@nswds/tokens 2.25.0 → 2.25.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.
Files changed (39) hide show
  1. package/dist/index.cjs +58 -3
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +8 -6
  4. package/dist/index.d.ts +8 -6
  5. package/dist/index.js +58 -3
  6. package/dist/index.js.map +1 -1
  7. package/dist/tailwind/colors/themes/fuchsia-blue/hex.css +59 -0
  8. package/dist/tailwind/colors/themes/fuchsia-blue/hsl.css +59 -0
  9. package/dist/tailwind/colors/themes/fuchsia-blue/oklch.css +59 -0
  10. package/dist/tailwind/colors/themes/fuchsia-blue/rgb.css +59 -0
  11. package/dist/tailwind/colors/themes/fuchsia-orange/hex.css +59 -0
  12. package/dist/tailwind/colors/themes/fuchsia-orange/hsl.css +59 -0
  13. package/dist/tailwind/colors/themes/fuchsia-orange/oklch.css +59 -0
  14. package/dist/tailwind/colors/themes/fuchsia-orange/rgb.css +59 -0
  15. package/dist/tokens/Primitives /342/200/224 global.light.json" +4868 -0
  16. package/dist/tokens/Primitives /342/200/224 semantic.light.json" +1074 -0
  17. package/dist/tokens/Themes /342/200/224 masterbrand.light.json" +806 -0
  18. package/dist/tokens/global/color/hex.json +1406 -0
  19. package/dist/tokens/global/color/hsl.json +4142 -0
  20. package/dist/tokens/global/color/oklch.json +4142 -0
  21. package/dist/tokens/global/color/rgb.json +4142 -0
  22. package/dist/tokens/semantic/color/hex.json +314 -0
  23. package/dist/tokens/semantic/color/hsl.json +618 -0
  24. package/dist/tokens/semantic/color/oklch.json +618 -0
  25. package/dist/tokens/semantic/color/rgb.json +618 -0
  26. package/dist/tokens/themes/color/masterbrand/hex.json +236 -0
  27. package/dist/tokens/themes/color/masterbrand/hsl.json +692 -0
  28. package/dist/tokens/themes/color/masterbrand/oklch.json +692 -0
  29. package/dist/tokens/themes/color/masterbrand/rgb.json +692 -0
  30. package/package.json +4 -3
  31. package/src/index.ts +88 -3
  32. package/src/tailwind/colors/themes/fuchsia-blue/hex.css +59 -0
  33. package/src/tailwind/colors/themes/fuchsia-blue/hsl.css +59 -0
  34. package/src/tailwind/colors/themes/fuchsia-blue/oklch.css +59 -0
  35. package/src/tailwind/colors/themes/fuchsia-blue/rgb.css +59 -0
  36. package/src/tailwind/colors/themes/fuchsia-orange/hex.css +59 -0
  37. package/src/tailwind/colors/themes/fuchsia-orange/hsl.css +59 -0
  38. package/src/tailwind/colors/themes/fuchsia-orange/oklch.css +59 -0
  39. package/src/tailwind/colors/themes/fuchsia-orange/rgb.css +59 -0
package/dist/index.cjs CHANGED
@@ -24112,13 +24112,68 @@ var globalColorHsl = require_hsl();
24112
24112
  var globalColorOklch = require_oklch();
24113
24113
  var globalColorRgb = require_rgb();
24114
24114
  var masterbrandColorHex = require_hex2();
24115
- var masterbrandColorHsl = require_hsl2();
24116
- var masterbrandColorOklch = require_oklch2();
24117
- var masterbrandColorRgb = require_rgb2();
24115
+ var rawMasterbrandColorHsl = require_hsl2();
24116
+ var rawMasterbrandColorOklch = require_oklch2();
24117
+ var rawMasterbrandColorRgb = require_rgb2();
24118
24118
  var semanticColorHex = require_hex3();
24119
24119
  var semanticColorHsl = require_hsl3();
24120
24120
  var semanticColorOklch = require_oklch3();
24121
24121
  var semanticColorRgb = require_rgb3();
24122
+ var ALIAS_PATTERN = /^\{([\w-]+(?:\.[\w-]+)*)\}$/;
24123
+ var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
24124
+ var clone = (value) => JSON.parse(JSON.stringify(value));
24125
+ var buildColorLookup = (palette) => {
24126
+ const lookup = {};
24127
+ const walk = (node, path) => {
24128
+ if ("$value" in node && isObject(node.$value) && "colorSpace" in node.$value) {
24129
+ lookup[path.join(".")] = node.$value;
24130
+ }
24131
+ for (const [key, value] of Object.entries(node)) {
24132
+ if (key === "$value" || key === "$type") continue;
24133
+ if (isObject(value)) {
24134
+ walk(value, [...path, key]);
24135
+ }
24136
+ }
24137
+ };
24138
+ for (const [key, value] of Object.entries(palette)) {
24139
+ if (isObject(value)) {
24140
+ walk(value, [key]);
24141
+ }
24142
+ }
24143
+ return lookup;
24144
+ };
24145
+ var rehydrateAliases = (palette, lookup) => {
24146
+ if (!isObject(palette)) {
24147
+ return palette;
24148
+ }
24149
+ const cloned = clone(palette);
24150
+ const walk = (node) => {
24151
+ if (typeof node.$value === "string") {
24152
+ const match = ALIAS_PATTERN.exec(node.$value);
24153
+ if (match) {
24154
+ const alias = match[1];
24155
+ const resolved = lookup[alias];
24156
+ if (resolved) {
24157
+ node.$value = clone(resolved);
24158
+ }
24159
+ }
24160
+ }
24161
+ for (const [key, value] of Object.entries(node)) {
24162
+ if (key === "$value" || key === "$type") continue;
24163
+ if (isObject(value)) {
24164
+ walk(value);
24165
+ }
24166
+ }
24167
+ };
24168
+ walk(cloned);
24169
+ return cloned;
24170
+ };
24171
+ var globalHslLookup = buildColorLookup(globalColorHsl);
24172
+ var globalOklchLookup = buildColorLookup(globalColorOklch);
24173
+ var globalRgbLookup = buildColorLookup(globalColorRgb);
24174
+ var masterbrandColorHsl = rehydrateAliases(rawMasterbrandColorHsl, globalHslLookup);
24175
+ var masterbrandColorOklch = rehydrateAliases(rawMasterbrandColorOklch, globalOklchLookup);
24176
+ var masterbrandColorRgb = rehydrateAliases(rawMasterbrandColorRgb, globalRgbLookup);
24122
24177
  var globalJsonHex = require_hex4();
24123
24178
  var globalJsonHsl = require_hsl4();
24124
24179
  var globalJsonOklch = require_oklch4();