create-coralite 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/agent/AGENTS.md +1 -1
- package/templates/css/AGENTS.md +1 -1
- package/templates/css/package.json +1 -1
- package/templates/plugin/AGENTS.md +1 -1
- package/templates/plugin/package.json +1 -1
- package/templates/scss/AGENTS.md +1 -1
- package/templates/scss/package.json +1 -1
package/package.json
CHANGED
|
@@ -220,7 +220,7 @@ Top-level imports are reserved for `definePage` / `definePlugin` and modules use
|
|
|
220
220
|
The opt-in router plugin (`coralite/plugins/router`) provides single-page application navigation. Register it in `coralite.config.js` under `plugins` (`plugins: [router({ ... })]`). Registration gates ALL SPA behavior — without it, every SPA navigation behavior (link interception, popstate, guards, head reconciliation) is inert: a `data-router-outlet` marker alone does nothing, and the page behaves as a standard multi-page app.
|
|
221
221
|
|
|
222
222
|
- **Outlets**: Any element carrying the outlet attribute (default `data-router-outlet`) or the reserved `<router-outlet>` tag is an outlet. Every SPA-routed page MUST have an outlet or client navigation fails; outlet-less pages are auto-wrapped by default. Set `autoWrap: false` to disable automatic body wrapping; outlet-less pages then render as authored and still resolve tokens normally. Set `outletOnly: true` to skip link interception when the live document has no outlet, so those clicks use native browser navigation. `router.navigate()` is NOT affected by `outletOnly` and still updates history before failing if no outlet exists, so do not call it from outlet-less pages. Everything outside the outlet (navbar, background audio, open sockets) is never touched by the router — those component instances and their state persist across every route swap.
|
|
223
|
-
- **Client API**: `client({ router })` injects the router: `navigate(path, { replace })`, `current()`, `beforeEach(guard)` (returns the unregister function), and the `viewTransitions` getter. Also available on `window.
|
|
223
|
+
- **Client API**: `client({ router })` injects the router: `navigate(path, { replace })`, `current()`, `beforeEach(guard)` (returns the unregister function), and the `viewTransitions` getter. Also available on `window.__coralite__.plugins.router`.
|
|
224
224
|
- **Guards**: `beforeEach` guards may return `true`/`undefined` (allow), `false` (block), a relative or same-origin path (soft redirect; redirect chains are capped at depth 10), or an `http(s)` URL (hard redirect via `window.location.replace()`).
|
|
225
225
|
- **Guard placement**: The guard list lives in the router's client-init scope and PERSISTS across the whole SPA session — an outlet swap does not reset it, and nothing auto-unregisters a guard when its route leaves. App-wide guards (auth, redirects) MUST be registered in a persistent shell component OUTSIDE the outlet (it connects once, so the guard registers exactly once). Route-scoped guards MUST capture the function returned by `beforeEach` and call it on their component `signal` abort. Registering guards inside a route component's `client()` without unregistering accumulates one extra guard per visit.
|
|
226
226
|
- **State scoping**: Component `state` is route-scoped — on navigation the old outlet is disconnected (its `signal` aborts), and the new route hydrates from its pre-built HTML, so `state` mutations are lost when the route leaves. App-scoped state belongs in the global `store` (declared in `coralite.config.js`), which the router never touches and which survives every swap. Release imperative resources a component allocates (workers, canvas/WebGL contexts, external library handles) when the component is torn down — hook teardown to the `signal` `abort` event.
|
package/templates/css/AGENTS.md
CHANGED
|
@@ -220,7 +220,7 @@ Top-level imports are reserved for `definePage` / `definePlugin` and modules use
|
|
|
220
220
|
The opt-in router plugin (`coralite/plugins/router`) provides single-page application navigation. Register it in `coralite.config.js` under `plugins` (`plugins: [router({ ... })]`). Registration gates ALL SPA behavior — without it, every SPA navigation behavior (link interception, popstate, guards, head reconciliation) is inert: a `data-router-outlet` marker alone does nothing, and the page behaves as a standard multi-page app.
|
|
221
221
|
|
|
222
222
|
- **Outlets**: Any element carrying the outlet attribute (default `data-router-outlet`) or the reserved `<router-outlet>` tag is an outlet. Every SPA-routed page MUST have an outlet or client navigation fails; outlet-less pages are auto-wrapped by default. Set `autoWrap: false` to disable automatic body wrapping; outlet-less pages then render as authored and still resolve tokens normally. Set `outletOnly: true` to skip link interception when the live document has no outlet, so those clicks use native browser navigation. `router.navigate()` is NOT affected by `outletOnly` and still updates history before failing if no outlet exists, so do not call it from outlet-less pages. Everything outside the outlet (navbar, background audio, open sockets) is never touched by the router — those component instances and their state persist across every route swap.
|
|
223
|
-
- **Client API**: `client({ router })` injects the router: `navigate(path, { replace })`, `current()`, `beforeEach(guard)` (returns the unregister function), and the `viewTransitions` getter. Also available on `window.
|
|
223
|
+
- **Client API**: `client({ router })` injects the router: `navigate(path, { replace })`, `current()`, `beforeEach(guard)` (returns the unregister function), and the `viewTransitions` getter. Also available on `window.__coralite__.plugins.router`.
|
|
224
224
|
- **Guards**: `beforeEach` guards may return `true`/`undefined` (allow), `false` (block), a relative or same-origin path (soft redirect; redirect chains are capped at depth 10), or an `http(s)` URL (hard redirect via `window.location.replace()`).
|
|
225
225
|
- **Guard placement**: The guard list lives in the router's client-init scope and PERSISTS across the whole SPA session — an outlet swap does not reset it, and nothing auto-unregisters a guard when its route leaves. App-wide guards (auth, redirects) MUST be registered in a persistent shell component OUTSIDE the outlet (it connects once, so the guard registers exactly once). Route-scoped guards MUST capture the function returned by `beforeEach` and call it on their component `signal` abort. Registering guards inside a route component's `client()` without unregistering accumulates one extra guard per visit.
|
|
226
226
|
- **State scoping**: Component `state` is route-scoped — on navigation the old outlet is disconnected (its `signal` aborts), and the new route hydrates from its pre-built HTML, so `state` mutations are lost when the route leaves. App-scoped state belongs in the global `store` (declared in `coralite.config.js`), which the router never touches and which survives every swap. Release imperative resources a component allocates (workers, canvas/WebGL contexts, external library handles) when the component is torn down — hook teardown to the `signal` `abort` event.
|
|
@@ -220,7 +220,7 @@ Top-level imports are reserved for `definePage` / `definePlugin` and modules use
|
|
|
220
220
|
The opt-in router plugin (`coralite/plugins/router`) provides single-page application navigation. Register it in `coralite.config.js` under `plugins` (`plugins: [router({ ... })]`). Registration gates ALL SPA behavior — without it, every SPA navigation behavior (link interception, popstate, guards, head reconciliation) is inert: a `data-router-outlet` marker alone does nothing, and the page behaves as a standard multi-page app.
|
|
221
221
|
|
|
222
222
|
- **Outlets**: Any element carrying the outlet attribute (default `data-router-outlet`) or the reserved `<router-outlet>` tag is an outlet. Every SPA-routed page MUST have an outlet or client navigation fails; outlet-less pages are auto-wrapped by default. Set `autoWrap: false` to disable automatic body wrapping; outlet-less pages then render as authored and still resolve tokens normally. Set `outletOnly: true` to skip link interception when the live document has no outlet, so those clicks use native browser navigation. `router.navigate()` is NOT affected by `outletOnly` and still updates history before failing if no outlet exists, so do not call it from outlet-less pages. Everything outside the outlet (navbar, background audio, open sockets) is never touched by the router — those component instances and their state persist across every route swap.
|
|
223
|
-
- **Client API**: `client({ router })` injects the router: `navigate(path, { replace })`, `current()`, `beforeEach(guard)` (returns the unregister function), and the `viewTransitions` getter. Also available on `window.
|
|
223
|
+
- **Client API**: `client({ router })` injects the router: `navigate(path, { replace })`, `current()`, `beforeEach(guard)` (returns the unregister function), and the `viewTransitions` getter. Also available on `window.__coralite__.plugins.router`.
|
|
224
224
|
- **Guards**: `beforeEach` guards may return `true`/`undefined` (allow), `false` (block), a relative or same-origin path (soft redirect; redirect chains are capped at depth 10), or an `http(s)` URL (hard redirect via `window.location.replace()`).
|
|
225
225
|
- **Guard placement**: The guard list lives in the router's client-init scope and PERSISTS across the whole SPA session — an outlet swap does not reset it, and nothing auto-unregisters a guard when its route leaves. App-wide guards (auth, redirects) MUST be registered in a persistent shell component OUTSIDE the outlet (it connects once, so the guard registers exactly once). Route-scoped guards MUST capture the function returned by `beforeEach` and call it on their component `signal` abort. Registering guards inside a route component's `client()` without unregistering accumulates one extra guard per visit.
|
|
226
226
|
- **State scoping**: Component `state` is route-scoped — on navigation the old outlet is disconnected (its `signal` aborts), and the new route hydrates from its pre-built HTML, so `state` mutations are lost when the route leaves. App-scoped state belongs in the global `store` (declared in `coralite.config.js`), which the router never touches and which survives every swap. Release imperative resources a component allocates (workers, canvas/WebGL contexts, external library handles) when the component is torn down — hook teardown to the `signal` `abort` event.
|
package/templates/scss/AGENTS.md
CHANGED
|
@@ -220,7 +220,7 @@ Top-level imports are reserved for `definePage` / `definePlugin` and modules use
|
|
|
220
220
|
The opt-in router plugin (`coralite/plugins/router`) provides single-page application navigation. Register it in `coralite.config.js` under `plugins` (`plugins: [router({ ... })]`). Registration gates ALL SPA behavior — without it, every SPA navigation behavior (link interception, popstate, guards, head reconciliation) is inert: a `data-router-outlet` marker alone does nothing, and the page behaves as a standard multi-page app.
|
|
221
221
|
|
|
222
222
|
- **Outlets**: Any element carrying the outlet attribute (default `data-router-outlet`) or the reserved `<router-outlet>` tag is an outlet. Every SPA-routed page MUST have an outlet or client navigation fails; outlet-less pages are auto-wrapped by default. Set `autoWrap: false` to disable automatic body wrapping; outlet-less pages then render as authored and still resolve tokens normally. Set `outletOnly: true` to skip link interception when the live document has no outlet, so those clicks use native browser navigation. `router.navigate()` is NOT affected by `outletOnly` and still updates history before failing if no outlet exists, so do not call it from outlet-less pages. Everything outside the outlet (navbar, background audio, open sockets) is never touched by the router — those component instances and their state persist across every route swap.
|
|
223
|
-
- **Client API**: `client({ router })` injects the router: `navigate(path, { replace })`, `current()`, `beforeEach(guard)` (returns the unregister function), and the `viewTransitions` getter. Also available on `window.
|
|
223
|
+
- **Client API**: `client({ router })` injects the router: `navigate(path, { replace })`, `current()`, `beforeEach(guard)` (returns the unregister function), and the `viewTransitions` getter. Also available on `window.__coralite__.plugins.router`.
|
|
224
224
|
- **Guards**: `beforeEach` guards may return `true`/`undefined` (allow), `false` (block), a relative or same-origin path (soft redirect; redirect chains are capped at depth 10), or an `http(s)` URL (hard redirect via `window.location.replace()`).
|
|
225
225
|
- **Guard placement**: The guard list lives in the router's client-init scope and PERSISTS across the whole SPA session — an outlet swap does not reset it, and nothing auto-unregisters a guard when its route leaves. App-wide guards (auth, redirects) MUST be registered in a persistent shell component OUTSIDE the outlet (it connects once, so the guard registers exactly once). Route-scoped guards MUST capture the function returned by `beforeEach` and call it on their component `signal` abort. Registering guards inside a route component's `client()` without unregistering accumulates one extra guard per visit.
|
|
226
226
|
- **State scoping**: Component `state` is route-scoped — on navigation the old outlet is disconnected (its `signal` aborts), and the new route hydrates from its pre-built HTML, so `state` mutations are lost when the route leaves. App-scoped state belongs in the global `store` (declared in `coralite.config.js`), which the router never touches and which survives every swap. Release imperative resources a component allocates (workers, canvas/WebGL contexts, external library handles) when the component is torn down — hook teardown to the `signal` `abort` event.
|