what-framework 0.11.8 → 0.12.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "what-framework",
3
- "version": "0.11.8",
3
+ "version": "0.12.0",
4
4
  "description": "The web framework built for AI agents — signals, components, islands, SSR",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -84,9 +84,9 @@
84
84
  },
85
85
  "homepage": "https://whatfw.com",
86
86
  "dependencies": {
87
- "what-core": "^0.11.8",
88
- "what-router": "^0.11.8",
89
- "what-server": "^0.11.8",
90
- "what-compiler": "^0.11.8"
87
+ "what-core": "^0.12.0",
88
+ "what-router": "^0.12.0",
89
+ "what-server": "^0.12.0",
90
+ "what-compiler": "^0.12.0"
91
91
  }
92
92
  }
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
 
@@ -49,7 +49,7 @@ export interface RouteConfig {
49
49
  /** Loading component */
50
50
  loading?: Component<{}>;
51
51
  /** Error component */
52
- error?: Component<{ error: Error }>;
52
+ error?: Component<{ error: Error; reset: () => void }>;
53
53
  /** Route middleware */
54
54
  middleware?: RouteMiddleware[];
55
55
  }
@@ -91,7 +91,7 @@ export interface FileRouterProps {
91
91
  routes: FileRouteConfig[];
92
92
  layout?: Component<{ children?: VNodeChild }>;
93
93
  fallback?: Component<{}>;
94
- error?: Component<{ error: Error }>;
94
+ error?: Component<{ error: Error; reset: () => void }>;
95
95
  }
96
96
 
97
97
  /** Router driven by what-compiler's generated route manifest (virtual:what-routes). */
