swico 2.9.0-beta.1 → 2.9.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swico",
3
- "version": "2.9.0-beta.1",
3
+ "version": "2.9.0-beta.3",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -2,7 +2,6 @@ import { SwicoHistoryType, SwicoLocationType } from '../../../typings/global-typ
2
2
  export declare const compareURLPatterns: (urlPatternWithValues: string, urlPatternWithParams: string) => boolean;
3
3
  export declare const interpolatePath: (pathTemplate: string, params: Record<string, any>) => string;
4
4
  export declare const interpolatePathParams: (pathTemplate: string, path: string) => {};
5
- export declare const formatAncPath: (ancPath: string) => string;
6
5
  export declare const pathNameList: {
7
6
  path: string;
8
7
  name: string;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.history = exports.getHistory = exports.pathNameList = exports.formatAncPath = exports.interpolatePathParams = exports.interpolatePath = exports.compareURLPatterns = void 0;
6
+ exports.history = exports.getHistory = exports.pathNameList = exports.interpolatePathParams = exports.interpolatePath = exports.compareURLPatterns = void 0;
7
7
  const qs_1 = __importDefault(require("qs"));
8
8
  const router_1 = require("./router");
9
9
  const lastIndexBase = router_1.routerBase[router_1.routerBase.length - 1];
@@ -67,12 +67,11 @@ const formatAncPath = (ancPath) => {
67
67
  newAncPath = newAncPath.endsWith('/') ? newAncPath.slice(0, -1) : newAncPath;
68
68
  return newAncPath;
69
69
  };
70
- exports.formatAncPath = formatAncPath;
71
70
  const getPathNameList = (routes) => {
72
71
  const list = [];
73
72
  const checkRouteItem = (item, ancPath) => {
74
73
  const { path, name, children, custom } = item;
75
- const newAncPath = `${(0, exports.formatAncPath)(ancPath)}${path.startsWith('/') ? path : '/' + path}`;
74
+ const newAncPath = `${formatAncPath(ancPath)}${path.startsWith('/') ? path : '/' + path}`;
76
75
  list.push({ path: newAncPath, name, custom });
77
76
  if (children) {
78
77
  children.some((item) => checkRouteItem(item, newAncPath));
@@ -14,11 +14,10 @@ const Container = (0, vue_1.defineComponent)({
14
14
  const error = (0, vue_1.ref)(null);
15
15
  (0, vue_1.onErrorCaptured)((err) => {
16
16
  error.value = err.toString();
17
- return false;
18
17
  });
19
18
  return { error };
20
19
  },
21
- template: '<SwicoLayout v-if="!error"></SwicoLayout>'
20
+ template: '<SwicoLayout ></SwicoLayout>'
22
21
  });
23
22
  const router = (0, history_1.getRouter)();
24
23
  const app = (0, vue_1.createApp)(Container);
@@ -1,9 +1,9 @@
1
1
  import { RouteRecordRaw } from 'vue-router';
2
2
  import { ConfigRouterType } from '../../../main-config';
3
- type RouteItem = RouteRecordRaw & {
3
+ export type RouteItem = RouteRecordRaw & {
4
4
  decorator?: string;
5
+ custom?: any;
5
6
  };
6
7
  export declare const routes: RouteItem[];
7
8
  export declare const routerType: ConfigRouterType['type'];
8
9
  export declare const routerBase: ConfigRouterType['base'];
9
- export {};
@@ -8,7 +8,6 @@ const vue_router_1 = require("vue-router");
8
8
  const qs_1 = __importDefault(require("qs"));
9
9
  const vue_1 = require("vue");
10
10
  const router_1 = require("./$env/router");
11
- const history_1 = require("../.swico-react/$env/history");
12
11
  const getFormatRouterBase = (routerBase) => {
13
12
  const lastIndexBase = routerBase[routerBase.length - 1];
14
13
  return lastIndexBase === '/' ? routerBase.slice(0, routerBase.length - 1) : routerBase;
@@ -46,7 +45,6 @@ exports.useLocation = useLocation;
46
45
  const useNav = () => {
47
46
  const router = (0, vue_router_1.useRouter)();
48
47
  const newNavigate = (to, options) => {
49
- var _a;
50
48
  switch (typeof to) {
51
49
  case 'string':
52
50
  if (options === null || options === void 0 ? void 0 : options.replace) {
@@ -60,10 +58,6 @@ const useNav = () => {
60
58
  router.go(to);
61
59
  break;
62
60
  case 'object': {
63
- const name = to.name;
64
- if (name && !((_a = history_1.pathNameList.find((item) => item.name === name)) === null || _a === void 0 ? void 0 : _a.path)) {
65
- throw `An error occurred while executing 'useNav()' operation: The path for the name "${to.name}" could not be found`;
66
- }
67
61
  if (options === null || options === void 0 ? void 0 : options.replace) {
68
62
  router.replace(to);
69
63
  }