deictic 0.7.0 → 0.8.1

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.
Files changed (73) hide show
  1. package/API.md +23 -3
  2. package/README.md +2 -1
  3. package/dist/bun.js +1 -1
  4. package/dist/client/index.d.ts +1 -1
  5. package/dist/client/index.d.ts.map +1 -1
  6. package/dist/client/index.js +77 -51
  7. package/dist/client/index.js.map +1 -1
  8. package/dist/index.d.ts +2 -2
  9. package/dist/next.js +1 -1
  10. package/dist/recommended/index.d.ts +1 -1
  11. package/dist/recordings/client.js +8 -2
  12. package/dist/recordings/client.js.map +1 -1
  13. package/dist/screenshots/rrweb.d.ts.map +1 -1
  14. package/dist/screenshots/rrweb.js +11 -2
  15. package/dist/screenshots/rrweb.js.map +1 -1
  16. package/dist/shared/canvas.js +30 -0
  17. package/dist/shared/canvas.js.map +1 -0
  18. package/dist/shared/endpoints.js +26 -6
  19. package/dist/shared/endpoints.js.map +1 -1
  20. package/dist/shared/find.js +6 -1
  21. package/dist/shared/find.js.map +1 -1
  22. package/dist/shared/frame.js +5 -2
  23. package/dist/shared/frame.js.map +1 -1
  24. package/dist/shared/index.d.ts +35 -3
  25. package/dist/shared/index.d.ts.map +1 -1
  26. package/dist/shared/index7.d.ts +22 -2
  27. package/dist/shared/index7.d.ts.map +1 -1
  28. package/dist/shared/index9.d.ts +1 -1
  29. package/dist/shared/integration.d.ts +1 -1
  30. package/dist/shared/integration.js +59 -5
  31. package/dist/shared/integration.js.map +1 -1
  32. package/dist/shared/package.js +23 -0
  33. package/dist/shared/package.js.map +1 -0
  34. package/dist/shared/packages.js +14 -23
  35. package/dist/shared/packages.js.map +1 -1
  36. package/dist/shared/playwright.js +32 -6
  37. package/dist/shared/playwright.js.map +1 -1
  38. package/dist/shared/src.js.map +1 -1
  39. package/dist/shared/task.js +12 -3
  40. package/dist/shared/task.js.map +1 -1
  41. package/dist/shared/tasks.js +52 -4
  42. package/dist/shared/tasks.js.map +1 -1
  43. package/dist/shared/watch.js +2 -1
  44. package/dist/shared/watch.js.map +1 -1
  45. package/dist/tailwind/index.js +7 -2
  46. package/dist/tailwind/index.js.map +1 -1
  47. package/dist/tasks/client.d.ts.map +1 -1
  48. package/dist/tasks/client.js +50 -9
  49. package/dist/tasks/client.js.map +1 -1
  50. package/dist/tasks/index.d.ts +2 -2
  51. package/dist/webpack.js +1 -1
  52. package/package.json +2 -1
  53. package/src/cli/find.ts +5 -1
  54. package/src/cli/frame.ts +6 -3
  55. package/src/cli/task.ts +20 -4
  56. package/src/cli/watch.ts +3 -1
  57. package/src/client/index.ts +76 -43
  58. package/src/index.ts +35 -2
  59. package/src/plugins/recordings/client.ts +8 -2
  60. package/src/plugins/screenshots/canvas.ts +27 -0
  61. package/src/plugins/screenshots/playwright.ts +34 -7
  62. package/src/plugins/screenshots/rrweb.ts +30 -9
  63. package/src/plugins/tailwind/index.ts +3 -2
  64. package/src/plugins/tasks/client.ts +13 -3
  65. package/src/plugins/tasks/composer.ts +1 -1
  66. package/src/plugins/tasks/drawer.ts +3 -3
  67. package/src/plugins/tasks/index.ts +81 -3
  68. package/src/plugins/tasks/pins.ts +12 -7
  69. package/src/plugins/tasks/which.ts +34 -0
  70. package/src/tools/endpoints.ts +31 -5
  71. package/src/tools/packages.ts +12 -4
  72. package/src/tools/plugins.ts +18 -4
  73. package/src/tools/problems.ts +60 -0
