what-framework 0.6.2 → 0.6.5

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/compiler.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from 'what-core/compiler';
@@ -0,0 +1,3 @@
1
+ // packages/what/src/compiler.js
2
+ export * from "what-core/compiler";
3
+ //# sourceMappingURL=compiler.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/compiler.js"],
4
+ "sourcesContent": ["// What Framework - Compiler Runtime Internals\n// Re-exports from what-core/compiler for generated code.\n\nexport * from 'what-core/compiler';\n"],
5
+ "mappings": ";AAGA,cAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export*from"what-core/compiler";
2
+ //# sourceMappingURL=compiler.min.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/compiler.js"],
4
+ "sourcesContent": ["// What Framework - Compiler Runtime Internals\n// Re-exports from what-core/compiler for generated code.\n\nexport * from 'what-core/compiler';\n"],
5
+ "mappings": "AAGA,WAAc",
6
+ "names": []
7
+ }
package/dist/index.js CHANGED
@@ -1,3 +1,7 @@
1
1
  // packages/what/src/index.js
2
2
  export * from "what-core";
3
+ import { isSafeUrl } from "what-router";
4
+ export {
5
+ isSafeUrl
6
+ };
3
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.js"],
4
- "sourcesContent": ["// What Framework - The closest framework to vanilla JS\n// Main entry point - re-exports everything from core\n\nexport * from 'what-core';\n"],
5
- "mappings": ";AAGA,cAAc;",
4
+ "sourcesContent": ["// What Framework - The closest framework to vanilla JS\n// Main entry point - re-exports everything from core\n\nexport * from 'what-core';\nexport { isSafeUrl } from 'what-router';\n"],
5
+ "mappings": ";AAGA,cAAc;AACd,SAAS,iBAAiB;",
6
6
  "names": []
7
7
  }
package/dist/index.min.js CHANGED
@@ -1,2 +1,2 @@
1
- export*from"what-core";
1
+ export*from"what-core";import{isSafeUrl as f}from"what-router";export{f as isSafeUrl};
2
2
  //# sourceMappingURL=index.min.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.js"],
4
- "sourcesContent": ["// What Framework - The closest framework to vanilla JS\n// Main entry point - re-exports everything from core\n\nexport * from 'what-core';\n"],
5
- "mappings": "AAGA,WAAc",
6
- "names": []
4
+ "sourcesContent": ["// What Framework - The closest framework to vanilla JS\n// Main entry point - re-exports everything from core\n\nexport * from 'what-core';\nexport { isSafeUrl } from 'what-router';\n"],
5
+ "mappings": "AAGA,WAAc,YACd,OAAS,aAAAA,MAAiB",
6
+ "names": ["isSafeUrl"]
7
7
  }
package/hooks.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ // What Framework - Hooks Type Definitions
2
+
3
+ import { Signal } from './index.js';
4
+
5
+ export function useState<T>(initial: T | (() => T)): [Signal<T>, (value: T | ((prev: T) => T)) => void];
6
+ export function useSignal<T>(initial: T): Signal<T>;
7
+ export function useComputed<T>(fn: () => T): Signal<T>;
8
+ export function useEffect(fn: () => void | (() => void), deps?: any[]): void;
9
+ export function useMemo<T>(fn: () => T, deps?: any[]): T;
10
+ export function useCallback<T extends (...args: any[]) => any>(fn: T, deps?: any[]): T;
11
+ export function useRef<T>(initial?: T): { current: T };
12
+ export function useContext<T>(context: { _defaultValue: T }): T;
13
+ export function createContext<T>(defaultValue?: T): { _defaultValue: T; Provider: (props: { value: T; children: any }) => any };
14
+ export function useReducer<S, A>(reducer: (state: S, action: A) => S, initialState: S, init?: (s: S) => S): [Signal<S>, (action: A) => void];
15
+ export function onMount(fn: () => void | (() => void)): void;
16
+ export function onCleanup(fn: () => void): void;
17
+
18
+ export interface Resource<T> {
19
+ (): T | undefined;
20
+ loading: Signal<boolean>;
21
+ error: Signal<Error | null>;
22
+ refetch: () => void;
23
+ mutate: (value: T) => void;
24
+ }
25
+ export function createResource<T>(fetcher: () => Promise<T>, options?: { initialValue?: T }): Resource<T>;
package/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  // what-framework re-exports the full public API from what-core.
2
2
  export * from 'what-core';
