@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.
- package/fesm2022/trismegisto-angular-agent.mjs +458 -73
- package/fesm2022/trismegisto-angular-agent.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-api-exchange.mjs +1 -1
- package/fesm2022/trismegisto-angular-api-exchange.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-attachment.mjs +6 -2
- package/fesm2022/trismegisto-angular-attachment.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-bubble.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-code-viewer.mjs +78 -5
- package/fesm2022/trismegisto-angular-code-viewer.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-data-grid.mjs +51 -7
- package/fesm2022/trismegisto-angular-data-grid.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-icon.mjs +2 -1
- package/fesm2022/trismegisto-angular-icon.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-message-divider.mjs +14 -6
- package/fesm2022/trismegisto-angular-message-divider.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-message-scroller.mjs +14 -0
- package/fesm2022/trismegisto-angular-message-scroller.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-prompt-input.mjs +251 -0
- package/fesm2022/trismegisto-angular-prompt-input.mjs.map +1 -0
- package/fesm2022/trismegisto-angular-prompt-suggestions.mjs +10 -3
- package/fesm2022/trismegisto-angular-prompt-suggestions.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-questionnaire.mjs +420 -0
- package/fesm2022/trismegisto-angular-questionnaire.mjs.map +1 -0
- package/fesm2022/trismegisto-angular-trace.mjs +38 -9
- package/fesm2022/trismegisto-angular-trace.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-webhook.mjs +1 -1
- package/fesm2022/trismegisto-angular-webhook.mjs.map +1 -1
- package/fesm2022/trismegisto-angular.mjs +4 -2
- package/fesm2022/trismegisto-angular.mjs.map +1 -1
- package/package.json +13 -5
- package/types/trismegisto-angular-agent.d.ts +103 -4
- package/types/trismegisto-angular-agent.d.ts.map +1 -1
- package/types/trismegisto-angular-attachment.d.ts +5 -2
- package/types/trismegisto-angular-attachment.d.ts.map +1 -1
- package/types/trismegisto-angular-bubble.d.ts +1 -1
- package/types/trismegisto-angular-code-viewer.d.ts +40 -3
- package/types/trismegisto-angular-code-viewer.d.ts.map +1 -1
- package/types/trismegisto-angular-data-grid.d.ts +27 -2
- package/types/trismegisto-angular-data-grid.d.ts.map +1 -1
- package/types/trismegisto-angular-icon.d.ts +2 -1
- package/types/trismegisto-angular-icon.d.ts.map +1 -1
- package/types/trismegisto-angular-message-divider.d.ts +4 -2
- package/types/trismegisto-angular-message-divider.d.ts.map +1 -1
- package/types/trismegisto-angular-message-scroller.d.ts +5 -0
- package/types/trismegisto-angular-message-scroller.d.ts.map +1 -1
- package/types/trismegisto-angular-prompt-input.d.ts +100 -0
- package/types/trismegisto-angular-prompt-input.d.ts.map +1 -0
- package/types/trismegisto-angular-prompt-suggestions.d.ts +3 -1
- package/types/trismegisto-angular-prompt-suggestions.d.ts.map +1 -1
- package/types/trismegisto-angular-questionnaire.d.ts +97 -0
- package/types/trismegisto-angular-questionnaire.d.ts.map +1 -0
- package/types/trismegisto-angular-trace.d.ts +11 -4
- package/types/trismegisto-angular-trace.d.ts.map +1 -1
- package/types/trismegisto-angular.d.ts +5 -3
- package/types/trismegisto-angular.d.ts.map +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isPlatformBrowser } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, input, inject, ElementRef, Renderer2, effect, Directive, signal, Injectable, makeEnvironmentProviders, provideEnvironmentInitializer, booleanAttribute, numberAttribute, output, DOCUMENT, PLATFORM_ID, DestroyRef, viewChild,
|
|
3
|
+
import { InjectionToken, input, inject, ElementRef, Renderer2, effect, Directive, signal, Injectable, makeEnvironmentProviders, provideEnvironmentInitializer, booleanAttribute, numberAttribute, output, computed, DOCUMENT, PLATFORM_ID, DestroyRef, viewChild, untracked, afterNextRender, afterRenderEffect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
4
|
import { CodeDocumentTokens } from '@trismegisto/primitives/code-document';
|
|
5
5
|
import { isCodeTokenKind, CodeLanguageRegistry, codeDevWarn, CODE_LANGUAGE_TEXT, splitCodeLines } from '@trismegisto/primitives/code-syntax';
|
|
6
6
|
import { codeTextPieces, parseLineSelection, formatLineRanges, codeVirtualLayout, CODE_VIRTUAL_OVERSCAN, lineRangesInclude, codeSelectionText } from '@trismegisto/primitives/code-view';
|
|
@@ -325,6 +325,34 @@ function isPrimaryShortcut(event, key) {
|
|
|
325
325
|
return (event.ctrlKey || event.metaKey) && !event.altKey && event.key.toLowerCase() === key;
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
+
// Textos dos recursos do hm-code-viewer que entraram depois do catálogo compartilhado (linhas de diff, mostrar mais).
|
|
329
|
+
// Ficam na pasta, fora do HERMES_MESSAGES, para não pesar em quem não usa; o componente escolhe pelo idioma ativo
|
|
330
|
+
// do `HermesI18nService` (`pick`) e aceita sobrescrita parcial pelo input `texts`.
|
|
331
|
+
const CODE_VIEWER_MESSAGES_PT_BR = {
|
|
332
|
+
added: 'adicionada',
|
|
333
|
+
removed: 'removida',
|
|
334
|
+
showMore: 'Mostrar tudo ({count} linhas)',
|
|
335
|
+
showLess: 'Mostrar menos',
|
|
336
|
+
};
|
|
337
|
+
const CODE_VIEWER_MESSAGES_EN = {
|
|
338
|
+
added: 'added',
|
|
339
|
+
removed: 'removed',
|
|
340
|
+
showMore: 'Show all ({count} lines)',
|
|
341
|
+
showLess: 'Show less',
|
|
342
|
+
};
|
|
343
|
+
const CODE_VIEWER_MESSAGES_ES = {
|
|
344
|
+
added: 'agregada',
|
|
345
|
+
removed: 'eliminada',
|
|
346
|
+
showMore: 'Mostrar todo ({count} líneas)',
|
|
347
|
+
showLess: 'Mostrar menos',
|
|
348
|
+
};
|
|
349
|
+
/** Catálogos por idioma, para `HermesI18nService.pick`. */
|
|
350
|
+
const CODE_VIEWER_MESSAGES = {
|
|
351
|
+
'pt-BR': CODE_VIEWER_MESSAGES_PT_BR,
|
|
352
|
+
en: CODE_VIEWER_MESSAGES_EN,
|
|
353
|
+
es: CODE_VIEWER_MESSAGES_ES,
|
|
354
|
+
};
|
|
355
|
+
|
|
328
356
|
/** Linhas por bloco com `content-visibility: auto` (fora da janela virtual). */
|
|
329
357
|
const BLOCK_SIZE = 100;
|
|
330
358
|
/** Altura de linha usada antes da primeira medida (jsdom, servidor). */
|
|
@@ -375,11 +403,27 @@ class CodeViewerComponent {
|
|
|
375
403
|
virtualizeThreshold = input(2000, { ...(ngDevMode ? { debugName: "virtualizeThreshold" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
376
404
|
/** Revela espaços de largura zero e controles C0/C1. Os controles bidi aparecem sempre. */
|
|
377
405
|
revealInvisibles = input(true, { ...(ngDevMode ? { debugName: "revealInvisibles" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
406
|
+
/** Linhas adicionadas (verde, com `+`), na numeração exibida: `"3, 5-8"` ou `[3, 5]`. */
|
|
407
|
+
addedLines = input('', ...(ngDevMode ? [{ debugName: "addedLines" }] : /* istanbul ignore next */ []));
|
|
408
|
+
/** Linhas removidas (vermelho, com `-`). */
|
|
409
|
+
removedLines = input('', ...(ngDevMode ? [{ debugName: "removedLines" }] : /* istanbul ignore next */ []));
|
|
410
|
+
size = input('medium', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
411
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
412
|
+
/** Teto da altura (qualquer medida CSS: `20rem`, `50vh`); a área rola por dentro. */
|
|
413
|
+
maxHeight = input('', ...(ngDevMode ? [{ debugName: "maxHeight" }] : /* istanbul ignore next */ []));
|
|
414
|
+
/** Mostra só estas linhas e um botão para abrir o resto. `null`: tudo. */
|
|
415
|
+
collapsedLines = input(null, ...(ngDevMode ? [{ debugName: "collapsedLines" }] : /* istanbul ignore next */ []));
|
|
416
|
+
/** Sobrescrita parcial dos textos de diff e de mostrar mais. */
|
|
417
|
+
texts = input({}, ...(ngDevMode ? [{ debugName: "texts" }] : /* istanbul ignore next */ []));
|
|
378
418
|
/** Copiou pelo botão (ou `copyAll()`): o texto exato. */
|
|
379
419
|
copied = output();
|
|
380
420
|
/** A tokenização do documento inteiro terminou. */
|
|
381
421
|
tokenized = output();
|
|
382
422
|
catalog = inject(HERMES_MESSAGES);
|
|
423
|
+
extraText = computed(() => ({
|
|
424
|
+
...this.#i18n.pick(CODE_VIEWER_MESSAGES, CODE_VIEWER_MESSAGES_PT_BR),
|
|
425
|
+
...this.texts(),
|
|
426
|
+
}), ...(ngDevMode ? [{ debugName: "extraText" }] : /* istanbul ignore next */ []));
|
|
383
427
|
#i18n = inject(HermesI18nService);
|
|
384
428
|
#languages = inject(CodeLanguagesService);
|
|
385
429
|
#registry = inject(CODE_LINE_REGISTRY);
|
|
@@ -448,6 +492,29 @@ class CodeViewerComponent {
|
|
|
448
492
|
}
|
|
449
493
|
return selection.ranges;
|
|
450
494
|
}, ...(ngDevMode ? [{ debugName: "#highlight" }] : /* istanbul ignore next */ []));
|
|
495
|
+
#changes = computed(() => {
|
|
496
|
+
const first = this.firstNumber();
|
|
497
|
+
const last = first + this.#lines().length - 1;
|
|
498
|
+
return { added: parseLineSelection(this.addedLines(), first, last).ranges, removed: parseLineSelection(this.removedLines(), first, last).ranges };
|
|
499
|
+
}, ...(ngDevMode ? [{ debugName: "#changes" }] : /* istanbul ignore next */ []));
|
|
500
|
+
// ---- mostrar mais ---------------------------------------------------------------------------
|
|
501
|
+
/** A pessoa abriu o resto. Volta a recolher quando o código ou o limite mudam. */
|
|
502
|
+
#expanded = signal(false, ...(ngDevMode ? [{ debugName: "#expanded" }] : /* istanbul ignore next */ []));
|
|
503
|
+
collapsible = computed(() => {
|
|
504
|
+
const limit = this.collapsedLines();
|
|
505
|
+
return limit !== null && limit > 0 && this.#lines().length > limit;
|
|
506
|
+
}, ...(ngDevMode ? [{ debugName: "collapsible" }] : /* istanbul ignore next */ []));
|
|
507
|
+
collapsed = computed(() => this.collapsible() && !this.#expanded(), ...(ngDevMode ? [{ debugName: "collapsed" }] : /* istanbul ignore next */ []));
|
|
508
|
+
collapsedHeight = computed(() => (this.collapsed() ? (this.collapsedLines() ?? 0) * this.#rowHeight() : null), ...(ngDevMode ? [{ debugName: "collapsedHeight" }] : /* istanbul ignore next */ []));
|
|
509
|
+
toggleLabel = computed(() => this.#expanded() ? this.extraText().showLess : this.#i18n.format(this.extraText().showMore, { count: this.#lines().length }), ...(ngDevMode ? [{ debugName: "toggleLabel" }] : /* istanbul ignore next */ []));
|
|
510
|
+
#resetExpanded = effect(() => {
|
|
511
|
+
this.text();
|
|
512
|
+
this.collapsedLines();
|
|
513
|
+
untracked(() => this.#expanded.set(false));
|
|
514
|
+
}, ...(ngDevMode ? [{ debugName: "#resetExpanded" }] : /* istanbul ignore next */ []));
|
|
515
|
+
toggleCollapsed() {
|
|
516
|
+
this.#expanded.update((open) => !open);
|
|
517
|
+
}
|
|
451
518
|
highlightDescription = computed(() => {
|
|
452
519
|
const ranges = this.#highlight();
|
|
453
520
|
if (!ranges.length)
|
|
@@ -511,6 +578,7 @@ class CodeViewerComponent {
|
|
|
511
578
|
const lines = this.#lines();
|
|
512
579
|
const first = this.firstNumber();
|
|
513
580
|
const ranges = this.#highlight();
|
|
581
|
+
const changes = this.#changes();
|
|
514
582
|
const layout = this.#layout();
|
|
515
583
|
const start = layout ? layout.window.start : 0;
|
|
516
584
|
const end = layout ? layout.window.end : lines.length;
|
|
@@ -522,6 +590,7 @@ class CodeViewerComponent {
|
|
|
522
590
|
text: lines[i],
|
|
523
591
|
tokens: this.#doc.tokens(i),
|
|
524
592
|
highlighted: ranges.length > 0 && lineRangesInclude(ranges, number),
|
|
593
|
+
change: lineRangesInclude(changes.added, number) ? 'added' : lineRangesInclude(changes.removed, number) ? 'removed' : null,
|
|
525
594
|
ref: { line: i, side: null, row: i },
|
|
526
595
|
};
|
|
527
596
|
};
|
|
@@ -827,7 +896,7 @@ class CodeViewerComponent {
|
|
|
827
896
|
this.#scrollTop.set(Math.max(0, target));
|
|
828
897
|
}
|
|
829
898
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: CodeViewerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
830
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: CodeViewerComponent, isStandalone: true, selector: "hm-code-viewer", inputs: { code: { classPropertyName: "code", publicName: "code", isSignal: true, isRequired: true, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, filename: { classPropertyName: "filename", publicName: "filename", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, showLineNumbers: { classPropertyName: "showLineNumbers", publicName: "showLineNumbers", isSignal: true, isRequired: false, transformFunction: null }, firstLineNumber: { classPropertyName: "firstLineNumber", publicName: "firstLineNumber", isSignal: true, isRequired: false, transformFunction: null }, highlightLines: { classPropertyName: "highlightLines", publicName: "highlightLines", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null }, tabSize: { classPropertyName: "tabSize", publicName: "tabSize", isSignal: true, isRequired: false, transformFunction: null }, copyable: { classPropertyName: "copyable", publicName: "copyable", isSignal: true, isRequired: false, transformFunction: null }, header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, virtualize: { classPropertyName: "virtualize", publicName: "virtualize", isSignal: true, isRequired: false, transformFunction: null }, virtualizeThreshold: { classPropertyName: "virtualizeThreshold", publicName: "virtualizeThreshold", isSignal: true, isRequired: false, transformFunction: null }, revealInvisibles: { classPropertyName: "revealInvisibles", publicName: "revealInvisibles", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { copied: "copied", tokenized: "tokenized" }, host: { attributes: { "ngSkipHydration": "true" }, properties: { "class.hm-code-viewer--wrap": "wrap()", "class.hm-code-viewer--windowed": "virtual()", "class.hm-code-viewer--floating-copy": "floatingCopy()" }, classAttribute: "hm-code-viewer" }, providers: [{ provide: CODE_LINE_REGISTRY, useFactory: () => new CodeLineRegistry() }], viewQueries: [{ propertyName: "body", first: true, predicate: ["body"], descendants: true, isSignal: true }, { propertyName: "codeElement", first: true, predicate: ["code"], descendants: true, isSignal: true }, { propertyName: "copyButton", first: true, predicate: CopyButtonComponent, descendants: true, isSignal: true }], ngImport: i0, template: "@if (headerVisible()) {\n <div class=\"hm-code-viewer__header\">\n @if (filename()) {\n <span class=\"hm-code-viewer__filename\">{{ filename() }}</span>\n }\n <span class=\"hm-code-viewer__language\">{{ languageLabel() }}</span>\n @if (copyable()) {\n <hm-copy-button class=\"hm-code-viewer__copy\" size=\"small\" [value]=\"text()\" [label]=\"catalog.codeViewer.copy\" (copied)=\"onCopied($event)\" />\n }\n </div>\n}\n<div\n #body\n class=\"hm-code-viewer__body\"\n role=\"region\"\n tabindex=\"0\"\n [attr.aria-label]=\"regionLabel()\"\n [attr.aria-describedby]=\"highlightDescription() ? describedById : null\"\n [style.--hm-code-tab]=\"tab()\"\n [style.--hm-code-columns]=\"columns()\"\n [style.--hm-code-gutter-digits]=\"gutterDigits()\"\n (keydown)=\"onKeydown($event)\"\n>\n <div class=\"hm-code-viewer__scroller\" dir=\"ltr\">\n <code #code class=\"hm-code-viewer__code\" [class.hm-code-viewer__code--numbered]=\"showLineNumbers()\">\n @if (virtual()) {\n <span class=\"hm-code-viewer__spacer\" aria-hidden=\"true\" [style.height.px]=\"spacerBefore()\"></span>\n }\n @for (block of blocks(); track block.start) {\n <span\n class=\"hm-code-viewer__block\"\n [class.hm-code-viewer__block--lazy]=\"!virtual()\"\n [style.contain-intrinsic-block-size]=\"virtual() ? null : 'auto ' + block.lines.length * rowHeight() + 'px'\"\n >\n @for (line of block.lines; track line.index) {\n <span
|
|
899
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: CodeViewerComponent, isStandalone: true, selector: "hm-code-viewer", inputs: { code: { classPropertyName: "code", publicName: "code", isSignal: true, isRequired: true, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, filename: { classPropertyName: "filename", publicName: "filename", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, showLineNumbers: { classPropertyName: "showLineNumbers", publicName: "showLineNumbers", isSignal: true, isRequired: false, transformFunction: null }, firstLineNumber: { classPropertyName: "firstLineNumber", publicName: "firstLineNumber", isSignal: true, isRequired: false, transformFunction: null }, highlightLines: { classPropertyName: "highlightLines", publicName: "highlightLines", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null }, tabSize: { classPropertyName: "tabSize", publicName: "tabSize", isSignal: true, isRequired: false, transformFunction: null }, copyable: { classPropertyName: "copyable", publicName: "copyable", isSignal: true, isRequired: false, transformFunction: null }, header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, virtualize: { classPropertyName: "virtualize", publicName: "virtualize", isSignal: true, isRequired: false, transformFunction: null }, virtualizeThreshold: { classPropertyName: "virtualizeThreshold", publicName: "virtualizeThreshold", isSignal: true, isRequired: false, transformFunction: null }, revealInvisibles: { classPropertyName: "revealInvisibles", publicName: "revealInvisibles", isSignal: true, isRequired: false, transformFunction: null }, addedLines: { classPropertyName: "addedLines", publicName: "addedLines", isSignal: true, isRequired: false, transformFunction: null }, removedLines: { classPropertyName: "removedLines", publicName: "removedLines", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, collapsedLines: { classPropertyName: "collapsedLines", publicName: "collapsedLines", isSignal: true, isRequired: false, transformFunction: null }, texts: { classPropertyName: "texts", publicName: "texts", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { copied: "copied", tokenized: "tokenized" }, host: { attributes: { "ngSkipHydration": "true" }, properties: { "class.hm-code-viewer--wrap": "wrap()", "class.hm-code-viewer--windowed": "virtual()", "class.hm-code-viewer--floating-copy": "floatingCopy()", "class.hm-code-viewer--small": "size() === 'small'", "class.hm-code-viewer--destructive": "variant() === 'destructive'", "class.hm-code-viewer--collapsed": "collapsed()", "style.--hm-code-viewer-max-height": "maxHeight() || null" }, classAttribute: "hm-code-viewer" }, providers: [{ provide: CODE_LINE_REGISTRY, useFactory: () => new CodeLineRegistry() }], viewQueries: [{ propertyName: "body", first: true, predicate: ["body"], descendants: true, isSignal: true }, { propertyName: "codeElement", first: true, predicate: ["code"], descendants: true, isSignal: true }, { propertyName: "copyButton", first: true, predicate: CopyButtonComponent, descendants: true, isSignal: true }], ngImport: i0, template: "@if (headerVisible()) {\n <div class=\"hm-code-viewer__header\">\n @if (filename()) {\n <span class=\"hm-code-viewer__filename\">{{ filename() }}</span>\n }\n <span class=\"hm-code-viewer__language\">{{ languageLabel() }}</span>\n <ng-content select=\"[hmCodeViewerActions]\" />\n @if (copyable()) {\n <hm-copy-button class=\"hm-code-viewer__copy\" size=\"small\" [value]=\"text()\" [label]=\"catalog.codeViewer.copy\" (copied)=\"onCopied($event)\" />\n }\n </div>\n}\n<div\n #body\n class=\"hm-code-viewer__body\"\n role=\"region\"\n tabindex=\"0\"\n [attr.aria-label]=\"regionLabel()\"\n [attr.aria-describedby]=\"highlightDescription() ? describedById : null\"\n [style.--hm-code-tab]=\"tab()\"\n [style.--hm-code-columns]=\"columns()\"\n [style.--hm-code-gutter-digits]=\"gutterDigits()\"\n [style.max-block-size.px]=\"collapsedHeight()\"\n (keydown)=\"onKeydown($event)\"\n>\n <div class=\"hm-code-viewer__scroller\" dir=\"ltr\">\n <code #code class=\"hm-code-viewer__code\" [class.hm-code-viewer__code--numbered]=\"showLineNumbers()\">\n @if (virtual()) {\n <span class=\"hm-code-viewer__spacer\" aria-hidden=\"true\" [style.height.px]=\"spacerBefore()\"></span>\n }\n @for (block of blocks(); track block.start) {\n <span\n class=\"hm-code-viewer__block\"\n [class.hm-code-viewer__block--lazy]=\"!virtual()\"\n [style.contain-intrinsic-block-size]=\"virtual() ? null : 'auto ' + block.lines.length * rowHeight() + 'px'\"\n >\n @for (line of block.lines; track line.index) {\n <span\n class=\"hm-code-viewer__line\"\n [class.hm-code-viewer__line--highlighted]=\"line.highlighted\"\n [class.hm-code-viewer__line--added]=\"line.change === 'added'\"\n [class.hm-code-viewer__line--removed]=\"line.change === 'removed'\"\n >\n @if (showLineNumbers()) {\n <span class=\"hm-code-viewer__number\" aria-hidden=\"true\">{{ line.number }}</span>\n }\n @if (line.change) {\n <span class=\"hm-code-viewer__change\" aria-hidden=\"true\">{{ line.change === 'added' ? '+' : '-' }}</span>\n <span class=\"hm-code-viewer__change-text\">{{ line.change === 'added' ? extraText().added : extraText().removed }}</span>\n }\n <span\n class=\"hm-code-viewer__text\"\n [hmCodeLine]=\"line.text\"\n [hmCodeLineTokens]=\"line.tokens\"\n [hmCodeLineReveal]=\"revealInvisibles()\"\n [hmCodeLineFirst]=\"line.index === 0\"\n [hmCodeLineInvisibleLabel]=\"catalog.codeViewer.invisibleChar\"\n [hmCodeLineRef]=\"line.ref\"\n ></span>\n </span>\n }\n </span>\n }\n @if (virtual()) {\n <span class=\"hm-code-viewer__spacer\" aria-hidden=\"true\" [style.height.px]=\"spacerAfter()\"></span>\n }\n </code>\n </div>\n</div>\n@if (floatingCopy()) {\n <hm-copy-button class=\"hm-code-viewer__copy hm-code-viewer__copy--floating\" size=\"small\" [value]=\"text()\" [label]=\"catalog.codeViewer.copy\" (copied)=\"onCopied($event)\" />\n}\n@if (collapsible()) {\n <button type=\"button\" class=\"hm-code-viewer__more\" [attr.aria-expanded]=\"!collapsed()\" (click)=\"toggleCollapsed()\">{{ toggleLabel() }}</button>\n}\n@if (highlightDescription()) {\n <span class=\"hm-code-viewer__description\" [id]=\"describedById\">{{ highlightDescription() }}</span>\n}\n", dependencies: [{ kind: "component", type: CopyButtonComponent, selector: "hm-copy-button", inputs: ["value", "label", "copiedLabel", "variant", "size", "disabled", "feedbackDuration"], outputs: ["copied", "copyFailed"] }, { kind: "directive", type: CodeLineDirective, selector: "[hmCodeLine]", inputs: ["hmCodeLine", "hmCodeLineTokens", "hmCodeLineReveal", "hmCodeLineFirst", "hmCodeLineRanges", "hmCodeLineRangeClass", "hmCodeLineInvisibleLabel", "hmCodeLineRef"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
831
900
|
}
|
|
832
901
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: CodeViewerComponent, decorators: [{
|
|
833
902
|
type: Component,
|
|
@@ -836,10 +905,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
836
905
|
'[class.hm-code-viewer--wrap]': 'wrap()',
|
|
837
906
|
'[class.hm-code-viewer--windowed]': 'virtual()',
|
|
838
907
|
'[class.hm-code-viewer--floating-copy]': 'floatingCopy()',
|
|
908
|
+
'[class.hm-code-viewer--small]': "size() === 'small'",
|
|
909
|
+
'[class.hm-code-viewer--destructive]': "variant() === 'destructive'",
|
|
910
|
+
'[class.hm-code-viewer--collapsed]': 'collapsed()',
|
|
911
|
+
'[style.--hm-code-viewer-max-height]': 'maxHeight() || null',
|
|
839
912
|
// O cliente desenha de novo (as linhas são montadas por código, não por template hidratável).
|
|
840
913
|
ngSkipHydration: 'true',
|
|
841
|
-
}, template: "@if (headerVisible()) {\n <div class=\"hm-code-viewer__header\">\n @if (filename()) {\n <span class=\"hm-code-viewer__filename\">{{ filename() }}</span>\n }\n <span class=\"hm-code-viewer__language\">{{ languageLabel() }}</span>\n @if (copyable()) {\n <hm-copy-button class=\"hm-code-viewer__copy\" size=\"small\" [value]=\"text()\" [label]=\"catalog.codeViewer.copy\" (copied)=\"onCopied($event)\" />\n }\n </div>\n}\n<div\n #body\n class=\"hm-code-viewer__body\"\n role=\"region\"\n tabindex=\"0\"\n [attr.aria-label]=\"regionLabel()\"\n [attr.aria-describedby]=\"highlightDescription() ? describedById : null\"\n [style.--hm-code-tab]=\"tab()\"\n [style.--hm-code-columns]=\"columns()\"\n [style.--hm-code-gutter-digits]=\"gutterDigits()\"\n (keydown)=\"onKeydown($event)\"\n>\n <div class=\"hm-code-viewer__scroller\" dir=\"ltr\">\n <code #code class=\"hm-code-viewer__code\" [class.hm-code-viewer__code--numbered]=\"showLineNumbers()\">\n @if (virtual()) {\n <span class=\"hm-code-viewer__spacer\" aria-hidden=\"true\" [style.height.px]=\"spacerBefore()\"></span>\n }\n @for (block of blocks(); track block.start) {\n <span\n class=\"hm-code-viewer__block\"\n [class.hm-code-viewer__block--lazy]=\"!virtual()\"\n [style.contain-intrinsic-block-size]=\"virtual() ? null : 'auto ' + block.lines.length * rowHeight() + 'px'\"\n >\n @for (line of block.lines; track line.index) {\n <span
|
|
842
|
-
}], ctorParameters: () => [], propDecorators: { code: [{ type: i0.Input, args: [{ isSignal: true, alias: "code", required: true }] }], language: [{ type: i0.Input, args: [{ isSignal: true, alias: "language", required: false }] }], filename: [{ type: i0.Input, args: [{ isSignal: true, alias: "filename", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], showLineNumbers: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLineNumbers", required: false }] }], firstLineNumber: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstLineNumber", required: false }] }], highlightLines: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightLines", required: false }] }], wrap: [{ type: i0.Input, args: [{ isSignal: true, alias: "wrap", required: false }] }], tabSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabSize", required: false }] }], copyable: [{ type: i0.Input, args: [{ isSignal: true, alias: "copyable", required: false }] }], header: [{ type: i0.Input, args: [{ isSignal: true, alias: "header", required: false }] }], virtualize: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualize", required: false }] }], virtualizeThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualizeThreshold", required: false }] }], revealInvisibles: [{ type: i0.Input, args: [{ isSignal: true, alias: "revealInvisibles", required: false }] }], copied: [{ type: i0.Output, args: ["copied"] }], tokenized: [{ type: i0.Output, args: ["tokenized"] }], body: [{ type: i0.ViewChild, args: ['body', { isSignal: true }] }], codeElement: [{ type: i0.ViewChild, args: ['code', { isSignal: true }] }], copyButton: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CopyButtonComponent), { isSignal: true }] }] } });
|
|
914
|
+
}, template: "@if (headerVisible()) {\n <div class=\"hm-code-viewer__header\">\n @if (filename()) {\n <span class=\"hm-code-viewer__filename\">{{ filename() }}</span>\n }\n <span class=\"hm-code-viewer__language\">{{ languageLabel() }}</span>\n <ng-content select=\"[hmCodeViewerActions]\" />\n @if (copyable()) {\n <hm-copy-button class=\"hm-code-viewer__copy\" size=\"small\" [value]=\"text()\" [label]=\"catalog.codeViewer.copy\" (copied)=\"onCopied($event)\" />\n }\n </div>\n}\n<div\n #body\n class=\"hm-code-viewer__body\"\n role=\"region\"\n tabindex=\"0\"\n [attr.aria-label]=\"regionLabel()\"\n [attr.aria-describedby]=\"highlightDescription() ? describedById : null\"\n [style.--hm-code-tab]=\"tab()\"\n [style.--hm-code-columns]=\"columns()\"\n [style.--hm-code-gutter-digits]=\"gutterDigits()\"\n [style.max-block-size.px]=\"collapsedHeight()\"\n (keydown)=\"onKeydown($event)\"\n>\n <div class=\"hm-code-viewer__scroller\" dir=\"ltr\">\n <code #code class=\"hm-code-viewer__code\" [class.hm-code-viewer__code--numbered]=\"showLineNumbers()\">\n @if (virtual()) {\n <span class=\"hm-code-viewer__spacer\" aria-hidden=\"true\" [style.height.px]=\"spacerBefore()\"></span>\n }\n @for (block of blocks(); track block.start) {\n <span\n class=\"hm-code-viewer__block\"\n [class.hm-code-viewer__block--lazy]=\"!virtual()\"\n [style.contain-intrinsic-block-size]=\"virtual() ? null : 'auto ' + block.lines.length * rowHeight() + 'px'\"\n >\n @for (line of block.lines; track line.index) {\n <span\n class=\"hm-code-viewer__line\"\n [class.hm-code-viewer__line--highlighted]=\"line.highlighted\"\n [class.hm-code-viewer__line--added]=\"line.change === 'added'\"\n [class.hm-code-viewer__line--removed]=\"line.change === 'removed'\"\n >\n @if (showLineNumbers()) {\n <span class=\"hm-code-viewer__number\" aria-hidden=\"true\">{{ line.number }}</span>\n }\n @if (line.change) {\n <span class=\"hm-code-viewer__change\" aria-hidden=\"true\">{{ line.change === 'added' ? '+' : '-' }}</span>\n <span class=\"hm-code-viewer__change-text\">{{ line.change === 'added' ? extraText().added : extraText().removed }}</span>\n }\n <span\n class=\"hm-code-viewer__text\"\n [hmCodeLine]=\"line.text\"\n [hmCodeLineTokens]=\"line.tokens\"\n [hmCodeLineReveal]=\"revealInvisibles()\"\n [hmCodeLineFirst]=\"line.index === 0\"\n [hmCodeLineInvisibleLabel]=\"catalog.codeViewer.invisibleChar\"\n [hmCodeLineRef]=\"line.ref\"\n ></span>\n </span>\n }\n </span>\n }\n @if (virtual()) {\n <span class=\"hm-code-viewer__spacer\" aria-hidden=\"true\" [style.height.px]=\"spacerAfter()\"></span>\n }\n </code>\n </div>\n</div>\n@if (floatingCopy()) {\n <hm-copy-button class=\"hm-code-viewer__copy hm-code-viewer__copy--floating\" size=\"small\" [value]=\"text()\" [label]=\"catalog.codeViewer.copy\" (copied)=\"onCopied($event)\" />\n}\n@if (collapsible()) {\n <button type=\"button\" class=\"hm-code-viewer__more\" [attr.aria-expanded]=\"!collapsed()\" (click)=\"toggleCollapsed()\">{{ toggleLabel() }}</button>\n}\n@if (highlightDescription()) {\n <span class=\"hm-code-viewer__description\" [id]=\"describedById\">{{ highlightDescription() }}</span>\n}\n" }]
|
|
915
|
+
}], ctorParameters: () => [], propDecorators: { code: [{ type: i0.Input, args: [{ isSignal: true, alias: "code", required: true }] }], language: [{ type: i0.Input, args: [{ isSignal: true, alias: "language", required: false }] }], filename: [{ type: i0.Input, args: [{ isSignal: true, alias: "filename", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], showLineNumbers: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLineNumbers", required: false }] }], firstLineNumber: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstLineNumber", required: false }] }], highlightLines: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightLines", required: false }] }], wrap: [{ type: i0.Input, args: [{ isSignal: true, alias: "wrap", required: false }] }], tabSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabSize", required: false }] }], copyable: [{ type: i0.Input, args: [{ isSignal: true, alias: "copyable", required: false }] }], header: [{ type: i0.Input, args: [{ isSignal: true, alias: "header", required: false }] }], virtualize: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualize", required: false }] }], virtualizeThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualizeThreshold", required: false }] }], revealInvisibles: [{ type: i0.Input, args: [{ isSignal: true, alias: "revealInvisibles", required: false }] }], addedLines: [{ type: i0.Input, args: [{ isSignal: true, alias: "addedLines", required: false }] }], removedLines: [{ type: i0.Input, args: [{ isSignal: true, alias: "removedLines", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], collapsedLines: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsedLines", required: false }] }], texts: [{ type: i0.Input, args: [{ isSignal: true, alias: "texts", required: false }] }], copied: [{ type: i0.Output, args: ["copied"] }], tokenized: [{ type: i0.Output, args: ["tokenized"] }], body: [{ type: i0.ViewChild, args: ['body', { isSignal: true }] }], codeElement: [{ type: i0.ViewChild, args: ['code', { isSignal: true }] }], copyButton: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CopyButtonComponent), { isSignal: true }] }] } });
|
|
843
916
|
|
|
844
917
|
// Ponto de import `@trismegisto/angular/code-viewer`: o visualizador e as peças que o `hm-code-diff` reaproveita.
|
|
845
918
|
|
|
@@ -847,5 +920,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
847
920
|
* Generated bundle index. Do not edit.
|
|
848
921
|
*/
|
|
849
922
|
|
|
850
|
-
export { CODE_INVISIBLE_CLASS, CODE_LINE_REGISTRY, CODE_SLICE_MS, CodeLanguagesService, CodeLineDirective, CodeLineRegistry, CodeViewerComponent, codeModelPoint, cssLengthToPx, isPrimaryShortcut, provideCodeLanguages, resolveCodeLanguageInput, scheduleCodeTask, selectionInside, writeCodeClipboard };
|
|
923
|
+
export { CODE_INVISIBLE_CLASS, CODE_LINE_REGISTRY, CODE_SLICE_MS, CODE_VIEWER_MESSAGES, CODE_VIEWER_MESSAGES_EN, CODE_VIEWER_MESSAGES_ES, CODE_VIEWER_MESSAGES_PT_BR, CodeLanguagesService, CodeLineDirective, CodeLineRegistry, CodeViewerComponent, codeModelPoint, cssLengthToPx, isPrimaryShortcut, provideCodeLanguages, resolveCodeLanguageInput, scheduleCodeTask, selectionInside, writeCodeClipboard };
|
|
851
924
|
//# sourceMappingURL=trismegisto-angular-code-viewer.mjs.map
|