ziko 0.63.2 → 0.65.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 +1 -40
- package/dist/ziko.js +1 -40
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +2 -40
- package/package.json +1 -5
- package/src/--reactivity-deprecated/idea +1 -2
- package/src/data/api/fetchdom.js +27 -27
- package/src/data/api/index.js +4 -4
- 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
|
@@ -1,2 +1 @@
|
|
|
1
|
-
useTypeWritter
|
|
2
|
-
useValueToggler
|
|
1
|
+
useTypeWritter
|
package/src/data/api/fetchdom.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { preload } from "./preload";
|
|
1
|
+
// import { preload } from "./preload";
|
|
2
2
|
|
|
3
|
-
async function fetchdom(url='https://github.com/zakarialaoui10') {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
3
|
+
// async function fetchdom(url='https://github.com/zakarialaoui10') {
|
|
4
|
+
// try {
|
|
5
|
+
// const response = await fetch(url);
|
|
6
|
+
// if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
|
7
|
+
// const html = await response.text();
|
|
8
|
+
// const dom = new DOMParser().parseFromString(html, 'text/html');
|
|
9
|
+
// return dom.documentElement;
|
|
10
|
+
// } catch (err) {
|
|
11
|
+
// console.error('Failed to fetch DOM:', err);
|
|
12
|
+
// throw err;
|
|
13
|
+
// }
|
|
14
|
+
// }
|
|
15
15
|
|
|
16
|
-
function fetchdomSync(url='https://github.com/zakarialaoui10') {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
16
|
+
// function fetchdomSync(url='https://github.com/zakarialaoui10') {
|
|
17
|
+
// try {
|
|
18
|
+
// const data = preload(url);
|
|
19
|
+
// const dom = new DOMParser().parseFromString(data, 'text/html');
|
|
20
|
+
// return dom.documentElement;
|
|
21
|
+
// } catch (err) {
|
|
22
|
+
// console.error('Failed to fetch DOM synchronously:', err);
|
|
23
|
+
// throw err;
|
|
24
|
+
// }
|
|
25
|
+
// }
|
|
26
26
|
|
|
27
|
-
export {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
27
|
+
// export {
|
|
28
|
+
// fetchdom,
|
|
29
|
+
// fetchdomSync
|
|
30
|
+
// };
|
package/src/data/api/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { preload } from "./preload";
|
|
2
|
-
import { fetchdom ,fetchdomSync } from "./fetchdom";
|
|
3
|
-
globalThis.fetchdom=fetchdom
|
|
4
|
-
globalThis.fetchdomSync=fetchdomSync
|
|
1
|
+
// export { preload } from "./preload";
|
|
2
|
+
// import { fetchdom ,fetchdomSync } from "./fetchdom";
|
|
3
|
+
// globalThis.fetchdom=fetchdom
|
|
4
|
+
// globalThis.fetchdomSync=fetchdomSync
|
|
@@ -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;
|