@astl/editor-tiptap 0.2.2 → 0.2.3

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.
@@ -83,8 +83,8 @@ const sourceStyles = css `
83
83
  font: var(--astl-size-small) / 1.5 var(--astl-font-mono);
84
84
  }
85
85
  .source textarea:focus-visible {
86
- outline: var(--astl-focus-width) solid var(--astl-focus);
87
- outline-offset: var(--astl-focus-offset);
86
+ outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
87
+ outline-offset: var(--astl-editor-focus-offset, 1px);
88
88
  }
89
89
  `;
90
90
  /** Adopts the view's stylesheets into the shadow root holding `node`, once. */
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAOA,wGAAwG;AACxG,eAAO,MAAM,aAAa,iBAAiB,CAAC;AAukC5C,2FAA2F;AAC3F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAKnD"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAOA,wGAAwG;AACxG,eAAO,MAAM,aAAa,iBAAiB,CAAC;AA0lC5C,2FAA2F;AAC3F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAKnD"}
package/dist/styles.js CHANGED
@@ -31,8 +31,8 @@ const baseSurfaceStyles = css `
31
31
  }
32
32
  /* A host with a focus cue of its own (the frame with the cursor) may set the sheet's ring to a quieter one. */
33
33
  .astl-surface .tiptap:focus-visible {
34
- outline: var(--astl-editor-sheet-focus-ring, var(--astl-focus-width) solid var(--astl-focus));
35
- outline-offset: var(--astl-focus-offset);
34
+ outline: var(--astl-editor-sheet-focus-ring, var(--astl-editor-focus-width, 2px) solid var(--astl-focus));
35
+ outline-offset: var(--astl-editor-focus-offset, 1px);
36
36
  }
37
37
  .astl-surface .astl-vh {
38
38
  position: absolute;
@@ -129,10 +129,13 @@ const baseSurfaceStyles = css `
129
129
  padding-block-start: var(--astl-space-4);
130
130
  border-block-start: var(--astl-outline-width) solid var(--astl-line);
131
131
  }
132
+ /* A page head: its number, then its buttons at the end; in a narrow column a button that wraps stays at the end, under
133
+ the others, not under the number. */
132
134
  .astl-surface .astl-page-head {
133
135
  display: flex;
134
136
  flex-wrap: wrap;
135
137
  align-items: center;
138
+ justify-content: flex-end;
136
139
  gap: var(--astl-space-2);
137
140
  margin-block: 0 var(--astl-space-3);
138
141
  }
@@ -181,13 +184,15 @@ const baseSurfaceStyles = css `
181
184
  .astl-help-remove,
182
185
  .astl-help-free
183
186
  ):focus-visible {
184
- outline: var(--astl-focus-width) solid var(--astl-focus);
185
- outline-offset: var(--astl-focus-offset);
187
+ outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
188
+ outline-offset: var(--astl-editor-focus-offset, 1px);
186
189
  }
187
190
  /* The surface's authoring controls (the page heads' buttons, a page box's, the blocks' "Add option", a frame's
188
- position line, a picture's buttons) are compact, ghost at rest, so that the exercise looks as students see it. A
189
- host sizes them with --astl-editor-control-size (their height, 1.75rem), --astl-editor-control-font-size (0.8125rem)
190
- and --astl-editor-control-icon-size (0.875rem); a target stays at least 24px (WCAG 2.5.8). */
191
+ position line, a picture's buttons) are compact, so that the exercise looks as students see it, and each is
192
+ recognisable as a button at rest: a text button has a hairline in the outline colour (3:1 at least), an add action
193
+ a plus and the accent colour, an icon alone (a page box's cross) only its icon. A host sizes them with
194
+ --astl-editor-control-size (their height, 1.75rem), --astl-editor-control-font-size (0.8125rem) and
195
+ --astl-editor-control-icon-size (0.875rem); a target stays at least 24px (WCAG 2.5.8). */
191
196
  .astl-surface
192
197
  :is(
193
198
  .astl-page-join,
@@ -207,7 +212,7 @@ const baseSurfaceStyles = css `
207
212
  min-inline-size: max(24px, var(--astl-editor-control-size, 1.75rem));
