svelte-firekit 0.0.2 → 0.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.
- package/README.md +82 -34
- package/dist/components/nav/nav.js +1 -1
- package/dist/components/public/footer-main.svelte +0 -0
- package/dist/components/public/footer-main.svelte.d.ts +26 -0
- package/dist/components/public/nav-main.svelte +136 -0
- package/dist/components/public/nav-main.svelte.d.ts +18 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,58 +1,106 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Firekit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Firekit is a powerful Firebase toolkit for SvelteKit applications, providing a comprehensive set of utilities, stores, and components for Firebase integration.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- 🔥 **Firebase Integration** - Seamless Firebase setup and configuration
|
|
8
|
+
- 🔐 **Authentication** - Complete auth system with built-in components
|
|
9
|
+
- 📚 **Firestore** - Reactive data stores and CRUD operations
|
|
10
|
+
- 📦 **Storage** - File upload and management utilities
|
|
11
|
+
- 🛡️ **Route Guards** - Protected routes and authorization
|
|
12
|
+
- ⚡ **SSR Compatible** - Full server-side rendering support
|
|
13
|
+
- 🎯 **Type Safe** - Built with TypeScript for better development experience
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
## Quick Start
|
|
10
16
|
|
|
11
17
|
```bash
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
npx sv create my-app
|
|
18
|
+
# Install with your package manager of choice
|
|
19
|
+
npm install @firekit/sveltekit
|
|
20
|
+
pnpm install @firekit/sveltekit
|
|
21
|
+
yarn add @firekit/sveltekit
|
|
17
22
|
```
|
|
18
23
|
|
|
19
|
-
##
|
|
24
|
+
## Basic Usage
|
|
20
25
|
|
|
21
|
-
|
|
26
|
+
```typescript
|
|
27
|
+
// Configure Firebase
|
|
28
|
+
import { firebaseConfig } from '@firekit/sveltekit';
|
|
29
|
+
firebaseConfig.init({
|
|
30
|
+
apiKey: 'your-api-key',
|
|
31
|
+
// ... other firebase config
|
|
32
|
+
});
|
|
22
33
|
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
// Use Authentication
|
|
35
|
+
import { firekitAuth } from '@firekit/sveltekit';
|
|
36
|
+
await firekitAuth.signInWithEmail(email, password);
|
|
37
|
+
|
|
38
|
+
// Access User State
|
|
39
|
+
import { firekitUser } from '@firekit/sveltekit';
|
|
40
|
+
isLoggedIn = $derived(firekitUser.isLoggedIn);
|
|
41
|
+
|
|
42
|
+
// Protect Routes
|
|
43
|
+
import { firekitAuthGuard } from '@firekit/sveltekit';
|
|
44
|
+
await firekitAuthGuard.requireAuth();
|
|
25
45
|
|
|
26
|
-
|
|
27
|
-
|
|
46
|
+
// Use Firestore
|
|
47
|
+
import { firekitDoc, firekitCollection } from '@firekit/sveltekit';
|
|
48
|
+
const document = firekitDoc<UserData>('users/123');
|
|
49
|
+
const collection = firekitCollection<PostData>('posts');
|
|
50
|
+
|
|
51
|
+
// Handle File Uploads
|
|
52
|
+
import { firekitUploadTask } from '@firekit/sveltekit';
|
|
53
|
+
const uploadTask = firekitUploadTask('path/to/file', file);
|
|
28
54
|
```
|
|
29
55
|
|
|
30
|
-
|
|
56
|
+
## Available Services
|
|
31
57
|
|
|
32
|
-
|
|
58
|
+
### Firebase Configuration
|
|
59
|
+
- `firebaseConfig` - Firebase app configuration
|
|
60
|
+
- `firebaseService` - Core Firebase service initialization
|
|
33
61
|
|
|
34
|
-
|
|
62
|
+
### Authentication
|
|
63
|
+
- `firekitUser` - User state management
|
|
64
|
+
- `firekitAuth` - Authentication methods
|
|
65
|
+
- `firekitAuthGuard` - Route protection
|
|
35
66
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
67
|
+
### Firestore
|
|
68
|
+
- `firekitDoc` - Real-time document subscription
|
|
69
|
+
- `firekitAwaitableDoc` - Promise-based document operations
|
|
70
|
+
- `firekitCollection` - Real-time collection subscription
|
|
71
|
+
- `firekitDocMutations` - Document CRUD operations
|
|
39
72
|
|
|
40
|
-
|
|
73
|
+
### Storage
|
|
74
|
+
- `firekitDownloadUrl` - File URL management
|
|
75
|
+
- `firekitStorageList` - Storage browsing
|
|
76
|
+
- `firekitUploadTask` - File upload handling
|
|
41
77
|
|
|
42
|
-
|
|
43
|
-
npm run build
|
|
44
|
-
```
|
|
78
|
+
## Built-in Components
|
|
45
79
|
|
|
46
|
-
|
|
80
|
+
### Authentication
|
|
81
|
+
- `SignInPage` - Complete sign-in page
|
|
82
|
+
- `SignUpPage` - User registration page
|
|
83
|
+
- `ResetPasswordPage` - Password reset flow
|
|
84
|
+
- `SignInForm` - Reusable sign-in form
|
|
85
|
+
- `SignUpForm` - Reusable registration form
|
|
86
|
+
- `ResetPasswordForm` - Password reset form
|
|
87
|
+
- `UserButton` - User profile button
|
|
47
88
|
|
|
48
|
-
|
|
89
|
+
### Firestore
|
|
90
|
+
- `Collection` - Collection data display
|
|
91
|
+
- `Doc` - Document data display
|
|
49
92
|
|
|
50
|
-
|
|
93
|
+
### Storage
|
|
94
|
+
- `Upload` - File upload component
|
|
51
95
|
|
|
52
|
-
|
|
96
|
+
## Documentation
|
|
53
97
|
|
|
54
|
-
|
|
98
|
+
Visit our [documentation site](https://firekit.codegio.com) for detailed guides and API references.
|
|
55
99
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
100
|
+
## Contributing
|
|
101
|
+
|
|
102
|
+
We welcome contributions! Please see our [contributing guidelines](CONTRIBUTING.md) for details.
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default FooterMain;
|
|
2
|
+
type FooterMain = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const FooterMain: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Button, buttonVariants } from "../ui/button/index.js";
|
|
3
|
+
import { Separator } from "../ui/separator/index.js";
|
|
4
|
+
import { Menu } from "lucide-svelte";
|
|
5
|
+
import * as DropdownMenu from "../ui/dropdown-menu/index.js";
|
|
6
|
+
import DarkModeToggle from "../nav/dark-mode-toggle.svelte";
|
|
7
|
+
import type { NavItem } from "../../types/nav.js";
|
|
8
|
+
|
|
9
|
+
let isNavOpen = false;
|
|
10
|
+
const siteConfig = {
|
|
11
|
+
title: "Svelte Firekit",
|
|
12
|
+
description: "Firebase Toolkit for SvelteKit",
|
|
13
|
+
logo: "/logo.svg",
|
|
14
|
+
logoDark: "/logo-white.svg",
|
|
15
|
+
favicon: "/favicon.png",
|
|
16
|
+
onboarding: true,
|
|
17
|
+
};
|
|
18
|
+
const publicNav: NavItem[] = [
|
|
19
|
+
{
|
|
20
|
+
title: "Docs",
|
|
21
|
+
href: "/docs",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
title: "Contact",
|
|
25
|
+
href: "/contact",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
title: "Blog",
|
|
29
|
+
href: "/blog",
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<header
|
|
35
|
+
class="border-border/40 bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-50 w-full border-b backdrop-blur"
|
|
36
|
+
>
|
|
37
|
+
<nav
|
|
38
|
+
class="relative mx-auto w-full max-w-[85rem] px-4 py-4 sm:px-6 md:flex md:items-center md:justify-between md:gap-3 lg:px-8"
|
|
39
|
+
>
|
|
40
|
+
<!-- Logo w/ Collapse Button -->
|
|
41
|
+
<div class="flex items-center justify-between">
|
|
42
|
+
<a href="/">
|
|
43
|
+
<img
|
|
44
|
+
src={siteConfig.logo}
|
|
45
|
+
alt={siteConfig.title}
|
|
46
|
+
class="h-6 dark:hidden"
|
|
47
|
+
/>
|
|
48
|
+
<img
|
|
49
|
+
src={siteConfig.logoDark}
|
|
50
|
+
alt={siteConfig.title}
|
|
51
|
+
class="hidden h-6 dark:block"
|
|
52
|
+
/>
|
|
53
|
+
</a>
|
|
54
|
+
|
|
55
|
+
<div class="flex items-center gap-2">
|
|
56
|
+
<Button
|
|
57
|
+
variant="outline"
|
|
58
|
+
size="icon"
|
|
59
|
+
class="md:hidden"
|
|
60
|
+
onclick={() => (isNavOpen = !isNavOpen)}
|
|
61
|
+
>
|
|
62
|
+
<Menu /> <span class="sr-only">Toggle navigation</span>
|
|
63
|
+
</Button>
|
|
64
|
+
<!-- End Collapse Button -->
|
|
65
|
+
<div class="md:hidden">
|
|
66
|
+
<DarkModeToggle />
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
<!-- Collapse Button -->
|
|
70
|
+
</div>
|
|
71
|
+
<!-- End Logo w/ Collapse Button -->
|
|
72
|
+
|
|
73
|
+
<!-- Collapse -->
|
|
74
|
+
<div
|
|
75
|
+
class={`${
|
|
76
|
+
isNavOpen ? "block" : "hidden"
|
|
77
|
+
} grow basis-full overflow-hidden transition-all duration-300 md:block`}
|
|
78
|
+
aria-labelledby="header-collapse"
|
|
79
|
+
>
|
|
80
|
+
<div
|
|
81
|
+
class="max-h-[75vh] overflow-hidden overflow-y-auto [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500 [&::-webkit-scrollbar-track]:bg-gray-100 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 [&::-webkit-scrollbar]:w-2"
|
|
82
|
+
>
|
|
83
|
+
<div
|
|
84
|
+
class="flex flex-col gap-0.5 py-2 md:flex-row md:items-center md:justify-end md:gap-1 md:py-0"
|
|
85
|
+
>
|
|
86
|
+
{#each publicNav as item}
|
|
87
|
+
{#if item.items && item.items?.length > 0}
|
|
88
|
+
<!-- Dropdown for items with sub-items -->
|
|
89
|
+
<DropdownMenu.Root>
|
|
90
|
+
<DropdownMenu.Trigger
|
|
91
|
+
class="
|
|
92
|
+
{buttonVariants({
|
|
93
|
+
variant: 'ghost',
|
|
94
|
+
})} text-base font-normal"
|
|
95
|
+
>
|
|
96
|
+
{item.title}
|
|
97
|
+
</DropdownMenu.Trigger>
|
|
98
|
+
<DropdownMenu.Content>
|
|
99
|
+
<DropdownMenu.Group>
|
|
100
|
+
{#each item.items as subItem}
|
|
101
|
+
<DropdownMenu.Item>
|
|
102
|
+
<a href={subItem.href}
|
|
103
|
+
>{subItem.title}</a
|
|
104
|
+
>
|
|
105
|
+
</DropdownMenu.Item>
|
|
106
|
+
{/each}
|
|
107
|
+
</DropdownMenu.Group>
|
|
108
|
+
</DropdownMenu.Content>
|
|
109
|
+
</DropdownMenu.Root>
|
|
110
|
+
{:else}
|
|
111
|
+
<!-- Regular Button for single items -->
|
|
112
|
+
<Button
|
|
113
|
+
variant="ghost"
|
|
114
|
+
href={item.href}
|
|
115
|
+
class="text-base font-normal"
|
|
116
|
+
>
|
|
117
|
+
{#if item.icon}
|
|
118
|
+
<item.icon />
|
|
119
|
+
{/if}
|
|
120
|
+
{item.title}
|
|
121
|
+
</Button>
|
|
122
|
+
{/if}
|
|
123
|
+
{/each}
|
|
124
|
+
<Separator
|
|
125
|
+
orientation="vertical"
|
|
126
|
+
class="mr-2 hidden h-5 md:block"
|
|
127
|
+
/>
|
|
128
|
+
<div class="hidden md:block">
|
|
129
|
+
<DarkModeToggle />
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
<!-- End Collapse -->
|
|
135
|
+
</nav>
|
|
136
|
+
</header>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const NavMain: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type NavMain = InstanceType<typeof NavMain>;
|
|
18
|
+
export default NavMain;
|