@indietabletop/appkit 2.1.0 → 3.0.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/README.md +1 -1
- package/dist/async-op.d.ts +12 -0
- package/dist/async-op.js +14 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +14 -0
- package/package.json +4 -8
package/README.md
CHANGED
package/dist/async-op.d.ts
CHANGED
|
@@ -68,6 +68,18 @@ export declare class Failure<FailureValue> implements Operation<never, FailureVa
|
|
|
68
68
|
mapFailure<MappedFailure>(mappingFn: (value: FailureValue) => MappedFailure): Failure<MappedFailure>;
|
|
69
69
|
unpack<S, F, P>(_mapS: (value: never) => S, mapF: (failure: FailureValue) => F, _mapP: () => P): S | F | P;
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Folds multiple ops into a single op.
|
|
73
|
+
*
|
|
74
|
+
* To return a Success, all ops provided must be a Success. If any Failures are
|
|
75
|
+
* encountered, will return the first one found.
|
|
76
|
+
*
|
|
77
|
+
* If neither of these conditions is true, will return Pending.
|
|
78
|
+
*
|
|
79
|
+
* Note that if passed an empty array, will always return a Success (with an
|
|
80
|
+
* empty array as value). This mimics the semantics of many JS constructs, like
|
|
81
|
+
* Promise.all or Array.prototype.every.
|
|
82
|
+
*/
|
|
71
83
|
export declare function fold<Ops extends readonly AsyncOp<unknown, unknown>[] | []>(ops: Ops): AsyncOp<{
|
|
72
84
|
-readonly [Index in keyof Ops]: Ops[Index] extends AsyncOp<infer S, unknown> ? S : never;
|
|
73
85
|
}, Ops[number] extends AsyncOp<unknown, infer F> ? F : never>;
|
package/dist/async-op.js
CHANGED
|
@@ -197,7 +197,21 @@ export class Failure {
|
|
|
197
197
|
return mapF(this.failure);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Folds multiple ops into a single op.
|
|
202
|
+
*
|
|
203
|
+
* To return a Success, all ops provided must be a Success. If any Failures are
|
|
204
|
+
* encountered, will return the first one found.
|
|
205
|
+
*
|
|
206
|
+
* If neither of these conditions is true, will return Pending.
|
|
207
|
+
*
|
|
208
|
+
* Note that if passed an empty array, will always return a Success (with an
|
|
209
|
+
* empty array as value). This mimics the semantics of many JS constructs, like
|
|
210
|
+
* Promise.all or Array.prototype.every.
|
|
211
|
+
*/
|
|
200
212
|
export function fold(ops) {
|
|
213
|
+
// Note that due to the semantics of `every`, if the array provided to `fold`
|
|
214
|
+
// is empty, the result will be a Success with an empty array.
|
|
201
215
|
if (ops.every((v) => v.isSuccess)) {
|
|
202
216
|
return new Success(ops.map((op) => op.value));
|
|
203
217
|
}
|
package/dist/client.d.ts
CHANGED
package/dist/client.js
CHANGED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./append-copy-to-text.ts";
|
|
2
|
+
export * from "./async-op.ts";
|
|
3
|
+
export * from "./caught-value.ts";
|
|
4
|
+
export * from "./class-names.ts";
|
|
5
|
+
export * from "./client.ts";
|
|
6
|
+
export * from "./external-link.tsx";
|
|
7
|
+
export * from "./structs.ts";
|
|
8
|
+
export * from "./types.ts";
|
|
9
|
+
export * from "./use-async-op.ts";
|
|
10
|
+
export * from "./use-document-background-color.ts";
|
|
11
|
+
export * from "./use-is-installed.ts";
|
|
12
|
+
export * from "./use-media-query.ts";
|
|
13
|
+
export * from "./use-reverting-state.ts";
|
|
14
|
+
export * from "./use-scroll-restoration.ts";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./append-copy-to-text.js";
|
|
2
|
+
export * from "./async-op.js";
|
|
3
|
+
export * from "./caught-value.js";
|
|
4
|
+
export * from "./class-names.js";
|
|
5
|
+
export * from "./client.js";
|
|
6
|
+
export * from "./external-link.js";
|
|
7
|
+
export * from "./structs.js";
|
|
8
|
+
export * from "./types.js";
|
|
9
|
+
export * from "./use-async-op.js";
|
|
10
|
+
export * from "./use-document-background-color.js";
|
|
11
|
+
export * from "./use-is-installed.js";
|
|
12
|
+
export * from "./use-media-query.js";
|
|
13
|
+
export * from "./use-reverting-state.js";
|
|
14
|
+
export * from "./use-scroll-restoration.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indietabletop/appkit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "A collection of modules used in apps built by Indie Tabletop Club",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -19,19 +19,15 @@
|
|
|
19
19
|
"repository": "github:indietabletop/appkit",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"react": "^18.0.0 || ^19.0.0"
|
|
23
|
-
"vite": "^6.0.0"
|
|
22
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
25
|
"@types/react": "^19.0.8",
|
|
27
26
|
"np": "^10.1.0",
|
|
28
|
-
"typescript": "^5.
|
|
27
|
+
"typescript": "^5.8.2",
|
|
29
28
|
"vitest": "^3.0.5"
|
|
30
29
|
},
|
|
31
30
|
"dependencies": {
|
|
32
|
-
"
|
|
33
|
-
"@vitejs/plugin-react": "^4.3.4",
|
|
34
|
-
"superstruct": "^2.0.2",
|
|
35
|
-
"vite": "^6.1.0"
|
|
31
|
+
"superstruct": "^2.0.2"
|
|
36
32
|
}
|
|
37
33
|
}
|