solid-ctrl-flow 1.0.53 → 1.0.54

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/dist/index.d.ts CHANGED
@@ -142,6 +142,13 @@ export declare function Enfold<T>(props: Unkeyed<T>): JSX.Element;
142
142
  /** Handy type alias */
143
143
  declare type Equals = MemoOptions<unknown>["equals"];
144
144
 
145
+ /**
146
+ * Creates a {@link Signal} that behaves like the input one, with the only difference that each call to the setter will trigger the effects even if the value didn't change.
147
+ * Can give reactivity to a fake {@link Signal}
148
+ * @param param0 The {@link Signal} to force
149
+ */
150
+ export declare function forceSignal<T>([get, set]: Signal<T>): Signal<T>;
151
+
145
152
  /** Parameters to pass to a keyed {@link Enfold} */
146
153
  declare type Keyed<T> = Standard<T> & {
147
154
  keyed: true;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { useContext, createMemo, createComponent, createContext, createRoot, getOwner, untrack, createEffect, on, createResource, splitProps, Show, onCleanup, For, Match, mergeProps, createRenderEffect, getListener } from "solid-js";
1
+ import { useContext, createMemo, createComponent, createContext, createRoot, getOwner, untrack, createEffect, on, createResource, splitProps, Show, onCleanup, For, Match, mergeProps, createRenderEffect, createSignal, getListener } from "solid-js";
2
2
  import { createMutable } from "solid-js/store";
3
3
  const BASE_CTOR = Function;
4
4
  class ReactiveContext extends BASE_CTOR {
@@ -254,6 +254,16 @@ function toSignal(obj, k) {
254
254
  function unwrapSignal(f) {
255
255
  return [() => f()[0](), (x) => f()[1](x)];
256
256
  }
257
+ function forceSignal([get, set]) {
258
+ const [track, update] = createSignal(void 0, { equals: false });
259
+ return [
260
+ () => (track(), get()),
261
+ (x) => {
262
+ const out = set(x);
263
+ return update(), out;
264
+ }
265
+ ];
266
+ }
257
267
  function coalesceSignal([get, set], f) {
258
268
  return [getter, set];
259
269
  function getter() {
@@ -288,6 +298,7 @@ export {
288
298
  createExtractor,
289
299
  createReactiveResource,
290
300
  debug,
301
+ forceSignal,
291
302
  memoProps,
292
303
  runWithContext,
293
304
  splitAndMemoProps,
package/dist/index.umd.js CHANGED
@@ -256,6 +256,16 @@
256
256
  function unwrapSignal(f) {
257
257
  return [() => f()[0](), (x) => f()[1](x)];
258
258
  }
259
+ function forceSignal([get, set]) {
260
+ const [track, update] = solidJs.createSignal(void 0, { equals: false });
261
+ return [
262
+ () => (track(), get()),
263
+ (x) => {
264
+ const out = set(x);
265
+ return update(), out;
266
+ }
267
+ ];
268
+ }
259
269
  function coalesceSignal([get, set], f) {
260
270
  return [getter, set];
261
271
  function getter() {
@@ -288,6 +298,7 @@
288
298
  exports2.createExtractor = createExtractor;
289
299
  exports2.createReactiveResource = createReactiveResource;
290
300
  exports2.debug = debug;
301
+ exports2.forceSignal = forceSignal;
291
302
  exports2.memoProps = memoProps;
292
303
  exports2.runWithContext = runWithContext;
293
304
  exports2.splitAndMemoProps = splitAndMemoProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-ctrl-flow",
3
- "version": "1.0.53",
3
+ "version": "1.0.54",
4
4
  "description": "Control flow components for solid-js",
5
5
  "author": "AFatNiBBa",
6
6
  "license": "ISC",
package/readMe.md CHANGED
@@ -179,6 +179,9 @@ Functions that create bindings between `Signal`s
179
179
  >
180
180
  > #### `unwrapSignal()`
181
181
  > A `Signal`-specific version of `unwrap()` that allows the destructuring of its result
182
+ >
183
+ > #### `forceSignal()`
184
+ > Creates a `Signal` that behaves like the input one, with the only difference that each call to the setter will trigger the effects even if the value didn't change
182
185
  >
183
186
  > #### `coalesceSignal()`
184
187
  > Creates a non nullable `Signal` from a nullable one