208
213
  padding-block: 0;
209
214
  padding-inline: var(--astl-space-2);
210
- border: var(--astl-outline-width) solid transparent;
215
+ border: 1px solid var(--astl-outline);
211
216
  border-radius: var(--astl-radius-s);
212
217
  background: transparent;
213
218
  color: var(--astl-ink-muted);
@@ -219,6 +224,14 @@ const baseSurfaceStyles = css `
219
224
  white-space: nowrap;
220
225
  cursor: pointer;
221
226
  }
227
+ .astl-surface .astl-help-remove {
228
+ border-color: transparent;
229
+ }
230
+ .astl-surface .astl-page-add-title {
231
+ padding-inline-start: var(--astl-space-1);
232
+ border-color: transparent;
233
+ color: var(--astl-accent);
234
+ }
222
235
  .astl-surface
223
236
  :is(
224
237
  .astl-page-join,
@@ -232,7 +245,7 @@ const baseSurfaceStyles = css `
232
245
  background: var(--astl-accent-soft);
233
246
  color: var(--astl-ink);
234
247
  }
235
- .astl-surface :is(.astl-help-remove, .astl-block-add button) .astl-icon {
248
+ .astl-surface :is(.astl-help-remove, .astl-block-add button, .astl-page-add-title) .astl-icon {
236
249
  inline-size: var(--astl-editor-control-icon-size, 0.875rem);
237
250
  block-size: var(--astl-editor-control-icon-size, 0.875rem);
238
251
  }
@@ -466,8 +479,8 @@ const baseSurfaceStyles = css `
466
479
  }
467
480
  .astl-surface .astl-block-add :focus-visible,
468
481
  .astl-surface .astl-flag:focus-visible {
469
- outline: var(--astl-focus-width) solid var(--astl-focus);
470
- outline-offset: var(--astl-focus-offset);
482
+ outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
483
+ outline-offset: var(--astl-editor-focus-offset, 1px);
471
484
  }
472
485
  .astl-surface .astl-icon {
473
486
  flex: none;
@@ -529,7 +542,7 @@ const baseSurfaceStyles = css `
529
542
  margin-inline-start: auto;
530
543
  padding-block: 0;
531
544
  padding-inline: var(--astl-space-2);
532
- border: var(--astl-outline-width) solid transparent;
545
+ border: 1px solid transparent;
533
546
  border-radius: var(--astl-radius-s);
534
547
  background: transparent;
535
548
  color: var(--astl-ink-muted);
@@ -544,16 +557,19 @@ const baseSurfaceStyles = css `
544
557
  .astl-surface .astl-frame-head-current > .astl-frame-line {
545
558
  visibility: visible;
546
559
  }
560
+ /* As a button it opens the component's style form: outlined, with the selects' chevron. */
547
561
  .astl-surface button.astl-frame-line {
562
+ border-color: var(--astl-outline);
548
563
  cursor: pointer;
549
564
  }
565
+ ${unsafeCSS(nativeSelectCss('.astl-surface button.astl-frame-line'))}
550
566
  .astl-surface button.astl-frame-line:hover {
551
- background: var(--astl-accent-soft);
567
+ background-color: var(--astl-accent-soft);
552
568
  color: var(--astl-ink);
553
569
  }
554
570
  .astl-surface .astl-frame-line:focus-visible {
555
- outline: var(--astl-focus-width) solid var(--astl-focus);
556
- outline-offset: var(--astl-focus-offset);
571
+ outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
572
+ outline-offset: var(--astl-editor-focus-offset, 1px);
557
573
  }
558
574
  .astl-surface .astl-block.astl-atom {
559
575
  cursor: pointer;
@@ -592,7 +608,7 @@ const baseSurfaceStyles = css `
592
608
  min-block-size: max(24px, var(--astl-editor-control-size, 1.75rem));
593
609
  padding-block: 0;
594
610
  padding-inline: var(--astl-space-2);
595
- border: var(--astl-outline-width) solid var(--astl-outline);
611
+ border: 1px solid var(--astl-outline);
596
612
  border-radius: var(--astl-radius-s);
597
613
  background: var(--astl-surface);
598
614
  color: var(--astl-ink);
@@ -602,8 +618,8 @@ const baseSurfaceStyles = css `
602
618
  cursor: pointer;
603
619
  }
604
620
  .astl-surface .astl-help-head select:focus-visible {
605
- outline: var(--astl-focus-width) solid var(--astl-focus);
606
- outline-offset: var(--astl-focus-offset);
621
+ outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
622
+ outline-offset: var(--astl-editor-focus-offset, 1px);
607
623
  }
608
624
  ${unsafeCSS(nativeSelectCss('.astl-surface .astl-help-head select'))}
609
625
  /* "Remove" closes the head: a cross, a page button's look. */
@@ -641,7 +657,7 @@ const baseSurfaceStyles = css `
641
657
  pointer-events: none;
642
658
  }
