fuma 1.0.1 → 1.0.3

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.
@@ -1,12 +1,20 @@
1
1
  <script lang="ts">
2
2
  import { browser } from '$app/environment'
3
3
  import { ModeWatcher, toggleMode, mode } from 'mode-watcher'
4
+ import { mdiWeatherNight, mdiWhiteBalanceSunny } from '@mdi/js'
4
5
 
5
6
  import { Icon } from '../icon/index.js'
6
- import { mdiWeatherNight, mdiWhiteBalanceSunny } from '@mdi/js'
7
+ import { onMount } from 'svelte'
7
8
 
8
9
  let klass = ''
9
10
  export { klass as class }
11
+ export let defaultMode: 'dark' | 'light' | 'system' | undefined = undefined
12
+
13
+ onMount(() => {
14
+ const [html] = document.getElementsByTagName('html')
15
+ if (!html || !$mode) return
16
+ html.setAttribute('data-theme', $mode)
17
+ })
10
18
 
11
19
  mode.subscribe((_mode) => {
12
20
  if (!browser) return
@@ -18,7 +26,7 @@
18
26
  $: path = $mode === 'light' ? mdiWhiteBalanceSunny : mdiWeatherNight
19
27
  </script>
20
28
 
21
- <ModeWatcher />
29
+ <ModeWatcher {defaultMode} />
22
30
 
23
31
  <slot {toggleMode} {path}>
24
32
  <button class="btn btn-square btn-sm {klass}" on:click={toggleMode}>
@@ -3,6 +3,7 @@ import { toggleMode } from 'mode-watcher';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  class?: string | undefined;
6
+ defaultMode?: 'dark' | 'light' | 'system' | undefined;
6
7
  children?: import("svelte").Snippet<[{
7
8
  toggleMode: typeof toggleMode;
8
9
  path: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod, prisma, lucia",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",