@k2b/ui 0.60.0 → 0.62.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 (109) hide show
  1. package/dist/browser/actions/FilterChip.js +3 -0
  2. package/dist/browser/actions/FilterChip.js.map +1 -1
  3. package/dist/browser/chat/ChatPrimitives.js +435 -420
  4. package/dist/browser/chat/ChatPrimitives.js.map +1 -1
  5. package/dist/browser/chat/ChatTasks.js +78 -73
  6. package/dist/browser/chat/ChatTasks.js.map +1 -1
  7. package/dist/browser/chat/ChatTimeline.js +3 -0
  8. package/dist/browser/chat/ChatTimeline.js.map +1 -1
  9. package/dist/browser/content/ActivityList.js +379 -290
  10. package/dist/browser/content/ActivityList.js.map +1 -1
  11. package/dist/browser/content/FileView.js +0 -12
  12. package/dist/browser/content/FileView.js.map +1 -1
  13. package/dist/browser/content/Lightbox.js +31 -11
  14. package/dist/browser/content/Lightbox.js.map +1 -1
  15. package/dist/browser/content/PdfPages.js +26 -1
  16. package/dist/browser/content/PdfPages.js.map +1 -1
  17. package/dist/browser/content/RunLog.js +719 -0
  18. package/dist/browser/content/RunLog.js.map +1 -0
  19. package/dist/browser/content/activity-messages.js +2 -2
  20. package/dist/browser/content/activity-messages.js.map +1 -1
  21. package/dist/browser/content/file-view-preview.js +13 -0
  22. package/dist/browser/content/file-view-preview.js.map +1 -1
  23. package/dist/browser/content/index.js +5 -4
  24. package/dist/browser/content/index.js.map +1 -1
  25. package/dist/browser/content/run-log-messages.js +134 -0
  26. package/dist/browser/content/run-log-messages.js.map +1 -0
  27. package/dist/browser/feedback/dialog-core.js +24 -27
  28. package/dist/browser/feedback/dialog-core.js.map +1 -1
  29. package/dist/browser/feedback/dialog-frame-motion.js +506 -15
  30. package/dist/browser/feedback/dialog-frame-motion.js.map +1 -1
  31. package/dist/browser/feedback/prompt-sheet.js +1 -0
  32. package/dist/browser/feedback/prompt-sheet.js.map +1 -1
  33. package/dist/browser/feedback/prompts.js +5 -1
  34. package/dist/browser/feedback/prompts.js.map +1 -1
  35. package/dist/browser/feedback/toast.js +11 -1
  36. package/dist/browser/feedback/toast.js.map +1 -1
  37. package/dist/browser/internal/step-row.js +78 -0
  38. package/dist/browser/internal/step-row.js.map +1 -0
  39. package/dist/browser/layout/PullToRefresh.js +76 -23
  40. package/dist/browser/layout/PullToRefresh.js.map +1 -1
  41. package/dist/browser/layout/refresh-messages.js +4 -2
  42. package/dist/browser/layout/refresh-messages.js.map +1 -1
  43. package/dist/browser/layout/sheet-motion.js +3 -3
  44. package/dist/browser/layout/sheet-motion.js.map +1 -1
  45. package/dist/ssr/actions/FilterChip.js +3 -0
  46. package/dist/ssr/actions/FilterChip.js.map +1 -1
  47. package/dist/ssr/chat/ChatPrimitives.js +109 -71
  48. package/dist/ssr/chat/ChatPrimitives.js.map +1 -1
  49. package/dist/ssr/chat/ChatTasks.js +31 -16
  50. package/dist/ssr/chat/ChatTasks.js.map +1 -1
  51. package/dist/ssr/chat/ChatTimeline.js +3 -0
  52. package/dist/ssr/chat/ChatTimeline.js.map +1 -1
  53. package/dist/ssr/content/ActivityList.js +199 -114
  54. package/dist/ssr/content/ActivityList.js.map +1 -1
  55. package/dist/ssr/content/FileView.js +0 -12
  56. package/dist/ssr/content/FileView.js.map +1 -1
  57. package/dist/ssr/content/Lightbox.js +31 -11
  58. package/dist/ssr/content/Lightbox.js.map +1 -1
  59. package/dist/ssr/content/PdfPages.js +26 -1
  60. package/dist/ssr/content/PdfPages.js.map +1 -1
  61. package/dist/ssr/content/RunLog.js +471 -0
  62. package/dist/ssr/content/RunLog.js.map +1 -0
  63. package/dist/ssr/content/activity-messages.js +2 -2
  64. package/dist/ssr/content/activity-messages.js.map +1 -1
  65. package/dist/ssr/content/file-view-preview.js +13 -0
  66. package/dist/ssr/content/file-view-preview.js.map +1 -1
  67. package/dist/ssr/content/index.js +5 -4
  68. package/dist/ssr/content/index.js.map +1 -1
  69. package/dist/ssr/content/run-log-messages.js +134 -0
  70. package/dist/ssr/content/run-log-messages.js.map +1 -0
  71. package/dist/ssr/feedback/dialog-core.js +24 -27
  72. package/dist/ssr/feedback/dialog-core.js.map +1 -1
  73. package/dist/ssr/feedback/dialog-frame-motion.js +506 -15
  74. package/dist/ssr/feedback/dialog-frame-motion.js.map +1 -1
  75. package/dist/ssr/feedback/prompt-sheet.js +1 -0
  76. package/dist/ssr/feedback/prompt-sheet.js.map +1 -1
  77. package/dist/ssr/feedback/prompts.js +5 -1
  78. package/dist/ssr/feedback/prompts.js.map +1 -1
  79. package/dist/ssr/feedback/toast.js +11 -1
  80. package/dist/ssr/feedback/toast.js.map +1 -1
  81. package/dist/ssr/internal/step-row.js +35 -0
  82. package/dist/ssr/internal/step-row.js.map +1 -0
  83. package/dist/ssr/layout/PullToRefresh.js +67 -16
  84. package/dist/ssr/layout/PullToRefresh.js.map +1 -1
  85. package/dist/ssr/layout/refresh-messages.js +4 -2
  86. package/dist/ssr/layout/refresh-messages.js.map +1 -1
  87. package/dist/ssr/layout/sheet-motion.js +3 -3
  88. package/dist/ssr/layout/sheet-motion.js.map +1 -1
  89. package/dist/styles.css +1 -1
  90. package/dist/types/actions/FilterChip.d.ts +9 -0
  91. package/dist/types/chat/ChatPrimitives.d.ts +6 -0
  92. package/dist/types/chat/ChatTimeline.d.ts +2 -0
  93. package/dist/types/content/ActivityList.d.ts +24 -6
  94. package/dist/types/content/FileView.d.ts +0 -5
  95. package/dist/types/content/Lightbox.d.ts +7 -5
  96. package/dist/types/content/RunLog.d.ts +53 -0
  97. package/dist/types/content/file-view-preview.d.ts +5 -0
  98. package/dist/types/content/index.d.ts +4 -3
  99. package/dist/types/content/run-log-messages.d.ts +61 -0
  100. package/dist/types/feedback/dialog-core.d.ts +3 -1
  101. package/dist/types/feedback/dialog-frame-motion.d.ts +26 -1
  102. package/dist/types/feedback/prompt-sheet.d.ts +1 -0
  103. package/dist/types/feedback/prompts.d.ts +4 -0
  104. package/dist/types/feedback/toast.d.ts +9 -1
  105. package/dist/types/internal/step-row.d.ts +19 -0
  106. package/dist/types/layout/PullToRefresh.d.ts +2 -2
  107. package/dist/types/layout/refresh-messages.d.ts +1 -0
  108. package/dist/types/layout/sheet-motion.d.ts +2 -2
  109. package/package.json +9 -7
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["feedback/dialog-frame-motion.ts"],"sourcesContent":["/**\n * The motion of one dialog element's frame while it stays open: a level that replaces another morphs the frame from\n * the old size to the new one in the same place, without stacking. The old content fades out, the frame changes size\n * over `--k2b-motion-morph` with `--k2b-ease-morph`, and the new content fades in, set at its final size from the\n * first frame so it never rewraps; the frame clips meanwhile. Anything that interrupts a change turns around from the\n * values the eye sees; the endings of the interrupted change are dropped, not run. Reduced motion swaps in one frame.\n *\n * The frame's own size is animated, a named exception to \"transform and opacity only\" (see the motion guide): the\n * frame stands alone above the page, so nothing beside it moves.\n */\n\nimport { restoreScroll } from \"../internal/scroll-places\";\n\nexport { afterExitTransitions } from \"../internal/exit-motion\";\n\n/** Shares of the morph: the old content fades out in the first 80 of 280 ms, the new one waits 110 ms, then fades in 140 ms. */\nconst LEAVE_SHARE = 80 / 280;\nconst ARRIVE_DELAY_SHARE = 110 / 280;\nconst ARRIVE_SHARE = 140 / 280;\n\ntype Anchor = \"center\" | \"bottom\" | \"fixed\";\ntype Fade = { animation: Animation; to: 0 | 1; done: () => void };\n\nexport type FrameMotion = {\n /**\n * Before a level replaces the shown one: remembers the frame as the eye sees it and takes `leaving` out of the flow,\n * visible and inert, at its present size.\n */\n begin: (leaving: HTMLElement, back?: boolean) => void;\n /**\n * A level that replaces another keeps the same `<dialog>`, so a screen reader does not reliably say its new name.\n * The live region inside the dialog does (`announce()` regions sit outside a modal dialog and are silent there): the\n * shown level's name, and for an `alertdialog` its sentence too.\n */\n announce: (role: \"dialog\" | \"alertdialog\") => void;\n /**\n * After `arriving` is shown and its frame presentation applied: morphs the frame to its size and fades the contents.\n * `left` runs once `leaving` has faded out (hide a lower level, or dispose a closed one).\n */\n arrive: (arriving: HTMLElement, left: () => void) => void;\n /** Ends every motion now and runs the pending endings, for a frame that leaves the document. */\n stop: () => void;\n /**\n * For a frame that closes and fades out: keeps the size, place and contents exactly as the eye sees them now, and\n * returns the pending endings to run once the frame has left.\n */\n freeze: () => () => void;\n};\n\nconst STYLE_HELD = [\"position\", \"inset\", \"width\", \"height\", \"flex\"] as const;\n\nexport const createFrameMotion = (dialog: HTMLDialogElement): FrameMotion => {\n // Exists before its first message: a region inserted and filled at once is often not read.\n const live = document.createElement(\"div\");\n live.className = \"k2b-sr-only\";\n live.setAttribute(\"aria-live\", \"polite\");\n live.dataset.k2bDialogLive = \"\";\n dialog.prepend(live);\n // A region that was just inserted is read only once the accessibility tree knows it: its first message waits a frame.\n let fresh = true;\n requestAnimationFrame(() => {\n fresh = false;\n });\n let frame: Animation | undefined;\n const fades = new Map<HTMLElement, Fade>();\n\n /** A time token in milliseconds; the stylesheet may hand it over as `280ms` or, registered, as `0.28s`. */\n const token = (name: string) => {\n const value = getComputedStyle(dialog).getPropertyValue(name).trim();\n const amount = Number.parseFloat(value) || 0;\n return value.endsWith(\"ms\") ? amount : value.endsWith(\"s\") ? amount * 1000 : amount;\n };\n const curve = (name: string, fallback: string) => getComputedStyle(dialog).getPropertyValue(name).trim() || fallback;\n const animatable = () => typeof dialog.animate === \"function\";\n\n /** Where the frame stays put while it changes size: centred by the stylesheet, a sheet on the bottom edge, or placed. */\n const anchor = (): Anchor => {\n if (dialog.style.position === \"fixed\") return \"fixed\";\n if (!dialog.classList.contains(\"k2b-bottom-sheet-frame\")) return \"center\";\n const asDialog =\n dialog.classList.contains(\"is-adaptive\") && typeof matchMedia === \"function\" && matchMedia(\"(min-width: 48rem)\").matches;\n return asDialog ? \"center\" : \"bottom\";\n };\n /** What the eye sees now, including a size or place that is still moving. */\n const seen = () => ({\n width: dialog.offsetWidth,\n height: dialog.offsetHeight,\n top: Number.parseFloat(getComputedStyle(dialog).top) || 0,\n });\n\n /** Its exact laid-out size: `offsetWidth` rounds, and a content a fraction narrower can wrap differently. */\n const laidOut = (element: HTMLElement) => {\n const { width, height } = getComputedStyle(element);\n return { width, height };\n };\n /** Out of the flow, at the size it has now, so it neither moves nor takes room while it fades. */\n const hold = (element: HTMLElement) => {\n const { width, height } = laidOut(element);\n element.style.position = \"absolute\";\n element.style.inset = \"0 auto auto 0\";\n element.style.width = width;\n element.style.height = height;\n element.inert = true;\n element.setAttribute(\"aria-hidden\", \"true\");\n };\n const unhold = (element: HTMLElement) => {\n for (const property of STYLE_HELD) element.style.removeProperty(property);\n element.inert = false;\n element.removeAttribute(\"aria-hidden\");\n };\n /** At its final size while the frame moves around it. */\n const pin = (element: HTMLElement) => {\n const { width, height } = laidOut(element);\n element.style.width = width;\n element.style.height = height;\n element.style.flex = \"none\";\n };\n\n const fade = (element: HTMLElement, to: 0 | 1, duration: number, delay: number, done: () => void) => {\n const running = fades.get(element);\n // A fade that is under way turns around from its current value; only content that was hidden starts at 0.\n const from = running ? Number(getComputedStyle(element).opacity) : to === 1 ? 0 : 1;\n running?.animation.cancel();\n fades.delete(element);\n if (!duration || !animatable()) {\n done();\n return;\n }\n const animation = element.animate([{ opacity: from }, { opacity: to }], {\n duration,\n delay: running ? 0 : delay,\n easing: \"linear\",\n fill: \"both\",\n });\n fades.set(element, { animation, to, done });\n animation.onfinish = () => {\n if (fades.get(element)?.animation !== animation) return;\n fades.delete(element);\n done();\n animation.cancel();\n };\n };\n\n const endFrame = () => {\n frame?.cancel();\n frame = undefined;\n delete dialog.dataset.k2bFrameMotion;\n };\n\n let started: { from: ReturnType<typeof seen>; anchor: Anchor; leaving: HTMLElement; scrolled: boolean } | undefined;\n /** The frame scrolls its contents itself, as unstructured content does. */\n const scrolled = () => dialog.scrollTop > 0 || dialog.scrollLeft > 0;\n\n const begin: FrameMotion[\"begin\"] = (leaving, back) => {\n started = { from: seen(), anchor: anchor(), leaving, scrolled: scrolled() };\n endFrame();\n hold(leaving);\n // The frame clips from now on: the held content, larger than the new one, must not give it a scrollbar while the\n // new content is measured and pinned (a classic scrollbar would narrow it until the old content has gone). A frame\n // that scrolls itself swaps at once and keeps its scroll place instead.\n if (!started.scrolled) dialog.dataset.k2bFrameMotion = \"\";\n if (!back) return;\n // The shown level stays the dialog's last child, as sheets and tone rules expect; the closed one moves before it,\n // with the scroll places the dialog core kept for it.\n dialog.insertBefore(leaving, live.nextSibling);\n restoreScroll(leaving);\n };\n\n const announce: FrameMotion[\"announce\"] = (role) => {\n const texts = (attribute: string) =>\n (dialog.getAttribute(attribute) ?? \"\")\n .split(/\\s+/)\n .map((id) => (id ? (document.getElementById(id)?.textContent ?? \"\").trim() : \"\"))\n .filter(Boolean);\n const name = dialog.getAttribute(\"aria-label\") ?? texts(\"aria-labelledby\").join(\" \");\n const sentence = role === \"alertdialog\" ? texts(\"aria-describedby\").join(\" \") : \"\";\n live.textContent = \"\";\n const say = () => {\n live.textContent = [name, sentence].filter(Boolean).join(\" \");\n };\n requestAnimationFrame(() => (fresh ? requestAnimationFrame(say) : say()));\n };\n\n const arrive: FrameMotion[\"arrive\"] = (arriving, left) => {\n const change = started;\n started = undefined;\n if (!change) return;\n const { from, leaving } = change;\n unhold(arriving);\n // Only this change's two contents share the frame: one that still fades out from an earlier change is gone now\n // (one that comes back turns its fade around below).\n for (const [element, { animation, to, done }] of fades)\n if (to === 0 && element !== leaving && element !== arriving) {\n fades.delete(element);\n animation.cancel();\n done();\n }\n const leave = () => {\n unhold(leaving);\n left();\n };\n const duration = animatable() ? token(\"--k2b-motion-morph\") : 0;\n // Between a sheet and a centred dialog there is no shared edge to morph from. A frame that scrolls itself swaps at\n // once too: its contents stand in its scrolled space, which a moving size would cut or shift.\n if (!duration || anchor() !== change.anchor || change.scrolled || scrolled()) {\n delete dialog.dataset.k2bFrameMotion;\n fade(leaving, 0, 0, 0, leave);\n fade(arriving, 1, 0, 0, () => {});\n return;\n }\n const to = seen();\n pin(arriving);\n // The new level's own size limits would cut the old size at the first frame: the motion sets both sizes itself.\n const size = (geometry: typeof from) => ({\n width: `${geometry.width}px`,\n height: `${geometry.height}px`,\n minWidth: \"0\",\n minHeight: \"0\",\n maxWidth: \"none\",\n maxHeight: \"none\",\n ...(change.anchor === \"center\" ? { top: `${geometry.top}px` } : {}),\n });\n dialog.dataset.k2bFrameMotion = \"\";\n const animation = dialog.animate([size(from), size(to)], { duration, easing: curve(\"--k2b-ease-morph\", \"ease-out\") });\n frame = animation;\n // The new content keeps its final size until the frame has arrived there too, so it never rewraps; its fade\n // ends earlier (at 250 of 280 ms).\n animation.onfinish = () => {\n if (frame !== animation) return;\n endFrame();\n for (const property of [\"width\", \"height\", \"flex\"] as const) arriving.style.removeProperty(property);\n // A sheet measures its rests again at the frame's new size.\n dialog.dispatchEvent(new Event(\"k2b-frame-resize\"));\n };\n fade(leaving, 0, duration * LEAVE_SHARE, 0, leave);\n fade(arriving, 1, duration * ARRIVE_SHARE, duration * ARRIVE_DELAY_SHARE, () => {});\n };\n\n const stop = () => {\n started = undefined;\n endFrame();\n const pending = [...fades.values()];\n fades.clear();\n for (const { animation, done } of pending) {\n animation.cancel();\n done();\n }\n };\n\n const freeze = () => {\n started = undefined;\n // What the eye sees stays: the running values become the frame's and the contents' own styles.\n if (frame) {\n frame.commitStyles();\n frame.cancel();\n frame = undefined;\n }\n const pending = [...fades.values()];\n fades.clear();\n for (const { animation } of pending) {\n animation.commitStyles();\n animation.cancel();\n }\n return () => {\n for (const { done } of pending) done();\n };\n };\n\n return { begin, arrive, announce, stop, freeze };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,aAAa,QAAQ,2BAA2B;AAEzD,SAAS,oBAAoB,QAAQ,yBAAyB;;AAE9D;AACA,MAAM,WAAW,GAAG,EAAE,GAAG,GAAG;AAC5B,MAAM,kBAAkB,GAAG,GAAG,GAAG,GAAG;AACpC,MAAM,YAAY,GAAG,GAAG,GAAG,GAAG;AA+B9B,MAAM,UAAU,GAAG,CAAC,UAAU,E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AAC,CAAC;IACpB;IACA,OAAO,MAAM;MACX,KAAK,MAAM;QAAE;MAAK,CAAC,IAAI,OAAO,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;EACH,CAAC;EAED,OAAO;IAAE,KAAK;IAAE,MAAM;IAAE,QAAQ;IAAE,IAAI;IAAE;EAAO,CAAC;AAClD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["feedback/dialog-frame-motion.ts"],"sourcesContent":["/**\n * The motion of one dialog element's frame while it stays open: a level that replaces another morphs the frame from\n * the old size to the new one in the same place, without stacking. The old content fades out, the frame changes size\n * over `--k2b-motion-morph` with `--k2b-ease-morph`, and the new content fades in, set at its final size from the\n * first frame so it never rewraps; the frame clips meanwhile. Anything that interrupts a change turns around from the\n * values the eye sees; the endings of the interrupted change are dropped, not run. Reduced motion swaps in one frame.\n *\n * An opted-in frame also follows its content's height while it is open: when a notice comes or goes, fields appear, or text\n * grows, the frame goes from the height the eye sees to the new one over `--k2b-motion-fold` with `--k2b-ease-glide`,\n * and new content fades in over `--k2b-motion-fast` from 40 % of that time. Its top edge stays where it is: it grows\n * downwards and moves up together with growth only when the room below runs out; a sheet grows from the bottom edge. Frames with a size of\n * their own (fixed, workspace, full, sheets with detents) never follow. Neither the first open, the close, a window\n * resize, nor the on-screen keyboard starts an animation; a resize during a fold retargets it.\n *\n * The frame's own size is animated, a named exception to \"transform and opacity only\" (see the motion guide): the\n * frame stands alone above the page, so nothing beside it moves.\n */\n\nimport { restoreScroll } from \"../internal/scroll-places\";\n\nexport { afterExitTransitions } from \"../internal/exit-motion\";\n\n/** New content fades in from this share of the fold. */\nconst FOLD_DELAY_SHARE = 0.4;\n/** Frames whose size is their own: they never follow their content. A sheet with detents only while it is a sheet. */\nconst OWN_SIZE = \".is-fixed, .is-workspace, .k2b-dialog--full\";\n\n/** Shares of the morph: the old content fades out in the first 80 of 280 ms, the new one waits 110 ms, then fades in 140 ms. */\nconst LEAVE_SHARE = 80 / 280;\nconst ARRIVE_DELAY_SHARE = 110 / 280;\nconst ARRIVE_SHARE = 140 / 280;\n\ntype Anchor = \"center\" | \"bottom\" | \"fixed\";\ntype Position = { x: number; y: number } | null | undefined;\ntype Fade = { animation: Animation; to: 0 | 1; done: () => void };\n\nexport type FrameMotion = {\n /**\n * Before a level replaces the shown one: remembers the frame as the eye sees it and takes `leaving` out of the flow,\n * visible and inert, at its present size.\n */\n begin: (leaving: HTMLElement, back?: boolean) => void;\n /**\n * A level that replaces another keeps the same `<dialog>`, so a screen reader does not reliably say its new name.\n * The live region inside the dialog does (`announce()` regions sit outside a modal dialog and are silent there): the\n * shown level's name, and for an `alertdialog` its sentence too.\n */\n announce: (role: \"dialog\" | \"alertdialog\") => void;\n /**\n * After `arriving` is shown and its frame presentation applied: morphs the frame to its size and fades the contents.\n * `left` runs once `leaving` has faded out (hide a lower level, or dispose a closed one).\n */\n arrive: (arriving: HTMLElement, left: () => void, followContent?: boolean) => void;\n /** Follows only opted-in levels; `arrive` passes the arriving level's choice. */\n follow: (level: HTMLElement, enabled?: boolean) => void;\n /** Ends every motion now and runs the pending endings, for a frame that leaves the document. */\n stop: () => void;\n /** A changed explicit position wins over a fold; returns false for an unchanged position. */\n position: (previous: Position, next: Position) => boolean;\n /**\n * For a frame that closes and fades out: keeps the size, place and contents exactly as the eye sees them now, and\n * returns the pending endings to run once the frame has left.\n */\n freeze: () => () => void;\n};\n\nconst STYLE_HELD = [\"position\", \"inset\", \"width\", \"height\", \"flex\"] as const;\n\nexport const createFrameMotion = (dialog: HTMLDialogElement): FrameMotion => {\n // Exists before its first message: a region inserted and filled at once is often not read.\n const live = document.createElement(\"div\");\n live.className = \"k2b-sr-only\";\n live.setAttribute(\"aria-live\", \"polite\");\n live.dataset.k2bDialogLive = \"\";\n dialog.prepend(live);\n // A region that was just inserted is read only once the accessibility tree knows it: its first message waits a frame.\n let fresh = true;\n requestAnimationFrame(() => {\n fresh = false;\n });\n let frame: Animation | undefined;\n /** Whether the running frame animation is a morph between levels or a fold to new content. */\n let frameKind: \"morph\" | \"fold\" | undefined;\n const fades = new Map<HTMLElement, Fade>();\n\n /** A time token in milliseconds; the stylesheet may hand it over as `280ms` or, registered, as `0.28s`. */\n const token = (name: string) => {\n const value = getComputedStyle(dialog).getPropertyValue(name).trim();\n const amount = Number.parseFloat(value) || 0;\n return value.endsWith(\"ms\") ? amount : value.endsWith(\"s\") ? amount * 1000 : amount;\n };\n const curve = (name: string, fallback: string) => getComputedStyle(dialog).getPropertyValue(name).trim() || fallback;\n const animatable = () => typeof dialog.animate === \"function\";\n\n /** Where the frame stays put while it changes size: centred by the stylesheet, a sheet on the bottom edge, or placed. */\n const anchor = (): Anchor => {\n if (dialog.style.position === \"fixed\") return \"fixed\";\n if (!dialog.classList.contains(\"k2b-bottom-sheet-frame\")) return \"center\";\n const asDialog =\n dialog.classList.contains(\"is-adaptive\") && typeof matchMedia === \"function\" && matchMedia(\"(min-width: 48rem)\").matches;\n return asDialog ? \"center\" : \"bottom\";\n };\n /** Following content also respects a caller's stylesheet that anchors the top edge (translateX only), as setPosition does inline. */\n const followAnchor = (): Anchor => {\n const where = anchor();\n if (where !== \"center\" || dialog.classList.contains(\"k2b-bottom-sheet-frame\")) return where;\n const transform = getComputedStyle(dialog).transform;\n return !transform || transform === \"none\" || new DOMMatrixReadOnly(transform).m42 === 0 ? \"fixed\" : \"center\";\n };\n /** Frames use border-box sizing. Read their fractional CSS dimensions, before zoom or transforms are applied. */\n const seen = () => {\n const style = getComputedStyle(dialog);\n return {\n width: Number.parseFloat(style.width) || 0,\n height: Number.parseFloat(style.height) || 0,\n top: Number.parseFloat(style.top) || 0,\n };\n };\n\n /** Its exact laid-out size: `offsetWidth` rounds, and a content a fraction narrower can wrap differently. */\n const laidOut = (element: HTMLElement) => {\n const { width, height } = getComputedStyle(element);\n return { width, height };\n };\n /** Out of the flow, at the size it has now, so it neither moves nor takes room while it fades. */\n const hold = (element: HTMLElement) => {\n const { width, height } = laidOut(element);\n element.style.position = \"absolute\";\n element.style.inset = \"0 auto auto 0\";\n element.style.width = width;\n element.style.height = height;\n element.inert = true;\n element.setAttribute(\"aria-hidden\", \"true\");\n };\n const unhold = (element: HTMLElement) => {\n for (const property of STYLE_HELD) element.style.removeProperty(property);\n element.inert = false;\n element.removeAttribute(\"aria-hidden\");\n };\n /** At its final size while the frame moves around it. */\n const pin = (element: HTMLElement) => {\n const { width, height } = laidOut(element);\n element.style.width = width;\n element.style.height = height;\n element.style.flex = \"none\";\n };\n\n const fade = (element: HTMLElement, to: 0 | 1, duration: number, delay: number, done: () => void) => {\n const running = fades.get(element);\n // A fade that is under way turns around from its current value; only content that was hidden starts at 0.\n const from = running ? Number(getComputedStyle(element).opacity) : to === 1 ? 0 : 1;\n running?.animation.cancel();\n fades.delete(element);\n if (!duration || !animatable()) {\n done();\n return;\n }\n const animation = element.animate([{ opacity: from }, { opacity: to }], {\n duration,\n delay: running ? 0 : delay,\n easing: \"linear\",\n fill: \"both\",\n });\n fades.set(element, { animation, to, done });\n animation.onfinish = () => {\n if (fades.get(element)?.animation !== animation) return;\n fades.delete(element);\n done();\n animation.cancel();\n };\n };\n\n const endFrame = () => {\n frame?.cancel();\n frame = undefined;\n frameKind = undefined;\n delete dialog.dataset.k2bFrameMotion;\n };\n\n // ---- Following the content's height ----\n\n let level: HTMLElement | undefined;\n /** Between measurements the frame holds its height; content never grows it ahead of a fold. */\n let rested = 0;\n let placed = false;\n let followingAnchor: Anchor | undefined;\n let initialMeasure = false;\n let viewportHeight = window.innerHeight;\n let queued = 0;\n let resized = false;\n let firstRest = false;\n let restFrame = 0;\n let busy = false;\n let loadingChange = false;\n let arrived = new Set<HTMLElement>();\n let arrivalFrame = 0;\n const pointers = new Set<number>();\n let deferredFold = false;\n\n const ownSize = () => dialog.matches(OWN_SIZE) || (dialog.matches(\"[data-sheet-detents]\") && anchor() === \"bottom\");\n const BUSY_CONTENT = '[aria-busy=\"true\"]:not(button, [role=\"button\"])';\n const isBusyNode = (node: Element) => node.matches(BUSY_CONTENT) || Boolean(node.querySelector(BUSY_CONTENT));\n const isBusy = () => Boolean(level && isBusyNode(level));\n const textFocused = () => {\n const active = document.activeElement;\n if (!(active instanceof HTMLElement) || !level?.contains(active)) return false;\n if (active instanceof HTMLInputElement) return /^(text|search|email|url|tel|password|number)$/.test(active.type);\n return active instanceof HTMLTextAreaElement || active.isContentEditable;\n };\n const place = (offset: number) => {\n placed = offset !== 0;\n if (placed) dialog.style.top = `${window.innerHeight / 2 + offset}px`;\n else dialog.style.removeProperty(\"top\");\n };\n /** Keep the top edge, moving up with growth only as far as the new height needs. */\n const edgeFor = (shown: ReturnType<typeof seen>, height: number) => {\n const viewport = window.visualViewport?.scale === 1 ? window.visualViewport : null;\n const bottom = viewport ? viewport.offsetTop + viewport.height : window.innerHeight;\n const cap = Number.parseFloat(getComputedStyle(dialog).maxHeight);\n const margin = Number.isFinite(cap) ? Math.max(0, ((viewport?.height ?? window.innerHeight) - cap) / 2) : 0;\n return Math.max((viewport?.offsetTop ?? 0) + margin, Math.min(shown.top - shown.height / 2, bottom - margin - height));\n };\n const holdHeight = (height: number) => {\n // CSSOM decimal serialization can fall just below the actual layout unit (e.g. 284.984 instead of\n // 284.984375). Writing it back verbatim loses a unit and can give a flex body a 1 px scroll overflow.\n // A thousandth of a pixel restores that unit without rounding the frame to a whole CSS pixel.\n dialog.style.height = `${height + 0.001}px`;\n rested = height;\n };\n const changed = () => {\n if (!level || queued) return;\n queued = requestAnimationFrame(() => {\n queued = 0;\n fold();\n });\n };\n\n const fold = () => {\n if (!level || started || frameKind === \"morph\") return;\n const loading = busy || loadingChange || isBusy();\n const where = followAnchor();\n const anchorChanged = followingAnchor !== where;\n // A pressed control stays under the pointer even when a size report, rather than focusout, starts the fold.\n // Viewport/anchor corrections and loading still take their natural size immediately.\n if (pointers.size && firstRest && !initialMeasure && !loading && !resized && !anchorChanged) {\n deferredFold = true;\n return;\n }\n deferredFold = false;\n // A child already animating its height owns that motion. Measure its final height once, rather than folding\n // the frame towards intermediate samples and then folding it a second time.\n const heightMotion = dialog\n .getAnimations({ subtree: true })\n .filter(\n (animation) =>\n animation !== frame &&\n animation.timeline === document.timeline &&\n Number.isFinite(animation.effect?.getComputedTiming().endTime) &&\n animation.playState === \"running\" &&\n animation.effect instanceof KeyframeEffect &&\n animation.effect.target !== dialog &&\n animation.effect\n .getKeyframes()\n .some(\n (keyframe) => \"height\" in keyframe || \"maxHeight\" in keyframe || \"minHeight\" in keyframe || \"gridTemplateRows\" in keyframe,\n ),\n );\n if (heightMotion.length && !resized && !anchorChanged) {\n for (const animation of heightMotion)\n if (!waiting.has(animation)) {\n waiting.add(animation);\n void animation.finished.catch(() => {}).then(changed);\n }\n return;\n }\n if (refreshShells) {\n refreshShells = false;\n observeContent(level);\n }\n const added = arrived;\n arrived = new Set();\n busy = isBusy();\n loadingChange = false;\n const wasResize = resized;\n resized = false;\n // Release only the top owned here, before own-size/detent handling and natural-height measurement.\n if (anchorChanged) {\n if (placed) place(0);\n followingAnchor = where;\n }\n const shown = seen();\n if (wasResize && where === \"center\" && !placed && !anchorChanged) shown.top -= (window.innerHeight - viewportHeight) / 2;\n viewportHeight = window.innerHeight;\n const interrupted = Boolean(frame);\n if (interrupted) endFrame();\n // All measurement and layout writes run here, in a frame, never inside an observer delivery.\n dialog.style.removeProperty(\"height\");\n if (ownSize()) {\n rested = seen().height;\n return;\n }\n const natural = seen().height;\n const canFold = firstRest && !initialMeasure && !loading;\n const height = canFold && !wasResize && textFocused() ? Math.max(natural, shown.height) : natural;\n const from = interrupted ? shown.height : rested;\n const edge = edgeFor({ ...shown, height: from }, height);\n const offset = edge + height / 2 - window.innerHeight / 2;\n const moving = dialog.getAnimations().filter((animation) => animation.playState === \"running\" || animation.playState === \"paused\");\n const duration = canFold && (!wasResize || interrupted) && !moving.length && animatable() ? token(\"--k2b-motion-fold\") : 0;\n initialMeasure = false;\n holdHeight(height);\n if (!duration || Math.abs(height - from) < 1) {\n if (where === \"center\") place(firstRest && !anchorChanged ? offset : 0);\n if (Math.abs(height - from) >= 1 || wasResize) dialog.dispatchEvent(new Event(\"k2b-frame-resize\"));\n return;\n }\n // Both edges begin where the eye sees them. Top and height share one curve, so the bottom stays in view.\n const top = shown.top - from / 2;\n if (where === \"center\") place(offset);\n const keyframes =\n where === \"center\"\n ? [\n { height: `${from}px`, top: `${top + from / 2}px` },\n { height: `${height}px`, top: `${window.innerHeight / 2 + offset}px` },\n ]\n : [{ height: `${from}px` }, { height: `${height}px` }];\n dialog.dataset.k2bFrameMotion = \"\";\n const animation = dialog.animate(keyframes, { duration, easing: curve(\"--k2b-ease-glide\", \"ease-out\") });\n frame = animation;\n frameKind = \"fold\";\n animation.onfinish = () => {\n if (frame !== animation) return;\n if (where === \"center\") place(offset);\n endFrame();\n dialog.dispatchEvent(new Event(\"k2b-frame-resize\"));\n // An image or font can change intrinsic size while the frame clips its content.\n changed();\n };\n if (height > from) {\n const fast = token(\"--k2b-motion-fast\");\n const active = document.activeElement;\n const inFlow = (element: HTMLElement) => {\n for (let node: HTMLElement | null = element; node && node !== level; node = node.parentElement)\n if (node.getAttribute(\"aria-hidden\") === \"true\" || /^(absolute|fixed)$/.test(getComputedStyle(node).position)) return false;\n return true;\n };\n for (const element of added)\n if (element.isConnected && !element.contains(active) && !active?.contains(element) && inFlow(element))\n fade(element, 1, fast, duration * FOLD_DELAY_SHARE, () => {});\n }\n };\n\n const waiting = new WeakSet<Animation>();\n const known = new WeakSet<Element>();\n let firstDelivery = true;\n let followingMorph = false;\n const measured = new WeakMap<Element, { width: number; height: number }>();\n const watched = new Set<Element>();\n const shells = new WeakSet<Element>();\n let refreshShells = false;\n let sizes: ResizeObserver | undefined;\n const createSizes = () =>\n typeof ResizeObserver === \"function\"\n ? new ResizeObserver((entries) => {\n let resized = false;\n const initial = firstDelivery;\n firstDelivery = false;\n for (const { target, borderBoxSize, contentRect } of entries) {\n const box = borderBoxSize?.[0];\n const width = box?.inlineSize ?? contentRect.width;\n const height = box?.blockSize ?? contentRect.height;\n const previous = measured.get(target);\n measured.set(target, { width, height });\n const changedSize =\n previous === undefined ||\n !Number.isFinite(previous.width) ||\n !Number.isFinite(previous.height) ||\n Math.abs(width - previous.width) >= 0.01 ||\n Math.abs(height - previous.height) >= 0.01;\n resized ||= changedSize && (frameKind !== \"fold\" || !shells.has(target));\n }\n initialMeasure ||= initial && resized && !followingMorph;\n if (resized) changed();\n })\n : undefined;\n\n // Watch the structural shells down to natural-flow content, not every rendered row, word, or editor overlay.\n // A flex/grid or scrolling shell can be stretched by the held frame, so its children report intrinsic changes.\n // This traversal runs once per level; a preview replacing hundreds of descendants needs no observe/unobserve calls.\n const observeContent = (element: Element, pending: Element[] = [], stretched = true) => {\n const style = getComputedStyle(element);\n // Positioned overlays (for example MarkdownEditor's highlighted copy) do not contribute to the frame's height.\n if (\n element !== level &&\n (element.getAttribute(\"aria-hidden\") === \"true\" || style.position === \"absolute\" || style.position === \"fixed\")\n )\n return;\n if (!watched.has(element)) {\n watched.add(element);\n // Intrinsic padding and borders change the height the frame needs even when the content box stays put.\n // Match the observer's border box before its first delivery, preserving fractional layout dimensions.\n const inset = (axis: \"width\" | \"height\") =>\n style.boxSizing === \"border-box\"\n ? 0\n : axis === \"width\"\n ? Number.parseFloat(style.paddingLeft) +\n Number.parseFloat(style.paddingRight) +\n Number.parseFloat(style.borderLeftWidth) +\n Number.parseFloat(style.borderRightWidth)\n : Number.parseFloat(style.paddingTop) +\n Number.parseFloat(style.paddingBottom) +\n Number.parseFloat(style.borderTopWidth) +\n Number.parseFloat(style.borderBottomWidth);\n measured.set(element, {\n width: Number.parseFloat(style.width) + inset(\"width\"),\n height: Number.parseFloat(style.height) + inset(\"height\"),\n });\n pending.push(element);\n }\n // Only boxes stretched by the held frame need another observation level. A natural row already reports\n // all its descendants, even when it happens to use flex or grid internally.\n if (stretched && (element === level || /flex|grid|contents/.test(style.display) || /auto|scroll/.test(style.overflowY))) {\n shells.add(element);\n for (const child of element.children) {\n const childStyle = getComputedStyle(child);\n const grows = childStyle.flexGrow !== \"0\";\n const crossStretch =\n /flex/.test(style.display) &&\n !style.flexDirection.startsWith(\"column\") &&\n (childStyle.alignSelf === \"stretch\" || (childStyle.alignSelf === \"auto\" && /normal|stretch/.test(style.alignItems)));\n observeContent(child, pending, grows || crossStretch || /grid|contents/.test(style.display));\n }\n }\n if (element === level) for (const target of pending) sizes?.observe(target, { box: \"border-box\" });\n };\n let changes: MutationObserver | undefined;\n const createChanges = () =>\n typeof MutationObserver === \"function\"\n ? new MutationObserver((records) => {\n // Once per batch, keep only live observation targets. Losing an observed root (including the last\n // body child) is itself a size signal; the held shells cannot report that removal for us.\n for (const target of watched)\n if (!target.isConnected || !level?.contains(target)) {\n changed();\n sizes?.unobserve(target);\n watched.delete(target);\n }\n for (const record of records) for (const node of record.removedNodes) if (node instanceof Element) known.add(node);\n const eligible = (node: HTMLElement) => {\n for (let parent: HTMLElement | null = node; parent && parent !== level; parent = parent.parentElement)\n if (parent.getAttribute(\"aria-hidden\") === \"true\" || /^(absolute|fixed)$/.test(parent.style.position)) return false;\n return Boolean(level?.contains(node));\n };\n for (const record of records) {\n if (record.type === \"childList\") {\n for (const node of record.removedNodes) if (node instanceof Element) loadingChange ||= isBusyNode(node);\n for (const node of record.addedNodes)\n if (node instanceof HTMLElement) {\n const inFlow = eligible(node);\n if (!known.has(node) && inFlow) arrived.add(node);\n known.add(node);\n loadingChange ||= isBusyNode(node);\n if (inFlow && record.target instanceof Element && shells.has(record.target)) {\n // Registration has no layout read. The first report schedules structural discovery in a frame.\n watched.add(node);\n sizes?.observe(node, { box: \"border-box\" });\n refreshShells = true;\n }\n }\n } else if (record.type === \"attributes\" && record.target instanceof HTMLElement) {\n if (record.attributeName === \"aria-busy\" && record.oldValue === \"true\" && !record.target.matches('button, [role=\"button\"]'))\n loadingChange = true;\n if (record.attributeName === \"hidden\") {\n if (!record.target.hidden && eligible(record.target)) arrived.add(record.target);\n changed();\n }\n }\n }\n for (const node of arrived) {\n if (!eligible(node)) {\n arrived.delete(node);\n continue;\n }\n // Fade the outer arrival once, rather than fading every inserted descendant as well.\n for (let parent = node.parentElement; parent && parent !== level; parent = parent.parentElement)\n if (arrived.has(parent)) {\n arrived.delete(node);\n break;\n }\n }\n if (arrivalFrame) cancelAnimationFrame(arrivalFrame);\n // Let this batch's layout/ResizeObserver wave enqueue its measurement first. Unchanged previews\n // expire after that frame, without forcing layout or waiting for an unrelated later fold.\n arrivalFrame = requestAnimationFrame(() => {\n arrivalFrame = requestAnimationFrame(() => {\n arrivalFrame = 0;\n if (!queued && frameKind !== \"fold\") arrived.clear();\n });\n });\n })\n : undefined;\n const onFocusOut = () => {\n deferredFold = true;\n if (!pointers.size) changed();\n };\n const onFocusIn = () => {\n if (!textFocused() || frameKind !== \"fold\") return;\n const shown = seen();\n if (rested >= shown.height) return;\n holdHeight(shown.height);\n if (followAnchor() === \"center\") place(shown.top - window.innerHeight / 2);\n endFrame();\n };\n const onPointerDown = (event: PointerEvent) => {\n pointers.add(event.pointerId);\n if (frameKind !== \"fold\") return;\n const shown = seen();\n holdHeight(shown.height);\n if (followAnchor() === \"center\") place(shown.top - window.innerHeight / 2);\n endFrame();\n deferredFold = true;\n };\n const onPointerEnd = (event: PointerEvent) => {\n if (event.buttons === 0) {\n releasePointers();\n return;\n }\n pointers.delete(event.pointerId);\n if (!pointers.size && deferredFold) changed();\n };\n // A release in an iframe or outside this window need not deliver pointerup here. Recover on the next\n // trustworthy signal, without a timeout that could move a control underneath a real held press.\n const releasePointers = () => {\n if (!pointers.size) return;\n pointers.clear();\n changed();\n };\n const onPointer = (event: PointerEvent) => {\n if (event.buttons === 0) releasePointers();\n };\n const pointerEvents = [\n \"pointerdown\",\n \"pointermove\",\n \"pointerover\",\n \"pointerout\",\n \"pointerenter\",\n \"pointerleave\",\n \"gotpointercapture\",\n ] as const;\n const onVisibility = () => {\n if (document.visibilityState === \"hidden\") releasePointers();\n };\n const onResize = () => {\n resized = true;\n changed();\n };\n const onVisualResize = () => {\n if (window.visualViewport?.scale === 1) onResize();\n };\n\n const follow: FrameMotion[\"follow\"] = (next, enabled = false) => {\n dialog.toggleAttribute(\"data-k2b-follow-content\", enabled);\n if (!enabled) return;\n sizes ??= createSizes();\n changes ??= createChanges();\n sizes?.disconnect();\n watched.clear();\n changes?.disconnect();\n if (queued) cancelAnimationFrame(queued);\n queued = 0;\n level = next;\n firstDelivery = true;\n followingMorph = frameKind === \"morph\";\n initialMeasure = false;\n followingAnchor = followAnchor();\n viewportHeight = window.innerHeight;\n arrived = new Set();\n busy = isBusy();\n loadingChange = busy;\n // A morph's pinned content has its final size already. Its observer begins measuring after the morph releases it.\n if (frameKind !== \"morph\") {\n rested = seen().height;\n if (!ownSize()) holdHeight(rested);\n }\n known.add(next);\n for (const child of next.querySelectorAll(\"*\")) known.add(child);\n observeContent(next);\n changes?.observe(next, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeOldValue: true,\n attributeFilter: [\"hidden\", \"aria-busy\"],\n });\n next.addEventListener(\"focusout\", onFocusOut);\n next.addEventListener(\"focusin\", onFocusIn);\n dialog.addEventListener(\"pointerdown\", onPointerDown, true);\n window.addEventListener(\"pointerup\", onPointerEnd, true);\n window.addEventListener(\"pointercancel\", onPointerEnd, true);\n for (const type of pointerEvents) window.addEventListener(type, onPointer, true);\n window.addEventListener(\"lostpointercapture\", releasePointers, true);\n window.addEventListener(\"blur\", releasePointers);\n document.addEventListener(\"visibilitychange\", onVisibility);\n window.addEventListener(\"resize\", onResize);\n window.visualViewport?.addEventListener(\"resize\", onVisualResize);\n if (!firstRest) {\n const markRest = () => {\n restFrame = 0;\n if (level !== next) return;\n const moving = dialog.getAnimations().filter((animation) => animation.playState === \"running\" || animation.playState === \"paused\");\n if (!moving.length) firstRest = true;\n else\n void Promise.allSettled(moving.map((animation) => animation.finished)).then(() => {\n if (level === next) restFrame = requestAnimationFrame(markRest);\n });\n };\n restFrame = requestAnimationFrame(markRest);\n }\n };\n const unfollow = () => {\n sizes?.disconnect();\n watched.clear();\n changes?.disconnect();\n if (queued) cancelAnimationFrame(queued);\n if (restFrame) cancelAnimationFrame(restFrame);\n restFrame = 0;\n queued = 0;\n level?.removeEventListener(\"focusout\", onFocusOut);\n level?.removeEventListener(\"focusin\", onFocusIn);\n dialog.removeEventListener(\"pointerdown\", onPointerDown, true);\n window.removeEventListener(\"pointerup\", onPointerEnd, true);\n window.removeEventListener(\"pointercancel\", onPointerEnd, true);\n for (const type of pointerEvents) window.removeEventListener(type, onPointer, true);\n window.removeEventListener(\"lostpointercapture\", releasePointers, true);\n window.removeEventListener(\"blur\", releasePointers);\n document.removeEventListener(\"visibilitychange\", onVisibility);\n pointers.clear();\n deferredFold = false;\n if (arrivalFrame) cancelAnimationFrame(arrivalFrame);\n arrivalFrame = 0;\n arrived.clear();\n level = undefined;\n window.removeEventListener(\"resize\", onResize);\n window.visualViewport?.removeEventListener(\"resize\", onVisualResize);\n };\n\n let started: { from: ReturnType<typeof seen>; anchor: Anchor; leaving: HTMLElement; scrolled: boolean } | undefined;\n /** The frame scrolls its contents itself, as unstructured content does. */\n const scrolled = () => dialog.scrollTop > 0 || dialog.scrollLeft > 0;\n\n const begin: FrameMotion[\"begin\"] = (leaving, back) => {\n unfollow();\n started = { from: seen(), anchor: anchor(), leaving, scrolled: scrolled() };\n endFrame();\n dialog.style.removeProperty(\"height\");\n hold(leaving);\n // The frame clips from now on: the held content, larger than the new one, must not give it a scrollbar while the\n // new content is measured and pinned (a classic scrollbar would narrow it until the old content has gone). A frame\n // that scrolls itself swaps at once and keeps its scroll place instead.\n if (!started.scrolled) dialog.dataset.k2bFrameMotion = \"\";\n // A level that replaces another stands in the centre again.\n place(0);\n if (!back) return;\n // The shown level stays the dialog's last child, as sheets and tone rules expect; the closed one moves before it,\n // with the scroll places the dialog core kept for it.\n dialog.insertBefore(leaving, live.nextSibling);\n restoreScroll(leaving);\n };\n\n const announce: FrameMotion[\"announce\"] = (role) => {\n const texts = (attribute: string) =>\n (dialog.getAttribute(attribute) ?? \"\")\n .split(/\\s+/)\n .map((id) => (id ? (document.getElementById(id)?.textContent ?? \"\").trim() : \"\"))\n .filter(Boolean);\n const name = dialog.getAttribute(\"aria-label\") ?? texts(\"aria-labelledby\").join(\" \");\n const sentence = role === \"alertdialog\" ? texts(\"aria-describedby\").join(\" \") : \"\";\n live.textContent = \"\";\n const say = () => {\n live.textContent = [name, sentence].filter(Boolean).join(\" \");\n };\n requestAnimationFrame(() => (fresh ? requestAnimationFrame(say) : say()));\n };\n\n const arrive: FrameMotion[\"arrive\"] = (arriving, left, followContent = false) => {\n const change = started;\n started = undefined;\n if (!change) return;\n dialog.toggleAttribute(\"data-k2b-follow-content\", followContent);\n const { from, leaving } = change;\n unhold(arriving);\n // Only this change's two contents share the frame: one that still fades out from an earlier change is gone now\n // (one that comes back turns its fade around below).\n for (const [element, { animation, to, done }] of fades)\n if (to === 0 && element !== leaving && element !== arriving) {\n fades.delete(element);\n animation.cancel();\n done();\n }\n const leave = () => {\n unhold(leaving);\n left();\n };\n const duration = animatable() ? token(\"--k2b-motion-morph\") : 0;\n // Between a sheet and a centred dialog there is no shared edge to morph from. A frame that scrolls itself swaps at\n // once too: its contents stand in its scrolled space, which a moving size would cut or shift.\n if (!duration || anchor() !== change.anchor || change.scrolled || scrolled()) {\n delete dialog.dataset.k2bFrameMotion;\n fade(leaving, 0, 0, 0, leave);\n fade(arriving, 1, 0, 0, () => {});\n follow(arriving, followContent);\n return;\n }\n const to = seen();\n pin(arriving);\n // The new level's own size limits would cut the old size at the first frame: the motion sets both sizes itself.\n const size = (geometry: typeof from) => ({\n width: `${geometry.width}px`,\n height: `${geometry.height}px`,\n minWidth: \"0\",\n minHeight: \"0\",\n maxWidth: \"none\",\n maxHeight: \"none\",\n ...(change.anchor === \"center\" ? { top: `${geometry.top}px` } : {}),\n });\n dialog.dataset.k2bFrameMotion = \"\";\n const animation = dialog.animate([size(from), size(to)], { duration, easing: curve(\"--k2b-ease-morph\", \"ease-out\") });\n frame = animation;\n frameKind = \"morph\";\n // The new content keeps its final size until the frame has arrived there too, so it never rewraps; its fade\n // ends earlier (at 250 of 280 ms).\n animation.onfinish = () => {\n if (frame !== animation) return;\n endFrame();\n for (const property of [\"width\", \"height\", \"flex\"] as const) arriving.style.removeProperty(property);\n // A sheet measures its rests again at the size the morph reached.\n dialog.dispatchEvent(new Event(\"k2b-frame-resize\"));\n // Content that changed during the morph gets a fold from the size the morph reached.\n if (followContent) {\n holdHeight(to.height);\n firstRest = true;\n changed();\n }\n };\n follow(arriving, followContent);\n rested = to.height;\n fade(leaving, 0, duration * LEAVE_SHARE, 0, leave);\n fade(arriving, 1, duration * ARRIVE_SHARE, duration * ARRIVE_DELAY_SHARE, () => {});\n };\n\n const stop = () => {\n unfollow();\n started = undefined;\n endFrame();\n const pending = [...fades.values()];\n fades.clear();\n for (const { animation, done } of pending) {\n animation.cancel();\n done();\n }\n };\n\n const freeze = () => {\n unfollow();\n started = undefined;\n // What the eye sees stays: the running values become the frame's and the contents' own styles.\n if (frame) {\n frame.commitStyles();\n frame.cancel();\n frame = undefined;\n }\n const pending = [...fades];\n fades.clear();\n for (const [element, { animation }] of pending) {\n if (element.getClientRects().length) animation.commitStyles();\n animation.cancel();\n }\n return () => {\n for (const [, { done }] of pending) done();\n };\n };\n\n const position: FrameMotion[\"position\"] = (previous, next) => {\n if (previous?.x === next?.x && previous?.y === next?.y) return false;\n const folding = frameKind === \"fold\";\n if (folding) {\n holdHeight(seen().height);\n endFrame();\n }\n dialog.style.inset = \"\";\n placed = false;\n followingAnchor = undefined;\n // A fold stopped by the move resumes from the held height once the new place applies.\n if (folding) changed();\n return true;\n };\n\n return { begin, arrive, announce, follow, stop, freeze, position };\n};\n\n/** Every successful import, including retries, joins the current frame once and follows its current level. */\nexport const connectFrameMotion = (\n state: {\n element?: HTMLDialogElement;\n motion?: FrameMotion;\n stack: readonly { container: HTMLElement; role: \"dialog\" | \"alertdialog\"; follow?: boolean }[];\n },\n announced?: (typeof state.stack)[number],\n) => {\n if (!state.element?.isConnected) return;\n const top = state.stack.at(-1);\n if (!state.motion) {\n state.motion = createFrameMotion(state.element);\n if (top) state.motion.follow(top.container, top.follow);\n }\n if (top && top === announced) state.motion.announce(top.role);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,aAAa,QAAQ,2BAA2B;AAEzD,SAAS,oBAAoB,QAAQ,yBAAyB;;AAE9D;AACA,MAAM,gBAAgB,GAAG,GAAG;AAC5B;AACA,MAAM,QAAQ,GAAG,6CAA6C;;AAE9D;AACA,MAAM,WAAW,GAAG,EAAE,GAAG,GAAG;AAC5B,MAAM,kBAAkB,GAAG,GAAG,GAAG,GAAG;AACpC,MAAM,YAAY,GAAG,GAAG,GAAG,GAAG;AAoC9B,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAU;AAE5E,OAAO,MAAM,iBAAiB,GAAI,MAAyB,IAAkB;EAC3E;EACA,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC;EAC1C,IAAI,CAAC,SAAS,GAAG,aAAa;EAC9B,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC;EACxC,IAAI,CAAC,OAAO,CAAC,aAAa,GAAG,EAAE;EAC/B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;EACpB;EACA,IAAI,KAAK,GAAG,IAAI;EAChB,qBAAqB,CAAC,MAAM;IAC1B,KAAK,GAAG,KAAK;EACf,CAAC,CAAC;EACF,IAAI,KAA4B;EAChC;EACA,IAAI,SAAuC;EAC3C,MAAM,KAAK,GAAG,IAAI,GAAG,CAAoB,CAAC;;EAE1C;EACA,MAAM,KAAK,GAAI,IAAY,IAAK;IAC9B,MAAM,KAAK,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,IA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AI,KAAK;IAC5D,IAAI,QAAQ,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,QAAQ,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,OAAO,KAAK;IACpE,MAAM,OAAO,GAAG,SAAS,KAAK,MAAM;IACpC,IAAI,OAAO,EAAE;MACX,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;MACzB,QAAQ,CAAC,CAAC;IACZ;IACA,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE;IACvB,MAAM,GAAG,KAAK;IACd,eAAe,GAAG,SAAS;IAC3B;IACA,IAAI,OAAO,EAAE,OAAO,CAAC,CAAC;IACtB,OAAO,IAAI;EACb,CAAC;EAED,OAAO;IAAE,KAAK;IAAE,MAAM;IAAE,QAAQ;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE;EAAS,CAAC;AACpE,CAAC;;AAED;AACA,OAAO,MAAM,kBAAkB,GAAG,CAChC,KAIC,EACD,SAAwC,KACrC;EACH,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE;EACjC,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;EAC9B,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;IACjB,KAAK,CAAC,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC;IAC/C,IAAI,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC;EACzD;EACA,IAAI,GAAG,IAAI,GAAG,KAAK,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;AAC/D,CAAC","ignoreList":[]}
@@ -29,6 +29,7 @@ export const openPrompt = (render, options, label, sheet = true, initialFocus) =
29
29
  signal: options?.signal,
