From 751992229de5e53d54d6eaa1f70b4a5212d41e7a Mon Sep 17 00:00:00 2001 From: Hubert Bieszczad Date: Fri, 24 Jan 2025 07:39:31 +0100 Subject: [PATCH] fix: nested array styles on the web --- src/core/getClassname.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/getClassname.ts b/src/core/getClassname.ts index f48059b1..59278fd3 100644 --- a/src/core/getClassname.ts +++ b/src/core/getClassname.ts @@ -1,13 +1,14 @@ -import type { UnistylesValues } from '../types'; -import { UnistylesShadowRegistry } from '../web'; +import type { UnistylesValues } from '../types' +import { UnistylesWeb } from '../web' export const getClassName = (unistyle: UnistylesValues | undefined | Array) => { if (!unistyle) { return undefined } - // @ts-expect-error hidden from TS - const { hash, injectedClassName } = UnistylesShadowRegistry.addStyles(Array.isArray(unistyle) ? unistyle : [unistyle]) + const { hash, injectedClassName } = UnistylesWeb.shadowRegistry.addStyles( + Array.isArray(unistyle) ? unistyle.flat(Number.POSITIVE_INFINITY) : [unistyle] + ) return hash ? { $$css: true, hash, injectedClassName } : undefined }