@entur/tokens 4.0.0-next.0 → 4.0.0

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.
@@ -1,5 +1,4 @@
1
1
  import hexRgb from "hex-rgb";
2
- import { unflatten } from "flat";
3
2
  const primitive = { "blue": { "_10": "#f6f6f9", "_100": "#292b6a", "_20": "#eaeaf1", "_30": "#d9dae8", "_40": "#bcbdd2", "_50": "#9ea0bd", "_60": "#8284ab", "_70": "#626493", "_80": "#54568c", "_90": "#393d79" }, "canary": { "_10": "#fffbeb", "_100": "#302403", "_20": "#fff4cd", "_30": "#ffeeb3", "_40": "#ffe082", "_50": "#ffda6b", "_60": "#ffca28", "_70": "#e9b10c", "_80": "#b38909", "_90": "#775b09" }, "coral": { "_10": "#ffe5e5", "_100": "#2e0505", "_20": "#ffcece", "_30": "#ff9494", "_40": "#ff5959", "_50": "#f73e3b", "_60": "#d31b1b", "_70": "#b31414", "_80": "#8a1414", "_90": "#5d0e0e" }, "ebony": { "_10": "#e5e5e9", "_100": "#08091c", "_15": "#d8d9df", "_20": "#cccdd4", "_25": "#bfc0c8", "_30": "#b3b4bd", "_35": "#a6a7b2", "_40": "#999aa7", "_45": "#8d8e9c", "_5": "#f2f2f5", "_50": "#81828f", "_55": "#757584", "_60": "#6a6b78", "_65": "#5e5f6c", "_70": "#525360", "_75": "#464755", "_80": "#393a49", "_85": "#2d2e3e", "_90": "#212233", "_95": "#141527" }, "grey": { "_10": "#f2f5f7", "_100": "#262729", "_110": "#101112", "_20": "#edf0f2", "_30": "#e3e6e8", "_40": "#cfd2d4", "_50": "#b6b8ba", "_60": "#949699", "_70": "#6e6f73", "_80": "#515254", "_90": "#3d3e40" }, "lavender": { "_10": "#f0f1fa", "_100": "#11143c", "_20": "#d9ddf2", "_30": "#c7cdeb", "_40": "#aeb7e2", "_50": "#8794d4", "_60": "#5a68c4", "_70": "#3b46ab", "_80": "#262f7d", "_90": "#181c56" }, "mint": { "_10": "#e6f6f0", "_100": "#022015", "_20": "#d0f1e3", "_30": "#9cd9c2", "_40": "#5ac39a", "_50": "#37ab83", "_60": "#1a8e60", "_70": "#068152", "_80": "#05613e", "_90": "#034029" }, "peach": { "_10": "#fff1eb", "_100": "#3a1503", "_20": "#ffe4d6", "_30": "#ffd3bd", "_40": "#ffbf9e", "_50": "#fd9a68", "_60": "#fd7835", "_70": "#e6560f", "_80": "#ae4009", "_90": "#742b06" }, "sky": { "_10": "#e1eff8", "_100": "#022231", "_20": "#acd7f1", "_30": "#64b3e7", "_40": "#2d98d2", "_50": "#067eb2", "_60": "#046690", "_70": "#044d6c", "_80": "#003852", "_90": "#022536" }, "transparent": { "blueAlpha10": "#9ea0bd1a", "blueAlpha40": "#54568c66", "canaryAlpha25": "#ffe08240", "canaryAlpha30": "#fff4cd4d", "coralAlpha20": "#ff949433", "ebonyAlpha15": "#e5e5e926", "ebonyAlpha20": "#cccdd44d", "ebonyAlpha25": "#e5e5e940", "ebonyAlpha35": "#e5e5e959", "lavenderAlpha70": "#aeb7e2b2", "mintAlpha20": "#5ac39a33", "neutralAlpha10": "#cfd2d41a", "neutralAlpha15": "#cfd2d426", "neutralAlpha20": "#26272933", "peachAlpha70": "#ffbf9eb2", "skyAlpha20": "#2d98d233" }, "white": { "alpha0": "#ffffff00", "alpha10": "#ffffff1a", "alpha100": "#ffffff", "alpha20": "#ffffff33", "alpha30": "#ffffff4d", "alpha40": "#ffffff66", "alpha50": "#ffffff80", "alpha60": "#ffffff99", "alpha70": "#ffffffb2", "alpha80": "#ffffffcc", "alpha90": "#ffffffe5" }, "size0": "0rem", "size1": "0.0625rem", "size2": "0.125rem", "size3": "0.25rem", "size4": "0.375rem", "size5": "0.5rem", "size6": "0.75rem", "size7": "0.875rem", "size8": "1rem", "size9": "1.25rem", "size10": "1.5rem", "size11": "1.75rem", "size12": "2rem", "size13": "2.25rem", "size14": "2.5rem", "size15": "2.75rem", "size16": "3rem", "size17": "3.25rem", "size18": "3.5rem", "size19": "4rem", "size20": "4.5rem", "size21": "5rem", "size22": "5.5rem", "size23": "6rem", "size24": "6.5rem", "size25": "7rem", "size26": "7.5rem", "size27": "8rem", "size28": "8.5rem", "size29": "9rem", "size30": "9.5rem", "size31": "10rem" };
4
3
  const semantic = { "fill": { "background": { "contrast": { "dark": "#212233", "light": "#181c56", "lightalt": "#393d79", "lightalt2": "#292b6a" }, "overlay": { "solid": "#393a49", "solidalt": "#464755", "transparent": "#e5e5e926", "transparentalt": "#e5e5e940", "transparentalt2": "#cccdd44d" }, "standard": { "colorless": "#ffffff00", "dark": "#08091c", "light": "#ffffff" }, "subdued": { "dark": "#2d2e3e", "light": "#d9dae8" }, "tint": { "dark": "#141527", "light": "#f6f6f9", "neutral": "#f2f5f7", "transparent": "#9ea0bd1a" } }, "boolean": { "false": { "contrast": "#9ea0bd", "dark": "#e5e5e959", "light": "#949699" }, "true": { "contrast": "#5ac39a", "dark": "#5ac39a", "light": "#1a8e60" } }, "disabled": { "light": "#cfd2d4", "transparent": "#cfd2d426", "transparentalt": "#cfd2d41a" }, "information": { "accent": "#022231", "contrast": "#64b3e7", "deep": "#067eb2", "muted": "#e1eff8", "tint": "#acd7f1" }, "negative": { "accent": "#2e0505", "contrast": "#ff5959", "dark": "#5d0e0e", "deep": "#d31b1b", "muted": "#ffcece", "tint": "#ff9494", "transparent": "#ff949433" }, "primary": { "active": { "contrast": "#8794d4", "light": "#11143c" }, "default": { "contrast": "#aeb7e2", "light": "#181c56" }, "hover": { "contrast": "#c7cdeb", "light": "#393d79" } }, "secondary": { "active": { "contrast": "#8794d4", "light": "#aeb7e2" }, "default": { "colorless": "#ffffff00" }, "hover": { "contrast": "#626493", "light": "#d9ddf2" } }, "selected": { "default": { "contrast": "#393d79", "dark": "#e5e5e9", "darkalt": "#81828f", "light": "#f6f6f9", "neutral": "#e3e6e8", "tint": "#eaeaf1", "darktint": "#525360" }, "hover": { "contrast": "#54568c", "dark": "#e5e5e959", "light": "#eaeaf1", "neutral": "#edf0f2", "tint": "#d9dae8", "darktint": "#5e5f6c" } }, "success": { "accent": "#022015", "contrast": "#5ac39a", "deep": "#1a8e60", "muted": "#d0f1e3", "subdued": "#37ab83", "tint": "#9cd9c2" }, "warning": { "accent": "#302403", "contrast": "#ffe082", "deep": "#ffca28", "muted": "#fff4cd", "tint": "#ffeeb3" } }, "shape": { "accent": "#181c56", "contrast": "#aeb7e2", "dark": "#08091c", "darkalt": "#b3b4bd", "disabled": "#515254", "highlight": "#ff5959", "highlightalt": "#ffbf9e", "inactive": "#bcbdd2", "information": "#067eb2", "informationalt": "#64b3e7", "informationalt2": "#acd7f1", "light": "#ffffff", "lightalt": "#e5e5e9", "negative": "#d31b1b", "negativealt": "#ff9494", "neutral": "#6e6f73", "neutralalt": "#b6b8ba", "neutralalt2": "#949699", "subdued": "#626493", "subduedalt": "#d9dae8", "success": "#1a8e60", "successalt": "#5ac39a", "successalt2": "#9cd9c2", "warning": "#ffca28", "warningalt": "#ffe082", "warningalt2": "#ffeeb3" }, "stroke": { "accent": "#181c56", "colorless": "#ffffff00", "contrast": "#aeb7e2", "contrastalt": "#54568c", "contrastalt2": "#11143c", "dark": "#b3b4bd", "darkalt": "#81828f", "darkalt2": "#08091c", "highlight": "#ff5959", "highlightalt": "#ffbf9e", "information": "#067eb2", "informationalt": "#acd7f1", "light": "#ffffff", "lightalt": "#e5e5e9", "negative": "#d31b1b", "negativealt": "#ff9494", "neutral": "#e3e6e8", "neutralalt": "#949699", "subdued": "#8284ab", "success": "#1a8e60", "successalt": "#5ac39a", "successalt2": "#9cd9c2", "transparent": "#54568c66", "transparentalt": "#aeb7e2b2", "warning": "#e9b10c", "warningalt": "#ffeeb3" }, "text": { "accent": "#181c56", "contrast": "#aeb7e2", "dark": "#08091c", "darkalt": "#b3b4bd", "disabled": "#515254", "highlight": "#ff5959", "highlightalt": "#ffbf9e", "light": "#ffffff", "lightalt": "#e5e5e9", "negative": "#d31b1b", "negativealt": "#ff9494", "neutral": "#6e6f73", "neutralalt": "#b6b8ba", "neutralalt2": "#949699", "subdued": "#626493", "subduedalt": "#d9dae8", "success": "#1a8e60", "successalt": "#5ac39a" } };