3
+ export { isSafeUrl } from 'what-router';
@@ -0,0 +1,2 @@
1
+ // what-framework re-exports JSX types from what-core.
2
+ export * from 'what-core/jsx-runtime';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "what-framework",
3
- "version": "0.6.2",
4
- "description": "The closest framework to vanilla JS signals, components, islands, SSR",
3
+ "version": "0.6.5",
4
+ "description": "The closest framework to vanilla JS \u2014 signals, components, islands, SSR",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "module": "src/index.js",
@@ -13,10 +13,12 @@
13
13
  "import": "./src/index.js"
14
14
  },
15
15
  "./jsx-runtime": {
16
+ "types": "./jsx-runtime.d.ts",
16
17
  "production": "./dist/jsx-runtime.min.js",
17
18
  "import": "./src/jsx-runtime.js"
18
19
  },
19
20
  "./jsx-dev-runtime": {
21
+ "types": "./jsx-runtime.d.ts",
20
22
  "production": "./dist/jsx-dev-runtime.min.js",
21
23
  "import": "./src/jsx-dev-runtime.js"
22
24
  },
@@ -39,16 +41,33 @@
39
41
  "types": "./testing.d.ts",
40
42
  "production": "./dist/testing.min.js",
41
43
  "import": "./src/testing.js"
44
+ },
45
+ "./hooks": {
46
+ "types": "./hooks.d.ts",
47
+ "import": "./src/hooks.js"
48
+ },
49
+ "./react-compat": {
50
+ "types": "./react-compat.d.ts",
51
+ "import": "./src/react-compat.js"
52
+ },
53
+ "./compiler": {
54
+ "types": "./compiler.d.ts",
55
+ "production": "./dist/compiler.min.js",
56
+ "import": "./src/compiler.js"
42
57
  }
43
58
  },
44
59
  "files": [
45
60
  "src",
46
61
  "dist",
47
62
  "index.d.ts",
63
+ "jsx-runtime.d.ts",
48
64
  "render.d.ts",
49
65
  "router.d.ts",
50
66
  "server.d.ts",
51
- "testing.d.ts"
67
+ "testing.d.ts",
68
+ "hooks.d.ts",
69
+ "react-compat.d.ts",
70
+ "compiler.d.ts"
52
71
  ],
53
72
  "sideEffects": false,
54
73
  "keywords": [
@@ -73,9 +92,9 @@
73
92
  },
74
93
  "homepage": "https://whatfw.com",
75
94
  "dependencies": {
76
- "what-core": "^0.6.0",
77
- "what-router": "^0.6.0",
78
- "what-server": "^0.6.0",
79
- "what-compiler": "^0.6.0"
95
+ "what-core": "^0.6.5",
96
+ "what-router": "^0.6.5",
97
+ "what-server": "^0.6.5",
98
+ "what-compiler": "^0.6.5"
80
99
  }
81
100
  }
