@pyreon/core 0.7.6 → 0.7.8
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/README.md +11 -1
- package/lib/analysis/index.js.html +1 -1
- package/lib/index.js +101 -1
- package/lib/index.js.map +1 -1
- package/lib/jsx-dev-runtime.js.map +1 -1
- package/lib/jsx-runtime.js.map +1 -1
- package/lib/types/index.d.ts +110 -61
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/jsx-dev-runtime.d.ts +70 -53
- package/lib/types/jsx-dev-runtime.d.ts.map +1 -1
- package/lib/types/jsx-runtime.d.ts +71 -54
- package/lib/types/jsx-runtime.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +4 -1
- package/src/jsx-runtime.ts +71 -55
- package/src/props.ts +108 -0
- package/src/style.ts +42 -0
- package/src/tests/cx.test.ts +41 -0
- package/src/tests/props.test.ts +77 -0
package/README.md
CHANGED
|
@@ -65,6 +65,16 @@ function Counter() {
|
|
|
65
65
|
- **`Suspense`** -- Shows fallback content while async children resolve.
|
|
66
66
|
- **`ErrorBoundary`** -- Catches errors in descendant components and renders a fallback.
|
|
67
67
|
|
|
68
|
+
### Props Utilities
|
|
69
|
+
|
|
70
|
+
- **`splitProps(props, keys)`** -- Splits a props object into `[picked, rest]`, preserving signal reactivity.
|
|
71
|
+
- **`mergeProps(...sources)`** -- Merges multiple props objects; last source wins. Preserves reactivity.
|
|
72
|
+
- **`createUniqueId(): string`** -- Returns an SSR-safe unique ID (`"pyreon-1"`, `"pyreon-2"`, etc.).
|
|
73
|
+
|
|
74
|
+
### Class Utility
|
|
75
|
+
|
|
76
|
+
- **`cx(...values: ClassValue[]): string`** -- Combines class values (strings, arrays, objects, nested mix) into a single class string.
|
|
77
|
+
|
|
68
78
|
### Utilities
|
|
69
79
|
|
|
70
80
|
- **`mapArray(source, mapFn)`** -- Reactively maps over an array source.
|
|
@@ -72,7 +82,7 @@ function Counter() {
|
|
|
72
82
|
|
|
73
83
|
### Types
|
|
74
84
|
|
|
75
|
-
`VNode`, `VNodeChild`, `VNodeChildAtom`, `Props`, `ComponentFn`, `ExtractProps`, `HigherOrderComponent`, `ComponentInstance`, `LifecycleHooks`, `CleanupFn`, `NativeItem`, `Ref`, `Context`, `LazyComponent`, `ShowProps`, `SwitchProps`, `MatchProps`, `ForProps`, `PortalProps`, `ErrorContext`, `ErrorHandler`
|
|
85
|
+
`VNode`, `VNodeChild`, `VNodeChildAtom`, `Props`, `ComponentFn`, `ExtractProps`, `HigherOrderComponent`, `ComponentInstance`, `LifecycleHooks`, `CleanupFn`, `NativeItem`, `Ref`, `Context`, `LazyComponent`, `ShowProps`, `SwitchProps`, `MatchProps`, `ForProps`, `PortalProps`, `ErrorContext`, `ErrorHandler`, `ClassValue`, `TargetedEvent`, `PyreonHTMLAttributes`, `CSSProperties`, `StyleValue`, `CanvasAttributes`
|
|
76
86
|
|
|
77
87
|
## License
|
|
78
88
|
|
|
@@ -5386,7 +5386,7 @@ var drawChart = (function (exports) {
|
|
|
5386
5386
|
</script>
|
|
5387
5387
|
<script>
|
|
5388
5388
|
/*<!--*/
|
|
5389
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"uid":"
|
|
5389
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"uid":"4bcc4fa1-1","name":"lifecycle.ts"},{"uid":"4bcc4fa1-3","name":"component.ts"},{"uid":"4bcc4fa1-5","name":"context.ts"},{"uid":"4bcc4fa1-7","name":"h.ts"},{"uid":"4bcc4fa1-9","name":"dynamic.ts"},{"uid":"4bcc4fa1-11","name":"telemetry.ts"},{"uid":"4bcc4fa1-13","name":"error-boundary.ts"},{"uid":"4bcc4fa1-15","name":"for.ts"},{"uid":"4bcc4fa1-17","name":"lazy.ts"},{"uid":"4bcc4fa1-19","name":"map-array.ts"},{"uid":"4bcc4fa1-21","name":"portal.ts"},{"uid":"4bcc4fa1-23","name":"props.ts"},{"uid":"4bcc4fa1-25","name":"ref.ts"},{"uid":"4bcc4fa1-27","name":"show.ts"},{"uid":"4bcc4fa1-29","name":"style.ts"},{"uid":"4bcc4fa1-31","name":"suspense.ts"},{"uid":"4bcc4fa1-33","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"4bcc4fa1-1":{"renderedLength":1459,"gzipLength":658,"brotliLength":0,"metaUid":"4bcc4fa1-0"},"4bcc4fa1-3":{"renderedLength":1430,"gzipLength":679,"brotliLength":0,"metaUid":"4bcc4fa1-2"},"4bcc4fa1-5":{"renderedLength":2213,"gzipLength":1033,"brotliLength":0,"metaUid":"4bcc4fa1-4"},"4bcc4fa1-7":{"renderedLength":1082,"gzipLength":597,"brotliLength":0,"metaUid":"4bcc4fa1-6"},"4bcc4fa1-9":{"renderedLength":381,"gzipLength":268,"brotliLength":0,"metaUid":"4bcc4fa1-8"},"4bcc4fa1-11":{"renderedLength":570,"gzipLength":346,"brotliLength":0,"metaUid":"4bcc4fa1-10"},"4bcc4fa1-13":{"renderedLength":1664,"gzipLength":843,"brotliLength":0,"metaUid":"4bcc4fa1-12"},"4bcc4fa1-15":{"renderedLength":700,"gzipLength":478,"brotliLength":0,"metaUid":"4bcc4fa1-14"},"4bcc4fa1-17":{"renderedLength":461,"gzipLength":273,"brotliLength":0,"metaUid":"4bcc4fa1-16"},"4bcc4fa1-19":{"renderedLength":1018,"gzipLength":571,"brotliLength":0,"metaUid":"4bcc4fa1-18"},"4bcc4fa1-21":{"renderedLength":818,"gzipLength":491,"brotliLength":0,"metaUid":"4bcc4fa1-20"},"4bcc4fa1-23":{"renderedLength":2373,"gzipLength":984,"brotliLength":0,"metaUid":"4bcc4fa1-22"},"4bcc4fa1-25":{"renderedLength":86,"gzipLength":98,"brotliLength":0,"metaUid":"4bcc4fa1-24"},"4bcc4fa1-27":{"renderedLength":1892,"gzipLength":810,"brotliLength":0,"metaUid":"4bcc4fa1-26"},"4bcc4fa1-29":{"renderedLength":1858,"gzipLength":825,"brotliLength":0,"metaUid":"4bcc4fa1-28"},"4bcc4fa1-31":{"renderedLength":1138,"gzipLength":627,"brotliLength":0,"metaUid":"4bcc4fa1-30"},"4bcc4fa1-33":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"4bcc4fa1-32"}},"nodeMetas":{"4bcc4fa1-0":{"id":"/src/lifecycle.ts","moduleParts":{"index.js":"4bcc4fa1-1"},"imported":[],"importedBy":[{"uid":"4bcc4fa1-32"},{"uid":"4bcc4fa1-2"},{"uid":"4bcc4fa1-4"},{"uid":"4bcc4fa1-12"}]},"4bcc4fa1-2":{"id":"/src/component.ts","moduleParts":{"index.js":"4bcc4fa1-3"},"imported":[{"uid":"4bcc4fa1-0"}],"importedBy":[{"uid":"4bcc4fa1-32"},{"uid":"4bcc4fa1-12"}]},"4bcc4fa1-4":{"id":"/src/context.ts","moduleParts":{"index.js":"4bcc4fa1-5"},"imported":[{"uid":"4bcc4fa1-0"}],"importedBy":[{"uid":"4bcc4fa1-32"}]},"4bcc4fa1-6":{"id":"/src/h.ts","moduleParts":{"index.js":"4bcc4fa1-7"},"imported":[],"importedBy":[{"uid":"4bcc4fa1-32"},{"uid":"4bcc4fa1-8"},{"uid":"4bcc4fa1-16"},{"uid":"4bcc4fa1-30"}]},"4bcc4fa1-8":{"id":"/src/dynamic.ts","moduleParts":{"index.js":"4bcc4fa1-9"},"imported":[{"uid":"4bcc4fa1-6"}],"importedBy":[{"uid":"4bcc4fa1-32"}]},"4bcc4fa1-10":{"id":"/src/telemetry.ts","moduleParts":{"index.js":"4bcc4fa1-11"},"imported":[],"importedBy":[{"uid":"4bcc4fa1-32"},{"uid":"4bcc4fa1-12"}]},"4bcc4fa1-12":{"id":"/src/error-boundary.ts","moduleParts":{"index.js":"4bcc4fa1-13"},"imported":[{"uid":"4bcc4fa1-34"},{"uid":"4bcc4fa1-2"},{"uid":"4bcc4fa1-0"},{"uid":"4bcc4fa1-10"}],"importedBy":[{"uid":"4bcc4fa1-32"}]},"4bcc4fa1-14":{"id":"/src/for.ts","moduleParts":{"index.js":"4bcc4fa1-15"},"imported":[],"importedBy":[{"uid":"4bcc4fa1-32"}]},"4bcc4fa1-16":{"id":"/src/lazy.ts","moduleParts":{"index.js":"4bcc4fa1-17"},"imported":[{"uid":"4bcc4fa1-34"},{"uid":"4bcc4fa1-6"}],"importedBy":[{"uid":"4bcc4fa1-32"}]},"4bcc4fa1-18":{"id":"/src/map-array.ts","moduleParts":{"index.js":"4bcc4fa1-19"},"imported":[],"importedBy":[{"uid":"4bcc4fa1-32"}]},"4bcc4fa1-20":{"id":"/src/portal.ts","moduleParts":{"index.js":"4bcc4fa1-21"},"imported":[],"importedBy":[{"uid":"4bcc4fa1-32"}]},"4bcc4fa1-22":{"id":"/src/props.ts","moduleParts":{"index.js":"4bcc4fa1-23"},"imported":[],"importedBy":[{"uid":"4bcc4fa1-32"}]},"4bcc4fa1-24":{"id":"/src/ref.ts","moduleParts":{"index.js":"4bcc4fa1-25"},"imported":[],"importedBy":[{"uid":"4bcc4fa1-32"}]},"4bcc4fa1-26":{"id":"/src/show.ts","moduleParts":{"index.js":"4bcc4fa1-27"},"imported":[],"importedBy":[{"uid":"4bcc4fa1-32"}]},"4bcc4fa1-28":{"id":"/src/style.ts","moduleParts":{"index.js":"4bcc4fa1-29"},"imported":[],"importedBy":[{"uid":"4bcc4fa1-32"}]},"4bcc4fa1-30":{"id":"/src/suspense.ts","moduleParts":{"index.js":"4bcc4fa1-31"},"imported":[{"uid":"4bcc4fa1-6"}],"importedBy":[{"uid":"4bcc4fa1-32"}]},"4bcc4fa1-32":{"id":"/src/index.ts","moduleParts":{"index.js":"4bcc4fa1-33"},"imported":[{"uid":"4bcc4fa1-2"},{"uid":"4bcc4fa1-4"},{"uid":"4bcc4fa1-8"},{"uid":"4bcc4fa1-12"},{"uid":"4bcc4fa1-14"},{"uid":"4bcc4fa1-6"},{"uid":"4bcc4fa1-16"},{"uid":"4bcc4fa1-0"},{"uid":"4bcc4fa1-18"},{"uid":"4bcc4fa1-20"},{"uid":"4bcc4fa1-22"},{"uid":"4bcc4fa1-24"},{"uid":"4bcc4fa1-26"},{"uid":"4bcc4fa1-28"},{"uid":"4bcc4fa1-30"},{"uid":"4bcc4fa1-10"}],"importedBy":[],"isEntry":true},"4bcc4fa1-34":{"id":"@pyreon/reactivity","moduleParts":{},"imported":[],"importedBy":[{"uid":"4bcc4fa1-12"},{"uid":"4bcc4fa1-16"}]}},"env":{"rollup":"4.23.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
5390
5390
|
|
|
5391
5391
|
const run = () => {
|
|
5392
5392
|
const width = window.innerWidth;
|
package/lib/index.js
CHANGED
|
@@ -410,6 +410,82 @@ function Portal(props) {
|
|
|
410
410
|
};
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/props.ts
|
|
415
|
+
/**
|
|
416
|
+
* Split props into two groups: keys you want and the rest.
|
|
417
|
+
* Unlike destructuring, this preserves reactivity (getters on the original object).
|
|
418
|
+
*
|
|
419
|
+
* @example
|
|
420
|
+
* const [own, html] = splitProps(props, ["label", "icon"])
|
|
421
|
+
* return <button {...html}><Icon name={own.icon} /> {own.label}</button>
|
|
422
|
+
*/
|
|
423
|
+
function splitProps(props, keys) {
|
|
424
|
+
const picked = {};
|
|
425
|
+
const rest = {};
|
|
426
|
+
const keySet = new Set(keys);
|
|
427
|
+
for (const key of Object.keys(props)) {
|
|
428
|
+
const desc = Object.getOwnPropertyDescriptor(props, key);
|
|
429
|
+
if (!desc) continue;
|
|
430
|
+
if (keySet.has(key)) Object.defineProperty(picked, key, desc);
|
|
431
|
+
else Object.defineProperty(rest, key, desc);
|
|
432
|
+
}
|
|
433
|
+
return [picked, rest];
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Merge default values with component props. Defaults are used when
|
|
437
|
+
* the prop is `undefined`. Preserves getter reactivity.
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* const merged = mergeProps({ size: "md", variant: "primary" }, props)
|
|
441
|
+
* // merged.size is reactive — falls back to "md" when props.size is undefined
|
|
442
|
+
*/
|
|
443
|
+
function mergeProps(...sources) {
|
|
444
|
+
const result = {};
|
|
445
|
+
for (const source of sources) for (const key of Object.keys(source)) {
|
|
446
|
+
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
447
|
+
if (!desc) continue;
|
|
448
|
+
const existing = Object.getOwnPropertyDescriptor(result, key);
|
|
449
|
+
if (desc.get && existing) {
|
|
450
|
+
const prevGet = existing.get ?? (() => existing.value);
|
|
451
|
+
const nextGet = desc.get;
|
|
452
|
+
Object.defineProperty(result, key, {
|
|
453
|
+
get: () => {
|
|
454
|
+
const v = nextGet();
|
|
455
|
+
return v !== void 0 ? v : prevGet();
|
|
456
|
+
},
|
|
457
|
+
enumerable: true,
|
|
458
|
+
configurable: true
|
|
459
|
+
});
|
|
460
|
+
} else if (desc.get) Object.defineProperty(result, key, desc);
|
|
461
|
+
else if (existing?.get) {
|
|
462
|
+
const prevGet = existing.get;
|
|
463
|
+
if (desc.value !== void 0) Object.defineProperty(result, key, desc);
|
|
464
|
+
else Object.defineProperty(result, key, {
|
|
465
|
+
get: prevGet,
|
|
466
|
+
enumerable: true,
|
|
467
|
+
configurable: true
|
|
468
|
+
});
|
|
469
|
+
} else if (desc.value !== void 0 || !existing) Object.defineProperty(result, key, desc);
|
|
470
|
+
}
|
|
471
|
+
return result;
|
|
472
|
+
}
|
|
473
|
+
let _idCounter = 0;
|
|
474
|
+
/**
|
|
475
|
+
* Generate a unique ID string for accessibility attributes (htmlFor, aria-describedby, etc.).
|
|
476
|
+
* SSR-safe: uses a deterministic counter that resets per request context.
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* const id = createUniqueId()
|
|
480
|
+
* return <>
|
|
481
|
+
* <label for={id}>Name</label>
|
|
482
|
+
* <input id={id} />
|
|
483
|
+
* </>
|
|
484
|
+
*/
|
|
485
|
+
function createUniqueId() {
|
|
486
|
+
return `pyreon-${++_idCounter}`;
|
|
487
|
+
}
|
|
488
|
+
|
|
413
489
|
//#endregion
|
|
414
490
|
//#region src/ref.ts
|
|
415
491
|
function createRef() {
|
|
@@ -527,6 +603,30 @@ const CSS_UNITLESS = new Set([
|
|
|
527
603
|
"strokeOpacity",
|
|
528
604
|
"strokeWidth"
|
|
529
605
|
]);
|
|
606
|
+
function cxObject(obj) {
|
|
607
|
+
let result = "";
|
|
608
|
+
for (const key in obj) {
|
|
609
|
+
const v = obj[key];
|
|
610
|
+
if (typeof v === "function" ? v() : v) result = result ? `${result} ${key}` : key;
|
|
611
|
+
}
|
|
612
|
+
return result;
|
|
613
|
+
}
|
|
614
|
+
function cxArray(arr) {
|
|
615
|
+
let result = "";
|
|
616
|
+
for (const item of arr) {
|
|
617
|
+
const resolved = cx(item);
|
|
618
|
+
if (resolved) result = result ? `${result} ${resolved}` : resolved;
|
|
619
|
+
}
|
|
620
|
+
return result;
|
|
621
|
+
}
|
|
622
|
+
/** Resolve a ClassValue into a flat class string (like clsx/cx). */
|
|
623
|
+
function cx(value) {
|
|
624
|
+
if (value == null || value === false || value === true) return "";
|
|
625
|
+
if (typeof value === "string") return value;
|
|
626
|
+
if (typeof value === "number") return String(value);
|
|
627
|
+
if (Array.isArray(value)) return cxArray(value);
|
|
628
|
+
return cxObject(value);
|
|
629
|
+
}
|
|
530
630
|
/** Convert a camelCase CSS property name to kebab-case. */
|
|
531
631
|
function toKebabCase(str) {
|
|
532
632
|
return str.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
|
@@ -566,5 +666,5 @@ function Suspense(props) {
|
|
|
566
666
|
}
|
|
567
667
|
|
|
568
668
|
//#endregion
|
|
569
|
-
export { CSS_UNITLESS, Dynamic, EMPTY_PROPS, ErrorBoundary, For, ForSymbol, Fragment, Match, MatchSymbol, Portal, PortalSymbol, Show, Suspense, Switch, createContext, createRef, defineComponent, dispatchToErrorBoundary, h, lazy, mapArray, normalizeStyleValue, onErrorCaptured, onMount, onUnmount, onUpdate, popContext, propagateError, provide, pushContext, registerErrorHandler, reportError, runWithHooks, setContextStackProvider, toKebabCase, useContext, withContext };
|
|
669
|
+
export { CSS_UNITLESS, Dynamic, EMPTY_PROPS, ErrorBoundary, For, ForSymbol, Fragment, Match, MatchSymbol, Portal, PortalSymbol, Show, Suspense, Switch, createContext, createRef, createUniqueId, cx, defineComponent, dispatchToErrorBoundary, h, lazy, mapArray, mergeProps, normalizeStyleValue, onErrorCaptured, onMount, onUnmount, onUpdate, popContext, propagateError, provide, pushContext, registerErrorHandler, reportError, runWithHooks, setContextStackProvider, splitProps, toKebabCase, useContext, withContext };
|
|
570
670
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["__DEV__","__DEV__","__DEV__","__DEV__"],"sources":["../src/lifecycle.ts","../src/component.ts","../src/context.ts","../src/h.ts","../src/dynamic.ts","../src/telemetry.ts","../src/error-boundary.ts","../src/for.ts","../src/lazy.ts","../src/map-array.ts","../src/portal.ts","../src/ref.ts","../src/show.ts","../src/style.ts","../src/suspense.ts"],"sourcesContent":["import type { CleanupFn, LifecycleHooks } from \"./types\"\n\nconst __DEV__ = typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\"\n\n// The currently-executing component's hook storage, set by the renderer\n// before calling the component function, cleared immediately after.\nlet _current: LifecycleHooks | null = null\n\nexport function setCurrentHooks(hooks: LifecycleHooks | null) {\n _current = hooks\n}\n\nexport function getCurrentHooks(): LifecycleHooks | null {\n return _current\n}\n\nfunction warnOutsideSetup(hookName: string): void {\n if (__DEV__ && !_current) {\n // biome-ignore lint/suspicious/noConsole: dev-only warning\n console.warn(\n `[Pyreon] ${hookName}() called outside component setup. ` +\n \"Lifecycle hooks must be called synchronously during a component's setup function.\",\n )\n }\n}\n\n/**\n * Register a callback to run after the component is mounted to the DOM.\n * Optionally return a cleanup function — it will run on unmount.\n */\n// biome-ignore lint/suspicious/noConfusingVoidType: void allows callbacks that return nothing\nexport function onMount(fn: () => CleanupFn | void | undefined) {\n warnOutsideSetup(\"onMount\")\n _current?.mount.push(fn)\n}\n\n/**\n * Register a callback to run when the component is removed from the DOM.\n */\nexport function onUnmount(fn: () => void) {\n warnOutsideSetup(\"onUnmount\")\n _current?.unmount.push(fn)\n}\n\n/**\n * Register a callback to run after each reactive update.\n */\nexport function onUpdate(fn: () => void) {\n warnOutsideSetup(\"onUpdate\")\n _current?.update.push(fn)\n}\n\n/**\n * Register an error handler for this component subtree.\n *\n * When an error is thrown during rendering or in a child component,\n * the nearest `onErrorCaptured` handler is called with the error.\n * Return `true` to mark the error as handled and stop propagation.\n *\n * @example\n * onErrorCaptured((err) => {\n * setError(String(err))\n * return true // handled — don't propagate\n * })\n */\nexport function onErrorCaptured(fn: (err: unknown) => boolean | undefined) {\n warnOutsideSetup(\"onErrorCaptured\")\n _current?.error.push(fn)\n}\n","import { setCurrentHooks } from \"./lifecycle\"\nimport type { ComponentFn, LifecycleHooks, Props, VNodeChild } from \"./types\"\n\n/**\n * Identity wrapper — marks a function as a Pyreon component and preserves its type.\n * Useful for IDE tooling and future compiler optimisations.\n */\nexport function defineComponent<P extends Props>(fn: ComponentFn<P>): ComponentFn<P> {\n return fn\n}\n\n/**\n * Run a component function in a tracked context so that lifecycle hooks\n * registered inside it (onMount, onUnmount, onErrorCaptured, etc.) are captured.\n *\n * Called by the renderer — not intended for user code.\n */\nexport function runWithHooks<P extends Props>(\n fn: ComponentFn<P>,\n props: P,\n): { vnode: VNodeChild; hooks: LifecycleHooks } {\n const hooks: LifecycleHooks = { mount: [], unmount: [], update: [], error: [] }\n setCurrentHooks(hooks)\n let vnode: VNodeChild = null\n try {\n vnode = fn(props)\n } finally {\n setCurrentHooks(null)\n }\n return { vnode, hooks }\n}\n\n/**\n * Walk up error handlers collected during component rendering.\n * Returns true if any handler marked the error as handled.\n */\nexport function propagateError(err: unknown, hooks: LifecycleHooks): boolean {\n for (const handler of hooks.error) {\n if (handler(err) === true) return true\n }\n return false\n}\n\n// ─── Error boundary stack ────────────────────────────────────────────────────\n// Module-level stack of active ErrorBoundary handlers (innermost last).\n// ErrorBoundary pushes during its own setup (before children mount) so that\n// any child mountComponent error can dispatch up to the nearest boundary.\n\nconst _errorBoundaryStack: ((err: unknown) => boolean)[] = []\n\nexport function pushErrorBoundary(handler: (err: unknown) => boolean): void {\n _errorBoundaryStack.push(handler)\n}\n\nexport function popErrorBoundary(): void {\n _errorBoundaryStack.pop()\n}\n\n/**\n * Dispatch an error to the nearest active ErrorBoundary.\n * Returns true if the boundary handled it, false if none was registered.\n */\nexport function dispatchToErrorBoundary(err: unknown): boolean {\n const handler = _errorBoundaryStack[_errorBoundaryStack.length - 1]\n return handler ? handler(err) : false\n}\n","/**\n * Provide / inject — like React context or Vue provide/inject.\n *\n * Values flow down the component tree without prop-drilling.\n * The renderer maintains the context stack as it walks the VNode tree.\n */\n\nimport { onUnmount } from \"./lifecycle\"\n\nexport interface Context<T> {\n readonly id: symbol\n readonly defaultValue: T\n}\n\nexport function createContext<T>(defaultValue: T): Context<T> {\n return { id: Symbol(\"PyreonContext\"), defaultValue }\n}\n\n// ─── Runtime context stack (managed by the renderer) ─────────────────────────\n\n// Default stack — used for CSR and single-threaded SSR.\n// On Node.js with concurrent requests, @pyreon/runtime-server replaces this with\n// an AsyncLocalStorage-backed provider via setContextStackProvider().\nconst _defaultStack: Map<symbol, unknown>[] = []\nlet _stackProvider: () => Map<symbol, unknown>[] = () => _defaultStack\n\n/**\n * Override the context stack provider. Called by @pyreon/runtime-server to\n * inject an AsyncLocalStorage-backed stack that isolates concurrent SSR requests.\n * Has no effect in the browser (CSR always uses the default module-level stack).\n */\nexport function setContextStackProvider(fn: () => Map<symbol, unknown>[]): void {\n _stackProvider = fn\n}\n\nfunction getStack(): Map<symbol, unknown>[] {\n return _stackProvider()\n}\n\nconst __DEV__ = typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\"\n\nexport function pushContext(values: Map<symbol, unknown>) {\n getStack().push(values)\n}\n\nexport function popContext() {\n const stack = getStack()\n if (__DEV__ && stack.length === 0) {\n // biome-ignore lint/suspicious/noConsole: dev-only warning\n console.warn(\n \"[Pyreon] popContext() called on an empty context stack. This likely indicates a missing Provider.\",\n )\n return\n }\n stack.pop()\n}\n\n/**\n * Read the nearest provided value for a context.\n * Falls back to `context.defaultValue` if none found.\n */\nexport function useContext<T>(context: Context<T>): T {\n const stack = getStack()\n for (let i = stack.length - 1; i >= 0; i--) {\n const frame = stack[i]\n if (frame?.has(context.id)) {\n return frame.get(context.id) as T\n }\n }\n return context.defaultValue\n}\n\n/**\n * Provide a context value for the current component's subtree.\n * Must be called during component setup (like onMount/onUnmount).\n * Automatically cleaned up when the component unmounts.\n *\n * @example\n * const ThemeProvider = ({ children }: { children: VNodeChild }) => {\n * provide(ThemeContext, { color: \"blue\" })\n * return children\n * }\n */\nexport function provide<T>(context: Context<T>, value: T): void {\n pushContext(new Map<symbol, unknown>([[context.id, value]]))\n onUnmount(() => popContext())\n}\n\n/**\n * Provide a value for `context` during `fn()`.\n * Used by the renderer when it encounters a `<Provider>` component.\n */\nexport function withContext<T>(context: Context<T>, value: T, fn: () => void) {\n const frame = new Map<symbol, unknown>([[context.id, value]])\n pushContext(frame)\n try {\n fn()\n } finally {\n popContext()\n }\n}\n","import type { ComponentFn, Props, VNode, VNodeChild } from \"./types\"\n\n/** Marker for fragment nodes — renders children without a wrapper element */\nexport const Fragment: unique symbol = Symbol(\"Pyreon.Fragment\")\n\n/**\n * Hyperscript function — the compiled output of JSX.\n * `<div class=\"x\">hello</div>` → `h(\"div\", { class: \"x\" }, \"hello\")`\n *\n * Generic on P so TypeScript validates props match the component's signature\n * at the call site, then stores the result in the loosely-typed VNode.\n */\n/** Shared empty props sentinel — identity-checked in mountElement to skip applyProps. */\nexport const EMPTY_PROPS: Props = {} as Props\n\n/** Makes `children` optional in P (if present) so it can be passed as rest args to h(). */\ntype PropsWithOptionalChildren<P extends Props> = Omit<P, \"children\"> &\n (\"children\" extends keyof P ? { children?: P[\"children\"] } : unknown)\n\n// Overload: component with typed props — children is optional in the props object\n// because it can be passed as rest args. Extra keys are allowed via `& Props`.\nexport function h<P extends Props>(\n type: ComponentFn<P>,\n props: (PropsWithOptionalChildren<P> & Props) | null,\n ...children: VNodeChild[]\n): VNode\n// Overload: intrinsic element, symbol, generic/dynamic component, or mixed union\nexport function h(\n type: string | ((p: any) => VNodeChild) | symbol,\n props: Props | null,\n ...children: VNodeChild[]\n): VNode\nexport function h<P extends Props>(\n type: string | ComponentFn<P> | symbol,\n props: P | null,\n ...children: VNodeChild[]\n): VNode {\n return {\n type: type as string | ComponentFn | symbol,\n props: (props ?? EMPTY_PROPS) as Props,\n children: normalizeChildren(children),\n key: (props?.key as string | number | null) ?? null,\n }\n}\n\nfunction normalizeChildren(children: VNodeChild[]): VNodeChild[] {\n // Fast path: no nested arrays — return as-is without allocating\n for (let i = 0; i < children.length; i++) {\n if (Array.isArray(children[i])) {\n return flattenChildren(children)\n }\n }\n return children\n}\n\nfunction flattenChildren(children: VNodeChild[]): VNodeChild[] {\n const result: VNodeChild[] = []\n for (const child of children) {\n if (Array.isArray(child)) {\n result.push(...flattenChildren(child as VNodeChild[]))\n } else {\n result.push(child)\n }\n }\n return result\n}\n","import { h } from \"./h\"\nimport type { ComponentFn, Props, VNode } from \"./types\"\n\nconst __DEV__ = typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\"\n\nexport interface DynamicProps extends Props {\n component: ComponentFn | string\n}\n\nexport function Dynamic(props: DynamicProps): VNode | null {\n const { component, ...rest } = props\n if (__DEV__ && !component) {\n // biome-ignore lint/suspicious/noConsole: dev-only warning\n console.warn(\"[Pyreon] <Dynamic> received a falsy `component` prop. Nothing will be rendered.\")\n }\n if (!component) return null\n return h(component as string | ComponentFn, rest as Props)\n}\n","/**\n * Error telemetry — hook into Pyreon's error reporting for Sentry, Datadog, etc.\n *\n * @example\n * import { registerErrorHandler } from \"@pyreon/core\"\n * import * as Sentry from \"@sentry/browser\"\n *\n * registerErrorHandler(ctx => {\n * Sentry.captureException(ctx.error, {\n * extra: { component: ctx.component, phase: ctx.phase },\n * })\n * })\n */\n\nexport interface ErrorContext {\n /** Component function name, or \"Anonymous\" */\n component: string\n /** Lifecycle phase where the error occurred */\n phase: \"setup\" | \"render\" | \"mount\" | \"unmount\" | \"effect\"\n /** The thrown value */\n error: unknown\n /** Unix timestamp (ms) */\n timestamp: number\n /** Component props at the time of the error */\n props?: Record<string, unknown>\n}\n\nexport type ErrorHandler = (ctx: ErrorContext) => void\n\nlet _handlers: ErrorHandler[] = []\n\n/**\n * Register a global error handler. Called whenever a component throws in any\n * lifecycle phase. Returns an unregister function.\n */\nexport function registerErrorHandler(handler: ErrorHandler): () => void {\n _handlers.push(handler)\n return () => {\n _handlers = _handlers.filter((h) => h !== handler)\n }\n}\n\n/**\n * Internal — called by the runtime whenever a component error is caught.\n * Existing console.error calls are preserved; this is additive.\n */\nexport function reportError(ctx: ErrorContext): void {\n for (const h of _handlers) {\n try {\n h(ctx)\n } catch {\n // handler errors must never propagate back into the framework\n }\n }\n}\n","import { signal } from \"@pyreon/reactivity\"\nimport { popErrorBoundary, pushErrorBoundary } from \"./component\"\nimport { onUnmount } from \"./lifecycle\"\nimport { reportError } from \"./telemetry\"\nimport type { VNodeChild, VNodeChildAtom } from \"./types\"\n\nconst __DEV__ = typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\"\n\n/**\n * ErrorBoundary — catches errors thrown by child components and renders a\n * fallback UI instead of crashing the whole tree.\n *\n * Also reports caught errors to any registered telemetry handlers.\n *\n * How error propagation works:\n * ErrorBoundary pushes a handler onto the module-level boundary stack\n * synchronously during its own setup (before children are mounted).\n * When mountComponent catches a child error, it calls dispatchToErrorBoundary()\n * which invokes the innermost boundary's handler.\n *\n * Usage:\n * h(ErrorBoundary, {\n * fallback: (err) => h(\"p\", null, `Error: ${err}`),\n * children: h(MyComponent, null),\n * })\n *\n * // or with JSX:\n * <ErrorBoundary fallback={(err) => <p>Error: {String(err)}</p>}>\n * <MyComponent />\n * </ErrorBoundary>\n */\nexport function ErrorBoundary(props: {\n /**\n * Rendered when a child throws. Receives the caught error and a `reset`\n * function — calling `reset()` clears the error and re-renders children.\n */\n fallback: (err: unknown, reset: () => void) => VNodeChild\n children?: VNodeChild\n}): VNodeChild {\n if (__DEV__ && typeof props.fallback !== \"function\") {\n // biome-ignore lint/suspicious/noConsole: dev-only warning\n console.warn(\n \"[Pyreon] <ErrorBoundary> expects `fallback` to be a function: (err, reset) => VNode. \" +\n `Received ${typeof props.fallback}.`,\n )\n }\n\n const error = signal<unknown>(null)\n const reset = () => error.set(null)\n\n const handler = (err: unknown): boolean => {\n if (error.peek() !== null) return false // already in error state — let outer boundary catch it\n error.set(err)\n reportError({ component: \"ErrorBoundary\", phase: \"render\", error: err, timestamp: Date.now() })\n return true\n }\n\n // Push synchronously — before children are mounted — so child errors see this boundary\n pushErrorBoundary(handler)\n onUnmount(() => popErrorBoundary())\n\n return (): VNodeChildAtom => {\n const err = error()\n if (err != null) return props.fallback(err, reset) as VNodeChildAtom\n const ch = props.children\n return (typeof ch === \"function\" ? ch() : ch) as VNodeChildAtom\n }\n}\n","import type { NativeItem, Props, VNode } from \"./types\"\n\n/**\n * Symbol used as the VNode type for a For list — runtime-dom handles it\n * via mountFor, bypassing the generic VNode reconciler.\n */\nexport const ForSymbol: unique symbol = Symbol(\"pyreon.For\")\n\nexport interface ForProps<T> {\n each: () => T[]\n by: (item: T) => string | number\n children: (item: T) => VNode | NativeItem\n}\n\n/**\n * Efficient reactive list rendering.\n *\n * Unlike a plain `() => items().map(item => h(...))`, For never re-creates\n * VNodes for existing keys — only new keys invoke `children()`. Structural\n * mutations (swap, sort, filter) are O(n) key scan + O(k) DOM moves where k\n * is the number of actually displaced entries.\n *\n * Usage:\n * <For each={items} by={r => r.id}>{r => <li>...</li>}</For>\n */\nexport function For<T>(props: ForProps<T>): VNode {\n return {\n type: ForSymbol as unknown as string,\n props: props as unknown as Props,\n children: [],\n key: null,\n }\n}\n","import { signal } from \"@pyreon/reactivity\"\nimport { h } from \"./h\"\nimport type { LazyComponent } from \"./suspense\"\nimport type { ComponentFn, Props } from \"./types\"\n\nexport function lazy<P extends Props>(\n load: () => Promise<{ default: ComponentFn<P> }>,\n): LazyComponent<P> {\n const loaded = signal<ComponentFn<P> | null>(null)\n const error = signal<Error | null>(null)\n\n load()\n .then((m) => loaded.set(m.default))\n .catch((e) => error.set(e instanceof Error ? e : new Error(String(e))))\n\n const wrapper = ((props: P) => {\n const err = error()\n if (err) throw err\n const comp = loaded()\n return comp ? h(comp as ComponentFn, props as Props) : null\n }) as LazyComponent<P>\n\n wrapper.__loading = () => loaded() === null && error() === null\n return wrapper\n}\n","/**\n * mapArray — keyed reactive list mapping.\n *\n * Creates each mapped item exactly once per key, then reuses it across\n * updates. When the source array is reordered or partially changed, only\n * new keys invoke `map()`; existing entries return the cached result.\n *\n * This makes structural list operations (swap, sort, filter) O(k) in\n * allocations where k is the number of new/removed keys, not O(n).\n *\n * The returned accessor reads `source()` reactively, so it can be passed\n * directly to the keyed-list reconciler.\n */\nexport function mapArray<T, U>(\n source: () => T[],\n getKey: (item: T) => string | number,\n map: (item: T) => U,\n): () => U[] {\n const cache = new Map<string | number, U>()\n\n return () => {\n const items = source()\n const result: U[] = []\n const newKeys = new Set<string | number>()\n\n for (const item of items) {\n const key = getKey(item)\n newKeys.add(key)\n if (!cache.has(key)) {\n cache.set(key, map(item))\n }\n result.push(cache.get(key) as U)\n }\n\n // Evict entries whose keys are no longer present\n for (const key of cache.keys()) {\n if (!newKeys.has(key)) cache.delete(key)\n }\n\n return result\n }\n}\n","import type { Props, VNode, VNodeChild } from \"./types\"\n\n/**\n * Symbol used as the VNode type for a Portal — runtime-dom mounts the\n * children into `target` instead of the normal parent.\n */\nexport const PortalSymbol: unique symbol = Symbol(\"pyreon.Portal\")\n\nexport interface PortalProps {\n /** DOM element to render children into (e.g. document.body). */\n target: Element\n children: VNodeChild\n}\n\n/**\n * Portal — renders `children` into a different DOM node than the\n * current parent tree.\n *\n * Useful for modals, tooltips, dropdowns, and any overlay that needs to\n * escape CSS overflow/stacking context restrictions.\n *\n * @example\n * // Render a modal at document.body level regardless of where in the\n * // component tree <Modal> is used:\n * Portal({ target: document.body, children: h(Modal, { onClose }) })\n *\n * // JSX:\n * <Portal target={document.body}>\n * <Modal onClose={close} />\n * </Portal>\n */\nexport function Portal(props: PortalProps): VNode {\n return {\n type: PortalSymbol as unknown as string,\n props: props as unknown as Props,\n children: [],\n key: null,\n }\n}\n","/**\n * createRef — mutable container for a DOM element or component value.\n *\n * Usage:\n * const inputRef = createRef<HTMLInputElement>()\n * onMount(() => { inputRef.current?.focus() })\n * return <input ref={inputRef} />\n *\n * The runtime sets `ref.current` after the element is inserted into the DOM\n * and clears it to `null` when the element is removed.\n */\n\nexport interface Ref<T = unknown> {\n current: T | null\n}\n\nexport function createRef<T = unknown>(): Ref<T> {\n return { current: null }\n}\n","import type { Props, VNode, VNodeChild, VNodeChildAtom } from \"./types\"\n\n// ─── Show ─────────────────────────────────────────────────────────────────────\n\nexport interface ShowProps extends Props {\n /** Accessor — children render when truthy, fallback when falsy. */\n when: () => unknown\n fallback?: VNodeChild\n children?: VNodeChild\n}\n\n/**\n * Conditionally render children based on a reactive condition.\n *\n * @example\n * h(Show, { when: () => isLoggedIn() },\n * h(Dashboard, null)\n * )\n *\n * // With fallback:\n * h(Show, { when: () => user(), fallback: h(Login, null) },\n * h(Dashboard, null)\n * )\n */\nexport function Show(props: ShowProps): VNode | null {\n // Returns a reactive accessor; the renderer unwraps it at mount time.\n return ((): VNodeChildAtom =>\n (props.when()\n ? (props.children ?? null)\n : (props.fallback ?? null)) as VNodeChildAtom) as unknown as VNode\n}\n\n// ─── Switch / Match ───────────────────────────────────────────────────────────\n\nexport interface MatchProps extends Props {\n /** Accessor — this branch renders when truthy. */\n when: () => unknown\n children?: VNodeChild\n}\n\n/**\n * A branch inside `<Switch>`. Renders when `when()` is truthy.\n * Must be used as a direct child of `Switch`.\n *\n * `Match` acts as a pure type/identity marker — Switch identifies it by checking\n * `vnode.type === Match` rather than by the runtime return value.\n */\nexport function Match(_props: MatchProps): VNode | null {\n // Match is never mounted directly — Switch inspects Match VNodes by type identity.\n return null\n}\n\nexport interface SwitchProps extends Props {\n /** Rendered when no Match branch is truthy. */\n fallback?: VNodeChild\n children?: VNodeChild | VNodeChild[]\n}\n\n/**\n * Multi-branch conditional rendering. Evaluates each `Match` child in order,\n * renders the first whose `when()` is truthy, or `fallback` if none match.\n *\n * @example\n * h(Switch, { fallback: h(\"p\", null, \"404\") },\n * h(Match, { when: () => route() === \"/\" }, h(Home, null)),\n * h(Match, { when: () => route() === \"/about\" }, h(About, null)),\n * )\n */\nfunction isMatchVNode(branch: VNodeChild): branch is VNode {\n return (\n branch !== null &&\n typeof branch === \"object\" &&\n !Array.isArray(branch) &&\n (branch as VNode).type === Match\n )\n}\n\nfunction resolveMatchChildren(matchVNode: VNode): VNodeChildAtom {\n if (matchVNode.children.length === 0) {\n return ((matchVNode.props as unknown as MatchProps).children ?? null) as VNodeChildAtom\n }\n if (matchVNode.children.length === 1) return matchVNode.children[0] as VNodeChildAtom\n return matchVNode.children as unknown as VNodeChildAtom\n}\n\nfunction normalizeBranches(children: SwitchProps[\"children\"]): VNodeChild[] {\n if (Array.isArray(children)) return children\n if (children != null) return [children]\n return []\n}\n\nexport function Switch(props: SwitchProps): VNode | null {\n // Returns a reactive accessor; the renderer unwraps it at mount time.\n return ((): VNodeChildAtom => {\n const branches = normalizeBranches(props.children)\n\n for (const branch of branches) {\n if (!isMatchVNode(branch)) continue\n const matchProps = branch.props as unknown as MatchProps\n if (matchProps.when()) return resolveMatchChildren(branch)\n }\n\n return (props.fallback ?? null) as VNodeChildAtom\n }) as unknown as VNode\n}\n\n// Keep MatchSymbol export for any code that was using it\nexport const MatchSymbol: unique symbol = Symbol(\"pyreon.Match\")\n","// Shared style utilities used by both runtime-dom and runtime-server.\n\n// CSS properties where numeric values are unitless (e.g. `opacity: 0.5`, `zIndex: 10`).\n// All other numeric values get \"px\" appended automatically (e.g. `height: 100` → `\"100px\"`).\nexport const CSS_UNITLESS = new Set([\n \"animationIterationCount\",\n \"aspectRatio\",\n \"borderImageOutset\",\n \"borderImageSlice\",\n \"borderImageWidth\",\n \"boxFlex\",\n \"boxFlexGroup\",\n \"boxOrdinalGroup\",\n \"columnCount\",\n \"columns\",\n \"flex\",\n \"flexGrow\",\n \"flexPositive\",\n \"flexShrink\",\n \"flexNegative\",\n \"flexOrder\",\n \"gridArea\",\n \"gridRow\",\n \"gridRowEnd\",\n \"gridRowSpan\",\n \"gridRowStart\",\n \"gridColumn\",\n \"gridColumnEnd\",\n \"gridColumnSpan\",\n \"gridColumnStart\",\n \"fontWeight\",\n \"lineClamp\",\n \"lineHeight\",\n \"opacity\",\n \"order\",\n \"orphans\",\n \"scale\",\n \"tabSize\",\n \"widows\",\n \"zIndex\",\n \"zoom\",\n \"fillOpacity\",\n \"floodOpacity\",\n \"stopOpacity\",\n \"strokeDasharray\",\n \"strokeDashoffset\",\n \"strokeMiterlimit\",\n \"strokeOpacity\",\n \"strokeWidth\",\n])\n\n/** Convert a camelCase CSS property name to kebab-case. */\nexport function toKebabCase(str: string): string {\n return str.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)\n}\n\n/** Normalize a style value — appends \"px\" to numbers for non-unitless properties. */\nexport function normalizeStyleValue(key: string, value: unknown): string {\n return typeof value === \"number\" && !CSS_UNITLESS.has(key) ? `${value}px` : String(value)\n}\n","import { Fragment, h } from \"./h\"\nimport type { Props, VNode, VNodeChild } from \"./types\"\n\nconst __DEV__ = typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\"\n\n/** Internal marker attached to lazy()-wrapped components */\nexport type LazyComponent<P extends Props = Props> = ((props: P) => VNodeChild) & {\n __loading: () => boolean\n}\n\n/**\n * Suspense — shows `fallback` while a lazy child component is still loading.\n *\n * Works in tandem with `lazy()` from `@pyreon/react-compat` (or `@pyreon/core/lazy`).\n * The child VNode's `.type.__loading()` signal drives the switch.\n *\n * Usage:\n * const Page = lazy(() => import(\"./Page\"))\n *\n * h(Suspense, { fallback: h(Spinner, null) }, h(Page, null))\n * // or with JSX:\n * <Suspense fallback={<Spinner />}><Page /></Suspense>\n */\nexport function Suspense(props: { fallback: VNodeChild; children?: VNodeChild }): VNode {\n if (__DEV__ && props.fallback === undefined) {\n // biome-ignore lint/suspicious/noConsole: dev-only warning\n console.warn(\n \"[Pyreon] <Suspense> is missing a `fallback` prop. Provide fallback UI to show while loading.\",\n )\n }\n\n return h(Fragment, null, () => {\n const ch = props.children\n const childNode = typeof ch === \"function\" ? ch() : ch\n\n // Check if the child is a VNode whose type is a lazy component still loading\n const isLoading =\n childNode != null &&\n typeof childNode === \"object\" &&\n !Array.isArray(childNode) &&\n typeof (childNode as VNode).type === \"function\" &&\n ((childNode as VNode).type as unknown as LazyComponent).__loading?.()\n\n if (isLoading) {\n const fb = props.fallback\n return typeof fb === \"function\" ? fb() : fb\n }\n return childNode\n })\n}\n"],"mappings":";;;AAEA,MAAMA,YAAU,OAAO,YAAY,eAAe,QAAQ,IAAI,aAAa;AAI3E,IAAI,WAAkC;AAEtC,SAAgB,gBAAgB,OAA8B;AAC5D,YAAW;;AAOb,SAAS,iBAAiB,UAAwB;AAChD,KAAIA,aAAW,CAAC,SAEd,SAAQ,KACN,YAAY,SAAS,sHAEtB;;;;;;AASL,SAAgB,QAAQ,IAAwC;AAC9D,kBAAiB,UAAU;AAC3B,WAAU,MAAM,KAAK,GAAG;;;;;AAM1B,SAAgB,UAAU,IAAgB;AACxC,kBAAiB,YAAY;AAC7B,WAAU,QAAQ,KAAK,GAAG;;;;;AAM5B,SAAgB,SAAS,IAAgB;AACvC,kBAAiB,WAAW;AAC5B,WAAU,OAAO,KAAK,GAAG;;;;;;;;;;;;;;;AAgB3B,SAAgB,gBAAg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AAM,MAAM,OAAO,MAAM;;;;;ACvD3F,MAAM,UAAU,OAAO,YAAY,eAAe,QAAQ,IAAI,aAAa;;;;;;;;;;;;;;AAoB3E,SAAgB,SAAS,OAA+D;AACtF,KAAI,WAAW,MAAM,aAAa,OAEhC,SAAQ,KACN,+FACD;AAGH,QAAO,EAAE,UAAU,YAAY;EAC7B,MAAM,KAAK,MAAM;EACjB,MAAM,YAAY,OAAO,OAAO,aAAa,IAAI,GAAG;AAUpD,MANE,aAAa,QACb,OAAO,cAAc,YACrB,CAAC,MAAM,QAAQ,UAAU,IACzB,OAAQ,UAAoB,SAAS,cACnC,UAAoB,KAAkC,aAAa,EAExD;GACb,MAAM,KAAK,MAAM;AACjB,UAAO,OAAO,OAAO,aAAa,IAAI,GAAG;;AAE3C,SAAO;GACP"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["__DEV__","__DEV__","__DEV__","__DEV__"],"sources":["../src/lifecycle.ts","../src/component.ts","../src/context.ts","../src/h.ts","../src/dynamic.ts","../src/telemetry.ts","../src/error-boundary.ts","../src/for.ts","../src/lazy.ts","../src/map-array.ts","../src/portal.ts","../src/props.ts","../src/ref.ts","../src/show.ts","../src/style.ts","../src/suspense.ts"],"sourcesContent":["import type { CleanupFn, LifecycleHooks } from \"./types\"\n\nconst __DEV__ = typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\"\n\n// The currently-executing component's hook storage, set by the renderer\n// before calling the component function, cleared immediately after.\nlet _current: LifecycleHooks | null = null\n\nexport function setCurrentHooks(hooks: LifecycleHooks | null) {\n _current = hooks\n}\n\nexport function getCurrentHooks(): LifecycleHooks | null {\n return _current\n}\n\nfunction warnOutsideSetup(hookName: string): void {\n if (__DEV__ && !_current) {\n // biome-ignore lint/suspicious/noConsole: dev-only warning\n console.warn(\n `[Pyreon] ${hookName}() called outside component setup. ` +\n \"Lifecycle hooks must be called synchronously during a component's setup function.\",\n )\n }\n}\n\n/**\n * Register a callback to run after the component is mounted to the DOM.\n * Optionally return a cleanup function — it will run on unmount.\n */\n// biome-ignore lint/suspicious/noConfusingVoidType: void allows callbacks that return nothing\nexport function onMount(fn: () => CleanupFn | void | undefined) {\n warnOutsideSetup(\"onMount\")\n _current?.mount.push(fn)\n}\n\n/**\n * Register a callback to run when the component is removed from the DOM.\n */\nexport function onUnmount(fn: () => void) {\n warnOutsideSetup(\"onUnmount\")\n _current?.unmount.push(fn)\n}\n\n/**\n * Register a callback to run after each reactive update.\n */\nexport function onUpdate(fn: () => void) {\n warnOutsideSetup(\"onUpdate\")\n _current?.update.push(fn)\n}\n\n/**\n * Register an error handler for this component subtree.\n *\n * When an error is thrown during rendering or in a child component,\n * the nearest `onErrorCaptured` handler is called with the error.\n * Return `true` to mark the error as handled and stop propagation.\n *\n * @example\n * onErrorCaptured((err) => {\n * setError(String(err))\n * return true // handled — don't propagate\n * })\n */\nexport function onErrorCaptured(fn: (err: unknown) => boolean | undefined) {\n warnOutsideSetup(\"onErrorCaptured\")\n _current?.error.push(fn)\n}\n","import { setCurrentHooks } from \"./lifecycle\"\nimport type { ComponentFn, LifecycleHooks, Props, VNodeChild } from \"./types\"\n\n/**\n * Identity wrapper — marks a function as a Pyreon component and preserves its type.\n * Useful for IDE tooling and future compiler optimisations.\n */\nexport function defineComponent<P extends Props>(fn: ComponentFn<P>): ComponentFn<P> {\n return fn\n}\n\n/**\n * Run a component function in a tracked context so that lifecycle hooks\n * registered inside it (onMount, onUnmount, onErrorCaptured, etc.) are captured.\n *\n * Called by the renderer — not intended for user code.\n */\nexport function runWithHooks<P extends Props>(\n fn: ComponentFn<P>,\n props: P,\n): { vnode: VNodeChild; hooks: LifecycleHooks } {\n const hooks: LifecycleHooks = { mount: [], unmount: [], update: [], error: [] }\n setCurrentHooks(hooks)\n let vnode: VNodeChild = null\n try {\n vnode = fn(props)\n } finally {\n setCurrentHooks(null)\n }\n return { vnode, hooks }\n}\n\n/**\n * Walk up error handlers collected during component rendering.\n * Returns true if any handler marked the error as handled.\n */\nexport function propagateError(err: unknown, hooks: LifecycleHooks): boolean {\n for (const handler of hooks.error) {\n if (handler(err) === true) return true\n }\n return false\n}\n\n// ─── Error boundary stack ────────────────────────────────────────────────────\n// Module-level stack of active ErrorBoundary handlers (innermost last).\n// ErrorBoundary pushes during its own setup (before children mount) so that\n// any child mountComponent error can dispatch up to the nearest boundary.\n\nconst _errorBoundaryStack: ((err: unknown) => boolean)[] = []\n\nexport function pushErrorBoundary(handler: (err: unknown) => boolean): void {\n _errorBoundaryStack.push(handler)\n}\n\nexport function popErrorBoundary(): void {\n _errorBoundaryStack.pop()\n}\n\n/**\n * Dispatch an error to the nearest active ErrorBoundary.\n * Returns true if the boundary handled it, false if none was registered.\n */\nexport function dispatchToErrorBoundary(err: unknown): boolean {\n const handler = _errorBoundaryStack[_errorBoundaryStack.length - 1]\n return handler ? handler(err) : false\n}\n","/**\n * Provide / inject — like React context or Vue provide/inject.\n *\n * Values flow down the component tree without prop-drilling.\n * The renderer maintains the context stack as it walks the VNode tree.\n */\n\nimport { onUnmount } from \"./lifecycle\"\n\nexport interface Context<T> {\n readonly id: symbol\n readonly defaultValue: T\n}\n\nexport function createContext<T>(defaultValue: T): Context<T> {\n return { id: Symbol(\"PyreonContext\"), defaultValue }\n}\n\n// ─── Runtime context stack (managed by the renderer) ─────────────────────────\n\n// Default stack — used for CSR and single-threaded SSR.\n// On Node.js with concurrent requests, @pyreon/runtime-server replaces this with\n// an AsyncLocalStorage-backed provider via setContextStackProvider().\nconst _defaultStack: Map<symbol, unknown>[] = []\nlet _stackProvider: () => Map<symbol, unknown>[] = () => _defaultStack\n\n/**\n * Override the context stack provider. Called by @pyreon/runtime-server to\n * inject an AsyncLocalStorage-backed stack that isolates concurrent SSR requests.\n * Has no effect in the browser (CSR always uses the default module-level stack).\n */\nexport function setContextStackProvider(fn: () => Map<symbol, unknown>[]): void {\n _stackProvider = fn\n}\n\nfunction getStack(): Map<symbol, unknown>[] {\n return _stackProvider()\n}\n\nconst __DEV__ = typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\"\n\nexport function pushContext(values: Map<symbol, unknown>) {\n getStack().push(values)\n}\n\nexport function popContext() {\n const stack = getStack()\n if (__DEV__ && stack.length === 0) {\n // biome-ignore lint/suspicious/noConsole: dev-only warning\n console.warn(\n \"[Pyreon] popContext() called on an empty context stack. This likely indicates a missing Provider.\",\n )\n return\n }\n stack.pop()\n}\n\n/**\n * Read the nearest provided value for a context.\n * Falls back to `context.defaultValue` if none found.\n */\nexport function useContext<T>(context: Context<T>): T {\n const stack = getStack()\n for (let i = stack.length - 1; i >= 0; i--) {\n const frame = stack[i]\n if (frame?.has(context.id)) {\n return frame.get(context.id) as T\n }\n }\n return context.defaultValue\n}\n\n/**\n * Provide a context value for the current component's subtree.\n * Must be called during component setup (like onMount/onUnmount).\n * Automatically cleaned up when the component unmounts.\n *\n * @example\n * const ThemeProvider = ({ children }: { children: VNodeChild }) => {\n * provide(ThemeContext, { color: \"blue\" })\n * return children\n * }\n */\nexport function provide<T>(context: Context<T>, value: T): void {\n pushContext(new Map<symbol, unknown>([[context.id, value]]))\n onUnmount(() => popContext())\n}\n\n/**\n * Provide a value for `context` during `fn()`.\n * Used by the renderer when it encounters a `<Provider>` component.\n */\nexport function withContext<T>(context: Context<T>, value: T, fn: () => void) {\n const frame = new Map<symbol, unknown>([[context.id, value]])\n pushContext(frame)\n try {\n fn()\n } finally {\n popContext()\n }\n}\n","import type { ComponentFn, Props, VNode, VNodeChild } from \"./types\"\n\n/** Marker for fragment nodes — renders children without a wrapper element */\nexport const Fragment: unique symbol = Symbol(\"Pyreon.Fragment\")\n\n/**\n * Hyperscript function — the compiled output of JSX.\n * `<div class=\"x\">hello</div>` → `h(\"div\", { class: \"x\" }, \"hello\")`\n *\n * Generic on P so TypeScript validates props match the component's signature\n * at the call site, then stores the result in the loosely-typed VNode.\n */\n/** Shared empty props sentinel — identity-checked in mountElement to skip applyProps. */\nexport const EMPTY_PROPS: Props = {} as Props\n\n/** Makes `children` optional in P (if present) so it can be passed as rest args to h(). */\ntype PropsWithOptionalChildren<P extends Props> = Omit<P, \"children\"> &\n (\"children\" extends keyof P ? { children?: P[\"children\"] } : unknown)\n\n// Overload: component with typed props — children is optional in the props object\n// because it can be passed as rest args. Extra keys are allowed via `& Props`.\nexport function h<P extends Props>(\n type: ComponentFn<P>,\n props: (PropsWithOptionalChildren<P> & Props) | null,\n ...children: VNodeChild[]\n): VNode\n// Overload: intrinsic element, symbol, generic/dynamic component, or mixed union\nexport function h(\n type: string | ((p: any) => VNodeChild) | symbol,\n props: Props | null,\n ...children: VNodeChild[]\n): VNode\nexport function h<P extends Props>(\n type: string | ComponentFn<P> | symbol,\n props: P | null,\n ...children: VNodeChild[]\n): VNode {\n return {\n type: type as string | ComponentFn | symbol,\n props: (props ?? EMPTY_PROPS) as Props,\n children: normalizeChildren(children),\n key: (props?.key as string | number | null) ?? null,\n }\n}\n\nfunction normalizeChildren(children: VNodeChild[]): VNodeChild[] {\n // Fast path: no nested arrays — return as-is without allocating\n for (let i = 0; i < children.length; i++) {\n if (Array.isArray(children[i])) {\n return flattenChildren(children)\n }\n }\n return children\n}\n\nfunction flattenChildren(children: VNodeChild[]): VNodeChild[] {\n const result: VNodeChild[] = []\n for (const child of children) {\n if (Array.isArray(child)) {\n result.push(...flattenChildren(child as VNodeChild[]))\n } else {\n result.push(child)\n }\n }\n return result\n}\n","import { h } from \"./h\"\nimport type { ComponentFn, Props, VNode } from \"./types\"\n\nconst __DEV__ = typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\"\n\nexport interface DynamicProps extends Props {\n component: ComponentFn | string\n}\n\nexport function Dynamic(props: DynamicProps): VNode | null {\n const { component, ...rest } = props\n if (__DEV__ && !component) {\n // biome-ignore lint/suspicious/noConsole: dev-only warning\n console.warn(\"[Pyreon] <Dynamic> received a falsy `component` prop. Nothing will be rendered.\")\n }\n if (!component) return null\n return h(component as string | ComponentFn, rest as Props)\n}\n","/**\n * Error telemetry — hook into Pyreon's error reporting for Sentry, Datadog, etc.\n *\n * @example\n * import { registerErrorHandler } from \"@pyreon/core\"\n * import * as Sentry from \"@sentry/browser\"\n *\n * registerErrorHandler(ctx => {\n * Sentry.captureException(ctx.error, {\n * extra: { component: ctx.component, phase: ctx.phase },\n * })\n * })\n */\n\nexport interface ErrorContext {\n /** Component function name, or \"Anonymous\" */\n component: string\n /** Lifecycle phase where the error occurred */\n phase: \"setup\" | \"render\" | \"mount\" | \"unmount\" | \"effect\"\n /** The thrown value */\n error: unknown\n /** Unix timestamp (ms) */\n timestamp: number\n /** Component props at the time of the error */\n props?: Record<string, unknown>\n}\n\nexport type ErrorHandler = (ctx: ErrorContext) => void\n\nlet _handlers: ErrorHandler[] = []\n\n/**\n * Register a global error handler. Called whenever a component throws in any\n * lifecycle phase. Returns an unregister function.\n */\nexport function registerErrorHandler(handler: ErrorHandler): () => void {\n _handlers.push(handler)\n return () => {\n _handlers = _handlers.filter((h) => h !== handler)\n }\n}\n\n/**\n * Internal — called by the runtime whenever a component error is caught.\n * Existing console.error calls are preserved; this is additive.\n */\nexport function reportError(ctx: ErrorContext): void {\n for (const h of _handlers) {\n try {\n h(ctx)\n } catch {\n // handler errors must never propagate back into the framework\n }\n }\n}\n","import { signal } from \"@pyreon/reactivity\"\nimport { popErrorBoundary, pushErrorBoundary } from \"./component\"\nimport { onUnmount } from \"./lifecycle\"\nimport { reportError } from \"./telemetry\"\nimport type { VNodeChild, VNodeChildAtom } from \"./types\"\n\nconst __DEV__ = typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\"\n\n/**\n * ErrorBoundary — catches errors thrown by child components and renders a\n * fallback UI instead of crashing the whole tree.\n *\n * Also reports caught errors to any registered telemetry handlers.\n *\n * How error propagation works:\n * ErrorBoundary pushes a handler onto the module-level boundary stack\n * synchronously during its own setup (before children are mounted).\n * When mountComponent catches a child error, it calls dispatchToErrorBoundary()\n * which invokes the innermost boundary's handler.\n *\n * Usage:\n * h(ErrorBoundary, {\n * fallback: (err) => h(\"p\", null, `Error: ${err}`),\n * children: h(MyComponent, null),\n * })\n *\n * // or with JSX:\n * <ErrorBoundary fallback={(err) => <p>Error: {String(err)}</p>}>\n * <MyComponent />\n * </ErrorBoundary>\n */\nexport function ErrorBoundary(props: {\n /**\n * Rendered when a child throws. Receives the caught error and a `reset`\n * function — calling `reset()` clears the error and re-renders children.\n */\n fallback: (err: unknown, reset: () => void) => VNodeChild\n children?: VNodeChild\n}): VNodeChild {\n if (__DEV__ && typeof props.fallback !== \"function\") {\n // biome-ignore lint/suspicious/noConsole: dev-only warning\n console.warn(\n \"[Pyreon] <ErrorBoundary> expects `fallback` to be a function: (err, reset) => VNode. \" +\n `Received ${typeof props.fallback}.`,\n )\n }\n\n const error = signal<unknown>(null)\n const reset = () => error.set(null)\n\n const handler = (err: unknown): boolean => {\n if (error.peek() !== null) return false // already in error state — let outer boundary catch it\n error.set(err)\n reportError({ component: \"ErrorBoundary\", phase: \"render\", error: err, timestamp: Date.now() })\n return true\n }\n\n // Push synchronously — before children are mounted — so child errors see this boundary\n pushErrorBoundary(handler)\n onUnmount(() => popErrorBoundary())\n\n return (): VNodeChildAtom => {\n const err = error()\n if (err != null) return props.fallback(err, reset) as VNodeChildAtom\n const ch = props.children\n return (typeof ch === \"function\" ? ch() : ch) as VNodeChildAtom\n }\n}\n","import type { NativeItem, Props, VNode } from \"./types\"\n\n/**\n * Symbol used as the VNode type for a For list — runtime-dom handles it\n * via mountFor, bypassing the generic VNode reconciler.\n */\nexport const ForSymbol: unique symbol = Symbol(\"pyreon.For\")\n\nexport interface ForProps<T> {\n each: () => T[]\n by: (item: T) => string | number\n children: (item: T) => VNode | NativeItem\n}\n\n/**\n * Efficient reactive list rendering.\n *\n * Unlike a plain `() => items().map(item => h(...))`, For never re-creates\n * VNodes for existing keys — only new keys invoke `children()`. Structural\n * mutations (swap, sort, filter) are O(n) key scan + O(k) DOM moves where k\n * is the number of actually displaced entries.\n *\n * Usage:\n * <For each={items} by={r => r.id}>{r => <li>...</li>}</For>\n */\nexport function For<T>(props: ForProps<T>): VNode {\n return {\n type: ForSymbol as unknown as string,\n props: props as unknown as Props,\n children: [],\n key: null,\n }\n}\n","import { signal } from \"@pyreon/reactivity\"\nimport { h } from \"./h\"\nimport type { LazyComponent } from \"./suspense\"\nimport type { ComponentFn, Props } from \"./types\"\n\nexport function lazy<P extends Props>(\n load: () => Promise<{ default: ComponentFn<P> }>,\n): LazyComponent<P> {\n const loaded = signal<ComponentFn<P> | null>(null)\n const error = signal<Error | null>(null)\n\n load()\n .then((m) => loaded.set(m.default))\n .catch((e) => error.set(e instanceof Error ? e : new Error(String(e))))\n\n const wrapper = ((props: P) => {\n const err = error()\n if (err) throw err\n const comp = loaded()\n return comp ? h(comp as ComponentFn, props as Props) : null\n }) as LazyComponent<P>\n\n wrapper.__loading = () => loaded() === null && error() === null\n return wrapper\n}\n","/**\n * mapArray — keyed reactive list mapping.\n *\n * Creates each mapped item exactly once per key, then reuses it across\n * updates. When the source array is reordered or partially changed, only\n * new keys invoke `map()`; existing entries return the cached result.\n *\n * This makes structural list operations (swap, sort, filter) O(k) in\n * allocations where k is the number of new/removed keys, not O(n).\n *\n * The returned accessor reads `source()` reactively, so it can be passed\n * directly to the keyed-list reconciler.\n */\nexport function mapArray<T, U>(\n source: () => T[],\n getKey: (item: T) => string | number,\n map: (item: T) => U,\n): () => U[] {\n const cache = new Map<string | number, U>()\n\n return () => {\n const items = source()\n const result: U[] = []\n const newKeys = new Set<string | number>()\n\n for (const item of items) {\n const key = getKey(item)\n newKeys.add(key)\n if (!cache.has(key)) {\n cache.set(key, map(item))\n }\n result.push(cache.get(key) as U)\n }\n\n // Evict entries whose keys are no longer present\n for (const key of cache.keys()) {\n if (!newKeys.has(key)) cache.delete(key)\n }\n\n return result\n }\n}\n","import type { Props, VNode, VNodeChild } from \"./types\"\n\n/**\n * Symbol used as the VNode type for a Portal — runtime-dom mounts the\n * children into `target` instead of the normal parent.\n */\nexport const PortalSymbol: unique symbol = Symbol(\"pyreon.Portal\")\n\nexport interface PortalProps {\n /** DOM element to render children into (e.g. document.body). */\n target: Element\n children: VNodeChild\n}\n\n/**\n * Portal — renders `children` into a different DOM node than the\n * current parent tree.\n *\n * Useful for modals, tooltips, dropdowns, and any overlay that needs to\n * escape CSS overflow/stacking context restrictions.\n *\n * @example\n * // Render a modal at document.body level regardless of where in the\n * // component tree <Modal> is used:\n * Portal({ target: document.body, children: h(Modal, { onClose }) })\n *\n * // JSX:\n * <Portal target={document.body}>\n * <Modal onClose={close} />\n * </Portal>\n */\nexport function Portal(props: PortalProps): VNode {\n return {\n type: PortalSymbol as unknown as string,\n props: props as unknown as Props,\n children: [],\n key: null,\n }\n}\n","// Prop utilities for component authoring.\n\n/**\n * Split props into two groups: keys you want and the rest.\n * Unlike destructuring, this preserves reactivity (getters on the original object).\n *\n * @example\n * const [own, html] = splitProps(props, [\"label\", \"icon\"])\n * return <button {...html}><Icon name={own.icon} /> {own.label}</button>\n */\nexport function splitProps<T extends Record<string, unknown>, K extends (keyof T)[]>(\n props: T,\n keys: K,\n): [Pick<T, K[number]>, Omit<T, K[number]>] {\n const picked = {} as Pick<T, K[number]>\n const rest = {} as Omit<T, K[number]>\n const keySet = new Set<string | symbol>(keys as (string | symbol)[])\n\n for (const key of Object.keys(props)) {\n const desc = Object.getOwnPropertyDescriptor(props, key)\n if (!desc) continue\n if (keySet.has(key)) {\n Object.defineProperty(picked, key, desc)\n } else {\n Object.defineProperty(rest, key, desc)\n }\n }\n\n return [picked, rest]\n}\n\n/**\n * Merge default values with component props. Defaults are used when\n * the prop is `undefined`. Preserves getter reactivity.\n *\n * @example\n * const merged = mergeProps({ size: \"md\", variant: \"primary\" }, props)\n * // merged.size is reactive — falls back to \"md\" when props.size is undefined\n */\nexport function mergeProps<T extends Record<string, unknown>>(...sources: T[]): T {\n const result = {} as T\n for (const source of sources) {\n for (const key of Object.keys(source)) {\n const desc = Object.getOwnPropertyDescriptor(source, key)\n if (!desc) continue\n // If the source has a getter, wrap it to check if the value is undefined\n // and fall back to the previously defined value\n const existing = Object.getOwnPropertyDescriptor(result, key)\n if (desc.get && existing) {\n const prevGet = existing.get ?? (() => existing.value)\n const nextGet = desc.get\n Object.defineProperty(result, key, {\n get: () => {\n const v = nextGet()\n return v !== undefined ? v : prevGet()\n },\n enumerable: true,\n configurable: true,\n })\n } else if (desc.get) {\n Object.defineProperty(result, key, desc)\n } else if (existing?.get) {\n // New source has a static value, previous had a getter\n const prevGet = existing.get\n const staticVal = desc.value\n if (staticVal !== undefined) {\n Object.defineProperty(result, key, desc)\n } else {\n Object.defineProperty(result, key, {\n get: prevGet,\n enumerable: true,\n configurable: true,\n })\n }\n } else {\n // Both static — later value wins if defined\n if (desc.value !== undefined || !existing) {\n Object.defineProperty(result, key, desc)\n }\n }\n }\n }\n return result\n}\n\n// ─── Unique ID ───────────────────────────────────────────────────────────────\n\nlet _idCounter = 0\n\n/**\n * Generate a unique ID string for accessibility attributes (htmlFor, aria-describedby, etc.).\n * SSR-safe: uses a deterministic counter that resets per request context.\n *\n * @example\n * const id = createUniqueId()\n * return <>\n * <label for={id}>Name</label>\n * <input id={id} />\n * </>\n */\nexport function createUniqueId(): string {\n return `pyreon-${++_idCounter}`\n}\n\n/** Reset the ID counter (called by SSR per-request). */\nexport function _resetIdCounter(): void {\n _idCounter = 0\n}\n","/**\n * createRef — mutable container for a DOM element or component value.\n *\n * Usage:\n * const inputRef = createRef<HTMLInputElement>()\n * onMount(() => { inputRef.current?.focus() })\n * return <input ref={inputRef} />\n *\n * The runtime sets `ref.current` after the element is inserted into the DOM\n * and clears it to `null` when the element is removed.\n */\n\nexport interface Ref<T = unknown> {\n current: T | null\n}\n\nexport function createRef<T = unknown>(): Ref<T> {\n return { current: null }\n}\n","import type { Props, VNode, VNodeChild, VNodeChildAtom } from \"./types\"\n\n// ─── Show ─────────────────────────────────────────────────────────────────────\n\nexport interface ShowProps extends Props {\n /** Accessor — children render when truthy, fallback when falsy. */\n when: () => unknown\n fallback?: VNodeChild\n children?: VNodeChild\n}\n\n/**\n * Conditionally render children based on a reactive condition.\n *\n * @example\n * h(Show, { when: () => isLoggedIn() },\n * h(Dashboard, null)\n * )\n *\n * // With fallback:\n * h(Show, { when: () => user(), fallback: h(Login, null) },\n * h(Dashboard, null)\n * )\n */\nexport function Show(props: ShowProps): VNode | null {\n // Returns a reactive accessor; the renderer unwraps it at mount time.\n return ((): VNodeChildAtom =>\n (props.when()\n ? (props.children ?? null)\n : (props.fallback ?? null)) as VNodeChildAtom) as unknown as VNode\n}\n\n// ─── Switch / Match ───────────────────────────────────────────────────────────\n\nexport interface MatchProps extends Props {\n /** Accessor — this branch renders when truthy. */\n when: () => unknown\n children?: VNodeChild\n}\n\n/**\n * A branch inside `<Switch>`. Renders when `when()` is truthy.\n * Must be used as a direct child of `Switch`.\n *\n * `Match` acts as a pure type/identity marker — Switch identifies it by checking\n * `vnode.type === Match` rather than by the runtime return value.\n */\nexport function Match(_props: MatchProps): VNode | null {\n // Match is never mounted directly — Switch inspects Match VNodes by type identity.\n return null\n}\n\nexport interface SwitchProps extends Props {\n /** Rendered when no Match branch is truthy. */\n fallback?: VNodeChild\n children?: VNodeChild | VNodeChild[]\n}\n\n/**\n * Multi-branch conditional rendering. Evaluates each `Match` child in order,\n * renders the first whose `when()` is truthy, or `fallback` if none match.\n *\n * @example\n * h(Switch, { fallback: h(\"p\", null, \"404\") },\n * h(Match, { when: () => route() === \"/\" }, h(Home, null)),\n * h(Match, { when: () => route() === \"/about\" }, h(About, null)),\n * )\n */\nfunction isMatchVNode(branch: VNodeChild): branch is VNode {\n return (\n branch !== null &&\n typeof branch === \"object\" &&\n !Array.isArray(branch) &&\n (branch as VNode).type === Match\n )\n}\n\nfunction resolveMatchChildren(matchVNode: VNode): VNodeChildAtom {\n if (matchVNode.children.length === 0) {\n return ((matchVNode.props as unknown as MatchProps).children ?? null) as VNodeChildAtom\n }\n if (matchVNode.children.length === 1) return matchVNode.children[0] as VNodeChildAtom\n return matchVNode.children as unknown as VNodeChildAtom\n}\n\nfunction normalizeBranches(children: SwitchProps[\"children\"]): VNodeChild[] {\n if (Array.isArray(children)) return children\n if (children != null) return [children]\n return []\n}\n\nexport function Switch(props: SwitchProps): VNode | null {\n // Returns a reactive accessor; the renderer unwraps it at mount time.\n return ((): VNodeChildAtom => {\n const branches = normalizeBranches(props.children)\n\n for (const branch of branches) {\n if (!isMatchVNode(branch)) continue\n const matchProps = branch.props as unknown as MatchProps\n if (matchProps.when()) return resolveMatchChildren(branch)\n }\n\n return (props.fallback ?? null) as VNodeChildAtom\n }) as unknown as VNode\n}\n\n// Keep MatchSymbol export for any code that was using it\nexport const MatchSymbol: unique symbol = Symbol(\"pyreon.Match\")\n","// Shared style utilities used by both runtime-dom and runtime-server.\n\n// CSS properties where numeric values are unitless (e.g. `opacity: 0.5`, `zIndex: 10`).\n// All other numeric values get \"px\" appended automatically (e.g. `height: 100` → `\"100px\"`).\nexport const CSS_UNITLESS = new Set([\n \"animationIterationCount\",\n \"aspectRatio\",\n \"borderImageOutset\",\n \"borderImageSlice\",\n \"borderImageWidth\",\n \"boxFlex\",\n \"boxFlexGroup\",\n \"boxOrdinalGroup\",\n \"columnCount\",\n \"columns\",\n \"flex\",\n \"flexGrow\",\n \"flexPositive\",\n \"flexShrink\",\n \"flexNegative\",\n \"flexOrder\",\n \"gridArea\",\n \"gridRow\",\n \"gridRowEnd\",\n \"gridRowSpan\",\n \"gridRowStart\",\n \"gridColumn\",\n \"gridColumnEnd\",\n \"gridColumnSpan\",\n \"gridColumnStart\",\n \"fontWeight\",\n \"lineClamp\",\n \"lineHeight\",\n \"opacity\",\n \"order\",\n \"orphans\",\n \"scale\",\n \"tabSize\",\n \"widows\",\n \"zIndex\",\n \"zoom\",\n \"fillOpacity\",\n \"floodOpacity\",\n \"stopOpacity\",\n \"strokeDasharray\",\n \"strokeDashoffset\",\n \"strokeMiterlimit\",\n \"strokeOpacity\",\n \"strokeWidth\",\n])\n\n// ─── Class utilities ─────────────────────────────────────────────────────────\n\n/** Value accepted by the `class` prop — string, array, object, or nested mix. */\nexport type ClassValue =\n | string\n | number\n | boolean\n | null\n | undefined\n | ClassValue[]\n | Record<string, boolean | null | undefined | (() => boolean)>\n\nfunction cxObject(obj: Record<string, boolean | null | undefined | (() => boolean)>): string {\n let result = \"\"\n for (const key in obj) {\n const v = obj[key]\n const truthy = typeof v === \"function\" ? v() : v\n if (truthy) result = result ? `${result} ${key}` : key\n }\n return result\n}\n\nfunction cxArray(arr: ClassValue[]): string {\n let result = \"\"\n for (const item of arr) {\n const resolved = cx(item)\n if (resolved) result = result ? `${result} ${resolved}` : resolved\n }\n return result\n}\n\n/** Resolve a ClassValue into a flat class string (like clsx/cx). */\nexport function cx(value: ClassValue): string {\n if (value == null || value === false || value === true) return \"\"\n if (typeof value === \"string\") return value\n if (typeof value === \"number\") return String(value)\n if (Array.isArray(value)) return cxArray(value)\n return cxObject(value)\n}\n\n// ─── Style utilities ─────────────────────────────────────────────────────────\n\n/** Convert a camelCase CSS property name to kebab-case. */\nexport function toKebabCase(str: string): string {\n return str.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)\n}\n\n/** Normalize a style value — appends \"px\" to numbers for non-unitless properties. */\nexport function normalizeStyleValue(key: string, value: unknown): string {\n return typeof value === \"number\" && !CSS_UNITLESS.has(key) ? `${value}px` : String(value)\n}\n","import { Fragment, h } from \"./h\"\nimport type { Props, VNode, VNodeChild } from \"./types\"\n\nconst __DEV__ = typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\"\n\n/** Internal marker attached to lazy()-wrapped components */\nexport type LazyComponent<P extends Props = Props> = ((props: P) => VNodeChild) & {\n __loading: () => boolean\n}\n\n/**\n * Suspense — shows `fallback` while a lazy child component is still loading.\n *\n * Works in tandem with `lazy()` from `@pyreon/react-compat` (or `@pyreon/core/lazy`).\n * The child VNode's `.type.__loading()` signal drives the switch.\n *\n * Usage:\n * const Page = lazy(() => import(\"./Page\"))\n *\n * h(Suspense, { fallback: h(Spinner, null) }, h(Page, null))\n * // or with JSX:\n * <Suspense fallback={<Spinner />}><Page /></Suspense>\n */\nexport function Suspense(props: { fallback: VNodeChild; children?: VNodeChild }): VNode {\n if (__DEV__ && props.fallback === undefined) {\n // biome-ignore lint/suspicious/noConsole: dev-only warning\n console.warn(\n \"[Pyreon] <Suspense> is missing a `fallback` prop. Provide fallback UI to show while loading.\",\n )\n }\n\n return h(Fragment, null, () => {\n const ch = props.children\n const childNode = typeof ch === \"function\" ? ch() : ch\n\n // Check if the child is a VNode whose type is a lazy component still loading\n const isLoading =\n childNode != null &&\n typeof childNode === \"object\" &&\n !Array.isArray(childNode) &&\n typeof (childNode as VNode).type === \"function\" &&\n ((childNode as VNode).type as unknown as LazyComponent).__loading?.()\n\n if (isLoading) {\n const fb = props.fallback\n return typeof fb === \"function\" ? fb() : fb\n }\n return childNode\n })\n}\n"],"mappings":";;;AAEA,MAAMA,YAAU,OAAO,YAAY,eAAe,QAAQ,IAAI,aAAa;AAI3E,IAAI,WAAkC;AAEtC,SAAgB,gBAAgB,OAA8B;AAC5D,YAAW;;AAOb,SAAS,iBAAiB,UAAwB;AAChD,KAAIA,aAAW,CAAC,SAEd,SAAQ,KACN,YAAY,SAAS,sHAEtB;;;;;;AASL,SAAgB,QAAQ,IAAwC;AAC9D,kBAAiB,UAAU;AAC3B,WAAU,MAAM,KAAK,GAAG;;;;;AAM1B,SAAgB,UAAU,IAAgB;AACxC,kBAAiB,YAAY;AAC7B,WAAU,QAAQ,KAAK,GAAG;;;;;AAM5B,SAAgB,SAAS,IAAgB;AACvC,kBAAiB,WAAW;AAC5B,WAAU,OAAO,KAAK,GAAG;;;;;;;;;;;;;;;AAgB3B,SAAgB,gBAAgB,IAA2C;AACzE,kBAAiB,kBAAkB;AACnC,WAAU,MAAM,KAAK,GAAG;;;;;;;;;AC5D1B,SAAgB,gBAAiC,IAAoC;AACnF,QAAO;;;;;;;;AAST,SAAgB,aACd,IACA,OAC8C;CAC9C,MAAM,QAAwB;EAAE,OAAO,EAAE;EA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AAE5D,QAAO;;;AAIT,SAAgB,GAAG,OAA2B;AAC5C,KAAI,SAAS,QAAQ,UAAU,SAAS,UAAU,KAAM,QAAO;AAC/D,KAAI,OAAO,UAAU,SAAU,QAAO;AACtC,KAAI,OAAO,UAAU,SAAU,QAAO,OAAO,MAAM;AACnD,KAAI,MAAM,QAAQ,MAAM,CAAE,QAAO,QAAQ,MAAM;AAC/C,QAAO,SAAS,MAAM;;;AAMxB,SAAgB,YAAY,KAAqB;AAC/C,QAAO,IAAI,QAAQ,WAAW,MAAM,IAAI,EAAE,aAAa,GAAG;;;AAI5D,SAAgB,oBAAoB,KAAa,OAAwB;AACvE,QAAO,OAAO,UAAU,YAAY,CAAC,aAAa,IAAI,IAAI,GAAG,GAAG,MAAM,MAAM,OAAO,MAAM;;;;;ACjG3F,MAAM,UAAU,OAAO,YAAY,eAAe,QAAQ,IAAI,aAAa;;;;;;;;;;;;;;AAoB3E,SAAgB,SAAS,OAA+D;AACtF,KAAI,WAAW,MAAM,aAAa,OAEhC,SAAQ,KACN,+FACD;AAGH,QAAO,EAAE,UAAU,YAAY;EAC7B,MAAM,KAAK,MAAM;EACjB,MAAM,YAAY,OAAO,OAAO,aAAa,IAAI,GAAG;AAUpD,MANE,aAAa,QACb,OAAO,cAAc,YACrB,CAAC,MAAM,QAAQ,UAAU,IACzB,OAAQ,UAAoB,SAAS,cACnC,UAAoB,KAAkC,aAAa,EAExD;GACb,MAAM,KAAK,MAAM;AACjB,UAAO,OAAO,OAAO,aAAa,IAAI,GAAG;;AAE3C,SAAO;GACP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-dev-runtime.js","names":[],"sources":["../src/h.ts","../src/jsx-runtime.ts"],"sourcesContent":["import type { ComponentFn, Props, VNode, VNodeChild } from \"./types\"\n\n/** Marker for fragment nodes — renders children without a wrapper element */\nexport const Fragment: unique symbol = Symbol(\"Pyreon.Fragment\")\n\n/**\n * Hyperscript function — the compiled output of JSX.\n * `<div class=\"x\">hello</div>` → `h(\"div\", { class: \"x\" }, \"hello\")`\n *\n * Generic on P so TypeScript validates props match the component's signature\n * at the call site, then stores the result in the loosely-typed VNode.\n */\n/** Shared empty props sentinel — identity-checked in mountElement to skip applyProps. */\nexport const EMPTY_PROPS: Props = {} as Props\n\n/** Makes `children` optional in P (if present) so it can be passed as rest args to h(). */\ntype PropsWithOptionalChildren<P extends Props> = Omit<P, \"children\"> &\n (\"children\" extends keyof P ? { children?: P[\"children\"] } : unknown)\n\n// Overload: component with typed props — children is optional in the props object\n// because it can be passed as rest args. Extra keys are allowed via `& Props`.\nexport function h<P extends Props>(\n type: ComponentFn<P>,\n props: (PropsWithOptionalChildren<P> & Props) | null,\n ...children: VNodeChild[]\n): VNode\n// Overload: intrinsic element, symbol, generic/dynamic component, or mixed union\nexport function h(\n type: string | ((p: any) => VNodeChild) | symbol,\n props: Props | null,\n ...children: VNodeChild[]\n): VNode\nexport function h<P extends Props>(\n type: string | ComponentFn<P> | symbol,\n props: P | null,\n ...children: VNodeChild[]\n): VNode {\n return {\n type: type as string | ComponentFn | symbol,\n props: (props ?? EMPTY_PROPS) as Props,\n children: normalizeChildren(children),\n key: (props?.key as string | number | null) ?? null,\n }\n}\n\nfunction normalizeChildren(children: VNodeChild[]): VNodeChild[] {\n // Fast path: no nested arrays — return as-is without allocating\n for (let i = 0; i < children.length; i++) {\n if (Array.isArray(children[i])) {\n return flattenChildren(children)\n }\n }\n return children\n}\n\nfunction flattenChildren(children: VNodeChild[]): VNodeChild[] {\n const result: VNodeChild[] = []\n for (const child of children) {\n if (Array.isArray(child)) {\n result.push(...flattenChildren(child as VNodeChild[]))\n } else {\n result.push(child)\n }\n }\n return result\n}\n","/**\n * JSX automatic runtime.\n *\n * When tsconfig has `\"jsxImportSource\": \"@pyreon/core\"`, the TS/bundler compiler\n * rewrites JSX to imports from this file automatically:\n * <div class=\"x\" /> → jsx(\"div\", { class: \"x\" })\n */\nimport { Fragment, h } from \"./h\"\nimport type { ComponentFn, Props, VNode, VNodeChild } from \"./types\"\n\nexport { Fragment }\n\nexport function jsx(\n type: string | ComponentFn | symbol,\n props: Props & { children?: VNodeChild | VNodeChild[] },\n key?: string | number | null,\n): VNode {\n const { children, ...rest } = props\n const propsWithKey = (key != null ? { ...rest, key } : rest) as Props\n\n if (typeof type === \"function\") {\n // Component: keep children in props.children so the component function can access them.\n // Children must NOT be spread as h() rest args because mountComponent only passes vnode.props.\n const componentProps = children !== undefined ? { ...propsWithKey, children } : propsWithKey\n return h(type, componentProps)\n }\n\n // DOM element or symbol (Fragment, ForSymbol): children go in vnode.children\n const childArray = children === undefined ? [] : Array.isArray(children) ? children : [children]\n return h(type, propsWithKey, ...(childArray as VNodeChild[]))\n}\n\n// jsxs is called when there are multiple static children — same signature\nexport const jsxs = jsx\n\n// ─── JSX types ────────────────────────────────────────────────────────────────\n\ntype Booleanish = boolean | \"true\" | \"false\"\nexport type CSSProperties = { [K in keyof CSSStyleDeclaration]?: string | number }\nexport type StyleValue = string | CSSProperties\n\n/** Common HTML attributes accepted by all Pyreon elements */\nexport interface PyreonHTMLAttributes<E extends Element = HTMLElement> {\n // Identity\n id?: string | undefined\n class?: string | (() => string) | undefined\n className?: string | (() => string) | undefined\n style?: StyleValue | (() => StyleValue) | undefined\n // Accessible\n role?: string | undefined\n tabIndex?: number | (() => number) | undefined\n title?: string | undefined\n lang?: string | undefined\n dir?: \"ltr\" | \"rtl\" | \"auto\" | undefined\n hidden?: boolean | (() => boolean) | undefined\n draggable?: Booleanish | undefined\n // ARIA\n \"aria-label\"?: string | (() => string) | undefined\n \"aria-hidden\"?: Booleanish | (() => Booleanish) | undefined\n \"aria-disabled\"?: Booleanish | (() => Booleanish) | undefined\n \"aria-expanded\"?: Booleanish | (() => Booleanish) | undefined\n \"aria-selected\"?: Booleanish | (() => Booleanish) | undefined\n \"aria-checked\"?: Booleanish | \"mixed\" | (() => Booleanish | \"mixed\") | undefined\n \"aria-current\"?: Booleanish | \"page\" | \"step\" | \"location\" | \"date\" | \"time\" | undefined\n \"aria-live\"?: \"off\" | \"assertive\" | \"polite\" | undefined\n \"aria-atomic\"?: Booleanish | undefined\n \"aria-busy\"?: Booleanish | undefined\n \"aria-controls\"?: string | undefined\n \"aria-describedby\"?: string | undefined\n \"aria-labelledby\"?: string | undefined\n \"aria-placeholder\"?: string | undefined\n \"aria-required\"?: Booleanish | (() => Booleanish) | undefined\n \"aria-invalid\"?: Booleanish | \"grammar\" | \"spelling\" | undefined\n \"aria-valuemin\"?: number | undefined\n \"aria-valuemax\"?: number | undefined\n \"aria-valuenow\"?: number | undefined\n \"aria-valuetext\"?: string | undefined\n \"aria-haspopup\"?: Booleanish | \"menu\" | \"listbox\" | \"tree\" | \"grid\" | \"dialog\" | undefined\n \"aria-posinset\"?: number | undefined\n \"aria-setsize\"?: number | undefined\n \"aria-level\"?: number | undefined\n \"aria-multiline\"?: Booleanish | undefined\n \"aria-multiselectable\"?: Booleanish | undefined\n \"aria-orientation\"?: \"horizontal\" | \"vertical\" | undefined\n \"aria-readonly\"?: Booleanish | (() => Booleanish) | undefined\n \"aria-sort\"?: \"none\" | \"ascending\" | \"descending\" | \"other\" | undefined\n \"aria-autocomplete\"?: \"none\" | \"inline\" | \"list\" | \"both\" | undefined\n \"aria-colcount\"?: number | undefined\n \"aria-colindex\"?: number | undefined\n \"aria-colspan\"?: number | undefined\n \"aria-rowcount\"?: number | undefined\n \"aria-rowindex\"?: number | undefined\n \"aria-rowspan\"?: number | undefined\n // DOM lifecycle ref — object ref or callback ref\n ref?: { current: E | null } | ((el: E | null) => void) | undefined\n // Key for list reconciliation\n key?: string | number | undefined\n // Children — allows null, undefined, boolean in JSX children positions\n children?: VNodeChild | VNodeChild[]\n // innerHTML\n innerHTML?: string | undefined\n dangerouslySetInnerHTML?: { __html: string } | undefined\n // Events\n onClick?: ((e: MouseEvent) => void) | undefined\n onDblClick?: ((e: MouseEvent) => void) | undefined\n onMouseDown?: ((e: MouseEvent) => void) | undefined\n onMouseUp?: ((e: MouseEvent) => void) | undefined\n onMouseEnter?: ((e: MouseEvent) => void) | undefined\n onMouseLeave?: ((e: MouseEvent) => void) | undefined\n onMouseMove?: ((e: MouseEvent) => void) | undefined\n onMouseOver?: ((e: MouseEvent) => void) | undefined\n onMouseOut?: ((e: MouseEvent) => void) | undefined\n onContextMenu?: ((e: MouseEvent) => void) | undefined\n onKeyDown?: ((e: KeyboardEvent) => void) | undefined\n onKeyUp?: ((e: KeyboardEvent) => void) | undefined\n onKeyPress?: ((e: KeyboardEvent) => void) | undefined\n onFocus?: ((e: FocusEvent) => void) | undefined\n onBlur?: ((e: FocusEvent) => void) | undefined\n onChange?: ((e: Event) => void) | undefined\n onInput?: ((e: InputEvent) => void) | undefined\n onSubmit?: ((e: SubmitEvent) => void) | undefined\n onReset?: ((e: Event) => void) | undefined\n onScroll?: ((e: Event) => void) | undefined\n onWheel?: ((e: WheelEvent) => void) | undefined\n onDragStart?: ((e: DragEvent) => void) | undefined\n onDragEnd?: ((e: DragEvent) => void) | undefined\n onDragOver?: ((e: DragEvent) => void) | undefined\n onDragEnter?: ((e: DragEvent) => void) | undefined\n onDragLeave?: ((e: DragEvent) => void) | undefined\n onDrop?: ((e: DragEvent) => void) | undefined\n onTouchStart?: ((e: TouchEvent) => void) | undefined\n onTouchEnd?: ((e: TouchEvent) => void) | undefined\n onTouchMove?: ((e: TouchEvent) => void) | undefined\n onPointerDown?: ((e: PointerEvent) => void) | undefined\n onPointerUp?: ((e: PointerEvent) => void) | undefined\n onPointerMove?: ((e: PointerEvent) => void) | undefined\n onPointerEnter?: ((e: PointerEvent) => void) | undefined\n onPointerLeave?: ((e: PointerEvent) => void) | undefined\n onPointerCancel?: ((e: PointerEvent) => void) | undefined\n onPointerOver?: ((e: PointerEvent) => void) | undefined\n onPointerOut?: ((e: PointerEvent) => void) | undefined\n onTransitionEnd?: ((e: TransitionEvent) => void) | undefined\n onAnimationStart?: ((e: AnimationEvent) => void) | undefined\n onAnimationEnd?: ((e: AnimationEvent) => void) | undefined\n onAnimationIteration?: ((e: AnimationEvent) => void) | undefined\n onLoad?: ((e: Event) => void) | undefined\n onError?: ((e: Event | string) => void) | undefined\n onAbort?: ((e: Event) => void) | undefined\n onSelect?: ((e: Event) => void) | undefined\n onCopy?: ((e: ClipboardEvent) => void) | undefined\n onCut?: ((e: ClipboardEvent) => void) | undefined\n onPaste?: ((e: ClipboardEvent) => void) | undefined\n // Catch-all for data-* and other arbitrary attributes\n [key: string]: unknown\n}\n\n/** Attributes specific to form inputs */\nexport interface InputAttributes extends PyreonHTMLAttributes<HTMLInputElement> {\n type?: string | (() => string) | undefined\n value?: string | number | (() => string | number) | undefined\n defaultValue?: string | number | undefined\n checked?: boolean | (() => boolean) | undefined\n defaultChecked?: boolean | undefined\n placeholder?: string | (() => string) | undefined\n disabled?: boolean | (() => boolean) | undefined\n readOnly?: boolean | undefined\n required?: boolean | (() => boolean) | undefined\n min?: string | number | undefined\n max?: string | number | undefined\n step?: string | number | undefined\n minLength?: number | undefined\n maxLength?: number | undefined\n pattern?: string | undefined\n multiple?: boolean | undefined\n name?: string | undefined\n accept?: string | undefined\n autoComplete?: string | undefined\n autoFocus?: boolean | undefined\n form?: string | undefined\n list?: string | undefined\n size?: number | undefined\n src?: string | (() => string) | undefined\n alt?: string | undefined\n width?: number | string | undefined\n height?: number | string | undefined\n}\n\nexport interface AnchorAttributes extends PyreonHTMLAttributes<HTMLAnchorElement> {\n href?: string | (() => string) | undefined\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | string | undefined\n rel?: string | undefined\n download?: string | boolean | undefined\n}\n\nexport interface ButtonAttributes extends PyreonHTMLAttributes<HTMLButtonElement> {\n type?: \"button\" | \"submit\" | \"reset\" | undefined\n disabled?: boolean | (() => boolean) | undefined\n name?: string | undefined\n value?: string | undefined\n form?: string | undefined\n formAction?: string | undefined\n formMethod?: string | undefined\n formEncType?: string | undefined\n formNoValidate?: boolean | undefined\n formTarget?: string | undefined\n}\n\nexport interface TextareaAttributes extends PyreonHTMLAttributes<HTMLTextAreaElement> {\n value?: string | (() => string) | undefined\n defaultValue?: string | undefined\n placeholder?: string | (() => string) | undefined\n disabled?: boolean | (() => boolean) | undefined\n readOnly?: boolean | undefined\n required?: boolean | (() => boolean) | undefined\n rows?: number | undefined\n cols?: number | undefined\n minLength?: number | undefined\n maxLength?: number | undefined\n name?: string | undefined\n autoFocus?: boolean | undefined\n form?: string | undefined\n wrap?: \"hard\" | \"soft\" | undefined\n}\n\nexport interface SelectAttributes extends PyreonHTMLAttributes<HTMLSelectElement> {\n value?: string | string[] | (() => string | string[]) | undefined\n defaultValue?: string | string[] | undefined\n disabled?: boolean | (() => boolean) | undefined\n required?: boolean | (() => boolean) | undefined\n multiple?: boolean | undefined\n name?: string | undefined\n size?: number | undefined\n form?: string | undefined\n autoFocus?: boolean | undefined\n}\n\ninterface OptionAttributes extends PyreonHTMLAttributes<HTMLOptionElement> {\n value?: string | number | (() => string | number) | undefined\n disabled?: boolean | (() => boolean) | undefined\n selected?: boolean | (() => boolean) | undefined\n label?: string | undefined\n}\n\nexport interface FormAttributes extends PyreonHTMLAttributes<HTMLFormElement> {\n action?: string | undefined\n method?: \"get\" | \"post\" | undefined\n encType?: string | undefined\n noValidate?: boolean | undefined\n target?: string | undefined\n name?: string | undefined\n autoComplete?: string | undefined\n}\n\nexport interface ImgAttributes extends PyreonHTMLAttributes<HTMLImageElement> {\n src?: string | (() => string) | undefined\n alt?: string | (() => string) | undefined\n width?: number | string | (() => number | string) | undefined\n height?: number | string | (() => number | string) | undefined\n loading?: \"lazy\" | \"eager\" | undefined\n decoding?: \"auto\" | \"async\" | \"sync\" | undefined\n crossOrigin?: \"anonymous\" | \"use-credentials\" | undefined\n referrerPolicy?: string | undefined\n srcSet?: string | undefined\n sizes?: string | undefined\n}\n\ninterface VideoAttributes extends PyreonHTMLAttributes<HTMLVideoElement> {\n src?: string | (() => string) | undefined\n width?: number | string | undefined\n height?: number | string | undefined\n controls?: boolean | undefined\n autoPlay?: boolean | undefined\n muted?: boolean | undefined\n loop?: boolean | undefined\n poster?: string | undefined\n preload?: \"none\" | \"metadata\" | \"auto\" | undefined\n playsInline?: boolean | undefined\n crossOrigin?: \"anonymous\" | \"use-credentials\" | undefined\n}\n\ninterface AudioAttributes extends PyreonHTMLAttributes<HTMLAudioElement> {\n src?: string | (() => string) | undefined\n controls?: boolean | undefined\n autoPlay?: boolean | undefined\n muted?: boolean | undefined\n loop?: boolean | undefined\n preload?: \"none\" | \"metadata\" | \"auto\" | undefined\n crossOrigin?: \"anonymous\" | \"use-credentials\" | undefined\n}\n\ninterface LabelAttributes extends PyreonHTMLAttributes<HTMLLabelElement> {\n htmlFor?: string | undefined\n for?: string | undefined\n form?: string | undefined\n}\n\ninterface ThAttributes extends PyreonHTMLAttributes<HTMLTableCellElement> {\n colSpan?: number | undefined\n rowSpan?: number | undefined\n scope?: \"col\" | \"row\" | \"colgroup\" | \"rowgroup\" | undefined\n abbr?: string | undefined\n headers?: string | undefined\n}\n\ninterface TdAttributes extends PyreonHTMLAttributes<HTMLTableCellElement> {\n colSpan?: number | undefined\n rowSpan?: number | undefined\n headers?: string | undefined\n}\n\ninterface ColAttributes extends PyreonHTMLAttributes<HTMLTableColElement> {\n span?: number | undefined\n}\n\ninterface IframeAttributes extends PyreonHTMLAttributes<HTMLIFrameElement> {\n src?: string | (() => string) | undefined\n width?: number | string | undefined\n height?: number | string | undefined\n allow?: string | undefined\n allowFullScreen?: boolean | undefined\n loading?: \"lazy\" | \"eager\" | undefined\n name?: string | undefined\n sandbox?: string | undefined\n referrerPolicy?: string | undefined\n title?: string | undefined\n}\n\ninterface LinkAttributes extends PyreonHTMLAttributes<HTMLLinkElement> {\n href?: string | (() => string) | undefined\n rel?: string | undefined\n type?: string | undefined\n as?: string | undefined\n media?: string | undefined\n crossOrigin?: \"anonymous\" | \"use-credentials\" | undefined\n integrity?: string | undefined\n referrerPolicy?: string | undefined\n}\n\ninterface MetaAttributes extends PyreonHTMLAttributes<HTMLMetaElement> {\n name?: string | undefined\n content?: string | (() => string) | undefined\n httpEquiv?: string | undefined\n charset?: string | undefined\n property?: string | undefined\n}\n\ninterface ScriptAttributes extends PyreonHTMLAttributes<HTMLScriptElement> {\n src?: string | (() => string) | undefined\n type?: string | undefined\n async?: boolean | undefined\n defer?: boolean | undefined\n crossOrigin?: \"anonymous\" | \"use-credentials\" | undefined\n integrity?: string | undefined\n noModule?: boolean | undefined\n referrerPolicy?: string | undefined\n}\n\ninterface SourceAttributes extends PyreonHTMLAttributes<HTMLSourceElement> {\n src?: string | (() => string) | undefined\n type?: string | undefined\n srcSet?: string | undefined\n sizes?: string | undefined\n media?: string | undefined\n}\n\ninterface ProgressAttributes extends PyreonHTMLAttributes<HTMLProgressElement> {\n value?: number | (() => number) | undefined\n max?: number | undefined\n}\n\ninterface MeterAttributes extends PyreonHTMLAttributes<HTMLMeterElement> {\n value?: number | (() => number) | undefined\n min?: number | undefined\n max?: number | undefined\n low?: number | undefined\n high?: number | undefined\n optimum?: number | undefined\n}\n\ninterface DetailsAttributes extends PyreonHTMLAttributes<HTMLDetailsElement> {\n open?: boolean | (() => boolean) | undefined\n}\n\ninterface DialogAttributes extends PyreonHTMLAttributes<HTMLDialogElement> {\n open?: boolean | (() => boolean) | undefined\n}\n\ninterface OlAttributes extends PyreonHTMLAttributes<HTMLOListElement> {\n start?: number | undefined\n reversed?: boolean | undefined\n type?: \"1\" | \"a\" | \"A\" | \"i\" | \"I\" | undefined\n}\n\nexport interface SvgAttributes extends PyreonHTMLAttributes<SVGElement> {\n viewBox?: string | undefined\n xmlns?: string | undefined\n fill?: string | (() => string) | undefined\n stroke?: string | (() => string) | undefined\n \"stroke-width\"?: string | number | undefined\n \"stroke-linecap\"?: \"butt\" | \"round\" | \"square\" | undefined\n \"stroke-linejoin\"?: \"miter\" | \"round\" | \"bevel\" | undefined\n \"fill-rule\"?: \"nonzero\" | \"evenodd\" | undefined\n \"clip-rule\"?: \"nonzero\" | \"evenodd\" | undefined\n \"clip-path\"?: string | undefined\n d?: string | undefined\n cx?: string | number | undefined\n cy?: string | number | undefined\n r?: string | number | undefined\n rx?: string | number | undefined\n ry?: string | number | undefined\n x?: string | number | undefined\n y?: string | number | undefined\n x1?: string | number | undefined\n y1?: string | number | undefined\n x2?: string | number | undefined\n y2?: string | number | undefined\n width?: string | number | undefined\n height?: string | number | undefined\n transform?: string | (() => string) | undefined\n opacity?: string | number | (() => string | number) | undefined\n points?: string | undefined\n \"font-size\"?: string | number | undefined\n \"text-anchor\"?: \"start\" | \"middle\" | \"end\" | undefined\n \"dominant-baseline\"?: string | undefined\n}\n\ndeclare global {\n namespace JSX {\n /** The type that JSX expressions evaluate to */\n type Element = import(\"./types\").VNode\n\n /**\n * Valid JSX tag types — intrinsic strings + component functions.\n * Components may return VNode, null, strings, functions (reactive getters), etc.\n * (TS 5.1+ feature)\n */\n type ElementType = keyof IntrinsicElements | ((props: any) => import(\"./types\").VNodeChild)\n\n /** Tells TS which prop name carries children in component calls */\n interface ElementChildrenAttribute {\n // biome-ignore lint/complexity/noBannedTypes: JSX spec requires {} for ElementChildrenAttribute\n children: {}\n }\n\n interface IntrinsicElements {\n // Document structure\n html: PyreonHTMLAttributes\n head: PyreonHTMLAttributes\n body: PyreonHTMLAttributes\n title: PyreonHTMLAttributes\n base: PyreonHTMLAttributes\n meta: MetaAttributes\n link: LinkAttributes\n script: ScriptAttributes\n style: PyreonHTMLAttributes\n noscript: PyreonHTMLAttributes\n // Sections\n main: PyreonHTMLAttributes\n header: PyreonHTMLAttributes\n footer: PyreonHTMLAttributes\n nav: PyreonHTMLAttributes\n aside: PyreonHTMLAttributes\n section: PyreonHTMLAttributes\n article: PyreonHTMLAttributes\n address: PyreonHTMLAttributes\n h1: PyreonHTMLAttributes\n h2: PyreonHTMLAttributes\n h3: PyreonHTMLAttributes\n h4: PyreonHTMLAttributes\n h5: PyreonHTMLAttributes\n h6: PyreonHTMLAttributes\n hgroup: PyreonHTMLAttributes\n // Block text\n p: PyreonHTMLAttributes\n pre: PyreonHTMLAttributes\n blockquote: PyreonHTMLAttributes\n figure: PyreonHTMLAttributes\n figcaption: PyreonHTMLAttributes\n div: PyreonHTMLAttributes\n hr: PyreonHTMLAttributes\n // Inline text\n span: PyreonHTMLAttributes\n a: AnchorAttributes\n em: PyreonHTMLAttributes\n strong: PyreonHTMLAttributes\n small: PyreonHTMLAttributes\n s: PyreonHTMLAttributes\n cite: PyreonHTMLAttributes\n q: PyreonHTMLAttributes\n abbr: PyreonHTMLAttributes\n time: PyreonHTMLAttributes\n code: PyreonHTMLAttributes\n var: PyreonHTMLAttributes\n samp: PyreonHTMLAttributes\n kbd: PyreonHTMLAttributes\n mark: PyreonHTMLAttributes\n sub: PyreonHTMLAttributes\n sup: PyreonHTMLAttributes\n i: PyreonHTMLAttributes\n b: PyreonHTMLAttributes\n u: PyreonHTMLAttributes\n bdi: PyreonHTMLAttributes\n bdo: PyreonHTMLAttributes\n br: PyreonHTMLAttributes\n wbr: PyreonHTMLAttributes\n ruby: PyreonHTMLAttributes\n rt: PyreonHTMLAttributes\n rp: PyreonHTMLAttributes\n // Lists\n ul: PyreonHTMLAttributes\n ol: OlAttributes\n li: PyreonHTMLAttributes\n dl: PyreonHTMLAttributes\n dt: PyreonHTMLAttributes\n dd: PyreonHTMLAttributes\n // Forms\n form: FormAttributes\n label: LabelAttributes\n input: InputAttributes\n button: ButtonAttributes\n select: SelectAttributes\n datalist: PyreonHTMLAttributes\n optgroup: PyreonHTMLAttributes\n option: OptionAttributes\n textarea: TextareaAttributes\n output: PyreonHTMLAttributes\n progress: ProgressAttributes\n meter: MeterAttributes\n fieldset: PyreonHTMLAttributes\n legend: PyreonHTMLAttributes\n // Tables\n table: PyreonHTMLAttributes\n caption: PyreonHTMLAttributes\n colgroup: PyreonHTMLAttributes\n col: ColAttributes\n thead: PyreonHTMLAttributes\n tbody: PyreonHTMLAttributes\n tfoot: PyreonHTMLAttributes\n tr: PyreonHTMLAttributes\n th: ThAttributes\n td: TdAttributes\n // Media\n img: ImgAttributes\n video: VideoAttributes\n audio: AudioAttributes\n source: SourceAttributes\n track: PyreonHTMLAttributes\n picture: PyreonHTMLAttributes\n canvas: PyreonHTMLAttributes\n svg: SvgAttributes\n path: SvgAttributes\n circle: SvgAttributes\n ellipse: SvgAttributes\n line: SvgAttributes\n polyline: SvgAttributes\n polygon: SvgAttributes\n rect: SvgAttributes\n text: SvgAttributes\n tspan: SvgAttributes\n g: SvgAttributes\n defs: SvgAttributes\n use: SvgAttributes & { href?: string }\n symbol: SvgAttributes\n clipPath: SvgAttributes\n mask: SvgAttributes\n marker: SvgAttributes\n pattern: SvgAttributes\n linearGradient: SvgAttributes\n radialGradient: SvgAttributes\n stop: SvgAttributes & {\n offset?: string | number\n \"stop-color\"?: string\n \"stop-opacity\"?: string | number\n }\n // Interactive / embedding\n details: DetailsAttributes\n summary: PyreonHTMLAttributes\n dialog: DialogAttributes\n iframe: IframeAttributes\n embed: PyreonHTMLAttributes\n object: PyreonHTMLAttributes\n param: PyreonHTMLAttributes\n // Semantic / misc\n menu: PyreonHTMLAttributes\n menuitem: PyreonHTMLAttributes\n template: PyreonHTMLAttributes\n slot: PyreonHTMLAttributes\n portal: PyreonHTMLAttributes\n // Catch-all for custom elements and data-* attrs\n [tagName: string]: PyreonHTMLAttributes<any>\n }\n }\n}\n"],"mappings":";;AAGA,MAAa,WAA0B,OAAO,kBAAkB;;;;;;;;;AAUhE,MAAa,cAAqB,EAAE;AAmBpC,SAAgB,EACd,MACA,OACA,GAAG,UACI;AACP,QAAO;EACC;EACN,OAAQ,SAAS;EACjB,UAAU,kBAAkB,SAAS;EACrC,KAAM,OAAO,OAAkC;EAChD;;AAGH,SAAS,kBAAkB,UAAsC;AAE/D,MAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,IACnC,KAAI,MAAM,QAAQ,SAAS,GAAG,CAC5B,QAAO,gBAAgB,SAAS;AAGpC,QAAO;;AAGT,SAAS,gBAAgB,UAAsC;CAC7D,MAAM,SAAuB,EAAE;AAC/B,MAAK,MAAM,SAAS,SAClB,KAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,KAAK,GAAG,gBAAgB,MAAsB,CAAC;KAEtD,QAAO,KAAK,MAAM;AAGtB,QAAO;;;;;;;;;;;;ACpDT,SAAgB,IACd,MACA,OACA,KACO;CACP,MAAM,EAAE,UAAU,GAAG,SAAS;CAC9B,MAAM,eAAgB,OAAO,OAAO;EAAE,GAAG;EAAM;EAAK,GAAG;AAEvD,KAAI,OAAO,SAAS,WAIlB,QAAO,EAAE,MADc,aAAa,SAAY;EAAE,GAAG;EAAc;EAAU,GAAG,aAClD;AAKhC,QAAO,EAAE,MAAM,cAAc,GADV,aAAa,SAAY,EAAE,GAAG,MAAM,QAAQ,SAAS,GAAG,WAAW,CAAC,SAAS,CACnC;;AAI/D,MAAa,OAAO"}
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.js","names":[],"sources":["../src/h.ts","../src/jsx-runtime.ts"],"sourcesContent":["import type { ComponentFn, Props, VNode, VNodeChild } from \"./types\"\n\n/** Marker for fragment nodes — renders children without a wrapper element */\nexport const Fragment: unique symbol = Symbol(\"Pyreon.Fragment\")\n\n/**\n * Hyperscript function — the compiled output of JSX.\n * `<div class=\"x\">hello</div>` → `h(\"div\", { class: \"x\" }, \"hello\")`\n *\n * Generic on P so TypeScript validates props match the component's signature\n * at the call site, then stores the result in the loosely-typed VNode.\n */\n/** Shared empty props sentinel — identity-checked in mountElement to skip applyProps. */\nexport const EMPTY_PROPS: Props = {} as Props\n\n/** Makes `children` optional in P (if present) so it can be passed as rest args to h(). */\ntype PropsWithOptionalChildren<P extends Props> = Omit<P, \"children\"> &\n (\"children\" extends keyof P ? { children?: P[\"children\"] } : unknown)\n\n// Overload: component with typed props — children is optional in the props object\n// because it can be passed as rest args. Extra keys are allowed via `& Props`.\nexport function h<P extends Props>(\n type: ComponentFn<P>,\n props: (PropsWithOptionalChildren<P> & Props) | null,\n ...children: VNodeChild[]\n): VNode\n// Overload: intrinsic element, symbol, generic/dynamic component, or mixed union\nexport function h(\n type: string | ((p: any) => VNodeChild) | symbol,\n props: Props | null,\n ...children: VNodeChild[]\n): VNode\nexport function h<P extends Props>(\n type: string | ComponentFn<P> | symbol,\n props: P | null,\n ...children: VNodeChild[]\n): VNode {\n return {\n type: type as string | ComponentFn | symbol,\n props: (props ?? EMPTY_PROPS) as Props,\n children: normalizeChildren(children),\n key: (props?.key as string | number | null) ?? null,\n }\n}\n\nfunction normalizeChildren(children: VNodeChild[]): VNodeChild[] {\n // Fast path: no nested arrays — return as-is without allocating\n for (let i = 0; i < children.length; i++) {\n if (Array.isArray(children[i])) {\n return flattenChildren(children)\n }\n }\n return children\n}\n\nfunction flattenChildren(children: VNodeChild[]): VNodeChild[] {\n const result: VNodeChild[] = []\n for (const child of children) {\n if (Array.isArray(child)) {\n result.push(...flattenChildren(child as VNodeChild[]))\n } else {\n result.push(child)\n }\n }\n return result\n}\n","/**\n * JSX automatic runtime.\n *\n * When tsconfig has `\"jsxImportSource\": \"@pyreon/core\"`, the TS/bundler compiler\n * rewrites JSX to imports from this file automatically:\n * <div class=\"x\" /> → jsx(\"div\", { class: \"x\" })\n */\nimport { Fragment, h } from \"./h\"\nimport type { ClassValue } from \"./style\"\nimport type { ComponentFn, Props, VNode, VNodeChild } from \"./types\"\n\nexport { Fragment }\n\nexport function jsx(\n type: string | ComponentFn | symbol,\n props: Props & { children?: VNodeChild | VNodeChild[] },\n key?: string | number | null,\n): VNode {\n const { children, ...rest } = props\n const propsWithKey = (key != null ? { ...rest, key } : rest) as Props\n\n if (typeof type === \"function\") {\n // Component: keep children in props.children so the component function can access them.\n // Children must NOT be spread as h() rest args because mountComponent only passes vnode.props.\n const componentProps = children !== undefined ? { ...propsWithKey, children } : propsWithKey\n return h(type, componentProps)\n }\n\n // DOM element or symbol (Fragment, ForSymbol): children go in vnode.children\n const childArray = children === undefined ? [] : Array.isArray(children) ? children : [children]\n return h(type, propsWithKey, ...(childArray as VNodeChild[]))\n}\n\n// jsxs is called when there are multiple static children — same signature\nexport const jsxs = jsx\n\n// ─── JSX types ────────────────────────────────────────────────────────────────\n\ntype Booleanish = boolean | \"true\" | \"false\"\nexport type CSSProperties = { [K in keyof CSSStyleDeclaration]?: string | number }\nexport type StyleValue = string | CSSProperties\n\n/** Event with typed currentTarget — used in element-specific event handlers. */\nexport type TargetedEvent<T extends Element, E extends Event = Event> = E & {\n readonly currentTarget: T\n}\n\n/** Common HTML attributes accepted by all Pyreon elements */\nexport interface PyreonHTMLAttributes<E extends Element = HTMLElement> {\n // Identity\n id?: string | undefined\n class?: ClassValue | (() => ClassValue) | undefined\n className?: ClassValue | (() => ClassValue) | undefined\n style?: StyleValue | (() => StyleValue) | undefined\n // Accessible\n role?: string | undefined\n tabIndex?: number | (() => number) | undefined\n title?: string | undefined\n lang?: string | undefined\n dir?: \"ltr\" | \"rtl\" | \"auto\" | undefined\n hidden?: boolean | (() => boolean) | undefined\n draggable?: Booleanish | undefined\n // ARIA\n \"aria-label\"?: string | (() => string) | undefined\n \"aria-hidden\"?: Booleanish | (() => Booleanish) | undefined\n \"aria-disabled\"?: Booleanish | (() => Booleanish) | undefined\n \"aria-expanded\"?: Booleanish | (() => Booleanish) | undefined\n \"aria-selected\"?: Booleanish | (() => Booleanish) | undefined\n \"aria-checked\"?: Booleanish | \"mixed\" | (() => Booleanish | \"mixed\") | undefined\n \"aria-current\"?: Booleanish | \"page\" | \"step\" | \"location\" | \"date\" | \"time\" | undefined\n \"aria-live\"?: \"off\" | \"assertive\" | \"polite\" | undefined\n \"aria-atomic\"?: Booleanish | undefined\n \"aria-busy\"?: Booleanish | undefined\n \"aria-controls\"?: string | undefined\n \"aria-describedby\"?: string | undefined\n \"aria-labelledby\"?: string | undefined\n \"aria-placeholder\"?: string | undefined\n \"aria-required\"?: Booleanish | (() => Booleanish) | undefined\n \"aria-invalid\"?: Booleanish | \"grammar\" | \"spelling\" | undefined\n \"aria-valuemin\"?: number | undefined\n \"aria-valuemax\"?: number | undefined\n \"aria-valuenow\"?: number | undefined\n \"aria-valuetext\"?: string | undefined\n \"aria-haspopup\"?: Booleanish | \"menu\" | \"listbox\" | \"tree\" | \"grid\" | \"dialog\" | undefined\n \"aria-posinset\"?: number | undefined\n \"aria-setsize\"?: number | undefined\n \"aria-level\"?: number | undefined\n \"aria-multiline\"?: Booleanish | undefined\n \"aria-multiselectable\"?: Booleanish | undefined\n \"aria-orientation\"?: \"horizontal\" | \"vertical\" | undefined\n \"aria-readonly\"?: Booleanish | (() => Booleanish) | undefined\n \"aria-sort\"?: \"none\" | \"ascending\" | \"descending\" | \"other\" | undefined\n \"aria-autocomplete\"?: \"none\" | \"inline\" | \"list\" | \"both\" | undefined\n \"aria-colcount\"?: number | undefined\n \"aria-colindex\"?: number | undefined\n \"aria-colspan\"?: number | undefined\n \"aria-rowcount\"?: number | undefined\n \"aria-rowindex\"?: number | undefined\n \"aria-rowspan\"?: number | undefined\n // DOM lifecycle ref — object ref or callback ref\n ref?: { current: E | null } | ((el: E | null) => void) | undefined\n // Key for list reconciliation\n key?: string | number | undefined\n // Children — allows null, undefined, boolean in JSX children positions\n children?: VNodeChild | VNodeChild[]\n // innerHTML\n innerHTML?: string | undefined\n dangerouslySetInnerHTML?: { __html: string } | undefined\n // Events — typed currentTarget via generic E\n onClick?: ((e: TargetedEvent<E, MouseEvent>) => void) | undefined\n onDblClick?: ((e: TargetedEvent<E, MouseEvent>) => void) | undefined\n onMouseDown?: ((e: TargetedEvent<E, MouseEvent>) => void) | undefined\n onMouseUp?: ((e: TargetedEvent<E, MouseEvent>) => void) | undefined\n onMouseEnter?: ((e: TargetedEvent<E, MouseEvent>) => void) | undefined\n onMouseLeave?: ((e: TargetedEvent<E, MouseEvent>) => void) | undefined\n onMouseMove?: ((e: TargetedEvent<E, MouseEvent>) => void) | undefined\n onMouseOver?: ((e: TargetedEvent<E, MouseEvent>) => void) | undefined\n onMouseOut?: ((e: TargetedEvent<E, MouseEvent>) => void) | undefined\n onContextMenu?: ((e: TargetedEvent<E, MouseEvent>) => void) | undefined\n onKeyDown?: ((e: TargetedEvent<E, KeyboardEvent>) => void) | undefined\n onKeyUp?: ((e: TargetedEvent<E, KeyboardEvent>) => void) | undefined\n onKeyPress?: ((e: TargetedEvent<E, KeyboardEvent>) => void) | undefined\n onFocus?: ((e: TargetedEvent<E, FocusEvent>) => void) | undefined\n onBlur?: ((e: TargetedEvent<E, FocusEvent>) => void) | undefined\n onChange?: ((e: TargetedEvent<E>) => void) | undefined\n onInput?: ((e: TargetedEvent<E, InputEvent>) => void) | undefined\n onBeforeInput?: ((e: TargetedEvent<E, InputEvent>) => void) | undefined\n onSubmit?: ((e: TargetedEvent<E, SubmitEvent>) => void) | undefined\n onReset?: ((e: TargetedEvent<E>) => void) | undefined\n onInvalid?: ((e: TargetedEvent<E>) => void) | undefined\n onScroll?: ((e: TargetedEvent<E>) => void) | undefined\n onWheel?: ((e: TargetedEvent<E, WheelEvent>) => void) | undefined\n onResize?: ((e: TargetedEvent<E>) => void) | undefined\n onDragStart?: ((e: TargetedEvent<E, DragEvent>) => void) | undefined\n onDragEnd?: ((e: TargetedEvent<E, DragEvent>) => void) | undefined\n onDragOver?: ((e: TargetedEvent<E, DragEvent>) => void) | undefined\n onDragEnter?: ((e: TargetedEvent<E, DragEvent>) => void) | undefined\n onDragLeave?: ((e: TargetedEvent<E, DragEvent>) => void) | undefined\n onDrop?: ((e: TargetedEvent<E, DragEvent>) => void) | undefined\n onTouchStart?: ((e: TargetedEvent<E, TouchEvent>) => void) | undefined\n onTouchEnd?: ((e: TargetedEvent<E, TouchEvent>) => void) | undefined\n onTouchMove?: ((e: TargetedEvent<E, TouchEvent>) => void) | undefined\n onPointerDown?: ((e: TargetedEvent<E, PointerEvent>) => void) | undefined\n onPointerUp?: ((e: TargetedEvent<E, PointerEvent>) => void) | undefined\n onPointerMove?: ((e: TargetedEvent<E, PointerEvent>) => void) | undefined\n onPointerEnter?: ((e: TargetedEvent<E, PointerEvent>) => void) | undefined\n onPointerLeave?: ((e: TargetedEvent<E, PointerEvent>) => void) | undefined\n onPointerCancel?: ((e: TargetedEvent<E, PointerEvent>) => void) | undefined\n onPointerOver?: ((e: TargetedEvent<E, PointerEvent>) => void) | undefined\n onPointerOut?: ((e: TargetedEvent<E, PointerEvent>) => void) | undefined\n onTransitionEnd?: ((e: TargetedEvent<E, TransitionEvent>) => void) | undefined\n onAnimationStart?: ((e: TargetedEvent<E, AnimationEvent>) => void) | undefined\n onAnimationEnd?: ((e: TargetedEvent<E, AnimationEvent>) => void) | undefined\n onAnimationIteration?: ((e: TargetedEvent<E, AnimationEvent>) => void) | undefined\n onToggle?: ((e: TargetedEvent<E>) => void) | undefined\n onLoad?: ((e: TargetedEvent<E>) => void) | undefined\n onError?: ((e: TargetedEvent<E> | string) => void) | undefined\n onAbort?: ((e: TargetedEvent<E>) => void) | undefined\n onSelect?: ((e: TargetedEvent<E>) => void) | undefined\n onCopy?: ((e: TargetedEvent<E, ClipboardEvent>) => void) | undefined\n onCut?: ((e: TargetedEvent<E, ClipboardEvent>) => void) | undefined\n onPaste?: ((e: TargetedEvent<E, ClipboardEvent>) => void) | undefined\n // data-* and aria-* catch-all (typed attributes above catch typos)\n [key: `data-${string}`]: unknown\n [key: `aria-${string}`]: unknown\n}\n\n/** Attributes specific to form inputs */\nexport interface InputAttributes extends PyreonHTMLAttributes<HTMLInputElement> {\n type?: string | (() => string) | undefined\n value?: string | number | (() => string | number) | undefined\n defaultValue?: string | number | undefined\n checked?: boolean | (() => boolean) | undefined\n defaultChecked?: boolean | undefined\n placeholder?: string | (() => string) | undefined\n disabled?: boolean | (() => boolean) | undefined\n readOnly?: boolean | undefined\n required?: boolean | (() => boolean) | undefined\n min?: string | number | undefined\n max?: string | number | undefined\n step?: string | number | undefined\n minLength?: number | undefined\n maxLength?: number | undefined\n pattern?: string | undefined\n multiple?: boolean | undefined\n name?: string | undefined\n accept?: string | undefined\n autoComplete?: string | undefined\n autoFocus?: boolean | undefined\n form?: string | undefined\n list?: string | undefined\n size?: number | undefined\n src?: string | (() => string) | undefined\n alt?: string | undefined\n width?: number | string | undefined\n height?: number | string | undefined\n}\n\nexport interface AnchorAttributes extends PyreonHTMLAttributes<HTMLAnchorElement> {\n href?: string | (() => string) | undefined\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | string | undefined\n rel?: string | undefined\n download?: string | boolean | undefined\n}\n\nexport interface ButtonAttributes extends PyreonHTMLAttributes<HTMLButtonElement> {\n type?: \"button\" | \"submit\" | \"reset\" | undefined\n disabled?: boolean | (() => boolean) | undefined\n name?: string | undefined\n value?: string | undefined\n form?: string | undefined\n formAction?: string | undefined\n formMethod?: string | undefined\n formEncType?: string | undefined\n formNoValidate?: boolean | undefined\n formTarget?: string | undefined\n}\n\nexport interface TextareaAttributes extends PyreonHTMLAttributes<HTMLTextAreaElement> {\n value?: string | (() => string) | undefined\n defaultValue?: string | undefined\n placeholder?: string | (() => string) | undefined\n disabled?: boolean | (() => boolean) | undefined\n readOnly?: boolean | undefined\n required?: boolean | (() => boolean) | undefined\n rows?: number | undefined\n cols?: number | undefined\n minLength?: number | undefined\n maxLength?: number | undefined\n name?: string | undefined\n autoFocus?: boolean | undefined\n form?: string | undefined\n wrap?: \"hard\" | \"soft\" | undefined\n}\n\nexport interface SelectAttributes extends PyreonHTMLAttributes<HTMLSelectElement> {\n value?: string | string[] | (() => string | string[]) | undefined\n defaultValue?: string | string[] | undefined\n disabled?: boolean | (() => boolean) | undefined\n required?: boolean | (() => boolean) | undefined\n multiple?: boolean | undefined\n name?: string | undefined\n size?: number | undefined\n form?: string | undefined\n autoFocus?: boolean | undefined\n}\n\ninterface OptionAttributes extends PyreonHTMLAttributes<HTMLOptionElement> {\n value?: string | number | (() => string | number) | undefined\n disabled?: boolean | (() => boolean) | undefined\n selected?: boolean | (() => boolean) | undefined\n label?: string | undefined\n}\n\nexport interface FormAttributes extends PyreonHTMLAttributes<HTMLFormElement> {\n action?: string | undefined\n method?: \"get\" | \"post\" | undefined\n encType?: string | undefined\n noValidate?: boolean | undefined\n target?: string | undefined\n name?: string | undefined\n autoComplete?: string | undefined\n}\n\nexport interface ImgAttributes extends PyreonHTMLAttributes<HTMLImageElement> {\n src?: string | (() => string) | undefined\n alt?: string | (() => string) | undefined\n width?: number | string | (() => number | string) | undefined\n height?: number | string | (() => number | string) | undefined\n loading?: \"lazy\" | \"eager\" | undefined\n decoding?: \"auto\" | \"async\" | \"sync\" | undefined\n crossOrigin?: \"anonymous\" | \"use-credentials\" | undefined\n referrerPolicy?: string | undefined\n srcSet?: string | undefined\n sizes?: string | undefined\n}\n\ninterface VideoAttributes extends PyreonHTMLAttributes<HTMLVideoElement> {\n src?: string | (() => string) | undefined\n width?: number | string | undefined\n height?: number | string | undefined\n controls?: boolean | undefined\n autoPlay?: boolean | undefined\n muted?: boolean | undefined\n loop?: boolean | undefined\n poster?: string | undefined\n preload?: \"none\" | \"metadata\" | \"auto\" | undefined\n playsInline?: boolean | undefined\n crossOrigin?: \"anonymous\" | \"use-credentials\" | undefined\n}\n\ninterface AudioAttributes extends PyreonHTMLAttributes<HTMLAudioElement> {\n src?: string | (() => string) | undefined\n controls?: boolean | undefined\n autoPlay?: boolean | undefined\n muted?: boolean | undefined\n loop?: boolean | undefined\n preload?: \"none\" | \"metadata\" | \"auto\" | undefined\n crossOrigin?: \"anonymous\" | \"use-credentials\" | undefined\n}\n\ninterface LabelAttributes extends PyreonHTMLAttributes<HTMLLabelElement> {\n htmlFor?: string | undefined\n for?: string | undefined\n form?: string | undefined\n}\n\ninterface ThAttributes extends PyreonHTMLAttributes<HTMLTableCellElement> {\n colSpan?: number | undefined\n rowSpan?: number | undefined\n scope?: \"col\" | \"row\" | \"colgroup\" | \"rowgroup\" | undefined\n abbr?: string | undefined\n headers?: string | undefined\n}\n\ninterface TdAttributes extends PyreonHTMLAttributes<HTMLTableCellElement> {\n colSpan?: number | undefined\n rowSpan?: number | undefined\n headers?: string | undefined\n}\n\ninterface ColAttributes extends PyreonHTMLAttributes<HTMLTableColElement> {\n span?: number | undefined\n}\n\ninterface IframeAttributes extends PyreonHTMLAttributes<HTMLIFrameElement> {\n src?: string | (() => string) | undefined\n width?: number | string | undefined\n height?: number | string | undefined\n allow?: string | undefined\n allowFullScreen?: boolean | undefined\n loading?: \"lazy\" | \"eager\" | undefined\n name?: string | undefined\n sandbox?: string | undefined\n referrerPolicy?: string | undefined\n title?: string | undefined\n}\n\ninterface LinkAttributes extends PyreonHTMLAttributes<HTMLLinkElement> {\n href?: string | (() => string) | undefined\n rel?: string | undefined\n type?: string | undefined\n as?: string | undefined\n media?: string | undefined\n crossOrigin?: \"anonymous\" | \"use-credentials\" | undefined\n integrity?: string | undefined\n referrerPolicy?: string | undefined\n}\n\ninterface MetaAttributes extends PyreonHTMLAttributes<HTMLMetaElement> {\n name?: string | undefined\n content?: string | (() => string) | undefined\n httpEquiv?: string | undefined\n charset?: string | undefined\n property?: string | undefined\n}\n\ninterface ScriptAttributes extends PyreonHTMLAttributes<HTMLScriptElement> {\n src?: string | (() => string) | undefined\n type?: string | undefined\n async?: boolean | undefined\n defer?: boolean | undefined\n crossOrigin?: \"anonymous\" | \"use-credentials\" | undefined\n integrity?: string | undefined\n noModule?: boolean | undefined\n referrerPolicy?: string | undefined\n}\n\ninterface SourceAttributes extends PyreonHTMLAttributes<HTMLSourceElement> {\n src?: string | (() => string) | undefined\n type?: string | undefined\n srcSet?: string | undefined\n sizes?: string | undefined\n media?: string | undefined\n}\n\ninterface ProgressAttributes extends PyreonHTMLAttributes<HTMLProgressElement> {\n value?: number | (() => number) | undefined\n max?: number | undefined\n}\n\ninterface MeterAttributes extends PyreonHTMLAttributes<HTMLMeterElement> {\n value?: number | (() => number) | undefined\n min?: number | undefined\n max?: number | undefined\n low?: number | undefined\n high?: number | undefined\n optimum?: number | undefined\n}\n\ninterface DetailsAttributes extends PyreonHTMLAttributes<HTMLDetailsElement> {\n open?: boolean | (() => boolean) | undefined\n}\n\ninterface DialogAttributes extends PyreonHTMLAttributes<HTMLDialogElement> {\n open?: boolean | (() => boolean) | undefined\n}\n\ninterface OlAttributes extends PyreonHTMLAttributes<HTMLOListElement> {\n start?: number | undefined\n reversed?: boolean | undefined\n type?: \"1\" | \"a\" | \"A\" | \"i\" | \"I\" | undefined\n}\n\ninterface CanvasAttributes extends PyreonHTMLAttributes<HTMLCanvasElement> {\n width?: number | string | undefined\n height?: number | string | undefined\n}\n\nexport interface SvgAttributes extends PyreonHTMLAttributes<SVGElement> {\n viewBox?: string | undefined\n xmlns?: string | undefined\n fill?: string | (() => string) | undefined\n stroke?: string | (() => string) | undefined\n \"stroke-width\"?: string | number | undefined\n \"stroke-linecap\"?: \"butt\" | \"round\" | \"square\" | undefined\n \"stroke-linejoin\"?: \"miter\" | \"round\" | \"bevel\" | undefined\n \"fill-rule\"?: \"nonzero\" | \"evenodd\" | undefined\n \"clip-rule\"?: \"nonzero\" | \"evenodd\" | undefined\n \"clip-path\"?: string | undefined\n d?: string | undefined\n cx?: string | number | undefined\n cy?: string | number | undefined\n r?: string | number | undefined\n rx?: string | number | undefined\n ry?: string | number | undefined\n x?: string | number | undefined\n y?: string | number | undefined\n x1?: string | number | undefined\n y1?: string | number | undefined\n x2?: string | number | undefined\n y2?: string | number | undefined\n width?: string | number | undefined\n height?: string | number | undefined\n transform?: string | (() => string) | undefined\n opacity?: string | number | (() => string | number) | undefined\n points?: string | undefined\n \"font-size\"?: string | number | undefined\n \"text-anchor\"?: \"start\" | \"middle\" | \"end\" | undefined\n \"dominant-baseline\"?: string | undefined\n}\n\ndeclare global {\n namespace JSX {\n /** The type that JSX expressions evaluate to */\n type Element = import(\"./types\").VNode\n\n /**\n * Valid JSX tag types — intrinsic strings + component functions.\n * Components may return VNode, null, strings, functions (reactive getters), etc.\n * (TS 5.1+ feature)\n */\n type ElementType = keyof IntrinsicElements | ((props: any) => import(\"./types\").VNodeChild)\n\n /** Tells TS which prop name carries children in component calls */\n interface ElementChildrenAttribute {\n // biome-ignore lint/complexity/noBannedTypes: JSX spec requires {} for ElementChildrenAttribute\n children: {}\n }\n\n interface IntrinsicElements {\n // Document structure\n html: PyreonHTMLAttributes\n head: PyreonHTMLAttributes\n body: PyreonHTMLAttributes\n title: PyreonHTMLAttributes\n base: PyreonHTMLAttributes\n meta: MetaAttributes\n link: LinkAttributes\n script: ScriptAttributes\n style: PyreonHTMLAttributes\n noscript: PyreonHTMLAttributes\n // Sections\n main: PyreonHTMLAttributes\n header: PyreonHTMLAttributes\n footer: PyreonHTMLAttributes\n nav: PyreonHTMLAttributes\n aside: PyreonHTMLAttributes\n section: PyreonHTMLAttributes\n article: PyreonHTMLAttributes\n address: PyreonHTMLAttributes\n h1: PyreonHTMLAttributes\n h2: PyreonHTMLAttributes\n h3: PyreonHTMLAttributes\n h4: PyreonHTMLAttributes\n h5: PyreonHTMLAttributes\n h6: PyreonHTMLAttributes\n hgroup: PyreonHTMLAttributes\n // Block text\n p: PyreonHTMLAttributes\n pre: PyreonHTMLAttributes\n blockquote: PyreonHTMLAttributes\n figure: PyreonHTMLAttributes\n figcaption: PyreonHTMLAttributes\n div: PyreonHTMLAttributes\n hr: PyreonHTMLAttributes\n // Inline text\n span: PyreonHTMLAttributes\n a: AnchorAttributes\n em: PyreonHTMLAttributes\n strong: PyreonHTMLAttributes\n small: PyreonHTMLAttributes\n s: PyreonHTMLAttributes\n cite: PyreonHTMLAttributes\n q: PyreonHTMLAttributes\n abbr: PyreonHTMLAttributes\n time: PyreonHTMLAttributes\n code: PyreonHTMLAttributes\n var: PyreonHTMLAttributes\n samp: PyreonHTMLAttributes\n kbd: PyreonHTMLAttributes\n mark: PyreonHTMLAttributes\n sub: PyreonHTMLAttributes\n sup: PyreonHTMLAttributes\n i: PyreonHTMLAttributes\n b: PyreonHTMLAttributes\n u: PyreonHTMLAttributes\n bdi: PyreonHTMLAttributes\n bdo: PyreonHTMLAttributes\n br: PyreonHTMLAttributes\n wbr: PyreonHTMLAttributes\n ruby: PyreonHTMLAttributes\n rt: PyreonHTMLAttributes\n rp: PyreonHTMLAttributes\n // Lists\n ul: PyreonHTMLAttributes\n ol: OlAttributes\n li: PyreonHTMLAttributes\n dl: PyreonHTMLAttributes\n dt: PyreonHTMLAttributes\n dd: PyreonHTMLAttributes\n // Forms\n form: FormAttributes\n label: LabelAttributes\n input: InputAttributes\n button: ButtonAttributes\n select: SelectAttributes\n datalist: PyreonHTMLAttributes\n optgroup: PyreonHTMLAttributes\n option: OptionAttributes\n textarea: TextareaAttributes\n output: PyreonHTMLAttributes\n progress: ProgressAttributes\n meter: MeterAttributes\n fieldset: PyreonHTMLAttributes\n legend: PyreonHTMLAttributes\n // Tables\n table: PyreonHTMLAttributes\n caption: PyreonHTMLAttributes\n colgroup: PyreonHTMLAttributes\n col: ColAttributes\n thead: PyreonHTMLAttributes\n tbody: PyreonHTMLAttributes\n tfoot: PyreonHTMLAttributes\n tr: PyreonHTMLAttributes\n th: ThAttributes\n td: TdAttributes\n // Media\n img: ImgAttributes\n video: VideoAttributes\n audio: AudioAttributes\n source: SourceAttributes\n track: PyreonHTMLAttributes\n picture: PyreonHTMLAttributes\n canvas: CanvasAttributes\n svg: SvgAttributes\n path: SvgAttributes\n circle: SvgAttributes\n ellipse: SvgAttributes\n line: SvgAttributes\n polyline: SvgAttributes\n polygon: SvgAttributes\n rect: SvgAttributes\n text: SvgAttributes\n tspan: SvgAttributes\n g: SvgAttributes\n defs: SvgAttributes\n use: SvgAttributes & { href?: string }\n symbol: SvgAttributes\n clipPath: SvgAttributes\n mask: SvgAttributes\n marker: SvgAttributes\n pattern: SvgAttributes\n linearGradient: SvgAttributes\n radialGradient: SvgAttributes\n stop: SvgAttributes & {\n offset?: string | number\n \"stop-color\"?: string\n \"stop-opacity\"?: string | number\n }\n // Interactive / embedding\n details: DetailsAttributes\n summary: PyreonHTMLAttributes\n dialog: DialogAttributes\n iframe: IframeAttributes\n embed: PyreonHTMLAttributes\n object: PyreonHTMLAttributes\n param: PyreonHTMLAttributes\n // Semantic / misc\n menu: PyreonHTMLAttributes\n menuitem: PyreonHTMLAttributes\n template: PyreonHTMLAttributes\n slot: PyreonHTMLAttributes\n portal: PyreonHTMLAttributes\n // Catch-all for custom elements and data-* attrs\n [tagName: string]: PyreonHTMLAttributes<any>\n }\n }\n}\n"],"mappings":";;AAGA,MAAa,WAA0B,OAAO,kBAAkB;;;;;;;;;AAUhE,MAAa,cAAqB,EAAE;AAmBpC,SAAgB,EACd,MACA,OACA,GAAG,UACI;AACP,QAAO;EACC;EACN,OAAQ,SAAS;EACjB,UAAU,kBAAkB,SAAS;EACrC,KAAM,OAAO,OAAkC;EAChD;;AAGH,SAAS,kBAAkB,UAAsC;AAE/D,MAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,IACnC,KAAI,MAAM,QAAQ,SAAS,GAAG,CAC5B,QAAO,gBAAgB,SAAS;AAGpC,QAAO;;AAGT,SAAS,gBAAgB,UAAsC;CAC7D,MAAM,SAAuB,EAAE;AAC/B,MAAK,MAAM,SAAS,SAClB,KAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,KAAK,GAAG,gBAAgB,MAAsB,CAAC;KAEtD,QAAO,KAAK,MAAM;AAGtB,QAAO;;;;;;;;;;;;ACnDT,SAAgB,IACd,MACA,OACA,KACO;CACP,MAAM,EAAE,UAAU,GAAG,SAAS;CAC9B,MAAM,eAAgB,OAAO,OAAO;EAAE,GAAG;EAAM;EAAK,GAAG;AAEvD,KAAI,OAAO,SAAS,WAIlB,QAAO,EAAE,MADc,aAAa,SAAY;EAAE,GAAG;EAAc;EAAU,GAAG,aAClD;AAKhC,QAAO,EAAE,MAAM,cAAc,GADV,aAAa,SAAY,EAAE,GAAG,MAAM,QAAQ,SAAS,GAAG,WAAW,CAAC,SAAS,CACnC;;AAI/D,MAAa,OAAO"}
|