5
4
  const base = { "light": { "baseColors": { "frame": { "contrast": "#181c56", "contrastalt": "#393d79", "contrastalt2": "#292b6a", "default": "#ffffff", "elevated": "#ffffff", "elevatedalt": "#f6f6f9", "highlight": "#ff5959", "highlightalt": "#ffbf9e", "subdued": "#d9dae8", "tint": "#f6f6f9" }, "shape": { "accent": "#181c56", "bicycleContrast": "#00dbb6", "bicycleDefault": "#0d827e", "busContrast": "#ff6392", "busDefault": "#c5044e", "cablewayContrast": "#b482fb", "cablewayDefault": "#78469a", "disabled": "#6e6f73", "disabledalt": "#b6b8ba", "ferryContrast": "#6fdfff", "ferryDefault": "#0c6693", "funicularContrast": "#b482fb", "funicularDefault": "#78469a", "helicopterContrast": "#fbafea", "helicopterDefault": "#800664", "highlight": "#ff5959", "light": "#ffffff", "mask": "#ffffff", "maskalt": "#ffffff", "metroContrast": "#f08901", "metroDefault": "#bf5826", "mobilityContrast": "#00dbb6", "mobilityDefault": "#0d827e", "planeContrast": "#fbafea", "planeDefault": "#800664", "subdued": "#626493", "subduedalt": "#d9dae8", "taxiContrast": "#ffe082", "taxiDefault": "#3d3e40", "trainContrast": "#42a5f5", "trainDefault": "#00367f", "tramContrast": "#b482fb", "tramDefault": "#78469a", "walkContrast": "#9ea0bd", "walkDefault": "#8d8e9c", "airportlinkbusContrast": "#fbafea", "airportlinkbusDefault": "#800664", "airportlinkrailContrast": "#fbafea", "airportlinkrailDefault": "#800664" }, "stroke": { "contrast": "#aeb7e2", "default": "#181c56", "disabled": "#949699", "focusContrast": "#aeb7e2", "focusStandard": "#181c56", "highlight": "#ff5959", "highlight2": "#ffbf9e", "light": "#ffffff", "subdued": "#8284ab", "subduedalt": "#e3e6e8" }, "text": { "accent": "#181c56", "disabled": "#6e6f73", "disabledalt": "#b6b8ba", "highlight": "#ff5959", "highlightalt": "#ffbf9e", "light": "#ffffff", "subdued": "#626493", "subduedalt": "#d9dae8" } } }, "dark": { "baseColors": { "frame": { "contrast": "#212233", "contrastalt": "#141527", "contrastalt2": "#08091c", "default": "#08091c", "elevated": "#e5e5e926", "elevatedalt": "#464755", "highlight": "#ff5959", "highlightalt": "#ffbf9e", "subdued": "#2d2e3e", "tint": "#141527" }, "shape": { "accent": "#e5e5e9", "bicycleContrast": "#4db2a1", "bicycleDefault": "#4db2a1", "busContrast": "#ef7398", "busDefault": "#ef7398", "cablewayContrast": "#b898e5", "cablewayDefault": "#b898e5", "disabled": "#b6b8ba", "disabledalt": "#b3b4bd", "ferryContrast": "#8ccfe2", "ferryDefault": "#8ccfe2", "funicularContrast": "#b898e5", "funicularDefault": "#b898e5", "helicopterContrast": "#f2b8e5", "helicopterDefault": "#f2b8e5", "highlight": "#ff5959", "light": "#e5e5e9", "mask": "#2d2e3e", "maskalt": "#393a49", "metroContrast": "#dd973c", "metroDefault": "#dd973c", "mobilityContrast": "#4db2a1", "mobilityDefault": "#4db2a1", "planeContrast": "#f2b8e5", "planeDefault": "#f2b8e5", "subdued": "#b3b4bd", "subduedalt": "#b3b4bd", "taxiContrast": "#ffe082", "taxiDefault": "#ffe082", "trainContrast": "#60a2d7", "trainDefault": "#60a2d7", "tramContrast": "#b898e5", "tramDefault": "#b898e5", "walkContrast": "#8d8e9c", "walkDefault": "#8d8e9c", "airportlinkbusContrast": "#f2b8e5", "airportlinkbusDefault": "#f2b8e5", "airportlinkrailContrast": "#f2b8e5", "airportlinkrailDefault": "#f2b8e5" }, "stroke": { "contrast": "#aeb7e2", "default": "#b3b4bd", "disabled": "#e3e6e8", "focusContrast": "#aeb7e2", "focusStandard": "#aeb7e2", "highlight": "#ff5959", "highlight2": "#ffbf9e", "light": "#b3b4bd", "subdued": "#81828f", "subduedalt": "#949699" }, "text": { "accent": "#e5e5e9", "disabled": "#b6b8ba", "disabledalt": "#b6b8ba", "highlight": "#ff5959", "highlightalt": "#ffbf9e", "light": "#e5e5e9", "subdued": "#b3b4bd", "subduedalt": "#b3b4bd" } } } };
