Implement Parallel ujsx component with id and maxConcurrency props

This commit is contained in:
glm-5.1 committed 2026-05-21 20:48:59 +00:00
1 parent 0886ba1f00
commit e18fd19453
3 files changed
+58 -6

No files matched your search

+2 -1
View File
@@ -1 +1,2 @@
export {};
export { Parallel } from "./parallel.js";
export type { ParallelProps } from "./parallel.js";
+26 -1
View File
@@ -1 +1,26 @@
export {};
import type { UComponent, UElement, UNode, UniversalProps } from "@alkdev/ujsx";
export interface ParallelProps extends UniversalProps {
id?: string;
maxConcurrency?: number;
}
export const Parallel: UComponent<ParallelProps> = (
props: ParallelProps & { children?: UNode[] },
): UElement => {
const { id, maxConcurrency, children, ...rest } = props;
const elementProps: UniversalProps = { ...rest };
if (id !== undefined) {
elementProps.id = id;
}
if (maxConcurrency !== undefined) {
elementProps.maxConcurrency = maxConcurrency;
}
return {
type: "parallel",
props: elementProps,
children: children ?? [],
};
};
Parallel.displayName = "Parallel";