30
30
  cancelBehavior: options?.cancelBehavior,
31
31
  history: options?.history,
32
+ followContent: options?.followContent,
32
33
  ariaLabel: options?.ariaLabel ?? options?.title ?? label
33
34
  };
34
35
  return !sheet || !opensAsSheet(options) ? dialogCore.open(render, frame) : view ? view.openPromptSheet(render, frame) : load().then(module => module.openPromptSheet(render, frame));
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["feedback/prompt-sheet.tsx"],"sourcesContent":["import { PHONE_SHEET_QUERY } from \"../actions/phone-sheet\";\nimport { type DialogRender, dialogCore, type OpenDialogOptions } from \"./dialog-core\";\n\n/** The prompt options that shape its dialog, as in `DialogOptions`. */\ntype PromptFrame = {\n size?: string;\n surface?: string;\n variant?: string;\n signal?: AbortSignal;\n cancelBehavior?: OpenDialogOptions[\"cancelBehavior\"];\n history?: boolean;\n ariaLabel?: string;\n title?: string;\n};\n\n/**\n * On a phone a prompt rises from the bottom edge as a sheet, within thumb reach, with the sheet's own motion: it\n * slides in, follows the handle, and slides out. A full-screen or bare prompt keeps its own frame, and from 48rem\n * every prompt stays the dialog in the middle. The choice is made when the prompt opens.\n */\nconst opensAsSheet = (options?: PromptFrame): boolean =>\n options?.size !== \"full\" && options?.surface !== \"bare\" && typeof matchMedia === \"function\" && matchMedia(PHONE_SHEET_QUERY).matches;\n\nexport const panelClass = (options?: PromptFrame): string =>\n `k2b-dialog k2b-dialog--${options?.size ?? \"medium\"}${options?.variant && options.variant !== \"primary\" ? ` k2b-dialog--${options.variant}` : \"\"}${options?.surface === \"bare\" ? \" is-bare\" : \"\"}`;\n\nexport const contentClass = (surface?: string): string => (surface === \"bare\" ? \"k2b-dialog__viewport is-bare\" : \"k2b-dialog__viewport\");\n\ntype View = typeof import(\"./prompt-sheet-view\");\nlet view: View | undefined;\nconst load = (): Promise<View> => import(\"./prompt-sheet-view\").then((module) => (view = module));\n// A phone loads the sheet's code in the background when prompts load, so the first prompt opens at once and in the\n// order it was asked; a wider screen never loads it.\nif (typeof matchMedia === \"function\" && matchMedia(PHONE_SHEET_QUERY).matches) load().catch(() => {});\n\n/**\n * Opens a prompt with the frame, cancellation, history, and name every prompt shares: the dialog in the middle, or on\n * a phone the same content as a bottom sheet. `label` names it when it has no title; `sheet: false` keeps the dialog.\n */\nexport const openPrompt = <T,>(\n render: DialogRender<T>,\n options: PromptFrame | undefined,\n label: string,\n sheet = true,\n initialFocus?: OpenDialogOptions[\"initialFocus\"],\n): Promise<T | undefined> => {\n const frame: OpenDialogOptions = {\n panelClassName: panelClass(options),\n contentClassName: contentClass(options?.surface),\n initialFocus,\n signal: options?.signal,\n cancelBehavior: options?.cancelBehavior,\n history: options?.history,\n ariaLabel: options?.ariaLabel ?? options?.title ?? label,\n };\n return !sheet || !opensAsSheet(options)\n ? dialogCore.open<T>(render, frame)\n : view\n ? view.openPromptSheet(render, frame)\n : load().then((module) => module.openPromptSheet(render, frame));\n};\n"],"mappings":"AAAA,SAAS,iBAAiB,QAAQ,wBAAwB;AAC1D,SAA4B,UAAU,QAAgC,eAAe;;AAErF;;AAYA;AACA;AACA;AACA;AACA;AACA,MAAM,YAAY,GAAI,OAAqB,IACzC,OAAO,EAAE,IAAI,KAAK,MAAM,IAAI,OAAO,EAAE,OAAO,KAAK,MAAM,IAAI,OAAO,UAAU,KAAK,UAAU,IAAI,UAAU,CAAC,iBAAiB,CAAC,CAAC,OAAO;AAEtI,OAAO,MAAM,UAAU,GAAI,OAAqB,IAC9C,0BAA0B,OAAO,EAAE,IAAI,IAAI,QAAQ,GAAG,OAAO,EAAE,OAAO,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,GAAG,gBAAgB,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,OAAO,KAAK,MAAM,GAAG,UAAU,GAAG,EAAE,EAAE;AAEpM,OAAO,MAAM,YAAY,GAAI,OAAgB,IAAc,OAAO,KAAK,MAAM,GAAG,8BAA8B,GAAG,sBAAuB;AAGxI,IAAI,IAAsB;AAC1B,MAAM,IAAI,GAAG,MAAqB,OAAO,qBAAqB,CAAC,CAAC,IAAI,CAAE,MAAM,IAAM,IAAI,GAAG,MAAO,CAAC;AACjG;AACA;AACA,IAAI,OAAO,UAAU,KAAK,UAAU,IAAI,UAAU,CAAC,iBAAiB,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;;AAErG;AACA;AACA;AACA;AACA,OAAO,MAAM,UAAU,GAAG,CACxB,MAAuB,EACvB,OAAgC,EAChC,KAAa,EACb,KAAK,GAAG,IAAI,EACZ,YAAgD,KACrB;EAC3B,MAAM,KAAwB,GAAG;IAC/B,cAAc,EAAE,UAAU,CAAC,OAAO,CAAC;IACnC,gBAAgB,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC;IAChD,YAAY;IACZ,MAAM,EAAE,OAAO,EAAE,MAAM;IACvB,cAAc,EAAE,OAAO,EAAE,cAAc;IACvC,OAAO,EAAE,OAAO,EAAE,OAAO;IACzB,SAAS,EAAE,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,KAAK,IAAI;EACrD,CAAC;EACD,OAAO,CAAC,KAAK,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,GACnC,UAAU,CAAC,IAAI,CAAI,MAAM,EAAE,KAAK,CAAC,GACjC,IAAI,GACF,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,GACnC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAE,MAAM,IAAK,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACtE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["feedback/prompt-sheet.tsx"],"sourcesContent":["import { PHONE_SHEET_QUERY } from \"../actions/phone-sheet\";\nimport { type DialogRender, dialogCore, type OpenDialogOptions } from \"./dialog-core\";\n\n/** The prompt options that shape its dialog, as in `DialogOptions`. */\ntype PromptFrame = {\n size?: string;\n surface?: string;\n variant?: string;\n signal?: AbortSignal;\n cancelBehavior?: OpenDialogOptions[\"cancelBehavior\"];\n history?: boolean;\n followContent?: boolean;\n ariaLabel?: string;\n title?: string;\n};\n\n/**\n * On a phone a prompt rises from the bottom edge as a sheet, within thumb reach, with the sheet's own motion: it\n * slides in, follows the handle, and slides out. A full-screen or bare prompt keeps its own frame, and from 48rem\n * every prompt stays the dialog in the middle. The choice is made when the prompt opens.\n */\nconst opensAsSheet = (options?: PromptFrame): boolean =>\n options?.size !== \"full\" && options?.surface !== \"bare\" && typeof matchMedia === \"function\" && matchMedia(PHONE_SHEET_QUERY).matches;\n\nexport const panelClass = (options?: PromptFrame): string =>\n `k2b-dialog k2b-dialog--${options?.size ?? \"medium\"}${options?.variant && options.variant !== \"primary\" ? ` k2b-dialog--${options.variant}` : \"\"}${options?.surface === \"bare\" ? \" is-bare\" : \"\"}`;\n\nexport const contentClass = (surface?: string): string => (surface === \"bare\" ? \"k2b-dialog__viewport is-bare\" : \"k2b-dialog__viewport\");\n\ntype View = typeof import(\"./prompt-sheet-view\");\nlet view: View | undefined;\nconst load = (): Promise<View> => import(\"./prompt-sheet-view\").then((module) => (view = module));\n// A phone loads the sheet's code in the background when prompts load, so the first prompt opens at once and in the\n// order it was asked; a wider screen never loads it.\nif (typeof matchMedia === \"function\" && matchMedia(PHONE_SHEET_QUERY).matches) load().catch(() => {});\n\n/**\n * Opens a prompt with the frame, cancellation, history, and name every prompt shares: the dialog in the middle, or on\n * a phone the same content as a bottom sheet. `label` names it when it has no title; `sheet: false` keeps the dialog.\n */\nexport const openPrompt = <T,>(\n render: DialogRender<T>,\n options: PromptFrame | undefined,\n label: string,\n sheet = true,\n initialFocus?: OpenDialogOptions[\"initialFocus\"],\n): Promise<T | undefined> => {\n const frame: OpenDialogOptions = {\n panelClassName: panelClass(options),\n contentClassName: contentClass(options?.surface),\n initialFocus,\n signal: options?.signal,\n cancelBehavior: options?.cancelBehavior,\n history: options?.history,\n followContent: options?.followContent,\n ariaLabel: options?.ariaLabel ?? options?.title ?? label,\n };\n return !sheet || !opensAsSheet(options)\n ? dialogCore.open<T>(render, frame)\n : view\n ? view.openPromptSheet(render, frame)\n : load().then((module) => module.openPromptSheet(render, frame));\n};\n"],"mappings":"AAAA,SAAS,iBAAiB,QAAQ,wBAAwB;AAC1D,SAA4B,UAAU,QAAgC,eAAe;;AAErF;;AAaA;AACA;AACA;AACA;AACA;AACA,MAAM,YAAY,GAAI,OAAqB,IACzC,OAAO,EAAE,IAAI,KAAK,MAAM,IAAI,OAAO,EAAE,OAAO,KAAK,MAAM,IAAI,OAAO,UAAU,KAAK,UAAU,IAAI,UAAU,CAAC,iBAAiB,CAAC,CAAC,OAAO;AAEtI,OAAO,MAAM,UAAU,GAAI,OAAqB,IAC9C,0BAA0B,OAAO,EAAE,IAAI,IAAI,QAAQ,GAAG,OAAO,EAAE,OAAO,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,GAAG,gBAAgB,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,OAAO,KAAK,MAAM,GAAG,UAAU,GAAG,EAAE,EAAE;AAEpM,OAAO,MAAM,YAAY,GAAI,OAAgB,IAAc,OAAO,KAAK,MAAM,GAAG,8BAA8B,GAAG,sBAAuB;AAGxI,IAAI,IAAsB;AAC1B,MAAM,IAAI,GAAG,MAAqB,OAAO,qBAAqB,CAAC,CAAC,IAAI,CAAE,MAAM,IAAM,IAAI,GAAG,MAAO,CAAC;AACjG;AACA;AACA,IAAI,OAAO,UAAU,KAAK,UAAU,IAAI,UAAU,CAAC,iBAAiB,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;;AAErG;AACA;AACA;AACA;AACA,OAAO,MAAM,UAAU,GAAG,CACxB,MAAuB,EACvB,OAAgC,EAChC,KAAa,EACb,KAAK,GAAG,IAAI,EACZ,YAAgD,KACrB;EAC3B,MAAM,KAAwB,GAAG;IAC/B,cAAc,EAAE,UAAU,CAAC,OAAO,CAAC;IACnC,gBAAgB,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC;IAChD,YAAY;IACZ,MAAM,EAAE,OAAO,EAAE,MAAM;IACvB,cAAc,EAAE,OAAO,EAAE,cAAc;IACvC,OAAO,EAAE,OAAO,EAAE,OAAO;IACzB,aAAa,EAAE,OAAO,EAAE,aAAa;IACrC,SAAS,EAAE,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,KAAK,IAAI;EACrD,CAAC;EACD,OAAO,CAAC,KAAK,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,GACnC,UAAU,CAAC,IAAI,CAAI,MAAM,EAAE,KAAK,CAAC,GACjC,IAAI,GACF,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,GACnC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAE,MAAM,IAAK,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACtE,CAAC","ignoreList":[]}
@@ -558,6 +558,7 @@ const openSearchPrompt = (resolver, options) => dialogCore.open(close => {
558
558
  signal: options?.signal,
559
559
  cancelBehavior: options?.cancelBehavior,
560
560
  history: options?.history,
561
+ followContent: options?.followContent,
561
562
  ariaLabel: options?.ariaLabel ?? options?.title ?? resolveUiMessages().search
562
563
  });
