fds-vue-core 8.7.1 → 8.8.0

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.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Query on the previous history entry is restored by the browser back button.
3
+ * `router.push('/path')` drops it.
4
+ * When that entry's pathname matches, reuse its full path.
5
+ */
6
+ export declare const usePreviousLocation: () => {
7
+ hrefFor: (fallbackPath: string, matchPaths?: readonly string[]) => string;
8
+ goTo: (fallbackPath: string, matchPaths?: readonly string[]) => void;
9
+ };
@@ -21754,6 +21754,30 @@ const teardownRouterLinkInterceptor = () => {
21754
21754
  }
21755
21755
  globalRouter = null;
21756
21756
  };
21757
+ const withoutHash = (location) => location.split("#")[0] ?? location;
21758
+ const pathOf = (location) => withoutHash(location).split("?")[0] ?? location;
21759
+ const usePreviousLocation = () => {
21760
+ const route = vueRouter.useRoute();
21761
+ const router = vueRouter.useRouter();
21762
+ const hrefFor = (fallbackPath, matchPaths = [fallbackPath]) => {
21763
+ void route.fullPath;
21764
+ const previous = router.options.history.state.back;
21765
+ if (typeof previous !== "string" || previous === "") return fallbackPath;
21766
+ const full = withoutHash(previous);
21767
+ if (!matchPaths.includes(pathOf(full))) return fallbackPath;
21768
+ return full;
21769
+ };
21770
+ const goTo = (fallbackPath, matchPaths) => {
21771
+ const href = hrefFor(fallbackPath, matchPaths);
21772
+ const previous = router.options.history.state.back;
21773
+ if (typeof previous === "string" && withoutHash(previous) === href) {
21774
+ router.back();
21775
+ return;
21776
+ }
21777
+ void router.push(href);
21778
+ };
21779
+ return { hrefFor, goTo };
21780
+ };
21757
21781
  const isArr = (v) => Array.isArray(v);
21758
21782
  const clone = (v) => isArr(v) ? [...v] : v;
21759
21783
  const cloneRecord = (defaults2) => {
@@ -22277,6 +22301,7 @@ exports.useExitConfirmationGuardState = useExitConfirmationGuardState;
22277
22301
  exports.useFileSizeValidation = useFileSizeValidation;
22278
22302
  exports.useFileValidation = useFileValidation;
22279
22303
  exports.useIsPid = useIsPid;
22304
+ exports.usePreviousLocation = usePreviousLocation;
22280
22305
  exports.useRouteFilters = useRouteFilters;
22281
22306
  exports.useRouteScrollPositions = useRouteScrollPositions;
22282
22307
  exports.useTreeState = useTreeState;