react-modal-navigation 1.1.8 → 1.1.9
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/CHANGELOG.md +20 -4
- package/README.md +26 -8
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +719 -614
- package/dist/style.css +15 -0
- package/docs/API.md +5 -0
- package/docs/PERFORMANCE.md +19 -0
- package/package.json +1 -1
package/dist/style.css
CHANGED
|
@@ -94,3 +94,18 @@
|
|
|
94
94
|
.pmn-page-exit-forward{animation-name:pmn-page-forward-out}
|
|
95
95
|
.pmn-page-exit-back{animation-name:pmn-page-back-out}
|
|
96
96
|
@media(prefers-reduced-motion:reduce){.pmn-page-exit{animation:none!important}}
|
|
97
|
+
|
|
98
|
+
/* Full-width push/pop: incoming layer stays above the outgoing layer. */
|
|
99
|
+
.pmn-main>.pmn-body{position:relative;width:100%;flex:1 0 100%;background:var(--pmn-body)}
|
|
100
|
+
.pmn-page-forward,.pmn-page-back{z-index:2}
|
|
101
|
+
@keyframes pmn-page-forward-in{from{opacity:1;transform:translate3d(100%,0,0)}to{opacity:1;transform:translate3d(0,0,0)}}
|
|
102
|
+
@keyframes pmn-page-back-in{from{opacity:1;transform:translate3d(-100%,0,0)}to{opacity:1;transform:translate3d(0,0,0)}}
|
|
103
|
+
@keyframes pmn-page-forward-out{to{opacity:1;transform:translate3d(-100%,0,0)}}
|
|
104
|
+
@keyframes pmn-page-back-out{to{opacity:1;transform:translate3d(100%,0,0)}}
|
|
105
|
+
|
|
106
|
+
/* Top-positioned dialogs respect an independent offset and remain scrollable. */
|
|
107
|
+
.pmn-place-top .pmn-dialog{max-height:min(calc(100dvh - var(--pmn-top-offset, var(--pmn-gap)) - var(--pmn-gap)),var(--pmn-max-height,100dvh))}
|
|
108
|
+
.pmn-lazy-loading{display:flex;min-height:80px;align-items:center;justify-content:center;color:var(--pmn-muted);font-size:14px}
|
|
109
|
+
|
|
110
|
+
/* Top offset must reduce available dialog height, not just move its starting point. */
|
|
111
|
+
.pmn-place-top .pmn-dialog{max-height:min(calc(100dvh - var(--pmn-top-offset, var(--pmn-gap)) - var(--pmn-gap)),var(--pmn-max-height,100dvh))}
|
package/docs/API.md
CHANGED
|
@@ -638,3 +638,8 @@ type Navigation = TypedModalNavigation<Routes>;
|
|
|
638
638
|
页面动画仅在当前路由 `key` 变化时触发;`navigate`、`goBack`、`replace` 等操作无需修改调用方式。
|
|
639
639
|
|
|
640
640
|
- `pageAnimationDistance?: number` — 默认 `96`,页面进入滑动距离(像素),范围 0–300。
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
## Single-page registry (v1.1.6)
|
|
644
|
+
|
|
645
|
+
`{ component: AddDevice, title: 'Add device', modalOptions: { placement: 'center' } }` is supported as a registry item. A registry with exactly one `screens` entry is also rendered in lightweight single-page mode. Modal opening and closing APIs remain unchanged. No navigation history, reducer, KeepAlive cache or page transitions are initialized. Navigation-only commands are unavailable in this mode and return `false` (or `{status:'cancelled'}` for `navigateAsync`).
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Performance and lifecycle notes
|
|
2
|
+
|
|
3
|
+
## Architecture
|
|
4
|
+
|
|
5
|
+
- Single-screen modals bypass stack reducers and route-transition snapshots.
|
|
6
|
+
- Single-screen navigation command context now retains stable function identities across `setParams` and `setOptions`. Reactive route data continues through the navigation state store.
|
|
7
|
+
- Footer, loading, and toast regions subscribe independently via `useSyncExternalStore`.
|
|
8
|
+
- Lazy screen components use Suspense boundaries in both navigator modes.
|
|
9
|
+
- Closing transitions use a cancellable waiter; provider unmount clears outstanding timeouts and settles modal promises.
|
|
10
|
+
|
|
11
|
+
## Suggested browser verification
|
|
12
|
+
|
|
13
|
+
1. Record React Profiler commits for single-screen `setParams`, Footer loading, and toast changes.
|
|
14
|
+
2. Open/close the modal 100 times; verify listeners and DOM nodes return to baseline.
|
|
15
|
+
3. Exercise rapid open/close, async `onBeforeClose`, unmount during exit, and queue replacement.
|
|
16
|
+
4. Compare cold lazy import versus warm open with production bundles.
|
|
17
|
+
5. Check reduced-motion preference and navigation animation cancellation in real browsers.
|
|
18
|
+
|
|
19
|
+
These are validation scenarios, not measured benchmark claims. Run `npm test`, `npm run typecheck`, `npm run test:react`, and `npm run build` in a fully provisioned environment before publishing.
|