kmcom-nuxt-layers 1.1.7 → 1.1.8

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.
@@ -34,11 +34,11 @@ interface Props {
34
34
  componentName?: string
35
35
  }
36
36
 
37
- const props = withDefaults(defineProps<Props>(), {
38
- showDetails: true,
39
- message: 'Something went wrong in this section.',
40
- componentName: 'Unknown',
41
- })
37
+ const {
38
+ showDetails = true,
39
+ message = 'Something went wrong in this section.',
40
+ componentName = 'Unknown',
41
+ } = defineProps<Props>()
42
42
 
43
43
  const { logError } = useErrorLog()
44
44
 
@@ -46,7 +46,7 @@ const { logError } = useErrorLog()
46
46
  const handleError = (error: unknown) => {
47
47
  // Log error with context
48
48
  logError(error, {
49
- component: props.componentName,
49
+ component: componentName,
50
50
  info: 'Error caught by ErrorBoundary',
51
51
  })
52
52
  }
@@ -1,4 +1,3 @@
1
- <!-- eslint-disable vue/require-default-prop -->
2
1
  <script setup lang="ts">
3
2
  /**
4
3
  * PageContainer - Unified page wrapper component
@@ -39,12 +38,6 @@
39
38
  * </PageContainer>
40
39
  */
41
40
 
42
- const props = withDefaults(defineProps<Props>(), {
43
- showHeader: true,
44
- headerPreset: 'centered',
45
- layout: 'grid',
46
- })
47
-
48
41
  interface Props {
49
42
  title: string
50
43
  description?: string
@@ -53,20 +46,28 @@ interface Props {
53
46
  layout?: 'grid' | 'upage'
54
47
  }
55
48
 
49
+ const {
50
+ title,
51
+ description,
52
+ showHeader = true,
53
+ headerPreset = 'centered',
54
+ layout = 'grid',
55
+ } = defineProps<Props>()
56
+
56
57
  // Set page metadata for SEO and browser tab
57
58
  useHead({
58
- title: props.title,
59
- meta: props.description
59
+ title,
60
+ meta: description
60
61
  ? [
61
- { name: 'description', content: props.description },
62
- { property: 'og:title', content: props.title },
63
- { property: 'og:description', content: props.description },
62
+ { name: 'description', content: description },
63
+ { property: 'og:title', content: title },
64
+ { property: 'og:description', content: description },
64
65
  ]
65
66
  : undefined,
66
67
  })
67
68
 
68
69
  // Provide title to child components (e.g., for breadcrumbs, schema.org)
69
- provide('pageTitle', props.title)
70
+ provide('pageTitle', title)
70
71
  </script>
71
72
 
72
73
  <template>
@@ -14,10 +14,7 @@ interface Props {
14
14
  fullWidth?: boolean
15
15
  }
16
16
 
17
- withDefaults(defineProps<Props>(), {
18
- fullHeight: false,
19
- fullWidth: false,
20
- })
17
+ const { fullHeight = false, fullWidth = false } = defineProps<Props>()
21
18
  </script>
22
19
 
23
20
  <template>
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ // eslint-disable-next-line no-restricted-imports
2
3
  import { cloneVNode, defineComponent, Fragment, h, ref, type VNode } from 'vue'
3
4
 
4
5
  export default defineComponent({
@@ -13,25 +14,32 @@ export default defineComponent({
13
14
 
14
15
  return () => {
15
16
  const children = (slots.default?.() ?? [])
16
- .flatMap(node => node.type === Fragment ? (node.children as VNode[]) : [node])
17
- .filter(node => typeof node.type === 'string' || typeof node.type === 'object')
17
+ .flatMap((node) => (node.type === Fragment ? (node.children as VNode[]) : [node]))
18
+ .filter((node) => typeof node.type === 'string' || typeof node.type === 'object')
18
19
 
19
20
  const styledChildren = children.map((vnode, index) =>
20
21
  cloneVNode(vnode, {
21
- onMouseenter: () => { hoveredIndex.value = index },
22
+ onMouseenter: () => {
23
+ hoveredIndex.value = index
24
+ },
22
25
  style: {
23
- opacity: hoveredIndex.value !== null && hoveredIndex.value !== index
24
- ? props.dimOpacity
25
- : 1,
26
+ opacity:
27
+ hoveredIndex.value !== null && hoveredIndex.value !== index ? props.dimOpacity : 1,
26
28
  transition: `opacity ${props.duration}ms ease-out`,
27
29
  },
28
- }),
30
+ })
29
31
  )
30
32
 
31
- return h(props.tag, {
32
- ...attrs,
33
- onMouseleave: () => { hoveredIndex.value = null },
34
- }, styledChildren)
33
+ return h(
34
+ props.tag,
35
+ {
36
+ ...attrs,
37
+ onMouseleave: () => {
38
+ hoveredIndex.value = null
39
+ },
40
+ },
41
+ styledChildren
42
+ )
35
43
  }
36
44
  },
37
45
  })
