@pyreon/react-compat 0.13.0 → 0.14.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/lib/analysis/index.js.html +1 -1
- package/lib/analysis/jsx-runtime.js.html +1 -1
- package/lib/index.js +356 -40
- package/lib/index.js.map +1 -1
- package/lib/jsx-runtime.js +57 -5
- package/lib/jsx-runtime.js.map +1 -1
- package/lib/types/index.d.ts +205 -4
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/jsx-runtime.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +551 -52
- package/src/jsx-runtime.ts +90 -2
- package/src/tests/compat-integration.test.tsx +1 -0
- package/src/tests/new-apis.test.ts +1519 -0
- package/src/tests/react-compat.test.ts +2 -0
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["h"],"sources":["../src/jsx-runtime.ts","../src/index.ts"],"sourcesContent":["/**\n * Compat JSX runtime for React compatibility mode.\n *\n * When `jsxImportSource` is set to `@pyreon/react-compat` (via the vite plugin's\n * `compat: \"react\"` option), OXC rewrites JSX to import from this file:\n * <div className=\"x\" /> → jsx(\"div\", { className: \"x\" })\n *\n * For component VNodes, we wrap the component function so it returns a reactive\n * accessor — enabling React-style re-renders on state change while Pyreon's\n * existing renderer handles all DOM work.\n */\n\nimport type { ComponentFn, Props, VNode, VNodeChild } from '@pyreon/core'\nimport { Fragment, h } from '@pyreon/core'\nimport { signal } from '@pyreon/reactivity'\n\nexport { Fragment }\n\n// ─── Render context (used by hooks) ──────────────────────────────────────────\n\nexport interface RenderContext {\n hooks: unknown[]\n scheduleRerender: () => void\n /** Effect entries pending execution after render */\n pendingEffects: EffectEntry[]\n /** Layout effect entries pending execution after render */\n pendingLayoutEffects: EffectEntry[]\n /** Set to true when the component is unmounted */\n unmounted: boolean\n}\n\nexport interface EffectEntry {\n fn: () => (() => void) | void\n deps: unknown[] | undefined\n cleanup: (() => void) | undefined\n}\n\nlet _currentCtx: RenderContext | null = null\nlet _hookIndex = 0\n\nexport function getCurrentCtx(): RenderContext | null {\n return _currentCtx\n}\n\nexport function getHookIndex(): number {\n return _hookIndex++\n}\n\nexport function beginRender(ctx: RenderContext): void {\n _currentCtx = ctx\n _hookIndex = 0\n ctx.pendingEffects = []\n ctx.pendingLayoutEffects = []\n}\n\nexport function endRender(): void {\n _currentCtx = null\n _hookIndex = 0\n}\n\n// ─── Effect runners ──────────────────────────────────────────────────────────\n\nfunction runLayoutEffects(entries: EffectEntry[]): void {\n for (const entry of entries) {\n if (entry.cleanup) entry.cleanup()\n const cleanup = entry.fn()\n entry.cleanup = typeof cleanup === 'function' ? cleanup : undefined\n }\n}\n\nfunction scheduleEffects(ctx: RenderContext, entries: EffectEntry[]): void {\n if (entries.length === 0) return\n queueMicrotask(() => {\n for (const entry of entries) {\n if (ctx.unmounted) return\n if (entry.cleanup) entry.cleanup()\n const cleanup = entry.fn()\n entry.cleanup = typeof cleanup === 'function' ? cleanup : undefined\n }\n })\n}\n\n// ─── Component wrapping ──────────────────────────────────────────────────────\n\nconst _wrapperCache = new WeakMap<Function, ComponentFn>()\n\nfunction wrapCompatComponent(reactComponent: Function): ComponentFn {\n let wrapped = _wrapperCache.get(reactComponent)\n if (wrapped) return wrapped\n\n // The wrapper returns a reactive accessor (() => VNodeChild) which Pyreon's\n // mountChild treats as a reactive expression via mountReactive.\n wrapped = ((props: Props) => {\n const ctx: RenderContext = {\n hooks: [],\n scheduleRerender: () => {\n // Will be replaced below after version signal is created\n },\n pendingEffects: [],\n pendingLayoutEffects: [],\n unmounted: false,\n }\n\n const version = signal(0)\n let updateScheduled = false\n\n ctx.scheduleRerender = () => {\n if (ctx.unmounted || updateScheduled) return\n updateScheduled = true\n queueMicrotask(() => {\n updateScheduled = false\n if (!ctx.unmounted) version.set(version.peek() + 1)\n })\n }\n\n // Return reactive accessor — Pyreon's mountChild calls mountReactive\n return () => {\n version() // tracked read — triggers re-execution when state changes\n beginRender(ctx)\n const result = (reactComponent as ComponentFn)(props)\n const layoutEffects = ctx.pendingLayoutEffects\n const effects = ctx.pendingEffects\n endRender()\n\n runLayoutEffects(layoutEffects)\n scheduleEffects(ctx, effects)\n\n return result\n }\n }) as unknown as ComponentFn\n\n _wrapperCache.set(reactComponent, wrapped)\n return wrapped\n}\n\n// ─── JSX functions ───────────────────────────────────────────────────────────\n\nexport function jsx(\n type: string | ComponentFn | symbol,\n props: Props & { children?: VNodeChild | VNodeChild[] },\n key?: string | number | null,\n): VNode {\n const { children, ...rest } = props\n const propsWithKey = (key != null ? { ...rest, key } : rest) as Props\n\n if (typeof type === 'function') {\n // Wrap React-style component for re-render support\n const wrapped = wrapCompatComponent(type)\n const componentProps = children !== undefined ? { ...propsWithKey, children } : propsWithKey\n return h(wrapped, componentProps)\n }\n\n // DOM element or symbol (Fragment): children go in vnode.children\n const childArray = children === undefined ? [] : Array.isArray(children) ? children : [children]\n\n // Map React-style attributes to standard HTML attributes\n if (typeof type === 'string') {\n if (propsWithKey.className !== undefined) {\n propsWithKey.class = propsWithKey.className\n delete propsWithKey.className\n }\n if (propsWithKey.htmlFor !== undefined) {\n propsWithKey.for = propsWithKey.htmlFor\n delete propsWithKey.htmlFor\n }\n }\n\n return h(type, propsWithKey, ...(childArray as VNodeChild[]))\n}\n\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n","/**\n * @pyreon/react-compat\n *\n * Fully React-compatible hook API powered by Pyreon's reactive engine.\n *\n * Components re-render on state change — just like React. Hooks return plain\n * values and use deps arrays for memoization. Existing React code works\n * unchanged when paired with `pyreon({ compat: \"react\" })` in your vite config.\n *\n * USAGE:\n * import { useState, useEffect } from \"react\" // aliased by vite plugin\n * import { createRoot } from \"react-dom/client\" // aliased by vite plugin\n */\n\nexport type { Props, VNode as ReactNode, VNodeChild } from '@pyreon/core'\nexport { Fragment, h as createElement, h } from '@pyreon/core'\n\nimport type { VNode, VNodeChild } from '@pyreon/core'\nimport { createContext, ErrorBoundary, h, Portal, Suspense, useContext } from '@pyreon/core'\nimport { batch } from '@pyreon/reactivity'\nimport type { EffectEntry } from './jsx-runtime'\nimport { getCurrentCtx, getHookIndex } from './jsx-runtime'\n\n// ─── Helpers ─────────────────────────────────────────────────────────────────\n\nfunction requireCtx() {\n const ctx = getCurrentCtx()\n if (!ctx) throw new Error('Hook called outside of a component render')\n return ctx\n}\n\nfunction depsChanged(a: unknown[] | undefined, b: unknown[] | undefined): boolean {\n if (a === undefined || b === undefined) return true\n if (a.length !== b.length) return true\n for (let i = 0; i < a.length; i++) {\n if (!Object.is(a[i], b[i])) return true\n }\n return false\n}\n\n// ─── State ───────────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `useState` — returns `[value, setter]`.\n * Triggers a component re-render when the setter is called.\n */\nexport function useState<T>(initial: T | (() => T)): [T, (v: T | ((prev: T) => T)) => void] {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n if (ctx.hooks.length <= idx) {\n ctx.hooks.push(typeof initial === 'function' ? (initial as () => T)() : initial)\n }\n\n const value = ctx.hooks[idx] as T\n const setter = (v: T | ((prev: T) => T)) => {\n const current = ctx.hooks[idx] as T\n const next = typeof v === 'function' ? (v as (prev: T) => T)(current) : v\n if (Object.is(current, next)) return\n ctx.hooks[idx] = next\n ctx.scheduleRerender()\n }\n\n return [value, setter]\n}\n\n// ─── Reducer ─────────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `useReducer` — returns `[state, dispatch]`.\n */\nexport function useReducer<S, A>(\n reducer: (state: S, action: A) => S,\n initial: S | (() => S),\n): [S, (action: A) => void] {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n if (ctx.hooks.length <= idx) {\n ctx.hooks.push(typeof initial === 'function' ? (initial as () => S)() : initial)\n }\n\n const state = ctx.hooks[idx] as S\n const dispatch = (action: A) => {\n const current = ctx.hooks[idx] as S\n const next = reducer(current, action)\n if (Object.is(current, next)) return\n ctx.hooks[idx] = next\n ctx.scheduleRerender()\n }\n\n return [state, dispatch]\n}\n\n// ─── Effects ─────────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `useEffect` — runs after render when deps change.\n * Returns cleanup on unmount and before re-running.\n */\nexport function useEffect(fn: () => (() => void) | void, deps?: unknown[]): void {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n if (ctx.hooks.length <= idx) {\n // First render — always run\n const entry: EffectEntry = { fn, deps, cleanup: undefined }\n ctx.hooks.push(entry)\n ctx.pendingEffects.push(entry)\n } else {\n const entry = ctx.hooks[idx] as EffectEntry\n if (depsChanged(entry.deps, deps)) {\n entry.fn = fn\n entry.deps = deps\n ctx.pendingEffects.push(entry)\n }\n }\n}\n\n/**\n * React-compatible `useLayoutEffect` — runs synchronously after DOM mutations.\n */\nexport function useLayoutEffect(fn: () => (() => void) | void, deps?: unknown[]): void {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n if (ctx.hooks.length <= idx) {\n const entry: EffectEntry = { fn, deps, cleanup: undefined }\n ctx.hooks.push(entry)\n ctx.pendingLayoutEffects.push(entry)\n } else {\n const entry = ctx.hooks[idx] as EffectEntry\n if (depsChanged(entry.deps, deps)) {\n entry.fn = fn\n entry.deps = deps\n ctx.pendingLayoutEffects.push(entry)\n }\n }\n}\n\n// ─── Memoization ─────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `useMemo` — returns the cached value, recomputed when deps change.\n */\nexport function useMemo<T>(fn: () => T, deps: unknown[]): T {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n if (ctx.hooks.length <= idx) {\n const value = fn()\n ctx.hooks.push({ value, deps })\n return value\n }\n\n const entry = ctx.hooks[idx] as { value: T; deps: unknown[] }\n if (depsChanged(entry.deps, deps)) {\n entry.value = fn()\n entry.deps = deps\n }\n return entry.value\n}\n\n/**\n * React-compatible `useCallback` — returns the cached function when deps haven't changed.\n */\nexport function useCallback<T extends (...args: never[]) => unknown>(fn: T, deps: unknown[]): T {\n return useMemo(() => fn, deps)\n}\n\n// ─── Refs ────────────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `useRef` — returns `{ current }` persisted across re-renders.\n */\nexport function useRef<T>(initial?: T): { current: T | null } {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n if (ctx.hooks.length <= idx) {\n const ref = { current: initial !== undefined ? (initial as T) : null }\n ctx.hooks.push(ref)\n }\n\n return ctx.hooks[idx] as { current: T | null }\n}\n\n// ─── Context ─────────────────────────────────────────────────────────────────\n\nexport { createContext, useContext }\n\n// ─── ID ──────────────────────────────────────────────────────────────────────\n\nlet _idCounter = 0\n\n/**\n * React-compatible `useId` — returns a stable unique string per hook call.\n */\nexport function useId(): string {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n if (ctx.hooks.length <= idx) {\n ctx.hooks.push(`:r${(_idCounter++).toString(36)}:`)\n }\n\n return ctx.hooks[idx] as string\n}\n\n// ─── Optimization ────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `memo` — wraps a component to skip re-render when props\n * are shallowly equal.\n */\nexport function memo<P extends Record<string, unknown>>(\n component: (props: P) => VNodeChild,\n areEqual?: (prevProps: P, nextProps: P) => boolean,\n): (props: P) => VNodeChild {\n const compare =\n areEqual ??\n ((a: P, b: P) => {\n const keysA = Object.keys(a)\n const keysB = Object.keys(b)\n if (keysA.length !== keysB.length) return false\n for (const k of keysA) {\n if (!Object.is(a[k], b[k])) return false\n }\n return true\n })\n\n let prevProps: P | null = null\n let prevResult: VNodeChild = null\n\n return (props: P) => {\n if (prevProps !== null && compare(prevProps, props)) {\n return prevResult\n }\n prevProps = props\n prevResult = (component as (p: P) => VNodeChild)(props)\n return prevResult\n }\n}\n\n/**\n * React-compatible `useTransition` — no concurrent mode in Pyreon.\n */\nexport function useTransition(): [boolean, (fn: () => void) => void] {\n return [false, (fn) => fn()]\n}\n\n/**\n * React-compatible `useDeferredValue` — returns the value as-is.\n */\nexport function useDeferredValue<T>(value: T): T {\n return value\n}\n\n// ─── Imperative handle ───────────────────────────────────────────────────────\n\n/**\n * React-compatible `useImperativeHandle`.\n */\nexport function useImperativeHandle<T>(\n ref: { current: T | null } | null | undefined,\n init: () => T,\n deps?: unknown[],\n): void {\n useLayoutEffect(() => {\n if (ref) ref.current = init()\n return () => {\n if (ref) ref.current = null\n }\n }, deps)\n}\n\n// ─── Batching ────────────────────────────────────────────────────────────────\n\nexport { batch }\n\n// ─── Portals ─────────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `createPortal(children, target)`.\n */\nexport function createPortal(children: VNodeChild, target: Element): VNodeChild {\n return Portal({ target, children })\n}\n\n// ─── Suspense / lazy / ErrorBoundary ─────────────────────────────────────────\n\nexport { lazy } from '@pyreon/core'\nexport { ErrorBoundary, Suspense }\n\n// ─── forwardRef ─────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `forwardRef` — pass-through in Pyreon.\n * Refs are regular props in Pyreon, so no wrapper is needed.\n * The render function receives (props, ref) — we merge ref into props.\n */\nexport function forwardRef<P extends Record<string, unknown>>(\n render: (props: P, ref: { current: unknown } | null) => VNodeChild,\n): (props: P & { ref?: { current: unknown } | null }) => VNodeChild {\n return (props: P & { ref?: { current: unknown } | null }) => {\n const { ref, ...rest } = props\n return render(rest as P, ref ?? null)\n }\n}\n\n// ─── cloneElement ───────────────────────────────────────────────────────────\n\n/**\n * React-compatible `cloneElement` — creates a new VNode with merged props.\n */\nexport function cloneElement(\n element: VNode,\n props?: Record<string, unknown>,\n ...children: VNodeChild[]\n): VNode {\n const mergedProps = { ...element.props, ...props }\n const mergedChildren = children.length > 0 ? children : element.children\n return h(element.type, mergedProps, ...mergedChildren)\n}\n\n// ─── Children utilities ─────────────────────────────────────────────────────\n\nfunction flattenChildren(children: VNodeChild | VNodeChild[]): VNodeChild[] {\n if (children == null) return []\n if (!Array.isArray(children)) return [children]\n const result: VNodeChild[] = []\n for (const child of children) {\n if (Array.isArray(child)) {\n result.push(...flattenChildren(child))\n } else {\n result.push(child)\n }\n }\n return result\n}\n\n/**\n * React-compatible `Children` utilities for working with VNode children.\n */\nexport const Children = {\n /**\n * Iterate over children, calling `fn` for each non-null child.\n */\n map<T>(children: VNodeChild | VNodeChild[], fn: (child: VNodeChild, index: number) => T): T[] {\n const flat = flattenChildren(children)\n const result: T[] = []\n for (let i = 0; i < flat.length; i++) {\n const child = flat[i]\n if (child == null || child === true || child === false) continue\n result.push(fn(child, i))\n }\n return result\n },\n\n /**\n * Call `fn` for each non-null child (no return value).\n */\n forEach(children: VNodeChild | VNodeChild[], fn: (child: VNodeChild, index: number) => void): void {\n const flat = flattenChildren(children)\n for (let i = 0; i < flat.length; i++) {\n const child = flat[i]\n if (child == null || child === true || child === false) continue\n fn(child, i)\n }\n },\n\n /**\n * Count non-null children.\n */\n count(children: VNodeChild | VNodeChild[]): number {\n const flat = flattenChildren(children)\n let count = 0\n for (const child of flat) {\n if (child != null && child !== true && child !== false) count++\n }\n return count\n },\n\n /**\n * Convert children to a flat array.\n */\n toArray(children: VNodeChild | VNodeChild[]): VNodeChild[] {\n const flat = flattenChildren(children)\n return flat.filter((child) => child != null && child !== true && child !== false)\n },\n\n /**\n * Assert and return the only child. Throws if not exactly one child.\n */\n only(children: VNodeChild | VNodeChild[]): VNodeChild {\n const arr = Children.toArray(children)\n if (arr.length !== 1) {\n throw new Error('[Pyreon] Children.only expected exactly one child')\n }\n return arr[0] as VNodeChild\n },\n}\n"],"mappings":";;;;AAqCA,IAAI,cAAoC;AACxC,IAAI,aAAa;AAEjB,SAAgB,gBAAsC;AACpD,QAAO;;AAGT,SAAgB,eAAuB;AACrC,QAAO;;;;;ACpBT,SAAS,aAAa;CACpB,MAAM,MAAM,eAAe;AAC3B,KAAI,CAAC,IAAK,OAAM,IAAI,MAAM,4CAA4C;AACtE,QAAO;;AAGT,SAAS,YAAY,GAA0B,GAAmC;AAChF,KAAI,MAAM,UAAa,MAAM,OAAW,QAAO;AAC/C,KAAI,EAAE,WAAW,EAAE,OAAQ,QAAO;AAClC,MAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,IAC5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
|
|
1
|
+
{"version":3,"file":"index.js","names":["pyreonCreateContext","pyreonUseContext","h"],"sources":["../src/jsx-runtime.ts","../src/index.ts"],"sourcesContent":["/**\n * Compat JSX runtime for React compatibility mode.\n *\n * When `jsxImportSource` is set to `@pyreon/react-compat` (via the vite plugin's\n * `compat: \"react\"` option), OXC rewrites JSX to import from this file:\n * <div className=\"x\" /> → jsx(\"div\", { className: \"x\" })\n *\n * For component VNodes, we wrap the component function so it returns a reactive\n * accessor — enabling React-style re-renders on state change while Pyreon's\n * existing renderer handles all DOM work.\n */\n\nimport type { ComponentFn, Props, VNode, VNodeChild } from '@pyreon/core'\nimport { Fragment, h, onUnmount } from '@pyreon/core'\nimport { signal } from '@pyreon/reactivity'\n\nexport { Fragment }\n\n// ─── Render context (used by hooks) ──────────────────────────────────────────\n\nexport interface RenderContext {\n hooks: unknown[]\n scheduleRerender: () => void\n /** Insertion effect entries pending execution before layout effects */\n pendingInsertionEffects: EffectEntry[]\n /** Effect entries pending execution after render */\n pendingEffects: EffectEntry[]\n /** Layout effect entries pending execution after render */\n pendingLayoutEffects: EffectEntry[]\n /** Set to true when the component is unmounted */\n unmounted: boolean\n /** Hook count from the previous render (dev-mode ordering guard) */\n _hookCount?: number\n}\n\nexport interface EffectEntry {\n fn: () => (() => void) | void\n deps: unknown[] | undefined\n cleanup: (() => void) | undefined\n}\n\nlet _currentCtx: RenderContext | null = null\nlet _hookIndex = 0\nlet _expectedHookCount = -1\n\nexport function getCurrentCtx(): RenderContext | null {\n return _currentCtx\n}\n\nexport function getHookIndex(): number {\n return _hookIndex++\n}\n\nexport function beginRender(ctx: RenderContext): void {\n _currentCtx = ctx\n _hookIndex = 0\n ctx.pendingInsertionEffects = []\n ctx.pendingEffects = []\n ctx.pendingLayoutEffects = []\n\n // On re-renders, remember the hook count from last render\n if (ctx._hookCount !== undefined) {\n _expectedHookCount = ctx._hookCount\n } else {\n _expectedHookCount = -1\n }\n}\n\nexport function endRender(): void {\n if (_currentCtx) {\n // Dev-mode: check hook count matches expected\n if (\n (import.meta as { env?: { DEV?: boolean } }).env?.DEV &&\n _expectedHookCount !== -1 &&\n _hookIndex !== _expectedHookCount\n ) {\n console.error(\n `[Pyreon] Hook count changed between renders (expected ${_expectedHookCount}, got ${_hookIndex}). ` +\n `This usually means a hook is called conditionally. Hooks must be called in the same order every render.`,\n )\n }\n _currentCtx._hookCount = _hookIndex\n }\n _currentCtx = null\n _hookIndex = 0\n}\n\n// ─── Effect runners ──────────────────────────────────────────────────────────\n\nfunction runLayoutEffects(entries: EffectEntry[]): void {\n for (const entry of entries) {\n if (entry.cleanup) entry.cleanup()\n const cleanup = entry.fn()\n entry.cleanup = typeof cleanup === 'function' ? cleanup : undefined\n }\n}\n\nfunction scheduleEffects(ctx: RenderContext, entries: EffectEntry[]): void {\n if (entries.length === 0) return\n queueMicrotask(() => {\n for (const entry of entries) {\n if (ctx.unmounted) return\n if (entry.cleanup) entry.cleanup()\n const cleanup = entry.fn()\n entry.cleanup = typeof cleanup === 'function' ? cleanup : undefined\n }\n })\n}\n\n// ─── Component wrapping ──────────────────────────────────────────────────────\n\nconst _wrapperCache = new WeakMap<Function, ComponentFn>()\n\nfunction wrapCompatComponent(reactComponent: Function): ComponentFn {\n let wrapped = _wrapperCache.get(reactComponent)\n if (wrapped) return wrapped\n\n // The wrapper returns a reactive accessor (() => VNodeChild) which Pyreon's\n // mountChild treats as a reactive expression via mountReactive.\n wrapped = ((props: Props) => {\n const ctx: RenderContext = {\n hooks: [],\n scheduleRerender: () => {\n // Will be replaced below after version signal is created\n },\n pendingInsertionEffects: [],\n pendingEffects: [],\n pendingLayoutEffects: [],\n unmounted: false,\n }\n\n const version = signal(0)\n let updateScheduled = false\n\n ctx.scheduleRerender = () => {\n if (ctx.unmounted || updateScheduled) return\n updateScheduled = true\n queueMicrotask(() => {\n updateScheduled = false\n if (!ctx.unmounted) version.set(version.peek() + 1)\n })\n }\n\n // Register cleanup for all hooks on unmount\n onUnmount(() => {\n ctx.unmounted = true\n for (const hook of ctx.hooks) {\n if (hook && typeof hook === 'object' && 'cleanup' in hook) {\n const entry = hook as EffectEntry\n if (typeof entry.cleanup === 'function') entry.cleanup()\n }\n if (hook && typeof hook === 'object' && 'unsubscribe' in hook) {\n const sub = hook as { unsubscribe?: () => void }\n if (typeof sub.unsubscribe === 'function') sub.unsubscribe()\n }\n if (hook && typeof hook === 'object' && '_contextUnsub' in hook) {\n const ctxHook = hook as { _contextUnsub?: () => void }\n if (typeof ctxHook._contextUnsub === 'function') ctxHook._contextUnsub()\n }\n }\n })\n\n // Return reactive accessor — Pyreon's mountChild calls mountReactive\n return () => {\n version() // tracked read — triggers re-execution when state changes\n beginRender(ctx)\n const result = (reactComponent as ComponentFn)(props)\n const insertionEffects = ctx.pendingInsertionEffects\n const layoutEffects = ctx.pendingLayoutEffects\n const effects = ctx.pendingEffects\n endRender()\n\n // Run in React's order: insertion → layout → passive\n runLayoutEffects(insertionEffects)\n runLayoutEffects(layoutEffects)\n scheduleEffects(ctx, effects)\n\n return result\n }\n }) as unknown as ComponentFn\n\n _wrapperCache.set(reactComponent, wrapped)\n return wrapped\n}\n\n// ─── JSX functions ───────────────────────────────────────────────────────────\n\nexport function jsx(\n type: string | ComponentFn | symbol,\n props: Props & { children?: VNodeChild | VNodeChild[] },\n key?: string | number | null,\n): VNode {\n const { children, ...rest } = props\n const propsWithKey = (key != null ? { ...rest, key } : rest) as Props\n\n if (typeof type === 'function') {\n const componentProps = children !== undefined ? { ...propsWithKey, children } : propsWithKey\n // Native Pyreon components (e.g. context Provider) skip compat wrapping\n const NATIVE = Symbol.for('pyreon:native-compat')\n if ((type as unknown as Record<symbol, boolean>)[NATIVE]) {\n return h(type as ComponentFn, componentProps)\n }\n // Wrap React-style component for re-render support\n const wrapped = wrapCompatComponent(type)\n return h(wrapped, componentProps)\n }\n\n // DOM element or symbol (Fragment): children go in vnode.children\n const childArray = children === undefined ? [] : Array.isArray(children) ? children : [children]\n\n // Map React-style attributes to standard HTML attributes\n if (typeof type === 'string') {\n if (propsWithKey.className !== undefined) {\n propsWithKey.class = propsWithKey.className\n delete propsWithKey.className\n }\n if (propsWithKey.htmlFor !== undefined) {\n propsWithKey.for = propsWithKey.htmlFor\n delete propsWithKey.htmlFor\n }\n\n // React's onChange fires on every keystroke for form elements (like onInput)\n if (\n (type === 'input' || type === 'textarea' || type === 'select') &&\n propsWithKey.onChange !== undefined\n ) {\n if (propsWithKey.onInput === undefined) {\n propsWithKey.onInput = propsWithKey.onChange\n }\n delete propsWithKey.onChange\n }\n\n // autoFocus → autofocus\n if (propsWithKey.autoFocus !== undefined) {\n propsWithKey.autofocus = propsWithKey.autoFocus\n delete propsWithKey.autoFocus\n }\n\n // defaultValue / defaultChecked → value / checked when no controlled value\n if (type === 'input' || type === 'textarea') {\n if (propsWithKey.defaultValue !== undefined && propsWithKey.value === undefined) {\n propsWithKey.value = propsWithKey.defaultValue\n delete propsWithKey.defaultValue\n }\n if (propsWithKey.defaultChecked !== undefined && propsWithKey.checked === undefined) {\n propsWithKey.checked = propsWithKey.defaultChecked\n delete propsWithKey.defaultChecked\n }\n }\n\n // Strip React-only props that have no DOM equivalent\n delete propsWithKey.suppressHydrationWarning\n delete propsWithKey.suppressContentEditableWarning\n }\n\n return h(type, propsWithKey, ...(childArray as VNodeChild[]))\n}\n\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n","/**\n * @pyreon/react-compat\n *\n * Fully React-compatible hook API powered by Pyreon's reactive engine.\n *\n * Components re-render on state change — just like React. Hooks return plain\n * values and use deps arrays for memoization. Existing React code works\n * unchanged when paired with `pyreon({ compat: \"react\" })` in your vite config.\n *\n * USAGE:\n * import { useState, useEffect } from \"react\" // aliased by vite plugin\n * import { createRoot } from \"react-dom/client\" // aliased by vite plugin\n */\n\nexport type { Props, VNode, VNodeChild } from '@pyreon/core'\nexport { Fragment, h as createElement, h, createRef } from '@pyreon/core'\n\nimport type { Context, VNode, VNodeChild } from '@pyreon/core'\nimport {\n createContext as pyreonCreateContext,\n ErrorBoundary,\n h,\n Portal,\n provide as pyreonProvide,\n Suspense,\n useContext as pyreonUseContext,\n} from '@pyreon/core'\nimport { batch } from '@pyreon/reactivity'\nimport type { EffectEntry } from './jsx-runtime'\nimport { getCurrentCtx, getHookIndex } from './jsx-runtime'\n\n// ─── Helpers ─────────────────────────────────────────────────────────────────\n\nfunction requireCtx() {\n const ctx = getCurrentCtx()\n if (!ctx) throw new Error('Hook called outside of a component render')\n return ctx\n}\n\nfunction depsChanged(a: unknown[] | undefined, b: unknown[] | undefined): boolean {\n if (a === undefined || b === undefined) return true\n if (a.length !== b.length) return true\n for (let i = 0; i < a.length; i++) {\n if (!Object.is(a[i], b[i])) return true\n }\n return false\n}\n\n// ─── State ───────────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `useState` — returns `[value, setter]`.\n * Triggers a component re-render when the setter is called.\n */\nexport function useState<T>(initial: T | (() => T)): [T, (v: T | ((prev: T) => T)) => void] {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n if (ctx.hooks.length <= idx) {\n const val = typeof initial === 'function' ? (initial as () => T)() : initial\n // Store both value and a STABLE setter in one hook slot so setter identity\n // never changes across renders (React guarantee).\n const entry = { value: val, setter: null as unknown as (v: T | ((prev: T) => T)) => void }\n entry.setter = (v: T | ((prev: T) => T)) => {\n const current = entry.value\n const next = typeof v === 'function' ? (v as (prev: T) => T)(current) : v\n if (Object.is(current, next)) return\n entry.value = next\n ctx.scheduleRerender()\n }\n ctx.hooks.push(entry)\n }\n\n const entry = ctx.hooks[idx] as { value: T; setter: (v: T | ((prev: T) => T)) => void }\n return [entry.value, entry.setter]\n}\n\n// ─── Reducer ─────────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `useReducer` — returns `[state, dispatch]`.\n * Supports the 3-argument form: `useReducer(reducer, initialArg, init)`.\n */\nexport function useReducer<S, A>(\n reducer: (state: S, action: A) => S,\n initialArg: S | (() => S),\n init?: (arg: S) => S,\n): [S, (action: A) => void] {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n if (ctx.hooks.length <= idx) {\n let initial: S\n if (init) {\n initial = init(initialArg as S)\n } else if (typeof initialArg === 'function') {\n initial = (initialArg as () => S)()\n } else {\n initial = initialArg\n }\n // Store both value and a STABLE dispatch in one hook slot so dispatch identity\n // never changes across renders (React guarantee).\n const entry = { value: initial, dispatch: null as unknown as (action: A) => void }\n entry.dispatch = (action: A) => {\n const current = entry.value\n const next = reducer(current, action)\n if (Object.is(current, next)) return\n entry.value = next\n ctx.scheduleRerender()\n }\n ctx.hooks.push(entry)\n }\n\n const entry = ctx.hooks[idx] as { value: S; dispatch: (action: A) => void }\n return [entry.value, entry.dispatch]\n}\n\n// ─── Effects ─────────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `useEffect` — runs after render when deps change.\n * Returns cleanup on unmount and before re-running.\n */\nexport function useEffect(fn: () => (() => void) | void, deps?: unknown[]): void {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n if (ctx.hooks.length <= idx) {\n // First render — always run\n const entry: EffectEntry = { fn, deps, cleanup: undefined }\n ctx.hooks.push(entry)\n ctx.pendingEffects.push(entry)\n } else {\n const entry = ctx.hooks[idx] as EffectEntry\n if (depsChanged(entry.deps, deps)) {\n entry.fn = fn\n entry.deps = deps\n ctx.pendingEffects.push(entry)\n }\n }\n}\n\n/**\n * React-compatible `useLayoutEffect` — runs synchronously after DOM mutations.\n */\nexport function useLayoutEffect(fn: () => (() => void) | void, deps?: unknown[]): void {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n if (ctx.hooks.length <= idx) {\n const entry: EffectEntry = { fn, deps, cleanup: undefined }\n ctx.hooks.push(entry)\n ctx.pendingLayoutEffects.push(entry)\n } else {\n const entry = ctx.hooks[idx] as EffectEntry\n if (depsChanged(entry.deps, deps)) {\n entry.fn = fn\n entry.deps = deps\n ctx.pendingLayoutEffects.push(entry)\n }\n }\n}\n\n/**\n * React-compatible `useInsertionEffect` — runs synchronously before layout effects.\n * Intended for CSS-in-JS libraries to inject styles before DOM reads.\n */\nexport function useInsertionEffect(fn: () => (() => void) | void, deps?: unknown[]): void {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n if (ctx.hooks.length <= idx) {\n const entry: EffectEntry = { fn, deps, cleanup: undefined }\n ctx.hooks.push(entry)\n ctx.pendingInsertionEffects.push(entry)\n } else {\n const entry = ctx.hooks[idx] as EffectEntry\n if (depsChanged(entry.deps, deps)) {\n entry.fn = fn\n entry.deps = deps\n ctx.pendingInsertionEffects.push(entry)\n }\n }\n}\n\n// ─── Memoization ─────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `useMemo` — returns the cached value, recomputed when deps change.\n */\nexport function useMemo<T>(fn: () => T, deps: unknown[]): T {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n if (ctx.hooks.length <= idx) {\n const value = fn()\n ctx.hooks.push({ value, deps })\n return value\n }\n\n const entry = ctx.hooks[idx] as { value: T; deps: unknown[] }\n if (depsChanged(entry.deps, deps)) {\n entry.value = fn()\n entry.deps = deps\n }\n return entry.value\n}\n\n/**\n * React-compatible `useCallback` — returns the cached function when deps haven't changed.\n */\nexport function useCallback<T extends (...args: never[]) => unknown>(fn: T, deps: unknown[]): T {\n return useMemo(() => fn, deps)\n}\n\n// ─── Refs ────────────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `useRef` — returns `{ current }` persisted across re-renders.\n */\nexport function useRef<T>(initial?: T): { current: T | null } {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n if (ctx.hooks.length <= idx) {\n const ref = { current: initial !== undefined ? (initial as T) : null }\n ctx.hooks.push(ref)\n }\n\n return ctx.hooks[idx] as { current: T | null }\n}\n\n// ─── Context ─────────────────────────────────────────────────────────────────\n\nconst COMPAT_CTX = Symbol.for('pyreon:compat-ctx')\n\n/**\n * Compat-specific context with subscriber notification and tree-scoped nesting.\n *\n * Uses Pyreon's native context stack for tree-scoped Provider nesting (inner\n * Providers override outer ones for their subtree), with a subscriber set\n * layered on top for React-style consumer re-rendering.\n */\nexport interface CompatContext<T> {\n /** Brand marker so `useContext` can distinguish compat contexts */\n readonly [COMPAT_CTX_BRAND]: true\n /** Default value when no Provider is mounted */\n _defaultValue: T\n /** Pyreon native context for tree-scoped value+subscriber storage */\n _pyreonCtx: Context<{ value: T; subscribers: Set<() => void> }>\n /** Subscribers at the default (no-Provider) level */\n _subscribers: Set<() => void>\n /** React-compatible Provider component (native Pyreon, NOT compat-wrapped).\n * Returns a reactive accessor `() => VNodeChild` for Pyreon's renderer. */\n Provider: (props: Record<string, unknown>) => unknown\n}\n\nconst COMPAT_CTX_BRAND: typeof COMPAT_CTX = COMPAT_CTX\n\n// Tag the Provider so wrapCompatComponent skips it (it's already a native component)\nconst NATIVE_COMPONENT = Symbol.for('pyreon:native-compat')\n\n/**\n * React-compatible `createContext` — creates a context with a Provider that\n * supports nested Providers (inner overrides outer for its subtree) and\n * notifies all `useContext` consumers when its value changes.\n */\nexport function createContext<T>(defaultValue: T): CompatContext<T> {\n // Pyreon native context: each Provider pushes { value, subscribers } onto\n // the tree-scoped stack. Consumers read the nearest frame via useContext.\n const pyreonCtx = pyreonCreateContext<{ value: T; subscribers: Set<() => void> }>({\n value: defaultValue,\n subscribers: new Set(),\n })\n\n // Default-level subscribers (for consumers with no Provider above them)\n const defaultSubscribers = new Set<() => void>()\n\n // Provider is a NATIVE Pyreon component (not compat-wrapped).\n // It calls provide() once during setup to push onto the context stack,\n // then returns a reactive accessor that updates the frame value on re-render.\n const Provider = (props: Record<string, unknown>) => {\n // Setup (runs once per mount):\n const frame = { value: (props as { value: T }).value, subscribers: new Set<() => void>() }\n pyreonProvide(pyreonCtx, frame)\n\n // Return reactive accessor for children (re-evaluated when props change)\n return () => {\n const { value, children } = props as { value: T; children?: VNodeChild }\n // On re-render: update the frame value and notify subscribers\n if (!Object.is(frame.value, value)) {\n frame.value = value\n for (const sub of frame.subscribers) sub()\n }\n return children ?? null\n }\n }\n // Mark as native so jsx() doesn't wrap it with wrapCompatComponent\n ;(Provider as unknown as Record<symbol, boolean>)[NATIVE_COMPONENT] = true\n\n const ctx: CompatContext<T> = {\n [COMPAT_CTX_BRAND]: true as const,\n _defaultValue: defaultValue,\n _pyreonCtx: pyreonCtx,\n _subscribers: defaultSubscribers,\n Provider,\n }\n return ctx\n}\n\n/**\n * React-compatible `useContext` — reads the current context value and\n * subscribes the calling component to future value changes.\n *\n * Reads from Pyreon's tree-scoped context stack (correct nesting) and\n * subscribes to the nearest Provider's subscriber set for re-rendering.\n *\n * Works with both compat contexts (from this module's `createContext`) and\n * Pyreon native contexts (from `@pyreon/core`).\n */\nexport function useContext<T>(context: CompatContext<T> | Context<T>): T {\n if (COMPAT_CTX in context) {\n const compatCtx = context as CompatContext<T>\n // Read from Pyreon's tree-scoped stack (correct nesting)\n const frame = pyreonUseContext(compatCtx._pyreonCtx)\n const renderCtx = getCurrentCtx()\n if (renderCtx) {\n const idx = getHookIndex()\n if (renderCtx.hooks.length <= idx) {\n // Subscribe to the frame's subscriber set\n const sub = () => renderCtx.scheduleRerender()\n frame.subscribers.add(sub)\n renderCtx.hooks.push({ _contextUnsub: () => frame.subscribers.delete(sub) })\n }\n }\n return frame.value\n }\n return pyreonUseContext(context as Context<T>)\n}\n\n// ─── ID ──────────────────────────────────────────────────────────────────────\n\nlet _idCounter = 0\n\n/**\n * React-compatible `useId` — returns a stable unique string per hook call.\n */\nexport function useId(): string {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n if (ctx.hooks.length <= idx) {\n ctx.hooks.push(`:r${(_idCounter++).toString(36)}:`)\n }\n\n return ctx.hooks[idx] as string\n}\n\n// ─── Optimization ────────────────────────────────────────────────────────────\n\nfunction shallowEqual<P extends Record<string, unknown>>(a: P, b: P): boolean {\n const keysA = Object.keys(a)\n const keysB = Object.keys(b)\n if (keysA.length !== keysB.length) return false\n for (const k of keysA) {\n if (!Object.is(a[k], b[k])) return false\n }\n return true\n}\n\n/**\n * React-compatible `memo` — wraps a component to skip re-render when props\n * are shallowly equal.\n *\n * Each component INSTANCE gets its own props/result cache via a hook slot,\n * so two `<MemoComp />` usages don't share memoization state.\n */\nexport function memo<P extends Record<string, unknown>>(\n component: (props: P) => VNodeChild,\n areEqual?: (prevProps: P, nextProps: P) => boolean,\n): (props: P) => VNodeChild {\n const compare = areEqual ?? shallowEqual\n\n const MEMO_MARKER = Symbol.for('pyreon:memo')\n\n // Fallback closure-level cache for calls outside a compat render context\n // (e.g. direct function calls in tests). Inside a render context, each\n // component instance gets its own cache via a hook slot.\n let _fallbackPrevProps: P | null = null\n let _fallbackPrevResult: VNodeChild = null\n\n const memoized = (props: P) => {\n const ctx = getCurrentCtx()\n if (ctx) {\n // Per-instance cache via hook slot\n const idx = getHookIndex()\n if (ctx.hooks.length <= idx) {\n ctx.hooks.push({ prevProps: null as P | null, prevResult: null as VNodeChild })\n }\n const cache = ctx.hooks[idx] as { prevProps: P | null; prevResult: VNodeChild }\n if (cache.prevProps !== null && compare(cache.prevProps, props)) {\n return cache.prevResult\n }\n cache.prevProps = props\n cache.prevResult = component(props)\n return cache.prevResult\n }\n // No compat context — use closure-level fallback cache\n if (_fallbackPrevProps !== null && compare(_fallbackPrevProps, props)) {\n return _fallbackPrevResult\n }\n _fallbackPrevProps = props\n _fallbackPrevResult = component(props)\n return _fallbackPrevResult\n }\n ;(memoized as unknown as Record<symbol, boolean>)[MEMO_MARKER] = true\n memoized.displayName =\n (component as unknown as { displayName?: string }).displayName || component.name || 'Memo'\n return memoized\n}\n\n/**\n * React-compatible `useTransition` — no concurrent mode in Pyreon.\n */\nexport function useTransition(): [boolean, (fn: () => void) => void] {\n return [false, (fn) => fn()]\n}\n\n/**\n * React-compatible `useDeferredValue` — returns the value as-is.\n */\nexport function useDeferredValue<T>(value: T): T {\n return value\n}\n\n// ─── Imperative handle ───────────────────────────────────────────────────────\n\n/**\n * React-compatible `useImperativeHandle`.\n */\nexport function useImperativeHandle<T>(\n ref: { current: T | null } | null | undefined,\n init: () => T,\n deps?: unknown[],\n): void {\n useLayoutEffect(() => {\n if (ref) ref.current = init()\n return () => {\n if (ref) ref.current = null\n }\n }, deps)\n}\n\n// ─── Batching ────────────────────────────────────────────────────────────────\n\nexport { batch }\n\n// ─── Portals ─────────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `createPortal(children, target)`.\n */\nexport function createPortal(children: VNodeChild, target: Element): VNodeChild {\n return Portal({ target, children })\n}\n\n// ─── Suspense / lazy / ErrorBoundary ─────────────────────────────────────────\n\nexport { lazy } from '@pyreon/core'\nexport { ErrorBoundary, Suspense }\n\n// ─── forwardRef ─────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `forwardRef` — pass-through in Pyreon.\n * Refs are regular props in Pyreon, so no wrapper is needed.\n * The render function receives (props, ref) — we merge ref into props.\n */\nexport function forwardRef<P extends Record<string, unknown>>(\n render: (props: P, ref: { current: unknown } | null) => VNodeChild,\n): (props: P & { ref?: { current: unknown } | null }) => VNodeChild {\n const forwarded = (props: P & { ref?: { current: unknown } | null }) => {\n const { ref, ...rest } = props\n return render(rest as P, ref ?? null)\n }\n forwarded.displayName =\n (render as unknown as { displayName?: string }).displayName || render.name || 'ForwardRef'\n return forwarded\n}\n\n// ─── cloneElement ───────────────────────────────────────────────────────────\n\n/**\n * React-compatible `cloneElement` — creates a new VNode with merged props.\n */\nexport function cloneElement(\n element: VNode,\n props?: Record<string, unknown>,\n ...children: VNodeChild[]\n): VNode {\n const mergedProps = { ...element.props, ...props }\n const mergedChildren = children.length > 0 ? children : element.children\n return h(element.type, mergedProps, ...mergedChildren)\n}\n\n// ─── Children utilities ─────────────────────────────────────────────────────\n\nfunction flattenChildren(children: VNodeChild | VNodeChild[]): VNodeChild[] {\n if (children == null) return []\n if (!Array.isArray(children)) return [children]\n const result: VNodeChild[] = []\n for (const child of children) {\n if (Array.isArray(child)) {\n result.push(...flattenChildren(child))\n } else {\n result.push(child)\n }\n }\n return result\n}\n\n/**\n * React-compatible `Children` utilities for working with VNode children.\n */\nexport const Children = {\n /**\n * Iterate over children, calling `fn` for each non-null child.\n */\n map<T>(children: VNodeChild | VNodeChild[], fn: (child: VNodeChild, index: number) => T): T[] {\n const flat = flattenChildren(children)\n const result: T[] = []\n let validIndex = 0\n for (let i = 0; i < flat.length; i++) {\n const child = flat[i]\n if (child == null || child === true || child === false) continue\n const mapped = fn(child, validIndex)\n // Assign key to mapped VNode children if they don't already have one\n if (mapped && typeof mapped === 'object' && 'type' in mapped && 'props' in mapped) {\n const vnode = mapped as unknown as VNode\n if (vnode.key == null) {\n vnode.key = `.${validIndex}`\n }\n }\n result.push(mapped)\n validIndex++\n }\n return result\n },\n\n /**\n * Call `fn` for each non-null child (no return value).\n */\n forEach(children: VNodeChild | VNodeChild[], fn: (child: VNodeChild, index: number) => void): void {\n const flat = flattenChildren(children)\n let validIndex = 0\n for (let i = 0; i < flat.length; i++) {\n const child = flat[i]\n if (child == null || child === true || child === false) continue\n fn(child, validIndex++)\n }\n },\n\n /**\n * Count non-null children.\n */\n count(children: VNodeChild | VNodeChild[]): number {\n const flat = flattenChildren(children)\n let count = 0\n for (const child of flat) {\n if (child != null && child !== true && child !== false) count++\n }\n return count\n },\n\n /**\n * Convert children to a flat array.\n */\n toArray(children: VNodeChild | VNodeChild[]): VNodeChild[] {\n const flat = flattenChildren(children)\n return flat.filter((child) => child != null && child !== true && child !== false)\n },\n\n /**\n * Assert and return the only child. Throws if not exactly one child.\n */\n only(children: VNodeChild | VNodeChild[]): VNodeChild {\n const arr = Children.toArray(children)\n if (arr.length !== 1) {\n throw new Error('[Pyreon] Children.only expected exactly one child')\n }\n return arr[0] as VNodeChild\n },\n}\n\n// ─── useSyncExternalStore ───────────────────────────────────────────────────\n\n/**\n * React-compatible `useSyncExternalStore` — subscribes to an external store.\n * Re-subscribes automatically when the `subscribe` function identity changes.\n */\nexport function useSyncExternalStore<T>(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => T,\n getServerSnapshot?: () => T,\n): T {\n const ctx = requireCtx()\n const idx = getHookIndex()\n\n // SSR path\n if (typeof window === 'undefined' && getServerSnapshot) {\n if (ctx.hooks.length <= idx) {\n ctx.hooks.push({ subscribe, unsubscribe: undefined, snapshot: getServerSnapshot() })\n }\n return (ctx.hooks[idx] as { snapshot: T }).snapshot\n }\n\n if (ctx.hooks.length <= idx) {\n const snapshot = getSnapshot()\n const entry = {\n subscribe,\n unsubscribe: undefined as (() => void) | undefined,\n snapshot,\n }\n const onChange = () => {\n const next = getSnapshot()\n if (!Object.is(entry.snapshot, next)) {\n entry.snapshot = next\n ctx.scheduleRerender()\n }\n }\n entry.unsubscribe = subscribe(onChange)\n ctx.hooks.push(entry)\n return snapshot\n }\n\n const entry = ctx.hooks[idx] as {\n subscribe: typeof subscribe\n unsubscribe: (() => void) | undefined\n snapshot: T\n }\n\n // Re-subscribe if subscribe function identity changed\n if (entry.subscribe !== subscribe) {\n if (entry.unsubscribe) entry.unsubscribe()\n const onChange = () => {\n const next = getSnapshot()\n if (!Object.is(entry.snapshot, next)) {\n entry.snapshot = next\n ctx.scheduleRerender()\n }\n }\n entry.unsubscribe = subscribe(onChange)\n entry.subscribe = subscribe\n }\n\n // Always read fresh snapshot during render\n entry.snapshot = getSnapshot()\n return entry.snapshot\n}\n\n// ─── use ────────────────────────────────────────────────────────────────────\n\nconst _promiseCache = new WeakMap<\n Promise<unknown>,\n { status: 'pending' | 'resolved' | 'rejected'; value?: unknown; error?: unknown }\n>()\n\n/**\n * React-compatible `use` — reads a Context or suspends on a Promise.\n * Can be called conditionally (unlike other hooks).\n *\n * IMPORTANT: Promises must have a stable identity across renders.\n * Create promises outside the component or memoize them. Calling\n * `use(fetch('/api'))` creates a new promise each render and will\n * cause infinite suspension.\n */\nexport function use<T>(resource: Context<T> | CompatContext<T> | Promise<T>): T {\n // Compat context path\n if (resource && typeof resource === 'object' && COMPAT_CTX in resource) {\n return useContext(resource as CompatContext<T>)\n }\n // Pyreon native context path\n if (resource && typeof resource === 'object' && 'id' in resource && 'defaultValue' in resource) {\n return pyreonUseContext(resource as Context<T>)\n }\n // Promise path — suspend via throw\n const promise = resource as Promise<T>\n let entry = _promiseCache.get(promise)\n if (!entry) {\n entry = { status: 'pending' }\n _promiseCache.set(promise, entry)\n promise.then(\n (value) => {\n entry!.status = 'resolved'\n entry!.value = value\n },\n (error) => {\n entry!.status = 'rejected'\n entry!.error = error\n },\n )\n }\n if (entry.status === 'resolved') return entry.value as T\n if (entry.status === 'rejected') throw entry.error\n throw promise // Suspense catches this\n}\n\n// ─── useActionState ─────────────────────────────────────────────────────────\n\n/**\n * React-compatible `useActionState` — manages async action state with pending indicator.\n */\nexport function useActionState<S, P>(\n action: (state: S, payload: P) => S | Promise<S>,\n initialState: S,\n): [S, (payload: P) => void, boolean] {\n const [state, setState] = useState(initialState)\n const [isPending, setIsPending] = useState(false)\n\n const dispatch = (payload: P) => {\n setIsPending(true)\n const result = action(state, payload)\n if (result instanceof Promise) {\n result.then((next) => {\n setState(next)\n setIsPending(false)\n })\n } else {\n setState(result)\n setIsPending(false)\n }\n }\n\n return [state, dispatch, isPending]\n}\n\n// ─── startTransition ────────────────────────────────────────────────────────\n\n/**\n * React-compatible `startTransition` — runs the callback synchronously.\n * No concurrent mode in Pyreon, so transitions are immediate.\n */\nexport function startTransition(fn: () => void): void {\n fn()\n}\n\n// ─── isValidElement ─────────────────────────────────────────────────────────\n\n/**\n * React-compatible `isValidElement` — checks if a value is a VNode.\n */\nexport function isValidElement(value: unknown): value is VNode {\n return value != null && typeof value === 'object' && 'type' in value && 'props' in value\n}\n\n// ─── useDebugValue ──────────────────────────────────────────────────────────\n\n/**\n * React-compatible `useDebugValue` — no-op in Pyreon (no React DevTools integration).\n */\nexport function useDebugValue<T>(_value: T, _format?: (v: T) => unknown): void {}\n\n// ─── flushSync ──────────────────────────────────────────────────────────────\n\n/**\n * React-compatible `flushSync` — runs the callback synchronously.\n *\n * BEHAVIORAL DIFFERENCE: In Pyreon's compat model, state updates are\n * batched via microtask. flushSync runs the callback and returns its\n * result, but the DOM updates triggered by state changes inside the\n * callback still fire asynchronously. For DOM measurement after state\n * updates, use `await act(() => setState(...))` in tests, or\n * `requestAnimationFrame` in production code.\n */\nexport function flushSync<T>(fn: () => T): T {\n return fn()\n}\n\n// ─── act (testing) ──────────────────────────────────────────────────────────\n\n/**\n * React-compatible `act` — flushes pending microtasks for testing.\n */\nexport async function act(fn: () => void | Promise<void>): Promise<void> {\n const result = fn()\n if (result instanceof Promise) await result\n // Flush two rounds of microtasks to drain pending effects and rerenders\n await new Promise<void>((r) => queueMicrotask(r))\n await new Promise<void>((r) => queueMicrotask(r))\n}\n\n// ─── version ────────────────────────────────────────────────────────────────\n\nexport const version = '19.0.0-pyreon'\n\n// ─── StrictMode / Profiler ──────────────────────────────────────────────────\n\n/**\n * React-compatible `StrictMode` — pass-through in Pyreon (no double-invoke behavior).\n */\nexport function StrictMode(props: { children?: VNodeChild }): VNodeChild {\n return props.children ?? null\n}\n\n/**\n * React-compatible `Profiler` — pass-through in Pyreon (no profiling integration).\n */\nexport function Profiler(props: {\n id: string\n onRender?: (...args: unknown[]) => void\n children?: VNodeChild\n}): VNodeChild {\n return props.children ?? null\n}\n\n// ─── Component / PureComponent (class stubs) ────────────────────────────────\n\n/**\n * React-compatible `Component` class stub.\n * Class components are not fully supported — use function components with hooks.\n */\nexport class Component<P = Record<string, unknown>, S = Record<string, unknown>> {\n props: Readonly<P>\n state: Readonly<S>\n\n constructor(props: P) {\n this.props = props\n this.state = {} as S\n }\n\n setState(_partial: Partial<S> | ((prev: S) => Partial<S>)): void {\n console.warn(\n '[Pyreon] Class component setState is not supported. Use function components with hooks.',\n )\n }\n\n forceUpdate(): void {\n console.warn(\n '[Pyreon] Class component forceUpdate is not supported. Use function components with hooks.',\n )\n }\n\n render(): VNodeChild {\n return null\n }\n}\n\n/**\n * React-compatible `PureComponent` class stub.\n */\nexport class PureComponent<\n P = Record<string, unknown>,\n S = Record<string, unknown>,\n> extends Component<P, S> {}\n\n// ─── React-compatible type exports ──────────────────────────────────────────\n\nexport type { Context }\n\nexport type FC<P = Record<string, unknown>> = (props: P) => VNodeChild\nexport type FunctionComponent<P = Record<string, unknown>> = FC<P>\nexport type ReactElement = VNode\nexport type ReactNode = VNodeChild\nexport type JSXElementConstructor<P> = (props: P) => VNodeChild\nexport type Dispatch<A> = (action: A) => void\nexport type SetStateAction<S> = S | ((prev: S) => S)\nexport type RefObject<T> = { readonly current: T | null }\nexport type MutableRefObject<T> = { current: T }\nexport type RefCallback<T> = (instance: T | null) => void\nexport type ForwardedRef<T> = RefObject<T> | RefCallback<T> | null\nexport type PropsWithChildren<P = Record<string, unknown>> = P & { children?: ReactNode }\nexport type PropsWithRef<P> = P & { ref?: RefObject<unknown> | RefCallback<unknown> | null }\nexport type { CSSProperties } from '@pyreon/core'\n\n// Event types — aliases for TargetedEvent patterns\nexport type SyntheticEvent<T = Element> = Event & { currentTarget: T }\nexport type ChangeEvent<T = Element> = Event & { currentTarget: T; target: T }\nexport type FormEvent<T = Element> = Event & { currentTarget: T }\nexport type MouseEvent<T = Element> = globalThis.MouseEvent & { currentTarget: T }\nexport type KeyboardEvent<T = Element> = globalThis.KeyboardEvent & { currentTarget: T }\nexport type FocusEvent<T = Element> = globalThis.FocusEvent & { currentTarget: T }\nexport type DragEvent<T = Element> = globalThis.DragEvent & { currentTarget: T }\nexport type PointerEvent<T = Element> = globalThis.PointerEvent & { currentTarget: T }\nexport type TouchEvent<T = Element> = globalThis.TouchEvent & { currentTarget: T }\nexport type ClipboardEvent<T = Element> = globalThis.ClipboardEvent & { currentTarget: T }\nexport type AnimationEvent<T = Element> = globalThis.AnimationEvent & { currentTarget: T }\nexport type TransitionEvent<T = Element> = globalThis.TransitionEvent & { currentTarget: T }\nexport type WheelEvent<T = Element> = globalThis.WheelEvent & { currentTarget: T }\n\n// HTML attribute types\nexport type HTMLAttributes<T = HTMLElement> = Record<string, unknown> & {\n ref?: RefObject<T> | RefCallback<T> | null\n}\nexport type InputHTMLAttributes<T = HTMLInputElement> = HTMLAttributes<T>\nexport type TextareaHTMLAttributes<T = HTMLTextAreaElement> = HTMLAttributes<T>\nexport type SelectHTMLAttributes<T = HTMLSelectElement> = HTMLAttributes<T>\nexport type ButtonHTMLAttributes<T = HTMLButtonElement> = HTMLAttributes<T>\nexport type AnchorHTMLAttributes<T = HTMLAnchorElement> = HTMLAttributes<T>\nexport type FormHTMLAttributes<T = HTMLFormElement> = HTMLAttributes<T>\nexport type ImgHTMLAttributes<T = HTMLImageElement> = HTMLAttributes<T>\nexport type SVGAttributes<T = SVGElement> = HTMLAttributes<T>\n"],"mappings":";;;;AAyCA,IAAI,cAAoC;AACxC,IAAI,aAAa;AAGjB,SAAgB,gBAAsC;AACpD,QAAO;;AAGT,SAAgB,eAAuB;AACrC,QAAO;;;;;ACjBT,SAAS,aAAa;CACpB,MAAM,MAAM,eAAe;AAC3B,KAAI,CAAC,IAAK,OAAM,IAAI,MAAM,4CAA4C;AACtE,QAAO;;AAGT,SAAS,YAAY,GAA0B,GAAmC;AAChF,KAAI,MAAM,UAAa,MAAM,OAAW,QAAO;AAC/C,KAAI,EAAE,WAAW,EAAE,OAAQ,QAAO;AAClC,MAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,IAC5B,KAAI,CAAC,OAAO,GAAG,EAAE,IAAI,EAAE,GAAG,CAAE,QAAO;AAErC,QAAO;;;;;;AAST,SAAgB,SAAY,SAAgE;CAC1F,MAAM,MAAM,YAAY;CACxB,MAAM,MAAM,cAAc;AAE1B,KAAI,IAAI,MAAM,UAAU,KAAK;EAI3B,MAAM,QAAQ;GAAE,OAHJ,OAAO,YAAY,aAAc,SAAqB,GAAG;GAGzC,QAAQ;GAAsD;AAC1F,QAAM,UAAU,MAA4B;GAC1C,MAAM,UAAU,MAAM;GACtB,MAAM,OAAO,OAAO,MAAM,aAAc,EAAqB,QAAQ,GAAG;AACxE,OAAI,OAAO,GAAG,SAAS,KAAK,CAAE;AAC9B,SAAM,QAAQ;AACd,OAAI,kBAAkB;;AAExB,MAA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M;IACnB;OACG;AACL,YAAS,OAAO;AAChB,gBAAa,MAAM;;;AAIvB,QAAO;EAAC;EAAO;EAAU;EAAU;;;;;;AASrC,SAAgB,gBAAgB,IAAsB;AACpD,KAAI;;;;;AAQN,SAAgB,eAAe,OAAgC;AAC7D,QAAO,SAAS,QAAQ,OAAO,UAAU,YAAY,UAAU,SAAS,WAAW;;;;;AAQrF,SAAgB,cAAiB,QAAW,SAAmC;;;;;;;;;;;AAc/E,SAAgB,UAAa,IAAgB;AAC3C,QAAO,IAAI;;;;;AAQb,eAAsB,IAAI,IAA+C;CACvE,MAAM,SAAS,IAAI;AACnB,KAAI,kBAAkB,QAAS,OAAM;AAErC,OAAM,IAAI,SAAe,MAAM,eAAe,EAAE,CAAC;AACjD,OAAM,IAAI,SAAe,MAAM,eAAe,EAAE,CAAC;;AAKnD,MAAa,UAAU;;;;AAOvB,SAAgB,WAAW,OAA8C;AACvE,QAAO,MAAM,YAAY;;;;;AAM3B,SAAgB,SAAS,OAIV;AACb,QAAO,MAAM,YAAY;;;;;;AAS3B,IAAa,YAAb,MAAiF;CAC/E;CACA;CAEA,YAAY,OAAU;AACpB,OAAK,QAAQ;AACb,OAAK,QAAQ,EAAE;;CAGjB,SAAS,UAAwD;AAC/D,UAAQ,KACN,0FACD;;CAGH,cAAoB;AAClB,UAAQ,KACN,6FACD;;CAGH,SAAqB;AACnB,SAAO;;;;;;AAOX,IAAa,gBAAb,cAGU,UAAgB"}
|
package/lib/jsx-runtime.js
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import { Fragment, h } from "@pyreon/core";
|
|
1
|
+
import { Fragment, h, onUnmount } from "@pyreon/core";
|
|
2
2
|
import { signal } from "@pyreon/reactivity";
|
|
3
3
|
|
|
4
4
|
//#region src/jsx-runtime.ts
|
|
5
5
|
let _currentCtx = null;
|
|
6
6
|
let _hookIndex = 0;
|
|
7
|
+
let _expectedHookCount = -1;
|
|
7
8
|
function beginRender(ctx) {
|
|
8
9
|
_currentCtx = ctx;
|
|
9
10
|
_hookIndex = 0;
|
|
11
|
+
ctx.pendingInsertionEffects = [];
|
|
10
12
|
ctx.pendingEffects = [];
|
|
11
13
|
ctx.pendingLayoutEffects = [];
|
|
14
|
+
if (ctx._hookCount !== void 0) _expectedHookCount = ctx._hookCount;
|
|
15
|
+
else _expectedHookCount = -1;
|
|
12
16
|
}
|
|
13
17
|
function endRender() {
|
|
18
|
+
if (_currentCtx) {
|
|
19
|
+
if (import.meta.env?.DEV && _expectedHookCount !== -1 && _hookIndex !== _expectedHookCount) console.error(`[Pyreon] Hook count changed between renders (expected ${_expectedHookCount}, got ${_hookIndex}). This usually means a hook is called conditionally. Hooks must be called in the same order every render.`);
|
|
20
|
+
_currentCtx._hookCount = _hookIndex;
|
|
21
|
+
}
|
|
14
22
|
_currentCtx = null;
|
|
15
23
|
_hookIndex = 0;
|
|
16
24
|
}
|
|
@@ -40,6 +48,7 @@ function wrapCompatComponent(reactComponent) {
|
|
|
40
48
|
const ctx = {
|
|
41
49
|
hooks: [],
|
|
42
50
|
scheduleRerender: () => {},
|
|
51
|
+
pendingInsertionEffects: [],
|
|
43
52
|
pendingEffects: [],
|
|
44
53
|
pendingLayoutEffects: [],
|
|
45
54
|
unmounted: false
|
|
@@ -54,13 +63,32 @@ function wrapCompatComponent(reactComponent) {
|
|
|
54
63
|
if (!ctx.unmounted) version.set(version.peek() + 1);
|
|
55
64
|
});
|
|
56
65
|
};
|
|
66
|
+
onUnmount(() => {
|
|
67
|
+
ctx.unmounted = true;
|
|
68
|
+
for (const hook of ctx.hooks) {
|
|
69
|
+
if (hook && typeof hook === "object" && "cleanup" in hook) {
|
|
70
|
+
const entry = hook;
|
|
71
|
+
if (typeof entry.cleanup === "function") entry.cleanup();
|
|
72
|
+
}
|
|
73
|
+
if (hook && typeof hook === "object" && "unsubscribe" in hook) {
|
|
74
|
+
const sub = hook;
|
|
75
|
+
if (typeof sub.unsubscribe === "function") sub.unsubscribe();
|
|
76
|
+
}
|
|
77
|
+
if (hook && typeof hook === "object" && "_contextUnsub" in hook) {
|
|
78
|
+
const ctxHook = hook;
|
|
79
|
+
if (typeof ctxHook._contextUnsub === "function") ctxHook._contextUnsub();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
57
83
|
return () => {
|
|
58
84
|
version();
|
|
59
85
|
beginRender(ctx);
|
|
60
86
|
const result = reactComponent(props);
|
|
87
|
+
const insertionEffects = ctx.pendingInsertionEffects;
|
|
61
88
|
const layoutEffects = ctx.pendingLayoutEffects;
|
|
62
89
|
const effects = ctx.pendingEffects;
|
|
63
90
|
endRender();
|
|
91
|
+
runLayoutEffects(insertionEffects);
|
|
64
92
|
runLayoutEffects(layoutEffects);
|
|
65
93
|
scheduleEffects(ctx, effects);
|
|
66
94
|
return result;
|
|
@@ -75,10 +103,14 @@ function jsx(type, props, key) {
|
|
|
75
103
|
...rest,
|
|
76
104
|
key
|
|
77
105
|
} : rest;
|
|
78
|
-
if (typeof type === "function")
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
106
|
+
if (typeof type === "function") {
|
|
107
|
+
const componentProps = children !== void 0 ? {
|
|
108
|
+
...propsWithKey,
|
|
109
|
+
children
|
|
110
|
+
} : propsWithKey;
|
|
111
|
+
if (type[Symbol.for("pyreon:native-compat")]) return h(type, componentProps);
|
|
112
|
+
return h(wrapCompatComponent(type), componentProps);
|
|
113
|
+
}
|
|
82
114
|
const childArray = children === void 0 ? [] : Array.isArray(children) ? children : [children];
|
|
83
115
|
if (typeof type === "string") {
|
|
84
116
|
if (propsWithKey.className !== void 0) {
|
|
@@ -89,6 +121,26 @@ function jsx(type, props, key) {
|
|
|
89
121
|
propsWithKey.for = propsWithKey.htmlFor;
|
|
90
122
|
delete propsWithKey.htmlFor;
|
|
91
123
|
}
|
|
124
|
+
if ((type === "input" || type === "textarea" || type === "select") && propsWithKey.onChange !== void 0) {
|
|
125
|
+
if (propsWithKey.onInput === void 0) propsWithKey.onInput = propsWithKey.onChange;
|
|
126
|
+
delete propsWithKey.onChange;
|
|
127
|
+
}
|
|
128
|
+
if (propsWithKey.autoFocus !== void 0) {
|
|
129
|
+
propsWithKey.autofocus = propsWithKey.autoFocus;
|
|
130
|
+
delete propsWithKey.autoFocus;
|
|
131
|
+
}
|
|
132
|
+
if (type === "input" || type === "textarea") {
|
|
133
|
+
if (propsWithKey.defaultValue !== void 0 && propsWithKey.value === void 0) {
|
|
134
|
+
propsWithKey.value = propsWithKey.defaultValue;
|
|
135
|
+
delete propsWithKey.defaultValue;
|
|
136
|
+
}
|
|
137
|
+
if (propsWithKey.defaultChecked !== void 0 && propsWithKey.checked === void 0) {
|
|
138
|
+
propsWithKey.checked = propsWithKey.defaultChecked;
|
|
139
|
+
delete propsWithKey.defaultChecked;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
delete propsWithKey.suppressHydrationWarning;
|
|
143
|
+
delete propsWithKey.suppressContentEditableWarning;
|
|
92
144
|
}
|
|
93
145
|
return h(type, propsWithKey, ...childArray);
|
|
94
146
|
}
|
package/lib/jsx-runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-runtime.js","names":[],"sources":["../src/jsx-runtime.ts"],"sourcesContent":["/**\n * Compat JSX runtime for React compatibility mode.\n *\n * When `jsxImportSource` is set to `@pyreon/react-compat` (via the vite plugin's\n * `compat: \"react\"` option), OXC rewrites JSX to import from this file:\n * <div className=\"x\" /> → jsx(\"div\", { className: \"x\" })\n *\n * For component VNodes, we wrap the component function so it returns a reactive\n * accessor — enabling React-style re-renders on state change while Pyreon's\n * existing renderer handles all DOM work.\n */\n\nimport type { ComponentFn, Props, VNode, VNodeChild } from '@pyreon/core'\nimport { Fragment, h } from '@pyreon/core'\nimport { signal } from '@pyreon/reactivity'\n\nexport { Fragment }\n\n// ─── Render context (used by hooks) ──────────────────────────────────────────\n\nexport interface RenderContext {\n hooks: unknown[]\n scheduleRerender: () => void\n /** Effect entries pending execution after render */\n pendingEffects: EffectEntry[]\n /** Layout effect entries pending execution after render */\n pendingLayoutEffects: EffectEntry[]\n /** Set to true when the component is unmounted */\n unmounted: boolean\n}\n\nexport interface EffectEntry {\n fn: () => (() => void) | void\n deps: unknown[] | undefined\n cleanup: (() => void) | undefined\n}\n\nlet _currentCtx: RenderContext | null = null\nlet _hookIndex = 0\n\nexport function getCurrentCtx(): RenderContext | null {\n return _currentCtx\n}\n\nexport function getHookIndex(): number {\n return _hookIndex++\n}\n\nexport function beginRender(ctx: RenderContext): void {\n _currentCtx = ctx\n _hookIndex = 0\n ctx.pendingEffects = []\n ctx.pendingLayoutEffects = []\n}\n\nexport function endRender(): void {\n _currentCtx = null\n _hookIndex = 0\n}\n\n// ─── Effect runners ──────────────────────────────────────────────────────────\n\nfunction runLayoutEffects(entries: EffectEntry[]): void {\n for (const entry of entries) {\n if (entry.cleanup) entry.cleanup()\n const cleanup = entry.fn()\n entry.cleanup = typeof cleanup === 'function' ? cleanup : undefined\n }\n}\n\nfunction scheduleEffects(ctx: RenderContext, entries: EffectEntry[]): void {\n if (entries.length === 0) return\n queueMicrotask(() => {\n for (const entry of entries) {\n if (ctx.unmounted) return\n if (entry.cleanup) entry.cleanup()\n const cleanup = entry.fn()\n entry.cleanup = typeof cleanup === 'function' ? cleanup : undefined\n }\n })\n}\n\n// ─── Component wrapping ──────────────────────────────────────────────────────\n\nconst _wrapperCache = new WeakMap<Function, ComponentFn>()\n\nfunction wrapCompatComponent(reactComponent: Function): ComponentFn {\n let wrapped = _wrapperCache.get(reactComponent)\n if (wrapped) return wrapped\n\n // The wrapper returns a reactive accessor (() => VNodeChild) which Pyreon's\n // mountChild treats as a reactive expression via mountReactive.\n wrapped = ((props: Props) => {\n const ctx: RenderContext = {\n hooks: [],\n scheduleRerender: () => {\n // Will be replaced below after version signal is created\n },\n pendingEffects: [],\n pendingLayoutEffects: [],\n unmounted: false,\n }\n\n const version = signal(0)\n let updateScheduled = false\n\n ctx.scheduleRerender = () => {\n if (ctx.unmounted || updateScheduled) return\n updateScheduled = true\n queueMicrotask(() => {\n updateScheduled = false\n if (!ctx.unmounted) version.set(version.peek() + 1)\n })\n }\n\n // Return reactive accessor — Pyreon's mountChild calls mountReactive\n return () => {\n version() // tracked read — triggers re-execution when state changes\n beginRender(ctx)\n const result = (reactComponent as ComponentFn)(props)\n const layoutEffects = ctx.pendingLayoutEffects\n const effects = ctx.pendingEffects\n endRender()\n\n runLayoutEffects(layoutEffects)\n scheduleEffects(ctx, effects)\n\n return result\n }\n }) as unknown as ComponentFn\n\n _wrapperCache.set(reactComponent, wrapped)\n return wrapped\n}\n\n// ─── JSX functions ───────────────────────────────────────────────────────────\n\nexport function jsx(\n type: string | ComponentFn | symbol,\n props: Props & { children?: VNodeChild | VNodeChild[] },\n key?: string | number | null,\n): VNode {\n const { children, ...rest } = props\n const propsWithKey = (key != null ? { ...rest, key } : rest) as Props\n\n if (typeof type === 'function') {\n // Wrap React-style component for re-render support\n const wrapped = wrapCompatComponent(type)\n const componentProps = children !== undefined ? { ...propsWithKey, children } : propsWithKey\n return h(wrapped, componentProps)\n }\n\n // DOM element or symbol (Fragment): children go in vnode.children\n const childArray = children === undefined ? [] : Array.isArray(children) ? children : [children]\n\n // Map React-style attributes to standard HTML attributes\n if (typeof type === 'string') {\n if (propsWithKey.className !== undefined) {\n propsWithKey.class = propsWithKey.className\n delete propsWithKey.className\n }\n if (propsWithKey.htmlFor !== undefined) {\n propsWithKey.for = propsWithKey.htmlFor\n delete propsWithKey.htmlFor\n }\n }\n\n return h(type, propsWithKey, ...(childArray as VNodeChild[]))\n}\n\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n"],"mappings":";;;;AAqCA,IAAI,cAAoC;AACxC,IAAI,aAAa;AAUjB,SAAgB,YAAY,KAA0B;AACpD,eAAc;AACd,cAAa;AACb,KAAI,iBAAiB,EAAE;AACvB,KAAI,uBAAuB,EAAE;;AAG/B,SAAgB,YAAkB;AAChC,eAAc;AACd,cAAa;;AAKf,SAA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AAgB,OAAO,OAAO;EAAE,GAAG;EAAM;EAAK,GAAG;AAEvD,KAAI,OAAO,SAAS,WAIlB,QAAO,EAFS,oBAAoB,KAAK,EAClB,aAAa,SAAY;EAAE,GAAG;EAAc;EAAU,GAAG,aAC/C;CAInC,MAAM,aAAa,aAAa,SAAY,EAAE,GAAG,MAAM,QAAQ,SAAS,GAAG,WAAW,CAAC,SAAS;AAGhG,KAAI,OAAO,SAAS,UAAU;AAC5B,MAAI,aAAa,cAAc,QAAW;AACxC,gBAAa,QAAQ,aAAa;AAClC,UAAO,aAAa;;AAEtB,MAAI,aAAa,YAAY,QAAW;AACtC,gBAAa,MAAM,aAAa;AAChC,UAAO,aAAa;;;AAIxB,QAAO,EAAE,MAAM,cAAc,GAAI,WAA4B;;AAG/D,MAAa,OAAO"}
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","names":[],"sources":["../src/jsx-runtime.ts"],"sourcesContent":["/**\n * Compat JSX runtime for React compatibility mode.\n *\n * When `jsxImportSource` is set to `@pyreon/react-compat` (via the vite plugin's\n * `compat: \"react\"` option), OXC rewrites JSX to import from this file:\n * <div className=\"x\" /> → jsx(\"div\", { className: \"x\" })\n *\n * For component VNodes, we wrap the component function so it returns a reactive\n * accessor — enabling React-style re-renders on state change while Pyreon's\n * existing renderer handles all DOM work.\n */\n\nimport type { ComponentFn, Props, VNode, VNodeChild } from '@pyreon/core'\nimport { Fragment, h, onUnmount } from '@pyreon/core'\nimport { signal } from '@pyreon/reactivity'\n\nexport { Fragment }\n\n// ─── Render context (used by hooks) ──────────────────────────────────────────\n\nexport interface RenderContext {\n hooks: unknown[]\n scheduleRerender: () => void\n /** Insertion effect entries pending execution before layout effects */\n pendingInsertionEffects: EffectEntry[]\n /** Effect entries pending execution after render */\n pendingEffects: EffectEntry[]\n /** Layout effect entries pending execution after render */\n pendingLayoutEffects: EffectEntry[]\n /** Set to true when the component is unmounted */\n unmounted: boolean\n /** Hook count from the previous render (dev-mode ordering guard) */\n _hookCount?: number\n}\n\nexport interface EffectEntry {\n fn: () => (() => void) | void\n deps: unknown[] | undefined\n cleanup: (() => void) | undefined\n}\n\nlet _currentCtx: RenderContext | null = null\nlet _hookIndex = 0\nlet _expectedHookCount = -1\n\nexport function getCurrentCtx(): RenderContext | null {\n return _currentCtx\n}\n\nexport function getHookIndex(): number {\n return _hookIndex++\n}\n\nexport function beginRender(ctx: RenderContext): void {\n _currentCtx = ctx\n _hookIndex = 0\n ctx.pendingInsertionEffects = []\n ctx.pendingEffects = []\n ctx.pendingLayoutEffects = []\n\n // On re-renders, remember the hook count from last render\n if (ctx._hookCount !== undefined) {\n _expectedHookCount = ctx._hookCount\n } else {\n _expectedHookCount = -1\n }\n}\n\nexport function endRender(): void {\n if (_currentCtx) {\n // Dev-mode: check hook count matches expected\n if (\n (import.meta as { env?: { DEV?: boolean } }).env?.DEV &&\n _expectedHookCount !== -1 &&\n _hookIndex !== _expectedHookCount\n ) {\n console.error(\n `[Pyreon] Hook count changed between renders (expected ${_expectedHookCount}, got ${_hookIndex}). ` +\n `This usually means a hook is called conditionally. Hooks must be called in the same order every render.`,\n )\n }\n _currentCtx._hookCount = _hookIndex\n }\n _currentCtx = null\n _hookIndex = 0\n}\n\n// ─── Effect runners ──────────────────────────────────────────────────────────\n\nfunction runLayoutEffects(entries: EffectEntry[]): void {\n for (const entry of entries) {\n if (entry.cleanup) entry.cleanup()\n const cleanup = entry.fn()\n entry.cleanup = typeof cleanup === 'function' ? cleanup : undefined\n }\n}\n\nfunction scheduleEffects(ctx: RenderContext, entries: EffectEntry[]): void {\n if (entries.length === 0) return\n queueMicrotask(() => {\n for (const entry of entries) {\n if (ctx.unmounted) return\n if (entry.cleanup) entry.cleanup()\n const cleanup = entry.fn()\n entry.cleanup = typeof cleanup === 'function' ? cleanup : undefined\n }\n })\n}\n\n// ─── Component wrapping ──────────────────────────────────────────────────────\n\nconst _wrapperCache = new WeakMap<Function, ComponentFn>()\n\nfunction wrapCompatComponent(reactComponent: Function): ComponentFn {\n let wrapped = _wrapperCache.get(reactComponent)\n if (wrapped) return wrapped\n\n // The wrapper returns a reactive accessor (() => VNodeChild) which Pyreon's\n // mountChild treats as a reactive expression via mountReactive.\n wrapped = ((props: Props) => {\n const ctx: RenderContext = {\n hooks: [],\n scheduleRerender: () => {\n // Will be replaced below after version signal is created\n },\n pendingInsertionEffects: [],\n pendingEffects: [],\n pendingLayoutEffects: [],\n unmounted: false,\n }\n\n const version = signal(0)\n let updateScheduled = false\n\n ctx.scheduleRerender = () => {\n if (ctx.unmounted || updateScheduled) return\n updateScheduled = true\n queueMicrotask(() => {\n updateScheduled = false\n if (!ctx.unmounted) version.set(version.peek() + 1)\n })\n }\n\n // Register cleanup for all hooks on unmount\n onUnmount(() => {\n ctx.unmounted = true\n for (const hook of ctx.hooks) {\n if (hook && typeof hook === 'object' && 'cleanup' in hook) {\n const entry = hook as EffectEntry\n if (typeof entry.cleanup === 'function') entry.cleanup()\n }\n if (hook && typeof hook === 'object' && 'unsubscribe' in hook) {\n const sub = hook as { unsubscribe?: () => void }\n if (typeof sub.unsubscribe === 'function') sub.unsubscribe()\n }\n if (hook && typeof hook === 'object' && '_contextUnsub' in hook) {\n const ctxHook = hook as { _contextUnsub?: () => void }\n if (typeof ctxHook._contextUnsub === 'function') ctxHook._contextUnsub()\n }\n }\n })\n\n // Return reactive accessor — Pyreon's mountChild calls mountReactive\n return () => {\n version() // tracked read — triggers re-execution when state changes\n beginRender(ctx)\n const result = (reactComponent as ComponentFn)(props)\n const insertionEffects = ctx.pendingInsertionEffects\n const layoutEffects = ctx.pendingLayoutEffects\n const effects = ctx.pendingEffects\n endRender()\n\n // Run in React's order: insertion → layout → passive\n runLayoutEffects(insertionEffects)\n runLayoutEffects(layoutEffects)\n scheduleEffects(ctx, effects)\n\n return result\n }\n }) as unknown as ComponentFn\n\n _wrapperCache.set(reactComponent, wrapped)\n return wrapped\n}\n\n// ─── JSX functions ───────────────────────────────────────────────────────────\n\nexport function jsx(\n type: string | ComponentFn | symbol,\n props: Props & { children?: VNodeChild | VNodeChild[] },\n key?: string | number | null,\n): VNode {\n const { children, ...rest } = props\n const propsWithKey = (key != null ? { ...rest, key } : rest) as Props\n\n if (typeof type === 'function') {\n const componentProps = children !== undefined ? { ...propsWithKey, children } : propsWithKey\n // Native Pyreon components (e.g. context Provider) skip compat wrapping\n const NATIVE = Symbol.for('pyreon:native-compat')\n if ((type as unknown as Record<symbol, boolean>)[NATIVE]) {\n return h(type as ComponentFn, componentProps)\n }\n // Wrap React-style component for re-render support\n const wrapped = wrapCompatComponent(type)\n return h(wrapped, componentProps)\n }\n\n // DOM element or symbol (Fragment): children go in vnode.children\n const childArray = children === undefined ? [] : Array.isArray(children) ? children : [children]\n\n // Map React-style attributes to standard HTML attributes\n if (typeof type === 'string') {\n if (propsWithKey.className !== undefined) {\n propsWithKey.class = propsWithKey.className\n delete propsWithKey.className\n }\n if (propsWithKey.htmlFor !== undefined) {\n propsWithKey.for = propsWithKey.htmlFor\n delete propsWithKey.htmlFor\n }\n\n // React's onChange fires on every keystroke for form elements (like onInput)\n if (\n (type === 'input' || type === 'textarea' || type === 'select') &&\n propsWithKey.onChange !== undefined\n ) {\n if (propsWithKey.onInput === undefined) {\n propsWithKey.onInput = propsWithKey.onChange\n }\n delete propsWithKey.onChange\n }\n\n // autoFocus → autofocus\n if (propsWithKey.autoFocus !== undefined) {\n propsWithKey.autofocus = propsWithKey.autoFocus\n delete propsWithKey.autoFocus\n }\n\n // defaultValue / defaultChecked → value / checked when no controlled value\n if (type === 'input' || type === 'textarea') {\n if (propsWithKey.defaultValue !== undefined && propsWithKey.value === undefined) {\n propsWithKey.value = propsWithKey.defaultValue\n delete propsWithKey.defaultValue\n }\n if (propsWithKey.defaultChecked !== undefined && propsWithKey.checked === undefined) {\n propsWithKey.checked = propsWithKey.defaultChecked\n delete propsWithKey.defaultChecked\n }\n }\n\n // Strip React-only props that have no DOM equivalent\n delete propsWithKey.suppressHydrationWarning\n delete propsWithKey.suppressContentEditableW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KADU,OAAO,IAAI,uBAAuB,EAE/C,QAAO,EAAE,MAAqB,eAAe;AAI/C,SAAO,EADS,oBAAoB,KAAK,EACvB,eAAe;;CAInC,MAAM,aAAa,aAAa,SAAY,EAAE,GAAG,MAAM,QAAQ,SAAS,GAAG,WAAW,CAAC,SAAS;AAGhG,KAAI,OAAO,SAAS,UAAU;AAC5B,MAAI,aAAa,cAAc,QAAW;AACxC,gBAAa,QAAQ,aAAa;AAClC,UAAO,aAAa;;AAEtB,MAAI,aAAa,YAAY,QAAW;AACtC,gBAAa,MAAM,aAAa;AAChC,UAAO,aAAa;;AAItB,OACG,SAAS,WAAW,SAAS,cAAc,SAAS,aACrD,aAAa,aAAa,QAC1B;AACA,OAAI,aAAa,YAAY,OAC3B,cAAa,UAAU,aAAa;AAEtC,UAAO,aAAa;;AAItB,MAAI,aAAa,cAAc,QAAW;AACxC,gBAAa,YAAY,aAAa;AACtC,UAAO,aAAa;;AAItB,MAAI,SAAS,WAAW,SAAS,YAAY;AAC3C,OAAI,aAAa,iBAAiB,UAAa,aAAa,UAAU,QAAW;AAC/E,iBAAa,QAAQ,aAAa;AAClC,WAAO,aAAa;;AAEtB,OAAI,aAAa,mBAAmB,UAAa,aAAa,YAAY,QAAW;AACnF,iBAAa,UAAU,aAAa;AACpC,WAAO,aAAa;;;AAKxB,SAAO,aAAa;AACpB,SAAO,aAAa;;AAGtB,QAAO,EAAE,MAAM,cAAc,GAAI,WAA4B;;AAG/D,MAAa,OAAO"}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorBoundary, Fragment, Props, Suspense, VNode, VNode as
|
|
1
|
+
import { CSSProperties, Context, ErrorBoundary, Fragment, Props, Suspense, VNode, VNode as VNode$1, VNodeChild, VNodeChild as VNodeChild$1, createRef, h, h as createElement, lazy } from "@pyreon/core";
|
|
2
2
|
import { batch } from "@pyreon/reactivity";
|
|
3
3
|
|
|
4
4
|
//#region src/index.d.ts
|
|
@@ -9,8 +9,9 @@ import { batch } from "@pyreon/reactivity";
|
|
|
9
9
|
declare function useState<T>(initial: T | (() => T)): [T, (v: T | ((prev: T) => T)) => void];
|
|
10
10
|
/**
|
|
11
11
|
* React-compatible `useReducer` — returns `[state, dispatch]`.
|
|
12
|
+
* Supports the 3-argument form: `useReducer(reducer, initialArg, init)`.
|
|
12
13
|
*/
|
|
13
|
-
declare function useReducer<S, A>(reducer: (state: S, action: A) => S,
|
|
14
|
+
declare function useReducer<S, A>(reducer: (state: S, action: A) => S, initialArg: S | (() => S), init?: (arg: S) => S): [S, (action: A) => void];
|
|
14
15
|
/**
|
|
15
16
|
* React-compatible `useEffect` — runs after render when deps change.
|
|
16
17
|
* Returns cleanup on unmount and before re-running.
|
|
@@ -20,6 +21,11 @@ declare function useEffect(fn: () => (() => void) | void, deps?: unknown[]): voi
|
|
|
20
21
|
* React-compatible `useLayoutEffect` — runs synchronously after DOM mutations.
|
|
21
22
|
*/
|
|
22
23
|
declare function useLayoutEffect(fn: () => (() => void) | void, deps?: unknown[]): void;
|
|
24
|
+
/**
|
|
25
|
+
* React-compatible `useInsertionEffect` — runs synchronously before layout effects.
|
|
26
|
+
* Intended for CSS-in-JS libraries to inject styles before DOM reads.
|
|
27
|
+
*/
|
|
28
|
+
declare function useInsertionEffect(fn: () => (() => void) | void, deps?: unknown[]): void;
|
|
23
29
|
/**
|
|
24
30
|
* React-compatible `useMemo` — returns the cached value, recomputed when deps change.
|
|
25
31
|
*/
|
|
@@ -34,6 +40,48 @@ declare function useCallback<T extends (...args: never[]) => unknown>(fn: T, dep
|
|
|
34
40
|
declare function useRef<T>(initial?: T): {
|
|
35
41
|
current: T | null;
|
|
36
42
|
};
|
|
43
|
+
declare const COMPAT_CTX: unique symbol;
|
|
44
|
+
/**
|
|
45
|
+
* Compat-specific context with subscriber notification and tree-scoped nesting.
|
|
46
|
+
*
|
|
47
|
+
* Uses Pyreon's native context stack for tree-scoped Provider nesting (inner
|
|
48
|
+
* Providers override outer ones for their subtree), with a subscriber set
|
|
49
|
+
* layered on top for React-style consumer re-rendering.
|
|
50
|
+
*/
|
|
51
|
+
interface CompatContext<T> {
|
|
52
|
+
/** Brand marker so `useContext` can distinguish compat contexts */
|
|
53
|
+
readonly [COMPAT_CTX_BRAND]: true;
|
|
54
|
+
/** Default value when no Provider is mounted */
|
|
55
|
+
_defaultValue: T;
|
|
56
|
+
/** Pyreon native context for tree-scoped value+subscriber storage */
|
|
57
|
+
_pyreonCtx: Context<{
|
|
58
|
+
value: T;
|
|
59
|
+
subscribers: Set<() => void>;
|
|
60
|
+
}>;
|
|
61
|
+
/** Subscribers at the default (no-Provider) level */
|
|
62
|
+
_subscribers: Set<() => void>;
|
|
63
|
+
/** React-compatible Provider component (native Pyreon, NOT compat-wrapped).
|
|
64
|
+
* Returns a reactive accessor `() => VNodeChild` for Pyreon's renderer. */
|
|
65
|
+
Provider: (props: Record<string, unknown>) => unknown;
|
|
66
|
+
}
|
|
67
|
+
declare const COMPAT_CTX_BRAND: typeof COMPAT_CTX;
|
|
68
|
+
/**
|
|
69
|
+
* React-compatible `createContext` — creates a context with a Provider that
|
|
70
|
+
* supports nested Providers (inner overrides outer for its subtree) and
|
|
71
|
+
* notifies all `useContext` consumers when its value changes.
|
|
72
|
+
*/
|
|
73
|
+
declare function createContext<T>(defaultValue: T): CompatContext<T>;
|
|
74
|
+
/**
|
|
75
|
+
* React-compatible `useContext` — reads the current context value and
|
|
76
|
+
* subscribes the calling component to future value changes.
|
|
77
|
+
*
|
|
78
|
+
* Reads from Pyreon's tree-scoped context stack (correct nesting) and
|
|
79
|
+
* subscribes to the nearest Provider's subscriber set for re-rendering.
|
|
80
|
+
*
|
|
81
|
+
* Works with both compat contexts (from this module's `createContext`) and
|
|
82
|
+
* Pyreon native contexts (from `@pyreon/core`).
|
|
83
|
+
*/
|
|
84
|
+
declare function useContext<T>(context: CompatContext<T> | Context<T>): T;
|
|
37
85
|
/**
|
|
38
86
|
* React-compatible `useId` — returns a stable unique string per hook call.
|
|
39
87
|
*/
|
|
@@ -41,6 +89,9 @@ declare function useId(): string;
|
|
|
41
89
|
/**
|
|
42
90
|
* React-compatible `memo` — wraps a component to skip re-render when props
|
|
43
91
|
* are shallowly equal.
|
|
92
|
+
*
|
|
93
|
+
* Each component INSTANCE gets its own props/result cache via a hook slot,
|
|
94
|
+
* so two `<MemoComp />` usages don't share memoization state.
|
|
44
95
|
*/
|
|
45
96
|
declare function memo<P extends Record<string, unknown>>(component: (props: P) => VNodeChild$1, areEqual?: (prevProps: P, nextProps: P) => boolean): (props: P) => VNodeChild$1;
|
|
46
97
|
/**
|
|
@@ -76,7 +127,7 @@ declare function forwardRef<P extends Record<string, unknown>>(render: (props: P
|
|
|
76
127
|
/**
|
|
77
128
|
* React-compatible `cloneElement` — creates a new VNode with merged props.
|
|
78
129
|
*/
|
|
79
|
-
declare function cloneElement(element: VNode, props?: Record<string, unknown>, ...children: VNodeChild$1[]): VNode;
|
|
130
|
+
declare function cloneElement(element: VNode$1, props?: Record<string, unknown>, ...children: VNodeChild$1[]): VNode$1;
|
|
80
131
|
/**
|
|
81
132
|
* React-compatible `Children` utilities for working with VNode children.
|
|
82
133
|
*/
|
|
@@ -102,6 +153,156 @@ declare const Children: {
|
|
|
102
153
|
*/
|
|
103
154
|
only(children: VNodeChild$1 | VNodeChild$1[]): VNodeChild$1;
|
|
104
155
|
};
|
|
156
|
+
/**
|
|
157
|
+
* React-compatible `useSyncExternalStore` — subscribes to an external store.
|
|
158
|
+
* Re-subscribes automatically when the `subscribe` function identity changes.
|
|
159
|
+
*/
|
|
160
|
+
declare function useSyncExternalStore<T>(subscribe: (onStoreChange: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T): T;
|
|
161
|
+
/**
|
|
162
|
+
* React-compatible `use` — reads a Context or suspends on a Promise.
|
|
163
|
+
* Can be called conditionally (unlike other hooks).
|
|
164
|
+
*
|
|
165
|
+
* IMPORTANT: Promises must have a stable identity across renders.
|
|
166
|
+
* Create promises outside the component or memoize them. Calling
|
|
167
|
+
* `use(fetch('/api'))` creates a new promise each render and will
|
|
168
|
+
* cause infinite suspension.
|
|
169
|
+
*/
|
|
170
|
+
declare function use<T>(resource: Context<T> | CompatContext<T> | Promise<T>): T;
|
|
171
|
+
/**
|
|
172
|
+
* React-compatible `useActionState` — manages async action state with pending indicator.
|
|
173
|
+
*/
|
|
174
|
+
declare function useActionState<S, P>(action: (state: S, payload: P) => S | Promise<S>, initialState: S): [S, (payload: P) => void, boolean];
|
|
175
|
+
/**
|
|
176
|
+
* React-compatible `startTransition` — runs the callback synchronously.
|
|
177
|
+
* No concurrent mode in Pyreon, so transitions are immediate.
|
|
178
|
+
*/
|
|
179
|
+
declare function startTransition(fn: () => void): void;
|
|
180
|
+
/**
|
|
181
|
+
* React-compatible `isValidElement` — checks if a value is a VNode.
|
|
182
|
+
*/
|
|
183
|
+
declare function isValidElement(value: unknown): value is VNode$1;
|
|
184
|
+
/**
|
|
185
|
+
* React-compatible `useDebugValue` — no-op in Pyreon (no React DevTools integration).
|
|
186
|
+
*/
|
|
187
|
+
declare function useDebugValue<T>(_value: T, _format?: (v: T) => unknown): void;
|
|
188
|
+
/**
|
|
189
|
+
* React-compatible `flushSync` — runs the callback synchronously.
|
|
190
|
+
*
|
|
191
|
+
* BEHAVIORAL DIFFERENCE: In Pyreon's compat model, state updates are
|
|
192
|
+
* batched via microtask. flushSync runs the callback and returns its
|
|
193
|
+
* result, but the DOM updates triggered by state changes inside the
|
|
194
|
+
* callback still fire asynchronously. For DOM measurement after state
|
|
195
|
+
* updates, use `await act(() => setState(...))` in tests, or
|
|
196
|
+
* `requestAnimationFrame` in production code.
|
|
197
|
+
*/
|
|
198
|
+
declare function flushSync<T>(fn: () => T): T;
|
|
199
|
+
/**
|
|
200
|
+
* React-compatible `act` — flushes pending microtasks for testing.
|
|
201
|
+
*/
|
|
202
|
+
declare function act(fn: () => void | Promise<void>): Promise<void>;
|
|
203
|
+
declare const version = "19.0.0-pyreon";
|
|
204
|
+
/**
|
|
205
|
+
* React-compatible `StrictMode` — pass-through in Pyreon (no double-invoke behavior).
|
|
206
|
+
*/
|
|
207
|
+
declare function StrictMode(props: {
|
|
208
|
+
children?: VNodeChild$1;
|
|
209
|
+
}): VNodeChild$1;
|
|
210
|
+
/**
|
|
211
|
+
* React-compatible `Profiler` — pass-through in Pyreon (no profiling integration).
|
|
212
|
+
*/
|
|
213
|
+
declare function Profiler(props: {
|
|
214
|
+
id: string;
|
|
215
|
+
onRender?: (...args: unknown[]) => void;
|
|
216
|
+
children?: VNodeChild$1;
|
|
217
|
+
}): VNodeChild$1;
|
|
218
|
+
/**
|
|
219
|
+
* React-compatible `Component` class stub.
|
|
220
|
+
* Class components are not fully supported — use function components with hooks.
|
|
221
|
+
*/
|
|
222
|
+
declare class Component<P = Record<string, unknown>, S = Record<string, unknown>> {
|
|
223
|
+
props: Readonly<P>;
|
|
224
|
+
state: Readonly<S>;
|
|
225
|
+
constructor(props: P);
|
|
226
|
+
setState(_partial: Partial<S> | ((prev: S) => Partial<S>)): void;
|
|
227
|
+
forceUpdate(): void;
|
|
228
|
+
render(): VNodeChild$1;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* React-compatible `PureComponent` class stub.
|
|
232
|
+
*/
|
|
233
|
+
declare class PureComponent<P = Record<string, unknown>, S = Record<string, unknown>> extends Component<P, S> {}
|
|
234
|
+
type FC<P = Record<string, unknown>> = (props: P) => VNodeChild$1;
|
|
235
|
+
type FunctionComponent<P = Record<string, unknown>> = FC<P>;
|
|
236
|
+
type ReactElement = VNode$1;
|
|
237
|
+
type ReactNode = VNodeChild$1;
|
|
238
|
+
type JSXElementConstructor<P> = (props: P) => VNodeChild$1;
|
|
239
|
+
type Dispatch<A> = (action: A) => void;
|
|
240
|
+
type SetStateAction<S> = S | ((prev: S) => S);
|
|
241
|
+
type RefObject<T> = {
|
|
242
|
+
readonly current: T | null;
|
|
243
|
+
};
|
|
244
|
+
type MutableRefObject<T> = {
|
|
245
|
+
current: T;
|
|
246
|
+
};
|
|
247
|
+
type RefCallback<T> = (instance: T | null) => void;
|
|
248
|
+
type ForwardedRef<T> = RefObject<T> | RefCallback<T> | null;
|
|
249
|
+
type PropsWithChildren<P = Record<string, unknown>> = P & {
|
|
250
|
+
children?: ReactNode;
|
|
251
|
+
};
|
|
252
|
+
type PropsWithRef<P> = P & {
|
|
253
|
+
ref?: RefObject<unknown> | RefCallback<unknown> | null;
|
|
254
|
+
};
|
|
255
|
+
type SyntheticEvent<T = Element> = Event & {
|
|
256
|
+
currentTarget: T;
|
|
257
|
+
};
|
|
258
|
+
type ChangeEvent<T = Element> = Event & {
|
|
259
|
+
currentTarget: T;
|
|
260
|
+
target: T;
|
|
261
|
+
};
|
|
262
|
+
type FormEvent<T = Element> = Event & {
|
|
263
|
+
currentTarget: T;
|
|
264
|
+
};
|
|
265
|
+
type MouseEvent<T = Element> = globalThis.MouseEvent & {
|
|
266
|
+
currentTarget: T;
|
|
267
|
+
};
|
|
268
|
+
type KeyboardEvent<T = Element> = globalThis.KeyboardEvent & {
|
|
269
|
+
currentTarget: T;
|
|
270
|
+
};
|
|
271
|
+
type FocusEvent<T = Element> = globalThis.FocusEvent & {
|
|
272
|
+
currentTarget: T;
|
|
273
|
+
};
|
|
274
|
+
type DragEvent<T = Element> = globalThis.DragEvent & {
|
|
275
|
+
currentTarget: T;
|
|
276
|
+
};
|
|
277
|
+
type PointerEvent<T = Element> = globalThis.PointerEvent & {
|
|
278
|
+
currentTarget: T;
|
|
279
|
+
};
|
|
280
|
+
type TouchEvent<T = Element> = globalThis.TouchEvent & {
|
|
281
|
+
currentTarget: T;
|
|
282
|
+
};
|
|
283
|
+
type ClipboardEvent<T = Element> = globalThis.ClipboardEvent & {
|
|
284
|
+
currentTarget: T;
|
|
285
|
+
};
|
|
286
|
+
type AnimationEvent<T = Element> = globalThis.AnimationEvent & {
|
|
287
|
+
currentTarget: T;
|
|
288
|
+
};
|
|
289
|
+
type TransitionEvent<T = Element> = globalThis.TransitionEvent & {
|
|
290
|
+
currentTarget: T;
|
|
291
|
+
};
|
|
292
|
+
type WheelEvent<T = Element> = globalThis.WheelEvent & {
|
|
293
|
+
currentTarget: T;
|
|
294
|
+
};
|
|
295
|
+
type HTMLAttributes<T = HTMLElement> = Record<string, unknown> & {
|
|
296
|
+
ref?: RefObject<T> | RefCallback<T> | null;
|
|
297
|
+
};
|
|
298
|
+
type InputHTMLAttributes<T = HTMLInputElement> = HTMLAttributes<T>;
|
|
299
|
+
type TextareaHTMLAttributes<T = HTMLTextAreaElement> = HTMLAttributes<T>;
|
|
300
|
+
type SelectHTMLAttributes<T = HTMLSelectElement> = HTMLAttributes<T>;
|
|
301
|
+
type ButtonHTMLAttributes<T = HTMLButtonElement> = HTMLAttributes<T>;
|
|
302
|
+
type AnchorHTMLAttributes<T = HTMLAnchorElement> = HTMLAttributes<T>;
|
|
303
|
+
type FormHTMLAttributes<T = HTMLFormElement> = HTMLAttributes<T>;
|
|
304
|
+
type ImgHTMLAttributes<T = HTMLImageElement> = HTMLAttributes<T>;
|
|
305
|
+
type SVGAttributes<T = SVGElement> = HTMLAttributes<T>;
|
|
105
306
|
//#endregion
|
|
106
|
-
export { Children, ErrorBoundary, Fragment, type Props,
|
|
307
|
+
export { AnchorHTMLAttributes, AnimationEvent, ButtonHTMLAttributes, type CSSProperties, ChangeEvent, Children, ClipboardEvent, CompatContext, Component, type Context, Dispatch, DragEvent, ErrorBoundary, FC, FocusEvent, FormEvent, FormHTMLAttributes, ForwardedRef, Fragment, FunctionComponent, HTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, JSXElementConstructor, KeyboardEvent, MouseEvent, MutableRefObject, PointerEvent, Profiler, type Props, PropsWithChildren, PropsWithRef, PureComponent, ReactElement, ReactNode, RefCallback, RefObject, SVGAttributes, SelectHTMLAttributes, SetStateAction, StrictMode, Suspense, SyntheticEvent, TextareaHTMLAttributes, TouchEvent, TransitionEvent, type VNode, type VNodeChild, WheelEvent, act, batch, cloneElement, createContext, createElement, createPortal, createRef, flushSync, forwardRef, h, isValidElement, lazy, memo, startTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition, version };
|
|
107
308
|
//# sourceMappingURL=index2.d.ts.map
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index2.d.ts","names":[],"sources":["../../../src/index.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"index2.d.ts","names":[],"sources":["../../../src/index.ts"],"mappings":";;;;;;;;iBAsDgB,QAAA,GAAA,CAAY,OAAA,EAAS,CAAA,UAAW,CAAA,KAAM,CAAA,GAAI,CAAA,EAAG,CAAA,KAAM,IAAA,EAAM,CAAA,KAAM,CAAA;;;;;iBA6B/D,UAAA,MAAA,CACd,OAAA,GAAU,KAAA,EAAO,CAAA,EAAG,MAAA,EAAQ,CAAA,KAAM,CAAA,EAClC,UAAA,EAAY,CAAA,UAAW,CAAA,GACvB,IAAA,IAAQ,GAAA,EAAK,CAAA,KAAM,CAAA,IACjB,CAAA,GAAI,MAAA,EAAQ,CAAA;;;;;iBAoCA,SAAA,CAAU,EAAA,6BAA+B,IAAA;;;;iBAsBzC,eAAA,CAAgB,EAAA,6BAA+B,IAAA;;;;;iBAsB/C,kBAAA,CAAmB,EAAA,6BAA+B,IAAA;;;;iBAuBlD,OAAA,GAAA,CAAW,EAAA,QAAU,CAAA,EAAG,IAAA,cAAkB,CAAA;;;;iBAqB1C,WAAA,eAA0B,IAAA,sBAAA,CAA2B,EAAA,EAAI,CAAA,EAAG,IAAA,cAAkB,CAAA;;;;iBAS9E,MAAA,GAAA,CAAU,OAAA,GAAU,CAAA;EAAM,OAAA,EAAS,CAAA;AAAA;AAAA,cAc7C,UAAA;;;;;AA/GN;;;UAwHiB,aAAA;EAxHwD;EAAA,UA0H7D,gBAA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AA,KAAwB,gBAAA,IAAoB,cAAA,CAAe,CAAA;AAAA,KAC3D,sBAAA,KAA2B,mBAAA,IAAuB,cAAA,CAAe,CAAA;AAAA,KACjE,oBAAA,KAAyB,iBAAA,IAAqB,cAAA,CAAe,CAAA;AAAA,KAC7D,oBAAA,KAAyB,iBAAA,IAAqB,cAAA,CAAe,CAAA;AAAA,KAC7D,oBAAA,KAAyB,iBAAA,IAAqB,cAAA,CAAe,CAAA;AAAA,KAC7D,kBAAA,KAAuB,eAAA,IAAmB,cAAA,CAAe,CAAA;AAAA,KACzD,iBAAA,KAAsB,gBAAA,IAAoB,cAAA,CAAe,CAAA;AAAA,KACzD,aAAA,KAAkB,UAAA,IAAc,cAAA,CAAe,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-runtime2.d.ts","names":[],"sources":["../../../src/jsx-runtime.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"jsx-runtime2.d.ts","names":[],"sources":["../../../src/jsx-runtime.ts"],"mappings":";;;iBA2LgB,GAAA,CACd,IAAA,WAAe,WAAA,WACf,KAAA,EAAO,KAAA;EAAU,QAAA,GAAW,UAAA,GAAa,UAAA;AAAA,GACzC,GAAA,4BACC,KAAA;AAAA,cAmEU,IAAA,SAAI,GAAA"}
|