sveltedfire 0.1.18 → 0.1.20

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.
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export { listenDocs } from './sveltedfire/utilities/listenDocs.js';
8
8
  export { kindlyFetchDoc } from './sveltedfire/utilities/kindlyFetchDoc.js';
9
9
  export { kindlyFetchDocs } from './sveltedfire/utilities/kindlyFetchDocs.js';
10
10
  export { type AuthSig } from './sveltedfire/auth/AuthSig.js';
11
- export { authState } from './sveltedfire/auth/authState.js';
11
+ export { authState } from './sveltedfire/auth/authState.svelte';
12
12
  export { handleForm } from './sveltedfire/utilities/handleForm.js';
13
13
  import SignedIn from './sveltedfire/components/SignedIn.svelte';
14
14
  import SignedOut from './sveltedfire/components/SignedOut.svelte';
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ export { listenDocs } from './sveltedfire/utilities/listenDocs.js';
9
9
  export { kindlyFetchDoc } from './sveltedfire/utilities/kindlyFetchDoc.js';
10
10
  export { kindlyFetchDocs } from './sveltedfire/utilities/kindlyFetchDocs.js';
11
11
  export {} from './sveltedfire/auth/AuthSig.js';
12
- export { authState } from './sveltedfire/auth/authState.js';
12
+ export { authState } from './sveltedfire/auth/authState.svelte';
13
13
  export { handleForm } from './sveltedfire/utilities/handleForm.js';
14
14
  import SignedIn from './sveltedfire/components/SignedIn.svelte';
15
15
  import SignedOut from './sveltedfire/components/SignedOut.svelte';
@@ -0,0 +1,2 @@
1
+ import { type AuthSig } from './AuthSig.js';
2
+ export declare const authState: AuthSig;
@@ -0,0 +1,9 @@
1
+ import { signOut } from './signOut.js';
2
+ import { signInWithGoogle } from './signInWithGoogle.js';
3
+ import {} from './AuthSig.js';
4
+ export const authState = $state({
5
+ currentUser: null,
6
+ initialized: false,
7
+ signInWithGoogle,
8
+ signOut
9
+ });
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { authState } from "../auth/authState.js";
2
+ import { authState } from "../auth/authState.svelte";
3
3
 
4
- $authState.signInWithGoogle()
4
+ authState.signInWithGoogle()
5
5
  </script>
@@ -1,8 +1,8 @@
1
1
  <script lang="ts">
2
2
  const { children } = $props()
3
- import { authState } from '../auth/authState.js';
3
+ import { authState } from '../auth/authState.svelte';
4
4
  </script>
5
5
 
6
- {#if $authState.initialized && $authState!.currentUser}
6
+ {#if authState.initialized && authState!.currentUser}
7
7
  {@render children()}
8
8
  {/if}
@@ -1,8 +1,8 @@
1
1
  <script lang="ts">
2
2
  const { children } = $props()
3
- import { authState } from '../auth/authState.js';
3
+ import { authState } from '../auth/authState.svelte';
4
4
  </script>
5
5
 
6
- {#if $authState && $authState.initialized && !$authState!.currentUser}
6
+ {#if authState && authState.initialized && !authState!.currentUser}
7
7
  {@render children()}
8
8
  {/if}
@@ -1,9 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { getAuth, type User } from 'firebase/auth'
3
- import { signOut } from '../auth/signOut.js'
4
- import { signInWithGoogle } from '../auth/signInWithGoogle.js'
5
- import { type AuthSig } from '../auth/AuthSig.js';
6
- import { authState } from '../auth/authState.js'
3
+ import { authState } from '../auth/authState.svelte'
7
4
 
8
5
  const { children, ...rest } = $props()
9
6
 
@@ -17,35 +14,24 @@
17
14
 
18
15
  const auth = getAuth()
19
16
 
20
- let fullAuth = $state<AuthSig>({
21
- currentUser: null,
22
- initialized: false,
23
- signOut,
24
- signInWithGoogle
25
- })
26
-
27
17
  auth.authStateReady().then(() => {
28
18
  console.log('Received authStateReady')
29
- fullAuth.initialized = true
30
- authState.set(fullAuth)
19
+ authState.initialized = true
31
20
  })
32
21
 
33
22
  auth.onAuthStateChanged(user => {
34
- fullAuth.initialized = true
35
- fullAuth.currentUser = user
23
+ authState.initialized = true
24
+ authState.currentUser = user
36
25
  Object.keys(additionalKeys).forEach((k: string) => {
37
- fullAuth[k] = rest[additionalKeys[k]](null, null)
26
+ authState[k] = rest[additionalKeys[k]](null, null)
38
27
  })
39
28
  user?.getIdTokenResult().then(token => {
40
29
  Object.keys(additionalKeys).forEach((k: string) => {
41
- fullAuth[k] = rest[additionalKeys[k]](user, token)
30
+ authState[k] = rest[additionalKeys[k]](user, token)
42
31
  })
43
32
  })
44
- authState.set(fullAuth)
45
33
  })
46
34
 
47
- authState.set(fullAuth)
48
-
49
35
  </script>
50
36
 
51
37
  {@render children()}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltedfire",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
@@ -1,2 +0,0 @@
1
- import { type AuthSig } from './AuthSig.js';
2
- export declare const authState: import("svelte/store").Writable<AuthSig>;
@@ -1,8 +0,0 @@
1
- import { writable } from "svelte/store";
2
- import {} from './AuthSig.js';
3
- export const authState = writable({
4
- currentUser: null,
5
- signInWithGoogle: null,
6
- signOut: null,
7
- initialized: false
8
- });