doom-design-system 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/dist/components/Accordion/Accordion.module.css +121 -124
  2. package/dist/components/ActionRow/ActionRow.module.css +25 -24
  3. package/dist/components/Alert/Alert.module.css +74 -76
  4. package/dist/components/Avatar/Avatar.module.css +66 -66
  5. package/dist/components/Badge/Badge.module.css +50 -48
  6. package/dist/components/Breadcrumbs/Breadcrumbs.module.css +32 -33
  7. package/dist/components/Button/Button.d.ts +2 -2
  8. package/dist/components/Button/Button.js +1 -1
  9. package/dist/components/Button/Button.module.css +150 -152
  10. package/dist/components/Card/Card.module.css +37 -39
  11. package/dist/components/Chart/Chart.module.css +213 -245
  12. package/dist/components/Chart/behaviors/DraggablePuck.d.ts +36 -0
  13. package/dist/components/Chart/behaviors/DraggablePuck.js +94 -0
  14. package/dist/components/Chart/behaviors/Markers.js +6 -4
  15. package/dist/components/Chart/behaviors/SelectionUpdate.js +2 -4
  16. package/dist/components/Chart/behaviors/index.d.ts +1 -1
  17. package/dist/components/Chart/behaviors/index.js +1 -1
  18. package/dist/components/Chart/engine/CoordinateSystem.d.ts +59 -0
  19. package/dist/components/Chart/engine/CoordinateSystem.js +126 -0
  20. package/dist/components/Chart/engine/Engine.d.ts +102 -0
  21. package/dist/components/Chart/engine/Engine.js +226 -0
  22. package/dist/components/Chart/engine/Scheduler.d.ts +59 -0
  23. package/dist/components/Chart/engine/Scheduler.js +139 -0
  24. package/dist/components/Chart/engine/SpatialMap.d.ts +114 -0
  25. package/dist/components/Chart/engine/SpatialMap.js +270 -0
  26. package/dist/components/Chart/engine/index.d.ts +13 -0
  27. package/dist/components/Chart/engine/index.js +9 -0
  28. package/dist/components/Chart/engine/types.d.ts +137 -0
  29. package/dist/components/Chart/engine/types.js +47 -0
  30. package/dist/components/Chart/hooks/useEngine.d.ts +43 -0
  31. package/dist/components/Chart/hooks/useEngine.js +128 -0
  32. package/dist/components/Chart/sensors/DataHoverSensor/DataHoverSensor.d.ts +17 -19
  33. package/dist/components/Chart/sensors/DataHoverSensor/DataHoverSensor.js +38 -51
  34. package/dist/components/Chart/sensors/DragSensor/DragSensor.d.ts +38 -0
  35. package/dist/components/Chart/sensors/DragSensor/DragSensor.js +105 -0
  36. package/dist/components/Chart/sensors/DragSensor/index.d.ts +2 -0
  37. package/dist/components/Chart/sensors/DragSensor/index.js +1 -0
  38. package/dist/components/Chart/sensors/{KeyboardSensor.d.ts → KeyboardSensor/KeyboardSensor.d.ts} +1 -1
  39. package/dist/components/Chart/sensors/KeyboardSensor/KeyboardSensor.js +86 -0
  40. package/dist/components/Chart/sensors/KeyboardSensor/index.d.ts +1 -0
  41. package/dist/components/Chart/sensors/KeyboardSensor/index.js +1 -0
  42. package/dist/components/Chart/sensors/{SelectionSensor.d.ts → SelectionSensor/SelectionSensor.d.ts} +2 -2
  43. package/dist/components/Chart/sensors/SelectionSensor/SelectionSensor.js +39 -0
  44. package/dist/components/Chart/sensors/SelectionSensor/index.d.ts +1 -0
  45. package/dist/components/Chart/sensors/SelectionSensor/index.js +1 -0
  46. package/dist/components/Chart/sensors/SensorManager/SensorManager.js +36 -41
  47. package/dist/components/Chart/sensors/index.d.ts +1 -0
  48. package/dist/components/Chart/sensors/index.js +3 -2
  49. package/dist/components/Chart/sensors/utils/search.d.ts +1 -1
  50. package/dist/components/Chart/sensors/utils/search.js +25 -4
  51. package/dist/components/Chart/state/store/chart.store.js +18 -0
  52. package/dist/components/Chart/state/store/slices/series.slice.d.ts +1 -0
  53. package/dist/components/Chart/state/store/slices/series.slice.js +3 -2
  54. package/dist/components/Chart/subcomponents/Axis/Axis.module.css +32 -33
  55. package/dist/components/Chart/subcomponents/BarSeries/BarSeries.js +6 -1
  56. package/dist/components/Chart/subcomponents/BarSeries/BarSeries.module.css +11 -9
  57. package/dist/components/Chart/subcomponents/Cursor/Cursor.js +8 -1
  58. package/dist/components/Chart/subcomponents/Cursor/Cursor.module.css +14 -13
  59. package/dist/components/Chart/subcomponents/CustomSeries/CustomSeries.js +4 -0
  60. package/dist/components/Chart/subcomponents/CustomSeries/CustomSeries.module.css +5 -3
  61. package/dist/components/Chart/subcomponents/Footer/Footer.module.css +5 -3
  62. package/dist/components/Chart/subcomponents/Grid/Grid.module.css +12 -11
  63. package/dist/components/Chart/subcomponents/Header/Header.module.css +8 -7
  64. package/dist/components/Chart/subcomponents/InteractionLayer/InteractionLayer.d.ts +4 -4
  65. package/dist/components/Chart/subcomponents/InteractionLayer/InteractionLayer.js +39 -76
  66. package/dist/components/Chart/subcomponents/Legend/Legend.module.css +30 -32
  67. package/dist/components/Chart/subcomponents/LineSeries/LineSeries.js +9 -3
  68. package/dist/components/Chart/subcomponents/LineSeries/LineSeries.module.css +21 -21
  69. package/dist/components/Chart/subcomponents/Root/Root.js +113 -7
  70. package/dist/components/Chart/subcomponents/Root/Root.module.css +70 -82
  71. package/dist/components/Chart/subcomponents/ScatterSeries/ScatterSeries.js +6 -1
  72. package/dist/components/Chart/subcomponents/ScatterSeries/ScatterSeries.module.css +7 -5
  73. package/dist/components/Chart/subcomponents/Series/Series.module.css +118 -128
  74. package/dist/components/Chart/subcomponents/SeriesPoint/SeriesPoint.module.css +10 -8
  75. package/dist/components/Chart/subcomponents/Tooltip/Tooltip.js +2 -3
  76. package/dist/components/Chart/subcomponents/Tooltip/Tooltip.module.css +52 -67
  77. package/dist/components/Chart/types/context.d.ts +9 -0
  78. package/dist/components/Chart/types/events.d.ts +5 -7
  79. package/dist/components/Chart/types/interaction.d.ts +24 -2
  80. package/dist/components/Chart/types/interaction.js +1 -0
  81. package/dist/components/Checkbox/Checkbox.module.css +57 -59
  82. package/dist/components/Chip/Chip.module.css +105 -115
  83. package/dist/components/Combobox/Combobox.d.ts +2 -1
  84. package/dist/components/Combobox/Combobox.js +2 -2
  85. package/dist/components/Combobox/Combobox.module.css +233 -210
  86. package/dist/components/CopyButton/CopyButton.module.css +84 -90
  87. package/dist/components/Drawer/Drawer.module.css +126 -145
  88. package/dist/components/Dropdown/Dropdown.d.ts +3 -1
  89. package/dist/components/Dropdown/Dropdown.js +3 -3
  90. package/dist/components/Dropdown/Dropdown.module.css +52 -32
  91. package/dist/components/FileUpload/FileUpload.js +24 -0
  92. package/dist/components/FileUpload/FileUpload.module.css +295 -313
  93. package/dist/components/Form/Form.module.css +35 -39
  94. package/dist/components/Image/Image.module.css +53 -54
  95. package/dist/components/Input/Input.d.ts +4 -2
  96. package/dist/components/Input/Input.js +2 -2
  97. package/dist/components/Input/Input.module.css +135 -119
  98. package/dist/components/Label/Label.module.css +17 -15
  99. package/dist/components/Layout/Layout.module.css +95 -111
  100. package/dist/components/Link/Link.module.css +67 -65
  101. package/dist/components/Modal/Modal.module.css +112 -132
  102. package/dist/components/Page/Page.module.css +21 -21
  103. package/dist/components/Pagination/Pagination.module.css +56 -56
  104. package/dist/components/Popover/Popover.module.css +17 -16
  105. package/dist/components/ProgressBar/ProgressBar.module.css +36 -37
  106. package/dist/components/RadioGroup/RadioGroup.module.css +74 -77
  107. package/dist/components/Select/Select.d.ts +2 -1
  108. package/dist/components/Select/Select.js +2 -2
  109. package/dist/components/Select/Select.module.css +133 -98
  110. package/dist/components/Sheet/Sheet.module.css +134 -154
  111. package/dist/components/Sidebar/Sidebar.module.css +72 -74
  112. package/dist/components/Sidebar/subcomponents/Footer/Footer.module.css +7 -5
  113. package/dist/components/Sidebar/subcomponents/Group/Group.module.css +80 -85
  114. package/dist/components/Sidebar/subcomponents/Header/Header.module.css +12 -10
  115. package/dist/components/Sidebar/subcomponents/Item/Item.module.css +54 -55
  116. package/dist/components/Sidebar/subcomponents/MobileOverlay/MobileOverlay.module.css +38 -38
  117. package/dist/components/Sidebar/subcomponents/MobileTrigger/MobileTrigger.module.css +5 -3
  118. package/dist/components/Sidebar/subcomponents/Nav/Nav.module.css +13 -11
  119. package/dist/components/Sidebar/subcomponents/Rail/Rail.module.css +62 -63
  120. package/dist/components/Sidebar/subcomponents/Section/Section.module.css +86 -91
  121. package/dist/components/Skeleton/Skeleton.module.css +28 -26
  122. package/dist/components/Slat/Slat.module.css +93 -94
  123. package/dist/components/Slider/Slider.module.css +116 -121
  124. package/dist/components/Spinner/Spinner.module.css +28 -27
  125. package/dist/components/SplitButton/SplitButton.d.ts +3 -1
  126. package/dist/components/SplitButton/SplitButton.js +2 -2
  127. package/dist/components/SplitButton/SplitButton.module.css +104 -87
  128. package/dist/components/Switch/Switch.module.css +64 -63
  129. package/dist/components/Table/FilterBuilder/FilterBuilder.module.css +36 -36
  130. package/dist/components/Table/FilterBuilder/FilterConditionRow.js +1 -1
  131. package/dist/components/Table/FilterBuilder/FilterConditionRow.module.css +21 -22
  132. package/dist/components/Table/FilterBuilder/FilterGroup.js +4 -4
  133. package/dist/components/Table/FilterBuilder/FilterGroup.module.css +355 -389
  134. package/dist/components/Table/FilterBuilder/FilterSheet.module.css +68 -71
  135. package/dist/components/Table/Table.d.ts +4 -2
  136. package/dist/components/Table/Table.js +50 -13
  137. package/dist/components/Table/Table.module.css +210 -188
  138. package/dist/components/Table/TableHeaderFilter.js +1 -1
  139. package/dist/components/Table/TableHeaderFilter.module.css +51 -57
  140. package/dist/components/Tabs/Tabs.module.css +79 -80
  141. package/dist/components/Text/Text.module.css +108 -131
  142. package/dist/components/Textarea/Textarea.d.ts +3 -1
  143. package/dist/components/Textarea/Textarea.js +2 -2
  144. package/dist/components/Textarea/Textarea.module.css +114 -94
  145. package/dist/components/Toast/Toast.module.css +82 -82
  146. package/dist/components/Tooltip/Tooltip.module.css +17 -16
  147. package/dist/styles/globals.css +1677 -1691
  148. package/dist/styles/palettes.d.ts +0 -5
  149. package/dist/styles/palettes.js +0 -8
  150. package/dist/styles/themes/definitions.d.ts +0 -8
  151. package/dist/styles/themes/definitions.js +117 -5
  152. package/dist/styles/types.d.ts +2 -0
  153. package/dist/styles/types.js +1 -0
  154. package/dist/tsconfig.build.tsbuildinfo +1 -1
  155. package/package.json +4 -4
  156. package/.agent/skills/doom/a2ui/a2ui-examples.md +0 -289
  157. package/.agent/skills/doom/a2ui/a2ui-principles.md +0 -49
  158. package/.agent/skills/doom/a2ui/a2ui-protocol.md +0 -191
  159. package/.agent/skills/doom/components/a2ui.md +0 -46
  160. package/.agent/skills/doom/components/accordion.md +0 -44
  161. package/.agent/skills/doom/components/actionrow.md +0 -33
  162. package/.agent/skills/doom/components/alert.md +0 -35
  163. package/.agent/skills/doom/components/avatar.md +0 -36
  164. package/.agent/skills/doom/components/badge.md +0 -29
  165. package/.agent/skills/doom/components/breadcrumbs.md +0 -33
  166. package/.agent/skills/doom/components/button.md +0 -43
  167. package/.agent/skills/doom/components/card.md +0 -41
  168. package/.agent/skills/doom/components/chart.md +0 -106
  169. package/.agent/skills/doom/components/checkbox.md +0 -38
  170. package/.agent/skills/doom/components/chip.md +0 -35
  171. package/.agent/skills/doom/components/combobox.md +0 -50
  172. package/.agent/skills/doom/components/copybutton.md +0 -41
  173. package/.agent/skills/doom/components/drawer.md +0 -69
  174. package/.agent/skills/doom/components/dropdown.md +0 -33
  175. package/.agent/skills/doom/components/fileupload.md +0 -49
  176. package/.agent/skills/doom/components/form.md +0 -55
  177. package/.agent/skills/doom/components/icon.md +0 -47
  178. package/.agent/skills/doom/components/image.md +0 -48
  179. package/.agent/skills/doom/components/input.md +0 -54
  180. package/.agent/skills/doom/components/label.md +0 -32
  181. package/.agent/skills/doom/components/layout.md +0 -92
  182. package/.agent/skills/doom/components/link.md +0 -39
  183. package/.agent/skills/doom/components/modal.md +0 -71
  184. package/.agent/skills/doom/components/page.md +0 -41
  185. package/.agent/skills/doom/components/pagination.md +0 -32
  186. package/.agent/skills/doom/components/popover.md +0 -45
  187. package/.agent/skills/doom/components/progressbar.md +0 -37
  188. package/.agent/skills/doom/components/radiogroup.md +0 -45
  189. package/.agent/skills/doom/components/select.md +0 -43
  190. package/.agent/skills/doom/components/sheet.md +0 -71
  191. package/.agent/skills/doom/components/sidebar.md +0 -92
  192. package/.agent/skills/doom/components/skeleton.md +0 -35
  193. package/.agent/skills/doom/components/slat.md +0 -46
  194. package/.agent/skills/doom/components/slider.md +0 -51
  195. package/.agent/skills/doom/components/spinner.md +0 -34
  196. package/.agent/skills/doom/components/splitbutton.md +0 -35
  197. package/.agent/skills/doom/components/switch.md +0 -40
  198. package/.agent/skills/doom/components/table.md +0 -82
  199. package/.agent/skills/doom/components/tabs.md +0 -65
  200. package/.agent/skills/doom/components/text.md +0 -42
  201. package/.agent/skills/doom/components/textarea.md +0 -46
  202. package/.agent/skills/doom/components/toast.md +0 -59
  203. package/.agent/skills/doom/components/tooltip.md +0 -35
  204. package/.agent/skills/doom/index.md +0 -167
  205. package/.agent/skills/doom/styles/aesthetic.md +0 -151
  206. package/.agent/skills/doom/styles/css-variables.md +0 -80
  207. package/.agent/skills/doom/styles/mixins.md +0 -97
  208. package/.agent/skills/doom/styles/tokens.md +0 -129
  209. package/.agent/skills/doom/styles/utilities.md +0 -84
  210. package/dist/components/Chart/sensors/KeyboardSensor.js +0 -82
  211. package/dist/components/Chart/sensors/SelectionSensor.js +0 -41
