Orbit Migration
Orbit 2.0
Orbit 2.0 removes unused exports and speculative convenience wrappers, and aligns error handling with monorepo conventions.
Removed APIs:
float()FloatHandlefloatWithAnchor()isCssAnchorSupported()compose()TypedMiddleware@vielzeug/orbit/ssrcreateFloatState()computePositionAsync()computePositionRaf()getRects()OrbitError.is()
Replace computePositionAsync() / computePositionRaf()
Use native deferral mechanisms directly.
// Before
const result = await computePositionAsync(reference, floating);// After
const result = await Promise.resolve().then(() => computePosition(reference, floating));For animation-frame-deferred computation:
// After
const result = await new Promise((resolve) =>
requestAnimationFrame(() => resolve(computePosition(reference, floating))),
);Replace OrbitError.is() with instanceof
The static type guard is removed. Use instanceof OrbitError to narrow unknown errors.
// Before
if (OrbitError.is(err)) {
// handle orbit error
}// After
if (err instanceof OrbitError) {
// handle orbit error
}getRects() removed from public exports
getRects() was an internal helper leaked to the public API. If you need raw rect measurements, call getBoundingClientRect() directly.
// Before
import { getRects } from '@vielzeug/orbit';
const { reference, floating } = getRects(ref, el);// After
const reference = ref.getBoundingClientRect();
const floating = el.getBoundingClientRect();Replace float()
Create a positioner, then start and dispose it with your UI owner.
// Before
const handle = float(trigger, tooltip, {
middleware: [offset(8), flip(), shift({ padding: 6 })],
placement: 'top',
});
handle.dispose();// After
const positioner = createPositioner(trigger, tooltip, {
middleware: [offset(8), flip(), shift({ padding: 6 })],
placement: 'top',
});
positioner.start();
positioner.dispose();Replace Middleware Composition
Build middleware arrays directly. computePosition() no longer filters falsy values or infers middleware data types.
// Before
const middleware = compose(offset(8), enabled && flip(), shift());// After
const middleware = [offset(8), ...(enabled ? [flip()] : []), shift()];Replace CSS Anchor Positioning
Use a standard client-owned positioner. Orbit no longer applies unsupported CSS anchor styles silently.
const positioner = createPositioner(trigger, panel, { placement: 'bottom' });
positioner.start();Remove SSR Alias
Orbit imports are server-safe. Invoke positioning only after client mount, when DOM elements exist.
onMounted(() => {
const positioner = createPositioner(trigger, panel);
positioner.start();
onCleanup(() => positioner.dispose());
});Replace Reactive Adapter
createReactivePositioner() replaces createFloatState().
const positioner = createReactivePositioner(trigger, tooltip);
const position = positioner.position.value;Install @vielzeug/ripple when importing @vielzeug/orbit/reactive.
Upgrade Checklist
- Replace
computePositionAsync()withPromise.resolve().then(() => computePosition(...)). - Replace
computePositionRaf()withrequestAnimationFrame(() => computePosition(...)). - Replace
OrbitError.is(err)witherr instanceof OrbitError. - Replace
getRects()imports with directgetBoundingClientRect()calls. - Replace every
float()handle with a startedcreatePositioner(). - Build conditional middleware arrays explicitly.
- Remove root aliases to
/ssr. - Move CSS anchor behavior to a standard positioner.
- Replace
createFloatState()withcreateReactivePositioner(). - Install Ripple for
/reactiveusage. - Update
@vielzeug/orbitto version 2.