/**
* 0x1 Framework - Main Type Definitions
* React 19+ compatible framework with full type safety
*/
import * as React from './react-compat.js';
// Re-export React compatibility
export = React;
export as namespace React;
// Export main 0x1 types
export * from './0x1.js';
export * from './jsx-runtime.js';
export * from './jsx.js';
export * from './link.js';
// Core 0x1 Framework exports
export { default as Link } from './link.js';
// Make React available globally for JSX
declare global {
namespace React {
// Export all React types from our compatibility layer
export = React;
}
}
/**
* 0x1 Framework Type Definitions
*
* This file re-exports all type definitions to make them available to consuming applications
*/
// Re-export JSX namespace and related types
export * from './jsx';
export * from './jsx-runtime';
// JSX namespace augmentation - automatically picked up by TypeScript when using the framework
import './jsx';
import './jsx-runtime';
// Export JSX Element type
export declare namespace JSX {
interface Element {
type: string | ComponentFunction;
props: any;
children: any[];
__source?: {
fileName: string;
lineNumber: number;
columnNumber: number;
};
__self?: any;
}
// Type definitions for the JSX transformer
export interface ElementClass {
render(): Element;
}
export interface ElementAttributesProperty {
props: any;
}
export interface ElementChildrenAttribute {
children: any;
}
}
// Component type definitions
export type ComponentFunction
= (props: P) => JSX.Element;
export type ComponentClass
= new (props: P) => { render(): JSX.Element };
export type Component
= ComponentFunction
| ComponentClass
;
// JSX specific types
export type JSXNode = JSX.Element;
export type JSXChildren = JSXNode | JSXNode[] | string | number | boolean | null | undefined;
export type JSXAttributes = Record & {
children?: JSXChildren;
ref?: { current: T | null } | ((instance: T | null) => void);
};
/**
* Fragment component for grouping elements without a wrapper
*/
export declare const Fragment: unique symbol;
// Hooks type definitions - React-compatible hooks
export interface RefObject {
current: T | null;
}
export declare function useState(initialState: T | (() => T)): [T, (newState: T | ((prevState: T) => T)) => void];
export declare function useEffect(effect: () => void | (() => void), deps?: any[]): void;
export declare function useRef(initialValue: T): RefObject;
export declare function useCallback any>(callback: T, deps: any[]): T;
export declare function useMemo(factory: () => T, deps: any[]): T;
// Custom hooks
export declare function useClickOutside(callback: () => void): RefObject;
export declare function useFetch(url: string, options?: RequestInit): {
data: T | null;
loading: boolean;
error: Error | null;
};
export declare function useForm>(
initialValues: T,
validationRules?: Partial string | null>>
): {
values: T;
errors: Partial>;
touched: Partial>;
setValue: (name: keyof T, value: any) => void;
setFieldTouched: (name: keyof T, isTouched?: boolean) => void;
validateField: (name: keyof T) => string | null;
validateAll: () => boolean;
reset: () => void;
handleSubmit: (onSubmit: (values: T) => void) => (event?: Event | { preventDefault?: () => void }) => void;
isValid: boolean;
};
export declare function useLocalStorage(
key: string,
initialValue: T
): [T, (value: T | ((prev: T) => T)) => void];
// Store type definitions (re-exported from 0x1-store)
export interface Action {
type: string;
payload?: any;
[key: string]: any;
}
export interface Store {
getState: () => T;
dispatch: (action: Action) => any;
subscribe: (listener: (state: T) => void) => () => void;
select: (selector: (state: T) => S, listener?: (selectedState: S) => void) => () => S;
}
export declare function createStore(
reducer: (state: T, action: Action) => T,
initialState: T,
middlewares?: any[]
): Store;
export declare function createSlice({
name,
initialState,
reducers
}: {
name: string;
initialState: T;
reducers: Record T | void>;
}): {
name: string;
reducer: (state: T, action: Action) => T;
actions: Record Action>;
};
export declare function combineReducers>(
reducers: { [K in keyof T]: (state: T[K], action: Action) => T[K] }
): (state: T, action: Action) => T;
export declare function createSelector(
selector1: (state: T) => R1,
resultFn: (res1: R1) => Result
): (state: T) => Result;
export declare function createSelector2(
selector1: (state: T) => R1,
selector2: (state: T) => R2,
resultFn: (res1: R1, res2: R2) => Result
): (state: T) => Result;