@@ -0,0 +1,54 @@
1
+ // What Framework - React Compatibility Layer Type Definitions
2
+
3
+ import { Signal, VNode } from './index.js';
4
+
5
+ export const useState: <T>(initial: T | (() => T)) => [Signal<T>, (value: T | ((prev: T) => T)) => void];
6
+ export const useEffect: (fn: () => void | (() => void), deps?: any[]) => void;
7
+ export const useMemo: <T>(fn: () => T, deps?: any[]) => T;
8
+ export const useCallback: <T extends (...args: any[]) => any>(fn: T, deps?: any[]) => T;
9
+ export const useRef: <T>(initial?: T) => { current: T };
10
+ export const useContext: <T>(context: { _defaultValue: T }) => T;
11
+ export const useReducer: <S, A>(reducer: (state: S, action: A) => S, initialState: S, init?: (s: S) => S) => [Signal<S>, (action: A) => void];
12
+ export const createContext: <T>(defaultValue?: T) => { _defaultValue: T; Provider: (props: { value: T; children: any }) => any };
13
+ export const Fragment: (props: { children?: any }) => any;
14
+ export const Suspense: (props: { fallback?: any; children?: any }) => any;
15
+ export const memo: <T extends (...args: any[]) => any>(component: T) => T;
16
+ export const lazy: <T>(loader: () => Promise<{ default: T }>) => T;
17
+
18
+ export function createElement(type: any, props?: any, ...children: any[]): VNode;
19
+ export function forwardRef<T>(render: (props: any, ref: { current: T }) => any): (props: any) => any;
20
+ export function createRef<T>(): { current: T | null };
21
+ export function cloneElement(element: VNode, props?: any, ...children: any[]): VNode;
22
+ export function isValidElement(object: any): boolean;
23
+
24
+ export function useLayoutEffect(fn: () => void | (() => void), deps?: any[]): void;
25
+ export function useImperativeHandle<T>(ref: { current: T }, createHandle: () => T, deps?: any[]): void;
26
+ export function useId(): string;
27
+ export function useDebugValue(...args: any[]): void;
28
+ export function useSyncExternalStore<T>(subscribe: (cb: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T): T;
29
+ export function useTransition(): [boolean, (fn: () => void) => void];
30
+ export function useDeferredValue<T>(value: T): T;
31
+ export function startTransition(fn: () => void): void;
32
+ export function StrictMode(props: { children?: any }): any;
33
+
34
+ export const version: string;
35
+
36
+ declare const React: {
37
+ useState: typeof useState;
38
+ useEffect: typeof useEffect;
39
+ useMemo: typeof useMemo;
40
+ useCallback: typeof useCallback;
41
+ useRef: typeof useRef;
42
+ useContext: typeof useContext;
43
+ useReducer: typeof useReducer;
44
+ createContext: typeof createContext;
45
+ createElement: typeof createElement;
46
+ Fragment: typeof Fragment;
47
+ memo: typeof memo;
48
+ lazy: typeof lazy;
49
+ forwardRef: typeof forwardRef;
50
+ createRef: typeof createRef;
51
+ isValidElement: typeof isValidElement;
52
+ version: typeof version;
53
+ };
54
+ export default React;
package/router.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // What Framework Router - TypeScript Definitions
2
2
 
3
- import { VNode, VNodeChild, Component, Signal, Computed } from './index';
3
+ import { VNode, VNodeChild, Component, Signal, Computed } from './index.js';
4
4
 
5
5
  // --- Route State ---
6
6
 
@@ -23,6 +23,11 @@ export interface RouteState {
23
23
 
24
24
  export const route: RouteState;
25
25
 
26
+ // --- URL Sanitization ---
27
+
28
+ /** Return false for javascript:, data:, vbscript:, and other unsafe navigation URLs. */
29
+ export function isSafeUrl(url: string): boolean;
30
+
26
31
  // --- Navigation ---
27
32
 
28
33
  export interface NavigateOptions {
package/server.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // What Framework Server - TypeScript Definitions
2
2
 
3
- import { VNode, VNodeChild, Signal } from './index';
3
+ import { VNode, VNodeChild, Signal } from './index.js';
4
4
 
5
5
  // --- SSR ---
6
6
 
@@ -0,0 +1,4 @@
1
+ // What Framework - Compiler Runtime Internals
2
+ // Re-exports from what-core/compiler for generated code.
3
+
4
+ export * from 'what-core/compiler';
package/src/hooks.js ADDED
@@ -0,0 +1 @@
1
+ export * from 'what-core/hooks';
package/src/index.js CHANGED
@@ -2,3 +2,4 @@
2
2
  // Main entry point - re-exports everything from core
3
3
 
4
4
  export * from 'what-core';
5
+ export { isSafeUrl } from 'what-router';
@@ -0,0 +1 @@
1
+ export * from 'what-react';
package/testing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // What Framework - Testing Utilities Type Definitions
2
2
 
3
- import { VNode, Signal } from './index';
3
+ import { VNode, Signal } from './index.js';
4
4
 
5
5
  // Setup and Cleanup
6
6
  export function setupDOM(): HTMLElement | null;