kmcom-nuxt-layers 1.6.8 → 1.6.10

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/docs/LAYOUT.md CHANGED
@@ -208,8 +208,11 @@ Positioned child within a subgrid section. Use `preset` for common layouts or se
208
208
  | `rowStart` | `number \| ResponsiveValue` | Grid row start |
209
209
  | `rowSpan` | `number \| ResponsiveValue` | Row span |
210
210
  | `layer` | `keyof GridLayers` | Z-index layer: `back`, `mid`, `front`, `top` |
211
- | `align` | `string` | `align-self` value |
212
- | `justify` | `string` | `justify-self` value |
211
+ | `align` | `string` | `align-self` value: `start`, `center`, `end`, `stretch` |
212
+ | `justify` | `string` | `justify-self` value: `start`, `center`, `end`, `stretch` |
213
+ | `container` | `string` | Content width constraint: `content` (65ch), `wide` (90rem), `fluid`, `full` |
214
+ | `gap` | `string` | Override `--grid-gap` for nested content (e.g. `'1rem'`) |
215
+ | `density` | `string` | Rhythm base unit: `compact` (2px), `normal` (4px), `relaxed` (8px) |
213
216
  | `bleed` | `boolean` | Negative margin to reach viewport edge |
214
217
  | `as` | `string` | Tag override |
215
218
 
