@awsui/theming-runtime
Advanced tools
Comparing version 1.0.32 to 1.0.33
{ | ||
"commit": "eab1f5dd13deacce6dd6e78d9a65697001424888" | ||
"commit": "5febd2eafa6a27fd3a9c984286377787028ad304" | ||
} |
{ | ||
"version": "1.0.32", | ||
"version": "1.0.33", | ||
"name": "@awsui/theming-runtime", | ||
@@ -4,0 +4,0 @@ "main": "./browser/index.js", |
@@ -60,3 +60,3 @@ import { __extends, __spreadArray } from "tslib"; | ||
var modeResolution = reduce(secondaryResolution, secondary, modeReducer(mode, state)); | ||
var modeRule = _this.ruleCreator.create({ global: [secondary.selector, optionalState.selector] }, modeResolution); | ||
var modeRule = _this.ruleCreator.create({ global: [secondary.selector, optionalState.selector], media: optionalState.media }, modeResolution); | ||
var parentModeRule = stylesheet.findRule(_this.ruleCreator.selectorFor({ | ||
@@ -87,3 +87,4 @@ global: [primary.selector, optionalState.selector] | ||
global: [secondary.selector, optionalState.selector], | ||
local: [context.selector] | ||
local: [context.selector], | ||
media: optionalState.media | ||
}, contextResolution); | ||
@@ -109,3 +110,4 @@ var parentContextRule = stylesheet.findRule(_this.ruleCreator.selectorFor({ global: [primary.selector], local: [context.selector] })); | ||
var contextAndModeRuleGlobal = _this.ruleCreator.create({ | ||
global: [secondary.selector, optionalState.selector, context.selector] | ||
global: [secondary.selector, optionalState.selector, context.selector], | ||
media: optionalState.media | ||
}, contextResolution); | ||
@@ -112,0 +114,0 @@ MultiThemeCreator.appendRuleToStylesheet(stylesheet, contextAndModeRuleGlobal, compact([ |
@@ -8,2 +8,3 @@ import { Selector } from './selector'; | ||
local?: string[]; | ||
media?: string; | ||
} | ||
@@ -10,0 +11,0 @@ export declare class RuleCreator { |
@@ -10,3 +10,3 @@ import { Rule, Declaration } from './stylesheet'; | ||
var _this = this; | ||
var rule = new Rule(this.selectorFor(config)); | ||
var rule = new Rule(this.selectorFor(config), config.media); | ||
entries(resolution).forEach(function (_a) { | ||
@@ -13,0 +13,0 @@ var token = _a[0], value = _a[1]; |
@@ -25,3 +25,4 @@ import { __extends } from "tslib"; | ||
var modeResolution = reduce(_this.resolution, _this.theme, modeReducer(mode, state)); | ||
var modeRule = _this.ruleCreator.create({ global: [_this.theme.selector, mode.states[state].selector] }, modeResolution); | ||
var stateDetails = mode.states[state]; | ||
var modeRule = _this.ruleCreator.create({ global: [_this.theme.selector, stateDetails.selector], media: stateDetails.media }, modeResolution); | ||
SingleThemeCreator.appendRuleToStylesheet(stylesheet, modeRule, [rootRule]); | ||
@@ -38,3 +39,4 @@ }); | ||
var contextResolution = reduce(resolveContext(_this.theme, context), _this.theme, modeReducer(mode, state)); | ||
var contextAndModeRule = _this.ruleCreator.create({ global: [_this.theme.selector, mode.states[state].selector], local: [context.selector] }, contextResolution); | ||
var stateDetails = mode.states[state]; | ||
var contextAndModeRule = _this.ruleCreator.create({ global: [_this.theme.selector, stateDetails.selector], local: [context.selector], media: stateDetails.media }, contextResolution); | ||
var contextRule = stylesheet.findRule(_this.ruleCreator.selectorFor({ global: [_this.theme.selector], local: [context.selector] })); | ||
@@ -46,3 +48,3 @@ var modeRule = stylesheet.findRule(_this.ruleCreator.selectorFor({ | ||
SingleThemeCreator.appendRuleToStylesheet(stylesheet, contextAndModeRule, compact([contextRule, modeRule, rootRule])); | ||
var contextRuleAndModeRuleGlobal = _this.ruleCreator.create({ global: [_this.theme.selector, mode.states[state].selector, context.selector] }, contextResolution); | ||
var contextRuleAndModeRuleGlobal = _this.ruleCreator.create({ global: [_this.theme.selector, stateDetails.selector, context.selector], media: stateDetails.media }, contextResolution); | ||
SingleThemeCreator.appendRuleToStylesheet(stylesheet, contextRuleAndModeRuleGlobal, compact([contextRuleGlobal, modeRule, rootRule])); | ||
@@ -49,0 +51,0 @@ }); |
@@ -22,5 +22,6 @@ /** | ||
selector: string; | ||
media?: string; | ||
declarationsMap: Map<string, [Declaration, number]>; | ||
counter: number; | ||
constructor(selector: string); | ||
constructor(selector: string, media?: string); | ||
appendDeclaration(declaration: Declaration): void; | ||
@@ -27,0 +28,0 @@ clear(): void; |
@@ -52,6 +52,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
var Rule = /** @class */ (function () { | ||
function Rule(selector) { | ||
function Rule(selector, media) { | ||
this.declarationsMap = new Map(); | ||
this.counter = 0; | ||
this.selector = selector; | ||
this.media = media; | ||
} | ||
@@ -73,3 +74,7 @@ Rule.prototype.appendDeclaration = function (declaration) { | ||
var lines = asValuesArray(this.declarationsMap).map(function (decl) { return decl.toString(); }); | ||
return "".concat(this.selector, "{\n\t").concat(lines.join('\n\t'), "\n}"); | ||
var rule = "".concat(this.selector, "{\n\t").concat(lines.join('\n\t'), "\n}"); | ||
if (this.media) { | ||
return "@media ".concat(this.media, " {").concat(rule, "}"); | ||
} | ||
return rule; | ||
}; | ||
@@ -76,0 +81,0 @@ return Rule; |
export interface OptionalState { | ||
selector: string; | ||
media?: string; | ||
} | ||
@@ -4,0 +5,0 @@ export interface DefaultState { |
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
69739
1344