@aglyn/shared-ui-theme 1.0.0-beta.224 → 1.0.0-beta.226
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/shared-ui-theme",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.226",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/shared-data-types": "1.0.0-beta.
|
|
29
|
-
"@aglyn/shared-util-tools": "1.0.0-beta.
|
|
30
|
-
"@aglyn/shared-util-vendor": "1.0.0-beta.
|
|
28
|
+
"@aglyn/shared-data-types": "1.0.0-beta.226",
|
|
29
|
+
"@aglyn/shared-util-tools": "1.0.0-beta.226",
|
|
30
|
+
"@aglyn/shared-util-vendor": "1.0.0-beta.226",
|
|
31
31
|
"@emotion/cache": "^11.14.0",
|
|
32
32
|
"@emotion/react": "11.14.0",
|
|
33
33
|
"@swc/helpers": "0.5.23",
|
|
@@ -27,11 +27,12 @@ import type { ThemeMode } from '../hocs/create-with-theme-provider';
|
|
|
27
27
|
* repaints once React has hydrated the whole page.
|
|
28
28
|
*
|
|
29
29
|
* A browser sends it only where the origin asked for it, and the tenant
|
|
30
|
-
* middleware is what asks — it advertises this same token in `Accept-CH`
|
|
31
|
-
* `Critical-CH
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
30
|
+
* middleware is what asks — it advertises this same token in `Accept-CH`
|
|
31
|
+
* (not `Critical-CH`, so a first visit is never retried for it; that visit
|
|
32
|
+
* settles the scheme at hydration) and splits its cache on it in `Vary`, from
|
|
33
|
+
* a copy of its own, since an edge bundle takes no library imports. Reading
|
|
34
|
+
* the request header by this constant is safe whatever the transport did to
|
|
35
|
+
* the casing: `Headers` matches case-insensitively.
|
|
35
36
|
*
|
|
36
37
|
* ⚠️ CHROMIUM ONLY. Firefox and Safari implement neither this hint nor the
|
|
37
38
|
* `Accept-CH` negotiation that asks for it, so on those browsers the header is
|
|
@@ -25,11 +25,12 @@
|
|
|
25
25
|
* repaints once React has hydrated the whole page.
|
|
26
26
|
*
|
|
27
27
|
* A browser sends it only where the origin asked for it, and the tenant
|
|
28
|
-
* middleware is what asks — it advertises this same token in `Accept-CH`
|
|
29
|
-
* `Critical-CH
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
28
|
+
* middleware is what asks — it advertises this same token in `Accept-CH`
|
|
29
|
+
* (not `Critical-CH`, so a first visit is never retried for it; that visit
|
|
30
|
+
* settles the scheme at hydration) and splits its cache on it in `Vary`, from
|
|
31
|
+
* a copy of its own, since an edge bundle takes no library imports. Reading
|
|
32
|
+
* the request header by this constant is safe whatever the transport did to
|
|
33
|
+
* the casing: `Headers` matches case-insensitively.
|
|
33
34
|
*
|
|
34
35
|
* ⚠️ CHROMIUM ONLY. Firefox and Safari implement neither this hint nor the
|
|
35
36
|
* `Accept-CH` negotiation that asks for it, so on those browsers the header is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../libs/shared/ui/theme/src/lib/util/color-scheme-hint.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ThemeMode } from '../hocs/create-with-theme-provider'\n\n/**\n * The device's own light/dark preference, carried on the request.\n *\n * `prefers-color-scheme` is a media feature, and a media feature is a browser\n * fact: a server render has no viewport to evaluate it against, so\n * `useMediaQuery` reports light for every visitor whose device is dark. This\n * user-agent client hint is the same preference in a form the server CAN read\n * — the browser puts it on the request, so a visitor following their device\n * gets their scheme in the first byte rather than a light document that\n * repaints once React has hydrated the whole page.\n *\n * A browser sends it only where the origin asked for it, and the tenant\n * middleware is what asks — it advertises this same token in `Accept-CH
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/ui/theme/src/lib/util/color-scheme-hint.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ThemeMode } from '../hocs/create-with-theme-provider'\n\n/**\n * The device's own light/dark preference, carried on the request.\n *\n * `prefers-color-scheme` is a media feature, and a media feature is a browser\n * fact: a server render has no viewport to evaluate it against, so\n * `useMediaQuery` reports light for every visitor whose device is dark. This\n * user-agent client hint is the same preference in a form the server CAN read\n * — the browser puts it on the request, so a visitor following their device\n * gets their scheme in the first byte rather than a light document that\n * repaints once React has hydrated the whole page.\n *\n * A browser sends it only where the origin asked for it, and the tenant\n * middleware is what asks — it advertises this same token in `Accept-CH`\n * (not `Critical-CH`, so a first visit is never retried for it; that visit\n * settles the scheme at hydration) and splits its cache on it in `Vary`, from\n * a copy of its own, since an edge bundle takes no library imports. Reading\n * the request header by this constant is safe whatever the transport did to\n * the casing: `Headers` matches case-insensitively.\n *\n * ⚠️ CHROMIUM ONLY. Firefox and Safari implement neither this hint nor the\n * `Accept-CH` negotiation that asks for it, so on those browsers the header is\n * simply absent and the scheme settles once the page has hydrated. Absence is\n * therefore an ordinary answer, never an error: every reader must have a\n * behavior for \"the request did not say\".\n *\n * Nothing in this module imports React, MUI or `js-cookie`, and its one import\n * is a type erased at compile time. That is what lets a Server Component take\n * it without pulling the theme library's context providers into the RSC graph\n * — the same reason `util/theme-mode-cookie`, `util/emotion-cache` and\n * `util/host-theme` are deep-imported rather than taken from the barrel.\n */\nexport const COLOR_SCHEME_HINT_HEADER = 'Sec-CH-Prefers-Color-Scheme'\n\n/**\n * A `Sec-CH-Prefers-Color-Scheme` request-header value as a theme mode.\n *\n * Only `light` and `dark` are schemes; anything else — a header the browser\n * never sent, a value from a future revision of the media feature — is `null`,\n * meaning \"the request named no scheme, fall back to the browser's own answer\n * once there is one\". A caller that mistook an unknown value for light would\n * pin a dark device to the wrong scheme for the whole render.\n *\n * The value is a structured-field string, so it may arrive quoted (`\"dark\"`);\n * the quotes are stripped and the token is compared case-insensitively so one\n * parser reads every spelling a conforming user agent may send.\n *\n * This is the device-preference counterpart to `parseThemeModeCookie`, which\n * reads the visitor's EXPLICIT choice off the same request. The two are\n * separate answers on purpose and are never merged here: a stated preference\n * outranks a device default, and the layering that enforces that lives in\n * `useThemeModeState`, where the switcher can still tell them apart.\n */\nexport function parseColorSchemeHint(\n value: string | undefined | null,\n): ThemeMode {\n const scheme = value?.trim().replace(/^\"|\"$/g, '').toLowerCase()\n return scheme === 'dark' || scheme === 'light' ? scheme : null\n}\n"],"names":["COLOR_SCHEME_HINT_HEADER","parseColorSchemeHint","value","scheme","trim","replace","toLowerCase"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BC,GACD,OAAO,MAAMA,2BAA2B,8BAA6B;AAErE;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASC,qBACdC,KAAgC;IAEhC,MAAMC,SAASD,yBAAAA,MAAOE,IAAI,GAAGC,OAAO,CAAC,UAAU,IAAIC,WAAW;IAC9D,OAAOH,WAAW,UAAUA,WAAW,UAAUA,SAAS;AAC5D"}
|