@astl/editor-tiptap 0.2.1 → 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.
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,9 +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);
188
- }
189
+ outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
190
+ outline-offset: var(--astl-editor-focus-offset, 1px);
191
+ }
192
+ /* The surface's authoring controls (the page heads' buttons, a page box's, the blocks' "Add option", a frame's
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). */
189
198
  .astl-surface
190
199
  :is(
191
200
  .astl-page-join,
@@ -196,17 +205,52 @@ const baseSurfaceStyles: CSSResult = css`
196
205
  .astl-help-remove,
197
206
  .astl-help-free
198
207
  ) {
199
- min-block-size: var(--astl-target-min);
200
- min-inline-size: var(--astl-target-min);
201
- padding-inline: var(--astl-space-3);
202
- border: var(--astl-outline-width) solid var(--astl-outline);
208
+ box-sizing: border-box;
209
+ display: inline-flex;
210
+ align-items: center;
211
+ justify-content: center;
212
+ gap: 0.25rem;
213
+ min-block-size: max(24px, var(--astl-editor-control-size, 1.75rem));
214
+ min-inline-size: max(24px, var(--astl-editor-control-size, 1.75rem));
215
+ padding-block: 0;
216
+ padding-inline: var(--astl-space-2);
217
+ border: 1px solid var(--astl-outline);
203
218
  border-radius: var(--astl-radius-s);
204
- background: var(--astl-surface);
205
- color: var(--astl-ink);
219
+ background: transparent;
220
+ color: var(--astl-ink-muted);
206
221
  font: inherit;
207
- font-size: var(--astl-size-small);
222
+ font-family: var(--astl-font-body);
223
+ font-size: var(--astl-editor-control-font-size, 0.8125rem);
224
+ font-weight: 600;
225
+ line-height: 1.2;
226
+ white-space: nowrap;
208
227
  cursor: pointer;
209
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
+ }
237
+ .astl-surface
238
+ :is(
239
+ .astl-page-join,
240
+ .astl-page-delete,
241
+ .astl-page-add-title,
242
+ .astl-page-remove-title,
243
+ .astl-page-check,
244
+ .astl-help-remove,
245
+ .astl-help-free
246
+ ):hover {
247
+ background: var(--astl-accent-soft);
248
+ color: var(--astl-ink);
249
+ }
250
+ .astl-surface :is(.astl-help-remove, .astl-block-add button, .astl-page-add-title) .astl-icon {
251
+ inline-size: var(--astl-editor-control-icon-size, 0.875rem);
252
+ block-size: var(--astl-editor-control-icon-size, 0.875rem);
253
+ }
210
254
  .astl-surface
211
255
  :is(.astl-page-join, .astl-page-delete, .astl-page-add-title, .astl-page-remove-title, .astl-help-free)[hidden] {
212
256
  display: none;
@@ -215,6 +259,7 @@ const baseSurfaceStyles: CSSResult = css`
215
259
  .astl-surface .astl-page-check[aria-pressed='true'] {
216
260
  border-color: var(--astl-accent);
217
261
  background: var(--astl-accent-soft);
262
+ color: var(--astl-ink);
218
263
  }
219
264
  .astl-surface .astl-page-check[aria-pressed='true']::before {
220
265
  content: '✓ ' / '';
@@ -413,8 +458,7 @@ const baseSurfaceStyles: CSSResult = css`
413
458
  .astl-surface .astl-frame-note[data-severity='warning'] .astl-icon {
414
459
  color: var(--astl-warning);
415
460
  }
416
- .astl-surface .astl-flag,
417
- .astl-surface .astl-block-add button {
461
+ .astl-surface .astl-flag {
418
462
  box-sizing: border-box;
419
463
  display: inline-flex;
420
464
  align-items: center;
@@ -431,14 +475,14 @@ const baseSurfaceStyles: CSSResult = css`
431
475
  font: inherit;
432
476
  cursor: pointer;
433
477
  }
434
- .astl-surface .astl-block-add button:hover {
435
- border-color: var(--astl-line);
478
+ .astl-surface .astl-block-add button:hover:not(:disabled) {
436
479
  background: var(--astl-accent-soft);
480
+ color: var(--astl-ink);
437
481
  }
438
482
  .astl-surface .astl-block-add :focus-visible,
439
483
  .astl-surface .astl-flag:focus-visible {
440
- outline: var(--astl-focus-width) solid var(--astl-focus);
441
- 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);
442
486
  }
443
487
  .astl-surface .astl-icon {
444
488
  flex: none;
@@ -492,35 +536,42 @@ const baseSurfaceStyles: CSSResult = css`
492
536
  position: relative;
493
537
  z-index: 1;
494
538
  box-sizing: border-box;
539
+ display: inline-flex;
540
+ align-items: center;
495
541
  visibility: hidden;
496
- min-block-size: var(--astl-target-min);
542
+ min-block-size: max(24px, var(--astl-editor-control-size, 1.75rem));
497
543
  margin-block: 0 var(--astl-space-1);
498
544
  margin-inline-start: auto;
499
- padding-block: var(--astl-space-1);
545
+ padding-block: 0;
500
546
  padding-inline: var(--astl-space-2);
501
- border: var(--astl-outline-width) solid var(--astl-outline);
547
+ border: 1px solid transparent;
502
548
  border-radius: var(--astl-radius-s);
503
- background: var(--astl-surface);
504
- color: var(--astl-ink);
549
+ background: transparent;
550
+ color: var(--astl-ink-muted);
505
551
  font: inherit;
506
552
  font-family: var(--astl-font-body);
507
- font-size: var(--astl-editor-kicker-size, var(--astl-size-small));
553
+ font-size: var(--astl-editor-control-font-size, 0.8125rem);
508
554
  font-style: normal;
509
- font-weight: 400;
510
- line-height: 1.3;
555
+ font-weight: 600;
556
+ line-height: 1.2;
557
+ white-space: nowrap;
511
558
  }
512
559
  .astl-surface .astl-frame-head-current > .astl-frame-line {
513
560
  visibility: visible;
514
561
  }
562
+ /* As a button it opens the component's style form: outlined, with the selects' chevron. */
515
563
  .astl-surface button.astl-frame-line {
564
+ border-color: var(--astl-outline);
516
565
  cursor: pointer;
517
566
  }
567
+ ${unsafeCSS(nativeSelectCss('.astl-surface button.astl-frame-line'))}
518
568
  .astl-surface button.astl-frame-line:hover {
519
- background: var(--astl-accent-soft);
569
+ background-color: var(--astl-accent-soft);
570
+ color: var(--astl-ink);
520
571
  }
521
572
  .astl-surface .astl-frame-line:focus-visible {
522
- outline: var(--astl-focus-width) solid var(--astl-focus);
523
- 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);
524
575
  }
525
576
  .astl-surface .astl-block.astl-atom {
526
577
  cursor: pointer;
@@ -556,19 +607,21 @@ const baseSurfaceStyles: CSSResult = css`
556
607
  }
557
608
  .astl-surface .astl-help-head select {
558
609
  box-sizing: border-box;
559
- min-block-size: var(--astl-target-min);
610
+ min-block-size: max(24px, var(--astl-editor-control-size, 1.75rem));
611
+ padding-block: 0;
560
612
  padding-inline: var(--astl-space-2);
561
- border: var(--astl-outline-width) solid var(--astl-outline);
613
+ border: 1px solid var(--astl-outline);
562
614
  border-radius: var(--astl-radius-s);
563
615
  background: var(--astl-surface);
564
616
  color: var(--astl-ink);
565
617
  font: inherit;
618
+ font-size: var(--astl-editor-control-font-size, 0.8125rem);
566
619
  font-weight: 400;
567
620
  cursor: pointer;
568
621
  }
569
622
  .astl-surface .astl-help-head select:focus-visible {
570
- outline: var(--astl-focus-width) solid var(--astl-focus);
571
- 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);
572
625
  }
