Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cloudscape-design/theming-runtime

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloudscape-design/theming-runtime - npm Package Compare versions

Comparing version 1.0.14 to 1.0.15

1

browser/index.d.ts

@@ -5,2 +5,3 @@ import { ThemePreset, Override } from '../shared/theme';

preset: ThemePreset;
baseThemeId?: string;
}

@@ -7,0 +8,0 @@ export interface ApplyThemeResult {

7

browser/index.js

@@ -7,8 +7,9 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

import { createMultiThemeCustomizer } from '../shared/declaration/customizer';
import { getContexts } from '../shared/theme/validate';
import { getContexts, getThemeFromPreset } from '../shared/theme/validate';
export function applyTheme(params) {
var override = params.override, preset = params.preset;
var override = params.override, preset = params.preset, baseThemeId = params.baseThemeId;
var availableContexts = getContexts(preset);
var validated = validateOverride(override, preset.themeable, availableContexts);
var content = createOverrideDeclarations(preset.theme, validated, preset.propertiesMap, createMultiThemeCustomizer(preset.theme.selector));
var theme = getThemeFromPreset(preset, baseThemeId);
var content = createOverrideDeclarations(theme, validated, preset.propertiesMap, createMultiThemeCustomizer(theme.selector));
var nonce = getNonce();

@@ -15,0 +16,0 @@ var styleNode = createStyleNode(content, nonce);

{
"commit": "23c08c719c113e94d47aa266d33bc29cf1f8c399"
"commit": "08d2634ece93560254be57d7145e54c8964b305d"
}
{
"version": "1.0.14",
"version": "1.0.15",
"name": "@cloudscape-design/theming-runtime",

@@ -4,0 +4,0 @@ "main": "./browser/index.js",

@@ -1,2 +0,2 @@

import { Override, ThemePreset, Token } from './interfaces';
import { Override, Theme, ThemePreset, Token } from './interfaces';
/**

@@ -12,1 +12,2 @@ * This function compares the theme override against the list of tokens that are allowed

export declare function getContexts(preset: ThemePreset): string[];
export declare function getThemeFromPreset(preset: ThemePreset, baseThemeId?: string): Theme;

@@ -76,1 +76,17 @@ import { __assign, __spreadArray } from "tslib";

}
export function getThemeFromPreset(preset, baseThemeId) {
var _a;
if (!baseThemeId) {
return preset.theme;
}
var themesMap = __spreadArray([preset.theme], ((_a = preset.secondary) !== null && _a !== void 0 ? _a : []), true).reduce(function (accThemesMap, currentTheme) {
accThemesMap[currentTheme.id] = currentTheme;
return accThemesMap;
}, {});
if (!themesMap[baseThemeId]) {
throw new Error("Specified baseThemeId '".concat(baseThemeId, "' is not available. Available values are ").concat(Object.keys(themesMap)
.map(function (value) { return "'".concat(value, "'"); })
.join(', '), "."));
}
return themesMap[baseThemeId];
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc