From c767b77e5b3a9bd955fcf48aca017672d74411e1 Mon Sep 17 00:00:00 2001 From: Brian Love Date: Thu, 9 Apr 2026 10:39:50 -0700 Subject: [PATCH] fix(a2ui): remove unused EnvelopeKey type alias breaking production builds --- .../src/app/computed-functions.component.ts | 12 ++++++---- .../src/app/element-rendering.component.ts | 22 +++++++++++++------ .../angular/src/app/registry.component.ts | 22 +++++++++++++------ .../angular/src/app/repeat-loops.component.ts | 22 +++++++++++++------ .../src/app/spec-rendering.component.ts | 22 +++++++++++++------ .../src/app/state-management.component.ts | 22 +++++++++++++------ libs/a2ui/src/lib/parser.ts | 1 - 7 files changed, 83 insertions(+), 40 deletions(-) diff --git a/cockpit/render/computed-functions/angular/src/app/computed-functions.component.ts b/cockpit/render/computed-functions/angular/src/app/computed-functions.component.ts index 7eb458108..02e687dc1 100644 --- a/cockpit/render/computed-functions/angular/src/app/computed-functions.component.ts +++ b/cockpit/render/computed-functions/angular/src/app/computed-functions.component.ts @@ -1,5 +1,5 @@ // SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 -import { Component, input, OnDestroy, viewChild, ElementRef, effect } from '@angular/core'; +import { Component, computed, input, OnDestroy, viewChild, ElementRef, effect } from '@angular/core'; import { RenderSpecComponent, RenderElementComponent, @@ -45,8 +45,8 @@ class DemoValueComponent { standalone: true, imports: [RenderElementComponent], template: ` - @if (content()) { -

{{ content() }}