@@ -373,6 +372,125 @@ const outlineOffsets = {
373
372
  focus: pxToRem(outlineOffsetsConstants[0])
374
373
  }
375
374
  };
375
+ function getDefaultExportFromCjs(x) {
376
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
377
+ }
378
+ var flat$1;
379
+ var hasRequiredFlat;
380
+ function requireFlat() {
381
+ if (hasRequiredFlat) return flat$1;
382
+ hasRequiredFlat = 1;
383
+ flat$1 = flatten;
384
+ flatten.flatten = flatten;
385
+ flatten.unflatten = unflatten2;
386
+ function isBuffer(obj) {
387
+ return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
388
+ }
389
+ function keyIdentity(key) {
390
+ return key;
391
+ }
392
+ function flatten(target, opts) {
393
+ opts = opts || {};
394
+ const delimiter = opts.delimiter || ".";
395
+ const maxDepth = opts.maxDepth;
396
+ const transformKey = opts.transformKey || keyIdentity;
397
+ const output = {};
398
+ function step(object, prev, currentDepth) {
399
+ currentDepth = currentDepth || 1;
400
+ Object.keys(object).forEach(function(key) {
401
+ const value = object[key];
402
+ const isarray = opts.safe && Array.isArray(value);
403
+ const type = Object.prototype.toString.call(value);
404
+ const isbuffer = isBuffer(value);
405
+ const isobject = type === "[object Object]" || type === "[object Array]";
406
+ const newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);
407
+ if (!isarray && !isbuffer && isobject && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) {
408
+ return step(value, newKey, currentDepth + 1);
409
+ }
410
+ output[newKey] = value;
411
+ });
412
+ }
413
+ step(target);
414
+ return output;
415
+ }
416
+ function unflatten2(target, opts) {
417
+ opts = opts || {};
418
+ const delimiter = opts.delimiter || ".";
419
+ const overwrite = opts.overwrite || false;
420
+ const transformKey = opts.transformKey || keyIdentity;
421
+ const result = {};
422
+ const isbuffer = isBuffer(target);
423
+ if (isbuffer || Object.prototype.toString.call(target) !== "[object Object]") {
424
+ return target;
425
+ }
426
+ function getkey(key) {
427
+ const parsedKey = Number(key);
428
+ return isNaN(parsedKey) || key.indexOf(".") !== -1 || opts.object ? key : parsedKey;
429
+ }
430
+ function addKeys(keyPrefix, recipient, target2) {
431
+ return Object.keys(target2).reduce(function(result2, key) {
432
+ result2[keyPrefix + delimiter + key] = target2[key];
433
+ return result2;
434
+ }, recipient);
435
+ }
436
+ function isEmpty(val) {
437
+ const type = Object.prototype.toString.call(val);
438
+ const isArray = type === "[object Array]";
439
+ const isObject = type === "[object Object]";
440
+ if (!val) {
441
+ return true;
442
+ } else if (isArray) {
443
+ return !val.length;
444
+ } else if (isObject) {
445
+ return !Object.keys(val).length;
446
+ }
447
+ }
448
+ target = Object.keys(target).reduce(function(result2, key) {
449
+ const type = Object.prototype.toString.call(target[key]);
450
+ const isObject = type === "[object Object]" || type === "[object Array]";
451
+ if (!isObject || isEmpty(target[key])) {
452
+ result2[key] = target[key];
453
+ return result2;
454
+ } else {
455
+ return addKeys(
456
+ key,
457
+ result2,
458
+ flatten(target[key], opts)
459
+ );
460
+ }
461
+ }, {});
462
+ Object.keys(target).forEach(function(key) {
463
+ const split = key.split(delimiter).map(transformKey);
464
+ let key1 = getkey(split.shift());
465
+ let key2 = getkey(split[0]);
466
+ let recipient = result;
467
+ while (key2 !== void 0) {
468
+ if (key1 === "__proto__") {
469
+ return;
470
+ }
471
+ const type = Object.prototype.toString.call(recipient[key1]);
472
+ const isobject = type === "[object Object]" || type === "[object Array]";
473
+ if (!overwrite && !isobject && typeof recipient[key1] !== "undefined") {
474
+ return;
475
+ }
476
+ if (overwrite && !isobject || !overwrite && recipient[key1] == null) {
477
+ recipient[key1] = typeof key2 === "number" && !opts.object ? [] : {};
478
+ }
479
+ recipient = recipient[key1];
480
+ if (split.length > 0) {
481
+ key1 = getkey(split.shift());
482
+ key2 = getkey(split[0]);
483
+ }
484
+ }
485
+ recipient[key1] = unflatten2(target[key], opts);
486
+ });
487
+ return result;
488
+ }
489
+ return flat$1;
490
+ }
491
+ var flatExports = requireFlat();
492
+ const flat = /* @__PURE__ */ getDefaultExportFromCjs(flatExports);
493
+ const { unflatten } = flat;
376
494
  const SUPPORTED_COLOR_MODES = ["light", "dark"];
377
495
  function createVariableSet(fileData, valueType = "color") {
378
496
  const dataUnformatted = JSON.parse(fileData);
@@ -704,4 +822,4 @@ export {
704
822
  transport,
705
823
  zIndexes
706
824
  };
707
- //# sourceMappingURL=tokens.esm.js.map
825
+ //# sourceMappingURL=tokens.mjs.map