@trismegisto/angular 3.3.9 → 3.3.11

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 (55) hide show
  1. package/fesm2022/trismegisto-angular-agent.mjs +458 -73
  2. package/fesm2022/trismegisto-angular-agent.mjs.map +1 -1
  3. package/fesm2022/trismegisto-angular-api-exchange.mjs +1 -1
  4. package/fesm2022/trismegisto-angular-api-exchange.mjs.map +1 -1
  5. package/fesm2022/trismegisto-angular-attachment.mjs +6 -2
  6. package/fesm2022/trismegisto-angular-attachment.mjs.map +1 -1
  7. package/fesm2022/trismegisto-angular-bubble.mjs.map +1 -1
  8. package/fesm2022/trismegisto-angular-code-viewer.mjs +78 -5
  9. package/fesm2022/trismegisto-angular-code-viewer.mjs.map +1 -1
  10. package/fesm2022/trismegisto-angular-data-grid.mjs +51 -7
  11. package/fesm2022/trismegisto-angular-data-grid.mjs.map +1 -1
  12. package/fesm2022/trismegisto-angular-icon.mjs +2 -1
  13. package/fesm2022/trismegisto-angular-icon.mjs.map +1 -1
  14. package/fesm2022/trismegisto-angular-message-divider.mjs +14 -6
  15. package/fesm2022/trismegisto-angular-message-divider.mjs.map +1 -1
  16. package/fesm2022/trismegisto-angular-message-scroller.mjs +14 -0
  17. package/fesm2022/trismegisto-angular-message-scroller.mjs.map +1 -1
  18. package/fesm2022/trismegisto-angular-prompt-input.mjs +251 -0
  19. package/fesm2022/trismegisto-angular-prompt-input.mjs.map +1 -0
  20. package/fesm2022/trismegisto-angular-prompt-suggestions.mjs +10 -3
  21. package/fesm2022/trismegisto-angular-prompt-suggestions.mjs.map +1 -1
  22. package/fesm2022/trismegisto-angular-questionnaire.mjs +420 -0
  23. package/fesm2022/trismegisto-angular-questionnaire.mjs.map +1 -0
  24. package/fesm2022/trismegisto-angular-trace.mjs +38 -9
  25. package/fesm2022/trismegisto-angular-trace.mjs.map +1 -1
  26. package/fesm2022/trismegisto-angular-webhook.mjs +1 -1
  27. package/fesm2022/trismegisto-angular-webhook.mjs.map +1 -1
  28. package/fesm2022/trismegisto-angular.mjs +4 -2
  29. package/fesm2022/trismegisto-angular.mjs.map +1 -1
  30. package/package.json +13 -5
  31. package/types/trismegisto-angular-agent.d.ts +103 -4
  32. package/types/trismegisto-angular-agent.d.ts.map +1 -1
  33. package/types/trismegisto-angular-attachment.d.ts +5 -2
  34. package/types/trismegisto-angular-attachment.d.ts.map +1 -1
  35. package/types/trismegisto-angular-bubble.d.ts +1 -1
  36. package/types/trismegisto-angular-code-viewer.d.ts +40 -3
  37. package/types/trismegisto-angular-code-viewer.d.ts.map +1 -1
  38. package/types/trismegisto-angular-data-grid.d.ts +27 -2
  39. package/types/trismegisto-angular-data-grid.d.ts.map +1 -1
  40. package/types/trismegisto-angular-icon.d.ts +2 -1
  41. package/types/trismegisto-angular-icon.d.ts.map +1 -1
  42. package/types/trismegisto-angular-message-divider.d.ts +4 -2
  43. package/types/trismegisto-angular-message-divider.d.ts.map +1 -1
  44. package/types/trismegisto-angular-message-scroller.d.ts +5 -0
  45. package/types/trismegisto-angular-message-scroller.d.ts.map +1 -1
  46. package/types/trismegisto-angular-prompt-input.d.ts +100 -0
  47. package/types/trismegisto-angular-prompt-input.d.ts.map +1 -0
  48. package/types/trismegisto-angular-prompt-suggestions.d.ts +3 -1
  49. package/types/trismegisto-angular-prompt-suggestions.d.ts.map +1 -1
  50. package/types/trismegisto-angular-questionnaire.d.ts +97 -0
  51. package/types/trismegisto-angular-questionnaire.d.ts.map +1 -0
  52. package/types/trismegisto-angular-trace.d.ts +11 -4
  53. package/types/trismegisto-angular-trace.d.ts.map +1 -1
  54. package/types/trismegisto-angular.d.ts +5 -3
  55. package/types/trismegisto-angular.d.ts.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"trismegisto-angular-message-divider.mjs","sources":["../../src/message-divider/message-divider.component.ts","../../src/message-divider/index.ts","../../src/message-divider/trismegisto-angular-message-divider.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { IconComponent } from '@trismegisto/angular/icon';\n\n/**\n * `separator`: texto centralizado entre dois traços — a quebra de data (\"Hoje\", \"Ontem\") ou de\n * sessão (\"Nova conversa\"). `inline`: ícone e texto alinhados ao começo, sem traço — o evento no meio\n * do fluxo (\"Ana entrou na conversa\", \"Chamado transferido para o financeiro\").\n */\nexport type MessageDividerVariant = 'separator' | 'inline';\n\n/**\n * Divisor de conversa: uma linha no fluxo das mensagens que não é mensagem de ninguém — quebra de\n * data, começo de uma conversa nova, um evento do sistema.\n *\n * ```html\n * <hm-message-divider label=\"Hoje\" />\n * <hm-message-divider variant=\"inline\" icon=\"user\" label=\"Ana entrou na conversa\" />\n * <hm-message-divider><time datetime=\"2026-10-03\">Ontem</time></hm-message-divider>\n * ```\n *\n * Nome: é um divisor *de mensagens*, do mesmo vocabulário de `hm-message`/`hm-message-scroller`.\n * Não confundir com `hm-divider` (separador genérico entre blocos de qualquer tela). O `hm-message-scroller` não o conta como mensagem nova.\n *\n * Acessibilidade: o texto é lido como texto comum, na ordem do fluxo (um `role=\"separator\"` tornaria\n * o texto apresentacional e ele sumiria para o leitor de tela); os traços e o ícone são decorativos.\n * `icon` é registrado pelo app, como todo ícone que vem de fora.\n */\n@Component({\n selector: 'hm-message-divider',\n imports: [IconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': 'modifiers()',\n },\n template: `\n @if (variant() === 'separator') {\n <span class=\"hm-message-divider__line\" aria-hidden=\"true\"></span>\n }\n <span class=\"hm-message-divider__label\">\n @if (icon()) {\n <hm-icon class=\"hm-message-divider__icon\" [shape]=\"icon()\" />\n }\n <span class=\"hm-message-divider__text\">{{ label() }}<ng-content /></span>\n </span>\n @if (variant() === 'separator') {\n <span class=\"hm-message-divider__line\" aria-hidden=\"true\"></span>\n }\n `,\n})\nexport class MessageDividerComponent {\n /** Texto do divisor. Conteúdo projetado também vale (um `<time>`, um link). */\n readonly label = input('');\n /** Ícone antes do texto (decorativo; o app registra). */\n readonly icon = input('');\n readonly variant = input<MessageDividerVariant>('separator');\n\n protected readonly modifiers = computed(() => `hm-message-divider hm-message-divider--${this.variant()}`);\n}\n","// Ponto de import `@trismegisto/angular/message-divider` (secundário do ng-packagr): o que o public-api e as outras pastas usam\n// daqui. Ao criar arquivo público novo na pasta, acrescente a linha.\nexport * from './message-divider.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAUA;;;;;;;;;;;;;;;;AAgBG;MAuBU,uBAAuB,CAAA;;AAEzB,IAAA,KAAK,GAAG,KAAK,CAAC,EAAE,4EAAC;;AAEjB,IAAA,IAAI,GAAG,KAAK,CAAC,EAAE,2EAAC;AAChB,IAAA,OAAO,GAAG,KAAK,CAAwB,WAAW,8EAAC;AAEzC,IAAA,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAA,uCAAA,EAA0C,IAAI,CAAC,OAAO,EAAE,CAAA,CAAE,gFAAC;wGAP9F,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAvB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,uBAAuB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,IAAA,EAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,OAAA,EAAA,aAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAfxB;;;;;;;;;;;;;AAaT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAlBS,aAAa,EAAA,QAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,WAAA,EAAA,MAAA,EAAA,OAAA,EAAA,OAAA,EAAA,QAAA,EAAA,MAAA,EAAA,SAAA,EAAA,OAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAoBZ,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAtBnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,oBAAoB;oBAC9B,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE,aAAa;AACzB,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;AAaT,EAAA,CAAA;AACF,iBAAA;;;AChDD;AACA;;ACDA;;AAEG;;"}
1
+ {"version":3,"file":"trismegisto-angular-message-divider.mjs","sources":["../../src/message-divider/message-divider.component.ts","../../src/message-divider/index.ts","../../src/message-divider/trismegisto-angular-message-divider.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, booleanAttribute, computed, input } from '@angular/core';\nimport { IconComponent } from '@trismegisto/angular/icon';\n\n/**\n * `separator`: texto centralizado entre dois traços — a quebra de data (\"Hoje\", \"Ontem\") ou de\n * sessão (\"Nova conversa\"). `inline`: ícone e texto alinhados ao começo, sem traço — o evento no meio\n * do fluxo (\"Ana entrou na conversa\", \"Chamado transferido para o financeiro\").\n */\nexport type MessageDividerVariant = 'separator' | 'inline' | 'border';\n\n/**\n * Divisor de conversa: uma linha no fluxo das mensagens que não é mensagem de ninguém — quebra de\n * data, começo de uma conversa nova, um evento do sistema.\n *\n * ```html\n * <hm-message-divider label=\"Hoje\" />\n * <hm-message-divider variant=\"inline\" icon=\"user\" label=\"Ana entrou na conversa\" />\n * <hm-message-divider><time datetime=\"2026-10-03\">Ontem</time></hm-message-divider>\n * ```\n *\n * Nome: é um divisor *de mensagens*, do mesmo vocabulário de `hm-message`/`hm-message-scroller`.\n * Não confundir com `hm-divider` (separador genérico entre blocos de qualquer tela). O `hm-message-scroller` não o conta como mensagem nova.\n *\n * Acessibilidade: o texto é lido como texto comum, na ordem do fluxo (um `role=\"separator\"` tornaria\n * o texto apresentacional e ele sumiria para o leitor de tela); os traços e o ícone são decorativos.\n * `icon` é registrado pelo app, como todo ícone que vem de fora.\n */\n@Component({\n selector: 'hm-message-divider',\n imports: [IconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': 'modifiers()',\n // Em andamento (\"Pensando…\", \"Buscando…\"): a mudança de texto é anunciada.\n '[attr.role]': \"live() ? 'status' : null\",\n },\n template: `\n @if (variant() === 'separator') {\n <span class=\"hm-message-divider__line\" aria-hidden=\"true\"></span>\n }\n <span class=\"hm-message-divider__label\">\n @if (live()) {\n <span class=\"hm-spinner hm-message-divider__spinner\" aria-hidden=\"true\"></span>\n } @else if (icon()) {\n <hm-icon class=\"hm-message-divider__icon\" [shape]=\"icon()\" />\n }\n <span class=\"hm-message-divider__text\">{{ label() }}<ng-content /></span>\n </span>\n @if (variant() === 'separator') {\n <span class=\"hm-message-divider__line\" aria-hidden=\"true\"></span>\n }\n `,\n})\nexport class MessageDividerComponent {\n /** Texto do divisor. Conteúdo projetado também vale (um `<time>`, um link). */\n readonly label = input('');\n /** Ícone antes do texto (decorativo; o app registra). */\n readonly icon = input('');\n readonly variant = input<MessageDividerVariant>('separator');\n /** Algo em andamento: troca o ícone por um spinner, o texto ganha brilho e as mudanças são anunciadas. */\n readonly live = input(false, { transform: booleanAttribute });\n\n protected readonly modifiers = computed(\n () => `hm-message-divider hm-message-divider--${this.variant()}${this.live() ? ' hm-message-divider--live' : ''}`,\n );\n}\n","// Ponto de import `@trismegisto/angular/message-divider` (secundário do ng-packagr): o que o public-api e as outras pastas usam\n// daqui. Ao criar arquivo público novo na pasta, acrescente a linha.\nexport * from './message-divider.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAUA;;;;;;;;;;;;;;;;AAgBG;MA2BU,uBAAuB,CAAA;;AAEzB,IAAA,KAAK,GAAG,KAAK,CAAC,EAAE,4EAAC;;AAEjB,IAAA,IAAI,GAAG,KAAK,CAAC,EAAE,2EAAC;AAChB,IAAA,OAAO,GAAG,KAAK,CAAwB,WAAW,8EAAC;;IAEnD,IAAI,GAAG,KAAK,CAAC,KAAK,4EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IAE1C,SAAS,GAAG,QAAQ,CACrC,MAAM,CAAA,uCAAA,EAA0C,IAAI,CAAC,OAAO,EAAE,CAAA,EAAG,IAAI,CAAC,IAAI,EAAE,GAAG,2BAA2B,GAAG,EAAE,CAAA,CAAE,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,WAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAClH;wGAXU,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAvB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,uBAAuB,EAAA,YA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,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,oBAAoB;oBAC9B,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE,aAAa;;AAExB,wBAAA,aAAa,EAAE,0BAA0B;AAC1C,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;AAeT,EAAA,CAAA;AACF,iBAAA;;;ACpDD;AACA;;ACDA;;AAEG;;"}
@@ -143,6 +143,20 @@ class MessageScrollerComponent {
143
143
  }
144
144
  this.measure();
145
145
  }