@@ -0,0 +1 @@
1
+ export * from "./SelectionSensor.js";
@@ -1,11 +1,10 @@
1
1
  "use client";
2
- import { useEffect, useMemo } from "react";
2
+ import { useEffect, useMemo, useRef } from "react";
3
3
  import { useChartContext } from "../../context.js";
4
- import { useEventContext } from "../../state/EventContext.js";
5
4
  import { removeInteraction, upsertInteraction, } from "../../state/store/chart.store.js";
6
5
  import { InteractionChannel } from "../../types/interaction.js";
7
6
  import { DataHoverSensor } from "../DataHoverSensor/DataHoverSensor.js";
8
- import { KeyboardSensor } from "../KeyboardSensor.js";
7
+ import { KeyboardSensor } from "../KeyboardSensor/index.js";
9
8
  /**
10
9
  * The SensorManager is a headless component that manages the lifecycle of
11
10
  * Chart Sensors. It coordinates event listeners, identifies default sensors
@@ -13,25 +12,25 @@ import { KeyboardSensor } from "../KeyboardSensor.js";
13
12
  * to the interaction store.
14
13
  */
15
14
  export const SensorManager = ({ sensors }) => {
16
- const { chartStore, config, colorPalette } = useChartContext();
17
- const eventContext = useEventContext();
18
- // Subscribe to status and data for lifecycle protection
15
+ const { chartStore, config, colorPalette, engine } = useChartContext();
19
16
  const status = chartStore.useStore((s) => s.status);
20
17
  const data = chartStore.useStore((s) => s.data);
18
+ // Use a ref to access the latest colorPalette without triggering re-instantiation
19
+ const colorPaletteRef = useRef(colorPalette);
20
+ useEffect(() => {
21
+ colorPaletteRef.current = colorPalette;
22
+ }, [colorPalette]);
21
23
  const activeSensors = useMemo(() => {
22
24
  if (sensors && sensors.length > 0) {
23
25
  return sensors;
24
26
  }
25
- // Default injection
26
27
  const defaults = [];
27
28
  const type = config.type || "line";
28
29
  if (["line", "area", "bar", "scatter", "bubble"].includes(type)) {
29
- const mode = type === "scatter" || type === "bubble"
30
- ? "closest"
31
- : "nearest-x";
30
+ const isVerticalSliceType = ["line", "area", "bar"].includes(type);
32
31
  defaults.push(DataHoverSensor({
33
- mode,
34
32
  name: InteractionChannel.PRIMARY_HOVER,
33
+ verticalSlice: isVerticalSliceType,
35
34
  }));
36
35
  // A11y: Always include keyboard sensor for line/bar/scatter
37
36
  defaults.push(KeyboardSensor({
@@ -40,47 +39,43 @@ export const SensorManager = ({ sensors }) => {
40
39
  }
41
40
  else {
42
41
  defaults.push(DataHoverSensor({
43
- mode: "exact",
44
42
  name: InteractionChannel.PRIMARY_HOVER,
45
43
  }));
46
44
  }
47
45
  return defaults;
48
46
  }, [sensors, config.type]);
49
47
  useEffect(() => {
50
- // PROTECT: Only instantiate sensors when the chart is READY.
51
- if (status !== "ready" || !data.length) {
48
+ if (status !== "ready" || !data.length || !engine) {
52
49
  return;
53
50
  }
54
- // Instantiate sensors
55
- const cleanups = activeSensors.map((sensor) => {
56
- return sensor({
57
- on: eventContext.on,
58
- off: eventContext.off,
59
- emit: eventContext.emit,
60
- pointerPosition: eventContext.pointerPosition,
61
- isWithinPlot: eventContext.isWithinPlot,
62
- getChartContext: () => {
63
- const state = chartStore.getState();
64
- return Object.assign(Object.assign({}, state), { xScale: state.scales.x, yScale: state.scales.y, colorPalette: colorPalette || [], chartStore });
65
- },
66
- getInteraction: (name) => {
67
- return chartStore.getState().interactions.get(name) || null;
68
- },
69
- upsertInteraction: (name, value) => {
70
- upsertInteraction(chartStore, name, value);
71
- },
72
- removeInteraction: (name) => {
73
- removeInteraction(chartStore, name);
74
- },
51
+ const sensorContext = {
52
+ getChartContext: () => {
53
+ const state = chartStore.getState();
54
+ return Object.assign(Object.assign({}, state), { xScale: state.scales.x, yScale: state.scales.y, colorPalette: colorPaletteRef.current || [], chartStore });
55
+ },
56
+ getInteraction: (name) => {
57
+ return chartStore.getState().interactions.get(name) || null;
58
+ },
59
+ upsertInteraction: (name, value) => {
60
+ upsertInteraction(chartStore, name, value);
61
+ },
62
+ removeInteraction: (name) => {
63
+ removeInteraction(chartStore, name);
64
+ },
65
+ };
66
+ engine.setHandler((event) => {
67
+ activeSensors.forEach((sensor) => {
68
+ try {
69
+ sensor(event, sensorContext);
70
+ }
71
+ catch (err) {
72
+ console.error("Sensor Error:", err);
73
+ }
75
74
  });
76
75
  });
77
76
  return () => {
78
- cleanups.forEach((cleanup) => {
79
- if (typeof cleanup === "function") {
80
- cleanup();
81
- }
82
- });
77
+ engine.setHandler(() => { });
83
78
  };
84
- }, [activeSensors, eventContext, chartStore, status, data.length]);
79
+ }, [activeSensors, engine, chartStore, status, data.length]);
85
80
  return null;
86
81
  };
@@ -1,4 +1,5 @@
1
1
  export * from "./DataHoverSensor";
2
+ export * from "./DragSensor";
2
3
  export * from "./KeyboardSensor";
3
4
  export * from "./SelectionSensor";
4
5
  export * from "./SensorManager";
@@ -1,4 +1,5 @@
1
1
  export * from "./DataHoverSensor/index.js";
2
- export * from "./KeyboardSensor.js";
3
- export * from "./SelectionSensor.js";
2
+ export * from "./DragSensor/index.js";
3
+ export * from "./KeyboardSensor/index.js";
4
+ export * from "./SelectionSensor/index.js";
4
5
  export * from "./SensorManager/index.js";
@@ -12,4 +12,4 @@ export interface SearchResult {
12
12
  * Coordinated search logic to find target(s) across all registered series.
13
13
  * This is the "Engine" of the sensor architecture.
14
14
  */
15
- export declare const findClosestTargets: (event: ChartEvent, mode: HoverMode, state: State) => InteractionTarget[];
15
+ export declare const findClosestTargets: (event: ChartEvent, mode: HoverMode, state: State, radius?: number) => InteractionTarget[];
@@ -3,17 +3,38 @@ const INTERACTION_RADIUS = 50;
3
3
  * Coordinated search logic to find target(s) across all registered series.
4
4
  * This is the "Engine" of the sensor architecture.
5
5
  */
6
- export const findClosestTargets = (event, mode, state) => {
6
+ export const findClosestTargets = (event, mode, state, radius = INTERACTION_RADIUS) => {
7
+ var _a, _b, _c;
7
8
  const chartX = event.coordinates.chartX;
8
9
  const chartY = event.coordinates.chartY;
9
- // Exact target finding (DOM fallback) - Does NOT require global scales
10
+ // Exact target finding (DOM hit-test) - Uses elementFromPoint since
11
+ // events are captured at container level, not individual elements
10
12
  if (mode === "exact") {
11
- const domTarget = event.nativeEvent.target;
13
+ // First check if the event target itself has __data__ (direct click on element)
14
+ const directTarget = event.nativeEvent.target;
15
+ if (directTarget && directTarget.__data__) {
16
+ return [
17
+ {
18
+ data: directTarget.__data__,
19
+ coordinate: { x: chartX, y: chartY },
20
+ seriesColor: ((_b = (_a = directTarget).getAttribute) === null || _b === void 0 ? void 0 : _b.call(_a, "fill")) || undefined,
21
+ },
22
+ ];
23
+ }
24
+ // Use elementFromPoint to find what's under the cursor
25
+ // IMPORTANT: Use the event target's ownerDocument for correct context (handles iframes)
26
+ const pointerEvent = event.nativeEvent;
27
+ const { clientX, clientY } = pointerEvent;
28
+ // Get the correct document - if the event target is in an iframe,
29
+ // its ownerDocument will be the iframe's document
30
+ const targetDoc = (directTarget === null || directTarget === void 0 ? void 0 : directTarget.ownerDocument) || document;
31
+ const domTarget = targetDoc.elementFromPoint(clientX, clientY);
12
32
  if (domTarget && domTarget.__data__) {
13
33
  return [
14
34
  {
15
35
  data: domTarget.__data__,
16
36
  coordinate: { x: chartX, y: chartY },
37
+ seriesColor: ((_c = domTarget.getAttribute) === null || _c === void 0 ? void 0 : _c.call(domTarget, "fill")) || undefined,
17
38
  },
18
39
  ];
19
40
  }
@@ -31,7 +52,7 @@ export const findClosestTargets = (event, mode, state) => {
31
52
  if (!series.strategy) {
32
53
  return;
33
54
  }
34
- const result = series.strategy.find(chartX, chartY, INTERACTION_RADIUS, xScale, yScale);
55
+ const result = series.strategy.find(chartX, chartY, radius, xScale, yScale);
35
56
  if (result) {
36
57
  targets.push(result);
37
58
  }
@@ -64,11 +64,22 @@ export const updateChartState = (store, props) => {
64
64
  innerHeight });
65
65
  // Recalculate scales based on new data/type/dimensions
66
66
  const nextScales = calculateScales(data, nextDimensions, Object.assign(Object.assign({}, prev), { type: type || prev.type }));
67
+ // Re-hydrate series with new data
68
+ // This is critical for real-time updates (e.g. drag interactions)
69
+ // We must use the stored configs to re-create the series strategies with the fresh data
70
+ const nextSeries = new Map();
71
+ const currentConfigs = prev.seriesConfigs || new Map();
72
+ currentConfigs.forEach((configs, id) => {
73
+ const hydrated = configs.map((c, i) => hydrateSeries(c, (prev.processedSeries.length || 0) + i, data));
74
+ nextSeries.set(id, hydrated);
75
+ });
67
76
  return {
68
77
  data,
69
78
  type: type || prev.type,
70
79
  dimensions: nextDimensions,
71
80
  scales: nextScales,
81
+ series: nextSeries, // Update series map
82
+ processedSeries: combineSeries(nextSeries), // Update flattened series
72
83
  status: nextDimensions.width > 0 && nextDimensions.height > 0
73
84
  ? "ready"
74
85
  : "idle",
@@ -82,10 +93,14 @@ export const updateChartState = (store, props) => {
82
93
  export const registerSeries = (store, id, configs) => {
83
94
  store.setState((state) => {
84
95
  const nextSeries = new Map(state.series);
96
+ const nextConfigs = new Map(state.seriesConfigs); // Clone configs map
97
+ // Store raw configs for future re-hydration
98
+ nextConfigs.set(id, configs);
85
99
  const hydrated = configs.map((c, i) => hydrateSeries(c, (state.processedSeries.length || 0) + i, state.data));
86
100
  nextSeries.set(id, hydrated);
87
101
  return {
88
102
  series: nextSeries,
103
+ seriesConfigs: nextConfigs,
89
104
  processedSeries: combineSeries(nextSeries),
90
105
  };
91
106
  });
@@ -96,9 +111,12 @@ export const unregisterSeries = (store, id) => {
96
111
  return state;
97
112
  }
98
113
  const nextSeries = new Map(state.series);
114
+ const nextConfigs = new Map(state.seriesConfigs);
99
115
  nextSeries.delete(id);
116
+ nextConfigs.delete(id);
100
117
  return {
101
118
  series: nextSeries,
119
+ seriesConfigs: nextConfigs,
102
120
  processedSeries: combineSeries(nextSeries),
103
121
  };
104
122
  });
@@ -1,6 +1,7 @@
1
1
  import { Series } from "../../../types";
2
2
  export interface SeriesSlice {
3
3
  series: Map<string, Series[]>;
4
+ seriesConfigs: Map<string, any[]>;
4
5
  processedSeries: Series[];
5
6
  }
6
7
  export declare const getSeriesInitialState: () => SeriesSlice;
@@ -3,10 +3,12 @@ import { LinearStrategy } from "../../../sensors/utils/strategies/LinearStrategy
3
3
  import { QuadtreeStrategy } from "../../../sensors/utils/strategies/QuadtreeStrategy/index.js";
4
4
  export const getSeriesInitialState = () => ({
5
5
  series: new Map(),
6
+ seriesConfigs: new Map(),
6
7
  processedSeries: [],
7
8
  });
8
9
  const LEGEND_PALETTE = ["#2E93fA", "#66DA26", "#546E7A", "#E91E63", "#FF9800"];
9
10
  export const hydrateSeries = (props, index, defaultData) => {
11
+ const data = props.data || defaultData;
10
12
  const series = {
11
13
  id: props.id || `series-${index}`,
12
14
  label: props.label || `Series ${index + 1}`,
@@ -16,9 +18,8 @@ export const hydrateSeries = (props, index, defaultData) => {
16
18
  hideCursor: props.hideCursor,
17
19
  interactionMode: props.interactionMode,
18
20
  type: props.type,
21
+ data,
19
22
  };
20
- // --- Strategy Selection Heuristic ---
21
- const data = props.data || defaultData;
22
23
  if (!data || data.length === 0) {
23
24
  series.strategy = new LinearStrategy(series, []);
24
25
  return series;
@@ -1,34 +1,33 @@
1
- .axes {
2
- pointer-events: none;
3
- font-family: var(--font-montserrat); /* Keep this as it matches font-bold usually */
4
- font-size: var(--text-xs);
5
- }
6
- .axes :global(.domain) {
7
- stroke: var(--card-border);
8
- stroke-width: var(--border-width);
9
- }
10
- .axes :global(.domain).hideDomain {
11
- stroke: none;
12
- }
13
- .axes :global(.tick) line {
14
- stroke: var(--card-border);
15
- stroke-width: var(--border-width);
16
- opacity: 1;
17
- }
18
- .axes :global(.tick) text {
19
- fill: var(--foreground);
20
- font-family: inherit;
21
- font-weight: var(--font-bold);
22
- text-transform: uppercase;
23
- font-size: var(--text-xs);
24
- }
25
- .axes {
26
- /* This might be redundant if we target :global(.tick) text above, but keeping for safety if Axis.tsx uses .label */
27
- }
28
- .axes .label {
29
- fill: var(--foreground);
30
- font-size: var(--text-xs);
31
- font-weight: var(--font-bold);
32
- text-transform: uppercase;
33
- text-anchor: middle;
1
+ @layer doom.components {
2
+ .axes {
3
+ pointer-events: none;
4
+ font-family: var(--font-montserrat); /* Keep this as it matches font-bold usually */
5
+ font-size: var(--text-xs);
6
+ }
7
+ .axes :global(.domain) {
8
+ stroke: var(--card-border);
9
+ stroke-width: var(--surface-border-width);
10
+ }
11
+ .axes :global(.domain).hideDomain {
12
+ stroke: none;
13
+ }
14
+ .axes :global(.tick) line {
15
+ stroke: var(--card-border);
16
+ stroke-width: var(--surface-border-width);
17
+ opacity: 1;
18
+ }
19
+ .axes :global(.tick) text {
20
+ fill: var(--foreground);
21
+ font-family: inherit;
22
+ font-weight: var(--font-bold);
23
+ text-transform: uppercase;
24
+ font-size: var(--text-xs);
25
+ }
26
+ .axes .label {
27
+ fill: var(--foreground);
28
+ font-size: var(--text-xs);
29
+ font-weight: var(--font-bold);
30
+ text-transform: uppercase;
31
+ text-anchor: middle;
32
+ }
34
33
  }
@@ -2,6 +2,7 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import React, { useEffect, useId, useMemo } from "react";
4
4
  import { useChartContext } from "../../context.js";
5
+ import { CHART_DATA_ATTRS } from "../../engine/index.js";
5
6
  import { registerSeries, unregisterSeries, } from "../../state/store/chart.store.js";
6
7
  import { resolveAccessor } from "../../utils/accessors.js";
7
8
  import { createRoundedTopBarPath } from "../../utils/shapes.js";
@@ -24,6 +25,7 @@ const BarSeriesComponent = ({ data: localData, x: localX, y: localY, color, hide
24
25
  }
25
26
  registerSeries(chartStore, gradientId, [
26
27
  {
28
+ id: gradientId,
27
29
  label: label || "Bar Series",
28
30
  color: color || "var(--primary)",
29
31
  x: xAccessor,
@@ -86,7 +88,10 @@ const BarSeriesComponent = ({ data: localData, x: localX, y: localY, color, hide
86
88
  : `Bar: ${JSON.stringify(d)}`, "aria-roledescription": "bar", className: `${styles.bar} chart-bar`, d: createRoundedTopBarPath(finalX, yVal, w, h, BAR_RADIUS), role: "graphics-symbol", style: {
87
89
  fill: fillColor,
88
90
  pointerEvents: "all",
89
- } }, i));
91
+ }, [CHART_DATA_ATTRS.TYPE]: "bar",
92
+ [CHART_DATA_ATTRS.SERIES_ID]: gradientId,
93
+ [CHART_DATA_ATTRS.INDEX]: i,
94
+ [CHART_DATA_ATTRS.DRAGGABLE]: false }, i));
90
95
  }) }));
91
96
  };
92
97
  export const BarSeries = React.memo(BarSeriesComponent);
@@ -1,10 +1,12 @@
1
- .bar {
2
- fill: var(--primary);
3
- stroke: var(--card-border);
4
- stroke-width: var(--border-width);
5
- stroke-linejoin: round;
6
- transition: opacity 0.2s;
7
- }
8
- .bar:hover {
9
- filter: brightness(1.1);
1
+ @layer doom.components {
2
+ .bar {
3
+ fill: var(--primary);
4
+ stroke: var(--card-border);
5
+ stroke-width: var(--surface-border-width);
6
+ stroke-linejoin: round;
7
+ transition: opacity 0.2s;
8
+ }
9
+ .bar:hover {
10
+ filter: brightness(1.1);
11
+ }
10
12
  }
@@ -27,7 +27,14 @@ export function CursorLine() {
27
27
  // Use primary target or first target in list
28
28
  const target = (_b = (_a = hover === null || hover === void 0 ? void 0 : hover.targets) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : null;
29
29
  // Use pointer for fallback or if target is missing
30
- const point = target ? target.coordinate : ((_c = hover === null || hover === void 0 ? void 0 : hover.pointer) !== null && _c !== void 0 ? _c : null);
30
+ let point = target ? target.coordinate : ((_c = hover === null || hover === void 0 ? void 0 : hover.pointer) !== null && _c !== void 0 ? _c : null);
31
+ // Normalize point to plot-relative coordinates consistently
32
+ if (target && point) {
33
+ point = {
34
+ x: point.x - dimensions.margin.left,
35
+ y: point.y - dimensions.margin.top,
36
+ };
37
+ }
31
38
  if (!point) {
32
39
  return null;
33
40
  }
@@ -1,14 +1,15 @@
1
- .cursorLine {
2
- stroke: var(--muted-foreground);
3
- stroke-width: var(--border-width);
4
- stroke-dasharray: 4 4;
5
- opacity: 1;
6
- pointer-events: none;
7
- }
8
-
9
- .cursorPoint {
10
- fill: var(--primary);
11
- stroke: var(--border-strong);
12
- stroke-width: var(--border-width);
13
- pointer-events: none;
1
+ @layer doom.components {
2
+ .cursorLine {
3
+ stroke: var(--muted-foreground);
4
+ stroke-width: var(--surface-border-width);
5
+ stroke-dasharray: 4 4;
6
+ opacity: 1;
7
+ pointer-events: none;
8
+ }
9
+ .cursorPoint {
10
+ fill: var(--primary);
11
+ stroke: var(--border-strong);
12
+ stroke-width: var(--surface-border-width);
13
+ pointer-events: none;
14
+ }
14
15
  }
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { useEffect, useId, useRef } from "react";
3
3
  import { useChartContext } from "../../context.js";
4
+ import { CHART_DATA_ATTRS } from "../../engine/index.js";
4
5
  import { registerSeries, unregisterSeries, } from "../../state/store/chart.store.js";
5
6
  import { resolveAccessor } from "../../utils/accessors.js";
6
7
  import { d3 } from "../../utils/d3.js";
@@ -30,6 +31,7 @@ const CustomSeriesComponent = (props) => {
30
31
  hideCursor: true,
31
32
  interactionMode: "x",
32
33
  data,
34
+ id: seriesId,
33
35
  },
34
36
  ]);
35
37
  return () => {
@@ -74,6 +76,8 @@ const CustomSeriesComponent = (props) => {
74
76
  },
75
77
  config,
76
78
  resolveInteraction,
79
+ seriesId,
80
+ chartDataAttrs: CHART_DATA_ATTRS,
77
81
  });
78
82
  }, [
79
83
  render,
@@ -1,4 +1,6 @@
1
- .customSeries {
2
- /* Placeholder for custom series styles */
3
- pointer-events: none; /* Usually custom render handles its own events */
1
+ @layer doom.components {
2
+ .customSeries {
3
+ /* Placeholder for custom series styles */
4
+ pointer-events: none; /* Usually custom render handles its own events */
5
+ }
4
6
  }
@@ -1,4 +1,6 @@
1
- .footer {
2
- width: 100%;
3
- margin-top: var(--spacing-4);
1
+ @layer doom.components {
2
+ .footer {
3
+ width: 100%;
4
+ margin-top: var(--space-4);
5
+ }
4
6
  }
@@ -1,12 +1,13 @@
1
- .grid {
2
- pointer-events: none;
3
- }
4
- .grid :global(.tick) line,
5
- .grid line {
6
- stroke: var(--muted);
7
- stroke-opacity: 0.5;
8
- /* stroke-dasharray: 4 4; */ /* User's snippet didn't have dash on grid? Wait, snippet said .grid :global(.tick) line { ... }. D3 grids often use ticks. My Grid component manually renders lines though. Keeping solid as per snippet, but adding opacity. */
9
- }
10
- .grid path {
11
- display: none;
1
+ @layer doom.components {
2
+ .grid {
3
+ pointer-events: none;
4
+ }
5
+ .grid :global(.tick) line,
6
+ .grid line {
7
+ stroke: var(--muted);
8
+ stroke-opacity: 0.5;
9
+ }
10
+ .grid path {
11
+ display: none;
12
+ }
12
13
  }
@@ -1,8 +1,9 @@
1
- .header {
2
- padding-right: 0;
3
- }
4
-
5
- .subtitle {
6
- color: var(--muted-foreground);
7
- margin: 0;
1
+ @layer doom.components {
2
+ .header {
3
+ padding-right: 0;
4
+ }
5
+ .subtitle {
6
+ color: var(--muted-foreground);
7
+ margin: 0;
8
+ }
8
9
  }
@@ -3,11 +3,11 @@ import React from "react";
3
3
  * InteractionLayer
4
4
  *
5
5
  * The root-level driver that captures native DOM pointer events on the Chart Container
6
- * and broadcasts normalized chart events to the EventContext.
6
+ * and forwards them to the Engine as InputSignals.
7
7
  *
8
8
  * Features:
9
- * - RAF Throttling (60fps aligned)
10
- * - Coordinate Normalization (fixes margins, borders, padding)
11
- * - Keyboard Support (basic)
9
+ * - RAF Throttling (60fps aligned for moves)
10
+ * - Direct Engine integration (no EventContext)
11
+ * - Keyboard Support
12
12
  */
13
13
  export declare const InteractionLayer: React.FC;