@pyreon/solid-compat 0.5.5 → 0.5.6

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/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["pyreonSignal","pyreonEffect","pyreonComputed","pyreonCreateSelector"],"sources":["../src/jsx-runtime.ts","../src/index.ts"],"sourcesContent":["/**\n * Compat JSX runtime for SolidJS compatibility mode.\n *\n * When `jsxImportSource` is redirected to `@pyreon/solid-compat` (via the vite\n * plugin's `compat: \"solid\"` option), OXC rewrites JSX to import from this file.\n *\n * For component VNodes, we wrap the component function so it returns a reactive\n * accessor — enabling Solid-style re-renders on state change while Pyreon's\n * existing renderer handles all DOM work.\n *\n * The component body runs inside `runUntracked` to prevent signal reads (from\n * createSignal getters) from being tracked by the reactive accessor. Only the\n * version signal triggers re-renders.\n *\n * ## Child instance preservation\n *\n * When a parent component re-renders, mountReactive does a full teardown+rebuild\n * of the DOM tree. Without preservation, child components get brand new\n * RenderContexts with empty hooks arrays — causing `onMount` and `onCleanup`\n * to fire again, which can trigger infinite re-render loops.\n *\n * To fix this, we store child RenderContexts in the parent's hooks array (indexed\n * by the parent's hook counter). When the child wrapper is called again after a\n * parent re-render, it reuses the existing ctx (preserving hooks state), so\n * hook-indexed guards like `if (idx >= ctx.hooks.length) return` work correctly\n * and lifecycle hooks don't re-fire.\n */\n\nimport type { ComponentFn, Props, VNode, VNodeChild } from \"@pyreon/core\"\nimport {\n ErrorBoundary,\n For,\n Fragment,\n h,\n Match,\n onUnmount,\n Show,\n Suspense,\n Switch,\n} from \"@pyreon/core\"\nimport { runUntracked, 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 /** Callbacks to run on unmount (lifecycle + effect cleanups) */\n unmountCallbacks: (() => void)[]\n}\n\nexport interface EffectEntry {\n // biome-ignore lint/suspicious/noConfusingVoidType: matches Solid's effect signature\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// ─── Child instance preservation ─────────────────────────────────────────────\n\n/** Stored in the parent's hooks array to preserve child state across re-renders */\ninterface ChildInstance {\n ctx: RenderContext\n version: ReturnType<typeof signal<number>>\n updateScheduled: boolean\n}\n\n// Internal prop keys for passing parent context info to child wrappers\nconst _CHILD_INSTANCE = Symbol.for(\"pyreon.childInstance\")\nconst noop = () => {\n /* noop */\n}\n\n// ─── Component wrapping ──────────────────────────────────────────────────────\n\n// biome-ignore lint/complexity/noBannedTypes: Function is needed for generic component wrapping\nconst _wrapperCache = new WeakMap<Function, ComponentFn>()\n\n// Pyreon core components that must NOT be wrapped — they rely on internal reactivity\n// biome-ignore lint/complexity/noBannedTypes: Function is needed for generic component set\nconst _nativeComponents: Set<Function> = new Set([\n Show,\n For,\n Switch,\n Match,\n Suspense,\n ErrorBoundary,\n])\n\n// biome-ignore lint/complexity/noBannedTypes: Function is needed for generic component wrapping\nfunction wrapCompatComponent(solidComponent: Function): ComponentFn {\n if (_nativeComponents.has(solidComponent)) return solidComponent as ComponentFn\n\n let wrapped = _wrapperCache.get(solidComponent)\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 // Check for a preserved child instance from the parent's hooks\n const existing = (props as Record<symbol, unknown>)[_CHILD_INSTANCE] as\n | ChildInstance\n | undefined\n\n const ctx: RenderContext = existing?.ctx ?? {\n hooks: [],\n scheduleRerender: () => {\n // Will be replaced below after version signal is created\n },\n pendingEffects: [],\n pendingLayoutEffects: [],\n unmounted: false,\n unmountCallbacks: [],\n }\n\n // When reusing an existing ctx after parent re-render, reset unmounted flag\n // and clear stale unmount callbacks (they belong to the previous mount cycle)\n if (existing) {\n ctx.unmounted = false\n ctx.unmountCallbacks = []\n }\n\n const version = existing?.version ?? signal(0)\n\n // Use a shared updateScheduled flag (preserved across parent re-renders)\n let updateScheduled = existing?.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 when component unmounts\n onUnmount(() => {\n ctx.unmounted = true\n for (const cb of ctx.unmountCallbacks) cb()\n })\n\n // Strip the internal prop before passing to the component\n const { [_CHILD_INSTANCE]: _stripped, ...cleanProps } = props as Record<\n string | symbol,\n unknown\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 // runUntracked prevents signal reads (from createSignal getters) from\n // being tracked by this accessor — only the version signal should trigger re-renders\n const result = runUntracked(() => (solidComponent as ComponentFn)(cleanProps as 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 // Forward __loading from lazy components so Pyreon's Suspense can detect them\n if (\"__loading\" in solidComponent) {\n ;(wrapped as unknown as Record<string, unknown>).__loading = (\n solidComponent as unknown as Record<string, unknown>\n ).__loading\n }\n\n _wrapperCache.set(solidComponent, wrapped)\n return wrapped\n}\n\n// ─── Child instance lookup ───────────────────────────────────────────────────\n\nfunction createChildInstance(): ChildInstance {\n return {\n ctx: {\n hooks: [],\n scheduleRerender: noop,\n pendingEffects: [],\n pendingLayoutEffects: [],\n unmounted: false,\n unmountCallbacks: [],\n },\n version: signal(0),\n updateScheduled: false,\n }\n}\n\n/**\n * During a parent component render, get or create the child instance at the\n * current hook index. Returns undefined when called outside a component render.\n */\nfunction resolveChildInstance(): ChildInstance | undefined {\n const parentCtx = _currentCtx\n if (!parentCtx) return undefined\n\n const idx = _hookIndex++\n if (idx < parentCtx.hooks.length) {\n return parentCtx.hooks[idx] as ChildInstance\n }\n const instance = createChildInstance()\n parentCtx.hooks[idx] = instance\n return instance\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 if (_nativeComponents.has(type)) {\n const componentProps = children !== undefined ? { ...propsWithKey, children } : propsWithKey\n return h(type as ComponentFn, componentProps)\n }\n\n const wrapped = wrapCompatComponent(type)\n const componentProps =\n children !== undefined ? { ...propsWithKey, children } : { ...propsWithKey }\n\n const childInstance = resolveChildInstance()\n if (childInstance) {\n ;(componentProps as Record<symbol, unknown>)[_CHILD_INSTANCE] = childInstance\n }\n\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 return h(type, propsWithKey, ...(childArray as VNodeChild[]))\n}\n\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n","/**\n * @pyreon/solid-compat\n *\n * Fully SolidJS-compatible API powered by Pyreon's reactive engine.\n *\n * Components re-render on state change via the compat JSX runtime wrapper.\n * Signals use Pyreon's native signal system internally (enabling auto-tracking\n * for createEffect/createMemo), while the component body runs inside\n * `runUntracked` to prevent signal reads from being tracked by the reactive\n * accessor. Only the version signal triggers re-renders.\n *\n * USAGE:\n * import { createSignal, createEffect } from \"solid-js\" // aliased by vite plugin\n */\n\nimport type { ComponentFn, LazyComponent, Props, VNodeChild } from \"@pyreon/core\"\nimport {\n ErrorBoundary,\n For,\n Match,\n createContext as pyreonCreateContext,\n onMount as pyreonOnMount,\n onUnmount as pyreonOnUnmount,\n useContext as pyreonUseContext,\n Show,\n Suspense,\n Switch,\n} from \"@pyreon/core\"\nimport {\n type EffectScope,\n effectScope,\n getCurrentScope,\n batch as pyreonBatch,\n computed as pyreonComputed,\n createSelector as pyreonCreateSelector,\n effect as pyreonEffect,\n signal as pyreonSignal,\n runUntracked,\n setCurrentScope,\n} from \"@pyreon/reactivity\"\nimport { getCurrentCtx, getHookIndex } from \"./jsx-runtime\"\n\n// ─── createSignal ────────────────────────────────────────────────────────────\n\nexport type SignalGetter<T> = () => T\nexport type SignalSetter<T> = (v: T | ((prev: T) => T)) => void\n\nexport function createSignal<T>(initialValue: T): [SignalGetter<T>, SignalSetter<T>] {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx >= ctx.hooks.length) {\n ctx.hooks[idx] = pyreonSignal<T>(initialValue)\n }\n const s = ctx.hooks[idx] as ReturnType<typeof pyreonSignal<T>>\n const { scheduleRerender } = ctx\n\n const getter: SignalGetter<T> = () => s()\n const setter: SignalSetter<T> = (v) => {\n if (typeof v === \"function\") {\n s.update(v as (prev: T) => T)\n } else {\n s.set(v)\n }\n scheduleRerender()\n }\n return [getter, setter]\n }\n\n // Outside component — plain Pyreon signal\n const s = pyreonSignal<T>(initialValue)\n const getter: SignalGetter<T> = () => s()\n const setter: SignalSetter<T> = (v) => {\n if (typeof v === \"function\") {\n s.update(v as (prev: T) => T)\n } else {\n s.set(v)\n }\n }\n return [getter, setter]\n}\n\n// ─── createEffect ────────────────────────────────────────────────────────────\n\n/**\n * Solid-compatible `createEffect` — creates a reactive side effect.\n *\n * In component context: hook-indexed, only created on first render. The effect\n * uses Pyreon's native tracking so signal reads are automatically tracked.\n * A re-entrance guard prevents infinite loops from signal writes inside\n * the effect.\n */\nexport function createEffect(fn: () => void): void {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return // Already registered on first render\n\n let running = false\n const e = pyreonEffect(() => {\n if (running) return\n running = true\n try {\n fn()\n } finally {\n running = false\n }\n })\n const stop = () => e.dispose()\n ctx.hooks[idx] = stop\n ctx.unmountCallbacks.push(stop)\n return\n }\n\n // Outside component\n pyreonEffect(fn)\n}\n\n// ─── createRenderEffect ──────────────────────────────────────────────────────\n\n/**\n * Solid-compatible `createRenderEffect` — same as createEffect.\n * In Solid, this runs during the render phase; here it runs as a Pyreon effect.\n */\nexport function createRenderEffect(fn: () => void): void {\n createEffect(fn)\n}\n\n// ─── createComputed (legacy Solid API) ───────────────────────────────────────\n\nexport { createEffect as createComputed }\n\n// ─── createMemo ──────────────────────────────────────────────────────────────\n\n/**\n * Solid-compatible `createMemo` — derives a value from reactive sources.\n *\n * In component context: hook-indexed, only created on first render.\n * Uses Pyreon's native computed for auto-tracking.\n */\nexport function createMemo<T>(fn: () => T): () => T {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx >= ctx.hooks.length) {\n ctx.hooks[idx] = pyreonComputed(fn)\n }\n const c = ctx.hooks[idx] as ReturnType<typeof pyreonComputed<T>>\n return () => c()\n }\n\n // Outside component\n const c = pyreonComputed(fn)\n return () => c()\n}\n\n// ─── createRoot ──────────────────────────────────────────────────────────────\n\nexport function createRoot<T>(fn: (dispose: () => void) => T): T {\n const scope = effectScope()\n const prev = getCurrentScope()\n setCurrentScope(scope)\n try {\n return fn(() => scope.stop())\n } finally {\n setCurrentScope(prev)\n }\n}\n\n// ─── on ──────────────────────────────────────────────────────────────────────\n\ntype AccessorArray = readonly (() => unknown)[]\ntype OnEffectFunction<D, V> = (input: D, prevInput: D | undefined, prev: V | undefined) => V\n\nexport function on<S extends (() => unknown) | AccessorArray, V>(\n deps: S,\n fn: OnEffectFunction<\n S extends () => infer R ? R : S extends readonly (() => infer R)[] ? R[] : never,\n V\n >,\n): () => V | undefined {\n type D = S extends () => infer R ? R : S extends readonly (() => infer R)[] ? R[] : never\n\n let prevInput: D | undefined\n let prevValue: V | undefined\n let initialized = false\n\n return () => {\n // Read dependencies to register tracking\n const input: D = (\n Array.isArray(deps) ? (deps as (() => unknown)[]).map((d) => d()) : (deps as () => unknown)()\n ) as D\n\n if (!initialized) {\n initialized = true\n prevValue = fn(input, undefined, undefined)\n prevInput = input\n return prevValue\n }\n\n const result = runUntracked(() => fn(input, prevInput, prevValue))\n prevInput = input\n prevValue = result\n return result\n }\n}\n\n// ─── batch ───────────────────────────────────────────────────────────────────\n\nexport { pyreonBatch as batch }\n\n// ─── untrack ─────────────────────────────────────────────────────────────────\n\nexport { runUntracked as untrack }\n\n// ─── onMount / onCleanup ─────────────────────────────────────────────────────\n\n/**\n * Solid-compatible `onMount` — runs once after the component's first render.\n */\ntype CleanupFn = () => void\nexport function onMount(fn: () => CleanupFn | undefined): void {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx >= ctx.hooks.length) {\n ctx.hooks[idx] = true\n ctx.pendingEffects.push({\n fn: () => {\n fn()\n return undefined\n },\n deps: undefined,\n cleanup: undefined,\n })\n }\n return\n }\n\n // Outside component\n pyreonOnMount(fn)\n}\n\n/**\n * Solid-compatible `onCleanup` — registers a callback to run when the component unmounts.\n */\nexport function onCleanup(fn: () => void): void {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx >= ctx.hooks.length) {\n ctx.hooks[idx] = true\n ctx.unmountCallbacks.push(fn)\n }\n return\n }\n\n // Outside component\n pyreonOnUnmount(fn)\n}\n\n// ─── createSelector ──────────────────────────────────────────────────────────\n\nexport function createSelector<T>(source: () => T): (key: T) => boolean {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx >= ctx.hooks.length) {\n ctx.hooks[idx] = pyreonCreateSelector(source)\n }\n return ctx.hooks[idx] as (key: T) => boolean\n }\n\n return pyreonCreateSelector(source)\n}\n\n// ─── mergeProps ──────────────────────────────────────────────────────────────\n\ntype UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (\n k: infer I,\n) => void\n ? I\n : never\n\ntype MergeProps<T extends object[]> = UnionToIntersection<T[number]>\n\nexport function mergeProps<T extends object[]>(...sources: [...T]): MergeProps<T> {\n const target = {} as Record<PropertyKey, unknown>\n for (const source of sources) {\n const descriptors = Object.getOwnPropertyDescriptors(source)\n for (const key of Reflect.ownKeys(descriptors)) {\n const desc = descriptors[key as string]\n if (!desc) continue\n // Preserve getters for reactivity\n if (desc.get) {\n Object.defineProperty(target, key, {\n get: desc.get,\n enumerable: true,\n configurable: true,\n })\n } else {\n Object.defineProperty(target, key, {\n value: desc.value,\n writable: true,\n enumerable: true,\n configurable: true,\n })\n }\n }\n }\n return target as MergeProps<T>\n}\n\n// ─── splitProps ──────────────────────────────────────────────────────────────\n\nexport function splitProps<T extends Record<string, unknown>, K extends (keyof T)[]>(\n props: T,\n ...keys: K\n): [Pick<T, K[number]>, Omit<T, K[number]>] {\n const picked = {} as Pick<T, K[number]>\n const rest = {} as Record<string, unknown>\n const keySet = new Set<string>(keys.flat() as string[])\n\n const descriptors = Object.getOwnPropertyDescriptors(props)\n for (const key of Reflect.ownKeys(descriptors)) {\n const desc = descriptors[key as string]\n if (!desc) continue\n const target = typeof key === \"string\" && keySet.has(key) ? picked : rest\n if (desc.get) {\n Object.defineProperty(target, key, {\n get: desc.get,\n enumerable: true,\n configurable: true,\n })\n } else {\n Object.defineProperty(target, key, {\n value: desc.value,\n writable: true,\n enumerable: true,\n configurable: true,\n })\n }\n }\n\n return [picked, rest as Omit<T, K[number]>]\n}\n\n// ─── children ────────────────────────────────────────────────────────────────\n\nexport function children(fn: () => VNodeChild): () => VNodeChild {\n const memo = createMemo(() => {\n const result = fn()\n // Resolve function children (reactive getters)\n if (typeof result === \"function\") return (result as () => VNodeChild)()\n return result\n })\n return memo\n}\n\n// ─── lazy ────────────────────────────────────────────────────────────────────\n\nexport function lazy<P extends Props>(\n loader: () => Promise<{ default: ComponentFn<P> }>,\n): LazyComponent<P> & { preload: () => Promise<{ default: ComponentFn<P> }> } {\n const loaded = pyreonSignal<ComponentFn<P> | null>(null)\n const error = pyreonSignal<Error | null>(null)\n let promise: Promise<{ default: ComponentFn<P> }> | null = null\n\n const load = () => {\n if (!promise) {\n promise = loader()\n .then((mod) => {\n loaded.set(mod.default)\n return mod\n })\n .catch((err) => {\n const e = err instanceof Error ? err : new Error(String(err))\n error.set(e)\n promise = null\n throw e\n })\n }\n return promise\n }\n\n // Uses Pyreon's __loading protocol — Suspense checks this to show fallback.\n // __loading() triggers load() on first call so loading starts when Suspense\n // first encounters the component (not at module load time, not on first render).\n const LazyComponent = ((props: P) => {\n const err = error()\n if (err) throw err\n const comp = loaded()\n if (!comp) return null\n return comp(props)\n }) as LazyComponent<P> & { preload: () => Promise<{ default: ComponentFn<P> }> }\n\n LazyComponent.__loading = () => {\n const isLoading = loaded() === null && error() === null\n if (isLoading) load()\n return isLoading\n }\n LazyComponent.preload = load\n\n return LazyComponent\n}\n\n// ─── createContext / useContext ───────────────────────────────────────────────\n\nexport { pyreonCreateContext as createContext, pyreonUseContext as useContext }\n\n// ─── getOwner / runWithOwner ─────────────────────────────────────────────────\n\nexport function getOwner(): EffectScope | null {\n return getCurrentScope()\n}\n\nexport function runWithOwner<T>(owner: EffectScope | null, fn: () => T): T {\n const prev = getCurrentScope()\n setCurrentScope(owner)\n try {\n return fn()\n } finally {\n setCurrentScope(prev)\n }\n}\n\n// ─── Re-exports from @pyreon/core ──────────────────────────────────────────────\n\nexport { ErrorBoundary, For, Match, Show, Suspense, Switch }\n"],"mappings":";;;;AAkEA,IAAI,cAAoC;AACxC,IAAI,aAAa;AAEjB,SAAgB,gBAAsC;AACpD,QAAO;;AAGT,SAAgB,eAAuB;AACrC,QAAO;;AA+CT,MAAM,kBAAkB,OAAO,IAAI,uBAAuB;;;;AC1E1D,SAAgB,aAAgB,cAAqD;CACnF,MAAM,MAAM,eAAe;AAC3B,KAAI,KAAK;EACP,MAAM,MAAM,cAAc;AAC1B,MAAI,OAAO,IAAI,MAAM,OACnB,KAAI,MAAM,OAAOA,OAAgB,aAAa;EAEhD,MAAM,IAAI,IAAI,MAAM;EACpB,MAAM,EAAE,qBAAqB;EAE7B,MAAM,eAAgC,GAAG;EACzC,MAAM,UAA2B,MAAM;AACrC,OAAI,OAAO,MAAM,WACf,GAAE,OAAO,EAAoB;OAE7B,GAAE,IAAI,EAAE;AAEV,qBAAkB;;AAEpB,SAAO,CAAC,QAAQ,OAAO;;CAIzB,MAAM,IAAIA,OAAgB,aAAa;CACvC,MAAM,eAAgC,GAAG;CACzC,MAAM,UAA2B,MAAM;AACrC,MAAI,OAAO,MAAM,WACf,GAAE,OAAO,EAAoB;MAE7B,GAAE,IAAI,EAAE;;AAGZ,QAAO,CAAC,QAAQ,OAAO;;;;;;;;;;AAazB,SAAgB,aAAa,IAAsB;CACjD,MAAM,MAAM,eAAe;AAC3B,KAAI,KAAK;EACP,MAAM,MAAM,cAAc;AAC1B,MAAI,MAAM,IAAI,MAAM,OAAQ;EA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B,aAAgB,OAA2B,IAAgB;CACzE,MAAM,OAAO,iBAAiB;AAC9B,iBAAgB,MAAM;AACtB,KAAI;AACF,SAAO,IAAI;WACH;AACR,kBAAgB,KAAK"}
1
+ {"version":3,"file":"index.js","names":["pyreonSignal","pyreonEffect","pyreonComputed","pyreonCreateSelector"],"sources":["../src/jsx-runtime.ts","../src/index.ts"],"sourcesContent":["/**\n * Compat JSX runtime for SolidJS compatibility mode.\n *\n * When `jsxImportSource` is redirected to `@pyreon/solid-compat` (via the vite\n * plugin's `compat: \"solid\"` option), OXC rewrites JSX to import from this file.\n *\n * For component VNodes, we wrap the component function so it returns a reactive\n * accessor — enabling Solid-style re-renders on state change while Pyreon's\n * existing renderer handles all DOM work.\n *\n * The component body runs inside `runUntracked` to prevent signal reads (from\n * createSignal getters) from being tracked by the reactive accessor. Only the\n * version signal triggers re-renders.\n *\n * ## Child instance preservation\n *\n * When a parent component re-renders, mountReactive does a full teardown+rebuild\n * of the DOM tree. Without preservation, child components get brand new\n * RenderContexts with empty hooks arrays — causing `onMount` and `onCleanup`\n * to fire again, which can trigger infinite re-render loops.\n *\n * To fix this, we store child RenderContexts in the parent's hooks array (indexed\n * by the parent's hook counter). When the child wrapper is called again after a\n * parent re-render, it reuses the existing ctx (preserving hooks state), so\n * hook-indexed guards like `if (idx >= ctx.hooks.length) return` work correctly\n * and lifecycle hooks don't re-fire.\n */\n\nimport type { ComponentFn, Props, VNode, VNodeChild } from \"@pyreon/core\"\nimport {\n ErrorBoundary,\n For,\n Fragment,\n h,\n Match,\n onUnmount,\n Show,\n Suspense,\n Switch,\n} from \"@pyreon/core\"\nimport { runUntracked, 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 /** Callbacks to run on unmount (lifecycle + effect cleanups) */\n unmountCallbacks: (() => void)[]\n}\n\nexport interface EffectEntry {\n // biome-ignore lint/suspicious/noConfusingVoidType: matches Solid's effect signature\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// ─── Child instance preservation ─────────────────────────────────────────────\n\n/** Stored in the parent's hooks array to preserve child state across re-renders */\ninterface ChildInstance {\n ctx: RenderContext\n version: ReturnType<typeof signal<number>>\n updateScheduled: boolean\n}\n\n// Internal prop keys for passing parent context info to child wrappers\nconst _CHILD_INSTANCE = Symbol.for(\"pyreon.childInstance\")\nconst noop = () => {\n /* noop */\n}\n\n// ─── Component wrapping ──────────────────────────────────────────────────────\n\n// biome-ignore lint/complexity/noBannedTypes: Function is needed for generic component wrapping\nconst _wrapperCache = new WeakMap<Function, ComponentFn>()\n\n// Pyreon core components that must NOT be wrapped — they rely on internal reactivity\n// biome-ignore lint/complexity/noBannedTypes: Function is needed for generic component set\nconst _nativeComponents: Set<Function> = new Set([\n Show,\n For,\n Switch,\n Match,\n Suspense,\n ErrorBoundary,\n])\n\n// biome-ignore lint/complexity/noBannedTypes: Function is needed for generic component wrapping\nfunction wrapCompatComponent(solidComponent: Function): ComponentFn {\n if (_nativeComponents.has(solidComponent)) return solidComponent as ComponentFn\n\n let wrapped = _wrapperCache.get(solidComponent)\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 // Check for a preserved child instance from the parent's hooks\n const existing = (props as Record<symbol, unknown>)[_CHILD_INSTANCE] as\n | ChildInstance\n | undefined\n\n const ctx: RenderContext = existing?.ctx ?? {\n hooks: [],\n scheduleRerender: () => {\n // Will be replaced below after version signal is created\n },\n pendingEffects: [],\n pendingLayoutEffects: [],\n unmounted: false,\n unmountCallbacks: [],\n }\n\n // When reusing an existing ctx after parent re-render, reset unmounted flag\n // and clear stale unmount callbacks (they belong to the previous mount cycle)\n if (existing) {\n ctx.unmounted = false\n ctx.unmountCallbacks = []\n }\n\n const version = existing?.version ?? signal(0)\n\n // Use a shared updateScheduled flag (preserved across parent re-renders)\n let updateScheduled = existing?.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 when component unmounts\n onUnmount(() => {\n ctx.unmounted = true\n for (const cb of ctx.unmountCallbacks) cb()\n })\n\n // Strip the internal prop before passing to the component\n const { [_CHILD_INSTANCE]: _stripped, ...cleanProps } = props as Record<\n string | symbol,\n unknown\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 // runUntracked prevents signal reads (from createSignal getters) from\n // being tracked by this accessor — only the version signal should trigger re-renders\n const result = runUntracked(() => (solidComponent as ComponentFn)(cleanProps as 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 // Forward __loading from lazy components so Pyreon's Suspense can detect them\n if (\"__loading\" in solidComponent) {\n ;(wrapped as unknown as Record<string, unknown>).__loading = (\n solidComponent as unknown as Record<string, unknown>\n ).__loading\n }\n\n _wrapperCache.set(solidComponent, wrapped)\n return wrapped\n}\n\n// ─── Child instance lookup ───────────────────────────────────────────────────\n\nfunction createChildInstance(): ChildInstance {\n return {\n ctx: {\n hooks: [],\n scheduleRerender: noop,\n pendingEffects: [],\n pendingLayoutEffects: [],\n unmounted: false,\n unmountCallbacks: [],\n },\n version: signal(0),\n updateScheduled: false,\n }\n}\n\n/**\n * During a parent component render, get or create the child instance at the\n * current hook index. Returns undefined when called outside a component render.\n */\nfunction resolveChildInstance(): ChildInstance | undefined {\n const parentCtx = _currentCtx\n if (!parentCtx) return undefined\n\n const idx = _hookIndex++\n if (idx < parentCtx.hooks.length) {\n return parentCtx.hooks[idx] as ChildInstance\n }\n const instance = createChildInstance()\n parentCtx.hooks[idx] = instance\n return instance\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 if (_nativeComponents.has(type)) {\n const componentProps = children !== undefined ? { ...propsWithKey, children } : propsWithKey\n return h(type as ComponentFn, componentProps)\n }\n\n const wrapped = wrapCompatComponent(type)\n const componentProps =\n children !== undefined ? { ...propsWithKey, children } : { ...propsWithKey }\n\n const childInstance = resolveChildInstance()\n if (childInstance) {\n ;(componentProps as Record<symbol, unknown>)[_CHILD_INSTANCE] = childInstance\n }\n\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 return h(type, propsWithKey, ...(childArray as VNodeChild[]))\n}\n\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n","/**\n * @pyreon/solid-compat\n *\n * Fully SolidJS-compatible API powered by Pyreon's reactive engine.\n *\n * Components re-render on state change via the compat JSX runtime wrapper.\n * Signals use Pyreon's native signal system internally (enabling auto-tracking\n * for createEffect/createMemo), while the component body runs inside\n * `runUntracked` to prevent signal reads from being tracked by the reactive\n * accessor. Only the version signal triggers re-renders.\n *\n * USAGE:\n * import { createSignal, createEffect } from \"solid-js\" // aliased by vite plugin\n */\n\nimport type { ComponentFn, LazyComponent, Props, VNodeChild } from \"@pyreon/core\"\nimport {\n ErrorBoundary,\n For,\n Match,\n createContext as pyreonCreateContext,\n onMount as pyreonOnMount,\n onUnmount as pyreonOnUnmount,\n useContext as pyreonUseContext,\n Show,\n Suspense,\n Switch,\n} from \"@pyreon/core\"\nimport {\n type EffectScope,\n effectScope,\n getCurrentScope,\n batch as pyreonBatch,\n computed as pyreonComputed,\n createSelector as pyreonCreateSelector,\n effect as pyreonEffect,\n signal as pyreonSignal,\n runUntracked,\n setCurrentScope,\n} from \"@pyreon/reactivity\"\nimport { getCurrentCtx, getHookIndex } from \"./jsx-runtime\"\n\n// ─── createSignal ────────────────────────────────────────────────────────────\n\nexport type SignalGetter<T> = () => T\nexport type SignalSetter<T> = (v: T | ((prev: T) => T)) => void\n\nexport function createSignal<T>(initialValue: T): [SignalGetter<T>, SignalSetter<T>] {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx >= ctx.hooks.length) {\n ctx.hooks[idx] = pyreonSignal<T>(initialValue)\n }\n const s = ctx.hooks[idx] as ReturnType<typeof pyreonSignal<T>>\n const { scheduleRerender } = ctx\n\n const getter: SignalGetter<T> = () => s()\n const setter: SignalSetter<T> = (v) => {\n if (typeof v === \"function\") {\n s.update(v as (prev: T) => T)\n } else {\n s.set(v)\n }\n scheduleRerender()\n }\n return [getter, setter]\n }\n\n // Outside component — plain Pyreon signal\n const s = pyreonSignal<T>(initialValue)\n const getter: SignalGetter<T> = () => s()\n const setter: SignalSetter<T> = (v) => {\n if (typeof v === \"function\") {\n s.update(v as (prev: T) => T)\n } else {\n s.set(v)\n }\n }\n return [getter, setter]\n}\n\n// ─── createEffect ────────────────────────────────────────────────────────────\n\n/**\n * Solid-compatible `createEffect` — creates a reactive side effect.\n *\n * In component context: hook-indexed, only created on first render. The effect\n * uses Pyreon's native tracking so signal reads are automatically tracked.\n * A re-entrance guard prevents infinite loops from signal writes inside\n * the effect.\n */\nexport function createEffect(fn: () => void): void {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return // Already registered on first render\n\n let running = false\n const e = pyreonEffect(() => {\n if (running) return\n running = true\n try {\n fn()\n } finally {\n running = false\n }\n })\n const stop = () => e.dispose()\n ctx.hooks[idx] = stop\n ctx.unmountCallbacks.push(stop)\n return\n }\n\n // Outside component\n pyreonEffect(fn)\n}\n\n// ─── createRenderEffect ──────────────────────────────────────────────────────\n\n/**\n * Solid-compatible `createRenderEffect` — same as createEffect.\n * In Solid, this runs during the render phase; here it runs as a Pyreon effect.\n */\nexport function createRenderEffect(fn: () => void): void {\n createEffect(fn)\n}\n\n// ─── createComputed (legacy Solid API) ───────────────────────────────────────\n\nexport { createEffect as createComputed }\n\n// ─── createMemo ──────────────────────────────────────────────────────────────\n\n/**\n * Solid-compatible `createMemo` — derives a value from reactive sources.\n *\n * In component context: hook-indexed, only created on first render.\n * Uses Pyreon's native computed for auto-tracking.\n */\nexport function createMemo<T>(fn: () => T): () => T {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx >= ctx.hooks.length) {\n ctx.hooks[idx] = pyreonComputed(fn)\n }\n const c = ctx.hooks[idx] as ReturnType<typeof pyreonComputed<T>>\n return () => c()\n }\n\n // Outside component\n const c = pyreonComputed(fn)\n return () => c()\n}\n\n// ─── createRoot ──────────────────────────────────────────────────────────────\n\nexport function createRoot<T>(fn: (dispose: () => void) => T): T {\n const scope = effectScope()\n const prev = getCurrentScope()\n setCurrentScope(scope)\n try {\n return fn(() => scope.stop())\n } finally {\n setCurrentScope(prev)\n }\n}\n\n// ─── on ──────────────────────────────────────────────────────────────────────\n\ntype AccessorArray = readonly (() => unknown)[]\ntype OnEffectFunction<D, V> = (input: D, prevInput: D | undefined, prev: V | undefined) => V\n\nexport function on<S extends (() => unknown) | AccessorArray, V>(\n deps: S,\n fn: OnEffectFunction<\n S extends () => infer R ? R : S extends readonly (() => infer R)[] ? R[] : never,\n V\n >,\n): () => V | undefined {\n type D = S extends () => infer R ? R : S extends readonly (() => infer R)[] ? R[] : never\n\n let prevInput: D | undefined\n let prevValue: V | undefined\n let initialized = false\n\n return () => {\n // Read dependencies to register tracking\n const input: D = (\n Array.isArray(deps) ? (deps as (() => unknown)[]).map((d) => d()) : (deps as () => unknown)()\n ) as D\n\n if (!initialized) {\n initialized = true\n prevValue = fn(input, undefined, undefined)\n prevInput = input\n return prevValue\n }\n\n const result = runUntracked(() => fn(input, prevInput, prevValue))\n prevInput = input\n prevValue = result\n return result\n }\n}\n\n// ─── batch ───────────────────────────────────────────────────────────────────\n\nexport { pyreonBatch as batch }\n\n// ─── untrack ─────────────────────────────────────────────────────────────────\n\nexport { runUntracked as untrack }\n\n// ─── onMount / onCleanup ─────────────────────────────────────────────────────\n\n/**\n * Solid-compatible `onMount` — runs once after the component's first render.\n */\ntype CleanupFn = () => void\n// biome-ignore lint/suspicious/noConfusingVoidType: void allows callbacks that return nothing\nexport function onMount(fn: () => CleanupFn | void | undefined): void {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx >= ctx.hooks.length) {\n ctx.hooks[idx] = true\n ctx.pendingEffects.push({\n fn: () => {\n fn()\n return undefined\n },\n deps: undefined,\n cleanup: undefined,\n })\n }\n return\n }\n\n // Outside component\n pyreonOnMount(fn)\n}\n\n/**\n * Solid-compatible `onCleanup` — registers a callback to run when the component unmounts.\n */\nexport function onCleanup(fn: () => void): void {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx >= ctx.hooks.length) {\n ctx.hooks[idx] = true\n ctx.unmountCallbacks.push(fn)\n }\n return\n }\n\n // Outside component\n pyreonOnUnmount(fn)\n}\n\n// ─── createSelector ──────────────────────────────────────────────────────────\n\nexport function createSelector<T>(source: () => T): (key: T) => boolean {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx >= ctx.hooks.length) {\n ctx.hooks[idx] = pyreonCreateSelector(source)\n }\n return ctx.hooks[idx] as (key: T) => boolean\n }\n\n return pyreonCreateSelector(source)\n}\n\n// ─── mergeProps ──────────────────────────────────────────────────────────────\n\ntype UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (\n k: infer I,\n) => void\n ? I\n : never\n\ntype MergeProps<T extends object[]> = UnionToIntersection<T[number]>\n\nexport function mergeProps<T extends object[]>(...sources: [...T]): MergeProps<T> {\n const target = {} as Record<PropertyKey, unknown>\n for (const source of sources) {\n const descriptors = Object.getOwnPropertyDescriptors(source)\n for (const key of Reflect.ownKeys(descriptors)) {\n const desc = descriptors[key as string]\n if (!desc) continue\n // Preserve getters for reactivity\n if (desc.get) {\n Object.defineProperty(target, key, {\n get: desc.get,\n enumerable: true,\n configurable: true,\n })\n } else {\n Object.defineProperty(target, key, {\n value: desc.value,\n writable: true,\n enumerable: true,\n configurable: true,\n })\n }\n }\n }\n return target as MergeProps<T>\n}\n\n// ─── splitProps ──────────────────────────────────────────────────────────────\n\nexport function splitProps<T extends Record<string, unknown>, K extends (keyof T)[]>(\n props: T,\n ...keys: K\n): [Pick<T, K[number]>, Omit<T, K[number]>] {\n const picked = {} as Pick<T, K[number]>\n const rest = {} as Record<string, unknown>\n const keySet = new Set<string>(keys.flat() as string[])\n\n const descriptors = Object.getOwnPropertyDescriptors(props)\n for (const key of Reflect.ownKeys(descriptors)) {\n const desc = descriptors[key as string]\n if (!desc) continue\n const target = typeof key === \"string\" && keySet.has(key) ? picked : rest\n if (desc.get) {\n Object.defineProperty(target, key, {\n get: desc.get,\n enumerable: true,\n configurable: true,\n })\n } else {\n Object.defineProperty(target, key, {\n value: desc.value,\n writable: true,\n enumerable: true,\n configurable: true,\n })\n }\n }\n\n return [picked, rest as Omit<T, K[number]>]\n}\n\n// ─── children ────────────────────────────────────────────────────────────────\n\nexport function children(fn: () => VNodeChild): () => VNodeChild {\n const memo = createMemo(() => {\n const result = fn()\n // Resolve function children (reactive getters)\n if (typeof result === \"function\") return (result as () => VNodeChild)()\n return result\n })\n return memo\n}\n\n// ─── lazy ────────────────────────────────────────────────────────────────────\n\nexport function lazy<P extends Props>(\n loader: () => Promise<{ default: ComponentFn<P> }>,\n): LazyComponent<P> & { preload: () => Promise<{ default: ComponentFn<P> }> } {\n const loaded = pyreonSignal<ComponentFn<P> | null>(null)\n const error = pyreonSignal<Error | null>(null)\n let promise: Promise<{ default: ComponentFn<P> }> | null = null\n\n const load = () => {\n if (!promise) {\n promise = loader()\n .then((mod) => {\n loaded.set(mod.default)\n return mod\n })\n .catch((err) => {\n const e = err instanceof Error ? err : new Error(String(err))\n error.set(e)\n promise = null\n throw e\n })\n }\n return promise\n }\n\n // Uses Pyreon's __loading protocol — Suspense checks this to show fallback.\n // __loading() triggers load() on first call so loading starts when Suspense\n // first encounters the component (not at module load time, not on first render).\n const LazyComponent = ((props: P) => {\n const err = error()\n if (err) throw err\n const comp = loaded()\n if (!comp) return null\n return comp(props)\n }) as LazyComponent<P> & { preload: () => Promise<{ default: ComponentFn<P> }> }\n\n LazyComponent.__loading = () => {\n const isLoading = loaded() === null && error() === null\n if (isLoading) load()\n return isLoading\n }\n LazyComponent.preload = load\n\n return LazyComponent\n}\n\n// ─── createContext / useContext ───────────────────────────────────────────────\n\nexport { pyreonCreateContext as createContext, pyreonUseContext as useContext }\n\n// ─── getOwner / runWithOwner ─────────────────────────────────────────────────\n\nexport function getOwner(): EffectScope | null {\n return getCurrentScope()\n}\n\nexport function runWithOwner<T>(owner: EffectScope | null, fn: () => T): T {\n const prev = getCurrentScope()\n setCurrentScope(owner)\n try {\n return fn()\n } finally {\n setCurrentScope(prev)\n }\n}\n\n// ─── Re-exports from @pyreon/core ──────────────────────────────────────────────\n\nexport { ErrorBoundary, For, Match, Show, Suspense, Switch }\n"],"mappings":";;;;AAkEA,IAAI,cAAoC;AACxC,IAAI,aAAa;AAEjB,SAAgB,gBAAsC;AACpD,QAAO;;AAGT,SAAgB,eAAuB;AACrC,QAAO;;AA+CT,MAAM,kBAAkB,OAAO,IAAI,uBAAuB;;;;AC1E1D,SAAgB,aAAgB,cAAqD;CACnF,MAAM,MAAM,eAAe;AAC3B,KAAI,KAAK;EACP,MAAM,MAAM,cAAc;AAC1B,MAAI,OAAO,IAAI,MAAM,OACnB,KAAI,MAAM,OAAOA,OAAgB,aAAa;EAEhD,MAAM,IAAI,IAAI,MAAM;EACpB,MAAM,EAAE,qBAAqB;EAE7B,MAAM,eAAgC,GAAG;EACzC,MAAM,UAA2B,MAAM;AACrC,OAAI,OAAO,MAAM,WACf,GAAE,OAAO,EAAoB;OAE7B,GAAE,IAAI,EAAE;AAEV,qBAAkB;;AAEpB,SAAO,CAAC,QAAQ,OAAO;;CAIzB,MAAM,IAAIA,OAAgB,aAAa;CACvC,MAAM,eAAgC,GAAG;CACzC,MAAM,UAA2B,MAAM;AACrC,MAAI,OAAO,MAAM,WACf,GAAE,OAAO,EAAoB;MAE7B,GAAE,IAAI,EAAE;;AAGZ,QAAO,CAAC,QAAQ,OAAO;;;;;;;;;;AAazB,SAAgB,aAAa,IAAsB;CACjD,MAAM,MAAM,eAAe;AAC3B,KAAI,KAAK;EACP,MAAM,MAAM,cAAc;AAC1B,MAA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,QAAO,iBAAiB;;AAG1B,SAAgB,aAAgB,OAA2B,IAAgB;CACzE,MAAM,OAAO,iBAAiB;AAC9B,iBAAgB,MAAM;AACtB,KAAI;AACF,SAAO,IAAI;WACH;AACR,kBAAgB,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["pyreonSignal","pyreonEffect","pyreonComputed","pyreonCreateSelector"],"sources":["../../../src/jsx-runtime.ts","../../../src/index.ts"],"mappings":";;;;;AAqEA,SAAgB,aAAA,CAAA,EAAsC;EACpD,OAAO,WAAA;;AAGT,SAAgB,YAAA,CAAA,EAAuB;EACrC,OAAO,UAAA,EAAA;;;;AC3BT,SAAgB,YAAA,CAAgB,YAAA,EAAqD;EACnF,MAAM,GAAA,GAAM,aAAA,CAAA,CAAe;EAC3B,IAAI,GAAA,EAAK;IACP,MAAM,GAAA,GAAM,YAAA,CAAA,CAAc;IAC1B,IAAI,GAAA,IAAO,GAAA,CAAI,KAAA,CAAM,MAAA,EACnB,GAAA,CAAI,KAAA,CAAM,GAAA,CAAA,GAAOA,MAAAA,CAAgB,YAAA,CAAa;IAEhD,MAAM,CAAA,GAAI,GAAA,CAAI,KAAA,CAAM,GAAA,CAAA;IACpB,MAAM;MAAE;IAAA,CAAA,GAAqB,GAAA;IAE7B,MAAM,MAAA,GAAA,CAAA,KAAgC,CAAA,CAAA,CAAG;IACzC,MAAM,MAAA,GAA2B,CAAA,IAAM;MACrC,IAAI,OAAO,CAAA,KAAM,UAAA,EACf,CAAA,CAAE,MAAA,CAAO,CAAA,CAAoB,CAAA,KAE7B,CAAA,CAAE,GAAA,CAAI,CAAA,CAAE;MAEV,gBAAA,CAAA,CAAkB;;IAEpB,OAAO,CAAC,MAAA,EAAQ,MAAA,CAAO;;EAIzB,MAAM,CAAA,GAAIA,MAAAA,CAAgB,YAAA,CAAa;EACvC,MAAM,MAAA,GAAA,CAAA,KAAgC,CAAA,CAAA,CAAG;EACzC,MAAM,MAAA,GAA2B,CAAA,IAAM;I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AAA,CAAK,KAAA,CAAM;;EAGpB,aAAA,CAAc,SAAA,GAAA,MAAkB;IAC9B,MAAM,SAAA,GAAY,MAAA,CAAA,CAAQ,KAAK,IAAA,IAAQ,KAAA,CAAA,CAAO,KAAK,IAAA;IACnD,IAAI,SAAA,EAAW,IAAA,CAAA,CAAM;IACrB,OAAO,SAAA;;EAET,aAAA,CAAc,OAAA,GAAU,IAAA;EAExB,OAAO,aAAA;;AAST,SAAgB,QAAA,CAAA,EAA+B;EAC7C,OAAO,eAAA,CAAA,CAAiB;;AAG1B,SAAgB,YAAA,CAAgB,KAAA,EAA2B,EAAA,EAAgB;EACzE,MAAM,IAAA,GAAO,eAAA,CAAA,CAAiB;EAC9B,eAAA,CAAgB,KAAA,CAAM;EACtB,IAAI;IACF,OAAO,EAAA,CAAA,CAAI;YACH;IACR,eAAA,CAAgB,IAAA,CAAK"}
1
+ {"version":3,"file":"index.d.ts","names":["pyreonSignal","pyreonEffect","pyreonComputed","pyreonCreateSelector"],"sources":["../../../src/jsx-runtime.ts","../../../src/index.ts"],"mappings":";;;;;AAqEA,SAAgB,aAAA,CAAA,EAAsC;EACpD,OAAO,WAAA;;AAGT,SAAgB,YAAA,CAAA,EAAuB;EACrC,OAAO,UAAA,EAAA;;;;AC3BT,SAAgB,YAAA,CAAgB,YAAA,EAAqD;EACnF,MAAM,GAAA,GAAM,aAAA,CAAA,CAAe;EAC3B,IAAI,GAAA,EAAK;IACP,MAAM,GAAA,GAAM,YAAA,CAAA,CAAc;IAC1B,IAAI,GAAA,IAAO,GAAA,CAAI,KAAA,CAAM,MAAA,EACnB,GAAA,CAAI,KAAA,CAAM,GAAA,CAAA,GAAOA,MAAAA,CAAgB,YAAA,CAAa;IAEhD,MAAM,CAAA,GAAI,GAAA,CAAI,KAAA,CAAM,GAAA,CAAA;IACpB,MAAM;MAAE;IAAA,CAAA,GAAqB,GAAA;IAE7B,MAAM,MAAA,GAAA,CAAA,KAAgC,CAAA,CAAA,CAAG;IACzC,MAA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AAM,IAAI,KAAA,CAAM,MAAA,CAAO,GAAA,CAAI,CAAC;MAC7D,KAAA,CAAM,GAAA,CAAI,CAAA,CAAE;MACZ,OAAA,GAAU,IAAA;MACV,MAAM,CAAA;MACN;IAEN,OAAO,OAAA;;EAMT,MAAM,aAAA,GAAkB,KAAA,IAAa;IACnC,MAAM,GAAA,GAAM,KAAA,CAAA,CAAO;IACnB,IAAI,GAAA,EAAK,MAAM,GAAA;IACf,MAAM,IAAA,GAAO,MAAA,CAAA,CAAQ;IACrB,IAAI,CAAC,IAAA,EAAM,OAAO,IAAA;IAClB,OAAO,IAAA,CAAK,KAAA,CAAM;;EAGpB,aAAA,CAAc,SAAA,GAAA,MAAkB;IAC9B,MAAM,SAAA,GAAY,MAAA,CAAA,CAAQ,KAAK,IAAA,IAAQ,KAAA,CAAA,CAAO,KAAK,IAAA;IACnD,IAAI,SAAA,EAAW,IAAA,CAAA,CAAM;IACrB,OAAO,SAAA;;EAET,aAAA,CAAc,OAAA,GAAU,IAAA;EAExB,OAAO,aAAA;;AAST,SAAgB,QAAA,CAAA,EAA+B;EAC7C,OAAO,eAAA,CAAA,CAAiB;;AAG1B,SAAgB,YAAA,CAAgB,KAAA,EAA2B,EAAA,EAAgB;EACzE,MAAM,IAAA,GAAO,eAAA,CAAA,CAAiB;EAC9B,eAAA,CAAgB,KAAA,CAAM;EACtB,IAAI;IACF,OAAO,EAAA,CAAA,CAAI;YACH;IACR,eAAA,CAAgB,IAAA,CAAK"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyreon/solid-compat",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "SolidJS-compatible API shim for Pyreon — write Solid-style code that runs on Pyreon's reactive engine",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -49,9 +49,9 @@
49
49
  "prepublishOnly": "bun run build"
50
50
  },
51
51
  "dependencies": {
52
- "@pyreon/core": "^0.5.5",
53
- "@pyreon/reactivity": "^0.5.5",
54
- "@pyreon/runtime-dom": "^0.5.5"
52
+ "@pyreon/core": "^0.5.6",
53
+ "@pyreon/reactivity": "^0.5.6",
54
+ "@pyreon/runtime-dom": "^0.5.6"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@happy-dom/global-registrator": "^20.8.3",
package/src/index.ts CHANGED
@@ -219,7 +219,8 @@ export { runUntracked as untrack }
219
219
  * Solid-compatible `onMount` — runs once after the component's first render.
220
220
  */
221
221
  type CleanupFn = () => void
222
- export function onMount(fn: () => CleanupFn | undefined): void {
222
+ // biome-ignore lint/suspicious/noConfusingVoidType: void allows callbacks that return nothing
223
+ export function onMount(fn: () => CleanupFn | void | undefined): void {
223
224
  const ctx = getCurrentCtx()
224
225
  if (ctx) {
225
226
  const idx = getHookIndex()
@@ -111,7 +111,6 @@ describe("child instance preservation - no infinite re-render", () => {
111
111
  onMount(() => {
112
112
  mountCount++
113
113
  props.onEvent("mounted")
114
- return undefined
115
114
  })
116
115
  return jsx("p", { children: "alive" })
117
116
  }