solid-ctrl-flow 1.0.59 → 1.0.61

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
@@ -4,46 +4,6 @@ import { JSX } from 'solid-js';
4
4
  import { MemoOptions } from 'solid-js';
5
5
  import { Owner } from 'solid-js';
6
6
  import { ParentProps } from 'solid-js';
7
- import { Signal } from 'solid-js';
8
-
9
- /** Reactive atomic value without the inconveniences of {@link Signal} */
10
- export declare class Atom<T> {
11
- get: Accessor<T>;
12
- set: (x: T) => void;
13
- get value(): T;
14
- set value(v: T);
15
- constructor(get: Accessor<T>, set: (x: T) => void);
16
- /**
17
- * Allows you to set the current {@link Atom} based on its current value.
18
- * The current value gets read through {@link untrack} to mimic the {@link Setter} behaviour
19
- * @param f Function that creates a new value based on the current one
20
- */
21
- update<V extends T>(f: (prev: T) => V): V;
22
- /**
23
- * Creates a new {@link Atom} that applies a conversion to the current one
24
- * @param to Conversion function from {@link S} to {@link D}
25
- * @param from Conversion function from {@link D} to {@link S}
26
- */
27
- convert<R>(to: (x: T) => R, from: (x: R) => T): Atom<R>;
28
- /**
29
- * Creates an {@link Atom} that forwards an {@link Accessor} to another {@link Atom}
30
- * @param f The reactive {@link Accessor} to the {@link Atom} to forward
31
- */
32
- static unwrap<T>(f: Accessor<Atom<T>>): Atom<T>;
33
- /**
34
- * Creates an {@link Atom} based on a {@link Signal}
35
- * @param param0 The {@link Signal} to forward
36
- */
37
- static from<T>([get, set]: Signal<T>): Atom<T>;
38
- /**
39
- * Creates a bindable data source.
40
- * If {@link bind} returns an {@link Atom} it gets wrapped, otherwise it creates a {@link Signal} using {@link f} and uses it to store the value until {@link bind}'s value changes
41
- * @param bind The bound {@link Atom}
42
- * @param f The function that will create the actual {@link Signal} that will store the {@link Atom}'s data in case that {@link bind} doesn't return anything
43
- */
44
- static source<T>(bind: Accessor<Atom<T> | undefined>): Atom<T | undefined>;
45
- static source<T>(bind: Accessor<Atom<T> | undefined>, f: Accessor<Signal<T>>): Atom<T>;
46
- }
47
7
 
48
8
  /** Type hack for making {@link ReactiveContext} implement {@link Accessor} */
49
9
  declare const BASE_CTOR: new <T>() => Accessor<T>;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { useContext, createMemo, createComponent, createContext, createRoot, getOwner, untrack, splitProps, Show, onCleanup, For, Match, mergeProps, on, createSignal } from "solid-js";
1
+ import { useContext, createMemo, createComponent, createContext, createRoot, getOwner, untrack, splitProps, Show, onCleanup, For, Match, mergeProps } from "solid-js";
2
2
  import { createMutable } from "solid-js/store";
3
3
  const BASE_CTOR = Function;
4
4
  class ReactiveContext extends BASE_CTOR {
@@ -224,51 +224,6 @@ function Case(props) {
224
224
  }
225
225
  }, other));
226
226
  }
227
- class Atom {
228
- constructor(get, set) {
229
- this.get = get;
230
- this.set = set;
231
- }
232
- get value() {
233
- return this.get();
234
- }
235
- set value(v) {
236
- this.set(v);
237
- }
238
- /**
239
- * Allows you to set the current {@link Atom} based on its current value.
240
- * The current value gets read through {@link untrack} to mimic the {@link Setter} behaviour
241
- * @param f Function that creates a new value based on the current one
242
- */
243
- update(f) {
244
- return this.value = f(untrack(this.get));
245
- }
246
- /**
247
- * Creates a new {@link Atom} that applies a conversion to the current one
248
- * @param to Conversion function from {@link S} to {@link D}
249
- * @param from Conversion function from {@link D} to {@link S}
250
- */
251
- convert(to, from) {
252
- return new Atom(() => to(this.value), (x) => this.value = from(x));
253
- }
254
- /**
255
- * Creates an {@link Atom} that forwards an {@link Accessor} to another {@link Atom}
256
- * @param f The reactive {@link Accessor} to the {@link Atom} to forward
257
- */
258
- static unwrap(f) {
259
- return new this(() => f().value, (x) => f().value = x);
260
- }
261
- /**
262
- * Creates an {@link Atom} based on a {@link Signal}
263
- * @param param0 The {@link Signal} to forward
264
- */
265
- static from([get, set]) {
266
- return new this(get, (v) => set(() => v));
267
- }
268
- static source(bind, f = createSignal) {
269
- return this.unwrap(createMemo(on(bind, (x) => x ?? Atom.from(f()))));
270
- }
271
- }
272
227
  const debug = ReactiveContext.create(false, "debug-scope");
