@pyreon/solid-compat 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,148 @@
1
+ import { ErrorBoundary, For, Fragment, Match, Show, Suspense, Switch, h, onUnmount } from "@pyreon/core";
2
+ import { runUntracked, signal } from "@pyreon/reactivity";
3
+
4
+ //#region src/jsx-runtime.ts
5
+ let _currentCtx = null;
6
+ let _hookIndex = 0;
7
+ function beginRender(ctx) {
8
+ _currentCtx = ctx;
9
+ _hookIndex = 0;
10
+ ctx.pendingEffects = [];
11
+ ctx.pendingLayoutEffects = [];
12
+ }
13
+ function endRender() {
14
+ _currentCtx = null;
15
+ _hookIndex = 0;
16
+ }
17
+ function runLayoutEffects(entries) {
18
+ for (const entry of entries) {
19
+ if (entry.cleanup) entry.cleanup();
20
+ const cleanup = entry.fn();
21
+ entry.cleanup = typeof cleanup === "function" ? cleanup : void 0;
22
+ }
23
+ }
24
+ function scheduleEffects(ctx, entries) {
25
+ if (entries.length === 0) return;
26
+ queueMicrotask(() => {
27
+ for (const entry of entries) {
28
+ if (ctx.unmounted) return;
29
+ if (entry.cleanup) entry.cleanup();
30
+ const cleanup = entry.fn();
31
+ entry.cleanup = typeof cleanup === "function" ? cleanup : void 0;
32
+ }
33
+ });
34
+ }
35
+ const _CHILD_INSTANCE = Symbol.for("pyreon.childInstance");
36
+ const noop = () => {};
37
+ const _wrapperCache = /* @__PURE__ */ new WeakMap();
38
+ const _nativeComponents = new Set([
39
+ Show,
40
+ For,
41
+ Switch,
42
+ Match,
43
+ Suspense,
44
+ ErrorBoundary
45
+ ]);
46
+ function wrapCompatComponent(solidComponent) {
47
+ if (_nativeComponents.has(solidComponent)) return solidComponent;
48
+ let wrapped = _wrapperCache.get(solidComponent);
49
+ if (wrapped) return wrapped;
50
+ wrapped = ((props) => {
51
+ const existing = props[_CHILD_INSTANCE];
52
+ const ctx = existing?.ctx ?? {
53
+ hooks: [],
54
+ scheduleRerender: () => {},
55
+ pendingEffects: [],
56
+ pendingLayoutEffects: [],
57
+ unmounted: false,
58
+ unmountCallbacks: []
59
+ };
60
+ if (existing) {
61
+ ctx.unmounted = false;
62
+ ctx.unmountCallbacks = [];
63
+ }
64
+ const version = existing?.version ?? signal(0);
65
+ let updateScheduled = existing?.updateScheduled ?? false;
66
+ ctx.scheduleRerender = () => {
67
+ if (ctx.unmounted || updateScheduled) return;
68
+ updateScheduled = true;
69
+ queueMicrotask(() => {
70
+ updateScheduled = false;
71
+ if (!ctx.unmounted) version.set(version.peek() + 1);
72
+ });
73
+ };
74
+ onUnmount(() => {
75
+ ctx.unmounted = true;
76
+ for (const cb of ctx.unmountCallbacks) cb();
77
+ });
78
+ const { [_CHILD_INSTANCE]: _stripped, ...cleanProps } = props;
79
+ return () => {
80
+ version();
81
+ beginRender(ctx);
82
+ const result = runUntracked(() => solidComponent(cleanProps));
83
+ const layoutEffects = ctx.pendingLayoutEffects;
84
+ const effects = ctx.pendingEffects;
85
+ endRender();
86
+ runLayoutEffects(layoutEffects);
87
+ scheduleEffects(ctx, effects);
88
+ return result;
89
+ };
90
+ });
91
+ if ("__loading" in solidComponent) wrapped.__loading = solidComponent.__loading;
92
+ _wrapperCache.set(solidComponent, wrapped);
93
+ return wrapped;
94
+ }
95
+ function createChildInstance() {
96
+ return {
97
+ ctx: {
98
+ hooks: [],
99
+ scheduleRerender: noop,
100
+ pendingEffects: [],
101
+ pendingLayoutEffects: [],
102
+ unmounted: false,
103
+ unmountCallbacks: []
104
+ },
105
+ version: signal(0),
106
+ updateScheduled: false
107
+ };
108
+ }
109
+ /**
110
+ * During a parent component render, get or create the child instance at the
111
+ * current hook index. Returns undefined when called outside a component render.
112
+ */
113
+ function resolveChildInstance() {
114
+ const parentCtx = _currentCtx;
115
+ if (!parentCtx) return void 0;
116
+ const idx = _hookIndex++;
117
+ if (idx < parentCtx.hooks.length) return parentCtx.hooks[idx];
118
+ const instance = createChildInstance();
119
+ parentCtx.hooks[idx] = instance;
120
+ return instance;
121
+ }
122
+ function jsx(type, props, key) {
123
+ const { children, ...rest } = props;
124
+ const propsWithKey = key != null ? {
125
+ ...rest,
126
+ key
127
+ } : rest;
128
+ if (typeof type === "function") {
129
+ if (_nativeComponents.has(type)) return h(type, children !== void 0 ? {
130
+ ...propsWithKey,
131
+ children
132
+ } : propsWithKey);
133
+ const wrapped = wrapCompatComponent(type);
134
+ const componentProps = children !== void 0 ? {
135
+ ...propsWithKey,
136
+ children
137
+ } : { ...propsWithKey };
138
+ const childInstance = resolveChildInstance();
139
+ if (childInstance) componentProps[_CHILD_INSTANCE] = childInstance;
140
+ return h(wrapped, componentProps);
141
+ }
142
+ return h(type, propsWithKey, ...children === void 0 ? [] : Array.isArray(children) ? children : [children]);
143
+ }
144
+ const jsxs = jsx;
145
+
146
+ //#endregion
147
+ export { Fragment, jsx, jsxs };
148
+ //# sourceMappingURL=jsx-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-runtime.js","names":[],"sources":["../src/jsx-runtime.ts"],"sourcesContent":["/**\n * Compat JSX runtime for SolidJS compatibility mode.\n *\n * When `jsxImportSource` is redirected to `@pyreon/solid-compat` (via the vite\n * plugin's `compat: \"solid\"` option), OXC rewrites JSX to import from this file.\n *\n * For component VNodes, we wrap the component function so it returns a reactive\n * accessor — enabling Solid-style re-renders on state change while Pyreon's\n * existing renderer handles all DOM work.\n *\n * The component body runs inside `runUntracked` to prevent signal reads (from\n * createSignal getters) from being tracked by the reactive accessor. Only the\n * version signal triggers re-renders.\n *\n * ## Child instance preservation\n *\n * When a parent component re-renders, mountReactive does a full teardown+rebuild\n * of the DOM tree. Without preservation, child components get brand new\n * RenderContexts with empty hooks arrays — causing `onMount` and `onCleanup`\n * to fire again, which can trigger infinite re-render loops.\n *\n * To fix this, we store child RenderContexts in the parent's hooks array (indexed\n * by the parent's hook counter). When the child wrapper is called again after a\n * parent re-render, it reuses the existing ctx (preserving hooks state), so\n * hook-indexed guards like `if (idx >= ctx.hooks.length) return` work correctly\n * and lifecycle hooks don't re-fire.\n */\n\nimport type { ComponentFn, Props, VNode, VNodeChild } from \"@pyreon/core\"\nimport {\n ErrorBoundary,\n For,\n Fragment,\n h,\n Match,\n onUnmount,\n Show,\n Suspense,\n Switch,\n} from \"@pyreon/core\"\nimport { runUntracked, signal } from \"@pyreon/reactivity\"\n\nexport { Fragment }\n\n// ─── Render context (used by hooks) ──────────────────────────────────────────\n\nexport interface RenderContext {\n hooks: unknown[]\n scheduleRerender: () => void\n /** Effect entries pending execution after render */\n pendingEffects: EffectEntry[]\n /** Layout effect entries pending execution after render */\n pendingLayoutEffects: EffectEntry[]\n /** Set to true when the component is unmounted */\n unmounted: boolean\n /** Callbacks to run on unmount (lifecycle + effect cleanups) */\n unmountCallbacks: (() => void)[]\n}\n\nexport interface EffectEntry {\n // biome-ignore lint/suspicious/noConfusingVoidType: matches Solid's effect signature\n fn: () => (() => void) | void\n deps: unknown[] | undefined\n cleanup: (() => void) | undefined\n}\n\nlet _currentCtx: RenderContext | null = null\nlet _hookIndex = 0\n\nexport function getCurrentCtx(): RenderContext | null {\n return _currentCtx\n}\n\nexport function getHookIndex(): number {\n return _hookIndex++\n}\n\nexport function beginRender(ctx: RenderContext): void {\n _currentCtx = ctx\n _hookIndex = 0\n ctx.pendingEffects = []\n ctx.pendingLayoutEffects = []\n}\n\nexport function endRender(): void {\n _currentCtx = null\n _hookIndex = 0\n}\n\n// ─── Effect runners ──────────────────────────────────────────────────────────\n\nfunction runLayoutEffects(entries: EffectEntry[]): void {\n for (const entry of entries) {\n if (entry.cleanup) entry.cleanup()\n const cleanup = entry.fn()\n entry.cleanup = typeof cleanup === \"function\" ? cleanup : undefined\n }\n}\n\nfunction scheduleEffects(ctx: RenderContext, entries: EffectEntry[]): void {\n if (entries.length === 0) return\n queueMicrotask(() => {\n for (const entry of entries) {\n if (ctx.unmounted) return\n if (entry.cleanup) entry.cleanup()\n const cleanup = entry.fn()\n entry.cleanup = typeof cleanup === \"function\" ? cleanup : undefined\n }\n })\n}\n\n// ─── Child instance preservation ─────────────────────────────────────────────\n\n/** Stored in the parent's hooks array to preserve child state across re-renders */\ninterface ChildInstance {\n ctx: RenderContext\n version: ReturnType<typeof signal<number>>\n updateScheduled: boolean\n}\n\n// Internal prop keys for passing parent context info to child wrappers\nconst _CHILD_INSTANCE = Symbol.for(\"pyreon.childInstance\")\nconst noop = () => {\n /* noop */\n}\n\n// ─── Component wrapping ──────────────────────────────────────────────────────\n\n// biome-ignore lint/complexity/noBannedTypes: Function is needed for generic component wrapping\nconst _wrapperCache = new WeakMap<Function, ComponentFn>()\n\n// Pyreon core components that must NOT be wrapped — they rely on internal reactivity\n// biome-ignore lint/complexity/noBannedTypes: Function is needed for generic component set\nconst _nativeComponents: Set<Function> = new Set([\n Show,\n For,\n Switch,\n Match,\n Suspense,\n ErrorBoundary,\n])\n\n// biome-ignore lint/complexity/noBannedTypes: Function is needed for generic component wrapping\nfunction wrapCompatComponent(solidComponent: Function): ComponentFn {\n if (_nativeComponents.has(solidComponent)) return solidComponent as ComponentFn\n\n let wrapped = _wrapperCache.get(solidComponent)\n if (wrapped) return wrapped\n\n // The wrapper returns a reactive accessor (() => VNodeChild) which Pyreon's\n // mountChild treats as a reactive expression via mountReactive.\n wrapped = ((props: Props) => {\n // Check for a preserved child instance from the parent's hooks\n const existing = (props as Record<symbol, unknown>)[_CHILD_INSTANCE] as\n | ChildInstance\n | undefined\n\n const ctx: RenderContext = existing?.ctx ?? {\n hooks: [],\n scheduleRerender: () => {\n // Will be replaced below after version signal is created\n },\n pendingEffects: [],\n pendingLayoutEffects: [],\n unmounted: false,\n unmountCallbacks: [],\n }\n\n // When reusing an existing ctx after parent re-render, reset unmounted flag\n // and clear stale unmount callbacks (they belong to the previous mount cycle)\n if (existing) {\n ctx.unmounted = false\n ctx.unmountCallbacks = []\n }\n\n const version = existing?.version ?? signal(0)\n\n // Use a shared updateScheduled flag (preserved across parent re-renders)\n let updateScheduled = existing?.updateScheduled ?? false\n\n ctx.scheduleRerender = () => {\n if (ctx.unmounted || updateScheduled) return\n updateScheduled = true\n queueMicrotask(() => {\n updateScheduled = false\n if (!ctx.unmounted) version.set(version.peek() + 1)\n })\n }\n\n // Register cleanup when component unmounts\n onUnmount(() => {\n ctx.unmounted = true\n for (const cb of ctx.unmountCallbacks) cb()\n })\n\n // Strip the internal prop before passing to the component\n const { [_CHILD_INSTANCE]: _stripped, ...cleanProps } = props as Record<\n string | symbol,\n unknown\n >\n\n // Return reactive accessor — Pyreon's mountChild calls mountReactive\n return () => {\n version() // tracked read — triggers re-execution when state changes\n beginRender(ctx)\n // runUntracked prevents signal reads (from createSignal getters) from\n // being tracked by this accessor — only the version signal should trigger re-renders\n const result = runUntracked(() => (solidComponent as ComponentFn)(cleanProps as Props))\n const layoutEffects = ctx.pendingLayoutEffects\n const effects = ctx.pendingEffects\n endRender()\n\n runLayoutEffects(layoutEffects)\n scheduleEffects(ctx, effects)\n\n return result\n }\n }) as unknown as ComponentFn\n\n // Forward __loading from lazy components so Pyreon's Suspense can detect them\n if (\"__loading\" in solidComponent) {\n ;(wrapped as unknown as Record<string, unknown>).__loading = (\n solidComponent as unknown as Record<string, unknown>\n ).__loading\n }\n\n _wrapperCache.set(solidComponent, wrapped)\n return wrapped\n}\n\n// ─── Child instance lookup ───────────────────────────────────────────────────\n\nfunction createChildInstance(): ChildInstance {\n return {\n ctx: {\n hooks: [],\n scheduleRerender: noop,\n pendingEffects: [],\n pendingLayoutEffects: [],\n unmounted: false,\n unmountCallbacks: [],\n },\n version: signal(0),\n updateScheduled: false,\n }\n}\n\n/**\n * During a parent component render, get or create the child instance at the\n * current hook index. Returns undefined when called outside a component render.\n */\nfunction resolveChildInstance(): ChildInstance | undefined {\n const parentCtx = _currentCtx\n if (!parentCtx) return undefined\n\n const idx = _hookIndex++\n if (idx < parentCtx.hooks.length) {\n return parentCtx.hooks[idx] as ChildInstance\n }\n const instance = createChildInstance()\n parentCtx.hooks[idx] = instance\n return instance\n}\n\n// ─── JSX functions ───────────────────────────────────────────────────────────\n\nexport function jsx(\n type: string | ComponentFn | symbol,\n props: Props & { children?: VNodeChild | VNodeChild[] },\n key?: string | number | null,\n): VNode {\n const { children, ...rest } = props\n const propsWithKey = (key != null ? { ...rest, key } : rest) as Props\n\n if (typeof type === \"function\") {\n if (_nativeComponents.has(type)) {\n const componentProps = children !== undefined ? { ...propsWithKey, children } : propsWithKey\n return h(type as ComponentFn, componentProps)\n }\n\n const wrapped = wrapCompatComponent(type)\n const componentProps =\n children !== undefined ? { ...propsWithKey, children } : { ...propsWithKey }\n\n const childInstance = resolveChildInstance()\n if (childInstance) {\n ;(componentProps as Record<symbol, unknown>)[_CHILD_INSTANCE] = childInstance\n }\n\n return h(wrapped, componentProps)\n }\n\n // DOM element or symbol (Fragment): children go in vnode.children\n const childArray = children === undefined ? [] : Array.isArray(children) ? children : [children]\n\n return h(type, propsWithKey, ...(childArray as VNodeChild[]))\n}\n\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n"],"mappings":";;;;AAkEA,IAAI,cAAoC;AACxC,IAAI,aAAa;AAUjB,SAAgB,YAAY,KAA0B;AACpD,eAAc;AACd,cAAa;AACb,KAAI,iBAAiB,EAAE;AACvB,KAAI,uBAAuB,EAAE;;AAG/B,SAAgB,YAAkB;AAChC,eAAc;AACd,cAAa;;AAKf,SAAS,iBAAiB,SAA8B;AACtD,MAAK,MAAM,SAAS,SAAS;AAC3B,MAAI,MAAM,QAAS,OAAM,SAAS;EAClC,MAAM,UAAU,MAAM,IAAI;AAC1B,QAAM,UAAU,OAAO,YAAY,aAAa,UAAU;;;AAI9D,SAAS,gBAAgB,KAAoB,SAA8B;AACzE,KAAI,QAAQ,WAAW,EAAG;AAC1B,sBAAqB;AACnB,OAAK,MAAM,SAAS,SAAS;AAC3B,OAAI,IAAI,UAAW;AACnB,OAAI,MAAM,QAAS,OAAM,SAAS;GAClC,MAAM,UAAU,MAAM,IAAI;AAC1B,SAAM,U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A+C,YAC/C,eACA;AAGJ,eAAc,IAAI,gBAAgB,QAAQ;AAC1C,QAAO;;AAKT,SAAS,sBAAqC;AAC5C,QAAO;EACL,KAAK;GACH,OAAO,EAAE;GACT,kBAAkB;GAClB,gBAAgB,EAAE;GAClB,sBAAsB,EAAE;GACxB,WAAW;GACX,kBAAkB,EAAE;GACrB;EACD,SAAS,OAAO,EAAE;EAClB,iBAAiB;EAClB;;;;;;AAOH,SAAS,uBAAkD;CACzD,MAAM,YAAY;AAClB,KAAI,CAAC,UAAW,QAAO;CAEvB,MAAM,MAAM;AACZ,KAAI,MAAM,UAAU,MAAM,OACxB,QAAO,UAAU,MAAM;CAEzB,MAAM,WAAW,qBAAqB;AACtC,WAAU,MAAM,OAAO;AACvB,QAAO;;AAKT,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,YAAY;AAC9B,MAAI,kBAAkB,IAAI,KAAK,CAE7B,QAAO,EAAE,MADc,aAAa,SAAY;GAAE,GAAG;GAAc;GAAU,GAAG,aACnC;EAG/C,MAAM,UAAU,oBAAoB,KAAK;EACzC,MAAM,iBACJ,aAAa,SAAY;GAAE,GAAG;GAAc;GAAU,GAAG,EAAE,GAAG,cAAc;EAE9E,MAAM,gBAAgB,sBAAsB;AAC5C,MAAI,cACD,CAAC,eAA2C,mBAAmB;AAGlE,SAAO,EAAE,SAAS,eAAe;;AAMnC,QAAO,EAAE,MAAM,cAAc,GAFV,aAAa,SAAY,EAAE,GAAG,MAAM,QAAQ,SAAS,GAAG,WAAW,CAAC,SAAS,CAEnC;;AAG/D,MAAa,OAAO"}
@@ -0,0 +1,142 @@
1
+ import { ErrorBoundary, For, Fragment, Match, Show, Suspense, Switch, h, onUnmount } from "@pyreon/core";
2
+ import { runUntracked, signal } from "@pyreon/reactivity";
3
+
4
+ //#region src/jsx-runtime.ts
5
+
6
+ function beginRender(ctx) {
7
+ _currentCtx = ctx;
8
+ _hookIndex = 0;
9
+ ctx.pendingEffects = [];
10
+ ctx.pendingLayoutEffects = [];
11
+ }
12
+ function endRender() {
13
+ _currentCtx = null;
14
+ _hookIndex = 0;
15
+ }
16
+ function runLayoutEffects(entries) {
17
+ for (const entry of entries) {
18
+ if (entry.cleanup) entry.cleanup();
19
+ const cleanup = entry.fn();
20
+ entry.cleanup = typeof cleanup === "function" ? cleanup : void 0;
21
+ }
22
+ }
23
+ function scheduleEffects(ctx, entries) {
24
+ if (entries.length === 0) return;
25
+ queueMicrotask(() => {
26
+ for (const entry of entries) {
27
+ if (ctx.unmounted) return;
28
+ if (entry.cleanup) entry.cleanup();
29
+ const cleanup = entry.fn();
30
+ entry.cleanup = typeof cleanup === "function" ? cleanup : void 0;
31
+ }
32
+ });
33
+ }
34
+ function wrapCompatComponent(solidComponent) {
35
+ if (_nativeComponents.has(solidComponent)) return solidComponent;
36
+ let wrapped = _wrapperCache.get(solidComponent);
37
+ if (wrapped) return wrapped;
38
+ wrapped = props => {
39
+ const existing = props[_CHILD_INSTANCE];
40
+ const ctx = existing?.ctx ?? {
41
+ hooks: [],
42
+ scheduleRerender: () => {},
43
+ pendingEffects: [],
44
+ pendingLayoutEffects: [],
45
+ unmounted: false,
46
+ unmountCallbacks: []
47
+ };
48
+ if (existing) {
49
+ ctx.unmounted = false;
50
+ ctx.unmountCallbacks = [];
51
+ }
52
+ const version = existing?.version ?? signal(0);
53
+ let updateScheduled = existing?.updateScheduled ?? false;
54
+ ctx.scheduleRerender = () => {
55
+ if (ctx.unmounted || updateScheduled) return;
56
+ updateScheduled = true;
57
+ queueMicrotask(() => {
58
+ updateScheduled = false;
59
+ if (!ctx.unmounted) version.set(version.peek() + 1);
60
+ });
61
+ };
62
+ onUnmount(() => {
63
+ ctx.unmounted = true;
64
+ for (const cb of ctx.unmountCallbacks) cb();
65
+ });
66
+ const {
67
+ [_CHILD_INSTANCE]: _stripped,
68
+ ...cleanProps
69
+ } = props;
70
+ return () => {
71
+ version();
72
+ beginRender(ctx);
73
+ const result = runUntracked(() => solidComponent(cleanProps));
74
+ const layoutEffects = ctx.pendingLayoutEffects;
75
+ const effects = ctx.pendingEffects;
76
+ endRender();
77
+ runLayoutEffects(layoutEffects);
78
+ scheduleEffects(ctx, effects);
79
+ return result;
80
+ };
81
+ };
82
+ if ("__loading" in solidComponent) wrapped.__loading = solidComponent.__loading;
83
+ _wrapperCache.set(solidComponent, wrapped);
84
+ return wrapped;
85
+ }
86
+ function createChildInstance() {
87
+ return {
88
+ ctx: {
89
+ hooks: [],
90
+ scheduleRerender: noop,
91
+ pendingEffects: [],
92
+ pendingLayoutEffects: [],
93
+ unmounted: false,
94
+ unmountCallbacks: []
95
+ },
96
+ version: signal(0),
97
+ updateScheduled: false
98
+ };
99
+ }
100
+ /**
101
+ * During a parent component render, get or create the child instance at the
102
+ * current hook index. Returns undefined when called outside a component render.
103
+ */
104
+ function resolveChildInstance() {
105
+ const parentCtx = _currentCtx;
106
+ if (!parentCtx) return void 0;
107
+ const idx = _hookIndex++;
108
+ if (idx < parentCtx.hooks.length) return parentCtx.hooks[idx];
109
+ const instance = createChildInstance();
110
+ parentCtx.hooks[idx] = instance;
111
+ return instance;
112
+ }
113
+ function jsx(type, props, key) {
114
+ const {
115
+ children,
116
+ ...rest
117
+ } = props;
118
+ const propsWithKey = key != null ? {
119
+ ...rest,
120
+ key
121
+ } : rest;
122
+ if (typeof type === "function") {
123
+ if (_nativeComponents.has(type)) return h(type, children !== void 0 ? {
124
+ ...propsWithKey,
125
+ children
126
+ } : propsWithKey);
127
+ const wrapped = wrapCompatComponent(type);
128
+ const componentProps = children !== void 0 ? {
129
+ ...propsWithKey,
130
+ children
131
+ } : {
132
+ ...propsWithKey
133
+ };
134
+ const childInstance = resolveChildInstance();
135
+ if (childInstance) componentProps[_CHILD_INSTANCE] = childInstance;
136
+ return h(wrapped, componentProps);
137
+ }
138
+ return h(type, propsWithKey, ...(children === void 0 ? [] : Array.isArray(children) ? children : [children]));
139
+ }
140
+ //#endregion
141
+ export { Fragment, jsx, jsxs };
142
+ //# sourceMappingURL=jsx-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-runtime.d.ts","names":[],"sources":["../../src/jsx-runtime.ts"],"mappings":";;;;;AA6EA,SAAgB,WAAA,CAAY,GAAA,EAA0B;EACpD,WAAA,GAAc,GAAA;EACd,UAAA,GAAa,CAAA;EACb,GAAA,CAAI,cAAA,GAAiB,EAAE;EACvB,GAAA,CAAI,oBAAA,GAAuB,EAAE;;AAG/B,SAAgB,SAAA,CAAA,EAAkB;EAChC,WAAA,GAAc,IAAA;EACd,UAAA,GAAa,CAAA;;AAKf,SAAS,gBAAA,CAAiB,OAAA,EAA8B;EACtD,KAAK,MAAM,KAAA,IAAS,OAAA,EAAS;IAC3B,IAAI,KAAA,CAAM,OAAA,EAAS,KAAA,CAAM,OAAA,CAAA,CAAS;IAClC,MAAM,OAAA,GAAU,KAAA,CAAM,EAAA,CAAA,CAAI;IAC1B,KAAA,CAAM,OAAA,GAAU,OAAO,OAAA,KAAY,UAAA,GAAa,OAAA,GAAU,KAAA,CAAA;;;AAI9D,SAAS,eAAA,CAAgB,GAAA,EAAoB,OAAA,EAA8B;EACzE,IAAI,OAAA,CAAQ,MAAA,KAAW,CAAA,EAAG;EAC1B,cAAA,CAAA,MAAqB;IACnB,KAAK,MAAM,KAAA,IAAS,OAAA,EAAS;MAC3B,IAAI,GAAA,CAAI,SAAA,EAAW;MACnB,IAAI,KAAA,CAAM,OAAA,EAAS,KAAA,CAAM,OAAA,CAAA,CAAS;MAClC,MAAM,OAAA,GAAU,KAAA,CAAM,EAAA,CAAA,CAAI;MAC1B,KAAA,CAAM,OAAA,GAAU,OAAO,OAAA,KAAY,UAAA,GAAa,OAAA,GAAU,KAAA,CAAA;;IAE5D;;AAmCJ,SAAS,mBAAA,CAAoB,cAAA,EAAuC;EAClE,IAAI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AAA,CAAA,GAAS,KAAA;EAC9B,MAAM,YAAA,GAAgB,GAAA,IAAO,IAAA,GAAO;IAAE,GAAG,IAAA;IAAM;GAAK,GAAG,IAAA;EAEvD,IAAI,OAAO,IAAA,KAAS,UAAA,EAAY;IAC9B,IAAI,iBAAA,CAAkB,GAAA,CAAI,IAAA,CAAK,EAE7B,OAAO,CAAA,CAAE,IAAA,EADc,QAAA,KAAa,KAAA,CAAA,GAAY;MAAE,GAAG,YAAA;MAAc;KAAU,GAAG,YAAA,CACnC;IAG/C,MAAM,OAAA,GAAU,mBAAA,CAAoB,IAAA,CAAK;IACzC,MAAM,cAAA,GACJ,QAAA,KAAa,KAAA,CAAA,GAAY;MAAE,GAAG,YAAA;MAAc;KAAU,GAAG;MAAE,GAAG;IAAA,CAAc;IAE9E,MAAM,aAAA,GAAgB,oBAAA,CAAA,CAAsB;IAC5C,IAAI,aAAA,EACA,cAAA,CAA2C,eAAA,CAAA,GAAmB,aAAA;IAGlE,OAAO,CAAA,CAAE,OAAA,EAAS,cAAA,CAAe;;EAMnC,OAAO,CAAA,CAAE,IAAA,EAAM,YAAA,EAAc,IAFV,QAAA,KAAa,KAAA,CAAA,GAAY,EAAE,GAAG,KAAA,CAAM,OAAA,CAAQ,QAAA,CAAS,GAAG,QAAA,GAAW,CAAC,QAAA,CAAS,EAEnC"}
@@ -0,0 +1,10 @@
1
+ import { ComponentFn, Fragment, Props, VNode, VNodeChild } from "@pyreon/core";
2
+
3
+ //#region src/jsx-runtime.d.ts
4
+ declare function jsx(type: string | ComponentFn | symbol, props: Props & {
5
+ children?: VNodeChild | VNodeChild[];
6
+ }, key?: string | number | null): VNode;
7
+ declare const jsxs: typeof jsx;
8
+ //#endregion
9
+ export { Fragment, jsx, jsxs };
10
+ //# sourceMappingURL=jsx-runtime2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-runtime2.d.ts","names":[],"sources":["../../src/jsx-runtime.ts"],"mappings":";;;iBA0QgB,GAAA,CACd,IAAA,WAAe,WAAA,WACf,KAAA,EAAO,KAAA;EAAU,QAAA,GAAW,UAAA,GAAa,UAAA;AAAA,GACzC,GAAA,4BACC,KAAA;AAAA,cA4BU,IAAA,SAAI,GAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyreon/solid-compat",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "SolidJS-compatible API shim for Pyreon — write Solid-style code that runs on Pyreon's reactive engine",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -49,9 +49,9 @@
49
49
  "prepublishOnly": "bun run build"
50
50
  },
51
51
  "dependencies": {
52
- "@pyreon/core": "^0.4.0",
53
- "@pyreon/reactivity": "^0.4.0",
54
- "@pyreon/runtime-dom": "^0.4.0"
52
+ "@pyreon/core": "^0.5.1",
53
+ "@pyreon/reactivity": "^0.5.1",
54
+ "@pyreon/runtime-dom": "^0.5.1"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@happy-dom/global-registrator": "^20.8.3",
@@ -0,0 +1 @@
1
+ export { Fragment, jsx, jsxs } from "./jsx-runtime"