@falcondev-oss/nuxt-layers-base 0.18.0 → 0.19.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/.playground/app/assets/test.css +4 -0
- package/.playground/app/pages/index.vue +261 -0
- package/.playground/app/pages/login.vue +29 -0
- package/.playground/app/pages/page.vue +31 -0
- package/.playground/app/plugins/trpc.ts +5 -0
- package/.playground/app/plugins/vue-query.ts +1 -0
- package/.playground/nuxt.config.ts +10 -0
- package/.playground/tsconfig.json +17 -0
- package/app/app.config.ts +1 -1
- package/app/composables/createUsable.ts +15 -0
- package/app/composables/useTableColumns.tsx +1 -1
- package/eslint.config.js +22 -0
- package/nuxt.config.ts +6 -0
- package/package.json +3 -7
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { LazyOverlayModalActions } from '#components'
|
|
3
|
+
import z from 'zod'
|
|
4
|
+
|
|
5
|
+
const confirm = useConfirm()
|
|
6
|
+
const overlay = useOverlay()
|
|
7
|
+
|
|
8
|
+
const form = useForm({
|
|
9
|
+
schema: z.object({
|
|
10
|
+
duration: z.number(),
|
|
11
|
+
dateIso: z.string(),
|
|
12
|
+
}),
|
|
13
|
+
sourceValues: () => ({
|
|
14
|
+
dateIso: null,
|
|
15
|
+
duration: null,
|
|
16
|
+
}),
|
|
17
|
+
async submit({ values }) {
|
|
18
|
+
await new Promise((resolve) => setTimeout(resolve, 2000))
|
|
19
|
+
console.log(values)
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const data = ref([
|
|
24
|
+
{
|
|
25
|
+
hey: '',
|
|
26
|
+
ho: 1,
|
|
27
|
+
},
|
|
28
|
+
])
|
|
29
|
+
|
|
30
|
+
const columns = useTableColumns<typeof data>(
|
|
31
|
+
() => [
|
|
32
|
+
{
|
|
33
|
+
accessorKey: 'hey',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
accessorKey: 'ho',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
{
|
|
40
|
+
headerActions: [
|
|
41
|
+
{
|
|
42
|
+
label: 'Add Row',
|
|
43
|
+
onClick: () => {
|
|
44
|
+
data.value.push({ hey: 'new', ho: data.value.length + 1 })
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: 'Add Row 2',
|
|
49
|
+
onClick: () => {
|
|
50
|
+
data.value.push({ hey: 'new', ho: data.value.length + 1 })
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
onDelete(row) {
|
|
55
|
+
data.value = data.value.filter((_, i) => i !== row.index)
|
|
56
|
+
},
|
|
57
|
+
rowActions: [
|
|
58
|
+
{
|
|
59
|
+
icon: 'lucide:pencil',
|
|
60
|
+
onClick: () => {
|
|
61
|
+
console.log('Edit row')
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
)
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<template>
|
|
70
|
+
<LayoutDashboard
|
|
71
|
+
:sidebar="{
|
|
72
|
+
items: [
|
|
73
|
+
{
|
|
74
|
+
label: 'Home',
|
|
75
|
+
icon: 'i-lucide-house',
|
|
76
|
+
active: true,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
label: 'Inbox',
|
|
80
|
+
icon: 'i-lucide-inbox',
|
|
81
|
+
badge: '4',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: 'Contacts',
|
|
85
|
+
icon: 'i-lucide-users',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
label: 'Settings',
|
|
89
|
+
icon: 'i-lucide-settings',
|
|
90
|
+
defaultOpen: true,
|
|
91
|
+
children: [
|
|
92
|
+
{
|
|
93
|
+
label: 'General',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
label: 'Members',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
label: 'Notifications',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
bottomItems: [
|
|
105
|
+
{
|
|
106
|
+
label: 'Home',
|
|
107
|
+
icon: 'i-lucide-house',
|
|
108
|
+
active: true,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
label: 'Inbox',
|
|
112
|
+
icon: 'i-lucide-inbox',
|
|
113
|
+
badge: '4',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
label: 'Contacts',
|
|
117
|
+
icon: 'i-lucide-users',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
label: 'Settings',
|
|
121
|
+
icon: 'i-lucide-settings',
|
|
122
|
+
defaultOpen: true,
|
|
123
|
+
children: [
|
|
124
|
+
{
|
|
125
|
+
label: 'General',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
label: 'Members',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
label: 'Notifications',
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
userMenu: {
|
|
137
|
+
name: 'Benjamin Canac',
|
|
138
|
+
avatarSrc: 'https://github.com/benjamincanac.png',
|
|
139
|
+
},
|
|
140
|
+
}"
|
|
141
|
+
:panel="{
|
|
142
|
+
navbar: {
|
|
143
|
+
title: 'Dashboard',
|
|
144
|
+
ui: {
|
|
145
|
+
root: 'relative',
|
|
146
|
+
title: 'flex-1 absolute inset-0 w-full',
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
toolbar: {
|
|
150
|
+
items: [
|
|
151
|
+
{
|
|
152
|
+
label: 'General',
|
|
153
|
+
icon: 'i-lucide-user',
|
|
154
|
+
active: true,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
label: 'Members',
|
|
158
|
+
icon: 'i-lucide-users',
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
label: 'Notifications',
|
|
162
|
+
icon: 'i-lucide-bell',
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
itemsEnd: [
|
|
166
|
+
{
|
|
167
|
+
label: 'General',
|
|
168
|
+
icon: 'i-lucide-user',
|
|
169
|
+
active: true,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
label: 'Members',
|
|
173
|
+
icon: 'i-lucide-users',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
label: 'Notifications',
|
|
177
|
+
icon: 'i-lucide-bell',
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
},
|
|
181
|
+
}"
|
|
182
|
+
>
|
|
183
|
+
<template #navbar-title>
|
|
184
|
+
<div class="w-full text-center">title</div>
|
|
185
|
+
</template>
|
|
186
|
+
|
|
187
|
+
<UTableCard>
|
|
188
|
+
<UTable :data :columns @select="() => {}" />
|
|
189
|
+
</UTableCard>
|
|
190
|
+
<UCard
|
|
191
|
+
:ui="{
|
|
192
|
+
body: 'flex flex-col gap-4 items-start',
|
|
193
|
+
}"
|
|
194
|
+
>
|
|
195
|
+
<UButton
|
|
196
|
+
label="Confirm"
|
|
197
|
+
variant="subtle"
|
|
198
|
+
@click="
|
|
199
|
+
() => {
|
|
200
|
+
confirm.confirmDestructive({
|
|
201
|
+
title: 'Are you sure?',
|
|
202
|
+
description: 'This action cannot be undone.',
|
|
203
|
+
submitLabel: 'Yes, delete it',
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
"
|
|
207
|
+
/>
|
|
208
|
+
<UButton
|
|
209
|
+
label="Actions"
|
|
210
|
+
variant="subtle"
|
|
211
|
+
@click="
|
|
212
|
+
() => {
|
|
213
|
+
overlay.create(LazyOverlayModalActions, {
|
|
214
|
+
defaultOpen: true,
|
|
215
|
+
props: {
|
|
216
|
+
title: 'Actions',
|
|
217
|
+
description: 'Choose an action to perform',
|
|
218
|
+
actions: [
|
|
219
|
+
{
|
|
220
|
+
label: 'Action 1',
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
label: 'Action 2',
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
},
|
|
227
|
+
})
|
|
228
|
+
}
|
|
229
|
+
"
|
|
230
|
+
/>
|
|
231
|
+
</UCard>
|
|
232
|
+
<UCard
|
|
233
|
+
:ui="{
|
|
234
|
+
body: 'flex flex-col gap-4 items-start ',
|
|
235
|
+
}"
|
|
236
|
+
>
|
|
237
|
+
<UForm
|
|
238
|
+
:form
|
|
239
|
+
:success-toast="{
|
|
240
|
+
title: 'test',
|
|
241
|
+
description: 'wow',
|
|
242
|
+
}"
|
|
243
|
+
>
|
|
244
|
+
{{ form.data }}
|
|
245
|
+
<UField
|
|
246
|
+
v-slot="props"
|
|
247
|
+
:field="
|
|
248
|
+
form.fields.dateIso.$use({
|
|
249
|
+
translate: dateValueIsoTranslator(),
|
|
250
|
+
})
|
|
251
|
+
"
|
|
252
|
+
>
|
|
253
|
+
<UInputDatePicker v-bind="props" />
|
|
254
|
+
</UField>
|
|
255
|
+
<UField v-slot="props" :field="form.fields.duration.$use()">
|
|
256
|
+
<UInputDurationMinutes v-bind="props" />
|
|
257
|
+
</UField>
|
|
258
|
+
</UForm>
|
|
259
|
+
</UCard>
|
|
260
|
+
</LayoutDashboard>
|
|
261
|
+
</template>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { AuthFormField } from '@nuxt/ui'
|
|
3
|
+
|
|
4
|
+
const fields: AuthFormField[] = [
|
|
5
|
+
{
|
|
6
|
+
name: 'email',
|
|
7
|
+
type: 'email',
|
|
8
|
+
label: 'Email',
|
|
9
|
+
placeholder: 'Enter your email',
|
|
10
|
+
required: true,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'password',
|
|
14
|
+
label: 'Password',
|
|
15
|
+
type: 'password',
|
|
16
|
+
placeholder: 'Enter your password',
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'remember',
|
|
21
|
+
label: 'Remember me',
|
|
22
|
+
type: 'checkbox',
|
|
23
|
+
},
|
|
24
|
+
]
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<UAuthForm :fields />
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<LayoutPage
|
|
3
|
+
:header="{
|
|
4
|
+
navigation: {
|
|
5
|
+
variant: 'pill',
|
|
6
|
+
items: [
|
|
7
|
+
{
|
|
8
|
+
label: 'test',
|
|
9
|
+
to: '/',
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
},
|
|
13
|
+
}"
|
|
14
|
+
:footer="{
|
|
15
|
+
items: [
|
|
16
|
+
{
|
|
17
|
+
label: 'hallo',
|
|
18
|
+
to: '/',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
ui: {
|
|
22
|
+
root: 'bg-primary-200',
|
|
23
|
+
},
|
|
24
|
+
}"
|
|
25
|
+
>
|
|
26
|
+
<UContainer>test</UContainer>
|
|
27
|
+
|
|
28
|
+
<template #footer-left>left</template>
|
|
29
|
+
<template #footer-bottom>bottom</template>
|
|
30
|
+
</LayoutPage>
|
|
31
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default defineNuxtPlugin(vueQueryPlugin())
|
package/app/app.config.ts
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const emptyArgsSymbol = Symbol('emptyArgs')
|
|
2
|
+
// https://github.com/vueuse/vueuse/blob/6f880000165cebcb76e4f8a1f031bb98f99f37d6/packages/shared/createGlobalState/index.ts
|
|
3
|
+
export function createUsable<Fn extends (...args: any[]) => any>(stateFactory: Fn): Fn {
|
|
4
|
+
const states = new WeakMap<object | symbol, any>()
|
|
5
|
+
|
|
6
|
+
return ((...args: any[]) => {
|
|
7
|
+
const key = args.length === 0 ? emptyArgsSymbol : args
|
|
8
|
+
if (!states.has(key)) {
|
|
9
|
+
// eslint-disable-next-line ts/no-unsafe-argument
|
|
10
|
+
states.set(key, stateFactory(...args))
|
|
11
|
+
}
|
|
12
|
+
// eslint-disable-next-line ts/no-unsafe-return
|
|
13
|
+
return states.get(key)
|
|
14
|
+
}) as Fn
|
|
15
|
+
}
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import eslintConfig from '@falcondev-oss/configs/eslint'
|
|
3
|
+
|
|
4
|
+
export default eslintConfig({
|
|
5
|
+
tsconfigPath: './tsconfig.json',
|
|
6
|
+
nuxt: true,
|
|
7
|
+
}).append({
|
|
8
|
+
ignores: [
|
|
9
|
+
'node_modules/',
|
|
10
|
+
'dist/',
|
|
11
|
+
'.nuxt/',
|
|
12
|
+
'.nitro/',
|
|
13
|
+
'.output/',
|
|
14
|
+
'.temp/',
|
|
15
|
+
'.data/',
|
|
16
|
+
'drizzle/',
|
|
17
|
+
'prisma/generated/',
|
|
18
|
+
'convex/_generated/',
|
|
19
|
+
'pnpm-lock.yaml',
|
|
20
|
+
'.playground/',
|
|
21
|
+
],
|
|
22
|
+
})
|
package/nuxt.config.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@falcondev-oss/nuxt-layers-base",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.19.0",
|
|
5
5
|
"description": "Nuxt layer with lots of useful helpers and @nuxt/ui components",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "github:falcondev-oss/nuxt-layers",
|
|
@@ -45,9 +45,6 @@
|
|
|
45
45
|
"vue-router": "^4.6.4"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@falcondev-oss/configs": "^5.0.2",
|
|
49
|
-
"eslint": "^9.39.2",
|
|
50
|
-
"prettier": "^3.8.1",
|
|
51
48
|
"typescript": "^5.9.3",
|
|
52
49
|
"vue-tsc": "^3.2.4",
|
|
53
50
|
"zod": "^4.3.6"
|
|
@@ -56,8 +53,7 @@
|
|
|
56
53
|
"dev": "nuxi dev .playground",
|
|
57
54
|
"dev:prepare": "nuxt prepare .playground",
|
|
58
55
|
"type-check": "vue-tsc --noEmit",
|
|
59
|
-
"lint": "eslint
|
|
60
|
-
"lint:
|
|
61
|
-
"lint:fix": "eslint --fix --cache . && prettier --write --cache ."
|
|
56
|
+
"lint": "pnpm -w eslint:cmd \"$PWD\" && pnpm -w prettier:cmd \"$PWD\" --check",
|
|
57
|
+
"lint:fix": "pnpm -w eslint:cmd \"$PWD\" --fix && pnpm -w prettier:cmd \"$PWD\" --write"
|
|
62
58
|
}
|
|
63
59
|
}
|