@xui/rich-text-editor 2.0.0-alpha.11 → 2.0.0-alpha.12

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
@@ -1,89 +1,103 @@
1
- <p style="font-size: 5rem; font-weight: 700; text-align: center">
2
- <span style="color: #1f75cb">x</span>UI
1
+ <h1 align="center">xUI</h1>
2
+
3
+ <p align="center">
4
+ <strong>90 Angular components, one npm package each, themed from a single token layer.</strong>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://xuijs.org">Documentation</a> ·
9
+ <a href="https://develop--67d2b4c756077a325913e5d9.chromatic.com/?globals=theme:dark">Storybook</a> ·
10
+ <a href="https://stackblitz.com/fork/xui">StackBlitz</a> ·
11
+ <a href="#components">Components</a>
12
+ </p>
13
+
14
+ <p align="center">
15
+ <a href="https://github.com/rikarin/xui/actions/workflows/release.yml"><img src="https://github.com/rikarin/xui/actions/workflows/release.yml/badge.svg?branch=master" alt="Build status" /></a>
16
+ <a href="https://www.npmjs.com/package/@xui/core"><img src="https://img.shields.io/npm/v/%40xui/core.svg" alt="npm version" /></a>
17
+ <a href="https://www.npmjs.com/org/xui"><img src="https://img.shields.io/npm/dm/%40xui/core.svg" alt="Downloads" /></a>
18
+ <a href="https://app.netlify.com/sites/xui/deploys"><img src="https://api.netlify.com/api/v1/badges/fa0cfd14-97df-47fa-8a7c-152e6d4cfda2/deploy-status" alt="Netlify status" /></a>
3
19
  </p>
4
20
 
5
21
  ---
6
22
 
