@astryxdesign/richtext 0.7.0-canary.291c4e9 → 0.7.0-canary.2c86d9d

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.
@@ -5,7 +5,8 @@
5
5
  * command constants, plus Astryx Toolbar / IconButton / Selector /
6
6
  * ToggleButton / Divider / Dialog / TextInput / Button / Layout primitives.
7
7
  * @output Exports RichTextEditorToolbar (a compact formatting toolbar with a
8
- * horizontally scrollable action row) and RichTextEditorToolbarProps.
8
+ * RichText-owned 4px control gutter and horizontally scrollable action row)
9
+ * and RichTextEditorToolbarProps.
9
10
  * @position Experimental (richtext). Drop into RichTextEditor's `toolbar` slot to
10
11
  * add a flush top formatting toolbar. Themed via Astryx Toolbar, Selector,
11
12
  * IconButton, and ToggleButton, so it inherits the active theme.
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextEditorToolbar.d.ts","sourceRoot":"","sources":["../src/RichTextEditorToolbar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAsIf;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;CAgBrB,CAAC;AAmPX,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IAClD;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACnE;;;;;;;OAOG;IACH,iBAAiB,CA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,GACX,EAAE,0BAA0B,+BAwgB5B;yBAhhBe,qBAAqB"}
@@ -9,7 +9,8 @@
9
9
  * command constants, plus Astryx Toolbar / IconButton / Selector /
10
10
  * ToggleButton / Divider / Dialog / TextInput / Button / Layout primitives.
11
11
  * @output Exports RichTextEditorToolbar (a compact formatting toolbar with a
12
- * horizontally scrollable action row) and RichTextEditorToolbarProps.
12
+ * RichText-owned 4px control gutter and horizontally scrollable action row)
13
+ * and RichTextEditorToolbarProps.
13
14
  * @position Experimental (richtext). Drop into RichTextEditor's `toolbar` slot to
14
15
  * add a flush top formatting toolbar. Themed via Astryx Toolbar, Selector,
15
16
  * IconButton, and ToggleButton, so it inherits the active theme.
@@ -55,7 +56,7 @@ import { getExtendedIcon } from '@astryxdesign/core/Icon';
55
56
  import { useThemeName } from '@astryxdesign/core/theme';
56
57
  import { rtlStyles } from '@astryxdesign/core/utils';
57
58
  import '@astryxdesign/core/theme/tokens.stylex';
58
- import { fontWeightVars, typeScaleVars } from '@astryxdesign/core/theme/tokens.stylex';
59
+ import { fontWeightVars, spacingVars, typeScaleVars } from '@astryxdesign/core/theme/tokens.stylex';
59
60
  import { useTranslator } from '@astryxdesign/core/i18n';
60
61
  import { FORMAT_TEXT_COMMAND, UNDO_COMMAND, REDO_COMMAND, CAN_UNDO_COMMAND, CAN_REDO_COMMAND, SELECTION_CHANGE_COMMAND, KEY_DOWN_COMMAND, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_NORMAL, IS_APPLE, isExactShortcutMatch, $getSelection, $isNodeSelection, $isRangeSelection, $setSelection, $createParagraphNode, $createTextNode } from 'lexical';
61
62
  import { sanitizeUrl } from "./linkUtils.js";
@@ -89,6 +90,13 @@ const glyphStyles = {
89
90
  }
90
91
  };
