monowind 0.2.10 → 0.2.11

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.css CHANGED
@@ -154,7 +154,7 @@
154
154
  * despite `pointer-events: none`, and would show an arrow there.
155
155
  * Interactives keep their own (UA and authored cursors win). */
156
156
  mono-wind[select="grid"]
157
- :is([data-mw-laid-out], [data-mw-flow]):not(
157
+ :is([data-mw-laid-out], [data-mw-flow], [data-mw-float]):not(
158
158
  a,
159
159
  button,
160
160
  input,
@@ -278,10 +278,9 @@ mono-wind:not([data-mw-ready]) {
278
278
  * invisible: every field, as some engines keep an OS default background
279
279
  * when only `color` is set, and Safari's text-shadow ink. Shadow scopes
280
280
  * can't share the rule: element.ts (the slot) and @monowind/ascii's
281
- * transcript restate it — update all three together. Form controls
282
- * render their own text and keep their native highlight; forced
283
- * colors paint selections themselves and strip backgrounds, so the
284
- * native highlight stays there. */
281
+ * transcript restate it — update all three together. Forced colors
282
+ * paint selections themselves and strip backgrounds, so the native
283
+ * highlight stays there. */
285
284
  @media (forced-colors: none) {
286
285
  mono-wind:not([measuring])[data-mw-leaf]::selection,
287
286
  mono-wind:not([measuring])
@@ -290,6 +289,16 @@ mono-wind:not([data-mw-ready]) {
290
289
  text-shadow: none !important;
291
290
  background: transparent !important;
292
291
  }
292
+ /* An editable renders its own text, and Chromium and WebKit hand it
293
+ * its parent's `::selection` (css-pseudo-4 highlight inheritance —
294
+ * transparent, from the rule above): its own rule swaps its colors as
295
+ * the grid swaps a selected cell's, from the ink and ground the engine
296
+ * measured and wrote on it (render.ts). */
297
+ mono-wind:not([measuring])
298
+ :where(input, textarea, select, [contenteditable], [contenteditable] *)::selection {
299
+ color: var(--mw-ground, var(--mw-bg, canvas));
300
+ background: var(--mw-ink, var(--mw-fg, canvastext));
301
+ }
293
302
  }
294
303
 
295
304
  /* === Typography locks and measuring gates ============================ */
@@ -456,8 +465,10 @@ mono-wind:not([measuring]) [data-mw-nowrap][data-mw-clip] {
456
465
  * position:absolute (out of flow), so nothing consumes them anyway. */
457
466
  mono-wind:not([measuring]) [data-mw-laid-out] {
458
467
  position: absolute !important;
459
- left: calc(var(--mw-x, 0) * var(--mw-cw, 1px)) !important;
460
- top: calc(var(--mw-y, 0) * var(--mw-ch, 1px)) !important;
468
+ /* A sticky box's shift for the scroll rides beside its position
469
+ * (specs/sticky.md). */
470
+ left: calc((var(--mw-x, 0) + var(--mw-sx, 0)) * var(--mw-cw, 1px)) !important;
471
+ top: calc((var(--mw-y, 0) + var(--mw-sy, 0)) * var(--mw-ch, 1px)) !important;
461
472
  /* Neutralize the browser's residual grid machinery (specs/grid.md).
462
473
  * grid-area: per CSS §10.1 an ABSOLUTE child of a grid container with
463
474
  * placement properties uses its grid area as containing block — our
@@ -486,8 +497,15 @@ mono-wind:not([measuring]) [data-mw-laid-out] {
486
497
  mono-wind:not([measuring]) [data-mw-laid-out],
487
498
  mono-wind:not([measuring]) [data-mw-inline-box],
488
499
  mono-wind:not([measuring]) [data-mw-multicol-flow-span],
489
- mono-wind:not([measuring]) [data-mw-flow] {
500
+ mono-wind:not([measuring]) [data-mw-flow],
501
+ mono-wind:not([measuring]) [data-mw-float] {
490
502
  box-sizing: border-box !important;
503
+ /* A sticky shift (specs/sticky.md) belongs to the box the engine wrote
504
+ * it on: custom properties inherit, so every box resets them and only
505
+ * the engine's inline value — which beats an unimportant rule — moves
506
+ * a box. */
507
+ --mw-sx: 0;
508
+ --mw-sy: 0;
491
509
  /* Trailing-gap allowance: a tracked box's lines end with a phantom
492
510
  * `--mw-ls`-cell gap the engine doesn't count. Give the content box that
493
511
  * room by carving it out of the engine-owned right padding/border cells;
@@ -541,6 +559,10 @@ mono-wind:not([measuring]) [data-mw-flow] {
541
559
  * line) — a box taller than one row grows its line, per CSS. */
542
560
  mono-wind:not([measuring]) [data-mw-inline-box] {
543
561
  position: relative !important;
562
+ /* A sticky inline box's shift for the scroll (specs/sticky.md); the
563
+ * vars are absent otherwise. */
564
+ top: calc(var(--mw-sy, 0) * var(--mw-ch, 1px)) !important;
565
+ left: calc(var(--mw-sx, 0) * var(--mw-cw, 1px)) !important;
544
566
  vertical-align: top !important;
545
567
  /* Same half-leading cancellation as laid-out elements — without it
546
568
  * an inline box's NATIVE ink (a textarea's value under leading-*)
@@ -625,7 +647,8 @@ mono-wind:not([measuring]) [data-mw-multicol-flow] {
625
647
  mono-wind:not([measuring])[data-mw-leaf],
626
648
  mono-wind:not([measuring]) [data-mw-laid-out],
627
649
  mono-wind:not([measuring]) [data-mw-multicol-flow],
628
- mono-wind:not([measuring]) [data-mw-flow] {
650
+ mono-wind:not([measuring]) [data-mw-flow],
651
+ mono-wind:not([measuring]) [data-mw-float] {
629
652
  text-indent: calc(var(--mw-ti, 0) * var(--mw-cw, 1px)) !important;
630
653
  }
631
654
 
@@ -638,6 +661,7 @@ mono-wind:not([measuring]) [data-mw-flow] {
638
661
  * block for their absolutized descendants (a transformed box contains
639
662
  * them like a positioned one). */
640
663
  mono-wind:not([measuring]) [data-mw-flow],
664
+ mono-wind:not([measuring]) [data-mw-float],
641
665
  mono-wind:not([measuring]) [data-mw-multicol-flow-span] {
642
666
  position: static !important;
643
667
  margin-top: calc(var(--mw-mt, 0) * var(--mw-ch, 1px)) !important;
@@ -649,12 +673,36 @@ mono-wind:not([measuring]) [data-mw-multicol-flow-span] {
649
673
  mono-wind:not([measuring]) [data-mw-multicol-flow-span] {
650
674
  column-span: all !important;
651
675
  }
652
- /* A flow child's own formatting context: its first child's top margin
653
- * stays inside it, where the engine put that child (the shadow slot
654
- * does the same for the host's, element.ts). */
655
- mono-wind:not([measuring]) [data-mw-flow] {
676
+ /* A formatting-context root among flow children a container, or a leaf
677
+ * CSS makes one keeps its own: its first child's top margin stays
678
+ * inside it, where the engine put that child (the shadow slot does the
679
+ * same for the host's, element.ts), and it steps aside from a float
680
+ * rather than passing under (specs/float.md). */
681
+ mono-wind:not([measuring]) [data-mw-flow="box"] {
656
682
  contain: layout !important;
657
683
  }
684
+ /* A float (specs/float.md): the browser floats the engine's box, and
685
+ * the lines of the leaf flow children beside it shorten as the engine
686
+ * shortened them, while a root flow child steps aside as the engine
687
+ * placed it. Both margin boxes take part in the browser's fit — a
688
+ * float's is the exclusion, a root's must not overlap one — so each
689
+ * gives back the shared rule's widening on its right margin: the
690
+ * tracking allowance and, as a quarter pixel, the layout-unit headroom.
691
+ * A root or a later float that fits the engine's band exactly then
692
+ * fits natively too, and a line beside a float keeps its headroom. */
693
+ mono-wind:not([measuring]) [data-mw-float],
694
+ mono-wind:not([measuring]) [data-mw-flow="box"] {
695
+ margin-right: calc(
696
+ (var(--mw-mr, 0) - max(0, var(--mw-ls, 0) - var(--mw-pr, 0) - var(--mw-br, 0))) *
697
+ var(--mw-cw, 1px) - 0.25px
698
+ ) !important;
699
+ }
700
+ mono-wind:not([measuring]) [data-mw-float="left"] {
701
+ float: left !important;
702
+ }
703
+ mono-wind:not([measuring]) [data-mw-float="right"] {
704
+ float: right !important;
705
+ }
658
706
 
659
707
  /* Spanner-split paragraph flow trusts the NATIVE balancer per segment
660
708
  * (probed pixel-exact in all three engines under quantized inputs):
@@ -726,8 +774,8 @@ mono-wind:not([measuring]) [data-mw-hidden-runs] > [data-mw-laid-out] {
726
774
  }
727
775
 
728
776
  /* Force off-grid text alignments back to `start`. `text-left`/`right`/`start`/
729
- * `end` all land on whole cells (offset = (W - N) × cell width); `center` and
730
- * `justify` produce fractional per-line offsets we can't snap to the grid. */
777
+ * `end`/`center` all land on whole cells (offset = (W - N) × cell width);
778
+ * `justify` produces fractional per-line offsets we can't snap to the grid. */
731
779
  mono-wind:not([measuring])[data-mw-text-align-blocked],
732
780
  mono-wind:not([measuring]) [data-mw-text-align-blocked] {
733
781
  text-align: start !important;