release: WRNexusJS 0.5.10

This commit is contained in:
2026-07-30 13:36:29 +05:30
parent 8fc6f15402
commit d1b0c55b53
159 changed files with 7509 additions and 604 deletions
+16 -1
View File
@@ -182,6 +182,15 @@ export interface BuildConfig {
adapter?: "bun" | "node" | "static" | "serverless" | "edge" | string;
}
export interface NavigationConfig {
/**
* `client` progressively enhances same-origin links with in-place page swaps.
* `document` keeps normal browser navigation so every route performs a fresh
* server-rendered document request.
*/
mode?: "client" | "document";
}
export interface AppConfig {
/** Compiler/dev/build plugins, resolved in deterministic pre/normal/post order. */
plugins?: PluginInput;
@@ -195,6 +204,8 @@ export interface AppConfig {
tenancy?: TenancyConfig;
/** Build cache, source map, report, and deployment adapter settings. */
build?: BuildConfig;
/** Page navigation strategy. Defaults to progressive client navigation. */
navigation?: NavigationConfig;
/** Development-only page diagnostics toolbar. Enabled by default in development. */
devToolbar?: boolean | DevToolbarConfig;
/** Raw HTML appended to every page's `<head>` (e.g. CDN stylesheet links). */
@@ -294,8 +305,12 @@ export async function loadRawConfig(appRoot: string): Promise<AppConfig> {
/** Load `wrnexus.config.*`, applying the active profile's overrides. */
export async function loadAppConfig(appRoot: string, profile?: string): Promise<AppConfig> {
const base = await loadRawConfig(appRoot);
const active = profile ?? resolveProfile();
// Configuration modules commonly read DATABASE_URL and other settings during
// module evaluation. Load the profile cascade before importing the module so
// development and production behave consistently.
loadEnv(appRoot, active);
const base = await loadRawConfig(appRoot);
const override = base.profiles?.[active];
const merged: AppConfig = override ? deepMerge(base, override) : { ...base };
delete merged.profiles;
+1
View File
@@ -15,6 +15,7 @@ export type {
ExplainedConfig,
ExperimentalConfig,
MobileConfig,
NavigationConfig,
ObservabilityConfig,
PerformanceConfig,
TenancyConfig,
+81 -21
View File
@@ -243,18 +243,18 @@ export const DEFAULT_THEMES: Record<string, ThemeTokens> = {
"color-error": "#dc2626",
radius: "8px",
"radius-sm": "5px",
"font-sans": "system-ui, -apple-system, Segoe UI, Roboto, sans-serif",
"font-sans": '"Plus Jakarta Sans",ui-sans-serif,system-ui,sans-serif',
"shadow-1": "0 1px 2px rgba(16,24,40,0.06), 0 1px 3px rgba(16,24,40,0.1)",
},
dark: {
"color-scheme": "dark",
"color-bg": "#0b1020",
"color-background": "#0b1020",
"color-foreground": "#e7ecff",
"color-surface-raised": "#1a223b",
"color-surface-muted": "#1c243f",
"color-text-muted": "#aab4d8",
"color-text-subtle": "#8995bd",
"color-bg": "#000000",
"color-background": "#000000",
"color-foreground": "#f5f5f5",
"color-surface-raised": "#111111",
"color-surface-muted": "#181818",
"color-text-muted": "#b3b3b3",
"color-text-subtle": "#8a8a8a",
"color-border-strong": "#ffffff38",
"color-primary-soft": "#6c8cff24",
"color-secondary-soft": "#a78bfa24",
@@ -262,10 +262,10 @@ export const DEFAULT_THEMES: Record<string, ThemeTokens> = {
"color-success-soft": "#4ade8024",
"color-warning-soft": "#fbbf2424",
"color-danger-soft": "#f8717124",
"color-code-background": "#060a15",
"color-code-surface": "#10172a",
"color-code-text": "#e7ecff",
"color-code-muted": "#9aa6d0",
"color-code-background": "#050505",
"color-code-surface": "#101010",
"color-code-text": "#f5f5f5",
"color-code-muted": "#a3a3a3",
"color-code-border": "#ffffff24",
"shadow-sm": "0 1px 2px rgba(0,0,0,0.28)",
"shadow-md": "0 10px 30px rgba(0,0,0,0.35)",
@@ -273,17 +273,17 @@ export const DEFAULT_THEMES: Record<string, ThemeTokens> = {
"space-section": "5rem",
"space-section-sm": "3.5rem",
"container-max": "80rem",
"color-surface": "#141a30",
"color-surface-2": "#1c243f",
"color-text": "#e7ecff",
"color-muted": "#9aa6d0",
"color-surface": "#0a0a0a",
"color-surface-2": "#171717",
"color-text": "#f5f5f5",
"color-muted": "#a3a3a3",
"color-border": "#ffffff1f",
"color-primary": "#6c8cff",
"color-primary-hover": "#8aa2ff",
"color-primary-contrast": "#0b1020",
"color-primary-contrast": "#000000",
"color-secondary": "#a78bfa",
"color-secondary-hover": "#c4b5fd",
"color-secondary-contrast": "#0b1020",
"color-secondary-contrast": "#000000",
"color-info": "#38bdf8",
"color-danger": "#f87171",
"color-success": "#4ade80",
@@ -291,7 +291,7 @@ export const DEFAULT_THEMES: Record<string, ThemeTokens> = {
"color-error": "#f87171",
radius: "10px",
"radius-sm": "6px",
"font-sans": "system-ui, -apple-system, Segoe UI, Roboto, sans-serif",
"font-sans": '"Plus Jakarta Sans",ui-sans-serif,system-ui,sans-serif',
"shadow-1": "0 1px 2px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.35)",
},
};
@@ -338,7 +338,10 @@ export function renderThemeCss(theme: ResolvedTheme): string {
for (const name of theme.names) {
blocks.push(`[data-theme="${name}"]{${tokensToDeclarations(theme.themes[name]!)}}`);
}
return blocks.join("\n") + "\n";
return (
blocks.join("\n") +
'\nhtml,body{font-family:var(--wire-font-sans,"Plus Jakarta Sans",ui-sans-serif,system-ui,sans-serif);}\n'
);
}
/**
@@ -351,14 +354,59 @@ export function renderThemeRuntime(theme: ResolvedTheme): string {
return `(function(){
var COOKIE=${JSON.stringify(THEME_COOKIE)};
var THEMES=${names};
var ACCENT_COOKIE="wire-accent";
var COOKIE_MAX_AGE=31536000;
var ACCENTS={
blue:["#2563eb","#1d4ed8","#ffffff"],
cyan:["#0891b2","#0e7490","#ffffff"],
emerald:["#059669","#047857","#ffffff"],
violet:["#7c3aed","#6d28d9","#ffffff"],
rose:["#e11d48","#be123c","#ffffff"],
amber:["#d97706","#b45309","#ffffff"]
};
var el=document.documentElement;
function readCookie(name){
var prefix=encodeURIComponent(name)+"=";
var parts=document.cookie?document.cookie.split(";"):[];
for(var i=0;i<parts.length;i++){
var part=parts[i].trim();
if(part.indexOf(prefix)===0){
try{return decodeURIComponent(part.slice(prefix.length));}catch(_){return part.slice(prefix.length);}
}
}
return null;
}
function writeCookie(name,value){
var secure=location.protocol==="https:"?";secure":"";
document.cookie=encodeURIComponent(name)+"="+encodeURIComponent(value)+";path=/;max-age="+COOKIE_MAX_AGE+";samesite=lax"+secure;
}
function get(){return el.getAttribute("data-theme")||${JSON.stringify(theme.default)};}
function syncThemeButtons(root){
(root||document).querySelectorAll("[data-wire-theme-set]").forEach(function(n){
n.setAttribute("aria-pressed",String(n.getAttribute("data-wire-theme-set")===get()));
});
}
function syncAccentButtons(root,name){
(root||document).querySelectorAll("[data-wire-accent-set]").forEach(function(n){
n.setAttribute("aria-pressed",String(n.getAttribute("data-wire-accent-set")===name));
});
}
function set(name){
if(THEMES.indexOf(name)<0)return;
el.setAttribute("data-theme",name);
document.cookie=COOKIE+"="+encodeURIComponent(name)+";path=/;max-age=31536000;samesite=lax";
writeCookie(COOKIE,name);
syncThemeButtons(document);
}
function toggle(){var i=THEMES.indexOf(get());set(THEMES[(i+1)%THEMES.length]);}
function setAccent(name){
var value=ACCENTS[name];if(!value)return;
el.style.setProperty("--wire-color-primary",value[0]);
el.style.setProperty("--wire-color-primary-hover",value[1]);
el.style.setProperty("--wire-color-primary-contrast",value[2]);
el.setAttribute("data-accent",name);
writeCookie(ACCENT_COOKIE,name);
syncAccentButtons(document,name);
}
function bind(root){
(root||document).querySelectorAll("[data-wire-theme-toggle]").forEach(function(n){
if(n.__wireThemeBound)return;n.__wireThemeBound=1;
@@ -368,8 +416,20 @@ export function renderThemeRuntime(theme: ResolvedTheme): string {
if(n.__wireThemeBound)return;n.__wireThemeBound=1;
n.addEventListener("click",function(){set(n.getAttribute("data-wire-theme-set"));});
});
(root||document).querySelectorAll("[data-wire-accent-set]").forEach(function(n){
if(n.__wireAccentBound)return;n.__wireAccentBound=1;
n.addEventListener("click",function(){setAccent(n.getAttribute("data-wire-accent-set"));});
});
syncThemeButtons(root);
syncAccentButtons(root,el.getAttribute("data-accent")||"blue");
}
function getAccent(){
var current=el.getAttribute("data-accent")||readCookie(ACCENT_COOKIE)||"blue";
return ACCENTS[current]?current:"blue";
}
window.wireTheme={get:get,set:set,toggle:toggle,bind:bind,themes:THEMES};
window.wireAccent={get:getAccent,set:setAccent,colors:Object.keys(ACCENTS)};
setAccent(getAccent());
window.addEventListener("wrnexus:navigated",function(){bind(document);});
if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",function(){bind(document);});
else bind(document);