strata-react 1.0.0 → 1.0.2
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 +3 -0
- package/UPGRADING.md +60 -0
- package/dist/components/alert.d.ts +17 -0
- package/dist/components/job-status.d.ts +11 -2
- package/dist/components/toast.d.ts +33 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +224 -15
- package/dist/index.js.map +1 -1
- package/dist/lib/client-work.d.ts +24 -0
- package/package.json +3 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** What the work is given: a signal that aborts on cancel, and a way to report progress. */
|
|
2
|
+
export type WorkContext = {
|
|
3
|
+
signal: AbortSignal;
|
|
4
|
+
/** Report items done, and the total when it is known. */
|
|
5
|
+
progress: (current: number, total?: number) => void;
|
|
6
|
+
};
|
|
7
|
+
/** Where client work is. */
|
|
8
|
+
export type WorkPhase = "idle" | "running" | "finished" | "failed" | "cancelled";
|
|
9
|
+
/** The state `useClientWork` returns. */
|
|
10
|
+
export type ClientWork<T> = {
|
|
11
|
+
phase: WorkPhase;
|
|
12
|
+
current?: number;
|
|
13
|
+
total?: number;
|
|
14
|
+
result?: T;
|
|
15
|
+
error?: unknown;
|
|
16
|
+
/** Runs the work. Ignored while it is already running. */
|
|
17
|
+
start: () => Promise<void>;
|
|
18
|
+
/** Aborts the work's signal; the phase becomes `cancelled`. */
|
|
19
|
+
cancel: () => void;
|
|
20
|
+
/** Back to `idle`, forgetting the result. */
|
|
21
|
+
dismiss: () => void;
|
|
22
|
+
};
|
|
23
|
+
/** Runs browser-side work with progress, cancel and a clear end state, ready for `JobStatus`. */
|
|
24
|
+
export declare function useClientWork<T>(run: (ctx: WorkContext) => Promise<T>): ClientWork<T>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strata-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "React + Tailwind v4 components that ship structure, behaviour, states and a token contract, and no look: each product brings a theme generated from its own subject.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"files": [
|
|
39
39
|
"dist",
|
|
40
40
|
"bin",
|
|
41
|
-
"README.md"
|
|
41
|
+
"README.md",
|
|
42
|
+
"UPGRADING.md"
|
|
42
43
|
],
|
|
43
44
|
"scripts": {
|
|
44
45
|
"clean": "node scripts/clean.mjs",
|