packages/core/src/lib/element/fragment.ts
This is the source snapshot used to build these API details. View this revision on GitHub.
1 import type { PibblElement, PibblNodeInput } from './types.js';
2
3 export interface FragmentProps {
4 children?: PibblNodeInput;
5 }
6
7 /**
8 * Compiler-visible fragment value. The renderer handles its descriptor directly.
9 *
10 * @param props - Children and optional fragment identity. See {@link FragmentProps}.
11 * @returns The fragment's children, preserving their order. See {@link PibblNodeInput}.
12 *
13 * @see {@link PibblNodeInput}
14 */
15 export function Fragment(props: FragmentProps): PibblNodeInput {
16 return props.children;
17 }
18
19 /** @internal */
20 export function isFragmentElement(
21 element: PibblElement<any>,
22 ): element is PibblElement<FragmentProps> {
23 return element.type === Fragment;
24 }
25
Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision 2dccb19. ALPHA — NOT FOR PRODUCTION USE.