91
92
  const toolbarScrollStyles = {
93
+ compactToolbar: {
94
+ "--astryx-section-padding-inline-start": "xcfn0br",
95
+ "--astryx-section-padding-inline-end": "x1qgjean",
96
+ keoZOQ: "x1uy92hs",
97
+ k1K539: "x199tud",
98
+ $$css: true
99
+ },
92
100
  actions: {
93
101
  kUk6DE: "x845mor",
94
102
  kzqmXN: "xnalus7",
@@ -689,6 +697,7 @@ export function RichTextEditorToolbar({
689
697
  children: [/*#__PURE__*/_jsx(Toolbar, {
690
698
  label: label,
691
699
  size: size,
700
+ xstyle: toolbarScrollStyles.compactToolbar,
692
701
  startContent: /*#__PURE__*/_jsxs(HStack, {
693
702
  gap: 1,
694
703
  role: "group",
package/dist/richtext.css CHANGED
@@ -6,6 +6,8 @@
6
6
  @property --x-minHeight { syntax: "*"; inherits: false;}
7
7
  @property --x-top { syntax: "*"; inherits: false;}
8
8
  @property --x-width { syntax: "*"; inherits: false;}
9
+ .x1qgjean{--astryx-section-padding-inline-end:var(--spacing-1)}
10
+ .xcfn0br{--astryx-section-padding-inline-start:var(--spacing-1)}
9
11
  .xax9j7h{--container-padding-block-end:0px}
10
12
  .x1047aw6{--container-padding-block-start:0px}
11
13
  .xjsfl84{--container-padding-inline-end:0px}
@@ -144,11 +146,13 @@
144
146
  .x11xkdxz:not(#\#):not(#\#):not(#\#):not(#\#){border-top-width:var(--border-width)}
145
147
  .xt7dq6l:not(#\#):not(#\#):not(#\#):not(#\#){height:auto}
146
148
  .xgq9j65:not(#\#):not(#\#):not(#\#):not(#\#){left:var(--x-left)}
149
+ .x199tud:not(#\#):not(#\#):not(#\#):not(#\#){margin-bottom:calc(-1 * var(--spacing-1))}
147
150
  .x10j6jf0:not(#\#):not(#\#):not(#\#):not(#\#){margin-bottom:calc(var(--spacing-0-5))}
148
151
  .x1hws3vx:not(#\#):not(#\#):not(#\#):not(#\#){margin-bottom:calc(var(--spacing-2))}
149
152
  .x18pneqc:not(#\#):not(#\#):not(#\#):not(#\#){margin-bottom:calc(var(--spacing-3))}
150
153
  .x1u2y747:not(#\#):not(#\#):not(#\#):not(#\#){margin-bottom:calc(var(--spacing-4))}
151
154
  .x1qaki06:not(#\#):not(#\#):not(#\#):not(#\#){margin-bottom:calc(var(--spacing-6))}
155
+ .x1uy92hs:not(#\#):not(#\#):not(#\#):not(#\#){margin-top:calc(-1 * var(--spacing-1))}
152
156
  .x1wqhfsw:not(#\#):not(#\#):not(#\#):not(#\#){margin-top:calc(var(--spacing-0))}
153
157
  .x1ftnraw:not(#\#):not(#\#):not(#\#):not(#\#){margin-top:calc(var(--spacing-3))}
154
158
  .x1w2a574:not(#\#):not(#\#):not(#\#):not(#\#){margin-top:calc(var(--spacing-4))}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astryxdesign/richtext",
3
3
  "displayName": "Rich Text",
4
- "version": "0.7.0-canary.291c4e9",
4
+ "version": "0.7.0-canary.2c86d9d",
5
5
  "description": "Astryx rich text — a Lexical-based rich text editor and viewer. Published to npm only under the @canary dist-tag for early testing; never released as a stable (latest) version.",
6
6
  "author": "Meta Open Source",
7
7
  "license": "MIT",
@@ -55,7 +55,7 @@
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@stylexjs/stylex": ">=0.10.0",
58
- "@astryxdesign/core": "0.7.0-canary.291c4e9",
58
+ "@astryxdesign/core": "0.7.0-canary.2c86d9d",
59
59
  "react": ">=19.0.0",
60
60
  "react-dom": ">=19.0.0",
61
61
  "lexical": "^0.46.0",
@@ -114,8 +114,8 @@
114
114
  }
115
115
  },
116
116
  "devDependencies": {
117
- "@astryxdesign/a11y-spec": "0.7.0-canary.291c4e9",
118
- "@astryxdesign/cli": "0.7.0-canary.291c4e9",
117
+ "@astryxdesign/a11y-spec": "0.7.0-canary.2c86d9d",
118
+ "@astryxdesign/cli": "0.7.0-canary.2c86d9d",
119
119
  "@babel/cli": "^7.29.7",
120
120
  "@babel/core": "^7.29.7",
121
121
  "@babel/preset-react": "^7.29.7",
@@ -224,7 +224,7 @@ export const docs = {
224
224
  {
225
225
  guidance: true,
226
226
  description:
227
- 'Add a formatting toolbar with toolbar={<RichTextEditorToolbar />}. The dedicated slot places it edge-to-edge at the top of the field, before the padded editing surface, with correct keyboard order. It uses small Astryx Toolbar controls: undo/redo, a divided block-format Selector for paragraphs/headings/lists/quotes, then divided inline ToggleButtons for bold/italic/underline/strikethrough/code and links. The complete action row scrolls horizontally when space is tight, keeping every control directly available without a More menu. The Selector keeps its default adaptive placement. Compose extra controls via endContent.',
227
+ 'Add a formatting toolbar with toolbar={<RichTextEditorToolbar />}. The dedicated slot places it edge-to-edge at the top of the field, before the padded editing surface, with a RichText-owned 4px control gutter and correct keyboard order. It uses small Astryx Toolbar controls: undo/redo, a divided block-format Selector for paragraphs/headings/lists/quotes, then divided inline ToggleButtons for bold/italic/underline/strikethrough/code and links. The complete action row scrolls horizontally when space is tight, keeping every control directly available without a More menu. The Selector keeps its default adaptive placement. Compose extra controls via endContent.',
228
228
  },
229
229
  {
230
230
  guidance: true,
@@ -41,6 +41,7 @@ import {
41
41
  } from './markdownSerializers';
42
42
  import {RichTextEditorToolbar} from './RichTextEditorToolbar';
43
43
  import {registerIcons, resetIcons} from '@astryxdesign/core/Icon';
44
+ import {EDGE_COMP_ATTR} from '@astryxdesign/core/Layout';
44
45
  import {Theme, defineTheme} from '@astryxdesign/core/theme';
45
46
  import {rtlStyles} from '@astryxdesign/core/utils';
46
47
  import {InternationalizationProvider} from '@astryxdesign/core/i18n';
@@ -1313,7 +1314,11 @@ describe('RichTextEditorToolbar', () => {
1313
1314
  Node.DOCUMENT_POSITION_FOLLOWING,
1314
1315
  ).toBe(Node.DOCUMENT_POSITION_FOLLOWING);
1315
1316
  expect(toolbarRegion?.parentElement).toBe(editor);
1317
+ expect(toolbarRegion).toBeInstanceOf(HTMLElement);
1316
1318
  expect(editorBody).toBeInstanceOf(HTMLElement);
1319
+ // The compact gutter is emitted by StyleX; do not regress to a component
1320
+ // inline-style escape hatch. Browser coverage below owns the geometry.
1321
+ expect(toolbarRegion).not.toHaveAttribute('style');
1317
1322
  // Vitest's JSDOM setup does not load compiled StyleX CSS. The WithToolbar
1318
1323
  // story provides visual coverage for flush edges and preserved body inset;
1319
1324
  // here we verify that the dedicated body receives its StyleX layout.
@@ -1420,6 +1425,7 @@ describe('RichTextEditorToolbar', () => {
1420
1425
  const actionRow = screen.getByRole('group', {
1421
1426
  name: 'Formatting actions',
1422
1427
  });
1428
+ expect(actionRow).not.toHaveAttribute(EDGE_COMP_ATTR);
1423
1429
  for (const name of [
1424
1430
  'Bold',
1425
1431
  'Italic',
@@ -9,7 +9,8 @@
9
9
  * command constants, plus Astryx Toolbar / IconButton / Selector /
10
10
  * ToggleButton / Divider / Dialog / TextInput / Button / Layout primitives.
11
11
  * @output Exports RichTextEditorToolbar (a compact formatting toolbar with a
12
- * horizontally scrollable action row) and RichTextEditorToolbarProps.
12
+ * RichText-owned 4px control gutter and horizontally scrollable action row)
13
+ * and RichTextEditorToolbarProps.
13
14
  * @position Experimental (richtext). Drop into RichTextEditor's `toolbar` slot to
14
15
  * add a flush top formatting toolbar. Themed via Astryx Toolbar, Selector,
15
16
  * IconButton, and ToggleButton, so it inherits the active theme.
@@ -80,6 +81,7 @@ import {useThemeName} from '@astryxdesign/core/theme';
80
81
  import {rtlStyles} from '@astryxdesign/core/utils';
81
82
  import {
82
83
  fontWeightVars,
84
+ spacingVars,
83
85
  typeScaleVars,
84
86
  } from '@astryxdesign/core/theme/tokens.stylex';
85
87
  import {useTranslator} from '@astryxdesign/core/i18n';
@@ -146,6 +148,15 @@ const glyphStyles = stylex.create({
146
148
  });
147
149
 
148
150
  const toolbarScrollStyles = stylex.create({
151
+ // Core Toolbar owns an 8px block inset. This transparent RichText-only
152
+ // surface overlaps 4px of that inset at each block edge, so its controls and
153
+ // following editor body retain a 4px visual gutter.
154
+ compactToolbar: {
155
+ '--astryx-section-padding-inline-start': spacingVars['--spacing-1'],
156
+ '--astryx-section-padding-inline-end': spacingVars['--spacing-1'],
157
+ marginBlockStart: `calc(-1 * ${spacingVars['--spacing-1']})`,
158
+ marginBlockEnd: `calc(-1 * ${spacingVars['--spacing-1']})`,
159
+ },
149
160
  // The row scrolls when it runs out of room, so a control keeps its own
150
161
  // width. A Selector's field may shrink, which squeezes its label to a
151
162
  // sliver, so it sits in a slot that may not.
@@ -887,6 +898,7 @@ export function RichTextEditorToolbar({
887
898
  <Toolbar
888
899
  label={label}
889
900
  size={size}
901
+ xstyle={toolbarScrollStyles.compactToolbar}
890
902
  startContent={
891
903
  <HStack
892
904
  gap={1}