diff --git a/bun.lock b/bun.lock index 16b5366e..8266229d 100644 --- a/bun.lock +++ b/bun.lock @@ -588,7 +588,7 @@ }, "packages/styles": { "name": "@wrnexus/styles", - "version": "0.8.10", + "version": "0.8.14", "dependencies": { "@wrnexus/core": "workspace:*", "@wrnexus/plugin": "workspace:*", diff --git a/packages/styles/package.json b/packages/styles/package.json index 1d7221c5..cfaf7948 100644 --- a/packages/styles/package.json +++ b/packages/styles/package.json @@ -1,6 +1,6 @@ { "name": "@wrnexus/styles", - "version": "0.8.13", + "version": "0.8.14", "type": "module", "main": "src/index.ts", "exports": { diff --git a/packages/styles/src/theme.ts b/packages/styles/src/theme.ts index b226591e..dd4380fc 100644 --- a/packages/styles/src/theme.ts +++ b/packages/styles/src/theme.ts @@ -667,7 +667,12 @@ export function renderThemeRuntime(theme: ResolvedTheme): string { options=options||{}; var path=options.path||"/"; var sameSite=options.sameSite||"Lax"; - var domain=options.domain?";domain="+options.domain:""; + // localhost is not a registrable parent domain. Some browsers reject a + // Domain=localhost cookie entirely, so keep it host-only in local dev. + var configuredDomain=options.domain; + var domain=configuredDomain&&configuredDomain!=="localhost" + ?";domain="+configuredDomain + :""; var secure=options.secure===true||(options.secure!==false&&location.protocol==="https:")?";secure":""; return ";path="+path+";samesite="+sameSite+domain+secure; } diff --git a/packages/styles/test/theme-accent.test.ts b/packages/styles/test/theme-accent.test.ts index 003d1e9c..2cf1cd3f 100644 --- a/packages/styles/test/theme-accent.test.ts +++ b/packages/styles/test/theme-accent.test.ts @@ -58,6 +58,7 @@ describe("theme accents", () => { expect(runtime).toContain('"domain":"localhost"'); expect(runtime).toContain("deleteCookie(ACCENT_COOKIE);"); expect(runtime).toContain("writeCookie(ACCENT_COOKIE,name,ACCENT_COOKIE_OPTIONS)"); + expect(runtime).toContain('configuredDomain!=="localhost"'); expect(runtime).not.toContain("setInterval(syncSharedAccent"); }); });