Project typed records as semantic list items

This commit is contained in:
Meta Vens 2026-07-15 02:38:32 +01:00
commit fe81204177
3 changed files with 8 additions and 8 deletions

View file

@ -627,9 +627,9 @@ export function renderEveComponent(node, options = currentOptions) {
export function projectSemanticListItem(node) {
const props = objectProps(node.props);
return {
label: firstString(props.label, props.title, node.text, node.kind, "item"),
status: firstString(props.status, ""),
detail: firstString(props.detail, props.phase, ""),
label: firstString(props.label, props.title, props.displayName, node.text, node.kind, "item"),
status: firstString(props.status, props.state, ""),
detail: firstString(props.detail, props.phase, props.repoName, ""),
badges: Array.isArray(props.badges)
? props.badges.map(value => String(value).trim()).filter(Boolean)
: firstString(props.badges, "").split(",").map(value => value.trim()).filter(Boolean),

View file

@ -808,9 +808,9 @@ export function renderEveComponent(
export function projectSemanticListItem(node: EveSurfaceComponent): EveSemanticListItem {
const props = objectProps(node.props);
return {
label: firstString(props.label, props.title, node.text, node.kind, "item"),
status: firstString(props.status, ""),
detail: firstString(props.detail, props.phase, ""),
label: firstString(props.label, props.title, props.displayName, node.text, node.kind, "item"),
status: firstString(props.status, props.state, ""),
detail: firstString(props.detail, props.phase, props.repoName, ""),
badges: Array.isArray(props.badges)
? props.badges.map(value => String(value).trim()).filter(Boolean)
: firstString(props.badges, "").split(",").map(value => value.trim()).filter(Boolean),

View file

@ -96,10 +96,10 @@ test("projects unknown semantic items through the generic list contract", () =>
test("projects provider-owned list data through the same semantic item contract", () => {
assert.deepEqual(projectSemanticListItems([
{ label: "Face One", status: "working", detail: "Current turn", badges: ["repo", "live"] },
{ label: "Face Two", status: "ready" },
{ displayName: "Face Two", state: "ready", repoName: "VoidBot" },
]), [
{ label: "Face One", status: "working", detail: "Current turn", badges: ["repo", "live"] },
{ label: "Face Two", status: "ready", detail: "", badges: [] },
{ label: "Face Two", status: "ready", detail: "VoidBot", badges: [] },
]);
});