sygnal 6.3.0 → 6.4.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/CHANGELOG.md +51 -0
- package/dist/astro/index.cjs.js +69 -3
- package/dist/astro/index.cjs.js.map +1 -1
- package/dist/astro/index.mjs +69 -3
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/server.cjs.js.map +1 -1
- package/dist/astro/server.mjs.map +1 -1
- package/dist/diagnostics.cjs.js +47 -8
- package/dist/diagnostics.cjs.js.map +1 -1
- package/dist/diagnostics.esm.js +47 -8
- package/dist/diagnostics.esm.js.map +1 -1
- package/dist/guide/mcp-apps.md +59 -4
- package/dist/index.cjs.js +9 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/index.esm.js +9 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/sygnal.min.js +1 -1
- package/dist/sygnal.min.js.map +1 -1
- package/dist/vike/config/package.json +1 -1
- package/dist/vite/plugin.cjs.js +69 -3
- package/dist/vite/plugin.cjs.js.map +1 -1
- package/dist/vite/plugin.mjs +69 -3
- package/dist/vite/plugin.mjs.map +1 -1
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/src/extra/diagnostics/checks/dom.ts +10 -2
- package/src/extra/diagnostics/checks/next.ts +17 -1
- package/src/extra/diagnostics/checks/persist.ts +4 -2
- package/src/extra/diagnostics/checks/wiring.ts +14 -6
- package/src/extra/diagnostics/codes.ts +5 -0
- package/src/extra/pwa.ts +3 -1
- package/src/extra/reducers.ts +10 -4
- package/src/index.d.ts +9 -2
- package/src/vite/plugin.ts +63 -2
package/dist/index.d.ts
CHANGED
|
@@ -2495,7 +2495,7 @@ type EventNextFunction = (action: string, data?: any, delay?: number) => void
|
|
|
2495
2495
|
|
|
2496
2496
|
/** Payload function for `event()` / `emit()`: receives the reducer arguments, returns the event data. */
|
|
2497
2497
|
type EventPayloadFunction<TYPE extends string = string, STATE = any, DATA = any> =
|
|
2498
|
-
(state: STATE, data: DATA, next: EventNextFunction, props: any) => EventPayload<TYPE>
|
|
2498
|
+
(state: STATE, data: DATA, next: EventNextFunction, props: any) => EventPayload<TYPE> | ABORT
|
|
2499
2499
|
|
|
2500
2500
|
/**
|
|
2501
2501
|
* Remaining arguments of `event()` / `emit()` when the payload is a static value.
|
|
@@ -4301,7 +4301,8 @@ declare function emit<TYPE extends EventName>(
|
|
|
4301
4301
|
* }
|
|
4302
4302
|
*
|
|
4303
4303
|
* The payload is either a function `(state, data, next, props) => payload` or a static value:
|
|
4304
|
-
* `event('RESET')`, `event('SET_MODE', 'dark')`.
|
|
4304
|
+
* `event('RESET')`, `event('SET_MODE', 'dark')`. A payload function that returns `ABORT` sends
|
|
4305
|
+
* nothing: `event('SAVED', (state) => state.dirty ? { id: state.id } : ABORT)`.
|
|
4305
4306
|
*
|
|
4306
4307
|
* With a `SygnalEvents` registry, `type` must be a registered name and the payload must match
|
|
4307
4308
|
* its type. When used inside a model, the payload function's `state` and `data` parameters are
|
|
@@ -5329,6 +5330,12 @@ interface ServiceWorkerCommand {
|
|
|
5329
5330
|
|
|
5330
5331
|
interface ServiceWorkerOptions {
|
|
5331
5332
|
scope?: string;
|
|
5333
|
+
/**
|
|
5334
|
+
* `false`: the driver registers no service worker, ignores commands and emits nothing, so the
|
|
5335
|
+
* app keeps its `SW` wiring where a worker must not run: `enabled: import.meta.env.PROD`.
|
|
5336
|
+
* Default `true`.
|
|
5337
|
+
*/
|
|
5338
|
+
enabled?: boolean;
|
|
5332
5339
|
}
|
|
5333
5340
|
|
|
5334
5341
|
declare function makeServiceWorkerDriver(
|
package/dist/index.esm.js
CHANGED
|
@@ -766,6 +766,8 @@ const DEV_CODE_SEVERITY = {
|
|
|
766
766
|
SYG425: 'warn',
|
|
767
767
|
// PLAN-9 (checks/next.ts): D471 a lowercase <collection> / <switchable> tag (deprecated in 6.3.0)
|
|
768
768
|
SYG426: 'warn',
|
|
769
|
+
// checks/next.ts: CHILD.select(undefined), usually a missing export
|
|
770
|
+
SYG427: 'error',
|
|
769
771
|
// PLAN-9 (checks/next.ts): D470 key identity, two children with one identity
|
|
770
772
|
SYG453: 'warn',
|
|
771
773
|
SYG612: 'error',
|
|
@@ -17441,10 +17443,14 @@ function toggle(field) {
|
|
|
17441
17443
|
return (state) => ({ ...state, [field]: !state[field] });
|
|
17442
17444
|
}
|
|
17443
17445
|
// event(type, payload?) → EVENTS sink fn for the object form:
|
|
17444
|
-
// `ACTION: { EVENTS: event('TYPE', (state, data) => payload) }` (static payloads allowed)
|
|
17446
|
+
// `ACTION: { EVENTS: event('TYPE', (state, data) => payload) }` (static payloads allowed).
|
|
17447
|
+
// A payload function that returns ABORT sends nothing, as ABORT does from any other sink.
|
|
17445
17448
|
function event(type, payload) {
|
|
17446
17449
|
return typeof payload === 'function'
|
|
17447
|
-
? (state, data, next, props) =>
|
|
17450
|
+
? (state, data, next, props) => {
|
|
17451
|
+
const d = payload(state, data, next, props);
|
|
17452
|
+
return isAbort(d) ? ABORT : { type, data: d };
|
|
17453
|
+
}
|
|
17448
17454
|
: () => ({ type, data: payload });
|
|
17449
17455
|
}
|
|
17450
17456
|
// ── emit() ─────────────────────────────────────────────────────────
|
|
@@ -17482,7 +17488,7 @@ function trackWorker(worker, events) {
|
|
|
17482
17488
|
function makeServiceWorkerDriver(scriptUrl, options = {}) {
|
|
17483
17489
|
return function serviceWorkerDriver(sink$) {
|
|
17484
17490
|
const events = new EventTarget();
|
|
17485
|
-
if (typeof navigator !== 'undefined' && 'serviceWorker' in navigator) {
|
|
17491
|
+
if (options.enabled !== false && typeof navigator !== 'undefined' && 'serviceWorker' in navigator) {
|
|
17486
17492
|
navigator.serviceWorker
|
|
17487
17493
|
.register(scriptUrl, { scope: options.scope })
|
|
17488
17494
|
.then((reg) => {
|