@fluentui/make-styles
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -5,3 +5,18 @@ { | ||
{ | ||
"date": "Thu, 17 Dec 2020 12:29:34 GMT", | ||
"date": "Mon, 21 Dec 2020 12:26:37 GMT", | ||
"tag": "@fluentui/make-styles_v0.3.0", | ||
"version": "0.3.0", | ||
"comments": { | ||
"minor": [ | ||
{ | ||
"comment": "perf: makeStyles improve classnames side-effect", | ||
"author": "olfedias@microsoft.com", | ||
"commit": "67141a6ffc27b3e0d9f3ff346841076573a52784", | ||
"package": "@fluentui/make-styles" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Thu, 17 Dec 2020 12:30:15 GMT", | ||
"tag": "@fluentui/make-styles_v0.2.0", | ||
@@ -8,0 +23,0 @@ "version": "0.2.0", |
# Change Log - @fluentui/make-styles | ||
This log was last generated on Thu, 17 Dec 2020 12:29:34 GMT and should not be manually modified. | ||
This log was last generated on Mon, 21 Dec 2020 12:26:37 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## [0.3.0](https://github.com/microsoft/fluentui/tree/@fluentui/make-styles_v0.3.0) | ||
Mon, 21 Dec 2020 12:26:37 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/make-styles_v0.2.0..@fluentui/make-styles_v0.3.0) | ||
### Minor changes | ||
- perf: makeStyles improve classnames side-effect ([PR #16242](https://github.com/microsoft/fluentui/pull/16242) by olfedias@microsoft.com) | ||
## [0.2.0](https://github.com/microsoft/fluentui/tree/@fluentui/make-styles_v0.2.0) | ||
Thu, 17 Dec 2020 12:29:34 GMT | ||
Thu, 17 Dec 2020 12:30:15 GMT | ||
@@ -11,0 +20,0 @@ ### Minor changes |
@@ -7,7 +7,3 @@ define(["require", "exports", "tslib", "./constants", "./runtime/index"], function (require, exports, tslib_1, constants_1, index_1) { | ||
var cxCache = {}; | ||
return function computeClasses(selectors, options) { | ||
var classNames = []; | ||
for (var _i = 2; _i < arguments.length; _i++) { | ||
classNames[_i - 2] = arguments[_i]; | ||
} | ||
function computeClasses(selectors, options) { | ||
var tokens; | ||
@@ -20,31 +16,46 @@ var resolvedDefinitions; | ||
var overridesCx = ''; | ||
classNames.forEach(function (className) { | ||
if (typeof className === 'string') { | ||
if (className === '') { | ||
return; | ||
} | ||
className.split(' ').forEach(function (cName) { | ||
if (constants_1.DEFINITION_LOOKUP_TABLE[cName] !== undefined) { | ||
overrides[constants_1.DEFINITION_LOOKUP_TABLE[cName][0]] = constants_1.DEFINITION_LOOKUP_TABLE[cName][1]; | ||
overridesCx += cName; | ||
// arguments are parsed intentionally manually to avoid double loops as TS transforms rest via an additional loop | ||
for (var i = 2; i < arguments.length; i++) { | ||
// eslint-disable-next-line prefer-rest-params | ||
var classNames = arguments[i]; | ||
if (typeof classNames === 'string' && classNames !== '') { | ||
// .split() is an expensive call, it's faster to ensure that string contains any spaces before splitting | ||
if (classNames.indexOf(' ') === -1) { | ||
var definition = constants_1.DEFINITION_LOOKUP_TABLE[classNames]; | ||
if (definition !== undefined) { | ||
overrides[definition[0]] = constants_1.DEFINITION_LOOKUP_TABLE[classNames][1]; | ||
overridesCx += classNames; | ||
} | ||
else { | ||
nonMakeClasses += cName + ' '; | ||
nonMakeClasses += classNames + ' '; | ||
} | ||
}); | ||
} | ||
else { | ||
classNames.split(' ').forEach(function (className) { | ||
var definition = constants_1.DEFINITION_LOOKUP_TABLE[className]; | ||
if (definition !== undefined) { | ||
overrides[definition[0]] = definition[1]; | ||
overridesCx += className; | ||
} | ||
else { | ||
nonMakeClasses += className + ' '; | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
var matchedIndexes = ''; | ||
var matchedDefinitions = resolvedDefinitions.reduce(function (acc, definition, i) { | ||
var matcherFn = definition[0]; | ||
var matchedDefinitions = []; | ||
for (var i = 0, l = resolvedDefinitions.length; i < l; i++) { | ||
var matcherFn = resolvedDefinitions[i][0]; | ||
if (matcherFn === null || matcherFn(selectors)) { | ||
acc.push(definition[2]); | ||
matchedDefinitions.push(resolvedDefinitions[i][2]); | ||
matchedIndexes += i; | ||
} | ||
return acc; | ||
}, []); | ||
} | ||
var overridesHash = overridesCx === '' ? '' : overridesCx; | ||
var cxCacheKey = options.renderer.id + matchedIndexes + '' + overridesHash; | ||
if (constants_1.CAN_USE_CSS_VARIABLES && cxCache[cxCacheKey] !== undefined) { | ||
return nonMakeClasses + cxCache[cxCacheKey]; | ||
var cxCacheElement = cxCache[cxCacheKey]; | ||
if (constants_1.CAN_USE_CSS_VARIABLES && cxCacheElement !== undefined) { | ||
return nonMakeClasses + cxCacheElement; | ||
} | ||
@@ -57,3 +68,4 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
return nonMakeClasses + resultClasses; | ||
}; | ||
} | ||
return computeClasses; | ||
} | ||
@@ -60,0 +72,0 @@ exports.makeStyles = makeStyles; |
define(["require", "exports", "@fluentui/set-version"], function (require, exports, set_version_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
set_version_1.setVersion('@fluentui/make-styles', '0.2.0'); | ||
set_version_1.setVersion('@fluentui/make-styles', '0.3.0'); | ||
}); | ||
//# sourceMappingURL=version.js.map |
@@ -9,7 +9,3 @@ "use strict"; | ||
var cxCache = {}; | ||
return function computeClasses(selectors, options) { | ||
var classNames = []; | ||
for (var _i = 2; _i < arguments.length; _i++) { | ||
classNames[_i - 2] = arguments[_i]; | ||
} | ||
function computeClasses(selectors, options) { | ||
var tokens; | ||
@@ -31,31 +27,46 @@ var resolvedDefinitions; | ||
var overridesCx = ''; | ||
classNames.forEach(function (className) { | ||
if (typeof className === 'string') { | ||
if (className === '') { | ||
return; | ||
} | ||
className.split(' ').forEach(function (cName) { | ||
if (constants_1.DEFINITION_LOOKUP_TABLE[cName] !== undefined) { | ||
overrides[constants_1.DEFINITION_LOOKUP_TABLE[cName][0]] = constants_1.DEFINITION_LOOKUP_TABLE[cName][1]; | ||
overridesCx += cName; | ||
// arguments are parsed intentionally manually to avoid double loops as TS transforms rest via an additional loop | ||
for (var i = 2; i < arguments.length; i++) { | ||
// eslint-disable-next-line prefer-rest-params | ||
var classNames = arguments[i]; | ||
if (typeof classNames === 'string' && classNames !== '') { | ||
// .split() is an expensive call, it's faster to ensure that string contains any spaces before splitting | ||
if (classNames.indexOf(' ') === -1) { | ||
var definition = constants_1.DEFINITION_LOOKUP_TABLE[classNames]; | ||
if (definition !== undefined) { | ||
overrides[definition[0]] = constants_1.DEFINITION_LOOKUP_TABLE[classNames][1]; | ||
overridesCx += classNames; | ||
} | ||
else { | ||
nonMakeClasses += cName + ' '; | ||
nonMakeClasses += classNames + ' '; | ||
} | ||
}); | ||
} | ||
else { | ||
classNames.split(' ').forEach(function (className) { | ||
var definition = constants_1.DEFINITION_LOOKUP_TABLE[className]; | ||
if (definition !== undefined) { | ||
overrides[definition[0]] = definition[1]; | ||
overridesCx += className; | ||
} | ||
else { | ||
nonMakeClasses += className + ' '; | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
var matchedIndexes = ''; | ||
var matchedDefinitions = resolvedDefinitions.reduce(function (acc, definition, i) { | ||
var matcherFn = definition[0]; | ||
var matchedDefinitions = []; | ||
for (var i = 0, l = resolvedDefinitions.length; i < l; i++) { | ||
var matcherFn = resolvedDefinitions[i][0]; | ||
if (matcherFn === null || matcherFn(selectors)) { | ||
acc.push(definition[2]); | ||
matchedDefinitions.push(resolvedDefinitions[i][2]); | ||
matchedIndexes += i; | ||
} | ||
return acc; | ||
}, []); | ||
} | ||
var overridesHash = overridesCx === '' ? '' : overridesCx; | ||
var cxCacheKey = options.renderer.id + matchedIndexes + '' + overridesHash; | ||
if (constants_1.CAN_USE_CSS_VARIABLES && cxCache[cxCacheKey] !== undefined) { | ||
return nonMakeClasses + cxCache[cxCacheKey]; | ||
var cxCacheElement = cxCache[cxCacheKey]; | ||
if (constants_1.CAN_USE_CSS_VARIABLES && cxCacheElement !== undefined) { | ||
return nonMakeClasses + cxCacheElement; | ||
} | ||
@@ -68,5 +79,6 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
return nonMakeClasses + resultClasses; | ||
}; | ||
} | ||
return computeClasses; | ||
} | ||
exports.makeStyles = makeStyles; | ||
//# sourceMappingURL=makeStyles.js.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
var set_version_1 = require("@fluentui/set-version"); | ||
set_version_1.setVersion('@fluentui/make-styles', '0.2.0'); | ||
set_version_1.setVersion('@fluentui/make-styles', '0.3.0'); | ||
//# sourceMappingURL=version.js.map |
@@ -7,7 +7,3 @@ import { __spreadArrays } from "tslib"; | ||
var cxCache = {}; | ||
return function computeClasses(selectors, options) { | ||
var classNames = []; | ||
for (var _i = 2; _i < arguments.length; _i++) { | ||
classNames[_i - 2] = arguments[_i]; | ||
} | ||
function computeClasses(selectors, options) { | ||
var tokens; | ||
@@ -29,31 +25,46 @@ var resolvedDefinitions; | ||
var overridesCx = ''; | ||
classNames.forEach(function (className) { | ||
if (typeof className === 'string') { | ||
if (className === '') { | ||
return; | ||
} | ||
className.split(' ').forEach(function (cName) { | ||
if (DEFINITION_LOOKUP_TABLE[cName] !== undefined) { | ||
overrides[DEFINITION_LOOKUP_TABLE[cName][0]] = DEFINITION_LOOKUP_TABLE[cName][1]; | ||
overridesCx += cName; | ||
// arguments are parsed intentionally manually to avoid double loops as TS transforms rest via an additional loop | ||
for (var i = 2; i < arguments.length; i++) { | ||
// eslint-disable-next-line prefer-rest-params | ||
var classNames = arguments[i]; | ||
if (typeof classNames === 'string' && classNames !== '') { | ||
// .split() is an expensive call, it's faster to ensure that string contains any spaces before splitting | ||
if (classNames.indexOf(' ') === -1) { | ||
var definition = DEFINITION_LOOKUP_TABLE[classNames]; | ||
if (definition !== undefined) { | ||
overrides[definition[0]] = DEFINITION_LOOKUP_TABLE[classNames][1]; | ||
overridesCx += classNames; | ||
} | ||
else { | ||
nonMakeClasses += cName + ' '; | ||
nonMakeClasses += classNames + ' '; | ||
} | ||
}); | ||
} | ||
else { | ||
classNames.split(' ').forEach(function (className) { | ||
var definition = DEFINITION_LOOKUP_TABLE[className]; | ||
if (definition !== undefined) { | ||
overrides[definition[0]] = definition[1]; | ||
overridesCx += className; | ||
} | ||
else { | ||
nonMakeClasses += className + ' '; | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
var matchedIndexes = ''; | ||
var matchedDefinitions = resolvedDefinitions.reduce(function (acc, definition, i) { | ||
var matcherFn = definition[0]; | ||
var matchedDefinitions = []; | ||
for (var i = 0, l = resolvedDefinitions.length; i < l; i++) { | ||
var matcherFn = resolvedDefinitions[i][0]; | ||
if (matcherFn === null || matcherFn(selectors)) { | ||
acc.push(definition[2]); | ||
matchedDefinitions.push(resolvedDefinitions[i][2]); | ||
matchedIndexes += i; | ||
} | ||
return acc; | ||
}, []); | ||
} | ||
var overridesHash = overridesCx === '' ? '' : overridesCx; | ||
var cxCacheKey = options.renderer.id + matchedIndexes + '' + overridesHash; | ||
if (CAN_USE_CSS_VARIABLES && cxCache[cxCacheKey] !== undefined) { | ||
return nonMakeClasses + cxCache[cxCacheKey]; | ||
var cxCacheElement = cxCache[cxCacheKey]; | ||
if (CAN_USE_CSS_VARIABLES && cxCacheElement !== undefined) { | ||
return nonMakeClasses + cxCacheElement; | ||
} | ||
@@ -66,4 +77,5 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
return nonMakeClasses + resultClasses; | ||
}; | ||
} | ||
return computeClasses; | ||
} | ||
//# sourceMappingURL=makeStyles.js.map |
// Do not modify this file; it is generated as part of publish. | ||
// The checked in version is a placeholder only and will not be updated. | ||
import { setVersion } from '@fluentui/set-version'; | ||
setVersion('@fluentui/make-styles', '0.2.0'); | ||
setVersion('@fluentui/make-styles', '0.3.0'); | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@fluentui/make-styles", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Experimental utility for creating css styles/classes.", | ||
@@ -5,0 +5,0 @@ "main": "lib-commonjs/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
194087
1570