@askrjs/askr 0.2.3 → 0.3.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 +11 -0
- package/dist/access-CEA2pOry.js +1046 -0
- package/dist/actions/index.d.ts +16 -2
- package/dist/actions/index.js +5 -5
- package/dist/{activity-ZxJXI9hF.js → activity-oy2YFTFF.js} +22 -16
- package/dist/benchmark.js +8 -9
- package/dist/boot/index.d.ts +21 -9
- package/dist/boot/index.js +1 -1
- package/dist/{boot-D4GaLA0d.js → boot-BMBMWUGI.js} +680 -440
- package/dist/capabilities-Bbf0mlp9.js +42 -0
- package/dist/components/index.d.ts +11 -8
- package/dist/components/index.js +1 -1
- package/dist/{compose-ref-Bfaf4kUC.js → compose-ref-v0qGlHoN.js} +7 -1
- package/dist/control/index.d.ts +20 -2
- package/dist/control/index.js +1 -1
- package/dist/{control-57x3wa4J.js → control-BR_mrX__.js} +4 -4
- package/dist/core.d.ts +163 -0
- package/dist/csp-nonce-BfFWcd0w.js +173 -0
- package/dist/data/index.d.ts +74 -2
- package/dist/data/index.js +3 -3
- package/dist/{data-B7XCDeC8.js → data-2edW0jhF.js} +133 -138
- package/dist/{data-runtime-7t_Y0iv3.js → data-runtime-CxoY98lX.js} +22 -15
- package/dist/{deferred-BELyvMsC.js → deferred-CbgNhf67.js} +5 -5
- package/dist/dom-renderer.d.ts +77 -0
- package/dist/domains/actions.d.ts +70 -0
- package/dist/domains/component.d.ts +119 -0
- package/dist/domains/context.d.ts +73 -0
- package/dist/domains/control.d.ts +328 -0
- package/dist/domains/data.d.ts +461 -0
- package/dist/domains/diagnostics.d.ts +21 -0
- package/dist/domains/lifecycle.d.ts +112 -0
- package/dist/domains/refs.d.ts +18 -0
- package/dist/domains/renderer.d.ts +127 -0
- package/dist/domains/routing.d.ts +501 -0
- package/dist/domains/scheduler.d.ts +79 -0
- package/dist/domains/server.d.ts +112 -0
- package/dist/domains/state.d.ts +129 -0
- package/dist/domains/telemetry.d.ts +29 -0
- package/dist/eager-control.d.ts +8 -0
- package/dist/{effect-4LwBwV58.js → effect-C3Zsc1k6.js} +14 -41
- package/dist/{types-DkVJhVs9.d.ts → elements.d.ts} +84 -42
- package/dist/{for-internal-DeoSg_AV.js → for-state-BDykeOJL.js} +623 -511
- package/dist/foundations/icon/index.d.ts +67 -16
- package/dist/foundations/icon/index.js +1 -1
- package/dist/foundations/index.d.ts +26 -3
- package/dist/foundations/index.js +1 -1
- package/dist/foundations/interactions/index.d.ts +73 -34
- package/dist/foundations/interactions/index.js +1 -1
- package/dist/foundations/state/index.d.ts +12 -5
- package/dist/foundations/state/index.js +1 -1
- package/dist/foundations/structures/index.d.ts +44 -3
- package/dist/foundations/structures/index.js +1 -1
- package/dist/foundations/utilities/index.d.ts +34 -3
- package/dist/foundations/utilities/index.js +1 -1
- package/dist/fx/index.d.ts +72 -25
- package/dist/fx/index.js +8 -8
- package/dist/index.d.ts +121 -4
- package/dist/index.js +316 -47
- package/dist/{component-internal-Dl02WQKS.js → instance-VAFYVJOa.js} +495 -283
- package/dist/{interactions-D102JxBR.js → interactions-CTeACdT_.js} +1 -1
- package/dist/jsx-dev-runtime.d.ts +51 -11
- package/dist/jsx-globals.d.ts +2 -0
- package/dist/jsx-runtime-CPJXAOBF.js +43 -0
- package/dist/jsx-runtime.d.ts +17 -3
- package/dist/jsx-runtime.js +2 -42
- package/dist/jsx.d.ts +108 -0
- package/dist/{manifest-D6rfj_jC.js → manifest-D1P3UNWV.js} +4 -9
- package/dist/{navigate-C46GtScG.js → navigate-prC5V8XV.js} +204 -476
- package/dist/{navigate-wel1e6cU.d.ts → navigation.d.ts} +10 -8
- package/dist/{readable-CEcteIDE.js → notify-DxxuDPeY.js} +96 -34
- package/dist/{query-registry-Bua3cDyb.js → query-registry-LrYpQsDJ.js} +1 -1
- package/dist/{compose-ref-DOJHoW5X.d.ts → refs.d.ts} +11 -7
- package/dist/{ssr-BaC5qHEw.js → render-resolved-BC0W7_5b.js} +165 -558
- package/dist/{renderer-BhXofszH.js → renderer-CT0HeY58.js} +6866 -5715
- package/dist/{resolution-t8J0yNaU.js → resolution-3DskUkjG.js} +189 -180
- package/dist/{resource-operation-B8q-QRUx.js → resource-18-sFRl9.js} +98 -58
- package/dist/resources/index.d.ts +64 -46
- package/dist/resources/index.js +215 -9
- package/dist/route-activity.d.ts +21 -0
- package/dist/{route-matching-Bo6UqG-5.js → route-matching-CUzZ31gT.js} +68 -82
- package/dist/router/index.d.ts +378 -79
- package/dist/router/index.js +9 -9
- package/dist/router-internal-7nuNEHfG.js +36 -0
- package/dist/scope-Cq_iYbTR.js +403 -0
- package/dist/{selector-C7rIpOnN.js → selector-BSPVkjKP.js} +41 -41
- package/dist/{shared-CGrx2AOL.js → shared-kU8yvryp.js} +3 -6
- package/dist/{snapshot-source-BB42xgwb.js → snapshot-source-An4iKajG.js} +1 -1
- package/dist/ssg/index.d.ts +51 -15
- package/dist/ssg/index.js +269 -209
- package/dist/ssr/index.d.ts +121 -68
- package/dist/ssr/index.js +2 -1
- package/dist/ssr-CiNm6Vzl.js +393 -0
- package/dist/{ssr-DSHd_Q9K.js → ssr-EPjwJH5R.js} +5 -1
- package/dist/{state-BzhOW2TX.js → state-BXJfudq1.js} +10 -15
- package/dist/{structures-BwfeO4Iz.js → structures-CjEzfj4h.js} +37 -57
- package/dist/{index-r5THqzPN.d.ts → structures.d.ts} +57 -36
- package/dist/testing/index.d.ts +125 -24
- package/dist/testing/index.js +26 -62
- package/dist/timer-C7uqnJVt.js +85 -0
- package/dist/{index-B1gu0_m0.d.ts → utilities.d.ts} +24 -13
- package/dist/{verify-hydration-_Q6avFp0.js → verify-hydration-ikaxotf7.js} +8 -5
- package/package.json +13 -15
- package/dist/access-Rr7CMa06.js +0 -507
- package/dist/activity-CAJ5eho-.d.ts +0 -14
- package/dist/benchmark.d.ts +0 -26
- package/dist/cleanup-DsrbV-rr.js +0 -535
- package/dist/component-cleanup-DjpwO9WX.js +0 -143
- package/dist/component-scope-4I3yEMkb.js +0 -195
- package/dist/control-DdFw-Caz.d.ts +0 -8
- package/dist/csp-nonce-C9OuML0U.js +0 -72
- package/dist/css-BuPaTOfe.js +0 -70
- package/dist/fastlane-Buz1Rvlr.js +0 -166
- package/dist/index-DSqXWc77.d.ts +0 -1402
- package/dist/jsx-runtime-BTzDdBJ_.d.ts +0 -2
- package/dist/jsx-runtime-Cdd6Gkb0.d.ts +0 -38
- package/dist/lifecycle-batch-Be-CLDjV.js +0 -253
- package/dist/lifecycle-operations-C5m03NQc.js +0 -195
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { JSXElementType, JSXElement, Props } from '../elements.js';
|
|
2
|
+
import '../jsx-globals.js';
|
|
3
|
+
import { AuthContext, AuthRequirement } from '@askrjs/auth';
|
|
4
|
+
import { InferSchema, ObjectSchema } from '@askrjs/schema';
|
|
5
|
+
import { RenderableChild, Scope } from './context.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Common call contracts: SSR types
|
|
9
|
+
*/
|
|
10
|
+
/** Arbitrary serializable data attached to an SSR render pass (e.g. loader output). */
|
|
11
|
+
type SSRData = Record<string, unknown>;
|
|
12
|
+
|
|
13
|
+
/** Styles produced while rendering a request, kept with that request's SSR context. */
|
|
14
|
+
interface SSRStyleRegistration {
|
|
15
|
+
id: string;
|
|
16
|
+
cssText: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface DocumentRenderRoute {
|
|
20
|
+
path: string;
|
|
21
|
+
namespace?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Request/render metadata passed to a {@link DocumentRenderer}. */
|
|
25
|
+
interface DocumentRenderContext {
|
|
26
|
+
mode: 'ssr' | 'ssg';
|
|
27
|
+
url: string;
|
|
28
|
+
pathname: string;
|
|
29
|
+
search: string;
|
|
30
|
+
hash: string;
|
|
31
|
+
params: Record<string, string>;
|
|
32
|
+
data?: SSRData;
|
|
33
|
+
seed: number;
|
|
34
|
+
route: DocumentRenderRoute;
|
|
35
|
+
cspNonce?: string;
|
|
36
|
+
styles?: readonly SSRStyleRegistration[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Arguments passed to a {@link DocumentRenderer}: the rendered app HTML and its context. */
|
|
40
|
+
interface DocumentRenderArgs {
|
|
41
|
+
appHtml: string;
|
|
42
|
+
context: DocumentRenderContext;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Wraps rendered app HTML in a full document (`<html>`, `<head>`, etc.) for SSR/SSG output. */
|
|
46
|
+
type DocumentRenderer = (args: DocumentRenderArgs) => string;
|
|
47
|
+
|
|
48
|
+
/** How to react when SSR styles were registered but not included in the rendered document. */
|
|
49
|
+
type SSRStyleRegistrationValidation = 'warn' | 'error' | 'off';
|
|
50
|
+
|
|
51
|
+
/** Full context for sink-based streaming SSR */
|
|
52
|
+
type SSRContext = {
|
|
53
|
+
url: string;
|
|
54
|
+
seed: number;
|
|
55
|
+
data?: SSRData;
|
|
56
|
+
params?: Record<string, string>;
|
|
57
|
+
signal?: AbortSignal;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/** Lexical scope carrying the CSP nonce for the current render, if any. */
|
|
61
|
+
declare const CspNonceScope: Scope<string | undefined>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Read the CSP nonce for the current render from {@link CspNonceScope}.
|
|
65
|
+
*
|
|
66
|
+
* @returns The active nonce, or `undefined` when called outside of a
|
|
67
|
+
* component render or when no nonce was configured.
|
|
68
|
+
*/
|
|
69
|
+
declare function cspNonce(): string | undefined;
|
|
70
|
+
|
|
71
|
+
interface DeferredBoundaryRegistration {
|
|
72
|
+
id: string;
|
|
73
|
+
promise: Promise<unknown>;
|
|
74
|
+
fulfilled(value: unknown): RenderableChild;
|
|
75
|
+
rejected(error: unknown): RenderableChild;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface SSRPortalHostRegistration {
|
|
79
|
+
token: string;
|
|
80
|
+
automatic: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface SSRPortalSlot {
|
|
84
|
+
hasValue: boolean;
|
|
85
|
+
value: RenderableChild | undefined;
|
|
86
|
+
hosts: SSRPortalHostRegistration[];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface SSRPortalState {
|
|
90
|
+
slots: Map<object, SSRPortalSlot>;
|
|
91
|
+
nextHostId: number;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Register request-local CSS produced during SSR without importing the SSR renderer in clients. */
|
|
95
|
+
declare function registerSSRStyle(id: string, cssText: string): void;
|
|
96
|
+
export {
|
|
97
|
+
SSRData,
|
|
98
|
+
SSRStyleRegistration,
|
|
99
|
+
DocumentRenderRoute,
|
|
100
|
+
DocumentRenderContext,
|
|
101
|
+
DocumentRenderArgs,
|
|
102
|
+
DocumentRenderer,
|
|
103
|
+
SSRStyleRegistrationValidation,
|
|
104
|
+
SSRContext,
|
|
105
|
+
CspNonceScope,
|
|
106
|
+
cspNonce,
|
|
107
|
+
DeferredBoundaryRegistration,
|
|
108
|
+
SSRPortalHostRegistration,
|
|
109
|
+
SSRPortalSlot,
|
|
110
|
+
SSRPortalState,
|
|
111
|
+
registerSSRStyle,
|
|
112
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { JSXElementType, JSXElement, Props } from '../elements.js';
|
|
2
|
+
import '../jsx-globals.js';
|
|
3
|
+
import { AuthContext, AuthRequirement } from '@askrjs/auth';
|
|
4
|
+
import { InferSchema, ObjectSchema } from '@askrjs/schema';
|
|
5
|
+
import { ReadableSource } from './component.js';
|
|
6
|
+
import { capture } from './lifecycle.js';
|
|
7
|
+
import { For } from './control.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* State value holder - callable to read, has set method to update
|
|
11
|
+
* @example
|
|
12
|
+
* const count = state(0);
|
|
13
|
+
* count(); // read: 0
|
|
14
|
+
* count.set(1); // write: triggers re-render
|
|
15
|
+
*/
|
|
16
|
+
interface State<T> extends ReadableSource<T> {
|
|
17
|
+
(): T;
|
|
18
|
+
set(...args: StateSetterArgs<T>): void;
|
|
19
|
+
[Symbol.iterator](): IterableIterator<StateTuple<T>[number]>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type StateUpdater<T> = (prev: T) => T;
|
|
23
|
+
|
|
24
|
+
type StateSetterArgs<T> = [Extract<T, (...args: any[]) => unknown>] extends [
|
|
25
|
+
never,
|
|
26
|
+
]
|
|
27
|
+
? [value: T] | [updater: StateUpdater<T>]
|
|
28
|
+
: [updater: StateUpdater<T>];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Public setter type for state cells.
|
|
32
|
+
*/
|
|
33
|
+
type StateSetter<T> = (...args: StateSetterArgs<T>) => void;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Tuple-first state handle returned by `state()`.
|
|
37
|
+
*/
|
|
38
|
+
type StateTuple<T> = [get: State<T>, set: StateSetter<T>] & State<T>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Creates a local state value for a component
|
|
42
|
+
* Optimized for:
|
|
43
|
+
* - O(1) read performance
|
|
44
|
+
* - Minimal allocation per state
|
|
45
|
+
* - Fast scheduler integration
|
|
46
|
+
*
|
|
47
|
+
* IMPORTANT: state() must be called during component render execution.
|
|
48
|
+
* It captures the current component instance from context.
|
|
49
|
+
* Calling outside a component function will throw an error.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* // ✅ Correct: called during render
|
|
54
|
+
* export function Counter() {
|
|
55
|
+
* const [count, setCount] = state(0);
|
|
56
|
+
* return { type: 'button', children: [count()] };
|
|
57
|
+
* }
|
|
58
|
+
*
|
|
59
|
+
* // ❌ Wrong: called outside component
|
|
60
|
+
* const count = state(0);
|
|
61
|
+
* export function BadComponent() {
|
|
62
|
+
* return { type: 'div' };
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
declare function state<T>(initialValue: T): StateTuple<T>;
|
|
67
|
+
|
|
68
|
+
declare const SNAPSHOT_SOURCE_BRAND: unique symbol;
|
|
69
|
+
|
|
70
|
+
type SnapshotSourceBrand = {
|
|
71
|
+
readonly [SNAPSHOT_SOURCE_BRAND]: true;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** A reactive derived value produced by {@link derive}; call it to read the current result. */
|
|
75
|
+
interface Derived<T> extends ReadableSource<T> {
|
|
76
|
+
(): T;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
type SnapshotSource<T> = {
|
|
80
|
+
value: T | null;
|
|
81
|
+
pending?: boolean;
|
|
82
|
+
error?: Error | null;
|
|
83
|
+
} & SnapshotSourceBrand;
|
|
84
|
+
|
|
85
|
+
/** Creates a render-scoped derived value; must be called during component render. */
|
|
86
|
+
declare function derive<TOut>(fn: () => TOut): Derived<TOut>;
|
|
87
|
+
|
|
88
|
+
declare function derive<TIn, TOut>(
|
|
89
|
+
source: SnapshotSource<TIn> | TIn | (() => TIn),
|
|
90
|
+
map: (value: TIn) => TOut
|
|
91
|
+
): Derived<TOut | null>;
|
|
92
|
+
|
|
93
|
+
/** A fine-grained reactive membership check produced by {@link selector}. */
|
|
94
|
+
interface Selector<T> {
|
|
95
|
+
(candidate: T): boolean;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
type SelectorEquals<T> = {
|
|
99
|
+
bivarianceHack(a: T, b: T): boolean;
|
|
100
|
+
}['bivarianceHack'];
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Creates a render-scoped predicate for keyed membership in reactive list rows.
|
|
104
|
+
*
|
|
105
|
+
* Use this when a `<For>` child needs to compare each stable item with a
|
|
106
|
+
* changing selected value. Unlike a plain closure capture, the predicate
|
|
107
|
+
* subscribes the affected rows and updates them without rebuilding the list.
|
|
108
|
+
* Must be called during component render.
|
|
109
|
+
*/
|
|
110
|
+
declare function selector<T>(
|
|
111
|
+
source: () => T,
|
|
112
|
+
equals?: SelectorEquals<T>
|
|
113
|
+
): Selector<T>;
|
|
114
|
+
export {
|
|
115
|
+
State,
|
|
116
|
+
StateUpdater,
|
|
117
|
+
StateSetterArgs,
|
|
118
|
+
StateSetter,
|
|
119
|
+
StateTuple,
|
|
120
|
+
state,
|
|
121
|
+
SNAPSHOT_SOURCE_BRAND,
|
|
122
|
+
SnapshotSourceBrand,
|
|
123
|
+
Derived,
|
|
124
|
+
SnapshotSource,
|
|
125
|
+
derive,
|
|
126
|
+
Selector,
|
|
127
|
+
SelectorEquals,
|
|
128
|
+
selector,
|
|
129
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { JSXElementType, JSXElement, Props } from '../elements.js';
|
|
2
|
+
import '../jsx-globals.js';
|
|
3
|
+
import { AuthContext, AuthRequirement } from '@askrjs/auth';
|
|
4
|
+
import { InferSchema, ObjectSchema } from '@askrjs/schema';
|
|
5
|
+
import { action } from './actions.js';
|
|
6
|
+
|
|
7
|
+
interface TelemetryFields {
|
|
8
|
+
requestId?: string;
|
|
9
|
+
traceId?: string;
|
|
10
|
+
route?: string;
|
|
11
|
+
action?: string;
|
|
12
|
+
operation?: string;
|
|
13
|
+
status?: number;
|
|
14
|
+
durationMs?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type TelemetrySpan = <T>(fields: TelemetryFields, work: () => T) => T;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Structural subset implemented by `createTelemetry()` from `@askrjs/otel`.
|
|
21
|
+
* Core does not install an OpenTelemetry SDK, backend, or exporter.
|
|
22
|
+
*/
|
|
23
|
+
interface CoreTelemetry {
|
|
24
|
+
routeMatch?: TelemetrySpan;
|
|
25
|
+
loader?: TelemetrySpan;
|
|
26
|
+
queryPrefetch?: TelemetrySpan;
|
|
27
|
+
ssrRender?: TelemetrySpan;
|
|
28
|
+
}
|
|
29
|
+
export { TelemetryFields, TelemetrySpan, CoreTelemetry };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
//#region src/runtime/effect.ts
|
|
1
|
+
import { b as ScheduledWork, f as requestRuntimeWork, y as SCHEDULER_LANES } from "./access-CEA2pOry.js";
|
|
2
|
+
import { S as withFineGrainedReadTracking } from "./notify-DxxuDPeY.js";
|
|
3
|
+
//#region src/runtime/reactivity/effect.ts
|
|
4
4
|
const SOURCE_EFFECTS = Symbol("askr.source-effects");
|
|
5
5
|
const effectSources = /* @__PURE__ */ new WeakMap();
|
|
6
6
|
const dirtyEffectsByLane = {
|
|
@@ -9,24 +9,12 @@ const dirtyEffectsByLane = {
|
|
|
9
9
|
reactive: /* @__PURE__ */ new Set(),
|
|
10
10
|
post: /* @__PURE__ */ new Set()
|
|
11
11
|
};
|
|
12
|
-
const hasPendingLaneFlush = {
|
|
13
|
-
derived: false,
|
|
14
|
-
component: false,
|
|
15
|
-
reactive: false,
|
|
16
|
-
post: false
|
|
17
|
-
};
|
|
18
|
-
const dirtyLaneState = {
|
|
19
|
-
derived: false,
|
|
20
|
-
component: false,
|
|
21
|
-
reactive: false,
|
|
22
|
-
post: false
|
|
23
|
-
};
|
|
24
12
|
const MAX_EFFECT_RUNS_PER_FLUSH = 50;
|
|
25
13
|
const LANE_FLUSH_TASKS = {
|
|
26
|
-
derived: () => flushLaneEffects("derived"),
|
|
27
|
-
component: () => flushLaneEffects("component"),
|
|
28
|
-
reactive: () => flushLaneEffects("reactive"),
|
|
29
|
-
post: () => flushLaneEffects("post")
|
|
14
|
+
derived: new ScheduledWork(() => flushLaneEffects("derived")),
|
|
15
|
+
component: new ScheduledWork(() => flushLaneEffects("component")),
|
|
16
|
+
reactive: new ScheduledWork(() => flushLaneEffects("reactive")),
|
|
17
|
+
post: new ScheduledWork(() => flushLaneEffects("post"))
|
|
30
18
|
};
|
|
31
19
|
function isEffectReadSourceCollection(sources) {
|
|
32
20
|
return Array.isArray(sources) || sources instanceof Set;
|
|
@@ -171,7 +159,6 @@ function handleEffectError(effect, error) {
|
|
|
171
159
|
throw error;
|
|
172
160
|
}
|
|
173
161
|
function flushLaneEffects(lane) {
|
|
174
|
-
hasPendingLaneFlush[lane] = false;
|
|
175
162
|
const effects = dirtyEffectsByLane[lane];
|
|
176
163
|
if (effects.size === 0) return;
|
|
177
164
|
const pending = effects.values();
|
|
@@ -211,11 +198,6 @@ function flushLaneEffects(lane) {
|
|
|
211
198
|
if (failures?.length === 1) throw failures[0];
|
|
212
199
|
if (failures && failures.length > 1) throw new AggregateError(failures, "Fine-grained effect failures");
|
|
213
200
|
}
|
|
214
|
-
function scheduleLaneFlush(lane) {
|
|
215
|
-
if (hasPendingLaneFlush[lane]) return;
|
|
216
|
-
hasPendingLaneFlush[lane] = true;
|
|
217
|
-
enqueueRuntimeLane(lane, LANE_FLUSH_TASKS[lane]);
|
|
218
|
-
}
|
|
219
201
|
function unscheduleEffect(effect) {
|
|
220
202
|
dirtyEffectsByLane[effect.lane].delete(effect);
|
|
221
203
|
}
|
|
@@ -229,22 +211,13 @@ function recomputeEffectNow(effect) {
|
|
|
229
211
|
function markFineGrainedEffectsDirtySource(source) {
|
|
230
212
|
const registered = getRegisteredEffects(source);
|
|
231
213
|
if (!registered) return;
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
dirtyEffectsByLane[lane].add(effect);
|
|
240
|
-
dirtyLaneState[lane] = true;
|
|
241
|
-
};
|
|
242
|
-
if (registered instanceof Set) for (const effect of registered) markDirty(effect);
|
|
243
|
-
else markDirty(registered);
|
|
244
|
-
if (dirtyLaneState.derived) scheduleLaneFlush("derived");
|
|
245
|
-
if (dirtyLaneState.component) scheduleLaneFlush("component");
|
|
246
|
-
if (dirtyLaneState.reactive) scheduleLaneFlush("reactive");
|
|
247
|
-
if (dirtyLaneState.post) scheduleLaneFlush("post");
|
|
214
|
+
if (registered instanceof Set) for (const effect of registered) markDirtyEffect(effect);
|
|
215
|
+
else markDirtyEffect(registered);
|
|
216
|
+
for (const lane of SCHEDULER_LANES) if (dirtyEffectsByLane[lane].size) requestRuntimeWork(lane, LANE_FLUSH_TASKS[lane]);
|
|
217
|
+
}
|
|
218
|
+
function markDirtyEffect(effect) {
|
|
219
|
+
if (!effect.isActive) return;
|
|
220
|
+
dirtyEffectsByLane[effect.lane].add(effect);
|
|
248
221
|
}
|
|
249
222
|
var FineGrainedEffectImpl = class {
|
|
250
223
|
constructor(lane, compute, commit, equals, onError, owner) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/common/props.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Common call contracts: Props
|
|
4
3
|
*
|
|
@@ -29,12 +28,26 @@ type IntrinsicTextValue = string | null | undefined;
|
|
|
29
28
|
type IntrinsicTextLikeValue = string | number | null | undefined;
|
|
30
29
|
type IntrinsicStyleEntryValue = string | number | null | undefined | false;
|
|
31
30
|
type IntrinsicStyleObject = Record<string, IntrinsicStyleEntryValue>;
|
|
32
|
-
type IntrinsicStyleValue =
|
|
33
|
-
|
|
31
|
+
type IntrinsicStyleValue =
|
|
32
|
+
| string
|
|
33
|
+
| IntrinsicStyleObject
|
|
34
|
+
| null
|
|
35
|
+
| undefined
|
|
36
|
+
| false;
|
|
37
|
+
type IntrinsicFormValue =
|
|
38
|
+
| string
|
|
39
|
+
| number
|
|
40
|
+
| readonly string[]
|
|
41
|
+
| null
|
|
42
|
+
| undefined;
|
|
34
43
|
type IntrinsicRefTarget = Element | null;
|
|
35
|
-
type IntrinsicRef =
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
type IntrinsicRef =
|
|
45
|
+
| BivariantHandler<IntrinsicRefTarget>
|
|
46
|
+
| {
|
|
47
|
+
current: IntrinsicRefTarget;
|
|
48
|
+
}
|
|
49
|
+
| null
|
|
50
|
+
| undefined;
|
|
38
51
|
interface IntrinsicEventProps {
|
|
39
52
|
onAbort?: BivariantHandler<Event>;
|
|
40
53
|
onBlur?: BivariantHandler<FocusEvent>;
|
|
@@ -89,6 +102,11 @@ interface IntrinsicProps extends IntrinsicEventProps {
|
|
|
89
102
|
hidden?: ReactiveProp<IntrinsicBooleanValue>;
|
|
90
103
|
dir?: ReactiveProp<IntrinsicTextValue>;
|
|
91
104
|
lang?: ReactiveProp<IntrinsicTextValue>;
|
|
105
|
+
contentEditable?: ReactiveProp<IntrinsicTextValue>;
|
|
106
|
+
draggable?: ReactiveProp<IntrinsicTextValue>;
|
|
107
|
+
enterKeyHint?: ReactiveProp<IntrinsicTextValue>;
|
|
108
|
+
inputMode?: ReactiveProp<IntrinsicTextValue>;
|
|
109
|
+
spellCheck?: ReactiveProp<IntrinsicTextValue>;
|
|
92
110
|
[attr: `aria-${string}`]: ReactiveProp<IntrinsicAriaValue>;
|
|
93
111
|
[attr: `data-${string}`]: ReactiveProp<IntrinsicDataValue>;
|
|
94
112
|
}
|
|
@@ -139,7 +157,10 @@ type ForbiddenLayoutOnlyProps = {
|
|
|
139
157
|
value?: never;
|
|
140
158
|
width?: never;
|
|
141
159
|
};
|
|
142
|
-
type StructuredContentIntrinsicProps<TAllowed extends object = {}> =
|
|
160
|
+
type StructuredContentIntrinsicProps<TAllowed extends object = {}> =
|
|
161
|
+
IntrinsicFallbackProps &
|
|
162
|
+
Omit<ForbiddenLayoutOnlyProps, keyof TAllowed> &
|
|
163
|
+
TAllowed;
|
|
143
164
|
type LayoutIntrinsicProps = StructuredContentIntrinsicProps;
|
|
144
165
|
type OrderedListIntrinsicProps = StructuredContentIntrinsicProps<{
|
|
145
166
|
reversed?: ReactiveProp<IntrinsicBooleanValue>;
|
|
@@ -154,12 +175,21 @@ type TableCellIntrinsicAllowedProps = {
|
|
|
154
175
|
headers?: ReactiveProp<IntrinsicTextValue>;
|
|
155
176
|
rowSpan?: ReactiveProp<IntrinsicNumberValue>;
|
|
156
177
|
};
|
|
157
|
-
type TableHeaderScopeValue =
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
178
|
+
type TableHeaderScopeValue =
|
|
179
|
+
| 'col'
|
|
180
|
+
| 'colgroup'
|
|
181
|
+
| 'row'
|
|
182
|
+
| 'rowgroup'
|
|
183
|
+
| null
|
|
184
|
+
| undefined;
|
|
185
|
+
type TableCellIntrinsicProps =
|
|
186
|
+
StructuredContentIntrinsicProps<TableCellIntrinsicAllowedProps>;
|
|
187
|
+
type TableHeaderIntrinsicProps = StructuredContentIntrinsicProps<
|
|
188
|
+
TableCellIntrinsicAllowedProps & {
|
|
189
|
+
abbr?: ReactiveProp<IntrinsicTextValue>;
|
|
190
|
+
scope?: ReactiveProp<TableHeaderScopeValue>;
|
|
191
|
+
}
|
|
192
|
+
>;
|
|
163
193
|
interface AnchorIntrinsicProps extends IntrinsicProps {
|
|
164
194
|
href?: ReactiveProp<IntrinsicTextValue>;
|
|
165
195
|
rel?: ReactiveProp<IntrinsicTextValue>;
|
|
@@ -218,29 +248,38 @@ type SvgPresentationIntrinsicAllowedProps = {
|
|
|
218
248
|
strokeLinejoin?: ReactiveProp<IntrinsicTextValue>;
|
|
219
249
|
strokeWidth?: ReactiveProp<IntrinsicTextLikeValue>;
|
|
220
250
|
};
|
|
221
|
-
type SvgIntrinsicProps = StructuredContentIntrinsicProps<
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
type
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
251
|
+
type SvgIntrinsicProps = StructuredContentIntrinsicProps<
|
|
252
|
+
SvgPresentationIntrinsicAllowedProps & {
|
|
253
|
+
height?: ReactiveProp<IntrinsicTextLikeValue>;
|
|
254
|
+
viewBox?: ReactiveProp<IntrinsicTextValue>;
|
|
255
|
+
width?: ReactiveProp<IntrinsicTextLikeValue>;
|
|
256
|
+
xmlns?: ReactiveProp<IntrinsicTextValue>;
|
|
257
|
+
}
|
|
258
|
+
>;
|
|
259
|
+
type SvgCircleIntrinsicProps = StructuredContentIntrinsicProps<
|
|
260
|
+
SvgPresentationIntrinsicAllowedProps & {
|
|
261
|
+
cx?: ReactiveProp<IntrinsicTextLikeValue>;
|
|
262
|
+
cy?: ReactiveProp<IntrinsicTextLikeValue>;
|
|
263
|
+
r?: ReactiveProp<IntrinsicTextLikeValue>;
|
|
264
|
+
}
|
|
265
|
+
>;
|
|
266
|
+
type SvgGroupIntrinsicProps =
|
|
267
|
+
StructuredContentIntrinsicProps<SvgPresentationIntrinsicAllowedProps>;
|
|
268
|
+
type SvgPathIntrinsicProps = StructuredContentIntrinsicProps<
|
|
269
|
+
SvgPresentationIntrinsicAllowedProps & {
|
|
270
|
+
d?: ReactiveProp<IntrinsicTextValue>;
|
|
271
|
+
}
|
|
272
|
+
>;
|
|
273
|
+
type SvgRectIntrinsicProps = StructuredContentIntrinsicProps<
|
|
274
|
+
SvgPresentationIntrinsicAllowedProps & {
|
|
275
|
+
height?: ReactiveProp<IntrinsicTextLikeValue>;
|
|
276
|
+
rx?: ReactiveProp<IntrinsicTextLikeValue>;
|
|
277
|
+
ry?: ReactiveProp<IntrinsicTextLikeValue>;
|
|
278
|
+
width?: ReactiveProp<IntrinsicTextLikeValue>;
|
|
279
|
+
x?: ReactiveProp<IntrinsicTextLikeValue>;
|
|
280
|
+
y?: ReactiveProp<IntrinsicTextLikeValue>;
|
|
281
|
+
}
|
|
282
|
+
>;
|
|
244
283
|
interface OptionIntrinsicProps extends IntrinsicProps {
|
|
245
284
|
disabled?: ReactiveProp<IntrinsicBooleanValue>;
|
|
246
285
|
label?: ReactiveProp<IntrinsicTextValue>;
|
|
@@ -324,8 +363,6 @@ interface KnownIntrinsicElementProps {
|
|
|
324
363
|
tr: LayoutIntrinsicProps;
|
|
325
364
|
ul: LayoutIntrinsicProps;
|
|
326
365
|
}
|
|
327
|
-
//#endregion
|
|
328
|
-
//#region src/common/jsx.d.ts
|
|
329
366
|
/** The element type marker for JSX fragments (`<>...</>`), groups children without a wrapper element. */
|
|
330
367
|
declare const Fragment: unique symbol;
|
|
331
368
|
/** A component function accepting `TProps`, usable as a JSX element's `type`. */
|
|
@@ -345,8 +382,6 @@ interface JSXElement {
|
|
|
345
382
|
/** Optional key (normalized by runtime) */
|
|
346
383
|
key?: string | number | null;
|
|
347
384
|
}
|
|
348
|
-
//#endregion
|
|
349
|
-
//#region src/jsx/types.d.ts
|
|
350
385
|
declare global {
|
|
351
386
|
namespace JSX {
|
|
352
387
|
interface Element extends JSXElement {
|
|
@@ -361,5 +396,12 @@ declare global {
|
|
|
361
396
|
}
|
|
362
397
|
}
|
|
363
398
|
}
|
|
364
|
-
|
|
365
|
-
|
|
399
|
+
export {
|
|
400
|
+
IntrinsicFallbackProps,
|
|
401
|
+
JSXElementType,
|
|
402
|
+
JSXComponent,
|
|
403
|
+
KnownIntrinsicElementProps,
|
|
404
|
+
JSXElement,
|
|
405
|
+
Props,
|
|
406
|
+
Fragment,
|
|
407
|
+
};
|