From 8438e121134abd77badd600d30197d9e369eb13e Mon Sep 17 00:00:00 2001 From: Tamago Date: Mon, 18 Nov 2024 10:17:35 +0800 Subject: [PATCH] chore: mv server check in useStyle --- packages/core/src/composables/use-layout.ts | 3 --- packages/core/src/composables/use-style.ts | 7 +++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/core/src/composables/use-layout.ts b/packages/core/src/composables/use-layout.ts index 3fdf029..a028ab2 100644 --- a/packages/core/src/composables/use-layout.ts +++ b/packages/core/src/composables/use-layout.ts @@ -34,9 +34,6 @@ const STYLE_INCLUDES = [ ] export function useLayout(target: MaybeRef, options: MaybeRef, ctx?: HeroContext) { - if (import.meta.server) - return - let motionInstance: any const bounding: Record = { x: 0, y: 0, width: 0, height: 0 } diff --git a/packages/core/src/composables/use-style.ts b/packages/core/src/composables/use-style.ts index b5d1d1c..9176b71 100644 --- a/packages/core/src/composables/use-style.ts +++ b/packages/core/src/composables/use-style.ts @@ -40,10 +40,13 @@ function useTransform(target: PermissiveTarget) { } export function useStyle(target: PermissiveTarget, options: UseStyleOptions = {}) { - let observer: MutationObserver + const transform = ref>({}) + + if (import.meta.server) + return { transform } + let observer: MutationObserver const domRef = toRef(target) - const transform = ref>({}) if (domRef.value) transform.value = useTransform(domRef).value