+ @if (displayContent()) { +

{{ displayContent() }}

} @else if (loading()) {
} @@ -62,7 +62,11 @@ class DemoValueComponent { `, }) class DemoHeadingComponent { - readonly content = input(''); + readonly content = input(''); + readonly displayContent = computed(() => { + const c = this.content(); + return typeof c === 'string' ? c : ''; + }); readonly childKeys = input([]); readonly spec = input(null); readonly bindings = input>({}); diff --git a/cockpit/render/element-rendering/angular/src/app/element-rendering.component.ts b/cockpit/render/element-rendering/angular/src/app/element-rendering.component.ts index 153248a29..82ee54eb1 100644 --- a/cockpit/render/element-rendering/angular/src/app/element-rendering.component.ts +++ b/cockpit/render/element-rendering/angular/src/app/element-rendering.component.ts @@ -1,5 +1,5 @@ // SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 -import { Component, input, OnDestroy, viewChild, ElementRef, effect, signal } from '@angular/core'; +import { Component, computed, input, OnDestroy, viewChild, ElementRef, effect, signal } from '@angular/core'; import { RenderSpecComponent, RenderElementComponent, @@ -17,8 +17,8 @@ import { ELEMENT_RENDERING_SPECS } from './specs'; selector: 'demo-text', standalone: true, template: ` - @if (content()) { -

{{ content() }}

+ @if (displayContent()) { +

{{ displayContent() }}

} @else if (loading()) {
@@ -28,7 +28,11 @@ import { ELEMENT_RENDERING_SPECS } from './specs'; `, }) class DemoTextComponent { - readonly content = input(''); + readonly content = input(''); + readonly displayContent = computed(() => { + const c = this.content(); + return typeof c === 'string' ? c : ''; + }); readonly childKeys = input([]); readonly spec = input(null); readonly bindings = input>({}); @@ -41,8 +45,8 @@ class DemoTextComponent { standalone: true, imports: [RenderElementComponent], template: ` - @if (content()) { -

{{ content() }}

+ @if (displayContent()) { +

{{ displayContent() }}

} @else if (loading()) {
} @@ -58,7 +62,11 @@ class DemoTextComponent { `, }) class DemoHeadingComponent { - readonly content = input(''); + readonly content = input(''); + readonly displayContent = computed(() => { + const c = this.content(); + return typeof c === 'string' ? c : ''; + }); readonly childKeys = input([]); readonly spec = input(null); readonly bindings = input>({}); diff --git a/cockpit/render/registry/angular/src/app/registry.component.ts b/cockpit/render/registry/angular/src/app/registry.component.ts index 1d065f8c7..1d8fe887b 100644 --- a/cockpit/render/registry/angular/src/app/registry.component.ts +++ b/cockpit/render/registry/angular/src/app/registry.component.ts @@ -1,5 +1,5 @@ // SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 -import { Component, input, OnDestroy, viewChild, ElementRef, effect } from '@angular/core'; +import { Component, computed, input, OnDestroy, viewChild, ElementRef, effect } from '@angular/core'; import { RenderSpecComponent, RenderElementComponent, @@ -17,8 +17,8 @@ import { REGISTRY_SPECS } from './specs'; selector: 'demo-text', standalone: true, template: ` - @if (content()) { -

{{ content() }}

+ @if (displayContent()) { +

{{ displayContent() }}

} @else if (loading()) {
@@ -28,7 +28,11 @@ import { REGISTRY_SPECS } from './specs'; `, }) class DemoTextComponent { - readonly content = input(''); + readonly content = input(''); + readonly displayContent = computed(() => { + const c = this.content(); + return typeof c === 'string' ? c : ''; + }); readonly childKeys = input([]); readonly spec = input(null); readonly bindings = input>({}); @@ -41,8 +45,8 @@ class DemoTextComponent { standalone: true, imports: [RenderElementComponent], template: ` - @if (content()) { -

{{ content() }}

+ @if (displayContent()) { +

{{ displayContent() }}

} @else if (loading()) {
} @@ -58,7 +62,11 @@ class DemoTextComponent { `, }) class DemoHeadingComponent { - readonly content = input(''); + readonly content = input(''); + readonly displayContent = computed(() => { + const c = this.content(); + return typeof c === 'string' ? c : ''; + }); readonly childKeys = input([]); readonly spec = input(null); readonly bindings = input>({}); diff --git a/cockpit/render/repeat-loops/angular/src/app/repeat-loops.component.ts b/cockpit/render/repeat-loops/angular/src/app/repeat-loops.component.ts index 07546f93e..640b69e41 100644 --- a/cockpit/render/repeat-loops/angular/src/app/repeat-loops.component.ts +++ b/cockpit/render/repeat-loops/angular/src/app/repeat-loops.component.ts @@ -1,5 +1,5 @@ // SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 -import { Component, input, OnDestroy, viewChild, ElementRef, effect } from '@angular/core'; +import { Component, computed, input, OnDestroy, viewChild, ElementRef, effect } from '@angular/core'; import { RenderSpecComponent, RenderElementComponent, @@ -17,8 +17,8 @@ import { REPEAT_LOOPS_SPECS } from './specs'; selector: 'demo-text', standalone: true, template: ` - @if (content()) { -

{{ content() }}

+ @if (displayContent()) { +

{{ displayContent() }}

} @else if (loading()) {
@@ -28,7 +28,11 @@ import { REPEAT_LOOPS_SPECS } from './specs'; `, }) class DemoTextComponent { - readonly content = input(''); + readonly content = input(''); + readonly displayContent = computed(() => { + const c = this.content(); + return typeof c === 'string' ? c : ''; + }); readonly childKeys = input([]); readonly spec = input(null); readonly bindings = input>({}); @@ -41,8 +45,8 @@ class DemoTextComponent { standalone: true, imports: [RenderElementComponent], template: ` - @if (content()) { -

{{ content() }}

+ @if (displayContent()) { +

{{ displayContent() }}

} @else if (loading()) {
} @@ -58,7 +62,11 @@ class DemoTextComponent { `, }) class DemoHeadingComponent { - readonly content = input(''); + readonly content = input(''); + readonly displayContent = computed(() => { + const c = this.content(); + return typeof c === 'string' ? c : ''; + }); readonly childKeys = input([]); readonly spec = input(null); readonly bindings = input>({}); diff --git a/cockpit/render/spec-rendering/angular/src/app/spec-rendering.component.ts b/cockpit/render/spec-rendering/angular/src/app/spec-rendering.component.ts index ab2095229..10ed745cd 100644 --- a/cockpit/render/spec-rendering/angular/src/app/spec-rendering.component.ts +++ b/cockpit/render/spec-rendering/angular/src/app/spec-rendering.component.ts @@ -1,5 +1,5 @@ // SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 -import { Component, input, OnDestroy, viewChild, ElementRef, effect } from '@angular/core'; +import { Component, computed, input, OnDestroy, viewChild, ElementRef, effect } from '@angular/core'; import { RenderSpecComponent, RenderElementComponent, @@ -17,8 +17,8 @@ import { SPEC_RENDERING_SPECS } from './specs'; selector: 'demo-text', standalone: true, template: ` - @if (content()) { -

{{ content() }}

+ @if (displayContent()) { +

{{ displayContent() }}

} @else if (loading()) {
@@ -28,7 +28,11 @@ import { SPEC_RENDERING_SPECS } from './specs'; `, }) class DemoTextComponent { - readonly content = input(''); + readonly content = input(''); + readonly displayContent = computed(() => { + const c = this.content(); + return typeof c === 'string' ? c : ''; + }); readonly childKeys = input([]); readonly spec = input(null); readonly bindings = input>({}); @@ -41,8 +45,8 @@ class DemoTextComponent { standalone: true, imports: [RenderElementComponent], template: ` - @if (content()) { -

{{ content() }}

+ @if (displayContent()) { +

{{ displayContent() }}

} @else if (loading()) {
} @@ -58,7 +62,11 @@ class DemoTextComponent { `, }) class DemoHeadingComponent { - readonly content = input(''); + readonly content = input(''); + readonly displayContent = computed(() => { + const c = this.content(); + return typeof c === 'string' ? c : ''; + }); readonly childKeys = input([]); readonly spec = input(null); readonly bindings = input>({}); diff --git a/cockpit/render/state-management/angular/src/app/state-management.component.ts b/cockpit/render/state-management/angular/src/app/state-management.component.ts index d84dab3e3..76ca48dbd 100644 --- a/cockpit/render/state-management/angular/src/app/state-management.component.ts +++ b/cockpit/render/state-management/angular/src/app/state-management.component.ts @@ -1,5 +1,5 @@ // SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 -import { Component, input, OnDestroy, viewChild, ElementRef, effect } from '@angular/core'; +import { Component, computed, input, OnDestroy, viewChild, ElementRef, effect } from '@angular/core'; import { RenderSpecComponent, RenderElementComponent, @@ -17,8 +17,8 @@ import { STATE_MANAGEMENT_SPECS } from './specs'; selector: 'demo-text', standalone: true, template: ` - @if (content()) { -

{{ content() }}

+ @if (displayContent()) { +

{{ displayContent() }}

} @else if (loading()) {
@@ -28,7 +28,11 @@ import { STATE_MANAGEMENT_SPECS } from './specs'; `, }) class DemoTextComponent { - readonly content = input(''); + readonly content = input(''); + readonly displayContent = computed(() => { + const c = this.content(); + return typeof c === 'string' ? c : ''; + }); readonly childKeys = input([]); readonly spec = input(null); readonly bindings = input>({}); @@ -41,8 +45,8 @@ class DemoTextComponent { standalone: true, imports: [RenderElementComponent], template: ` - @if (content()) { -

{{ content() }}

+ @if (displayContent()) { +

{{ displayContent() }}

} @else if (loading()) {
} @@ -58,7 +62,11 @@ class DemoTextComponent { `, }) class DemoHeadingComponent { - readonly content = input(''); + readonly content = input(''); + readonly displayContent = computed(() => { + const c = this.content(); + return typeof c === 'string' ? c : ''; + }); readonly childKeys = input([]); readonly spec = input(null); readonly bindings = input>({}); diff --git a/libs/a2ui/src/lib/parser.ts b/libs/a2ui/src/lib/parser.ts index 2fc526c79..b51bf858b 100644 --- a/libs/a2ui/src/lib/parser.ts +++ b/libs/a2ui/src/lib/parser.ts @@ -2,7 +2,6 @@ import type { A2uiMessage } from './types'; const ENVELOPE_KEYS = ['createSurface', 'updateComponents', 'updateDataModel', 'deleteSurface'] as const; -type EnvelopeKey = typeof ENVELOPE_KEYS[number]; export interface A2uiMessageParser { push(chunk: string): A2uiMessage[];