firebase-os 1.0.0
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 +236 -0
- package/dist/FirebaseOS.d.ts +18 -0
- package/dist/_redirects +1 -0
- package/dist/contactForm.config-BHvMbfxM.js +42 -0
- package/dist/contactForm.config-DLeI_ZEj.js +2 -0
- package/dist/contactForm.config-Dfh0WPXL.cjs +1 -0
- package/dist/contactForm.config-Y2AYSH9s.cjs +1 -0
- package/dist/favicon.svg +5 -0
- package/dist/firebase-os.cjs.js +627 -0
- package/dist/firebase-os.css +2 -0
- package/dist/firebase-os.es.js +90410 -0
- package/dist/icons.svg +24 -0
- package/dist/index.d.ts +6 -0
- package/dist/lib/AuthContext.d.ts +25 -0
- package/dist/lib/ConfigContext.d.ts +19 -0
- package/dist/lib/ThemeContext.d.ts +17 -0
- package/dist/supportForm.config-3dz3ymzX.cjs +1 -0
- package/dist/supportForm.config-74T-eSSH.js +2 -0
- package/dist/supportForm.config-D5ZRFZtU.js +35 -0
- package/dist/supportForm.config-NfLDtLTB.cjs +1 -0
- package/dist/theme.config-BJFA9Nq2.cjs +1 -0
- package/dist/theme.config-BbEzcEDR.js +2 -0
- package/dist/theme.config-DJqqr_kx.cjs +1 -0
- package/dist/theme.config-q93xMCw6.js +68 -0
- package/package.json +80 -0
- package/scripts/postinstall.js +98 -0
package/README.md
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# 🔥 Firebase OS
|
|
2
|
+
|
|
3
|
+
**A complete, production-ready Firebase admin OS — packaged as a single React component.**
|
|
4
|
+
|
|
5
|
+
Authentication, user management, role-based access control, file storage, dynamic pages, form builder, theme customisation, and more — all behind one import.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { FirebaseOS } from 'firebase-os';
|
|
9
|
+
import 'firebase-os/styles.css';
|
|
10
|
+
|
|
11
|
+
export default function App() {
|
|
12
|
+
return <FirebaseOS />;
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
That's it. **One component. Zero configuration files.**
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## ✨ What you get
|
|
21
|
+
|
|
22
|
+
| Feature | Details |
|
|
23
|
+
|:--------|:--------|
|
|
24
|
+
| 🔐 **Authentication** | Email/password, email verification, password reset |
|
|
25
|
+
| 👥 **User Management** | Admin panel, role assignment, inactive user blocking |
|
|
26
|
+
| 🗂️ **Dynamic Pages** | Create pages from the admin panel — no code needed |
|
|
27
|
+
| 📋 **Templates** | Board (Kanban), Calendar, Table, Inline Form, Popup Form, Confirmation |
|
|
28
|
+
| 🎨 **Theme Engine** | Full dark/light mode, custom accent colours, fonts, corner radii, logo |
|
|
29
|
+
| 📁 **File Storage** | Firebase Storage drive with folder structure |
|
|
30
|
+
| 📬 **Form Builder** | Contact forms, support forms — fully customisable |
|
|
31
|
+
| ⚙️ **Settings** | All admin settings via UI — no `.env` editing needed after setup |
|
|
32
|
+
| 📊 **Dashboard** | Personalised user dashboard |
|
|
33
|
+
| 🧑💼 **Submissions & Requests** | Track form submissions and user requests |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 📦 Installation
|
|
38
|
+
|
|
39
|
+
### Peer dependencies (install these in your project)
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install firebase react react-dom react-router-dom
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Install the library
|
|
46
|
+
|
|
47
|
+
**From npm:**
|
|
48
|
+
```bash
|
|
49
|
+
npm install firebase-os
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**From a local build (development):**
|
|
53
|
+
```bash
|
|
54
|
+
npm pack # in the firebase-os repo
|
|
55
|
+
npm install /path/to/firebase-os-1.0.0.tgz # in your app
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 🚀 Quick Start
|
|
61
|
+
|
|
62
|
+
### Option A — Zero config (recommended)
|
|
63
|
+
|
|
64
|
+
On first load, Firebase OS shows a **Setup Wizard** that guides you through pasting your Firebase project credentials. Nothing is stored on any server — keys are saved in your browser's `localStorage`.
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
// App.tsx
|
|
68
|
+
import { FirebaseOS } from 'firebase-os';
|
|
69
|
+
import 'firebase-os/styles.css';
|
|
70
|
+
|
|
71
|
+
export default function App() {
|
|
72
|
+
return <FirebaseOS />;
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
1. Run your app
|
|
77
|
+
2. The Setup Wizard opens automatically
|
|
78
|
+
3. Paste your Firebase config (from the Firebase Console)
|
|
79
|
+
4. Done — the full OS loads
|
|
80
|
+
|
|
81
|
+
### Option B — Pre-configured (CI/CD, teams)
|
|
82
|
+
|
|
83
|
+
Skip the wizard entirely by passing your Firebase config as props:
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import { FirebaseOS } from 'firebase-os';
|
|
87
|
+
import 'firebase-os/styles.css';
|
|
88
|
+
|
|
89
|
+
export default function App() {
|
|
90
|
+
return (
|
|
91
|
+
<FirebaseOS
|
|
92
|
+
firebaseConfig={{
|
|
93
|
+
apiKey: import.meta.env.VITE_API_KEY,
|
|
94
|
+
authDomain: import.meta.env.VITE_AUTH_DOMAIN,
|
|
95
|
+
projectId: import.meta.env.VITE_PROJECT_ID,
|
|
96
|
+
storageBucket: import.meta.env.VITE_STORAGE_BUCKET,
|
|
97
|
+
messagingSenderId: import.meta.env.VITE_MESSAGING_SENDER_ID,
|
|
98
|
+
appId: import.meta.env.VITE_APP_ID,
|
|
99
|
+
}}
|
|
100
|
+
adminEmails={['you@yourcompany.com']}
|
|
101
|
+
/>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 🎛️ Props API
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
interface FirebaseOSProps {
|
|
112
|
+
/**
|
|
113
|
+
* Pass Firebase config directly to skip the Setup Wizard.
|
|
114
|
+
* If omitted, the wizard runs on first load and saves config to localStorage.
|
|
115
|
+
*/
|
|
116
|
+
firebaseConfig?: {
|
|
117
|
+
apiKey: string;
|
|
118
|
+
authDomain: string;
|
|
119
|
+
projectId: string;
|
|
120
|
+
storageBucket: string;
|
|
121
|
+
messagingSenderId: string;
|
|
122
|
+
appId: string;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Email addresses that are automatically assigned the 'admin' role
|
|
127
|
+
* on their first login. Replaces the VITE_ADMIN_EMAILS env var.
|
|
128
|
+
*/
|
|
129
|
+
adminEmails?: string[];
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Custom router basename (e.g. "/app" if your app lives at a subdirectory).
|
|
133
|
+
*/
|
|
134
|
+
basename?: string;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Callback fired whenever the Firebase auth state changes.
|
|
138
|
+
* Useful for integrating with your own auth layer.
|
|
139
|
+
*/
|
|
140
|
+
onAuthChange?: (user: any) => void;
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## 🪝 Advanced: Hooks
|
|
147
|
+
|
|
148
|
+
For advanced integrations, two hooks are exported from the library:
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
import { useAuth, useTheme } from 'firebase-os';
|
|
152
|
+
|
|
153
|
+
// Access auth state anywhere inside <FirebaseOS />
|
|
154
|
+
function MyWidget() {
|
|
155
|
+
const { user, userRole, signOut } = useAuth();
|
|
156
|
+
const { theme, toggleTheme, activeConfig } = useTheme();
|
|
157
|
+
// ...
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
> **Note:** These hooks only work when rendered inside the `<FirebaseOS />` component tree.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 🔥 Getting your Firebase config
|
|
166
|
+
|
|
167
|
+
1. Go to [Firebase Console](https://console.firebase.google.com/)
|
|
168
|
+
2. Create or select a project
|
|
169
|
+
3. Go to **Project Settings** → **Your apps** → **Web app**
|
|
170
|
+
4. Copy the `firebaseConfig` object
|
|
171
|
+
5. Enable **Authentication** (Email/Password), **Firestore**, and **Storage** in your project
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## 🎨 Theming
|
|
176
|
+
|
|
177
|
+
The theme is managed entirely through the admin UI at `/theme`. No code changes needed.
|
|
178
|
+
|
|
179
|
+
All CSS is scoped to `.firebase-os` — the library's styles **do not leak** into your own application's CSS.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 📐 CSS Isolation
|
|
184
|
+
|
|
185
|
+
Firebase OS uses a `.firebase-os` container div for all its CSS variable scope. This means:
|
|
186
|
+
|
|
187
|
+
- ✅ Library's theme variables stay inside `.firebase-os`
|
|
188
|
+
- ✅ Your own `:root` variables are untouched
|
|
189
|
+
- ✅ `data-theme` attribute is set on the container, not `<html>`
|
|
190
|
+
- ✅ No Tailwind class pollution on your global styles
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 🔒 How data is stored
|
|
195
|
+
|
|
196
|
+
- **Firebase credentials** — `localStorage` (your browser only, never any server)
|
|
197
|
+
- **User data** — your own Firebase Firestore
|
|
198
|
+
- **Files** — your own Firebase Storage
|
|
199
|
+
- **Theme / page config** — your own Firestore (`sys_configs` collection)
|
|
200
|
+
|
|
201
|
+
You own all your data. Firebase OS is just the UI layer.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## 📁 Project structure (for contributors)
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
src/
|
|
209
|
+
├── index.ts ← Public API (only exports FirebaseOS + hooks)
|
|
210
|
+
├── FirebaseOS.tsx ← The library component wrapper
|
|
211
|
+
├── App.tsx ← Router + route guards (internal)
|
|
212
|
+
├── lib/
|
|
213
|
+
│ ├── firebase.ts ← Dynamic Firebase init (env OR props)
|
|
214
|
+
│ ├── AuthContext ← Auth lifecycle (internal)
|
|
215
|
+
│ ├── ThemeContext ← CSS variable injection (internal)
|
|
216
|
+
│ └── ConfigContext ← Library props → internal bridge
|
|
217
|
+
├── pages/ ← 17 page components (internal)
|
|
218
|
+
├── templates/ ← 8 template components (internal)
|
|
219
|
+
├── components/ ← Shared UI (internal)
|
|
220
|
+
└── configs/ ← Default configurations (internal)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Scripts
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
npm run dev # Run standalone app (for development)
|
|
227
|
+
npm run test # Run test suite (47 tests)
|
|
228
|
+
npm run build:lib # Build the distributable library
|
|
229
|
+
npm pack # Create .tgz for local testing
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## 📄 License
|
|
235
|
+
|
|
236
|
+
MIT
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface FirebaseOSProps {
|
|
2
|
+
/** Skip the setup wizard — pass Firebase config directly */
|
|
3
|
+
firebaseConfig?: {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
authDomain: string;
|
|
6
|
+
projectId: string;
|
|
7
|
+
storageBucket: string;
|
|
8
|
+
messagingSenderId: string;
|
|
9
|
+
appId: string;
|
|
10
|
+
};
|
|
11
|
+
/** Admin email addresses (replaces VITE_ADMIN_EMAILS env var) */
|
|
12
|
+
adminEmails?: string[];
|
|
13
|
+
/** Custom basename for the router (e.g., "/app") */
|
|
14
|
+
basename?: string;
|
|
15
|
+
/** Called when auth state changes */
|
|
16
|
+
onAuthChange?: (user: any) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function FirebaseOS(props: FirebaseOSProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/_redirects
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* /index.html 200
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region src/configs/forms/contactForm.config.ts
|
|
2
|
+
var e = {
|
|
3
|
+
systemName: "contact",
|
|
4
|
+
formType: "public",
|
|
5
|
+
submitPage: "submissions",
|
|
6
|
+
redirectTo: "/",
|
|
7
|
+
title: "Get in Touch",
|
|
8
|
+
buttonName: "Contact Us",
|
|
9
|
+
submitText: "Send Message",
|
|
10
|
+
fields: [
|
|
11
|
+
{
|
|
12
|
+
name: "name",
|
|
13
|
+
type: "text",
|
|
14
|
+
label: "Full Name",
|
|
15
|
+
placeholder: "John Doe",
|
|
16
|
+
required: !0
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "email",
|
|
20
|
+
type: "email",
|
|
21
|
+
label: "Email Address",
|
|
22
|
+
placeholder: "john@example.com",
|
|
23
|
+
required: !0
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "phone",
|
|
27
|
+
type: "tel",
|
|
28
|
+
label: "Phone Number",
|
|
29
|
+
placeholder: "+1 (555) 000-0000",
|
|
30
|
+
required: !1
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "questions",
|
|
34
|
+
type: "textarea",
|
|
35
|
+
label: "Your Questions",
|
|
36
|
+
placeholder: "How can we help you?",
|
|
37
|
+
required: !0
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { e as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./contactForm.config-Y2AYSH9s.cjs`);require(`./firebase-os.cjs.js`),exports.contactFormConfig=e.t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={systemName:`contact`,formType:`public`,submitPage:`submissions`,redirectTo:`/`,title:`Get in Touch`,buttonName:`Contact Us`,submitText:`Send Message`,fields:[{name:`name`,type:`text`,label:`Full Name`,placeholder:`John Doe`,required:!0},{name:`email`,type:`email`,label:`Email Address`,placeholder:`john@example.com`,required:!0},{name:`phone`,type:`tel`,label:`Phone Number`,placeholder:`+1 (555) 000-0000`,required:!1},{name:`questions`,type:`textarea`,label:`Your Questions`,placeholder:`How can we help you?`,required:!0}]};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|
package/dist/favicon.svg
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="#7c3aed" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<ellipse cx="12" cy="5" rx="9" ry="3"></ellipse>
|
|
3
|
+
<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"></path>
|
|
4
|
+
<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"></path>
|
|
5
|
+
</svg>
|