@design.estate/dees-catalog 21.41.1 → 21.43.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 (36) hide show
  1. package/dist_bundle/bundle.js +74 -39
  2. package/dist_bundle/bundle.js.map +1 -1
  3. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-6S3PVK6Y.js → chunk-72W55DOJ.js} +3 -2
  4. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-6S3PVK6Y.js.map → chunk-72W55DOJ.js.map} +1 -1
  5. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-OUB3OAV2.js → chunk-GTAAYRP5.js} +2 -2
  6. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-DGKFXX4X.js → chunk-PAFNUCDL.js} +3 -3
  7. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-2ALUFQHJ.js → de-CQ56NZVB.js} +3 -2
  8. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-2ALUFQHJ.js.map → de-CQ56NZVB.js.map} +1 -1
  9. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-CDXSOKKD.js → dees-modal-JNRW3HIY.js} +3 -3
  10. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-46JECUZO.js → dees-workspace-terminal-Y532Z546.js} +4 -4
  11. package/dist_ts_web/00_commitinfo_data.js +1 -1
  12. package/dist_ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.d.ts +4 -1
  13. package/dist_ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.js +13 -2
  14. package/dist_ts_web/elements/00group-harness/dees-harness-composer/dees-harness-composer.d.ts +18 -3
  15. package/dist_ts_web/elements/00group-harness/dees-harness-composer/dees-harness-composer.js +50 -9
  16. package/dist_ts_web/elements/00group-harness/harness.helpers.d.ts +6 -0
  17. package/dist_ts_web/elements/00group-harness/harness.helpers.js +22 -1
  18. package/dist_ts_web/elements/00group-input/dees-input-multitoggle/dees-input-multitoggle.d.ts +2 -0
  19. package/dist_ts_web/elements/00group-input/dees-input-multitoggle/dees-input-multitoggle.js +3 -2
  20. package/dist_ts_web/i18n/de.d.ts +4 -0
  21. package/dist_ts_web/i18n/de.js +2 -1
  22. package/dist_ts_web/i18n/messages.d.ts +4 -0
  23. package/dist_ts_web/i18n/messages.js +2 -1
  24. package/package.json +1 -1
  25. package/readme.md +3 -3
  26. package/ts_web/00_commitinfo_data.ts +1 -1
  27. package/ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.ts +7 -1
  28. package/ts_web/elements/00group-harness/dees-harness-composer/dees-harness-composer.ts +46 -6
  29. package/ts_web/elements/00group-harness/harness.helpers.ts +18 -0
  30. package/ts_web/elements/00group-input/dees-input-multitoggle/dees-input-multitoggle.ts +4 -2
  31. package/ts_web/i18n/de.ts +1 -0
  32. package/ts_web/i18n/messages.ts +1 -0
  33. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-OUB3OAV2.js.map → chunk-GTAAYRP5.js.map} +0 -0
  34. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-DGKFXX4X.js.map → chunk-PAFNUCDL.js.map} +0 -0
  35. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-CDXSOKKD.js.map → dees-modal-JNRW3HIY.js.map} +0 -0
  36. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-46JECUZO.js.map → dees-workspace-terminal-Y532Z546.js.map} +0 -0
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-catalog',
6
- version: '21.41.1',
6
+ version: '21.43.0',
7
7
  description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
8
8
  }
