@the-w1zard/the-cloud 0.0.0-stage → 1.0.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/README.md +37 -3
- package/dist/hooks/callback.d.ts +1 -0
- package/dist/hooks/callback.js +13 -0
- package/dist/hooks/compose-event-handlers.d.ts +10 -0
- package/dist/hooks/compose-event-handlers.js +10 -0
- package/dist/hooks/core/index.d.ts +1 -0
- package/dist/hooks/core/index.js +1 -0
- package/dist/hooks/core/use-id.d.ts +1 -0
- package/dist/hooks/core/use-id.js +4 -0
- package/dist/hooks/core/use-reducer.d.ts +1 -0
- package/dist/hooks/core/use-reducer.js +14 -0
- package/dist/hooks/core/use-ref.d.ts +92 -0
- package/dist/hooks/core/use-ref.js +559 -0
- package/dist/hooks/core/use-state2.d.ts +1 -0
- package/dist/hooks/core/use-state2.js +15 -0
- package/dist/hooks/deferred_value.d.ts +1 -0
- package/dist/hooks/deferred_value.js +12 -0
- package/dist/hooks/effect.d.ts +1 -0
- package/dist/hooks/effect.js +37 -0
- package/dist/hooks/hooks.d.ts +1 -0
- package/dist/hooks/hooks.js +1 -0
- package/dist/hooks/impertaive_handle.d.ts +3 -0
- package/dist/hooks/impertaive_handle.js +24 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/init_hooks.d.ts +285 -0
- package/dist/hooks/init_hooks.js +285 -0
- package/dist/hooks/lazy.d.ts +3 -0
- package/dist/hooks/lazy.js +15 -0
- package/dist/hooks/memo.d.ts +2 -0
- package/dist/hooks/memo.js +44 -0
- package/dist/hooks/rect.d.ts +24 -0
- package/dist/hooks/rect.js +77 -0
- package/dist/hooks/state.d.ts +1 -0
- package/dist/hooks/state.js +34 -0
- package/dist/hooks/suspense.d.ts +4 -0
- package/dist/hooks/suspense.js +10 -0
- package/dist/hooks/types.d.ts +25 -0
- package/dist/hooks/types.js +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/the-cloud.d.ts +406 -0
- package/dist/the-cloud.js +1386 -0
- package/package.json +41 -4
package/README.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
|
|
2
|
+
<div align="left" style="position: relative;">
|
|
3
|
+
<img src="./icons/gandalf.png" align="right" width="30%" style="margin: -20px 0 0 20px;">
|
|
4
|
+
|
|
5
|
+
<h3>THE-CLOUD: <span style="font-size:18px;">I don't know how it works... it's just... like, you know... the cloud... fuck off.</span></h3>
|
|
6
|
+
|
|
7
|
+
<p align="left"><em>The most opinionated platform... ever.</em></p>
|
|
8
|
+
<p align="left"><em>Trust me... I'm a fucking wizard... 🧙</em></p>ON USER USAGE PATH!-95ED27?style=flat">
|
|
9
|
+
<p align="left">VSCode ext:</p>
|
|
10
|
+
<p align="left">
|
|
11
|
+
<img src="https://img.shields.io/badge/THEMES- 251-95ED27?style=flat">
|
|
12
|
+
<img src="https://img.shields.io/badge/SIDEBARS- 160+-95ED27?style=flat">
|
|
13
|
+
<img src="https://img.shields.io/badge/PRODUCT ICONS- 651-95ED27?style=flat">
|
|
14
|
+
<img src="https://img.shields.io/badge/FILE ICONS- 454-95ED27?style=flat">
|
|
15
|
+
<img src="https://img.shields.io/badge/VSCode Extentions- 82+-95ED27?style=flat">
|
|
16
|
+
<img src="https://img.shields.io/badge/FEATURES- SHIT TONNE-95ED27?style=flat">
|
|
17
|
+
</p>
|
|
18
|
+
<p align="left">Small but powerful repos worth checking out:</p>
|
|
19
|
+
<p align="left">
|
|
20
|
+
|
|
21
|
+
<a href="https://github.com/the-w1zard/app_store"><img src="https://img.shields.io/badge/Store / Maelstrom-000000.svg?style=flat&logo=JetBrains&logoColor=white" alt="JetBrains"></a>
|
|
22
|
+
<a href="https://github.com/the-w1zard/dx"><img src="https://img.shields.io/badge/UX /DX-34A853.svg?style=flat&logo=Android&logoColor=white" alt="Android"></a>
|
|
23
|
+
<a href="https://github.com/the-w1zard/temporal_shift"><img src="https://img.shields.io/badge/Temporal Shift-77AA99.svg?style=flat&logo=Org&logoColor=white" alt="Org"></a>
|
|
24
|
+
<a href="https://github.com/the-w1zard/the_cloud"><img src="https://img.shields.io/badge/The Cloud-02303A.svg?style=flat&logo=Gradle&logoColor=white" alt="Gradle"></a>
|
|
25
|
+
<a href="https://github.com/the-w1zard/signals"><img src="https://img.shields.io/badge/Signals-02303A.svg?style=flat&logo=Gradle&logoColor=white" alt="Gradle"></a>
|
|
26
|
+
<img src="https://img.shields.io/badge/Sometimes, my genius... It generates gravity.-4285F4.svg?style=flat&logo=🧙&logoColor=white" alt="Google">
|
|
27
|
+
<a href="https://github.com/the-w1zard"><img src="https://img.shields.io/badge/Coming Soon: The Wizard Platform-7F52FF.svg?style=flat&logo=Kotlin&logoColor=white" alt="Kotlin"></a>
|
|
28
|
+
<a href="https://github.com/the-w1zard"><img src="https://img.shields.io/badge/Coming Soon: Hadron Particle Disruptor-%23ED8B00.svg?style=flat&logo=openjdk&logoColor=white" alt="java"></a>
|
|
29
|
+
</p>
|
|
30
|
+
<p align="left">The goal? To remove all friction, from everything.</p>
|
|
31
|
+
|
|
32
|
+
</div>
|
|
33
|
+
<br clear="right">
|
|
34
|
+
|
|
35
|
+
> [!NOTE]
|
|
36
|
+
>
|
|
37
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useCallback<T extends (...args: A[]) => A>(callback: T, deps?: A[], __sauron_id__?: string): T;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function useCallback(callback, deps, __sauron_id__ = _sid()) {
|
|
2
|
+
return createHook('useCallback', __sauron_id__, () => ({ value: undefined, callback, deps: deps ?? [] }), (s) => {
|
|
3
|
+
const state = s;
|
|
4
|
+
const hasChanged = !deps ||
|
|
5
|
+
deps.length !== state.deps.length ||
|
|
6
|
+
deps.some((d, i) => d !== state.deps[i]);
|
|
7
|
+
if (hasChanged) {
|
|
8
|
+
state.callback = callback;
|
|
9
|
+
state.deps = deps ?? [];
|
|
10
|
+
}
|
|
11
|
+
return state.callback;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useId(__sauron_id__?: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useReducer<S, A>(reducer: (state: S, action: A) => S, initial: S, __sauron_id__?: string): [S, (action: A) => void];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createHook, getCurrentComponent, subscribeToHook, notifyHook } from '#the-cloud';
|
|
2
|
+
export function useReducer(reducer, initial, __sauron_id__ = _sid()) {
|
|
3
|
+
return createHook('useReducer', __sauron_id__, () => ({ value: initial }), (state, key, notify) => {
|
|
4
|
+
const dispatch = (action) => {
|
|
5
|
+
const next = reducer(state.value, action);
|
|
6
|
+
if (Object.is(state.value, next))
|
|
7
|
+
return;
|
|
8
|
+
state.value = next;
|
|
9
|
+
notify(key);
|
|
10
|
+
return next;
|
|
11
|
+
};
|
|
12
|
+
return [state.value, dispatch];
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export interface RefHandle<T = any> {
|
|
2
|
+
current: T;
|
|
3
|
+
get: () => T;
|
|
4
|
+
set: (value: T) => void;
|
|
5
|
+
subscribe: (callback: (value: T) => void) => () => void;
|
|
6
|
+
isAttached: boolean;
|
|
7
|
+
waitForAttach: (timeout?: number) => Promise<T>;
|
|
8
|
+
}
|
|
9
|
+
export interface MutableRefObject<T = any> {
|
|
10
|
+
current: T;
|
|
11
|
+
}
|
|
12
|
+
export type RefCallback<T = any> = (instance: T) => void;
|
|
13
|
+
export type ForwardedRef<T = any> = ((instance: T) => void) | MutableRefObject<T>;
|
|
14
|
+
export type FowardRef<T = any> = ((instance: T) => void) | {
|
|
15
|
+
current: T;
|
|
16
|
+
};
|
|
17
|
+
export interface RefHandle<T = any> {
|
|
18
|
+
current: T;
|
|
19
|
+
get: () => T;
|
|
20
|
+
set: (value: T) => void;
|
|
21
|
+
subscribe: (callback: (value: T) => void) => () => void;
|
|
22
|
+
isAttached: boolean;
|
|
23
|
+
waitForAttach: (timeout?: number) => Promise<T>;
|
|
24
|
+
toReact: () => MutableRefObject<T>;
|
|
25
|
+
toCallback: () => RefCallback<T>;
|
|
26
|
+
}
|
|
27
|
+
export type AnyRef<T = any> = RefHandle<T> | ForwardedRef<T> | MutableRefObject<T> | RefCallback<T> | {
|
|
28
|
+
current: T;
|
|
29
|
+
} | ((instance: T) => void);
|
|
30
|
+
export declare function useRef<T = any>(initialValue?: T, __sauron_id__?: string): RefHandle<T>;
|
|
31
|
+
export type Ref<T> = RefHandle<T>;
|
|
32
|
+
export type PossibleRef<T> = Ref<T> | undefined;
|
|
33
|
+
export declare function useComposedRefs<T = any>(...refs: PossibleRef<T>[]): RefCallback<T>;
|
|
34
|
+
export declare function composeRefs1<T = any>(...refs: (RefHandle<T> | ((instance: T) => void))[]): (instance: T) => void;
|
|
35
|
+
export declare function composeRefs<T = any>(...refs: PossibleRef<T>[]): RefCallback<T>;
|
|
36
|
+
export interface RefForwardingOptions {
|
|
37
|
+
autoAttach?: boolean;
|
|
38
|
+
validate?: (target: any) => boolean;
|
|
39
|
+
transform?: <T, R>(value: T) => R;
|
|
40
|
+
}
|
|
41
|
+
export declare function createRefForwarder<T = any, P extends object = {}>(render: (props: P, ref: RefHandle<T>) => any, options?: RefForwardingOptions): (props: P & {
|
|
42
|
+
ref?: RefHandle<T> | ((instance: T) => void) | {
|
|
43
|
+
current: T;
|
|
44
|
+
};
|
|
45
|
+
}) => any;
|
|
46
|
+
export declare function useDomRef<T extends HTMLElement = HTMLElement>(): {
|
|
47
|
+
measure: () => {
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
top: number;
|
|
51
|
+
left: number;
|
|
52
|
+
bottom: number;
|
|
53
|
+
right: number;
|
|
54
|
+
scrollWidth: number;
|
|
55
|
+
scrollHeight: number;
|
|
56
|
+
scrollTop: number;
|
|
57
|
+
scrollLeft: number;
|
|
58
|
+
} | null;
|
|
59
|
+
focus: (options?: FocusOptions) => void;
|
|
60
|
+
blur: () => void;
|
|
61
|
+
click: () => void;
|
|
62
|
+
scrollIntoView: (options?: ScrollIntoViewOptions) => void;
|
|
63
|
+
useMeasure: () => void;
|
|
64
|
+
current: T;
|
|
65
|
+
get: () => T;
|
|
66
|
+
set: (value: T) => void;
|
|
67
|
+
subscribe: (callback: (value: T) => void) => () => void;
|
|
68
|
+
isAttached: boolean;
|
|
69
|
+
waitForAttach: (timeout?: number) => Promise<T>;
|
|
70
|
+
toReact: () => MutableRefObject<T>;
|
|
71
|
+
toCallback: () => RefCallback<T>;
|
|
72
|
+
};
|
|
73
|
+
export declare function forwardRef<T = any, P = {}>(render: (props: P, ref: ForwardedRef<T>) => any): ((props: P & {
|
|
74
|
+
ref?: ForwardedRef<T>;
|
|
75
|
+
}) => any) & {
|
|
76
|
+
displayName?: string;
|
|
77
|
+
};
|
|
78
|
+
export declare function mergeAnyRefs<T = any>(...refs: Array<AnyRef<T> | undefined>): RefCallback<T>;
|
|
79
|
+
export declare function useReactRef<T = any>(ref: ForwardedRef<T>): RefHandle<T>;
|
|
80
|
+
export declare function toReactRef<T = any>(handle: RefHandle<T>): MutableRefObject<T>;
|
|
81
|
+
export declare function mergeForwardRefs<T = any>(...refs: (FowardRef<T> | undefined)[]): (instance: T) => void;
|
|
82
|
+
export declare function useForwardedRef<T = any>(forwardedRef: FowardRef<T>): {
|
|
83
|
+
current: T;
|
|
84
|
+
};
|
|
85
|
+
export declare function createForwardRef<T = any>(): {
|
|
86
|
+
current: T | null;
|
|
87
|
+
};
|
|
88
|
+
export declare function isForwardRefObject(ref: any): ref is {
|
|
89
|
+
current: any;
|
|
90
|
+
};
|
|
91
|
+
export declare function isForwardRefCallback(ref: any): ref is (instance: any) => void;
|
|
92
|
+
export declare const UNDEFINED_VOID_ONLY: symbol;
|