@pyreon/vue-compat 0.5.5 → 0.5.7

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":["pyreonComputed","pyreonNextTick","pyreonMount"],"sources":["../src/jsx-runtime.ts","../src/index.ts"],"sourcesContent":["/**\n * Compat JSX runtime for Vue compatibility mode.\n *\n * When `jsxImportSource` is redirected to `@pyreon/vue-compat` (via the vite\n * plugin's `compat: \"vue\"` 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 Vue-style re-renders on state change while Pyreon's\n * existing renderer handles all DOM work.\n *\n * Key difference from react/preact compat: the component body runs inside\n * `runUntracked` to prevent `.value` reads (which access underlying signals)\n * from being tracked by the reactive accessor. Only the version signal\n * triggers re-renders.\n */\n\nimport type { ComponentFn, Props, VNode, VNodeChild } from \"@pyreon/core\"\nimport { Fragment, h, onUnmount } 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 Vue'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// ─── Component wrapping ──────────────────────────────────────────────────────\n\n// biome-ignore lint/complexity/noBannedTypes: Function is needed for generic component wrapping\nconst _wrapperCache = new WeakMap<Function, ComponentFn>()\n\n// biome-ignore lint/complexity/noBannedTypes: Function is needed for generic component wrapping\nfunction wrapCompatComponent(vueComponent: Function): ComponentFn {\n let wrapped = _wrapperCache.get(vueComponent)\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 unmountCallbacks: [],\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 when component unmounts\n onUnmount(() => {\n ctx.unmounted = true\n for (const cb of ctx.unmountCallbacks) cb()\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 .value signal reads from being tracked by this accessor —\n // only the version signal should trigger re-renders\n const result = runUntracked(() => (vueComponent 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(vueComponent, 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 Vue-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 return h(type, propsWithKey, ...(childArray as VNodeChild[]))\n}\n\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n","/**\n * @pyreon/vue-compat\n *\n * Vue 3-compatible Composition API that runs on Pyreon's reactive engine,\n * using a hook-indexed re-render model.\n *\n * All stateful APIs (ref, computed, reactive, watch, lifecycle hooks, etc.)\n * use hook-indexing to persist state across re-renders. The component body\n * re-executes when state changes (driven by a version signal in the JSX\n * runtime), and hook-indexed calls return the same objects across renders.\n *\n * DIFFERENCES FROM VUE 3:\n * - `deep` option in watch() is ignored — Pyreon tracks dependencies automatically.\n * - `shallowReactive` uses per-property signals (still shallow, but Pyreon-flavored).\n * - `readonly` returns a Proxy that throws on set (not Vue's readonly proxy).\n * - `defineComponent` only supports Composition API (setup function), not Options API.\n * - Components re-execute their body on state change (hook-indexed re-render model).\n *\n * USAGE:\n * Replace `import { ref, computed, watch } from \"vue\"` with\n * `import { ref, computed, watch } from \"@pyreon/vue-compat\"`\n */\n\nimport type { ComponentFn, Props, VNodeChild } from \"@pyreon/core\"\nimport {\n createContext,\n Fragment,\n onMount,\n onUnmount,\n onUpdate,\n popContext,\n pushContext,\n h as pyreonH,\n useContext,\n} from \"@pyreon/core\"\nimport {\n createStore,\n effect,\n computed as pyreonComputed,\n nextTick as pyreonNextTick,\n type Signal,\n signal,\n} from \"@pyreon/reactivity\"\nimport { mount as pyreonMount } from \"@pyreon/runtime-dom\"\nimport { getCurrentCtx, getHookIndex } from \"./jsx-runtime\"\n\n// ─── Internal symbols ─────────────────────────────────────────────────────────\n\nconst V_IS_REF = Symbol(\"__v_isRef\")\nconst V_IS_READONLY = Symbol(\"__v_isReadonly\")\nconst V_RAW = Symbol(\"__v_raw\")\n\n// ─── Ref ──────────────────────────────────────────────────────────────────────\n\nexport interface Ref<T = unknown> {\n value: T\n readonly [V_IS_REF]: true\n}\n\n/**\n * Creates a reactive ref wrapping the given value.\n * Access via `.value` — reads track, writes trigger.\n *\n * Inside a component: hook-indexed. The setter also calls `scheduleRerender()`.\n * Outside a component: creates a standalone reactive ref.\n */\nexport function ref<T>(value: T): Ref<T> {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as Ref<T>\n\n const s = signal(value)\n const { scheduleRerender } = ctx\n const r = {\n [V_IS_REF]: true as const,\n get value(): T {\n return s()\n },\n set value(v: T) {\n s.set(v)\n scheduleRerender()\n },\n /** @internal — access underlying signal for triggerRef */\n _signal: s,\n _scheduleRerender: scheduleRerender,\n }\n ctx.hooks[idx] = r\n return r as Ref<T>\n }\n\n // Outside component\n const s = signal(value)\n const r = {\n [V_IS_REF]: true as const,\n get value(): T {\n return s()\n },\n set value(v: T) {\n s.set(v)\n },\n /** @internal — access underlying signal for triggerRef */\n _signal: s,\n }\n return r as Ref<T>\n}\n\n/**\n * Creates a shallow ref — same as `ref()` in Pyreon since signals are inherently shallow.\n */\nexport function shallowRef<T>(value: T): Ref<T> {\n return ref(value)\n}\n\n/**\n * Force trigger a ref's subscribers, even if the value hasn't changed.\n */\nexport function triggerRef<T>(r: Ref<T>): void {\n const internal = r as Ref<T> & { _signal: Signal<T>; _scheduleRerender?: () => void }\n if (internal._signal) {\n // Force notify by setting the same value with Object.is bypass\n const current = internal._signal.peek()\n internal._signal.set(undefined as T)\n internal._signal.set(current)\n }\n if (internal._scheduleRerender) {\n internal._scheduleRerender()\n }\n}\n\n/**\n * Returns `true` if the value is a ref (created by `ref()` or `computed()`).\n */\nexport function isRef(val: unknown): val is Ref {\n return (\n val !== null && typeof val === \"object\" && (val as Record<symbol, unknown>)[V_IS_REF] === true\n )\n}\n\n/**\n * Unwraps a ref: if it has `.value`, return `.value`; otherwise return as-is.\n */\nexport function unref<T>(r: T | Ref<T>): T {\n return isRef(r) ? r.value : r\n}\n\n// ─── Computed ─────────────────────────────────────────────────────────────────\n\nexport interface ComputedRef<T = unknown> extends Ref<T> {\n readonly value: T\n}\n\nexport interface WritableComputedRef<T = unknown> extends Ref<T> {\n value: T\n}\n\n/**\n * Creates a computed ref. Supports both readonly and writable forms.\n *\n * Inside a component: hook-indexed.\n */\nexport function computed<T>(getter: () => T): ComputedRef<T>\nexport function computed<T>(options: {\n get: () => T\n set: (value: T) => void\n}): WritableComputedRef<T>\nexport function computed<T>(\n fnOrOptions: (() => T) | { get: () => T; set: (value: T) => void },\n): ComputedRef<T> | WritableComputedRef<T> {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as ComputedRef<T>\n\n const getter = typeof fnOrOptions === \"function\" ? fnOrOptions : fnOrOptions.get\n const setter = typeof fnOrOptions === \"object\" ? fnOrOptions.set : undefined\n const c = pyreonComputed(getter)\n const { scheduleRerender } = ctx\n const r = {\n [V_IS_REF]: true as const,\n get value(): T {\n return c()\n },\n set value(v: T) {\n if (!setter) {\n throw new Error(\"Cannot set value of a computed ref — computed refs are readonly\")\n }\n setter(v)\n scheduleRerender()\n },\n }\n ctx.hooks[idx] = r\n return r as ComputedRef<T>\n }\n\n // Outside component\n const getter = typeof fnOrOptions === \"function\" ? fnOrOptions : fnOrOptions.get\n const setter = typeof fnOrOptions === \"object\" ? fnOrOptions.set : undefined\n const c = pyreonComputed(getter)\n const r = {\n [V_IS_REF]: true as const,\n get value(): T {\n return c()\n },\n set value(v: T) {\n if (!setter) {\n throw new Error(\"Cannot set value of a computed ref — computed refs are readonly\")\n }\n setter(v)\n },\n }\n return r as ComputedRef<T>\n}\n\n// ─── Reactive / Readonly ──────────────────────────────────────────────────────\n\n// WeakMap to track raw objects behind reactive proxies\nconst rawMap = new WeakMap<object, object>()\n\n/**\n * Creates a deeply reactive proxy from a plain object.\n * Backed by Pyreon's `createStore()`.\n *\n * Inside a component: hook-indexed. Proxy wrapper intercepts sets to\n * call `scheduleRerender()`.\n */\nexport function reactive<T extends object>(obj: T): T {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as T\n\n const proxy = createStore(obj)\n rawMap.set(proxy as object, obj)\n const { scheduleRerender } = ctx\n const wrapped = new Proxy(proxy, {\n set(target, key, value, receiver) {\n const result = Reflect.set(target, key, value, receiver)\n scheduleRerender()\n return result\n },\n deleteProperty(target, key) {\n const result = Reflect.deleteProperty(target, key)\n scheduleRerender()\n return result\n },\n })\n rawMap.set(wrapped as object, obj)\n ctx.hooks[idx] = wrapped\n return wrapped as T\n }\n\n // Outside component\n const proxy = createStore(obj)\n rawMap.set(proxy as object, obj)\n return proxy\n}\n\n/**\n * Creates a shallow reactive proxy — same as `reactive()` in Pyreon.\n */\nexport function shallowReactive<T extends object>(obj: T): T {\n return reactive(obj)\n}\n\n/**\n * Returns a readonly proxy that throws on mutation attempts.\n *\n * Inside a component: hook-indexed.\n */\nexport function readonly<T extends object>(obj: T): Readonly<T> {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as Readonly<T>\n\n const proxy = _createReadonlyProxy(obj)\n ctx.hooks[idx] = proxy\n return proxy\n }\n\n return _createReadonlyProxy(obj)\n}\n\nfunction _createReadonlyProxy<T extends object>(obj: T): Readonly<T> {\n const proxy = new Proxy(obj, {\n get(target, key) {\n if (key === V_IS_READONLY) return true\n if (key === V_RAW) return target\n return Reflect.get(target, key)\n },\n set(_target, key) {\n // Internal symbols used for identification are allowed\n if (key === V_IS_READONLY || key === V_RAW) return true\n throw new Error(`Cannot set property \"${String(key)}\" on a readonly object`)\n },\n deleteProperty(_target, key) {\n throw new Error(`Cannot delete property \"${String(key)}\" from a readonly object`)\n },\n })\n return proxy as Readonly<T>\n}\n\n/**\n * Returns the raw (unwrapped) object behind a reactive or readonly proxy.\n */\nexport function toRaw<T extends object>(proxy: T): T {\n // Check readonly first\n const readonlyRaw = (proxy as Record<symbol, unknown>)[V_RAW]\n if (readonlyRaw) return readonlyRaw as T\n // Check reactive\n const raw = rawMap.get(proxy as object)\n return (raw as T) ?? proxy\n}\n\n// ─── toRef / toRefs ───────────────────────────────────────────────────────────\n\n/**\n * Creates a ref linked to a property of a reactive object.\n * Reading/writing the ref's `.value` reads/writes the original property.\n *\n * Inside a component: hook-indexed.\n */\nexport function toRef<T extends object, K extends keyof T>(obj: T, key: K): Ref<T[K]> {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as Ref<T[K]>\n\n const r = _createToRef(obj, key)\n ctx.hooks[idx] = r\n return r\n }\n\n return _createToRef(obj, key)\n}\n\nfunction _createToRef<T extends object, K extends keyof T>(obj: T, key: K): Ref<T[K]> {\n const r = {\n [V_IS_REF]: true as const,\n get value(): T[K] {\n return obj[key]\n },\n set value(newValue: T[K]) {\n obj[key] = newValue\n },\n }\n return r as Ref<T[K]>\n}\n\n/**\n * Converts all properties of a reactive object into individual refs.\n * Each ref is linked to the original property (not a copy).\n *\n * Inside a component: hook-indexed (the entire result, not individual refs).\n */\nexport function toRefs<T extends object>(obj: T): { [K in keyof T]: Ref<T[K]> } {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as { [K in keyof T]: Ref<T[K]> }\n\n const result = {} as { [K in keyof T]: Ref<T[K]> }\n for (const key of Object.keys(obj) as (keyof T)[]) {\n // Create refs directly (not via exported toRef) to avoid extra hook index consumption\n result[key] = _createToRef(obj, key)\n }\n ctx.hooks[idx] = result\n return result\n }\n\n const result = {} as { [K in keyof T]: Ref<T[K]> }\n for (const key of Object.keys(obj) as (keyof T)[]) {\n result[key] = _createToRef(obj, key)\n }\n return result\n}\n\n// ─── Watch ────────────────────────────────────────────────────────────────────\n\nexport interface WatchOptions {\n /** Call the callback immediately with current value. Default: false */\n immediate?: boolean\n /** Ignored in Pyreon — dependencies are tracked automatically. */\n deep?: boolean\n}\n\ntype WatchSource<T> = Ref<T> | (() => T)\n\n/**\n * Watches a reactive source and calls `cb` when it changes.\n *\n * Inside a component: hook-indexed, created once. Disposed on unmount.\n */\nexport function watch<T>(\n source: WatchSource<T>,\n cb: (newValue: T, oldValue: T | undefined) => void,\n options?: WatchOptions,\n): () => void {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as () => void\n\n const getter = isRef(source) ? () => source.value : (source as () => T)\n let oldValue: T | undefined\n let initialized = false\n\n if (options?.immediate) {\n oldValue = undefined\n const current = getter()\n cb(current, oldValue)\n oldValue = current\n initialized = true\n }\n\n let running = false\n const e = effect(() => {\n if (running) return\n running = true\n try {\n const newValue = getter()\n if (initialized) {\n cb(newValue, oldValue)\n }\n oldValue = newValue\n initialized = true\n } finally {\n running = false\n }\n })\n\n const stop = () => e.dispose()\n ctx.hooks[idx] = stop\n ctx.unmountCallbacks.push(stop)\n return stop\n }\n\n // Outside component\n const getter = isRef(source) ? () => source.value : (source as () => T)\n let oldValue: T | undefined\n let initialized = false\n\n if (options?.immediate) {\n oldValue = undefined\n const current = getter()\n cb(current, oldValue)\n oldValue = current\n initialized = true\n }\n\n let running = false\n const e = effect(() => {\n if (running) return\n running = true\n try {\n const newValue = getter()\n if (initialized) {\n cb(newValue, oldValue)\n }\n oldValue = newValue\n initialized = true\n } finally {\n running = false\n }\n })\n\n return () => e.dispose()\n}\n\n/**\n * Runs the given function reactively — re-executes whenever its tracked\n * dependencies change.\n *\n * Inside a component: hook-indexed, created once. Disposed on unmount.\n */\nexport function watchEffect(fn: () => void): () => void {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as () => void\n\n let running = false\n const e = effect(() => {\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 stop\n }\n\n let running = false\n const e = effect(() => {\n if (running) return\n running = true\n try {\n fn()\n } finally {\n running = false\n }\n })\n return () => e.dispose()\n}\n\n// ─── Lifecycle ────────────────────────────────────────────────────────────────\n\n/**\n * Registers a callback to run after the component is mounted.\n * Hook-indexed: only registered on first render.\n */\nexport function onMounted(fn: () => void): void {\n const ctx = getCurrentCtx()\n if (!ctx) {\n // Fallback: use Pyreon's lifecycle directly (e.g., inside defineComponent without jsx-runtime)\n onMount(() => {\n fn()\n return undefined\n })\n return\n }\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return // Already registered\n ctx.hooks[idx] = true\n // Schedule to run after render via microtask\n ctx.pendingEffects.push({\n fn: () => {\n fn()\n return undefined\n },\n deps: [],\n cleanup: undefined,\n })\n}\n\n/**\n * Registers a callback to run when the component is unmounted.\n * Hook-indexed: only registered on first render.\n */\nexport function onUnmounted(fn: () => void): void {\n const ctx = getCurrentCtx()\n if (!ctx) {\n onUnmount(fn)\n return\n }\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return // Already registered\n ctx.hooks[idx] = true\n ctx.unmountCallbacks.push(fn)\n}\n\n/**\n * Registers a callback to run after a reactive update (not on initial mount).\n * Hook-indexed: registered once, fires on each re-render.\n */\nexport function onUpdated(fn: () => void): void {\n const ctx = getCurrentCtx()\n if (!ctx) {\n onUpdate(fn)\n return\n }\n const idx = getHookIndex()\n if (idx >= ctx.hooks.length) {\n // First render — just mark as registered, don't fire\n ctx.hooks[idx] = true\n return\n }\n // Re-render — schedule the callback\n ctx.pendingEffects.push({\n fn: () => {\n fn()\n return undefined\n },\n deps: undefined,\n cleanup: undefined,\n })\n}\n\n/**\n * Registers a callback to run before mount.\n * In Pyreon there is no pre-mount phase — maps to `onMounted()`.\n */\nexport function onBeforeMount(fn: () => void): void {\n onMounted(fn)\n}\n\n/**\n * Registers a callback to run before unmount.\n * In Pyreon there is no pre-unmount phase — maps to `onUnmounted()`.\n */\nexport function onBeforeUnmount(fn: () => void): void {\n onUnmounted(fn)\n}\n\n// ─── nextTick ─────────────────────────────────────────────────────────────────\n\n/**\n * Returns a Promise that resolves after all pending reactive updates have flushed.\n */\nexport function nextTick(): Promise<void> {\n return pyreonNextTick()\n}\n\n// ─── Provide / Inject ─────────────────────────────────────────────────────────\n\n// Registry of string/symbol keys to Pyreon context objects (created lazily)\nconst _contextRegistry = new Map<string | symbol, ReturnType<typeof createContext>>()\n\nfunction getOrCreateContext<T>(key: string | symbol, defaultValue?: T) {\n if (!_contextRegistry.has(key)) {\n _contextRegistry.set(key, createContext<T>(defaultValue as T))\n }\n return _contextRegistry.get(key) as ReturnType<typeof createContext<T>>\n}\n\n/**\n * Provides a value to all descendant components.\n *\n * Inside a component: hook-indexed, pushed once. Popped on unmount.\n */\nexport function provide<T>(key: string | symbol, value: T): void {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return // Already provided\n ctx.hooks[idx] = true\n const vueCtx = getOrCreateContext<T>(key)\n pushContext(new Map([[vueCtx.id, value]]))\n ctx.unmountCallbacks.push(() => popContext())\n return\n }\n // Outside component — use Pyreon's provide directly\n const vueCtx = getOrCreateContext<T>(key)\n pushContext(new Map([[vueCtx.id, value]]))\n}\n\n/**\n * Injects a value provided by an ancestor component.\n */\nexport function inject<T>(key: string | symbol, defaultValue?: T): T | undefined {\n const ctx = getOrCreateContext<T>(key)\n const value = useContext(ctx)\n return value !== undefined ? value : defaultValue\n}\n\n// ─── defineComponent ──────────────────────────────────────────────────────────\n\ninterface ComponentOptions<P extends Props = Props> {\n /** The setup function — called once during component initialization. */\n setup: (props: P) => (() => VNodeChild) | VNodeChild\n /** Optional name for debugging. */\n name?: string\n}\n\n/**\n * Defines a component using Vue 3 Composition API style.\n * Only supports the `setup()` function — Options API is not supported.\n */\nexport function defineComponent<P extends Props = Props>(\n options: ComponentOptions<P> | ((props: P) => VNodeChild),\n): ComponentFn<P> {\n if (typeof options === \"function\") {\n return options as ComponentFn<P>\n }\n const comp = (props: P) => {\n const result = options.setup(props)\n if (typeof result === \"function\") {\n return (result as () => VNodeChild)()\n }\n return result\n }\n if (options.name) {\n Object.defineProperty(comp, \"name\", { value: options.name })\n }\n return comp as ComponentFn<P>\n}\n\n// ─── h ────────────────────────────────────────────────────────────────────────\n\n/**\n * Re-export of Pyreon's `h()` function for creating VNodes.\n */\nexport { Fragment, pyreonH as h }\n\n// ─── createApp ────────────────────────────────────────────────────────────────\n\ninterface App {\n /** Mount the application into a DOM element. Returns an unmount function. */\n mount(el: string | Element): () => void\n}\n\n/**\n * Creates a Pyreon application instance — Vue 3 `createApp()` compatible.\n */\nexport function createApp(component: ComponentFn, props?: Props): App {\n return {\n mount(el: string | Element): () => void {\n const container = typeof el === \"string\" ? document.querySelector(el) : el\n if (!container) {\n throw new Error(`Cannot find mount target: ${el}`)\n }\n const vnode = pyreonH(component, props ?? null)\n return pyreonMount(vnode, container)\n },\n }\n}\n\n// ─── Additional re-exports ────────────────────────────────────────────────────\n\nexport { batch } from \"@pyreon/reactivity\"\n"],"mappings":";;;;;AA4CA,IAAI,cAAoC;AACxC,IAAI,aAAa;AAEjB,SAAgB,gBAAsC;AACpD,QAAO;;AAGT,SAAgB,eAAuB;AACrC,QAAO;;;;;ACJT,MAAM,WAAW,OAAO,YAAY;AACpC,MAAM,gBAAgB,OAAO,iBAAiB;AAC9C,MAAM,QAAQ,OAAO,UAAU;;;;;;;;AAgB/B,SAAgB,IAAO,OAAkB;CACvC,MAAM,MAAM,eAAe;AAC3B,KAAI,KAAK;EACP,MAAM,MAAM,cAAc;AAC1B,MAAI,MAAM,IAAI,MAAM,OAAQ,QAAO,IAAI,MAAM;EAE7C,MAAM,IAAI,OAAO,MAAM;EACvB,MAAM,EAAE,qBAAqB;EAC7B,MAAM,IAAI;IACP,WAAW;GACZ,IAAI,QAAW;AACb,WAAO,GAAG;;GAEZ,IAAI,MAAM,GAAM;AACd,MAAE,IAAI,EAAE;AACR,sBAAkB;;GAGpB,SAAS;GACT,mBAAmB;GACpB;AACD,MAAI,MAAM,OAAO;AACjB,SAAO;;CAIT,MAAM,IAAI,OAAO,MAAM;AAYvB,QAXU;GACP,WAAW;EACZ,IAAI,QAAW;AACb,UAAO,GAAG;;EAEZ,IAAI,MAAM,GAAM;AACd,KAAE,IAAI,EAAE;;EAGV,SAAS;EACV;;;;;AAOH,SAAgB,WAAc,OAAkB;AAC9C,QAAO,IAAI,MAAM;;;;;AAMnB,SAAgB,WAAc,GAAiB;CAC7C,MAAM,WAAW;AACjB,KAAI,SAAS,SAAS;EAEpB,MAAM,UAAU,SAAS,QAAQ,MAAM;AACvC,WAAS,QAAQ,IAAI,OAAe;AACpC,WAAS,QAAQ,IAAI,QAAQ;;AAE/B,KAAI,SAAS,kBACX,UAAS,mBAAmB;;;;;AAOhC,SAAgB,MAAM,KAA0B;AAC9C,QACE,QAAQ,QAAQ,OAAO,QAAQ,YAAa,IAAgC,cAAc;;;;;AAO9F,SAAgB,M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B,MAAM,SAAS,mBAAsB,IAAI;AACzC,cAAY,IAAI,IAAI,CAAC,CAAC,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC;AAC1C,MAAI,iBAAiB,WAAW,YAAY,CAAC;AAC7C;;CAGF,MAAM,SAAS,mBAAsB,IAAI;AACzC,aAAY,IAAI,IAAI,CAAC,CAAC,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC;;;;;AAM5C,SAAgB,OAAU,KAAsB,cAAiC;CAE/E,MAAM,QAAQ,WADF,mBAAsB,IAAI,CACT;AAC7B,QAAO,UAAU,SAAY,QAAQ;;;;;;AAgBvC,SAAgB,gBACd,SACgB;AAChB,KAAI,OAAO,YAAY,WACrB,QAAO;CAET,MAAM,QAAQ,UAAa;EACzB,MAAM,SAAS,QAAQ,MAAM,MAAM;AACnC,MAAI,OAAO,WAAW,WACpB,QAAQ,QAA6B;AAEvC,SAAO;;AAET,KAAI,QAAQ,KACV,QAAO,eAAe,MAAM,QAAQ,EAAE,OAAO,QAAQ,MAAM,CAAC;AAE9D,QAAO;;;;;AAoBT,SAAgB,UAAU,WAAwB,OAAoB;AACpE,QAAO,EACL,MAAM,IAAkC;EACtC,MAAM,YAAY,OAAO,OAAO,WAAW,SAAS,cAAc,GAAG,GAAG;AACxE,MAAI,CAAC,UACH,OAAM,IAAI,MAAM,6BAA6B,KAAK;AAGpD,SAAOC,MADO,QAAQ,WAAW,SAAS,KAAK,EACrB,UAAU;IAEvC"}
1
+ {"version":3,"file":"index.js","names":["pyreonComputed","pyreonNextTick","pyreonMount"],"sources":["../src/jsx-runtime.ts","../src/index.ts"],"sourcesContent":["/**\n * Compat JSX runtime for Vue compatibility mode.\n *\n * When `jsxImportSource` is redirected to `@pyreon/vue-compat` (via the vite\n * plugin's `compat: \"vue\"` 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 Vue-style re-renders on state change while Pyreon's\n * existing renderer handles all DOM work.\n *\n * Key difference from react/preact compat: the component body runs inside\n * `runUntracked` to prevent `.value` reads (which access underlying signals)\n * from being tracked by the reactive accessor. Only the version signal\n * triggers re-renders.\n */\n\nimport type { ComponentFn, Props, VNode, VNodeChild } from \"@pyreon/core\"\nimport { Fragment, h, onUnmount } 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 Vue'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// ─── Component wrapping ──────────────────────────────────────────────────────\n\n// biome-ignore lint/complexity/noBannedTypes: Function is needed for generic component wrapping\nconst _wrapperCache = new WeakMap<Function, ComponentFn>()\n\n// biome-ignore lint/complexity/noBannedTypes: Function is needed for generic component wrapping\nfunction wrapCompatComponent(vueComponent: Function): ComponentFn {\n let wrapped = _wrapperCache.get(vueComponent)\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 unmountCallbacks: [],\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 when component unmounts\n onUnmount(() => {\n ctx.unmounted = true\n for (const cb of ctx.unmountCallbacks) cb()\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 .value signal reads from being tracked by this accessor —\n // only the version signal should trigger re-renders\n const result = runUntracked(() => (vueComponent 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(vueComponent, 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 Vue-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 return h(type, propsWithKey, ...(childArray as VNodeChild[]))\n}\n\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n","/**\n * @pyreon/vue-compat\n *\n * Vue 3-compatible Composition API that runs on Pyreon's reactive engine,\n * using a hook-indexed re-render model.\n *\n * All stateful APIs (ref, computed, reactive, watch, lifecycle hooks, etc.)\n * use hook-indexing to persist state across re-renders. The component body\n * re-executes when state changes (driven by a version signal in the JSX\n * runtime), and hook-indexed calls return the same objects across renders.\n *\n * DIFFERENCES FROM VUE 3:\n * - `deep` option in watch() is ignored — Pyreon tracks dependencies automatically.\n * - `shallowReactive` uses per-property signals (still shallow, but Pyreon-flavored).\n * - `readonly` returns a Proxy that throws on set (not Vue's readonly proxy).\n * - `defineComponent` only supports Composition API (setup function), not Options API.\n * - Components re-execute their body on state change (hook-indexed re-render model).\n *\n * USAGE:\n * Replace `import { ref, computed, watch } from \"vue\"` with\n * `import { ref, computed, watch } from \"@pyreon/vue-compat\"`\n */\n\nimport type { ComponentFn, Props, VNodeChild } from \"@pyreon/core\"\nimport {\n createContext,\n Fragment,\n onMount,\n onUnmount,\n onUpdate,\n popContext,\n pushContext,\n h as pyreonH,\n useContext,\n} from \"@pyreon/core\"\nimport {\n createStore,\n effect,\n computed as pyreonComputed,\n nextTick as pyreonNextTick,\n type Signal,\n signal,\n} from \"@pyreon/reactivity\"\nimport { mount as pyreonMount } from \"@pyreon/runtime-dom\"\nimport { getCurrentCtx, getHookIndex } from \"./jsx-runtime\"\n\n// ─── Internal symbols ─────────────────────────────────────────────────────────\n\nconst V_IS_REF = Symbol(\"__v_isRef\")\nconst V_IS_READONLY = Symbol(\"__v_isReadonly\")\nconst V_RAW = Symbol(\"__v_raw\")\n\n// ─── Ref ──────────────────────────────────────────────────────────────────────\n\nexport interface Ref<T = unknown> {\n value: T\n readonly [V_IS_REF]: true\n}\n\n/**\n * Creates a reactive ref wrapping the given value.\n * Access via `.value` — reads track, writes trigger.\n *\n * Inside a component: hook-indexed. The setter also calls `scheduleRerender()`.\n * Outside a component: creates a standalone reactive ref.\n */\nexport function ref<T>(value: T): Ref<T> {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as Ref<T>\n\n const s = signal(value)\n const { scheduleRerender } = ctx\n const r = {\n [V_IS_REF]: true as const,\n get value(): T {\n return s()\n },\n set value(v: T) {\n s.set(v)\n scheduleRerender()\n },\n /** @internal — access underlying signal for triggerRef */\n _signal: s,\n _scheduleRerender: scheduleRerender,\n }\n ctx.hooks[idx] = r\n return r as Ref<T>\n }\n\n // Outside component\n const s = signal(value)\n const r = {\n [V_IS_REF]: true as const,\n get value(): T {\n return s()\n },\n set value(v: T) {\n s.set(v)\n },\n /** @internal — access underlying signal for triggerRef */\n _signal: s,\n }\n return r as Ref<T>\n}\n\n/**\n * Creates a shallow ref — same as `ref()` in Pyreon since signals are inherently shallow.\n */\nexport function shallowRef<T>(value: T): Ref<T> {\n return ref(value)\n}\n\n/**\n * Force trigger a ref's subscribers, even if the value hasn't changed.\n */\nexport function triggerRef<T>(r: Ref<T>): void {\n const internal = r as Ref<T> & { _signal: Signal<T>; _scheduleRerender?: () => void }\n if (internal._signal) {\n // Force notify by setting the same value with Object.is bypass\n const current = internal._signal.peek()\n internal._signal.set(undefined as T)\n internal._signal.set(current)\n }\n if (internal._scheduleRerender) {\n internal._scheduleRerender()\n }\n}\n\n/**\n * Returns `true` if the value is a ref (created by `ref()` or `computed()`).\n */\nexport function isRef(val: unknown): val is Ref {\n return (\n val !== null && typeof val === \"object\" && (val as Record<symbol, unknown>)[V_IS_REF] === true\n )\n}\n\n/**\n * Unwraps a ref: if it has `.value`, return `.value`; otherwise return as-is.\n */\nexport function unref<T>(r: T | Ref<T>): T {\n return isRef(r) ? r.value : r\n}\n\n// ─── Computed ─────────────────────────────────────────────────────────────────\n\nexport interface ComputedRef<T = unknown> extends Ref<T> {\n readonly value: T\n}\n\nexport interface WritableComputedRef<T = unknown> extends Ref<T> {\n value: T\n}\n\n/**\n * Creates a computed ref. Supports both readonly and writable forms.\n *\n * Inside a component: hook-indexed.\n */\nexport function computed<T>(getter: () => T): ComputedRef<T>\nexport function computed<T>(options: {\n get: () => T\n set: (value: T) => void\n}): WritableComputedRef<T>\nexport function computed<T>(\n fnOrOptions: (() => T) | { get: () => T; set: (value: T) => void },\n): ComputedRef<T> | WritableComputedRef<T> {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as ComputedRef<T>\n\n const getter = typeof fnOrOptions === \"function\" ? fnOrOptions : fnOrOptions.get\n const setter = typeof fnOrOptions === \"object\" ? fnOrOptions.set : undefined\n const c = pyreonComputed(getter)\n const { scheduleRerender } = ctx\n const r = {\n [V_IS_REF]: true as const,\n get value(): T {\n return c()\n },\n set value(v: T) {\n if (!setter) {\n throw new Error(\"Cannot set value of a computed ref — computed refs are readonly\")\n }\n setter(v)\n scheduleRerender()\n },\n }\n ctx.hooks[idx] = r\n return r as ComputedRef<T>\n }\n\n // Outside component\n const getter = typeof fnOrOptions === \"function\" ? fnOrOptions : fnOrOptions.get\n const setter = typeof fnOrOptions === \"object\" ? fnOrOptions.set : undefined\n const c = pyreonComputed(getter)\n const r = {\n [V_IS_REF]: true as const,\n get value(): T {\n return c()\n },\n set value(v: T) {\n if (!setter) {\n throw new Error(\"Cannot set value of a computed ref — computed refs are readonly\")\n }\n setter(v)\n },\n }\n return r as ComputedRef<T>\n}\n\n// ─── Reactive / Readonly ──────────────────────────────────────────────────────\n\n// WeakMap to track raw objects behind reactive proxies\nconst rawMap = new WeakMap<object, object>()\n\n/**\n * Creates a deeply reactive proxy from a plain object.\n * Backed by Pyreon's `createStore()`.\n *\n * Inside a component: hook-indexed. Proxy wrapper intercepts sets to\n * call `scheduleRerender()`.\n */\nexport function reactive<T extends object>(obj: T): T {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as T\n\n const proxy = createStore(obj)\n rawMap.set(proxy as object, obj)\n const { scheduleRerender } = ctx\n const wrapped = new Proxy(proxy, {\n set(target, key, value, receiver) {\n const result = Reflect.set(target, key, value, receiver)\n scheduleRerender()\n return result\n },\n deleteProperty(target, key) {\n const result = Reflect.deleteProperty(target, key)\n scheduleRerender()\n return result\n },\n })\n rawMap.set(wrapped as object, obj)\n ctx.hooks[idx] = wrapped\n return wrapped as T\n }\n\n // Outside component\n const proxy = createStore(obj)\n rawMap.set(proxy as object, obj)\n return proxy\n}\n\n/**\n * Creates a shallow reactive proxy — same as `reactive()` in Pyreon.\n */\nexport function shallowReactive<T extends object>(obj: T): T {\n return reactive(obj)\n}\n\n/**\n * Returns a readonly proxy that throws on mutation attempts.\n *\n * Inside a component: hook-indexed.\n */\nexport function readonly<T extends object>(obj: T): Readonly<T> {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as Readonly<T>\n\n const proxy = _createReadonlyProxy(obj)\n ctx.hooks[idx] = proxy\n return proxy\n }\n\n return _createReadonlyProxy(obj)\n}\n\nfunction _createReadonlyProxy<T extends object>(obj: T): Readonly<T> {\n const proxy = new Proxy(obj, {\n get(target, key) {\n if (key === V_IS_READONLY) return true\n if (key === V_RAW) return target\n return Reflect.get(target, key)\n },\n set(_target, key) {\n // Internal symbols used for identification are allowed\n if (key === V_IS_READONLY || key === V_RAW) return true\n throw new Error(`Cannot set property \"${String(key)}\" on a readonly object`)\n },\n deleteProperty(_target, key) {\n throw new Error(`Cannot delete property \"${String(key)}\" from a readonly object`)\n },\n })\n return proxy as Readonly<T>\n}\n\n/**\n * Returns the raw (unwrapped) object behind a reactive or readonly proxy.\n */\nexport function toRaw<T extends object>(proxy: T): T {\n // Check readonly first\n const readonlyRaw = (proxy as Record<symbol, unknown>)[V_RAW]\n if (readonlyRaw) return readonlyRaw as T\n // Check reactive\n const raw = rawMap.get(proxy as object)\n return (raw as T) ?? proxy\n}\n\n// ─── toRef / toRefs ───────────────────────────────────────────────────────────\n\n/**\n * Creates a ref linked to a property of a reactive object.\n * Reading/writing the ref's `.value` reads/writes the original property.\n *\n * Inside a component: hook-indexed.\n */\nexport function toRef<T extends object, K extends keyof T>(obj: T, key: K): Ref<T[K]> {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as Ref<T[K]>\n\n const r = _createToRef(obj, key)\n ctx.hooks[idx] = r\n return r\n }\n\n return _createToRef(obj, key)\n}\n\nfunction _createToRef<T extends object, K extends keyof T>(obj: T, key: K): Ref<T[K]> {\n const r = {\n [V_IS_REF]: true as const,\n get value(): T[K] {\n return obj[key]\n },\n set value(newValue: T[K]) {\n obj[key] = newValue\n },\n }\n return r as Ref<T[K]>\n}\n\n/**\n * Converts all properties of a reactive object into individual refs.\n * Each ref is linked to the original property (not a copy).\n *\n * Inside a component: hook-indexed (the entire result, not individual refs).\n */\nexport function toRefs<T extends object>(obj: T): { [K in keyof T]: Ref<T[K]> } {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as { [K in keyof T]: Ref<T[K]> }\n\n const result = {} as { [K in keyof T]: Ref<T[K]> }\n for (const key of Object.keys(obj) as (keyof T)[]) {\n // Create refs directly (not via exported toRef) to avoid extra hook index consumption\n result[key] = _createToRef(obj, key)\n }\n ctx.hooks[idx] = result\n return result\n }\n\n const result = {} as { [K in keyof T]: Ref<T[K]> }\n for (const key of Object.keys(obj) as (keyof T)[]) {\n result[key] = _createToRef(obj, key)\n }\n return result\n}\n\n// ─── Watch ────────────────────────────────────────────────────────────────────\n\nexport interface WatchOptions {\n /** Call the callback immediately with current value. Default: false */\n immediate?: boolean\n /** Ignored in Pyreon — dependencies are tracked automatically. */\n deep?: boolean\n}\n\ntype WatchSource<T> = Ref<T> | (() => T)\n\n/**\n * Watches a reactive source and calls `cb` when it changes.\n *\n * Inside a component: hook-indexed, created once. Disposed on unmount.\n */\nexport function watch<T>(\n source: WatchSource<T>,\n cb: (newValue: T, oldValue: T | undefined) => void,\n options?: WatchOptions,\n): () => void {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as () => void\n\n const getter = isRef(source) ? () => source.value : (source as () => T)\n let oldValue: T | undefined\n let initialized = false\n\n if (options?.immediate) {\n oldValue = undefined\n const current = getter()\n cb(current, oldValue)\n oldValue = current\n initialized = true\n }\n\n let running = false\n const e = effect(() => {\n if (running) return\n running = true\n try {\n const newValue = getter()\n if (initialized) {\n cb(newValue, oldValue)\n }\n oldValue = newValue\n initialized = true\n } finally {\n running = false\n }\n })\n\n const stop = () => e.dispose()\n ctx.hooks[idx] = stop\n ctx.unmountCallbacks.push(stop)\n return stop\n }\n\n // Outside component\n const getter = isRef(source) ? () => source.value : (source as () => T)\n let oldValue: T | undefined\n let initialized = false\n\n if (options?.immediate) {\n oldValue = undefined\n const current = getter()\n cb(current, oldValue)\n oldValue = current\n initialized = true\n }\n\n let running = false\n const e = effect(() => {\n if (running) return\n running = true\n try {\n const newValue = getter()\n if (initialized) {\n cb(newValue, oldValue)\n }\n oldValue = newValue\n initialized = true\n } finally {\n running = false\n }\n })\n\n return () => e.dispose()\n}\n\n/**\n * Runs the given function reactively — re-executes whenever its tracked\n * dependencies change.\n *\n * Inside a component: hook-indexed, created once. Disposed on unmount.\n */\nexport function watchEffect(fn: () => void): () => void {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return ctx.hooks[idx] as () => void\n\n let running = false\n const e = effect(() => {\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 stop\n }\n\n let running = false\n const e = effect(() => {\n if (running) return\n running = true\n try {\n fn()\n } finally {\n running = false\n }\n })\n return () => e.dispose()\n}\n\n// ─── Lifecycle ────────────────────────────────────────────────────────────────\n\n/**\n * Registers a callback to run after the component is mounted.\n * Hook-indexed: only registered on first render.\n */\nexport function onMounted(fn: () => void): void {\n const ctx = getCurrentCtx()\n if (!ctx) {\n // Fallback: use Pyreon's lifecycle directly (e.g., inside defineComponent without jsx-runtime)\n onMount(() => {\n fn()\n })\n return\n }\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return // Already registered\n ctx.hooks[idx] = true\n // Schedule to run after render via microtask\n ctx.pendingEffects.push({\n fn: () => {\n fn()\n return undefined\n },\n deps: [],\n cleanup: undefined,\n })\n}\n\n/**\n * Registers a callback to run when the component is unmounted.\n * Hook-indexed: only registered on first render.\n */\nexport function onUnmounted(fn: () => void): void {\n const ctx = getCurrentCtx()\n if (!ctx) {\n onUnmount(fn)\n return\n }\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return // Already registered\n ctx.hooks[idx] = true\n ctx.unmountCallbacks.push(fn)\n}\n\n/**\n * Registers a callback to run after a reactive update (not on initial mount).\n * Hook-indexed: registered once, fires on each re-render.\n */\nexport function onUpdated(fn: () => void): void {\n const ctx = getCurrentCtx()\n if (!ctx) {\n onUpdate(fn)\n return\n }\n const idx = getHookIndex()\n if (idx >= ctx.hooks.length) {\n // First render — just mark as registered, don't fire\n ctx.hooks[idx] = true\n return\n }\n // Re-render — schedule the callback\n ctx.pendingEffects.push({\n fn: () => {\n fn()\n return undefined\n },\n deps: undefined,\n cleanup: undefined,\n })\n}\n\n/**\n * Registers a callback to run before mount.\n * In Pyreon there is no pre-mount phase — maps to `onMounted()`.\n */\nexport function onBeforeMount(fn: () => void): void {\n onMounted(fn)\n}\n\n/**\n * Registers a callback to run before unmount.\n * In Pyreon there is no pre-unmount phase — maps to `onUnmounted()`.\n */\nexport function onBeforeUnmount(fn: () => void): void {\n onUnmounted(fn)\n}\n\n// ─── nextTick ─────────────────────────────────────────────────────────────────\n\n/**\n * Returns a Promise that resolves after all pending reactive updates have flushed.\n */\nexport function nextTick(): Promise<void> {\n return pyreonNextTick()\n}\n\n// ─── Provide / Inject ─────────────────────────────────────────────────────────\n\n// Registry of string/symbol keys to Pyreon context objects (created lazily)\nconst _contextRegistry = new Map<string | symbol, ReturnType<typeof createContext>>()\n\nfunction getOrCreateContext<T>(key: string | symbol, defaultValue?: T) {\n if (!_contextRegistry.has(key)) {\n _contextRegistry.set(key, createContext<T>(defaultValue as T))\n }\n return _contextRegistry.get(key) as ReturnType<typeof createContext<T>>\n}\n\n/**\n * Provides a value to all descendant components.\n *\n * Inside a component: hook-indexed, pushed once. Popped on unmount.\n */\nexport function provide<T>(key: string | symbol, value: T): void {\n const ctx = getCurrentCtx()\n if (ctx) {\n const idx = getHookIndex()\n if (idx < ctx.hooks.length) return // Already provided\n ctx.hooks[idx] = true\n const vueCtx = getOrCreateContext<T>(key)\n pushContext(new Map([[vueCtx.id, value]]))\n ctx.unmountCallbacks.push(() => popContext())\n return\n }\n // Outside component — use Pyreon's provide directly\n const vueCtx = getOrCreateContext<T>(key)\n pushContext(new Map([[vueCtx.id, value]]))\n}\n\n/**\n * Injects a value provided by an ancestor component.\n */\nexport function inject<T>(key: string | symbol, defaultValue?: T): T | undefined {\n const ctx = getOrCreateContext<T>(key)\n const value = useContext(ctx)\n return value !== undefined ? value : defaultValue\n}\n\n// ─── defineComponent ──────────────────────────────────────────────────────────\n\ninterface ComponentOptions<P extends Props = Props> {\n /** The setup function — called once during component initialization. */\n setup: (props: P) => (() => VNodeChild) | VNodeChild\n /** Optional name for debugging. */\n name?: string\n}\n\n/**\n * Defines a component using Vue 3 Composition API style.\n * Only supports the `setup()` function — Options API is not supported.\n */\nexport function defineComponent<P extends Props = Props>(\n options: ComponentOptions<P> | ((props: P) => VNodeChild),\n): ComponentFn<P> {\n if (typeof options === \"function\") {\n return options as ComponentFn<P>\n }\n const comp = (props: P) => {\n const result = options.setup(props)\n if (typeof result === \"function\") {\n return (result as () => VNodeChild)()\n }\n return result\n }\n if (options.name) {\n Object.defineProperty(comp, \"name\", { value: options.name })\n }\n return comp as ComponentFn<P>\n}\n\n// ─── h ────────────────────────────────────────────────────────────────────────\n\n/**\n * Re-export of Pyreon's `h()` function for creating VNodes.\n */\nexport { Fragment, pyreonH as h }\n\n// ─── createApp ────────────────────────────────────────────────────────────────\n\ninterface App {\n /** Mount the application into a DOM element. Returns an unmount function. */\n mount(el: string | Element): () => void\n}\n\n/**\n * Creates a Pyreon application instance — Vue 3 `createApp()` compatible.\n */\nexport function createApp(component: ComponentFn, props?: Props): App {\n return {\n mount(el: string | Element): () => void {\n const container = typeof el === \"string\" ? document.querySelector(el) : el\n if (!container) {\n throw new Error(`Cannot find mount target: ${el}`)\n }\n const vnode = pyreonH(component, props ?? null)\n return pyreonMount(vnode, container)\n },\n }\n}\n\n// ─── Additional re-exports ────────────────────────────────────────────────────\n\nexport { batch } from \"@pyreon/reactivity\"\n"],"mappings":";;;;;AA4CA,IAAI,cAAoC;AACxC,IAAI,aAAa;AAEjB,SAAgB,gBAAsC;AACpD,QAAO;;AAGT,SAAgB,eAAuB;AACrC,QAAO;;;;;ACJT,MAAM,WAAW,OAAO,YAAY;AACpC,MAAM,gBAAgB,OAAO,iBAAiB;AAC9C,MAAM,QAAQ,OAAO,UAAU;;;;;;;;AAgB/B,SAAgB,IAAO,OAAkB;CACvC,MAAM,MAAM,eAAe;AAC3B,KAAI,KAAK;EACP,MAAM,MAAM,cAAc;AAC1B,MAAI,MAAM,IAAI,MAAM,OAAQ,QAAO,IAAI,MAAM;EAE7C,MAAM,IAAI,OAAO,MAAM;EACvB,MAAM,EAAE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QAAQ,MAAM,MAAM;AACnC,MAAI,OAAO,WAAW,WACpB,QAAQ,QAA6B;AAEvC,SAAO;;AAET,KAAI,QAAQ,KACV,QAAO,eAAe,MAAM,QAAQ,EAAE,OAAO,QAAQ,MAAM,CAAC;AAE9D,QAAO;;;;;AAoBT,SAAgB,UAAU,WAAwB,OAAoB;AACpE,QAAO,EACL,MAAM,IAAkC;EACtC,MAAM,YAAY,OAAO,OAAO,WAAW,SAAS,cAAc,GAAG,GAAG;AACxE,MAAI,CAAC,UACH,OAAM,IAAI,MAAM,6BAA6B,KAAK;AAGpD,SAAOC,MADO,QAAQ,WAAW,SAAS,KAAK,EACrB,UAAU;IAEvC"}
@@ -1,503 +1,166 @@
1
- import { Fragment, createContext, h as pyreonH, onMount, onUnmount, onUpdate, popContext, pushContext, useContext } from "@pyreon/core";
2
- import { batch, computed as computed$1, createStore, effect, nextTick as nextTick$1, signal } from "@pyreon/reactivity";
3
- import { mount } from "@pyreon/runtime-dom";
4
-
5
- //#region src/jsx-runtime.ts
6
-
7
- function getCurrentCtx() {
8
- return _currentCtx;
9
- }
10
- function getHookIndex() {
11
- return _hookIndex++;
12
- }
13
-
14
- //#endregion
15
- //#region src/index.ts
16
-
17
- /**
18
- * Creates a reactive ref wrapping the given value.
19
- * Access via `.value` — reads track, writes trigger.
20
- *
21
- * Inside a component: hook-indexed. The setter also calls `scheduleRerender()`.
22
- * Outside a component: creates a standalone reactive ref.
23
- */
24
- function ref(value) {
25
- const ctx = getCurrentCtx();
26
- if (ctx) {
27
- const idx = getHookIndex();
28
- if (idx < ctx.hooks.length) return ctx.hooks[idx];
29
- const s = signal(value);
30
- const {
31
- scheduleRerender
32
- } = ctx;
33
- const r = {
34
- [V_IS_REF]: true,
35
- get value() {
36
- return s();
37
- },
38
- set value(v) {
39
- s.set(v);
40
- scheduleRerender();
41
- },
42
- _signal: s,
43
- _scheduleRerender: scheduleRerender
44
- };
45
- ctx.hooks[idx] = r;
46
- return r;
47
- }
48
- const s = signal(value);
49
- return {
50
- [V_IS_REF]: true,
51
- get value() {
52
- return s();
53
- },
54
- set value(v) {
55
- s.set(v);
56
- },
57
- _signal: s
58
- };
59
- }
60
- /**
61
- * Creates a shallow ref — same as `ref()` in Pyreon since signals are inherently shallow.
62
- */
63
- function shallowRef(value) {
64
- return ref(value);
65
- }
66
- /**
67
- * Force trigger a ref's subscribers, even if the value hasn't changed.
68
- */
69
- function triggerRef(r) {
70
- const internal = r;
71
- if (internal._signal) {
72
- const current = internal._signal.peek();
73
- internal._signal.set(void 0);
74
- internal._signal.set(current);
75
- }
76
- if (internal._scheduleRerender) internal._scheduleRerender();
77
- }
78
- /**
79
- * Returns `true` if the value is a ref (created by `ref()` or `computed()`).
80
- */
81
- function isRef(val) {
82
- return val !== null && typeof val === "object" && val[V_IS_REF] === true;
83
- }
84
- /**
85
- * Unwraps a ref: if it has `.value`, return `.value`; otherwise return as-is.
86
- */
87
- function unref(r) {
88
- return isRef(r) ? r.value : r;
89
- }
90
- function computed(fnOrOptions) {
91
- const ctx = getCurrentCtx();
92
- if (ctx) {
93
- const idx = getHookIndex();
94
- if (idx < ctx.hooks.length) return ctx.hooks[idx];
95
- const getter = typeof fnOrOptions === "function" ? fnOrOptions : fnOrOptions.get;
96
- const setter = typeof fnOrOptions === "object" ? fnOrOptions.set : void 0;
97
- const c = computed$1(getter);
98
- const {
99
- scheduleRerender
100
- } = ctx;
101
- const r = {
102
- [V_IS_REF]: true,
103
- get value() {
104
- return c();
105
- },
106
- set value(v) {
107
- if (!setter) throw new Error("Cannot set value of a computed ref — computed refs are readonly");
108
- setter(v);
109
- scheduleRerender();
110
- }
111
- };
112
- ctx.hooks[idx] = r;
113
- return r;
114
- }
115
- const getter = typeof fnOrOptions === "function" ? fnOrOptions : fnOrOptions.get;
116
- const setter = typeof fnOrOptions === "object" ? fnOrOptions.set : void 0;
117
- const c = computed$1(getter);
118
- return {
119
- [V_IS_REF]: true,
120
- get value() {
121
- return c();
122
- },
123
- set value(v) {
124
- if (!setter) throw new Error("Cannot set value of a computed ref — computed refs are readonly");
125
- setter(v);
126
- }
127
- };
128
- }
129
- /**
130
- * Creates a deeply reactive proxy from a plain object.
131
- * Backed by Pyreon's `createStore()`.
132
- *
133
- * Inside a component: hook-indexed. Proxy wrapper intercepts sets to
134
- * call `scheduleRerender()`.
135
- */
136
- function reactive(obj) {
137
- const ctx = getCurrentCtx();
138
- if (ctx) {
139
- const idx = getHookIndex();
140
- if (idx < ctx.hooks.length) return ctx.hooks[idx];
141
- const proxy = createStore(obj);
142
- rawMap.set(proxy, obj);
143
- const {
144
- scheduleRerender
145
- } = ctx;
146
- const wrapped = new Proxy(proxy, {
147
- set(target, key, value, receiver) {
148
- const result = Reflect.set(target, key, value, receiver);
149
- scheduleRerender();
150
- return result;
151
- },
152
- deleteProperty(target, key) {
153
- const result = Reflect.deleteProperty(target, key);
154
- scheduleRerender();
155
- return result;
156
- }
157
- });
158
- rawMap.set(wrapped, obj);
159
- ctx.hooks[idx] = wrapped;
160
- return wrapped;
161
- }
162
- const proxy = createStore(obj);
163
- rawMap.set(proxy, obj);
164
- return proxy;
165
- }
166
- /**
167
- * Creates a shallow reactive proxy — same as `reactive()` in Pyreon.
168
- */
169
- function shallowReactive(obj) {
170
- return reactive(obj);
171
- }
172
- /**
173
- * Returns a readonly proxy that throws on mutation attempts.
174
- *
175
- * Inside a component: hook-indexed.
176
- */
177
- function readonly(obj) {
178
- const ctx = getCurrentCtx();
179
- if (ctx) {
180
- const idx = getHookIndex();
181
- if (idx < ctx.hooks.length) return ctx.hooks[idx];
182
- const proxy = _createReadonlyProxy(obj);
183
- ctx.hooks[idx] = proxy;
184
- return proxy;
185
- }
186
- return _createReadonlyProxy(obj);
187
- }
188
- function _createReadonlyProxy(obj) {
189
- return new Proxy(obj, {
190
- get(target, key) {
191
- if (key === V_IS_READONLY) return true;
192
- if (key === V_RAW) return target;
193
- return Reflect.get(target, key);
194
- },
195
- set(_target, key) {
196
- if (key === V_IS_READONLY || key === V_RAW) return true;
197
- throw new Error(`Cannot set property "${String(key)}" on a readonly object`);
198
- },
199
- deleteProperty(_target, key) {
200
- throw new Error(`Cannot delete property "${String(key)}" from a readonly object`);
201
- }
202
- });
203
- }
204
- /**
205
- * Returns the raw (unwrapped) object behind a reactive or readonly proxy.
206
- */
207
- function toRaw(proxy) {
208
- const readonlyRaw = proxy[V_RAW];
209
- if (readonlyRaw) return readonlyRaw;
210
- return rawMap.get(proxy) ?? proxy;
211
- }
212
- /**
213
- * Creates a ref linked to a property of a reactive object.
214
- * Reading/writing the ref's `.value` reads/writes the original property.
215
- *
216
- * Inside a component: hook-indexed.
217
- */
218
- function toRef(obj, key) {
219
- const ctx = getCurrentCtx();
220
- if (ctx) {
221
- const idx = getHookIndex();
222
- if (idx < ctx.hooks.length) return ctx.hooks[idx];
223
- const r = _createToRef(obj, key);
224
- ctx.hooks[idx] = r;
225
- return r;
226
- }
227
- return _createToRef(obj, key);
228
- }
229
- function _createToRef(obj, key) {
230
- return {
231
- [V_IS_REF]: true,
232
- get value() {
233
- return obj[key];
234
- },
235
- set value(newValue) {
236
- obj[key] = newValue;
237
- }
238
- };
239
- }
240
- /**
241
- * Converts all properties of a reactive object into individual refs.
242
- * Each ref is linked to the original property (not a copy).
243
- *
244
- * Inside a component: hook-indexed (the entire result, not individual refs).
245
- */
246
- function toRefs(obj) {
247
- const ctx = getCurrentCtx();
248
- if (ctx) {
249
- const idx = getHookIndex();
250
- if (idx < ctx.hooks.length) return ctx.hooks[idx];
251
- const result = {};
252
- for (const key of Object.keys(obj)) result[key] = _createToRef(obj, key);
253
- ctx.hooks[idx] = result;
254
- return result;
255
- }
256
- const result = {};
257
- for (const key of Object.keys(obj)) result[key] = _createToRef(obj, key);
258
- return result;
259
- }
260
- /**
261
- * Watches a reactive source and calls `cb` when it changes.
262
- *
263
- * Inside a component: hook-indexed, created once. Disposed on unmount.
264
- */
265
- function watch(source, cb, options) {
266
- const ctx = getCurrentCtx();
267
- if (ctx) {
268
- const idx = getHookIndex();
269
- if (idx < ctx.hooks.length) return ctx.hooks[idx];
270
- const getter = isRef(source) ? () => source.value : source;
271
- let oldValue;
272
- let initialized = false;
273
- if (options?.immediate) {
274
- oldValue = void 0;
275
- const current = getter();
276
- cb(current, oldValue);
277
- oldValue = current;
278
- initialized = true;
279
- }
280
- let running = false;
281
- const e = effect(() => {
282
- if (running) return;
283
- running = true;
284
- try {
285
- const newValue = getter();
286
- if (initialized) cb(newValue, oldValue);
287
- oldValue = newValue;
288
- initialized = true;
289
- } finally {
290
- running = false;
291
- }
292
- });
293
- const stop = () => e.dispose();
294
- ctx.hooks[idx] = stop;
295
- ctx.unmountCallbacks.push(stop);
296
- return stop;
297
- }
298
- const getter = isRef(source) ? () => source.value : source;
299
- let oldValue;
300
- let initialized = false;
301
- if (options?.immediate) {
302
- oldValue = void 0;
303
- const current = getter();
304
- cb(current, oldValue);
305
- oldValue = current;
306
- initialized = true;
307
- }
308
- let running = false;
309
- const e = effect(() => {
310
- if (running) return;
311
- running = true;
312
- try {
313
- const newValue = getter();
314
- if (initialized) cb(newValue, oldValue);
315
- oldValue = newValue;
316
- initialized = true;
317
- } finally {
318
- running = false;
319
- }
320
- });
321
- return () => e.dispose();
322
- }
323
- /**
324
- * Runs the given function reactively — re-executes whenever its tracked
325
- * dependencies change.
326
- *
327
- * Inside a component: hook-indexed, created once. Disposed on unmount.
328
- */
329
- function watchEffect(fn) {
330
- const ctx = getCurrentCtx();
331
- if (ctx) {
332
- const idx = getHookIndex();
333
- if (idx < ctx.hooks.length) return ctx.hooks[idx];
334
- let running = false;
335
- const e = effect(() => {
336
- if (running) return;
337
- running = true;
338
- try {
339
- fn();
340
- } finally {
341
- running = false;
342
- }
343
- });
344
- const stop = () => e.dispose();
345
- ctx.hooks[idx] = stop;
346
- ctx.unmountCallbacks.push(stop);
347
- return stop;
348
- }
349
- let running = false;
350
- const e = effect(() => {
351
- if (running) return;
352
- running = true;
353
- try {
354
- fn();
355
- } finally {
356
- running = false;
357
- }
358
- });
359
- return () => e.dispose();
360
- }
361
- /**
362
- * Registers a callback to run after the component is mounted.
363
- * Hook-indexed: only registered on first render.
364
- */
365
- function onMounted(fn) {
366
- const ctx = getCurrentCtx();
367
- if (!ctx) {
368
- onMount(() => {
369
- fn();
370
- });
371
- return;
372
- }
373
- const idx = getHookIndex();
374
- if (idx < ctx.hooks.length) return;
375
- ctx.hooks[idx] = true;
376
- ctx.pendingEffects.push({
377
- fn: () => {
378
- fn();
379
- },
380
- deps: [],
381
- cleanup: void 0
382
- });
383
- }
384
- /**
385
- * Registers a callback to run when the component is unmounted.
386
- * Hook-indexed: only registered on first render.
387
- */
388
- function onUnmounted(fn) {
389
- const ctx = getCurrentCtx();
390
- if (!ctx) {
391
- onUnmount(fn);
392
- return;
393
- }
394
- const idx = getHookIndex();
395
- if (idx < ctx.hooks.length) return;
396
- ctx.hooks[idx] = true;
397
- ctx.unmountCallbacks.push(fn);
398
- }
399
- /**
400
- * Registers a callback to run after a reactive update (not on initial mount).
401
- * Hook-indexed: registered once, fires on each re-render.
402
- */
403
- function onUpdated(fn) {
404
- const ctx = getCurrentCtx();
405
- if (!ctx) {
406
- onUpdate(fn);
407
- return;
408
- }
409
- const idx = getHookIndex();
410
- if (idx >= ctx.hooks.length) {
411
- ctx.hooks[idx] = true;
412
- return;
413
- }
414
- ctx.pendingEffects.push({
415
- fn: () => {
416
- fn();
417
- },
418
- deps: void 0,
419
- cleanup: void 0
420
- });
421
- }
422
- /**
423
- * Registers a callback to run before mount.
424
- * In Pyreon there is no pre-mount phase — maps to `onMounted()`.
425
- */
426
- function onBeforeMount(fn) {
427
- onMounted(fn);
428
- }
429
- /**
430
- * Registers a callback to run before unmount.
431
- * In Pyreon there is no pre-unmount phase — maps to `onUnmounted()`.
432
- */
433
- function onBeforeUnmount(fn) {
434
- onUnmounted(fn);
435
- }
436
- /**
437
- * Returns a Promise that resolves after all pending reactive updates have flushed.
438
- */
439
- function nextTick() {
440
- return nextTick$1();
441
- }
442
- function getOrCreateContext(key, defaultValue) {
443
- if (!_contextRegistry.has(key)) _contextRegistry.set(key, createContext(defaultValue));
444
- return _contextRegistry.get(key);
445
- }
446
- /**
447
- * Provides a value to all descendant components.
448
- *
449
- * Inside a component: hook-indexed, pushed once. Popped on unmount.
450
- */
451
- function provide(key, value) {
452
- const ctx = getCurrentCtx();
453
- if (ctx) {
454
- const idx = getHookIndex();
455
- if (idx < ctx.hooks.length) return;
456
- ctx.hooks[idx] = true;
457
- const vueCtx = getOrCreateContext(key);
458
- pushContext(new Map([[vueCtx.id, value]]));
459
- ctx.unmountCallbacks.push(() => popContext());
460
- return;
461
- }
462
- const vueCtx = getOrCreateContext(key);
463
- pushContext(new Map([[vueCtx.id, value]]));
464
- }
465
- /**
466
- * Injects a value provided by an ancestor component.
467
- */
468
- function inject(key, defaultValue) {
469
- const value = useContext(getOrCreateContext(key));
470
- return value !== void 0 ? value : defaultValue;
471
- }
472
- /**
473
- * Defines a component using Vue 3 Composition API style.
474
- * Only supports the `setup()` function — Options API is not supported.
475
- */
476
- function defineComponent(options) {
477
- if (typeof options === "function") return options;
478
- const comp = props => {
479
- const result = options.setup(props);
480
- if (typeof result === "function") return result();
481
- return result;
482
- };
483
- if (options.name) Object.defineProperty(comp, "name", {
484
- value: options.name
485
- });
486
- return comp;
487
- }
488
- /**
489
- * Creates a Pyreon application instance — Vue 3 `createApp()` compatible.
490
- */
491
- function createApp(component, props) {
492
- return {
493
- mount(el) {
494
- const container = typeof el === "string" ? document.querySelector(el) : el;
495
- if (!container) throw new Error(`Cannot find mount target: ${el}`);
496
- return mount(pyreonH(component, props ?? null), container);
497
- }
498
- };
499
- }
1
+ import { ComponentFn, Fragment, Props, VNodeChild, h as pyreonH } from "@pyreon/core";
2
+ import { batch } from "@pyreon/reactivity";
500
3
 
