Comparing version 4.0.0-alpha.6 to 4.0.0-alpha.7
@@ -1,22 +0,1 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _extend = _interopRequireDefault(require("extend")); | ||
var _v = _interopRequireDefault(require("uuid/v4")); | ||
var _aestheticUtils = require("aesthetic-utils"); | ||
var _CacheManager = _interopRequireDefault(require("./CacheManager")); | ||
var _Sheet = _interopRequireDefault(require("./Sheet")); | ||
var _StyleSheetManager = _interopRequireDefault(require("./StyleSheetManager")); | ||
var _UnifiedSyntax = _interopRequireDefault(require("./UnifiedSyntax")); | ||
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); } | ||
@@ -26,2 +5,10 @@ | ||
import deepMerge from 'extend'; | ||
import uuid from 'uuid/v4'; | ||
import { isObject, stripClassPrefix } from 'aesthetic-utils'; | ||
import CacheManager from './CacheManager'; | ||
import Sheet from './Sheet'; | ||
import StyleSheetManager from './StyleSheetManager'; | ||
import UnifiedSyntax from './UnifiedSyntax'; | ||
var Aesthetic = function () { | ||
@@ -41,7 +28,7 @@ function Aesthetic(options) { | ||
_defineProperty(this, "syntax", new _UnifiedSyntax.default()); | ||
_defineProperty(this, "syntax", new UnifiedSyntax()); | ||
_defineProperty(this, "themes", {}); | ||
_defineProperty(this, "cacheManager", new _CacheManager.default()); | ||
_defineProperty(this, "cacheManager", new CacheManager()); | ||
@@ -120,3 +107,3 @@ _defineProperty(this, "sheetManager", null); | ||
}); | ||
return _extend.default.apply(void 0, [true, {}].concat(sheets)); | ||
return deepMerge.apply(void 0, [true, {}].concat(sheets)); | ||
}; | ||
@@ -130,3 +117,3 @@ }; | ||
return this.registerTheme(themeName, (0, _extend.default)(true, {}, this.getTheme(parentThemeName), theme), globalSheet || this.globals[parentThemeName]); | ||
return this.registerTheme(themeName, deepMerge(true, {}, this.getTheme(parentThemeName), theme), globalSheet || this.globals[parentThemeName]); | ||
}; | ||
@@ -136,9 +123,9 @@ | ||
_proto.getStyleSheet = function getStyleSheet(styleName) { | ||
_proto.getStyleSheet = function getStyleSheet(styleName, themeName) { | ||
var parentStyleName = this.parents[styleName]; | ||
var styleDef = this.styles[styleName]; | ||
var styleSheet = styleDef(this.getTheme()); | ||
var styleSheet = styleDef(this.getTheme(themeName || this.options.theme)); | ||
if (parentStyleName) { | ||
return (0, _extend.default)(true, {}, this.getStyleSheet(parentStyleName), styleSheet); | ||
return deepMerge(true, {}, this.getStyleSheet(parentStyleName, themeName), styleSheet); | ||
} | ||
@@ -154,3 +141,3 @@ | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!theme || !(0, _aestheticUtils.isObject)(theme)) { | ||
if (!theme || !isObject(theme)) { | ||
throw new Error("Theme \"" + themeName + "\" does not exist."); | ||
@@ -164,3 +151,3 @@ } | ||
_proto.isParsedBlock = function isParsedBlock(block) { | ||
return (0, _aestheticUtils.isObject)(block); | ||
return isObject(block); | ||
}; | ||
@@ -199,3 +186,3 @@ | ||
throw new Error("Theme \"" + themeName + "\" already exists."); | ||
} else if (!(0, _aestheticUtils.isObject)(theme)) { | ||
} else if (!isObject(theme)) { | ||
throw new TypeError("Theme \"" + themeName + "\" must be a style object."); | ||
@@ -225,5 +212,5 @@ } | ||
classNames.push.apply(classNames, String(style).split(' ').map(function (s) { | ||
return (0, _aestheticUtils.stripClassPrefix)(s).trim(); | ||
return stripClassPrefix(s).trim(); | ||
})); | ||
} else if ((0, _aestheticUtils.isObject)(style)) { | ||
} else if (isObject(style)) { | ||
if (_this.isParsedBlock(style)) { | ||
@@ -240,5 +227,5 @@ parsedBlocks.push(style); | ||
if (nativeBlocks.length > 0) { | ||
var nativeSheet = new _Sheet.default(options); | ||
var nativeSheet = new Sheet(options); | ||
var counter = 0; | ||
inlineName = (0, _v.default)(); | ||
inlineName = uuid(); | ||
nativeBlocks.forEach(function (block) { | ||
@@ -281,3 +268,3 @@ nativeSheet.addRuleset(nativeSheet.createRuleset("inline-" + counter).addProperties(block)); | ||
this.sheetManager = new _StyleSheetManager.default(); | ||
this.sheetManager = new StyleSheetManager(); | ||
return this.sheetManager; | ||
@@ -301,2 +288,2 @@ }; | ||
exports.default = Aesthetic; | ||
export { Aesthetic as default }; |
@@ -1,6 +0,1 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
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); } | ||
@@ -48,2 +43,2 @@ | ||
exports.default = CacheManager; | ||
export { CacheManager as default }; |
@@ -1,12 +0,5 @@ | ||
"use strict"; | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
import Aesthetic from './Aesthetic'; | ||
var _Aesthetic2 = _interopRequireDefault(require("./Aesthetic")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
var ClassNameAesthetic = function (_Aesthetic) { | ||
@@ -28,4 +21,4 @@ _inheritsLoose(ClassNameAesthetic, _Aesthetic); | ||
return ClassNameAesthetic; | ||
}(_Aesthetic2.default); | ||
}(Aesthetic); | ||
exports.default = ClassNameAesthetic; | ||
export { ClassNameAesthetic as default }; |
@@ -1,40 +0,1 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
var _exportNames = { | ||
ClassNameAesthetic: true, | ||
UnifiedSyntax: true, | ||
Ruleset: true, | ||
Sheet: true | ||
}; | ||
exports.default = void 0; | ||
var _Aesthetic = _interopRequireDefault(require("./Aesthetic")); | ||
var _ClassNameAesthetic = _interopRequireDefault(require("./ClassNameAesthetic")); | ||
exports.ClassNameAesthetic = _ClassNameAesthetic.default; | ||
var _UnifiedSyntax = _interopRequireDefault(require("./UnifiedSyntax")); | ||
exports.UnifiedSyntax = _UnifiedSyntax.default; | ||
var _Ruleset = _interopRequireDefault(require("./Ruleset")); | ||
exports.Ruleset = _Ruleset.default; | ||
var _Sheet = _interopRequireDefault(require("./Sheet")); | ||
exports.Sheet = _Sheet.default; | ||
var _types = require("./types"); | ||
Object.keys(_types).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
exports[key] = _types[key]; | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -44,3 +5,9 @@ * @copyright 2017-2019, Miles Johnson | ||
*/ | ||
var _default = _Aesthetic.default; | ||
exports.default = _default; | ||
import Aesthetic from './Aesthetic'; | ||
import ClassNameAesthetic from './ClassNameAesthetic'; | ||
import UnifiedSyntax from './UnifiedSyntax'; | ||
import Ruleset from './Ruleset'; | ||
import Sheet from './Sheet'; | ||
export * from './types'; | ||
export { ClassNameAesthetic, UnifiedSyntax, Ruleset, Sheet }; | ||
export default Aesthetic; |
@@ -1,12 +0,1 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _rtlCssJs = _interopRequireDefault(require("rtl-css-js")); | ||
var _aestheticUtils = require("aesthetic-utils"); | ||
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); } | ||
@@ -16,2 +5,5 @@ | ||
import convertRTL from 'rtl-css-js'; | ||
import { isRTL, toObjectRecursive } from 'aesthetic-utils'; | ||
var Ruleset = function () { | ||
@@ -86,3 +78,3 @@ function Ruleset(selector, root, parent) { | ||
_proto.toObject = function toObject() { | ||
var props = (0, _aestheticUtils.isRTL)(this.root.options.dir) ? (0, _rtlCssJs.default)(this.properties) : this.properties; | ||
var props = isRTL(this.root.options.dir) ? convertRTL(this.properties) : this.properties; | ||
var compounds = {}; | ||
@@ -92,3 +84,3 @@ this.compoundProperties.forEach(function (compound, key) { | ||
}); | ||
return _extends({}, props, compounds, (0, _aestheticUtils.toObjectRecursive)(this.nested)); | ||
return _extends({}, props, compounds, toObjectRecursive(this.nested)); | ||
}; | ||
@@ -99,2 +91,2 @@ | ||
exports.default = Ruleset; | ||
export { Ruleset as default }; |
@@ -1,12 +0,1 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _aestheticUtils = require("aesthetic-utils"); | ||
var _Ruleset = _interopRequireDefault(require("./Ruleset")); | ||
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); } | ||
@@ -16,2 +5,5 @@ | ||
import { toObjectRecursive } from 'aesthetic-utils'; | ||
import Ruleset from './Ruleset'; | ||
var Sheet = function () { | ||
@@ -52,3 +44,3 @@ function Sheet(options) { | ||
_proto.createRuleset = function createRuleset(selector) { | ||
return new _Ruleset.default(selector, this); | ||
return new Ruleset(selector, this); | ||
}; | ||
@@ -68,7 +60,7 @@ | ||
if (value instanceof Sheet || value instanceof _Ruleset.default) { | ||
if (value instanceof Sheet || value instanceof Ruleset) { | ||
sets[key] = value; | ||
} else if (Array.isArray(value)) { | ||
atRules[key] = value.map(function (item) { | ||
return item instanceof _Ruleset.default ? item.toObject() : item; | ||
return item instanceof Ruleset ? item.toObject() : item; | ||
}); | ||
@@ -79,3 +71,3 @@ } else { | ||
}); | ||
return _extends({}, atRules, (0, _aestheticUtils.toObjectRecursive)(sets), (0, _aestheticUtils.toObjectRecursive)(this.ruleSets)); | ||
return _extends({}, atRules, toObjectRecursive(sets), toObjectRecursive(this.ruleSets)); | ||
}; | ||
@@ -86,2 +78,2 @@ | ||
exports.default = Sheet; | ||
export { Sheet as default }; |
@@ -1,10 +0,5 @@ | ||
"use strict"; | ||
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; } | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
import { getFlushedStyles as _getFlushedStyles, purgeStyles as _purgeStyles } from 'aesthetic-utils'; | ||
var _aestheticUtils = require("aesthetic-utils"); | ||
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; } | ||
var StyleSheetManager = function () { | ||
@@ -27,3 +22,3 @@ function StyleSheetManager() { | ||
_proto.getFlushedStyles = function getFlushedStyles() { | ||
return (0, _aestheticUtils.getFlushedStyles)(this.element); | ||
return _getFlushedStyles(this.element); | ||
}; | ||
@@ -42,3 +37,4 @@ | ||
_proto.purgeStyles = function purgeStyles() { | ||
(0, _aestheticUtils.purgeStyles)(this.element); | ||
_purgeStyles(this.element); | ||
return this; | ||
@@ -50,2 +46,2 @@ }; | ||
exports.default = StyleSheetManager; | ||
export { StyleSheetManager as default }; |
@@ -1,21 +0,1 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.registerTestTheme = registerTestTheme; | ||
exports.cleanupStyleElements = cleanupStyleElements; | ||
exports.getFlushedStyles = getFlushedStyles; | ||
exports.convertDirection = convertDirection; | ||
exports.renderAndExpect = renderAndExpect; | ||
exports.SYNTAX_RAW_CSS = exports.SYNTAX_VIEWPORT = exports.SYNTAX_SUPPORTS = exports.SYNTAX_PSEUDO = exports.SYNTAX_PROPERTIES = exports.SYNTAX_PAGE = exports.SYNTAX_NAMESPACE = exports.SYNTAX_MULTI_SELECTOR = exports.SYNTAX_MEDIA_QUERY_NESTED = exports.SYNTAX_MEDIA_QUERY = exports.SYNTAX_KEYFRAMES_INLINE = exports.SYNTAX_KEYFRAMES_MIXED = exports.SYNTAX_KEYFRAMES_PERCENT = exports.SYNTAX_KEYFRAMES = exports.SYNTAX_GLOBAL = exports.SYNTAX_FONT_FACES_INLINE = exports.SYNTAX_FONT_FACE_MIXED = exports.SYNTAX_FONT_FACE_MULTIPLE = exports.SYNTAX_FONT_FACE = exports.SYNTAX_FALLBACKS = exports.SYNTAX_IMPORT_MULTIPLE = exports.SYNTAX_IMPORT = exports.SYNTAX_DESCENDANT = exports.SYNTAX_CHARSET = exports.SYNTAX_ATTRIBUTE = exports.SYNTAX_UNIFIED_LOCAL_FULL = exports.SYNTAX_UNIFIED_GLOBAL_FULL = exports.SYNTAX_UNIFIED_LOCAL = exports.KEYFRAME_SLIDE_PERCENT = exports.KEYFRAME_FADE = exports.FONT_CIRCULAR_MULTIPLE_FLAT_SRC = exports.FONT_CIRCULAR_MULTIPLE = exports.FONT_ROBOTO_FLAT_SRC = exports.FONT_ROBOTO = exports.DIRECTIONS = exports.TEST_STATEMENT = exports.TEST_CLASS_NAMES = exports.TestAesthetic = void 0; | ||
var _rtlCssJs = _interopRequireDefault(require("rtl-css-js")); | ||
var _aestheticUtils = require("aesthetic-utils"); | ||
exports.getStyleElements = _aestheticUtils.getStyleElements; | ||
var _Aesthetic2 = _interopRequireDefault(require("./Aesthetic")); | ||
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); } | ||
@@ -25,3 +5,7 @@ | ||
var TestAesthetic = function (_Aesthetic) { | ||
import convertRTL from 'rtl-css-js'; | ||
import { getFlushedStyles as getBaseFlushedStyles, getStyleElements, isObject } from 'aesthetic-utils'; | ||
import Aesthetic from './Aesthetic'; | ||
export { getStyleElements }; | ||
export var TestAesthetic = function (_Aesthetic) { | ||
_inheritsLoose(TestAesthetic, _Aesthetic); | ||
@@ -42,7 +26,4 @@ | ||
return TestAesthetic; | ||
}(_Aesthetic2.default); | ||
exports.TestAesthetic = TestAesthetic; | ||
function registerTestTheme(aesthetic) { | ||
}(Aesthetic); | ||
export function registerTestTheme(aesthetic) { | ||
aesthetic.registerTheme('default', { | ||
@@ -64,14 +45,11 @@ color: 'black', | ||
} | ||
function cleanupStyleElements() { | ||
(0, _aestheticUtils.getStyleElements)().forEach(function (style) { | ||
export function cleanupStyleElements() { | ||
getStyleElements().forEach(function (style) { | ||
style.remove(); | ||
}); | ||
} | ||
function getFlushedStyles(namespace) { | ||
return (0, _aestheticUtils.getFlushedStyles)((0, _aestheticUtils.getStyleElements)(namespace)); | ||
export function getFlushedStyles(namespace) { | ||
return getBaseFlushedStyles(getStyleElements(namespace)); | ||
} | ||
function convertDirection(value, dir) { | ||
export function convertDirection(value, dir) { | ||
if (dir !== 'rtl') { | ||
@@ -87,3 +65,3 @@ return value; | ||
if (!(0, _aestheticUtils.isObject)(value)) { | ||
if (!isObject(value)) { | ||
return value; | ||
@@ -97,3 +75,3 @@ } | ||
if ((0, _aestheticUtils.isObject)(prop) || Array.isArray(prop)) { | ||
if (isObject(prop) || Array.isArray(prop)) { | ||
nested[key] = convertDirection(prop, dir); | ||
@@ -104,6 +82,5 @@ } else { | ||
}); | ||
return _extends({}, (0, _rtlCssJs.default)(props), nested); | ||
return _extends({}, convertRTL(props), nested); | ||
} | ||
function renderAndExpect(aesthetic, styleSheet, expectedStyles, _ref2) { | ||
export function renderAndExpect(aesthetic, styleSheet, expectedStyles, _ref2) { | ||
if (expectedStyles === void 0) { | ||
@@ -129,9 +106,7 @@ expectedStyles = {}; | ||
} | ||
var TEST_CLASS_NAMES = { | ||
export var TEST_CLASS_NAMES = { | ||
footer: '.footer', | ||
header: '.header' | ||
}; | ||
exports.TEST_CLASS_NAMES = TEST_CLASS_NAMES; | ||
var TEST_STATEMENT = { | ||
export var TEST_STATEMENT = { | ||
footer: { | ||
@@ -144,6 +119,4 @@ color: 'blue' | ||
}; | ||
exports.TEST_STATEMENT = TEST_STATEMENT; | ||
var DIRECTIONS = ['ltr', 'rtl']; | ||
exports.DIRECTIONS = DIRECTIONS; | ||
var FONT_ROBOTO = { | ||
export var DIRECTIONS = ['ltr', 'rtl']; | ||
export var FONT_ROBOTO = { | ||
fontFamily: 'Roboto', | ||
@@ -155,4 +128,3 @@ fontStyle: 'normal', | ||
}; | ||
exports.FONT_ROBOTO = FONT_ROBOTO; | ||
var FONT_ROBOTO_FLAT_SRC = { | ||
export var FONT_ROBOTO_FLAT_SRC = { | ||
fontFamily: 'Roboto', | ||
@@ -163,4 +135,3 @@ fontStyle: 'normal', | ||
}; | ||
exports.FONT_ROBOTO_FLAT_SRC = FONT_ROBOTO_FLAT_SRC; | ||
var FONT_CIRCULAR_MULTIPLE = [{ | ||
export var FONT_CIRCULAR_MULTIPLE = [{ | ||
fontFamily: 'Circular', | ||
@@ -186,4 +157,3 @@ fontStyle: 'normal', | ||
}]; | ||
exports.FONT_CIRCULAR_MULTIPLE = FONT_CIRCULAR_MULTIPLE; | ||
var FONT_CIRCULAR_MULTIPLE_FLAT_SRC = [{ | ||
export var FONT_CIRCULAR_MULTIPLE_FLAT_SRC = [{ | ||
fontFamily: 'Circular', | ||
@@ -209,4 +179,3 @@ fontStyle: 'normal', | ||
}]; | ||
exports.FONT_CIRCULAR_MULTIPLE_FLAT_SRC = FONT_CIRCULAR_MULTIPLE_FLAT_SRC; | ||
var KEYFRAME_FADE = { | ||
export var KEYFRAME_FADE = { | ||
from: { | ||
@@ -219,4 +188,3 @@ opacity: 0 | ||
}; | ||
exports.KEYFRAME_FADE = KEYFRAME_FADE; | ||
var KEYFRAME_SLIDE_PERCENT = { | ||
export var KEYFRAME_SLIDE_PERCENT = { | ||
'0%': { | ||
@@ -232,4 +200,3 @@ left: '0%' | ||
}; | ||
exports.KEYFRAME_SLIDE_PERCENT = KEYFRAME_SLIDE_PERCENT; | ||
var SYNTAX_UNIFIED_LOCAL = { | ||
export var SYNTAX_UNIFIED_LOCAL = { | ||
button: { | ||
@@ -265,4 +232,3 @@ margin: 0, | ||
}; | ||
exports.SYNTAX_UNIFIED_LOCAL = SYNTAX_UNIFIED_LOCAL; | ||
var SYNTAX_UNIFIED_GLOBAL_FULL = { | ||
export var SYNTAX_UNIFIED_GLOBAL_FULL = { | ||
'@font-face': { | ||
@@ -275,4 +241,3 @@ Roboto: FONT_ROBOTO | ||
}; | ||
exports.SYNTAX_UNIFIED_GLOBAL_FULL = SYNTAX_UNIFIED_GLOBAL_FULL; | ||
var SYNTAX_UNIFIED_LOCAL_FULL = { | ||
export var SYNTAX_UNIFIED_LOCAL_FULL = { | ||
button: _extends({}, SYNTAX_UNIFIED_LOCAL.button, { | ||
@@ -286,4 +251,3 @@ '@media': { | ||
}; | ||
exports.SYNTAX_UNIFIED_LOCAL_FULL = SYNTAX_UNIFIED_LOCAL_FULL; | ||
var SYNTAX_ATTRIBUTE = { | ||
export var SYNTAX_ATTRIBUTE = { | ||
attr: { | ||
@@ -296,8 +260,6 @@ display: 'block', | ||
}; | ||
exports.SYNTAX_ATTRIBUTE = SYNTAX_ATTRIBUTE; | ||
var SYNTAX_CHARSET = { | ||
export var SYNTAX_CHARSET = { | ||
'@charset': 'utf8' | ||
}; | ||
exports.SYNTAX_CHARSET = SYNTAX_CHARSET; | ||
var SYNTAX_DESCENDANT = { | ||
export var SYNTAX_DESCENDANT = { | ||
list: { | ||
@@ -313,12 +275,9 @@ margin: 0, | ||
}; | ||
exports.SYNTAX_DESCENDANT = SYNTAX_DESCENDANT; | ||
var SYNTAX_IMPORT = { | ||
export var SYNTAX_IMPORT = { | ||
'@import': 'url("./some/path.css")' | ||
}; | ||
exports.SYNTAX_IMPORT = SYNTAX_IMPORT; | ||
var SYNTAX_IMPORT_MULTIPLE = { | ||
export var SYNTAX_IMPORT_MULTIPLE = { | ||
'@import': ['url("./some/path.css")', 'url("./another/path.css")'] | ||
}; | ||
exports.SYNTAX_IMPORT_MULTIPLE = SYNTAX_IMPORT_MULTIPLE; | ||
var SYNTAX_FALLBACKS = { | ||
export var SYNTAX_FALLBACKS = { | ||
fallback: { | ||
@@ -334,4 +293,3 @@ background: 'linear-gradient(...)', | ||
}; | ||
exports.SYNTAX_FALLBACKS = SYNTAX_FALLBACKS; | ||
var SYNTAX_FONT_FACE = { | ||
export var SYNTAX_FONT_FACE = { | ||
'@font-face': { | ||
@@ -341,4 +299,3 @@ Roboto: [FONT_ROBOTO] | ||
}; | ||
exports.SYNTAX_FONT_FACE = SYNTAX_FONT_FACE; | ||
var SYNTAX_FONT_FACE_MULTIPLE = { | ||
export var SYNTAX_FONT_FACE_MULTIPLE = { | ||
'@font-face': { | ||
@@ -348,4 +305,3 @@ Circular: FONT_CIRCULAR_MULTIPLE | ||
}; | ||
exports.SYNTAX_FONT_FACE_MULTIPLE = SYNTAX_FONT_FACE_MULTIPLE; | ||
var SYNTAX_FONT_FACE_MIXED = { | ||
export var SYNTAX_FONT_FACE_MIXED = { | ||
'@font-face': { | ||
@@ -356,4 +312,3 @@ Roboto: [FONT_ROBOTO], | ||
}; | ||
exports.SYNTAX_FONT_FACE_MIXED = SYNTAX_FONT_FACE_MIXED; | ||
var SYNTAX_FONT_FACES_INLINE = { | ||
export var SYNTAX_FONT_FACES_INLINE = { | ||
single: { | ||
@@ -366,4 +321,3 @@ fontFamily: FONT_ROBOTO | ||
}; | ||
exports.SYNTAX_FONT_FACES_INLINE = SYNTAX_FONT_FACES_INLINE; | ||
var SYNTAX_GLOBAL = { | ||
export var SYNTAX_GLOBAL = { | ||
'@global': { | ||
@@ -384,4 +338,3 @@ body: { | ||
}; | ||
exports.SYNTAX_GLOBAL = SYNTAX_GLOBAL; | ||
var SYNTAX_KEYFRAMES = { | ||
export var SYNTAX_KEYFRAMES = { | ||
'@keyframes': { | ||
@@ -391,4 +344,3 @@ fade: KEYFRAME_FADE | ||
}; | ||
exports.SYNTAX_KEYFRAMES = SYNTAX_KEYFRAMES; | ||
var SYNTAX_KEYFRAMES_PERCENT = { | ||
export var SYNTAX_KEYFRAMES_PERCENT = { | ||
'@keyframes': { | ||
@@ -398,4 +350,3 @@ slide: KEYFRAME_SLIDE_PERCENT | ||
}; | ||
exports.SYNTAX_KEYFRAMES_PERCENT = SYNTAX_KEYFRAMES_PERCENT; | ||
var SYNTAX_KEYFRAMES_MIXED = { | ||
export var SYNTAX_KEYFRAMES_MIXED = { | ||
'@keyframes': { | ||
@@ -406,4 +357,3 @@ fade: KEYFRAME_FADE, | ||
}; | ||
exports.SYNTAX_KEYFRAMES_MIXED = SYNTAX_KEYFRAMES_MIXED; | ||
var SYNTAX_KEYFRAMES_INLINE = { | ||
export var SYNTAX_KEYFRAMES_INLINE = { | ||
single: { | ||
@@ -420,4 +370,3 @@ animationName: _extends({}, KEYFRAME_SLIDE_PERCENT, { | ||
}; | ||
exports.SYNTAX_KEYFRAMES_INLINE = SYNTAX_KEYFRAMES_INLINE; | ||
var SYNTAX_MEDIA_QUERY = { | ||
export var SYNTAX_MEDIA_QUERY = { | ||
media: { | ||
@@ -438,4 +387,3 @@ color: 'red', | ||
}; | ||
exports.SYNTAX_MEDIA_QUERY = SYNTAX_MEDIA_QUERY; | ||
var SYNTAX_MEDIA_QUERY_NESTED = { | ||
export var SYNTAX_MEDIA_QUERY_NESTED = { | ||
media: { | ||
@@ -455,4 +403,3 @@ color: 'red', | ||
}; | ||
exports.SYNTAX_MEDIA_QUERY_NESTED = SYNTAX_MEDIA_QUERY_NESTED; | ||
var SYNTAX_MULTI_SELECTOR = { | ||
export var SYNTAX_MULTI_SELECTOR = { | ||
multi: { | ||
@@ -467,8 +414,6 @@ cursor: 'pointer', | ||
}; | ||
exports.SYNTAX_MULTI_SELECTOR = SYNTAX_MULTI_SELECTOR; | ||
var SYNTAX_NAMESPACE = { | ||
export var SYNTAX_NAMESPACE = { | ||
'@namespace': 'url(http://www.w3.org/1999/xhtml)' | ||
}; | ||
exports.SYNTAX_NAMESPACE = SYNTAX_NAMESPACE; | ||
var SYNTAX_PAGE = { | ||
export var SYNTAX_PAGE = { | ||
'@page': { | ||
@@ -481,4 +426,3 @@ margin: '1cm', | ||
}; | ||
exports.SYNTAX_PAGE = SYNTAX_PAGE; | ||
var SYNTAX_PROPERTIES = { | ||
export var SYNTAX_PROPERTIES = { | ||
props: { | ||
@@ -491,4 +435,3 @@ color: 'black', | ||
}; | ||
exports.SYNTAX_PROPERTIES = SYNTAX_PROPERTIES; | ||
var SYNTAX_PSEUDO = { | ||
export var SYNTAX_PSEUDO = { | ||
pseudo: { | ||
@@ -504,4 +447,3 @@ position: 'fixed', | ||
}; | ||
exports.SYNTAX_PSEUDO = SYNTAX_PSEUDO; | ||
var SYNTAX_SUPPORTS = { | ||
export var SYNTAX_SUPPORTS = { | ||
sup: { | ||
@@ -519,4 +461,3 @@ display: 'block', | ||
}; | ||
exports.SYNTAX_SUPPORTS = SYNTAX_SUPPORTS; | ||
var SYNTAX_VIEWPORT = { | ||
export var SYNTAX_VIEWPORT = { | ||
'@viewport': { | ||
@@ -527,6 +468,4 @@ width: 'device-width', | ||
}; | ||
exports.SYNTAX_VIEWPORT = SYNTAX_VIEWPORT; | ||
var SYNTAX_RAW_CSS = { | ||
export var SYNTAX_RAW_CSS = { | ||
button: "\n display: 'block';\n font-size: 16px;\n text-align: 'left';\n\n &:hover {\n color: 'red';\n }\n\n & {\n vertical-align: 'middle';\n }\n\n @media (max-width: 600px) {\n display: 'none';\n }\n\n @supports (display: flex) {\n display: 'flex';\n }\n " | ||
}; | ||
exports.SYNTAX_RAW_CSS = SYNTAX_RAW_CSS; | ||
}; |
@@ -1,16 +0,1 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = exports.CLASS_NAME = exports.SELECTOR = void 0; | ||
var _stylis = _interopRequireDefault(require("stylis")); | ||
var _core = require("rtl-css-js/core"); | ||
var _aestheticUtils = require("aesthetic-utils"); | ||
var _Sheet = _interopRequireDefault(require("./Sheet")); | ||
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); } | ||
@@ -20,6 +5,8 @@ | ||
var SELECTOR = /^((\[[\x2Da-z\u017F\u212A]+\])|(::?[\x2Da-z\u017F\u212A]+))$/i; | ||
exports.SELECTOR = SELECTOR; | ||
var CLASS_NAME = /^[a-z\u017F\u212A]{1}[\x2D0-9_a-z\u017F\u212A]+$/i; | ||
exports.CLASS_NAME = CLASS_NAME; | ||
import Stylis from 'stylis'; | ||
import { convertProperty } from 'rtl-css-js/core'; | ||
import { formatFontFace, isObject, isRTL, toArray } from 'aesthetic-utils'; | ||
import Sheet from './Sheet'; | ||
export var SELECTOR = /^((\[[\x2Da-z\u017F\u212A]+\])|(::?[\x2Da-z\u017F\u212A]+))$/i; | ||
export var CLASS_NAME = /^[a-z\u017F\u212A]{1}[\x2D0-9_a-z\u017F\u212A]+$/i; | ||
@@ -38,3 +25,3 @@ function rtlPlugin(context, content) { | ||
var _convertProperty = (0, _core.convertProperty)(rawKey.trim(), unquotedValue.trim()), | ||
var _convertProperty = convertProperty(rawKey.trim(), unquotedValue.trim()), | ||
key = _convertProperty.key, | ||
@@ -79,3 +66,3 @@ value = _convertProperty.value; | ||
var fontFaces = {}; | ||
(0, _aestheticUtils.toArray)(value).forEach(function (item) { | ||
toArray(value).forEach(function (item) { | ||
if (typeof item === 'string') { | ||
@@ -115,3 +102,3 @@ output.add(item); | ||
var sheet = new _Sheet.default(options); | ||
var sheet = new Sheet(options); | ||
Object.keys(globalSheet).forEach(function (rule) { | ||
@@ -137,3 +124,3 @@ switch (rule) { | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!(0, _aestheticUtils.isObject)(faces)) { | ||
if (!isObject(faces)) { | ||
throw new Error('@font-face must be an object of font family names to font faces.'); | ||
@@ -144,3 +131,3 @@ } | ||
Object.keys(faces).forEach(function (fontFamily) { | ||
_this2.convertFontFaces(fontFamily, (0, _aestheticUtils.toArray)(faces[fontFamily]), sheet); | ||
_this2.convertFontFaces(fontFamily, toArray(faces[fontFamily]), sheet); | ||
}); | ||
@@ -155,3 +142,3 @@ break; | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!(0, _aestheticUtils.isObject)(globals)) { | ||
if (!isObject(globals)) { | ||
throw new Error('@global must be an object of selectors to ruleset objects.'); | ||
@@ -162,3 +149,3 @@ } | ||
Object.keys(globals).forEach(function (selector) { | ||
if ((0, _aestheticUtils.isObject)(globals[selector])) { | ||
if (isObject(globals[selector])) { | ||
_this2.emit('global', [sheet, selector, _this2.convertRuleset(globals[selector], sheet.createRuleset(selector))]); | ||
@@ -177,3 +164,3 @@ } else if ("production" !== process.env.NODE_ENV) { | ||
if (typeof _paths === 'string' || Array.isArray(_paths)) { | ||
_this2.emit('import', [sheet, (0, _aestheticUtils.toArray)(_paths).map(function (path) { | ||
_this2.emit('import', [sheet, toArray(_paths).map(function (path) { | ||
return String(path); | ||
@@ -193,3 +180,3 @@ })]); | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!(0, _aestheticUtils.isObject)(frames)) { | ||
if (!isObject(frames)) { | ||
throw new Error('@keyframes must be an object of animation names to keyframes.'); | ||
@@ -210,3 +197,3 @@ } | ||
if ((0, _aestheticUtils.isObject)(style)) { | ||
if (isObject(style)) { | ||
_this2.emit(rule.slice(1), [sheet, _this2.convertRuleset(style, sheet.createRuleset(rule))]); | ||
@@ -234,3 +221,3 @@ } else if ("production" !== process.env.NODE_ENV) { | ||
var sheet = new _Sheet.default(options); | ||
var sheet = new Sheet(options); | ||
Object.keys(styleSheet).forEach(function (selector) { | ||
@@ -253,3 +240,3 @@ var ruleset = styleSheet[selector]; | ||
} | ||
} else if ((0, _aestheticUtils.isObject)(ruleset)) { | ||
} else if (isObject(ruleset)) { | ||
sheet.addRuleset(_this3.convertRuleset(ruleset, sheet.createRuleset(selector))); | ||
@@ -266,3 +253,3 @@ } else if ("production" !== process.env.NODE_ENV) { | ||
var className = styleName + "-" + selector; | ||
var stylis = new _stylis.default({ | ||
var stylis = new Stylis({ | ||
compress: !("production" !== process.env.NODE_ENV), | ||
@@ -274,3 +261,3 @@ global: false, | ||
if ((0, _aestheticUtils.isRTL)(sheet.options.dir)) { | ||
if (isRTL(sheet.options.dir)) { | ||
stylis.use(rtlPlugin); | ||
@@ -287,3 +274,3 @@ } | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!(0, _aestheticUtils.isObject)(unifiedRuleset)) { | ||
if (!isObject(unifiedRuleset)) { | ||
throw new TypeError('Ruleset must be an object of properties.'); | ||
@@ -319,3 +306,3 @@ } | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!(0, _aestheticUtils.isObject)(fallbacks)) { | ||
if (!isObject(fallbacks)) { | ||
throw new Error('@fallbacks must be an object of property names to fallback values.'); | ||
@@ -326,3 +313,3 @@ } | ||
Object.keys(fallbacks).forEach(function (property) { | ||
_this4.emit('fallback', [ruleset, property, (0, _aestheticUtils.toArray)(fallbacks[property])]); | ||
_this4.emit('fallback', [ruleset, property, toArray(fallbacks[property])]); | ||
}); | ||
@@ -338,3 +325,3 @@ break; | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!(0, _aestheticUtils.isObject)(styles)) { | ||
if (!isObject(styles)) { | ||
throw new Error(key + " must be an object of queries to rulesets."); | ||
@@ -345,3 +332,3 @@ } | ||
Object.keys(styles).forEach(function (query) { | ||
if ((0, _aestheticUtils.isObject)(styles[query])) { | ||
if (isObject(styles[query])) { | ||
var event = key === '@media' ? 'media' : 'support'; | ||
@@ -362,3 +349,3 @@ | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!(0, _aestheticUtils.isObject)(selectors)) { | ||
if (!isObject(selectors)) { | ||
throw new Error('@selectors must be an object of selectors to rulesets.'); | ||
@@ -393,3 +380,3 @@ } | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!(0, _aestheticUtils.isObject)(value)) { | ||
if (!isObject(value)) { | ||
throw new Error("Selector \"" + key + "\" must be a ruleset object."); | ||
@@ -421,3 +408,3 @@ } else if ((key.includes(',') || !key.match(SELECTOR)) && !inAtRule) { | ||
srcPaths.push(font.srcPaths); | ||
return _this6.convertRuleset((0, _aestheticUtils.formatFontFace)(_extends({}, font, { | ||
return _this6.convertRuleset(formatFontFace(_extends({}, font, { | ||
fontFamily: fontFamily | ||
@@ -504,2 +491,2 @@ })), sheet.createRuleset(fontFamily)); | ||
exports.default = UnifiedSyntax; | ||
export { UnifiedSyntax as default }; |
@@ -0,1 +1,22 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _extend = _interopRequireDefault(require("extend")); | ||
var _v = _interopRequireDefault(require("uuid/v4")); | ||
var _aestheticUtils = require("aesthetic-utils"); | ||
var _CacheManager = _interopRequireDefault(require("./CacheManager")); | ||
var _Sheet = _interopRequireDefault(require("./Sheet")); | ||
var _StyleSheetManager = _interopRequireDefault(require("./StyleSheetManager")); | ||
var _UnifiedSyntax = _interopRequireDefault(require("./UnifiedSyntax")); | ||
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); } | ||
@@ -5,10 +26,2 @@ | ||
import deepMerge from 'extend'; | ||
import uuid from 'uuid/v4'; | ||
import { isObject, stripClassPrefix } from 'aesthetic-utils'; | ||
import CacheManager from './CacheManager'; | ||
import Sheet from './Sheet'; | ||
import StyleSheetManager from './StyleSheetManager'; | ||
import UnifiedSyntax from './UnifiedSyntax'; | ||
var Aesthetic = function () { | ||
@@ -28,7 +41,7 @@ function Aesthetic(options) { | ||
_defineProperty(this, "syntax", new UnifiedSyntax()); | ||
_defineProperty(this, "syntax", new _UnifiedSyntax.default()); | ||
_defineProperty(this, "themes", {}); | ||
_defineProperty(this, "cacheManager", new CacheManager()); | ||
_defineProperty(this, "cacheManager", new _CacheManager.default()); | ||
@@ -107,3 +120,3 @@ _defineProperty(this, "sheetManager", null); | ||
}); | ||
return deepMerge.apply(void 0, [true, {}].concat(sheets)); | ||
return _extend.default.apply(void 0, [true, {}].concat(sheets)); | ||
}; | ||
@@ -117,3 +130,3 @@ }; | ||
return this.registerTheme(themeName, deepMerge(true, {}, this.getTheme(parentThemeName), theme), globalSheet || this.globals[parentThemeName]); | ||
return this.registerTheme(themeName, (0, _extend.default)(true, {}, this.getTheme(parentThemeName), theme), globalSheet || this.globals[parentThemeName]); | ||
}; | ||
@@ -129,3 +142,3 @@ | ||
if (parentStyleName) { | ||
return deepMerge(true, {}, this.getStyleSheet(parentStyleName, themeName), styleSheet); | ||
return (0, _extend.default)(true, {}, this.getStyleSheet(parentStyleName, themeName), styleSheet); | ||
} | ||
@@ -141,3 +154,3 @@ | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!theme || !isObject(theme)) { | ||
if (!theme || !(0, _aestheticUtils.isObject)(theme)) { | ||
throw new Error("Theme \"" + themeName + "\" does not exist."); | ||
@@ -151,3 +164,3 @@ } | ||
_proto.isParsedBlock = function isParsedBlock(block) { | ||
return isObject(block); | ||
return (0, _aestheticUtils.isObject)(block); | ||
}; | ||
@@ -186,3 +199,3 @@ | ||
throw new Error("Theme \"" + themeName + "\" already exists."); | ||
} else if (!isObject(theme)) { | ||
} else if (!(0, _aestheticUtils.isObject)(theme)) { | ||
throw new TypeError("Theme \"" + themeName + "\" must be a style object."); | ||
@@ -212,5 +225,5 @@ } | ||
classNames.push.apply(classNames, String(style).split(' ').map(function (s) { | ||
return stripClassPrefix(s).trim(); | ||
return (0, _aestheticUtils.stripClassPrefix)(s).trim(); | ||
})); | ||
} else if (isObject(style)) { | ||
} else if ((0, _aestheticUtils.isObject)(style)) { | ||
if (_this.isParsedBlock(style)) { | ||
@@ -227,5 +240,5 @@ parsedBlocks.push(style); | ||
if (nativeBlocks.length > 0) { | ||
var nativeSheet = new Sheet(options); | ||
var nativeSheet = new _Sheet.default(options); | ||
var counter = 0; | ||
inlineName = uuid(); | ||
inlineName = (0, _v.default)(); | ||
nativeBlocks.forEach(function (block) { | ||
@@ -268,3 +281,3 @@ nativeSheet.addRuleset(nativeSheet.createRuleset("inline-" + counter).addProperties(block)); | ||
this.sheetManager = new StyleSheetManager(); | ||
this.sheetManager = new _StyleSheetManager.default(); | ||
return this.sheetManager; | ||
@@ -288,2 +301,2 @@ }; | ||
export { Aesthetic as default }; | ||
exports.default = Aesthetic; |
@@ -0,1 +1,6 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
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); } | ||
@@ -43,2 +48,2 @@ | ||
export { CacheManager as default }; | ||
exports.default = CacheManager; |
@@ -0,5 +1,12 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _Aesthetic2 = _interopRequireDefault(require("./Aesthetic")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
import Aesthetic from './Aesthetic'; | ||
var ClassNameAesthetic = function (_Aesthetic) { | ||
@@ -21,4 +28,4 @@ _inheritsLoose(ClassNameAesthetic, _Aesthetic); | ||
return ClassNameAesthetic; | ||
}(Aesthetic); | ||
}(_Aesthetic2.default); | ||
export { ClassNameAesthetic as default }; | ||
exports.default = ClassNameAesthetic; |
@@ -0,1 +1,40 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
var _exportNames = { | ||
ClassNameAesthetic: true, | ||
UnifiedSyntax: true, | ||
Ruleset: true, | ||
Sheet: true | ||
}; | ||
exports.default = void 0; | ||
var _Aesthetic = _interopRequireDefault(require("./Aesthetic")); | ||
var _ClassNameAesthetic = _interopRequireDefault(require("./ClassNameAesthetic")); | ||
exports.ClassNameAesthetic = _ClassNameAesthetic.default; | ||
var _UnifiedSyntax = _interopRequireDefault(require("./UnifiedSyntax")); | ||
exports.UnifiedSyntax = _UnifiedSyntax.default; | ||
var _Ruleset = _interopRequireDefault(require("./Ruleset")); | ||
exports.Ruleset = _Ruleset.default; | ||
var _Sheet = _interopRequireDefault(require("./Sheet")); | ||
exports.Sheet = _Sheet.default; | ||
var _types = require("./types"); | ||
Object.keys(_types).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
exports[key] = _types[key]; | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -5,9 +44,3 @@ * @copyright 2017-2019, Miles Johnson | ||
*/ | ||
import Aesthetic from './Aesthetic'; | ||
import ClassNameAesthetic from './ClassNameAesthetic'; | ||
import UnifiedSyntax from './UnifiedSyntax'; | ||
import Ruleset from './Ruleset'; | ||
import Sheet from './Sheet'; | ||
export * from './types'; | ||
export { ClassNameAesthetic, UnifiedSyntax, Ruleset, Sheet }; | ||
export default Aesthetic; | ||
var _default = _Aesthetic.default; | ||
exports.default = _default; |
@@ -0,1 +1,12 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _rtlCssJs = _interopRequireDefault(require("rtl-css-js")); | ||
var _aestheticUtils = require("aesthetic-utils"); | ||
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); } | ||
@@ -5,5 +16,2 @@ | ||
import convertRTL from 'rtl-css-js'; | ||
import { isRTL, toObjectRecursive } from 'aesthetic-utils'; | ||
var Ruleset = function () { | ||
@@ -78,3 +86,3 @@ function Ruleset(selector, root, parent) { | ||
_proto.toObject = function toObject() { | ||
var props = isRTL(this.root.options.dir) ? convertRTL(this.properties) : this.properties; | ||
var props = (0, _aestheticUtils.isRTL)(this.root.options.dir) ? (0, _rtlCssJs.default)(this.properties) : this.properties; | ||
var compounds = {}; | ||
@@ -84,3 +92,3 @@ this.compoundProperties.forEach(function (compound, key) { | ||
}); | ||
return _extends({}, props, compounds, toObjectRecursive(this.nested)); | ||
return _extends({}, props, compounds, (0, _aestheticUtils.toObjectRecursive)(this.nested)); | ||
}; | ||
@@ -91,2 +99,2 @@ | ||
export { Ruleset as default }; | ||
exports.default = Ruleset; |
@@ -0,1 +1,12 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _aestheticUtils = require("aesthetic-utils"); | ||
var _Ruleset = _interopRequireDefault(require("./Ruleset")); | ||
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); } | ||
@@ -5,5 +16,2 @@ | ||
import { toObjectRecursive } from 'aesthetic-utils'; | ||
import Ruleset from './Ruleset'; | ||
var Sheet = function () { | ||
@@ -44,3 +52,3 @@ function Sheet(options) { | ||
_proto.createRuleset = function createRuleset(selector) { | ||
return new Ruleset(selector, this); | ||
return new _Ruleset.default(selector, this); | ||
}; | ||
@@ -60,7 +68,7 @@ | ||
if (value instanceof Sheet || value instanceof Ruleset) { | ||
if (value instanceof Sheet || value instanceof _Ruleset.default) { | ||
sets[key] = value; | ||
} else if (Array.isArray(value)) { | ||
atRules[key] = value.map(function (item) { | ||
return item instanceof Ruleset ? item.toObject() : item; | ||
return item instanceof _Ruleset.default ? item.toObject() : item; | ||
}); | ||
@@ -71,3 +79,3 @@ } else { | ||
}); | ||
return _extends({}, atRules, toObjectRecursive(sets), toObjectRecursive(this.ruleSets)); | ||
return _extends({}, atRules, (0, _aestheticUtils.toObjectRecursive)(sets), (0, _aestheticUtils.toObjectRecursive)(this.ruleSets)); | ||
}; | ||
@@ -78,2 +86,2 @@ | ||
export { Sheet as default }; | ||
exports.default = Sheet; |
@@ -0,5 +1,10 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _aestheticUtils = require("aesthetic-utils"); | ||
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; } | ||
import { getFlushedStyles as _getFlushedStyles, purgeStyles as _purgeStyles } from 'aesthetic-utils'; | ||
var StyleSheetManager = function () { | ||
@@ -22,3 +27,3 @@ function StyleSheetManager() { | ||
_proto.getFlushedStyles = function getFlushedStyles() { | ||
return _getFlushedStyles(this.element); | ||
return (0, _aestheticUtils.getFlushedStyles)(this.element); | ||
}; | ||
@@ -37,4 +42,3 @@ | ||
_proto.purgeStyles = function purgeStyles() { | ||
_purgeStyles(this.element); | ||
(0, _aestheticUtils.purgeStyles)(this.element); | ||
return this; | ||
@@ -46,2 +50,2 @@ }; | ||
export { StyleSheetManager as default }; | ||
exports.default = StyleSheetManager; |
@@ -0,1 +1,21 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.registerTestTheme = registerTestTheme; | ||
exports.cleanupStyleElements = cleanupStyleElements; | ||
exports.getFlushedStyles = getFlushedStyles; | ||
exports.convertDirection = convertDirection; | ||
exports.renderAndExpect = renderAndExpect; | ||
exports.SYNTAX_RAW_CSS = exports.SYNTAX_VIEWPORT = exports.SYNTAX_SUPPORTS = exports.SYNTAX_PSEUDO = exports.SYNTAX_PROPERTIES = exports.SYNTAX_PAGE = exports.SYNTAX_NAMESPACE = exports.SYNTAX_MULTI_SELECTOR = exports.SYNTAX_MEDIA_QUERY_NESTED = exports.SYNTAX_MEDIA_QUERY = exports.SYNTAX_KEYFRAMES_INLINE = exports.SYNTAX_KEYFRAMES_MIXED = exports.SYNTAX_KEYFRAMES_PERCENT = exports.SYNTAX_KEYFRAMES = exports.SYNTAX_GLOBAL = exports.SYNTAX_FONT_FACES_INLINE = exports.SYNTAX_FONT_FACE_MIXED = exports.SYNTAX_FONT_FACE_MULTIPLE = exports.SYNTAX_FONT_FACE = exports.SYNTAX_FALLBACKS = exports.SYNTAX_IMPORT_MULTIPLE = exports.SYNTAX_IMPORT = exports.SYNTAX_DESCENDANT = exports.SYNTAX_CHARSET = exports.SYNTAX_ATTRIBUTE = exports.SYNTAX_UNIFIED_LOCAL_FULL = exports.SYNTAX_UNIFIED_GLOBAL_FULL = exports.SYNTAX_UNIFIED_LOCAL = exports.KEYFRAME_SLIDE_PERCENT = exports.KEYFRAME_FADE = exports.FONT_CIRCULAR_MULTIPLE_FLAT_SRC = exports.FONT_CIRCULAR_MULTIPLE = exports.FONT_ROBOTO_FLAT_SRC = exports.FONT_ROBOTO = exports.DIRECTIONS = exports.TEST_STATEMENT = exports.TEST_CLASS_NAMES = exports.TestAesthetic = void 0; | ||
var _rtlCssJs = _interopRequireDefault(require("rtl-css-js")); | ||
var _aestheticUtils = require("aesthetic-utils"); | ||
exports.getStyleElements = _aestheticUtils.getStyleElements; | ||
var _Aesthetic2 = _interopRequireDefault(require("./Aesthetic")); | ||
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); } | ||
@@ -5,7 +25,3 @@ | ||
import convertRTL from 'rtl-css-js'; | ||
import { getFlushedStyles as getBaseFlushedStyles, getStyleElements, isObject } from 'aesthetic-utils'; | ||
import Aesthetic from './Aesthetic'; | ||
export { getStyleElements }; | ||
export var TestAesthetic = function (_Aesthetic) { | ||
var TestAesthetic = function (_Aesthetic) { | ||
_inheritsLoose(TestAesthetic, _Aesthetic); | ||
@@ -26,4 +42,7 @@ | ||
return TestAesthetic; | ||
}(Aesthetic); | ||
export function registerTestTheme(aesthetic) { | ||
}(_Aesthetic2.default); | ||
exports.TestAesthetic = TestAesthetic; | ||
function registerTestTheme(aesthetic) { | ||
aesthetic.registerTheme('default', { | ||
@@ -45,11 +64,14 @@ color: 'black', | ||
} | ||
export function cleanupStyleElements() { | ||
getStyleElements().forEach(function (style) { | ||
function cleanupStyleElements() { | ||
(0, _aestheticUtils.getStyleElements)().forEach(function (style) { | ||
style.remove(); | ||
}); | ||
} | ||
export function getFlushedStyles(namespace) { | ||
return getBaseFlushedStyles(getStyleElements(namespace)); | ||
function getFlushedStyles(namespace) { | ||
return (0, _aestheticUtils.getFlushedStyles)((0, _aestheticUtils.getStyleElements)(namespace)); | ||
} | ||
export function convertDirection(value, dir) { | ||
function convertDirection(value, dir) { | ||
if (dir !== 'rtl') { | ||
@@ -65,3 +87,3 @@ return value; | ||
if (!isObject(value)) { | ||
if (!(0, _aestheticUtils.isObject)(value)) { | ||
return value; | ||
@@ -75,3 +97,3 @@ } | ||
if (isObject(prop) || Array.isArray(prop)) { | ||
if ((0, _aestheticUtils.isObject)(prop) || Array.isArray(prop)) { | ||
nested[key] = convertDirection(prop, dir); | ||
@@ -82,5 +104,6 @@ } else { | ||
}); | ||
return _extends({}, convertRTL(props), nested); | ||
return _extends({}, (0, _rtlCssJs.default)(props), nested); | ||
} | ||
export function renderAndExpect(aesthetic, styleSheet, expectedStyles, _ref2) { | ||
function renderAndExpect(aesthetic, styleSheet, expectedStyles, _ref2) { | ||
if (expectedStyles === void 0) { | ||
@@ -106,7 +129,9 @@ expectedStyles = {}; | ||
} | ||
export var TEST_CLASS_NAMES = { | ||
var TEST_CLASS_NAMES = { | ||
footer: '.footer', | ||
header: '.header' | ||
}; | ||
export var TEST_STATEMENT = { | ||
exports.TEST_CLASS_NAMES = TEST_CLASS_NAMES; | ||
var TEST_STATEMENT = { | ||
footer: { | ||
@@ -119,4 +144,6 @@ color: 'blue' | ||
}; | ||
export var DIRECTIONS = ['ltr', 'rtl']; | ||
export var FONT_ROBOTO = { | ||
exports.TEST_STATEMENT = TEST_STATEMENT; | ||
var DIRECTIONS = ['ltr', 'rtl']; | ||
exports.DIRECTIONS = DIRECTIONS; | ||
var FONT_ROBOTO = { | ||
fontFamily: 'Roboto', | ||
@@ -128,3 +155,4 @@ fontStyle: 'normal', | ||
}; | ||
export var FONT_ROBOTO_FLAT_SRC = { | ||
exports.FONT_ROBOTO = FONT_ROBOTO; | ||
var FONT_ROBOTO_FLAT_SRC = { | ||
fontFamily: 'Roboto', | ||
@@ -135,3 +163,4 @@ fontStyle: 'normal', | ||
}; | ||
export var FONT_CIRCULAR_MULTIPLE = [{ | ||
exports.FONT_ROBOTO_FLAT_SRC = FONT_ROBOTO_FLAT_SRC; | ||
var FONT_CIRCULAR_MULTIPLE = [{ | ||
fontFamily: 'Circular', | ||
@@ -157,3 +186,4 @@ fontStyle: 'normal', | ||
}]; | ||
export var FONT_CIRCULAR_MULTIPLE_FLAT_SRC = [{ | ||
exports.FONT_CIRCULAR_MULTIPLE = FONT_CIRCULAR_MULTIPLE; | ||
var FONT_CIRCULAR_MULTIPLE_FLAT_SRC = [{ | ||
fontFamily: 'Circular', | ||
@@ -179,3 +209,4 @@ fontStyle: 'normal', | ||
}]; | ||
export var KEYFRAME_FADE = { | ||
exports.FONT_CIRCULAR_MULTIPLE_FLAT_SRC = FONT_CIRCULAR_MULTIPLE_FLAT_SRC; | ||
var KEYFRAME_FADE = { | ||
from: { | ||
@@ -188,3 +219,4 @@ opacity: 0 | ||
}; | ||
export var KEYFRAME_SLIDE_PERCENT = { | ||
exports.KEYFRAME_FADE = KEYFRAME_FADE; | ||
var KEYFRAME_SLIDE_PERCENT = { | ||
'0%': { | ||
@@ -200,3 +232,4 @@ left: '0%' | ||
}; | ||
export var SYNTAX_UNIFIED_LOCAL = { | ||
exports.KEYFRAME_SLIDE_PERCENT = KEYFRAME_SLIDE_PERCENT; | ||
var SYNTAX_UNIFIED_LOCAL = { | ||
button: { | ||
@@ -232,3 +265,4 @@ margin: 0, | ||
}; | ||
export var SYNTAX_UNIFIED_GLOBAL_FULL = { | ||
exports.SYNTAX_UNIFIED_LOCAL = SYNTAX_UNIFIED_LOCAL; | ||
var SYNTAX_UNIFIED_GLOBAL_FULL = { | ||
'@font-face': { | ||
@@ -241,3 +275,4 @@ Roboto: FONT_ROBOTO | ||
}; | ||
export var SYNTAX_UNIFIED_LOCAL_FULL = { | ||
exports.SYNTAX_UNIFIED_GLOBAL_FULL = SYNTAX_UNIFIED_GLOBAL_FULL; | ||
var SYNTAX_UNIFIED_LOCAL_FULL = { | ||
button: _extends({}, SYNTAX_UNIFIED_LOCAL.button, { | ||
@@ -251,3 +286,4 @@ '@media': { | ||
}; | ||
export var SYNTAX_ATTRIBUTE = { | ||
exports.SYNTAX_UNIFIED_LOCAL_FULL = SYNTAX_UNIFIED_LOCAL_FULL; | ||
var SYNTAX_ATTRIBUTE = { | ||
attr: { | ||
@@ -260,6 +296,8 @@ display: 'block', | ||
}; | ||
export var SYNTAX_CHARSET = { | ||
exports.SYNTAX_ATTRIBUTE = SYNTAX_ATTRIBUTE; | ||
var SYNTAX_CHARSET = { | ||
'@charset': 'utf8' | ||
}; | ||
export var SYNTAX_DESCENDANT = { | ||
exports.SYNTAX_CHARSET = SYNTAX_CHARSET; | ||
var SYNTAX_DESCENDANT = { | ||
list: { | ||
@@ -275,9 +313,12 @@ margin: 0, | ||
}; | ||
export var SYNTAX_IMPORT = { | ||
exports.SYNTAX_DESCENDANT = SYNTAX_DESCENDANT; | ||
var SYNTAX_IMPORT = { | ||
'@import': 'url("./some/path.css")' | ||
}; | ||
export var SYNTAX_IMPORT_MULTIPLE = { | ||
exports.SYNTAX_IMPORT = SYNTAX_IMPORT; | ||
var SYNTAX_IMPORT_MULTIPLE = { | ||
'@import': ['url("./some/path.css")', 'url("./another/path.css")'] | ||
}; | ||
export var SYNTAX_FALLBACKS = { | ||
exports.SYNTAX_IMPORT_MULTIPLE = SYNTAX_IMPORT_MULTIPLE; | ||
var SYNTAX_FALLBACKS = { | ||
fallback: { | ||
@@ -293,3 +334,4 @@ background: 'linear-gradient(...)', | ||
}; | ||
export var SYNTAX_FONT_FACE = { | ||
exports.SYNTAX_FALLBACKS = SYNTAX_FALLBACKS; | ||
var SYNTAX_FONT_FACE = { | ||
'@font-face': { | ||
@@ -299,3 +341,4 @@ Roboto: [FONT_ROBOTO] | ||
}; | ||
export var SYNTAX_FONT_FACE_MULTIPLE = { | ||
exports.SYNTAX_FONT_FACE = SYNTAX_FONT_FACE; | ||
var SYNTAX_FONT_FACE_MULTIPLE = { | ||
'@font-face': { | ||
@@ -305,3 +348,4 @@ Circular: FONT_CIRCULAR_MULTIPLE | ||
}; | ||
export var SYNTAX_FONT_FACE_MIXED = { | ||
exports.SYNTAX_FONT_FACE_MULTIPLE = SYNTAX_FONT_FACE_MULTIPLE; | ||
var SYNTAX_FONT_FACE_MIXED = { | ||
'@font-face': { | ||
@@ -312,3 +356,4 @@ Roboto: [FONT_ROBOTO], | ||
}; | ||
export var SYNTAX_FONT_FACES_INLINE = { | ||
exports.SYNTAX_FONT_FACE_MIXED = SYNTAX_FONT_FACE_MIXED; | ||
var SYNTAX_FONT_FACES_INLINE = { | ||
single: { | ||
@@ -321,3 +366,4 @@ fontFamily: FONT_ROBOTO | ||
}; | ||
export var SYNTAX_GLOBAL = { | ||
exports.SYNTAX_FONT_FACES_INLINE = SYNTAX_FONT_FACES_INLINE; | ||
var SYNTAX_GLOBAL = { | ||
'@global': { | ||
@@ -338,3 +384,4 @@ body: { | ||
}; | ||
export var SYNTAX_KEYFRAMES = { | ||
exports.SYNTAX_GLOBAL = SYNTAX_GLOBAL; | ||
var SYNTAX_KEYFRAMES = { | ||
'@keyframes': { | ||
@@ -344,3 +391,4 @@ fade: KEYFRAME_FADE | ||
}; | ||
export var SYNTAX_KEYFRAMES_PERCENT = { | ||
exports.SYNTAX_KEYFRAMES = SYNTAX_KEYFRAMES; | ||
var SYNTAX_KEYFRAMES_PERCENT = { | ||
'@keyframes': { | ||
@@ -350,3 +398,4 @@ slide: KEYFRAME_SLIDE_PERCENT | ||
}; | ||
export var SYNTAX_KEYFRAMES_MIXED = { | ||
exports.SYNTAX_KEYFRAMES_PERCENT = SYNTAX_KEYFRAMES_PERCENT; | ||
var SYNTAX_KEYFRAMES_MIXED = { | ||
'@keyframes': { | ||
@@ -357,3 +406,4 @@ fade: KEYFRAME_FADE, | ||
}; | ||
export var SYNTAX_KEYFRAMES_INLINE = { | ||
exports.SYNTAX_KEYFRAMES_MIXED = SYNTAX_KEYFRAMES_MIXED; | ||
var SYNTAX_KEYFRAMES_INLINE = { | ||
single: { | ||
@@ -370,3 +420,4 @@ animationName: _extends({}, KEYFRAME_SLIDE_PERCENT, { | ||
}; | ||
export var SYNTAX_MEDIA_QUERY = { | ||
exports.SYNTAX_KEYFRAMES_INLINE = SYNTAX_KEYFRAMES_INLINE; | ||
var SYNTAX_MEDIA_QUERY = { | ||
media: { | ||
@@ -387,3 +438,4 @@ color: 'red', | ||
}; | ||
export var SYNTAX_MEDIA_QUERY_NESTED = { | ||
exports.SYNTAX_MEDIA_QUERY = SYNTAX_MEDIA_QUERY; | ||
var SYNTAX_MEDIA_QUERY_NESTED = { | ||
media: { | ||
@@ -403,3 +455,4 @@ color: 'red', | ||
}; | ||
export var SYNTAX_MULTI_SELECTOR = { | ||
exports.SYNTAX_MEDIA_QUERY_NESTED = SYNTAX_MEDIA_QUERY_NESTED; | ||
var SYNTAX_MULTI_SELECTOR = { | ||
multi: { | ||
@@ -414,6 +467,8 @@ cursor: 'pointer', | ||
}; | ||
export var SYNTAX_NAMESPACE = { | ||
exports.SYNTAX_MULTI_SELECTOR = SYNTAX_MULTI_SELECTOR; | ||
var SYNTAX_NAMESPACE = { | ||
'@namespace': 'url(http://www.w3.org/1999/xhtml)' | ||
}; | ||
export var SYNTAX_PAGE = { | ||
exports.SYNTAX_NAMESPACE = SYNTAX_NAMESPACE; | ||
var SYNTAX_PAGE = { | ||
'@page': { | ||
@@ -426,3 +481,4 @@ margin: '1cm', | ||
}; | ||
export var SYNTAX_PROPERTIES = { | ||
exports.SYNTAX_PAGE = SYNTAX_PAGE; | ||
var SYNTAX_PROPERTIES = { | ||
props: { | ||
@@ -435,3 +491,4 @@ color: 'black', | ||
}; | ||
export var SYNTAX_PSEUDO = { | ||
exports.SYNTAX_PROPERTIES = SYNTAX_PROPERTIES; | ||
var SYNTAX_PSEUDO = { | ||
pseudo: { | ||
@@ -447,3 +504,4 @@ position: 'fixed', | ||
}; | ||
export var SYNTAX_SUPPORTS = { | ||
exports.SYNTAX_PSEUDO = SYNTAX_PSEUDO; | ||
var SYNTAX_SUPPORTS = { | ||
sup: { | ||
@@ -461,3 +519,4 @@ display: 'block', | ||
}; | ||
export var SYNTAX_VIEWPORT = { | ||
exports.SYNTAX_SUPPORTS = SYNTAX_SUPPORTS; | ||
var SYNTAX_VIEWPORT = { | ||
'@viewport': { | ||
@@ -468,4 +527,6 @@ width: 'device-width', | ||
}; | ||
export var SYNTAX_RAW_CSS = { | ||
exports.SYNTAX_VIEWPORT = SYNTAX_VIEWPORT; | ||
var SYNTAX_RAW_CSS = { | ||
button: "\n display: 'block';\n font-size: 16px;\n text-align: 'left';\n\n &:hover {\n color: 'red';\n }\n\n & {\n vertical-align: 'middle';\n }\n\n @media (max-width: 600px) {\n display: 'none';\n }\n\n @supports (display: flex) {\n display: 'flex';\n }\n " | ||
}; | ||
}; | ||
exports.SYNTAX_RAW_CSS = SYNTAX_RAW_CSS; |
@@ -0,1 +1,16 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = exports.CLASS_NAME = exports.SELECTOR = void 0; | ||
var _stylis = _interopRequireDefault(require("stylis")); | ||
var _core = require("rtl-css-js/core"); | ||
var _aestheticUtils = require("aesthetic-utils"); | ||
var _Sheet = _interopRequireDefault(require("./Sheet")); | ||
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); } | ||
@@ -5,8 +20,6 @@ | ||
import Stylis from 'stylis'; | ||
import { convertProperty } from 'rtl-css-js/core'; | ||
import { formatFontFace, isObject, isRTL, toArray } from 'aesthetic-utils'; | ||
import Sheet from './Sheet'; | ||
export var SELECTOR = /^((\[[\x2Da-z\u017F\u212A]+\])|(::?[\x2Da-z\u017F\u212A]+))$/i; | ||
export var CLASS_NAME = /^[a-z\u017F\u212A]{1}[\x2D0-9_a-z\u017F\u212A]+$/i; | ||
var SELECTOR = /^((\[[\x2Da-z\u017F\u212A]+\])|(::?[\x2Da-z\u017F\u212A]+))$/i; | ||
exports.SELECTOR = SELECTOR; | ||
var CLASS_NAME = /^[a-z\u017F\u212A]{1}[\x2D0-9_a-z\u017F\u212A]+$/i; | ||
exports.CLASS_NAME = CLASS_NAME; | ||
@@ -25,3 +38,3 @@ function rtlPlugin(context, content) { | ||
var _convertProperty = convertProperty(rawKey.trim(), unquotedValue.trim()), | ||
var _convertProperty = (0, _core.convertProperty)(rawKey.trim(), unquotedValue.trim()), | ||
key = _convertProperty.key, | ||
@@ -66,3 +79,3 @@ value = _convertProperty.value; | ||
var fontFaces = {}; | ||
toArray(value).forEach(function (item) { | ||
(0, _aestheticUtils.toArray)(value).forEach(function (item) { | ||
if (typeof item === 'string') { | ||
@@ -102,3 +115,3 @@ output.add(item); | ||
var sheet = new Sheet(options); | ||
var sheet = new _Sheet.default(options); | ||
Object.keys(globalSheet).forEach(function (rule) { | ||
@@ -124,3 +137,3 @@ switch (rule) { | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!isObject(faces)) { | ||
if (!(0, _aestheticUtils.isObject)(faces)) { | ||
throw new Error('@font-face must be an object of font family names to font faces.'); | ||
@@ -131,3 +144,3 @@ } | ||
Object.keys(faces).forEach(function (fontFamily) { | ||
_this2.convertFontFaces(fontFamily, toArray(faces[fontFamily]), sheet); | ||
_this2.convertFontFaces(fontFamily, (0, _aestheticUtils.toArray)(faces[fontFamily]), sheet); | ||
}); | ||
@@ -142,3 +155,3 @@ break; | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!isObject(globals)) { | ||
if (!(0, _aestheticUtils.isObject)(globals)) { | ||
throw new Error('@global must be an object of selectors to ruleset objects.'); | ||
@@ -149,3 +162,3 @@ } | ||
Object.keys(globals).forEach(function (selector) { | ||
if (isObject(globals[selector])) { | ||
if ((0, _aestheticUtils.isObject)(globals[selector])) { | ||
_this2.emit('global', [sheet, selector, _this2.convertRuleset(globals[selector], sheet.createRuleset(selector))]); | ||
@@ -164,3 +177,3 @@ } else if ("production" !== process.env.NODE_ENV) { | ||
if (typeof _paths === 'string' || Array.isArray(_paths)) { | ||
_this2.emit('import', [sheet, toArray(_paths).map(function (path) { | ||
_this2.emit('import', [sheet, (0, _aestheticUtils.toArray)(_paths).map(function (path) { | ||
return String(path); | ||
@@ -180,3 +193,3 @@ })]); | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!isObject(frames)) { | ||
if (!(0, _aestheticUtils.isObject)(frames)) { | ||
throw new Error('@keyframes must be an object of animation names to keyframes.'); | ||
@@ -197,3 +210,3 @@ } | ||
if (isObject(style)) { | ||
if ((0, _aestheticUtils.isObject)(style)) { | ||
_this2.emit(rule.slice(1), [sheet, _this2.convertRuleset(style, sheet.createRuleset(rule))]); | ||
@@ -221,3 +234,3 @@ } else if ("production" !== process.env.NODE_ENV) { | ||
var sheet = new Sheet(options); | ||
var sheet = new _Sheet.default(options); | ||
Object.keys(styleSheet).forEach(function (selector) { | ||
@@ -240,3 +253,3 @@ var ruleset = styleSheet[selector]; | ||
} | ||
} else if (isObject(ruleset)) { | ||
} else if ((0, _aestheticUtils.isObject)(ruleset)) { | ||
sheet.addRuleset(_this3.convertRuleset(ruleset, sheet.createRuleset(selector))); | ||
@@ -253,3 +266,3 @@ } else if ("production" !== process.env.NODE_ENV) { | ||
var className = styleName + "-" + selector; | ||
var stylis = new Stylis({ | ||
var stylis = new _stylis.default({ | ||
compress: !("production" !== process.env.NODE_ENV), | ||
@@ -261,3 +274,3 @@ global: false, | ||
if (isRTL(sheet.options.dir)) { | ||
if ((0, _aestheticUtils.isRTL)(sheet.options.dir)) { | ||
stylis.use(rtlPlugin); | ||
@@ -274,3 +287,3 @@ } | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!isObject(unifiedRuleset)) { | ||
if (!(0, _aestheticUtils.isObject)(unifiedRuleset)) { | ||
throw new TypeError('Ruleset must be an object of properties.'); | ||
@@ -306,3 +319,3 @@ } | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!isObject(fallbacks)) { | ||
if (!(0, _aestheticUtils.isObject)(fallbacks)) { | ||
throw new Error('@fallbacks must be an object of property names to fallback values.'); | ||
@@ -313,3 +326,3 @@ } | ||
Object.keys(fallbacks).forEach(function (property) { | ||
_this4.emit('fallback', [ruleset, property, toArray(fallbacks[property])]); | ||
_this4.emit('fallback', [ruleset, property, (0, _aestheticUtils.toArray)(fallbacks[property])]); | ||
}); | ||
@@ -325,3 +338,3 @@ break; | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!isObject(styles)) { | ||
if (!(0, _aestheticUtils.isObject)(styles)) { | ||
throw new Error(key + " must be an object of queries to rulesets."); | ||
@@ -332,3 +345,3 @@ } | ||
Object.keys(styles).forEach(function (query) { | ||
if (isObject(styles[query])) { | ||
if ((0, _aestheticUtils.isObject)(styles[query])) { | ||
var event = key === '@media' ? 'media' : 'support'; | ||
@@ -349,3 +362,3 @@ | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!isObject(selectors)) { | ||
if (!(0, _aestheticUtils.isObject)(selectors)) { | ||
throw new Error('@selectors must be an object of selectors to rulesets.'); | ||
@@ -380,3 +393,3 @@ } | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!isObject(value)) { | ||
if (!(0, _aestheticUtils.isObject)(value)) { | ||
throw new Error("Selector \"" + key + "\" must be a ruleset object."); | ||
@@ -408,3 +421,3 @@ } else if ((key.includes(',') || !key.match(SELECTOR)) && !inAtRule) { | ||
srcPaths.push(font.srcPaths); | ||
return _this6.convertRuleset(formatFontFace(_extends({}, font, { | ||
return _this6.convertRuleset((0, _aestheticUtils.formatFontFace)(_extends({}, font, { | ||
fontFamily: fontFamily | ||
@@ -491,2 +504,2 @@ })), sheet.createRuleset(fontFamily)); | ||
export { UnifiedSyntax as default }; | ||
exports.default = UnifiedSyntax; |
{ | ||
"name": "aesthetic", | ||
"version": "4.0.0-alpha.6", | ||
"version": "4.0.0-alpha.7", | ||
"description": "Aesthetic is a powerful type-safe, framework agnostic, CSS-in-JS library for styling components through the use of adapters.", | ||
@@ -30,3 +30,3 @@ "keywords": [ | ||
"dependencies": { | ||
"aesthetic-utils": "^2.0.0-alpha.5", | ||
"aesthetic-utils": "^2.0.0-alpha.6", | ||
"csstype": "^2.6.5", | ||
@@ -43,3 +43,3 @@ "extend": "^3.0.2", | ||
}, | ||
"gitHead": "5526792431adeebc7d8ec1420627fbd20d51cc84" | ||
"gitHead": "8a8e92b75a056555209a0690098d0fa855fd1cf3" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
0
153404
44