@astl/editor-tiptap 0.1.4 → 0.2.1

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
@@ -179,13 +179,23 @@ const baseSurfaceStyles: CSSResult = css`
179
179
  .astl-page-delete,
180
180
  .astl-page-add-title,
181
181
  .astl-page-remove-title,
182
- .astl-help-remove
182
+ .astl-page-check,
183
+ .astl-help-remove,
184
+ .astl-help-free
183
185
  ):focus-visible {
184
186
  outline: var(--astl-focus-width) solid var(--astl-focus);
185
187
  outline-offset: var(--astl-focus-offset);
186
188
  }
187
189
  .astl-surface
188
- :is(.astl-page-join, .astl-page-delete, .astl-page-add-title, .astl-page-remove-title, .astl-help-remove) {
190
+ :is(
191
+ .astl-page-join,
192
+ .astl-page-delete,
193
+ .astl-page-add-title,
194
+ .astl-page-remove-title,
195
+ .astl-page-check,
196
+ .astl-help-remove,
197
+ .astl-help-free
198
+ ) {
189
199
  min-block-size: var(--astl-target-min);
190
200
  min-inline-size: var(--astl-target-min);
191
201
  padding-inline: var(--astl-space-3);
@@ -197,9 +207,18 @@ const baseSurfaceStyles: CSSResult = css`
197
207
  font-size: var(--astl-size-small);
198
208
  cursor: pointer;
199
209
  }
