@jsenv/navi 0.29.122 → 0.29.124

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.
@@ -382,6 +382,33 @@ const computedStyle = getComputedStyle(button);
382
382
  const controlDefaultFontFamily = computedStyle.fontFamily;
383
383
  const controlDefaultFontSize = computedStyle.fontSize;
384
384
  document.body.removeChild(button);
385
+
386
+ // The color keywords derived from the ink. Written once and declared on every
387
+ // paper — :root, and each surface that is a new one (popup, callout) — so what
388
+ // a container pinned for its own paper does not reach the surface. The -mix
389
+ // ratios (see :root) are read where this is declared.
390
+ const INK_DERIVED_COLOR_TOKENS_CSS = `
391
+ --navi-color-secondary: color-mix(
392
+ in srgb,
393
+ currentColor var(--navi-color-secondary-mix),
394
+ transparent
395
+ );
396
+ --navi-color-emphasis: color-mix(
397
+ in srgb,
398
+ currentColor var(--navi-color-emphasis-mix),
399
+ black
400
+ );
401
+ --navi-color-discrete: color-mix(
402
+ in srgb,
403
+ currentColor var(--navi-color-discrete-mix),
404
+ transparent
405
+ );
406
+ --navi-color-hint: color-mix(
407
+ in srgb,
408
+ currentColor var(--navi-color-hint-mix),
409
+ transparent
410
+ );
411
+ `;
385
412
  const css = /* css */`
386
413
  @layer navi {
387
414
  :root {
@@ -601,14 +628,21 @@ const css = /* css */`
601
628
  hint: barely-there color, watermarks, ghost placeholders
602
629
  The last four mix currentColor toward transparent or black, so they
603
630
  follow whatever ink a container writes in: a dark card sets color and
604
- nothing else. Theme tokens, like everything on :root a container
605
- that overrides one for ITS paper is heard by every popup opened from
606
- it too, a popup having no way to tell a theme from a paper. */
631
+ nothing else. The share of ink in each is the theme's knob, a -mix
632
+ token read wherever the formulas are declared here and on each
633
+ surface that re-declares them (rules below) so a ratio set on :root
634
+ reaches the page and its popups alike. Set on a container it reaches
635
+ none of that container's own text, a var() resolving where its custom
636
+ property is declared; a container that wants one keyword otherwise
637
+ for ITS paper (a white at 88% where 80% of white reads too faint on a
638
+ colored resin) pins the keyword itself, and that value stops at the
639
+ next surface. */
640
+ --navi-color-secondary-mix: 80%;
641
+ --navi-color-emphasis-mix: 50%;
642
+ --navi-color-discrete-mix: 60%;
643
+ --navi-color-hint-mix: 25%;
607
644
  --navi-color-primary: var(--navi-surface-text-color);
608
- --navi-color-secondary: color-mix(in srgb, currentColor 80%, transparent);
609
- --navi-color-emphasis: color-mix(in srgb, currentColor 50%, black);
610
- --navi-color-discrete: color-mix(in srgb, currentColor 60%, transparent);
611
- --navi-color-hint: color-mix(in srgb, currentColor 25%, transparent);
645
+ ${INK_DERIVED_COLOR_TOKENS_CSS}
612
646
 
613
647
  /* What a control shows while it holds nothing: the ::placeholder of an
614
648
  input, the empty value slot of a picker. One place for the whole app:
@@ -622,14 +656,23 @@ const css = /* css */`
622
656
  --navi-placeholder-font-style: normal;
623
657
  }
624
658
 
625
- /* A popup is a new paper (see --navi-popup-color): primary is the ink it
626
- writes in, not the ink of the container it was opened from. On the
627
- element itself, so it beats a container's own override whatever the
628
- layer; an app that wants a popup to keep its container's ink says so on
629
- the popup, unlayered, and wins in turn. */
659
+ /* A surface is a new paper: its color keywords are computed against the
660
+ ink it writes in, not the container's the :root formulas again,
661
+ re-declared so a container's own value for one of them stops here. On
662
+ the element itself, so it beats that value whatever the layer; an app
663
+ that wants a surface to keep its container's ink says so on the
664
+ surface, unlayered, and wins in turn.
665
+ A popup writes in --navi-popup-color. */
630
666
  .navi_popover,
631
667
  .navi_dialog {
632
668
  --navi-color-primary: var(--navi-popup-color);
669
+ ${INK_DERIVED_COLOR_TOKENS_CSS}
670
+ }
671
+ /* A callout writes in the UA's own ink: callout.js sets color: revert on
672
+ a [popover] element, which the UA styles CanvasText. */
673
+ .navi_callout {
674
+ --navi-color-primary: CanvasText;
675
+ ${INK_DERIVED_COLOR_TOKENS_CSS}
633
676
  }
634
677
  }
635
678