@@ -272,6 +272,10 @@ export class DeesHarnessChat extends DeesElement {
272
272
  @property({ type: Number, reflect: true })
273
273
  accessor maxTotalAttachmentBytes: number = harnessMaxTotalAttachmentBytes;
274
274
 
275
+ /** The files the host takes, as an `accept` list; forwarded to the composer. */
276
+ @property({ type: String, reflect: true })
277
+ accessor attachmentAccept: string = '';
278
+
275
279
  @property({ reflect: true })
276
280
  accessor account: string = '';
277
281
 
@@ -298,8 +302,9 @@ export class DeesHarnessChat extends DeesElement {
298
302
  @property({ reflect: true })
299
303
  accessor mode: string = '';
300
304
 
305
+ /** Forwarded to the composer's `modeOptions`: plain strings, or labeled options with a tooltip. */
301
306
  @property({ attribute: false })
302
- accessor modeOptions: string[] = [];
307
+ accessor modeOptions: Array<string | IHarnessComposerOption> = [];
303
308
 
304
309
  /** Forwarded to the composer's `menuActions`: host commands in a "More options" menu beside Send. */
305
310
  @property({ attribute: false })
@@ -910,6 +915,7 @@ export class DeesHarnessChat extends DeesElement {
910
915
  .maxAttachmentCount=${this.maxAttachmentCount}
911
916
  .maxAttachmentBytes=${this.maxAttachmentBytes}
912
917
  .maxTotalAttachmentBytes=${this.maxTotalAttachmentBytes}
918
+ .attachmentAccept=${this.attachmentAccept}
913
919
  .disabled=${this.disabled}
914
920
  .inputLocked=${this.inputLocked}
915
921
  .busy=${this.busy || this.status.type === 'busy'}
@@ -29,6 +29,7 @@ import type {
29
29
  THarnessComposerDelivery,
30
30
  } from '../interfaces.js';
31
31
  import {
32
+ harnessFileMatchesAccept,
32
33
  harnessFileToBase64,
33
34
  harnessFormatBytes,
34
35
  harnessAttachmentKindFor,
@@ -40,6 +41,7 @@ import '../../00group-button/dees-button/dees-button.js';
40
41
  import type { DeesButton } from '../../00group-button/dees-button/dees-button.js';
41
42
  import { DeesContextmenu, type TContextMenuItem } from '../../00group-overlay/dees-contextmenu/dees-contextmenu.js';
42
43
  import { DeesInputDropdown } from '../../00group-input/dees-input-dropdown/dees-input-dropdown.js';
44
+ import type { TMultitoggleOption } from '../../00group-input/dees-input-multitoggle/dees-input-multitoggle.js';
43
45
  import '../../00group-utility/dees-icon/dees-icon.js';
44
46
 
45
47
  declare global {
@@ -54,6 +56,14 @@ const toDropdownOptions = (values: string[]): IDropdownOption[] =>
54
56
  const toLabeledDropdownOptions = (values: IHarnessComposerOption[]): IDropdownOption[] =>
55
57
  values.map((value) => ({ option: value.label, key: value.value, disabled: value.disabled, description: value.description }));
56
58
 
59
+ const modeOptionValue = (option: string | IHarnessComposerOption): string =>
60
+ typeof option === 'string' ? option : option.value;
61
+
62
+ const toModeToggleOptions = (values: Array<string | IHarnessComposerOption>): TMultitoggleOption[] =>
63
+ values.map((value) => typeof value === 'string'
64
+ ? value
65
+ : { key: value.value, label: value.label, disabled: value.disabled, description: value.description });
66
+
57
67
  let nextCommandMenuId = 0;
58
68
 
59
69
  /** One row of the slash command menu: a command, or an option for a command's argument. */
@@ -145,7 +155,7 @@ const deliveryHintKeys = {
145
155
 
146
156
  /**
147
157
  * Prompt composer: autogrow textarea, attachments (picker / paste /
148
- * drag-drop with per-file and total size limits), optional account, model,
158
+ * drag-drop with accepted types and per-file and total size limits), optional account, model,
149
159
  * and reasoning-effort dropdowns. Cmd/Ctrl+Enter sends. While busy, Stop is an
150
160
  * additional button and the main action delivers the draft the way the host supports
151
161
  * (`busyDeliveryModes`): Steer (read at the next step) when it can, else Send (read after this
@@ -302,6 +312,15 @@ export class DeesHarnessComposer extends DeesElement {
302
312
  @property({ type: Number, reflect: true })
303
313
  accessor maxAttachmentCount: number = Number.POSITIVE_INFINITY;
304
314
 
315
+ /**
316
+ * The files the host takes, as an `<input type="file">` `accept` list: extensions (`.pdf`),
317
+ * media types (`application/pdf`) and families (`image/*`). The picker offers those, and a
318
+ * picked, pasted or dropped file of another type is refused with `harness-attachment-error`.
319
+ * Empty takes every file.
320
+ */
321
+ @property({ type: String, reflect: true })
322
+ accessor attachmentAccept: string = '';
323
+
305
324
  @property({ reflect: true })
306
325
  accessor account: string = '';
307
326
 
@@ -330,13 +349,22 @@ export class DeesHarnessComposer extends DeesElement {
330
349
 
331
350
  /**
332
351
  * Agent mode switcher (e.g. Planning / Building). Renders a segmented
333
- * control when modeOptions is set; emits harness-mode-change.
352
+ * control when modeOptions is set; emits harness-mode-change. `mode` is the
353
+ * chosen option's value.
334
354
  */
335
355
  @property({ reflect: true })
336
356
  accessor mode: string = '';
337
357
 
358
+ /**
359
+ * A plain string is its own label and value. A labeled option (`{ label, value }`) keeps
360
+ * `mode` independent of the language shown; its `description` is the segment's tooltip,
361
+ * such as what the mode still asks before acting, and `disabled` lists it unselectable.
362
+ */
338
363
  @property({ attribute: false })
339
- accessor modeOptions: string[] = [];
364
+ accessor modeOptions: Array<string | IHarnessComposerOption> = [];
365
+
366
+ /** The switch's options, rebuilt only with `modeOptions`, so typing never redraws the switch. */
367
+ private modeToggleOptions: TMultitoggleOption[] = [];
340
368
 
341
369
  @property({ type: Boolean, reflect: true })
342
370
  accessor showModelControls: boolean = true;
@@ -740,6 +768,7 @@ export class DeesHarnessComposer extends DeesElement {
740
768
  // Another prompt or command list lists other entries: highlight the first completable one.
741
769
  if (changedProperties.has('value') || changedProperties.has('commands')) this.activeMenuIndex = -1;
742
770
  if (changedProperties.has('historyKey')) this.resetHistoryNavigation();
771
+ if (changedProperties.has('modeOptions')) this.modeToggleOptions = toModeToggleOptions(this.modeOptions);
743
772
  }
744
773
 
745
774
  public updated(changedProperties: Map<PropertyKey, unknown>): void {
@@ -777,6 +806,7 @@ export class DeesHarnessComposer extends DeesElement {
777
806
  class="fileInput"
778
807
  type="file"
779
808
  multiple
809
+ accept=${this.attachmentAccept}
780
810
  ?disabled=${this.interactionLocked}
781
811
  @change=${this.handleFileInputChange}
782
812
  />` : ''}
@@ -823,7 +853,7 @@ export class DeesHarnessComposer extends DeesElement {
823
853
  ${this.modeOptions.length
824
854
  ? html`
825
855
  <dees-input-multitoggle class="modeSwitch" label=${this.t('composer.mode')} .labelPosition=${'none'}
826
- .options=${this.modeOptions} .selectedOption=${this.mode} .disabled=${this.interactionLocked}
856
+ .options=${this.modeToggleOptions} .selectedOption=${this.mode} .disabled=${this.interactionLocked}
827
857
  @input=${(event: Event) => event.stopPropagation()}
828
858
  @change=${(event: CustomEvent<{ value: string }>) => {
829
859
  event.stopPropagation();
@@ -1101,8 +1131,12 @@ export class DeesHarnessComposer extends DeesElement {
1101
1131
  // Shift+Tab cycles the agent mode without leaving the prompt
1102
1132
  if (event.key === 'Tab' && event.shiftKey && this.modeOptions.length) {
1103
1133
  event.preventDefault();
1104
- const currentIndex = this.modeOptions.indexOf(this.mode);
1105
- const nextMode = this.modeOptions[(currentIndex + 1) % this.modeOptions.length];
1134
+ const modes = this.modeOptions
1135
+ .filter((option) => typeof option === 'string' || !option.disabled)
1136
+ .map(modeOptionValue);
1137
+ if (!modes.length) return;
1138
+ const nextMode = modes[(modes.indexOf(this.mode) + 1) % modes.length];
1139
+ if (nextMode === this.mode) return;
1106
1140
  this.mode = nextMode;
1107
1141
  this.emit('harness-mode-change', { mode: nextMode });
1108
1142
  }
@@ -1412,6 +1446,12 @@ export class DeesHarnessComposer extends DeesElement {
1412
1446
  break;
1413
1447
  }
1414
1448
  const mediaType = harnessMediaTypeForFile(file);
1449
+ if (!harnessFileMatchesAccept(this.attachmentAccept, file, mediaType)) {
1450
+ this.emit('harness-attachment-error', {
1451
+ message: this.t('composer.typeRefused', { name: file.name || this.t('harness.file') }),
1452
+ });
1453
+ continue;
1454
+ }
1415
1455
  if (file.size > this.maxAttachmentBytes) {
1416
1456
  this.emit('harness-attachment-error', {
1417
1457
  message: this.t('composer.tooLarge', { name: file.name || this.t('harness.file'), size: harnessFormatBytes(this.maxAttachmentBytes, this.t.format) }),
@@ -261,6 +261,24 @@ export const harnessMediaTypeForFile = (file: File): string => {
261
261
  return byExtension || file.type || 'application/octet-stream';
262
262
  };
263
263
 
264
+ /**
265
+ * Whether a file is one an `accept` list in the syntax of `<input type="file">` names: an
266
+ * extension (`.pdf`) by the file's name, a media type (`application/pdf`) or a family (`image/*`)
267
+ * by the type the composer sends or the browser's own. An empty list takes every file.
268
+ */
269
+ export const harnessFileMatchesAccept = (accept: string, file: File, mediaType: string): boolean => {
270
+ const tokens = accept.split(',').map((token) => token.trim().toLowerCase()).filter(Boolean);
271
+ if (!tokens.length) return true;
272
+ const name = file.name.toLowerCase();
273
+ const types = [mediaType, file.type].map((type) => type.toLowerCase()).filter(Boolean);
274
+ return tokens.some((token) => {
275
+ if (token.startsWith('.')) return name.endsWith(token);
276
+ if (token === '*/*') return true;
277
+ if (token.endsWith('/*')) return types.some((type) => type.startsWith(token.slice(0, -1)));
278
+ return types.includes(token);
279
+ });
280
+ };
281
+
264
282
  export const harnessIsSupportedAttachmentType = (mediaType: string): boolean => {
265
283
  return (
266
284
  harnessSupportedImageTypes.has(mediaType)
@@ -4,7 +4,8 @@ import { demoFunc } from './dees-input-multitoggle.demo.js';
4
4
  import { themeDefaultStyles } from '../../00theme.js';
5
5
  import '../../00group-utility/dees-icon/dees-icon.js';
6
6
 
7
- export type TMultitoggleOption = string | { key: string; label: string; disabled?: boolean; icon?: string; badge?: string | number };
7
+ /** A keyed option's `description` is its tooltip: what choosing it means. */
8
+ export type TMultitoggleOption = string | { key: string; label: string; disabled?: boolean; icon?: string; badge?: string | number; description?: string };
8
9
 
9
10
  declare global {
10
11
  interface HTMLElementTagNameMap { 'dees-input-multitoggle': DeesInputMultitoggle; }
@@ -100,7 +101,8 @@ export class DeesInputMultitoggle extends DeesInputBase<DeesInputMultitoggle> {
100
101
  const key = this.optionKey(option); const label = this.optionLabel(option); const selected = key === this.selectedOption;
101
102
  const icon = typeof option === 'string' ? undefined : option.icon;
102
103
  const badge = typeof option === 'string' ? undefined : option.badge;
103
- return html`<button type="button" role="radio" class="option ${selected ? 'selected' : ''}" data-option=${label}
104
+ const description = typeof option === 'string' ? undefined : option.description;
105
+ return html`<button type="button" role="radio" class="option ${selected ? 'selected' : ''}" data-option=${label} .title=${description ?? ''}
104
106
  aria-checked=${selected} ?disabled=${this.optionDisabled(option)} tabindex=${key === (typeof focusKey === 'object' ? focusKey.key : focusKey) ? 0 : -1}
105
107
  @click=${() => this.handleSelection(key)} @keydown=${this.handleKeydown}><span class="option-content">${icon ? html`<dees-icon .icon=${icon} iconSize="14" aria-hidden="true"></dees-icon>` : ''}<span class="option-label">${label}</span>${badge !== undefined ? html`<span class="option-badge">${badge}</span>` : ''}</span></button>`;
106
108
  })}
package/ts_web/i18n/de.ts CHANGED
@@ -1261,6 +1261,7 @@ export default dcMessages.translation('de', {
1261
1261
  'composer.tooMany': 'Es sind höchstens {count, number} Anhänge erlaubt.',
1262
1262
  'composer.tooLarge': '{name} ist zu groß. Pro Anhang sind höchstens {size} erlaubt.',
1263
1263
  'composer.totalLimit': 'Die Anhänge überschreiten die Gesamtgrenze von {size}.',
1264
+ 'composer.typeRefused': '{name} kann hier nicht angehängt werden: Dieser Dateityp wird nicht angenommen.',
1264
1265
  'message.role': '{role, select, user {Benutzer} assistant {Assistent} system {System} tool {Werkzeug} other {Nachricht}}',
1265
1266
  'message.truncated': 'gekürzt',
1266
1267
  'message.pendingSteering': 'Steuert · wird beim nächsten Schritt gelesen',
@@ -1319,6 +1319,7 @@ export const dcMessages = plugins.smarti18n.defineCatalog({
1319
1319
  'composer.tooMany': { message: 'A maximum of {count, number} attachments is allowed.', description: 'Said when more files are attached than allowed.' },
1320
1320
  'composer.tooLarge': { message: '{name} is too large. Max per attachment is {size}.', description: 'Said when a file is larger than allowed; {size} is the limit.' },
1321
1321
  'composer.totalLimit': { message: 'Attachments exceed the {size} total limit.', description: 'Said when the attachments together are larger than allowed.' },
1322
+ 'composer.typeRefused': { message: '{name} cannot be attached here: its file type is not accepted.', description: 'Said when a file is of a type the host does not take; {name} is the file name.' },
1322
1323
 
1323
1324
  // dees-harness-message
1324
1325
  'message.role': { message: '{role, select, user {user} assistant {assistant} system {system} tool {tool} other {message}}', description: 'A message\'s role label.' },