@exactjs/core 0.6.2 → 0.6.4
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/AGENTS.md +12 -14
- package/README.md +6 -8
- package/dist/client/component/resumption.js +5 -1
- package/dist/client/component/resumption.js.map +1 -1
- package/dist/client/component-contract/continuation-validation.d.ts +5 -0
- package/dist/client/component-contract/continuation-validation.d.ts.map +1 -1
- package/dist/client/component-contract/continuation-validation.js +7 -0
- package/dist/client/component-contract/continuation-validation.js.map +1 -1
- package/dist/client/component-contract/contract-validation.d.ts.map +1 -1
- package/dist/client/component-contract/contract-validation.js +4 -1
- package/dist/client/component-contract/contract-validation.js.map +1 -1
- package/dist/client/component-contracts.d.ts +5 -0
- package/dist/client/component-contracts.d.ts.map +1 -1
- package/dist/client/component-contracts.js.map +1 -1
- package/dist/client/framework/component-contract-validation.d.ts +1 -1
- package/dist/client/framework/component-contract-validation.d.ts.map +1 -1
- package/dist/client/framework/component-contract-validation.js +1 -1
- package/dist/client/framework/component-contract-validation.js.map +1 -1
- package/dist/client/framework/fragment-target-projection-plan.d.ts +9 -0
- package/dist/client/framework/fragment-target-projection-plan.d.ts.map +1 -0
- package/dist/client/framework/fragment-target-projection-plan.js +99 -0
- package/dist/client/framework/fragment-target-projection-plan.js.map +1 -0
- package/dist/client/framework/fragment-target-projection.d.ts +1 -5
- package/dist/client/framework/fragment-target-projection.d.ts.map +1 -1
- package/dist/client/framework/fragment-target-projection.js +5 -95
- package/dist/client/framework/fragment-target-projection.js.map +1 -1
- package/dist/client/framework/operation-protocol.d.ts +9 -0
- package/dist/client/framework/operation-protocol.d.ts.map +1 -1
- package/dist/client/framework/operation-protocol.js.map +1 -1
- package/dist/client/framework/server-fragment-target-projection.d.ts +4 -0
- package/dist/client/framework/server-fragment-target-projection.d.ts.map +1 -0
- package/dist/client/framework/server-fragment-target-projection.js +7 -0
- package/dist/client/framework/server-fragment-target-projection.js.map +1 -0
- package/dist/client/framework/server-render-structure.d.ts +1 -0
- package/dist/client/framework/server-render-structure.d.ts.map +1 -1
- package/dist/client/framework/server-render-structure.js +1 -0
- package/dist/client/framework/server-render-structure.js.map +1 -1
- package/dist/client/framework/server-task-helpers.d.ts +1 -0
- package/dist/client/framework/server-task-helpers.d.ts.map +1 -1
- package/dist/client/framework/server-task-helpers.js +1 -0
- package/dist/client/framework/server-task-helpers.js.map +1 -1
- package/dist/client/framework/task-frames.d.ts +2 -1
- package/dist/client/framework/task-frames.d.ts.map +1 -1
- package/dist/client/framework/task-frames.js +1 -0
- package/dist/client/framework/task-frames.js.map +1 -1
- package/dist/client/runtime/tasks.d.ts +1 -0
- package/dist/client/runtime/tasks.d.ts.map +1 -1
- package/dist/client/runtime/tasks.js +1 -0
- package/dist/client/runtime/tasks.js.map +1 -1
- package/dist/client/tasks/contracts.d.ts +2 -0
- package/dist/client/tasks/contracts.d.ts.map +1 -1
- package/dist/client/tasks/contracts.js.map +1 -1
- package/dist/client/tasks/progress-bindings.d.ts +20 -0
- package/dist/client/tasks/progress-bindings.d.ts.map +1 -0
- package/dist/client/tasks/progress-bindings.js +51 -0
- package/dist/client/tasks/progress-bindings.js.map +1 -0
- package/dist/client/tasks/progress-receiver.d.ts +24 -0
- package/dist/client/tasks/progress-receiver.d.ts.map +1 -0
- package/dist/client/tasks/progress-receiver.js +71 -0
- package/dist/client/tasks/progress-receiver.js.map +1 -0
- package/dist/component/resumption.js +5 -1
- package/dist/component/resumption.js.map +1 -1
- package/dist/component-contract/continuation-validation.d.ts +5 -0
- package/dist/component-contract/continuation-validation.d.ts.map +1 -1
- package/dist/component-contract/continuation-validation.js +7 -0
- package/dist/component-contract/continuation-validation.js.map +1 -1
- package/dist/component-contract/contract-validation.d.ts.map +1 -1
- package/dist/component-contract/contract-validation.js +4 -1
- package/dist/component-contract/contract-validation.js.map +1 -1
- package/dist/component-contracts.d.ts +5 -0
- package/dist/component-contracts.d.ts.map +1 -1
- package/dist/component-contracts.js.map +1 -1
- package/dist/framework/component-contract-validation.d.ts +1 -1
- package/dist/framework/component-contract-validation.d.ts.map +1 -1
- package/dist/framework/component-contract-validation.js +1 -1
- package/dist/framework/component-contract-validation.js.map +1 -1
- package/dist/framework/fragment-target-projection-plan.d.ts +9 -0
- package/dist/framework/fragment-target-projection-plan.d.ts.map +1 -0
- package/dist/framework/fragment-target-projection-plan.js +99 -0
- package/dist/framework/fragment-target-projection-plan.js.map +1 -0
- package/dist/framework/fragment-target-projection.d.ts +1 -5
- package/dist/framework/fragment-target-projection.d.ts.map +1 -1
- package/dist/framework/fragment-target-projection.js +5 -95
- package/dist/framework/fragment-target-projection.js.map +1 -1
- package/dist/framework/operation-protocol.d.ts +9 -0
- package/dist/framework/operation-protocol.d.ts.map +1 -1
- package/dist/framework/operation-protocol.js.map +1 -1
- package/dist/framework/server-fragment-target-projection.d.ts +4 -0
- package/dist/framework/server-fragment-target-projection.d.ts.map +1 -0
- package/dist/framework/server-fragment-target-projection.js +7 -0
- package/dist/framework/server-fragment-target-projection.js.map +1 -0
- package/dist/framework/server-render-structure.d.ts +1 -0
- package/dist/framework/server-render-structure.d.ts.map +1 -1
- package/dist/framework/server-render-structure.js +1 -0
- package/dist/framework/server-render-structure.js.map +1 -1
- package/dist/framework/server-task-helpers.d.ts +1 -0
- package/dist/framework/server-task-helpers.d.ts.map +1 -1
- package/dist/framework/server-task-helpers.js +1 -0
- package/dist/framework/server-task-helpers.js.map +1 -1
- package/dist/framework/task-frames.d.ts +2 -1
- package/dist/framework/task-frames.d.ts.map +1 -1
- package/dist/framework/task-frames.js +1 -0
- package/dist/framework/task-frames.js.map +1 -1
- package/dist/runtime/tasks.d.ts +1 -0
- package/dist/runtime/tasks.d.ts.map +1 -1
- package/dist/runtime/tasks.js +1 -0
- package/dist/runtime/tasks.js.map +1 -1
- package/dist/server/component/resumption.js +5 -1
- package/dist/server/component/resumption.js.map +1 -1
- package/dist/server/component-contract/continuation-validation.d.ts +5 -0
- package/dist/server/component-contract/continuation-validation.d.ts.map +1 -1
- package/dist/server/component-contract/continuation-validation.js +7 -0
- package/dist/server/component-contract/continuation-validation.js.map +1 -1
- package/dist/server/component-contract/contract-validation.d.ts.map +1 -1
- package/dist/server/component-contract/contract-validation.js +4 -1
- package/dist/server/component-contract/contract-validation.js.map +1 -1
- package/dist/server/component-contracts.d.ts +5 -0
- package/dist/server/component-contracts.d.ts.map +1 -1
- package/dist/server/component-contracts.js.map +1 -1
- package/dist/server/framework/component-contract-validation.d.ts +1 -1
- package/dist/server/framework/component-contract-validation.d.ts.map +1 -1
- package/dist/server/framework/component-contract-validation.js +1 -1
- package/dist/server/framework/component-contract-validation.js.map +1 -1
- package/dist/server/framework/fragment-target-projection-plan.d.ts +9 -0
- package/dist/server/framework/fragment-target-projection-plan.d.ts.map +1 -0
- package/dist/server/framework/fragment-target-projection-plan.js +99 -0
- package/dist/server/framework/fragment-target-projection-plan.js.map +1 -0
- package/dist/server/framework/fragment-target-projection.d.ts +1 -5
- package/dist/server/framework/fragment-target-projection.d.ts.map +1 -1
- package/dist/server/framework/fragment-target-projection.js +5 -95
- package/dist/server/framework/fragment-target-projection.js.map +1 -1
- package/dist/server/framework/operation-protocol.d.ts +9 -0
- package/dist/server/framework/operation-protocol.d.ts.map +1 -1
- package/dist/server/framework/operation-protocol.js.map +1 -1
- package/dist/server/framework/server-fragment-target-projection.d.ts +4 -0
- package/dist/server/framework/server-fragment-target-projection.d.ts.map +1 -0
- package/dist/server/framework/server-fragment-target-projection.js +7 -0
- package/dist/server/framework/server-fragment-target-projection.js.map +1 -0
- package/dist/server/framework/server-render-structure.d.ts +1 -0
- package/dist/server/framework/server-render-structure.d.ts.map +1 -1
- package/dist/server/framework/server-render-structure.js +1 -0
- package/dist/server/framework/server-render-structure.js.map +1 -1
- package/dist/server/framework/server-task-helpers.d.ts +1 -0
- package/dist/server/framework/server-task-helpers.d.ts.map +1 -1
- package/dist/server/framework/server-task-helpers.js +1 -0
- package/dist/server/framework/server-task-helpers.js.map +1 -1
- package/dist/server/framework/task-frames.d.ts +2 -1
- package/dist/server/framework/task-frames.d.ts.map +1 -1
- package/dist/server/framework/task-frames.js +1 -0
- package/dist/server/framework/task-frames.js.map +1 -1
- package/dist/server/runtime/tasks.d.ts +1 -0
- package/dist/server/runtime/tasks.d.ts.map +1 -1
- package/dist/server/runtime/tasks.js +1 -0
- package/dist/server/runtime/tasks.js.map +1 -1
- package/dist/server/tasks/contracts.d.ts +2 -0
- package/dist/server/tasks/contracts.d.ts.map +1 -1
- package/dist/server/tasks/contracts.js.map +1 -1
- package/dist/server/tasks/progress-bindings.d.ts +20 -0
- package/dist/server/tasks/progress-bindings.d.ts.map +1 -0
- package/dist/server/tasks/progress-bindings.js +51 -0
- package/dist/server/tasks/progress-bindings.js.map +1 -0
- package/dist/server/tasks/progress-receiver.d.ts +24 -0
- package/dist/server/tasks/progress-receiver.d.ts.map +1 -0
- package/dist/server/tasks/progress-receiver.js +71 -0
- package/dist/server/tasks/progress-receiver.js.map +1 -0
- package/dist/tasks/contracts.d.ts +2 -0
- package/dist/tasks/contracts.d.ts.map +1 -1
- package/dist/tasks/contracts.js.map +1 -1
- package/dist/tasks/progress-bindings.d.ts +20 -0
- package/dist/tasks/progress-bindings.d.ts.map +1 -0
- package/dist/tasks/progress-bindings.js +51 -0
- package/dist/tasks/progress-bindings.js.map +1 -0
- package/dist/tasks/progress-receiver.d.ts +24 -0
- package/dist/tasks/progress-receiver.d.ts.map +1 -0
- package/dist/tasks/progress-receiver.js +71 -0
- package/dist/tasks/progress-receiver.js.map +1 -0
- package/package.json +1 -1
- package/dist/client/component/error-boundary.js.map +0 -1
- package/dist/server/component/error-boundary.js.map +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TaskContext, TaskOwner } from './contracts.js';
|
|
2
|
+
/** One replaceable observation lane, owned by an originating invocation. */
|
|
3
|
+
export interface TaskProgressReceiver<Snapshot> {
|
|
4
|
+
/** Offers a captured snapshot, replacing any snapshot which has not started. */
|
|
5
|
+
report(snapshot: Snapshot): void;
|
|
6
|
+
/** Fences publication immediately; asynchronous cleanup does not delay the caller. */
|
|
7
|
+
close(reason?: unknown): void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Serializes asynchronous progress activations while retaining only the latest pending value.
|
|
11
|
+
* Each activation is an ordinary task with independent staged publication and structural children.
|
|
12
|
+
* It belongs to the durable component owner, but never extends the originating invocation.
|
|
13
|
+
* Callers must capture/validate snapshots before offering them and route errors to diagnostics.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createTaskProgressReceiver<Snapshot>(options: {
|
|
16
|
+
readonly owner: TaskOwner;
|
|
17
|
+
readonly signal: AbortSignal;
|
|
18
|
+
readonly label: string;
|
|
19
|
+
readonly priority?: 'immediate' | 'normal' | 'deferred';
|
|
20
|
+
readonly readiness?: 'blocking' | 'nonblocking';
|
|
21
|
+
readonly receive: (snapshot: Snapshot, task: TaskContext) => void | Promise<void>;
|
|
22
|
+
readonly onError: (error: unknown) => void;
|
|
23
|
+
}): TaskProgressReceiver<Snapshot>;
|
|
24
|
+
//# sourceMappingURL=progress-receiver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-receiver.d.ts","sourceRoot":"","sources":["../../src/tasks/progress-receiver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK7D,4EAA4E;AAC5E,MAAM,WAAW,oBAAoB,CAAC,QAAQ;IAC7C,gFAAgF;IAChF,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IACjC,sFAAsF;IACtF,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,OAAO,EAAE;IAC7D,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;IACxD,QAAQ,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClF,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC3C,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAoEjC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { isTaskCancellation } from './cancellation.js';
|
|
2
|
+
import { bindTask, defineTask } from './runtime.js';
|
|
3
|
+
import { logFrameworkEvent } from '../component/log.js';
|
|
4
|
+
/**
|
|
5
|
+
* Serializes asynchronous progress activations while retaining only the latest pending value.
|
|
6
|
+
* Each activation is an ordinary task with independent staged publication and structural children.
|
|
7
|
+
* It belongs to the durable component owner, but never extends the originating invocation.
|
|
8
|
+
* Callers must capture/validate snapshots before offering them and route errors to diagnostics.
|
|
9
|
+
*/
|
|
10
|
+
export function createTaskProgressReceiver(options) {
|
|
11
|
+
const task = bindTask(defineTask({
|
|
12
|
+
label: options.label,
|
|
13
|
+
placement: 'client',
|
|
14
|
+
readiness: options.readiness ?? 'nonblocking',
|
|
15
|
+
priority: options.priority,
|
|
16
|
+
detached: true,
|
|
17
|
+
owner: options.owner
|
|
18
|
+
}, options.receive), { owner: options.owner });
|
|
19
|
+
let closed = false;
|
|
20
|
+
let running = false;
|
|
21
|
+
let pending;
|
|
22
|
+
const close = (reason = 'progress-complete') => {
|
|
23
|
+
if (closed)
|
|
24
|
+
return;
|
|
25
|
+
closed = true;
|
|
26
|
+
pending = undefined;
|
|
27
|
+
options.signal.removeEventListener('abort', abort);
|
|
28
|
+
options.owner.signal.removeEventListener('abort', abort);
|
|
29
|
+
task.cancel(reason);
|
|
30
|
+
};
|
|
31
|
+
const abort = () => close(options.signal.reason ?? options.owner.signal.reason);
|
|
32
|
+
const drain = () => {
|
|
33
|
+
if (closed || running || !pending)
|
|
34
|
+
return;
|
|
35
|
+
const { snapshot } = pending;
|
|
36
|
+
pending = undefined;
|
|
37
|
+
running = true;
|
|
38
|
+
// Observe the invocation's rejection before work can settle. Cancellation is lifecycle,
|
|
39
|
+
// while failures still remain inspectable on the task and reach the supplied diagnostic.
|
|
40
|
+
void Promise.resolve(task(snapshot)).then(() => finish(), (error) => {
|
|
41
|
+
try {
|
|
42
|
+
if (!isTaskCancellation(error))
|
|
43
|
+
options.onError(error);
|
|
44
|
+
}
|
|
45
|
+
catch (diagnosticError) {
|
|
46
|
+
logFrameworkEvent('error', 'core', 'task', 'progress error diagnostic failed', diagnosticError);
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
finish();
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
const finish = () => {
|
|
54
|
+
running = false;
|
|
55
|
+
drain();
|
|
56
|
+
};
|
|
57
|
+
options.signal.addEventListener('abort', abort, { once: true });
|
|
58
|
+
options.owner.signal.addEventListener('abort', abort, { once: true });
|
|
59
|
+
if (options.signal.aborted || options.owner.signal.aborted)
|
|
60
|
+
abort();
|
|
61
|
+
return {
|
|
62
|
+
report(snapshot) {
|
|
63
|
+
if (closed)
|
|
64
|
+
return;
|
|
65
|
+
pending = { snapshot };
|
|
66
|
+
drain();
|
|
67
|
+
},
|
|
68
|
+
close
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=progress-receiver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-receiver.js","sourceRoot":"","sources":["../../src/tasks/progress-receiver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MA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AC;QACD,KAAK;KACL,CAAC;AACH,CAAC","sourcesContent":["import type { TaskContext, TaskOwner } from './contracts.js';\nimport { isTaskCancellation } from './cancellation.js';\nimport { bindTask, defineTask } from './runtime.js';\nimport { logFrameworkEvent } from '../component/log.js';\n\n/** One replaceable observation lane, owned by an originating invocation. */\nexport interface TaskProgressReceiver<Snapshot> {\n\t/** Offers a captured snapshot, replacing any snapshot which has not started. */\n\treport(snapshot: Snapshot): void;\n\t/** Fences publication immediately; asynchronous cleanup does not delay the caller. */\n\tclose(reason?: unknown): void;\n}\n\n/**\n * Serializes asynchronous progress activations while retaining only the latest pending value.\n * Each activation is an ordinary task with independent staged publication and structural children.\n * It belongs to the durable component owner, but never extends the originating invocation.\n * Callers must capture/validate snapshots before offering them and route errors to diagnostics.\n */\nexport function createTaskProgressReceiver<Snapshot>(options: {\n\treadonly owner: TaskOwner;\n\treadonly signal: AbortSignal;\n\treadonly label: string;\n\treadonly priority?: 'immediate' | 'normal' | 'deferred';\n\treadonly readiness?: 'blocking' | 'nonblocking';\n\treadonly receive: (snapshot: Snapshot, task: TaskContext) => void | Promise<void>;\n\treadonly onError: (error: unknown) => void;\n}): TaskProgressReceiver<Snapshot> {\n\tconst task = bindTask(\n\t\tdefineTask<[Snapshot], void>(\n\t\t\t{\n\t\t\t\tlabel: options.label,\n\t\t\t\tplacement: 'client',\n\t\t\t\treadiness: options.readiness ?? 'nonblocking',\n\t\t\t\tpriority: options.priority,\n\t\t\t\tdetached: true,\n\t\t\t\towner: options.owner\n\t\t\t},\n\t\t\toptions.receive\n\t\t),\n\t\t{ owner: options.owner }\n\t);\n\tlet closed = false;\n\tlet running = false;\n\tlet pending: { snapshot: Snapshot } | undefined;\n\tconst close = (reason: unknown = 'progress-complete') => {\n\t\tif (closed) return;\n\t\tclosed = true;\n\t\tpending = undefined;\n\t\toptions.signal.removeEventListener('abort', abort);\n\t\toptions.owner.signal.removeEventListener('abort', abort);\n\t\ttask.cancel(reason);\n\t};\n\tconst abort = () => close(options.signal.reason ?? options.owner.signal.reason);\n\tconst drain = () => {\n\t\tif (closed || running || !pending) return;\n\t\tconst { snapshot } = pending;\n\t\tpending = undefined;\n\t\trunning = true;\n\t\t// Observe the invocation's rejection before work can settle. Cancellation is lifecycle,\n\t\t// while failures still remain inspectable on the task and reach the supplied diagnostic.\n\t\tvoid Promise.resolve(task(snapshot)).then(\n\t\t\t() => finish(),\n\t\t\t(error: unknown) => {\n\t\t\t\ttry {\n\t\t\t\t\tif (!isTaskCancellation(error)) options.onError(error);\n\t\t\t\t} catch (diagnosticError) {\n\t\t\t\t\tlogFrameworkEvent(\n\t\t\t\t\t\t'error',\n\t\t\t\t\t\t'core',\n\t\t\t\t\t\t'task',\n\t\t\t\t\t\t'progress error diagnostic failed',\n\t\t\t\t\t\tdiagnosticError\n\t\t\t\t\t);\n\t\t\t\t} finally {\n\t\t\t\t\tfinish();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t};\n\tconst finish = () => {\n\t\trunning = false;\n\t\tdrain();\n\t};\n\toptions.signal.addEventListener('abort', abort, { once: true });\n\toptions.owner.signal.addEventListener('abort', abort, { once: true });\n\tif (options.signal.aborted || options.owner.signal.aborted) abort();\n\treturn {\n\t\treport(snapshot) {\n\t\t\tif (closed) return;\n\t\t\tpending = { snapshot };\n\t\t\tdrain();\n\t\t},\n\t\tclose\n\t};\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-boundary.js","sourceRoot":"","sources":["../../../src/component/error-boundary.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAsBzD;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAsB,KAAyB;IAC3E,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC;IACpC,MAAM,CAAC,QAAQ,GAAG,IAA6B,CAAC;IAChD,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAEtC,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;IAEtC,OAAO,GAAG,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,mBAAmB,CAC3B,MAA8B,EAC9B,KAAyB,EACzB,KAAiB;IAEjB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5B,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC;IAC1C,IAAI,OAAO,KAAK,CAAC,QAAQ,KAAK,UAAU;QAAE,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1F,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxD,OAAO,yBAAyB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,yBAAyB,CAAC,MAA8B,EAAE,KAAiB;IACnF,OAAO,sBAAsB,CAAC,MAAM,EAAE;QACrC,OAAO,EAAE;YACR,8BAA8B,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,WAAW,CAAC;SACzF;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type {\n\tChild,\n\tComponent,\n\tComponentInstance,\n\tErrorReport,\n\tRenderFunction,\n\tRenderResult\n} from './contracts.js';\n\nimport { createCompiledIntrinsicReceipt } from '../component-abi/intrinsic-receipt.js';\nimport { ErrorContext } from './contexts.js';\nimport { createErrorContext } from './errors.js';\nimport { createDefaultErrorView } from './error-view.js';\n\n/** Values supplied to a custom {@link ErrorBoundary} fallback. */\nexport type ErrorBoundaryFallbackProps = {\n\t/** Every error captured since the boundary was last reset. */\n\treadonly errors: readonly ErrorReport[];\n\t/** The most recently captured error. */\n\treadonly error: ErrorReport;\n\t/** Clears captured errors and remounts the boundary's children. */\n\treset(): void;\n};\n\n/** Configures the framework-provided error boundary component. */\nexport type ErrorBoundaryProps = {\n\tchildren?: Child | Child[];\n\t/**\n\t * Replacement content shown after a descendant fails. A function receives the captured reports\n\t * and a reset operation; a child value is rendered as-is.\n\t */\n\tfallback?: Child | ((props: ErrorBoundaryFallbackProps) => RenderResult);\n};\n\n/**\n * Captures descendant component, render, event, lifecycle, reactive, and task errors.\n *\n * Clearing the boundary removes the failed subtree and mounts it again. Errors thrown by the\n * fallback itself are deliberately routed to the next enclosing boundary.\n */\nexport function ErrorBoundary(this: Component<{}>, props: ErrorBoundaryProps): RenderFunction {\n\tconst errors = createErrorContext();\n\terrors.boundary = this as ComponentInstance<{}>;\n\tthis.setContext(ErrorContext, errors);\n\n\tconst reset = () => errors.clearAll();\n\n\treturn () => renderErrorBoundary(errors.errors, props, reset);\n}\n\nfunction renderErrorBoundary(\n\terrors: readonly ErrorReport[],\n\tprops: ErrorBoundaryProps,\n\treset: () => void\n): RenderResult {\n\tconst error = errors.at(-1);\n\tif (!error) return props.children ?? null;\n\tif (typeof props.fallback === 'function') return props.fallback({ errors, error, reset });\n\tif (props.fallback !== undefined) return props.fallback;\n\treturn createDefaultBoundaryView(errors, reset);\n}\n\nfunction createDefaultBoundaryView(errors: readonly ErrorReport[], reset: () => void): Child {\n\treturn createDefaultErrorView(errors, {\n\t\tactions: [\n\t\t\tcreateCompiledIntrinsicReceipt('button', { type: 'button', onClick: reset }, 'Try again')\n\t\t]\n\t});\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":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C,MAAM,EAAE;QACrC,OAAO,EAAE;YACR,8BAA8B,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,WAAW,CAAC;SACzF;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type {\n\tChild,\n\tComponent,\n\tComponentInstance,\n\tErrorReport,\n\tRenderFunction,\n\tRenderResult\n} from './contracts.js';\n\nimport { createCompiledIntrinsicReceipt } from '../component-abi/intrinsic-receipt.js';\nimport { ErrorContext } from './contexts.js';\nimport { createErrorContext } from './errors.js';\nimport { createDefaultErrorView } from './error-view.js';\n\n/** Values supplied to a custom {@link ErrorBoundary} fallback. */\nexport type ErrorBoundaryFallbackProps = {\n\t/** Every error captured since the boundary was last reset. */\n\treadonly errors: readonly ErrorReport[];\n\t/** The most recently captured error. */\n\treadonly error: ErrorReport;\n\t/** Clears captured errors and remounts the boundary's children. */\n\treset(): void;\n};\n\n/** Configures the framework-provided error boundary component. */\nexport type ErrorBoundaryProps = {\n\tchildren?: Child | Child[];\n\t/**\n\t * Replacement content shown after a descendant fails. A function receives the captured reports\n\t * and a reset operation; a child value is rendered as-is.\n\t */\n\tfallback?: Child | ((props: ErrorBoundaryFallbackProps) => RenderResult);\n};\n\n/**\n * Captures descendant component, render, event, lifecycle, reactive, and task errors.\n *\n * Clearing the boundary removes the failed subtree and mounts it again. Errors thrown by the\n * fallback itself are deliberately routed to the next enclosing boundary.\n */\nexport function ErrorBoundary(this: Component<{}>, props: ErrorBoundaryProps): RenderFunction {\n\tconst errors = createErrorContext();\n\terrors.boundary = this as ComponentInstance<{}>;\n\tthis.setContext(ErrorContext, errors);\n\n\tconst reset = () => errors.clearAll();\n\n\treturn () => renderErrorBoundary(errors.errors, props, reset);\n}\n\nfunction renderErrorBoundary(\n\terrors: readonly ErrorReport[],\n\tprops: ErrorBoundaryProps,\n\treset: () => void\n): RenderResult {\n\tconst error = errors.at(-1);\n\tif (!error) return props.children ?? null;\n\tif (typeof props.fallback === 'function') return props.fallback({ errors, error, reset });\n\tif (props.fallback !== undefined) return props.fallback;\n\treturn createDefaultBoundaryView(errors, reset);\n}\n\nfunction createDefaultBoundaryView(errors: readonly ErrorReport[], reset: () => void): Child {\n\treturn createDefaultErrorView(errors, {\n\t\tactions: [\n\t\t\tcreateCompiledIntrinsicReceipt('button', { type: 'button', onClick: reset }, 'Try again')\n\t\t]\n\t});\n}\n"]}
|