4
+ //#region src/index.d.ts
5
+ declare const V_IS_REF: unique symbol;
6
+ interface Ref<T = unknown> {
7
+ value: T;
8
+ readonly [V_IS_REF]: true;
9
+ }
10
+ /**
11
+ * Creates a reactive ref wrapping the given value.
12
+ * Access via `.value` — reads track, writes trigger.
13
+ *
14
+ * Inside a component: hook-indexed. The setter also calls `scheduleRerender()`.
15
+ * Outside a component: creates a standalone reactive ref.
16
+ */
17
+ declare function ref<T>(value: T): Ref<T>;
18
+ /**
19
+ * Creates a shallow ref — same as `ref()` in Pyreon since signals are inherently shallow.
20
+ */
21
+ declare function shallowRef<T>(value: T): Ref<T>;
22
+ /**
23
+ * Force trigger a ref's subscribers, even if the value hasn't changed.
24
+ */
25
+ declare function triggerRef<T>(r: Ref<T>): void;
26
+ /**
27
+ * Returns `true` if the value is a ref (created by `ref()` or `computed()`).
28
+ */
29
+ declare function isRef(val: unknown): val is Ref;
30
+ /**
31
+ * Unwraps a ref: if it has `.value`, return `.value`; otherwise return as-is.
32
+ */
33
+ declare function unref<T>(r: T | Ref<T>): T;
34
+ interface ComputedRef<T = unknown> extends Ref<T> {
35
+ readonly value: T;
36
+ }
37
+ interface WritableComputedRef<T = unknown> extends Ref<T> {
38
+ value: T;
39
+ }
40
+ /**
41
+ * Creates a computed ref. Supports both readonly and writable forms.
42
+ *
43
+ * Inside a component: hook-indexed.
44
+ */
45
+ declare function computed<T>(getter: () => T): ComputedRef<T>;
46
+ declare function computed<T>(options: {
47
+ get: () => T;
48
+ set: (value: T) => void;
49
+ }): WritableComputedRef<T>;
50
+ /**
51
+ * Creates a deeply reactive proxy from a plain object.
52
+ * Backed by Pyreon's `createStore()`.
53
+ *
54
+ * Inside a component: hook-indexed. Proxy wrapper intercepts sets to
55
+ * call `scheduleRerender()`.
56
+ */
57
+ declare function reactive<T extends object>(obj: T): T;
58
+ /**
59
+ * Creates a shallow reactive proxy — same as `reactive()` in Pyreon.
60
+ */
61
+ declare function shallowReactive<T extends object>(obj: T): T;
62
+ /**
63
+ * Returns a readonly proxy that throws on mutation attempts.
64
+ *
65
+ * Inside a component: hook-indexed.
66
+ */
67
+ declare function readonly<T extends object>(obj: T): Readonly<T>;
68
+ /**
69
+ * Returns the raw (unwrapped) object behind a reactive or readonly proxy.
70
+ */
71
+ declare function toRaw<T extends object>(proxy: T): T;
72
+ /**
73
+ * Creates a ref linked to a property of a reactive object.
74
+ * Reading/writing the ref's `.value` reads/writes the original property.
75
+ *
76
+ * Inside a component: hook-indexed.
77
+ */
78
+ declare function toRef<T extends object, K extends keyof T>(obj: T, key: K): Ref<T[K]>;
79
+ /**
80
+ * Converts all properties of a reactive object into individual refs.
81
+ * Each ref is linked to the original property (not a copy).
82
+ *
83
+ * Inside a component: hook-indexed (the entire result, not individual refs).
84
+ */
85
+ declare function toRefs<T extends object>(obj: T): { [K in keyof T]: Ref<T[K]> };
86
+ interface WatchOptions {
87
+ /** Call the callback immediately with current value. Default: false */
88
+ immediate?: boolean;
89
+ /** Ignored in Pyreon — dependencies are tracked automatically. */
90
+ deep?: boolean;
91
+ }
92
+ type WatchSource<T> = Ref<T> | (() => T);
93
+ /**
94
+ * Watches a reactive source and calls `cb` when it changes.
95
+ *
96
+ * Inside a component: hook-indexed, created once. Disposed on unmount.
97
+ */
98
+ declare function watch<T>(source: WatchSource<T>, cb: (newValue: T, oldValue: T | undefined) => void, options?: WatchOptions): () => void;
99
+ /**
100
+ * Runs the given function reactively — re-executes whenever its tracked
101
+ * dependencies change.
102
+ *
103
+ * Inside a component: hook-indexed, created once. Disposed on unmount.
104
+ */
105
+ declare function watchEffect(fn: () => void): () => void;
106
+ /**
107
+ * Registers a callback to run after the component is mounted.
108
+ * Hook-indexed: only registered on first render.
109
+ */
110
+ declare function onMounted(fn: () => void): void;
111
+ /**
112
+ * Registers a callback to run when the component is unmounted.
113
+ * Hook-indexed: only registered on first render.
114
+ */
115
+ declare function onUnmounted(fn: () => void): void;
116
+ /**
117
+ * Registers a callback to run after a reactive update (not on initial mount).
118
+ * Hook-indexed: registered once, fires on each re-render.
119
+ */
120
+ declare function onUpdated(fn: () => void): void;
121
+ /**
122
+ * Registers a callback to run before mount.
123
+ * In Pyreon there is no pre-mount phase — maps to `onMounted()`.
124
+ */
125
+ declare function onBeforeMount(fn: () => void): void;
126
+ /**
127
+ * Registers a callback to run before unmount.
128
+ * In Pyreon there is no pre-unmount phase — maps to `onUnmounted()`.
129
+ */
130
+ declare function onBeforeUnmount(fn: () => void): void;
131
+ /**
132
+ * Returns a Promise that resolves after all pending reactive updates have flushed.
133
+ */
134
+ declare function nextTick(): Promise<void>;
135
+ /**
136
+ * Provides a value to all descendant components.
137
+ *
138
+ * Inside a component: hook-indexed, pushed once. Popped on unmount.
139
+ */
140
+ declare function provide<T>(key: string | symbol, value: T): void;
141
+ /**
142
+ * Injects a value provided by an ancestor component.
143
+ */
144
+ declare function inject<T>(key: string | symbol, defaultValue?: T): T | undefined;
145
+ interface ComponentOptions<P extends Props = Props> {
146
+ /** The setup function — called once during component initialization. */
147
+ setup: (props: P) => (() => VNodeChild) | VNodeChild;
148
+ /** Optional name for debugging. */
149
+ name?: string;
150
+ }
151
+ /**
152
+ * Defines a component using Vue 3 Composition API style.
153
+ * Only supports the `setup()` function — Options API is not supported.
154
+ */
155
+ declare function defineComponent<P extends Props = Props>(options: ComponentOptions<P> | ((props: P) => VNodeChild)): ComponentFn<P>;
156
+ interface App {
157
+ /** Mount the application into a DOM element. Returns an unmount function. */
158
+ mount(el: string | Element): () => void;
159
+ }
160
+ /**
161
+ * Creates a Pyreon application instance — Vue 3 `createApp()` compatible.
162
+ */
163
+ declare function createApp(component: ComponentFn, props?: Props): App;
501
164
  //#endregion
