defuss 3.4.3 → 3.4.4

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/index.cjs CHANGED
@@ -1294,10 +1294,10 @@ const setupRouter = (config = {
1294
1294
  createRouteContext(request) {
1295
1295
  return {
1296
1296
  request,
1297
- onBeforeUnmount(fn) {
1297
+ onBeforeLeave(fn) {
1298
1298
  state.lifecycleHooks.beforeUnmount.push(fn);
1299
1299
  },
1300
- onUnmount(fn) {
1300
+ onLeave(fn) {
1301
1301
  state.lifecycleHooks.unmount.push(fn);
1302
1302
  }
1303
1303
  };
package/dist/index.d.ts CHANGED
@@ -146,11 +146,11 @@ type UnmountHookFn = () => void;
146
146
  * @example
147
147
  * ```tsx
148
148
  * const MyScreen = ({ route }: { route: RouteContext }) => {
149
- * route.onBeforeUnmount(() => {
149
+ * route.onBeforeLeave(() => {
150
150
  * // Return false to block navigation (e.g. unsaved changes)
151
151
  * return confirm("Leave page?");
152
152
  * });
153
- * route.onUnmount(() => {
153
+ * route.onLeave(() => {
154
154
  * console.log("Route was left");
155
155
  * });
156
156
  * return <div>Current path: {route.request.path}</div>;
@@ -161,16 +161,16 @@ interface RouteContext {
161
161
  /** The matched RouteRequest for the current route */
162
162
  request: RouteRequest;
163
163
  /**
164
- * Register a hook that fires before the route is unmounted.
164
+ * Register a hook that fires before leaving the current route.
165
165
  * Returning `false` (or a Promise resolving to `false`) blocks navigation,
166
166
  * allowing implementation of confirmation dialogs.
167
167
  */
168
- onBeforeUnmount(fn: BeforeUnmountHookFn): void;
168
+ onBeforeLeave(fn: BeforeUnmountHookFn): void;
169
169
  /**
170
- * Register a hook that fires after the route has been unmounted
170
+ * Register a hook that fires after the route has been left
171
171
  * (navigation completed, new route is rendered).
172
172
  */
173
- onUnmount(fn: UnmountHookFn): void;
173
+ onLeave(fn: UnmountHookFn): void;
174
174
  }
175
175
  /**
176
176
  * Props mixin for screen components rendered by `<Route component={...} />`.
@@ -361,7 +361,7 @@ interface Router {
361
361
  ready(): Promise<void>;
362
362
  /**
363
363
  * Create a RouteContext object for a matched route request.
364
- * The context provides lifecycle hooks (onBeforeUnmount, onUnmount)
364
+ * The context provides lifecycle hooks (onBeforeLeave, onLeave)
365
365
  * and is passed to components rendered via Route's `component` prop.
366
366
  */
367
367
  createRouteContext(request: RouteRequest): RouteContext;
@@ -381,8 +381,8 @@ interface RouteComponentProps extends Props {
381
381
  *
382
382
  * The component receives a `route` prop (RouteContext) with:
383
383
  * - `route.request` — the matched RouteRequest with params, query, etc.
384
- * - `route.onBeforeUnmount(fn)` — register a hook before route leaves; return `false` to block
385
- * - `route.onUnmount(fn)` — register a hook after route has been left
384
+ * - `route.onBeforeLeave(fn)` — register a hook before route leaves; return `false` to block
385
+ * - `route.onLeave(fn)` — register a hook after route has been left
386
386
  *
387
387
  * When the component is async and Route has children, the children are
388
388
  * shown as a loading fallback until the async component resolves.
package/dist/index.mjs CHANGED
@@ -1293,10 +1293,10 @@ const setupRouter = (config = {
1293
1293
  createRouteContext(request) {
1294
1294
  return {
1295
1295
  request,
1296
- onBeforeUnmount(fn) {
1296
+ onBeforeLeave(fn) {
1297
1297
  state.lifecycleHooks.beforeUnmount.push(fn);
1298
1298
  },
1299
- onUnmount(fn) {
1299
+ onLeave(fn) {
1300
1300
  state.lifecycleHooks.unmount.push(fn);
1301
1301
  }
1302
1302
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "defuss",
3
- "version": "3.4.3",
3
+ "version": "3.4.4",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"