643
659
  /* A frame's tags: the help for students its component has, small pills in its tab. Each is a 24px target that keeps
644
- the tab as high as its line. */
660
+ the tab as high as its line; its focus ring hugs the pill, so it stays off the tab's line above when the tab wraps. */
645
661
  .astl-surface .astl-frame-help {
646
662
  box-sizing: border-box;
647
663
  display: inline-flex;
@@ -671,8 +687,11 @@ const baseSurfaceStyles = css `
671
687
  color: var(--astl-ink);
672
688
  }
673
689
  .astl-surface .astl-frame-help:focus-visible {
674
- outline: var(--astl-focus-width) solid var(--astl-focus);
675
- outline-offset: var(--astl-focus-offset);
690
+ outline: none;
691
+ }
692
+ .astl-surface .astl-frame-help:focus-visible > span {
693
+ outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
694
+ outline-offset: var(--astl-editor-focus-offset, 1px);
676
695
  }
677
696
  .astl-surface .astl-child {
678
697
  padding-block: var(--astl-space-1);
@@ -759,10 +778,10 @@ const baseSurfaceStyles = css `
759
778
  margin: 0;
760
779
  padding-block: 0;
761
780
  padding-inline: var(--astl-space-1) var(--astl-space-2);
762
- border: var(--astl-outline-width) solid transparent;
781
+ border: 1px solid transparent;
763
782
  border-radius: var(--astl-radius-s);
764
783
  background: transparent;
765
- color: var(--astl-ink-muted);
784
+ color: var(--astl-accent);
766
785
  font: inherit;
767
786
  font-family: var(--astl-font-body);
768
787
  font-size: var(--astl-editor-control-font-size, 0.8125rem);
@@ -794,11 +813,11 @@ const baseSurfaceStyles = css `
794
813
  words beside it: its ring is inside it, and it is filled (its border is the accent already). An empty chip keeps
795
814
  its colours: the solid ring stands out on its dashed one. */
796
815
  .astl-surface .ProseMirror-selectednode {
797
- outline: var(--astl-focus-width) solid var(--astl-focus);
798
- outline-offset: var(--astl-focus-offset);
816
+ outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
817
+ outline-offset: var(--astl-editor-focus-offset, 1px);
799
818
  }
800
819
  .astl-surface .astl-chip.ProseMirror-selectednode {
801
- outline-offset: calc(-1 * var(--astl-focus-width));
820
+ outline-offset: calc(-1 * var(--astl-editor-focus-width, 2px));
802
821
  }
803
822
  .astl-surface .astl-chip.ProseMirror-selectednode:not([data-empty]) {
804
823
  background: var(--astl-accent);
@@ -923,7 +942,7 @@ const baseSurfaceStyles = css `
923
942
  min-inline-size: max(24px, var(--astl-editor-control-size, 1.75rem));
924
943
  padding-block: 0;
925
944
  padding-inline: var(--astl-space-2);
926
- border: var(--astl-outline-width) solid var(--astl-outline);
945
+ border: 1px solid var(--astl-outline);
927
946
  border-radius: var(--astl-radius-s);
928
947
  background: var(--astl-surface);
929
948
  color: var(--astl-ink);
@@ -937,7 +956,7 @@ const baseSurfaceStyles = css `
937
956
  min-inline-size: max(24px, var(--astl-editor-control-size, 1.75rem));
938
957
  padding-block: 0;
939
958
  padding-inline: var(--astl-space-2);
940
- border: var(--astl-outline-width) solid var(--astl-outline);
959
+ border: 1px solid var(--astl-outline);
941
960
  border-radius: var(--astl-radius-s);
942
961
  background: var(--astl-surface);
943
962
  color: var(--astl-ink);
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAkB,GAAG,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAErD,wGAAwG;AACxG,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,iBAAiB,GAAc,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;CAmErB,CAAC;AAEF,yDAAyD;AACzD,MAAM,WAAW,GAAG,SAAS,CAC3B,KAAK,CAAC,IAAI,CACR,EAAE,MAAM,EAAE,CAAC,EAAE,EACb,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACP,+BAA+B,CAAC,GAAG,CAAC,8BAA8B,CAAC,GAAG,CAAC,+BAA+B,CAAC,GAAG,CAAC,SAAS,CACvH,CAAC,IAAI,CAAC,EAAE,CAAC,CACX,CAAC;AAEF,qHAAqH;AACrH,uHAAuH;AACvH,+CAA+C;AAC/C,MAAM,YAAY,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDvB,CAAC;AAEF,MAAM,aAAa,GAAc,GAAG,CAAA,GAAG,iBAAiB,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,EAAE,CAAC;AAErG,2FAA2F;AAC3F,MAAM,UAAU,kBAAkB,CAAC,IAAU;IAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAmC,CAAC;IACjE,MAAM,KAAK,GAAG,aAAa,CAAC,UAAU,CAAC;IACvC,IAAI,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS;QAAE,OAAO;IACzE,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,IAAI,CAAC,kBAAkB,GAAG,CAAC,GAAG,IAAI,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;AAC9G,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astl/editor-tiptap",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "<astl-editor>: the authoring kit around a TipTap surface, loaded only when no other editor is plugged in through an adapter.",
5
5
  "keywords": [
6
6
  "astrolabe",
@@ -53,11 +53,11 @@
53
53
  "access": "public"
54
54
  },
55
55
  "dependencies": {
56
- "@astl/core": "0.2.2",
57
- "@astl/editor": "0.2.2",
58
- "@astl/engine": "0.2.2",
59
- "@astl/player": "0.2.2",
60
- "@astl/tokens": "0.2.2",
56
+ "@astl/core": "0.2.3",
57
+ "@astl/editor": "0.2.3",
58
+ "@astl/engine": "0.2.3",
59
+ "@astl/player": "0.2.3",
60
+ "@astl/tokens": "0.2.3",
61
61
  "@tiptap/core": "3.32.0",
62
62
  "@tiptap/pm": "3.32.0",
63
63
  "@tiptap/starter-kit": "3.32.0",
package/src/adapter.ts CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  import { scanElements } from '@astl/editor';
15
15
  import type { ChainedCommands, Editor } from '@tiptap/core';
16
16
  import { closeHistory } from '@tiptap/pm/history';
17
- import { DOMSerializer, type Node as PMNode, DOMParser as SchemaParser } from '@tiptap/pm/model';
17
+ import { DOMSerializer, Fragment, type Node as PMNode, DOMParser as SchemaParser } from '@tiptap/pm/model';
18
18
  import { NodeSelection, type Selection, TextSelection, type Transaction } from '@tiptap/pm/state';
19
19
  import { cursorIn, isBlockOf, LAYOUT, LAYOUT_COLUMN, moveBlockIn, removeBlockIn } from './blocks.js';
20
20
  import {
@@ -70,26 +70,44 @@ function formatCommand(
70
70
  }
71
71
  }
72
72
 
73
- /** Attribute changes are applied in place (so the selection survives); other changes replace the content. */
73
+ /**
74
+ * Changes `from` (at `pos`) into `to` with the least replaced, so that a selection inside it maps through: attributes in
75
+ * place; the children both have at the start and at the end (by type, text by text) patched in place, each the same
76
+ * way; only the run between them replaced, so a child added or taken away (a hint, a row) is just that step. Replacing
77
+ * the whole content instead threw a cursor in the block's prompt out of the block, and the inspector lost its element.
78
+ */
74
79
  function patch(tr: Transaction, pos: number, from: PMNode, to: PMNode): void {
75
80
  if (!from.sameMarkup(to)) tr.setNodeMarkup(pos, undefined, to.attrs, from.marks);
76
81
  if (from.isLeaf || from.content.eq(to.content)) return;
77
- const sameShape =
78
- from.childCount === to.childCount &&
79
- from.content.content.every(
80
- (child, i) => child.type === to.child(i).type && (!child.isText || child.eq(to.child(i))),
81
- );
82
- if (!sameShape) {
83
- tr.replaceWith(pos + 1, pos + from.nodeSize - 1, to.content);
84
- return;
85
- }
86
- // Last child first, so earlier positions stay valid.
82
+ const same = (a: PMNode, b: PMNode) => a.type === b.type && (!a.isText || a.eq(b));
83
+ const shortest = Math.min(from.childCount, to.childCount);
84
+ let start = 0;
85
+ while (start < shortest && same(from.child(start), to.child(start))) start++;
86
+ let end = 0;
87
+ while (
88
+ end < shortest - start &&
89
+ same(from.child(from.childCount - 1 - end), to.child(to.childCount - 1 - end))
90
+ )
91
+ end++;
87
92
  const offsets: number[] = [];
88
93
  from.forEach((_, offset) => {
89
94
  offsets.push(offset);
90
95
  });
91
- for (let i = from.childCount - 1; i >= 0; i--)
92
- patch(tr, pos + 1 + (offsets[i] ?? 0), from.child(i), to.child(i));
96
+ const at = (i: number) => pos + 1 + (i < from.childCount ? (offsets[i] ?? 0) : from.content.size);
97
+ // Last first, so earlier positions stay valid: the children at the end, the run between, the children at the start.
98
+ for (let k = 0; k < end; k++) {
99
+ patch(
100
+ tr,
101
+ at(from.childCount - 1 - k),
102
+ from.child(from.childCount - 1 - k),
103
+ to.child(to.childCount - 1 - k),
104
+ );
105
+ }
106
+ const [fromEnd, toEnd] = [from.childCount - end, to.childCount - end];
107
+ if (start < fromEnd || start < toEnd) {
108
+ tr.replaceWith(at(start), at(fromEnd), Fragment.fromArray(to.content.content.slice(start, toEnd)));
109
+ }
110
+ for (let i = start - 1; i >= 0; i--) patch(tr, at(i), from.child(i), to.child(i));
93
111
  }
94
112
 
95
113
  /**
package/src/element.ts CHANGED
@@ -209,8 +209,8 @@ const editorStyles: CSSResultGroup = [
209
209
  inset-block-start: var(--astl-editor-sticky-top, var(--astl-space-4));
210
210
  max-block-size: calc(100dvh - var(--astl-editor-sticky-top, var(--astl-space-4)) - var(--astl-space-4));
211
211
  overflow-y: auto;
212
- padding: var(--astl-focus-width);
213
- margin: calc(-1 * var(--astl-focus-width));
212
+ padding: var(--astl-editor-focus-width, 2px);
213
+ margin: calc(-1 * var(--astl-editor-focus-width, 2px));
214
214
  }
215
215
  }
216
216
  `,
package/src/nodes.ts CHANGED
@@ -1933,6 +1933,7 @@ export function pageNode(authoring: Authoring): Node {
1933
1933
  return button;
1934
1934
  };
1935
1935
  const addTitle = named('add-title', t('surface.pageAddTitle'));
1936
+ addTitle.prepend(lineIcon('add', 'astl-icon'));
1936
1937
  // "Check this page", pressed while the page has `check`: its own Check in practice, then its help.
1937
1938
  const check = named('check', t('surface.pageCheck'));
1938
1939
  // Hidden until numbered: the first page has no join button, the only page no delete button.
@@ -101,8 +101,8 @@ const sourceStyles = css`
101
101
  font: var(--astl-size-small) / 1.5 var(--astl-font-mono);
102
102
  }
103
103
  .source textarea:focus-visible {
104
- outline: var(--astl-focus-width) solid var(--astl-focus);
105
- outline-offset: var(--astl-focus-offset);
104
+ outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
105
+ outline-offset: var(--astl-editor-focus-offset, 1px);
106
106
  }
107
107
  `;
108
108
 
package/src/styles.ts CHANGED
@@ -33,8 +33,8 @@ const baseSurfaceStyles: CSSResult = css`
33
33
  }
34
34
  /* A host with a focus cue of its own (the frame with the cursor) may set the sheet's ring to a quieter one. */
35
35
  .astl-surface .tiptap:focus-visible {
36
- outline: var(--astl-editor-sheet-focus-ring, var(--astl-focus-width) solid var(--astl-focus));
37
- outline-offset: var(--astl-focus-offset);
36
+ outline: var(--astl-editor-sheet-focus-ring, var(--astl-editor-focus-width, 2px) solid var(--astl-focus));
37
+ outline-offset: var(--astl-editor-focus-offset, 1px);
38
38
  }
39
39
  .astl-surface .astl-vh {
40
40
  position: absolute;
@@ -131,10 +131,13 @@ const baseSurfaceStyles: CSSResult = css`
131
131
  padding-block-start: var(--astl-space-4);
132
132
  border-block-start: var(--astl-outline-width) solid var(--astl-line);
133
133
  }