273
228
  function SameContext(props) {
274
229
  return createMemo(() => {
@@ -277,7 +232,6 @@ function SameContext(props) {
277
232
  });
278
233
  }
279
234
  export {
280
- Atom,
281
235
  Case,
282
236
  Enfold,
283
237
  On,
package/dist/index.umd.js CHANGED
@@ -226,51 +226,6 @@
226
226
  }
227
227
  }, other));
228
228
  }
229
- class Atom {
230
- constructor(get, set) {
231
- this.get = get;
232
- this.set = set;
233
- }
234
- get value() {
235
- return this.get();
236
- }
237
- set value(v) {
238
- this.set(v);
239
- }
240
- /**
241
- * Allows you to set the current {@link Atom} based on its current value.
242
- * The current value gets read through {@link untrack} to mimic the {@link Setter} behaviour
243
- * @param f Function that creates a new value based on the current one
244
- */
245
- update(f) {
246
- return this.value = f(solidJs.untrack(this.get));
247
- }
248
- /**
249
- * Creates a new {@link Atom} that applies a conversion to the current one
250
- * @param to Conversion function from {@link S} to {@link D}
251
- * @param from Conversion function from {@link D} to {@link S}
252
- */
253
- convert(to, from) {
254
- return new Atom(() => to(this.value), (x) => this.value = from(x));
255
- }
256
- /**
257
- * Creates an {@link Atom} that forwards an {@link Accessor} to another {@link Atom}
258
- * @param f The reactive {@link Accessor} to the {@link Atom} to forward
259
- */
260
- static unwrap(f) {
261
- return new this(() => f().value, (x) => f().value = x);
262
- }
263
- /**
264
- * Creates an {@link Atom} based on a {@link Signal}
265
- * @param param0 The {@link Signal} to forward
266
- */
267
- static from([get, set]) {
268
- return new this(get, (v) => set(() => v));
269
- }
270
- static source(bind, f = solidJs.createSignal) {
271
- return this.unwrap(solidJs.createMemo(solidJs.on(bind, (x) => x ?? Atom.from(f()))));
272
- }
273
- }
274
229
  const debug = ReactiveContext.create(false, "debug-scope");
275
230
  function SameContext(props) {
276
231
  return solidJs.createMemo(() => {
@@ -278,7 +233,6 @@
278
233
  return props.children;
279
234
  });
280
235
  }
281
- exports2.Atom = Atom;
282
236
  exports2.Case = Case;
283
237
  exports2.Enfold = Enfold;
284
238
  exports2.On = On;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-ctrl-flow",
3
- "version": "1.0.59",
3
+ "version": "1.0.61",
4
4
  "description": "Control flow components for solid-js",
5
5
  "author": "AFatNiBBa",
6
6
  "license": "ISC",
package/readMe.md CHANGED
@@ -162,27 +162,6 @@ return <>
162
162
 
163
163
  ## Utility
164
164
 
165
- ### `Atom`s
166
- Customizable and simplified wrappers for reactive states
167
-
168
- > #### `new Atom()`
169
- > Creates an `Atom` with custom getter and setter
170
- >
171
- > #### `Atom.update()`
172
- > Like the `Setter` overload of a `Signal` that takes a function with the previous value
173
- >
174
- > #### `Atom.convert()`
175
- > Creates a new `Atom` that applies a conversion to the current one
176
- >
177
- > #### `Atom.unwrap()`
178
- > An `Atom`-specific (optimized) version of `unwrap()` that allows the destructuring of its result
179
- >
180
- > #### `Atom.from()`
181
- > Creates an `Atom` from a `Signal`
182
- >
183
- > #### `Atom.source()`
184
- > Similiar to `Atom.unwrap()`, but if the `Accessor` doesn't return anything it automatically creates an internal `Signal` in which to store the value
185
-
186
165
  ### `ReactiveContext.create()`
187
166
  Method that creates a reactive version of a solid `Context` with some additional built-in functionalities
188
167
  ```ts