@microsoft/load-themed-styles
Advanced tools
Comparing version 2.0.129 to 2.0.130
@@ -17,3 +17,25 @@ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.splitStyles = exports.detokenize = exports.clearStyles = exports.loadTheme = exports.flush = exports.configureRunMode = exports.configureLoadStyles = exports.loadStyles = void 0; | ||
exports.splitStyles = exports.detokenize = exports.clearStyles = exports.loadTheme = exports.flush = exports.configureRunMode = exports.configureLoadStyles = exports.loadStyles = exports.ClearStyleOptions = exports.Mode = void 0; | ||
/** | ||
* In sync mode, styles are registered as style elements synchronously with loadStyles() call. | ||
* In async mode, styles are buffered and registered as batch in async timer for performance purpose. | ||
*/ | ||
var Mode; | ||
(function (Mode) { | ||
Mode[Mode["sync"] = 0] = "sync"; | ||
Mode[Mode["async"] = 1] = "async"; | ||
})(Mode || (exports.Mode = Mode = {})); | ||
/** | ||
* Themable styles and non-themable styles are tracked separately | ||
* Specify ClearStyleOptions when calling clearStyles API to specify which group of registered styles should be cleared. | ||
*/ | ||
var ClearStyleOptions; | ||
(function (ClearStyleOptions) { | ||
/** only themable styles will be cleared */ | ||
ClearStyleOptions[ClearStyleOptions["onlyThemable"] = 1] = "onlyThemable"; | ||
/** only non-themable styles will be cleared */ | ||
ClearStyleOptions[ClearStyleOptions["onlyNonThemable"] = 2] = "onlyNonThemable"; | ||
/** both themable and non-themable styles will be cleared */ | ||
ClearStyleOptions[ClearStyleOptions["all"] = 3] = "all"; | ||
})(ClearStyleOptions || (exports.ClearStyleOptions = ClearStyleOptions = {})); | ||
// Store the theming state in __themeState__ global scope for reuse in the case of duplicate | ||
@@ -53,3 +75,3 @@ // load-themed-styles hosted on the page. | ||
flushTimer: 0, | ||
mode: 0 /* Mode.sync */, | ||
mode: Mode.sync, | ||
buffer: [] | ||
@@ -75,3 +97,3 @@ } }); | ||
var _a = _themeState.runState, mode = _a.mode, buffer = _a.buffer, flushTimer = _a.flushTimer; | ||
if (loadAsync || mode === 1 /* Mode.async */) { | ||
if (loadAsync || mode === Mode.async) { | ||
buffer.push(styleParts); | ||
@@ -161,8 +183,8 @@ if (!flushTimer) { | ||
function clearStyles(option) { | ||
if (option === void 0) { option = 3 /* ClearStyleOptions.all */; } | ||
if (option === 3 /* ClearStyleOptions.all */ || option === 2 /* ClearStyleOptions.onlyNonThemable */) { | ||
if (option === void 0) { option = ClearStyleOptions.all; } | ||
if (option === ClearStyleOptions.all || option === ClearStyleOptions.onlyNonThemable) { | ||
clearStylesInternal(_themeState.registeredStyles); | ||
_themeState.registeredStyles = []; | ||
} | ||
if (option === 3 /* ClearStyleOptions.all */ || option === 1 /* ClearStyleOptions.onlyThemable */) { | ||
if (option === ClearStyleOptions.all || option === ClearStyleOptions.onlyThemable) { | ||
clearStylesInternal(_themeState.registeredThemableStyles); | ||
@@ -192,3 +214,3 @@ _themeState.registeredThemableStyles = []; | ||
if (themableStyles.length > 0) { | ||
clearStyles(1 /* ClearStyleOptions.onlyThemable */); | ||
clearStyles(ClearStyleOptions.onlyThemable); | ||
applyThemableStyles([].concat.apply([], themableStyles)); | ||
@@ -195,0 +217,0 @@ } |
@@ -14,2 +14,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
}; | ||
/** | ||
* In sync mode, styles are registered as style elements synchronously with loadStyles() call. | ||
* In async mode, styles are buffered and registered as batch in async timer for performance purpose. | ||
*/ | ||
export var Mode; | ||
(function (Mode) { | ||
Mode[Mode["sync"] = 0] = "sync"; | ||
Mode[Mode["async"] = 1] = "async"; | ||
})(Mode || (Mode = {})); | ||
/** | ||
* Themable styles and non-themable styles are tracked separately | ||
* Specify ClearStyleOptions when calling clearStyles API to specify which group of registered styles should be cleared. | ||
*/ | ||
export var ClearStyleOptions; | ||
(function (ClearStyleOptions) { | ||
/** only themable styles will be cleared */ | ||
ClearStyleOptions[ClearStyleOptions["onlyThemable"] = 1] = "onlyThemable"; | ||
/** only non-themable styles will be cleared */ | ||
ClearStyleOptions[ClearStyleOptions["onlyNonThemable"] = 2] = "onlyNonThemable"; | ||
/** both themable and non-themable styles will be cleared */ | ||
ClearStyleOptions[ClearStyleOptions["all"] = 3] = "all"; | ||
})(ClearStyleOptions || (ClearStyleOptions = {})); | ||
// Store the theming state in __themeState__ global scope for reuse in the case of duplicate | ||
@@ -49,3 +71,3 @@ // load-themed-styles hosted on the page. | ||
flushTimer: 0, | ||
mode: 0 /* Mode.sync */, | ||
mode: Mode.sync, | ||
buffer: [] | ||
@@ -71,3 +93,3 @@ } }); | ||
var _a = _themeState.runState, mode = _a.mode, buffer = _a.buffer, flushTimer = _a.flushTimer; | ||
if (loadAsync || mode === 1 /* Mode.async */) { | ||
if (loadAsync || mode === Mode.async) { | ||
buffer.push(styleParts); | ||
@@ -152,8 +174,8 @@ if (!flushTimer) { | ||
export function clearStyles(option) { | ||
if (option === void 0) { option = 3 /* ClearStyleOptions.all */; } | ||
if (option === 3 /* ClearStyleOptions.all */ || option === 2 /* ClearStyleOptions.onlyNonThemable */) { | ||
if (option === void 0) { option = ClearStyleOptions.all; } | ||
if (option === ClearStyleOptions.all || option === ClearStyleOptions.onlyNonThemable) { | ||
clearStylesInternal(_themeState.registeredStyles); | ||
_themeState.registeredStyles = []; | ||
} | ||
if (option === 3 /* ClearStyleOptions.all */ || option === 1 /* ClearStyleOptions.onlyThemable */) { | ||
if (option === ClearStyleOptions.all || option === ClearStyleOptions.onlyThemable) { | ||
clearStylesInternal(_themeState.registeredThemableStyles); | ||
@@ -182,3 +204,3 @@ _themeState.registeredThemableStyles = []; | ||
if (themableStyles.length > 0) { | ||
clearStyles(1 /* ClearStyleOptions.onlyThemable */); | ||
clearStyles(ClearStyleOptions.onlyThemable); | ||
applyThemableStyles([].concat.apply([], themableStyles)); | ||
@@ -185,0 +207,0 @@ } |
@@ -16,3 +16,25 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.splitStyles = exports.detokenize = exports.clearStyles = exports.loadTheme = exports.flush = exports.configureRunMode = exports.configureLoadStyles = exports.loadStyles = void 0; | ||
exports.splitStyles = exports.detokenize = exports.clearStyles = exports.loadTheme = exports.flush = exports.configureRunMode = exports.configureLoadStyles = exports.loadStyles = exports.ClearStyleOptions = exports.Mode = void 0; | ||
/** | ||
* In sync mode, styles are registered as style elements synchronously with loadStyles() call. | ||
* In async mode, styles are buffered and registered as batch in async timer for performance purpose. | ||
*/ | ||
var Mode; | ||
(function (Mode) { | ||
Mode[Mode["sync"] = 0] = "sync"; | ||
Mode[Mode["async"] = 1] = "async"; | ||
})(Mode || (exports.Mode = Mode = {})); | ||
/** | ||
* Themable styles and non-themable styles are tracked separately | ||
* Specify ClearStyleOptions when calling clearStyles API to specify which group of registered styles should be cleared. | ||
*/ | ||
var ClearStyleOptions; | ||
(function (ClearStyleOptions) { | ||
/** only themable styles will be cleared */ | ||
ClearStyleOptions[ClearStyleOptions["onlyThemable"] = 1] = "onlyThemable"; | ||
/** only non-themable styles will be cleared */ | ||
ClearStyleOptions[ClearStyleOptions["onlyNonThemable"] = 2] = "onlyNonThemable"; | ||
/** both themable and non-themable styles will be cleared */ | ||
ClearStyleOptions[ClearStyleOptions["all"] = 3] = "all"; | ||
})(ClearStyleOptions || (exports.ClearStyleOptions = ClearStyleOptions = {})); | ||
// Store the theming state in __themeState__ global scope for reuse in the case of duplicate | ||
@@ -52,3 +74,3 @@ // load-themed-styles hosted on the page. | ||
flushTimer: 0, | ||
mode: 0 /* Mode.sync */, | ||
mode: Mode.sync, | ||
buffer: [] | ||
@@ -74,3 +96,3 @@ } }); | ||
var _a = _themeState.runState, mode = _a.mode, buffer = _a.buffer, flushTimer = _a.flushTimer; | ||
if (loadAsync || mode === 1 /* Mode.async */) { | ||
if (loadAsync || mode === Mode.async) { | ||
buffer.push(styleParts); | ||
@@ -160,8 +182,8 @@ if (!flushTimer) { | ||
function clearStyles(option) { | ||
if (option === void 0) { option = 3 /* ClearStyleOptions.all */; } | ||
if (option === 3 /* ClearStyleOptions.all */ || option === 2 /* ClearStyleOptions.onlyNonThemable */) { | ||
if (option === void 0) { option = ClearStyleOptions.all; } | ||
if (option === ClearStyleOptions.all || option === ClearStyleOptions.onlyNonThemable) { | ||
clearStylesInternal(_themeState.registeredStyles); | ||
_themeState.registeredStyles = []; | ||
} | ||
if (option === 3 /* ClearStyleOptions.all */ || option === 1 /* ClearStyleOptions.onlyThemable */) { | ||
if (option === ClearStyleOptions.all || option === ClearStyleOptions.onlyThemable) { | ||
clearStylesInternal(_themeState.registeredThemableStyles); | ||
@@ -191,3 +213,3 @@ _themeState.registeredThemableStyles = []; | ||
if (themableStyles.length > 0) { | ||
clearStyles(1 /* ClearStyleOptions.onlyThemable */); | ||
clearStyles(ClearStyleOptions.onlyThemable); | ||
applyThemableStyles([].concat.apply([], themableStyles)); | ||
@@ -194,0 +216,0 @@ } |
{ | ||
"name": "@microsoft/load-themed-styles", | ||
"version": "2.0.129", | ||
"version": "2.0.130", | ||
"description": "Loads themed styles.", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@rushstack/heft": "0.66.16", | ||
"@rushstack/heft": "0.66.17", | ||
"local-web-rig": "1.0.0" | ||
@@ -19,0 +19,0 @@ }, |
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
111667
1057