@theia/ai-core-ui 1.76.0-next.6 → 1.76.0

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.
Files changed (32) hide show
  1. package/lib/browser/ai-configuration/components/ai-configuration-components.spec.js +34 -1
  2. package/lib/browser/ai-configuration/components/ai-configuration-components.spec.js.map +1 -1
  3. package/lib/browser/ai-configuration/components/ai-configuration-controls.d.ts +6 -0
  4. package/lib/browser/ai-configuration/components/ai-configuration-controls.d.ts.map +1 -1
  5. package/lib/browser/ai-configuration/components/ai-configuration-controls.js +2 -1
  6. package/lib/browser/ai-configuration/components/ai-configuration-controls.js.map +1 -1
  7. package/lib/browser/ai-configuration/components/ai-configuration-item-row.d.ts +7 -1
  8. package/lib/browser/ai-configuration/components/ai-configuration-item-row.d.ts.map +1 -1
  9. package/lib/browser/ai-configuration/components/ai-configuration-item-row.js +3 -1
  10. package/lib/browser/ai-configuration/components/ai-configuration-item-row.js.map +1 -1
  11. package/lib/browser/ai-configuration/components/ai-configuration-primitives.d.ts +37 -1
  12. package/lib/browser/ai-configuration/components/ai-configuration-primitives.d.ts.map +1 -1
  13. package/lib/browser/ai-configuration/components/ai-configuration-primitives.js +18 -7
  14. package/lib/browser/ai-configuration/components/ai-configuration-primitives.js.map +1 -1
  15. package/lib/browser/ai-configuration/components/ai-settings-row-service.d.ts +3 -2
  16. package/lib/browser/ai-configuration/components/ai-settings-row-service.d.ts.map +1 -1
  17. package/lib/browser/ai-configuration/components/ai-settings-row-service.js +8 -2
  18. package/lib/browser/ai-configuration/components/ai-settings-row-service.js.map +1 -1
  19. package/lib/browser/ai-configuration/components/ai-settings-row-service.spec.js +15 -0
  20. package/lib/browser/ai-configuration/components/ai-settings-row-service.spec.js.map +1 -1
  21. package/lib/browser/ai-configuration/components/variant-set-card.d.ts.map +1 -1
  22. package/lib/browser/ai-configuration/components/variant-set-card.js +2 -1
  23. package/lib/browser/ai-configuration/components/variant-set-card.js.map +1 -1
  24. package/package.json +6 -6
  25. package/src/browser/ai-configuration/components/ai-configuration-components.spec.ts +36 -3
  26. package/src/browser/ai-configuration/components/ai-configuration-controls.tsx +8 -1
  27. package/src/browser/ai-configuration/components/ai-configuration-item-row.tsx +11 -2
  28. package/src/browser/ai-configuration/components/ai-configuration-primitives.tsx +77 -18
  29. package/src/browser/ai-configuration/components/ai-settings-row-service.spec.ts +19 -0
  30. package/src/browser/ai-configuration/components/ai-settings-row-service.ts +11 -3
  31. package/src/browser/ai-configuration/components/variant-set-card.tsx +10 -13
  32. package/src/browser/style/ai-configuration-components.css +65 -39
@@ -19,6 +19,7 @@ import { codicon } from '@theia/core/lib/browser';
19
19
  import * as React from '@theia/core/shared/react';
20
20
  import { isCustomizedPromptFragment, PromptService } from '@theia/ai-core/lib/common/prompt-service';
21
21
  import { AiConfigurationItemRow } from './ai-configuration-item-row';
22
+ import { AiConfigurationIconButton } from './ai-configuration-primitives';
22
23
  import { AiEnumOption, AiEnumSelect } from './ai-configuration-controls';
23
24
  import { AiSettingsRowService } from './ai-settings-row-service';
24
25
  import { PromptCustomizationDialogs } from './prompt-customization-dialogs';
