@dogsbay/docs-layout 0.2.0-beta.96 → 0.2.0-beta.98
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 +3 -3
- package/src/DocsLayout.astro +32 -3
- package/src/TagList.astro +17 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dogsbay/docs-layout",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.98",
|
|
4
4
|
"description": "Standard documentation layout components for Dogsbay",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"./json-ld": "./src/json-ld.ts"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@dogsbay/primitives": "0.2.0-beta.
|
|
34
|
-
"@dogsbay/ui": "0.2.0-beta.
|
|
33
|
+
"@dogsbay/primitives": "0.2.0-beta.98",
|
|
34
|
+
"@dogsbay/ui": "0.2.0-beta.98"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"happy-dom": "^20.10.6",
|
package/src/DocsLayout.astro
CHANGED
|
@@ -839,10 +839,39 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
839
839
|
></script>
|
|
840
840
|
)}
|
|
841
841
|
|
|
842
|
+
{/*
|
|
843
|
+
Theme bootstrap. Inline and BLOCKING on purpose — it must run
|
|
844
|
+
before first paint or the page flashes light before going dark.
|
|
845
|
+
|
|
846
|
+
An explicit choice wins in BOTH directions. Someone on a
|
|
847
|
+
dark-mode OS who deliberately picked light must stay light, so
|
|
848
|
+
"light" is checked rather than treated as "not dark". Only the
|
|
849
|
+
absence of a stored value falls through to the OS preference.
|
|
850
|
+
|
|
851
|
+
That fallback is the point of this block. Previously the only
|
|
852
|
+
condition was `=== "dark"`, so a visitor whose OS is in dark mode
|
|
853
|
+
got a light page until they found the toggle — and nothing else
|
|
854
|
+
in the CSS consulted prefers-color-scheme either. It also made
|
|
855
|
+
dark mode untestable by any tool that emulates the media query
|
|
856
|
+
(DevTools' Rendering panel, Playwright's colorScheme), because
|
|
857
|
+
the page did not read it.
|
|
858
|
+
|
|
859
|
+
localStorage access throws in some privacy modes; a throw here
|
|
860
|
+
would skip the class entirely, so it is guarded and degrades to
|
|
861
|
+
the OS preference.
|
|
862
|
+
*/}
|
|
842
863
|
<script is:inline>
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
864
|
+
(function () {
|
|
865
|
+
var stored = null;
|
|
866
|
+
try {
|
|
867
|
+
stored = localStorage.getItem("theme");
|
|
868
|
+
} catch (e) {}
|
|
869
|
+
var dark =
|
|
870
|
+
stored === "dark" ||
|
|
871
|
+
(stored !== "light" &&
|
|
872
|
+
window.matchMedia("(prefers-color-scheme: dark)").matches);
|
|
873
|
+
if (dark) document.documentElement.classList.add("dark");
|
|
874
|
+
})();
|
|
846
875
|
</script>
|
|
847
876
|
<slot name="head" />
|
|
848
877
|
</head>
|
package/src/TagList.astro
CHANGED
|
@@ -72,8 +72,13 @@ const chips = buildChips(tags, { indexPath, prefixes, labels });
|
|
|
72
72
|
*/
|
|
73
73
|
const PALETTE: Record<TagPaletteName, string> = {
|
|
74
74
|
blue: "border-blue-500/40 bg-blue-500/15 text-blue-700 dark:text-blue-300",
|
|
75
|
+
// amber-800, not -700, in light mode: amber-700 on amber-500/15 is
|
|
76
|
+
// 4.48:1 — under 4.5:1 by a hair, and failing regardless of the
|
|
77
|
+
// opacity bug below. -800 gives 6.32:1. Every other colour clears it
|
|
78
|
+
// at -700 (4.76–8.60:1). Dark mode is unaffected: text-*-300 on the
|
|
79
|
+
// same tint over a dark page is 9–12:1 across the palette.
|
|
75
80
|
amber:
|
|
76
|
-
"border-amber-500/40 bg-amber-500/15 text-amber-
|
|
81
|
+
"border-amber-500/40 bg-amber-500/15 text-amber-800 dark:text-amber-300",
|
|
77
82
|
emerald:
|
|
78
83
|
"border-emerald-500/40 bg-emerald-500/15 text-emerald-700 dark:text-emerald-300",
|
|
79
84
|
violet:
|
|
@@ -108,7 +113,17 @@ const DEFAULT_CLASS =
|
|
|
108
113
|
>
|
|
109
114
|
{chip.prefixLabel ? (
|
|
110
115
|
<Fragment>
|
|
111
|
-
|
|
116
|
+
{/*
|
|
117
|
+
No opacity here. `opacity-70` on the prefix blended the
|
|
118
|
+
text 30% toward the chip background and put EVERY colour
|
|
119
|
+
in the palette below 4.5:1 — measured 2.75–3.95:1, worst
|
|
120
|
+
amber, best slate. It is 12px text, so 4.5:1 applies.
|
|
121
|
+
|
|
122
|
+
The prefix/leaf distinction is carried by font-weight
|
|
123
|
+
instead: the leaf below is font-semibold against the
|
|
124
|
+
anchor's font-medium. Weight costs no contrast.
|
|
125
|
+
*/}
|
|
126
|
+
<span>{chip.prefixLabel}:</span>
|
|
112
127
|
<span class="font-semibold">{chip.leafLabel}</span>
|
|
113
128
|
</Fragment>
|
|
114
129
|
) : (
|