@craft-ts/component 0.7.0-beta.13 → 0.7.0-beta.16
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 +7 -2
- package/src/index.d.ts +40 -40
- package/src/index.js +35 -35
- package/src/lib/a11y-control.d.ts +0 -1
- package/src/lib/a11y-control.js +0 -1
- package/src/lib/a11y.d.ts +4 -5
- package/src/lib/a11y.js +3 -4
- package/src/lib/ai/ai-context-menu.d.ts +24 -25
- package/src/lib/ai/ai-context-menu.js +2 -3
- package/src/lib/ai/ai-send-dialog.d.ts +277 -278
- package/src/lib/ai/ai-send-dialog.js +4 -5
- package/src/lib/ai/send-context-to-ai.d.ts +1 -2
- package/src/lib/ai/send-context-to-ai.js +4 -5
- package/src/lib/assert-defined-input.d.ts +1 -2
- package/src/lib/assert-defined-input.js +0 -1
- package/src/lib/bootstrap.d.ts +4 -3
- package/src/lib/bootstrap.js +6 -8
- package/src/lib/bridge.d.ts +9 -10
- package/src/lib/bridge.js +3 -4
- package/src/lib/catch-node.d.ts +35 -0
- package/src/lib/{block.js → catch-node.js} +9 -10
- package/src/lib/component.d.ts +23 -10
- package/src/lib/component.js +5 -6
- package/src/lib/composition.d.ts +1 -2
- package/src/lib/composition.js +2 -3
- package/src/lib/craft-defaults.d.ts +0 -1
- package/src/lib/craft-defaults.js +4 -5
- package/src/lib/craft-host-tokens.d.ts +0 -1
- package/src/lib/craft-host-tokens.js +0 -1
- package/src/lib/craft-router-outlet.d.ts +1 -2
- package/src/lib/craft-router-outlet.js +1 -2
- package/src/lib/css-vars.d.ts +0 -1
- package/src/lib/css-vars.js +0 -1
- package/src/lib/css-vars.type.d.ts +1 -2
- package/src/lib/css-vars.type.js +0 -1
- package/src/lib/{defer.d.ts → defer-node.d.ts} +4 -5
- package/src/lib/{defer.js → defer-node.js} +1 -2
- package/src/lib/directive.d.ts +1 -2
- package/src/lib/directive.js +1 -2
- package/src/lib/factory-runtime.d.ts +1 -2
- package/src/lib/factory-runtime.js +0 -1
- package/src/lib/{field-exception-block.d.ts → field-error-node.d.ts} +22 -23
- package/src/lib/{field-exception-block.js → field-error-node.js} +8 -9
- package/src/lib/for-node.d.ts +28 -0
- package/src/lib/{each.js → for-node.js} +4 -5
- package/src/lib/for-scheduling.d.ts +58 -0
- package/src/lib/{each-scheduling.js → for-scheduling.js} +14 -15
- package/src/lib/host-runtime.d.ts +0 -1
- package/src/lib/host-runtime.js +0 -1
- package/src/lib/hydrate.d.ts +2 -3
- package/src/lib/hydrate.js +57 -18
- package/src/lib/hyperscript.d.ts +1 -2
- package/src/lib/hyperscript.js +1 -2
- package/src/lib/if-node.d.ts +7 -0
- package/src/lib/{if-block.js → if-node.js} +2 -3
- package/src/lib/locator.d.ts +5 -6
- package/src/lib/locator.js +1 -2
- package/src/lib/{match-block.d.ts → match-node.d.ts} +8 -9
- package/src/lib/{match-block.js → match-node.js} +3 -4
- package/src/lib/{pending-block.d.ts → pending-node.d.ts} +28 -29
- package/src/lib/{pending-block.js → pending-node.js} +12 -13
- package/src/lib/project.d.ts +2 -3
- package/src/lib/project.js +2 -3
- package/src/lib/render/hydration-metadata.d.ts +0 -1
- package/src/lib/render/hydration-metadata.js +0 -1
- package/src/lib/render/hydration.d.ts +0 -1
- package/src/lib/render/hydration.js +0 -1
- package/src/lib/render/interpreter.d.ts +9 -8
- package/src/lib/render/interpreter.js +156 -81
- package/src/lib/render/server-style-collector.d.ts +0 -1
- package/src/lib/render/server-style-collector.js +0 -1
- package/src/lib/render/ssr-coordinator.d.ts +4 -2
- package/src/lib/render/ssr-coordinator.js +14 -3
- package/src/lib/render/string-dom.d.ts +0 -1
- package/src/lib/render/string-dom.js +48 -7
- package/src/lib/render/style-registry.d.ts +3 -2
- package/src/lib/render/style-registry.js +3 -2
- package/src/lib/render/style-scope.d.ts +0 -1
- package/src/lib/render/style-scope.js +0 -1
- package/src/lib/render/vnode.d.ts +117 -54
- package/src/lib/render/vnode.js +26 -27
- package/src/lib/security.d.ts +54 -0
- package/src/lib/security.js +502 -0
- package/src/lib/server-render.d.ts +12 -3
- package/src/lib/server-render.js +76 -17
- package/src/lib/start.d.ts +2 -3
- package/src/lib/start.js +3 -3
- package/src/lib/template-contract.d.ts +22 -23
- package/src/lib/template-contract.js +0 -1
- package/src/lib/template.d.ts +2 -3
- package/src/lib/template.js +2 -3
- package/src/lib/testing.d.ts +3 -4
- package/src/lib/testing.js +5 -6
- package/src/lib/types.d.ts +40 -28
- package/src/lib/types.js +3 -4
- package/testing/public-api.d.ts +0 -1
- package/testing/public-api.js +0 -1
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/a11y-control.d.ts.map +0 -1
- package/src/lib/a11y-control.js.map +0 -1
- package/src/lib/a11y.d.ts.map +0 -1
- package/src/lib/a11y.js.map +0 -1
- package/src/lib/ai/ai-context-menu.d.ts.map +0 -1
- package/src/lib/ai/ai-context-menu.js.map +0 -1
- package/src/lib/ai/ai-send-dialog.d.ts.map +0 -1
- package/src/lib/ai/ai-send-dialog.js.map +0 -1
- package/src/lib/ai/send-context-to-ai.d.ts.map +0 -1
- package/src/lib/ai/send-context-to-ai.js.map +0 -1
- package/src/lib/assert-defined-input.d.ts.map +0 -1
- package/src/lib/assert-defined-input.js.map +0 -1
- package/src/lib/block.d.ts +0 -36
- package/src/lib/block.d.ts.map +0 -1
- package/src/lib/block.js.map +0 -1
- package/src/lib/bootstrap.d.ts.map +0 -1
- package/src/lib/bootstrap.js.map +0 -1
- package/src/lib/bridge.d.ts.map +0 -1
- package/src/lib/bridge.js.map +0 -1
- package/src/lib/component.d.ts.map +0 -1
- package/src/lib/component.js.map +0 -1
- package/src/lib/composition.d.ts.map +0 -1
- package/src/lib/composition.js.map +0 -1
- package/src/lib/craft-defaults.d.ts.map +0 -1
- package/src/lib/craft-defaults.js.map +0 -1
- package/src/lib/craft-host-tokens.d.ts.map +0 -1
- package/src/lib/craft-host-tokens.js.map +0 -1
- package/src/lib/craft-router-outlet.d.ts.map +0 -1
- package/src/lib/craft-router-outlet.js.map +0 -1
- package/src/lib/css-vars.d.ts.map +0 -1
- package/src/lib/css-vars.js.map +0 -1
- package/src/lib/css-vars.type.d.ts.map +0 -1
- package/src/lib/css-vars.type.js.map +0 -1
- package/src/lib/defer.d.ts.map +0 -1
- package/src/lib/defer.js.map +0 -1
- package/src/lib/directive.d.ts.map +0 -1
- package/src/lib/directive.js.map +0 -1
- package/src/lib/each-scheduling.d.ts +0 -59
- package/src/lib/each-scheduling.d.ts.map +0 -1
- package/src/lib/each-scheduling.js.map +0 -1
- package/src/lib/each.d.ts +0 -29
- package/src/lib/each.d.ts.map +0 -1
- package/src/lib/each.js.map +0 -1
- package/src/lib/factory-runtime.d.ts.map +0 -1
- package/src/lib/factory-runtime.js.map +0 -1
- package/src/lib/field-exception-block.d.ts.map +0 -1
- package/src/lib/field-exception-block.js.map +0 -1
- package/src/lib/host-runtime.d.ts.map +0 -1
- package/src/lib/host-runtime.js.map +0 -1
- package/src/lib/hydrate.d.ts.map +0 -1
- package/src/lib/hydrate.js.map +0 -1
- package/src/lib/hyperscript.d.ts.map +0 -1
- package/src/lib/hyperscript.js.map +0 -1
- package/src/lib/if-block.d.ts +0 -8
- package/src/lib/if-block.d.ts.map +0 -1
- package/src/lib/if-block.js.map +0 -1
- package/src/lib/locator.d.ts.map +0 -1
- package/src/lib/locator.js.map +0 -1
- package/src/lib/match-block.d.ts.map +0 -1
- package/src/lib/match-block.js.map +0 -1
- package/src/lib/pending-block.d.ts.map +0 -1
- package/src/lib/pending-block.js.map +0 -1
- package/src/lib/project.d.ts.map +0 -1
- package/src/lib/project.js.map +0 -1
- package/src/lib/render/hydration-metadata.d.ts.map +0 -1
- package/src/lib/render/hydration-metadata.js.map +0 -1
- package/src/lib/render/hydration.d.ts.map +0 -1
- package/src/lib/render/hydration.js.map +0 -1
- package/src/lib/render/interpreter.d.ts.map +0 -1
- package/src/lib/render/interpreter.js.map +0 -1
- package/src/lib/render/server-style-collector.d.ts.map +0 -1
- package/src/lib/render/server-style-collector.js.map +0 -1
- package/src/lib/render/ssr-coordinator.d.ts.map +0 -1
- package/src/lib/render/ssr-coordinator.js.map +0 -1
- package/src/lib/render/string-dom.d.ts.map +0 -1
- package/src/lib/render/string-dom.js.map +0 -1
- package/src/lib/render/style-registry.d.ts.map +0 -1
- package/src/lib/render/style-registry.js.map +0 -1
- package/src/lib/render/style-scope.d.ts.map +0 -1
- package/src/lib/render/style-scope.js.map +0 -1
- package/src/lib/render/vnode.d.ts.map +0 -1
- package/src/lib/render/vnode.js.map +0 -1
- package/src/lib/server-render.d.ts.map +0 -1
- package/src/lib/server-render.js.map +0 -1
- package/src/lib/start.d.ts.map +0 -1
- package/src/lib/start.js.map +0 -1
- package/src/lib/template-contract.d.ts.map +0 -1
- package/src/lib/template-contract.js.map +0 -1
- package/src/lib/template.d.ts.map +0 -1
- package/src/lib/template.js.map +0 -1
- package/src/lib/testing.d.ts.map +0 -1
- package/src/lib/testing.js.map +0 -1
- package/src/lib/types.d.ts.map +0 -1
- package/src/lib/types.js.map +0 -1
- package/testing/public-api.d.ts.map +0 -1
- package/testing/public-api.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type CraftDirective } from './types';
|
|
2
|
-
import type { CraftNodeChildren } from './render/vnode';
|
|
1
|
+
import { type CraftDirective } from './types.js';
|
|
2
|
+
import type { CraftNodeChildren } from './render/vnode.js';
|
|
3
3
|
import type { SsrMode } from '@craft-ts/core';
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const PENDING_NODE_DIRECTIVE: unique symbol;
|
|
5
5
|
/**
|
|
6
6
|
* Where the fallback is inserted relative to the suspended subtree. The subtree
|
|
7
7
|
* itself is kept mounted but **detached from the document** while it is
|
|
@@ -9,28 +9,28 @@ export declare const PENDING_BLOCK_DIRECTIVE: unique symbol;
|
|
|
9
9
|
* CSS), so its state survives the wait. Assistive tech is told via
|
|
10
10
|
* `aria-busy` / `aria-live` on the fallback, not via the detached source.
|
|
11
11
|
*/
|
|
12
|
-
export type
|
|
12
|
+
export type PendingPosition = 'before' | 'after';
|
|
13
13
|
export type PendingFallback = () => CraftNodeChildren;
|
|
14
14
|
/**
|
|
15
15
|
* What to render for one source. A bare function covers the suspended case; the
|
|
16
16
|
* object form adds `reloading`, rendered **next to the still-visible subtree**
|
|
17
17
|
* when the source already has a value and is refetching.
|
|
18
18
|
*/
|
|
19
|
-
export type
|
|
19
|
+
export type PendingHandler = PendingFallback | {
|
|
20
20
|
readonly pending: PendingFallback;
|
|
21
21
|
readonly reloading?: PendingFallback;
|
|
22
22
|
};
|
|
23
23
|
/** One handler per async source name, for the `.exhaustive` form. */
|
|
24
|
-
export type
|
|
24
|
+
export type PendingHandlers = Readonly<Record<string, PendingHandler>>;
|
|
25
25
|
type HandlerChildrenOf<Handler> = Handler extends () => infer Children ? Children : Handler extends {
|
|
26
26
|
readonly pending: () => infer Pending;
|
|
27
27
|
readonly reloading?: () => infer Reloading;
|
|
28
28
|
} ? Pending | Reloading : never;
|
|
29
|
-
export type
|
|
29
|
+
export type PendingHandlerChildren<Handler> = HandlerChildrenOf<Handler>;
|
|
30
30
|
/** Resolves the children a handler renders for one of its two states. */
|
|
31
|
-
export declare function
|
|
31
|
+
export declare function resolvePendingHandler(handler: PendingHandler, state: 'pending' | 'reloading'): CraftNodeChildren;
|
|
32
32
|
/**
|
|
33
|
-
* Thrown when a `CraftNotSettled` escapes every `
|
|
33
|
+
* Thrown when a `CraftNotSettled` escapes every `pendingNode` boundary — the
|
|
34
34
|
* runtime counterpart of the compile-time check, for the cases the types cannot
|
|
35
35
|
* see (a settled read hidden inside a lambda, a dynamically built subtree).
|
|
36
36
|
*/
|
|
@@ -38,30 +38,30 @@ export declare class CraftUnhandledPendingError extends Error {
|
|
|
38
38
|
readonly source: string;
|
|
39
39
|
constructor(source: string);
|
|
40
40
|
}
|
|
41
|
-
export type
|
|
42
|
-
readonly [
|
|
41
|
+
export type PendingDirective<Handlers extends PendingHandlers | undefined = undefined, FallbackChildren extends CraftNodeChildren = CraftNodeChildren> = CraftDirective & {
|
|
42
|
+
readonly [PENDING_NODE_DIRECTIVE]: {
|
|
43
43
|
/** `undefined` for the catch-all form: every source below is covered. */
|
|
44
44
|
readonly handlers: Handlers;
|
|
45
45
|
readonly fallback: PendingFallback | undefined;
|
|
46
46
|
readonly reloading: PendingFallback | undefined;
|
|
47
|
-
readonly position:
|
|
47
|
+
readonly position: PendingPosition;
|
|
48
48
|
readonly ssr: SsrMode | undefined;
|
|
49
49
|
/** Phantom carrier — the fallback's own nodes, never read at runtime. */
|
|
50
50
|
readonly fallbackChildren?: FallbackChildren;
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
53
|
/**
|
|
54
|
-
* The sources a `
|
|
54
|
+
* The sources a `pendingNode` leaves uncovered. The catch-all form covers
|
|
55
55
|
* everything below it; the `.exhaustive` form covers only the sources it names.
|
|
56
56
|
*/
|
|
57
|
-
export type
|
|
58
|
-
/** Exhaustiveness check for `
|
|
59
|
-
export type
|
|
60
|
-
'
|
|
57
|
+
export type PendingResidualSources<Sources extends string, Handlers extends PendingHandlers | undefined> = Handlers extends PendingHandlers ? Exclude<Sources, Extract<keyof Handlers, string>> : never;
|
|
58
|
+
/** Exhaustiveness check for `pendingNode.exhaustive({...})`. */
|
|
59
|
+
export type PendingExhaustiveCheck<Sources extends string, Handlers extends PendingHandlers> = [Exclude<Sources, Extract<keyof Handlers, string>>] extends [never] ? [Exclude<Extract<keyof Handlers, string>, Sources>] extends [never] ? unknown : {
|
|
60
|
+
'pendingNode.exhaustive has fallbacks for sources that never suspend here': Exclude<Extract<keyof Handlers, string>, Sources>;
|
|
61
61
|
} : {
|
|
62
|
-
'
|
|
62
|
+
'pendingNode.exhaustive is missing a fallback for async sources': Exclude<Sources, Extract<keyof Handlers, string>>;
|
|
63
63
|
};
|
|
64
|
-
type
|
|
64
|
+
type PendingBaseOptions<Fallback extends PendingFallback = PendingFallback> = Readonly<{
|
|
65
65
|
/**
|
|
66
66
|
* Rendered next to the still-visible subtree while a source that already has
|
|
67
67
|
* a value is refetching. A refetch does not suspend — the stale value stays
|
|
@@ -69,14 +69,14 @@ type PendingBlockBaseOptions<Fallback extends PendingFallback = PendingFallback>
|
|
|
69
69
|
*/
|
|
70
70
|
readonly reloading?: Fallback;
|
|
71
71
|
/** Where the fallback goes relative to the (hidden) subtree. Defaults to `'before'`. */
|
|
72
|
-
readonly position?:
|
|
72
|
+
readonly position?: PendingPosition;
|
|
73
73
|
}>;
|
|
74
74
|
/**
|
|
75
75
|
* A client-only SSR boundary must name the shell that replaces the skipped
|
|
76
76
|
* subtree. Other modes may omit it when an exhaustive handler or an outer
|
|
77
77
|
* boundary owns the pending UI.
|
|
78
78
|
*/
|
|
79
|
-
export type
|
|
79
|
+
export type PendingOptions<Fallback extends PendingFallback = PendingFallback> = PendingBaseOptions<Fallback> & (Readonly<{
|
|
80
80
|
readonly ssr: 'client';
|
|
81
81
|
readonly fallback: Fallback;
|
|
82
82
|
}> | Readonly<{
|
|
@@ -84,14 +84,14 @@ export type PendingBlockOptions<Fallback extends PendingFallback = PendingFallba
|
|
|
84
84
|
/** Rendered while the subtree has an async source with no value yet. */
|
|
85
85
|
readonly fallback?: Fallback;
|
|
86
86
|
}>);
|
|
87
|
-
interface
|
|
87
|
+
interface PendingFactory {
|
|
88
88
|
/**
|
|
89
89
|
* A boundary that renders `fallback` while **any** async source read below it
|
|
90
90
|
* has no value yet — the template equivalent of Solid's `Suspense`.
|
|
91
91
|
*
|
|
92
92
|
* ```ts
|
|
93
93
|
* div([span(users.settledValue)]).pipe(
|
|
94
|
-
*
|
|
94
|
+
* pendingNode({ fallback: () => span('Chargement…') }),
|
|
95
95
|
* )
|
|
96
96
|
* ```
|
|
97
97
|
*
|
|
@@ -99,7 +99,7 @@ interface PendingBlockFactory {
|
|
|
99
99
|
* CSS-hidden) so nothing below it is torn down and rebuilt when the data
|
|
100
100
|
* arrives. The fallback is announced with `aria-live="polite"`.
|
|
101
101
|
*/
|
|
102
|
-
<Fallback extends PendingFallback>(options?:
|
|
102
|
+
<Fallback extends PendingFallback>(options?: PendingOptions<Fallback>): PendingDirective<undefined, ReturnType<Fallback> extends CraftNodeChildren ? ReturnType<Fallback> : CraftNodeChildren>;
|
|
103
103
|
/**
|
|
104
104
|
* A boundary with one fallback per async source, checked exhaustively against
|
|
105
105
|
* the sources actually read below it — an unlisted source is a compile error,
|
|
@@ -107,7 +107,7 @@ interface PendingBlockFactory {
|
|
|
107
107
|
*
|
|
108
108
|
* ```ts
|
|
109
109
|
* div([...]).pipe(
|
|
110
|
-
*
|
|
110
|
+
* pendingNode.exhaustive({
|
|
111
111
|
* users: () => SkeletonList(),
|
|
112
112
|
* orders: () => SkeletonRows(),
|
|
113
113
|
* }),
|
|
@@ -117,9 +117,8 @@ interface PendingBlockFactory {
|
|
|
117
117
|
* When several listed sources are pending at once, the fallback of the first
|
|
118
118
|
* one to suspend is rendered.
|
|
119
119
|
*/
|
|
120
|
-
exhaustive<const Handlers extends
|
|
120
|
+
exhaustive<const Handlers extends PendingHandlers>(handlers: Handlers, options?: Omit<PendingOptions, 'fallback' | 'reloading'>): PendingDirective<Handlers, PendingHandlerChildren<Handlers[keyof Handlers]> extends CraftNodeChildren ? PendingHandlerChildren<Handlers[keyof Handlers]> : CraftNodeChildren>;
|
|
121
121
|
}
|
|
122
|
-
export declare const
|
|
123
|
-
export declare function
|
|
122
|
+
export declare const pendingNode: PendingFactory;
|
|
123
|
+
export declare function isPendingDirective(value: unknown): value is PendingDirective<PendingHandlers | undefined>;
|
|
124
124
|
export {};
|
|
125
|
-
//# sourceMappingURL=pending-block.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CRAFT_DIRECTIVE } from './types';
|
|
2
|
-
export const
|
|
1
|
+
import { CRAFT_DIRECTIVE } from './types.js';
|
|
2
|
+
export const PENDING_NODE_DIRECTIVE = Symbol('craft-pending-node-directive');
|
|
3
3
|
/** Resolves the children a handler renders for one of its two states. */
|
|
4
|
-
export function
|
|
4
|
+
export function resolvePendingHandler(handler, state) {
|
|
5
5
|
if (typeof handler === 'function') {
|
|
6
6
|
return state === 'pending' ? handler() : [];
|
|
7
7
|
}
|
|
@@ -10,39 +10,38 @@ export function resolvePendingBlockHandler(handler, state) {
|
|
|
10
10
|
: (handler.reloading?.() ?? []);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Thrown when a `CraftNotSettled` escapes every `
|
|
13
|
+
* Thrown when a `CraftNotSettled` escapes every `pendingNode` boundary — the
|
|
14
14
|
* runtime counterpart of the compile-time check, for the cases the types cannot
|
|
15
15
|
* see (a settled read hidden inside a lambda, a dynamically built subtree).
|
|
16
16
|
*/
|
|
17
17
|
export class CraftUnhandledPendingError extends Error {
|
|
18
18
|
source;
|
|
19
19
|
constructor(source) {
|
|
20
|
-
super(`Craft async source "${source}" suspended outside of any
|
|
20
|
+
super(`Craft async source "${source}" suspended outside of any pendingNode(...) boundary.`);
|
|
21
21
|
this.name = 'CraftUnhandledPendingError';
|
|
22
22
|
this.source = source;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function createPendingDirective(handlers, fallback, reloading, position, ssr) {
|
|
26
26
|
const directive = (() => undefined);
|
|
27
27
|
Object.defineProperty(directive, CRAFT_DIRECTIVE, {
|
|
28
28
|
value: {
|
|
29
|
-
name: handlers ? '
|
|
29
|
+
name: handlers ? 'pendingNode.exhaustive' : 'pendingNode',
|
|
30
30
|
meta: {},
|
|
31
31
|
logic: (baseLogic) => baseLogic,
|
|
32
32
|
template: (baseTemplate) => baseTemplate,
|
|
33
33
|
},
|
|
34
34
|
enumerable: false,
|
|
35
35
|
});
|
|
36
|
-
Object.defineProperty(directive,
|
|
36
|
+
Object.defineProperty(directive, PENDING_NODE_DIRECTIVE, {
|
|
37
37
|
value: { handlers, fallback, reloading, position, ssr },
|
|
38
38
|
enumerable: false,
|
|
39
39
|
});
|
|
40
40
|
return directive;
|
|
41
41
|
}
|
|
42
|
-
export const
|
|
43
|
-
exhaustive: (handlers, options = {}) =>
|
|
42
|
+
export const pendingNode = Object.assign((options = {}) => createPendingDirective(undefined, options.fallback, options.reloading, options.position ?? 'before', options.ssr), {
|
|
43
|
+
exhaustive: (handlers, options = {}) => createPendingDirective(handlers, undefined, undefined, options.position ?? 'before', options.ssr),
|
|
44
44
|
});
|
|
45
|
-
export function
|
|
46
|
-
return (typeof value === 'function' &&
|
|
45
|
+
export function isPendingDirective(value) {
|
|
46
|
+
return (typeof value === 'function' && PENDING_NODE_DIRECTIVE in value);
|
|
47
47
|
}
|
|
48
|
-
//# sourceMappingURL=pending-block.js.map
|
package/src/lib/project.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CraftNodeChildren, CraftNodeChildrenDependencies, ProjectionNode } from './render/vnode';
|
|
2
|
-
import { CONTENT_DECLARATION_CONTEXT, CONTENT_OUTPUT, CONTENT_RENDERABLE, CONTENT_STYLE_POLICY, type ContentOptions, type InputValue, type ProjectionUnit, type RenderableContent } from './types';
|
|
1
|
+
import type { CraftNodeChildren, CraftNodeChildrenDependencies, ProjectionNode } from './render/vnode.js';
|
|
2
|
+
import { CONTENT_DECLARATION_CONTEXT, CONTENT_OUTPUT, CONTENT_RENDERABLE, CONTENT_STYLE_POLICY, type ContentOptions, type InputValue, type ProjectionUnit, type RenderableContent } from './types.js';
|
|
3
3
|
type ContentOutput<Value> = Value extends (...args: any[]) => infer Output ? Output : never;
|
|
4
4
|
type RenderableContentOutput<Value> = ContentOutput<Value> extends CraftNodeChildren ? ContentOutput<Value> : CraftNodeChildren;
|
|
5
5
|
/** Brands deferred DOM content and records the caller's style opt-in. */
|
|
@@ -16,4 +16,3 @@ export declare function renderContent<Value extends RenderableContent>(value: Va
|
|
|
16
16
|
export declare function renderContent<Value extends ProjectionUnit<any>>(value: Value | InputValue<Value>): ProjectionNode<CraftNodeChildrenDependencies<Value>, Value>;
|
|
17
17
|
export declare function renderContent<SlotName extends string, Value extends RenderableContent>(slotName: SlotName, value: Value | InputValue<Value>): ProjectionNode<CraftNodeChildrenDependencies<RenderableContentOutput<Value>>, RenderableContentOutput<Value>>;
|
|
18
18
|
export {};
|
|
19
|
-
//# sourceMappingURL=project.d.ts.map
|
package/src/lib/project.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isGeneratorFunction, isYieldableValue } from '@craft-ts/core';
|
|
2
|
-
import { currentCraftRenderContext } from './render/vnode';
|
|
3
|
-
import { CONTENT_DECLARATION_CONTEXT, CONTENT_OUTPUT, CONTENT_RENDERABLE, CONTENT_STYLE_POLICY, } from './types';
|
|
2
|
+
import { currentCraftRenderContext } from './render/vnode.js';
|
|
3
|
+
import { CONTENT_DECLARATION_CONTEXT, CONTENT_OUTPUT, CONTENT_RENDERABLE, CONTENT_STYLE_POLICY, } from './types.js';
|
|
4
4
|
function contentStylePolicy(value) {
|
|
5
5
|
return value[CONTENT_STYLE_POLICY] === 'allow-container-styles'
|
|
6
6
|
? 'allow-container-styles'
|
|
@@ -53,4 +53,3 @@ export function renderContent(slotNameOrValue, maybeValue) {
|
|
|
53
53
|
declarationContext,
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
//# sourceMappingURL=project.js.map
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { type CraftServiceProvider, type CraftDomAdapter, type CraftRenderIdentity } from '@craft-ts/core';
|
|
2
|
-
import { Injector } from '../host-runtime';
|
|
3
|
-
import { type CraftComponent } from '../types';
|
|
4
|
-
import { CraftStyleRegistry } from './style-registry';
|
|
5
|
-
import { type RuntimeLocatorCriteria } from '../locator';
|
|
6
|
-
import { type HydrationCursor } from './hydration';
|
|
7
|
-
import type { CraftSsrCoordinator } from './ssr-coordinator';
|
|
8
|
-
import type { CraftServerStyleCollector } from './server-style-collector';
|
|
2
|
+
import { Injector } from '../host-runtime.js';
|
|
3
|
+
import { type CraftComponent } from '../types.js';
|
|
4
|
+
import { CraftStyleRegistry } from './style-registry.js';
|
|
5
|
+
import { type RuntimeLocatorCriteria } from '../locator.js';
|
|
6
|
+
import { type HydrationCursor } from './hydration.js';
|
|
7
|
+
import type { CraftSsrCoordinator } from './ssr-coordinator.js';
|
|
8
|
+
import type { CraftServerStyleCollector } from './server-style-collector.js';
|
|
9
|
+
/** Exporté pour la suite de non-régression sécurité. */
|
|
10
|
+
export declare function ɵassertSafeStyleValue(value: unknown, resourceOrigins?: readonly string[]): void;
|
|
9
11
|
export interface MountedCraftComponent<Props extends object> {
|
|
10
12
|
updateProps(props: Props): void;
|
|
11
13
|
destroy(): void;
|
|
@@ -29,4 +31,3 @@ export type InterpretedRenderOptions = Readonly<{
|
|
|
29
31
|
export declare function mountInterpretedComponent<Props extends object>(component: CraftComponent<Props>, host: Element, injector: Injector | object, props: Props): MountedCraftComponent<Props>;
|
|
30
32
|
export declare function mountInterpretedComponentWithOptions<Props extends object>(component: CraftComponent<Props>, host: Element, injector: Injector | object, props: Props, options: InterpretedRenderOptions): MountedCraftComponent<Props>;
|
|
31
33
|
export declare function mountInterpretedComponentTemplate<Context>(component: CraftComponent<any>, host: Element, injector: Injector | object, context: Context, additionalProviders?: readonly CraftServiceProvider[]): MountedCraftTemplate<Context>;
|
|
32
|
-
//# sourceMappingURL=interpreter.d.ts.map
|