@onsvisual/svelte-components 0.0.36 → 0.1.0

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.
@@ -2,9 +2,9 @@
2
2
  /** @typedef {typeof __propDef.events} CardsEvents */
3
3
  /** @typedef {typeof __propDef.slots} CardsSlots */
4
4
  export default class Cards extends SvelteComponentTyped<{
5
- theme?: "light" | "dark" | "lightblue";
6
5
  id?: string;
7
6
  cls?: string;
7
+ theme?: "light" | "dark" | "lightblue";
8
8
  width?: "narrow" | "medium" | "wide" | "wider" | "full";
9
9
  height?: string | number;
10
10
  marginTop?: boolean;
@@ -27,9 +27,9 @@ export type CardsSlots = typeof __propDef.slots;
27
27
  import { SvelteComponentTyped } from "svelte";
28
28
  declare const __propDef: {
29
29
  props: {
30
- theme?: "light" | "dark" | "lightblue";
31
30
  id?: string;
32
31
  cls?: string;
32
+ theme?: "light" | "dark" | "lightblue";
33
33
  width?: "narrow" | "medium" | "wide" | "wider" | "full";
34
34
  height?: number | string;
35
35
  marginTop?: boolean;
@@ -2,9 +2,9 @@
2
2
  /** @typedef {typeof __propDef.events} GridEvents */
3
3
  /** @typedef {typeof __propDef.slots} GridSlots */
4
4
  export default class Grid extends SvelteComponentTyped<{
5
- theme?: "light" | "dark" | "lightblue";
6
5
  id?: string;
7
6
  cls?: string;
7
+ theme?: "light" | "dark" | "lightblue";
8
8
  width?: "narrow" | "medium" | "wide" | "full";
9
9
  height?: string | number;
10
10
  marginTop?: boolean;
@@ -27,9 +27,9 @@ export type GridSlots = typeof __propDef.slots;
27
27
  import { SvelteComponentTyped } from "svelte";
28
28
  declare const __propDef: {
29
29
  props: {
30
- theme?: "light" | "dark" | "lightblue";
31
30
  id?: string;
32
31
  cls?: string;
32
+ theme?: "light" | "dark" | "lightblue";
33
33
  width?: "narrow" | "medium" | "wide" | "full";
34
34
  height?: number | string;
35
35
  marginTop?: boolean;
@@ -2,9 +2,9 @@
2
2
  /** @typedef {typeof __propDef.events} HeroEvents */
3
3
  /** @typedef {typeof __propDef.slots} HeroSlots */
4
4
  export default class Hero extends SvelteComponentTyped<{
5
- theme?: "light" | "dark" | "lightblue";
6
5
  id?: string;
7
6
  cls?: string;
7
+ theme?: "light" | "dark" | "lightblue";
8
8
  background?: string;
9
9
  width?: "narrow" | "medium" | "wide" | "wider" | "full";
10
10
  height?: "full" | "auto" | "tall";
@@ -24,9 +24,9 @@ export type HeroSlots = typeof __propDef.slots;
24
24
  import { SvelteComponentTyped } from "svelte";
25
25
  declare const __propDef: {
26
26
  props: {
27
- theme?: "light" | "dark" | "lightblue";
28
27
  id?: string;
29
28
  cls?: string;
29
+ theme?: "light" | "dark" | "lightblue";
30
30
  background?: string;
31
31
  width?: "narrow" | "medium" | "wide" | "wider" | "full";
32
32
  height?: "auto" | "tall" | "full";
@@ -2,8 +2,8 @@
2
2
  /** @typedef {typeof __propDef.events} HighlightEvents */
3
3
  /** @typedef {typeof __propDef.slots} HighlightSlots */
4
4
  export default class Highlight extends SvelteComponentTyped<{
5
- theme?: "light" | "dark" | "lightblue";
6
5
  id?: string;
6
+ theme?: "light" | "dark" | "lightblue";
7
7
  background?: string;
8
8
  width?: "narrow" | "medium" | "wide" | "wider" | "full";
9
9
  height?: "full" | "auto" | "tall";
@@ -22,8 +22,8 @@ export type HighlightSlots = typeof __propDef.slots;
22
22
  import { SvelteComponentTyped } from "svelte";
23
23
  declare const __propDef: {
24
24
  props: {
25
- theme?: "light" | "dark" | "lightblue";
26
25
  id?: string;
26
+ theme?: "light" | "dark" | "lightblue";
27
27
  background?: string;
28
28
  width?: "narrow" | "medium" | "wide" | "wider" | "full";
29
29
  height?: "auto" | "tall" | "full";
@@ -2,9 +2,9 @@
2
2
  /** @typedef {typeof __propDef.events} NavSectionsEvents */
3
3
  /** @typedef {typeof __propDef.slots} NavSectionsSlots */
4
4
  export default class NavSections extends SvelteComponentTyped<{
5
- theme?: "light" | "dark" | "lightblue";
6
5
  id?: string;
7
6
  cls?: string;
7
+ theme?: "light" | "dark" | "lightblue";
8
8
  background?: string;
9
9
  width?: "narrow" | "medium" | "wide" | "wider" | "full";
10
10
  marginTop?: boolean;
@@ -30,9 +30,9 @@ export type NavSectionsSlots = typeof __propDef.slots;
30
30
  import { SvelteComponentTyped } from "svelte";
31
31
  declare const __propDef: {
32
32
  props: {
33
- theme?: "light" | "dark" | "lightblue";
34
33
  id?: string;
35
34
  cls?: string;
35
+ theme?: "light" | "dark" | "lightblue";
36
36
  background?: string;
37
37
  width?: "narrow" | "medium" | "wide" | "wider" | "full";
38
38
  marginTop?: boolean;
@@ -2,8 +2,8 @@
2
2
  /** @typedef {typeof __propDef.events} ScrollerSectionEvents */
3
3
  /** @typedef {typeof __propDef.slots} ScrollerSectionSlots */
4
4
  export default class ScrollerSection extends SvelteComponentTyped<{
5
- theme?: "light" | "dark" | "lightblue";
6
5
  id?: string;
6
+ theme?: "light" | "dark" | "lightblue";
7
7
  title?: string;
8
8
  hideTitle?: boolean;
9
9
  }, {
@@ -18,8 +18,8 @@ export type ScrollerSectionSlots = typeof __propDef.slots;
18
18
  import { SvelteComponentTyped } from "svelte";
19
19
  declare const __propDef: {
20
20
  props: {
21
- theme?: "light" | "dark" | "lightblue";
22
21
  id?: string;
22
+ theme?: "light" | "dark" | "lightblue";
23
23
  title?: string;
24
24
  hideTitle?: boolean;
25
25
  };
@@ -2,9 +2,9 @@
2
2
  /** @typedef {typeof __propDef.events} SectionEvents */
3
3
  /** @typedef {typeof __propDef.slots} SectionSlots */
4
4
  export default class Section extends SvelteComponentTyped<{
5
- theme?: "light" | "dark" | "lightblue";
6
5
  id?: string;
7
6
  cls?: string;
7
+ theme?: "light" | "dark" | "lightblue";
8
8
  background?: string;
9
9
  width?: "narrow" | "medium" | "wide" | "wider" | "full";
10
10
  marginTop?: boolean;
@@ -24,9 +24,9 @@ export type SectionSlots = typeof __propDef.slots;
24
24
  import { SvelteComponentTyped } from "svelte";
25
25
  declare const __propDef: {
26
26
  props: {
27
- theme?: "light" | "dark" | "lightblue";
28
27
  id?: string;
29
28
  cls?: string;
29
+ theme?: "light" | "dark" | "lightblue";
30
30
  background?: string;
31
31
  width?: "narrow" | "medium" | "wide" | "wider" | "full";
32
32
  marginTop?: boolean;
@@ -2,9 +2,9 @@
2
2
  /** @typedef {typeof __propDef.events} ContainerEvents */
3
3
  /** @typedef {typeof __propDef.slots} ContainerSlots */
4
4
  export default class Container extends SvelteComponentTyped<{
5
- theme?: "light" | "dark" | "lightblue";
6
5
  id?: string;
7
6
  cls?: string;
7
+ theme?: "light" | "dark" | "lightblue";
8
8
  background?: string;
9
9
  width?: "narrow" | "medium" | "wide" | "wider" | "full";
10
10
  height?: "full" | "auto" | "tall";
@@ -23,9 +23,9 @@ export type ContainerSlots = typeof __propDef.slots;
23
23
  import { SvelteComponentTyped } from "svelte";
24
24
  declare const __propDef: {
25
25
  props: {
26
- theme?: "light" | "dark" | "lightblue";
27
26
  id?: string;
28
27
  cls?: string;
28
+ theme?: "light" | "dark" | "lightblue";
29
29
  background?: string;
30
30
  width?: "narrow" | "medium" | "wide" | "wider" | "full";
31
31
  height?: "auto" | "tall" | "full";
@@ -2,10 +2,10 @@
2
2
  /** @typedef {typeof __propDef.events} ThemeEvents */
3
3
  /** @typedef {typeof __propDef.slots} ThemeSlots */
4
4
  export default class Theme extends SvelteComponentTyped<{
5
- theme?: "light" | "dark" | "lightblue";
6
5
  id?: string;
7
6
  cls?: string;
8
7
  global?: boolean;
8
+ theme?: "light" | "dark" | "lightblue";
9
9
  overrides?: any;
10
10
  background?: string;
11
11
  }, {
@@ -20,10 +20,10 @@ export type ThemeSlots = typeof __propDef.slots;
20
20
  import { SvelteComponentTyped } from "svelte";
21
21
  declare const __propDef: {
22
22
  props: {
23
- theme?: "light" | "dark" | "lightblue";
24
23
  id?: string;
25
24
  cls?: string;
26
25
  global?: boolean;
26
+ theme?: "light" | "dark" | "lightblue";
27
27
  overrides?: object;
28
28
  background?: string;
29
29
  };
package/dist/css/main.css CHANGED
@@ -16,6 +16,7 @@ body {
16
16
  --background: #fff;
17
17
  --link: #206095;
18
18
  --link-hover: #003c57;
19
+ background: var(--background, #fff);
19
20
  }
20
21
  .theme-wrapper {
21
22
  color: var(--text);
@@ -28,8 +29,7 @@ a {
28
29
  color: var(--link, --ons-color-text-link);
29
30
  }
30
31
  a:hover {
31
- text-decoration: underline solid
32
- var(--link-hover, --ons-color-text-link-hover) 2px;
32
+ text-decoration: underline solid var(--link-hover, --ons-color-text-link-hover) 2px;
33
33
  }
34
34
  a:hover {
35
35
  color: var(--link-hover, --ons-color-text-link-hover);
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { onMount } from "svelte";
2
+ // import { onMount } from "svelte";
3
3
  import Container from "../../wrappers/Container/Container.svelte";
4
4
 
5
5
  /**
@@ -24,17 +24,17 @@
24
24
  export let hideTitle = false;
25
25
 
26
26
  let section;
27
- let background;
27
+ // let background;
28
28
 
29
- onMount(() => {
30
- background = getComputedStyle(section).getPropertyValue("--background").replaceAll('"', "");
31
- console.log(section, getComputedStyle(section), background);
32
- });
29
+ // onMount(() => {
30
+ // background = getComputedStyle(section).getPropertyValue("--background").replaceAll('"', "");
31
+ // console.log(section, getComputedStyle(section), background);
32
+ // });
33
33
  </script>
34
34
 
35
35
  <section data-id="{id}" bind:this="{section}">
36
- <Container theme="{theme}" width="narrow" background="none">
37
- <div class="ons-scroller-section" style:--background="{background}">
36
+ <Container theme="{theme}" width="narrow">
37
+ <div class="ons-scroller-section">
38
38
  {#if title}
39
39
  <h2 class="section-title" class:ons-u-vh="{hideTitle}">{title}</h2>
40
40
  {/if}
@@ -100,7 +100,6 @@
100
100
 
101
101
  <style>
102
102
  .ons-page__container {
103
- background: var(--background, "none");
104
103
  padding-top: 0.05px;
105
104
  padding-bottom: 0.05px;
106
105
  }
@@ -1,5 +1,4 @@
1
1
  <script>
2
- import { setContext, getContext } from "svelte";
3
2
  import themes from "./themes.js";
4
3
 
5
4
  /**
@@ -17,17 +16,11 @@
17
16
  * @type {boolean}
18
17
  */
19
18
  export let global = false;
20
-
21
- let themeParent = global ? null : getContext("theme");
22
-
23
19
  /**
24
20
  * Sets a predefined theme
25
21
  * @type {"light"|"dark"|"lightblue"}
26
22
  */
27
- export let theme = themeParent || null;
28
-
29
- if (!themeParent) setContext("theme", theme);
30
-
23
+ export let theme = null;
31
24
  /**
32
25
  * Define additional props to override the base theme
33
26
  * @type {object}
@@ -37,7 +30,7 @@
37
30
  * Overrides the base theme background (accepts any valid CSS background value)
38
31
  * @type {string}
39
32
  */
40
- export let background = overrides?.background || themes[theme]?.background || null;
33
+ export let background = null;
41
34
 
42
35
  function makeStyle(theme, overrides, background) {
43
36
  if (theme) {
@@ -57,12 +50,12 @@
57
50
  </script>
58
51
 
59
52
  <svelte:head>
60
- {#if global && background}
61
- {@html "<st" + `yle>body{background:${background}}</st` + "yle>"}
53
+ {#if global}
54
+ {@html "<st" + `yle>${style}</st` + "yle>"}
62
55
  {/if}
63
56
  </svelte:head>
64
57
 
65
- {#if style}
58
+ {#if style && !global}
66
59
  <div id="{id}" class="{cls ? `theme-wrapper ${cls}` : 'theme-wrapper'}" style="{style}">
67
60
  <slot />
68
61
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onsvisual/svelte-components",
3
- "version": "0.0.36",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://onsvisual.github.io/svelte-components",