chore: version packages#51
Merged
Merged
Conversation
9bf0896 to
bcbd158
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
@tenphi/glaze@0.10.0
Minor Changes
#50
6e2d42dThanks @tenphi! - Revampglaze.color()with a value-shorthand overload, seed-anchoredcontrast solving, a per-call lightness-scaling argument, and a
.css()export.
glaze.shadow()now accepts the same value forms asglaze.color().New defaults for
glaze.color()— split by input form so end-userstring values (color picker / theme settings) get a natural light/dark
inversion, while programmatic object / tuple / structured inputs keep
predictable linear behavior:
rgb(),hsl(),okhsl(),oklch()):mode: 'auto'with snapshotted scaling{ lightLightness: false, darkLightness: [globalConfig.darkLightness[0], 100] }.Light preserves the input exactly; dark Möbius-inverts up to
100,so
glaze.color('#000')renders as#fffin dark mode andglaze.color('#fff')falls to the darklofloor (default0.15).The dark
lois snapshotted fromglobalConfigat color-creationtime, matching how an explicit
scaling.darkLightness: [lo, hi]behaves.
{ h, s, l },[r, g, b]) andstructured form:
mode: 'fixed'with light preserved and darklinearly mapped into
globalConfig.darkLightness(default[15, 95]),also snapshotted at create time so later
glaze.configure()callsdon't retroactively change already-created tokens.
GlazeColorScaling:{ lightLightness?: false | [lo, hi]; darkLightness?: false | [lo, hi] }.falsedisables the remap, a tuple sets a custom window. To optstring inputs back into the previous fixed-linear default, pass
{ mode: 'fixed' }as the second arg or supply an explicitscaling.Behavior change (minor bump):
variant by default —
glaze.color('#000').resolve().dark.lis now≈ 1.0, not0.15. To preserve the old fixed-linear behavior pass{ mode: 'fixed' }as the second argument.modewill seeglaze.color({...}).resolve().light.lmatch the input lightnessexactly instead of being remapped to
globalConfig.lightLightness.To preserve the old behavior pass
{ lightLightness: globalConfig.lightLightness }as the secondargument.
inputs are now snapshotted from
globalConfig.darkLightnessatcolor-creation time, matching the existing behavior for string
inputs. Tokens created before a
glaze.configure()call no longerpick up the new dark window on their next
.resolve(). To get theold "live config" behavior, recreate the token after
configure().Value shorthand additions:
#rgb/#rrggbb/#rrggbbaa), the four CSS colorfunctions Glaze itself emits (
rgb(),hsl(),okhsl(),oklch()),OkhslColorobjects ({ h, s, l }), and[r, g, b](0–255) tuplesas the first argument. Every string emitted by
theme.tasty() / .json() / .css()round-trips back through
glaze.color().rgba()/hsla()/ slash-alpha alpha components areparsed and dropped with a
console.warn(standalone colors have noopacity field).
oklch()chroma now correctly interprets percent values per CSS Color 4(
100% → 0.4).OkhslColorand[r, g, b]inputs are validated up front with helpfulerror messages — passing 0–100-scale
s/lthrows with a hint to usethe structured form, and out-of-range RGB tuples throw with the offending
value in the message.
Anchor model: by default, relative
lightness: '+N'andcontrast: <ratio>are anchored to the literal seed (the value passedto
glaze.color()), so the contrast solver compares against theunmapped user-provided color across every variant. Pass
overrides.base(aGlazeColorToken) to anchor against anothercolor's resolved variant per scheme instead.
Color pairing via
base:GlazeColorOverrides.baselets onestandalone color depend on another. Accepts either a
GlazeColorTokenor any
GlazeColorValue(hex /rgb()/OkhslColor/[r, g, b]);raw values are auto-wrapped via
glaze.color(value)and inherit thesame string-vs-object defaults. When set:
contrastis solved per scheme against the base's resolved variant(light / dark / lightContrast / darkContrast).
lightness: '+N'/'-N'is anchored to the base'slightness per scheme (matches theme behavior for dependent colors).
hue: '+N'still anchors to the seed (the value passed toglaze.color()), not the base.modeis the per-pair knob — passmode: 'fixed'to disable Möbiusinversion for the dependent color,
mode: 'auto'to keep it.The base token's
.resolve()is called lazily on first resolve andthe result is captured by reference, matching existing snapshot
semantics. Internally,
resolveAllColorsaccepts pre-resolvedexternal bases and seeds them into the resolution context;
validateColorDefsandtopoSorttreat external base names as leaves.opacityandnameonglaze.color():GlazeColorOverrides.opacity(and the same field onGlazeColorInput) sets a fixed alpha 0–1 that surfaces in everyscheme variant. Combining with
contrastis not recommended (perceivedlightness becomes unpredictable) —
glazeemits aconsole.warninthat case.
GlazeColorOverrides.name(and the same field onGlazeColorInput)is a human-readable label that surfaces in error and warning messages
in place of the internal
"value"sentinel. Empty / whitespace-onlynames and reserved internal names (
"value","seed","externalBase") are rejected with a clear error.Structured form parity: the
glaze.color({...})overload nowaccepts
opacity,contrast,base, andnamein addition to theexisting
hue,saturation,lightness,saturationFactor, andmode.contrastwithoutbasesynthesizes a hidden static seedfrom the input's normal-mode lightness so the contrast solver always
has an anchor (mirrors value-form behavior).
hue(finite),saturation/lightness(0–100),saturationFactor(0–1), andopacity(0–1) are range-checked up front with helpful errormessages — non-finite or out-of-range values fail at creation rather
than producing a NaN-laden token.
Contrast warning: when the contrast solver cannot meet the
requested target (e.g. AAA against a mid-grey base — physically
unreachable),
glazeemits a singleconsole.warnper(name, scheme, target)triple naming the affected color, scheme, andthe actual achieved ratio. The token still resolves to the closest
passing variant. Use the
nameoverride to make the warning easier totrace.
Persisting standalone colors:
token.export()returns a JSON-safesnapshot containing the original
value(or structured input), theoverrides, and the captured
scaling. Token-typedbaseisrecursively serialized; value-typed
baseis preserved as the rawvalue. Pass the result to
glaze.colorFrom(data)to rehydrate a tokenthat resolves byte-for-byte identically to the original — across
glaze.configure()calls and across processes. The capturedscalingsnapshots both
lightLightnessanddarkLightnessfromglobalConfigat create time, so later
glaze.configure()calls don't retroactivelychange exported tokens regardless of input form.
.css({ name })export: new method on the standalone color tokenreaches export parity with
theme.css(). Existing.token() / .tasty() / .json()continue to work unchanged.glaze.shadow()upgrade:bgandfgnow accept anyGlazeColorValueform — hex,rgb()/hsl()/okhsl()/oklch()strings,
OkhslColorobjects, or[r, g, b]tuples — sharing the sameparser as
glaze.color().Internal: standalone color tokens now memoize the underlying resolve
across
.resolve() / .token() / .tasty() / .json() / .css()calls.Public type additions:
GlazeColorValue,GlazeColorOverrides,GlazeColorOverridesExport,GlazeColorCssOptions,GlazeColorScaling,GlazeColorTokenExport,GlazeColorInputExport.New
glaze.colorFrom(data)factory andtoken.export()method onGlazeColorToken. NewhslToSrgb,oklabToOkhsl, andparseHexAlphamath helpers re-exported from the package root.