veles 0.0.5 → 0.0.7

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.
@@ -0,0 +1,18 @@
1
+ import { c as createState } from '../create-state-D1JASFVs.cjs';
2
+ import '../types.d-DgVBp6oa.cjs';
3
+
4
+ type createdState<StateType> = ReturnType<typeof createState<StateType>>;
5
+ declare function combineState<A, B>(state1: createdState<A>, state2: createdState<B>): createdState<[A, B]>;
6
+ declare function combineState<A, B, C>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>): createdState<[A, B, C]>;
7
+ declare function combineState<A, B, C, D>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>, state4: createdState<D>): createdState<[A, B, C, D]>;
8
+ declare function combineState<A, B, C, D, E>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>, state4: createdState<D>, state5: createdState<E>): createdState<[A, B, C, D, E]>;
9
+ declare function combineState<A, B, C, D, E, F>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>, state4: createdState<D>, state5: createdState<E>, state6: createdState<F>): createdState<[A, B, C, D, E, F]>;
10
+ declare function combineState<A, B, C, D, E, F, G>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>, state4: createdState<D>, state5: createdState<E>, state6: createdState<F>, state7: createdState<G>): createdState<[A, B, C, D, E, F, G]>;
11
+ declare function combineState<A, B, C, D, E, F, G, H>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>, state4: createdState<D>, state5: createdState<E>, state6: createdState<F>, state7: createdState<G>, state8: createdState<H>): createdState<[A, B, C, D, E, F, G, H]>;
12
+ declare function combineState<A, B, C, D, E, F, G, H, I>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>, state4: createdState<D>, state5: createdState<E>, state6: createdState<F>, state7: createdState<G>, state8: createdState<H>, state9: createdState<I>): createdState<[A, B, C, D, E, F, G, H, I]>;
13
+ declare function combineState<A, B, C, D, E, F, G, H, I, J>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>, state4: createdState<D>, state5: createdState<E>, state6: createdState<F>, state7: createdState<G>, state8: createdState<H>, state9: createdState<I>, state10: createdState<J>): createdState<[A, B, C, D, E, F, G, H, I, J]>;
14
+
15
+ type State<StateType> = ReturnType<typeof createState<StateType>>;
16
+ declare function selectState<F, T>(state: State<F>, selector: (state: F) => T): State<T>;
17
+
18
+ export { combineState as combine, combineState, selectState as select, selectState };
@@ -0,0 +1,18 @@
1
+ import { c as createState } from '../create-state-Bo6TT4qP.js';
2
+ import '../types.d-DgVBp6oa.js';
3
+
4
+ type createdState<StateType> = ReturnType<typeof createState<StateType>>;
5
+ declare function combineState<A, B>(state1: createdState<A>, state2: createdState<B>): createdState<[A, B]>;
6
+ declare function combineState<A, B, C>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>): createdState<[A, B, C]>;
7
+ declare function combineState<A, B, C, D>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>, state4: createdState<D>): createdState<[A, B, C, D]>;
8
+ declare function combineState<A, B, C, D, E>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>, state4: createdState<D>, state5: createdState<E>): createdState<[A, B, C, D, E]>;
9
+ declare function combineState<A, B, C, D, E, F>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>, state4: createdState<D>, state5: createdState<E>, state6: createdState<F>): createdState<[A, B, C, D, E, F]>;
10
+ declare function combineState<A, B, C, D, E, F, G>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>, state4: createdState<D>, state5: createdState<E>, state6: createdState<F>, state7: createdState<G>): createdState<[A, B, C, D, E, F, G]>;
11
+ declare function combineState<A, B, C, D, E, F, G, H>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>, state4: createdState<D>, state5: createdState<E>, state6: createdState<F>, state7: createdState<G>, state8: createdState<H>): createdState<[A, B, C, D, E, F, G, H]>;
12
+ declare function combineState<A, B, C, D, E, F, G, H, I>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>, state4: createdState<D>, state5: createdState<E>, state6: createdState<F>, state7: createdState<G>, state8: createdState<H>, state9: createdState<I>): createdState<[A, B, C, D, E, F, G, H, I]>;
13
+ declare function combineState<A, B, C, D, E, F, G, H, I, J>(state1: createdState<A>, state2: createdState<B>, state3: createdState<C>, state4: createdState<D>, state5: createdState<E>, state6: createdState<F>, state7: createdState<G>, state8: createdState<H>, state9: createdState<I>, state10: createdState<J>): createdState<[A, B, C, D, E, F, G, H, I, J]>;
14
+
15
+ type State<StateType> = ReturnType<typeof createState<StateType>>;
16
+ declare function selectState<F, T>(state: State<F>, selector: (state: F) => T): State<T>;
17
+
18
+ export { combineState as combine, combineState, selectState as select, selectState };
@@ -0,0 +1,37 @@
1
+ import {
2
+ createState
3
+ } from "../chunk-MH6DPZ3V.js";
4
+ import "../chunk-ILNLS6QO.js";
5
+
6
+ // src/utils/combine-state.ts
7
+ function combineState(...states) {
8
+ const initialValue = states.map((state) => state.getValue());
9
+ const combinedState = createState(initialValue);
10
+ states.forEach((state) => {
11
+ state.trackValue(() => {
12
+ const updatedValue = states.map((state2) => state2.getValue());
13
+ combinedState.setValue(updatedValue);
14
+ });
15
+ });
16
+ return combinedState;
17
+ }
18
+
19
+ // src/utils/select-state.ts
20
+ function selectState(state, selector) {
21
+ const initialValue = selector(state.getValue());
22
+ const newState = createState(initialValue);
23
+ state.trackValueSelector(
24
+ selector,
25
+ (selectedState) => {
26
+ newState.setValue(selectedState);
27
+ },
28
+ { skipFirstCall: true }
29
+ );
30
+ return newState;
31
+ }
32
+ export {
33
+ combineState as combine,
34
+ combineState,
35
+ selectState as select,
36
+ selectState
37
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veles",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "UI library with main focus on performance",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,6 +19,11 @@
19
19
  "types": "./dist/jsx-runtime.d.ts",
20
20
  "import": "./dist/jsx-runtime.js",
21
21
  "require": "./dist/jsx-runtime.cjs"
22
+ },
23
+ "./utils": {
24
+ "types": "./dist/utils/index.d.ts",
25
+ "import": "./dist/utils/index.js",
26
+ "require": "./dist/utils/index.cjs"
22
27
  }
23
28
  },
24
29
  "scripts": {