134
+ /* A page head: its number, then its buttons at the end; in a narrow column a button that wraps stays at the end, under
135
+ the others, not under the number. */
134
136
  .astl-surface .astl-page-head {
135
137
  display: flex;
136
138
  flex-wrap: wrap;
137
139
  align-items: center;
140
+ justify-content: flex-end;
138
141
  gap: var(--astl-space-2);
139
142
  margin-block: 0 var(--astl-space-3);
140
143
  }
@@ -183,13 +186,15 @@ const baseSurfaceStyles: CSSResult = css`
183
186
  .astl-help-remove,
184
187
  .astl-help-free
185
188
  ):focus-visible {
186
- outline: var(--astl-focus-width) solid var(--astl-focus);
187
- outline-offset: var(--astl-focus-offset);
189
+ outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
190
+ outline-offset: var(--astl-editor-focus-offset, 1px);
188
191
  }
189
192
  /* The surface's authoring controls (the page heads' buttons, a page box's, the blocks' "Add option", a frame's
190
- position line, a picture's buttons) are compact, ghost at rest, so that the exercise looks as students see it. A
191
- host sizes them with --astl-editor-control-size (their height, 1.75rem), --astl-editor-control-font-size (0.8125rem)
192
- and --astl-editor-control-icon-size (0.875rem); a target stays at least 24px (WCAG 2.5.8). */
193
+ position line, a picture's buttons) are compact, so that the exercise looks as students see it, and each is
194
+ recognisable as a button at rest: a text button has a hairline in the outline colour (3:1 at least), an add action
195
+ a plus and the accent colour, an icon alone (a page box's cross) only its icon. A host sizes them with
196
+ --astl-editor-control-size (their height, 1.75rem), --astl-editor-control-font-size (0.8125rem) and
197
+ --astl-editor-control-icon-size (0.875rem); a target stays at least 24px (WCAG 2.5.8). */
193
198
  .astl-surface
194
199
  :is(
195
200
  .astl-page-join,
@@ -209,7 +214,7 @@ const baseSurfaceStyles: CSSResult = css`
209
214
  min-inline-size: max(24px, var(--astl-editor-control-size, 1.75rem));
