@k2b/ui 0.26.0 → 0.28.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 (231) hide show
  1. package/README.md +1 -1
  2. package/dist/base.css +147 -2
  3. package/dist/browser/actions/ContextMenu.js +30 -4
  4. package/dist/browser/actions/ContextMenu.js.map +1 -1
  5. package/dist/browser/actions/Dropdown.js +184 -158
  6. package/dist/browser/actions/Dropdown.js.map +1 -1
  7. package/dist/browser/actions/GestureMenu.js +71 -138
  8. package/dist/browser/actions/GestureMenu.js.map +1 -1
  9. package/dist/browser/actions/Toolbar.js +379 -48
  10. package/dist/browser/actions/Toolbar.js.map +1 -1
  11. package/dist/browser/actions/index.js.map +1 -1
  12. package/dist/browser/actions/menu-rows.js +15 -0
  13. package/dist/browser/actions/menu-rows.js.map +1 -0
  14. package/dist/browser/actions/menu-sheet.js +154 -0
  15. package/dist/browser/actions/menu-sheet.js.map +1 -0
  16. package/dist/browser/actions/toolbar-messages.js +20 -0
  17. package/dist/browser/actions/toolbar-messages.js.map +1 -0
  18. package/dist/browser/chart-inspection.js +3 -0
  19. package/dist/browser/chart-inspection.js.map +1 -0
  20. package/dist/browser/chat/ChatComposer.js +1020 -431
  21. package/dist/browser/chat/ChatComposer.js.map +1 -1
  22. package/dist/browser/chat/chat-behavior.js +4 -0
  23. package/dist/browser/chat/chat-behavior.js.map +1 -1
  24. package/dist/browser/chat/chat-messages.js +33 -1
  25. package/dist/browser/chat/chat-messages.js.map +1 -1
  26. package/dist/browser/chat/command-search.js +173 -0
  27. package/dist/browser/chat/command-search.js.map +1 -0
  28. package/dist/browser/chat/composer-document.js +1 -1
  29. package/dist/browser/chat/composer-document.js.map +1 -1
  30. package/dist/browser/chat/index.js +2 -0
  31. package/dist/browser/chat/index.js.map +1 -1
  32. package/dist/browser/chat/reaction-people.js +15 -0
  33. package/dist/browser/chat/reaction-people.js.map +1 -0
  34. package/dist/browser/content/CalendarDayView.js +28 -3
  35. package/dist/browser/content/CalendarDayView.js.map +1 -1
  36. package/dist/browser/content/Chart.js +6 -15
  37. package/dist/browser/content/Chart.js.map +1 -1
  38. package/dist/browser/content/ChartSnapshotView.js +7 -10
  39. package/dist/browser/content/ChartSnapshotView.js.map +1 -1
  40. package/dist/browser/content/MessageRow.js +330 -448
  41. package/dist/browser/content/MessageRow.js.map +1 -1
  42. package/dist/browser/content/ReactionBar.js +419 -0
  43. package/dist/browser/content/ReactionBar.js.map +1 -0
  44. package/dist/browser/content/chart-inspection-core.js +557 -0
  45. package/dist/browser/content/chart-inspection-core.js.map +1 -0
  46. package/dist/browser/content/chart-inspection.js +10 -445
  47. package/dist/browser/content/chart-inspection.js.map +1 -1
  48. package/dist/browser/content/chart-line-gaps.js +1 -1
  49. package/dist/browser/content/chart-line-gaps.js.map +1 -1
  50. package/dist/browser/content/chart-snapshot.js +1 -1
  51. package/dist/browser/content/chart-snapshot.js.map +1 -1
  52. package/dist/browser/content/index.js +1 -0
  53. package/dist/browser/content/index.js.map +1 -1
  54. package/dist/browser/feedback/dialog-core.js +135 -23
  55. package/dist/browser/feedback/dialog-core.js.map +1 -1
  56. package/dist/browser/index.js +1 -0
  57. package/dist/browser/index.js.map +1 -1
  58. package/dist/browser/input-mode.js +40 -0
  59. package/dist/browser/input-mode.js.map +1 -0
  60. package/dist/browser/inputs/Combobox.js +4 -2
  61. package/dist/browser/inputs/Combobox.js.map +1 -1
  62. package/dist/browser/inputs/FileDropTarget.js +24 -9
  63. package/dist/browser/inputs/FileDropTarget.js.map +1 -1
  64. package/dist/browser/inputs/FileInputs.js +2 -2
  65. package/dist/browser/inputs/FileInputs.js.map +1 -1
  66. package/dist/browser/inputs/SelectChip.js +52 -12
  67. package/dist/browser/inputs/SelectChip.js.map +1 -1
  68. package/dist/browser/inputs/emoji/EmojiPicker.js +13 -0
  69. package/dist/browser/inputs/emoji/EmojiPicker.js.map +1 -1
  70. package/dist/browser/inputs/file-drop.js.map +1 -1
  71. package/dist/browser/layout/AppWorkspace.js +708 -515
  72. package/dist/browser/layout/AppWorkspace.js.map +1 -1
  73. package/dist/browser/layout/BottomSheet.js +8 -0
  74. package/dist/browser/layout/BottomSheet.js.map +1 -1
  75. package/dist/browser/layout/DetailPanel.js +283 -197
  76. package/dist/browser/layout/DetailPanel.js.map +1 -1
  77. package/dist/browser/layout/Discussion.js +233 -185
  78. package/dist/browser/layout/Discussion.js.map +1 -1
  79. package/dist/browser/layout/TableOfContents.js +10 -2
  80. package/dist/browser/layout/TableOfContents.js.map +1 -1
  81. package/dist/browser/layout/app-workspace-controller.js +155 -23
  82. package/dist/browser/layout/app-workspace-controller.js.map +1 -1
  83. package/dist/browser/layout/app-workspace-state.js +5 -1
  84. package/dist/browser/layout/app-workspace-state.js.map +1 -1
  85. package/dist/browser/layout/detail-panel-messages.js +35 -0
  86. package/dist/browser/layout/detail-panel-messages.js.map +1 -0
  87. package/dist/browser/layout/index.js +1 -1
  88. package/dist/browser/layout/index.js.map +1 -1
  89. package/dist/browser/surfaces/Avatar.js +50 -20
  90. package/dist/browser/surfaces/Avatar.js.map +1 -1
  91. package/dist/browser/surfaces/AvatarStack.js +406 -0
  92. package/dist/browser/surfaces/AvatarStack.js.map +1 -0
  93. package/dist/browser/surfaces/avatar-messages.js +8 -2
  94. package/dist/browser/surfaces/avatar-messages.js.map +1 -1
  95. package/dist/browser/surfaces/index.js +1 -0
  96. package/dist/browser/surfaces/index.js.map +1 -1
  97. package/dist/ssr/actions/ContextMenu.js +21 -3
  98. package/dist/ssr/actions/ContextMenu.js.map +1 -1
  99. package/dist/ssr/actions/Dropdown.js +140 -72
  100. package/dist/ssr/actions/Dropdown.js.map +1 -1
  101. package/dist/ssr/actions/GestureMenu.js +52 -106
  102. package/dist/ssr/actions/GestureMenu.js.map +1 -1
  103. package/dist/ssr/actions/Toolbar.js +294 -14
  104. package/dist/ssr/actions/Toolbar.js.map +1 -1
  105. package/dist/ssr/actions/index.js.map +1 -1
  106. package/dist/ssr/actions/menu-rows.js +15 -0
  107. package/dist/ssr/actions/menu-rows.js.map +1 -0
  108. package/dist/ssr/actions/menu-sheet.js +138 -0
  109. package/dist/ssr/actions/menu-sheet.js.map +1 -0
  110. package/dist/ssr/actions/toolbar-messages.js +20 -0
  111. package/dist/ssr/actions/toolbar-messages.js.map +1 -0
  112. package/dist/ssr/chart-inspection.js +3 -0
  113. package/dist/ssr/chart-inspection.js.map +1 -0
  114. package/dist/ssr/chat/ChatComposer.js +604 -113
  115. package/dist/ssr/chat/ChatComposer.js.map +1 -1
  116. package/dist/ssr/chat/chat-behavior.js +4 -0
  117. package/dist/ssr/chat/chat-behavior.js.map +1 -1
  118. package/dist/ssr/chat/chat-messages.js +33 -1
  119. package/dist/ssr/chat/chat-messages.js.map +1 -1
  120. package/dist/ssr/chat/command-search.js +173 -0
  121. package/dist/ssr/chat/command-search.js.map +1 -0
  122. package/dist/ssr/chat/composer-document.js +1 -1
  123. package/dist/ssr/chat/composer-document.js.map +1 -1
  124. package/dist/ssr/chat/index.js +2 -0
  125. package/dist/ssr/chat/index.js.map +1 -1
  126. package/dist/ssr/chat/reaction-people.js +15 -0
  127. package/dist/ssr/chat/reaction-people.js.map +1 -0
  128. package/dist/ssr/content/CalendarDayView.js +28 -3
  129. package/dist/ssr/content/CalendarDayView.js.map +1 -1
  130. package/dist/ssr/content/Chart.js +6 -15
  131. package/dist/ssr/content/Chart.js.map +1 -1
  132. package/dist/ssr/content/ChartSnapshotView.js +7 -10
  133. package/dist/ssr/content/ChartSnapshotView.js.map +1 -1
  134. package/dist/ssr/content/MessageRow.js +98 -152
  135. package/dist/ssr/content/MessageRow.js.map +1 -1
  136. package/dist/ssr/content/ReactionBar.js +304 -0
  137. package/dist/ssr/content/ReactionBar.js.map +1 -0
  138. package/dist/ssr/content/chart-inspection-core.js +557 -0
  139. package/dist/ssr/content/chart-inspection-core.js.map +1 -0
  140. package/dist/ssr/content/chart-inspection.js +10 -445
  141. package/dist/ssr/content/chart-inspection.js.map +1 -1
  142. package/dist/ssr/content/chart-line-gaps.js +1 -1
  143. package/dist/ssr/content/chart-line-gaps.js.map +1 -1
  144. package/dist/ssr/content/chart-snapshot.js +1 -1
  145. package/dist/ssr/content/chart-snapshot.js.map +1 -1
  146. package/dist/ssr/content/index.js +1 -0
  147. package/dist/ssr/content/index.js.map +1 -1
  148. package/dist/ssr/feedback/dialog-core.js +135 -23
  149. package/dist/ssr/feedback/dialog-core.js.map +1 -1
  150. package/dist/ssr/index.js +1 -0
  151. package/dist/ssr/index.js.map +1 -1
  152. package/dist/ssr/input-mode.js +40 -0
  153. package/dist/ssr/input-mode.js.map +1 -0
  154. package/dist/ssr/inputs/Combobox.js +4 -2
  155. package/dist/ssr/inputs/Combobox.js.map +1 -1
  156. package/dist/ssr/inputs/FileDropTarget.js +17 -5
  157. package/dist/ssr/inputs/FileDropTarget.js.map +1 -1
  158. package/dist/ssr/inputs/FileInputs.js +2 -2
  159. package/dist/ssr/inputs/FileInputs.js.map +1 -1
  160. package/dist/ssr/inputs/SelectChip.js +44 -11
  161. package/dist/ssr/inputs/SelectChip.js.map +1 -1
  162. package/dist/ssr/inputs/emoji/EmojiPicker.js +12 -0
  163. package/dist/ssr/inputs/emoji/EmojiPicker.js.map +1 -1
  164. package/dist/ssr/inputs/file-drop.js.map +1 -1
  165. package/dist/ssr/layout/AppWorkspace.js +242 -105
  166. package/dist/ssr/layout/AppWorkspace.js.map +1 -1
  167. package/dist/ssr/layout/BottomSheet.js +8 -0
  168. package/dist/ssr/layout/BottomSheet.js.map +1 -1
  169. package/dist/ssr/layout/DetailPanel.js +112 -58
  170. package/dist/ssr/layout/DetailPanel.js.map +1 -1
  171. package/dist/ssr/layout/Discussion.js +63 -36
  172. package/dist/ssr/layout/Discussion.js.map +1 -1
  173. package/dist/ssr/layout/TableOfContents.js +10 -2
  174. package/dist/ssr/layout/TableOfContents.js.map +1 -1
  175. package/dist/ssr/layout/app-workspace-controller.js +155 -23
  176. package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
  177. package/dist/ssr/layout/app-workspace-state.js +5 -1
  178. package/dist/ssr/layout/app-workspace-state.js.map +1 -1
  179. package/dist/ssr/layout/detail-panel-messages.js +35 -0
  180. package/dist/ssr/layout/detail-panel-messages.js.map +1 -0
  181. package/dist/ssr/layout/index.js +1 -1
  182. package/dist/ssr/layout/index.js.map +1 -1
  183. package/dist/ssr/surfaces/Avatar.js +20 -2
  184. package/dist/ssr/surfaces/Avatar.js.map +1 -1
  185. package/dist/ssr/surfaces/AvatarStack.js +286 -0
  186. package/dist/ssr/surfaces/AvatarStack.js.map +1 -0
  187. package/dist/ssr/surfaces/avatar-messages.js +8 -2
  188. package/dist/ssr/surfaces/avatar-messages.js.map +1 -1
  189. package/dist/ssr/surfaces/index.js +1 -0
  190. package/dist/ssr/surfaces/index.js.map +1 -1
  191. package/dist/styles.css +1 -1
  192. package/dist/types/actions/ContextMenu.d.ts +8 -0
  193. package/dist/types/actions/Dropdown.d.ts +12 -5
  194. package/dist/types/actions/GestureMenu.d.ts +6 -4
  195. package/dist/types/actions/Toolbar.d.ts +20 -0
  196. package/dist/types/actions/index.d.ts +1 -1
  197. package/dist/types/actions/menu-rows.d.ts +5 -0
  198. package/dist/types/actions/menu-sheet.d.ts +22 -0
  199. package/dist/types/actions/toolbar-messages.d.ts +8 -0
  200. package/dist/types/chart-inspection.d.ts +2 -0
  201. package/dist/types/chat/ChatComposer.d.ts +51 -2
  202. package/dist/types/chat/chat-behavior.d.ts +4 -0
  203. package/dist/types/chat/chat-messages.d.ts +17 -2
  204. package/dist/types/chat/command-search.d.ts +41 -0
  205. package/dist/types/chat/index.d.ts +3 -1
  206. package/dist/types/chat/reaction-people.d.ts +9 -0
  207. package/dist/types/content/Chart.d.ts +2 -2
  208. package/dist/types/content/MessageRow.d.ts +3 -10
  209. package/dist/types/content/ReactionBar.d.ts +32 -0
  210. package/dist/types/content/chart-inspection-core.d.ts +61 -0
  211. package/dist/types/content/chart-inspection.d.ts +4 -20
  212. package/dist/types/content/chart-snapshot.d.ts +1 -1
  213. package/dist/types/content/index.d.ts +2 -1
  214. package/dist/types/feedback/dialog-core.d.ts +16 -1
  215. package/dist/types/index.d.ts +1 -0
  216. package/dist/types/input-mode.d.ts +7 -0
  217. package/dist/types/inputs/FileDropTarget.d.ts +6 -3
  218. package/dist/types/inputs/SelectChip.d.ts +6 -0
  219. package/dist/types/inputs/file-drop.d.ts +2 -0
  220. package/dist/types/layout/AppWorkspace.d.ts +13 -1
  221. package/dist/types/layout/BottomSheet.d.ts +8 -0
  222. package/dist/types/layout/DetailPanel.d.ts +11 -0
  223. package/dist/types/layout/Discussion.d.ts +8 -0
  224. package/dist/types/layout/TableOfContents.d.ts +2 -0
  225. package/dist/types/layout/detail-panel-messages.d.ts +15 -0
  226. package/dist/types/layout/index.d.ts +1 -1
  227. package/dist/types/surfaces/Avatar.d.ts +12 -0
  228. package/dist/types/surfaces/AvatarStack.d.ts +41 -0
  229. package/dist/types/surfaces/avatar-messages.d.ts +3 -0
  230. package/dist/types/surfaces/index.d.ts +3 -1
  231. package/package.json +9 -4
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["content/chart-inspection-core.ts"],"sourcesContent":["import type { ChartDatum, charts } from \"@k2b/stdlib\";\nimport { positionTooltipSurface } from \"../feedback/tooltip-position\";\nimport type { ChartCursor, ChartCursorState } from \"./chart-cursor\";\n\nexport type ChartKind = keyof typeof charts;\n\nexport type ChartDatumRef = Pick<ChartDatum, \"role\" | \"index\" | \"seriesIndex\">;\nexport const sameChartDatum = (a: ChartDatumRef, b: ChartDatumRef) =>\n a.role === b.role && a.index === b.index && a.seriesIndex === b.seriesIndex;\n\nexport type ChartSelection = { kind: ChartKind; datum: ChartDatum };\nexport type ChartTooltip = { title?: string; rows: readonly { label: string; value: string }[] };\nexport type ChartTooltipFormatter = (selection: ChartSelection) => ChartTooltip;\n\ntype Entry = { element: SVGGraphicsElement; datum: ChartDatum };\nconst object = (value: unknown): value is Record<string, unknown> => typeof value === \"object\" && value !== null;\nconst pair = (value: unknown): value is [number, number] =>\n Array.isArray(value) && value.length === 2 && value.every((n) => typeof n === \"number\" && Number.isFinite(n));\nconst roles = new Set([\"point\", \"item\", \"bin\", \"box\", \"outlier\", \"value\", \"cell\", \"interval\"]);\nexport function isChartDatum(value: unknown): value is ChartDatum {\n return (\n object(value) &&\n Number.isInteger(value.index) &&\n typeof value.index === \"number\" &&\n value.index >= 0 &&\n (value.seriesIndex === undefined ||\n (typeof value.seriesIndex === \"number\" && Number.isInteger(value.seriesIndex) && value.seriesIndex >= 0)) &&\n typeof value.role === \"string\" &&\n roles.has(value.role) &&\n pair(value.anchor) &&\n (value.grid === undefined || pair(value.grid)) &&\n (value.label === undefined || typeof value.label === \"string\") &&\n Array.isArray(value.values) &&\n value.values.every(\n (field) =>\n object(field) &&\n typeof field.key === \"string\" &&\n (typeof field.value === \"string\" || (typeof field.value === \"number\" && Number.isFinite(field.value))) &&\n (field.formatted === undefined || typeof field.formatted === \"string\"),\n )\n );\n}\n\n/** Adds or removes only the tooltip id, keeping descriptions the host put on the container. */\nconst describe = (container: HTMLElement, id: string, on: boolean) => {\n const ids = (container.getAttribute(\"aria-describedby\") ?? \"\").split(/\\s+/).filter((token) => token && token !== id);\n if (on) ids.push(id);\n if (ids.length) container.setAttribute(\"aria-describedby\", ids.join(\" \"));\n else container.removeAttribute(\"aria-describedby\");\n};\n\n/** Enhances existing SVG nodes. Pointer/focus changes never rebuild the chart. */\nexport function createChartInspector(options: {\n container: () => HTMLElement | undefined;\n cursor?: () => ChartCursor | undefined;\n tooltip: () => HTMLSpanElement | undefined;\n anchor: () => HTMLSpanElement | undefined;\n kind: () => ChartKind;\n enabled: () => boolean;\n format: ChartTooltipFormatter;\n select: (selection: ChartSelection) => void;\n}) {\n const source = Symbol(\"chart cursor\");\n let entries: Entry[] | undefined;\n let sortedPoints: Entry[] = [];\n const byElement = new Map<Element, Entry>();\n let active: Entry | undefined;\n let highlighted: Entry[] = [];\n let pinned = false;\n let pointerStart: { x: number; y: number } | undefined;\n let moved = false;\n let pending: { x: number; y: number; target: Element | null } | undefined;\n let frame: number | undefined;\n // The cursor this chart is subscribed to. Closing reads it instead of the cursor prop: a chart also closes\n // while it unmounts, when a parent `<Show>` may already have dropped the value the prop came from.\n let linkedCursor: ChartCursor | undefined;\n\n const records = () => {\n if (!entries || (entries.length > 0 && !entries[0]!.element.isConnected)) {\n entries = [];\n byElement.clear();\n sortedPoints = [];\n for (const element of Array.from(options.container()?.querySelectorAll<SVGGraphicsElement>(\"[data-chart-datum]\") ?? [])) {\n try {\n const value: unknown = JSON.parse(element.getAttribute(\"data-chart-datum\") ?? \"null\");\n if (isChartDatum(value)) {\n const entry = { element, datum: value };\n entries.push(entry);\n byElement.set(element, entry);\n }\n } catch {\n /* Only valid renderer metadata participates in inspection. */\n }\n }\n sortedPoints = entries.filter((entry) => entry.datum.role === \"point\").sort((a, b) => a.datum.anchor[0] - b.datum.anchor[0]);\n }\n return entries;\n };\n const highlightColor = (item: Entry): string => {\n // Read the actual paint before applying inspection styles, including\n // custom series and threshold colors. Invisible points use their line.\n const point = item.element.querySelector(\".stdlib-chart-inspection-point\");\n const source = point\n ? options\n .container()\n ?.querySelector(\n options.kind() === \"line\"\n ? `.stdlib-chart-line.stdlib-chart-series-${(item.datum.seriesIndex ?? 0) % 8}`\n : \".stdlib-chart-sparkline, .stdlib-chart-stat-sparkline\",\n )\n : (item.element.querySelector(\".stdlib-chart-bar-gauge-fill, .stdlib-chart-gauge-fill, .stdlib-chart-stat-value\") ??\n item.element.querySelector(\"rect, path, circle\"));\n const paint = source ? source.ownerDocument.defaultView?.getComputedStyle(source) : undefined;\n const color =\n (point || item.element.hasAttribute(\"data-chart-reference\") ? paint?.stroke : paint?.fill) ||\n `var(--stdlib-chart-c${((item.datum.seriesIndex ?? 0) % 8) + 1})`;\n return `color-mix(in srgb, ${color} 72%, var(--k2b-chart-highlight-mix))`;\n };\n const selectData = (selected: readonly ChartDatumRef[]) => {\n for (const entry of records()) {\n const matches = selected.some((datum) => sameChartDatum(datum, entry.datum));\n if (matches) entry.element.style.setProperty(\"--k2b-chart-selection-color\", highlightColor(entry));\n else entry.element.style.removeProperty(\"--k2b-chart-selection-color\");\n entry.element.toggleAttribute(\"data-selected\", matches);\n }\n };\n const screenPoint = (entry: Entry) => {\n const matrix = entry.element.getScreenCTM?.();\n const [x, y] = entry.datum.anchor;\n if (matrix) return { x: matrix.a * x + matrix.c * y + matrix.e, y: matrix.b * x + matrix.d * y + matrix.f };\n const rect = entry.element.getBoundingClientRect();\n return { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 };\n };\n const visibleRecords = () => {\n const nodes = records();\n if (options.kind() !== \"map\") return nodes;\n const viewport = options.container()?.querySelector<SVGSVGElement>(\".stdlib-chart-map-viewport\");\n if (!viewport?.getScreenCTM?.()) return nodes;\n const root = viewport.ownerSVGElement?.getBoundingClientRect();\n if (!root?.width || !root.height) return nodes;\n const width = viewport?.width?.baseVal.value;\n const height = viewport?.height?.baseVal.value;\n if (!width || !height) return nodes;\n const left = root.left + viewport.x.baseVal.value;\n const top = root.top + viewport.y.baseVal.value;\n const clip = { left, top, right: left + width, bottom: top + height };\n return nodes.filter((entry) => {\n const point = screenPoint(entry);\n return point.x >= clip.left && point.x <= clip.right && point.y >= clip.top && point.y <= clip.bottom;\n });\n };\n const rawX = (entry: Entry) => entry.datum.values.find((field) => field.key === \"x\")?.value;\n const seriesChart = () => options.kind() === \"line\" || options.kind() === \"sparkline\";\n const clearHighlight = () => {\n for (const entry of highlighted) {\n entry.element.removeAttribute(\"data-inspected\");\n entry.element.style.removeProperty(\"--k2b-chart-inspection-color\");\n if (!entry.element.getAttribute(\"style\")) entry.element.removeAttribute(\"style\");\n }\n highlighted = [];\n };\n const close = (broadcast = true, cancelPending = true) => {\n const state = linkedCursor?.read();\n if (broadcast && state && state.source !== source) return;\n if (broadcast) linkedCursor?.clear(source);\n options.container()?.removeAttribute(\"data-cursor-source\");\n pinned = false;\n active = undefined;\n clearHighlight();\n const container = options.container(),\n id = options.tooltip()?.id;\n if (container && id) describe(container, id, false);\n options.container()?.removeAttribute(\"data-inspecting\");\n const tooltip = options.tooltip();\n if (tooltip) {\n try {\n if (tooltip.matches(\":popover-open\")) tooltip.hidePopover();\n } catch {\n /* Detached during navigation. */\n }\n }\n if (cancelPending) {\n if (frame !== undefined) cancelAnimationFrame(frame);\n frame = undefined;\n pending = undefined;\n }\n };\n const invalidate = () => {\n options.cursor?.()?.clear(source);\n close(false);\n entries = undefined;\n sortedPoints = [];\n byElement.clear();\n receive(options.cursor?.()?.read() ?? null);\n };\n const show = (entry: Entry, broadcast = true) => {\n const x = rawX(entry);\n if (broadcast && options.kind() === \"line\" && typeof x === \"number\") options.cursor?.()?.move(source, x);\n const tooltip = options.tooltip(),\n anchor = options.anchor(),\n container = options.container();\n if (!tooltip || !anchor || !container || !options.enabled()) return;\n if (active === entry && tooltip.matches(\":popover-open\")) return;\n clearHighlight();\n active = entry;\n highlighted = options.kind() === \"line\" ? records().filter((candidate) => rawX(candidate) === rawX(entry)) : [entry];\n for (const item of highlighted) {\n item.element.style.setProperty(\"--k2b-chart-inspection-color\", highlightColor(item));\n item.element.setAttribute(\"data-inspected\", \"true\");\n }\n const document = tooltip.ownerDocument;\n const contents = highlighted.map((item) => ({\n item,\n content: options.format({ kind: options.kind(), datum: item.datum }),\n missing: false,\n }));\n if (options.cursor?.() && options.kind() === \"line\") {\n const present = new Set(highlighted.map((item) => item.datum.seriesIndex));\n for (const item of records()) {\n if (present.has(item.datum.seriesIndex)) continue;\n present.add(item.datum.seriesIndex);\n contents.push({ item, content: options.format({ kind: options.kind(), datum: item.datum }), missing: true });\n }\n contents.sort((a, b) => (a.item.datum.seriesIndex ?? 0) - (b.item.datum.seriesIndex ?? 0));\n }\n tooltip.replaceChildren();\n const sharedTitle = typeof x === \"number\" ? options.cursor?.()?.formatX?.(x) : undefined;\n const commonTitle =\n sharedTitle ??\n (contents.every(({ content }) => content.title === contents[0]?.content.title) ? contents[0]?.content.title : undefined);\n if (commonTitle) {\n const title = document.createElement(\"strong\");\n title.className = \"k2b-chart__tooltip-title\";\n title.textContent = commonTitle;\n tooltip.append(title);\n }\n for (const { item, content, missing } of contents) {\n if (content.title && !commonTitle) {\n const title = document.createElement(\"strong\");\n title.className = \"k2b-chart__tooltip-title\";\n title.textContent = content.title;\n tooltip.append(title);\n }\n for (const row of content.rows) {\n const line = document.createElement(\"span\");\n line.className = \"k2b-chart__tooltip-row\";\n if (options.kind() === \"line\") {\n const swatch = document.createElement(\"i\");\n swatch.setAttribute(\"aria-hidden\", \"true\");\n const series = container.querySelector(`.stdlib-chart-line.stdlib-chart-series-${(item.datum.seriesIndex ?? 0) % 8}`);\n swatch.style.background = series\n ? getComputedStyle(series).stroke\n : `var(--stdlib-chart-c${((item.datum.seriesIndex ?? 0) % 8) + 1})`;\n line.append(swatch);\n }\n const label = document.createElement(\"span\");\n label.textContent = `${row.label}: `;\n const value = document.createElement(\"b\");\n value.textContent = missing ? \"—\" : row.value;\n line.append(label, value);\n tooltip.append(line);\n }\n }\n const rect = container.getBoundingClientRect(),\n point = screenPoint(entry);\n anchor.style.left = `${point.x - rect.left}px`;\n anchor.style.top = `${point.y - rect.top}px`;\n updatePlotBounds();\n container.style.setProperty(\"--k2b-chart-inspection-x\", `${point.x - rect.left}px`);\n container.setAttribute(\"data-inspecting\", seriesChart() ? \"series\" : \"datum\");\n describe(container, tooltip.id, true);\n try {\n if (!tooltip.matches(\":popover-open\")) tooltip.showPopover();\n positionTooltipSurface(tooltip, anchor);\n } catch {\n /* SVG titles remain available without the Popover API. */\n }\n };\n const updatePlotBounds = () => {\n const container = options.container();\n if (!container) return;\n const axes = Array.from(container.querySelectorAll(\".stdlib-chart-axis\")).map((axis) => axis.getBoundingClientRect());\n if (axes.length < 2) return;\n const left = Math.min(...axes.map((a) => a.left)),\n right = Math.max(...axes.map((a) => a.right));\n const top = Math.min(...axes.map((a) => a.top)),\n bottom = Math.max(...axes.map((a) => a.bottom));\n if (right <= left || bottom <= top) return;\n const rect = container.getBoundingClientRect();\n for (const [name, value] of Object.entries({\n left: left - rect.left,\n right: rect.right - right,\n top: top - rect.top,\n bottom: rect.bottom - bottom,\n }))\n container.style.setProperty(`--k2b-chart-plot-${name}`, `${value}px`);\n return { left, right, top, bottom };\n };\n const receive = (state: ChartCursorState) => {\n if (state?.source === source) return;\n close(false, false);\n if (!state || options.kind() !== \"line\") return;\n const entry = records().find((item) => rawX(item) === state.x);\n if (entry) show(entry, false);\n };\n const linkCursor = (cursor: ChartCursor | undefined): (() => void) => {\n linkedCursor = cursor;\n const unsubscribe = cursor?.subscribe(receive);\n return () => {\n unsubscribe?.();\n cursor?.clear(source);\n linkedCursor = undefined;\n };\n };\n const nearest = (x: number, y: number, target: Element | null): Entry | undefined => {\n if (target?.closest(\"button,a\") && !target.closest(\"[data-chart-datum]\")) return;\n const nodes = visibleRecords();\n // A mark wins before the plot bounds: the first and last points of a line sit on the plot's edges, so half of\n // their hit area lies outside it.\n const direct = target?.closest(\"[data-chart-datum]\");\n const hit = direct ? byElement.get(direct) : undefined;\n if (hit && nodes.includes(hit)) return hit;\n if (seriesChart()) {\n const plot = updatePlotBounds();\n if (plot && (x < plot.left || x > plot.right || y < plot.top || y > plot.bottom)) return;\n }\n // Exact shapes win. A small physical hit radius also reaches tiny or\n // zero-sized marks; distant whitespace leaves the chart unselected.\n const points = seriesChart() ? sortedPoints : nodes;\n if (seriesChart() && points.length) {\n const matrix = points[0]!.element.getScreenCTM?.();\n if (matrix) {\n const determinant = matrix.a * matrix.d - matrix.b * matrix.c;\n if (!determinant) return;\n const targetX = ((x - matrix.e) * matrix.d - (y - matrix.f) * matrix.c) / determinant;\n let low = 0,\n high = points.length - 1;\n while (low < high) {\n const mid = Math.floor((low + high) / 2);\n if (points[mid]!.datum.anchor[0] < targetX) low = mid + 1;\n else high = mid;\n }\n const previous = Math.max(0, low - 1);\n return Math.abs(points[previous]!.datum.anchor[0] - targetX) <= Math.abs(points[low]!.datum.anchor[0] - targetX)\n ? points[previous]\n : points[low];\n }\n }\n const matrices = new Map<SVGSVGElement, DOMMatrix | null>();\n let best: Entry | undefined,\n distance = Infinity;\n for (const entry of points) {\n const svg = entry.element.ownerSVGElement;\n if (svg && !matrices.has(svg)) matrices.set(svg, svg.getScreenCTM?.() ?? null);\n const matrix = svg ? matrices.get(svg) : null;\n const [ax, ay] = entry.datum.anchor;\n const point = matrix\n ? { x: matrix.a * ax + matrix.c * ay + matrix.e, y: matrix.b * ax + matrix.d * ay + matrix.f }\n : screenPoint(entry);\n const dx = point.x - x,\n dy = point.y - y;\n const next = seriesChart() ? Math.abs(dx) : Math.hypot(dx, dy);\n if (next < distance) {\n distance = next;\n best = entry;\n }\n }\n return seriesChart() || distance <= 24 ? best : undefined;\n };\n const move = (event: PointerEvent) => {\n if (event.target instanceof Node && options.tooltip()?.contains(event.target)) return;\n if (pointerStart && Math.hypot(event.clientX - pointerStart.x, event.clientY - pointerStart.y) > 6) moved = true;\n if (!options.enabled() || pinned || event.pointerType === \"touch\" || event.buttons) return;\n pending = { x: event.clientX, y: event.clientY, target: event.target instanceof Element ? event.target : null };\n if (frame !== undefined) return;\n frame = requestAnimationFrame(() => {\n frame = undefined;\n const sample = pending;\n pending = undefined;\n if (!sample) return;\n const entry = nearest(sample.x, sample.y, sample.target);\n if (entry) {\n show(entry);\n if (seriesChart()) {\n const container = options.container();\n container?.setAttribute(\"data-cursor-source\", \"true\");\n container?.style.setProperty(\"--k2b-chart-inspection-y\", `${sample.y - container.getBoundingClientRect().top}px`);\n }\n } else close();\n });\n };\n const down = (event: PointerEvent) => {\n pointerStart = { x: event.clientX, y: event.clientY };\n moved = false;\n };\n const click = (event: MouseEvent) => {\n if (!options.enabled() || moved || (event.target instanceof Element && event.target.closest(\"button,a\"))) return;\n const entry = nearest(event.clientX, event.clientY, event.target instanceof Element ? event.target : null);\n if (!entry) {\n close();\n return;\n }\n pinned = true;\n show(entry);\n options.select({ kind: options.kind(), datum: entry.datum });\n };\n const focus = (event: FocusEvent) => {\n if (event.target !== options.container() || !options.enabled()) return;\n const nodes = visibleRecords();\n const first = options.kind() === \"line\" ? sortedPoints.at(-1) : nodes[0];\n if (first) show(first);\n };\n const key = (event: KeyboardEvent): boolean => {\n if (!options.enabled() || event.target !== options.container()) return false;\n if (event.key === \"Escape\") {\n close();\n return true;\n }\n if (event.key === \"Enter\" && active) {\n if (options.kind() === \"map\" && !visibleRecords().includes(active)) {\n close();\n return true;\n }\n event.preventDefault();\n pinned = true;\n const link = active.element.closest(\"a\");\n if (link) link.dispatchEvent(new MouseEvent(\"click\", { bubbles: true, cancelable: true }));\n else options.select({ kind: options.kind(), datum: active.datum });\n return true;\n }\n const navigationChart = options.kind() === \"map\" || options.kind() === \"stateTimeline\";\n if (navigationChart && !event.altKey) return false;\n if (![\"Home\", \"End\", \"ArrowLeft\", \"ArrowRight\", \"ArrowUp\", \"ArrowDown\"].includes(event.key)) return false;\n let nodes = visibleRecords();\n if (seriesChart()) nodes = [...nodes].sort((a, b) => a.datum.anchor[0] - b.datum.anchor[0]);\n if (options.kind() === \"line\") {\n const seen = new Set<string | number | undefined>();\n nodes = nodes.filter((entry) => {\n const x = rawX(entry);\n if (seen.has(x)) return false;\n seen.add(x);\n return true;\n });\n }\n if (!nodes.length) return false;\n event.preventDefault();\n pinned = false;\n let index = active\n ? options.kind() === \"line\"\n ? nodes.findIndex((entry) => rawX(entry) === rawX(active!))\n : nodes.indexOf(active)\n : -1;\n if (event.key === \"Home\") index = 0;\n else if (event.key === \"End\") index = nodes.length - 1;\n else if (active?.datum.grid && [\"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"].includes(event.key)) {\n const [x, y] = active.datum.grid;\n const dx = event.key === \"ArrowLeft\" ? -1 : event.key === \"ArrowRight\" ? 1 : 0;\n const dy = event.key === \"ArrowUp\" ? -1 : event.key === \"ArrowDown\" ? 1 : 0;\n const next = nodes\n .filter(\n (entry) =>\n entry.datum.grid &&\n (dx\n ? entry.datum.grid[1] === y && (entry.datum.grid[0] - x) * dx > 0\n : entry.datum.grid[0] === x && (entry.datum.grid[1] - y) * dy > 0),\n )\n .sort(\n (a, b) =>\n Math.abs(a.datum.grid![0] - x) +\n Math.abs(a.datum.grid![1] - y) -\n Math.abs(b.datum.grid![0] - x) -\n Math.abs(b.datum.grid![1] - y),\n )[0];\n if (next) index = nodes.indexOf(next);\n } else index += event.key === \"ArrowLeft\" || event.key === \"ArrowUp\" ? -1 : 1;\n show(nodes[Math.max(0, Math.min(nodes.length - 1, index))]!);\n return true;\n };\n return {\n selectDatum: (selected: ChartDatumRef | null | undefined) => selectData(selected ? [selected] : []),\n selectData,\n linkCursor,\n destroy: () => close(false),\n move,\n down,\n click,\n focus,\n key,\n close: () => close(),\n invalidate,\n leave: () => {\n if (!pinned) close();\n },\n };\n}\n\n/** Dismiss inspection on outside interaction, but allow the tooltip itself to scroll. */\nexport function closeChartInspectionOnOutside(options: {\n container: () => HTMLElement | undefined;\n tooltip: () => HTMLElement | undefined;\n close: () => void;\n}): () => void {\n const outside = (event: PointerEvent) => {\n if (event.target instanceof Node && !options.container()?.contains(event.target)) options.close();\n };\n const scroll = (event: Event) => {\n if (event.target instanceof Node && options.tooltip()?.contains(event.target)) return;\n options.close();\n };\n window.addEventListener(\"pointerdown\", outside);\n window.addEventListener(\"scroll\", scroll, true);\n window.addEventListener(\"resize\", options.close);\n return () => {\n window.removeEventListener(\"pointerdown\", outside);\n window.removeEventListener(\"scroll\", scroll, true);\n window.removeEventListener(\"resize\", options.close);\n };\n}\n\nexport type InspectChartOptions = {\n kind: ChartKind;\n format: ChartTooltipFormatter;\n select?: (selection: ChartSelection) => void;\n cursor?: ChartCursor;\n};\nexport type ChartInspection = { invalidate(): void; close(): void; destroy(): void };\n\nlet tooltipId = 0;\n\n/** Attach inspection to stdlib SVG rendered with inspect: true, without a framework. */\nexport function inspectChart(container: HTMLElement, options: InspectChartOptions): ChartInspection {\n const document = container.ownerDocument;\n const anchor = document.createElement(\"span\");\n anchor.className = \"k2b-chart__anchor\";\n anchor.setAttribute(\"aria-hidden\", \"true\");\n const tooltip = document.createElement(\"span\");\n tooltip.className = \"k2b-tooltip k2b-chart__tooltip\";\n tooltip.setAttribute(\"role\", \"tooltip\");\n tooltip.setAttribute(\"popover\", \"manual\");\n tooltip.setAttribute(\"data-instant\", \"true\");\n do {\n tooltip.id = `k2b-chart-tooltip-${++tooltipId}`;\n } while (document.getElementById(tooltip.id));\n container.append(anchor, tooltip);\n const addedTabindex = !container.hasAttribute(\"tabindex\");\n if (addedTabindex) container.setAttribute(\"tabindex\", \"0\");\n\n const inspector = createChartInspector({\n container: () => container,\n cursor: () => options.cursor,\n tooltip: () => tooltip,\n anchor: () => anchor,\n kind: () => options.kind,\n enabled: () => true,\n format: options.format,\n select: (selection) => options.select?.(selection),\n });\n container.addEventListener(\"pointerdown\", inspector.down);\n container.addEventListener(\"pointermove\", inspector.move);\n container.addEventListener(\"click\", inspector.click);\n container.addEventListener(\"pointerleave\", inspector.leave);\n container.addEventListener(\"focusin\", inspector.focus);\n container.addEventListener(\"focusout\", inspector.close);\n container.addEventListener(\"keydown\", inspector.key);\n const removeOutside = closeChartInspectionOnOutside({ container: () => container, tooltip: () => tooltip, close: inspector.close });\n const unlinkCursor = inspector.linkCursor(options.cursor);\n let destroyed = false;\n return {\n invalidate: () => {\n if (!destroyed) inspector.invalidate();\n },\n close: () => {\n if (!destroyed) inspector.close();\n },\n destroy() {\n if (destroyed) return;\n destroyed = true;\n container.removeEventListener(\"pointerdown\", inspector.down);\n container.removeEventListener(\"pointermove\", inspector.move);\n container.removeEventListener(\"click\", inspector.click);\n container.removeEventListener(\"pointerleave\", inspector.leave);\n container.removeEventListener(\"focusin\", inspector.focus);\n container.removeEventListener(\"focusout\", inspector.close);\n container.removeEventListener(\"keydown\", inspector.key);\n removeOutside();\n unlinkCursor();\n inspector.destroy();\n for (const element of container.querySelectorAll<SVGGraphicsElement>(\"[data-chart-datum]\")) {\n element.removeAttribute(\"data-inspected\");\n element.style.removeProperty(\"--k2b-chart-inspection-color\");\n if (!element.getAttribute(\"style\")) element.removeAttribute(\"style\");\n }\n // Inspection geometry the inspector wrote onto the host container.\n for (const name of [\"inspection-x\", \"inspection-y\", \"plot-left\", \"plot-right\", \"plot-top\", \"plot-bottom\"])\n container.style.removeProperty(`--k2b-chart-${name}`);\n anchor.remove();\n tooltip.remove();\n if (addedTabindex) container.removeAttribute(\"tabindex\");\n },\n };\n}\n"],"mappings":"AACA,SAAS,sBAAsB,QAAQ,8BAA8B;AAMrE,OAAO,MAAM,cAAc,GAAG,CAAC,CAAgB,EAAE,CAAgB,KAC/D,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,WAAW,KAAK,CAAC,CAAC,WAAW;AAO7E,MAAM,MAAM,GAAI,KAAc,IAAuC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;AAChH,MAAM,IAAI,GAAI,KAAc,IAC1B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAE,CAAC,IAAK,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC/G,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AAC9F,OAAO,SAAS,YAAY,CAAC,KAAc,EAAuB;EAChE,OACE,MAAM,CAAC,KAAK,CAAC,IACb,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,IAC7B,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAC/B,KAAK,CAAC,KAAK,IAAI,CAAC,KACf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MAAM,IAAI,IAAI,CAAC,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,CAAC,EACvG,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,IAAI,EAAE,CAAC;MACvD,MAAM,CAAC,MAAM,CAAC,CAAC;MACf,OAAO,CAAC,MAAM,CAAC,CAAC;MAChB,IAAI,aAAa,EAAE,SAAS,CAAC,eAAe,CAAC,UAAU,CAAC;IAC1D;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,452 +1,17 @@
1
1
  import { createEffect, onCleanup } from "solid-js";
