📝 Commit Details:
This commit is contained in:
50
backend/node_modules/preact/jsx-runtime/src/index.d.ts
generated
vendored
Normal file
50
backend/node_modules/preact/jsx-runtime/src/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
export { Fragment } from '../../';
|
||||
import {
|
||||
ComponentType,
|
||||
ComponentChild,
|
||||
ComponentChildren,
|
||||
VNode,
|
||||
Attributes
|
||||
} from '../../';
|
||||
import { JSXInternal } from '../../src/jsx';
|
||||
|
||||
export function jsx(
|
||||
type: string,
|
||||
props: JSXInternal.HTMLAttributes &
|
||||
JSXInternal.SVGAttributes &
|
||||
Record<string, any> & { children?: ComponentChild },
|
||||
key?: string
|
||||
): VNode<any>;
|
||||
export function jsx<P>(
|
||||
type: ComponentType<P>,
|
||||
props: Attributes & P & { children?: ComponentChild },
|
||||
key?: string
|
||||
): VNode<any>;
|
||||
|
||||
export function jsxs(
|
||||
type: string,
|
||||
props: JSXInternal.HTMLAttributes &
|
||||
JSXInternal.SVGAttributes &
|
||||
Record<string, any> & { children?: ComponentChild[] },
|
||||
key?: string
|
||||
): VNode<any>;
|
||||
export function jsxs<P>(
|
||||
type: ComponentType<P>,
|
||||
props: Attributes & P & { children?: ComponentChild[] },
|
||||
key?: string
|
||||
): VNode<any>;
|
||||
|
||||
export function jsxDEV(
|
||||
type: string,
|
||||
props: JSXInternal.HTMLAttributes &
|
||||
JSXInternal.SVGAttributes &
|
||||
Record<string, any> & { children?: ComponentChildren },
|
||||
key?: string
|
||||
): VNode<any>;
|
||||
export function jsxDEV<P>(
|
||||
type: ComponentType<P>,
|
||||
props: Attributes & P & { children?: ComponentChildren },
|
||||
key?: string
|
||||
): VNode<any>;
|
||||
|
||||
export { JSXInternal as JSX };
|
78
backend/node_modules/preact/jsx-runtime/src/index.js
generated
vendored
Normal file
78
backend/node_modules/preact/jsx-runtime/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
import { options, Fragment } from 'preact';
|
||||
|
||||
/** @typedef {import('preact').VNode} VNode */
|
||||
|
||||
let vnodeId = 0;
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* This file exports various methods that implement Babel's "automatic" JSX runtime API:
|
||||
* - jsx(type, props, key)
|
||||
* - jsxs(type, props, key)
|
||||
* - jsxDEV(type, props, key, __source, __self)
|
||||
*
|
||||
* The implementation of createVNode here is optimized for performance.
|
||||
* Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3
|
||||
*/
|
||||
|
||||
/**
|
||||
* JSX.Element factory used by Babel's {runtime:"automatic"} JSX transform
|
||||
* @param {VNode['type']} type
|
||||
* @param {VNode['props']} props
|
||||
* @param {VNode['key']} [key]
|
||||
* @param {unknown} [isStaticChildren]
|
||||
* @param {unknown} [__source]
|
||||
* @param {unknown} [__self]
|
||||
*/
|
||||
function createVNode(type, props, key, isStaticChildren, __source, __self) {
|
||||
// We'll want to preserve `ref` in props to get rid of the need for
|
||||
// forwardRef components in the future, but that should happen via
|
||||
// a separate PR.
|
||||
let normalizedProps = {},
|
||||
ref,
|
||||
i;
|
||||
for (i in props) {
|
||||
if (i == 'ref') {
|
||||
ref = props[i];
|
||||
} else {
|
||||
normalizedProps[i] = props[i];
|
||||
}
|
||||
}
|
||||
|
||||
const vnode = {
|
||||
type,
|
||||
props: normalizedProps,
|
||||
key,
|
||||
ref,
|
||||
_children: null,
|
||||
_parent: null,
|
||||
_depth: 0,
|
||||
_dom: null,
|
||||
_nextDom: undefined,
|
||||
_component: null,
|
||||
_hydrating: null,
|
||||
constructor: undefined,
|
||||
_original: --vnodeId,
|
||||
__source,
|
||||
__self
|
||||
};
|
||||
|
||||
// If a Component VNode, check for and apply defaultProps.
|
||||
// Note: `type` is often a String, and can be `undefined` in development.
|
||||
if (typeof type === 'function' && (ref = type.defaultProps)) {
|
||||
for (i in ref)
|
||||
if (typeof normalizedProps[i] === 'undefined') {
|
||||
normalizedProps[i] = ref[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (options.vnode) options.vnode(vnode);
|
||||
return vnode;
|
||||
}
|
||||
|
||||
export {
|
||||
createVNode as jsx,
|
||||
createVNode as jsxs,
|
||||
createVNode as jsxDEV,
|
||||
Fragment
|
||||
};
|
Reference in New Issue
Block a user