|
1 | 1 | # @dschz/solid-uplot |
2 | 2 |
|
| 3 | +## 0.5.0 |
| 4 | + |
| 5 | +### Breaking Changes |
| 6 | + |
| 7 | +#### DOM Structure: Two-div layout |
| 8 | + |
| 9 | +The component now renders a **two-div structure** instead of a single div. A new inner |
| 10 | +`<div class="solid-uplot-chart">` wraps the uPlot canvas, separating it from the |
| 11 | +outer layout container. |
| 12 | + |
| 13 | +**Before (v0.4.0):** |
| 14 | + |
| 15 | +```html |
| 16 | +<div id="solid-uplot-root" class="solid-uplot" ref="{ref}"> |
| 17 | + <!-- children (legends, toolbars, etc.) --> |
| 18 | + <!-- uPlot canvas injected here, in the same container --> |
| 19 | +</div> |
| 20 | +``` |
| 21 | + |
| 22 | +**After (v0.5.0):** |
| 23 | + |
| 24 | +```html |
| 25 | +<div id="solid-uplot-root" class="solid-uplot" ref="{ref}"> |
| 26 | + <!-- children (legends, toolbars, etc.) --> |
| 27 | + <div class="solid-uplot-chart"> |
| 28 | + <!-- uPlot canvas injected here, in the inner container --> |
| 29 | + </div> |
| 30 | +</div> |
| 31 | +``` |
| 32 | + |
| 33 | +The `ref` prop continues to point to the component's root element. The inner |
| 34 | +`solid-uplot-chart` div is an implementation detail and should not be targeted |
| 35 | +directly. |
| 36 | + |
| 37 | +**Migration notes:** |
| 38 | + |
| 39 | +- CSS selectors targeting `.solid-uplot` still match the outer container. |
| 40 | + The new `.solid-uplot-chart` class is available for targeting the chart |
| 41 | + wrapper specifically, but is considered internal. |
| 42 | +- If you were relying on the root div having `position: relative`, note |
| 43 | + that this style now lives on the inner chart div. The root div's |
| 44 | + positioning is unset (controlled by your layout). |
| 45 | + |
| 46 | +#### `autoResize` behavioral change |
| 47 | + |
| 48 | +When `autoResize` is enabled, the `width` and `height` props are now **ignored**. |
| 49 | +The chart fills whatever space its container provides via flex layout instead of |
| 50 | +using the prop values as initial dimensions. |
| 51 | + |
| 52 | +The parent container **must** provide explicit dimensions (e.g., fixed height, |
| 53 | +flex/grid layout). If it does not, the chart renders at 0px height and logs a |
| 54 | +development-mode warning, rather than growing infinitely. |
| 55 | + |
| 56 | +| Scenario | v0.4.0 | v0.5.0 | |
| 57 | +| -------------------------------- | -------------------------- | ------------------------------ | |
| 58 | +| Constrained parent (has height) | Works correctly | Works correctly | |
| 59 | +| Flex/grid parent with height | Works correctly | Works correctly | |
| 60 | +| Unconstrained parent (no height) | **Infinite height growth** | 0px chart height + dev warning | |
| 61 | + |
| 62 | +### Bug Fixes |
| 63 | + |
| 64 | +#### Infinite height growth with `autoResize` |
| 65 | + |
| 66 | +Fixed a feedback loop where enabling `autoResize` in a container without explicit |
| 67 | +height constraints caused the chart to grow infinitely. The root cause was the |
| 68 | +single-div layout: the ResizeObserver reported the container size, uPlot resized |
| 69 | +its canvas to match, the canvas content pushed the container taller, and the cycle |
| 70 | +repeated. |
| 71 | + |
| 72 | +The fix introduces the two-div structure described above. The inner chart div uses |
| 73 | +`flex: 1 1 0` with `min-height: 0` and `min-width: 0`, ensuring its size is |
| 74 | +dictated by the parent layout rather than by the canvas content. This breaks the |
| 75 | +feedback loop entirely. |
| 76 | + |
| 77 | +#### Tooltip positioning in offset containers |
| 78 | + |
| 79 | +Fixed tooltip placement when the chart is not at the document origin (e.g., has |
| 80 | +margins, padding, or is nested in a layout). Previously, absolute-positioned |
| 81 | +tooltips calculated coordinates in document-absolute space using `window.scrollX/Y`, |
| 82 | +but were rendered inside a `position: relative` ancestor — causing a double-offset |
| 83 | +that displaced the tooltip from the cursor. |
| 84 | + |
| 85 | +Tooltips now compute container-relative coordinates by subtracting the root |
| 86 | +element's viewport position (`rootRect.left`/`rootRect.top`). Overflow detection |
| 87 | +was updated to use a `rootOffset` parameter instead of the previous `isFixed` |
| 88 | +boolean, correctly converting back to viewport coordinates for edge flipping. |
| 89 | + |
| 90 | +#### `focusSeries` implicit return fix |
| 91 | + |
| 92 | +Fixed a missing return value in the series focus target matching logic. The final |
| 93 | +`"index" in t` branch now correctly returns the comparison result instead of |
| 94 | +falling through as `undefined`. |
| 95 | + |
| 96 | +### Internal |
| 97 | + |
| 98 | +- **Monorepo migration**: The project was restructured from a flat single-package |
| 99 | + repository into a Bun workspaces monorepo (`packages/solid-uplot`, |
| 100 | + `apps/playground`, `apps/e2e`, `packages/tsconfig`). Published import paths |
| 101 | + are unchanged. |
| 102 | +- **E2E test suite**: Added Playwright-based end-to-end tests covering resize |
| 103 | + behavior (fixed, auto, manual), infinite growth regression, and tooltip |
| 104 | + positioning (absolute and fixed/dialog modes). |
| 105 | +- **Dev-mode warning**: When `autoResize` observes a 0px container height, a |
| 106 | + one-time console warning guides developers to provide explicit container |
| 107 | + dimensions. |
| 108 | +- **Playground refinements**: Updated the Resize and Children Placement pages to |
| 109 | + reflect the new `autoResize` semantics — removed outdated warnings about |
| 110 | + `autoResize` with children, added a Dashboard Layout page demonstrating the |
| 111 | + recommended flex-based resize pattern, and standardized the demo styling. |
| 112 | + |
3 | 113 | ## 0.4.0 |
4 | 114 |
|
5 | 115 | ### Minor Changes |
|
0 commit comments