@@ -176,25 +177,21 @@ export const VariantSetCard: React.FC<VariantSetCardProps> = ({ agentId, promptV
176
177
  trailing={<div className='ai-variant-controls'>
177
178
  <AiEnumSelect
178
179
  value={invalidSelection ? explicitSelection : selected}
179
- ariaLabel={nls.localize('theia/ai/core/variantSet/templateLabel', 'Template')}
180
+ ariaLabel={nls.localizeByDefault('Template')}
180
181
  options={options}
181
182
  invalid={invalidSelection}
182
183
  onCommit={selectVariant}
183
184
  />
184
- <button
185
- className='ai-variant-action-button'
185
+ <AiConfigurationIconButton
186
+ iconClass={codicon('edit')}
186
187
  title={editLabel}
187
- aria-label={editLabel}
188
- onClick={() => customize(selected)}>
189
- <span className={codicon('edit')}></span>
190
- </button>
191
- {selectedCustomized && <button
192
- className='ai-variant-action-button'
188
+ onClick={() => customize(selected)}
189
+ />
190
+ {selectedCustomized && <AiConfigurationIconButton
191
+ iconClass={codicon(selectedHasBuiltIn ? 'discard' : 'trash')}
193
192
  title={resetLabel}
194
- aria-label={resetLabel}
195
- onClick={() => selectedHasBuiltIn ? resetVariant(selected) : removeVariant(selected)}>
196
- <span className={codicon(selectedHasBuiltIn ? 'discard' : 'trash')}></span>
197
- </button>}
193
+ onClick={() => selectedHasBuiltIn ? resetVariant(selected) : removeVariant(selected)}
194
+ />}
198
195
  </div>}
199
196
  />;
200
197
  };
@@ -815,6 +815,13 @@
815
815
  flex-shrink: 0;
816
816
  }
817
817
 
818
+ /* Secondary fact in a row's trailing slot, e.g. a model's release date. */
819
+ .ai-configuration-item-row-detail {
820
+ color: var(--theia-descriptionForeground);
821
+ font-size: var(--theia-ui-font-size0);
822
+ white-space: nowrap;
823
+ }
824
+
818
825
  .ai-configuration-item-row-chevron {
819
826
  color: var(--theia-descriptionForeground);
820
827
  }
@@ -888,6 +895,11 @@
888
895
  align-items: center;
889
896
  }
890
897
 
898
+ .ai-configuration-filter-input.with-toggles .theia-input {
899
+ /* A second trailing control needs its own room, or the text slides under it. */
900
+ padding-right: 44px;
901
+ }
902
+
891
903
  .ai-configuration-filter-input-icon {
892
904
  position: absolute;
893
905
  left: 6px;
@@ -903,9 +915,15 @@
903
915
  border: 1px solid var(--theia-dropdown-border);
904
916
  }
905
917
 