573
626
  ${unsafeCSS(nativeSelectCss('.astl-surface .astl-help-head select'))}
574
627
  /* "Remove" closes the head: a cross, a page button's look. */
@@ -605,14 +658,16 @@ const baseSurfaceStyles: CSSResult = css`
605
658
  color: var(--astl-ink-muted);
606
659
  pointer-events: none;
607
660
  }
608
- /* A frame's tags: the help for students its component has, small pills in its tab. Each is a 44px target that keeps
609
- the tab as high as its line. */
661
+ /* A frame's tags: the help for students its component has, small pills in its tab. Each is a 24px target that keeps
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. */
610
663
  .astl-surface .astl-frame-help {
611
664
  box-sizing: border-box;
612
665
  display: inline-flex;
613
666
  align-items: center;
614
- min-block-size: var(--astl-target-min);
615
- margin-block: calc((1.3em - var(--astl-target-min)) / 2);
667
+ justify-content: center;
668
+ min-block-size: 24px;
669
+ min-inline-size: 24px;
670
+ margin-block: calc((1.3em - 24px) / 2);
616
671
  padding: 0;
617
672
  border: 0;
618
673
  background: none;
@@ -634,8 +689,11 @@ const baseSurfaceStyles: CSSResult = css`
634
689
  color: var(--astl-ink);
635
690
  }
636
691
  .astl-surface .astl-frame-help:focus-visible {
637
- outline: var(--astl-focus-width) solid var(--astl-focus);
638
- 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);
639
697
  }
