@onsvisual/svelte-components 0.0.17 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
* Sets a predefined theme
|
|
16
16
|
* @type {"light"|"dark"|"lightblue"}
|
|
17
17
|
*/
|
|
18
|
-
export let theme = null;
|
|
18
|
+
export let theme = themeParent || null;
|
|
19
|
+
|
|
20
|
+
if (!themeParent) setContext("theme", theme);
|
|
21
|
+
|
|
19
22
|
/**
|
|
20
23
|
* Define additional props to override the base theme
|
|
21
24
|
* @type {object}
|
|
@@ -27,13 +30,8 @@
|
|
|
27
30
|
*/
|
|
28
31
|
export let background = overrides?.background || themes[theme]?.background || null;
|
|
29
32
|
|
|
30
|
-
const _theme = writable(theme || $themeParent);
|
|
31
|
-
$: _theme.set(theme || $themeParent);
|
|
32
|
-
|
|
33
|
-
setContext("theme", _theme);
|
|
34
|
-
|
|
35
33
|
function makeStyle(theme, overrides, background) {
|
|
36
|
-
if (theme
|
|
34
|
+
if (theme) {
|
|
37
35
|
const _theme = themes[theme] || themes.light;
|
|
38
36
|
if (overrides) Object.keys(overrides).forEach((key) => (_theme[key] = overrides[key]));
|
|
39
37
|
if (background) _theme.background = background;
|
|
@@ -46,7 +44,7 @@
|
|
|
46
44
|
return null;
|
|
47
45
|
}
|
|
48
46
|
|
|
49
|
-
$: style = makeStyle(
|
|
47
|
+
$: style = makeStyle(theme, overrides, background);
|
|
50
48
|
</script>
|
|
51
49
|
|
|
52
50
|
<svelte:head>
|