@appsemble/utils
Version:
Utility functions used in Appsemble internally
31 lines • 959 B
JavaScript
import { baseTheme } from '@appsemble/lang-sdk';
/**
* Merge multiple partial themes and the base theme into one resulting theme.
*
* @param themes The themes to merge. The later a theme is specified, the higher its priority.
* @returns A combination of all themes.
*/
export function mergeThemes(...themes) {
var _a;
const result = Object.assign({}, baseTheme, ...themes);
(_a = result.font).source || (_a.source = 'google');
return result;
}
/**
* Create a Bulma URL for an Appsemble theme.
*
* @param theme The theme to create a URL for.
* @returns The URL to the Bulma theme.
*/
export function createThemeURL(theme) {
const { font, ...rest } = theme;
const params = new URLSearchParams({
...rest,
fontFamily: font.family,
fontSource: font.source ?? '',
});
// Sort for cacheability.
params.sort();
return `/bulma/0.9.3/bulma.min.css?${params}`;
}
//# sourceMappingURL=theme.js.map