@revikornmann/muka-ui 0.64.1 → 0.64.3
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/dist/cjs/components/View/View.css +43 -0
- package/dist/cjs/components/View/View.js +6 -2
- package/dist/cjs/components/View/View.js.map +1 -1
- package/dist/cjs/components/View/viewNavigation.js +142 -6
- package/dist/cjs/components/View/viewNavigation.js.map +1 -1
- package/dist/esm/components/View/View.css +43 -0
- package/dist/esm/components/View/View.js +8 -4
- package/dist/esm/components/View/View.js.map +1 -1
- package/dist/esm/components/View/viewNavigation.js +141 -6
- package/dist/esm/components/View/viewNavigation.js.map +1 -1
- package/dist/styles/components/View.css +43 -0
- package/dist/styles/index.css +1282 -1239
- package/dist/styles/muka-dark.css +1282 -1239
- package/dist/styles/muka-light.css +1282 -1239
- package/dist/styles/wireframe-dark.css +1282 -1239
- package/dist/styles/wireframe-light.css +1282 -1239
- package/dist/types/components/View/View.d.ts.map +1 -1
- package/dist/types/components/View/viewNavigation.d.ts +6 -1
- package/dist/types/components/View/viewNavigation.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -215,6 +215,49 @@
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
/* ─── The same motion without a view transition ──────────
|
|
219
|
+
When React commits a navigation outside a view transition, the browser
|
|
220
|
+
animates nothing; viewNavigation.ts then puts a copy of the leaving View
|
|
221
|
+
(.muka-view-ghost) over the page and marks the new View
|
|
222
|
+
[data-muka-view-entering]. Pop only on small and medium screens: a push
|
|
223
|
+
would slide over nothing. */
|
|
224
|
+
.muka-view-ghost {
|
|
225
|
+
position: fixed;
|
|
226
|
+
margin: 0;
|
|
227
|
+
z-index: 40; /* above the app shell (11), below popovers and sheets (50) */
|
|
228
|
+
pointer-events: none;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
@media (max-width: 1023px) {
|
|
232
|
+
:root[data-muka-nav='pop'] .muka-view-ghost {
|
|
233
|
+
animation: muka-view-to-right var(--motion-duration-view) var(--motion-easing-enter) both;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
:root[data-muka-nav='pop'] .muka-view[data-muka-view-entering] {
|
|
237
|
+
animation: muka-view-from-behind var(--motion-duration-view) var(--motion-easing-enter) both;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
@media (min-width: 1024px) {
|
|
242
|
+
:root[data-muka-nav] .muka-view-ghost {
|
|
243
|
+
animation: muka-view-shift-out var(--motion-duration-exit) var(--motion-easing-exit) both;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
:root[data-muka-nav] .muka-view[data-muka-view-entering] {
|
|
247
|
+
animation: muka-view-shift-in var(--motion-duration-micro) var(--motion-easing-enter) both;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
:root[data-muka-nav='push'] .muka-view[data-muka-view-entering],
|
|
251
|
+
:root[data-muka-nav='pop'] .muka-view-ghost {
|
|
252
|
+
--muka-view-shift: var(--spacing-4);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
:root[data-muka-nav='pop'] .muka-view[data-muka-view-entering],
|
|
256
|
+
:root[data-muka-nav='push'] .muka-view-ghost {
|
|
257
|
+
--muka-view-shift: calc(-1 * var(--spacing-4));
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
218
261
|
@keyframes muka-view-shift-in {
|
|
219
262
|
from { opacity: 0; transform: translateX(var(--muka-view-shift)); }
|
|
220
263
|
to { opacity: 1; transform: translateX(0); }
|
|
@@ -85,8 +85,12 @@ function withViewButtons(node, variant) {
|
|
|
85
85
|
* - TopBar provides semantic `<header>` structure
|
|
86
86
|
*/
|
|
87
87
|
const View = ({ level, title, subtitle, titleLeading, titleTrailing, titleLabel, onTitleClick, renderTitle, leading, trailing, trailingSecondary, controlBar, surfaceLevel = 2, size, footer, children, loading = false, navigationKey, className = '', }) => {
|
|
88
|
+
const rootRef = (0, react_1.useRef)(null);
|
|
88
89
|
useIsomorphicLayoutEffect(() => {
|
|
89
|
-
|
|
90
|
+
const element = rootRef.current;
|
|
91
|
+
(0, viewNavigation_1.registerViewMount)(level, navigationKey, element);
|
|
92
|
+
// The leaving View, for a commit the browser doesn't animate.
|
|
93
|
+
return () => (0, viewNavigation_1.registerViewUnmount)(element);
|
|
90
94
|
// Only on mount: a View that stays mounted has not navigated.
|
|
91
95
|
}, []);
|
|
92
96
|
const viewClasses = [
|
|
@@ -104,7 +108,7 @@ const View = ({ level, title, subtitle, titleLeading, titleTrailing, titleLabel,
|
|
|
104
108
|
const transitionStyle = ReactViewTransition
|
|
105
109
|
? { viewTransitionName: transitionName }
|
|
106
110
|
: undefined;
|
|
107
|
-
const view = ((0, jsx_runtime_1.jsxs)("div", { className: viewClasses, "data-size": size, style: transitionStyle, children: [(0, jsx_runtime_1.jsx)(TopBar_1.TopBar, { title: title, subtitle: subtitle, titleLeading: titleLeading, titleTrailing: titleTrailing, titleLabel: titleLabel, onTitleClick: onTitleClick, renderTitle: renderTitle, leading: withViewButtons(leading, 'secondary'), trailing: withViewButtons(trailing, 'ghost'), trailingSecondary: withViewButtons(trailingSecondary, 'ghost'), controlBar: controlBar, size: size }), (0, jsx_runtime_1.jsxs)("main", { className: "muka-view__body", "aria-busy": loading || undefined, children: [(0, jsx_runtime_1.jsx)("div", { className: "muka-view__body-inner", children: loading ? (0, jsx_runtime_1.jsx)(ViewLoadingBody, {}) : children }), footer && ((0, jsx_runtime_1.jsx)("div", { className: "muka-view__footer", children: footer }))] })] }));
|
|
111
|
+
const view = ((0, jsx_runtime_1.jsxs)("div", { ref: rootRef, className: viewClasses, "data-size": size, style: transitionStyle, children: [(0, jsx_runtime_1.jsx)(TopBar_1.TopBar, { title: title, subtitle: subtitle, titleLeading: titleLeading, titleTrailing: titleTrailing, titleLabel: titleLabel, onTitleClick: onTitleClick, renderTitle: renderTitle, leading: withViewButtons(leading, 'secondary'), trailing: withViewButtons(trailing, 'ghost'), trailingSecondary: withViewButtons(trailingSecondary, 'ghost'), controlBar: controlBar, size: size }), (0, jsx_runtime_1.jsxs)("main", { className: "muka-view__body", "aria-busy": loading || undefined, children: [(0, jsx_runtime_1.jsx)("div", { className: "muka-view__body-inner", children: loading ? (0, jsx_runtime_1.jsx)(ViewLoadingBody, {}) : children }), footer && ((0, jsx_runtime_1.jsx)("div", { className: "muka-view__footer", children: footer }))] })] }));
|
|
108
112
|
if (!ReactViewTransition)
|
|
109
113
|
return view;
|
|
110
114
|
// Animates only when the View mounts or unmounts in a transition; View.css
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"View.js","sourceRoot":"","sources":["../../../../components/View/View.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,+
|
|
1
|
+
{"version":3,"file":"View.js","sourceRoot":"","sources":["../../../../components/View/View.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,+CAA8D;AAC9D,sCAA6D;AAC7D,sCAAmC;AACnC,0CAAuC;AACvC,qDAA0E;AAC1E,sBAAoB;AAgBpB,MAAM,mBAAmB,GACtB,eAAiE,CAAC,cAAc;IAChF,eAA0E,CAAC,uBAAuB,CAAC;AAEtG,MAAM,yBAAyB,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,uBAAe,CAAC;AAiF7F;;;;;;GAMG;AACH,SAAS,eAAe,CACtB,IAAqB,EACrB,OAA8B;IAE9B,OAAO,eAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE;QACxC,IAAI,CAAC,eAAK,CAAC,cAAc,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAC/C,IAAI,KAAK,CAAC,IAAI,KAAK,eAAK,CAAC,QAAQ,EAAE,CAA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E,OAAO,CACL,uBAAC,mBAAmB,IAAC,KAAK,EAAC,iBAAiB,EAAC,IAAI,EAAC,gBAAgB,EAAC,MAAM,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,EAAC,OAAO,EAAC,MAAM,YACzG,IAAI,GACe,CACvB,CAAC;AACJ,CAAC,CAAC;AAvFW,QAAA,IAAI,QAuFf;AAEF,SAAS,eAAe;IACtB,OAAO,CACL,iCAAK,SAAS,EAAC,oBAAoB,aACjC,uBAAC,mBAAQ,IAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAC,KAAK,EAAC,MAAM,EAAE,EAAE,GAAI,EAClD,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACnC,uBAAC,mBAAQ,IAAS,OAAO,EAAC,aAAa,EAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAC,SAAS,IAAxD,CAAC,CAA0D,CAC3E,CAAC,IACE,CACP,CAAC;AACJ,CAAC;AAED,kBAAe,YAAI,CAAC"}
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.resolveNavigation = resolveNavigation;
|
|
27
|
+
exports.registerViewUnmount = registerViewUnmount;
|
|
27
28
|
exports.registerViewMount = registerViewMount;
|
|
28
29
|
exports.resetViewNavigation = resetViewNavigation;
|
|
29
30
|
const ATTRIBUTE = 'data-muka-nav';
|
|
@@ -61,8 +62,16 @@ function resolveNavigation(stack, next) {
|
|
|
61
62
|
}
|
|
62
63
|
let stack = [];
|
|
63
64
|
let pending = null;
|
|
65
|
+
let pendingElement = null;
|
|
64
66
|
let clearTimer;
|
|
65
67
|
let lastPopState = null;
|
|
68
|
+
/**
|
|
69
|
+
* A direction whose view transition was skipped before it animated. Next.js
|
|
70
|
+
* can start a transition for a navigation and abort it for the next commit of
|
|
71
|
+
* the same navigation (iOS Safari, back to a top View): that commit mounts the
|
|
72
|
+
* same path again, so on its own it would resolve to none and lose the slide.
|
|
73
|
+
*/
|
|
74
|
+
let unplayed = null;
|
|
66
75
|
let listening = false;
|
|
67
76
|
function listenForSystemBack() {
|
|
68
77
|
if (listening || typeof window === 'undefined')
|
|
@@ -86,15 +95,115 @@ function setDirection(direction) {
|
|
|
86
95
|
const root = document.documentElement;
|
|
87
96
|
root.setAttribute(ATTRIBUTE, direction);
|
|
88
97
|
clearTimeout(clearTimer);
|
|
98
|
+
unplayed = null;
|
|
89
99
|
const clear = () => {
|
|
90
100
|
if (root.getAttribute(ATTRIBUTE) === direction)
|
|
91
101
|
root.removeAttribute(ATTRIBUTE);
|
|
92
102
|
};
|
|
93
103
|
const transition = runningViewTransition();
|
|
94
|
-
if (transition)
|
|
95
|
-
|
|
96
|
-
|
|
104
|
+
if (!transition) {
|
|
105
|
+
clearTimer = setTimeout(clear, 1000);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
let skipped = false;
|
|
109
|
+
transition.ready.then(undefined, () => {
|
|
110
|
+
// Skipped before it animated: keep the direction for the transition that
|
|
111
|
+
// replaces it; the timer clears it if none comes.
|
|
112
|
+
skipped = true;
|
|
113
|
+
if (direction !== 'none')
|
|
114
|
+
unplayed = { direction, at: Date.now() };
|
|
97
115
|
clearTimer = setTimeout(clear, 1000);
|
|
116
|
+
});
|
|
117
|
+
transition.finished.then(() => {
|
|
118
|
+
if (!skipped)
|
|
119
|
+
clear();
|
|
120
|
+
}, () => {
|
|
121
|
+
if (!skipped)
|
|
122
|
+
clear();
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
let leaving = null;
|
|
126
|
+
const GHOST_CLASS = 'muka-view-ghost';
|
|
127
|
+
const ENTERING_ATTRIBUTE = 'data-muka-view-entering';
|
|
128
|
+
/**
|
|
129
|
+
* Called from a View's layout effect cleanup when it unmounts. A commit that
|
|
130
|
+
* removes nested Views reports the outer one first; keep the largest.
|
|
131
|
+
*/
|
|
132
|
+
function registerViewUnmount(element) {
|
|
133
|
+
if (typeof window === 'undefined' || !element)
|
|
134
|
+
return;
|
|
135
|
+
const rect = element.getBoundingClientRect();
|
|
136
|
+
if (rect.width === 0 || rect.height === 0)
|
|
137
|
+
return;
|
|
138
|
+
const now = Date.now();
|
|
139
|
+
if (leaving && now - leaving.at < 50 && leaving.rect.width * leaving.rect.height >= rect.width * rect.height) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const body = element.querySelector('.muka-view__body');
|
|
143
|
+
leaving = { element, rect, scrollTop: body?.scrollTop ?? 0, at: now };
|
|
144
|
+
}
|
|
145
|
+
function takeLeaving() {
|
|
146
|
+
const view = leaving && Date.now() - leaving.at < 200 ? leaving : null;
|
|
147
|
+
leaving = null;
|
|
148
|
+
return view;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The commit ran outside a view transition (React commits a navigation
|
|
152
|
+
* without one when another update interrupts it, as on iOS Safari going back
|
|
153
|
+
* to a cached screen), so the browser animates nothing. Play the same motion
|
|
154
|
+
* on the DOM: a copy of the leaving View on top, the new View under it.
|
|
155
|
+
* Returns false when there is nothing to play.
|
|
156
|
+
*/
|
|
157
|
+
function playWithoutTransition(direction, entering, left) {
|
|
158
|
+
if (!entering || !left || !entering.isConnected)
|
|
159
|
+
return false;
|
|
160
|
+
const large = window.matchMedia?.('(min-width: 1024px)').matches ?? false;
|
|
161
|
+
// On small screens a push slides the new View over the old one; without the
|
|
162
|
+
// old one underneath that is a View sliding over nothing. Only pop.
|
|
163
|
+
if (!large && direction !== 'pop')
|
|
164
|
+
return false;
|
|
165
|
+
const ghost = left.element.cloneNode(true);
|
|
166
|
+
ghost.classList.add(GHOST_CLASS);
|
|
167
|
+
ghost.setAttribute('aria-hidden', 'true');
|
|
168
|
+
ghost.setAttribute('inert', '');
|
|
169
|
+
ghost.removeAttribute('id');
|
|
170
|
+
Object.assign(ghost.style, {
|
|
171
|
+
display: '',
|
|
172
|
+
viewTransitionName: 'none',
|
|
173
|
+
top: `${left.rect.top}px`,
|
|
174
|
+
left: `${left.rect.left}px`,
|
|
175
|
+
width: `${left.rect.width}px`,
|
|
176
|
+
height: `${left.rect.height}px`,
|
|
177
|
+
});
|
|
178
|
+
document.body.appendChild(ghost);
|
|
179
|
+
const body = ghost.querySelector('.muka-view__body');
|
|
180
|
+
if (body)
|
|
181
|
+
body.scrollTop = left.scrollTop;
|
|
182
|
+
const root = document.documentElement;
|
|
183
|
+
clearTimeout(clearTimer);
|
|
184
|
+
unplayed = null;
|
|
185
|
+
root.setAttribute(ATTRIBUTE, direction);
|
|
186
|
+
entering.setAttribute(ENTERING_ATTRIBUTE, '');
|
|
187
|
+
let done = false;
|
|
188
|
+
const finish = () => {
|
|
189
|
+
if (done)
|
|
190
|
+
return;
|
|
191
|
+
done = true;
|
|
192
|
+
ghost.remove();
|
|
193
|
+
entering.removeAttribute(ENTERING_ATTRIBUTE);
|
|
194
|
+
if (root.getAttribute(ATTRIBUTE) === direction)
|
|
195
|
+
root.removeAttribute(ATTRIBUTE);
|
|
196
|
+
};
|
|
197
|
+
ghost.addEventListener('animationend', finish, { once: true });
|
|
198
|
+
ghost.addEventListener('animationcancel', finish, { once: true });
|
|
199
|
+
// No animation (reduced motion, or the stylesheet's rules didn't match).
|
|
200
|
+
clearTimer = setTimeout(finish, 1000);
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
function takeUnplayed() {
|
|
204
|
+
const carried = unplayed && Date.now() - unplayed.at < 1000 ? unplayed.direction : undefined;
|
|
205
|
+
unplayed = null;
|
|
206
|
+
return carried;
|
|
98
207
|
}
|
|
99
208
|
/**
|
|
100
209
|
* Called from a View's layout effect when it mounts. Every View that mounts in
|
|
@@ -102,24 +211,48 @@ function setDirection(direction) {
|
|
|
102
211
|
* effects child first) decides, in a microtask that still runs before the
|
|
103
212
|
* browser captures the new state.
|
|
104
213
|
*/
|
|
105
|
-
function registerViewMount(level, navigationKey) {
|
|
214
|
+
function registerViewMount(level, navigationKey, element) {
|
|
106
215
|
if (typeof window === 'undefined')
|
|
107
216
|
return;
|
|
108
217
|
listenForSystemBack();
|
|
109
218
|
const first = pending === null;
|
|
110
219
|
pending = { path: navigationKey ?? window.location.pathname, level };
|
|
220
|
+
pendingElement = element ?? null;
|
|
111
221
|
if (!first)
|
|
112
222
|
return;
|
|
223
|
+
// Whether this commit runs in a view transition the browser will animate.
|
|
224
|
+
// A skipped one rejects `ready` before React commits, so its handler runs
|
|
225
|
+
// before the microtask below.
|
|
226
|
+
const transition = runningViewTransition();
|
|
227
|
+
const doc = document;
|
|
228
|
+
let animates = 'activeViewTransition' in doc ? Boolean(doc.activeViewTransition) : transition !== undefined;
|
|
229
|
+
transition?.ready.then(undefined, () => {
|
|
230
|
+
animates = false;
|
|
231
|
+
});
|
|
113
232
|
queueMicrotask(() => {
|
|
114
233
|
const next = pending;
|
|
234
|
+
const entering = pendingElement;
|
|
115
235
|
pending = null;
|
|
236
|
+
pendingElement = null;
|
|
237
|
+
const left = takeLeaving();
|
|
116
238
|
if (!next)
|
|
117
239
|
return;
|
|
240
|
+
const samePath = stack[stack.length - 1]?.path === normalize(next.path);
|
|
118
241
|
const result = resolveNavigation(stack, next);
|
|
119
242
|
stack = result.stack;
|
|
243
|
+
// The same View again after a skipped transition: play what was skipped.
|
|
244
|
+
const carried = takeUnplayed();
|
|
245
|
+
const direction = samePath && carried ? carried : result.direction;
|
|
120
246
|
const systemBack = lastPopState !== null && lastPopState.uaTransition && Date.now() - lastPopState.at < 1000;
|
|
121
|
-
if (
|
|
122
|
-
|
|
247
|
+
if (!animates &&
|
|
248
|
+
!systemBack &&
|
|
249
|
+
direction !== 'none' &&
|
|
250
|
+
!samePath &&
|
|
251
|
+
playWithoutTransition(direction, entering, left)) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (direction !== 'none' || document.documentElement.hasAttribute(ATTRIBUTE)) {
|
|
255
|
+
setDirection(systemBack ? 'none' : direction);
|
|
123
256
|
}
|
|
124
257
|
});
|
|
125
258
|
}
|
|
@@ -127,7 +260,10 @@ function registerViewMount(level, navigationKey) {
|
|
|
127
260
|
function resetViewNavigation() {
|
|
128
261
|
stack = [];
|
|
129
262
|
pending = null;
|
|
263
|
+
pendingElement = null;
|
|
264
|
+
leaving = null;
|
|
130
265
|
lastPopState = null;
|
|
266
|
+
unplayed = null;
|
|
131
267
|
clearTimeout(clearTimer);
|
|
132
268
|
if (typeof document !== 'undefined')
|
|
133
269
|
document.documentElement.removeAttribute(ATTRIBUTE);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewNavigation.js","sourceRoot":"","sources":["../../../../components/View/viewNavigation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;AAwBH,8CA2BC;
|
|
1
|
+
{"version":3,"file":"viewNavigation.js","sourceRoot":"","sources":["../../../../components/View/viewNavigation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;AAwBH,8CA2BC;AA2FD,kDAUC;AAwED,8CAkDC;AAGD,kDASC;AArRD,MAAM,SAAS,GAAG,eAAe,CAAC;AAElC,mEAAmE;AACnE,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC;AAED,SAAS,YAAY,CAAC,MAAc,EAAE,KAAa;IACjD,OAAO,MAAM,KAAK,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;AACnF,CAAC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAC/B,KAA0B,EAC1B,IAAc;IAEd,MAAM,KAAK,GAAG,EAAE,GAAG,I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AAqB,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,EAChD,CAAC;YACD,OAAO;QACT,CAAC;QACD,IAAI,SAAS,KAAK,MAAM,IAAI,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7E,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAChD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,qCAAqC;AACrC,SAAgB,mBAAmB;IACjC,KAAK,GAAG,EAAE,CAAC;IACX,OAAO,GAAG,IAAI,CAAC;IACf,cAAc,GAAG,IAAI,CAAC;IACtB,OAAO,GAAG,IAAI,CAAC;IACf,YAAY,GAAG,IAAI,CAAC;IACpB,QAAQ,GAAG,IAAI,CAAC;IAChB,YAAY,CAAC,UAAU,CAAC,CAAC;IACzB,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,QAAQ,CAAC,eAAe,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;AAC3F,CAAC"}
|
|
@@ -215,6 +215,49 @@
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
/* ─── The same motion without a view transition ──────────
|
|
219
|
+
When React commits a navigation outside a view transition, the browser
|
|
220
|
+
animates nothing; viewNavigation.ts then puts a copy of the leaving View
|
|
221
|
+
(.muka-view-ghost) over the page and marks the new View
|
|
222
|
+
[data-muka-view-entering]. Pop only on small and medium screens: a push
|
|
223
|
+
would slide over nothing. */
|
|
224
|
+
.muka-view-ghost {
|
|
225
|
+
position: fixed;
|
|
226
|
+
margin: 0;
|
|
227
|
+
z-index: 40; /* above the app shell (11), below popovers and sheets (50) */
|
|
228
|
+
pointer-events: none;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
@media (max-width: 1023px) {
|
|
232
|
+
:root[data-muka-nav='pop'] .muka-view-ghost {
|
|
233
|
+
animation: muka-view-to-right var(--motion-duration-view) var(--motion-easing-enter) both;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
:root[data-muka-nav='pop'] .muka-view[data-muka-view-entering] {
|
|
237
|
+
animation: muka-view-from-behind var(--motion-duration-view) var(--motion-easing-enter) both;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
@media (min-width: 1024px) {
|
|
242
|
+
:root[data-muka-nav] .muka-view-ghost {
|
|
243
|
+
animation: muka-view-shift-out var(--motion-duration-exit) var(--motion-easing-exit) both;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
:root[data-muka-nav] .muka-view[data-muka-view-entering] {
|
|
247
|
+
animation: muka-view-shift-in var(--motion-duration-micro) var(--motion-easing-enter) both;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
:root[data-muka-nav='push'] .muka-view[data-muka-view-entering],
|
|
251
|
+
:root[data-muka-nav='pop'] .muka-view-ghost {
|
|
252
|
+
--muka-view-shift: var(--spacing-4);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
:root[data-muka-nav='pop'] .muka-view[data-muka-view-entering],
|
|
256
|
+
:root[data-muka-nav='push'] .muka-view-ghost {
|
|
257
|
+
--muka-view-shift: calc(-1 * var(--spacing-4));
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
218
261
|
@keyframes muka-view-shift-in {
|
|
219
262
|
from { opacity: 0; transform: translateX(var(--muka-view-shift)); }
|
|
220
263
|
to { opacity: 1; transform: translateX(0); }
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import React, { useId, useLayoutEffect } from 'react';
|
|
3
|
+
import React, { useId, useLayoutEffect, useRef } from 'react';
|
|
4
4
|
import { TopBar } from '../TopBar';
|
|
5
5
|
import { Button } from '../Button';
|
|
6
6
|
import { Skeleton } from '../Skeleton';
|
|
7
|
-
import { registerViewMount } from './viewNavigation';
|
|
7
|
+
import { registerViewMount, registerViewUnmount } from './viewNavigation';
|
|
8
8
|
import './View.css';
|
|
9
9
|
const ReactViewTransition = React.ViewTransition ??
|
|
10
10
|
React.unstable_ViewTransition;
|
|
@@ -49,8 +49,12 @@ function withViewButtons(node, variant) {
|
|
|
49
49
|
* - TopBar provides semantic `<header>` structure
|
|
50
50
|
*/
|
|
51
51
|
export const View = ({ level, title, subtitle, titleLeading, titleTrailing, titleLabel, onTitleClick, renderTitle, leading, trailing, trailingSecondary, controlBar, surfaceLevel = 2, size, footer, children, loading = false, navigationKey, className = '', }) => {
|
|
52
|
+
const rootRef = useRef(null);
|
|
52
53
|
useIsomorphicLayoutEffect(() => {
|
|
53
|
-
|
|
54
|
+
const element = rootRef.current;
|
|
55
|
+
registerViewMount(level, navigationKey, element);
|
|
56
|
+
// The leaving View, for a commit the browser doesn't animate.
|
|
57
|
+
return () => registerViewUnmount(element);
|
|
54
58
|
// Only on mount: a View that stays mounted has not navigated.
|
|
55
59
|
}, []);
|
|
56
60
|
const viewClasses = [
|
|
@@ -68,7 +72,7 @@ export const View = ({ level, title, subtitle, titleLeading, titleTrailing, titl
|
|
|
68
72
|
const transitionStyle = ReactViewTransition
|
|
69
73
|
? { viewTransitionName: transitionName }
|
|
70
74
|
: undefined;
|
|
71
|
-
const view = (_jsxs("div", { className: viewClasses, "data-size": size, style: transitionStyle, children: [_jsx(TopBar, { title: title, subtitle: subtitle, titleLeading: titleLeading, titleTrailing: titleTrailing, titleLabel: titleLabel, onTitleClick: onTitleClick, renderTitle: renderTitle, leading: withViewButtons(leading, 'secondary'), trailing: withViewButtons(trailing, 'ghost'), trailingSecondary: withViewButtons(trailingSecondary, 'ghost'), controlBar: controlBar, size: size }), _jsxs("main", { className: "muka-view__body", "aria-busy": loading || undefined, children: [_jsx("div", { className: "muka-view__body-inner", children: loading ? _jsx(ViewLoadingBody, {}) : children }), footer && (_jsx("div", { className: "muka-view__footer", children: footer }))] })] }));
|
|
75
|
+
const view = (_jsxs("div", { ref: rootRef, className: viewClasses, "data-size": size, style: transitionStyle, children: [_jsx(TopBar, { title: title, subtitle: subtitle, titleLeading: titleLeading, titleTrailing: titleTrailing, titleLabel: titleLabel, onTitleClick: onTitleClick, renderTitle: renderTitle, leading: withViewButtons(leading, 'secondary'), trailing: withViewButtons(trailing, 'ghost'), trailingSecondary: withViewButtons(trailingSecondary, 'ghost'), controlBar: controlBar, size: size }), _jsxs("main", { className: "muka-view__body", "aria-busy": loading || undefined, children: [_jsx("div", { className: "muka-view__body-inner", children: loading ? _jsx(ViewLoadingBody, {}) : children }), footer && (_jsx("div", { className: "muka-view__footer", children: footer }))] })] }));
|
|
72
76
|
if (!ReactViewTransition)
|
|
73
77
|
return view;
|
|
74
78
|
// Animates only when the View mounts or unmounts in a transition; View.css
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"View.js","sourceRoot":"","sources":["../../../../components/View/View.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"View.js","sourceRoot":"","sources":["../../../../components/View/View.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,MAAM,EAA4B,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,YAAY,CAAC;AAgBpB,MAAM,mBAAmB,GACtB,KAAiE,CAAC,cAAc;IAChF,KAA0E,CAAC,uBAAuB,CAAC;AAEtG,MAAM,yBAAyB,GAAG,OAAO,MAAM,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IAAI,GACV,EAEF,gBAAM,SAAS,EAAC,iBAAiB,eAAY,OAAO,IAAI,SAAS,aAC/D,cAAK,SAAS,EAAC,uBAAuB,YACnC,OAAO,CAAC,CAAC,CAAC,KAAC,eAAe,KAAG,CAAC,CAAC,CAAC,QAAQ,GACrC,EAEL,MAAM,IAAI,CACT,cAAK,SAAS,EAAC,mBAAmB,YAC/B,MAAM,GACH,CACP,IACI,IACH,CACP,CAAC;IAEF,IAAI,CAAC,mBAAmB;QAAE,OAAO,IAAI,CAAC;IAEtC,2EAA2E;IAC3E,0EAA0E;IAC1E,OAAO,CACL,KAAC,mBAAmB,IAAC,KAAK,EAAC,iBAAiB,EAAC,IAAI,EAAC,gBAAgB,EAAC,MAAM,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,EAAC,OAAO,EAAC,MAAM,YACzG,IAAI,GACe,CACvB,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,eAAe;IACtB,OAAO,CACL,eAAK,SAAS,EAAC,oBAAoB,aACjC,KAAC,QAAQ,IAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAC,KAAK,EAAC,MAAM,EAAE,EAAE,GAAI,EAClD,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACnC,KAAC,QAAQ,IAAS,OAAO,EAAC,aAAa,EAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAC,SAAS,IAAxD,CAAC,CAA0D,CAC3E,CAAC,IACE,CACP,CAAC;AACJ,CAAC;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -56,8 +56,16 @@ export function resolveNavigation(stack, next) {
|
|
|
56
56
|
}
|
|
57
57
|
let stack = [];
|
|
58
58
|
let pending = null;
|
|
59
|
+
let pendingElement = null;
|
|
59
60
|
let clearTimer;
|
|
60
61
|
let lastPopState = null;
|
|
62
|
+
/**
|
|
63
|
+
* A direction whose view transition was skipped before it animated. Next.js
|
|
64
|
+
* can start a transition for a navigation and abort it for the next commit of
|
|
65
|
+
* the same navigation (iOS Safari, back to a top View): that commit mounts the
|
|
66
|
+
* same path again, so on its own it would resolve to none and lose the slide.
|
|
67
|
+
*/
|
|
68
|
+
let unplayed = null;
|
|
61
69
|
let listening = false;
|
|
62
70
|
function listenForSystemBack() {
|
|
63
71
|
if (listening || typeof window === 'undefined')
|
|
@@ -81,15 +89,115 @@ function setDirection(direction) {
|
|
|
81
89
|
const root = document.documentElement;
|
|
82
90
|
root.setAttribute(ATTRIBUTE, direction);
|
|
83
91
|
clearTimeout(clearTimer);
|
|
92
|
+
unplayed = null;
|
|
84
93
|
const clear = () => {
|
|
85
94
|
if (root.getAttribute(ATTRIBUTE) === direction)
|
|
86
95
|
root.removeAttribute(ATTRIBUTE);
|
|
87
96
|
};
|
|
88
97
|
const transition = runningViewTransition();
|
|
89
|
-
if (transition)
|
|
90
|
-
|
|
91
|
-
|
|
98
|
+
if (!transition) {
|
|
99
|
+
clearTimer = setTimeout(clear, 1000);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
let skipped = false;
|
|
103
|
+
transition.ready.then(undefined, () => {
|
|
104
|
+
// Skipped before it animated: keep the direction for the transition that
|
|
105
|
+
// replaces it; the timer clears it if none comes.
|
|
106
|
+
skipped = true;
|
|
107
|
+
if (direction !== 'none')
|
|
108
|
+
unplayed = { direction, at: Date.now() };
|
|
92
109
|
clearTimer = setTimeout(clear, 1000);
|
|
110
|
+
});
|
|
111
|
+
transition.finished.then(() => {
|
|
112
|
+
if (!skipped)
|
|
113
|
+
clear();
|
|
114
|
+
}, () => {
|
|
115
|
+
if (!skipped)
|
|
116
|
+
clear();
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
let leaving = null;
|
|
120
|
+
const GHOST_CLASS = 'muka-view-ghost';
|
|
121
|
+
const ENTERING_ATTRIBUTE = 'data-muka-view-entering';
|
|
122
|
+
/**
|
|
123
|
+
* Called from a View's layout effect cleanup when it unmounts. A commit that
|
|
124
|
+
* removes nested Views reports the outer one first; keep the largest.
|
|
125
|
+
*/
|
|
126
|
+
export function registerViewUnmount(element) {
|
|
127
|
+
if (typeof window === 'undefined' || !element)
|
|
128
|
+
return;
|
|
129
|
+
const rect = element.getBoundingClientRect();
|
|
130
|
+
if (rect.width === 0 || rect.height === 0)
|
|
131
|
+
return;
|
|
132
|
+
const now = Date.now();
|
|
133
|
+
if (leaving && now - leaving.at < 50 && leaving.rect.width * leaving.rect.height >= rect.width * rect.height) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const body = element.querySelector('.muka-view__body');
|
|
137
|
+
leaving = { element, rect, scrollTop: body?.scrollTop ?? 0, at: now };
|
|
138
|
+
}
|
|
139
|
+
function takeLeaving() {
|
|
140
|
+
const view = leaving && Date.now() - leaving.at < 200 ? leaving : null;
|
|
141
|
+
leaving = null;
|
|
142
|
+
return view;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The commit ran outside a view transition (React commits a navigation
|
|
146
|
+
* without one when another update interrupts it, as on iOS Safari going back
|
|
147
|
+
* to a cached screen), so the browser animates nothing. Play the same motion
|
|
148
|
+
* on the DOM: a copy of the leaving View on top, the new View under it.
|
|
149
|
+
* Returns false when there is nothing to play.
|
|
150
|
+
*/
|
|
151
|
+
function playWithoutTransition(direction, entering, left) {
|
|
152
|
+
if (!entering || !left || !entering.isConnected)
|
|
153
|
+
return false;
|
|
154
|
+
const large = window.matchMedia?.('(min-width: 1024px)').matches ?? false;
|
|
155
|
+
// On small screens a push slides the new View over the old one; without the
|
|
156
|
+
// old one underneath that is a View sliding over nothing. Only pop.
|
|
157
|
+
if (!large && direction !== 'pop')
|
|
158
|
+
return false;
|
|
159
|
+
const ghost = left.element.cloneNode(true);
|
|
160
|
+
ghost.classList.add(GHOST_CLASS);
|
|
161
|
+
ghost.setAttribute('aria-hidden', 'true');
|
|
162
|
+
ghost.setAttribute('inert', '');
|
|
163
|
+
ghost.removeAttribute('id');
|
|
164
|
+
Object.assign(ghost.style, {
|
|
165
|
+
display: '',
|
|
166
|
+
viewTransitionName: 'none',
|
|
167
|
+
top: `${left.rect.top}px`,
|
|
168
|
+
left: `${left.rect.left}px`,
|
|
169
|
+
width: `${left.rect.width}px`,
|
|
170
|
+
height: `${left.rect.height}px`,
|
|
171
|
+
});
|
|
172
|
+
document.body.appendChild(ghost);
|
|
173
|
+
const body = ghost.querySelector('.muka-view__body');
|
|
174
|
+
if (body)
|
|
175
|
+
body.scrollTop = left.scrollTop;
|
|
176
|
+
const root = document.documentElement;
|
|
177
|
+
clearTimeout(clearTimer);
|
|
178
|
+
unplayed = null;
|
|
179
|
+
root.setAttribute(ATTRIBUTE, direction);
|
|
180
|
+
entering.setAttribute(ENTERING_ATTRIBUTE, '');
|
|
181
|
+
let done = false;
|
|
182
|
+
const finish = () => {
|
|
183
|
+
if (done)
|
|
184
|
+
return;
|
|
185
|
+
done = true;
|
|
186
|
+
ghost.remove();
|
|
187
|
+
entering.removeAttribute(ENTERING_ATTRIBUTE);
|
|
188
|
+
if (root.getAttribute(ATTRIBUTE) === direction)
|
|
189
|
+
root.removeAttribute(ATTRIBUTE);
|
|
190
|
+
};
|
|
191
|
+
ghost.addEventListener('animationend', finish, { once: true });
|
|
192
|
+
ghost.addEventListener('animationcancel', finish, { once: true });
|
|
193
|
+
// No animation (reduced motion, or the stylesheet's rules didn't match).
|
|
194
|
+
clearTimer = setTimeout(finish, 1000);
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
function takeUnplayed() {
|
|
198
|
+
const carried = unplayed && Date.now() - unplayed.at < 1000 ? unplayed.direction : undefined;
|
|
199
|
+
unplayed = null;
|
|
200
|
+
return carried;
|
|
93
201
|
}
|
|
94
202
|
/**
|
|
95
203
|
* Called from a View's layout effect when it mounts. Every View that mounts in
|
|
@@ -97,24 +205,48 @@ function setDirection(direction) {
|
|
|
97
205
|
* effects child first) decides, in a microtask that still runs before the
|
|
98
206
|
* browser captures the new state.
|
|
99
207
|
*/
|
|
100
|
-
export function registerViewMount(level, navigationKey) {
|
|
208
|
+
export function registerViewMount(level, navigationKey, element) {
|
|
101
209
|
if (typeof window === 'undefined')
|
|
102
210
|
return;
|
|
103
211
|
listenForSystemBack();
|
|
104
212
|
const first = pending === null;
|
|
105
213
|
pending = { path: navigationKey ?? window.location.pathname, level };
|
|
214
|
+
pendingElement = element ?? null;
|
|
106
215
|
if (!first)
|
|
107
216
|
return;
|
|
217
|
+
// Whether this commit runs in a view transition the browser will animate.
|
|
218
|
+
// A skipped one rejects `ready` before React commits, so its handler runs
|
|
219
|
+
// before the microtask below.
|
|
220
|
+
const transition = runningViewTransition();
|
|
221
|
+
const doc = document;
|
|
222
|
+
let animates = 'activeViewTransition' in doc ? Boolean(doc.activeViewTransition) : transition !== undefined;
|
|
223
|
+
transition?.ready.then(undefined, () => {
|
|
224
|
+
animates = false;
|
|
225
|
+
});
|
|
108
226
|
queueMicrotask(() => {
|
|
109
227
|
const next = pending;
|
|
228
|
+
const entering = pendingElement;
|
|
110
229
|
pending = null;
|
|
230
|
+
pendingElement = null;
|
|
231
|
+
const left = takeLeaving();
|
|
111
232
|
if (!next)
|
|
112
233
|
return;
|
|
234
|
+
const samePath = stack[stack.length - 1]?.path === normalize(next.path);
|
|
113
235
|
const result = resolveNavigation(stack, next);
|
|
114
236
|
stack = result.stack;
|
|
237
|
+
// The same View again after a skipped transition: play what was skipped.
|
|
238
|
+
const carried = takeUnplayed();
|
|
239
|
+
const direction = samePath && carried ? carried : result.direction;
|
|
115
240
|
const systemBack = lastPopState !== null && lastPopState.uaTransition && Date.now() - lastPopState.at < 1000;
|
|
116
|
-
if (
|
|
117
|
-
|
|
241
|
+
if (!animates &&
|
|
242
|
+
!systemBack &&
|
|
243
|
+
direction !== 'none' &&
|
|
244
|
+
!samePath &&
|
|
245
|
+
playWithoutTransition(direction, entering, left)) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (direction !== 'none' || document.documentElement.hasAttribute(ATTRIBUTE)) {
|
|
249
|
+
setDirection(systemBack ? 'none' : direction);
|
|
118
250
|
}
|
|
119
251
|
});
|
|
120
252
|
}
|
|
@@ -122,7 +254,10 @@ export function registerViewMount(level, navigationKey) {
|
|
|
122
254
|
export function resetViewNavigation() {
|
|
123
255
|
stack = [];
|
|
124
256
|
pending = null;
|
|
257
|
+
pendingElement = null;
|
|
258
|
+
leaving = null;
|
|
125
259
|
lastPopState = null;
|
|
260
|
+
unplayed = null;
|
|
126
261
|
clearTimeout(clearTimer);
|
|
127
262
|
if (typeof document !== 'undefined')
|
|
128
263
|
document.documentElement.removeAttribute(ATTRIBUTE);
|