640
698
  .astl-surface .astl-child {
641
699
  padding-block: var(--astl-space-1);
@@ -704,17 +762,35 @@ const baseSurfaceStyles: CSSResult = css`
704
762
  .astl-surface .astl-block-add {
705
763
  display: flex;
706
764
  flex-wrap: wrap;
707
- gap: var(--astl-space-2);
765
+ gap: var(--astl-space-1);
708
766
  padding-block-start: var(--astl-space-1);
709
767
  }
710
768
  .astl-surface .astl-block-add button[hidden],
711
769
  .astl-surface .astl-block-add:not(:has(button:not([hidden]))) {
712
770
  display: none;
713
771
  }
772
+ /* A small text button under the last child, as the page heads' are. */
714
773
  .astl-surface .astl-block-add button {
715
- padding-inline: var(--astl-space-2) var(--astl-space-3);
774
+ box-sizing: border-box;
775
+ display: inline-flex;
776
+ align-items: center;
777
+ gap: 0.25rem;
778
+ min-block-size: max(24px, var(--astl-editor-control-size, 1.75rem));
779
+ min-inline-size: max(24px, var(--astl-editor-control-size, 1.75rem));
780
+ margin: 0;
781
+ padding-block: 0;
782
+ padding-inline: var(--astl-space-1) var(--astl-space-2);
783
+ border: 1px solid transparent;
784
+ border-radius: var(--astl-radius-s);
785
+ background: transparent;
716
786
  color: var(--astl-accent);
787
+ font: inherit;
788
+ font-family: var(--astl-font-body);
789
+ font-size: var(--astl-editor-control-font-size, 0.8125rem);
717
790
  font-weight: 600;
791
+ line-height: 1.2;
792
+ white-space: nowrap;
793
+ cursor: pointer;
718
794
  }
719
795
  .astl-surface .astl-block-add button:disabled {
720
796
  color: var(--astl-ink-muted);
@@ -739,11 +815,11 @@ const baseSurfaceStyles: CSSResult = css`
739
815
  words beside it: its ring is inside it, and it is filled (its border is the accent already). An empty chip keeps
740
816
  its colours: the solid ring stands out on its dashed one. */
741
817
  .astl-surface .ProseMirror-selectednode {
742
- outline: var(--astl-focus-width) solid var(--astl-focus);
743
- 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);
744
820
  }
745
821
  .astl-surface .astl-chip.ProseMirror-selectednode {
746
- outline-offset: calc(-1 * var(--astl-focus-width));
822
+ outline-offset: calc(-1 * var(--astl-editor-focus-width, 2px));
747
823
  }
748
824
  .astl-surface .astl-chip.ProseMirror-selectednode:not([data-empty]) {
749
825
  background: var(--astl-accent);
@@ -864,28 +940,30 @@ const baseSurfaceStyles: CSSResult = css`
864
940
  font-size: var(--astl-size-small);
865
941
  }
866
942
  .astl-surface button.astl-picture-place {
867
- min-block-size: var(--astl-target-min);
868
- min-inline-size: var(--astl-target-min);
943
+ min-block-size: max(24px, var(--astl-editor-control-size, 1.75rem));
944
+ min-inline-size: max(24px, var(--astl-editor-control-size, 1.75rem));
945
+ padding-block: 0;
869
946
  padding-inline: var(--astl-space-2);
870
- border: var(--astl-outline-width) solid var(--astl-outline);
947
+ border: 1px solid var(--astl-outline);
871
948
  border-radius: var(--astl-radius-s);
872
949
  background: var(--astl-surface);
873
950
  color: var(--astl-ink);
874
951
  font: inherit;
875
- font-size: var(--astl-size-small);
952
+ font-size: var(--astl-editor-control-font-size, 0.8125rem);
876
953
  cursor: pointer;
877
954
  }
878
955
  .astl-surface .astl-picture-edit {
879
956
  align-self: flex-start;
880
- min-block-size: var(--astl-target-min);
881
- min-inline-size: var(--astl-target-min);
957
+ min-block-size: max(24px, var(--astl-editor-control-size, 1.75rem));
958
+ min-inline-size: max(24px, var(--astl-editor-control-size, 1.75rem));
959
+ padding-block: 0;
882
960
  padding-inline: var(--astl-space-2);
883
- border: var(--astl-outline-width) solid var(--astl-outline);
961
+ border: 1px solid var(--astl-outline);
884
962
  border-radius: var(--astl-radius-s);
885
963
  background: var(--astl-surface);
886
964
  color: var(--astl-ink);
887
965
  font: inherit;
888
- font-size: var(--astl-size-small);
966
+ font-size: var(--astl-editor-control-font-size, 0.8125rem);
889
967
  cursor: pointer;
890
968
  }
891
969
  .astl-surface .astl-figure {