@pyreon/solid-compat 0.5.6 → 0.6.0
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/index.d.ts +53 -251
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/jsx-runtime.d.ts +7 -139
- package/lib/types/jsx-runtime.d.ts.map +1 -1
- package/package.json +4 -4
package/lib/types/index.d.ts
CHANGED
|
@@ -1,257 +1,59 @@
|
|
|
1
|
-
import { ErrorBoundary, For, Match, Show, Suspense, Switch, createContext as pyreonCreateContext,
|
|
2
|
-
import { batch as pyreonBatch,
|
|
1
|
+
import { ComponentFn, ErrorBoundary, For, LazyComponent, Match, Props, Show, Suspense, Switch, VNodeChild, createContext as pyreonCreateContext, useContext as pyreonUseContext } from "@pyreon/core";
|
|
2
|
+
import { EffectScope, batch as pyreonBatch, runUntracked } from "@pyreon/reactivity";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
function getHookIndex() {
|
|
10
|
-
return _hookIndex++;
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/index.ts
|
|
14
|
-
function createSignal(initialValue) {
|
|
15
|
-
const ctx = getCurrentCtx();
|
|
16
|
-
if (ctx) {
|
|
17
|
-
const idx = getHookIndex();
|
|
18
|
-
if (idx >= ctx.hooks.length) ctx.hooks[idx] = signal(initialValue);
|
|
19
|
-
const s = ctx.hooks[idx];
|
|
20
|
-
const {
|
|
21
|
-
scheduleRerender
|
|
22
|
-
} = ctx;
|
|
23
|
-
const getter = () => s();
|
|
24
|
-
const setter = v => {
|
|
25
|
-
if (typeof v === "function") s.update(v);else s.set(v);
|
|
26
|
-
scheduleRerender();
|
|
27
|
-
};
|
|
28
|
-
return [getter, setter];
|
|
29
|
-
}
|
|
30
|
-
const s = signal(initialValue);
|
|
31
|
-
const getter = () => s();
|
|
32
|
-
const setter = v => {
|
|
33
|
-
if (typeof v === "function") s.update(v);else s.set(v);
|
|
34
|
-
};
|
|
35
|
-
return [getter, setter];
|
|
36
|
-
}
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
type SignalGetter<T> = () => T;
|
|
6
|
+
type SignalSetter<T> = (v: T | ((prev: T) => T)) => void;
|
|
7
|
+
declare function createSignal<T>(initialValue: T): [SignalGetter<T>, SignalSetter<T>];
|
|
37
8
|
/**
|
|
38
|
-
* Solid-compatible `createEffect` — creates a reactive side effect.
|
|
39
|
-
*
|
|
40
|
-
* In component context: hook-indexed, only created on first render. The effect
|
|
41
|
-
* uses Pyreon's native tracking so signal reads are automatically tracked.
|
|
42
|
-
* A re-entrance guard prevents infinite loops from signal writes inside
|
|
43
|
-
* the effect.
|
|
44
|
-
*/
|
|
45
|
-
function createEffect(fn)
|
|
46
|
-
const ctx = getCurrentCtx();
|
|
47
|
-
if (ctx) {
|
|
48
|
-
const idx = getHookIndex();
|
|
49
|
-
if (idx < ctx.hooks.length) return;
|
|
50
|
-
let running = false;
|
|
51
|
-
const e = effect(() => {
|
|
52
|
-
if (running) return;
|
|
53
|
-
running = true;
|
|
54
|
-
try {
|
|
55
|
-
fn();
|
|
56
|
-
} finally {
|
|
57
|
-
running = false;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
const stop = () => e.dispose();
|
|
61
|
-
ctx.hooks[idx] = stop;
|
|
62
|
-
ctx.unmountCallbacks.push(stop);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
effect(fn);
|
|
66
|
-
}
|
|
9
|
+
* Solid-compatible `createEffect` — creates a reactive side effect.
|
|
10
|
+
*
|
|
11
|
+
* In component context: hook-indexed, only created on first render. The effect
|
|
12
|
+
* uses Pyreon's native tracking so signal reads are automatically tracked.
|
|
13
|
+
* A re-entrance guard prevents infinite loops from signal writes inside
|
|
14
|
+
* the effect.
|
|
15
|
+
*/
|
|
16
|
+
declare function createEffect(fn: () => void): void;
|
|
67
17
|
/**
|
|
68
|
-
* Solid-compatible `createRenderEffect` — same as createEffect.
|
|
69
|
-
* In Solid, this runs during the render phase; here it runs as a Pyreon effect.
|
|
70
|
-
*/
|
|
71
|
-
function createRenderEffect(fn)
|
|
72
|
-
createEffect(fn);
|
|
73
|
-
}
|
|
18
|
+
* Solid-compatible `createRenderEffect` — same as createEffect.
|
|
19
|
+
* In Solid, this runs during the render phase; here it runs as a Pyreon effect.
|
|
20
|
+
*/
|
|
21
|
+
declare function createRenderEffect(fn: () => void): void;
|
|
74
22
|
/**
|
|
75
|
-
* Solid-compatible `createMemo` — derives a value from reactive sources.
|
|
76
|
-
*
|
|
77
|
-
* In component context: hook-indexed, only created on first render.
|
|
78
|
-
* Uses Pyreon's native computed for auto-tracking.
|
|
79
|
-
*/
|
|
80
|
-
function createMemo(fn)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const c = ctx.hooks[idx];
|
|
86
|
-
return () => c();
|
|
87
|
-
}
|
|
88
|
-
const c = computed(fn);
|
|
89
|
-
return () => c();
|
|
90
|
-
}
|
|
91
|
-
function createRoot(fn) {
|
|
92
|
-
const scope = effectScope();
|
|
93
|
-
const prev = getCurrentScope();
|
|
94
|
-
setCurrentScope(scope);
|
|
95
|
-
try {
|
|
96
|
-
return fn(() => scope.stop());
|
|
97
|
-
} finally {
|
|
98
|
-
setCurrentScope(prev);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
function on(deps, fn) {
|
|
102
|
-
let prevInput;
|
|
103
|
-
let prevValue;
|
|
104
|
-
let initialized = false;
|
|
105
|
-
return () => {
|
|
106
|
-
const input = Array.isArray(deps) ? deps.map(d => d()) : deps();
|
|
107
|
-
if (!initialized) {
|
|
108
|
-
initialized = true;
|
|
109
|
-
prevValue = fn(input, void 0, void 0);
|
|
110
|
-
prevInput = input;
|
|
111
|
-
return prevValue;
|
|
112
|
-
}
|
|
113
|
-
const result = runUntracked(() => fn(input, prevInput, prevValue));
|
|
114
|
-
prevInput = input;
|
|
115
|
-
prevValue = result;
|
|
116
|
-
return result;
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
function onMount(fn) {
|
|
120
|
-
const ctx = getCurrentCtx();
|
|
121
|
-
if (ctx) {
|
|
122
|
-
const idx = getHookIndex();
|
|
123
|
-
if (idx >= ctx.hooks.length) {
|
|
124
|
-
ctx.hooks[idx] = true;
|
|
125
|
-
ctx.pendingEffects.push({
|
|
126
|
-
fn: () => {
|
|
127
|
-
fn();
|
|
128
|
-
},
|
|
129
|
-
deps: void 0,
|
|
130
|
-
cleanup: void 0
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
onMount$1(fn);
|
|
136
|
-
}
|
|
23
|
+
* Solid-compatible `createMemo` — derives a value from reactive sources.
|
|
24
|
+
*
|
|
25
|
+
* In component context: hook-indexed, only created on first render.
|
|
26
|
+
* Uses Pyreon's native computed for auto-tracking.
|
|
27
|
+
*/
|
|
28
|
+
declare function createMemo<T>(fn: () => T): () => T;
|
|
29
|
+
declare function createRoot<T>(fn: (dispose: () => void) => T): T;
|
|
30
|
+
type AccessorArray = readonly (() => unknown)[];
|
|
31
|
+
type OnEffectFunction<D, V> = (input: D, prevInput: D | undefined, prev: V | undefined) => V;
|
|
32
|
+
declare function on<S extends (() => unknown) | AccessorArray, V>(deps: S, fn: OnEffectFunction<S extends (() => infer R) ? R : S extends readonly (() => infer R)[] ? R[] : never, V>): () => V | undefined;
|
|
137
33
|
/**
|
|
138
|
-
* Solid-compatible `
|
|
139
|
-
*/
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
function
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
function mergeProps(...sources) {
|
|
162
|
-
const target = {};
|
|
163
|
-
for (const source of sources) {
|
|
164
|
-
const descriptors = Object.getOwnPropertyDescriptors(source);
|
|
165
|
-
for (const key of Reflect.ownKeys(descriptors)) {
|
|
166
|
-
const desc = descriptors[key];
|
|
167
|
-
if (!desc) continue;
|
|
168
|
-
if (desc.get) Object.defineProperty(target, key, {
|
|
169
|
-
get: desc.get,
|
|
170
|
-
enumerable: true,
|
|
171
|
-
configurable: true
|
|
172
|
-
});else Object.defineProperty(target, key, {
|
|
173
|
-
value: desc.value,
|
|
174
|
-
writable: true,
|
|
175
|
-
enumerable: true,
|
|
176
|
-
configurable: true
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return target;
|
|
181
|
-
}
|
|
182
|
-
function splitProps(props, ...keys) {
|
|
183
|
-
const picked = {};
|
|
184
|
-
const rest = {};
|
|
185
|
-
const keySet = new Set(keys.flat());
|
|
186
|
-
const descriptors = Object.getOwnPropertyDescriptors(props);
|
|
187
|
-
for (const key of Reflect.ownKeys(descriptors)) {
|
|
188
|
-
const desc = descriptors[key];
|
|
189
|
-
if (!desc) continue;
|
|
190
|
-
const target = typeof key === "string" && keySet.has(key) ? picked : rest;
|
|
191
|
-
if (desc.get) Object.defineProperty(target, key, {
|
|
192
|
-
get: desc.get,
|
|
193
|
-
enumerable: true,
|
|
194
|
-
configurable: true
|
|
195
|
-
});else Object.defineProperty(target, key, {
|
|
196
|
-
value: desc.value,
|
|
197
|
-
writable: true,
|
|
198
|
-
enumerable: true,
|
|
199
|
-
configurable: true
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
return [picked, rest];
|
|
203
|
-
}
|
|
204
|
-
function children(fn) {
|
|
205
|
-
return createMemo(() => {
|
|
206
|
-
const result = fn();
|
|
207
|
-
if (typeof result === "function") return result();
|
|
208
|
-
return result;
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
function lazy(loader) {
|
|
212
|
-
const loaded = signal(null);
|
|
213
|
-
const error = signal(null);
|
|
214
|
-
let promise = null;
|
|
215
|
-
const load = () => {
|
|
216
|
-
if (!promise) promise = loader().then(mod => {
|
|
217
|
-
loaded.set(mod.default);
|
|
218
|
-
return mod;
|
|
219
|
-
}).catch(err => {
|
|
220
|
-
const e = err instanceof Error ? err : new Error(String(err));
|
|
221
|
-
error.set(e);
|
|
222
|
-
promise = null;
|
|
223
|
-
throw e;
|
|
224
|
-
});
|
|
225
|
-
return promise;
|
|
226
|
-
};
|
|
227
|
-
const LazyComponent = props => {
|
|
228
|
-
const err = error();
|
|
229
|
-
if (err) throw err;
|
|
230
|
-
const comp = loaded();
|
|
231
|
-
if (!comp) return null;
|
|
232
|
-
return comp(props);
|
|
233
|
-
};
|
|
234
|
-
LazyComponent.__loading = () => {
|
|
235
|
-
const isLoading = loaded() === null && error() === null;
|
|
236
|
-
if (isLoading) load();
|
|
237
|
-
return isLoading;
|
|
238
|
-
};
|
|
239
|
-
LazyComponent.preload = load;
|
|
240
|
-
return LazyComponent;
|
|
241
|
-
}
|
|
242
|
-
function getOwner() {
|
|
243
|
-
return getCurrentScope();
|
|
244
|
-
}
|
|
245
|
-
function runWithOwner(owner, fn) {
|
|
246
|
-
const prev = getCurrentScope();
|
|
247
|
-
setCurrentScope(owner);
|
|
248
|
-
try {
|
|
249
|
-
return fn();
|
|
250
|
-
} finally {
|
|
251
|
-
setCurrentScope(prev);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
34
|
+
* Solid-compatible `onMount` — runs once after the component's first render.
|
|
35
|
+
*/
|
|
36
|
+
type CleanupFn = () => void;
|
|
37
|
+
declare function onMount(fn: () => CleanupFn | void | undefined): void;
|
|
38
|
+
/**
|
|
39
|
+
* Solid-compatible `onCleanup` — registers a callback to run when the component unmounts.
|
|
40
|
+
*/
|
|
41
|
+
declare function onCleanup(fn: () => void): void;
|
|
42
|
+
declare function createSelector<T>(source: () => T): (key: T) => boolean;
|
|
43
|
+
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
44
|
+
type MergeProps<T extends object[]> = UnionToIntersection<T[number]>;
|
|
45
|
+
declare function mergeProps<T extends object[]>(...sources: [...T]): MergeProps<T>;
|
|
46
|
+
declare function splitProps<T extends Record<string, unknown>, K extends (keyof T)[]>(props: T, ...keys: K): [Pick<T, K[number]>, Omit<T, K[number]>];
|
|
47
|
+
declare function children(fn: () => VNodeChild): () => VNodeChild;
|
|
48
|
+
declare function lazy<P extends Props>(loader: () => Promise<{
|
|
49
|
+
default: ComponentFn<P>;
|
|
50
|
+
}>): LazyComponent<P> & {
|
|
51
|
+
preload: () => Promise<{
|
|
52
|
+
default: ComponentFn<P>;
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
55
|
+
declare function getOwner(): EffectScope | null;
|
|
56
|
+
declare function runWithOwner<T>(owner: EffectScope | null, fn: () => T): T;
|
|
255
57
|
//#endregion
|
|
256
|
-
export { ErrorBoundary, For, Match, Show, Suspense, Switch, pyreonBatch as batch, children, createEffect as createComputed, createEffect, pyreonCreateContext as createContext, createMemo, createRenderEffect, createRoot, createSelector, createSignal, getOwner, lazy, mergeProps, on, onCleanup, onMount, runWithOwner, splitProps, runUntracked as untrack, pyreonUseContext as useContext };
|
|
257
|
-
//# sourceMappingURL=
|
|
58
|
+
export { ErrorBoundary, For, Match, Show, SignalGetter, SignalSetter, Suspense, Switch, pyreonBatch as batch, children, createEffect as createComputed, createEffect, pyreonCreateContext as createContext, createMemo, createRenderEffect, createRoot, createSelector, createSignal, getOwner, lazy, mergeProps, on, onCleanup, onMount, runWithOwner, splitProps, runUntracked as untrack, pyreonUseContext as useContext };
|
|
59
|
+
//# 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":";;;;KA4CY,YAAA,YAAwB,CAAA;AAAA,KACxB,YAAA,OAAmB,CAAA,EAAG,CAAA,KAAM,IAAA,EAAM,CAAA,KAAM,CAAA;AAAA,iBAEpC,YAAA,GAAA,CAAgB,YAAA,EAAc,CAAA,IAAK,YAAA,CAAa,CAAA,GAAI,YAAA,CAAa,CAAA;;;;;;AAAjF;;;iBA6CgB,YAAA,CAAa,EAAA;;;;;iBAgCb,kBAAA,CAAmB,EAAA;;;;;;;iBAgBnB,UAAA,GAAA,CAAc,EAAA,QAAU,CAAA,SAAU,CAAA;AAAA,iBAkBlC,UAAA,GAAA,CAAc,EAAA,GAAK,OAAA,iBAAwB,CAAA,GAAI,CAAA;AAAA,KAa1D,aAAA;AAAA,KACA,gBAAA,UAA0B,KAAA,EAAO,CAAA,EAAG,SAAA,EAAW,CAAA,cAAe,IAAA,EAAM,CAAA,iBAAkB,CAAA;AAAA,iBAE3E,EAAA,6BAA+B,aAAA,IAAA,CAC7C,IAAA,EAAM,CAAA,EACN,EAAA,EAAI,gBAAA,CACF,CAAA,2BAA0B,CAAA,GAAI,CAAA,sCAAuC,CAAA,YACrE,CAAA,UAEK,CAAA;;AAxDT;;KAgGK,SAAA;AAAA,iBAEW,OAAA,CAAQ,EAAA,QAAU,SAAA;;AAlFlC;;iBA2GgB,SAAA,CAAU,EAAA;AAAA,iBAiBV,cAAA,GAAA,CAAkB,MAAA,QAAc,CAAA,IAAK,GAAA,EAAK,CAAA;AAAA,KAerD,mBAAA,OAA0B,CAAA,oBAAqB,CAAA,EAAG,CAAA,6BACrD,CAAA,sBAEE,CAAA;AAAA,KAGC,UAAA,uBAAiC,mBAAA,CAAoB,CAAA;AAAA,iBAE1C,UAAA,oBAAA,CAAA,GAAkC,OAAA,MAAa,CAAA,IAAK,UAAA,CAAW,CAAA;AAAA,iBA6B/D,UAAA,WAAqB,MAAA,oCAA0C,CAAA,IAAA,CAC7E,KAAA,EAAO,CAAA,KACJ,IAAA,EAAM,CAAA,IACP,IAAA,CAAK,CAAA,EAAG,CAAA,WAAY,IAAA,CAAK,CAAA,EAAG,CAAA;AAAA,iBA+BhB,QAAA,CAAS,EAAA,QAAU,UAAA,SAAmB,UAAA;AAAA,iBAYtC,IAAA,WAAe,KAAA,CAAA,CAC7B,MAAA,QAAc,OAAA;EAAU,OAAA,EAAS,WAAA,CAAY,CAAA;AAAA,KAC5C,aAAA,CAAc,CAAA;EAAO,OAAA,QAAe,OAAA;IAAU,OAAA,EAAS,WAAA,CAAY,CAAA;EAAA;AAAA;AAAA,iBAiDtD,QAAA,CAAA,GAAY,WAAA;AAAA,iBAIZ,YAAA,GAAA,CAAgB,KAAA,EAAO,WAAA,SAAoB,EAAA,QAAU,CAAA,GAAI,CAAA"}
|
|
@@ -1,142 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { runUntracked, 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(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
|
-
}
|
|
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;
|
|
140
8
|
//#endregion
|
|
141
9
|
export { Fragment, jsx, jsxs };
|
|
142
|
-
//# 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":";;;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.
|
|
3
|
+
"version": "0.6.0",
|
|
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.
|
|
53
|
-
"@pyreon/reactivity": "^0.
|
|
54
|
-
"@pyreon/runtime-dom": "^0.
|
|
52
|
+
"@pyreon/core": "^0.6.0",
|
|
53
|
+
"@pyreon/reactivity": "^0.6.0",
|
|
54
|
+
"@pyreon/runtime-dom": "^0.6.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@happy-dom/global-registrator": "^20.8.3",
|