@falcondev-oss/nuxt-layers-base 0.4.1 → 0.6.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.
@@ -0,0 +1,13 @@
1
+ <script setup lang="ts">
2
+ defineSlots<{
3
+ default: any
4
+ }>()
5
+ </script>
6
+
7
+ <template>
8
+ <div class="flex min-h-full flex-col items-center justify-center gap-4 p-4">
9
+ <UPageCard class="w-full max-w-md">
10
+ <slot />
11
+ </UPageCard>
12
+ </div>
13
+ </template>
@@ -0,0 +1,107 @@
1
+ <script setup lang="ts">
2
+ import type { ButtonProps, FooterSlots, HeaderSlots, NavigationMenuItem } from '@nuxt/ui'
3
+ import { omit } from 'remeda'
4
+
5
+ defineProps<{
6
+ header?: {
7
+ logo?: {
8
+ src?: string
9
+ iconSrc?: string
10
+ }
11
+ items?: NavigationMenuItem[]
12
+ actions?: ButtonProps[]
13
+ }
14
+ footer?: {
15
+ items?: NavigationMenuItem[]
16
+ actions?: ButtonProps[]
17
+ }
18
+ }>()
19
+
20
+ const slots = defineSlots<
21
+ {
22
+ default: any
23
+ } & AddPropertyPrefix<HeaderSlots, 'header'> &
24
+ AddPropertyPrefix<FooterSlots, 'footer'>
25
+ >()
26
+
27
+ type AddPropertyPrefix<T extends object, P extends string> = {
28
+ [K in keyof T as `${P}-${K & string}`]: T[K]
29
+ }
30
+
31
+ const omitHeaderSlots = [
32
+ 'header-title',
33
+ 'header-right',
34
+ 'header-default',
35
+ ] satisfies (keyof typeof slots)[]
36
+
37
+ const omitFooterSlots = [
38
+ 'footer-left',
39
+ 'footer-right',
40
+ 'footer-default',
41
+ ] satisfies (keyof typeof slots)[]
42
+ </script>
43
+
44
+ <!-- eslint-disable vue/require-explicit-slots -->
45
+ <template>
46
+ <div>
47
+ <UHeader v-if="header">
48
+ <template v-if="header.logo || slots['header-title']" #title>
49
+ <slot name="header-title">
50
+ <template v-if="header.logo">
51
+ <img v-if="header.logo.src" class="h-5 w-auto shrink-0" :src="header.logo.src" />
52
+ <img
53
+ v-if="!header.logo.src && header.logo.iconSrc"
54
+ class="size-5"
55
+ :src="header.logo.iconSrc"
56
+ />
57
+ </template>
58
+ </slot>
59
+ </template>
60
+
61
+ <UNavigationMenu v-if="header.items" :items="header.items" />
62
+
63
+ <template v-if="header.actions || slots['header-right']" #right>
64
+ <slot name="header-right">
65
+ <UActions
66
+ v-if="header.actions"
67
+ :actions="header.actions"
68
+ :defaults="{
69
+ variant: 'subtle',
70
+ }"
71
+ />
72
+ </slot>
73
+ </template>
74
+
75
+ <template v-for="(_, name) in omit(slots, omitHeaderSlots)" #[name]="slotData">
76
+ <!-- @vue-ignore -->
77
+ <slot :name="name" v-bind="slotData || {}" />
78
+ </template>
79
+ </UHeader>
80
+ <UMain>
81
+ <UContainer>
82
+ <slot />
83
+ </UContainer>
84
+ </UMain>
85
+ <UFooter v-if="footer">
86
+ <template #left>
87
+ <p class="text-muted text-sm">Copyright © {{ new Date().getFullYear() }}</p>
88
+ </template>
89
+
90
+ <UNavigationMenu v-if="footer.items" :items="footer.items" variant="link" />
91
+
92
+ <template v-if="footer.actions" #right>
93
+ <UActions
94
+ :actions="footer.actions"
95
+ :defaults="{
96
+ variant: 'ghost',
97
+ }"
98
+ />
99
+ </template>
100
+
101
+ <template v-for="(_, name) in omit(slots, omitFooterSlots)" #[name]="slotData">
102
+ <!-- @vue-ignore -->
103
+ <slot :name="name" v-bind="slotData || {}" />
104
+ </template>
105
+ </UFooter>
106
+ </div>
107
+ </template>
@@ -0,0 +1,39 @@
1
+ <script
2
+ setup
3
+ lang="ts"
4
+ generic="T extends FormSchema = FormSchema<object>, F extends AuthFormField = AuthFormField"
5
+ >
6
+ import type {
7
+ AuthFormField,
8
+ AuthFormProps,
9
+ AuthFormSlots,
10
+ FormSchema,
11
+ FormSubmitEvent,
12
+ InferInput,
13
+ InferOutput,
14
+ } from '@nuxt/ui'
15
+ import type { Merge } from 'type-fest'
16
+ import type { Reactive } from 'vue'
17
+ import { useForwardProps } from 'reka-ui'
18
+
19
+ const props = defineProps<
20
+ Merge<
21
+ AuthFormProps<T, F>,
22
+ {
23
+ onSubmit?: (event: FormSubmitEvent<InferOutput<T>>) => void | Promise<void>
24
+ }
25
+ >
26
+ >()
27
+ const slots = defineSlots<AuthFormSlots<Reactive<InferInput<T>>, F>>()
28
+
29
+ const forwarded = useForwardProps(props)
30
+ </script>
31
+
32
+ <template>
33
+ <UAuthForm v-bind="forwarded">
34
+ <template v-for="(_, name) in slots" #[name]="slotData">
35
+ <!-- @vue-ignore -->
36
+ <slot :name="name" v-bind="slotData || {}" />
37
+ </template>
38
+ </UAuthForm>
39
+ </template>
package/nuxt.config.ts CHANGED
@@ -9,14 +9,6 @@ export default defineNuxtConfig({
9
9
 
10
10
  // dev
11
11
  typescript: {
12
- tsConfig: {
13
- vueCompilerOptions: {
14
- strictTemplates: true,
15
- htmlAttributes: ['aria-*'],
16
- dataAttributes: ['data-*'],
17
- strictVModel: true,
18
- },
19
- },
20
12
  strict: true,
21
13
  },
22
14
  nitro: {
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.1",
4
+ "version": "0.6.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",