deictic 0.5.0 → 0.7.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/API.md +150 -37
- package/README.md +4 -3
- package/dist/annotations/client.d.ts +1 -1
- package/dist/annotations/client.d.ts.map +1 -1
- package/dist/annotations/client.js +161 -176
- package/dist/annotations/client.js.map +1 -1
- package/dist/annotations/index.d.ts +2 -11
- package/dist/client/index.d.ts +7 -6
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1007 -192
- package/dist/client/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/recommended/index.d.ts +2 -2
- package/dist/recordings/client.d.ts.map +1 -1
- package/dist/recordings/client.js +82 -153
- package/dist/recordings/client.js.map +1 -1
- package/dist/screenshots/client.d.ts.map +1 -1
- package/dist/shared/annotations.js +3 -4
- package/dist/shared/annotations.js.map +1 -1
- package/dist/shared/board.js +1 -1
- package/dist/shared/client.js +45 -2
- package/dist/shared/client.js.map +1 -1
- package/dist/shared/component.js +62 -0
- package/dist/shared/component.js.map +1 -0
- package/dist/shared/dom.js +79 -0
- package/dist/shared/dom.js.map +1 -0
- package/dist/shared/drawer.js +217 -0
- package/dist/shared/drawer.js.map +1 -0
- package/dist/shared/endpoints.js +34 -8
- package/dist/shared/endpoints.js.map +1 -1
- package/dist/shared/find.js +2 -1
- package/dist/shared/find.js.map +1 -1
- package/dist/shared/index.d.ts +124 -11
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index2.d.ts +9 -19
- package/dist/shared/index2.d.ts.map +1 -1
- package/dist/shared/index7.d.ts +105 -26
- package/dist/shared/index7.d.ts.map +1 -1
- package/dist/shared/index9.d.ts +1 -1
- package/dist/shared/init.js +12 -10
- package/dist/shared/init.js.map +1 -1
- package/dist/shared/integration.d.ts +1 -1
- package/dist/shared/packages.js +1 -1
- package/dist/shared/recording.js +31 -3
- package/dist/shared/recording.js.map +1 -1
- package/dist/shared/src.js.map +1 -1
- package/dist/shared/task.js +72 -21
- package/dist/shared/task.js.map +1 -1
- package/dist/shared/tasks.js +330 -166
- package/dist/shared/tasks.js.map +1 -1
- package/dist/shared/vb.js +1 -1
- package/dist/shared/voice2.js +6 -4
- package/dist/shared/voice2.js.map +1 -1
- package/dist/shared/watch.js +14 -14
- package/dist/shared/watch.js.map +1 -1
- package/dist/tailwind/index.js +6 -2
- package/dist/tailwind/index.js.map +1 -1
- package/dist/tasks/client.d.ts +2 -2
- package/dist/tasks/client.d.ts.map +1 -1
- package/dist/tasks/client.js +1829 -742
- package/dist/tasks/client.js.map +1 -1
- package/dist/tasks/index.d.ts +2 -2
- package/dist/voice/client.d.ts.map +1 -1
- package/dist/voice/client.js +154 -57
- package/dist/voice/client.js.map +1 -1
- package/package.json +1 -1
- package/skills/deictic/SKILL.md +22 -28
- package/src/cli/find.ts +3 -1
- package/src/cli/init.ts +13 -11
- package/src/cli/recording.ts +34 -3
- package/src/cli/task.ts +94 -23
- package/src/cli/voice.ts +9 -4
- package/src/cli/watch.ts +14 -13
- package/src/client/away.ts +3 -1
- package/src/client/component.ts +98 -0
- package/src/client/dom.ts +70 -0
- package/src/client/drawer.ts +258 -0
- package/src/client/index.ts +220 -128
- package/src/client/lightbox.ts +8 -8
- package/src/client/lighting.ts +279 -0
- package/src/client/style.ts +263 -44
- package/src/client/tools.ts +279 -0
- package/src/client/tooltip.ts +25 -5
- package/src/client/tray.ts +48 -0
- package/src/index.ts +121 -10
- package/src/plugins/annotations/client.ts +103 -129
- package/src/plugins/annotations/draw.ts +68 -72
- package/src/plugins/annotations/index.ts +12 -19
- package/src/plugins/recordings/client.ts +89 -167
- package/src/plugins/screenshots/client.ts +53 -2
- package/src/plugins/tailwind/index.ts +6 -2
- package/src/plugins/tasks/client.ts +219 -749
- package/src/plugins/tasks/composer.ts +797 -0
- package/src/plugins/tasks/drawer.ts +516 -0
- package/src/plugins/tasks/index.ts +459 -192
- package/src/plugins/tasks/pins.ts +275 -0
- package/src/plugins/tasks/store.ts +132 -0
- package/src/plugins/voice/client.ts +96 -5
- package/src/tools/endpoints.ts +18 -7
- package/src/tools/source.ts +25 -5
- package/skills/deictic/references/recordings.md +0 -13
- package/skills/deictic/references/tasks.md +0 -21
- package/skills/deictic/references/watch.md +0 -17
package/src/client/style.ts
CHANGED
|
@@ -17,79 +17,77 @@ export const STYLE = `
|
|
|
17
17
|
}
|
|
18
18
|
/* The host takes no room in the page: everything in it is fixed, so nothing of deictic's moves or scrolls it. */
|
|
19
19
|
:host(deictic-overlay) { display: contents; }
|
|
20
|
-
.
|
|
20
|
+
/* What's under the pointer inside the lit element, where that differs. */
|
|
21
|
+
.inner {
|
|
21
22
|
position: fixed;
|
|
22
23
|
display: none;
|
|
23
24
|
z-index: 2147483646;
|
|
24
25
|
pointer-events: none;
|
|
25
26
|
box-sizing: border-box;
|
|
26
|
-
outline:
|
|
27
|
-
background: rgb(18 179 88 / 0.1);
|
|
28
|
-
}
|
|
29
|
-
.box.shown { display: block; }
|
|
30
|
-
.box.inner { outline: 1px dashed var(--deictic-accent); background: none; }
|
|
31
|
-
/* The element the popup is open on: dashed and off it a little, with no fill, so what's tried on it shows as it is. */
|
|
32
|
-
.box.on { outline: 1px dashed var(--deictic-accent); border-radius: 4px; background: none; }
|
|
33
|
-
.label {
|
|
34
|
-
position: absolute;
|
|
35
|
-
left: -2px;
|
|
36
|
-
bottom: 100%;
|
|
37
|
-
padding: 1px 6px;
|
|
38
|
-
font: 12px/1.5 ui-monospace, monospace;
|
|
39
|
-
white-space: nowrap;
|
|
40
|
-
color: var(--deictic-on-accent);
|
|
41
|
-
background: var(--deictic-accent);
|
|
27
|
+
outline: 1px dashed var(--deictic-accent);
|
|
42
28
|
}
|
|
43
|
-
.
|
|
29
|
+
.inner.shown { display: block; }
|
|
30
|
+
/* Glass, over a page that's dimmed around what it's about. */
|
|
44
31
|
.panel {
|
|
32
|
+
--deictic-line: rgb(255 255 255 / 0.14);
|
|
45
33
|
position: fixed;
|
|
46
34
|
z-index: 2147483647;
|
|
47
|
-
width: min(
|
|
35
|
+
width: min(440px, calc(100vw - 16px));
|
|
48
36
|
max-height: 60vh;
|
|
49
37
|
display: flex;
|
|
50
38
|
flex-direction: column;
|
|
51
39
|
box-sizing: border-box;
|
|
52
|
-
border: 1px solid
|
|
53
|
-
border-radius:
|
|
54
|
-
box-shadow: 0
|
|
40
|
+
border: 1px solid rgb(255 255 255 / 0.1);
|
|
41
|
+
border-radius: 14px;
|
|
42
|
+
box-shadow: 0 0 0 1px rgb(0 0 0 / 0.4), 0 24px 64px -12px rgb(0 0 0 / 0.55), 0 0 56px -12px rgb(18 179 88 / 0.35),
|
|
43
|
+
inset 0 1px 0 rgb(255 255 255 / 0.08);
|
|
55
44
|
font: 13px/1.4 system-ui, sans-serif;
|
|
56
45
|
color: var(--deictic-fg);
|
|
57
|
-
background:
|
|
58
|
-
|
|
59
|
-
.panel.pinned { position: relative; z-index: auto; max-height: none; }
|
|
60
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
61
|
-
.panel:not(.pinned) { animation: deictic-in 0.12s ease-out; }
|
|
46
|
+
background: linear-gradient(rgb(39 39 42 / 0.9), rgb(24 24 27 / 0.94));
|
|
47
|
+
backdrop-filter: blur(24px) saturate(1.8);
|
|
62
48
|
}
|
|
49
|
+
.panel.pinned { position: relative; z-index: auto; width: min(440px, 100%); max-height: none; }
|
|
63
50
|
@keyframes deictic-in {
|
|
64
51
|
from { opacity: 0; translate: 0 4px; }
|
|
65
52
|
}
|
|
66
53
|
.head {
|
|
54
|
+
position: relative;
|
|
67
55
|
display: flex;
|
|
68
|
-
align-items:
|
|
56
|
+
align-items: center;
|
|
69
57
|
gap: 2px;
|
|
70
|
-
padding:
|
|
58
|
+
padding: 8px 8px 6px;
|
|
71
59
|
}
|
|
72
60
|
/* Over the page the head is what the popup is dragged by; no touch scrolling starts there. */
|
|
73
61
|
.panel:not(.pinned) .head { cursor: grab; touch-action: none; user-select: none; }
|
|
74
62
|
.panel.dragging .head, .panel.dragging .head button { cursor: grabbing; }
|
|
75
63
|
.head .tab {
|
|
64
|
+
position: relative;
|
|
76
65
|
border: 0;
|
|
77
|
-
border-
|
|
78
|
-
|
|
79
|
-
padding: 4px 8px;
|
|
66
|
+
border-radius: 8px;
|
|
67
|
+
padding: 4px 10px;
|
|
80
68
|
font-weight: 600;
|
|
81
69
|
color: var(--deictic-muted);
|
|
82
70
|
}
|
|
83
71
|
.head .tab:hover { color: var(--deictic-fg); }
|
|
84
|
-
.head .tab[aria-selected='true'] { color: var(--deictic-fg);
|
|
85
|
-
|
|
72
|
+
.head .tab[aria-selected='true'] { color: var(--deictic-fg); }
|
|
73
|
+
/* A pill behind the shown tab, slid to the next one shown. */
|
|
74
|
+
.head .thumb {
|
|
75
|
+
position: absolute;
|
|
76
|
+
left: 0;
|
|
77
|
+
top: 8px;
|
|
78
|
+
bottom: 6px;
|
|
79
|
+
border-radius: 8px;
|
|
80
|
+
background: rgb(255 255 255 / 0.1);
|
|
81
|
+
box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.06);
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
}
|
|
84
|
+
.head .end { margin-left: auto; }
|
|
86
85
|
.bar {
|
|
87
86
|
display: flex;
|
|
88
87
|
align-items: center;
|
|
89
88
|
gap: 2px;
|
|
90
|
-
padding:
|
|
91
|
-
border-
|
|
92
|
-
border-bottom: 1px solid var(--deictic-line);
|
|
89
|
+
padding: 0 10px 8px 12px;
|
|
90
|
+
border-bottom: 1px solid rgb(255 255 255 / 0.08);
|
|
93
91
|
}
|
|
94
92
|
.bar .where {
|
|
95
93
|
display: inline-flex;
|
|
@@ -102,10 +100,208 @@ export const STYLE = `
|
|
|
102
100
|
text-decoration: none;
|
|
103
101
|
}
|
|
104
102
|
.bar .where span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
103
|
+
.bar .where .tag { flex: none; color: var(--deictic-accent); }
|
|
105
104
|
.bar .where svg { flex: none; }
|
|
106
105
|
.bar .where:hover, .bar .where:focus-visible { color: var(--deictic-fg); }
|
|
107
106
|
.bar .where:hover span { text-decoration: underline; }
|
|
108
107
|
.bar .absent { flex: none; margin-right: 6px; font-size: 12px; color: var(--deictic-muted); }
|
|
108
|
+
/* The page dims around the element (lighting.ts), by a shadow far wider than any window. */
|
|
109
|
+
.veil {
|
|
110
|
+
position: fixed;
|
|
111
|
+
z-index: 2147483644;
|
|
112
|
+
box-sizing: border-box;
|
|
113
|
+
pointer-events: none;
|
|
114
|
+
box-shadow: 0 0 0 200vmax rgb(9 9 11 / 0.5);
|
|
115
|
+
opacity: 0;
|
|
116
|
+
visibility: hidden;
|
|
117
|
+
transition: opacity 0.2s, visibility 0s 0.2s;
|
|
118
|
+
}
|
|
119
|
+
/* A moment late: Alt is pressed for much else, and a page that dimmed with every press would flicker. */
|
|
120
|
+
.veil.shown { opacity: 1; visibility: visible; transition: opacity 0.3s 0.08s; }
|
|
121
|
+
.veil.shown.lifted { opacity: 0; transition: opacity 0.6s; }
|
|
122
|
+
.aim {
|
|
123
|
+
position: fixed;
|
|
124
|
+
inset: 0;
|
|
125
|
+
z-index: 2147483646;
|
|
126
|
+
pointer-events: none;
|
|
127
|
+
opacity: 0;
|
|
128
|
+
visibility: hidden;
|
|
129
|
+
transition: opacity 0.12s, visibility 0s 0.12s;
|
|
130
|
+
}
|
|
131
|
+
.aim.shown { opacity: 1; visibility: visible; transition: opacity 0.12s; }
|
|
132
|
+
.ring {
|
|
133
|
+
position: absolute;
|
|
134
|
+
box-sizing: border-box;
|
|
135
|
+
border: 1.5px solid var(--deictic-accent);
|
|
136
|
+
box-shadow: 0 0 0 4px rgb(18 179 88 / 0.14), 0 0 32px rgb(18 179 88 / 0.5), inset 0 0 24px rgb(18 179 88 / 0.1);
|
|
137
|
+
}
|
|
138
|
+
/* From the element's edges across the window: what it lines up with, anywhere on the page. */
|
|
139
|
+
.guide { position: absolute; left: 0; top: 0; opacity: 0.35; }
|
|
140
|
+
.guide.gx { width: 1px; height: 100%; background: linear-gradient(transparent, var(--deictic-accent) 20% 80%, transparent); }
|
|
141
|
+
.guide.gy { width: 100%; height: 1px; background: linear-gradient(90deg, transparent, var(--deictic-accent) 20% 80%, transparent); }
|
|
142
|
+
.caption {
|
|
143
|
+
position: absolute;
|
|
144
|
+
left: -1.5px;
|
|
145
|
+
bottom: calc(100% + 8px);
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
gap: 8px;
|
|
149
|
+
padding: 3px 10px 3px 3px;
|
|
150
|
+
border: 1px solid rgb(255 255 255 / 0.12);
|
|
151
|
+
border-radius: 999px;
|
|
152
|
+
font: 12px/20px ui-monospace, monospace;
|
|
153
|
+
white-space: nowrap;
|
|
154
|
+
color: var(--deictic-fg);
|
|
155
|
+
background: rgb(24 24 27 / 0.86);
|
|
156
|
+
backdrop-filter: blur(12px) saturate(1.6);
|
|
157
|
+
box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
|
|
158
|
+
}
|
|
159
|
+
.caption.below { top: calc(100% + 8px); bottom: auto; }
|
|
160
|
+
.caption .tag { padding: 0 8px; border-radius: 999px; font-weight: 600; color: var(--deictic-on-accent); background: var(--deictic-accent); }
|
|
161
|
+
.caption .dim { color: var(--deictic-muted); }
|
|
162
|
+
.caption .opens { padding-left: 8px; border-left: 1px solid rgb(255 255 255 / 0.16); font: 600 12px/20px system-ui, sans-serif; color: var(--deictic-accent); }
|
|
163
|
+
.lit { position: fixed; inset: 0; z-index: 2147483646; display: none; pointer-events: none; }
|
|
164
|
+
.lit.shown { display: block; }
|
|
165
|
+
.lit svg { display: block; width: 100%; height: 100%; fill: none; stroke: var(--deictic-accent); stroke-linecap: round; }
|
|
166
|
+
.lit .halo { stroke-width: 7; opacity: 0.16; }
|
|
167
|
+
.lit .lock, .lit .tether { stroke-width: 1.5; }
|
|
168
|
+
.lit .flow { stroke: #eafff3; stroke-width: 2; opacity: 0; }
|
|
169
|
+
.lit circle { fill: var(--deictic-accent); stroke: none; }
|
|
170
|
+
.lit:not(.tied) path, .lit:not(.tied) circle { display: none; }
|
|
171
|
+
.pulse {
|
|
172
|
+
position: fixed;
|
|
173
|
+
z-index: 2147483646;
|
|
174
|
+
box-sizing: border-box;
|
|
175
|
+
pointer-events: none;
|
|
176
|
+
outline: 2px solid var(--deictic-accent);
|
|
177
|
+
animation: deictic-pulse 0.5s ease-out forwards;
|
|
178
|
+
}
|
|
179
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
180
|
+
.head .thumb.moves { transition: left 0.22s cubic-bezier(0.3, 0.7, 0.2, 1), width 0.22s cubic-bezier(0.3, 0.7, 0.2, 1); }
|
|
181
|
+
/* The light goes from one element to the next, not out and on again. */
|
|
182
|
+
.veil.shown.glide {
|
|
183
|
+
transition: opacity 0.3s, left 0.24s cubic-bezier(0.3, 0.7, 0.2, 1), top 0.24s cubic-bezier(0.3, 0.7, 0.2, 1),
|
|
184
|
+
width 0.24s cubic-bezier(0.3, 0.7, 0.2, 1), height 0.24s cubic-bezier(0.3, 0.7, 0.2, 1), border-radius 0.24s;
|
|
185
|
+
}
|
|
186
|
+
.aim.glide .ring {
|
|
187
|
+
transition: left 0.24s cubic-bezier(0.3, 0.7, 0.2, 1), top 0.24s cubic-bezier(0.3, 0.7, 0.2, 1),
|
|
188
|
+
width 0.24s cubic-bezier(0.3, 0.7, 0.2, 1), height 0.24s cubic-bezier(0.3, 0.7, 0.2, 1), border-radius 0.24s;
|
|
189
|
+
}
|
|
190
|
+
.aim.glide .guide { transition: translate 0.24s cubic-bezier(0.3, 0.7, 0.2, 1); }
|
|
191
|
+
.panel:not(.pinned) { animation: deictic-rise 0.32s cubic-bezier(0.2, 0.9, 0.25, 1.1) backwards; }
|
|
192
|
+
/* Once, as the popup opens: the line drawn out to the popup, with a light along it. */
|
|
193
|
+
.lit .tether, .lit path.halo { stroke-dasharray: 1; animation: deictic-draw 0.4s 0.1s ease-out backwards; }
|
|
194
|
+
.lit .flow { stroke-dasharray: 0.14 1; animation: deictic-flow 0.8s 0.45s ease-out; }
|
|
195
|
+
.lit circle:last-of-type { animation: deictic-in 0.2s 0.45s backwards; }
|
|
196
|
+
}
|
|
197
|
+
@keyframes deictic-rise {
|
|
198
|
+
from { opacity: 0; scale: 0.94; filter: blur(6px); }
|
|
199
|
+
}
|
|
200
|
+
@keyframes deictic-draw {
|
|
201
|
+
from { stroke-dashoffset: 1; }
|
|
202
|
+
}
|
|
203
|
+
@keyframes deictic-flow {
|
|
204
|
+
from { stroke-dashoffset: 0.14; opacity: 1; }
|
|
205
|
+
to { stroke-dashoffset: -1; opacity: 0; }
|
|
206
|
+
}
|
|
207
|
+
@keyframes deictic-pulse {
|
|
208
|
+
to { outline-offset: 14px; outline-color: transparent; }
|
|
209
|
+
}
|
|
210
|
+
/* The tool panel (tools.ts): the plugins' tools in a bar on an edge of the window, there while it's of use. */
|
|
211
|
+
.tool-panel {
|
|
212
|
+
position: fixed;
|
|
213
|
+
z-index: 2147483647;
|
|
214
|
+
display: flex;
|
|
215
|
+
align-items: center;
|
|
216
|
+
gap: 6px;
|
|
217
|
+
padding: 6px 8px;
|
|
218
|
+
border: 1px solid rgb(255 255 255 / 0.1);
|
|
219
|
+
border-radius: 12px;
|
|
220
|
+
font: 13px/1.4 system-ui, sans-serif;
|
|
221
|
+
color: var(--deictic-fg);
|
|
222
|
+
background: linear-gradient(rgb(39 39 42 / 0.92), rgb(24 24 27 / 0.96));
|
|
223
|
+
backdrop-filter: blur(24px) saturate(1.8);
|
|
224
|
+
box-shadow: 0 0 0 1px rgb(0 0 0 / 0.4), 0 16px 40px -8px rgb(0 0 0 / 0.55), inset 0 1px 0 rgb(255 255 255 / 0.08);
|
|
225
|
+
user-select: none;
|
|
226
|
+
opacity: 0;
|
|
227
|
+
visibility: hidden;
|
|
228
|
+
transition: opacity 0.15s, visibility 0s 0.15s;
|
|
229
|
+
}
|
|
230
|
+
.tool-panel.shown { opacity: 1; visibility: visible; transition: opacity 0.15s; }
|
|
231
|
+
.tool-panel.vertical, .tool-panel.vertical .tool-group { flex-direction: column; }
|
|
232
|
+
.tool-panel .tool-group { display: flex; align-items: center; gap: 4px; }
|
|
233
|
+
/* Groups of one section side by side, as close as the tools in a group are: the bar's gap is for between sections. */
|
|
234
|
+
.tool-panel .tool-group + .tool-group { margin-left: -2px; }
|
|
235
|
+
.tool-panel.vertical .tool-group + .tool-group { margin: -2px 0 0; }
|
|
236
|
+
.tool-panel .grip { display: inline-flex; padding: 2px; color: var(--deictic-muted); cursor: grab; touch-action: none; }
|
|
237
|
+
.tool-panel .grip:active { cursor: grabbing; }
|
|
238
|
+
.tool-panel .grip svg { width: 16px; height: 16px; }
|
|
239
|
+
.tool-panel .sep { align-self: stretch; width: 1px; background: rgb(255 255 255 / 0.12); }
|
|
240
|
+
.tool-panel.vertical .sep { width: auto; height: 1px; }
|
|
241
|
+
/* A group with nothing to show now (a plugin's, hidden) has no line of its own either. */
|
|
242
|
+
.tool-panel .sep:has(+ [hidden]) { display: none; }
|
|
243
|
+
.tool-panel [hidden] { display: none; }
|
|
244
|
+
.tool-panel button.icon { width: 28px; height: 26px; border-radius: 6px; color: var(--deictic-fg); }
|
|
245
|
+
.tool-panel button.icon svg { width: 16px; height: 16px; }
|
|
246
|
+
.tool-panel button[aria-pressed='true'], .tool-panel button[aria-pressed='true']:hover {
|
|
247
|
+
color: var(--deictic-on-accent);
|
|
248
|
+
background: var(--deictic-accent);
|
|
249
|
+
}
|
|
250
|
+
.tool-panel button.problem { color: var(--deictic-problem); }
|
|
251
|
+
/*
|
|
252
|
+
* The drawer (drawer.ts): on the window's side, as tall as what's in it, there while it's of use. Its
|
|
253
|
+
* sections are the plugins', each with its own styles; these are what they share.
|
|
254
|
+
*/
|
|
255
|
+
.drawer {
|
|
256
|
+
position: fixed;
|
|
257
|
+
top: 12px;
|
|
258
|
+
right: 12px;
|
|
259
|
+
z-index: 2147483646;
|
|
260
|
+
display: flex;
|
|
261
|
+
flex-direction: column;
|
|
262
|
+
box-sizing: border-box;
|
|
263
|
+
width: 296px;
|
|
264
|
+
max-width: calc(100vw - 24px);
|
|
265
|
+
max-height: calc(100vh - 24px);
|
|
266
|
+
border: 1px solid rgb(255 255 255 / 0.1);
|
|
267
|
+
border-radius: 12px;
|
|
268
|
+
font: 12px/1.4 system-ui, sans-serif;
|
|
269
|
+
color: var(--deictic-fg);
|
|
270
|
+
background: linear-gradient(rgb(39 39 42 / 0.92), rgb(24 24 27 / 0.96));
|
|
271
|
+
backdrop-filter: blur(24px) saturate(1.8);
|
|
272
|
+
box-shadow: 0 0 0 1px rgb(0 0 0 / 0.4), 0 16px 40px -8px rgb(0 0 0 / 0.55), inset 0 1px 0 rgb(255 255 255 / 0.08);
|
|
273
|
+
opacity: 0;
|
|
274
|
+
visibility: hidden;
|
|
275
|
+
transition: opacity 0.15s, visibility 0s 0.15s;
|
|
276
|
+
}
|
|
277
|
+
.drawer.left { right: auto; left: 12px; }
|
|
278
|
+
.drawer.shown { opacity: 1; visibility: visible; transition: opacity 0.15s; }
|
|
279
|
+
.drawer.emptied { transition: none; }
|
|
280
|
+
.drawer [hidden] { display: none; }
|
|
281
|
+
.drawer-sections, .drawer-view { display: flex; flex-direction: column; gap: 12px; min-height: 0; padding: 10px; overflow-y: auto; scrollbar-width: thin; }
|
|
282
|
+
.drawer-view { gap: 8px; }
|
|
283
|
+
.drawer-section h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font: 600 10px/1.4 system-ui, sans-serif; letter-spacing: 0.06em; text-transform: uppercase; color: var(--deictic-muted); }
|
|
284
|
+
.drawer-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
|
|
285
|
+
.drawer-row { display: flex; align-items: center; gap: 2px; padding-right: 4px; border: 1px solid rgb(255 255 255 / 0.08); border-radius: 8px; background: rgb(255 255 255 / 0.04); }
|
|
286
|
+
.drawer-row:hover { border-color: rgb(255 255 255 / 0.16); }
|
|
287
|
+
/* A row one height whether it has a picture, and the picture one size, loaded or not: nothing moves as one comes. */
|
|
288
|
+
.drawer-open { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; height: 32px; padding: 0 6px; border: 0; text-align: left; font-size: 12px; }
|
|
289
|
+
.drawer-open img { flex: none; display: block; width: 36px; height: 24px; object-fit: cover; border-radius: 4px; background: rgb(255 255 255 / 0.08); }
|
|
290
|
+
.drawer-open svg { flex: none; width: 12px; height: 12px; }
|
|
291
|
+
.drawer-head { display: flex; align-items: center; gap: 6px; margin: -4px 24px 0 -4px; }
|
|
292
|
+
/* Folding it away: the button in its corner, and the pill it folds to, which counts what's in it. */
|
|
293
|
+
.drawer-fold { position: absolute; top: 6px; right: 6px; z-index: 1; width: 22px; height: 22px; border-radius: 6px; color: var(--deictic-muted); }
|
|
294
|
+
.drawer-fold svg { width: 14px; height: 14px; }
|
|
295
|
+
.drawer-sections > .drawer-section:first-child h3 { margin-right: 22px; }
|
|
296
|
+
.drawer-pill { display: none; align-items: center; gap: 6px; padding: 6px 10px; border: 0; border-radius: inherit; font: 600 12px/1 system-ui, sans-serif; color: var(--deictic-fg); }
|
|
297
|
+
.drawer-pill svg { width: 16px; height: 16px; }
|
|
298
|
+
.drawer-pill.news span { padding: 2px 6px; border-radius: 8px; color: var(--deictic-on-accent); background: var(--deictic-accent); }
|
|
299
|
+
.drawer.folded { width: auto; }
|
|
300
|
+
.drawer.folded > :not(.drawer-pill) { display: none; }
|
|
301
|
+
.drawer.folded .drawer-pill { display: inline-flex; }
|
|
302
|
+
.drawer-title { font-weight: 600; }
|
|
303
|
+
/* What a tool that picks a point takes the pointer with, over the page and under the popup. */
|
|
304
|
+
.tool-surface { position: fixed; inset: 0; z-index: 2147483645; cursor: crosshair; }
|
|
109
305
|
.lightbox {
|
|
110
306
|
position: fixed;
|
|
111
307
|
inset: 0;
|
|
@@ -164,10 +360,11 @@ export const STYLE = `
|
|
|
164
360
|
padding: 0;
|
|
165
361
|
border: 1px solid var(--deictic-line);
|
|
166
362
|
border-radius: 50%;
|
|
167
|
-
|
|
168
|
-
|
|
363
|
+
display: grid;
|
|
364
|
+
place-items: center;
|
|
169
365
|
background: var(--deictic-bg);
|
|
170
366
|
}
|
|
367
|
+
.lb-prev svg, .lb-next svg { width: 20px; height: 20px; }
|
|
171
368
|
.lb-prev { left: 16px; }
|
|
172
369
|
.lb-next { right: 16px; }
|
|
173
370
|
.lightbox.pinned { position: relative; inset: auto; z-index: auto; display: block; padding: 0 64px; }
|
|
@@ -196,6 +393,23 @@ export const STYLE = `
|
|
|
196
393
|
transition: opacity 0.12s;
|
|
197
394
|
}
|
|
198
395
|
.tip.shown { visibility: visible; opacity: 1; }
|
|
396
|
+
/* A control's keys, after its name: caps, as on a keyboard. */
|
|
397
|
+
.tip kbd {
|
|
398
|
+
display: inline-block;
|
|
399
|
+
box-sizing: border-box;
|
|
400
|
+
min-width: 18px;
|
|
401
|
+
margin-left: 3px;
|
|
402
|
+
padding: 0 4px;
|
|
403
|
+
border: 1px solid var(--deictic-line);
|
|
404
|
+
border-bottom-width: 2px;
|
|
405
|
+
border-radius: 4px;
|
|
406
|
+
font: 11px/15px ui-monospace, monospace;
|
|
407
|
+
text-align: center;
|
|
408
|
+
color: var(--deictic-fg);
|
|
409
|
+
background: rgb(255 255 255 / 0.08);
|
|
410
|
+
}
|
|
411
|
+
.tip kbd:first-of-type { margin-left: 6px; }
|
|
412
|
+
.tip kbd:first-child { margin-left: 0; }
|
|
199
413
|
button {
|
|
200
414
|
font: inherit;
|
|
201
415
|
color: inherit;
|
|
@@ -223,22 +437,27 @@ button.icon {
|
|
|
223
437
|
}
|
|
224
438
|
button.icon svg { width: 14px; height: 14px; }
|
|
225
439
|
button.icon:hover:not(:disabled) { color: var(--deictic-fg); background: rgb(255 255 255 / 0.08); }
|
|
226
|
-
button.primary {
|
|
440
|
+
button.primary {
|
|
441
|
+
background: var(--deictic-accent);
|
|
442
|
+
border-color: var(--deictic-accent);
|
|
443
|
+
color: var(--deictic-on-accent);
|
|
444
|
+
box-shadow: 0 4px 16px -4px rgb(18 179 88 / 0.6);
|
|
445
|
+
}
|
|
227
446
|
input, textarea {
|
|
228
447
|
box-sizing: border-box;
|
|
229
448
|
width: 100%;
|
|
230
449
|
font: 12px ui-monospace, monospace;
|
|
231
450
|
color: inherit;
|
|
232
|
-
background:
|
|
451
|
+
background: rgb(0 0 0 / 0.35);
|
|
233
452
|
border: 1px solid var(--deictic-line);
|
|
234
|
-
border-radius:
|
|
453
|
+
border-radius: 6px;
|
|
235
454
|
padding: 4px 6px;
|
|
236
455
|
}
|
|
237
456
|
input:focus, textarea:focus { outline: 1px solid var(--deictic-accent); }
|
|
238
457
|
code { font: 12px ui-monospace, monospace; }
|
|
239
458
|
/* Border-box, as the popup holds the body's height by its whole box while a tab reads. */
|
|
240
|
-
.body { box-sizing: border-box; padding:
|
|
241
|
-
.status { padding: 0
|
|
459
|
+
.body { box-sizing: border-box; padding: 12px; overflow: auto; }
|
|
460
|
+
.status { padding: 0 12px 10px; font-size: 12px; color: var(--deictic-muted); }
|
|
242
461
|
.status:empty { display: none; }
|
|
243
462
|
.status.problem { color: var(--deictic-problem); }
|
|
244
463
|
`;
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tool panel: a bar of the plugins' tools, docked to an edge of the window, that its grip drags to any other.
|
|
3
|
+
* It shows while a shortcut's keys are held, as the page dims to point on, and stays for as long as it's in use: a
|
|
4
|
+
* tool has the page (`hold`), something goes on that its controls end (`keep`, a recording), or the pointer is on it.
|
|
5
|
+
*
|
|
6
|
+
* A plugin adds its controls as a group (`add`), each a button named by its `title`, with its key in
|
|
7
|
+
* `aria-keyshortcuts`: the panel hears the keys, so a tool's key is its button's click. One tool has the page at a
|
|
8
|
+
* time. The pointer, the panel's own, is none of them: the page is the page's.
|
|
9
|
+
*/
|
|
10
|
+
import type { Spot, ToolPanel } from '#src/index.ts';
|
|
11
|
+
|
|
12
|
+
import { controlFor, div } from './dom.ts';
|
|
13
|
+
|
|
14
|
+
type Edge = 'top' | 'bottom' | 'left' | 'right';
|
|
15
|
+
/** Where the bar is: the edge it's docked to, and how far along it, from 0 to 1. */
|
|
16
|
+
interface Dock {
|
|
17
|
+
edge: Edge;
|
|
18
|
+
along: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const DOCK = 'deictic:tools';
|
|
22
|
+
const MARGIN = 12;
|
|
23
|
+
/** How long the panel outlasts the keys, in milliseconds: time to get the pointer to it. */
|
|
24
|
+
const LINGER = 600;
|
|
25
|
+
|
|
26
|
+
const svg = (paths: string) =>
|
|
27
|
+
`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${paths}</svg>`;
|
|
28
|
+
const GRIP = svg(
|
|
29
|
+
'<circle cx="9" cy="6" r="1"/><circle cx="15" cy="6" r="1"/><circle cx="9" cy="12" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="9" cy="18" r="1"/><circle cx="15" cy="18" r="1"/>',
|
|
30
|
+
);
|
|
31
|
+
const POINTER = svg('<path d="M5 3l14 7-6 2-2 6z"/>');
|
|
32
|
+
|
|
33
|
+
function storedDock(): Dock {
|
|
34
|
+
try {
|
|
35
|
+
const dock = JSON.parse(localStorage.getItem(DOCK) ?? 'null') as Dock | null;
|
|
36
|
+
if (dock !== null && ['top', 'bottom', 'left', 'right'].includes(dock.edge) && dock.along >= 0 && dock.along <= 1) return dock;
|
|
37
|
+
} catch {
|
|
38
|
+
// Storage can be off, or hold something else: the default, then.
|
|
39
|
+
}
|
|
40
|
+
return { edge: 'bottom', along: 0.5 };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Puts the bar on its edge, laid out along it, and how far along. */
|
|
44
|
+
function place(bar: HTMLElement, { edge, along }: Dock): void {
|
|
45
|
+
const vertical = edge === 'left' || edge === 'right';
|
|
46
|
+
bar.classList.toggle('vertical', vertical);
|
|
47
|
+
// Said too, for whatever reads it: the overlay's tooltip puts a tip beside a tool of a bar that runs down.
|
|
48
|
+
bar.setAttribute('aria-orientation', vertical ? 'vertical' : 'horizontal');
|
|
49
|
+
const { width, height } = bar.getBoundingClientRect();
|
|
50
|
+
const across = (room: number, size: number) => `${MARGIN + along * Math.max(0, room - size - MARGIN * 2)}px`;
|
|
51
|
+
Object.assign(bar.style, {
|
|
52
|
+
left: edge === 'left' ? `${MARGIN}px` : edge === 'right' ? `${innerWidth - width - MARGIN}px` : across(innerWidth, width),
|
|
53
|
+
top: edge === 'top' ? `${MARGIN}px` : edge === 'bottom' ? `${innerHeight - height - MARGIN}px` : across(innerHeight, height),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Dragging the bar by its grip, freely; let go, it docks to the nearest edge. */
|
|
58
|
+
function draggable(bar: HTMLElement, grip: HTMLElement, docked: (dock: Dock) => void): void {
|
|
59
|
+
grip.addEventListener('pointerdown', (e) => {
|
|
60
|
+
if (e.button !== 0) return;
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
grip.setPointerCapture(e.pointerId);
|
|
63
|
+
const start = bar.getBoundingClientRect();
|
|
64
|
+
const dx = e.clientX - start.left;
|
|
65
|
+
const dy = e.clientY - start.top;
|
|
66
|
+
const move = (m: PointerEvent) => {
|
|
67
|
+
bar.style.left = `${m.clientX - dx}px`;
|
|
68
|
+
bar.style.top = `${m.clientY - dy}px`;
|
|
69
|
+
};
|
|
70
|
+
const up = () => {
|
|
71
|
+
grip.removeEventListener('pointermove', move);
|
|
72
|
+
const r = bar.getBoundingClientRect();
|
|
73
|
+
const x = r.left + r.width / 2;
|
|
74
|
+
const y = r.top + r.height / 2;
|
|
75
|
+
const away: [Edge, number][] = [
|
|
76
|
+
['left', x],
|
|
77
|
+
['right', innerWidth - x],
|
|
78
|
+
['top', y],
|
|
79
|
+
['bottom', innerHeight - y],
|
|
80
|
+
];
|
|
81
|
+
const [edge] = away.reduce((a, b) => (b[1] < a[1] ? b : a));
|
|
82
|
+
const ratio = (at: number, room: number) => Math.min(1, Math.max(0, at / room));
|
|
83
|
+
docked({ edge, along: edge === 'left' || edge === 'right' ? ratio(y, innerHeight) : ratio(x, innerWidth) });
|
|
84
|
+
};
|
|
85
|
+
grip.addEventListener('pointermove', move);
|
|
86
|
+
grip.addEventListener('pointerup', up, { once: true });
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface Tools extends ToolPanel {
|
|
91
|
+
/** Whether a shortcut's keys are held: the panel shows while they are. */
|
|
92
|
+
point: (on: boolean) => void;
|
|
93
|
+
/** The edge of the window it's docked to. */
|
|
94
|
+
edge: () => Edge;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface ToolsOptions {
|
|
98
|
+
/** The marked element at a point of the window, or the nearest to it, and where the point is in it. */
|
|
99
|
+
spotAt: (x: number, y: number) => Spot | undefined;
|
|
100
|
+
/** Whether a point of the page is being picked: what's under the pointer is lit meanwhile, as pointing lights it. */
|
|
101
|
+
aim: (on: boolean) => void;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function toolPanel(root: ShadowRoot, { spotAt, aim }: ToolsOptions): Tools {
|
|
105
|
+
const bar = div('tool-panel');
|
|
106
|
+
bar.setAttribute('role', 'toolbar');
|
|
107
|
+
bar.setAttribute('aria-label', 'deictic tools');
|
|
108
|
+
const grip = Object.assign(document.createElement('span'), { className: 'grip', title: 'Drag to any edge', innerHTML: GRIP });
|
|
109
|
+
const pointer = Object.assign(document.createElement('button'), {
|
|
110
|
+
type: 'button',
|
|
111
|
+
className: 'icon',
|
|
112
|
+
title: 'Pointer',
|
|
113
|
+
innerHTML: POINTER,
|
|
114
|
+
});
|
|
115
|
+
pointer.setAttribute('aria-label', 'Pointer');
|
|
116
|
+
pointer.setAttribute('aria-keyshortcuts', 'V');
|
|
117
|
+
bar.append(grip, pointer);
|
|
118
|
+
// Each plugin's group as it was added: where each goes is worked out from all of them (`order`), as a later one
|
|
119
|
+
// may belong before an earlier one.
|
|
120
|
+
const added: { group: HTMLElement; section?: string; last: boolean }[] = [];
|
|
121
|
+
/**
|
|
122
|
+
* The groups in their places: those of no section, then each section (in the order its first group came, its groups
|
|
123
|
+
* side by side), then those of none that asked to be `last`. Within a section, its `last` ones are at its end. A
|
|
124
|
+
* line between each.
|
|
125
|
+
*/
|
|
126
|
+
const order = () => {
|
|
127
|
+
const plain = added.filter((a) => a.section === undefined);
|
|
128
|
+
const sections = [...new Set(added.flatMap((a) => a.section ?? []))].map((name) => {
|
|
129
|
+
const of = added.filter((a) => a.section === name);
|
|
130
|
+
// Named on each, for a plugin's styles to tell its section's other groups by (a recording hides them).
|
|
131
|
+
for (const a of of) a.group.dataset.section = name;
|
|
132
|
+
return [...of.filter((a) => !a.last), ...of.filter((a) => a.last)].map((a) => a.group);
|
|
133
|
+
});
|
|
134
|
+
const blocks = [
|
|
135
|
+
...plain.filter((a) => !a.last).map((a) => [a.group]),
|
|
136
|
+
...sections,
|
|
137
|
+
...plain.filter((a) => a.last).map((a) => [a.group]),
|
|
138
|
+
];
|
|
139
|
+
for (const sep of bar.querySelectorAll(':scope > .sep')) sep.remove();
|
|
140
|
+
for (const block of blocks) bar.append(Object.assign(document.createElement('span'), { className: 'sep' }), ...block);
|
|
141
|
+
};
|
|
142
|
+
root.append(bar);
|
|
143
|
+
|
|
144
|
+
let dock = storedDock();
|
|
145
|
+
const replace = () => place(bar, dock);
|
|
146
|
+
addEventListener('resize', replace);
|
|
147
|
+
draggable(bar, grip, (next) => {
|
|
148
|
+
dock = next;
|
|
149
|
+
replace();
|
|
150
|
+
try {
|
|
151
|
+
localStorage.setItem(DOCK, JSON.stringify(dock));
|
|
152
|
+
} catch {
|
|
153
|
+
// Not kept, then: the next page has it at the bottom.
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
let pointing = false;
|
|
158
|
+
let over = false;
|
|
159
|
+
let keeps = 0;
|
|
160
|
+
// The tool that has the page, as what makes it let go.
|
|
161
|
+
let holder: (() => void) | undefined;
|
|
162
|
+
let leaving: ReturnType<typeof setTimeout> | undefined;
|
|
163
|
+
const shown = () => bar.classList.contains('shown');
|
|
164
|
+
const show = () => {
|
|
165
|
+
clearTimeout(leaving);
|
|
166
|
+
leaving = undefined;
|
|
167
|
+
pointer.setAttribute('aria-pressed', String(holder === undefined));
|
|
168
|
+
const on = pointing || over || keeps > 0 || holder !== undefined;
|
|
169
|
+
if (on === shown()) return;
|
|
170
|
+
if (!on) {
|
|
171
|
+
// Not at once: the keys are let go on the way to it.
|
|
172
|
+
leaving = setTimeout(() => bar.classList.remove('shown'), LINGER);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
bar.classList.add('shown');
|
|
176
|
+
// Its groups may have changed size since it was last shown.
|
|
177
|
+
replace();
|
|
178
|
+
};
|
|
179
|
+
bar.addEventListener('pointerenter', () => {
|
|
180
|
+
over = true;
|
|
181
|
+
show();
|
|
182
|
+
});
|
|
183
|
+
bar.addEventListener('pointerleave', () => {
|
|
184
|
+
over = false;
|
|
185
|
+
show();
|
|
186
|
+
});
|
|
187
|
+
// Laid out again as its groups change: a recording's controls come and go.
|
|
188
|
+
new ResizeObserver(() => shown() && replace()).observe(bar);
|
|
189
|
+
|
|
190
|
+
const letGo = () => {
|
|
191
|
+
const left = holder;
|
|
192
|
+
holder = undefined;
|
|
193
|
+
left?.();
|
|
194
|
+
show();
|
|
195
|
+
};
|
|
196
|
+
pointer.addEventListener('click', letGo);
|
|
197
|
+
|
|
198
|
+
window.addEventListener(
|
|
199
|
+
'keydown',
|
|
200
|
+
(e) => {
|
|
201
|
+
if (e.repeat || !(pointing || holder !== undefined)) return;
|
|
202
|
+
// A modal of ours has the keys while it's there: a note being typed, a picture drawn on, the lightbox.
|
|
203
|
+
if (root.querySelector('[data-deictic-modal]') !== null) return;
|
|
204
|
+
const [target] = e.composedPath();
|
|
205
|
+
const typing = target instanceof HTMLElement && target.matches('input, textarea, select, [contenteditable]');
|
|
206
|
+
// Esc is the tool's before the popup's, from the popup's field too (a task being typed while marks are drawn).
|
|
207
|
+
if (e.key === 'Escape' && holder !== undefined) {
|
|
208
|
+
e.preventDefault();
|
|
209
|
+
e.stopImmediatePropagation();
|
|
210
|
+
return letGo();
|
|
211
|
+
}
|
|
212
|
+
// What's typed in a field of ours is the field's (a note, a task's words). A field of the page's has its keys
|
|
213
|
+
// too while they're only held to point: Alt with a letter types one there. Once a tool has the page, the page
|
|
214
|
+
// isn't in use, and a field of its that still has the focus gets none.
|
|
215
|
+
if (typing && (holder === undefined || target.getRootNode() === root)) return;
|
|
216
|
+
// While the keys are held to point, a key alone is its tool whatever is held with it.
|
|
217
|
+
const control = controlFor(bar, e, pointing);
|
|
218
|
+
if (control === undefined) return;
|
|
219
|
+
e.preventDefault();
|
|
220
|
+
e.stopImmediatePropagation();
|
|
221
|
+
control.click();
|
|
222
|
+
},
|
|
223
|
+
true,
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
const hold: ToolPanel['hold'] = (left) => {
|
|
227
|
+
letGo();
|
|
228
|
+
holder = left;
|
|
229
|
+
show();
|
|
230
|
+
return () => {
|
|
231
|
+
if (holder !== left) return;
|
|
232
|
+
holder = undefined;
|
|
233
|
+
show();
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
return {
|
|
238
|
+
add: (group, options) => {
|
|
239
|
+
added.push({ group, ...(options?.section === undefined ? {} : { section: options.section }), last: options?.last === true });
|
|
240
|
+
order();
|
|
241
|
+
},
|
|
242
|
+
hold,
|
|
243
|
+
keep: () => {
|
|
244
|
+
keeps++;
|
|
245
|
+
show();
|
|
246
|
+
let kept = true;
|
|
247
|
+
return () => {
|
|
248
|
+
if (!kept) return;
|
|
249
|
+
kept = false;
|
|
250
|
+
keeps--;
|
|
251
|
+
show();
|
|
252
|
+
};
|
|
253
|
+
},
|
|
254
|
+
pick: () =>
|
|
255
|
+
new Promise((done) => {
|
|
256
|
+
// Over the page and under the popup and the panel: it takes the pointer, so the press is no click on the page.
|
|
257
|
+
const surface = div('tool-surface');
|
|
258
|
+
root.append(surface);
|
|
259
|
+
const end = (spot: Spot | undefined) => {
|
|
260
|
+
surface.remove();
|
|
261
|
+
aim(false);
|
|
262
|
+
done(spot);
|
|
263
|
+
};
|
|
264
|
+
const release = hold(() => end(undefined));
|
|
265
|
+
aim(true);
|
|
266
|
+
surface.addEventListener('pointerdown', (e) => {
|
|
267
|
+
if (e.button !== 0) return;
|
|
268
|
+
e.preventDefault();
|
|
269
|
+
release();
|
|
270
|
+
end(spotAt(e.clientX, e.clientY));
|
|
271
|
+
});
|
|
272
|
+
}),
|
|
273
|
+
point: (on) => {
|
|
274
|
+
pointing = on;
|
|
275
|
+
show();
|
|
276
|
+
},
|
|
277
|
+
edge: () => dock.edge,
|
|
278
|
+
};
|
|
279
|
+
}
|