@@ -2,22 +2,20 @@
2
2
  import { useColor } from '../../composables/color'
3
3
  import type { UiColors } from '../../types/colors'
4
4
 
5
- const props = withDefaults(
6
- defineProps<{
7
- name: string
8
- params?: Record<string, string>
9
- query?: Record<string, string>
10
- variant?: string
11
- color?: UiColors
12
- }>(),
13
- {
14
- params: undefined,
15
- query: undefined,
16
- variant: undefined,
17
- color: undefined,
18
- }
19
- )
20
- const colorClass = useColor(props.color, 'text')
5
+ const {
6
+ name,
7
+ params = undefined,
8
+ query = undefined,
9
+ variant = undefined,
10
+ color = undefined,
11
+ } = defineProps<{
12
+ name: string
13
+ params?: Record<string, string>
14
+ query?: Record<string, string>
15
+ variant?: string
16
+ color?: UiColors
17
+ }>()
18
+ const colorClass = useColor(color, 'text')
21
19
  </script>
22
20
 
23
21
  <template>
@@ -1,41 +1,50 @@
1
- <!-- eslint-disable vue/define-macros-order -->
2
1
  <script lang="ts" setup>
3
2
  import { usePicture } from '../../composables/picture'
4
3
  import type { PictureProps } from '../../types/media'
5
4
 
6
- const props = withDefaults(defineProps<PictureProps>(), {
7
- loading: 'lazy',
8
- decoding: 'async',
9
- format: 'webp',
10
- sizes: '100vw',
11
- fit: 'cover',
12
- fetchpriority: 'auto',
13
- quality: 80,
14
- class: '',
15
- imgClass: '',
16
- })
5
+ const {
6
+ src,
7
+ alt,
8
+ width,
9
+ height,
10
+ sizes = '100vw',
11
+ format = 'webp',
12
+ quality = 80,
13
+ fit = 'cover',
14
+ loading = 'lazy',
15
+ fetchpriority = 'auto',
16
+ decoding = 'async',
17
+ provider,
18
+ preset,
19
+ densities,
20
+ class: wrapperClass = '',
21
+ imgClass = '',
22
+ } = defineProps<PictureProps>()
17
23
 
18
- const { sizesString, computedFormat } = usePicture(props)
24
+ const { sizesString, computedFormat } = usePicture(
25
+ () => sizes,
26
+ () => format
27
+ )
19
28
  </script>
20
29
 
21
30
  <template>
22
31
  <NuxtPicture
23
- :src="props.src"
24
- :alt="props.alt"
25
- :width="props.width"
26
- :height="props.height"
32
+ :src
33
+ :alt
34
+ :width
35
+ :height
27
36
  :sizes="sizesString"
28
37
  :format="computedFormat"
29
- :quality="props.quality"
30
- :fit="props.fit"
31
- :loading="props.loading"
32
- :fetchpriority="props.fetchpriority"
33
- :decoding="props.decoding"
34
- :provider="props.provider"
35
- :preset="props.preset"
36
- :densities="props.densities"
37
- :class="props.class"
38
- :img-attrs="{ class: props.imgClass }"
38
+ :quality
39
+ :fit
40
+ :loading
41
+ :fetchpriority
42
+ :decoding
43
+ :provider
44
+ :preset
45
+ :densities
46
+ :class="wrapperClass"
47
+ :img-attrs="{ class: imgClass }"
39
48
  v-bind="$attrs"
40
49
  />
41
50
  </template>
