@llui/dom 0.0.17 → 0.0.19
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/dist/binding.d.ts.map +1 -1
- package/dist/binding.js +5 -0
- package/dist/binding.js.map +1 -1
- package/dist/devtools.d.ts +109 -0
- package/dist/devtools.d.ts.map +1 -1
- package/dist/devtools.js +401 -1
- package/dist/devtools.js.map +1 -1
- package/dist/hmr.d.ts.map +1 -1
- package/dist/hmr.js +2 -0
- package/dist/hmr.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mount.d.ts.map +1 -1
- package/dist/mount.js +18 -2
- package/dist/mount.js.map +1 -1
- package/dist/primitives/branch.d.ts.map +1 -1
- package/dist/primitives/branch.js +10 -1
- package/dist/primitives/branch.js.map +1 -1
- package/dist/primitives/child.d.ts.map +1 -1
- package/dist/primitives/child.js +25 -5
- package/dist/primitives/child.js.map +1 -1
- package/dist/primitives/context.d.ts +30 -6
- package/dist/primitives/context.d.ts.map +1 -1
- package/dist/primitives/context.js +30 -6
- package/dist/primitives/context.js.map +1 -1
- package/dist/primitives/each.d.ts.map +1 -1
- package/dist/primitives/each.js +79 -6
- package/dist/primitives/each.js.map +1 -1
- package/dist/primitives/foreign.d.ts.map +1 -1
- package/dist/primitives/foreign.js +1 -0
- package/dist/primitives/foreign.js.map +1 -1
- package/dist/primitives/lazy.d.ts.map +1 -1
- package/dist/primitives/lazy.js +1 -0
- package/dist/primitives/lazy.js.map +1 -1
- package/dist/primitives/portal.d.ts.map +1 -1
- package/dist/primitives/portal.js +1 -0
- package/dist/primitives/portal.js.map +1 -1
- package/dist/primitives/show.d.ts.map +1 -1
- package/dist/primitives/show.js +4 -0
- package/dist/primitives/show.js.map +1 -1
- package/dist/primitives/virtual-each.d.ts.map +1 -1
- package/dist/primitives/virtual-each.js +3 -0
- package/dist/primitives/virtual-each.js.map +1 -1
- package/dist/render-context.d.ts.map +1 -1
- package/dist/render-context.js.map +1 -1
- package/dist/scope.d.ts.map +1 -1
- package/dist/scope.js +68 -1
- package/dist/scope.js.map +1 -1
- package/dist/ssr.d.ts.map +1 -1
- package/dist/ssr.js +5 -1
- package/dist/ssr.js.map +1 -1
- package/dist/tracking/coverage.d.ts +27 -0
- package/dist/tracking/coverage.d.ts.map +1 -0
- package/dist/tracking/coverage.js +39 -0
- package/dist/tracking/coverage.js.map +1 -0
- package/dist/tracking/disposer-log.d.ts +22 -0
- package/dist/tracking/disposer-log.d.ts.map +1 -0
- package/dist/tracking/disposer-log.js +3 -0
- package/dist/tracking/disposer-log.js.map +1 -0
- package/dist/tracking/each-diff.d.ts +62 -0
- package/dist/tracking/each-diff.d.ts.map +1 -0
- package/dist/tracking/each-diff.js +26 -0
- package/dist/tracking/each-diff.js.map +1 -0
- package/dist/tracking/effect-timeline.d.ts +73 -0
- package/dist/tracking/effect-timeline.d.ts.map +1 -0
- package/dist/tracking/effect-timeline.js +89 -0
- package/dist/tracking/effect-timeline.js.map +1 -0
- package/dist/types.d.ts +18 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/update-loop.d.ts.map +1 -1
- package/dist/update-loop.js +78 -0
- package/dist/update-loop.js.map +1 -1
- package/package.json +1 -1
package/dist/devtools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools.js","sourceRoot":"","sources":["../src/devtools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAA0B,MAAM,kBAAkB,CAAA;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAGhD;;;;;GAKG;AACH,MAAM,UAAU,cAAc;IAC5B,mBAAmB,CAAC,eAAe,CAAC,CAAA;AACtC,CAAC;AAED,uEAAuE;AACvE,iEAAiE;AACjE,8EAA8E;AAC9E,EAAE;AACF,oEAAoE;AACpE,uEAAuE;AACvE,uDAAu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AC,CAAC,gBAAgB,CAAC,YAAY,CAAC,GAAG,GAAG,CAAA;IACtC,CAAC,CAAC,WAAW,GAAG,GAAG,CAElB;IAAC,GAAW,CAAC,cAAc,GAAG,YAAY,CAAA;AAC7C,CAAC;AAED,mEAAmE;AACnE,0DAA0D;AAC1D,SAAS,UAAU,CAAC,QAAiC,EAAE,IAAY;IACjE,IAAI,CAAC,CAAC,IAAI,IAAI,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAA;IACpC,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,GAAG,IAAI,IAAI,CAAC,EAAE,IAAI,QAAQ;QAAE,CAAC,EAAE,CAAA;IACtC,OAAO,GAAG,IAAI,IAAI,CAAC,EAAE,CAAA;AACvB,CAAC","sourcesContent":["import { flushInstance, _forceState, type ComponentInstance } from './update-loop.js'\nimport { _setDevToolsInstall } from './mount.js'\nimport type { Binding } from './types.js'\n\n/**\n * Enable devtools auto-installation for every mountApp call. Called by\n * compiler-generated dev code — never imported in production builds.\n * Once enabled, every mounted component attaches `globalThis.__lluiDebug`\n * to the most recently mounted instance.\n */\nexport function enableDevTools(): void {\n _setDevToolsInstall(installDevTools)\n}\n\n// ── MCP WebSocket Relay ─────────────────────────────────────────────\n// Forwards method calls from an out-of-process MCP server to the\n// current __lluiDebug API. Dev-mode only — compiler injects startRelay(port).\n//\n// On-demand: tries a SINGLE connection on page load. If it succeeds\n// (MCP server is already running), the relay stays open and reconnects\n// on drop. If it fails, no retry loop — just registers\n// `window.__lluiConnect(port?)` so the developer can connect later\n// from the console or when the MCP server starts.\n\nlet relayPort = 5200\nlet relayConnected = false\n\ninterface RelayRequest {\n id: string\n method: keyof LluiDebugAPI | '__listComponents' | '__selectComponent'\n args: unknown[]\n}\n\nfunction handleMessage(ws: WebSocket, event: MessageEvent): void {\n let req: RelayRequest\n try {\n req = JSON.parse(String(event.data)) as RelayRequest\n } catch {\n return\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const g = globalThis as any\n if (req.method === '__listComponents') {\n const keys = g.__lluiComponents ? Object.keys(g.__lluiComponents) : []\n const active =\n g.__lluiDebug && g.__lluiComponents\n ? (Object.entries(g.__lluiComponents).find(([, v]) => v === g.__lluiDebug)?.[0] ?? null)\n : null\n ws.send(JSON.stringify({ id: req.id, result: { components: keys, active } }))\n return\n }\n if (req.method === '__selectComponent') {\n const key = (req.args?.[0] as string | undefined) ?? ''\n const entry = g.__lluiComponents?.[key]\n if (!entry) {\n ws.send(JSON.stringify({ id: req.id, error: `unknown component: ${key}` }))\n return\n }\n g.__lluiDebug = entry\n ws.send(JSON.stringify({ id: req.id, result: { active: key } }))\n return\n }\n\n const api = g.__lluiDebug as LluiDebugAPI | undefined\n if (!api) {\n ws.send(JSON.stringify({ id: req.id, error: '__lluiDebug not available' }))\n return\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const fn = (api as any)[req.method]\n if (typeof fn !== 'function') {\n ws.send(JSON.stringify({ id: req.id, error: `unknown method: ${req.method}` }))\n return\n }\n try {\n const result = fn.apply(api, req.args ?? [])\n ws.send(JSON.stringify({ id: req.id, result: result ?? null }))\n } catch (e) {\n ws.send(JSON.stringify({ id: req.id, error: e instanceof Error ? e.message : String(e) }))\n }\n}\n\nfunction connectRelay(port: number, isInitial: boolean): void {\n if (typeof WebSocket === 'undefined') return\n\n let ws: WebSocket\n try {\n ws = new WebSocket(`ws://127.0.0.1:${port}`)\n } catch {\n if (!isInitial) console.warn(`[LLui MCP] failed to connect to ws://127.0.0.1:${port}`)\n return\n }\n\n ws.onopen = () => {\n relayConnected = true\n console.log(`[LLui MCP] connected to ws://127.0.0.1:${port}`)\n }\n ws.onmessage = (event) => handleMessage(ws, event)\n ws.onclose = () => {\n if (relayConnected) {\n relayConnected = false\n console.log('[LLui MCP] disconnected — call __lluiConnect() to reconnect')\n }\n }\n ws.onerror = () => {\n // onclose fires after onerror — nothing to do here\n }\n}\n\n/**\n * Register the MCP relay for this page.\n *\n * Discovery happens in two phases:\n *\n * 1. **Status endpoint** (preferred): fetches `/__llui_mcp_status`,\n * which the Vite plugin serves from the active marker file written\n * by `@llui/mcp`. If the MCP server is running, the response gives\n * us the actual port — we connect immediately. This avoids the race\n * where HMR events fire before the listener registers, and handles\n * cases where MCP runs on a non-default port.\n * 2. **Compile-time fallback**: if the status endpoint is unavailable\n * (404, network error, non-Vite environment), we attempt a single\n * connection to the compiled-in `port` parameter as a best-effort.\n *\n * Either way: no retry loop. If both fail, `window.__lluiConnect(port?)`\n * is exposed so the developer can connect manually from the console\n * when the MCP server starts. The Vite plugin also dispatches an\n * `llui:mcp-ready` HMR custom event when the marker file appears later,\n * which the compiler-injected dev code forwards to `__lluiConnect`.\n */\nexport function startRelay(port = 5200): void {\n relayPort = port\n if (typeof WebSocket === 'undefined') return\n\n // Expose manual connect for on-demand use\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const g = globalThis as any\n g.__lluiConnect = (p?: number) => {\n connectRelay(p ?? relayPort, false)\n }\n\n // Try the Vite middleware first (knows the actual port from the marker file)\n if (typeof fetch !== 'undefined') {\n fetch('/__llui_mcp_status')\n .then((res) => (res.ok ? (res.json() as Promise<{ port: number }>) : null))\n .then((data) => {\n if (data && typeof data.port === 'number') {\n relayPort = data.port\n connectRelay(data.port, true)\n } else {\n // Endpoint replied 404 — MCP not running. Don't fall back to the\n // compile-time port; the HMR event will fire if MCP starts later.\n }\n })\n .catch(() => {\n // Network error or non-Vite environment — fall back to compile-time port\n connectRelay(port, true)\n })\n } else {\n // No fetch available — use the compile-time port directly\n connectRelay(port, true)\n }\n}\n\nexport interface MessageRecord {\n index: number\n timestamp: number\n msg: unknown\n stateBefore: unknown\n stateAfter: unknown\n effects: unknown[]\n dirtyMask: number\n}\n\nexport interface BindingDebugInfo {\n index: number\n mask: number\n lastValue: unknown\n kind: string\n key: string | undefined\n dead: boolean\n perItem: boolean\n}\n\nexport interface UpdateExplanation {\n bindingIndex: number\n bindingMask: number\n lastDirtyMask: number\n matched: boolean\n accessorResult: unknown\n lastValue: unknown\n changed: boolean\n}\n\nexport interface ValidationError {\n path: string\n expected: string\n received: string\n message: string\n}\n\nexport interface LluiDebugAPI {\n getState(): unknown\n send(msg: unknown): void\n flush(): void\n getMessageHistory(opts?: { since?: number; limit?: number }): MessageRecord[]\n evalUpdate(msg: unknown): { state: unknown; effects: unknown[] }\n exportTrace(): {\n lluiTrace: 1\n component: string\n generatedBy: string\n timestamp: string\n entries: Array<{ msg: unknown; expectedState: unknown; expectedEffects: unknown[] }>\n }\n clearLog(): void\n validateMessage(msg: unknown): ValidationError[] | null\n getBindings(): BindingDebugInfo[]\n whyDidUpdate(bindingIndex: number): UpdateExplanation\n searchState(query: string): unknown\n /** Returns the compiled Msg schema (discriminant + variant field types). */\n getMessageSchema(): MessageSchemaInfo | null\n /** Returns the bit→field map injected by the compiler. Lets tools decode dirty-mask values. */\n getMaskLegend(): Record<string, number> | null\n /** Given a dirty mask, return the list of top-level fields it represents. */\n decodeMask(mask: number): string[]\n /** Component name + source location (file/line from compiler-injected metadata). */\n getComponentInfo(): ComponentInfo\n /** Returns the compiled State type shape (from TypeScript `type State = { … }`). */\n getStateSchema(): object | null\n /** Returns the compiled Effect schema (from TypeScript `type Effect = { … }` union). */\n getEffectSchema(): object | null\n /** Deep-clone the current state. Pair with restoreState() to checkpoint before risky operations. */\n snapshotState(): unknown\n /** Overwrite the current state with a previously-captured snapshot. Triggers a full re-render. */\n restoreState(snap: unknown): void\n /** Find all bindings whose target node matches or is a child of the selector. */\n getBindingsFor(selector: string): BindingLocation[]\n}\n\nexport interface BindingLocation {\n bindingIndex: number\n kind: string\n key: string | undefined\n mask: number\n lastValue: unknown\n /** How the binding's node relates to the matched element: 'self' (binding on the element itself) or 'text-child' (text node inside). */\n relation: 'self' | 'text-child' | 'comment-child'\n}\n\nexport interface ComponentInfo {\n name: string\n file: string | null\n line: number | null\n}\n\nexport interface MessageSchemaInfo {\n discriminant: string\n variants: Record<string, Record<string, unknown>>\n}\n\nconst MAX_HISTORY = 1000\n\nexport function installDevTools(inst: object): void {\n const ci = inst as ComponentInstance\n const history: MessageRecord[] = []\n let idx = 0\n let lastDirtyMask = 0\n\n const api: LluiDebugAPI = {\n getState: () => ci.state,\n send: (msg) => ci.send(msg as never),\n flush: () => flushInstance(ci),\n getMessageHistory: (opts) => {\n let result = history\n if (opts?.since !== undefined) {\n const since = opts.since\n result = result.filter((r) => r.index > since)\n }\n if (opts?.limit !== undefined && opts.limit > 0) {\n result = result.slice(-opts.limit)\n }\n return result.slice()\n },\n\n evalUpdate(msg) {\n const [state, effects] = ci.def.update(ci.state, msg as never)\n return { state, effects }\n },\n\n exportTrace() {\n return {\n lluiTrace: 1 as const,\n component: ci.def.name,\n generatedBy: 'devtools',\n timestamp: new Date().toISOString(),\n entries: history.map((h) => ({\n msg: h.msg,\n expectedState: h.stateAfter,\n expectedEffects: h.effects,\n })),\n }\n },\n\n clearLog() {\n history.length = 0\n idx = 0\n },\n\n validateMessage(msg: unknown): ValidationError[] | null {\n const schema = ci.def.__msgSchema as\n | { discriminant: string; variants: Record<string, Record<string, unknown>> }\n | undefined\n if (!schema) return null\n\n if (msg == null || typeof msg !== 'object') {\n return [\n {\n path: '',\n expected: 'object',\n received: typeof msg,\n message: 'Message must be an object',\n },\n ]\n }\n\n const msgObj = msg as Record<string, unknown>\n const discriminant = schema.discriminant\n const typeValue = msgObj[discriminant]\n\n if (typeValue === undefined) {\n return [\n {\n path: `.${discriminant}`,\n expected: `one of: ${Object.keys(schema.variants)\n .map((v) => `'${v}'`)\n .join(', ')}`,\n received: 'undefined',\n message: `Missing discriminant field '${discriminant}'`,\n },\n ]\n }\n\n if (typeof typeValue !== 'string') {\n return [\n {\n path: `.${discriminant}`,\n expected: 'string',\n received: typeof typeValue,\n message: `Discriminant field '${discriminant}' must be a string`,\n },\n ]\n }\n\n const variant = schema.variants[typeValue]\n if (!variant) {\n return [\n {\n path: `.${discriminant}`,\n expected: `one of: ${Object.keys(schema.variants)\n .map((v) => `'${v}'`)\n .join(', ')}`,\n received: `'${typeValue}'`,\n message: `Unknown message type '${typeValue}'`,\n },\n ]\n }\n\n // Validate fields of the matched variant\n const errors: ValidationError[] = []\n for (const [field, expectedType] of Object.entries(variant)) {\n if (field === discriminant) continue\n const value = msgObj[field]\n if (value === undefined) {\n errors.push({\n path: `.${field}`,\n expected: String(expectedType),\n received: 'undefined',\n message: `Missing required field '${field}'`,\n })\n } else if (typeof expectedType === 'string' && expectedType !== 'unknown') {\n if (typeof value !== expectedType) {\n errors.push({\n path: `.${field}`,\n expected: expectedType,\n received: typeof value,\n message: `Field '${field}' has wrong type`,\n })\n }\n }\n }\n\n return errors.length > 0 ? errors : null\n },\n\n getBindings(): BindingDebugInfo[] {\n const bindings: Binding[] = ci.allBindings ?? []\n return bindings.map((b, i) => ({\n index: i,\n mask: b.mask,\n lastValue: b.lastValue,\n kind: b.kind,\n key: b.key,\n dead: b.dead,\n perItem: b.perItem,\n }))\n },\n\n whyDidUpdate(bindingIndex: number): UpdateExplanation {\n const bindings: Binding[] = ci.allBindings ?? []\n const binding = bindings[bindingIndex]\n if (!binding) {\n return {\n bindingIndex,\n bindingMask: 0,\n lastDirtyMask: 0,\n matched: false,\n accessorResult: undefined,\n lastValue: undefined,\n changed: false,\n }\n }\n\n const matched = (binding.mask & lastDirtyMask) !== 0\n let accessorResult: unknown\n try {\n accessorResult = binding.accessor(ci.state)\n } catch {\n accessorResult = '<error>'\n }\n const changed = !Object.is(accessorResult, binding.lastValue)\n\n return {\n bindingIndex,\n bindingMask: binding.mask,\n lastDirtyMask,\n matched,\n accessorResult,\n lastValue: binding.lastValue,\n changed,\n }\n },\n\n searchState(query: string): unknown {\n const parts = query.split('.')\n let current: unknown = ci.state\n for (const part of parts) {\n if (current == null || typeof current !== 'object') return undefined\n current = (current as Record<string, unknown>)[part]\n }\n return current\n },\n\n getMessageSchema(): MessageSchemaInfo | null {\n return (ci.def.__msgSchema as MessageSchemaInfo | undefined) ?? null\n },\n\n getMaskLegend(): Record<string, number> | null {\n return ci.def.__maskLegend ?? null\n },\n\n decodeMask(mask: number): string[] {\n const legend = ci.def.__maskLegend\n if (!legend) return []\n const fields: string[] = []\n for (const [field, bit] of Object.entries(legend)) {\n if ((mask & bit) !== 0) fields.push(field)\n }\n return fields\n },\n\n getComponentInfo(): ComponentInfo {\n const meta = ci.def.__componentMeta\n return {\n name: ci.def.name,\n file: meta?.file ?? null,\n line: meta?.line ?? null,\n }\n },\n\n getStateSchema(): object | null {\n return (ci.def.__stateSchema as object | undefined) ?? null\n },\n\n getEffectSchema(): object | null {\n return (ci.def.__effectSchema as object | undefined) ?? null\n },\n\n snapshotState(): unknown {\n return JSON.parse(JSON.stringify(ci.state))\n },\n\n restoreState(snap: unknown): void {\n _forceState(ci, snap)\n },\n\n getBindingsFor(selector: string): BindingLocation[] {\n if (typeof document === 'undefined') return []\n const elements = Array.from(document.querySelectorAll(selector))\n if (elements.length === 0) return []\n const elementSet = new Set<Element>(elements)\n const results: BindingLocation[] = []\n for (let i = 0; i < ci.allBindings.length; i++) {\n const b = ci.allBindings[i]!\n if (b.dead) continue\n const node = b.node\n let relation: 'self' | 'text-child' | 'comment-child' | null = null\n if (node.nodeType === 1 && elementSet.has(node as Element)) {\n relation = 'self'\n } else if (\n (node.nodeType === 3 || node.nodeType === 8) &&\n node.parentElement &&\n elementSet.has(node.parentElement)\n ) {\n relation = node.nodeType === 3 ? 'text-child' : 'comment-child'\n }\n if (!relation) continue\n results.push({\n bindingIndex: i,\n kind: b.kind,\n key: b.key,\n mask: b.mask,\n lastValue: b.lastValue,\n relation,\n })\n }\n return results\n },\n }\n\n // Intercept update to record transitions\n const originalUpdate = ci.def.update\n ci.def.update = ((state: unknown, msg: unknown) => {\n const [newState, effects] = (\n originalUpdate as (s: unknown, m: unknown) => [unknown, unknown[]]\n )(state, msg)\n const dirty = ci.def.__dirty\n ? (ci.def.__dirty as (o: unknown, n: unknown) => number)(state, newState)\n : -1\n\n lastDirtyMask = typeof dirty === 'number' ? dirty : -1\n\n const record: MessageRecord = {\n index: idx++,\n timestamp: Date.now(),\n msg,\n stateBefore: state,\n stateAfter: newState,\n effects,\n dirtyMask: lastDirtyMask,\n }\n\n if (history.length >= MAX_HISTORY) history.shift()\n history.push(record)\n\n return [newState, effects]\n }) as typeof ci.def.update\n\n // Register in the multi-component registry and point __lluiDebug at the\n // newest mount (so single-component apps keep working unchanged). Tools\n // can switch the active pointer via llui_select_component.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const g = globalThis as any\n if (!g.__lluiComponents) g.__lluiComponents = {} as Record<string, LluiDebugAPI>\n const componentKey = uniqueName(g.__lluiComponents, ci.def.name)\n g.__lluiComponents[componentKey] = api\n g.__lluiDebug = api\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(api as any).__componentKey = componentKey\n}\n\n// Generate a unique key for a component name if it's already taken\n// (e.g. same component mounted into multiple containers).\nfunction uniqueName(registry: Record<string, unknown>, name: string): string {\n if (!(name in registry)) return name\n let i = 2\n while (`${name}#${i}` in registry) i++\n return `${name}#${i}`\n}\n"]}
|
|
1
|
+
{"version":3,"file":"devtools.js","sourceRoot":"","sources":["../src/devtools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAA0B,MAAM,kBAAkB,CAAA;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAiB,MAAM,yBAAyB,CAAA;AACzE,OAAO,EACL,gBAAgB,IAAI,oBAAoB,GAEzC,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,qBAAqB,EAAyB,MAAM,wBAAwB,CAAA;AACrF,OAAO,EACL,gBAAgB,IAAI,oBAAoB,EACxC,kBAAkB,EAClB,wBAAwB,GAIzB,MAAM,+BAA+B,CAAA;AA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AAkC,CAAA;IAChF,MAAM,YAAY,GAAG,UAAU,CAAC,CAAC,CAAC,gBAAgB,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAChE,CAAC,CAAC,gBAAgB,CAAC,YAAY,CAAC,GAAG,GAAG,CAAA;IACtC,CAAC,CAAC,WAAW,GAAG,GAAG,CAElB;IAAC,GAAW,CAAC,cAAc,GAAG,YAAY,CAAA;AAC7C,CAAC;AAED,mEAAmE;AACnE,0DAA0D;AAC1D,SAAS,UAAU,CAAC,QAAiC,EAAE,IAAY;IACjE,IAAI,CAAC,CAAC,IAAI,IAAI,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAA;IACpC,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,GAAG,IAAI,IAAI,CAAC,EAAE,IAAI,QAAQ;QAAE,CAAC,EAAE,CAAA;IACtC,OAAO,GAAG,IAAI,IAAI,CAAC,EAAE,CAAA;AACvB,CAAC","sourcesContent":["import { flushInstance, _forceState, type ComponentInstance } from './update-loop.js'\nimport { _setDevToolsInstall } from './mount.js'\nimport { _markDisposerLogInstalled } from './scope.js'\nimport type { Binding, Scope, ScopeNode } from './types.js'\nimport { applyBinding } from './binding.js'\nimport { createRingBuffer, type EachDiff } from './tracking/each-diff.js'\nimport {\n createRingBuffer as createDisposerBuffer,\n type DisposerEvent,\n} from './tracking/disposer-log.js'\nimport { createCoverageTracker, type CoverageSnapshot } from './tracking/coverage.js'\nimport {\n createRingBuffer as createTimelineBuffer,\n createMockRegistry,\n createPendingEffectsList,\n type PendingEffect,\n type EffectTimelineEntry,\n type EffectMatch,\n} from './tracking/effect-timeline.js'\n\nexport interface StateDiff {\n added: Record<string, unknown>\n removed: Record<string, unknown>\n changed: Record<string, { from: unknown; to: unknown }>\n}\n\nfunction diffStateInternal(a: unknown, b: unknown): StateDiff {\n const out: StateDiff = { added: {}, removed: {}, changed: {} }\n if (\n a == null ||\n b == null ||\n typeof a !== 'object' ||\n typeof b !== 'object' ||\n Array.isArray(a) !== Array.isArray(b)\n ) {\n if (a !== b) out.changed['<root>'] = { from: a, to: b }\n return out\n }\n const aObj = a as Record<string, unknown>\n const bObj = b as Record<string, unknown>\n const keys = new Set([...Object.keys(aObj), ...Object.keys(bObj)])\n for (const k of keys) {\n if (!(k in aObj)) out.added[k] = bObj[k]\n else if (!(k in bObj)) out.removed[k] = aObj[k]\n else if (!Object.is(aObj[k], bObj[k])) out.changed[k] = { from: aObj[k], to: bObj[k] }\n }\n return out\n}\n\n/**\n * Enable devtools auto-installation for every mountApp call. Called by\n * compiler-generated dev code — never imported in production builds.\n * Once enabled, every mounted component attaches `globalThis.__lluiDebug`\n * to the most recently mounted instance.\n */\nexport function enableDevTools(): void {\n _setDevToolsInstall(installDevTools)\n}\n\n// ── MCP WebSocket Relay ─────────────────────────────────────────────\n// Forwards method calls from an out-of-process MCP server to the\n// current __lluiDebug API. Dev-mode only — compiler injects startRelay(port).\n//\n// On-demand: tries a SINGLE connection on page load. If it succeeds\n// (MCP server is already running), the relay stays open and reconnects\n// on drop. If it fails, no retry loop — just registers\n// `window.__lluiConnect(port?)` so the developer can connect later\n// from the console or when the MCP server starts.\n\nlet relayPort = 5200\nlet relayConnected = false\n\ninterface RelayRequest {\n id: string\n method: keyof LluiDebugAPI | '__listComponents' | '__selectComponent'\n args: unknown[]\n}\n\nfunction handleMessage(ws: WebSocket, event: MessageEvent): void {\n let req: RelayRequest\n try {\n req = JSON.parse(String(event.data)) as RelayRequest\n } catch {\n return\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const g = globalThis as any\n if (req.method === '__listComponents') {\n const keys = g.__lluiComponents ? Object.keys(g.__lluiComponents) : []\n const active =\n g.__lluiDebug && g.__lluiComponents\n ? (Object.entries(g.__lluiComponents).find(([, v]) => v === g.__lluiDebug)?.[0] ?? null)\n : null\n ws.send(JSON.stringify({ id: req.id, result: { components: keys, active } }))\n return\n }\n if (req.method === '__selectComponent') {\n const key = (req.args?.[0] as string | undefined) ?? ''\n const entry = g.__lluiComponents?.[key]\n if (!entry) {\n ws.send(JSON.stringify({ id: req.id, error: `unknown component: ${key}` }))\n return\n }\n g.__lluiDebug = entry\n ws.send(JSON.stringify({ id: req.id, result: { active: key } }))\n return\n }\n\n const api = g.__lluiDebug as LluiDebugAPI | undefined\n if (!api) {\n ws.send(JSON.stringify({ id: req.id, error: '__lluiDebug not available' }))\n return\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const fn = (api as any)[req.method]\n if (typeof fn !== 'function') {\n ws.send(JSON.stringify({ id: req.id, error: `unknown method: ${req.method}` }))\n return\n }\n try {\n const result = fn.apply(api, req.args ?? [])\n ws.send(JSON.stringify({ id: req.id, result: result ?? null }))\n } catch (e) {\n ws.send(JSON.stringify({ id: req.id, error: e instanceof Error ? e.message : String(e) }))\n }\n}\n\nfunction connectRelay(port: number, isInitial: boolean): void {\n if (typeof WebSocket === 'undefined') return\n\n let ws: WebSocket\n try {\n ws = new WebSocket(`ws://127.0.0.1:${port}`)\n } catch {\n if (!isInitial) console.warn(`[LLui MCP] failed to connect to ws://127.0.0.1:${port}`)\n return\n }\n\n ws.onopen = () => {\n relayConnected = true\n console.log(`[LLui MCP] connected to ws://127.0.0.1:${port}`)\n }\n ws.onmessage = (event) => handleMessage(ws, event)\n ws.onclose = () => {\n if (relayConnected) {\n relayConnected = false\n console.log('[LLui MCP] disconnected — call __lluiConnect() to reconnect')\n }\n }\n ws.onerror = () => {\n // onclose fires after onerror — nothing to do here\n }\n}\n\n/**\n * Register the MCP relay for this page.\n *\n * Discovery happens in two phases:\n *\n * 1. **Status endpoint** (preferred): fetches `/__llui_mcp_status`,\n * which the Vite plugin serves from the active marker file written\n * by `@llui/mcp`. If the MCP server is running, the response gives\n * us the actual port — we connect immediately. This avoids the race\n * where HMR events fire before the listener registers, and handles\n * cases where MCP runs on a non-default port.\n * 2. **Compile-time fallback**: if the status endpoint is unavailable\n * (404, network error, non-Vite environment), we attempt a single\n * connection to the compiled-in `port` parameter as a best-effort.\n *\n * Either way: no retry loop. If both fail, `window.__lluiConnect(port?)`\n * is exposed so the developer can connect manually from the console\n * when the MCP server starts. The Vite plugin also dispatches an\n * `llui:mcp-ready` HMR custom event when the marker file appears later,\n * which the compiler-injected dev code forwards to `__lluiConnect`.\n */\nexport function startRelay(port = 5200): void {\n relayPort = port\n if (typeof WebSocket === 'undefined') return\n\n // Expose manual connect for on-demand use\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const g = globalThis as any\n g.__lluiConnect = (p?: number) => {\n connectRelay(p ?? relayPort, false)\n }\n\n // Try the Vite middleware first (knows the actual port from the marker file)\n if (typeof fetch !== 'undefined') {\n fetch('/__llui_mcp_status')\n .then((res) => (res.ok ? (res.json() as Promise<{ port: number }>) : null))\n .then((data) => {\n if (data && typeof data.port === 'number') {\n relayPort = data.port\n connectRelay(data.port, true)\n } else {\n // Endpoint replied 404 — MCP not running. Don't fall back to the\n // compile-time port; the HMR event will fire if MCP starts later.\n }\n })\n .catch(() => {\n // Network error or non-Vite environment — fall back to compile-time port\n connectRelay(port, true)\n })\n } else {\n // No fetch available — use the compile-time port directly\n connectRelay(port, true)\n }\n}\n\nexport interface MessageRecord {\n index: number\n timestamp: number\n msg: unknown\n stateBefore: unknown\n stateAfter: unknown\n effects: unknown[]\n dirtyMask: number\n}\n\nexport interface BindingDebugInfo {\n index: number\n mask: number\n lastValue: unknown\n kind: string\n key: string | undefined\n dead: boolean\n perItem: boolean\n}\n\nexport interface UpdateExplanation {\n bindingIndex: number\n bindingMask: number\n lastDirtyMask: number\n matched: boolean\n accessorResult: unknown\n lastValue: unknown\n changed: boolean\n}\n\nexport interface ValidationError {\n path: string\n expected: string\n received: string\n message: string\n}\n\nexport interface LluiDebugAPI {\n getState(): unknown\n send(msg: unknown): void\n flush(): void\n getMessageHistory(opts?: { since?: number; limit?: number }): MessageRecord[]\n evalUpdate(msg: unknown): { state: unknown; effects: unknown[] }\n exportTrace(): {\n lluiTrace: 1\n component: string\n generatedBy: string\n timestamp: string\n entries: Array<{ msg: unknown; expectedState: unknown; expectedEffects: unknown[] }>\n }\n clearLog(): void\n validateMessage(msg: unknown): ValidationError[] | null\n getBindings(): BindingDebugInfo[]\n whyDidUpdate(bindingIndex: number): UpdateExplanation\n searchState(query: string): unknown\n /** Returns the compiled Msg schema (discriminant + variant field types). */\n getMessageSchema(): MessageSchemaInfo | null\n /** Returns the bit→field map injected by the compiler. Lets tools decode dirty-mask values. */\n getMaskLegend(): Record<string, number> | null\n /** Given a dirty mask, return the list of top-level fields it represents. */\n decodeMask(mask: number): string[]\n /** Component name + source location (file/line from compiler-injected metadata). */\n getComponentInfo(): ComponentInfo\n /** Returns the compiled State type shape (from TypeScript `type State = { … }`). */\n getStateSchema(): object | null\n /** Returns the compiled Effect schema (from TypeScript `type Effect = { … }` union). */\n getEffectSchema(): object | null\n /** Deep-clone the current state. Pair with restoreState() to checkpoint before risky operations. */\n snapshotState(): unknown\n /** Overwrite the current state with a previously-captured snapshot. Triggers a full re-render. */\n restoreState(snap: unknown): void\n /** Find all bindings whose target node matches or is a child of the selector. */\n getBindingsFor(selector: string): BindingLocation[]\n /** Return a rich structural + style + binding report for the first element matching selector. Returns null if no element matches or document is unavailable. */\n inspectElement(selector: string): ElementReport | null\n /** Get the outerHTML of the mounted component or a specific element. Pass a selector for a specific node (defaults to the mount root). Pass maxLength to truncate output. */\n getRenderedHtml(selector?: string, maxLength?: number): string\n /** Synthesize and dispatch a browser event at a DOM element matched by selector. Returns dispatched status, the history indices of any Msgs the handler produced, and the resulting state. */\n dispatchDomEvent(\n selector: string,\n type: string,\n init?: EventInit,\n ): {\n dispatched: boolean\n messagesProducedIndices: number[]\n resultingState: unknown | null\n }\n /** Return info about the currently focused element: { selector (if it has an id), tagName, selectionStart, selectionEnd }. Useful for catching \"focus lost on re-render\" bugs. */\n getFocus(): {\n selector: string | null\n tagName: string | null\n selectionStart: number | null\n selectionEnd: number | null\n }\n /** Re-evaluate every binding's accessor against the current state, apply values that changed to the DOM, and return indices of bindings that changed. */\n forceRerender(): { changedBindings: number[] }\n /** Per-each-site reconciliation diffs (added/removed/moved/reused keys) from the dev-time diff log. Pass sinceIndex to filter to entries after a specific message history index. */\n getEachDiff(sinceIndex?: number): EachDiff[]\n /** Walk the component's scope tree and return a nested ScopeNode with kind classification. Pass depth to limit traversal depth, scopeId to start from a specific scope. */\n getScopeTree(opts?: { depth?: number; scopeId?: string }): ScopeNode\n /** Recent onDispose firings with scope id and cause. Pass 'limit' to cap results to the N most recent entries. Catches 'leak on branch swap' class bugs. */\n getDisposerLog(limit?: number): DisposerEvent[]\n /** Edge list: state path → binding indices that depend on it. Inverts the compiler-emitted mask legend to show, for each top-level state field, which bindings will re-evaluate when it changes. */\n getBindingGraph(): Array<{ statePath: string; bindingIndices: number[] }>\n /** Current queued and in-flight effects. Each entry has { id, type, dispatchedAt, status, payload }. Use 'id' with llui_resolve_effect to manually resolve one. */\n getPendingEffects(): PendingEffect[]\n /** Phased log of effect events: dispatched -> in-flight -> resolved/cancelled/resolved-mocked. Each entry has { effectId, type, phase, timestamp, durationMs? }. Pass 'limit' to cap the tail. */\n getEffectTimeline(limit?: number): EffectTimelineEntry[]\n /** Register a mock for an effect matching 'match'. The next matching effect resolves with 'response' instead of running. Mocks are one-shot by default; pass { persist: true } to keep across matches. Returns { mockId } for later reference. */\n mockEffect(\n match: EffectMatch,\n response: unknown,\n opts?: { persist?: boolean },\n ): { mockId: string }\n /** Manually resolve a pending effect with a given response. The effect's onSuccess callback (if any) runs as if it had actually resolved. Pass effectId from llui_pending_effects. */\n resolveEffect(effectId: string, response: unknown): { resolved: boolean }\n /** Rewind state by replaying from init() with the last N messages excluded. mode='pure' suppresses effects; mode='live' re-fires them. Returns the new state and rewind depth. */\n stepBack(n: number, mode: 'pure' | 'live'): { state: unknown; rewindDepth: number }\n /** Per-Msg-variant coverage for the current session. Shows which message types have run and which haven't. */\n getCoverage(): CoverageSnapshot\n /** Run arbitrary JS in page context and return { result, sideEffects }. result is the expression's return value or { error }. sideEffects captures state diff, new history entries, new pending effects, and dirty binding indices. Phase 1 does not support async expressions. */\n evalInPage(code: string): {\n result: unknown | { error: string }\n sideEffects: {\n stateChanged: StateDiff | null\n newHistoryEntries: number\n newPendingEffects: PendingEffect[]\n dirtyBindingIndices: number[]\n }\n }\n}\n\nexport interface ElementReport {\n selector: string\n tagName: string\n attributes: Record<string, string>\n classes: string[]\n dataset: Record<string, string>\n text: string\n computed: {\n display: string\n visibility: string\n position: string\n width: number\n height: number\n }\n boundingBox: { x: number; y: number; width: number; height: number }\n bindings: Array<{\n bindingIndex: number\n kind: string\n mask: number\n lastValue: unknown\n relation: 'self' | 'text-child' | 'comment-child'\n }>\n}\n\nexport interface BindingLocation {\n bindingIndex: number\n kind: string\n key: string | undefined\n mask: number\n lastValue: unknown\n /** How the binding's node relates to the matched element: 'self' (binding on the element itself) or 'text-child' (text node inside). */\n relation: 'self' | 'text-child' | 'comment-child'\n}\n\nexport interface ComponentInfo {\n name: string\n file: string | null\n line: number | null\n}\n\nexport interface MessageSchemaInfo {\n discriminant: string\n variants: Record<string, Record<string, unknown>>\n}\n\nconst MAX_HISTORY = 1000\n\nfunction findScopeById(root: Scope, id: string): Scope | null {\n const n = Number(id)\n if (root.id === n) return root\n for (const c of root.children) {\n const found = findScopeById(c, id)\n if (found) return found\n }\n return null\n}\n\nfunction walkScope(s: Scope, depth: number, maxDepth: number): ScopeNode {\n const node: ScopeNode = {\n scopeId: String(s.id),\n kind: s._kind ?? 'root',\n active: true,\n children: [],\n }\n if (depth < maxDepth) {\n for (const c of s.children) node.children.push(walkScope(c, depth + 1, maxDepth))\n }\n return node\n}\n\nexport function installDevTools(inst: object): void {\n const ci = inst as ComponentInstance\n const history: MessageRecord[] = []\n let idx = 0\n let lastDirtyMask = 0\n\n // Tracker storage — populated by primitives when they detect dev-mode\n // is active (via `inst._eachDiffLog !== undefined` guard). Zero cost in\n // production where installDevTools never runs.\n ci._eachDiffLog = createRingBuffer(100)\n ci._updateCounter = 0\n // Disposer log — consumed by `llui_disposer_log` MCP tool. Stamped by\n // `disposeScope` via `findInstance(scope)` — which only works when the\n // rootScope carries an `instance` back-reference.\n ci._disposerLog = createDisposerBuffer(500)\n // Coverage tracker — consumed by `llui_coverage` MCP tool. Records the\n // discriminant of each dispatched message along with the message index\n // it fired at, allowing the tool to surface Msg variants that never\n // fired this session. Recorded inside the update interceptor below.\n ci._coverage = createCoverageTracker()\n // Effect timeline / pending / mocks — consumed by the\n // `llui_effect_timeline`, `llui_pending_effects`, `llui_mock_effect`,\n // and `llui_resolve_effect` MCP tools. Populated by the\n // `dispatchEffectDev` wrapper in `update-loop.ts`; zero cost in\n // production where `_effectTimeline` stays undefined.\n ci._effectTimeline = createTimelineBuffer(500)\n ci._effectMocks = createMockRegistry()\n ci._pendingEffects = createPendingEffectsList()\n ci.rootScope.instance = ci\n // Flip the scope-module flag so disposeScope starts walking the parent\n // chain to emit disposer events. Before the first installDevTools call\n // the flag stays false and disposeScope skips findInstance entirely.\n _markDisposerLogInstalled()\n\n const api: LluiDebugAPI = {\n getState: () => ci.state,\n send: (msg) => ci.send(msg as never),\n flush: () => flushInstance(ci),\n getMessageHistory: (opts) => {\n let result = history\n if (opts?.since !== undefined) {\n const since = opts.since\n result = result.filter((r) => r.index > since)\n }\n if (opts?.limit !== undefined && opts.limit > 0) {\n result = result.slice(-opts.limit)\n }\n return result.slice()\n },\n\n evalUpdate(msg) {\n const [state, effects] = ci.def.update(ci.state, msg as never)\n return { state, effects }\n },\n\n exportTrace() {\n return {\n lluiTrace: 1 as const,\n component: ci.def.name,\n generatedBy: 'devtools',\n timestamp: new Date().toISOString(),\n entries: history.map((h) => ({\n msg: h.msg,\n expectedState: h.stateAfter,\n expectedEffects: h.effects,\n })),\n }\n },\n\n clearLog() {\n history.length = 0\n idx = 0\n ci._updateCounter = 0\n ci._eachDiffLog?.clear()\n ci._disposerLog?.clear()\n ci._coverage?.clear()\n ci._effectTimeline?.clear()\n ci._effectMocks?.clear()\n // NB: `_pendingEffects` is intentionally NOT cleared — pending\n // entries represent in-flight effects that still have to land\n // resolution/cancellation phases. Dropping them here would leak\n // the ids that MCP tools hold onto for `llui_resolve_effect`.\n },\n\n validateMessage(msg: unknown): ValidationError[] | null {\n const schema = ci.def.__msgSchema as\n | { discriminant: string; variants: Record<string, Record<string, unknown>> }\n | undefined\n if (!schema) return null\n\n if (msg == null || typeof msg !== 'object') {\n return [\n {\n path: '',\n expected: 'object',\n received: typeof msg,\n message: 'Message must be an object',\n },\n ]\n }\n\n const msgObj = msg as Record<string, unknown>\n const discriminant = schema.discriminant\n const typeValue = msgObj[discriminant]\n\n if (typeValue === undefined) {\n return [\n {\n path: `.${discriminant}`,\n expected: `one of: ${Object.keys(schema.variants)\n .map((v) => `'${v}'`)\n .join(', ')}`,\n received: 'undefined',\n message: `Missing discriminant field '${discriminant}'`,\n },\n ]\n }\n\n if (typeof typeValue !== 'string') {\n return [\n {\n path: `.${discriminant}`,\n expected: 'string',\n received: typeof typeValue,\n message: `Discriminant field '${discriminant}' must be a string`,\n },\n ]\n }\n\n const variant = schema.variants[typeValue]\n if (!variant) {\n return [\n {\n path: `.${discriminant}`,\n expected: `one of: ${Object.keys(schema.variants)\n .map((v) => `'${v}'`)\n .join(', ')}`,\n received: `'${typeValue}'`,\n message: `Unknown message type '${typeValue}'`,\n },\n ]\n }\n\n // Validate fields of the matched variant\n const errors: ValidationError[] = []\n for (const [field, expectedType] of Object.entries(variant)) {\n if (field === discriminant) continue\n const value = msgObj[field]\n if (value === undefined) {\n errors.push({\n path: `.${field}`,\n expected: String(expectedType),\n received: 'undefined',\n message: `Missing required field '${field}'`,\n })\n } else if (typeof expectedType === 'string' && expectedType !== 'unknown') {\n if (typeof value !== expectedType) {\n errors.push({\n path: `.${field}`,\n expected: expectedType,\n received: typeof value,\n message: `Field '${field}' has wrong type`,\n })\n }\n }\n }\n\n return errors.length > 0 ? errors : null\n },\n\n getBindings(): BindingDebugInfo[] {\n const bindings: Binding[] = ci.allBindings ?? []\n return bindings.map((b, i) => ({\n index: i,\n mask: b.mask,\n lastValue: b.lastValue,\n kind: b.kind,\n key: b.key,\n dead: b.dead,\n perItem: b.perItem,\n }))\n },\n\n whyDidUpdate(bindingIndex: number): UpdateExplanation {\n const bindings: Binding[] = ci.allBindings ?? []\n const binding = bindings[bindingIndex]\n if (!binding) {\n return {\n bindingIndex,\n bindingMask: 0,\n lastDirtyMask: 0,\n matched: false,\n accessorResult: undefined,\n lastValue: undefined,\n changed: false,\n }\n }\n\n const matched = (binding.mask & lastDirtyMask) !== 0\n let accessorResult: unknown\n try {\n accessorResult = binding.accessor(ci.state)\n } catch {\n accessorResult = '<error>'\n }\n const changed = !Object.is(accessorResult, binding.lastValue)\n\n return {\n bindingIndex,\n bindingMask: binding.mask,\n lastDirtyMask,\n matched,\n accessorResult,\n lastValue: binding.lastValue,\n changed,\n }\n },\n\n searchState(query: string): unknown {\n const parts = query.split('.')\n let current: unknown = ci.state\n for (const part of parts) {\n if (current == null || typeof current !== 'object') return undefined\n current = (current as Record<string, unknown>)[part]\n }\n return current\n },\n\n getMessageSchema(): MessageSchemaInfo | null {\n return (ci.def.__msgSchema as MessageSchemaInfo | undefined) ?? null\n },\n\n getMaskLegend(): Record<string, number> | null {\n return ci.def.__maskLegend ?? null\n },\n\n decodeMask(mask: number): string[] {\n const legend = ci.def.__maskLegend\n if (!legend) return []\n const fields: string[] = []\n for (const [field, bit] of Object.entries(legend)) {\n if ((mask & bit) !== 0) fields.push(field)\n }\n return fields\n },\n\n getComponentInfo(): ComponentInfo {\n const meta = ci.def.__componentMeta\n return {\n name: ci.def.name,\n file: meta?.file ?? null,\n line: meta?.line ?? null,\n }\n },\n\n getStateSchema(): object | null {\n return (ci.def.__stateSchema as object | undefined) ?? null\n },\n\n getEffectSchema(): object | null {\n return (ci.def.__effectSchema as object | undefined) ?? null\n },\n\n snapshotState(): unknown {\n return JSON.parse(JSON.stringify(ci.state))\n },\n\n restoreState(snap: unknown): void {\n _forceState(ci, snap)\n },\n\n getBindingsFor(selector: string): BindingLocation[] {\n if (typeof document === 'undefined') return []\n const elements = Array.from(document.querySelectorAll(selector))\n if (elements.length === 0) return []\n const elementSet = new Set<Element>(elements)\n const results: BindingLocation[] = []\n for (let i = 0; i < ci.allBindings.length; i++) {\n const b = ci.allBindings[i]!\n if (b.dead) continue\n const node = b.node\n let relation: 'self' | 'text-child' | 'comment-child' | null = null\n if (node.nodeType === 1 && elementSet.has(node as Element)) {\n relation = 'self'\n } else if (\n (node.nodeType === 3 || node.nodeType === 8) &&\n node.parentElement &&\n elementSet.has(node.parentElement)\n ) {\n relation = node.nodeType === 3 ? 'text-child' : 'comment-child'\n }\n if (!relation) continue\n results.push({\n bindingIndex: i,\n kind: b.kind,\n key: b.key,\n mask: b.mask,\n lastValue: b.lastValue,\n relation,\n })\n }\n return results\n },\n\n inspectElement(selector: string): ElementReport | null {\n if (typeof document === 'undefined') return null\n const el = document.querySelector(selector)\n if (!el) return null\n\n const attributes: Record<string, string> = {}\n for (const attr of Array.from(el.attributes)) {\n attributes[attr.name] = attr.value\n }\n\n const classes = Array.from(el.classList)\n\n const dataset: Record<string, string> = {}\n if (el instanceof HTMLElement) {\n for (const [key, value] of Object.entries(el.dataset)) {\n if (typeof value === 'string') dataset[key] = value\n }\n }\n\n const rawText = el.textContent ?? ''\n const text = rawText.length > 1000 ? rawText.slice(0, 1000) : rawText\n\n const rect = el.getBoundingClientRect()\n const boundingBox = { x: rect.x, y: rect.y, width: rect.width, height: rect.height }\n\n let computed: ElementReport['computed']\n try {\n const cs = window.getComputedStyle(el)\n computed = {\n display: cs.display,\n visibility: cs.visibility,\n position: cs.position,\n width: rect.width,\n height: rect.height,\n }\n } catch {\n computed = {\n display: 'unknown',\n visibility: 'unknown',\n position: 'unknown',\n width: 0,\n height: 0,\n }\n }\n\n const rawBindings = api.getBindingsFor(selector)\n const bindings = rawBindings.map((b) => ({\n bindingIndex: b.bindingIndex,\n kind: b.kind,\n mask: b.mask,\n lastValue: b.lastValue,\n relation: b.relation,\n }))\n\n return {\n selector,\n tagName: el.tagName.toLowerCase(),\n attributes,\n classes,\n dataset,\n text,\n computed,\n boundingBox,\n bindings,\n }\n },\n\n getRenderedHtml(selector?: string, maxLength?: number): string {\n if (typeof document === 'undefined') return ''\n const el = selector ? document.querySelector(selector) : document.body\n if (!(el instanceof Element)) return ''\n const html = el.outerHTML\n if (typeof maxLength === 'number' && html.length > maxLength) {\n return html.slice(0, maxLength) + `<!-- truncated; total ${html.length} chars -->`\n }\n return html\n },\n\n dispatchDomEvent(\n selector: string,\n type: string,\n init?: EventInit,\n ): {\n dispatched: boolean\n messagesProducedIndices: number[]\n resultingState: unknown | null\n } {\n const noOp = { dispatched: false, messagesProducedIndices: [], resultingState: null }\n if (typeof document === 'undefined') return noOp\n const el = document.querySelector(selector)\n if (!el) return noOp\n\n const preIndex = history.length > 0 ? history[history.length - 1]!.index : -1\n\n let event: Event\n if (type === 'click' || type === 'mousedown' || type === 'mouseup') {\n event = new MouseEvent(type, {\n bubbles: true,\n cancelable: true,\n ...(init as MouseEventInit),\n })\n } else if (type === 'keydown' || type === 'keyup' || type === 'keypress') {\n event = new KeyboardEvent(type, {\n bubbles: true,\n cancelable: true,\n ...(init as KeyboardEventInit),\n })\n } else {\n event = new Event(type, { bubbles: true, cancelable: true, ...init })\n }\n\n el.dispatchEvent(event)\n flushInstance(ci)\n\n const messagesProducedIndices = history.filter((r) => r.index > preIndex).map((r) => r.index)\n\n return {\n dispatched: true,\n messagesProducedIndices,\n resultingState: ci.state,\n }\n },\n\n getFocus() {\n if (typeof document === 'undefined') {\n return { selector: null, tagName: null, selectionStart: null, selectionEnd: null }\n }\n const el = document.activeElement\n if (!el || el === document.body) {\n return { selector: null, tagName: null, selectionStart: null, selectionEnd: null }\n }\n const id = el.id ? `#${el.id}` : null\n const tagName = el.tagName.toLowerCase()\n let selectionStart: number | null = null\n let selectionEnd: number | null = null\n if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {\n selectionStart = el.selectionStart ?? null\n selectionEnd = el.selectionEnd ?? null\n }\n return { selector: id, tagName, selectionStart, selectionEnd }\n },\n\n forceRerender(): { changedBindings: number[] } {\n const changed: number[] = []\n const allBindings = ci.allBindings\n for (let i = 0; i < allBindings.length; i++) {\n const b = allBindings[i]!\n if (b.dead) continue\n const next = b.accessor(ci.state)\n if (!Object.is(next, b.lastValue)) {\n changed.push(i)\n b.lastValue = next\n applyBinding(b, next)\n }\n }\n return { changedBindings: changed }\n },\n\n getEachDiff(sinceIndex?: number): EachDiff[] {\n const all = ci._eachDiffLog?.toArray() ?? []\n if (sinceIndex === undefined) return all\n return all.filter((e) => e.updateIndex >= sinceIndex)\n },\n\n getScopeTree(opts?: { depth?: number; scopeId?: string }): ScopeNode {\n const maxDepth = opts?.depth ?? Infinity\n const startScope = opts?.scopeId ? findScopeById(ci.rootScope, opts.scopeId) : ci.rootScope\n if (!startScope) {\n return { scopeId: '0', kind: 'root', active: false, children: [] }\n }\n return walkScope(startScope, 0, maxDepth)\n },\n\n getDisposerLog(limit?: number): DisposerEvent[] {\n const all = ci._disposerLog?.toArray() ?? []\n if (limit === undefined) return all\n return all.slice(-Math.max(0, limit))\n },\n\n getBindingGraph(): Array<{ statePath: string; bindingIndices: number[] }> {\n const legend = ci.def.__maskLegend as Record<string, number> | undefined\n if (!legend) return []\n const result: Array<{ statePath: string; bindingIndices: number[] }> = []\n for (const [path, bit] of Object.entries(legend)) {\n const indices: number[] = []\n for (let i = 0; i < ci.allBindings.length; i++) {\n const b = ci.allBindings[i]!\n if ((b.mask & bit) !== 0) indices.push(i)\n }\n result.push({ statePath: path, bindingIndices: indices })\n }\n return result\n },\n\n getPendingEffects(): PendingEffect[] {\n return ci._pendingEffects?.list() ?? []\n },\n\n getEffectTimeline(limit?: number): EffectTimelineEntry[] {\n const all = ci._effectTimeline?.toArray() ?? []\n if (limit === undefined) return all\n return all.slice(-Math.max(0, limit))\n },\n\n mockEffect(match, response, opts) {\n if (!ci._effectMocks) return { mockId: '' }\n return { mockId: ci._effectMocks.add(match, response, Boolean(opts?.persist)) }\n },\n\n resolveEffect(effectId, response) {\n const pending = ci._pendingEffects?.findById(effectId)\n if (!pending) return { resolved: false }\n const payload = pending.payload as { onSuccess?: (d: unknown) => unknown } | undefined\n if (payload?.onSuccess) {\n const msg = payload.onSuccess(response)\n ci.send(msg as never)\n }\n ci._pendingEffects?.remove(effectId)\n ci._effectTimeline?.push({\n effectId,\n type: pending.type,\n phase: 'resolved',\n timestamp: Date.now(),\n durationMs: Date.now() - pending.dispatchedAt,\n })\n return { resolved: true }\n },\n\n stepBack(n: number, mode: 'pure' | 'live') {\n const rewindDepth = Math.min(Math.max(0, n), history.length)\n const keep = history.slice(0, history.length - rewindDepth)\n const [initialState] = ci.def.init(undefined) as [unknown, unknown[]]\n let state = initialState\n const collectedEffects: unknown[] = []\n for (const record of keep) {\n const [newState, newEffects] = (\n ci.def.update as unknown as (s: unknown, m: unknown) => [unknown, unknown[]]\n )(state, record.msg)\n state = newState\n if (mode === 'live') collectedEffects.push(...newEffects)\n }\n _forceState(ci, state)\n history.length = keep.length\n if (mode === 'live') {\n for (const eff of collectedEffects) {\n if (ci.def.onEffect)\n ci.def.onEffect({ effect: eff as never, send: ci.send, signal: ci.signal })\n }\n }\n return { state, rewindDepth }\n },\n\n getCoverage(): CoverageSnapshot {\n if (!ci._coverage) return { fired: {}, neverFired: [] }\n const schema = ci.def.__msgSchema as { variants?: Record<string, unknown> } | undefined\n const known = schema?.variants ? Object.keys(schema.variants) : undefined\n return ci._coverage.snapshot(known)\n },\n\n evalInPage(code: string) {\n const stateBefore = JSON.parse(JSON.stringify(ci.state))\n const historyLenBefore = history.length\n const pendingBefore = new Set((ci._pendingEffects?.list() ?? []).map((p) => p.id))\n const dirtyMaskBefore = lastDirtyMask\n\n let result: unknown | { error: string }\n try {\n const fn = new Function(`return (${code})`) as () => unknown\n const rv = fn()\n if (rv && typeof rv === 'object' && 'then' in (rv as object)) {\n result = {\n error:\n 'llui_eval does not support async expressions in Phase 1. Wrap awaits in an IIFE and expose the result synchronously via globalThis.',\n }\n } else {\n result = rv\n }\n } catch (err) {\n result = { error: err instanceof Error ? err.message : String(err) }\n }\n\n try {\n flushInstance(ci)\n } catch {\n // Best-effort; user's eval may have left the instance in a weird state\n }\n\n const stateAfter = ci.state\n const stateDiff = diffStateInternal(stateBefore, stateAfter)\n const stateChanged =\n Object.keys(stateDiff.added).length === 0 &&\n Object.keys(stateDiff.removed).length === 0 &&\n Object.keys(stateDiff.changed).length === 0\n ? null\n : stateDiff\n\n const newHistoryEntries = history.length - historyLenBefore\n const pendingNow = ci._pendingEffects?.list() ?? []\n const newPendingEffects = pendingNow.filter((p) => !pendingBefore.has(p.id))\n\n const dirtyBindingIndices: number[] = []\n const maskDiff = lastDirtyMask ^ dirtyMaskBefore\n for (let i = 0; i < ci.allBindings.length; i++) {\n const b = ci.allBindings[i]!\n if ((b.mask & maskDiff) !== 0) dirtyBindingIndices.push(i)\n }\n\n return {\n result,\n sideEffects: {\n stateChanged,\n newHistoryEntries,\n newPendingEffects,\n dirtyBindingIndices,\n },\n }\n },\n }\n\n // Intercept update to record transitions\n const originalUpdate = ci.def.update\n ci.def.update = ((state: unknown, msg: unknown) => {\n const [newState, effects] = (\n originalUpdate as (s: unknown, m: unknown) => [unknown, unknown[]]\n )(state, msg)\n const dirty = ci.def.__dirty\n ? (ci.def.__dirty as (o: unknown, n: unknown) => number)(state, newState)\n : -1\n\n lastDirtyMask = typeof dirty === 'number' ? dirty : -1\n\n const record: MessageRecord = {\n index: idx,\n timestamp: Date.now(),\n msg,\n stateBefore: state,\n stateAfter: newState,\n effects,\n dirtyMask: lastDirtyMask,\n }\n\n // _updateCounter and the history index track the same thing —\n // tie them so EachDiff entries emitted during the ensuing Phase 1\n // reconcile carry the same updateIndex as the message record that\n // caused the reconcile. `each.ts` reads `inst._updateCounter` when\n // stamping EachDiff entries.\n ci._updateCounter = idx\n\n // Coverage: record the discriminant of this message at the SAME\n // index stamped on the MessageRecord above, so tools can cross-\n // reference `getMessageHistory()[i]` with `coverage.fired[v].lastIndex`.\n const variant =\n msg && typeof msg === 'object' && 'type' in (msg as Record<string, unknown>)\n ? String((msg as Record<string, unknown>).type)\n : '<non-discriminant>'\n ci._coverage?.record(variant, idx)\n\n idx++\n\n if (history.length >= MAX_HISTORY) history.shift()\n history.push(record)\n\n return [newState, effects]\n }) as typeof ci.def.update\n\n // Register in the multi-component registry and point __lluiDebug at the\n // newest mount (so single-component apps keep working unchanged). Tools\n // can switch the active pointer via llui_select_component.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const g = globalThis as any\n if (!g.__lluiComponents) g.__lluiComponents = {} as Record<string, LluiDebugAPI>\n const componentKey = uniqueName(g.__lluiComponents, ci.def.name)\n g.__lluiComponents[componentKey] = api\n g.__lluiDebug = api\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(api as any).__componentKey = componentKey\n}\n\n// Generate a unique key for a component name if it's already taken\n// (e.g. same component mounted into multiple containers).\nfunction uniqueName(registry: Record<string, unknown>, name: string): string {\n if (!(name in registry)) return name\n let i = 2\n while (`${name}#${i}` in registry) i++\n return `${name}#${i}`\n}\n"]}
|
package/dist/hmr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmr.d.ts","sourceRoot":"","sources":["../src/hmr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAUzD;;;GAGG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAEhC;AAWD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,GAAG,IAAI,CAIvF;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAMjE;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACtC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC5B,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"hmr.d.ts","sourceRoot":"","sources":["../src/hmr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAUzD;;;GAGG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAEhC;AAWD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,GAAG,IAAI,CAIvF;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAMjE;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACtC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC5B,SAAS,GAAG,IAAI,CAwElB"}
|
package/dist/hmr.js
CHANGED
|
@@ -60,6 +60,7 @@ export function replaceComponent(name, newDef) {
|
|
|
60
60
|
container.textContent = '';
|
|
61
61
|
// Create fresh scope tree
|
|
62
62
|
typedInst.rootScope = createScope(null);
|
|
63
|
+
typedInst.rootScope._kind = 'root';
|
|
63
64
|
typedInst.allBindings = [];
|
|
64
65
|
typedInst.structuralBlocks = [];
|
|
65
66
|
// Re-run view with current state
|
|
@@ -71,6 +72,7 @@ export function replaceComponent(name, newDef) {
|
|
|
71
72
|
structuralBlocks: typedInst.structuralBlocks,
|
|
72
73
|
container,
|
|
73
74
|
send: typedInst.send,
|
|
75
|
+
instance: typedInst,
|
|
74
76
|
});
|
|
75
77
|
const nodes = typedInst.def.view(createView(typedInst.send));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ACf,CAAC;oBAAC,SAAS,CAAC,IAA6B,CAAC,GAAG,CAAC,CAAA;gBAChD,CAAC;aACF,CAAA;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,4BAA4B,CAAC,CAAA;IAE3D,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import type { ComponentDef, AppHandle } from './types.js'\nimport type { ComponentInstance } from './update-loop.js'\nimport { flushInstance } from './update-loop.js'\nimport { createScope, disposeScope } from './scope.js'\nimport { setRenderContext, clearRenderContext } from './render-context.js'\nimport { setFlatBindings } from './binding.js'\nimport { unregisterInstance } from './runtime.js'\nimport { _setHmrModule } from './mount.js'\nimport { createView } from './view-helpers.js'\n\n/**\n * Enable HMR state preservation. Called by compiler-generated dev code.\n * Importing this module registers it with mountApp for hot-swapping.\n */\nexport function enableHmr(): void {\n _setHmrModule({ enableHmr, registerForHmr, unregisterForHmr, replaceComponent })\n}\n\n// ── HMR Registry ─────────────────────────────────────────────────\n\ninterface HmrEntry {\n inst: ComponentInstance\n container: HTMLElement\n}\n\nconst hmrRegistry = new Map<string, HmrEntry[]>()\n\nexport function registerForHmr(name: string, inst: object, container: HTMLElement): void {\n const entries = hmrRegistry.get(name) ?? []\n entries.push({ inst: inst as ComponentInstance, container })\n hmrRegistry.set(name, entries)\n}\n\nexport function unregisterForHmr(name: string, inst: object): void {\n const entries = hmrRegistry.get(name)\n if (!entries) return\n const idx = entries.findIndex((e) => e.inst === inst)\n if (idx !== -1) entries.splice(idx, 1)\n if (entries.length === 0) hmrRegistry.delete(name)\n}\n\n/**\n * Hot-swap a component definition on all live instances.\n *\n * Preserves the current state. Replaces update, view, onEffect, and __dirty.\n * Disposes the old scope tree (removing old DOM and bindings),\n * re-runs view(currentState, send) to rebuild fresh DOM.\n *\n * Returns an AppHandle for the first instance (for mountApp compatibility),\n * or null if no instances are registered (first mount).\n */\nexport function replaceComponent<S, M, E>(\n name: string,\n newDef: ComponentDef<S, M, E>,\n): AppHandle | null {\n const entries = hmrRegistry.get(name)\n if (!entries || entries.length === 0) return null\n\n let handle: AppHandle | null = null\n\n for (const { inst, container } of entries) {\n const typedInst = inst as ComponentInstance<S, M, E>\n\n // Replace functions on the live definition\n typedInst.def = {\n ...typedInst.def,\n update: newDef.update,\n view: newDef.view,\n onEffect: newDef.onEffect,\n __dirty: newDef.__dirty,\n __update: newDef.__update,\n __handlers: newDef.__handlers,\n }\n\n // Dispose old scope tree — removes all old DOM nodes and bindings\n disposeScope(typedInst.rootScope)\n container.textContent = ''\n\n // Create fresh scope tree\n typedInst.rootScope = createScope(null)\n typedInst.rootScope._kind = 'root'\n typedInst.allBindings = []\n typedInst.structuralBlocks = []\n\n // Re-run view with current state\n setFlatBindings(typedInst.allBindings)\n setRenderContext({\n rootScope: typedInst.rootScope,\n state: typedInst.state,\n allBindings: typedInst.allBindings,\n structuralBlocks: typedInst.structuralBlocks,\n container,\n send: typedInst.send as (msg: unknown) => void,\n instance: typedInst as ComponentInstance,\n })\n const nodes = typedInst.def.view(createView<S, M>(typedInst.send))\n clearRenderContext()\n setFlatBindings(null)\n\n for (const node of nodes) {\n container.appendChild(node)\n }\n\n // Return AppHandle for the first instance\n if (!handle) {\n handle = {\n dispose() {\n unregisterForHmr(name, inst)\n inst.abortController.abort()\n unregisterInstance(inst)\n disposeScope(typedInst.rootScope)\n container.textContent = ''\n },\n flush() {\n flushInstance(inst)\n },\n send(msg: unknown) {\n ;(typedInst.send as (m: unknown) => void)(msg)\n },\n }\n }\n }\n\n console.log(`[LLui HMR] ${name} updated — state preserved`)\n\n return handle\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,12 @@ export type { ComponentDef, Send, Props, AppHandle, Scope, Binding, BindingKind,
|
|
|
2
2
|
export { component } from './component.js';
|
|
3
3
|
export { createView, type View } from './view-helpers.js';
|
|
4
4
|
export { mountApp, hydrateApp, type MountOptions } from './mount.js';
|
|
5
|
-
export type { LluiDebugAPI } from './devtools.js';
|
|
5
|
+
export type { LluiDebugAPI, ElementReport, MessageRecord, StateDiff } from './devtools.js';
|
|
6
|
+
export type { CoverageSnapshot } from './tracking/coverage.js';
|
|
7
|
+
export type { EachDiff } from './tracking/each-diff.js';
|
|
8
|
+
export type { DisposerEvent } from './tracking/disposer-log.js';
|
|
9
|
+
export type { PendingEffect, EffectTimelineEntry, EffectMatch } from './tracking/effect-timeline.js';
|
|
10
|
+
export type { ScopeNode } from './types.js';
|
|
6
11
|
export { flush } from './runtime.js';
|
|
7
12
|
export { addressOf } from './addressed.js';
|
|
8
13
|
export { renderToString, renderNodes, serializeNodes } from './ssr.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACV,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,SAAS,EACT,KAAK,EACL,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAA;AAInB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAIzD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAA;AAGpE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACV,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,SAAS,EACT,KAAK,EACL,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,GACb,MAAM,YAA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,EACR,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,aAAa,GACd,MAAM,sBAAsB,CAAA;AAI7B,OAAO,EAAE,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAA;AAIrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAoBrE,qEAAqE;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAa,MAAM,mBAAmB,CAAA;AAEzD,qEAAqE;AAErE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAqB,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAoBrE,qEAAqE;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAa,MAAM,mBAAmB,CAAA;AAEzD,qEAAqE;AAErE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAqB,MAAM,YAAY,CAAA;AAUpE,qEAAqE;AAErE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EACL,aAAa,EACb,OAAO,EACP,YAAY,EACZ,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AAE,EACF,EAAE,EACF,EAAE,EACF,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,UAAU,EACV,aAAa,EACb,WAAW,EACX,KAAK,EACL,MAAM,EACN,GAAG,EACH,GAAG,EACH,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,aAAa,GACd,MAAM,sBAAsB,CAAA;AAE7B,qEAAqE;AAErE,OAAO,EAAE,UAAU,EAAiB,MAAM,WAAW,CAAA;AAErD,qEAAqE;AAErE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAA","sourcesContent":["// ── Types ─────────────────────────────────────────────────────────\n\nexport type {\n ComponentDef,\n Send,\n Props,\n AppHandle,\n Scope,\n Binding,\n BindingKind,\n TransitionOptions,\n BranchOptions,\n ShowOptions,\n EachOptions,\n ItemAccessor,\n PortalOptions,\n ForeignOptions,\n ChildOptions,\n} from './types.js'\n\n// ── Component ─────────────────────────────────────────────────────\n\nexport { component } from './component.js'\nexport { createView, type View } from './view-helpers.js'\n\n// ── Mount ─────────────────────────────────────────────────────────\n\nexport { mountApp, hydrateApp, type MountOptions } from './mount.js'\n// installDevTools is NOT re-exported here to keep it out of production bundles.\n// Import directly: import { installDevTools } from '@llui/dom/devtools'\nexport type { LluiDebugAPI, ElementReport, MessageRecord, StateDiff } from './devtools.js'\nexport type { CoverageSnapshot } from './tracking/coverage.js'\nexport type { EachDiff } from './tracking/each-diff.js'\nexport type { DisposerEvent } from './tracking/disposer-log.js'\nexport type { PendingEffect, EffectTimelineEntry, EffectMatch } from './tracking/effect-timeline.js'\nexport type { ScopeNode } from './types.js'\n\n// ── Runtime ───────────────────────────────────────────────────────\n\nexport { flush } from './runtime.js'\nexport { addressOf } from './addressed.js'\nexport { renderToString, renderNodes, serializeNodes } from './ssr.js'\nexport { mergeHandlers } from './merge-handlers.js'\nexport {\n createContext,\n provide,\n provideValue,\n useContext,\n useContextValue,\n type Context,\n} from './primitives/context.js'\nexport { sliceHandler } from './slice-handler.js'\nexport {\n childHandlers,\n type ChildState,\n type ChildMsg,\n type ModuleState,\n type ModuleMsg,\n} from './compose.js'\n\n// ── View Primitives ───────────────────────────────────────────────\n\nexport { text } from './primitives/text.js'\nexport { branch } from './primitives/branch.js'\nexport { each } from './primitives/each.js'\nexport { virtualEach, type VirtualEachOptions } from './primitives/virtual-each.js'\nexport { show } from './primitives/show.js'\nexport { slice } from './primitives/slice.js'\nexport { portal } from './primitives/portal.js'\nexport { foreign } from './primitives/foreign.js'\nexport { child } from './primitives/child.js'\nexport { lazy, type LazyOptions } from './primitives/lazy.js'\nexport type { LazyDef, AnyComponentDef } from './types.js'\nexport { memo } from './primitives/memo.js'\nexport { selector } from './primitives/selector.js'\nexport { onMount } from './primitives/on-mount.js'\nexport { errorBoundary } from './primitives/error-boundary.js'\n\n// ── Element Helpers ───────────────────────────────────────────────\n\nexport {\n a,\n abbr,\n article,\n aside,\n b,\n blockquote,\n br,\n button,\n canvas,\n code,\n dd,\n details,\n dialog,\n div,\n dl,\n dt,\n em,\n fieldset,\n figcaption,\n figure,\n footer,\n form,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n header,\n hr,\n i,\n iframe,\n img,\n input,\n label,\n legend,\n li,\n main,\n mark,\n nav,\n ol,\n optgroup,\n option,\n output,\n p,\n pre,\n progress,\n section,\n select,\n small,\n span,\n strong,\n sub,\n summary,\n sup,\n table,\n tbody,\n td,\n textarea,\n tfoot,\n th,\n thead,\n time,\n tr,\n ul,\n video,\n} from './elements.js'\n\n// ── SVG Elements ─────────────────────────────────────────────────\n\nexport {\n svg,\n g,\n defs,\n symbol,\n use,\n circle,\n ellipse,\n line,\n path,\n polygon,\n polyline,\n rect,\n text as svgText,\n tspan,\n textPath,\n clipPath,\n linearGradient,\n radialGradient,\n stop,\n mask,\n pattern,\n marker,\n filter,\n feBlend,\n feColorMatrix,\n feComponentTransfer,\n feComposite,\n feConvolveMatrix,\n feDiffuseLighting,\n feDisplacementMap,\n feDropShadow,\n feFlood,\n feGaussianBlur,\n feImage,\n feMerge,\n feMergeNode,\n feMorphology,\n feOffset,\n feSpecularLighting,\n feTile,\n feTurbulence,\n fePointLight,\n feSpotLight,\n feDistantLight,\n feFuncR,\n feFuncG,\n feFuncB,\n feFuncA,\n image,\n foreignObject,\n animate,\n animateMotion,\n animateTransform,\n set,\n mpath,\n desc,\n title as svgTitle,\n metadata,\n} from './svg-elements.js'\n\n// ── MathML Elements ──────────────────────────────────────────────\n\nexport {\n math,\n mi,\n mn,\n mo,\n ms,\n mtext,\n mrow,\n mfrac,\n msqrt,\n mroot,\n msup,\n msub,\n msubsup,\n munder,\n mover,\n munderover,\n mmultiscripts,\n mprescripts,\n mnone,\n mtable,\n mtr,\n mtd,\n mspace,\n mpadded,\n mphantom,\n menclose,\n merror,\n maction,\n semantics,\n annotation,\n annotationXml,\n} from './mathml-elements.js'\n\n// ── Form Utilities ────────────────────────────────────────────────\n\nexport { applyField, type FieldMsg } from './form.js'\n\n// ── Compiler Target ───────────────────────────────────────────────\n\nexport { elSplit } from './el-split.js'\nexport { elTemplate } from './el-template.js'\nexport { _runPhase2 as __runPhase2, _handleMsg as __handleMsg } from './update-loop.js'\n"]}
|
package/dist/mount.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAUhE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB,G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,CAAC,EACd,OAAO,CAAC,EAAE,YAAY,GACrB,SAAS,CAqEX"}
|
package/dist/mount.js
CHANGED
|
@@ -50,7 +50,12 @@ export function mountApp(container, def, data, options) {
|
|
|
50
50
|
// between mount and the queueMicrotask callback running.
|
|
51
51
|
const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue();
|
|
52
52
|
setFlatBindings(inst.allBindings);
|
|
53
|
-
setRenderContext({
|
|
53
|
+
setRenderContext({
|
|
54
|
+
...inst,
|
|
55
|
+
container,
|
|
56
|
+
send: inst.send,
|
|
57
|
+
instance: inst,
|
|
58
|
+
});
|
|
54
59
|
const nodes = def.view(createView(inst.send));
|
|
55
60
|
clearRenderContext();
|
|
56
61
|
setFlatBindings(null);
|
|
@@ -86,6 +91,9 @@ export function mountApp(container, def, data, options) {
|
|
|
86
91
|
hmrModule.unregisterForHmr(def.name, inst);
|
|
87
92
|
inst.abortController.abort();
|
|
88
93
|
unregisterInstance(inst);
|
|
94
|
+
// Tag the root scope so the disposer log reports app-level
|
|
95
|
+
// teardown distinct from in-tree component-unmount events.
|
|
96
|
+
inst.rootScope.disposalCause = 'app-unmount';
|
|
89
97
|
disposeScope(inst.rootScope);
|
|
90
98
|
container.textContent = '';
|
|
91
99
|
},
|
|
@@ -182,7 +190,12 @@ export function hydrateApp(container, def, serverState, options) {
|
|
|
182
190
|
// after the swap, matching mountApp's ordering.
|
|
183
191
|
const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue();
|
|
184
192
|
setFlatBindings(inst.allBindings);
|
|
185
|
-
setRenderContext({
|
|
193
|
+
setRenderContext({
|
|
194
|
+
...inst,
|
|
195
|
+
container,
|
|
196
|
+
send: inst.send,
|
|
197
|
+
instance: inst,
|
|
198
|
+
});
|
|
186
199
|
const nodes = hydrateDef.view(createView(inst.send));
|
|
187
200
|
clearRenderContext();
|
|
188
201
|
setFlatBindings(null);
|
|
@@ -203,6 +216,9 @@ export function hydrateApp(container, def, serverState, options) {
|
|
|
203
216
|
disposed = true;
|
|
204
217
|
inst.abortController.abort();
|
|
205
218
|
unregisterInstance(inst);
|
|
219
|
+
// Tag the root scope so the disposer log reports app-level
|
|
220
|
+
// teardown distinct from in-tree component-unmount events.
|
|
221
|
+
inst.rootScope.disposalCause = 'app-unmount';
|
|
206
222
|
disposeScope(inst.rootScope);
|
|
207
223
|
container.textContent = '';
|
|
208
224
|
},
|
package/dist/mount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AASzF,mEAAmE;AACnE,0EAA0E;AAE1E,IAAI,SAAS,GAAkC,IAAI,CAAA;AAEnD,sDAAsD;AACtD,MAAM,UAAU,aAAa,CAAC,CAAyB;IACrD,SAAS,GAAG,CAAC,CAAA;AACf,CAAC;AAED,mEAAmE;AACnE,oFAAoF;AAEpF,IAAI,eAAe,GAAoC,IAAI,CAAA;AAE3D,gEAAgE;AAChE,MAAM,UAAU,mBAAmB,CAAC,EAAmC;IACrE,eAAe,GAAG,EAAE,CAAA;AACtB,CAAC;AAmBD,MAAM,UAAU,QAAQ,CACtB,SAAsB,EACtB,GAA0B,EAC1B,IAAc,EACd,OAAsB;IAEtB,iEAAiE;IACjE,8EAA8E;IAC9E,0EAA0E;IAC1E,yEA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CAAA;AACH,CAAC","sourcesContent":["import type { ComponentDef, AppHandle, Scope } from './types.js'\nimport { createComponentInstance, flushInstance } from './update-loop.js'\nimport { disposeScope } from './scope.js'\nimport { setRenderContext, clearRenderContext } from './render-context.js'\nimport { setFlatBindings } from './binding.js'\nimport { registerInstance, unregisterInstance } from './runtime.js'\nimport { createView } from './view-helpers.js'\nimport { pushMountQueue, popMountQueue, flushMountQueue } from './primitives/on-mount.js'\n\n// Vite injects import.meta.env.DEV — declare the shape for TypeScript\ndeclare global {\n interface ImportMeta {\n env?: { DEV?: boolean }\n }\n}\n\n// ── HMR (dev only) ──────────────────────────────────────────────\n// Set by enableHmr() from '@llui/dom/hmr' — never imported in production.\n\nlet hmrModule: typeof import('./hmr') | null = null\n\n/** @internal Called by enableHmr in the hmr module */\nexport function _setHmrModule(m: typeof import('./hmr')): void {\n hmrModule = m\n}\n\n// ── DevTools auto-install (dev only) ────────────────────────────\n// Set by enableDevTools() from '@llui/dom/devtools' — never imported in production.\n\nlet devToolsInstall: ((inst: object) => void) | null = null\n\n/** @internal Called by enableDevTools in the devtools module */\nexport function _setDevToolsInstall(fn: ((inst: object) => void) | null): void {\n devToolsInstall = fn\n}\n\nexport interface MountOptions {\n devTools?: boolean\n /**\n * Parent scope for the mounted component's rootScope. When provided,\n * the rootScope is created as a child of this scope — context lookups\n * from within the component walk up through the parent's scope tree,\n * and disposing the parent scope cascades into this instance's scope.\n * Used by `@llui/vike`'s persistent-layout machinery to mount a page\n * as a true scope-tree child of its enclosing layout, so layout-\n * provided contexts flow naturally into pages via `useContext`.\n *\n * When omitted (the default), the rootScope is detached — same as\n * every `mountApp` call before persistent layouts existed.\n */\n parentScope?: Scope\n}\n\nexport function mountApp<S, M, E>(\n container: HTMLElement,\n def: ComponentDef<S, M, E>,\n data?: unknown,\n options?: MountOptions,\n): AppHandle {\n // HMR: if this component is already mounted (module re-execution\n // during hot update), swap the definition instead of creating a new instance.\n // HMR swap bypasses parentScope — HMR re-mounts the outermost app handle,\n // which in a layout setup means the layout re-mounts at the root and the\n // rest of the chain is re-established via the normal mount path.\n if (hmrModule && def.name && !options?.parentScope) {\n const swapped = hmrModule.replaceComponent(def.name, def)\n if (swapped) return swapped\n }\n\n const inst = createComponentInstance(def, data, options?.parentScope ?? null)\n\n // Dev-only: auto-install devtools if enabled via '@llui/dom/devtools' import\n if (devToolsInstall) devToolsInstall(inst)\n\n // Dev-only: warn if initial state contains non-serializable values.\n // Silent bug-bomb: Date/Map/Set/class instances break SSR, hydration, replay tools.\n if (import.meta.env?.DEV) {\n const offender = findNonSerializable(inst.state)\n if (offender) {\n console.warn(\n `[LLui] <${def.name}> initial state contains a non-serializable value at \"${offender.path}\":`,\n offender.value,\n '\\nState must be plain JSON (no Date/Map/Set/class instances/functions).' +\n '\\nThis will break SSR hydration, state replay, and devtools snapshots.' +\n '\\nhint: Convert to a serializable representation (e.g., Date → ISO string, Map → Record).',\n )\n }\n }\n\n // Run view() within a render context so primitives can register bindings.\n // Also collect onMount callbacks in a queue we'll flush synchronously\n // after node insertion — prevents the race where a user event fires\n // between mount and the queueMicrotask callback running.\n const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue()\n setFlatBindings(inst.allBindings)\n setRenderContext({ ...inst, container, send: inst.send as (msg: unknown) => void })\n const nodes = def.view(createView<S, M>(inst.send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(prevMountQueue)\n\n // Batch-insert via DocumentFragment — one layout-invalidating operation\n // instead of N individual appendChild calls on a live container element.\n if (nodes.length > 1) {\n const frag = document.createDocumentFragment()\n for (const node of nodes) frag.appendChild(node)\n container.appendChild(frag)\n } else if (nodes.length === 1) {\n container.appendChild(nodes[0]!)\n }\n\n // Flush onMount callbacks SYNCHRONOUSLY now that the DOM is in place.\n // Any listeners they attach are ready before this function returns,\n // so a synchronous dispatchEvent in the caller's next line fires\n // against a fully-wired tree.\n flushMountQueue(onMountQueue)\n\n registerInstance(inst)\n if (hmrModule && def.name) {\n hmrModule.registerForHmr(def.name, inst, container)\n }\n dispatchInitialEffects(inst)\n let disposed = false\n\n return {\n dispose() {\n if (disposed) return\n disposed = true\n if (hmrModule && def.name) hmrModule.unregisterForHmr(def.name, inst)\n inst.abortController.abort()\n unregisterInstance(inst)\n disposeScope(inst.rootScope)\n container.textContent = ''\n },\n flush() {\n if (disposed) return\n flushInstance(inst)\n },\n send(msg: unknown) {\n if (disposed) return\n ;(inst.send as (m: unknown) => void)(msg)\n },\n }\n}\n\n// Walks an object graph looking for non-JSON-serializable values. Returns the\n// first offender found (depth-first), or null if everything is fine. Stops at\n// depth 6 to bound runtime cost for large states.\nfunction findNonSerializable(\n v: unknown,\n path = 'state',\n depth = 0,\n seen = new WeakSet<object>(),\n): { path: string; value: unknown } | null {\n if (depth > 6) return null\n if (v === null || v === undefined) return null\n const t = typeof v\n if (t === 'string' || t === 'number' || t === 'boolean') return null\n if (t === 'function') return { path, value: v }\n if (t === 'symbol' || t === 'bigint') return { path, value: v }\n if (t !== 'object') return null\n const obj = v as object\n if (seen.has(obj)) return null\n seen.add(obj)\n if (obj instanceof Date) return { path: `${path} (Date)`, value: v }\n if (obj instanceof Map) return { path: `${path} (Map)`, value: v }\n if (obj instanceof Set) return { path: `${path} (Set)`, value: v }\n if (obj instanceof RegExp) return { path: `${path} (RegExp)`, value: v }\n if (obj instanceof Promise) return { path: `${path} (Promise)`, value: v }\n // Plain objects/arrays have Object.prototype / Array.prototype. Class instances\n // have a different prototype.\n const proto = Object.getPrototypeOf(obj)\n if (proto !== null && proto !== Object.prototype && proto !== Array.prototype) {\n return { path: `${path} (${proto?.constructor?.name ?? 'class instance'})`, value: v }\n }\n if (Array.isArray(v)) {\n for (let i = 0; i < v.length; i++) {\n const r = findNonSerializable(v[i], `${path}[${i}]`, depth + 1, seen)\n if (r) return r\n }\n return null\n }\n for (const k of Object.keys(obj)) {\n const r = findNonSerializable(\n (obj as Record<string, unknown>)[k],\n `${path}.${k}`,\n depth + 1,\n seen,\n )\n if (r) return r\n }\n return null\n}\n\nfunction dispatchInitialEffects<S, M, E>(\n inst: ReturnType<typeof createComponentInstance<S, M, E>>,\n): void {\n if (inst.initialEffects.length === 0 || !inst.def.onEffect) return\n for (const effect of inst.initialEffects) {\n inst.def.onEffect({ effect, send: inst.send, signal: inst.signal })\n }\n inst.initialEffects = []\n}\n\nexport function hydrateApp<S, M, E>(\n container: HTMLElement,\n def: ComponentDef<S, M, E>,\n serverState: S,\n options?: MountOptions,\n): AppHandle {\n // Run the original init once to capture its effects. The state it\n // returns is discarded — we use `serverState` (what the server\n // rendered with) instead. The effects are preserved and dispatched\n // after the DOM is in place, so components that rely on \"load data\n // or wire subscriptions on mount\" behave consistently between fresh\n // mount and SSR+hydrate. If the original init has already-loaded\n // data for the hydration case, gate the effect emission inside init\n // itself (e.g. based on a `loaded` flag in state).\n const [, originalEffects] = (def.init as (data: unknown) => [S, E[]])(undefined)\n\n const hydrateDef: ComponentDef<S, M, E> = {\n ...def,\n init: () => [serverState, originalEffects],\n }\n\n const inst = createComponentInstance(hydrateDef, undefined, options?.parentScope ?? null)\n\n // Build the component DOM and swap atomically with server HTML.\n // Server HTML remains visible until JS finishes — no flash.\n // onMount callbacks are collected in a queue and flushed synchronously\n // after the swap, matching mountApp's ordering.\n const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue()\n setFlatBindings(inst.allBindings)\n setRenderContext({ ...inst, container, send: inst.send as (msg: unknown) => void })\n const nodes = hydrateDef.view(createView<S, M>(inst.send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(prevMountQueue)\n\n // Atomic swap — replaces server HTML with client DOM in one operation\n container.replaceChildren(...nodes)\n\n // Flush onMount callbacks synchronously now that the DOM is in place.\n flushMountQueue(onMountQueue)\n\n // Fire the original init's effects post-swap, matching mountApp's\n // lifecycle. Previously these were silently dropped.\n dispatchInitialEffects(inst)\n\n registerInstance(inst)\n let disposed = false\n\n return {\n dispose() {\n if (disposed) return\n disposed = true\n inst.abortController.abort()\n unregisterInstance(inst)\n disposeScope(inst.rootScope)\n container.textContent = ''\n },\n flush() {\n if (disposed) return\n flushInstance(inst)\n },\n send(msg: unknown) {\n if (disposed) return\n ;(inst.send as (m: unknown) => void)(msg)\n },\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAA0B,MAAM,kBAAkB,CAAA;AACjG,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AASzF,mEAAmE;AACnE,0EAA0E;AAE1E,IAAI,SAAS,GAAkC,IAAI,CAAA;AAEnD,sDAAsD;AACtD,MAAM,UAAU,aAAa,CAAC,CAAyB;IACrD,SAAS,GAAG,CAAC,CAAA;AACf,CAAC;AAED,mEAAmE;AACnE,oFAAoF;AAEpF,IAAI,eAAe,GAAoC,IAAI,CAAA;AAE3D,gEAAgE;AAChE,MAAM,UAAU,mBAAmB,CAAC,EAAmC;IACrE,eAAe,GAAG,EAAE,CAAA;AACtB,CAAC;AAmBD,MAAM,UAAU,QAAQ,CACtB,SAAsB,EACtB,GAA0B,EAC1B,IAAc,EACd,OAAsB;IAEtB,iEAAiE;IACjE,8EAA8E;IAC9E,0EAA0E;IAC1E,yEAAyE;IACzE,iEAAiE;IACjE,IAAI,SAAS,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,CAAC;QACnD,MAAM,OAAO,GAAG,SAAS,CAAC,gB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E,OACb;YAAC,IAAI,CAAC,IAA6B,CAAC,GAAG,CAAC,CAAA;QAC3C,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import type { ComponentDef, AppHandle, Scope } from './types.js'\nimport { createComponentInstance, flushInstance, type ComponentInstance } from './update-loop.js'\nimport { disposeScope } from './scope.js'\nimport { setRenderContext, clearRenderContext } from './render-context.js'\nimport { setFlatBindings } from './binding.js'\nimport { registerInstance, unregisterInstance } from './runtime.js'\nimport { createView } from './view-helpers.js'\nimport { pushMountQueue, popMountQueue, flushMountQueue } from './primitives/on-mount.js'\n\n// Vite injects import.meta.env.DEV — declare the shape for TypeScript\ndeclare global {\n interface ImportMeta {\n env?: { DEV?: boolean }\n }\n}\n\n// ── HMR (dev only) ──────────────────────────────────────────────\n// Set by enableHmr() from '@llui/dom/hmr' — never imported in production.\n\nlet hmrModule: typeof import('./hmr') | null = null\n\n/** @internal Called by enableHmr in the hmr module */\nexport function _setHmrModule(m: typeof import('./hmr')): void {\n hmrModule = m\n}\n\n// ── DevTools auto-install (dev only) ────────────────────────────\n// Set by enableDevTools() from '@llui/dom/devtools' — never imported in production.\n\nlet devToolsInstall: ((inst: object) => void) | null = null\n\n/** @internal Called by enableDevTools in the devtools module */\nexport function _setDevToolsInstall(fn: ((inst: object) => void) | null): void {\n devToolsInstall = fn\n}\n\nexport interface MountOptions {\n devTools?: boolean\n /**\n * Parent scope for the mounted component's rootScope. When provided,\n * the rootScope is created as a child of this scope — context lookups\n * from within the component walk up through the parent's scope tree,\n * and disposing the parent scope cascades into this instance's scope.\n * Used by `@llui/vike`'s persistent-layout machinery to mount a page\n * as a true scope-tree child of its enclosing layout, so layout-\n * provided contexts flow naturally into pages via `useContext`.\n *\n * When omitted (the default), the rootScope is detached — same as\n * every `mountApp` call before persistent layouts existed.\n */\n parentScope?: Scope\n}\n\nexport function mountApp<S, M, E>(\n container: HTMLElement,\n def: ComponentDef<S, M, E>,\n data?: unknown,\n options?: MountOptions,\n): AppHandle {\n // HMR: if this component is already mounted (module re-execution\n // during hot update), swap the definition instead of creating a new instance.\n // HMR swap bypasses parentScope — HMR re-mounts the outermost app handle,\n // which in a layout setup means the layout re-mounts at the root and the\n // rest of the chain is re-established via the normal mount path.\n if (hmrModule && def.name && !options?.parentScope) {\n const swapped = hmrModule.replaceComponent(def.name, def)\n if (swapped) return swapped\n }\n\n const inst = createComponentInstance(def, data, options?.parentScope ?? null)\n\n // Dev-only: auto-install devtools if enabled via '@llui/dom/devtools' import\n if (devToolsInstall) devToolsInstall(inst)\n\n // Dev-only: warn if initial state contains non-serializable values.\n // Silent bug-bomb: Date/Map/Set/class instances break SSR, hydration, replay tools.\n if (import.meta.env?.DEV) {\n const offender = findNonSerializable(inst.state)\n if (offender) {\n console.warn(\n `[LLui] <${def.name}> initial state contains a non-serializable value at \"${offender.path}\":`,\n offender.value,\n '\\nState must be plain JSON (no Date/Map/Set/class instances/functions).' +\n '\\nThis will break SSR hydration, state replay, and devtools snapshots.' +\n '\\nhint: Convert to a serializable representation (e.g., Date → ISO string, Map → Record).',\n )\n }\n }\n\n // Run view() within a render context so primitives can register bindings.\n // Also collect onMount callbacks in a queue we'll flush synchronously\n // after node insertion — prevents the race where a user event fires\n // between mount and the queueMicrotask callback running.\n const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue()\n setFlatBindings(inst.allBindings)\n setRenderContext({\n ...inst,\n container,\n send: inst.send as (msg: unknown) => void,\n instance: inst as ComponentInstance,\n })\n const nodes = def.view(createView<S, M>(inst.send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(prevMountQueue)\n\n // Batch-insert via DocumentFragment — one layout-invalidating operation\n // instead of N individual appendChild calls on a live container element.\n if (nodes.length > 1) {\n const frag = document.createDocumentFragment()\n for (const node of nodes) frag.appendChild(node)\n container.appendChild(frag)\n } else if (nodes.length === 1) {\n container.appendChild(nodes[0]!)\n }\n\n // Flush onMount callbacks SYNCHRONOUSLY now that the DOM is in place.\n // Any listeners they attach are ready before this function returns,\n // so a synchronous dispatchEvent in the caller's next line fires\n // against a fully-wired tree.\n flushMountQueue(onMountQueue)\n\n registerInstance(inst)\n if (hmrModule && def.name) {\n hmrModule.registerForHmr(def.name, inst, container)\n }\n dispatchInitialEffects(inst)\n let disposed = false\n\n return {\n dispose() {\n if (disposed) return\n disposed = true\n if (hmrModule && def.name) hmrModule.unregisterForHmr(def.name, inst)\n inst.abortController.abort()\n unregisterInstance(inst)\n // Tag the root scope so the disposer log reports app-level\n // teardown distinct from in-tree component-unmount events.\n inst.rootScope.disposalCause = 'app-unmount'\n disposeScope(inst.rootScope)\n container.textContent = ''\n },\n flush() {\n if (disposed) return\n flushInstance(inst)\n },\n send(msg: unknown) {\n if (disposed) return\n ;(inst.send as (m: unknown) => void)(msg)\n },\n }\n}\n\n// Walks an object graph looking for non-JSON-serializable values. Returns the\n// first offender found (depth-first), or null if everything is fine. Stops at\n// depth 6 to bound runtime cost for large states.\nfunction findNonSerializable(\n v: unknown,\n path = 'state',\n depth = 0,\n seen = new WeakSet<object>(),\n): { path: string; value: unknown } | null {\n if (depth > 6) return null\n if (v === null || v === undefined) return null\n const t = typeof v\n if (t === 'string' || t === 'number' || t === 'boolean') return null\n if (t === 'function') return { path, value: v }\n if (t === 'symbol' || t === 'bigint') return { path, value: v }\n if (t !== 'object') return null\n const obj = v as object\n if (seen.has(obj)) return null\n seen.add(obj)\n if (obj instanceof Date) return { path: `${path} (Date)`, value: v }\n if (obj instanceof Map) return { path: `${path} (Map)`, value: v }\n if (obj instanceof Set) return { path: `${path} (Set)`, value: v }\n if (obj instanceof RegExp) return { path: `${path} (RegExp)`, value: v }\n if (obj instanceof Promise) return { path: `${path} (Promise)`, value: v }\n // Plain objects/arrays have Object.prototype / Array.prototype. Class instances\n // have a different prototype.\n const proto = Object.getPrototypeOf(obj)\n if (proto !== null && proto !== Object.prototype && proto !== Array.prototype) {\n return { path: `${path} (${proto?.constructor?.name ?? 'class instance'})`, value: v }\n }\n if (Array.isArray(v)) {\n for (let i = 0; i < v.length; i++) {\n const r = findNonSerializable(v[i], `${path}[${i}]`, depth + 1, seen)\n if (r) return r\n }\n return null\n }\n for (const k of Object.keys(obj)) {\n const r = findNonSerializable(\n (obj as Record<string, unknown>)[k],\n `${path}.${k}`,\n depth + 1,\n seen,\n )\n if (r) return r\n }\n return null\n}\n\nfunction dispatchInitialEffects<S, M, E>(\n inst: ReturnType<typeof createComponentInstance<S, M, E>>,\n): void {\n if (inst.initialEffects.length === 0 || !inst.def.onEffect) return\n for (const effect of inst.initialEffects) {\n inst.def.onEffect({ effect, send: inst.send, signal: inst.signal })\n }\n inst.initialEffects = []\n}\n\nexport function hydrateApp<S, M, E>(\n container: HTMLElement,\n def: ComponentDef<S, M, E>,\n serverState: S,\n options?: MountOptions,\n): AppHandle {\n // Run the original init once to capture its effects. The state it\n // returns is discarded — we use `serverState` (what the server\n // rendered with) instead. The effects are preserved and dispatched\n // after the DOM is in place, so components that rely on \"load data\n // or wire subscriptions on mount\" behave consistently between fresh\n // mount and SSR+hydrate. If the original init has already-loaded\n // data for the hydration case, gate the effect emission inside init\n // itself (e.g. based on a `loaded` flag in state).\n const [, originalEffects] = (def.init as (data: unknown) => [S, E[]])(undefined)\n\n const hydrateDef: ComponentDef<S, M, E> = {\n ...def,\n init: () => [serverState, originalEffects],\n }\n\n const inst = createComponentInstance(hydrateDef, undefined, options?.parentScope ?? null)\n\n // Build the component DOM and swap atomically with server HTML.\n // Server HTML remains visible until JS finishes — no flash.\n // onMount callbacks are collected in a queue and flushed synchronously\n // after the swap, matching mountApp's ordering.\n const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue()\n setFlatBindings(inst.allBindings)\n setRenderContext({\n ...inst,\n container,\n send: inst.send as (msg: unknown) => void,\n instance: inst as ComponentInstance,\n })\n const nodes = hydrateDef.view(createView<S, M>(inst.send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(prevMountQueue)\n\n // Atomic swap — replaces server HTML with client DOM in one operation\n container.replaceChildren(...nodes)\n\n // Flush onMount callbacks synchronously now that the DOM is in place.\n flushMountQueue(onMountQueue)\n\n // Fire the original init's effects post-swap, matching mountApp's\n // lifecycle. Previously these were silently dropped.\n dispatchInitialEffects(inst)\n\n registerInstance(inst)\n let disposed = false\n\n return {\n dispose() {\n if (disposed) return\n disposed = true\n inst.abortController.abort()\n unregisterInstance(inst)\n // Tag the root scope so the disposer log reports app-level\n // teardown distinct from in-tree component-unmount events.\n inst.rootScope.disposalCause = 'app-unmount'\n disposeScope(inst.rootScope)\n container.textContent = ''\n },\n flush() {\n if (disposed) return\n flushInstance(inst)\n },\n send(msg: unknown) {\n if (disposed) return\n ;(inst.send as (m: unknown) => void)(msg)\n },\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../src/primitives/branch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAS,MAAM,aAAa,CAAA;AASvD,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../src/primitives/branch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAS,MAAM,aAAa,CAAA;AASvD,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,CAgIxE"}
|
|
@@ -40,6 +40,7 @@ export function branch(opts) {
|
|
|
40
40
|
const mq = pushMountQueue();
|
|
41
41
|
onMountQueue = mq.queue;
|
|
42
42
|
currentScope = createScope(parentScope);
|
|
43
|
+
currentScope._kind = opts.__disposalCause === 'show-hide' ? 'show' : 'branch';
|
|
43
44
|
setFlatBindings(ctx.allBindings);
|
|
44
45
|
setRenderContext({ ...ctx, rootScope: currentScope, state });
|
|
45
46
|
currentNodes = newBuilder(createView(send));
|
|
@@ -63,8 +64,15 @@ export function branch(opts) {
|
|
|
63
64
|
if (node.parentNode)
|
|
64
65
|
node.parentNode.removeChild(node);
|
|
65
66
|
}
|
|
66
|
-
if (leavingScope)
|
|
67
|
+
if (leavingScope) {
|
|
68
|
+
// Tag BEFORE dispose so the disposer log records the cause.
|
|
69
|
+
// `show()` passes `__disposalCause: 'show-hide'`; raw branch()
|
|
70
|
+
// defaults to `'branch-swap'`. Tag wins over any pre-existing
|
|
71
|
+
// value set by an inner primitive so the outermost cause is
|
|
72
|
+
// reported (matches how humans describe the event).
|
|
73
|
+
leavingScope.disposalCause = opts.__disposalCause ?? 'branch-swap';
|
|
67
74
|
disposeScope(leavingScope);
|
|
75
|
+
}
|
|
68
76
|
};
|
|
69
77
|
if (leavingNodes.length > 0 && opts.leave) {
|
|
70
78
|
const result = opts.leave(leavingNodes);
|
|
@@ -96,6 +104,7 @@ export function branch(opts) {
|
|
|
96
104
|
// are returned to the parent), so we don't need to flush here.
|
|
97
105
|
if (builder) {
|
|
98
106
|
currentScope = createScope(parentScope);
|
|
107
|
+
currentScope._kind = opts.__disposalCause === 'show-hide' ? 'show' : 'branch';
|
|
99
108
|
setRenderContext({ ...ctx, rootScope: currentScope });
|
|
100
109
|
currentNodes = builder(createView(send));
|
|
101
110
|
clearRenderContext();
|