@solid-primitives/utils 5.2.1 → 5.4.0-beta.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/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,19 +1,19 @@
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
- See [CHANGELOG.md](./CHANGELOG.md)
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
+ See [CHANGELOG.md](./CHANGELOG.md)
package/dist/index.cjs CHANGED
@@ -17,9 +17,15 @@ exports.compare = (a, b) => a < b ? -1 : a > b ? 1 : 0;
17
17
  exports.arrayEquals = (a, b) => a === b || a.length === b.length && a.every((e, i) => e === b[i]);
18
18
  function chain(callbacks) {
19
19
  return (...args) => {
20
- for (const callback of callbacks) {
21
- if (typeof callback === "function")
22
- callback(...args);
20
+ for (const callback of callbacks)
21
+ callback && callback(...args);
22
+ };
23
+ }
24
+ function reverseChain(callbacks) {
25
+ return (...args) => {
26
+ for (let i = callbacks.length - 1; i >= 0; i--) {
27
+ const callback = callbacks[i];
28
+ callback && callback(...args);
23
29
  }
24
30
  };
25
31
  }
@@ -170,3 +176,4 @@ exports.createStaticStore = createStaticStore;
170
176
  exports.defer = defer;
171
177
  exports.handleDiffArray = handleDiffArray;
172
178
  exports.isObject = isObject;
179
+ exports.reverseChain = reverseChain;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Accessor, Setter, AccessorArray, NoInfer, EffectFunction, onCleanup, SignalOptions, Signal } from 'solid-js';
2
- export { EffectOptions, OnOptions } from 'solid-js/types/reactive/signal';
2
+ export { EffectOptions, OnOptions, ResolvedChildren, ResolvedJSXElement } from 'solid-js/types/reactive/signal';
3
3
 
4
4
  /**
5
5
  * Can be single or in an array
@@ -108,6 +108,10 @@ declare const arrayEquals: (a: readonly unknown[], b: readonly unknown[]) => boo
108
108
  declare function chain<Args extends [] | any[]>(callbacks: {
109
109
  [Symbol.iterator](): IterableIterator<((...args: Args) => any) | undefined>;
110
110
  }): (...args: Args) => void;
111
+ /**
112
+ * Returns a function that will call all functions in the reversed order with the same arguments.
113
+ */
114
+ declare function reverseChain<Args extends [] | any[]>(callbacks: (((...args: Args) => any) | undefined)[]): (...args: Args) => void;
111
115
  declare const clamp: (n: number, min: number, max: number) => number;
112
116
  /**
113
117
  * Accesses the value of a MaybeAccessor
@@ -203,4 +207,4 @@ declare function handleDiffArray<T>(current: readonly T[], prev: readonly T[], h
203
207
  */
204
208
  declare function createHydrateSignal<T>(serverValue: T, update: () => T, options?: SignalOptions<T>): Signal<T>;
205
209
 
206
- export { AccessReturnTypes, AnyClass, AnyFunction, AnyObject, AnyStatic, DeepPartialAny, Directive, ExtractIfPossible, Falsy, FalsyValue, ItemsOf, ItemsOfMany, Many, MaybeAccessor, MaybeAccessorValue, Modify, ModifyDeep, Narrow, NonIterable, Noop, OnAccessEffectFunction, Position, PrimitiveValue, RequiredKeys, SetterParam, Simplify, StaticStoreSetter, Tail, Truthy, UnboxLazy, UnionToIntersection, Values, access, accessArray, accessWith, arrayEquals, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createHydrateSignal, createMicrotask, createStaticStore, defer, entries, handleDiffArray, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, tryOnCleanup, withAccess };
210
+ export { AccessReturnTypes, AnyClass, AnyFunction, AnyObject, AnyStatic, DeepPartialAny, Directive, ExtractIfPossible, Falsy, FalsyValue, ItemsOf, ItemsOfMany, Many, MaybeAccessor, MaybeAccessorValue, Modify, ModifyDeep, Narrow, NonIterable, Noop, OnAccessEffectFunction, Position, PrimitiveValue, RequiredKeys, SetterParam, Simplify, StaticStoreSetter, Tail, Truthy, UnboxLazy, UnionToIntersection, Values, access, accessArray, accessWith, arrayEquals, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createHydrateSignal, createMicrotask, createStaticStore, defer, entries, handleDiffArray, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, reverseChain, tryOnCleanup, withAccess };
package/dist/index.js CHANGED
@@ -15,9 +15,15 @@ var compare = (a, b) => a < b ? -1 : a > b ? 1 : 0;
15
15
  var arrayEquals = (a, b) => a === b || a.length === b.length && a.every((e, i) => e === b[i]);
16
16
  function chain(callbacks) {
17
17
  return (...args) => {
18
- for (const callback of callbacks) {
19
- if (typeof callback === "function")
20
- callback(...args);
18
+ for (const callback of callbacks)
19
+ callback && callback(...args);
20
+ };
21
+ }
22
+ function reverseChain(callbacks) {
23
+ return (...args) => {
24
+ for (let i = callbacks.length - 1; i >= 0; i--) {
25
+ const callback = callbacks[i];
26
+ callback && callback(...args);
21
27
  }
22
28
  };
23
29
  }
@@ -160,4 +166,4 @@ function createHydrateSignal(serverValue, update, options) {
160
166
  return [state, setState];
161
167
  }
162
168
 
163
- export { access, accessArray, accessWith, arrayEquals, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createHydrateSignal, createMicrotask, createStaticStore, defer, entries, handleDiffArray, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, tryOnCleanup, withAccess };
169
+ export { access, accessArray, accessWith, arrayEquals, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createHydrateSignal, createMicrotask, createStaticStore, defer, entries, handleDiffArray, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, reverseChain, tryOnCleanup, withAccess };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solid-primitives/utils",
3
- "version": "5.2.1",
3
+ "version": "5.4.0-beta.0",
4
4
  "description": "A bunch of reactive utility types and functions, for building primitives with Solid.js",
5
5
  "author": "Damian Tarnawski @thetarnav <gthetarnav@gmail.com>",
6
6
  "contributors": [