@finema/finework-layer 0.2.50 → 0.2.51

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,73 +1,239 @@
1
- # Nuxt Layer Starter
1
+ # @finema/finework-layer
2
2
 
3
- Create Nuxt extendable layer with this GitHub template.
3
+ A comprehensive Nuxt Layer providing reusable components, composables, layouts, and utilities for Finework applications.
4
4
 
5
- ## Setup
5
+ [![Version](https://img.shields.io/npm/v/@finema/finework-layer.svg)](https://www.npmjs.com/package/@finema/finework-layer)
6
+ [![License](https://img.shields.io/npm/l/@finema/finework-layer.svg)](https://www.npmjs.com/package/@finema/finework-layer)
6
7
 
7
- Make sure to install the dependencies:
8
+ ## 📚 Documentation
9
+
10
+ ### For Developers
11
+
12
+ - **[Quick Start Guide](./QUICK_START.md)** - Get started in 5 minutes
13
+ - **[Component Examples](./COMPONENT_EXAMPLES.md)** - Real-world usage examples
14
+ - **[API Reference](./API_REFERENCE.md)** - Complete API documentation
15
+ - **[Architecture](./ARCHITECTURE.md)** - System design and patterns
16
+ - **[Troubleshooting](./TROUBLESHOOTING.md)** - Common issues and solutions
17
+
18
+ ### For LLM/AI Assistants
19
+
20
+ - **[LLM Guide](./LLM_GUIDE.md)** - Comprehensive guide for AI code generation
21
+
22
+ ## 🚀 Features
23
+
24
+ - ✅ **Authentication System** - Complete auth flow with permissions
25
+ - ✅ **Layout Components** - Admin and User layouts
26
+ - ✅ **Data Loading** - Smart loading states with StatusBox
27
+ - ✅ **Form Handling** - Validation with Valibot
28
+ - ✅ **Type Safety** - Full TypeScript support
29
+ - ✅ **Auto-imports** - Components, composables, and constants
30
+ - ✅ **Middleware** - Auth, permissions, and route guards
31
+ - ✅ **UI Components** - Built on @nuxt/ui
32
+
33
+ ## 📦 Installation
8
34
 
9
35
  ```bash
10
- pnpm install
36
+ pnpm add @finema/finework-layer
11
37
  ```
12
38
 
13
- ## Working on your layer
39
+ ## 🎯 Quick Start
40
+
41
+ ### 1. Extend the Layer
42
+
43
+ ```typescript
44
+ // nuxt.config.ts
45
+ export default defineNuxtConfig({
46
+ extends: ["@finema/finework-layer"],
47
+
48
+ runtimeConfig: {
49
+ public: {
50
+ baseAPI: process.env.NUXT_PUBLIC_BASE_API,
51
+ },
52
+ },
53
+ });
54
+ ```
14
55
 
15
- Your layer is at the root of this repository, it is exactly like a regular Nuxt project, except you can publish it on NPM.
56
+ ### 2. Create Your First Page
57
+
58
+ ```vue
59
+ <template>
60
+ <LayoutAdmin label="Dashboard" :items="navItems">
61
+ <StatusBox :status="data.status.value" :data="data.data.value">
62
+ <template #default="{ data }">
63
+ <Card>
64
+ <h1>Welcome, {{ data.name }}!</h1>
65
+ </Card>
66
+ </template>
67
+ </StatusBox>
68
+ </LayoutAdmin>
69
+ </template>
70
+
71
+ <script setup lang="ts">
72
+ definePageMeta({
73
+ middleware: ["auth"],
74
+ });
75
+
76
+ const data = useObjectLoader({
77
+ method: "GET",
78
+ url: "/api/dashboard",
79
+ getRequestOptions: useRequestOptions().auth,
80
+ });
81
+
82
+ onMounted(() => data.run());
83
+
84
+ const navItems = [
85
+ { label: "Dashboard", to: "/dashboard", icon: "i-heroicons-home" },
86
+ ];
87
+ </script>
88
+ ```
16
89
 
17
- The `.playground` directory should help you on trying your layer during development.
90
+ ## 🏗️ Project Structure
18
91
 
19
- Running `pnpm dev` will prepare and boot `.playground` directory, which imports your layer itself.
92
+ ```
93
+ @finema/finework-layer/
94
+ ├── app/
95
+ │ ├── components/ # Reusable components
96
+ │ │ ├── Button/ # Button variants
97
+ │ │ ├── Layout/ # Layout components
98
+ │ │ ├── InfoItemList.vue
99
+ │ │ └── StatusBox.vue
100
+ │ ├── composables/ # Vue composables
101
+ │ │ ├── useAuth.ts
102
+ │ │ └── useRequestOptions.ts
103
+ │ ├── constants/ # App constants
104
+ │ │ └── routes.ts
105
+ │ ├── middleware/ # Route middleware
106
+ │ │ ├── auth.ts
107
+ │ │ ├── permissions.ts
108
+ │ │ └── guest.ts
109
+ │ └── app.config.ts # App configuration
110
+ ├── .playground/ # Development playground
111
+ └── docs/ # Documentation
112
+ ```
20
113
 
21
- ## Distributing your layer
114
+ ## 🎨 Key Components
22
115
 
23
- Your Nuxt layer is shaped exactly the same as any other Nuxt project, except you can publish it on NPM.
116
+ ### StatusBox
24
117
 
25
- To do so, you only have to check if `files` in `package.json` are valid, then run:
118
+ Handles loading, error, and empty states automatically.
26
119
 
27
- ```bash
28
- npm publish --access public
120
+ ```vue
121
+ <StatusBox :status="loader.status.value" :data="loader.data.value">
122
+ <template #default="{ data }">
123
+ <!-- Your content -->
124
+ </template>
125
+ </StatusBox>
29
126
  ```
30
127
 
31
- Once done, your users will only have to run:
128
+ ### InfoItemList
32
129
 
33
- ```bash
34
- npm install --save your-layer
130
+ Display key-value information in a clean layout.
131
+
132
+ ```vue
133
+ <InfoItemList
134
+ :items="[
135
+ { label: 'Name', value: user.name },
136
+ { label: 'Email', value: user.email },
137
+ { label: 'Active', value: user.is_active, type: 'boolean' },
138
+ ]"
139
+ />
35
140
  ```
36
141
 
37
- Then add the dependency to their `extends` in `nuxt.config`:
142
+ ### Layouts
143
+
144
+ Pre-built layouts for admin and user interfaces.
38
145
 
39
- ```ts
40
- defineNuxtConfig({
41
- extends: 'your-layer'
42
- })
146
+ ```vue
147
+ <LayoutAdmin label="Admin Panel" :items="navigationItems">
148
+ <!-- Your content -->
149
+ </LayoutAdmin>
43
150
  ```
44
151
 
45
- ## Development Server
152
+ ## 🔐 Authentication
46
153
 
47
- Start the development server on http://localhost:3000
154
+ Built-in authentication system with permission management.
48
155
 
49
- ```bash
50
- pnpm dev
156
+ ```typescript
157
+ const auth = useAuth();
158
+
159
+ // Check authentication
160
+ if (auth.isAuthenticated.value) {
161
+ console.log("User:", auth.me.value);
162
+ }
163
+
164
+ // Check permissions
165
+ if (auth.hasPermission(UserModule.PMO, Permission.ADMIN)) {
166
+ // User has PMO admin access
167
+ }
51
168
  ```
52
169
 
53
- ## Production
170
+ ## 🛠️ Development
54
171
 
55
- Build the application for production:
172
+ ### Setup
56
173
 
57
174
  ```bash
175
+ # Install dependencies
176
+ pnpm install
177
+
178
+ # Start development server
179
+ pnpm dev
180
+
181
+ # Build for production
58
182
  pnpm build
183
+
184
+ # Run linter
185
+ pnpm lint
186
+
187
+ # Fix linting issues
188
+ pnpm lint:fix
59
189
  ```
60
190
 
61
- Or statically generate it with:
191
+ ### Working on the Layer
192
+
193
+ The `.playground` directory is used for development and testing. It imports the layer itself, allowing you to test changes in real-time.
62
194
 
63
195
  ```bash
64
- pnpm generate
196
+ # Start playground
197
+ pnpm dev
65
198
  ```
66
199
 
67
- Locally preview production build:
200
+ ## 📝 Publishing
68
201
 
69
202
  ```bash
70
- pnpm preview
203
+ # Update version and create changelog
204
+ pnpm release
205
+
206
+ # Or manually
207
+ npm publish --access public
71
208
  ```
72
209
 
73
- Checkout the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
210
+ ## 🤝 Contributing
211
+
212
+ 1. Create a feature branch
213
+ 2. Make your changes
214
+ 3. Run tests and linting
215
+ 4. Submit a pull request
216
+
217
+ ## 📄 License
218
+
219
+ MIT License - see LICENSE file for details
220
+
221
+ ## 🔗 Links
222
+
223
+ - [Nuxt Documentation](https://nuxt.com)
224
+ - [Nuxt UI Documentation](https://ui.nuxt.com)
225
+ - [@finema/core](https://www.npmjs.com/package/@finema/core)
226
+
227
+ ## 📞 Support
228
+
229
+ For issues and questions:
230
+
231
+ 1. Check the [Troubleshooting Guide](./TROUBLESHOOTING.md)
232
+ 2. Review [Component Examples](./COMPONENT_EXAMPLES.md)
233
+ 3. Consult the [API Reference](./API_REFERENCE.md)
234
+
235
+ ---
236
+
237
+ **Version:** 0.2.50
238
+ **Last Updated:** 2025-11-07
239
+ **Maintained by:** Finema Team