@pyreon/react-compat 0.5.6 → 0.5.7
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/lib/types/dom.d.ts +14 -34
- package/lib/types/dom.d.ts.map +1 -1
- package/lib/types/index.d.ts +50 -198
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/jsx-runtime.d.ts +7 -89
- package/lib/types/jsx-runtime.d.ts.map +1 -1
- package/package.json +4 -4
package/lib/types/dom.d.ts
CHANGED
|
@@ -1,39 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VNodeChild } from "@pyreon/core";
|
|
2
2
|
|
|
3
|
-
//#region src/dom.ts
|
|
3
|
+
//#region src/dom.d.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* createRoot(document.getElementById("app")!).render(<App />)
|
|
16
|
-
*/
|
|
17
|
-
function createRoot(container) {
|
|
18
|
-
let cleanup = null;
|
|
19
|
-
return {
|
|
20
|
-
render(element) {
|
|
21
|
-
if (cleanup) cleanup();
|
|
22
|
-
cleanup = mount(element, container);
|
|
23
|
-
},
|
|
24
|
-
unmount() {
|
|
25
|
-
if (cleanup) {
|
|
26
|
-
cleanup();
|
|
27
|
-
cleanup = null;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
5
|
+
* Drop-in for React 18's `createRoot(container).render(element)`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import { createRoot } from "@pyreon/react-compat/dom"
|
|
9
|
+
* createRoot(document.getElementById("app")!).render(<App />)
|
|
10
|
+
*/
|
|
11
|
+
declare function createRoot(container: Element): {
|
|
12
|
+
render: (element: VNodeChild) => void;
|
|
13
|
+
unmount: () => void;
|
|
14
|
+
};
|
|
32
15
|
/** Alias — matches React 17's `render(element, container)` signature. */
|
|
33
|
-
function render(element, container)
|
|
34
|
-
mount(element, container);
|
|
35
|
-
}
|
|
36
|
-
|
|
16
|
+
declare function render(element: VNodeChild, container: Element): void;
|
|
37
17
|
//#endregion
|
|
38
18
|
export { createRoot, render };
|
|
39
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=dom2.d.ts.map
|
package/lib/types/dom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"dom2.d.ts","names":[],"sources":["../../../src/dom.ts"],"mappings":";;;;;AAgBA;;;;;iBAAgB,UAAA,CAAW,SAAA,EAAW,OAAA;EACpC,MAAA,GAAS,OAAA,EAAS,UAAA;EAClB,OAAA;AAAA;;iBAkBc,MAAA,CAAO,OAAA,EAAS,UAAA,EAAY,SAAA,EAAW,OAAA"}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,214 +1,66 @@
|
|
|
1
|
-
import { ErrorBoundary, Fragment,
|
|
1
|
+
import { ErrorBoundary, Fragment, Props, Suspense, VNode as ReactNode, VNodeChild, VNodeChild as VNodeChild$1, createContext, h, h as createElement, lazy, useContext } from "@pyreon/core";
|
|
2
2
|
import { batch } from "@pyreon/reactivity";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
5
|
-
|
|
6
|
-
function getCurrentCtx() {
|
|
7
|
-
return _currentCtx;
|
|
8
|
-
}
|
|
9
|
-
function getHookIndex() {
|
|
10
|
-
return _hookIndex++;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region src/index.ts
|
|
15
|
-
function requireCtx() {
|
|
16
|
-
const ctx = getCurrentCtx();
|
|
17
|
-
if (!ctx) throw new Error("Hook called outside of a component render");
|
|
18
|
-
return ctx;
|
|
19
|
-
}
|
|
20
|
-
function depsChanged(a, b) {
|
|
21
|
-
if (a === void 0 || b === void 0) return true;
|
|
22
|
-
if (a.length !== b.length) return true;
|
|
23
|
-
for (let i = 0; i < a.length; i++) if (!Object.is(a[i], b[i])) return true;
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
4
|
+
//#region src/index.d.ts
|
|
26
5
|
/**
|
|
27
|
-
* React-compatible `useState` — returns `[value, setter]`.
|
|
28
|
-
* Triggers a component re-render when the setter is called.
|
|
29
|
-
*/
|
|
30
|
-
function useState(initial)
|
|
31
|
-
const ctx = requireCtx();
|
|
32
|
-
const idx = getHookIndex();
|
|
33
|
-
if (ctx.hooks.length <= idx) ctx.hooks.push(typeof initial === "function" ? initial() : initial);
|
|
34
|
-
const value = ctx.hooks[idx];
|
|
35
|
-
const setter = v => {
|
|
36
|
-
const current = ctx.hooks[idx];
|
|
37
|
-
const next = typeof v === "function" ? v(current) : v;
|
|
38
|
-
if (Object.is(current, next)) return;
|
|
39
|
-
ctx.hooks[idx] = next;
|
|
40
|
-
ctx.scheduleRerender();
|
|
41
|
-
};
|
|
42
|
-
return [value, setter];
|
|
43
|
-
}
|
|
6
|
+
* React-compatible `useState` — returns `[value, setter]`.
|
|
7
|
+
* Triggers a component re-render when the setter is called.
|
|
8
|
+
*/
|
|
9
|
+
declare function useState<T>(initial: T | (() => T)): [T, (v: T | ((prev: T) => T)) => void];
|
|
44
10
|
/**
|
|
45
|
-
* React-compatible `useReducer` — returns `[state, dispatch]`.
|
|
46
|
-
*/
|
|
47
|
-
function useReducer(reducer, initial)
|
|
48
|
-
const ctx = requireCtx();
|
|
49
|
-
const idx = getHookIndex();
|
|
50
|
-
if (ctx.hooks.length <= idx) ctx.hooks.push(typeof initial === "function" ? initial() : initial);
|
|
51
|
-
const state = ctx.hooks[idx];
|
|
52
|
-
const dispatch = action => {
|
|
53
|
-
const current = ctx.hooks[idx];
|
|
54
|
-
const next = reducer(current, action);
|
|
55
|
-
if (Object.is(current, next)) return;
|
|
56
|
-
ctx.hooks[idx] = next;
|
|
57
|
-
ctx.scheduleRerender();
|
|
58
|
-
};
|
|
59
|
-
return [state, dispatch];
|
|
60
|
-
}
|
|
11
|
+
* React-compatible `useReducer` — returns `[state, dispatch]`.
|
|
12
|
+
*/
|
|
13
|
+
declare function useReducer<S, A>(reducer: (state: S, action: A) => S, initial: S | (() => S)): [S, (action: A) => void];
|
|
61
14
|
/**
|
|
62
|
-
* React-compatible `useEffect` — runs after render when deps change.
|
|
63
|
-
* Returns cleanup on unmount and before re-running.
|
|
64
|
-
*/
|
|
65
|
-
function useEffect(fn, deps)
|
|
66
|
-
const ctx = requireCtx();
|
|
67
|
-
const idx = getHookIndex();
|
|
68
|
-
if (ctx.hooks.length <= idx) {
|
|
69
|
-
const entry = {
|
|
70
|
-
fn,
|
|
71
|
-
deps,
|
|
72
|
-
cleanup: void 0
|
|
73
|
-
};
|
|
74
|
-
ctx.hooks.push(entry);
|
|
75
|
-
ctx.pendingEffects.push(entry);
|
|
76
|
-
} else {
|
|
77
|
-
const entry = ctx.hooks[idx];
|
|
78
|
-
if (depsChanged(entry.deps, deps)) {
|
|
79
|
-
entry.fn = fn;
|
|
80
|
-
entry.deps = deps;
|
|
81
|
-
ctx.pendingEffects.push(entry);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
15
|
+
* React-compatible `useEffect` — runs after render when deps change.
|
|
16
|
+
* Returns cleanup on unmount and before re-running.
|
|
17
|
+
*/
|
|
18
|
+
declare function useEffect(fn: () => (() => void) | void, deps?: unknown[]): void;
|
|
85
19
|
/**
|
|
86
|
-
* React-compatible `useLayoutEffect` — runs synchronously after DOM mutations.
|
|
87
|
-
*/
|
|
88
|
-
function useLayoutEffect(fn, deps)
|
|
89
|
-
const ctx = requireCtx();
|
|
90
|
-
const idx = getHookIndex();
|
|
91
|
-
if (ctx.hooks.length <= idx) {
|
|
92
|
-
const entry = {
|
|
93
|
-
fn,
|
|
94
|
-
deps,
|
|
95
|
-
cleanup: void 0
|
|
96
|
-
};
|
|
97
|
-
ctx.hooks.push(entry);
|
|
98
|
-
ctx.pendingLayoutEffects.push(entry);
|
|
99
|
-
} else {
|
|
100
|
-
const entry = ctx.hooks[idx];
|
|
101
|
-
if (depsChanged(entry.deps, deps)) {
|
|
102
|
-
entry.fn = fn;
|
|
103
|
-
entry.deps = deps;
|
|
104
|
-
ctx.pendingLayoutEffects.push(entry);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
20
|
+
* React-compatible `useLayoutEffect` — runs synchronously after DOM mutations.
|
|
21
|
+
*/
|
|
22
|
+
declare function useLayoutEffect(fn: () => (() => void) | void, deps?: unknown[]): void;
|
|
108
23
|
/**
|
|
109
|
-
* React-compatible `useMemo` — returns the cached value, recomputed when deps change.
|
|
110
|
-
*/
|
|
111
|
-
function useMemo(fn, deps)
|
|
112
|
-
const ctx = requireCtx();
|
|
113
|
-
const idx = getHookIndex();
|
|
114
|
-
if (ctx.hooks.length <= idx) {
|
|
115
|
-
const value = fn();
|
|
116
|
-
ctx.hooks.push({
|
|
117
|
-
value,
|
|
118
|
-
deps
|
|
119
|
-
});
|
|
120
|
-
return value;
|
|
121
|
-
}
|
|
122
|
-
const entry = ctx.hooks[idx];
|
|
123
|
-
if (depsChanged(entry.deps, deps)) {
|
|
124
|
-
entry.value = fn();
|
|
125
|
-
entry.deps = deps;
|
|
126
|
-
}
|
|
127
|
-
return entry.value;
|
|
128
|
-
}
|
|
24
|
+
* React-compatible `useMemo` — returns the cached value, recomputed when deps change.
|
|
25
|
+
*/
|
|
26
|
+
declare function useMemo<T>(fn: () => T, deps: unknown[]): T;
|
|
129
27
|
/**
|
|
130
|
-
* React-compatible `useCallback` — returns the cached function when deps haven't changed.
|
|
131
|
-
*/
|
|
132
|
-
function useCallback(fn, deps)
|
|
133
|
-
return useMemo(() => fn, deps);
|
|
134
|
-
}
|
|
28
|
+
* React-compatible `useCallback` — returns the cached function when deps haven't changed.
|
|
29
|
+
*/
|
|
30
|
+
declare function useCallback<T extends (...args: never[]) => unknown>(fn: T, deps: unknown[]): T;
|
|
135
31
|
/**
|
|
136
|
-
* React-compatible `useRef` — returns `{ current }` persisted across re-renders.
|
|
137
|
-
*/
|
|
138
|
-
function useRef(initial) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if (ctx.hooks.length <= idx) {
|
|
142
|
-
const ref = {
|
|
143
|
-
current: initial !== void 0 ? initial : null
|
|
144
|
-
};
|
|
145
|
-
ctx.hooks.push(ref);
|
|
146
|
-
}
|
|
147
|
-
return ctx.hooks[idx];
|
|
148
|
-
}
|
|
32
|
+
* React-compatible `useRef` — returns `{ current }` persisted across re-renders.
|
|
33
|
+
*/
|
|
34
|
+
declare function useRef<T>(initial?: T): {
|
|
35
|
+
current: T | null;
|
|
36
|
+
};
|
|
149
37
|
/**
|
|
150
|
-
* React-compatible `useId` — returns a stable unique string per hook call.
|
|
151
|
-
*/
|
|
152
|
-
function useId()
|
|
153
|
-
const ctx = requireCtx();
|
|
154
|
-
const idx = getHookIndex();
|
|
155
|
-
if (ctx.hooks.length <= idx) ctx.hooks.push(`:r${(_idCounter++).toString(36)}:`);
|
|
156
|
-
return ctx.hooks[idx];
|
|
157
|
-
}
|
|
38
|
+
* React-compatible `useId` — returns a stable unique string per hook call.
|
|
39
|
+
*/
|
|
40
|
+
declare function useId(): string;
|
|
158
41
|
/**
|
|
159
|
-
* React-compatible `memo` — wraps a component to skip re-render when props
|
|
160
|
-
* are shallowly equal.
|
|
161
|
-
*/
|
|
162
|
-
function memo(component, areEqual)
|
|
163
|
-
const compare = areEqual ?? ((a, b) => {
|
|
164
|
-
const keysA = Object.keys(a);
|
|
165
|
-
const keysB = Object.keys(b);
|
|
166
|
-
if (keysA.length !== keysB.length) return false;
|
|
167
|
-
for (const k of keysA) if (!Object.is(a[k], b[k])) return false;
|
|
168
|
-
return true;
|
|
169
|
-
});
|
|
170
|
-
let prevProps = null;
|
|
171
|
-
let prevResult = null;
|
|
172
|
-
return props => {
|
|
173
|
-
if (prevProps !== null && compare(prevProps, props)) return prevResult;
|
|
174
|
-
prevProps = props;
|
|
175
|
-
prevResult = component(props);
|
|
176
|
-
return prevResult;
|
|
177
|
-
};
|
|
178
|
-
}
|
|
42
|
+
* React-compatible `memo` — wraps a component to skip re-render when props
|
|
43
|
+
* are shallowly equal.
|
|
44
|
+
*/
|
|
45
|
+
declare function memo<P extends Record<string, unknown>>(component: (props: P) => VNodeChild$1, areEqual?: (prevProps: P, nextProps: P) => boolean): (props: P) => VNodeChild$1;
|
|
179
46
|
/**
|
|
180
|
-
* React-compatible `useTransition` — no concurrent mode in Pyreon.
|
|
181
|
-
*/
|
|
182
|
-
function useTransition()
|
|
183
|
-
return [false, fn => fn()];
|
|
184
|
-
}
|
|
47
|
+
* React-compatible `useTransition` — no concurrent mode in Pyreon.
|
|
48
|
+
*/
|
|
49
|
+
declare function useTransition(): [boolean, (fn: () => void) => void];
|
|
185
50
|
/**
|
|
186
|
-
* React-compatible `useDeferredValue` — returns the value as-is.
|
|
187
|
-
*/
|
|
188
|
-
function useDeferredValue(value)
|
|
189
|
-
return value;
|
|
190
|
-
}
|
|
51
|
+
* React-compatible `useDeferredValue` — returns the value as-is.
|
|
52
|
+
*/
|
|
53
|
+
declare function useDeferredValue<T>(value: T): T;
|
|
191
54
|
/**
|
|
192
|
-
* React-compatible `useImperativeHandle`.
|
|
193
|
-
*/
|
|
194
|
-
function useImperativeHandle(ref
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
return () => {
|
|
198
|
-
if (ref) ref.current = null;
|
|
199
|
-
};
|
|
200
|
-
}, deps);
|
|
201
|
-
}
|
|
55
|
+
* React-compatible `useImperativeHandle`.
|
|
56
|
+
*/
|
|
57
|
+
declare function useImperativeHandle<T>(ref: {
|
|
58
|
+
current: T | null;
|
|
59
|
+
} | null | undefined, init: () => T, deps?: unknown[]): void;
|
|
202
60
|
/**
|
|
203
|
-
* React-compatible `createPortal(children, target)`.
|
|
204
|
-
*/
|
|
205
|
-
function createPortal(children, target)
|
|
206
|
-
return Portal({
|
|
207
|
-
target,
|
|
208
|
-
children
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
|
|
61
|
+
* React-compatible `createPortal(children, target)`.
|
|
62
|
+
*/
|
|
63
|
+
declare function createPortal(children: VNodeChild$1, target: Element): VNodeChild$1;
|
|
212
64
|
//#endregion
|
|
213
|
-
export { ErrorBoundary, Fragment, Suspense, batch, createContext, createElement, createPortal, h, lazy, memo, useCallback, useContext, useDeferredValue, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, useTransition };
|
|
214
|
-
//# sourceMappingURL=
|
|
65
|
+
export { ErrorBoundary, Fragment, type Props, type ReactNode, Suspense, type VNodeChild, batch, createContext, createElement, createPortal, h, lazy, memo, useCallback, useContext, useDeferredValue, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, useTransition };
|
|
66
|
+
//# sourceMappingURL=index2.d.ts.map
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"index2.d.ts","names":[],"sources":["../../../src/index.ts"],"mappings":";;;;;;;;iBA8CgB,QAAA,GAAA,CAAY,OAAA,EAAS,CAAA,UAAW,CAAA,KAAM,CAAA,GAAI,CAAA,EAAG,CAAA,KAAM,IAAA,EAAM,CAAA,KAAM,CAAA;;;;iBAyB/D,UAAA,MAAA,CACd,OAAA,GAAU,KAAA,EAAO,CAAA,EAAG,MAAA,EAAQ,CAAA,KAAM,CAAA,EAClC,OAAA,EAAS,CAAA,UAAW,CAAA,KAClB,CAAA,GAAI,MAAA,EAAQ,CAAA;AAHhB;;;;AAAA,iBA8BgB,SAAA,CAAU,EAAA,6BAA+B,IAAA;;;;iBAuBzC,eAAA,CAAgB,EAAA,6BAA+B,IAAA;;;;iBAuB/C,OAAA,GAAA,CAAW,EAAA,QAAU,CAAA,EAAG,IAAA,cAAkB,CAAA;;;;iBAqB1C,WAAA,eAA0B,IAAA,sBAAA,CAA2B,EAAA,EAAI,CAAA,EAAG,IAAA,cAAkB,CAAA;;;;iBAS9E,MAAA,GAAA,CAAU,OAAA,GAAU,CAAA;EAAM,OAAA,EAAS,CAAA;AAAA;;;;iBAuBnC,KAAA,CAAA;AAnGhB;;;;AAAA,iBAoHgB,IAAA,WAAe,MAAA,kBAAA,CAC7B,SAAA,GAAY,KAAA,EAAO,CAAA,KAAM,YAAA,EACzB,QAAA,IAAY,SAAA,EAAW,CAAA,EAAG,SAAA,EAAW,CAAA,gBACnC,KAAA,EAAO,CAAA,KAAM,YAAA;AAhGjB;;;AAAA,iBA6HgB,aAAA,CAAA,cAA4B,EAAA;;AAtG5C;;iBA6GgB,gBAAA,GAAA,CAAoB,KAAA,EAAO,CAAA,GAAI,CAAA;;;;iBAS/B,mBAAA,GAAA,CACd,GAAA;EAAO,OAAA,EAAS,CAAA;AAAA,sBAChB,IAAA,QAAY,CAAA,EACZ,IAAA;;AApGF;;iBAuHgB,YAAA,CAAa,QAAA,EAAU,YAAA,EAAY,MAAA,EAAQ,OAAA,GAAU,YAAA"}
|
|
@@ -1,92 +1,10 @@
|
|
|
1
|
-
import { Fragment,
|
|
2
|
-
import { signal } from "@pyreon/reactivity";
|
|
1
|
+
import { ComponentFn, Fragment, Props, VNode, VNodeChild } from "@pyreon/core";
|
|
3
2
|
|
|
4
|
-
//#region src/jsx-runtime.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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(reactComponent) {
|
|
35
|
-
let wrapped = _wrapperCache.get(reactComponent);
|
|
36
|
-
if (wrapped) return wrapped;
|
|
37
|
-
wrapped = props => {
|
|
38
|
-
const ctx = {
|
|
39
|
-
hooks: [],
|
|
40
|
-
scheduleRerender: () => {},
|
|
41
|
-
pendingEffects: [],
|
|
42
|
-
pendingLayoutEffects: [],
|
|
43
|
-
unmounted: false
|
|
44
|
-
};
|
|
45
|
-
const version = signal(0);
|
|
46
|
-
let updateScheduled = false;
|
|
47
|
-
ctx.scheduleRerender = () => {
|
|
48
|
-
if (ctx.unmounted || updateScheduled) return;
|
|
49
|
-
updateScheduled = true;
|
|
50
|
-
queueMicrotask(() => {
|
|
51
|
-
updateScheduled = false;
|
|
52
|
-
if (!ctx.unmounted) version.set(version.peek() + 1);
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
return () => {
|
|
56
|
-
version();
|
|
57
|
-
beginRender(ctx);
|
|
58
|
-
const result = reactComponent(props);
|
|
59
|
-
const layoutEffects = ctx.pendingLayoutEffects;
|
|
60
|
-
const effects = ctx.pendingEffects;
|
|
61
|
-
endRender();
|
|
62
|
-
runLayoutEffects(layoutEffects);
|
|
63
|
-
scheduleEffects(ctx, effects);
|
|
64
|
-
return result;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
_wrapperCache.set(reactComponent, wrapped);
|
|
68
|
-
return wrapped;
|
|
69
|
-
}
|
|
70
|
-
function jsx(type, props, key) {
|
|
71
|
-
const {
|
|
72
|
-
children,
|
|
73
|
-
...rest
|
|
74
|
-
} = props;
|
|
75
|
-
const propsWithKey = key != null ? {
|
|
76
|
-
...rest,
|
|
77
|
-
key
|
|
78
|
-
} : rest;
|
|
79
|
-
if (typeof type === "function") return h(wrapCompatComponent(type), children !== void 0 ? {
|
|
80
|
-
...propsWithKey,
|
|
81
|
-
children
|
|
82
|
-
} : propsWithKey);
|
|
83
|
-
const childArray = children === void 0 ? [] : Array.isArray(children) ? children : [children];
|
|
84
|
-
if (typeof type === "string" && propsWithKey.className !== void 0) {
|
|
85
|
-
propsWithKey.class = propsWithKey.className;
|
|
86
|
-
delete propsWithKey.className;
|
|
87
|
-
}
|
|
88
|
-
return h(type, propsWithKey, ...childArray);
|
|
89
|
-
}
|
|
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;
|
|
90
8
|
//#endregion
|
|
91
9
|
export { Fragment, jsx, jsxs };
|
|
92
|
-
//# sourceMappingURL=jsx-
|
|
10
|
+
//# sourceMappingURL=jsx-runtime2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-
|
|
1
|
+
{"version":3,"file":"jsx-runtime2.d.ts","names":[],"sources":["../../../src/jsx-runtime.ts"],"mappings":";;;iBA4IgB,GAAA,CACd,IAAA,WAAe,WAAA,WACf,KAAA,EAAO,KAAA;EAAU,QAAA,GAAW,UAAA,GAAa,UAAA;AAAA,GACzC,GAAA,4BACC,KAAA;AAAA,cAuBU,IAAA,SAAI,GAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/react-compat",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7",
|
|
4
4
|
"description": "React-compatible API shim for Pyreon — write React-style hooks that run on Pyreon's reactive engine",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"prepublishOnly": "bun run build"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@pyreon/core": "^0.5.
|
|
58
|
-
"@pyreon/reactivity": "^0.5.
|
|
59
|
-
"@pyreon/runtime-dom": "^0.5.
|
|
57
|
+
"@pyreon/core": "^0.5.7",
|
|
58
|
+
"@pyreon/reactivity": "^0.5.7",
|
|
59
|
+
"@pyreon/runtime-dom": "^0.5.7"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@happy-dom/global-registrator": "^20.8.3",
|