210
215
  padding-block: 0;
211
216
  padding-inline: var(--astl-space-2);
212
- border: var(--astl-outline-width) solid transparent;
217
+ border: 1px solid var(--astl-outline);
213
218
  border-radius: var(--astl-radius-s);
214
219
  background: transparent;
215
220
  color: var(--astl-ink-muted);
@@ -221,6 +226,14 @@ const baseSurfaceStyles: CSSResult = css`
221
226
  white-space: nowrap;
222
227
  cursor: pointer;
223
228
  }
229
+ .astl-surface .astl-help-remove {
230
+ border-color: transparent;
231
+ }
232
+ .astl-surface .astl-page-add-title {
233
+ padding-inline-start: var(--astl-space-1);
234
+ border-color: transparent;
235
+ color: var(--astl-accent);
236
+ }
224
237
  .astl-surface
225
238
  :is(
226
239
  .astl-page-join,
@@ -234,7 +247,7 @@ const baseSurfaceStyles: CSSResult = css`
234
247
  background: var(--astl-accent-soft);
235
248
  color: var(--astl-ink);
236
249
  }
237
- .astl-surface :is(.astl-help-remove, .astl-block-add button) .astl-icon {
250
+ .astl-surface :is(.astl-help-remove, .astl-block-add button, .astl-page-add-title) .astl-icon {
238
251
  inline-size: var(--astl-editor-control-icon-size, 0.875rem);
239
252
  block-size: var(--astl-editor-control-icon-size, 0.875rem);
240
253
  }
@@ -468,8 +481,8 @@ const baseSurfaceStyles: CSSResult = css`
468
481
  }
469
482
  .astl-surface .astl-block-add :focus-visible,
470
483
  .astl-surface .astl-flag:focus-visible {
471
- outline: var(--astl-focus-width) solid var(--astl-focus);
472
- outline-offset: var(--astl-focus-offset);
484
+ outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
485
+ outline-offset: var(--astl-editor-focus-offset, 1px);
473
486
  }
474
487
  .astl-surface .astl-icon {
475
488
  flex: none;
@@ -531,7 +544,7 @@ const baseSurfaceStyles: CSSResult = css`
531
544
  margin-inline-start: auto;
532
545
  padding-block: 0;
533
546
  padding-inline: var(--astl-space-2);
534
- border: var(--astl-outline-width) solid transparent;
547
+ border: 1px solid transparent;
535
548
  border-radius: var(--astl-radius-s);
536
549
  background: transparent;
537
550
  color: var(--astl-ink-muted);
@@ -546,16 +559,19 @@ const baseSurfaceStyles: CSSResult = css`
546
559
  .astl-surface .astl-frame-head-current > .astl-frame-line {
547
560
  visibility: visible;
548
561
  }
562
+ /* As a button it opens the component's style form: outlined, with the selects' chevron. */
549
563
  .astl-surface button.astl-frame-line {
564
+ border-color: var(--astl-outline);
550
565
  cursor: pointer;
551
566
  }
567
+ ${unsafeCSS(nativeSelectCss('.astl-surface button.astl-frame-line'))}
552
568
  .astl-surface button.astl-frame-line:hover {
553
- background: var(--astl-accent-soft);
569
+ background-color: var(--astl-accent-soft);
554
570
  color: var(--astl-ink);
555
571
  }
556
572
  .astl-surface .astl-frame-line:focus-visible {
557
- outline: var(--astl-focus-width) solid var(--astl-focus);
558
- outline-offset: var(--astl-focus-offset);
573
+ outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
574
+ outline-offset: var(--astl-editor-focus-offset, 1px);
559
575
  }
560
576
  .astl-surface .astl-block.astl-atom {
561
577
  cursor: pointer;
@@ -594,7 +610,7 @@ const baseSurfaceStyles: CSSResult = css`
594
610
  min-block-size: max(24px, var(--astl-editor-control-size, 1.75rem));
595
611
  padding-block: 0;
596
612
  padding-inline: var(--astl-space-2);
597
- border: var(--astl-outline-width) solid var(--astl-outline);
613
+ border: 1px solid var(--astl-outline);
598
614
  border-radius: var(--astl-radius-s);
599
615
  background: var(--astl-surface);
600
616
  color: var(--astl-ink);
@@ -604,8 +620,8 @@ const baseSurfaceStyles: CSSResult = css`
604
620
  cursor: pointer;
605
621
  }
606
622
  .astl-surface .astl-help-head select:focus-visible {
607
- outline: var(--astl-focus-width) solid var(--astl-focus);
608
- outline-offset: var(--astl-focus-offset);
623
+ outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
624
+ outline-offset: var(--astl-editor-focus-offset, 1px);
609
625
  }
610
626
  ${unsafeCSS(nativeSelectCss('.astl-surface .astl-help-head select'))}
611
627
  /* "Remove" closes the head: a cross, a page button's look. */
@@ -643,7 +659,7 @@ const baseSurfaceStyles: CSSResult = css`
643
659
  pointer-events: none;
644
660
  }
