@nanahoshi/mona-ui 0.25.1 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/README.md +2 -0
  2. package/command/package.json +4 -0
  3. package/docs/auto-complete.md +733 -0
  4. package/docs/avatar.md +220 -0
  5. package/docs/breadcrumb.md +320 -0
  6. package/docs/button-group.md +392 -0
  7. package/docs/button.md +256 -0
  8. package/docs/calendar.md +515 -0
  9. package/docs/card.md +292 -0
  10. package/docs/chart.md +4058 -0
  11. package/docs/checkbox.md +374 -0
  12. package/docs/chip.md +339 -0
  13. package/docs/circular-progress-bar.md +287 -0
  14. package/docs/collapsible.md +308 -0
  15. package/docs/color-gradient.md +336 -0
  16. package/docs/color-palette.md +317 -0
  17. package/docs/color-picker.md +387 -0
  18. package/docs/combo-box.md +764 -0
  19. package/docs/command.md +582 -0
  20. package/docs/contextmenu.md +530 -0
  21. package/docs/date-picker.md +251 -0
  22. package/docs/datetime-picker.md +284 -0
  23. package/docs/decimal-textbox.md +260 -0
  24. package/docs/dialog.md +822 -0
  25. package/docs/dropdown-button.md +507 -0
  26. package/docs/dropdown-list.md +779 -0
  27. package/docs/editor.md +374 -0
  28. package/docs/expansion-panel.md +348 -0
  29. package/docs/fieldset.md +217 -0
  30. package/docs/forms.md +162 -0
  31. package/docs/grid.md +2053 -0
  32. package/docs/input.md +197 -0
  33. package/docs/installation.md +54 -0
  34. package/docs/introduction.md +46 -0
  35. package/docs/label.md +340 -0
  36. package/docs/list-box.md +637 -0
  37. package/docs/list-view.md +584 -0
  38. package/docs/menubar.md +559 -0
  39. package/docs/multi-select.md +765 -0
  40. package/docs/notification.md +460 -0
  41. package/docs/numeric-textbox.md +301 -0
  42. package/docs/otp-input.md +539 -0
  43. package/docs/pager.md +513 -0
  44. package/docs/placeholder.md +176 -0
  45. package/docs/popover.md +423 -0
  46. package/docs/popup-menu.md +658 -0
  47. package/docs/popup.md +617 -0
  48. package/docs/progress-bar.md +368 -0
  49. package/docs/radio-button.md +451 -0
  50. package/docs/range-slider.md +367 -0
  51. package/docs/rating.md +518 -0
  52. package/docs/scroll-view.md +375 -0
  53. package/docs/segmented.md +434 -0
  54. package/docs/sheet.md +348 -0
  55. package/docs/sidebar.md +1126 -0
  56. package/docs/skeleton.md +181 -0
  57. package/docs/slider.md +423 -0
  58. package/docs/spinner.md +370 -0
  59. package/docs/split-button.md +522 -0
  60. package/docs/splitter.md +342 -0
  61. package/docs/stepper.md +539 -0
  62. package/docs/switch.md +340 -0
  63. package/docs/tabs.md +542 -0
  64. package/docs/textarea.md +196 -0
  65. package/docs/textbox.md +332 -0
  66. package/docs/theming.md +403 -0
  67. package/docs/time-picker.md +254 -0
  68. package/docs/tooltip-directive.md +340 -0
  69. package/docs/tooltip.md +321 -0
  70. package/docs/tree-view.md +1018 -0
  71. package/docs/window.md +663 -0
  72. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
  73. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +8 -0
  74. package/fesm2022/nanahoshi-mona-ui-button.mjs +12 -0
  75. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
  76. package/fesm2022/nanahoshi-mona-ui-chart.mjs +86 -0
  77. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
  78. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
  79. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
  80. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
  81. package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
  82. package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
  83. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
  84. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
  85. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
  86. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
  87. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
  88. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
  89. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
  90. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
  91. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
  92. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
  93. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
  94. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
  95. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
  96. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
  97. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  98. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
  99. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
  100. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
  101. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
  102. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
  103. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
  104. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
  105. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
  106. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
  107. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
  108. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
  109. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
  110. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
  111. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
  112. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
  113. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
  114. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
  115. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
  116. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
  117. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
  118. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
  119. package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
  120. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
  121. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
  122. package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
  123. package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
  124. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
  125. package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
  126. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
  127. package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
  128. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +1 -0
  129. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
  130. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
  131. package/fesm2022/nanahoshi-mona-ui-slider.mjs +7 -2
  132. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +9 -6
  133. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
  134. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
  135. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
  136. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
  137. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
  138. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
  139. package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
  140. package/i18n/catalogs/en-US.messages.json +10 -0
  141. package/internal/popup-menu/package.json +4 -0
  142. package/llms.txt +123 -0
  143. package/locales/ar-sa/ar-sa.messages.json +10 -0
  144. package/locales/de-de/de-de.messages.json +10 -0
  145. package/locales/es-es/es-es.messages.json +10 -0
  146. package/locales/fr-fr/fr-fr.messages.json +10 -0
  147. package/locales/id-id/id-id.messages.json +10 -0
  148. package/locales/it-it/it-it.messages.json +10 -0
  149. package/locales/ja-jp/ja-jp.messages.json +10 -0
  150. package/locales/ko-kr/ko-kr.messages.json +10 -0
  151. package/locales/pt-br/pt-br.messages.json +10 -0
  152. package/locales/ru-ru/ru-ru.messages.json +10 -0
  153. package/locales/tr-tr/tr-tr.messages.json +10 -0
  154. package/locales/zh-cn/zh-cn.messages.json +10 -0
  155. package/locales/zh-tw/zh-tw.messages.json +10 -0
  156. package/package.json +9 -1
  157. package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
  158. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
  159. package/types/nanahoshi-mona-ui-button.d.ts +12 -0
  160. package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
  161. package/types/nanahoshi-mona-ui-chart.d.ts +200 -0
  162. package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
  163. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
  164. package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
  165. package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
  166. package/types/nanahoshi-mona-ui-command.d.ts +253 -0
  167. package/types/nanahoshi-mona-ui-common.d.ts +17 -1
  168. package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
  169. package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
  170. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
  171. package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
  172. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
  173. package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
  174. package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
  175. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
  176. package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
  177. package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
  178. package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
  179. package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
  180. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
  181. package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
  182. package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
  183. package/types/nanahoshi-mona-ui-label.d.ts +1 -0
  184. package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
  185. package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
  186. package/types/nanahoshi-mona-ui-list.d.ts +1 -1
  187. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
  188. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
  189. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
  190. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
  191. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
  192. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
  193. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
  194. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
  195. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
  196. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
  197. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
  198. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
  199. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
  200. package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
  201. package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
  202. package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
  203. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
  204. package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
  205. package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
  206. package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
  207. package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
  208. package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
  209. package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
  210. package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
  211. package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
  212. package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
  213. package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
  214. package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
  215. package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
  216. package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
  217. package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
  218. package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
  219. package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
  220. package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
  221. package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
  222. package/types/nanahoshi-mona-ui-window.d.ts +66 -1
