deictic 0.5.0 → 0.6.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/plugins/tailwind/catalog.ts","../../src/plugins/tailwind/index.ts"],"sourcesContent":["/**\n * What the project's Tailwind knows, for the panel: every class it can make (to complete what's typed), what\n * each one sets (a colour to show, a value to hint), the classes of the same kind (to switch between), and a\n * class's CSS (to preview one no file uses yet).\n *\n * All of it comes from Tailwind's own design system, loaded from the project (v4, through `@tailwindcss/node`,\n * which every v4 integration brings), so the theme is the project's. Two classes are of a kind when they set the\n * same properties: `text-sm` and `text-lg`, `flex` and `grid`, but not `text-sm` and `text-red-500`.\n */\nimport { readFileSync, statSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { dirname, join, resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\n/** A class as the panel shows it. */\nexport interface ClassInfo {\n name: string;\n /** Whether Tailwind makes anything of it: a class of the project's own isn't known. */\n known: boolean;\n /** The colour it sets, as CSS. */\n color?: string;\n /** What it sets its main property to, theme values resolved: `0.875rem`. */\n value?: string;\n /** A variant to go on typing after (`hover:`), not a class. */\n variant?: true;\n}\n\n/** The classes of one kind, and how to write one with a value of the user's own. */\nexport interface Alternatives {\n /** The property the kind sets: `font-size`. */\n label: string;\n /** Whether the kind is a colour's, shown as swatches. */\n colors: boolean;\n items: ClassInfo[];\n /** A custom value goes between these: `md:text-[` and `]`. None for a kind that takes no value (`flex`). */\n custom?: { before: string; after: string; value?: string };\n}\n\nexport interface Catalog {\n /** Classes for what's typed, the best first: those starting with it, variants, then those holding it. */\n complete(query: string, limit?: number): ClassInfo[];\n info(classes: string[]): ClassInfo[];\n alternatives(name: string): Alternatives | undefined;\n /** CSS for the classes, in Tailwind's order, theme values written out: for a page whose build hasn't seen them. */\n css(classes: string[]): string;\n}\n\n/** The part of Tailwind's design system used here. Unstable there, so everything read from it is checked. */\ninterface DesignSystem {\n getClassList(): [string, { modifiers?: string[] }][];\n getVariants(): { name: string; values: string[]; hasDash: boolean }[];\n candidatesToCss(classes: string[]): (string | null)[];\n parseCandidate(candidate: string): Iterable<{ kind: string; root?: string; value?: { kind: string; value: string } | null }>;\n resolveThemeValue(path: string): string | undefined;\n getClassOrder(classes: string[]): [string, bigint | null][];\n}\n\ninterface Entry {\n name: string;\n /** The kind: the properties it sets, sorted. */\n kind: string;\n color?: string;\n value?: string;\n}\n\n/** Packages that depend on `@tailwindcss/node`, where the project doesn't itself. */\nconst VIA = ['@tailwindcss/vite', '@tailwindcss/postcss', '@tailwindcss/cli', '@tailwindcss/webpack'];\nconst MOST = 400;\nconst natural = new Intl.Collator('en', { numeric: true }).compare;\n\n/**\n * The catalog of the project at `root`, from its stylesheet (`css`, from the root: the one that imports\n * Tailwind and holds the theme), or from Tailwind's defaults without one. Read again when that file changes.\n * Rejects where the project has no Tailwind v4.\n */\nexport async function loadCatalog(root: string, css?: string): Promise<Catalog> {\n const { __unstable__loadDesignSystem: load } = await tailwindOf(root);\n const file = css === undefined ? undefined : resolve(root, css);\n const build = async () =>\n catalogOf(\n file === undefined\n ? await load('@import \"tailwindcss\";', { base: root })\n : await load(readFileSync(file, 'utf8'), { base: dirname(file) }),\n );\n const stamp = () => (file === undefined ? 0 : statSync(file).mtimeMs);\n let built = stamp();\n let current = await build();\n // The latest build, rebuilt when the stylesheet changed since. One that fails (a file half-saved) keeps the last.\n const latest = (): Catalog => {\n const now = stamp();\n if (now !== built) {\n built = now;\n void build().then(\n (next) => (current = next),\n () => {},\n );\n }\n return current;\n };\n return {\n complete: (query, limit) => latest().complete(query, limit),\n info: (classes) => latest().info(classes),\n alternatives: (name) => latest().alternatives(name),\n css: (classes) => latest().css(classes),\n };\n}\n\ntype Loader = (css: string, options: { base: string }) => Promise<DesignSystem>;\n\nasync function tailwindOf(root: string): Promise<{ __unstable__loadDesignSystem: Loader }> {\n const from = createRequire(join(root, 'package.json'));\n const found = [\n () => from.resolve('@tailwindcss/node'),\n ...VIA.map((via) => () => createRequire(from.resolve(via)).resolve('@tailwindcss/node')),\n ];\n for (const find of found) {\n let path: string;\n try {\n path = find();\n } catch {\n continue;\n }\n const module = (await import(pathToFileURL(path).href)) as { __unstable__loadDesignSystem?: Loader };\n if (typeof module.__unstable__loadDesignSystem === 'function')\n return { __unstable__loadDesignSystem: module.__unstable__loadDesignSystem };\n }\n throw new Error(`no Tailwind v4 in ${root}: install @tailwindcss/node there (or one of ${VIA.join(', ')})`);\n}\n\nexport function catalogOf(design: DesignSystem): Catalog {\n /** A value with the theme's variables written out, and what arithmetic is left done: `calc(var(--spacing) * 4)` is `1rem`. */\n const resolved = (value: string): string => {\n let now = value;\n for (let i = 0; i < 4; i++) {\n const next = now.replace(/var\\((--[\\w-]+)\\)/g, (all, name: string) => themed(name) ?? all);\n if (next === now) break;\n now = next;\n }\n return now.replace(/calc\\(([^()]+)\\)/g, (all, sum: string) => computed(sum) ?? all);\n };\n const themed = (name: string): string | undefined => {\n try {\n return design.resolveThemeValue(name) ?? undefined;\n } catch {\n return undefined;\n }\n };\n\n const entryOf = (name: string, css: string): Entry => {\n const set = declarations(css);\n const kind = [...new Set(set.map(([property]) => property))].toSorted().join(',');\n const color = set.findLast(([property, value]) => COLOR.test(property) && !NO_COLOR.test(value))?.[1];\n const main = (set.find(([property]) => !property.startsWith('--')) ?? set[0])?.[1];\n return {\n name,\n kind,\n ...(color === undefined ? {} : { color: resolved(color) }),\n ...(main === undefined ? {} : { value: resolved(main) }),\n };\n };\n\n const names = design\n .getClassList()\n .map(([name]) => name)\n .toSorted(natural);\n const modifiers = new Map(design.getClassList().map(([name, { modifiers = [] }]) => [name, modifiers]));\n const sheets = design.candidatesToCss(names);\n const byName = new Map<string, Entry>();\n const kinds = new Map<string, Entry[]>();\n names.forEach((name, i) => {\n const css = sheets[i];\n if (css === null || css === undefined) return;\n const entry = entryOf(name, css);\n if (entry.kind === '') return;\n byName.set(name, entry);\n const kind = kinds.get(entry.kind);\n if (kind === undefined) kinds.set(entry.kind, [entry]);\n else kind.push(entry);\n });\n for (const kind of kinds.values()) kind.sort(byValue(kind));\n\n const variants = design\n .getVariants()\n .flatMap(({ name, values, hasDash }) => [name, ...values.map((value) => `${name}${hasDash ? '-' : ''}${value}`)])\n // `*` and `**` are variants too, and so are those that only take a value in brackets: neither completes a word.\n .filter((name) => /^[@\\w]/.test(name))\n .toSorted(natural);\n\n /** A class Tailwind makes on asking, not in its list: one with a value in brackets, a modifier, a fraction. */\n const made = new Map<string, Entry | undefined>();\n const make = (body: string): Entry | undefined => {\n if (made.has(body)) return made.get(body);\n const css = design.candidatesToCss([body])[0];\n const entry = css === null || css === undefined ? undefined : entryOf(body, css);\n made.set(body, entry?.kind === '' ? undefined : entry);\n return made.get(body);\n };\n const rootOf = (body: string): string | undefined => {\n for (const candidate of design.parseCandidate(body))\n if (candidate.kind === 'functional' && candidate.root !== undefined && candidate.value) return candidate.root;\n return undefined;\n };\n /** The entry of a class's own part (no variants, no `!`), and the kind it's of among the listed ones. */\n const find = (body: string): { entry: Entry; kind: string } | undefined => {\n const listed = byName.get(body);\n if (listed !== undefined) return { entry: listed, kind: listed.kind };\n const entry = make(body);\n if (entry === undefined) return undefined;\n if (kinds.has(entry.kind)) return { entry, kind: entry.kind };\n // `text-[13px]` sets the size alone, `text-sm` the line height too: the kind is the nearest one of its root's.\n const root = rootOf(body);\n if (root === undefined) return { entry, kind: entry.kind };\n const own = new Set(entry.kind.split(','));\n let best: { kind: string; shared: number } | undefined;\n for (const name of names) {\n if (!name.startsWith(`${root}-`)) continue;\n const kind = byName.get(name)?.kind;\n if (kind === undefined || kind === best?.kind) continue;\n const shared = kind.split(',').filter((property) => own.has(property)).length;\n if (shared > (best?.shared ?? 0)) best = { kind, shared };\n }\n return { entry, kind: best?.kind ?? entry.kind };\n };\n const shown = (name: string, entry: Entry): ClassInfo => ({\n name,\n known: true,\n ...(entry.color === undefined ? {} : { color: entry.color }),\n ...(entry.value === undefined ? {} : { value: entry.value }),\n });\n const info = (name: string): ClassInfo => {\n const found = find(parts(name).body);\n return found === undefined ? { name, known: false } : shown(name, found.entry);\n };\n\n return {\n complete(query, limit = 40) {\n const { before: variantsBefore, bang, body, after } = parts(query.trim());\n if (body === '' && variantsBefore === '') return [];\n const before = `${variantsBefore}${bang}`;\n const starts: ClassInfo[] = [];\n const holds: ClassInfo[] = [];\n const add = (to: ClassInfo[], name: string, entry: Entry) => {\n if (to.length < limit) to.push(shown(`${before}${name}${after}`, entry));\n };\n const exact = byName.get(body);\n if (exact !== undefined) add(starts, body, exact);\n for (const name of names) {\n if (starts.length >= limit) break;\n if (name === body) continue;\n const entry = byName.get(name);\n if (entry === undefined) continue;\n if (name.startsWith(body)) add(starts, name, entry);\n else if (body.length > 1 && name.includes(body)) add(holds, name, entry);\n }\n // `bg-red-500/`: the modifiers the class takes.\n const slash = body.lastIndexOf('/');\n const base = slash < 0 ? undefined : byName.get(body.slice(0, slash));\n const modified =\n base === undefined || starts.length > 0\n ? []\n : (modifiers.get(base.name) ?? [])\n .filter((modifier) => modifier.startsWith(body.slice(slash + 1)))\n .map((modifier) => shown(`${before}${base.name}/${modifier}${after}`, make(`${base.name}/${modifier}`) ?? base));\n const ahead =\n after !== '' || bang !== '' || body === ''\n ? []\n : variants\n .filter((name) => name.startsWith(body))\n .map((name): ClassInfo => ({ name: `${before}${name}:`, known: true, variant: true }));\n return [...starts, ...modified, ...ahead, ...holds].slice(0, limit);\n },\n info: (classes) => classes.map(info),\n alternatives(name) {\n const { before, bang, body, after } = parts(name);\n const found = find(body);\n if (found === undefined) return undefined;\n const { modifier, base } = modified(body, byName);\n const kind = kinds.get(found.kind) ?? [];\n const properties = found.kind.split(',');\n const root = rootOf(body);\n const value = [...design.parseCandidate(body)].find((candidate) => candidate.value?.kind === 'arbitrary')?.value?.value;\n const items = kind.slice(0, MOST).map((entry) => shown(`${before}${bang}${entry.name}${modifier}${after}`, entry));\n // The class itself where it isn't listed (its value is its own), so the panel has it to show as chosen.\n if (!kind.some((entry) => entry.name === base)) items.unshift(shown(name, found.entry));\n return {\n label: properties.find((property) => !property.startsWith('--')) ?? properties[0]!,\n colors: kind.filter((entry) => entry.color !== undefined).length * 2 > kind.length,\n items,\n ...(root === undefined\n ? {}\n : { custom: { before: `${before}${bang}${root}-[`, after: `]${modifier}${after}`, ...(value === undefined ? {} : { value }) } }),\n };\n },\n css(classes) {\n const bodies = [...new Set(classes)];\n const order = new Map(design.getClassOrder(bodies));\n bodies.sort((a, b) => {\n const [x, y] = [order.get(a) ?? null, order.get(b) ?? null];\n if (x === null || y === null) return x === y ? 0 : x === null ? 1 : -1;\n return x < y ? -1 : x > y ? 1 : 0;\n });\n const properties = new Set<string>();\n const rules = design\n .candidatesToCss(bodies)\n .filter((css) => css !== null && css !== undefined)\n // `@property` can't sit in a layer, so each is lifted out, once.\n .map((css) =>\n css.replace(PROPERTY, (rule) => {\n properties.add(rule.trim());\n return '';\n }),\n )\n .join('');\n if (rules.trim() === '') return '';\n // In the layer the page's own utilities are in, so what beats them there (the page's unlayered CSS) beats these.\n return `${[...properties].join('\\n')}\\n@layer utilities {\\n${rules.replace(/var\\((--[\\w-]+)\\)/g, (all, name: string) => themed(name) ?? all)}}\\n`;\n },\n };\n}\n\nconst COLOR = /(^|-)color$|^fill$|^stroke$|^--tw-gradient-(from|via|to)$/;\nconst NO_COLOR = /^(inherit|none|initial|unset)$/;\nconst PROPERTY = /@property [^{]+\\{[^}]*\\}\\n?/g;\n\n/** A rule's declarations, in order, from Tailwind's CSS for one class: one a line, `@property` rules after. */\nfunction declarations(css: string): [property: string, value: string][] {\n const rules = css.replace(PROPERTY, '');\n return [...rules.matchAll(/^\\s+(-{0,2}[\\w-]+):\\s*(.+?)(?:\\s*!important)?;$/gm)].map((match) => [match[1]!, match[2]!]);\n}\n\n/** `0.25rem * 4` as `1rem`: products and quotients of numbers with one unit between them. Anything else is left. */\nfunction computed(sum: string): string | undefined {\n const tokens = sum.trim().split(/\\s+/);\n let total = 1;\n let unit = '';\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i]!;\n if (i % 2 === 1) {\n if (token !== '*' && token !== '/') return undefined;\n continue;\n }\n const match = /^(-?(?:\\d+\\.?\\d*|\\.\\d+))(%|[a-z]+)?$/.exec(token);\n if (match === null) return undefined;\n const divides = tokens[i - 1] === '/';\n if (match[2] !== undefined && (unit !== '' || divides)) return undefined;\n unit = match[2] ?? unit;\n total = divides ? total / Number(match[1]) : total * Number(match[1]);\n }\n if (tokens.length % 2 === 0 || !Number.isFinite(total)) return undefined;\n return `${Number(total.toFixed(4))}${unit}`;\n}\n\n/** A length as a number to order by, where the value is one: `1rem` is 16. */\nfunction measure(value: string | undefined): number | undefined {\n const match = value === undefined ? null : /^(-?(?:\\d+\\.?\\d*|\\.\\d+))(px|rem|em|%)?$/.exec(value);\n if (match === null) return undefined;\n return Number(match[1]) * (match[2] === 'rem' || match[2] === 'em' ? 16 : 1);\n}\n\n/** A kind's order: by size where most of it has one (`text-xs` before `text-sm`), by name else, as it already is. */\nfunction byValue(kind: Entry[]): (a: Entry, b: Entry) => number {\n const sizes = new Map(kind.map((entry) => [entry, measure(entry.value)]));\n const sized = [...sizes.values()].filter((size) => size !== undefined).length;\n if (sized * 10 < kind.length * 7) return () => 0;\n return (a, b) => {\n const [x, y] = [sizes.get(a), sizes.get(b)];\n if (x === undefined || y === undefined) return x === y ? 0 : x === undefined ? 1 : -1;\n return x - y;\n };\n}\n\n/**\n * A class as written, apart: its variants (`md:hover:`), `!` where it leads, its own part, and `!` where it\n * trails. A `:` inside brackets or parentheses is the value's.\n */\nfunction parts(name: string): { before: string; bang: string; body: string; after: string } {\n let depth = 0;\n let cut = 0;\n for (let i = 0; i < name.length; i++) {\n const char = name[i]!;\n if (char === '[' || char === '(') depth++;\n else if (char === ']' || char === ')') depth--;\n else if (char === ':' && depth === 0) cut = i + 1;\n }\n const own = name.slice(cut);\n const bang = own.startsWith('!') ? '!' : '';\n const after = !bang && own.endsWith('!') ? '!' : '';\n return { before: name.slice(0, cut), bang, body: own.slice(bang.length, own.length - after.length), after };\n}\n\n/** A class's modifier (`/50`) and what it's on, where the whole isn't a class itself, as `w-1/2` is. */\nfunction modified(body: string, listed: Map<string, unknown>): { base: string; modifier: string } {\n const slash = body.lastIndexOf('/');\n if (listed.has(body) || slash < 0 || body.indexOf(']', slash) >= 0) return { base: body, modifier: '' };\n return { base: body.slice(0, slash), modifier: body.slice(slash) };\n}\n","/**\n * `deictic/tailwind`: open its tab on an element to edit its classes, written to its `className`.\n *\n * Only a list the source spells out can be edited: `className=\"…\"`, `className={'…'}`, a template\n * with no `${}`, or the first argument of a class helper (`cn('…', active && '…')`), whose other\n * arguments stay as they are. A list built any other way is shown, not edited, since there is no one\n * place for a class to go. An element without the attribute gets one.\n *\n * Its routes answer the panel from the project's own Tailwind (`catalog.ts`): what completes a word typed\n * (`complete`), what each class sets (`info`), the classes of a class's kind (`alternatives`) and the CSS of\n * classes the page's build hasn't seen (`css`). Without Tailwind v4 they answer nothing, and the panel is plain.\n */\nimport type { Argument, Expression, JSXAttribute, JSXOpeningElement, Program } from 'oxc-parser';\n\nimport { definePlugin, Refusal, type ServerContext, type Shortcut } from '#src/index.ts';\n\nimport { type Catalog, loadCatalog } from './catalog.ts';\n\nexport type { Alternatives, ClassInfo } from './catalog.ts';\n\nexport interface TailwindOptions {\n /** Calls whose first argument is a class list: `cn`, `clsx`, `cx`, `twMerge`, `classNames` by default. */\n helpers?: string[];\n /** The attribute an element without one gets: `className`, or `class` for Solid and Preact. */\n attribute?: 'className' | 'class';\n /**\n * The stylesheet that imports Tailwind and holds the theme, from the project's root: `src/index.css`. What\n * the panel completes and shows comes from it. Tailwind's default theme without one.\n */\n css?: string;\n /** What opens its tab directly, beside deictic's own shortcut, which opens any: none by default. */\n shortcut?: Shortcut;\n}\n\nexport type Model =\n | {\n editable: true;\n classes: string;\n /** The helper's other arguments, which add classes at runtime, each read as far as the source says. */\n others?: Extra[];\n }\n | { editable: false; source: string };\n\n/** Classes a helper's argument adds: `active && 'ring'` is `ring` when `active`. */\nexport interface Extra {\n /** The argument, or the part of it these classes come from, as written. */\n source: string;\n /** The classes, where the source spells them out: there, or in a `const` of the file it names. */\n classes?: string;\n /** What must hold for them to be added, as written: `active === 'h3'`. None where they always are. */\n when?: string;\n /** Set where the classes are a string in this file, which an op with `at` can write. */\n editable?: true;\n /** The `const` the string is in, where it isn't the argument itself: other elements may use it too. */\n shared?: string;\n}\n\nexport interface Op {\n classes: string;\n /** Which of the model's `others` the classes are for, by its place there. The element's own list without. */\n at?: number;\n}\n\n/** Where a class list sits in the source: the text between its quotes, or where a missing attribute goes. */\ntype List = { kind: 'list'; start: number; end: number; quote: string; others?: Argument[] };\ntype Spot = List | { kind: 'missing'; at: number } | { kind: 'fixed'; source: string };\n\nconst HELPERS = ['cn', 'clsx', 'cx', 'twMerge', 'classNames'];\n\nexport function tailwind(options: TailwindOptions = {}) {\n const helpers = new Set(options.helpers ?? HELPERS);\n const attribute = options.attribute ?? 'className';\n // Loaded on the first ask, as it takes a moment, and once: a project without Tailwind v4 has none.\n let loading: Promise<Catalog | undefined> | undefined;\n const catalog = ({ root }: ServerContext) =>\n (loading ??= loadCatalog(root, options.css).catch((problem: unknown) => {\n console.warn(`deictic/tailwind: no completions or class details, as ${problem instanceof Error ? problem.message : String(problem)}`);\n return undefined;\n }));\n const asked = async (request: Request): Promise<string[]> => {\n const body = (await request.json().catch(() => undefined)) as { classes?: unknown } | undefined;\n return Array.isArray(body?.classes) ? body.classes.filter((c): c is string => typeof c === 'string').slice(0, 500) : [];\n };\n return definePlugin<Model, Op>({\n name: 'tailwind',\n client: 'deictic/tailwind/client',\n shortcut: options.shortcut,\n routes: {\n // `complete?q=fle`: the classes for a word being typed.\n complete: async (request, context) => {\n const query = new URL(request.url).searchParams.get('q') ?? '';\n return Response.json({ items: (await catalog(context))?.complete(query) ?? [] });\n },\n // What each of `classes` sets. `available` is false where there's no catalog, so the panel stops asking.\n info: async (request, context) => {\n const known = await catalog(context);\n return Response.json({ available: known !== undefined, items: known?.info(await asked(request)) ?? [] });\n },\n // `alternatives?class=text-sm`: the classes of its kind, or nothing for one Tailwind doesn't know.\n alternatives: async (request, context) => {\n const name = new URL(request.url).searchParams.get('class') ?? '';\n return Response.json((await catalog(context))?.alternatives(name) ?? null);\n },\n css: async (request, context) => Response.json({ css: (await catalog(context))?.css(await asked(request)) ?? '' }),\n },\n read({ code, element, program }) {\n const spot = spotOf(element, code, helpers);\n if (spot.kind === 'fixed') return { editable: false, source: spot.source };\n if (spot.kind === 'missing') return { editable: true, classes: '' };\n const others = spot.others?.flatMap((argument) => extrasOf(argument, code, program)).map(({ spot: _, ...extra }) => extra);\n return { editable: true, classes: code.slice(spot.start, spot.end), ...(others === undefined ? {} : { others }) };\n },\n apply({ file, code, element, program }, _target, { classes, at }) {\n const list = classes.trim().split(/\\s+/).filter(Boolean).join(' ');\n const spot = spotOf(element, code, helpers);\n if (spot.kind === 'fixed') throw new Refusal('this class list is built at runtime: edit it in the editor');\n if (at !== undefined) {\n const others = spot.kind === 'list' ? (spot.others ?? []).flatMap((argument) => extrasOf(argument, code, program)) : [];\n const place = others[at]?.spot;\n if (place === undefined)\n throw new Refusal(\"these classes aren't a string in this file any more: reload, or edit them in the editor\");\n return [{ start: place.start, end: place.end, text: quoted(list, place.quote) }];\n }\n // An `.astro` component writes `class`, whatever the JSX beside it does.\n const name = file.endsWith('.astro') ? 'class' : attribute;\n if (spot.kind === 'missing') return list === '' ? [] : [{ start: spot.at, end: spot.at, text: ` ${name}=\"${quoted(list, '\"')}\"` }];\n return [{ start: spot.start, end: spot.end, text: quoted(list, spot.quote) }];\n },\n describe({ classes, at }, before) {\n if (!before.editable) return 'classes';\n if (at === undefined) return diff(before.classes, classes);\n const other = before.others?.[at];\n return `${diff(other?.classes ?? '', classes)}${other?.when === undefined ? '' : ` when ${other.when}`}`;\n },\n });\n}\n\nfunction spotOf(element: JSXOpeningElement, code: string, helpers: Set<string>): Spot {\n const attr = element.attributes.find(\n (a): a is JSXAttribute =>\n a.type === 'JSXAttribute' && a.name.type === 'JSXIdentifier' && (a.name.name === 'className' || a.name.name === 'class'),\n );\n if (attr === undefined) {\n // Astro's `class:list` is the element's class list too: a `class` beside it would be a second one.\n const listed = element.attributes.find(\n (a) => a.type === 'JSXAttribute' && a.name.type === 'JSXIdentifier' && a.name.name === 'class:list',\n );\n return listed === undefined\n ? { kind: 'missing', at: element.name.end }\n : { kind: 'fixed', source: code.slice(listed.start, listed.end) };\n }\n const { value } = attr;\n if (value?.type === 'Literal') return list(value, code);\n if (value?.type !== 'JSXExpressionContainer' || value.expression.type === 'JSXEmptyExpression')\n return { kind: 'fixed', source: code.slice(attr.start, attr.end) };\n const e = value.expression;\n const whole = listIn(e, code);\n if (whole !== undefined) return whole;\n if (e.type === 'CallExpression' && e.callee.type === 'Identifier' && helpers.has(e.callee.name)) {\n const [first, ...others] = e.arguments;\n const head = first === undefined || first.type === 'SpreadElement' ? undefined : listIn(first, code);\n if (head !== undefined) return others.length === 0 ? head : { ...head, others };\n }\n return { kind: 'fixed', source: code.slice(attr.start, attr.end) };\n}\n\n/**\n * What one of a helper's arguments adds, and when: `on && 'ring'`, `on ? 'a' : 'b'`, `{ ring: on }`, a string,\n * or a name for one. Anything else is only its source, as nothing says what it adds.\n */\nfunction extrasOf(argument: Argument, code: string, program: Program): (Extra & { spot?: List })[] {\n const source = (node: { start: number; end: number }) => code.slice(node.start, node.end);\n const added = (e: { type: string; start: number; end: number }, when?: string, key = false): Extra & { spot?: List } => {\n const found = stringOf(e, program, !key);\n if (found === undefined) return { source: source(e), ...(when === undefined ? {} : { when }) };\n return {\n source: source(e),\n classes: found.value,\n ...(when === undefined ? {} : { when }),\n editable: true,\n ...(found.shared === undefined ? {} : { shared: found.shared }),\n spot: list(found.node, code),\n };\n };\n const e = argument;\n if (e.type === 'SpreadElement') return [{ source: source(e) }];\n if (e.type === 'LogicalExpression' && e.operator === '&&') return [added(e.right, source(e.left))];\n if (e.type === 'ConditionalExpression') {\n const test = source(e.test);\n const not = e.test.type === 'Identifier' ? `!${test}` : `!(${test})`;\n // A branch that adds nothing (`on ? 'ring' : undefined`) isn't one to show.\n return [added(e.consequent, test), added(e.alternate, not)].filter(\n (extra) => extra.classes !== '' && !/^(undefined|null|false)$/.test(extra.source),\n );\n }\n if (e.type === 'ObjectExpression') {\n return e.properties.map((property): Extra & { spot?: List } => {\n if (property.type !== 'Property' || property.computed) return { source: source(property) };\n const always = property.value.type === 'Literal' && property.value.value === true;\n const when = always ? {} : { when: source(property.value) };\n // A bare key (`ring`) is a class, but not a string to write a list into.\n if (property.key.type === 'Identifier') return { source: source(property), classes: property.key.name, ...when };\n const { source: _, ...key } = added(property.key, undefined, true);\n return key.classes === undefined ? { source: source(property) } : { source: source(property), ...key, ...when };\n });\n }\n return [added(e)];\n}\n\n/**\n * A string the source spells out, and where: a literal, a template with nothing interpolated, or a top-level\n * `const` of one (`shared`, its name).\n */\nfunction stringOf(\n e: { type: string },\n program: Program,\n named = true,\n): { value: string; node: { start: number; end: number }; shared?: string } | undefined {\n const node = e as Expression;\n if (node.type === 'Literal') return typeof node.value === 'string' ? { value: node.value, node } : undefined;\n if (node.type === 'TemplateLiteral') {\n const value = node.expressions.length === 0 ? node.quasis[0]?.value.cooked : undefined;\n return value === undefined || value === null ? undefined : { value, node };\n }\n if (node.type !== 'Identifier' || !named) return undefined;\n for (const statement of program.body) {\n const declared = statement.type === 'ExportNamedDeclaration' ? statement.declaration : statement;\n if (declared?.type !== 'VariableDeclaration' || declared.kind !== 'const') continue;\n for (const { id, init } of declared.declarations) {\n if (id.type !== 'Identifier' || id.name !== node.name || !init) continue;\n const found = stringOf(init, program, false);\n return found === undefined ? undefined : { ...found, shared: node.name };\n }\n }\n return undefined;\n}\n\n/** A string literal or a template with nothing interpolated, as the text between its quotes. */\nfunction listIn(e: Expression, code: string): List | undefined {\n if (e.type === 'Literal' && typeof e.value === 'string') return list(e, code);\n if (e.type === 'TemplateLiteral' && e.expressions.length === 0) return list(e, code);\n return undefined;\n}\n\nconst list = (node: { start: number; end: number }, code: string): List => ({\n kind: 'list',\n start: node.start + 1,\n end: node.end - 1,\n quote: code[node.start]!,\n});\n\n/** The list as it may sit between `quote`s. A JSX attribute has no escapes, so a quote of its own kind can't. */\nfunction quoted(list: string, quote: string): string {\n if (quote === '`') return list.replaceAll('\\\\', '\\\\\\\\').replaceAll('`', '\\\\`').replaceAll('${', '\\\\${');\n if (!list.includes(quote)) return list;\n throw new Refusal(`a class can't hold ${quote} here: use the other quote inside arbitrary values, as in content-['…']`);\n}\n\n/** What changed between two lists: `+ring -px-2`. */\nfunction diff(before: string, after: string): string {\n const was = new Set(before.split(/\\s+/).filter(Boolean));\n const now = new Set(after.split(/\\s+/).filter(Boolean));\n const parts = [...[...now].filter((c) => !was.has(c)).map((c) => `+${c}`), ...[...was].filter((c) => !now.has(c)).map((c) => `-${c}`)];\n return parts.length > 0 ? parts.join(' ') : 'reordered classes';\n}\n\nexport default tailwind;\n"],"mappings":";;;;;;;;;;;;;;;;AAkEA,MAAM,MAAM;CAAC;CAAqB;CAAwB;CAAoB;AAAsB;AACpG,MAAM,OAAO;AACb,MAAM,UAAU,IAAI,KAAK,SAAS,MAAM,EAAE,SAAS,KAAK,CAAC,CAAC,CAAC;;;;;;AAO3D,eAAsB,YAAY,MAAc,KAAgC;CAC9E,MAAM,EAAE,8BAA8B,SAAS,MAAM,WAAW,IAAI;CACpE,MAAM,OAAO,QAAQ,KAAA,IAAY,KAAA,IAAY,QAAQ,MAAM,GAAG;CAC9D,MAAM,QAAQ,YACZ,UACE,SAAS,KAAA,IACL,MAAM,KAAK,4BAA0B,EAAE,MAAM,KAAK,CAAC,IACnD,MAAM,KAAK,aAAa,MAAM,MAAM,GAAG,EAAE,MAAM,QAAQ,IAAI,EAAE,CAAC,CACpE;CACF,MAAM,cAAe,SAAS,KAAA,IAAY,IAAI,SAAS,IAAI,CAAC,CAAC;CAC7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AC,CAAC,CAAC,KAAK,MAAM,IAAI,GAAG,CAAC;CACrI,OAAO,MAAM,SAAS,IAAI,MAAM,KAAK,GAAG,IAAI;AAC9C"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/plugins/tailwind/catalog.ts","../../src/plugins/tailwind/index.ts"],"sourcesContent":["/**\n * What the project's Tailwind knows, for the panel: every class it can make (to complete what's typed), what\n * each one sets (a colour to show, a value to hint), the classes of the same kind (to switch between), and a\n * class's CSS (to preview one no file uses yet).\n *\n * All of it comes from Tailwind's own design system, loaded from the project (v4, through `@tailwindcss/node`,\n * which every v4 integration brings), so the theme is the project's. Two classes are of a kind when they set the\n * same properties: `text-sm` and `text-lg`, `flex` and `grid`, but not `text-sm` and `text-red-500`.\n */\nimport { readFileSync, statSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { dirname, join, resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\n/** A class as the panel shows it. */\nexport interface ClassInfo {\n name: string;\n /** Whether Tailwind makes anything of it: a class of the project's own isn't known. */\n known: boolean;\n /** The colour it sets, as CSS. */\n color?: string;\n /** What it sets its main property to, theme values resolved: `0.875rem`. */\n value?: string;\n /** A variant to go on typing after (`hover:`), not a class. */\n variant?: true;\n}\n\n/** The classes of one kind, and how to write one with a value of the user's own. */\nexport interface Alternatives {\n /** The property the kind sets: `font-size`. */\n label: string;\n /** Whether the kind is a colour's, shown as swatches. */\n colors: boolean;\n items: ClassInfo[];\n /** A custom value goes between these: `md:text-[` and `]`. None for a kind that takes no value (`flex`). */\n custom?: { before: string; after: string; value?: string };\n}\n\nexport interface Catalog {\n /** Classes for what's typed, the best first: those starting with it, variants, then those holding it. */\n complete(query: string, limit?: number): ClassInfo[];\n info(classes: string[]): ClassInfo[];\n alternatives(name: string): Alternatives | undefined;\n /** CSS for the classes, in Tailwind's order, theme values written out: for a page whose build hasn't seen them. */\n css(classes: string[]): string;\n}\n\n/** The part of Tailwind's design system used here. Unstable there, so everything read from it is checked. */\ninterface DesignSystem {\n getClassList(): [string, { modifiers?: string[] }][];\n getVariants(): { name: string; values: string[]; hasDash: boolean }[];\n candidatesToCss(classes: string[]): (string | null)[];\n parseCandidate(candidate: string): Iterable<{ kind: string; root?: string; value?: { kind: string; value: string } | null }>;\n resolveThemeValue(path: string): string | undefined;\n getClassOrder(classes: string[]): [string, bigint | null][];\n}\n\ninterface Entry {\n name: string;\n /** The kind: the properties it sets, sorted. */\n kind: string;\n color?: string;\n value?: string;\n}\n\n/** Packages that depend on `@tailwindcss/node`, where the project doesn't itself. */\nconst VIA = ['@tailwindcss/vite', '@tailwindcss/postcss', '@tailwindcss/cli', '@tailwindcss/webpack'];\nconst MOST = 400;\nconst natural = new Intl.Collator('en', { numeric: true }).compare;\n\n/**\n * The catalog of the project at `root`, from its stylesheet (`css`, from the root: the one that imports\n * Tailwind and holds the theme), or from Tailwind's defaults without one. Read again when that file changes.\n * Rejects where the project has no Tailwind v4.\n */\nexport async function loadCatalog(root: string, css?: string): Promise<Catalog> {\n const { __unstable__loadDesignSystem: load } = await tailwindOf(root);\n const file = css === undefined ? undefined : resolve(root, css);\n const build = async () =>\n catalogOf(\n file === undefined\n ? await load('@import \"tailwindcss\";', { base: root })\n : await load(readFileSync(file, 'utf8'), { base: dirname(file) }),\n );\n const stamp = () => (file === undefined ? 0 : statSync(file).mtimeMs);\n let built = stamp();\n let current = await build();\n // The latest build, rebuilt when the stylesheet changed since. One that fails (a file half-saved) keeps the last.\n const latest = (): Catalog => {\n const now = stamp();\n if (now !== built) {\n built = now;\n void build().then(\n (next) => (current = next),\n () => {},\n );\n }\n return current;\n };\n return {\n complete: (query, limit) => latest().complete(query, limit),\n info: (classes) => latest().info(classes),\n alternatives: (name) => latest().alternatives(name),\n css: (classes) => latest().css(classes),\n };\n}\n\ntype Loader = (css: string, options: { base: string }) => Promise<DesignSystem>;\n\nasync function tailwindOf(root: string): Promise<{ __unstable__loadDesignSystem: Loader }> {\n const from = createRequire(join(root, 'package.json'));\n const found = [\n () => from.resolve('@tailwindcss/node'),\n ...VIA.map((via) => () => createRequire(from.resolve(via)).resolve('@tailwindcss/node')),\n ];\n for (const find of found) {\n let path: string;\n try {\n path = find();\n } catch {\n continue;\n }\n const module = (await import(pathToFileURL(path).href)) as { __unstable__loadDesignSystem?: Loader };\n if (typeof module.__unstable__loadDesignSystem === 'function')\n return { __unstable__loadDesignSystem: module.__unstable__loadDesignSystem };\n }\n throw new Error(`no Tailwind v4 in ${root}: install @tailwindcss/node there (or one of ${VIA.join(', ')})`);\n}\n\nexport function catalogOf(design: DesignSystem): Catalog {\n /** A value with the theme's variables written out, and what arithmetic is left done: `calc(var(--spacing) * 4)` is `1rem`. */\n const resolved = (value: string): string => {\n let now = value;\n for (let i = 0; i < 4; i++) {\n const next = now.replace(/var\\((--[\\w-]+)\\)/g, (all, name: string) => themed(name) ?? all);\n if (next === now) break;\n now = next;\n }\n return now.replace(/calc\\(([^()]+)\\)/g, (all, sum: string) => computed(sum) ?? all);\n };\n const themed = (name: string): string | undefined => {\n try {\n return design.resolveThemeValue(name) ?? undefined;\n } catch {\n return undefined;\n }\n };\n\n const entryOf = (name: string, css: string): Entry => {\n const set = declarations(css);\n const kind = [...new Set(set.map(([property]) => property))].toSorted().join(',');\n const color = set.findLast(([property, value]) => COLOR.test(property) && !NO_COLOR.test(value))?.[1];\n const main = (set.find(([property]) => !property.startsWith('--')) ?? set[0])?.[1];\n return {\n name,\n kind,\n ...(color === undefined ? {} : { color: resolved(color) }),\n ...(main === undefined ? {} : { value: resolved(main) }),\n };\n };\n\n const names = design\n .getClassList()\n .map(([name]) => name)\n .toSorted(natural);\n const modifiers = new Map(design.getClassList().map(([name, { modifiers = [] }]) => [name, modifiers]));\n const sheets = design.candidatesToCss(names);\n const byName = new Map<string, Entry>();\n const kinds = new Map<string, Entry[]>();\n names.forEach((name, i) => {\n const css = sheets[i];\n if (css === null || css === undefined) return;\n const entry = entryOf(name, css);\n if (entry.kind === '') return;\n byName.set(name, entry);\n const kind = kinds.get(entry.kind);\n if (kind === undefined) kinds.set(entry.kind, [entry]);\n else kind.push(entry);\n });\n for (const kind of kinds.values()) kind.sort(byValue(kind));\n\n const variants = design\n .getVariants()\n .flatMap(({ name, values, hasDash }) => [name, ...values.map((value) => `${name}${hasDash ? '-' : ''}${value}`)])\n // `*` and `**` are variants too, and so are those that only take a value in brackets: neither completes a word.\n .filter((name) => /^[@\\w]/.test(name))\n .toSorted(natural);\n\n /** A class Tailwind makes on asking, not in its list: one with a value in brackets, a modifier, a fraction. */\n const made = new Map<string, Entry | undefined>();\n const make = (body: string): Entry | undefined => {\n if (made.has(body)) return made.get(body);\n const css = design.candidatesToCss([body])[0];\n const entry = css === null || css === undefined ? undefined : entryOf(body, css);\n made.set(body, entry?.kind === '' ? undefined : entry);\n return made.get(body);\n };\n const rootOf = (body: string): string | undefined => {\n for (const candidate of design.parseCandidate(body))\n if (candidate.kind === 'functional' && candidate.root !== undefined && candidate.value) return candidate.root;\n return undefined;\n };\n /** The entry of a class's own part (no variants, no `!`), and the kind it's of among the listed ones. */\n const find = (body: string): { entry: Entry; kind: string } | undefined => {\n const listed = byName.get(body);\n if (listed !== undefined) return { entry: listed, kind: listed.kind };\n const entry = make(body);\n if (entry === undefined) return undefined;\n if (kinds.has(entry.kind)) return { entry, kind: entry.kind };\n // `text-[13px]` sets the size alone, `text-sm` the line height too: the kind is the nearest one of its root's.\n const root = rootOf(body);\n if (root === undefined) return { entry, kind: entry.kind };\n const own = new Set(entry.kind.split(','));\n let best: { kind: string; shared: number } | undefined;\n for (const name of names) {\n if (!name.startsWith(`${root}-`)) continue;\n const kind = byName.get(name)?.kind;\n if (kind === undefined || kind === best?.kind) continue;\n const shared = kind.split(',').filter((property) => own.has(property)).length;\n if (shared > (best?.shared ?? 0)) best = { kind, shared };\n }\n return { entry, kind: best?.kind ?? entry.kind };\n };\n const shown = (name: string, entry: Entry): ClassInfo => ({\n name,\n known: true,\n ...(entry.color === undefined ? {} : { color: entry.color }),\n ...(entry.value === undefined ? {} : { value: entry.value }),\n });\n const info = (name: string): ClassInfo => {\n const found = find(parts(name).body);\n return found === undefined ? { name, known: false } : shown(name, found.entry);\n };\n\n return {\n complete(query, limit = 40) {\n const { before: variantsBefore, bang, body, after } = parts(query.trim());\n if (body === '' && variantsBefore === '') return [];\n const before = `${variantsBefore}${bang}`;\n const starts: ClassInfo[] = [];\n const holds: ClassInfo[] = [];\n const add = (to: ClassInfo[], name: string, entry: Entry) => {\n if (to.length < limit) to.push(shown(`${before}${name}${after}`, entry));\n };\n const exact = byName.get(body);\n if (exact !== undefined) add(starts, body, exact);\n for (const name of names) {\n if (starts.length >= limit) break;\n if (name === body) continue;\n const entry = byName.get(name);\n if (entry === undefined) continue;\n if (name.startsWith(body)) add(starts, name, entry);\n else if (body.length > 1 && name.includes(body)) add(holds, name, entry);\n }\n // `bg-red-500/`: the modifiers the class takes.\n const slash = body.lastIndexOf('/');\n const base = slash < 0 ? undefined : byName.get(body.slice(0, slash));\n const modified =\n base === undefined || starts.length > 0\n ? []\n : (modifiers.get(base.name) ?? [])\n .filter((modifier) => modifier.startsWith(body.slice(slash + 1)))\n .map((modifier) => shown(`${before}${base.name}/${modifier}${after}`, make(`${base.name}/${modifier}`) ?? base));\n const ahead =\n after !== '' || bang !== '' || body === ''\n ? []\n : variants\n .filter((name) => name.startsWith(body))\n .map((name): ClassInfo => ({ name: `${before}${name}:`, known: true, variant: true }));\n return [...starts, ...modified, ...ahead, ...holds].slice(0, limit);\n },\n info: (classes) => classes.map(info),\n alternatives(name) {\n const { before, bang, body, after } = parts(name);\n const found = find(body);\n if (found === undefined) return undefined;\n const { modifier, base } = modified(body, byName);\n const kind = kinds.get(found.kind) ?? [];\n const properties = found.kind.split(',');\n const root = rootOf(body);\n const value = [...design.parseCandidate(body)].find((candidate) => candidate.value?.kind === 'arbitrary')?.value?.value;\n const items = kind.slice(0, MOST).map((entry) => shown(`${before}${bang}${entry.name}${modifier}${after}`, entry));\n // The class itself where it isn't listed (its value is its own), so the panel has it to show as chosen.\n if (!kind.some((entry) => entry.name === base)) items.unshift(shown(name, found.entry));\n return {\n label: properties.find((property) => !property.startsWith('--')) ?? properties[0]!,\n colors: kind.filter((entry) => entry.color !== undefined).length * 2 > kind.length,\n items,\n ...(root === undefined\n ? {}\n : { custom: { before: `${before}${bang}${root}-[`, after: `]${modifier}${after}`, ...(value === undefined ? {} : { value }) } }),\n };\n },\n css(classes) {\n const bodies = [...new Set(classes)];\n const order = new Map(design.getClassOrder(bodies));\n bodies.sort((a, b) => {\n const [x, y] = [order.get(a) ?? null, order.get(b) ?? null];\n if (x === null || y === null) return x === y ? 0 : x === null ? 1 : -1;\n return x < y ? -1 : x > y ? 1 : 0;\n });\n const properties = new Set<string>();\n const rules = design\n .candidatesToCss(bodies)\n .filter((css) => css !== null && css !== undefined)\n // `@property` can't sit in a layer, so each is lifted out, once.\n .map((css) =>\n css.replace(PROPERTY, (rule) => {\n properties.add(rule.trim());\n return '';\n }),\n )\n .join('');\n if (rules.trim() === '') return '';\n // In the layer the page's own utilities are in, so what beats them there (the page's unlayered CSS) beats these.\n return `${[...properties].join('\\n')}\\n@layer utilities {\\n${rules.replace(/var\\((--[\\w-]+)\\)/g, (all, name: string) => themed(name) ?? all)}}\\n`;\n },\n };\n}\n\nconst COLOR = /(^|-)color$|^fill$|^stroke$|^--tw-gradient-(from|via|to)$/;\nconst NO_COLOR = /^(inherit|none|initial|unset)$/;\nconst PROPERTY = /@property [^{]+\\{[^}]*\\}\\n?/g;\n\n/** A rule's declarations, in order, from Tailwind's CSS for one class: one a line, `@property` rules after. */\nfunction declarations(css: string): [property: string, value: string][] {\n const rules = css.replace(PROPERTY, '');\n return [...rules.matchAll(/^\\s+(-{0,2}[\\w-]+):\\s*(.+?)(?:\\s*!important)?;$/gm)].map((match) => [match[1]!, match[2]!]);\n}\n\n/** `0.25rem * 4` as `1rem`: products and quotients of numbers with one unit between them. Anything else is left. */\nfunction computed(sum: string): string | undefined {\n const tokens = sum.trim().split(/\\s+/);\n let total = 1;\n let unit = '';\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i]!;\n if (i % 2 === 1) {\n if (token !== '*' && token !== '/') return undefined;\n continue;\n }\n const match = /^(-?(?:\\d+\\.?\\d*|\\.\\d+))(%|[a-z]+)?$/.exec(token);\n if (match === null) return undefined;\n const divides = tokens[i - 1] === '/';\n if (match[2] !== undefined && (unit !== '' || divides)) return undefined;\n unit = match[2] ?? unit;\n total = divides ? total / Number(match[1]) : total * Number(match[1]);\n }\n if (tokens.length % 2 === 0 || !Number.isFinite(total)) return undefined;\n return `${Number(total.toFixed(4))}${unit}`;\n}\n\n/** A length as a number to order by, where the value is one: `1rem` is 16. */\nfunction measure(value: string | undefined): number | undefined {\n const match = value === undefined ? null : /^(-?(?:\\d+\\.?\\d*|\\.\\d+))(px|rem|em|%)?$/.exec(value);\n if (match === null) return undefined;\n return Number(match[1]) * (match[2] === 'rem' || match[2] === 'em' ? 16 : 1);\n}\n\n/** A kind's order: by size where most of it has one (`text-xs` before `text-sm`), by name else, as it already is. */\nfunction byValue(kind: Entry[]): (a: Entry, b: Entry) => number {\n const sizes = new Map(kind.map((entry) => [entry, measure(entry.value)]));\n const sized = [...sizes.values()].filter((size) => size !== undefined).length;\n if (sized * 10 < kind.length * 7) return () => 0;\n return (a, b) => {\n const [x, y] = [sizes.get(a), sizes.get(b)];\n if (x === undefined || y === undefined) return x === y ? 0 : x === undefined ? 1 : -1;\n return x - y;\n };\n}\n\n/**\n * A class as written, apart: its variants (`md:hover:`), `!` where it leads, its own part, and `!` where it\n * trails. A `:` inside brackets or parentheses is the value's.\n */\nfunction parts(name: string): { before: string; bang: string; body: string; after: string } {\n let depth = 0;\n let cut = 0;\n for (let i = 0; i < name.length; i++) {\n const char = name[i]!;\n if (char === '[' || char === '(') depth++;\n else if (char === ']' || char === ')') depth--;\n else if (char === ':' && depth === 0) cut = i + 1;\n }\n const own = name.slice(cut);\n const bang = own.startsWith('!') ? '!' : '';\n const after = !bang && own.endsWith('!') ? '!' : '';\n return { before: name.slice(0, cut), bang, body: own.slice(bang.length, own.length - after.length), after };\n}\n\n/** A class's modifier (`/50`) and what it's on, where the whole isn't a class itself, as `w-1/2` is. */\nfunction modified(body: string, listed: Map<string, unknown>): { base: string; modifier: string } {\n const slash = body.lastIndexOf('/');\n if (listed.has(body) || slash < 0 || body.indexOf(']', slash) >= 0) return { base: body, modifier: '' };\n return { base: body.slice(0, slash), modifier: body.slice(slash) };\n}\n","/**\n * `deictic/tailwind`: open its tab on an element to edit its classes, written to its `className`.\n *\n * Only a list the source spells out can be edited: `className=\"…\"`, `className={'…'}`, a template\n * with no `${}`, or the first argument of a class helper (`cn('…', active && '…')`), whose other\n * arguments stay as they are. A list built any other way is shown, not edited, since there is no one\n * place for a class to go. An element without the attribute gets one.\n *\n * Its routes answer the panel from the project's own Tailwind (`catalog.ts`): what completes a word typed\n * (`complete`), what each class sets (`info`), the classes of a class's kind (`alternatives`) and the CSS of\n * classes the page's build hasn't seen (`css`). Without Tailwind v4 they answer nothing, and the panel is plain.\n */\nimport type { Argument, Expression, JSXAttribute, JSXOpeningElement, Program } from 'oxc-parser';\n\nimport { definePlugin, Refusal, type ServerContext, type Shortcut } from '#src/index.ts';\n\nimport { type Catalog, loadCatalog } from './catalog.ts';\n\nexport type { Alternatives, ClassInfo } from './catalog.ts';\n\nexport interface TailwindOptions {\n /** Calls whose first argument is a class list: `cn`, `clsx`, `cx`, `twMerge`, `classNames` by default. */\n helpers?: string[];\n /** The attribute an element without one gets: `className`, or `class` for Solid and Preact. */\n attribute?: 'className' | 'class';\n /**\n * The stylesheet that imports Tailwind and holds the theme, from the project's root: `src/index.css`. What\n * the panel completes and shows comes from it. Tailwind's default theme without one.\n */\n css?: string;\n /** What opens its tab directly, beside deictic's own shortcut, which opens any: none by default. */\n shortcut?: Shortcut;\n}\n\nexport type Model =\n | {\n editable: true;\n classes: string;\n /** The helper's other arguments, which add classes at runtime, each read as far as the source says. */\n others?: Extra[];\n }\n | { editable: false; source: string };\n\n/** Classes a helper's argument adds: `active && 'ring'` is `ring` when `active`. */\nexport interface Extra {\n /** The argument, or the part of it these classes come from, as written. */\n source: string;\n /** The classes, where the source spells them out: there, or in a `const` of the file it names. */\n classes?: string;\n /** What must hold for them to be added, as written: `active === 'h3'`. None where they always are. */\n when?: string;\n /** Set where the classes are a string in this file, which an op with `at` can write. */\n editable?: true;\n /** The `const` the string is in, where it isn't the argument itself: other elements may use it too. */\n shared?: string;\n}\n\nexport interface Op {\n classes: string;\n /** Which of the model's `others` the classes are for, by its place there. The element's own list without. */\n at?: number;\n}\n\n/** Where a class list sits in the source: the text between its quotes, or where a missing attribute goes. */\ntype List = { kind: 'list'; start: number; end: number; quote: string; others?: Argument[] };\ntype Spot = List | { kind: 'missing'; at: number } | { kind: 'fixed'; source: string };\n\nconst HELPERS = ['cn', 'clsx', 'cx', 'twMerge', 'classNames'];\n\nexport function tailwind(options: TailwindOptions = {}) {\n const helpers = new Set(options.helpers ?? HELPERS);\n const attribute = options.attribute ?? 'className';\n // Loaded on the first ask, as it takes a moment, and once: a project without Tailwind v4 has none.\n let loading: Promise<Catalog | undefined> | undefined;\n const catalog = ({ root }: ServerContext) =>\n (loading ??= loadCatalog(root, options.css).catch((problem: unknown) => {\n console.warn(`deictic/tailwind: no completions or class details, as ${problem instanceof Error ? problem.message : String(problem)}`);\n return undefined;\n }));\n const asked = async (request: Request): Promise<string[]> => {\n const body = (await request.json().catch(() => undefined)) as { classes?: unknown } | undefined;\n return Array.isArray(body?.classes) ? body.classes.filter((c): c is string => typeof c === 'string').slice(0, 500) : [];\n };\n return definePlugin<Model, Op>({\n name: 'tailwind',\n client: 'deictic/tailwind/client',\n shortcut: options.shortcut,\n routes: {\n // `complete?q=fle`: the classes for a word being typed.\n complete: async (request, context) => {\n const query = new URL(request.url).searchParams.get('q') ?? '';\n return Response.json({ items: (await catalog(context))?.complete(query) ?? [] });\n },\n // What each of `classes` sets. `available` is false where there's no catalog, so the panel stops asking.\n info: async (request, context) => {\n const known = await catalog(context);\n return Response.json({ available: known !== undefined, items: known?.info(await asked(request)) ?? [] });\n },\n // `alternatives?class=text-sm`: the classes of its kind, or nothing for one Tailwind doesn't know.\n alternatives: async (request, context) => {\n const name = new URL(request.url).searchParams.get('class') ?? '';\n return Response.json((await catalog(context))?.alternatives(name) ?? null);\n },\n css: async (request, context) => Response.json({ css: (await catalog(context))?.css(await asked(request)) ?? '' }),\n },\n read(source) {\n if (source instanceof Refusal) throw source;\n const { code, element, program } = source;\n const spot = spotOf(element, code, helpers);\n if (spot.kind === 'fixed') return { editable: false, source: spot.source };\n if (spot.kind === 'missing') return { editable: true, classes: '' };\n const others = spot.others?.flatMap((argument) => extrasOf(argument, code, program)).map(({ spot: _, ...extra }) => extra);\n return { editable: true, classes: code.slice(spot.start, spot.end), ...(others === undefined ? {} : { others }) };\n },\n apply(source, _target, { classes, at }) {\n if (source instanceof Refusal) throw source;\n const { file, code, element, program } = source;\n const list = classes.trim().split(/\\s+/).filter(Boolean).join(' ');\n const spot = spotOf(element, code, helpers);\n if (spot.kind === 'fixed') throw new Refusal('this class list is built at runtime: edit it in the editor');\n if (at !== undefined) {\n const others = spot.kind === 'list' ? (spot.others ?? []).flatMap((argument) => extrasOf(argument, code, program)) : [];\n const place = others[at]?.spot;\n if (place === undefined)\n throw new Refusal(\"these classes aren't a string in this file any more: reload, or edit them in the editor\");\n return [{ start: place.start, end: place.end, text: quoted(list, place.quote) }];\n }\n // An `.astro` component writes `class`, whatever the JSX beside it does.\n const name = file.endsWith('.astro') ? 'class' : attribute;\n if (spot.kind === 'missing') return list === '' ? [] : [{ start: spot.at, end: spot.at, text: ` ${name}=\"${quoted(list, '\"')}\"` }];\n return [{ start: spot.start, end: spot.end, text: quoted(list, spot.quote) }];\n },\n describe({ classes, at }, before) {\n if (!before.editable) return 'classes';\n if (at === undefined) return diff(before.classes, classes);\n const other = before.others?.[at];\n return `${diff(other?.classes ?? '', classes)}${other?.when === undefined ? '' : ` when ${other.when}`}`;\n },\n });\n}\n\nfunction spotOf(element: JSXOpeningElement, code: string, helpers: Set<string>): Spot {\n const attr = element.attributes.find(\n (a): a is JSXAttribute =>\n a.type === 'JSXAttribute' && a.name.type === 'JSXIdentifier' && (a.name.name === 'className' || a.name.name === 'class'),\n );\n if (attr === undefined) {\n // Astro's `class:list` is the element's class list too: a `class` beside it would be a second one.\n const listed = element.attributes.find(\n (a) => a.type === 'JSXAttribute' && a.name.type === 'JSXIdentifier' && a.name.name === 'class:list',\n );\n return listed === undefined\n ? { kind: 'missing', at: element.name.end }\n : { kind: 'fixed', source: code.slice(listed.start, listed.end) };\n }\n const { value } = attr;\n if (value?.type === 'Literal') return list(value, code);\n if (value?.type !== 'JSXExpressionContainer' || value.expression.type === 'JSXEmptyExpression')\n return { kind: 'fixed', source: code.slice(attr.start, attr.end) };\n const e = value.expression;\n const whole = listIn(e, code);\n if (whole !== undefined) return whole;\n if (e.type === 'CallExpression' && e.callee.type === 'Identifier' && helpers.has(e.callee.name)) {\n const [first, ...others] = e.arguments;\n const head = first === undefined || first.type === 'SpreadElement' ? undefined : listIn(first, code);\n if (head !== undefined) return others.length === 0 ? head : { ...head, others };\n }\n return { kind: 'fixed', source: code.slice(attr.start, attr.end) };\n}\n\n/**\n * What one of a helper's arguments adds, and when: `on && 'ring'`, `on ? 'a' : 'b'`, `{ ring: on }`, a string,\n * or a name for one. Anything else is only its source, as nothing says what it adds.\n */\nfunction extrasOf(argument: Argument, code: string, program: Program): (Extra & { spot?: List })[] {\n const source = (node: { start: number; end: number }) => code.slice(node.start, node.end);\n const added = (e: { type: string; start: number; end: number }, when?: string, key = false): Extra & { spot?: List } => {\n const found = stringOf(e, program, !key);\n if (found === undefined) return { source: source(e), ...(when === undefined ? {} : { when }) };\n return {\n source: source(e),\n classes: found.value,\n ...(when === undefined ? {} : { when }),\n editable: true,\n ...(found.shared === undefined ? {} : { shared: found.shared }),\n spot: list(found.node, code),\n };\n };\n const e = argument;\n if (e.type === 'SpreadElement') return [{ source: source(e) }];\n if (e.type === 'LogicalExpression' && e.operator === '&&') return [added(e.right, source(e.left))];\n if (e.type === 'ConditionalExpression') {\n const test = source(e.test);\n const not = e.test.type === 'Identifier' ? `!${test}` : `!(${test})`;\n // A branch that adds nothing (`on ? 'ring' : undefined`) isn't one to show.\n return [added(e.consequent, test), added(e.alternate, not)].filter(\n (extra) => extra.classes !== '' && !/^(undefined|null|false)$/.test(extra.source),\n );\n }\n if (e.type === 'ObjectExpression') {\n return e.properties.map((property): Extra & { spot?: List } => {\n if (property.type !== 'Property' || property.computed) return { source: source(property) };\n const always = property.value.type === 'Literal' && property.value.value === true;\n const when = always ? {} : { when: source(property.value) };\n // A bare key (`ring`) is a class, but not a string to write a list into.\n if (property.key.type === 'Identifier') return { source: source(property), classes: property.key.name, ...when };\n const { source: _, ...key } = added(property.key, undefined, true);\n return key.classes === undefined ? { source: source(property) } : { source: source(property), ...key, ...when };\n });\n }\n return [added(e)];\n}\n\n/**\n * A string the source spells out, and where: a literal, a template with nothing interpolated, or a top-level\n * `const` of one (`shared`, its name).\n */\nfunction stringOf(\n e: { type: string },\n program: Program,\n named = true,\n): { value: string; node: { start: number; end: number }; shared?: string } | undefined {\n const node = e as Expression;\n if (node.type === 'Literal') return typeof node.value === 'string' ? { value: node.value, node } : undefined;\n if (node.type === 'TemplateLiteral') {\n const value = node.expressions.length === 0 ? node.quasis[0]?.value.cooked : undefined;\n return value === undefined || value === null ? undefined : { value, node };\n }\n if (node.type !== 'Identifier' || !named) return undefined;\n for (const statement of program.body) {\n const declared = statement.type === 'ExportNamedDeclaration' ? statement.declaration : statement;\n if (declared?.type !== 'VariableDeclaration' || declared.kind !== 'const') continue;\n for (const { id, init } of declared.declarations) {\n if (id.type !== 'Identifier' || id.name !== node.name || !init) continue;\n const found = stringOf(init, program, false);\n return found === undefined ? undefined : { ...found, shared: node.name };\n }\n }\n return undefined;\n}\n\n/** A string literal or a template with nothing interpolated, as the text between its quotes. */\nfunction listIn(e: Expression, code: string): List | undefined {\n if (e.type === 'Literal' && typeof e.value === 'string') return list(e, code);\n if (e.type === 'TemplateLiteral' && e.expressions.length === 0) return list(e, code);\n return undefined;\n}\n\nconst list = (node: { start: number; end: number }, code: string): List => ({\n kind: 'list',\n start: node.start + 1,\n end: node.end - 1,\n quote: code[node.start]!,\n});\n\n/** The list as it may sit between `quote`s. A JSX attribute has no escapes, so a quote of its own kind can't. */\nfunction quoted(list: string, quote: string): string {\n if (quote === '`') return list.replaceAll('\\\\', '\\\\\\\\').replaceAll('`', '\\\\`').replaceAll('${', '\\\\${');\n if (!list.includes(quote)) return list;\n throw new Refusal(`a class can't hold ${quote} here: use the other quote inside arbitrary values, as in content-['…']`);\n}\n\n/** What changed between two lists: `+ring -px-2`. */\nfunction diff(before: string, after: string): string {\n const was = new Set(before.split(/\\s+/).filter(Boolean));\n const now = new Set(after.split(/\\s+/).filter(Boolean));\n const parts = [...[...now].filter((c) => !was.has(c)).map((c) => `+${c}`), ...[...was].filter((c) => !now.has(c)).map((c) => `-${c}`)];\n return parts.length > 0 ? parts.join(' ') : 'reordered classes';\n}\n\nexport default tailwind;\n"],"mappings":";;;;;;;;;;;;;;;;AAkEA,MAAM,MAAM;CAAC;CAAqB;CAAwB;CAAoB;AAAsB;AACpG,MAAM,OAAO;AACb,MAAM,UAAU,IAAI,KAAK,SAAS,MAAM,EAAE,SAAS,KAAK,CAAC,CAAC,CAAC;;;;;;AAO3D,eAAsB,YAAY,MAAc,KAAgC;CAC9E,MAAM,EAAE,8BAA8B,SAAS,MAAM,WAAW,IAAI;CACpE,MAAM,OAAO,QAAQ,KAAA,IAAY,KAAA,IAAY,QAAQ,MAAM,GAAG;CAC9D,MAAM,QAAQ,YACZ,UACE,SAAS,KAAA,IACL,MAAM,KAAK,4BAA0B,EAAE,MAAM,KAAK,CAAC,IACnD,MAAM,KAAK,aAAa,MAAM,MAAM,GAAG,EAAE,MAAM,QAAQ,IAAI,EAAE,CAAC,CACpE;CACF,MAAM,cAAe,S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AAM,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,QAAQ,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,IAAI,GAAG,CAAC;CACrI,OAAO,MAAM,SAAS,IAAI,MAAM,KAAK,GAAG,IAAI;AAC9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","names":[],"sources":["../../src/plugins/tasks/client.ts"],"mappings":";;qBAyTa;cAwBb,4B"}
1
+ {"version":3,"file":"client.d.ts","names":[],"sources":["../../src/plugins/tasks/client.ts"],"mappings":";;qBAsTa;cAwBb,4B"}
@@ -208,8 +208,8 @@ const OUTLINE = "#12b358";
208
208
  /** CSS pixels between the element and its outline, so the dashes are on nothing of the element's. */
209
209
  const ROOM = 3;
210
210
  /**
211
- * A shot's PNG with the element outlined in it: dashes around its box, white under them so they show on any
212
- * page. The shot may have more pixels than its size in CSS ones, which the box is in.
211
+ * A shot's PNG with the element outlined in it: dashes around its box, with nothing between them, as the overlay
212
+ * draws it. The shot may have more pixels than its size in CSS ones, which the box is in.
213
213
  */
214
214
  async function outlined(png, { box, size }) {
215
215
  const url = typeof png === "string" ? png : URL.createObjectURL(png);
@@ -231,9 +231,6 @@ async function outlined(png, { box, size }) {
231
231
  (box.width + 6) * k,
232
232
  (box.height + 6) * k
233
233
  ];
234
- ctx.lineWidth = 4 * k;
235
- ctx.strokeStyle = "#fff";
236
- ctx.strokeRect(...rect);
237
234
  ctx.lineWidth = 2 * k;
238
235
  ctx.strokeStyle = OUTLINE;
239
236
  ctx.setLineDash([6 * k, 4 * k]);
@@ -853,6 +850,8 @@ var client_default = defineClientPlugin({
853
850
  announce(model, op, context.target);
854
851
  text.value = "";
855
852
  reset();
853
+ const dropped = model.tasks.at(-1)?.dropped;
854
+ if (dropped !== void 0) problem.textContent = `Sent without ${dropped}: it wasn't kept any more`;
856
855
  } catch {}
857
856
  sending = false;
858
857
  able();
@@ -1 +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 * Beside the channel it says who watches it (`Model.watching`), or that no agent does.\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: the chain of source it rendered through, its HTML (a file attached), and where the\n * 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, the element\n * outlined in it as the task goes: nothing else says which of two rows alike was meant (a shot drawn on is\n * left as it was drawn). 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 * The element's HTML as it rendered goes with it too, as a file, unless its box is unticked (or the server\n * half's `html` option is off, and then there's no box).\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/* The column is no wider than the panel: an \\`auto\\` one grows to a long title, which then never truncates. */\n.tasks { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }\n/* Five rows, and the rest scrolled to: the field stays where it is however many there are. */\n.tasks { max-height: 112px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--deictic-line) transparent; }\n/* A task's words being changed need the room. */\n.tasks:has(.editing) { max-height: none; }\n.tasks li { position: relative; display: flex; gap: 6px; align-items: baseline; }\n.tasks .title { flex: 1; min-width: 0; padding: 0; border: 0; border-radius: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n/* Clicked, a task reads whole, as it was typed. */\n.tasks li.whole .title { white-space: pre-wrap; overflow-wrap: anywhere; }\n/* The state is a dot, named by its tooltip: a ring while no one has it, filled once someone does or it's over. */\n.tasks .state { flex: none; align-self: center; box-sizing: border-box; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n/* Room for Edit and Delete, which would lie over the first line's end. */\n.tasks li.whole:has(.acts) .title { padding-right: 40px; }\n.tasks li.whole .state { align-self: baseline; }\n.tasks .state.waiting { border-style: dotted; }\n.tasks .state.claimed { border-color: #60a5fa; background: #60a5fa; }\n.tasks .state.blocked { border-color: #fbbf24; background: #fbbf24; }\n.tasks .state.completed { border-color: #4ade80; background: #4ade80; }\n.tasks .state.failed { border-color: var(--deictic-problem); background: var(--deictic-problem); }\n.tasks a { color: inherit; text-decoration: none; }\n.tasks a:hover { text-decoration: underline; }\n/* Over the row's end, and only while the row is pointed at or focused in: the title keeps the width. */\n.tasks .acts { position: absolute; inset: 0 0 auto auto; min-height: 18px; display: none; align-items: center; padding-left: 14px; background: linear-gradient(to right, transparent, var(--deictic-bg) 12px); }\n.tasks li:hover .acts, .tasks li:focus-within .acts { display: flex; }\n.tasks .act { 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 .place { flex: none; padding: 0; border: 0; font: 11px ui-monospace, monospace; color: var(--deictic-muted); }\n.tasks button.place:hover { color: var(--deictic-fg); text-decoration: underline; }\n.more { margin: 0 0 8px; }\n.more[hidden] { display: none; }\n.more summary { cursor: pointer; font-size: 12px; color: var(--deictic-muted); }\n.more summary:hover { color: var(--deictic-fg); }\n.more .tasks { margin: 4px 0 0; }\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/* Cut short before it pushes Add out: a channel's name and its watchers' may be long. */\n.hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--deictic-muted); font-size: 12px; }\n/* A dot as a task's state is: a ring while no one watches, green while someone does. */\n.watch::before { content: ''; display: inline-block; box-sizing: border-box; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n.watch.on::before { border-color: #4ade80; background: #4ade80; }\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');\n/** The states of a task that's over, as a board names them: nothing more happens to it. */\nconst OVER = new Set(['completed', 'failed']);\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 html: boolean;\n drawn: Drawn[];\n recordings: Recording[];\n voices: Clip[];\n /** What the page said of the element as the panel left, for a task added where the page no longer has it. */\n facts: Facts;\n}\n\n/** What a task says that only the page with the element on it knows. */\ntype Facts = Pick<Op, 'page' | 'viewport' | 'pointed' | 'count' | 'chain'> & {\n /** The element's HTML, as it would be attached. */\n html: string;\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\nconst parentOf = (el: Element): Element | undefined => {\n if (el.parentElement !== null) return el.parentElement;\n const root = el.getRootNode();\n return root instanceof ShadowRoot ? root.host : undefined;\n};\n\n/** How many places a chain names after the element's own: who uses it, and who uses that. Further out is the app's shell. */\nconst CHAIN = 3;\n\n/**\n * What React keeps, in development, of who wrote an element: a fiber (its `type` the component), or for a server\n * component its `name`. Each has the one that wrote it in turn.\n */\ninterface Owner {\n name?: unknown;\n type?: unknown;\n alternate?: Owner | null;\n owner?: Owner | null;\n _debugOwner?: Owner | null;\n}\n\n/** React's fiber of an element it rendered, which it keeps on the element under a key of its own. */\nconst fiberOf = (el: Element): Owner | undefined => {\n const key = Object.keys(el).find((k) => k.startsWith('__reactFiber$'));\n return key === undefined ? undefined : (el as unknown as Record<string, Owner>)[key];\n};\n\nconst ownerOf = (of: Owner | undefined): Owner | undefined => of?._debugOwner ?? of?.owner ?? undefined;\n\n/** A component's name, through `memo` and `forwardRef`, or nothing for one written without. */\nfunction componentOf(owner: Owner): string | undefined {\n if (typeof owner.name === 'string') return owner.name === '' ? undefined : owner.name;\n let type = owner.type as { displayName?: unknown; name?: unknown; render?: unknown; type?: unknown } | null | undefined;\n for (let depth = 0; depth < 4 && type !== null && type !== undefined; depth++) {\n // A function's own name, where it has no `displayName`; a `memo` or `forwardRef` object has neither.\n const name = type.displayName ?? type.name;\n if (typeof name === 'string' && name !== '') return name;\n type = (type.render ?? type.type) as typeof type;\n }\n return undefined;\n}\n\n/**\n * The source `el` rendered through, after its own place, nearest first: a shared component's own line is the same\n * wherever it's used, and the change is most often in what uses it, or in what uses that.\n *\n * With React in development, those are the components that wrote it, each the one whose JSX has the one before:\n * `Field (src/Field.tsx:20)`, its line the nearest element around `el` that the component wrote, or the name alone\n * for one with no element of its own around it (it wraps what it uses only in other components), which the marks\n * can't show at all. A layout component the element was only passed through isn't among them.\n *\n * Without (another framework, a production build) it's read off the marks around it, each a `file:line`: the\n * nearest element each next file wrote.\n */\nfunction chainOf(el: Element, file: string): NonNullable<Op['chain']> {\n const found: NonNullable<Op['chain']> = [];\n const wrote = ownerOf(fiberOf(el));\n if (wrote !== undefined) {\n for (let owner = ownerOf(wrote); owner !== undefined && found.length < CHAIN; owner = ownerOf(owner)) {\n const name = componentOf(owner);\n let place: string | undefined;\n for (let at = parentOf(el); at !== undefined && place === undefined; at = parentOf(at)) {\n const by = ownerOf(fiberOf(at));\n // A component's fiber is one of two, by turns: an element may name either.\n if (by === undefined || (by !== owner && by !== owner.alternate)) continue;\n place = at.getAttribute('data-deictic')?.replace(/:\\d+$/, '');\n }\n if (name !== undefined) found.push(place === undefined ? name : `${name} (${place})`);\n else if (place !== undefined) found.push(place);\n }\n if (found.length > 0) return found;\n }\n let last = file;\n for (let at = parentOf(el); at !== undefined && found.length < CHAIN; at = parentOf(at)) {\n const mark = at.getAttribute('data-deictic');\n if (mark === null) continue;\n const from = mark.replace(/:\\d+:\\d+$/, '');\n if (from === last) continue;\n last = from;\n found.push(mark.replace(/:\\d+$/, ''));\n }\n return found;\n}\n\n/** What's sent of the element's HTML at most, in characters: the server attaches it as a file. */\nconst HTML = 100_000;\n\n/** The overlay's own green, as its outline of the element while the popup is open. */\nconst OUTLINE = '#12b358';\n/** CSS pixels between the element and its outline, so the dashes are on nothing of the element's. */\nconst ROOM = 3;\n\n/**\n * A shot's PNG with the element outlined in it: dashes around its box, white under them so they show on any\n * page. The shot may have more pixels than its size in CSS ones, which the box is in.\n */\nasync function outlined(png: Blob | string, { box, size }: Pick<Shot, 'box' | 'size'>): Promise<Blob> {\n const url = typeof png === 'string' ? png : URL.createObjectURL(png);\n try {\n const image = new Image();\n image.src = url;\n await image.decode();\n const canvas = element('canvas', { width: image.naturalWidth, height: image.naturalHeight });\n const ctx = canvas.getContext('2d');\n if (ctx === null) throw new Error(\"tasks: this browser won't draw to a canvas\");\n ctx.drawImage(image, 0, 0);\n const k = image.naturalWidth / size.width;\n const rect = [(box.x - ROOM) * k, (box.y - ROOM) * k, (box.width + 2 * ROOM) * k, (box.height + 2 * ROOM) * k] as const;\n ctx.lineWidth = 4 * k;\n ctx.strokeStyle = '#fff';\n ctx.strokeRect(...rect);\n ctx.lineWidth = 2 * k;\n ctx.strokeStyle = OUTLINE;\n ctx.setLineDash([6 * k, 4 * k]);\n ctx.strokeRect(...rect);\n return await new Promise<Blob>((done, fail) =>\n canvas.toBlob((blob) => (blob === null ? fail(new Error('tasks: the screenshot drew nothing')) : done(blob)), 'image/png'),\n );\n } finally {\n if (typeof png !== 'string') URL.revokeObjectURL(url);\n }\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 // All the panel leaves for is a recording, which a page load doesn't end.\n resume: ({ use }) => use('recordings')?.going(),\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 // The file's other tasks, folded away: the panel is about this element. It stays as it's left while the panel is up.\n const fold = element('details', { className: 'more' });\n const count = element('summary');\n const others = element('ul', { className: 'tasks' });\n fold.append(count, others);\n // The element's tasks that are over, folded away too: what's still to do is what's read first.\n const closed = element('details', { className: 'more' });\n const closedCount = element('summary');\n const ended = element('ul', { className: 'tasks' });\n closed.append(closedCount, ended);\n panel.append(style, list, closed, fold, text);\n\n const shots = context.use('screenshots');\n // Back from a recording that went on to a page without the element: there's nothing here to take a shot of.\n const here = context.element.isConnected;\n const notes = context.use('annotations');\n const recorder = context.use('recordings');\n const voice = context.use('voice');\n // The server half's `html` option, which takes the box away; a page half with no options (a `standalone` server's) has it.\n const sendsHtml = (context.options as { html?: boolean } | undefined)?.html !== false;\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 || !here });\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 && here ? [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 // Its own line: the screenshot's gives way to the chips, and this is asked whatever else is attached.\n const withHtml = element('input', { type: 'checkbox', checked: true });\n const htmlToggle = element('label', { title: 'The element as the page has it now, as a file: element.html' });\n htmlToggle.append(withHtml, 'Attach HTML snapshot');\n const htmlRow = element('div', { className: 'shot' });\n htmlRow.append(htmlToggle);\n if (sendsHtml) panel.append(htmlRow);\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 && here ? [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, html: withHtml.checked, drawn, recordings, voices, facts: facts() };\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 tasks shown whole, by ID: kept over a change, which draws the list again.\n const whole = new Set<string>();\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, elsewhere, watching } = 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 // Whether a task added now is taken up: who watches the channel, or that no one does, where that's known.\n if (watching !== undefined) {\n const names = new Intl.ListFormat('en', { type: 'conjunction' }).format(watching);\n const on = watching.length > 0;\n const who = element('span', {\n className: on ? 'watch on' : 'watch',\n textContent: on ? `${names} watching` : 'no agent watching',\n title: on\n ? `${names} ${watching.length === 1 ? 'is' : 'are'} watching #${channel}, and take${watching.length === 1 ? 's' : ''} each task as it's added`\n : `A task waits on the board until an agent watches #${channel}: ask yours to watch deictic's tasks`,\n });\n hint.append(' · ', who);\n }\n /** A task's row: its state, its ID, a link where it has a page, its title, and where it's from when that's said. */\n const rowOf = (t: Task, from?: HTMLElement) => {\n const item = element('li');\n const state = element('span', { className: `state ${t.state}`, title: t.by === undefined ? t.state : `${t.state} by ${t.by}` });\n state.role = 'img';\n const id = element('code', { textContent: `#${t.id}` });\n const title = element('button', { type: 'button', className: 'title' });\n // In place, not by drawing the list again: that would take a task's words being changed with it.\n const show = () => {\n const all = whole.has(t.id);\n item.classList.toggle('whole', all);\n title.textContent = all ? t.text : t.title;\n title.title = all ? 'Show its first line only' : 'Show all of it';\n title.ariaExpanded = String(all);\n };\n title.addEventListener('click', () => {\n if (!whole.delete(t.id)) whole.add(t.id);\n show();\n });\n show();\n const to =\n t.link === undefined\n ? id\n : element('a', { href: t.link, target: '_blank', rel: 'noreferrer', title: 'Open the task on the board' });\n if (to !== id) to.append(id);\n item.append(state, to, title, ...(from === undefined ? [] : [from]));\n return item;\n };\n const { file } = context.target.loc;\n fold.hidden = elsewhere.length === 0;\n count.textContent = `${elsewhere.length} elsewhere in ${file.split('/').at(-1)}`;\n others.replaceChildren(\n ...elsewhere.map((t) => {\n if (t.at === undefined) return rowOf(t);\n const { line, column, tag } = t.at;\n const name = `<${tag}> :${line}`;\n // Only an element the page shows now has a popup to open: its place is from the task, which may be old.\n const there = document.querySelector(`[data-deictic=\"${CSS.escape(`${file}:${line}:${column}`)}\"]`);\n if (there === null)\n return rowOf(t, element('span', { className: 'place', textContent: name, title: `Line ${line}, not on this page now` }));\n\n const go = element('button', { type: 'button', className: 'place', textContent: name, title: `Open the tasks of line ${line}` });\n go.addEventListener('click', () => void context.open('tasks', there));\n return rowOf(t, go);\n }),\n );\n const over = tasks.filter((t) => OVER.has(t.state));\n closed.hidden = over.length === 0;\n closedCount.textContent = `${over.length} closed`;\n ended.replaceChildren(...over.map((t) => rowOf(t)));\n const live = tasks.filter((t) => !OVER.has(t.state));\n // The latest is the last, which a list longer than its room would keep out of sight: as it opens, and after one is added.\n const grew = live.length > list.childElementCount;\n list.replaceChildren(\n ...live.map((t) => {\n if (t.id === editing && t.open) return editor(t);\n const item = rowOf(\n t,\n t.at === undefined\n ? undefined\n : element('span', {\n className: 'place',\n textContent: `was :${t.at.line}`,\n title: `Added when this was on line ${t.at.line}: it has moved since`,\n }),\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 const acts = element('span', { className: 'acts' });\n acts.append(edit, remove);\n item.append(acts);\n return item;\n }),\n );\n if (grew) list.scrollTop = list.scrollHeight;\n able();\n mark();\n };\n\n const back = context.resumed;\n /**\n * What the page says of the element: read now, while the page has it, and as the panel left it where the\n * page has moved on without it (a recording that went on to another), which is the page the task is about.\n */\n const facts = (): Facts => {\n const { element: el, elements } = context;\n if (!here && back !== undefined) return (back.state as Kept).facts;\n const chain = chainOf(el, context.target.loc.file);\n return {\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 ...(chain.length === 0 ? {} : { chain }),\n html: (shots?.masked(el) ?? el).outerHTML.slice(0, HTML),\n };\n };\n\n /**\n * The shots to attach: each chip's PNG, kept as a shot, as the person drew it, or a shot taken now where the\n * box is ticked. Only that one has the element outlined in it (or is as it was taken, where that can't be\n * drawn): nothing else in it says what it's about, while a shot someone annotated says what they marked.\n */\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 || !here) return undefined;\n add.textContent = 'Capturing…';\n const taken = await shots.capture(context.element);\n try {\n return [{ id: (await shots.upload(await outlined(taken.url, taken), taken)).id, box: taken.box, outlined: true }];\n } catch {\n return [{ id: taken.id, box: taken.box }];\n }\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 try {\n const { html, ...said } = facts();\n const op: Op = {\n text: text.value,\n ...said,\n ...(sendsHtml && withHtml.checked ? { html } : {}),\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 if (back !== undefined) {\n const kept = back.state as Kept;\n text.value = kept.text;\n attach.checked = kept.attach;\n withHtml.checked = kept.html;\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEd,MAAM,QAAQ,SACZ,0JAA0J,KAAK;AACjK,MAAM,OAAO,KAAK,yBAAyB;AAC3C,MAAM,SAAS,KAAK,qCAAqC;;AAEzD,MAAM,uBAAO,IAAI,IAAI,CAAC,aAAa,QAAQ,CAAC;AAC5C,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,IA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A,UAAU;GACV,KAAK;EACP;EAGA,IAAI,SAAS,KAAA,GAAW;GACtB,MAAM,OAAO,KAAK;GAClB,KAAK,QAAQ,KAAK;GAClB,OAAO,UAAU,KAAK;GACtB,SAAS,UAAU,KAAK;GACxB,QAAQ,KAAK,MAAM,IAAI,MAAM;GAC7B,aAAa,CAAC,GAAG,KAAK,YAAY,GAAI,KAAK,WAAW,KAAA,IAAY,CAAC,IAAI,CAAC,KAAK,MAAmB,CAAE;GAClG,SAAS,KAAK;GACd,IAAI,KAAK,YAAY,KAAA,GAAW,QAAQ,cAAc,KAAK;EAC7D;EAEA,KAAK,iBAAiB,eAAe;GACnC,KAAK;GACL,KAAK;EACP,CAAC;EACD,KAAK,iBAAiB,YAAY,MAAM;GACtC,IAAI,EAAE,QAAQ,WAAW,EAAE,EAAE,WAAW,EAAE,UAAU;GACpD,EAAE,eAAe;GACZ,KAAK;EACZ,CAAC;EACD,IAAI,iBAAiB,eAAe,KAAK,KAAK,CAAC;EAC/C,UAAU;EACV,OAAO,QAAQ,KAAK;EACpB,KAAK,MAAM;EACX,aAAa;GACX,OAAO,MAAM;GACb,MAAM,OAAO;GACb,cAAc,OAAO;GACrB,WAAW;GACX,KAAK,MAAM,KAAK,OAAO,IAAI,gBAAgB,EAAE,GAAG;EAClD;CACF;AACF,CAAC"}
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 * Beside the channel it says who watches it (`Model.watching`), or that no agent does.\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: the chain of source it rendered through, its HTML (a file attached), and where the\n * 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, the element\n * outlined in it as the task goes: nothing else says which of two rows alike was meant (a shot drawn on is\n * left as it was drawn). 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 * The element's HTML as it rendered goes with it too, as a file, unless its box is unticked (or the server\n * half's `html` option is off, and then there's no box).\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/* The column is no wider than the panel: an \\`auto\\` one grows to a long title, which then never truncates. */\n.tasks { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }\n/* Five rows, and the rest scrolled to: the field stays where it is however many there are. */\n.tasks { max-height: 112px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--deictic-line) transparent; }\n/* A task's words being changed need the room. */\n.tasks:has(.editing) { max-height: none; }\n.tasks li { position: relative; display: flex; gap: 6px; align-items: baseline; }\n.tasks .title { flex: 1; min-width: 0; padding: 0; border: 0; border-radius: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n/* Clicked, a task reads whole, as it was typed. */\n.tasks li.whole .title { white-space: pre-wrap; overflow-wrap: anywhere; }\n/* The state is a dot, named by its tooltip: a ring while no one has it, filled once someone does or it's over. */\n.tasks .state { flex: none; align-self: center; box-sizing: border-box; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n/* Room for Edit and Delete, which would lie over the first line's end. */\n.tasks li.whole:has(.acts) .title { padding-right: 40px; }\n.tasks li.whole .state { align-self: baseline; }\n.tasks .state.waiting { border-style: dotted; }\n.tasks .state.claimed { border-color: #60a5fa; background: #60a5fa; }\n.tasks .state.blocked { border-color: #fbbf24; background: #fbbf24; }\n.tasks .state.completed { border-color: #4ade80; background: #4ade80; }\n.tasks .state.failed { border-color: var(--deictic-problem); background: var(--deictic-problem); }\n.tasks a { color: inherit; text-decoration: none; }\n.tasks a:hover { text-decoration: underline; }\n/* Over the row's end, and only while the row is pointed at or focused in: the title keeps the width. */\n.tasks .acts { position: absolute; inset: 0 0 auto auto; min-height: 18px; display: none; align-items: center; padding-left: 14px; background: linear-gradient(to right, transparent, var(--deictic-bg) 12px); }\n.tasks li:hover .acts, .tasks li:focus-within .acts { display: flex; }\n.tasks .act { 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 .place { flex: none; padding: 0; border: 0; font: 11px ui-monospace, monospace; color: var(--deictic-muted); }\n.tasks button.place:hover { color: var(--deictic-fg); text-decoration: underline; }\n.more { margin: 0 0 8px; }\n.more[hidden] { display: none; }\n.more summary { cursor: pointer; font-size: 12px; color: var(--deictic-muted); }\n.more summary:hover { color: var(--deictic-fg); }\n.more .tasks { margin: 4px 0 0; }\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/* Cut short before it pushes Add out: a channel's name and its watchers' may be long. */\n.hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--deictic-muted); font-size: 12px; }\n/* A dot as a task's state is: a ring while no one watches, green while someone does. */\n.watch::before { content: ''; display: inline-block; box-sizing: border-box; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n.watch.on::before { border-color: #4ade80; background: #4ade80; }\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');\n/** The states of a task that's over, as a board names them: nothing more happens to it. */\nconst OVER = new Set(['completed', 'failed']);\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 html: boolean;\n drawn: Drawn[];\n recordings: Recording[];\n voices: Clip[];\n /** What the page said of the element as the panel left, for a task added where the page no longer has it. */\n facts: Facts;\n}\n\n/** What a task says that only the page with the element on it knows. */\ntype Facts = Pick<Op, 'page' | 'viewport' | 'pointed' | 'count' | 'chain'> & {\n /** The element's HTML, as it would be attached. */\n html: string;\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\nconst parentOf = (el: Element): Element | undefined => {\n if (el.parentElement !== null) return el.parentElement;\n const root = el.getRootNode();\n return root instanceof ShadowRoot ? root.host : undefined;\n};\n\n/** How many places a chain names after the element's own: who uses it, and who uses that. Further out is the app's shell. */\nconst CHAIN = 3;\n\n/**\n * What React keeps, in development, of who wrote an element: a fiber (its `type` the component), or for a server\n * component its `name`. Each has the one that wrote it in turn.\n */\ninterface Owner {\n name?: unknown;\n type?: unknown;\n alternate?: Owner | null;\n owner?: Owner | null;\n _debugOwner?: Owner | null;\n}\n\n/** React's fiber of an element it rendered, which it keeps on the element under a key of its own. */\nconst fiberOf = (el: Element): Owner | undefined => {\n const key = Object.keys(el).find((k) => k.startsWith('__reactFiber$'));\n return key === undefined ? undefined : (el as unknown as Record<string, Owner>)[key];\n};\n\nconst ownerOf = (of: Owner | undefined): Owner | undefined => of?._debugOwner ?? of?.owner ?? undefined;\n\n/** A component's name, through `memo` and `forwardRef`, or nothing for one written without. */\nfunction componentOf(owner: Owner): string | undefined {\n if (typeof owner.name === 'string') return owner.name === '' ? undefined : owner.name;\n let type = owner.type as { displayName?: unknown; name?: unknown; render?: unknown; type?: unknown } | null | undefined;\n for (let depth = 0; depth < 4 && type !== null && type !== undefined; depth++) {\n // A function's own name, where it has no `displayName`; a `memo` or `forwardRef` object has neither.\n const name = type.displayName ?? type.name;\n if (typeof name === 'string' && name !== '') return name;\n type = (type.render ?? type.type) as typeof type;\n }\n return undefined;\n}\n\n/**\n * The source `el` rendered through, after its own place, nearest first: a shared component's own line is the same\n * wherever it's used, and the change is most often in what uses it, or in what uses that.\n *\n * With React in development, those are the components that wrote it, each the one whose JSX has the one before:\n * `Field (src/Field.tsx:20)`, its line the nearest element around `el` that the component wrote, or the name alone\n * for one with no element of its own around it (it wraps what it uses only in other components), which the marks\n * can't show at all. A layout component the element was only passed through isn't among them.\n *\n * Without (another framework, a production build) it's read off the marks around it, each a `file:line`: the\n * nearest element each next file wrote.\n */\nfunction chainOf(el: Element, file: string): NonNullable<Op['chain']> {\n const found: NonNullable<Op['chain']> = [];\n const wrote = ownerOf(fiberOf(el));\n if (wrote !== undefined) {\n for (let owner = ownerOf(wrote); owner !== undefined && found.length < CHAIN; owner = ownerOf(owner)) {\n const name = componentOf(owner);\n let place: string | undefined;\n for (let at = parentOf(el); at !== undefined && place === undefined; at = parentOf(at)) {\n const by = ownerOf(fiberOf(at));\n // A component's fiber is one of two, by turns: an element may name either.\n if (by === undefined || (by !== owner && by !== owner.alternate)) continue;\n place = at.getAttribute('data-deictic')?.replace(/:\\d+$/, '');\n }\n if (name !== undefined) found.push(place === undefined ? name : `${name} (${place})`);\n else if (place !== undefined) found.push(place);\n }\n if (found.length > 0) return found;\n }\n let last = file;\n for (let at = parentOf(el); at !== undefined && found.length < CHAIN; at = parentOf(at)) {\n const mark = at.getAttribute('data-deictic');\n if (mark === null) continue;\n const from = mark.replace(/:\\d+:\\d+$/, '');\n if (from === last) continue;\n last = from;\n found.push(mark.replace(/:\\d+$/, ''));\n }\n return found;\n}\n\n/** What's sent of the element's HTML at most, in characters: the server attaches it as a file. */\nconst HTML = 100_000;\n\n/** The overlay's own green, as its outline of the element while the popup is open. */\nconst OUTLINE = '#12b358';\n/** CSS pixels between the element and its outline, so the dashes are on nothing of the element's. */\nconst ROOM = 3;\n\n/**\n * A shot's PNG with the element outlined in it: dashes around its box, with nothing between them, as the overlay\n * draws it. The shot may have more pixels than its size in CSS ones, which the box is in.\n */\nasync function outlined(png: Blob | string, { box, size }: Pick<Shot, 'box' | 'size'>): Promise<Blob> {\n const url = typeof png === 'string' ? png : URL.createObjectURL(png);\n try {\n const image = new Image();\n image.src = url;\n await image.decode();\n const canvas = element('canvas', { width: image.naturalWidth, height: image.naturalHeight });\n const ctx = canvas.getContext('2d');\n if (ctx === null) throw new Error(\"tasks: this browser won't draw to a canvas\");\n ctx.drawImage(image, 0, 0);\n const k = image.naturalWidth / size.width;\n const rect = [(box.x - ROOM) * k, (box.y - ROOM) * k, (box.width + 2 * ROOM) * k, (box.height + 2 * ROOM) * k] as const;\n ctx.lineWidth = 2 * k;\n ctx.strokeStyle = OUTLINE;\n ctx.setLineDash([6 * k, 4 * k]);\n ctx.strokeRect(...rect);\n return await new Promise<Blob>((done, fail) =>\n canvas.toBlob((blob) => (blob === null ? fail(new Error('tasks: the screenshot drew nothing')) : done(blob)), 'image/png'),\n );\n } finally {\n if (typeof png !== 'string') URL.revokeObjectURL(url);\n }\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 // All the panel leaves for is a recording, which a page load doesn't end.\n resume: ({ use }) => use('recordings')?.going(),\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 // The file's other tasks, folded away: the panel is about this element. It stays as it's left while the panel is up.\n const fold = element('details', { className: 'more' });\n const count = element('summary');\n const others = element('ul', { className: 'tasks' });\n fold.append(count, others);\n // The element's tasks that are over, folded away too: what's still to do is what's read first.\n const closed = element('details', { className: 'more' });\n const closedCount = element('summary');\n const ended = element('ul', { className: 'tasks' });\n closed.append(closedCount, ended);\n panel.append(style, list, closed, fold, text);\n\n const shots = context.use('screenshots');\n // Back from a recording that went on to a page without the element: there's nothing here to take a shot of.\n const here = context.element.isConnected;\n const notes = context.use('annotations');\n const recorder = context.use('recordings');\n const voice = context.use('voice');\n // The server half's `html` option, which takes the box away; a page half with no options (a `standalone` server's) has it.\n const sendsHtml = (context.options as { html?: boolean } | undefined)?.html !== false;\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 || !here });\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 && here ? [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 // Its own line: the screenshot's gives way to the chips, and this is asked whatever else is attached.\n const withHtml = element('input', { type: 'checkbox', checked: true });\n const htmlToggle = element('label', { title: 'The element as the page has it now, as a file: element.html' });\n htmlToggle.append(withHtml, 'Attach HTML snapshot');\n const htmlRow = element('div', { className: 'shot' });\n htmlRow.append(htmlToggle);\n if (sendsHtml) panel.append(htmlRow);\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 && here ? [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, html: withHtml.checked, drawn, recordings, voices, facts: facts() };\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 tasks shown whole, by ID: kept over a change, which draws the list again.\n const whole = new Set<string>();\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, elsewhere, watching } = 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 // Whether a task added now is taken up: who watches the channel, or that no one does, where that's known.\n if (watching !== undefined) {\n const names = new Intl.ListFormat('en', { type: 'conjunction' }).format(watching);\n const on = watching.length > 0;\n const who = element('span', {\n className: on ? 'watch on' : 'watch',\n textContent: on ? `${names} watching` : 'no agent watching',\n title: on\n ? `${names} ${watching.length === 1 ? 'is' : 'are'} watching #${channel}, and take${watching.length === 1 ? 's' : ''} each task as it's added`\n : `A task waits on the board until an agent watches #${channel}: ask yours to watch deictic's tasks`,\n });\n hint.append(' · ', who);\n }\n /** A task's row: its state, its ID, a link where it has a page, its title, and where it's from when that's said. */\n const rowOf = (t: Task, from?: HTMLElement) => {\n const item = element('li');\n const state = element('span', { className: `state ${t.state}`, title: t.by === undefined ? t.state : `${t.state} by ${t.by}` });\n state.role = 'img';\n const id = element('code', { textContent: `#${t.id}` });\n const title = element('button', { type: 'button', className: 'title' });\n // In place, not by drawing the list again: that would take a task's words being changed with it.\n const show = () => {\n const all = whole.has(t.id);\n item.classList.toggle('whole', all);\n title.textContent = all ? t.text : t.title;\n title.title = all ? 'Show its first line only' : 'Show all of it';\n title.ariaExpanded = String(all);\n };\n title.addEventListener('click', () => {\n if (!whole.delete(t.id)) whole.add(t.id);\n show();\n });\n show();\n const to =\n t.link === undefined\n ? id\n : element('a', { href: t.link, target: '_blank', rel: 'noreferrer', title: 'Open the task on the board' });\n if (to !== id) to.append(id);\n item.append(state, to, title, ...(from === undefined ? [] : [from]));\n return item;\n };\n const { file } = context.target.loc;\n fold.hidden = elsewhere.length === 0;\n count.textContent = `${elsewhere.length} elsewhere in ${file.split('/').at(-1)}`;\n others.replaceChildren(\n ...elsewhere.map((t) => {\n if (t.at === undefined) return rowOf(t);\n const { line, column, tag } = t.at;\n const name = `<${tag}> :${line}`;\n // Only an element the page shows now has a popup to open: its place is from the task, which may be old.\n const there = document.querySelector(`[data-deictic=\"${CSS.escape(`${file}:${line}:${column}`)}\"]`);\n if (there === null)\n return rowOf(t, element('span', { className: 'place', textContent: name, title: `Line ${line}, not on this page now` }));\n\n const go = element('button', { type: 'button', className: 'place', textContent: name, title: `Open the tasks of line ${line}` });\n go.addEventListener('click', () => void context.open('tasks', there));\n return rowOf(t, go);\n }),\n );\n const over = tasks.filter((t) => OVER.has(t.state));\n closed.hidden = over.length === 0;\n closedCount.textContent = `${over.length} closed`;\n ended.replaceChildren(...over.map((t) => rowOf(t)));\n const live = tasks.filter((t) => !OVER.has(t.state));\n // The latest is the last, which a list longer than its room would keep out of sight: as it opens, and after one is added.\n const grew = live.length > list.childElementCount;\n list.replaceChildren(\n ...live.map((t) => {\n if (t.id === editing && t.open) return editor(t);\n const item = rowOf(\n t,\n t.at === undefined\n ? undefined\n : element('span', {\n className: 'place',\n textContent: `was :${t.at.line}`,\n title: `Added when this was on line ${t.at.line}: it has moved since`,\n }),\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 const acts = element('span', { className: 'acts' });\n acts.append(edit, remove);\n item.append(acts);\n return item;\n }),\n );\n if (grew) list.scrollTop = list.scrollHeight;\n able();\n mark();\n };\n\n const back = context.resumed;\n /**\n * What the page says of the element: read now, while the page has it, and as the panel left it where the\n * page has moved on without it (a recording that went on to another), which is the page the task is about.\n */\n const facts = (): Facts => {\n const { element: el, elements } = context;\n if (!here && back !== undefined) return (back.state as Kept).facts;\n const chain = chainOf(el, context.target.loc.file);\n return {\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 ...(chain.length === 0 ? {} : { chain }),\n html: (shots?.masked(el) ?? el).outerHTML.slice(0, HTML),\n };\n };\n\n /**\n * The shots to attach: each chip's PNG, kept as a shot, as the person drew it, or a shot taken now where the\n * box is ticked. Only that one has the element outlined in it (or is as it was taken, where that can't be\n * drawn): nothing else in it says what it's about, while a shot someone annotated says what they marked.\n */\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 || !here) return undefined;\n add.textContent = 'Capturing…';\n const taken = await shots.capture(context.element);\n try {\n return [{ id: (await shots.upload(await outlined(taken.url, taken), taken)).id, box: taken.box, outlined: true }];\n } catch {\n return [{ id: taken.id, box: taken.box }];\n }\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 try {\n const { html, ...said } = facts();\n const op: Op = {\n text: text.value,\n ...said,\n ...(sendsHtml && withHtml.checked ? { html } : {}),\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 const dropped = model.tasks.at(-1)?.dropped;\n if (dropped !== undefined) problem.textContent = `Sent without ${dropped}: it wasn't kept any more`;\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 if (back !== undefined) {\n const kept = back.state as Kept;\n text.value = kept.text;\n attach.checked = kept.attach;\n withHtml.checked = kept.html;\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEd,MAAM,QAAQ,SACZ,0JAA0J,KAAK;AACjK,MAAM,OAAO,KAAK,yBAAyB;AAC3C,MAAM,SAAS,KAAK,qCAAqC;;AAEzD,MAAM,uBAAO,IAAI,IAAI,CAAC,aAAa,QAAQ,CAAC;AAC5C,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;AAgCA,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,OA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