645
661
  /* A frame's tags: the help for students its component has, small pills in its tab. Each is a 24px target that keeps
646
- the tab as high as its line. */
662
+ the tab as high as its line; its focus ring hugs the pill, so it stays off the tab's line above when the tab wraps. */
647
663
  .astl-surface .astl-frame-help {
648
664
  box-sizing: border-box;
649
665
  display: inline-flex;
@@ -673,8 +689,11 @@ const baseSurfaceStyles: CSSResult = css`
673
689
  color: var(--astl-ink);
674
690
  }
675
691
  .astl-surface .astl-frame-help:focus-visible {
676
- outline: var(--astl-focus-width) solid var(--astl-focus);
677
- outline-offset: var(--astl-focus-offset);
692
+ outline: none;
693
+ }
694
+ .astl-surface .astl-frame-help:focus-visible > span {
695
+ outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
696
+ outline-offset: var(--astl-editor-focus-offset, 1px);
678
697
  }
679
698
  .astl-surface .astl-child {
680
699
  padding-block: var(--astl-space-1);
@@ -761,10 +780,10 @@ const baseSurfaceStyles: CSSResult = css`
761
780
  margin: 0;
762
781
  padding-block: 0;
763
782
  padding-inline: var(--astl-space-1) var(--astl-space-2);
764
- border: var(--astl-outline-width) solid transparent;
783
+ border: 1px solid transparent;
765
784
  border-radius: var(--astl-radius-s);
766
785
  background: transparent;
767
- color: var(--astl-ink-muted);
786
+ color: var(--astl-accent);
768
787
  font: inherit;
769
788
  font-family: var(--astl-font-body);
770
789
  font-size: var(--astl-editor-control-font-size, 0.8125rem);
@@ -796,11 +815,11 @@ const baseSurfaceStyles: CSSResult = css`
796
815
  words beside it: its ring is inside it, and it is filled (its border is the accent already). An empty chip keeps
797
816
  its colours: the solid ring stands out on its dashed one. */
798
817
  .astl-surface .ProseMirror-selectednode {
799
- outline: var(--astl-focus-width) solid var(--astl-focus);
800
- outline-offset: var(--astl-focus-offset);
818
+ outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
819
+ outline-offset: var(--astl-editor-focus-offset, 1px);
801
820
  }
802
821
  .astl-surface .astl-chip.ProseMirror-selectednode {
803
- outline-offset: calc(-1 * var(--astl-focus-width));
822
+ outline-offset: calc(-1 * var(--astl-editor-focus-width, 2px));
804
823
  }
805
824
  .astl-surface .astl-chip.ProseMirror-selectednode:not([data-empty]) {
806
825
  background: var(--astl-accent);
@@ -925,7 +944,7 @@ const baseSurfaceStyles: CSSResult = css`
925
944
  min-inline-size: max(24px, var(--astl-editor-control-size, 1.75rem));
926
945
  padding-block: 0;
927
946
  padding-inline: var(--astl-space-2);
928
- border: var(--astl-outline-width) solid var(--astl-outline);
947
+ border: 1px solid var(--astl-outline);
929
948
  border-radius: var(--astl-radius-s);
930
949
  background: var(--astl-surface);
931
950
  color: var(--astl-ink);
@@ -939,7 +958,7 @@ const baseSurfaceStyles: CSSResult = css`
939
958
  min-inline-size: max(24px, var(--astl-editor-control-size, 1.75rem));
940
959
  padding-block: 0;
941
960
  padding-inline: var(--astl-space-2);
942
- border: var(--astl-outline-width) solid var(--astl-outline);
961
+ border: 1px solid var(--astl-outline);
943
962
  border-radius: var(--astl-radius-s);
944
963
  background: var(--astl-surface);
945
964
  color: var(--astl-ink);