@doenet/doenetml-iframe 0.7.23-dev.475 → 0.7.23-dev.476

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@doenet/doenetml-iframe",
3
3
  "type": "module",
4
4
  "description": "A renderer for DoenetML contained in an iframe",
5
- "version": "0.7.23-dev.475",
5
+ "version": "0.7.23-dev.476",
6
6
  "license": "AGPL-3.0-or-later",
7
7
  "homepage": "https://github.com/Doenet/DoenetML#readme",
8
8
  "repository": {
package/style.css CHANGED
@@ -1,23 +1,52 @@
1
+ .container {
2
+ width: 100%;
3
+ }
4
+ @media (min-width: 640px) {
5
+ .container {
6
+ max-width: 640px;
7
+ }
8
+ }
9
+ @media (min-width: 768px) {
10
+ .container {
11
+ max-width: 768px;
12
+ }
13
+ }
14
+ @media (min-width: 1024px) {
15
+ .container {
16
+ max-width: 1024px;
17
+ }
18
+ }
19
+ @media (min-width: 1280px) {
20
+ .container {
21
+ max-width: 1280px;
22
+ }
23
+ }
24
+ @media (min-width: 1536px) {
25
+ .container {
26
+ max-width: 1536px;
27
+ }
28
+ }
1
29
  .fixed {
2
30
  position: fixed;
3
31
  }
4
-
5
32
  .inline {
6
33
  display: inline;
7
34
  }
8
-
9
35
  .overline {
10
36
  text-decoration-line: overline;
11
37
  }
12
-
13
38
  .blur {
14
39
  --tw-blur: blur(8px);
15
40
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
16
41
  }
17
-
18
42
  .filter {
19
43
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
20
44
  }
45
+ .transition {
46
+ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
47
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
48
+ transition-duration: 150ms;
49
+ }
21
50
 
22
51
  .keyboard-button {
23
52
  display: inline-flex;
@@ -86,8 +115,13 @@
86
115
  }
87
116
 
88
117
  .virtual-keyboard {
118
+ /*
119
+ * How wide the keyboard may spread. A variable because the sub-keyboard
120
+ * has to agree with it, and because the touch-device block below raises
121
+ * it — two literals that must match are two literals that can drift.
122
+ */
123
+ --keyboard-max-width: 42rem;
89
124
  display: flex;
90
- max-width: 42rem;
91
125
  justify-content: center;
92
126
  row-gap: 0.25rem;
93
127
  -moz-column-gap: 0.75rem;
@@ -95,7 +129,6 @@
95
129
  }
96
130
 
97
131
  @media (min-width: 640px) {
98
-
99
132
  .virtual-keyboard {
100
133
  row-gap: 0.5rem;
101
134
  }
@@ -106,12 +139,15 @@
106
139
  }
107
140
 
108
141
  @media (min-width: 640px) {
109
-
110
142
  .virtual-keyboard {
111
143
  flex-wrap: nowrap;
112
144
  }
113
145
  }
114
146
 
147
+ .virtual-keyboard {
148
+ max-width: var(--keyboard-max-width);
149
+ }
150
+
115
151
  .virtual-keyboard .row {
116
152
  display: flex;
117
153
  flex-basis: 100%;
@@ -121,7 +157,6 @@
121
157
  }
122
158
 
123
159
  @media (min-width: 640px) {
124
-
125
160
  .virtual-keyboard .row {
126
161
  -moz-column-gap: 0.5rem;
127
162
  column-gap: 0.5rem;
@@ -137,7 +172,6 @@
137
172
  }
138
173
 
139
174
  @media (min-width: 640px) {
140
-
141
175
  .virtual-keyboard .keyboard-region {
142
176
  -moz-column-gap: 0.5rem;
143
177
  column-gap: 0.5rem;
@@ -151,7 +185,6 @@
151
185
  }
152
186
 
153
187
  @media (min-width: 640px) {
154
-
155
188
  .virtual-keyboard .keyboard-region .key {
156
189
  padding-left: 1rem;
157
190
  padding-right: 1rem;
@@ -160,14 +193,12 @@
160
193
 
161
194
  .virtual-keyboard .sub-keyboard {
162
195
  display: flex;
163
- max-width: 42rem;
164
196
  flex-wrap: wrap;
165
197
  justify-content: center;
166
198
  row-gap: 0.25rem;
167
199
  }
168
200
 
169
201
  @media (min-width: 640px) {
170
-
171
202
  .virtual-keyboard .sub-keyboard {
172
203
  row-gap: 0.5rem;
173
204
  }
@@ -175,6 +206,7 @@
175
206
 
176
207
  .virtual-keyboard .sub-keyboard {
177
208
  height: 100%;
209
+ max-width: var(--keyboard-max-width);
178
210
  }
179
211
 
180
212
  .virtual-keyboard button {
@@ -295,7 +327,6 @@
295
327
  }
296
328
 
297
329
  @media (min-width: 640px) {
298
-
299
330
  .virtual-keyboard-tab-list button {
300
331
  padding: 0.5rem;
301
332
  padding-left: 0.75rem;
@@ -317,10 +348,87 @@
317
348
  --tw-text-opacity: 1;
318
349
  color: rgb(37 99 235 / var(--tw-text-opacity, 1));
319
350
  }
351
+
352
+ /*
353
+ * Touch devices — see the note beside the matching block in
354
+ * `keyboard-tray.css`. A key was 39x40 on a phone and a layout tab 30x25;
355
+ * both are below the 44px a fingertip needs (issue #449).
356
+ *
357
+ * Height is raised outright, since it costs only tray height. Width is left
358
+ * to the flex layout, which already gives each key an equal share of the row:
359
+ * a phone cannot fit twelve 44px-wide keys across, and forcing it would push
360
+ * the row into an overflow or a wrap that helps no one. What helps the other
361
+ * end — a tablet, where the row had room to spare and the keys stayed small
362
+ * in the middle of it — is room for the row to grow, so the even share each
363
+ * key gets is a larger one, and a ceiling raised to match.
364
+ *
365
+ * Both halves are needed. `--keyboard-max-width` alone would hand the extra
366
+ * room to shift, backspace and space, the only keys with no ceiling of their
367
+ * own; the per-key `max-width` alone has nothing extra to hand out. Note that
368
+ * the ceiling is in `em`, and a key is a `button`, which this package's
369
+ * partial copy of Tailwind's preflight leaves at the UA font size of
370
+ * 13.33px — so `4em` is 53px and `4.5em` is 60px, not 64 and 72.
371
+ *
372
+ * Last in the file because every rule here raises one above it and each pair
373
+ * has equal specificity, so source order is all that separates them — a media
374
+ * query adds none. Shift, backspace and space are the exception: their
375
+ * `max-width: none` is set on `.virtual-keyboard .key-*`, two classes, which
376
+ * already outranks the one-class-one-type `button` selector here, so they
377
+ * stay unbounded without being named again. Backspace on the numeric layout
378
+ * is the exception to that exception — a rule above puts its ceiling back at
379
+ * `4em`, and outranks this block for the same reason — so it is the one key
380
+ * that has to be raised by name.
381
+ */
382
+ @media (pointer: coarse) {
383
+ .virtual-keyboard {
384
+ --keyboard-max-width: 48rem;
385
+ }
386
+
387
+ .virtual-keyboard button {
388
+ min-height: 2.75rem;
389
+ max-width: 4.5em;
390
+ }
391
+ .virtual-keyboard.numeric .key-backspace {
392
+ max-width: 4.5em;
393
+ }
394
+ .virtual-keyboard-tab-list button {
395
+ min-height: 2.75rem;
396
+ padding-left: 0.75rem;
397
+ padding-right: 0.75rem;
398
+ }
399
+ }
320
400
  /*
321
401
  Tailwind base is purposely not included because we want all styles to be prefixed. We manually copy in whatever is needed from tailwind preflight.
322
402
  @tailwind base;
323
403
  */
404
+ .container {
405
+ width: 100%;
406
+ }
407
+ @media (min-width: 640px) {
408
+ .container {
409
+ max-width: 640px;
410
+ }
411
+ }
412
+ @media (min-width: 768px) {
413
+ .container {
414
+ max-width: 768px;
415
+ }
416
+ }
417
+ @media (min-width: 1024px) {
418
+ .container {
419
+ max-width: 1024px;
420
+ }
421
+ }
422
+ @media (min-width: 1280px) {
423
+ .container {
424
+ max-width: 1280px;
425
+ }
426
+ }
427
+ @media (min-width: 1536px) {
428
+ .container {
429
+ max-width: 1536px;
430
+ }
431
+ }
324
432
  .fixed {
325
433
  position: fixed;
326
434
  }
@@ -337,6 +445,11 @@ Tailwind base is purposely not included because we want all styles to be prefixe
337
445
  .filter {
338
446
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
339
447
  }
448
+ .transition {
449
+ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
450
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
451
+ transition-duration: 150ms;
452
+ }
340
453
 
341
454
  /*
342
455
  * Some styles from tailwind preflight need to be included here
@@ -381,6 +494,15 @@ Tailwind base is purposely not included because we want all styles to be prefixe
381
494
 
382
495
  --keyboard-tray-height: 280px;
383
496
 
497
+ /*
498
+ * The tab that peeks above a closed tray. Its height and the distance it
499
+ * is raised by are the same measurement — it sits exactly its own height
500
+ * above the tray's top edge — so they are one value, not two that have to
501
+ * be kept equal.
502
+ */
503
+ --keyboard-tab-height: 1.5rem;
504
+ --keyboard-tab-width: 3rem;
505
+
384
506
  border-top: 1px solid var(--kb-tray-border-top);
385
507
 
386
508
  position: fixed;
@@ -406,12 +528,67 @@ Tailwind base is purposely not included because we want all styles to be prefixe
406
528
  transition-duration: 300ms;
407
529
 
408
530
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
409
- min-height: var(--keyboard-tray-height);
410
- max-height: calc(100vh - 1.5rem);
531
+ /* A column, so `.keyboard-container` is bound by the height set below. */
532
+ display: flex;
533
+ flex-direction: column;
534
+ /*
535
+ * The tray may never be so tall that it carries its own tab off the top of
536
+ * the screen: the tab hangs exactly `--keyboard-tab-height` above the
537
+ * tray's top edge, so that much has to stay clear. Both bounds are held to
538
+ * it — the floor as well as the ceiling, because a `min-height` outranks a
539
+ * `max-height` and would otherwise reinstate the overshoot on a viewport
540
+ * shorter than the floor. Written against the variable rather than
541
+ * repeating its value: widening the tab for a fingertip is exactly the
542
+ * change that a literal here would have missed.
543
+ */
544
+ --keyboard-tray-max-height: calc(100vh - var(--keyboard-tab-height));
545
+ min-height: min(
546
+ var(--keyboard-tray-height),
547
+ var(--keyboard-tray-max-height)
548
+ );
549
+ max-height: var(--keyboard-tray-max-height);
411
550
  z-index: 10000;
412
551
  background-color: var(--kb-tray-bg);
413
552
  }
414
553
 
554
+ /*
555
+ * The layout tabs and the keyboard under them, and the only part of the
556
+ * tray that scrolls. A viewport too short for the keyboard — a phone held
557
+ * sideways, or any short window — used to cut the bottom rows off, which
558
+ * on the numeric layout is the number pad; taller keys for a fingertip
559
+ * would have cut off more. `min-height: 0` is what lets it shrink: a flex
560
+ * item's automatic minimum is its own content, which would otherwise push
561
+ * the overflow straight back out to the tray.
562
+ *
563
+ * The layout tabs scroll with the keys rather than staying pinned, so a
564
+ * tray reopened at the position it was left at would be missing them.
565
+ * `keyboard-tray.tsx` scrolls this back to the top as the tray opens.
566
+ *
567
+ * A finger can pan it even though the tray cancels the default action of
568
+ * `pointerdown` across its whole subtree (see `keyboard-tray.tsx`): what
569
+ * suppresses a pan is `touch-action` or a cancelled `touchstart` /
570
+ * `touchmove`, and the tray does neither. Confirmed in Chromium with a
571
+ * real coarse pointer, and asserted in
572
+ * `cypress/e2e/accessibility/virtualKeyboardTouchTargets.cy.js`; iOS
573
+ * Safari has not been tried. `overscroll-behavior` keeps a pan that runs
574
+ * off the end of it from scrolling the document behind the tray.
575
+ */
576
+
577
+ #virtual-keyboard-tray .keyboard-container {
578
+ min-height: 0;
579
+ overflow-y: auto;
580
+ overscroll-behavior: contain;
581
+ }
582
+
583
+ /*
584
+ * Outside `.keyboard-container`'s scroll for positioning purposes even
585
+ * though it is inside it in the markup: its containing block is the tray,
586
+ * so it neither scrolls away nor is clipped, and stays in the corner
587
+ * where it can be reached. That holds only while nothing between the two
588
+ * is positioned — give `.keyboard-container` a `position` and the button
589
+ * starts scrolling away with the keys.
590
+ */
591
+
415
592
  #virtual-keyboard-tray .close-keyboard-button {
416
593
  position: absolute;
417
594
  top: 0px;
@@ -441,19 +618,19 @@ Tailwind base is purposely not included because we want all styles to be prefixe
441
618
  }
442
619
 
443
620
  /*
444
- * Inline-end footprint of this button (w-12 + me-4 = 4rem) is mirrored
445
- * by `--keyboard-tab-reserve-width` in
621
+ * Inline-end footprint of this button (`--keyboard-tab-width` + me-4) is
622
+ * mirrored by `--keyboard-tab-reserve-width` in
446
623
  * `packages/doenetml/src/EditorViewer/editor-viewer.css` so the editor
447
624
  * footer can shift its last element inward to clear it. Keep the two
448
- * values in sync — and keep both on the *same* axis. `end-0` here pairs
449
- * with `margin-inline-end` there; making one logical and leaving the
450
- * other physical would send the tab and the space reserved for it to
451
- * opposite edges under `rtl`, which is worse than either alone.
625
+ * values in sync — including the touch-device widening below and keep
626
+ * both on the *same* axis. `end-0` here pairs with `margin-inline-end`
627
+ * there; making one logical and leaving the other physical would send the
628
+ * tab and the space reserved for it to opposite edges under `rtl`, which
629
+ * is worse than either alone.
452
630
  */
453
631
 
454
632
  #virtual-keyboard-tray .open-keyboard-button {
455
633
  position: absolute;
456
- top: -1.5rem;
457
634
  inset-inline-end: 0px;
458
635
  margin-inline-end: 1rem;
459
636
  border-top-left-radius: 0.25rem;
@@ -475,13 +652,14 @@ Tailwind base is purposely not included because we want all styles to be prefixe
475
652
 
476
653
  #virtual-keyboard-tray .open-keyboard-button {
477
654
  display: flex;
478
- height: 1.5rem;
479
- width: 3rem;
480
655
  align-items: center;
481
656
  justify-content: center;
482
657
  border-width: 1px;
483
658
  --tw-bg-opacity: 1;
484
659
  background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
660
+ top: calc(-1 * var(--keyboard-tab-height));
661
+ width: var(--keyboard-tab-width);
662
+ height: var(--keyboard-tab-height);
485
663
  }
486
664
 
487
665
  #virtual-keyboard-tray .virtual-keyboard-tab-list {
@@ -501,6 +679,38 @@ Tailwind base is purposely not included because we want all styles to be prefixe
501
679
  margin-right: auto;
502
680
  }
503
681
 
682
+ /*
683
+ * Touch devices: everything here is tapped with a fingertip rather than
684
+ * pointed at, so every control needs a target a fingertip can land on. 44px is
685
+ * the minimum in Apple's HIG and in WCAG 2.5.5. The tray shipped with a 48x24
686
+ * tab to open it, a 24x24 button to close it, and layout tabs measuring 30x25
687
+ * on a phone — issue #449.
688
+ *
689
+ * Keyed on the reader's primary pointer being coarse rather than on how wide
690
+ * the viewport is: a narrow window on a desktop is still driven by a mouse,
691
+ * and a tablet held in two hands is not, however much room it has. This is the
692
+ * same test the viewer uses to decide whether to suppress the device's own
693
+ * on-screen keyboard, so the two stay consistent about what a touch device is.
694
+ */
695
+ @media (pointer: coarse) {
696
+ #virtual-keyboard-tray {
697
+ --keyboard-tab-height: 2.75rem;
698
+ --keyboard-tab-width: 4rem;
699
+ }
700
+
701
+ #virtual-keyboard-tray .open-keyboard-button {
702
+ /* The icon is drawn at 1em, so it grows with the tab. */
703
+ font-size: 1.25rem;
704
+ line-height: 1.75rem;
705
+ }
706
+
707
+ #virtual-keyboard-tray .close-keyboard-button {
708
+ margin: 0.25rem;
709
+ height: 2.75rem;
710
+ width: 2.75rem;
711
+ }
712
+ }
713
+
504
714
  /* Dark-mode overrides — applied when data-theme="dark" is written to #virtual-keyboard-tray */
505
715
  #virtual-keyboard-tray[data-theme="dark"] {
506
716
  --kb-tray-bg: #1e1e1e;