duckylib 0.1.8 → 0.1.10

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.
@@ -12,7 +12,7 @@
12
12
 
13
13
  </script>
14
14
 
15
- <button onclick={async () => await onlogin}>
15
+ <button onclick={async () => {if(onlogin) await onlogin()}}>
16
16
  {#if withIcon}<Symbol name="account_circle" inheritColor={true} sizePx={20} hoverEffect={false} />{/if}
17
17
  <p class="font-bold">{label}</p>
18
18
  </button>
@@ -70,7 +70,7 @@
70
70
  <contextentry
71
71
  data-disabled="false"
72
72
  id="log-out"
73
- onclick={async () => await onlogout}
73
+ onclick={async () => {if(onlogout) await onlogout()}}
74
74
  >
75
75
  <span class="material-symbols-outlined">logout</span>
76
76
  <red>Log Out</red>
@@ -145,7 +145,7 @@
145
145
  }
146
146
 
147
147
  img {
148
- width: 2em;
148
+ width: 1.8em;
149
149
  aspect-ratio: 1/1;
150
150
  border-radius: 100px;
151
151
  cursor: pointer;
@@ -97,9 +97,8 @@
97
97
  return authFeatures;
98
98
  }
99
99
 
100
- let user: Auth.User | null = $state(null);
100
+ let user: Auth.User | null = $state(getUserData());
101
101
 
102
- if(authFeaturesEnabled()) user = getUserData();
103
102
 
104
103
  const mobileQuery = new MediaQuery(`max-width: ${PUBLIC_MOBILE_SIZE_PX}px`);
105
104
  const tabletQuery = new MediaQuery(`max-width: ${PUBLIC_TABLET_SIZE_PX}px`);
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { browser } from "$app/environment";
2
+ import { writable } from "svelte/store";
2
3
  export { default as LoginButton } from "./components/buttons/LoginButton.svelte";
3
4
  export { default as ThemeButton } from "./components/buttons/ThemeButton.svelte";
4
5
  export { default as Button } from "./components/buttons/Button.svelte";
@@ -55,7 +56,7 @@ export function getAgeVerified() {
55
56
  }
56
57
  export function getUserData() {
57
58
  if (browser) {
58
- if (window.localStorage.getItem("av") !== null) {
59
+ if (window.localStorage.getItem("userData") !== null) {
59
60
  let it = window.localStorage.getItem("userData");
60
61
  if (!it) {
61
62
  window.localStorage.setItem("userData", "null");
@@ -74,7 +75,10 @@ export function getUserData() {
74
75
  }
75
76
  }
76
77
  export function setUserData(user) {
77
- if (browser) {
78
+ console.log("SET USER DATA", user);
79
+ // if(b) {
80
+ if (window !== undefined)
78
81
  window.localStorage.setItem("userData", JSON.stringify(user));
79
- }
82
+ // writable()
83
+ // }
80
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "duckylib",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",