@reykjavik/webtools 0.3.2 → 0.3.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/CHANGELOG.md +8 -2
- package/README.md +5 -1
- package/errorhandling.d.ts +3 -1
- package/errorhandling.js +2 -2
- package/esm/errorhandling.d.ts +3 -1
- package/esm/errorhandling.js +2 -2
- package/esm/vanillaExtract.d.ts +1 -1
- package/esm/vanillaExtract.js +1 -1
- package/package.json +1 -1
- package/vanillaExtract.d.ts +1 -1
- package/vanillaExtract.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,13 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
- ... <!-- Add new lines here. -->
|
|
6
6
|
|
|
7
|
+
## 0.3.3
|
|
8
|
+
|
|
9
|
+
_2026-02-13_
|
|
10
|
+
|
|
11
|
+
- feat: Make `ResultFail` better infer its error type from the argument
|
|
12
|
+
|
|
7
13
|
## 0.3.2
|
|
8
14
|
|
|
9
15
|
_2025-12-01_
|
|
10
16
|
|
|
11
17
|
- `@reykjavik/webtools/errorhandling`:
|
|
12
18
|
- feat: Add type `Result.PayloadOf<T>` to extract the successful payload
|
|
13
|
-
type from a `ResultTuple<T>` or a `ResultTuple`-returning function
|
|
19
|
+
type from a `ResultTuple<T>` or a `ResultTuple`-returning function
|
|
14
20
|
|
|
15
21
|
## 0.3.0 – 0.3.1
|
|
16
22
|
|
|
@@ -28,7 +34,7 @@ _2025-09-30_
|
|
|
28
34
|
|
|
29
35
|
- `@reykjavik/webtools/next/vanillaExtract`:
|
|
30
36
|
- feat: Make `vanillaVars` return a type-safe `setVars()` helper to avoid
|
|
31
|
-
offending VSCode's CSS syntax parser too much
|
|
37
|
+
offending VSCode's CSS syntax parser too much
|
|
32
38
|
|
|
33
39
|
## 0.2.8
|
|
34
40
|
|
package/README.md
CHANGED
|
@@ -1216,11 +1216,15 @@ const myStyle = style({
|
|
|
1216
1216
|
### `vanillaVars`
|
|
1217
1217
|
|
|
1218
1218
|
**Syntax:**
|
|
1219
|
-
`` vanillaVars(...varNames: Array<T>): Record <`var${Capitalize<T>}`, string> ``
|
|
1219
|
+
`` vanillaVars(...varNames: Array<T>): Record <`var${Capitalize<T>}`, string> & { setVars: (Partial<Record<`var${Capitalize<T>}`, unknown>>) => string} ``
|
|
1220
1220
|
|
|
1221
1221
|
Returns an object with privately scoped CSS variables props. Pass them around
|
|
1222
1222
|
and use them in your CSS.
|
|
1223
1223
|
|
|
1224
|
+
The object also has a `setVars` method for generating a CSS string that sets
|
|
1225
|
+
all or some of the variables in CSS, without offending VSCode's CSS syntax
|
|
1226
|
+
parser too much.
|
|
1227
|
+
|
|
1224
1228
|
```ts
|
|
1225
1229
|
// MyComponent.css.ts
|
|
1226
1230
|
import {
|
package/errorhandling.d.ts
CHANGED
|
@@ -51,6 +51,8 @@ export type ResultTuple<T, E extends Error = Error> = [error: undefined, result:
|
|
|
51
51
|
* @see https://github.com/reykjavikcity/webtools/blob/v0.3/README.md#type-resulttupleobj
|
|
52
52
|
*/
|
|
53
53
|
export type ResultTupleObj<T, E extends Error = Error> = SuccessResult<T> | FailResult<E>;
|
|
54
|
+
declare function Fail<E extends Error = Error>(e: E): FailResult<E>;
|
|
55
|
+
declare function Fail<E extends Error = Error>(e: unknown): FailResult<E>;
|
|
54
56
|
/**
|
|
55
57
|
* Error handling utility that wraps a promise or a callback function.
|
|
56
58
|
*
|
|
@@ -82,7 +84,7 @@ export declare const Result: {
|
|
|
82
84
|
*
|
|
83
85
|
* @see https://github.com/reykjavikcity/webtools/blob/v0.3/README.md#resultsfail
|
|
84
86
|
*/
|
|
85
|
-
Fail:
|
|
87
|
+
Fail: typeof Fail;
|
|
86
88
|
catch: typeof catch_;
|
|
87
89
|
ify: typeof catch_;
|
|
88
90
|
/**
|
package/errorhandling.js
CHANGED
|
@@ -48,12 +48,12 @@ const Success = (result) => {
|
|
|
48
48
|
return tuple;
|
|
49
49
|
};
|
|
50
50
|
/*#__NO_SIDE_EFFECTS__*/
|
|
51
|
-
|
|
51
|
+
function Fail(e) {
|
|
52
52
|
const tuple = [(0, exports.asError)(e)];
|
|
53
53
|
tuple.error = tuple[0];
|
|
54
54
|
tuple.mapTo = () => tuple;
|
|
55
55
|
return tuple;
|
|
56
|
-
}
|
|
56
|
+
}
|
|
57
57
|
/*#__NO_SIDE_EFFECTS__*/
|
|
58
58
|
function catch_(something) {
|
|
59
59
|
if (something instanceof Promise) {
|
package/esm/errorhandling.d.ts
CHANGED
|
@@ -51,6 +51,8 @@ export type ResultTuple<T, E extends Error = Error> = [error: undefined, result:
|
|
|
51
51
|
* @see https://github.com/reykjavikcity/webtools/blob/v0.3/README.md#type-resulttupleobj
|
|
52
52
|
*/
|
|
53
53
|
export type ResultTupleObj<T, E extends Error = Error> = SuccessResult<T> | FailResult<E>;
|
|
54
|
+
declare function Fail<E extends Error = Error>(e: E): FailResult<E>;
|
|
55
|
+
declare function Fail<E extends Error = Error>(e: unknown): FailResult<E>;
|
|
54
56
|
/**
|
|
55
57
|
* Error handling utility that wraps a promise or a callback function.
|
|
56
58
|
*
|
|
@@ -82,7 +84,7 @@ export declare const Result: {
|
|
|
82
84
|
*
|
|
83
85
|
* @see https://github.com/reykjavikcity/webtools/blob/v0.3/README.md#resultsfail
|
|
84
86
|
*/
|
|
85
|
-
Fail:
|
|
87
|
+
Fail: typeof Fail;
|
|
86
88
|
catch: typeof catch_;
|
|
87
89
|
ify: typeof catch_;
|
|
88
90
|
/**
|
package/esm/errorhandling.js
CHANGED
|
@@ -43,12 +43,12 @@ const Success = (result) => {
|
|
|
43
43
|
return tuple;
|
|
44
44
|
};
|
|
45
45
|
/*#__NO_SIDE_EFFECTS__*/
|
|
46
|
-
|
|
46
|
+
function Fail(e) {
|
|
47
47
|
const tuple = [asError(e)];
|
|
48
48
|
tuple.error = tuple[0];
|
|
49
49
|
tuple.mapTo = () => tuple;
|
|
50
50
|
return tuple;
|
|
51
|
-
}
|
|
51
|
+
}
|
|
52
52
|
/*#__NO_SIDE_EFFECTS__*/
|
|
53
53
|
function catch_(something) {
|
|
54
54
|
if (something instanceof Promise) {
|
package/esm/vanillaExtract.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare function vanillaClass(debugId: string, css: string | ClassNameCal
|
|
|
35
35
|
* Returns an object with privately scoped CSS variables props.
|
|
36
36
|
* Pass them around and use them in your CSS.
|
|
37
37
|
*
|
|
38
|
-
* @see https://github.com/reykjavikcity/webtools/blob/v0.3/README.md#
|
|
38
|
+
* @see https://github.com/reykjavikcity/webtools/blob/v0.3/README.md#vanillavars
|
|
39
39
|
*/
|
|
40
40
|
export declare const vanillaVars: <T extends string>(...varNames: Array<T>) => Record<`var${Capitalize<T>}`, string> & {
|
|
41
41
|
/** Allows initializing all or some of the variables in CSS, without offending VSCode's CSS syntax parser too much. */
|
package/esm/vanillaExtract.js
CHANGED
|
@@ -31,7 +31,7 @@ export function vanillaClass(cssOrDebugId, css) {
|
|
|
31
31
|
* Returns an object with privately scoped CSS variables props.
|
|
32
32
|
* Pass them around and use them in your CSS.
|
|
33
33
|
*
|
|
34
|
-
* @see https://github.com/reykjavikcity/webtools/blob/v0.3/README.md#
|
|
34
|
+
* @see https://github.com/reykjavikcity/webtools/blob/v0.3/README.md#vanillavars
|
|
35
35
|
*/
|
|
36
36
|
export const vanillaVars = (...varNames) => {
|
|
37
37
|
const id = vanillaClass(``);
|
package/package.json
CHANGED
package/vanillaExtract.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare function vanillaClass(debugId: string, css: string | ClassNameCal
|
|
|
35
35
|
* Returns an object with privately scoped CSS variables props.
|
|
36
36
|
* Pass them around and use them in your CSS.
|
|
37
37
|
*
|
|
38
|
-
* @see https://github.com/reykjavikcity/webtools/blob/v0.3/README.md#
|
|
38
|
+
* @see https://github.com/reykjavikcity/webtools/blob/v0.3/README.md#vanillavars
|
|
39
39
|
*/
|
|
40
40
|
export declare const vanillaVars: <T extends string>(...varNames: Array<T>) => Record<`var${Capitalize<T>}`, string> & {
|
|
41
41
|
/** Allows initializing all or some of the variables in CSS, without offending VSCode's CSS syntax parser too much. */
|
package/vanillaExtract.js
CHANGED
|
@@ -37,7 +37,7 @@ function vanillaClass(cssOrDebugId, css) {
|
|
|
37
37
|
* Returns an object with privately scoped CSS variables props.
|
|
38
38
|
* Pass them around and use them in your CSS.
|
|
39
39
|
*
|
|
40
|
-
* @see https://github.com/reykjavikcity/webtools/blob/v0.3/README.md#
|
|
40
|
+
* @see https://github.com/reykjavikcity/webtools/blob/v0.3/README.md#vanillavars
|
|
41
41
|
*/
|
|
42
42
|
const vanillaVars = (...varNames) => {
|
|
43
43
|
const id = vanillaClass(``);
|