@astryxdesign/richtext 0.7.5-canary.fd0aba8 → 0.7.6-canary.0ef60dd
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/CHANGELOG.md +43 -0
- package/package.json +4 -4
- package/src/CodeBlockHeaderPlugin.test.tsx +21 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @astryxdesign/richtext
|
|
2
2
|
|
|
3
|
+
# 0.7.5
|
|
4
|
+
|
|
5
|
+
#### New Features
|
|
6
|
+
|
|
7
|
+
- Status colors are readable everywhere they appear, and Info is a status of its own. Each status (info, success, warning, error) now has a strong fill (`--color-<status>`) with content on it (`--color-on-<status>`, at least 4.5:1), a pale fill (`--color-<status>-muted`) with its content (`--color-on-<status>-muted`), and readable text for the page and cards (`--color-text-<status>`). Status icons (`--color-icon-<status>`) and borders (`--color-border-<status>`) default to the readable text color. The Info roles (`--color-info`, `--color-on-info`, `--color-info-muted`, …) are new and no longer borrow your accent color.
|
|
8
|
+
|
|
9
|
+
`--color-success`, `--color-warning`, and `--color-error` and `bg-<status>` keep their meaning as the strong fills. In Tailwind, `bg-info`, `bg-info-muted`, `text-on-<status>`, `text-on-<status>-muted`, and `text-status-<status>` are new; `text-`, `decoration-`, `placeholder-`, and `caret-<status>` now use the readable text shade, and `border-`, `divide-`, `outline-`, and `ring-<status>` use the border shade, while `bg-`, `accent-`, `fill-`, `stroke-<status>`, shadows, and gradients keep the strong fill. For example, Core's light `text-warning` is now `#753F07` instead of `#E9AF08`. To keep the fill color on text, write `text-[var(--color-warning)]`.
|
|
10
|
+
|
|
11
|
+
What changes on screen:
|
|
12
|
+
|
|
13
|
+
- Core's dark Error content (`--color-on-error`) is now `#0A1317` instead of white, so text on dark-mode error fills reaches 4.5:1. Core's Info Badge uses `#0064E0` instead of the accent (`#2694FE` in dark mode).
|
|
14
|
+
- Status icons (Icon `color="info|success|warning|error"`), Stepper status glyphs, and Chat tool-call status icons use the readable shades. Core's light success icon is now `#09441F` instead of `#0D8626`.
|
|
15
|
+
- Input and FileInput status borders use the border shades. Core's light warning border is now `#753F07` instead of `#E9AF08`, and Butter's light success and warning input borders reach 3:1.
|
|
16
|
+
- Banner draws its title, description, icon, and controls in the on-muted colors, and fills Info with `--color-info-muted`.
|
|
17
|
+
- Status fills keep a visible edge in forced-colors mode.
|
|
18
|
+
- Content on Chocolate and Matcha success and error fills, and on Stone success, warning, and error fills, now reaches 4.5:1.
|
|
19
|
+
- Every first-party theme sets a blue Info. Chocolate and Matcha Info Badges move from the accent to that blue; Butter keeps its own Info Badge colors.
|
|
20
|
+
- Neutral's `--color-success`, `--color-warning`, and `--color-error` are now the fills its Badges already showed, and its `--color-info` is `#0074E2` (`#6D9CFE` in dark mode). Its Badges, StatusDots, progress fills, and Stepper badges look the same; its accent ProgressBar, StatusDot, and Stepper now use Neutral's accent instead of blue.
|
|
21
|
+
- Neutral no longer defines its undocumented local status tokens. Use the standard roles instead: `--astryx-theme-neutral-color-status-fill-success`, `-status-fill-warning`, and `-status-fill-error` → `--color-success`, `--color-warning`, `--color-error`; `-status-muted-accent` → `--color-info-muted`; `-on-tint-neutral` → `--color-neutral`; the `-on-tint-overlay-*` and `-destructive-overlay-*` tokens → `--color-overlay-hover` and `--color-overlay-pressed`. `--astryx-theme-neutral-color-status-fill-accent` keeps its value but is deprecated.
|
|
22
|
+
|
|
23
|
+
Custom themes get the content and text roles they don't set: they are derived from the theme's status fills. To keep a component's previous color, set the matching role, for example `--color-icon-success` to your old `--color-success`.
|
|
24
|
+
|
|
25
|
+
- `RichTextEditor` and `RichTextView` take `codeLanguages`, the same list `Markdown` takes, so code looks the same while reading and editing.
|
|
26
|
+
|
|
27
|
+
#### Fixes
|
|
28
|
+
|
|
29
|
+
- Type declarations resolve in projects that use `moduleResolution: NodeNext`.
|
|
30
|
+
- In `RichTextEditor` and `RichTextView`, a code block with no language leaves room for its Copy button, so long lines wrap before it. The block is as tall as in `Markdown`, so switching between reading and editing no longer shifts the page.
|
|
31
|
+
|
|
32
|
+
#### Documentation
|
|
33
|
+
|
|
34
|
+
- Package links now point to the project's GitHub home, `meta/astryx`.
|
|
35
|
+
|
|
36
|
+
#### Contributors
|
|
37
|
+
|
|
38
|
+
Thanks to everyone who contributed to this release:
|
|
39
|
+
|
|
40
|
+
- @cixzhang
|
|
41
|
+
- @harjothkhara
|
|
42
|
+
- @rubyycheung
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
3
46
|
# 0.7.4
|
|
4
47
|
|
|
5
48
|
---
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/richtext",
|
|
3
3
|
"displayName": "Rich Text",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.6-canary.0ef60dd",
|
|
5
5
|
"description": "Astryx rich text — a Lexical-based rich text editor and viewer, styled with Astryx design tokens.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
7
7
|
"license": "MIT",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@stylexjs/stylex": ">=0.10.0",
|
|
56
|
-
"@astryxdesign/core": "0.7.
|
|
56
|
+
"@astryxdesign/core": "0.7.6-canary.0ef60dd",
|
|
57
57
|
"react": ">=19.0.0",
|
|
58
58
|
"react-dom": ">=19.0.0",
|
|
59
59
|
"lexical": "^0.52.0",
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
|
-
"@astryxdesign/a11y-spec": "0.7.
|
|
116
|
-
"@astryxdesign/cli": "0.7.
|
|
115
|
+
"@astryxdesign/a11y-spec": "0.7.6-canary.0ef60dd",
|
|
116
|
+
"@astryxdesign/cli": "0.7.6-canary.0ef60dd",
|
|
117
117
|
"@babel/cli": "^7.29.7",
|
|
118
118
|
"@babel/core": "^7.29.7",
|
|
119
119
|
"@babel/preset-react": "^7.29.7",
|
|
@@ -38,13 +38,14 @@ describe('code block headers (spec:AST-061 FR8)', () => {
|
|
|
38
38
|
const {container} = render(
|
|
39
39
|
<RichTextView value={markdownToEditorStateJSON('```\nplain\n```\n')} />,
|
|
40
40
|
);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
// The header's text ends with the copy button's tooltip, which its layer
|
|
42
|
+
// draws in a later render than the header itself: wait for the text, not
|
|
43
|
+
// only for the header.
|
|
44
|
+
await waitFor(() =>
|
|
45
|
+
expect(
|
|
46
|
+
container.querySelector('[data-richtext-code-header]')?.textContent,
|
|
47
|
+
).toBe('Copy code'),
|
|
48
|
+
);
|
|
48
49
|
expect(screen.getByRole('button', {name: 'Copy code'})).toBeTruthy();
|
|
49
50
|
});
|
|
50
51
|
|
|
@@ -56,19 +57,16 @@ describe('code block headers (spec:AST-061 FR8)', () => {
|
|
|
56
57
|
)}
|
|
57
58
|
/>,
|
|
58
59
|
);
|
|
60
|
+
// Exactly `plaintext` names nothing; core compares it case-sensitively.
|
|
61
|
+
// Each header's text ends with its copy button's tooltip, drawn in a later
|
|
62
|
+
// render than the header: wait for the text.
|
|
59
63
|
await waitFor(() =>
|
|
60
64
|
expect(
|
|
61
|
-
container.querySelectorAll('[data-richtext-code-header]')
|
|
62
|
-
|
|
65
|
+
[...container.querySelectorAll('[data-richtext-code-header]')].map(
|
|
66
|
+
header => header.textContent,
|
|
67
|
+
),
|
|
68
|
+
).toEqual(['Copy code', 'PlaintextCopy code']),
|
|
63
69
|
);
|
|
64
|
-
const headers = [
|
|
65
|
-
...container.querySelectorAll('[data-richtext-code-header]'),
|
|
66
|
-
];
|
|
67
|
-
// Exactly `plaintext` names nothing; core compares it case-sensitively.
|
|
68
|
-
expect(headers.map(header => header.textContent)).toEqual([
|
|
69
|
-
'Copy code',
|
|
70
|
-
'PlaintextCopy code',
|
|
71
|
-
]);
|
|
72
70
|
});
|
|
73
71
|
|
|
74
72
|
it('draws one header per code block in the editor, outside the editable text', async () => {
|
|
@@ -80,19 +78,18 @@ describe('code block headers (spec:AST-061 FR8)', () => {
|
|
|
80
78
|
)}
|
|
81
79
|
/>,
|
|
82
80
|
);
|
|
81
|
+
// Each header: its language label, then the copy button's tooltip, which
|
|
82
|
+
// its layer draws in a later render than the header: wait for the text.
|
|
83
83
|
await waitFor(() =>
|
|
84
84
|
expect(
|
|
85
|
-
container.querySelectorAll('[data-richtext-code-header]')
|
|
86
|
-
|
|
85
|
+
[...container.querySelectorAll('[data-richtext-code-header]')].map(
|
|
86
|
+
header => header.textContent,
|
|
87
|
+
),
|
|
88
|
+
).toEqual(['tsCopy code', 'jsCopy code']),
|
|
87
89
|
);
|
|
88
90
|
const headers = [
|
|
89
91
|
...container.querySelectorAll('[data-richtext-code-header]'),
|
|
90
92
|
];
|
|
91
|
-
// Each header: its language label, then the copy button's name.
|
|
92
|
-
expect(headers.map(header => header.textContent)).toEqual([
|
|
93
|
-
'tsCopy code',
|
|
94
|
-
'jsCopy code',
|
|
95
|
-
]);
|
|
96
93
|
for (const header of headers) {
|
|
97
94
|
expect(header.closest('[contenteditable]')).toBeNull();
|
|
98
95
|
}
|