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":"client.js","names":[],"sources":["../../src/plugins/tasks/client.ts"],"sourcesContent":["/**\n * The tasks panel: the tasks already about this element and their state, and a field to add one. Each\n * task's ID opens it on the board, where the board has a page; one no one has claimed yet can be edited\n * in place (its words) or deleted (canceled on the board), both changes the popup's undo takes back.\n * Ctrl+Enter or Add sends it with the page's URL, the viewport and the element as it rendered, which\n * the source can't tell; and where the annotations plugin is loaded, what's marked on the page.\n *\n * Where the screenshots plugin is loaded, a shot of the page goes with it, unless that's unticked. With\n * the annotations plugin too, Annotate takes the shot now and opens it to draw on: saved, it's a chip\n * under the field, which opens it again to change the marks, and Add another takes one more. Any chip\n * (a recording's too) takes the box's place; removing the last brings it back unticked, so a task goes\n * without a shot unless asked again.\n *\n * Where the recordings plugin is loaded, Record leaves the popup (`away`) to record the page, keeping\n * what's typed and attached, and comes back with the recording as a chip too, which plays it back.\n * Where the voice plugin is, Voice records the mic here in the panel: stopped, it's a chip that plays it.\n */\nimport { liveWaveform } from '#src/client/waveform.ts';\nimport { defineClientPlugin, type LightboxItem, type Target } from '#src/index.ts';\n\n// For `use()`'s types: the plugins may not be loaded, and nothing of them runs here.\nimport type { Annotation, Annotations, Picture } from '#src/plugins/annotations/index.ts';\nimport type { Recording } from '#src/plugins/recordings/index.ts';\nimport type { Shot } from '#src/plugins/screenshots/index.ts';\nimport type { Clip, Take } from '#src/plugins/voice/index.ts';\n\nimport type { Change, Marks, Model, Op, Task, TaskAdded } from './index.ts';\n\nconst STYLE = `\n.tasks { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }\n.tasks li { display: flex; gap: 6px; align-items: baseline; }\n.tasks .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.tasks .state { font: 11px ui-monospace, monospace; color: var(--deictic-muted); }\n.tasks .state.completed { color: #4ade80; }\n.tasks .state.failed { color: var(--deictic-problem); }\n.tasks a { color: inherit; text-decoration: none; }\n.tasks a:hover { text-decoration: underline; }\n.tasks .act { align-self: center; display: inline-flex; padding: 2px; border: 0; color: var(--deictic-muted); }\n.tasks .act:hover { color: var(--deictic-fg); }\n.tasks .act svg { width: 12px; height: 12px; }\n.tasks li.editing { display: grid; }\n.tasks li.editing .row { margin-top: 0; }\n.tasks li.editing .actions { display: flex; gap: 6px; }\ntextarea { min-height: 64px; resize: vertical; font: 13px/1.4 system-ui, sans-serif; }\n.row { display: flex; gap: 6px; margin-top: 8px; justify-content: space-between; align-items: center; }\n.hint { color: var(--deictic-muted); font-size: 12px; }\n.hint a { color: inherit; }\n.hint a:hover { color: var(--deictic-fg); }\n.shot { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--deictic-muted); }\n.shot label { display: flex; gap: 6px; align-items: center; }\n.shot input { width: auto; margin: 0; }\n.shot .actions { display: flex; gap: 6px; margin-left: auto; }\n.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; font-size: 12px; }\n.chip { display: inline-flex; align-items: center; border: 1px solid var(--deictic-line); border-radius: 6px; }\n.chip button { border: 0; }\n.chip .open { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 2px; }\n.chip img { display: block; height: 28px; border-radius: 4px; }\n.chip .play { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 4px; background: var(--deictic-line); }\n.chip .play svg { width: 12px; height: 12px; }\n.chip .remove { padding: 0 6px; color: var(--deictic-muted); }\n.chip .remove:hover { color: var(--deictic-fg); }\n.voice-on { display: inline-flex; align-items: center; gap: 4px; color: #fff; background: #ef4444; border-color: #ef4444; font-variant-numeric: tabular-nums; }\n.voice-on .wave { width: 36px; height: 14px; }\n.shot-problem { margin-top: 4px; font-size: 12px; color: var(--deictic-problem); }\n.shot-problem:empty { display: none; }\n.shot[hidden], .chips[hidden], label[hidden] { display: none; }\n`;\n\nconst ICON = (path: string) =>\n `<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"${path}\"/></svg>`;\nconst EDIT = ICON('M4 20h4L19 9l-4-4L4 16z');\nconst DELETE = ICON('M4 7h16M10 7V4h4v3M6 7l1 13h10l1-13');\nconst PLAY = '<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M7 4v16l13-8z\" fill=\"currentColor\"/></svg>';\n\n/** Marks as a task tells of them: how many, and what the notes say. */\nfunction marksOf(list: readonly Annotation[]): Marks {\n return { count: list.length, notes: list.flatMap(({ shape }) => (shape.kind === 'note' ? [shape.text] : [])) };\n}\n\n/** The page's annotations for the op, where there are any. */\nfunction annotationsOf(marks: Annotations | undefined): Pick<Op, 'annotations'> {\n const list = marks?.list() ?? [];\n return list.length === 0 ? {} : { annotations: marksOf(list) };\n}\n\n/** An annotated shot: the shot as taken, the marks drawn on it, and the PNG of both. */\ninterface Drawn {\n shot: Shot;\n marks: Annotation[];\n png: Blob;\n}\n\n/** A drawn shot as the panel shows it, with a URL for its thumbnail, revoked with it. */\ninterface Chip extends Drawn {\n url: string;\n}\n\n/** What the panel keeps while it's away recording: what's typed, ticked and attached. */\ninterface Kept {\n text: string;\n attach: boolean;\n drawn: Drawn[];\n recordings: Recording[];\n voices: Clip[];\n}\n\nconst clock = (ms: number) => {\n const s = Math.round(ms / 1000);\n return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`;\n};\n\nconst messageOf = (e: unknown) => (e instanceof Error ? e.message : String(e));\n\n/**\n * `#shadow-root > div.panel > div.head > button.tab:nth-of-type(2)`: where `inner` is inside `outer`, through\n * shadow roots, by tag, classes and, among siblings alike, place, for whoever finds it in the code.\n */\nfunction pathTo(inner: Element, outer: Element): string {\n const steps: string[] = [];\n for (let at: Element | undefined = inner; at !== undefined && at !== outer;) {\n const nameOf = (el: Element) => `${el.localName}${[...el.classList].map((c) => `.${c}`).join('')}`;\n const name = nameOf(at);\n const siblings = at.parentElement === null ? [] : [...at.parentElement.children];\n // Its place only where a sibling reads the same.\n const same = siblings.filter((c) => nameOf(c) === name).length > 1;\n const alike = siblings.filter((c) => c.localName === at!.localName);\n steps.unshift(same ? `${name}:nth-of-type(${alike.indexOf(at) + 1})` : name);\n if (at.parentElement !== null) {\n at = at.parentElement;\n } else {\n const root = at.getRootNode();\n if (!(root instanceof ShadowRoot)) break;\n steps.unshift('#shadow-root');\n at = root.host;\n }\n }\n return steps.join(' > ');\n}\n\nfunction element<K extends keyof HTMLElementTagNameMap>(tag: K, props: Partial<HTMLElementTagNameMap[K]> = {}): HTMLElementTagNameMap[K] {\n return Object.assign(document.createElement(tag), props);\n}\n\n/** The event the page hears of each added task by, on `window`: its `detail` is a `TaskAdded`. */\nexport const TASK_ADDED = 'deictic:task';\n\n/** Tells the page of a task just added: the newest of the element's tasks, as the board answered them. */\nfunction announce(model: Model, op: Op, target: Target): void {\n const task = model.tasks.at(-1);\n if (task === undefined) return;\n const marks = (op.annotations?.count ?? 0) + (op.screenshots ?? []).reduce((n, shot) => n + (shot.marks?.count ?? 0), 0);\n const detail: TaskAdded = {\n id: task.id,\n title: task.title,\n state: task.state,\n channel: model.channel,\n target,\n page: op.page,\n attached: {\n screenshots: op.screenshots?.length ?? 0,\n recordings: op.recordings?.length ?? 0,\n voice: op.voice?.length ?? 0,\n marks,\n },\n };\n window.dispatchEvent(new CustomEvent(TASK_ADDED, { detail }));\n}\n\nexport default defineClientPlugin<Model, Change>({\n name: 'tasks',\n label: 'Task',\n mount: (panel, context) => {\n const style = element('style', { textContent: STYLE });\n const list = element('ul', { className: 'tasks' });\n const text = element('textarea', { placeholder: 'What should change here?' });\n const add = element('button', { type: 'button', className: 'primary', textContent: 'Add task' });\n const hint = element('span', { className: 'hint' });\n const row = element('div', { className: 'row' });\n row.append(hint, add);\n panel.append(style, list, text);\n\n const shots = context.use('screenshots');\n const notes = context.use('annotations');\n const recorder = context.use('recordings');\n const voice = context.use('voice');\n // Closes an open editor with the panel.\n const aborts = new AbortController();\n\n const attach = element('input', { type: 'checkbox', checked: true });\n const toggle = element('label', { hidden: shots === undefined });\n toggle.append(attach, 'Attach a screenshot');\n const annotate = element('button', { type: 'button', textContent: 'Annotate', title: 'Take the screenshot now and draw on it' });\n const record = element('button', {\n type: 'button',\n textContent: 'Record',\n title: 'Record the page, with a toolbar to draw on it, then come back here',\n });\n const speak = element('button', { type: 'button', textContent: 'Voice', title: 'Record your voice, here' });\n const actions = element('span', { className: 'actions' });\n actions.append(...(shots !== undefined && notes !== undefined ? [annotate] : []));\n const shot = element('div', { className: 'shot' });\n shot.append(toggle, actions);\n const chipsEl = element('div', { className: 'chips' });\n const another = element('button', { type: 'button', textContent: 'Add another', title: 'Take another screenshot and draw on it' });\n const problem = element('div', { className: 'shot-problem' });\n if (shots !== undefined || recorder !== undefined || voice !== undefined) panel.append(shot, chipsEl, problem);\n panel.append(row);\n\n let chips: Chip[] = [];\n let recordings: Recording[] = [];\n let voices: Clip[] = [];\n let busy = false;\n const attachedCount = () => chips.length + recordings.length + voices.length;\n // A task goes with words, or with something attached that says it; not while one is going.\n let sending = false;\n const able = () => (add.disabled = sending || (text.value.trim() === '' && attachedCount() === 0));\n // Record and Voice, where their plugins are: beside Annotate, or after the chips while the box is away.\n const more = () => [...(recorder !== undefined ? [record] : []), ...(voice !== undefined ? [speak] : [])];\n const chip = (content: (string | Node)[], title: string, at: number, remove: string, drop: () => void) => {\n const opener = element('button', { type: 'button', className: 'open', title });\n opener.append(...content);\n // Every attachment in one lightbox, opened at this one, growing out of its chip.\n opener.addEventListener('click', () => context.lightbox(viewed(), { at, from: el }));\n const remover = element('button', { type: 'button', className: 'remove', textContent: '×', title: remove });\n remover.addEventListener('click', drop);\n const el = element('span', { className: 'chip' });\n el.append(opener, remover);\n return el;\n };\n const shotName = (i: number) => `Screenshot ${i + 1}`;\n const recordingName = (i: number) => (recordings.length === 1 ? 'Recording' : `Recording ${i + 1}`);\n const voiceName = (i: number) => (voices.length === 1 ? 'Voice' : `Voice ${i + 1}`);\n /** What's attached, as the lightbox shows it, in the chips' order. */\n const viewed = (): LightboxItem[] => [\n ...chips.map((c, i) => ({\n kind: 'image' as const,\n url: c.url,\n title: shotName(i),\n actions: [{ label: 'Change marks', title: 'Draw on it again', run: () => void draw(c) }],\n })),\n ...recordings.map((r, i) => ({\n kind: 'page' as const,\n // The replay filling the frame, without a header of its own: the lightbox names it.\n url: `${r.url}${r.url.includes('?') ? '&' : '?'}embed`,\n title: `${recordingName(i)} · ${clock(r.duration)}`,\n actions: [\n { label: 'New tab', title: 'Play it back in a tab of its own', run: () => void window.open(r.url, '_blank', 'noopener') },\n ],\n })),\n ...voices.map((v, i) => ({ kind: 'audio' as const, url: v.url, title: `${voiceName(i)} · ${clock(v.duration)}` })),\n ];\n const showChips = () => {\n // The box stands for a shot taken as the task goes, so it's away while anything else is attached.\n const attached = attachedCount() > 0;\n shot.hidden = attached;\n chipsEl.hidden = !attached;\n if (!busy) another.textContent = chips.length > 0 ? 'Add another' : 'Annotate';\n if (!attached) actions.append(...more());\n chipsEl.replaceChildren(\n ...chips.map((c, i) => {\n const thumb = element('img', { src: c.url, alt: '' });\n return chip([thumb, shotName(i)], `Open ${shotName(i).toLowerCase()}`, i, `Remove ${shotName(i).toLowerCase()}`, () =>\n dropShot(c),\n );\n }),\n ...recordings.map((r, i) => {\n const play = element('span', { className: 'play', innerHTML: PLAY });\n return chip(\n [play, `${recordingName(i)} ${clock(r.duration)}${r.voice === undefined ? '' : ' · voice'}`],\n `Play ${recordingName(i).toLowerCase()} back`,\n chips.length + i,\n `Remove ${recordingName(i).toLowerCase()}`,\n () => {\n recordings = recordings.filter((x) => x !== r);\n dropped();\n },\n );\n }),\n ...voices.map((v, i) => {\n const play = element('span', { className: 'play', innerHTML: PLAY });\n return chip(\n [play, `${voiceName(i)} ${clock(v.duration)}`],\n `Play ${voiceName(i).toLowerCase()}`,\n chips.length + recordings.length + i,\n `Remove ${voiceName(i).toLowerCase()}`,\n () => {\n voices = voices.filter((x) => x !== v);\n dropped();\n },\n );\n }),\n ...(attached && shots !== undefined && notes !== undefined ? [another] : []),\n ...(attached ? more() : []),\n );\n able();\n mark();\n };\n const dropShot = (c: Chip) => {\n URL.revokeObjectURL(c.url);\n chips = chips.filter((x) => x !== c);\n dropped();\n };\n // Back to the box, unticked, once the last is gone: what was attached is, so nothing is until it's asked for again.\n const dropped = () => {\n if (attachedCount() === 0) attach.checked = false;\n showChips();\n };\n const toChip = (drawn: Drawn): Chip => ({ ...drawn, url: URL.createObjectURL(drawn.png) });\n const reset = () => {\n for (const c of chips) URL.revokeObjectURL(c.url);\n chips = [];\n recordings = [];\n voices = [];\n attach.checked = true;\n showChips();\n };\n\n /** Takes a shot and opens it to draw on, or opens a chip's again: saved, it's a chip. */\n const draw = async (old?: Chip) => {\n if (shots === undefined || notes === undefined || busy) return;\n busy = true;\n const was = { annotate: annotate.textContent, another: another.textContent };\n annotate.textContent = another.textContent = old === undefined ? 'Capturing…' : was.another;\n problem.textContent = '';\n try {\n const taken = old?.shot ?? (await shots.capture(context.element));\n annotate.textContent = was.annotate;\n another.textContent = was.another;\n const picture: Picture = { url: taken.url, ...taken.size };\n const marks = await notes.edit(picture, old?.marks ?? [], { signal: aborts.signal });\n if (marks === undefined) return;\n const next = toChip({ shot: taken, marks, png: await notes.flatten(picture, marks) });\n if (old === undefined) {\n chips = [...chips, next];\n } else {\n URL.revokeObjectURL(old.url);\n chips = chips.map((c) => (c === old ? next : c));\n }\n showChips();\n } catch (e) {\n problem.textContent = messageOf(e);\n } finally {\n annotate.textContent = was.annotate;\n another.textContent = was.another;\n busy = false;\n showChips();\n }\n };\n annotate.addEventListener('click', () => void draw());\n another.addEventListener('click', () => void draw());\n record.addEventListener('click', () => {\n if (recorder === undefined || busy) return;\n // A take going on is kept first, as a chip, to come back to with the rest.\n void speakOff().then(() => {\n const drawn = chips.map(({ url: _, ...d }) => d);\n const kept: Kept = { text: text.value, attach: attach.checked, drawn, recordings, voices };\n context.away(kept, () => recorder.record());\n });\n });\n\n // The mic, here: Voice starts a take, the same button (now its time) stops it, and it's a chip.\n let take: Take | undefined;\n let ticking: ReturnType<typeof setInterval> | undefined;\n let stopWave: (() => void) | undefined;\n const speakOn = async () => {\n if (voice === undefined) return;\n problem.textContent = '';\n speak.disabled = true;\n try {\n take = await voice.start();\n } catch (e) {\n problem.textContent = messageOf(e);\n return;\n } finally {\n speak.disabled = false;\n }\n const started = take.started;\n // The time, the mic's live waveform, so it's plain it hears, and what a click does.\n const time = element('span', { className: 'time' });\n const wave = element('canvas', { className: 'wave' });\n speak.replaceChildren('● ', time, wave, 'Stop');\n stopWave = liveWaveform(wave, take.stream, { played: '#fff', rest: 'rgb(255 255 255 / 0.4)' });\n const tick = () => (time.textContent = clock(Date.now() - started));\n speak.classList.add('voice-on');\n speak.title = 'Stop, and attach it';\n tick();\n ticking = setInterval(tick, 250);\n mark();\n };\n const speakOff = async () => {\n const ending = take;\n if (ending === undefined) return;\n take = undefined;\n clearInterval(ticking);\n stopWave?.();\n stopWave = undefined;\n speak.classList.remove('voice-on');\n speak.textContent = 'Saving…';\n try {\n voices = [...voices, await ending.stop()];\n } catch (e) {\n problem.textContent = messageOf(e);\n } finally {\n speak.textContent = 'Voice';\n speak.title = 'Record your voice, here';\n showChips();\n }\n };\n speak.addEventListener('click', () => void (take === undefined ? speakOn() : speakOff()));\n\n // The task whose words are open to change, by ID, and the tasks as last read.\n let editing: string | undefined;\n // The Save of a listed task whose words were changed and not kept yet.\n let edited: HTMLElement | undefined;\n /** Tells the popup what leaving now would lose: a listed task's changed words, or a new one's, typed, attached or being spoken. */\n const mark = () => context.unsaved(edited ?? (text.value.trim() !== '' || attachedCount() > 0 || take !== undefined ? add : undefined));\n let shown = context.model;\n /** Asks for a change to a listed task and shows the tasks as they are after; the panel's status says why not. */\n const change = async (op: Change) => {\n try {\n editing = undefined;\n render(await context.apply(op));\n } catch {\n render(shown);\n }\n };\n /** A task's words in a field of their own: Save or Ctrl+Enter keeps them, Cancel or Esc leaves them. */\n const editor = (t: Task) => {\n // Marked a modal while it's open, so Esc is its and not the popup's.\n const item = element('li', { className: 'editing' });\n item.dataset['deicticModal'] = '';\n const field = element('textarea', { value: t.text });\n const save = element('button', { type: 'button', className: 'primary', textContent: 'Save' });\n const leave = element('button', { type: 'button', textContent: 'Cancel' });\n const buttons = element('div', { className: 'row' });\n const right = element('span', { className: 'actions' });\n right.append(leave, save);\n buttons.append(element('code', { textContent: `#${t.id}` }), right);\n item.append(field, buttons);\n const done = () => {\n editing = undefined;\n render(shown);\n };\n const keep = () => {\n if (field.value.trim() === '') return;\n if (field.value.trim() === t.text) return done();\n save.disabled = true;\n void change({ edit: t.id, text: field.value });\n };\n field.addEventListener('input', () => {\n save.disabled = field.value.trim() === '';\n edited = field.value.trim() === t.text ? undefined : save;\n mark();\n });\n field.addEventListener('keydown', (e) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n done();\n }\n if (e.key !== 'Enter' || !(e.ctrlKey || e.metaKey)) return;\n e.preventDefault();\n keep();\n });\n save.addEventListener('click', keep);\n leave.addEventListener('click', done);\n queueMicrotask(() => field.focus());\n return item;\n };\n const render = (model: Model) => {\n shown = model;\n // A task being changed is drawn again with its words as they were.\n edited = undefined;\n const { channel, link, tasks } = model;\n const name =\n link === undefined\n ? element('span')\n : element('a', { href: link, target: '_blank', rel: 'noreferrer', title: 'Open the channel on the board' });\n name.textContent = `#${channel}`;\n hint.replaceChildren('to ', name);\n list.replaceChildren(\n ...tasks.map((t) => {\n if (t.id === editing && t.open) return editor(t);\n const item = element('li');\n const id = element('code', { textContent: `#${t.id}` });\n const title = element('span', { className: 'title', textContent: t.title, title: t.title });\n const state = element('span', { className: `state ${t.state}`, textContent: t.state });\n if (t.link === undefined) {\n item.append(id, title, state);\n } else {\n const to = element('a', { href: t.link, target: '_blank', rel: 'noreferrer', title: 'Open the task on the board' });\n to.append(id);\n item.append(to, title, state);\n }\n if (!t.open) return item;\n const edit = element('button', { type: 'button', className: 'act', innerHTML: EDIT, title: 'Edit the task' });\n edit.addEventListener('click', () => {\n editing = t.id;\n render(shown);\n });\n const remove = element('button', { type: 'button', className: 'act', innerHTML: DELETE, title: 'Delete the task' });\n remove.addEventListener('click', () => {\n remove.disabled = true;\n void change({ remove: t.id });\n });\n item.append(edit, remove);\n return item;\n }),\n );\n able();\n mark();\n };\n\n /** The shots to attach: each chip's PNG, kept as a shot, or a shot taken now where the box is ticked. */\n const screenshotsOf = async (): Promise<Op['screenshots']> => {\n if (shots === undefined) return undefined;\n if (chips.length > 0) {\n add.textContent = 'Uploading…';\n return Promise.all(\n chips.map(async ({ shot: taken, marks, png }) => ({\n id: (await shots.upload(png, taken)).id,\n box: taken.box,\n ...(marks.length === 0 ? {} : { marks: marksOf(marks) }),\n })),\n );\n }\n // With a recording attached the box is away, so no shot is asked for.\n if (!attach.checked || recordings.length > 0) return undefined;\n add.textContent = 'Capturing…';\n const { id, box } = await shots.capture(context.element);\n return [{ id, box }];\n };\n\n const send = async () => {\n if (busy || sending) return;\n // A take still going is kept first: it may be all there is to send.\n await speakOff();\n if (able()) return;\n sending = true;\n able();\n problem.textContent = '';\n let screenshots: Op['screenshots'];\n try {\n screenshots = await screenshotsOf();\n } catch (e) {\n // Said under the shots, which stay as they are: untick the box, or remove the chips, to send without.\n problem.textContent = messageOf(e);\n add.textContent = 'Add task';\n sending = false;\n able();\n return;\n }\n add.textContent = 'Add task';\n const { element: el, elements } = context;\n try {\n const op: Op = {\n text: text.value,\n page: location.href,\n viewport: { width: innerWidth, height: innerHeight },\n ...(context.pointed === undefined\n ? {}\n : { pointed: { path: pathTo(context.pointed, el), html: context.pointed.outerHTML.slice(0, 4000) } }),\n count: elements.length,\n ...(screenshots === undefined ? {} : { screenshots }),\n ...(recordings.length === 0\n ? {}\n : {\n recordings: recordings.map(({ id, duration, url, voice: clips }) => ({\n id,\n duration,\n replay: new URL(url, location.href).href,\n ...(clips === undefined ? {} : { voice: clips.map((c) => c.id) }),\n })),\n }),\n ...(voices.length === 0 ? {} : { voice: voices.map(({ id, duration }) => ({ id, duration })) }),\n ...annotationsOf(notes),\n };\n const model = await context.apply(op);\n render(model);\n announce(model, op, context.target);\n text.value = '';\n reset();\n } catch {\n // The panel's status says why; what was typed and drawn stays, to send again.\n }\n sending = false;\n able();\n };\n\n // Back from recording: what was kept, and the recording, or why there's none.\n const back = context.resumed;\n if (back !== undefined) {\n const kept = back.state as Kept;\n text.value = kept.text;\n attach.checked = kept.attach;\n chips = kept.drawn.map(toChip);\n recordings = [...kept.recordings, ...(back.result === undefined ? [] : [back.result as Recording])];\n voices = kept.voices;\n if (back.problem !== undefined) problem.textContent = back.problem;\n }\n\n text.addEventListener('input', () => {\n able();\n mark();\n });\n text.addEventListener('keydown', (e) => {\n if (e.key !== 'Enter' || !(e.ctrlKey || e.metaKey)) return;\n e.preventDefault();\n void send();\n });\n add.addEventListener('click', () => void send());\n showChips();\n render(context.model);\n text.focus();\n return () => {\n aborts.abort();\n take?.cancel();\n clearInterval(ticking);\n stopWave?.();\n for (const c of chips) URL.revokeObjectURL(c.url);\n };\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCd,MAAM,QAAQ,SACZ,0JAA0J,KAAK;AACjK,MAAM,OAAO,KAAK,yBAAyB;AAC3C,MAAM,SAAS,KAAK,qCAAqC;AACzD,MAAM,OAAO;;AAGb,SAAS,QAAQ,MAAoC;CACnD,OAAO;EAAE,OAAO,KAAK;EAAQ,OAAO,KAAK,SAAS,EAAE,YAAa,MAAM,SAAS,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC,CAAE;CAAE;AAC/G;;AAGA,SAAS,cAAc,OAAyD;CAC9E,MAAM,OAAO,OAAO,KAAK,KAAK,CAAC;CAC/B,OAAO,KAAK,WAAW,IAAI,CAAC,IAAI,EAAE,aAAa,QAAQ,IAAI,EAAE;AAC/D;AAuBA,MAAM,SAAS,OAAe;CAC5B,MAAM,IAAI,KAAK,MAAM,KAAK,GAAI;CAC9B,OAAO,GAAG,KAAK,MAAM,IAAI,EAAE,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG;AAChE;AAEA,MAAM,aAAa,MAAgB,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC;;;;;AAM5E,SAAS,OAAO,OAAgB,OAAwB;CACtD,MAAM,QAAkB,CAAC;CACzB,KAAK,IAAI,KAA0B,OAAO,OAAO,KAAA,KAAa,OAAO,QAAQ;EAC3E,MAAM,UAAU,OAAgB,GAA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as Change, o as Model, p as tasks, r as Edited, s as Op, t as Added, u as TaskAdded } from "../shared/index4.js";
|
|
2
|
+
export { Added, Change, Edited, Kept, type LocalBoard, type LocalOptions, Marks, Model, Op, Removed, Task, TaskAdded, TaskBoard, TasksOptions, tasks as default, tasks, local };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as default, t as tasks, n as local } from "../shared/tasks.js";
|
package/dist/vite.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
|
+
import { n as clientModule, t as DeicticOptions } from "./shared/integration.js";
|
|
3
|
+
export interface ViteOptions extends DeicticOptions {
|
|
4
|
+
/**
|
|
5
|
+
* deictic in a build too, for a page that shows it with no dev server behind it (a deployed demo): a module of
|
|
6
|
+
* the page's, from the root, whose default export answers the overlay's requests there (a `Standalone`, from
|
|
7
|
+
* `deictic`). The build's elements are marked and the overlay is in its bundle. The dev server answers as ever.
|
|
8
|
+
* Without it, the default, nothing of deictic is in a build.
|
|
9
|
+
*/
|
|
10
|
+
standalone?: string;
|
|
11
|
+
}
|
|
12
|
+
/** The client module's ID, which a page can import itself where nothing it bundles is JSX (Astro's pages). */
|
|
13
|
+
export declare const CLIENT = "virtual:deictic/client";
|
|
14
|
+
export declare function deictic(options?: ViteOptions): Plugin;
|
|
15
|
+
export { type DeicticOptions, clientModule, deictic as default };
|
|
16
|
+
//# sourceMappingURL=vite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.d.ts","names":[],"sources":["../src/vite.ts"],"mappings":";;iBAmBiB,oBAAoB;;;;;;;EAOnC;;;qBAIW;wBAGG,QAAQ,UAAS,cAAmB"}
|
package/dist/vite.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { n as nodeMiddleware, r as redirect, t as endpoints } from "./shared/endpoints.js";
|
|
3
|
+
import { a as markAstro, i as mark, n as clientModule, o as prepare } from "./shared/integration.js";
|
|
4
|
+
// src/vite.ts
|
|
5
|
+
/**
|
|
6
|
+
* `deictic/vite`: deictic in Vite's dev server. Nothing runs in a build, unless `standalone` asks for it.
|
|
7
|
+
*
|
|
8
|
+
* Its transform runs `pre`, so each JSX module's host elements are marked with their place in the
|
|
9
|
+
* source as written (`tools/locate.ts`). In the browser each marked module also imports the client
|
|
10
|
+
* module, which starts the overlay with every plugin's panel: imports run first and only once, so no
|
|
11
|
+
* line moves and frameworks that render their own HTML get it too. The endpoints are middleware on
|
|
12
|
+
* Vite's server, and a place opens through Vite's own `/__open-in-editor`, so the editor is whichever
|
|
13
|
+
* Vite already launches. A write reaches the page through Vite's usual update for the file.
|
|
14
|
+
*/
|
|
15
|
+
/** The client module's ID, which a page can import itself where nothing it bundles is JSX (Astro's pages). */
|
|
16
|
+
const CLIENT = "virtual:deictic/client";
|
|
17
|
+
const CLIENT_ID = "\0deictic/client";
|
|
18
|
+
function deictic(options = {}) {
|
|
19
|
+
const { plugins, shortcut } = prepare(options);
|
|
20
|
+
let root = "";
|
|
21
|
+
let base = "/";
|
|
22
|
+
let building = false;
|
|
23
|
+
return {
|
|
24
|
+
name: "deictic",
|
|
25
|
+
enforce: "pre",
|
|
26
|
+
apply: (_, { command }) => command === "serve" || options.standalone !== void 0,
|
|
27
|
+
config: () => ({ optimizeDeps: { exclude: ["deictic"] } }),
|
|
28
|
+
configResolved(config) {
|
|
29
|
+
root = config.root;
|
|
30
|
+
base = config.base;
|
|
31
|
+
building = config.command === "build";
|
|
32
|
+
},
|
|
33
|
+
configureServer(server) {
|
|
34
|
+
const handle = endpoints({
|
|
35
|
+
root,
|
|
36
|
+
plugins,
|
|
37
|
+
base,
|
|
38
|
+
open: (path, { line, column }) => redirect(`${base}__open-in-editor?${new URLSearchParams({ file: `${path}:${line}:${column}` })}`)
|
|
39
|
+
});
|
|
40
|
+
server.middlewares.use(nodeMiddleware(handle));
|
|
41
|
+
},
|
|
42
|
+
resolveId: (id) => id === "virtual:deictic/client" ? CLIENT_ID : void 0,
|
|
43
|
+
load(id) {
|
|
44
|
+
if (id !== CLIENT_ID) return void 0;
|
|
45
|
+
const server = building && options.standalone !== void 0 ? resolve(root, options.standalone).replaceAll("\\", "/") : void 0;
|
|
46
|
+
return clientModule(plugins, base, shortcut, server);
|
|
47
|
+
},
|
|
48
|
+
transform: {
|
|
49
|
+
order: "pre",
|
|
50
|
+
handler(code, id) {
|
|
51
|
+
const [path = ""] = id.split("?");
|
|
52
|
+
if (path.endsWith(".astro")) return id === path ? markAstro(code, path, root) : void 0;
|
|
53
|
+
const browser = this.environment.config.consumer === "client";
|
|
54
|
+
return mark(code, path, root, browser ? `\nimport ${JSON.stringify(CLIENT)};\n` : "");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export { CLIENT, clientModule, deictic as default, deictic };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=vite.js.map
|
package/dist/vite.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.js","names":[],"sources":["../src/vite.ts"],"sourcesContent":["/**\n * `deictic/vite`: deictic in Vite's dev server. Nothing runs in a build, unless `standalone` asks for it.\n *\n * Its transform runs `pre`, so each JSX module's host elements are marked with their place in the\n * source as written (`tools/locate.ts`). In the browser each marked module also imports the client\n * module, which starts the overlay with every plugin's panel: imports run first and only once, so no\n * line moves and frameworks that render their own HTML get it too. The endpoints are middleware on\n * Vite's server, and a place opens through Vite's own `/__open-in-editor`, so the editor is whichever\n * Vite already launches. A write reaches the page through Vite's usual update for the file.\n */\nimport { resolve } from 'node:path';\n\nimport type { Plugin } from 'vite';\n\nimport { endpoints, nodeMiddleware, redirect } from './tools/endpoints.ts';\nimport { clientModule, type DeicticOptions, mark, markAstro, prepare } from './tools/integration.ts';\n\nexport { clientModule, type DeicticOptions };\n\nexport interface ViteOptions extends DeicticOptions {\n /**\n * deictic in a build too, for a page that shows it with no dev server behind it (a deployed demo): a module of\n * the page's, from the root, whose default export answers the overlay's requests there (a `Standalone`, from\n * `deictic`). The build's elements are marked and the overlay is in its bundle. The dev server answers as ever.\n * Without it, the default, nothing of deictic is in a build.\n */\n standalone?: string;\n}\n\n/** The client module's ID, which a page can import itself where nothing it bundles is JSX (Astro's pages). */\nexport const CLIENT = 'virtual:deictic/client';\nconst CLIENT_ID = '\\0deictic/client';\n\nexport function deictic(options: ViteOptions = {}): Plugin {\n const { plugins, shortcut } = prepare(options);\n let root = '';\n let base = '/';\n let building = false;\n return {\n name: 'deictic',\n enforce: 'pre',\n apply: (_, { command }) => command === 'serve' || options.standalone !== undefined,\n // The client is the app's to bundle as it changes, not a dependency to prebundle once.\n config: () => ({ optimizeDeps: { exclude: ['deictic'] } }),\n configResolved(config) {\n root = config.root;\n base = config.base;\n building = config.command === 'build';\n },\n configureServer(server) {\n const handle = endpoints({\n root,\n plugins,\n base,\n open: (path, { line, column }) => redirect(`${base}__open-in-editor?${new URLSearchParams({ file: `${path}:${line}:${column}` })}`),\n });\n server.middlewares.use(nodeMiddleware(handle));\n },\n resolveId: (id) => (id === CLIENT ? CLIENT_ID : undefined),\n load(id) {\n if (id !== CLIENT_ID) return undefined;\n // Only a build's page asks the module: the dev server is there to answer.\n const server = building && options.standalone !== undefined ? resolve(root, options.standalone).replaceAll('\\\\', '/') : undefined;\n return clientModule(plugins, base, shortcut, server);\n },\n transform: {\n // First of all, not only first of the `pre` plugins: the React Compiler (`react({ compiler: true })`) is\n // `pre` too and compiles the JSX away, so after it there'd be no element to mark, wherever deictic is listed.\n order: 'pre',\n handler(code, id) {\n const [path = ''] = id.split('?');\n // An `.astro` component itself, not the styles and scripts Astro loads from it by a query.\n if (path.endsWith('.astro')) return id === path ? markAstro(code, path, root) : undefined;\n const browser = this.environment.config.consumer === 'client';\n return mark(code, path, root, browser ? `\\nimport ${JSON.stringify(CLIENT)};\\n` : '');\n },\n },\n };\n}\n\nexport default deictic;\n"],"mappings":";;;;;;;;;;;;;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AAE,OAAO,EAAE;GACtF;EACF;CACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/plugins/voice/client.ts"],"mappings":";cAYA,4B"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { defineClientPlugin } from "../index.js";
|
|
2
|
+
// src/plugins/voice/client.ts
|
|
3
|
+
/**
|
|
4
|
+
* The voice plugin's page half: `start()` asks for the mic (the browser asks the user the first time) and
|
|
5
|
+
* records it with `MediaRecorder`. `stop` sends the take to the `add` route and lets the mic go, so the
|
|
6
|
+
* browser's recording light goes out between takes.
|
|
7
|
+
*/
|
|
8
|
+
/** What the browser can record, best first: Opus in WebM where it can (Chrome, Firefox), else MP4 (Safari). */
|
|
9
|
+
const TYPES = [
|
|
10
|
+
"audio/webm;codecs=opus",
|
|
11
|
+
"audio/webm",
|
|
12
|
+
"audio/ogg;codecs=opus",
|
|
13
|
+
"audio/mp4"
|
|
14
|
+
];
|
|
15
|
+
var client_default = defineClientPlugin({
|
|
16
|
+
name: "voice",
|
|
17
|
+
setup: ({ base, request }) => ({ start: async () => {
|
|
18
|
+
if (typeof MediaRecorder === "undefined" || navigator.mediaDevices?.getUserMedia === void 0) throw new Error("voice: this browser can't record the mic here: it needs a secure page (https or localhost)");
|
|
19
|
+
const stream = await navigator.mediaDevices.getUserMedia({ audio: true }).catch((e) => {
|
|
20
|
+
throw new Error(`voice: the mic isn't available: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
|
|
21
|
+
});
|
|
22
|
+
const mimeType = TYPES.find((t) => MediaRecorder.isTypeSupported(t));
|
|
23
|
+
const recorder = new MediaRecorder(stream, mimeType === void 0 ? {} : { mimeType });
|
|
24
|
+
const chunks = [];
|
|
25
|
+
recorder.addEventListener("dataavailable", (e) => chunks.push(e.data));
|
|
26
|
+
const started = Date.now();
|
|
27
|
+
recorder.start();
|
|
28
|
+
const release = () => {
|
|
29
|
+
for (const track of stream.getTracks()) track.stop();
|
|
30
|
+
};
|
|
31
|
+
const ended = () => new Promise((done) => {
|
|
32
|
+
if (recorder.state === "inactive") return done();
|
|
33
|
+
recorder.addEventListener("stop", () => done(), { once: true });
|
|
34
|
+
recorder.stop();
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
started,
|
|
38
|
+
stream,
|
|
39
|
+
cancel: () => {
|
|
40
|
+
ended().then(release);
|
|
41
|
+
},
|
|
42
|
+
stop: async () => {
|
|
43
|
+
await ended();
|
|
44
|
+
release();
|
|
45
|
+
const duration = Date.now() - started;
|
|
46
|
+
const type = (recorder.mimeType || mimeType || "audio/webm").split(";")[0];
|
|
47
|
+
const res = await request("add", {
|
|
48
|
+
method: "POST",
|
|
49
|
+
headers: { "content-type": type },
|
|
50
|
+
body: new Blob(chunks, { type })
|
|
51
|
+
});
|
|
52
|
+
const { id, url, problem } = await res.json();
|
|
53
|
+
if (id === void 0) throw new Error(`voice: ${problem ?? res.statusText}`);
|
|
54
|
+
return {
|
|
55
|
+
id,
|
|
56
|
+
url: url ?? `${base}__deictic/plugins/voice/clip/${id}`,
|
|
57
|
+
duration,
|
|
58
|
+
type
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
} })
|
|
63
|
+
});
|
|
64
|
+
export { client_default as default };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"sources":["../../src/plugins/voice/client.ts"],"sourcesContent":["/**\n * The voice plugin's page half: `start()` asks for the mic (the browser asks the user the first time) and\n * records it with `MediaRecorder`. `stop` sends the take to the `add` route and lets the mic go, so the\n * browser's recording light goes out between takes.\n */\nimport { defineClientPlugin } from '#src/index.ts';\n\nimport type { Clip, Voice } from './index.ts';\n\n/** What the browser can record, best first: Opus in WebM where it can (Chrome, Firefox), else MP4 (Safari). */\nconst TYPES = ['audio/webm;codecs=opus', 'audio/webm', 'audio/ogg;codecs=opus', 'audio/mp4'];\n\nexport default defineClientPlugin<never, never, Voice>({\n name: 'voice',\n setup: ({ base, request }) => ({\n start: async () => {\n if (typeof MediaRecorder === 'undefined' || navigator.mediaDevices?.getUserMedia === undefined)\n throw new Error(\"voice: this browser can't record the mic here: it needs a secure page (https or localhost)\");\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true }).catch((e: unknown) => {\n throw new Error(`voice: the mic isn't available: ${e instanceof Error ? e.message : String(e)}`, { cause: e });\n });\n const mimeType = TYPES.find((t) => MediaRecorder.isTypeSupported(t));\n const recorder = new MediaRecorder(stream, mimeType === undefined ? {} : { mimeType });\n const chunks: Blob[] = [];\n recorder.addEventListener('dataavailable', (e) => chunks.push(e.data));\n const started = Date.now();\n recorder.start();\n const release = () => {\n for (const track of stream.getTracks()) track.stop();\n };\n const ended = () =>\n new Promise<void>((done) => {\n if (recorder.state === 'inactive') return done();\n recorder.addEventListener('stop', () => done(), { once: true });\n recorder.stop();\n });\n\n return {\n started,\n stream,\n cancel: () => {\n void ended().then(release);\n },\n stop: async (): Promise<Clip> => {\n await ended();\n release();\n const duration = Date.now() - started;\n const type = (recorder.mimeType || mimeType || 'audio/webm').split(';')[0]!;\n const res = await request('add', { method: 'POST', headers: { 'content-type': type }, body: new Blob(chunks, { type }) });\n // `url`: where the clip is, said by what keeps it with no server to serve it from (a `standalone` build).\n const { id, url, problem } = (await res.json()) as { id?: string; url?: string; problem?: string };\n if (id === undefined) throw new Error(`voice: ${problem ?? res.statusText}`);\n return { id, url: url ?? `${base}__deictic/plugins/voice/clip/${id}`, duration, type };\n },\n };\n },\n }),\n});\n"],"mappings":";;;;;;;;AAUA,MAAM,QAAQ;CAAC;CAA0B;CAAc;CAAyB;AAAW;AAE3F,IAAA,iBAAe,mBAAwC;CACrD,MAAM;CACN,QAAQ,EAAE,MAAM,eAAe,EAC7B,OAAO,YAAY;EACjB,IAAI,OAAO,kBAAkB,eAAe,UAAU,cAAc,iBAAiB,KAAA,GACnF,MAA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MAAM,IAAI,MAAM,UAAU,WAAW,IAAI,YAAY;IAC3E,OAAO;KAAE;KAAI,KAAK,OAAO,GAAG,KAAK,+BAA+B;KAAM;KAAU;IAAK;GACvF;EACF;CACF,EACF;AACF,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** A clip as the page knows it: its ID, where it plays from, how long it runs in milliseconds, and its type. */
|
|
2
|
+
export interface Clip {
|
|
3
|
+
id: string;
|
|
4
|
+
url: string;
|
|
5
|
+
duration: number;
|
|
6
|
+
type: string;
|
|
7
|
+
}
|
|
8
|
+
/** A take going on: `stop` ends it and keeps it, `cancel` ends it and keeps nothing. */
|
|
9
|
+
export interface Take {
|
|
10
|
+
/** When it started, as `Date.now()`. */
|
|
11
|
+
started: number;
|
|
12
|
+
/** The mic, while it's recorded: to show it's heard (`liveWaveform` from `deictic/client`). */
|
|
13
|
+
stream: MediaStream;
|
|
14
|
+
stop(): Promise<Clip>;
|
|
15
|
+
cancel(): void;
|
|
16
|
+
}
|
|
17
|
+
/** The page's half, for other plugins' page halves. */
|
|
18
|
+
export interface Voice {
|
|
19
|
+
/** Starts recording the mic, asking for it the first time: rejects when it's refused or there's none. */
|
|
20
|
+
start(): Promise<Take>;
|
|
21
|
+
}
|
|
22
|
+
/** The server's half, for other plugins' server halves. */
|
|
23
|
+
export interface Clips {
|
|
24
|
+
/** A clip's audio, or nothing for one not kept (any more). */
|
|
25
|
+
read(id: string): {
|
|
26
|
+
data: Uint8Array<ArrayBuffer>;
|
|
27
|
+
name: string;
|
|
28
|
+
type: string;
|
|
29
|
+
} | undefined;
|
|
30
|
+
}
|
|
31
|
+
declare module 'deictic' {
|
|
32
|
+
interface ServerApis {
|
|
33
|
+
voice: Clips;
|
|
34
|
+
}
|
|
35
|
+
interface ClientApis {
|
|
36
|
+
voice: Voice;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export interface VoiceOptions {
|
|
40
|
+
/** How many clips to keep, the latest: 50 by default. */
|
|
41
|
+
keep?: number;
|
|
42
|
+
/** Where they're kept, from the project's root: `.deictic/voice` by default. */
|
|
43
|
+
dir?: string;
|
|
44
|
+
}
|
|
45
|
+
export declare function voice(options?: VoiceOptions): import("deictic").ServerPlugin<never, never, never, Clips>;
|
|
46
|
+
export { voice as default };
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/plugins/voice/index.ts"],"mappings":";iBAaiB;EACf;EACA;EACA;EACA;;;iBAIe;;EAEf;;EAEA,QAAQ;EACR,QAAQ,QAAQ;EAChB;;;iBAIe;;EAEf,SAAS,QAAQ;;;iBAIF;;EAEf,KAAK;IAAe,MAAM,WAAW;IAAc;IAAc;;;;YAIvD;IACR,OAAO;;YAEC;IACR,OAAO;;;iBAIM;;EAEf;;EAEA;;wBASc,MAAM,UAAS,iCAAiB,kCAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { definePlugin } from "../index.js";
|
|
4
|
+
import { t as keptIn } from "../shared/kept.js";
|
|
5
|
+
// src/plugins/voice/index.ts
|
|
6
|
+
/**
|
|
7
|
+
* `deictic/voice`: records the mic, for other plugins to attach (tasks does) or play along with
|
|
8
|
+
* something (a recording does). No tab of its own. The page half asks for the mic the first time, records
|
|
9
|
+
* with `MediaRecorder` and sends each take to the `add` route; the server half keeps the latest `keep`
|
|
10
|
+
* clips under `.deictic/voice` and serves them at `clip/<id>`.
|
|
11
|
+
*/
|
|
12
|
+
const ID = /^[a-z0-9]+-[a-z0-9]+$/;
|
|
13
|
+
/** What one clip may weigh: minutes of speech in Opus are well under a MB. */
|
|
14
|
+
const MAX = 26214400;
|
|
15
|
+
/** The audio a browser's `MediaRecorder` makes, by the extension it's kept under. */
|
|
16
|
+
const TYPES = {
|
|
17
|
+
webm: "audio/webm",
|
|
18
|
+
ogg: "audio/ogg",
|
|
19
|
+
mp4: "audio/mp4"
|
|
20
|
+
};
|
|
21
|
+
function voice(options = {}) {
|
|
22
|
+
const keep = options.keep ?? 50;
|
|
23
|
+
let dir = "";
|
|
24
|
+
let taken = 0;
|
|
25
|
+
const fileOf = (id) => ID.test(id) && existsSync(dir) ? readdirSync(dir).find((f) => f.startsWith(`${id}.`)) : void 0;
|
|
26
|
+
const read = (id) => {
|
|
27
|
+
const file = fileOf(id);
|
|
28
|
+
if (file === void 0) return void 0;
|
|
29
|
+
const ext = file.slice(id.length + 1);
|
|
30
|
+
return {
|
|
31
|
+
data: new Uint8Array(readFileSync(join(dir, file))),
|
|
32
|
+
name: `voice-${file}`,
|
|
33
|
+
type: TYPES[ext] ?? "application/octet-stream"
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const keepClip = (data, ext) => {
|
|
37
|
+
const id = `${Date.now().toString(36).padStart(9, "0")}${(taken++ % 1296).toString(36).padStart(2, "0")}-${crypto.randomUUID().slice(0, 8)}`;
|
|
38
|
+
mkdirSync(dir, { recursive: true });
|
|
39
|
+
writeFileSync(join(dir, `${id}.${ext}`), data);
|
|
40
|
+
const kept = readdirSync(dir).toSorted();
|
|
41
|
+
for (const old of kept.slice(0, Math.max(0, kept.length - keep))) rmSync(join(dir, old));
|
|
42
|
+
return id;
|
|
43
|
+
};
|
|
44
|
+
return definePlugin({
|
|
45
|
+
name: "voice",
|
|
46
|
+
client: "deictic/voice/client",
|
|
47
|
+
setup: ({ root }) => {
|
|
48
|
+
dir = options.dir === void 0 ? keptIn(root, "voice") : resolve(root, options.dir);
|
|
49
|
+
return { read };
|
|
50
|
+
},
|
|
51
|
+
routes: {
|
|
52
|
+
add: async (req) => {
|
|
53
|
+
const type = (req.headers.get("content-type") ?? "").split(";")[0].trim();
|
|
54
|
+
const ext = Object.keys(TYPES).find((e) => TYPES[e] === type);
|
|
55
|
+
if (ext === void 0) return Response.json({ problem: `send the clip as ${Object.values(TYPES).join(", ")}` }, { status: 415 });
|
|
56
|
+
const body = new Uint8Array(await req.arrayBuffer());
|
|
57
|
+
if (body.byteLength === 0) return Response.json({ problem: "the clip is empty: speak for a moment longer" }, { status: 400 });
|
|
58
|
+
if (body.byteLength > MAX) return Response.json({ problem: `a clip may weigh ${MAX / 1024 / 1024} MB at most` }, { status: 413 });
|
|
59
|
+
return Response.json({ id: keepClip(body, ext) });
|
|
60
|
+
},
|
|
61
|
+
clip: (req) => {
|
|
62
|
+
const found = read(new URL(req.url).pathname.split("/").at(-1) ?? "");
|
|
63
|
+
if (found === void 0) return new Response("no such clip, or not kept any more", { status: 404 });
|
|
64
|
+
return new Response(found.data, { headers: {
|
|
65
|
+
"content-type": found.type,
|
|
66
|
+
"cache-control": "no-store"
|
|
67
|
+
} });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
export { voice as default, voice };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/plugins/voice/index.ts"],"sourcesContent":["/**\n * `deictic/voice`: records the mic, for other plugins to attach (tasks does) or play along with\n * something (a recording does). No tab of its own. The page half asks for the mic the first time, records\n * with `MediaRecorder` and sends each take to the `add` route; the server half keeps the latest `keep`\n * clips under `.deictic/voice` and serves them at `clip/<id>`.\n */\nimport { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\n\nimport { definePlugin } from '#src/index.ts';\nimport { keptIn } from '#src/tools/kept.ts';\n\n/** A clip as the page knows it: its ID, where it plays from, how long it runs in milliseconds, and its type. */\nexport interface Clip {\n id: string;\n url: string;\n duration: number;\n type: string;\n}\n\n/** A take going on: `stop` ends it and keeps it, `cancel` ends it and keeps nothing. */\nexport interface Take {\n /** When it started, as `Date.now()`. */\n started: number;\n /** The mic, while it's recorded: to show it's heard (`liveWaveform` from `deictic/client`). */\n stream: MediaStream;\n stop(): Promise<Clip>;\n cancel(): void;\n}\n\n/** The page's half, for other plugins' page halves. */\nexport interface Voice {\n /** Starts recording the mic, asking for it the first time: rejects when it's refused or there's none. */\n start(): Promise<Take>;\n}\n\n/** The server's half, for other plugins' server halves. */\nexport interface Clips {\n /** A clip's audio, or nothing for one not kept (any more). */\n read(id: string): { data: Uint8Array<ArrayBuffer>; name: string; type: string } | undefined;\n}\n\ndeclare module 'deictic' {\n interface ServerApis {\n voice: Clips;\n }\n interface ClientApis {\n voice: Voice;\n }\n}\n\nexport interface VoiceOptions {\n /** How many clips to keep, the latest: 50 by default. */\n keep?: number;\n /** Where they're kept, from the project's root: `.deictic/voice` by default. */\n dir?: string;\n}\n\nconst ID = /^[a-z0-9]+-[a-z0-9]+$/;\n/** What one clip may weigh: minutes of speech in Opus are well under a MB. */\nconst MAX = 25 * 1024 * 1024;\n/** The audio a browser's `MediaRecorder` makes, by the extension it's kept under. */\nconst TYPES: Record<string, string> = { webm: 'audio/webm', ogg: 'audio/ogg', mp4: 'audio/mp4' };\n\nexport function voice(options: VoiceOptions = {}) {\n const keep = options.keep ?? 50;\n let dir = '';\n let taken = 0;\n const fileOf = (id: string) => (ID.test(id) && existsSync(dir) ? readdirSync(dir).find((f) => f.startsWith(`${id}.`)) : undefined);\n const read: Clips['read'] = (id) => {\n const file = fileOf(id);\n if (file === undefined) return undefined;\n const ext = file.slice(id.length + 1);\n return { data: new Uint8Array(readFileSync(join(dir, file))), name: `voice-${file}`, type: TYPES[ext] ?? 'application/octet-stream' };\n };\n const keepClip = (data: Uint8Array, ext: string) => {\n // Sorts by when it was made, which is what pruning keeps by: the count orders two in one millisecond.\n const id = `${Date.now().toString(36).padStart(9, '0')}${(taken++ % 1296).toString(36).padStart(2, '0')}-${crypto.randomUUID().slice(0, 8)}`;\n mkdirSync(dir, { recursive: true });\n writeFileSync(join(dir, `${id}.${ext}`), data);\n const kept = readdirSync(dir).toSorted();\n for (const old of kept.slice(0, Math.max(0, kept.length - keep))) rmSync(join(dir, old));\n return id;\n };\n\n return definePlugin<never, never, never, Clips>({\n name: 'voice',\n client: 'deictic/voice/client',\n setup: ({ root }) => {\n dir = options.dir === undefined ? keptIn(root, 'voice') : resolve(root, options.dir);\n return { read };\n },\n routes: {\n // A take the page recorded, as the audio type its `MediaRecorder` made.\n add: async (req) => {\n const type = (req.headers.get('content-type') ?? '').split(';')[0]!.trim();\n const ext = Object.keys(TYPES).find((e) => TYPES[e] === type);\n if (ext === undefined) return Response.json({ problem: `send the clip as ${Object.values(TYPES).join(', ')}` }, { status: 415 });\n const body = new Uint8Array(await req.arrayBuffer());\n if (body.byteLength === 0) return Response.json({ problem: 'the clip is empty: speak for a moment longer' }, { status: 400 });\n if (body.byteLength > MAX) return Response.json({ problem: `a clip may weigh ${MAX / 1024 / 1024} MB at most` }, { status: 413 });\n return Response.json({ id: keepClip(body, ext) });\n },\n // `clip/<id>`: the audio, to play back.\n clip: (req) => {\n const found = read(new URL(req.url).pathname.split('/').at(-1) ?? '');\n if (found === undefined) return new Response('no such clip, or not kept any more', { status: 404 });\n return new Response(found.data, { headers: { 'content-type': found.type, 'cache-control': 'no-store' } });\n },\n },\n });\n}\n\nexport default voice;\n"],"mappings":";;;;;;;;;;;AA0DA,MAAM,KAAK;;AAEX,MAAM,MAAM;;AAEZ,MAAM,QAAgC;CAAE,MAAM;CAAc,KAAK;CAAa,KAAK;AAAY;AAE/F,SAAgB,MAAM,UAAwB,CAAC,GAAG;CAChD,MAAM,OAAO,QAAQ,QAAQ;CAC7B,IAAI,MAAM;CACV,IAAI,QAAQ;CACZ,MAAM,UAAU,OAAgB,GAAG,KAAK,EAAE,KAAK,WAAW,GAAG,IAAI,YAAY,GAAG,CAAC,CAAC,MAAM,MAAM,EAAE,WAAW,GAAG,GAAG,EAAE,CAAC,IAAI,KAAA;CACxH,MAAM,QAAuB,OAAO;EAClC,MAAM,OAAO,O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,oBAAoB,OAAO,OAAO,KAAK,CAAC,CAAC,KAAK,IAAI,IAAI,GAAG,EAAE,QAAQ,IAAI,CAAC;IAC/H,MAAM,OAAO,IAAI,WAAW,MAAM,IAAI,YAAY,CAAC;IACnD,IAAI,KAAK,eAAe,GAAG,OAAO,SAAS,KAAK,EAAE,SAAS,+CAA+C,GAAG,EAAE,QAAQ,IAAI,CAAC;IAC5H,IAAI,KAAK,aAAa,KAAK,OAAO,SAAS,KAAK,EAAE,SAAS,oBAAoB,MAAM,OAAO,KAAK,aAAa,GAAG,EAAE,QAAQ,IAAI,CAAC;IAChI,OAAO,SAAS,KAAK,EAAE,IAAI,SAAS,MAAM,GAAG,EAAE,CAAC;GAClD;GAEA,OAAO,QAAQ;IACb,MAAM,QAAQ,KAAK,IAAI,IAAI,IAAI,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE;IACpE,IAAI,UAAU,KAAA,GAAW,OAAO,IAAI,SAAS,sCAAsC,EAAE,QAAQ,IAAI,CAAC;IAClG,OAAO,IAAI,SAAS,MAAM,MAAM,EAAE,SAAS;KAAE,gBAAgB,MAAM;KAAM,iBAAiB;IAAW,EAAE,CAAC;GAC1G;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `deictic/webpack`: deictic in webpack's dev server, or Rspack's (`@rspack/core` takes the same
|
|
3
|
+
* plugin). Nothing runs out of development mode.
|
|
4
|
+
*
|
|
5
|
+
* A loader (`loader.ts`) runs `pre` on the project's JSX modules, marking each host element with its
|
|
6
|
+
* place in the source as written, and in a build for the browser appending the import of the client
|
|
7
|
+
* module, which webpack has no virtual module for, so it's written to `.deictic/client.js`. The
|
|
8
|
+
* endpoints go in front of the dev server's own middleware (`devServer.setupMiddlewares`, which
|
|
9
|
+
* webpack-dev-server and Rspack's both read), and a place opens with `launch-editor`, as webpack has no
|
|
10
|
+
* launcher of its own. Where the dev server is started by hand, or by Rsbuild, `middleware` is the
|
|
11
|
+
* endpoints to mount there.
|
|
12
|
+
*/
|
|
13
|
+
import { IncomingMessage, ServerResponse } from "node:http";
|
|
14
|
+
import { t as DeicticOptions } from "./shared/integration.js";
|
|
15
|
+
export interface DeicticWebpackOptions extends DeicticOptions {
|
|
16
|
+
/** The project's root, which marks and edits are from: the compiler's `context` by default. */
|
|
17
|
+
root?: string;
|
|
18
|
+
/** The path the page is served under, ending in `/`: `/` by default. */
|
|
19
|
+
base?: string;
|
|
20
|
+
}
|
|
21
|
+
type Middleware = (req: IncomingMessage, res: ServerResponse, next: () => void) => void;
|
|
22
|
+
type Middlewares = ({
|
|
23
|
+
name: string;
|
|
24
|
+
middleware: Middleware;
|
|
25
|
+
} | Middleware)[];
|
|
26
|
+
/** What the plugin reads and sets of a webpack or Rspack compiler. */
|
|
27
|
+
interface Compiler {
|
|
28
|
+
context: string;
|
|
29
|
+
options: {
|
|
30
|
+
mode?: string;
|
|
31
|
+
target?: string | string[] | false;
|
|
32
|
+
module: {
|
|
33
|
+
rules: unknown[];
|
|
34
|
+
};
|
|
35
|
+
devServer?: {
|
|
36
|
+
setupMiddlewares?: (middlewares: Middlewares, server: unknown) => Middlewares;
|
|
37
|
+
} & Record<string, unknown>;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export declare class DeicticPlugin {
|
|
41
|
+
#private;
|
|
42
|
+
constructor(options?: DeicticWebpackOptions);
|
|
43
|
+
/** The endpoints as Node middleware, once the plugin is applied: for a dev server started by hand. */
|
|
44
|
+
get middleware(): Middleware;
|
|
45
|
+
apply(compiler: Compiler): void;
|
|
46
|
+
}
|
|
47
|
+
/** The plugin, as a function: `plugins: [deictic({ plugins: [tailwind()] })]`. */
|
|
48
|
+
export declare const deictic: (options?: DeicticWebpackOptions) => DeicticPlugin;
|
|
49
|
+
export { deictic as default };
|
|
50
|
+
//# sourceMappingURL=webpack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack.d.ts","names":[],"sources":["../src/webpack.ts"],"mappings":";;;;;;;;;;;;;;iBAsBiB,8BAA8B;;EAE7C;;EAEA;;KAGG,cAAc,KAAK,iBAAiB,KAAK,gBAAgB;KACzD;EAAiB;EAAc,YAAY;IAAe;;UAGrD;EACR;EACA;IACE;IACA;IACA;MAAU;;IACV;MAAc,oBAAoB,aAAa,aAAa,oBAAoB;QAAgB;;;qBAUvF;;EAOX,YAAY,UAAS;;MAOjB,cAAc;EAalB,MAAM,UAAU;;;qBA4BL,UAAO,UAAa,0BAAqB"}
|
package/dist/webpack.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { n as nodeMiddleware, t as endpoints } from "./shared/endpoints.js";
|
|
2
|
+
import { d as JSX, o as prepare, s as writeClient, t as beside } from "./shared/integration.js";
|
|
3
|
+
// src/tools/editor.ts
|
|
4
|
+
async function openInEditor(path, { line, column }) {
|
|
5
|
+
const launcher = await import("launch-editor").catch(() => void 0);
|
|
6
|
+
if (launcher === void 0) return new Response("deictic opens files with launch-editor here: add it to your devDependencies", { status: 501 });
|
|
7
|
+
return new Promise((done) => {
|
|
8
|
+
let failed = false;
|
|
9
|
+
launcher.default(`${path}:${line}:${column}`, (_, message) => {
|
|
10
|
+
failed = true;
|
|
11
|
+
done(new Response(`${message ?? "the editor didn't open"}: set EDITOR to your editor's command`, { status: 500 }));
|
|
12
|
+
});
|
|
13
|
+
setTimeout(() => failed || done(new Response(null, { status: 204 })), 50);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
// src/webpack.ts
|
|
17
|
+
const loaderPath = beside(import.meta.url, "loader");
|
|
18
|
+
/** Whether a target runs in a browser: webpack's default does, as do `web` and `browserslist`; Node's and Electron's main don't. */
|
|
19
|
+
const forBrowser = (target) => target === void 0 || [target].flat().some((t) => t !== false && !/^(async-)?node|^electron-main|^electron-preload/.test(t));
|
|
20
|
+
var DeicticPlugin = class {
|
|
21
|
+
#options;
|
|
22
|
+
#plugins;
|
|
23
|
+
#shortcut;
|
|
24
|
+
#middleware;
|
|
25
|
+
#root = "";
|
|
26
|
+
constructor(options = {}) {
|
|
27
|
+
this.#options = options;
|
|
28
|
+
({plugins: this.#plugins, shortcut: this.#shortcut} = prepare(options));
|
|
29
|
+
}
|
|
30
|
+
/** The endpoints as Node middleware, once the plugin is applied: for a dev server started by hand. */
|
|
31
|
+
get middleware() {
|
|
32
|
+
if (this.#middleware !== void 0) return this.#middleware;
|
|
33
|
+
if (this.#root === "") throw new Error("deictic: give the plugin to the compiler before mounting its middleware");
|
|
34
|
+
const root = this.#root;
|
|
35
|
+
const handle = endpoints({
|
|
36
|
+
root,
|
|
37
|
+
plugins: this.#plugins,
|
|
38
|
+
base: this.#options.base ?? "/",
|
|
39
|
+
open: (path, loc) => openInEditor(path, loc)
|
|
40
|
+
});
|
|
41
|
+
return this.#middleware = nodeMiddleware(handle);
|
|
42
|
+
}
|
|
43
|
+
apply(compiler) {
|
|
44
|
+
if (compiler.options.mode !== "development") return;
|
|
45
|
+
this.#root = this.#options.root ?? compiler.context;
|
|
46
|
+
const browser = forBrowser(compiler.options.target);
|
|
47
|
+
const client = browser ? writeClient(this.#root, this.#plugins, this.#options.base ?? "/", this.#shortcut) : void 0;
|
|
48
|
+
const options = {
|
|
49
|
+
root: this.#root,
|
|
50
|
+
...client === void 0 ? {} : { client }
|
|
51
|
+
};
|
|
52
|
+
compiler.options.module.rules.unshift({
|
|
53
|
+
test: JSX,
|
|
54
|
+
exclude: /[\\/]node_modules[\\/]/,
|
|
55
|
+
enforce: "pre",
|
|
56
|
+
use: [{
|
|
57
|
+
loader: loaderPath,
|
|
58
|
+
options
|
|
59
|
+
}]
|
|
60
|
+
});
|
|
61
|
+
if (!browser) return;
|
|
62
|
+
const devServer = compiler.options.devServer ??= {};
|
|
63
|
+
const theirs = devServer.setupMiddlewares;
|
|
64
|
+
devServer.setupMiddlewares = (middlewares, server) => {
|
|
65
|
+
const all = theirs === void 0 ? middlewares : theirs(middlewares, server);
|
|
66
|
+
all.unshift({
|
|
67
|
+
name: "deictic",
|
|
68
|
+
middleware: this.middleware
|
|
69
|
+
});
|
|
70
|
+
return all;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
/** The plugin, as a function: `plugins: [deictic({ plugins: [tailwind()] })]`. */
|
|
75
|
+
const deictic = (options = {}) => new DeicticPlugin(options);
|
|
76
|
+
export { DeicticPlugin, deictic as default, deictic };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=webpack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack.js","names":[],"sources":["../src/tools/editor.ts","../src/webpack.ts"],"sourcesContent":["/**\n * Opens a place in the editor, for a dev server without a launcher of its own (webpack's, Rspack's):\n * `launch-editor`, which Vite's own launcher uses, finds the editor that's running or the one `EDITOR`\n * names. An optional peer, imported when first asked.\n */\n\nimport type { Loc } from '#src/index.ts';\n\nexport async function openInEditor(path: string, { line, column }: Loc): Promise<Response> {\n const launcher = await import('launch-editor').catch(() => undefined);\n if (launcher === undefined)\n return new Response('deictic opens files with launch-editor here: add it to your devDependencies', { status: 501 });\n return new Promise((done) => {\n let failed = false;\n launcher.default(`${path}:${line}:${column}`, (_, message) => {\n failed = true;\n done(new Response(`${message ?? \"the editor didn't open\"}: set EDITOR to your editor's command`, { status: 500 }));\n });\n // launch-editor reports a failure as it happens, and nothing on success.\n setTimeout(() => failed || done(new Response(null, { status: 204 })), 50);\n });\n}\n","/**\n * `deictic/webpack`: deictic in webpack's dev server, or Rspack's (`@rspack/core` takes the same\n * plugin). Nothing runs out of development mode.\n *\n * A loader (`loader.ts`) runs `pre` on the project's JSX modules, marking each host element with its\n * place in the source as written, and in a build for the browser appending the import of the client\n * module, which webpack has no virtual module for, so it's written to `.deictic/client.js`. The\n * endpoints go in front of the dev server's own middleware (`devServer.setupMiddlewares`, which\n * webpack-dev-server and Rspack's both read), and a place opens with `launch-editor`, as webpack has no\n * launcher of its own. Where the dev server is started by hand, or by Rsbuild, `middleware` is the\n * endpoints to mount there.\n */\nimport type { IncomingMessage, ServerResponse } from 'node:http';\n\nimport type { ServerPlugin } from './index.ts';\nimport type { LoaderOptions } from './loader.ts';\nimport type { Shortcut } from './shortcut.ts';\nimport { openInEditor } from './tools/editor.ts';\nimport { endpoints, nodeMiddleware } from './tools/endpoints.ts';\nimport { beside, type DeicticOptions, prepare, writeClient } from './tools/integration.ts';\nimport { JSX } from './tools/locate.ts';\n\nexport interface DeicticWebpackOptions extends DeicticOptions {\n /** The project's root, which marks and edits are from: the compiler's `context` by default. */\n root?: string;\n /** The path the page is served under, ending in `/`: `/` by default. */\n base?: string;\n}\n\ntype Middleware = (req: IncomingMessage, res: ServerResponse, next: () => void) => void;\ntype Middlewares = ({ name: string; middleware: Middleware } | Middleware)[];\n\n/** What the plugin reads and sets of a webpack or Rspack compiler. */\ninterface Compiler {\n context: string;\n options: {\n mode?: string;\n target?: string | string[] | false;\n module: { rules: unknown[] };\n devServer?: { setupMiddlewares?: (middlewares: Middlewares, server: unknown) => Middlewares } & Record<string, unknown>;\n };\n}\n\nconst loaderPath = beside(import.meta.url, 'loader');\n\n/** Whether a target runs in a browser: webpack's default does, as do `web` and `browserslist`; Node's and Electron's main don't. */\nconst forBrowser = (target: Compiler['options']['target']) =>\n target === undefined || [target].flat().some((t) => t !== false && !/^(async-)?node|^electron-main|^electron-preload/.test(t));\n\nexport class DeicticPlugin {\n readonly #options: DeicticWebpackOptions;\n readonly #plugins: ServerPlugin[];\n readonly #shortcut: Shortcut | false | undefined;\n #middleware: Middleware | undefined;\n #root = '';\n\n constructor(options: DeicticWebpackOptions = {}) {\n this.#options = options;\n // Now, so a wrong set of plugins stops the dev server as it starts, rather than the page.\n ({ plugins: this.#plugins, shortcut: this.#shortcut } = prepare(options));\n }\n\n /** The endpoints as Node middleware, once the plugin is applied: for a dev server started by hand. */\n get middleware(): Middleware {\n if (this.#middleware !== undefined) return this.#middleware;\n if (this.#root === '') throw new Error('deictic: give the plugin to the compiler before mounting its middleware');\n const root = this.#root;\n const handle = endpoints({\n root,\n plugins: this.#plugins,\n base: this.#options.base ?? '/',\n open: (path, loc) => openInEditor(path, loc),\n });\n return (this.#middleware = nodeMiddleware(handle));\n }\n\n apply(compiler: Compiler): void {\n // Development only: a build without a mode is webpack's production one.\n if (compiler.options.mode !== 'development') return;\n this.#root = this.#options.root ?? compiler.context;\n const browser = forBrowser(compiler.options.target);\n const client = browser ? writeClient(this.#root, this.#plugins, this.#options.base ?? '/', this.#shortcut) : undefined;\n const options: LoaderOptions = { root: this.#root, ...(client === undefined ? {} : { client }) };\n // First, and `pre`, so it sees the source as written whatever the app's own rules do.\n compiler.options.module.rules.unshift({\n test: JSX,\n exclude: /[\\\\/]node_modules[\\\\/]/,\n enforce: 'pre',\n use: [{ loader: loaderPath, options }],\n });\n if (!browser) return;\n\n const devServer = (compiler.options.devServer ??= {});\n const theirs = devServer.setupMiddlewares;\n devServer.setupMiddlewares = (middlewares, server) => {\n const all = theirs === undefined ? middlewares : theirs(middlewares, server);\n // In front of the dev server's own, which would answer `/__deictic/` with the page or a 404.\n all.unshift({ name: 'deictic', middleware: this.middleware });\n return all;\n };\n }\n}\n\n/** The plugin, as a function: `plugins: [deictic({ plugins: [tailwind()] })]`. */\nexport const deictic = (options: DeicticWebpackOptions = {}) => new DeicticPlugin(options);\n\nexport default deictic;\n"],"mappings":";;;AAQA,eAAsB,aAAa,MAAc,EAAE,MAAM,UAAkC;CACzF,MAAM,WAAW,MAAM,OAAO,gBAAgB,CAAC,YAAY,KAAA,CAAS;CACpE,IAAI,aAAa,KAAA,GACf,OAAO,IAAI,SAAS,+EAA+E,EAAE,QAAQ,IAAI,CAAC;CACpH,OAAO,IAAI,SAAS,SAAS;EAC3B,IAAI,SAAS;EACb,SAAS,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,WAAW,GAAG,YAAY;GAC5D,SAAS;GACT,KAAK,IAAI,SAAS,GAAG,W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