@pyreon/solid-compat 0.13.1 → 0.14.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/analysis/index.js.html +1 -1
- package/lib/analysis/jsx-runtime.js.html +1 -1
- package/lib/index.js +460 -20
- package/lib/index.js.map +1 -1
- package/lib/jsx-runtime.js +5 -0
- package/lib/jsx-runtime.js.map +1 -1
- package/lib/types/index.d.ts +194 -6
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/jsx-runtime.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +741 -25
- package/src/jsx-runtime.ts +9 -0
- package/src/tests/new-apis.test.ts +1539 -0
- package/src/tests/solid-compat.test.ts +366 -0
package/src/jsx-runtime.ts
CHANGED
|
@@ -260,6 +260,9 @@ function resolveChildInstance(): ChildInstance | undefined {
|
|
|
260
260
|
|
|
261
261
|
// ─── JSX functions ───────────────────────────────────────────────────────────
|
|
262
262
|
|
|
263
|
+
// Tag used by compat context Providers to skip compat wrapping
|
|
264
|
+
const _NATIVE_COMPAT = Symbol.for('pyreon:native-compat')
|
|
265
|
+
|
|
263
266
|
export function jsx(
|
|
264
267
|
type: string | ComponentFn | symbol,
|
|
265
268
|
props: Props & { children?: VNodeChild | VNodeChild[] },
|
|
@@ -274,6 +277,12 @@ export function jsx(
|
|
|
274
277
|
return h(type as ComponentFn, componentProps)
|
|
275
278
|
}
|
|
276
279
|
|
|
280
|
+
// Native compat components (e.g. context Providers) skip compat wrapping
|
|
281
|
+
if ((type as unknown as Record<symbol, boolean>)[_NATIVE_COMPAT]) {
|
|
282
|
+
const componentProps = children !== undefined ? { ...propsWithKey, children } : propsWithKey
|
|
283
|
+
return h(type as ComponentFn, componentProps)
|
|
284
|
+
}
|
|
285
|
+
|
|
277
286
|
const wrapped = wrapCompatComponent(type)
|
|
278
287
|
const componentProps =
|
|
279
288
|
children !== undefined ? { ...propsWithKey, children } : { ...propsWithKey }
|