@design.estate/dees-catalog 21.41.0 → 21.42.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 +69 -36
  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 +2 -0
  13. package/dist_ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.js +12 -2
  14. package/dist_ts_web/elements/00group-harness/dees-harness-composer/dees-harness-composer.d.ts +8 -1
  15. package/dist_ts_web/elements/00group-harness/dees-harness-composer/dees-harness-composer.js +25 -4
  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-dropdown/dees-input-dropdown-popup.d.ts +2 -0
  19. package/dist_ts_web/elements/00group-input/dees-input-dropdown/dees-input-dropdown-popup.js +12 -3
  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 +1 -1
  26. package/ts_web/00_commitinfo_data.ts +1 -1
  27. package/ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.ts +5 -0
  28. package/ts_web/elements/00group-harness/dees-harness-composer/dees-harness-composer.ts +18 -1
  29. package/ts_web/elements/00group-harness/harness.helpers.ts +18 -0
  30. package/ts_web/elements/00group-input/dees-input-dropdown/dees-input-dropdown-popup.ts +10 -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
@@ -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
 
@@ -910,6 +914,7 @@ export class DeesHarnessChat extends DeesElement {
910
914
  .maxAttachmentCount=${this.maxAttachmentCount}
911
915
  .maxAttachmentBytes=${this.maxAttachmentBytes}
912
916
  .maxTotalAttachmentBytes=${this.maxTotalAttachmentBytes}
917
+ .attachmentAccept=${this.attachmentAccept}
913
918
  .disabled=${this.disabled}
914
919
  .inputLocked=${this.inputLocked}
915
920
  .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,
@@ -145,7 +146,7 @@ const deliveryHintKeys = {
145
146
 
146
147
  /**
147
148
  * Prompt composer: autogrow textarea, attachments (picker / paste /
148
- * drag-drop with per-file and total size limits), optional account, model,
149
+ * drag-drop with accepted types and per-file and total size limits), optional account, model,
149
150
  * and reasoning-effort dropdowns. Cmd/Ctrl+Enter sends. While busy, Stop is an
150
151
  * additional button and the main action delivers the draft the way the host supports
151
152
  * (`busyDeliveryModes`): Steer (read at the next step) when it can, else Send (read after this
@@ -302,6 +303,15 @@ export class DeesHarnessComposer extends DeesElement {
302
303
  @property({ type: Number, reflect: true })
303
304
  accessor maxAttachmentCount: number = Number.POSITIVE_INFINITY;
304
305
 
306
+ /**
307
+ * The files the host takes, as an `<input type="file">` `accept` list: extensions (`.pdf`),
308
+ * media types (`application/pdf`) and families (`image/*`). The picker offers those, and a
309
+ * picked, pasted or dropped file of another type is refused with `harness-attachment-error`.
310
+ * Empty takes every file.
311
+ */
312
+ @property({ type: String, reflect: true })
313
+ accessor attachmentAccept: string = '';
314
+
305
315
  @property({ reflect: true })
306
316
  accessor account: string = '';
307
317
 
@@ -777,6 +787,7 @@ export class DeesHarnessComposer extends DeesElement {
777
787
  class="fileInput"
778
788
  type="file"
779
789
  multiple
790
+ accept=${this.attachmentAccept}
780
791
  ?disabled=${this.interactionLocked}
781
792
  @change=${this.handleFileInputChange}
782
793
  />` : ''}
@@ -1412,6 +1423,12 @@ export class DeesHarnessComposer extends DeesElement {
1412
1423
  break;
1413
1424
  }
1414
1425
  const mediaType = harnessMediaTypeForFile(file);
1426
+ if (!harnessFileMatchesAccept(this.attachmentAccept, file, mediaType)) {
1427
+ this.emit('harness-attachment-error', {
1428
+ message: this.t('composer.typeRefused', { name: file.name || this.t('harness.file') }),
1429
+ });
1430
+ continue;
1431
+ }
1415
1432
  if (file.size > this.maxAttachmentBytes) {
1416
1433
  this.emit('harness-attachment-error', {
1417
1434
  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)
@@ -94,6 +94,8 @@ export class DeesInputDropdownPopup extends DeesElement {
94
94
 
95
95
  private windowLayer: DeesWindowLayer | null = null;
96
96
  private isDestroying: boolean = false;
97
+ /** The list's openings so far: a close removes the list after its exit only if none came since. */
98
+ private openings = 0;
97
99
 
98
100
  public static styles = [
99
101
  themeDefaultStyles,
@@ -344,7 +346,9 @@ export class DeesInputDropdownPopup extends DeesElement {
344
346
  const selectedIndex = this.options.findIndex((option) => option.key === this.selectedKey && !option.disabled);
345
347
  this.highlightedIndex = selectedIndex >= 0 ? selectedIndex : firstUsableIndex(this.options);
346
348
  this.searchValue = '';
347
- // the field reuses its list: one closed before takes presses again
349
+ // the field reuses its list: one closed before, or still on its way out, takes presses again
350
+ this.openings++;
351
+ this.isDestroying = false;
348
352
  this.classList.remove('closing');
349
353
 
350
354
  // Create window layer (transparent click-catcher, no dim/blur)
@@ -355,10 +359,11 @@ export class DeesInputDropdownPopup extends DeesElement {
355
359
 
356
360
  // Set z-index above the window layer
357
361
  this.menuZIndex = zIndexRegistry.getNextZIndex();
358
- zIndexRegistry.register(this, this.menuZIndex);
359
362
  this.style.zIndex = this.menuZIndex.toString();
360
363
 
361
364
  this.windowLayer.parentElement!.appendChild(this);
365
+ // registered once in place: a list still there from its last opening is moved, and the move unregisters it
366
+ zIndexRegistry.register(this, this.menuZIndex);
362
367
 
363
368
  // Animate in on next frame
364
369
  await domtools.plugins.smartpromise.delayFor(0);
@@ -375,6 +380,7 @@ export class DeesInputDropdownPopup extends DeesElement {
375
380
  return;
376
381
  }
377
382
  this.isDestroying = true;
383
+ const opening = this.openings;
378
384
  this.classList.add('closing');
379
385
  this.searchAbort?.abort();
380
386
 
@@ -396,6 +402,8 @@ export class DeesInputDropdownPopup extends DeesElement {
396
402
  // Animate out via CSS transition
397
403
  this.visible = false;
398
404
  await domtools.plugins.smartpromise.delayFor(150);
405
+ // opened again during its exit: the list stays, and the close of that opening removes it
406
+ if (opening !== this.openings) return;
399
407
 
400
408
  if (this.parentElement) {
401
409
  this.parentElement.removeChild(this);
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.' },