svelte-firekit 0.0.2 → 0.0.4

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 CHANGED
@@ -1,58 +1,106 @@
1
- # create-svelte
1
+ # Firekit
2
2
 
3
- Everything you need to build a Svelte library, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
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
- Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
5
+ ## Features
6
6
 
7
- ## Creating a project
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
- If you're seeing this, you've probably already done this step. Congrats!
15
+ ## Quick Start
10
16
 
11
17
  ```bash
12
- # create a new project in the current directory
13
- npx sv create
14
-
15
- # create a new project in my-app
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
- ## Developing
24
+ ## Basic Usage
20
25
 
21
- Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
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
- ```bash
24
- npm run dev
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
- # or start the server and open the app in a new browser tab
27
- npm run dev -- --open
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
- Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
56
+ ## Available Services
31
57
 
32
- ## Building
58
+ ### Firebase Configuration
59
+ - `firebaseConfig` - Firebase app configuration
60
+ - `firebaseService` - Core Firebase service initialization
33
61
 
34
- To build your library:
62
+ ### Authentication
63
+ - `firekitUser` - User state management
64
+ - `firekitAuth` - Authentication methods
65
+ - `firekitAuthGuard` - Route protection
35
66
 
36
- ```bash
37
- npm run package
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
- To create a production version of your showcase app:
73
+ ### Storage
74
+ - `firekitDownloadUrl` - File URL management
75
+ - `firekitStorageList` - Storage browsing
76
+ - `firekitUploadTask` - File upload handling
41
77
 
42
- ```bash
43
- npm run build
44
- ```
78
+ ## Built-in Components
45
79
 
46
- You can preview the production build with `npm run preview`.
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
- > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
89
+ ### Firestore
90
+ - `Collection` - Collection data display
91
+ - `Doc` - Document data display
49
92
 
50
- ## Publishing
93
+ ### Storage
94
+ - `Upload` - File upload component
51
95
 
52
- Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
96
+ ## Documentation
53
97
 
54
- To publish your library to [npm](https://www.npmjs.com):
98
+ Visit our [documentation site](https://firekit.codegio.com) for detailed guides and API references.
55
99
 
56
- ```bash
57
- npm publish
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.
@@ -1,5 +1,5 @@
1
1
  export const nav = {
2
- versions: ["1.0.1",],
2
+ versions: ["0.0.3",],
3
3
  navMain: [
4
4
  {
5
5
  title: "Getting Started",
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-firekit",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -11,6 +11,18 @@
11
11
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
12
12
  "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
13
13
  },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/code-gio/svelte-firekit.git"
17
+ },
18
+ "description": "A Svelte library for Firebase integration",
19
+ "keywords": [
20
+ "svelte",
21
+ "firebase",
22
+ "library",
23
+ "frontend"
24
+ ],
25
+ "author": "Giovani Rodriguez",
14
26
  "files": [
15
27
  "dist",
16
28
  "!dist/**/*.test.*",
@@ -35,6 +47,7 @@
35
47
  },
36
48
  "devDependencies": {
37
49
  "@sveltejs/adapter-auto": "^3.0.0",
50
+ "@sveltejs/adapter-cloudflare": "^4.7.4",
38
51
  "@sveltejs/kit": "^2.0.0",
39
52
  "@sveltejs/package": "^2.0.0",
40
53
  "@sveltejs/vite-plugin-svelte": "^4.0.0",