@askrjs/askr 0.0.1
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/LICENSE +201 -0
- package/README.md +298 -0
- package/dist/chunk-4CV4JOE5.js +27 -0
- package/dist/chunk-4CV4JOE5.js.map +1 -0
- package/dist/chunk-HIWJVOS4.js +503 -0
- package/dist/chunk-HIWJVOS4.js.map +1 -0
- package/dist/chunk-L7RL4LYV.js +3442 -0
- package/dist/chunk-L7RL4LYV.js.map +1 -0
- package/dist/chunk-UUM5W2RM.js +84 -0
- package/dist/chunk-UUM5W2RM.js.map +1 -0
- package/dist/chunk-YNH3D4KW.js +29 -0
- package/dist/chunk-YNH3D4KW.js.map +1 -0
- package/dist/index.cjs +4733 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +446 -0
- package/dist/index.d.ts +446 -0
- package/dist/index.js +683 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx/jsx-dev-runtime.cjs +40 -0
- package/dist/jsx/jsx-dev-runtime.cjs.map +1 -0
- package/dist/jsx/jsx-dev-runtime.d.cts +16 -0
- package/dist/jsx/jsx-dev-runtime.d.ts +16 -0
- package/dist/jsx/jsx-dev-runtime.js +16 -0
- package/dist/jsx/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx/jsx-runtime.cjs +45 -0
- package/dist/jsx/jsx-runtime.cjs.map +1 -0
- package/dist/jsx/jsx-runtime.d.cts +17 -0
- package/dist/jsx/jsx-runtime.d.ts +17 -0
- package/dist/jsx/jsx-runtime.js +14 -0
- package/dist/jsx/jsx-runtime.js.map +1 -0
- package/dist/navigate-NLQOZQGM.js +16 -0
- package/dist/navigate-NLQOZQGM.js.map +1 -0
- package/dist/route-TVYWYCEJ.js +31 -0
- package/dist/route-TVYWYCEJ.js.map +1 -0
- package/dist/ssr-4ELUFK65.js +24 -0
- package/dist/ssr-4ELUFK65.js.map +1 -0
- package/dist/types-DUDmnzD8.d.cts +38 -0
- package/dist/types-DUDmnzD8.d.ts +38 -0
- package/package.json +83 -0
- package/src/jsx/jsx-dev-runtime.ts +26 -0
- package/src/jsx/jsx-runtime.ts +36 -0
- package/src/jsx/react-jsx-runtime.d.ts +0 -0
- package/src/jsx/types.ts +27 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/state.ts","../src/index.ts","../src/runtime/operations.ts","../src/runtime/resource_cell.ts","../src/app/createApp.ts","../src/router/layouts.ts","../src/components/Link.tsx"],"sourcesContent":["/**\n * State primitive for Askr components\n * Optimized for minimal overhead and fast updates\n *\n * INVARIANTS ENFORCED:\n * - state() only callable during component render (currentInstance exists)\n * - state() called at top-level only (indices must be monotonically increasing)\n * - state values persist across re-renders (stored in stateValues array)\n * - state.set() cannot be called during render (causes infinite loops)\n * - state.set() always enqueues through scheduler (never direct mutation)\n * - state.set() callback (notifyUpdate) always available\n */\n\nimport { globalScheduler } from './scheduler';\nimport {\n getCurrentInstance,\n getNextStateIndex,\n type ComponentInstance,\n} from './component';\nimport { invariant } from '../dev/invariant';\nimport { isBulkCommitActive } from './fastlane';\n\n/**\n * State value holder - callable to read, has set method to update\n * @example\n * const count = state(0);\n * count(); // read: 0\n * count.set(1); // write: triggers re-render\n */\nexport interface State<T> {\n (): T;\n set(value: T): void;\n _hasBeenRead?: boolean; // Internal: track if state has been read during render\n _readers?: Map<ComponentInstance, number>; // Internal: map of readers -> last committed token\n}\n\n/**\n * Creates a local state value for a component\n * Optimized for:\n * - O(1) read performance\n * - Minimal allocation per state\n * - Fast scheduler integration\n *\n * IMPORTANT: state() must be called during component render execution.\n * It captures the current component instance from context.\n * Calling outside a component function will throw an error.\n *\n * @example\n * ```ts\n * // ✅ Correct: called during render\n * export function Counter() {\n * const count = state(0);\n * return { type: 'button', children: [count()] };\n * }\n *\n * // ❌ Wrong: called outside component\n * const count = state(0);\n * export function BadComponent() {\n * return { type: 'div' };\n * }\n * ```\n */\nexport function state<T>(initialValue: T): State<T> {\n // INVARIANT: state() must be called during component render\n const instance = getCurrentInstance();\n if (!instance) {\n throw new Error(\n 'state() can only be called during component render execution. ' +\n 'Move state() calls to the top level of your component function.'\n );\n }\n\n const index = getNextStateIndex();\n const stateValues = instance.stateValues;\n\n // INVARIANT: Detect conditional state() calls by validating index order\n // If indices go backward, state() was called conditionally\n if (index < instance.stateIndexCheck) {\n throw new Error(\n `State index violation: state() call at index ${index}, ` +\n `but previously saw index ${instance.stateIndexCheck}. ` +\n `This happens when state() is called conditionally (inside if/for/etc). ` +\n `Move all state() calls to the top level of your component function, ` +\n `before any conditionals.`\n );\n }\n\n // INVARIANT: stateIndexCheck advances monotonically\n invariant(\n index >= instance.stateIndexCheck,\n '[State] State indices must increase monotonically'\n );\n instance.stateIndexCheck = index;\n\n // INVARIANT: On subsequent renders, validate that state calls happen in same order\n if (instance.firstRenderComplete) {\n // Check if this index was expected based on first render\n if (!instance.expectedStateIndices.includes(index)) {\n throw new Error(\n `Hook order violation: state() called at index ${index}, ` +\n `but this index was not in the first render's sequence [${instance.expectedStateIndices.join(', ')}]. ` +\n `This usually means state() is inside a conditional or loop. ` +\n `Move all state() calls to the top level of your component function.`\n );\n }\n } else {\n // First render - record this index in the expected sequence\n instance.expectedStateIndices.push(index);\n }\n\n // INVARIANT: Reuse existing state if it exists (fast path on re-renders)\n // This ensures state identity and persistence and enforces ownership stability\n if (stateValues[index]) {\n const existing = stateValues[index] as State<T> & {\n _owner?: ComponentInstance;\n };\n // Ownership must be stable: the state cell belongs to the instance that\n // created it and must never change. This checks for accidental reuse.\n if (existing._owner !== instance) {\n throw new Error(\n `State ownership violation: state() called at index ${index} is owned by a different component instance. ` +\n `State ownership is positional and immutable.`\n );\n }\n return existing as State<T>;\n }\n\n // Create new state (slow path, only on first render) — delegated to helper\n const cell = createStateCell(initialValue, instance);\n\n // INVARIANT: Store state in instance for persistence across renders\n stateValues[index] = cell;\n\n return cell;\n}\n\n/**\n * Internal helper: create the backing state cell (value + readers + set semantics)\n * This extraction makes it easier to later split hook wiring from storage.\n */\nfunction createStateCell<T>(\n initialValue: T,\n instance: ComponentInstance\n): State<T> {\n let value = initialValue;\n\n // Per-state reader map: component -> last-committed render token\n const readers = new Map<ComponentInstance, number>();\n\n // Use a function as the state object (callable directly)\n function read(): T {\n (read as State<T>)._hasBeenRead = true;\n\n // Record that the current instance read this state during its in-progress render\n const inst = getCurrentInstance();\n if (inst && inst._currentRenderToken !== undefined) {\n if (!inst._pendingReadStates) inst._pendingReadStates = new Set();\n inst._pendingReadStates.add(read as State<T>);\n }\n\n return value;\n }\n\n // Attach the readers map to the callable so other runtime parts can access it\n (read as State<T>)._readers = readers;\n\n // Record explicit ownership of this state cell. Ownership is the component\n // instance that created the state cell and must never change for the life\n // of the cell. We expose this for runtime invariant checks/tests.\n (read as unknown as { _owner?: ComponentInstance })._owner = instance;\n\n // Attach set method directly to function\n read.set = (newValue: T): void => {\n // INVARIANT: State cannot be mutated during component render\n // (when currentInstance is non-null). It must be scheduled for consistency.\n // NOTE: Skip invariant checks in production for graceful degradation\n const currentInst = getCurrentInstance();\n if (currentInst !== null && process.env.NODE_ENV !== 'production') {\n throw new Error(\n `[Askr] state.set() cannot be called during component render. ` +\n `State mutations during render break the actor model and cause infinite loops. ` +\n `Move state updates to event handlers or use conditional rendering instead.`\n );\n }\n\n // PRODUCTION FALLBACK: Skip state updates during render to prevent infinite loops\n if (currentInst !== null && process.env.NODE_ENV === 'production') {\n return;\n }\n\n // Skip work if value didn't change\n if (Object.is(value, newValue)) return;\n\n // If a bulk commit is active, update backing value only and DO NOT notify or enqueue.\n // Bulk commits must be side-effect silent with respect to runtime notifications.\n if (isBulkCommitActive()) {\n // In bulk commit mode we must be side-effect free: update backing\n // value only and do not notify, enqueue, or log.\n value = newValue;\n return;\n }\n\n // INVARIANT: Update the value\n value = newValue;\n\n // notifyUpdate may be temporarily unavailable (e.g. during hydration).\n // We intentionally avoid logging here to keep the state mutation path\n // side-effect free. The scheduler will process updates when the system\n // is stable.\n\n // After value change, notify only components that *read* this state in their last committed render\n const readersMap = (read as State<T>)._readers as\n | Map<ComponentInstance, number>\n | undefined;\n if (readersMap) {\n for (const [subInst, token] of readersMap) {\n // Only notify if the component's last committed render token matches the token recorded\n // when it last read this state. This ensures we only wake components that actually\n // observed the state in their most recent render.\n if (subInst.lastRenderToken !== token) continue;\n if (!subInst.hasPendingUpdate) {\n // Log enqueue decision for subInst\n\n subInst.hasPendingUpdate = true;\n const subTask = subInst._pendingFlushTask;\n if (subTask) globalScheduler.enqueue(subTask);\n else\n globalScheduler.enqueue(() => {\n subInst.hasPendingUpdate = false;\n subInst.notifyUpdate?.();\n });\n }\n }\n }\n\n // OPTIMIZATION: Batch state updates from the same component within the same event loop tick\n // Only enqueue the owner component if it actually read this state during its last committed render\n const readersMapForOwner = readersMap;\n const ownerRecordedToken = readersMapForOwner?.get(instance);\n const ownerShouldEnqueue =\n // Normal case: owner read this state in last committed render\n ownerRecordedToken !== undefined &&\n instance.lastRenderToken === ownerRecordedToken;\n\n if (ownerShouldEnqueue && !instance.hasPendingUpdate) {\n instance.hasPendingUpdate = true;\n // INVARIANT: All state updates go through scheduler\n // Use prebound task to avoid allocating a closure per update\n // Fallback to a safe closure if the prebound task is not present\n const task = instance._pendingFlushTask;\n if (task) globalScheduler.enqueue(task);\n else\n globalScheduler.enqueue(() => {\n instance.hasPendingUpdate = false;\n instance.notifyUpdate?.();\n });\n }\n };\n\n return read as State<T>;\n}\n","/**\n * Askr: Actor-backed deterministic UI framework\n *\n * Public API surface — only users should import from here\n */\n\n// Runtime primitives\nexport { state } from './runtime/state';\nexport type { State } from './runtime/state';\nexport { getSignal } from './runtime/component';\nexport { scheduleEventHandler } from './runtime/scheduler';\n\n// Context (spec-defined, currently stubbed)\nexport { defineContext, readContext } from './runtime/context';\nexport type { Context } from './runtime/context';\n\n// Bindings (spec-defined, currently stubbed)\nexport { resource } from './runtime/operations';\nexport type { DataResult } from './runtime/operations';\n\n// App bootstrap (explicit startup APIs)\nexport {\n createApp,\n createIsland,\n createSPA,\n hydrateSPA,\n cleanupApp,\n hasApp,\n} from './app/createApp';\nexport type {\n IslandConfig,\n SPAConfig,\n HydrateSPAConfig,\n} from './app/createApp';\n\n// Routing\n// Public render-time accessor: route() (also supports route registration when called with args)\nexport {\n route,\n setServerLocation,\n type RouteSnapshot,\n type RouteMatch,\n} from './router/route';\nexport { layout } from './router/layouts';\n// Keep route registration utilities available under a distinct name to avoid\n// collision with the render-time accessor.\nexport {\n clearRoutes,\n getRoutes,\n getNamespaceRoutes,\n unloadNamespace,\n getLoadedNamespaces,\n} from './router/route';\nexport { navigate } from './router/navigate';\nexport type { Route, RouteHandler } from './router/route';\n\n// Components\nexport { Link } from './components/Link';\nexport type { LinkProps } from './components/Link';\n\n// Standard library helpers are unstable and not re-exported from core.\n\n// SSR - Server-side rendering (sync-only APIs)\nexport {\n renderToStringSync,\n renderToStringSyncForUrl,\n renderToString,\n renderToStream,\n collectResources,\n resolveResources,\n} from './ssr';\n\n// Re-export JSX runtime for tsconfig jsxImportSource\nexport { jsx, jsxs, Fragment } from './jsx/jsx-runtime';\n\n// Expose common APIs to globalThis for test-suite compatibility (legacy test patterns)\n// These are safe to export globally and make migrating tests simpler.\nimport { route, getRoutes } from './router/route';\nimport { navigate } from './router/navigate';\nimport {\n createApp,\n createIsland,\n createSPA,\n hydrateSPA,\n} from './app/createApp';\n\nif (typeof globalThis !== 'undefined') {\n const g = globalThis as unknown as Record<string, unknown>;\n if (!g.createApp) g.createApp = createApp;\n if (!g.createIsland) g.createIsland = createIsland;\n if (!g.createSPA) g.createSPA = createSPA;\n if (!g.hydrateSPA) g.hydrateSPA = hydrateSPA;\n if (!g.route) g.route = route;\n if (!g.getRoutes) g.getRoutes = getRoutes;\n if (!g.navigate) g.navigate = navigate;\n}\n\n// Public types\nexport type { Props } from './shared/types';\n","import {\n getCurrentComponentInstance,\n registerMountOperation,\n type ComponentInstance,\n} from './component';\nimport { getCurrentContextFrame } from './context';\nimport { ResourceCell } from './resource_cell';\nimport { state } from './state';\nimport { getDeriveCache } from '../shared/derive_cache';\nimport {\n getCurrentSSRContext,\n throwSSRDataMissing,\n SSRDataMissingError,\n} from '../ssr/context';\nimport { getCurrentRenderData, getNextKey } from '../ssr/data';\n\n// Memoization cache for derive() (centralized)\n\nexport interface DataResult<T> {\n value: T | null;\n pending: boolean;\n error: Error | null;\n refresh(): void;\n}\n\n/**\n * Resource primitive — simple, deterministic async primitive\n * Usage: resource(fn, deps)\n * - fn receives { signal }\n * - captures execution context once at creation (synchronous step only)\n * - executes at most once per generation; stale async results are ignored\n * - refresh() cancels in-flight execution, increments generation and re-runs\n * - exposes { value, pending, error, refresh }\n * - during SSR, async results are disallowed and will throw synchronously\n */\nexport function resource<T>(\n fn: (opts: { signal: AbortSignal }) => Promise<T> | T,\n deps: unknown[] = []\n): DataResult<T> {\n const instance = getCurrentComponentInstance();\n // Create a non-null alias early so it can be used in nested closures\n // without TypeScript complaining about possible null access.\n const inst = instance as ComponentInstance;\n\n if (!instance) {\n // If we're in a synchronous SSR render that has resolved data, use it.\n const renderData = getCurrentRenderData();\n if (renderData) {\n const key = getNextKey();\n if (!(key in renderData)) {\n throwSSRDataMissing();\n }\n const val = renderData[key] as T;\n return {\n value: val,\n pending: false,\n error: null,\n refresh: () => {},\n } as DataResult<T>;\n }\n\n // If we are in an SSR render pass without supplied data, throw for clarity.\n const ssrCtx = getCurrentSSRContext();\n if (ssrCtx) {\n throwSSRDataMissing();\n }\n\n // No active component instance and not in SSR render with data. Return a\n // pending snapshot for non-SSR usage (e.g., runtime usage outside render).\n return {\n value: null,\n pending: true,\n error: null,\n refresh: () => {},\n } as DataResult<T>;\n }\n\n // Internal ResourceCell — pure state machine now moved to its own module\n // to keep component wiring separate and ensure no component access here.\n // (See ./resource_cell.ts)\n\n // If we're in a synchronous SSR render that was supplied resolved data, use it\n const renderData = getCurrentRenderData();\n if (renderData) {\n // Deterministic key generation: the collection step and render step use\n // the same incremental key generation to align resources.\n const key = getNextKey();\n if (!(key in renderData)) {\n throwSSRDataMissing();\n }\n\n // Commit synchronous value from render data and return a stable snapshot\n const val = renderData[key] as T;\n\n const holder = state<{ cell?: ResourceCell<T>; snapshot: DataResult<T> }>({\n cell: undefined,\n snapshot: {\n value: val,\n pending: false,\n error: null,\n refresh: () => {},\n },\n });\n\n const h = holder();\n h.snapshot.value = val;\n h.snapshot.pending = false;\n h.snapshot.error = null;\n holder.set(h);\n return h.snapshot;\n }\n\n // Persist a holder so the snapshot identity is stable across renders.\n const holder = state<{ cell?: ResourceCell<T>; snapshot: DataResult<T> }>({\n cell: undefined,\n snapshot: {\n value: null,\n pending: true,\n error: null,\n refresh: () => {},\n },\n });\n\n const h = holder();\n\n // Initialize cell on first call\n if (!h.cell) {\n const frame = getCurrentContextFrame();\n const cell = new ResourceCell<T>(fn, deps, frame);\n h.cell = cell;\n h.snapshot = cell.snapshot as DataResult<T>;\n\n // Subscribe and schedule component updates when cell changes\n const unsubscribe = cell.subscribe(() => {\n const cur = holder();\n cur.snapshot.value = cell.snapshot.value;\n cur.snapshot.pending = cell.snapshot.pending;\n cur.snapshot.error = cell.snapshot.error;\n holder.set(cur);\n try {\n inst._enqueueRun?.();\n } catch {\n // ignore\n }\n });\n\n // Cleanup on unmount\n inst.cleanupFns.push(() => {\n unsubscribe();\n cell.abort();\n });\n\n // Start immediately (not tied to mount timing); SSR will throw if async\n try {\n // Avoid notifying subscribers synchronously during render — update\n // holder.snapshot in-place instead to prevent state.set() during render.\n cell.start(inst.ssr ?? false, false);\n // If the run completed synchronously, reflect the result into the holder\n if (!cell.pending) {\n const cur = holder();\n cur.snapshot.value = cell.value;\n cur.snapshot.pending = cell.pending;\n cur.snapshot.error = cell.error;\n // Do not call holder.set() here — we are still in render; the host\n // component will read the snapshot immediately.\n }\n } catch (err) {\n if (err instanceof SSRDataMissingError) throw err;\n // Synchronous error — reflect into snapshot\n cell.error = err as Error;\n cell.pending = false;\n const cur = holder();\n cur.snapshot.value = cell.value;\n cur.snapshot.pending = cell.pending;\n cur.snapshot.error = cell.error;\n // Do not call holder.set() here for the same reason as above\n }\n }\n\n const cell = h.cell!;\n\n // Detect dependency changes and refresh immediately\n const depsChanged =\n !cell.deps ||\n cell.deps.length !== deps.length ||\n cell.deps.some((d, i) => d !== deps[i]);\n\n if (depsChanged) {\n cell.deps = deps.slice();\n cell.generation++;\n cell.pending = true;\n cell.error = null;\n try {\n cell.start(inst.ssr ?? false, false);\n if (!cell.pending) {\n const cur = holder();\n cur.snapshot.value = cell.value;\n cur.snapshot.pending = cell.pending;\n cur.snapshot.error = cell.error;\n }\n } catch (err) {\n if (err instanceof SSRDataMissingError) throw err;\n cell.error = err as Error;\n cell.pending = false;\n const cur = holder();\n cur.snapshot.value = cell.value;\n cur.snapshot.pending = cell.pending;\n cur.snapshot.error = cell.error;\n }\n }\n\n // Return the stable snapshot object owned by the cell\n return h.snapshot;\n}\n\nexport function derive<TIn, TOut>(\n source:\n | { value: TIn | null; pending?: boolean; error?: Error | null }\n | TIn\n | (() => TIn),\n map: (value: TIn) => TOut\n): TOut | null {\n // Extract the actual value\n let value: TIn;\n if (typeof source === 'function' && !('value' in source)) {\n // It's a function (not a binding object with value property)\n value = (source as () => TIn)();\n } else {\n value = (source as { value?: TIn | null })?.value ?? (source as TIn);\n }\n if (value == null) return null;\n\n // Get or create memoization cache for this component\n const instance = getCurrentComponentInstance();\n if (!instance) {\n // No component context - just compute eagerly\n return map(value as TIn);\n }\n\n // Get or create the cache map for this component\n const cache = getDeriveCache(instance);\n\n // Check if we already have a cached result for this source value\n if (cache.has(value)) {\n return cache.get(value) as TOut;\n }\n\n // Compute and cache the result\n const result = map(value as TIn);\n cache.set(value, result);\n return result;\n}\n\nexport function on(\n target: EventTarget,\n event: string,\n handler: EventListener\n): void {\n const ownerIsRoot = getCurrentComponentInstance()?.isRoot ?? false;\n // Register the listener to be attached on mount. If the owner is not the\n // root app instance, fail loudly to prevent silent no-op behavior.\n registerMountOperation(() => {\n if (!ownerIsRoot) {\n throw new Error('[Askr] on() may only be used in root components');\n }\n target.addEventListener(event, handler);\n // Return cleanup function\n return () => {\n target.removeEventListener(event, handler);\n };\n });\n}\n\nexport function timer(intervalMs: number, fn: () => void): void {\n const ownerIsRoot = getCurrentComponentInstance()?.isRoot ?? false;\n // Register the timer to be started on mount. Fail loudly when used outside\n // of the root component to avoid silent no-ops.\n registerMountOperation(() => {\n if (!ownerIsRoot) {\n throw new Error('[Askr] timer() may only be used in root components');\n }\n const id = setInterval(fn, intervalMs);\n // Return cleanup function\n return () => {\n clearInterval(id);\n };\n });\n}\n\nexport function stream<T>(\n _source: unknown,\n _options?: Record<string, unknown>\n): { value: T | null; pending: boolean; error: Error | null } {\n // Stub implementation: no-op.\n return { value: null, pending: true, error: null };\n}\n\nexport function task(\n fn: () => void | (() => void) | Promise<void | (() => void)>\n): void {\n const ownerIsRoot = getCurrentComponentInstance()?.isRoot ?? false;\n // Register the task to run on mount. Fail loudly when used outside the root\n // component so callers get immediate feedback rather than silent no-op.\n registerMountOperation(async () => {\n if (!ownerIsRoot) {\n throw new Error('[Askr] task() may only be used in root components');\n }\n // Execute the task (may be async) and return its cleanup\n return await fn();\n });\n}\n\n/**\n * Capture the result of a synchronous expression at call time and return a\n * thunk that returns the captured value later. This is a low-level helper for\n * cases where async continuations need to observe a snapshot of values at the\n * moment scheduling occurred.\n *\n * Usage (public API):\n * const snapshot = capture(() => someState());\n * Promise.resolve().then(() => { use(snapshot()); });\n */\nexport function capture<T>(fn: () => T): () => T {\n const value = fn();\n return () => value;\n}\n","import { withAsyncResourceContext, type ContextFrame } from './context';\nimport { logger } from '../dev/logger';\nimport { throwSSRDataMissing } from '../ssr/context';\n\n/**\n * Pure, component-agnostic ResourceCell state machine.\n * - Holds value/pending/error/generation/controller\n * - Exposes a stable `snapshot` object: { value, pending, error, refresh }\n * - Uses `withAsyncResourceContext` to bind the synchronous execution step\n * to a captured frame. Continuations after await do not see the frame.\n */\nexport class ResourceCell<U> {\n value: U | null = null;\n pending = true;\n error: Error | null = null;\n generation = 0;\n controller: AbortController | null = null;\n deps: unknown[] | null = null;\n resourceFrame: ContextFrame | null = null;\n\n private subscribers = new Set<() => void>();\n\n readonly snapshot: {\n value: U | null;\n pending: boolean;\n error: Error | null;\n refresh: () => void;\n };\n\n private readonly fn: (opts: { signal: AbortSignal }) => Promise<U> | U;\n\n constructor(\n fn: (opts: { signal: AbortSignal }) => Promise<U> | U,\n deps: unknown[] | null,\n resourceFrame: ContextFrame | null\n ) {\n this.fn = fn;\n this.deps = deps ? deps.slice() : null;\n this.resourceFrame = resourceFrame;\n this.snapshot = {\n value: null,\n pending: true,\n error: null,\n refresh: () => this.refresh(),\n };\n }\n\n subscribe(cb: () => void): () => void {\n this.subscribers.add(cb);\n return () => this.subscribers.delete(cb);\n }\n\n private notifySubscribers() {\n this.snapshot.value = this.value;\n this.snapshot.pending = this.pending;\n this.snapshot.error = this.error;\n for (const cb of this.subscribers) cb();\n }\n\n start(ssr = false, notify = true) {\n const generation = this.generation;\n\n this.controller?.abort();\n const controller = new AbortController();\n this.controller = controller;\n this.pending = true;\n this.error = null;\n if (notify) this.notifySubscribers();\n\n let result: Promise<U> | U;\n try {\n // Execute only the synchronous step inside the frozen resource frame.\n result = withAsyncResourceContext(this.resourceFrame, () =>\n this.fn({ signal: controller.signal })\n );\n } catch (err) {\n this.pending = false;\n this.error = err as Error;\n if (notify) this.notifySubscribers();\n return;\n }\n\n if (!(result instanceof Promise)) {\n this.value = result as U;\n this.pending = false;\n this.error = null;\n if (notify) this.notifySubscribers();\n return;\n }\n\n if (ssr) {\n // During SSR async results are disallowed\n throwSSRDataMissing();\n }\n\n (result as Promise<U>)\n .then((val) => {\n if (this.generation !== generation) return;\n if (this.controller !== controller) return;\n this.value = val;\n this.pending = false;\n this.error = null;\n this.notifySubscribers();\n })\n .catch((err) => {\n if (this.generation !== generation) return;\n this.pending = false;\n this.error = err as Error;\n try {\n logger.error('[Askr] Async resource error:', err);\n } catch {\n /* ignore logging errors */\n }\n this.notifySubscribers();\n });\n }\n\n refresh() {\n this.generation++;\n this.controller?.abort();\n this.start();\n }\n\n abort() {\n this.controller?.abort();\n }\n}\n","/**\n * App bootstrap and mount\n */\n\nimport {\n createComponentInstance,\n mountComponent,\n cleanupComponent,\n type ComponentFunction,\n type ComponentInstance,\n} from '../runtime/component';\nimport { globalScheduler } from '../runtime/scheduler';\nimport { logger } from '../dev/logger';\nimport { removeAllListeners } from '../renderer/dom';\nimport { registerAppInstance, initializeNavigation } from '../router/navigate';\n\nlet componentIdCounter = 0;\n\n// Track instances by root element to support multiple createApp calls on same root\nconst instancesByRoot = new WeakMap<Element, ComponentInstance>();\n\n// Symbol for storing cleanup on elements\nconst CLEANUP_SYMBOL = Symbol.for('__tempoCleanup__');\n\n// Type for elements that have cleanup functions attached\ninterface ElementWithCleanup extends Element {\n [CLEANUP_SYMBOL]?: () => void;\n}\n\nexport interface AppConfig {\n root: Element | string;\n component: ComponentFunction;\n}\n\n/**\n * Bootstrap and mount app on client\n * Supports both sync and async components\n *\n * If createApp is called multiple times on the same root, the existing instance\n * is reused and its component function is updated. This ensures:\n * - Generation tokens work correctly (old async renders don't overwrite new ones)\n * - State is preserved across updates (if desired)\n * - DOM is diffed/updated rather than replaced\n */\n// Backcompat wrapper for test-suite migration and user feedback.\n// If called with `routes` a hard error is thrown to encourage migration to\n// `createSPA`/`hydrateSPA`. Otherwise, delegate to `createIsland` to preserve\n// legacy single-root enhancement behavior during the migration period.\nexport function createApp(config: AppConfig | SPAConfig): void {\n if (!config || typeof config !== 'object') {\n throw new Error('createApp requires a config object');\n }\n // Routed apps must use createSPA/hydrateSPA explicitly\n if ('routes' in config) {\n throw new Error(\n 'The `createApp` API is removed. Use `createSPA({ root, routes })` for routed apps, or `hydrateSPA({ root, routes })` for SSR hydration.'\n );\n }\n // Treat remaining calls as islands for backwards compatibility during tests\n // and guide users to use `createIsland` in migration docs/tests.\n const appCfg = config as AppConfig;\n createIsland({\n root: appCfg.root,\n component: appCfg.component,\n });\n}\n\nfunction attachCleanupForRoot(\n rootElement: Element,\n instance: ComponentInstance\n) {\n (rootElement as ElementWithCleanup)[CLEANUP_SYMBOL] = () => {\n removeAllListeners(rootElement);\n cleanupComponent(instance as ComponentInstance);\n };\n\n try {\n const descriptor =\n Object.getOwnPropertyDescriptor(rootElement, 'innerHTML') ||\n Object.getOwnPropertyDescriptor(\n Object.getPrototypeOf(rootElement),\n 'innerHTML'\n ) ||\n Object.getOwnPropertyDescriptor(Element.prototype, 'innerHTML');\n\n if (descriptor && (descriptor.get || descriptor.set)) {\n Object.defineProperty(rootElement, 'innerHTML', {\n get: descriptor.get\n ? function (this: Element) {\n return descriptor.get!.call(this);\n }\n : undefined,\n set: function (this: Element, value: string) {\n if (value === '' && instancesByRoot.get(this) === instance) {\n removeAllListeners(rootElement);\n cleanupComponent(instance as ComponentInstance);\n }\n if (descriptor.set) {\n return descriptor.set.call(this, value);\n }\n },\n configurable: true,\n });\n }\n } catch {\n // If Object.defineProperty fails, ignore\n }\n}\n\nfunction mountOrUpdate(rootElement: Element, componentFn: ComponentFunction) {\n // Clean up existing cleanup function before mounting new one\n const existingCleanup = (rootElement as ElementWithCleanup)[CLEANUP_SYMBOL];\n if (existingCleanup) existingCleanup();\n\n let instance = instancesByRoot.get(rootElement);\n\n if (instance) {\n removeAllListeners(rootElement);\n cleanupComponent(instance);\n\n instance.fn = componentFn;\n instance.evaluationGeneration++;\n instance.mounted = false;\n instance.expectedStateIndices = [];\n instance.firstRenderComplete = false;\n instance.isRoot = true;\n } else {\n const componentId = String(++componentIdCounter);\n instance = createComponentInstance(\n componentId,\n componentFn,\n {},\n rootElement\n );\n instancesByRoot.set(rootElement, instance);\n instance.isRoot = true;\n }\n\n attachCleanupForRoot(rootElement, instance);\n mountComponent(instance);\n globalScheduler.flush();\n}\n\n// New strongly-typed init functions\nimport type { Route } from '../router/route';\n\nexport type IslandConfig = {\n root: Element | string;\n component: ComponentFunction;\n // Explicitly disallow routes on islands at type level\n routes?: never;\n};\n\nexport type SPAConfig = {\n root: Element | string;\n routes: Route[]; // routes are required\n component?: never;\n};\n\nexport type HydrateSPAConfig = {\n root: Element | string;\n routes: Route[];\n};\n\n/**\n * createIsland: Enhances existing DOM (no router, mounts once)\n */\nexport function createIsland(config: IslandConfig): void {\n if (!config || typeof config !== 'object') {\n throw new Error('createIsland requires a config object');\n }\n if (typeof config.component !== 'function') {\n throw new Error('createIsland: component must be a function');\n }\n\n const rootElement =\n typeof config.root === 'string'\n ? document.getElementById(config.root)\n : config.root;\n if (!rootElement) throw new Error(`Root element not found: ${config.root}`);\n\n // Islands must not initialize router or routes\n if ('routes' in config) {\n throw new Error(\n 'createIsland does not accept routes; use createSPA for routed apps'\n );\n }\n\n mountOrUpdate(rootElement, config.component);\n}\n\n/**\n * createSPA: Initializes router and mounts the app with provided route table\n */\nexport async function createSPA(config: SPAConfig): Promise<void> {\n if (!config || typeof config !== 'object') {\n throw new Error('createSPA requires a config object');\n }\n if (!Array.isArray(config.routes) || config.routes.length === 0) {\n throw new Error(\n 'createSPA requires a route table. If you are enhancing existing HTML, use createIsland instead.'\n );\n }\n\n const rootElement =\n typeof config.root === 'string'\n ? document.getElementById(config.root)\n : config.root;\n if (!rootElement) throw new Error(`Root element not found: ${config.root}`);\n\n // Register routes at startup (clear previous registrations to avoid surprises)\n const { clearRoutes, route, lockRouteRegistration, resolveRoute } =\n await import('../router/route');\n\n clearRoutes();\n for (const r of config.routes) {\n // Using typed Route from router; allow handler functions\n route(r.path, r.handler, r.namespace);\n }\n // Lock registration in production to prevent late registration surprises\n if (process.env.NODE_ENV === 'production') lockRouteRegistration();\n\n // Mount the currently-resolved route handler (if any)\n const path = typeof window !== 'undefined' ? window.location.pathname : '/';\n const resolved = resolveRoute(path);\n if (!resolved) {\n // If no route currently matches, mount an empty placeholder and continue.\n // This supports cases where routes are registered but the current URL is\n // not one of them (common in router tests that navigate programmatically).\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(\n `createSPA: no route found for current path (${path}). Mounting empty placeholder; navigation will activate routes when requested.`\n );\n }\n\n // Mount a no-op component until navigation occurs\n mountOrUpdate(rootElement, () => ({ type: 'div', children: [] }));\n\n // Still register app instance and initialize navigation so future navigations work\n const instance = instancesByRoot.get(rootElement);\n if (!instance) throw new Error('Internal error: app instance missing');\n registerAppInstance(instance as ComponentInstance, path);\n initializeNavigation();\n return;\n }\n\n // Mount resolved handler as the root component\n // Convert resolved.handler to a ComponentFunction-compatible shape\n mountOrUpdate(rootElement, resolved.handler as ComponentFunction);\n\n // Register for navigation and wire up history handling\n const instance = instancesByRoot.get(rootElement);\n if (!instance) throw new Error('Internal error: app instance missing');\n registerAppInstance(instance as ComponentInstance, path);\n initializeNavigation();\n}\n\n/**\n * hydrateSPA: Hydrate server-rendered HTML with explicit routes\n */\nexport async function hydrateSPA(config: HydrateSPAConfig): Promise<void> {\n if (!config || typeof config !== 'object') {\n throw new Error('hydrateSPA requires a config object');\n }\n if (!Array.isArray(config.routes) || config.routes.length === 0) {\n throw new Error(\n 'hydrateSPA requires a route table. If you are enhancing existing HTML, use createIsland instead.'\n );\n }\n\n const rootElement =\n typeof config.root === 'string'\n ? document.getElementById(config.root)\n : config.root;\n if (!rootElement) throw new Error(`Root element not found: ${config.root}`);\n\n // Capture server HTML for mismatch detection\n const serverHTML = rootElement.innerHTML;\n\n // Register routes for hydration and set server location for deterministic route()\n const {\n clearRoutes,\n route,\n setServerLocation,\n lockRouteRegistration,\n resolveRoute,\n } = await import('../router/route');\n\n clearRoutes();\n for (const r of config.routes) {\n route(r.path, r.handler, r.namespace);\n }\n // Set server location so route() reflects server URL during SSR checks\n const path = typeof window !== 'undefined' ? window.location.pathname : '/';\n setServerLocation(path);\n if (process.env.NODE_ENV === 'production') lockRouteRegistration();\n\n // Resolve handler for current path\n const resolved = resolveRoute(path);\n if (!resolved) {\n throw new Error(`hydrateSPA: no route found for current path (${path}).`);\n }\n\n // Synchronously render expected HTML using SSR helper\n const { renderToStringSync } = await import('../ssr');\n // renderToStringSync takes a zero-arg component factory; wrap the handler to pass params\n const expectedHTML = renderToStringSync(() => {\n const out = resolved.handler(resolved.params);\n return (out ?? {\n type: 'div',\n children: [],\n }) as ReturnType<ComponentFunction>;\n });\n\n // Prefer a DOM-based comparison to avoid false positives from attribute order\n // or whitespace differences between server and expected HTML.\n const serverContainer = document.createElement('div');\n serverContainer.innerHTML = serverHTML;\n const expectedContainer = document.createElement('div');\n expectedContainer.innerHTML = expectedHTML;\n\n if (!serverContainer.isEqualNode(expectedContainer)) {\n throw new Error(\n '[Askr] Hydration mismatch detected. Server HTML does not match expected server-render output.'\n );\n }\n\n // Proceed to mount the client SPA (this will attach listeners and start navigation)\n // Reuse createSPA path but we already registered routes and set server location, so just mount\n // Mount resolved handler\n mountOrUpdate(rootElement, resolved.handler as ComponentFunction);\n\n // Register navigation and instance\n const { registerAppInstance, initializeNavigation } =\n await import('../router/navigate');\n const instance = instancesByRoot.get(rootElement);\n if (!instance) throw new Error('Internal error: app instance missing');\n registerAppInstance(instance as ComponentInstance, path);\n initializeNavigation();\n}\n\nexport async function hydrate(_config: AppConfig): Promise<void> {\n throw new Error(\n 'The legacy `hydrate` API is removed. Use `hydrateSPA({ root, routes })` for SSR hydration with an explicit route table.'\n );\n}\n\n/**\n * Cleanup an app mounted on a root element (element or id).\n * Safe to call multiple times — no-op when nothing is mounted.\n */\nexport function cleanupApp(root: Element | string): void {\n const rootElement =\n typeof root === 'string' ? document.getElementById(root) : root;\n\n if (!rootElement) return;\n\n const cleanupFn = (rootElement as ElementWithCleanup)[CLEANUP_SYMBOL];\n if (typeof cleanupFn === 'function') {\n cleanupFn();\n }\n\n instancesByRoot.delete(rootElement);\n}\n\n/**\n * Check whether an app is mounted on the given root\n */\nexport function hasApp(root: Element | string): boolean {\n const rootElement =\n typeof root === 'string' ? document.getElementById(root) : root;\n\n if (!rootElement) return false;\n return instancesByRoot.has(rootElement);\n}\n","/**\n * Small layout helper (centralized)\n * Usage: const parent = layout(ParentLayout); route('/parent', () => parent(<Child />));\n *\n * A layout is simply a component that receives `children`.\n * This helper intentionally avoids vnode inspection, heuristics, or double-invocation.\n * Prefer boring, explicit code over cleverness.\n *\n * Example:\n * const Parent = ({ children }: { children?: unknown }) => <div class=\"parent\">{children}</div>;\n * const parent = layout(Parent);\n * route('/parent', () => parent(<div class=\"child\">C</div>));\n */\nexport type Component<P = object> = (\n props: P & { children?: unknown }\n) => unknown;\n\nexport function layout<P>(Layout: Component<P>) {\n return (children?: unknown) =>\n Layout({ children } as P & { children?: unknown });\n}\n","/**\n * Link component for client-side navigation\n */\n\nimport { navigate } from '../router/navigate';\nimport type { JSXElement } from '../jsx/types';\n\nexport interface LinkProps {\n href: string;\n children?: unknown;\n}\n\n/**\n * Link component that prevents default navigation and uses navigate()\n * Provides declarative way to navigate between routes\n *\n * Respects:\n * - Middle-click (opens in new tab)\n * - Ctrl/Cmd+click (opens in new tab)\n * - Shift+click (opens in new window)\n * - Right-click context menu\n */\nexport function Link({ href, children }: LinkProps): JSXElement {\n return {\n type: 'a',\n props: {\n href,\n children,\n onClick: (e: Event) => {\n const event = e as MouseEvent;\n\n // Only handle left-click without modifiers\n // Default button to 0 if undefined (for mock events in tests)\n const button = event.button ?? 0;\n if (\n button !== 0 || // not left-click\n event.ctrlKey || // Ctrl/Cmd+click\n event.metaKey || // Cmd on Mac\n event.shiftKey || // Shift+click\n event.altKey // Alt+click\n ) {\n return; // Let browser handle it (new tab, etc.)\n }\n\n event.preventDefault();\n navigate(href);\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;AACA;AAKA;AACA;AA0CO,SAAS,MAAS,cAA2B;AAElD,QAAM,WAAW,mBAAmB;AACpC,MAAI,CAAC,UAAU;AACb,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AAEA,QAAM,QAAQ,kBAAkB;AAChC,QAAM,cAAc,SAAS;AAI7B,MAAI,QAAQ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OAAO,WAAW;AACpC;AAKO,SAAS,OAAO,MAAiC;AACtD,QAAM,cACJ,OAAO,SAAS,WAAW,SAAS,eAAe,IAAI,IAAI;AAE7D,MAAI,CAAC,YAAa,QAAO;AACzB,SAAO,gBAAgB,IAAI,WAAW;AACxC;;;ACrWO,SAAS,OAAU,QAAsB;AAC9C,SAAO,CAAC,aACN,OAAO,EAAE,SAAS,CAA+B;AACrD;;;ACEO,SAAS,KAAK,EAAE,MAAM,SAAS,GAA0B;AAC9D,SAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,CAAC,MAAa;AACrB,cAAM,QAAQ;AAId,cAAM,SAAS,MAAM,UAAU;AAC/B,YACE,WAAW;AAAA,QACX,MAAM;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,QACN,MAAM,QACN;AACA;AAAA,QACF;AAEA,cAAM,eAAe;AACrB,iBAAS,IAAI;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;;;ALwBA;AAaA,IAAI,OAAO,eAAe,aAAa;AACrC,QAAM,IAAI;AACV,MAAI,CAAC,EAAE,UAAW,GAAE,YAAY;AAChC,MAAI,CAAC,EAAE,aAAc,GAAE,eAAe;AACtC,MAAI,CAAC,EAAE,UAAW,GAAE,YAAY;AAChC,MAAI,CAAC,EAAE,WAAY,GAAE,aAAa;AAClC,MAAI,CAAC,EAAE,MAAO,GAAE,QAAQ;AACxB,MAAI,CAAC,EAAE,UAAW,GAAE,YAAY;AAChC,MAAI,CAAC,EAAE,SAAU,GAAE,WAAW;AAChC;","names":["renderData","holder","h","cell","clearRoutes","route","instance","setServerLocation","renderToStringSync","registerAppInstance","initializeNavigation"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/jsx/jsx-dev-runtime.ts
|
|
21
|
+
var jsx_dev_runtime_exports = {};
|
|
22
|
+
__export(jsx_dev_runtime_exports, {
|
|
23
|
+
Fragment: () => Fragment,
|
|
24
|
+
jsxDEV: () => jsxDEV
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(jsx_dev_runtime_exports);
|
|
27
|
+
function jsxDEV(type, props, key) {
|
|
28
|
+
return {
|
|
29
|
+
type,
|
|
30
|
+
props: props || {},
|
|
31
|
+
key
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
var Fragment = /* @__PURE__ */ Symbol("Fragment");
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
Fragment,
|
|
38
|
+
jsxDEV
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=jsx-dev-runtime.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["/**\n * JSX dev runtime factory\n * Same as production runtime but with dev warnings\n */\n\nimport './types';\n\nexport interface JSXElement {\n type: unknown;\n props: Record<string, unknown>;\n key?: string | number;\n}\n\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n): JSXElement {\n return {\n type,\n props: props || {},\n key,\n };\n}\n\nexport const Fragment = Symbol('Fragment');\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,OACd,MACA,OACA,KACY;AACZ,SAAO;AAAA,IACL;AAAA,IACA,OAAO,SAAS,CAAC;AAAA,IACjB;AAAA,EACF;AACF;AAEO,IAAM,WAAW,uBAAO,UAAU;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import '../types-DUDmnzD8.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* JSX dev runtime factory
|
|
5
|
+
* Same as production runtime but with dev warnings
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface JSXElement {
|
|
9
|
+
type: unknown;
|
|
10
|
+
props: Record<string, unknown>;
|
|
11
|
+
key?: string | number;
|
|
12
|
+
}
|
|
13
|
+
declare function jsxDEV(type: unknown, props: Record<string, unknown> | null, key?: string | number): JSXElement;
|
|
14
|
+
declare const Fragment: unique symbol;
|
|
15
|
+
|
|
16
|
+
export { Fragment, type JSXElement, jsxDEV };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import '../types-DUDmnzD8.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* JSX dev runtime factory
|
|
5
|
+
* Same as production runtime but with dev warnings
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface JSXElement {
|
|
9
|
+
type: unknown;
|
|
10
|
+
props: Record<string, unknown>;
|
|
11
|
+
key?: string | number;
|
|
12
|
+
}
|
|
13
|
+
declare function jsxDEV(type: unknown, props: Record<string, unknown> | null, key?: string | number): JSXElement;
|
|
14
|
+
declare const Fragment: unique symbol;
|
|
15
|
+
|
|
16
|
+
export { Fragment, type JSXElement, jsxDEV };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "../chunk-4CV4JOE5.js";
|
|
2
|
+
|
|
3
|
+
// src/jsx/jsx-dev-runtime.ts
|
|
4
|
+
function jsxDEV(type, props, key) {
|
|
5
|
+
return {
|
|
6
|
+
type,
|
|
7
|
+
props: props || {},
|
|
8
|
+
key
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
var Fragment = /* @__PURE__ */ Symbol("Fragment");
|
|
12
|
+
export {
|
|
13
|
+
Fragment,
|
|
14
|
+
jsxDEV
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=jsx-dev-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["/**\n * JSX dev runtime factory\n * Same as production runtime but with dev warnings\n */\n\nimport './types';\n\nexport interface JSXElement {\n type: unknown;\n props: Record<string, unknown>;\n key?: string | number;\n}\n\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n): JSXElement {\n return {\n type,\n props: props || {},\n key,\n };\n}\n\nexport const Fragment = Symbol('Fragment');\n"],"mappings":";;;AAaO,SAAS,OACd,MACA,OACA,KACY;AACZ,SAAO;AAAA,IACL;AAAA,IACA,OAAO,SAAS,CAAC;AAAA,IACjB;AAAA,EACF;AACF;AAEO,IAAM,WAAW,uBAAO,UAAU;","names":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/jsx/jsx-runtime.ts
|
|
21
|
+
var jsx_runtime_exports = {};
|
|
22
|
+
__export(jsx_runtime_exports, {
|
|
23
|
+
Fragment: () => Fragment,
|
|
24
|
+
jsx: () => jsx,
|
|
25
|
+
jsxs: () => jsxs
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(jsx_runtime_exports);
|
|
28
|
+
function jsx(type, props, key) {
|
|
29
|
+
return {
|
|
30
|
+
type,
|
|
31
|
+
props: props || {},
|
|
32
|
+
key
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function jsxs(type, props, key) {
|
|
36
|
+
return jsx(type, props, key);
|
|
37
|
+
}
|
|
38
|
+
var Fragment = /* @__PURE__ */ Symbol.for("@askrjs/askr.Fragment");
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
Fragment,
|
|
42
|
+
jsx,
|
|
43
|
+
jsxs
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=jsx-runtime.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/jsx/jsx-runtime.ts"],"sourcesContent":["/**\n * JSX runtime factory\n * Thin layer — no scheduling, no logic\n */\n\nimport './types';\n\nexport interface JSXElement {\n type: unknown;\n props: Record<string, unknown>;\n key?: string | number;\n}\n\nexport function jsx(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n): JSXElement {\n return {\n type,\n props: props || {},\n key,\n };\n}\n\nexport function jsxs(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n): JSXElement {\n return jsx(type, props, key);\n}\n\n// Fragment for rendering multiple elements without wrapper\n// Unique fragment symbol for Askr\nexport const Fragment = Symbol.for('@askrjs/askr.Fragment');\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,IACd,MACA,OACA,KACY;AACZ,SAAO;AAAA,IACL;AAAA,IACA,OAAO,SAAS,CAAC;AAAA,IACjB;AAAA,EACF;AACF;AAEO,SAAS,KACd,MACA,OACA,KACY;AACZ,SAAO,IAAI,MAAM,OAAO,GAAG;AAC7B;AAIO,IAAM,WAAW,uBAAO,IAAI,uBAAuB;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import '../types-DUDmnzD8.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* JSX runtime factory
|
|
5
|
+
* Thin layer — no scheduling, no logic
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface JSXElement {
|
|
9
|
+
type: unknown;
|
|
10
|
+
props: Record<string, unknown>;
|
|
11
|
+
key?: string | number;
|
|
12
|
+
}
|
|
13
|
+
declare function jsx(type: unknown, props: Record<string, unknown> | null, key?: string | number): JSXElement;
|
|
14
|
+
declare function jsxs(type: unknown, props: Record<string, unknown> | null, key?: string | number): JSXElement;
|
|
15
|
+
declare const Fragment: unique symbol;
|
|
16
|
+
|
|
17
|
+
export { Fragment, type JSXElement, jsx, jsxs };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import '../types-DUDmnzD8.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* JSX runtime factory
|
|
5
|
+
* Thin layer — no scheduling, no logic
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface JSXElement {
|
|
9
|
+
type: unknown;
|
|
10
|
+
props: Record<string, unknown>;
|
|
11
|
+
key?: string | number;
|
|
12
|
+
}
|
|
13
|
+
declare function jsx(type: unknown, props: Record<string, unknown> | null, key?: string | number): JSXElement;
|
|
14
|
+
declare function jsxs(type: unknown, props: Record<string, unknown> | null, key?: string | number): JSXElement;
|
|
15
|
+
declare const Fragment: unique symbol;
|
|
16
|
+
|
|
17
|
+
export { Fragment, type JSXElement, jsx, jsxs };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cleanupNavigation,
|
|
3
|
+
initializeNavigation,
|
|
4
|
+
navigate,
|
|
5
|
+
registerAppInstance
|
|
6
|
+
} from "./chunk-UUM5W2RM.js";
|
|
7
|
+
import "./chunk-L7RL4LYV.js";
|
|
8
|
+
import "./chunk-YNH3D4KW.js";
|
|
9
|
+
import "./chunk-4CV4JOE5.js";
|
|
10
|
+
export {
|
|
11
|
+
cleanupNavigation,
|
|
12
|
+
initializeNavigation,
|
|
13
|
+
navigate,
|
|
14
|
+
registerAppInstance
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=navigate-NLQOZQGM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
_lockRouteRegistrationForTests,
|
|
3
|
+
_unlockRouteRegistrationForTests,
|
|
4
|
+
clearRoutes,
|
|
5
|
+
getLoadedNamespaces,
|
|
6
|
+
getNamespaceRoutes,
|
|
7
|
+
getRoutes,
|
|
8
|
+
lockRouteRegistration,
|
|
9
|
+
registerRoute,
|
|
10
|
+
resolveRoute,
|
|
11
|
+
route,
|
|
12
|
+
setServerLocation,
|
|
13
|
+
unloadNamespace
|
|
14
|
+
} from "./chunk-L7RL4LYV.js";
|
|
15
|
+
import "./chunk-YNH3D4KW.js";
|
|
16
|
+
import "./chunk-4CV4JOE5.js";
|
|
17
|
+
export {
|
|
18
|
+
_lockRouteRegistrationForTests,
|
|
19
|
+
_unlockRouteRegistrationForTests,
|
|
20
|
+
clearRoutes,
|
|
21
|
+
getLoadedNamespaces,
|
|
22
|
+
getNamespaceRoutes,
|
|
23
|
+
getRoutes,
|
|
24
|
+
lockRouteRegistration,
|
|
25
|
+
registerRoute,
|
|
26
|
+
resolveRoute,
|
|
27
|
+
route,
|
|
28
|
+
setServerLocation,
|
|
29
|
+
unloadNamespace
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=route-TVYWYCEJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SSRDataMissingError,
|
|
3
|
+
collectResources,
|
|
4
|
+
renderToStream,
|
|
5
|
+
renderToString,
|
|
6
|
+
renderToStringSync,
|
|
7
|
+
renderToStringSyncForUrl,
|
|
8
|
+
resolvePlan,
|
|
9
|
+
resolveResources
|
|
10
|
+
} from "./chunk-HIWJVOS4.js";
|
|
11
|
+
import "./chunk-L7RL4LYV.js";
|
|
12
|
+
import "./chunk-YNH3D4KW.js";
|
|
13
|
+
import "./chunk-4CV4JOE5.js";
|
|
14
|
+
export {
|
|
15
|
+
SSRDataMissingError,
|
|
16
|
+
collectResources,
|
|
17
|
+
renderToStream,
|
|
18
|
+
renderToString,
|
|
19
|
+
renderToStringSync,
|
|
20
|
+
renderToStringSyncForUrl,
|
|
21
|
+
resolvePlan,
|
|
22
|
+
resolveResources
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=ssr-4ELUFK65.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types exposed to consumers
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Props accepted by components and elements. This is intentionally permissive
|
|
6
|
+
* but gives a single named type to tighten and document over time.
|
|
7
|
+
*/
|
|
8
|
+
interface Props {
|
|
9
|
+
/** Optional key for keyed lists (string | number | symbol for internal frames) */
|
|
10
|
+
key?: string | number | symbol;
|
|
11
|
+
/** Optional children slot */
|
|
12
|
+
children?: unknown;
|
|
13
|
+
/** Allow additional arbitrary attributes (e.g., class, id, data-*) */
|
|
14
|
+
[attr: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* JSX type definitions
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
interface JSXElement {
|
|
22
|
+
type: string | ((props: Props) => JSXElement | null);
|
|
23
|
+
props: Props;
|
|
24
|
+
key?: string | number;
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
namespace JSX {
|
|
28
|
+
type Element = JSXElement;
|
|
29
|
+
interface IntrinsicElements {
|
|
30
|
+
[elem: string]: Props;
|
|
31
|
+
}
|
|
32
|
+
interface ElementAttributesProperty {
|
|
33
|
+
props: Props;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type { JSXElement as J, Props as P };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types exposed to consumers
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Props accepted by components and elements. This is intentionally permissive
|
|
6
|
+
* but gives a single named type to tighten and document over time.
|
|
7
|
+
*/
|
|
8
|
+
interface Props {
|
|
9
|
+
/** Optional key for keyed lists (string | number | symbol for internal frames) */
|
|
10
|
+
key?: string | number | symbol;
|
|
11
|
+
/** Optional children slot */
|
|
12
|
+
children?: unknown;
|
|
13
|
+
/** Allow additional arbitrary attributes (e.g., class, id, data-*) */
|
|
14
|
+
[attr: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* JSX type definitions
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
interface JSXElement {
|
|
22
|
+
type: string | ((props: Props) => JSXElement | null);
|
|
23
|
+
props: Props;
|
|
24
|
+
key?: string | number;
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
namespace JSX {
|
|
28
|
+
type Element = JSXElement;
|
|
29
|
+
interface IntrinsicElements {
|
|
30
|
+
[elem: string]: Props;
|
|
31
|
+
}
|
|
32
|
+
interface ElementAttributesProperty {
|
|
33
|
+
props: Props;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type { JSXElement as J, Props as P };
|
package/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@askrjs/askr",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Actor-backed deterministic UI framework",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/askrjs/askr"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/askrjs/askr#readme",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/askrjs/askr/issues"
|
|
12
|
+
},
|
|
13
|
+
"author": {
|
|
14
|
+
"name": "askrjs",
|
|
15
|
+
"url": "https://github.com/askrjs"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"askr",
|
|
19
|
+
"ui",
|
|
20
|
+
"framework",
|
|
21
|
+
"jsx",
|
|
22
|
+
"ssr",
|
|
23
|
+
"library"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"packageManager": "npm",
|
|
27
|
+
"license": "Apache-2.0",
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"main": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"src/jsx"
|
|
34
|
+
],
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"exports": {
|
|
39
|
+
".": {
|
|
40
|
+
"import": "./dist/index.js",
|
|
41
|
+
"types": "./dist/index.d.ts"
|
|
42
|
+
},
|
|
43
|
+
"./jsx-runtime": {
|
|
44
|
+
"import": "./src/jsx/jsx-runtime.ts",
|
|
45
|
+
"types": "./src/jsx/jsx-runtime.ts"
|
|
46
|
+
},
|
|
47
|
+
"./jsx-dev-runtime": {
|
|
48
|
+
"import": "./src/jsx/jsx-dev-runtime.ts",
|
|
49
|
+
"types": "./src/jsx/jsx-dev-runtime.ts"
|
|
50
|
+
},
|
|
51
|
+
"./vite": {
|
|
52
|
+
"import": "./src/dev/vite-plugin-askr.ts",
|
|
53
|
+
"types": "./src/dev/vite-plugin-askr.ts"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsup",
|
|
58
|
+
"dev": "tsup --watch",
|
|
59
|
+
"test": "vitest run",
|
|
60
|
+
"test:ui": "vitest --ui",
|
|
61
|
+
"test:types": "npm run build && tsd",
|
|
62
|
+
"bench": "cross-env NODE_ENV=production vitest bench --run --reporter=default --config vitest.bench.config.ts",
|
|
63
|
+
"check:benches": "node ./scripts/check-bench-awaits.js",
|
|
64
|
+
"fmt": "prettier --write .",
|
|
65
|
+
"lint": "eslint src tests benches --ext .ts,.tsx"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@eslint/js": "^9.39.2",
|
|
69
|
+
"@types/node": "^25.0.3",
|
|
70
|
+
"cross-env": "^10.1.0",
|
|
71
|
+
"eslint": "^9.39.2",
|
|
72
|
+
"eslint-config-prettier": "^10.1.8",
|
|
73
|
+
"jiti": "^2.6.1",
|
|
74
|
+
"jsdom": "^27.3.0",
|
|
75
|
+
"prettier": "^3.7.4",
|
|
76
|
+
"tsup": "^8.5.1",
|
|
77
|
+
"tsd": "^0.33.0",
|
|
78
|
+
"typescript": "^5.9.3",
|
|
79
|
+
"typescript-eslint": "^8.50.0",
|
|
80
|
+
"vitest": "^4.0.16",
|
|
81
|
+
"vite": "^7.3.0"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSX dev runtime factory
|
|
3
|
+
* Same as production runtime but with dev warnings
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import './types';
|
|
7
|
+
|
|
8
|
+
export interface JSXElement {
|
|
9
|
+
type: unknown;
|
|
10
|
+
props: Record<string, unknown>;
|
|
11
|
+
key?: string | number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function jsxDEV(
|
|
15
|
+
type: unknown,
|
|
16
|
+
props: Record<string, unknown> | null,
|
|
17
|
+
key?: string | number
|
|
18
|
+
): JSXElement {
|
|
19
|
+
return {
|
|
20
|
+
type,
|
|
21
|
+
props: props || {},
|
|
22
|
+
key,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const Fragment = Symbol('Fragment');
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSX runtime factory
|
|
3
|
+
* Thin layer — no scheduling, no logic
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import './types';
|
|
7
|
+
|
|
8
|
+
export interface JSXElement {
|
|
9
|
+
type: unknown;
|
|
10
|
+
props: Record<string, unknown>;
|
|
11
|
+
key?: string | number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function jsx(
|
|
15
|
+
type: unknown,
|
|
16
|
+
props: Record<string, unknown> | null,
|
|
17
|
+
key?: string | number
|
|
18
|
+
): JSXElement {
|
|
19
|
+
return {
|
|
20
|
+
type,
|
|
21
|
+
props: props || {},
|
|
22
|
+
key,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function jsxs(
|
|
27
|
+
type: unknown,
|
|
28
|
+
props: Record<string, unknown> | null,
|
|
29
|
+
key?: string | number
|
|
30
|
+
): JSXElement {
|
|
31
|
+
return jsx(type, props, key);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Fragment for rendering multiple elements without wrapper
|
|
35
|
+
// Unique fragment symbol for Askr
|
|
36
|
+
export const Fragment = Symbol.for('@askrjs/askr.Fragment');
|
|
File without changes
|