Files
zeekayandHanzo Dev 3ec2a50324 ui: the slider computes its own geometry, and nine radix packages leave with it
Slider was the last primitive in this layer whose behaviour radix actually
supplied — pointer drag, keyboard steps, thumb placement. All three are
arithmetic over one rectangle, and the rectangle is already in the document: the
track element carries the half-thumb inset at each end, so its own
getBoundingClientRect IS the usable span, and a pointer's value is
(clientX - rect.left) / rect.width. Nothing else needs measuring.

The pieces, in the order the file states them:
  - snap() rounds to the step grid measured from `min`, then trims the float dust
    the division leaves, so a formatter is handed 33.8 and not 33.800000000000004;
  - moveThumb() clamps each thumb between its neighbours, so a range cannot cross
    itself;
  - the drag captures the pointer and listens on the window, so a drag that
    leaves the element still moves the thumb it grabbed, and releases anywhere;
  - onChange fires continuously, onAfterChange only on pointerup/keyup — the
    split the two Duration filters and the onboarding sliders already depend on.

The thumb tooltip drops @radix-ui/react-tooltip too, because it never needed a
positioning engine: the thumb is already absolutely positioned at its own value,
so "above the thumb, centred" is two CSS declarations. A portal here would only
add a layer that has to be told where the thumb moved.

With that, nine packages have no consumer left and are out of package.json:
react-slot, react-checkbox, react-progress, react-radio-group, react-slider,
react-switch, react-tabs, react-toggle-group — and react-avatar, which had zero
imports in src the whole time.

Five remain, and they are one family: dialog, dropdown-menu, popover, select,
tooltip. Every one is a portalled layer that has to be positioned against an
anchor, dismissed on outside pointerdown and Escape, and (for the menus) focus-
managed. That is one shared primitive, not five conversions, and it is not a
change to make without seeing it render — see the next commit's note.

  pnpm build -> EXIT=0, built in 37.37s
  tsc --noEmit -> zero errors outside test files
  pnpm install -> removed 9 @radix-ui packages, Done in 26.4s

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-04 01:11:57 -07:00

19 lines
680 B
JavaScript

import { renderToStaticMarkup } from 'react-dom/server';
import React from 'react';
const ui = await import('@hanzo/ui');
const gui = await import('@hanzo/gui');
const { config } = await import('@hanzo/ui/gui-config');
console.log('--- NO PROVIDER ---');
try {
console.log(renderToStaticMarkup(React.createElement(ui.Button, null, 'Hi')).slice(0, 600));
} catch (e) { console.log('ERR', e.message); }
console.log('\n--- WITH PROVIDER ---');
try {
console.log(renderToStaticMarkup(
React.createElement(gui.GuiProvider, { config, defaultTheme: 'light' },
React.createElement(ui.Button, null, 'Hi'))
).slice(0, 900));
} catch (e) { console.log('ERR', e.message); }