146
+ /**
147
+ * Leva até a mensagem com este `id` (uma resposta citada, o resultado de uma busca) e para de acompanhar o fim,
148
+ * para a leitura não ser puxada de volta. Devolve `false` se a mensagem não está na conversa.
149
+ */
150
+ scrollToMessage(id, behavior = 'auto') {
151
+ const content = this.content().nativeElement;
152
+ const target = content.ownerDocument.getElementById(id);
153
+ if (!target || !content.contains(target))
154
+ return false;
155
+ this.follow = false;
156
+ target.scrollIntoView({ block: 'start', behavior: behavior === 'smooth' && !prefersReducedMotion() ? 'smooth' : 'auto' });
157
+ this.measure();
158
+ return true;
159
+ }
146
160
  /** Anuncia um texto pela região viva do componente (ex.: "Ana saiu da conversa"). */
147
161
  announce(message) {
148
162
  clearTimeout(this.announceTimer);
@@ -1 +1 @@
1
- {"version":3,"file":"trismegisto-angular-message-scroller.mjs","sources":["../../src/message-scroller/icons.generated.ts","../../src/message-scroller/message-scroller.component.ts","../../src/message-scroller/index.ts","../../src/message-scroller/trismegisto-angular-message-scroller.ts"],"sourcesContent":["// GERADO por scripts/generate-internal-icons.mjs — não editar à mão.\n// Ícones que esta pasta usa por dentro; cada @Component/@Directive daqui os registra com\n// `readonly #icons = useHermesIcons(MESSAGE_SCROLLER_ICONS);`.\nimport type { RegisteredIcon } from '@trismegisto/icons';\nimport {\n ICON_ARROW,\n} from '@trismegisto/angular/icon';\n\nexport const MESSAGE_SCROLLER_ICONS: readonly RegisteredIcon[] = [ICON_ARROW];\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n afterNextRender,\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n effect,\n ElementRef,\n inject,\n input,\n output,\n PLATFORM_ID,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { anchoredScrollTop, CONVERSATION_ANNOUNCE_ATTR, conversationAnnouncement, isAtConversationEnd, isAtConversationStart } from '@trismegisto/primitives/conversation';\nimport { formatMessage, pluralMessage } from '@trismegisto/primitives/i18n';\nimport { prefersReducedMotion } from '@trismegisto/primitives/motion';\nimport { HERMES_MESSAGES } from '@trismegisto/angular/i18n';\nimport { ButtonComponent } from '@trismegisto/angular/button';\nimport { IconComponent, useHermesIcons } from '@trismegisto/angular/icon';\nimport { SpinnerComponent } from '@trismegisto/angular/spinner';\nimport { MESSAGE_SCROLLER_ICONS } from './icons.generated';\n\n/** `polite`: o componente anuncia as mensagens que chegam; `off`: o app cuida do anúncio (ou não quer). */\nexport type MessageScrollerLive = 'polite' | 'off';\n\n/** Item lembrado como âncora de leitura: o primeiro visível no topo e a distância dele ao topo. */\ninterface ReadingAnchor {\n readonly element: Element;\n readonly offset: number;\n}\n\n/**\n * Contêiner de uma conversa: rola, acompanha o fim quando chegam mensagens e carrega histórico pelo\n * topo sem tirar a pessoa do lugar.\n *\n * ```html\n * <hm-message-scroller [hasMoreHistory]=\"temMais()\" [loadingHistory]=\"carregando()\" (loadHistory)=\"carregarAnteriores()\">\n * @for (m of mensagens(); track m.id) {\n * <hm-message [author]=\"m.autor\" [time]=\"m.em\" [align]=\"m.minha ? 'end' : 'start'\"> ... </hm-message>\n * }\n * </hm-message-scroller>\n * ```\n *\n * - **Acompanhar o fim**: com a rolagem no fim, mensagem nova rola junto. Se a pessoa subiu para ler,\n * nada se mexe: a contagem de novas aparece no botão \"ir para o fim\" (que só existe enquanto ela\n * está longe do fim). Depois de enviar uma mensagem, chame `scrollToEnd()`.\n * - **Histórico**: `hasMoreHistory` mostra no topo o botão \"Carregar mensagens anteriores\", e chegar\n * ao topo rolando também emite `loadHistory` — assim como uma conversa curta demais para rolar, que\n * pede até encher a área (uma vez por pedido; desligue com `autoLoadHistory`).\n * Durante a busca, `loadingHistory` troca o botão por um indicador. O que entra acima não move o\n * que a pessoa estava lendo (âncora de leitura — não depende do `overflow-anchor` do navegador).\n * - Contam como mensagem os elementos que casam com `itemSelector` (por padrão, `hm-message`): o\n * `hm-message-divider` e outros elementos do fluxo não contam nem são anunciados.\n *\n * Acessibilidade: a área rolável é um `role=\"log\"` nomeado e focável (rola pelo teclado). O anúncio\n * de mensagem nova é comedido e passa por uma região `role=\"status\"` própria — e não pelo `aria-live`\n * implícito do `log`, que leria também cada troca de status, reação e o histórico inteiro carregado no\n * topo: anuncia só o que chega ao **fim**, educadamente, cortado num trecho curto; várias de uma vez\n * viram \"3 mensagens novas\"; mensagens enviadas pela própria pessoa (`hm-message` `end`) e trechos\n * marcados `data-hm-announce=\"off\"` ficam de fora. O botão \"ir para o fim\" leva o foco de volta à\n * conversa, porque some ao chegar lá.\n */\n@Component({\n selector: 'hm-message-scroller',\n imports: [ButtonComponent, IconComponent, SpinnerComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'hm-message-scroller' },\n template: `\n <div\n #viewport\n class=\"hm-message-scroller__viewport\"\n role=\"log\"\n tabindex=\"0\"\n aria-live=\"off\"\n [attr.aria-label]=\"label() || text.label\"\n [attr.aria-busy]=\"loadingHistory() ? 'true' : null\"\n (scroll)=\"onScroll()\"\n >\n <div #inner class=\"hm-message-scroller__inner\">\n @if (hasMoreHistory()) {\n <div class=\"hm-message-scroller__history\">\n @if (loadingHistory()) {\n <hm-spinner size=\"small\" [label]=\"text.loadingHistory\" [labelVisible]=\"true\" />\n } @else {\n <hm-button emphasis=\"minimal\" size=\"small\" (clicked)=\"requestHistory()\">{{ text.loadHistory }}</hm-button>\n }\n </div>\n }\n <div #content class=\"hm-message-scroller__content\"><ng-content /></div>\n </div>\n </div>\n @if (!atEnd()) {\n <button\n type=\"button\"\n class=\"hm-message-scroller__jump\"\n [class.hm-message-scroller__jump--count]=\"unread() > 0\"\n [attr.aria-label]=\"jumpLabel()\"\n (click)=\"jumpToEnd()\"\n >\n <hm-icon shape=\"arrow\" direction=\"down\" />\n @if (unread() > 0) {\n <span class=\"hm-message-scroller__count\" aria-hidden=\"true\">{{ unreadText() }}</span>\n }\n </button>\n }\n <div class=\"hm-visually-hidden\" role=\"status\">{{ announcement() }}</div>\n `,\n})\nexport class MessageScrollerComponent {\n readonly #icons = useHermesIcons(MESSAGE_SCROLLER_ICONS);\n /** Nome da região da conversa (\"Conversa com Ana\"). Padrão: `conversation.label` do catálogo. */\n readonly label = input('');\n /** Há mensagens anteriores a buscar: mostra o botão no topo e liga o pedido ao rolar até lá. */\n readonly hasMoreHistory = input(false, { transform: booleanAttribute });\n /** O histórico pedido está a caminho: indicador no topo e nenhum pedido novo. */\n readonly loadingHistory = input(false, { transform: booleanAttribute });\n /** Chegar ao topo rolando já pede histórico (além do botão). */\n readonly autoLoadHistory = input(true, { transform: booleanAttribute });\n /** Anúncio de mensagem nova pelo componente (`polite`) ou nenhum (`off`). */\n readonly live = input<MessageScrollerLive>('polite');\n /** Seletor CSS do que conta como mensagem (contagem, anúncio, âncora de leitura). */\n readonly itemSelector = input('hm-message');\n /** Folga, em px, para considerar a rolagem no fim/no topo. */\n readonly threshold = input(32);\n\n /** Pedido de mensagens anteriores (botão do topo ou rolagem até o topo). */\n readonly loadHistory = output<void>();\n /** A rolagem chegou ao fim (`true`) ou saiu dele (`false`) — útil para marcar como lidas. */\n readonly atEndChange = output<boolean>();\n\n private readonly messages = inject(HERMES_MESSAGES);\n protected get text() {\n return this.messages.conversation;\n }\n\n /** Rolagem no fim. */\n readonly atEnd = signal(true);\n /** Mensagens que chegaram com a rolagem longe do fim e ainda não foram vistas. */\n readonly unread = signal(0);\n protected readonly announcement = signal('');\n\n protected readonly unreadText = computed(() =>\n pluralMessage(this.messages.conversation.newMessages, this.unread(), this.messages.meta.locale),\n );\n protected readonly jumpLabel = computed(() =>\n this.unread() > 0\n ? formatMessage(this.messages.conversation.jumpWithNew, { messages: this.unreadText() })\n : this.messages.conversation.jumpToEnd,\n );\n\n private readonly viewport = viewChild.required<ElementRef<HTMLElement>>('viewport');\n private readonly content = viewChild.required<ElementRef<HTMLElement>>('content');\n /** Histórico do topo + mensagens: a altura dele é o que muda quando algo entra ou sai. */\n private readonly inner = viewChild.required<ElementRef<HTMLElement>>('inner');\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n /** Acompanha o fim: decidido pela posição ANTES do conteúdo mudar. */\n private follow = true;\n /** Rolagem suave até o fim em andamento: os eventos de rolagem do caminho não desligam o `follow`. */\n private jumping = false;\n private anchor: ReadingAnchor | null = null;\n /** Já pediu histórico e ainda não chegou nada (nem `loadingHistory` voltou a falso). */\n private historyRequested = false;\n private announceTimer: ReturnType<typeof setTimeout> | undefined;\n private jumpTimer: ReturnType<typeof setTimeout> | undefined;\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n destroyRef.onDestroy(() => {\n clearTimeout(this.announceTimer);\n clearTimeout(this.jumpTimer);\n });\n\n // A busca terminou (com ou sem mensagens): um próximo pedido volta a valer.\n let wasLoading = false;\n effect(() => {\n const loading = this.loadingHistory();\n if (wasLoading && !loading) this.historyRequested = false;\n wasLoading = loading;\n });\n\n afterNextRender(() => {\n if (!this.browser) return;\n const content = this.content().nativeElement;\n this.settle();\n const mutations = new MutationObserver((records) => this.onMutations(records));\n mutations.observe(content, { childList: true, subtree: true });\n // Altura que muda sem nó novo nas mensagens (imagem que carrega, texto que quebra diferente ao\n // redimensionar, o botão de histórico que vira indicador ou some).\n const resize = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(() => this.settle());\n resize?.observe(this.inner().nativeElement);\n resize?.observe(this.viewport().nativeElement);\n destroyRef.onDestroy(() => {\n mutations.disconnect();\n resize?.disconnect();\n });\n });\n }\n\n /** Rola até a mensagem mais recente e volta a acompanhar o fim (chame depois de a pessoa enviar). */\n scrollToEnd(behavior: ScrollBehavior = 'auto'): void {\n const viewport = this.viewport().nativeElement;\n this.follow = true;\n this.unread.set(0);\n const top = viewport.scrollHeight;\n if (behavior === 'smooth' && !prefersReducedMotion()) {\n this.jumping = true;\n clearTimeout(this.jumpTimer);\n // Rede de segurança: rolagem suave interrompida (a pessoa rolou no meio) não deixa o `jumping` preso.\n this.jumpTimer = setTimeout(() => {\n this.jumping = false;\n this.follow = isAtConversationEnd(this.metrics(), this.threshold());\n this.measure();\n }, 1000);\n viewport.scrollTo({ top, behavior: 'smooth' });\n } else {\n viewport.scrollTop = top;\n }\n this.measure();\n }\n\n /** Anuncia um texto pela região viva do componente (ex.: \"Ana saiu da conversa\"). */\n announce(message: string): void {\n clearTimeout(this.announceTimer);\n // Esvazia e preenche depois: o mesmo texto duas vezes seguidas também é anunciado.\n this.announcement.set('');\n this.announceTimer = setTimeout(() => this.announcement.set(message), 50);\n }\n\n protected jumpToEnd(): void {\n // O botão some ao chegar ao fim: o foco vai para a conversa, não se perde no <body>.\n this.viewport().nativeElement.focus({ preventScroll: true });\n this.scrollToEnd('smooth');\n }\n\n protected requestHistory(): void {\n if (this.loadingHistory() || this.historyRequested) return;\n this.historyRequested = true;\n this.loadHistory.emit();\n }\n\n protected onScroll(): void {\n const metrics = this.metrics();\n const atEnd = isAtConversationEnd(metrics, this.threshold());\n if (this.jumping && atEnd) {\n this.jumping = false;\n clearTimeout(this.jumpTimer);\n }\n if (!this.jumping) this.follow = atEnd;\n this.measure();\n this.rememberAnchor();\n if (this.autoLoadHistory() && this.hasMoreHistory() && isAtConversationStart(metrics, this.threshold())) {\n this.requestHistory();\n }\n }\n\n private onMutations(records: MutationRecord[]): void {\n const selector = this.itemSelector();\n const added: Element[] = [];\n for (const record of records) {\n for (const node of Array.from(record.addedNodes)) {\n if (!(node instanceof Element)) continue;\n if (node.matches(selector)) added.push(node);\n added.push(...Array.from(node.querySelectorAll(selector)));\n }\n }\n if (added.length) {\n const reference = this.anchor?.element.isConnected ? this.anchor.element : null;\n // Entrou antes da âncora de leitura = histórico; depois = mensagem nova.\n const incoming = added.filter(\n (el) =>\n el !== reference &&\n (!reference || !!(reference.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING)) &&\n el.getAttribute(CONVERSATION_ANNOUNCE_ATTR) !== 'off',\n );\n if (incoming.length < added.length) this.historyRequested = false;\n if (incoming.length) this.receive(incoming);\n }\n this.settle();\n }\n\n /** Mensagens novas no fim: conta se a pessoa está longe do fim e anuncia (se `live`). */\n private receive(items: Element[]): void {\n untracked(() => {\n if (!this.follow) this.unread.update((n) => n + items.length);\n if (this.live() === 'off') return;\n const text =\n items.length === 1\n ? conversationAnnouncement(items[0])\n : pluralMessage(this.messages.conversation.newMessages, items.length, this.messages.meta.locale);\n if (text) this.announce(text);\n });\n }\n\n /** Depois de qualquer mudança de conteúdo/tamanho: segue o fim ou segura a âncora de leitura. */\n private settle(): void {\n const viewport = this.viewport().nativeElement;\n if (this.follow) {\n // Rolagem suave em andamento: o fim mudou (a mensagem recém-enviada entrou no DOM), o alvo também.\n if (this.jumping) viewport.scrollTo({ top: viewport.scrollHeight, behavior: 'smooth' });\n else viewport.scrollTop = viewport.scrollHeight;\n } else if (this.anchor?.element.isConnected) {\n const offset = this.offsetOf(this.anchor.element);\n if (offset !== this.anchor.offset) viewport.scrollTop = anchoredScrollTop(viewport.scrollTop, this.anchor.offset, offset);\n }\n this.measure();\n this.rememberAnchor();\n // Conversa curta demais para rolar não tem como \"chegar ao topo\": com mais histórico, já pede.\n const metrics = this.metrics();\n if (this.autoLoadHistory() && this.hasMoreHistory() && metrics.scrollHeight <= metrics.clientHeight) this.requestHistory();\n }\n\n private measure(): void {\n const atEnd = isAtConversationEnd(this.metrics(), this.threshold());\n if (atEnd) this.unread.set(0);\n if (atEnd !== untracked(this.atEnd)) {\n this.atEnd.set(atEnd);\n this.atEndChange.emit(atEnd);\n }\n }\n\n /** Lembra o primeiro item visível no topo (ou, sem medida possível, o último) e a distância dele. */\n private rememberAnchor(): void {\n const items = Array.from(this.content().nativeElement.querySelectorAll(this.itemSelector()));\n if (!items.length) {\n this.anchor = null;\n return;\n }\n const top = this.viewport().nativeElement.getBoundingClientRect().top;\n const element = items.find((el) => el.getBoundingClientRect().bottom > top) ?? items[items.length - 1];\n this.anchor = { element, offset: this.offsetOf(element) };\n }\n\n private offsetOf(element: Element): number {\n return element.getBoundingClientRect().top - this.viewport().nativeElement.getBoundingClientRect().top;\n }\n\n private metrics() {\n const { scrollTop, scrollHeight, clientHeight } = this.viewport().nativeElement;\n return { scrollTop, scrollHeight, clientHeight };\n }\n}\n","// Ponto de import `@trismegisto/angular/message-scroller` (secundário do ng-packagr): o que o public-api e as outras pastas usam\n// daqui. Ao criar arquivo público novo na pasta, acrescente a linha.\nexport * from './message-scroller.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAQO,MAAM,sBAAsB,GAA8B,CAAC,UAAU,CAAC;;AC4B7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;MA+CU,wBAAwB,CAAA;AAC1B,IAAA,MAAM,GAAG,cAAc,CAAC,sBAAsB,CAAC;;AAE/C,IAAA,KAAK,GAAG,KAAK,CAAC,EAAE,4EAAC;;IAEjB,cAAc,GAAG,KAAK,CAAC,KAAK,sFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAE9D,cAAc,GAAG,KAAK,CAAC,KAAK,sFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAE9D,eAAe,GAAG,KAAK,CAAC,IAAI,uFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;AAE9D,IAAA,IAAI,GAAG,KAAK,CAAsB,QAAQ,2EAAC;;AAE3C,IAAA,YAAY,GAAG,KAAK,CAAC,YAAY,mFAAC;;AA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AAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CACX,SAAS,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAEX,OAAO,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AC9J9E;AACA;;ACDA;;AAEG;;"}
1
+ {"version":3,"file":"trismegisto-angular-message-scroller.mjs","sources":["../../src/message-scroller/icons.generated.ts","../../src/message-scroller/message-scroller.component.ts","../../src/message-scroller/index.ts","../../src/message-scroller/trismegisto-angular-message-scroller.ts"],"sourcesContent":["// GERADO por scripts/generate-internal-icons.mjs — não editar à mão.\n// Ícones que esta pasta usa por dentro; cada @Component/@Directive daqui os registra com\n// `readonly #icons = useHermesIcons(MESSAGE_SCROLLER_ICONS);`.\nimport type { RegisteredIcon } from '@trismegisto/icons';\nimport {\n ICON_ARROW,\n} from '@trismegisto/angular/icon';\n\nexport const MESSAGE_SCROLLER_ICONS: readonly RegisteredIcon[] = [ICON_ARROW];\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n afterNextRender,\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n effect,\n ElementRef,\n inject,\n input,\n output,\n PLATFORM_ID,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { anchoredScrollTop, CONVERSATION_ANNOUNCE_ATTR, conversationAnnouncement, isAtConversationEnd, isAtConversationStart } from '@trismegisto/primitives/conversation';\nimport { formatMessage, pluralMessage } from '@trismegisto/primitives/i18n';\nimport { prefersReducedMotion } from '@trismegisto/primitives/motion';\nimport { HERMES_MESSAGES } from '@trismegisto/angular/i18n';\nimport { ButtonComponent } from '@trismegisto/angular/button';\nimport { IconComponent, useHermesIcons } from '@trismegisto/angular/icon';\nimport { SpinnerComponent } from '@trismegisto/angular/spinner';\nimport { MESSAGE_SCROLLER_ICONS } from './icons.generated';\n\n/** `polite`: o componente anuncia as mensagens que chegam; `off`: o app cuida do anúncio (ou não quer). */\nexport type MessageScrollerLive = 'polite' | 'off';\n\n/** Item lembrado como âncora de leitura: o primeiro visível no topo e a distância dele ao topo. */\ninterface ReadingAnchor {\n readonly element: Element;\n readonly offset: number;\n}\n\n/**\n * Contêiner de uma conversa: rola, acompanha o fim quando chegam mensagens e carrega histórico pelo\n * topo sem tirar a pessoa do lugar.\n *\n * ```html\n * <hm-message-scroller [hasMoreHistory]=\"temMais()\" [loadingHistory]=\"carregando()\" (loadHistory)=\"carregarAnteriores()\">\n * @for (m of mensagens(); track m.id) {\n * <hm-message [author]=\"m.autor\" [time]=\"m.em\" [align]=\"m.minha ? 'end' : 'start'\"> ... </hm-message>\n * }\n * </hm-message-scroller>\n * ```\n *\n * - **Acompanhar o fim**: com a rolagem no fim, mensagem nova rola junto. Se a pessoa subiu para ler,\n * nada se mexe: a contagem de novas aparece no botão \"ir para o fim\" (que só existe enquanto ela\n * está longe do fim). Depois de enviar uma mensagem, chame `scrollToEnd()`.\n * - **Histórico**: `hasMoreHistory` mostra no topo o botão \"Carregar mensagens anteriores\", e chegar\n * ao topo rolando também emite `loadHistory` — assim como uma conversa curta demais para rolar, que\n * pede até encher a área (uma vez por pedido; desligue com `autoLoadHistory`).\n * Durante a busca, `loadingHistory` troca o botão por um indicador. O que entra acima não move o\n * que a pessoa estava lendo (âncora de leitura — não depende do `overflow-anchor` do navegador).\n * - Contam como mensagem os elementos que casam com `itemSelector` (por padrão, `hm-message`): o\n * `hm-message-divider` e outros elementos do fluxo não contam nem são anunciados.\n *\n * Acessibilidade: a área rolável é um `role=\"log\"` nomeado e focável (rola pelo teclado). O anúncio\n * de mensagem nova é comedido e passa por uma região `role=\"status\"` própria — e não pelo `aria-live`\n * implícito do `log`, que leria também cada troca de status, reação e o histórico inteiro carregado no\n * topo: anuncia só o que chega ao **fim**, educadamente, cortado num trecho curto; várias de uma vez\n * viram \"3 mensagens novas\"; mensagens enviadas pela própria pessoa (`hm-message` `end`) e trechos\n * marcados `data-hm-announce=\"off\"` ficam de fora. O botão \"ir para o fim\" leva o foco de volta à\n * conversa, porque some ao chegar lá.\n */\n@Component({\n selector: 'hm-message-scroller',\n imports: [ButtonComponent, IconComponent, SpinnerComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'hm-message-scroller' },\n template: `\n <div\n #viewport\n class=\"hm-message-scroller__viewport\"\n role=\"log\"\n tabindex=\"0\"\n aria-live=\"off\"\n [attr.aria-label]=\"label() || text.label\"\n [attr.aria-busy]=\"loadingHistory() ? 'true' : null\"\n (scroll)=\"onScroll()\"\n >\n <div #inner class=\"hm-message-scroller__inner\">\n @if (hasMoreHistory()) {\n <div class=\"hm-message-scroller__history\">\n @if (loadingHistory()) {\n <hm-spinner size=\"small\" [label]=\"text.loadingHistory\" [labelVisible]=\"true\" />\n } @else {\n <hm-button emphasis=\"minimal\" size=\"small\" (clicked)=\"requestHistory()\">{{ text.loadHistory }}</hm-button>\n }\n </div>\n }\n <div #content class=\"hm-message-scroller__content\"><ng-content /></div>\n </div>\n </div>\n @if (!atEnd()) {\n <button\n type=\"button\"\n class=\"hm-message-scroller__jump\"\n [class.hm-message-scroller__jump--count]=\"unread() > 0\"\n [attr.aria-label]=\"jumpLabel()\"\n (click)=\"jumpToEnd()\"\n >\n <hm-icon shape=\"arrow\" direction=\"down\" />\n @if (unread() > 0) {\n <span class=\"hm-message-scroller__count\" aria-hidden=\"true\">{{ unreadText() }}</span>\n }\n </button>\n }\n <div class=\"hm-visually-hidden\" role=\"status\">{{ announcement() }}</div>\n `,\n})\nexport class MessageScrollerComponent {\n readonly #icons = useHermesIcons(MESSAGE_SCROLLER_ICONS);\n /** Nome da região da conversa (\"Conversa com Ana\"). Padrão: `conversation.label` do catálogo. */\n readonly label = input('');\n /** Há mensagens anteriores a buscar: mostra o botão no topo e liga o pedido ao rolar até lá. */\n readonly hasMoreHistory = input(false, { transform: booleanAttribute });\n /** O histórico pedido está a caminho: indicador no topo e nenhum pedido novo. */\n readonly loadingHistory = input(false, { transform: booleanAttribute });\n /** Chegar ao topo rolando já pede histórico (além do botão). */\n readonly autoLoadHistory = input(true, { transform: booleanAttribute });\n /** Anúncio de mensagem nova pelo componente (`polite`) ou nenhum (`off`). */\n readonly live = input<MessageScrollerLive>('polite');\n /** Seletor CSS do que conta como mensagem (contagem, anúncio, âncora de leitura). */\n readonly itemSelector = input('hm-message');\n /** Folga, em px, para considerar a rolagem no fim/no topo. */\n readonly threshold = input(32);\n\n /** Pedido de mensagens anteriores (botão do topo ou rolagem até o topo). */\n readonly loadHistory = output<void>();\n /** A rolagem chegou ao fim (`true`) ou saiu dele (`false`) — útil para marcar como lidas. */\n readonly atEndChange = output<boolean>();\n\n private readonly messages = inject(HERMES_MESSAGES);\n protected get text() {\n return this.messages.conversation;\n }\n\n /** Rolagem no fim. */\n readonly atEnd = signal(true);\n /** Mensagens que chegaram com a rolagem longe do fim e ainda não foram vistas. */\n readonly unread = signal(0);\n protected readonly announcement = signal('');\n\n protected readonly unreadText = computed(() =>\n pluralMessage(this.messages.conversation.newMessages, this.unread(), this.messages.meta.locale),\n );\n protected readonly jumpLabel = computed(() =>\n this.unread() > 0\n ? formatMessage(this.messages.conversation.jumpWithNew, { messages: this.unreadText() })\n : this.messages.conversation.jumpToEnd,\n );\n\n private readonly viewport = viewChild.required<ElementRef<HTMLElement>>('viewport');\n private readonly content = viewChild.required<ElementRef<HTMLElement>>('content');\n /** Histórico do topo + mensagens: a altura dele é o que muda quando algo entra ou sai. */\n private readonly inner = viewChild.required<ElementRef<HTMLElement>>('inner');\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n /** Acompanha o fim: decidido pela posição ANTES do conteúdo mudar. */\n private follow = true;\n /** Rolagem suave até o fim em andamento: os eventos de rolagem do caminho não desligam o `follow`. */\n private jumping = false;\n private anchor: ReadingAnchor | null = null;\n /** Já pediu histórico e ainda não chegou nada (nem `loadingHistory` voltou a falso). */\n private historyRequested = false;\n private announceTimer: ReturnType<typeof setTimeout> | undefined;\n private jumpTimer: ReturnType<typeof setTimeout> | undefined;\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n destroyRef.onDestroy(() => {\n clearTimeout(this.announceTimer);\n clearTimeout(this.jumpTimer);\n });\n\n // A busca terminou (com ou sem mensagens): um próximo pedido volta a valer.\n let wasLoading = false;\n effect(() => {\n const loading = this.loadingHistory();\n if (wasLoading && !loading) this.historyRequested = false;\n wasLoading = loading;\n });\n\n afterNextRender(() => {\n if (!this.browser) return;\n const content = this.content().nativeElement;\n this.settle();\n const mutations = new MutationObserver((records) => this.onMutations(records));\n mutations.observe(content, { childList: true, subtree: true });\n // Altura que muda sem nó novo nas mensagens (imagem que carrega, texto que quebra diferente ao\n // redimensionar, o botão de histórico que vira indicador ou some).\n const resize = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(() => this.settle());\n resize?.observe(this.inner().nativeElement);\n resize?.observe(this.viewport().nativeElement);\n destroyRef.onDestroy(() => {\n mutations.disconnect();\n resize?.disconnect();\n });\n });\n }\n\n /** Rola até a mensagem mais recente e volta a acompanhar o fim (chame depois de a pessoa enviar). */\n scrollToEnd(behavior: ScrollBehavior = 'auto'): void {\n const viewport = this.viewport().nativeElement;\n this.follow = true;\n this.unread.set(0);\n const top = viewport.scrollHeight;\n if (behavior === 'smooth' && !prefersReducedMotion()) {\n this.jumping = true;\n clearTimeout(this.jumpTimer);\n // Rede de segurança: rolagem suave interrompida (a pessoa rolou no meio) não deixa o `jumping` preso.\n this.jumpTimer = setTimeout(() => {\n this.jumping = false;\n this.follow = isAtConversationEnd(this.metrics(), this.threshold());\n this.measure();\n }, 1000);\n viewport.scrollTo({ top, behavior: 'smooth' });\n } else {\n viewport.scrollTop = top;\n }\n this.measure();\n }\n\n /**\n * Leva até a mensagem com este `id` (uma resposta citada, o resultado de uma busca) e para de acompanhar o fim,\n * para a leitura não ser puxada de volta. Devolve `false` se a mensagem não está na conversa.\n */\n scrollToMessage(id: string, behavior: ScrollBehavior = 'auto'): boolean {\n const content = this.content().nativeElement;\n const target = content.ownerDocument.getElementById(id);\n if (!target || !content.contains(target)) return false;\n this.follow = false;\n target.scrollIntoView({ block: 'start', behavior: behavior === 'smooth' && !prefersReducedMotion() ? 'smooth' : 'auto' });\n this.measure();\n return true;\n }\n\n /** Anuncia um texto pela região viva do componente (ex.: \"Ana saiu da conversa\"). */\n announce(message: string): void {\n clearTimeout(this.announceTimer);\n // Esvazia e preenche depois: o mesmo texto duas vezes seguidas também é anunciado.\n this.announcement.set('');\n this.announceTimer = setTimeout(() => this.announcement.set(message), 50);\n }\n\n protected jumpToEnd(): void {\n // O botão some ao chegar ao fim: o foco vai para a conversa, não se perde no <body>.\n this.viewport().nativeElement.focus({ preventScroll: true });\n this.scrollToEnd('smooth');\n }\n\n protected requestHistory(): void {\n if (this.loadingHistory() || this.historyRequested) return;\n this.historyRequested = true;\n this.loadHistory.emit();\n }\n\n protected onScroll(): void {\n const metrics = this.metrics();\n const atEnd = isAtConversationEnd(metrics, this.threshold());\n if (this.jumping && atEnd) {\n this.jumping = false;\n clearTimeout(this.jumpTimer);\n }\n if (!this.jumping) this.follow = atEnd;\n this.measure();\n this.rememberAnchor();\n if (this.autoLoadHistory() && this.hasMoreHistory() && isAtConversationStart(metrics, this.threshold())) {\n this.requestHistory();\n }\n }\n\n private onMutations(records: MutationRecord[]): void {\n const selector = this.itemSelector();\n const added: Element[] = [];\n for (const record of records) {\n for (const node of Array.from(record.addedNodes)) {\n if (!(node instanceof Element)) continue;\n if (node.matches(selector)) added.push(node);\n added.push(...Array.from(node.querySelectorAll(selector)));\n }\n }\n if (added.length) {\n const reference = this.anchor?.element.isConnected ? this.anchor.element : null;\n // Entrou antes da âncora de leitura = histórico; depois = mensagem nova.\n const incoming = added.filter(\n (el) =>\n el !== reference &&\n (!reference || !!(reference.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING)) &&\n el.getAttribute(CONVERSATION_ANNOUNCE_ATTR) !== 'off',\n );\n if (incoming.length < added.length) this.historyRequested = false;\n if (incoming.length) this.receive(incoming);\n }\n this.settle();\n }\n\n /** Mensagens novas no fim: conta se a pessoa está longe do fim e anuncia (se `live`). */\n private receive(items: Element[]): void {\n untracked(() => {\n if (!this.follow) this.unread.update((n) => n + items.length);\n if (this.live() === 'off') return;\n const text =\n items.length === 1\n ? conversationAnnouncement(items[0])\n : pluralMessage(this.messages.conversation.newMessages, items.length, this.messages.meta.locale);\n if (text) this.announce(text);\n });\n }\n\n /** Depois de qualquer mudança de conteúdo/tamanho: segue o fim ou segura a âncora de leitura. */\n private settle(): void {\n const viewport = this.viewport().nativeElement;\n if (this.follow) {\n // Rolagem suave em andamento: o fim mudou (a mensagem recém-enviada entrou no DOM), o alvo também.\n if (this.jumping) viewport.scrollTo({ top: viewport.scrollHeight, behavior: 'smooth' });\n else viewport.scrollTop = viewport.scrollHeight;\n } else if (this.anchor?.element.isConnected) {\n const offset = this.offsetOf(this.anchor.element);\n if (offset !== this.anchor.offset) viewport.scrollTop = anchoredScrollTop(viewport.scrollTop, this.anchor.offset, offset);\n }\n this.measure();\n this.rememberAnchor();\n // Conversa curta demais para rolar não tem como \"chegar ao topo\": com mais histórico, já pede.\n const metrics = this.metrics();\n if (this.autoLoadHistory() && this.hasMoreHistory() && metrics.scrollHeight <= metrics.clientHeight) this.requestHistory();\n }\n\n private measure(): void {\n const atEnd = isAtConversationEnd(this.metrics(), this.threshold());\n if (atEnd) this.unread.set(0);\n if (atEnd !== untracked(this.atEnd)) {\n this.atEnd.set(atEnd);\n this.atEndChange.emit(atEnd);\n }\n }\n\n /** Lembra o primeiro item visível no topo (ou, sem medida possível, o último) e a distância dele. */\n private rememberAnchor(): void {\n const items = Array.from(this.content().nativeElement.querySelectorAll(this.itemSelector()));\n if (!items.length) {\n this.anchor = null;\n return;\n }\n const top = this.viewport().nativeElement.getBoundingClientRect().top;\n const element = items.find((el) => el.getBoundingClientRect().bottom > top) ?? items[items.length - 1];\n this.anchor = { element, offset: this.offsetOf(element) };\n }\n\n private offsetOf(element: Element): number {\n return element.getBoundingClientRect().top - this.viewport().nativeElement.getBoundingClientRect().top;\n }\n\n private metrics() {\n const { scrollTop, scrollHeight, clientHeight } = this.viewport().nativeElement;\n return { scrollTop, scrollHeight, clientHeight };\n }\n}\n","// Ponto de import `@trismegisto/angular/message-scroller` (secundário do ng-packagr): o que o public-api e as outras pastas usam\n// daqui. Ao criar arquivo público novo na pasta, acrescente a linha.\nexport * from './message-scroller.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAQO,MAAM,sBAAsB,GAA8B,CAAC,UAAU,CAAC;;AC4B7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;MA+CU,wBAAwB,CAAA;AAC1B,IAAA,MAAM,GAAG,cAAc,CAAC,sBAAsB,CAAC;;AAE/C,IAAA,KAAK,GAAG,KAAK,CAAC,EAAE,4EAAC;;IAEjB,cAAc,GAAG,KAAK,CAAC,KAAK,sFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAE9D,cAAc,GAAG,KAAK,CAAC,KAAK,sFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAE9D,eAAe,GAAG,KAAK,CAAC,IAAI,uFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;AAE9D,IAAA,IAAI,GAAG,KAAK,CAAsB,QAAQ,2EAAC;;AAE3C,IAAA,YAAY,GAAG,KAAK,CAAC,YAAY,mFAAC;;AAElC,IAAA,SAAS,GAAG,KAAK,CAAC,EAAE,gFAAC;;IAGrB,WAAW,GAAG,MAAM,EAAQ;;IAE5B,WAAW,GAAG,MAAM,EAAW;AAEvB,IAAA,QAAQ,GAAG,MAAM,CAAC,e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wBAAwB,EAAA,UAAA,EAAA,CAAA;kBA9CpC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,qBAAqB;AAC/B,oBAAA,OAAO,EAAE,CAAC,eAAe,EAAE,aAAa,EAAE,gBAAgB,CAAC;oBAC3D,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,IAAI,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE;AACtC,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCT,EAAA,CAAA;AACF,iBAAA;w5BA2CyE,UAAU,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CACX,SAAS,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAEX,OAAO,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AC9J9E;AACA;;ACDA;;AAEG;;"}
@@ -0,0 +1,251 @@
1
+ import * as i0 from '@angular/core';
2
+ import { model, input, booleanAttribute, output, inject, viewChild, computed, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { ModelSelectorComponent } from '@trismegisto/angular/agent';
4
+ import { AttachmentComponent, AttachmentGroupComponent } from '@trismegisto/angular/attachment';
5
+ import { HermesI18nService } from '@trismegisto/angular/i18n';
6
+ import { ICON_PAPERCLIP, ICON_SEND_ARROW, ICON_STOP, useHermesIcons } from '@trismegisto/angular/icon';
7
+ import { IconButtonComponent } from '@trismegisto/angular/icon-button';
8
+ import { TextareaAddonDirective, TextareaComponent } from '@trismegisto/angular/textarea';
9
+
10
+ const PROMPT_INPUT_ICONS = [ICON_PAPERCLIP, ICON_SEND_ARROW, ICON_STOP];
11
+
12
+ // Textos do hm-prompt-input (pt-BR/en/es). Ficam na pasta, fora do HERMES_MESSAGES compartilhado, para não pesar no
13
+ // bundle de quem não usa a peça. O componente escolhe pelo idioma ativo do `HermesI18nService` (`pick`) e aceita
14
+ // sobrescrita parcial pelo input `texts`.
15
+ const PROMPT_INPUT_MESSAGES_PT_BR = {
16
+ label: 'Mensagem para o agente',
17
+ placeholder: 'Pergunte algo ou descreva a tarefa',
18
+ hint: 'Enter envia; Shift+Enter quebra a linha.',
19
+ attach: 'Anexar arquivo',
20
+ attachments: 'Anexos da mensagem',
21
+ send: 'Enviar',
22
+ stop: 'Parar a resposta',
23
+ model: 'Modelo',
24
+ effort: 'Esforço',
25
+ };
26
+ const PROMPT_INPUT_MESSAGES_EN = {
27
+ label: 'Message to the agent',
28
+ placeholder: 'Ask something or describe the task',
29
+ hint: 'Enter sends; Shift+Enter adds a line.',
30
+ attach: 'Attach file',
31
+ attachments: 'Message attachments',
32
+ send: 'Send',
33
+ stop: 'Stop the reply',
34
+ model: 'Model',
35
+ effort: 'Effort',
36
+ };
37
+ const PROMPT_INPUT_MESSAGES_ES = {
38
+ label: 'Mensaje para el agente',
39
+ placeholder: 'Pregunte algo o describa la tarea',
40
+ hint: 'Enter envía; Shift+Enter agrega una línea.',
41
+ attach: 'Adjuntar archivo',
42
+ attachments: 'Adjuntos del mensaje',
43
+ send: 'Enviar',
44
+ stop: 'Detener la respuesta',
45
+ model: 'Modelo',
46
+ effort: 'Esfuerzo',
47
+ };
48
+ /** Catálogos por idioma, para `HermesI18nService.pick`. */
49
+ const PROMPT_INPUT_MESSAGES = {
50
+ 'pt-BR': PROMPT_INPUT_MESSAGES_PT_BR,
51
+ en: PROMPT_INPUT_MESSAGES_EN,
52
+ es: PROMPT_INPUT_MESSAGES_ES,
53
+ };
54
+
55
+ /**
56
+ * O campo em que a pessoa escreve para o agente: texto que cresce, anexos, escolha de modelo e de esforço, e enviar
57
+ * (ou parar, enquanto o agente responde). Enter envia; Shift+Enter quebra a linha. Só apresenta e devolve a intenção:
58
+ * ler os arquivos, enviar e limpar o campo é do app.
59
+ *
60
+ * ```html
61
+ * <hm-prompt-input [(value)]="texto" [attachments]="anexos" [models]="modelos" [(model)]="modelo"
62
+ * [streaming]="respondendo()" (submitted)="enviar($event)" (stopped)="parar()" (filesAdded)="anexar($event)" />
63
+ * ```
64
+ */
65
+ class PromptInputComponent {
66
+ #icons = useHermesIcons(PROMPT_INPUT_ICONS);
67
+ value = model('', ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
68
+ /** Nome do campo. Padrão: "Mensagem para o agente". */
69
+ label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
70
+ /** Mostra o rótulo acima do campo (por padrão ele vale só para leitor de tela). */
71
+ showLabel = input(false, { ...(ngDevMode ? { debugName: "showLabel" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
72
+ placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
73
+ hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
74
+ disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
75
+ /** O agente está respondendo: no lugar de enviar, o botão para a resposta. */
76
+ streaming = input(false, { ...(ngDevMode ? { debugName: "streaming" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
77
+ attachments = input([], ...(ngDevMode ? [{ debugName: "attachments" }] : /* istanbul ignore next */ []));
78
+ /** Mostra o botão de anexar. */
79
+ attachable = input(true, { ...(ngDevMode ? { debugName: "attachable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
80
+ /** Tipos aceitos no seletor de arquivo (`accept` do input). */
81
+ accept = input('', ...(ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ []));
82
+ multipleFiles = input(true, { ...(ngDevMode ? { debugName: "multipleFiles" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
83
+ /** Modelos que a pessoa pode escolher; vazio esconde a escolha. */
84
+ models = input([], ...(ngDevMode ? [{ debugName: "models" }] : /* istanbul ignore next */ []));
85
+ model = model('', ...(ngDevMode ? [{ debugName: "model" }] : /* istanbul ignore next */ []));
86
+ /** Níveis de esforço (raciocínio) que o modelo aceita; vazio esconde a escolha. */
87
+ efforts = input([], ...(ngDevMode ? [{ debugName: "efforts" }] : /* istanbul ignore next */ []));
88
+ effort = model('', ...(ngDevMode ? [{ debugName: "effort" }] : /* istanbul ignore next */ []));
89
+ /** Teto da altura, em linhas. */
90
+ maxRows = input(8, ...(ngDevMode ? [{ debugName: "maxRows" }] : /* istanbul ignore next */ []));
91
+ texts = input({}, ...(ngDevMode ? [{ debugName: "texts" }] : /* istanbul ignore next */ []));
92
+ /** Pediu para enviar: o app manda e limpa o campo. */
93
+ submitted = output();
94
+ /** Pediu para parar a resposta em andamento. */
95
+ stopped = output();
96
+ /** Arquivos escolhidos para anexar. */
97
+ filesAdded = output();
98
+ /** Id do anexo que a pessoa tirou. */
99
+ attachmentRemoved = output();
100
+ #i18n = inject(HermesI18nService);
101
+ picker = viewChild('picker', ...(ngDevMode ? [{ debugName: "picker" }] : /* istanbul ignore next */ []));
102
+ text = computed(() => ({
103
+ ...this.#i18n.pick(PROMPT_INPUT_MESSAGES, PROMPT_INPUT_MESSAGES_PT_BR),
104
+ ...this.texts(),
105
+ }), ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
106
+ /** Texto ou anexo, e nenhum anexo ainda subindo ou com erro. */
107
+ canSend = computed(() => {
108
+ if (this.disabled() || this.streaming())
109
+ return false;
110
+ const files = this.attachments();
111
+ if (files.some((file) => file.status === 'uploading' || file.status === 'pending' || file.status === 'error'))
112
+ return false;
113
+ return this.value().trim() !== '' || files.length > 0;
114
+ }, ...(ngDevMode ? [{ debugName: "canSend" }] : /* istanbul ignore next */ []));
115
+ /** Envia, se der: o mesmo que o botão e o Enter. */
116
+ send() {
117
+ if (!this.canSend())
118
+ return;
119
+ this.submitted.emit({ text: this.value().trim(), attachments: this.attachments() });
120
+ }
121
+ /** Abre o seletor de arquivo. */
122
+ pick() {
123
+ this.picker()?.nativeElement.click();
124
+ }
125
+ onFiles(picker) {
126
+ const files = picker.files ? [...picker.files] : [];
127
+ // Limpa para a mesma escolha disparar de novo depois de removida.
128
+ picker.value = '';
129
+ if (files.length)
130
+ this.filesAdded.emit(files);
131
+ }
132
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: PromptInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
133
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: PromptInputComponent, isStandalone: true, selector: "hm-prompt-input", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, showLabel: { classPropertyName: "showLabel", publicName: "showLabel", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, streaming: { classPropertyName: "streaming", publicName: "streaming", isSignal: true, isRequired: false, transformFunction: null }, attachments: { classPropertyName: "attachments", publicName: "attachments", isSignal: true, isRequired: false, transformFunction: null }, attachable: { classPropertyName: "attachable", publicName: "attachable", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, multipleFiles: { classPropertyName: "multipleFiles", publicName: "multipleFiles", isSignal: true, isRequired: false, transformFunction: null }, models: { classPropertyName: "models", publicName: "models", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, efforts: { classPropertyName: "efforts", publicName: "efforts", isSignal: true, isRequired: false, transformFunction: null }, effort: { classPropertyName: "effort", publicName: "effort", isSignal: true, isRequired: false, transformFunction: null }, maxRows: { classPropertyName: "maxRows", publicName: "maxRows", isSignal: true, isRequired: false, transformFunction: null }, texts: { classPropertyName: "texts", publicName: "texts", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", model: "modelChange", effort: "effortChange", submitted: "submitted", stopped: "stopped", filesAdded: "filesAdded", attachmentRemoved: "attachmentRemoved" }, host: { properties: { "class.hm-prompt-input--streaming": "streaming()" }, classAttribute: "hm-prompt-input" }, viewQueries: [{ propertyName: "picker", first: true, predicate: ["picker"], descendants: true, isSignal: true }], ngImport: i0, template: `
134
+ <hm-textarea
135
+ [label]="label() || text().label"
136
+ [labelHidden]="!showLabel()"
137
+ [placeholder]="placeholder() || text().placeholder"
138
+ [hint]="hint()"
139
+ [(value)]="value"
140
+ [rows]="1"
141
+ [autoGrow]="true"
142
+ [maxRows]="maxRows()"
143
+ [disabled]="disabled()"
144
+ submitKey="enter"
145
+ (submitted)="send()"
146
+ >
147
+ @if (attachments().length) {
148
+ <hm-attachment-group hmTextareaActions [label]="text().attachments" layout="inline">
149
+ @for (file of attachments(); track file.id) {
150
+ <hm-attachment
151
+ [name]="file.name"
152
+ [size]="file.size ?? null"
153
+ [type]="file.type ?? ''"
154
+ [thumbnail]="file.thumbnail ?? ''"
155
+ [status]="file.status ?? 'idle'"
156
+ [progress]="file.progress ?? 0"
157
+ [error]="file.error ?? ''"
158
+ [removable]="!disabled()"
159
+ (removed)="attachmentRemoved.emit(file.id)"
160
+ />
161
+ }
162
+ </hm-attachment-group>
163
+ }
164
+ @if (attachable()) {
165
+ <hm-icon-button hmTextareaActions icon="paperclip" emphasis="subtle" size="small" [label]="text().attach" [disabled]="disabled()" (clicked)="pick()" />
166
+ }
167
+ @if (models().length) {
168
+ <hm-model-selector hmTextareaActions class="hm-prompt-input__menu" [models]="models()" [(value)]="model" [label]="text().model" labelHidden />
169
+ }
170
+ @if (efforts().length) {
171
+ <hm-model-selector hmTextareaActions class="hm-prompt-input__menu" [models]="efforts()" [(value)]="effort" [label]="text().effort" labelHidden />
172
+ }
173
+ @if (streaming()) {
174
+ <hm-icon-button hmTextareaActionsEnd icon="stop" emphasis="filled" size="small" [label]="text().stop" (clicked)="stopped.emit()" />
175
+ } @else {
176
+ <hm-icon-button hmTextareaActionsEnd icon="send-arrow" emphasis="filled" size="small" [label]="text().send" [disabled]="!canSend()" (clicked)="send()" />
177
+ }
178
+ </hm-textarea>
179
+ @if (attachable()) {
180
+ <input #picker type="file" class="hm-prompt-input__picker" hidden [attr.accept]="accept() || null" [multiple]="multipleFiles()" (change)="onFiles(picker)" />
181
+ }
182
+ `, isInline: true, dependencies: [{ kind: "component", type: AttachmentComponent, selector: "hm-attachment", inputs: ["name", "size", "type", "description", "thumbnail", "icon", "href", "download", "status", "progress", "error", "removable", "retryable", "disabled", "scale"], outputs: ["removed", "retried"] }, { kind: "component", type: AttachmentGroupComponent, selector: "hm-attachment-group", inputs: ["label", "layout"] }, { kind: "component", type: IconButtonComponent, selector: "hm-icon-button", inputs: ["label", "icon", "solid", "iconDirection", "emphasis", "intent", "size", "disabled", "toggle", "pressed", "keyShortcuts"], outputs: ["pressedChange", "clicked"] }, { kind: "component", type: ModelSelectorComponent, selector: "hm-model-selector", inputs: ["models", "value", "label", "labelHidden", "texts"], outputs: ["valueChange"] }, { kind: "directive", type: TextareaAddonDirective, selector: "[hmTextareaPrefix], [hmTextareaSuffix], [hmTextareaActions], [hmTextareaActionsEnd]" }, { kind: "component", type: TextareaComponent, selector: "hm-textarea", inputs: ["value", "label", "hint", "placeholder", "maxLength", "rows", "autoGrow", "labelHidden", "loading", "maxRows", "submitKey", "mentionCandidates", "mentionTrigger", "texts"], outputs: ["valueChange", "submitted", "mentioned"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
183
+ }
184
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: PromptInputComponent, decorators: [{
185
+ type: Component,
186
+ args: [{
187
+ selector: 'hm-prompt-input',
188
+ imports: [AttachmentComponent, AttachmentGroupComponent, IconButtonComponent, ModelSelectorComponent, TextareaAddonDirective, TextareaComponent],
189
+ changeDetection: ChangeDetectionStrategy.OnPush,
190
+ host: { class: 'hm-prompt-input', '[class.hm-prompt-input--streaming]': 'streaming()' },
191
+ template: `
192
+ <hm-textarea
193
+ [label]="label() || text().label"
194
+ [labelHidden]="!showLabel()"
195
+ [placeholder]="placeholder() || text().placeholder"
196
+ [hint]="hint()"
197
+ [(value)]="value"
198
+ [rows]="1"
199
+ [autoGrow]="true"
200
+ [maxRows]="maxRows()"
201
+ [disabled]="disabled()"
202
+ submitKey="enter"
203
+ (submitted)="send()"
204
+ >
205
+ @if (attachments().length) {
206
+ <hm-attachment-group hmTextareaActions [label]="text().attachments" layout="inline">
207
+ @for (file of attachments(); track file.id) {
208
+ <hm-attachment
209
+ [name]="file.name"
210
+ [size]="file.size ?? null"
211
+ [type]="file.type ?? ''"
212
+ [thumbnail]="file.thumbnail ?? ''"
213
+ [status]="file.status ?? 'idle'"
214
+ [progress]="file.progress ?? 0"
215
+ [error]="file.error ?? ''"
216
+ [removable]="!disabled()"
217
+ (removed)="attachmentRemoved.emit(file.id)"
218
+ />
219
+ }
220
+ </hm-attachment-group>
221
+ }
222
+ @if (attachable()) {
223
+ <hm-icon-button hmTextareaActions icon="paperclip" emphasis="subtle" size="small" [label]="text().attach" [disabled]="disabled()" (clicked)="pick()" />
224
+ }
225
+ @if (models().length) {
226
+ <hm-model-selector hmTextareaActions class="hm-prompt-input__menu" [models]="models()" [(value)]="model" [label]="text().model" labelHidden />
227
+ }
228
+ @if (efforts().length) {
229
+ <hm-model-selector hmTextareaActions class="hm-prompt-input__menu" [models]="efforts()" [(value)]="effort" [label]="text().effort" labelHidden />
230
+ }
231
+ @if (streaming()) {
232
+ <hm-icon-button hmTextareaActionsEnd icon="stop" emphasis="filled" size="small" [label]="text().stop" (clicked)="stopped.emit()" />
233
+ } @else {
234
+ <hm-icon-button hmTextareaActionsEnd icon="send-arrow" emphasis="filled" size="small" [label]="text().send" [disabled]="!canSend()" (clicked)="send()" />
235
+ }
236
+ </hm-textarea>
237
+ @if (attachable()) {
238
+ <input #picker type="file" class="hm-prompt-input__picker" hidden [attr.accept]="accept() || null" [multiple]="multipleFiles()" (change)="onFiles(picker)" />
239
+ }
240
+ `,
241
+ }]
242
+ }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], showLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLabel", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], streaming: [{ type: i0.Input, args: [{ isSignal: true, alias: "streaming", required: false }] }], attachments: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachments", required: false }] }], attachable: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachable", required: false }] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], multipleFiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "multipleFiles", required: false }] }], models: [{ type: i0.Input, args: [{ isSignal: true, alias: "models", required: false }] }], model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }, { type: i0.Output, args: ["modelChange"] }], efforts: [{ type: i0.Input, args: [{ isSignal: true, alias: "efforts", required: false }] }], effort: [{ type: i0.Input, args: [{ isSignal: true, alias: "effort", required: false }] }, { type: i0.Output, args: ["effortChange"] }], maxRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxRows", required: false }] }], texts: [{ type: i0.Input, args: [{ isSignal: true, alias: "texts", required: false }] }], submitted: [{ type: i0.Output, args: ["submitted"] }], stopped: [{ type: i0.Output, args: ["stopped"] }], filesAdded: [{ type: i0.Output, args: ["filesAdded"] }], attachmentRemoved: [{ type: i0.Output, args: ["attachmentRemoved"] }], picker: [{ type: i0.ViewChild, args: ['picker', { isSignal: true }] }] } });
243
+
244
+ // Ponto de import `@trismegisto/angular/prompt-input` (secundário do ng-packagr): o que o público usa sai daqui.
245
+
246
+ /**
247
+ * Generated bundle index. Do not edit.
248
+ */
249
+
250
+ export { PROMPT_INPUT_MESSAGES, PROMPT_INPUT_MESSAGES_EN, PROMPT_INPUT_MESSAGES_ES, PROMPT_INPUT_MESSAGES_PT_BR, PromptInputComponent };
251
+ //# sourceMappingURL=trismegisto-angular-prompt-input.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trismegisto-angular-prompt-input.mjs","sources":["../../src/prompt-input/icons.generated.ts","../../src/prompt-input/prompt-input-messages.ts","../../src/prompt-input/prompt-input.component.ts","../../src/prompt-input/index.ts","../../src/prompt-input/trismegisto-angular-prompt-input.ts"],"sourcesContent":["// GERADO por scripts/generate-internal-icons.mjs — não editar à mão.\n// Ícones que esta pasta usa por dentro; cada @Component/@Directive daqui os registra com\n// `readonly #icons = useHermesIcons(PROMPT_INPUT_ICONS);`.\nimport type { RegisteredIcon } from '@trismegisto/icons';\nimport {\n ICON_PAPERCLIP,\n ICON_SEND_ARROW,\n ICON_STOP,\n} from '@trismegisto/angular/icon';\n\nexport const PROMPT_INPUT_ICONS: readonly RegisteredIcon[] = [ICON_PAPERCLIP, ICON_SEND_ARROW, ICON_STOP];\n","// Textos do hm-prompt-input (pt-BR/en/es). Ficam na pasta, fora do HERMES_MESSAGES compartilhado, para não pesar no\n// bundle de quem não usa a peça. O componente escolhe pelo idioma ativo do `HermesI18nService` (`pick`) e aceita\n// sobrescrita parcial pelo input `texts`.\n\nexport interface PromptInputMessages {\n label: string;\n placeholder: string;\n hint: string;\n attach: string;\n attachments: string;\n send: string;\n stop: string;\n model: string;\n effort: string;\n}\n\nexport const PROMPT_INPUT_MESSAGES_PT_BR: PromptInputMessages = {\n label: 'Mensagem para o agente',\n placeholder: 'Pergunte algo ou descreva a tarefa',\n hint: 'Enter envia; Shift+Enter quebra a linha.',\n attach: 'Anexar arquivo',\n attachments: 'Anexos da mensagem',\n send: 'Enviar',\n stop: 'Parar a resposta',\n model: 'Modelo',\n effort: 'Esforço',\n};\n\nexport const PROMPT_INPUT_MESSAGES_EN: PromptInputMessages = {\n label: 'Message to the agent',\n placeholder: 'Ask something or describe the task',\n hint: 'Enter sends; Shift+Enter adds a line.',\n attach: 'Attach file',\n attachments: 'Message attachments',\n send: 'Send',\n stop: 'Stop the reply',\n model: 'Model',\n effort: 'Effort',\n};\n\nexport const PROMPT_INPUT_MESSAGES_ES: PromptInputMessages = {\n label: 'Mensaje para el agente',\n placeholder: 'Pregunte algo o describa la tarea',\n hint: 'Enter envía; Shift+Enter agrega una línea.',\n attach: 'Adjuntar archivo',\n attachments: 'Adjuntos del mensaje',\n send: 'Enviar',\n stop: 'Detener la respuesta',\n model: 'Modelo',\n effort: 'Esfuerzo',\n};\n\n/** Catálogos por idioma, para `HermesI18nService.pick`. */\nexport const PROMPT_INPUT_MESSAGES: Readonly<Record<string, PromptInputMessages>> = {\n 'pt-BR': PROMPT_INPUT_MESSAGES_PT_BR,\n en: PROMPT_INPUT_MESSAGES_EN,\n es: PROMPT_INPUT_MESSAGES_ES,\n};\n","import { ChangeDetectionStrategy, Component, ElementRef, booleanAttribute, computed, inject, input, model, output, viewChild } from '@angular/core';\nimport { ModelSelectorComponent, type AgentModel } from '@trismegisto/angular/agent';\nimport { AttachmentComponent, AttachmentGroupComponent, type AttachmentStatus } from '@trismegisto/angular/attachment';\nimport { HermesI18nService } from '@trismegisto/angular/i18n';\nimport { useHermesIcons } from '@trismegisto/angular/icon';\nimport { IconButtonComponent } from '@trismegisto/angular/icon-button';\nimport { TextareaAddonDirective, TextareaComponent } from '@trismegisto/angular/textarea';\nimport { PROMPT_INPUT_ICONS } from './icons.generated';\nimport { PROMPT_INPUT_MESSAGES, PROMPT_INPUT_MESSAGES_PT_BR, type PromptInputMessages } from './prompt-input-messages';\n\n/** Um arquivo que vai com a mensagem. Quem envia e acompanha o envio é o app. */\nexport interface PromptInputAttachment {\n readonly id: string;\n readonly name: string;\n /** Bytes. */\n readonly size?: number;\n readonly type?: string;\n readonly thumbnail?: string;\n readonly status?: AttachmentStatus;\n /** 0 a 100, durante `uploading`. */\n readonly progress?: number;\n readonly error?: string;\n}\n\n/** O que a pessoa mandou: o texto e os anexos à vista naquele momento. */\nexport interface PromptInputSubmit {\n readonly text: string;\n readonly attachments: readonly PromptInputAttachment[];\n}\n\n/**\n * O campo em que a pessoa escreve para o agente: texto que cresce, anexos, escolha de modelo e de esforço, e enviar\n * (ou parar, enquanto o agente responde). Enter envia; Shift+Enter quebra a linha. Só apresenta e devolve a intenção:\n * ler os arquivos, enviar e limpar o campo é do app.\n *\n * ```html\n * <hm-prompt-input [(value)]=\"texto\" [attachments]=\"anexos\" [models]=\"modelos\" [(model)]=\"modelo\"\n * [streaming]=\"respondendo()\" (submitted)=\"enviar($event)\" (stopped)=\"parar()\" (filesAdded)=\"anexar($event)\" />\n * ```\n */\n@Component({\n selector: 'hm-prompt-input',\n imports: [AttachmentComponent, AttachmentGroupComponent, IconButtonComponent, ModelSelectorComponent, TextareaAddonDirective, TextareaComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'hm-prompt-input', '[class.hm-prompt-input--streaming]': 'streaming()' },\n template: `\n <hm-textarea\n [label]=\"label() || text().label\"\n [labelHidden]=\"!showLabel()\"\n [placeholder]=\"placeholder() || text().placeholder\"\n [hint]=\"hint()\"\n [(value)]=\"value\"\n [rows]=\"1\"\n [autoGrow]=\"true\"\n [maxRows]=\"maxRows()\"\n [disabled]=\"disabled()\"\n submitKey=\"enter\"\n (submitted)=\"send()\"\n >\n @if (attachments().length) {\n <hm-attachment-group hmTextareaActions [label]=\"text().attachments\" layout=\"inline\">\n @for (file of attachments(); track file.id) {\n <hm-attachment\n [name]=\"file.name\"\n [size]=\"file.size ?? null\"\n [type]=\"file.type ?? ''\"\n [thumbnail]=\"file.thumbnail ?? ''\"\n [status]=\"file.status ?? 'idle'\"\n [progress]=\"file.progress ?? 0\"\n [error]=\"file.error ?? ''\"\n [removable]=\"!disabled()\"\n (removed)=\"attachmentRemoved.emit(file.id)\"\n />\n }\n </hm-attachment-group>\n }\n @if (attachable()) {\n <hm-icon-button hmTextareaActions icon=\"paperclip\" emphasis=\"subtle\" size=\"small\" [label]=\"text().attach\" [disabled]=\"disabled()\" (clicked)=\"pick()\" />\n }\n @if (models().length) {\n <hm-model-selector hmTextareaActions class=\"hm-prompt-input__menu\" [models]=\"models()\" [(value)]=\"model\" [label]=\"text().model\" labelHidden />\n }\n @if (efforts().length) {\n <hm-model-selector hmTextareaActions class=\"hm-prompt-input__menu\" [models]=\"efforts()\" [(value)]=\"effort\" [label]=\"text().effort\" labelHidden />\n }\n @if (streaming()) {\n <hm-icon-button hmTextareaActionsEnd icon=\"stop\" emphasis=\"filled\" size=\"small\" [label]=\"text().stop\" (clicked)=\"stopped.emit()\" />\n } @else {\n <hm-icon-button hmTextareaActionsEnd icon=\"send-arrow\" emphasis=\"filled\" size=\"small\" [label]=\"text().send\" [disabled]=\"!canSend()\" (clicked)=\"send()\" />\n }\n </hm-textarea>\n @if (attachable()) {\n <input #picker type=\"file\" class=\"hm-prompt-input__picker\" hidden [attr.accept]=\"accept() || null\" [multiple]=\"multipleFiles()\" (change)=\"onFiles(picker)\" />\n }\n `,\n})\nexport class PromptInputComponent {\n readonly #icons = useHermesIcons(PROMPT_INPUT_ICONS);\n readonly value = model('');\n /** Nome do campo. Padrão: \"Mensagem para o agente\". */\n readonly label = input('');\n /** Mostra o rótulo acima do campo (por padrão ele vale só para leitor de tela). */\n readonly showLabel = input(false, { transform: booleanAttribute });\n readonly placeholder = input('');\n readonly hint = input('');\n readonly disabled = input(false, { transform: booleanAttribute });\n /** O agente está respondendo: no lugar de enviar, o botão para a resposta. */\n readonly streaming = input(false, { transform: booleanAttribute });\n readonly attachments = input<readonly PromptInputAttachment[]>([]);\n /** Mostra o botão de anexar. */\n readonly attachable = input(true, { transform: booleanAttribute });\n /** Tipos aceitos no seletor de arquivo (`accept` do input). */\n readonly accept = input('');\n readonly multipleFiles = input(true, { transform: booleanAttribute });\n /** Modelos que a pessoa pode escolher; vazio esconde a escolha. */\n readonly models = input<readonly AgentModel[]>([]);\n readonly model = model('');\n /** Níveis de esforço (raciocínio) que o modelo aceita; vazio esconde a escolha. */\n readonly efforts = input<readonly AgentModel[]>([]);\n readonly effort = model('');\n /** Teto da altura, em linhas. */\n readonly maxRows = input(8);\n readonly texts = input<Partial<PromptInputMessages>>({});\n\n /** Pediu para enviar: o app manda e limpa o campo. */\n readonly submitted = output<PromptInputSubmit>();\n /** Pediu para parar a resposta em andamento. */\n readonly stopped = output<void>();\n /** Arquivos escolhidos para anexar. */\n readonly filesAdded = output<readonly File[]>();\n /** Id do anexo que a pessoa tirou. */\n readonly attachmentRemoved = output<string>();\n\n readonly #i18n = inject(HermesI18nService);\n private readonly picker = viewChild<ElementRef<HTMLInputElement>>('picker');\n protected readonly text = computed<PromptInputMessages>(() => ({\n ...this.#i18n.pick(PROMPT_INPUT_MESSAGES, PROMPT_INPUT_MESSAGES_PT_BR),\n ...this.texts(),\n }));\n /** Texto ou anexo, e nenhum anexo ainda subindo ou com erro. */\n protected readonly canSend = computed(() => {\n if (this.disabled() || this.streaming()) return false;\n const files = this.attachments();\n if (files.some((file) => file.status === 'uploading' || file.status === 'pending' || file.status === 'error')) return false;\n return this.value().trim() !== '' || files.length > 0;\n });\n\n /** Envia, se der: o mesmo que o botão e o Enter. */\n send(): void {\n if (!this.canSend()) return;\n this.submitted.emit({ text: this.value().trim(), attachments: this.attachments() });\n }\n\n /** Abre o seletor de arquivo. */\n pick(): void {\n this.picker()?.nativeElement.click();\n }\n\n protected onFiles(picker: HTMLInputElement): void {\n const files = picker.files ? [...picker.files] : [];\n // Limpa para a mesma escolha disparar de novo depois de removida.\n picker.value = '';\n if (files.length) this.filesAdded.emit(files);\n }\n}\n","// Ponto de import `@trismegisto/angular/prompt-input` (secundário do ng-packagr): o que o público usa sai daqui.\nexport * from './prompt-input.component';\nexport * from './prompt-input-messages';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAUO,MAAM,kBAAkB,GAA8B,CAAC,cAAc,EAAE,eAAe,EAAE,SAAS,CAAC;;ACVzG;AACA;AACA;AAcO,MAAM,2BAA2B,GAAwB;AAC9D,IAAA,KAAK,EAAE,wBAAwB;AAC/B,IAAA,WAAW,EAAE,oCAAoC;AACjD,IAAA,IAAI,EAAE,0CAA0C;AAChD,IAAA,MAAM,EAAE,gBAAgB;AACxB,IAAA,WAAW,EAAE,oBAAoB;AACjC,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,IAAI,EAAE,kBAAkB;AACxB,IAAA,KAAK,EAAE,QAAQ;AACf,IAAA,MAAM,EAAE,SAAS;;AAGZ,MAAM,wBAAwB,GAAwB;AAC3D,IAAA,KAAK,EAAE,sBAAsB;AAC7B,IAAA,WAAW,EAAE,oCAAoC;AACjD,IAAA,IAAI,EAAE,uCAAuC;AAC7C,IAAA,MAAM,EAAE,aAAa;AACrB,IAAA,WAAW,EAAE,qBAAqB;AAClC,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,IAAI,EAAE,gBAAgB;AACtB,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,MAAM,EAAE,QAAQ;;AAGX,MAAM,wBAAwB,GAAwB;AAC3D,IAAA,KAAK,EAAE,wBAAwB;AAC/B,IAAA,WAAW,EAAE,mCAAmC;AAChD,IAAA,IAAI,EAAE,4CAA4C;AAClD,IAAA,MAAM,EAAE,kBAAk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CAAA,EAAA,OAAA,EAAA,CAAA,aAAA,EAAA,WAAA,EAAA,WAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAsDpI,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAxDhC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,OAAO,EAAE,CAAC,mBAAmB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,iBAAiB,CAAC;oBAChJ,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,IAAI,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,oCAAoC,EAAE,aAAa,EAAE;AACvF,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDT,EAAA,CAAA;AACF,iBAAA;igEAuCmE,QAAQ,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;ACtI5E;;ACAA;;AAEG;;"}
@@ -29,12 +29,14 @@ class PromptSuggestionsComponent {
29
29
  label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
30
30
  /** Enquanto o assistente responde. */
31
31
  disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
32
+ /** `wrap` quebra em linhas; `scroll` fica numa linha só, que rola de lado (em cima do campo, onde a altura pesa). */
33
+ layout = input('wrap', ...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
32
34
  /** O texto da sugestão escolhida. */
33
35
  chosen = output();
34
36
  #i18n = inject(HermesI18nService);
35
37
  groupLabel = computed(() => this.label() || this.#i18n.pick(PROMPT_SUGGESTIONS_MESSAGES, PROMPT_SUGGESTIONS_MESSAGES_PT_BR).label, ...(ngDevMode ? [{ debugName: "groupLabel" }] : /* istanbul ignore next */ []));
36
38
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: PromptSuggestionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
37
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: PromptSuggestionsComponent, isStandalone: true, selector: "hm-prompt-suggestions", inputs: { suggestions: { classPropertyName: "suggestions", publicName: "suggestions", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { chosen: "chosen" }, host: { attributes: { "role": "group" }, properties: { "attr.aria-label": "groupLabel()" }, classAttribute: "hm-prompt-suggestions" }, ngImport: i0, template: `
39
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: PromptSuggestionsComponent, isStandalone: true, selector: "hm-prompt-suggestions", inputs: { suggestions: { classPropertyName: "suggestions", publicName: "suggestions", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { chosen: "chosen" }, host: { attributes: { "role": "group" }, properties: { "class.hm-prompt-suggestions--scroll": "layout() === 'scroll'", "attr.aria-label": "groupLabel()" }, classAttribute: "hm-prompt-suggestions" }, ngImport: i0, template: `
38
40
  @for (suggestion of suggestions(); track suggestion) {
39
41
  <hm-button size="small" emphasis="medium" [disabled]="disabled()" (clicked)="chosen.emit(suggestion)">{{ suggestion }}</hm-button>
40
42
  }
@@ -46,14 +48,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
46
48
  selector: 'hm-prompt-suggestions',
47
49
  imports: [ButtonComponent],
48
50
  changeDetection: ChangeDetectionStrategy.OnPush,
49
- host: { class: 'hm-prompt-suggestions', role: 'group', '[attr.aria-label]': 'groupLabel()' },
51
+ host: {
52
+ class: 'hm-prompt-suggestions',
53
+ '[class.hm-prompt-suggestions--scroll]': "layout() === 'scroll'",
54
+ role: 'group',
55
+ '[attr.aria-label]': 'groupLabel()',
56
+ },
50
57
  template: `
51
58
  @for (suggestion of suggestions(); track suggestion) {
52
59
  <hm-button size="small" emphasis="medium" [disabled]="disabled()" (clicked)="chosen.emit(suggestion)">{{ suggestion }}</hm-button>
53
60
  }
54
61
  `,
55
62
  }]
56
- }], propDecorators: { suggestions: [{ type: i0.Input, args: [{ isSignal: true, alias: "suggestions", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], chosen: [{ type: i0.Output, args: ["chosen"] }] } });
63
+ }], propDecorators: { suggestions: [{ type: i0.Input, args: [{ isSignal: true, alias: "suggestions", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }], chosen: [{ type: i0.Output, args: ["chosen"] }] } });
57
64
 
58
65
  // Ponto de import `@trismegisto/angular/prompt-suggestions` (secundário do ng-packagr): o que o public-api e as outras
59
66
  // pastas usam daqui. Ao criar arquivo público novo na pasta, acrescente a linha.
@@ -1 +1 @@
1
- {"version":3,"file":"trismegisto-angular-prompt-suggestions.mjs","sources":["../../src/prompt-suggestions/prompt-suggestions-messages.ts","../../src/prompt-suggestions/prompt-suggestions.component.ts","../../src/prompt-suggestions/index.ts","../../src/prompt-suggestions/trismegisto-angular-prompt-suggestions.ts"],"sourcesContent":["// Textos do hm-prompt-suggestions (pt-BR/en/es). Ficam na pasta do componente, fora do HERMES_MESSAGES compartilhado, para\n// não pesar no bundle de quem não usa a peça. O componente escolhe pelo idioma ativo do `HermesI18nService` (`pick`).\n\nexport interface PromptSuggestionsMessages {\n label: string;\n}\n\nexport const PROMPT_SUGGESTIONS_MESSAGES_PT_BR: PromptSuggestionsMessages = { label: 'Sugestões de pergunta' };\nexport const PROMPT_SUGGESTIONS_MESSAGES_EN: PromptSuggestionsMessages = { label: 'Suggested questions' };\nexport const PROMPT_SUGGESTIONS_MESSAGES_ES: PromptSuggestionsMessages = { label: 'Sugerencias de pregunta' };\n\n/** Catálogos por idioma, para `HermesI18nService.pick`. */\nexport const PROMPT_SUGGESTIONS_MESSAGES: Readonly<Record<string, PromptSuggestionsMessages>> = {\n 'pt-BR': PROMPT_SUGGESTIONS_MESSAGES_PT_BR,\n en: PROMPT_SUGGESTIONS_MESSAGES_EN,\n es: PROMPT_SUGGESTIONS_MESSAGES_ES,\n};\n","import { ChangeDetectionStrategy, Component, booleanAttribute, computed, inject, input, output } from '@angular/core';\nimport { ButtonComponent } from '@trismegisto/angular/button';\nimport { HermesI18nService } from '@trismegisto/angular/i18n';\nimport { PROMPT_SUGGESTIONS_MESSAGES, PROMPT_SUGGESTIONS_MESSAGES_PT_BR } from './prompt-suggestions-messages';\n\n/**\n * Perguntas prontas para um assistente: escolher uma envia o texto dela, sem digitar. Mostra a pessoa o que dá para\n * perguntar. Quem envia é o app, ao receber `chosen`.\n *\n * ```html\n * <hm-prompt-suggestions [suggestions]=\"['Qual o resumo de hoje?']\" (chosen)=\"enviar($event)\" />\n * ```\n */\n@Component({\n selector: 'hm-prompt-suggestions',\n imports: [ButtonComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'hm-prompt-suggestions', role: 'group', '[attr.aria-label]': 'groupLabel()' },\n template: `\n @for (suggestion of suggestions(); track suggestion) {\n <hm-button size=\"small\" emphasis=\"medium\" [disabled]=\"disabled()\" (clicked)=\"chosen.emit(suggestion)\">{{ suggestion }}</hm-button>\n }\n `,\n})\nexport class PromptSuggestionsComponent {\n readonly suggestions = input<readonly string[]>([]);\n /** Nome acessível do grupo. Padrão: \"Sugestões de pergunta\". */\n readonly label = input('');\n /** Enquanto o assistente responde. */\n readonly disabled = input(false, { transform: booleanAttribute });\n /** O texto da sugestão escolhida. */\n readonly chosen = output<string>();\n\n readonly #i18n = inject(HermesI18nService);\n protected readonly groupLabel = computed(\n () => this.label() || this.#i18n.pick(PROMPT_SUGGESTIONS_MESSAGES, PROMPT_SUGGESTIONS_MESSAGES_PT_BR).label,\n );\n}\n","// Ponto de import `@trismegisto/angular/prompt-suggestions` (secundário do ng-packagr): o que o public-api e as outras\n// pastas usam daqui. Ao criar arquivo público novo na pasta, acrescente a linha.\nexport * from './prompt-suggestions.component';\nexport * from './prompt-suggestions-messages';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;AACA;MAMa,iCAAiC,GAA8B,EAAE,KAAK,EAAE,uBAAuB;MAC/F,8BAA8B,GAA8B,EAAE,KAAK,EAAE,qBAAqB;MAC1F,8BAA8B,GAA8B,EAAE,KAAK,EAAE,yBAAyB;AAE3G;AACO,MAAM,2BAA2B,GAAwD;AAC9F,IAAA,OAAO,EAAE,iCAAiC;AAC1C,IAAA,EAAE,EAAE,8BAA8B;AAClC,IAAA,EAAE,EAAE,8BAA8B;;;ACVpC;;;;;;;AAOG;MAYU,0BAA0B,CAAA;AAC5B,IAAA,WAAW,GAAG,KAAK,CAAoB,EAAE,kFAAC;;AAE1C,IAAA,KAAK,GAAG,KAAK,CAAC,EAAE,4EAAC;;IAEjB,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAExD,MAAM,GAAG,MAAM,EAAU;AAEzB,IAAA,KAAK,GAAG,MAAM,CAAC,iBAAiB,CAAC;IACvB,UAAU,GAAG,QAAQ,CAC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IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAPS,eAAe,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,UAAA,EAAA,QAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,eAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,cAAA,EAAA,OAAA,EAAA,MAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,SAAA,CAAA,EAAA,OAAA,EAAA,CAAA,oBAAA,EAAA,eAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FASd,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAXtC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,uBAAuB;oBACjC,OAAO,EAAE,CAAC,eAAe,CAAC;oBAC1B,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,IAAI,EAAE,EAAE,KAAK,EAAE,uBAAuB,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE;AAC5F,oBAAA,QAAQ,EAAE;;;;AAIT,EAAA,CAAA;AACF,iBAAA;;;ACvBD;AACA;;ACDA;;AAEG;;"}
1
+ {"version":3,"file":"trismegisto-angular-prompt-suggestions.mjs","sources":["../../src/prompt-suggestions/prompt-suggestions-messages.ts","../../src/prompt-suggestions/prompt-suggestions.component.ts","../../src/prompt-suggestions/index.ts","../../src/prompt-suggestions/trismegisto-angular-prompt-suggestions.ts"],"sourcesContent":["// Textos do hm-prompt-suggestions (pt-BR/en/es). Ficam na pasta do componente, fora do HERMES_MESSAGES compartilhado, para\n// não pesar no bundle de quem não usa a peça. O componente escolhe pelo idioma ativo do `HermesI18nService` (`pick`).\n\nexport interface PromptSuggestionsMessages {\n label: string;\n}\n\nexport const PROMPT_SUGGESTIONS_MESSAGES_PT_BR: PromptSuggestionsMessages = { label: 'Sugestões de pergunta' };\nexport const PROMPT_SUGGESTIONS_MESSAGES_EN: PromptSuggestionsMessages = { label: 'Suggested questions' };\nexport const PROMPT_SUGGESTIONS_MESSAGES_ES: PromptSuggestionsMessages = { label: 'Sugerencias de pregunta' };\n\n/** Catálogos por idioma, para `HermesI18nService.pick`. */\nexport const PROMPT_SUGGESTIONS_MESSAGES: Readonly<Record<string, PromptSuggestionsMessages>> = {\n 'pt-BR': PROMPT_SUGGESTIONS_MESSAGES_PT_BR,\n en: PROMPT_SUGGESTIONS_MESSAGES_EN,\n es: PROMPT_SUGGESTIONS_MESSAGES_ES,\n};\n","import { ChangeDetectionStrategy, Component, booleanAttribute, computed, inject, input, output } from '@angular/core';\nimport { ButtonComponent } from '@trismegisto/angular/button';\nimport { HermesI18nService } from '@trismegisto/angular/i18n';\nimport { PROMPT_SUGGESTIONS_MESSAGES, PROMPT_SUGGESTIONS_MESSAGES_PT_BR } from './prompt-suggestions-messages';\n\n/**\n * Perguntas prontas para um assistente: escolher uma envia o texto dela, sem digitar. Mostra a pessoa o que dá para\n * perguntar. Quem envia é o app, ao receber `chosen`.\n *\n * ```html\n * <hm-prompt-suggestions [suggestions]=\"['Qual o resumo de hoje?']\" (chosen)=\"enviar($event)\" />\n * ```\n */\n@Component({\n selector: 'hm-prompt-suggestions',\n imports: [ButtonComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'hm-prompt-suggestions',\n '[class.hm-prompt-suggestions--scroll]': \"layout() === 'scroll'\",\n role: 'group',\n '[attr.aria-label]': 'groupLabel()',\n },\n template: `\n @for (suggestion of suggestions(); track suggestion) {\n <hm-button size=\"small\" emphasis=\"medium\" [disabled]=\"disabled()\" (clicked)=\"chosen.emit(suggestion)\">{{ suggestion }}</hm-button>\n }\n `,\n})\nexport class PromptSuggestionsComponent {\n readonly suggestions = input<readonly string[]>([]);\n /** Nome acessível do grupo. Padrão: \"Sugestões de pergunta\". */\n readonly label = input('');\n /** Enquanto o assistente responde. */\n readonly disabled = input(false, { transform: booleanAttribute });\n /** `wrap` quebra em linhas; `scroll` fica numa linha só, que rola de lado (em cima do campo, onde a altura pesa). */\n readonly layout = input<'wrap' | 'scroll'>('wrap');\n /** O texto da sugestão escolhida. */\n readonly chosen = output<string>();\n\n readonly #i18n = inject(HermesI18nService);\n protected readonly groupLabel = computed(\n () => this.label() || this.#i18n.pick(PROMPT_SUGGESTIONS_MESSAGES, PROMPT_SUGGESTIONS_MESSAGES_PT_BR).label,\n );\n}\n","// Ponto de import `@trismegisto/angular/prompt-suggestions` (secundário do ng-packagr): o que o public-api e as outras\n// pastas usam daqui. Ao criar arquivo público novo na pasta, acrescente a linha.\nexport * from './prompt-suggestions.component';\nexport * from './prompt-suggestions-messages';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;AACA;MAMa,iCAAiC,GAA8B,EAAE,KAAK,EAAE,uBAAuB;MAC/F,8BAA8B,GAA8B,EAAE,KAAK,EAAE,qBAAqB;MAC1F,8BAA8B,GAA8B,EAAE,KAAK,EAAE,yBAAyB;AAE3G;AACO,MAAM,2BAA2B,GAAwD;AAC9F,IAAA,OAAO,EAAE,iCAAiC;AAC1C,IAAA,EAAE,EAAE,8BAA8B;AAClC,IAAA,EAAE,EAAE,8BAA8B;;;ACVpC;;;;;;;AAOG;MAiBU,0BAA0B,CAAA;AAC5B,IAAA,WAAW,GAAG,KAAK,CAAoB,EAAE,kFAAC;;AAE1C,IAAA,KAAK,GAAG,KAAK,CAAC,EAAE,4EAAC;;IAEjB,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;AAExD,IAAA,MAAM,GAAG,KAAK,CAAoB,MAAM,6EAAC;;IAEzC,MAAM,GAAG,MAAM,EAAU;AAEzB,IAAA,KAAK,GAAG,MAAM,CAAC,iBAAi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