sygnal 5.3.6 → 5.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/README.md +53 -38
- package/dist/astro/client.cjs.js +18 -8106
- package/dist/astro/client.cjs.js.map +1 -0
- package/dist/astro/client.mjs +17 -8105
- package/dist/astro/client.mjs.map +1 -0
- package/dist/astro/index.cjs.js +768 -9
- package/dist/astro/index.cjs.js.map +1 -0
- package/dist/astro/index.mjs +768 -9
- package/dist/astro/index.mjs.map +1 -0
- package/dist/astro/server.cjs.js +4 -1
- package/dist/astro/server.cjs.js.map +1 -0
- package/dist/astro/server.mjs +4 -1
- package/dist/astro/server.mjs.map +1 -0
- package/dist/diagnostics.cjs.js +1297 -0
- package/dist/diagnostics.cjs.js.map +1 -0
- package/dist/diagnostics.esm.js +1267 -0
- package/dist/diagnostics.esm.js.map +1 -0
- package/dist/index.cjs.js +2981 -1386
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +848 -111
- package/dist/index.esm.js +2997 -1411
- package/dist/index.esm.js.map +1 -0
- package/dist/jsx-dev-runtime.cjs.js +15 -9
- package/dist/jsx-dev-runtime.cjs.js.map +1 -0
- package/dist/jsx-dev-runtime.esm.js +15 -9
- package/dist/jsx-dev-runtime.esm.js.map +1 -0
- package/dist/jsx-runtime.cjs.js +15 -9
- package/dist/jsx-runtime.cjs.js.map +1 -0
- package/dist/jsx-runtime.esm.js +15 -9
- package/dist/jsx-runtime.esm.js.map +1 -0
- package/dist/jsx.cjs.js +15 -9
- package/dist/jsx.cjs.js.map +1 -0
- package/dist/jsx.esm.js +15 -9
- package/dist/jsx.esm.js.map +1 -0
- package/dist/sygnal.min.js +2 -1
- package/dist/sygnal.min.js.map +1 -0
- package/dist/vike/+config.cjs.js +1 -0
- package/dist/vike/+config.cjs.js.map +1 -0
- package/dist/vike/+config.js +1 -0
- package/dist/vike/+config.js.map +1 -0
- package/dist/vike/ClientOnly.cjs.js +1 -0
- package/dist/vike/ClientOnly.cjs.js.map +1 -0
- package/dist/vike/ClientOnly.mjs +1 -0
- package/dist/vike/ClientOnly.mjs.map +1 -0
- package/dist/vike/onRenderClient.cjs.js +1 -0
- package/dist/vike/onRenderClient.cjs.js.map +1 -0
- package/dist/vike/onRenderClient.mjs +1 -0
- package/dist/vike/onRenderClient.mjs.map +1 -0
- package/dist/vike/onRenderHtml.cjs.js +1 -0
- package/dist/vike/onRenderHtml.cjs.js.map +1 -0
- package/dist/vike/onRenderHtml.mjs +1 -0
- package/dist/vike/onRenderHtml.mjs.map +1 -0
- package/dist/vite/plugin.cjs.js +680 -47
- package/dist/vite/plugin.cjs.js.map +1 -0
- package/dist/vite/plugin.mjs +680 -47
- package/dist/vite/plugin.mjs.map +1 -0
- package/llms.txt +250 -0
- package/package.json +15 -6
- package/src/astro/client.ts +13 -2
- package/src/astro/index.d.ts +24 -1
- package/src/astro/index.ts +40 -9
- package/src/astro/server.ts +3 -1
- package/src/collection.ts +5 -2
- package/src/component.ts +375 -330
- package/src/cycle/dom/MainDOMSource.ts +4 -0
- package/src/cycle/dom/classNameModule.ts +74 -0
- package/src/cycle/dom/controlledInputModule.ts +33 -0
- package/src/cycle/dom/enrichEventStream.ts +9 -3
- package/src/cycle/dom/makeDOMDriver.ts +1 -2
- package/src/cycle/dom/mockDOMSource.ts +62 -8
- package/src/cycle/dom/modules.ts +5 -1
- package/src/cycle/state/Collection.ts +13 -3
- package/src/cycle/state/StateSource.ts +1 -1
- package/src/cycle/state/pickCombine.ts +35 -1
- package/src/cycle/state/withState.ts +1 -1
- package/src/extra/devtools.ts +8 -0
- package/src/extra/diagnostics/checks/collections.ts +67 -0
- package/src/extra/diagnostics/checks/dom.ts +241 -0
- package/src/extra/diagnostics/checks/events.ts +68 -0
- package/src/extra/diagnostics/checks/index.ts +109 -0
- package/src/extra/diagnostics/checks/inspect.ts +319 -0
- package/src/extra/diagnostics/checks/props.ts +51 -0
- package/src/extra/diagnostics/checks/public.d.ts +211 -0
- package/src/extra/diagnostics/checks/rxjsHints.ts +88 -0
- package/src/extra/diagnostics/checks/shared.ts +119 -0
- package/src/extra/diagnostics/checks/state.ts +55 -0
- package/src/extra/diagnostics/checks/strict.ts +112 -0
- package/src/extra/diagnostics/checks/wiring.ts +65 -0
- package/src/extra/diagnostics/codes.ts +232 -0
- package/src/extra/diagnostics/index.ts +328 -0
- package/src/extra/diagnostics/legacy.ts +59 -0
- package/src/extra/driverFactories.ts +106 -58
- package/src/extra/eventDriver.ts +4 -0
- package/src/extra/flatten.ts +75 -0
- package/src/extra/reducers.ts +12 -5
- package/src/extra/run.ts +11 -0
- package/src/extra/testing.ts +890 -180
- package/src/extra/xstreamExtras.ts +269 -0
- package/src/index.d.ts +428 -17
- package/src/index.ts +7 -6
- package/src/pragma/index.ts +14 -9
- package/src/switchable.ts +10 -8
- package/src/vike/types.ts +21 -4
- package/src/vite/plugin.d.ts +95 -2
- package/src/vite/plugin.ts +730 -55
- package/dist/astro/astro/client.d.ts +0 -5
- package/dist/astro/astro/index.d.ts +0 -16
- package/dist/astro/astro/server.d.ts +0 -12
- package/dist/astro/client.d.ts +0 -5
- package/dist/astro/client.esm.js +0 -4665
- package/dist/astro/collection.d.ts +0 -12
- package/dist/astro/component.d.ts +0 -22
- package/dist/astro/cycle/dom/BodyDOMSource.d.ts +0 -10
- package/dist/astro/cycle/dom/DOMSource.d.ts +0 -11
- package/dist/astro/cycle/dom/DocumentDOMSource.d.ts +0 -12
- package/dist/astro/cycle/dom/ElementFinder.d.ts +0 -8
- package/dist/astro/cycle/dom/EventDelegator.d.ts +0 -34
- package/dist/astro/cycle/dom/IsolateModule.d.ts +0 -23
- package/dist/astro/cycle/dom/MainDOMSource.d.ts +0 -32
- package/dist/astro/cycle/dom/PriorityQueue.d.ts +0 -7
- package/dist/astro/cycle/dom/ScopeChecker.d.ts +0 -9
- package/dist/astro/cycle/dom/SymbolTree.d.ts +0 -9
- package/dist/astro/cycle/dom/VNodeWrapper.d.ts +0 -8
- package/dist/astro/cycle/dom/enrichEventStream.d.ts +0 -24
- package/dist/astro/cycle/dom/fromEvent.d.ts +0 -6
- package/dist/astro/cycle/dom/index.d.ts +0 -8
- package/dist/astro/cycle/dom/isolate.d.ts +0 -9
- package/dist/astro/cycle/dom/makeDOMDriver.d.ts +0 -11
- package/dist/astro/cycle/dom/mockDOMSource.d.ts +0 -17
- package/dist/astro/cycle/dom/modules.d.ts +0 -5
- package/dist/astro/cycle/dom/snabbdom.d.ts +0 -22
- package/dist/astro/cycle/dom/styleModule.d.ts +0 -13
- package/dist/astro/cycle/dom/thunk.d.ts +0 -11
- package/dist/astro/cycle/dom/utils.d.ts +0 -8
- package/dist/astro/cycle/isolate/index.d.ts +0 -42
- package/dist/astro/cycle/run/adapt.d.ts +0 -6
- package/dist/astro/cycle/run/index.d.ts +0 -36
- package/dist/astro/cycle/run/internals.d.ts +0 -8
- package/dist/astro/cycle/run/types.d.ts +0 -49
- package/dist/astro/cycle/state/Collection.d.ts +0 -29
- package/dist/astro/cycle/state/StateSource.d.ts +0 -20
- package/dist/astro/cycle/state/index.d.ts +0 -5
- package/dist/astro/cycle/state/pickCombine.d.ts +0 -3
- package/dist/astro/cycle/state/pickMerge.d.ts +0 -3
- package/dist/astro/cycle/state/types.d.ts +0 -18
- package/dist/astro/cycle/state/withState.d.ts +0 -17
- package/dist/astro/extra/classes.d.ts +0 -7
- package/dist/astro/extra/devtools.d.ts +0 -78
- package/dist/astro/extra/dragDriver.d.ts +0 -20
- package/dist/astro/extra/driverFactories.d.ts +0 -12
- package/dist/astro/extra/eventDriver.d.ts +0 -9
- package/dist/astro/extra/exactState.d.ts +0 -1
- package/dist/astro/extra/hmr.d.ts +0 -17
- package/dist/astro/extra/logDriver.d.ts +0 -2
- package/dist/astro/extra/processDrag.d.ts +0 -19
- package/dist/astro/extra/processForm.d.ts +0 -15
- package/dist/astro/extra/run.d.ts +0 -13
- package/dist/astro/extra/xstreamCompat.d.ts +0 -5
- package/dist/astro/index.d.ts +0 -19
- package/dist/astro/index.esm.js +0 -27
- package/dist/astro/jsx-dev-runtime.d.ts +0 -1
- package/dist/astro/jsx-runtime.d.ts +0 -4
- package/dist/astro/jsx.d.ts +0 -2
- package/dist/astro/pragma/fn.d.ts +0 -7
- package/dist/astro/pragma/index.d.ts +0 -7
- package/dist/astro/pragma/is.d.ts +0 -10
- package/dist/astro/server.d.ts +0 -12
- package/dist/astro/server.esm.js +0 -25
- package/dist/astro/switchable.d.ts +0 -7
- package/dist/collection.d.ts +0 -12
- package/dist/component.d.ts +0 -22
- package/dist/cycle/dom/BodyDOMSource.d.ts +0 -10
- package/dist/cycle/dom/DOMSource.d.ts +0 -11
- package/dist/cycle/dom/DocumentDOMSource.d.ts +0 -12
- package/dist/cycle/dom/ElementFinder.d.ts +0 -8
- package/dist/cycle/dom/EventDelegator.d.ts +0 -34
- package/dist/cycle/dom/IsolateModule.d.ts +0 -23
- package/dist/cycle/dom/MainDOMSource.d.ts +0 -32
- package/dist/cycle/dom/PriorityQueue.d.ts +0 -7
- package/dist/cycle/dom/ScopeChecker.d.ts +0 -9
- package/dist/cycle/dom/SymbolTree.d.ts +0 -9
- package/dist/cycle/dom/VNodeWrapper.d.ts +0 -8
- package/dist/cycle/dom/enrichEventStream.d.ts +0 -24
- package/dist/cycle/dom/fromEvent.d.ts +0 -6
- package/dist/cycle/dom/index.d.ts +0 -8
- package/dist/cycle/dom/isolate.d.ts +0 -9
- package/dist/cycle/dom/makeDOMDriver.d.ts +0 -11
- package/dist/cycle/dom/mockDOMSource.d.ts +0 -17
- package/dist/cycle/dom/modules.d.ts +0 -5
- package/dist/cycle/dom/snabbdom.d.ts +0 -22
- package/dist/cycle/dom/styleModule.d.ts +0 -13
- package/dist/cycle/dom/thunk.d.ts +0 -11
- package/dist/cycle/dom/utils.d.ts +0 -8
- package/dist/cycle/isolate/index.d.ts +0 -42
- package/dist/cycle/run/adapt.d.ts +0 -6
- package/dist/cycle/run/index.d.ts +0 -36
- package/dist/cycle/run/internals.d.ts +0 -8
- package/dist/cycle/run/types.d.ts +0 -49
- package/dist/cycle/state/Collection.d.ts +0 -29
- package/dist/cycle/state/StateSource.d.ts +0 -20
- package/dist/cycle/state/index.d.ts +0 -5
- package/dist/cycle/state/pickCombine.d.ts +0 -3
- package/dist/cycle/state/pickMerge.d.ts +0 -3
- package/dist/cycle/state/types.d.ts +0 -18
- package/dist/cycle/state/withState.d.ts +0 -17
- package/dist/extra/classes.d.ts +0 -7
- package/dist/extra/devtools.d.ts +0 -78
- package/dist/extra/dragDriver.d.ts +0 -20
- package/dist/extra/driverFactories.d.ts +0 -12
- package/dist/extra/eventDriver.d.ts +0 -9
- package/dist/extra/exactState.d.ts +0 -1
- package/dist/extra/hmr.d.ts +0 -17
- package/dist/extra/logDriver.d.ts +0 -2
- package/dist/extra/processDrag.d.ts +0 -19
- package/dist/extra/processForm.d.ts +0 -15
- package/dist/extra/run.d.ts +0 -13
- package/dist/extra/xstreamCompat.d.ts +0 -5
- package/dist/jsx-dev-runtime.d.ts +0 -1
- package/dist/jsx-dev-runtime.js +0 -224
- package/dist/jsx-runtime.d.ts +0 -4
- package/dist/jsx-runtime.js +0 -224
- package/dist/jsx.d.ts +0 -2
- package/dist/pragma/fn.d.ts +0 -7
- package/dist/pragma/index.d.ts +0 -7
- package/dist/pragma/is.d.ts +0 -10
- package/dist/switchable.d.ts +0 -7
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESM ports of xstream's `flattenConcurrently` and `flattenSequentially` extras
|
|
3
|
+
* (xstream, MIT, André Staltz), behaviour-identical.
|
|
4
|
+
*
|
|
5
|
+
* Why not re-export 'xstream/extra/*': those modules are CommonJS, and a bundler keeps a
|
|
6
|
+
* CJS module that an ESM module re-exports even when the app never uses it (G-055: +300 B
|
|
7
|
+
* gzip in the kanban bundle). ESM classes are tree-shaken when unused.
|
|
8
|
+
*/
|
|
9
|
+
import {Stream} from 'xstream'
|
|
10
|
+
|
|
11
|
+
class Inner {
|
|
12
|
+
constructor(public out: any, public op: any) {}
|
|
13
|
+
_n(t: any) { this.out._n(t) }
|
|
14
|
+
_e(err: any) { this.out._e(err) }
|
|
15
|
+
_c() { this.op.less() }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class FlattenConcOperator {
|
|
19
|
+
type = 'flattenConcurrently'
|
|
20
|
+
active = 1 // outers and inners that have not yet ended
|
|
21
|
+
out: any = null
|
|
22
|
+
constructor(public ins: any) {}
|
|
23
|
+
_start(out: any) { this.out = out; this.ins._add(this) }
|
|
24
|
+
_stop() { this.ins._remove(this); this.active = 1; this.out = null }
|
|
25
|
+
less() { if (--this.active === 0 && this.out) this.out._c() }
|
|
26
|
+
_n(s: any) { if (this.out) { this.active++; s._add(new Inner(this.out, this)) } }
|
|
27
|
+
_e(err: any) { if (this.out) this.out._e(err) }
|
|
28
|
+
_c() { this.less() }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
class FlattenSeqOperator {
|
|
32
|
+
type = 'flattenSequentially'
|
|
33
|
+
out: any = null
|
|
34
|
+
open = true
|
|
35
|
+
active: any = null
|
|
36
|
+
activeIL: any = null
|
|
37
|
+
seq: any[] = []
|
|
38
|
+
constructor(public ins: any) {}
|
|
39
|
+
_start(out: any) {
|
|
40
|
+
this.out = out; this.open = true; this.active = null
|
|
41
|
+
this.activeIL = new Inner(out, this); this.seq = []
|
|
42
|
+
this.ins._add(this)
|
|
43
|
+
}
|
|
44
|
+
_stop() {
|
|
45
|
+
this.ins._remove(this)
|
|
46
|
+
if (this.active && this.activeIL) this.active._remove(this.activeIL)
|
|
47
|
+
this.open = true; this.active = null; this.activeIL = null; this.seq = []; this.out = null
|
|
48
|
+
}
|
|
49
|
+
less() {
|
|
50
|
+
this.active = null
|
|
51
|
+
if (this.seq.length > 0) this._n(this.seq.shift())
|
|
52
|
+
if (!this.open && !this.active) this.out._c()
|
|
53
|
+
}
|
|
54
|
+
_n(s: any) {
|
|
55
|
+
if (!this.out) return
|
|
56
|
+
if (this.active) this.seq.push(s)
|
|
57
|
+
else { this.active = s; s._add(this.activeIL) }
|
|
58
|
+
}
|
|
59
|
+
_e(err: any) { if (this.out) this.out._e(err) }
|
|
60
|
+
_c() {
|
|
61
|
+
if (!this.out) return
|
|
62
|
+
this.open = false
|
|
63
|
+
if (!this.active && this.seq.length === 0) this.out._c()
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Flattens a stream of streams, imitating every nested stream at once (RxJS mergeAll). */
|
|
68
|
+
export function flattenConcurrently<T>(ins: Stream<Stream<T>>): Stream<T> {
|
|
69
|
+
return new Stream<T>(new FlattenConcOperator(ins) as any)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Flattens a stream of streams one at a time, buffering the rest in order (RxJS concatAll). */
|
|
73
|
+
export function flattenSequentially<T>(ins: Stream<Stream<T>>): Stream<T> {
|
|
74
|
+
return new Stream<T>(new FlattenSeqOperator(ins) as any)
|
|
75
|
+
}
|
package/src/extra/reducers.ts
CHANGED
|
@@ -39,6 +39,17 @@ export function toggle<S = any>(field: keyof S & string): (state: S) => S {
|
|
|
39
39
|
return (state) => ({ ...state, [field]: !state[field] })
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
// event(type, payload?) → EVENTS sink fn for the object form:
|
|
43
|
+
// `ACTION: { EVENTS: event('TYPE', (state, data) => payload) }` (static payloads allowed)
|
|
44
|
+
export function event(
|
|
45
|
+
type: string,
|
|
46
|
+
payload?: any | ((state: any, data: any, next: Function, props: any) => any)
|
|
47
|
+
): (state: any, data: any, next: Function, props: any) => { type: string; data: any } {
|
|
48
|
+
return typeof payload === 'function'
|
|
49
|
+
? (state, data, next, props) => ({ type, data: payload(state, data, next, props) })
|
|
50
|
+
: () => ({ type, data: payload })
|
|
51
|
+
}
|
|
52
|
+
|
|
42
53
|
// ── emit() ─────────────────────────────────────────────────────────
|
|
43
54
|
/**
|
|
44
55
|
* Create a model entry that emits an EVENTS bus event.
|
|
@@ -56,9 +67,5 @@ export function emit(
|
|
|
56
67
|
type: string,
|
|
57
68
|
data?: any | ((state: any, actionData: any, next: Function, props: any) => any)
|
|
58
69
|
): { EVENTS: (state: any, actionData: any, next: Function, props: any) => { type: string; data: any } } {
|
|
59
|
-
return {
|
|
60
|
-
EVENTS: typeof data === 'function'
|
|
61
|
-
? (state, actionData, next, props) => ({ type, data: data(state, actionData, next, props) })
|
|
62
|
-
: () => ({ type, data }),
|
|
63
|
-
}
|
|
70
|
+
return { EVENTS: event(type, data) }
|
|
64
71
|
}
|
package/src/extra/run.ts
CHANGED
|
@@ -5,11 +5,15 @@ import eventBusDriver from './eventDriver';
|
|
|
5
5
|
import logDriver from './logDriver';
|
|
6
6
|
import component, {ABORT} from '../component';
|
|
7
7
|
import {getDevTools} from './devtools';
|
|
8
|
+
import {configureDiagnostics} from './diagnostics/index';
|
|
9
|
+
import type {DiagnosticsMode, DiagnosticsOptions} from './diagnostics/index';
|
|
8
10
|
|
|
9
11
|
interface RunOptions {
|
|
10
12
|
mountPoint?: string;
|
|
11
13
|
fragments?: boolean;
|
|
12
14
|
useDefaultDrivers?: boolean;
|
|
15
|
+
/** Diagnostics mode (or mode + ignore list). Overrides globalThis.__SYGNAL_DEV__. */
|
|
16
|
+
diagnostics?: DiagnosticsMode | DiagnosticsOptions;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
interface SygnalRunResult {
|
|
@@ -30,6 +34,13 @@ export default function run(
|
|
|
30
34
|
dt.init();
|
|
31
35
|
}
|
|
32
36
|
|
|
37
|
+
// Resolve diagnostics mode: explicit option > globalThis.__SYGNAL_DEV__ > 'off'.
|
|
38
|
+
// Each run() is authoritative: without the option, mode and ignore list
|
|
39
|
+
// reset to defaults (no leakage from an earlier run()/configureDiagnostics()).
|
|
40
|
+
const {diagnostics} = options;
|
|
41
|
+
const diagOptions: DiagnosticsOptions = typeof diagnostics === 'string' ? {mode: diagnostics} : diagnostics || {};
|
|
42
|
+
configureDiagnostics({mode: diagOptions.mode, ignore: diagOptions.ignore || []});
|
|
43
|
+
|
|
33
44
|
const {mountPoint = '#root', fragments = true, useDefaultDrivers = true} = options;
|
|
34
45
|
if (!app.isSygnalComponent) {
|
|
35
46
|
const name = app.name || app.componentName || app.label || 'FUNCTIONAL_COMPONENT';
|