@marver-design/marver 0.30.1 → 0.32.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 +70 -0
- package/README.md +12 -8
- package/dist/{anchor-check-Bv4o-R2T.mjs → anchor-check-DZtX13ly.mjs} +1 -1
- package/dist/{board-tree-BXR8dw4b.mjs → board-tree-DGj0HhEE.mjs} +6 -2
- package/dist/{boards-EH2onUXM.mjs → boards-Cim1GTKc.mjs} +32 -2
- package/dist/{boards-BeWtjGUM.mjs → boards-jHmEPLV7.mjs} +7 -7
- package/dist/{build-zWGXSzly.mjs → build-D2dHEWX-.mjs} +14 -17
- package/dist/{capture-DEtM4qm5.mjs → capture-HaS-1or8.mjs} +1 -1
- package/dist/cli.mjs +38 -20
- package/dist/{collab-BEAcXrBb.mjs → collab-D2NcrOB8.mjs} +53 -14
- package/dist/comment-actions-Bxf9Ld4g.mjs +351 -0
- package/dist/{comments-XNhMmSSu.mjs → comments-ocvsnt2j.mjs} +85 -10
- package/dist/config-B0YcFtqS.mjs +510 -0
- package/dist/{context-BUnFiyA3.mjs → context-Cj2TcC0H.mjs} +3 -3
- package/dist/{daemon-CChgWJNq.mjs → daemon-D6TrdgMi.mjs} +268 -28
- package/dist/deep-link-DYtuT740.mjs +163 -0
- package/dist/{dev-DOgIITpT.mjs → dev-DMQYbw-2.mjs} +23 -16
- package/dist/devices-uJZ2inMq.mjs +155 -0
- package/dist/{events-CLH4ijKP.mjs → events-Dieo1482.mjs} +49 -4
- package/dist/{init-CYlFaRzG.mjs → init-BgusplYn.mjs} +40 -10
- package/dist/{jam-Cj5gBvwD.mjs → jam-CkuLL8A8.mjs} +1 -1
- package/dist/{link-BFFRgrMt.mjs → link-aZq5cExV.mjs} +54 -7
- package/dist/{logo-CXY-1yrn.mjs → logo-C9s7-Cy9.mjs} +89 -66
- package/dist/{ls-NqmePKOf.mjs → ls-DGVIW-Io.mjs} +1 -1
- package/dist/{manifest-DPZ3WNg_.mjs → manifest-CK8Qh4Nq.mjs} +255 -13
- package/dist/{marks-BnNANic9.mjs → marks-C8oX8kbE.mjs} +3 -3
- package/dist/{marks-DBp3h1Mc.mjs → marks-Dt-5JXCp.mjs} +18 -5
- package/dist/{marver-id-gate-vBLb_Icb.mjs → marver-id-gate-BAeuMeaU.mjs} +11 -7
- package/dist/md-B9_13Q0R.mjs +105 -0
- package/dist/notes-CRAX4wgk.mjs +148 -0
- package/dist/own-C8Mq0Hnf.mjs +128 -0
- package/dist/pdf-Cf9GIoIM.mjs +2299 -0
- package/dist/pdf-HB0prF75.mjs +117 -0
- package/dist/{perf-6MOTHxay.mjs → perf-9ZEF5KLO.mjs} +5 -5
- package/dist/{perf-BCxAo0IS.mjs → perf-BA_NDarr.mjs} +2 -1
- package/dist/{plugin-CFWBcAba.mjs → plugin-DesQP9L5.mjs} +565 -107
- package/dist/{poster-DPPpQiva.mjs → poster-Bb6WraCA.mjs} +1 -1
- package/dist/{profile-B1FKOM1e.mjs → profile-cdmSer1k.mjs} +1 -1
- package/dist/{publish-bakes-_Zx8crP3.mjs → publish-bakes-EjMmukJB.mjs} +3 -3
- package/dist/{queue-DeSQm24g.mjs → queue-BLLfdlDw.mjs} +156 -11
- package/dist/{recover-mDUVsnPd.mjs → recover-B3dmatx4.mjs} +2 -2
- package/dist/{serve-DQv3Ti6X.mjs → serve-kcF6-H8V.mjs} +4 -4
- package/dist/{session-VDJfXEEm.mjs → session-DBF-nQvq.mjs} +29 -3
- package/dist/{share-Bu_kuOKL.mjs → share-CS2mg27O.mjs} +1 -1
- package/dist/{shot-d4h_hJi9.mjs → shot-Bjt2MQe3.mjs} +4 -4
- package/dist/{shot-DBWN8hPP.mjs → shot-BuUCG46-.mjs} +1 -1
- package/dist/show-DhmiUu01.mjs +101 -0
- package/dist/{sizes-wjXDev3b.mjs → sizes-BckcL4Zz.mjs} +1 -1
- package/dist/{slots-Dn4Onb0V.mjs → slots-BOcfIqxy.mjs} +15 -3
- package/dist/{summary-Y8MY1Wuc.mjs → summary-cPmRDGpX.mjs} +1 -1
- package/dist/{sync-CMozOwZ0.mjs → sync-BNWwh8OF.mjs} +205 -7
- package/dist/{work-DJxH7cCX.mjs → work-B4tydWnf.mjs} +38 -2
- package/dist/{work-BYWD_1Zf.mjs → work-CzIXp7n1.mjs} +3 -3
- package/docs/app.md +143 -6
- package/docs/boards-and-folders.md +41 -7
- package/docs/jam-session.md +5 -0
- package/docs/live-jam.md +9 -0
- package/docs/pdf.md +108 -0
- package/docs/publish.md +9 -9
- package/docs/sharing.md +11 -0
- package/docs/slides.md +11 -1
- package/package.json +3 -1
- package/src/client/content/index.tsx +4 -2
- package/src/client/frame-host/main.tsx +3 -0
- package/src/client/shell/App.tsx +71 -24
- package/src/client/shell/BoardList.tsx +16 -7
- package/src/client/shell/Comments.tsx +77 -16
- package/src/client/shell/Play.tsx +104 -27
- package/src/client/shell/Toolbar.tsx +4 -3
- package/src/client/shell/app-bridge.ts +40 -5
- package/src/client/shell/canvas/Canvas.tsx +30 -8
- package/src/client/shell/canvas/FrameNode.tsx +3 -1
- package/src/client/shell/canvas/ctl.ts +16 -0
- package/src/client/shell/commands.ts +20 -0
- package/src/client/shell/comments-store.ts +81 -2
- package/src/client/shell/devices.tsx +42 -0
- package/src/client/shell/goto.ts +56 -9
- package/src/client/shell/icons.tsx +11 -4
- package/src/client/shell/immersive.ts +123 -0
- package/src/client/shell/inset.ts +29 -3
- package/src/client/shell/jam-lines.ts +5 -3
- package/src/client/shell/jam-panel.tsx +17 -5
- package/src/client/shell/marks-ui.tsx +54 -0
- package/src/client/shell/notes.ts +21 -0
- package/src/client/shell/pdf-export.tsx +154 -0
- package/src/client/shell/pdf-notes.ts +20 -0
- package/src/client/shell/recorder-signals.ts +5 -2
- package/src/client/shell/show.ts +250 -0
- package/src/client/shell/store.ts +23 -38
- package/src/client/shell/styles.css +68 -6
- package/src/shared/app-api.ts +90 -4
- package/src/shared/auto-place.ts +32 -0
- package/src/shared/board-tree.ts +3 -0
- package/src/shared/board-types.ts +6 -2
- package/src/shared/deep-link.ts +212 -0
- package/src/shared/devices.ts +89 -0
- package/src/shared/events.ts +48 -5
- package/src/shared/export-plan.ts +98 -0
- package/src/shared/immersive.ts +13 -0
- package/src/shared/perf-records.ts +1 -1
- package/templates/AGENTS-embedded.md +76 -12
- package/templates/AGENTS-studio.md +76 -12
- package/templates/instructions/boards.md +6 -5
- package/templates/instructions/configure.md +32 -2
- package/templates/instructions/iterate.md +8 -0
- package/templates/instructions/jam.md +9 -0
- package/templates/instructions/publish.md +14 -4
- package/templates/instructions/review.md +4 -0
- package/templates/instructions/slides.md +67 -1
- package/templates/instructions/welcome.md +9 -5
- package/templates/playbooks/publish-canvas/PLAYBOOK.md +1 -1
- package/dist/config-BezZTiov.mjs +0 -182
|
@@ -3,7 +3,7 @@ import { TransformWrapper, TransformComponent, type ReactZoomPanPinchContentRef
|
|
|
3
3
|
import { CONFIG, useStore } from '../store.ts'
|
|
4
4
|
import { letGoOfTile } from '../jam-state.ts'
|
|
5
5
|
import { bootHash, linkTargets } from '../hash.ts'
|
|
6
|
-
import { revealFrame } from '../goto.ts'
|
|
6
|
+
import { isLatest, navigated, navigatedByHand, navNow, revealFrame } from '../goto.ts'
|
|
7
7
|
import { noteGestureCmd, startPerf } from '../perf.ts'
|
|
8
8
|
import { FrameNode, HEADER } from './FrameNode.tsx'
|
|
9
9
|
import { NOTE_GAP } from '../notes.ts'
|
|
@@ -61,6 +61,8 @@ let keepTimer: ReturnType<typeof setTimeout> | undefined
|
|
|
61
61
|
let keepPending: (() => void) | undefined
|
|
62
62
|
/** Where the camera's flight lands (a fit, a zoom), for canvasCtl.landing: read only while rzpp animates. */
|
|
63
63
|
let flight: Camera | null = null
|
|
64
|
+
/** Each flight's number: a background tab's landing re-applies itself only while it is still the newest */
|
|
65
|
+
let flyGen = 0
|
|
64
66
|
function keepCamera(x: number, y: number, scale: number) {
|
|
65
67
|
if (!WS) return
|
|
66
68
|
const board = useStore.getState().board
|
|
@@ -163,7 +165,7 @@ export function animateLayout(ms = 360) {
|
|
|
163
165
|
// the control channel lives in ctl.ts so play/focus can import it without
|
|
164
166
|
// dragging the canvas into a locked-shell bundle; Canvas assigns the real
|
|
165
167
|
// implementations below when it mounts
|
|
166
|
-
import { canvasCtl, type CanvasWheelInput } from './ctl.ts'
|
|
168
|
+
import { bootCancelled, canvasCtl, markBootLanded, type CanvasWheelInput } from './ctl.ts'
|
|
167
169
|
import { cmd, type CmdHandle } from '../commands.ts'
|
|
168
170
|
export { canvasCtl, type CanvasWheelInput }
|
|
169
171
|
import { anchorNode, anchoredCamera, type Held } from './anchor.ts'
|
|
@@ -197,7 +199,7 @@ function GroupCaptions() {
|
|
|
197
199
|
style={{ transform: `translate(${g.x}px, ${g.y}px) translateY(calc(-100% - clamp(4px, 8px * var(--sh-inv, 1), 40px)))` }}
|
|
198
200
|
title="Select all variants"
|
|
199
201
|
onPointerDown={(e) => e.stopPropagation()}
|
|
200
|
-
onClick={() => { cmd('group-fit', { via: 'click', in: 'shell', frames: g.keys.length }); useStore.getState().selectMany(g.keys); canvasCtl.fitNodes(g.keys) }}>
|
|
202
|
+
onClick={() => { cmd('group-fit', { via: 'click', in: 'shell', frames: g.keys.length }); navigated(); useStore.getState().selectMany(g.keys); canvasCtl.fitNodes(g.keys) }}>
|
|
201
203
|
{id.split('/').map((s) => s[0].toUpperCase() + s.slice(1)).join(' / ')} · {g.ids.size} variants
|
|
202
204
|
</div>
|
|
203
205
|
)
|
|
@@ -214,9 +216,19 @@ export function Canvas() {
|
|
|
214
216
|
const ref = useRef<ReactZoomPanPinchContentRef>(null)
|
|
215
217
|
// every camera move the canvas aims (a fit, a zoom, a camera restored): where it lands, while rzpp flies there, and the
|
|
216
218
|
// boot queue told - the first frame of a board starts now, ranked on that view, not once the flight is over
|
|
217
|
-
const fly = (x: number, y: number, scale: number,
|
|
219
|
+
const fly = (x: number, y: number, scale: number, msAsked: number) => {
|
|
220
|
+
// a tab in the background draws no frames: its camera lands at once, where a flight nobody sees would wait for it
|
|
221
|
+
// to come forward (`marver show` to a background tab, spec 31 D3)
|
|
222
|
+
const hidden = document.visibilityState === 'hidden'
|
|
223
|
+
const ms = hidden ? 0 : msAsked
|
|
224
|
+
const gen = ++flyGen
|
|
218
225
|
flight = ms ? { x, y, scale } : null
|
|
226
|
+
// an older flight still in the air no longer counts: the camera is landed now
|
|
227
|
+
if (hidden && ref.current) ref.current.instance.animation = null
|
|
219
228
|
ref.current?.setTransform(x, y, scale, ms, 'easeOut')
|
|
229
|
+
// ...but its frame queued before the tab went to the background still lands its own end when frames resume (the
|
|
230
|
+
// library cannot cancel it): this landing goes again right after it, unless a newer flight came since
|
|
231
|
+
if (hidden) requestAnimationFrame(() => { if (gen === flyGen) ref.current?.setTransform(x, y, scale, 0) })
|
|
220
232
|
aimed()
|
|
221
233
|
}
|
|
222
234
|
const scaleTimer = useRef(0)
|
|
@@ -340,7 +352,8 @@ export function Canvas() {
|
|
|
340
352
|
// refit through their own path.
|
|
341
353
|
const booted = useRef(false)
|
|
342
354
|
useEffect(() => {
|
|
343
|
-
|
|
355
|
+
// the boot's camera, once: never for a later board load once the boot is over (an empty board boots with none)
|
|
356
|
+
if (booted.current || nodes.length === 0 || bootCancelled()) return
|
|
344
357
|
let revealed = false
|
|
345
358
|
booted.current = true
|
|
346
359
|
// the page before this one reloaded itself when its canvas came back: its camera, on the board it showed
|
|
@@ -350,7 +363,10 @@ export function Canvas() {
|
|
|
350
363
|
// reloaded this tab after a crash
|
|
351
364
|
const named = !!(bootHash.n?.length || bootHash.f?.length || bootHash.s?.length)
|
|
352
365
|
const cam = carried ?? (!named || APP_REOPEN ? savedCamera(board) : null)
|
|
366
|
+
// a navigation after this point (a person's, a show's) owns the camera: the boot's fit gives way to it
|
|
367
|
+
const nav = navNow()
|
|
353
368
|
const fit = () => {
|
|
369
|
+
if (!isLatest(nav) || bootCancelled()) return
|
|
354
370
|
const keys = linkTargets(bootHash, useStore.getState().nodes)
|
|
355
371
|
if (keys.length) {
|
|
356
372
|
useStore.setState({ selection: keys })
|
|
@@ -366,16 +382,20 @@ export function Canvas() {
|
|
|
366
382
|
} else {
|
|
367
383
|
canvasCtl.fitAll()
|
|
368
384
|
// a link naming a frame this board does not show follows the frame where it lives
|
|
369
|
-
|
|
385
|
+
// under the boot's own navigation (no new one: a person's, or an applied show, supersedes it)
|
|
386
|
+
if (bootHash.f?.length && !revealed) { revealed = true; void revealFrame(bootHash.f[0], nav, () => !bootCancelled()) }
|
|
370
387
|
}
|
|
371
388
|
}
|
|
372
|
-
|
|
389
|
+
// a frame, or at once in a tab in the background (it draws none until it comes forward)
|
|
390
|
+
const soon = (fn: () => void) => { if (document.visibilityState === 'hidden') setTimeout(fn, 0); else requestAnimationFrame(fn) }
|
|
391
|
+
soon(() => {
|
|
373
392
|
fit()
|
|
374
393
|
// published builds boot fast enough that rzpp's own init can land AFTER this fit
|
|
375
394
|
// and stomp it back to the identity transform - one verification pass re-fits
|
|
376
395
|
setTimeout(() => {
|
|
377
396
|
const st = ref.current?.instance.transformState
|
|
378
397
|
if (st && st.scale === 1 && st.positionX === 0 && st.positionY === 0) fit()
|
|
398
|
+
markBootLanded() // spec 31 D3: a show waits for this
|
|
379
399
|
}, 150)
|
|
380
400
|
})
|
|
381
401
|
}, [nodes])
|
|
@@ -427,6 +447,7 @@ export function Canvas() {
|
|
|
427
447
|
if (!app || !canvas) return
|
|
428
448
|
let settle = 0
|
|
429
449
|
const beginGesture = (panning: boolean) => {
|
|
450
|
+
navigatedByHand() // a person's pan or zoom: a show or link still loading gives way (spec 31 D3)
|
|
430
451
|
// sh-camera = a CANVAS pan/zoom (the image-LOD freeze signal); sh-gesturing also drops iframe
|
|
431
452
|
// pointer-events. A frame click/drag sets only sh-gesturing.
|
|
432
453
|
document.getElementById('sh-world')?.classList.add('sh-gesturing', 'sh-camera')
|
|
@@ -494,13 +515,14 @@ export function Canvas() {
|
|
|
494
515
|
document.getElementById('sh-world')?.classList[on ? 'add' : 'remove']('sh-gesturing', 'sh-camera')
|
|
495
516
|
}
|
|
496
517
|
const pan = (on: boolean) => () => {
|
|
518
|
+
if (on) navigatedByHand() // a person's drag-pan (spec 31 D3)
|
|
497
519
|
camera(on)
|
|
498
520
|
document.body.classList[on ? 'add' : 'remove']('sh-panning')
|
|
499
521
|
const sp = spacePan.current
|
|
500
522
|
if (sp && on) sp.panned = true
|
|
501
523
|
else if (sp?.panned) { sp.h.done(); spacePan.current = null }
|
|
502
524
|
}
|
|
503
|
-
const zoom = (on: boolean) => () => camera(on)
|
|
525
|
+
const zoom = (on: boolean) => () => { if (on) navigatedByHand(); camera(on) } // a person's pinch (spec 31 D3)
|
|
504
526
|
|
|
505
527
|
// no initialPosition props on the wrapper: rzpp applies them ASYNC after mount and
|
|
506
528
|
// stomps the boot fit when data is inlined (published builds) - the boot fit owns
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { navigatedByHand } from '../goto.ts'
|
|
1
2
|
import { memo, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'
|
|
2
3
|
import { cap, frameUrl, shownRev, useStore, CONFIG, type Node } from '../store.ts'
|
|
3
4
|
import { admit, release } from './admission.ts'
|
|
@@ -300,6 +301,7 @@ export const FrameNode = memo(function FrameNode({ node }: { node: Node }) {
|
|
|
300
301
|
const drag = (e: React.PointerEvent, mode: 'move' | 'e' | 's' | 'se') => {
|
|
301
302
|
e.stopPropagation()
|
|
302
303
|
if (e.button !== 0) return
|
|
304
|
+
navigatedByHand() // the person's own selection: a show or link still loading gives way (spec 31 D3)
|
|
303
305
|
// shift-click toggles multi-selection instead of dragging (Figma convention)
|
|
304
306
|
if (e.shiftKey && mode === 'move') { cmd('select', { via: 'click', in: 'shell', frame: node.frame }); select(node.key, true); return }
|
|
305
307
|
if (mode === 'move') cmd('select', { via: 'click', in: 'shell', frame: node.frame })
|
|
@@ -423,7 +425,7 @@ export const FrameNode = memo(function FrameNode({ node }: { node: Node }) {
|
|
|
423
425
|
{frame.variantGroup && (
|
|
424
426
|
<div className="sh-vbadge sh-no-pan" title={`${frame.variantGroup} · variant ${frame.variant?.toUpperCase()} - click to select`}
|
|
425
427
|
onPointerDown={(e) => e.stopPropagation()}
|
|
426
|
-
onClick={(e) => { cmd('select', { via: 'click', in: 'shell', frame: node.frame }); select(node.key, e.shiftKey) }}>
|
|
428
|
+
onClick={(e) => { cmd('select', { via: 'click', in: 'shell', frame: node.frame }); navigatedByHand(); select(node.key, e.shiftKey) }}>
|
|
427
429
|
<b>{frame.variant?.toUpperCase()}</b>
|
|
428
430
|
<span>{variantName}</span>
|
|
429
431
|
</div>
|
|
@@ -16,6 +16,22 @@ export interface CanvasWheelInput {
|
|
|
16
16
|
ctrlKey: boolean; metaKey: boolean; clientX: number; clientY: number
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/** The board's first camera - its boot fit or restored camera (Canvas.tsx) - has been applied: a `marver show` that came
|
|
20
|
+
* during the boot waits for it (show.ts), so it never races the boot (spec 31 D3). */
|
|
21
|
+
let bootLandedNow: () => void = () => {}
|
|
22
|
+
export const bootLanded = new Promise<void>((r) => { bootLandedNow = r })
|
|
23
|
+
export function markBootLanded(): void { bootLandedNow() }
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A show applied (spec 31 D3): every boot reveal still to come gives way to it - the boot camera (Canvas.tsx), the boot
|
|
27
|
+
* link's frame fallback (Canvas.tsx, App.tsx) and its thread (Comments.tsx) each read this before they act. One flag,
|
|
28
|
+
* never reset: from here on the camera is the show's, and later board loads never restore the boot link's place - after
|
|
29
|
+
* a failed boot too, even when the show's own board then fails (a failed board load like any other: accepted).
|
|
30
|
+
*/
|
|
31
|
+
let bootCancelledFlag = false
|
|
32
|
+
export function cancelBoot(): void { bootCancelledFlag = true }
|
|
33
|
+
export const bootCancelled = (): boolean => bootCancelledFlag
|
|
34
|
+
|
|
19
35
|
export const canvasCtl = {
|
|
20
36
|
fitNode(_key: string) {},
|
|
21
37
|
fitNodes(_keys: string[]) {},
|
|
@@ -137,9 +137,21 @@ export const COMMANDS = {
|
|
|
137
137
|
'board-status': se('answer', { deadlineMs: S30, cancelled: true, failed: ['api'] }),
|
|
138
138
|
// `nothing-new` (not in R12's table): no write goes, so no answer can come
|
|
139
139
|
'mark-seen': se('answer', { noop: ['nothing-new'], failed: ['api'] }),
|
|
140
|
+
// spec 31 B: resolve every open thread in a scope; its notice's Undo. `nothing-open` (not in R12's table): no thread
|
|
141
|
+
// to resolve, or every one is Jam's work in progress
|
|
142
|
+
'resolve-all': se('answer', { deadlineMs: S30, noop: ['nothing-open', 'published'], failed: ['api'] }),
|
|
143
|
+
'resolve-undo': se('answer', { deadlineMs: S30, failed: ['api'] }),
|
|
144
|
+
// spec 31: a deck PDF - ends when the server takes the job (its progress is the notice's); `busy` - one is being made
|
|
145
|
+
'export-pdf': se('answer', { deadlineMs: S30, noop: ['busy'], failed: ['api'] }),
|
|
146
|
+
'export-pdf-cancel': se('answer', { failed: ['api'] }),
|
|
147
|
+
// an app with no exportPdf (1.0.1): the notice's Download of the file it holds; `nothing-ready` - none waits
|
|
148
|
+
'export-pdf-download': se('answer', { noop: ['nothing-ready'] }),
|
|
140
149
|
'add-to-board': se('answer', { failed: ['api'] }),
|
|
141
150
|
'update-copy': se('clipboard', { failed: CLIP }),
|
|
142
151
|
'update-dismiss': se('2raf'),
|
|
152
|
+
// `marver show` over unsent words (spec 31 D3): the notice's Go moves the tab (the camera lands), × leaves it be
|
|
153
|
+
'show-go': se('camera', { cancelled: true }),
|
|
154
|
+
'show-dismiss': se('2raf'),
|
|
143
155
|
'notice-view': se('thread', { failed: ['missing'] }),
|
|
144
156
|
'notice-retry': se('answer', { deadlineMs: S30, failed: ['refused', 'missing'] }),
|
|
145
157
|
'notice-dismiss': se('2raf'),
|
|
@@ -154,6 +166,13 @@ export const COMMANDS = {
|
|
|
154
166
|
'comment-reply': se('answer', { deadlineMs: S30, failed: ['send-failed', 'signed-out'] }),
|
|
155
167
|
'draft-discard': se('2raf'),
|
|
156
168
|
'comment-resolve': se('answer', { deadlineMs: S30, failed: ['send-failed'] }),
|
|
169
|
+
// spec 31 C: your own message - open its editor, save the words, delete it (asked first, then for real); ⌘A in a card
|
|
170
|
+
'comment-edit': se('2raf'),
|
|
171
|
+
'comment-edit-save': se('answer', { deadlineMs: S30, failed: ['send-failed', 'signed-out'] }),
|
|
172
|
+
'comment-delete-cancel': se('2raf'),
|
|
173
|
+
'comment-delete-ask': se('2raf'),
|
|
174
|
+
'comment-delete': se('answer', { deadlineMs: S30, failed: ['send-failed', 'signed-out'] }),
|
|
175
|
+
'thread-select-all': se('selection'),
|
|
157
176
|
'mention-pick': once(),
|
|
158
177
|
'mention-dismiss': once(),
|
|
159
178
|
'thread-open': se('2raf'),
|
|
@@ -762,4 +781,5 @@ export const RELAYS: readonly Relay[] = [
|
|
|
762
781
|
{ from: "the stage's post({ type }) (stage/main.tsx)", owner: "Play.tsx's stage message branch for that type", why: 'the shell executes it' },
|
|
763
782
|
{ from: 'app-bridge.ts runMenuItem (a synthetic keydown)', owner: "App.tsx's key handler branch", why: "#51: via 'relay', in 'menu', 'tab-menu' or 'app'" },
|
|
764
783
|
{ from: "app-bridge.ts runMenuItem('mark-all-seen')", owner: 'mark-seen', why: "#51: via 'relay', in 'tab-menu'" },
|
|
784
|
+
{ from: "app-bridge.ts runMenuItem('resolve-all-comments')", owner: 'resolve-all', why: "#51: via 'relay', in 'tab-menu' (spec 31 B.1)" },
|
|
765
785
|
]
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* on which one it is beyond capability flags the endpoints themselves report.
|
|
6
6
|
*/
|
|
7
7
|
import { create } from 'zustand'
|
|
8
|
-
import { asks, replay, type CommentEvent, type Thread } from '../../shared/events.ts'
|
|
8
|
+
import { asks, asSentBy, replay, type CommentEvent, type Thread } from '../../shared/events.ts'
|
|
9
9
|
import { mentionPeople, mentionsIn } from './mentions.ts'
|
|
10
10
|
import { playPing } from './sound.ts'
|
|
11
11
|
import { ROUTE } from '../const.ts'
|
|
@@ -53,6 +53,11 @@ interface CommentsState {
|
|
|
53
53
|
draft: { nodeKey: string; frame: string; anchor: unknown; board?: string } | null
|
|
54
54
|
needsIdentity: boolean // published viewer tried to comment while signed out
|
|
55
55
|
inviteToken: string | null // arrived via an invite link - claim flow, token known
|
|
56
|
+
/** dev (spec 31 C.2): the messages this machine's human wrote, per board - the server's record (own.json), never
|
|
57
|
+
* the email. null until read (or on a published canvas, where the opaque author id decides) */
|
|
58
|
+
ownership: Record<string, Set<string>> | null
|
|
59
|
+
/** what the server's comment API takes (spec 31 C.6): an older published server has no `delete` - the shell hides it */
|
|
60
|
+
caps: { delete: boolean }
|
|
56
61
|
|
|
57
62
|
load(board: string): Promise<void>
|
|
58
63
|
live(board: string): () => void
|
|
@@ -72,6 +77,15 @@ interface CommentsState {
|
|
|
72
77
|
reply(threadId: string, body: string): Promise<void>
|
|
73
78
|
replyOk(threadId: string, body: string, h?: CmdHandle): Promise<boolean>
|
|
74
79
|
resolve(threadId: string, reopen?: boolean, h?: CmdHandle): Promise<void>
|
|
80
|
+
/** Is this message mine to edit or delete (spec 31 C.2)? Never an agent's; locally the server's record decides, on a
|
|
81
|
+
* published canvas the original message's opaque author id against /me's. */
|
|
82
|
+
isMine(board: string | undefined, msg: { id: string; author?: { id?: string }; agent?: boolean }): boolean
|
|
83
|
+
/** Edit one of my messages (spec 31 C.3): an `edit` event with the new words, to the thread's own log. */
|
|
84
|
+
edit(threadId: string, msgId: string, body: string, h?: CmdHandle): Promise<boolean>
|
|
85
|
+
/** Delete one of my messages (spec 31 C.4): a `delete` tombstone, to the thread's own log. */
|
|
86
|
+
remove(threadId: string, msgId: string, h?: CmdHandle): Promise<boolean>
|
|
87
|
+
/** One sweep of every board's log now (after a resolve-all or its Undo). */
|
|
88
|
+
sweep(): Promise<void>
|
|
75
89
|
setMode(on: boolean): void
|
|
76
90
|
setShow(show: boolean): void
|
|
77
91
|
setShowAnchor(on: boolean): void
|
|
@@ -250,12 +264,38 @@ export const useComments = create<CommentsState>((set, get) => {
|
|
|
250
264
|
})))
|
|
251
265
|
union(results.flatMap((evs) => evs ?? []))
|
|
252
266
|
names.forEach((n, i) => { if (results[i] !== null) baselinedBoards.add(n) })
|
|
267
|
+
if (get().local) await readOwnership()
|
|
268
|
+
}
|
|
269
|
+
/** dev: the messages this machine's human wrote (spec 31 C.2) - read with each sweep; a 404 (an older server) leaves
|
|
270
|
+
* none mine, so nothing offers an edit the server would refuse */
|
|
271
|
+
const readOwnership = async () => {
|
|
272
|
+
try {
|
|
273
|
+
const r = await request('comment-ownership', { headers: { 'x-mv-c': csrf() } })
|
|
274
|
+
if (!r.ok) return
|
|
275
|
+
const b = await r.json() as { boards?: Record<string, string[]> }
|
|
276
|
+
// (no prototype: a board may be called `constructor`)
|
|
277
|
+
const next: Record<string, Set<string>> = Object.create(null)
|
|
278
|
+
for (const [k, ids] of Object.entries(b.boards ?? {})) if (Array.isArray(ids)) next[k] = new Set(ids)
|
|
279
|
+
// what this page wrote since stays mine (its sweep may have read the file a moment before the write)
|
|
280
|
+
for (const [k, ids] of Object.entries(get().ownership ?? {})) for (const id of ids) (Object.hasOwn(next, k) ? next[k] : (next[k] = new Set())).add(id)
|
|
281
|
+
set({ ownership: next })
|
|
282
|
+
} catch { /* the next sweep */ }
|
|
283
|
+
}
|
|
284
|
+
/** The server's capabilities (spec 31 C.6): only a JSON answer that says `delete` counts - an older server's 404 or
|
|
285
|
+
* gate page is an older server. */
|
|
286
|
+
const readCaps = async () => {
|
|
287
|
+
try {
|
|
288
|
+
const r = await request('capabilities')
|
|
289
|
+
const b = r.ok && (r.headers.get('content-type') ?? '').includes('application/json') ? await r.json() as { delete?: unknown } : null
|
|
290
|
+
set({ caps: { delete: b?.delete === true } })
|
|
291
|
+
} catch { /* keep what we have */ }
|
|
253
292
|
}
|
|
254
293
|
|
|
255
294
|
return {
|
|
256
295
|
events: [], threads: [], board: null, me: null, myBoards: null, local: false, connected: false,
|
|
257
296
|
mentionSeen: loadMentionSeen(),
|
|
258
297
|
commentMode: false, show: true, showAnchor: true, active: null, draft: null, needsIdentity: false, inviteToken: null,
|
|
298
|
+
ownership: null, caps: { delete: false },
|
|
259
299
|
|
|
260
300
|
poke(board) {
|
|
261
301
|
const b = board ?? get().board
|
|
@@ -290,6 +330,7 @@ export const useComments = create<CommentsState>((set, get) => {
|
|
|
290
330
|
myBoards: me.data.boards && typeof me.data.boards === 'object' ? me.data.boards : null,
|
|
291
331
|
local: !!me.data.local, connected: !!me.data.connected,
|
|
292
332
|
})
|
|
333
|
+
await readCaps()
|
|
293
334
|
await fetchAll()
|
|
294
335
|
// mark-seen: the board was actually PRESENTED (load runs on open, never
|
|
295
336
|
// from the background poll), so the viewer's unread mark advances - the
|
|
@@ -346,7 +387,21 @@ export const useComments = create<CommentsState>((set, get) => {
|
|
|
346
387
|
// union only what the server took - a rejected send must not leave phantoms; the
|
|
347
388
|
// store is global now, so an accepted write lands regardless of the viewed board
|
|
348
389
|
// (client ids keep the eventual SSE/poll echo idempotent)
|
|
349
|
-
if (res.ok) {
|
|
390
|
+
if (res.ok) {
|
|
391
|
+
// published: the copy kept here wears my opaque id, as the server's projection of it will (spec 31 C.2, Codex
|
|
392
|
+
// r2) - the echo is a duplicate by id and dropped, so without it this message would not be mine until a reload
|
|
393
|
+
union(get().local ? stamped : asSentBy(stamped, get().me?.id))
|
|
394
|
+
// a message this page just wrote is mine (spec 31 C.2) - the server recorded it with the write
|
|
395
|
+
if (get().local) {
|
|
396
|
+
const mine = stamped.filter((e) => (e.type === 'create' || e.type === 'reply') && e.commentId)
|
|
397
|
+
if (mine.length) {
|
|
398
|
+
const own: Record<string, Set<string>> = Object.assign(Object.create(null), get().ownership ?? {})
|
|
399
|
+
own[target] = new Set([...(Object.hasOwn(own, target) ? own[target] : []), ...mine.map((e) => e.commentId!)])
|
|
400
|
+
set({ ownership: own })
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
h?.done()
|
|
404
|
+
}
|
|
350
405
|
return res.ok
|
|
351
406
|
},
|
|
352
407
|
|
|
@@ -384,6 +439,30 @@ export const useComments = create<CommentsState>((set, get) => {
|
|
|
384
439
|
if (sent) h?.done(); else h?.fail('send-failed')
|
|
385
440
|
},
|
|
386
441
|
|
|
442
|
+
isMine(board, msg) {
|
|
443
|
+
if (msg.agent) return false
|
|
444
|
+
const { local, ownership, me } = get()
|
|
445
|
+
if (local) return !!board && !!ownership && Object.hasOwn(ownership, board) && ownership[board].has(msg.id)
|
|
446
|
+
return !!me?.id && !!msg.author?.id && msg.author.id === me.id
|
|
447
|
+
},
|
|
448
|
+
|
|
449
|
+
async edit(threadId, msgId, body, h) {
|
|
450
|
+
const words = body.trim()
|
|
451
|
+
if (!words) { h?.fail('send-failed'); return false }
|
|
452
|
+
const origin = get().threads.find((t) => t.id === threadId)?.board
|
|
453
|
+
return get().send([{ id: uuid(), ts: Date.now(), type: 'edit', commentId: msgId, author: postAuthor(get().me), body: words }], origin, h)
|
|
454
|
+
},
|
|
455
|
+
|
|
456
|
+
async remove(threadId, msgId, h) {
|
|
457
|
+
const origin = get().threads.find((t) => t.id === threadId)?.board
|
|
458
|
+
const ok = await get().send([{ id: uuid(), ts: Date.now(), type: 'delete', commentId: msgId, author: postAuthor(get().me) }], origin, h)
|
|
459
|
+
// a deleted first comment with nothing under it is gone: its card closes
|
|
460
|
+
if (ok && get().active === threadId && !get().threads.some((t) => t.id === threadId)) set({ active: null })
|
|
461
|
+
return ok
|
|
462
|
+
},
|
|
463
|
+
|
|
464
|
+
async sweep() { await fetchAll() },
|
|
465
|
+
|
|
387
466
|
async findThread(id) {
|
|
388
467
|
if (!get().threads.some((t) => t.id === id)) await fetchAll()
|
|
389
468
|
return get().threads.find((t) => t.id === id) ?? null
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a device shows in the shell (spec 31 Part F): its label and its icon, wherever a device name shows - the frame
|
|
3
|
+
* toolbar, the device menu, Play, the Jam panel. The server resolved each configured viewport's look once
|
|
4
|
+
* (device-icons.ts, `CONFIG.devices`); a name it did not resolve (a Jam step recorded under an older config) takes the
|
|
5
|
+
* same rules from its name (src/shared/devices.ts).
|
|
6
|
+
*
|
|
7
|
+
* A device's own SVG is drawn as a CSS `mask-image` filled with the ink (`currentColor`): an image, never DOM, so
|
|
8
|
+
* nothing in it can run or restyle the page. Only a base64 SVG data URI is ever drawn - anything else is the glyph.
|
|
9
|
+
*/
|
|
10
|
+
import type { CSSProperties } from 'react'
|
|
11
|
+
import { lookFromName, type DeviceLook } from '../../shared/devices.ts'
|
|
12
|
+
import { DEVICE_GLYPH_ICONS, DevicesIcon } from './icons.tsx'
|
|
13
|
+
import { CONFIG } from './store.ts'
|
|
14
|
+
|
|
15
|
+
/** The only mask a device wears: a base64 SVG data URI, as the server writes it (nothing can close the `url()`). */
|
|
16
|
+
export const SAFE_MASK = /^data:image\/svg\+xml;base64,[A-Za-z0-9+/]+={0,2}$/
|
|
17
|
+
|
|
18
|
+
/** A device's look: the server's, else its name's. */
|
|
19
|
+
export function deviceLook(name: string): DeviceLook {
|
|
20
|
+
const d = CONFIG.devices
|
|
21
|
+
return d && Object.hasOwn(d, name) ? d[name] : lookFromName(name)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** A device's label ("iPad landscape"). */
|
|
25
|
+
export const deviceLabel = (name: string): string => deviceLook(name).label
|
|
26
|
+
|
|
27
|
+
/** A look's icon at `size` px. */
|
|
28
|
+
export function DeviceGlyph({ look, size = 14 }: { look: DeviceLook; size?: number }) {
|
|
29
|
+
if (look.mask && SAFE_MASK.test(look.mask)) {
|
|
30
|
+
const url = `url("${look.mask}")`
|
|
31
|
+
const style: CSSProperties = { width: size, height: size, WebkitMaskImage: url, maskImage: url }
|
|
32
|
+
// an <i>, not a <span>: menu rules that stretch and capitalise a button's span are for its words
|
|
33
|
+
return <i className="sh-dev-mask" aria-hidden data-mv-device-mask="" style={style} />
|
|
34
|
+
}
|
|
35
|
+
const I = (look.glyph && DEVICE_GLYPH_ICONS[look.glyph]) || DevicesIcon
|
|
36
|
+
return <I size={size} style={look.rotate ? { transform: 'rotate(90deg)' } : undefined} />
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** A device name's icon; null (no device: the default view) is the generic Devices glyph. */
|
|
40
|
+
export function deviceIcon(name: string | null, size = 14) {
|
|
41
|
+
return name ? <DeviceGlyph look={deviceLook(name)} size={size} /> : <DevicesIcon size={size} />
|
|
42
|
+
}
|
package/src/client/shell/goto.ts
CHANGED
|
@@ -71,6 +71,52 @@ export function navigated(): number {
|
|
|
71
71
|
if (s.board) void s.switchBoard(s.board)
|
|
72
72
|
return ++gotoSeq
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* A person acted on the canvas or its camera themselves - a frame, a badge or a comment stack clicked, ⌘A, Escape, a pan,
|
|
76
|
+
* a zoom, a fit or zoom key, the zoom menu, a notification's View (spec 31 D3): a `marver show` or an app link still on
|
|
77
|
+
* its way gives way, its board never committed over what they did (show.ts reads `handNow`). Its own counter, apart
|
|
78
|
+
* from the navigation number: nothing the person started themselves - a board switch, its fit - is cancelled by it.
|
|
79
|
+
* Programmatic selection and fits (the show's own) never call it, so a show never cancels itself.
|
|
80
|
+
*
|
|
81
|
+
* Accepted limits for this release: a click or Escape inside a frame the person is interacting with arrives as a message
|
|
82
|
+
* (`sh:frame-down`, `sh:exit-interact`) and is not counted - a show still loading then lands over it; and a frame's own
|
|
83
|
+
* script that synthesizes keys is forwarded and counted like the person's - a show still loading then does not land,
|
|
84
|
+
* and nothing else changes.
|
|
85
|
+
*/
|
|
86
|
+
let handSeq = 0
|
|
87
|
+
export function navigatedByHand(): void { ++handSeq }
|
|
88
|
+
export const handNow = (): number => handSeq
|
|
89
|
+
|
|
90
|
+
const TEXT = 'textarea, input, select, [contenteditable=""], [contenteditable="true"]'
|
|
91
|
+
const MODIFIERS = new Set(['Shift', 'Control', 'Alt', 'Meta', 'CapsLock', 'Fn'])
|
|
92
|
+
/**
|
|
93
|
+
* Every input the person makes in the shell counts (spec 31 D3) - a pointer pressed, a key, a wheel - so no handler can
|
|
94
|
+
* be missed: a device preset, a Jam tile, Play and back, a toolbar button. Not words typed into a field (they make a
|
|
95
|
+
* show the notice instead, show.ts) nor a modifier key alone; never a synthetic event (`isTrusted`). Input inside a
|
|
96
|
+
* frame's own document never reaches here: its wheel is forwarded and counted by the canvas (Canvas.tsx beginGesture),
|
|
97
|
+
* a click on its node by FrameNode, a key it forwards (`sh:key`, the stage's `sh:stage-key`) where the shell takes it;
|
|
98
|
+
* the app menu's items replay their key untrusted and count at their relay (app-bridge.ts runMenuItem). Installed once
|
|
99
|
+
* by App.tsx; answers what removes it.
|
|
100
|
+
*/
|
|
101
|
+
export function watchHands(target: Window = window): () => void {
|
|
102
|
+
const inText = (e: Event) => { const t = e.target as Element | null; return !!t?.closest?.(TEXT) }
|
|
103
|
+
const press = (e: PointerEvent) => { if (e.isTrusted && !inText(e)) navigatedByHand() }
|
|
104
|
+
// a key held down repeats: one choice, counted once (a held Enter on the show notice's Go never cancels the Go)
|
|
105
|
+
// Escape in a field is no word: it leaves the field (a composer dismissed) - the person's choice, counted (release r3)
|
|
106
|
+
const key = (e: KeyboardEvent) => { if (e.isTrusted && !e.repeat && !MODIFIERS.has(e.key) && (!inText(e) || e.key === 'Escape')) navigatedByHand() }
|
|
107
|
+
const wheel = (e: WheelEvent) => { if (e.isTrusted) navigatedByHand() }
|
|
108
|
+
target.addEventListener('pointerdown', press, true)
|
|
109
|
+
target.addEventListener('keydown', key, true)
|
|
110
|
+
target.addEventListener('wheel', wheel, { capture: true, passive: true })
|
|
111
|
+
return () => {
|
|
112
|
+
target.removeEventListener('pointerdown', press, true)
|
|
113
|
+
target.removeEventListener('keydown', key, true)
|
|
114
|
+
target.removeEventListener('wheel', wheel, { capture: true })
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/** The navigation now, without starting one: a caller that waits (`marver show` for the boot) reads it first, and
|
|
118
|
+
* gives way if a person navigated meanwhile (`isLatest`). */
|
|
119
|
+
export const navNow = (): number => gotoSeq
|
|
74
120
|
/** Is this still the latest navigation - nothing newer since `navigated()` handed it out? */
|
|
75
121
|
export const isLatest = (seq: number): boolean => seq === gotoSeq
|
|
76
122
|
/** The one way a navigation changes boards - a link, a goto, a reveal, a board picked in the sidebar or the play pill, a
|
|
@@ -84,22 +130,22 @@ export async function switchFor(board: string, nav: number = navigated(), mayCom
|
|
|
84
130
|
return isLatest(nav) && useStore.getState().board === board
|
|
85
131
|
}
|
|
86
132
|
/** The camera to a node once it is drawn - unless a newer navigation has it by then. */
|
|
87
|
-
const fitLater = (key: string, seq: number) => setTimeout(() => { if (isLatest(seq)) canvasCtl.fitNode(key) }, 50)
|
|
133
|
+
const fitLater = (key: string, seq: number, mayCommit?: () => boolean) => setTimeout(() => { if (isLatest(seq) && (!mayCommit || mayCommit())) canvasCtl.fitNode(key) }, 50)
|
|
88
134
|
|
|
89
135
|
/** Switch to `home` and select + fit `target` there once the board commits - unless the human has
|
|
90
136
|
* moved on: newer navigation, or a board they switched to themselves while the lookup ran. */
|
|
91
|
-
async function landOn(home: string, target: string, carry: boolean, seq: number, from: string) {
|
|
137
|
+
async function landOn(home: string, target: string, carry: boolean, seq: number, from: string, mayCommit?: () => boolean) {
|
|
92
138
|
if (seq !== gotoSeq || useStore.getState().board !== from) return
|
|
93
|
-
if (!await switchFor(home, seq)) return
|
|
139
|
+
if (!await switchFor(home, seq, mayCommit)) return
|
|
94
140
|
for (let i = 0; i < 12; i++) { // the board commits async - retry like viewNote
|
|
95
|
-
if (seq !== gotoSeq) return
|
|
141
|
+
if (seq !== gotoSeq || (mayCommit && !mayCommit())) return
|
|
96
142
|
const st = useStore.getState()
|
|
97
143
|
if (st.board === home) { // a cancelled/failed switch must not select here
|
|
98
144
|
const node = st.nodes.find((n) => n.frame === target && !n.missing)
|
|
99
145
|
if (node) {
|
|
100
146
|
st.select(node.key)
|
|
101
147
|
if (carry) st.setInteract(node.key)
|
|
102
|
-
fitLater(node.key, seq)
|
|
148
|
+
fitLater(node.key, seq, mayCommit)
|
|
103
149
|
return
|
|
104
150
|
}
|
|
105
151
|
}
|
|
@@ -111,13 +157,14 @@ async function landOn(home: string, target: string, carry: boolean, seq: number,
|
|
|
111
157
|
* not show, the way back from a focus link): this board, else the first board that shows it
|
|
112
158
|
* (archive boards last), else - a frame on no board - the Not on a board view. Unlike a goto it
|
|
113
159
|
* never spawns - opening a link must not edit a board. */
|
|
114
|
-
export async function revealFrame(target: string, nav?: number): Promise<void> { // `nav`: a caller's navigation, else its own
|
|
160
|
+
export async function revealFrame(target: string, nav?: number, mayCommit?: () => boolean): Promise<void> { // `nav`: a caller's navigation, else its own; `mayCommit`: its own condition, read before the board commits and before it selects (`marver show`'s: no words typed meanwhile)
|
|
115
161
|
const s = useStore.getState()
|
|
162
|
+
if (mayCommit && !mayCommit()) return
|
|
116
163
|
const here = s.nodes.find((n) => n.frame === target && !n.missing)
|
|
117
164
|
if (here) {
|
|
118
165
|
const seq = nav ?? navigated()
|
|
119
166
|
s.select(here.key)
|
|
120
|
-
fitLater(here.key, seq)
|
|
167
|
+
fitLater(here.key, seq, mayCommit)
|
|
121
168
|
return
|
|
122
169
|
}
|
|
123
170
|
if (!s.manifest?.frames.some((f) => f.id === target)) return s.toast(`no frame "${target}" on this canvas`)
|
|
@@ -130,7 +177,7 @@ export async function revealFrame(target: string, nav?: number): Promise<void> {
|
|
|
130
177
|
} catch {
|
|
131
178
|
return useStore.getState().toast(`could not read the boards - try again`)
|
|
132
179
|
}
|
|
133
|
-
if (seq !== gotoSeq) return
|
|
180
|
+
if (seq !== gotoSeq || (mayCommit && !mayCommit())) return
|
|
134
181
|
if (!home) return useStore.getState().toast(`"${target}" is not on any board`)
|
|
135
|
-
await landOn(home, target, false, seq, from)
|
|
182
|
+
await landOn(home, target, false, seq, from, mayCommit)
|
|
136
183
|
}
|
|
@@ -85,10 +85,15 @@ export const ArrowRightIcon = icon(<path d="M221.66,133.66l-72,72a8,8,0,0,1-11.3
|
|
|
85
85
|
export const VariantsIcon = icon(<path d="M223.45,208.19,168,101.11V40h8a8,8,0,0,0,0-16H80a8,8,0,0,0,0,16h8v61.11L32.55,208.19A16,16,0,0,0,46.86,232H209.14a16,16,0,0,0,14.31-23.81ZM102.13,108.5A8,8,0,0,0,104,103.35V40h48v63.35a8,8,0,0,0,1.87,5.15L179.36,157c-11.71,2.87-26.5.66-44.16-6.64-14.08-5.82-27.34-8.53-39.66-8.16ZM46.86,216,84.36,143.6c11.68-2.9,26.47-.68,44.13,6.61,13.09,5.42,25.36,8.11,36.65,8.11a67.86,67.86,0,0,0,22.53-3.72L209.14,216Z" />)
|
|
86
86
|
/** The board glyph, for a board with no type. */
|
|
87
87
|
export const CardsIcon = icon(<path d="M184,72H40A16,16,0,0,0,24,88V200a16,16,0,0,0,16,16H184a16,16,0,0,0,16-16V88A16,16,0,0,0,184,72Zm0,128H40V88H184V200ZM232,56V176a8,8,0,0,1-16,0V56H64a8,8,0,0,1,0-16H216A16,16,0,0,1,232,56Z" />)
|
|
88
|
-
|
|
89
|
-
export
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
/* spec 31 F.1: the built-in glyphs beyond Phosphor's devices, drawn in the same 256-space and stroke. */
|
|
89
|
+
export const WatchIcon = icon(<><rect x="64" y="64" width="128" height="128" rx="32" fill="none" stroke="currentColor" strokeWidth="16" /><path d="M92 64 L100 24 H156 L164 64 M92 192 L100 232 H156 L164 192" fill="none" stroke="currentColor" strokeWidth="16" strokeLinejoin="round" /><path d="M128 104 V128 H148" fill="none" stroke="currentColor" strokeWidth="14" strokeLinecap="round" strokeLinejoin="round" /></>)
|
|
90
|
+
export const DesktopIcon = icon(<><rect x="24" y="40" width="208" height="144" rx="16" fill="none" stroke="currentColor" strokeWidth="16" /><path d="M24 152 H232 M128 184 V216 M88 216 H168" fill="none" stroke="currentColor" strokeWidth="16" strokeLinecap="round" /></>)
|
|
91
|
+
export const EreaderIcon = icon(<><rect x="52" y="24" width="152" height="208" rx="20" fill="none" stroke="currentColor" strokeWidth="16" /><path d="M88 72 H168 M88 104 H168 M88 136 H144" fill="none" stroke="currentColor" strokeWidth="14" strokeLinecap="round" /><path d="M112 196 H144" fill="none" stroke="currentColor" strokeWidth="14" strokeLinecap="round" /></>)
|
|
92
|
+
|
|
93
|
+
/** A built-in device glyph's icon; an unknown or absent one is the generic Devices. */
|
|
94
|
+
export const DEVICE_GLYPH_ICONS: Record<string, typeof DevicesIcon> = {
|
|
95
|
+
mobile: DeviceMobileIcon, tablet: DeviceTabletIcon, laptop: LaptopIcon, monitor: MonitorIcon, tv: TvIcon,
|
|
96
|
+
watch: WatchIcon, desktop: DesktopIcon, ereader: EreaderIcon,
|
|
92
97
|
}
|
|
93
98
|
|
|
94
99
|
export const BrowsersIcon = icon(<path d="M216,40H72A16,16,0,0,0,56,56V72H40A16,16,0,0,0,24,88V200a16,16,0,0,0,16,16H184a16,16,0,0,0,16-16V184h16a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM184,88v16H40V88Zm0,112H40V120H184v80Zm32-32H200V88a16,16,0,0,0-16-16H72V56H216Z" />)
|
|
@@ -112,4 +117,6 @@ export const FileCodeIcon = icon(<path d="M181.66,146.34a8,8,0,0,1,0,11.32l-24,2
|
|
|
112
117
|
export const KeyboardIcon = icon(<path d="M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z" />)
|
|
113
118
|
export const ArrowBendUpLeftIcon = icon(<path d="M232,200a8,8,0,0,1-16,0,88.1,88.1,0,0,0-88-88H51.31l34.35,34.34a8,8,0,0,1-11.32,11.32l-48-48a8,8,0,0,1,0-11.32l48-48A8,8,0,0,1,85.66,61.66L51.31,96H128A104.11,104.11,0,0,1,232,200Z" />)
|
|
114
119
|
export const WarningIcon = icon(<path d="M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z" />)
|
|
120
|
+
/** Phosphor's Export: a page with an arrow up out of it (Export PDF, spec 31) */
|
|
121
|
+
export const ExportIcon = icon(<path d="M216,112v96a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V112A16,16,0,0,1,56,96H80a8,8,0,0,1,0,16H56v96H200V112H176a8,8,0,0,1,0-16h24A16,16,0,0,1,216,112ZM93.66,69.66,120,43.31V136a8,8,0,0,0,16,0V43.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,69.66Z" />)
|
|
115
122
|
export const NotebookIcon = icon(<path d="M184,112a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16h64A8,8,0,0,1,184,112Zm-8,24H112a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16Zm48-88V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48ZM48,208H72V48H48Zm160,0V48H88V208H208Z" />)
|