Repository navigation
v0.177.0
Minor Changes
-
#1394
0ef322d9Thanks @tenphi! - New:toLegacyColor()— converts a color literal, most usefully theoklch(...)every color token resolves to, into a hex orrgba()string a third-party parser will actually accept.resolveTokenValue()hands back the token's computed value, and since Glaze that is alwaysoklch(...). A large class of consumers validates colors against "HEX,rgb(), orhsl()" and silently drops anything else: Stripe's Appearance API falls back to its own light theme,d3-color(so Vega) throws, mapbox-gl rejects even an#rrggbbaatail. Nothing warns, and a round trip through the DOM does not normalize it — Chrome serializesoklchback asoklch— so until now each consumer wrote its own regex plus the polar→cartesian→OKHSL→sRGB math, and its own alpha handling.toLegacyColor(resolveTokenValue("#purple")); // '#6b53e4' toLegacyColor("oklch(0.55 0.21 285 / 0.4)"); // 'rgba(107, 83, 228, 0.4)' toLegacyColor("oklch(0.55 0.21 285 / 0.4)", { alpha: "hex" }); // '#6b53e466'
An opaque color is always
#rrggbb;alphapicks the translucent form, since the acceptable one differs per consumer ('rgba', the default, is the widest;'hex'gives the#rrggbbaaVega and CSS prefer and mapbox-gl drops). It acceptsnullso it composes withresolveTokenValue()without a null check, and readsoklch(),okhsl(),okhst(),rgb(),hsl(), hex (3/4/6/8 digits) andtransparent, in either the slash or the legacy comma alpha syntax — including the components a hand-rolled regex misses: a negative hue, any angle unit, scientific notation, anonecomponent. An out-of-gamut chroma is clipped to the gamut boundary. A value whose meaning only exists inside a CSS engine —color-mix(), relative syntax (oklch(from …)), a barevar()— returnsfallback ?? nullrather than passing through, because handing it back unchanged is precisely what makes a consumer drop the color.The color-literal grammar behind it is now shared with the color fields' own parser rather than duplicated, so
ColorInput/ColorPickeradditionally acceptnonecomponents andrad/grad/turnhue units, and no longer read an angle where a plain number belongs.
Patch Changes
-
#1395
a5c284b5Thanks @tenphi! - Stop the published build from inliningprocess.env.NODE_ENV, which had leftisDevEnv()returningtruein every consumer and every environment.platform: 'browser'makes rolldown replace that read with the literalNODE_ENVof the machine that cut the release, sodistshipped"development" !== 'test' && "development" !== 'production'— a constant — and theNODE_ENV=testandNODE_ENV=productionopt-outs the function documents were unreachable.tsdown.config.tsnow defines the expression as itself, which wins over that injection and leaves the read in the output for the consumer's own bundler (webpack, Vite and Next all define it) or Node to resolve for the environment that is actually running.The visible symptom was
Layout: it flags a collapse by measuringoffsetHeight === 0from arequestAnimationFramecallback, and withisDevEnv()stuck attrueany productionLayoutthat ever measured zero — a hidden tab, a collapsed accordion, a container mid-animation, adisplay: noneancestor — swapped the app's subtree for a developer warning, with no way for a consumer to turn it off. The warning is now overlaid on the content instead of substituted for it, sochildrenstay mounted and keep their state even when the diagnostic is shown and even when it is wrong; a zero-height measurement is not proof of a mistake, and unmounting on a wrong guess turns a diagnostic into an outage. This also unbreaks jsdom specs: jsdom reportsoffsetHeight: 0for everything, so every test rendering aLayoutlost the component under test two frames after mount, andNODE_ENV=testnow switches the warning off as intended rather than needing anoffsetHeightstub in the test setup.NODE_ENVis read in exactly one place now, guarded so that a bundle which never substituted it cannot turn a bareprocessreference into aReferenceError; when nothing can say what the environment is, diagnostics stay off, since one shown to an end user is worse than one missed by a developer. TheUIKIT_DEBUGlocalStorage flag became an escape hatch in both directions —"true"forces ui-kit's diagnostics on anywhere, and"false"forces them off, so a consumer whose build reportsdevelopmentcan silence them without waiting for a release. Diagnostics split by whether a test run should hear them: deprecation warnings still fire underNODE_ENV=test, while anything keyed off a measurement does not, because jsdom has no layout to measure.