docs: update portal for WRNexusJS 0.8.0

This commit is contained in:
2026-08-02 23:57:41 +05:30
parent 9366895f78
commit 8d5d4b8f12
183 changed files with 14433 additions and 2492 deletions
+72 -8
View File
@@ -10,11 +10,18 @@ page wrnexusstyles {
<header class="topbar">
<a class="brand" href="/"><span>W</span> WRNexusJS</a>
<nav aria-label="Primary"><a href="/getting-started">Get started</a><a href="/packages">Packages</a><a href="https://component.wrnexusjs.dev/">Components</a><a href="/language">Language</a><a href="/architecture">Architecture</a></nav>
<div class="topbar-actions"><a class="preview-pill" href="/access">Private preview · v0.7.0</a><button data-wire-theme-toggle class="theme-button" aria-label="Toggle color theme" title="Toggle color theme">◐</button></div>
<div class="topbar-actions"><a class="preview-pill" href="/access">Private preview · v0.8.0</a><button data-wire-theme-toggle class="theme-button" aria-label="Toggle color theme" title="Toggle color theme">◐</button></div>
</header>
<div class="mobile-doc-nav"><details><summary>Browse documentation</summary><nav><a href="/getting-started">Get started</a><a href="/packages">Packages</a><a href="https://component.wrnexusjs.dev/">Components</a><a href="/language">Language</a><a href="/architecture">Architecture</a><a href="/tutorial">Tutorial</a><a href="/guides/project-structure">Guides</a><a href="/examples">Examples</a><a href="/search">Search</a></nav></details></div>
<main class="portal-main docs-layout">
<article id="main" class="documentation prose standalone package-document"><nav class="breadcrumbs" aria-label="Breadcrumb"><a href="/">Home</a><span>/</span><a href="/packages">Packages</a><span>/</span><span aria-current="page">@wrnexus/styles</span></nav><section class="doc-intro"><span class="eyebrow">Frontend · Package reference</span><h1>@wrnexus/styles</h1><p>CSS pipeline, themes, fonts, profiles, and application config.</p><div class="doc-meta"><span>v0.7.0</span><span>Private registry</span><span>Frontend</span></div><section id="access" class="access-callout"><h2>Install the package</h2><p>After WorkRoot approves private registry access, install the release-aligned package:</p><pre><code>bun add @wrnexus/styles@0.7.0</code><button type="button" class="copy-button" aria-label="Copy installation command">Copy</button></pre><p><a href="/access">Request preview access</a>. Never put registry tokens in source control.</p></section></section><section id="guide"><blockquote>Global CSS bundling, the <code>--wire-*</code> design-token theme system, and the <code>wrnexus.config.ts</code> app-config loader for WRNexusJS apps.</blockquote>
<article id="main" class="documentation prose standalone package-document"><nav class="breadcrumbs" aria-label="Breadcrumb"><a href="/">Home</a><span>/</span><a href="/packages">Packages</a><span>/</span><span aria-current="page">@wrnexus/styles</span></nav><section class="doc-intro"><span class="eyebrow">Frontend · Package reference</span><h1>@wrnexus/styles</h1><p>CSS pipeline, themes, fonts, profiles, and application config.</p><div class="doc-meta"><span>v0.8.0</span><span>Private registry</span><span>Frontend</span></div><section id="access" class="access-callout"><h2>Install the package</h2><p>After WorkRoot approves private registry access, install the release-aligned package:</p><pre><code>bun add @wrnexus/styles@0.8.0</code><button type="button" class="copy-button" aria-label="Copy installation command">Copy</button></pre><p><a href="/access">Request preview access</a>. Never put registry tokens in source control.</p></section></section><section id="guide"><h3 id="reusable-layers-and-presets">Reusable layers and presets</h3>
<p>Compose local or package foundations in order; later layers override earlier ones and the application has final base-config precedence:</p>
<pre data-language="ts"><code>export default defineConfig(&#123;
extends: [&quot;@workroot/wrnexus-enterprise&quot;, &quot;./layers/company&quot;],
profiles: &#123; production: &#123; port: 8080 &#125; &#125;,
&#125;);</code></pre>
<p>A directory layer exports <code>wrnexus.layer.ts</code> (JavaScript/MJS are supported). A package can provide that conventional file or declare <code>wrnexus.layer</code> in its <code>package.json</code>. Layers may extend other layers and carry the complete app configuration, including plugins that contribute layouts, components, routes, middleware, and migrations. <code>plugins</code> and <code>head</code> compose; other arrays intentionally replace earlier values. Cycles and missing/invalid entries fail with stable <code>WRN-CONFIG-LAYER-*</code> diagnostics. <code>wrnexus config --explain</code> lists every resolved layer source.</p>
<blockquote>Global CSS bundling, the <code>--wire-*</code> design-token theme system, and the <code>wrnexus.config.ts</code> app-config loader for WRNexusJS apps.</blockquote>
<p>Part of the <strong>WRNexusJS</strong> framework — an SSR-first, Bun-native full-stack web framework.</p>
<h3 id="overview">Overview</h3>
<p>This package owns three server-side concerns that shape every page a WRNexusJS app renders:</p>
@@ -176,7 +183,7 @@ const themeJs = renderThemeRuntime(theme); // served at THEME_JS_HREF</code></pr
<li>Peer package: <code>@wrnexus/core</code> supplies the <code>SeoConfig</code> and <code>SecurityConfig</code> types referenced by <code>AppConfig</code>.</li>
<li>The bundled global stylesheet, the theme stylesheet (<code>THEME_CSS_HREF</code>), and the theme runtime (<code>THEME_JS_HREF</code>) are wired into pages by the framework's server; this package only produces their contents.</li>
</ul></section><section id="api" class="api"><h2>Complete TypeScript API</h2><p>Generated from the exact installed package declarations.</p><pre data-language="typescript"><code>import &#123; PerformanceBudgets, SeoConfig, SecurityConfig &#125; from '@wrnexus/core';
import &#123; PluginInput &#125; from '@wrnexus/plugin';
import &#123; PluginInput, PluginPermission &#125; from '@wrnexus/plugin';
import &#123; StorageConfig &#125; from '@wrnexus/uploader';
/**
@@ -191,7 +198,12 @@ import &#123; StorageConfig &#125; from '@wrnexus/uploader';
* present before the first paint. The reserved token key `color-scheme` is
* emitted as the native CSS property instead of a custom property.
*/
type ThemeTokens = Record&lt;string, string&gt;;
type ThemeSemanticColor = &quot;primary&quot; | &quot;secondary&quot; | &quot;info&quot; | &quot;success&quot; | &quot;warning&quot; | &quot;danger&quot; | &quot;error&quot;;
type ThemeToken = &quot;color-scheme&quot; | &quot;color-bg&quot; | &quot;color-background&quot; | &quot;color-foreground&quot; | &quot;color-surface&quot; | &quot;color-surface-2&quot; | &quot;color-surface-raised&quot; | &quot;color-surface-muted&quot; | &quot;color-text&quot; | &quot;color-text-muted&quot; | &quot;color-text-subtle&quot; | &quot;color-muted&quot; | &quot;color-border&quot; | &quot;color-border-strong&quot; | &quot;color-code-background&quot; | &quot;color-code-surface&quot; | &quot;color-code-text&quot; | &quot;color-code-muted&quot; | &quot;color-code-border&quot; | `color-$&#123;ThemeSemanticColor&#125;` | `color-$&#123;ThemeSemanticColor&#125;-$&#123;&quot;hover&quot; | &quot;active&quot; | &quot;contrast&quot; | &quot;soft&quot; | &quot;muted&quot; | &quot;text&quot;&#125;` | `color-on-$&#123;&quot;primary&quot; | &quot;secondary&quot;&#125;` | &quot;radius&quot; | &quot;radius-sm&quot; | &quot;shadow-1&quot; | &quot;shadow-sm&quot; | &quot;shadow-md&quot; | &quot;shadow-lg&quot; | &quot;space-section&quot; | &quot;space-section-sm&quot; | &quot;container-max&quot; | &quot;font-sans&quot;;
/** Known tokens get autocomplete while applications may add namespaced custom tokens. */
type ThemeTokens = Partial&lt;Record&lt;ThemeToken, string&gt;&gt; &amp; Record&lt;string, string&gt;;
declare function defineThemeTokens&lt;T extends ThemeTokens&gt;(tokens: T): T;
declare function themeVar(token: ThemeToken, fallback?: string): string;
declare const THEME_PALETTE_NAMES: readonly [&quot;blue&quot;, &quot;indigo&quot;, &quot;violet&quot;, &quot;emerald&quot;, &quot;cyan&quot;, &quot;rose&quot;, &quot;amber&quot;, &quot;slate&quot;];
type ThemePaletteName = (typeof THEME_PALETTE_NAMES)[number];
/** Required semantic colors for a custom application palette. */
@@ -345,6 +357,26 @@ declare function fontCspSources(fonts?: FontConfig): &#123;
font: string[];
&#125;;
declare const CURRENT_COMPATIBILITY_DATE = &quot;2026-08-02&quot;;
declare const CURRENT_FRAMEWORK_BEHAVIOUR = 1;
interface CompatibilityPolicy &#123;
compatibilityDate?: string;
frameworkBehaviour?: number;
&#125;
interface CompatibilityReport &#123;
configuredDate?: string;
effectiveDate: string;
currentDate: string;
configuredBehaviour?: number;
effectiveBehaviour: number;
currentBehaviour: number;
needsUpgrade: boolean;
future: boolean;
messages: string[];
&#125;
declare function isCompatibilityDate(value: string): boolean;
declare function resolveCompatibility(policy: CompatibilityPolicy): CompatibilityReport;
/**
* App configuration loader (`wrnexus.config.ts`).
*
@@ -453,6 +485,15 @@ interface PwaConfig &#123;
cacheUrls?: string[];
/** Service-worker cache key. Change it to invalidate existing PWA caches. */
cacheName?: string;
/** Ordered URL rules for runtime caching. Patterns are regular-expression source strings. */
runtimeCaching?: Array&lt;&#123;
pattern: string;
strategy: &quot;network-first&quot; | &quot;cache-first&quot; | &quot;stale-while-revalidate&quot;;
cacheName?: string;
methods?: string[];
&#125;&gt;;
/** Background Sync tag used by the offline mutation queue. */
backgroundSyncTag?: string;
&#125;
type DevToolbarPosition = &quot;bottom-center&quot; | &quot;bottom-left&quot; | &quot;bottom-right&quot;;
interface DevToolbarConfig &#123;
@@ -548,9 +589,16 @@ interface CompatibilityConfig &#123;
legacyComponentDiscovery?: boolean;
stringLayouts?: boolean;
&#125;
interface AppConfig &#123;
interface AppConfig extends CompatibilityPolicy &#123;
/** Ordered reusable configuration layers; the application always has final precedence. */
extends?: string | string[];
/** Compiler/dev/build plugins, resolved in deterministic pre/normal/post order. */
plugins?: PluginInput;
/** Optional least-privilege enforcement for automatically discovered packages. */
pluginPermissions?: &#123;
enforce?: boolean;
grants?: Record&lt;string, PluginPermission[]&gt;;
&#125;;
/** WRN v0.6 explicit import and compatibility resolution. */
imports?: ImportsConfig;
/** TypeScript-backed .wrn type checking and declaration generation. */
@@ -598,6 +646,17 @@ interface AppConfig &#123;
i18n?: &#123;
default?: string;
locales?: string[];
labels?: Record&lt;string, string&gt;;
fallbacks?: Record&lt;string, string[]&gt;;
direction?: Record&lt;string, &quot;ltr&quot; | &quot;rtl&quot;&gt;;
cookie?: &#123;
name?: string;
maxAge?: number;
path?: string;
sameSite?: &quot;Strict&quot; | &quot;Lax&quot; | &quot;None&quot;;
secure?: boolean;
&#125;;
strict?: boolean;
&#125;;
/** Default database connection (driver + url); reached with `getDb()`. */
db?: &#123;
@@ -647,6 +706,11 @@ declare function resolveProfile(options?: &#123;
explicit?: string;
mode?: Mode;
&#125;): string;
interface ResolvedConfigLayers &#123;
config: AppConfig;
sources: string[];
&#125;
declare function resolveConfigLayers(appRoot: string, application: AppConfig): Promise&lt;ResolvedConfigLayers&gt;;
/** Load the raw `wrnexus.config.*` (with the `profiles` map intact), or `&#123;&#125;`. */
declare function loadRawConfig(appRoot: string): Promise&lt;AppConfig&gt;;
/** Load `wrnexus.config.*`, applying the active profile's overrides. */
@@ -746,7 +810,7 @@ declare function auditCssPerformance(source: string): CssPerformanceAuditIssue[]
*/
declare function renderStyles(ctx: StyleProcessContext, styles?: StylesConfig): Promise&lt;string&gt;;
export &#123; ACCENT_COOKIE, type AppConfig, type BuildConfig, type ConfigIssue, type ContrastResult, type CssPerformanceAuditIssue, type CssTokenAudit, type CustomThemePalette, DEFAULT_THEMES, type DevToolbarConfig, type ExperimentalConfig, type ExplainedConfig, type FontConfig, type FontDisplay, type GoogleFont, type LocalFontFace, type MobileConfig, type Mode, type NavigationConfig, type ObservabilityConfig, type PerformanceConfig, type PwaConfig, type ResolvedTheme, type StyleProcessContext, type StyleSource, type StylesConfig, type Mode as StylesMode, THEME_COOKIE, THEME_CSS_HREF, THEME_JS_HREF, THEME_PALETTES, THEME_PALETTE_NAMES, type TenancyConfig, type ThemeAccentConfig, type ThemeConfig, type ThemePaletteName, type ThemeTokens, auditCssPerformance, auditWireTokens, bundleCss, contrast, defineConfig, explainAppConfig, findStyleEntry, fontCspSources, headToString, loadAppConfig, loadEnv, loadRawConfig, normalizeStyleSources, renderFontHead, renderProductionFontHead, renderStyles, renderThemeCss, renderThemeRuntime, resolveAccentName, resolveProfile, resolveThemeConfig, resolveThemeName, tailwindSourceDirectives, validateAppConfig &#125;;
export &#123; ACCENT_COOKIE, type AppConfig, type BuildConfig, CURRENT_COMPATIBILITY_DATE, CURRENT_FRAMEWORK_BEHAVIOUR, type CompatibilityPolicy, type CompatibilityReport, type ConfigIssue, type ContrastResult, type CssPerformanceAuditIssue, type CssTokenAudit, type CustomThemePalette, DEFAULT_THEMES, type DevToolbarConfig, type ExperimentalConfig, type ExplainedConfig, type FontConfig, type FontDisplay, type GoogleFont, type LocalFontFace, type MobileConfig, type Mode, type NavigationConfig, type ObservabilityConfig, type PerformanceConfig, type PwaConfig, type ResolvedConfigLayers, type ResolvedTheme, type StyleProcessContext, type StyleSource, type StylesConfig, type Mode as StylesMode, THEME_COOKIE, THEME_CSS_HREF, THEME_JS_HREF, THEME_PALETTES, THEME_PALETTE_NAMES, type TenancyConfig, type ThemeAccentConfig, type ThemeConfig, type ThemePaletteName, type ThemeSemanticColor, type ThemeToken, type ThemeTokens, auditCssPerformance, auditWireTokens, bundleCss, contrast, defineConfig, defineThemeTokens, explainAppConfig, findStyleEntry, fontCspSources, headToString, isCompatibilityDate, loadAppConfig, loadEnv, loadRawConfig, normalizeStyleSources, renderFontHead, renderProductionFontHead, renderStyles, renderThemeCss, renderThemeRuntime, resolveAccentName, resolveCompatibility, resolveConfigLayers, resolveProfile, resolveThemeConfig, resolveThemeName, tailwindSourceDirectives, themeVar, validateAppConfig &#125;;
</code></pre></section><section id="examples" class="examples"><h2>Examples</h2><p>Copy-ready examples from the installed package documentation.</p><div class="example-grid"><article class="example-card"><h3>wrnexus.config.ts</h3><pre data-language="ts"><code>import type &#123; AppConfig &#125; from &quot;@wrnexus/styles&quot;;
export default &#123;
@@ -817,9 +881,9 @@ const themeJs = renderThemeRuntime(theme); // served at THEME_JS_HREF</code></pr
box-shadow: var(--wire-shadow-1);
&#125;</code></pre></article><article class="example-card"><h3>Rendering the theme</h3><pre data-language="html"><code>&lt;button data-wire-theme-toggle&gt;Toggle theme&lt;/button&gt;
&lt;button data-wire-theme-set=&quot;brand&quot;&gt;Brand theme&lt;/button&gt;</code></pre></article></div></section></article>
<aside class="on-this-page"><h2>On this page</h2><nav><a class="toc-level-2" href="#guide">Guide</a><a class="toc-level-3" href="#overview">Overview</a><a class="toc-level-3" href="#api">API</a><a class="toc-level-4" href="#config-loading">Config loading</a><a class="toc-level-4" href="#appconfig">AppConfig</a><a class="toc-level-4" href="#styles-pipeline">Styles pipeline</a><a class="toc-level-4" href="#theme-system">Theme system</a><a class="toc-level-3" href="#usage">Usage</a><a class="toc-level-4" href="#wrnexus-config-ts">wrnexus.config.ts</a><a class="toc-level-4" href="#loading-config-producing-css">Loading config + producing CSS</a><a class="toc-level-4" href="#rendering-the-theme">Rendering the theme</a><a class="toc-level-3" href="#requirements-notes">Requirements / Notes</a><a class="toc-level-2" href="#api">Complete API</a><a class="toc-level-2" href="#examples">Examples</a></nav></aside>
<aside class="on-this-page"><h2>On this page</h2><nav><a class="toc-level-2" href="#guide">Guide</a><a class="toc-level-3" href="#reusable-layers-and-presets">Reusable layers and presets</a><a class="toc-level-3" href="#overview">Overview</a><a class="toc-level-3" href="#api">API</a><a class="toc-level-4" href="#config-loading">Config loading</a><a class="toc-level-4" href="#appconfig">AppConfig</a><a class="toc-level-4" href="#styles-pipeline">Styles pipeline</a><a class="toc-level-4" href="#theme-system">Theme system</a><a class="toc-level-3" href="#usage">Usage</a><a class="toc-level-4" href="#wrnexus-config-ts">wrnexus.config.ts</a><a class="toc-level-4" href="#loading-config-producing-css">Loading config + producing CSS</a><a class="toc-level-4" href="#rendering-the-theme">Rendering the theme</a><a class="toc-level-3" href="#requirements-notes">Requirements / Notes</a><a class="toc-level-2" href="#api">Complete API</a><a class="toc-level-2" href="#examples">Examples</a></nav></aside>
</main>
<footer><div class="footer-brand"><span class="footer-mark" aria-hidden="true">W</span><p><strong>WRNexusJS 0.7.0</strong><span>Complete API documentation generated from installed package declarations.</span></p></div><nav aria-label="Footer"><a href="/packages">All packages</a><a href="/getting-started">Get started</a><a href="/security">Security</a><a href="/support">Support</a><a href="/llms.txt">AI guide</a></nav><p class="footer-meta">Private Developer Preview · Bun-native</p></footer>
<footer><div class="footer-brand"><span class="footer-mark" aria-hidden="true">W</span><p><strong>WRNexusJS 0.8.0</strong><span>Complete API documentation generated from installed package declarations.</span></p></div><nav aria-label="Footer"><a href="/packages">All packages</a><a href="/getting-started">Get started</a><a href="/security">Security</a><a href="/support">Support</a><a href="/llms.txt">AI guide</a></nav><p class="footer-meta">Private Developer Preview · Bun-native</p></footer>
<BackToTop />
</div>
}