200
- .astl-surface :is(.astl-page-join, .astl-page-delete, .astl-page-add-title, .astl-page-remove-title)[hidden] {
210
+ .astl-surface
211
+ :is(.astl-page-join, .astl-page-delete, .astl-page-add-title, .astl-page-remove-title, .astl-help-free)[hidden] {
201
212
  display: none;
202
213
  }
214
+ /* "Check this page" pressed: filled, with a tick beside its words, so the state shows without colour alone. */
215
+ .astl-surface .astl-page-check[aria-pressed='true'] {
216
+ border-color: var(--astl-accent);
217
+ background: var(--astl-accent-soft);
218
+ }
219
+ .astl-surface .astl-page-check[aria-pressed='true']::before {
220
+ content: '✓ ' / '';
221
+ }
203
222
  /* Beside the title the button keeps its words whole (it broke "Remove" at 320 px): the title gives way instead. */
204
223
  .astl-surface .astl-page-remove-title {
205
224
  flex: none;
@@ -273,7 +292,7 @@ const baseSurfaceStyles: CSSResult = css`
273
292
  display: flex;
274
293
  flex-wrap: wrap;
275
294
  align-items: center;
276
- gap: 0 var(--astl-space-1);
295
+ gap: 0.2em var(--astl-space-1);
277
296
  inline-size: fit-content;
278
297
  max-inline-size: 100%;
279
298
  margin-block: var(--astl-space-4) calc(-1 * var(--frame-width));
@@ -509,13 +528,17 @@ const baseSurfaceStyles: CSSResult = css`
509
528
  .astl-surface .astl-atom-summary {
510
529
  color: var(--astl-ink);
511
530
  }
512
- /* Help for students: a labelled box in its interaction or at its place on the page, never wider than either. */
531
+ /* Help for students on the page: a compact labelled box at its place, never wider than the page. A graded block
532
+ component's own help is kept, not drawn: its frame's tags say what it has, the card edits it. */
533
+ .astl-surface .astl-block[data-astl-graded] .astl-help-box {
534
+ display: none;
535
+ }
513
536
  .astl-surface .astl-help-box {
514
537
  box-sizing: border-box;
515
538
  max-inline-size: 100%;
516
539
  margin-block: var(--astl-space-2);
517
- padding-block: var(--astl-space-1) var(--astl-space-2);
518
- padding-inline: var(--astl-space-3);
540
+ padding-block: 0 var(--astl-space-1);
541
+ padding-inline: var(--astl-space-2);
519
542
  border: var(--astl-outline-width) dashed var(--astl-outline);
520
543
  border-radius: var(--astl-radius-s);
521
544
  background: var(--astl-surface-raised);
@@ -548,17 +571,72 @@ const baseSurfaceStyles: CSSResult = css`
548
571
  outline-offset: var(--astl-focus-offset);
549
572
  }
550
573
  ${unsafeCSS(nativeSelectCss('.astl-surface .astl-help-head select'))}
551
- /* "Remove" closes the head, a page button's look. */
574
+ /* "Remove" closes the head: a cross, a page button's look. */
552
575
  .astl-surface .astl-help-remove {
576
+ display: inline-flex;
577
+ align-items: center;
578
+ justify-content: center;
553
579
  margin-inline-start: auto;
580
+ padding-inline: 0;
581
+ font-weight: 400;
582
+ }
583
+ /* A page's hint with a cost (an older source): what it costs, and "Make it free". */
584
+ .astl-surface .astl-help-notice {
585
+ flex: 1 1 12rem;
586
+ font-weight: 400;
587
+ }
588
+ .astl-surface .astl-help-free {
554
589
  font-weight: 400;
555
590
  }
591
+ .astl-surface :is(.astl-help-notice, .astl-help-head select)[hidden] {
592
+ display: none;
593
+ }
556
594
  .astl-surface .astl-help-content > :first-child {
557
- margin-block-start: var(--astl-space-1);
595
+ margin-block-start: 0;
558
596
  }
559
597
  .astl-surface .astl-help-content > :last-child {
560
598
  margin-block-end: 0;
561
599
  }
600
+ /* An empty box's line says what to write there. */
601
+ .astl-surface .astl-help-content > .astl-help-empty::before {
602
+ content: attr(data-placeholder);
603
+ float: inline-start;
604
+ block-size: 0;
605
+ color: var(--astl-ink-muted);
606
+ pointer-events: none;
607
+ }
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. */
610
+ .astl-surface .astl-frame-help {
611
+ box-sizing: border-box;
612
+ display: inline-flex;
613
+ align-items: center;
614
+ min-block-size: var(--astl-target-min);
615
+ margin-block: calc((1.3em - var(--astl-target-min)) / 2);
616
+ padding: 0;
617
+ border: 0;
618
+ background: none;
619
+ color: inherit;
620
+ font: inherit;
621
+ }
622
+ .astl-surface .astl-frame-help > span {
623
+ padding-inline: 0.45em;
624
+ border: 1px solid currentColor;
625
+ border-radius: var(--astl-radius-pill);
626
+ line-height: 1.3;
627
+ white-space: nowrap;
628
+ }
629
+ .astl-surface button.astl-frame-help {
630
+ cursor: pointer;
631
+ }
632
+ .astl-surface button.astl-frame-help:hover > span {
633
+ background: var(--astl-accent-soft);
634
+ color: var(--astl-ink);
635
+ }
636
+ .astl-surface .astl-frame-help:focus-visible {
637
+ outline: var(--astl-focus-width) solid var(--astl-focus);
638
+ outline-offset: var(--astl-focus-offset);
639
+ }
562
640
  .astl-surface .astl-child {
563
641
  padding-block: var(--astl-space-1);
564
642
  padding-inline-start: var(--astl-space-5);
@@ -906,11 +984,12 @@ const zonePalette = unsafeCSS(
906
984
  ).join(''),
907
985
  );
908
986
 
909
- // Authors' styles and layouts, as the player draws them: floats stay in their page, no style makes the surface scroll
910
- // sideways, and columns wrap by themselves. A column's edge is the surface's own: the student sees none.
987
+ // Authors' styles and layouts, as the player draws them: floats stay in their page (its content, not its head, which
988
+ // stays a row of its own), no style makes the surface scroll sideways, and columns wrap by themselves. A column's edge
989
+ // is the surface's own: the student sees none.
911
990
  const layoutStyles = css`
912
991
  .astl-surface .ProseMirror,
913
- .astl-surface .astl-page > div {
992
+ .astl-surface .astl-page > div:not(.astl-page-head) {
914
993
  display: flow-root;
915
994
  }
916
995
  .astl-surface .ProseMirror [style] {