@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.
- package/dist/{tokens.cjs.js → tokens.cjs} +121 -3
- package/dist/tokens.cjs.map +1 -0
- package/dist/{tokens.esm.js → tokens.mjs} +120 -2
- package/dist/tokens.mjs.map +1 -0
- package/package.json +38 -14
- package/dist/tokens.cjs.js.map +0 -1
- package/dist/tokens.esm.js.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const hexRgb = require("hex-rgb");
|
|
4
|
-
const flat = require("flat");
|
|
5
4
|
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" };
|
|
6
5
|
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" } };
|
|
7
6
|
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" } } } };
|
|
@@ -375,6 +374,125 @@ const outlineOffsets = {
|
|
|
375
374
|
focus: pxToRem(outlineOffsetsConstants[0])
|
|
376
375
|
}
|
|
377
376
|
};
|
|
377
|
+
function getDefaultExportFromCjs(x) {
|
|
378
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
379
|
+
}
|
|
380
|
+
var flat$1;
|
|
381
|
+
var hasRequiredFlat;
|
|
382
|
+
function requireFlat() {
|
|
383
|
+
if (hasRequiredFlat) return flat$1;
|
|
384
|
+
hasRequiredFlat = 1;
|
|
385
|
+
flat$1 = flatten;
|
|
386
|
+
flatten.flatten = flatten;
|
|
387
|
+
flatten.unflatten = unflatten2;
|
|
388
|
+
function isBuffer(obj) {
|
|
389
|
+
return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
|
|
390
|
+
}
|
|
391
|
+
function keyIdentity(key) {
|
|
392
|
+
return key;
|
|
393
|
+
}
|
|
394
|
+
function flatten(target, opts) {
|
|
395
|
+
opts = opts || {};
|
|
396
|
+
const delimiter = opts.delimiter || ".";
|
|
397
|
+
const maxDepth = opts.maxDepth;
|
|
398
|
+
const transformKey = opts.transformKey || keyIdentity;
|
|
399
|
+
const output = {};
|
|
400
|
+
function step(object, prev, currentDepth) {
|
|
401
|
+
currentDepth = currentDepth || 1;
|
|
402
|
+
Object.keys(object).forEach(function(key) {
|
|
403
|
+
const value = object[key];
|
|
404
|
+
const isarray = opts.safe && Array.isArray(value);
|
|
405
|
+
const type = Object.prototype.toString.call(value);
|
|
406
|
+
const isbuffer = isBuffer(value);
|
|
407
|
+
const isobject = type === "[object Object]" || type === "[object Array]";
|
|
408
|
+
const newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);
|
|
409
|
+
if (!isarray && !isbuffer && isobject && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) {
|
|
410
|
+
return step(value, newKey, currentDepth + 1);
|
|
411
|
+
}
|
|
412
|
+
output[newKey] = value;
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
step(target);
|
|
416
|
+
return output;
|
|
417
|
+
}
|
|
418
|
+
function unflatten2(target, opts) {
|
|
419
|
+
opts = opts || {};
|
|
420
|
+
const delimiter = opts.delimiter || ".";
|
|
421
|
+
const overwrite = opts.overwrite || false;
|
|
422
|
+
const transformKey = opts.transformKey || keyIdentity;
|
|
423
|
+
const result = {};
|
|
424
|
+
const isbuffer = isBuffer(target);
|
|
425
|
+
if (isbuffer || Object.prototype.toString.call(target) !== "[object Object]") {
|
|
426
|
+
return target;
|
|
427
|
+
}
|
|
428
|
+
function getkey(key) {
|
|
429
|
+
const parsedKey = Number(key);
|
|
430
|
+
return isNaN(parsedKey) || key.indexOf(".") !== -1 || opts.object ? key : parsedKey;
|
|
431
|
+
}
|
|
432
|
+
function addKeys(keyPrefix, recipient, target2) {
|
|
433
|
+
return Object.keys(target2).reduce(function(result2, key) {
|
|
434
|
+
result2[keyPrefix + delimiter + key] = target2[key];
|
|
435
|
+
return result2;
|
|
436
|
+
}, recipient);
|
|
437
|
+
}
|
|
438
|
+
function isEmpty(val) {
|
|
439
|
+
const type = Object.prototype.toString.call(val);
|
|
440
|
+
const isArray = type === "[object Array]";
|
|
441
|
+
const isObject = type === "[object Object]";
|
|
442
|
+
if (!val) {
|
|
443
|
+
return true;
|
|
444
|
+
} else if (isArray) {
|
|
445
|
+
return !val.length;
|
|
446
|
+
} else if (isObject) {
|
|
447
|
+
return !Object.keys(val).length;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
target = Object.keys(target).reduce(function(result2, key) {
|
|
451
|
+
const type = Object.prototype.toString.call(target[key]);
|
|
452
|
+
const isObject = type === "[object Object]" || type === "[object Array]";
|
|
453
|
+
if (!isObject || isEmpty(target[key])) {
|
|
454
|
+
result2[key] = target[key];
|
|
455
|
+
return result2;
|
|
456
|
+
} else {
|
|
457
|
+
return addKeys(
|
|
458
|
+
key,
|
|
459
|
+
result2,
|
|
460
|
+
flatten(target[key], opts)
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
}, {});
|
|
464
|
+
Object.keys(target).forEach(function(key) {
|
|
465
|
+
const split = key.split(delimiter).map(transformKey);
|
|
466
|
+
let key1 = getkey(split.shift());
|
|
467
|
+
let key2 = getkey(split[0]);
|
|
468
|
+
let recipient = result;
|
|
469
|
+
while (key2 !== void 0) {
|
|
470
|
+
if (key1 === "__proto__") {
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
const type = Object.prototype.toString.call(recipient[key1]);
|
|
474
|
+
const isobject = type === "[object Object]" || type === "[object Array]";
|
|
475
|
+
if (!overwrite && !isobject && typeof recipient[key1] !== "undefined") {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
if (overwrite && !isobject || !overwrite && recipient[key1] == null) {
|
|
479
|
+
recipient[key1] = typeof key2 === "number" && !opts.object ? [] : {};
|
|
480
|
+
}
|
|
481
|
+
recipient = recipient[key1];
|
|
482
|
+
if (split.length > 0) {
|
|
483
|
+
key1 = getkey(split.shift());
|
|
484
|
+
key2 = getkey(split[0]);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
recipient[key1] = unflatten2(target[key], opts);
|
|
488
|
+
});
|
|
489
|
+
return result;
|
|
490
|
+
}
|
|
491
|
+
return flat$1;
|
|
492
|
+
}
|
|
493
|
+
var flatExports = requireFlat();
|
|
494
|
+
const flat = /* @__PURE__ */ getDefaultExportFromCjs(flatExports);
|
|
495
|
+
const { unflatten } = flat;
|
|
378
496
|
const SUPPORTED_COLOR_MODES = ["light", "dark"];
|
|
379
497
|
function createVariableSet(fileData, valueType = "color") {
|
|
380
498
|
const dataUnformatted = JSON.parse(fileData);
|
|
@@ -659,7 +777,7 @@ function createJSColorFileData({
|
|
|
659
777
|
[color?.js.key]: color?.js.value
|
|
660
778
|
}));
|
|
661
779
|
const jsVariablesObject = Object.assign({}, ...jsVariables);
|
|
662
|
-
const unflattenedJSVariablesObject =
|
|
780
|
+
const unflattenedJSVariablesObject = unflatten(jsVariablesObject);
|
|
663
781
|
const outputString = `${WARNING_TEXT}
|
|
664
782
|
export const ${name} = ${JSON.stringify(unflattenedJSVariablesObject)}
|
|
665
783
|
`;
|
|
@@ -704,4 +822,4 @@ exports.space = space;
|
|
|
704
822
|
exports.timings = timings;
|
|
705
823
|
exports.transport = transport;
|
|
706
824
|
exports.zIndexes = zIndexes;
|
|
707
|
-
//# sourceMappingURL=tokens.cjs.
|
|
825
|
+
//# sourceMappingURL=tokens.cjs.map
|