kmcom-nuxt-layers 2.2.5 → 2.2.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.
- package/docs/FEEDS.md +197 -0
- package/docs/LAYERS-FIXES.md +101 -0
- package/docs/MIGRATION.md +627 -0
- package/docs/feed-layer.md +374 -0
- package/docs/patch-picture-provider-type.md +52 -0
- package/docs/shaderGuide.md +2071 -0
- package/docs/types-architecture.md +234 -0
- package/layers/animations/app/components/Motion/CountUp.vue +1 -1
- package/layers/animations/app/components/Motion/Magnetic.vue +1 -1
- package/layers/animations/app/components/Motion/Marquee.vue +3 -2
- package/layers/animations/app/components/Motion/MarqueeText.vue +3 -2
- package/layers/animations/app/components/Motion/Tilt.vue +1 -1
- package/layers/animations/app/composables/useCountUp.ts +4 -1
- package/layers/animations/app/composables/useMagneticElement.ts +2 -4
- package/layers/animations/app/composables/useMarqueeCopies.ts +4 -4
- package/layers/animations/app/composables/useTiltEffect.ts +1 -1
- package/layers/animations/app/types/animations.ts +8 -0
- package/layers/animations/app/types/index.ts +1 -0
- package/layers/animations/package.json +4 -1
- package/layers/canvas/app/components/ShaderCanvas.vue +4 -4
- package/layers/canvas/app/composables/useRendererCapabilities.ts +19 -15
- package/layers/canvas/app/types/index.ts +1 -0
- package/layers/canvas/package.json +2 -1
- package/layers/canvas/tsconfig.json +2 -1
- package/layers/content/app/components/Blog/Card.vue +5 -5
- package/layers/content/app/components/Gallery/AmbientImage.vue +3 -3
- package/layers/content/app/components/Gallery/Card.vue +3 -3
- package/layers/content/app/components/Gallery/Lightbox.vue +5 -1
- package/layers/content/app/components/NuxtContent/Detail.vue +5 -1
- package/layers/content/app/components/NuxtContent/Surround.vue +5 -3
- package/layers/content/app/components/NuxtContent/Toc.vue +1 -1
- package/layers/content/app/components/Portfolio/Card.vue +5 -5
- package/layers/content/app/components/content/Figure.vue +3 -3
- package/layers/content/app/composables/useBlogPosts.ts +2 -2
- package/layers/content/app/composables/useCollectionItem.ts +1 -3
- package/layers/content/app/composables/useGalleryItems.ts +2 -2
- package/layers/content/app/types/index.ts +1 -0
- package/layers/content/package.json +2 -1
- package/layers/core/app/composables/useCache.ts +0 -1
- package/layers/core/app/composables/useErrorLog.ts +9 -11
- package/layers/core/app/plugins/error-handler.ts +36 -36
- package/layers/core/app/plugins/feature-detection.client.ts +15 -15
- package/layers/core/app/plugins/init.ts +121 -129
- package/layers/core/app/plugins/loading.client.ts +27 -27
- package/layers/core/app/plugins/scroll-guard.client.ts +26 -26
- package/layers/core/app/utils/helpers.ts +14 -12
- package/layers/core/nuxt.config.ts +1 -0
- package/layers/feeds/app/plugins/feed-head.ts +62 -63
- package/layers/feeds/package.json +2 -1
- package/layers/feeds/server/routes/feed/discovery.get.ts +1 -2
- package/layers/feeds/server/utils/content-adapter.ts +3 -2
- package/layers/forms/app/components/Form/Field.vue +4 -4
- package/layers/forms/app/types/index.ts +1 -0
- package/layers/forms/package.json +2 -1
- package/layers/forms/server/api/contact.post.ts +1 -1
- package/layers/layout/app/components/Layout/Grid/Item.vue +33 -19
- package/layers/layout/app/components/Layout/Page/Container.vue +11 -11
- package/layers/layout/app/components/Layout/Page/Header.vue +1 -1
- package/layers/layout/app/components/Layout/Page/index.vue +1 -1
- package/layers/layout/app/components/Layout/Section/Gallery.vue +6 -1
- package/layers/layout/app/components/Layout/Section/Title.vue +1 -1
- package/layers/layout/app/types/index.ts +1 -0
- package/layers/layout/package.json +2 -1
- package/layers/mailer/app/types/index.ts +1 -0
- package/layers/mailer/app/types/mailer.ts +25 -0
- package/layers/mailer/package.json +2 -1
- package/layers/motion/package.json +2 -1
- package/layers/navigation/app/components/Links/Group.vue +1 -0
- package/layers/navigation/app/components/Links/Named.vue +2 -0
- package/layers/navigation/app/types/index.ts +1 -0
- package/layers/navigation/package.json +4 -1
- package/layers/page-transitions/app/plugins/page-transitions.client.ts +9 -9
- package/layers/page-transitions/package.json +4 -1
- package/layers/routing/app/plugins/feature-flags.client.ts +9 -9
- package/layers/routing/app/types/app-config.d.ts +3 -1
- package/layers/routing/app/types/index.ts +1 -0
- package/layers/routing/package.json +2 -1
- package/layers/scripts/app/composables/useGtm.ts +1 -1
- package/layers/scripts/app/types/index.ts +1 -0
- package/layers/scripts/app/types/scripts.ts +14 -0
- package/layers/scripts/package.json +2 -1
- package/layers/scroll/app/components/Motion/ScrollScene.vue +3 -1
- package/layers/scroll/app/composables/useScrollSteps.ts +2 -9
- package/layers/scroll/app/composables/useSectionProgress.ts +2 -1
- package/layers/scroll/app/plugins/locomotive-scroll.client.ts +54 -61
- package/layers/scroll/app/types/index.ts +1 -0
- package/layers/scroll/app/types/scroll.ts +32 -0
- package/layers/scroll/package.json +3 -0
- package/layers/seo/package.json +2 -1
- package/layers/shader/app/components/Material/Fresnel.client.vue +1 -1
- package/layers/shader/app/components/Material/Image.client.vue +1 -1
- package/layers/shader/app/components/Material/Node.client.vue +7 -7
- package/layers/shader/app/components/Material/Noise.client.vue +1 -1
- package/layers/shader/app/components/Node/Color.client.vue +17 -20
- package/layers/shader/app/components/Node/Noise.client.vue +31 -34
- package/layers/shader/app/components/Pipeline/Aurora.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/BilinearGradient.client.vue +8 -11
- package/layers/shader/app/components/Pipeline/BillowNoise.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/BrightnessContrast.client.vue +6 -2
- package/layers/shader/app/components/Pipeline/CellularNoise.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/Checkerboard.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/Circle.client.vue +5 -8
- package/layers/shader/app/components/Pipeline/Clouds.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/ColorBurnBlend.client.vue +2 -19
- package/layers/shader/app/components/Pipeline/ColorDodgeBlend.client.vue +2 -19
- package/layers/shader/app/components/Pipeline/ColourRamp.client.vue +5 -9
- package/layers/shader/app/components/Pipeline/ConicGradient.client.vue +5 -8
- package/layers/shader/app/components/Pipeline/Cross.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/CurlNoise.client.vue +3 -7
- package/layers/shader/app/components/Pipeline/DarkenBlend.client.vue +2 -19
- package/layers/shader/app/components/Pipeline/DayNightCycle.client.vue +5 -8
- package/layers/shader/app/components/Pipeline/DiagonalGradient.client.vue +5 -8
- package/layers/shader/app/components/Pipeline/DiamondGradient.client.vue +5 -8
- package/layers/shader/app/components/Pipeline/DifferenceBlend.client.vue +2 -19
- package/layers/shader/app/components/Pipeline/DomainWarpedNoise.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/Dots.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/DuoTone.client.vue +5 -9
- package/layers/shader/app/components/Pipeline/ExclusionBlend.client.vue +3 -23
- package/layers/shader/app/components/Pipeline/ExponentialFog.client.vue +4 -7
- package/layers/shader/app/components/Pipeline/FilmBurn.client.vue +4 -7
- package/layers/shader/app/components/Pipeline/Flame.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/FocalGradient.client.vue +5 -8
- package/layers/shader/app/components/Pipeline/GodRays.client.vue +4 -7
- package/layers/shader/app/components/Pipeline/GradientNoise.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/Grid.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/Halation.client.vue +3 -7
- package/layers/shader/app/components/Pipeline/HardLightBlend.client.vue +2 -19
- package/layers/shader/app/components/Pipeline/Haze.client.vue +4 -7
- package/layers/shader/app/components/Pipeline/Hexagon.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/LensFlare.client.vue +4 -7
- package/layers/shader/app/components/Pipeline/LightenBlend.client.vue +2 -19
- package/layers/shader/app/components/Pipeline/LinearGradient4.client.vue +2 -2
- package/layers/shader/app/components/Pipeline/Marble.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/MonochromeTint.client.vue +3 -7
- package/layers/shader/app/components/Pipeline/MultiplyBlend.client.vue +2 -19
- package/layers/shader/app/components/Pipeline/NoisyGradient.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/NoisyGradientBlend.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/OverlayBlend.client.vue +2 -19
- package/layers/shader/app/components/Pipeline/Polygon.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/RaymarchTunnel.client.vue +4 -7
- package/layers/shader/app/components/Pipeline/Rectangle.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/RidgedNoise.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/Ring.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/ScreenBlend.client.vue +2 -19
- package/layers/shader/app/components/Pipeline/SkyAtmosphere.client.vue +6 -9
- package/layers/shader/app/components/Pipeline/SoftLightBlend.client.vue +2 -19
- package/layers/shader/app/components/Pipeline/SplitTone.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/Star.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/Stripes.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/Tint.client.vue +4 -7
- package/layers/shader/app/components/Pipeline/Triangle.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/ValueNoise.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/VoronoiEdges.client.vue +4 -8
- package/layers/shader/app/components/Pipeline/Water.client.vue +5 -8
- package/layers/shader/app/components/Pipeline/WaveBendLayer.client.vue +4 -7
- package/layers/shader/app/components/Pipeline/WaveColourLayer.client.vue +3 -7
- package/layers/shader/app/components/Pipeline/Wood.client.vue +4 -8
- package/layers/shader/app/components/Preset/Aurora.client.vue +15 -21
- package/layers/shader/app/components/Preset/Flow.client.vue +2 -1
- package/layers/shader/app/components/Preset/GradientMesh.client.vue +2 -1
- package/layers/shader/app/components/Preset/Nebula.client.vue +2 -1
- package/layers/shader/app/components/Preset/Ocean.client.vue +2 -1
- package/layers/shader/app/components/Preset/ThemeAurora.client.vue +30 -90
- package/layers/shader/app/components/Preset/ThemeBubble.client.vue +30 -91
- package/layers/shader/app/components/Preset/ThemeFlow.client.vue +30 -90
- package/layers/shader/app/components/Preset/ThemeGradient.client.vue +30 -91
- package/layers/shader/app/components/Preset/ThemeLavaLamp.client.vue +30 -90
- package/layers/shader/app/components/Preset/ThemePlasma.client.vue +30 -90
- package/layers/shader/app/components/Preset/ThemeWave.client.vue +30 -90
- package/layers/shader/app/components/Shader/Background.client.vue +4 -4
- package/layers/shader/app/components/Shader/Host.client.vue +31 -33
- package/layers/shader/app/components/Shader/Runtime.client.vue +15 -23
- package/layers/shader/app/composables/useAmbientMaterials.ts +53 -51
- package/layers/shader/app/composables/useShaderMixBlend.ts +26 -0
- package/layers/shader/app/composables/useThemePreset.ts +75 -0
- package/layers/shader/app/plugins/shader.client.ts +21 -21
- package/layers/shader/app/shaders/common/noise.ts +2 -7
- package/layers/shader/app/shaders/types.ts +6 -6
- package/layers/shader/app/types/tsl.ts +7 -25
- package/layers/shader/app/types/uniforms.ts +2 -1
- package/layers/shader/app/utils/tsl/color.ts +7 -1
- package/layers/shader/package.json +2 -1
- package/layers/theme/app/components/ThemePicker/Colors.vue +1 -3
- package/layers/theme/app/plugins/theme.client.ts +54 -51
- package/layers/theme/app/types/app-config.d.ts +4 -2
- package/layers/theme/app/types/index.ts +1 -0
- package/layers/theme/app/types/theme.ts +3 -18
- package/layers/theme/package.json +2 -1
- package/layers/theme/server/plugins/theme-fouc.ts +1 -1
- package/layers/transitions/package.json +4 -1
- package/layers/typography/app/components/Typography/CodeBlock.vue +2 -2
- package/layers/typography/app/components/Typography/Headline.vue +2 -2
- package/layers/typography/app/components/Typography/HeadlineScreen.vue +1 -1
- package/layers/typography/app/components/Typography/QuoteBlock.vue +4 -1
- package/layers/typography/app/components/Typography/TextStroke.vue +2 -0
- package/layers/typography/app/components/Typography/index.vue +36 -27
- package/layers/typography/app/composables/typography.ts +27 -21
- package/layers/typography/app/types/colors.ts +9 -29
- package/layers/typography/app/types/index.ts +2 -0
- package/layers/typography/package.json +4 -1
- package/layers/ui/package.json +2 -1
- package/layers/visual/app/app.config.ts +5 -2
- package/layers/visual/app/components/Accent/Blob.vue +20 -20
- package/layers/visual/app/components/Accent/Scene.vue +2 -2
- package/layers/visual/app/components/Base/Modal.vue +2 -2
- package/layers/visual/app/components/Gradient/Background.vue +2 -2
- package/layers/visual/app/components/Gradient/Text.vue +2 -2
- package/layers/visual/app/components/Media/Picture.vue +3 -1
- package/layers/visual/app/components/Progress/Bar.vue +6 -6
- package/layers/visual/app/components/Tint/Overlay.vue +14 -14
- package/layers/visual/app/composables/accent.ts +10 -8
- package/layers/visual/app/composables/gradient.ts +2 -3
- package/layers/visual/app/composables/tint.ts +7 -7
- package/layers/visual/app/types/index.ts +6 -0
- package/layers/visual/app/types/media.ts +4 -2
- package/layers/visual/app/types/tint.ts +2 -1
- package/layers/visual/package.json +4 -1
- package/package.json +5 -2
|
@@ -4,15 +4,15 @@ import type { FeatureValue } from '../types/routing'
|
|
|
4
4
|
export default defineNuxtPlugin({
|
|
5
5
|
name: 'routing:feature-flags',
|
|
6
6
|
async setup() {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const { config } = useRoutingConfig()
|
|
8
|
+
if (!config.runtimeFlags) return
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
const { runtimeFlags } = useFeatureFlags()
|
|
11
|
+
try {
|
|
12
|
+
const data = await $fetch<Record<string, FeatureValue>>('/api/feature-flags')
|
|
13
|
+
runtimeFlags.value = data
|
|
14
|
+
} catch (e) {
|
|
15
|
+
if (config.debug) console.warn('[routing] Failed to fetch feature flags', e)
|
|
16
|
+
}
|
|
17
17
|
},
|
|
18
18
|
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type * from './routing'
|
|
@@ -4,7 +4,7 @@ export function useGtm() {
|
|
|
4
4
|
|
|
5
5
|
const gtmConfig = scriptsLayer?.gtm
|
|
6
6
|
if (!gtmConfig?.enabled || !gtmConfig?.id) {
|
|
7
|
-
return { push: (
|
|
7
|
+
return { push: () => {}, load: () => {} }
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
// Load on Nuxt ready unless consent is required and not yet granted
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type * from './scripts'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type LoadStrategy = 'onNuxtReady' | 'idle' | 'manual'
|
|
2
|
+
|
|
3
|
+
export type ScriptLoaderOptions = {
|
|
4
|
+
src: string
|
|
5
|
+
key?: string
|
|
6
|
+
strategy?: LoadStrategy
|
|
7
|
+
crossorigin?: 'anonymous' | 'use-credentials'
|
|
8
|
+
integrity?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type AnalyticsProxy = {
|
|
12
|
+
track: (event: string, params?: Record<string, unknown>) => void
|
|
13
|
+
load: () => void
|
|
14
|
+
}
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "nuxi dev",
|
|
8
8
|
"dev:playground": "PLAYGROUND_LAYERS=core,scripts pnpm -F playground dev",
|
|
9
|
-
"typecheck": "vue-tsc --noEmit -p ../../tsconfig.typecheck.json"
|
|
9
|
+
"typecheck": "vue-tsc --noEmit -p ../../tsconfig.typecheck.json",
|
|
10
|
+
"lint": "eslint ."
|
|
10
11
|
},
|
|
11
12
|
"dependencies": {
|
|
12
13
|
"@nuxt/scripts": "catalog:"
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import type { ScrollTrigger as GSAPScrollTrigger } from 'gsap/ScrollTrigger'
|
|
3
|
+
|
|
2
4
|
import { SCROLL_SCENE_KEY, type ScrollSceneContext } from '../../composables/useScrollSteps'
|
|
3
5
|
|
|
4
6
|
const {
|
|
@@ -72,7 +74,7 @@
|
|
|
72
74
|
unregisterStep,
|
|
73
75
|
})
|
|
74
76
|
|
|
75
|
-
let st:
|
|
77
|
+
let st: GSAPScrollTrigger | null = null
|
|
76
78
|
|
|
77
79
|
onMounted(() => {
|
|
78
80
|
if (!containerRef.value) return
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ScrollSceneContext } from '../types/scroll'
|
|
2
2
|
|
|
3
3
|
export const SCROLL_SCENE_KEY = Symbol('motionScrollScene')
|
|
4
4
|
|
|
5
|
-
export type ScrollSceneContext
|
|
6
|
-
progress: Ref<number>
|
|
7
|
-
active: Ref<boolean>
|
|
8
|
-
name: string
|
|
9
|
-
stepCount: ComputedRef<number>
|
|
10
|
-
registerStep: (index: number) => void
|
|
11
|
-
unregisterStep: (index: number) => void
|
|
12
|
-
}
|
|
5
|
+
export type { ScrollSceneContext }
|
|
13
6
|
|
|
14
7
|
/**
|
|
15
8
|
* Step/waypoint state tracking — must be used inside a MotionScrollScene.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ScrollTrigger } from 'gsap/ScrollTrigger'
|
|
1
2
|
import type { MaybeRef } from 'vue'
|
|
2
3
|
|
|
3
4
|
type SectionProgressOptions = {
|
|
@@ -27,7 +28,7 @@ export function useSectionProgress(
|
|
|
27
28
|
const entering = computed(() => active.value && direction.value > 0)
|
|
28
29
|
const leaving = computed(() => active.value && direction.value < 0)
|
|
29
30
|
|
|
30
|
-
let st:
|
|
31
|
+
let st: ScrollTrigger | null = null
|
|
31
32
|
|
|
32
33
|
onMounted(() => {
|
|
33
34
|
const el = unref(trigger)
|
|
@@ -1,78 +1,71 @@
|
|
|
1
1
|
import { ScrollTrigger } from 'gsap/ScrollTrigger'
|
|
2
2
|
import LocomotiveScroll from 'locomotive-scroll'
|
|
3
|
-
|
|
4
|
-
export type ScrollState = {
|
|
5
|
-
scroll: number
|
|
6
|
-
limit: number
|
|
7
|
-
velocity: number
|
|
8
|
-
direction: number
|
|
9
|
-
progress: number
|
|
10
|
-
}
|
|
3
|
+
import type { ScrollState } from '../types/scroll'
|
|
11
4
|
|
|
12
5
|
export default defineNuxtPlugin({
|
|
13
6
|
name: 'scroll:locomotive-scroll',
|
|
14
7
|
setup() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
const scrollState = reactive<ScrollState>({
|
|
9
|
+
scroll: 0,
|
|
10
|
+
limit: 0,
|
|
11
|
+
velocity: 0,
|
|
12
|
+
direction: 0,
|
|
13
|
+
progress: 0,
|
|
14
|
+
})
|
|
22
15
|
|
|
23
|
-
|
|
16
|
+
const instance = shallowRef<LocomotiveScroll | null>(null)
|
|
24
17
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
18
|
+
function init() {
|
|
19
|
+
if (instance.value) return
|
|
20
|
+
instance.value = new LocomotiveScroll({
|
|
21
|
+
lenisOptions: {
|
|
22
|
+
lerp: 0.1,
|
|
23
|
+
smoothWheel: true,
|
|
24
|
+
wheelMultiplier: 1,
|
|
25
|
+
},
|
|
26
|
+
scrollCallback: ({ scroll, limit, velocity, direction, progress }) => {
|
|
27
|
+
scrollState.scroll = scroll
|
|
28
|
+
scrollState.limit = limit
|
|
29
|
+
scrollState.velocity = velocity
|
|
30
|
+
scrollState.direction = direction
|
|
31
|
+
scrollState.progress = progress
|
|
32
|
+
ScrollTrigger.update()
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
}
|
|
43
36
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
function destroy() {
|
|
38
|
+
instance.value?.destroy()
|
|
39
|
+
instance.value = null
|
|
40
|
+
}
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
const router = useRouter()
|
|
43
|
+
const appConfig = useAppConfig()
|
|
44
|
+
const smoothScroll: boolean | string[] = appConfig.scroll?.smoothScroll ?? true
|
|
52
45
|
|
|
53
|
-
|
|
46
|
+
const nuxtApp = useNuxtApp()
|
|
54
47
|
|
|
55
|
-
|
|
56
|
-
nuxtApp.hook('app:mounted', () => nextTick(init))
|
|
57
|
-
nuxtApp.hook('page:finish', () => nextTick(() => ScrollTrigger.refresh()))
|
|
58
|
-
} else if (Array.isArray(smoothScroll)) {
|
|
59
|
-
addRouteMiddleware((to, from) => {
|
|
60
|
-
if (smoothScroll.includes(to.path)) {
|
|
61
|
-
nextTick(init)
|
|
62
|
-
} else if (from?.path && smoothScroll.includes(from.path)) {
|
|
63
|
-
destroy()
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
if (smoothScroll.includes(router.currentRoute.value.path)) {
|
|
48
|
+
if (smoothScroll === true) {
|
|
67
49
|
nuxtApp.hook('app:mounted', () => nextTick(init))
|
|
50
|
+
nuxtApp.hook('page:finish', () => nextTick(() => ScrollTrigger.refresh()))
|
|
51
|
+
} else if (Array.isArray(smoothScroll)) {
|
|
52
|
+
addRouteMiddleware((to, from) => {
|
|
53
|
+
if (smoothScroll.includes(to.path)) {
|
|
54
|
+
nextTick(init)
|
|
55
|
+
} else if (from?.path && smoothScroll.includes(from.path)) {
|
|
56
|
+
destroy()
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
if (smoothScroll.includes(router.currentRoute.value.path)) {
|
|
60
|
+
nuxtApp.hook('app:mounted', () => nextTick(init))
|
|
61
|
+
}
|
|
68
62
|
}
|
|
69
|
-
}
|
|
70
63
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
return {
|
|
65
|
+
provide: {
|
|
66
|
+
locomotiveScroll: instance,
|
|
67
|
+
scrollState,
|
|
68
|
+
},
|
|
69
|
+
}
|
|
77
70
|
},
|
|
78
71
|
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type * from './scroll'
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ComputedRef, Ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
export type ScrollToOptions = {
|
|
4
|
+
offset?: number
|
|
5
|
+
duration?: number
|
|
6
|
+
immediate?: boolean
|
|
7
|
+
lock?: boolean
|
|
8
|
+
onComplete?: () => void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type SectionProgressOptions = {
|
|
12
|
+
start?: string
|
|
13
|
+
end?: string
|
|
14
|
+
markers?: boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type ScrollSceneContext = {
|
|
18
|
+
progress: Ref<number>
|
|
19
|
+
active: Ref<boolean>
|
|
20
|
+
name: string
|
|
21
|
+
stepCount: ComputedRef<number>
|
|
22
|
+
registerStep: (index: number) => void
|
|
23
|
+
unregisterStep: (index: number) => void
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type ScrollState = {
|
|
27
|
+
scroll: number
|
|
28
|
+
limit: number
|
|
29
|
+
velocity: number
|
|
30
|
+
direction: number
|
|
31
|
+
progress: number
|
|
32
|
+
}
|
package/layers/seo/package.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "nuxi dev",
|
|
8
8
|
"dev:playground": "PLAYGROUND_LAYERS=core,seo pnpm -F playground dev",
|
|
9
|
-
"typecheck": "vue-tsc --noEmit -p ../../tsconfig.typecheck.json"
|
|
9
|
+
"typecheck": "vue-tsc --noEmit -p ../../tsconfig.typecheck.json",
|
|
10
|
+
"lint": "eslint ."
|
|
10
11
|
},
|
|
11
12
|
"dependencies": {
|
|
12
13
|
"@nuxtjs/seo": "catalog:"
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
// Mix colors based on fresnel using reactive uniforms
|
|
74
74
|
const colorNode = mix(vec3(baseColorUniform), vec3(fresnelColorUniform), fresnelFactor)
|
|
75
75
|
|
|
76
|
-
mat.colorNode = colorNode as
|
|
76
|
+
mat.colorNode = colorNode as TSLNode
|
|
77
77
|
mat.transparent = transparent
|
|
78
78
|
mat.side = DoubleSide
|
|
79
79
|
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
const {
|
|
8
8
|
type = 'basic',
|
|
9
|
-
colorNode,
|
|
10
|
-
opacityNode,
|
|
11
|
-
normalNode,
|
|
12
|
-
emissiveNode,
|
|
13
|
-
metalnessNode,
|
|
14
|
-
roughnessNode,
|
|
15
|
-
positionNode,
|
|
9
|
+
colorNode = undefined,
|
|
10
|
+
opacityNode = undefined,
|
|
11
|
+
normalNode = undefined,
|
|
12
|
+
emissiveNode = undefined,
|
|
13
|
+
metalnessNode = undefined,
|
|
14
|
+
roughnessNode = undefined,
|
|
15
|
+
positionNode = undefined,
|
|
16
16
|
transparent = false,
|
|
17
17
|
side = 'front',
|
|
18
18
|
wireframe = false,
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
// Mix colors based on noise using reactive uniforms
|
|
126
126
|
const colorNode = mix(vec3(baseColorUniform), vec3(peakColorUniform), normalizedNoise)
|
|
127
127
|
|
|
128
|
-
mat.colorNode = colorNode as
|
|
128
|
+
mat.colorNode = colorNode as TSLNode
|
|
129
129
|
mat.transparent = transparent
|
|
130
130
|
mat.side = DoubleSide
|
|
131
131
|
|
|
@@ -4,38 +4,35 @@
|
|
|
4
4
|
|
|
5
5
|
import type { TSLNode } from '../../shaders/types'
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
opacity: 1.0,
|
|
21
|
-
}
|
|
22
|
-
)
|
|
7
|
+
const {
|
|
8
|
+
id = 'color',
|
|
9
|
+
color = '#ffffff',
|
|
10
|
+
order = 0,
|
|
11
|
+
blend = 'normal',
|
|
12
|
+
opacity = 1.0,
|
|
13
|
+
} = defineProps<{
|
|
14
|
+
id?: string
|
|
15
|
+
color?: string
|
|
16
|
+
order?: number
|
|
17
|
+
blend?: 'normal' | 'add' | 'multiply' | 'screen' | 'overlay' | 'mix'
|
|
18
|
+
opacity?: number
|
|
19
|
+
}>()
|
|
23
20
|
|
|
24
21
|
const graph = useShaderGraphContext()
|
|
25
22
|
|
|
26
23
|
// Create uniform once
|
|
27
|
-
const colorValue = new Color(
|
|
24
|
+
const colorValue = new Color(color)
|
|
28
25
|
const colorNode: TSLNode = uniform(colorValue)
|
|
29
26
|
|
|
30
27
|
// Build TSL node once (references uniform by pointer)
|
|
31
28
|
const node = vec3(colorNode)
|
|
32
29
|
|
|
33
30
|
// Register in graph
|
|
34
|
-
graph.register(
|
|
31
|
+
graph.register(id, node, order, blend, opacity)
|
|
35
32
|
|
|
36
33
|
// Watch props to update uniform value (no recompilation)
|
|
37
34
|
watch(
|
|
38
|
-
() =>
|
|
35
|
+
() => color,
|
|
39
36
|
(hex) => {
|
|
40
37
|
colorValue.set(hex)
|
|
41
38
|
colorNode.value = colorValue
|
|
@@ -43,7 +40,7 @@
|
|
|
43
40
|
)
|
|
44
41
|
|
|
45
42
|
onUnmounted(() => {
|
|
46
|
-
graph.unregister(
|
|
43
|
+
graph.unregister(id)
|
|
47
44
|
})
|
|
48
45
|
</script>
|
|
49
46
|
|
|
@@ -8,34 +8,31 @@
|
|
|
8
8
|
} from '#layers/shader/app/shaders/common/noise'
|
|
9
9
|
import { add, mul, time, uniform, uv, vec2, vec3 } from 'three/tsl'
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
opacity: 1.0,
|
|
31
|
-
}
|
|
32
|
-
)
|
|
11
|
+
const {
|
|
12
|
+
id = 'noise',
|
|
13
|
+
type = 'simplex',
|
|
14
|
+
scale = 3.0,
|
|
15
|
+
speed = 0.2,
|
|
16
|
+
octaves = 4,
|
|
17
|
+
order = 0,
|
|
18
|
+
blend = 'normal',
|
|
19
|
+
opacity = 1.0,
|
|
20
|
+
} = defineProps<{
|
|
21
|
+
id?: string
|
|
22
|
+
type?: 'simplex' | 'fbm' | 'voronoi' | 'ridged' | 'fbm3d'
|
|
23
|
+
scale?: number
|
|
24
|
+
speed?: number
|
|
25
|
+
octaves?: number
|
|
26
|
+
order?: number
|
|
27
|
+
blend?: 'normal' | 'add' | 'multiply' | 'screen' | 'overlay' | 'mix'
|
|
28
|
+
opacity?: number
|
|
29
|
+
}>()
|
|
33
30
|
|
|
34
31
|
const graph = useShaderGraphContext()
|
|
35
32
|
|
|
36
33
|
// Create uniforms once
|
|
37
|
-
const uScale = uniform(
|
|
38
|
-
const uSpeed = uniform(
|
|
34
|
+
const uScale = uniform(scale)
|
|
35
|
+
const uSpeed = uniform(speed)
|
|
39
36
|
|
|
40
37
|
// Build TSL node
|
|
41
38
|
function buildNode() {
|
|
@@ -46,9 +43,9 @@
|
|
|
46
43
|
|
|
47
44
|
let noiseValue
|
|
48
45
|
|
|
49
|
-
switch (
|
|
46
|
+
switch (type) {
|
|
50
47
|
case 'fbm':
|
|
51
|
-
noiseValue = fbm2D(animatedUV, { octaves
|
|
48
|
+
noiseValue = fbm2D(animatedUV, { octaves, frequency: 1.0 }).mul(0.5).add(0.5)
|
|
52
49
|
break
|
|
53
50
|
case 'voronoi': {
|
|
54
51
|
const { distance } = voronoi2D(animatedUV, 1.0)
|
|
@@ -56,10 +53,10 @@
|
|
|
56
53
|
break
|
|
57
54
|
}
|
|
58
55
|
case 'ridged':
|
|
59
|
-
noiseValue = ridgedFbm2d(animatedUV, { octaves
|
|
56
|
+
noiseValue = ridgedFbm2d(animatedUV, { octaves, frequency: 1.0 })
|
|
60
57
|
break
|
|
61
58
|
case 'fbm3d':
|
|
62
|
-
noiseValue = fbm3dSimplex(vec3(scaledUV, t), { octaves
|
|
59
|
+
noiseValue = fbm3dSimplex(vec3(scaledUV, t), { octaves }).mul(0.5).add(0.5)
|
|
63
60
|
break
|
|
64
61
|
case 'simplex':
|
|
65
62
|
default:
|
|
@@ -71,17 +68,17 @@
|
|
|
71
68
|
}
|
|
72
69
|
|
|
73
70
|
const node = buildNode()
|
|
74
|
-
graph.register(
|
|
71
|
+
graph.register(id, node, order, blend, opacity)
|
|
75
72
|
|
|
76
73
|
// Watch uniform-driven props (no recompilation)
|
|
77
74
|
watch(
|
|
78
|
-
() =>
|
|
75
|
+
() => scale,
|
|
79
76
|
(v) => {
|
|
80
77
|
uScale.value = v
|
|
81
78
|
}
|
|
82
79
|
)
|
|
83
80
|
watch(
|
|
84
|
-
() =>
|
|
81
|
+
() => speed,
|
|
85
82
|
(v) => {
|
|
86
83
|
uSpeed.value = v
|
|
87
84
|
}
|
|
@@ -89,15 +86,15 @@
|
|
|
89
86
|
|
|
90
87
|
// Watch topology-changing props (requires graph update)
|
|
91
88
|
watch(
|
|
92
|
-
() => [
|
|
89
|
+
() => [type, octaves] as const,
|
|
93
90
|
() => {
|
|
94
91
|
const newNode = buildNode()
|
|
95
|
-
graph.update(
|
|
92
|
+
graph.update(id, newNode)
|
|
96
93
|
}
|
|
97
94
|
)
|
|
98
95
|
|
|
99
96
|
onUnmounted(() => {
|
|
100
|
-
graph.unregister(
|
|
97
|
+
graph.unregister(id)
|
|
101
98
|
})
|
|
102
99
|
</script>
|
|
103
100
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { Color
|
|
2
|
+
import { Color } from 'three'
|
|
3
3
|
import { clamp, float, mix, time, uniform, vec2, vec4 } from 'three/tsl'
|
|
4
4
|
|
|
5
5
|
import { fbm2D } from '../../shaders/common/noise'
|
|
6
|
+
import { hexToVec3Uniform } from '../../utils/tsl/color'
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Aurora borealis — layered animated colour bands across the upper screen.
|
|
@@ -32,13 +33,8 @@
|
|
|
32
33
|
order?: number
|
|
33
34
|
}>()
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return uniform(new Vector3(c.r, c.g, c.b))
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const colorANode = toVec3Node(colorA)
|
|
41
|
-
const colorBNode = toVec3Node(colorB)
|
|
36
|
+
const colorANode = hexToVec3Uniform(colorA)
|
|
37
|
+
const colorBNode = hexToVec3Uniform(colorB)
|
|
42
38
|
const bandYNode = uniform(bandY)
|
|
43
39
|
const bandHNode = uniform(bandHeight)
|
|
44
40
|
const speedNode = uniform(speed)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { Color
|
|
3
|
-
import { mix,
|
|
2
|
+
import { Color } from 'three'
|
|
3
|
+
import { mix, vec4 } from 'three/tsl'
|
|
4
|
+
|
|
5
|
+
import { hexToVec3Uniform } from '../../utils/tsl/color'
|
|
4
6
|
|
|
5
7
|
const {
|
|
6
8
|
bottomLeft = '#000000',
|
|
@@ -20,15 +22,10 @@
|
|
|
20
22
|
order?: number
|
|
21
23
|
}>()
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const blNode = toVec3Node(bottomLeft)
|
|
29
|
-
const brNode = toVec3Node(bottomRight)
|
|
30
|
-
const tlNode = toVec3Node(topLeft)
|
|
31
|
-
const trNode = toVec3Node(topRight)
|
|
25
|
+
const blNode = hexToVec3Uniform(bottomLeft)
|
|
26
|
+
const brNode = hexToVec3Uniform(bottomRight)
|
|
27
|
+
const tlNode = hexToVec3Uniform(topLeft)
|
|
28
|
+
const trNode = hexToVec3Uniform(topRight)
|
|
32
29
|
watch(
|
|
33
30
|
() => bottomLeft,
|
|
34
31
|
(v) => {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { Color
|
|
2
|
+
import { Color } from 'three'
|
|
3
3
|
import { float, mix, time, uniform, vec4 } from 'three/tsl'
|
|
4
4
|
|
|
5
5
|
import { turbulence2D } from '../../shaders/common/noise'
|
|
6
|
+
import { hexToVec3Uniform } from '../../utils/tsl/color'
|
|
6
7
|
|
|
7
8
|
/** Billow/turbulence noise — folded abs() of FBM, producing cloud-like forms. */
|
|
8
9
|
const {
|
|
@@ -19,13 +20,8 @@
|
|
|
19
20
|
order?: number
|
|
20
21
|
}>()
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return uniform(new Vector3(c.r, c.g, c.b))
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const colorANode = toVec3Node(colorA)
|
|
28
|
-
const colorBNode = toVec3Node(colorB)
|
|
23
|
+
const colorANode = hexToVec3Uniform(colorA)
|
|
24
|
+
const colorBNode = hexToVec3Uniform(colorB)
|
|
29
25
|
const scaleNode = uniform(scale)
|
|
30
26
|
const speedNode = uniform(speed)
|
|
31
27
|
watch(
|