package/server.d.ts CHANGED
@@ -1,108 +1,11 @@
1
- // What Framework Server - TypeScript Definitions
2
-
3
- import { Component, VNode, VNodeChild, Signal } from './index';
4
-
5
- // --- SSR ---
6
-
7
- /** Render VNode tree to HTML string */
8
- export function renderToString(vnode: VNode): string;
9
-
10
- /** Render VNode tree as async iterator for streaming */
11
- export function renderToStream(vnode: VNode): AsyncGenerator<string>;
12
-
13
- export interface RenderRequestContext {
14
- params?: Record<string, string>;
15
- query?: Record<string, string>;
16
- request?: any;
17
- [key: string]: any;
18
- }
19
-
20
- /** Run a page module's loader, then render it. Returns the body, head and loader data. */
21
- export function renderPage(
22
- pageModule: { default: Component<any>; loader?: (ctx: RenderRequestContext) => any } | Component<any>,
23
- reqCtx?: RenderRequestContext,
24
- ): Promise<{ body: string; head: string; loaderData: any }>;
25
-
26
- // --- Page Configuration ---
27
-
28
- export interface PageConfig {
29
- /** Rendering mode */
30
- mode?: 'static' | 'server' | 'client' | 'hybrid';
31
- /** Page title */
32
- title?: string;
33
- /** Meta tags */
34
- meta?: Record<string, string>;
35
- /** Page component */
36
- component: (data?: any) => VNode;
37
- /** Islands to hydrate */
38
- islands?: string[];
39
- /** Scripts to load */
40
- scripts?: string[];
41
- /** Stylesheets to load */
42
- styles?: string[];
43
- }
44
-
45
- export function definePage(config: Partial<PageConfig>): PageConfig;
46
-
47
- // --- Islands ---
48
-
49
- export type IslandMode = 'static' | 'idle' | 'visible' | 'load' | 'media' | 'action';
50
-
51
- export interface IslandOptions {
52
- /** Hydration mode */
53
- mode?: IslandMode;
54
- /** Media query for 'media' mode */
55
- media?: string;
56
- /** Priority (higher = hydrate first) */
57
- priority?: number;
58
- /** Shared stores this island uses */
59
- stores?: string[];
60
- }
61
-
62
- /** Register an island component */
63
- export function island(
64
- name: string,
65
- loader: () => Promise<any>,
66
- options?: IslandOptions
67
- ): void;
68
-
69
- /** Island component wrapper for SSR */
70
- export function Island(props: {
71
- name: string;
72
- props?: Record<string, any>;
73
- mode?: IslandMode;
74
- priority?: number;
75
- stores?: string[];
76
- children?: VNodeChild;
77
- }): VNode;
78
-
79
- /** Hydrate all islands on the page */
80
- export function hydrateIslands(): void;
81
-
82
- // --- Server Actions ---
83
-
84
- export interface ActionOptions {
85
- id?: string;
86
- onError?: (error: Error) => void;
87
- onSuccess?: (result: any) => void;
88
- revalidate?: string[];
89
- }
90
-
91
- /** Define a server action */
92
- export function action<T extends any[], R>(
93
- fn: (...args: T) => Promise<R>,
94
- options?: ActionOptions
95
- ): (...args: T) => Promise<R>;
96
-
97
- /** Hook for using server actions */
98
- export interface UseActionResult<T extends any[], R> {
99
- trigger: (...args: T) => Promise<R>;
100
- isPending: () => boolean;
101
- error: () => Error | null;
102
- data: () => R | null;
103
- reset: () => void;
104
- }
105
-
106
- export function useAction<T extends any[], R>(
107
- actionFn: (...args: T) => Promise<R>
108
- ): UseActionResult<T, R>;
1
+ // what-framework/server re-exports the full server API. Its runtime
2
+ // (src/server.js) is a pure barrel, so its declarations are one too: this file
3
+ // used to hand-mirror what-server's surface and had drifted 45 exports behind it,
4
+ // which is invisible to every TypeScript user and caught by nothing.
5
+ export * from 'what-server';
6
+ export * from 'what-server/islands';
7
+
8
+ // The island shapes are exported by both entries (the root re-exports them for
9
+ // convenience). An explicit re-export outranks the two star exports and resolves
10
+ // the ambiguity, which is what TS2308 asks for.
11
+ export type { IslandOptions, IslandStore, IslandStatus } from 'what-server/islands';
package/testing.d.ts CHANGED
@@ -1,103 +1,3 @@
1
- // What Framework - Testing Utilities Type Definitions
2
-
3
- import { VNode, Signal } from './index';
4
-
5
- // Setup and Cleanup
6
- export function setupDOM(): HTMLElement | null;
7
- export function cleanup(): void;
8
-
9
- // Render
10
- export interface RenderResult {
11
- container: HTMLElement;
12
- unmount: () => void;
13
- getByText: (text: string | RegExp) => HTMLElement | null;
14
- getByTestId: (id: string) => HTMLElement | null;
15
- getByRole: (role: string) => HTMLElement | null;
16
- getAllByText: (text: string | RegExp) => HTMLElement[];
17
- queryByText: (text: string | RegExp) => HTMLElement | null;
18
- queryByTestId: (id: string) => HTMLElement | null;
19
- debug: () => void;
20
- findByText: (text: string | RegExp, timeout?: number) => Promise<HTMLElement>;
21
- findByTestId: (id: string, timeout?: number) => Promise<HTMLElement>;
22
- }
23
-
24
- export interface RenderOptions {
25
- container?: HTMLElement;
26
- }
27
-
28
- export function render(vnode: VNode, options?: RenderOptions): RenderResult;
29
-
30
- // Fire Events
31
- export interface FireEvent {
32
- click(element: HTMLElement): MouseEvent;
33
- change(element: HTMLInputElement, value: string): Event;
34
- input(element: HTMLInputElement, value: string): Event;
35
- submit(element: HTMLFormElement): Event;
36
- focus(element: HTMLElement): FocusEvent;
37
- blur(element: HTMLElement): FocusEvent;
38
- keyDown(element: HTMLElement, key: string, options?: KeyboardEventInit): KeyboardEvent;
39
- keyUp(element: HTMLElement, key: string, options?: KeyboardEventInit): KeyboardEvent;
40
- mouseEnter(element: HTMLElement): MouseEvent;
41
- mouseLeave(element: HTMLElement): MouseEvent;
42
- }
43
-
44
- export const fireEvent: FireEvent;
45
-
46
- // Wait Utilities
47
- export interface WaitOptions {
48
- timeout?: number;
49
- interval?: number;
50
- }
51
-
52
- export function waitFor<T>(callback: () => T, options?: WaitOptions): Promise<T>;
53
- export function waitForElementToBeRemoved(callback: () => HTMLElement | null, options?: WaitOptions): Promise<void>;
54
-
55
- // Act
56
- export function act<T>(callback: () => T | Promise<T>): Promise<T>;
57
-
58
- // Signal Testing Helpers
59
- export interface TestSignal<T> {
60
- signal: Signal<T>;
61
- value: T;
62
- history: T[];
63
- reset(): void;
64
- }
65
-
66
- export function createTestSignal<T>(initial: T): TestSignal<T>;
67
-
68
- // Mocking
69
- export interface MockComponent {
70
- (props: Record<string, any>): VNode;
71
- displayName: string;
72
- calls: Array<{ props: Record<string, any>; timestamp: number }>;
73
- lastCall(): { props: Record<string, any>; timestamp: number } | undefined;
74
- reset(): void;
75
- }
76
-
77
- export function mockComponent(name?: string): MockComponent;
78
-
79
- // Assertions
80
- export interface Expect {
81
- toBeInTheDocument(element: HTMLElement | null): void;
82
- toHaveTextContent(element: HTMLElement | null, text: string | RegExp): void;
83
- toHaveAttribute(element: HTMLElement | null, attr: string, value?: string): void;
84
- toHaveClass(element: HTMLElement | null, className: string): void;
85
- toBeVisible(element: HTMLElement | null): void;
86
- toBeDisabled(element: HTMLElement | null): void;
87
- toHaveValue(element: HTMLInputElement | null, value: string): void;
88
- }
89
-
90
- export const expect: Expect;
91
-
92
- // Screen
93
- export interface Screen {
94
- getByText(text: string | RegExp): HTMLElement | null;
95
- getByTestId(id: string): HTMLElement | null;
96
- getByRole(role: string): HTMLElement | null;
97
- getAllByText(text: string | RegExp): HTMLElement[];
98
- queryByText(text: string | RegExp): HTMLElement | null;
99
- queryByTestId(id: string): HTMLElement | null;
100
- debug(): void;
101
- }
102
-
103
- export const screen: Screen;
1
+ // what-framework/testing re-exports what-core/testing. Runtime is a pure barrel
2
+ // (src/testing.js), so the declarations mirror it rather than duplicating them.
3
+ export * from 'what-core/testing';