Skip to content

packages/core/src/lib/element/jsx-runtime.ts

Read as Markdown

This is the source snapshot used to build these API details. View this revision on GitHub.

Back to reference

1 import { createPibblElement } from './create-element.js';
2 export { Fragment } from './fragment.js';
3 import type { PibblElementSource } from './metadata.js';
4 import type {
5   PibblElement,
6   PibblElementType,
7   PibblKey,
8 } from './types.js';
9 
10 /**
11  * @internal Automatic JSX production constructor.
12  *
13  * @param type - Pibbl component or fragment emitted by the JSX compiler. See {@link PibblElementType}.
14  * @param props - Compiler-generated props, including children.
15  * @param key - Optional reconciliation key supplied separately by the compiler. See {@link PibblKey}
16  * .
17  * @returns A branded Pibbl element descriptor. See {@link PibblElement}.
18  *
19  * @see {@link PibblElementType}
20  * @see {@link PibblKey}
21  * @see {@link PibblElement}
22  */
23 export function jsx<P>(
24   type: PibblElementType<P>,
25   props: P,
26   key?: PibblKey,
27 ): PibblElement<P> {
28   return createPibblElement(type, props, key, undefined);
29 }
30 
31 /**
32  * @internal Automatic JSX production constructor for static child lists.
33  *
34  * @param type - Pibbl component or fragment emitted by the JSX compiler. See {@link PibblElementType}.
35  * @param props - Compiler-generated props, including the static child list.
36  * @param key - Optional reconciliation key. See {@link PibblKey}.
37  * @returns A branded Pibbl element descriptor. See {@link PibblElement}.
38  *
39  * @see {@link PibblElementType}
40  * @see {@link PibblKey}
41  * @see {@link PibblElement}
42  */
43 export const jsxs = jsx;
44 
45 /**
46  * @internal Automatic JSX development constructor.
47  *
48  * @param type - Pibbl component or fragment emitted by the JSX compiler. See {@link PibblElementType}.
49  * @param props - Compiler-generated props, including children.
50  * @param key - Reconciliation key, if present. See {@link PibblKey}.
51  * @param _isStaticChildren - Compiler compatibility flag; not used by Pibbl.
52  * @param source - Development source location for diagnostics. See {@link PibblElementSource}.
53  * @param _self - Compiler compatibility receiver; not used by Pibbl.
54  * @returns A branded Pibbl element descriptor with development source metadata. See
55  * {@link PibblElement} .
56  *
57  * @see {@link PibblElementType}
58  * @see {@link PibblKey}
59  * @see {@link PibblElementSource}
60  * @see {@link PibblElement}
61  */
62 export function jsxDEV<P>(
63   type: PibblElementType<P>,
64   props: P,
65   key: PibblKey | undefined,
66   _isStaticChildren: boolean,
67   source: PibblElementSource | undefined,
68   _self: unknown,
69 ): PibblElement<P> {
70   return createPibblElement(type, props, key, source);
71 }
72 

Documentation built with @pibbl/core 0.0.2, revision 2dccb19. ALPHA — NOT FOR PRODUCTION USE.