fix(styles): persist accent cookies on localhost
Quality / quality (ubuntu-latest) (push) Failing after 10m41s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-12 21:28:18 +05:30
parent dd9b7a289a
commit a0dab308f0
4 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -588,7 +588,7 @@
},
"packages/styles": {
"name": "@wrnexus/styles",
"version": "0.8.10",
"version": "0.8.14",
"dependencies": {
"@wrnexus/core": "workspace:*",
"@wrnexus/plugin": "workspace:*",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/styles",
"version": "0.8.13",
"version": "0.8.14",
"type": "module",
"main": "src/index.ts",
"exports": {
+6 -1
View File
@@ -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;
}
@@ -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");
});
});