@vanilla-extract/css
Advanced tools
Comparing version 0.0.0-babel-modern-20231227140935 to 0.0.0-const-regexes-20240813051516
@@ -5,3 +5,3 @@ 'use strict'; | ||
const mockAdapter = { | ||
var mockAdapter = { | ||
appendCss: () => {}, | ||
@@ -14,4 +14,4 @@ registerClassName: () => {}, | ||
}; | ||
const adapterStack = [mockAdapter]; | ||
const currentAdapter = () => { | ||
var adapterStack = [mockAdapter]; | ||
var currentAdapter = () => { | ||
if (adapterStack.length < 1) { | ||
@@ -22,4 +22,4 @@ throw new Error('No adapter configured'); | ||
}; | ||
let hasConfiguredAdapter = false; | ||
const setAdapterIfNotSet = newAdapter => { | ||
var hasConfiguredAdapter = false; | ||
var setAdapterIfNotSet = newAdapter => { | ||
if (!hasConfiguredAdapter) { | ||
@@ -29,3 +29,3 @@ setAdapter(newAdapter); | ||
}; | ||
const setAdapter = newAdapter => { | ||
var setAdapter = newAdapter => { | ||
if (!newAdapter) { | ||
@@ -37,25 +37,29 @@ throw new Error('No adapter provided when calling "setAdapter"'); | ||
}; | ||
const removeAdapter = () => { | ||
var removeAdapter = () => { | ||
adapterStack.pop(); | ||
}; | ||
const appendCss = (...props) => { | ||
return currentAdapter().appendCss(...props); | ||
var appendCss = function appendCss() { | ||
return currentAdapter().appendCss(...arguments); | ||
}; | ||
const registerClassName = (...props) => { | ||
return currentAdapter().registerClassName(...props); | ||
var registerClassName = function registerClassName() { | ||
return currentAdapter().registerClassName(...arguments); | ||
}; | ||
const registerComposition = (...props) => { | ||
return currentAdapter().registerComposition(...props); | ||
var registerComposition = function registerComposition() { | ||
return currentAdapter().registerComposition(...arguments); | ||
}; | ||
const markCompositionUsed = (...props) => { | ||
return currentAdapter().markCompositionUsed(...props); | ||
var markCompositionUsed = function markCompositionUsed() { | ||
return currentAdapter().markCompositionUsed(...arguments); | ||
}; | ||
const onBeginFileScope = (...props) => { | ||
return currentAdapter().onBeginFileScope?.(...props); | ||
var onBeginFileScope = function onBeginFileScope() { | ||
var _currentAdapter$onBeg, _currentAdapter; | ||
for (var _len = arguments.length, props = new Array(_len), _key = 0; _key < _len; _key++) { | ||
props[_key] = arguments[_key]; | ||
} | ||
return (_currentAdapter$onBeg = (_currentAdapter = currentAdapter()).onBeginFileScope) === null || _currentAdapter$onBeg === void 0 ? void 0 : _currentAdapter$onBeg.call(_currentAdapter, ...props); | ||
}; | ||
const onEndFileScope = (...props) => { | ||
return currentAdapter().onEndFileScope(...props); | ||
var onEndFileScope = function onEndFileScope() { | ||
return currentAdapter().onEndFileScope(...arguments); | ||
}; | ||
const getIdentOption = (...props) => { | ||
const adapter = currentAdapter(); | ||
var getIdentOption = function getIdentOption() { | ||
var adapter = currentAdapter(); | ||
@@ -66,3 +70,3 @@ // Backwards compatibility with old versions of the integration package | ||
} | ||
return adapter.getIdentOption(...props); | ||
return adapter.getIdentOption(...arguments); | ||
}; | ||
@@ -69,0 +73,0 @@ |
@@ -1,2 +0,2 @@ | ||
const mockAdapter = { | ||
var mockAdapter = { | ||
appendCss: () => {}, | ||
@@ -9,4 +9,4 @@ registerClassName: () => {}, | ||
}; | ||
const adapterStack = [mockAdapter]; | ||
const currentAdapter = () => { | ||
var adapterStack = [mockAdapter]; | ||
var currentAdapter = () => { | ||
if (adapterStack.length < 1) { | ||
@@ -17,4 +17,4 @@ throw new Error('No adapter configured'); | ||
}; | ||
let hasConfiguredAdapter = false; | ||
const setAdapterIfNotSet = newAdapter => { | ||
var hasConfiguredAdapter = false; | ||
var setAdapterIfNotSet = newAdapter => { | ||
if (!hasConfiguredAdapter) { | ||
@@ -24,3 +24,3 @@ setAdapter(newAdapter); | ||
}; | ||
const setAdapter = newAdapter => { | ||
var setAdapter = newAdapter => { | ||
if (!newAdapter) { | ||
@@ -32,25 +32,29 @@ throw new Error('No adapter provided when calling "setAdapter"'); | ||
}; | ||
const removeAdapter = () => { | ||
var removeAdapter = () => { | ||
adapterStack.pop(); | ||
}; | ||
const appendCss = (...props) => { | ||
return currentAdapter().appendCss(...props); | ||
var appendCss = function appendCss() { | ||
return currentAdapter().appendCss(...arguments); | ||
}; | ||
const registerClassName = (...props) => { | ||
return currentAdapter().registerClassName(...props); | ||
var registerClassName = function registerClassName() { | ||
return currentAdapter().registerClassName(...arguments); | ||
}; | ||
const registerComposition = (...props) => { | ||
return currentAdapter().registerComposition(...props); | ||
var registerComposition = function registerComposition() { | ||
return currentAdapter().registerComposition(...arguments); | ||
}; | ||
const markCompositionUsed = (...props) => { | ||
return currentAdapter().markCompositionUsed(...props); | ||
var markCompositionUsed = function markCompositionUsed() { | ||
return currentAdapter().markCompositionUsed(...arguments); | ||
}; | ||
const onBeginFileScope = (...props) => { | ||
return currentAdapter().onBeginFileScope?.(...props); | ||
var onBeginFileScope = function onBeginFileScope() { | ||
var _currentAdapter$onBeg, _currentAdapter; | ||
for (var _len = arguments.length, props = new Array(_len), _key = 0; _key < _len; _key++) { | ||
props[_key] = arguments[_key]; | ||
} | ||
return (_currentAdapter$onBeg = (_currentAdapter = currentAdapter()).onBeginFileScope) === null || _currentAdapter$onBeg === void 0 ? void 0 : _currentAdapter$onBeg.call(_currentAdapter, ...props); | ||
}; | ||
const onEndFileScope = (...props) => { | ||
return currentAdapter().onEndFileScope(...props); | ||
var onEndFileScope = function onEndFileScope() { | ||
return currentAdapter().onEndFileScope(...arguments); | ||
}; | ||
const getIdentOption = (...props) => { | ||
const adapter = currentAdapter(); | ||
var getIdentOption = function getIdentOption() { | ||
var adapter = currentAdapter(); | ||
@@ -61,5 +65,5 @@ // Backwards compatibility with old versions of the integration package | ||
} | ||
return adapter.getIdentOption(...props); | ||
return adapter.getIdentOption(...arguments); | ||
}; | ||
export { appendCss, getIdentOption, markCompositionUsed, mockAdapter, onBeginFileScope, onEndFileScope, registerClassName, registerComposition, removeAdapter, setAdapter, setAdapterIfNotSet }; |
@@ -5,3 +5,3 @@ 'use strict'; | ||
const mockAdapter = { | ||
var mockAdapter = { | ||
appendCss: () => {}, | ||
@@ -14,4 +14,4 @@ registerClassName: () => {}, | ||
}; | ||
const adapterStack = [mockAdapter]; | ||
const currentAdapter = () => { | ||
var adapterStack = [mockAdapter]; | ||
var currentAdapter = () => { | ||
if (adapterStack.length < 1) { | ||
@@ -22,4 +22,4 @@ throw new Error('No adapter configured'); | ||
}; | ||
let hasConfiguredAdapter = false; | ||
const setAdapterIfNotSet = newAdapter => { | ||
var hasConfiguredAdapter = false; | ||
var setAdapterIfNotSet = newAdapter => { | ||
if (!hasConfiguredAdapter) { | ||
@@ -29,3 +29,3 @@ setAdapter(newAdapter); | ||
}; | ||
const setAdapter = newAdapter => { | ||
var setAdapter = newAdapter => { | ||
if (!newAdapter) { | ||
@@ -37,25 +37,29 @@ throw new Error('No adapter provided when calling "setAdapter"'); | ||
}; | ||
const removeAdapter = () => { | ||
var removeAdapter = () => { | ||
adapterStack.pop(); | ||
}; | ||
const appendCss = (...props) => { | ||
return currentAdapter().appendCss(...props); | ||
var appendCss = function appendCss() { | ||
return currentAdapter().appendCss(...arguments); | ||
}; | ||
const registerClassName = (...props) => { | ||
return currentAdapter().registerClassName(...props); | ||
var registerClassName = function registerClassName() { | ||
return currentAdapter().registerClassName(...arguments); | ||
}; | ||
const registerComposition = (...props) => { | ||
return currentAdapter().registerComposition(...props); | ||
var registerComposition = function registerComposition() { | ||
return currentAdapter().registerComposition(...arguments); | ||
}; | ||
const markCompositionUsed = (...props) => { | ||
return currentAdapter().markCompositionUsed(...props); | ||
var markCompositionUsed = function markCompositionUsed() { | ||
return currentAdapter().markCompositionUsed(...arguments); | ||
}; | ||
const onBeginFileScope = (...props) => { | ||
return currentAdapter().onBeginFileScope?.(...props); | ||
var onBeginFileScope = function onBeginFileScope() { | ||
var _currentAdapter$onBeg, _currentAdapter; | ||
for (var _len = arguments.length, props = new Array(_len), _key = 0; _key < _len; _key++) { | ||
props[_key] = arguments[_key]; | ||
} | ||
return (_currentAdapter$onBeg = (_currentAdapter = currentAdapter()).onBeginFileScope) === null || _currentAdapter$onBeg === void 0 ? void 0 : _currentAdapter$onBeg.call(_currentAdapter, ...props); | ||
}; | ||
const onEndFileScope = (...props) => { | ||
return currentAdapter().onEndFileScope(...props); | ||
var onEndFileScope = function onEndFileScope() { | ||
return currentAdapter().onEndFileScope(...arguments); | ||
}; | ||
const getIdentOption = (...props) => { | ||
const adapter = currentAdapter(); | ||
var getIdentOption = function getIdentOption() { | ||
var adapter = currentAdapter(); | ||
@@ -66,3 +70,3 @@ // Backwards compatibility with old versions of the integration package | ||
} | ||
return adapter.getIdentOption(...props); | ||
return adapter.getIdentOption(...arguments); | ||
}; | ||
@@ -69,0 +73,0 @@ |
@@ -5,3 +5,3 @@ 'use strict'; | ||
const mockAdapter = { | ||
var mockAdapter = { | ||
appendCss: () => {}, | ||
@@ -14,4 +14,4 @@ registerClassName: () => {}, | ||
}; | ||
const adapterStack = [mockAdapter]; | ||
const currentAdapter = () => { | ||
var adapterStack = [mockAdapter]; | ||
var currentAdapter = () => { | ||
if (adapterStack.length < 1) { | ||
@@ -22,4 +22,4 @@ throw new Error('No adapter configured'); | ||
}; | ||
let hasConfiguredAdapter = false; | ||
const setAdapterIfNotSet = newAdapter => { | ||
var hasConfiguredAdapter = false; | ||
var setAdapterIfNotSet = newAdapter => { | ||
if (!hasConfiguredAdapter) { | ||
@@ -29,3 +29,3 @@ setAdapter(newAdapter); | ||
}; | ||
const setAdapter = newAdapter => { | ||
var setAdapter = newAdapter => { | ||
if (!newAdapter) { | ||
@@ -37,25 +37,29 @@ throw new Error('No adapter provided when calling "setAdapter"'); | ||
}; | ||
const removeAdapter = () => { | ||
var removeAdapter = () => { | ||
adapterStack.pop(); | ||
}; | ||
const appendCss = (...props) => { | ||
return currentAdapter().appendCss(...props); | ||
var appendCss = function appendCss() { | ||
return currentAdapter().appendCss(...arguments); | ||
}; | ||
const registerClassName = (...props) => { | ||
return currentAdapter().registerClassName(...props); | ||
var registerClassName = function registerClassName() { | ||
return currentAdapter().registerClassName(...arguments); | ||
}; | ||
const registerComposition = (...props) => { | ||
return currentAdapter().registerComposition(...props); | ||
var registerComposition = function registerComposition() { | ||
return currentAdapter().registerComposition(...arguments); | ||
}; | ||
const markCompositionUsed = (...props) => { | ||
return currentAdapter().markCompositionUsed(...props); | ||
var markCompositionUsed = function markCompositionUsed() { | ||
return currentAdapter().markCompositionUsed(...arguments); | ||
}; | ||
const onBeginFileScope = (...props) => { | ||
return currentAdapter().onBeginFileScope?.(...props); | ||
var onBeginFileScope = function onBeginFileScope() { | ||
var _currentAdapter$onBeg, _currentAdapter; | ||
for (var _len = arguments.length, props = new Array(_len), _key = 0; _key < _len; _key++) { | ||
props[_key] = arguments[_key]; | ||
} | ||
return (_currentAdapter$onBeg = (_currentAdapter = currentAdapter()).onBeginFileScope) === null || _currentAdapter$onBeg === void 0 ? void 0 : _currentAdapter$onBeg.call(_currentAdapter, ...props); | ||
}; | ||
const onEndFileScope = (...props) => { | ||
return currentAdapter().onEndFileScope(...props); | ||
var onEndFileScope = function onEndFileScope() { | ||
return currentAdapter().onEndFileScope(...arguments); | ||
}; | ||
const getIdentOption = (...props) => { | ||
const adapter = currentAdapter(); | ||
var getIdentOption = function getIdentOption() { | ||
var adapter = currentAdapter(); | ||
@@ -66,3 +70,3 @@ // Backwards compatibility with old versions of the integration package | ||
} | ||
return adapter.getIdentOption(...props); | ||
return adapter.getIdentOption(...arguments); | ||
}; | ||
@@ -69,0 +73,0 @@ |
@@ -1,2 +0,2 @@ | ||
const mockAdapter = { | ||
var mockAdapter = { | ||
appendCss: () => {}, | ||
@@ -9,4 +9,4 @@ registerClassName: () => {}, | ||
}; | ||
const adapterStack = [mockAdapter]; | ||
const currentAdapter = () => { | ||
var adapterStack = [mockAdapter]; | ||
var currentAdapter = () => { | ||
if (adapterStack.length < 1) { | ||
@@ -17,4 +17,4 @@ throw new Error('No adapter configured'); | ||
}; | ||
let hasConfiguredAdapter = false; | ||
const setAdapterIfNotSet = newAdapter => { | ||
var hasConfiguredAdapter = false; | ||
var setAdapterIfNotSet = newAdapter => { | ||
if (!hasConfiguredAdapter) { | ||
@@ -24,3 +24,3 @@ setAdapter(newAdapter); | ||
}; | ||
const setAdapter = newAdapter => { | ||
var setAdapter = newAdapter => { | ||
if (!newAdapter) { | ||
@@ -32,25 +32,29 @@ throw new Error('No adapter provided when calling "setAdapter"'); | ||
}; | ||
const removeAdapter = () => { | ||
var removeAdapter = () => { | ||
adapterStack.pop(); | ||
}; | ||
const appendCss = (...props) => { | ||
return currentAdapter().appendCss(...props); | ||
var appendCss = function appendCss() { | ||
return currentAdapter().appendCss(...arguments); | ||
}; | ||
const registerClassName = (...props) => { | ||
return currentAdapter().registerClassName(...props); | ||
var registerClassName = function registerClassName() { | ||
return currentAdapter().registerClassName(...arguments); | ||
}; | ||
const registerComposition = (...props) => { | ||
return currentAdapter().registerComposition(...props); | ||
var registerComposition = function registerComposition() { | ||
return currentAdapter().registerComposition(...arguments); | ||
}; | ||
const markCompositionUsed = (...props) => { | ||
return currentAdapter().markCompositionUsed(...props); | ||
var markCompositionUsed = function markCompositionUsed() { | ||
return currentAdapter().markCompositionUsed(...arguments); | ||
}; | ||
const onBeginFileScope = (...props) => { | ||
return currentAdapter().onBeginFileScope?.(...props); | ||
var onBeginFileScope = function onBeginFileScope() { | ||
var _currentAdapter$onBeg, _currentAdapter; | ||
for (var _len = arguments.length, props = new Array(_len), _key = 0; _key < _len; _key++) { | ||
props[_key] = arguments[_key]; | ||
} | ||
return (_currentAdapter$onBeg = (_currentAdapter = currentAdapter()).onBeginFileScope) === null || _currentAdapter$onBeg === void 0 ? void 0 : _currentAdapter$onBeg.call(_currentAdapter, ...props); | ||
}; | ||
const onEndFileScope = (...props) => { | ||
return currentAdapter().onEndFileScope(...props); | ||
var onEndFileScope = function onEndFileScope() { | ||
return currentAdapter().onEndFileScope(...arguments); | ||
}; | ||
const getIdentOption = (...props) => { | ||
const adapter = currentAdapter(); | ||
var getIdentOption = function getIdentOption() { | ||
var adapter = currentAdapter(); | ||
@@ -61,5 +65,5 @@ // Backwards compatibility with old versions of the integration package | ||
} | ||
return adapter.getIdentOption(...props); | ||
return adapter.getIdentOption(...arguments); | ||
}; | ||
export { appendCss, getIdentOption, markCompositionUsed, mockAdapter, onBeginFileScope, onEndFileScope, registerClassName, registerComposition, removeAdapter, setAdapter, setAdapterIfNotSet }; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
var injectStyles_dist_vanillaExtractCssInjectStyles = require('../injectStyles/dist/vanilla-extract-css-injectStyles.browser.cjs.js'); | ||
var transformCss_dist_vanillaExtractCssTransformCss = require('./transformCss-97c9e882.browser.cjs.js'); | ||
var transformCss_dist_vanillaExtractCssTransformCss = require('./transformCss-80eb10a6.browser.cjs.js'); | ||
var adapter_dist_vanillaExtractCssAdapter = require('../adapter/dist/vanilla-extract-css-adapter.browser.cjs.js'); | ||
@@ -14,4 +14,5 @@ var hash = require('@emotion/hash'); | ||
var deepObjectDiff = require('deep-object-diff'); | ||
var chalk = require('chalk'); | ||
var outdent = require('outdent'); | ||
var pc = require('picocolors'); | ||
var taggedTemplateLiteral = require('./taggedTemplateLiteral-00b821ff.browser.cjs.js'); | ||
var dedent = require('dedent'); | ||
var deepmerge = require('deepmerge'); | ||
@@ -26,10 +27,10 @@ require('modern-ahocorasick'); | ||
var cssesc__default = /*#__PURE__*/_interopDefault(cssesc); | ||
var chalk__default = /*#__PURE__*/_interopDefault(chalk); | ||
var outdent__default = /*#__PURE__*/_interopDefault(outdent); | ||
var pc__default = /*#__PURE__*/_interopDefault(pc); | ||
var dedent__default = /*#__PURE__*/_interopDefault(dedent); | ||
var deepmerge__default = /*#__PURE__*/_interopDefault(deepmerge); | ||
const localClassNames = new Set(); | ||
const composedClassLists = []; | ||
let bufferedCSSObjs = []; | ||
const browserRuntimeAdapter = { | ||
var localClassNames = new Set(); | ||
var composedClassLists = []; | ||
var bufferedCSSObjs = []; | ||
var browserRuntimeAdapter = { | ||
appendCss: cssObj => { | ||
@@ -46,3 +47,3 @@ bufferedCSSObjs.push(cssObj); | ||
onEndFileScope: fileScope => { | ||
const css = transformCss_dist_vanillaExtractCssTransformCss.transformCss({ | ||
var css = transformCss_dist_vanillaExtractCssTransformCss.transformCss({ | ||
localClassNames: Array.from(localClassNames), | ||
@@ -64,14 +65,93 @@ composedClassLists, | ||
function getDevPrefix({ | ||
debugId, | ||
debugFileName | ||
}) { | ||
const parts = debugId ? [debugId.replace(/\s/g, '_')] : []; | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
function _inherits(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
Object.defineProperty(subClass, "prototype", { | ||
writable: false | ||
}); | ||
if (superClass) _setPrototypeOf(subClass, superClass); | ||
} | ||
function _wrapRegExp() { | ||
_wrapRegExp = function (e, r) { | ||
return new BabelRegExp(e, void 0, r); | ||
}; | ||
var e = RegExp.prototype, | ||
r = new WeakMap(); | ||
function BabelRegExp(e, t, p) { | ||
var o = new RegExp(e, t); | ||
return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); | ||
} | ||
function buildGroups(e, t) { | ||
var p = r.get(t); | ||
return Object.keys(p).reduce(function (r, t) { | ||
var o = p[t]; | ||
if ("number" == typeof o) r[t] = e[o];else { | ||
for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; | ||
r[t] = e[o[i]]; | ||
} | ||
return r; | ||
}, Object.create(null)); | ||
} | ||
return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { | ||
var t = e.exec.call(this, r); | ||
if (t) { | ||
t.groups = buildGroups(t, this); | ||
var p = t.indices; | ||
p && (p.groups = buildGroups(p, this)); | ||
} | ||
return t; | ||
}, BabelRegExp.prototype[Symbol.replace] = function (t, p) { | ||
if ("string" == typeof p) { | ||
var o = r.get(this); | ||
return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) { | ||
var t = o[r]; | ||
return "$" + (Array.isArray(t) ? t.join("$") : t); | ||
})); | ||
} | ||
if ("function" == typeof p) { | ||
var i = this; | ||
return e[Symbol.replace].call(this, t, function () { | ||
var e = arguments; | ||
return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); | ||
}); | ||
} | ||
return e[Symbol.replace].call(this, t, p); | ||
}, _wrapRegExp.apply(this, arguments); | ||
} | ||
var DIR_FILE_REGEXP = /*#__PURE__*/_wrapRegExp(/([^\/\\]*)?[\/\\]?([^\/\\]*)\.css\.(?:ts|js|tsx|jsx|cjs|mjs)$/, { | ||
dir: 1, | ||
file: 2 | ||
}); | ||
var WHITESPACE_REGEXP = /\s/g; | ||
function getDevPrefix(_ref) { | ||
var { | ||
debugId, | ||
debugFileName | ||
} = _ref; | ||
var parts = debugId ? [debugId.replace(WHITESPACE_REGEXP, '_')] : []; | ||
if (debugFileName) { | ||
const { | ||
var { | ||
filePath | ||
} = fileScope_dist_vanillaExtractCssFileScope.getFileScope(); | ||
const matches = filePath.match(/(?<dir>[^\/\\]*)?[\/\\]?(?<file>[^\/\\]*)\.css\.(ts|js|tsx|jsx|cjs|mjs)$/); | ||
var matches = filePath.match(DIR_FILE_REGEXP); | ||
if (matches && matches.groups) { | ||
const { | ||
var { | ||
dir, | ||
@@ -85,27 +165,26 @@ file | ||
} | ||
var NORMALIZE_REGEXP = /^[0-9]/; | ||
function normalizeIdentifier(identifier) { | ||
return identifier.match(/^[0-9]/) ? `_${identifier}` : identifier; | ||
return NORMALIZE_REGEXP.test(identifier) ? "_".concat(identifier) : identifier; | ||
} | ||
var IDENTIFIER_REGEXP = /^[A-Z_][0-9A-Z_-]+$/i; | ||
function generateIdentifier(arg) { | ||
const identOption = adapter_dist_vanillaExtractCssAdapter.getIdentOption(); | ||
const { | ||
var identOption = adapter_dist_vanillaExtractCssAdapter.getIdentOption(); | ||
var { | ||
debugId, | ||
debugFileName = true | ||
} = { | ||
...(typeof arg === 'string' ? { | ||
debugId: arg | ||
} : null), | ||
...(typeof arg === 'object' ? arg : null) | ||
}; | ||
} = transformCss_dist_vanillaExtractCssTransformCss._objectSpread2(transformCss_dist_vanillaExtractCssTransformCss._objectSpread2({}, typeof arg === 'string' ? { | ||
debugId: arg | ||
} : null), typeof arg === 'object' ? arg : null); | ||
// Convert ref count to base 36 for optimal hash lengths | ||
const refCount = fileScope_dist_vanillaExtractCssFileScope.getAndIncrementRefCounter().toString(36); | ||
const { | ||
var refCount = fileScope_dist_vanillaExtractCssFileScope.getAndIncrementRefCounter().toString(36); | ||
var { | ||
filePath, | ||
packageName | ||
} = fileScope_dist_vanillaExtractCssFileScope.getFileScope(); | ||
const fileScopeHash = hash__default["default"](packageName ? `${packageName}${filePath}` : filePath); | ||
let identifier = `${fileScopeHash}${refCount}`; | ||
var fileScopeHash = hash__default["default"](packageName ? "".concat(packageName).concat(filePath) : filePath); | ||
var identifier = "".concat(fileScopeHash).concat(refCount); | ||
if (identOption === 'debug') { | ||
const devPrefix = getDevPrefix({ | ||
var devPrefix = getDevPrefix({ | ||
debugId, | ||
@@ -115,3 +194,3 @@ debugFileName | ||
if (devPrefix) { | ||
identifier = `${devPrefix}__${identifier}`; | ||
identifier = "".concat(devPrefix, "__").concat(identifier); | ||
} | ||
@@ -127,4 +206,4 @@ return normalizeIdentifier(identifier); | ||
}); | ||
if (!identifier.match(/^[A-Z_][0-9A-Z_]+$/i)) { | ||
throw new Error(`Identifier function returned invalid indentifier: "${identifier}"`); | ||
if (!identifier.match(IDENTIFIER_REGEXP)) { | ||
throw new Error("Identifier function returned invalid indentifier: \"".concat(identifier, "\"")); | ||
} | ||
@@ -136,6 +215,6 @@ return identifier; | ||
const normaliseObject = obj => _private.walkObject(obj, () => ''); | ||
var normaliseObject = obj => _private.walkObject(obj, () => ''); | ||
function validateContract(contract, tokens) { | ||
const theDiff = deepObjectDiff.diff(normaliseObject(contract), normaliseObject(tokens)); | ||
const valid = Object.keys(theDiff).length === 0; | ||
var theDiff = deepObjectDiff.diff(normaliseObject(contract), normaliseObject(tokens)); | ||
var valid = Object.keys(theDiff).length === 0; | ||
return { | ||
@@ -147,10 +226,10 @@ valid, | ||
function diffLine(value, nesting, type) { | ||
const whitespace = [...Array(nesting).keys()].map(() => ' ').join(''); | ||
const line = `${type ? type : ' '}${whitespace}${value}`; | ||
var whitespace = [...Array(nesting).keys()].map(() => ' ').join(''); | ||
var line = "".concat(type ? type : ' ').concat(whitespace).concat(value); | ||
if (process.env.NODE_ENV !== 'test') { | ||
if (type === '-') { | ||
return chalk__default["default"].red(line); | ||
return pc__default["default"].red(line); | ||
} | ||
if (type === '+') { | ||
return chalk__default["default"].green(line); | ||
return pc__default["default"].green(line); | ||
} | ||
@@ -160,19 +239,20 @@ } | ||
} | ||
function renderDiff(orig, diff, nesting = 0) { | ||
const lines = []; | ||
function renderDiff(orig, diff) { | ||
var nesting = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; | ||
var lines = []; | ||
if (nesting === 0) { | ||
lines.push(diffLine('{', 0)); | ||
} | ||
const innerNesting = nesting + 1; | ||
const keys = Object.keys(diff).sort(); | ||
for (const key of keys) { | ||
const value = diff[key]; | ||
var innerNesting = nesting + 1; | ||
var keys = Object.keys(diff).sort(); | ||
for (var key of keys) { | ||
var value = diff[key]; | ||
if (!(key in orig)) { | ||
lines.push(diffLine(`${key}: ...,`, innerNesting, '+')); | ||
lines.push(diffLine("".concat(key, ": ...,"), innerNesting, '+')); | ||
} else if (typeof value === 'object') { | ||
lines.push(diffLine(`${key}: {`, innerNesting)); | ||
lines.push(diffLine("".concat(key, ": {"), innerNesting)); | ||
lines.push(renderDiff(orig[key], diff[key], innerNesting)); | ||
lines.push(diffLine('}', innerNesting)); | ||
} else { | ||
lines.push(diffLine(`${key}: ...,`, innerNesting, '-')); | ||
lines.push(diffLine("".concat(key, ": ...,"), innerNesting, '-')); | ||
} | ||
@@ -187,3 +267,3 @@ } | ||
function createVar(debugId) { | ||
const cssVarName = cssesc__default["default"](generateIdentifier({ | ||
var cssVarName = cssesc__default["default"](generateIdentifier({ | ||
debugId, | ||
@@ -194,6 +274,9 @@ debugFileName: false | ||
}); | ||
return `var(--${cssVarName})`; | ||
return "var(--".concat(cssVarName, ")"); | ||
} | ||
function fallbackVar(...values) { | ||
let finalValue = ''; | ||
function fallbackVar() { | ||
var finalValue = ''; | ||
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) { | ||
values[_key] = arguments[_key]; | ||
} | ||
values.reverse().forEach(value => { | ||
@@ -204,5 +287,5 @@ if (finalValue === '') { | ||
if (typeof value !== 'string' || !/^var\(--.*\)$/.test(value)) { | ||
throw new Error(`Invalid variable name: ${value}`); | ||
throw new Error("Invalid variable name: ".concat(value)); | ||
} | ||
finalValue = value.replace(/\)$/, `, ${finalValue})`); | ||
finalValue = value.replace(/\)$/, ", ".concat(finalValue, ")")); | ||
} | ||
@@ -213,4 +296,4 @@ }); | ||
function assignVars(varContract, tokens) { | ||
const varSetters = {}; | ||
const { | ||
var varSetters = {}; | ||
var { | ||
valid, | ||
@@ -220,3 +303,3 @@ diffString | ||
if (!valid) { | ||
throw new Error(`Tokens don't match contract.\n${diffString}`); | ||
throw new Error("Tokens don't match contract.\n".concat(diffString)); | ||
} | ||
@@ -235,10 +318,10 @@ _private.walkObject(tokens, (value, path) => { | ||
return _private.walkObject(tokens, (value, path) => { | ||
const rawVarName = typeof mapFn === 'function' ? mapFn(value, path) : value; | ||
const varName = typeof rawVarName === 'string' ? rawVarName.replace(/^\-\-/, '') : null; | ||
var rawVarName = typeof mapFn === 'function' ? mapFn(value, path) : value; | ||
var varName = typeof rawVarName === 'string' ? rawVarName.replace(/^\-\-/, '') : null; | ||
if (typeof varName !== 'string' || varName !== cssesc__default["default"](varName, { | ||
isIdentifier: true | ||
})) { | ||
throw new Error(`Invalid variable name for "${path.join('.')}": ${varName}`); | ||
throw new Error("Invalid variable name for \"".concat(path.join('.'), "\": ").concat(varName)); | ||
} | ||
return `var(--${varName})`; | ||
return "var(--".concat(varName, ")"); | ||
}); | ||
@@ -248,5 +331,5 @@ } | ||
function createGlobalTheme(selector, arg2, arg3) { | ||
const shouldCreateVars = Boolean(!arg3); | ||
const themeVars = shouldCreateVars ? createThemeContract(arg2) : arg2; | ||
const tokens = shouldCreateVars ? arg2 : arg3; | ||
var shouldCreateVars = Boolean(!arg3); | ||
var themeVars = shouldCreateVars ? createThemeContract(arg2) : arg2; | ||
var tokens = shouldCreateVars ? arg2 : arg3; | ||
adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
@@ -264,14 +347,15 @@ type: 'global', | ||
function createTheme(arg1, arg2, arg3) { | ||
const themeClassName = generateIdentifier(typeof arg2 === 'object' ? arg3 : arg2); | ||
var themeClassName = generateIdentifier(typeof arg2 === 'object' ? arg3 : arg2); | ||
adapter_dist_vanillaExtractCssAdapter.registerClassName(themeClassName, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
const vars = typeof arg2 === 'object' ? createGlobalTheme(themeClassName, arg1, arg2) : createGlobalTheme(themeClassName, arg1); | ||
var vars = typeof arg2 === 'object' ? createGlobalTheme(themeClassName, arg1, arg2) : createGlobalTheme(themeClassName, arg1); | ||
return vars ? [themeClassName, vars] : themeClassName; | ||
} | ||
var _templateObject; | ||
function composedStyle(rules, debugId) { | ||
const className = generateIdentifier(debugId); | ||
var className = generateIdentifier(debugId); | ||
adapter_dist_vanillaExtractCssAdapter.registerClassName(className, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
const classList = []; | ||
const styleRules = []; | ||
for (const rule of rules) { | ||
var classList = []; | ||
var styleRules = []; | ||
for (var rule of rules) { | ||
if (typeof rule === 'string') { | ||
@@ -283,5 +367,5 @@ classList.push(rule); | ||
} | ||
let result = className; | ||
var result = className; | ||
if (classList.length > 0) { | ||
result = `${className} ${transformCss_dist_vanillaExtractCssTransformCss.dudupeAndJoinClassList(classList)}`; | ||
result = "".concat(className, " ").concat(transformCss_dist_vanillaExtractCssTransformCss.dudupeAndJoinClassList(classList)); | ||
adapter_dist_vanillaExtractCssAdapter.registerComposition({ | ||
@@ -298,3 +382,3 @@ identifier: className, | ||
if (styleRules.length > 0) { | ||
const rule = deepmerge__default["default"].all(styleRules, { | ||
var _rule = deepmerge__default["default"].all(styleRules, { | ||
// Replace arrays rather than merging | ||
@@ -306,3 +390,3 @@ arrayMerge: (_, sourceArray) => sourceArray | ||
selector: className, | ||
rule | ||
rule: _rule | ||
}, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
@@ -316,3 +400,3 @@ } | ||
} | ||
const className = generateIdentifier(debugId); | ||
var className = generateIdentifier(debugId); | ||
adapter_dist_vanillaExtractCssAdapter.registerClassName(className, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
@@ -330,4 +414,7 @@ adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
*/ | ||
function composeStyles(...classNames) { | ||
const compose = fileScope_dist_vanillaExtractCssFileScope.hasFileScope() ? composedStyle : transformCss_dist_vanillaExtractCssTransformCss.dudupeAndJoinClassList; | ||
function composeStyles() { | ||
var compose = fileScope_dist_vanillaExtractCssFileScope.hasFileScope() ? composedStyle : transformCss_dist_vanillaExtractCssTransformCss.dudupeAndJoinClassList; | ||
for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) { | ||
classNames[_key] = arguments[_key]; | ||
} | ||
return compose(classNames); | ||
@@ -343,20 +430,15 @@ } | ||
function fontFace(rule, debugId) { | ||
const fontFamily = `"${cssesc__default["default"](generateIdentifier(debugId), { | ||
var fontFamily = "\"".concat(cssesc__default["default"](generateIdentifier(debugId), { | ||
quotes: 'double' | ||
})}"`; | ||
const rules = Array.isArray(rule) ? rule : [rule]; | ||
for (const singleRule of rules) { | ||
}), "\""); | ||
var rules = Array.isArray(rule) ? rule : [rule]; | ||
for (var singleRule of rules) { | ||
if ('fontFamily' in singleRule) { | ||
throw new Error(outdent__default["default"]` | ||
This function creates and returns a hashed font-family name, so the "fontFamily" property should not be provided. | ||
If you'd like to define a globally scoped custom font, you can use the "globalFontFace" function instead. | ||
`); | ||
throw new Error(dedent__default["default"](_templateObject || (_templateObject = taggedTemplateLiteral._taggedTemplateLiteral(["\n This function creates and returns a hashed font-family name, so the \"fontFamily\" property should not be provided.\n \n If you'd like to define a globally scoped custom font, you can use the \"globalFontFace\" function instead.\n "])))); | ||
} | ||
adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
type: 'fontFace', | ||
rule: { | ||
...singleRule, | ||
rule: transformCss_dist_vanillaExtractCssTransformCss._objectSpread2(transformCss_dist_vanillaExtractCssTransformCss._objectSpread2({}, singleRule), {}, { | ||
fontFamily | ||
} | ||
}) | ||
}, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
@@ -367,12 +449,14 @@ } | ||
function globalFontFace(fontFamily, rule) { | ||
adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
type: 'fontFace', | ||
rule: { | ||
...rule, | ||
fontFamily | ||
} | ||
}, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
var rules = Array.isArray(rule) ? rule : [rule]; | ||
for (var singleRule of rules) { | ||
adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
type: 'fontFace', | ||
rule: transformCss_dist_vanillaExtractCssTransformCss._objectSpread2(transformCss_dist_vanillaExtractCssTransformCss._objectSpread2({}, singleRule), {}, { | ||
fontFamily | ||
}) | ||
}, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
} | ||
} | ||
function keyframes(rule, debugId) { | ||
const name = cssesc__default["default"](generateIdentifier(debugId), { | ||
var name = cssesc__default["default"](generateIdentifier(debugId), { | ||
isIdentifier: true | ||
@@ -394,18 +478,18 @@ }); | ||
} | ||
function styleVariants(...args) { | ||
if (typeof args[1] === 'function') { | ||
const data = args[0]; | ||
const mapData = args[1]; | ||
const debugId = args[2]; | ||
const classMap = {}; | ||
for (const key in data) { | ||
classMap[key] = style(mapData(data[key], key), debugId ? `${debugId}_${key}` : key); | ||
function styleVariants() { | ||
if (typeof (arguments.length <= 1 ? undefined : arguments[1]) === 'function') { | ||
var _data = arguments.length <= 0 ? undefined : arguments[0]; | ||
var _mapData = arguments.length <= 1 ? undefined : arguments[1]; | ||
var _debugId = arguments.length <= 2 ? undefined : arguments[2]; | ||
var _classMap = {}; | ||
for (var _key2 in _data) { | ||
_classMap[_key2] = style(_mapData(_data[_key2], _key2), _debugId ? "".concat(_debugId, "_").concat(_key2) : _key2); | ||
} | ||
return classMap; | ||
return _classMap; | ||
} | ||
const styleMap = args[0]; | ||
const debugId = args[1]; | ||
const classMap = {}; | ||
for (const key in styleMap) { | ||
classMap[key] = style(styleMap[key], debugId ? `${debugId}_${key}` : key); | ||
var styleMap = arguments.length <= 0 ? undefined : arguments[0]; | ||
var debugId = arguments.length <= 1 ? undefined : arguments[1]; | ||
var classMap = {}; | ||
for (var _key3 in styleMap) { | ||
classMap[_key3] = style(styleMap[_key3], debugId ? "".concat(debugId, "_").concat(_key3) : _key3); | ||
} | ||
@@ -417,23 +501,20 @@ return classMap; | ||
// For now it is mostly just an alias of generateIdentifier | ||
const createContainer = debugId => generateIdentifier(debugId); | ||
var createContainer = debugId => generateIdentifier(debugId); | ||
const defaultLayerOptions = {}; | ||
const merge = (obj1, obj2) => ({ | ||
...obj1, | ||
...obj2 | ||
}); | ||
const getLayerArgs = (...args) => { | ||
let options = defaultLayerOptions; | ||
let debugId = args[0]; | ||
if (typeof args[0] === 'object') { | ||
options = merge(defaultLayerOptions, args[0]); | ||
debugId = args[1]; | ||
var defaultLayerOptions = {}; | ||
var merge = (obj1, obj2) => transformCss_dist_vanillaExtractCssTransformCss._objectSpread2(transformCss_dist_vanillaExtractCssTransformCss._objectSpread2({}, obj1), obj2); | ||
var getLayerArgs = function getLayerArgs() { | ||
var options = defaultLayerOptions; | ||
var debugId = arguments.length <= 0 ? undefined : arguments[0]; | ||
if (typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'object') { | ||
options = merge(defaultLayerOptions, arguments.length <= 0 ? undefined : arguments[0]); | ||
debugId = arguments.length <= 1 ? undefined : arguments[1]; | ||
} | ||
return [options, debugId]; | ||
}; | ||
function layer(...args) { | ||
const [options, debugId] = getLayerArgs(...args); | ||
let name = generateIdentifier(debugId); | ||
function layer() { | ||
var [options, debugId] = getLayerArgs(...arguments); | ||
var name = generateIdentifier(debugId); | ||
if (options.parent) { | ||
name = `${options.parent}.${name}`; | ||
name = "".concat(options.parent, ".").concat(name); | ||
} | ||
@@ -446,6 +527,6 @@ adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
} | ||
function globalLayer(...args) { | ||
let [options, name] = getLayerArgs(...args); | ||
function globalLayer() { | ||
var [options, name] = getLayerArgs(...arguments); | ||
if (options.parent) { | ||
name = `${options.parent}.${name}`; | ||
name = "".concat(options.parent, ".").concat(name); | ||
} | ||
@@ -452,0 +533,0 @@ adapter_dist_vanillaExtractCssAdapter.appendCss({ |
import { injectStyles } from '../injectStyles/dist/vanilla-extract-css-injectStyles.browser.esm.js'; | ||
import { t as transformCss, d as dudupeAndJoinClassList } from './transformCss-35fbcc6e.browser.esm.js'; | ||
import { t as transformCss, _ as _objectSpread2, d as dudupeAndJoinClassList } from './transformCss-72a2e7e9.browser.esm.js'; | ||
import { setAdapterIfNotSet, getIdentOption, appendCss, registerClassName, registerComposition, markCompositionUsed } from '../adapter/dist/vanilla-extract-css-adapter.browser.esm.js'; | ||
@@ -9,4 +9,5 @@ import hash from '@emotion/hash'; | ||
import { diff } from 'deep-object-diff'; | ||
import chalk from 'chalk'; | ||
import outdent from 'outdent'; | ||
import pc from 'picocolors'; | ||
import { _ as _taggedTemplateLiteral } from './taggedTemplateLiteral-8e47dbd7.browser.esm.js'; | ||
import dedent from 'dedent'; | ||
import deepmerge from 'deepmerge'; | ||
@@ -17,6 +18,6 @@ import 'modern-ahocorasick'; | ||
const localClassNames = new Set(); | ||
const composedClassLists = []; | ||
let bufferedCSSObjs = []; | ||
const browserRuntimeAdapter = { | ||
var localClassNames = new Set(); | ||
var composedClassLists = []; | ||
var bufferedCSSObjs = []; | ||
var browserRuntimeAdapter = { | ||
appendCss: cssObj => { | ||
@@ -33,3 +34,3 @@ bufferedCSSObjs.push(cssObj); | ||
onEndFileScope: fileScope => { | ||
const css = transformCss({ | ||
var css = transformCss({ | ||
localClassNames: Array.from(localClassNames), | ||
@@ -51,14 +52,93 @@ composedClassLists, | ||
function getDevPrefix({ | ||
debugId, | ||
debugFileName | ||
}) { | ||
const parts = debugId ? [debugId.replace(/\s/g, '_')] : []; | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
function _inherits(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
Object.defineProperty(subClass, "prototype", { | ||
writable: false | ||
}); | ||
if (superClass) _setPrototypeOf(subClass, superClass); | ||
} | ||
function _wrapRegExp() { | ||
_wrapRegExp = function (e, r) { | ||
return new BabelRegExp(e, void 0, r); | ||
}; | ||
var e = RegExp.prototype, | ||
r = new WeakMap(); | ||
function BabelRegExp(e, t, p) { | ||
var o = new RegExp(e, t); | ||
return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); | ||
} | ||
function buildGroups(e, t) { | ||
var p = r.get(t); | ||
return Object.keys(p).reduce(function (r, t) { | ||
var o = p[t]; | ||
if ("number" == typeof o) r[t] = e[o];else { | ||
for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; | ||
r[t] = e[o[i]]; | ||
} | ||
return r; | ||
}, Object.create(null)); | ||
} | ||
return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { | ||
var t = e.exec.call(this, r); | ||
if (t) { | ||
t.groups = buildGroups(t, this); | ||
var p = t.indices; | ||
p && (p.groups = buildGroups(p, this)); | ||
} | ||
return t; | ||
}, BabelRegExp.prototype[Symbol.replace] = function (t, p) { | ||
if ("string" == typeof p) { | ||
var o = r.get(this); | ||
return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) { | ||
var t = o[r]; | ||
return "$" + (Array.isArray(t) ? t.join("$") : t); | ||
})); | ||
} | ||
if ("function" == typeof p) { | ||
var i = this; | ||
return e[Symbol.replace].call(this, t, function () { | ||
var e = arguments; | ||
return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); | ||
}); | ||
} | ||
return e[Symbol.replace].call(this, t, p); | ||
}, _wrapRegExp.apply(this, arguments); | ||
} | ||
var DIR_FILE_REGEXP = /*#__PURE__*/_wrapRegExp(/([^\/\\]*)?[\/\\]?([^\/\\]*)\.css\.(?:ts|js|tsx|jsx|cjs|mjs)$/, { | ||
dir: 1, | ||
file: 2 | ||
}); | ||
var WHITESPACE_REGEXP = /\s/g; | ||
function getDevPrefix(_ref) { | ||
var { | ||
debugId, | ||
debugFileName | ||
} = _ref; | ||
var parts = debugId ? [debugId.replace(WHITESPACE_REGEXP, '_')] : []; | ||
if (debugFileName) { | ||
const { | ||
var { | ||
filePath | ||
} = getFileScope(); | ||
const matches = filePath.match(/(?<dir>[^\/\\]*)?[\/\\]?(?<file>[^\/\\]*)\.css\.(ts|js|tsx|jsx|cjs|mjs)$/); | ||
var matches = filePath.match(DIR_FILE_REGEXP); | ||
if (matches && matches.groups) { | ||
const { | ||
var { | ||
dir, | ||
@@ -72,27 +152,26 @@ file | ||
} | ||
var NORMALIZE_REGEXP = /^[0-9]/; | ||
function normalizeIdentifier(identifier) { | ||
return identifier.match(/^[0-9]/) ? `_${identifier}` : identifier; | ||
return NORMALIZE_REGEXP.test(identifier) ? "_".concat(identifier) : identifier; | ||
} | ||
var IDENTIFIER_REGEXP = /^[A-Z_][0-9A-Z_-]+$/i; | ||
function generateIdentifier(arg) { | ||
const identOption = getIdentOption(); | ||
const { | ||
var identOption = getIdentOption(); | ||
var { | ||
debugId, | ||
debugFileName = true | ||
} = { | ||
...(typeof arg === 'string' ? { | ||
debugId: arg | ||
} : null), | ||
...(typeof arg === 'object' ? arg : null) | ||
}; | ||
} = _objectSpread2(_objectSpread2({}, typeof arg === 'string' ? { | ||
debugId: arg | ||
} : null), typeof arg === 'object' ? arg : null); | ||
// Convert ref count to base 36 for optimal hash lengths | ||
const refCount = getAndIncrementRefCounter().toString(36); | ||
const { | ||
var refCount = getAndIncrementRefCounter().toString(36); | ||
var { | ||
filePath, | ||
packageName | ||
} = getFileScope(); | ||
const fileScopeHash = hash(packageName ? `${packageName}${filePath}` : filePath); | ||
let identifier = `${fileScopeHash}${refCount}`; | ||
var fileScopeHash = hash(packageName ? "".concat(packageName).concat(filePath) : filePath); | ||
var identifier = "".concat(fileScopeHash).concat(refCount); | ||
if (identOption === 'debug') { | ||
const devPrefix = getDevPrefix({ | ||
var devPrefix = getDevPrefix({ | ||
debugId, | ||
@@ -102,3 +181,3 @@ debugFileName | ||
if (devPrefix) { | ||
identifier = `${devPrefix}__${identifier}`; | ||
identifier = "".concat(devPrefix, "__").concat(identifier); | ||
} | ||
@@ -114,4 +193,4 @@ return normalizeIdentifier(identifier); | ||
}); | ||
if (!identifier.match(/^[A-Z_][0-9A-Z_]+$/i)) { | ||
throw new Error(`Identifier function returned invalid indentifier: "${identifier}"`); | ||
if (!identifier.match(IDENTIFIER_REGEXP)) { | ||
throw new Error("Identifier function returned invalid indentifier: \"".concat(identifier, "\"")); | ||
} | ||
@@ -123,6 +202,6 @@ return identifier; | ||
const normaliseObject = obj => walkObject(obj, () => ''); | ||
var normaliseObject = obj => walkObject(obj, () => ''); | ||
function validateContract(contract, tokens) { | ||
const theDiff = diff(normaliseObject(contract), normaliseObject(tokens)); | ||
const valid = Object.keys(theDiff).length === 0; | ||
var theDiff = diff(normaliseObject(contract), normaliseObject(tokens)); | ||
var valid = Object.keys(theDiff).length === 0; | ||
return { | ||
@@ -134,10 +213,10 @@ valid, | ||
function diffLine(value, nesting, type) { | ||
const whitespace = [...Array(nesting).keys()].map(() => ' ').join(''); | ||
const line = `${type ? type : ' '}${whitespace}${value}`; | ||
var whitespace = [...Array(nesting).keys()].map(() => ' ').join(''); | ||
var line = "".concat(type ? type : ' ').concat(whitespace).concat(value); | ||
if (process.env.NODE_ENV !== 'test') { | ||
if (type === '-') { | ||
return chalk.red(line); | ||
return pc.red(line); | ||
} | ||
if (type === '+') { | ||
return chalk.green(line); | ||
return pc.green(line); | ||
} | ||
@@ -147,19 +226,20 @@ } | ||
} | ||
function renderDiff(orig, diff, nesting = 0) { | ||
const lines = []; | ||
function renderDiff(orig, diff) { | ||
var nesting = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; | ||
var lines = []; | ||
if (nesting === 0) { | ||
lines.push(diffLine('{', 0)); | ||
} | ||
const innerNesting = nesting + 1; | ||
const keys = Object.keys(diff).sort(); | ||
for (const key of keys) { | ||
const value = diff[key]; | ||
var innerNesting = nesting + 1; | ||
var keys = Object.keys(diff).sort(); | ||
for (var key of keys) { | ||
var value = diff[key]; | ||
if (!(key in orig)) { | ||
lines.push(diffLine(`${key}: ...,`, innerNesting, '+')); | ||
lines.push(diffLine("".concat(key, ": ...,"), innerNesting, '+')); | ||
} else if (typeof value === 'object') { | ||
lines.push(diffLine(`${key}: {`, innerNesting)); | ||
lines.push(diffLine("".concat(key, ": {"), innerNesting)); | ||
lines.push(renderDiff(orig[key], diff[key], innerNesting)); | ||
lines.push(diffLine('}', innerNesting)); | ||
} else { | ||
lines.push(diffLine(`${key}: ...,`, innerNesting, '-')); | ||
lines.push(diffLine("".concat(key, ": ...,"), innerNesting, '-')); | ||
} | ||
@@ -174,3 +254,3 @@ } | ||
function createVar(debugId) { | ||
const cssVarName = cssesc(generateIdentifier({ | ||
var cssVarName = cssesc(generateIdentifier({ | ||
debugId, | ||
@@ -181,6 +261,9 @@ debugFileName: false | ||
}); | ||
return `var(--${cssVarName})`; | ||
return "var(--".concat(cssVarName, ")"); | ||
} | ||
function fallbackVar(...values) { | ||
let finalValue = ''; | ||
function fallbackVar() { | ||
var finalValue = ''; | ||
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) { | ||
values[_key] = arguments[_key]; | ||
} | ||
values.reverse().forEach(value => { | ||
@@ -191,5 +274,5 @@ if (finalValue === '') { | ||
if (typeof value !== 'string' || !/^var\(--.*\)$/.test(value)) { | ||
throw new Error(`Invalid variable name: ${value}`); | ||
throw new Error("Invalid variable name: ".concat(value)); | ||
} | ||
finalValue = value.replace(/\)$/, `, ${finalValue})`); | ||
finalValue = value.replace(/\)$/, ", ".concat(finalValue, ")")); | ||
} | ||
@@ -200,4 +283,4 @@ }); | ||
function assignVars(varContract, tokens) { | ||
const varSetters = {}; | ||
const { | ||
var varSetters = {}; | ||
var { | ||
valid, | ||
@@ -207,3 +290,3 @@ diffString | ||
if (!valid) { | ||
throw new Error(`Tokens don't match contract.\n${diffString}`); | ||
throw new Error("Tokens don't match contract.\n".concat(diffString)); | ||
} | ||
@@ -222,10 +305,10 @@ walkObject(tokens, (value, path) => { | ||
return walkObject(tokens, (value, path) => { | ||
const rawVarName = typeof mapFn === 'function' ? mapFn(value, path) : value; | ||
const varName = typeof rawVarName === 'string' ? rawVarName.replace(/^\-\-/, '') : null; | ||
var rawVarName = typeof mapFn === 'function' ? mapFn(value, path) : value; | ||
var varName = typeof rawVarName === 'string' ? rawVarName.replace(/^\-\-/, '') : null; | ||
if (typeof varName !== 'string' || varName !== cssesc(varName, { | ||
isIdentifier: true | ||
})) { | ||
throw new Error(`Invalid variable name for "${path.join('.')}": ${varName}`); | ||
throw new Error("Invalid variable name for \"".concat(path.join('.'), "\": ").concat(varName)); | ||
} | ||
return `var(--${varName})`; | ||
return "var(--".concat(varName, ")"); | ||
}); | ||
@@ -235,5 +318,5 @@ } | ||
function createGlobalTheme(selector, arg2, arg3) { | ||
const shouldCreateVars = Boolean(!arg3); | ||
const themeVars = shouldCreateVars ? createThemeContract(arg2) : arg2; | ||
const tokens = shouldCreateVars ? arg2 : arg3; | ||
var shouldCreateVars = Boolean(!arg3); | ||
var themeVars = shouldCreateVars ? createThemeContract(arg2) : arg2; | ||
var tokens = shouldCreateVars ? arg2 : arg3; | ||
appendCss({ | ||
@@ -251,14 +334,15 @@ type: 'global', | ||
function createTheme(arg1, arg2, arg3) { | ||
const themeClassName = generateIdentifier(typeof arg2 === 'object' ? arg3 : arg2); | ||
var themeClassName = generateIdentifier(typeof arg2 === 'object' ? arg3 : arg2); | ||
registerClassName(themeClassName, getFileScope()); | ||
const vars = typeof arg2 === 'object' ? createGlobalTheme(themeClassName, arg1, arg2) : createGlobalTheme(themeClassName, arg1); | ||
var vars = typeof arg2 === 'object' ? createGlobalTheme(themeClassName, arg1, arg2) : createGlobalTheme(themeClassName, arg1); | ||
return vars ? [themeClassName, vars] : themeClassName; | ||
} | ||
var _templateObject; | ||
function composedStyle(rules, debugId) { | ||
const className = generateIdentifier(debugId); | ||
var className = generateIdentifier(debugId); | ||
registerClassName(className, getFileScope()); | ||
const classList = []; | ||
const styleRules = []; | ||
for (const rule of rules) { | ||
var classList = []; | ||
var styleRules = []; | ||
for (var rule of rules) { | ||
if (typeof rule === 'string') { | ||
@@ -270,5 +354,5 @@ classList.push(rule); | ||
} | ||
let result = className; | ||
var result = className; | ||
if (classList.length > 0) { | ||
result = `${className} ${dudupeAndJoinClassList(classList)}`; | ||
result = "".concat(className, " ").concat(dudupeAndJoinClassList(classList)); | ||
registerComposition({ | ||
@@ -285,3 +369,3 @@ identifier: className, | ||
if (styleRules.length > 0) { | ||
const rule = deepmerge.all(styleRules, { | ||
var _rule = deepmerge.all(styleRules, { | ||
// Replace arrays rather than merging | ||
@@ -293,3 +377,3 @@ arrayMerge: (_, sourceArray) => sourceArray | ||
selector: className, | ||
rule | ||
rule: _rule | ||
}, getFileScope()); | ||
@@ -303,3 +387,3 @@ } | ||
} | ||
const className = generateIdentifier(debugId); | ||
var className = generateIdentifier(debugId); | ||
registerClassName(className, getFileScope()); | ||
@@ -317,4 +401,7 @@ appendCss({ | ||
*/ | ||
function composeStyles(...classNames) { | ||
const compose = hasFileScope() ? composedStyle : dudupeAndJoinClassList; | ||
function composeStyles() { | ||
var compose = hasFileScope() ? composedStyle : dudupeAndJoinClassList; | ||
for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) { | ||
classNames[_key] = arguments[_key]; | ||
} | ||
return compose(classNames); | ||
@@ -330,20 +417,15 @@ } | ||
function fontFace(rule, debugId) { | ||
const fontFamily = `"${cssesc(generateIdentifier(debugId), { | ||
var fontFamily = "\"".concat(cssesc(generateIdentifier(debugId), { | ||
quotes: 'double' | ||
})}"`; | ||
const rules = Array.isArray(rule) ? rule : [rule]; | ||
for (const singleRule of rules) { | ||
}), "\""); | ||
var rules = Array.isArray(rule) ? rule : [rule]; | ||
for (var singleRule of rules) { | ||
if ('fontFamily' in singleRule) { | ||
throw new Error(outdent` | ||
This function creates and returns a hashed font-family name, so the "fontFamily" property should not be provided. | ||
If you'd like to define a globally scoped custom font, you can use the "globalFontFace" function instead. | ||
`); | ||
throw new Error(dedent(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n This function creates and returns a hashed font-family name, so the \"fontFamily\" property should not be provided.\n \n If you'd like to define a globally scoped custom font, you can use the \"globalFontFace\" function instead.\n "])))); | ||
} | ||
appendCss({ | ||
type: 'fontFace', | ||
rule: { | ||
...singleRule, | ||
rule: _objectSpread2(_objectSpread2({}, singleRule), {}, { | ||
fontFamily | ||
} | ||
}) | ||
}, getFileScope()); | ||
@@ -354,12 +436,14 @@ } | ||
function globalFontFace(fontFamily, rule) { | ||
appendCss({ | ||
type: 'fontFace', | ||
rule: { | ||
...rule, | ||
fontFamily | ||
} | ||
}, getFileScope()); | ||
var rules = Array.isArray(rule) ? rule : [rule]; | ||
for (var singleRule of rules) { | ||
appendCss({ | ||
type: 'fontFace', | ||
rule: _objectSpread2(_objectSpread2({}, singleRule), {}, { | ||
fontFamily | ||
}) | ||
}, getFileScope()); | ||
} | ||
} | ||
function keyframes(rule, debugId) { | ||
const name = cssesc(generateIdentifier(debugId), { | ||
var name = cssesc(generateIdentifier(debugId), { | ||
isIdentifier: true | ||
@@ -381,18 +465,18 @@ }); | ||
} | ||
function styleVariants(...args) { | ||
if (typeof args[1] === 'function') { | ||
const data = args[0]; | ||
const mapData = args[1]; | ||
const debugId = args[2]; | ||
const classMap = {}; | ||
for (const key in data) { | ||
classMap[key] = style(mapData(data[key], key), debugId ? `${debugId}_${key}` : key); | ||
function styleVariants() { | ||
if (typeof (arguments.length <= 1 ? undefined : arguments[1]) === 'function') { | ||
var _data = arguments.length <= 0 ? undefined : arguments[0]; | ||
var _mapData = arguments.length <= 1 ? undefined : arguments[1]; | ||
var _debugId = arguments.length <= 2 ? undefined : arguments[2]; | ||
var _classMap = {}; | ||
for (var _key2 in _data) { | ||
_classMap[_key2] = style(_mapData(_data[_key2], _key2), _debugId ? "".concat(_debugId, "_").concat(_key2) : _key2); | ||
} | ||
return classMap; | ||
return _classMap; | ||
} | ||
const styleMap = args[0]; | ||
const debugId = args[1]; | ||
const classMap = {}; | ||
for (const key in styleMap) { | ||
classMap[key] = style(styleMap[key], debugId ? `${debugId}_${key}` : key); | ||
var styleMap = arguments.length <= 0 ? undefined : arguments[0]; | ||
var debugId = arguments.length <= 1 ? undefined : arguments[1]; | ||
var classMap = {}; | ||
for (var _key3 in styleMap) { | ||
classMap[_key3] = style(styleMap[_key3], debugId ? "".concat(debugId, "_").concat(_key3) : _key3); | ||
} | ||
@@ -404,23 +488,20 @@ return classMap; | ||
// For now it is mostly just an alias of generateIdentifier | ||
const createContainer = debugId => generateIdentifier(debugId); | ||
var createContainer = debugId => generateIdentifier(debugId); | ||
const defaultLayerOptions = {}; | ||
const merge = (obj1, obj2) => ({ | ||
...obj1, | ||
...obj2 | ||
}); | ||
const getLayerArgs = (...args) => { | ||
let options = defaultLayerOptions; | ||
let debugId = args[0]; | ||
if (typeof args[0] === 'object') { | ||
options = merge(defaultLayerOptions, args[0]); | ||
debugId = args[1]; | ||
var defaultLayerOptions = {}; | ||
var merge = (obj1, obj2) => _objectSpread2(_objectSpread2({}, obj1), obj2); | ||
var getLayerArgs = function getLayerArgs() { | ||
var options = defaultLayerOptions; | ||
var debugId = arguments.length <= 0 ? undefined : arguments[0]; | ||
if (typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'object') { | ||
options = merge(defaultLayerOptions, arguments.length <= 0 ? undefined : arguments[0]); | ||
debugId = arguments.length <= 1 ? undefined : arguments[1]; | ||
} | ||
return [options, debugId]; | ||
}; | ||
function layer(...args) { | ||
const [options, debugId] = getLayerArgs(...args); | ||
let name = generateIdentifier(debugId); | ||
function layer() { | ||
var [options, debugId] = getLayerArgs(...arguments); | ||
var name = generateIdentifier(debugId); | ||
if (options.parent) { | ||
name = `${options.parent}.${name}`; | ||
name = "".concat(options.parent, ".").concat(name); | ||
} | ||
@@ -433,6 +514,6 @@ appendCss({ | ||
} | ||
function globalLayer(...args) { | ||
let [options, name] = getLayerArgs(...args); | ||
function globalLayer() { | ||
var [options, name] = getLayerArgs(...arguments); | ||
if (options.parent) { | ||
name = `${options.parent}.${name}`; | ||
name = "".concat(options.parent, ".").concat(name); | ||
} | ||
@@ -439,0 +520,0 @@ appendCss({ |
@@ -245,4 +245,4 @@ import { Properties, AtRule } from 'csstype'; | ||
declare function createGlobalTheme<ThemeContract extends Contract>(selector: string, themeContract: ThemeContract, tokens: MapLeafNodes<ThemeContract, string>): void; | ||
declare function createTheme<ThemeContract extends Contract>(themeContract: ThemeContract, tokens: MapLeafNodes<ThemeContract, string>, debugId?: string): string; | ||
declare function createTheme<ThemeTokens extends Tokens>(tokens: ThemeTokens, debugId?: string): [className: string, vars: ThemeVars<ThemeTokens>]; | ||
declare function createTheme<ThemeContract extends Contract>(themeContract: ThemeContract, tokens: MapLeafNodes<ThemeContract, string>, debugId?: string): string; | ||
@@ -256,3 +256,3 @@ declare function style(rule: ComplexStyleRule, debugId?: string): string; | ||
declare function fontFace(rule: FontFaceRule | FontFaceRule[], debugId?: string): string; | ||
declare function globalFontFace(fontFamily: string, rule: FontFaceRule): void; | ||
declare function globalFontFace(fontFamily: string, rule: FontFaceRule | FontFaceRule[]): void; | ||
declare function keyframes(rule: CSSKeyframes, debugId?: string): string; | ||
@@ -259,0 +259,0 @@ declare function globalKeyframes(name: string, rule: CSSKeyframes): void; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
var injectStyles_dist_vanillaExtractCssInjectStyles = require('../injectStyles/dist/vanilla-extract-css-injectStyles.cjs.dev.js'); | ||
var transformCss_dist_vanillaExtractCssTransformCss = require('./transformCss-15eca288.cjs.dev.js'); | ||
var transformCss_dist_vanillaExtractCssTransformCss = require('./transformCss-96f55895.cjs.dev.js'); | ||
var adapter_dist_vanillaExtractCssAdapter = require('../adapter/dist/vanilla-extract-css-adapter.cjs.dev.js'); | ||
@@ -14,4 +14,5 @@ var hash = require('@emotion/hash'); | ||
var deepObjectDiff = require('deep-object-diff'); | ||
var chalk = require('chalk'); | ||
var outdent = require('outdent'); | ||
var pc = require('picocolors'); | ||
var taggedTemplateLiteral = require('./taggedTemplateLiteral-4fcaa261.cjs.dev.js'); | ||
var dedent = require('dedent'); | ||
var deepmerge = require('deepmerge'); | ||
@@ -26,10 +27,10 @@ require('modern-ahocorasick'); | ||
var cssesc__default = /*#__PURE__*/_interopDefault(cssesc); | ||
var chalk__default = /*#__PURE__*/_interopDefault(chalk); | ||
var outdent__default = /*#__PURE__*/_interopDefault(outdent); | ||
var pc__default = /*#__PURE__*/_interopDefault(pc); | ||
var dedent__default = /*#__PURE__*/_interopDefault(dedent); | ||
var deepmerge__default = /*#__PURE__*/_interopDefault(deepmerge); | ||
const localClassNames = new Set(); | ||
const composedClassLists = []; | ||
let bufferedCSSObjs = []; | ||
const browserRuntimeAdapter = { | ||
var localClassNames = new Set(); | ||
var composedClassLists = []; | ||
var bufferedCSSObjs = []; | ||
var browserRuntimeAdapter = { | ||
appendCss: cssObj => { | ||
@@ -46,3 +47,3 @@ bufferedCSSObjs.push(cssObj); | ||
onEndFileScope: fileScope => { | ||
const css = transformCss_dist_vanillaExtractCssTransformCss.transformCss({ | ||
var css = transformCss_dist_vanillaExtractCssTransformCss.transformCss({ | ||
localClassNames: Array.from(localClassNames), | ||
@@ -64,14 +65,93 @@ composedClassLists, | ||
function getDevPrefix({ | ||
debugId, | ||
debugFileName | ||
}) { | ||
const parts = debugId ? [debugId.replace(/\s/g, '_')] : []; | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
function _inherits(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
Object.defineProperty(subClass, "prototype", { | ||
writable: false | ||
}); | ||
if (superClass) _setPrototypeOf(subClass, superClass); | ||
} | ||
function _wrapRegExp() { | ||
_wrapRegExp = function (e, r) { | ||
return new BabelRegExp(e, void 0, r); | ||
}; | ||
var e = RegExp.prototype, | ||
r = new WeakMap(); | ||
function BabelRegExp(e, t, p) { | ||
var o = new RegExp(e, t); | ||
return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); | ||
} | ||
function buildGroups(e, t) { | ||
var p = r.get(t); | ||
return Object.keys(p).reduce(function (r, t) { | ||
var o = p[t]; | ||
if ("number" == typeof o) r[t] = e[o];else { | ||
for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; | ||
r[t] = e[o[i]]; | ||
} | ||
return r; | ||
}, Object.create(null)); | ||
} | ||
return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { | ||
var t = e.exec.call(this, r); | ||
if (t) { | ||
t.groups = buildGroups(t, this); | ||
var p = t.indices; | ||
p && (p.groups = buildGroups(p, this)); | ||
} | ||
return t; | ||
}, BabelRegExp.prototype[Symbol.replace] = function (t, p) { | ||
if ("string" == typeof p) { | ||
var o = r.get(this); | ||
return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) { | ||
var t = o[r]; | ||
return "$" + (Array.isArray(t) ? t.join("$") : t); | ||
})); | ||
} | ||
if ("function" == typeof p) { | ||
var i = this; | ||
return e[Symbol.replace].call(this, t, function () { | ||
var e = arguments; | ||
return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); | ||
}); | ||
} | ||
return e[Symbol.replace].call(this, t, p); | ||
}, _wrapRegExp.apply(this, arguments); | ||
} | ||
var DIR_FILE_REGEXP = /*#__PURE__*/_wrapRegExp(/([^\/\\]*)?[\/\\]?([^\/\\]*)\.css\.(?:ts|js|tsx|jsx|cjs|mjs)$/, { | ||
dir: 1, | ||
file: 2 | ||
}); | ||
var WHITESPACE_REGEXP = /\s/g; | ||
function getDevPrefix(_ref) { | ||
var { | ||
debugId, | ||
debugFileName | ||
} = _ref; | ||
var parts = debugId ? [debugId.replace(WHITESPACE_REGEXP, '_')] : []; | ||
if (debugFileName) { | ||
const { | ||
var { | ||
filePath | ||
} = fileScope_dist_vanillaExtractCssFileScope.getFileScope(); | ||
const matches = filePath.match(/(?<dir>[^\/\\]*)?[\/\\]?(?<file>[^\/\\]*)\.css\.(ts|js|tsx|jsx|cjs|mjs)$/); | ||
var matches = filePath.match(DIR_FILE_REGEXP); | ||
if (matches && matches.groups) { | ||
const { | ||
var { | ||
dir, | ||
@@ -85,27 +165,26 @@ file | ||
} | ||
var NORMALIZE_REGEXP = /^[0-9]/; | ||
function normalizeIdentifier(identifier) { | ||
return identifier.match(/^[0-9]/) ? `_${identifier}` : identifier; | ||
return NORMALIZE_REGEXP.test(identifier) ? "_".concat(identifier) : identifier; | ||
} | ||
var IDENTIFIER_REGEXP = /^[A-Z_][0-9A-Z_-]+$/i; | ||
function generateIdentifier(arg) { | ||
const identOption = adapter_dist_vanillaExtractCssAdapter.getIdentOption(); | ||
const { | ||
var identOption = adapter_dist_vanillaExtractCssAdapter.getIdentOption(); | ||
var { | ||
debugId, | ||
debugFileName = true | ||
} = { | ||
...(typeof arg === 'string' ? { | ||
debugId: arg | ||
} : null), | ||
...(typeof arg === 'object' ? arg : null) | ||
}; | ||
} = transformCss_dist_vanillaExtractCssTransformCss._objectSpread2(transformCss_dist_vanillaExtractCssTransformCss._objectSpread2({}, typeof arg === 'string' ? { | ||
debugId: arg | ||
} : null), typeof arg === 'object' ? arg : null); | ||
// Convert ref count to base 36 for optimal hash lengths | ||
const refCount = fileScope_dist_vanillaExtractCssFileScope.getAndIncrementRefCounter().toString(36); | ||
const { | ||
var refCount = fileScope_dist_vanillaExtractCssFileScope.getAndIncrementRefCounter().toString(36); | ||
var { | ||
filePath, | ||
packageName | ||
} = fileScope_dist_vanillaExtractCssFileScope.getFileScope(); | ||
const fileScopeHash = hash__default["default"](packageName ? `${packageName}${filePath}` : filePath); | ||
let identifier = `${fileScopeHash}${refCount}`; | ||
var fileScopeHash = hash__default["default"](packageName ? "".concat(packageName).concat(filePath) : filePath); | ||
var identifier = "".concat(fileScopeHash).concat(refCount); | ||
if (identOption === 'debug') { | ||
const devPrefix = getDevPrefix({ | ||
var devPrefix = getDevPrefix({ | ||
debugId, | ||
@@ -115,3 +194,3 @@ debugFileName | ||
if (devPrefix) { | ||
identifier = `${devPrefix}__${identifier}`; | ||
identifier = "".concat(devPrefix, "__").concat(identifier); | ||
} | ||
@@ -127,4 +206,4 @@ return normalizeIdentifier(identifier); | ||
}); | ||
if (!identifier.match(/^[A-Z_][0-9A-Z_]+$/i)) { | ||
throw new Error(`Identifier function returned invalid indentifier: "${identifier}"`); | ||
if (!identifier.match(IDENTIFIER_REGEXP)) { | ||
throw new Error("Identifier function returned invalid indentifier: \"".concat(identifier, "\"")); | ||
} | ||
@@ -136,6 +215,6 @@ return identifier; | ||
const normaliseObject = obj => _private.walkObject(obj, () => ''); | ||
var normaliseObject = obj => _private.walkObject(obj, () => ''); | ||
function validateContract(contract, tokens) { | ||
const theDiff = deepObjectDiff.diff(normaliseObject(contract), normaliseObject(tokens)); | ||
const valid = Object.keys(theDiff).length === 0; | ||
var theDiff = deepObjectDiff.diff(normaliseObject(contract), normaliseObject(tokens)); | ||
var valid = Object.keys(theDiff).length === 0; | ||
return { | ||
@@ -147,10 +226,10 @@ valid, | ||
function diffLine(value, nesting, type) { | ||
const whitespace = [...Array(nesting).keys()].map(() => ' ').join(''); | ||
const line = `${type ? type : ' '}${whitespace}${value}`; | ||
var whitespace = [...Array(nesting).keys()].map(() => ' ').join(''); | ||
var line = "".concat(type ? type : ' ').concat(whitespace).concat(value); | ||
if (process.env.NODE_ENV !== 'test') { | ||
if (type === '-') { | ||
return chalk__default["default"].red(line); | ||
return pc__default["default"].red(line); | ||
} | ||
if (type === '+') { | ||
return chalk__default["default"].green(line); | ||
return pc__default["default"].green(line); | ||
} | ||
@@ -160,19 +239,20 @@ } | ||
} | ||
function renderDiff(orig, diff, nesting = 0) { | ||
const lines = []; | ||
function renderDiff(orig, diff) { | ||
var nesting = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; | ||
var lines = []; | ||
if (nesting === 0) { | ||
lines.push(diffLine('{', 0)); | ||
} | ||
const innerNesting = nesting + 1; | ||
const keys = Object.keys(diff).sort(); | ||
for (const key of keys) { | ||
const value = diff[key]; | ||
var innerNesting = nesting + 1; | ||
var keys = Object.keys(diff).sort(); | ||
for (var key of keys) { | ||
var value = diff[key]; | ||
if (!(key in orig)) { | ||
lines.push(diffLine(`${key}: ...,`, innerNesting, '+')); | ||
lines.push(diffLine("".concat(key, ": ...,"), innerNesting, '+')); | ||
} else if (typeof value === 'object') { | ||
lines.push(diffLine(`${key}: {`, innerNesting)); | ||
lines.push(diffLine("".concat(key, ": {"), innerNesting)); | ||
lines.push(renderDiff(orig[key], diff[key], innerNesting)); | ||
lines.push(diffLine('}', innerNesting)); | ||
} else { | ||
lines.push(diffLine(`${key}: ...,`, innerNesting, '-')); | ||
lines.push(diffLine("".concat(key, ": ...,"), innerNesting, '-')); | ||
} | ||
@@ -187,3 +267,3 @@ } | ||
function createVar(debugId) { | ||
const cssVarName = cssesc__default["default"](generateIdentifier({ | ||
var cssVarName = cssesc__default["default"](generateIdentifier({ | ||
debugId, | ||
@@ -194,6 +274,9 @@ debugFileName: false | ||
}); | ||
return `var(--${cssVarName})`; | ||
return "var(--".concat(cssVarName, ")"); | ||
} | ||
function fallbackVar(...values) { | ||
let finalValue = ''; | ||
function fallbackVar() { | ||
var finalValue = ''; | ||
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) { | ||
values[_key] = arguments[_key]; | ||
} | ||
values.reverse().forEach(value => { | ||
@@ -204,5 +287,5 @@ if (finalValue === '') { | ||
if (typeof value !== 'string' || !/^var\(--.*\)$/.test(value)) { | ||
throw new Error(`Invalid variable name: ${value}`); | ||
throw new Error("Invalid variable name: ".concat(value)); | ||
} | ||
finalValue = value.replace(/\)$/, `, ${finalValue})`); | ||
finalValue = value.replace(/\)$/, ", ".concat(finalValue, ")")); | ||
} | ||
@@ -213,4 +296,4 @@ }); | ||
function assignVars(varContract, tokens) { | ||
const varSetters = {}; | ||
const { | ||
var varSetters = {}; | ||
var { | ||
valid, | ||
@@ -220,3 +303,3 @@ diffString | ||
if (!valid) { | ||
throw new Error(`Tokens don't match contract.\n${diffString}`); | ||
throw new Error("Tokens don't match contract.\n".concat(diffString)); | ||
} | ||
@@ -235,10 +318,10 @@ _private.walkObject(tokens, (value, path) => { | ||
return _private.walkObject(tokens, (value, path) => { | ||
const rawVarName = typeof mapFn === 'function' ? mapFn(value, path) : value; | ||
const varName = typeof rawVarName === 'string' ? rawVarName.replace(/^\-\-/, '') : null; | ||
var rawVarName = typeof mapFn === 'function' ? mapFn(value, path) : value; | ||
var varName = typeof rawVarName === 'string' ? rawVarName.replace(/^\-\-/, '') : null; | ||
if (typeof varName !== 'string' || varName !== cssesc__default["default"](varName, { | ||
isIdentifier: true | ||
})) { | ||
throw new Error(`Invalid variable name for "${path.join('.')}": ${varName}`); | ||
throw new Error("Invalid variable name for \"".concat(path.join('.'), "\": ").concat(varName)); | ||
} | ||
return `var(--${varName})`; | ||
return "var(--".concat(varName, ")"); | ||
}); | ||
@@ -248,5 +331,5 @@ } | ||
function createGlobalTheme(selector, arg2, arg3) { | ||
const shouldCreateVars = Boolean(!arg3); | ||
const themeVars = shouldCreateVars ? createThemeContract(arg2) : arg2; | ||
const tokens = shouldCreateVars ? arg2 : arg3; | ||
var shouldCreateVars = Boolean(!arg3); | ||
var themeVars = shouldCreateVars ? createThemeContract(arg2) : arg2; | ||
var tokens = shouldCreateVars ? arg2 : arg3; | ||
adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
@@ -264,14 +347,15 @@ type: 'global', | ||
function createTheme(arg1, arg2, arg3) { | ||
const themeClassName = generateIdentifier(typeof arg2 === 'object' ? arg3 : arg2); | ||
var themeClassName = generateIdentifier(typeof arg2 === 'object' ? arg3 : arg2); | ||
adapter_dist_vanillaExtractCssAdapter.registerClassName(themeClassName, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
const vars = typeof arg2 === 'object' ? createGlobalTheme(themeClassName, arg1, arg2) : createGlobalTheme(themeClassName, arg1); | ||
var vars = typeof arg2 === 'object' ? createGlobalTheme(themeClassName, arg1, arg2) : createGlobalTheme(themeClassName, arg1); | ||
return vars ? [themeClassName, vars] : themeClassName; | ||
} | ||
var _templateObject; | ||
function composedStyle(rules, debugId) { | ||
const className = generateIdentifier(debugId); | ||
var className = generateIdentifier(debugId); | ||
adapter_dist_vanillaExtractCssAdapter.registerClassName(className, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
const classList = []; | ||
const styleRules = []; | ||
for (const rule of rules) { | ||
var classList = []; | ||
var styleRules = []; | ||
for (var rule of rules) { | ||
if (typeof rule === 'string') { | ||
@@ -283,5 +367,5 @@ classList.push(rule); | ||
} | ||
let result = className; | ||
var result = className; | ||
if (classList.length > 0) { | ||
result = `${className} ${transformCss_dist_vanillaExtractCssTransformCss.dudupeAndJoinClassList(classList)}`; | ||
result = "".concat(className, " ").concat(transformCss_dist_vanillaExtractCssTransformCss.dudupeAndJoinClassList(classList)); | ||
adapter_dist_vanillaExtractCssAdapter.registerComposition({ | ||
@@ -298,3 +382,3 @@ identifier: className, | ||
if (styleRules.length > 0) { | ||
const rule = deepmerge__default["default"].all(styleRules, { | ||
var _rule = deepmerge__default["default"].all(styleRules, { | ||
// Replace arrays rather than merging | ||
@@ -306,3 +390,3 @@ arrayMerge: (_, sourceArray) => sourceArray | ||
selector: className, | ||
rule | ||
rule: _rule | ||
}, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
@@ -316,3 +400,3 @@ } | ||
} | ||
const className = generateIdentifier(debugId); | ||
var className = generateIdentifier(debugId); | ||
adapter_dist_vanillaExtractCssAdapter.registerClassName(className, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
@@ -330,4 +414,7 @@ adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
*/ | ||
function composeStyles(...classNames) { | ||
const compose = fileScope_dist_vanillaExtractCssFileScope.hasFileScope() ? composedStyle : transformCss_dist_vanillaExtractCssTransformCss.dudupeAndJoinClassList; | ||
function composeStyles() { | ||
var compose = fileScope_dist_vanillaExtractCssFileScope.hasFileScope() ? composedStyle : transformCss_dist_vanillaExtractCssTransformCss.dudupeAndJoinClassList; | ||
for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) { | ||
classNames[_key] = arguments[_key]; | ||
} | ||
return compose(classNames); | ||
@@ -343,20 +430,15 @@ } | ||
function fontFace(rule, debugId) { | ||
const fontFamily = `"${cssesc__default["default"](generateIdentifier(debugId), { | ||
var fontFamily = "\"".concat(cssesc__default["default"](generateIdentifier(debugId), { | ||
quotes: 'double' | ||
})}"`; | ||
const rules = Array.isArray(rule) ? rule : [rule]; | ||
for (const singleRule of rules) { | ||
}), "\""); | ||
var rules = Array.isArray(rule) ? rule : [rule]; | ||
for (var singleRule of rules) { | ||
if ('fontFamily' in singleRule) { | ||
throw new Error(outdent__default["default"]` | ||
This function creates and returns a hashed font-family name, so the "fontFamily" property should not be provided. | ||
If you'd like to define a globally scoped custom font, you can use the "globalFontFace" function instead. | ||
`); | ||
throw new Error(dedent__default["default"](_templateObject || (_templateObject = taggedTemplateLiteral._taggedTemplateLiteral(["\n This function creates and returns a hashed font-family name, so the \"fontFamily\" property should not be provided.\n \n If you'd like to define a globally scoped custom font, you can use the \"globalFontFace\" function instead.\n "])))); | ||
} | ||
adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
type: 'fontFace', | ||
rule: { | ||
...singleRule, | ||
rule: transformCss_dist_vanillaExtractCssTransformCss._objectSpread2(transformCss_dist_vanillaExtractCssTransformCss._objectSpread2({}, singleRule), {}, { | ||
fontFamily | ||
} | ||
}) | ||
}, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
@@ -367,12 +449,14 @@ } | ||
function globalFontFace(fontFamily, rule) { | ||
adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
type: 'fontFace', | ||
rule: { | ||
...rule, | ||
fontFamily | ||
} | ||
}, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
var rules = Array.isArray(rule) ? rule : [rule]; | ||
for (var singleRule of rules) { | ||
adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
type: 'fontFace', | ||
rule: transformCss_dist_vanillaExtractCssTransformCss._objectSpread2(transformCss_dist_vanillaExtractCssTransformCss._objectSpread2({}, singleRule), {}, { | ||
fontFamily | ||
}) | ||
}, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
} | ||
} | ||
function keyframes(rule, debugId) { | ||
const name = cssesc__default["default"](generateIdentifier(debugId), { | ||
var name = cssesc__default["default"](generateIdentifier(debugId), { | ||
isIdentifier: true | ||
@@ -394,18 +478,18 @@ }); | ||
} | ||
function styleVariants(...args) { | ||
if (typeof args[1] === 'function') { | ||
const data = args[0]; | ||
const mapData = args[1]; | ||
const debugId = args[2]; | ||
const classMap = {}; | ||
for (const key in data) { | ||
classMap[key] = style(mapData(data[key], key), debugId ? `${debugId}_${key}` : key); | ||
function styleVariants() { | ||
if (typeof (arguments.length <= 1 ? undefined : arguments[1]) === 'function') { | ||
var _data = arguments.length <= 0 ? undefined : arguments[0]; | ||
var _mapData = arguments.length <= 1 ? undefined : arguments[1]; | ||
var _debugId = arguments.length <= 2 ? undefined : arguments[2]; | ||
var _classMap = {}; | ||
for (var _key2 in _data) { | ||
_classMap[_key2] = style(_mapData(_data[_key2], _key2), _debugId ? "".concat(_debugId, "_").concat(_key2) : _key2); | ||
} | ||
return classMap; | ||
return _classMap; | ||
} | ||
const styleMap = args[0]; | ||
const debugId = args[1]; | ||
const classMap = {}; | ||
for (const key in styleMap) { | ||
classMap[key] = style(styleMap[key], debugId ? `${debugId}_${key}` : key); | ||
var styleMap = arguments.length <= 0 ? undefined : arguments[0]; | ||
var debugId = arguments.length <= 1 ? undefined : arguments[1]; | ||
var classMap = {}; | ||
for (var _key3 in styleMap) { | ||
classMap[_key3] = style(styleMap[_key3], debugId ? "".concat(debugId, "_").concat(_key3) : _key3); | ||
} | ||
@@ -417,23 +501,20 @@ return classMap; | ||
// For now it is mostly just an alias of generateIdentifier | ||
const createContainer = debugId => generateIdentifier(debugId); | ||
var createContainer = debugId => generateIdentifier(debugId); | ||
const defaultLayerOptions = {}; | ||
const merge = (obj1, obj2) => ({ | ||
...obj1, | ||
...obj2 | ||
}); | ||
const getLayerArgs = (...args) => { | ||
let options = defaultLayerOptions; | ||
let debugId = args[0]; | ||
if (typeof args[0] === 'object') { | ||
options = merge(defaultLayerOptions, args[0]); | ||
debugId = args[1]; | ||
var defaultLayerOptions = {}; | ||
var merge = (obj1, obj2) => transformCss_dist_vanillaExtractCssTransformCss._objectSpread2(transformCss_dist_vanillaExtractCssTransformCss._objectSpread2({}, obj1), obj2); | ||
var getLayerArgs = function getLayerArgs() { | ||
var options = defaultLayerOptions; | ||
var debugId = arguments.length <= 0 ? undefined : arguments[0]; | ||
if (typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'object') { | ||
options = merge(defaultLayerOptions, arguments.length <= 0 ? undefined : arguments[0]); | ||
debugId = arguments.length <= 1 ? undefined : arguments[1]; | ||
} | ||
return [options, debugId]; | ||
}; | ||
function layer(...args) { | ||
const [options, debugId] = getLayerArgs(...args); | ||
let name = generateIdentifier(debugId); | ||
function layer() { | ||
var [options, debugId] = getLayerArgs(...arguments); | ||
var name = generateIdentifier(debugId); | ||
if (options.parent) { | ||
name = `${options.parent}.${name}`; | ||
name = "".concat(options.parent, ".").concat(name); | ||
} | ||
@@ -446,6 +527,6 @@ adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
} | ||
function globalLayer(...args) { | ||
let [options, name] = getLayerArgs(...args); | ||
function globalLayer() { | ||
var [options, name] = getLayerArgs(...arguments); | ||
if (options.parent) { | ||
name = `${options.parent}.${name}`; | ||
name = "".concat(options.parent, ".").concat(name); | ||
} | ||
@@ -452,0 +533,0 @@ adapter_dist_vanillaExtractCssAdapter.appendCss({ |
@@ -6,3 +6,3 @@ 'use strict'; | ||
var injectStyles_dist_vanillaExtractCssInjectStyles = require('../injectStyles/dist/vanilla-extract-css-injectStyles.cjs.prod.js'); | ||
var transformCss_dist_vanillaExtractCssTransformCss = require('./transformCss-f0d00910.cjs.prod.js'); | ||
var transformCss_dist_vanillaExtractCssTransformCss = require('./transformCss-5f281e7b.cjs.prod.js'); | ||
var adapter_dist_vanillaExtractCssAdapter = require('../adapter/dist/vanilla-extract-css-adapter.cjs.prod.js'); | ||
@@ -14,4 +14,5 @@ var hash = require('@emotion/hash'); | ||
var deepObjectDiff = require('deep-object-diff'); | ||
var chalk = require('chalk'); | ||
var outdent = require('outdent'); | ||
var pc = require('picocolors'); | ||
var taggedTemplateLiteral = require('./taggedTemplateLiteral-0bfb2e96.cjs.prod.js'); | ||
var dedent = require('dedent'); | ||
var deepmerge = require('deepmerge'); | ||
@@ -26,10 +27,10 @@ require('modern-ahocorasick'); | ||
var cssesc__default = /*#__PURE__*/_interopDefault(cssesc); | ||
var chalk__default = /*#__PURE__*/_interopDefault(chalk); | ||
var outdent__default = /*#__PURE__*/_interopDefault(outdent); | ||
var pc__default = /*#__PURE__*/_interopDefault(pc); | ||
var dedent__default = /*#__PURE__*/_interopDefault(dedent); | ||
var deepmerge__default = /*#__PURE__*/_interopDefault(deepmerge); | ||
const localClassNames = new Set(); | ||
const composedClassLists = []; | ||
let bufferedCSSObjs = []; | ||
const browserRuntimeAdapter = { | ||
var localClassNames = new Set(); | ||
var composedClassLists = []; | ||
var bufferedCSSObjs = []; | ||
var browserRuntimeAdapter = { | ||
appendCss: cssObj => { | ||
@@ -46,3 +47,3 @@ bufferedCSSObjs.push(cssObj); | ||
onEndFileScope: fileScope => { | ||
const css = transformCss_dist_vanillaExtractCssTransformCss.transformCss({ | ||
var css = transformCss_dist_vanillaExtractCssTransformCss.transformCss({ | ||
localClassNames: Array.from(localClassNames), | ||
@@ -64,14 +65,93 @@ composedClassLists, | ||
function getDevPrefix({ | ||
debugId, | ||
debugFileName | ||
}) { | ||
const parts = debugId ? [debugId.replace(/\s/g, '_')] : []; | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
function _inherits(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
Object.defineProperty(subClass, "prototype", { | ||
writable: false | ||
}); | ||
if (superClass) _setPrototypeOf(subClass, superClass); | ||
} | ||
function _wrapRegExp() { | ||
_wrapRegExp = function (e, r) { | ||
return new BabelRegExp(e, void 0, r); | ||
}; | ||
var e = RegExp.prototype, | ||
r = new WeakMap(); | ||
function BabelRegExp(e, t, p) { | ||
var o = new RegExp(e, t); | ||
return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); | ||
} | ||
function buildGroups(e, t) { | ||
var p = r.get(t); | ||
return Object.keys(p).reduce(function (r, t) { | ||
var o = p[t]; | ||
if ("number" == typeof o) r[t] = e[o];else { | ||
for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; | ||
r[t] = e[o[i]]; | ||
} | ||
return r; | ||
}, Object.create(null)); | ||
} | ||
return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { | ||
var t = e.exec.call(this, r); | ||
if (t) { | ||
t.groups = buildGroups(t, this); | ||
var p = t.indices; | ||
p && (p.groups = buildGroups(p, this)); | ||
} | ||
return t; | ||
}, BabelRegExp.prototype[Symbol.replace] = function (t, p) { | ||
if ("string" == typeof p) { | ||
var o = r.get(this); | ||
return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) { | ||
var t = o[r]; | ||
return "$" + (Array.isArray(t) ? t.join("$") : t); | ||
})); | ||
} | ||
if ("function" == typeof p) { | ||
var i = this; | ||
return e[Symbol.replace].call(this, t, function () { | ||
var e = arguments; | ||
return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); | ||
}); | ||
} | ||
return e[Symbol.replace].call(this, t, p); | ||
}, _wrapRegExp.apply(this, arguments); | ||
} | ||
var DIR_FILE_REGEXP = /*#__PURE__*/_wrapRegExp(/([^\/\\]*)?[\/\\]?([^\/\\]*)\.css\.(?:ts|js|tsx|jsx|cjs|mjs)$/, { | ||
dir: 1, | ||
file: 2 | ||
}); | ||
var WHITESPACE_REGEXP = /\s/g; | ||
function getDevPrefix(_ref) { | ||
var { | ||
debugId, | ||
debugFileName | ||
} = _ref; | ||
var parts = debugId ? [debugId.replace(WHITESPACE_REGEXP, '_')] : []; | ||
if (debugFileName) { | ||
const { | ||
var { | ||
filePath | ||
} = fileScope_dist_vanillaExtractCssFileScope.getFileScope(); | ||
const matches = filePath.match(/(?<dir>[^\/\\]*)?[\/\\]?(?<file>[^\/\\]*)\.css\.(ts|js|tsx|jsx|cjs|mjs)$/); | ||
var matches = filePath.match(DIR_FILE_REGEXP); | ||
if (matches && matches.groups) { | ||
const { | ||
var { | ||
dir, | ||
@@ -85,27 +165,26 @@ file | ||
} | ||
var NORMALIZE_REGEXP = /^[0-9]/; | ||
function normalizeIdentifier(identifier) { | ||
return identifier.match(/^[0-9]/) ? `_${identifier}` : identifier; | ||
return NORMALIZE_REGEXP.test(identifier) ? "_".concat(identifier) : identifier; | ||
} | ||
var IDENTIFIER_REGEXP = /^[A-Z_][0-9A-Z_-]+$/i; | ||
function generateIdentifier(arg) { | ||
const identOption = adapter_dist_vanillaExtractCssAdapter.getIdentOption(); | ||
const { | ||
var identOption = adapter_dist_vanillaExtractCssAdapter.getIdentOption(); | ||
var { | ||
debugId, | ||
debugFileName = true | ||
} = { | ||
...(typeof arg === 'string' ? { | ||
debugId: arg | ||
} : null), | ||
...(typeof arg === 'object' ? arg : null) | ||
}; | ||
} = transformCss_dist_vanillaExtractCssTransformCss._objectSpread2(transformCss_dist_vanillaExtractCssTransformCss._objectSpread2({}, typeof arg === 'string' ? { | ||
debugId: arg | ||
} : null), typeof arg === 'object' ? arg : null); | ||
// Convert ref count to base 36 for optimal hash lengths | ||
const refCount = fileScope_dist_vanillaExtractCssFileScope.getAndIncrementRefCounter().toString(36); | ||
const { | ||
var refCount = fileScope_dist_vanillaExtractCssFileScope.getAndIncrementRefCounter().toString(36); | ||
var { | ||
filePath, | ||
packageName | ||
} = fileScope_dist_vanillaExtractCssFileScope.getFileScope(); | ||
const fileScopeHash = hash__default["default"](packageName ? `${packageName}${filePath}` : filePath); | ||
let identifier = `${fileScopeHash}${refCount}`; | ||
var fileScopeHash = hash__default["default"](packageName ? "".concat(packageName).concat(filePath) : filePath); | ||
var identifier = "".concat(fileScopeHash).concat(refCount); | ||
if (identOption === 'debug') { | ||
const devPrefix = getDevPrefix({ | ||
var devPrefix = getDevPrefix({ | ||
debugId, | ||
@@ -115,3 +194,3 @@ debugFileName | ||
if (devPrefix) { | ||
identifier = `${devPrefix}__${identifier}`; | ||
identifier = "".concat(devPrefix, "__").concat(identifier); | ||
} | ||
@@ -127,4 +206,4 @@ return normalizeIdentifier(identifier); | ||
}); | ||
if (!identifier.match(/^[A-Z_][0-9A-Z_]+$/i)) { | ||
throw new Error(`Identifier function returned invalid indentifier: "${identifier}"`); | ||
if (!identifier.match(IDENTIFIER_REGEXP)) { | ||
throw new Error("Identifier function returned invalid indentifier: \"".concat(identifier, "\"")); | ||
} | ||
@@ -136,6 +215,6 @@ return identifier; | ||
const normaliseObject = obj => _private.walkObject(obj, () => ''); | ||
var normaliseObject = obj => _private.walkObject(obj, () => ''); | ||
function validateContract(contract, tokens) { | ||
const theDiff = deepObjectDiff.diff(normaliseObject(contract), normaliseObject(tokens)); | ||
const valid = Object.keys(theDiff).length === 0; | ||
var theDiff = deepObjectDiff.diff(normaliseObject(contract), normaliseObject(tokens)); | ||
var valid = Object.keys(theDiff).length === 0; | ||
return { | ||
@@ -147,10 +226,10 @@ valid, | ||
function diffLine(value, nesting, type) { | ||
const whitespace = [...Array(nesting).keys()].map(() => ' ').join(''); | ||
const line = `${type ? type : ' '}${whitespace}${value}`; | ||
var whitespace = [...Array(nesting).keys()].map(() => ' ').join(''); | ||
var line = "".concat(type ? type : ' ').concat(whitespace).concat(value); | ||
{ | ||
if (type === '-') { | ||
return chalk__default["default"].red(line); | ||
return pc__default["default"].red(line); | ||
} | ||
if (type === '+') { | ||
return chalk__default["default"].green(line); | ||
return pc__default["default"].green(line); | ||
} | ||
@@ -160,19 +239,20 @@ } | ||
} | ||
function renderDiff(orig, diff, nesting = 0) { | ||
const lines = []; | ||
function renderDiff(orig, diff) { | ||
var nesting = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; | ||
var lines = []; | ||
if (nesting === 0) { | ||
lines.push(diffLine('{', 0)); | ||
} | ||
const innerNesting = nesting + 1; | ||
const keys = Object.keys(diff).sort(); | ||
for (const key of keys) { | ||
const value = diff[key]; | ||
var innerNesting = nesting + 1; | ||
var keys = Object.keys(diff).sort(); | ||
for (var key of keys) { | ||
var value = diff[key]; | ||
if (!(key in orig)) { | ||
lines.push(diffLine(`${key}: ...,`, innerNesting, '+')); | ||
lines.push(diffLine("".concat(key, ": ...,"), innerNesting, '+')); | ||
} else if (typeof value === 'object') { | ||
lines.push(diffLine(`${key}: {`, innerNesting)); | ||
lines.push(diffLine("".concat(key, ": {"), innerNesting)); | ||
lines.push(renderDiff(orig[key], diff[key], innerNesting)); | ||
lines.push(diffLine('}', innerNesting)); | ||
} else { | ||
lines.push(diffLine(`${key}: ...,`, innerNesting, '-')); | ||
lines.push(diffLine("".concat(key, ": ...,"), innerNesting, '-')); | ||
} | ||
@@ -187,3 +267,3 @@ } | ||
function createVar(debugId) { | ||
const cssVarName = cssesc__default["default"](generateIdentifier({ | ||
var cssVarName = cssesc__default["default"](generateIdentifier({ | ||
debugId, | ||
@@ -194,6 +274,9 @@ debugFileName: false | ||
}); | ||
return `var(--${cssVarName})`; | ||
return "var(--".concat(cssVarName, ")"); | ||
} | ||
function fallbackVar(...values) { | ||
let finalValue = ''; | ||
function fallbackVar() { | ||
var finalValue = ''; | ||
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) { | ||
values[_key] = arguments[_key]; | ||
} | ||
values.reverse().forEach(value => { | ||
@@ -204,5 +287,5 @@ if (finalValue === '') { | ||
if (typeof value !== 'string' || !/^var\(--.*\)$/.test(value)) { | ||
throw new Error(`Invalid variable name: ${value}`); | ||
throw new Error("Invalid variable name: ".concat(value)); | ||
} | ||
finalValue = value.replace(/\)$/, `, ${finalValue})`); | ||
finalValue = value.replace(/\)$/, ", ".concat(finalValue, ")")); | ||
} | ||
@@ -213,4 +296,4 @@ }); | ||
function assignVars(varContract, tokens) { | ||
const varSetters = {}; | ||
const { | ||
var varSetters = {}; | ||
var { | ||
valid, | ||
@@ -220,3 +303,3 @@ diffString | ||
if (!valid) { | ||
throw new Error(`Tokens don't match contract.\n${diffString}`); | ||
throw new Error("Tokens don't match contract.\n".concat(diffString)); | ||
} | ||
@@ -235,10 +318,10 @@ _private.walkObject(tokens, (value, path) => { | ||
return _private.walkObject(tokens, (value, path) => { | ||
const rawVarName = typeof mapFn === 'function' ? mapFn(value, path) : value; | ||
const varName = typeof rawVarName === 'string' ? rawVarName.replace(/^\-\-/, '') : null; | ||
var rawVarName = typeof mapFn === 'function' ? mapFn(value, path) : value; | ||
var varName = typeof rawVarName === 'string' ? rawVarName.replace(/^\-\-/, '') : null; | ||
if (typeof varName !== 'string' || varName !== cssesc__default["default"](varName, { | ||
isIdentifier: true | ||
})) { | ||
throw new Error(`Invalid variable name for "${path.join('.')}": ${varName}`); | ||
throw new Error("Invalid variable name for \"".concat(path.join('.'), "\": ").concat(varName)); | ||
} | ||
return `var(--${varName})`; | ||
return "var(--".concat(varName, ")"); | ||
}); | ||
@@ -248,5 +331,5 @@ } | ||
function createGlobalTheme(selector, arg2, arg3) { | ||
const shouldCreateVars = Boolean(!arg3); | ||
const themeVars = shouldCreateVars ? createThemeContract(arg2) : arg2; | ||
const tokens = shouldCreateVars ? arg2 : arg3; | ||
var shouldCreateVars = Boolean(!arg3); | ||
var themeVars = shouldCreateVars ? createThemeContract(arg2) : arg2; | ||
var tokens = shouldCreateVars ? arg2 : arg3; | ||
adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
@@ -264,14 +347,15 @@ type: 'global', | ||
function createTheme(arg1, arg2, arg3) { | ||
const themeClassName = generateIdentifier(typeof arg2 === 'object' ? arg3 : arg2); | ||
var themeClassName = generateIdentifier(typeof arg2 === 'object' ? arg3 : arg2); | ||
adapter_dist_vanillaExtractCssAdapter.registerClassName(themeClassName, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
const vars = typeof arg2 === 'object' ? createGlobalTheme(themeClassName, arg1, arg2) : createGlobalTheme(themeClassName, arg1); | ||
var vars = typeof arg2 === 'object' ? createGlobalTheme(themeClassName, arg1, arg2) : createGlobalTheme(themeClassName, arg1); | ||
return vars ? [themeClassName, vars] : themeClassName; | ||
} | ||
var _templateObject; | ||
function composedStyle(rules, debugId) { | ||
const className = generateIdentifier(debugId); | ||
var className = generateIdentifier(debugId); | ||
adapter_dist_vanillaExtractCssAdapter.registerClassName(className, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
const classList = []; | ||
const styleRules = []; | ||
for (const rule of rules) { | ||
var classList = []; | ||
var styleRules = []; | ||
for (var rule of rules) { | ||
if (typeof rule === 'string') { | ||
@@ -283,5 +367,5 @@ classList.push(rule); | ||
} | ||
let result = className; | ||
var result = className; | ||
if (classList.length > 0) { | ||
result = `${className} ${transformCss_dist_vanillaExtractCssTransformCss.dudupeAndJoinClassList(classList)}`; | ||
result = "".concat(className, " ").concat(transformCss_dist_vanillaExtractCssTransformCss.dudupeAndJoinClassList(classList)); | ||
adapter_dist_vanillaExtractCssAdapter.registerComposition({ | ||
@@ -298,3 +382,3 @@ identifier: className, | ||
if (styleRules.length > 0) { | ||
const rule = deepmerge__default["default"].all(styleRules, { | ||
var _rule = deepmerge__default["default"].all(styleRules, { | ||
// Replace arrays rather than merging | ||
@@ -306,3 +390,3 @@ arrayMerge: (_, sourceArray) => sourceArray | ||
selector: className, | ||
rule | ||
rule: _rule | ||
}, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
@@ -316,3 +400,3 @@ } | ||
} | ||
const className = generateIdentifier(debugId); | ||
var className = generateIdentifier(debugId); | ||
adapter_dist_vanillaExtractCssAdapter.registerClassName(className, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
@@ -330,4 +414,7 @@ adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
*/ | ||
function composeStyles(...classNames) { | ||
const compose = fileScope_dist_vanillaExtractCssFileScope.hasFileScope() ? composedStyle : transformCss_dist_vanillaExtractCssTransformCss.dudupeAndJoinClassList; | ||
function composeStyles() { | ||
var compose = fileScope_dist_vanillaExtractCssFileScope.hasFileScope() ? composedStyle : transformCss_dist_vanillaExtractCssTransformCss.dudupeAndJoinClassList; | ||
for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) { | ||
classNames[_key] = arguments[_key]; | ||
} | ||
return compose(classNames); | ||
@@ -343,20 +430,15 @@ } | ||
function fontFace(rule, debugId) { | ||
const fontFamily = `"${cssesc__default["default"](generateIdentifier(debugId), { | ||
var fontFamily = "\"".concat(cssesc__default["default"](generateIdentifier(debugId), { | ||
quotes: 'double' | ||
})}"`; | ||
const rules = Array.isArray(rule) ? rule : [rule]; | ||
for (const singleRule of rules) { | ||
}), "\""); | ||
var rules = Array.isArray(rule) ? rule : [rule]; | ||
for (var singleRule of rules) { | ||
if ('fontFamily' in singleRule) { | ||
throw new Error(outdent__default["default"]` | ||
This function creates and returns a hashed font-family name, so the "fontFamily" property should not be provided. | ||
If you'd like to define a globally scoped custom font, you can use the "globalFontFace" function instead. | ||
`); | ||
throw new Error(dedent__default["default"](_templateObject || (_templateObject = taggedTemplateLiteral._taggedTemplateLiteral(["\n This function creates and returns a hashed font-family name, so the \"fontFamily\" property should not be provided.\n \n If you'd like to define a globally scoped custom font, you can use the \"globalFontFace\" function instead.\n "])))); | ||
} | ||
adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
type: 'fontFace', | ||
rule: { | ||
...singleRule, | ||
rule: transformCss_dist_vanillaExtractCssTransformCss._objectSpread2(transformCss_dist_vanillaExtractCssTransformCss._objectSpread2({}, singleRule), {}, { | ||
fontFamily | ||
} | ||
}) | ||
}, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
@@ -367,12 +449,14 @@ } | ||
function globalFontFace(fontFamily, rule) { | ||
adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
type: 'fontFace', | ||
rule: { | ||
...rule, | ||
fontFamily | ||
} | ||
}, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
var rules = Array.isArray(rule) ? rule : [rule]; | ||
for (var singleRule of rules) { | ||
adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
type: 'fontFace', | ||
rule: transformCss_dist_vanillaExtractCssTransformCss._objectSpread2(transformCss_dist_vanillaExtractCssTransformCss._objectSpread2({}, singleRule), {}, { | ||
fontFamily | ||
}) | ||
}, fileScope_dist_vanillaExtractCssFileScope.getFileScope()); | ||
} | ||
} | ||
function keyframes(rule, debugId) { | ||
const name = cssesc__default["default"](generateIdentifier(debugId), { | ||
var name = cssesc__default["default"](generateIdentifier(debugId), { | ||
isIdentifier: true | ||
@@ -394,18 +478,18 @@ }); | ||
} | ||
function styleVariants(...args) { | ||
if (typeof args[1] === 'function') { | ||
const data = args[0]; | ||
const mapData = args[1]; | ||
const debugId = args[2]; | ||
const classMap = {}; | ||
for (const key in data) { | ||
classMap[key] = style(mapData(data[key], key), debugId ? `${debugId}_${key}` : key); | ||
function styleVariants() { | ||
if (typeof (arguments.length <= 1 ? undefined : arguments[1]) === 'function') { | ||
var _data = arguments.length <= 0 ? undefined : arguments[0]; | ||
var _mapData = arguments.length <= 1 ? undefined : arguments[1]; | ||
var _debugId = arguments.length <= 2 ? undefined : arguments[2]; | ||
var _classMap = {}; | ||
for (var _key2 in _data) { | ||
_classMap[_key2] = style(_mapData(_data[_key2], _key2), _debugId ? "".concat(_debugId, "_").concat(_key2) : _key2); | ||
} | ||
return classMap; | ||
return _classMap; | ||
} | ||
const styleMap = args[0]; | ||
const debugId = args[1]; | ||
const classMap = {}; | ||
for (const key in styleMap) { | ||
classMap[key] = style(styleMap[key], debugId ? `${debugId}_${key}` : key); | ||
var styleMap = arguments.length <= 0 ? undefined : arguments[0]; | ||
var debugId = arguments.length <= 1 ? undefined : arguments[1]; | ||
var classMap = {}; | ||
for (var _key3 in styleMap) { | ||
classMap[_key3] = style(styleMap[_key3], debugId ? "".concat(debugId, "_").concat(_key3) : _key3); | ||
} | ||
@@ -417,23 +501,20 @@ return classMap; | ||
// For now it is mostly just an alias of generateIdentifier | ||
const createContainer = debugId => generateIdentifier(debugId); | ||
var createContainer = debugId => generateIdentifier(debugId); | ||
const defaultLayerOptions = {}; | ||
const merge = (obj1, obj2) => ({ | ||
...obj1, | ||
...obj2 | ||
}); | ||
const getLayerArgs = (...args) => { | ||
let options = defaultLayerOptions; | ||
let debugId = args[0]; | ||
if (typeof args[0] === 'object') { | ||
options = merge(defaultLayerOptions, args[0]); | ||
debugId = args[1]; | ||
var defaultLayerOptions = {}; | ||
var merge = (obj1, obj2) => transformCss_dist_vanillaExtractCssTransformCss._objectSpread2(transformCss_dist_vanillaExtractCssTransformCss._objectSpread2({}, obj1), obj2); | ||
var getLayerArgs = function getLayerArgs() { | ||
var options = defaultLayerOptions; | ||
var debugId = arguments.length <= 0 ? undefined : arguments[0]; | ||
if (typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'object') { | ||
options = merge(defaultLayerOptions, arguments.length <= 0 ? undefined : arguments[0]); | ||
debugId = arguments.length <= 1 ? undefined : arguments[1]; | ||
} | ||
return [options, debugId]; | ||
}; | ||
function layer(...args) { | ||
const [options, debugId] = getLayerArgs(...args); | ||
let name = generateIdentifier(debugId); | ||
function layer() { | ||
var [options, debugId] = getLayerArgs(...arguments); | ||
var name = generateIdentifier(debugId); | ||
if (options.parent) { | ||
name = `${options.parent}.${name}`; | ||
name = "".concat(options.parent, ".").concat(name); | ||
} | ||
@@ -446,6 +527,6 @@ adapter_dist_vanillaExtractCssAdapter.appendCss({ | ||
} | ||
function globalLayer(...args) { | ||
let [options, name] = getLayerArgs(...args); | ||
function globalLayer() { | ||
var [options, name] = getLayerArgs(...arguments); | ||
if (options.parent) { | ||
name = `${options.parent}.${name}`; | ||
name = "".concat(options.parent, ".").concat(name); | ||
} | ||
@@ -452,0 +533,0 @@ adapter_dist_vanillaExtractCssAdapter.appendCss({ |
import { injectStyles } from '../injectStyles/dist/vanilla-extract-css-injectStyles.esm.js'; | ||
import { t as transformCss, d as dudupeAndJoinClassList } from './transformCss-4ff5fbc3.esm.js'; | ||
import { t as transformCss, _ as _objectSpread2, d as dudupeAndJoinClassList } from './transformCss-9149bda7.esm.js'; | ||
import { setAdapterIfNotSet, getIdentOption, appendCss, registerClassName, registerComposition, markCompositionUsed } from '../adapter/dist/vanilla-extract-css-adapter.esm.js'; | ||
@@ -9,4 +9,5 @@ import hash from '@emotion/hash'; | ||
import { diff } from 'deep-object-diff'; | ||
import chalk from 'chalk'; | ||
import outdent from 'outdent'; | ||
import pc from 'picocolors'; | ||
import { _ as _taggedTemplateLiteral } from './taggedTemplateLiteral-10998315.esm.js'; | ||
import dedent from 'dedent'; | ||
import deepmerge from 'deepmerge'; | ||
@@ -17,6 +18,6 @@ import 'modern-ahocorasick'; | ||
const localClassNames = new Set(); | ||
const composedClassLists = []; | ||
let bufferedCSSObjs = []; | ||
const browserRuntimeAdapter = { | ||
var localClassNames = new Set(); | ||
var composedClassLists = []; | ||
var bufferedCSSObjs = []; | ||
var browserRuntimeAdapter = { | ||
appendCss: cssObj => { | ||
@@ -33,3 +34,3 @@ bufferedCSSObjs.push(cssObj); | ||
onEndFileScope: fileScope => { | ||
const css = transformCss({ | ||
var css = transformCss({ | ||
localClassNames: Array.from(localClassNames), | ||
@@ -51,14 +52,93 @@ composedClassLists, | ||
function getDevPrefix({ | ||
debugId, | ||
debugFileName | ||
}) { | ||
const parts = debugId ? [debugId.replace(/\s/g, '_')] : []; | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
function _inherits(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
Object.defineProperty(subClass, "prototype", { | ||
writable: false | ||
}); | ||
if (superClass) _setPrototypeOf(subClass, superClass); | ||
} | ||
function _wrapRegExp() { | ||
_wrapRegExp = function (e, r) { | ||
return new BabelRegExp(e, void 0, r); | ||
}; | ||
var e = RegExp.prototype, | ||
r = new WeakMap(); | ||
function BabelRegExp(e, t, p) { | ||
var o = new RegExp(e, t); | ||
return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); | ||
} | ||
function buildGroups(e, t) { | ||
var p = r.get(t); | ||
return Object.keys(p).reduce(function (r, t) { | ||
var o = p[t]; | ||
if ("number" == typeof o) r[t] = e[o];else { | ||
for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; | ||
r[t] = e[o[i]]; | ||
} | ||
return r; | ||
}, Object.create(null)); | ||
} | ||
return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { | ||
var t = e.exec.call(this, r); | ||
if (t) { | ||
t.groups = buildGroups(t, this); | ||
var p = t.indices; | ||
p && (p.groups = buildGroups(p, this)); | ||
} | ||
return t; | ||
}, BabelRegExp.prototype[Symbol.replace] = function (t, p) { | ||
if ("string" == typeof p) { | ||
var o = r.get(this); | ||
return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) { | ||
var t = o[r]; | ||
return "$" + (Array.isArray(t) ? t.join("$") : t); | ||
})); | ||
} | ||
if ("function" == typeof p) { | ||
var i = this; | ||
return e[Symbol.replace].call(this, t, function () { | ||
var e = arguments; | ||
return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); | ||
}); | ||
} | ||
return e[Symbol.replace].call(this, t, p); | ||
}, _wrapRegExp.apply(this, arguments); | ||
} | ||
var DIR_FILE_REGEXP = /*#__PURE__*/_wrapRegExp(/([^\/\\]*)?[\/\\]?([^\/\\]*)\.css\.(?:ts|js|tsx|jsx|cjs|mjs)$/, { | ||
dir: 1, | ||
file: 2 | ||
}); | ||
var WHITESPACE_REGEXP = /\s/g; | ||
function getDevPrefix(_ref) { | ||
var { | ||
debugId, | ||
debugFileName | ||
} = _ref; | ||
var parts = debugId ? [debugId.replace(WHITESPACE_REGEXP, '_')] : []; | ||
if (debugFileName) { | ||
const { | ||
var { | ||
filePath | ||
} = getFileScope(); | ||
const matches = filePath.match(/(?<dir>[^\/\\]*)?[\/\\]?(?<file>[^\/\\]*)\.css\.(ts|js|tsx|jsx|cjs|mjs)$/); | ||
var matches = filePath.match(DIR_FILE_REGEXP); | ||
if (matches && matches.groups) { | ||
const { | ||
var { | ||
dir, | ||
@@ -72,27 +152,26 @@ file | ||
} | ||
var NORMALIZE_REGEXP = /^[0-9]/; | ||
function normalizeIdentifier(identifier) { | ||
return identifier.match(/^[0-9]/) ? `_${identifier}` : identifier; | ||
return NORMALIZE_REGEXP.test(identifier) ? "_".concat(identifier) : identifier; | ||
} | ||
var IDENTIFIER_REGEXP = /^[A-Z_][0-9A-Z_-]+$/i; | ||
function generateIdentifier(arg) { | ||
const identOption = getIdentOption(); | ||
const { | ||
var identOption = getIdentOption(); | ||
var { | ||
debugId, | ||
debugFileName = true | ||
} = { | ||
...(typeof arg === 'string' ? { | ||
debugId: arg | ||
} : null), | ||
...(typeof arg === 'object' ? arg : null) | ||
}; | ||
} = _objectSpread2(_objectSpread2({}, typeof arg === 'string' ? { | ||
debugId: arg | ||
} : null), typeof arg === 'object' ? arg : null); | ||
// Convert ref count to base 36 for optimal hash lengths | ||
const refCount = getAndIncrementRefCounter().toString(36); | ||
const { | ||
var refCount = getAndIncrementRefCounter().toString(36); | ||
var { | ||
filePath, | ||
packageName | ||
} = getFileScope(); | ||
const fileScopeHash = hash(packageName ? `${packageName}${filePath}` : filePath); | ||
let identifier = `${fileScopeHash}${refCount}`; | ||
var fileScopeHash = hash(packageName ? "".concat(packageName).concat(filePath) : filePath); | ||
var identifier = "".concat(fileScopeHash).concat(refCount); | ||
if (identOption === 'debug') { | ||
const devPrefix = getDevPrefix({ | ||
var devPrefix = getDevPrefix({ | ||
debugId, | ||
@@ -102,3 +181,3 @@ debugFileName | ||
if (devPrefix) { | ||
identifier = `${devPrefix}__${identifier}`; | ||
identifier = "".concat(devPrefix, "__").concat(identifier); | ||
} | ||
@@ -114,4 +193,4 @@ return normalizeIdentifier(identifier); | ||
}); | ||
if (!identifier.match(/^[A-Z_][0-9A-Z_]+$/i)) { | ||
throw new Error(`Identifier function returned invalid indentifier: "${identifier}"`); | ||
if (!identifier.match(IDENTIFIER_REGEXP)) { | ||
throw new Error("Identifier function returned invalid indentifier: \"".concat(identifier, "\"")); | ||
} | ||
@@ -123,6 +202,6 @@ return identifier; | ||
const normaliseObject = obj => walkObject(obj, () => ''); | ||
var normaliseObject = obj => walkObject(obj, () => ''); | ||
function validateContract(contract, tokens) { | ||
const theDiff = diff(normaliseObject(contract), normaliseObject(tokens)); | ||
const valid = Object.keys(theDiff).length === 0; | ||
var theDiff = diff(normaliseObject(contract), normaliseObject(tokens)); | ||
var valid = Object.keys(theDiff).length === 0; | ||
return { | ||
@@ -134,10 +213,10 @@ valid, | ||
function diffLine(value, nesting, type) { | ||
const whitespace = [...Array(nesting).keys()].map(() => ' ').join(''); | ||
const line = `${type ? type : ' '}${whitespace}${value}`; | ||
var whitespace = [...Array(nesting).keys()].map(() => ' ').join(''); | ||
var line = "".concat(type ? type : ' ').concat(whitespace).concat(value); | ||
if (process.env.NODE_ENV !== 'test') { | ||
if (type === '-') { | ||
return chalk.red(line); | ||
return pc.red(line); | ||
} | ||
if (type === '+') { | ||
return chalk.green(line); | ||
return pc.green(line); | ||
} | ||
@@ -147,19 +226,20 @@ } | ||
} | ||
function renderDiff(orig, diff, nesting = 0) { | ||
const lines = []; | ||
function renderDiff(orig, diff) { | ||
var nesting = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; | ||
var lines = []; | ||
if (nesting === 0) { | ||
lines.push(diffLine('{', 0)); | ||
} | ||
const innerNesting = nesting + 1; | ||
const keys = Object.keys(diff).sort(); | ||
for (const key of keys) { | ||
const value = diff[key]; | ||
var innerNesting = nesting + 1; | ||
var keys = Object.keys(diff).sort(); | ||
for (var key of keys) { | ||
var value = diff[key]; | ||
if (!(key in orig)) { | ||
lines.push(diffLine(`${key}: ...,`, innerNesting, '+')); | ||
lines.push(diffLine("".concat(key, ": ...,"), innerNesting, '+')); | ||
} else if (typeof value === 'object') { | ||
lines.push(diffLine(`${key}: {`, innerNesting)); | ||
lines.push(diffLine("".concat(key, ": {"), innerNesting)); | ||
lines.push(renderDiff(orig[key], diff[key], innerNesting)); | ||
lines.push(diffLine('}', innerNesting)); | ||
} else { | ||
lines.push(diffLine(`${key}: ...,`, innerNesting, '-')); | ||
lines.push(diffLine("".concat(key, ": ...,"), innerNesting, '-')); | ||
} | ||
@@ -174,3 +254,3 @@ } | ||
function createVar(debugId) { | ||
const cssVarName = cssesc(generateIdentifier({ | ||
var cssVarName = cssesc(generateIdentifier({ | ||
debugId, | ||
@@ -181,6 +261,9 @@ debugFileName: false | ||
}); | ||
return `var(--${cssVarName})`; | ||
return "var(--".concat(cssVarName, ")"); | ||
} | ||
function fallbackVar(...values) { | ||
let finalValue = ''; | ||
function fallbackVar() { | ||
var finalValue = ''; | ||
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) { | ||
values[_key] = arguments[_key]; | ||
} | ||
values.reverse().forEach(value => { | ||
@@ -191,5 +274,5 @@ if (finalValue === '') { | ||
if (typeof value !== 'string' || !/^var\(--.*\)$/.test(value)) { | ||
throw new Error(`Invalid variable name: ${value}`); | ||
throw new Error("Invalid variable name: ".concat(value)); | ||
} | ||
finalValue = value.replace(/\)$/, `, ${finalValue})`); | ||
finalValue = value.replace(/\)$/, ", ".concat(finalValue, ")")); | ||
} | ||
@@ -200,4 +283,4 @@ }); | ||
function assignVars(varContract, tokens) { | ||
const varSetters = {}; | ||
const { | ||
var varSetters = {}; | ||
var { | ||
valid, | ||
@@ -207,3 +290,3 @@ diffString | ||
if (!valid) { | ||
throw new Error(`Tokens don't match contract.\n${diffString}`); | ||
throw new Error("Tokens don't match contract.\n".concat(diffString)); | ||
} | ||
@@ -222,10 +305,10 @@ walkObject(tokens, (value, path) => { | ||
return walkObject(tokens, (value, path) => { | ||
const rawVarName = typeof mapFn === 'function' ? mapFn(value, path) : value; | ||
const varName = typeof rawVarName === 'string' ? rawVarName.replace(/^\-\-/, '') : null; | ||
var rawVarName = typeof mapFn === 'function' ? mapFn(value, path) : value; | ||
var varName = typeof rawVarName === 'string' ? rawVarName.replace(/^\-\-/, '') : null; | ||
if (typeof varName !== 'string' || varName !== cssesc(varName, { | ||
isIdentifier: true | ||
})) { | ||
throw new Error(`Invalid variable name for "${path.join('.')}": ${varName}`); | ||
throw new Error("Invalid variable name for \"".concat(path.join('.'), "\": ").concat(varName)); | ||
} | ||
return `var(--${varName})`; | ||
return "var(--".concat(varName, ")"); | ||
}); | ||
@@ -235,5 +318,5 @@ } | ||
function createGlobalTheme(selector, arg2, arg3) { | ||
const shouldCreateVars = Boolean(!arg3); | ||
const themeVars = shouldCreateVars ? createThemeContract(arg2) : arg2; | ||
const tokens = shouldCreateVars ? arg2 : arg3; | ||
var shouldCreateVars = Boolean(!arg3); | ||
var themeVars = shouldCreateVars ? createThemeContract(arg2) : arg2; | ||
var tokens = shouldCreateVars ? arg2 : arg3; | ||
appendCss({ | ||
@@ -251,14 +334,15 @@ type: 'global', | ||
function createTheme(arg1, arg2, arg3) { | ||
const themeClassName = generateIdentifier(typeof arg2 === 'object' ? arg3 : arg2); | ||
var themeClassName = generateIdentifier(typeof arg2 === 'object' ? arg3 : arg2); | ||
registerClassName(themeClassName, getFileScope()); | ||
const vars = typeof arg2 === 'object' ? createGlobalTheme(themeClassName, arg1, arg2) : createGlobalTheme(themeClassName, arg1); | ||
var vars = typeof arg2 === 'object' ? createGlobalTheme(themeClassName, arg1, arg2) : createGlobalTheme(themeClassName, arg1); | ||
return vars ? [themeClassName, vars] : themeClassName; | ||
} | ||
var _templateObject; | ||
function composedStyle(rules, debugId) { | ||
const className = generateIdentifier(debugId); | ||
var className = generateIdentifier(debugId); | ||
registerClassName(className, getFileScope()); | ||
const classList = []; | ||
const styleRules = []; | ||
for (const rule of rules) { | ||
var classList = []; | ||
var styleRules = []; | ||
for (var rule of rules) { | ||
if (typeof rule === 'string') { | ||
@@ -270,5 +354,5 @@ classList.push(rule); | ||
} | ||
let result = className; | ||
var result = className; | ||
if (classList.length > 0) { | ||
result = `${className} ${dudupeAndJoinClassList(classList)}`; | ||
result = "".concat(className, " ").concat(dudupeAndJoinClassList(classList)); | ||
registerComposition({ | ||
@@ -285,3 +369,3 @@ identifier: className, | ||
if (styleRules.length > 0) { | ||
const rule = deepmerge.all(styleRules, { | ||
var _rule = deepmerge.all(styleRules, { | ||
// Replace arrays rather than merging | ||
@@ -293,3 +377,3 @@ arrayMerge: (_, sourceArray) => sourceArray | ||
selector: className, | ||
rule | ||
rule: _rule | ||
}, getFileScope()); | ||
@@ -303,3 +387,3 @@ } | ||
} | ||
const className = generateIdentifier(debugId); | ||
var className = generateIdentifier(debugId); | ||
registerClassName(className, getFileScope()); | ||
@@ -317,4 +401,7 @@ appendCss({ | ||
*/ | ||
function composeStyles(...classNames) { | ||
const compose = hasFileScope() ? composedStyle : dudupeAndJoinClassList; | ||
function composeStyles() { | ||
var compose = hasFileScope() ? composedStyle : dudupeAndJoinClassList; | ||
for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) { | ||
classNames[_key] = arguments[_key]; | ||
} | ||
return compose(classNames); | ||
@@ -330,20 +417,15 @@ } | ||
function fontFace(rule, debugId) { | ||
const fontFamily = `"${cssesc(generateIdentifier(debugId), { | ||
var fontFamily = "\"".concat(cssesc(generateIdentifier(debugId), { | ||
quotes: 'double' | ||
})}"`; | ||
const rules = Array.isArray(rule) ? rule : [rule]; | ||
for (const singleRule of rules) { | ||
}), "\""); | ||
var rules = Array.isArray(rule) ? rule : [rule]; | ||
for (var singleRule of rules) { | ||
if ('fontFamily' in singleRule) { | ||
throw new Error(outdent` | ||
This function creates and returns a hashed font-family name, so the "fontFamily" property should not be provided. | ||
If you'd like to define a globally scoped custom font, you can use the "globalFontFace" function instead. | ||
`); | ||
throw new Error(dedent(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n This function creates and returns a hashed font-family name, so the \"fontFamily\" property should not be provided.\n \n If you'd like to define a globally scoped custom font, you can use the \"globalFontFace\" function instead.\n "])))); | ||
} | ||
appendCss({ | ||
type: 'fontFace', | ||
rule: { | ||
...singleRule, | ||
rule: _objectSpread2(_objectSpread2({}, singleRule), {}, { | ||
fontFamily | ||
} | ||
}) | ||
}, getFileScope()); | ||
@@ -354,12 +436,14 @@ } | ||
function globalFontFace(fontFamily, rule) { | ||
appendCss({ | ||
type: 'fontFace', | ||
rule: { | ||
...rule, | ||
fontFamily | ||
} | ||
}, getFileScope()); | ||
var rules = Array.isArray(rule) ? rule : [rule]; | ||
for (var singleRule of rules) { | ||
appendCss({ | ||
type: 'fontFace', | ||
rule: _objectSpread2(_objectSpread2({}, singleRule), {}, { | ||
fontFamily | ||
}) | ||
}, getFileScope()); | ||
} | ||
} | ||
function keyframes(rule, debugId) { | ||
const name = cssesc(generateIdentifier(debugId), { | ||
var name = cssesc(generateIdentifier(debugId), { | ||
isIdentifier: true | ||
@@ -381,18 +465,18 @@ }); | ||
} | ||
function styleVariants(...args) { | ||
if (typeof args[1] === 'function') { | ||
const data = args[0]; | ||
const mapData = args[1]; | ||
const debugId = args[2]; | ||
const classMap = {}; | ||
for (const key in data) { | ||
classMap[key] = style(mapData(data[key], key), debugId ? `${debugId}_${key}` : key); | ||
function styleVariants() { | ||
if (typeof (arguments.length <= 1 ? undefined : arguments[1]) === 'function') { | ||
var _data = arguments.length <= 0 ? undefined : arguments[0]; | ||
var _mapData = arguments.length <= 1 ? undefined : arguments[1]; | ||
var _debugId = arguments.length <= 2 ? undefined : arguments[2]; | ||
var _classMap = {}; | ||
for (var _key2 in _data) { | ||
_classMap[_key2] = style(_mapData(_data[_key2], _key2), _debugId ? "".concat(_debugId, "_").concat(_key2) : _key2); | ||
} | ||
return classMap; | ||
return _classMap; | ||
} | ||
const styleMap = args[0]; | ||
const debugId = args[1]; | ||
const classMap = {}; | ||
for (const key in styleMap) { | ||
classMap[key] = style(styleMap[key], debugId ? `${debugId}_${key}` : key); | ||
var styleMap = arguments.length <= 0 ? undefined : arguments[0]; | ||
var debugId = arguments.length <= 1 ? undefined : arguments[1]; | ||
var classMap = {}; | ||
for (var _key3 in styleMap) { | ||
classMap[_key3] = style(styleMap[_key3], debugId ? "".concat(debugId, "_").concat(_key3) : _key3); | ||
} | ||
@@ -404,23 +488,20 @@ return classMap; | ||
// For now it is mostly just an alias of generateIdentifier | ||
const createContainer = debugId => generateIdentifier(debugId); | ||
var createContainer = debugId => generateIdentifier(debugId); | ||
const defaultLayerOptions = {}; | ||
const merge = (obj1, obj2) => ({ | ||
...obj1, | ||
...obj2 | ||
}); | ||
const getLayerArgs = (...args) => { | ||
let options = defaultLayerOptions; | ||
let debugId = args[0]; | ||
if (typeof args[0] === 'object') { | ||
options = merge(defaultLayerOptions, args[0]); | ||
debugId = args[1]; | ||
var defaultLayerOptions = {}; | ||
var merge = (obj1, obj2) => _objectSpread2(_objectSpread2({}, obj1), obj2); | ||
var getLayerArgs = function getLayerArgs() { | ||
var options = defaultLayerOptions; | ||
var debugId = arguments.length <= 0 ? undefined : arguments[0]; | ||
if (typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'object') { | ||
options = merge(defaultLayerOptions, arguments.length <= 0 ? undefined : arguments[0]); | ||
debugId = arguments.length <= 1 ? undefined : arguments[1]; | ||
} | ||
return [options, debugId]; | ||
}; | ||
function layer(...args) { | ||
const [options, debugId] = getLayerArgs(...args); | ||
let name = generateIdentifier(debugId); | ||
function layer() { | ||
var [options, debugId] = getLayerArgs(...arguments); | ||
var name = generateIdentifier(debugId); | ||
if (options.parent) { | ||
name = `${options.parent}.${name}`; | ||
name = "".concat(options.parent, ".").concat(name); | ||
} | ||
@@ -433,6 +514,6 @@ appendCss({ | ||
} | ||
function globalLayer(...args) { | ||
let [options, name] = getLayerArgs(...args); | ||
function globalLayer() { | ||
var [options, name] = getLayerArgs(...arguments); | ||
if (options.parent) { | ||
name = `${options.parent}.${name}`; | ||
name = "".concat(options.parent, ".").concat(name); | ||
} | ||
@@ -439,0 +520,0 @@ appendCss({ |
@@ -5,3 +5,4 @@ 'use strict'; | ||
var outdent = require('outdent'); | ||
var taggedTemplateLiteral = require('../../dist/taggedTemplateLiteral-00b821ff.browser.cjs.js'); | ||
var dedent = require('dedent'); | ||
var adapter_dist_vanillaExtractCssAdapter = require('../../adapter/dist/vanilla-extract-css-adapter.browser.cjs.js'); | ||
@@ -11,9 +12,10 @@ | ||
var outdent__default = /*#__PURE__*/_interopDefault(outdent); | ||
var dedent__default = /*#__PURE__*/_interopDefault(dedent); | ||
let refCounter = 0; | ||
const fileScopes = []; | ||
var _templateObject; | ||
var refCounter = 0; | ||
var fileScopes = []; | ||
function setFileScope(filePath, packageName) { | ||
refCounter = 0; | ||
const fileScope = { | ||
var fileScope = { | ||
filePath, | ||
@@ -35,8 +37,3 @@ packageName | ||
if (fileScopes.length === 0) { | ||
throw new Error(outdent__default["default"]` | ||
Styles were unable to be assigned to a file. This is generally caused by one of the following: | ||
- You may have created styles outside of a '.css.ts' context | ||
- You may have incorrect configuration. See https://vanilla-extract.style/documentation/getting-started | ||
`); | ||
throw new Error(dedent__default["default"](_templateObject || (_templateObject = taggedTemplateLiteral._taggedTemplateLiteral(["\n Styles were unable to be assigned to a file. This is generally caused by one of the following:\n\n - You may have created styles outside of a '.css.ts' context\n - You may have incorrect configuration. See https://vanilla-extract.style/documentation/getting-started\n "])))); | ||
} | ||
@@ -43,0 +40,0 @@ return fileScopes[0]; |
@@ -1,9 +0,11 @@ | ||
import outdent from 'outdent'; | ||
import { _ as _taggedTemplateLiteral } from '../../dist/taggedTemplateLiteral-8e47dbd7.browser.esm.js'; | ||
import dedent from 'dedent'; | ||
import { onBeginFileScope, onEndFileScope } from '../../adapter/dist/vanilla-extract-css-adapter.browser.esm.js'; | ||
let refCounter = 0; | ||
const fileScopes = []; | ||
var _templateObject; | ||
var refCounter = 0; | ||
var fileScopes = []; | ||
function setFileScope(filePath, packageName) { | ||
refCounter = 0; | ||
const fileScope = { | ||
var fileScope = { | ||
filePath, | ||
@@ -25,8 +27,3 @@ packageName | ||
if (fileScopes.length === 0) { | ||
throw new Error(outdent` | ||
Styles were unable to be assigned to a file. This is generally caused by one of the following: | ||
- You may have created styles outside of a '.css.ts' context | ||
- You may have incorrect configuration. See https://vanilla-extract.style/documentation/getting-started | ||
`); | ||
throw new Error(dedent(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n Styles were unable to be assigned to a file. This is generally caused by one of the following:\n\n - You may have created styles outside of a '.css.ts' context\n - You may have incorrect configuration. See https://vanilla-extract.style/documentation/getting-started\n "])))); | ||
} | ||
@@ -33,0 +30,0 @@ return fileScopes[0]; |
@@ -5,3 +5,4 @@ 'use strict'; | ||
var outdent = require('outdent'); | ||
var taggedTemplateLiteral = require('../../dist/taggedTemplateLiteral-4fcaa261.cjs.dev.js'); | ||
var dedent = require('dedent'); | ||
var adapter_dist_vanillaExtractCssAdapter = require('../../adapter/dist/vanilla-extract-css-adapter.cjs.dev.js'); | ||
@@ -11,9 +12,10 @@ | ||
var outdent__default = /*#__PURE__*/_interopDefault(outdent); | ||
var dedent__default = /*#__PURE__*/_interopDefault(dedent); | ||
let refCounter = 0; | ||
const fileScopes = []; | ||
var _templateObject; | ||
var refCounter = 0; | ||
var fileScopes = []; | ||
function setFileScope(filePath, packageName) { | ||
refCounter = 0; | ||
const fileScope = { | ||
var fileScope = { | ||
filePath, | ||
@@ -35,8 +37,3 @@ packageName | ||
if (fileScopes.length === 0) { | ||
throw new Error(outdent__default["default"]` | ||
Styles were unable to be assigned to a file. This is generally caused by one of the following: | ||
- You may have created styles outside of a '.css.ts' context | ||
- You may have incorrect configuration. See https://vanilla-extract.style/documentation/getting-started | ||
`); | ||
throw new Error(dedent__default["default"](_templateObject || (_templateObject = taggedTemplateLiteral._taggedTemplateLiteral(["\n Styles were unable to be assigned to a file. This is generally caused by one of the following:\n\n - You may have created styles outside of a '.css.ts' context\n - You may have incorrect configuration. See https://vanilla-extract.style/documentation/getting-started\n "])))); | ||
} | ||
@@ -43,0 +40,0 @@ return fileScopes[0]; |
@@ -5,3 +5,4 @@ 'use strict'; | ||
var outdent = require('outdent'); | ||
var taggedTemplateLiteral = require('../../dist/taggedTemplateLiteral-0bfb2e96.cjs.prod.js'); | ||
var dedent = require('dedent'); | ||
var adapter_dist_vanillaExtractCssAdapter = require('../../adapter/dist/vanilla-extract-css-adapter.cjs.prod.js'); | ||
@@ -11,9 +12,10 @@ | ||
var outdent__default = /*#__PURE__*/_interopDefault(outdent); | ||
var dedent__default = /*#__PURE__*/_interopDefault(dedent); | ||
let refCounter = 0; | ||
const fileScopes = []; | ||
var _templateObject; | ||
var refCounter = 0; | ||
var fileScopes = []; | ||
function setFileScope(filePath, packageName) { | ||
refCounter = 0; | ||
const fileScope = { | ||
var fileScope = { | ||
filePath, | ||
@@ -35,8 +37,3 @@ packageName | ||
if (fileScopes.length === 0) { | ||
throw new Error(outdent__default["default"]` | ||
Styles were unable to be assigned to a file. This is generally caused by one of the following: | ||
- You may have created styles outside of a '.css.ts' context | ||
- You may have incorrect configuration. See https://vanilla-extract.style/documentation/getting-started | ||
`); | ||
throw new Error(dedent__default["default"](_templateObject || (_templateObject = taggedTemplateLiteral._taggedTemplateLiteral(["\n Styles were unable to be assigned to a file. This is generally caused by one of the following:\n\n - You may have created styles outside of a '.css.ts' context\n - You may have incorrect configuration. See https://vanilla-extract.style/documentation/getting-started\n "])))); | ||
} | ||
@@ -43,0 +40,0 @@ return fileScopes[0]; |
@@ -1,9 +0,11 @@ | ||
import outdent from 'outdent'; | ||
import { _ as _taggedTemplateLiteral } from '../../dist/taggedTemplateLiteral-10998315.esm.js'; | ||
import dedent from 'dedent'; | ||
import { onBeginFileScope, onEndFileScope } from '../../adapter/dist/vanilla-extract-css-adapter.esm.js'; | ||
let refCounter = 0; | ||
const fileScopes = []; | ||
var _templateObject; | ||
var refCounter = 0; | ||
var fileScopes = []; | ||
function setFileScope(filePath, packageName) { | ||
refCounter = 0; | ||
const fileScope = { | ||
var fileScope = { | ||
filePath, | ||
@@ -25,8 +27,3 @@ packageName | ||
if (fileScopes.length === 0) { | ||
throw new Error(outdent` | ||
Styles were unable to be assigned to a file. This is generally caused by one of the following: | ||
- You may have created styles outside of a '.css.ts' context | ||
- You may have incorrect configuration. See https://vanilla-extract.style/documentation/getting-started | ||
`); | ||
throw new Error(dedent(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n Styles were unable to be assigned to a file. This is generally caused by one of the following:\n\n - You may have created styles outside of a '.css.ts' context\n - You may have incorrect configuration. See https://vanilla-extract.style/documentation/getting-started\n "])))); | ||
} | ||
@@ -33,0 +30,0 @@ return fileScopes[0]; |
@@ -5,11 +5,12 @@ 'use strict'; | ||
const stylesheets = {}; | ||
const injectStyles = ({ | ||
fileScope, | ||
css | ||
}) => { | ||
const fileScopeId = fileScope.packageName ? [fileScope.packageName, fileScope.filePath].join('/') : fileScope.filePath; | ||
let stylesheet = stylesheets[fileScopeId]; | ||
var stylesheets = {}; | ||
var injectStyles = _ref => { | ||
var { | ||
fileScope, | ||
css | ||
} = _ref; | ||
var fileScopeId = fileScope.packageName ? [fileScope.packageName, fileScope.filePath].join('/') : fileScope.filePath; | ||
var stylesheet = stylesheets[fileScopeId]; | ||
if (!stylesheet) { | ||
const styleEl = document.createElement('style'); | ||
var styleEl = document.createElement('style'); | ||
if (fileScope.packageName) { | ||
@@ -16,0 +17,0 @@ styleEl.setAttribute('data-package', fileScope.packageName); |
@@ -1,10 +0,11 @@ | ||
const stylesheets = {}; | ||
const injectStyles = ({ | ||
fileScope, | ||
css | ||
}) => { | ||
const fileScopeId = fileScope.packageName ? [fileScope.packageName, fileScope.filePath].join('/') : fileScope.filePath; | ||
let stylesheet = stylesheets[fileScopeId]; | ||
var stylesheets = {}; | ||
var injectStyles = _ref => { | ||
var { | ||
fileScope, | ||
css | ||
} = _ref; | ||
var fileScopeId = fileScope.packageName ? [fileScope.packageName, fileScope.filePath].join('/') : fileScope.filePath; | ||
var stylesheet = stylesheets[fileScopeId]; | ||
if (!stylesheet) { | ||
const styleEl = document.createElement('style'); | ||
var styleEl = document.createElement('style'); | ||
if (fileScope.packageName) { | ||
@@ -11,0 +12,0 @@ styleEl.setAttribute('data-package', fileScope.packageName); |
@@ -5,11 +5,12 @@ 'use strict'; | ||
const stylesheets = {}; | ||
const injectStyles = ({ | ||
fileScope, | ||
css | ||
}) => { | ||
const fileScopeId = fileScope.packageName ? [fileScope.packageName, fileScope.filePath].join('/') : fileScope.filePath; | ||
let stylesheet = stylesheets[fileScopeId]; | ||
var stylesheets = {}; | ||
var injectStyles = _ref => { | ||
var { | ||
fileScope, | ||
css | ||
} = _ref; | ||
var fileScopeId = fileScope.packageName ? [fileScope.packageName, fileScope.filePath].join('/') : fileScope.filePath; | ||
var stylesheet = stylesheets[fileScopeId]; | ||
if (!stylesheet) { | ||
const styleEl = document.createElement('style'); | ||
var styleEl = document.createElement('style'); | ||
if (fileScope.packageName) { | ||
@@ -16,0 +17,0 @@ styleEl.setAttribute('data-package', fileScope.packageName); |
@@ -5,11 +5,12 @@ 'use strict'; | ||
const stylesheets = {}; | ||
const injectStyles = ({ | ||
fileScope, | ||
css | ||
}) => { | ||
const fileScopeId = fileScope.packageName ? [fileScope.packageName, fileScope.filePath].join('/') : fileScope.filePath; | ||
let stylesheet = stylesheets[fileScopeId]; | ||
var stylesheets = {}; | ||
var injectStyles = _ref => { | ||
var { | ||
fileScope, | ||
css | ||
} = _ref; | ||
var fileScopeId = fileScope.packageName ? [fileScope.packageName, fileScope.filePath].join('/') : fileScope.filePath; | ||
var stylesheet = stylesheets[fileScopeId]; | ||
if (!stylesheet) { | ||
const styleEl = document.createElement('style'); | ||
var styleEl = document.createElement('style'); | ||
if (fileScope.packageName) { | ||
@@ -16,0 +17,0 @@ styleEl.setAttribute('data-package', fileScope.packageName); |
@@ -1,10 +0,11 @@ | ||
const stylesheets = {}; | ||
const injectStyles = ({ | ||
fileScope, | ||
css | ||
}) => { | ||
const fileScopeId = fileScope.packageName ? [fileScope.packageName, fileScope.filePath].join('/') : fileScope.filePath; | ||
let stylesheet = stylesheets[fileScopeId]; | ||
var stylesheets = {}; | ||
var injectStyles = _ref => { | ||
var { | ||
fileScope, | ||
css | ||
} = _ref; | ||
var fileScopeId = fileScope.packageName ? [fileScope.packageName, fileScope.filePath].join('/') : fileScope.filePath; | ||
var stylesheet = stylesheets[fileScopeId]; | ||
if (!stylesheet) { | ||
const styleEl = document.createElement('style'); | ||
var styleEl = document.createElement('style'); | ||
if (fileScope.packageName) { | ||
@@ -11,0 +12,0 @@ styleEl.setAttribute('data-package', fileScope.packageName); |
{ | ||
"name": "@vanilla-extract/css", | ||
"version": "0.0.0-babel-modern-20231227140935", | ||
"version": "0.0.0-const-regexes-20240813051516", | ||
"description": "Zero-runtime Stylesheets-in-TypeScript", | ||
@@ -8,2 +8,3 @@ "sideEffects": true, | ||
"module": "dist/vanilla-extract-css.esm.js", | ||
"types": "dist/vanilla-extract-css.cjs.d.ts", | ||
"browser": { | ||
@@ -16,2 +17,3 @@ "./dist/vanilla-extract-css.cjs.js": "./dist/vanilla-extract-css.browser.cjs.js", | ||
".": { | ||
"types": "./dist/vanilla-extract-css.cjs.d.ts", | ||
"browser": { | ||
@@ -25,2 +27,3 @@ "module": "./dist/vanilla-extract-css.browser.esm.js", | ||
"./recipe": { | ||
"types": "./recipe/dist/vanilla-extract-css-recipe.cjs.d.ts", | ||
"browser": { | ||
@@ -34,2 +37,3 @@ "module": "./recipe/dist/vanilla-extract-css-recipe.browser.esm.js", | ||
"./functionSerializer": { | ||
"types": "./functionSerializer/dist/vanilla-extract-css-functionSerializer.cjs.d.ts", | ||
"browser": { | ||
@@ -43,2 +47,3 @@ "module": "./functionSerializer/dist/vanilla-extract-css-functionSerializer.browser.esm.js", | ||
"./adapter": { | ||
"types": "./adapter/dist/vanilla-extract-css-adapter.cjs.d.ts", | ||
"browser": { | ||
@@ -52,2 +57,3 @@ "module": "./adapter/dist/vanilla-extract-css-adapter.browser.esm.js", | ||
"./transformCss": { | ||
"types": "./transformCss/dist/vanilla-extract-css-transformCss.cjs.d.ts", | ||
"browser": { | ||
@@ -61,2 +67,3 @@ "module": "./transformCss/dist/vanilla-extract-css-transformCss.browser.esm.js", | ||
"./fileScope": { | ||
"types": "./fileScope/dist/vanilla-extract-css-fileScope.cjs.d.ts", | ||
"browser": { | ||
@@ -71,2 +78,3 @@ "module": "./fileScope/dist/vanilla-extract-css-fileScope.browser.esm.js", | ||
"./injectStyles": { | ||
"types": "./injectStyles/dist/vanilla-extract-css-injectStyles.cjs.d.ts", | ||
"browser": { | ||
@@ -80,2 +88,3 @@ "module": "./injectStyles/dist/vanilla-extract-css-injectStyles.browser.esm.js", | ||
"./disableRuntimeStyles": { | ||
"types": "./disableRuntimeStyles/dist/vanilla-extract-css-disableRuntimeStyles.cjs.d.ts", | ||
"browser": { | ||
@@ -120,7 +129,6 @@ "module": "./disableRuntimeStyles/dist/vanilla-extract-css-disableRuntimeStyles.browser.esm.js", | ||
"@emotion/hash": "^0.9.0", | ||
"@vanilla-extract/private": "0.0.0-babel-modern-20231227140935", | ||
"chalk": "^4.1.1", | ||
"css-what": "^6.1.0", | ||
"cssesc": "^3.0.0", | ||
"csstype": "^3.0.7", | ||
"dedent": "^1.5.3", | ||
"deep-object-diff": "^1.1.9", | ||
@@ -130,3 +138,4 @@ "deepmerge": "^4.2.2", | ||
"modern-ahocorasick": "^1.0.0", | ||
"outdent": "^0.8.0" | ||
"picocolors": "^1.0.0", | ||
"@vanilla-extract/private": "^1.0.5" | ||
}, | ||
@@ -133,0 +142,0 @@ "devDependencies": { |
@@ -10,4 +10,4 @@ 'use strict'; | ||
*/ | ||
const addRecipe = functionSerializer_dist_vanillaExtractCssFunctionSerializer.addFunctionSerializer; | ||
var addRecipe = functionSerializer_dist_vanillaExtractCssFunctionSerializer.addFunctionSerializer; | ||
exports.addRecipe = addRecipe; |
@@ -6,4 +6,4 @@ import { addFunctionSerializer } from '../../functionSerializer/dist/vanilla-extract-css-functionSerializer.browser.esm.js'; | ||
*/ | ||
const addRecipe = addFunctionSerializer; | ||
var addRecipe = addFunctionSerializer; | ||
export { addRecipe }; |
@@ -10,4 +10,4 @@ 'use strict'; | ||
*/ | ||
const addRecipe = functionSerializer_dist_vanillaExtractCssFunctionSerializer.addFunctionSerializer; | ||
var addRecipe = functionSerializer_dist_vanillaExtractCssFunctionSerializer.addFunctionSerializer; | ||
exports.addRecipe = addRecipe; |
@@ -10,4 +10,4 @@ 'use strict'; | ||
*/ | ||
const addRecipe = functionSerializer_dist_vanillaExtractCssFunctionSerializer.addFunctionSerializer; | ||
var addRecipe = functionSerializer_dist_vanillaExtractCssFunctionSerializer.addFunctionSerializer; | ||
exports.addRecipe = addRecipe; |
@@ -6,4 +6,4 @@ import { addFunctionSerializer } from '../../functionSerializer/dist/vanilla-extract-css-functionSerializer.esm.js'; | ||
*/ | ||
const addRecipe = addFunctionSerializer; | ||
var addRecipe = addFunctionSerializer; | ||
export { addRecipe }; |
@@ -5,2 +5,3 @@ 'use strict'; | ||
var transformCss_dist_vanillaExtractCssTransformCss = require('../../dist/transformCss-80eb10a6.browser.cjs.js'); | ||
require('@vanilla-extract/private'); | ||
@@ -10,5 +11,5 @@ require('cssesc'); | ||
require('../../adapter/dist/vanilla-extract-css-adapter.browser.cjs.js'); | ||
var transformCss_dist_vanillaExtractCssTransformCss = require('../../dist/transformCss-97c9e882.browser.cjs.js'); | ||
require('../../dist/taggedTemplateLiteral-00b821ff.browser.cjs.js'); | ||
require('css-what'); | ||
require('outdent'); | ||
require('dedent'); | ||
require('media-query-parser'); | ||
@@ -15,0 +16,0 @@ |
@@ -0,1 +1,2 @@ | ||
export { t as transformCss } from '../../dist/transformCss-72a2e7e9.browser.esm.js'; | ||
import '@vanilla-extract/private'; | ||
@@ -5,5 +6,5 @@ import 'cssesc'; | ||
import '../../adapter/dist/vanilla-extract-css-adapter.browser.esm.js'; | ||
export { t as transformCss } from '../../dist/transformCss-35fbcc6e.browser.esm.js'; | ||
import '../../dist/taggedTemplateLiteral-8e47dbd7.browser.esm.js'; | ||
import 'css-what'; | ||
import 'outdent'; | ||
import 'dedent'; | ||
import 'media-query-parser'; |
@@ -5,2 +5,3 @@ 'use strict'; | ||
var transformCss_dist_vanillaExtractCssTransformCss = require('../../dist/transformCss-96f55895.cjs.dev.js'); | ||
require('@vanilla-extract/private'); | ||
@@ -10,5 +11,5 @@ require('cssesc'); | ||
require('../../adapter/dist/vanilla-extract-css-adapter.cjs.dev.js'); | ||
var transformCss_dist_vanillaExtractCssTransformCss = require('../../dist/transformCss-15eca288.cjs.dev.js'); | ||
require('../../dist/taggedTemplateLiteral-4fcaa261.cjs.dev.js'); | ||
require('css-what'); | ||
require('outdent'); | ||
require('dedent'); | ||
require('media-query-parser'); | ||
@@ -15,0 +16,0 @@ |
@@ -5,2 +5,3 @@ 'use strict'; | ||
var transformCss_dist_vanillaExtractCssTransformCss = require('../../dist/transformCss-5f281e7b.cjs.prod.js'); | ||
require('@vanilla-extract/private'); | ||
@@ -10,5 +11,5 @@ require('cssesc'); | ||
require('../../adapter/dist/vanilla-extract-css-adapter.cjs.prod.js'); | ||
var transformCss_dist_vanillaExtractCssTransformCss = require('../../dist/transformCss-f0d00910.cjs.prod.js'); | ||
require('../../dist/taggedTemplateLiteral-0bfb2e96.cjs.prod.js'); | ||
require('css-what'); | ||
require('outdent'); | ||
require('dedent'); | ||
require('media-query-parser'); | ||
@@ -15,0 +16,0 @@ |
@@ -0,1 +1,2 @@ | ||
export { t as transformCss } from '../../dist/transformCss-9149bda7.esm.js'; | ||
import '@vanilla-extract/private'; | ||
@@ -5,5 +6,5 @@ import 'cssesc'; | ||
import '../../adapter/dist/vanilla-extract-css-adapter.esm.js'; | ||
export { t as transformCss } from '../../dist/transformCss-4ff5fbc3.esm.js'; | ||
import '../../dist/taggedTemplateLiteral-10998315.esm.js'; | ||
import 'css-what'; | ||
import 'outdent'; | ||
import 'dedent'; | ||
import 'media-query-parser'; |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
331839
84
8717
1
+ Addeddedent@^1.5.3
+ Addedpicocolors@^1.0.0
+ Added@vanilla-extract/private@1.0.6(transitive)
+ Addeddedent@1.5.3(transitive)
+ Addedpicocolors@1.1.1(transitive)
- Removedchalk@^4.1.1
- Removedoutdent@^0.8.0
- Removed@vanilla-extract/private@0.0.0-babel-modern-20231227140935(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedchalk@4.1.2(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedoutdent@0.8.0(transitive)
- Removedsupports-color@7.2.0(transitive)