906
- .ai-configuration-filter-input-clear {
918
+ .ai-configuration-filter-input-actions {
907
919
  position: absolute;
908
920
  right: 4px;
921
+ display: inline-flex;
922
+ align-items: center;
923
+ gap: 2px;
924
+ }
925
+
926
+ .ai-configuration-filter-input-action {
909
927
  display: inline-flex;
910
928
  align-items: center;
911
929
  justify-content: center;
@@ -919,12 +937,19 @@
919
937
  cursor: pointer;
920
938
  }
921
939
 
922
- .ai-configuration-filter-input-clear:hover {
940
+ .ai-configuration-filter-input-action:hover {
923
941
  color: var(--theia-foreground);
924
942
  background: var(--theia-list-hoverBackground);
925
943
  }
926
944
 
927
- .ai-configuration-filter-input-clear:focus-visible {
945
+ /* An engaged narrowing has to look engaged: it keeps filtering the list after the click. */
946
+ .ai-configuration-filter-input-action.active {
947
+ color: var(--theia-inputOption-activeForeground, var(--theia-foreground));
948
+ background: var(--theia-inputOption-activeBackground, var(--theia-list-activeSelectionBackground));
949
+ outline: 1px solid var(--theia-inputOption-activeBorder, transparent);
950
+ }
951
+
952
+ .ai-configuration-filter-input-action:focus-visible {
928
953
  outline: 1px solid var(--theia-focusBorder);
929
954
  }
930
955
 
@@ -937,6 +962,8 @@
937
962
  padding: calc(var(--theia-ui-padding) * 3);
938
963
  color: var(--theia-descriptionForeground);
939
964
  text-align: center;
965
+ /* Same reason as the callout: a message can carry a key or a URL with nothing to wrap at. */
966
+ overflow-wrap: anywhere;
940
967
  }
941
968
 
942
969
  .ai-configuration-empty-state-icon {
@@ -1071,6 +1098,8 @@
1071
1098
  white-space: nowrap;
1072
1099
  background-color: var(--theia-badge-background);
1073
1100
  color: var(--theia-badge-foreground);
1101
+ /* An annotation on the row, not text to select: an I-beam over it only invites a drag. */
1102
+ cursor: default;
1074
1103
  }
1075
1104
 
1076
1105
  .ai-configuration-kind-badge-outline {
@@ -1142,29 +1171,36 @@
1142
1171
  gap: calc(var(--theia-ui-padding) / 2);
1143
1172
  }
1144
1173
 
1145
- .ai-variant-action-button {
1174
+ /* Borderless icon-only action: a section's refresh, a row's edit/reset/copy. */
1175
+ .ai-configuration-icon-button {
1176
+ flex: 0 0 auto;
1146
1177
  display: inline-flex;
1147
1178
  align-items: center;
1148
1179
  justify-content: center;
1149
- width: 24px;
1150
- height: 24px;
1180
+ width: 22px;
1181
+ height: 22px;
1151
1182
  padding: 0;
1152
1183
  border: none;
1153
- background: none;
1184
+ background: transparent;
1154
1185
  color: var(--theia-icon-foreground);
1186
+ border-radius: 3px;
1155
1187
  cursor: pointer;
1156
- border-radius: 4px;
1157
1188
  }
1158
1189
 
1159
- .ai-variant-action-button:hover {
1190
+ .ai-configuration-icon-button:hover:not(:disabled) {
1160
1191
  color: var(--theia-foreground);
1161
- background: var(--theia-list-hoverBackground);
1192
+ background-color: var(--theia-list-hoverBackground);
1162
1193
  }
1163
1194
 
1164
- .ai-variant-action-button:focus-visible {
1195
+ .ai-configuration-icon-button:focus-visible {
1165
1196
  outline: 1px solid var(--theia-focusBorder);
1166
1197
  }
1167
1198
 
1199
+ .ai-configuration-icon-button:disabled {
1200
+ opacity: 0.5;
1201
+ cursor: default;
1202
+ }
1203
+
1168
1204
  /* A page-level offer: an explanatory line plus one action. */
1169
1205
  .ai-configuration-callout {
1170
1206
  display: flex;
@@ -1178,10 +1214,25 @@
1178
1214
  }
1179
1215
 
1180
1216
  .ai-configuration-callout-text {
1181
- flex: 1;
1217
+ /* `min-width: 0` lets the text shrink below its content width, and `anywhere` breaks the tokens that
1218
+ make that necessary: a provider's failure carries API keys and URLs, which have nothing to wrap at.
1219
+ Without both, a long message pushes the action out of the box. */
1220
+ flex: 1 1 auto;
1221
+ min-width: 0;
1222
+ overflow-wrap: anywhere;
1223
+ /* Three lines of a provider's error are as much as this row should grow; the rest is on hover. */
1224
+ overflow: hidden;
1225
+ display: -webkit-box;
1226
+ -webkit-line-clamp: 3;
1227
+ -webkit-box-orient: vertical;
1182
1228
  line-height: var(--theia-content-line-height);
1183
1229
  }
1184
1230
 
1231
+ /* The action keeps its size whatever the message does. */
1232
+ .ai-configuration-callout > :not(.ai-configuration-callout-text) {
1233
+ flex: 0 0 auto;
1234
+ }
1235
+
1185
1236
  /* A read-only value with its label and copy button (ids, paths, frontmatter entries). */
1186
1237
  .ai-configuration-value-row {
1187
1238
  display: flex;
@@ -1216,31 +1267,6 @@
1216
1267
  overflow-wrap: break-word;
1217
1268
  }
1218
1269
 
1219
- .ai-configuration-value-row-copy {
1220
- flex: 0 0 auto;
1221
- width: 22px;
1222
- height: 22px;
1223
- display: inline-flex;
1224
- align-items: center;
1225
- justify-content: center;
1226
- padding: 0;
1227
- border: none;
1228
- background: transparent;
1229
- color: var(--theia-icon-foreground);
1230
- border-radius: 3px;
1231
- cursor: pointer;
1232
- }
1233
-
1234
- .ai-configuration-value-row-copy:hover {
1235
- background-color: var(--theia-list-hoverBackground);
1236
- outline: 1px dotted var(--theia-contrastActiveBorder, transparent);
1237
- outline-offset: -1px;
1238
- }
1239
-
1240
- .ai-configuration-value-row-copy:focus-visible {
1241
- outline: 1px solid var(--theia-focusBorder);
1242
- }
1243
-
1244
1270
  /* Available to assistive tech only. */
1245
1271
  .ai-configuration-visually-hidden {
1246
1272
  position: absolute;
@@ -1428,11 +1454,11 @@
1428
1454
  .ai-settings-row:hover,
1429
1455
  .ai-settings-row-gear:hover,
1430
1456
  .ai-configuration-item-row.navigable:hover,
1431
- .ai-configuration-filter-input-clear:hover,
1457
+ .ai-configuration-filter-input-action:hover,
1432
1458
  .ai-config-stepper-button:hover:not(:disabled),
1433
1459
  .ai-config-array .preference-array-element:hover,
1434
1460
  .ai-config-array .preference-array-element-btn:hover,
1435
- .ai-variant-action-button:hover,
1461
+ .ai-configuration-icon-button:hover:not(:disabled),
1436
1462
  .ai-config-collapsible-row-header:hover,
1437
1463
  .ai-config-collapsible-row-action:hover {
1438
1464
  outline: 1px dotted var(--theia-contrastActiveBorder, transparent);