@the-w1zard/the-cloud 0.0.0-stage → 1.0.1

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.
Files changed (44) hide show
  1. package/README.md +56 -3
  2. package/dist/hooks/callback.d.ts +1 -0
  3. package/dist/hooks/callback.js +13 -0
  4. package/dist/hooks/compose-event-handlers.d.ts +10 -0
  5. package/dist/hooks/compose-event-handlers.js +10 -0
  6. package/dist/hooks/core/index.d.ts +1 -0
  7. package/dist/hooks/core/index.js +1 -0
  8. package/dist/hooks/core/use-id.d.ts +1 -0
  9. package/dist/hooks/core/use-id.js +4 -0
  10. package/dist/hooks/core/use-reducer.d.ts +1 -0
  11. package/dist/hooks/core/use-reducer.js +14 -0
  12. package/dist/hooks/core/use-ref.d.ts +92 -0
  13. package/dist/hooks/core/use-ref.js +559 -0
  14. package/dist/hooks/core/use-state2.d.ts +1 -0
  15. package/dist/hooks/core/use-state2.js +15 -0
  16. package/dist/hooks/deferred_value.d.ts +1 -0
  17. package/dist/hooks/deferred_value.js +12 -0
  18. package/dist/hooks/effect.d.ts +1 -0
  19. package/dist/hooks/effect.js +37 -0
  20. package/dist/hooks/hooks.d.ts +1 -0
  21. package/dist/hooks/hooks.js +1 -0
  22. package/dist/hooks/impertaive_handle.d.ts +3 -0
  23. package/dist/hooks/impertaive_handle.js +24 -0
  24. package/dist/hooks/index.d.ts +1 -0
  25. package/dist/hooks/index.js +4 -0
  26. package/dist/hooks/init_hooks.d.ts +285 -0
  27. package/dist/hooks/init_hooks.js +285 -0
  28. package/dist/hooks/lazy.d.ts +3 -0
  29. package/dist/hooks/lazy.js +15 -0
  30. package/dist/hooks/memo.d.ts +2 -0
  31. package/dist/hooks/memo.js +44 -0
  32. package/dist/hooks/rect.d.ts +24 -0
  33. package/dist/hooks/rect.js +77 -0
  34. package/dist/hooks/state.d.ts +1 -0
  35. package/dist/hooks/state.js +34 -0
  36. package/dist/hooks/suspense.d.ts +4 -0
  37. package/dist/hooks/suspense.js +10 -0
  38. package/dist/hooks/types.d.ts +25 -0
  39. package/dist/hooks/types.js +1 -0
  40. package/dist/index.d.ts +8 -0
  41. package/dist/index.js +8 -0
  42. package/dist/the-cloud.d.ts +406 -0
  43. package/dist/the-cloud.js +1386 -0
  44. package/package.json +41 -4
