@the-w1zard/the-cloud 1.0.1 → 1.0.3

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/dist/index.js +25850 -8
  2. package/package.json +12 -3
  3. package/src/the-cloud.d.ts +0 -0
  4. package/dist/hooks/callback.d.ts +0 -1
  5. package/dist/hooks/callback.js +0 -13
  6. package/dist/hooks/compose-event-handlers.d.ts +0 -10
  7. package/dist/hooks/compose-event-handlers.js +0 -10
  8. package/dist/hooks/core/index.d.ts +0 -1
  9. package/dist/hooks/core/index.js +0 -1
  10. package/dist/hooks/core/use-id.d.ts +0 -1
  11. package/dist/hooks/core/use-id.js +0 -4
  12. package/dist/hooks/core/use-reducer.d.ts +0 -1
  13. package/dist/hooks/core/use-reducer.js +0 -14
  14. package/dist/hooks/core/use-ref.d.ts +0 -92
  15. package/dist/hooks/core/use-ref.js +0 -559
  16. package/dist/hooks/core/use-state2.d.ts +0 -1
  17. package/dist/hooks/core/use-state2.js +0 -15
  18. package/dist/hooks/deferred_value.d.ts +0 -1
  19. package/dist/hooks/deferred_value.js +0 -12
  20. package/dist/hooks/effect.d.ts +0 -1
  21. package/dist/hooks/effect.js +0 -37
  22. package/dist/hooks/hooks.d.ts +0 -1
  23. package/dist/hooks/hooks.js +0 -1
  24. package/dist/hooks/impertaive_handle.d.ts +0 -3
  25. package/dist/hooks/impertaive_handle.js +0 -24
  26. package/dist/hooks/index.d.ts +0 -1
  27. package/dist/hooks/index.js +0 -4
  28. package/dist/hooks/init_hooks.d.ts +0 -285
  29. package/dist/hooks/init_hooks.js +0 -285
  30. package/dist/hooks/lazy.d.ts +0 -3
  31. package/dist/hooks/lazy.js +0 -15
  32. package/dist/hooks/memo.d.ts +0 -2
  33. package/dist/hooks/memo.js +0 -44
  34. package/dist/hooks/rect.d.ts +0 -24
  35. package/dist/hooks/rect.js +0 -77
  36. package/dist/hooks/state.d.ts +0 -1
  37. package/dist/hooks/state.js +0 -34
  38. package/dist/hooks/suspense.d.ts +0 -4
  39. package/dist/hooks/suspense.js +0 -10
  40. package/dist/hooks/types.d.ts +0 -25
  41. package/dist/hooks/types.js +0 -1
  42. package/dist/index.d.ts +0 -8
  43. package/dist/the-cloud.d.ts +0 -406
  44. package/dist/the-cloud.js +0 -1386
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-w1zard/the-cloud",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "sideEffects": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -11,13 +11,22 @@
11
11
  }
12
12
  },
13
13
  "files": [
14
- "dist"
14
+ "dist",
15
+ "./src/the-cloud.d.ts"
15
16
  ],
16
17
  "scripts": {
17
- "build": "tsc",
18
+ "build": "rspack build",
19
+ "build1": "rspack build",
20
+ "dev": "rspack serve",
18
21
  "check": "tsc --noEmit"
19
22
  },
20
23
  "devDependencies": {
24
+ "@babel/parser": "^8.1.0",
25
+ "@babel/traverse": "^8.1.0",
26
+ "@babel/types": "^8.1.0",
27
+ "@rspack/cli": "^2.3.1",
28
+ "@rspack/core": "^2.3.1",
29
+ "@rspack/dev-server": "^2.2.2",
21
30
  "@the-w1zard/alias_types": "^1.0.2",
22
31
  "@the-w1zard/types": "^1.0.6",
23
32
  "@tsconfig/node-lts": "^24.0.0",
File without changes
@@ -1 +0,0 @@
1
- export declare function useCallback<T extends (...args: A[]) => A>(callback: T, deps?: A[], __sauron_id__?: string): T;
@@ -1,13 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
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
- */
@@ -1,10 +0,0 @@
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
- */
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare function useId(__sauron_id__?: string): string;
@@ -1,4 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- export declare function useReducer<S, A>(reducer: (state: S, action: A) => S, initial: S, __sauron_id__?: string): [S, (action: A) => void];
@@ -1,14 +0,0 @@
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
- }
@@ -1,92 +0,0 @@
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;