@ultimat3/render 31.52.0 → 31.53.1
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 +7 -7
- package/src/head.ts +7 -2
- package/src/navigation-dom.ts +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/render",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.53.1",
|
|
4
4
|
"description": "The route primitive and the five render modes: static, isr, ssr, stream, spa.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ultimate",
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"test": "bun test"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@ultimat3/cache": "31.
|
|
56
|
-
"@ultimat3/core": "31.
|
|
57
|
-
"@ultimat3/http": "31.
|
|
58
|
-
"@ultimat3/i18n": "31.
|
|
59
|
-
"@ultimat3/schema": "31.
|
|
60
|
-
"@ultimat3/seo": "31.
|
|
55
|
+
"@ultimat3/cache": "31.53.1",
|
|
56
|
+
"@ultimat3/core": "31.53.1",
|
|
57
|
+
"@ultimat3/http": "31.53.1",
|
|
58
|
+
"@ultimat3/i18n": "31.53.1",
|
|
59
|
+
"@ultimat3/schema": "31.53.1",
|
|
60
|
+
"@ultimat3/seo": "31.53.1",
|
|
61
61
|
"sass": "1.108.1"
|
|
62
62
|
}
|
|
63
63
|
}
|
package/src/head.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* catalog and so the tag vocabulary keeps exactly one owner (`@ultimat3/seo`).
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { escapeHtml, finiteCount, THEME_STORAGE_KEY } from '@ultimat3/core';
|
|
10
|
+
import { escapeHtml, finiteCount, MOTION_STORAGE_KEY, THEME_STORAGE_KEY } from '@ultimat3/core';
|
|
11
11
|
import type { RouteMeta } from '@ultimat3/seo';
|
|
12
12
|
import { BudgetExceededError } from './errors';
|
|
13
13
|
// The raw-text escapers are `html.ts`'s and the text/attribute table is core's `escapeHtml` — a
|
|
@@ -173,12 +173,17 @@ export function themeScriptBody(options: ThemeScriptOptions = {}): string {
|
|
|
173
173
|
// The fallback itself goes on the document too, OUTSIDE the `try`: a storage read that throws
|
|
174
174
|
// still leaves the app's own opinion where `@ultimat3/ui`'s `clearTheme` / `watchOsTheme` read
|
|
175
175
|
// it, so a fixed `theme.defaultMode` is never overridden by an OS flip or a "system" pick.
|
|
176
|
+
// The reader's motion pause (WCAG 2.2.2, `@ultimat3/ui`'s `MotionToggle`) is stamped in the same
|
|
177
|
+
// pass, before first paint: CSS entrances and effects must not run until an island hydrates, and
|
|
178
|
+
// a page with no toggle on it still honours a pause made on another.
|
|
176
179
|
return (
|
|
177
180
|
`var d=document.documentElement;` +
|
|
178
181
|
`d.setAttribute(${JSON.stringify(`${attribute}-default`)},${JSON.stringify(fallback)});` +
|
|
179
182
|
`try{var s=localStorage.getItem(${JSON.stringify(storageKey)}),` +
|
|
180
183
|
`t=s==="light"||s==="dark"?s:${otherwise};` +
|
|
181
|
-
`d.setAttribute(${JSON.stringify(attribute)},t)
|
|
184
|
+
`d.setAttribute(${JSON.stringify(attribute)},t);` +
|
|
185
|
+
`if(localStorage.getItem(${JSON.stringify(MOTION_STORAGE_KEY)})==="paused")` +
|
|
186
|
+
`d.setAttribute("data-motion","paused")}catch(e){}`
|
|
182
187
|
);
|
|
183
188
|
}
|
|
184
189
|
|
package/src/navigation-dom.ts
CHANGED
|
@@ -138,7 +138,11 @@ export async function transition(
|
|
|
138
138
|
const doc = win.document as Document & {
|
|
139
139
|
startViewTransition?: (update: () => void) => RunningTransition;
|
|
140
140
|
};
|
|
141
|
-
|
|
141
|
+
// Reduced motion, or the reader's WCAG 2.2.2 pause (`MotionToggle` writes the attribute
|
|
142
|
+
// `@ultimat3/ui`'s motion gate and stylesheet read): either way the swap is instant.
|
|
143
|
+
const still =
|
|
144
|
+
win.matchMedia?.('(prefers-reduced-motion: reduce)').matches === true ||
|
|
145
|
+
doc.documentElement?.getAttribute('data-motion') === 'paused';
|
|
142
146
|
if (doc.startViewTransition === undefined || still) {
|
|
143
147
|
apply();
|
|
144
148
|
return;
|