@pyreon/core 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/lib/analysis/index.js.html +1 -1
- package/lib/index.js +77 -3
- 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 +11 -4
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/jsx-dev-runtime.d.ts +2 -1
- package/lib/types/jsx-dev-runtime.d.ts.map +1 -1
- package/lib/types/jsx-runtime.d.ts +2 -1
- package/lib/types/jsx-runtime.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/context.ts +4 -0
- package/src/dynamic.ts +6 -0
- package/src/error-boundary.ts +10 -0
- package/src/h.ts +1 -2
- package/src/index.ts +1 -0
- package/src/jsx-runtime.ts +3 -1
- package/src/lifecycle.ts +18 -1
- package/src/style.ts +60 -0
- package/src/suspense.ts +9 -0
- package/src/tests/core.test.ts +52 -5
- package/src/tests/jsx-compat.test.tsx +2 -2
- package/src/types.ts +2 -1
package/README.md
CHANGED
|
@@ -16,7 +16,6 @@ import { onMount, onUnmount, createContext, useContext } from "@pyreon/core"
|
|
|
16
16
|
function Counter() {
|
|
17
17
|
onMount(() => {
|
|
18
18
|
console.log("mounted")
|
|
19
|
-
return undefined
|
|
20
19
|
})
|
|
21
20
|
|
|
22
21
|
return <div>Hello Pyreon</div>
|
|
@@ -40,7 +39,7 @@ function Counter() {
|
|
|
40
39
|
|
|
41
40
|
### Lifecycle Hooks
|
|
42
41
|
|
|
43
|
-
- **`onMount(fn: () => CleanupFn |
|
|
42
|
+
- **`onMount(fn: () => CleanupFn | void)`** -- Runs after the component mounts. Optionally return a cleanup function.
|
|
44
43
|
- **`onUnmount(fn)`** -- Runs when the component is removed.
|
|
45
44
|
- **`onUpdate(fn)`** -- Runs after each reactive update.
|
|
46
45
|
- **`onErrorCaptured(fn)`** -- Captures errors thrown by descendant components.
|
|
@@ -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":"24b8d196-1","name":"lifecycle.ts"},{"uid":"24b8d196-3","name":"component.ts"},{"uid":"24b8d196-5","name":"context.ts"},{"uid":"24b8d196-7","name":"h.ts"},{"uid":"24b8d196-9","name":"dynamic.ts"},{"uid":"24b8d196-11","name":"telemetry.ts"},{"uid":"24b8d196-13","name":"error-boundary.ts"},{"uid":"24b8d196-15","name":"for.ts"},{"uid":"24b8d196-17","name":"lazy.ts"},{"uid":"24b8d196-19","name":"map-array.ts"},{"uid":"24b8d196-21","name":"portal.ts"},{"uid":"24b8d196-23","name":"ref.ts"},{"uid":"24b8d196-25","name":"show.ts"},{"uid":"24b8d196-27","name":"style.ts"},{"uid":"24b8d196-29","name":"suspense.ts"},{"uid":"24b8d196-31","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"24b8d196-1":{"renderedLength":1459,"gzipLength":658,"brotliLength":0,"metaUid":"24b8d196-0"},"24b8d196-3":{"renderedLength":1430,"gzipLength":679,"brotliLength":0,"metaUid":"24b8d196-2"},"24b8d196-5":{"renderedLength":1548,"gzipLength":769,"brotliLength":0,"metaUid":"24b8d196-4"},"24b8d196-7":{"renderedLength":1082,"gzipLength":597,"brotliLength":0,"metaUid":"24b8d196-6"},"24b8d196-9":{"renderedLength":381,"gzipLength":268,"brotliLength":0,"metaUid":"24b8d196-8"},"24b8d196-11":{"renderedLength":570,"gzipLength":346,"brotliLength":0,"metaUid":"24b8d196-10"},"24b8d196-13":{"renderedLength":1664,"gzipLength":843,"brotliLength":0,"metaUid":"24b8d196-12"},"24b8d196-15":{"renderedLength":700,"gzipLength":478,"brotliLength":0,"metaUid":"24b8d196-14"},"24b8d196-17":{"renderedLength":461,"gzipLength":273,"brotliLength":0,"metaUid":"24b8d196-16"},"24b8d196-19":{"renderedLength":1018,"gzipLength":571,"brotliLength":0,"metaUid":"24b8d196-18"},"24b8d196-21":{"renderedLength":818,"gzipLength":491,"brotliLength":0,"metaUid":"24b8d196-20"},"24b8d196-23":{"renderedLength":86,"gzipLength":98,"brotliLength":0,"metaUid":"24b8d196-22"},"24b8d196-25":{"renderedLength":1892,"gzipLength":810,"brotliLength":0,"metaUid":"24b8d196-24"},"24b8d196-27":{"renderedLength":1137,"gzipLength":581,"brotliLength":0,"metaUid":"24b8d196-26"},"24b8d196-29":{"renderedLength":1138,"gzipLength":627,"brotliLength":0,"metaUid":"24b8d196-28"},"24b8d196-31":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"24b8d196-30"}},"nodeMetas":{"24b8d196-0":{"id":"/src/lifecycle.ts","moduleParts":{"index.js":"24b8d196-1"},"imported":[],"importedBy":[{"uid":"24b8d196-30"},{"uid":"24b8d196-2"},{"uid":"24b8d196-12"}]},"24b8d196-2":{"id":"/src/component.ts","moduleParts":{"index.js":"24b8d196-3"},"imported":[{"uid":"24b8d196-0"}],"importedBy":[{"uid":"24b8d196-30"},{"uid":"24b8d196-12"}]},"24b8d196-4":{"id":"/src/context.ts","moduleParts":{"index.js":"24b8d196-5"},"imported":[],"importedBy":[{"uid":"24b8d196-30"}]},"24b8d196-6":{"id":"/src/h.ts","moduleParts":{"index.js":"24b8d196-7"},"imported":[],"importedBy":[{"uid":"24b8d196-30"},{"uid":"24b8d196-8"},{"uid":"24b8d196-16"},{"uid":"24b8d196-28"}]},"24b8d196-8":{"id":"/src/dynamic.ts","moduleParts":{"index.js":"24b8d196-9"},"imported":[{"uid":"24b8d196-6"}],"importedBy":[{"uid":"24b8d196-30"}]},"24b8d196-10":{"id":"/src/telemetry.ts","moduleParts":{"index.js":"24b8d196-11"},"imported":[],"importedBy":[{"uid":"24b8d196-30"},{"uid":"24b8d196-12"}]},"24b8d196-12":{"id":"/src/error-boundary.ts","moduleParts":{"index.js":"24b8d196-13"},"imported":[{"uid":"24b8d196-32"},{"uid":"24b8d196-2"},{"uid":"24b8d196-0"},{"uid":"24b8d196-10"}],"importedBy":[{"uid":"24b8d196-30"}]},"24b8d196-14":{"id":"/src/for.ts","moduleParts":{"index.js":"24b8d196-15"},"imported":[],"importedBy":[{"uid":"24b8d196-30"}]},"24b8d196-16":{"id":"/src/lazy.ts","moduleParts":{"index.js":"24b8d196-17"},"imported":[{"uid":"24b8d196-32"},{"uid":"24b8d196-6"}],"importedBy":[{"uid":"24b8d196-30"}]},"24b8d196-18":{"id":"/src/map-array.ts","moduleParts":{"index.js":"24b8d196-19"},"imported":[],"importedBy":[{"uid":"24b8d196-30"}]},"24b8d196-20":{"id":"/src/portal.ts","moduleParts":{"index.js":"24b8d196-21"},"imported":[],"importedBy":[{"uid":"24b8d196-30"}]},"24b8d196-22":{"id":"/src/ref.ts","moduleParts":{"index.js":"24b8d196-23"},"imported":[],"importedBy":[{"uid":"24b8d196-30"}]},"24b8d196-24":{"id":"/src/show.ts","moduleParts":{"index.js":"24b8d196-25"},"imported":[],"importedBy":[{"uid":"24b8d196-30"}]},"24b8d196-26":{"id":"/src/style.ts","moduleParts":{"index.js":"24b8d196-27"},"imported":[],"importedBy":[{"uid":"24b8d196-30"}]},"24b8d196-28":{"id":"/src/suspense.ts","moduleParts":{"index.js":"24b8d196-29"},"imported":[{"uid":"24b8d196-6"}],"importedBy":[{"uid":"24b8d196-30"}]},"24b8d196-30":{"id":"/src/index.ts","moduleParts":{"index.js":"24b8d196-31"},"imported":[{"uid":"24b8d196-2"},{"uid":"24b8d196-4"},{"uid":"24b8d196-8"},{"uid":"24b8d196-12"},{"uid":"24b8d196-14"},{"uid":"24b8d196-6"},{"uid":"24b8d196-16"},{"uid":"24b8d196-0"},{"uid":"24b8d196-18"},{"uid":"24b8d196-20"},{"uid":"24b8d196-22"},{"uid":"24b8d196-24"},{"uid":"24b8d196-26"},{"uid":"24b8d196-28"},{"uid":"24b8d196-10"}],"importedBy":[],"isEntry":true},"24b8d196-32":{"id":"@pyreon/reactivity","moduleParts":{},"imported":[],"importedBy":[{"uid":"24b8d196-12"},{"uid":"24b8d196-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
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
import { signal } from "@pyreon/reactivity";
|
|
2
2
|
|
|
3
3
|
//#region src/lifecycle.ts
|
|
4
|
+
const __DEV__$4 = typeof process !== "undefined" && process.env.NODE_ENV !== "production";
|
|
4
5
|
let _current = null;
|
|
5
6
|
function setCurrentHooks(hooks) {
|
|
6
7
|
_current = hooks;
|
|
7
8
|
}
|
|
9
|
+
function warnOutsideSetup(hookName) {
|
|
10
|
+
if (__DEV__$4 && !_current) console.warn(`[Pyreon] ${hookName}() called outside component setup. Lifecycle hooks must be called synchronously during a component's setup function.`);
|
|
11
|
+
}
|
|
8
12
|
/**
|
|
9
13
|
* Register a callback to run after the component is mounted to the DOM.
|
|
10
14
|
* Optionally return a cleanup function — it will run on unmount.
|
|
11
15
|
*/
|
|
12
16
|
function onMount(fn) {
|
|
17
|
+
warnOutsideSetup("onMount");
|
|
13
18
|
_current?.mount.push(fn);
|
|
14
19
|
}
|
|
15
20
|
/**
|
|
16
21
|
* Register a callback to run when the component is removed from the DOM.
|
|
17
22
|
*/
|
|
18
23
|
function onUnmount(fn) {
|
|
24
|
+
warnOutsideSetup("onUnmount");
|
|
19
25
|
_current?.unmount.push(fn);
|
|
20
26
|
}
|
|
21
27
|
/**
|
|
22
28
|
* Register a callback to run after each reactive update.
|
|
23
29
|
*/
|
|
24
30
|
function onUpdate(fn) {
|
|
31
|
+
warnOutsideSetup("onUpdate");
|
|
25
32
|
_current?.update.push(fn);
|
|
26
33
|
}
|
|
27
34
|
/**
|
|
@@ -38,6 +45,7 @@ function onUpdate(fn) {
|
|
|
38
45
|
* })
|
|
39
46
|
*/
|
|
40
47
|
function onErrorCaptured(fn) {
|
|
48
|
+
warnOutsideSetup("onErrorCaptured");
|
|
41
49
|
_current?.error.push(fn);
|
|
42
50
|
}
|
|
43
51
|
|
|
@@ -120,13 +128,16 @@ function setContextStackProvider(fn) {
|
|
|
120
128
|
function getStack() {
|
|
121
129
|
return _stackProvider();
|
|
122
130
|
}
|
|
123
|
-
const __DEV__ = typeof process !== "undefined" && process.env.NODE_ENV !== "production";
|
|
131
|
+
const __DEV__$3 = typeof process !== "undefined" && process.env.NODE_ENV !== "production";
|
|
124
132
|
function pushContext(values) {
|
|
125
133
|
getStack().push(values);
|
|
126
134
|
}
|
|
127
135
|
function popContext() {
|
|
128
136
|
const stack = getStack();
|
|
129
|
-
if (__DEV__ && stack.length === 0)
|
|
137
|
+
if (__DEV__$3 && stack.length === 0) {
|
|
138
|
+
console.warn("[Pyreon] popContext() called on an empty context stack. This likely indicates a missing Provider.");
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
130
141
|
stack.pop();
|
|
131
142
|
}
|
|
132
143
|
/**
|
|
@@ -188,8 +199,10 @@ function flattenChildren(children) {
|
|
|
188
199
|
|
|
189
200
|
//#endregion
|
|
190
201
|
//#region src/dynamic.ts
|
|
202
|
+
const __DEV__$2 = typeof process !== "undefined" && process.env.NODE_ENV !== "production";
|
|
191
203
|
function Dynamic(props) {
|
|
192
204
|
const { component, ...rest } = props;
|
|
205
|
+
if (__DEV__$2 && !component) console.warn("[Pyreon] <Dynamic> received a falsy `component` prop. Nothing will be rendered.");
|
|
193
206
|
if (!component) return null;
|
|
194
207
|
return h(component, rest);
|
|
195
208
|
}
|
|
@@ -219,6 +232,7 @@ function reportError(ctx) {
|
|
|
219
232
|
|
|
220
233
|
//#endregion
|
|
221
234
|
//#region src/error-boundary.ts
|
|
235
|
+
const __DEV__$1 = typeof process !== "undefined" && process.env.NODE_ENV !== "production";
|
|
222
236
|
/**
|
|
223
237
|
* ErrorBoundary — catches errors thrown by child components and renders a
|
|
224
238
|
* fallback UI instead of crashing the whole tree.
|
|
@@ -243,6 +257,7 @@ function reportError(ctx) {
|
|
|
243
257
|
* </ErrorBoundary>
|
|
244
258
|
*/
|
|
245
259
|
function ErrorBoundary(props) {
|
|
260
|
+
if (__DEV__$1 && typeof props.fallback !== "function") console.warn(`[Pyreon] <ErrorBoundary> expects \`fallback\` to be a function: (err, reset) => VNode. Received ${typeof props.fallback}.`);
|
|
246
261
|
const error = signal(null);
|
|
247
262
|
const reset = () => error.set(null);
|
|
248
263
|
const handler = (err) => {
|
|
@@ -443,8 +458,66 @@ function Switch(props) {
|
|
|
443
458
|
}
|
|
444
459
|
const MatchSymbol = Symbol("pyreon.Match");
|
|
445
460
|
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/style.ts
|
|
463
|
+
const CSS_UNITLESS = new Set([
|
|
464
|
+
"animationIterationCount",
|
|
465
|
+
"aspectRatio",
|
|
466
|
+
"borderImageOutset",
|
|
467
|
+
"borderImageSlice",
|
|
468
|
+
"borderImageWidth",
|
|
469
|
+
"boxFlex",
|
|
470
|
+
"boxFlexGroup",
|
|
471
|
+
"boxOrdinalGroup",
|
|
472
|
+
"columnCount",
|
|
473
|
+
"columns",
|
|
474
|
+
"flex",
|
|
475
|
+
"flexGrow",
|
|
476
|
+
"flexPositive",
|
|
477
|
+
"flexShrink",
|
|
478
|
+
"flexNegative",
|
|
479
|
+
"flexOrder",
|
|
480
|
+
"gridArea",
|
|
481
|
+
"gridRow",
|
|
482
|
+
"gridRowEnd",
|
|
483
|
+
"gridRowSpan",
|
|
484
|
+
"gridRowStart",
|
|
485
|
+
"gridColumn",
|
|
486
|
+
"gridColumnEnd",
|
|
487
|
+
"gridColumnSpan",
|
|
488
|
+
"gridColumnStart",
|
|
489
|
+
"fontWeight",
|
|
490
|
+
"lineClamp",
|
|
491
|
+
"lineHeight",
|
|
492
|
+
"opacity",
|
|
493
|
+
"order",
|
|
494
|
+
"orphans",
|
|
495
|
+
"scale",
|
|
496
|
+
"tabSize",
|
|
497
|
+
"widows",
|
|
498
|
+
"zIndex",
|
|
499
|
+
"zoom",
|
|
500
|
+
"fillOpacity",
|
|
501
|
+
"floodOpacity",
|
|
502
|
+
"stopOpacity",
|
|
503
|
+
"strokeDasharray",
|
|
504
|
+
"strokeDashoffset",
|
|
505
|
+
"strokeMiterlimit",
|
|
506
|
+
"strokeOpacity",
|
|
507
|
+
"strokeWidth"
|
|
508
|
+
]);
|
|
509
|
+
/** Convert a camelCase CSS property name to kebab-case. */
|
|
510
|
+
function toKebabCase(str) {
|
|
511
|
+
return str.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
|
512
|
+
}
|
|
513
|
+
/** Normalize a style value — appends "px" to numbers for non-unitless properties. */
|
|
514
|
+
function normalizeStyleValue(key, value) {
|
|
515
|
+
return typeof value === "number" && !CSS_UNITLESS.has(key) ? `${value}px` : String(value);
|
|
516
|
+
}
|
|
517
|
+
|
|
446
518
|
//#endregion
|
|
447
519
|
//#region src/suspense.ts
|
|
520
|
+
const __DEV__ = typeof process !== "undefined" && process.env.NODE_ENV !== "production";
|
|
448
521
|
/**
|
|
449
522
|
* Suspense — shows `fallback` while a lazy child component is still loading.
|
|
450
523
|
*
|
|
@@ -459,6 +532,7 @@ const MatchSymbol = Symbol("pyreon.Match");
|
|
|
459
532
|
* <Suspense fallback={<Spinner />}><Page /></Suspense>
|
|
460
533
|
*/
|
|
461
534
|
function Suspense(props) {
|
|
535
|
+
if (__DEV__ && props.fallback === void 0) console.warn("[Pyreon] <Suspense> is missing a `fallback` prop. Provide fallback UI to show while loading.");
|
|
462
536
|
return h(Fragment, null, () => {
|
|
463
537
|
const ch = props.children;
|
|
464
538
|
const childNode = typeof ch === "function" ? ch() : ch;
|
|
@@ -471,5 +545,5 @@ function Suspense(props) {
|
|
|
471
545
|
}
|
|
472
546
|
|
|
473
547
|
//#endregion
|
|
474
|
-
export { Dynamic, EMPTY_PROPS, ErrorBoundary, For, ForSymbol, Fragment, Match, MatchSymbol, Portal, PortalSymbol, Show, Suspense, Switch, createContext, createRef, defineComponent, dispatchToErrorBoundary, h, lazy, mapArray, onErrorCaptured, onMount, onUnmount, onUpdate, popContext, propagateError, pushContext, registerErrorHandler, reportError, runWithHooks, setContextStackProvider, useContext, withContext };
|
|
548
|
+
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, pushContext, registerErrorHandler, reportError, runWithHooks, setContextStackProvider, toKebabCase, useContext, withContext };
|
|
475
549
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"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/suspense.ts"],"sourcesContent":["import type { CleanupFn, LifecycleHooks } from \"./types\"\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\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 */\nexport function onMount(fn: () => CleanupFn | undefined) {\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 _current?.unmount.push(fn)\n}\n\n/**\n * Register a callback to run after each reactive update.\n */\nexport function onUpdate(fn: () => void) {\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 _current?.error.push(fn)\n}\n","import { setCurrentHooks } from \"./lifecycle\"\nimport type { ComponentFn, LifecycleHooks, Props, VNode } 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: VNode | null; hooks: LifecycleHooks } {\n const hooks: LifecycleHooks = { mount: [], unmount: [], update: [], error: [] }\n setCurrentHooks(hooks)\n let vnode: VNode | null = 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\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 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 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\n// biome-ignore lint/suspicious/noExplicitAny: accepts any component function for generic components like For<T>\nexport function h(\n type: string | ((props: any) => VNode | null) | 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\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 (!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\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 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","import { Fragment, h } from \"./h\"\nimport type { Props, VNode, VNodeChild } from \"./types\"\n\n/** Internal marker attached to lazy()-wrapped components */\nexport type LazyComponent<P extends Props = Props> = ((props: P) => VNode | null) & {\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 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":";;;AAIA,IAAI,WAAkC;AAEtC,SAAgB,gBAAgB,OAA8B;AAC5D,YAAW;;;;;;AAWb,SAAgB,QAAQ,IAAiC;AACvD,WAAU,MAAM,KAAK,GAAG;;;;;AAM1B,SAAgB,UAAU,IAAgB;AACxC,WAAU,QAAQ,KAAK,GAAG;;;;;AAM5B,SAAgB,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AAkB,UAAiD;AAC1E,KAAI,MAAM,QAAQ,SAAS,CAAE,QAAO;AACpC,KAAI,YAAY,KAAM,QAAO,CAAC,SAAS;AACvC,QAAO,EAAE;;AAGX,SAAgB,OAAO,OAAkC;AAEvD,eAA8B;EAC5B,MAAM,WAAW,kBAAkB,MAAM,SAAS;AAElD,OAAK,MAAM,UAAU,UAAU;AAC7B,OAAI,CAAC,aAAa,OAAO,CAAE;AAE3B,OADmB,OAAO,MACX,MAAM,CAAE,QAAO,qBAAqB,OAAO;;AAG5D,SAAQ,MAAM,YAAY;;;AAK9B,MAAa,cAA6B,OAAO,eAAe;;;;;;;;;;;;;;;;;ACtFhE,SAAgB,SAAS,OAA+D;AACtF,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/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, VNode } 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: VNode | null; hooks: LifecycleHooks } {\n const hooks: LifecycleHooks = { mount: [], unmount: [], update: [], error: [] }\n setCurrentHooks(hooks)\n let vnode: VNode | null = 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\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 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) => VNode | null) | 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) => VNode | null) & {\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,WAA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,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\n// biome-ignore lint/suspicious/noExplicitAny: accepts any component function for generic components like For<T>\nexport function h(\n type: string | ((props: any) => VNode | null) | 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\"\ntype StyleValue = string | Partial<CSSStyleDeclaration>\n\n/** Common HTML attributes accepted by all Pyreon elements */\ninterface PyreonHTMLAttributes {\n // Identity\n id?: string\n class?: string | (() => string)\n className?: string | (() => string)\n style?: StyleValue | (() => StyleValue)\n // pyreon-specific directives\n \"n-show\"?: boolean | (() => boolean)\n // Accessible\n role?: string\n tabIndex?: number | (() => number)\n title?: string\n lang?: string\n dir?: \"ltr\" | \"rtl\" | \"auto\"\n hidden?: boolean | (() => boolean)\n draggable?: Booleanish\n // ARIA\n \"aria-label\"?: string | (() => string)\n \"aria-hidden\"?: Booleanish | (() => Booleanish)\n \"aria-disabled\"?: Booleanish | (() => Booleanish)\n \"aria-expanded\"?: Booleanish | (() => Booleanish)\n \"aria-selected\"?: Booleanish | (() => Booleanish)\n \"aria-checked\"?: Booleanish | \"mixed\" | (() => Booleanish | \"mixed\")\n \"aria-current\"?: Booleanish | \"page\" | \"step\" | \"location\" | \"date\" | \"time\"\n \"aria-live\"?: \"off\" | \"assertive\" | \"polite\"\n \"aria-atomic\"?: Booleanish\n \"aria-busy\"?: Booleanish\n \"aria-controls\"?: string\n \"aria-describedby\"?: string\n \"aria-labelledby\"?: string\n \"aria-placeholder\"?: string\n \"aria-required\"?: Booleanish | (() => Booleanish)\n \"aria-invalid\"?: Booleanish | \"grammar\" | \"spelling\"\n \"aria-valuemin\"?: number\n \"aria-valuemax\"?: number\n \"aria-valuenow\"?: number\n \"aria-valuetext\"?: string\n \"aria-haspopup\"?: Booleanish | \"menu\" | \"listbox\" | \"tree\" | \"grid\" | \"dialog\"\n \"aria-posinset\"?: number\n \"aria-setsize\"?: number\n \"aria-level\"?: number\n \"aria-multiline\"?: Booleanish\n \"aria-multiselectable\"?: Booleanish\n \"aria-orientation\"?: \"horizontal\" | \"vertical\"\n \"aria-readonly\"?: Booleanish | (() => Booleanish)\n \"aria-sort\"?: \"none\" | \"ascending\" | \"descending\" | \"other\"\n \"aria-autocomplete\"?: \"none\" | \"inline\" | \"list\" | \"both\"\n \"aria-colcount\"?: number\n \"aria-colindex\"?: number\n \"aria-colspan\"?: number\n \"aria-rowcount\"?: number\n \"aria-rowindex\"?: number\n \"aria-rowspan\"?: number\n // DOM lifecycle ref — object ref or callback ref\n ref?: { current: unknown } | ((el: Element | null) => void)\n // Key for list reconciliation\n key?: string | number\n // Children — allows null, undefined, boolean in JSX children positions\n children?: VNodeChild | VNodeChild[]\n // innerHTML\n innerHTML?: string\n dangerouslySetInnerHTML?: { __html: string }\n // Events\n onClick?: (e: MouseEvent) => void\n onDblClick?: (e: MouseEvent) => void\n onMouseDown?: (e: MouseEvent) => void\n onMouseUp?: (e: MouseEvent) => void\n onMouseEnter?: (e: MouseEvent) => void\n onMouseLeave?: (e: MouseEvent) => void\n onMouseMove?: (e: MouseEvent) => void\n onMouseOver?: (e: MouseEvent) => void\n onMouseOut?: (e: MouseEvent) => void\n onContextMenu?: (e: MouseEvent) => void\n onKeyDown?: (e: KeyboardEvent) => void\n onKeyUp?: (e: KeyboardEvent) => void\n onKeyPress?: (e: KeyboardEvent) => void\n onFocus?: (e: FocusEvent) => void\n onBlur?: (e: FocusEvent) => void\n onChange?: (e: Event) => void\n onInput?: (e: InputEvent) => void\n onSubmit?: (e: SubmitEvent) => void\n onReset?: (e: Event) => void\n onScroll?: (e: Event) => void\n onWheel?: (e: WheelEvent) => void\n onDragStart?: (e: DragEvent) => void\n onDragEnd?: (e: DragEvent) => void\n onDragOver?: (e: DragEvent) => void\n onDragEnter?: (e: DragEvent) => void\n onDragLeave?: (e: DragEvent) => void\n onDrop?: (e: DragEvent) => void\n onTouchStart?: (e: TouchEvent) => void\n onTouchEnd?: (e: TouchEvent) => void\n onTouchMove?: (e: TouchEvent) => void\n onPointerDown?: (e: PointerEvent) => void\n onPointerUp?: (e: PointerEvent) => void\n onPointerMove?: (e: PointerEvent) => void\n onPointerEnter?: (e: PointerEvent) => void\n onPointerLeave?: (e: PointerEvent) => void\n onPointerCancel?: (e: PointerEvent) => void\n onPointerOver?: (e: PointerEvent) => void\n onPointerOut?: (e: PointerEvent) => void\n onTransitionEnd?: (e: TransitionEvent) => void\n onAnimationStart?: (e: AnimationEvent) => void\n onAnimationEnd?: (e: AnimationEvent) => void\n onAnimationIteration?: (e: AnimationEvent) => void\n onLoad?: (e: Event) => void\n onError?: (e: Event | string) => void\n onAbort?: (e: Event) => void\n onSelect?: (e: Event) => void\n onCopy?: (e: ClipboardEvent) => void\n onCut?: (e: ClipboardEvent) => void\n onPaste?: (e: ClipboardEvent) => void\n // Catch-all for data-* and other arbitrary attributes\n [key: string]: unknown\n}\n\n/** Attributes specific to form inputs */\ninterface InputAttributes extends PyreonHTMLAttributes {\n type?: string | (() => string)\n value?: string | number | (() => string | number)\n defaultValue?: string | number\n checked?: boolean | (() => boolean)\n defaultChecked?: boolean\n placeholder?: string | (() => string)\n disabled?: boolean | (() => boolean)\n readOnly?: boolean\n required?: boolean | (() => boolean)\n min?: string | number\n max?: string | number\n step?: string | number\n minLength?: number\n maxLength?: number\n pattern?: string\n multiple?: boolean\n name?: string\n accept?: string\n autoComplete?: string\n autoFocus?: boolean\n form?: string\n list?: string\n size?: number\n src?: string | (() => string)\n alt?: string\n width?: number | string\n height?: number | string\n}\n\ninterface AnchorAttributes extends PyreonHTMLAttributes {\n href?: string | (() => string)\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | string\n rel?: string\n download?: string | boolean\n}\n\ninterface ButtonAttributes extends PyreonHTMLAttributes {\n type?: \"button\" | \"submit\" | \"reset\"\n disabled?: boolean | (() => boolean)\n name?: string\n value?: string\n form?: string\n formAction?: string\n formMethod?: string\n formEncType?: string\n formNoValidate?: boolean\n formTarget?: string\n}\n\ninterface TextareaAttributes extends PyreonHTMLAttributes {\n value?: string | (() => string)\n defaultValue?: string\n placeholder?: string | (() => string)\n disabled?: boolean | (() => boolean)\n readOnly?: boolean\n required?: boolean | (() => boolean)\n rows?: number\n cols?: number\n minLength?: number\n maxLength?: number\n name?: string\n autoFocus?: boolean\n form?: string\n wrap?: \"hard\" | \"soft\"\n}\n\ninterface SelectAttributes extends PyreonHTMLAttributes {\n value?: string | string[] | (() => string | string[])\n defaultValue?: string | string[]\n disabled?: boolean | (() => boolean)\n required?: boolean | (() => boolean)\n multiple?: boolean\n name?: string\n size?: number\n form?: string\n autoFocus?: boolean\n}\n\ninterface OptionAttributes extends PyreonHTMLAttributes {\n value?: string | number | (() => string | number)\n disabled?: boolean | (() => boolean)\n selected?: boolean | (() => boolean)\n label?: string\n}\n\ninterface FormAttributes extends PyreonHTMLAttributes {\n action?: string\n method?: \"get\" | \"post\"\n encType?: string\n noValidate?: boolean\n target?: string\n name?: string\n autoComplete?: string\n}\n\ninterface ImgAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n alt?: string | (() => string)\n width?: number | string | (() => number | string)\n height?: number | string | (() => number | string)\n loading?: \"lazy\" | \"eager\"\n decoding?: \"auto\" | \"async\" | \"sync\"\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n referrerPolicy?: string\n srcSet?: string\n sizes?: string\n}\n\ninterface VideoAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n width?: number | string\n height?: number | string\n controls?: boolean\n autoPlay?: boolean\n muted?: boolean\n loop?: boolean\n poster?: string\n preload?: \"none\" | \"metadata\" | \"auto\"\n playsInline?: boolean\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n}\n\ninterface AudioAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n controls?: boolean\n autoPlay?: boolean\n muted?: boolean\n loop?: boolean\n preload?: \"none\" | \"metadata\" | \"auto\"\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n}\n\ninterface LabelAttributes extends PyreonHTMLAttributes {\n htmlFor?: string\n for?: string\n form?: string\n}\n\ninterface ThAttributes extends PyreonHTMLAttributes {\n colSpan?: number\n rowSpan?: number\n scope?: \"col\" | \"row\" | \"colgroup\" | \"rowgroup\"\n abbr?: string\n headers?: string\n}\n\ninterface TdAttributes extends PyreonHTMLAttributes {\n colSpan?: number\n rowSpan?: number\n headers?: string\n}\n\ninterface ColAttributes extends PyreonHTMLAttributes {\n span?: number\n}\n\ninterface IframeAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n width?: number | string\n height?: number | string\n allow?: string\n allowFullScreen?: boolean\n loading?: \"lazy\" | \"eager\"\n name?: string\n sandbox?: string\n referrerPolicy?: string\n title?: string\n}\n\ninterface LinkAttributes extends PyreonHTMLAttributes {\n href?: string | (() => string)\n rel?: string\n type?: string\n as?: string\n media?: string\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n integrity?: string\n referrerPolicy?: string\n}\n\ninterface MetaAttributes extends PyreonHTMLAttributes {\n name?: string\n content?: string | (() => string)\n httpEquiv?: string\n charset?: string\n property?: string\n}\n\ninterface ScriptAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n type?: string\n async?: boolean\n defer?: boolean\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n integrity?: string\n noModule?: boolean\n referrerPolicy?: string\n}\n\ninterface SourceAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n type?: string\n srcSet?: string\n sizes?: string\n media?: string\n}\n\ninterface ProgressAttributes extends PyreonHTMLAttributes {\n value?: number | (() => number)\n max?: number\n}\n\ninterface MeterAttributes extends PyreonHTMLAttributes {\n value?: number | (() => number)\n min?: number\n max?: number\n low?: number\n high?: number\n optimum?: number\n}\n\ninterface DetailsAttributes extends PyreonHTMLAttributes {\n open?: boolean | (() => boolean)\n}\n\ninterface DialogAttributes extends PyreonHTMLAttributes {\n open?: boolean | (() => boolean)\n}\n\ninterface OlAttributes extends PyreonHTMLAttributes {\n start?: number\n reversed?: boolean\n type?: \"1\" | \"a\" | \"A\" | \"i\" | \"I\"\n}\n\ninterface SvgAttributes extends PyreonHTMLAttributes {\n viewBox?: string\n xmlns?: string\n fill?: string | (() => string)\n stroke?: string | (() => string)\n \"stroke-width\"?: string | number\n \"stroke-linecap\"?: \"butt\" | \"round\" | \"square\"\n \"stroke-linejoin\"?: \"miter\" | \"round\" | \"bevel\"\n \"fill-rule\"?: \"nonzero\" | \"evenodd\"\n \"clip-rule\"?: \"nonzero\" | \"evenodd\"\n \"clip-path\"?: string\n d?: string\n cx?: string | number\n cy?: string | number\n r?: string | number\n rx?: string | number\n ry?: string | number\n x?: string | number\n y?: string | number\n x1?: string | number\n y1?: string | number\n x2?: string | number\n y2?: string | number\n width?: string | number\n height?: string | number\n transform?: string | (() => string)\n opacity?: string | number | (() => string | number)\n points?: string\n \"font-size\"?: string | number\n \"text-anchor\"?: \"start\" | \"middle\" | \"end\"\n \"dominant-baseline\"?: string\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 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\n }\n }\n}\n"],"mappings":";;AAGA,MAAa,WAA0B,OAAO,kBAAkB;;;;;;;;;AAUhE,MAAa,cAAqB,EAAE;AAoBpC,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;;;;;;;;;;;;ACrDT,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) => VNode | null) | 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\"\ntype CSSProperties = { [K in keyof CSSStyleDeclaration]?: string | number }\ntype StyleValue = string | CSSProperties\n\n/** Common HTML attributes accepted by all Pyreon elements */\ninterface PyreonHTMLAttributes {\n // Identity\n id?: string\n class?: string | (() => string)\n className?: string | (() => string)\n style?: StyleValue | (() => StyleValue)\n // pyreon-specific directives\n \"n-show\"?: boolean | (() => boolean)\n // Accessible\n role?: string\n tabIndex?: number | (() => number)\n title?: string\n lang?: string\n dir?: \"ltr\" | \"rtl\" | \"auto\"\n hidden?: boolean | (() => boolean)\n draggable?: Booleanish\n // ARIA\n \"aria-label\"?: string | (() => string)\n \"aria-hidden\"?: Booleanish | (() => Booleanish)\n \"aria-disabled\"?: Booleanish | (() => Booleanish)\n \"aria-expanded\"?: Booleanish | (() => Booleanish)\n \"aria-selected\"?: Booleanish | (() => Booleanish)\n \"aria-checked\"?: Booleanish | \"mixed\" | (() => Booleanish | \"mixed\")\n \"aria-current\"?: Booleanish | \"page\" | \"step\" | \"location\" | \"date\" | \"time\"\n \"aria-live\"?: \"off\" | \"assertive\" | \"polite\"\n \"aria-atomic\"?: Booleanish\n \"aria-busy\"?: Booleanish\n \"aria-controls\"?: string\n \"aria-describedby\"?: string\n \"aria-labelledby\"?: string\n \"aria-placeholder\"?: string\n \"aria-required\"?: Booleanish | (() => Booleanish)\n \"aria-invalid\"?: Booleanish | \"grammar\" | \"spelling\"\n \"aria-valuemin\"?: number\n \"aria-valuemax\"?: number\n \"aria-valuenow\"?: number\n \"aria-valuetext\"?: string\n \"aria-haspopup\"?: Booleanish | \"menu\" | \"listbox\" | \"tree\" | \"grid\" | \"dialog\"\n \"aria-posinset\"?: number\n \"aria-setsize\"?: number\n \"aria-level\"?: number\n \"aria-multiline\"?: Booleanish\n \"aria-multiselectable\"?: Booleanish\n \"aria-orientation\"?: \"horizontal\" | \"vertical\"\n \"aria-readonly\"?: Booleanish | (() => Booleanish)\n \"aria-sort\"?: \"none\" | \"ascending\" | \"descending\" | \"other\"\n \"aria-autocomplete\"?: \"none\" | \"inline\" | \"list\" | \"both\"\n \"aria-colcount\"?: number\n \"aria-colindex\"?: number\n \"aria-colspan\"?: number\n \"aria-rowcount\"?: number\n \"aria-rowindex\"?: number\n \"aria-rowspan\"?: number\n // DOM lifecycle ref — object ref or callback ref\n ref?: { current: unknown } | ((el: Element | null) => void)\n // Key for list reconciliation\n key?: string | number\n // Children — allows null, undefined, boolean in JSX children positions\n children?: VNodeChild | VNodeChild[]\n // innerHTML\n innerHTML?: string\n dangerouslySetInnerHTML?: { __html: string }\n // Events\n onClick?: (e: MouseEvent) => void\n onDblClick?: (e: MouseEvent) => void\n onMouseDown?: (e: MouseEvent) => void\n onMouseUp?: (e: MouseEvent) => void\n onMouseEnter?: (e: MouseEvent) => void\n onMouseLeave?: (e: MouseEvent) => void\n onMouseMove?: (e: MouseEvent) => void\n onMouseOver?: (e: MouseEvent) => void\n onMouseOut?: (e: MouseEvent) => void\n onContextMenu?: (e: MouseEvent) => void\n onKeyDown?: (e: KeyboardEvent) => void\n onKeyUp?: (e: KeyboardEvent) => void\n onKeyPress?: (e: KeyboardEvent) => void\n onFocus?: (e: FocusEvent) => void\n onBlur?: (e: FocusEvent) => void\n onChange?: (e: Event) => void\n onInput?: (e: InputEvent) => void\n onSubmit?: (e: SubmitEvent) => void\n onReset?: (e: Event) => void\n onScroll?: (e: Event) => void\n onWheel?: (e: WheelEvent) => void\n onDragStart?: (e: DragEvent) => void\n onDragEnd?: (e: DragEvent) => void\n onDragOver?: (e: DragEvent) => void\n onDragEnter?: (e: DragEvent) => void\n onDragLeave?: (e: DragEvent) => void\n onDrop?: (e: DragEvent) => void\n onTouchStart?: (e: TouchEvent) => void\n onTouchEnd?: (e: TouchEvent) => void\n onTouchMove?: (e: TouchEvent) => void\n onPointerDown?: (e: PointerEvent) => void\n onPointerUp?: (e: PointerEvent) => void\n onPointerMove?: (e: PointerEvent) => void\n onPointerEnter?: (e: PointerEvent) => void\n onPointerLeave?: (e: PointerEvent) => void\n onPointerCancel?: (e: PointerEvent) => void\n onPointerOver?: (e: PointerEvent) => void\n onPointerOut?: (e: PointerEvent) => void\n onTransitionEnd?: (e: TransitionEvent) => void\n onAnimationStart?: (e: AnimationEvent) => void\n onAnimationEnd?: (e: AnimationEvent) => void\n onAnimationIteration?: (e: AnimationEvent) => void\n onLoad?: (e: Event) => void\n onError?: (e: Event | string) => void\n onAbort?: (e: Event) => void\n onSelect?: (e: Event) => void\n onCopy?: (e: ClipboardEvent) => void\n onCut?: (e: ClipboardEvent) => void\n onPaste?: (e: ClipboardEvent) => void\n // Catch-all for data-* and other arbitrary attributes\n [key: string]: unknown\n}\n\n/** Attributes specific to form inputs */\ninterface InputAttributes extends PyreonHTMLAttributes {\n type?: string | (() => string)\n value?: string | number | (() => string | number)\n defaultValue?: string | number\n checked?: boolean | (() => boolean)\n defaultChecked?: boolean\n placeholder?: string | (() => string)\n disabled?: boolean | (() => boolean)\n readOnly?: boolean\n required?: boolean | (() => boolean)\n min?: string | number\n max?: string | number\n step?: string | number\n minLength?: number\n maxLength?: number\n pattern?: string\n multiple?: boolean\n name?: string\n accept?: string\n autoComplete?: string\n autoFocus?: boolean\n form?: string\n list?: string\n size?: number\n src?: string | (() => string)\n alt?: string\n width?: number | string\n height?: number | string\n}\n\ninterface AnchorAttributes extends PyreonHTMLAttributes {\n href?: string | (() => string)\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | string\n rel?: string\n download?: string | boolean\n}\n\ninterface ButtonAttributes extends PyreonHTMLAttributes {\n type?: \"button\" | \"submit\" | \"reset\"\n disabled?: boolean | (() => boolean)\n name?: string\n value?: string\n form?: string\n formAction?: string\n formMethod?: string\n formEncType?: string\n formNoValidate?: boolean\n formTarget?: string\n}\n\ninterface TextareaAttributes extends PyreonHTMLAttributes {\n value?: string | (() => string)\n defaultValue?: string\n placeholder?: string | (() => string)\n disabled?: boolean | (() => boolean)\n readOnly?: boolean\n required?: boolean | (() => boolean)\n rows?: number\n cols?: number\n minLength?: number\n maxLength?: number\n name?: string\n autoFocus?: boolean\n form?: string\n wrap?: \"hard\" | \"soft\"\n}\n\ninterface SelectAttributes extends PyreonHTMLAttributes {\n value?: string | string[] | (() => string | string[])\n defaultValue?: string | string[]\n disabled?: boolean | (() => boolean)\n required?: boolean | (() => boolean)\n multiple?: boolean\n name?: string\n size?: number\n form?: string\n autoFocus?: boolean\n}\n\ninterface OptionAttributes extends PyreonHTMLAttributes {\n value?: string | number | (() => string | number)\n disabled?: boolean | (() => boolean)\n selected?: boolean | (() => boolean)\n label?: string\n}\n\ninterface FormAttributes extends PyreonHTMLAttributes {\n action?: string\n method?: \"get\" | \"post\"\n encType?: string\n noValidate?: boolean\n target?: string\n name?: string\n autoComplete?: string\n}\n\ninterface ImgAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n alt?: string | (() => string)\n width?: number | string | (() => number | string)\n height?: number | string | (() => number | string)\n loading?: \"lazy\" | \"eager\"\n decoding?: \"auto\" | \"async\" | \"sync\"\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n referrerPolicy?: string\n srcSet?: string\n sizes?: string\n}\n\ninterface VideoAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n width?: number | string\n height?: number | string\n controls?: boolean\n autoPlay?: boolean\n muted?: boolean\n loop?: boolean\n poster?: string\n preload?: \"none\" | \"metadata\" | \"auto\"\n playsInline?: boolean\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n}\n\ninterface AudioAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n controls?: boolean\n autoPlay?: boolean\n muted?: boolean\n loop?: boolean\n preload?: \"none\" | \"metadata\" | \"auto\"\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n}\n\ninterface LabelAttributes extends PyreonHTMLAttributes {\n htmlFor?: string\n for?: string\n form?: string\n}\n\ninterface ThAttributes extends PyreonHTMLAttributes {\n colSpan?: number\n rowSpan?: number\n scope?: \"col\" | \"row\" | \"colgroup\" | \"rowgroup\"\n abbr?: string\n headers?: string\n}\n\ninterface TdAttributes extends PyreonHTMLAttributes {\n colSpan?: number\n rowSpan?: number\n headers?: string\n}\n\ninterface ColAttributes extends PyreonHTMLAttributes {\n span?: number\n}\n\ninterface IframeAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n width?: number | string\n height?: number | string\n allow?: string\n allowFullScreen?: boolean\n loading?: \"lazy\" | \"eager\"\n name?: string\n sandbox?: string\n referrerPolicy?: string\n title?: string\n}\n\ninterface LinkAttributes extends PyreonHTMLAttributes {\n href?: string | (() => string)\n rel?: string\n type?: string\n as?: string\n media?: string\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n integrity?: string\n referrerPolicy?: string\n}\n\ninterface MetaAttributes extends PyreonHTMLAttributes {\n name?: string\n content?: string | (() => string)\n httpEquiv?: string\n charset?: string\n property?: string\n}\n\ninterface ScriptAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n type?: string\n async?: boolean\n defer?: boolean\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n integrity?: string\n noModule?: boolean\n referrerPolicy?: string\n}\n\ninterface SourceAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n type?: string\n srcSet?: string\n sizes?: string\n media?: string\n}\n\ninterface ProgressAttributes extends PyreonHTMLAttributes {\n value?: number | (() => number)\n max?: number\n}\n\ninterface MeterAttributes extends PyreonHTMLAttributes {\n value?: number | (() => number)\n min?: number\n max?: number\n low?: number\n high?: number\n optimum?: number\n}\n\ninterface DetailsAttributes extends PyreonHTMLAttributes {\n open?: boolean | (() => boolean)\n}\n\ninterface DialogAttributes extends PyreonHTMLAttributes {\n open?: boolean | (() => boolean)\n}\n\ninterface OlAttributes extends PyreonHTMLAttributes {\n start?: number\n reversed?: boolean\n type?: \"1\" | \"a\" | \"A\" | \"i\" | \"I\"\n}\n\ninterface SvgAttributes extends PyreonHTMLAttributes {\n viewBox?: string\n xmlns?: string\n fill?: string | (() => string)\n stroke?: string | (() => string)\n \"stroke-width\"?: string | number\n \"stroke-linecap\"?: \"butt\" | \"round\" | \"square\"\n \"stroke-linejoin\"?: \"miter\" | \"round\" | \"bevel\"\n \"fill-rule\"?: \"nonzero\" | \"evenodd\"\n \"clip-rule\"?: \"nonzero\" | \"evenodd\"\n \"clip-path\"?: string\n d?: string\n cx?: string | number\n cy?: string | number\n r?: string | number\n rx?: string | number\n ry?: string | number\n x?: string | number\n y?: string | number\n x1?: string | number\n y1?: string | number\n x2?: string | number\n y2?: string | number\n width?: string | number\n height?: string | number\n transform?: string | (() => string)\n opacity?: string | number | (() => string | number)\n points?: string\n \"font-size\"?: string | number\n \"text-anchor\"?: \"start\" | \"middle\" | \"end\"\n \"dominant-baseline\"?: string\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\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"}
|
package/lib/jsx-runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-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\n// biome-ignore lint/suspicious/noExplicitAny: accepts any component function for generic components like For<T>\nexport function h(\n type: string | ((props: any) => VNode | null) | 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\"\ntype StyleValue = string | Partial<CSSStyleDeclaration>\n\n/** Common HTML attributes accepted by all Pyreon elements */\ninterface PyreonHTMLAttributes {\n // Identity\n id?: string\n class?: string | (() => string)\n className?: string | (() => string)\n style?: StyleValue | (() => StyleValue)\n // pyreon-specific directives\n \"n-show\"?: boolean | (() => boolean)\n // Accessible\n role?: string\n tabIndex?: number | (() => number)\n title?: string\n lang?: string\n dir?: \"ltr\" | \"rtl\" | \"auto\"\n hidden?: boolean | (() => boolean)\n draggable?: Booleanish\n // ARIA\n \"aria-label\"?: string | (() => string)\n \"aria-hidden\"?: Booleanish | (() => Booleanish)\n \"aria-disabled\"?: Booleanish | (() => Booleanish)\n \"aria-expanded\"?: Booleanish | (() => Booleanish)\n \"aria-selected\"?: Booleanish | (() => Booleanish)\n \"aria-checked\"?: Booleanish | \"mixed\" | (() => Booleanish | \"mixed\")\n \"aria-current\"?: Booleanish | \"page\" | \"step\" | \"location\" | \"date\" | \"time\"\n \"aria-live\"?: \"off\" | \"assertive\" | \"polite\"\n \"aria-atomic\"?: Booleanish\n \"aria-busy\"?: Booleanish\n \"aria-controls\"?: string\n \"aria-describedby\"?: string\n \"aria-labelledby\"?: string\n \"aria-placeholder\"?: string\n \"aria-required\"?: Booleanish | (() => Booleanish)\n \"aria-invalid\"?: Booleanish | \"grammar\" | \"spelling\"\n \"aria-valuemin\"?: number\n \"aria-valuemax\"?: number\n \"aria-valuenow\"?: number\n \"aria-valuetext\"?: string\n \"aria-haspopup\"?: Booleanish | \"menu\" | \"listbox\" | \"tree\" | \"grid\" | \"dialog\"\n \"aria-posinset\"?: number\n \"aria-setsize\"?: number\n \"aria-level\"?: number\n \"aria-multiline\"?: Booleanish\n \"aria-multiselectable\"?: Booleanish\n \"aria-orientation\"?: \"horizontal\" | \"vertical\"\n \"aria-readonly\"?: Booleanish | (() => Booleanish)\n \"aria-sort\"?: \"none\" | \"ascending\" | \"descending\" | \"other\"\n \"aria-autocomplete\"?: \"none\" | \"inline\" | \"list\" | \"both\"\n \"aria-colcount\"?: number\n \"aria-colindex\"?: number\n \"aria-colspan\"?: number\n \"aria-rowcount\"?: number\n \"aria-rowindex\"?: number\n \"aria-rowspan\"?: number\n // DOM lifecycle ref — object ref or callback ref\n ref?: { current: unknown } | ((el: Element | null) => void)\n // Key for list reconciliation\n key?: string | number\n // Children — allows null, undefined, boolean in JSX children positions\n children?: VNodeChild | VNodeChild[]\n // innerHTML\n innerHTML?: string\n dangerouslySetInnerHTML?: { __html: string }\n // Events\n onClick?: (e: MouseEvent) => void\n onDblClick?: (e: MouseEvent) => void\n onMouseDown?: (e: MouseEvent) => void\n onMouseUp?: (e: MouseEvent) => void\n onMouseEnter?: (e: MouseEvent) => void\n onMouseLeave?: (e: MouseEvent) => void\n onMouseMove?: (e: MouseEvent) => void\n onMouseOver?: (e: MouseEvent) => void\n onMouseOut?: (e: MouseEvent) => void\n onContextMenu?: (e: MouseEvent) => void\n onKeyDown?: (e: KeyboardEvent) => void\n onKeyUp?: (e: KeyboardEvent) => void\n onKeyPress?: (e: KeyboardEvent) => void\n onFocus?: (e: FocusEvent) => void\n onBlur?: (e: FocusEvent) => void\n onChange?: (e: Event) => void\n onInput?: (e: InputEvent) => void\n onSubmit?: (e: SubmitEvent) => void\n onReset?: (e: Event) => void\n onScroll?: (e: Event) => void\n onWheel?: (e: WheelEvent) => void\n onDragStart?: (e: DragEvent) => void\n onDragEnd?: (e: DragEvent) => void\n onDragOver?: (e: DragEvent) => void\n onDragEnter?: (e: DragEvent) => void\n onDragLeave?: (e: DragEvent) => void\n onDrop?: (e: DragEvent) => void\n onTouchStart?: (e: TouchEvent) => void\n onTouchEnd?: (e: TouchEvent) => void\n onTouchMove?: (e: TouchEvent) => void\n onPointerDown?: (e: PointerEvent) => void\n onPointerUp?: (e: PointerEvent) => void\n onPointerMove?: (e: PointerEvent) => void\n onPointerEnter?: (e: PointerEvent) => void\n onPointerLeave?: (e: PointerEvent) => void\n onPointerCancel?: (e: PointerEvent) => void\n onPointerOver?: (e: PointerEvent) => void\n onPointerOut?: (e: PointerEvent) => void\n onTransitionEnd?: (e: TransitionEvent) => void\n onAnimationStart?: (e: AnimationEvent) => void\n onAnimationEnd?: (e: AnimationEvent) => void\n onAnimationIteration?: (e: AnimationEvent) => void\n onLoad?: (e: Event) => void\n onError?: (e: Event | string) => void\n onAbort?: (e: Event) => void\n onSelect?: (e: Event) => void\n onCopy?: (e: ClipboardEvent) => void\n onCut?: (e: ClipboardEvent) => void\n onPaste?: (e: ClipboardEvent) => void\n // Catch-all for data-* and other arbitrary attributes\n [key: string]: unknown\n}\n\n/** Attributes specific to form inputs */\ninterface InputAttributes extends PyreonHTMLAttributes {\n type?: string | (() => string)\n value?: string | number | (() => string | number)\n defaultValue?: string | number\n checked?: boolean | (() => boolean)\n defaultChecked?: boolean\n placeholder?: string | (() => string)\n disabled?: boolean | (() => boolean)\n readOnly?: boolean\n required?: boolean | (() => boolean)\n min?: string | number\n max?: string | number\n step?: string | number\n minLength?: number\n maxLength?: number\n pattern?: string\n multiple?: boolean\n name?: string\n accept?: string\n autoComplete?: string\n autoFocus?: boolean\n form?: string\n list?: string\n size?: number\n src?: string | (() => string)\n alt?: string\n width?: number | string\n height?: number | string\n}\n\ninterface AnchorAttributes extends PyreonHTMLAttributes {\n href?: string | (() => string)\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | string\n rel?: string\n download?: string | boolean\n}\n\ninterface ButtonAttributes extends PyreonHTMLAttributes {\n type?: \"button\" | \"submit\" | \"reset\"\n disabled?: boolean | (() => boolean)\n name?: string\n value?: string\n form?: string\n formAction?: string\n formMethod?: string\n formEncType?: string\n formNoValidate?: boolean\n formTarget?: string\n}\n\ninterface TextareaAttributes extends PyreonHTMLAttributes {\n value?: string | (() => string)\n defaultValue?: string\n placeholder?: string | (() => string)\n disabled?: boolean | (() => boolean)\n readOnly?: boolean\n required?: boolean | (() => boolean)\n rows?: number\n cols?: number\n minLength?: number\n maxLength?: number\n name?: string\n autoFocus?: boolean\n form?: string\n wrap?: \"hard\" | \"soft\"\n}\n\ninterface SelectAttributes extends PyreonHTMLAttributes {\n value?: string | string[] | (() => string | string[])\n defaultValue?: string | string[]\n disabled?: boolean | (() => boolean)\n required?: boolean | (() => boolean)\n multiple?: boolean\n name?: string\n size?: number\n form?: string\n autoFocus?: boolean\n}\n\ninterface OptionAttributes extends PyreonHTMLAttributes {\n value?: string | number | (() => string | number)\n disabled?: boolean | (() => boolean)\n selected?: boolean | (() => boolean)\n label?: string\n}\n\ninterface FormAttributes extends PyreonHTMLAttributes {\n action?: string\n method?: \"get\" | \"post\"\n encType?: string\n noValidate?: boolean\n target?: string\n name?: string\n autoComplete?: string\n}\n\ninterface ImgAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n alt?: string | (() => string)\n width?: number | string | (() => number | string)\n height?: number | string | (() => number | string)\n loading?: \"lazy\" | \"eager\"\n decoding?: \"auto\" | \"async\" | \"sync\"\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n referrerPolicy?: string\n srcSet?: string\n sizes?: string\n}\n\ninterface VideoAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n width?: number | string\n height?: number | string\n controls?: boolean\n autoPlay?: boolean\n muted?: boolean\n loop?: boolean\n poster?: string\n preload?: \"none\" | \"metadata\" | \"auto\"\n playsInline?: boolean\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n}\n\ninterface AudioAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n controls?: boolean\n autoPlay?: boolean\n muted?: boolean\n loop?: boolean\n preload?: \"none\" | \"metadata\" | \"auto\"\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n}\n\ninterface LabelAttributes extends PyreonHTMLAttributes {\n htmlFor?: string\n for?: string\n form?: string\n}\n\ninterface ThAttributes extends PyreonHTMLAttributes {\n colSpan?: number\n rowSpan?: number\n scope?: \"col\" | \"row\" | \"colgroup\" | \"rowgroup\"\n abbr?: string\n headers?: string\n}\n\ninterface TdAttributes extends PyreonHTMLAttributes {\n colSpan?: number\n rowSpan?: number\n headers?: string\n}\n\ninterface ColAttributes extends PyreonHTMLAttributes {\n span?: number\n}\n\ninterface IframeAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n width?: number | string\n height?: number | string\n allow?: string\n allowFullScreen?: boolean\n loading?: \"lazy\" | \"eager\"\n name?: string\n sandbox?: string\n referrerPolicy?: string\n title?: string\n}\n\ninterface LinkAttributes extends PyreonHTMLAttributes {\n href?: string | (() => string)\n rel?: string\n type?: string\n as?: string\n media?: string\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n integrity?: string\n referrerPolicy?: string\n}\n\ninterface MetaAttributes extends PyreonHTMLAttributes {\n name?: string\n content?: string | (() => string)\n httpEquiv?: string\n charset?: string\n property?: string\n}\n\ninterface ScriptAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n type?: string\n async?: boolean\n defer?: boolean\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n integrity?: string\n noModule?: boolean\n referrerPolicy?: string\n}\n\ninterface SourceAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n type?: string\n srcSet?: string\n sizes?: string\n media?: string\n}\n\ninterface ProgressAttributes extends PyreonHTMLAttributes {\n value?: number | (() => number)\n max?: number\n}\n\ninterface MeterAttributes extends PyreonHTMLAttributes {\n value?: number | (() => number)\n min?: number\n max?: number\n low?: number\n high?: number\n optimum?: number\n}\n\ninterface DetailsAttributes extends PyreonHTMLAttributes {\n open?: boolean | (() => boolean)\n}\n\ninterface DialogAttributes extends PyreonHTMLAttributes {\n open?: boolean | (() => boolean)\n}\n\ninterface OlAttributes extends PyreonHTMLAttributes {\n start?: number\n reversed?: boolean\n type?: \"1\" | \"a\" | \"A\" | \"i\" | \"I\"\n}\n\ninterface SvgAttributes extends PyreonHTMLAttributes {\n viewBox?: string\n xmlns?: string\n fill?: string | (() => string)\n stroke?: string | (() => string)\n \"stroke-width\"?: string | number\n \"stroke-linecap\"?: \"butt\" | \"round\" | \"square\"\n \"stroke-linejoin\"?: \"miter\" | \"round\" | \"bevel\"\n \"fill-rule\"?: \"nonzero\" | \"evenodd\"\n \"clip-rule\"?: \"nonzero\" | \"evenodd\"\n \"clip-path\"?: string\n d?: string\n cx?: string | number\n cy?: string | number\n r?: string | number\n rx?: string | number\n ry?: string | number\n x?: string | number\n y?: string | number\n x1?: string | number\n y1?: string | number\n x2?: string | number\n y2?: string | number\n width?: string | number\n height?: string | number\n transform?: string | (() => string)\n opacity?: string | number | (() => string | number)\n points?: string\n \"font-size\"?: string | number\n \"text-anchor\"?: \"start\" | \"middle\" | \"end\"\n \"dominant-baseline\"?: string\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 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\n }\n }\n}\n"],"mappings":";;AAGA,MAAa,WAA0B,OAAO,kBAAkB;;;;;;;;;AAUhE,MAAa,cAAqB,EAAE;AAoBpC,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;;;;;;;;;;;;ACrDT,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-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) => VNode | null) | 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\"\ntype CSSProperties = { [K in keyof CSSStyleDeclaration]?: string | number }\ntype StyleValue = string | CSSProperties\n\n/** Common HTML attributes accepted by all Pyreon elements */\ninterface PyreonHTMLAttributes {\n // Identity\n id?: string\n class?: string | (() => string)\n className?: string | (() => string)\n style?: StyleValue | (() => StyleValue)\n // pyreon-specific directives\n \"n-show\"?: boolean | (() => boolean)\n // Accessible\n role?: string\n tabIndex?: number | (() => number)\n title?: string\n lang?: string\n dir?: \"ltr\" | \"rtl\" | \"auto\"\n hidden?: boolean | (() => boolean)\n draggable?: Booleanish\n // ARIA\n \"aria-label\"?: string | (() => string)\n \"aria-hidden\"?: Booleanish | (() => Booleanish)\n \"aria-disabled\"?: Booleanish | (() => Booleanish)\n \"aria-expanded\"?: Booleanish | (() => Booleanish)\n \"aria-selected\"?: Booleanish | (() => Booleanish)\n \"aria-checked\"?: Booleanish | \"mixed\" | (() => Booleanish | \"mixed\")\n \"aria-current\"?: Booleanish | \"page\" | \"step\" | \"location\" | \"date\" | \"time\"\n \"aria-live\"?: \"off\" | \"assertive\" | \"polite\"\n \"aria-atomic\"?: Booleanish\n \"aria-busy\"?: Booleanish\n \"aria-controls\"?: string\n \"aria-describedby\"?: string\n \"aria-labelledby\"?: string\n \"aria-placeholder\"?: string\n \"aria-required\"?: Booleanish | (() => Booleanish)\n \"aria-invalid\"?: Booleanish | \"grammar\" | \"spelling\"\n \"aria-valuemin\"?: number\n \"aria-valuemax\"?: number\n \"aria-valuenow\"?: number\n \"aria-valuetext\"?: string\n \"aria-haspopup\"?: Booleanish | \"menu\" | \"listbox\" | \"tree\" | \"grid\" | \"dialog\"\n \"aria-posinset\"?: number\n \"aria-setsize\"?: number\n \"aria-level\"?: number\n \"aria-multiline\"?: Booleanish\n \"aria-multiselectable\"?: Booleanish\n \"aria-orientation\"?: \"horizontal\" | \"vertical\"\n \"aria-readonly\"?: Booleanish | (() => Booleanish)\n \"aria-sort\"?: \"none\" | \"ascending\" | \"descending\" | \"other\"\n \"aria-autocomplete\"?: \"none\" | \"inline\" | \"list\" | \"both\"\n \"aria-colcount\"?: number\n \"aria-colindex\"?: number\n \"aria-colspan\"?: number\n \"aria-rowcount\"?: number\n \"aria-rowindex\"?: number\n \"aria-rowspan\"?: number\n // DOM lifecycle ref — object ref or callback ref\n ref?: { current: unknown } | ((el: Element | null) => void)\n // Key for list reconciliation\n key?: string | number\n // Children — allows null, undefined, boolean in JSX children positions\n children?: VNodeChild | VNodeChild[]\n // innerHTML\n innerHTML?: string\n dangerouslySetInnerHTML?: { __html: string }\n // Events\n onClick?: (e: MouseEvent) => void\n onDblClick?: (e: MouseEvent) => void\n onMouseDown?: (e: MouseEvent) => void\n onMouseUp?: (e: MouseEvent) => void\n onMouseEnter?: (e: MouseEvent) => void\n onMouseLeave?: (e: MouseEvent) => void\n onMouseMove?: (e: MouseEvent) => void\n onMouseOver?: (e: MouseEvent) => void\n onMouseOut?: (e: MouseEvent) => void\n onContextMenu?: (e: MouseEvent) => void\n onKeyDown?: (e: KeyboardEvent) => void\n onKeyUp?: (e: KeyboardEvent) => void\n onKeyPress?: (e: KeyboardEvent) => void\n onFocus?: (e: FocusEvent) => void\n onBlur?: (e: FocusEvent) => void\n onChange?: (e: Event) => void\n onInput?: (e: InputEvent) => void\n onSubmit?: (e: SubmitEvent) => void\n onReset?: (e: Event) => void\n onScroll?: (e: Event) => void\n onWheel?: (e: WheelEvent) => void\n onDragStart?: (e: DragEvent) => void\n onDragEnd?: (e: DragEvent) => void\n onDragOver?: (e: DragEvent) => void\n onDragEnter?: (e: DragEvent) => void\n onDragLeave?: (e: DragEvent) => void\n onDrop?: (e: DragEvent) => void\n onTouchStart?: (e: TouchEvent) => void\n onTouchEnd?: (e: TouchEvent) => void\n onTouchMove?: (e: TouchEvent) => void\n onPointerDown?: (e: PointerEvent) => void\n onPointerUp?: (e: PointerEvent) => void\n onPointerMove?: (e: PointerEvent) => void\n onPointerEnter?: (e: PointerEvent) => void\n onPointerLeave?: (e: PointerEvent) => void\n onPointerCancel?: (e: PointerEvent) => void\n onPointerOver?: (e: PointerEvent) => void\n onPointerOut?: (e: PointerEvent) => void\n onTransitionEnd?: (e: TransitionEvent) => void\n onAnimationStart?: (e: AnimationEvent) => void\n onAnimationEnd?: (e: AnimationEvent) => void\n onAnimationIteration?: (e: AnimationEvent) => void\n onLoad?: (e: Event) => void\n onError?: (e: Event | string) => void\n onAbort?: (e: Event) => void\n onSelect?: (e: Event) => void\n onCopy?: (e: ClipboardEvent) => void\n onCut?: (e: ClipboardEvent) => void\n onPaste?: (e: ClipboardEvent) => void\n // Catch-all for data-* and other arbitrary attributes\n [key: string]: unknown\n}\n\n/** Attributes specific to form inputs */\ninterface InputAttributes extends PyreonHTMLAttributes {\n type?: string | (() => string)\n value?: string | number | (() => string | number)\n defaultValue?: string | number\n checked?: boolean | (() => boolean)\n defaultChecked?: boolean\n placeholder?: string | (() => string)\n disabled?: boolean | (() => boolean)\n readOnly?: boolean\n required?: boolean | (() => boolean)\n min?: string | number\n max?: string | number\n step?: string | number\n minLength?: number\n maxLength?: number\n pattern?: string\n multiple?: boolean\n name?: string\n accept?: string\n autoComplete?: string\n autoFocus?: boolean\n form?: string\n list?: string\n size?: number\n src?: string | (() => string)\n alt?: string\n width?: number | string\n height?: number | string\n}\n\ninterface AnchorAttributes extends PyreonHTMLAttributes {\n href?: string | (() => string)\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | string\n rel?: string\n download?: string | boolean\n}\n\ninterface ButtonAttributes extends PyreonHTMLAttributes {\n type?: \"button\" | \"submit\" | \"reset\"\n disabled?: boolean | (() => boolean)\n name?: string\n value?: string\n form?: string\n formAction?: string\n formMethod?: string\n formEncType?: string\n formNoValidate?: boolean\n formTarget?: string\n}\n\ninterface TextareaAttributes extends PyreonHTMLAttributes {\n value?: string | (() => string)\n defaultValue?: string\n placeholder?: string | (() => string)\n disabled?: boolean | (() => boolean)\n readOnly?: boolean\n required?: boolean | (() => boolean)\n rows?: number\n cols?: number\n minLength?: number\n maxLength?: number\n name?: string\n autoFocus?: boolean\n form?: string\n wrap?: \"hard\" | \"soft\"\n}\n\ninterface SelectAttributes extends PyreonHTMLAttributes {\n value?: string | string[] | (() => string | string[])\n defaultValue?: string | string[]\n disabled?: boolean | (() => boolean)\n required?: boolean | (() => boolean)\n multiple?: boolean\n name?: string\n size?: number\n form?: string\n autoFocus?: boolean\n}\n\ninterface OptionAttributes extends PyreonHTMLAttributes {\n value?: string | number | (() => string | number)\n disabled?: boolean | (() => boolean)\n selected?: boolean | (() => boolean)\n label?: string\n}\n\ninterface FormAttributes extends PyreonHTMLAttributes {\n action?: string\n method?: \"get\" | \"post\"\n encType?: string\n noValidate?: boolean\n target?: string\n name?: string\n autoComplete?: string\n}\n\ninterface ImgAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n alt?: string | (() => string)\n width?: number | string | (() => number | string)\n height?: number | string | (() => number | string)\n loading?: \"lazy\" | \"eager\"\n decoding?: \"auto\" | \"async\" | \"sync\"\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n referrerPolicy?: string\n srcSet?: string\n sizes?: string\n}\n\ninterface VideoAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n width?: number | string\n height?: number | string\n controls?: boolean\n autoPlay?: boolean\n muted?: boolean\n loop?: boolean\n poster?: string\n preload?: \"none\" | \"metadata\" | \"auto\"\n playsInline?: boolean\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n}\n\ninterface AudioAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n controls?: boolean\n autoPlay?: boolean\n muted?: boolean\n loop?: boolean\n preload?: \"none\" | \"metadata\" | \"auto\"\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n}\n\ninterface LabelAttributes extends PyreonHTMLAttributes {\n htmlFor?: string\n for?: string\n form?: string\n}\n\ninterface ThAttributes extends PyreonHTMLAttributes {\n colSpan?: number\n rowSpan?: number\n scope?: \"col\" | \"row\" | \"colgroup\" | \"rowgroup\"\n abbr?: string\n headers?: string\n}\n\ninterface TdAttributes extends PyreonHTMLAttributes {\n colSpan?: number\n rowSpan?: number\n headers?: string\n}\n\ninterface ColAttributes extends PyreonHTMLAttributes {\n span?: number\n}\n\ninterface IframeAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n width?: number | string\n height?: number | string\n allow?: string\n allowFullScreen?: boolean\n loading?: \"lazy\" | \"eager\"\n name?: string\n sandbox?: string\n referrerPolicy?: string\n title?: string\n}\n\ninterface LinkAttributes extends PyreonHTMLAttributes {\n href?: string | (() => string)\n rel?: string\n type?: string\n as?: string\n media?: string\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n integrity?: string\n referrerPolicy?: string\n}\n\ninterface MetaAttributes extends PyreonHTMLAttributes {\n name?: string\n content?: string | (() => string)\n httpEquiv?: string\n charset?: string\n property?: string\n}\n\ninterface ScriptAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n type?: string\n async?: boolean\n defer?: boolean\n crossOrigin?: \"anonymous\" | \"use-credentials\"\n integrity?: string\n noModule?: boolean\n referrerPolicy?: string\n}\n\ninterface SourceAttributes extends PyreonHTMLAttributes {\n src?: string | (() => string)\n type?: string\n srcSet?: string\n sizes?: string\n media?: string\n}\n\ninterface ProgressAttributes extends PyreonHTMLAttributes {\n value?: number | (() => number)\n max?: number\n}\n\ninterface MeterAttributes extends PyreonHTMLAttributes {\n value?: number | (() => number)\n min?: number\n max?: number\n low?: number\n high?: number\n optimum?: number\n}\n\ninterface DetailsAttributes extends PyreonHTMLAttributes {\n open?: boolean | (() => boolean)\n}\n\ninterface DialogAttributes extends PyreonHTMLAttributes {\n open?: boolean | (() => boolean)\n}\n\ninterface OlAttributes extends PyreonHTMLAttributes {\n start?: number\n reversed?: boolean\n type?: \"1\" | \"a\" | \"A\" | \"i\" | \"I\"\n}\n\ninterface SvgAttributes extends PyreonHTMLAttributes {\n viewBox?: string\n xmlns?: string\n fill?: string | (() => string)\n stroke?: string | (() => string)\n \"stroke-width\"?: string | number\n \"stroke-linecap\"?: \"butt\" | \"round\" | \"square\"\n \"stroke-linejoin\"?: \"miter\" | \"round\" | \"bevel\"\n \"fill-rule\"?: \"nonzero\" | \"evenodd\"\n \"clip-rule\"?: \"nonzero\" | \"evenodd\"\n \"clip-path\"?: string\n d?: string\n cx?: string | number\n cy?: string | number\n r?: string | number\n rx?: string | number\n ry?: string | number\n x?: string | number\n y?: string | number\n x1?: string | number\n y1?: string | number\n x2?: string | number\n y2?: string | number\n width?: string | number\n height?: string | number\n transform?: string | (() => string)\n opacity?: string | number | (() => string | number)\n points?: string\n \"font-size\"?: string | number\n \"text-anchor\"?: \"start\" | \"middle\" | \"end\"\n \"dominant-baseline\"?: string\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\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"}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ interface NativeItem {
|
|
|
35
35
|
cleanup: (() => void) | null;
|
|
36
36
|
}
|
|
37
37
|
interface LifecycleHooks {
|
|
38
|
-
mount: (() => CleanupFn | undefined)[];
|
|
38
|
+
mount: (() => CleanupFn | void | undefined)[];
|
|
39
39
|
unmount: (() => void)[];
|
|
40
40
|
update: (() => void)[];
|
|
41
41
|
/** Error handlers — return true to mark the error as handled (stops propagation). */
|
|
@@ -180,7 +180,7 @@ type PropsWithOptionalChildren<P extends Props> = Omit<P, "children"> & ("childr
|
|
|
180
180
|
children?: P["children"];
|
|
181
181
|
} : unknown);
|
|
182
182
|
declare function h<P extends Props>(type: ComponentFn<P>, props: (PropsWithOptionalChildren<P> & Props) | null, ...children: VNodeChild[]): VNode;
|
|
183
|
-
declare function h(type: string | ((
|
|
183
|
+
declare function h(type: string | ((p: any) => VNode | null) | symbol, props: Props | null, ...children: VNodeChild[]): VNode;
|
|
184
184
|
//#endregion
|
|
185
185
|
//#region src/suspense.d.ts
|
|
186
186
|
/** Internal marker attached to lazy()-wrapped components */
|
|
@@ -215,7 +215,7 @@ declare function lazy<P extends Props>(load: () => Promise<{
|
|
|
215
215
|
* Register a callback to run after the component is mounted to the DOM.
|
|
216
216
|
* Optionally return a cleanup function — it will run on unmount.
|
|
217
217
|
*/
|
|
218
|
-
declare function onMount(fn: () => CleanupFn | undefined): void;
|
|
218
|
+
declare function onMount(fn: () => CleanupFn | void | undefined): void;
|
|
219
219
|
/**
|
|
220
220
|
* Register a callback to run when the component is removed from the DOM.
|
|
221
221
|
*/
|
|
@@ -344,6 +344,13 @@ interface SwitchProps extends Props {
|
|
|
344
344
|
declare function Switch(props: SwitchProps): VNode | null;
|
|
345
345
|
declare const MatchSymbol: unique symbol;
|
|
346
346
|
//#endregion
|
|
347
|
+
//#region src/style.d.ts
|
|
348
|
+
declare const CSS_UNITLESS: Set<string>;
|
|
349
|
+
/** Convert a camelCase CSS property name to kebab-case. */
|
|
350
|
+
declare function toKebabCase(str: string): string;
|
|
351
|
+
/** Normalize a style value — appends "px" to numbers for non-unitless properties. */
|
|
352
|
+
declare function normalizeStyleValue(key: string, value: unknown): string;
|
|
353
|
+
//#endregion
|
|
347
354
|
//#region src/telemetry.d.ts
|
|
348
355
|
/**
|
|
349
356
|
* Error telemetry — hook into Pyreon's error reporting for Sentry, Datadog, etc.
|
|
@@ -382,5 +389,5 @@ declare function registerErrorHandler(handler: ErrorHandler): () => void;
|
|
|
382
389
|
*/
|
|
383
390
|
declare function reportError(ctx: ErrorContext): void;
|
|
384
391
|
//#endregion
|
|
385
|
-
export { type CleanupFn, type ComponentFn, type ComponentInstance, type Context, Dynamic, type DynamicProps, EMPTY_PROPS, ErrorBoundary, type ErrorContext, type ErrorHandler, For, type ForProps, ForSymbol, Fragment, type LazyComponent, type LifecycleHooks, Match, type MatchProps, MatchSymbol, type NativeItem, Portal, type PortalProps, PortalSymbol, type Props, type Ref, Show, type ShowProps, Suspense, Switch, type SwitchProps, type VNode, type VNodeChild, type VNodeChildAtom, createContext, createRef, defineComponent, dispatchToErrorBoundary, h, lazy, mapArray, onErrorCaptured, onMount, onUnmount, onUpdate, popContext, propagateError, pushContext, registerErrorHandler, reportError, runWithHooks, setContextStackProvider, useContext, withContext };
|
|
392
|
+
export { CSS_UNITLESS, type CleanupFn, type ComponentFn, type ComponentInstance, type Context, Dynamic, type DynamicProps, EMPTY_PROPS, ErrorBoundary, type ErrorContext, type ErrorHandler, For, type ForProps, ForSymbol, Fragment, type LazyComponent, type LifecycleHooks, Match, type MatchProps, MatchSymbol, type NativeItem, Portal, type PortalProps, PortalSymbol, type Props, type Ref, Show, type ShowProps, Suspense, Switch, type SwitchProps, type VNode, type VNodeChild, type VNodeChildAtom, createContext, createRef, defineComponent, dispatchToErrorBoundary, h, lazy, mapArray, normalizeStyleValue, onErrorCaptured, onMount, onUnmount, onUpdate, popContext, propagateError, pushContext, registerErrorHandler, reportError, runWithHooks, setContextStackProvider, toKebabCase, useContext, withContext };
|
|
386
393
|
//# sourceMappingURL=index2.d.ts.map
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index2.d.ts","names":[],"sources":["../../../src/types.ts","../../../src/component.ts","../../../src/context.ts","../../../src/dynamic.ts","../../../src/error-boundary.ts","../../../src/for.ts","../../../src/h.ts","../../../src/suspense.ts","../../../src/lazy.ts","../../../src/lifecycle.ts","../../../src/map-array.ts","../../../src/portal.ts","../../../src/ref.ts","../../../src/show.ts","../../../src/telemetry.ts"],"mappings":";KAGY,cAAA,GAAiB,KAAA,GAAQ,KAAA;AAAA,KACzB,UAAA,GAAa,cAAA,UAAwB,cAAA;AAAA,UAEhC,KAAA;;EAEf,IAAA,WAAe,WAAA;EACf,KAAA,EAAO,KAAA;EACP,QAAA,EAAU,UAAA;EACV,GAAA;AAAA;AAAA,KAKU,KAAA,GAAQ,MAAA;;AAVpB;;;KAkBY,WAAA,WAAsB,KAAA,GAAQ,KAAA,KAAU,KAAA,EAAO,CAAA,KAAM,KAAA;;;;UAKhD,iBAAA;EACf,KAAA,EAAO,KAAA;EAtBQ;EAwBf,MAAA;EACA,OAAA;AAAA;AAAA,KAMU,SAAA;;;;AAvBZ;;UAgCiB,UAAA;EAAA,SACN,UAAA;EACT,EAAA,EAAI,WAAA;EACJ,OAAA;AAAA;AAAA,UAGe,cAAA;
|
|
1
|
+
{"version":3,"file":"index2.d.ts","names":[],"sources":["../../../src/types.ts","../../../src/component.ts","../../../src/context.ts","../../../src/dynamic.ts","../../../src/error-boundary.ts","../../../src/for.ts","../../../src/h.ts","../../../src/suspense.ts","../../../src/lazy.ts","../../../src/lifecycle.ts","../../../src/map-array.ts","../../../src/portal.ts","../../../src/ref.ts","../../../src/show.ts","../../../src/style.ts","../../../src/telemetry.ts"],"mappings":";KAGY,cAAA,GAAiB,KAAA,GAAQ,KAAA;AAAA,KACzB,UAAA,GAAa,cAAA,UAAwB,cAAA;AAAA,UAEhC,KAAA;;EAEf,IAAA,WAAe,WAAA;EACf,KAAA,EAAO,KAAA;EACP,QAAA,EAAU,UAAA;EACV,GAAA;AAAA;AAAA,KAKU,KAAA,GAAQ,MAAA;;AAVpB;;;KAkBY,WAAA,WAAsB,KAAA,GAAQ,KAAA,KAAU,KAAA,EAAO,CAAA,KAAM,KAAA;;;;UAKhD,iBAAA;EACf,KAAA,EAAO,KAAA;EAtBQ;EAwBf,MAAA;EACA,OAAA;AAAA;AAAA,KAMU,SAAA;;;;AAvBZ;;UAgCiB,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AAEA;;UeQiB,YAAA;EfNA;EeQf,SAAA;EfNU;EeQV,KAAA;EfRoB;EeUpB,KAAA;EfZe;Eecf,SAAA;EfbO;EeeP,KAAA,GAAQ,MAAA;AAAA;AAAA,KAGE,YAAA,IAAgB,GAAA,EAAK,YAAA;;;AfXjC;;iBemBgB,oBAAA,CAAqB,OAAA,EAAS,YAAA;;;AfX9C;;iBesBgB,WAAA,CAAY,GAAA,EAAK,YAAA"}
|
|
@@ -25,7 +25,8 @@ declare function jsx(type: string | ComponentFn | symbol, props: Props & {
|
|
|
25
25
|
}, key?: string | number | null): VNode;
|
|
26
26
|
declare const jsxs: typeof jsx;
|
|
27
27
|
type Booleanish = boolean | "true" | "false";
|
|
28
|
-
type
|
|
28
|
+
type CSSProperties = { [K in keyof CSSStyleDeclaration]?: string | number };
|
|
29
|
+
type StyleValue = string | CSSProperties;
|
|
29
30
|
/** Common HTML attributes accepted by all Pyreon elements */
|
|
30
31
|
interface PyreonHTMLAttributes {
|
|
31
32
|
id?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-dev-runtime2.d.ts","names":[],"sources":["../../../src/types.ts","../../../src/h.ts","../../../src/jsx-runtime.ts"],"mappings":";KAGY,cAAA,GAAiB,KAAA,GAAQ,KAAA;AAAA,KACzB,UAAA,GAAa,cAAA,UAAwB,cAAA;AAAA,UAEhC,KAAA;;EAEf,IAAA,WAAe,WAAA;EACf,KAAA,EAAO,KAAA;EACP,QAAA,EAAU,UAAA;EACV,GAAA;AAAA;AAAA,KAKU,KAAA,GAAQ,MAAA;;AAVpB;;;KAkBY,WAAA,WAAsB,KAAA,GAAQ,KAAA,KAAU,KAAA,EAAO,CAAA,KAAM,KAAA;;;AArBjE;AAAA,cCAa,QAAA;;;iBCSG,GAAA,CACd,IAAA,WAAe,WAAA,WACf,KAAA,EAAO,KAAA;EAAU,QAAA,GAAW,UAAA,GAAa,UAAA;AAAA,GACzC,GAAA,4BACC,KAAA;AAAA,cAiBU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AA,EAAS,oBAAA;MACT,MAAA,EAAQ,gBAAA;MACR,MAAA,EAAQ,gBAAA;MACR,KAAA,EAAO,oBAAA;MACP,MAAA,EAAQ,oBAAA;MACR,KAAA,EAAO,oBAAA;MAEP,IAAA,EAAM,oBAAA;MACN,QAAA,EAAU,oBAAA;MACV,QAAA,EAAU,oBAAA;MACV,IAAA,EAAM,oBAAA;MACN,MAAA,EAAQ,oBAAA;MAAA,CAEP,OAAA,WAAkB,oBAAA;IAAA;EAAA;AAAA"}
|
|
@@ -25,7 +25,8 @@ declare function jsx(type: string | ComponentFn | symbol, props: Props & {
|
|
|
25
25
|
}, key?: string | number | null): VNode;
|
|
26
26
|
declare const jsxs: typeof jsx;
|
|
27
27
|
type Booleanish = boolean | "true" | "false";
|
|
28
|
-
type
|
|
28
|
+
type CSSProperties = { [K in keyof CSSStyleDeclaration]?: string | number };
|
|
29
|
+
type StyleValue = string | CSSProperties;
|
|
29
30
|
/** Common HTML attributes accepted by all Pyreon elements */
|
|
30
31
|
interface PyreonHTMLAttributes {
|
|
31
32
|
id?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-runtime2.d.ts","names":[],"sources":["../../../src/types.ts","../../../src/h.ts","../../../src/jsx-runtime.ts"],"mappings":";KAGY,cAAA,GAAiB,KAAA,GAAQ,KAAA;AAAA,KACzB,UAAA,GAAa,cAAA,UAAwB,cAAA;AAAA,UAEhC,KAAA;;EAEf,IAAA,WAAe,WAAA;EACf,KAAA,EAAO,KAAA;EACP,QAAA,EAAU,UAAA;EACV,GAAA;AAAA;AAAA,KAKU,KAAA,GAAQ,MAAA;;AAVpB;;;KAkBY,WAAA,WAAsB,KAAA,GAAQ,KAAA,KAAU,KAAA,EAAO,CAAA,KAAM,KAAA;;;AArBjE;AAAA,cCAa,QAAA;;;iBCSG,GAAA,CACd,IAAA,WAAe,WAAA,WACf,KAAA,EAAO,KAAA;EAAU,QAAA,GAAW,UAAA,GAAa,UAAA;AAAA,GAC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GF,OAAA,EAAS,iBAAA;MACT,OAAA,EAAS,oBAAA;MACT,MAAA,EAAQ,gBAAA;MACR,MAAA,EAAQ,gBAAA;MACR,KAAA,EAAO,oBAAA;MACP,MAAA,EAAQ,oBAAA;MACR,KAAA,EAAO,oBAAA;MAEP,IAAA,EAAM,oBAAA;MACN,QAAA,EAAU,oBAAA;MACV,QAAA,EAAU,oBAAA;MACV,IAAA,EAAM,oBAAA;MACN,MAAA,EAAQ,oBAAA;MAAA,CAEP,OAAA,WAAkB,oBAAA;IAAA;EAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "Core component model and lifecycle for Pyreon",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"prepublishOnly": "bun run build"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@pyreon/reactivity": "^0.5.
|
|
52
|
+
"@pyreon/reactivity": "^0.5.6"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
package/src/context.ts
CHANGED
|
@@ -44,6 +44,10 @@ export function pushContext(values: Map<symbol, unknown>) {
|
|
|
44
44
|
export function popContext() {
|
|
45
45
|
const stack = getStack()
|
|
46
46
|
if (__DEV__ && stack.length === 0) {
|
|
47
|
+
// biome-ignore lint/suspicious/noConsole: dev-only warning
|
|
48
|
+
console.warn(
|
|
49
|
+
"[Pyreon] popContext() called on an empty context stack. This likely indicates a missing Provider.",
|
|
50
|
+
)
|
|
47
51
|
return
|
|
48
52
|
}
|
|
49
53
|
stack.pop()
|
package/src/dynamic.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { h } from "./h"
|
|
2
2
|
import type { ComponentFn, Props, VNode } from "./types"
|
|
3
3
|
|
|
4
|
+
const __DEV__ = typeof process !== "undefined" && process.env.NODE_ENV !== "production"
|
|
5
|
+
|
|
4
6
|
export interface DynamicProps extends Props {
|
|
5
7
|
component: ComponentFn | string
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
export function Dynamic(props: DynamicProps): VNode | null {
|
|
9
11
|
const { component, ...rest } = props
|
|
12
|
+
if (__DEV__ && !component) {
|
|
13
|
+
// biome-ignore lint/suspicious/noConsole: dev-only warning
|
|
14
|
+
console.warn("[Pyreon] <Dynamic> received a falsy `component` prop. Nothing will be rendered.")
|
|
15
|
+
}
|
|
10
16
|
if (!component) return null
|
|
11
17
|
return h(component as string | ComponentFn, rest as Props)
|
|
12
18
|
}
|
package/src/error-boundary.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { onUnmount } from "./lifecycle"
|
|
|
4
4
|
import { reportError } from "./telemetry"
|
|
5
5
|
import type { VNodeChild, VNodeChildAtom } from "./types"
|
|
6
6
|
|
|
7
|
+
const __DEV__ = typeof process !== "undefined" && process.env.NODE_ENV !== "production"
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* ErrorBoundary — catches errors thrown by child components and renders a
|
|
9
11
|
* fallback UI instead of crashing the whole tree.
|
|
@@ -35,6 +37,14 @@ export function ErrorBoundary(props: {
|
|
|
35
37
|
fallback: (err: unknown, reset: () => void) => VNodeChild
|
|
36
38
|
children?: VNodeChild
|
|
37
39
|
}): VNodeChild {
|
|
40
|
+
if (__DEV__ && typeof props.fallback !== "function") {
|
|
41
|
+
// biome-ignore lint/suspicious/noConsole: dev-only warning
|
|
42
|
+
console.warn(
|
|
43
|
+
"[Pyreon] <ErrorBoundary> expects `fallback` to be a function: (err, reset) => VNode. " +
|
|
44
|
+
`Received ${typeof props.fallback}.`,
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
38
48
|
const error = signal<unknown>(null)
|
|
39
49
|
const reset = () => error.set(null)
|
|
40
50
|
|
package/src/h.ts
CHANGED
|
@@ -25,9 +25,8 @@ export function h<P extends Props>(
|
|
|
25
25
|
...children: VNodeChild[]
|
|
26
26
|
): VNode
|
|
27
27
|
// Overload: intrinsic element, symbol, generic/dynamic component, or mixed union
|
|
28
|
-
// biome-ignore lint/suspicious/noExplicitAny: accepts any component function for generic components like For<T>
|
|
29
28
|
export function h(
|
|
30
|
-
type: string | ((
|
|
29
|
+
type: string | ((p: any) => VNode | null) | symbol,
|
|
31
30
|
props: Props | null,
|
|
32
31
|
...children: VNodeChild[]
|
|
33
32
|
): VNode
|
package/src/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ export type { Ref } from "./ref"
|
|
|
25
25
|
export { createRef } from "./ref"
|
|
26
26
|
export type { MatchProps, ShowProps, SwitchProps } from "./show"
|
|
27
27
|
export { Match, MatchSymbol, Show, Switch } from "./show"
|
|
28
|
+
export { CSS_UNITLESS, normalizeStyleValue, toKebabCase } from "./style"
|
|
28
29
|
export type { LazyComponent } from "./suspense"
|
|
29
30
|
export { Suspense } from "./suspense"
|
|
30
31
|
export type { ErrorContext, ErrorHandler } from "./telemetry"
|
package/src/jsx-runtime.ts
CHANGED
|
@@ -36,7 +36,8 @@ export const jsxs = jsx
|
|
|
36
36
|
// ─── JSX types ────────────────────────────────────────────────────────────────
|
|
37
37
|
|
|
38
38
|
type Booleanish = boolean | "true" | "false"
|
|
39
|
-
type
|
|
39
|
+
type CSSProperties = { [K in keyof CSSStyleDeclaration]?: string | number }
|
|
40
|
+
type StyleValue = string | CSSProperties
|
|
40
41
|
|
|
41
42
|
/** Common HTML attributes accepted by all Pyreon elements */
|
|
42
43
|
interface PyreonHTMLAttributes {
|
|
@@ -439,6 +440,7 @@ declare global {
|
|
|
439
440
|
|
|
440
441
|
/** Tells TS which prop name carries children in component calls */
|
|
441
442
|
interface ElementChildrenAttribute {
|
|
443
|
+
// biome-ignore lint/complexity/noBannedTypes: JSX spec requires {} for ElementChildrenAttribute
|
|
442
444
|
children: {}
|
|
443
445
|
}
|
|
444
446
|
|
package/src/lifecycle.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { CleanupFn, LifecycleHooks } from "./types"
|
|
2
2
|
|
|
3
|
+
const __DEV__ = typeof process !== "undefined" && process.env.NODE_ENV !== "production"
|
|
4
|
+
|
|
3
5
|
// The currently-executing component's hook storage, set by the renderer
|
|
4
6
|
// before calling the component function, cleared immediately after.
|
|
5
7
|
let _current: LifecycleHooks | null = null
|
|
@@ -12,11 +14,23 @@ export function getCurrentHooks(): LifecycleHooks | null {
|
|
|
12
14
|
return _current
|
|
13
15
|
}
|
|
14
16
|
|
|
17
|
+
function warnOutsideSetup(hookName: string): void {
|
|
18
|
+
if (__DEV__ && !_current) {
|
|
19
|
+
// biome-ignore lint/suspicious/noConsole: dev-only warning
|
|
20
|
+
console.warn(
|
|
21
|
+
`[Pyreon] ${hookName}() called outside component setup. ` +
|
|
22
|
+
"Lifecycle hooks must be called synchronously during a component's setup function.",
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
15
27
|
/**
|
|
16
28
|
* Register a callback to run after the component is mounted to the DOM.
|
|
17
29
|
* Optionally return a cleanup function — it will run on unmount.
|
|
18
30
|
*/
|
|
19
|
-
|
|
31
|
+
// biome-ignore lint/suspicious/noConfusingVoidType: void allows callbacks that return nothing
|
|
32
|
+
export function onMount(fn: () => CleanupFn | void | undefined) {
|
|
33
|
+
warnOutsideSetup("onMount")
|
|
20
34
|
_current?.mount.push(fn)
|
|
21
35
|
}
|
|
22
36
|
|
|
@@ -24,6 +38,7 @@ export function onMount(fn: () => CleanupFn | undefined) {
|
|
|
24
38
|
* Register a callback to run when the component is removed from the DOM.
|
|
25
39
|
*/
|
|
26
40
|
export function onUnmount(fn: () => void) {
|
|
41
|
+
warnOutsideSetup("onUnmount")
|
|
27
42
|
_current?.unmount.push(fn)
|
|
28
43
|
}
|
|
29
44
|
|
|
@@ -31,6 +46,7 @@ export function onUnmount(fn: () => void) {
|
|
|
31
46
|
* Register a callback to run after each reactive update.
|
|
32
47
|
*/
|
|
33
48
|
export function onUpdate(fn: () => void) {
|
|
49
|
+
warnOutsideSetup("onUpdate")
|
|
34
50
|
_current?.update.push(fn)
|
|
35
51
|
}
|
|
36
52
|
|
|
@@ -48,5 +64,6 @@ export function onUpdate(fn: () => void) {
|
|
|
48
64
|
* })
|
|
49
65
|
*/
|
|
50
66
|
export function onErrorCaptured(fn: (err: unknown) => boolean | undefined) {
|
|
67
|
+
warnOutsideSetup("onErrorCaptured")
|
|
51
68
|
_current?.error.push(fn)
|
|
52
69
|
}
|
package/src/style.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Shared style utilities used by both runtime-dom and runtime-server.
|
|
2
|
+
|
|
3
|
+
// CSS properties where numeric values are unitless (e.g. `opacity: 0.5`, `zIndex: 10`).
|
|
4
|
+
// All other numeric values get "px" appended automatically (e.g. `height: 100` → `"100px"`).
|
|
5
|
+
export const CSS_UNITLESS = new Set([
|
|
6
|
+
"animationIterationCount",
|
|
7
|
+
"aspectRatio",
|
|
8
|
+
"borderImageOutset",
|
|
9
|
+
"borderImageSlice",
|
|
10
|
+
"borderImageWidth",
|
|
11
|
+
"boxFlex",
|
|
12
|
+
"boxFlexGroup",
|
|
13
|
+
"boxOrdinalGroup",
|
|
14
|
+
"columnCount",
|
|
15
|
+
"columns",
|
|
16
|
+
"flex",
|
|
17
|
+
"flexGrow",
|
|
18
|
+
"flexPositive",
|
|
19
|
+
"flexShrink",
|
|
20
|
+
"flexNegative",
|
|
21
|
+
"flexOrder",
|
|
22
|
+
"gridArea",
|
|
23
|
+
"gridRow",
|
|
24
|
+
"gridRowEnd",
|
|
25
|
+
"gridRowSpan",
|
|
26
|
+
"gridRowStart",
|
|
27
|
+
"gridColumn",
|
|
28
|
+
"gridColumnEnd",
|
|
29
|
+
"gridColumnSpan",
|
|
30
|
+
"gridColumnStart",
|
|
31
|
+
"fontWeight",
|
|
32
|
+
"lineClamp",
|
|
33
|
+
"lineHeight",
|
|
34
|
+
"opacity",
|
|
35
|
+
"order",
|
|
36
|
+
"orphans",
|
|
37
|
+
"scale",
|
|
38
|
+
"tabSize",
|
|
39
|
+
"widows",
|
|
40
|
+
"zIndex",
|
|
41
|
+
"zoom",
|
|
42
|
+
"fillOpacity",
|
|
43
|
+
"floodOpacity",
|
|
44
|
+
"stopOpacity",
|
|
45
|
+
"strokeDasharray",
|
|
46
|
+
"strokeDashoffset",
|
|
47
|
+
"strokeMiterlimit",
|
|
48
|
+
"strokeOpacity",
|
|
49
|
+
"strokeWidth",
|
|
50
|
+
])
|
|
51
|
+
|
|
52
|
+
/** Convert a camelCase CSS property name to kebab-case. */
|
|
53
|
+
export function toKebabCase(str: string): string {
|
|
54
|
+
return str.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Normalize a style value — appends "px" to numbers for non-unitless properties. */
|
|
58
|
+
export function normalizeStyleValue(key: string, value: unknown): string {
|
|
59
|
+
return typeof value === "number" && !CSS_UNITLESS.has(key) ? `${value}px` : String(value)
|
|
60
|
+
}
|
package/src/suspense.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Fragment, h } from "./h"
|
|
2
2
|
import type { Props, VNode, VNodeChild } from "./types"
|
|
3
3
|
|
|
4
|
+
const __DEV__ = typeof process !== "undefined" && process.env.NODE_ENV !== "production"
|
|
5
|
+
|
|
4
6
|
/** Internal marker attached to lazy()-wrapped components */
|
|
5
7
|
export type LazyComponent<P extends Props = Props> = ((props: P) => VNode | null) & {
|
|
6
8
|
__loading: () => boolean
|
|
@@ -20,6 +22,13 @@ export type LazyComponent<P extends Props = Props> = ((props: P) => VNode | null
|
|
|
20
22
|
* <Suspense fallback={<Spinner />}><Page /></Suspense>
|
|
21
23
|
*/
|
|
22
24
|
export function Suspense(props: { fallback: VNodeChild; children?: VNodeChild }): VNode {
|
|
25
|
+
if (__DEV__ && props.fallback === undefined) {
|
|
26
|
+
// biome-ignore lint/suspicious/noConsole: dev-only warning
|
|
27
|
+
console.warn(
|
|
28
|
+
"[Pyreon] <Suspense> is missing a `fallback` prop. Provide fallback UI to show while loading.",
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
return h(Fragment, null, () => {
|
|
24
33
|
const ch = props.children
|
|
25
34
|
const childNode = typeof ch === "function" ? ch() : ch
|
package/src/tests/core.test.ts
CHANGED
|
@@ -603,6 +603,13 @@ describe("Suspense", () => {
|
|
|
603
603
|
// The getter should unwrap the function child
|
|
604
604
|
expect(getter()).toBe(child)
|
|
605
605
|
})
|
|
606
|
+
|
|
607
|
+
test("warns when fallback prop is missing", () => {
|
|
608
|
+
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {})
|
|
609
|
+
Suspense({ fallback: undefined as unknown as VNodeChild, children: h("div", null) })
|
|
610
|
+
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("<Suspense>"))
|
|
611
|
+
warnSpy.mockRestore()
|
|
612
|
+
})
|
|
606
613
|
})
|
|
607
614
|
|
|
608
615
|
// ─── ErrorBoundary ───────────────────────────────────────────────────────────
|
|
@@ -612,6 +619,19 @@ describe("ErrorBoundary", () => {
|
|
|
612
619
|
expect(typeof ErrorBoundary).toBe("function")
|
|
613
620
|
})
|
|
614
621
|
|
|
622
|
+
test("warns when fallback is not a function", () => {
|
|
623
|
+
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {})
|
|
624
|
+
runWithHooks(() => {
|
|
625
|
+
ErrorBoundary({
|
|
626
|
+
fallback: "not a function" as unknown as (err: unknown, reset: () => void) => VNodeChild,
|
|
627
|
+
children: "child",
|
|
628
|
+
})
|
|
629
|
+
return null
|
|
630
|
+
}, {})
|
|
631
|
+
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("<ErrorBoundary>"))
|
|
632
|
+
warnSpy.mockRestore()
|
|
633
|
+
})
|
|
634
|
+
|
|
615
635
|
test("returns a reactive getter", () => {
|
|
616
636
|
// Must run inside runWithHooks since ErrorBoundary calls onUnmount
|
|
617
637
|
const { vnode, hooks } = runWithHooks(() => {
|
|
@@ -904,20 +924,40 @@ describe("jsx / jsxs / jsxDEV", () => {
|
|
|
904
924
|
// ─── Lifecycle hooks outside component ───────────────────────────────────────
|
|
905
925
|
|
|
906
926
|
describe("lifecycle hooks", () => {
|
|
907
|
-
test("onMount outside component is a no-op", () => {
|
|
908
|
-
|
|
927
|
+
test("onMount outside component warns and is a no-op", () => {
|
|
928
|
+
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {})
|
|
929
|
+
expect(() => onMount(() => {})).not.toThrow()
|
|
930
|
+
expect(warnSpy).toHaveBeenCalledWith(
|
|
931
|
+
expect.stringContaining("onMount() called outside component setup"),
|
|
932
|
+
)
|
|
933
|
+
warnSpy.mockRestore()
|
|
909
934
|
})
|
|
910
935
|
|
|
911
|
-
test("onUnmount outside component is a no-op", () => {
|
|
936
|
+
test("onUnmount outside component warns and is a no-op", () => {
|
|
937
|
+
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {})
|
|
912
938
|
expect(() => onUnmount(() => {})).not.toThrow()
|
|
939
|
+
expect(warnSpy).toHaveBeenCalledWith(
|
|
940
|
+
expect.stringContaining("onUnmount() called outside component setup"),
|
|
941
|
+
)
|
|
942
|
+
warnSpy.mockRestore()
|
|
913
943
|
})
|
|
914
944
|
|
|
915
|
-
test("onUpdate outside component is a no-op", () => {
|
|
945
|
+
test("onUpdate outside component warns and is a no-op", () => {
|
|
946
|
+
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {})
|
|
916
947
|
expect(() => onUpdate(() => {})).not.toThrow()
|
|
948
|
+
expect(warnSpy).toHaveBeenCalledWith(
|
|
949
|
+
expect.stringContaining("onUpdate() called outside component setup"),
|
|
950
|
+
)
|
|
951
|
+
warnSpy.mockRestore()
|
|
917
952
|
})
|
|
918
953
|
|
|
919
|
-
test("onErrorCaptured outside component is a no-op", () => {
|
|
954
|
+
test("onErrorCaptured outside component warns and is a no-op", () => {
|
|
955
|
+
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {})
|
|
920
956
|
expect(() => onErrorCaptured(() => true)).not.toThrow()
|
|
957
|
+
expect(warnSpy).toHaveBeenCalledWith(
|
|
958
|
+
expect.stringContaining("onErrorCaptured() called outside component setup"),
|
|
959
|
+
)
|
|
960
|
+
warnSpy.mockRestore()
|
|
921
961
|
})
|
|
922
962
|
})
|
|
923
963
|
|
|
@@ -1223,4 +1263,11 @@ describe("Dynamic", () => {
|
|
|
1223
1263
|
const result = Dynamic({ component: "" })
|
|
1224
1264
|
expect(result).toBeNull()
|
|
1225
1265
|
})
|
|
1266
|
+
|
|
1267
|
+
test("warns when component prop is falsy", () => {
|
|
1268
|
+
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {})
|
|
1269
|
+
Dynamic({ component: "" })
|
|
1270
|
+
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("<Dynamic>"))
|
|
1271
|
+
warnSpy.mockRestore()
|
|
1272
|
+
})
|
|
1226
1273
|
})
|
|
@@ -13,12 +13,12 @@ describe("JSX type compat (via h)", () => {
|
|
|
13
13
|
})
|
|
14
14
|
|
|
15
15
|
test("callback ref", () => {
|
|
16
|
-
let
|
|
16
|
+
let _captured: Element | null = null
|
|
17
17
|
const el = h(
|
|
18
18
|
"div",
|
|
19
19
|
{
|
|
20
20
|
ref: (e: Element) => {
|
|
21
|
-
|
|
21
|
+
_captured = e
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
24
|
"test",
|
package/src/types.ts
CHANGED
|
@@ -53,7 +53,8 @@ export interface NativeItem {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export interface LifecycleHooks {
|
|
56
|
-
|
|
56
|
+
// biome-ignore lint/suspicious/noConfusingVoidType: void allows callbacks that return nothing
|
|
57
|
+
mount: (() => CleanupFn | void | undefined)[]
|
|
57
58
|
unmount: (() => void)[]
|
|
58
59
|
update: (() => void)[]
|
|
59
60
|
/** Error handlers — return true to mark the error as handled (stops propagation). */
|