MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / commitChildrenForVNode

Function commitChildrenForVNode

packages/core/src/runtime/commit/validation.ts:116–164  ·  view source on GitHub ↗
(vnode: VNode)

Source from the content-addressed store, hash-verified

114}
115
116export function commitChildrenForVNode(vnode: VNode): readonly VNode[] {
117 if (
118 vnode.kind === "fragment" ||
119 vnode.kind === "box" ||
120 vnode.kind === "row" ||
121 vnode.kind === "column" ||
122 vnode.kind === "themed" ||
123 vnode.kind === "grid" ||
124 vnode.kind === "focusZone" ||
125 vnode.kind === "focusTrap" ||
126 vnode.kind === "layers" ||
127 vnode.kind === "tabs" ||
128 vnode.kind === "accordion" ||
129 vnode.kind === "breadcrumb" ||
130 vnode.kind === "pagination" ||
131 vnode.kind === "splitPane" ||
132 vnode.kind === "panelGroup"
133 ) {
134 return vnode.children;
135 }
136
137 if (vnode.kind === "field" || vnode.kind === "resizablePanel") {
138 const child = vnode.children[0];
139 return child ? [child] : [];
140 }
141
142 if (vnode.kind === "layer") {
143 const content = (vnode.props as { content?: unknown }).content;
144 return isVNode(content) ? [content] : [];
145 }
146
147 if (vnode.kind === "modal") {
148 const props = vnode.props as { content?: unknown; actions?: unknown };
149 const content = isVNode(props.content) ? props.content : null;
150
151 const actionsRaw = Array.isArray(props.actions) ? props.actions : [];
152 const actions: VNode[] = [];
153 for (const a of actionsRaw) {
154 if (isVNode(a)) actions.push(a);
155 }
156
157 const children: VNode[] = [];
158 if (content) children.push(content);
159 children.push(...actions);
160 return children;
161 }
162
163 return [];
164}
165
166export function readVNodeKey(vnode: VNode): string | undefined {
167 const props = vnode.props as Readonly<{ key?: unknown }> | undefined;

Callers 1

commitContainerFunction · 0.85

Calls 2

isVNodeFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected