@a2ui/angular 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/a2ui-angular-audio-DoZb9mn_.mjs +48 -0
- package/fesm2022/a2ui-angular-audio-DoZb9mn_.mjs.map +1 -0
- package/fesm2022/a2ui-angular-button-CvH0kAtN.mjs +61 -0
- package/fesm2022/a2ui-angular-button-CvH0kAtN.mjs.map +1 -0
- package/fesm2022/a2ui-angular-card-Ix6OIdUv.mjs +48 -0
- package/fesm2022/a2ui-angular-card-Ix6OIdUv.mjs.map +1 -0
- package/fesm2022/a2ui-angular-checkbox-BN4EF2Ci.mjs +78 -0
- package/fesm2022/a2ui-angular-checkbox-BN4EF2Ci.mjs.map +1 -0
- package/fesm2022/a2ui-angular-datetime-input-dmZAjvrF.mjs +120 -0
- package/fesm2022/a2ui-angular-datetime-input-dmZAjvrF.mjs.map +1 -0
- package/fesm2022/a2ui-angular-divider-BizPl3qL.mjs +30 -0
- package/fesm2022/a2ui-angular-divider-BizPl3qL.mjs.map +1 -0
- package/fesm2022/a2ui-angular-icon-BE9Hj9V6.mjs +48 -0
- package/fesm2022/a2ui-angular-icon-BE9Hj9V6.mjs.map +1 -0
- package/fesm2022/a2ui-angular-image-BWzAw0rh.mjs +54 -0
- package/fesm2022/a2ui-angular-image-BWzAw0rh.mjs.map +1 -0
- package/fesm2022/a2ui-angular-list-nEeT59V3.mjs +45 -0
- package/fesm2022/a2ui-angular-list-nEeT59V3.mjs.map +1 -0
- package/fesm2022/a2ui-angular-modal-mr9LmczA.mjs +108 -0
- package/fesm2022/a2ui-angular-modal-mr9LmczA.mjs.map +1 -0
- package/fesm2022/a2ui-angular-multiple-choice-Bry7X74i.mjs +78 -0
- package/fesm2022/a2ui-angular-multiple-choice-Bry7X74i.mjs.map +1 -0
- package/fesm2022/a2ui-angular-slider-BgseUbN2.mjs +79 -0
- package/fesm2022/a2ui-angular-slider-BgseUbN2.mjs.map +1 -0
- package/fesm2022/a2ui-angular-tabs-q5Mn9vgq.mjs +87 -0
- package/fesm2022/a2ui-angular-tabs-q5Mn9vgq.mjs.map +1 -0
- package/fesm2022/a2ui-angular-text-field-Deokh07j.mjs +85 -0
- package/fesm2022/a2ui-angular-text-field-Deokh07j.mjs.map +1 -0
- package/fesm2022/a2ui-angular-video-DuFTfN0B.mjs +48 -0
- package/fesm2022/a2ui-angular-video-DuFTfN0B.mjs.map +1 -0
- package/fesm2022/a2ui-angular.mjs +872 -0
- package/fesm2022/a2ui-angular.mjs.map +1 -0
- package/package.json +12 -45
- package/types/a2ui-angular.d.ts +90 -0
- package/angular.json +0 -35
- package/ng-package.json +0 -8
- package/src/lib/catalog/audio.ts +0 -50
- package/src/lib/catalog/button.ts +0 -56
- package/src/lib/catalog/card.ts +0 -57
- package/src/lib/catalog/checkbox.ts +0 -73
- package/src/lib/catalog/column.ts +0 -96
- package/src/lib/catalog/datetime-input.ts +0 -127
- package/src/lib/catalog/default.ts +0 -185
- package/src/lib/catalog/divider.ts +0 -37
- package/src/lib/catalog/icon.ts +0 -44
- package/src/lib/catalog/image.ts +0 -62
- package/src/lib/catalog/list.ts +0 -63
- package/src/lib/catalog/modal.ts +0 -113
- package/src/lib/catalog/multiple-choice.ts +0 -77
- package/src/lib/catalog/row.ts +0 -100
- package/src/lib/catalog/slider.ts +0 -73
- package/src/lib/catalog/surface.ts +0 -82
- package/src/lib/catalog/tabs.ts +0 -72
- package/src/lib/catalog/text-field.ts +0 -86
- package/src/lib/catalog/text.ts +0 -137
- package/src/lib/catalog/video.ts +0 -50
- package/src/lib/config.ts +0 -25
- package/src/lib/data/index.ts +0 -18
- package/src/lib/data/markdown.ts +0 -114
- package/src/lib/data/processor.ts +0 -47
- package/src/lib/data/types.ts +0 -29
- package/src/lib/rendering/catalog.ts +0 -36
- package/src/lib/rendering/dynamic-component.ts +0 -100
- package/src/lib/rendering/index.ts +0 -20
- package/src/lib/rendering/renderer.ts +0 -109
- package/src/lib/rendering/theming.ts +0 -22
- package/src/public-api.ts +0 -21
- package/tsconfig.json +0 -23
- package/tsconfig.lib.json +0 -16
- package/tsconfig.lib.prod.json +0 -9
- package/tsconfig.spec.json +0 -12
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2025 Google LLC
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { Component, computed, input } from '@angular/core';
|
|
18
|
-
import { Types } from '@a2ui/lit/0.8';
|
|
19
|
-
import { DynamicComponent } from '../rendering/dynamic-component';
|
|
20
|
-
import { Renderer } from '../rendering/renderer';
|
|
21
|
-
|
|
22
|
-
@Component({
|
|
23
|
-
selector: 'a2ui-column',
|
|
24
|
-
imports: [Renderer],
|
|
25
|
-
styles: `
|
|
26
|
-
:host {
|
|
27
|
-
display: flex;
|
|
28
|
-
flex: var(--weight);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
section {
|
|
32
|
-
display: flex;
|
|
33
|
-
flex-direction: column;
|
|
34
|
-
min-width: 100%;
|
|
35
|
-
height: 100%;
|
|
36
|
-
box-sizing: border-box;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.align-start {
|
|
40
|
-
align-items: start;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.align-center {
|
|
44
|
-
align-items: center;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.align-end {
|
|
48
|
-
align-items: end;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.align-stretch {
|
|
52
|
-
align-items: stretch;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.distribute-start {
|
|
56
|
-
justify-content: start;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.distribute-center {
|
|
60
|
-
justify-content: center;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.distribute-end {
|
|
64
|
-
justify-content: end;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.distribute-spaceBetween {
|
|
68
|
-
justify-content: space-between;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.distribute-spaceAround {
|
|
72
|
-
justify-content: space-around;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.distribute-spaceEvenly {
|
|
76
|
-
justify-content: space-evenly;
|
|
77
|
-
}
|
|
78
|
-
`,
|
|
79
|
-
template: `
|
|
80
|
-
<section [class]="classes()" [style]="theme.additionalStyles?.Column">
|
|
81
|
-
@for (child of component().properties.children; track child) {
|
|
82
|
-
<ng-container a2ui-renderer [surfaceId]="surfaceId()!" [component]="child" />
|
|
83
|
-
}
|
|
84
|
-
</section>
|
|
85
|
-
`,
|
|
86
|
-
})
|
|
87
|
-
export class Column extends DynamicComponent<Types.ColumnNode> {
|
|
88
|
-
readonly alignment = input<Types.ResolvedColumn['alignment']>('stretch');
|
|
89
|
-
readonly distribution = input<Types.ResolvedColumn['distribution']>('start');
|
|
90
|
-
|
|
91
|
-
protected readonly classes = computed(() => ({
|
|
92
|
-
...this.theme.components.Column,
|
|
93
|
-
[`align-${this.alignment()}`]: true,
|
|
94
|
-
[`distribute-${this.distribution()}`]: true,
|
|
95
|
-
}));
|
|
96
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2025 Google LLC
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { computed, Component, input } from '@angular/core';
|
|
18
|
-
import { DynamicComponent } from '../rendering/dynamic-component';
|
|
19
|
-
import { Primitives } from '@a2ui/lit/0.8';
|
|
20
|
-
|
|
21
|
-
@Component({
|
|
22
|
-
selector: 'a2ui-datetime-input',
|
|
23
|
-
template: `
|
|
24
|
-
<section [class]="theme.components.DateTimeInput.container">
|
|
25
|
-
<label [for]="inputId" [class]="theme.components.DateTimeInput.label">{{ label() }}</label>
|
|
26
|
-
|
|
27
|
-
<input
|
|
28
|
-
autocomplete="off"
|
|
29
|
-
[attr.type]="inputType()"
|
|
30
|
-
[id]="inputId"
|
|
31
|
-
[class]="theme.components.DateTimeInput.element"
|
|
32
|
-
[style]="theme.additionalStyles?.DateTimeInput"
|
|
33
|
-
[value]="inputValue()"
|
|
34
|
-
(input)="handleInput($event)"
|
|
35
|
-
/>
|
|
36
|
-
</section>
|
|
37
|
-
`,
|
|
38
|
-
styles: `
|
|
39
|
-
:host {
|
|
40
|
-
display: block;
|
|
41
|
-
flex: var(--weight);
|
|
42
|
-
min-height: 0;
|
|
43
|
-
overflow: auto;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
input {
|
|
47
|
-
display: block;
|
|
48
|
-
width: 100%;
|
|
49
|
-
box-sizing: border-box;
|
|
50
|
-
}
|
|
51
|
-
`,
|
|
52
|
-
})
|
|
53
|
-
export class DatetimeInput extends DynamicComponent {
|
|
54
|
-
readonly value = input.required<Primitives.StringValue | null>();
|
|
55
|
-
readonly enableDate = input.required<boolean>();
|
|
56
|
-
readonly enableTime = input.required<boolean>();
|
|
57
|
-
protected readonly inputId = super.getUniqueId('a2ui-datetime-input');
|
|
58
|
-
|
|
59
|
-
protected inputType = computed(() => {
|
|
60
|
-
const enableDate = this.enableDate();
|
|
61
|
-
const enableTime = this.enableTime();
|
|
62
|
-
|
|
63
|
-
if (enableDate && enableTime) {
|
|
64
|
-
return 'datetime-local';
|
|
65
|
-
} else if (enableDate) {
|
|
66
|
-
return 'date';
|
|
67
|
-
} else if (enableTime) {
|
|
68
|
-
return 'time';
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return 'datetime-local';
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
protected label = computed(() => {
|
|
75
|
-
// TODO: this should likely be passed from the model.
|
|
76
|
-
const inputType = this.inputType();
|
|
77
|
-
|
|
78
|
-
if (inputType === 'date') {
|
|
79
|
-
return 'Date';
|
|
80
|
-
} else if (inputType === 'time') {
|
|
81
|
-
return 'Time';
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return 'Date & Time';
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
protected inputValue = computed(() => {
|
|
88
|
-
const inputType = this.inputType();
|
|
89
|
-
const parsed = super.resolvePrimitive(this.value()) || '';
|
|
90
|
-
const date = parsed ? new Date(parsed) : null;
|
|
91
|
-
|
|
92
|
-
if (!date || isNaN(date.getTime())) {
|
|
93
|
-
return '';
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const year = this.padNumber(date.getFullYear());
|
|
97
|
-
const month = this.padNumber(date.getMonth());
|
|
98
|
-
const day = this.padNumber(date.getDate());
|
|
99
|
-
const hours = this.padNumber(date.getHours());
|
|
100
|
-
const minutes = this.padNumber(date.getMinutes());
|
|
101
|
-
|
|
102
|
-
// Browsers are picky with what format they allow for the `value` attribute of date/time inputs.
|
|
103
|
-
// We need to parse it out of the provided value. Note that we don't use `toISOString`,
|
|
104
|
-
// because the resulting value is relative to UTC.
|
|
105
|
-
if (inputType === 'date') {
|
|
106
|
-
return `${year}-${month}-${day}`;
|
|
107
|
-
} else if (inputType === 'time') {
|
|
108
|
-
return `${hours}:${minutes}`;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return `${year}-${month}-${day}T${hours}:${minutes}`;
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
protected handleInput(event: Event) {
|
|
115
|
-
const path = this.value()?.path;
|
|
116
|
-
|
|
117
|
-
if (!(event.target instanceof HTMLInputElement) || !path) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
this.processor.setData(this.component(), path, event.target.value, this.surfaceId());
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
private padNumber(value: number) {
|
|
125
|
-
return value.toString().padStart(2, '0');
|
|
126
|
-
}
|
|
127
|
-
}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2025 Google LLC
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { inputBinding } from '@angular/core';
|
|
18
|
-
import { Types } from '@a2ui/lit/0.8';
|
|
19
|
-
import { Catalog } from '../rendering/catalog';
|
|
20
|
-
import { Row } from './row';
|
|
21
|
-
import { Column } from './column';
|
|
22
|
-
import { Text } from './text';
|
|
23
|
-
|
|
24
|
-
export const DEFAULT_CATALOG: Catalog = {
|
|
25
|
-
Row: {
|
|
26
|
-
type: () => Row,
|
|
27
|
-
bindings: (node) => {
|
|
28
|
-
const properties = (node as Types.RowNode).properties;
|
|
29
|
-
return [
|
|
30
|
-
inputBinding('alignment', () => properties.alignment ?? 'stretch'),
|
|
31
|
-
inputBinding('distribution', () => properties.distribution ?? 'start'),
|
|
32
|
-
];
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
Column: {
|
|
37
|
-
type: () => Column,
|
|
38
|
-
bindings: (node) => {
|
|
39
|
-
const properties = (node as Types.ColumnNode).properties;
|
|
40
|
-
return [
|
|
41
|
-
inputBinding('alignment', () => properties.alignment ?? 'stretch'),
|
|
42
|
-
inputBinding('distribution', () => properties.distribution ?? 'start'),
|
|
43
|
-
];
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
List: {
|
|
48
|
-
type: () => import('./list').then((r) => r.List),
|
|
49
|
-
bindings: (node) => {
|
|
50
|
-
const properties = (node as Types.ListNode).properties;
|
|
51
|
-
return [inputBinding('direction', () => properties.direction ?? 'vertical')];
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
Card: () => import('./card').then((r) => r.Card),
|
|
56
|
-
|
|
57
|
-
Image: {
|
|
58
|
-
type: () => import('./image').then((r) => r.Image),
|
|
59
|
-
bindings: (node) => {
|
|
60
|
-
const properties = (node as Types.ImageNode).properties;
|
|
61
|
-
return [
|
|
62
|
-
inputBinding('url', () => properties.url),
|
|
63
|
-
inputBinding('usageHint', () => properties.usageHint),
|
|
64
|
-
];
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
Icon: {
|
|
69
|
-
type: () => import('./icon').then((r) => r.Icon),
|
|
70
|
-
bindings: (node) => {
|
|
71
|
-
const properties = (node as Types.IconNode).properties;
|
|
72
|
-
return [inputBinding('name', () => properties.name)];
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
Video: {
|
|
77
|
-
type: () => import('./video').then((r) => r.Video),
|
|
78
|
-
bindings: (node) => {
|
|
79
|
-
const properties = (node as Types.VideoNode).properties;
|
|
80
|
-
return [inputBinding('url', () => properties.url)];
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
AudioPlayer: {
|
|
85
|
-
type: () => import('./audio').then((r) => r.Audio),
|
|
86
|
-
bindings: (node) => {
|
|
87
|
-
const properties = (node as Types.AudioPlayerNode).properties;
|
|
88
|
-
return [inputBinding('url', () => properties.url)];
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
Text: {
|
|
93
|
-
type: () => Text,
|
|
94
|
-
bindings: (node) => {
|
|
95
|
-
const properties = (node as Types.TextNode).properties;
|
|
96
|
-
return [
|
|
97
|
-
inputBinding('text', () => properties.text),
|
|
98
|
-
inputBinding('usageHint', () => properties.usageHint || null),
|
|
99
|
-
];
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
Button: {
|
|
104
|
-
type: () => import('./button').then((r) => r.Button),
|
|
105
|
-
bindings: (node) => {
|
|
106
|
-
const properties = (node as Types.ButtonNode).properties;
|
|
107
|
-
return [inputBinding('action', () => properties.action)];
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
Divider: () => import('./divider').then((r) => r.Divider),
|
|
112
|
-
|
|
113
|
-
MultipleChoice: {
|
|
114
|
-
type: () => import('./multiple-choice').then((r) => r.MultipleChoice),
|
|
115
|
-
bindings: (node) => {
|
|
116
|
-
const properties = (node as Types.MultipleChoiceNode).properties;
|
|
117
|
-
return [
|
|
118
|
-
inputBinding('options', () => properties.options || []),
|
|
119
|
-
inputBinding('value', () => properties.selections),
|
|
120
|
-
inputBinding('description', () => 'Select an item'), // TODO: this should be defined in the properties
|
|
121
|
-
];
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
TextField: {
|
|
126
|
-
type: () => import('./text-field').then((r) => r.TextField),
|
|
127
|
-
bindings: (node) => {
|
|
128
|
-
const properties = (node as Types.TextFieldNode).properties;
|
|
129
|
-
return [
|
|
130
|
-
inputBinding('text', () => properties.text ?? null),
|
|
131
|
-
inputBinding('label', () => properties.label),
|
|
132
|
-
inputBinding('inputType', () => properties.type),
|
|
133
|
-
];
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
DateTimeInput: {
|
|
138
|
-
type: () => import('./datetime-input').then((r) => r.DatetimeInput),
|
|
139
|
-
bindings: (node) => {
|
|
140
|
-
const properties = (node as Types.DateTimeInputNode).properties;
|
|
141
|
-
return [
|
|
142
|
-
inputBinding('enableDate', () => properties.enableDate),
|
|
143
|
-
inputBinding('enableTime', () => properties.enableTime),
|
|
144
|
-
inputBinding('value', () => properties.value),
|
|
145
|
-
];
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
CheckBox: {
|
|
150
|
-
type: () => import('./checkbox').then((r) => r.Checkbox),
|
|
151
|
-
bindings: (node) => {
|
|
152
|
-
const properties = (node as Types.CheckboxNode).properties;
|
|
153
|
-
return [
|
|
154
|
-
inputBinding('label', () => properties.label),
|
|
155
|
-
inputBinding('value', () => properties.value),
|
|
156
|
-
];
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
Slider: {
|
|
161
|
-
type: () => import('./slider').then((r) => r.Slider),
|
|
162
|
-
bindings: (node) => {
|
|
163
|
-
const properties = (node as Types.SliderNode).properties;
|
|
164
|
-
return [
|
|
165
|
-
inputBinding('value', () => properties.value),
|
|
166
|
-
inputBinding('minValue', () => properties.minValue),
|
|
167
|
-
inputBinding('maxValue', () => properties.maxValue),
|
|
168
|
-
inputBinding('label', () => ''), // TODO: this should be defined in the properties
|
|
169
|
-
];
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
Tabs: {
|
|
174
|
-
type: () => import('./tabs').then((r) => r.Tabs),
|
|
175
|
-
bindings: (node) => {
|
|
176
|
-
const properties = (node as Types.TabsNode).properties;
|
|
177
|
-
return [inputBinding('tabs', () => properties.tabItems)];
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
Modal: {
|
|
182
|
-
type: () => import('./modal').then((r) => r.Modal),
|
|
183
|
-
bindings: () => [],
|
|
184
|
-
},
|
|
185
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2025 Google LLC
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { Component } from '@angular/core';
|
|
18
|
-
import { DynamicComponent } from '../rendering/dynamic-component';
|
|
19
|
-
|
|
20
|
-
@Component({
|
|
21
|
-
selector: 'a2ui-divider',
|
|
22
|
-
template: '<hr [class]="theme.components.Divider" [style]="theme.additionalStyles?.Divider"/>',
|
|
23
|
-
styles: `
|
|
24
|
-
:host {
|
|
25
|
-
display: block;
|
|
26
|
-
min-height: 0;
|
|
27
|
-
overflow: auto;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
hr {
|
|
31
|
-
height: 1px;
|
|
32
|
-
background: #ccc;
|
|
33
|
-
border: none;
|
|
34
|
-
}
|
|
35
|
-
`,
|
|
36
|
-
})
|
|
37
|
-
export class Divider extends DynamicComponent {}
|
package/src/lib/catalog/icon.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2025 Google LLC
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { Component, computed, input } from '@angular/core';
|
|
18
|
-
import { DynamicComponent } from '../rendering/dynamic-component';
|
|
19
|
-
import { Primitives } from '@a2ui/lit/0.8';
|
|
20
|
-
|
|
21
|
-
@Component({
|
|
22
|
-
selector: 'a2ui-icon',
|
|
23
|
-
styles: `
|
|
24
|
-
:host {
|
|
25
|
-
display: block;
|
|
26
|
-
flex: var(--weight);
|
|
27
|
-
min-height: 0;
|
|
28
|
-
overflow: auto;
|
|
29
|
-
}
|
|
30
|
-
`,
|
|
31
|
-
template: `
|
|
32
|
-
@let resolvedName = this.resolvedName();
|
|
33
|
-
|
|
34
|
-
@if (resolvedName) {
|
|
35
|
-
<section [class]="theme.components.Icon" [style]="theme.additionalStyles?.Icon">
|
|
36
|
-
<span class="g-icon">{{ resolvedName }}</span>
|
|
37
|
-
</section>
|
|
38
|
-
}
|
|
39
|
-
`,
|
|
40
|
-
})
|
|
41
|
-
export class Icon extends DynamicComponent {
|
|
42
|
-
readonly name = input.required<Primitives.StringValue | null>();
|
|
43
|
-
protected readonly resolvedName = computed(() => this.resolvePrimitive(this.name()));
|
|
44
|
-
}
|
package/src/lib/catalog/image.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2025 Google LLC
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { Component, computed, input } from '@angular/core';
|
|
18
|
-
import { Primitives, Styles, Types } from '@a2ui/lit/0.8';
|
|
19
|
-
import { DynamicComponent } from '../rendering/dynamic-component';
|
|
20
|
-
|
|
21
|
-
@Component({
|
|
22
|
-
selector: 'a2ui-image',
|
|
23
|
-
styles: `
|
|
24
|
-
:host {
|
|
25
|
-
display: block;
|
|
26
|
-
flex: var(--weight);
|
|
27
|
-
min-height: 0;
|
|
28
|
-
overflow: auto;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
img {
|
|
32
|
-
display: block;
|
|
33
|
-
width: 100%;
|
|
34
|
-
height: 100%;
|
|
35
|
-
box-sizing: border-box;
|
|
36
|
-
}
|
|
37
|
-
`,
|
|
38
|
-
template: `
|
|
39
|
-
@let resolvedUrl = this.resolvedUrl();
|
|
40
|
-
|
|
41
|
-
@if (resolvedUrl) {
|
|
42
|
-
<section [class]="classes()" [style]="theme.additionalStyles?.Image">
|
|
43
|
-
<img [src]="resolvedUrl" />
|
|
44
|
-
</section>
|
|
45
|
-
}
|
|
46
|
-
`,
|
|
47
|
-
})
|
|
48
|
-
export class Image extends DynamicComponent {
|
|
49
|
-
readonly url = input.required<Primitives.StringValue | null>();
|
|
50
|
-
readonly usageHint = input.required<Types.ResolvedImage['usageHint'] | null>();
|
|
51
|
-
|
|
52
|
-
protected readonly resolvedUrl = computed(() => this.resolvePrimitive(this.url()));
|
|
53
|
-
|
|
54
|
-
protected classes = computed(() => {
|
|
55
|
-
const usageHint = this.usageHint();
|
|
56
|
-
|
|
57
|
-
return Styles.merge(
|
|
58
|
-
this.theme.components.Image.all,
|
|
59
|
-
usageHint ? this.theme.components.Image[usageHint] : {},
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
}
|
package/src/lib/catalog/list.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2025 Google LLC
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { Component, input } from '@angular/core';
|
|
18
|
-
import { Types } from '@a2ui/lit/0.8';
|
|
19
|
-
import { DynamicComponent } from '../rendering/dynamic-component';
|
|
20
|
-
import { Renderer } from '../rendering/renderer';
|
|
21
|
-
|
|
22
|
-
@Component({
|
|
23
|
-
selector: 'a2ui-list',
|
|
24
|
-
imports: [Renderer],
|
|
25
|
-
host: {
|
|
26
|
-
'[attr.direction]': 'direction()',
|
|
27
|
-
},
|
|
28
|
-
styles: `
|
|
29
|
-
:host {
|
|
30
|
-
display: block;
|
|
31
|
-
flex: var(--weight);
|
|
32
|
-
min-height: 0;
|
|
33
|
-
overflow: auto;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
:host([direction='vertical']) section {
|
|
37
|
-
display: grid;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
:host([direction='horizontal']) section {
|
|
41
|
-
display: flex;
|
|
42
|
-
max-width: 100%;
|
|
43
|
-
overflow-x: scroll;
|
|
44
|
-
overflow-y: hidden;
|
|
45
|
-
scrollbar-width: none;
|
|
46
|
-
|
|
47
|
-
> ::slotted(*) {
|
|
48
|
-
flex: 1 0 fit-content;
|
|
49
|
-
max-width: min(80%, 400px);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
`,
|
|
53
|
-
template: `
|
|
54
|
-
<section [class]="theme.components.List" [style]="theme.additionalStyles?.List">
|
|
55
|
-
@for (child of component().properties.children; track child) {
|
|
56
|
-
<ng-container a2ui-renderer [surfaceId]="surfaceId()!" [component]="child" />
|
|
57
|
-
}
|
|
58
|
-
</section>
|
|
59
|
-
`,
|
|
60
|
-
})
|
|
61
|
-
export class List extends DynamicComponent<Types.ListNode> {
|
|
62
|
-
readonly direction = input<'vertical' | 'horizontal'>('vertical');
|
|
63
|
-
}
|