@tooark/angular 1.6.1 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,7 +33,7 @@ The `@tooark/angular` package provides:
33
33
  - `@Output()`s re-emitting the custom events (`arkClose`, `arkSelect`, `changed`, …) as the original `CustomEvent` or, on the calendar, clock, datepicker, carousel and scheduler (`arkChange`, `arkSlideChange`, `arkEventClick`, …), its `detail`;
34
34
  - registration in each wrapper constructor, skipped without `customElements` — SSR and Angular Universal safe;
35
35
  - built with ng-packagr in partial Ivy: works in AOT production builds;
36
- - `toast`, `showToast`, `dismissToast` re-exported from `@tooark/core`.
36
+ - `toast`, `showToast`, `dismissToast` and `setArkLocale`, `getArkLocale`, `observeArkLocale` (the app-wide default language) re-exported from `@tooark/core`.
37
37
 
38
38
  ---
39
39
 
@@ -64,13 +64,17 @@ Add the stylesheet to `angular.json` (or import it from your global `styles.css`
64
64
 
65
65
  One standalone component per element: `ark-button` → `ArkButtonComponent` (`<ark-button-wrapper>`), `ark-kv-editor` → `ArkKvEditorComponent` (`<ark-kv-editor-wrapper>`), and so on.
66
66
 
67
- - Inputs: the element's attributes in camelCase (`iconOnly`, `stepMinutes`, `localeJson`) plus `ariaLabel` on the input, textarea, select, checkbox, radio, switch, toggle, color-swatches, shape-picker, button, copy-button, avatar, dialog, drawer, command palette and menu; object inputs where they matter (`events`, `rows`, `options`, and `valueField` on the key/value editor).
67
+ - Inputs: the element's attributes in camelCase (`iconOnly`, `stepMinutes`, `localeJson`) plus `ariaLabel` on the input, textarea, select, checkbox, radio, switch, toggle, color-swatches, shape-picker, button, copy-button, avatar, dialog, drawer, command palette, menu and pagination; object inputs where they matter (`events`, `rows`, `options`, `valueField` on the key/value editor, and `columns`, `selected` and `cardRender` on the data view). On the data view the content of a cell is an `<ng-template arkDataViewCell="<key>" let-row>` and `<ng-template arkDataViewCard let-row>` draws a card body (import `ArkDataViewCellDirective` and `ArkDataViewCardDirective`); the templates are checked with the component that declares them.
68
68
  - Outputs: the custom events in camelCase (`(arkClose)` on the dialog and drawer, `(arkSelect)` on the menu and palette, `(changed)` on the select and the key/value editor, …) delivering the `CustomEvent`; `(arkChange)` on the calendar, clock and datepicker, `(arkSlideChange)` on the carousel and `(arkEventClick)`/`(arkSlotClick)`/`(arkViewChange)`/`(arkRangeChange)` on the scheduler deliver the `detail` itself; native events bubble from the inner control (`(input)` on the input: read `$any($event.target).value`).
69
69
  - State: attributes like `open` are the source of truth (`[open]="bool"` + `(arkClose)`).
70
70
  - Element: every wrapper exposes the `ark-*` element it renders as `element`, typed as the element class (`null` before the view): `@ViewChild(ArkDialogComponent) dialog!: ArkDialogComponent;`, then `this.dialog.element?.show()`. The `*Ref` view children a few wrappers already had stay for compatibility.
71
71
  - Wrapper host: the wrapper is an element of its own around the `ark-*` one, so only the inputs reach the element. An `id`, `class`, `style` or `data-*` written on the `<ark-*-wrapper>` tag stays on the wrapper (set it through `element`), and `aria-label` goes through the `ariaLabel` input; native events such as `(click)` bubble up to the wrapper.
72
72
  - Raw `ark-*` tags (side packages): add `schemas: [CUSTOM_ELEMENTS_SCHEMA]` to your component and call the `registerTooark*()` function in the browser.
73
73
 
74
+ ### Side packages (secondary entries)
75
+
76
+ `@tooark/angular/chart` (`ArkChartComponent`, `<ark-chart-wrapper>`), `@tooark/angular/code` (`ArkCodeEditorComponent`, `<ark-code-editor-wrapper>`) and `@tooark/angular/wysiwyg` (`ArkWysiwygEditorComponent`, `ArkWysiwygViewerComponent`) wrap the side packages without adding them to the main entry: install `@tooark/chart`, `@tooark/code` or `@tooark/wysiwyg` (optional peers) with their own peers. `[option]`, `[value]`, the code editor's lists and functions and the wysiwyg `[content]`/`[uploadFile]` are property bindings, reassigned only with a new value; a controlled editor keeps its cursor. Outputs: `(chartClick)`; `(changed)`, `(arkSubmit)`, `(arkFormatError)` on the code editor (`$event.detail.value`); `(changed)` (the Tiptap JSON in `$event.detail`) and `(uploadError)` on the wysiwyg editor. Each wrapper calls its package's `registerTooark*()` and exposes `element`.
77
+
74
78
  Full attribute reference, theming guide and E2E hooks: [https://github.com/Tooark/web-components#readme](https://github.com/Tooark/web-components#readme) · live examples with interaction tests: [Storybook](https://tooark.com/web-components/).
75
79
 
76
80
  ---
@@ -87,7 +91,7 @@ import {
87
91
  ArkInputComponent,
88
92
  ArkSelectComponent,
89
93
  ArkToasterComponent,
90
- toast,
94
+ toast
91
95
  } from "@tooark/angular";
92
96
 
93
97
  @Component({
@@ -120,12 +124,12 @@ import {
120
124
 
121
125
  <ark-toaster-wrapper position="bottom-right"></ark-toaster-wrapper>
122
126
  </form>
123
- `,
127
+ `
124
128
  })
125
129
  export class ProfileFormComponent {
126
130
  roles = [
127
131
  { value: "dev", label: "Developer" },
128
- { value: "ops", label: "Operations" },
132
+ { value: "ops", label: "Operations" }
129
133
  ];
130
134
  name = "";
131
135
  role = "dev";
@@ -148,7 +152,7 @@ import { registerTooarkChart } from "@tooark/chart";
148
152
  selector: "app-sales",
149
153
  standalone: true,
150
154
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
151
- template: `<ark-chart #chart height="320px"></ark-chart>`,
155
+ template: `<ark-chart #chart height="320px"></ark-chart>`
152
156
  })
153
157
  export class SalesComponent implements AfterViewInit {
154
158
  @ViewChild("chart") chart!: ElementRef<HTMLElement & { option: object }>;
@@ -166,13 +170,16 @@ export class SalesComponent implements AfterViewInit {
166
170
 
167
171
  Installed automatically unless marked as peer; peer dependencies are yours to install (the ranges are what the package declares).
168
172
 
169
- | Package | Version | Description |
170
- | -------------------------------------------------------------------------------- | ---------------- | ---------------------------------------------------------------- |
171
- | [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.6.1 | Types, i18n, toast/announce services, motion and overlay helpers |
172
- | [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.6.1 | The `ark-*` Custom Elements and their stylesheet |
173
- | [`tslib`](https://www.npmjs.com/package/tslib) | ^2.8.1 | TypeScript runtime helpers |
174
- | [`@angular/common`](https://www.npmjs.com/package/@angular/common) | >=21.2.19 (peer) | Angular common |
175
- | [`@angular/core`](https://www.npmjs.com/package/@angular/core) | >=21.2.19 (peer) | Angular core (security floor of the workspace) |
173
+ | Package | Version | Description |
174
+ | -------------------------------------------------------------------------------- | ----------------------- | ---------------------------------------------------------------- |
175
+ | [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.8.0 | Types, i18n, toast/announce services, motion and overlay helpers |
176
+ | [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.8.0 | The `ark-*` Custom Elements and their stylesheet |
177
+ | [`tslib`](https://www.npmjs.com/package/tslib) | ^2.9.1 | TypeScript runtime helpers |
178
+ | [`@angular/common`](https://www.npmjs.com/package/@angular/common) | >=21.2.19 (peer) | Angular common |
179
+ | [`@angular/core`](https://www.npmjs.com/package/@angular/core) | >=21.2.19 (peer) | Angular core (security floor of the workspace) |
180
+ | [`@tooark/chart`](https://www.npmjs.com/package/@tooark/chart) | >=1.0.0 (optional peer) | ark-chart, for the `/chart` subpath |
181
+ | [`@tooark/code`](https://www.npmjs.com/package/@tooark/code) | >=1.6.0 (optional peer) | ark-code-editor, for the `/code` subpath |
182
+ | [`@tooark/wysiwyg`](https://www.npmjs.com/package/@tooark/wysiwyg) | >=1.0.0 (optional peer) | ark-wysiwyg-*, for the `/wysiwyg` subpath |
176
183
 
177
184
  ---
178
185
 
package/README.pt-BR.md CHANGED
@@ -33,7 +33,7 @@ O pacote `@tooark/angular` fornece:
33
33
  - `@Output()` reemitindo os eventos customizados (`arkClose`, `arkSelect`, `changed`, …) como o `CustomEvent` original ou, no calendário, relógio, datepicker, carrossel e agenda (`arkChange`, `arkSlideChange`, `arkEventClick`, …), o `detail` dele;
34
34
  - registro no construtor de cada wrapper, pulado sem `customElements` — seguro para SSR e Angular Universal;
35
35
  - compilado com ng-packagr em Ivy parcial: funciona em builds AOT de produção;
36
- - `toast`, `showToast`, `dismissToast` reexportados do `@tooark/core`.
36
+ - `toast`, `showToast`, `dismissToast` e `setArkLocale`, `getArkLocale`, `observeArkLocale` (o idioma padrão do app) reexportados do `@tooark/core`.
37
37
 
38
38
  ---
39
39
 
@@ -64,13 +64,17 @@ Adicione a folha de estilo ao `angular.json` (ou importe-a do seu `styles.css` g
64
64
 
65
65
  Um componente standalone por elemento: `ark-button` → `ArkButtonComponent` (`<ark-button-wrapper>`), `ark-kv-editor` → `ArkKvEditorComponent` (`<ark-kv-editor-wrapper>`), e assim por diante.
66
66
 
67
- - Inputs: os atributos do elemento em camelCase (`iconOnly`, `stepMinutes`, `localeJson`) mais `ariaLabel` no input, textarea, select, checkbox, radio, switch, toggle, color-swatches, shape-picker, button, copy-button, avatar, dialog, drawer, paleta de comandos e menu; inputs de objeto onde importam (`events`, `rows`, `options`, e `valueField` no editor chave/valor).
67
+ - Inputs: os atributos do elemento em camelCase (`iconOnly`, `stepMinutes`, `localeJson`) mais `ariaLabel` no input, textarea, select, checkbox, radio, switch, toggle, color-swatches, shape-picker, button, copy-button, avatar, dialog, drawer, paleta de comandos, menu e paginação; inputs de objeto onde importam (`events`, `rows`, `options`, `valueField` no editor chave/valor, e `columns`, `selected` e `cardRender` no data view). No data view o conteúdo de uma célula é um `<ng-template arkDataViewCell="<key>" let-row>` e `<ng-template arkDataViewCard let-row>` desenha o corpo de um card (importe `ArkDataViewCellDirective` e `ArkDataViewCardDirective`); os templates são checados com o componente que os declara.
68
68
  - Outputs: os eventos customizados em camelCase (`(arkClose)` no dialog e no drawer, `(arkSelect)` no menu e na paleta, `(changed)` no select e no editor chave/valor, …) entregando o `CustomEvent`; `(arkChange)` no calendário, no relógio e no datepicker, `(arkSlideChange)` no carrossel e `(arkEventClick)`/`(arkSlotClick)`/`(arkViewChange)`/`(arkRangeChange)` na agenda entregam o próprio `detail`; eventos nativos sobem do controle interno (`(input)` no input: leia `$any($event.target).value`).
69
69
  - Estado: atributos como `open` são a fonte da verdade (`[open]="bool"` + `(arkClose)`).
70
70
  - Elemento: todo wrapper expõe o elemento `ark-*` que renderiza em `element`, tipado como a classe do elemento (`null` antes da view): `@ViewChild(ArkDialogComponent) dialog!: ArkDialogComponent;` e depois `this.dialog.element?.show()`. As view children `*Ref` que alguns wrappers já tinham continuam, por compatibilidade.
71
71
  - Host do wrapper: o wrapper é um elemento próprio em volta do `ark-*`, então só os inputs chegam ao elemento. Um `id`, `class`, `style` ou `data-*` escrito na tag `<ark-*-wrapper>` fica no wrapper (atribua pelo `element`), e o `aria-label` vai pelo input `ariaLabel`; eventos nativos como `(click)` sobem até o wrapper.
72
72
  - Tags `ark-*` cruas (pacotes laterais): adicione `schemas: [CUSTOM_ELEMENTS_SCHEMA]` ao seu componente e chame a função `registerTooark*()` no navegador.
73
73
 
74
+ ### Pacotes laterais (entradas secundárias)
75
+
76
+ `@tooark/angular/chart` (`ArkChartComponent`, `<ark-chart-wrapper>`), `@tooark/angular/code` (`ArkCodeEditorComponent`, `<ark-code-editor-wrapper>`) e `@tooark/angular/wysiwyg` (`ArkWysiwygEditorComponent`, `ArkWysiwygViewerComponent`) envolvem os pacotes laterais sem trazê-los para a entrada principal: instale `@tooark/chart`, `@tooark/code` ou `@tooark/wysiwyg` (peers opcionais) com os peers deles. `[option]`, `[value]`, as listas e funções do editor de código e o `[content]`/`[uploadFile]` do wysiwyg são property bindings, reatribuídos só com valor novo; um editor controlado mantém o cursor. Outputs: `(chartClick)`; `(changed)`, `(arkSubmit)`, `(arkFormatError)` no editor de código (`$event.detail.value`); `(changed)` (o JSON do Tiptap em `$event.detail`) e `(uploadError)` no editor wysiwyg. Cada wrapper chama o `registerTooark*()` do próprio pacote e expõe `element`.
77
+
74
78
  Referência completa de atributos, guia de tema e hooks de E2E: [https://github.com/Tooark/web-components/blob/main/README.pt-BR.md](https://github.com/Tooark/web-components/blob/main/README.pt-BR.md) · exemplos vivos com testes de interação: [Storybook](https://tooark.com/web-components/).
75
79
 
76
80
  ---
@@ -87,7 +91,7 @@ import {
87
91
  ArkInputComponent,
88
92
  ArkSelectComponent,
89
93
  ArkToasterComponent,
90
- toast,
94
+ toast
91
95
  } from "@tooark/angular";
92
96
 
93
97
  @Component({
@@ -120,12 +124,12 @@ import {
120
124
 
121
125
  <ark-toaster-wrapper position="bottom-right" lang="pt"></ark-toaster-wrapper>
122
126
  </form>
123
- `,
127
+ `
124
128
  })
125
129
  export class FormularioPerfilComponent {
126
130
  papeis = [
127
131
  { value: "dev", label: "Desenvolvimento" },
128
- { value: "ops", label: "Operações" },
132
+ { value: "ops", label: "Operações" }
129
133
  ];
130
134
  nome = "";
131
135
  papel = "dev";
@@ -148,7 +152,7 @@ import { registerTooarkChart } from "@tooark/chart";
148
152
  selector: "app-vendas",
149
153
  standalone: true,
150
154
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
151
- template: `<ark-chart #chart height="320px"></ark-chart>`,
155
+ template: `<ark-chart #chart height="320px"></ark-chart>`
152
156
  })
153
157
  export class VendasComponent implements AfterViewInit {
154
158
  @ViewChild("chart") chart!: ElementRef<HTMLElement & { option: object }>;
@@ -166,13 +170,16 @@ export class VendasComponent implements AfterViewInit {
166
170
 
167
171
  Instaladas automaticamente, salvo as marcadas como peer, que ficam por sua conta (os ranges são os que o pacote declara).
168
172
 
169
- | Pacote | Versão | Descrição |
170
- | -------------------------------------------------------------------------------- | ---------------- | -------------------------------------------------------------------- |
171
- | [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.6.1 | Tipos, i18n, serviços de toast/announce, motion e helpers de overlay |
172
- | [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.6.1 | Os Custom Elements `ark-*` e a folha de estilo deles |
173
- | [`tslib`](https://www.npmjs.com/package/tslib) | ^2.8.1 | Helpers de runtime do TypeScript |
174
- | [`@angular/common`](https://www.npmjs.com/package/@angular/common) | >=21.2.19 (peer) | Angular common |
175
- | [`@angular/core`](https://www.npmjs.com/package/@angular/core) | >=21.2.19 (peer) | Núcleo do Angular (piso de segurança do workspace) |
173
+ | Pacote | Versão | Descrição |
174
+ | -------------------------------------------------------------------------------- | ----------------------- | -------------------------------------------------------------------- |
175
+ | [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.8.0 | Tipos, i18n, serviços de toast/announce, motion e helpers de overlay |
176
+ | [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.8.0 | Os Custom Elements `ark-*` e a folha de estilo deles |
177
+ | [`tslib`](https://www.npmjs.com/package/tslib) | ^2.9.1 | Helpers de runtime do TypeScript |
178
+ | [`@angular/common`](https://www.npmjs.com/package/@angular/common) | >=21.2.19 (peer) | Angular common |
179
+ | [`@angular/core`](https://www.npmjs.com/package/@angular/core) | >=21.2.19 (peer) | Núcleo do Angular (piso de segurança do workspace) |
180
+ | [`@tooark/chart`](https://www.npmjs.com/package/@tooark/chart) | >=1.0.0 (peer opcional) | ark-chart, para a subpath `/chart` |
181
+ | [`@tooark/code`](https://www.npmjs.com/package/@tooark/code) | >=1.6.0 (peer opcional) | ark-code-editor, para a subpath `/code` |
182
+ | [`@tooark/wysiwyg`](https://www.npmjs.com/package/@tooark/wysiwyg) | >=1.0.0 (peer opcional) | ark-wysiwyg-*, para a subpath `/wysiwyg` |
176
183
 
177
184
  ---
178
185
 
@@ -0,0 +1,77 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ElementRef, EventEmitter, Output, Input, CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
3
+ import { registerTooarkChart } from '@tooark/chart';
4
+
5
+ // Entry point @tooark/angular/chart: fora da entrada principal para que o ECharts (peer do @tooark/chart) só entre no
6
+ // app que importa este caminho.
7
+ class ArkChartComponent {
8
+ constructor() {
9
+ this.host = inject(ElementRef);
10
+ /** Opções nativas do ECharts, pela propriedade (só com referência nova; cada uma re-renderiza com notMerge). */
11
+ this.option = null;
12
+ /** Clique numa série, com os params nativos do ECharts em `detail`. */
13
+ this.chartClick = new EventEmitter();
14
+ this.clickHandler = (event) => this.chartClick.emit(event);
15
+ registerTooarkChart();
16
+ }
17
+ /** O `ark-chart` que este wrapper renderiza, com os métodos e propriedades do elemento; `null` antes da view. */
18
+ get element() {
19
+ return this.host.nativeElement.querySelector(":scope > ark-chart");
20
+ }
21
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: ArkChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
22
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.26", type: ArkChartComponent, isStandalone: true, selector: "ark-chart-wrapper", inputs: { testid: "testid", option: "option", theme: "theme", palette: "palette", renderer: "renderer", height: "height", autoResize: "autoResize", ariaLabel: "ariaLabel" }, outputs: { chartClick: "chartClick" }, ngImport: i0, template: `
23
+ <ark-chart
24
+ [attr.testid]="testid"
25
+ [attr.theme]="theme"
26
+ [attr.palette]="palette"
27
+ [attr.renderer]="renderer"
28
+ [attr.height]="height"
29
+ [attr.auto-resize]="autoResize === false ? 'false' : null"
30
+ [attr.aria-label]="ariaLabel"
31
+ [option]="option"
32
+ (ark-chart-click)="clickHandler($event)"></ark-chart>`, isInline: true }); }
33
+ }
34
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: ArkChartComponent, decorators: [{
35
+ type: Component,
36
+ args: [{
37
+ selector: "ark-chart-wrapper",
38
+ standalone: true,
39
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
40
+ template: `
41
+ <ark-chart
42
+ [attr.testid]="testid"
43
+ [attr.theme]="theme"
44
+ [attr.palette]="palette"
45
+ [attr.renderer]="renderer"
46
+ [attr.height]="height"
47
+ [attr.auto-resize]="autoResize === false ? 'false' : null"
48
+ [attr.aria-label]="ariaLabel"
49
+ [option]="option"
50
+ (ark-chart-click)="clickHandler($event)"></ark-chart>`
51
+ }]
52
+ }], ctorParameters: () => [], propDecorators: { testid: [{
53
+ type: Input
54
+ }], option: [{
55
+ type: Input
56
+ }], theme: [{
57
+ type: Input
58
+ }], palette: [{
59
+ type: Input
60
+ }], renderer: [{
61
+ type: Input
62
+ }], height: [{
63
+ type: Input
64
+ }], autoResize: [{
65
+ type: Input
66
+ }], ariaLabel: [{
67
+ type: Input
68
+ }], chartClick: [{
69
+ type: Output
70
+ }] } });
71
+
72
+ /**
73
+ * Generated bundle index. Do not edit.
74
+ */
75
+
76
+ export { ArkChartComponent };
77
+ //# sourceMappingURL=tooark-angular-chart.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooark-angular-chart.mjs","sources":["../../chart/src/ark-chart.component.ts","../../chart/src/tooark-angular-chart.ts"],"sourcesContent":["import { Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, EventEmitter, Input, inject, Output } from \"@angular/core\";\nimport { type ArkChart as ArkChartElement, type EChartsOption, registerTooarkChart } from \"@tooark/chart\";\n\n// Entry point @tooark/angular/chart: fora da entrada principal para que o ECharts (peer do @tooark/chart) só entre no\n// app que importa este caminho.\n@Component({\n selector: \"ark-chart-wrapper\",\n standalone: true,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n template: `\n <ark-chart\n [attr.testid]=\"testid\"\n [attr.theme]=\"theme\"\n [attr.palette]=\"palette\"\n [attr.renderer]=\"renderer\"\n [attr.height]=\"height\"\n [attr.auto-resize]=\"autoResize === false ? 'false' : null\"\n [attr.aria-label]=\"ariaLabel\"\n [option]=\"option\"\n (ark-chart-click)=\"clickHandler($event)\"></ark-chart>`\n})\nexport class ArkChartComponent {\n constructor() {\n registerTooarkChart();\n }\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** O `ark-chart` que este wrapper renderiza, com os métodos e propriedades do elemento; `null` antes da view. */\n get element(): ArkChartElement | null {\n return this.host.nativeElement.querySelector<ArkChartElement>(\":scope > ark-chart\");\n }\n\n @Input() testid: string | undefined;\n /** Opções nativas do ECharts, pela propriedade (só com referência nova; cada uma re-renderiza com notMerge). */\n @Input() option: EChartsOption | null = null;\n /** auto (segue o color-scheme da página), light ou dark. Padrão: \"auto\". */\n @Input() theme: \"auto\" | \"light\" | \"dark\" | undefined;\n /** default ou tokens (cores dos tokens `--ark-color-*`, @tooark/chart 1.7+). Padrão: \"default\". */\n @Input() palette: \"default\" | \"tokens\" | undefined;\n @Input() renderer: \"canvas\" | \"svg\" | undefined;\n /** Altura (comprimento CSS). Padrão: \"320px\". */\n @Input() height: string | undefined;\n /** false desliga o redimensionamento junto com o contêiner. Padrão: true. */\n @Input() autoResize: boolean | undefined;\n /** Nome do gráfico como imagem (`role=\"img\"`). */\n @Input() ariaLabel: string | undefined;\n /** Clique numa série, com os params nativos do ECharts em `detail`. */\n @Output() chartClick = new EventEmitter<CustomEvent>();\n\n protected clickHandler = (event: Event) => this.chartClick.emit(event as CustomEvent);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGA;AACA;MAiBa,iBAAiB,CAAA;AAC5B,IAAA,WAAA,GAAA;AAIiB,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAA0B,UAAU,CAAC;;QAS1D,IAAA,CAAA,MAAM,GAAyB,IAAI;;AAalC,QAAA,IAAA,CAAA,UAAU,GAAG,IAAI,YAAY,EAAe;AAE5C,QAAA,IAAA,CAAA,YAAY,GAAG,CAAC,KAAY,KAAK,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAoB,CAAC;AA3BnF,QAAA,mBAAmB,EAAE;IACvB;;AAKA,IAAA,IAAI,OAAO,GAAA;QACT,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,aAAa,CAAkB,oBAAoB,CAAC;IACrF;+GAVW,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAjB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,iBAAiB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,QAAA,EAAA,KAAA,EAAA,OAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,QAAA,EAAA,UAAA,EAAA,YAAA,EAAA,SAAA,EAAA,WAAA,EAAA,EAAA,OAAA,EAAA,EAAA,UAAA,EAAA,YAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAZlB;;;;;;;;;;AAU8C,yDAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,CAAA;;4FAE7C,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAhB7B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,sBAAsB,CAAC;AACjC,oBAAA,QAAQ,EAAE;;;;;;;;;;AAU8C,yDAAA;AACzD,iBAAA;;sBAaE;;sBAEA;;sBAEA;;sBAEA;;sBACA;;sBAEA;;sBAEA;;sBAEA;;sBAEA;;;AChDH;;AAEG;;"}
@@ -0,0 +1,165 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ElementRef, EventEmitter, Output, Input, CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
3
+ import { registerTooarkCode } from '@tooark/code';
4
+
5
+ // Entry point @tooark/angular/code: fora da entrada principal para que o CodeMirror (peers do @tooark/code) só entre
6
+ // no app que importa este caminho. As propriedades JS vão por property binding, que só reatribui com valor novo.
7
+ class ArkCodeEditorComponent {
8
+ constructor() {
9
+ this.host = inject(ElementRef);
10
+ this.readonly = false;
11
+ this.wrap = false;
12
+ this.markUnknownVariables = false;
13
+ this.singleLine = false;
14
+ /** Cada edição do usuário, com `detail: { value }`. */
15
+ this.changed = new EventEmitter();
16
+ /** Enter em `singleLine`, com `detail: { value }`. */
17
+ this.arkSubmit = new EventEmitter();
18
+ /** `format()` falhou, com `detail: { error }`. */
19
+ this.arkFormatError = new EventEmitter();
20
+ this.changeHandler = (event) => this.changed.emit(event);
21
+ this.submitHandler = (event) => this.arkSubmit.emit(event);
22
+ this.formatErrorHandler = (event) => this.arkFormatError.emit(event);
23
+ registerTooarkCode();
24
+ }
25
+ /** O `ark-code-editor` que este wrapper renderiza, com os métodos e propriedades do elemento; `null` antes da view. */
26
+ get element() {
27
+ return this.host.nativeElement.querySelector(":scope > ark-code-editor");
28
+ }
29
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: ArkCodeEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
30
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.26", type: ArkCodeEditorComponent, isStandalone: true, selector: "ark-code-editor-wrapper", inputs: { testid: "testid", value: "value", language: "language", theme: "theme", readonly: "readonly", placeholder: "placeholder", minHeight: "minHeight", maxHeight: "maxHeight", lineNumbers: "lineNumbers", fold: "fold", wrap: "wrap", indentStyle: "indentStyle", indentSize: "indentSize", lineEnding: "lineEnding", tabIndent: "tabIndent", autocomplete: "autocomplete", markUnknownVariables: "markUnknownVariables", singleLine: "singleLine", size: "size", ariaLabel: "ariaLabel", variableKeys: "variableKeys", variables: "variables", completions: "completions", completionSource: "completionSource", formatter: "formatter", extensions: "extensions" }, outputs: { changed: "changed", arkSubmit: "arkSubmit", arkFormatError: "arkFormatError" }, ngImport: i0, template: `
31
+ <ark-code-editor
32
+ [attr.testid]="testid"
33
+ [attr.language]="language"
34
+ [attr.theme]="theme"
35
+ [attr.readonly]="readonly ? '' : null"
36
+ [attr.placeholder]="placeholder"
37
+ [attr.min-height]="minHeight"
38
+ [attr.max-height]="maxHeight"
39
+ [attr.line-numbers]="lineNumbers === false ? 'false' : null"
40
+ [attr.fold]="fold === false ? 'false' : null"
41
+ [attr.wrap]="wrap ? '' : null"
42
+ [attr.indent-style]="indentStyle"
43
+ [attr.indent-size]="indentSize"
44
+ [attr.line-ending]="lineEnding"
45
+ [attr.tab-indent]="tabIndent === false ? 'false' : null"
46
+ [attr.autocomplete]="autocomplete === false ? 'false' : null"
47
+ [attr.mark-unknown-variables]="markUnknownVariables ? '' : null"
48
+ [attr.single-line]="singleLine ? '' : null"
49
+ [attr.size]="size"
50
+ [attr.aria-label]="ariaLabel"
51
+ [value]="value ?? ''"
52
+ [variableKeys]="variableKeys ?? []"
53
+ [variables]="variables ?? []"
54
+ [completions]="completions ?? []"
55
+ [completionSource]="completionSource"
56
+ [formatter]="formatter"
57
+ [extensions]="extensions ?? []"
58
+ (change)="changeHandler($event)"
59
+ (ark-submit)="submitHandler($event)"
60
+ (ark-format-error)="formatErrorHandler($event)"></ark-code-editor>`, isInline: true }); }
61
+ }
62
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: ArkCodeEditorComponent, decorators: [{
63
+ type: Component,
64
+ args: [{
65
+ selector: "ark-code-editor-wrapper",
66
+ standalone: true,
67
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
68
+ template: `
69
+ <ark-code-editor
70
+ [attr.testid]="testid"
71
+ [attr.language]="language"
72
+ [attr.theme]="theme"
73
+ [attr.readonly]="readonly ? '' : null"
74
+ [attr.placeholder]="placeholder"
75
+ [attr.min-height]="minHeight"
76
+ [attr.max-height]="maxHeight"
77
+ [attr.line-numbers]="lineNumbers === false ? 'false' : null"
78
+ [attr.fold]="fold === false ? 'false' : null"
79
+ [attr.wrap]="wrap ? '' : null"
80
+ [attr.indent-style]="indentStyle"
81
+ [attr.indent-size]="indentSize"
82
+ [attr.line-ending]="lineEnding"
83
+ [attr.tab-indent]="tabIndent === false ? 'false' : null"
84
+ [attr.autocomplete]="autocomplete === false ? 'false' : null"
85
+ [attr.mark-unknown-variables]="markUnknownVariables ? '' : null"
86
+ [attr.single-line]="singleLine ? '' : null"
87
+ [attr.size]="size"
88
+ [attr.aria-label]="ariaLabel"
89
+ [value]="value ?? ''"
90
+ [variableKeys]="variableKeys ?? []"
91
+ [variables]="variables ?? []"
92
+ [completions]="completions ?? []"
93
+ [completionSource]="completionSource"
94
+ [formatter]="formatter"
95
+ [extensions]="extensions ?? []"
96
+ (change)="changeHandler($event)"
97
+ (ark-submit)="submitHandler($event)"
98
+ (ark-format-error)="formatErrorHandler($event)"></ark-code-editor>`
99
+ }]
100
+ }], ctorParameters: () => [], propDecorators: { testid: [{
101
+ type: Input
102
+ }], value: [{
103
+ type: Input
104
+ }], language: [{
105
+ type: Input
106
+ }], theme: [{
107
+ type: Input
108
+ }], readonly: [{
109
+ type: Input
110
+ }], placeholder: [{
111
+ type: Input
112
+ }], minHeight: [{
113
+ type: Input
114
+ }], maxHeight: [{
115
+ type: Input
116
+ }], lineNumbers: [{
117
+ type: Input
118
+ }], fold: [{
119
+ type: Input
120
+ }], wrap: [{
121
+ type: Input
122
+ }], indentStyle: [{
123
+ type: Input
124
+ }], indentSize: [{
125
+ type: Input
126
+ }], lineEnding: [{
127
+ type: Input
128
+ }], tabIndent: [{
129
+ type: Input
130
+ }], autocomplete: [{
131
+ type: Input
132
+ }], markUnknownVariables: [{
133
+ type: Input
134
+ }], singleLine: [{
135
+ type: Input
136
+ }], size: [{
137
+ type: Input
138
+ }], ariaLabel: [{
139
+ type: Input
140
+ }], variableKeys: [{
141
+ type: Input
142
+ }], variables: [{
143
+ type: Input
144
+ }], completions: [{
145
+ type: Input
146
+ }], completionSource: [{
147
+ type: Input
148
+ }], formatter: [{
149
+ type: Input
150
+ }], extensions: [{
151
+ type: Input
152
+ }], changed: [{
153
+ type: Output
154
+ }], arkSubmit: [{
155
+ type: Output
156
+ }], arkFormatError: [{
157
+ type: Output
158
+ }] } });
159
+
160
+ /**
161
+ * Generated bundle index. Do not edit.
162
+ */
163
+
164
+ export { ArkCodeEditorComponent };
165
+ //# sourceMappingURL=tooark-angular-code.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooark-angular-code.mjs","sources":["../../code/src/ark-code-editor.component.ts","../../code/src/tooark-angular-code.ts"],"sourcesContent":["import { Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, EventEmitter, Input, inject, Output } from \"@angular/core\";\nimport {\n type ArkCodeCompletion,\n type ArkCodeCompletionSource,\n type ArkCodeEditor as ArkCodeEditorElement,\n type ArkCodeExtension,\n type ArkCodeFormatter,\n type ArkCodeIndentStyle,\n type ArkCodeLanguage,\n type ArkCodeLineEnding,\n type ArkCodeVariable,\n registerTooarkCode\n} from \"@tooark/code\";\nimport type { ArkSize } from \"@tooark/core\";\n\n// Entry point @tooark/angular/code: fora da entrada principal para que o CodeMirror (peers do @tooark/code) só entre\n// no app que importa este caminho. As propriedades JS vão por property binding, que só reatribui com valor novo.\n@Component({\n selector: \"ark-code-editor-wrapper\",\n standalone: true,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n template: `\n <ark-code-editor\n [attr.testid]=\"testid\"\n [attr.language]=\"language\"\n [attr.theme]=\"theme\"\n [attr.readonly]=\"readonly ? '' : null\"\n [attr.placeholder]=\"placeholder\"\n [attr.min-height]=\"minHeight\"\n [attr.max-height]=\"maxHeight\"\n [attr.line-numbers]=\"lineNumbers === false ? 'false' : null\"\n [attr.fold]=\"fold === false ? 'false' : null\"\n [attr.wrap]=\"wrap ? '' : null\"\n [attr.indent-style]=\"indentStyle\"\n [attr.indent-size]=\"indentSize\"\n [attr.line-ending]=\"lineEnding\"\n [attr.tab-indent]=\"tabIndent === false ? 'false' : null\"\n [attr.autocomplete]=\"autocomplete === false ? 'false' : null\"\n [attr.mark-unknown-variables]=\"markUnknownVariables ? '' : null\"\n [attr.single-line]=\"singleLine ? '' : null\"\n [attr.size]=\"size\"\n [attr.aria-label]=\"ariaLabel\"\n [value]=\"value ?? ''\"\n [variableKeys]=\"variableKeys ?? []\"\n [variables]=\"variables ?? []\"\n [completions]=\"completions ?? []\"\n [completionSource]=\"completionSource\"\n [formatter]=\"formatter\"\n [extensions]=\"extensions ?? []\"\n (change)=\"changeHandler($event)\"\n (ark-submit)=\"submitHandler($event)\"\n (ark-format-error)=\"formatErrorHandler($event)\"></ark-code-editor>`\n})\nexport class ArkCodeEditorComponent {\n constructor() {\n registerTooarkCode();\n }\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** O `ark-code-editor` que este wrapper renderiza, com os métodos e propriedades do elemento; `null` antes da view. */\n get element(): ArkCodeEditorElement | null {\n return this.host.nativeElement.querySelector<ArkCodeEditorElement>(\":scope > ark-code-editor\");\n }\n\n @Input() testid: string | undefined;\n /** Texto do editor; o valor que o `(changed)` acabou de entregar, repassado, não move o cursor. */\n @Input() value: string | undefined;\n @Input() language: ArkCodeLanguage | undefined;\n @Input() theme: \"auto\" | \"light\" | \"dark\" | undefined;\n @Input() readonly = false;\n @Input() placeholder: string | undefined;\n @Input() minHeight: string | undefined;\n /** Altura máxima (comprimento CSS), com rolagem interna acima dela. */\n @Input() maxHeight: string | undefined;\n /** false tira a numeração. Padrão: true. */\n @Input() lineNumbers: boolean | undefined;\n /** false tira a calha de dobra. Padrão: true. */\n @Input() fold: boolean | undefined;\n @Input() wrap = false;\n @Input() indentStyle: ArkCodeIndentStyle | undefined;\n @Input() indentSize: number | undefined;\n @Input() lineEnding: ArkCodeLineEnding | undefined;\n /** false deixa Tab como navegação. Padrão: true. */\n @Input() tabIndent: boolean | undefined;\n /** false desliga as completions. Padrão: true. */\n @Input() autocomplete: boolean | undefined;\n @Input() markUnknownVariables = false;\n @Input() singleLine = false;\n @Input() size: ArkSize | undefined;\n @Input() ariaLabel: string | undefined;\n @Input() variableKeys: string[] | undefined;\n @Input() variables: ArkCodeVariable[] | undefined;\n @Input() completions: ArkCodeCompletion[] | undefined;\n @Input() completionSource: ArkCodeCompletionSource | undefined;\n @Input() formatter: ArkCodeFormatter | undefined;\n /** Extensões do CodeMirror do app; mantenha a referência estável, uma nova reconfigura o editor. */\n @Input() extensions: ArkCodeExtension | undefined;\n /** Cada edição do usuário, com `detail: { value }`. */\n @Output() changed = new EventEmitter<CustomEvent<{ value: string }>>();\n /** Enter em `singleLine`, com `detail: { value }`. */\n @Output() arkSubmit = new EventEmitter<CustomEvent<{ value: string }>>();\n /** `format()` falhou, com `detail: { error }`. */\n @Output() arkFormatError = new EventEmitter<CustomEvent<{ error: unknown }>>();\n\n protected changeHandler = (event: Event) => this.changed.emit(event as CustomEvent<{ value: string }>);\n protected submitHandler = (event: Event) => this.arkSubmit.emit(event as CustomEvent<{ value: string }>);\n protected formatErrorHandler = (event: Event) => this.arkFormatError.emit(event as CustomEvent<{ error: unknown }>);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAeA;AACA;MAqCa,sBAAsB,CAAA;AACjC,IAAA,WAAA,GAAA;AAIiB,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAA0B,UAAU,CAAC;QAY1D,IAAA,CAAA,QAAQ,GAAG,KAAK;QAShB,IAAA,CAAA,IAAI,GAAG,KAAK;QAQZ,IAAA,CAAA,oBAAoB,GAAG,KAAK;QAC5B,IAAA,CAAA,UAAU,GAAG,KAAK;;AAWjB,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,YAAY,EAAkC;;AAE5D,QAAA,IAAA,CAAA,SAAS,GAAG,IAAI,YAAY,EAAkC;;AAE9D,QAAA,IAAA,CAAA,cAAc,GAAG,IAAI,YAAY,EAAmC;AAEpE,QAAA,IAAA,CAAA,aAAa,GAAG,CAAC,KAAY,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAuC,CAAC;AAC5F,QAAA,IAAA,CAAA,aAAa,GAAG,CAAC,KAAY,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAuC,C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A,OAAA,EAAA,SAAA,EAAA,SAAA,EAAA,WAAA,EAAA,cAAA,EAAA,gBAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAhCvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8B2D,sEAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,CAAA;;4FAE1D,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBApClC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,yBAAyB;AACnC,oBAAA,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,sBAAsB,CAAC;AACjC,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8B2D,sEAAA;AACtE,iBAAA;;sBAaE;;sBAEA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBAEA;;sBAEA;;sBAEA;;sBACA;;sBACA;;sBACA;;sBACA;;sBAEA;;sBAEA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBAEA;;sBAEA;;sBAEA;;sBAEA;;;ACvGH;;AAEG;;"}
@@ -0,0 +1,163 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ElementRef, EventEmitter, Output, Input, CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
3
+ import { registerTooarkWysiwyg } from '@tooark/wysiwyg';
4
+
5
+ // Entry point @tooark/angular/wysiwyg: fora da entrada principal para que o Tiptap (dependência do @tooark/wysiwyg) só
6
+ // entre no app que importa este caminho.
7
+ class ArkWysiwygEditorComponent {
8
+ constructor() {
9
+ this.host = inject(ElementRef);
10
+ /** Cada edição, com o JSON do Tiptap em `detail`. */
11
+ this.changed = new EventEmitter();
12
+ /** Arquivo recusado ou upload que falhou, com o motivo em `detail`. */
13
+ this.uploadError = new EventEmitter();
14
+ this.stringify = (value) => JSON.stringify(value);
15
+ this.changeHandler = (event) => {
16
+ this.known = event.detail;
17
+ this.changed.emit(event);
18
+ };
19
+ this.uploadErrorHandler = (event) => this.uploadError.emit(event);
20
+ registerTooarkWysiwyg();
21
+ }
22
+ /** O `ark-wysiwyg-editor` que este wrapper renderiza; `null` antes da view. */
23
+ get element() {
24
+ return this.host.nativeElement.querySelector(":scope > ark-wysiwyg-editor");
25
+ }
26
+ /**
27
+ * Conteúdo como JSON do Tiptap. Atribuído só quando a referência muda e fora do histórico de desfazer: o objeto
28
+ * que o `(changed)` entregou, repassado, não reescreve o editor nem move o cursor.
29
+ */
30
+ set content(value) {
31
+ if (value === undefined || value === this.known)
32
+ return;
33
+ this.known = value;
34
+ const el = this.element;
35
+ if (el) {
36
+ el.content = value;
37
+ }
38
+ else {
39
+ this.pending = value;
40
+ }
41
+ }
42
+ get content() {
43
+ return this.known;
44
+ }
45
+ get localeJsonAttr() {
46
+ if (this.localeJson === undefined)
47
+ return null;
48
+ return typeof this.localeJson === "string" ? this.localeJson : JSON.stringify(this.localeJson);
49
+ }
50
+ ngAfterViewInit() {
51
+ const el = this.element;
52
+ if (el && this.pending !== undefined)
53
+ el.content = this.pending;
54
+ this.pending = undefined;
55
+ }
56
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: ArkWysiwygEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
57
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.26", type: ArkWysiwygEditorComponent, isStandalone: true, selector: "ark-wysiwyg-editor-wrapper", inputs: { testid: "testid", content: "content", uploadFile: "uploadFile", toolbar: "toolbar", theme: "theme", placeholder: "placeholder", editable: "editable", lang: "lang", localeJson: "localeJson", colors: "colors", highlights: "highlights", maxFileSize: "maxFileSize", ariaLabel: "ariaLabel" }, outputs: { changed: "changed", uploadError: "uploadError" }, ngImport: i0, template: `
58
+ <ark-wysiwyg-editor
59
+ [attr.testid]="testid"
60
+ [attr.toolbar]="toolbar"
61
+ [attr.theme]="theme"
62
+ [attr.placeholder]="placeholder"
63
+ [attr.editable]="editable === false ? 'false' : null"
64
+ [attr.lang]="lang"
65
+ [attr.locale-json]="localeJsonAttr"
66
+ [attr.colors]="colors ? stringify(colors) : null"
67
+ [attr.highlights]="highlights ? stringify(highlights) : null"
68
+ [attr.max-file-size]="maxFileSize"
69
+ [attr.aria-label]="ariaLabel"
70
+ [uploadFile]="uploadFile ?? null"
71
+ (ark-wysiwyg-change)="changeHandler($event)"
72
+ (ark-wysiwyg-upload-error)="uploadErrorHandler($event)"></ark-wysiwyg-editor>`, isInline: true }); }
73
+ }
74
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: ArkWysiwygEditorComponent, decorators: [{
75
+ type: Component,
76
+ args: [{
77
+ selector: "ark-wysiwyg-editor-wrapper",
78
+ standalone: true,
79
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
80
+ template: `
81
+ <ark-wysiwyg-editor
82
+ [attr.testid]="testid"
83
+ [attr.toolbar]="toolbar"
84
+ [attr.theme]="theme"
85
+ [attr.placeholder]="placeholder"
86
+ [attr.editable]="editable === false ? 'false' : null"
87
+ [attr.lang]="lang"
88
+ [attr.locale-json]="localeJsonAttr"
89
+ [attr.colors]="colors ? stringify(colors) : null"
90
+ [attr.highlights]="highlights ? stringify(highlights) : null"
91
+ [attr.max-file-size]="maxFileSize"
92
+ [attr.aria-label]="ariaLabel"
93
+ [uploadFile]="uploadFile ?? null"
94
+ (ark-wysiwyg-change)="changeHandler($event)"
95
+ (ark-wysiwyg-upload-error)="uploadErrorHandler($event)"></ark-wysiwyg-editor>`
96
+ }]
97
+ }], ctorParameters: () => [], propDecorators: { testid: [{
98
+ type: Input
99
+ }], content: [{
100
+ type: Input
101
+ }], uploadFile: [{
102
+ type: Input
103
+ }], toolbar: [{
104
+ type: Input
105
+ }], theme: [{
106
+ type: Input
107
+ }], placeholder: [{
108
+ type: Input
109
+ }], editable: [{
110
+ type: Input
111
+ }], lang: [{
112
+ type: Input
113
+ }], localeJson: [{
114
+ type: Input
115
+ }], colors: [{
116
+ type: Input
117
+ }], highlights: [{
118
+ type: Input
119
+ }], maxFileSize: [{
120
+ type: Input
121
+ }], ariaLabel: [{
122
+ type: Input
123
+ }], changed: [{
124
+ type: Output
125
+ }], uploadError: [{
126
+ type: Output
127
+ }] } });
128
+ class ArkWysiwygViewerComponent {
129
+ constructor() {
130
+ this.host = inject(ElementRef);
131
+ registerTooarkWysiwyg();
132
+ }
133
+ /** O `ark-wysiwyg-viewer` que este wrapper renderiza; `null` antes da view. */
134
+ get element() {
135
+ return this.host.nativeElement.querySelector(":scope > ark-wysiwyg-viewer");
136
+ }
137
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: ArkWysiwygViewerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
138
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.26", type: ArkWysiwygViewerComponent, isStandalone: true, selector: "ark-wysiwyg-viewer-wrapper", inputs: { testid: "testid", content: "content", theme: "theme" }, ngImport: i0, template: `
139
+ <ark-wysiwyg-viewer [attr.testid]="testid" [attr.theme]="theme" [content]="content ?? null"></ark-wysiwyg-viewer>`, isInline: true }); }
140
+ }
141
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: ArkWysiwygViewerComponent, decorators: [{
142
+ type: Component,
143
+ args: [{
144
+ selector: "ark-wysiwyg-viewer-wrapper",
145
+ standalone: true,
146
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
147
+ template: `
148
+ <ark-wysiwyg-viewer [attr.testid]="testid" [attr.theme]="theme" [content]="content ?? null"></ark-wysiwyg-viewer>`
149
+ }]
150
+ }], ctorParameters: () => [], propDecorators: { testid: [{
151
+ type: Input
152
+ }], content: [{
153
+ type: Input
154
+ }], theme: [{
155
+ type: Input
156
+ }] } });
157
+
158
+ /**
159
+ * Generated bundle index. Do not edit.
160
+ */
161
+
162
+ export { ArkWysiwygEditorComponent, ArkWysiwygViewerComponent };
163
+ //# sourceMappingURL=tooark-angular-wysiwyg.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooark-angular-wysiwyg.mjs","sources":["../../wysiwyg/src/ark-wysiwyg.component.ts","../../wysiwyg/src/tooark-angular-wysiwyg.ts"],"sourcesContent":["import {\n type AfterViewInit,\n Component,\n CUSTOM_ELEMENTS_SCHEMA,\n ElementRef,\n EventEmitter,\n Input,\n inject,\n Output\n} from \"@angular/core\";\nimport type { ArkLang } from \"@tooark/core\";\nimport {\n type ArkWysiwygContent,\n type ArkWysiwygEditor as ArkWysiwygEditorElement,\n type ArkWysiwygUploadError,\n type ArkWysiwygUploader,\n type ArkWysiwygViewer as ArkWysiwygViewerElement,\n registerTooarkWysiwyg\n} from \"@tooark/wysiwyg\";\n\n// Entry point @tooark/angular/wysiwyg: fora da entrada principal para que o Tiptap (dependência do @tooark/wysiwyg) só\n// entre no app que importa este caminho.\n@Component({\n selector: \"ark-wysiwyg-editor-wrapper\",\n standalone: true,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n template: `\n <ark-wysiwyg-editor\n [attr.testid]=\"testid\"\n [attr.toolbar]=\"toolbar\"\n [attr.theme]=\"theme\"\n [attr.placeholder]=\"placeholder\"\n [attr.editable]=\"editable === false ? 'false' : null\"\n [attr.lang]=\"lang\"\n [attr.locale-json]=\"localeJsonAttr\"\n [attr.colors]=\"colors ? stringify(colors) : null\"\n [attr.highlights]=\"highlights ? stringify(highlights) : null\"\n [attr.max-file-size]=\"maxFileSize\"\n [attr.aria-label]=\"ariaLabel\"\n [uploadFile]=\"uploadFile ?? null\"\n (ark-wysiwyg-change)=\"changeHandler($event)\"\n (ark-wysiwyg-upload-error)=\"uploadErrorHandler($event)\"></ark-wysiwyg-editor>`\n})\nexport class ArkWysiwygEditorComponent implements AfterViewInit {\n constructor() {\n registerTooarkWysiwyg();\n }\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n /** O último JSON emitido ou atribuído: o getter `content` do elemento monta um objeto novo a cada leitura. */\n private known: ArkWysiwygContent | null | undefined;\n private pending: ArkWysiwygContent | null | undefined;\n\n /** O `ark-wysiwyg-editor` que este wrapper renderiza; `null` antes da view. */\n get element(): ArkWysiwygEditorElement | null {\n return this.host.nativeElement.querySelector<ArkWysiwygEditorElement>(\":scope > ark-wysiwyg-editor\");\n }\n\n @Input() testid: string | undefined;\n\n /**\n * Conteúdo como JSON do Tiptap. Atribuído só quando a referência muda e fora do histórico de desfazer: o objeto\n * que o `(changed)` entregou, repassado, não reescreve o editor nem move o cursor.\n */\n @Input()\n set content(value: ArkWysiwygContent | null | undefined) {\n if (value === undefined || value === this.known) return;\n this.known = value;\n const el = this.element;\n if (el) {\n el.content = value;\n } else {\n this.pending = value;\n }\n }\n get content(): ArkWysiwygContent | null | undefined {\n return this.known;\n }\n\n /** Gancho de upload; sem ele não há botões de mídia e arquivos colados são recusados. */\n @Input() uploadFile: ArkWysiwygUploader | null | undefined;\n @Input() toolbar: string | undefined;\n @Input() theme: \"auto\" | \"light\" | \"dark\" | undefined;\n @Input() placeholder: string | undefined;\n /** false desabilita a edição. Padrão: true. */\n @Input() editable: boolean | undefined;\n @Input() lang: ArkLang | undefined;\n /** Rótulos próprios (objeto ou JSON), por cima do idioma. */\n @Input() localeJson: string | Record<string, string> | undefined;\n @Input() colors: string[] | undefined;\n @Input() highlights: string[] | undefined;\n @Input() maxFileSize: number | undefined;\n @Input() ariaLabel: string | undefined;\n /** Cada edição, com o JSON do Tiptap em `detail`. */\n @Output() changed = new EventEmitter<CustomEvent<ArkWysiwygContent>>();\n /** Arquivo recusado ou upload que falhou, com o motivo em `detail`. */\n @Output() uploadError = new EventEmitter<CustomEvent<ArkWysiwygUploadError>>();\n\n get localeJsonAttr(): string | null {\n if (this.localeJson === undefined) return null;\n return typeof this.localeJson === \"string\" ? this.localeJson : JSON.stringify(this.localeJson);\n }\n\n ngAfterViewInit(): void {\n const el = this.element;\n if (el && this.pending !== undefined) el.content = this.pending;\n this.pending = undefined;\n }\n\n protected stringify = (value: unknown): string => JSON.stringify(value);\n\n protected changeHandler = (event: Event) => {\n this.known = (event as CustomEvent<ArkWysiwygContent>).detail;\n this.changed.emit(event as CustomEvent<ArkWysiwygContent>);\n };\n protected uploadErrorHandler = (event: Event) => this.uploadError.emit(event as CustomEvent<ArkWysiwygUploadError>);\n}\n\n@Component({\n selector: \"ark-wysiwyg-viewer-wrapper\",\n standalone: true,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n template: `\n <ark-wysiwyg-viewer [attr.testid]=\"testid\" [attr.theme]=\"theme\" [content]=\"content ?? null\"></ark-wysiwyg-viewer>`\n})\nexport class ArkWysiwygViewerComponent {\n constructor() {\n registerTooarkWysiwyg();\n }\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** O `ark-wysiwyg-viewer` que este wrapper renderiza; `null` antes da view. */\n get element(): ArkWysiwygViewerElement | null {\n return this.host.nativeElement.querySelector<ArkWysiwygViewerElement>(\":scope > ark-wysiwyg-viewer\");\n }\n\n @Input() testid: string | undefined;\n /** Conteúdo como JSON do Tiptap, sanitizado ao entrar. */\n @Input() content: ArkWysiwygContent | null | undefined;\n @Input() theme: \"auto\" | \"light\" | \"dark\" | undefined;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAoBA;AACA;MAsBa,yBAAyB,CAAA;AACpC,IAAA,WAAA,GAAA;AAIiB,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAA0B,UAAU,CAAC;;AA8CzD,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,YAAY,EAAkC;;AAE5D,QAAA,IAAA,CAAA,WAAW,GAAG,IAAI,YAAY,EAAsC;AAapE,QAAA,IAAA,CAAA,SAAS,GA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