Socket
Socket
Sign inDemoInstall

@hig/theme-data

Package Overview
Dependencies
Maintainers
6
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hig/theme-data - npm Package Compare versions

Comparing version 2.24.0 to 2.25.0

85

build/index.es.js
import tinycolor from 'tinycolor2';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
/**

@@ -17,3 +56,3 @@ * extendTheme

// object instance `acc` using property assignment and `Object.assign`.
return Object.keys(extension).reduce(function (acc, key) {
return Object.keys(extension).reduce((acc, key) => {
if (!acc[key]) {

@@ -24,4 +63,5 @@ acc[key] = extension[key];

}
return acc;
}, _extends({}, theme));
}, _objectSpread2({}, theme));
}

@@ -32,3 +72,3 @@

// object in every iteration and becomes a performance bottleneck
return Object.keys(object).reduce(function (acc, key) {
return Object.keys(object).reduce((acc, key) => {
acc[key] = iterator(object, key);

@@ -39,8 +79,7 @@ return acc;

var _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function errorMsg(msg, referencingRole) {
if (referencingRole) {
return "Role " + referencingRole + ": " + msg;
return `Role ${referencingRole}: ${msg}`;
}
return msg;

@@ -50,17 +89,19 @@ }

function dereferenceValue(theme, role, referencingRole) {
var valueData = theme[role];
const valueData = theme[role];
if (valueData === undefined) {
throw new Error(errorMsg("Role \"" + role + "\" is not present in theme", referencingRole));
throw new Error(errorMsg(`Role "${role}" is not present in theme`, referencingRole));
}
if (valueData.value === null) {
throw new Error(errorMsg("You must provide a value for role \"" + role + "\"", referencingRole));
throw new Error(errorMsg(`You must provide a value for role "${role}"`, referencingRole));
}
if (valueData.value && valueData.value.ref) {
var dereferencedValue = dereferenceValue(theme, valueData.value.ref, role);
return _extends$1({}, dereferencedValue, valueData, {
const dereferencedValue = dereferenceValue(theme, valueData.value.ref, role);
return _objectSpread2(_objectSpread2(_objectSpread2({}, dereferencedValue), valueData), {}, {
value: dereferencedValue.value
});
}
return valueData;

@@ -70,6 +111,8 @@ }

function transformAlpha(role, valueData) {
var color = tinycolor(valueData.value);
const color = tinycolor(valueData.value);
if (!color.isValid()) {
throw new Error("Role " + role + ": " + valueData.value + " is not a valid color");
throw new Error(`Role ${role}: ${valueData.value} is not a valid color`);
}
return color.setAlpha(valueData.transform.alpha).toRgbString();

@@ -79,8 +122,10 @@ }

function transformColorValue(theme, role) {
var valueData = theme[role];
var hasAlphaTransform = valueData.transform && valueData.transform.alpha !== undefined;
const valueData = theme[role];
const hasAlphaTransform = valueData.transform && valueData.transform.alpha !== undefined;
if (!hasAlphaTransform) {
return valueData;
}
return _extends$1({}, valueData, {
return _objectSpread2(_objectSpread2({}, valueData), {}, {
value: transformAlpha(role, valueData)

@@ -95,7 +140,5 @@ });

function resolveTheme(theme) {
return [dereferenceValue, transformColorValue, destructureValue].reduce(function (acc, fn) {
return mapValues(acc, fn);
}, theme);
return [dereferenceValue, transformColorValue, destructureValue].reduce((acc, fn) => mapValues(acc, fn), theme);
}
export { extendTheme, resolveTheme };

@@ -5,8 +5,49 @@ 'use strict';

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var tinycolor = require('tinycolor2');
var tinycolor = _interopDefault(require('tinycolor2'));
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var tinycolor__default = /*#__PURE__*/_interopDefaultLegacy(tinycolor);
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
/**

@@ -24,3 +65,3 @@ * extendTheme

// object instance `acc` using property assignment and `Object.assign`.
return Object.keys(extension).reduce(function (acc, key) {
return Object.keys(extension).reduce((acc, key) => {
if (!acc[key]) {

@@ -31,4 +72,5 @@ acc[key] = extension[key];

}
return acc;
}, _extends({}, theme));
}, _objectSpread2({}, theme));
}

@@ -39,3 +81,3 @@

// object in every iteration and becomes a performance bottleneck
return Object.keys(object).reduce(function (acc, key) {
return Object.keys(object).reduce((acc, key) => {
acc[key] = iterator(object, key);

@@ -46,8 +88,7 @@ return acc;

var _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function errorMsg(msg, referencingRole) {
if (referencingRole) {
return "Role " + referencingRole + ": " + msg;
return `Role ${referencingRole}: ${msg}`;
}
return msg;

@@ -57,17 +98,19 @@ }

function dereferenceValue(theme, role, referencingRole) {
var valueData = theme[role];
const valueData = theme[role];
if (valueData === undefined) {
throw new Error(errorMsg("Role \"" + role + "\" is not present in theme", referencingRole));
throw new Error(errorMsg(`Role "${role}" is not present in theme`, referencingRole));
}
if (valueData.value === null) {
throw new Error(errorMsg("You must provide a value for role \"" + role + "\"", referencingRole));
throw new Error(errorMsg(`You must provide a value for role "${role}"`, referencingRole));
}
if (valueData.value && valueData.value.ref) {
var dereferencedValue = dereferenceValue(theme, valueData.value.ref, role);
return _extends$1({}, dereferencedValue, valueData, {
const dereferencedValue = dereferenceValue(theme, valueData.value.ref, role);
return _objectSpread2(_objectSpread2(_objectSpread2({}, dereferencedValue), valueData), {}, {
value: dereferencedValue.value
});
}
return valueData;

@@ -77,6 +120,8 @@ }

function transformAlpha(role, valueData) {
var color = tinycolor(valueData.value);
const color = tinycolor__default["default"](valueData.value);
if (!color.isValid()) {
throw new Error("Role " + role + ": " + valueData.value + " is not a valid color");
throw new Error(`Role ${role}: ${valueData.value} is not a valid color`);
}
return color.setAlpha(valueData.transform.alpha).toRgbString();

@@ -86,8 +131,10 @@ }

function transformColorValue(theme, role) {
var valueData = theme[role];
var hasAlphaTransform = valueData.transform && valueData.transform.alpha !== undefined;
const valueData = theme[role];
const hasAlphaTransform = valueData.transform && valueData.transform.alpha !== undefined;
if (!hasAlphaTransform) {
return valueData;
}
return _extends$1({}, valueData, {
return _objectSpread2(_objectSpread2({}, valueData), {}, {
value: transformAlpha(role, valueData)

@@ -102,5 +149,3 @@ });

function resolveTheme(theme) {
return [dereferenceValue, transformColorValue, destructureValue].reduce(function (acc, fn) {
return mapValues(acc, fn);
}, theme);
return [dereferenceValue, transformColorValue, destructureValue].reduce((acc, fn) => mapValues(acc, fn), theme);
}

@@ -107,0 +152,0 @@

@@ -0,1 +1,8 @@

# [@hig/theme-data-v2.25.0](https://github.com/Autodesk/hig/compare/@hig/theme-data@2.24.0...@hig/theme-data@2.25.0) (2022-03-28)
### Features
* updated underline tab bottom padding ([0a79ef9](https://github.com/Autodesk/hig/commit/0a79ef9))
# [@hig/theme-data-v2.24.0](https://github.com/Autodesk/hig/compare/@hig/theme-data@2.23.1...@hig/theme-data@2.24.0) (2022-03-16)

@@ -2,0 +9,0 @@

{
"name": "@hig/theme-data",
"version": "2.24.0",
"version": "2.25.0",
"description": "HIG Theme Data",

@@ -29,2 +29,4 @@ "author": "Autodesk Inc.",

"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/node": "^7.0.0",
"@hig/babel-preset": "^0.1.1",

@@ -36,3 +38,2 @@ "@hig/eslint-config": "^0.1.0",

"@hig/typography": "^2.1.0",
"babel-cli": "^6.26.0",
"camelcase": "^5.0.0",

@@ -39,0 +40,0 @@ "style-dictionary": "^2.6.2"

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc