release: WRNexusJS 0.5.14
This commit is contained in:
@@ -594,15 +594,15 @@ export const HMR_CLIENT_JS = `
|
||||
document.title = doc.title;
|
||||
}
|
||||
|
||||
["data-theme", "data-accent", "lang"].forEach(function (name) {
|
||||
var value = doc.documentElement.getAttribute(name);
|
||||
// HMR morphs only #app. Keep the live browser theme and accent because
|
||||
// they represent the user's current selection. Language remains SSR-owned.
|
||||
var nextLang = doc.documentElement.getAttribute("lang");
|
||||
|
||||
if (value == null) {
|
||||
document.documentElement.removeAttribute(name);
|
||||
} else {
|
||||
document.documentElement.setAttribute(name, value);
|
||||
}
|
||||
});
|
||||
if (nextLang == null) {
|
||||
document.documentElement.removeAttribute("lang");
|
||||
} else {
|
||||
document.documentElement.setAttribute("lang", nextLang);
|
||||
}
|
||||
|
||||
var from = document.getElementById("app");
|
||||
var to = doc.getElementById("app");
|
||||
@@ -620,6 +620,22 @@ export const HMR_CLIENT_JS = `
|
||||
if (window.__wrnexusHydrateCsrFetches) {
|
||||
window.__wrnexusHydrateCsrFetches(document);
|
||||
}
|
||||
|
||||
if (
|
||||
window.wireTheme &&
|
||||
typeof window.wireTheme.bind === "function"
|
||||
) {
|
||||
window.wireTheme.bind(document);
|
||||
}
|
||||
|
||||
window.dispatchEvent(
|
||||
new CustomEvent("wrnexus:hmr-updated", {
|
||||
detail: {
|
||||
theme: document.documentElement.getAttribute("data-theme"),
|
||||
accent: document.documentElement.getAttribute("data-accent"),
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
// Minimal index-based DOM morph: preserve matching nodes (keeps state/focus),
|
||||
|
||||
Reference in New Issue
Block a user