563
564
  const promptText = (content, defaultValue, options) => prompts.form({
@@ -624,7 +625,10 @@ export const prompts = Object.assign(sharedPrompts, {
624
625
  form: async config => (await openPrompt(close => _$createComponent(PromptFormDialog, {
625
626
  config: config,
626
627
  close: value => close(value)
627
- }), config, resolvePromptMessages().form)) ?? null,
628
+ }), {
629
+ ...config,
630
+ followContent: config.followContent ?? true
631
+ }, resolvePromptMessages().form)) ?? null,
628
632
  /**
629
633
  * Open custom content with a typed close callback and the dialog render context.
630
634
  * Register a dismiss handler to guard Escape, backdrop clicks and the supplied header's close button,
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["feedback/prompts.tsx"],"sourcesContent":["import { mutation, timed } from \"@k2b/stdlib/solid\";\nimport { createEffect, createMemo, createSignal, createUniqueId, For, type JSX, onCleanup, Show } from \"solid-js\";\nimport { createStore } from \"solid-js/store\";\nimport { Checkbox } from \"../inputs/Checkbox\";\nimport { PinInput } from \"../inputs/ChoiceInputs\";\nimport { DatePicker, DateTimePicker } from \"../inputs/DatePicker\";\nimport { ImageInput } from \"../inputs/FileInputs\";\nimport { NumberInput } from \"../inputs/NumberInput\";\nimport { Select } from \"../inputs/Select\";\nimport { resolveSelectMessages } from \"../inputs/select-messages\";\nimport { TagsInput } from \"../inputs/TagsInput\";\nimport { TextInput } from \"../inputs/TextInput\";\nimport { KeyedFor } from \"../internal/keyed-for\";\nimport { optionDescription } from \"../internal/option-description\";\nimport { resolveUiMessages } from \"../intl/messages\";\nimport { type DialogRender, dialogCore, type OpenDialogOptions } from \"./dialog-core\";\nimport { DialogHeader, type PromptContent, promptButtonVariant, promptTone, sharedPrompts } from \"./prompt-confirm\";\nimport { resolvePromptMessages } from \"./prompt-messages\";\nimport { openPrompt } from \"./prompt-sheet\";\n\nexport { DialogHeader } from \"./prompt-confirm\";\n\nexport interface DialogOptions {\n signal?: AbortSignal;\n title?: string;\n ariaLabel?: string;\n icon?: string;\n confirmText?: string;\n cancelText?: string | false;\n variant?: \"danger\" | \"primary\" | \"success\" | \"warning\";\n /** `full` fills the available viewport and becomes edge-to-edge on narrow screens. */\n size?: \"small\" | \"medium\" | \"large\" | \"wide\" | \"full\";\n surface?: \"default\" | \"bare\";\n header?: false;\n cancelBehavior?: OpenDialogOptions[\"cancelBehavior\"];\n /** Back closes the prompt like Cancel, as in a phone app; see `OpenDialogOptions.history`. */\n history?: boolean;\n}\n\nexport type SuccessDialogOptions = Omit<DialogOptions, \"variant\"> & {\n /** A finished success, such as an issued document: the header draws its check once when the dialog opens. */\n celebrate?: boolean;\n};\n\nexport interface ConfirmOptions extends DialogOptions {\n confirmationPhrase?: string;\n}\n\nexport type PromptSearchItem<T = unknown> = {\n /**\n * Stable identity of the result, such as its record ID. With it, a newer answer that contains the same result keeps\n * its row, so a click in progress still lands. Without it, each answer replaces the rows.\n */\n id?: string;\n label: string;\n desc?: string;\n /**\n * Shown in place of `desc`, such as a colored `Tag`. A function, so each place gets its own element. It shows only\n * with a `desc`, which stays the text that screen readers use.\n */\n descriptionVisual?: () => JSX.Element;\n icon?: string;\n previewUrl?: string;\n value?: T;\n};\n\nexport type PromptSearchInput = {\n query: string;\n abortSignal: AbortSignal;\n};\n\nexport type PromptSearchOptions = DialogOptions & {\n placeholder?: string;\n icon?: string;\n initialQuery?: string;\n minQueryLength?: number;\n debounceMs?: number;\n emptyText?: string;\n noResultsText?: string;\n};\n\nexport type PromptFieldBase<T = any> = {\n label?: string | false;\n description?: string;\n placeholder?: string;\n required?: boolean;\n default?: T;\n validate?: (value: T | undefined) => string | null;\n};\n\nexport type FieldSchema =\n | (PromptFieldBase<string> & {\n type: \"text\";\n multiline?: boolean;\n lines?: number;\n maxLength?: number;\n minLength?: number;\n icon?: string;\n activeIcon?: string;\n password?: boolean;\n markdown?: boolean;\n })\n | (PromptFieldBase<number> & {\n type: \"number\";\n min?: number;\n max?: number;\n step?: number;\n })\n | (PromptFieldBase<string> & {\n type: \"image\";\n round?: boolean;\n ariaLabel?: string;\n accept?: string;\n })\n | (PromptFieldBase<string> & {\n type: \"pin\";\n length?: number;\n stretch?: boolean;\n })\n | (PromptFieldBase<string> & {\n type: \"select\";\n options: string[] | { id: string; label?: string; description?: string; icon?: string }[];\n icon?: string;\n activeIcon?: string;\n clearable?: boolean;\n })\n | (PromptFieldBase<string[]> & {\n type: \"tags\";\n maxTags?: number;\n minTags?: number;\n icon?: string;\n activeIcon?: string;\n })\n | (PromptFieldBase<boolean> & {\n type: \"boolean\";\n })\n | (PromptFieldBase<string> & {\n type: \"datetime\";\n dateOnly?: boolean;\n /** A date whose time is optional, as `DateTimePicker`'s `optionalTime`. */\n optionalTime?: boolean;\n })\n | {\n type: \"info\";\n content: string | JSX.Element | (() => JSX.Element);\n };\n\ntype InferFieldType<T extends FieldSchema> = T extends { type: \"text\" }\n ? string\n : T extends { type: \"number\" }\n ? number\n : T extends { type: \"image\" }\n ? string\n : T extends { type: \"pin\" }\n ? string\n : T extends { type: \"select\" }\n ? string\n : T extends { type: \"tags\" }\n ? string[]\n : T extends { type: \"boolean\" }\n ? boolean\n : T extends { type: \"datetime\" }\n ? string\n : T extends { type: \"currency\" }\n ? number\n : T extends { type: \"info\" }\n ? never\n : never;\n\ntype InferFormValues<T extends Record<string, FieldSchema>> = {\n [K in keyof T as T[K] extends { type: \"info\" } ? never : K]: T[K] extends { required: true }\n ? InferFieldType<T[K]>\n : InferFieldType<T[K]> | undefined;\n};\n\ntype PromptFormValue = string | number | boolean | string[] | undefined;\ntype PromptFormOptions<T extends Record<string, FieldSchema>> = {\n signal?: AbortSignal;\n title?: string;\n ariaLabel?: string;\n icon?: string;\n fields: T;\n confirmText?: string;\n cancelText?: string | false;\n variant?: \"danger\" | \"primary\" | \"success\" | \"warning\";\n size?: DialogOptions[\"size\"];\n cancelBehavior?: DialogOptions[\"cancelBehavior\"];\n};\n\nconst isEmpty = (value: unknown): boolean =>\n value === undefined || value === null || value === \"\" || (Array.isArray(value) && value.length === 0);\n\nexport const createFormState = <T extends Record<string, FieldSchema>>(schema: T) => {\n const messages = resolveUiMessages();\n const promptMessages = resolvePromptMessages();\n const [values, setValues] = createStore<Record<string, PromptFormValue>>({});\n const [errors, setErrors] = createStore<Record<string, string | undefined>>({});\n // Errors appear with the first submit and then follow every change. Before that, a check that fails mid-input,\n // such as a URL still being typed, would interrupt the user with an alert on the first character.\n let submitted = false;\n\n for (const [key, field] of Object.entries(schema)) {\n if (field.type !== \"info\" && \"default\" in field) setValues(key, field.default as PromptFormValue);\n }\n\n const validateField = (key: string, value: PromptFormValue): string | null => {\n const field = schema[key];\n if (!field || field.type === \"info\") return null;\n if (field.type === \"boolean\" && field.required && value !== true) return messages.required;\n if (field.required && isEmpty(value)) return messages.required;\n if (\"validate\" in field && field.validate) {\n const customError = (field.validate as (next: never) => string | null)(value as never);\n if (customError) return customError;\n }\n if (field.type === \"text\" && typeof value === \"string\" && value.length > 0) {\n if (field.minLength !== undefined && value.length < field.minLength) return promptMessages.minCharacters({ count: field.minLength });\n if (field.maxLength !== undefined && value.length > field.maxLength) return promptMessages.maxCharacters({ count: field.maxLength });\n }\n if (field.type === \"tags\" && Array.isArray(value) && value.length > 0) {\n if (field.minTags !== undefined && value.length < field.minTags) return promptMessages.minTags({ count: field.minTags });\n if (field.maxTags !== undefined && value.length > field.maxTags) return promptMessages.maxTags({ count: field.maxTags });\n }\n return null;\n };\n\n const updateField = (key: string, value: PromptFormValue) => {\n setValues(key, value);\n if (submitted) setErrors(key, validateField(key, value) ?? undefined);\n };\n\n const validateAll = (): boolean => {\n submitted = true;\n let valid = true;\n for (const [key, field] of Object.entries(schema)) {\n if (field.type === \"info\") continue;\n const error = validateField(key, values[key]);\n setErrors(key, error ?? undefined);\n if (error) valid = false;\n }\n return valid;\n };\n\n const reset = () => {\n submitted = false;\n for (const [key, field] of Object.entries(schema)) {\n if (field.type === \"info\") continue;\n setValues(key, \"default\" in field ? (field.default as PromptFormValue) : undefined);\n setErrors(key, undefined);\n }\n };\n\n return { values, errors, updateField, validateAll, reset };\n};\n\nconst renderInfo = (content: Extract<FieldSchema, { type: \"info\" }>[\"content\"]): JSX.Element => {\n if (typeof content === \"string\") return <p>{content}</p>;\n if (typeof content === \"function\") return content();\n return content;\n};\n\nconst PromptControl = (props: {\n field: Exclude<FieldSchema, { type: \"info\" }>;\n value: () => PromptFormValue;\n update: (value: PromptFormValue) => void;\n error: () => string | undefined;\n submit: () => void;\n}): JSX.Element => {\n const label = props.field.label || undefined;\n\n switch (props.field.type) {\n case \"text\":\n return (\n <TextInput\n label={label}\n description={props.field.description}\n required={props.field.required}\n placeholder={props.field.placeholder}\n error={props.error}\n value={String(props.value() ?? \"\")}\n onValueChange={(value) => props.update(value ?? undefined)}\n onSubmit={props.submit}\n multiline={props.field.multiline}\n lines={props.field.lines}\n icon={props.field.icon}\n activeIcon={props.field.activeIcon}\n password={props.field.password}\n markdown={props.field.markdown}\n minLength={props.field.minLength}\n maxLength={props.field.maxLength}\n />\n );\n case \"number\":\n return (\n <NumberInput\n label={label}\n description={props.field.description}\n required={props.field.required}\n placeholder={props.field.placeholder}\n error={props.error}\n value={typeof props.value() === \"number\" ? (props.value() as number) : null}\n onValueChange={(value) => props.update(value ?? undefined)}\n min={props.field.min}\n max={props.field.max}\n step={props.field.step}\n />\n );\n case \"image\":\n return (\n <ImageInput\n label={label}\n description={props.field.description}\n required={props.field.required}\n error={props.error}\n value={() => (typeof props.value() === \"string\" ? (props.value() as string) : null)}\n onValueChange={(value) => props.update(value ?? undefined)}\n round={props.field.round}\n aria-label={props.field.ariaLabel}\n accept={props.field.accept}\n />\n );\n case \"pin\":\n return (\n <PinInput\n label={label}\n description={props.field.description}\n required={props.field.required}\n error={props.error}\n value={() => String(props.value() ?? \"\")}\n onValueChange={props.update}\n length={props.field.length}\n stretch={props.field.stretch}\n />\n );\n case \"select\":\n return (\n <Select\n label={label}\n description={props.field.description}\n required={props.field.required}\n placeholder={props.field.placeholder}\n error={props.error}\n value={() => (typeof props.value() === \"string\" ? (props.value() as string) : null)}\n onValueChange={(value) => props.update(value ?? undefined)}\n options={props.field.options}\n icon={props.field.icon}\n activeIcon={props.field.activeIcon}\n clearable={props.field.clearable}\n />\n );\n case \"tags\":\n return (\n <TagsInput\n label={label}\n description={props.field.description}\n required={props.field.required}\n placeholder={props.field.placeholder}\n error={props.error}\n value={() => (Array.isArray(props.value()) ? (props.value() as string[]) : [])}\n onValueChange={props.update}\n maxTags={props.field.maxTags}\n icon={props.field.icon}\n activeIcon={props.field.activeIcon}\n />\n );\n case \"boolean\":\n return (\n <Checkbox\n label={label}\n description={props.field.description}\n required={props.field.required}\n error={props.error}\n value={() => Boolean(props.value())}\n onValueChange={props.update}\n />\n );\n case \"datetime\": {\n const pickerProps = {\n label,\n description: props.field.description,\n required: props.field.required,\n placeholder: props.field.placeholder,\n error: props.error,\n value: () => (typeof props.value() === \"string\" ? (props.value() as string) : null),\n onValueChange: (value: string | null) => props.update(value ?? \"\"),\n clearable: true,\n };\n return props.field.dateOnly ? (\n <DatePicker {...pickerProps} />\n ) : (\n <DateTimePicker {...pickerProps} optionalTime={props.field.optionalTime} />\n );\n }\n }\n};\n\nconst PromptFormDialog = <T extends Record<string, FieldSchema>>(props: {\n config: PromptFormOptions<T>;\n close: (value: InferFormValues<T> | null) => void;\n}): JSX.Element => {\n const state = createFormState(props.config.fields);\n const submit = () => {\n if (state.validateAll()) props.close(state.values as InferFormValues<T>);\n };\n const handleSubmit = (event: SubmitEvent) => {\n event.preventDefault();\n submit();\n };\n\n return (\n <form class=\"k2b-dialog__panel\" onSubmit={handleSubmit}>\n <DialogHeader\n title={props.config.title}\n icon={props.config.icon}\n tone={promptTone(props.config.variant)}\n close={() => props.close(null)}\n />\n <div class=\"k2b-dialog__body k2b-prompt-form\">\n <For each={Object.entries(props.config.fields)}>\n {([key, field]) => {\n if (field.type === \"info\") return <div class=\"k2b-prompt-form__info\">{renderInfo(field.content)}</div>;\n return (\n <PromptControl\n field={field}\n value={() => state.values[key]}\n update={(value) => state.updateField(key, value)}\n error={() => state.errors[key]}\n submit={submit}\n />\n );\n }}\n </For>\n </div>\n <footer class=\"k2b-dialog__actions\">\n <Show when={props.config.cancelText !== false}>\n <button type=\"button\" class=\"k2b-button\" data-variant=\"secondary\" onClick={() => props.close(null)}>\n {props.config.cancelText || resolveUiMessages().cancel}\n </button>\n </Show>\n <button type=\"submit\" class=\"k2b-button\" data-variant={promptButtonVariant(props.config.variant)}>\n {props.config.confirmText ?? resolveUiMessages().save}\n </button>\n </footer>\n </form>\n );\n};\n\n// Results without an ID keep today's behavior: each object is its own identity, so a new answer replaces the row.\nconst anonymousRows = new WeakMap<object, string>();\nlet anonymousRow = 0;\nconst searchRowIdentity = (item: PromptSearchItem<unknown>): string => {\n if (item.id !== undefined) return `id:${item.id}`;\n const known = anonymousRows.get(item);\n if (known !== undefined) return known;\n const key = `object:${anonymousRow++}`;\n anonymousRows.set(item, key);\n return key;\n};\n\ntype CloudSearchResolver<T> = (input: PromptSearchInput) => Promise<PromptSearchItem<T>[]> | PromptSearchItem<T>[];\n\nconst openSearchPrompt = <T extends unknown = unknown>(resolver: CloudSearchResolver<T>, options?: PromptSearchOptions) =>\n dialogCore.open<PromptSearchItem<T>>(\n (close) => {\n const [query, setQuery] = createSignal(options?.initialQuery ?? \"\");\n const [items, setItems] = createSignal<PromptSearchItem<T>[]>([]);\n const [activeIndex, setActiveIndex] = createSignal(0);\n const [hasLoaded, setHasLoaded] = createSignal(false);\n const [failedPreviews, setFailedPreviews] = createStore<Record<number, true>>({});\n const [activeSearchQuery, setActiveSearchQuery] = createSignal(\"\");\n const rowRefs = new Map<number, HTMLButtonElement>();\n const searchId = `k2b-prompt-search-${createUniqueId()}`;\n const listboxId = `${searchId}-listbox`;\n const optionId = (index: number) => `${searchId}-option-${index}`;\n\n const minQueryLength = options?.minQueryLength ?? 0;\n const debounceMs = options?.debounceMs ?? 180;\n const searchMutation = mutation.create<{ query: string; items: PromptSearchItem<T>[] }, string, { requestQuery: string }>({\n // The newest query wins over a search still in flight.\n concurrency: \"replace\",\n onBefore: (requestQuery) => ({ requestQuery }),\n mutation: async (requestQuery, context) => {\n const result = await resolver({\n query: requestQuery,\n abortSignal: context.abortSignal,\n });\n return { query: requestQuery, items: (result ?? []).slice() };\n },\n onSuccess: (result, context) => {\n if (!context || context.requestQuery !== activeSearchQuery()) return;\n setItems(result.items);\n setActiveIndex(0);\n setHasLoaded(true);\n },\n onError: (error, context) => {\n if (!context || context.requestQuery !== activeSearchQuery() || error.name === \"AbortError\") return;\n setItems([]);\n setActiveIndex(0);\n setHasLoaded(true);\n },\n });\n const searchError = createMemo(() => {\n const error = searchMutation.error();\n if (!error || error.name === \"AbortError\") return null;\n return error.message || resolvePromptMessages().searchFailed;\n });\n const shouldShowResults = createMemo(() => {\n if (query().trim().length < minQueryLength) return false;\n return hasLoaded() || searchError() !== null || items().length > 0;\n });\n const emptyStateText = createMemo(() => {\n if (!hasLoaded()) return options?.emptyText ?? resolveSelectMessages().typeToSearch;\n return options?.noResultsText ?? resolveUiMessages().noResults;\n });\n const { debouncedFn: debounceSearch, cancel: cancelDebounce } = timed.debounce((nextQuery: string) => {\n setActiveSearchQuery(nextQuery);\n searchMutation.abort();\n void searchMutation.mutate(nextQuery);\n }, debounceMs);\n\n const execute = (item?: PromptSearchItem<T>) => {\n if (!item) return;\n close(item);\n };\n const moveSelection = (delta: -1 | 1) => {\n const list = items();\n if (list.length === 0) return;\n setActiveIndex((activeIndex() + delta + list.length) % list.length);\n };\n\n createEffect(() => {\n const list = items();\n const maxIndex = list.length - 1;\n if (maxIndex < 0) {\n setActiveIndex(0);\n return;\n }\n if (activeIndex() > maxIndex) setActiveIndex(maxIndex);\n rowRefs.get(activeIndex())?.scrollIntoView({ block: \"nearest\" });\n });\n createEffect(() => {\n const nextQuery = query().trim();\n setFailedPreviews({});\n if (nextQuery.length < minQueryLength) {\n cancelDebounce();\n searchMutation.abort();\n setItems([]);\n setActiveIndex(0);\n setHasLoaded(false);\n setActiveSearchQuery(\"\");\n return;\n }\n debounceSearch(nextQuery);\n });\n onCleanup(() => {\n cancelDebounce();\n searchMutation.abort();\n });\n\n return (\n <div class=\"k2b-prompt-search-shell\">\n <Show when={options?.title}>{(title) => <p class=\"k2b-prompt-search-shell__title\">{title()}</p>}</Show>\n <div class=\"k2b-prompt-search\">\n <label class=\"k2b-prompt-search__input\">\n <i class={options?.icon ?? \"ti ti-search\"} aria-hidden=\"true\" />\n <input\n id={searchId}\n type=\"search\"\n role=\"combobox\"\n aria-label={options?.ariaLabel ?? options?.title ?? resolveUiMessages().search}\n aria-autocomplete=\"list\"\n aria-controls={listboxId}\n aria-expanded={shouldShowResults()}\n aria-activedescendant={shouldShowResults() && items().length > 0 ? optionId(activeIndex()) : undefined}\n aria-busy={searchMutation.loading()}\n value={query()}\n onInput={(event) => setQuery(event.currentTarget.value)}\n onKeyDown={(event) => {\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n moveSelection(1);\n } else if (event.key === \"ArrowUp\") {\n event.preventDefault();\n moveSelection(-1);\n } else if (event.key === \"Enter\") {\n event.preventDefault();\n execute(items()[activeIndex()]);\n }\n }}\n placeholder={options?.placeholder ?? resolveUiMessages().search}\n spellcheck={false}\n autocapitalize=\"off\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n />\n <Show when={searchMutation.loading()}>\n <i class=\"ti ti-loader-2 k2b-spin\" aria-hidden=\"true\" />\n </Show>\n </label>\n <div\n class=\"k2b-prompt-search__collapse\"\n style={{\n height: shouldShowResults() ? \"var(--k2b-search-body-max)\" : \"0px\",\n opacity: shouldShowResults() ? \"1\" : \"0\",\n }}\n >\n <div class=\"k2b-prompt-search__results\" onWheel={(event) => event.stopPropagation()}>\n <Show when={searchError()}>\n {(message) => (\n <div class=\"k2b-prompt-search__error\" role=\"status\" aria-live=\"polite\">\n {message()}\n </div>\n )}\n </Show>\n <Show\n when={items().length > 0}\n fallback={\n <p role=\"status\" aria-live=\"polite\">\n {emptyStateText()}\n </p>\n }\n >\n <div id={listboxId} class=\"k2b-prompt-search__list\" role=\"listbox\" aria-label={resolveUiMessages().searchResults}>\n <KeyedFor each={items()} by={searchRowIdentity}>\n {(item, index) => (\n <button\n ref={(element) => {\n if (!element) rowRefs.delete(index());\n else rowRefs.set(index(), element);\n }}\n type=\"button\"\n id={optionId(index())}\n role=\"option\"\n aria-selected={activeIndex() === index()}\n data-active={activeIndex() === index() ? \"true\" : undefined}\n data-has-description={item().desc ? \"true\" : undefined}\n onMouseEnter={() => setActiveIndex(index())}\n onClick={() => execute(item())}\n >\n {/* Cloud keeps the preview box mounted once a row declares an image, so a\n failed load swaps in the fallback glyph instead of collapsing the row. */}\n <Show when={item().previewUrl?.startsWith(\"/\") || item().icon}>\n <span class=\"k2b-prompt-search__preview\">\n <Show\n when={item().previewUrl?.startsWith(\"/\") && !failedPreviews[index()]}\n fallback={<i class={item().icon ?? \"ti ti-file\"} aria-hidden=\"true\" />}\n >\n <img src={item().previewUrl} alt=\"\" onError={() => setFailedPreviews(index(), true)} />\n </Show>\n </span>\n </Show>\n <span class=\"k2b-prompt-search__copy\">\n <strong>{item().label}</strong>\n {optionDescription(() => ({ description: item().desc, descriptionVisual: item().descriptionVisual }))}\n </span>\n </button>\n )}\n </KeyedFor>\n </div>\n </Show>\n </div>\n </div>\n </div>\n </div>\n );\n },\n {\n panelClassName: \"k2b-dialog k2b-dialog--search is-bare\",\n contentClassName: \"k2b-dialog__viewport is-search\",\n initialFocus: \"first-input\",\n signal: options?.signal,\n cancelBehavior: options?.cancelBehavior,\n history: options?.history,\n ariaLabel: options?.ariaLabel ?? options?.title ?? resolveUiMessages().search,\n },\n );\n\nconst promptText = (content: string, defaultValue?: string, options?: DialogOptions) =>\n prompts\n .form({\n ...options,\n fields: {\n message: { type: \"info\", content: () => <div class=\"k2b-prompt-copy\">{content}</div> },\n value: {\n type: \"text\",\n label: false,\n default: defaultValue || \"\",\n },\n },\n })\n .then((result) => result?.value ?? null);\n\nconst promptNumber = (\n content: string,\n defaultValue?: number,\n options?: DialogOptions & {\n min?: number;\n max?: number;\n },\n) =>\n prompts\n .form({\n ...options,\n fields: {\n message: { type: \"info\", content: () => <div class=\"k2b-prompt-copy\">{content}</div> },\n value: {\n type: \"number\",\n label: false,\n default: defaultValue || 0,\n min: options?.min,\n max: options?.max,\n },\n },\n })\n .then((result) => result?.value ?? null);\n\nconst openAlert = (content: PromptContent, options?: DialogOptions, celebrate?: boolean): Promise<void | undefined> =>\n openPrompt<void>(\n (close) => (\n <div class=\"k2b-dialog__panel\">\n <DialogHeader\n title={options?.title || resolveUiMessages().info}\n icon={options?.icon}\n tone={promptTone(options?.variant)}\n celebrate={celebrate}\n close={() => close()}\n />\n <div class=\"k2b-dialog__body\">{content}</div>\n <footer class=\"k2b-dialog__actions\">\n <button type=\"button\" class=\"k2b-button\" data-variant={promptButtonVariant(options?.variant)} onClick={() => close()}>\n {options?.confirmText || resolveUiMessages().ok}\n </button>\n </footer>\n </div>\n ),\n options,\n resolveUiMessages().info,\n );\n\n// The same object as `sharedPrompts`, which `PanelDialog` uses for its discard question: replacing `prompts.confirm`\n// (for example in a test) therefore reaches every confirmation.\nexport const prompts = Object.assign(sharedPrompts, {\n alert: (content: PromptContent, options?: DialogOptions): Promise<void | undefined> => openAlert(content, options),\n\n success: (content: PromptContent, options?: SuccessDialogOptions): Promise<void | undefined> => {\n const { celebrate, ...rest } = options ?? {};\n return openAlert(content, { ...rest, variant: \"success\", title: rest.title ?? resolveUiMessages().success }, celebrate);\n },\n\n prompt: promptText,\n promptNumber,\n\n form: async <T extends Record<string, FieldSchema>>(config: PromptFormOptions<T>): Promise<InferFormValues<T> | null> =>\n (await openPrompt<InferFormValues<T> | null>(\n (close) => <PromptFormDialog config={config} close={(value) => close(value)} />,\n config,\n resolvePromptMessages().form,\n )) ?? null,\n\n /**\n * Open custom content with a typed close callback and the dialog render context.\n * Register a dismiss handler to guard Escape, backdrop clicks and the supplied header's close button,\n * for example while saving. Explicit close(result) bypasses the guard. Without a handler, dismissal\n * keeps its existing behavior, including a header close button independent of cancelBehavior.\n */\n dialog: <T extends unknown = unknown>(component: DialogRender<T>, options?: DialogOptions): Promise<T | undefined> =>\n openPrompt<T>(\n (close, context) => {\n // A dismiss handler the component sets guards the header's close button as well as Escape and the backdrop.\n let dismiss = () => close(undefined);\n const body = component(close, {\n ...context,\n setDismissHandler: (handler) => {\n context.setDismissHandler(handler);\n dismiss = () => void context.requestDismiss();\n },\n });\n if (options?.surface === \"bare\" && options.header === false) return body;\n return (\n <div class=\"k2b-dialog__panel k2b-dialog__stack\">\n <Show when={options?.header !== false}>\n <DialogHeader title={options?.title} icon={options?.icon} tone={promptTone(options?.variant)} close={() => dismiss()} />\n </Show>\n <div class=\"k2b-dialog__content\">{body}</div>\n </div>\n );\n },\n options,\n resolveUiMessages().dialog,\n // Without its header a custom dialog draws its own chrome and keeps the dialog frame.\n options?.header !== false,\n ),\n\n search: openSearchPrompt,\n\n error: (content: string | HTMLElement, options?: DialogOptions) =>\n openPrompt(\n (close) => (\n <div class=\"k2b-dialog__panel\">\n <DialogHeader title={options?.title ?? resolveUiMessages().error} icon={options?.icon} tone=\"danger\" close={close} />\n <div class=\"k2b-dialog__body\">{content}</div>\n <footer class=\"k2b-dialog__actions\">\n <button type=\"button\" class=\"k2b-button\" onClick={() => close()}>\n {options?.confirmText || resolveUiMessages().close}\n </button>\n </footer>\n </div>\n ),\n { ...options, variant: \"danger\" },\n resolveUiMessages().error,\n ),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,QAAQ,EAAE,KAAK,QAAQ,mBAAmB;AACnD,SAAS,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,EAAY,SAAS,EAAE,IAAI,QAAQ,UAAU;AACjH,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,QAAQ,QAAQ,oBAAoB;AAC7C,SAAS,QAAQ,QAAQ,wBAAwB;AACjD,SAAS,UAAU,EAAE,cAAc,QAAQ,sBAAsB;AACjE,SAAS,UAAU,QAAQ,sBAAsB;AACjD,SAAS,WAAW,QAAQ,uBAAuB;AACnD,SAAS,MAAM,QAAQ,kBAAkB;AACzC,SAAS,qBAAqB,QAAQ,2BAA2B;AACjE,SAAS,SAAS,QAAQ,qBAAqB;AAC/C,SAAS,SAAS,QAAQ,qBAAqB;AAC/C,SAAS,QAAQ,QAAQ,uBAAuB;AAChD,SAAS,iBAAiB,QAAQ,gCAAgC;AAClE,SAAS,iBAAiB,QAAQ,kBAAkB;AACpD,SAA4B,UAAU,QAAgC,eAAe;AACrF,SAAS,YAAY,EAAsB,mBAAmB,EAAE,UAAU,EAAE,aAAa,QAAQ,kBAAkB;AACnH,SAAS,qBAAqB,QAAQ,mBAAmB;AACzD,SAAS,UAA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AI;EAG5C,CAAC,EACD,OAAO,EACP,iBAAiB,CAAC,CAAC,CAAC,MAAM;EAC1B;EACA,OAAO,EAAE,MAAM,KAAK,KACtB,CAAC;EAEH,MAAM,EAAE,gBAAgB;EAExB,KAAK,EAAE,CAAC,OAA6B,EAAE,OAAuB,KAC5D,UAAU,CACP,KAAK,+CAED,YAAY;IAAA,IAAC,KAAK;MAAA,OAAE,OAAO,EAAE,KAAK,IAAI,iBAAiB,CAAC,CAAC,CAAC,KAAK;IAAA;IAAA,IAAE,IAAI;MAAA,OAAE,OAAO,EAAE,IAAI;IAAA;IAAE,IAAI;IAAU,KAAK,EAAE;EAAK,cAClF,OAAO,YAGjC,OAAO,EAAE,WAAW,IAAI,iBAAiB,CAAC,CAAC,CAAC,KAAK,EAIzD,EACD;IAAE,GAAG,OAAO;IAAE,OAAO,EAAE;EAAS,CAAC,EACjC,iBAAiB,CAAC,CAAC,CAAC,KACtB;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["feedback/prompts.tsx"],"sourcesContent":["import { mutation, timed } from \"@k2b/stdlib/solid\";\nimport { createEffect, createMemo, createSignal, createUniqueId, For, type JSX, onCleanup, Show } from \"solid-js\";\nimport { createStore } from \"solid-js/store\";\nimport { Checkbox } from \"../inputs/Checkbox\";\nimport { PinInput } from \"../inputs/ChoiceInputs\";\nimport { DatePicker, DateTimePicker } from \"../inputs/DatePicker\";\nimport { ImageInput } from \"../inputs/FileInputs\";\nimport { NumberInput } from \"../inputs/NumberInput\";\nimport { Select } from \"../inputs/Select\";\nimport { resolveSelectMessages } from \"../inputs/select-messages\";\nimport { TagsInput } from \"../inputs/TagsInput\";\nimport { TextInput } from \"../inputs/TextInput\";\nimport { KeyedFor } from \"../internal/keyed-for\";\nimport { optionDescription } from \"../internal/option-description\";\nimport { resolveUiMessages } from \"../intl/messages\";\nimport { type DialogRender, dialogCore, type OpenDialogOptions } from \"./dialog-core\";\nimport { DialogHeader, type PromptContent, promptButtonVariant, promptTone, sharedPrompts } from \"./prompt-confirm\";\nimport { resolvePromptMessages } from \"./prompt-messages\";\nimport { openPrompt } from \"./prompt-sheet\";\n\nexport { DialogHeader } from \"./prompt-confirm\";\n\nexport interface DialogOptions {\n signal?: AbortSignal;\n title?: string;\n ariaLabel?: string;\n icon?: string;\n confirmText?: string;\n cancelText?: string | false;\n variant?: \"danger\" | \"primary\" | \"success\" | \"warning\";\n /** `full` fills the available viewport and becomes edge-to-edge on narrow screens. */\n size?: \"small\" | \"medium\" | \"large\" | \"wide\" | \"full\";\n surface?: \"default\" | \"bare\";\n header?: false;\n cancelBehavior?: OpenDialogOptions[\"cancelBehavior\"];\n /** Back closes the prompt like Cancel, as in a phone app; see `OpenDialogOptions.history`. */\n history?: boolean;\n /** Animate content height changes. Defaults to false, or true for form, prompt and promptNumber. */\n followContent?: boolean;\n}\n\nexport type SuccessDialogOptions = Omit<DialogOptions, \"variant\"> & {\n /** A finished success, such as an issued document: the header draws its check once when the dialog opens. */\n celebrate?: boolean;\n};\n\nexport interface ConfirmOptions extends DialogOptions {\n confirmationPhrase?: string;\n}\n\nexport type PromptSearchItem<T = unknown> = {\n /**\n * Stable identity of the result, such as its record ID. With it, a newer answer that contains the same result keeps\n * its row, so a click in progress still lands. Without it, each answer replaces the rows.\n */\n id?: string;\n label: string;\n desc?: string;\n /**\n * Shown in place of `desc`, such as a colored `Tag`. A function, so each place gets its own element. It shows only\n * with a `desc`, which stays the text that screen readers use.\n */\n descriptionVisual?: () => JSX.Element;\n icon?: string;\n previewUrl?: string;\n value?: T;\n};\n\nexport type PromptSearchInput = {\n query: string;\n abortSignal: AbortSignal;\n};\n\nexport type PromptSearchOptions = DialogOptions & {\n placeholder?: string;\n icon?: string;\n initialQuery?: string;\n minQueryLength?: number;\n debounceMs?: number;\n emptyText?: string;\n noResultsText?: string;\n};\n\nexport type PromptFieldBase<T = any> = {\n label?: string | false;\n description?: string;\n placeholder?: string;\n required?: boolean;\n default?: T;\n validate?: (value: T | undefined) => string | null;\n};\n\nexport type FieldSchema =\n | (PromptFieldBase<string> & {\n type: \"text\";\n multiline?: boolean;\n lines?: number;\n maxLength?: number;\n minLength?: number;\n icon?: string;\n activeIcon?: string;\n password?: boolean;\n markdown?: boolean;\n })\n | (PromptFieldBase<number> & {\n type: \"number\";\n min?: number;\n max?: number;\n step?: number;\n })\n | (PromptFieldBase<string> & {\n type: \"image\";\n round?: boolean;\n ariaLabel?: string;\n accept?: string;\n })\n | (PromptFieldBase<string> & {\n type: \"pin\";\n length?: number;\n stretch?: boolean;\n })\n | (PromptFieldBase<string> & {\n type: \"select\";\n options: string[] | { id: string; label?: string; description?: string; icon?: string }[];\n icon?: string;\n activeIcon?: string;\n clearable?: boolean;\n })\n | (PromptFieldBase<string[]> & {\n type: \"tags\";\n maxTags?: number;\n minTags?: number;\n icon?: string;\n activeIcon?: string;\n })\n | (PromptFieldBase<boolean> & {\n type: \"boolean\";\n })\n | (PromptFieldBase<string> & {\n type: \"datetime\";\n dateOnly?: boolean;\n /** A date whose time is optional, as `DateTimePicker`'s `optionalTime`. */\n optionalTime?: boolean;\n })\n | {\n type: \"info\";\n content: string | JSX.Element | (() => JSX.Element);\n };\n\ntype InferFieldType<T extends FieldSchema> = T extends { type: \"text\" }\n ? string\n : T extends { type: \"number\" }\n ? number\n : T extends { type: \"image\" }\n ? string\n : T extends { type: \"pin\" }\n ? string\n : T extends { type: \"select\" }\n ? string\n : T extends { type: \"tags\" }\n ? string[]\n : T extends { type: \"boolean\" }\n ? boolean\n : T extends { type: \"datetime\" }\n ? string\n : T extends { type: \"currency\" }\n ? number\n : T extends { type: \"info\" }\n ? never\n : never;\n\ntype InferFormValues<T extends Record<string, FieldSchema>> = {\n [K in keyof T as T[K] extends { type: \"info\" } ? never : K]: T[K] extends { required: true }\n ? InferFieldType<T[K]>\n : InferFieldType<T[K]> | undefined;\n};\n\ntype PromptFormValue = string | number | boolean | string[] | undefined;\ntype PromptFormOptions<T extends Record<string, FieldSchema>> = {\n signal?: AbortSignal;\n title?: string;\n ariaLabel?: string;\n icon?: string;\n /** Hold and animate content height changes. Defaults to true. */\n followContent?: boolean;\n fields: T;\n confirmText?: string;\n cancelText?: string | false;\n variant?: \"danger\" | \"primary\" | \"success\" | \"warning\";\n size?: DialogOptions[\"size\"];\n cancelBehavior?: DialogOptions[\"cancelBehavior\"];\n};\n\nconst isEmpty = (value: unknown): boolean =>\n value === undefined || value === null || value === \"\" || (Array.isArray(value) && value.length === 0);\n\nexport const createFormState = <T extends Record<string, FieldSchema>>(schema: T) => {\n const messages = resolveUiMessages();\n const promptMessages = resolvePromptMessages();\n const [values, setValues] = createStore<Record<string, PromptFormValue>>({});\n const [errors, setErrors] = createStore<Record<string, string | undefined>>({});\n // Errors appear with the first submit and then follow every change. Before that, a check that fails mid-input,\n // such as a URL still being typed, would interrupt the user with an alert on the first character.\n let submitted = false;\n\n for (const [key, field] of Object.entries(schema)) {\n if (field.type !== \"info\" && \"default\" in field) setValues(key, field.default as PromptFormValue);\n }\n\n const validateField = (key: string, value: PromptFormValue): string | null => {\n const field = schema[key];\n if (!field || field.type === \"info\") return null;\n if (field.type === \"boolean\" && field.required && value !== true) return messages.required;\n if (field.required && isEmpty(value)) return messages.required;\n if (\"validate\" in field && field.validate) {\n const customError = (field.validate as (next: never) => string | null)(value as never);\n if (customError) return customError;\n }\n if (field.type === \"text\" && typeof value === \"string\" && value.length > 0) {\n if (field.minLength !== undefined && value.length < field.minLength) return promptMessages.minCharacters({ count: field.minLength });\n if (field.maxLength !== undefined && value.length > field.maxLength) return promptMessages.maxCharacters({ count: field.maxLength });\n }\n if (field.type === \"tags\" && Array.isArray(value) && value.length > 0) {\n if (field.minTags !== undefined && value.length < field.minTags) return promptMessages.minTags({ count: field.minTags });\n if (field.maxTags !== undefined && value.length > field.maxTags) return promptMessages.maxTags({ count: field.maxTags });\n }\n return null;\n };\n\n const updateField = (key: string, value: PromptFormValue) => {\n setValues(key, value);\n if (submitted) setErrors(key, validateField(key, value) ?? undefined);\n };\n\n const validateAll = (): boolean => {\n submitted = true;\n let valid = true;\n for (const [key, field] of Object.entries(schema)) {\n if (field.type === \"info\") continue;\n const error = validateField(key, values[key]);\n setErrors(key, error ?? undefined);\n if (error) valid = false;\n }\n return valid;\n };\n\n const reset = () => {\n submitted = false;\n for (const [key, field] of Object.entries(schema)) {\n if (field.type === \"info\") continue;\n setValues(key, \"default\" in field ? (field.default as PromptFormValue) : undefined);\n setErrors(key, undefined);\n }\n };\n\n return { values, errors, updateField, validateAll, reset };\n};\n\nconst renderInfo = (content: Extract<FieldSchema, { type: \"info\" }>[\"content\"]): JSX.Element => {\n if (typeof content === \"string\") return <p>{content}</p>;\n if (typeof content === \"function\") return content();\n return content;\n};\n\nconst PromptControl = (props: {\n field: Exclude<FieldSchema, { type: \"info\" }>;\n value: () => PromptFormValue;\n update: (value: PromptFormValue) => void;\n error: () => string | undefined;\n submit: () => void;\n}): JSX.Element => {\n const label = props.field.label || undefined;\n\n switch (props.field.type) {\n case \"text\":\n return (\n <TextInput\n label={label}\n description={props.field.description}\n required={props.field.required}\n placeholder={props.field.placeholder}\n error={props.error}\n value={String(props.value() ?? \"\")}\n onValueChange={(value) => props.update(value ?? undefined)}\n onSubmit={props.submit}\n multiline={props.field.multiline}\n lines={props.field.lines}\n icon={props.field.icon}\n activeIcon={props.field.activeIcon}\n password={props.field.password}\n markdown={props.field.markdown}\n minLength={props.field.minLength}\n maxLength={props.field.maxLength}\n />\n );\n case \"number\":\n return (\n <NumberInput\n label={label}\n description={props.field.description}\n required={props.field.required}\n placeholder={props.field.placeholder}\n error={props.error}\n value={typeof props.value() === \"number\" ? (props.value() as number) : null}\n onValueChange={(value) => props.update(value ?? undefined)}\n min={props.field.min}\n max={props.field.max}\n step={props.field.step}\n />\n );\n case \"image\":\n return (\n <ImageInput\n label={label}\n description={props.field.description}\n required={props.field.required}\n error={props.error}\n value={() => (typeof props.value() === \"string\" ? (props.value() as string) : null)}\n onValueChange={(value) => props.update(value ?? undefined)}\n round={props.field.round}\n aria-label={props.field.ariaLabel}\n accept={props.field.accept}\n />\n );\n case \"pin\":\n return (\n <PinInput\n label={label}\n description={props.field.description}\n required={props.field.required}\n error={props.error}\n value={() => String(props.value() ?? \"\")}\n onValueChange={props.update}\n length={props.field.length}\n stretch={props.field.stretch}\n />\n );\n case \"select\":\n return (\n <Select\n label={label}\n description={props.field.description}\n required={props.field.required}\n placeholder={props.field.placeholder}\n error={props.error}\n value={() => (typeof props.value() === \"string\" ? (props.value() as string) : null)}\n onValueChange={(value) => props.update(value ?? undefined)}\n options={props.field.options}\n icon={props.field.icon}\n activeIcon={props.field.activeIcon}\n clearable={props.field.clearable}\n />\n );\n case \"tags\":\n return (\n <TagsInput\n label={label}\n description={props.field.description}\n required={props.field.required}\n placeholder={props.field.placeholder}\n error={props.error}\n value={() => (Array.isArray(props.value()) ? (props.value() as string[]) : [])}\n onValueChange={props.update}\n maxTags={props.field.maxTags}\n icon={props.field.icon}\n activeIcon={props.field.activeIcon}\n />\n );\n case \"boolean\":\n return (\n <Checkbox\n label={label}\n description={props.field.description}\n required={props.field.required}\n error={props.error}\n value={() => Boolean(props.value())}\n onValueChange={props.update}\n />\n );\n case \"datetime\": {\n const pickerProps = {\n label,\n description: props.field.description,\n required: props.field.required,\n placeholder: props.field.placeholder,\n error: props.error,\n value: () => (typeof props.value() === \"string\" ? (props.value() as string) : null),\n onValueChange: (value: string | null) => props.update(value ?? \"\"),\n clearable: true,\n };\n return props.field.dateOnly ? (\n <DatePicker {...pickerProps} />\n ) : (\n <DateTimePicker {...pickerProps} optionalTime={props.field.optionalTime} />\n );\n }\n }\n};\n\nconst PromptFormDialog = <T extends Record<string, FieldSchema>>(props: {\n config: PromptFormOptions<T>;\n close: (value: InferFormValues<T> | null) => void;\n}): JSX.Element => {\n const state = createFormState(props.config.fields);\n const submit = () => {\n if (state.validateAll()) props.close(state.values as InferFormValues<T>);\n };\n const handleSubmit = (event: SubmitEvent) => {\n event.preventDefault();\n submit();\n };\n\n return (\n <form class=\"k2b-dialog__panel\" onSubmit={handleSubmit}>\n <DialogHeader\n title={props.config.title}\n icon={props.config.icon}\n tone={promptTone(props.config.variant)}\n close={() => props.close(null)}\n />\n <div class=\"k2b-dialog__body k2b-prompt-form\">\n <For each={Object.entries(props.config.fields)}>\n {([key, field]) => {\n if (field.type === \"info\") return <div class=\"k2b-prompt-form__info\">{renderInfo(field.content)}</div>;\n return (\n <PromptControl\n field={field}\n value={() => state.values[key]}\n update={(value) => state.updateField(key, value)}\n error={() => state.errors[key]}\n submit={submit}\n />\n );\n }}\n </For>\n </div>\n <footer class=\"k2b-dialog__actions\">\n <Show when={props.config.cancelText !== false}>\n <button type=\"button\" class=\"k2b-button\" data-variant=\"secondary\" onClick={() => props.close(null)}>\n {props.config.cancelText || resolveUiMessages().cancel}\n </button>\n </Show>\n <button type=\"submit\" class=\"k2b-button\" data-variant={promptButtonVariant(props.config.variant)}>\n {props.config.confirmText ?? resolveUiMessages().save}\n </button>\n </footer>\n </form>\n );\n};\n\n// Results without an ID keep today's behavior: each object is its own identity, so a new answer replaces the row.\nconst anonymousRows = new WeakMap<object, string>();\nlet anonymousRow = 0;\nconst searchRowIdentity = (item: PromptSearchItem<unknown>): string => {\n if (item.id !== undefined) return `id:${item.id}`;\n const known = anonymousRows.get(item);\n if (known !== undefined) return known;\n const key = `object:${anonymousRow++}`;\n anonymousRows.set(item, key);\n return key;\n};\n\ntype CloudSearchResolver<T> = (input: PromptSearchInput) => Promise<PromptSearchItem<T>[]> | PromptSearchItem<T>[];\n\nconst openSearchPrompt = <T extends unknown = unknown>(resolver: CloudSearchResolver<T>, options?: PromptSearchOptions) =>\n dialogCore.open<PromptSearchItem<T>>(\n (close) => {\n const [query, setQuery] = createSignal(options?.initialQuery ?? \"\");\n const [items, setItems] = createSignal<PromptSearchItem<T>[]>([]);\n const [activeIndex, setActiveIndex] = createSignal(0);\n const [hasLoaded, setHasLoaded] = createSignal(false);\n const [failedPreviews, setFailedPreviews] = createStore<Record<number, true>>({});\n const [activeSearchQuery, setActiveSearchQuery] = createSignal(\"\");\n const rowRefs = new Map<number, HTMLButtonElement>();\n const searchId = `k2b-prompt-search-${createUniqueId()}`;\n const listboxId = `${searchId}-listbox`;\n const optionId = (index: number) => `${searchId}-option-${index}`;\n\n const minQueryLength = options?.minQueryLength ?? 0;\n const debounceMs = options?.debounceMs ?? 180;\n const searchMutation = mutation.create<{ query: string; items: PromptSearchItem<T>[] }, string, { requestQuery: string }>({\n // The newest query wins over a search still in flight.\n concurrency: \"replace\",\n onBefore: (requestQuery) => ({ requestQuery }),\n mutation: async (requestQuery, context) => {\n const result = await resolver({\n query: requestQuery,\n abortSignal: context.abortSignal,\n });\n return { query: requestQuery, items: (result ?? []).slice() };\n },\n onSuccess: (result, context) => {\n if (!context || context.requestQuery !== activeSearchQuery()) return;\n setItems(result.items);\n setActiveIndex(0);\n setHasLoaded(true);\n },\n onError: (error, context) => {\n if (!context || context.requestQuery !== activeSearchQuery() || error.name === \"AbortError\") return;\n setItems([]);\n setActiveIndex(0);\n setHasLoaded(true);\n },\n });\n const searchError = createMemo(() => {\n const error = searchMutation.error();\n if (!error || error.name === \"AbortError\") return null;\n return error.message || resolvePromptMessages().searchFailed;\n });\n const shouldShowResults = createMemo(() => {\n if (query().trim().length < minQueryLength) return false;\n return hasLoaded() || searchError() !== null || items().length > 0;\n });\n const emptyStateText = createMemo(() => {\n if (!hasLoaded()) return options?.emptyText ?? resolveSelectMessages().typeToSearch;\n return options?.noResultsText ?? resolveUiMessages().noResults;\n });\n const { debouncedFn: debounceSearch, cancel: cancelDebounce } = timed.debounce((nextQuery: string) => {\n setActiveSearchQuery(nextQuery);\n searchMutation.abort();\n void searchMutation.mutate(nextQuery);\n }, debounceMs);\n\n const execute = (item?: PromptSearchItem<T>) => {\n if (!item) return;\n close(item);\n };\n const moveSelection = (delta: -1 | 1) => {\n const list = items();\n if (list.length === 0) return;\n setActiveIndex((activeIndex() + delta + list.length) % list.length);\n };\n\n createEffect(() => {\n const list = items();\n const maxIndex = list.length - 1;\n if (maxIndex < 0) {\n setActiveIndex(0);\n return;\n }\n if (activeIndex() > maxIndex) setActiveIndex(maxIndex);\n rowRefs.get(activeIndex())?.scrollIntoView({ block: \"nearest\" });\n });\n createEffect(() => {\n const nextQuery = query().trim();\n setFailedPreviews({});\n if (nextQuery.length < minQueryLength) {\n cancelDebounce();\n searchMutation.abort();\n setItems([]);\n setActiveIndex(0);\n setHasLoaded(false);\n setActiveSearchQuery(\"\");\n return;\n }\n debounceSearch(nextQuery);\n });\n onCleanup(() => {\n cancelDebounce();\n searchMutation.abort();\n });\n\n return (\n <div class=\"k2b-prompt-search-shell\">\n <Show when={options?.title}>{(title) => <p class=\"k2b-prompt-search-shell__title\">{title()}</p>}</Show>\n <div class=\"k2b-prompt-search\">\n <label class=\"k2b-prompt-search__input\">\n <i class={options?.icon ?? \"ti ti-search\"} aria-hidden=\"true\" />\n <input\n id={searchId}\n type=\"search\"\n role=\"combobox\"\n aria-label={options?.ariaLabel ?? options?.title ?? resolveUiMessages().search}\n aria-autocomplete=\"list\"\n aria-controls={listboxId}\n aria-expanded={shouldShowResults()}\n aria-activedescendant={shouldShowResults() && items().length > 0 ? optionId(activeIndex()) : undefined}\n aria-busy={searchMutation.loading()}\n value={query()}\n onInput={(event) => setQuery(event.currentTarget.value)}\n onKeyDown={(event) => {\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n moveSelection(1);\n } else if (event.key === \"ArrowUp\") {\n event.preventDefault();\n moveSelection(-1);\n } else if (event.key === \"Enter\") {\n event.preventDefault();\n execute(items()[activeIndex()]);\n }\n }}\n placeholder={options?.placeholder ?? resolveUiMessages().search}\n spellcheck={false}\n autocapitalize=\"off\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n />\n <Show when={searchMutation.loading()}>\n <i class=\"ti ti-loader-2 k2b-spin\" aria-hidden=\"true\" />\n </Show>\n </label>\n <div\n class=\"k2b-prompt-search__collapse\"\n style={{\n height: shouldShowResults() ? \"var(--k2b-search-body-max)\" : \"0px\",\n opacity: shouldShowResults() ? \"1\" : \"0\",\n }}\n >\n <div class=\"k2b-prompt-search__results\" onWheel={(event) => event.stopPropagation()}>\n <Show when={searchError()}>\n {(message) => (\n <div class=\"k2b-prompt-search__error\" role=\"status\" aria-live=\"polite\">\n {message()}\n </div>\n )}\n </Show>\n <Show\n when={items().length > 0}\n fallback={\n <p role=\"status\" aria-live=\"polite\">\n {emptyStateText()}\n </p>\n }\n >\n <div id={listboxId} class=\"k2b-prompt-search__list\" role=\"listbox\" aria-label={resolveUiMessages().searchResults}>\n <KeyedFor each={items()} by={searchRowIdentity}>\n {(item, index) => (\n <button\n ref={(element) => {\n if (!element) rowRefs.delete(index());\n else rowRefs.set(index(), element);\n }}\n type=\"button\"\n id={optionId(index())}\n role=\"option\"\n aria-selected={activeIndex() === index()}\n data-active={activeIndex() === index() ? \"true\" : undefined}\n data-has-description={item().desc ? \"true\" : undefined}\n onMouseEnter={() => setActiveIndex(index())}\n onClick={() => execute(item())}\n >\n {/* Cloud keeps the preview box mounted once a row declares an image, so a\n failed load swaps in the fallback glyph instead of collapsing the row. */}\n <Show when={item().previewUrl?.startsWith(\"/\") || item().icon}>\n <span class=\"k2b-prompt-search__preview\">\n <Show\n when={item().previewUrl?.startsWith(\"/\") && !failedPreviews[index()]}\n fallback={<i class={item().icon ?? \"ti ti-file\"} aria-hidden=\"true\" />}\n >\n <img src={item().previewUrl} alt=\"\" onError={() => setFailedPreviews(index(), true)} />\n </Show>\n </span>\n </Show>\n <span class=\"k2b-prompt-search__copy\">\n <strong>{item().label}</strong>\n {optionDescription(() => ({ description: item().desc, descriptionVisual: item().descriptionVisual }))}\n </span>\n </button>\n )}\n </KeyedFor>\n </div>\n </Show>\n </div>\n </div>\n </div>\n </div>\n );\n },\n {\n panelClassName: \"k2b-dialog k2b-dialog--search is-bare\",\n contentClassName: \"k2b-dialog__viewport is-search\",\n initialFocus: \"first-input\",\n signal: options?.signal,\n cancelBehavior: options?.cancelBehavior,\n history: options?.history,\n followContent: options?.followContent,\n ariaLabel: options?.ariaLabel ?? options?.title ?? resolveUiMessages().search,\n },\n );\n\nconst promptText = (content: string, defaultValue?: string, options?: DialogOptions) =>\n prompts\n .form({\n ...options,\n fields: {\n message: { type: \"info\", content: () => <div class=\"k2b-prompt-copy\">{content}</div> },\n value: {\n type: \"text\",\n label: false,\n default: defaultValue || \"\",\n },\n },\n })\n .then((result) => result?.value ?? null);\n\nconst promptNumber = (\n content: string,\n defaultValue?: number,\n options?: DialogOptions & {\n min?: number;\n max?: number;\n },\n) =>\n prompts\n .form({\n ...options,\n fields: {\n message: { type: \"info\", content: () => <div class=\"k2b-prompt-copy\">{content}</div> },\n value: {\n type: \"number\",\n label: false,\n default: defaultValue || 0,\n min: options?.min,\n max: options?.max,\n },\n },\n })\n .then((result) => result?.value ?? null);\n\nconst openAlert = (content: PromptContent, options?: DialogOptions, celebrate?: boolean): Promise<void | undefined> =>\n openPrompt<void>(\n (close) => (\n <div class=\"k2b-dialog__panel\">\n <DialogHeader\n title={options?.title || resolveUiMessages().info}\n icon={options?.icon}\n tone={promptTone(options?.variant)}\n celebrate={celebrate}\n close={() => close()}\n />\n <div class=\"k2b-dialog__body\">{content}</div>\n <footer class=\"k2b-dialog__actions\">\n <button type=\"button\" class=\"k2b-button\" data-variant={promptButtonVariant(options?.variant)} onClick={() => close()}>\n {options?.confirmText || resolveUiMessages().ok}\n </button>\n </footer>\n </div>\n ),\n options,\n resolveUiMessages().info,\n );\n\n// The same object as `sharedPrompts`, which `PanelDialog` uses for its discard question: replacing `prompts.confirm`\n// (for example in a test) therefore reaches every confirmation.\nexport const prompts = Object.assign(sharedPrompts, {\n alert: (content: PromptContent, options?: DialogOptions): Promise<void | undefined> => openAlert(content, options),\n\n success: (content: PromptContent, options?: SuccessDialogOptions): Promise<void | undefined> => {\n const { celebrate, ...rest } = options ?? {};\n return openAlert(content, { ...rest, variant: \"success\", title: rest.title ?? resolveUiMessages().success }, celebrate);\n },\n\n prompt: promptText,\n promptNumber,\n\n form: async <T extends Record<string, FieldSchema>>(config: PromptFormOptions<T>): Promise<InferFormValues<T> | null> =>\n (await openPrompt<InferFormValues<T> | null>(\n (close) => <PromptFormDialog config={config} close={(value) => close(value)} />,\n { ...config, followContent: config.followContent ?? true },\n resolvePromptMessages().form,\n )) ?? null,\n\n /**\n * Open custom content with a typed close callback and the dialog render context.\n * Register a dismiss handler to guard Escape, backdrop clicks and the supplied header's close button,\n * for example while saving. Explicit close(result) bypasses the guard. Without a handler, dismissal\n * keeps its existing behavior, including a header close button independent of cancelBehavior.\n */\n dialog: <T extends unknown = unknown>(component: DialogRender<T>, options?: DialogOptions): Promise<T | undefined> =>\n openPrompt<T>(\n (close, context) => {\n // A dismiss handler the component sets guards the header's close button as well as Escape and the backdrop.\n let dismiss = () => close(undefined);\n const body = component(close, {\n ...context,\n setDismissHandler: (handler) => {\n context.setDismissHandler(handler);\n dismiss = () => void context.requestDismiss();\n },\n });\n if (options?.surface === \"bare\" && options.header === false) return body;\n return (\n <div class=\"k2b-dialog__panel k2b-dialog__stack\">\n <Show when={options?.header !== false}>\n <DialogHeader title={options?.title} icon={options?.icon} tone={promptTone(options?.variant)} close={() => dismiss()} />\n </Show>\n <div class=\"k2b-dialog__content\">{body}</div>\n </div>\n );\n },\n options,\n resolveUiMessages().dialog,\n // Without its header a custom dialog draws its own chrome and keeps the dialog frame.\n options?.header !== false,\n ),\n\n search: openSearchPrompt,\n\n error: (content: string | HTMLElement, options?: DialogOptions) =>\n openPrompt(\n (close) => (\n <div class=\"k2b-dialog__panel\">\n <DialogHeader title={options?.title ?? resolveUiMessages().error} icon={options?.icon} tone=\"danger\" close={close} />\n <div class=\"k2b-dialog__body\">{content}</div>\n <footer class=\"k2b-dialog__actions\">\n <button type=\"button\" class=\"k2b-button\" onClick={() => close()}>\n {options?.confirmText || resolveUiMessages().close}\n </button>\n </footer>\n </div>\n ),\n { ...options, variant: \"danger\" },\n resolveUiMessages().error,\n ),\n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;IAAA,IAAE,IAAI;MAAA,OAAE,OAAO,EAAE,IAAI;IAAA;IAAE,IAAI;IAAU,KAAK,EAAE;EAAK,cAClF,OAAO,YAGjC,OAAO,EAAE,WAAW,IAAI,iBAAiB,CAAC,CAAC,CAAC,KAAK,EAIzD,EACD;IAAE,GAAG,OAAO;IAAE,OAAO,EAAE;EAAS,CAAC,EACjC,iBAAiB,CAAC,CAAC,CAAC,KACtB;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -7,6 +7,13 @@ import { resolveToastMessages } from "./toast-messages";
7
7
 