2
- import { positionTooltipSurface } from "../feedback/tooltip-position";
3
- export const sameChartDatum = (a, b) => a.role === b.role && a.index === b.index && a.seriesIndex === b.seriesIndex;
4
- const object = value => typeof value === "object" && value !== null;
5
- const pair = value => Array.isArray(value) && value.length === 2 && value.every(n => typeof n === "number" && Number.isFinite(n));
6
- const roles = new Set(["point", "item", "bin", "box", "outlier", "value", "cell", "interval"]);
7
- export function isChartDatum(value) {
8
- return object(value) && Number.isInteger(value.index) && typeof value.index === "number" && value.index >= 0 && (value.seriesIndex === undefined || typeof value.seriesIndex === "number" && Number.isInteger(value.seriesIndex) && value.seriesIndex >= 0) && typeof value.role === "string" && roles.has(value.role) && pair(value.anchor) && (value.grid === undefined || pair(value.grid)) && (value.label === undefined || typeof value.label === "string") && Array.isArray(value.values) && value.values.every(field => object(field) && typeof field.key === "string" && (typeof field.value === "string" || typeof field.value === "number" && Number.isFinite(field.value)) && (field.formatted === undefined || typeof field.formatted === "string"));
9
- }
10
-
11
- /** Enhances existing SVG nodes. Pointer/focus changes never rebuild the chart. */
2
+ import { createChartInspector } from "./chart-inspection-core";
12
3
  export function createChartInspection(options) {
13
- const source = Symbol("chart cursor");
14
- let entries;
15
- let sortedPoints = [];
16
- const byElement = new Map();
17
- let active;
18
- let highlighted = [];
19
- let pinned = false;
20
- let pointerStart;
21
- let moved = false;
22
- let pending;
23
- let frame;
24
- // The cursor this chart is subscribed to. Closing reads it instead of the cursor prop: a chart also closes
25
- // while it unmounts, when a parent `<Show>` may already have dropped the value the prop came from.
26
- let linkedCursor;
27
- const records = () => {
28
- if (!entries || entries.length > 0 && !entries[0].element.isConnected) {
29
- entries = [];
30
- byElement.clear();
31
- sortedPoints = [];
32
- for (const element of Array.from(options.container()?.querySelectorAll("[data-chart-datum]") ?? [])) {
33
- try {
34
- const value = JSON.parse(element.getAttribute("data-chart-datum") ?? "null");
35
- if (isChartDatum(value)) {
36
- const entry = {
37
- element,
38
- datum: value
39
- };
40
- entries.push(entry);
41
- byElement.set(element, entry);
42
- }
43
- } catch {
44
- /* Only valid renderer metadata participates in inspection. */
45
- }
46
- }
47
- sortedPoints = entries.filter(entry => entry.datum.role === "point").sort((a, b) => a.datum.anchor[0] - b.datum.anchor[0]);
48
- }
49
- return entries;
50
- };
51
- const highlightColor = item => {
52
- // Read the actual paint before applying inspection styles, including
53
- // custom series and threshold colors. Invisible points use their line.
54
- const point = item.element.querySelector(".stdlib-chart-inspection-point");
55
- const source = point ? options.container()?.querySelector(options.kind() === "line" ? `.stdlib-chart-line.stdlib-chart-series-${(item.datum.seriesIndex ?? 0) % 8}` : ".stdlib-chart-sparkline, .stdlib-chart-stat-sparkline") : item.element.querySelector(".stdlib-chart-bar-gauge-fill, .stdlib-chart-gauge-fill, .stdlib-chart-stat-value") ?? item.element.querySelector("rect, path, circle");
56
- const paint = source ? source.ownerDocument.defaultView?.getComputedStyle(source) : undefined;
57
- const color = (point || item.element.hasAttribute("data-chart-reference") ? paint?.stroke : paint?.fill) || `var(--stdlib-chart-c${(item.datum.seriesIndex ?? 0) % 8 + 1})`;
58
- return `color-mix(in srgb, ${color} 72%, var(--k2b-chart-highlight-mix))`;
59
- };
60
- const selectData = selected => {
61
- for (const entry of records()) {
62
- const matches = selected.some(datum => sameChartDatum(datum, entry.datum));
63
- if (matches) entry.element.style.setProperty("--k2b-chart-selection-color", highlightColor(entry));else entry.element.style.removeProperty("--k2b-chart-selection-color");
64
- entry.element.toggleAttribute("data-selected", matches);
65
- }
66
- };
67
- const screenPoint = entry => {
68
- const matrix = entry.element.getScreenCTM?.();
69
- const [x, y] = entry.datum.anchor;
70
- if (matrix) return {
71
- x: matrix.a * x + matrix.c * y + matrix.e,
72
- y: matrix.b * x + matrix.d * y + matrix.f
73
- };
74
- const rect = entry.element.getBoundingClientRect();
75
- return {
76
- x: rect.x + rect.width / 2,
77
- y: rect.y + rect.height / 2
78
- };
79
- };
80
- const visibleRecords = () => {
81
- const nodes = records();
82
- if (options.kind() !== "map") return nodes;
83
- const viewport = options.container()?.querySelector(".stdlib-chart-map-viewport");
84
- if (!viewport?.getScreenCTM?.()) return nodes;
85
- const root = viewport.ownerSVGElement?.getBoundingClientRect();
86
- if (!root?.width || !root.height) return nodes;
87
- const width = viewport?.width?.baseVal.value;
88
- const height = viewport?.height?.baseVal.value;
89
- if (!width || !height) return nodes;
90
- const left = root.left + viewport.x.baseVal.value;
91
- const top = root.top + viewport.y.baseVal.value;
92
- const clip = {
93
- left,
94
- top,
95
- right: left + width,
96
- bottom: top + height
97
- };
98
- return nodes.filter(entry => {
99
- const point = screenPoint(entry);
100
- return point.x >= clip.left && point.x <= clip.right && point.y >= clip.top && point.y <= clip.bottom;
101
- });
102
- };
103
- const rawX = entry => entry.datum.values.find(field => field.key === "x")?.value;
104
- const seriesChart = () => options.kind() === "line" || options.kind() === "sparkline";
105
- const clearHighlight = () => {
106
- for (const entry of highlighted) {
107
- entry.element.removeAttribute("data-inspected");
108
- entry.element.style.removeProperty("--k2b-chart-inspection-color");
109
- if (!entry.element.getAttribute("style")) entry.element.removeAttribute("style");
110
- }
111
- highlighted = [];
112
- };
113
- const close = (broadcast = true, cancelPending = true) => {
114
- const state = linkedCursor?.read();
115
- if (broadcast && state && state.source !== source) return;
116
- if (broadcast) linkedCursor?.clear(source);
117
- options.container()?.removeAttribute("data-cursor-source");
118
- pinned = false;
119
- active = undefined;
120
- clearHighlight();
121
- options.container()?.removeAttribute("aria-describedby");
122
- options.container()?.removeAttribute("data-inspecting");
123
- const tooltip = options.tooltip();
124
- if (tooltip) {
125
- try {
126
- if (tooltip.matches(":popover-open")) tooltip.hidePopover();
127
- } catch {
128
- /* Detached during navigation. */
129
- }
130
- }
131
- if (cancelPending) {
132
- if (frame !== undefined) cancelAnimationFrame(frame);
133
- frame = undefined;
134
- pending = undefined;
135
- }
136
- };
137
- const invalidate = () => {
138
- options.cursor?.()?.clear(source);
139
- close(false);
140
- entries = undefined;
141
- sortedPoints = [];
142
- byElement.clear();
143
- receive(options.cursor?.()?.read() ?? null);
144
- };
145
- const show = (entry, broadcast = true) => {
146
- const x = rawX(entry);
147
- if (broadcast && options.kind() === "line" && typeof x === "number") options.cursor?.()?.move(source, x);
148
- const tooltip = options.tooltip(),
149
- anchor = options.anchor(),
150
- container = options.container();
151
- if (!tooltip || !anchor || !container || !options.enabled()) return;
152
- if (active === entry && tooltip.matches(":popover-open")) return;
153
- clearHighlight();
154
- active = entry;
155
- highlighted = options.kind() === "line" ? records().filter(candidate => rawX(candidate) === rawX(entry)) : [entry];
156
- for (const item of highlighted) {
157
- item.element.style.setProperty("--k2b-chart-inspection-color", highlightColor(item));
158
- item.element.setAttribute("data-inspected", "true");
159
- }
160
- const document = tooltip.ownerDocument;
161
- const contents = highlighted.map(item => ({
162
- item,
163
- content: options.format({
164
- kind: options.kind(),
165
- datum: item.datum
166
- }),
167
- missing: false
168
- }));
169
- if (options.cursor?.() && options.kind() === "line") {
170
- const present = new Set(highlighted.map(item => item.datum.seriesIndex));
171
- for (const item of records()) {
172
- if (present.has(item.datum.seriesIndex)) continue;
173
- present.add(item.datum.seriesIndex);
174
- contents.push({
175
- item,
176
- content: options.format({
177
- kind: options.kind(),
178
- datum: item.datum
179
- }),
180
- missing: true
181
- });
182
- }
183
- contents.sort((a, b) => (a.item.datum.seriesIndex ?? 0) - (b.item.datum.seriesIndex ?? 0));
184
- }
185
- tooltip.replaceChildren();
186
- const sharedTitle = typeof x === "number" ? options.cursor?.()?.formatX?.(x) : undefined;
187
- const commonTitle = sharedTitle ?? (contents.every(({
188
- content
189
- }) => content.title === contents[0]?.content.title) ? contents[0]?.content.title : undefined);
190
- if (commonTitle) {
191
- const title = document.createElement("strong");
192
- title.className = "k2b-chart__tooltip-title";
193
- title.textContent = commonTitle;
194
- tooltip.append(title);
195
- }
196
- for (const {
197
- item,
198
- content,
199
- missing
200
- } of contents) {
201
- if (content.title && !commonTitle) {
202
- const title = document.createElement("strong");
203
- title.className = "k2b-chart__tooltip-title";
204
- title.textContent = content.title;
205
- tooltip.append(title);
206
- }
207
- for (const row of content.rows) {
208
- const line = document.createElement("span");
209
- line.className = "k2b-chart__tooltip-row";
210
- if (options.kind() === "line") {
211
- const swatch = document.createElement("i");
212
- swatch.setAttribute("aria-hidden", "true");
213
- const series = container.querySelector(`.stdlib-chart-line.stdlib-chart-series-${(item.datum.seriesIndex ?? 0) % 8}`);
214
- swatch.style.background = series ? getComputedStyle(series).stroke : `var(--stdlib-chart-c${(item.datum.seriesIndex ?? 0) % 8 + 1})`;
215
- line.append(swatch);
216
- }
217
- const label = document.createElement("span");
218
- label.textContent = `${row.label}: `;
219
- const value = document.createElement("b");
220
- value.textContent = missing ? "—" : row.value;
221
- line.append(label, value);
222
- tooltip.append(line);
223
- }
224
- }
225
- const rect = container.getBoundingClientRect(),
226
- point = screenPoint(entry);
227
- anchor.style.left = `${point.x - rect.left}px`;
228
- anchor.style.top = `${point.y - rect.top}px`;
229
- updatePlotBounds();
230
- container.style.setProperty("--k2b-chart-inspection-x", `${point.x - rect.left}px`);
231
- container.setAttribute("data-inspecting", seriesChart() ? "series" : "datum");
232
- container.setAttribute("aria-describedby", tooltip.id);
233
- try {
234
- if (!tooltip.matches(":popover-open")) tooltip.showPopover();
235
- positionTooltipSurface(tooltip, anchor);
236
- } catch {
237
- /* SVG titles remain available without the Popover API. */
238
- }
239
- };
240
- const updatePlotBounds = () => {
241
- const container = options.container();
242
- if (!container) return;
243
- const axes = Array.from(container.querySelectorAll(".stdlib-chart-axis")).map(axis => axis.getBoundingClientRect());
244
- if (axes.length < 2) return;
245
- const left = Math.min(...axes.map(a => a.left)),
246
- right = Math.max(...axes.map(a => a.right));
247
- const top = Math.min(...axes.map(a => a.top)),
248
- bottom = Math.max(...axes.map(a => a.bottom));
249
- if (right <= left || bottom <= top) return;
250
- const rect = container.getBoundingClientRect();
251
- for (const [name, value] of Object.entries({
252
- left: left - rect.left,
253
- right: rect.right - right,
254
- top: top - rect.top,
255
- bottom: rect.bottom - bottom
256
- })) container.style.setProperty(`--k2b-chart-plot-${name}`, `${value}px`);
257
- return {
258
- left,
259
- right,
260
- top,
261
- bottom
262
- };
263
- };
264
- const receive = state => {
265
- if (state?.source === source) return;
266
- close(false, false);
267
- if (!state || options.kind() !== "line") return;
268
- const entry = records().find(item => rawX(item) === state.x);
269
- if (entry) show(entry, false);
270
- };
4
+ const inspector = createChartInspector(options);
271
5
  createEffect(() => {
272
6
  const cursor = options.cursor?.();
273
- linkedCursor = cursor;
274
- const unsubscribe = cursor?.subscribe(receive);
275
- onCleanup(() => {
276
- unsubscribe?.();
277
- cursor?.clear(source);
278
- linkedCursor = undefined;
279
- });
7
+ onCleanup(inspector.linkCursor(cursor));
280
8
  });
281
- onCleanup(() => close(false));
282
- const nearest = (x, y, target) => {
283
- if (target?.closest("button,a") && !target.closest("[data-chart-datum]")) return;
284
- if (seriesChart()) {
285
- const plot = updatePlotBounds();
286
- if (plot && (x < plot.left || x > plot.right || y < plot.top || y > plot.bottom)) return;
287
- }
288
- const nodes = visibleRecords();
289
- const direct = target?.closest("[data-chart-datum]");
290
- const hit = direct ? byElement.get(direct) : undefined;
291
- if (hit && nodes.includes(hit)) return hit;
292
- // Exact shapes win. A small physical hit radius also reaches tiny or
293
- // zero-sized marks; distant whitespace leaves the chart unselected.
294
- const points = seriesChart() ? sortedPoints : nodes;
295
- if (seriesChart() && points.length) {
296
- const matrix = points[0].element.getScreenCTM?.();
297
- if (matrix) {
298
- const determinant = matrix.a * matrix.d - matrix.b * matrix.c;
299
- if (!determinant) return;
300
- const targetX = ((x - matrix.e) * matrix.d - (y - matrix.f) * matrix.c) / determinant;
301
- let low = 0,
302
- high = points.length - 1;
303
- while (low < high) {
304
- const mid = Math.floor((low + high) / 2);
305
- if (points[mid].datum.anchor[0] < targetX) low = mid + 1;else high = mid;
306
- }
307
- const previous = Math.max(0, low - 1);
308
- return Math.abs(points[previous].datum.anchor[0] - targetX) <= Math.abs(points[low].datum.anchor[0] - targetX) ? points[previous] : points[low];
309
- }
310
- }
311
- const matrices = new Map();
312
- let best,
313
- distance = Infinity;
314
- for (const entry of points) {
315
- const svg = entry.element.ownerSVGElement;
316
- if (svg && !matrices.has(svg)) matrices.set(svg, svg.getScreenCTM?.() ?? null);
317
- const matrix = svg ? matrices.get(svg) : null;
318
- const [ax, ay] = entry.datum.anchor;
319
- const point = matrix ? {
320
- x: matrix.a * ax + matrix.c * ay + matrix.e,
321
- y: matrix.b * ax + matrix.d * ay + matrix.f
322
- } : screenPoint(entry);
323
- const dx = point.x - x,
324
- dy = point.y - y;
325
- const next = seriesChart() ? Math.abs(dx) : Math.hypot(dx, dy);
326
- if (next < distance) {
327
- distance = next;
328
- best = entry;
329
- }
330
- }
331
- return seriesChart() || distance <= 24 ? best : undefined;
332
- };
333
- const move = event => {
334
- if (event.target instanceof Node && options.tooltip()?.contains(event.target)) return;
335
- if (pointerStart && Math.hypot(event.clientX - pointerStart.x, event.clientY - pointerStart.y) > 6) moved = true;
336
- if (!options.enabled() || pinned || event.pointerType === "touch" || event.buttons) return;
337
- pending = {
338
- x: event.clientX,
339
- y: event.clientY,
340
- target: event.target instanceof Element ? event.target : null
341
- };
342
- if (frame !== undefined) return;
343
- frame = requestAnimationFrame(() => {
344
- frame = undefined;
345
- const sample = pending;
346
- pending = undefined;
347
- if (!sample) return;
348
- const entry = nearest(sample.x, sample.y, sample.target);
349
- if (entry) {
350
- show(entry);
351
- if (seriesChart()) {
352
- const container = options.container();
353
- container?.setAttribute("data-cursor-source", "true");
354
- container?.style.setProperty("--k2b-chart-inspection-y", `${sample.y - container.getBoundingClientRect().top}px`);
355
- }
356
- } else close();
357
- });
358
- };
359
- const down = event => {
360
- pointerStart = {
361
- x: event.clientX,
362
- y: event.clientY
363
- };
364
- moved = false;
365
- };
366
- const click = event => {
367
- if (!options.enabled() || moved || event.target instanceof Element && event.target.closest("button,a")) return;
368
- const entry = nearest(event.clientX, event.clientY, event.target instanceof Element ? event.target : null);
369
- if (!entry) {
370
- close();
371
- return;
372
- }
373
- pinned = true;
374
- show(entry);
375
- options.select({
376
- kind: options.kind(),
377
- datum: entry.datum
378
- });
379
- };
380
- const focus = event => {
381
- if (event.target !== options.container() || !options.enabled()) return;
382
- const nodes = visibleRecords();
383
- const first = options.kind() === "line" ? sortedPoints.at(-1) : nodes[0];
384
- if (first) show(first);
385
- };
386
- const key = event => {
387
- if (!options.enabled() || event.target !== options.container()) return false;
388
- if (event.key === "Escape") {
389
- close();
390
- return true;
391
- }
392
- if (event.key === "Enter" && active) {
393
- if (options.kind() === "map" && !visibleRecords().includes(active)) {
394
- close();
395
- return true;
396
- }
397
- event.preventDefault();
398
- pinned = true;
399
- const link = active.element.closest("a");
400
- if (link) link.dispatchEvent(new MouseEvent("click", {
401
- bubbles: true,
402
- cancelable: true
403
- }));else options.select({
404
- kind: options.kind(),
405
- datum: active.datum
406
- });
407
- return true;
408
- }
409
- const navigationChart = options.kind() === "map" || options.kind() === "stateTimeline";
410
- if (navigationChart && !event.altKey) return false;
411
- if (!["Home", "End", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].includes(event.key)) return false;
412
- let nodes = visibleRecords();
413
- if (seriesChart()) nodes = [...nodes].sort((a, b) => a.datum.anchor[0] - b.datum.anchor[0]);
414
- if (options.kind() === "line") {
415
- const seen = new Set();
416
- nodes = nodes.filter(entry => {
417
- const x = rawX(entry);
418
- if (seen.has(x)) return false;
419
- seen.add(x);
420
- return true;
421
- });
422
- }
423
- if (!nodes.length) return false;
424
- event.preventDefault();
425
- pinned = false;
426
- let index = active ? options.kind() === "line" ? nodes.findIndex(entry => rawX(entry) === rawX(active)) : nodes.indexOf(active) : -1;
427
- if (event.key === "Home") index = 0;else if (event.key === "End") index = nodes.length - 1;else if (active?.datum.grid && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(event.key)) {
428
- const [x, y] = active.datum.grid;
429
- const dx = event.key === "ArrowLeft" ? -1 : event.key === "ArrowRight" ? 1 : 0;
430
- const dy = event.key === "ArrowUp" ? -1 : event.key === "ArrowDown" ? 1 : 0;
431
- const next = nodes.filter(entry => entry.datum.grid && (dx ? entry.datum.grid[1] === y && (entry.datum.grid[0] - x) * dx > 0 : entry.datum.grid[0] === x && (entry.datum.grid[1] - y) * dy > 0)).sort((a, b) => Math.abs(a.datum.grid[0] - x) + Math.abs(a.datum.grid[1] - y) - Math.abs(b.datum.grid[0] - x) - Math.abs(b.datum.grid[1] - y))[0];
432
- if (next) index = nodes.indexOf(next);
433
- } else index += event.key === "ArrowLeft" || event.key === "ArrowUp" ? -1 : 1;
434
- show(nodes[Math.max(0, Math.min(nodes.length - 1, index))]);
435
- return true;
436
- };
437
- return {
438
- selectDatum: selected => selectData(selected ? [selected] : []),
439
- selectData,
440
- move,
441
- down,
442
- click,
443
- focus,
444
- key,
445
- close: () => close(),
446
- invalidate,
447
- leave: () => {
448
- if (!pinned) close();
449
- }
450
- };
9
+ onCleanup(inspector.destroy);
10
+ const {
11
+ linkCursor,
12
+ destroy,
13
+ ...inspection
14
+ } = inspector;
15
+ return inspection;
451
16
  }
452
17
  //# sourceMappingURL=chart-inspection.js.map