502
- export { Fragment, batch, computed, createApp, defineComponent, pyreonH as h, inject, isRef, nextTick, onBeforeMount, onBeforeUnmount, onMounted, onUnmounted, onUpdated, provide, reactive, readonly, ref, shallowReactive, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, watch, watchEffect };
503
- //# sourceMappingURL=index.d.ts.map
165
+ export { ComputedRef, Fragment, Ref, WatchOptions, WritableComputedRef, batch, computed, createApp, defineComponent, pyreonH as h, inject, isRef, nextTick, onBeforeMount, onBeforeUnmount, onMounted, onUnmounted, onUpdated, provide, reactive, readonly, ref, shallowReactive, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, watch, watchEffect };
166
+ //# sourceMappingURL=index2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["pyreonComputed","pyreonNextTick","pyreonMount"],"sources":["../../../src/jsx-runtime.ts","../../../src/index.ts"],"mappings":";;;;;;AA+CA,SAAgB,aAAA,CAAA,EAAsC;EACpD,OAAO,WAAA;;AAGT,SAAgB,YAAA,CAAA,EAAuB;EACrC,OAAO,UAAA,EAAA;;;;;;;;;;;;;ACcT,SAAgB,GAAA,CAAO,KAAA,EAAkB;EACvC,MAAM,GAAA,GAAM,aAAA,CAAA,CAAe;EAC3B,IAAI,GAAA,EAAK;IACP,MAAM,GAAA,GAAM,YAAA,CAAA,CAAc;IAC1B,IAAI,GAAA,GAAM,GAAA,CAAI,KAAA,CAAM,MAAA,EAAQ,OAAO,GAAA,CAAI,KAAA,CAAM,GAAA,CAAA;IAE7C,MAAM,CAAA,GAAI,MAAA,CAAO,KAAA,CAAM;IACvB,MAAM;MAAE;IAAA,CAAA,GAAqB,GAAA;IAC7B,MAAM,CAAA,GAAI;OACP,QAAA,GAAW,IAAA;MACZ,IAAI,KAAA,CAAA,EAAW;QACb,OAAO,CAAA,CAAA,CAAG;;MAEZ,IAAI,KAAA,CAAM,CAAA,EAAM;QACd,CAAA,CAAE,GAAA,CAAI,CAAA,CAAE;QACR,gBAAA,CAAA,CAAkB;;MAGpB,OAAA,EAAS,CAAA;MACT,iBAAA,EAAmB;KACpB;IACD,GAAA,CAAI,KAAA,CAAM,GAAA,CAAA,GAAO,CAAA;IACjB,OAAO,CAAA;;EAIT,MAAM,CAAA,GAAI,MAAA,CAAO,KAAA,CAAM;EAYvB,OAXU;KACP,QAAA,GAAW,IAAA;IACZ,IAAI,KAAA,CAAA,EAAW;MACb,OAAO,CAAA,CAAA,CAAG;;IAEZ,IAAI,KAAA,CAAM,CAAA,EAAM;MACd,CAAA,CAAE,GAAA,C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al } from "@pyreon/reactivity";
1
+ import { ComponentFn, Fragment, Props, VNode, VNodeChild } from "@pyreon/core";
3
2
 