8
8
  /** A link at the end of the message, such as "Open settings". Following it closes the toast. */
9
9
 
10
+ /**
11
+ * A title names the outcome in at most three words and 32 characters: one semibold line beside the icon tile in the
12
+ * narrowest toast (about 260 px of text on a 390 px phone). The repository rule `toast-copy` checks the same limits.
13
+ */
14
+ const TITLE_MAX_WORDS = 3;
15
+ const TITLE_MAX_CHARACTERS = 32;
16
+ const isShortLabel = text => text.trim().length <= TITLE_MAX_CHARACTERS && text.trim().split(/\s+/).filter(Boolean).length <= TITLE_MAX_WORDS;
10
17
  /** Toasts in the stack at every width; older ones leave by the eviction rule below. */
11
18
  const MAX_VISIBLE_TOASTS = 3;
12
19
  /** The same media query that moves the rail to the top edge in the stylesheet. */
@@ -724,6 +731,9 @@ const showToast = (description, options) => {
724
731
  titleElement.textContent = currentTitle ?? "";
725
732
  titleElement.hidden = !currentTitle;
726
733
  descriptionText.data = currentDescription;
734
+ // A short message without a title, such as "Link copied", is the outcome itself: it reads in the title's type.
735
+ // Anything longer stays calm body text, so an old sentence never turns into a bold paragraph.
736
+ if (!currentTitle && currentProgress === null && !currentLink && isShortLabel(currentDescription)) contentElement.dataset.short = "true";else delete contentElement.dataset.short;
727
737
  const href = currentLink ? safeHref(currentLink.href) : null;
728
738
  if (currentLink && href !== null) {
729
739
  linkElement.href = href;
@@ -862,7 +872,6 @@ const showToast = (description, options) => {
862
872
  if (has("title")) currentTitle = nextOptions.title;
863
873
  if (has("link")) currentLink = nextOptions.link ?? null;
864
874
  if (nextOptions?.dismissLabel) dismissLabel = nextOptions.dismissLabel;
865
- renderText();
866
875
  if (has("action") || has("secondaryAction")) {
867
876
  if (has("action")) currentAction = nextOptions.action ?? null;
868
877
  if (has("secondaryAction")) currentSecondary = nextOptions.secondaryAction ?? null;
@@ -871,6 +880,7 @@ const showToast = (description, options) => {
871
880
  if (has("duration")) explicitDuration = nextOptions.duration;
872
881
  if (has("progress")) currentProgress = nextOptions.progress ?? null;
873
882
  if (has("celebrate")) currentCelebrate = nextOptions.celebrate ?? false;
883
+ renderText();
874
884
  renderProgress();
875
885
  renderCheck();
876
886
  resetDismissTimer();