@@ -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(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,SAAS,KAAA,IAAY,IAAI,SAAS,IAAI,CAAC,CAAC;CAC7D,IAAI,QAAQ,MAAM;CAClB,IAAI,UAAU,MAAM,MAAM;CAE1B,MAAM,eAAwB;EAC5B,MAAM,MAAM,MAAM;EAClB,IAAI,QAAQ,OAAO;GACjB,QAAQ;GACH,MAAM,CAAC,CAAC,MACV,SAAU,UAAU,YACf,CAAC,CACT;EACF;EACA,OAAO;CACT;CACA,OAAO;EACL,WAAW,OAAO,UAAU,OAAO,CAAC,CAAC,SAAS,OAAO,KAAK;EAC1D,OAAO,YAAY,OAAO,CAAC,CAAC,KAAK,OAAO;EACxC,eAAe,SAAS,OAAO,CAAC,CAAC,aAAa,IAAI;EAClD,MAAM,YAAY,OAAO,CAAC,CAAC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O,EAAE,UAAU,UAAU,OAAO,KAAK,GAAG,IAAI;CAC5E,IAAI,EAAE,SAAS,qBAAqB,EAAE,YAAY,WAAW,GAAG,OAAO,KAAK,GAAG,IAAI;AAErF;AAEA,MAAM,QAAQ,MAAsC,UAAwB;CAC1E,MAAM;CACN,OAAO,KAAK,QAAQ;CACpB,KAAK,KAAK,MAAM;CAChB,OAAO,KAAK,KAAK;AACnB;;AAGA,SAAS,OAAO,MAAc,OAAuB;CACnD,IAAI,UAAU,KAAK,OAAO,KAAK,WAAW,MAAM,MAAM,CAAC,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC,WAAW,MAAM,MAAM;CACtG,IAAI,CAAC,KAAK,SAAS,KAAK,GAAG,OAAO;CAClC,MAAM,IAAI,QAAQ,sBAAsB,MAAM,wEAAwE;AACxH;;AAGA,SAAS,KAAK,QAAgB,OAAuB;CACnD,MAAM,MAAM,IAAI,IAAI,OAAO,MAAM,KAAK,CAAC,CAAC,OAAO,OAAO,CAAC;CACvD,MAAM,MAAM,IAAI,IAAI,MAAM,MAAM,KAAK,CAAC,CAAC,OAAO,OAAO,CAAC;CACtD,MAAM,QAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,QAAQ,MAAM,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
+ {"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, report }: ServerContext) =>\n (loading ??= loadCatalog(root, options.css).catch((problem: unknown) => {\n const message = problem instanceof Error ? problem.message : String(problem);\n report({ key: 'setup:tailwind', kind: 'setup', plugin: 'tailwind', message: `no completions or class details, as ${message}` });\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,SAAS,KAAA,IAAY,IAAI,SAAS,IAAI,CAAC,CAAC;CAC7D,IAAI,QAAQ,MAAM;CAClB,IAAI,UAAU,MAAM,MAAM;CAE1B,MAAM,eAAwB;EAC5B,MAAM,MAAM,MAAM;EAClB,IAAI,QAAQ,OAAO;GACjB,QAAQ;GACH,MAAM,CAAC,CAAC,MACV,SAAU,UAAU,YACf,CAAC,CACT;EACF;EACA,OAAO;CACT;CACA,OAAO;EAC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S,IAAI,MAAM,KAAK,GAAG,IAAI;AAC9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","names":[],"sources":["../../src/plugins/tasks/client.ts"],"mappings":";;qBAmJa;cAwBb,4B"}
1
+ {"version":3,"file":"client.d.ts","names":[],"sources":["../../src/plugins/tasks/client.ts"],"mappings":";;qBAoJa;cAwBb,4B"}
@@ -844,6 +844,36 @@ function storeOf(context) {
844
844
  made$2.set(context.root, store);
845
845
  return store;
846
846
  }
847
+ // src/plugins/tasks/which.ts
848
+ /**
849
+ * Which element a task is about, where one place in the source renders several (a list's items, a `map`): the mark
850
+ * alone finds the first of them, so a task keeps its place among them and its text, and is found again by those.
851
+ */
852
+ /** As much of an element's text as tells it from its siblings, and as a label holds. */
853
+ const SAID = 120;
854
+ const textOf = (el) => (el.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, SAID);
855
+ /** Which of `alike` (the elements with its mark, in the page's order) `el` is; its text as `said` has it, which may be masked. */
856
+ function whichOf(el, alike, said = el) {
857
+ const text = textOf(said);
858
+ return {
859
+ nth: alike.indexOf(el) + 1,
860
+ ...text === "" ? {} : { text }
861
+ };
862
+ }
863
+ /**
864
+ * The element a task is about on this page: the only one with its mark, or the one of several with its text, else the
865
+ * one at its place among them. None where it was one of more than the page has now and its text is on none of them.
866
+ */
867
+ function elementOf(task) {
868
+ if (task.place === void 0) return null;
869
+ const alike = [...document.querySelectorAll(`[${ATTRIBUTE}="${CSS.escape(task.place)}"]`)];
870
+ const { which } = task;
871
+ if (which === void 0 || alike.length <= 1) return alike[0] ?? null;
872
+ const at = alike[which.nth - 1];
873
+ const said = which.text === void 0 ? [] : alike.filter((el) => textOf(el) === which.text);
874
+ if (said.length > 0) return at !== void 0 && said.includes(at) ? at : said[0];
875
+ return at ?? null;
876
+ }
847
877
  // src/plugins/tasks/drawer.ts
848
878
  /**
849
879
  * The tasks' section of the drawer: the channel's tasks still to do, each with its state, and the latest finished
@@ -984,9 +1014,9 @@ function drawerOf(context) {
984
1014
  finishedRows.append(putAway);
985
1015
  finished.append(finishedCount, finishedRows);
986
1016
  section.append(element("style", { textContent: STYLE$2 }), heading, rows, finished);
987
- const elementOf = (task) => task.place === void 0 ? null : document.querySelector(`[${ATTRIBUTE}="${CSS.escape(task.place)}"]`);
988
1017
  /** What a task is about, as the caption says an element: by its component where the page has it, else its tag. */
989
1018
  const about = (task) => {
1019
+ if (task.problem !== void 0) return task.problem === "setup" ? "deictic's setup" : "a bug in deictic";
990
1020
  if (task.place === void 0) return "the page";
991
1021
  const el = elementOf(task);
992
1022
  if (el !== null) return tell(named(el));
@@ -1485,7 +1515,6 @@ function pinsIn(context) {
1485
1515
  let leaving;
1486
1516
  const pins = /* @__PURE__ */ new Map();
1487
1517
  let frames = 0;
1488
- const elementAt = (at) => document.querySelector(`[data-deictic="${CSS.escape(at)}"]`);
1489
1518
  const pinOf = (at, el, spot) => {
1490
1519
  const box = div("pin");
1491
1520
  const badge = Object.assign(document.createElement("button"), {
@@ -1539,7 +1568,11 @@ function pinsIn(context) {
1539
1568
  const draw = () => {
1540
1569
  if (layer === void 0) return;
1541
1570
  const tasks = store.tasks().filter((t) => t.place !== void 0 && !OVER.has(t.state));
1542
- const keyOf = (t) => t.point === void 0 ? t.place : `${t.place}@${t.point.x},${t.point.y}`;
1571
+ const keyOf = (t) => {
1572
+ const el = elementOf(t);
1573
+ const of = el === null ? t.place : `${t.place}#${sameAs(el).indexOf(el)}`;
1574
+ return t.point === void 0 ? of : `${of}@${t.point.x},${t.point.y}`;
1575
+ };
1543
1576
  const byPlace = /* @__PURE__ */ new Map();
1544
1577
  for (const t of tasks) byPlace.set(keyOf(t), [...byPlace.get(keyOf(t)) ?? [], t]);
1545
1578
  for (const [at, pin] of pins) {
@@ -1550,8 +1583,9 @@ function pinsIn(context) {
1550
1583
  for (const [at, list] of byPlace) {
1551
1584
  let pin = pins.get(at);
1552
1585
  if (pin === void 0) {
1553
- const [{ place: where, point }] = list;
1554
- const el = elementAt(where);
1586
+ const [first] = list;
1587
+ const { place: where, point } = first;
1588
+ const el = elementOf(first);
1555
1589
  if (el === null) continue;
1556
1590
  pin = pinOf(where, el, point);
1557
1591
  pins.set(at, pin);
@@ -1567,7 +1601,7 @@ function pinsIn(context) {
1567
1601
  const height = document.documentElement.clientHeight;
1568
1602
  const look = frames++ % 20 === 0;
1569
1603
  for (const pin of pins.values()) {
1570
- if (!pin.el.isConnected && look) pin.el = elementAt(pin.place) ?? pin.el;
1604
+ if (!pin.el.isConnected && look && pin.tasks[0] !== void 0) pin.el = elementOf(pin.tasks[0]) ?? pin.el;
1571
1605
  const whole = pin.el.getBoundingClientRect();
1572
1606
  const r = pin.at === void 0 ? whole : new DOMRect(whole.left + pin.at.x, whole.top + pin.at.y, 0, 0);
1573
1607
  const seen = pin.el.isConnected && whole.width > 0 && whole.height > 0 && r.bottom > 0 && r.top < height && r.right > 0 && r.left < width;
@@ -1820,15 +1854,18 @@ var client_default = defineClientPlugin({
1820
1854
  if (el === void 0) return a.seen;
1821
1855
  const chain = chainOf(el, a.target.loc.file);
1822
1856
  const { pointed, at } = context;
1857
+ const masked = shots?.masked(el) ?? el;
1858
+ const alike = sameAs(el);
1823
1859
  return {
1824
1860
  ...a.own && at !== void 0 ? { point: at } : {},
1825
1861
  ...a.own && pointed !== void 0 ? { pointed: {
1826
1862
  path: pathTo(pointed, el),
1827
1863
  html: pointed.outerHTML.slice(0, 4e3)
1828
1864
  } } : {},
1829
- count: sameAs(el).length,
1865
+ count: alike.length,
1866
+ ...alike.length > 1 ? { which: whichOf(el, alike, masked) } : {},
1830
1867
  ...chain.length === 0 ? {} : { chain },
1831
- html: (shots?.masked(el) ?? el).outerHTML.slice(0, HTML)
1868
+ html: masked.outerHTML.slice(0, HTML)
1832
1869
  };
1833
1870
  };
1834
1871
  /** The page the task is about: this one, or the one the panel left where none of its elements is on this one. */
@@ -1920,7 +1957,11 @@ var client_default = defineClientPlugin({
1920
1957
  announce(model, op, on, (screenshots ?? []).map((shot) => shot.url));
1921
1958
  const added = model.tasks.at(-1);
1922
1959
  composer.note.textContent = first === void 0 ? "Added, about the page: it is in the drawer" : `Added${added === void 0 ? "" : ` #${added.id}`}: it is in the drawer`;
1923
- if (added?.dropped !== void 0) composer.problem.textContent = `Sent without ${added.dropped}: it wasn't kept any more`;
1960
+ if (added?.dropped !== void 0) {
1961
+ composer.problem.textContent = `Sent without ${added.dropped}: it wasn't kept any more`;
1962
+ return true;
1963
+ }
1964
+ setTimeout(context.close);
1924
1965
  return true;
1925
1966
  }
1926
1967
  });