ziko 0.63.2 → 0.64.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/package.json +1 -5
- package/{types → src}/router/file-based-router/index.d.ts +1 -1
- package/src/router/file-based-router/index.js +6 -30
- package/src/router/utils/index.js +2 -1
- package/src/router/utils/renderer.js +8 -0
- package/types/data/api/index.d.ts +0 -15
- package/types/data/index.d.ts +0 -1
- package/types/data/string/checkers.d.ts +0 -51
- package/types/data/string/converters.d.ts +0 -101
- package/types/data/string/index.d.ts +0 -2
- package/types/global.d.ts +0 -10
- package/types/hooks/index.d.ts +0 -11
- package/types/hooks/use-Thread.d.ts +0 -33
- package/types/hooks/use-derived.d.ts +0 -14
- package/types/hooks/use-event-emitter.d.ts +0 -46
- package/types/hooks/use-favicon.d.ts +0 -41
- package/types/hooks/use-ipc.d.ts +0 -12
- package/types/hooks/use-media-query.d.ts +0 -24
- package/types/hooks/use-reactive.d.ts +0 -14
- package/types/hooks/use-root.d.ts +0 -15
- package/types/hooks/use-state.d.ts +0 -25
- package/types/hooks/use-storage.d.ts +0 -47
- package/types/hooks/use-title.d.ts +0 -37
- package/types/index.d.ts +0 -5
- package/types/math/complex/index.d.ts +0 -54
- package/types/math/functions/index.d.ts +0 -140
- package/types/math/functions/logic/index.d.ts +0 -11
- package/types/math/index.d.ts +0 -3
- package/types/math/mapfun/index.d.ts +0 -87
- package/types/math/utils/index.d.ts +0 -1
- package/types/math/utils/mapfun.d.ts +0 -43
- package/types/time/clocks/clock.d.ts +0 -28
- package/types/time/clocks/index.d.ts +0 -3
- package/types/time/clocks/scheduler.d.ts +0 -42
- package/types/time/clocks/tick.d.ts +0 -26
- package/types/time/decorators/index.d.ts +0 -9
- package/types/time/delay/index.d.ts +0 -12
- package/types/time/ease/index.d.ts +0 -103
- package/types/time/index.d.ts +0 -4
- package/types/time/loop/index.d.ts +0 -50
- /package/{types → src}/router/index.d.ts +0 -0
- /package/{types → src}/router/utils/dynamic-routes-parser.d.ts +0 -0
- /package/{types → src}/router/utils/get-root.d.ts +0 -0
- /package/{types → src}/router/utils/index.d.ts +0 -0
- /package/{types → src}/router/utils/normalize-path.d.ts +0 -0
- /package/{types → src}/router/utils/routes-grouper.d.ts +0 -0
- /package/{types → src}/router/utils/routes-matcher.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ziko",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.64.0",
|
|
4
4
|
"description": "A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"front-end",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"files": [
|
|
22
22
|
"src",
|
|
23
23
|
"dist",
|
|
24
|
-
"types",
|
|
25
24
|
"LICENCE"
|
|
26
25
|
],
|
|
27
26
|
"exports": {
|
|
@@ -29,11 +28,9 @@
|
|
|
29
28
|
"import": "./src/*"
|
|
30
29
|
},
|
|
31
30
|
"./*": {
|
|
32
|
-
"types": "./types/*/index.d.ts",
|
|
33
31
|
"import": "./src/*/index.js"
|
|
34
32
|
},
|
|
35
33
|
".": {
|
|
36
|
-
"types": "./types/index.d.ts",
|
|
37
34
|
"import": "./dist/ziko.mjs",
|
|
38
35
|
"require": "./dist/ziko.cjs"
|
|
39
36
|
},
|
|
@@ -50,7 +47,6 @@
|
|
|
50
47
|
"import": "./src/use/index.js"
|
|
51
48
|
},
|
|
52
49
|
"./hooks": {
|
|
53
|
-
"types": "./types/hooks/index.d.ts",
|
|
54
50
|
"import": "./src/hooks/index.js"
|
|
55
51
|
},
|
|
56
52
|
"./ui": {
|
|
@@ -3,14 +3,15 @@ import {
|
|
|
3
3
|
normalize_path,
|
|
4
4
|
routes_matcher,
|
|
5
5
|
is_dynamic,
|
|
6
|
-
dynamic_routes_parser
|
|
6
|
+
dynamic_routes_parser,
|
|
7
|
+
renderer as ziko_renderer
|
|
7
8
|
} from "../utils/index.js"
|
|
8
9
|
export async function createSPAFileBasedRouter({
|
|
9
10
|
pages = {},
|
|
10
11
|
target = globalThis?.document?.body,
|
|
11
12
|
extensions = ['js', 'ts'],
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
renderer = ziko_renderer,
|
|
14
|
+
wrapper,
|
|
14
15
|
} = {}) {
|
|
15
16
|
if(!(target instanceof HTMLElement) && target?.element instanceof HTMLElement) target = target?.element;
|
|
16
17
|
if (!(target instanceof HTMLElement)) {
|
|
@@ -39,31 +40,6 @@ export async function createSPAFileBasedRouter({
|
|
|
39
40
|
}
|
|
40
41
|
if (mask === null) return; // no route matched
|
|
41
42
|
const params = is_dynamic(mask) ? dynamic_routes_parser(mask, path) : undefined;
|
|
42
|
-
|
|
43
|
-
renderer(target, component, params)
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
let mounted = domifier
|
|
49
|
-
? await domifier(component, params)
|
|
50
|
-
: await component(params)
|
|
51
|
-
// // let mounted
|
|
52
|
-
// if(domifier) {
|
|
53
|
-
// mounted = await domifier(component, params);
|
|
54
|
-
// target.append(mounted)
|
|
55
|
-
// }
|
|
56
|
-
// console.log({component})
|
|
57
|
-
|
|
58
|
-
// return;
|
|
59
|
-
// const mounted = params ? await component(params) : await component();
|
|
60
|
-
|
|
61
|
-
if(mounted instanceof HTMLElement)
|
|
62
|
-
mounted instanceof Array
|
|
63
|
-
? target.append(...mounted)
|
|
64
|
-
: target.append(mounted);
|
|
65
|
-
else mounted instanceof Array
|
|
66
|
-
? mounted.forEach(el => el.mount(target))
|
|
67
|
-
: mounted.mount(target);
|
|
68
|
-
|
|
43
|
+
renderer(target, component, params, wrapper)
|
|
69
44
|
}
|
|
45
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const renderer = async (target, component, props, wrapper) =>{
|
|
2
|
+
if(!component) return;
|
|
3
|
+
let mounted = await component(props);
|
|
4
|
+
if(wrapper) mounted = wrapper(mounted);
|
|
5
|
+
mounted instanceof Array
|
|
6
|
+
? mounted.forEach(el => el.mount(target))
|
|
7
|
+
: mounted.mount(target);
|
|
8
|
+
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// fetchdom.d.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Fetches a URL and parses it into a DOM Document asynchronously.
|
|
5
|
-
* @param url The URL to fetch. Defaults to 'https://github.com/zakarialaoui10'.
|
|
6
|
-
* @returns A Promise resolving to the root element of the parsed DOM.
|
|
7
|
-
*/
|
|
8
|
-
export function fetchdom(url?: string): Promise<Element>;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Fetches a URL synchronously (using `preload`) and parses it into a DOM Document.
|
|
12
|
-
* @param url The URL to fetch. Defaults to 'https://github.com/zakarialaoui10'.
|
|
13
|
-
* @returns The root element of the parsed DOM.
|
|
14
|
-
*/
|
|
15
|
-
export function fetchdomSync(url?: string): Element;
|
package/types/data/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type * from './api/index.d.ts'
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// stringUtils.d.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Checks if a string is in camelCase.
|
|
5
|
-
* @param text The string to check. Defaults to empty string.
|
|
6
|
-
* @returns True if the string is camelCase, false otherwise.
|
|
7
|
-
*/
|
|
8
|
-
export function is_camelcase(text?: string): boolean;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Checks if a string contains hyphens (hyphen-case).
|
|
12
|
-
* @param text The string to check. Defaults to empty string.
|
|
13
|
-
* @returns True if the string contains hyphens, false otherwise.
|
|
14
|
-
*/
|
|
15
|
-
export function is_hyphencase(text?: string): boolean;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Checks if a string contains underscores (snake_case).
|
|
19
|
-
* @param text The string to check. Defaults to empty string.
|
|
20
|
-
* @returns True if the string contains underscores, false otherwise.
|
|
21
|
-
*/
|
|
22
|
-
export function is_snakeCase(text?: string): boolean;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Checks if a string is in PascalCase.
|
|
26
|
-
* @param text The string to check. Defaults to empty string.
|
|
27
|
-
* @returns True if the string is PascalCase, false otherwise.
|
|
28
|
-
*/
|
|
29
|
-
export function is_pascalcalse(text?: string): boolean;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Checks if a string is a palindrome (case-insensitive).
|
|
33
|
-
* @param text The string to check.
|
|
34
|
-
* @returns True if the string is a palindrome, false otherwise.
|
|
35
|
-
*/
|
|
36
|
-
export function is_palindrome(text: string): boolean;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Checks if two words are anagrams of each other.
|
|
40
|
-
* @param word The first word.
|
|
41
|
-
* @param words The second word.
|
|
42
|
-
* @returns True if the words are anagrams, false otherwise.
|
|
43
|
-
*/
|
|
44
|
-
export function is_anagram(word: string, words: string): boolean;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Checks if a string is an isogram (no repeating letters, case-insensitive).
|
|
48
|
-
* @param text The string to check. Defaults to empty string.
|
|
49
|
-
* @returns True if the string is an isogram, false otherwise.
|
|
50
|
-
*/
|
|
51
|
-
export function is_isogram(text?: string): boolean;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts camelCase to hyphen-case.
|
|
3
|
-
* @param text The camelCase string. Defaults to ''.
|
|
4
|
-
* @returns The converted hyphen-case string.
|
|
5
|
-
*/
|
|
6
|
-
export function camel2hyphencase(text?: string): string;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Converts camelCase to snake_case.
|
|
10
|
-
*/
|
|
11
|
-
export function camel2snakecase(text?: string): string;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Converts camelCase to PascalCase.
|
|
15
|
-
*/
|
|
16
|
-
export function camel2pascalcase(text?: string): string;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Converts camelCase to CONSTANT_CASE.
|
|
20
|
-
*/
|
|
21
|
-
export function camel2constantcase(text?: string): string;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Converts PascalCase to snake_case.
|
|
25
|
-
*/
|
|
26
|
-
export function pascal2snakecase(text?: string): string;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Converts PascalCase to hyphen-case.
|
|
30
|
-
*/
|
|
31
|
-
export function pascal2hyphencase(text?: string): string;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Converts PascalCase to camelCase.
|
|
35
|
-
*/
|
|
36
|
-
export function pascal2camelcase(text?: string): string;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Converts PascalCase to CONSTANT_CASE.
|
|
40
|
-
*/
|
|
41
|
-
export function pascal2constantcase(text?: string): string;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Converts snake_case to camelCase.
|
|
45
|
-
*/
|
|
46
|
-
export function snake2camelcase(text?: string): string;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Converts snake_case to hyphen-case.
|
|
50
|
-
*/
|
|
51
|
-
export function snake2hyphencase(text?: string): string;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Converts snake_case to PascalCase.
|
|
55
|
-
*/
|
|
56
|
-
export function snake2pascalcase(text?: string): string;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Converts snake_case to CONSTANT_CASE.
|
|
60
|
-
*/
|
|
61
|
-
export function snake2constantcase(text?: string): string;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Converts hyphen-case to camelCase.
|
|
65
|
-
*/
|
|
66
|
-
export function hyphen2camelcase(text?: string): string;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Converts hyphen-case to snake_case.
|
|
70
|
-
*/
|
|
71
|
-
export function hyphen2snakecase(text?: string): string;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Converts hyphen-case to PascalCase.
|
|
75
|
-
*/
|
|
76
|
-
export function hyphen2pascalcase(text?: string): string;
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Converts hyphen-case to CONSTANT_CASE.
|
|
80
|
-
*/
|
|
81
|
-
export function hyphen2constantcase(text?: string): string;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Converts CONSTANT_CASE to camelCase.
|
|
85
|
-
*/
|
|
86
|
-
export function constant2camelcase(text?: string): string;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Converts CONSTANT_CASE to snake_case.
|
|
90
|
-
*/
|
|
91
|
-
export function constant2snakecase(text?: string): string;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Converts CONSTANT_CASE to PascalCase.
|
|
95
|
-
*/
|
|
96
|
-
export function constant2pascalcase(text?: string): string;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Converts CONSTANT_CASE to hyphen-case.
|
|
100
|
-
*/
|
|
101
|
-
export function constant2hyphencase(text?: string): string;
|
package/types/global.d.ts
DELETED
package/types/hooks/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export type * from './use-ipc'
|
|
2
|
-
export type * from './use-storage.d.ts'
|
|
3
|
-
export type * from './use-state.d.ts'
|
|
4
|
-
export type * from './use-derived.d.ts'
|
|
5
|
-
export type * from './use-reactive.d.ts'
|
|
6
|
-
export type * from './use-Thread.d.ts'
|
|
7
|
-
export type * from './use-event-emitter.d.ts'
|
|
8
|
-
export type * from './use-media-query.d.ts'
|
|
9
|
-
export type * from './use-title.d.ts'
|
|
10
|
-
export type * from './use-favicon.d.ts'
|
|
11
|
-
export type * from './use-root.d.ts'
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// use-thread.d.ts
|
|
2
|
-
|
|
3
|
-
export declare class UseThread {
|
|
4
|
-
constructor();
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Call a function inside the worker.
|
|
8
|
-
* @param func - Function to execute (cannot capture outer scope)
|
|
9
|
-
* @param callback - Callback receiving (result, error)
|
|
10
|
-
* @param args - Optional arguments array to pass to the function
|
|
11
|
-
* @param close - Automatically close the worker after execution (default true)
|
|
12
|
-
*/
|
|
13
|
-
call<T = any>(
|
|
14
|
-
func: (...args: any[]) => T,
|
|
15
|
-
callback: (result: T | null, error: string | null) => void,
|
|
16
|
-
args?: any[],
|
|
17
|
-
close?: boolean
|
|
18
|
-
): this;
|
|
19
|
-
|
|
20
|
-
/** Terminate the worker manually */
|
|
21
|
-
terminate(): void;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Helper function for single-use worker threads.
|
|
26
|
-
* Immediately executes the function and returns the UseThread instance.
|
|
27
|
-
*/
|
|
28
|
-
export declare const useThread: <T = any>(
|
|
29
|
-
func: (...args: any[]) => T,
|
|
30
|
-
callback: (result: T | null, error: string | null) => void,
|
|
31
|
-
args?: any[],
|
|
32
|
-
close?: boolean
|
|
33
|
-
) => UseThread;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export function useDerived<T>(
|
|
2
|
-
deriveFn: (...values: any[]) => T,
|
|
3
|
-
sources: Array<
|
|
4
|
-
() => {
|
|
5
|
-
value: any;
|
|
6
|
-
isStateGetter: () => true;
|
|
7
|
-
_subscribe: (fn: (value: any) => void) => void;
|
|
8
|
-
}
|
|
9
|
-
>
|
|
10
|
-
): () => {
|
|
11
|
-
value: T;
|
|
12
|
-
isStateGetter: () => true;
|
|
13
|
-
_subscribe: (fn: (value: T) => void) => void;
|
|
14
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
declare class UseEventEmitter {
|
|
2
|
-
constructor(maxListeners?: number);
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Register and listen for an event.
|
|
6
|
-
* The listener will be called every time the event is emitted.
|
|
7
|
-
*/
|
|
8
|
-
on(event: string, listener: (...args: any[]) => void): this;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Register and listen for an event ONCE.
|
|
12
|
-
* After the first call, the listener is automatically removed.
|
|
13
|
-
*/
|
|
14
|
-
once(event: string, listener: (...args: any[]) => void): this;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Remove a specific listener.
|
|
18
|
-
*/
|
|
19
|
-
off(event: string, listener: (...args: any[]) => void): this;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Emit an event and call all listeners associated with it.
|
|
23
|
-
* Returns true if the event had listeners; otherwise false.
|
|
24
|
-
*/
|
|
25
|
-
emit(event: string, data?: any): boolean;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Remove all listeners for a specific event.
|
|
29
|
-
*/
|
|
30
|
-
remove(event: string): this;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Clear all events and their listeners.
|
|
34
|
-
*/
|
|
35
|
-
clear(): this;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Set the maximum number of listeners allowed per event.
|
|
39
|
-
*/
|
|
40
|
-
setMaxListeners(max: number): this;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** Create a new event emitter instance */
|
|
44
|
-
declare const useEventEmitter: (maxListeners?: number) => UseEventEmitter;
|
|
45
|
-
|
|
46
|
-
export { UseEventEmitter, useEventEmitter };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export declare class UseFavIcon {
|
|
2
|
-
/**
|
|
3
|
-
* Create a favicon manager.
|
|
4
|
-
* @param FavIcon Initial favicon URL.
|
|
5
|
-
* @param withEmitter Whether to enable an internal event emitter (default: true).
|
|
6
|
-
*/
|
|
7
|
-
constructor(FavIcon?: string, withEmitter?: boolean);
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Sets the favicon URL.
|
|
11
|
-
* Emits "ziko:favicon-changed" if emitter is enabled.
|
|
12
|
-
*/
|
|
13
|
-
setFavicon(href: string): this;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Returns the current favicon URL.
|
|
17
|
-
*/
|
|
18
|
-
readonly current: string;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Listen for favicon changes.
|
|
22
|
-
* Callback receives the new href as a string.
|
|
23
|
-
*/
|
|
24
|
-
onChange(callback: (href: string) => void): this;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* To Do
|
|
28
|
-
* Disable or remove the internal event emitter entirely.
|
|
29
|
-
*/
|
|
30
|
-
removeEventEmitter(): this;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Enable the internal event emitter manually.
|
|
34
|
-
*/
|
|
35
|
-
useEventEmitter(): this;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Factory function to create a `UseFavIcon` instance.
|
|
40
|
-
*/
|
|
41
|
-
export declare const useFavIcon: (FavIcon?: string, withEmitter?: boolean) => UseFavIcon;
|
package/types/hooks/use-ipc.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare class UseIPC {
|
|
2
|
-
emit(event: string, data: any, rooms?: string[]): this;
|
|
3
|
-
on(event: string, handler: (data: any) => void, rooms?: string | string[]): this;
|
|
4
|
-
off(event: string, handler: (data: any) => void): this;
|
|
5
|
-
once(event: string, handler: (data: any) => void, rooms?: string | string[]): this;
|
|
6
|
-
join(...rooms: string[]): this;
|
|
7
|
-
leave(...rooms: string[]): this;
|
|
8
|
-
close(): this;
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export declare const useIPC: (name?: string) => UseIPC;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export interface MediaQueryRule {
|
|
2
|
-
query: string;
|
|
3
|
-
callback: () => void;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export class UseMediaQuery {
|
|
7
|
-
// Private fields (only for type awareness; not accessible)
|
|
8
|
-
private readonly #mediaQueryRules: MediaQueryRule[];
|
|
9
|
-
private readonly #fallback: () => void;
|
|
10
|
-
private #lastCalledCallback: (() => void) | null;
|
|
11
|
-
|
|
12
|
-
constructor(
|
|
13
|
-
mediaQueryRules?: MediaQueryRule[],
|
|
14
|
-
fallback?: () => void
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Helper function to create a UseMediaQuery instance.
|
|
20
|
-
*/
|
|
21
|
-
export function useMediaQuery(
|
|
22
|
-
mediaQueryRules?: MediaQueryRule[],
|
|
23
|
-
fallback?: () => void
|
|
24
|
-
): UseMediaQuery;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { mapfun, MapfunResult } from "../math/utils/mapfun.d.ts";
|
|
2
|
-
import { useState } from "./use-state.d.ts";
|
|
3
|
-
|
|
4
|
-
export function useReactive<
|
|
5
|
-
T
|
|
6
|
-
>(
|
|
7
|
-
nested_value: T
|
|
8
|
-
): MapfunResult<
|
|
9
|
-
(n: any) => {
|
|
10
|
-
get: ReturnType<typeof useState<any>>[0];
|
|
11
|
-
set: ReturnType<typeof useState<any>>[1];
|
|
12
|
-
},
|
|
13
|
-
T
|
|
14
|
-
>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare class UseRoot<PropMap extends Record<string, string>> {
|
|
2
|
-
constructor(PropsMap: PropMap, options?: UseRootOptions);
|
|
3
|
-
|
|
4
|
-
currentPropsMap: PropMap;
|
|
5
|
-
namespace: string;
|
|
6
|
-
ValidateCssProps: boolean;
|
|
7
|
-
|
|
8
|
-
/** Dynamically created CSS variable references */
|
|
9
|
-
[K in keyof PropMap]: string;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Apply a new set of properties
|
|
13
|
-
*/
|
|
14
|
-
use(PropsMap: PropMap): this;
|
|
15
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export function useState<T>(
|
|
2
|
-
initialValue: T
|
|
3
|
-
): [
|
|
4
|
-
/** getter function */
|
|
5
|
-
() => {
|
|
6
|
-
value: T;
|
|
7
|
-
isStateGetter: () => true;
|
|
8
|
-
_subscribe: (fn: (value: T) => void) => void;
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
/** setter function */
|
|
12
|
-
(newValue: T | ((prev: T) => T)) => void,
|
|
13
|
-
|
|
14
|
-
/** controller */
|
|
15
|
-
{
|
|
16
|
-
pause: () => void;
|
|
17
|
-
resume: () => void;
|
|
18
|
-
clear: () => void;
|
|
19
|
-
force: (newValue: T | ((prev: T) => T)) => void;
|
|
20
|
-
getSubscribers: () => Set<(value: T) => void>;
|
|
21
|
-
}
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
/** check if argument is a state getter */
|
|
25
|
-
export function isStateGetter(arg: any): boolean;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// use-storage.d.ts
|
|
2
|
-
|
|
3
|
-
export declare class UseStorage {
|
|
4
|
-
constructor(
|
|
5
|
-
storage: Storage,
|
|
6
|
-
globalKey: string,
|
|
7
|
-
initialValue?: Record<string, any>,
|
|
8
|
-
use_channel?: boolean
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
/** Current stored items */
|
|
12
|
-
readonly items: Record<string, any>;
|
|
13
|
-
|
|
14
|
-
/** Set entire storage */
|
|
15
|
-
set(data: Record<string, any>): this;
|
|
16
|
-
|
|
17
|
-
/** Merge new data into existing storage */
|
|
18
|
-
add(data: Record<string, any>): this;
|
|
19
|
-
|
|
20
|
-
/** Remove keys from storage */
|
|
21
|
-
remove(...keys: string[]): this;
|
|
22
|
-
|
|
23
|
-
/** Get a single key */
|
|
24
|
-
get(key: string): any;
|
|
25
|
-
|
|
26
|
-
/** Clear storage completely */
|
|
27
|
-
clear(): this;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Listen for any storage updates.
|
|
31
|
-
* Callback receives the data passed to the last .set() / .add() / .remove()
|
|
32
|
-
*/
|
|
33
|
-
onStorageUpdated(callback: (data: Record<string, any>) => void): this;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** Factory functions */
|
|
37
|
-
export declare const useLocaleStorage: (
|
|
38
|
-
key: string,
|
|
39
|
-
initialValue?: Record<string, any>,
|
|
40
|
-
use_channel?: boolean
|
|
41
|
-
) => UseStorage;
|
|
42
|
-
|
|
43
|
-
export declare const useSessionStorage: (
|
|
44
|
-
key: string,
|
|
45
|
-
initialValue?: Record<string, any>,
|
|
46
|
-
use_channel?: boolean
|
|
47
|
-
) => UseStorage;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export declare class UseTitle {
|
|
2
|
-
/**
|
|
3
|
-
* Create a reactive title manager.
|
|
4
|
-
* @param title Initial title. Defaults to `document.title`.
|
|
5
|
-
* @param withEmitter Whether to create an internal event emitter. Default: true.
|
|
6
|
-
*/
|
|
7
|
-
constructor(title?: string, withEmitter?: boolean);
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Enables the internal event emitter.
|
|
11
|
-
*/
|
|
12
|
-
useEventEmitter(): this;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Sets the document title.
|
|
16
|
-
* Emits "ziko:title-changed" if emitter is enabled.
|
|
17
|
-
*/
|
|
18
|
-
setTitle(title: string): this;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Returns the current document title.
|
|
22
|
-
*/
|
|
23
|
-
readonly current: string;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Listen for title changes.
|
|
27
|
-
*/
|
|
28
|
-
onChange(callback: (title: string) => void): this;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* To Do
|
|
32
|
-
* Disable or remove the internal event emitter entirely.
|
|
33
|
-
*/
|
|
34
|
-
removeEventEmitter(): this;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export declare const useTitle: (title?: string, withEmitter?: boolean) => UseTitle;
|
package/types/index.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export declare class Complex {
|
|
2
|
-
a: number;
|
|
3
|
-
b: number;
|
|
4
|
-
|
|
5
|
-
constructor(a?: number, b?: number);
|
|
6
|
-
constructor(c: Complex);
|
|
7
|
-
constructor(a:
|
|
8
|
-
{ a: number; b: number } |
|
|
9
|
-
{ a: number; z: number } |
|
|
10
|
-
{ a: number; phi: number } |
|
|
11
|
-
{ b: number; z: number } |
|
|
12
|
-
{ b: number; phi: number } |
|
|
13
|
-
{ z: number; phi: number }
|
|
14
|
-
);
|
|
15
|
-
constructor();
|
|
16
|
-
|
|
17
|
-
isComplex(): true;
|
|
18
|
-
toString(): string;
|
|
19
|
-
readonly __mapfun__ : boolean
|
|
20
|
-
readonly clone: Complex;
|
|
21
|
-
readonly z: number;
|
|
22
|
-
readonly phi: number;
|
|
23
|
-
readonly conj: Complex;
|
|
24
|
-
readonly inv: Complex;
|
|
25
|
-
readonly sqrt: Complex;
|
|
26
|
-
readonly cbrt: Complex;
|
|
27
|
-
readonly log: Complex;
|
|
28
|
-
readonly cos: Complex;
|
|
29
|
-
readonly sin: Complex;
|
|
30
|
-
readonly tan: Complex;
|
|
31
|
-
expo: [number, number];
|
|
32
|
-
|
|
33
|
-
add(...z: (number | Complex)[]): this;
|
|
34
|
-
sub(...z: (number | Complex)[]): this;
|
|
35
|
-
mul(...z: (number | Complex)[]): this;
|
|
36
|
-
div(...z: (number | Complex)[]): this;
|
|
37
|
-
pow(n: number): this;
|
|
38
|
-
nthr(n?: number): Complex;
|
|
39
|
-
|
|
40
|
-
static zero(): Complex;
|
|
41
|
-
static twiddle(K : number, N : number): Complex;
|
|
42
|
-
static fromPolar(z: number, phi: number): Complex;
|
|
43
|
-
|
|
44
|
-
static add(c: Complex, ...z: (number | Complex)[]): Complex;
|
|
45
|
-
static sub(c: Complex, ...z: (number | Complex)[]): Complex;
|
|
46
|
-
static mul(c: Complex, ...z: (number | Complex)[]): Complex;
|
|
47
|
-
static div(c: Complex, ...z: (number | Complex)[]): Complex;
|
|
48
|
-
static pow(c: Complex, n: number): Complex;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export declare function complex(a: number, b?: number): Complex;
|
|
52
|
-
export declare function complex(a: Complex): Complex;
|
|
53
|
-
export declare function complex(a: object): Complex;
|
|
54
|
-
export declare function complex(): Complex;
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import type { Complex } from "../complex/index.js";
|
|
2
|
-
import type { MapfunResult, Mappable } from "../utils/mapfun.js";
|
|
3
|
-
|
|
4
|
-
/* -------------------- MapfunWrap -------------------- */
|
|
5
|
-
|
|
6
|
-
type MapfunWrap<F extends (x: any) => any, A extends Mappable[]> =
|
|
7
|
-
A["length"] extends 1
|
|
8
|
-
? MapfunResult<F, A[0]>
|
|
9
|
-
: { [K in keyof A]: MapfunResult<F, A[K]> };
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/* -------------------- mapfun-based simple operators -------------------- */
|
|
13
|
-
|
|
14
|
-
export declare function abs<A extends Mappable[]>(...x: A):
|
|
15
|
-
MapfunWrap<typeof Math.abs, A>;
|
|
16
|
-
|
|
17
|
-
export declare function sqrt<A extends Mappable[]>(...x: A):
|
|
18
|
-
MapfunWrap<typeof Math.sqrt, A>;
|
|
19
|
-
|
|
20
|
-
export declare function e<A extends Mappable[]>(...x: A):
|
|
21
|
-
MapfunWrap<typeof Math.exp, A>;
|
|
22
|
-
|
|
23
|
-
export declare function ln<A extends Mappable[]>(...x: A):
|
|
24
|
-
MapfunWrap<typeof Math.log, A>;
|
|
25
|
-
|
|
26
|
-
/* ---- Fixed-based operators ---- */
|
|
27
|
-
|
|
28
|
-
export declare function cos<A extends Mappable[]>(...x: A):
|
|
29
|
-
MapfunWrap<typeof Math.cos, A>;
|
|
30
|
-
|
|
31
|
-
export declare function sin<A extends Mappable[]>(...x: A):
|
|
32
|
-
MapfunWrap<Math.sin, A>;
|
|
33
|
-
|
|
34
|
-
export declare function tan<A extends Mappable[]>(...x: A):
|
|
35
|
-
MapfunWrap<Math.tan, A>;
|
|
36
|
-
|
|
37
|
-
export declare function sec<A extends Mappable[]>(...x: A):
|
|
38
|
-
MapfunWrap<Math.sec, A>;
|
|
39
|
-
|
|
40
|
-
export declare function sinc<A extends Mappable[]>(...x: A):
|
|
41
|
-
MapfunWrap<Math.sinc, A>;
|
|
42
|
-
|
|
43
|
-
export declare function csc<A extends Mappable[]>(...x: A):
|
|
44
|
-
MapfunWrap<Math.csc, A>;
|
|
45
|
-
|
|
46
|
-
export declare function cot<A extends Mappable[]>(...x: A):
|
|
47
|
-
MapfunWrap<Math.cot, A>;
|
|
48
|
-
|
|
49
|
-
export declare function acos<A extends Mappable[]>(...x: A):
|
|
50
|
-
MapfunWrap<Math.acos, A>;
|
|
51
|
-
|
|
52
|
-
export declare function asin<A extends Mappable[]>(...x: A):
|
|
53
|
-
MapfunWrap<Math.asin, A>;
|
|
54
|
-
|
|
55
|
-
export declare function atan<A extends Mappable[]>(...x: A):
|
|
56
|
-
MapfunWrap<Math.atan, A>;
|
|
57
|
-
|
|
58
|
-
export declare function acot<A extends Mappable[]>(...x: A):
|
|
59
|
-
MapfunWrap<Math.acot, A>;
|
|
60
|
-
|
|
61
|
-
export declare function cosh<A extends Mappable[]>(...x: A):
|
|
62
|
-
MapfunWrap<Math.cosh, A>;
|
|
63
|
-
|
|
64
|
-
export declare function sinh<A extends Mappable[]>(...x: A):
|
|
65
|
-
MapfunWrap<Math.sinh, A>;
|
|
66
|
-
|
|
67
|
-
export declare function tanh<A extends Mappable[]>(...x: A):
|
|
68
|
-
MapfunWrap<Math.tanh, A>;
|
|
69
|
-
|
|
70
|
-
export declare function coth<A extends Mappable[]>(...x: A):
|
|
71
|
-
MapfunWrap<Math.coth, A>;
|
|
72
|
-
|
|
73
|
-
export declare function acosh<A extends Mappable[]>(...x: A):
|
|
74
|
-
MapfunWrap<Math.acosh, A>;
|
|
75
|
-
|
|
76
|
-
export declare function asinh<A extends Mappable[]>(...x: A):
|
|
77
|
-
MapfunWrap<Math.asinh, A>;
|
|
78
|
-
|
|
79
|
-
export declare function atanh<A extends Mappable[]>(...x: A):
|
|
80
|
-
MapfunWrap<Math.atanh, A>;
|
|
81
|
-
|
|
82
|
-
/* ---- Math wrappers ---- */
|
|
83
|
-
|
|
84
|
-
export declare function ceil<A extends Mappable[]>(...x: A):
|
|
85
|
-
MapfunWrap<typeof Math.ceil, A>;
|
|
86
|
-
|
|
87
|
-
export declare function floor<A extends Mappable[]>(...x: A):
|
|
88
|
-
MapfunWrap<typeof Math.floor, A>;
|
|
89
|
-
|
|
90
|
-
export declare function round<A extends Mappable[]>(...x: A):
|
|
91
|
-
MapfunWrap<typeof Math.round, A>;
|
|
92
|
-
|
|
93
|
-
export declare function sign<A extends Mappable[]>(...x: A):
|
|
94
|
-
MapfunWrap<typeof Math.sign, A>;
|
|
95
|
-
|
|
96
|
-
export declare function sig<A extends Mappable[]>(...x: A):
|
|
97
|
-
MapfunWrap<(n: number) => number, A>;
|
|
98
|
-
|
|
99
|
-
export declare function fact<A extends Mappable[]>(...x: A):
|
|
100
|
-
MapfunWrap<(n: number) => number, A>;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
/* -------------------- pow -------------------- */
|
|
104
|
-
|
|
105
|
-
export declare function pow(x: number, n: number): number;
|
|
106
|
-
export declare function pow(x: number, n: Complex): Complex;
|
|
107
|
-
export declare function pow(x: number, n: Mappable): any;
|
|
108
|
-
|
|
109
|
-
export declare function pow(x: Complex, n: number): Complex;
|
|
110
|
-
export declare function pow(x: Complex, n: Complex): Complex;
|
|
111
|
-
export declare function pow(x: Complex, n: Mappable): any;
|
|
112
|
-
|
|
113
|
-
export declare function pow(x: Mappable[], n: number): any[];
|
|
114
|
-
export declare function pow(x: Mappable[], n: Mappable[]): any[];
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
/* -------------------- sqrtn -------------------- */
|
|
118
|
-
|
|
119
|
-
export declare function sqrtn(x: number, n: number): number;
|
|
120
|
-
export declare function sqrtn(x: number, n: Mappable): any;
|
|
121
|
-
|
|
122
|
-
export declare function sqrtn(x: Complex, n: number): Complex;
|
|
123
|
-
export declare function sqrtn(x: Complex, n: Mappable): any;
|
|
124
|
-
|
|
125
|
-
export declare function sqrtn(x: Mappable[], n: number): any[];
|
|
126
|
-
export declare function sqrtn(x: Mappable[], n: Mappable[]): any[];
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
/* -------------------- atan2 -------------------- */
|
|
130
|
-
|
|
131
|
-
export declare function atan2(x: number, y: number, rad?: boolean): number;
|
|
132
|
-
export declare function atan2(x: number, y: Mappable, rad?: boolean): any;
|
|
133
|
-
export declare function atan2(x: Mappable, y: number, rad?: boolean): any;
|
|
134
|
-
export declare function atan2(x: Mappable[], y: Mappable[], rad?: boolean): any[];
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
/* -------------------- hypot -------------------- */
|
|
138
|
-
|
|
139
|
-
export declare function hypot(...x: number[]): number;
|
|
140
|
-
export declare function hypot(...x: Mappable[]): any;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Complex } from "../../complex/index.d.ts";
|
|
2
|
-
// import type { Matrix } from "../../matrix/index.d.ts";
|
|
3
|
-
import { Matrix } from '../../../../src/math/matrix/index.js'
|
|
4
|
-
|
|
5
|
-
export declare const not: (x: 0 | 1 | Complex | Matrix) => 0 | 1 | Complex | Matrix;
|
|
6
|
-
export declare const and: (...x: (0 | 1 | Complex | Matrix)[]) => 0 | 1 | Complex | Matrix;
|
|
7
|
-
export declare const or: (...x: (0 | 1 | Complex | Matrix)[]) => 0 | 1 | Complex | Matrix;
|
|
8
|
-
export declare const xor: (...x: (0 | 1 | Complex | Matrix)[]) => 0 | 1 | Complex | Matrix;
|
|
9
|
-
export declare const nand: (...x: (0 | 1 | Complex | Matrix)[]) => 0 | 1 | Complex | Matrix;
|
|
10
|
-
export declare const nor: (...x: (0 | 1 | Complex | Matrix)[]) => 0 | 1 | Complex | Matrix;
|
|
11
|
-
export declare const xnor: (...x: (0 | 1 | Complex | Matrix)[]) => 0 | 1 | Complex | Matrix;
|
package/types/math/index.d.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
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]> }>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type * from './mapfun'
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { Matrix } from "../matrix/index.js";
|
|
2
|
-
import type { Complex } from "../complex/index.js";
|
|
3
|
-
|
|
4
|
-
export type Mappable =
|
|
5
|
-
| number
|
|
6
|
-
| string
|
|
7
|
-
| boolean
|
|
8
|
-
| bigint
|
|
9
|
-
| undefined
|
|
10
|
-
| null
|
|
11
|
-
| Complex
|
|
12
|
-
| Matrix
|
|
13
|
-
| object
|
|
14
|
-
| any[]
|
|
15
|
-
| Set<any>
|
|
16
|
-
| Map<any, any>;
|
|
17
|
-
|
|
18
|
-
export type MapfunResult<F, T> =
|
|
19
|
-
T extends Complex ? ReturnType<F> :
|
|
20
|
-
// T extends Matrix ? Matrix :
|
|
21
|
-
T extends Array<infer U> ? Array<MapfunResult<F, U>> :
|
|
22
|
-
T extends Set<infer U> ? Set<MapfunResult<F, U>> :
|
|
23
|
-
T extends Map<infer K, infer V> ? Map<K, MapfunResult<F, V>> :
|
|
24
|
-
T extends object ? { [K in keyof T]: MapfunResult<F, T[K]> } :
|
|
25
|
-
ReturnType<F>;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Helper to unwrap single-element tuple
|
|
29
|
-
*/
|
|
30
|
-
type UnwrapSingle<T extends unknown[]> = T extends [infer U] ? U : { [K in keyof T]: T[K] };
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* mapfun:
|
|
34
|
-
* - if multiple values → return tuple
|
|
35
|
-
* - if single value → return mapped value directly
|
|
36
|
-
*/
|
|
37
|
-
export declare function mapfun<
|
|
38
|
-
F extends (x: any) => any,
|
|
39
|
-
A extends Mappable[]
|
|
40
|
-
>(
|
|
41
|
-
fun: F,
|
|
42
|
-
...values: A
|
|
43
|
-
): UnwrapSingle<{ [K in keyof A]: MapfunResult<F, A[K]> }>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Tick } from "./tick.js";
|
|
2
|
-
|
|
3
|
-
export interface ClockTickEvent {
|
|
4
|
-
elapsed: number;
|
|
5
|
-
delta: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export declare class Clock extends Tick {
|
|
9
|
-
elapsed: number;
|
|
10
|
-
protected _lastTime: number;
|
|
11
|
-
protected _callbacks: Set<(ev: ClockTickEvent) => void>;
|
|
12
|
-
|
|
13
|
-
constructor(tickMs?: number);
|
|
14
|
-
|
|
15
|
-
protected _tick(): void;
|
|
16
|
-
|
|
17
|
-
onTick(
|
|
18
|
-
cb: (ev: ClockTickEvent) => void
|
|
19
|
-
): () => boolean;
|
|
20
|
-
|
|
21
|
-
reset(): void;
|
|
22
|
-
|
|
23
|
-
pause(): void;
|
|
24
|
-
|
|
25
|
-
resume(): void;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export declare function clock(tickMs?: number): Clock;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export interface TimeTask {
|
|
2
|
-
fn: () => Promise<any> | any;
|
|
3
|
-
delay?: number;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export type ParallelTasks = TimeTask[];
|
|
7
|
-
|
|
8
|
-
export interface TimeSchedulerOptions {
|
|
9
|
-
repeat?: number;
|
|
10
|
-
loop?: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export declare class TimeScheduler {
|
|
14
|
-
tasks: (TimeTask | ParallelTasks)[];
|
|
15
|
-
repeat: number;
|
|
16
|
-
loop: boolean;
|
|
17
|
-
|
|
18
|
-
stopped: boolean;
|
|
19
|
-
running: boolean;
|
|
20
|
-
|
|
21
|
-
onStart: (() => void) | null;
|
|
22
|
-
onTask: ((fn: () => Promise<any> | any) => void) | null;
|
|
23
|
-
onEnd: (() => void) | null;
|
|
24
|
-
|
|
25
|
-
constructor(
|
|
26
|
-
tasks?: (TimeTask | ParallelTasks)[],
|
|
27
|
-
options?: TimeSchedulerOptions
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
run(): Promise<void>;
|
|
31
|
-
|
|
32
|
-
stop(): void;
|
|
33
|
-
|
|
34
|
-
addTask(task: TimeTask | ParallelTasks): void;
|
|
35
|
-
|
|
36
|
-
clearTasks(): void;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export declare function Scheduler(
|
|
40
|
-
tasks?: (TimeTask | ParallelTasks)[],
|
|
41
|
-
options?: { repeat?: number | null }
|
|
42
|
-
): TimeScheduler;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export declare class Tick {
|
|
2
|
-
ms: number;
|
|
3
|
-
fn: (self: Tick) => void;
|
|
4
|
-
count: number;
|
|
5
|
-
frame: number;
|
|
6
|
-
id: ReturnType<typeof setInterval> | null;
|
|
7
|
-
running: boolean;
|
|
8
|
-
|
|
9
|
-
constructor(
|
|
10
|
-
fn: (self: Tick) => void,
|
|
11
|
-
ms: number,
|
|
12
|
-
count?: number,
|
|
13
|
-
start?: boolean
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
start(): this;
|
|
17
|
-
stop(): this;
|
|
18
|
-
isRunning(): boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export declare function tick(
|
|
22
|
-
fn: (self: Tick) => void,
|
|
23
|
-
ms: number,
|
|
24
|
-
count?: number,
|
|
25
|
-
start?: boolean
|
|
26
|
-
): Tick;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare function debounce<T extends (...args: any[]) => any>(
|
|
2
|
-
fn: T,
|
|
3
|
-
delay?: number
|
|
4
|
-
): (...args: Parameters<T>) => void;
|
|
5
|
-
|
|
6
|
-
export declare function throttle<T extends (...args: any[]) => any>(
|
|
7
|
-
fn: T,
|
|
8
|
-
delay: number
|
|
9
|
-
): (...args: Parameters<T>) => void;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const sleep: (ms: number) => Promise<void>;
|
|
2
|
-
|
|
3
|
-
export interface TimeoutResult {
|
|
4
|
-
id: ReturnType<typeof setTimeout>;
|
|
5
|
-
clear: () => void;
|
|
6
|
-
promise: Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export declare function timeout(
|
|
10
|
-
ms: number,
|
|
11
|
-
fn?: () => any
|
|
12
|
-
): TimeoutResult;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
declare const linear: (t: number) => number;
|
|
2
|
-
|
|
3
|
-
// --- Sin ---
|
|
4
|
-
declare const in_sin: (t: number) => number;
|
|
5
|
-
declare const out_sin: (t: number) => number;
|
|
6
|
-
declare const in_out_sin: (t: number) => number;
|
|
7
|
-
|
|
8
|
-
// --- Quad ---
|
|
9
|
-
declare const in_quad: (t: number) => number;
|
|
10
|
-
declare const out_quad: (t: number) => number;
|
|
11
|
-
declare const in_out_quad: (t: number) => number;
|
|
12
|
-
|
|
13
|
-
// --- Cubic ---
|
|
14
|
-
declare const in_cubic: (t: number) => number;
|
|
15
|
-
declare const out_cubic: (t: number) => number;
|
|
16
|
-
declare const in_out_cubic: (t: number) => number;
|
|
17
|
-
|
|
18
|
-
// --- Quart ---
|
|
19
|
-
declare const in_quart: (t: number) => number;
|
|
20
|
-
declare const out_quart: (t: number) => number;
|
|
21
|
-
declare const in_out_quart: (t: number) => number;
|
|
22
|
-
|
|
23
|
-
// --- Quint ---
|
|
24
|
-
declare const in_quint: (t: number) => number;
|
|
25
|
-
declare const out_quint: (t: number) => number;
|
|
26
|
-
declare const in_out_quint: (t: number) => number;
|
|
27
|
-
|
|
28
|
-
// --- Expo ---
|
|
29
|
-
declare const in_expo: (t: number) => number;
|
|
30
|
-
declare const out_expo: (t: number) => number;
|
|
31
|
-
declare const in_out_expo: (t: number) => number;
|
|
32
|
-
|
|
33
|
-
// --- Circ ---
|
|
34
|
-
declare const in_circ: (t: number) => number;
|
|
35
|
-
declare const out_circ: (t: number) => number;
|
|
36
|
-
declare const in_out_circ: (t: number) => number;
|
|
37
|
-
|
|
38
|
-
// --- Arc ---
|
|
39
|
-
declare const arc: (t: number) => number;
|
|
40
|
-
|
|
41
|
-
// --- Back ---
|
|
42
|
-
declare const back: (t: number, x?: number) => number;
|
|
43
|
-
|
|
44
|
-
// --- Elastic ---
|
|
45
|
-
declare const elastic: (t: number) => number;
|
|
46
|
-
|
|
47
|
-
// --- Back variations ---
|
|
48
|
-
declare const in_back: (t: number, c1?: number, c3?: number) => number;
|
|
49
|
-
declare const out_back: (t: number, c1?: number, c3?: number) => number;
|
|
50
|
-
declare const in_out_back: (t: number, c1?: number, c2?: number) => number;
|
|
51
|
-
|
|
52
|
-
// --- Elastic variations ---
|
|
53
|
-
declare const in_elastic: (t: number, c4?: number) => number;
|
|
54
|
-
declare const out_elastic: (t: number, c4?: number) => number;
|
|
55
|
-
declare const in_out_elastic: (t: number, c5?: number) => number;
|
|
56
|
-
|
|
57
|
-
// --- Bounce ---
|
|
58
|
-
declare const in_bounce: (t: number, n1?: number, d1?: number) => number;
|
|
59
|
-
declare const out_bounce: (t: number, n1?: number, d1?: number) => number;
|
|
60
|
-
declare const in_out_bounce: (t: number, n1?: number, d1?: number) => number;
|
|
61
|
-
|
|
62
|
-
// --- Step & Discret ---
|
|
63
|
-
declare const step: (t: number, steps?: number) => number;
|
|
64
|
-
declare const discret: (t: number, segments?: number) => number;
|
|
65
|
-
|
|
66
|
-
export {
|
|
67
|
-
linear,
|
|
68
|
-
in_sin,
|
|
69
|
-
out_sin,
|
|
70
|
-
in_out_sin,
|
|
71
|
-
in_quad,
|
|
72
|
-
out_quad,
|
|
73
|
-
in_out_quad,
|
|
74
|
-
in_cubic,
|
|
75
|
-
out_cubic,
|
|
76
|
-
in_out_cubic,
|
|
77
|
-
in_quart,
|
|
78
|
-
out_quart,
|
|
79
|
-
in_out_quart,
|
|
80
|
-
in_quint,
|
|
81
|
-
out_quint,
|
|
82
|
-
in_out_quint,
|
|
83
|
-
in_expo,
|
|
84
|
-
out_expo,
|
|
85
|
-
in_out_expo,
|
|
86
|
-
in_circ,
|
|
87
|
-
out_circ,
|
|
88
|
-
in_out_circ,
|
|
89
|
-
arc,
|
|
90
|
-
back,
|
|
91
|
-
elastic,
|
|
92
|
-
in_back,
|
|
93
|
-
out_back,
|
|
94
|
-
in_out_back,
|
|
95
|
-
in_elastic,
|
|
96
|
-
out_elastic,
|
|
97
|
-
in_out_elastic,
|
|
98
|
-
in_bounce,
|
|
99
|
-
out_bounce,
|
|
100
|
-
in_out_bounce,
|
|
101
|
-
step,
|
|
102
|
-
discret
|
|
103
|
-
};
|
package/types/time/index.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export declare class TimeLoop {
|
|
2
|
-
callback: (self: TimeLoop) => void;
|
|
3
|
-
|
|
4
|
-
protected cache: {
|
|
5
|
-
isRunning: boolean;
|
|
6
|
-
id: ReturnType<typeof setTimeout> | null;
|
|
7
|
-
last_tick: number | null;
|
|
8
|
-
step: number;
|
|
9
|
-
t0: number;
|
|
10
|
-
t1: number;
|
|
11
|
-
autoplay: boolean;
|
|
12
|
-
pauseTime: number | null;
|
|
13
|
-
frame: number;
|
|
14
|
-
elapsed?: number;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
constructor(
|
|
18
|
-
callback: (self: TimeLoop) => void,
|
|
19
|
-
options?: {
|
|
20
|
-
step?: number;
|
|
21
|
-
t0?: number;
|
|
22
|
-
t1?: number;
|
|
23
|
-
autoplay?: boolean;
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
get frame(): number;
|
|
28
|
-
|
|
29
|
-
get elapsed(): number | undefined;
|
|
30
|
-
|
|
31
|
-
start(): this;
|
|
32
|
-
pause(): this;
|
|
33
|
-
resume(): this;
|
|
34
|
-
stop(): this;
|
|
35
|
-
|
|
36
|
-
startAfter(t?: number): this;
|
|
37
|
-
stopAfter(t?: number): this;
|
|
38
|
-
|
|
39
|
-
protected animate: () => void;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export declare function loop(
|
|
43
|
-
callback: (self: TimeLoop) => void,
|
|
44
|
-
options?: {
|
|
45
|
-
step?: number;
|
|
46
|
-
t0?: number;
|
|
47
|
-
t1?: number;
|
|
48
|
-
autoplay?: boolean;
|
|
49
|
-
}
|
|
50
|
-
): TimeLoop;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|