@onsvisual/svelte-components 0.0.16 → 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 && theme !== $themeParent) {
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($_theme, overrides, background);
47
+ $: style = makeStyle(theme, overrides, background);
50
48
  </script>
51
49
 
52
50
  <svelte:head>
@@ -56,7 +54,7 @@
56
54
  </svelte:head>
57
55
 
58
56
  {#if style}
59
- <div class="theme-wrapper" style="{style}" style:display="content">
57
+ <div class="theme-wrapper" style="{style}">
60
58
  <slot />
61
59
  </div>
62
60
  {:else}
@@ -65,6 +63,7 @@
65
63
 
66
64
  <style>
67
65
  .theme-wrapper {
66
+ position: relative;
68
67
  color: var(--text, #222);
69
68
  background: var(--background, none);
70
69
  --ons-color-text: var(--text, --ons-color-text);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onsvisual/svelte-components",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://onsvisual.github.io/svelte-components",