7
- ![Build Status](https://github.com/rikarin/xui/actions/workflows/publish.yaml/badge.svg?branch=develop)
8
- [![Demo](https://img.shields.io/badge/demo-online-ed1c46)](https://xuijs.org/)
9
- [![npm](https://img.shields.io/npm/v/%40xui/core.svg?maxAge=2592000?style=plastic)](https://www.npmjs.com/org/xui)
10
- [![License](https://img.shields.io/npm/l/express.svg?maxAge=2592000)](/LICENSE)
11
- [![Netlify Status](https://api.netlify.com/api/v1/badges/fa0cfd14-97df-47fa-8a7c-152e6d4cfda2/deploy-status)](https://app.netlify.com/sites/xui/deploys)
23
+ xUI is an Angular 22 component library styled with Tailwind CSS 4. You compose it from directives and
24
+ standalone components rather than configuring one monolith, and the set goes well past the
25
+ primitives: data tables, dock managers, omnibars, node graphs and date ranges are packages here, not
26
+ things you are left to build.
12
27
 
13
- xUI is a customizable Angular 22 UI Library with full support of TailwindCSS styling based on popular React library ShardCN and its Angular alternative SpartanUI.
28
+ ```ts
29
+ import { XuiButtonImports } from '@xui/button';
30
+
31
+ @Component({
32
+ imports: [XuiButtonImports],
33
+ template: `<button xuiButton color="primary">Save changes</button>`
34
+ })
35
+ export class Example {}
36
+ ```
14
37
 
15
38
  ## Features
16
39
 
17
- - **35+ High-Quality Angular Components:** Ready to use out of the box.
18
- - **Powerful Theme Customization:** Detailed customization options with default themes.
19
- - **High Performance:** Supports Zoneless, OnPush mode, and Signals for optimized performance.
20
- - **Accessibility:** Supports WCAG 2.0 standards.
21
- - **Powerful Theme Customization:** Install each visual component and customize it according your needs
22
- - **TypeScript:** Written with predictable static types.
23
-
24
- ## Table of Contents
25
-
26
- - [Storybook](https://develop--67d2b4c756077a325913e5d9.chromatic.com/?globals=theme:dark)
27
- - [StackBlitz Demo](https://stackblitz.com/fork/xui)
28
- - [Documentation](https://xuijs.org)
29
- - [Live Demo](https://cord.dj/r)
30
- - [Packages](#packages)
31
- - [Installation](#installation)
32
- - [Browser Support](#browser-support)
33
- - [Development](#development)
34
- - [Issues](#issues)
35
- - [Roadmap](#roadmap)
36
-
37
- ## Packages
38
-
39
- | Package | Usage | Description |
40
- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
41
- | Core | [![Downloads](https://img.shields.io/npm/dt/%40xui/core.svg)](https://www.npmjs.com/package/%40xui/core)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/core.svg)](https://www.npmjs.com/package/%40xui/core)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/core)](https://bundlephobia.com/result?p=%40xui/core) | Core package required by all other packages |
42
- | Badge | [![Downloads](https://img.shields.io/npm/dt/%40xui/badge.svg)](https://www.npmjs.com/package/%40xui/badge)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/badge.svg)](https://www.npmjs.com/package/%40xui/badge)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/badge)](https://bundlephobia.com/result?p=%40xui/badge) | Badge component |
43
- | Breadcrumb | [![Downloads](https://img.shields.io/npm/dt/%40xui/breadcrumb.svg)](https://www.npmjs.com/package/%40xui/breadcrumb)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/breadcrumb.svg)](https://www.npmjs.com/package/%40xui/breadcrumb)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/breadcrumb)](https://bundlephobia.com/result?p=%40xui/breadcrumb) | Breadcrumb component |
44
- | Button | [![Downloads](https://img.shields.io/npm/dt/%40xui/button.svg)](https://www.npmjs.com/package/%40xui/button)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/button.svg)](https://www.npmjs.com/package/%40xui/button)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/button)](https://bundlephobia.com/result?p=%40xui/button) | Button component |
45
- | Button Group | [![Downloads](https://img.shields.io/npm/dt/%40xui/button-group.svg)](https://www.npmjs.com/package/%40xui/button-group)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/button-group.svg)](https://www.npmjs.com/package/%40xui/button-group)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/button-group)](https://bundlephobia.com/result?p=%40xui/button-group) | Button Group component |
46
- | Checkbox | [![Downloads](https://img.shields.io/npm/dt/%40xui/checkbox.svg)](https://www.npmjs.com/package/%40xui/checkbox)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/checkbox.svg)](https://www.npmjs.com/package/%40xui/checkbox)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/checkbox)](https://bundlephobia.com/result?p=%40xui/checkbox) | Checkbox component |
47
- | Form Field | [![Downloads](https://img.shields.io/npm/dt/%40xui/form-field.svg)](https://www.npmjs.com/package/%40xui/form-field)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/form-field.svg)](https://www.npmjs.com/package/%40xui/form-field)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/form-field)](https://bundlephobia.com/result?p=%40xui/form-field) | Form Field component |
48
- | Icon | [![Downloads](https://img.shields.io/npm/dt/%40xui/icon.svg)](https://www.npmjs.com/package/%40xui/icon)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/icon.svg)](https://www.npmjs.com/package/%40xui/icon)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/icon)](https://bundlephobia.com/result?p=%40xui/icon) | Icon component |
49
- | Input | [![Downloads](https://img.shields.io/npm/dt/%40xui/input.svg)](https://www.npmjs.com/package/%40xui/input)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/input.svg)](https://www.npmjs.com/package/%40xui/input)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/input)](https://bundlephobia.com/result?p=%40xui/input) | Input component |
50
- | Label | [![Downloads](https://img.shields.io/npm/dt/%40xui/label.svg)](https://www.npmjs.com/package/%40xui/label)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/label.svg)](https://www.npmjs.com/package/%40xui/label)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/label)](https://bundlephobia.com/result?p=%40xui/label) | Label component |
51
- | Skeleton | [![Downloads](https://img.shields.io/npm/dt/%40xui/skeleton.svg)](https://www.npmjs.com/package/%40xui/skeleton)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/skeleton.svg)](https://www.npmjs.com/package/%40xui/skeleton)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/skeleton)](https://bundlephobia.com/result?p=%40xui/skeleton) | Skeleton component |
52
- | Spinner | [![Downloads](https://img.shields.io/npm/dt/%40xui/spinner.svg)](https://www.npmjs.com/package/%40xui/spinner)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/spinner.svg)](https://www.npmjs.com/package/%40xui/spinner)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/spinner)](https://bundlephobia.com/result?p=%40xui/spinner) | Spinner component |
53
- | Status | [![Downloads](https://img.shields.io/npm/dt/%40xui/status.svg)](https://www.npmjs.com/package/%40xui/status)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/status.svg)](https://www.npmjs.com/package/%40xui/status)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/status)](https://bundlephobia.com/result?p=%40xui/status) | Status component |
54
- | Table | [![Downloads](https://img.shields.io/npm/dt/%40xui/table.svg)](https://www.npmjs.com/package/%40xui/table)<br />[![Monthly Downloads](https://img.shields.io/npm/dm/%40xui/table.svg)](https://www.npmjs.com/package/%40xui/table)<br />[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/%40xui/table)](https://bundlephobia.com/result?p=%40xui/table) | Table component |
55
-
56
- ## Installation
57
-
58
- Install package with **PNPM**
40
+ - **One package per component.** Install `@xui/button` and you ship a button, not a library. Each
41
+ package exports an imports barrel for standalone components.
42
+ - **Signals throughout.** Signal inputs, `OnPush` and zoneless change detection; no `zone.js`
43
+ required.
44
+ - **Themed by tokens, not overrides.** Components style themselves with `bg-surface`,
45
+ `text-foreground-muted`, `border-error-muted`. Light and dark both work without a single `dark:`
46
+ class, and re-colouring an intent is one CSS variable.
47
+ - **Typed variants.** Every visual axis is a typed input backed by
48
+ [CVA](https://cva.style), and the `class` input merges through `tailwind-merge` — your utility
49
+ wins instead of fighting the component's.
50
+ - **Angular CDK underneath.** Overlays, focus traps, roving tabindex, typeahead, drag and drop and
51
+ bidi come from `@angular/cdk`, so keyboard behaviour and RTL are not reimplemented per component.
52
+ - **Built for coding agents.** An MCP server and an agent skill expose the real API of every
53
+ package — see [AI coding agents](#ai-coding-agents).
54
+
55
+ ## Requirements
56
+
57
+ | | |
58
+ | ----------------------- | --- |
59
+ | Angular | 22 |
60
+ | Tailwind CSS | 4 |
61
+ | Node (development only) | 24 |
62
+
63
+ ## Getting started
64
+
65
+ ```bash
66
+ ng add @xui/core
67
+ ```
68
+
69
+ That installs the core package and wires your global stylesheet: the theme import, the CDK overlay
70
+ stylesheet, and a `@source` glob pointing at the published packages. It is idempotent, so running it
71
+ again only adds what is missing. Use `nx add @xui/core` in an Nx workspace, and `--skip-overlay` if
72
+ you will not use dialogs, drawers, popovers, tooltips, menus or toasts.
73
+
74
+ Then add the components you need:
59
75
 
60
76
  ```bash
61
- pnpm i @xui/core ....
77
+ pnpm add @xui/button @xui/dialog @xui/icon
62
78
  ```
63
79
 
64
80
  ## Theming
65
81
 
66
- Every `@xui/*` component styles itself with semantic Tailwind utilities `bg-surface`,
67
- `text-foreground-muted`, `border-error-muted` — that resolve through the token layer shipped with
68
- `@xui/core`. Import it once, after Tailwind:
82
+ To wire the styles by hand, import the token layer once after Tailwind:
69
83
 
70
84
  ```css
71
85
  @import 'tailwindcss';
72
86
  @import '@xui/core/styles/theme.css';
73
87
 
74
- /* Only needed if you use an overlay surface — popover, tooltip, menu, dialog,
75
- drawer or toast. Without it overlays render in the document flow. */
88
+ /* Only needed for an overlay surface — popover, tooltip, menu, dialog, drawer
89
+ or toast. Without it, overlays render in the document flow. */
76
90
  @import '@angular/cdk/overlay-prebuilt.css';
77
91
 
78
- /* Tell Tailwind to scan the component sources for utility classes. */
92
+ /* Tailwind only emits utilities it can see, and it cannot see node_modules by default. */
79
93
  @source '../node_modules/@xui';
80
94
  ```
81
95
 
82
- Switch themes by putting `.dark` (or `[data-theme='dark']`) on `<html>`; with neither class
83
- present the theme follows `prefers-color-scheme`. Both selectors also work on any element, so a
84
- subtree can render in the opposite theme.
96
+ Put `.dark` (or `[data-theme='dark']`) on `<html>` to switch themes; with neither present the theme
97
+ follows `prefers-color-scheme`. Both selectors work on any element, so a subtree can render in the
98
+ opposite theme.
85
99
 
86
- Re-theme by overriding tokens after the import the `darker` / `lighter` / `subtle` / `muted` /
100
+ Re-theme by overriding tokens after the import. The `darker` / `lighter` / `subtle` / `muted` /
87
101
  `emphasis` steps of each intent are derived, so one declaration re-colours the whole ramp:
88
102
 
89
103
  ```css
@@ -93,37 +107,48 @@ Re-theme by overriding tokens after the import — the `darker` / `lighter` / `s
93
107
  }
94
108
  ```
95
109
 
96
- The full token reference, rendered in both themes, is the **Design Tokens** page in
97
- [Storybook](https://develop--67d2b4c756077a325913e5d9.chromatic.com/?globals=theme:dark).
110
+ Controls share one density scale 24 / 30 / 40px for `sm` / default / `lg` — so a button, an input
111
+ and a date field on the same row line up. Override `--control-height-md` to re-tune the library.
98
112
 
99
- ## Browser Support
113
+ The full token reference, rendered in both themes, is the **Design tokens** page in Storybook.
100
114
 
101
- xUI Supports most recent browsers according to Angular [support](https://angular.io/guide/browser-support).
115
+ ## Components
102
116
 
103
- ## Development
117
+ <details>
118
+ <summary><strong>All 90 packages</strong>, grouped as they appear in Storybook</summary>
104
119
 
105
- The project uses `NX` and `Angular` to build the package.
120
+ <br />
106
121
 
107
- To start docs page use
122
+ **Foundations** [`@xui/icon`](https://www.npmjs.com/package/@xui/icon) · [`@xui/link`](https://www.npmjs.com/package/@xui/link) · [`@xui/text`](https://www.npmjs.com/package/@xui/text)
108
123
 
109
- ```bash
110
- pnpm start
111
- ```
124
+ **Actions** — [`@xui/button`](https://www.npmjs.com/package/@xui/button) · [`@xui/button-group`](https://www.npmjs.com/package/@xui/button-group) · [`@xui/hotkeys`](https://www.npmjs.com/package/@xui/hotkeys)
112
125
 
113
- To start storybook use
126
+ **Forms** [`@xui/cascader`](https://www.npmjs.com/package/@xui/cascader) · [`@xui/checkbox`](https://www.npmjs.com/package/@xui/checkbox) · [`@xui/color-picker`](https://www.npmjs.com/package/@xui/color-picker) · [`@xui/control-card`](https://www.npmjs.com/package/@xui/control-card) · [`@xui/control-group`](https://www.npmjs.com/package/@xui/control-group) · [`@xui/editable-text`](https://www.npmjs.com/package/@xui/editable-text) · [`@xui/file-input`](https://www.npmjs.com/package/@xui/file-input) · [`@xui/form-field`](https://www.npmjs.com/package/@xui/form-field) · [`@xui/html-select`](https://www.npmjs.com/package/@xui/html-select) · [`@xui/input`](https://www.npmjs.com/package/@xui/input) · [`@xui/input-otp`](https://www.npmjs.com/package/@xui/input-otp) · [`@xui/label`](https://www.npmjs.com/package/@xui/label) · [`@xui/multi-select`](https://www.npmjs.com/package/@xui/multi-select) · [`@xui/numeric-input`](https://www.npmjs.com/package/@xui/numeric-input) · [`@xui/radio`](https://www.npmjs.com/package/@xui/radio) · [`@xui/rate`](https://www.npmjs.com/package/@xui/rate) · [`@xui/rich-text-editor`](https://www.npmjs.com/package/@xui/rich-text-editor) · [`@xui/segmented-control`](https://www.npmjs.com/package/@xui/segmented-control) · [`@xui/select`](https://www.npmjs.com/package/@xui/select) · [`@xui/slider`](https://www.npmjs.com/package/@xui/slider) · [`@xui/suggest`](https://www.npmjs.com/package/@xui/suggest) · [`@xui/switch`](https://www.npmjs.com/package/@xui/switch) · [`@xui/tag-input`](https://www.npmjs.com/package/@xui/tag-input) · [`@xui/textarea`](https://www.npmjs.com/package/@xui/textarea) · [`@xui/transfer`](https://www.npmjs.com/package/@xui/transfer) · [`@xui/tree-select`](https://www.npmjs.com/package/@xui/tree-select) · [`@xui/upload`](https://www.npmjs.com/package/@xui/upload)
114
127
 
115
- ```bash
116
- pnpm storybook
117
- ```
128
+ **Date & time** — [`@xui/date-input`](https://www.npmjs.com/package/@xui/date-input) · [`@xui/date-picker`](https://www.npmjs.com/package/@xui/date-picker) · [`@xui/date-range-input`](https://www.npmjs.com/package/@xui/date-range-input) · [`@xui/date-range-picker`](https://www.npmjs.com/package/@xui/date-range-picker) · [`@xui/time-picker`](https://www.npmjs.com/package/@xui/time-picker) · [`@xui/timezone-select`](https://www.npmjs.com/package/@xui/timezone-select)
129
+
130
+ **Data display** — [`@xui/avatar`](https://www.npmjs.com/package/@xui/avatar) · [`@xui/badge`](https://www.npmjs.com/package/@xui/badge) · [`@xui/card`](https://www.npmjs.com/package/@xui/card) · [`@xui/card-list`](https://www.npmjs.com/package/@xui/card-list) · [`@xui/carousel`](https://www.npmjs.com/package/@xui/carousel) · [`@xui/data-table`](https://www.npmjs.com/package/@xui/data-table) · [`@xui/descriptions`](https://www.npmjs.com/package/@xui/descriptions) · [`@xui/entity-title`](https://www.npmjs.com/package/@xui/entity-title) · [`@xui/kbd`](https://www.npmjs.com/package/@xui/kbd) · [`@xui/statistic`](https://www.npmjs.com/package/@xui/statistic) · [`@xui/status`](https://www.npmjs.com/package/@xui/status) · [`@xui/table`](https://www.npmjs.com/package/@xui/table) · [`@xui/tag`](https://www.npmjs.com/package/@xui/tag) · [`@xui/timeline`](https://www.npmjs.com/package/@xui/timeline) · [`@xui/tree`](https://www.npmjs.com/package/@xui/tree)
131
+
132
+ **Navigation** — [`@xui/breadcrumb`](https://www.npmjs.com/package/@xui/breadcrumb) · [`@xui/menubar`](https://www.npmjs.com/package/@xui/menubar) · [`@xui/navbar`](https://www.npmjs.com/package/@xui/navbar) · [`@xui/navigation-menu`](https://www.npmjs.com/package/@xui/navigation-menu) · [`@xui/pagination`](https://www.npmjs.com/package/@xui/pagination) · [`@xui/panel-stack`](https://www.npmjs.com/package/@xui/panel-stack) · [`@xui/steps`](https://www.npmjs.com/package/@xui/steps) · [`@xui/tabs`](https://www.npmjs.com/package/@xui/tabs)
133
+
134
+ **Overlays** — [`@xui/alert`](https://www.npmjs.com/package/@xui/alert) · [`@xui/alert-dialog`](https://www.npmjs.com/package/@xui/alert-dialog) · [`@xui/context-menu`](https://www.npmjs.com/package/@xui/context-menu) · [`@xui/dialog`](https://www.npmjs.com/package/@xui/dialog) · [`@xui/drawer`](https://www.npmjs.com/package/@xui/drawer) · [`@xui/menu`](https://www.npmjs.com/package/@xui/menu) · [`@xui/omnibar`](https://www.npmjs.com/package/@xui/omnibar) · [`@xui/popover`](https://www.npmjs.com/package/@xui/popover) · [`@xui/toast`](https://www.npmjs.com/package/@xui/toast) · [`@xui/tooltip`](https://www.npmjs.com/package/@xui/tooltip)
135
+
136
+ **Feedback** — [`@xui/callout`](https://www.npmjs.com/package/@xui/callout) · [`@xui/non-ideal-state`](https://www.npmjs.com/package/@xui/non-ideal-state) · [`@xui/progress-bar`](https://www.npmjs.com/package/@xui/progress-bar) · [`@xui/result`](https://www.npmjs.com/package/@xui/result) · [`@xui/skeleton`](https://www.npmjs.com/package/@xui/skeleton) · [`@xui/spinner`](https://www.npmjs.com/package/@xui/spinner)
137
+
138
+ **Layout** — [`@xui/accordion`](https://www.npmjs.com/package/@xui/accordion) · [`@xui/aspect-ratio`](https://www.npmjs.com/package/@xui/aspect-ratio) · [`@xui/collapse`](https://www.npmjs.com/package/@xui/collapse) · [`@xui/divider`](https://www.npmjs.com/package/@xui/divider) · [`@xui/dock-manager`](https://www.npmjs.com/package/@xui/dock-manager) · [`@xui/overflow-list`](https://www.npmjs.com/package/@xui/overflow-list) · [`@xui/scroll-area`](https://www.npmjs.com/package/@xui/scroll-area) · [`@xui/section`](https://www.npmjs.com/package/@xui/section) · [`@xui/splitter`](https://www.npmjs.com/package/@xui/splitter)
139
+
140
+ **Visualisation** — [`@xui/echarts`](https://www.npmjs.com/package/@xui/echarts) · [`@xui/konva`](https://www.npmjs.com/package/@xui/konva) · [`@xui/node-graph`](https://www.npmjs.com/package/@xui/node-graph)
141
+
142
+ </details>
118
143
 
119
144
  ## AI coding agents
120
145
 
121
146
  Two pieces of tooling teach coding agents how to build with xUI.
122
147
 
123
- **MCP server** — [`@xui/mcp`](https://github.com/Rikarin/xui/blob/HEAD/libs/mcp/README.md) exposes every package's real API (selectors,
124
- signal inputs, variant axes, outputs), the design tokens, the docs and the Storybook examples as
125
- MCP tools. It extracts them from the library sources, so all ~90 packages are covered and the
126
- answers match the installed version.
148
+ **MCP server** — [`@xui/mcp`](libs/mcp/README.md) exposes every package's real API (selectors, signal
149
+ inputs, variant axes, outputs), the design tokens, the docs and the Storybook examples as MCP tools.
150
+ It extracts them from the library sources, so every package is covered and the answers match the
151
+ installed version.
127
152
 
128
153
  ```json
129
154
  {
@@ -133,85 +158,46 @@ answers match the installed version.
133
158
  }
134
159
  ```
135
160
 
136
- In this repo, `.mcp.json` already points at `dist/libs/mcp/src/server.js` — run `pnpm nx build mcp`
137
- once so it exists.
161
+ In this repository `.mcp.json` already points at `dist/libs/mcp/src/server.js` — run
162
+ `pnpm nx build mcp` once so it exists.
138
163
 
139
- **Skill** — [`skills/xui`](https://github.com/Rikarin/xui/blob/HEAD/skills/xui/SKILL.md) is the procedural knowledge: the three-layer
164
+ **Skill** — [`skills/xui`](skills/xui/SKILL.md) is the procedural knowledge: the three-layer
140
165
  architecture, discovery through the MCP server, composition and styling rules, theming, the
141
166
  generators, and the conventions for authoring a package inside the monorepo. `.claude/skills/xui`
142
167
  links to it for agents working in this repository.
143
168
 
144
- ## Issues
145
-
146
- If you find any issues in the library or have and idea for an improvement feel free to open an [issue](https://github.com/Rikarin/xui/issues).
147
-
148
- ## Roadmap
149
-
150
- - [ ] Accordion
151
- - [ ] Alert
152
- - [ ] Alert Dialog
153
- - [ ] Avatar
154
- - [ ] Calendar
155
- - [ ] Card
156
- - [ ] Carousel
157
- - [ ] Collapsible
158
- - [ ] Combobox
159
- - [ ] Command
160
- - [ ] Date Picker
161
- - [ ] Date Range Picker
162
- - [ ] Dialog
163
- - [ ] Hover Card
164
- - [ ] Menu
165
- - [ ] Pagination
166
- - [ ] Popover
167
- - [ ] Progress
168
- - [ ] Radio Group
169
- - [ ] Scroll Area
170
- - [ ] Select
171
- - [ ] Separator
172
- - [ ] Sheet
173
- - [ ] Slider
174
- - [ ] Switch
175
- - [ ] Tabs
176
- - [ ] Toggle
177
- - [ ] Tooltip
178
- - [ ] Typography
179
- - [ ] Input OTP
180
- - [ ] Toggle Group
181
-
182
- ### Additional
183
-
184
- - [ ] Decagram
185
- - [ ] Settings
186
- - [ ] Drawer
187
- - [ ] Panel Bar
188
- - [ ] Textarea
189
- - [ ] Time Picker
190
- - [ ] Image Upload
191
- - [ ] Banner
192
- - [ ] Snack bar
193
-
194
- ## Opinionated "components"
195
-
196
- - [ ] Graph View (Nodes)
197
- - [ ] Analysis
198
- - [ ] Charts (NG Charts?)
199
-
200
- ## CLI
201
-
202
- Make cli to install the components
203
-
204
- ## TODO
205
-
206
- - Button
207
-
208
- - Icon
209
- - Shine
210
-
211
- - Breadcrumb
212
-
213
- - fix styling issues
214
- - on hover stuff
215
- - data driven component
216
-
217
- - adjust generator to generate stories into the apps/storybook
169
+ ## Browser support
170
+
171
+ The browsers Angular itself supports see the
172
+ [Angular browser support policy](https://angular.dev/reference/versions#browser-support).
173
+
174
+ ## Development
175
+
176
+ The workspace is [Nx](https://nx.dev) + pnpm.
177
+
178
+ ```bash
179
+ pnpm install
180
+ pnpm start # documentation site on :4200
181
+ pnpm storybook # component gallery on :4400
182
+ pnpm nx serve admin # the example admin application
183
+ pnpm test # unit tests
184
+ pnpm nx test-storybook ui-storybook # render every story in headless Chromium
185
+ pnpm build # build every package
186
+ ```
187
+
188
+ Commits follow [Conventional Commits](https://www.conventionalcommits.org) and are linted — the
189
+ release is cut from them. See [docs/releasing.md](docs/releasing.md) for how a version is published,
190
+ [apps/ui-storybook/README.md](apps/ui-storybook/README.md) before writing stories, and
191
+ [apps/app/README.md](apps/app/README.md) for the documentation site, whose component pages are
192
+ generated from those same stories, and [apps/admin/README.md](apps/admin/README.md) for the example
193
+ admin application a full app built from these packages, which is the fastest way to see how they
194
+ fit together.
195
+
196
+ ## Contributing
197
+
198
+ Bugs and ideas are welcome in [issues](https://github.com/Rikarin/xui/issues). For a change of any
199
+ size, open an issue first so the API can be agreed before the code exists.
200
+
201
+ ## License
202
+
203
+ See [LICENSE](LICENSE).
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, forwardRef, viewChild, input, model, booleanAttribute, signal, computed, effect, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
2
+ import { InjectionToken, inject, viewChild, input, model, booleanAttribute, signal, computed, effect, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
4
3
  import { provideIcons, NgIcon } from '@ng-icons/core';
5
4
  import { matTerminalRound, matLinkRound, matHorizontalRuleRound, matFormatUnderlinedRound, matFormatStrikethroughRound, matFormatQuoteRound, matFormatListNumberedRound, matFormatListBulletedRound, matFormatItalicRound, matFormatBoldRound, matCodeRound } from '@ng-icons/material-icons/round';
6
- import { xui } from '@xui/core';
5
+ import { createXConfigToken, xui } from '@xui/core';
6
+ import { createXValueAccessor, provideXValueAccessor } from '@xui/core/forms';
7
7
  import { XuiIcon } from '@xui/icon';
8
8
 
9
9
  const MARK_TAGS = {
@@ -418,19 +418,12 @@ function inlineToHtml(text) {
418
418
  .replace(new RegExp(`${SPAN}(\\d+)${SPAN}`, 'g'), (_, index) => `<code>${codeSpans[Number(index)]}</code>`);
419
419
  }
420
420
 
421
- const defaultConfig = {
421
+ /** Application-wide defaults for every editor. Individual inputs still win. */
422
+ const [injectXuiRichTextEditorConfig, provideXuiRichTextEditorConfig] = createXConfigToken('XuiRichTextEditorConfig', {
422
423
  format: 'markdown',
423
424
  placeholder: '',
424
425
  sourceView: true
425
- };
426
- const XuiRichTextEditorConfigToken = new InjectionToken('XuiRichTextEditorConfig');
427
- /** Application-wide defaults for every editor. Individual inputs still win. */
428
- function provideXuiRichTextEditorConfig(config) {
429
- return { provide: XuiRichTextEditorConfigToken, useValue: { ...defaultConfig, ...config } };
430
- }
431
- function injectXuiRichTextEditorConfig() {
432
- return inject(XuiRichTextEditorConfigToken, { optional: true }) ?? defaultConfig;
433
- }
426
+ });
434
427
  const XuiRichTextSyntaxToken = new InjectionToken('XuiRichTextSyntax');
435
428
  /**
436
429
  * Teaches the editor a format.
@@ -526,11 +519,6 @@ const TOOLS = [
526
519
  state: 'none'
527
520
  }
528
521
  ];
529
- const XUI_RICH_TEXT_EDITOR_VALUE_ACCESSOR = {
530
- provide: NG_VALUE_ACCESSOR,
531
- useExisting: forwardRef(() => XuiRichTextEditor),
532
- multi: true
533
- };
534
522
  /**
535
523
  * A WYSIWYG editor whose value is source text.
536
524
  *
@@ -585,12 +573,16 @@ class XuiRichTextEditor {
585
573
  ...(ngDevMode ? [{ debugName: "linkDraft" }] : /* istanbul ignore next */ []));
586
574
  active = signal([], /* @ts-ignore */
587
575
  ...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
588
- onChange;
589
- onTouched;
590
- disabledByForm = signal(false, /* @ts-ignore */
591
- ...(ngDevMode ? [{ debugName: "disabledByForm" }] : /* istanbul ignore next */ []));
592
- isDisabled = computed(() => this.disabled() || this.disabledByForm(), /* @ts-ignore */
593
- ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
576
+ cva = createXValueAccessor({
577
+ onWrite: value => {
578
+ this.value.set(value ?? '');
579
+ // Force the next render: the value came from outside, so whatever is in
580
+ // the surface is stale even if the string matches what we last serialised.
581
+ this.synced = null;
582
+ },
583
+ disabled: this.disabled
584
+ });
585
+ isDisabled = this.cva.disabled;
594
586
  /**
595
587
  * The value the surface already shows, tagged with the format it was rendered
596
588
  * in. Re-rendering the user's own keystrokes would reset the caret on every
@@ -617,7 +609,7 @@ class XuiRichTextEditor {
617
609
  ...(ngDevMode ? [{ debugName: "tools" }] : /* istanbul ignore next */ []));
618
610
  computedClass = computed(() => xui('border-border bg-surface-inset text-foreground block overflow-hidden rounded-lg border', 'focus-within:border-focus transition-colors', 'data-disabled:cursor-not-allowed data-disabled:opacity-50', '[&.ng-invalid.ng-touched]:border-error', this.class()), /* @ts-ignore */
619
611
  ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
620
- toolClass = computed(() => xui('text-foreground-muted hover:bg-surface-raised hover:text-foreground flex items-center rounded px-1.5 py-1', 'data-active:bg-surface-raised data-active:text-foreground disabled:pointer-events-none disabled:opacity-50', 'focus-visible:outline-focus focus-visible:outline-2'), /* @ts-ignore */
612
+ toolClass = computed(() => xui('text-foreground-muted hover:bg-surface-raised hover:text-foreground flex items-center rounded px-1.5 py-1', 'data-active:bg-surface-raised data-active:text-foreground disabled:pointer-events-none disabled:opacity-50'), /* @ts-ignore */
621
613
  ...(ngDevMode ? [{ debugName: "toolClass" }] : /* istanbul ignore next */ []));
622
614
  /** Tailwind resets block elements, so the writing area re-states how prose looks. */
623
615
  surfaceClass = computed(() => xui('block p-3 outline-none [&>*+*]:mt-2', '[&_h1]:text-2xl [&_h1]:font-semibold [&_h2]:text-xl [&_h2]:font-semibold [&_h3]:text-lg [&_h3]:font-semibold', '[&_ul]:list-disc [&_ol]:list-decimal [&_ul]:ps-6 [&_ol]:ps-6', '[&_blockquote]:border-border-strong [&_blockquote]:text-foreground-muted [&_blockquote]:border-s-2 [&_blockquote]:ps-3', '[&_pre]:bg-surface-sunken [&_pre]:rounded [&_pre]:p-2 [&_pre]:font-mono [&_pre]:text-sm', '[&_code]:bg-surface-sunken [&_code]:rounded [&_code]:px-1 [&_code]:font-mono [&_code]:text-sm', '[&_pre_code]:bg-transparent [&_pre_code]:p-0', '[&_a]:text-link [&_a]:underline', '[&_hr]:border-border [&_hr]:my-3'), /* @ts-ignore */
@@ -645,7 +637,7 @@ class XuiRichTextEditor {
645
637
  const translated = this.syntax().fromHtml(surface);
646
638
  this.synced = this.syncKey(translated);
647
639
  this.value.set(translated);
648
- this.onChange?.(translated);
640
+ this.cva.notifyChange(translated);
649
641
  return;
650
642
  }
651
643
  surface.innerHTML = this.syntax().toHtml(value);
@@ -790,29 +782,18 @@ class XuiRichTextEditor {
790
782
  // effect sees it and leaves the caret where the user put it.
791
783
  this.synced = this.syncKey(next);
792
784
  this.value.set(next);
793
- this.onChange?.(next);
785
+ this.cva.notifyChange(next);
794
786
  }
795
787
  syncKey(value) {
796
788
  return `${this.format()}:${value}`;
797
789
  }
798
790
  // --- ControlValueAccessor ---
799
- writeValue(value) {
800
- this.value.set(value ?? '');
801
- // Force the next render: the value came from outside, so whatever is in the
802
- // surface is stale even if the string matches what we last serialised.
803
- this.synced = null;
804
- }
805
- registerOnChange(fn) {
806
- this.onChange = fn;
807
- }
808
- registerOnTouched(fn) {
809
- this.onTouched = fn;
810
- }
811
- setDisabledState(isDisabled) {
812
- this.disabledByForm.set(isDisabled);
813
- }
791
+ writeValue = this.cva.writeValue;
792
+ registerOnChange = this.cva.registerOnChange;
793
+ registerOnTouched = this.cva.registerOnTouched;
794
+ setDisabledState = this.cva.setDisabledState;
814
795
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiRichTextEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
815
- /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: XuiRichTextEditor, isStandalone: true, selector: "xui-rich-text-editor", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, sourceView: { classPropertyName: "sourceView", publicName: "sourceView", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", source: "sourceChange" }, host: { properties: { "class": "computedClass()", "attr.data-disabled": "isDisabled() ? \"\" : null" } }, providers: [XUI_RICH_TEXT_EDITOR_VALUE_ACCESSOR], viewQueries: [{ propertyName: "surface", first: true, predicate: ["surface"], descendants: true, isSignal: true }, { propertyName: "linkField", first: true, predicate: ["linkField"], descendants: true, isSignal: true }], ngImport: i0, template: `
796
+ /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: XuiRichTextEditor, isStandalone: true, selector: "xui-rich-text-editor", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, sourceView: { classPropertyName: "sourceView", publicName: "sourceView", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", source: "sourceChange" }, host: { properties: { "class": "computedClass()", "attr.data-disabled": "isDisabled() ? \"\" : null" } }, providers: [provideXValueAccessor((() => XuiRichTextEditor))], viewQueries: [{ propertyName: "surface", first: true, predicate: ["surface"], descendants: true, isSignal: true }, { propertyName: "linkField", first: true, predicate: ["linkField"], descendants: true, isSignal: true }], ngImport: i0, template: `
816
797
  <div
817
798
  role="toolbar"
818
799
  aria-label="Formatting"
@@ -881,7 +862,7 @@ class XuiRichTextEditor {
881
862
  [disabled]="isDisabled()"
882
863
  [value]="value()"
883
864
  (input)="onSourceInput($event)"
884
- (blur)="onTouched?.()"
865
+ (blur)="cva.markTouched()"
885
866
  ></textarea>
886
867
  } @else {
887
868
  <div class="relative">
@@ -900,7 +881,7 @@ class XuiRichTextEditor {
900
881
  [attr.aria-label]="ariaLabel()"
901
882
  [attr.aria-disabled]="isDisabled() ? true : null"
902
883
  (input)="pull()"
903
- (blur)="onTouched?.()"
884
+ (blur)="cva.markTouched()"
904
885
  (paste)="onPaste($event)"
905
886
  (keydown)="onKeydown($event)"
906
887
  (keyup)="refreshActive()"
@@ -908,7 +889,7 @@ class XuiRichTextEditor {
908
889
  ></div>
909
890
  </div>
910
891
  }
911
- `, isInline: true, dependencies: [{ kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: XuiIcon, selector: "ng-icon[xui]", inputs: ["class", "size", "color", "title"], exportAs: ["xuiIcon"] }], viewProviders: [
892
+ `, isInline: true, dependencies: [{ kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: XuiIcon, selector: "ng-icon[xui]", inputs: ["class", "size", "color", "label"], exportAs: ["xuiIcon"] }], viewProviders: [
912
893
  provideIcons({
913
894
  matCodeRound,
914
895
  matFormatBoldRound,
@@ -998,7 +979,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
998
979
  [disabled]="isDisabled()"
999
980
  [value]="value()"
1000
981
  (input)="onSourceInput($event)"
1001
- (blur)="onTouched?.()"
982
+ (blur)="cva.markTouched()"
1002
983
  ></textarea>
1003
984
  } @else {
1004
985
  <div class="relative">
@@ -1017,7 +998,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
1017
998
  [attr.aria-label]="ariaLabel()"
1018
999
  [attr.aria-disabled]="isDisabled() ? true : null"
1019
1000
  (input)="pull()"
1020
- (blur)="onTouched?.()"
1001
+ (blur)="cva.markTouched()"
1021
1002
  (paste)="onPaste($event)"
1022
1003
  (keydown)="onKeydown($event)"
1023
1004
  (keyup)="refreshActive()"
@@ -1030,7 +1011,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
1030
1011
  '[class]': 'computedClass()',
1031
1012
  '[attr.data-disabled]': 'isDisabled() ? "" : null'
1032
1013
  },
1033
- providers: [XUI_RICH_TEXT_EDITOR_VALUE_ACCESSOR],
1014
+ providers: [provideXValueAccessor((() => XuiRichTextEditor))],
1034
1015
  changeDetection: ChangeDetectionStrategy.OnPush,
1035
1016
  encapsulation: ViewEncapsulation.None,
1036
1017
  viewProviders: [
@@ -1078,5 +1059,5 @@ const XuiRichTextEditorImports = [XuiRichTextEditor];
1078
1059
  * Generated bundle index. Do not edit.
1079
1060
  */
1080
1061
 
1081
- export { XUI_RICH_TEXT_EDITOR_VALUE_ACCESSOR, XuiRichTextEditor, XuiRichTextEditorImports, bbcodeSyntax, escapeHtml, injectXuiRichTextEditorConfig, injectXuiRichTextSyntaxes, markdownSyntax, provideXuiRichTextEditorConfig, provideXuiRichTextSyntax, sanitizeUrl, serializeHtml };
1062
+ export { XuiRichTextEditor, XuiRichTextEditorImports, bbcodeSyntax, escapeHtml, injectXuiRichTextEditorConfig, injectXuiRichTextSyntaxes, markdownSyntax, provideXuiRichTextEditorConfig, provideXuiRichTextSyntax, sanitizeUrl, serializeHtml };
1082
1063
  //# sourceMappingURL=xui-rich-text-editor.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"xui-rich-text-editor.mjs","sources":["../../../../../../libs/ui/rich-text-editor/xui/src/lib/rich-text-syntax.ts","../../../../../../libs/ui/rich-text-editor/xui/src/lib/bbcode-syntax.ts","../../../../../../libs/ui/rich-text-editor/xui/src/lib/markdown-syntax.ts","../../../../../../libs/ui/rich-text-editor/xui/src/lib/rich-text-editor.token.ts","../../../../../../libs/ui/rich-text-editor/xui/src/lib/rich-text-editor.ts","../../../../../../libs/ui/rich-text-editor/xui/src/index.ts","../../../../../../libs/ui/rich-text-editor/xui/src/xui-rich-text-editor.ts"],"sourcesContent":["/**\n * A formatting feature. The editor's toolbar offers exactly the features the\n * active syntax declares, so nothing can be applied that the format cannot\n * express — Markdown has no underline, BBCode has no headings.\n */\nexport type XuiRichTextMark = 'bold' | 'italic' | 'underline' | 'strike' | 'code' | 'link';\n\nexport type XuiRichTextBlock =\n 'heading1' | 'heading2' | 'heading3' | 'bulletList' | 'orderedList' | 'quote' | 'codeBlock' | 'rule';\n\nexport type XuiRichTextFeature = XuiRichTextMark | XuiRichTextBlock;\n\n/**\n * Turns the editor's HTML into source text.\n *\n * The editor edits one canonical HTML subset — `p`, `h1`–`h3`, `ul`/`ol`,\n * `blockquote`, `pre`, `hr` and the inline marks — and a syntax is only the\n * translation at each end. Implement one to teach the editor a new format;\n * nothing else changes.\n */\nexport interface XuiRichTextWriter {\n /** Escape text so the syntax's own punctuation is not read as markup. */\n escape(text: string): string;\n /** Wrap `inner` in a mark, or return it untouched when the syntax lacks one. */\n mark(kind: XuiRichTextMark, inner: string, href?: string): string;\n /** Wrap a block's already-serialised inline content. */\n block(kind: 'paragraph' | 'heading1' | 'heading2' | 'heading3' | 'quote', inner: string): string;\n /** A whole list, given its already-serialised items. */\n list(items: string[], ordered: boolean): string;\n /** Verbatim text — never escaped, never marked up. */\n codeBlock(text: string): string;\n /** A thematic break. */\n rule(): string;\n}\n\n/** Both directions of one text format. */\nexport interface XuiRichTextSyntax {\n /** How the format is named in the `format` input — `'markdown'`, `'bbcode'`, … */\n readonly name: string;\n /** What this format can express. Anything absent is left out of the toolbar. */\n readonly features: readonly XuiRichTextFeature[];\n /** Source text → the editor's HTML subset. Must return markup it produced itself. */\n toHtml(source: string): string;\n /** The editor's HTML → source text. */\n fromHtml(root: HTMLElement): string;\n}\n\nconst MARK_TAGS: Record<string, XuiRichTextMark> = {\n STRONG: 'bold',\n B: 'bold',\n EM: 'italic',\n I: 'italic',\n U: 'underline',\n S: 'strike',\n STRIKE: 'strike',\n DEL: 'strike',\n CODE: 'code',\n A: 'link'\n};\n\n/**\n * Walks the editor's HTML and hands each piece to `writer`.\n *\n * Shared by every syntax so they only describe *what* their markup looks like,\n * never how to traverse a DOM — and so a new syntax cannot get the traversal\n * subtly wrong.\n */\nexport function serializeHtml(root: HTMLElement, writer: XuiRichTextWriter): string {\n const blocks: string[] = [];\n\n for (const node of Array.from(root.childNodes)) {\n const block = serializeBlock(node, writer);\n\n if (block !== null) {\n blocks.push(block);\n }\n }\n\n return blocks.filter(block => block !== '').join('\\n\\n');\n}\n\nfunction serializeBlock(node: Node, writer: XuiRichTextWriter): string | null {\n if (node.nodeType === Node.TEXT_NODE) {\n const text = node.textContent ?? '';\n\n // Loose text between blocks — browsers leave it there after some edits.\n return text.trim() ? writer.block('paragraph', writer.escape(text)) : null;\n }\n\n if (!(node instanceof Element)) {\n return null;\n }\n\n switch (node.tagName) {\n case 'H1':\n return writer.block('heading1', serializeInline(node, writer));\n case 'H2':\n return writer.block('heading2', serializeInline(node, writer));\n case 'H3':\n return writer.block('heading3', serializeInline(node, writer));\n case 'BLOCKQUOTE':\n return writer.block('quote', quoteContent(node as HTMLElement, writer));\n case 'PRE':\n return writer.codeBlock(node.textContent ?? '');\n case 'HR':\n return writer.rule();\n case 'UL':\n case 'OL':\n return writer.list(\n Array.from(node.children)\n .filter(child => child.tagName === 'LI')\n .map(item => serializeInline(item, writer)),\n node.tagName === 'OL'\n );\n case 'BR':\n return null;\n default:\n // `p`, `div` (what some browsers still produce on Enter), and anything\n // else that reached the top level: treat as a paragraph.\n return writer.block('paragraph', serializeInline(node, writer));\n }\n}\n\n/** A quote may hold blocks of its own; flatten them to lines. */\nfunction quoteContent(node: HTMLElement, writer: XuiRichTextWriter): string {\n const hasBlocks = Array.from(node.children).some(child => /^(P|DIV|H[1-3])$/.test(child.tagName));\n\n if (!hasBlocks) {\n return serializeInline(node, writer);\n }\n\n return Array.from(node.children)\n .map(child => serializeInline(child, writer))\n .filter(Boolean)\n .join('\\n');\n}\n\nfunction serializeInline(node: Node, writer: XuiRichTextWriter): string {\n let out = '';\n\n for (const child of Array.from(node.childNodes)) {\n if (child.nodeType === Node.TEXT_NODE) {\n out += writer.escape(child.textContent ?? '');\n continue;\n }\n\n if (!(child instanceof Element)) {\n continue;\n }\n\n if (child.tagName === 'BR') {\n out += '\\n';\n continue;\n }\n\n const mark = MARK_TAGS[child.tagName];\n const inner = child.tagName === 'CODE' ? writer.escape(child.textContent ?? '') : serializeInline(child, writer);\n\n out += mark ? writer.mark(mark, inner, child.getAttribute('href') ?? undefined) : inner;\n }\n\n return out;\n}\n\n/** Escapes text for insertion into the editor's HTML. */\nexport function escapeHtml(text: string): string {\n return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;');\n}\n\n/**\n * Keeps `javascript:` and friends out of an `href`.\n *\n * Source text is user input as far as this package is concerned — a comment, a\n * forum post — so a link is only ever emitted when its scheme is one that can\n * do nothing but navigate.\n */\nexport function sanitizeUrl(url: string): string {\n const trimmed = url.trim();\n\n return /^(https?:|mailto:|tel:|\\/|#|\\.)/i.test(trimmed) ? trimmed : '';\n}\n","import {\n escapeHtml,\n sanitizeUrl,\n serializeHtml,\n type XuiRichTextFeature,\n type XuiRichTextSyntax,\n type XuiRichTextWriter\n} from './rich-text-syntax';\n\n/**\n * The BBCode this syntax reads and writes.\n *\n * The tags every forum agrees on. BBCode has underline, which Markdown lacks;\n * it has no headings and no thematic break, so the toolbar drops those — the\n * format decides what the toolbar offers, not the other way round.\n */\nconst FEATURES: readonly XuiRichTextFeature[] = [\n 'bold',\n 'italic',\n 'underline',\n 'strike',\n 'link',\n 'bulletList',\n 'orderedList',\n 'quote',\n 'codeBlock'\n];\n\nconst writer: XuiRichTextWriter = {\n // BBCode has no escape character. A stray `[` is only ambiguous next to a tag\n // name, so that is the one case worth neutralising.\n escape: text => text.replace(/\\[(?=\\/?[a-z*]+[\\]=])/gi, '&#91;'),\n mark: (kind, inner, href) => {\n switch (kind) {\n case 'bold':\n return `[b]${inner}[/b]`;\n case 'italic':\n return `[i]${inner}[/i]`;\n case 'underline':\n return `[u]${inner}[/u]`;\n case 'strike':\n return `[s]${inner}[/s]`;\n case 'link':\n return href ? `[url=${href}]${inner}[/url]` : inner;\n // No inline-code tag in BBCode: `[code]` is a block everywhere.\n default:\n return inner;\n }\n },\n block: (kind, inner) => {\n switch (kind) {\n case 'quote':\n return `[quote]${inner}[/quote]`;\n // Headings degrade to plain paragraphs rather than to a `[size]` guess.\n default:\n return inner;\n }\n },\n list: (items, ordered) => [ordered ? '[list=1]' : '[list]', ...items.map(item => `[*]${item}`), '[/list]'].join('\\n'),\n codeBlock: text => `[code]\\n${text.replace(/\\n$/, '')}\\n[/code]`,\n rule: () => ''\n};\n\n/** BBCode ⇄ the editor's HTML. */\nexport const bbcodeSyntax: XuiRichTextSyntax = {\n name: 'bbcode',\n features: FEATURES,\n fromHtml: root => serializeHtml(root, writer),\n toHtml: source => bbcodeToHtml(source)\n};\n\n/** `[tag]…[/tag]` → HTML element, innermost pair first. */\nconst PAIRS: [RegExp, string][] = [\n [/\\[b]([\\s\\S]*?)\\[\\/b]/gi, '<strong>$1</strong>'],\n [/\\[i]([\\s\\S]*?)\\[\\/i]/gi, '<em>$1</em>'],\n [/\\[u]([\\s\\S]*?)\\[\\/u]/gi, '<u>$1</u>'],\n [/\\[s]([\\s\\S]*?)\\[\\/s]/gi, '<s>$1</s>']\n];\n\nfunction bbcodeToHtml(source: string): string {\n const blocks = splitBlocks(source.replace(/\\r\\n?/g, '\\n'));\n\n return blocks.join('');\n}\n\n/**\n * Block tags first — they own whole lines and may hold inline markup — then\n * whatever is left becomes paragraphs.\n */\nfunction splitBlocks(source: string): string[] {\n const html: string[] = [];\n const pattern = /\\[(code|quote|list)(=1)?]([\\s\\S]*?)\\[\\/\\1]/gi;\n let cursor = 0;\n let match: RegExpExecArray | null;\n\n while ((match = pattern.exec(source)) !== null) {\n html.push(...paragraphs(source.slice(cursor, match.index)));\n cursor = match.index + match[0].length;\n\n const [, tag, ordered, body] = match;\n\n if (tag.toLowerCase() === 'code') {\n html.push(`<pre>${escapeHtml(body.replace(/^\\n|\\n$/g, ''))}</pre>`);\n continue;\n }\n\n if (tag.toLowerCase() === 'quote') {\n html.push(`<blockquote>${paragraphs(body).join('') || '<p></p>'}</blockquote>`);\n continue;\n }\n\n const items = body\n .split(/\\[\\*]/)\n .map(item => item.trim())\n .filter(Boolean)\n .map(item => `<li>${inlineToHtml(item)}</li>`)\n .join('');\n\n html.push(ordered ? `<ol>${items}</ol>` : `<ul>${items}</ul>`);\n }\n\n html.push(...paragraphs(source.slice(cursor)));\n\n return html;\n}\n\nfunction paragraphs(source: string): string[] {\n return source\n .split(/\\n{2,}/)\n .map(block => block.replace(/^\\n+|\\n+$/g, ''))\n .filter(block => block.trim())\n .map(block => `<p>${block.split('\\n').map(inlineToHtml).join('<br>')}</p>`);\n}\n\nfunction inlineToHtml(text: string): string {\n let out = escapeHtml(text).replace(\n /\\[url(?:=([^\\]]+))?]([\\s\\S]*?)\\[\\/url]/gi,\n (match, href: string, label: string) => {\n const url = sanitizeUrl(href ?? label);\n\n return url ? `<a href=\"${escapeHtml(url)}\">${label || escapeHtml(url)}</a>` : match;\n }\n );\n\n for (const [pattern, replacement] of PAIRS) {\n // Non-greedy matches close the innermost pair first, so repeating until the\n // text settles unwraps nested tags from the inside out.\n let previous: string;\n\n do {\n previous = out;\n out = out.replace(pattern, replacement);\n } while (out !== previous);\n }\n\n return out;\n}\n","import {\n escapeHtml,\n sanitizeUrl,\n serializeHtml,\n type XuiRichTextFeature,\n type XuiRichTextSyntax,\n type XuiRichTextWriter\n} from './rich-text-syntax';\n\n/**\n * The Markdown this syntax reads and writes.\n *\n * A deliberately small, portable subset — what a comment box needs and what\n * every Markdown renderer agrees on. No tables, footnotes, images or HTML\n * passthrough; no underline, which Markdown has no syntax for.\n */\nconst FEATURES: readonly XuiRichTextFeature[] = [\n 'bold',\n 'italic',\n 'strike',\n 'code',\n 'link',\n 'heading1',\n 'heading2',\n 'heading3',\n 'bulletList',\n 'orderedList',\n 'quote',\n 'codeBlock',\n 'rule'\n];\n\nconst writer: XuiRichTextWriter = {\n escape: text => text.replace(/([\\\\`*_[\\]#>~])/g, '\\\\$1'),\n mark: (kind, inner, href) => {\n switch (kind) {\n case 'bold':\n return `**${inner}**`;\n case 'italic':\n return `*${inner}*`;\n case 'strike':\n return `~~${inner}~~`;\n case 'code':\n // Code spans are verbatim, so the backslashes `escape` added are noise.\n return `\\`${inner.replace(/\\\\([\\\\`*_[\\]#>~])/g, '$1')}\\``;\n case 'link':\n return href ? `[${inner}](${href})` : inner;\n // Markdown cannot underline. Rather than invent `<u>`, the text stays put.\n default:\n return inner;\n }\n },\n block: (kind, inner) => {\n switch (kind) {\n case 'heading1':\n return `# ${inner}`;\n case 'heading2':\n return `## ${inner}`;\n case 'heading3':\n return `### ${inner}`;\n case 'quote':\n return inner\n .split('\\n')\n .map(line => `> ${line}`)\n .join('\\n');\n default:\n return inner;\n }\n },\n list: (items, ordered) => items.map((item, index) => (ordered ? `${index + 1}. ${item}` : `- ${item}`)).join('\\n'),\n codeBlock: text => `\\`\\`\\`\\n${text.replace(/\\n$/, '')}\\n\\`\\`\\``,\n rule: () => '---'\n};\n\n/** Markdown ⇄ the editor's HTML. */\nexport const markdownSyntax: XuiRichTextSyntax = {\n name: 'markdown',\n features: FEATURES,\n fromHtml: root => serializeHtml(root, writer),\n toHtml: source => blocksToHtml(source)\n};\n\nfunction blocksToHtml(source: string): string {\n const lines = source.replace(/\\r\\n?/g, '\\n').split('\\n');\n const html: string[] = [];\n let index = 0;\n\n while (index < lines.length) {\n const line = lines[index];\n\n if (!line.trim()) {\n index++;\n continue;\n }\n\n // Fenced code: verbatim until the closing fence, or the end of the input.\n if (/^```/.test(line)) {\n const code: string[] = [];\n\n index++;\n\n while (index < lines.length && !/^```/.test(lines[index])) {\n code.push(lines[index++]);\n }\n\n index++;\n html.push(`<pre>${escapeHtml(code.join('\\n'))}</pre>`);\n continue;\n }\n\n const heading = /^(#{1,3})\\s+(.*)$/.exec(line);\n\n if (heading) {\n const level = heading[1].length;\n\n html.push(`<h${level}>${inlineToHtml(heading[2])}</h${level}>`);\n index++;\n continue;\n }\n\n if (/^(\\s*[-*_]){3,}\\s*$/.test(line)) {\n html.push('<hr>');\n index++;\n continue;\n }\n\n if (/^>\\s?/.test(line)) {\n const quoted: string[] = [];\n\n while (index < lines.length && /^>\\s?/.test(lines[index])) {\n quoted.push(lines[index++].replace(/^>\\s?/, ''));\n }\n\n html.push(`<blockquote>${quoted.map(text => `<p>${inlineToHtml(text)}</p>`).join('')}</blockquote>`);\n continue;\n }\n\n const bullet = /^\\s*[-*+]\\s+/;\n const ordered = /^\\s*\\d+[.)]\\s+/;\n\n if (bullet.test(line) || ordered.test(line)) {\n const isOrdered = ordered.test(line);\n const marker = isOrdered ? ordered : bullet;\n const items: string[] = [];\n\n while (index < lines.length && marker.test(lines[index])) {\n items.push(`<li>${inlineToHtml(lines[index++].replace(marker, ''))}</li>`);\n }\n\n html.push(isOrdered ? `<ol>${items.join('')}</ol>` : `<ul>${items.join('')}</ul>`);\n continue;\n }\n\n // Anything else runs on as a paragraph until a blank line or a new block.\n const paragraph: string[] = [];\n\n while (index < lines.length && lines[index].trim() && !startsBlock(lines[index])) {\n paragraph.push(lines[index++]);\n }\n\n html.push(`<p>${paragraph.map(inlineToHtml).join('<br>')}</p>`);\n }\n\n return html.join('');\n}\n\nfunction startsBlock(line: string): boolean {\n return /^(```|#{1,3}\\s|>|\\s*[-*+]\\s|\\s*\\d+[.)]\\s)/.test(line) || /^(\\s*[-*_]){3,}\\s*$/.test(line);\n}\n\n/**\n * Stand-ins for the two things that must sit out the emphasis passes: a code\n * span, and a backslash-escaped character. Private-use codepoints, so nothing a\n * user can type collides with them.\n */\nconst SPAN = String.fromCharCode(0xe000);\nconst ESCAPED = String.fromCharCode(0xe001);\n\n/**\n * Inline Markdown → HTML.\n *\n * Code spans and escapes are lifted out first and put back last. That is what\n * keeps `**` inside a code span from turning bold, and `\\*` from being read as\n * emphasis at all — both are invisible to the passes in between.\n */\nfunction inlineToHtml(text: string): string {\n const codeSpans: string[] = [];\n const escapes: string[] = [];\n\n let out = escapeHtml(text)\n .replace(/`([^`]+)`/g, (_, code: string) => {\n codeSpans.push(code);\n\n return `${SPAN}${codeSpans.length - 1}${SPAN}`;\n })\n .replace(/\\\\([\\\\`*_[\\]#>~])/g, (_, char: string) => {\n escapes.push(char);\n\n return `${ESCAPED}${escapes.length - 1}${ESCAPED}`;\n });\n\n out = out\n .replace(/\\[([^\\]]+)]\\(([^)\\s]+)\\)/g, (match, label: string, href: string) => {\n const url = sanitizeUrl(href);\n\n return url ? `<a href=\"${escapeHtml(url)}\">${label}</a>` : match;\n })\n .replace(/(\\*\\*|__)(?=\\S)([\\s\\S]*?\\S)\\1/g, '<strong>$2</strong>')\n .replace(/(?<![*\\w])\\*(?=\\S)([^*]*?\\S)\\*(?![*\\w])/g, '<em>$1</em>')\n .replace(/(?<![_\\w])_(?=\\S)([^_]*?\\S)_(?![_\\w])/g, '<em>$1</em>')\n .replace(/~~(?=\\S)([\\s\\S]*?\\S)~~/g, '<s>$1</s>');\n\n return out\n .replace(new RegExp(`${ESCAPED}(\\\\d+)${ESCAPED}`, 'g'), (_, index: string) => escapes[Number(index)])\n .replace(new RegExp(`${SPAN}(\\\\d+)${SPAN}`, 'g'), (_, index: string) => `<code>${codeSpans[Number(index)]}</code>`);\n}\n","import { InjectionToken, inject, type Provider, type ValueProvider } from '@angular/core';\nimport { bbcodeSyntax } from './bbcode-syntax';\nimport { markdownSyntax } from './markdown-syntax';\nimport type { XuiRichTextSyntax } from './rich-text-syntax';\n\nexport interface XuiRichTextEditorConfig {\n /** Which format new editors start in. */\n format: string;\n /** Text shown while the editor is empty. */\n placeholder: string;\n /** Offer the source-text view alongside the formatted one. */\n sourceView: boolean;\n}\n\nconst defaultConfig: XuiRichTextEditorConfig = {\n format: 'markdown',\n placeholder: '',\n sourceView: true\n};\n\nconst XuiRichTextEditorConfigToken = new InjectionToken<XuiRichTextEditorConfig>('XuiRichTextEditorConfig');\n\n/** Application-wide defaults for every editor. Individual inputs still win. */\nexport function provideXuiRichTextEditorConfig(config: Partial<XuiRichTextEditorConfig>): ValueProvider {\n return { provide: XuiRichTextEditorConfigToken, useValue: { ...defaultConfig, ...config } };\n}\n\nexport function injectXuiRichTextEditorConfig(): XuiRichTextEditorConfig {\n return inject(XuiRichTextEditorConfigToken, { optional: true }) ?? defaultConfig;\n}\n\nconst XuiRichTextSyntaxToken = new InjectionToken<readonly XuiRichTextSyntax[]>('XuiRichTextSyntax');\n\n/**\n * Teaches the editor a format.\n *\n * Markdown and BBCode are built in; this adds to them, or replaces one by\n * registering a syntax under the same name — the last one provided wins, so an\n * app can swap in its own flavour of Markdown without forking the editor.\n *\n * ```ts\n * provideXuiRichTextSyntax({\n * name: 'plain',\n * features: ['bold'],\n * toHtml: text => `<p>${text}</p>`,\n * fromHtml: root => root.textContent ?? ''\n * });\n * ```\n */\nexport function provideXuiRichTextSyntax(...syntaxes: XuiRichTextSyntax[]): Provider {\n return { provide: XuiRichTextSyntaxToken, useValue: syntaxes, multi: true };\n}\n\n/**\n * Every known syntax, by name. Built-ins first, so anything provided by the app\n * that reuses a name replaces it.\n */\nexport function injectXuiRichTextSyntaxes(): Map<string, XuiRichTextSyntax> {\n const provided = inject(XuiRichTextSyntaxToken, { optional: true }) as XuiRichTextSyntax[][] | null;\n\n return new Map([markdownSyntax, bbcodeSyntax, ...(provided ?? []).flat()].map(syntax => [syntax.name, syntax]));\n}\n","import type { BooleanInput } from '@angular/cdk/coercion';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n effect,\n forwardRef,\n input,\n model,\n signal,\n viewChild\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport {\n matCodeRound,\n matFormatBoldRound,\n matFormatItalicRound,\n matFormatListBulletedRound,\n matFormatListNumberedRound,\n matFormatQuoteRound,\n matFormatStrikethroughRound,\n matFormatUnderlinedRound,\n matHorizontalRuleRound,\n matLinkRound,\n matTerminalRound\n} from '@ng-icons/material-icons/round';\nimport { xui } from '@xui/core';\nimport type { ChangeFn, TouchFn } from '@xui/core/forms';\nimport { XuiIcon } from '@xui/icon';\nimport type { ClassValue } from 'clsx';\nimport { injectXuiRichTextEditorConfig, injectXuiRichTextSyntaxes } from './rich-text-editor.token';\nimport type { XuiRichTextFeature } from './rich-text-syntax';\n\ninterface Tool {\n readonly feature: XuiRichTextFeature;\n readonly label: string;\n readonly icon?: string;\n readonly text?: string;\n /** `document.execCommand` name, and its argument where one is needed. */\n readonly command: string;\n readonly argument?: string;\n /** How the button's pressed state is read back from the document. */\n readonly state: 'command' | 'block' | 'none';\n readonly key?: string;\n}\n\n/**\n * The full toolbar, in order. Each editor shows the entries its format can\n * express — the same button set can therefore never produce markup the format\n * cannot round-trip.\n */\nconst TOOLS: readonly Tool[] = [\n { feature: 'bold', label: 'Bold', icon: 'matFormatBoldRound', command: 'bold', state: 'command', key: 'b' },\n { feature: 'italic', label: 'Italic', icon: 'matFormatItalicRound', command: 'italic', state: 'command', key: 'i' },\n {\n feature: 'underline',\n label: 'Underline',\n icon: 'matFormatUnderlinedRound',\n command: 'underline',\n state: 'command',\n key: 'u'\n },\n {\n feature: 'strike',\n label: 'Strikethrough',\n icon: 'matFormatStrikethroughRound',\n command: 'strikeThrough',\n state: 'command'\n },\n { feature: 'code', label: 'Inline code', icon: 'matCodeRound', command: 'xuiCode', state: 'none' },\n { feature: 'link', label: 'Link', icon: 'matLinkRound', command: 'xuiLink', state: 'none', key: 'k' },\n { feature: 'heading1', label: 'Heading 1', text: 'H1', command: 'formatBlock', argument: 'h1', state: 'block' },\n { feature: 'heading2', label: 'Heading 2', text: 'H2', command: 'formatBlock', argument: 'h2', state: 'block' },\n { feature: 'heading3', label: 'Heading 3', text: 'H3', command: 'formatBlock', argument: 'h3', state: 'block' },\n {\n feature: 'bulletList',\n label: 'Bulleted list',\n icon: 'matFormatListBulletedRound',\n command: 'insertUnorderedList',\n state: 'command'\n },\n {\n feature: 'orderedList',\n label: 'Numbered list',\n icon: 'matFormatListNumberedRound',\n command: 'insertOrderedList',\n state: 'command'\n },\n {\n feature: 'quote',\n label: 'Quote',\n icon: 'matFormatQuoteRound',\n command: 'formatBlock',\n argument: 'blockquote',\n state: 'block'\n },\n {\n feature: 'codeBlock',\n label: 'Code block',\n icon: 'matTerminalRound',\n command: 'formatBlock',\n argument: 'pre',\n state: 'block'\n },\n {\n feature: 'rule',\n label: 'Divider',\n icon: 'matHorizontalRuleRound',\n command: 'insertHorizontalRule',\n state: 'none'\n }\n];\n\nexport const XUI_RICH_TEXT_EDITOR_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => XuiRichTextEditor),\n multi: true\n};\n\n/**\n * A WYSIWYG editor whose value is source text.\n *\n * The user works on formatted content; the binding is the Markdown or BBCode\n * you store — so nothing downstream has to know an editor was involved, and\n * nothing has to be sanitised on the way out.\n *\n * ```html\n * <xui-rich-text-editor [(value)]=\"comment\" format=\"markdown\" placeholder=\"Say something…\" />\n * ```\n *\n * ```html\n * <xui-rich-text-editor formControlName=\"post\" format=\"bbcode\" />\n * ```\n *\n * The toolbar is the format's capabilities: Markdown offers headings and a\n * divider but no underline, BBCode the reverse. Teach it a new format with\n * {@link provideXuiRichTextSyntax} and the toolbar follows.\n *\n * The source view (`</>`) shows the text itself, editable, and the two stay in\n * step. Pasting always lands as plain text — foreign HTML never enters the\n * document, so the value cannot carry markup the format does not define.\n */\n@Component({\n selector: 'xui-rich-text-editor',\n imports: [NgIcon, XuiIcon],\n template: `\n <div\n role=\"toolbar\"\n aria-label=\"Formatting\"\n class=\"border-border bg-surface-sunken flex flex-wrap items-center gap-0.5 rounded-t-lg border-b p-1\"\n >\n @for (tool of tools(); track tool.feature) {\n <button\n type=\"button\"\n [class]=\"toolClass()\"\n [attr.aria-label]=\"tool.label\"\n [attr.aria-pressed]=\"tool.state === 'none' ? null : active().includes(tool.feature)\"\n [attr.data-active]=\"active().includes(tool.feature) ? '' : null\"\n [disabled]=\"isDisabled() || source()\"\n [title]=\"tool.label\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"run(tool)\"\n >\n @if (tool.icon) {\n <ng-icon xui size=\"sm\" [name]=\"tool.icon\" />\n } @else {\n <span class=\"px-0.5 text-xs font-semibold\">{{ tool.text }}</span>\n }\n </button>\n }\n\n @if (sourceView()) {\n <button\n type=\"button\"\n [class]=\"toolClass()\"\n class=\"ms-auto\"\n aria-label=\"Source\"\n [attr.aria-pressed]=\"source()\"\n [attr.data-active]=\"source() ? '' : null\"\n [disabled]=\"isDisabled()\"\n title=\"Source\"\n (click)=\"toggleSource()\"\n >\n <span class=\"px-0.5 text-xs font-semibold\">&lt;/&gt;</span>\n </button>\n }\n </div>\n\n @if (linkDraft() !== null) {\n <div class=\"border-border bg-surface-sunken flex items-center gap-1 border-b p-1\">\n <input\n #linkField\n type=\"url\"\n class=\"text-foreground placeholder:text-foreground-subtle min-w-0 flex-1 bg-transparent px-2 py-1 text-sm outline-none\"\n placeholder=\"https://example.com\"\n aria-label=\"Link URL\"\n [value]=\"linkDraft()\"\n (input)=\"linkDraft.set($any($event.target).value)\"\n (keydown.enter)=\"applyLink(); $event.preventDefault()\"\n (keydown.escape)=\"linkDraft.set(null)\"\n />\n <button type=\"button\" [class]=\"toolClass()\" class=\"text-xs\" (click)=\"applyLink()\">Apply</button>\n <button type=\"button\" [class]=\"toolClass()\" class=\"text-xs\" (click)=\"linkDraft.set(null)\">Cancel</button>\n </div>\n }\n\n @if (source()) {\n <textarea\n class=\"text-foreground placeholder:text-foreground-subtle block w-full resize-y bg-transparent p-3 font-mono text-sm outline-none\"\n [style.min-height.px]=\"minHeight()\"\n [attr.aria-label]=\"'Source (' + format() + ')'\"\n [disabled]=\"isDisabled()\"\n [value]=\"value()\"\n (input)=\"onSourceInput($event)\"\n (blur)=\"onTouched?.()\"\n ></textarea>\n } @else {\n <div class=\"relative\">\n @if (!value().trim() && placeholder()) {\n <p class=\"text-foreground-subtle pointer-events-none absolute p-3 select-none\">{{ placeholder() }}</p>\n }\n\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n #surface\n role=\"textbox\"\n aria-multiline=\"true\"\n [class]=\"surfaceClass()\"\n [style.min-height.px]=\"minHeight()\"\n [attr.contenteditable]=\"isDisabled() ? null : true\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-disabled]=\"isDisabled() ? true : null\"\n (input)=\"pull()\"\n (blur)=\"onTouched?.()\"\n (paste)=\"onPaste($event)\"\n (keydown)=\"onKeydown($event)\"\n (keyup)=\"refreshActive()\"\n (mouseup)=\"refreshActive()\"\n ></div>\n </div>\n }\n `,\n host: {\n '[class]': 'computedClass()',\n '[attr.data-disabled]': 'isDisabled() ? \"\" : null'\n },\n providers: [XUI_RICH_TEXT_EDITOR_VALUE_ACCESSOR],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n viewProviders: [\n provideIcons({\n matCodeRound,\n matFormatBoldRound,\n matFormatItalicRound,\n matFormatListBulletedRound,\n matFormatListNumberedRound,\n matFormatQuoteRound,\n matFormatStrikethroughRound,\n matFormatUnderlinedRound,\n matHorizontalRuleRound,\n matLinkRound,\n matTerminalRound\n })\n ]\n})\nexport class XuiRichTextEditor implements ControlValueAccessor {\n private readonly config = injectXuiRichTextEditorConfig();\n private readonly syntaxes = injectXuiRichTextSyntaxes();\n private readonly surface = viewChild<ElementRef<HTMLElement>>('surface');\n private readonly linkField = viewChild<ElementRef<HTMLInputElement>>('linkField');\n\n readonly class = input<ClassValue>('');\n\n /** The source text, in the active `format`. Two-way bindable, and the form value. */\n readonly value = model<string>('');\n\n /** `'markdown'`, `'bbcode'`, or any format registered with `provideXuiRichTextSyntax`. */\n readonly format = input<string>(this.config.format);\n\n readonly placeholder = input<string>(this.config.placeholder);\n\n /** Offer the source-text toggle. */\n readonly sourceView = input<boolean, BooleanInput>(this.config.sourceView, { transform: booleanAttribute });\n\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /** Height of the writing area before it grows with the content. */\n readonly minHeight = input<number>(180);\n\n readonly ariaLabel = input<string | undefined>(undefined, { alias: 'aria-label' });\n\n /** Whether the source view is showing. Two-way bindable. */\n readonly source = model(false);\n\n protected readonly linkDraft = signal<string | null>(null);\n protected readonly active = signal<XuiRichTextFeature[]>([]);\n\n private onChange?: ChangeFn<string>;\n protected onTouched?: TouchFn;\n private readonly disabledByForm = signal(false);\n protected readonly isDisabled = computed(() => this.disabled() || this.disabledByForm());\n\n /**\n * The value the surface already shows, tagged with the format it was rendered\n * in. Re-rendering the user's own keystrokes would reset the caret on every\n * one, so the effect below writes only when this no longer matches.\n */\n private synced: string | null = null;\n /** The element that value went into — the source toggle builds a new one. */\n private syncedSurface: HTMLElement | null = null;\n /** What the link is to wrap, held while the URL field has the selection. */\n private savedRange: Range | null = null;\n\n private readonly syntax = computed(() => {\n const syntax = this.syntaxes.get(this.format());\n\n if (!syntax) {\n throw new Error(\n `@xui/rich-text-editor: unknown format \"${this.format()}\". ` +\n `Known formats: ${[...this.syntaxes.keys()].join(', ')}. Register others with provideXuiRichTextSyntax().`\n );\n }\n\n return syntax;\n });\n\n protected readonly tools = computed(() => {\n const features = this.syntax().features;\n\n return TOOLS.filter(tool => features.includes(tool.feature));\n });\n\n protected readonly computedClass = computed(() =>\n xui(\n 'border-border bg-surface-inset text-foreground block overflow-hidden rounded-lg border',\n 'focus-within:border-focus transition-colors',\n 'data-disabled:cursor-not-allowed data-disabled:opacity-50',\n '[&.ng-invalid.ng-touched]:border-error',\n this.class()\n )\n );\n\n protected readonly toolClass = computed(() =>\n xui(\n 'text-foreground-muted hover:bg-surface-raised hover:text-foreground flex items-center rounded px-1.5 py-1',\n 'data-active:bg-surface-raised data-active:text-foreground disabled:pointer-events-none disabled:opacity-50',\n 'focus-visible:outline-focus focus-visible:outline-2'\n )\n );\n\n /** Tailwind resets block elements, so the writing area re-states how prose looks. */\n protected readonly surfaceClass = computed(() =>\n xui(\n 'block p-3 outline-none [&>*+*]:mt-2',\n '[&_h1]:text-2xl [&_h1]:font-semibold [&_h2]:text-xl [&_h2]:font-semibold [&_h3]:text-lg [&_h3]:font-semibold',\n '[&_ul]:list-disc [&_ol]:list-decimal [&_ul]:ps-6 [&_ol]:ps-6',\n '[&_blockquote]:border-border-strong [&_blockquote]:text-foreground-muted [&_blockquote]:border-s-2 [&_blockquote]:ps-3',\n '[&_pre]:bg-surface-sunken [&_pre]:rounded [&_pre]:p-2 [&_pre]:font-mono [&_pre]:text-sm',\n '[&_code]:bg-surface-sunken [&_code]:rounded [&_code]:px-1 [&_code]:font-mono [&_code]:text-sm',\n '[&_pre_code]:bg-transparent [&_pre_code]:p-0',\n '[&_a]:text-link [&_a]:underline',\n '[&_hr]:border-border [&_hr]:my-3'\n )\n );\n\n constructor() {\n // Enter should start a paragraph, and marks should be tags rather than\n // inline styles — otherwise there is nothing for a syntax to recognise.\n safely(() => document.execCommand?.('defaultParagraphSeparator', false, 'p'));\n safely(() => document.execCommand?.('styleWithCSS', false, 'false'));\n\n // Renders whenever the value arrives from outside — a binding, a form, the\n // source toggle — and skips the echo of the user's own typing, which would\n // otherwise reset the caret on every keystroke.\n effect(() => {\n const surface = this.surface()?.nativeElement;\n const value = this.value();\n const key = this.syncKey(value);\n\n if (!surface || (key === this.synced && surface === this.syncedSurface)) {\n return;\n }\n\n this.syncedSurface = surface;\n\n // A format switch keeps the content and changes only how it is written\n // down: the document is the same either way, so it is re-read in the new\n // format rather than re-rendered from text the new format cannot parse.\n if (this.synced && !this.synced.startsWith(`${this.format()}:`) && surface.innerHTML) {\n const translated = this.syntax().fromHtml(surface);\n\n this.synced = this.syncKey(translated);\n this.value.set(translated);\n this.onChange?.(translated);\n\n return;\n }\n\n surface.innerHTML = this.syntax().toHtml(value);\n this.synced = key;\n });\n\n effect(() => {\n if (this.linkDraft() !== null) {\n this.linkField()?.nativeElement.focus();\n }\n });\n }\n\n /** The editing surface, for consumers who need to focus it. */\n focus(): void {\n this.surface()?.nativeElement.focus();\n }\n\n /** Show the formatted view (`false`) or the source text (`true`). */\n protected toggleSource(): void {\n this.source.update(source => !source);\n }\n\n protected onSourceInput(event: Event): void {\n this.commit((event.target as HTMLTextAreaElement).value);\n }\n\n /** Reads the surface back out as source text. */\n protected pull(): void {\n const surface = this.surface()?.nativeElement;\n\n if (!surface) {\n return;\n }\n\n this.commit(this.syntax().fromHtml(surface));\n this.refreshActive();\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (!(event.metaKey || event.ctrlKey)) {\n return;\n }\n\n const tool = this.tools().find(candidate => candidate.key === event.key.toLowerCase());\n\n if (tool) {\n event.preventDefault();\n this.run(tool);\n }\n }\n\n /**\n * Paste as plain text.\n *\n * Whatever is on the clipboard — a Word document, half a web page — would\n * otherwise arrive as HTML the format cannot express and the editor would\n * have to guess at. The text is inserted as typed instead.\n */\n protected onPaste(event: ClipboardEvent): void {\n event.preventDefault();\n\n const text = event.clipboardData?.getData('text/plain') ?? '';\n\n this.exec('insertText', text);\n this.pull();\n }\n\n protected run(tool: Tool): void {\n if (this.isDisabled() || this.source()) {\n return;\n }\n\n if (tool.command === 'xuiLink') {\n // Captured before anything touches focus: the URL field is about to take\n // the document selection, and this is the range the link must wrap.\n this.savedRange = currentRange();\n // The field appears with the draft; an effect focuses it once it exists.\n this.linkDraft.set('');\n\n return;\n }\n\n this.focus();\n\n if (tool.command === 'xuiCode') {\n this.wrapSelection('code');\n } else if (tool.command === 'formatBlock') {\n // A second press on the same block returns it to a paragraph.\n const target = this.active().includes(tool.feature) ? 'p' : tool.argument!;\n\n this.exec('formatBlock', target);\n } else {\n this.exec(tool.command, tool.argument);\n }\n\n this.pull();\n }\n\n protected applyLink(): void {\n const href = this.linkDraft()?.trim();\n\n this.linkDraft.set(null);\n this.focus();\n this.restoreSelection();\n\n if (href) {\n this.exec('createLink', href);\n this.pull();\n }\n }\n\n /** Puts the caret back where it was before the URL field took focus. */\n private restoreSelection(): void {\n const selection = getSelection();\n\n if (!this.savedRange || !selection) {\n return;\n }\n\n selection.removeAllRanges();\n selection.addRange(this.savedRange);\n this.savedRange = null;\n }\n\n /** Reflects the caret's formatting on the toolbar. */\n protected refreshActive(): void {\n if (typeof document === 'undefined' || !document.queryCommandState) {\n return;\n }\n\n const block = document.queryCommandValue?.('formatBlock')?.toLowerCase();\n\n this.active.set(\n this.tools()\n .filter(tool => {\n if (tool.state === 'command') {\n return safely(() => document.queryCommandState(tool.command));\n }\n\n return tool.state === 'block' && block === tool.argument;\n })\n .map(tool => tool.feature)\n );\n }\n\n /** Wraps the selection in a tag, or unwraps it when it is already wrapped. */\n private wrapSelection(tag: string): void {\n const selection = getSelection();\n\n if (!selection?.rangeCount) {\n return;\n }\n\n const range = selection.getRangeAt(0);\n const existing = closest(range.commonAncestorContainer, tag);\n\n if (existing) {\n existing.replaceWith(...Array.from(existing.childNodes));\n\n return;\n }\n\n if (!range.collapsed) {\n this.exec('insertHTML', `<${tag}>${escapeText(range.toString())}</${tag}>`);\n }\n }\n\n private exec(command: string, argument?: string): void {\n // `execCommand` is the only editing API every browser implements for\n // contenteditable; absent under a test DOM, where nothing is being edited.\n safely(() => document.execCommand?.(command, false, argument));\n }\n\n private commit(next: string): void {\n if (next === this.value()) {\n return;\n }\n\n // The surface already shows this — recorded before the write so the render\n // effect sees it and leaves the caret where the user put it.\n this.synced = this.syncKey(next);\n this.value.set(next);\n this.onChange?.(next);\n }\n\n private syncKey(value: string): string {\n return `${this.format()}:${value}`;\n }\n\n // --- ControlValueAccessor ---\n writeValue(value: string): void {\n this.value.set(value ?? '');\n // Force the next render: the value came from outside, so whatever is in the\n // surface is stale even if the string matches what we last serialised.\n this.synced = null;\n }\n\n registerOnChange(fn: ChangeFn<string>): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: TouchFn): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabledByForm.set(isDisabled);\n }\n}\n\nfunction currentRange(): Range | null {\n const selection = getSelection();\n\n return selection?.rangeCount ? selection.getRangeAt(0).cloneRange() : null;\n}\n\n/** The nearest ancestor with `tag`, starting at `node` itself. */\nfunction closest(node: Node, tag: string): Element | null {\n const element = node instanceof Element ? node : node.parentElement;\n\n return element?.closest(tag) ?? null;\n}\n\nfunction escapeText(text: string): string {\n return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n}\n\n/** Runs `fn`, treating a DOM that does not implement it as \"no\". */\nfunction safely(fn: () => boolean | void): boolean {\n try {\n return fn() === true;\n } catch {\n return false;\n }\n}\n","import { XuiRichTextEditor } from './lib/rich-text-editor';\n\nexport * from './lib/bbcode-syntax';\nexport * from './lib/markdown-syntax';\nexport * from './lib/rich-text-editor';\nexport * from './lib/rich-text-editor.token';\nexport * from './lib/rich-text-syntax';\n\nexport const XuiRichTextEditorImports = [XuiRichTextEditor] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["FEATURES","writer","inlineToHtml"],"mappings":";;;;;;;;AA+CA,MAAM,SAAS,GAAoC;AACjD,IAAA,MAAM,EAAE,MAAM;AACd,IAAA,CAAC,EAAE,MAAM;AACT,IAAA,EAAE,EAAE,QAAQ;AACZ,IAAA,CAAC,EAAE,QAAQ;AACX,IAAA,CAAC,EAAE,WAAW;AACd,IAAA,CAAC,E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R1D;;AAEG;;;;"}
1
+ {"version":3,"file":"xui-rich-text-editor.mjs","sources":["../../../../../../libs/ui/rich-text-editor/xui/src/lib/rich-text-syntax.ts","../../../../../../libs/ui/rich-text-editor/xui/src/lib/bbcode-syntax.ts","../../../../../../libs/ui/rich-text-editor/xui/src/lib/markdown-syntax.ts","../../../../../../libs/ui/rich-text-editor/xui/src/lib/rich-text-editor.token.ts","../../../../../../libs/ui/rich-text-editor/xui/src/lib/rich-text-editor.ts","../../../../../../libs/ui/rich-text-editor/xui/src/index.ts","../../../../../../libs/ui/rich-text-editor/xui/src/xui-rich-text-editor.ts"],"sourcesContent":["/**\n * A formatting feature. The editor's toolbar offers exactly the features the\n * active syntax declares, so nothing can be applied that the format cannot\n * express — Markdown has no underline, BBCode has no headings.\n */\nexport type XuiRichTextMark = 'bold' | 'italic' | 'underline' | 'strike' | 'code' | 'link';\n\nexport type XuiRichTextBlock =\n 'heading1' | 'heading2' | 'heading3' | 'bulletList' | 'orderedList' | 'quote' | 'codeBlock' | 'rule';\n\nexport type XuiRichTextFeature = XuiRichTextMark | XuiRichTextBlock;\n\n/**\n * Turns the editor's HTML into source text.\n *\n * The editor edits one canonical HTML subset — `p`, `h1`–`h3`, `ul`/`ol`,\n * `blockquote`, `pre`, `hr` and the inline marks — and a syntax is only the\n * translation at each end. Implement one to teach the editor a new format;\n * nothing else changes.\n */\nexport interface XuiRichTextWriter {\n /** Escape text so the syntax's own punctuation is not read as markup. */\n escape(text: string): string;\n /** Wrap `inner` in a mark, or return it untouched when the syntax lacks one. */\n mark(kind: XuiRichTextMark, inner: string, href?: string): string;\n /** Wrap a block's already-serialised inline content. */\n block(kind: 'paragraph' | 'heading1' | 'heading2' | 'heading3' | 'quote', inner: string): string;\n /** A whole list, given its already-serialised items. */\n list(items: string[], ordered: boolean): string;\n /** Verbatim text — never escaped, never marked up. */\n codeBlock(text: string): string;\n /** A thematic break. */\n rule(): string;\n}\n\n/** Both directions of one text format. */\nexport interface XuiRichTextSyntax {\n /** How the format is named in the `format` input — `'markdown'`, `'bbcode'`, … */\n readonly name: string;\n /** What this format can express. Anything absent is left out of the toolbar. */\n readonly features: readonly XuiRichTextFeature[];\n /** Source text → the editor's HTML subset. Must return markup it produced itself. */\n toHtml(source: string): string;\n /** The editor's HTML → source text. */\n fromHtml(root: HTMLElement): string;\n}\n\nconst MARK_TAGS: Record<string, XuiRichTextMark> = {\n STRONG: 'bold',\n B: 'bold',\n EM: 'italic',\n I: 'italic',\n U: 'underline',\n S: 'strike',\n STRIKE: 'strike',\n DEL: 'strike',\n CODE: 'code',\n A: 'link'\n};\n\n/**\n * Walks the editor's HTML and hands each piece to `writer`.\n *\n * Shared by every syntax so they only describe *what* their markup looks like,\n * never how to traverse a DOM — and so a new syntax cannot get the traversal\n * subtly wrong.\n */\nexport function serializeHtml(root: HTMLElement, writer: XuiRichTextWriter): string {\n const blocks: string[] = [];\n\n for (const node of Array.from(root.childNodes)) {\n const block = serializeBlock(node, writer);\n\n if (block !== null) {\n blocks.push(block);\n }\n }\n\n return blocks.filter(block => block !== '').join('\\n\\n');\n}\n\nfunction serializeBlock(node: Node, writer: XuiRichTextWriter): string | null {\n if (node.nodeType === Node.TEXT_NODE) {\n const text = node.textContent ?? '';\n\n // Loose text between blocks — browsers leave it there after some edits.\n return text.trim() ? writer.block('paragraph', writer.escape(text)) : null;\n }\n\n if (!(node instanceof Element)) {\n return null;\n }\n\n switch (node.tagName) {\n case 'H1':\n return writer.block('heading1', serializeInline(node, writer));\n case 'H2':\n return writer.block('heading2', serializeInline(node, writer));\n case 'H3':\n return writer.block('heading3', serializeInline(node, writer));\n case 'BLOCKQUOTE':\n return writer.block('quote', quoteContent(node as HTMLElement, writer));\n case 'PRE':\n return writer.codeBlock(node.textContent ?? '');\n case 'HR':\n return writer.rule();\n case 'UL':\n case 'OL':\n return writer.list(\n Array.from(node.children)\n .filter(child => child.tagName === 'LI')\n .map(item => serializeInline(item, writer)),\n node.tagName === 'OL'\n );\n case 'BR':\n return null;\n default:\n // `p`, `div` (what some browsers still produce on Enter), and anything\n // else that reached the top level: treat as a paragraph.\n return writer.block('paragraph', serializeInline(node, writer));\n }\n}\n\n/** A quote may hold blocks of its own; flatten them to lines. */\nfunction quoteContent(node: HTMLElement, writer: XuiRichTextWriter): string {\n const hasBlocks = Array.from(node.children).some(child => /^(P|DIV|H[1-3])$/.test(child.tagName));\n\n if (!hasBlocks) {\n return serializeInline(node, writer);\n }\n\n return Array.from(node.children)\n .map(child => serializeInline(child, writer))\n .filter(Boolean)\n .join('\\n');\n}\n\nfunction serializeInline(node: Node, writer: XuiRichTextWriter): string {\n let out = '';\n\n for (const child of Array.from(node.childNodes)) {\n if (child.nodeType === Node.TEXT_NODE) {\n out += writer.escape(child.textContent ?? '');\n continue;\n }\n\n if (!(child instanceof Element)) {\n continue;\n }\n\n if (child.tagName === 'BR') {\n out += '\\n';\n continue;\n }\n\n const mark = MARK_TAGS[child.tagName];\n const inner = child.tagName === 'CODE' ? writer.escape(child.textContent ?? '') : serializeInline(child, writer);\n\n out += mark ? writer.mark(mark, inner, child.getAttribute('href') ?? undefined) : inner;\n }\n\n return out;\n}\n\n/** Escapes text for insertion into the editor's HTML. */\nexport function escapeHtml(text: string): string {\n return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;');\n}\n\n/**\n * Keeps `javascript:` and friends out of an `href`.\n *\n * Source text is user input as far as this package is concerned — a comment, a\n * forum post — so a link is only ever emitted when its scheme is one that can\n * do nothing but navigate.\n */\nexport function sanitizeUrl(url: string): string {\n const trimmed = url.trim();\n\n return /^(https?:|mailto:|tel:|\\/|#|\\.)/i.test(trimmed) ? trimmed : '';\n}\n","import {\n escapeHtml,\n sanitizeUrl,\n serializeHtml,\n type XuiRichTextFeature,\n type XuiRichTextSyntax,\n type XuiRichTextWriter\n} from './rich-text-syntax';\n\n/**\n * The BBCode this syntax reads and writes.\n *\n * The tags every forum agrees on. BBCode has underline, which Markdown lacks;\n * it has no headings and no thematic break, so the toolbar drops those — the\n * format decides what the toolbar offers, not the other way round.\n */\nconst FEATURES: readonly XuiRichTextFeature[] = [\n 'bold',\n 'italic',\n 'underline',\n 'strike',\n 'link',\n 'bulletList',\n 'orderedList',\n 'quote',\n 'codeBlock'\n];\n\nconst writer: XuiRichTextWriter = {\n // BBCode has no escape character. A stray `[` is only ambiguous next to a tag\n // name, so that is the one case worth neutralising.\n escape: text => text.replace(/\\[(?=\\/?[a-z*]+[\\]=])/gi, '&#91;'),\n mark: (kind, inner, href) => {\n switch (kind) {\n case 'bold':\n return `[b]${inner}[/b]`;\n case 'italic':\n return `[i]${inner}[/i]`;\n case 'underline':\n return `[u]${inner}[/u]`;\n case 'strike':\n return `[s]${inner}[/s]`;\n case 'link':\n return href ? `[url=${href}]${inner}[/url]` : inner;\n // No inline-code tag in BBCode: `[code]` is a block everywhere.\n default:\n return inner;\n }\n },\n block: (kind, inner) => {\n switch (kind) {\n case 'quote':\n return `[quote]${inner}[/quote]`;\n // Headings degrade to plain paragraphs rather than to a `[size]` guess.\n default:\n return inner;\n }\n },\n list: (items, ordered) => [ordered ? '[list=1]' : '[list]', ...items.map(item => `[*]${item}`), '[/list]'].join('\\n'),\n codeBlock: text => `[code]\\n${text.replace(/\\n$/, '')}\\n[/code]`,\n rule: () => ''\n};\n\n/** BBCode ⇄ the editor's HTML. */\nexport const bbcodeSyntax: XuiRichTextSyntax = {\n name: 'bbcode',\n features: FEATURES,\n fromHtml: root => serializeHtml(root, writer),\n toHtml: source => bbcodeToHtml(source)\n};\n\n/** `[tag]…[/tag]` → HTML element, innermost pair first. */\nconst PAIRS: [RegExp, string][] = [\n [/\\[b]([\\s\\S]*?)\\[\\/b]/gi, '<strong>$1</strong>'],\n [/\\[i]([\\s\\S]*?)\\[\\/i]/gi, '<em>$1</em>'],\n [/\\[u]([\\s\\S]*?)\\[\\/u]/gi, '<u>$1</u>'],\n [/\\[s]([\\s\\S]*?)\\[\\/s]/gi, '<s>$1</s>']\n];\n\nfunction bbcodeToHtml(source: string): string {\n const blocks = splitBlocks(source.replace(/\\r\\n?/g, '\\n'));\n\n return blocks.join('');\n}\n\n/**\n * Block tags first — they own whole lines and may hold inline markup — then\n * whatever is left becomes paragraphs.\n */\nfunction splitBlocks(source: string): string[] {\n const html: string[] = [];\n const pattern = /\\[(code|quote|list)(=1)?]([\\s\\S]*?)\\[\\/\\1]/gi;\n let cursor = 0;\n let match: RegExpExecArray | null;\n\n while ((match = pattern.exec(source)) !== null) {\n html.push(...paragraphs(source.slice(cursor, match.index)));\n cursor = match.index + match[0].length;\n\n const [, tag, ordered, body] = match;\n\n if (tag.toLowerCase() === 'code') {\n html.push(`<pre>${escapeHtml(body.replace(/^\\n|\\n$/g, ''))}</pre>`);\n continue;\n }\n\n if (tag.toLowerCase() === 'quote') {\n html.push(`<blockquote>${paragraphs(body).join('') || '<p></p>'}</blockquote>`);\n continue;\n }\n\n const items = body\n .split(/\\[\\*]/)\n .map(item => item.trim())\n .filter(Boolean)\n .map(item => `<li>${inlineToHtml(item)}</li>`)\n .join('');\n\n html.push(ordered ? `<ol>${items}</ol>` : `<ul>${items}</ul>`);\n }\n\n html.push(...paragraphs(source.slice(cursor)));\n\n return html;\n}\n\nfunction paragraphs(source: string): string[] {\n return source\n .split(/\\n{2,}/)\n .map(block => block.replace(/^\\n+|\\n+$/g, ''))\n .filter(block => block.trim())\n .map(block => `<p>${block.split('\\n').map(inlineToHtml).join('<br>')}</p>`);\n}\n\nfunction inlineToHtml(text: string): string {\n let out = escapeHtml(text).replace(\n /\\[url(?:=([^\\]]+))?]([\\s\\S]*?)\\[\\/url]/gi,\n (match, href: string, label: string) => {\n const url = sanitizeUrl(href ?? label);\n\n return url ? `<a href=\"${escapeHtml(url)}\">${label || escapeHtml(url)}</a>` : match;\n }\n );\n\n for (const [pattern, replacement] of PAIRS) {\n // Non-greedy matches close the innermost pair first, so repeating until the\n // text settles unwraps nested tags from the inside out.\n let previous: string;\n\n do {\n previous = out;\n out = out.replace(pattern, replacement);\n } while (out !== previous);\n }\n\n return out;\n}\n","import {\n escapeHtml,\n sanitizeUrl,\n serializeHtml,\n type XuiRichTextFeature,\n type XuiRichTextSyntax,\n type XuiRichTextWriter\n} from './rich-text-syntax';\n\n/**\n * The Markdown this syntax reads and writes.\n *\n * A deliberately small, portable subset — what a comment box needs and what\n * every Markdown renderer agrees on. No tables, footnotes, images or HTML\n * passthrough; no underline, which Markdown has no syntax for.\n */\nconst FEATURES: readonly XuiRichTextFeature[] = [\n 'bold',\n 'italic',\n 'strike',\n 'code',\n 'link',\n 'heading1',\n 'heading2',\n 'heading3',\n 'bulletList',\n 'orderedList',\n 'quote',\n 'codeBlock',\n 'rule'\n];\n\nconst writer: XuiRichTextWriter = {\n escape: text => text.replace(/([\\\\`*_[\\]#>~])/g, '\\\\$1'),\n mark: (kind, inner, href) => {\n switch (kind) {\n case 'bold':\n return `**${inner}**`;\n case 'italic':\n return `*${inner}*`;\n case 'strike':\n return `~~${inner}~~`;\n case 'code':\n // Code spans are verbatim, so the backslashes `escape` added are noise.\n return `\\`${inner.replace(/\\\\([\\\\`*_[\\]#>~])/g, '$1')}\\``;\n case 'link':\n return href ? `[${inner}](${href})` : inner;\n // Markdown cannot underline. Rather than invent `<u>`, the text stays put.\n default:\n return inner;\n }\n },\n block: (kind, inner) => {\n switch (kind) {\n case 'heading1':\n return `# ${inner}`;\n case 'heading2':\n return `## ${inner}`;\n case 'heading3':\n return `### ${inner}`;\n case 'quote':\n return inner\n .split('\\n')\n .map(line => `> ${line}`)\n .join('\\n');\n default:\n return inner;\n }\n },\n list: (items, ordered) => items.map((item, index) => (ordered ? `${index + 1}. ${item}` : `- ${item}`)).join('\\n'),\n codeBlock: text => `\\`\\`\\`\\n${text.replace(/\\n$/, '')}\\n\\`\\`\\``,\n rule: () => '---'\n};\n\n/** Markdown ⇄ the editor's HTML. */\nexport const markdownSyntax: XuiRichTextSyntax = {\n name: 'markdown',\n features: FEATURES,\n fromHtml: root => serializeHtml(root, writer),\n toHtml: source => blocksToHtml(source)\n};\n\nfunction blocksToHtml(source: string): string {\n const lines = source.replace(/\\r\\n?/g, '\\n').split('\\n');\n const html: string[] = [];\n let index = 0;\n\n while (index < lines.length) {\n const line = lines[index];\n\n if (!line.trim()) {\n index++;\n continue;\n }\n\n // Fenced code: verbatim until the closing fence, or the end of the input.\n if (/^```/.test(line)) {\n const code: string[] = [];\n\n index++;\n\n while (index < lines.length && !/^```/.test(lines[index])) {\n code.push(lines[index++]);\n }\n\n index++;\n html.push(`<pre>${escapeHtml(code.join('\\n'))}</pre>`);\n continue;\n }\n\n const heading = /^(#{1,3})\\s+(.*)$/.exec(line);\n\n if (heading) {\n const level = heading[1].length;\n\n html.push(`<h${level}>${inlineToHtml(heading[2])}</h${level}>`);\n index++;\n continue;\n }\n\n if (/^(\\s*[-*_]){3,}\\s*$/.test(line)) {\n html.push('<hr>');\n index++;\n continue;\n }\n\n if (/^>\\s?/.test(line)) {\n const quoted: string[] = [];\n\n while (index < lines.length && /^>\\s?/.test(lines[index])) {\n quoted.push(lines[index++].replace(/^>\\s?/, ''));\n }\n\n html.push(`<blockquote>${quoted.map(text => `<p>${inlineToHtml(text)}</p>`).join('')}</blockquote>`);\n continue;\n }\n\n const bullet = /^\\s*[-*+]\\s+/;\n const ordered = /^\\s*\\d+[.)]\\s+/;\n\n if (bullet.test(line) || ordered.test(line)) {\n const isOrdered = ordered.test(line);\n const marker = isOrdered ? ordered : bullet;\n const items: string[] = [];\n\n while (index < lines.length && marker.test(lines[index])) {\n items.push(`<li>${inlineToHtml(lines[index++].replace(marker, ''))}</li>`);\n }\n\n html.push(isOrdered ? `<ol>${items.join('')}</ol>` : `<ul>${items.join('')}</ul>`);\n continue;\n }\n\n // Anything else runs on as a paragraph until a blank line or a new block.\n const paragraph: string[] = [];\n\n while (index < lines.length && lines[index].trim() && !startsBlock(lines[index])) {\n paragraph.push(lines[index++]);\n }\n\n html.push(`<p>${paragraph.map(inlineToHtml).join('<br>')}</p>`);\n }\n\n return html.join('');\n}\n\nfunction startsBlock(line: string): boolean {\n return /^(```|#{1,3}\\s|>|\\s*[-*+]\\s|\\s*\\d+[.)]\\s)/.test(line) || /^(\\s*[-*_]){3,}\\s*$/.test(line);\n}\n\n/**\n * Stand-ins for the two things that must sit out the emphasis passes: a code\n * span, and a backslash-escaped character. Private-use codepoints, so nothing a\n * user can type collides with them.\n */\nconst SPAN = String.fromCharCode(0xe000);\nconst ESCAPED = String.fromCharCode(0xe001);\n\n/**\n * Inline Markdown → HTML.\n *\n * Code spans and escapes are lifted out first and put back last. That is what\n * keeps `**` inside a code span from turning bold, and `\\*` from being read as\n * emphasis at all — both are invisible to the passes in between.\n */\nfunction inlineToHtml(text: string): string {\n const codeSpans: string[] = [];\n const escapes: string[] = [];\n\n let out = escapeHtml(text)\n .replace(/`([^`]+)`/g, (_, code: string) => {\n codeSpans.push(code);\n\n return `${SPAN}${codeSpans.length - 1}${SPAN}`;\n })\n .replace(/\\\\([\\\\`*_[\\]#>~])/g, (_, char: string) => {\n escapes.push(char);\n\n return `${ESCAPED}${escapes.length - 1}${ESCAPED}`;\n });\n\n out = out\n .replace(/\\[([^\\]]+)]\\(([^)\\s]+)\\)/g, (match, label: string, href: string) => {\n const url = sanitizeUrl(href);\n\n return url ? `<a href=\"${escapeHtml(url)}\">${label}</a>` : match;\n })\n .replace(/(\\*\\*|__)(?=\\S)([\\s\\S]*?\\S)\\1/g, '<strong>$2</strong>')\n .replace(/(?<![*\\w])\\*(?=\\S)([^*]*?\\S)\\*(?![*\\w])/g, '<em>$1</em>')\n .replace(/(?<![_\\w])_(?=\\S)([^_]*?\\S)_(?![_\\w])/g, '<em>$1</em>')\n .replace(/~~(?=\\S)([\\s\\S]*?\\S)~~/g, '<s>$1</s>');\n\n return out\n .replace(new RegExp(`${ESCAPED}(\\\\d+)${ESCAPED}`, 'g'), (_, index: string) => escapes[Number(index)])\n .replace(new RegExp(`${SPAN}(\\\\d+)${SPAN}`, 'g'), (_, index: string) => `<code>${codeSpans[Number(index)]}</code>`);\n}\n","import { InjectionToken, inject, type Provider } from '@angular/core';\nimport { createXConfigToken } from '@xui/core';\nimport { bbcodeSyntax } from './bbcode-syntax';\nimport { markdownSyntax } from './markdown-syntax';\nimport type { XuiRichTextSyntax } from './rich-text-syntax';\n\nexport interface XuiRichTextEditorConfig {\n /** Which format new editors start in. */\n format: string;\n /** Text shown while the editor is empty. */\n placeholder: string;\n /** Offer the source-text view alongside the formatted one. */\n sourceView: boolean;\n}\n\n/** Application-wide defaults for every editor. Individual inputs still win. */\nexport const [injectXuiRichTextEditorConfig, provideXuiRichTextEditorConfig] =\n createXConfigToken<XuiRichTextEditorConfig>('XuiRichTextEditorConfig', {\n format: 'markdown',\n placeholder: '',\n sourceView: true\n });\n\nconst XuiRichTextSyntaxToken = new InjectionToken<readonly XuiRichTextSyntax[]>('XuiRichTextSyntax');\n\n/**\n * Teaches the editor a format.\n *\n * Markdown and BBCode are built in; this adds to them, or replaces one by\n * registering a syntax under the same name — the last one provided wins, so an\n * app can swap in its own flavour of Markdown without forking the editor.\n *\n * ```ts\n * provideXuiRichTextSyntax({\n * name: 'plain',\n * features: ['bold'],\n * toHtml: text => `<p>${text}</p>`,\n * fromHtml: root => root.textContent ?? ''\n * });\n * ```\n */\nexport function provideXuiRichTextSyntax(...syntaxes: XuiRichTextSyntax[]): Provider {\n return { provide: XuiRichTextSyntaxToken, useValue: syntaxes, multi: true };\n}\n\n/**\n * Every known syntax, by name. Built-ins first, so anything provided by the app\n * that reuses a name replaces it.\n */\nexport function injectXuiRichTextSyntaxes(): Map<string, XuiRichTextSyntax> {\n const provided = inject(XuiRichTextSyntaxToken, { optional: true }) as XuiRichTextSyntax[][] | null;\n\n return new Map([markdownSyntax, bbcodeSyntax, ...(provided ?? []).flat()].map(syntax => [syntax.name, syntax]));\n}\n","import type { BooleanInput } from '@angular/cdk/coercion';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n effect,\n input,\n model,\n signal,\n viewChild\n} from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport {\n matCodeRound,\n matFormatBoldRound,\n matFormatItalicRound,\n matFormatListBulletedRound,\n matFormatListNumberedRound,\n matFormatQuoteRound,\n matFormatStrikethroughRound,\n matFormatUnderlinedRound,\n matHorizontalRuleRound,\n matLinkRound,\n matTerminalRound\n} from '@ng-icons/material-icons/round';\nimport { xui } from '@xui/core';\nimport { createXValueAccessor, provideXValueAccessor } from '@xui/core/forms';\nimport { XuiIcon } from '@xui/icon';\nimport type { ClassValue } from 'clsx';\nimport { injectXuiRichTextEditorConfig, injectXuiRichTextSyntaxes } from './rich-text-editor.token';\nimport type { XuiRichTextFeature } from './rich-text-syntax';\n\ninterface Tool {\n readonly feature: XuiRichTextFeature;\n readonly label: string;\n readonly icon?: string;\n readonly text?: string;\n /** `document.execCommand` name, and its argument where one is needed. */\n readonly command: string;\n readonly argument?: string;\n /** How the button's pressed state is read back from the document. */\n readonly state: 'command' | 'block' | 'none';\n readonly key?: string;\n}\n\n/**\n * The full toolbar, in order. Each editor shows the entries its format can\n * express — the same button set can therefore never produce markup the format\n * cannot round-trip.\n */\nconst TOOLS: readonly Tool[] = [\n { feature: 'bold', label: 'Bold', icon: 'matFormatBoldRound', command: 'bold', state: 'command', key: 'b' },\n { feature: 'italic', label: 'Italic', icon: 'matFormatItalicRound', command: 'italic', state: 'command', key: 'i' },\n {\n feature: 'underline',\n label: 'Underline',\n icon: 'matFormatUnderlinedRound',\n command: 'underline',\n state: 'command',\n key: 'u'\n },\n {\n feature: 'strike',\n label: 'Strikethrough',\n icon: 'matFormatStrikethroughRound',\n command: 'strikeThrough',\n state: 'command'\n },\n { feature: 'code', label: 'Inline code', icon: 'matCodeRound', command: 'xuiCode', state: 'none' },\n { feature: 'link', label: 'Link', icon: 'matLinkRound', command: 'xuiLink', state: 'none', key: 'k' },\n { feature: 'heading1', label: 'Heading 1', text: 'H1', command: 'formatBlock', argument: 'h1', state: 'block' },\n { feature: 'heading2', label: 'Heading 2', text: 'H2', command: 'formatBlock', argument: 'h2', state: 'block' },\n { feature: 'heading3', label: 'Heading 3', text: 'H3', command: 'formatBlock', argument: 'h3', state: 'block' },\n {\n feature: 'bulletList',\n label: 'Bulleted list',\n icon: 'matFormatListBulletedRound',\n command: 'insertUnorderedList',\n state: 'command'\n },\n {\n feature: 'orderedList',\n label: 'Numbered list',\n icon: 'matFormatListNumberedRound',\n command: 'insertOrderedList',\n state: 'command'\n },\n {\n feature: 'quote',\n label: 'Quote',\n icon: 'matFormatQuoteRound',\n command: 'formatBlock',\n argument: 'blockquote',\n state: 'block'\n },\n {\n feature: 'codeBlock',\n label: 'Code block',\n icon: 'matTerminalRound',\n command: 'formatBlock',\n argument: 'pre',\n state: 'block'\n },\n {\n feature: 'rule',\n label: 'Divider',\n icon: 'matHorizontalRuleRound',\n command: 'insertHorizontalRule',\n state: 'none'\n }\n];\n\n/**\n * A WYSIWYG editor whose value is source text.\n *\n * The user works on formatted content; the binding is the Markdown or BBCode\n * you store — so nothing downstream has to know an editor was involved, and\n * nothing has to be sanitised on the way out.\n *\n * ```html\n * <xui-rich-text-editor [(value)]=\"comment\" format=\"markdown\" placeholder=\"Say something…\" />\n * ```\n *\n * ```html\n * <xui-rich-text-editor formControlName=\"post\" format=\"bbcode\" />\n * ```\n *\n * The toolbar is the format's capabilities: Markdown offers headings and a\n * divider but no underline, BBCode the reverse. Teach it a new format with\n * {@link provideXuiRichTextSyntax} and the toolbar follows.\n *\n * The source view (`</>`) shows the text itself, editable, and the two stay in\n * step. Pasting always lands as plain text — foreign HTML never enters the\n * document, so the value cannot carry markup the format does not define.\n */\n@Component({\n selector: 'xui-rich-text-editor',\n imports: [NgIcon, XuiIcon],\n template: `\n <div\n role=\"toolbar\"\n aria-label=\"Formatting\"\n class=\"border-border bg-surface-sunken flex flex-wrap items-center gap-0.5 rounded-t-lg border-b p-1\"\n >\n @for (tool of tools(); track tool.feature) {\n <button\n type=\"button\"\n [class]=\"toolClass()\"\n [attr.aria-label]=\"tool.label\"\n [attr.aria-pressed]=\"tool.state === 'none' ? null : active().includes(tool.feature)\"\n [attr.data-active]=\"active().includes(tool.feature) ? '' : null\"\n [disabled]=\"isDisabled() || source()\"\n [title]=\"tool.label\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"run(tool)\"\n >\n @if (tool.icon) {\n <ng-icon xui size=\"sm\" [name]=\"tool.icon\" />\n } @else {\n <span class=\"px-0.5 text-xs font-semibold\">{{ tool.text }}</span>\n }\n </button>\n }\n\n @if (sourceView()) {\n <button\n type=\"button\"\n [class]=\"toolClass()\"\n class=\"ms-auto\"\n aria-label=\"Source\"\n [attr.aria-pressed]=\"source()\"\n [attr.data-active]=\"source() ? '' : null\"\n [disabled]=\"isDisabled()\"\n title=\"Source\"\n (click)=\"toggleSource()\"\n >\n <span class=\"px-0.5 text-xs font-semibold\">&lt;/&gt;</span>\n </button>\n }\n </div>\n\n @if (linkDraft() !== null) {\n <div class=\"border-border bg-surface-sunken flex items-center gap-1 border-b p-1\">\n <input\n #linkField\n type=\"url\"\n class=\"text-foreground placeholder:text-foreground-subtle min-w-0 flex-1 bg-transparent px-2 py-1 text-sm outline-none\"\n placeholder=\"https://example.com\"\n aria-label=\"Link URL\"\n [value]=\"linkDraft()\"\n (input)=\"linkDraft.set($any($event.target).value)\"\n (keydown.enter)=\"applyLink(); $event.preventDefault()\"\n (keydown.escape)=\"linkDraft.set(null)\"\n />\n <button type=\"button\" [class]=\"toolClass()\" class=\"text-xs\" (click)=\"applyLink()\">Apply</button>\n <button type=\"button\" [class]=\"toolClass()\" class=\"text-xs\" (click)=\"linkDraft.set(null)\">Cancel</button>\n </div>\n }\n\n @if (source()) {\n <textarea\n class=\"text-foreground placeholder:text-foreground-subtle block w-full resize-y bg-transparent p-3 font-mono text-sm outline-none\"\n [style.min-height.px]=\"minHeight()\"\n [attr.aria-label]=\"'Source (' + format() + ')'\"\n [disabled]=\"isDisabled()\"\n [value]=\"value()\"\n (input)=\"onSourceInput($event)\"\n (blur)=\"cva.markTouched()\"\n ></textarea>\n } @else {\n <div class=\"relative\">\n @if (!value().trim() && placeholder()) {\n <p class=\"text-foreground-subtle pointer-events-none absolute p-3 select-none\">{{ placeholder() }}</p>\n }\n\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n #surface\n role=\"textbox\"\n aria-multiline=\"true\"\n [class]=\"surfaceClass()\"\n [style.min-height.px]=\"minHeight()\"\n [attr.contenteditable]=\"isDisabled() ? null : true\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-disabled]=\"isDisabled() ? true : null\"\n (input)=\"pull()\"\n (blur)=\"cva.markTouched()\"\n (paste)=\"onPaste($event)\"\n (keydown)=\"onKeydown($event)\"\n (keyup)=\"refreshActive()\"\n (mouseup)=\"refreshActive()\"\n ></div>\n </div>\n }\n `,\n host: {\n '[class]': 'computedClass()',\n '[attr.data-disabled]': 'isDisabled() ? \"\" : null'\n },\n providers: [provideXValueAccessor(() => XuiRichTextEditor)],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n viewProviders: [\n provideIcons({\n matCodeRound,\n matFormatBoldRound,\n matFormatItalicRound,\n matFormatListBulletedRound,\n matFormatListNumberedRound,\n matFormatQuoteRound,\n matFormatStrikethroughRound,\n matFormatUnderlinedRound,\n matHorizontalRuleRound,\n matLinkRound,\n matTerminalRound\n })\n ]\n})\nexport class XuiRichTextEditor implements ControlValueAccessor {\n private readonly config = injectXuiRichTextEditorConfig();\n private readonly syntaxes = injectXuiRichTextSyntaxes();\n private readonly surface = viewChild<ElementRef<HTMLElement>>('surface');\n private readonly linkField = viewChild<ElementRef<HTMLInputElement>>('linkField');\n\n readonly class = input<ClassValue>('');\n\n /** The source text, in the active `format`. Two-way bindable, and the form value. */\n readonly value = model<string>('');\n\n /** `'markdown'`, `'bbcode'`, or any format registered with `provideXuiRichTextSyntax`. */\n readonly format = input<string>(this.config.format);\n\n readonly placeholder = input<string>(this.config.placeholder);\n\n /** Offer the source-text toggle. */\n readonly sourceView = input<boolean, BooleanInput>(this.config.sourceView, { transform: booleanAttribute });\n\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /** Height of the writing area before it grows with the content. */\n readonly minHeight = input<number>(180);\n\n readonly ariaLabel = input<string | undefined>(undefined, { alias: 'aria-label' });\n\n /** Whether the source view is showing. Two-way bindable. */\n readonly source = model(false);\n\n protected readonly linkDraft = signal<string | null>(null);\n protected readonly active = signal<XuiRichTextFeature[]>([]);\n\n protected readonly cva = createXValueAccessor<string>({\n onWrite: value => {\n this.value.set(value ?? '');\n // Force the next render: the value came from outside, so whatever is in\n // the surface is stale even if the string matches what we last serialised.\n this.synced = null;\n },\n disabled: this.disabled\n });\n protected readonly isDisabled = this.cva.disabled;\n\n /**\n * The value the surface already shows, tagged with the format it was rendered\n * in. Re-rendering the user's own keystrokes would reset the caret on every\n * one, so the effect below writes only when this no longer matches.\n */\n private synced: string | null = null;\n /** The element that value went into — the source toggle builds a new one. */\n private syncedSurface: HTMLElement | null = null;\n /** What the link is to wrap, held while the URL field has the selection. */\n private savedRange: Range | null = null;\n\n private readonly syntax = computed(() => {\n const syntax = this.syntaxes.get(this.format());\n\n if (!syntax) {\n throw new Error(\n `@xui/rich-text-editor: unknown format \"${this.format()}\". ` +\n `Known formats: ${[...this.syntaxes.keys()].join(', ')}. Register others with provideXuiRichTextSyntax().`\n );\n }\n\n return syntax;\n });\n\n protected readonly tools = computed(() => {\n const features = this.syntax().features;\n\n return TOOLS.filter(tool => features.includes(tool.feature));\n });\n\n protected readonly computedClass = computed(() =>\n xui(\n 'border-border bg-surface-inset text-foreground block overflow-hidden rounded-lg border',\n 'focus-within:border-focus transition-colors',\n 'data-disabled:cursor-not-allowed data-disabled:opacity-50',\n '[&.ng-invalid.ng-touched]:border-error',\n this.class()\n )\n );\n\n protected readonly toolClass = computed(() =>\n xui(\n 'text-foreground-muted hover:bg-surface-raised hover:text-foreground flex items-center rounded px-1.5 py-1',\n 'data-active:bg-surface-raised data-active:text-foreground disabled:pointer-events-none disabled:opacity-50'\n )\n );\n\n /** Tailwind resets block elements, so the writing area re-states how prose looks. */\n protected readonly surfaceClass = computed(() =>\n xui(\n 'block p-3 outline-none [&>*+*]:mt-2',\n '[&_h1]:text-2xl [&_h1]:font-semibold [&_h2]:text-xl [&_h2]:font-semibold [&_h3]:text-lg [&_h3]:font-semibold',\n '[&_ul]:list-disc [&_ol]:list-decimal [&_ul]:ps-6 [&_ol]:ps-6',\n '[&_blockquote]:border-border-strong [&_blockquote]:text-foreground-muted [&_blockquote]:border-s-2 [&_blockquote]:ps-3',\n '[&_pre]:bg-surface-sunken [&_pre]:rounded [&_pre]:p-2 [&_pre]:font-mono [&_pre]:text-sm',\n '[&_code]:bg-surface-sunken [&_code]:rounded [&_code]:px-1 [&_code]:font-mono [&_code]:text-sm',\n '[&_pre_code]:bg-transparent [&_pre_code]:p-0',\n '[&_a]:text-link [&_a]:underline',\n '[&_hr]:border-border [&_hr]:my-3'\n )\n );\n\n constructor() {\n // Enter should start a paragraph, and marks should be tags rather than\n // inline styles — otherwise there is nothing for a syntax to recognise.\n safely(() => document.execCommand?.('defaultParagraphSeparator', false, 'p'));\n safely(() => document.execCommand?.('styleWithCSS', false, 'false'));\n\n // Renders whenever the value arrives from outside — a binding, a form, the\n // source toggle — and skips the echo of the user's own typing, which would\n // otherwise reset the caret on every keystroke.\n effect(() => {\n const surface = this.surface()?.nativeElement;\n const value = this.value();\n const key = this.syncKey(value);\n\n if (!surface || (key === this.synced && surface === this.syncedSurface)) {\n return;\n }\n\n this.syncedSurface = surface;\n\n // A format switch keeps the content and changes only how it is written\n // down: the document is the same either way, so it is re-read in the new\n // format rather than re-rendered from text the new format cannot parse.\n if (this.synced && !this.synced.startsWith(`${this.format()}:`) && surface.innerHTML) {\n const translated = this.syntax().fromHtml(surface);\n\n this.synced = this.syncKey(translated);\n this.value.set(translated);\n this.cva.notifyChange(translated);\n\n return;\n }\n\n surface.innerHTML = this.syntax().toHtml(value);\n this.synced = key;\n });\n\n effect(() => {\n if (this.linkDraft() !== null) {\n this.linkField()?.nativeElement.focus();\n }\n });\n }\n\n /** The editing surface, for consumers who need to focus it. */\n focus(): void {\n this.surface()?.nativeElement.focus();\n }\n\n /** Show the formatted view (`false`) or the source text (`true`). */\n protected toggleSource(): void {\n this.source.update(source => !source);\n }\n\n protected onSourceInput(event: Event): void {\n this.commit((event.target as HTMLTextAreaElement).value);\n }\n\n /** Reads the surface back out as source text. */\n protected pull(): void {\n const surface = this.surface()?.nativeElement;\n\n if (!surface) {\n return;\n }\n\n this.commit(this.syntax().fromHtml(surface));\n this.refreshActive();\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (!(event.metaKey || event.ctrlKey)) {\n return;\n }\n\n const tool = this.tools().find(candidate => candidate.key === event.key.toLowerCase());\n\n if (tool) {\n event.preventDefault();\n this.run(tool);\n }\n }\n\n /**\n * Paste as plain text.\n *\n * Whatever is on the clipboard — a Word document, half a web page — would\n * otherwise arrive as HTML the format cannot express and the editor would\n * have to guess at. The text is inserted as typed instead.\n */\n protected onPaste(event: ClipboardEvent): void {\n event.preventDefault();\n\n const text = event.clipboardData?.getData('text/plain') ?? '';\n\n this.exec('insertText', text);\n this.pull();\n }\n\n protected run(tool: Tool): void {\n if (this.isDisabled() || this.source()) {\n return;\n }\n\n if (tool.command === 'xuiLink') {\n // Captured before anything touches focus: the URL field is about to take\n // the document selection, and this is the range the link must wrap.\n this.savedRange = currentRange();\n // The field appears with the draft; an effect focuses it once it exists.\n this.linkDraft.set('');\n\n return;\n }\n\n this.focus();\n\n if (tool.command === 'xuiCode') {\n this.wrapSelection('code');\n } else if (tool.command === 'formatBlock') {\n // A second press on the same block returns it to a paragraph.\n const target = this.active().includes(tool.feature) ? 'p' : tool.argument!;\n\n this.exec('formatBlock', target);\n } else {\n this.exec(tool.command, tool.argument);\n }\n\n this.pull();\n }\n\n protected applyLink(): void {\n const href = this.linkDraft()?.trim();\n\n this.linkDraft.set(null);\n this.focus();\n this.restoreSelection();\n\n if (href) {\n this.exec('createLink', href);\n this.pull();\n }\n }\n\n /** Puts the caret back where it was before the URL field took focus. */\n private restoreSelection(): void {\n const selection = getSelection();\n\n if (!this.savedRange || !selection) {\n return;\n }\n\n selection.removeAllRanges();\n selection.addRange(this.savedRange);\n this.savedRange = null;\n }\n\n /** Reflects the caret's formatting on the toolbar. */\n protected refreshActive(): void {\n if (typeof document === 'undefined' || !document.queryCommandState) {\n return;\n }\n\n const block = document.queryCommandValue?.('formatBlock')?.toLowerCase();\n\n this.active.set(\n this.tools()\n .filter(tool => {\n if (tool.state === 'command') {\n return safely(() => document.queryCommandState(tool.command));\n }\n\n return tool.state === 'block' && block === tool.argument;\n })\n .map(tool => tool.feature)\n );\n }\n\n /** Wraps the selection in a tag, or unwraps it when it is already wrapped. */\n private wrapSelection(tag: string): void {\n const selection = getSelection();\n\n if (!selection?.rangeCount) {\n return;\n }\n\n const range = selection.getRangeAt(0);\n const existing = closest(range.commonAncestorContainer, tag);\n\n if (existing) {\n existing.replaceWith(...Array.from(existing.childNodes));\n\n return;\n }\n\n if (!range.collapsed) {\n this.exec('insertHTML', `<${tag}>${escapeText(range.toString())}</${tag}>`);\n }\n }\n\n private exec(command: string, argument?: string): void {\n // `execCommand` is the only editing API every browser implements for\n // contenteditable; absent under a test DOM, where nothing is being edited.\n safely(() => document.execCommand?.(command, false, argument));\n }\n\n private commit(next: string): void {\n if (next === this.value()) {\n return;\n }\n\n // The surface already shows this — recorded before the write so the render\n // effect sees it and leaves the caret where the user put it.\n this.synced = this.syncKey(next);\n this.value.set(next);\n this.cva.notifyChange(next);\n }\n\n private syncKey(value: string): string {\n return `${this.format()}:${value}`;\n }\n\n // --- ControlValueAccessor ---\n readonly writeValue = this.cva.writeValue;\n readonly registerOnChange = this.cva.registerOnChange;\n readonly registerOnTouched = this.cva.registerOnTouched;\n readonly setDisabledState = this.cva.setDisabledState;\n}\n\nfunction currentRange(): Range | null {\n const selection = getSelection();\n\n return selection?.rangeCount ? selection.getRangeAt(0).cloneRange() : null;\n}\n\n/** The nearest ancestor with `tag`, starting at `node` itself. */\nfunction closest(node: Node, tag: string): Element | null {\n const element = node instanceof Element ? node : node.parentElement;\n\n return element?.closest(tag) ?? null;\n}\n\nfunction escapeText(text: string): string {\n return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n}\n\n/** Runs `fn`, treating a DOM that does not implement it as \"no\". */\nfunction safely(fn: () => boolean | void): boolean {\n try {\n return fn() === true;\n } catch {\n return false;\n }\n}\n","import { XuiRichTextEditor } from './lib/rich-text-editor';\n\nexport * from './lib/bbcode-syntax';\nexport * from './lib/markdown-syntax';\nexport * from './lib/rich-text-editor';\nexport * from './lib/rich-text-editor.token';\nexport * from './lib/rich-text-syntax';\n\nexport const XuiRichTextEditorImports = [XuiRichTextEditor] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["FEATURES","writer","inlineToHtml"],"mappings":";;;;;;;;AA+CA,MAAM,SAAS,GAAoC;AACjD,IAAA,MAAM,EAAE,MAAM;AACd,IAAA,CAAC,EAAE,MAAM;AACT,IAAA,EAAE,EAAE,QAAQ;AACZ,IAAA,CAAC,EAAE,QAAQ;AACX,IAAA,CAAC,EAAE,WAAW;AACd,IAAA,CAAC,EAAE,QAAQ;AACX,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,GAAG,EAAE,QAAQ;AACb,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,CAAC,EAAE;CACJ;AAED;;;;;;AAMG;AACG,SAAU,aAAa,CAAC,IAAiB,EAAE,MAAyB,EAAA;IACxE,MAAM,MAAM,GAAa,EAAE;AAE3B,IAAA,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EA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CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;AAChF;AAEA;AACA,SAAS,MAAM,CAAC,EAAwB,EAAA;AACtC,IAAA,IAAI;AACF,QAAA,OAAO,EAAE,EAAE,KAAK,IAAI;IACtB;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,KAAK;IACd;AACF;;ACnmBO,MAAM,wBAAwB,GAAG,CAAC,iBAAiB;;ACR1D;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xui/rich-text-editor",
3
- "version": "2.0.0-alpha.11",
3
+ "version": "2.0.0-alpha.12",
4
4
  "description": "Modern Angular 22 UI Library based on TailwindCSS",
5
5
  "keywords": [
6
6
  "angular",
@@ -41,8 +41,8 @@
41
41
  "@angular/forms": "22",
42
42
  "@ng-icons/core": "^34.0.0",
43
43
  "@ng-icons/material-icons": "^34.0.0",
44
- "@xui/core": "2.0.0-alpha.11",
45
- "@xui/icon": "2.0.0-alpha.11",
44
+ "@xui/core": "2.0.0-alpha.12",
45
+ "@xui/icon": "2.0.0-alpha.12",
46
46
  "clsx": "^2.1.1"
47
47
  },
48
48
  "publishConfig": {
@@ -1,8 +1,8 @@
1
+ import * as _xui_core_forms from '@xui/core/forms';
1
2
  import * as _angular_core from '@angular/core';
2
- import { ValueProvider, Provider } from '@angular/core';
3
+ import { Provider } from '@angular/core';
3
4
  import { BooleanInput } from '@angular/cdk/coercion';
4
5
  import { ControlValueAccessor } from '@angular/forms';
5
- import { TouchFn, ChangeFn } from '@xui/core/forms';
6
6
  import { ClassValue } from 'clsx';
7
7
 
8
8
  /**
@@ -77,11 +77,6 @@ interface Tool {
77
77
  readonly state: 'command' | 'block' | 'none';
78
78
  readonly key?: string;
79
79
  }
80
- declare const XUI_RICH_TEXT_EDITOR_VALUE_ACCESSOR: {
81
- provide: _angular_core.InjectionToken<readonly ControlValueAccessor[]>;
82
- useExisting: _angular_core.Type<any>;
83
- multi: boolean;
84
- };
85
80
  /**
86
81
  * A WYSIWYG editor whose value is source text.
87
82
  *
@@ -126,9 +121,7 @@ declare class XuiRichTextEditor implements ControlValueAccessor {
126
121
  readonly source: _angular_core.ModelSignal<boolean>;
127
122
  protected readonly linkDraft: _angular_core.WritableSignal<string | null>;
128
123
  protected readonly active: _angular_core.WritableSignal<XuiRichTextFeature[]>;
129
- private onChange?;
130
- protected onTouched?: TouchFn;
131
- private readonly disabledByForm;
124
+ protected readonly cva: _xui_core_forms.XValueAccessor<string>;
132
125
  protected readonly isDisabled: _angular_core.Signal<boolean>;
133
126
  /**
134
127
  * The value the surface already shows, tagged with the format it was rendered
@@ -174,10 +167,10 @@ declare class XuiRichTextEditor implements ControlValueAccessor {
174
167
  private exec;
175
168
  private commit;
176
169
  private syncKey;
177
- writeValue(value: string): void;
178
- registerOnChange(fn: ChangeFn<string>): void;
179
- registerOnTouched(fn: TouchFn): void;
180
- setDisabledState(isDisabled: boolean): void;
170
+ readonly writeValue: (value: string) => void;
171
+ readonly registerOnChange: (fn: _xui_core_forms.XChangeFn<string>) => void;
172
+ readonly registerOnTouched: (fn: _xui_core_forms.XTouchFn) => void;
173
+ readonly setDisabledState: (isDisabled: boolean) => void;
181
174
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<XuiRichTextEditor, never>;
182
175
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<XuiRichTextEditor, "xui-rich-text-editor", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "sourceView": { "alias": "sourceView"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "minHeight": { "alias": "minHeight"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "source": { "alias": "source"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "source": "sourceChange"; }, never, never, true, never>;
183
176
  }
@@ -197,8 +190,8 @@ interface XuiRichTextEditorConfig {
197
190
  sourceView: boolean;
198
191
  }
199
192
  /** Application-wide defaults for every editor. Individual inputs still win. */
200
- declare function provideXuiRichTextEditorConfig(config: Partial<XuiRichTextEditorConfig>): ValueProvider;
201
- declare function injectXuiRichTextEditorConfig(): XuiRichTextEditorConfig;
193
+ declare const injectXuiRichTextEditorConfig: () => XuiRichTextEditorConfig;
194
+ declare const provideXuiRichTextEditorConfig: (config: Partial<XuiRichTextEditorConfig>) => _angular_core.ValueProvider;
202
195
  /**
203
196
  * Teaches the editor a format.
204
197
  *
@@ -224,5 +217,5 @@ declare function injectXuiRichTextSyntaxes(): Map<string, XuiRichTextSyntax>;
224
217
 
225
218
  declare const XuiRichTextEditorImports: readonly [typeof XuiRichTextEditor];
226
219
 
227
- export { XUI_RICH_TEXT_EDITOR_VALUE_ACCESSOR, XuiRichTextEditor, XuiRichTextEditorImports, bbcodeSyntax, escapeHtml, injectXuiRichTextEditorConfig, injectXuiRichTextSyntaxes, markdownSyntax, provideXuiRichTextEditorConfig, provideXuiRichTextSyntax, sanitizeUrl, serializeHtml };
220
+ export { XuiRichTextEditor, XuiRichTextEditorImports, bbcodeSyntax, escapeHtml, injectXuiRichTextEditorConfig, injectXuiRichTextSyntaxes, markdownSyntax, provideXuiRichTextEditorConfig, provideXuiRichTextSyntax, sanitizeUrl, serializeHtml };
228
221
  export type { XuiRichTextBlock, XuiRichTextEditorConfig, XuiRichTextFeature, XuiRichTextMark, XuiRichTextSyntax, XuiRichTextWriter };