package/README.md CHANGED
@@ -1,3 +1,56 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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>
9
+ <p align="left">Platforms stats:</p>
10
+ <p align="left">
11
+ <img src="https://img.shields.io/badge/LINES OF CODE- 10,300,000-95ED27?style=flat">
12
+ <img src="https://img.shields.io/badge/FEATURES- UNKNOWN-95ED27?style=flat">
13
+ <img src="https://img.shields.io/badge/REACTS RULES ON HOOKS- 0-95ED27?style=flat">
14
+ <img src="https://img.shields.io/badge/DISRUPTORS- 18+-95ED27?style=flat">
15
+ <img src="https://img.shields.io/badge/MESSAGE QUEUES- 5-95ED27?style=flat">
16
+ </p>
17
+ <p align="left">VSCode ext:</p>
18
+ <p align="left">
19
+ <img src="https://img.shields.io/badge/THEMES- 251-95ED27?style=flat">
20
+ <img src="https://img.shields.io/badge/SIDEBARS- 160+-95ED27?style=flat">
21
+ <img src="https://img.shields.io/badge/PRODUCT ICONS- 651-95ED27?style=flat">
22
+ <img src="https://img.shields.io/badge/FILE ICONS- 454-95ED27?style=flat">
23
+ <img src="https://img.shields.io/badge/VSCode Extentions- 82+-95ED27?style=flat">
24
+ <img src="https://img.shields.io/badge/FEATURES- SHIT TONNE-95ED27?style=flat">
25
+ </p>
26
+ <p align="left">Small but powerful repos worth checking out:</p>
27
+ <p align="left">
28
+
29
+ - [![🧙 Alias Types](https://img.shields.io/badge/Alias%20Types-000000.svg?style=flat&logo=typescript&logoColor=white)](https://github.com/the-w1zard/alias_types) <a href="https://www.npmjs.com/package/@the-w1zard/alias_types"><img src="./icons/npm.png" alt="alias_types" width="20" height="20"></a>
30
+ - [![🧙 The Cloud](https://img.shields.io/badge/%F0%9F%A7%99%20App%20Store-000000.svg?style=flat)](https://github.com/the-w1zard/app_store) <a href="https://www.npmjs.com/package/@the-w1zard/store"><img src="./icons/npm.png" alt="app_store" width="20" height="20"></a>
31
+ - [![🧙 The Cloud](https://img.shields.io/badge/%F0%9F%A7%99%20DX-95ED27.svg?style=flat)](https://github.com/the-w1zard/dx) <a href="https://www.npmjs.com/package/@the-w1zard/dx"><img src="./icons/npm.png" alt="dx" width="20" height="20"></a>
32
+ - [![🧙 The Cloud](https://img.shields.io/badge/%F0%9F%A7%99%20Temporal%20Shift-77AA99.svg?style=flat)](https://github.com/the-w1zard/temporal_shift) <a href="https://www.npmjs.com/package/@the-w1zard/temporal_shift"><img src="./icons/npm.png" alt="temporal_shift" width="20" height="20"></a>
33
+ - [![🧙 The Cloud](https://img.shields.io/badge/%F0%9F%A7%99%20The%20Cloud-02303A.svg?style=flat)](https://github.com/the-w1zard/the_cloud) <a href="https://www.npmjs.com/package/@the-w1zard/the-cloud"><img src="./icons/npm.png" alt="app_store" width="20" height="20"></a>
34
+ - [![🧙 SINGULARITY](https://img.shields.io/badge/%F0%9F%A7%99%20SINGULARITY-02303A.svg?style=flat)](https://github.com/the-w1zard)
35
+ - [![🧙 Sometimes,%20my%20genius...%20It%20generates%20gravity.](https://img.shields.io/badge/%F0%9F%A7%99%20Sometimes,%20my%20genius...%20It%20generates%20gravity.-4285F4.svg?style=flat)](https://github.com/the-w1zard)
36
+ - [![🧙 The Wizard](https://img.shields.io/badge/%F0%9F%A7%99%20Coming%20Soon:%20The%20Wizard%20Ed.-7F52FF.svg?style=flat)](https://github.com/the-w1zard)
37
+ - [![🧙 Hadron Particle Disruptor](https://img.shields.io/badge/%F0%9F%A7%99%20Coming%20Soon:%20Hadron%20Particle%20Disruptor-23ED8B00.svg?style=flat)](https://github.com/the-w1zard)
38
+ </p>
39
+ <p align="left">The goal? To remove all friction, from everything.</p>
40
+
41
+ </div>
42
+ <br clear="right">
43
+
44
+ > [!NOTE]
45
+ > Uhhhhmmm... I truly cannot think... of a single solution that ships a reactive foundation, where its just 'plop!' right into, any app really... and you either have a react alternative... that works right alongside react without having to configure or edit anything... OR like in my case its used as one of the foundational building block of the platform.
46
+ >
47
+ > Nevermind the fact that:
48
+ > - Other than my own deps... and ts ofcourse, there is no deps. The only reason I moved them out of module was because I wanted thme in other modules I was making. So this is a VERY very lean foundation.
49
+ > - It ships with... how many hooks? I don't even know... didn't count to the exact amount but 150ish, with A LOT more to come. The platform will have EVEN MORE because of their req's, to which I won't be able to include them here.
50
+ > - The only... literally... the only hooks... whatever you can name, solution, module, library WHATEVER really, in the industry at the time of writing, that does NOT ABIDE BY REACTS RULES ON HOOKS, despite the fact that you can LITERALLY place these hooks RIGHT FUCKING BESIDE reacts hooks and they work... And they work in any react based app. ( I've also been thinking about making a module out of... how I can turn a platform from having 0 compatibility to 100% compatibility in terms of every react based platforms node module ecosystem. Truly... not joking. Because this is a fucking pain in the dick, expecially considering there is no room for errors with this one. )
51
+ > - The hooks run in module space, in loops and in conditionals
52
+ > - Dspite actually being signals based, there is no mention of it anywhere.
53
+ > - A secret that I will drop... because it has really changed how I go about code whenever it can be used... The nested map fn ie the quad tiered scoped channel format... If any dev came up to me and asked for one piece of advice that could instantly turn their game around that wasn't some sort of philosophical thing, or just work harder man... this would be it, hands down.
54
+ >
55
+ > At the time of release, this is only meant for the wizards platform. In order for this to be usuable, by anyone anywhere... I need to write a small bit of code for bundlers.
56
+
@@ -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,10 @@
1
+ export {};
2
+ /**
3
+
4
+ export function composeEventHandlers1(theirHandler, ourHandler) {
5
+ return (event) => {
6
+ theirHandler?.(event);
7
+ if (!event.defaultPrevented) ourHandler(event);
8
+ };
9
+ }
10
+ */
@@ -0,0 +1,10 @@
1
+ export {};
2
+ /**
3
+
4
+ export function composeEventHandlers1(theirHandler, ourHandler) {
5
+ return (event) => {
6
+ theirHandler?.(event);
7
+ if (!event.defaultPrevented) ourHandler(event);
8
+ };
9
+ }
10
+ */
@@ -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,4 @@
1
+ import { createHook, getCurrentComponent, subscribeToHook, notifyHook } from '#the-cloud';
2
+ export function useId(__sauron_id__ = _sid()) {
3
+ return createHook('useId', __sauron_id__, () => ({ value: `sid-${__sauron_id__}` }), (state) => state.value);
4
+ }
@@ -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;