Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aesthetic-utils

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aesthetic-utils - npm Package Compare versions

Comparing version 2.0.0-alpha.4 to 2.0.0-alpha.5

lib/formatFontFace.d.ts

17

esm/formatFontFace.js

@@ -0,4 +1,12 @@

"use strict";
exports.__esModule = true;
exports.default = formatFontFace;
var _toArray = _interopRequireDefault(require("./toArray"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _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; }; return _extends.apply(this, arguments); }
import toArray from './toArray';
var FORMATS = {

@@ -13,3 +21,4 @@ '.eot': 'embedded-opentype',

};
export default function formatFontFace(properties) {
function formatFontFace(properties) {
var fontFace = _extends({}, properties);

@@ -20,3 +29,3 @@

if (fontFace.local) {
toArray(fontFace.local).forEach(function (alias) {
(0, _toArray.default)(fontFace.local).forEach(function (alias) {
src.push("local('" + String(alias) + "')");

@@ -28,3 +37,3 @@ });

if (Array.isArray(fontFace.srcPaths)) {
toArray(fontFace.srcPaths).forEach(function (srcPath) {
(0, _toArray.default)(fontFace.srcPaths).forEach(function (srcPath) {
var ext = srcPath.slice(srcPath.lastIndexOf('.'));

@@ -31,0 +40,0 @@

@@ -1,5 +0,14 @@

import hasQueryCondition from './hasQueryCondition';
import toArray from './toArray';
export default function getFlushedStyles(styles) {
return toArray(styles).reduce(function (css, style) {
"use strict";
exports.__esModule = true;
exports.default = getFlushedStyles;
var _hasQueryCondition = _interopRequireDefault(require("./hasQueryCondition"));
var _toArray = _interopRequireDefault(require("./toArray"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getFlushedStyles(styles) {
return (0, _toArray.default)(styles).reduce(function (css, style) {
var sheet = style.sheet;

@@ -20,3 +29,3 @@ var content = '';

if (style.media && hasQueryCondition(style.media)) {
if (style.media && (0, _hasQueryCondition.default)(style.media)) {
content = "@media " + style.media + " { " + content + " }";

@@ -23,0 +32,0 @@ }

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

export default function getStyleElements(namespace) {
"use strict";
exports.__esModule = true;
exports.default = getStyleElements;
function getStyleElements(namespace) {
return Array.from(document.querySelectorAll(namespace ? "style[" + namespace + "]" : 'style'));
}

@@ -0,4 +1,9 @@

"use strict";
exports.__esModule = true;
exports.default = hasQueryCondition;
var QUERY_GROUP = /\([\x2Da-z\u017F\u212A]+:/gi;
export default function hasQueryCondition(value) {
function hasQueryCondition(value) {
return !!value.match(QUERY_GROUP);
}

@@ -1,15 +0,45 @@

/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
import formatFontFace from './formatFontFace';
import getFlushedStyles from './getFlushedStyles';
import getStyleElements from './getStyleElements';
import hasQueryCondition from './hasQueryCondition';
import isObject from './isObject';
import isRTL from './isRTL';
import purgeStyles from './purgeStyles';
import stripClassPrefix from './stripClassPrefix';
import toArray from './toArray';
import toObjectRecursive from './toObjectRecursive';
export { formatFontFace, getFlushedStyles, getStyleElements, hasQueryCondition, isObject, isRTL, purgeStyles, stripClassPrefix, toArray, toObjectRecursive };
"use strict";
exports.__esModule = true;
var _formatFontFace = _interopRequireDefault(require("./formatFontFace"));
exports.formatFontFace = _formatFontFace.default;
var _getFlushedStyles = _interopRequireDefault(require("./getFlushedStyles"));
exports.getFlushedStyles = _getFlushedStyles.default;
var _getStyleElements = _interopRequireDefault(require("./getStyleElements"));
exports.getStyleElements = _getStyleElements.default;
var _hasQueryCondition = _interopRequireDefault(require("./hasQueryCondition"));
exports.hasQueryCondition = _hasQueryCondition.default;
var _isObject = _interopRequireDefault(require("./isObject"));
exports.isObject = _isObject.default;
var _isRTL = _interopRequireDefault(require("./isRTL"));
exports.isRTL = _isRTL.default;
var _purgeStyles = _interopRequireDefault(require("./purgeStyles"));
exports.purgeStyles = _purgeStyles.default;
var _stripClassPrefix = _interopRequireDefault(require("./stripClassPrefix"));
exports.stripClassPrefix = _stripClassPrefix.default;
var _toArray = _interopRequireDefault(require("./toArray"));
exports.toArray = _toArray.default;
var _toObjectRecursive = _interopRequireDefault(require("./toObjectRecursive"));
exports.toObjectRecursive = _toObjectRecursive.default;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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

export default function isObject(value) {
"use strict";
exports.__esModule = true;
exports.default = isObject;
function isObject(value) {
return value !== null && !Array.isArray(value) && typeof value === 'object';
}

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

export default function isRTL(dir) {
"use strict";
exports.__esModule = true;
exports.default = isRTL;
function isRTL(dir) {
return !!dir && dir === 'rtl';
}

@@ -1,4 +0,12 @@

import toArray from './toArray';
export default function purgeStyles(styles) {
toArray(styles).forEach(function (style) {
"use strict";
exports.__esModule = true;
exports.default = purgeStyles;
var _toArray = _interopRequireDefault(require("./toArray"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function purgeStyles(styles) {
(0, _toArray.default)(styles).forEach(function (style) {
style.textContent = '';

@@ -5,0 +13,0 @@ var sheet = style.sheet;

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

export default function stripClassPrefix(name) {
"use strict";
exports.__esModule = true;
exports.default = stripClassPrefix;
function stripClassPrefix(name) {
return name.charAt(0) === '.' ? name.substring(1) : name;
}

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

export default function toArray(value) {
"use strict";
exports.__esModule = true;
exports.default = toArray;
function toArray(value) {
return Array.isArray(value) ? value : [value];
}

@@ -1,2 +0,7 @@

export default function toObjectRecursive(map) {
"use strict";
exports.__esModule = true;
exports.default = toObjectRecursive;
function toObjectRecursive(map) {
var object = {};

@@ -3,0 +8,0 @@

@@ -1,12 +0,4 @@

"use strict";
exports.__esModule = true;
exports.default = formatFontFace;
var _toArray = _interopRequireDefault(require("./toArray"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _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; }; return _extends.apply(this, arguments); }
import toArray from './toArray';
var FORMATS = {

@@ -21,4 +13,3 @@ '.eot': 'embedded-opentype',

};
function formatFontFace(properties) {
export default function formatFontFace(properties) {
var fontFace = _extends({}, properties);

@@ -29,3 +20,3 @@

if (fontFace.local) {
(0, _toArray.default)(fontFace.local).forEach(function (alias) {
toArray(fontFace.local).forEach(function (alias) {
src.push("local('" + String(alias) + "')");

@@ -37,3 +28,3 @@ });

if (Array.isArray(fontFace.srcPaths)) {
(0, _toArray.default)(fontFace.srcPaths).forEach(function (srcPath) {
toArray(fontFace.srcPaths).forEach(function (srcPath) {
var ext = srcPath.slice(srcPath.lastIndexOf('.'));

@@ -40,0 +31,0 @@

@@ -1,14 +0,5 @@

"use strict";
exports.__esModule = true;
exports.default = getFlushedStyles;
var _hasQueryCondition = _interopRequireDefault(require("./hasQueryCondition"));
var _toArray = _interopRequireDefault(require("./toArray"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getFlushedStyles(styles) {
return (0, _toArray.default)(styles).reduce(function (css, style) {
import hasQueryCondition from './hasQueryCondition';
import toArray from './toArray';
export default function getFlushedStyles(styles) {
return toArray(styles).reduce(function (css, style) {
var sheet = style.sheet;

@@ -29,3 +20,3 @@ var content = '';

if (style.media && (0, _hasQueryCondition.default)(style.media)) {
if (style.media && hasQueryCondition(style.media)) {
content = "@media " + style.media + " { " + content + " }";

@@ -32,0 +23,0 @@ }

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

"use strict";
exports.__esModule = true;
exports.default = getStyleElements;
function getStyleElements(namespace) {
export default function getStyleElements(namespace) {
return Array.from(document.querySelectorAll(namespace ? "style[" + namespace + "]" : 'style'));
}

@@ -1,9 +0,4 @@

"use strict";
exports.__esModule = true;
exports.default = hasQueryCondition;
var QUERY_GROUP = /\([\x2Da-z\u017F\u212A]+:/gi;
function hasQueryCondition(value) {
export default function hasQueryCondition(value) {
return !!value.match(QUERY_GROUP);
}

@@ -1,45 +0,15 @@

"use strict";
exports.__esModule = true;
var _formatFontFace = _interopRequireDefault(require("./formatFontFace"));
exports.formatFontFace = _formatFontFace.default;
var _getFlushedStyles = _interopRequireDefault(require("./getFlushedStyles"));
exports.getFlushedStyles = _getFlushedStyles.default;
var _getStyleElements = _interopRequireDefault(require("./getStyleElements"));
exports.getStyleElements = _getStyleElements.default;
var _hasQueryCondition = _interopRequireDefault(require("./hasQueryCondition"));
exports.hasQueryCondition = _hasQueryCondition.default;
var _isObject = _interopRequireDefault(require("./isObject"));
exports.isObject = _isObject.default;
var _isRTL = _interopRequireDefault(require("./isRTL"));
exports.isRTL = _isRTL.default;
var _purgeStyles = _interopRequireDefault(require("./purgeStyles"));
exports.purgeStyles = _purgeStyles.default;
var _stripClassPrefix = _interopRequireDefault(require("./stripClassPrefix"));
exports.stripClassPrefix = _stripClassPrefix.default;
var _toArray = _interopRequireDefault(require("./toArray"));
exports.toArray = _toArray.default;
var _toObjectRecursive = _interopRequireDefault(require("./toObjectRecursive"));
exports.toObjectRecursive = _toObjectRecursive.default;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @copyright 2017-2019, Miles Johnson
* @license https://opensource.org/licenses/MIT
*/
import formatFontFace from './formatFontFace';
import getFlushedStyles from './getFlushedStyles';
import getStyleElements from './getStyleElements';
import hasQueryCondition from './hasQueryCondition';
import isObject from './isObject';
import isRTL from './isRTL';
import purgeStyles from './purgeStyles';
import stripClassPrefix from './stripClassPrefix';
import toArray from './toArray';
import toObjectRecursive from './toObjectRecursive';
export { formatFontFace, getFlushedStyles, getStyleElements, hasQueryCondition, isObject, isRTL, purgeStyles, stripClassPrefix, toArray, toObjectRecursive };

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

"use strict";
exports.__esModule = true;
exports.default = isObject;
function isObject(value) {
export default function isObject(value) {
return value !== null && !Array.isArray(value) && typeof value === 'object';
}

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

"use strict";
exports.__esModule = true;
exports.default = isRTL;
function isRTL(dir) {
export default function isRTL(dir) {
return !!dir && dir === 'rtl';
}

@@ -1,12 +0,4 @@

"use strict";
exports.__esModule = true;
exports.default = purgeStyles;
var _toArray = _interopRequireDefault(require("./toArray"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function purgeStyles(styles) {
(0, _toArray.default)(styles).forEach(function (style) {
import toArray from './toArray';
export default function purgeStyles(styles) {
toArray(styles).forEach(function (style) {
style.textContent = '';

@@ -13,0 +5,0 @@ var sheet = style.sheet;

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

"use strict";
exports.__esModule = true;
exports.default = stripClassPrefix;
function stripClassPrefix(name) {
export default function stripClassPrefix(name) {
return name.charAt(0) === '.' ? name.substring(1) : name;
}

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

"use strict";
exports.__esModule = true;
exports.default = toArray;
function toArray(value) {
export default function toArray(value) {
return Array.isArray(value) ? value : [value];
}

@@ -1,7 +0,2 @@

"use strict";
exports.__esModule = true;
exports.default = toObjectRecursive;
function toObjectRecursive(map) {
export default function toObjectRecursive(map) {
var object = {};

@@ -8,0 +3,0 @@

{
"name": "aesthetic-utils",
"version": "2.0.0-alpha.4",
"version": "2.0.0-alpha.5",
"description": "Utility functions for Aesthetic.",

@@ -22,3 +22,3 @@ "keywords": [

},
"gitHead": "28e2a8739270007f74903ce8b911d0149bdbc111"
"gitHead": "5526792431adeebc7d8ec1420627fbd20d51cc84"
}
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