@solid-primitives/utils 1.5.2 → 2.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/LICENSE +21 -21
- package/README.md +46 -46
- package/dist/index.cjs +8 -5
- package/dist/index.d.ts +5 -4
- package/dist/index.js +7 -4
- package/package.json +47 -47
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 Solid Primitives Working Group
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Solid Primitives Working Group
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
<p>
|
|
2
|
-
<img width="100%" src="https://assets.solidjs.com/banner?type=Primitives&background=tiles&project=Utils" alt="Solid Primitives Utils">
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
# @solid-primitives/utils
|
|
6
|
-
|
|
7
|
-
Solid Primitives Utilities is a support and helper package for a number of primitives in our library. Please free to augment or centralize useful utilities and methods in this package for sharing.
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npm install @solid-primitives/utils
|
|
13
|
-
# or
|
|
14
|
-
yarn add @solid-primitives/utils
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Changelog
|
|
18
|
-
|
|
19
|
-
<details>
|
|
20
|
-
<summary><b>Expand Changelog</b></summary>
|
|
21
|
-
|
|
22
|
-
0.0.100
|
|
23
|
-
|
|
24
|
-
First commit of the timer primitive.
|
|
25
|
-
|
|
26
|
-
0.0.250
|
|
27
|
-
|
|
28
|
-
Republished version with better ESM support and build tooling.
|
|
29
|
-
|
|
30
|
-
0.0.260
|
|
31
|
-
|
|
32
|
-
Added comments for util methods.
|
|
33
|
-
|
|
34
|
-
0.1.0
|
|
35
|
-
|
|
36
|
-
Add `/fp` and `/setter` export entries. Add `destore` and `raceTimeout` util. More jsdoc.
|
|
37
|
-
|
|
38
|
-
0.1.2
|
|
39
|
-
|
|
40
|
-
Updated to Solid 1.3
|
|
41
|
-
|
|
42
|
-
0.1.3
|
|
43
|
-
|
|
44
|
-
Minor upgrades.
|
|
45
|
-
|
|
46
|
-
</details>
|
|
1
|
+
<p>
|
|
2
|
+
<img width="100%" src="https://assets.solidjs.com/banner?type=Primitives&background=tiles&project=Utils" alt="Solid Primitives Utils">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# @solid-primitives/utils
|
|
6
|
+
|
|
7
|
+
Solid Primitives Utilities is a support and helper package for a number of primitives in our library. Please free to augment or centralize useful utilities and methods in this package for sharing.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @solid-primitives/utils
|
|
13
|
+
# or
|
|
14
|
+
yarn add @solid-primitives/utils
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Changelog
|
|
18
|
+
|
|
19
|
+
<details>
|
|
20
|
+
<summary><b>Expand Changelog</b></summary>
|
|
21
|
+
|
|
22
|
+
0.0.100
|
|
23
|
+
|
|
24
|
+
First commit of the timer primitive.
|
|
25
|
+
|
|
26
|
+
0.0.250
|
|
27
|
+
|
|
28
|
+
Republished version with better ESM support and build tooling.
|
|
29
|
+
|
|
30
|
+
0.0.260
|
|
31
|
+
|
|
32
|
+
Added comments for util methods.
|
|
33
|
+
|
|
34
|
+
0.1.0
|
|
35
|
+
|
|
36
|
+
Add `/fp` and `/setter` export entries. Add `destore` and `raceTimeout` util. More jsdoc.
|
|
37
|
+
|
|
38
|
+
0.1.2
|
|
39
|
+
|
|
40
|
+
Updated to Solid 1.3
|
|
41
|
+
|
|
42
|
+
0.1.3
|
|
43
|
+
|
|
44
|
+
Minor upgrades.
|
|
45
|
+
|
|
46
|
+
</details>
|
package/dist/index.cjs
CHANGED
|
@@ -53,7 +53,7 @@ __export(src_exports, {
|
|
|
53
53
|
isDev: () => isDev,
|
|
54
54
|
isObject: () => isObject,
|
|
55
55
|
isProd: () => isProd,
|
|
56
|
-
isServer: () =>
|
|
56
|
+
isServer: () => isServer,
|
|
57
57
|
keys: () => keys,
|
|
58
58
|
noop: () => noop,
|
|
59
59
|
ofClass: () => ofClass,
|
|
@@ -67,7 +67,8 @@ module.exports = __toCommonJS(src_exports);
|
|
|
67
67
|
var import_solid_js = require("solid-js");
|
|
68
68
|
var import_web = require("solid-js/web");
|
|
69
69
|
var noop = () => void 0;
|
|
70
|
-
var
|
|
70
|
+
var isServer = import_web.isServer;
|
|
71
|
+
var isClient = !isServer;
|
|
71
72
|
var isDev = import_solid_js.DEV && isClient;
|
|
72
73
|
var isProd = !isDev;
|
|
73
74
|
var warn = (...a) => isDev && console.warn(...a);
|
|
@@ -76,10 +77,12 @@ function isObject(value) {
|
|
|
76
77
|
return value !== null && (typeof value === "object" || typeof value === "function");
|
|
77
78
|
}
|
|
78
79
|
var compare = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
79
|
-
function chain(
|
|
80
|
+
function chain(callbacks) {
|
|
80
81
|
return (...args) => {
|
|
81
|
-
for (const callback of callbacks)
|
|
82
|
-
callback
|
|
82
|
+
for (const callback of callbacks) {
|
|
83
|
+
if (typeof callback === "function")
|
|
84
|
+
callback(...args);
|
|
85
|
+
}
|
|
83
86
|
};
|
|
84
87
|
}
|
|
85
88
|
var clamp = (n, min, max) => Math.min(Math.max(n, min), max);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Accessor, Setter, onCleanup } from 'solid-js';
|
|
2
2
|
import { BaseOptions } from 'solid-js/types/reactive/signal';
|
|
3
|
-
export { isServer } from 'solid-js/web';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Can be single or in an array
|
|
@@ -92,8 +91,8 @@ declare type Position = {
|
|
|
92
91
|
|
|
93
92
|
/** no operation */
|
|
94
93
|
declare const noop: Noop;
|
|
94
|
+
declare const isServer: boolean;
|
|
95
95
|
declare const isClient = true;
|
|
96
|
-
|
|
97
96
|
/** development environment */
|
|
98
97
|
declare const isDev = true;
|
|
99
98
|
/** production environment */
|
|
@@ -110,7 +109,9 @@ declare const compare: (a: any, b: any) => number;
|
|
|
110
109
|
/**
|
|
111
110
|
* Returns a function that will call all functions in the order they were chained with the same arguments.
|
|
112
111
|
*/
|
|
113
|
-
declare function chain<Args extends [] | any[]>(
|
|
112
|
+
declare function chain<Args extends [] | any[]>(callbacks: {
|
|
113
|
+
[Symbol.iterator](): IterableIterator<((...args: Args) => any) | undefined>;
|
|
114
|
+
}): (...args: Args) => void;
|
|
114
115
|
declare const clamp: (n: number, min: number, max: number) => number;
|
|
115
116
|
/**
|
|
116
117
|
* Accesses the value of a MaybeAccessor
|
|
@@ -254,4 +255,4 @@ declare type StaticStoreSetter<T extends Readonly<AnyStatic>> = {
|
|
|
254
255
|
*/
|
|
255
256
|
declare function createStaticStore<T extends Readonly<AnyStatic>>(init: T): [access: T, write: StaticStoreSetter<T>];
|
|
256
257
|
|
|
257
|
-
export { AccessReturnTypes, AnyClass, AnyFunction, AnyObject, AnyStatic, DeepPartialAny, Definite, Directive, ExtractIfPossible, Falsy, FalsyValue, ItemsOf, ItemsOfMany, Many, MaybeAccessor, MaybeAccessorValue, Modify, ModifyDeep, NonIterable, Noop, OnAccessEffectFunction, Position, PrimitiveValue, RequiredKeys, SetterValue, Simplify, StaticStoreSetter, Tail, Trigger, TriggerCache, Truthy, UnboxLazy, UnionToIntersection, Values, access, accessArray, accessWith, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createMicrotask, createProxy, createStaticStore, createTrigger, createTriggerCache, entries, forEachEntry, isClient, isDev, isObject, isProd, keys, noop, ofClass, onRootCleanup, promiseTimeout, raceTimeout, warn, withAccess };
|
|
258
|
+
export { AccessReturnTypes, AnyClass, AnyFunction, AnyObject, AnyStatic, DeepPartialAny, Definite, Directive, ExtractIfPossible, Falsy, FalsyValue, ItemsOf, ItemsOfMany, Many, MaybeAccessor, MaybeAccessorValue, Modify, ModifyDeep, NonIterable, Noop, OnAccessEffectFunction, Position, PrimitiveValue, RequiredKeys, SetterValue, Simplify, StaticStoreSetter, Tail, Trigger, TriggerCache, Truthy, UnboxLazy, UnionToIntersection, Values, access, accessArray, accessWith, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createMicrotask, createProxy, createStaticStore, createTrigger, createTriggerCache, entries, forEachEntry, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, onRootCleanup, promiseTimeout, raceTimeout, warn, withAccess };
|
package/dist/index.js
CHANGED
|
@@ -17,8 +17,9 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
|
|
18
18
|
// src/index.ts
|
|
19
19
|
import { getOwner, onCleanup, createSignal, DEV, untrack, batch } from "solid-js";
|
|
20
|
-
import { isServer } from "solid-js/web";
|
|
20
|
+
import { isServer as _isServer } from "solid-js/web";
|
|
21
21
|
var noop = () => void 0;
|
|
22
|
+
var isServer = _isServer;
|
|
22
23
|
var isClient = !isServer;
|
|
23
24
|
var isDev = DEV && isClient;
|
|
24
25
|
var isProd = !isDev;
|
|
@@ -28,10 +29,12 @@ function isObject(value) {
|
|
|
28
29
|
return value !== null && (typeof value === "object" || typeof value === "function");
|
|
29
30
|
}
|
|
30
31
|
var compare = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
31
|
-
function chain(
|
|
32
|
+
function chain(callbacks) {
|
|
32
33
|
return (...args) => {
|
|
33
|
-
for (const callback of callbacks)
|
|
34
|
-
callback
|
|
34
|
+
for (const callback of callbacks) {
|
|
35
|
+
if (typeof callback === "function")
|
|
36
|
+
callback(...args);
|
|
37
|
+
}
|
|
35
38
|
};
|
|
36
39
|
}
|
|
37
40
|
var clamp = (n, min, max) => Math.min(Math.max(n, min), max);
|
package/package.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@solid-primitives/utils",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "A bunch of reactive utility types and functions, for building primitives with Solid.js",
|
|
5
|
-
"author": "Damian Tarnawski @thetarnav <gthetarnav@gmail.com>",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"homepage": "https://github.com/solidjs-community/solid-primitives/tree/main/packages/utils#readme",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/solidjs-community/solid-primitives.git"
|
|
11
|
-
},
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/solidjs-community/solid-primitives/issues"
|
|
14
|
-
},
|
|
15
|
-
"private": false,
|
|
16
|
-
"sideEffects": false,
|
|
17
|
-
"type": "module",
|
|
18
|
-
"main": "dist/index.cjs",
|
|
19
|
-
"module": "dist/index.js",
|
|
20
|
-
"types": "dist/index.d.ts",
|
|
21
|
-
"files": [
|
|
22
|
-
"dist"
|
|
23
|
-
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "tsup",
|
|
26
|
-
"test": "uvu -r solid-register",
|
|
27
|
-
"test:watch": "watchlist src test -- npm test"
|
|
28
|
-
},
|
|
29
|
-
"keywords": [
|
|
30
|
-
"utilities",
|
|
31
|
-
"reactivity",
|
|
32
|
-
"solid",
|
|
33
|
-
"primitives"
|
|
34
|
-
],
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"jsdom": "^19.0.0",
|
|
37
|
-
"prettier": "^2.5.1",
|
|
38
|
-
"solid-register": "^0.
|
|
39
|
-
"tslib": "^2.3.1",
|
|
40
|
-
"tsup": "^5.11.0",
|
|
41
|
-
"uvu": "^0.5.2",
|
|
42
|
-
"watchlist": "^0.3.1"
|
|
43
|
-
},
|
|
44
|
-
"peerDependencies": {
|
|
45
|
-
"solid-js": "^1.
|
|
46
|
-
}
|
|
47
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@solid-primitives/utils",
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"description": "A bunch of reactive utility types and functions, for building primitives with Solid.js",
|
|
5
|
+
"author": "Damian Tarnawski @thetarnav <gthetarnav@gmail.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/solidjs-community/solid-primitives/tree/main/packages/utils#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/solidjs-community/solid-primitives.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/solidjs-community/solid-primitives/issues"
|
|
14
|
+
},
|
|
15
|
+
"private": false,
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "dist/index.cjs",
|
|
19
|
+
"module": "dist/index.js",
|
|
20
|
+
"types": "dist/index.d.ts",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup",
|
|
26
|
+
"test": "uvu -r solid-register",
|
|
27
|
+
"test:watch": "watchlist src test -- npm test"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"utilities",
|
|
31
|
+
"reactivity",
|
|
32
|
+
"solid",
|
|
33
|
+
"primitives"
|
|
34
|
+
],
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"jsdom": "^19.0.0",
|
|
37
|
+
"prettier": "^2.5.1",
|
|
38
|
+
"solid-register": "^0.2.5",
|
|
39
|
+
"tslib": "^2.3.1",
|
|
40
|
+
"tsup": "^5.11.0",
|
|
41
|
+
"uvu": "^0.5.2",
|
|
42
|
+
"watchlist": "^0.3.1"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"solid-js": "^1.4.1"
|
|
46
|
+
}
|
|
47
|
+
}
|