4
- //#region src/jsx-runtime.ts
5
-
6
- function beginRender(ctx) {
7
- _currentCtx = ctx;
8
- _hookIndex = 0;
9
- ctx.pendingEffects = [];
10
- ctx.pendingLayoutEffects = [];
11
- }
12
- function endRender() {
13
- _currentCtx = null;
14
- _hookIndex = 0;
15
- }
16
- function runLayoutEffects(entries) {
17
- for (const entry of entries) {
18
- if (entry.cleanup) entry.cleanup();
19
- const cleanup = entry.fn();
20
- entry.cleanup = typeof cleanup === "function" ? cleanup : void 0;
21
- }
22
- }
23
- function scheduleEffects(ctx, entries) {
24
- if (entries.length === 0) return;
25
- queueMicrotask(() => {
26
- for (const entry of entries) {
27
- if (ctx.unmounted) return;
28
- if (entry.cleanup) entry.cleanup();
29
- const cleanup = entry.fn();
30
- entry.cleanup = typeof cleanup === "function" ? cleanup : void 0;
31
- }
32
- });
33
- }
34
- function wrapCompatComponent(vueComponent) {
35
- let wrapped = _wrapperCache.get(vueComponent);
36
- if (wrapped) return wrapped;
37
- wrapped = props => {
38
- const ctx = {
39
- hooks: [],
40
- scheduleRerender: () => {},
41
- pendingEffects: [],
42
- pendingLayoutEffects: [],
43
- unmounted: false,
44
- unmountCallbacks: []
45
- };
46
- const version = signal(0);
47
- let updateScheduled = false;
48
- ctx.scheduleRerender = () => {
49
- if (ctx.unmounted || updateScheduled) return;
50
- updateScheduled = true;
51
- queueMicrotask(() => {
52
- updateScheduled = false;
53
- if (!ctx.unmounted) version.set(version.peek() + 1);
54
- });
55
- };
56
- onUnmount(() => {
57
- ctx.unmounted = true;
58
- for (const cb of ctx.unmountCallbacks) cb();
59
- });
60
- return () => {
61
- version();
62
- beginRender(ctx);
63
- const result = runUntracked(() => vueComponent(props));
64
- const layoutEffects = ctx.pendingLayoutEffects;
65
- const effects = ctx.pendingEffects;
66
- endRender();
67
- runLayoutEffects(layoutEffects);
68
- scheduleEffects(ctx, effects);
69
- return result;
70
- };
71
- };
72
- _wrapperCache.set(vueComponent, wrapped);
73
- return wrapped;
74
- }
75
- function jsx(type, props, key) {
76
- const {
77
- children,
78
- ...rest
79
- } = props;
80
- const propsWithKey = key != null ? {
81
- ...rest,
82
- key
83
- } : rest;
84
- if (typeof type === "function") return h(wrapCompatComponent(type), children !== void 0 ? {
85
- ...propsWithKey,
86
- children
87
- } : propsWithKey);
88
- return h(type, propsWithKey, ...(children === void 0 ? [] : Array.isArray(children) ? children : [children]));
89
- }
3
+ //#region src/jsx-runtime.d.ts
4
+ declare function jsx(type: string | ComponentFn | symbol, props: Props & {
5
+ children?: VNodeChild | VNodeChild[];
6
+ }, key?: string | number | null): VNode;
7
+ declare const jsxs: typeof jsx;
90
8
  //#endregion