@@ -428,12 +431,14 @@ interface GridConfig {
428
431
 
429
432
  interface GridPresetsItem {
430
433
  colStart?: number | ResponsiveValue
431
- colSpan?: number | ResponsiveValue
434
+ colSpan?: number | 'full' | ResponsiveValue
432
435
  rowStart?: number | ResponsiveValue
433
436
  rowSpan?: number | ResponsiveValue
437
+ align?: 'start' | 'center' | 'end' | 'stretch'
438
+ justify?: 'start' | 'center' | 'end' | 'stretch'
434
439
  container?: 'content' | 'wide' | 'fluid' | 'full'
435
440
  gap?: string
436
- density?: 'compact' | 'normal' | 'spacious'
441
+ density?: 'compact' | 'normal' | 'relaxed'
437
442
  }
438
443
  ```
439
444
 
@@ -0,0 +1,3 @@
1
+ export default {
2
+ contentLayer: {},
3
+ }
@@ -0,0 +1,7 @@
1
+ declare module '@nuxt/schema' {
2
+ interface AppConfigInput {
3
+ contentLayer?: {
4
+ name?: string
5
+ }
6
+ }
7
+ }
@@ -1,6 +1,4 @@
1
- import { defineAppConfig } from 'nuxt/app'
2
-
3
- export default defineAppConfig({
1
+ export default {
4
2
  coreLayer: {
5
3
  // 404 Page defaults (all optional)
6
4
  notFound: {
@@ -72,4 +70,4 @@ export default defineAppConfig({
72
70
  debug: false,
73
71
  },
74
72
  },
75
- })
73
+ }
@@ -0,0 +1,59 @@
1
+ declare module '@nuxt/schema' {
2
+ interface AppConfigInput {
3
+ coreLayer?: {
4
+ /** Project name */
5
+ name?: string
6
+
7
+ /** 404 Not Found page configuration */
8
+ notFound?: {
9
+ icon?: string
10
+ title?: string
11
+ description?: string
12
+ showPath?: boolean
13
+ showHomeButton?: boolean
14
+ homeButtonLabel?: string
15
+ homeButtonTo?: string
16
+ showBackButton?: boolean
17
+ backButtonLabel?: string
18
+ actions?: Array<{
19
+ label: string
20
+ to?: string
21
+ icon?: string
22
+ color?: 'primary' | 'neutral' | 'error' | 'success'
23
+ variant?: 'solid' | 'outline' | 'ghost' | 'soft'
24
+ click?: () => void
25
+ }>
26
+ suggestions?: {
27
+ enabled?: boolean
28
+ title?: string
29
+ links?: Array<{ label: string; to: string; icon?: string }>
30
+ }
31
+ }
32
+
33
+ loading?: {
34
+ enabled?: boolean
35
+ minDuration?: number
36
+ maxDuration?: number
37
+ background?: string
38
+ textColor?: string
39
+ zIndex?: number
40
+ }
41
+
42
+ errors?: {
43
+ logToConsole?: boolean
44
+ logToExternal?: boolean
45
+ externalUrl?: string
46
+ externalToken?: string
47
+ }
48
+
49
+ scrollGuard?: {
50
+ enabled?: boolean
51
+ excludeSelectors?: string[]
52
+ strict?: boolean
53
+ transitionDuration?: number
54
+ resizeDebounce?: number
55
+ debug?: boolean
56
+ }
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,3 @@
1
+ export default {
2
+ formsLayer: {},
3
+ }
@@ -0,0 +1,7 @@
1
+ declare module '@nuxt/schema' {
2
+ interface AppConfigInput {
3
+ formsLayer?: {
4
+ name?: string
5
+ }
6
+ }
7
+ }
@@ -1,6 +1,4 @@
1
- import { defineAppConfig } from 'nuxt/app'
2
-
3
- export default defineAppConfig({
1
+ export default {
4
2
  /**
5
3
  * Nuxt UI component theming — aligned to the Swiss Grid System.
6
4
  *
@@ -88,11 +86,12 @@ export default defineAppConfig({
88
86
  // Full-viewport hero: full width, all 12 rows
89
87
  hero: { colSpan: 'full', rowSpan: 12 },
90
88
 
91
- // Centered content column (equal margins both sides)
92
- // lg: 3 + 12 + 3 = 18 ✓ | md: 1 + 10 + 1 = 12 ✓
89
+ // Full-width content area within the grid's own padding.
90
+ // mastmain already applies padding-inline (clamp-based gutters),
91
+ // so col-start:1 / col-end:-1 is already visually centred.
92
+ // Use preset="prose" for a narrower reading-width column.
93
93
  centered: {
94
- colStart: { default: 1, md: 2, lg: 4 },
95
- colSpan: { default: 6, md: 10, lg: 12 },
94
+ colSpan: 'full',
96
95
  rowSpan: 12,
97
96
  },
98
97
 
@@ -178,4 +177,4 @@ export default defineAppConfig({
178
177
  },
179
178
  },
180
179
  },
181
- })
180
+ }
@@ -12,6 +12,9 @@
12
12
  * @prop {number | ResponsiveValue} rowSpan - Number of rows to span (default: 1)
13
13
  * @prop {Alignment} align - Vertical alignment (align-self): start, center, end, stretch
14
14
  * @prop {Alignment} justify - Horizontal alignment (justify-self): start, center, end, stretch
15
+ * @prop {string} container - Content width constraint: content (65ch), wide (90rem), fluid, full
16
+ * @prop {string} gap - Override --grid-gap for nested content (e.g. '1rem', '2rem')
17
+ * @prop {string} density - Vertical rhythm: compact (2px), normal (4px), relaxed (8px)
15
18
  * @prop {number} z - Explicit z-index value
16
19
  * @prop {LayerName} layer - Semantic layer: back, mid, front, top
17
20
  * @prop {BleedDirection} bleed - Edge bleed: left, right, both
@@ -41,6 +44,9 @@ interface ResponsiveValue<T> {
41
44
  lg?: T
42
45
  }
43
46
 
47
+ type ContainerSize = 'content' | 'wide' | 'fluid' | 'full'
48
+ type Density = 'compact' | 'normal' | 'relaxed'
49
+
44
50
  interface Props {
45
51
  preset?: string
46
52
  as?: string
@@ -50,6 +56,9 @@ interface Props {
50
56
  rowSpan?: number | ResponsiveValue<number>
51
57
  align?: Alignment
52
58
  justify?: Alignment
59
+ container?: ContainerSize
60
+ gap?: string
61
+ density?: Density
53
62
  z?: number
54
63
  layer?: LayerName
55
64
  bleed?: BleedDirection
@@ -73,6 +82,9 @@ const rowSpan = computed(() => props.rowSpan ?? presetConfig.value?.rowSpan ?? 1
73
82
  // Preset-aware alignment computed refs
74
83
  const align = computed(() => props.align ?? presetConfig.value?.align)
75
84
  const justify = computed(() => props.justify ?? presetConfig.value?.justify)
85
+ const container = computed(() => props.container ?? presetConfig.value?.container)
86
+ const gap = computed(() => props.gap ?? presetConfig.value?.gap)
87
+ const density = computed(() => props.density ?? presetConfig.value?.density)
76
88
 
77
89
  const layerZIndex: Record<LayerName, number> = {
78
90
  back: 0,
@@ -186,6 +198,19 @@ const style = computed(() => {
186
198
  styles.placeItems = `${align.value ?? 'stretch'} ${justify.value ?? 'stretch'}`
187
199
  }
188
200
 
201
+ // Gap override — cascades to nested content via --grid-gap
202
+ if (gap.value) styles['--grid-gap'] = gap.value
203
+
204
+ // Density — sets --rhythm base unit for child spacing utilities
205
+ if (density.value) {
206
+ const rhythmMap: Record<Density, string> = {
207
+ compact: '0.125rem',
208
+ normal: '0.25rem',
209
+ relaxed: '0.5rem',
210
+ }
211
+ styles['--rhythm'] = rhythmMap[density.value]
212
+ }
213
+
189
214
  // Z-index
190
215
  const zIndex = props.z ?? (props.layer ? layerZIndex[props.layer] : undefined)
191
216
  if (zIndex !== undefined) styles.zIndex = String(zIndex)
@@ -196,9 +221,8 @@ const style = computed(() => {
196
221
  const classes = computed(() => {
197
222
  const classList: string[] = ['gi-placed', '@container', '@container/item']
198
223
 
199
- if (props.aspect) {
200
- classList.push(aspectClasses[props.aspect])
201
- }
224
+ if (props.aspect) classList.push(aspectClasses[props.aspect])
225
+ if (container.value) classList.push(`layout-container-${container.value}`)
202
226
 
203
227
  return classList.join(' ')
204
228
  })
@@ -0,0 +1,10 @@
1
+ declare module '@nuxt/schema' {
2
+ interface AppConfigInput {
3
+ layoutLayer?: {
4
+ name?: string
5
+ ui?: {
6
+ grid?: import('./layouts').GridConfig
7
+ }
8
+ }
9
+ }
10
+ }
@@ -28,7 +28,7 @@ export interface GridLayers {
28
28
  }
29
29
 
30
30
  export type GridContainerSize = 'content' | 'wide' | 'fluid' | 'full'
31
- export type GridDensity = 'compact' | 'normal' | 'relaxed'
31
+ export type GridDensity = 'compact' | 'normal' | 'relaxed' // relaxed = 0.5rem --rhythm base
32
32
  export type GridMode = 'swiss' | 'fluid' | 'disabled'
33
33
 
34
34
  export interface GridPresetsItem {
@@ -1,6 +1,4 @@
1
- import { defineAppConfig } from 'nuxt/app'
2
-
3
- export default defineAppConfig({
1
+ export default {
4
2
  motion: {
5
3
  /**
6
4
  * Enable smooth scroll globally (true), on specific routes (string[]), or disable (false).
@@ -26,4 +24,4 @@ export default defineAppConfig({
26
24
  touchMultiplier: 2,
27
25
  },
28
26
  },
29
- })
27
+ }
@@ -1,5 +1,9 @@
1
+ import { gsap } from 'gsap'
2
+ import { ScrollTrigger } from 'gsap/ScrollTrigger'
3
+
1
4
  /**
2
- * GSAP composable - provides access to GSAP and ScrollTrigger
5
+ * Provides access to GSAP and ScrollTrigger.
6
+ * Registration is handled by v-gsap-nuxt.
3
7
  *
4
8
  * @example
5
9
  * const { gsap, ScrollTrigger } = useGsap()
@@ -11,11 +15,5 @@
11
15
  * })
12
16
  */
13
17
  export function useGsap() {
14
- const nuxtApp = useNuxtApp()
15
-
16
- return {
17
- gsap: nuxtApp.$gsap as unknown as typeof import('gsap').gsap,
18
- ScrollTrigger:
19
- nuxtApp.$ScrollTrigger as unknown as typeof import('gsap/ScrollTrigger').ScrollTrigger,
20
- }
18
+ return { gsap, ScrollTrigger }
21
19
  }
@@ -0,0 +1,7 @@
1
+ declare module '@nuxt/schema' {
2
+ interface AppConfigInput {
3
+ motionLayer?: {
4
+ name?: string
5
+ }
6
+ }
7
+ }
@@ -1,6 +1,4 @@
1
- import { defineAppConfig } from 'nuxt/app'
2
-
3
- export default defineAppConfig({
1
+ export default {
4
2
  routingLayer: {
5
3
  preset: 'simple',
6
4
  strictDefaultDeny: false,
@@ -11,4 +9,4 @@ export default defineAppConfig({
11
9
  scrollRouting: { enabled: false, mode: 'replace' },
12
10
  features: {},
13
11
  },
14
- })
12
+ }
@@ -1,6 +1,4 @@
1
- import { defineAppConfig } from 'nuxt/app'
2
-
3
- export default defineAppConfig({
1
+ export default {
4
2
  shader: {
5
3
  preferWebGPU: true,
6
4
  maxPixelRatio: 2,
@@ -8,4 +6,4 @@ export default defineAppConfig({
8
6
  debugPanel: true,
9
7
  toneMapping: 'aces',
10
8
  },
11
- })
9
+ }
@@ -0,0 +1,7 @@
1
+ declare module '@nuxt/schema' {
2
+ interface AppConfigInput {
3
+ shaderLayer?: {
4
+ name?: string
5
+ }
6
+ }
7
+ }
@@ -0,0 +1,3 @@
1
+ export default {
2
+ themeLayer: {},
3
+ }
@@ -0,0 +1,8 @@
1
+ declare module '@nuxt/schema' {
2
+ interface AppConfigInput {
3
+ themeLayer?: {
4
+ accents?: string[]
5
+ defaultAccent?: string
6
+ }
7
+ }
8
+ }
@@ -1,6 +1,4 @@
1
- import { defineAppConfig } from 'nuxt/app'
2
-
3
- export default defineAppConfig({
1
+ export default {
4
2
  mastNav: {
5
3
  links: [],
6
4
  scrollBehaviour: 'router',
@@ -37,4 +35,4 @@ export default defineAppConfig({
37
35
  },
38
36
  },
39
37
  },
40
- })
38
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kmcom-nuxt-layers",
3
3
  "private": false,
4
- "version": "1.6.8",
4
+ "version": "1.6.10",
5
5
  "description": "Composable Nuxt 4 layers for building scalable Vue applications",
6
6
  "files": [
7
7
  "layers/*/nuxt.config.ts",
@@ -1,5 +0,0 @@
1
- import { defineAppConfig } from 'nuxt/app'
2
-
3
- export default defineAppConfig({
4
- contentLayer: {},
5
- })
@@ -1,5 +0,0 @@
1
- import { defineAppConfig } from 'nuxt/app'
2
-
3
- export default defineAppConfig({
4
- formsLayer: {},
5
- })
@@ -1,137 +0,0 @@
1
- import { useElementHover, useElementVisibility, useScroll } from '@vueuse/core'
2
- // eslint-disable-next-line no-restricted-imports
3
- import type { Ref } from 'vue'
4
-
5
- /**
6
- * Composable for handling element animations and transitions
7
- */
8
- export function useMotion(target?: Ref<HTMLElement | null>) {
9
- // Hover state
10
- const isHovered = ref(false)
11
-
12
- // Visibility state
13
- const isVisible = ref(false)
14
-
15
- // Scroll position
16
- const scroll = ref({ x: 0, y: 0 })
17
-
18
- // Initialize if target is provided
19
- if (target?.value) {
20
- isHovered.value = useElementHover(target).value
21
- isVisible.value = useElementVisibility(target).value
22
-
23
- const scrollResult = useScroll(target)
24
- scroll.value = {
25
- x: scrollResult.x.value,
26
- y: scrollResult.y.value,
27
- }
28
- }
29
-
30
- // Animation trigger states
31
- const animateOnHover = ref(false)
32
- const animateOnVisible = ref(false)
33
- const animateOnScroll = ref(false)
34
-
35
- // Trigger functions
36
- const triggerHoverAnimation = () => {
37
- animateOnHover.value = true
38
- setTimeout(() => {
39
- animateOnHover.value = false
40
- }, 300)
41
- }
42
-
43
- const triggerVisibleAnimation = () => {
44
- animateOnVisible.value = true
45
- }
46
-
47
- const triggerScrollAnimation = () => {
48
- animateOnScroll.value = true
49
- }
50
-
51
- return {
52
- // States
53
- isHovered,
54
- isVisible,
55
- scroll,
56
- animateOnHover,
57
- animateOnVisible,
58
- animateOnScroll,
59
-
60
- // Methods
61
- triggerHoverAnimation,
62
- triggerVisibleAnimation,
63
- triggerScrollAnimation,
64
- }
65
- }
66
-
67
- /**
68
- * Composable for managing CSS transitions
69
- */
70
- export function useTransition() {
71
- const transitionClasses = ref<string[]>([])
72
-
73
- const addTransition = (className: string) => {
74
- if (!transitionClasses.value.includes(className)) {
75
- transitionClasses.value.push(className)
76
- }
77
- }
78
-
79
- const removeTransition = (className: string) => {
80
- const index = transitionClasses.value.indexOf(className)
81
- if (index > -1) {
82
- transitionClasses.value.splice(index, 1)
83
- }
84
- }
85
-
86
- const clearTransitions = () => {
87
- transitionClasses.value = []
88
- }
89
-
90
- return {
91
- transitionClasses,
92
- addTransition,
93
- removeTransition,
94
- clearTransitions,
95
- }
96
- }
97
-
98
- /**
99
- * Composable for managing CSS animations
100
- */
101
- export function useAnimation() {
102
- const animationClasses = ref<string[]>([])
103
- const isAnimating = ref(false)
104
-
105
- const addAnimation = (className: string) => {
106
- if (!animationClasses.value.includes(className)) {
107
- animationClasses.value.push(className)
108
- isAnimating.value = true
109
-
110
- // Auto-remove after duration (assuming 300ms)
111
- setTimeout(() => {
112
- removeAnimation(className)
113
- isAnimating.value = false
114
- }, 300)
115
- }
116
- }
117
-
118
- const removeAnimation = (className: string) => {
119
- const index = animationClasses.value.indexOf(className)
120
- if (index > -1) {
121
- animationClasses.value.splice(index, 1)
122
- }
123
- }
124
-
125
- const clearAnimations = () => {
126
- animationClasses.value = []
127
- isAnimating.value = false
128
- }
129
-
130
- return {
131
- animationClasses,
132
- isAnimating,
133
- addAnimation,
134
- removeAnimation,
135
- clearAnimations,
136
- }
137
- }
@@ -1,15 +0,0 @@
1
- import { gsap } from 'gsap'
2
- import { ScrollTrigger } from 'gsap/ScrollTrigger'
3
-
4
- export default defineNuxtPlugin(() => {
5
- // Register GSAP plugins
6
- gsap.registerPlugin(ScrollTrigger)
7
-
8
- // Provide GSAP globally
9
- return {
10
- provide: {
11
- gsap,
12
- ScrollTrigger,
13
- },
14
- }
15
- })
@@ -1,5 +0,0 @@
1
- import { defineAppConfig } from 'nuxt/app'
2
-
3
- export default defineAppConfig({
4
- themeLayer: {},
5
- })