monowind 0.2.10 → 0.2.12

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 ============================ */
@@ -363,6 +372,9 @@ mono-wind:not([measuring]) * {
363
372
  * bg-* and focus-invert both make it into the grid paint. */
364
373
  background-color: transparent !important;
365
374
  text-shadow: none !important;
375
+ /* Shadows paint in the grid as shades (specs/box-shadow.md), read
376
+ * during [measuring] like backgrounds. */
377
+ box-shadow: none !important;
366
378
  /* Inline-element horizontal padding, quantized: the engine writes
367
379
  * `--mw-ipl`/`--mw-ipr` (whole cells) on inline elements whose authored
368
380
  * padding it reserved in the run; everything else gets 0, so raw
@@ -456,8 +468,10 @@ mono-wind:not([measuring]) [data-mw-nowrap][data-mw-clip] {
456
468
  * position:absolute (out of flow), so nothing consumes them anyway. */
457
469
  mono-wind:not([measuring]) [data-mw-laid-out] {
458
470
  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;
471
+ /* A sticky box's shift for the scroll rides beside its position
472
+ * (specs/sticky.md). */
473
+ left: calc((var(--mw-x, 0) + var(--mw-sx, 0)) * var(--mw-cw, 1px)) !important;
474
+ top: calc((var(--mw-y, 0) + var(--mw-sy, 0)) * var(--mw-ch, 1px)) !important;
461
475
  /* Neutralize the browser's residual grid machinery (specs/grid.md).
462
476
  * grid-area: per CSS §10.1 an ABSOLUTE child of a grid container with
463
477
  * placement properties uses its grid area as containing block — our
@@ -486,8 +500,15 @@ mono-wind:not([measuring]) [data-mw-laid-out] {
486
500
  mono-wind:not([measuring]) [data-mw-laid-out],
487
501
  mono-wind:not([measuring]) [data-mw-inline-box],
488
502
  mono-wind:not([measuring]) [data-mw-multicol-flow-span],
489
- mono-wind:not([measuring]) [data-mw-flow] {
503
+ mono-wind:not([measuring]) [data-mw-flow],
504
+ mono-wind:not([measuring]) [data-mw-float] {
490
505
  box-sizing: border-box !important;
506
+ /* A sticky shift (specs/sticky.md) belongs to the box the engine wrote
507
+ * it on: custom properties inherit, so every box resets them and only
508
+ * the engine's inline value — which beats an unimportant rule — moves
509
+ * a box. */
510
+ --mw-sx: 0;
511
+ --mw-sy: 0;
491
512
  /* Trailing-gap allowance: a tracked box's lines end with a phantom
492
513
  * `--mw-ls`-cell gap the engine doesn't count. Give the content box that
493
514
  * room by carving it out of the engine-owned right padding/border cells;
@@ -541,6 +562,10 @@ mono-wind:not([measuring]) [data-mw-flow] {
541
562
  * line) — a box taller than one row grows its line, per CSS. */
542
563
  mono-wind:not([measuring]) [data-mw-inline-box] {
543
564
  position: relative !important;
565
+ /* A sticky inline box's shift for the scroll (specs/sticky.md); the
566
+ * vars are absent otherwise. */
567
+ top: calc(var(--mw-sy, 0) * var(--mw-ch, 1px)) !important;
568
+ left: calc(var(--mw-sx, 0) * var(--mw-cw, 1px)) !important;
544
569
  vertical-align: top !important;
545
570
  /* Same half-leading cancellation as laid-out elements — without it
546
571
  * an inline box's NATIVE ink (a textarea's value under leading-*)
@@ -625,7 +650,8 @@ mono-wind:not([measuring]) [data-mw-multicol-flow] {
625
650
  mono-wind:not([measuring])[data-mw-leaf],
626
651
  mono-wind:not([measuring]) [data-mw-laid-out],
627
652
  mono-wind:not([measuring]) [data-mw-multicol-flow],
628
- mono-wind:not([measuring]) [data-mw-flow] {
653
+ mono-wind:not([measuring]) [data-mw-flow],
654
+ mono-wind:not([measuring]) [data-mw-float] {
629
655
  text-indent: calc(var(--mw-ti, 0) * var(--mw-cw, 1px)) !important;
630
656
  }
631
657
 
@@ -638,6 +664,7 @@ mono-wind:not([measuring]) [data-mw-flow] {
638
664
  * block for their absolutized descendants (a transformed box contains
639
665
  * them like a positioned one). */
640
666
  mono-wind:not([measuring]) [data-mw-flow],
667
+ mono-wind:not([measuring]) [data-mw-float],
641
668
  mono-wind:not([measuring]) [data-mw-multicol-flow-span] {
642
669
  position: static !important;
643
670
  margin-top: calc(var(--mw-mt, 0) * var(--mw-ch, 1px)) !important;
@@ -649,12 +676,36 @@ mono-wind:not([measuring]) [data-mw-multicol-flow-span] {
649
676
  mono-wind:not([measuring]) [data-mw-multicol-flow-span] {
650
677
  column-span: all !important;
651
678
  }
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] {
679
+ /* A formatting-context root among flow children a container, or a leaf
680
+ * CSS makes one keeps its own: its first child's top margin stays
681
+ * inside it, where the engine put that child (the shadow slot does the
682
+ * same for the host's, element.ts), and it steps aside from a float
683
+ * rather than passing under (specs/float.md). */
684
+ mono-wind:not([measuring]) [data-mw-flow="box"] {
656
685
  contain: layout !important;
657
686
  }
687
+ /* A float (specs/float.md): the browser floats the engine's box, and
688
+ * the lines of the leaf flow children beside it shorten as the engine
689
+ * shortened them, while a root flow child steps aside as the engine
690
+ * placed it. Both margin boxes take part in the browser's fit — a
691
+ * float's is the exclusion, a root's must not overlap one — so each
692
+ * gives back the shared rule's widening on its right margin: the
693
+ * tracking allowance and, as a quarter pixel, the layout-unit headroom.
694
+ * A root or a later float that fits the engine's band exactly then
695
+ * fits natively too, and a line beside a float keeps its headroom. */
696
+ mono-wind:not([measuring]) [data-mw-float],
697
+ mono-wind:not([measuring]) [data-mw-flow="box"] {
698
+ margin-right: calc(
699
+ (var(--mw-mr, 0) - max(0, var(--mw-ls, 0) - var(--mw-pr, 0) - var(--mw-br, 0))) *
700
+ var(--mw-cw, 1px) - 0.25px
701
+ ) !important;
702
+ }
703
+ mono-wind:not([measuring]) [data-mw-float="left"] {
704
+ float: left !important;
705
+ }
706
+ mono-wind:not([measuring]) [data-mw-float="right"] {
707
+ float: right !important;
708
+ }
658
709
 
659
710
  /* Spanner-split paragraph flow trusts the NATIVE balancer per segment
660
711
  * (probed pixel-exact in all three engines under quantized inputs):
@@ -726,8 +777,8 @@ mono-wind:not([measuring]) [data-mw-hidden-runs] > [data-mw-laid-out] {
726
777
  }
727
778
 
728
779
  /* 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. */
780
+ * `end`/`center` all land on whole cells (offset = (W - N) × cell width);
781
+ * `justify` produces fractional per-line offsets we can't snap to the grid. */
731
782
  mono-wind:not([measuring])[data-mw-text-align-blocked],
732
783
  mono-wind:not([measuring]) [data-mw-text-align-blocked] {
733
784
  text-align: start !important;