@@ -1,3 +1,4 @@
1
+ import type { MaybeRefOrGetter } from 'vue'
1
2
  import {
2
3
  BREAKPOINT_VALUES,
3
4
  DEVICE_BREAKPOINT_VALUES,
@@ -111,32 +112,21 @@ function responsiveSizesToString(sizes: ResponsiveSizes): string {
111
112
  *
112
113
  * @example
113
114
  * ```ts
114
- * const { sizesString, computedFormat, imgAttrs } = usePicture(props)
115
+ * const { sizesString, computedFormat } = usePicture(() => sizes, () => format)
115
116
  * ```
116
117
  */
117
- export function usePicture(props: Partial<PictureProps>): UsePictureReturn {
118
- /**
119
- * Compute sizes attribute string
120
- * Handles both string and ResponsiveSizes object formats
121
- */
118
+ export function usePicture(
119
+ sizes: MaybeRefOrGetter<PictureProps['sizes']>,
120
+ format?: MaybeRefOrGetter<PictureProps['format']>
121
+ ): UsePictureReturn {
122
122
  const sizesString = computed(() => {
123
- if (!props.sizes) {
124
- return '100vw' // Default to full viewport width
125
- }
126
-
127
- if (typeof props.sizes === 'string') {
128
- return props.sizes
129
- }
130
-
131
- return responsiveSizesToString(props.sizes)
123
+ const s = toValue(sizes)
124
+ if (!s) return '100vw'
125
+ if (typeof s === 'string') return s
126
+ return responsiveSizesToString(s)
132
127
  })
133
128
 
134
- /**
135
- * Compute format string with fallback
136
- */
137
- const computedFormat = computed(() => {
138
- return props.format ?? 'webp'
139
- })
129
+ const computedFormat = computed(() => toValue(format) ?? 'webp')
140
130
 
141
131
  return {
142
132
  sizesString,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kmcom-nuxt-layers",
3
3
  "private": false,
4
- "version": "1.1.7",
4
+ "version": "1.1.8",
5
5
  "description": "Composable Nuxt 4 layers for building scalable Vue applications",
6
6
  "files": [
7
7
  "layers/*/nuxt.config.ts",
@@ -24,7 +24,7 @@
24
24
  "@nuxt/content": "^3.0.0",
25
25
  "@nuxt/eslint": "^1.0.0",
26
26
  "@nuxt/image": "^2.0.0",
27
- "@nuxt/ui": "^4.0.0",
27
+ "@nuxt/ui": "^4.5.0",
28
28
  "@nuxtjs/device": "^4.0.0",
29
29
  "@tresjs/cientos": "^5.0.0",
30
30
  "@tresjs/core": "^5.0.0",
@@ -38,7 +38,7 @@
38
38
  "nuxt": "^4.0.0",
39
39
  "nuxt-studio": "^1.0.0",
40
40
  "pinia": "^3.0.0",
41
- "tailwindcss": "^4.2.0",
41
+ "tailwindcss": "^4.2.1",
42
42
  "three": "^0.170.0",
43
43
  "zod": "^3.20.0"
44
44
  },
@@ -90,11 +90,11 @@
90
90
  "@commitlint/cli": "^20.4.1",
91
91
  "@commitlint/config-conventional": "^20.4.1",
92
92
  "@culur/config-stylelint": "^1.6.4",
93
- "@eslint/json": "^1.0.0",
93
+ "@eslint/json": "^1.0.1",
94
94
  "@eslint/markdown": "^7.5.1",
95
95
  "@ianvs/prettier-plugin-sort-imports": "^4.7.1",
96
96
  "@iconify-json/lucide": "^1.2.89",
97
- "@nuxt/eslint": "^1.14.0",
97
+ "@nuxt/eslint": "^1.15.2",
98
98
  "@nuxt/fonts": "^0.13.0",
99
99
  "@nuxt/image": "^2.0.0",
100
100
  "@nuxt/ui": "latest",
@@ -102,8 +102,8 @@
102
102
  "@perplex-digital/stylelint-config": "^17.3.0",
103
103
  "@pinia/nuxt": "^0.11.3",
104
104
  "@types/node": "^25.3.0",
105
- "@typescript-eslint/eslint-plugin": "^8.56.0",
106
- "@typescript-eslint/parser": "^8.56.0",
105
+ "@typescript-eslint/eslint-plugin": "^8.56.1",
106
+ "@typescript-eslint/parser": "^8.56.1",
107
107
  "@vue/eslint-config-typescript": "^14.7.0",
108
108
  "@vueuse/core": "^14.2.1",
109
109
  "@vueuse/nuxt": "^14.2.1",
@@ -112,16 +112,16 @@
112
112
  "changesets": "^1.0.2",
113
113
  "cypress": "^15.10.0",
114
114
  "depcheck": "^1.4.7",
115
- "eslint": "^10.0.0",
116
- "eslint-plugin-compat": "^6.1.0",
115
+ "eslint": "^10.0.2",
116
+ "eslint-plugin-compat": "^6.2.0",
117
117
  "eslint-plugin-glsl": "0.0.0-wip",
118
- "eslint-plugin-oxlint": "^1.43.0",
119
- "eslint-plugin-pnpm": "^1.5.0",
118
+ "eslint-plugin-oxlint": "^1.50.0",
119
+ "eslint-plugin-pnpm": "^1.6.0",
120
120
  "eslint-plugin-prettier": "^5.5.5",
121
- "eslint-plugin-unicorn": "^62.0.0",
121
+ "eslint-plugin-unicorn": "^63.0.0",
122
122
  "eslint-plugin-unused-imports": "^4.4.1",
123
123
  "eslint-plugin-vue": "^10.8.0",
124
- "npm-check-updates": "^19.3.2",
124
+ "npm-check-updates": "^19.5.0",
125
125
  "nuxt": "latest",
126
126
  "oxlint": "^1.43.0",
127
127
  "pinia": "^3.0.4",
@@ -140,7 +140,7 @@
140
140
  "stylelint-config-tailwindcss": "^1.0.1",
141
141
  "stylelint-no-unsupported-browser-features": "^8.1.1",
142
142
  "stylelint-prettier": "^5.0.3",
143
- "tailwindcss": "^4.2.0",
143
+ "tailwindcss": "^4.2.1",
144
144
  "turbo": "^2.8.10",
145
145
  "typescript": "^5.9.3",
146
146
  "vite-plugin-checker": "^0.12.0",