ziko 0.51.1 → 0.53.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/dist/ziko.cjs +1638 -1456
- package/dist/ziko.js +853 -810
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +853 -810
- package/package.json +1 -1
- package/src/{__helpers__ → helpers}/register/index.js +1 -1
- package/src/hooks/use-ipc.js +1 -3
- package/src/math/adapted/index.js +7 -0
- package/src/math/complex/index.js +11 -8
- package/src/math/functions/helper.js +68 -17
- package/src/math/functions/index.js +3 -2
- package/src/math/functions/primitives/index.js +355 -0
- package/src/math/mapfun/index.js +19 -0
- package/src/math/utils/index.js +1 -1
- package/src/math/utils/mapfun.js +30 -30
- package/src/ui/constructors/UIElement.js +9 -9
- package/src/ui/constructors/UIElementCore.js +2 -2
- package/types/math/adapted/index.d.ts +4 -0
- package/types/math/complex/index.d.ts +1 -1
- package/types/math/mapfun/index.d.ts +87 -0
- /package/src/{__helpers__ → helpers}/checkers/index.js +0 -0
- /package/src/{__helpers__ → helpers}/index.js +0 -0
- /package/src/{__helpers__ → helpers}/register/register-to-class.js +0 -0
- /package/src/{__helpers__ → helpers}/register/register-to-instance.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {UINode} from "./UINode.js";
|
|
2
|
-
|
|
2
|
+
import {__init__global__} from '../../__ziko__/index.js';
|
|
3
3
|
import { UIStore } from "../../__ziko__/__ui__.js";
|
|
4
|
-
|
|
4
|
+
__init__global__()
|
|
5
5
|
class UIElementCore extends UINode{
|
|
6
6
|
constructor(){
|
|
7
7
|
super()
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Complex } from "../../../src/math/index.js";
|
|
2
|
+
import { Matrix } from "../../../src/math/matrix/index.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Objects that behave like primitives for mapfun,
|
|
6
|
+
* meaning fun(x) is applied directly without recursion.
|
|
7
|
+
*/
|
|
8
|
+
export interface MapfunPrimitiveLike {
|
|
9
|
+
__mapfun__?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type PrimitiveLike =
|
|
13
|
+
| number
|
|
14
|
+
| boolean
|
|
15
|
+
| string
|
|
16
|
+
| bigint
|
|
17
|
+
| undefined
|
|
18
|
+
| null
|
|
19
|
+
| { readonly __mapfun__: boolean };
|
|
20
|
+
|
|
21
|
+
export type Mappable =
|
|
22
|
+
| number
|
|
23
|
+
| string
|
|
24
|
+
| boolean
|
|
25
|
+
| bigint
|
|
26
|
+
| undefined
|
|
27
|
+
| null
|
|
28
|
+
| Matrix
|
|
29
|
+
| MapfunPrimitiveLike
|
|
30
|
+
| any[]
|
|
31
|
+
| Set<any>
|
|
32
|
+
| Map<any, any>
|
|
33
|
+
| object;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* mapfun transform rules
|
|
37
|
+
*/
|
|
38
|
+
export type MapfunResult<F extends (x: any) => any, T> =
|
|
39
|
+
// Objects with __mapfun__ → treat as primitive (call fun(x))
|
|
40
|
+
// T extends MapfunPrimitiveLike
|
|
41
|
+
// ? ReturnType<F> :
|
|
42
|
+
|
|
43
|
+
// Matrix → always return Matrix (your JS logic rebuilds a new Matrix)
|
|
44
|
+
|
|
45
|
+
T extends PrimitiveLike
|
|
46
|
+
? ReturnType<F> :
|
|
47
|
+
// T extends Complex
|
|
48
|
+
// ? T :
|
|
49
|
+
T extends Matrix
|
|
50
|
+
? T :
|
|
51
|
+
|
|
52
|
+
// Array → deep-map
|
|
53
|
+
T extends Array<infer U>
|
|
54
|
+
? Array<MapfunResult<F, U>> :
|
|
55
|
+
|
|
56
|
+
// Set → deep-map
|
|
57
|
+
T extends Set<infer U>
|
|
58
|
+
? Set<MapfunResult<F, U>> :
|
|
59
|
+
|
|
60
|
+
// Map → deep-map values
|
|
61
|
+
T extends Map<infer K, infer V>
|
|
62
|
+
? Map<K, MapfunResult<F, V>> :
|
|
63
|
+
|
|
64
|
+
// Other objects → recursively map fields
|
|
65
|
+
T extends object
|
|
66
|
+
? { [K in keyof T]: MapfunResult<F, T[K]> } :
|
|
67
|
+
|
|
68
|
+
// Primitive
|
|
69
|
+
ReturnType<F>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* If only one argument → return mapped value
|
|
73
|
+
* If multiple → return tuple of mapped values
|
|
74
|
+
*/
|
|
75
|
+
type UnwrapSingle<T extends unknown[]> =
|
|
76
|
+
T extends [infer U] ? U : { [K in keyof T]: T[K] };
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* mapfun main declaration
|
|
80
|
+
*/
|
|
81
|
+
export declare function mapfun<
|
|
82
|
+
F extends (x: any) => any,
|
|
83
|
+
A extends Mappable[]
|
|
84
|
+
>(
|
|
85
|
+
fun: F,
|
|
86
|
+
...values: A
|
|
87
|
+
): UnwrapSingle<{ [K in keyof A]: MapfunResult<F, A[K]> }>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|