deictic 0.8.1 → 0.9.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.
Files changed (103) hide show
  1. package/API.md +71 -17
  2. package/README.md +1 -1
  3. package/dist/annotations/client.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/cli.js.map +1 -1
  6. package/dist/client/index.d.ts +13 -13
  7. package/dist/client/index.d.ts.map +1 -1
  8. package/dist/client/index.js +11 -7
  9. package/dist/client/index.js.map +1 -1
  10. package/dist/react/client.d.ts +19 -0
  11. package/dist/react/client.d.ts.map +1 -0
  12. package/dist/react/client.js +504 -0
  13. package/dist/react/client.js.map +1 -0
  14. package/dist/react/index.d.ts +2 -0
  15. package/dist/react/index.js +1 -0
  16. package/dist/recommended/index.d.ts +15 -7
  17. package/dist/recommended/index.d.ts.map +1 -1
  18. package/dist/recommended/index.js +1 -1
  19. package/dist/recordings/client.d.ts.map +1 -1
  20. package/dist/recordings/client.js +48 -5
  21. package/dist/recordings/client.js.map +1 -1
  22. package/dist/screenshots/client.d.ts +9 -1
  23. package/dist/screenshots/client.d.ts.map +1 -1
  24. package/dist/screenshots/rrweb.d.ts +0 -6
  25. package/dist/screenshots/rrweb.d.ts.map +1 -1
  26. package/dist/screenshots/rrweb.js +46 -12
  27. package/dist/screenshots/rrweb.js.map +1 -1
  28. package/dist/shared/board.js +1 -1
  29. package/dist/shared/client.js +44 -2
  30. package/dist/shared/client.js.map +1 -1
  31. package/dist/shared/dom.js +7 -1
  32. package/dist/shared/dom.js.map +1 -1
  33. package/dist/shared/drawer.js +1 -1
  34. package/dist/shared/endpoints.js +1 -1
  35. package/dist/shared/index.d.ts +6 -0
  36. package/dist/shared/index.d.ts.map +1 -1
  37. package/dist/shared/index10.d.ts +70 -0
  38. package/dist/shared/index10.d.ts.map +1 -0
  39. package/dist/shared/index3.d.ts +11 -0
  40. package/dist/shared/index3.d.ts.map +1 -1
  41. package/dist/shared/index7.d.ts +92 -312
  42. package/dist/shared/index7.d.ts.map +1 -1
  43. package/dist/shared/index8.d.ts +324 -47
  44. package/dist/shared/index8.d.ts.map +1 -1
  45. package/dist/shared/index9.d.ts +45 -63
  46. package/dist/shared/index9.d.ts.map +1 -1
  47. package/dist/shared/init.js +15 -11
  48. package/dist/shared/init.js.map +1 -1
  49. package/dist/shared/marks.js +7 -1
  50. package/dist/shared/marks.js.map +1 -1
  51. package/dist/shared/package.js +3 -1
  52. package/dist/shared/packages.js +1 -1
  53. package/dist/shared/playwright.js +39 -1
  54. package/dist/shared/playwright.js.map +1 -1
  55. package/dist/shared/react.js +25 -0
  56. package/dist/shared/react.js.map +1 -0
  57. package/dist/shared/recommended.js +6 -3
  58. package/dist/shared/recommended.js.map +1 -1
  59. package/dist/shared/recording.js +80 -3
  60. package/dist/shared/recording.js.map +1 -1
  61. package/dist/shared/recordings.js +30 -2
  62. package/dist/shared/recordings.js.map +1 -1
  63. package/dist/shared/screenshots.js.map +1 -1
  64. package/dist/shared/src.js.map +1 -1
  65. package/dist/shared/task.js +1 -0
  66. package/dist/shared/task.js.map +1 -1
  67. package/dist/shared/tasks.js +11 -0
  68. package/dist/shared/tasks.js.map +1 -1
  69. package/dist/tailwind/client.d.ts +1 -1
  70. package/dist/tailwind/index.d.ts +1 -1
  71. package/dist/tasks/client.d.ts +1 -1
  72. package/dist/tasks/client.js +45 -19
  73. package/dist/tasks/client.js.map +1 -1
  74. package/dist/tasks/index.d.ts +1 -1
  75. package/dist/voice/client.d.ts +1 -1
  76. package/dist/voice/client.js +1 -1
  77. package/dist/voice/index.d.ts +1 -1
  78. package/package.json +25 -1
  79. package/src/cli/bun.ts +2 -2
  80. package/src/cli/init.ts +14 -9
  81. package/src/cli/recording.ts +90 -4
  82. package/src/cli/task.ts +4 -0
  83. package/src/cli.ts +13 -6
  84. package/src/client/dom.ts +14 -0
  85. package/src/client/index.ts +21 -14
  86. package/src/index.ts +6 -0
  87. package/src/plugins/react/client.ts +162 -0
  88. package/src/plugins/react/index.ts +130 -0
  89. package/src/plugins/react/renders.ts +219 -0
  90. package/src/plugins/react/serialize.ts +139 -0
  91. package/src/plugins/react/timeline.ts +143 -0
  92. package/src/plugins/recommended/index.ts +17 -5
  93. package/src/plugins/recordings/client.ts +64 -4
  94. package/src/plugins/recordings/marks.ts +7 -0
  95. package/src/plugins/recordings/replay.ts +30 -2
  96. package/src/plugins/screenshots/client.ts +42 -2
  97. package/src/plugins/screenshots/index.ts +11 -0
  98. package/src/plugins/screenshots/playwright.ts +65 -1
  99. package/src/plugins/screenshots/rrweb.ts +55 -28
  100. package/src/plugins/screenshots/states.ts +26 -0
  101. package/src/plugins/tasks/client.ts +41 -6
  102. package/src/plugins/tasks/composer.ts +24 -7
  103. package/src/plugins/tasks/index.ts +16 -2
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":[],"sources":["../../src/plugins/screenshots/client.ts"],"sourcesContent":["/**\n * The screenshots plugin's page half, around a renderer's capture: the renderer makes the shot (a PNG,\n * or what its server half makes one of), and this sends it to the plugin's `add` route and answers the\n * `Shot`. A renderer's page module default-exports `screenshotsClient(itsCapture)`.\n *\n * Its tool in the tool panel takes the window as it is, with what's drawn on the page, and puts the shot in the\n * tray, for the next task.\n */\nimport { toolButton } from '#src/client/dom.ts';\nimport { trayed } from '#src/client/drawer.ts';\nimport { defineClientPlugin } from '#src/index.ts';\nimport type { Annotations } from '#src/plugins/annotations/index.ts';\n\nimport type { Box, Capture, CaptureOptions, ResolvedMasking, Shot } from './index.ts';\n\n/**\n * What a renderer's page half makes of the element: a body for `add`, its type, and where the element is\n * in the shot. `overlay(area)` is what's drawn over the page in that part of the viewport, in viewport CSS\n * pixels, as an SVG that size, or nothing: the annotations plugin's marks, where it's loaded. The renderer\n * draws it over the shot, as deictic's own layers are left out.\n */\nexport type PageCapture = (\n element: Element,\n options: {\n area: NonNullable<CaptureOptions['area']>;\n masking: ResolvedMasking;\n renderer: unknown;\n overlay: (area: Box) => string | undefined;\n },\n) => Promise<{ body: Blob | string; type: string; box: Box }>;\n\n/** Leaves out deictic's own UI: the overlay with its hover outline and any open panel. */\nexport const notOurs = (node: Node) => !(node instanceof Element && node.localName === 'deictic-overlay');\n\n/** The element's box, in CSS pixels from the viewport's top left, or from its own for a shot of it alone. */\nexport function boxOf(element: Element, area: NonNullable<CaptureOptions['area']>): Box {\n const { x, y, width, height } = element.getBoundingClientRect();\n return area === 'element' ? { x: 0, y: 0, width, height } : { x, y, width, height };\n}\n\nconst BLANK = '#d4d4d8';\n/** A camera, on a 24-pixel grid. */\nconst CAMERA = '<path d=\"M4 8h3l2-3h6l2 3h3v11H4z\"/><circle cx=\"12\" cy=\"13\" r=\"3.5\"/>';\n\nconst selector = (className: string, extra: string | undefined) => [`.${CSS.escape(className)}`, ...(extra ? [extra] : [])].join(', ');\n\n/**\n * Hides in a copy of the page's what rrweb would: blocked elements become a blank box their size (the copy keeps each\n * element's size as its styles), masked text keeps its spaces but shows `*`, and so do passwords' values,\n * or every field's.\n */\nexport function mask(copy: Node, m: ResolvedMasking): void {\n if (!(copy instanceof Element)) return;\n const all = (sel: string) => [...(copy.matches(sel) ? [copy] : []), ...copy.querySelectorAll(sel)];\n const stars = (text: string) => text.replace(/\\S/g, '*');\n for (const el of all(selector(m.blockClass, m.blockSelector))) {\n el.replaceChildren();\n if (el instanceof HTMLElement || el instanceof SVGElement) el.style.background = BLANK;\n }\n for (const el of all(selector(m.maskTextClass, m.maskTextSelector))) {\n const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT);\n for (let text = walker.nextNode(); text !== null; text = walker.nextNode()) text.textContent = stars(text.textContent ?? '');\n }\n for (const field of all('input, textarea')) {\n if (!(field instanceof HTMLInputElement || field instanceof HTMLTextAreaElement)) continue;\n if (!m.maskAllInputs && !(field instanceof HTMLInputElement && field.type === 'password')) continue;\n field.value = stars(field.value);\n field.setAttribute('value', field.value);\n if (field instanceof HTMLTextAreaElement) field.textContent = field.value;\n }\n}\n\nexport function screenshotsClient(capture: PageCapture) {\n return defineClientPlugin<never, never, Capture>({\n name: 'screenshots',\n setup: ({ base, request, options, use, tools, tray, drawer, lightbox }) => {\n const { masking, renderer } = options as { masking: ResolvedMasking; renderer: unknown };\n // Asked at each shot: the annotations plugin may be set up after this one.\n const overlay = (area: Box) => {\n const marks: Annotations | undefined = use('annotations');\n return marks?.svg(area);\n };\n const add = async (body: Blob | string, type: string, { box, size }: Pick<Shot, 'box' | 'size'>): Promise<Shot> => {\n const res = await request('add', { method: 'POST', headers: { 'content-type': type }, body });\n // `url`: where the shot is, said by what keeps it with no server to serve it from (a `standalone` build).\n // `box`: where the element is in a shot drawn again elsewhere, which is what's true of the PNG.\n const { id, url, problem, box: drawn } = (await res.json()) as { id?: string; url?: string; problem?: string; box?: Box };\n if (id === undefined) throw new Error(`screenshots: ${problem ?? res.statusText}`);\n return { id, url: url ?? `${base}__deictic/plugins/screenshots/shot/${id}`, box: drawn ?? box, size };\n };\n const api: Capture = {\n capture: async (element, { area = 'viewport' } = {}) => {\n const { body, type, box } = await capture(element, { area, masking, renderer, overlay });\n const { clientWidth, clientHeight } = document.documentElement;\n const size = area === 'element' ? { width: box.width, height: box.height } : { width: clientWidth, height: clientHeight };\n return add(body, type, { box, size });\n },\n upload: (png, of) => add(png, 'image/png', of),\n masked: (element) => {\n const copy = element.cloneNode(true) as Element;\n mask(copy, masking);\n return copy;\n },\n };\n\n const group = Object.assign(document.createElement('div'), { className: 'tool-group' });\n const shoot = toolButton(CAMERA, 'Screenshot', 'S', () => {\n shoot.disabled = true;\n shoot.classList.remove('problem');\n // The panel stays while the shot is made: it's in none, as nothing of deictic's is.\n const done = tools.keep();\n api\n .capture(document.documentElement)\n .then(\n (shot) => {\n tray.add('screenshots', shot.id, shot);\n shoot.title = 'Screenshot';\n },\n (e: unknown) => {\n // Said where it was asked for: its tooltip, which a missing renderer's fix fits in.\n shoot.classList.add('problem');\n shoot.title = e instanceof Error ? e.message : String(e);\n },\n )\n .finally(() => {\n shoot.disabled = false;\n done();\n });\n });\n group.append(shoot);\n // Beside the other tools that capture the page: a shot, a recording, the mic.\n tools.add(group, { section: 'capture' });\n // In the drawer until a task takes them: each opens among the others.\n drawer.add(\n trayed({ tray }, 'screenshots', 'Screenshots', (item, i, all) => {\n const name = (n: number) => (all.length === 1 ? 'Screenshot' : `Screenshot ${n + 1}`);\n const thumb = Object.assign(document.createElement('img'), { src: (item.value as Shot).url, alt: '' });\n return {\n label: [thumb, name(i)],\n open: (from) =>\n lightbox(\n all.map((each, n) => ({ kind: 'image' as const, url: (each.value as Shot).url, title: name(n) })),\n { at: i, from },\n ),\n };\n }),\n );\n return api;\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAgCA,MAAa,WAAW,SAAe,EAAE,gBAAgB,WAAW,KAAK,cAAc;;AAGvF,SAAgB,MAAM,SAAkB,MAAgD;CACtF,MAAM,EAAE,GAAG,GAAG,OAAO,WAAW,QAAQ,sBAAsB;CAC9D,OAAO,SAAS,YAAY;EAAE,GAAG;EAAG,GAAG;EAAG;EAAO;CAAO,IAAI;EAAE;EAAG;EAAG;EAAO;CAAO;AACpF;AAEA,MAAM,QAAQ;;AAEd,MAAM,SAAS;AAEf,MAAM,YAAY,WAAmB,UAA8B,CAAC,IAAI,IAAI,OAAO,SAAS,KAAK,GAAI,QAAQ,CAAC,KAAK,IAAI,CAAC,CAAE,CAAC,CAAC,KAAK,IAAI;;;;;;AAOrI,SAAgB,KAAK,MAAY,GAA0B;CACzD,IAAI,EAAE,gBAAgB,UAAU;CAChC,MAAM,OAAO,QAAgB,CAAC,GAAI,KAAK,QAAQ,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,GAAI,GAAG,KAAK,iBAAiB,GAAG,CAAC;CACjG,MAAM,SAAS,SAAiB,KAAK,QAAQ,OAAO,GAAG;CACvD,KAAK,MAAM,MAAM,IAAI,SAAS,EAAE,YAAY,EAAE,aAAa,CAAC,GAAG;EAC7D,GAAG,gBAAgB;EACnB,IAAI,cAAc,eAAe,cAAc,YAAY,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AFK,OAAO,OAAO,SAAS,cAAc,KAAK,GAAG;MAAE,KAAM,KAAK,MAAe;MAAK,KAAK;KAAG,CAEtF,GAAG,KAAK,CAAC,CAAC;KACtB,OAAO,SACL,SACE,IAAI,KAAK,MAAM,OAAO;MAAE,MAAM;MAAkB,KAAM,KAAK,MAAe;MAAK,OAAO,KAAK,CAAC;KAAE,EAAE,GAChG;MAAE,IAAI;MAAG;KAAK,CAChB;IACJ;GACF,CAAC,CACH;GACA,OAAO;EACT;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"client.js","names":[],"sources":["../../src/plugins/screenshots/client.ts"],"sourcesContent":["/**\n * The screenshots plugin's page half, around a renderer's capture: the renderer makes the shot (a PNG,\n * or what its server half makes one of), and this sends it to the plugin's `add` route and answers the\n * `Shot`. A renderer's page module default-exports `screenshotsClient(itsCapture)`.\n *\n * Its tool in the tool panel takes the window as it is, with what's drawn on the page, and puts the shot in the\n * tray, for the next task.\n */\nimport { POPUP_CLOSED, POPUP_OPENED, type PopupOpened, toolButton } from '#src/client/dom.ts';\nimport { trayed } from '#src/client/drawer.ts';\nimport { defineClientPlugin } from '#src/index.ts';\nimport type { Annotations } from '#src/plugins/annotations/index.ts';\n\nimport type { Box, Capture, CaptureOptions, ResolvedMasking, Shot } from './index.ts';\n\n/**\n * What a renderer's page half makes of the element: a body for `add`, its type, and where the element is\n * in the shot. `overlay(area)` is what's drawn over the page in that part of the viewport, in viewport CSS\n * pixels, as an SVG that size, or nothing: the annotations plugin's marks, where it's loaded. The renderer\n * draws it over the shot, as deictic's own layers are left out.\n */\nexport type PageCapture = (\n element: Element,\n options: {\n area: NonNullable<CaptureOptions['area']>;\n masking: ResolvedMasking;\n renderer: unknown;\n overlay: (area: Box) => string | undefined;\n },\n) => Promise<{ body: Blob | string; type: string; box: Box }>;\n\n/**\n * What a renderer that can take the page at once makes of it, synchronously: as `PageCapture` answers, or nothing\n * where it isn't ready (what it imports hasn't loaded). `prepare` loads it, once the page has started.\n */\nexport interface PageFreeze {\n freeze: (element: Element, options: Parameters<PageCapture>[1]) => Awaited<ReturnType<PageCapture>> | undefined;\n prepare: () => void;\n}\n\n/** Leaves out deictic's own UI: the overlay with its hover outline and any open panel. */\nexport const notOurs = (node: Node) => !(node instanceof Element && node.localName === 'deictic-overlay');\n\n/** The element's box, in CSS pixels from the viewport's top left, or from its own for a shot of it alone. */\nexport function boxOf(element: Element, area: NonNullable<CaptureOptions['area']>): Box {\n const { x, y, width, height } = element.getBoundingClientRect();\n return area === 'element' ? { x: 0, y: 0, width, height } : { x, y, width, height };\n}\n\nconst BLANK = '#d4d4d8';\n/** How long after its press a popup may first ask for the shot it froze, in milliseconds: later, it's another's. */\nconst ASKED = 60_000;\n/** A camera, on a 24-pixel grid. */\nconst CAMERA = '<path d=\"M4 8h3l2-3h6l2 3h3v11H4z\"/><circle cx=\"12\" cy=\"13\" r=\"3.5\"/>';\n\nconst selector = (className: string, extra: string | undefined) => [`.${CSS.escape(className)}`, ...(extra ? [extra] : [])].join(', ');\n\n/**\n * Hides in a copy of the page's what rrweb would: blocked elements become a blank box their size (the copy keeps each\n * element's size as its styles), masked text keeps its spaces but shows `*`, and so do passwords' values,\n * or every field's.\n */\nexport function mask(copy: Node, m: ResolvedMasking): void {\n if (!(copy instanceof Element)) return;\n const all = (sel: string) => [...(copy.matches(sel) ? [copy] : []), ...copy.querySelectorAll(sel)];\n const stars = (text: string) => text.replace(/\\S/g, '*');\n for (const el of all(selector(m.blockClass, m.blockSelector))) {\n el.replaceChildren();\n if (el instanceof HTMLElement || el instanceof SVGElement) el.style.background = BLANK;\n }\n for (const el of all(selector(m.maskTextClass, m.maskTextSelector))) {\n const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT);\n for (let text = walker.nextNode(); text !== null; text = walker.nextNode()) text.textContent = stars(text.textContent ?? '');\n }\n for (const field of all('input, textarea')) {\n if (!(field instanceof HTMLInputElement || field instanceof HTMLTextAreaElement)) continue;\n if (!m.maskAllInputs && !(field instanceof HTMLInputElement && field.type === 'password')) continue;\n field.value = stars(field.value);\n field.setAttribute('value', field.value);\n if (field instanceof HTMLTextAreaElement) field.textContent = field.value;\n }\n}\n\nexport function screenshotsClient(capture: PageCapture, freezer?: PageFreeze) {\n return defineClientPlugin<never, never, Capture>({\n name: 'screenshots',\n ...(freezer === undefined ? {} : { pressed: ({ use }, element) => use('screenshots')?.freeze(element) }),\n setup: ({ base, request, options, use, tools, tray, drawer, lightbox }) => {\n const { masking, renderer } = options as { masking: ResolvedMasking; renderer: unknown };\n // Ready for a press, which can't wait for an import: once the page has started, while the browser is idle.\n if (freezer !== undefined) {\n if (typeof requestIdleCallback === 'function') requestIdleCallback(freezer.prepare, { timeout: 5000 });\n else setTimeout(freezer.prepare, 1000);\n }\n // Asked at each shot: the annotations plugin may be set up after this one.\n const overlay = (area: Box) => {\n const marks: Annotations | undefined = use('annotations');\n return marks?.svg(area);\n };\n const add = async (body: Blob | string, type: string, { box, size }: Pick<Shot, 'box' | 'size'>): Promise<Shot> => {\n const res = await request('add', { method: 'POST', headers: { 'content-type': type }, body });\n // `url`: where the shot is, said by what keeps it with no server to serve it from (a `standalone` build).\n // `box`: where the element is in a shot drawn again elsewhere, which is what's true of the PNG.\n const { id, url, problem, box: drawn } = (await res.json()) as { id?: string; url?: string; problem?: string; box?: Box };\n if (id === undefined) throw new Error(`screenshots: ${problem ?? res.statusText}`);\n return { id, url: url ?? `${base}__deictic/plugins/screenshots/shot/${id}`, box: drawn ?? box, size };\n };\n // The last press's page, and its shot once it's asked for: the popup that press opened has it while it's open,\n // whichever of its tabs asks. Not a popup opened on another element, nor one long after the press.\n let last:\n { element: Element; at: number; made: Awaited<ReturnType<PageCapture>>; size: Shot['size']; shot?: Promise<Shot> } | undefined;\n window.addEventListener(POPUP_CLOSED, () => (last = undefined));\n window.addEventListener(POPUP_OPENED, (e) => {\n if (last !== undefined && (e as CustomEvent<PopupOpened>).detail.element !== last.element) last = undefined;\n });\n const api: Capture = {\n freeze: (element) => {\n const { clientWidth: width, clientHeight: height } = document.documentElement;\n const made = freezer?.freeze(element, { area: 'viewport', masking, renderer, overlay });\n last = made === undefined ? undefined : { element, at: performance.now(), made, size: { width, height } };\n },\n frozen: (element) => {\n if (last?.element !== element || (last.shot === undefined && performance.now() - last.at > ASKED)) return undefined;\n const { made, size } = last;\n if (last.shot === undefined) {\n last.shot = add(made.body, made.type, { box: made.box, size });\n // Asked for while the popup opens, and maybe never used: a failure is said where it's awaited.\n last.shot.catch(() => {});\n }\n return last.shot;\n },\n capture: async (element, { area = 'viewport' } = {}) => {\n const { body, type, box } = await capture(element, { area, masking, renderer, overlay });\n const { clientWidth, clientHeight } = document.documentElement;\n const size = area === 'element' ? { width: box.width, height: box.height } : { width: clientWidth, height: clientHeight };\n return add(body, type, { box, size });\n },\n upload: (png, of) => add(png, 'image/png', of),\n masked: (element) => {\n const copy = element.cloneNode(true) as Element;\n mask(copy, masking);\n return copy;\n },\n };\n\n const group = Object.assign(document.createElement('div'), { className: 'tool-group' });\n const shoot = toolButton(CAMERA, 'Screenshot', 'S', () => {\n shoot.disabled = true;\n shoot.classList.remove('problem');\n // The panel stays while the shot is made: it's in none, as nothing of deictic's is.\n const done = tools.keep();\n api\n .capture(document.documentElement)\n .then(\n (shot) => {\n tray.add('screenshots', shot.id, shot);\n shoot.title = 'Screenshot';\n },\n (e: unknown) => {\n // Said where it was asked for: its tooltip, which a missing renderer's fix fits in.\n shoot.classList.add('problem');\n shoot.title = e instanceof Error ? e.message : String(e);\n },\n )\n .finally(() => {\n shoot.disabled = false;\n done();\n });\n });\n group.append(shoot);\n // Beside the other tools that capture the page: a shot, a recording, the mic.\n tools.add(group, { section: 'capture' });\n // In the drawer until a task takes them: each opens among the others.\n drawer.add(\n trayed({ tray }, 'screenshots', 'Screenshots', (item, i, all) => {\n const name = (n: number) => (all.length === 1 ? 'Screenshot' : `Screenshot ${n + 1}`);\n const thumb = Object.assign(document.createElement('img'), { src: (item.value as Shot).url, alt: '' });\n return {\n label: [thumb, name(i)],\n open: (from) =>\n lightbox(\n all.map((each, n) => ({ kind: 'image' as const, url: (each.value as Shot).url, title: name(n) })),\n { at: i, from },\n ),\n };\n }),\n );\n return api;\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAyCA,MAAa,WAAW,SAAe,EAAE,gBAAgB,WAAW,KAAK,cAAc;;AAGvF,SAAgB,MAAM,SAAkB,MAAgD;CACtF,MAAM,EAAE,GAAG,GAAG,OAAO,WAAW,QAAQ,sBAAsB;CAC9D,OAAO,SAAS,YAAY;EAAE,GAAG;EAAG,GAAG;EAAG;EAAO;CAAO,IAAI;EAAE;EAAG;EAAG;EAAO;CAAO;AACpF;AAEA,MAAM,QAAQ;;AAEd,MAAM,QAAQ;;AAEd,MAAM,SAAS;AAEf,MAAM,YAAY,WAAmB,UAA8B,CAAC,IAAI,IAAI,OAAO,SAAS,KAAK,GAAI,QAAQ,CAAC,KAAK,IAAI,CAAC,CAAE,CAAC,CAAC,KAAK,IAAI;;;;;;AAOrI,SAAgB,KAAK,MAAY,GAA0B;CACzD,IAAI,EAAE,gBAAgB,UAAU;CAChC,MAAM,OAAO,QAAgB,CAAC,GAAI,KAAK,QAAQ,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,GAAI,GAAG,KAAK,iBAAiB,GAAG,CAAC;CACjG,MAAM,SAAS,SAAiB,KAAK,QAAQ,OAAO,GAAG;CACvD,KAAK,MAAM,MAAM,IAAI,SAAS,EAAE,YAAY,EAAE,aAAa,CAAC,GAAG;EAC7D,GAAG,gBAAgB;EACnB,IAAI,cAAc,eAAe,cAAc,YAAY,GAAG,MAAM,aAAa;CACnF;CACA,KAAK,MAAM,MAAM,IAAI,SAAS,EAAE,eAAe,EAAE,gBAAgB,CAAC,GAAG;EACnE,MAAM,SAAS,SAAS,iBAAiB,IAAI,WAAW,SAAS;EACjE,KAAK,IAAI,OAAO,OAAO,SAAS,GAAG,SAAS,MAAM,OAAO,OAAO,SAAS,GAAG,KAAK,cAAc,MAAM,KAA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M,OAAO,QAAQ,UAAU,IAAI;KACnC,KAAK,MAAM,OAAO;KAClB,OAAO;IACT;GACF;GAEA,MAAM,QAAQ,OAAO,OAAO,SAAS,cAAc,KAAK,GAAG,EAAE,WAAW,aAAa,CAAC;GACtF,MAAM,QAAQ,WAAW,QAAQ,cAAc,WAAW;IACxD,MAAM,WAAW;IACjB,MAAM,UAAU,OAAO,SAAS;IAEhC,MAAM,OAAO,MAAM,KAAK;IACxB,IACG,QAAQ,SAAS,eAAe,CAAC,CACjC,MACE,SAAS;KACR,KAAK,IAAI,eAAe,KAAK,IAAI,IAAI;KACrC,MAAM,QAAQ;IAChB,IACC,MAAe;KAEd,MAAM,UAAU,IAAI,SAAS;KAC7B,MAAM,QAAQ,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC;IACzD,CACF,CAAC,CACA,cAAc;KACb,MAAM,WAAW;KACjB,KAAK;IACP,CAAC;GACL,CAAC;GACD,MAAM,OAAO,KAAK;GAElB,MAAM,IAAI,OAAO,EAAE,SAAS,UAAU,CAAC;GAEvC,OAAO,IACL,OAAO,EAAE,KAAK,GAAG,eAAe,gBAAgB,MAAM,GAAG,QAAQ;IAC/D,MAAM,QAAQ,MAAe,IAAI,WAAW,IAAI,eAAe,cAAc,IAAI;IAEjF,OAAO;KACL,OAAO,CAFK,OAAO,OAAO,SAAS,cAAc,KAAK,GAAG;MAAE,KAAM,KAAK,MAAe;MAAK,KAAK;KAAG,CAEtF,GAAG,KAAK,CAAC,CAAC;KACtB,OAAO,SACL,SACE,IAAI,KAAK,MAAM,OAAO;MAAE,MAAM;MAAkB,KAAM,KAAK,MAAe;MAAK,OAAO,KAAK,CAAC;KAAE,EAAE,GAChG;MAAE,IAAI;MAAG;KAAK,CAChB;IACJ;GACF,CAAC,CACH;GACA,OAAO;EACT;CACF,CAAC;AACH"}
@@ -74,6 +74,12 @@ function controlFor(within, e, loose = false) {
74
74
  }
75
75
  /** The key held with a letter for a command, as the platform has it, by the name `aria-keyshortcuts` gives it. */
76
76
  const MOD = typeof navigator !== "undefined" && /Mac|iP(?:hone|ad)/.test(navigator.platform) ? "Meta" : "Control";
77
- export { nameOf as a, sameAs as c, div as i, targetOf as l, MOD as n, place as o, controlFor as r, reduced as s, ATTRIBUTE as t, toolButton as u };
77
+ /**
78
+ * What the page hears on `window` as the popup opens over it on an element (its `detail` a `PopupOpened`) and as
79
+ * it closes: for a page that moves on its own to hold still meanwhile, as deictic's site does. Not for one pinned.
80
+ */
81
+ const POPUP_OPENED = "deictic:open";
82
+ const POPUP_CLOSED = "deictic:close";
83
+ export { controlFor as a, place as c, targetOf as d, toolButton as f, POPUP_OPENED as i, reduced as l, MOD as n, div as o, POPUP_CLOSED as r, nameOf as s, ATTRIBUTE as t, sameAs as u };
78
84
 
79
85
  //# sourceMappingURL=dom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dom.js","names":[],"sources":["../../src/client/dom.ts"],"sourcesContent":["/** The little the overlay's parts all draw with. */\nimport type { Target } from '#src/index.ts';\n\n/** The attribute the transform marks an element with: `file:line:column`. */\nexport const ATTRIBUTE = 'data-deictic';\n\n/** An element's place in the source, as its mark has it, or nothing for one with none. */\nexport function targetOf(el: Element): Target | undefined {\n const at = el.getAttribute(ATTRIBUTE);\n const match = at === null ? null : /^(.*):(\\d+):(\\d+)$/.exec(at);\n if (match === null) return undefined;\n return { loc: { file: match[1]!, line: Number(match[2]), column: Number(match[3]) }, tag: el.localName };\n}\n\n/** Every element on the page from the same place in the source as `el`. */\nexport const sameAs = (el: Element) => [...document.querySelectorAll(`[${ATTRIBUTE}=\"${CSS.escape(el.getAttribute(ATTRIBUTE) ?? '')}\"]`)];\n\nexport function div(className: string): HTMLDivElement {\n const el = document.createElement('div');\n el.className = className;\n return el;\n}\n\n/** Puts a fixed box over `r`. */\nexport function place(el: HTMLElement, r: DOMRect): void {\n Object.assign(el.style, { left: `${r.left}px`, top: `${r.top}px`, width: `${r.width}px`, height: `${r.height}px` });\n}\n\n/** `button.tab`: the element as a selector, its own classes only, for a person to tell it by. */\nexport const nameOf = (el: Element) => `${el.localName}${[...el.classList].map((c) => `.${c}`).join('')}`;\n\nexport const reduced = () => matchMedia('(prefers-reduced-motion: reduce)').matches;\n\n/**\n * A button for the tool panel: an icon (its strokes, on a 24-pixel grid), named by its tooltip and for a screen\n * reader, with the keys that press it (`B`, `Control+Z`), which the tooltip shows and the panel hears.\n */\nexport function toolButton(strokes: string, name: string, keys: string | undefined, run: () => void): HTMLButtonElement {\n const el = Object.assign(document.createElement('button'), { type: 'button', className: 'icon', title: name });\n el.innerHTML = `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${strokes}</svg>`;\n el.setAttribute('aria-label', name);\n if (keys !== undefined) el.setAttribute('aria-keyshortcuts', keys);\n el.addEventListener('click', run);\n return el;\n}\n\n/**\n * The control in `within` that a key is for, by its `aria-keyshortcuts`: a key alone, or with the keys it names.\n * `loose` takes a key alone whatever is held with it, for while a shortcut's keys are held to point.\n */\nexport function controlFor(within: ParentNode, e: KeyboardEvent, loose = false): HTMLElement | undefined {\n // By the letter typed, and by where the key is where it types no Latin letter (another layout, or Alt held).\n const key = /^[a-z]$/i.test(e.key) ? e.key.toUpperCase() : e.code.startsWith('Key') ? e.code.slice(3) : e.key;\n const held = [e.ctrlKey && 'Control', e.metaKey && 'Meta', e.shiftKey && 'Shift'].filter((m) => m !== false);\n for (const el of within.querySelectorAll<HTMLElement>('[aria-keyshortcuts]')) {\n if (el instanceof HTMLButtonElement && el.disabled) continue;\n // One that isn't shown now: a recording's Stop while none is going.\n if (el.offsetParent === null) continue;\n for (const keys of (el.getAttribute('aria-keyshortcuts') ?? '').split(' ')) {\n const named = keys.split('+');\n if (named.at(-1) !== key) continue;\n const mods = named.slice(0, -1);\n if (mods.length === 0 ? loose || held.length === 0 : mods.length === held.length && mods.every((m) => held.includes(m))) return el;\n }\n }\n return undefined;\n}\n\n/** The key held with a letter for a command, as the platform has it, by the name `aria-keyshortcuts` gives it. */\nexport const MOD = typeof navigator !== 'undefined' && /Mac|iP(?:hone|ad)/.test(navigator.platform) ? 'Meta' : 'Control';\n"],"mappings":";;AAIA,MAAa,YAAY;;AAGzB,SAAgB,SAAS,IAAiC;CACxD,MAAM,KAAK,GAAG,aAAa,SAAS;CACpC,MAAM,QAAQ,OAAO,OAAO,OAAO,qBAAqB,KAAK,EAAE;CAC/D,IAAI,UAAU,MAAM,OAAO,KAAA;CAC3B,OAAO;EAAE,KAAK;GAAE,MAAM,MAAM;GAAK,MAAM,OAAO,MAAM,EAAE;GAAG,QAAQ,OAAO,MAAM,EAAE;EAAE;EAAG,KAAK,GAAG;CAAU;AACzG;;AAGA,MAAa,UAAU,OAAgB,CAAC,GAAG,SAAS,iBAAiB,IAAI,UAAU,IAAI,IAAI,OAAO,GAAG,aAAA,cAAsB,KAAK,EAAE,EAAE,GAAG,CAAC;AAExI,SAAgB,IAAI,WAAmC;CACrD,MAAM,KAAK,SAAS,cAAc,KAAK;CACvC,GAAG,YAAY;CACf,OAAO;AACT;;AAGA,SAAgB,MAAM,IAAiB,GAAkB;CACvD,OAAO,OAAO,GAAG,OAAO;EAAE,MAAM,GAAG,EAAE,KAAK;EAAK,KAAK,GAAG,EAAE,IAAI;EAAK,OAAO,GAAG,EAAE,MAAM;EAAK,QAAQ,GAAG,EAAE,OAAO;CAAI,CAAC;AACpH;;AAGA,MAAa,UAAU,OAAgB,GAAG,GAAG,YAAY,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC,KAAK,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE;AAEtG,MAAa,gBAAgB,WAAW,kCAAkC,CAAC,CAAC;;;;;AAM5E,SAAgB,WAAW,SAAiB,MAAc,MAA0B,KAAoC;CACtH,MAAM,KAAK,OAAO,OAAO,SAAS,cAAc,QAAQ,GAAG;EAAE,MAAM;EAAU,WAAW;EAAQ,OAAO;CAAK,CAAC;CAC7G,GAAG,YAAY,iJAAiJ,QAAQ;CACxK,GAAG,aAAa,cAAc,IAAI;CAClC,IAAI,SAAS,KAAA,GAAW,GAAG,aAAa,qBAAqB,IAAI;CACjE,GAAG,iBAAiB,SAAS,GAAG;CAChC,OAAO;AACT;;;;;AAMA,SAAgB,WAAW,QAAoB,GAAkB,QAAQ,OAAgC;CAEvG,MAAM,MAAM,WAAW,KAAK,EAAE,GAAG,IAAI,EAAE,IAAI,YAAY,IAAI,EAAE,KAAK,WAAW,KAAK,IAAI,EAAE,KAAK,MAAM,CAAC,IAAI,EAAE;CAC1G,MAAM,OAAO;EAAC,EAAE,WAAW;EAAW,EAAE,WAAW;EAAQ,EAAE,YAAY;CAAO,CAAC,CAAC,QAAQ,MAAM,MAAM,KAAK;CAC3G,KAAK,MAAM,MAAM,OAAO,iBAA8B,qBAAqB,GAAG;EAC5E,IAAI,cAAc,qBAAqB,GAAG,UAAU;EAEpD,IAAI,GAAG,iBAAiB,MAAM;EAC9B,KAAK,MAAM,SAAS,GAAG,aAAa,mBAAmB,KAAK,GAAA,CAAI,MAAM,GAAG,GAAG;GAC1E,MAAM,QAAQ,KAAK,MAAM,GAAG;GAC5B,IAAI,MAAM,GAAG,EAAE,MAAM,KAAK;GAC1B,MAAM,OAAO,MAAM,MAAM,GAAG,EAAE;GAC9B,IAAI,KAAK,WAAW,IAAI,SAAS,KAAK,WAAW,IAAI,KAAK,WAAW,KAAK,UAAU,KAAK,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,GAAG,OAAO;EAClI;CACF;AAEF;;AAGA,MAAa,MAAM,OAAO,cAAc,eAAe,oBAAoB,KAAK,UAAU,QAAQ,IAAI,SAAS"}
1
+ {"version":3,"file":"dom.js","names":[],"sources":["../../src/client/dom.ts"],"sourcesContent":["/** The little the overlay's parts all draw with. */\nimport type { Target } from '#src/index.ts';\n\n/** The attribute the transform marks an element with: `file:line:column`. */\nexport const ATTRIBUTE = 'data-deictic';\n\n/** An element's place in the source, as its mark has it, or nothing for one with none. */\nexport function targetOf(el: Element): Target | undefined {\n const at = el.getAttribute(ATTRIBUTE);\n const match = at === null ? null : /^(.*):(\\d+):(\\d+)$/.exec(at);\n if (match === null) return undefined;\n return { loc: { file: match[1]!, line: Number(match[2]), column: Number(match[3]) }, tag: el.localName };\n}\n\n/** Every element on the page from the same place in the source as `el`. */\nexport const sameAs = (el: Element) => [...document.querySelectorAll(`[${ATTRIBUTE}=\"${CSS.escape(el.getAttribute(ATTRIBUTE) ?? '')}\"]`)];\n\nexport function div(className: string): HTMLDivElement {\n const el = document.createElement('div');\n el.className = className;\n return el;\n}\n\n/** Puts a fixed box over `r`. */\nexport function place(el: HTMLElement, r: DOMRect): void {\n Object.assign(el.style, { left: `${r.left}px`, top: `${r.top}px`, width: `${r.width}px`, height: `${r.height}px` });\n}\n\n/** `button.tab`: the element as a selector, its own classes only, for a person to tell it by. */\nexport const nameOf = (el: Element) => `${el.localName}${[...el.classList].map((c) => `.${c}`).join('')}`;\n\nexport const reduced = () => matchMedia('(prefers-reduced-motion: reduce)').matches;\n\n/**\n * A button for the tool panel: an icon (its strokes, on a 24-pixel grid), named by its tooltip and for a screen\n * reader, with the keys that press it (`B`, `Control+Z`), which the tooltip shows and the panel hears.\n */\nexport function toolButton(strokes: string, name: string, keys: string | undefined, run: () => void): HTMLButtonElement {\n const el = Object.assign(document.createElement('button'), { type: 'button', className: 'icon', title: name });\n el.innerHTML = `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${strokes}</svg>`;\n el.setAttribute('aria-label', name);\n if (keys !== undefined) el.setAttribute('aria-keyshortcuts', keys);\n el.addEventListener('click', run);\n return el;\n}\n\n/**\n * The control in `within` that a key is for, by its `aria-keyshortcuts`: a key alone, or with the keys it names.\n * `loose` takes a key alone whatever is held with it, for while a shortcut's keys are held to point.\n */\nexport function controlFor(within: ParentNode, e: KeyboardEvent, loose = false): HTMLElement | undefined {\n // By the letter typed, and by where the key is where it types no Latin letter (another layout, or Alt held).\n const key = /^[a-z]$/i.test(e.key) ? e.key.toUpperCase() : e.code.startsWith('Key') ? e.code.slice(3) : e.key;\n const held = [e.ctrlKey && 'Control', e.metaKey && 'Meta', e.shiftKey && 'Shift'].filter((m) => m !== false);\n for (const el of within.querySelectorAll<HTMLElement>('[aria-keyshortcuts]')) {\n if (el instanceof HTMLButtonElement && el.disabled) continue;\n // One that isn't shown now: a recording's Stop while none is going.\n if (el.offsetParent === null) continue;\n for (const keys of (el.getAttribute('aria-keyshortcuts') ?? '').split(' ')) {\n const named = keys.split('+');\n if (named.at(-1) !== key) continue;\n const mods = named.slice(0, -1);\n if (mods.length === 0 ? loose || held.length === 0 : mods.length === held.length && mods.every((m) => held.includes(m))) return el;\n }\n }\n return undefined;\n}\n\n/** The key held with a letter for a command, as the platform has it, by the name `aria-keyshortcuts` gives it. */\nexport const MOD = typeof navigator !== 'undefined' && /Mac|iP(?:hone|ad)/.test(navigator.platform) ? 'Meta' : 'Control';\n\n/**\n * What the page hears on `window` as the popup opens over it on an element (its `detail` a `PopupOpened`) and as\n * it closes: for a page that moves on its own to hold still meanwhile, as deictic's site does. Not for one pinned.\n */\nexport const POPUP_OPENED = 'deictic:open';\nexport const POPUP_CLOSED = 'deictic:close';\n\nexport interface PopupOpened {\n /** The element it's open on. */\n element: Element;\n /** The plugin whose tab it opened at. */\n tab: string;\n}\n"],"mappings":";;AAIA,MAAa,YAAY;;AAGzB,SAAgB,SAAS,IAAiC;CACxD,MAAM,KAAK,GAAG,aAAa,SAAS;CACpC,MAAM,QAAQ,OAAO,OAAO,OAAO,qBAAqB,KAAK,EAAE;CAC/D,IAAI,UAAU,MAAM,OAAO,KAAA;CAC3B,OAAO;EAAE,KAAK;GAAE,MAAM,MAAM;GAAK,MAAM,OAAO,MAAM,EAAE;GAAG,QAAQ,OAAO,MAAM,EAAE;EAAE;EAAG,KAAK,GAAG;CAAU;AAC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Q,MAAM,MAAM,KAAK;CAC3G,KAAK,MAAM,MAAM,OAAO,iBAA8B,qBAAqB,GAAG;EAC5E,IAAI,cAAc,qBAAqB,GAAG,UAAU;EAEpD,IAAI,GAAG,iBAAiB,MAAM;EAC9B,KAAK,MAAM,SAAS,GAAG,aAAa,mBAAmB,KAAK,GAAA,CAAI,MAAM,GAAG,GAAG;GAC1E,MAAM,QAAQ,KAAK,MAAM,GAAG;GAC5B,IAAI,MAAM,GAAG,EAAE,MAAM,KAAK;GAC1B,MAAM,OAAO,MAAM,MAAM,GAAG,EAAE;GAC9B,IAAI,KAAK,WAAW,IAAI,SAAS,KAAK,WAAW,IAAI,KAAK,WAAW,KAAK,UAAU,KAAK,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,GAAG,OAAO;EAClI;CACF;AAEF;;AAGA,MAAa,MAAM,OAAO,cAAc,eAAe,oBAAoB,KAAK,UAAU,QAAQ,IAAI,SAAS;;;;;AAM/G,MAAa,eAAe;AAC5B,MAAa,eAAe"}
@@ -1,4 +1,4 @@
1
- import { i as div } from "./dom.js";
1
+ import { o as div } from "./dom.js";
2
2
  // src/client/drawer.ts
3
3
  /** How long the drawer outlasts the keys, in milliseconds: time to get the pointer to it. */
4
4
  const LINGER = 600;
@@ -3,7 +3,7 @@ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node
3
3
  import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
4
4
  import { t as keptIn } from "./kept.js";
5
5
  import { _ as lineStarts, b as parse, c as setUp, d as reporter, f as stackOf, g as isHost, l as messageOf, m as parseAstro, p as ASTRO, u as problemIn, v as offsetOf, y as openingsIn } from "./integration.js";
6
- import { r as missingProblem } from "./packages.js";
6
+ import { i as missingProblem } from "./packages.js";
7
7
  // src/tools/source.ts
8
8
  /**
9
9
  * The source a server half reads: a target's file, parsed, and the opening tag the page's attribute
@@ -380,6 +380,12 @@ interface ClientPlugin<Model = unknown, Op = unknown, Api = unknown> {
380
380
  * plugin pins each task where its element is. Answers what takes it away.
381
381
  */
382
382
  pointing?(context: ClientContext): () => void;
383
+ /**
384
+ * A shortcut's press on a marked element, before the page hears it and before the popup opens: the page as the
385
+ * person saw it, a tooltip still open under the pointer, a menu still focused. Called as the press goes down, so
386
+ * it must be quick; the screenshots plugin keeps what a shot needs here, and renders it later.
387
+ */
388
+ pressed?(context: ClientContext, element: Element): void;
383
389
  /** Draws into `panel`, inside deictic's shadow root. Returns what to undo on the page when the panel closes. */
384
390
  mount?: (panel: HTMLElement, context: PanelContext<Model, Op>) => (() => void) | void;
385
391
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/shortcut.ts","../../src/index.ts"],"mappings":";;;;;;;;;;KAUY;UAEK;;EAEf,YAAY;;EAEZ;;;UCYe;EACf;EACA;EACA;;;UAIe;EACf,KAAK;EACL;;;UAIe;EACf;EACA;EACA;EACA;;;UAIe;;EAEf;EACA;;EAEA,SAAS;;EAET,SAAS;;EAET,KAAK;;;;;;;KAQK,cAAc,SAAS,YAAY,WAAW,QAAQ;;cAGrD,gBAAgB;EAClB;;;;;;UAOM,KAAK;EACpB,MAAM;;KAGH,MAAM,KAAK,IAAI,QAAQ;;;;;;UAOX;;;;;EAKf;;;;;EAKA;;EAEA;;EAEA;;EAEA;;;;;;UAQe;;UAIA;;KAGL,MAAM,MAAM,uBAAuB,mBAAmB,OAAO,KAAK;UAE7D;;EAEf;;;;;EAKA,MAAM,qBAAqB,MAAM,SAAS,MAAM,YAAY;;EAE5D,SAAS,SAAS;;;;;;KAOR,SAAS,SAAS,SAAS,SAAS,kBAAkB,MAAM;UAEvD,aAAa,iBAAiB,cAAc,kBAAkB;;EAE7E;;EAEA;;EAEA;;EAEA,WAAW;;EAEX;;;;;EAKA;;EAEA,OAAO,SAAS,gBAAgB,MAAM;;EAEtC;KAAY,gBAAgB;;;;;;;EAM5B,MAAM,QAAQ,SAAS,SAAS,QAAQ,SAAS,MAAM;;EAEvD,OAAO,QAAQ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AAK;;EAEL,UAAU;EACV,QAAQ;EACR,OAAO;;;;;EAKP,MAAM,IAAI,IAAI,KAAK,SAAS,QAAQ;EACpC;;;;;;EAMA,UAAU,QAAQ;;;;;;;;;EASlB,OAAO,GAAG,gBAAgB,YAAY,QAAQ;;EAE9C,UAAU;;;UAIK;EACf;EACA;;EAEA;;UAGe,aAAa,iBAAiB,cAAc;;EAE3D;;EAEA;;;;;EAKA,OAAO,SAAS,gBAAgB;;;;;;EAMhC,QAAQ,SAAS,gBAAgB;;;;;EAKjC,UAAU,SAAS;;;;;;EAMnB,SAAS,SAAS,eAAe,SAAS;;EAE1C,SAAS,OAAO,aAAa,SAAS,aAAa,OAAO;;cAG/C,qBAAsB,OAAO,IAAI,eAAa,QAAU,aAAa,OAAO,IAAI,SAAO,aAAa,OAAO,IAAI"}
@@ -0,0 +1,70 @@
1
+ import { j as Shortcut } from "./index.js";
2
+ /** A class as the panel shows it. */
3
+ interface ClassInfo {
4
+ name: string;
5
+ /** Whether Tailwind makes anything of it: a class of the project's own isn't known. */
6
+ known: boolean;
7
+ /** The colour it sets, as CSS. */
8
+ color?: string;
9
+ /** What it sets its main property to, theme values resolved: `0.875rem`. */
10
+ value?: string;
11
+ /** A variant to go on typing after (`hover:`), not a class. */
12
+ variant?: true;
13
+ }
14
+ /** The classes of one kind, and how to write one with a value of the user's own. */
15
+ interface Alternatives {
16
+ /** The property the kind sets: `font-size`. */
17
+ label: string;
18
+ /** Whether the kind is a colour's, shown as swatches. */
19
+ colors: boolean;
20
+ items: ClassInfo[];
21
+ /** A custom value goes between these: `md:text-[` and `]`. None for a kind that takes no value (`flex`). */
22
+ custom?: {
23
+ before: string;
24
+ after: string;
25
+ value?: string;
26
+ };
27
+ }
28
+ interface TailwindOptions {
29
+ /** Calls whose first argument is a class list: `cn`, `clsx`, `cx`, `twMerge`, `classNames` by default. */
30
+ helpers?: string[];
31
+ /** The attribute an element without one gets: `className`, or `class` for Solid and Preact. */
32
+ attribute?: 'className' | 'class';
33
+ /**
34
+ * The stylesheet that imports Tailwind and holds the theme, from the project's root: `src/index.css`. What
35
+ * the panel completes and shows comes from it. Tailwind's default theme without one.
36
+ */
37
+ css?: string;
38
+ /** What opens its tab directly, beside deictic's own shortcut, which opens any: none by default. */
39
+ shortcut?: Shortcut;
40
+ }
41
+ type Model = {
42
+ editable: true;
43
+ classes: string;
44
+ /** The helper's other arguments, which add classes at runtime, each read as far as the source says. */
45
+ others?: Extra[];
46
+ } | {
47
+ editable: false;
48
+ source: string;
49
+ };
50
+ /** Classes a helper's argument adds: `active && 'ring'` is `ring` when `active`. */
51
+ interface Extra {
52
+ /** The argument, or the part of it these classes come from, as written. */
53
+ source: string;
54
+ /** The classes, where the source spells them out: there, or in a `const` of the file it names. */
55
+ classes?: string;
56
+ /** What must hold for them to be added, as written: `active === 'h3'`. None where they always are. */
57
+ when?: string;
58
+ /** Set where the classes are a string in this file, which an op with `at` can write. */
59
+ editable?: true;
60
+ /** The `const` the string is in, where it isn't the argument itself: other elements may use it too. */
61
+ shared?: string;
62
+ }
63
+ interface Op {
64
+ classes: string;
65
+ /** Which of the model's `others` the classes are for, by its place there. The element's own list without. */
66
+ at?: number;
67
+ }
68
+ declare function tailwind(options?: TailwindOptions): import("deictic").ServerPlugin<Model, Op, unknown, unknown>;
69
+ export { tailwind as a, TailwindOptions as i, Model as n, Alternatives as o, Op as r, ClassInfo as s, Extra as t };
70
+ //# sourceMappingURL=index10.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index10.d.ts","names":[],"sources":["../../src/plugins/tailwind/catalog.ts","../../src/plugins/tailwind/index.ts"],"mappings":";;UAeiB;EACf;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIe;;EAEf;;EAEA;EACA,OAAO;;EAEP;IAAW;IAAgB;IAAe;;;UCf3B;;EAEf;;EAEA;;;;;EAKA;;EAEA,WAAW;;KAGD;EAEN;EACA;;EAEA,SAAS;;EAET;EAAiB;;;UAGN;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;UAGe;EACf;;EAEA;;iBASc,SAAS,UAAS,oCAAoB,aAAA,OAAA"}
@@ -28,6 +28,17 @@ interface Capture {
28
28
  upload(png: Blob, of: Pick<Shot, 'box' | 'size'>): Promise<Shot>;
29
29
  /** A copy of an element with what a shot hides hidden in it too: for a plugin that sends its HTML somewhere. */
30
30
  masked(element: Element): Element;
31
+ /**
32
+ * Keeps what a shot of the page now needs, to render later: the overlay calls it (through the plugin's
33
+ * `pressed`) as a shortcut's press goes down, so a tooltip, a hover's styles or a focused menu are still there.
34
+ * Only a renderer that can take the page at once does (`rrweb()`, once it has loaded); the last press's is kept.
35
+ */
36
+ freeze(element: Element): void;
37
+ /**
38
+ * The shot of the page as the last press on `element` froze it, rendered on the first ask, or nothing where the
39
+ * last press was on another element or nothing was frozen: then `capture` takes the page as it is now.
40
+ */
41
+ frozen(element: Element): Promise<Shot> | undefined;
31
42
  }
32
43
  /** The server's half, for other plugins' server halves. */
33
44
  interface Screenshots {
@@ -1 +1 @@
1
- {"version":3,"file":"index3.d.ts","names":[],"sources":["../../src/plugins/screenshots/index.ts"],"mappings":";UAqBiB;EACf;EACA;EACA;EACA;;;UAIe;EACf;EACA;;EAEA,KAAK;;EAEL;IAAQ;IAAe;;;UAGR;;EAEf;;;UAIe;EACf,QAAQ,SAAS,SAAS,UAAU,iBAAiB,QAAQ;;EAE7D,OAAO,KAAK,MAAM,IAAI,KAAK,wBAAwB,QAAQ;;EAE3D,OAAO,SAAS,UAAU;;;UAIX;;EAEf,KAAK;IAAe,MAAM,WAAW;IAAc;IAAc;;;;YAIvD;IACR,aAAa;;YAEL;IACR,aAAa;;;;;;;UAQA;;EAEf;EACA;;EAEA;EACA;;EAEA;;;KAIU,kBAAkB,SAAS,KAAK,8DAA8D;;;;;;UAOzF;EACf;;EAEA;;EAEA;;EAEA,QAAQ,iBAAiB,QAAQ;IAAe,KAAK;IAAY,MAAM;;;;UAIxD;;EAEf;;EAEA;;;cAIW,WAAU;;;;;cA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