deictic 0.0.1 → 0.2.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/LICENSE +21 -0
- package/README.md +167 -0
- package/dist/annotations/client.d.ts +4 -0
- package/dist/annotations/client.d.ts.map +1 -0
- package/dist/annotations/client.js +497 -0
- package/dist/annotations/client.js.map +1 -0
- package/dist/annotations/index.d.ts +110 -0
- package/dist/annotations/index.d.ts.map +1 -0
- package/dist/annotations/index.js +22 -0
- package/dist/annotations/index.js.map +1 -0
- package/dist/astro.d.ts +29 -0
- package/dist/astro.d.ts.map +1 -0
- package/dist/astro.js +24 -0
- package/dist/astro.js.map +1 -0
- package/dist/bun.d.ts +12 -0
- package/dist/bun.d.ts.map +1 -0
- package/dist/bun.js +67 -0
- package/dist/bun.js.map +1 -0
- package/dist/client/index.d.ts +95 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +1333 -0
- package/dist/client/index.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/loader.d.ts +15 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +17 -0
- package/dist/loader.js.map +1 -0
- package/dist/next.d.ts +17 -0
- package/dist/next.d.ts.map +1 -0
- package/dist/next.js +150 -0
- package/dist/next.js.map +1 -0
- package/dist/recommended/index.d.ts +25 -0
- package/dist/recommended/index.d.ts.map +1 -0
- package/dist/recommended/index.js +19 -0
- package/dist/recommended/index.js.map +1 -0
- package/dist/recordings/client.d.ts +4 -0
- package/dist/recordings/client.d.ts.map +1 -0
- package/dist/recordings/client.js +376 -0
- package/dist/recordings/client.js.map +1 -0
- package/dist/recordings/index.d.ts +2 -0
- package/dist/recordings/index.js +3 -0
- package/dist/screenshots/client.d.ts +23 -0
- package/dist/screenshots/client.d.ts.map +1 -0
- package/dist/screenshots/client.js +76 -0
- package/dist/screenshots/client.js.map +1 -0
- package/dist/screenshots/dom.d.ts +4 -0
- package/dist/screenshots/dom.d.ts.map +1 -0
- package/dist/screenshots/dom.js +92 -0
- package/dist/screenshots/dom.js.map +1 -0
- package/dist/screenshots/index.d.ts +2 -0
- package/dist/screenshots/index.js +98 -0
- package/dist/screenshots/index.js.map +1 -0
- package/dist/screenshots/rrweb.d.ts +9 -0
- package/dist/screenshots/rrweb.d.ts.map +1 -0
- package/dist/screenshots/rrweb.js +60 -0
- package/dist/screenshots/rrweb.js.map +1 -0
- package/dist/shared/endpoints.js +354 -0
- package/dist/shared/endpoints.js.map +1 -0
- package/dist/shared/index.d.ts +226 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index2.d.ts +98 -0
- package/dist/shared/index2.d.ts.map +1 -0
- package/dist/shared/index3.d.ts +86 -0
- package/dist/shared/index3.d.ts.map +1 -0
- package/dist/shared/index4.d.ts +184 -0
- package/dist/shared/index4.d.ts.map +1 -0
- package/dist/shared/index5.d.ts +70 -0
- package/dist/shared/index5.d.ts.map +1 -0
- package/dist/shared/integration.d.ts +20 -0
- package/dist/shared/integration.d.ts.map +1 -0
- package/dist/shared/integration.js +279 -0
- package/dist/shared/integration.js.map +1 -0
- package/dist/shared/kept.js +23 -0
- package/dist/shared/kept.js.map +1 -0
- package/dist/shared/marks.js +14 -0
- package/dist/shared/marks.js.map +1 -0
- package/dist/shared/playwright.js +105 -0
- package/dist/shared/playwright.js.map +1 -0
- package/dist/shared/recordings.js +246 -0
- package/dist/shared/recordings.js.map +1 -0
- package/dist/shared/shortcut.js +63 -0
- package/dist/shared/shortcut.js.map +1 -0
- package/dist/shared/tasks.js +521 -0
- package/dist/shared/tasks.js.map +1 -0
- package/dist/shared/waveform.js +93 -0
- package/dist/shared/waveform.js.map +1 -0
- package/dist/tailwind/client.d.ts +4 -0
- package/dist/tailwind/client.d.ts.map +1 -0
- package/dist/tailwind/client.js +613 -0
- package/dist/tailwind/client.js.map +1 -0
- package/dist/tailwind/index.d.ts +2 -0
- package/dist/tailwind/index.js +557 -0
- package/dist/tailwind/index.js.map +1 -0
- package/dist/tasks/client.d.ts +6 -0
- package/dist/tasks/client.d.ts.map +1 -0
- package/dist/tasks/client.js +642 -0
- package/dist/tasks/client.js.map +1 -0
- package/dist/tasks/index.d.ts +2 -0
- package/dist/tasks/index.js +1 -0
- package/dist/vite.d.ts +16 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +61 -0
- package/dist/vite.js.map +1 -0
- package/dist/voice/client.d.ts +4 -0
- package/dist/voice/client.d.ts.map +1 -0
- package/dist/voice/client.js +66 -0
- package/dist/voice/client.js.map +1 -0
- package/dist/voice/index.d.ts +47 -0
- package/dist/voice/index.d.ts.map +1 -0
- package/dist/voice/index.js +74 -0
- package/dist/voice/index.js.map +1 -0
- package/dist/webpack.d.ts +50 -0
- package/dist/webpack.d.ts.map +1 -0
- package/dist/webpack.js +78 -0
- package/dist/webpack.js.map +1 -0
- package/package.json +307 -7
- package/skills/deictic/SKILL.md +47 -0
- package/skills/deictic/references/install.md +96 -0
- package/skills/deictic/references/recordings.md +83 -0
- package/skills/deictic/references/tasks.md +79 -0
- package/skills/deictic/references/watch.md +43 -0
- package/skills/deictic/scripts/frame.mjs +62 -0
- package/skills/deictic/scripts/lib.mjs +211 -0
- package/skills/deictic/scripts/recording.mjs +186 -0
- package/skills/deictic/scripts/task.mjs +84 -0
- package/skills/deictic/scripts/transcribe.mjs +93 -0
- package/skills/deictic/scripts/voice.mjs +50 -0
- package/skills/deictic/scripts/watch.mjs +51 -0
- package/src/astro.ts +34 -0
- package/src/bun.ts +79 -0
- package/src/client/index.ts +846 -0
- package/src/client/lightbox.ts +256 -0
- package/src/client/style.ts +243 -0
- package/src/client/tooltip.ts +78 -0
- package/src/client/waveform.ts +98 -0
- package/src/index.ts +247 -0
- package/src/loader.ts +28 -0
- package/src/next.ts +133 -0
- package/src/plugins/annotations/client.ts +301 -0
- package/src/plugins/annotations/draw.ts +169 -0
- package/src/plugins/annotations/index.ts +105 -0
- package/src/plugins/annotations/svg.ts +61 -0
- package/src/plugins/recommended/index.ts +35 -0
- package/src/plugins/recordings/client.ts +316 -0
- package/src/plugins/recordings/index.ts +175 -0
- package/src/plugins/recordings/marks.ts +11 -0
- package/src/plugins/recordings/ours.ts +70 -0
- package/src/plugins/recordings/replay.ts +165 -0
- package/src/plugins/screenshots/client.ts +64 -0
- package/src/plugins/screenshots/dom.ts +79 -0
- package/src/plugins/screenshots/index.ts +194 -0
- package/src/plugins/screenshots/playwright.ts +119 -0
- package/src/plugins/screenshots/rrweb.ts +45 -0
- package/src/plugins/tailwind/catalog.ts +396 -0
- package/src/plugins/tailwind/client.ts +669 -0
- package/src/plugins/tailwind/index.ts +267 -0
- package/src/plugins/tasks/client.ts +622 -0
- package/src/plugins/tasks/index.ts +557 -0
- package/src/plugins/tasks/local.ts +170 -0
- package/src/plugins/voice/client.ts +58 -0
- package/src/plugins/voice/index.ts +114 -0
- package/src/shortcut.ts +83 -0
- package/src/tools/astro.ts +81 -0
- package/src/tools/editor.ts +22 -0
- package/src/tools/endpoints.ts +163 -0
- package/src/tools/history.ts +203 -0
- package/src/tools/integration.ts +108 -0
- package/src/tools/kept.ts +21 -0
- package/src/tools/locate.ts +94 -0
- package/src/tools/plugins.ts +41 -0
- package/src/tools/source.ts +72 -0
- package/src/vite.ts +81 -0
- package/src/webpack.ts +107 -0
- package/index.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["div","button"],"sources":["../../src/client/lightbox.ts","../../src/client/style.ts","../../src/client/tooltip.ts","../../src/client/index.ts"],"sourcesContent":["/**\n * The lightbox: what a panel has attached (a capture, a recording's replay, a voice clip), big, over everything,\n * one at a time, ← and → between them. It grows out of the element that opened it and shrinks back into it, or\n * fades where motion is reduced. A sound plays in a player of its own: play, its waveform with what's played\n * lit (click or drag it to seek), and the time. It's a modal (`data-deictic-modal`): Esc closes it, not the popup.\n */\nimport type { LightboxItem, LightboxOptions } from '#src/index.ts';\n\nimport { type Colors, drawBars, peaksOf } from './waveform.ts';\n\nconst EASE = 'cubic-bezier(0.2, 0.8, 0.2, 1)';\nconst PLAY = '<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M7 4v16l13-8z\" fill=\"currentColor\"/></svg>';\nconst PAUSE = '<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M6 4h4v16H6zM14 4h4v16h-4z\" fill=\"currentColor\"/></svg>';\n\nconst reduced = () => matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst clock = (s: number) => `${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, '0')}`;\n\n/**\n * Opens it in `root`. `pinned` draws it where `root` is in the page instead, with no backdrop, motion or keys, and\n * actions that don't close it: for a page of deictic's own states (`lightboxIn`).\n */\nexport function openLightbox(\n root: ShadowRoot,\n items: LightboxItem[],\n { at = 0, from, pinned = false }: LightboxOptions & { pinned?: boolean } = {},\n): { close: () => void } {\n const box = div(pinned ? 'lightbox pinned' : 'lightbox');\n if (!pinned) {\n box.dataset.deicticModal = '';\n box.setAttribute('role', 'dialog');\n box.setAttribute('aria-modal', 'true');\n }\n const backdrop = div('lb-backdrop');\n const stage = div('lb-stage');\n const head = div('lb-head');\n const title = div('lb-title');\n const count = div('lb-count');\n const actions = div('lb-actions');\n const close = button('×', 'Close (Esc)', 'lb-close');\n head.append(title, count, actions, close);\n const body = div('lb-body');\n stage.append(head, body);\n const prev = button('‹', 'Previous (←)', 'lb-prev');\n const next = button('›', 'Next (→)', 'lb-next');\n box.append(backdrop, stage, ...(items.length > 1 ? [prev, next] : []));\n root.append(box);\n\n let index = Math.min(Math.max(0, at), items.length - 1);\n let leave: (() => void) | undefined;\n let closing = false;\n\n const show = (i: number, animate: boolean) => {\n leave?.();\n leave = undefined;\n index = (i + items.length) % items.length;\n const item = items[index]!;\n box.setAttribute('aria-label', item.title);\n title.textContent = item.title;\n count.textContent = items.length > 1 ? `${index + 1} / ${items.length}` : '';\n actions.replaceChildren(\n ...(item.actions ?? []).map((a) => {\n const b = button(a.label, a.title ?? '', '');\n b.addEventListener('click', () => {\n if (!pinned) done();\n a.run();\n });\n return b;\n }),\n );\n // A sound plays as it opens, but not on a page that only shows the lightbox.\n const content = contentOf(item, !pinned);\n body.replaceChildren(content.element);\n leave = content.leave;\n if (animate && !reduced()) body.animate({ opacity: [0, 1] }, { duration: 160, easing: 'ease-out' });\n };\n\n /** The transform that puts the stage where `from` is: what it grows from and shrinks back to. */\n const fromRect = () => {\n if (from === undefined || !from.isConnected) return undefined;\n const f = from.getBoundingClientRect();\n const s = stage.getBoundingClientRect();\n if (f.width === 0 || s.width === 0) return undefined;\n return `translate(${f.left - s.left}px, ${f.top - s.top}px) scale(${f.width / s.width}, ${f.height / s.height})`;\n };\n\n const onKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') done();\n else if (e.key === 'ArrowLeft' && items.length > 1) show(index - 1, true);\n else if (e.key === 'ArrowRight' && items.length > 1) show(index + 1, true);\n else return;\n // The popup, under it, waits for its own Esc.\n e.preventDefault();\n e.stopImmediatePropagation();\n };\n if (!pinned) addEventListener('keydown', onKey, true);\n\n function done() {\n if (closing) return;\n closing = true;\n removeEventListener('keydown', onKey, true);\n leave?.();\n if (pinned) return box.remove();\n const gone = () => {\n box.remove();\n if (from instanceof HTMLElement && from.isConnected) from.focus({ preventScroll: true });\n };\n if (reduced()) return gone();\n const to = fromRect();\n backdrop.animate({ opacity: [1, 0] }, { duration: 200, easing: 'ease-in', fill: 'forwards' });\n stage\n .animate(\n to === undefined\n ? { opacity: [1, 0], transform: ['none', 'scale(0.96)'] }\n : { transform: ['none', to], opacity: [1, 1, 0], offset: [0, 0.8, 1] },\n { duration: 220, easing: EASE, fill: 'forwards' },\n )\n .finished.then(gone, gone);\n }\n\n backdrop.addEventListener('click', done);\n close.addEventListener('click', done);\n prev.addEventListener('click', () => show(index - 1, true));\n next.addEventListener('click', () => show(index + 1, true));\n\n show(index, false);\n if (pinned) {\n close.hidden = true;\n return { close: done };\n }\n close.focus({ preventScroll: true });\n if (reduced()) {\n box.animate({ opacity: [0, 1] }, { duration: 150 });\n } else {\n backdrop.animate({ opacity: [0, 1] }, { duration: 240, easing: 'ease-out' });\n const grow = fromRect();\n stage.animate(\n grow === undefined\n ? { opacity: [0, 1], transform: ['scale(0.96)', 'none'] }\n : { transform: [grow, 'none'], opacity: [0, 1, 1], offset: [0, 0.2, 1] },\n { duration: 280, easing: EASE },\n );\n }\n return { close: done };\n}\n\n/** An item, drawn: what goes in the body, and what to stop when it's left (a sound playing). */\nfunction contentOf(item: LightboxItem, autoplay: boolean): { element: HTMLElement; leave?: () => void } {\n switch (item.kind) {\n case 'image': {\n const img = Object.assign(document.createElement('img'), { src: item.url, alt: item.title, className: 'lb-image', draggable: false });\n return { element: img };\n }\n case 'page': {\n const frame = Object.assign(document.createElement('iframe'), { src: item.url, title: item.title, className: 'lb-page' });\n frame.allow = 'autoplay; fullscreen';\n return { element: frame };\n }\n case 'audio':\n return player(item.url, autoplay);\n }\n}\n\n/** A sound: play and pause, its waveform with what's played lit, and the time. With `autoplay`, it starts playing. */\nfunction player(url: string, autoplay: boolean): { element: HTMLElement; leave: () => void } {\n const el = div('lb-audio');\n const play = button('', 'Play (Space)', 'lb-play');\n const wave = Object.assign(document.createElement('canvas'), { className: 'lb-wave' });\n wave.setAttribute('role', 'slider');\n wave.setAttribute('aria-label', 'Where in the clip');\n wave.tabIndex = 0;\n const time = div('lb-time');\n el.append(play, wave, time);\n const audio = new Audio(url);\n const colors: Colors = { played: '#3ddc7c', rest: '#52525b' };\n // Flat until the clip's read: the bars rise when its peaks are in.\n let peaks: number[] = Array<number>(120).fill(0.05);\n let frame = 0;\n // MediaRecorder's webm says no length until it's played through; reading the peaks gives it sooner.\n let length = 0;\n const lengthOf = () => (Number.isFinite(audio.duration) && audio.duration > 0 ? audio.duration : length);\n const draw = () => {\n const total = lengthOf();\n drawBars(wave, peaks, total > 0 ? audio.currentTime / total : 0, colors);\n time.textContent = `${clock(audio.currentTime)} / ${total > 0 ? clock(total) : '–:––'}`;\n wave.setAttribute('aria-valuenow', String(Math.round(audio.currentTime)));\n };\n const loop = () => {\n draw();\n frame = audio.paused ? 0 : requestAnimationFrame(loop);\n };\n const state = () => {\n play.innerHTML = audio.paused ? PLAY : PAUSE;\n play.title = audio.paused ? 'Play (Space)' : 'Pause (Space)';\n if (!audio.paused && frame === 0) frame = requestAnimationFrame(loop);\n draw();\n };\n audio.addEventListener('play', state);\n audio.addEventListener('pause', state);\n audio.addEventListener('ended', state);\n audio.addEventListener('loadedmetadata', draw);\n const toggle = () => void (audio.paused ? audio.play().catch(() => {}) : audio.pause());\n play.addEventListener('click', toggle);\n const seek = (e: PointerEvent) => {\n const r = wave.getBoundingClientRect();\n const total = lengthOf();\n if (total > 0) audio.currentTime = Math.min(1, Math.max(0, (e.clientX - r.left) / r.width)) * total;\n draw();\n };\n wave.addEventListener('pointerdown', (e) => {\n wave.setPointerCapture(e.pointerId);\n seek(e);\n });\n wave.addEventListener('pointermove', (e) => {\n if (wave.hasPointerCapture(e.pointerId)) seek(e);\n });\n el.addEventListener('keydown', (e) => {\n if (e.key !== ' ') return;\n e.preventDefault();\n toggle();\n });\n void peaksOf(url, 120).then(\n (read) => {\n peaks = read.peaks;\n length = read.duration;\n draw();\n },\n // Undecodable here: the player still plays it, over flat bars.\n () => {},\n );\n state();\n if (autoplay) void audio.play().catch(() => state());\n // The canvas has its size once it's in the page.\n requestAnimationFrame(draw);\n return {\n element: el,\n leave: () => {\n audio.pause();\n cancelAnimationFrame(frame);\n },\n };\n}\n\nfunction div(className: string): HTMLDivElement {\n const el = document.createElement('div');\n el.className = className;\n return el;\n}\n\nfunction button(text: string, title: string, className: string): HTMLButtonElement {\n const el = document.createElement('button');\n el.type = 'button';\n el.textContent = text;\n el.title = title;\n el.className = className;\n return el;\n}\n","/**\n * The overlay's styles, in its shadow root. Panels style their bodies with the same custom\n * properties, so a plugin's panel looks like the rest without styles of its own for the basics.\n */\nexport const STYLE = `\n:host {\n --deictic-accent: #12b358;\n --deictic-on-accent: #04130b;\n --deictic-bg: #18181b;\n --deictic-fg: #f4f4f5;\n --deictic-muted: #a1a1aa;\n --deictic-line: #3f3f46;\n --deictic-problem: #f87171;\n all: initial;\n /* Inherited by everything in the root: a thumb and no track, on whatever the panel's background is. */\n scrollbar-color: var(--deictic-line) transparent;\n}\n/* The host takes no room in the page: everything in it is fixed, so nothing of deictic's moves or scrolls it. */\n:host(deictic-overlay) { display: contents; }\n.box {\n position: fixed;\n display: none;\n z-index: 2147483646;\n pointer-events: none;\n box-sizing: border-box;\n outline: 2px solid var(--deictic-accent);\n background: rgb(18 179 88 / 0.1);\n}\n.box.shown { display: block; }\n.box.inner { outline: 1px dashed var(--deictic-accent); background: none; }\n/* 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. */\n.box.on { outline: 1px dashed var(--deictic-accent); border-radius: 4px; background: none; }\n.label {\n position: absolute;\n left: -2px;\n bottom: 100%;\n padding: 1px 6px;\n font: 12px/1.5 ui-monospace, monospace;\n white-space: nowrap;\n color: var(--deictic-on-accent);\n background: var(--deictic-accent);\n}\n.label.below { top: 100%; bottom: auto; }\n.panel {\n position: fixed;\n z-index: 2147483647;\n width: min(360px, calc(100vw - 16px));\n max-height: 60vh;\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n border: 1px solid var(--deictic-line);\n border-radius: 8px;\n box-shadow: 0 12px 32px rgb(0 0 0 / 0.35);\n font: 13px/1.4 system-ui, sans-serif;\n color: var(--deictic-fg);\n background: var(--deictic-bg);\n}\n.panel.pinned { position: relative; z-index: auto; max-height: none; }\n@media (prefers-reduced-motion: no-preference) {\n .panel:not(.pinned) { animation: deictic-in 0.12s ease-out; }\n}\n@keyframes deictic-in {\n from { opacity: 0; translate: 0 4px; }\n}\n.head {\n display: flex;\n align-items: flex-end;\n gap: 2px;\n padding: 4px 8px 0;\n}\n/* Over the page the head is what the popup is dragged by; no touch scrolling starts there. */\n.panel:not(.pinned) .head { cursor: grab; touch-action: none; user-select: none; }\n.panel.dragging .head, .panel.dragging .head button { cursor: grabbing; }\n.head .tab {\n border: 0;\n border-bottom: 2px solid transparent;\n border-radius: 0;\n padding: 4px 8px;\n font-weight: 600;\n color: var(--deictic-muted);\n}\n.head .tab:hover { color: var(--deictic-fg); }\n.head .tab[aria-selected='true'] { color: var(--deictic-fg); border-bottom-color: var(--deictic-accent); }\n.head .close { margin: 0 0 3px auto; }\n.bar {\n display: flex;\n align-items: center;\n gap: 2px;\n padding: 4px 8px;\n border-top: 1px solid var(--deictic-line);\n border-bottom: 1px solid var(--deictic-line);\n}\n.bar .where {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n min-width: 0;\n margin-right: auto;\n font: 12px ui-monospace, monospace;\n color: var(--deictic-muted);\n text-decoration: none;\n}\n.bar .where span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.bar .where svg { flex: none; }\n.bar .where:hover, .bar .where:focus-visible { color: var(--deictic-fg); }\n.bar .where:hover span { text-decoration: underline; }\n.lightbox {\n position: fixed;\n inset: 0;\n z-index: 2147483647;\n display: flex;\n align-items: center;\n justify-content: center;\n font: 13px/1.4 system-ui, sans-serif;\n color: var(--deictic-fg);\n}\n.lb-backdrop { position: absolute; inset: 0; background: rgb(9 9 11 / 0.72); backdrop-filter: blur(2px); }\n.lb-stage {\n position: relative;\n display: flex;\n flex-direction: column;\n max-width: 92vw;\n max-height: 90vh;\n border: 1px solid var(--deictic-line);\n border-radius: 10px;\n background: var(--deictic-bg);\n box-shadow: 0 24px 64px rgb(0 0 0 / 0.5);\n transform-origin: 0 0;\n overflow: hidden;\n}\n.lb-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--deictic-line); }\n.lb-title { font-weight: 600; }\n.lb-count { color: var(--deictic-muted); font-size: 12px; font-variant-numeric: tabular-nums; }\n.lb-actions { display: flex; gap: 6px; margin-left: auto; }\n.lb-body { display: flex; justify-content: center; min-height: 0; background: #09090b; }\n.lb-image { display: block; max-width: 92vw; max-height: calc(90vh - 48px); object-fit: contain; }\n.lb-page { display: block; width: min(1280px, 92vw); height: min(860px, calc(90vh - 48px)); border: 0; background: #18181b; }\n.lb-audio { display: flex; align-items: center; gap: 12px; width: min(640px, 86vw); padding: 20px 16px; }\n.lb-play {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 40px;\n height: 40px;\n padding: 0;\n border: 0;\n border-radius: 50%;\n color: var(--deictic-on-accent);\n background: var(--deictic-accent);\n}\n.lb-play svg { width: 16px; height: 16px; }\n.lb-wave { flex: 1; min-width: 0; height: 56px; cursor: pointer; border-radius: 4px; }\n.lb-wave:focus-visible { outline: 1px solid var(--deictic-accent); outline-offset: 2px; }\n.lb-time { flex: none; min-width: 9ch; text-align: right; font: 12px ui-monospace, monospace; color: var(--deictic-muted); }\n.lb-prev, .lb-next {\n position: absolute;\n top: 50%;\n translate: 0 -50%;\n width: 40px;\n height: 40px;\n padding: 0;\n border: 1px solid var(--deictic-line);\n border-radius: 50%;\n font-size: 22px;\n line-height: 1;\n background: var(--deictic-bg);\n}\n.lb-prev { left: 16px; }\n.lb-next { right: 16px; }\n.lightbox.pinned { position: relative; inset: auto; z-index: auto; display: block; padding: 0 64px; }\n.lightbox.pinned .lb-stage { max-width: 100%; max-height: none; }\n.lightbox.pinned .lb-page { width: 100%; height: 420px; }\n.lightbox.pinned .lb-image { max-width: 100%; max-height: 420px; }\n.lightbox.pinned .lb-backdrop { display: none; }\n.lightbox.pinned .lb-audio { width: 100%; box-sizing: border-box; }\n.lightbox.pinned .lb-close { display: none; }\n.tip {\n position: fixed;\n left: 0;\n top: 0;\n z-index: 2147483647;\n max-width: 280px;\n padding: 3px 6px;\n border: 1px solid var(--deictic-line);\n border-radius: 4px;\n font: 12px/1.4 system-ui, sans-serif;\n color: var(--deictic-fg);\n background: #09090b;\n box-shadow: 0 4px 12px rgb(0 0 0 / 0.3);\n pointer-events: none;\n visibility: hidden;\n opacity: 0;\n transition: opacity 0.12s;\n}\n.tip.shown { visibility: visible; opacity: 1; }\nbutton {\n font: inherit;\n color: inherit;\n background: transparent;\n border: 1px solid var(--deictic-line);\n border-radius: 4px;\n padding: 1px 7px;\n cursor: pointer;\n}\nbutton:hover { border-color: var(--deictic-muted); }\nbutton:disabled { opacity: 0.5; cursor: default; }\nbutton:disabled:hover { border-color: var(--deictic-line); }\n/* One ring for whatever the keyboard lands on, in place of each browser's own. */\nbutton:focus-visible, a:focus-visible { outline: 1px solid var(--deictic-accent); outline-offset: 1px; }\nbutton.icon {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 22px;\n height: 22px;\n padding: 0;\n border: 0;\n color: var(--deictic-muted);\n}\nbutton.icon svg { width: 14px; height: 14px; }\nbutton.icon:hover:not(:disabled) { color: var(--deictic-fg); background: rgb(255 255 255 / 0.08); }\nbutton.primary { background: var(--deictic-accent); border-color: var(--deictic-accent); color: var(--deictic-on-accent); }\ninput, textarea {\n box-sizing: border-box;\n width: 100%;\n font: 12px ui-monospace, monospace;\n color: inherit;\n background: #09090b;\n border: 1px solid var(--deictic-line);\n border-radius: 4px;\n padding: 4px 6px;\n}\ninput:focus, textarea:focus { outline: 1px solid var(--deictic-accent); }\ncode { font: 12px ui-monospace, monospace; }\n/* Border-box, as the popup holds the body's height by its whole box while a tab reads. */\n.body { box-sizing: border-box; padding: 8px; overflow: auto; }\n.status { padding: 0 8px 6px; font-size: 12px; color: var(--deictic-muted); }\n.status:empty { display: none; }\n.status.problem { color: var(--deictic-problem); }\n`;\n","/**\n * One tooltip for everything deictic draws in a shadow root: whatever has a `title` (or `data-tip`) shows it\n * in a box of ours, soon after the pointer rests or focus lands, instead of the browser's, which comes late\n * and looks like nothing else here. Plugins only set `title`, as they would anywhere; the first hover moves\n * it to `data-tip`, so the browser's own stays away, and gives a textless control the title as its name.\n * The box is fixed in the root, so no panel's scrolling clips it.\n */\nconst DELAY = 300;\n\nexport function tooltips(root: ShadowRoot): void {\n const tip = document.createElement('div');\n tip.className = 'tip';\n tip.setAttribute('role', 'tooltip');\n root.append(tip);\n let timer = 0;\n let over: Element | undefined;\n\n const hide = () => {\n clearTimeout(timer);\n over = undefined;\n tip.classList.remove('shown');\n };\n const show = (el: Element) => {\n const text = el.getAttribute('data-tip');\n if (text === null || text === '' || !el.isConnected) return hide();\n tip.textContent = text;\n // Last in the root, over a modal or toolbar added since at the same z-index.\n if (tip !== root.lastElementChild) root.append(tip);\n tip.classList.add('shown');\n // Centred below it, kept on screen; above it where there's no room below.\n const r = el.getBoundingClientRect();\n const t = tip.getBoundingClientRect();\n const left = Math.max(8, Math.min(r.left + r.width / 2 - t.width / 2, innerWidth - t.width - 8));\n const top = r.bottom + 6 + t.height > innerHeight - 8 ? r.top - 6 - t.height : r.bottom + 6;\n Object.assign(tip.style, { left: `${left}px`, top: `${top}px` });\n };\n /** The element with a tip around where the event happened, its `title` taken over the first time. */\n const tipped = (e: Event) => {\n for (const node of e.composedPath()) {\n if (!(node instanceof Element)) continue;\n if (node === tip) return undefined;\n // A frame's title is its name for assistive tech, not a tip; what's in it has tips of its own.\n if (node.localName === 'iframe') return undefined;\n const title = node.getAttribute('title');\n if (title !== null) {\n node.removeAttribute('title');\n if (title === '') continue;\n node.setAttribute('data-tip', title);\n // A control with no text of its own (an icon, ×, ↶) is known by its tip; one with text keeps its name.\n if (!node.hasAttribute('aria-label') && (node.textContent ?? '').trim().length <= 1) node.setAttribute('aria-label', title);\n else node.setAttribute('aria-description', title);\n }\n if (node.hasAttribute('data-tip')) return node;\n }\n return undefined;\n };\n const enter = (e: Event) => {\n const el = tipped(e);\n if (el === over) return;\n hide();\n if (el === undefined) return;\n over = el;\n timer = window.setTimeout(() => show(el), e.type === 'focusin' ? 0 : DELAY);\n };\n root.addEventListener('pointerover', enter);\n root.addEventListener('focusin', (e) => {\n // Focus from the keyboard only: a click focuses too, and its tip is the pointer's.\n if ((e.target as Element).matches(':focus-visible')) enter(e);\n });\n root.addEventListener('pointerout', (e) => {\n const to = (e as PointerEvent).relatedTarget;\n if (over !== undefined && !(to instanceof Node && over.contains(to))) hide();\n });\n root.addEventListener('focusout', hide);\n // A press acts, and what it changes (a mic turned on) may change the tip: the next hover shows the new one.\n root.addEventListener('pointerdown', hide);\n addEventListener('scroll', hide, { capture: true, passive: true });\n}\n","/**\n * `deictic/client`: the overlay the page loads in dev. Hold a shortcut's keys (Alt, deictic's own,\n * by default) and point: the element under the pointer that the source marked (`tools/locate.ts`) is\n * outlined, with its tag, its place and how many elements share it. Press the shortcut's button to open\n * the popup there: a tab for each plugin with a panel, at the one used last, or at a plugin's own where\n * its shortcut was pressed.\n *\n * Everything drawn sits in one shadow root, so neither the page's styles nor ours cross over. A\n * panel's undo and redo are its tab's on its element: the latest change that plugin made there.\n */\nimport type { ClientContext, ClientPlugin, LightboxItem, PanelContext, Resumed, Standalone, Target } from '#src/index.ts';\nimport { gestureOf, type Shortcut } from '#src/shortcut.ts';\n\nimport { openLightbox } from './lightbox.ts';\nimport { STYLE } from './style.ts';\nimport { tooltips } from './tooltip.ts';\n\n// For a plugin's page half that records the mic, or shows a clip: the waveforms the lightbox draws.\nexport { drawBars, liveWaveform, peaksOf, type Colors } from './waveform.ts';\n\nexport interface StartOptions {\n /** The dev server's base URL, ending in `/`. */\n base: string;\n /** deictic's own shortcut, checked: it opens the popup at the tab used last. None where it's turned off. */\n shortcut?: Required<Shortcut>;\n /** Each plugin with a half in the page, and its own shortcut as the bundler's plugin checked it, where it has one. */\n plugins: { plugin: ClientPlugin; shortcut?: Required<Shortcut>; options?: unknown }[];\n /** What answers the requests where there's no dev server to: a `standalone` build's. */\n server?: Standalone;\n}\n\n/** A request to the endpoints, by its URL: to the dev server, or to what stands in for it. */\ntype Send = (url: string, init?: RequestInit) => Promise<Response>;\n\ntype Mount = (panel: HTMLElement, context: PanelContext<unknown, unknown>) => (() => void) | void;\n\n/** A plugin with a panel: a tab in the popup. */\ninterface Tab {\n plugin: ClientPlugin;\n mount: Mount;\n}\n\nconst ATTRIBUTE = 'data-deictic';\n/** An arrow pointing up and out: the link leaves the page for the editor. */\nconst OUT = icon('M7 17 17 7M8 7h9v9', 2.25);\n// Drawn, as the arrows and the cross of a system's font differ in size and weight from one to the next.\nconst UNDO = icon('M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11');\nconst REDO = icon('m15 14 5-5-5-5M20 9H9.5a5.5 5.5 0 0 0 0 11H13');\nconst CLOSE = icon('M18 6 6 18M6 6l12 12');\n/** Where the tab used last is kept, for deictic's own shortcut to open it again. */\nconst LAST = 'deictic:tab';\n/** How long a read may take, in milliseconds, before the popup says it's reading. */\nconst SLOW = 200;\nconst STARTED = Symbol.for('deictic');\n\nexport function targetOf(el: Element): Target | undefined {\n const at = el.getAttribute(ATTRIBUTE);\n const match = at === null ? null : /^(.*):(\\d+):(\\d+)$/.exec(at);\n if (match === null) return undefined;\n return { loc: { file: match[1]!, line: Number(match[2]), column: Number(match[3]) }, tag: el.localName };\n}\n\nconst sameAs = (el: Element) => [...document.querySelectorAll(`[${ATTRIBUTE}=\"${CSS.escape(el.getAttribute(ATTRIBUTE) ?? '')}\"]`)];\n\n/** The nearest marked element around `el`, out through shadow roots to their hosts. */\nfunction markedAround(el: Element): Element | undefined {\n for (let at: Element | undefined = el; at !== undefined;) {\n const marked = at.closest(`[${ATTRIBUTE}]`);\n if (marked !== null) return marked;\n const root = at.getRootNode();\n at = root instanceof ShadowRoot ? root.host : undefined;\n }\n return undefined;\n}\n\n/** `div.panel > button.tab`: the element as a selector, the deepest classes only, for a person to tell it by. */\nfunction icon(path: string, width = 2): string {\n return `<svg viewBox=\"0 0 24 24\" width=\"12\" height=\"12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"${width}\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"${path}\"/></svg>`;\n}\n\nconst nameOf = (el: Element) => `${el.localName}${[...el.classList].map((c) => `.${c}`).join('')}`;\n\n/** What the overlay keeps once started, for `popupIn` to show the popup with. */\ninterface Started {\n base: string;\n send: Send;\n contextOf: (name: string) => ClientContext;\n tabs: Tab[];\n /** Opens the popup over the page on an element, at a tab or the one used last: `openPopup`. */\n open: (element: Element, tab?: string) => boolean;\n}\n\nlet started: Started | undefined;\n\n/**\n * What the page hears on `window` as the popup opens over it on an element (its `detail` a `PopupOpened`) and as\n * it closes: for a page that moves on its own to hold still meanwhile, as deictic's site does. Not for one pinned.\n */\nexport const POPUP_OPENED = 'deictic:open';\nexport const POPUP_CLOSED = 'deictic:close';\n\nexport interface PopupOpened {\n /** The element it's open on. */\n element: Element;\n /** The plugin whose tab it opened at. */\n tab: string;\n}\n\n/**\n * Opens the popup over the page on `element`, as deictic's own shortcut does: at `tab` (a plugin's name), or at the\n * tab used last. For a page that opens it from a gesture of its own, as deictic's site does on a plain click.\n * Answers whether it opened: not where no plugin has a tab, or `element` has no mark. The overlay must have started.\n */\nexport function openPopup(element: Element, { tab }: { tab?: string } = {}): boolean {\n if (started === undefined) throw new Error('deictic: the overlay has not started, so there is no popup to open');\n return started.open(element, tab);\n}\n\n/**\n * Shows the popup in `container`, open at a tab (`tab`, a plugin's name, or the first) on `element`, where\n * the page puts it rather than over the page: a page of the popup's states, to point at and fix, as deictic's\n * own site does. It's the real popup, its tabs and plugins working. Closing it, or a tab's `away`, opens it\n * again in place. It draws in `container`'s shadow root, made if there isn't one. Answers what removes it.\n * The overlay must have started (the dev server's client module starts it), and `element` be marked.\n */\nexport function popupIn(container: Element, { tab: name, element }: { tab?: string; element: Element }): () => void {\n if (started === undefined) throw new Error('deictic: the overlay has not started, so there is no popup to show');\n const target = targetOf(element);\n if (target === undefined) throw new Error(`deictic: ${nameOf(element)} has no ${ATTRIBUTE} mark to open the popup on`);\n const { base, send, contextOf, tabs } = started;\n // A tab shown here isn't one a person chose: the popup over the page keeps opening at theirs.\n const remember = () => {};\n const tab = tabs.find((t) => t.plugin.name === name) ?? tabs[0];\n if (tab === undefined) throw new Error('deictic: no plugin has a tab to show');\n const root = container.shadowRoot ?? container.attachShadow({ mode: 'open' });\n const style = document.createElement('style');\n style.textContent = `${STYLE}:host { display: block; }`;\n root.replaceChildren(style);\n tooltips(root);\n let panel: { close: () => void } | undefined;\n let gone = false;\n const open = (at: Tab, resumed?: Resumed) => {\n panel = openPanel({\n base,\n send,\n root,\n contextOf,\n tabs,\n tab: at,\n remember,\n element,\n target,\n pinned: true,\n onClose: (shown, leaving) => {\n panel = undefined;\n // Closed by its own × or Esc: open again, as the page is there to show it. Leaving for `away` comes back by `reopen`.\n if (!gone && !leaving) open(shown);\n },\n ...(resumed === undefined ? {} : { resumed }),\n reopen: (again, _, kept) => open(again, kept),\n });\n };\n open(tab);\n return () => {\n gone = true;\n panel?.close();\n style.remove();\n };\n}\n\n/**\n * Shows the lightbox in `container`, at `at`, where the page puts it rather than over everything: as `popupIn`\n * does the popup, for a page of deictic's own states. Its items step with its arrows; there's no backdrop, close\n * or keys, and an item's actions run without closing it. Answers what removes it.\n */\nexport function lightboxIn(container: Element, items: LightboxItem[], { at }: { at?: number } = {}): () => void {\n const root = container.shadowRoot ?? container.attachShadow({ mode: 'open' });\n const style = document.createElement('style');\n style.textContent = `${STYLE}:host { display: block; }`;\n root.replaceChildren(style);\n tooltips(root);\n const { close } = openLightbox(root, items, { ...(at === undefined ? {} : { at }), pinned: true });\n return () => {\n close();\n style.remove();\n };\n}\n\n/** Starts the overlay, once per page: the client module runs again when a module importing it is replaced. */\nexport function start({ base, shortcut: own, plugins: given, server }: StartOptions): void {\n const page = globalThis as { [STARTED]?: true };\n if (page[STARTED] === true) return;\n page[STARTED] = true;\n\n const host = document.createElement('deictic-overlay');\n const root = host.attachShadow({ mode: 'open' });\n const style = document.createElement('style');\n style.textContent = STYLE;\n const box = div('box');\n const label = div('label');\n box.append(label);\n // What's under the pointer, outlined inside the marked element around it when they differ.\n const inner = div('box inner');\n root.append(style, box, inner);\n tooltips(root);\n // What's typed in the popup is the popup's: the page hears a key from in here as one on the host, not in a field,\n // so its own shortcuts (a \"/\" to search, a \"j\" to step) would run on a task's words. Ours listen while capturing.\n for (const type of ['keydown', 'keypress', 'keyup'] as const) host.addEventListener(type, (e) => e.stopPropagation());\n document.documentElement.append(host);\n\n // Each plugin's API, set up before any panel opens. `use` reads it when asked, so a setup may keep\n // `use` for later, not call it: the plugin it asks for may not be set up yet.\n const apis = new Map<string, unknown>();\n const send: Send =\n server === undefined ? (url, init) => fetch(url, init) : async (url, init) => server(new Request(new URL(url, location.href), init));\n const optionsOf = new Map(given.map(({ plugin, options }) => [plugin.name, options]));\n const contextOf = (name: string): ClientContext => ({\n base,\n root,\n options: optionsOf.get(name),\n use: (other) => apis.get(other) as never,\n request: (route, init) => send(`${base}__deictic/plugins/${name}/${route}`, init),\n open: (plugin, element) => openAt(plugin, element),\n lightbox: (items, options) => openLightbox(root, items, options),\n });\n for (const { plugin } of given) {\n if (plugin.setup === undefined) continue;\n try {\n apis.set(plugin.name, plugin.setup(contextOf(plugin.name)));\n } catch (e) {\n // One plugin's failure is no reason to take the others down with it.\n console.error(`deictic: ${plugin.name} failed to set up`, e);\n }\n }\n const tabs: Tab[] = given.flatMap(({ plugin }) => (plugin.mount === undefined ? [] : [{ plugin, mount: plugin.mount }]));\n started = {\n base,\n send,\n contextOf,\n tabs,\n // Not over a popup holding something unsaved: the press that asked shook its button (`openPanel`).\n open: (element, tab) => tabs.length > 0 && panel?.unsaved() !== true && openAt(tab ?? last().plugin.name, element),\n };\n const last = () => {\n let name: string | null = null;\n try {\n name = localStorage.getItem(LAST);\n } catch {\n // Storage can be off: the first tab, then.\n }\n return tabs.find((t) => t.plugin.name === name) ?? tabs[0]!;\n };\n const remember = (tab: Tab) => {\n try {\n localStorage.setItem(LAST, tab.plugin.name);\n } catch {\n // Not kept, then: the next open starts at the first tab.\n }\n };\n // What opens the popup, and at which tab: deictic's own shortcut at the one used last, each\n // plugin's at its own.\n const plugins = [\n ...(own === undefined || tabs.length === 0 ? [] : [{ shortcut: own, gesture: gestureOf(own), tab: last }]),\n ...given.flatMap(({ plugin, shortcut }) => {\n if (shortcut === undefined) return [];\n const tab = tabs.find((t) => t.plugin === plugin);\n if (tab !== undefined) return [{ shortcut, gesture: gestureOf(shortcut), tab: () => tab }];\n console.error(`deictic: ${plugin.name} has a shortcut, but its page half has no \\`mount\\` to draw a tab with`);\n return [];\n }),\n ];\n\n let pointer: { x: number; y: number } | undefined;\n let frame = 0;\n let panel: { close: () => void; unsaved: () => boolean } | undefined;\n\n /** The plugins whose keys are held: several, where they share keys and differ by button. */\n const heldBy = (e: MouseEvent | KeyboardEvent) => plugins.filter((p) => p.gesture.held(e));\n /** The plugin a press opens. */\n const pressedBy = (e: MouseEvent) => plugins.find((p) => p.gesture.held(e) && e.button === p.gesture.button);\n /**\n * The marked element at a point, and what's under the pointer inside it where that differs: down through\n * open shadow roots but the overlay's own, as a page showing the popup (`popupIn`) has it in one.\n */\n const hitAt = (x: number, y: number) => {\n let under = document.elementFromPoint(x, y) ?? undefined;\n while (under !== undefined && under !== host && under.shadowRoot !== null) {\n const inside = under.shadowRoot.elementFromPoint(x, y);\n if (inside === null || inside === under) break;\n under = inside;\n }\n const el = under === undefined || under === host ? undefined : markedAround(under);\n return el === undefined ? undefined : { el, pointed: under === el ? undefined : under };\n };\n const hide = () => {\n box.classList.remove('shown');\n inner.classList.remove('shown');\n };\n const show = (held: typeof plugins) => {\n frame = 0;\n const hit = pointer === undefined ? undefined : hitAt(pointer.x, pointer.y);\n const el = hit?.el;\n const target = el === undefined ? undefined : targetOf(el);\n if (el === undefined || target === undefined) return hide();\n place(box, el.getBoundingClientRect());\n if (hit?.pointed === undefined) {\n inner.classList.remove('shown');\n } else {\n place(inner, hit.pointed.getBoundingClientRect());\n inner.classList.add('shown');\n }\n const count = sameAs(el).length;\n // The button, where it isn't the left: what the keys alone don't tell apart.\n const names = held.map(({ tab, shortcut }) => {\n const { plugin } = tab();\n const name = plugin.label ?? plugin.name;\n return shortcut.button === 'left' ? name : `${name} (${shortcut.button})`;\n });\n const within = hit?.pointed === undefined ? '' : ` › ${nameOf(hit.pointed)}`;\n label.textContent = `${names.join(' / ')} · <${target.tag}> ${target.loc.file}:${target.loc.line}${count > 1 ? ` · ×${count}` : ''}${within}`;\n label.classList.toggle('below', el.getBoundingClientRect().top < 24);\n box.classList.add('shown');\n };\n const update = (e: MouseEvent | KeyboardEvent) => {\n const held = heldBy(e);\n if (held.length === 0) return hide();\n if (frame === 0) frame = requestAnimationFrame(() => show(held));\n };\n\n window.addEventListener(\n 'mousemove',\n (e) => {\n pointer = { x: e.clientX, y: e.clientY };\n update(e);\n },\n { capture: true, passive: true },\n );\n window.addEventListener('keydown', update, true);\n window.addEventListener('keyup', update, true);\n window.addEventListener('blur', hide);\n let press = {};\n let opened: object | undefined;\n // Alt-click on a link would otherwise download it, and on a field focus it.\n window.addEventListener(\n 'mousedown',\n (e) => {\n press = {};\n if (e.composedPath().includes(host)) return;\n if (pressedBy(e) !== undefined && hitAt(e.clientX, e.clientY) !== undefined) e.preventDefault();\n },\n true,\n );\n // A press ends in `click`, `auxclick` or `contextmenu` by its button, and a right one in two of\n // them, in an order that varies by platform; on macOS Control-click is a left `contextmenu`. Each\n // is kept from the page, and the first opens the panel.\n const pressed = (e: MouseEvent) => {\n if (e.composedPath().includes(host)) return;\n const found = pressedBy(e);\n const hit = found === undefined ? undefined : hitAt(e.clientX, e.clientY);\n const target = hit === undefined ? undefined : targetOf(hit.el);\n if (found === undefined || hit === undefined || target === undefined) return;\n e.preventDefault();\n e.stopPropagation();\n if (opened === press) return;\n opened = press;\n // Still open after this press's pointerdown, outside it: it holds something unsaved, and shook its button.\n if (panel?.unsaved() === true) return;\n openTab(found.tab(), hit.el, target, undefined, hit.pointed);\n };\n const openTab = (tab: Tab, el: Element, target: Target, resumed?: Resumed, pointed?: Element) => {\n hide();\n panel?.close();\n panel = openPanel({\n base,\n send,\n root,\n contextOf,\n tabs,\n tab,\n remember,\n element: el,\n ...(pointed === undefined ? {} : { pointed }),\n target,\n onClose: () => (panel = undefined),\n ...(resumed === undefined ? {} : { resumed }),\n reopen: (again, element, kept) => {\n const found = element.isConnected ? element : sameAs(element)[0];\n const at = found === undefined ? undefined : targetOf(found);\n // Gone from the page while away: there's nothing to come back to.\n if (found === undefined || at === undefined)\n return console.warn('deictic: the element is no longer on the page, so the popup stays closed');\n openTab(again, found, at, kept, pointed?.isConnected === true && found === element ? pointed : undefined);\n },\n });\n };\n function openAt(name: string, given: Element): boolean {\n const tab = tabs.find((t) => t.plugin.name === name);\n const el = given.isConnected ? given : (sameAs(given)[0] ?? undefined);\n const target = el === undefined ? undefined : targetOf(el);\n if (tab === undefined || el === undefined || target === undefined) return false;\n openTab(tab, el, target);\n return true;\n }\n for (const type of ['click', 'auxclick', 'contextmenu'] as const) window.addEventListener(type, pressed, true);\n}\n\ninterface PanelOptions {\n base: string;\n send: Send;\n root: ShadowRoot;\n contextOf: (name: string) => ClientContext;\n tabs: Tab[];\n /** The tab it opens at. */\n tab: Tab;\n /** Keeps the tab shown, for deictic's own shortcut to open at next. */\n remember: (tab: Tab) => void;\n element: Element;\n /** What was under the pointer inside `element`, where that differs. */\n pointed?: Element;\n target: Target;\n /** Shown where the page put it (`popupIn`), not over the page beside the element; Esc leaves it alone. */\n pinned?: boolean;\n /** Called as it closes: the tab it showed, and whether it's leaving for a tab's `away`, to come back by `reopen`. */\n onClose: (shown: Tab, leaving: boolean) => void;\n /** What the first tab's mount gets, coming back from `away`. */\n resumed?: Resumed;\n /** Opens the popup again, at a tab on an element, coming back from `away`. */\n reopen: (tab: Tab, element: Element, resumed: Resumed) => void;\n}\n\nfunction openPanel({\n base,\n send,\n root,\n contextOf,\n tabs,\n tab: first,\n remember,\n element,\n pointed,\n target,\n pinned = false,\n onClose,\n resumed: coming,\n reopen,\n}: PanelOptions): { close: () => void; unsaved: () => boolean } {\n // Given to the first tab's first mount only: another tab, or a remount after an undo, starts afresh.\n let resumed = coming;\n const panel = div('panel');\n // The tabs, then the element's place and undo and redo, which are the shown tab's on this element.\n const head = div('head');\n head.setAttribute('role', 'tablist');\n const bar = div('bar');\n const where = document.createElement('a');\n where.className = 'where';\n const file = document.createElement('span');\n file.textContent = `${target.loc.file}:${target.loc.line}`;\n // An arrow out, as it leaves the page for the editor; its title is the overlay's tooltip (`tooltip.ts`).\n where.append(file);\n where.insertAdjacentHTML('beforeend', OUT);\n where.title = 'Open in editor';\n where.setAttribute('aria-label', `Open ${file.textContent} in the editor`);\n // The element's place, as a request's query names it.\n const at = { file: target.loc.file, line: String(target.loc.line), column: String(target.loc.column) };\n where.href = `${base}__deictic/open?${new URLSearchParams(at)}`;\n where.addEventListener('click', (e) => {\n e.preventDefault();\n void send(where.href);\n });\n // Off until the tab's history is read: there's nothing to take back on most elements.\n const undo = iconButton(UNDO, 'Undo', 'Nothing to undo');\n const redo = iconButton(REDO, 'Redo', 'Nothing to redo');\n undo.disabled = redo.disabled = true;\n const close = iconButton(CLOSE, 'Close', pinned ? 'Close' : 'Close (Esc)');\n const buttons = tabs.map((tab) => {\n const el = button(tab.plugin.label ?? tab.plugin.name, '');\n el.className = 'tab';\n el.setAttribute('role', 'tab');\n el.addEventListener('click', () => show(tab));\n return { tab, el };\n });\n close.classList.add('close');\n head.append(...buttons.map((b) => b.el), close);\n bar.append(where, undo, redo);\n const body = div('body');\n body.setAttribute('role', 'tabpanel');\n const status = div('status');\n panel.append(head, bar, body, status);\n root.append(panel);\n if (pinned) panel.classList.add('pinned');\n const release = pinned ? undefined : keepInView(panel, body, head, element);\n const unmark = pinned ? undefined : outline(root, element);\n if (!pinned) window.dispatchEvent(new CustomEvent<PopupOpened>(POPUP_OPENED, { detail: { element, tab: first.plugin.name } }));\n\n let cleanup: (() => void) | void;\n // The button that keeps what the shown tab would lose, while there's something: `unsaved`, from the panel.\n let holding: HTMLElement | undefined;\n const say = (text: string, problem = false) => {\n status.textContent = text;\n status.classList.toggle('problem', problem);\n };\n const post = async <T>(route: string, body?: unknown): Promise<T> => {\n const res = await send(`${base}__deictic/${route}`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body ?? {}),\n });\n const json = (await res.json()) as T & { problem?: string };\n if (!res.ok) throw new Error(json.problem ?? res.statusText);\n return json;\n };\n const unmount = () => {\n cleanup?.();\n cleanup = undefined;\n holding = undefined;\n body.replaceChildren();\n };\n // The change undone may be this tab's from before the panel opened: the panel reads its model again.\n const step = (route: 'undo' | 'redo') =>\n post<{ change: { label: string } }>(route, { plugin: current.plugin.name, target })\n .then(\n async ({ change }) => {\n await load();\n say(`${route === 'undo' ? 'Undid' : 'Redid'} ${change.label}`);\n },\n (e: unknown) => say(messageOf(e), true),\n )\n .finally(() => void steps());\n // Undo and redo as the tab's history on this element stands: off with nothing to take back or do again, else\n // saying what they would. Read as a tab shows, after each change made here, and as the pointer comes back, for a\n // change made elsewhere. One a later read overtook (another tab's) sets nothing.\n let asked = 0;\n const steps = async () => {\n const ask = ++asked;\n let history: { done: { label: string }[]; undone: { label: string }[] };\n try {\n const res = await send(`${base}__deictic/history?${new URLSearchParams({ plugin: current.plugin.name, ...at })}`);\n if (!res.ok || ask !== asked) return;\n history = (await res.json()) as typeof history;\n } catch {\n return;\n }\n const last = history.done.at(-1);\n const next = history.undone.at(-1);\n undo.disabled = last === undefined;\n undo.title = last === undefined ? 'Nothing to undo' : `Undo ${last.label}`;\n redo.disabled = next === undefined;\n redo.title = next === undefined ? 'Nothing to redo' : `Redo ${next.label}`;\n };\n panel.addEventListener('pointerenter', () => void steps());\n\n const done = (leaving = false) => {\n unmount();\n release?.();\n unmark?.();\n panel.remove();\n window.removeEventListener('keydown', onKey, true);\n window.removeEventListener('pointerdown', onOutside, true);\n if (!pinned) window.dispatchEvent(new CustomEvent(POPUP_CLOSED));\n onClose(current, leaving);\n };\n const onKey = (e: KeyboardEvent) => {\n // A plugin's modal over the popup (one marked `data-deictic-modal`) takes Esc for itself.\n if (e.key !== 'Escape' || root.querySelector('[data-deictic-modal]') !== null) return;\n // Esc is the popup's while it's open: a dialog of the page's that it's open in stays open.\n e.preventDefault();\n e.stopPropagation();\n done();\n };\n // A press on the page closes the popup, as it would a menu, unless that loses something: then the button that\n // keeps it shakes. Anything in the overlay is the popup's own: a modal, the lightbox, the surface marks are drawn on.\n const onOutside = (e: PointerEvent) => {\n if (e.composedPath().includes(root.host)) return;\n if (holding === undefined) return done();\n shake(holding);\n };\n if (!pinned) {\n window.addEventListener('keydown', onKey, true);\n window.addEventListener('pointerdown', onOutside, true);\n }\n undo.addEventListener('click', () => void step('undo'));\n redo.addEventListener('click', () => void step('redo'));\n close.addEventListener('click', () => done());\n\n let current = first;\n // A read that a later one overtook (another tab, or the same after an undo) mounts nothing.\n let reads = 0;\n const load = async () => {\n const { plugin, mount } = current;\n const read = ++reads;\n // The body keeps its height while it's empty, and \"Reading…\" waits for a read that takes long: one answered\n // at once, as most are, would otherwise fold the popup and open it again in a blink.\n body.style.minHeight = `${body.offsetHeight}px`;\n unmount();\n say('');\n const slow = setTimeout(() => read === reads && say('Reading…'), SLOW);\n let model: unknown;\n try {\n ({ model } = await post<{ model: unknown }>('read', { plugin: plugin.name, target }));\n } catch (e) {\n if (read !== reads) return;\n body.style.minHeight = '';\n say(messageOf(e), true);\n return;\n } finally {\n clearTimeout(slow);\n }\n if (read !== reads) return;\n body.style.minHeight = '';\n say('');\n const back = current === first ? resumed : undefined;\n resumed = undefined;\n cleanup = mount(body, {\n ...contextOf(plugin.name),\n ...(back === undefined ? {} : { resumed: back }),\n away: (state, task) => {\n const tab = current;\n done(true);\n void task().then(\n (result) => reopen(tab, element, { state, result }),\n (e: unknown) => reopen(tab, element, { state, problem: messageOf(e) }),\n );\n },\n element,\n ...(pointed === undefined ? {} : { pointed }),\n elements: sameAs(element),\n target,\n model,\n apply: async (op) => {\n say('Writing…');\n try {\n const result = await post<{ model: unknown }>('apply', { plugin: plugin.name, target, op });\n say('');\n void steps();\n return result.model;\n } catch (e) {\n say(messageOf(e), true);\n throw e;\n }\n },\n close: () => done(),\n unsaved: (action) => {\n if (read === reads) holding = action;\n },\n });\n };\n const show = (tab: Tab) => {\n current = tab;\n for (const b of buttons) b.el.setAttribute('aria-selected', String(b.tab === tab));\n remember(tab);\n void steps();\n void load();\n };\n show(first);\n return { close: done, unsaved: () => holding !== undefined };\n}\n\n/** Shakes a panel's button, in view: what a press outside does where closing would lose something. A blink where motion is reduced. */\nfunction shake(el: HTMLElement): void {\n el.scrollIntoView({ block: 'nearest' });\n if (matchMedia('(prefers-reduced-motion: reduce)').matches) return void el.animate({ opacity: [1, 0.3, 1, 0.3, 1] }, 400);\n el.animate({ translate: ['0', '-5px', '5px', '-4px', '4px', '-2px', '0'] }, { duration: 360, easing: 'ease-out' });\n}\n\n/** Puts an outline over `r`. */\nfunction place(el: HTMLElement, r: DOMRect): void {\n Object.assign(el.style, { left: `${r.left}px`, top: `${r.top}px`, width: `${r.width}px`, height: `${r.height}px` });\n}\n\n/** How far from the element the popup's outline is drawn, in pixels. */\nconst ROOM = 4;\n\n/**\n * Outlines the element the popup is open on, for as long as it is: which one it's about, where several look alike\n * or the popup covers it. Dashed, with no fill and a little room around the element, so nothing of it is drawn on:\n * a border, a ring or a colour tried on it shows as it is. Read each frame, as the element moves with the page's\n * scrolling, its layout and what a panel previews on it. Answers what removes it.\n */\nfunction outline(root: ShadowRoot, element: Element): () => void {\n const box = div('box on');\n root.append(box);\n let frame = 0;\n let was = '';\n const follow = () => {\n frame = requestAnimationFrame(follow);\n const r = element.getBoundingClientRect();\n const now = element.isConnected ? `${r.left},${r.top},${r.width},${r.height}` : '';\n if (now === was) return;\n was = now;\n box.classList.toggle('shown', now !== '');\n place(box, new DOMRect(r.left - ROOM, r.top - ROOM, r.width + 2 * ROOM, r.height + 2 * ROOM));\n };\n follow();\n return () => {\n cancelAnimationFrame(frame);\n box.remove();\n };\n}\n\nconst MARGIN = 8;\n// Under this much room on either side, the panel overlaps the element rather than shrink to a sliver beside it.\nconst LEAST = 160;\n\n/** How far a press on the head moves, in pixels, before it's a drag: a click there leaves the popup following. */\nconst SLACK = 3;\n\n/**\n * Keeps a panel beside `element` and inside the viewport, as its tabs fill it, the window resizes and the element\n * moves with the page: below, or above where it fits better, its height capped to the room there, so the body\n * scrolls rather than the panel leaving the window. Dragged by `handle`, it stays where it's put, in the window,\n * and follows the element no more. Fixed, so it never changes the page's own scrolling. Answers a release.\n */\nfunction keepInView(panel: HTMLElement, body: HTMLElement, handle: HTMLElement, element: Element): () => void {\n let frame = 0;\n let timer: ReturnType<typeof setTimeout> | undefined;\n // Where the element was last seen: one gone from the page leaves the popup where it was.\n let r = element.getBoundingClientRect();\n let moved: { left: number; top: number } | undefined;\n const fit = () => {\n cancelAnimationFrame(frame);\n clearTimeout(timer);\n frame = 0;\n timer = undefined;\n // The viewport without the page's scrollbars.\n const width = document.documentElement.clientWidth;\n const height = document.documentElement.clientHeight;\n // What the panel would take with no cap: its frame, and all of its body.\n const wanted = panel.offsetHeight - body.clientHeight + body.scrollHeight;\n if (moved !== undefined) {\n const room = Math.max(0, height - 2 * MARGIN);\n Object.assign(panel.style, {\n left: `${Math.max(MARGIN, Math.min(moved.left, width - MARGIN - panel.offsetWidth))}px`,\n top: `${Math.max(MARGIN, Math.min(moved.top, height - MARGIN - Math.min(wanted, room)))}px`,\n maxHeight: `${room}px`,\n });\n return;\n }\n const top = Math.min(Math.max(r.top, 0), height);\n const bottom = Math.min(Math.max(r.bottom, 0), height);\n const below = height - bottom - 2 * MARGIN;\n const above = top - 2 * MARGIN;\n const cap = Math.max(0, Math.min(height * 0.6, height - 2 * MARGIN));\n let at: number;\n let room: number;\n if (Math.max(below, above) < LEAST) {\n room = height - 2 * MARGIN;\n at = Math.min(Math.max(bottom + MARGIN, MARGIN), height - MARGIN - Math.min(wanted, room));\n } else if (wanted <= below || below >= above) {\n room = Math.min(below, cap);\n at = bottom + MARGIN;\n } else {\n room = Math.min(above, cap);\n at = top - MARGIN - Math.min(wanted, room);\n }\n Object.assign(panel.style, {\n left: `${Math.max(MARGIN, Math.min(r.left, width - MARGIN - panel.offsetWidth))}px`,\n top: `${at}px`,\n bottom: '',\n maxHeight: `${room}px`,\n });\n };\n // Not in the observers' callbacks, where a change of size is a \"ResizeObserver loop\" error on the page. The next\n // frame, or a moment later where there's none: a hidden tab draws no frames, and its popup still fits when shown.\n const later = () => {\n frame ||= requestAnimationFrame(fit);\n timer ??= setTimeout(fit, 50);\n };\n fit();\n // Read each frame, as nothing tells of an element moving: the page scrolls, its layout shifts, a panel previews.\n let watching = requestAnimationFrame(function watch() {\n if (moved !== undefined) return;\n watching = requestAnimationFrame(watch);\n if (!element.isConnected) return;\n const now = element.getBoundingClientRect();\n if (now.left === r.left && now.top === r.top && now.width === r.width && now.height === r.height) return;\n r = now;\n fit();\n });\n // A drag starts on the head itself, not on a tab or the close in it.\n let from: { x: number; y: number; left: number; top: number } | undefined;\n const down = (e: PointerEvent) => {\n if (e.button !== 0 || (e.target as Element).closest('button') !== null) return;\n // Kept from the browser: no text selected along the way, and the field being typed in keeps its focus.\n e.preventDefault();\n const at = panel.getBoundingClientRect();\n from = { x: e.clientX, y: e.clientY, left: at.left, top: at.top };\n handle.setPointerCapture(e.pointerId);\n };\n const move = (e: PointerEvent) => {\n if (from === undefined) return;\n const x = e.clientX - from.x;\n const y = e.clientY - from.y;\n if (moved === undefined && Math.hypot(x, y) < SLACK) return;\n moved = { left: from.left + x, top: from.top + y };\n panel.classList.add('dragging');\n fit();\n };\n const up = () => {\n from = undefined;\n panel.classList.remove('dragging');\n };\n handle.addEventListener('pointerdown', down);\n handle.addEventListener('pointermove', move);\n handle.addEventListener('pointerup', up);\n handle.addEventListener('pointercancel', up);\n // A tab's content arrives after the panel opens, and changes as it's used, as does the status line. Both, as a\n // resize observer reports only while the page renders: a hidden tab's popup would keep its first place.\n const resized = new ResizeObserver(later);\n resized.observe(panel);\n const changed = new MutationObserver(later);\n changed.observe(panel, { childList: true, subtree: true, characterData: true });\n window.addEventListener('resize', later);\n return () => {\n cancelAnimationFrame(frame);\n cancelAnimationFrame(watching);\n clearTimeout(timer);\n resized.disconnect();\n changed.disconnect();\n window.removeEventListener('resize', later);\n };\n}\n\nfunction div(className: string): HTMLDivElement {\n const el = document.createElement('div');\n el.className = className;\n return el;\n}\n\n/** A button that is a drawing: named for what it does, as its title, the tooltip, changes with what it would do. */\nfunction iconButton(svg: string, name: string, title: string): HTMLButtonElement {\n const el = button('', title);\n el.className = 'icon';\n el.innerHTML = svg;\n el.setAttribute('aria-label', name);\n return el;\n}\n\nfunction button(text: string, title: string): HTMLButtonElement {\n const el = document.createElement('button');\n el.type = 'button';\n el.textContent = text;\n el.title = title;\n return el;\n}\n\nconst messageOf = (e: unknown) => (e instanceof Error ? e.message : String(e));\n"],"mappings":";;;AAUA,MAAM,OAAO;AACb,MAAM,OAAO;AACb,MAAM,QAAQ;AAEd,MAAM,gBAAgB,WAAW,kCAAkC,CAAC,CAAC;AACrE,MAAM,SAAS,MAAc,GAAG,KAAK,MAAM,IAAI,EAAE,EAAE,GAAG,OAAO,KAAK,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG;;;;;AAMhG,SAAgB,aACd,MACA,OACA,EAAE,KAAK,GAAG,MAAM,SAAS,UAAkD,CAAC,GACrD;CACvB,MAAM,MAAMA,MAAI,SAAS,oBAAoB,UAAU;CACvD,IAAI,CAAC,QAAQ;EACX,IAAI,QAAQ,eAAe;EAC3B,IAAI,aAAa,QAAQ,QAAQ;EACjC,IAAI,aAAa,cAAc,MAAM;CACvC;CACA,MAAM,WAAWA,MAAI,aAAa;CAClC,MAAM,QAAQA,MAAI,UAAU;CAC5B,MAAM,OAAOA,MAAI,SAAS;CAC1B,MAAM,QAAQA,MAAI,UAAU;CAC5B,MAAM,QAAQA,MAAI,UAAU;CAC5B,MAAM,UAAUA,MAAI,YAAY;CAChC,MAAM,QAAQC,SAAO,KAAK,eAAe,UAAU;CACnD,KAAK,OAAO,OAAO,OAAO,SAAS,KAAK;CACxC,MAAM,OAAO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1C,GAAG,OAAO;CACV,GAAG,cAAc;CACjB,GAAG,QAAQ;CACX,OAAO;AACT;AAEA,MAAM,aAAa,MAAgB,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `deictic`: what a plugin is. Every plugin is optional: deictic itself is the glue (the
|
|
3
|
+
* transform that ties elements to source, the dev server's endpoints, the history, shortcuts and the
|
|
4
|
+
* overlay's panel), and each plugin adds what it does on top.
|
|
5
|
+
*
|
|
6
|
+
* A plugin has two halves, each optional that meet over the dev server's endpoints (`tools/endpoints.ts`). The
|
|
7
|
+
* server half runs beside the bundler and is the only one that reads source: it turns the element
|
|
8
|
+
* under the pointer into a model its panel can show, and an op from that panel into text edits. It
|
|
9
|
+
* never writes files; deictic does, so every plugin's changes land in one history and undo the
|
|
10
|
+
* same way. A change that isn't to a file (a task added to a board) the plugin makes itself and
|
|
11
|
+
* answers with what it did (`Done`): the history keeps that beside the files' changes and hands it
|
|
12
|
+
* back to the plugin's own `undo` and `redo`.
|
|
13
|
+
* The client half is a module the page loads, named by the server half's `client`, which draws the
|
|
14
|
+
* panel and previews an op on the page before it is applied.
|
|
15
|
+
*
|
|
16
|
+
* A plugin may have no panel at all, only an API for others (screenshots, a recording) and routes of
|
|
17
|
+
* its own on the dev server. Each half's `setup` answers its API, and `use(name)` reaches another
|
|
18
|
+
* plugin's, on the same side; `needs` names the plugins it can't do without.
|
|
19
|
+
*
|
|
20
|
+
* Both halves import from here, so the parser is imported for its types only: the browser must not load it.
|
|
21
|
+
*/
|
|
22
|
+
import { C as Modifier, S as definePlugin, _ as Source, a as Done, b as TextEdit, c as LightboxOptions, d as Refusal, f as Resumed, g as ServerPlugin, h as ServerContext, i as ClientPlugin, l as Loc, m as ServerApis, n as ClientApis, o as LightboxAction, p as Route, r as ClientContext, s as LightboxItem, t as ApiOf, u as PanelContext, v as Standalone, w as Shortcut, x as defineClientPlugin, y as Target } from "./shared/index.js";
|
|
23
|
+
export { ApiOf, ClientApis, ClientContext, ClientPlugin, Done, LightboxAction, LightboxItem, LightboxOptions, Loc, type Modifier, PanelContext, Refusal, Resumed, Route, ServerApis, ServerContext, ServerPlugin, type Shortcut, Source, Standalone, Target, TextEdit, defineClientPlugin, definePlugin };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
/** An op a plugin won't make. The message says why and what to do instead; the panel shows it. */
|
|
3
|
+
var Refusal = class extends Error {
|
|
4
|
+
name = "Refusal";
|
|
5
|
+
};
|
|
6
|
+
const definePlugin = (plugin) => plugin;
|
|
7
|
+
const defineClientPlugin = (plugin) => plugin;
|
|
8
|
+
export { Refusal, defineClientPlugin, definePlugin };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `deictic`: what a plugin is. Every plugin is optional: deictic itself is the glue (the\n * transform that ties elements to source, the dev server's endpoints, the history, shortcuts and the\n * overlay's panel), and each plugin adds what it does on top.\n *\n * A plugin has two halves, each optional that meet over the dev server's endpoints (`tools/endpoints.ts`). The\n * server half runs beside the bundler and is the only one that reads source: it turns the element\n * under the pointer into a model its panel can show, and an op from that panel into text edits. It\n * never writes files; deictic does, so every plugin's changes land in one history and undo the\n * same way. A change that isn't to a file (a task added to a board) the plugin makes itself and\n * answers with what it did (`Done`): the history keeps that beside the files' changes and hands it\n * back to the plugin's own `undo` and `redo`.\n * The client half is a module the page loads, named by the server half's `client`, which draws the\n * panel and previews an op on the page before it is applied.\n *\n * A plugin may have no panel at all, only an API for others (screenshots, a recording) and routes of\n * its own on the dev server. Each half's `setup` answers its API, and `use(name)` reaches another\n * plugin's, on the same side; `needs` names the plugins it can't do without.\n *\n * Both halves import from here, so the parser is imported for its types only: the browser must not load it.\n */\nimport type { JSXOpeningElement, Program } from 'oxc-parser';\n\nimport type { Shortcut } from './shortcut.ts';\n\nexport type { Modifier, Shortcut } from './shortcut.ts';\n\n/** A place in the source: the file from the project's root, with `/`, and the line and column, from 1. */\nexport interface Loc {\n file: string;\n line: number;\n column: number;\n}\n\n/** An element the pointer picked: where its opening tag starts, and the tag, which the server checks is still there. */\nexport interface Target {\n loc: Loc;\n tag: string;\n}\n\n/** Text in a file to replace, by UTF-16 offsets. `file` is the target's unless named, from the project's root. */\nexport interface TextEdit {\n file?: string;\n start: number;\n end: number;\n text: string;\n}\n\n/** What a server half reads: the target's file, parsed, and its element. */\nexport interface Source {\n /** The target's file, from the project's root. */\n file: string;\n code: string;\n /** The file's module; for an `.astro` component, its frontmatter's. */\n program: Program;\n /** The target's opening tag. */\n element: JSXOpeningElement;\n /** Another file under the project's root, for plugins whose edits go elsewhere (a locale's messages). */\n read(file: string): string;\n}\n\n/**\n * What answers the overlay's requests in a page with no dev server behind it (`deictic/vite`'s `standalone`): the\n * default export of a module of the page's. A request is one the endpoints would get, under `<base>__deictic/`;\n * the answer is theirs too (`{ model }`, `{ model, change }`, `{ problem }` with a status that isn't ok).\n */\nexport type Standalone = (request: Request) => Response | Promise<Response>;\n\n/** An op a plugin won't make. The message says why and what to do instead; the panel shows it. */\nexport class Refusal extends Error {\n override name = 'Refusal';\n}\n\n/**\n * A change the plugin made itself, not to a file: what its `undo` and `redo` need to take it back and\n * make it again. JSON, since the history keeps it on disk across restarts of the dev server.\n */\nexport interface Done<Record = unknown> {\n done: Record;\n}\n\ntype Maybe<T> = T | Promise<T>;\n\n/**\n * Each plugin's API to the others on the server, by name. A plugin adds its own, so `use` knows its type:\n * `declare module 'deictic' { interface ServerApis { screenshots: Screenshots } }`.\n */\n// oxlint-disable-next-line typescript/no-empty-interface -- filled by declaration merging\nexport interface ServerApis {}\n\n/** The same, in the page: `declare module 'deictic' { interface ClientApis { screenshots: Capture } }`. */\n// oxlint-disable-next-line typescript/no-empty-interface -- filled by declaration merging\nexport interface ClientApis {}\n\n/** A plugin's API, by its name: what its package declared, or `unknown` for one that declared none. */\nexport type ApiOf<Apis, Name extends string> = Name extends keyof Apis ? Apis[Name] : unknown;\n\nexport interface ServerContext {\n /** The project's root, as an absolute path. */\n root: string;\n /**\n * Another plugin's API, as its `setup` answered it, or nothing when it isn't loaded. One the plugin\n * `needs` always is; any other may not be, so check.\n */\n use: <Name extends string>(name: Name) => ApiOf<ServerApis, Name> | undefined;\n}\n\n/**\n * A route of the plugin's own, at `/__deictic/plugins/<name>/<route>`, and below it. A `GET` must\n * change nothing: anything else reaches it only from the page itself, which deictic checks.\n */\nexport type Route = (request: Request, context: ServerContext) => Maybe<Response>;\n\nexport interface ServerPlugin<Model = unknown, Op = unknown, Record = unknown, Api = unknown> {\n /** Ties the halves together; also the label of its changes in the history, and its routes' path. Lowercase, with `-`. */\n name: string;\n /** The module the page loads for this plugin's half there, which default-exports its `ClientPlugin`. */\n client?: string;\n /** What the page half gets as `context.options`: the user's options it needs there, as JSON. */\n clientOptions?: unknown;\n /** What opens its panel: its own default, which its options let the user change. A plugin with no panel has none. */\n shortcut?: Shortcut;\n /** The plugins it can't do without, by name: the dev server won't start without them. */\n needs?: string[];\n /** Runs once, as the dev server starts and before it answers anything. Answers the plugin's API to the others. */\n setup?(context: ServerContext): Maybe<Api>;\n /** Routes of its own, by their first segment under `/__deictic/plugins/<name>/`. */\n routes?: { [route: string]: Route };\n /** The model its panel shows for an element. Without it, the panel gets none. */\n read?(source: Source, target: Target): Maybe<Model>;\n /** Text edits for deictic to write, or a change the plugin made itself. */\n apply?(source: Source, target: Target, op: Op): Maybe<TextEdit[] | Done<Record>>;\n /**\n * Takes back a change `apply` made itself, or throws a `Refusal` saying why it can't any more. It may\n * answer what the next redo needs, where that differs (what it put back has a new ID).\n */\n undo?(record: Record): Maybe<void | Record>;\n /** Makes it again after an undo, and answers what the next undo needs, which may differ (a new ID). */\n redo?(record: Record): Maybe<Record>;\n /** Says what an op does, for the history: `className: px-2 → px-4`. */\n describe?(op: Op, before: Model): string;\n}\n\nexport const definePlugin = <Model, Op, Record = unknown, Api = unknown>(\n plugin: ServerPlugin<Model, Op, Record, Api>,\n): ServerPlugin<Model, Op, Record, Api> => plugin;\n\nexport interface ClientContext {\n /** The dev server's base URL, ending in `/`. */\n base: string;\n /** deictic's shadow root, to draw in: neither the page's styles nor the overlay's cross over. */\n root: ShadowRoot;\n /** The server half's `clientOptions`, or nothing. */\n options: unknown;\n /** Another plugin's API in the page, as its `setup` answered it, or nothing when it isn't loaded. */\n use: <Name extends string>(name: Name) => ApiOf<ClientApis, Name> | undefined;\n /** Asks one of this plugin's own routes, from the page: `request('shots', { method: 'POST', body: blob })`. */\n request: (route: string, init?: RequestInit) => Promise<Response>;\n /**\n * Opens the popup on an element at a plugin's tab, as its shortcut would: after a recording, say. An\n * element rendered again since stands in for one no longer on the page. False when there's no such tab\n * or no such element any more. Not from `setup`, which runs before the popup can open.\n */\n open: (plugin: string, element: Element) => boolean;\n /**\n * Shows `items` in the lightbox over everything, at `at` (the first by default), stepping between them with\n * ← and →. With `from`, it grows out of that element (the chip clicked) and shrinks back into it on close.\n */\n lightbox: (items: LightboxItem[], options?: LightboxOptions) => { close: () => void };\n}\n\n/** What the lightbox shows: a picture, a page in a frame (a recording's replay), or a sound with its waveform. */\nexport type LightboxItem = {\n /** Its name, over it. */\n title: string;\n /** Buttons beside the name: each closes the lightbox and runs. */\n actions?: LightboxAction[];\n} & ({ kind: 'image'; url: string } | { kind: 'page'; url: string } | { kind: 'audio'; url: string });\n\nexport interface LightboxAction {\n label: string;\n title?: string;\n run: () => void;\n}\n\nexport interface LightboxOptions {\n /** The item it opens at. */\n at?: number;\n /** The element it grows out of, and goes back into. */\n from?: Element;\n}\n\nexport interface PanelContext<Model, Op> extends ClientContext {\n /** The element clicked: the one the source marked, under the pointer or around what is. */\n element: Element;\n /**\n * What was under the pointer, where it isn't `element` but inside it: markup nothing marked, as a\n * dependency's, or in an open shadow root, as the popup's own on a page that shows it (`popupIn`).\n */\n pointed?: Element;\n /** Every element on the page from the same place in the source, the clicked one among them: the rows of a list. */\n elements: Element[];\n target: Target;\n model: Model;\n /** Applies an op on disk, and reads the model again. Rejects with the server's reason, which the panel also shows. */\n apply(op: Op): Promise<Model>;\n close: () => void;\n /**\n * Says there's something here that leaving would lose (words typed, a change tried on the page), and the button\n * that keeps it: a click outside the popup then shakes that button, where it would have closed the popup.\n * `undefined` once there's nothing to lose. Forgotten as the panel unmounts.\n */\n unsaved: (action: HTMLElement | undefined) => void;\n /**\n * Leaves the popup to do something on the page, then comes back: closes it, runs `task` (a recording, a\n * pick of another element), and opens it again at this tab on this element. The next mount gets\n * `resumed`: the `state` kept now (what was typed, what's attached), and what `task` answered, or why\n * it failed. The state stays in the page, as it is: no need for JSON.\n */\n away: <T>(state: unknown, task: () => Promise<T>) => void;\n /** Set when this mount is the panel coming back from `away`. */\n resumed?: Resumed;\n}\n\n/** What a panel coming back from `away` gets: the state it kept, and the task's result or problem. */\nexport interface Resumed {\n state: unknown;\n result?: unknown;\n /** Why the task failed: its error's message. */\n problem?: string;\n}\n\nexport interface ClientPlugin<Model = unknown, Op = unknown, Api = unknown> {\n /** The server half's `name`. */\n name: string;\n /** Shown over the element while its shortcut's keys are held, and atop the panel. */\n label?: string;\n /**\n * Runs once, as the page starts, before any panel opens (a recording starts here). Answers the\n * plugin's API to the others in the page, at once: one that needs time keeps its promises inside it.\n */\n setup?(context: ClientContext): Api;\n /** Draws into `panel`, inside deictic's shadow root. Returns what to undo on the page when the panel closes. */\n mount?: (panel: HTMLElement, context: PanelContext<Model, Op>) => (() => void) | void;\n}\n\nexport const defineClientPlugin = <Model, Op, Api = unknown>(plugin: ClientPlugin<Model, Op, Api>): ClientPlugin<Model, Op, Api> => plugin;\n"],"mappings":";;AAqEA,IAAa,UAAb,cAA6B,MAAM;CACxB,OAAO;AAClB;AAwEA,MAAa,gBACX,WACyC;AAqG3C,MAAa,sBAAgD,WAAuE"}
|
package/dist/loader.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface LoaderOptions {
|
|
2
|
+
/** The project's root, which a mark's path is from. */
|
|
3
|
+
root: string;
|
|
4
|
+
/** The written client module, to import in the browser; none on the server. */
|
|
5
|
+
client?: string;
|
|
6
|
+
}
|
|
7
|
+
interface Context {
|
|
8
|
+
getOptions(): LoaderOptions;
|
|
9
|
+
resourcePath: string;
|
|
10
|
+
sourceMap?: boolean;
|
|
11
|
+
callback(error: Error | null, code?: string, map?: object): void;
|
|
12
|
+
}
|
|
13
|
+
export default function loader(this: Context, source: string): void;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","names":[],"sources":["../src/loader.ts"],"mappings":"A,iBAQiB;;EAEf;;EAEA;;UAGQ;EACR,cAAc;EACd;EACA;EACA,SAAS,OAAO,cAAc,eAAe;;wBAGvB,OAAO,MAAM,SAAS"}
|
package/dist/loader.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { i as mark, r as importOf } from "./shared/integration.js";
|
|
2
|
+
// src/loader.ts
|
|
3
|
+
/**
|
|
4
|
+
* The loader `deictic/webpack` sets for webpack and Rspack, and `deictic/next` for Turbopack: it marks a
|
|
5
|
+
* JSX module's host elements (`tools/locate.ts`), and in the browser appends the import of the client
|
|
6
|
+
* module written to `.deictic/client.js`. It runs `pre`, before the app's own loaders, so lines and
|
|
7
|
+
* columns are the file's as written. Its options are JSON, as Turbopack's must be.
|
|
8
|
+
*/
|
|
9
|
+
function loader(source) {
|
|
10
|
+
const { root, client } = this.getOptions();
|
|
11
|
+
const marked = mark(source, this.resourcePath, root, client === void 0 ? "" : importOf(client, this.resourcePath));
|
|
12
|
+
if (marked === void 0) return this.callback(null, source);
|
|
13
|
+
this.callback(null, marked.code, this.sourceMap === false ? void 0 : marked.map);
|
|
14
|
+
}
|
|
15
|
+
export { loader as default };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","names":[],"sources":["../src/loader.ts"],"sourcesContent":["/**\n * The loader `deictic/webpack` sets for webpack and Rspack, and `deictic/next` for Turbopack: it marks a\n * JSX module's host elements (`tools/locate.ts`), and in the browser appends the import of the client\n * module written to `.deictic/client.js`. It runs `pre`, before the app's own loaders, so lines and\n * columns are the file's as written. Its options are JSON, as Turbopack's must be.\n */\nimport { importOf, mark } from './tools/integration.ts';\n\nexport interface LoaderOptions {\n /** The project's root, which a mark's path is from. */\n root: string;\n /** The written client module, to import in the browser; none on the server. */\n client?: string;\n}\n\ninterface Context {\n getOptions(): LoaderOptions;\n resourcePath: string;\n sourceMap?: boolean;\n callback(error: Error | null, code?: string, map?: object): void;\n}\n\nexport default function loader(this: Context, source: string): void {\n const { root, client } = this.getOptions();\n const marked = mark(source, this.resourcePath, root, client === undefined ? '' : importOf(client, this.resourcePath));\n if (marked === undefined) return this.callback(null, source);\n this.callback(null, marked.code, this.sourceMap === false ? undefined : marked.map);\n}\n"],"mappings":";;;;;;;;AAsBA,SAAwB,OAAsB,QAAsB;CAClE,MAAM,EAAE,MAAM,WAAW,KAAK,WAAW;CACzC,MAAM,SAAS,KAAK,QAAQ,KAAK,cAAc,MAAM,WAAW,KAAA,IAAY,KAAK,SAAS,QAAQ,KAAK,YAAY,CAAC;CACpH,IAAI,WAAW,KAAA,GAAW,OAAO,KAAK,SAAS,MAAM,MAAM;CAC3D,KAAK,SAAS,MAAM,OAAO,MAAM,KAAK,cAAc,QAAQ,KAAA,IAAY,OAAO,GAAG;AACpF"}
|
package/dist/next.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { t as DeicticOptions } from "./shared/integration.js";
|
|
2
|
+
export interface DeicticNextOptions extends DeicticOptions {
|
|
3
|
+
/** The project's root, which marks and edits are from: the working directory `next dev` runs in by default. */
|
|
4
|
+
root?: string;
|
|
5
|
+
}
|
|
6
|
+
type ConfigFunction<C> = (phase: string, context: {
|
|
7
|
+
defaultConfig: C;
|
|
8
|
+
}) => C | Promise<C>;
|
|
9
|
+
/**
|
|
10
|
+
* Wraps the Next config: `export default withDeictic({ ... }, { plugins: [tailwind()] })`. Takes the
|
|
11
|
+
* config as an object or as the function Next calls with the phase, and returns the function.
|
|
12
|
+
*/
|
|
13
|
+
export declare function withDeictic<C extends object>(next?: C | ConfigFunction<C>, options?: DeicticNextOptions): (phase: string, context: {
|
|
14
|
+
defaultConfig: C;
|
|
15
|
+
}) => Promise<C>;
|
|
16
|
+
export { withDeictic as default };
|
|
17
|
+
//# sourceMappingURL=next.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.d.ts","names":[],"sources":["../src/next.ts"],"mappings":";iBA2BiB,2BAA2B;;EAE1C;;KAUG,eAAe,MAAM,eAAe;EAAW,eAAe;MAAQ,IAAI,QAAQ;;;;;wBAavE,YAAY,kBAC1B,OAAM,IAAI,eAAe,IACzB,UAAS,sBACP,eAAe;EAAW,eAAe;MAAQ,QAAQ"}
|
package/dist/next.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { createServer } from "node:http";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { n as nodeMiddleware, r as redirect, t as endpoints } from "./shared/endpoints.js";
|
|
4
|
+
import { d as JSX, o as prepare, s as writeClient, t as beside } from "./shared/integration.js";
|
|
5
|
+
// src/next.ts
|
|
6
|
+
/**
|
|
7
|
+
* `deictic/next`: deictic in `next dev`, on Turbopack or webpack (`--webpack`). Nothing runs in `next build`.
|
|
8
|
+
*
|
|
9
|
+
* Turbopack has no transform hook and no virtual modules, so a loader rule (`loader.ts`) marks each JSX
|
|
10
|
+
* module, on the server too, which marks server components' elements in the HTML they render; in the
|
|
11
|
+
* browser it also imports the client module, written to `.deictic/client.js`. Only code the browser
|
|
12
|
+
* loads can start the overlay, so a page with no client component at all has none. Under webpack the
|
|
13
|
+
* same loader is a `pre` rule, as in `webpack.ts`.
|
|
14
|
+
*
|
|
15
|
+
* The endpoints can't be a route of the app without a file in it, so a server of their own answers them
|
|
16
|
+
* on a local port, and a rewrite sends `/__deictic/*` there, before any of the app's own; Next's proxy
|
|
17
|
+
* forwards the page's host, so writes are still checked against its origin. A place opens through
|
|
18
|
+
* Next's own `/__nextjs_launch-editor`.
|
|
19
|
+
*
|
|
20
|
+
* Both bundlers' rules are always set, as the config can't tell which will run: Next refuses a Turbopack
|
|
21
|
+
* build whose config has a `webpack` key only where it has no `turbopack` one, and ours always does.
|
|
22
|
+
*/
|
|
23
|
+
const DEV = "phase-development-server";
|
|
24
|
+
const loaderPath = beside(import.meta.url, "loader");
|
|
25
|
+
const GLOBS = [
|
|
26
|
+
"*.tsx",
|
|
27
|
+
"*.jsx",
|
|
28
|
+
"*.js"
|
|
29
|
+
];
|
|
30
|
+
const serving = /* @__PURE__ */ new Map();
|
|
31
|
+
/**
|
|
32
|
+
* Wraps the Next config: `export default withDeictic({ ... }, { plugins: [tailwind()] })`. Takes the
|
|
33
|
+
* config as an object or as the function Next calls with the phase, and returns the function.
|
|
34
|
+
*/
|
|
35
|
+
function withDeictic(next = {}, options = {}) {
|
|
36
|
+
const { plugins, shortcut } = prepare(options);
|
|
37
|
+
return async (phase, context) => {
|
|
38
|
+
const resolved = typeof next === "function" ? await next(phase, context) : next;
|
|
39
|
+
if (phase !== DEV) return resolved;
|
|
40
|
+
const root = resolve(options.root ?? process.cwd());
|
|
41
|
+
const base = `${resolved.basePath ?? ""}/`;
|
|
42
|
+
const client = writeClient(root, plugins, base, shortcut);
|
|
43
|
+
return withRewrite(withWebpack(withRules(resolved, GLOBS.flatMap((glob) => [[glob, {
|
|
44
|
+
condition: { all: ["browser", { not: "foreign" }] },
|
|
45
|
+
loaders: [{
|
|
46
|
+
loader: loaderPath,
|
|
47
|
+
options: {
|
|
48
|
+
root,
|
|
49
|
+
client
|
|
50
|
+
}
|
|
51
|
+
}]
|
|
52
|
+
}], [glob, {
|
|
53
|
+
condition: { all: [{ not: "browser" }, { not: "foreign" }] },
|
|
54
|
+
loaders: [{
|
|
55
|
+
loader: loaderPath,
|
|
56
|
+
options: { root }
|
|
57
|
+
}]
|
|
58
|
+
}]])), root, client), await serve(root, plugins, base));
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** The app's rules and ours: where both have one for a glob, theirs first, then ours, in a list. */
|
|
62
|
+
function withRules(resolved, ours) {
|
|
63
|
+
const turbopack = resolved.turbopack;
|
|
64
|
+
const rules = { ...turbopack?.rules };
|
|
65
|
+
for (const [glob, rule] of ours) rules[glob] = glob in rules ? [rules[glob], rule].flat() : rule;
|
|
66
|
+
return {
|
|
67
|
+
...resolved,
|
|
68
|
+
turbopack: {
|
|
69
|
+
...turbopack,
|
|
70
|
+
rules
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** For `next dev --webpack`: the app's own `webpack`, then the loader, `pre`, with the client in the browser's build. */
|
|
75
|
+
function withWebpack(resolved, root, client) {
|
|
76
|
+
const theirs = resolved.webpack;
|
|
77
|
+
const webpack = (config, context) => {
|
|
78
|
+
const made = theirs?.(config, context) ?? config;
|
|
79
|
+
const options = context.isServer ? { root } : {
|
|
80
|
+
root,
|
|
81
|
+
client
|
|
82
|
+
};
|
|
83
|
+
made.module.rules.unshift({
|
|
84
|
+
test: JSX,
|
|
85
|
+
exclude: /[\\/]node_modules[\\/]/,
|
|
86
|
+
enforce: "pre",
|
|
87
|
+
use: [{
|
|
88
|
+
loader: loaderPath,
|
|
89
|
+
options
|
|
90
|
+
}]
|
|
91
|
+
});
|
|
92
|
+
return made;
|
|
93
|
+
};
|
|
94
|
+
return {
|
|
95
|
+
...resolved,
|
|
96
|
+
webpack
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/** Sends `/__deictic/*` to the endpoints' server, before any of the app's own rewrites. */
|
|
100
|
+
function withRewrite(resolved, port) {
|
|
101
|
+
const theirs = resolved.rewrites;
|
|
102
|
+
const ours = [{
|
|
103
|
+
source: "/__deictic/:path*",
|
|
104
|
+
destination: `http://127.0.0.1:${port}/__deictic/:path*`
|
|
105
|
+
}];
|
|
106
|
+
const rewrites = async () => {
|
|
107
|
+
const r = await theirs?.() ?? [];
|
|
108
|
+
return Array.isArray(r) ? {
|
|
109
|
+
beforeFiles: ours,
|
|
110
|
+
afterFiles: r
|
|
111
|
+
} : {
|
|
112
|
+
...r,
|
|
113
|
+
beforeFiles: [...ours, ...r.beforeFiles ?? []]
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
...resolved,
|
|
118
|
+
rewrites
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/** Serves the endpoints on a free local port, for as long as the process lives. */
|
|
122
|
+
function serve(root, plugins, base) {
|
|
123
|
+
const running = serving.get(root);
|
|
124
|
+
if (running !== void 0) return running;
|
|
125
|
+
const handle = endpoints({
|
|
126
|
+
root,
|
|
127
|
+
plugins,
|
|
128
|
+
base: "/",
|
|
129
|
+
open: (path, { line, column }) => redirect(`${base}__nextjs_launch-editor?${new URLSearchParams({
|
|
130
|
+
file: path,
|
|
131
|
+
line1: String(line),
|
|
132
|
+
column1: String(column)
|
|
133
|
+
})}`)
|
|
134
|
+
});
|
|
135
|
+
const middleware = nodeMiddleware(handle);
|
|
136
|
+
const server = createServer((req, res) => middleware(req, res, () => {
|
|
137
|
+
res.statusCode = 404;
|
|
138
|
+
res.end();
|
|
139
|
+
}));
|
|
140
|
+
const port = new Promise((done, fail) => {
|
|
141
|
+
server.once("error", fail);
|
|
142
|
+
server.listen(0, "127.0.0.1", () => done(server.address().port));
|
|
143
|
+
});
|
|
144
|
+
server.unref();
|
|
145
|
+
serving.set(root, port);
|
|
146
|
+
return port;
|
|
147
|
+
}
|
|
148
|
+
export { withDeictic as default, withDeictic };
|
|
149
|
+
|
|
150
|
+
//# sourceMappingURL=next.js.map
|
package/dist/next.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.js","names":[],"sources":["../src/next.ts"],"sourcesContent":["/**\n * `deictic/next`: deictic in `next dev`, on Turbopack or webpack (`--webpack`). Nothing runs in `next build`.\n *\n * Turbopack has no transform hook and no virtual modules, so a loader rule (`loader.ts`) marks each JSX\n * module, on the server too, which marks server components' elements in the HTML they render; in the\n * browser it also imports the client module, written to `.deictic/client.js`. Only code the browser\n * loads can start the overlay, so a page with no client component at all has none. Under webpack the\n * same loader is a `pre` rule, as in `webpack.ts`.\n *\n * The endpoints can't be a route of the app without a file in it, so a server of their own answers them\n * on a local port, and a rewrite sends `/__deictic/*` there, before any of the app's own; Next's proxy\n * forwards the page's host, so writes are still checked against its origin. A place opens through\n * Next's own `/__nextjs_launch-editor`.\n *\n * Both bundlers' rules are always set, as the config can't tell which will run: Next refuses a Turbopack\n * build whose config has a `webpack` key only where it has no `turbopack` one, and ours always does.\n */\nimport { createServer } from 'node:http';\nimport type { AddressInfo } from 'node:net';\nimport { resolve } from 'node:path';\n\nimport type { ServerPlugin } from './index.ts';\nimport type { LoaderOptions } from './loader.ts';\nimport { endpoints, nodeMiddleware, redirect } from './tools/endpoints.ts';\nimport { beside, type DeicticOptions, prepare, writeClient } from './tools/integration.ts';\nimport { JSX } from './tools/locate.ts';\n\nexport interface DeicticNextOptions extends DeicticOptions {\n /** The project's root, which marks and edits are from: the working directory `next dev` runs in by default. */\n root?: string;\n}\n\n/** A Turbopack rule: ours, or whatever the app has. */\ntype Rule = { condition?: unknown; loaders: { loader: string; options: LoaderOptions }[] } | object;\ntype Rules = Record<string, Rule | Rule[]>;\ntype Rewrite = { source: string; destination: string };\ntype Rewrites = Rewrite[] | { beforeFiles?: Rewrite[]; afterFiles?: Rewrite[]; fallback?: Rewrite[] };\n/** What Next's `webpack` option reads and answers, as far as it's used here. Not async: Next doesn't wait for one. */\ntype Webpack = (config: { module: { rules: unknown[] } }, context: { isServer: boolean }) => { module: { rules: unknown[] } };\ntype ConfigFunction<C> = (phase: string, context: { defaultConfig: C }) => C | Promise<C>;\n\nconst DEV = 'phase-development-server';\nconst loaderPath = beside(import.meta.url, 'loader');\nconst GLOBS = ['*.tsx', '*.jsx', '*.js'];\n\n// Next loads its config more than once in a process: one endpoints server per project is enough.\nconst serving = new Map<string, Promise<number>>();\n\n/**\n * Wraps the Next config: `export default withDeictic({ ... }, { plugins: [tailwind()] })`. Takes the\n * config as an object or as the function Next calls with the phase, and returns the function.\n */\nexport function withDeictic<C extends object>(\n next: C | ConfigFunction<C> = {} as C,\n options: DeicticNextOptions = {},\n): (phase: string, context: { defaultConfig: C }) => Promise<C> {\n // Now, so a wrong set of plugins stops the dev server as it starts, rather than the page.\n const { plugins, shortcut } = prepare(options);\n return async (phase, context) => {\n const resolved = typeof next === 'function' ? await next(phase, context) : next;\n if (phase !== DEV) return resolved;\n const root = resolve(options.root ?? process.cwd());\n const base = `${(resolved as { basePath?: string }).basePath ?? ''}/`;\n const client = writeClient(root, plugins, base, shortcut);\n const rules: [string, Rule][] = GLOBS.flatMap((glob) => [\n [glob, { condition: { all: ['browser', { not: 'foreign' }] }, loaders: [{ loader: loaderPath, options: { root, client } }] }],\n [glob, { condition: { all: [{ not: 'browser' }, { not: 'foreign' }] }, loaders: [{ loader: loaderPath, options: { root } }] }],\n ]);\n return withRewrite(withWebpack(withRules(resolved, rules), root, client), await serve(root, plugins, base));\n };\n}\n\n/** The app's rules and ours: where both have one for a glob, theirs first, then ours, in a list. */\nfunction withRules<C extends object>(resolved: C, ours: [string, Rule][]): C {\n const turbopack = (resolved as { turbopack?: { rules?: Rules } }).turbopack;\n const rules: Rules = { ...turbopack?.rules };\n for (const [glob, rule] of ours) rules[glob] = glob in rules ? [rules[glob], rule].flat() : rule;\n return { ...resolved, turbopack: { ...turbopack, rules } };\n}\n\n/** For `next dev --webpack`: the app's own `webpack`, then the loader, `pre`, with the client in the browser's build. */\nfunction withWebpack<C extends object>(resolved: C, root: string, client: string): C {\n const theirs = (resolved as { webpack?: Webpack | null }).webpack;\n const webpack: Webpack = (config, context) => {\n const made = theirs?.(config, context) ?? config;\n const options: LoaderOptions = context.isServer ? { root } : { root, client };\n made.module.rules.unshift({ test: JSX, exclude: /[\\\\/]node_modules[\\\\/]/, enforce: 'pre', use: [{ loader: loaderPath, options }] });\n return made;\n };\n return { ...resolved, webpack };\n}\n\n/** Sends `/__deictic/*` to the endpoints' server, before any of the app's own rewrites. */\nfunction withRewrite<C extends object>(resolved: C, port: number): C {\n const theirs = (resolved as { rewrites?: () => Promise<Rewrites> }).rewrites;\n const ours = [{ source: '/__deictic/:path*', destination: `http://127.0.0.1:${port}/__deictic/:path*` }];\n const rewrites = async (): Promise<Rewrites> => {\n const r = (await theirs?.()) ?? [];\n return Array.isArray(r) ? { beforeFiles: ours, afterFiles: r } : { ...r, beforeFiles: [...ours, ...(r.beforeFiles ?? [])] };\n };\n return { ...resolved, rewrites };\n}\n\n/** Serves the endpoints on a free local port, for as long as the process lives. */\nfunction serve(root: string, plugins: ServerPlugin[], base: string): Promise<number> {\n const running = serving.get(root);\n if (running !== undefined) return running;\n const handle = endpoints({\n root,\n plugins,\n // Rewritten from under the base, but served at the root of their own server.\n base: '/',\n open: (path, { line, column }) =>\n redirect(`${base}__nextjs_launch-editor?${new URLSearchParams({ file: path, line1: String(line), column1: String(column) })}`),\n });\n const middleware = nodeMiddleware(handle);\n const server = createServer((req, res) =>\n middleware(req, res, () => {\n res.statusCode = 404;\n res.end();\n }),\n );\n const port = new Promise<number>((done, fail) => {\n server.once('error', fail);\n server.listen(0, '127.0.0.1', () => done((server.address() as AddressInfo).port));\n });\n // Not keeping the process alive past Next's own server.\n server.unref();\n serving.set(root, port);\n return port;\n}\n\nexport default withDeictic;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAM,MAAM;AACZ,MAAM,aAAa,OAAO,YAAY,KAAK,QAAQ;AACnD,MAAM,QAAQ;CAA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B,IAAI,aAAa;EACjB,IAAI,IAAI;CACV,CAAC,CACH;CACA,MAAM,OAAO,IAAI,SAAiB,MAAM,SAAS;EAC/C,OAAO,KAAK,SAAS,IAAI;EACzB,OAAO,OAAO,GAAG,mBAAmB,KAAM,OAAO,QAAQ,CAAC,CAAiB,IAAI,CAAC;CAClF,CAAC;CAED,OAAO,MAAM;CACb,QAAQ,IAAI,MAAM,IAAI;CACtB,OAAO;AACT"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `deictic/recommended`: the plugins for describing a change rather than making it. Alt-click an element, say what
|
|
3
|
+
* should change, attach a screenshot to draw on, a screen recording or your voice, and it goes to a Vercel Board.
|
|
4
|
+
*
|
|
5
|
+
* Only the server halves, as every factory is: each names its page half, which the integration imports. A plugin
|
|
6
|
+
* outside the preset (Tailwind, your own) goes beside it: `plugins: [...recommended(), tailwind()]`.
|
|
7
|
+
*/
|
|
8
|
+
import { g as ServerPlugin } from "../shared/index.js";
|
|
9
|
+
import { AnnotationsOptions } from "../annotations/index.js";
|
|
10
|
+
import { a as RecordingsOptions } from "../shared/index3.js";
|
|
11
|
+
import { l as ScreenshotsOptions } from "../shared/index2.js";
|
|
12
|
+
import { f as TasksOptions } from "../shared/index4.js";
|
|
13
|
+
import { VoiceOptions } from "../voice/index.js";
|
|
14
|
+
/** Each plugin's options, by its name, or `false` to leave it out. */
|
|
15
|
+
export interface RecommendedOptions {
|
|
16
|
+
tasks?: TasksOptions | false;
|
|
17
|
+
screenshots?: ScreenshotsOptions | false;
|
|
18
|
+
annotations?: AnnotationsOptions | false;
|
|
19
|
+
recordings?: RecordingsOptions | false;
|
|
20
|
+
voice?: VoiceOptions | false;
|
|
21
|
+
}
|
|
22
|
+
/** Tasks, screenshots, annotations, recordings and voice, in that order: the order of their tabs. */
|
|
23
|
+
export declare function recommended(options?: RecommendedOptions): ServerPlugin[];
|
|
24
|
+
export { recommended as default };
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/plugins/recommended/index.ts"],"mappings":";;;;;;;;;;;;;;iBAeiB;EACf,QAAQ;EACR,cAAc;EACd,cAAc;EACd,aAAa;EACb,QAAQ;;;wBAIM,YAAY,UAAS,qBAA0B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { annotations } from "../annotations/index.js";
|
|
2
|
+
import { t as recordings } from "../shared/recordings.js";
|
|
3
|
+
import screenshots from "../screenshots/index.js";
|
|
4
|
+
import { t as tasks } from "../shared/tasks.js";
|
|
5
|
+
import voice from "../voice/index.js";
|
|
6
|
+
// src/plugins/recommended/index.ts
|
|
7
|
+
/** Tasks, screenshots, annotations, recordings and voice, in that order: the order of their tabs. */
|
|
8
|
+
function recommended(options = {}) {
|
|
9
|
+
const plugins = [];
|
|
10
|
+
if (options.tasks !== false) plugins.push(tasks(options.tasks));
|
|
11
|
+
if (options.screenshots !== false) plugins.push(screenshots(options.screenshots));
|
|
12
|
+
if (options.annotations !== false) plugins.push(annotations(options.annotations));
|
|
13
|
+
if (options.recordings !== false) plugins.push(recordings(options.recordings));
|
|
14
|
+
if (options.voice !== false) plugins.push(voice(options.voice));
|
|
15
|
+
return plugins;
|
|
16
|
+
}
|
|
17
|
+
export { recommended as default, recommended };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/plugins/recommended/index.ts"],"sourcesContent":["/**\n * `deictic/recommended`: the plugins for describing a change rather than making it. Alt-click an element, say what\n * should change, attach a screenshot to draw on, a screen recording or your voice, and it goes to a Vercel Board.\n *\n * Only the server halves, as every factory is: each names its page half, which the integration imports. A plugin\n * outside the preset (Tailwind, your own) goes beside it: `plugins: [...recommended(), tailwind()]`.\n */\nimport type { ServerPlugin } from '#src/index.ts';\nimport { annotations, type AnnotationsOptions } from '#src/plugins/annotations/index.ts';\nimport { recordings, type RecordingsOptions } from '#src/plugins/recordings/index.ts';\nimport { screenshots, type ScreenshotsOptions } from '#src/plugins/screenshots/index.ts';\nimport { tasks, type TasksOptions } from '#src/plugins/tasks/index.ts';\nimport { voice, type VoiceOptions } from '#src/plugins/voice/index.ts';\n\n/** Each plugin's options, by its name, or `false` to leave it out. */\nexport interface RecommendedOptions {\n tasks?: TasksOptions | false;\n screenshots?: ScreenshotsOptions | false;\n annotations?: AnnotationsOptions | false;\n recordings?: RecordingsOptions | false;\n voice?: VoiceOptions | false;\n}\n\n/** Tasks, screenshots, annotations, recordings and voice, in that order: the order of their tabs. */\nexport function recommended(options: RecommendedOptions = {}): ServerPlugin[] {\n const plugins: ServerPlugin[] = [];\n if (options.tasks !== false) plugins.push(tasks(options.tasks));\n if (options.screenshots !== false) plugins.push(screenshots(options.screenshots));\n if (options.annotations !== false) plugins.push(annotations(options.annotations));\n if (options.recordings !== false) plugins.push(recordings(options.recordings));\n if (options.voice !== false) plugins.push(voice(options.voice));\n return plugins;\n}\n\nexport default recommended;\n"],"mappings":";;;;;;;AAwBA,SAAgB,YAAY,UAA8B,CAAC,GAAmB;CAC5E,MAAM,UAA0B,CAAC;CACjC,IAAI,QAAQ,UAAU,OAAO,QAAQ,KAAK,MAAM,QAAQ,KAAK,CAAC;CAC9D,IAAI,QAAQ,gBAAgB,OAAO,QAAQ,KAAK,YAAY,QAAQ,WAAW,CAAC;CAChF,IAAI,QAAQ,gBAAgB,OAAO,QAAQ,KAAK,YAAY,QAAQ,WAAW,CAAC;CAChF,IAAI,QAAQ,eAAe,OAAO,QAAQ,KAAK,WAAW,QAAQ,UAAU,CAAC;CAC7E,IAAI,QAAQ,UAAU,OAAO,QAAQ,KAAK,MAAM,QAAQ,KAAK,CAAC;CAC9D,OAAO;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/plugins/recordings/client.ts"],"mappings":";cAiIA,4B"}
|