@askrjs/askr 0.0.1 → 0.0.3
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 +18 -10
- package/dist/chunk-2ONGHQ7Z.js +3115 -0
- package/dist/chunk-2ONGHQ7Z.js.map +1 -0
- package/dist/{chunk-UUM5W2RM.js → chunk-H3NSVHA7.js} +2 -6
- package/dist/chunk-H3NSVHA7.js.map +1 -0
- package/dist/chunk-JHOGWTAW.js +16 -0
- package/dist/chunk-JHOGWTAW.js.map +1 -0
- package/dist/chunk-OFW6DFBM.js +716 -0
- package/dist/chunk-OFW6DFBM.js.map +1 -0
- package/dist/chunk-SALJX5PZ.js +26 -0
- package/dist/chunk-SALJX5PZ.js.map +1 -0
- package/dist/index.cjs +2785 -2327
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -45
- package/dist/index.d.ts +100 -45
- package/dist/index.js +430 -84
- package/dist/index.js.map +1 -1
- package/dist/jsx/jsx-dev-runtime.cjs +9 -3
- package/dist/jsx/jsx-dev-runtime.cjs.map +1 -1
- package/dist/jsx/jsx-dev-runtime.d.cts +4 -9
- package/dist/jsx/jsx-dev-runtime.d.ts +4 -9
- package/dist/jsx/jsx-dev-runtime.js +7 -4
- package/dist/jsx/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx/jsx-runtime.cjs +14 -5
- package/dist/jsx/jsx-runtime.cjs.map +1 -1
- package/dist/jsx/jsx-runtime.d.cts +9 -6
- package/dist/jsx/jsx-runtime.d.ts +9 -6
- package/dist/jsx/jsx-runtime.js +6 -4
- package/dist/{navigate-NLQOZQGM.js → navigate-CZEUXFPM.js} +5 -5
- package/dist/{route-TVYWYCEJ.js → route-USEXGOBT.js} +4 -4
- package/dist/{ssr-4ELUFK65.js → ssr-QJ5NTQR6.js} +9 -5
- package/dist/{types-DUDmnzD8.d.cts → types-DLTViI21.d.cts} +15 -3
- package/dist/{types-DUDmnzD8.d.ts → types-DLTViI21.d.ts} +15 -3
- package/package.json +7 -4
- package/src/jsx/index.ts +4 -0
- package/src/jsx/jsx-dev-runtime.ts +7 -10
- package/src/jsx/jsx-runtime.ts +23 -11
- package/src/jsx/types.ts +22 -3
- package/src/jsx/utils.ts +19 -0
- package/dist/chunk-4CV4JOE5.js +0 -27
- package/dist/chunk-HIWJVOS4.js +0 -503
- package/dist/chunk-HIWJVOS4.js.map +0 -1
- package/dist/chunk-L7RL4LYV.js +0 -3442
- package/dist/chunk-L7RL4LYV.js.map +0 -1
- package/dist/chunk-UUM5W2RM.js.map +0 -1
- package/dist/chunk-YNH3D4KW.js +0 -29
- package/dist/chunk-YNH3D4KW.js.map +0 -1
- package/dist/ssr-4ELUFK65.js.map +0 -1
- package/src/jsx/react-jsx-runtime.d.ts +0 -0
- /package/dist/{chunk-4CV4JOE5.js.map → navigate-CZEUXFPM.js.map} +0 -0
- /package/dist/{navigate-NLQOZQGM.js.map → route-USEXGOBT.js.map} +0 -0
- /package/dist/{route-TVYWYCEJ.js.map → ssr-QJ5NTQR6.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as JSXElement, P as Props } from './types-
|
|
1
|
+
import { J as JSXElement, P as Props } from './types-DLTViI21.cjs';
|
|
2
2
|
export { Fragment, jsx, jsxs } from './jsx/jsx-runtime.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -28,7 +28,7 @@ interface Context<T> {
|
|
|
28
28
|
readonly key: ContextKey;
|
|
29
29
|
readonly defaultValue: T;
|
|
30
30
|
readonly Scope: (props: {
|
|
31
|
-
value:
|
|
31
|
+
value: unknown;
|
|
32
32
|
children?: unknown;
|
|
33
33
|
}) => JSXElement;
|
|
34
34
|
}
|
|
@@ -60,6 +60,7 @@ interface ComponentInstance {
|
|
|
60
60
|
mounted: boolean;
|
|
61
61
|
abortController: AbortController;
|
|
62
62
|
ssr?: boolean;
|
|
63
|
+
cleanupStrict?: boolean;
|
|
63
64
|
stateValues: State<unknown>[];
|
|
64
65
|
evaluationGeneration: number;
|
|
65
66
|
notifyUpdate: (() => void) | null;
|
|
@@ -78,6 +79,7 @@ interface ComponentInstance {
|
|
|
78
79
|
lastRenderToken?: number;
|
|
79
80
|
_pendingReadStates?: Set<State<unknown>>;
|
|
80
81
|
_lastReadStates?: Set<State<unknown>>;
|
|
82
|
+
_placeholder?: Comment;
|
|
81
83
|
}
|
|
82
84
|
/**
|
|
83
85
|
* Get the abort signal for the current component
|
|
@@ -145,6 +147,7 @@ declare function getSignal(): AbortSignal;
|
|
|
145
147
|
interface State<T> {
|
|
146
148
|
(): T;
|
|
147
149
|
set(value: T): void;
|
|
150
|
+
set(updater: (prev: T) => T): void;
|
|
148
151
|
_hasBeenRead?: boolean;
|
|
149
152
|
_readers?: Map<ComponentInstance, number>;
|
|
150
153
|
}
|
|
@@ -197,6 +200,8 @@ interface DataResult<T> {
|
|
|
197
200
|
declare function resource<T>(fn: (opts: {
|
|
198
201
|
signal: AbortSignal;
|
|
199
202
|
}) => Promise<T> | T, deps?: unknown[]): DataResult<T>;
|
|
203
|
+
declare function derive<TOut>(fn: () => TOut): TOut | null;
|
|
204
|
+
declare function task(fn: () => void | (() => void) | Promise<void | (() => void)>): void;
|
|
200
205
|
|
|
201
206
|
/**
|
|
202
207
|
* Route definition and matching
|
|
@@ -240,7 +245,8 @@ interface RouteSnapshot {
|
|
|
240
245
|
matches: readonly RouteMatch[];
|
|
241
246
|
}
|
|
242
247
|
declare function setServerLocation(url: string | null): void;
|
|
243
|
-
declare function route(
|
|
248
|
+
declare function route(): RouteSnapshot;
|
|
249
|
+
declare function route(path: string, handler?: RouteHandler, namespace?: string): void;
|
|
244
250
|
/**
|
|
245
251
|
* Get all registered routes
|
|
246
252
|
*/
|
|
@@ -266,35 +272,22 @@ declare function getLoadedNamespaces(): string[];
|
|
|
266
272
|
* App bootstrap and mount
|
|
267
273
|
*/
|
|
268
274
|
|
|
269
|
-
interface AppConfig {
|
|
270
|
-
root: Element | string;
|
|
271
|
-
component: ComponentFunction;
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Bootstrap and mount app on client
|
|
275
|
-
* Supports both sync and async components
|
|
276
|
-
*
|
|
277
|
-
* If createApp is called multiple times on the same root, the existing instance
|
|
278
|
-
* is reused and its component function is updated. This ensures:
|
|
279
|
-
* - Generation tokens work correctly (old async renders don't overwrite new ones)
|
|
280
|
-
* - State is preserved across updates (if desired)
|
|
281
|
-
* - DOM is diffed/updated rather than replaced
|
|
282
|
-
*/
|
|
283
|
-
declare function createApp(config: AppConfig | SPAConfig): void;
|
|
284
|
-
|
|
285
275
|
type IslandConfig = {
|
|
286
276
|
root: Element | string;
|
|
287
277
|
component: ComponentFunction;
|
|
278
|
+
cleanupStrict?: boolean;
|
|
288
279
|
routes?: never;
|
|
289
280
|
};
|
|
290
281
|
type SPAConfig = {
|
|
291
282
|
root: Element | string;
|
|
292
283
|
routes: Route[];
|
|
284
|
+
cleanupStrict?: boolean;
|
|
293
285
|
component?: never;
|
|
294
286
|
};
|
|
295
287
|
type HydrateSPAConfig = {
|
|
296
288
|
root: Element | string;
|
|
297
289
|
routes: Route[];
|
|
290
|
+
cleanupStrict?: boolean;
|
|
298
291
|
};
|
|
299
292
|
/**
|
|
300
293
|
* createIsland: Enhances existing DOM (no router, mounts once)
|
|
@@ -318,24 +311,6 @@ declare function cleanupApp(root: Element | string): void;
|
|
|
318
311
|
*/
|
|
319
312
|
declare function hasApp(root: Element | string): boolean;
|
|
320
313
|
|
|
321
|
-
/**
|
|
322
|
-
* Small layout helper (centralized)
|
|
323
|
-
* Usage: const parent = layout(ParentLayout); route('/parent', () => parent(<Child />));
|
|
324
|
-
*
|
|
325
|
-
* A layout is simply a component that receives `children`.
|
|
326
|
-
* This helper intentionally avoids vnode inspection, heuristics, or double-invocation.
|
|
327
|
-
* Prefer boring, explicit code over cleverness.
|
|
328
|
-
*
|
|
329
|
-
* Example:
|
|
330
|
-
* const Parent = ({ children }: { children?: unknown }) => <div class="parent">{children}</div>;
|
|
331
|
-
* const parent = layout(Parent);
|
|
332
|
-
* route('/parent', () => parent(<div class="child">C</div>));
|
|
333
|
-
*/
|
|
334
|
-
type Component<P = object> = (props: P & {
|
|
335
|
-
children?: unknown;
|
|
336
|
-
}) => unknown;
|
|
337
|
-
declare function layout<P>(Layout: Component<P>): (children?: unknown) => unknown;
|
|
338
|
-
|
|
339
314
|
/**
|
|
340
315
|
* Client-side navigation with History API
|
|
341
316
|
*/
|
|
@@ -349,7 +324,6 @@ declare function navigate(path: string): void;
|
|
|
349
324
|
/**
|
|
350
325
|
* Link component for client-side navigation
|
|
351
326
|
*/
|
|
352
|
-
|
|
353
327
|
interface LinkProps {
|
|
354
328
|
href: string;
|
|
355
329
|
children?: unknown;
|
|
@@ -364,9 +338,92 @@ interface LinkProps {
|
|
|
364
338
|
* - Shift+click (opens in new window)
|
|
365
339
|
* - Right-click context menu
|
|
366
340
|
*/
|
|
367
|
-
declare function Link({ href, children }: LinkProps):
|
|
341
|
+
declare function Link({ href, children }: LinkProps): unknown;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Layout helper.
|
|
345
|
+
*
|
|
346
|
+
* A layout is just a normal component that wraps children.
|
|
347
|
+
* Persistence and reuse are handled by the runtime via component identity.
|
|
348
|
+
*
|
|
349
|
+
* This helper exists purely for readability and convention.
|
|
350
|
+
*/
|
|
351
|
+
type LayoutComponent<P = object> = (props: P & {
|
|
352
|
+
children?: unknown;
|
|
353
|
+
}) => unknown;
|
|
354
|
+
declare function layout<P = object>(Layout: LayoutComponent<P>): (children?: unknown, props?: P) => unknown;
|
|
355
|
+
|
|
356
|
+
type SlotProps = {
|
|
357
|
+
asChild: true;
|
|
358
|
+
children: JSXElement;
|
|
359
|
+
[key: string]: unknown;
|
|
360
|
+
} | {
|
|
361
|
+
asChild?: false;
|
|
362
|
+
children?: unknown;
|
|
363
|
+
};
|
|
364
|
+
declare function Slot(props: SlotProps): JSXElement | null;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Portal / Host primitive.
|
|
368
|
+
*
|
|
369
|
+
* A portal is a named render slot within the existing tree.
|
|
370
|
+
* It does NOT create a second tree or touch the DOM directly.
|
|
371
|
+
*/
|
|
372
|
+
interface Portal<T = unknown> {
|
|
373
|
+
/** Mount point — rendered exactly once */
|
|
374
|
+
(): unknown;
|
|
375
|
+
/** Render content into the portal */
|
|
376
|
+
render(props: {
|
|
377
|
+
children?: T;
|
|
378
|
+
}): unknown;
|
|
379
|
+
}
|
|
380
|
+
declare function definePortal<T = unknown>(): Portal<T>;
|
|
381
|
+
/**
|
|
382
|
+
* Reset the default portal state. Used by tests to ensure isolation.
|
|
383
|
+
* @internal
|
|
384
|
+
*/
|
|
385
|
+
declare function _resetDefaultPortal(): void;
|
|
386
|
+
declare const DefaultPortal: Portal<unknown>;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* SSR Context Management
|
|
390
|
+
*
|
|
391
|
+
* Provides context for server-side rendering including:
|
|
392
|
+
* - SSRContext: Full context for sink-based streaming SSR
|
|
393
|
+
* - RenderContext: Lightweight context for sync render passes
|
|
394
|
+
*/
|
|
368
395
|
|
|
369
396
|
type SSRData = Record<string, unknown>;
|
|
397
|
+
/** Lightweight context for synchronous render passes */
|
|
398
|
+
type RenderContext = {
|
|
399
|
+
seed: number;
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Shared SSR types
|
|
404
|
+
*/
|
|
405
|
+
|
|
406
|
+
/** VNode representation for SSR rendering */
|
|
407
|
+
type VNode = {
|
|
408
|
+
type: string | SSRComponent;
|
|
409
|
+
props?: Props;
|
|
410
|
+
children?: unknown[];
|
|
411
|
+
};
|
|
412
|
+
/**
|
|
413
|
+
* Component function signature for SSR.
|
|
414
|
+
* Components receive props and an optional context with signal and SSR context.
|
|
415
|
+
*/
|
|
416
|
+
type SSRComponent = (props: Props, context?: {
|
|
417
|
+
signal?: AbortSignal;
|
|
418
|
+
ssr?: RenderContext;
|
|
419
|
+
}) => VNode | JSXElement | string | number | boolean | null;
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* SSR Data Management
|
|
423
|
+
*
|
|
424
|
+
* Manages render-phase keying for deterministic SSR data lookup.
|
|
425
|
+
* Note: SSR collection/prepass APIs have been removed — SSR is strictly synchronous.
|
|
426
|
+
*/
|
|
370
427
|
|
|
371
428
|
type ResourceDescriptor = {
|
|
372
429
|
key: string;
|
|
@@ -379,11 +436,14 @@ type ResourceDescriptor = {
|
|
|
379
436
|
type ResourcePlan = {
|
|
380
437
|
resources: ResourceDescriptor[];
|
|
381
438
|
};
|
|
439
|
+
/** @deprecated SSR prepass has been removed */
|
|
382
440
|
declare function resolvePlan(_plan: ResourcePlan): Promise<Record<string, unknown>>;
|
|
441
|
+
/** @deprecated SSR prepass has been removed */
|
|
383
442
|
declare function collectResources(_opts: {
|
|
384
443
|
url: string;
|
|
385
444
|
routes: SSRRoute[];
|
|
386
445
|
}): ResourcePlan;
|
|
446
|
+
/** @deprecated Alias for resolvePlan */
|
|
387
447
|
declare const resolveResources: typeof resolvePlan;
|
|
388
448
|
|
|
389
449
|
/**
|
|
@@ -395,11 +455,6 @@ declare const resolveResources: typeof resolvePlan;
|
|
|
395
455
|
* when an async component or async resource is encountered during sync SSR.
|
|
396
456
|
*/
|
|
397
457
|
|
|
398
|
-
type VNode = {
|
|
399
|
-
type: string;
|
|
400
|
-
props?: Props;
|
|
401
|
-
children?: (string | VNode | null | undefined | false)[];
|
|
402
|
-
};
|
|
403
458
|
/**
|
|
404
459
|
* Single synchronous SSR entrypoint: render a component to an HTML string.
|
|
405
460
|
* This is strictly synchronous and deterministic. Optionally provide a seed
|
|
@@ -443,4 +498,4 @@ declare function renderToStream(opts: {
|
|
|
443
498
|
onComplete(): void;
|
|
444
499
|
}): void;
|
|
445
500
|
|
|
446
|
-
export { type Context, type DataResult, type HydrateSPAConfig, type IslandConfig, Link, type LinkProps, Props, type Route, type RouteHandler, type RouteMatch, type RouteSnapshot, type SPAConfig, type State, cleanupApp, clearRoutes, collectResources,
|
|
501
|
+
export { type Context, type DataResult, DefaultPortal, type HydrateSPAConfig, type IslandConfig, type LayoutComponent, Link, type LinkProps, type Portal, Props, type Route, type RouteHandler, type RouteMatch, type RouteSnapshot, type SPAConfig, Slot, type SlotProps, type State, _resetDefaultPortal, cleanupApp, clearRoutes, collectResources, createIsland, createSPA, defineContext, definePortal, derive, getLoadedNamespaces, getNamespaceRoutes, getRoutes, getSignal, hasApp, hydrateSPA, layout, navigate, readContext, renderToStream, renderToString, renderToStringSync, renderToStringSyncForUrl, resolveResources, resource, route, scheduleEventHandler, setServerLocation, state, task, unloadNamespace };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as JSXElement, P as Props } from './types-
|
|
1
|
+
import { J as JSXElement, P as Props } from './types-DLTViI21.js';
|
|
2
2
|
export { Fragment, jsx, jsxs } from './jsx/jsx-runtime.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -28,7 +28,7 @@ interface Context<T> {
|
|
|
28
28
|
readonly key: ContextKey;
|
|
29
29
|
readonly defaultValue: T;
|
|
30
30
|
readonly Scope: (props: {
|
|
31
|
-
value:
|
|
31
|
+
value: unknown;
|
|
32
32
|
children?: unknown;
|
|
33
33
|
}) => JSXElement;
|
|
34
34
|
}
|
|
@@ -60,6 +60,7 @@ interface ComponentInstance {
|
|
|
60
60
|
mounted: boolean;
|
|
61
61
|
abortController: AbortController;
|
|
62
62
|
ssr?: boolean;
|
|
63
|
+
cleanupStrict?: boolean;
|
|
63
64
|
stateValues: State<unknown>[];
|
|
64
65
|
evaluationGeneration: number;
|
|
65
66
|
notifyUpdate: (() => void) | null;
|
|
@@ -78,6 +79,7 @@ interface ComponentInstance {
|
|
|
78
79
|
lastRenderToken?: number;
|
|
79
80
|
_pendingReadStates?: Set<State<unknown>>;
|
|
80
81
|
_lastReadStates?: Set<State<unknown>>;
|
|
82
|
+
_placeholder?: Comment;
|
|
81
83
|
}
|
|
82
84
|
/**
|
|
83
85
|
* Get the abort signal for the current component
|
|
@@ -145,6 +147,7 @@ declare function getSignal(): AbortSignal;
|
|
|
145
147
|
interface State<T> {
|
|
146
148
|
(): T;
|
|
147
149
|
set(value: T): void;
|
|
150
|
+
set(updater: (prev: T) => T): void;
|
|
148
151
|
_hasBeenRead?: boolean;
|
|
149
152
|
_readers?: Map<ComponentInstance, number>;
|
|
150
153
|
}
|
|
@@ -197,6 +200,8 @@ interface DataResult<T> {
|
|
|
197
200
|
declare function resource<T>(fn: (opts: {
|
|
198
201
|
signal: AbortSignal;
|
|
199
202
|
}) => Promise<T> | T, deps?: unknown[]): DataResult<T>;
|
|
203
|
+
declare function derive<TOut>(fn: () => TOut): TOut | null;
|
|
204
|
+
declare function task(fn: () => void | (() => void) | Promise<void | (() => void)>): void;
|
|
200
205
|
|
|
201
206
|
/**
|
|
202
207
|
* Route definition and matching
|
|
@@ -240,7 +245,8 @@ interface RouteSnapshot {
|
|
|
240
245
|
matches: readonly RouteMatch[];
|
|
241
246
|
}
|
|
242
247
|
declare function setServerLocation(url: string | null): void;
|
|
243
|
-
declare function route(
|
|
248
|
+
declare function route(): RouteSnapshot;
|
|
249
|
+
declare function route(path: string, handler?: RouteHandler, namespace?: string): void;
|
|
244
250
|
/**
|
|
245
251
|
* Get all registered routes
|
|
246
252
|
*/
|
|
@@ -266,35 +272,22 @@ declare function getLoadedNamespaces(): string[];
|
|
|
266
272
|
* App bootstrap and mount
|
|
267
273
|
*/
|
|
268
274
|
|
|
269
|
-
interface AppConfig {
|
|
270
|
-
root: Element | string;
|
|
271
|
-
component: ComponentFunction;
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Bootstrap and mount app on client
|
|
275
|
-
* Supports both sync and async components
|
|
276
|
-
*
|
|
277
|
-
* If createApp is called multiple times on the same root, the existing instance
|
|
278
|
-
* is reused and its component function is updated. This ensures:
|
|
279
|
-
* - Generation tokens work correctly (old async renders don't overwrite new ones)
|
|
280
|
-
* - State is preserved across updates (if desired)
|
|
281
|
-
* - DOM is diffed/updated rather than replaced
|
|
282
|
-
*/
|
|
283
|
-
declare function createApp(config: AppConfig | SPAConfig): void;
|
|
284
|
-
|
|
285
275
|
type IslandConfig = {
|
|
286
276
|
root: Element | string;
|
|
287
277
|
component: ComponentFunction;
|
|
278
|
+
cleanupStrict?: boolean;
|
|
288
279
|
routes?: never;
|
|
289
280
|
};
|
|
290
281
|
type SPAConfig = {
|
|
291
282
|
root: Element | string;
|
|
292
283
|
routes: Route[];
|
|
284
|
+
cleanupStrict?: boolean;
|
|
293
285
|
component?: never;
|
|
294
286
|
};
|
|
295
287
|
type HydrateSPAConfig = {
|
|
296
288
|
root: Element | string;
|
|
297
289
|
routes: Route[];
|
|
290
|
+
cleanupStrict?: boolean;
|
|
298
291
|
};
|
|
299
292
|
/**
|
|
300
293
|
* createIsland: Enhances existing DOM (no router, mounts once)
|
|
@@ -318,24 +311,6 @@ declare function cleanupApp(root: Element | string): void;
|
|
|
318
311
|
*/
|
|
319
312
|
declare function hasApp(root: Element | string): boolean;
|
|
320
313
|
|
|
321
|
-
/**
|
|
322
|
-
* Small layout helper (centralized)
|
|
323
|
-
* Usage: const parent = layout(ParentLayout); route('/parent', () => parent(<Child />));
|
|
324
|
-
*
|
|
325
|
-
* A layout is simply a component that receives `children`.
|
|
326
|
-
* This helper intentionally avoids vnode inspection, heuristics, or double-invocation.
|
|
327
|
-
* Prefer boring, explicit code over cleverness.
|
|
328
|
-
*
|
|
329
|
-
* Example:
|
|
330
|
-
* const Parent = ({ children }: { children?: unknown }) => <div class="parent">{children}</div>;
|
|
331
|
-
* const parent = layout(Parent);
|
|
332
|
-
* route('/parent', () => parent(<div class="child">C</div>));
|
|
333
|
-
*/
|
|
334
|
-
type Component<P = object> = (props: P & {
|
|
335
|
-
children?: unknown;
|
|
336
|
-
}) => unknown;
|
|
337
|
-
declare function layout<P>(Layout: Component<P>): (children?: unknown) => unknown;
|
|
338
|
-
|
|
339
314
|
/**
|
|
340
315
|
* Client-side navigation with History API
|
|
341
316
|
*/
|
|
@@ -349,7 +324,6 @@ declare function navigate(path: string): void;
|
|
|
349
324
|
/**
|
|
350
325
|
* Link component for client-side navigation
|
|
351
326
|
*/
|
|
352
|
-
|
|
353
327
|
interface LinkProps {
|
|
354
328
|
href: string;
|
|
355
329
|
children?: unknown;
|
|
@@ -364,9 +338,92 @@ interface LinkProps {
|
|
|
364
338
|
* - Shift+click (opens in new window)
|
|
365
339
|
* - Right-click context menu
|
|
366
340
|
*/
|
|
367
|
-
declare function Link({ href, children }: LinkProps):
|
|
341
|
+
declare function Link({ href, children }: LinkProps): unknown;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Layout helper.
|
|
345
|
+
*
|
|
346
|
+
* A layout is just a normal component that wraps children.
|
|
347
|
+
* Persistence and reuse are handled by the runtime via component identity.
|
|
348
|
+
*
|
|
349
|
+
* This helper exists purely for readability and convention.
|
|
350
|
+
*/
|
|
351
|
+
type LayoutComponent<P = object> = (props: P & {
|
|
352
|
+
children?: unknown;
|
|
353
|
+
}) => unknown;
|
|
354
|
+
declare function layout<P = object>(Layout: LayoutComponent<P>): (children?: unknown, props?: P) => unknown;
|
|
355
|
+
|
|
356
|
+
type SlotProps = {
|
|
357
|
+
asChild: true;
|
|
358
|
+
children: JSXElement;
|
|
359
|
+
[key: string]: unknown;
|
|
360
|
+
} | {
|
|
361
|
+
asChild?: false;
|
|
362
|
+
children?: unknown;
|
|
363
|
+
};
|
|
364
|
+
declare function Slot(props: SlotProps): JSXElement | null;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Portal / Host primitive.
|
|
368
|
+
*
|
|
369
|
+
* A portal is a named render slot within the existing tree.
|
|
370
|
+
* It does NOT create a second tree or touch the DOM directly.
|
|
371
|
+
*/
|
|
372
|
+
interface Portal<T = unknown> {
|
|
373
|
+
/** Mount point — rendered exactly once */
|
|
374
|
+
(): unknown;
|
|
375
|
+
/** Render content into the portal */
|
|
376
|
+
render(props: {
|
|
377
|
+
children?: T;
|
|
378
|
+
}): unknown;
|
|
379
|
+
}
|
|
380
|
+
declare function definePortal<T = unknown>(): Portal<T>;
|
|
381
|
+
/**
|
|
382
|
+
* Reset the default portal state. Used by tests to ensure isolation.
|
|
383
|
+
* @internal
|
|
384
|
+
*/
|
|
385
|
+
declare function _resetDefaultPortal(): void;
|
|
386
|
+
declare const DefaultPortal: Portal<unknown>;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* SSR Context Management
|
|
390
|
+
*
|
|
391
|
+
* Provides context for server-side rendering including:
|
|
392
|
+
* - SSRContext: Full context for sink-based streaming SSR
|
|
393
|
+
* - RenderContext: Lightweight context for sync render passes
|
|
394
|
+
*/
|
|
368
395
|
|
|
369
396
|
type SSRData = Record<string, unknown>;
|
|
397
|
+
/** Lightweight context for synchronous render passes */
|
|
398
|
+
type RenderContext = {
|
|
399
|
+
seed: number;
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Shared SSR types
|
|
404
|
+
*/
|
|
405
|
+
|
|
406
|
+
/** VNode representation for SSR rendering */
|
|
407
|
+
type VNode = {
|
|
408
|
+
type: string | SSRComponent;
|
|
409
|
+
props?: Props;
|
|
410
|
+
children?: unknown[];
|
|
411
|
+
};
|
|
412
|
+
/**
|
|
413
|
+
* Component function signature for SSR.
|
|
414
|
+
* Components receive props and an optional context with signal and SSR context.
|
|
415
|
+
*/
|
|
416
|
+
type SSRComponent = (props: Props, context?: {
|
|
417
|
+
signal?: AbortSignal;
|
|
418
|
+
ssr?: RenderContext;
|
|
419
|
+
}) => VNode | JSXElement | string | number | boolean | null;
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* SSR Data Management
|
|
423
|
+
*
|
|
424
|
+
* Manages render-phase keying for deterministic SSR data lookup.
|
|
425
|
+
* Note: SSR collection/prepass APIs have been removed — SSR is strictly synchronous.
|
|
426
|
+
*/
|
|
370
427
|
|
|
371
428
|
type ResourceDescriptor = {
|
|
372
429
|
key: string;
|
|
@@ -379,11 +436,14 @@ type ResourceDescriptor = {
|
|
|
379
436
|
type ResourcePlan = {
|
|
380
437
|
resources: ResourceDescriptor[];
|
|
381
438
|
};
|
|
439
|
+
/** @deprecated SSR prepass has been removed */
|
|
382
440
|
declare function resolvePlan(_plan: ResourcePlan): Promise<Record<string, unknown>>;
|
|
441
|
+
/** @deprecated SSR prepass has been removed */
|
|
383
442
|
declare function collectResources(_opts: {
|
|
384
443
|
url: string;
|
|
385
444
|
routes: SSRRoute[];
|
|
386
445
|
}): ResourcePlan;
|
|
446
|
+
/** @deprecated Alias for resolvePlan */
|
|
387
447
|
declare const resolveResources: typeof resolvePlan;
|
|
388
448
|
|
|
389
449
|
/**
|
|
@@ -395,11 +455,6 @@ declare const resolveResources: typeof resolvePlan;
|
|
|
395
455
|
* when an async component or async resource is encountered during sync SSR.
|
|
396
456
|
*/
|
|
397
457
|
|
|
398
|
-
type VNode = {
|
|
399
|
-
type: string;
|
|
400
|
-
props?: Props;
|
|
401
|
-
children?: (string | VNode | null | undefined | false)[];
|
|
402
|
-
};
|
|
403
458
|
/**
|
|
404
459
|
* Single synchronous SSR entrypoint: render a component to an HTML string.
|
|
405
460
|
* This is strictly synchronous and deterministic. Optionally provide a seed
|
|
@@ -443,4 +498,4 @@ declare function renderToStream(opts: {
|
|
|
443
498
|
onComplete(): void;
|
|
444
499
|
}): void;
|
|
445
500
|
|
|
446
|
-
export { type Context, type DataResult, type HydrateSPAConfig, type IslandConfig, Link, type LinkProps, Props, type Route, type RouteHandler, type RouteMatch, type RouteSnapshot, type SPAConfig, type State, cleanupApp, clearRoutes, collectResources,
|
|
501
|
+
export { type Context, type DataResult, DefaultPortal, type HydrateSPAConfig, type IslandConfig, type LayoutComponent, Link, type LinkProps, type Portal, Props, type Route, type RouteHandler, type RouteMatch, type RouteSnapshot, type SPAConfig, Slot, type SlotProps, type State, _resetDefaultPortal, cleanupApp, clearRoutes, collectResources, createIsland, createSPA, defineContext, definePortal, derive, getLoadedNamespaces, getNamespaceRoutes, getRoutes, getSignal, hasApp, hydrateSPA, layout, navigate, readContext, renderToStream, renderToString, renderToStringSync, renderToStringSyncForUrl, resolveResources, resource, route, scheduleEventHandler, setServerLocation, state, task, unloadNamespace };
|