@tenphi/glaze 0.16.0 → 0.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2286,7 +2286,7 @@ const formatters = {
2286
2286
  function fmt(value, decimals) {
2287
2287
  return parseFloat(value.toFixed(decimals)).toString();
2288
2288
  }
2289
- function formatVariant(v, format = "okhsl", pastel = false) {
2289
+ function formatVariant(v, format = "oklch", pastel = false) {
2290
2290
  const effectivePastel = v.pastel ?? pastel;
2291
2291
  let base;
2292
2292
  if (format === "okhst") base = formatOkhst(v.h, v.s * 100, v.t * 100, effectivePastel);
@@ -2325,16 +2325,16 @@ function resolveModes(override) {
2325
2325
  highContrast: override?.highContrast ?? cfg.modes.highContrast
2326
2326
  };
2327
2327
  }
2328
- function buildTokenMap(resolved, prefix, states, modes, format = "okhsl", pastel = false, channelCtx) {
2328
+ function buildTokenMap(resolved, prefix, states, modes, format = "oklch", pastel = false, channelCtx) {
2329
2329
  const tokens = {};
2330
2330
  const huePlans = channelCtx !== void 0 && format === "oklch" ? buildHuePlans(resolved, channelCtx) : void 0;
2331
2331
  if (huePlans !== void 0 && channelCtx !== void 0) {
2332
2332
  const emitDecls = channelCtx.emitDeclarations !== false;
2333
- if (emitDecls && channelCtx.mode === "theme") tokens[`#${channelCtx.baseName}-hue`] = { "": String(channelCtx.seedHue) };
2333
+ if (emitDecls && channelCtx.mode === "theme") tokens[`$${channelCtx.baseName}-hue`] = { "": String(channelCtx.seedHue) };
2334
2334
  for (const [name, color] of resolved) {
2335
2335
  const plan = huePlans.get(name);
2336
2336
  if (emitDecls) for (const decl of plan.declarations) {
2337
- const key = `#${decl.prop.slice(2)}`;
2337
+ const key = `$${decl.prop.slice(2)}`;
2338
2338
  if (!(key in tokens)) tokens[key] = { "": decl.value };
2339
2339
  }
2340
2340
  const colorKey = `#${prefix}${name}`;
@@ -2355,7 +2355,7 @@ function buildTokenEntry(color, states, modes, format, pastel, huePlan) {
2355
2355
  if (modes.dark && modes.highContrast) entry[`${states.dark} & ${states.highContrast}`] = formatColorValue(color.darkContrast, format, pastel, huePlan);
2356
2356
  return entry;
2357
2357
  }
2358
- function buildFlatTokenMap(resolved, prefix, modes, format = "okhsl", pastel = false) {
2358
+ function buildFlatTokenMap(resolved, prefix, modes, format = "oklch", pastel = false) {
2359
2359
  const result = { light: {} };
2360
2360
  if (modes.dark) result.dark = {};
2361
2361
  if (modes.highContrast) result.lightContrast = {};
@@ -2369,7 +2369,7 @@ function buildFlatTokenMap(resolved, prefix, modes, format = "okhsl", pastel = f
2369
2369
  }
2370
2370
  return result;
2371
2371
  }
2372
- function buildJsonMap(resolved, modes, format = "okhsl", pastel = false) {
2372
+ function buildJsonMap(resolved, modes, format = "oklch", pastel = false) {
2373
2373
  const result = {};
2374
2374
  for (const [name, color] of resolved) {
2375
2375
  const entry = { light: formatVariant(color.light, format, pastel) };
@@ -2967,7 +2967,7 @@ function createColorTokenFromDefs(seedHue, seedSaturation, defs, primary, effect
2967
2967
  };
2968
2968
  };
2969
2969
  const tokenLike = (options) => {
2970
- return buildTokenMap(resolveOnce(), "", resolveStates(options), resolveModes(options?.modes), options?.format, effectiveConfig.pastel)[`#${primary}`];
2970
+ return buildTokenMap(resolveOnce(), "", resolveStates(options), resolveModes(options?.modes), options?.format ?? "oklch", effectiveConfig.pastel)[`#${primary}`];
2971
2971
  };
2972
2972
  return {
2973
2973
  resolve() {
@@ -2981,7 +2981,7 @@ function createColorTokenFromDefs(seedHue, seedSaturation, defs, primary, effect
2981
2981
  return buildJsonMap(resolveOnce(), resolveModes(options?.modes), format, effectiveConfig.pastel)[primary];
2982
2982
  },
2983
2983
  css(options) {
2984
- const format = options.format ?? "rgb";
2984
+ const format = options.format ?? "oklch";
2985
2985
  assertNativeFormat(format, "css");
2986
2986
  const resolved = resolveOnce().get(primary);
2987
2987
  const renamed = new Map([[options.name, resolved]]);
@@ -3318,7 +3318,7 @@ function createPalette(themes, paletteOptions) {
3318
3318
  highContrast: options?.states?.highContrast ?? cfg.states.highContrast
3319
3319
  };
3320
3320
  const modes = resolveModes(options?.modes);
3321
- const format = options?.format ?? "okhsl";
3321
+ const format = options?.format ?? "oklch";
3322
3322
  return buildPaletteOutput(themes, paletteOptions, options, (filtered, prefix, pastel, themeName, theme) => {
3323
3323
  return buildTokenMap(filtered, prefix, states, modes, format, pastel, channelCtxForTheme(theme, themeName, prefix, resolvePrefix(options, themeName, true), options?.splitHue, format, modes, filtered));
3324
3324
  }, (acc, part) => Object.assign(acc, part), () => ({}));
@@ -3333,7 +3333,7 @@ function createPalette(themes, paletteOptions) {
3333
3333
  },
3334
3334
  css(options) {
3335
3335
  const suffix = options?.suffix ?? "-color";
3336
- const format = options?.format ?? "rgb";
3336
+ const format = options?.format ?? "oklch";
3337
3337
  assertNativeFormat(format, "css");
3338
3338
  const modes = resolveModes();
3339
3339
  const lines = buildPaletteOutput(themes, paletteOptions, options, (filtered, prefix, pastel, themeName, theme) => {
@@ -3500,8 +3500,8 @@ function createTheme(hue, saturation, initialColors, configOverride) {
3500
3500
  highContrast: options?.states?.highContrast ?? cfg.states.highContrast
3501
3501
  };
3502
3502
  const modes = resolveModes(options?.modes);
3503
- const format = options?.format ?? "okhsl";
3504
- const channelCtx = channelCtxFor(options, "okhsl", "");
3503
+ const format = options?.format ?? "oklch";
3504
+ const channelCtx = channelCtxFor(options, "oklch", "");
3505
3505
  return buildTokenMap(resolveCached(), "", states, modes, format, cfg.pastel, channelCtx);
3506
3506
  },
3507
3507
  json(options) {
@@ -3511,9 +3511,9 @@ function createTheme(hue, saturation, initialColors, configOverride) {
3511
3511
  return buildJsonMap(resolveCached(), modes, format, getEffectiveConfig().pastel);
3512
3512
  },
3513
3513
  css(options) {
3514
- const format = options?.format ?? "rgb";
3514
+ const format = options?.format ?? "oklch";
3515
3515
  assertNativeFormat(format, "css");
3516
- const channelCtx = channelCtxFor(options, "rgb", "");
3516
+ const channelCtx = channelCtxFor(options, "oklch", "");
3517
3517
  return buildCssMap(resolveCached(), "", options?.suffix ?? "-color", format, getEffectiveConfig().pastel, channelCtx);
3518
3518
  },
3519
3519
  dtcg(options) {