package/docs/editor.md ADDED
@@ -0,0 +1,374 @@
1
+ # Editor
2
+
3
+ > A rich text editor with a configurable toolbar and an HTML value.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/editor`
6
+
7
+ **Selector:** `mona-editor`
8
+
9
+ Editor is a rich text editor with a configurable toolbar. Its value is HTML, and it works with `[(value)]` and signal forms through `[formField]`.
10
+
11
+ Give it a name with a `<label>` and `aria-labelledby`, or with `aria-label`. A placeholder is not a name.
12
+
13
+ ## Overview
14
+
15
+ Use Editor when people write formatted text: headings, lists, links, images and tables. For plain text, use `mona-text-area`.
16
+
17
+ `@nanahoshi/mona-ui/editor` exports `EditorComponent`, the `EDITOR_DEFAULT_MESSAGES` catalog, and the `ContentChangeEvent` and `EditorSettings` types.
18
+
19
+ ## Import & Quick Start
20
+
21
+ ```typescript
22
+ import { EditorComponent } from "@nanahoshi/mona-ui/editor";
23
+ import type { ContentChangeEvent, EditorSettings } from "@nanahoshi/mona-ui/editor";
24
+ ```
25
+
26
+ ```html
27
+ <label id="notes-label">Notes</label>
28
+ <mona-editor aria-labelledby="notes-label" placeholder="Write a note" [(value)]="notes" />
29
+ ```
30
+
31
+ ## Examples
32
+
33
+ ### Two-way value
34
+
35
+ `[(value)]` holds the content as HTML. An empty editor has the value `""`.
36
+
37
+ `basic-example.component.ts`
38
+
39
+ ```typescript
40
+ import { Component, signal } from "@angular/core";
41
+ import { EditorComponent } from "@nanahoshi/mona-ui/editor";
42
+
43
+ @Component({
44
+ selector: "app-editor-basic-example",
45
+ imports: [EditorComponent],
46
+ templateUrl: "./basic-example.component.html"
47
+ })
48
+ export class EditorBasicExampleComponent {
49
+ protected readonly notes = signal("<h2>Release notes</h2><p>The editor now keeps <strong>bold</strong> and <em>italic</em> text.</p>");
50
+ }
51
+ ```
52
+
53
+ `basic-example.component.html`
54
+
55
+ ```html
56
+ <div class="flex flex-col gap-2">
57
+ <label id="editor-basic-label" class="text-sm font-medium">Notes</label>
58
+ <mona-editor aria-labelledby="editor-basic-label" class="h-72 w-full" placeholder="Write a note" [(value)]="notes" />
59
+ <details>
60
+ <summary>HTML value</summary>
61
+ <pre class="whitespace-pre-wrap text-xs">{{ notes() }}</pre>
62
+ </details>
63
+ </div>
64
+ ```
65
+
66
+ ### A smaller toolbar
67
+
68
+ Every tool is on by default. Pass only what you want to change in `settings`.
69
+
70
+ `toolbar-example.component.ts`
71
+
72
+ ```typescript
73
+ import { Component, signal } from "@angular/core";
74
+ import { EditorComponent, type EditorSettings } from "@nanahoshi/mona-ui/editor";
75
+
76
+ @Component({
77
+ selector: "app-editor-toolbar-example",
78
+ imports: [EditorComponent],
79
+ templateUrl: "./toolbar-example.component.html"
80
+ })
81
+ export class EditorToolbarExampleComponent {
82
+ protected readonly comment = signal("");
83
+ protected readonly settings: Partial<EditorSettings> = {
84
+ alignment: false,
85
+ fontColor: false,
86
+ fontFamily: false,
87
+ fontHighlight: false,
88
+ fontSize: false,
89
+ headings: false,
90
+ horizontalRule: false,
91
+ image: false,
92
+ indent: false,
93
+ subscript: false,
94
+ superscript: false,
95
+ table: false
96
+ };
97
+ }
98
+ ```
99
+
100
+ `toolbar-example.component.html`
101
+
102
+ ```html
103
+ <mona-editor
104
+ aria-label="Comment"
105
+ class="h-48 w-full"
106
+ placeholder="Leave a comment"
107
+ [settings]="settings"
108
+ [(value)]="comment" />
109
+ ```
110
+
111
+ ### Forms
112
+
113
+ Bound with `[formField]`, the editor gets `disabled`, `invalid`, `readonly`, `required` and `touched` from the form. Link the error message with `aria-describedby`.
114
+
115
+ `forms-example.component.ts`
116
+
117
+ ```typescript
118
+ import { Component, signal } from "@angular/core";
119
+ import { form, FormField, required } from "@angular/forms/signals";
120
+ import { EditorComponent } from "@nanahoshi/mona-ui/editor";
121
+
122
+ @Component({
123
+ selector: "app-editor-forms-example",
124
+ imports: [EditorComponent, FormField],
125
+ templateUrl: "./forms-example.component.html"
126
+ })
127
+ export class EditorFormsExampleComponent {
128
+ readonly #model = signal({ description: "" });
129
+ protected readonly issue = form(this.#model, path => {
130
+ required(path.description);
131
+ });
132
+ }
133
+ ```
134
+
135
+ `forms-example.component.html`
136
+
137
+ ```html
138
+ <div class="flex flex-col gap-2">
139
+ <label id="editor-forms-label" class="text-sm font-medium">Issue description</label>
140
+ <mona-editor
141
+ aria-describedby="editor-forms-error"
142
+ aria-labelledby="editor-forms-label"
143
+ class="h-56 w-full"
144
+ [formField]="issue.description"
145
+ [settings]="{ image: false, table: false }" />
146
+ <p id="editor-forms-error" class="text-error text-sm" role="alert">
147
+ @if (issue.description().touched() && issue.description().invalid()) {
148
+ Describe the issue.
149
+ }
150
+ </p>
151
+ </div>
152
+ ```
153
+
154
+ ## Behavior
155
+
156
+ - The form inputs (`disabled`, `invalid`, `readonly`, `required`, `touched`) are set by the form when the editor is bound with `[formField]`.
157
+ - The editor is created in the browser after the first render, so `html` and `json` have no content on the server. Wait for `create` before reading them at startup.
158
+
159
+ ### Toolbar Settings
160
+
161
+ Every tool is on by default. Pass only what you want to change, as in the toolbar example.
162
+
163
+ `alignment`, `blockquote`, `bold`, `code`, `fontColor`, `fontFamily`, `fontHighlight`, `fontSize`, `headings`, `history`, `horizontalRule`, `image`, `indent`, `italic`, `link`, `list`, `strikethrough`, `subscript`, `superscript`, `table`, `taskList` and `underline` are booleans. `code: false` also turns off the code block.
164
+
165
+ | Setting | Type | Default | Description |
166
+ | :------------- | :----------------- | :------ | :--------------------------------------------------------------------------------------------------------------------- |
167
+ | `fontList` | `Iterable<string>` | `[]` | The fonts the font family dropdown offers. |
168
+ | `fontSizeList` | `Iterable<string>` | `[]` | The sizes the font size dropdown offers, as CSS lengths such as `"14px"` or `"1.25rem"`. Empty keeps the default list. |
169
+
170
+ If you remove a tool, content that used it stays as text.
171
+
172
+ The text color and highlight pickers show the color of the selection. They show none when the selected text has no color or several, so any color you pick applies to all of it.
173
+
174
+ ### Content and Safety
175
+
176
+ The editor reads HTML through its schema, so tags and attributes it doesn't know are dropped. Links typed in the link dialog keep `http:`, `https:`, `mailto:`, `tel:` and relative URLs, get `https://` when they are a bare host, and are refused with any other scheme, such as `javascript:`.
177
+
178
+ These checks protect the editor, not your application. The value is user-written HTML: sanitize it on the server before you store it, and again before you render it anywhere else.
179
+
180
+ ### Localization and Direction
181
+
182
+ Toolbar labels and the default content name come from the `editor` messages (`EDITOR_DEFAULT_MESSAGES`), and follow the library locale. In right-to-left, the toolbar order mirrors and start and end alignment follow the direction.
183
+
184
+ ## Accessibility
185
+
186
+ The content has `role="textbox"` with `aria-multiline`, its name, and `aria-disabled`, `aria-readonly`, `aria-required` and `aria-invalid` when they apply. Link an error message or hint with `aria-describedby`. The toolbar is named and its toggle buttons report `aria-pressed`.
187
+
188
+ ### Keyboard Navigation
189
+
190
+ The toolbar is one Tab stop.
191
+
192
+ | Key | Where | Action |
193
+ | :-------------------------- | :----------------------- | :--------------------------------------------------------------- |
194
+ | `Tab` | Toolbar | Moves into the content. |
195
+ | `ArrowRight` / `ArrowLeft` | Toolbar | Moves between tools. They follow the direction in right-to-left. |
196
+ | `Home` / `End` | Toolbar | Moves to the first or last tool. |
197
+ | `Tab` / `Shift` + `Tab` | List in the content | Nests or lifts the list item. |
198
+ | `Tab` | Elsewhere in the content | Leaves the editor. |
199
+ | `Ctrl` + `]` / `Ctrl` + `[` | Content | Indents or outdents. Use `Cmd` on macOS. |
200
+ | `Escape`, then `Tab` | List in the content | Leaves the editor, so the keyboard isn't stuck in a long list. |
201
+
202
+ ## API
203
+
204
+ Everything below is imported from `@nanahoshi/mona-ui/editor`.
205
+
206
+ ### `EditorComponent`
207
+
208
+ **Selector:** `mona-editor`
209
+ **Implements:** `FormValueControl<string>`
210
+
211
+ #### Inputs
212
+
213
+ | Name | Type | Default | Description |
214
+ | --- | --- | --- | --- |
215
+ | `aria-describedby` | `string` | `""` | The id of an element that describes the content, such as a hint or an error message. |
216
+ | `aria-label` | `string` | `""` | The accessible name of the content. Without it or `aria-labelledby`, the content is named "Rich text editor" (translated). |
217
+ | `aria-labelledby` | `string` | `""` | The id of a visible label for the content, such as a `<label>` next to the editor. |
218
+ | `class` | `string` | `""` | CSS classes applied to the host element. |
219
+ | `content` | `string \| JSONContent` | — | **Deprecated.** Use `value` (HTML), or `[formField]` with a signal form. To read the JSON, use the `update` event or the `json` property. The initial content of the editor, as HTML or a `JSONContent` document. A later change replaces the document, unless it is the content the editor already has. |
220
+ | `disabled` | `boolean` | `false` | Disables the editor: the content can't be edited or focused for editing, and the toolbar is inert. When bound to a signal form field via `[formField]`, the form sets it. |
221
+ | `invalid` | `boolean` | `false` | Marks the editor as invalid once it has been touched. When bound to a signal form field via `[formField]`, the form sets it. |
222
+ | `placeholder` | `string` | `""` | Text shown in the empty editor, and given to assistive technology as `aria-placeholder`. It is not a name: use a label or `aria-label` too. |
223
+ | `readonly` | `boolean` | `false` | Makes the content read-only and hides the toolbar. When bound to a signal form field via `[formField]`, the form sets it. |
224
+ | `required` | `boolean` | `false` | Marks the editor as required: once touched, an empty editor is invalid. |
225
+ | `settings` | `Partial<EditorSettings>` | — | The settings of the editor. Changing them rebuilds the editor and keeps its document. |
226
+ | `touched` | `boolean` | `false` | Sets the touched state. When bound to a signal form field via `[formField]`, the form sets it. |
227
+ | `value` (two-way) | `string` | `""` | The content of the editor as HTML. An empty editor has the value `""`. Use `[(value)]`, or `[formField]` with a signal form. |
228
+
229
+ #### Outputs
230
+
231
+ | Name | Type | Description |
232
+ | --- | --- | --- |
233
+ | `blur` | `void` | **Deprecated.** Use `editorBlur`. Emits when the editor loses focus. |
234
+ | `create` | `void` | Emits when the editor is created and ready to be used, and again when it is rebuilt for new `settings`. |
235
+ | `editorBlur` | `void` | Emits when the editor loses focus. |
236
+ | `editorFocus` | `void` | Emits when the editor gains focus. |
237
+ | `selectionUpdate` | `void` | Emits when the selection of the editor changes. |
238
+ | `touch` | `void` | Emits when the editor loses focus. Form directives (`[formField]`, `ngModel`, `formControl`) listen to this to mark the field as touched. |
239
+ | `update` | `ContentChangeEvent` | Emits when the user changes the content. It isn't emitted when `value` or `content` is set from outside. |
240
+ | `valueChange` | `string` | Emitted when `value` changes. |
241
+
242
+ #### Properties
243
+
244
+ | Name | Type | Description |
245
+ | --- | --- | --- |
246
+ | `html` (read-only) | `string` | Returns the HTML content of the editor, or `""` before the editor is created. It can be used to save the content of the editor in a database and restore it later. |
247
+ | `json` (read-only) | `JSONContent` | Returns the JSON content of the editor in the `JSONContent` format, or an empty document before the editor is created. It can be used to save the content of the editor in a database and restore it later. |
248
+
249
+ #### Methods
250
+
251
+ | Signature | Description |
252
+ | --- | --- |
253
+ | `focus(options?: FocusOptions): void` | Moves focus into the editor, keeping the selection it had. |
254
+
255
+ ### Types
256
+
257
+ #### `EDITOR_DEFAULT_MESSAGES`
258
+
259
+ ```typescript
260
+ const EDITOR_DEFAULT_MESSAGES: MonaEditorMessages;
261
+ ```
262
+
263
+ #### `ContentChangeEvent`
264
+
265
+ The content of the editor after a user change, emitted by `EditorComponent.update`.
266
+
267
+ | Name | Type | Description |
268
+ | --- | --- | --- |
269
+ | `html` | `string` | The content as HTML, the same as the editor's `html` property. |
270
+ | `json` | `JSONContent` | The content as a `JSONContent` document, the same as the editor's `json` property. |
271
+
272
+ #### `EditorSettings`
273
+
274
+ The features of an editor. Every feature is on unless it is set to `false`. Turning one off removes its toolbar
275
+ control, and the editor no longer keeps that kind of content.
276
+
277
+ | Name | Type | Description |
278
+ | --- | --- | --- |
279
+ | `alignment` | `boolean` | Whether the toolbar shows the text alignment buttons and the editor keeps paragraph and heading alignment. |
280
+ | `blockquote` | `boolean` | Whether the toolbar shows the block quote button and the editor keeps block quotes. |
281
+ | `bold` | `boolean` | Whether the toolbar shows the bold button and the editor keeps bold text. |
282
+ | `code` | `boolean` | Whether the toolbar shows the code block button and the editor keeps code blocks and inline code. |
283
+ | `fontColor` | `boolean` | Whether the toolbar shows the text color picker and the editor keeps text colors. |
284
+ | `fontFamily` | `boolean` | Whether the toolbar shows the font family dropdown and the editor keeps font families. |
285
+ | `fontHighlight` | `boolean` | Whether the toolbar shows the highlight color picker and the editor keeps highlighted text. |
286
+ | `fontList` | `Iterable<string>` | The fonts the font family dropdown offers, as CSS font family names. Empty keeps the default list. |
287
+ | `fontSize` | `boolean` | Whether the toolbar shows the font size dropdown and the editor keeps font sizes. |
288
+ | `fontSizeList` | `Iterable<string>` | The font sizes the font size dropdown offers, as CSS lengths (`"14px"`, `"1.25rem"`). Empty keeps the default list. |
289
+ | `headings` | `boolean` | Whether the toolbar shows the format dropdown and the editor keeps headings. |
290
+ | `history` | `boolean` | Whether the toolbar shows the undo and redo buttons and the editor keeps an undo history. |
291
+ | `horizontalRule` | `boolean` | Whether the toolbar shows the horizontal line button and the editor keeps horizontal lines. |
292
+ | `image` | `boolean` | Whether the toolbar shows the insert image button and the editor keeps images. |
293
+ | `indent` | `boolean` | Whether the toolbar shows the indent and outdent buttons and the editor keeps indentation. |
294
+ | `italic` | `boolean` | Whether the toolbar shows the italic button and the editor keeps italic text. |
295
+ | `link` | `boolean` | Whether the toolbar shows the link buttons and the editor keeps links, turning typed URLs into links. |
296
+ | `list` | `boolean` | Whether the toolbar shows the numbered and bulleted list buttons and the editor keeps those lists. |
297
+ | `strikethrough` | `boolean` | Whether the toolbar shows the strikethrough button and the editor keeps struck-through text. |
298
+ | `subscript` | `boolean` | Whether the toolbar shows the subscript button and the editor keeps subscript text. |
299
+ | `superscript` | `boolean` | Whether the toolbar shows the superscript button and the editor keeps superscript text. |
300
+ | `table` | `boolean` | Whether the toolbar shows the table buttons and the editor keeps tables. |
301
+ | `taskList` | `boolean` | Whether the toolbar shows the task list button and the editor keeps task lists. |
302
+ | `underline` | `boolean` | Whether the toolbar shows the underline button and the editor keeps underlined text. |
303
+
304
+ #### `MonaEditorMessages`
305
+
306
+ From `@nanahoshi/mona-ui/i18n`.
307
+
308
+ | Name | Type | Description |
309
+ | --- | --- | --- |
310
+ | `addColumnAfter` (read-only) | `string` | The label of the toolbar button that adds a column after the current one. |
311
+ | `addColumnBefore` (read-only) | `string` | The label of the toolbar button that adds a column before the current one. |
312
+ | `addHorizontalLine` (read-only) | `string` | The label of the toolbar button that inserts a horizontal line. |
313
+ | `addRowAfter` (read-only) | `string` | The label of the toolbar button that adds a row after the current one. |
314
+ | `addRowBefore` (read-only) | `string` | The label of the toolbar button that adds a row before the current one. |
315
+ | `alignCenter` (read-only) | `string` | The label of the toolbar button that centers the text. |
316
+ | `alignEnd` (read-only) | `string` | The label of the toolbar button that aligns the text to the end of the line. |
317
+ | `alignLeft` (read-only) | `string` | **Deprecated.** No longer rendered: the toolbar aligns to the start and end with `alignStart` and `alignEnd`. |
318
+ | `alignmentGroup` (read-only) | `string` | The accessible name of the toolbar's text alignment button group. |
319
+ | `alignRight` (read-only) | `string` | **Deprecated.** No longer rendered: the toolbar aligns to the start and end with `alignStart` and `alignEnd`. |
320
+ | `alignStart` (read-only) | `string` | The label of the toolbar button that aligns the text to the start of the line. |
321
+ | `altText` (read-only) | `string` | The label of the alternative text field in the insert image form. |
322
+ | `apply` (read-only) | `string` | The label of the link dialog's button that sets the link. |
323
+ | `backgroundColor` (read-only) | `string` | The label of the toolbar color picker that sets the text's highlight color. |
324
+ | `bold` (read-only) | `string` | The label of the toolbar button that toggles bold. |
325
+ | `cancel` (read-only) | `string` | The label of the Cancel button in the link dialog and the insert image form. |
326
+ | `codeBlock` (read-only) | `string` | The label of the toolbar button that toggles a code block. |
327
+ | `color` (read-only) | `string` | The label of the toolbar color picker that sets the text color. |
328
+ | `contentLabel` (read-only) | `string` | The accessible name of the editable content when the editor has no `aria-label` or `aria-labelledby`. |
329
+ | `defaultFontFamily` (read-only) | `string` | The placeholder of the font family dropdown when the text uses no specific font. |
330
+ | `deleteColumn` (read-only) | `string` | The label of the toolbar button that deletes the current column. |
331
+ | `deleteRow` (read-only) | `string` | The label of the toolbar button that deletes the current row. |
332
+ | `deleteTable` (read-only) | `string` | The label of the toolbar button that deletes the table. |
333
+ | `editLink` (read-only) | `string` | The title of the link dialog when the selection is already in a link. |
334
+ | `enterUrl` (read-only) | `string` | The label of the URL field in the link dialog. |
335
+ | `fontSize` (read-only) | `string` | The placeholder of the font size dropdown when the text has no specific size. |
336
+ | `format` (read-only) | `string` | The label of the toolbar dropdown that switches between paragraph and heading levels. |
337
+ | `heading` (read-only) | `(level: number) => string` | The text of a heading level in the format dropdown, given the level number. |
338
+ | `heightPx` (read-only) | `string` | The label of the height field in the insert image form. |
339
+ | `historyGroup` (read-only) | `string` | The accessible name of the toolbar's undo and redo button group. |
340
+ | `imageUrl` (read-only) | `string` | The label of the image URL field in the insert image form. |
341
+ | `indent` (read-only) | `string` | The label of the toolbar button that increases the indentation. |
342
+ | `indentGroup` (read-only) | `string` | The accessible name of the toolbar's indent and outdent button group. |
343
+ | `insert` (read-only) | `string` | The label of the insert image form's button that inserts the image. |
344
+ | `insertImage` (read-only) | `string` | The label of the toolbar button that opens the insert image form, and the title of that form's window. |
345
+ | `insertLink` (read-only) | `string` | The label of the toolbar button that opens the link dialog, and the dialog's title for a new link. |
346
+ | `insertOrderedList` (read-only) | `string` | The label of the toolbar button that toggles a numbered list. |
347
+ | `insertTable` (read-only) | `string` | The label of the toolbar button that opens the table size grid, and the accessible name of that grid. |
348
+ | `insertTaskList` (read-only) | `string` | The label of the toolbar button that toggles a task list. |
349
+ | `insertUnorderedList` (read-only) | `string` | The label of the toolbar button that toggles a bulleted list. |
350
+ | `invalidUrl` (read-only) | `string` | The error shown in the link dialog when the URL isn't a valid link. |
351
+ | `italic` (read-only) | `string` | The label of the toolbar button that toggles italic. |
352
+ | `justify` (read-only) | `string` | The label of the toolbar button that justifies the text. |
353
+ | `linkGroup` (read-only) | `string` | The accessible name of the toolbar's link button group. |
354
+ | `listGroup` (read-only) | `string` | The accessible name of the toolbar's list button group. |
355
+ | `mergeCells` (read-only) | `string` | The label of the toolbar button that merges the selected cells. |
356
+ | `outdent` (read-only) | `string` | The label of the toolbar button that decreases the indentation. |
357
+ | `paragraph` (read-only) | `string` | The text of the plain paragraph option in the format dropdown. |
358
+ | `quotation` (read-only) | `string` | The label of the toolbar button that toggles a block quote. |
359
+ | `redo` (read-only) | `string` | The label of the toolbar button that redoes the last undone change. |
360
+ | `removeLink` (read-only) | `string` | The label of the toolbar button and the link dialog button that remove the link. |
361
+ | `selectFontFamily` (read-only) | `string` | The label of the toolbar's font family dropdown. |
362
+ | `selectFontSize` (read-only) | `string` | The label of the toolbar's font size dropdown. |
363
+ | `splitCell` (read-only) | `string` | The label of the toolbar button that splits a merged cell. |
364
+ | `strikethrough` (read-only) | `string` | The label of the toolbar button that toggles strikethrough. |
365
+ | `subscript` (read-only) | `string` | The label of the toolbar button that toggles subscript. |
366
+ | `superscript` (read-only) | `string` | The label of the toolbar button that toggles superscript. |
367
+ | `tableGroup` (read-only) | `string` | The accessible name of the toolbar's table button group. |
368
+ | `tableSize` (read-only) | `(rows: number, columns: number) => string` | Describes a table size in the table size grid, given the number of rows and columns. It names each grid cell and announces the highlighted size. |
369
+ | `textStyleGroup` (read-only) | `string` | The accessible name of the toolbar's bold, italic and other text style button group. |
370
+ | `toggleHeaderRow` (read-only) | `string` | The label of the toolbar button that turns the header row on or off. |
371
+ | `toolbar` (read-only) | `string` | The accessible name of the editor's toolbar. |
372
+ | `underline` (read-only) | `string` | The label of the toolbar button that toggles underline. |
373
+ | `undo` (read-only) | `string` | The label of the toolbar button that undoes the last change. |
374
+ | `widthPx` (read-only) | `string` | The label of the width field in the insert image form. |