91
9
  export { Fragment, jsx, jsxs };
92
- //# sourceMappingURL=jsx-runtime.d.ts.map
10
+ //# sourceMappingURL=jsx-runtime2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-runtime.d.ts","names":[],"sources":["../../../src/jsx-runtime.ts"],"mappings":";;;;;AAuDA,SAAgB,WAAA,CAAY,GAAA,EAA0B;EACpD,WAAA,GAAc,GAAA;EACd,UAAA,GAAa,CAAA;EACb,GAAA,CAAI,cAAA,GAAiB,EAAE;EACvB,GAAA,CAAI,oBAAA,GAAuB,EAAE;;AAG/B,SAAgB,SAAA,CAAA,EAAkB;EAChC,WAAA,GAAc,IAAA;EACd,UAAA,GAAa,CAAA;;AAKf,SAAS,gBAAA,CAAiB,OAAA,EAA8B;EACtD,KAAK,MAAM,KAAA,IAAS,OAAA,EAAS;IAC3B,IAAI,KAAA,CAAM,OAAA,EAAS,KAAA,CAAM,OAAA,CAAA,CAAS;IAClC,MAAM,OAAA,GAAU,KAAA,CAAM,EAAA,CAAA,CAAI;IAC1B,KAAA,CAAM,OAAA,GAAU,OAAO,OAAA,KAAY,UAAA,GAAa,OAAA,GAAU,KAAA,CAAA;;;AAI9D,SAAS,eAAA,CAAgB,GAAA,EA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AAA,cAiBU,IAAA,SAAI,GAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyreon/vue-compat",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
4
4
  "description": "Vue 3-compatible Composition API shim for Pyreon — write Vue-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.7",
53
+ "@pyreon/reactivity": "^0.5.7",
54
+ "@pyreon/runtime-dom": "^0.5.7"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@happy-dom/global-registrator": "^20.8.3",
package/src/index.ts CHANGED
@@ -521,7 +521,6 @@ export function onMounted(fn: () => void): void {
521
521
  // Fallback: use Pyreon's lifecycle directly (e.g., inside defineComponent without jsx-runtime)
522
522
  onMount(() => {
523
523
  fn()
524
- return undefined
525
524
  })
526
525
  return
527
526
  }