@dargmuesli/nuxt-vio 1.6.1 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <h1>{{ statusCode ? `${statusCode} - ` : '' }}{{ statusReason }}</h1>
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ import { status } from '@http-util/status-i18n'
7
+
8
+ export interface Props {
9
+ statusCode?: number
10
+ }
11
+ const props = withDefaults(defineProps<Props>(), {
12
+ statusCode: undefined,
13
+ })
14
+
15
+ const { locale, t } = useI18n()
16
+
17
+ // computations
18
+ const statusReason = computed(() => {
19
+ return status(props.statusCode, locale) || t('error')
20
+ })
21
+ </script>
22
+
23
+ <i18n lang="yaml">
24
+ de:
25
+ error: Fehler
26
+ en:
27
+ error: Error
28
+ </i18n>
package/error.vue ADDED
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <NuxtLayout>
3
+ <VioError
4
+ :status-code="error?.statusCode ? +error?.statusCode : undefined"
5
+ />
6
+ </NuxtLayout>
7
+ </template>
8
+
9
+ <script setup lang="ts">
10
+ export type Error = { statusCode: string }
11
+ export interface Props {
12
+ error?: Error
13
+ }
14
+ const props = withDefaults(defineProps<Props>(), {
15
+ error: undefined,
16
+ })
17
+
18
+ useHead({
19
+ title: props.error?.statusCode?.toString(),
20
+ })
21
+ </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-vio",
3
- "version": "1.6.1",
3
+ "version": "1.7.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -17,7 +17,9 @@
17
17
  "server",
18
18
  "plugins",
19
19
  "utils",
20
- "nuxt.config.ts"
20
+ "error.vue",
21
+ "nuxt.config.ts",
22
+ "tailwind.config.ts"
21
23
  ],
22
24
  "main": "./nuxt.config.ts",
23
25
  "scripts": {
@@ -34,6 +36,7 @@
34
36
  },
35
37
  "dependencies": {
36
38
  "@dargmuesli/nuxt-cookie-control": "5.4.0",
39
+ "@http-util/status-i18n": "0.6.2",
37
40
  "@nuxtjs/html-validator": "1.2.4",
38
41
  "@nuxtjs/i18n": "8.0.0-beta.10",
39
42
  "@nuxtjs/tailwindcss": "6.6.5",
@@ -0,0 +1,110 @@
1
+ import colors from 'tailwindcss/colors'
2
+ import { PluginAPI } from 'tailwindcss/types/config'
3
+ import typographyPlugin from '@tailwindcss/typography'
4
+
5
+ const heading = (theme: PluginAPI['theme']) =>
6
+ ({
7
+ fontWeight: theme('fontWeight.bold'),
8
+ overflow: 'hidden',
9
+ textOverflow: 'ellipsis',
10
+ } as Record<string, string>)
11
+
12
+ const gray = colors.gray // or slate, zinc, neutral, stone
13
+
14
+ const prose = (theme: PluginAPI['theme']) => ({
15
+ css: {
16
+ a: {
17
+ color: theme('colors.link'),
18
+ textDecoration: 'none',
19
+ },
20
+ h1: {
21
+ lineHeight: theme('lineHeight.snug'),
22
+ },
23
+ h2: {
24
+ lineHeight: theme('lineHeight.snug'),
25
+ },
26
+ h3: {
27
+ lineHeight: theme('lineHeight.snug'),
28
+ },
29
+ h4: {
30
+ lineHeight: theme('lineHeight.snug'),
31
+ },
32
+ h5: {
33
+ lineHeight: theme('lineHeight.snug'),
34
+ },
35
+ h6: {
36
+ lineHeight: theme('lineHeight.snug'),
37
+ },
38
+ },
39
+ })
40
+
41
+ export default {
42
+ darkMode: 'class',
43
+ plugins: [
44
+ typographyPlugin,
45
+ ({ addBase, addComponents, theme }: PluginAPI) => {
46
+ addBase({
47
+ h1: {
48
+ ...heading(theme),
49
+ fontSize: theme('fontSize.4xl'),
50
+ textAlign: 'center',
51
+ },
52
+ h2: {
53
+ ...heading(theme),
54
+ fontSize: theme('fontSize.3xl'),
55
+ },
56
+ h3: {
57
+ ...heading(theme),
58
+ fontSize: theme('fontSize.2xl'),
59
+ },
60
+ h4: {
61
+ ...heading(theme),
62
+ fontSize: theme('fontSize.xl'),
63
+ },
64
+ h5: {
65
+ ...heading(theme),
66
+ fontSize: theme('fontSize.lg'),
67
+ },
68
+ h6: {
69
+ ...heading(theme),
70
+ },
71
+ })
72
+ addComponents({
73
+ '.object-position-custom': {
74
+ objectPosition: '50% 30%',
75
+ },
76
+ })
77
+ },
78
+ ],
79
+ theme: {
80
+ extend: {
81
+ colors: {
82
+ background: {
83
+ bright: colors.white,
84
+ brighten: gray['200'],
85
+ dark: gray['800'],
86
+ darken: gray['700'],
87
+ },
88
+ link: {
89
+ bright: colors.blue['400'],
90
+ dark: colors.blue['600'],
91
+ },
92
+ text: {
93
+ bright: gray['50'],
94
+ dark: gray['900'],
95
+ },
96
+ },
97
+ screens: {
98
+ 12: { raw: '(min-aspect-ratio: 2/1)' },
99
+ },
100
+ typography: (theme: PluginAPI['theme']) => ({
101
+ DEFAULT: prose(theme),
102
+ sm: prose(theme),
103
+ base: prose(theme),
104
+ lg: prose(theme),
105
+ xl: prose(theme),
106
+ '2xl': prose(theme),
107
+ }),
108
+ },
109
+ },
110
+ }