swico 0.5.0-beta13 → 0.5.0-beta14

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": "0.5.0-beta13",
3
+ "version": "0.5.0-beta14",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -10,4 +10,4 @@ export declare const getHistory: (routerBase: ConfigRouterType['base'], routerTy
10
10
  history: SwicoHistoryType;
11
11
  originalHistory: import("history").HashHistory;
12
12
  };
13
- export declare const useLocation: UseLocationType;
13
+ export declare const useLocation: () => void;
@@ -11,6 +11,7 @@ var react_router_dom_2 = require("react-router-dom");
11
11
  var routes_1 = require("./routes");
12
12
  var react_router_dom_3 = require("react-router-dom");
13
13
  Object.defineProperty(exports, "HistoryRouter", { enumerable: true, get: function () { return react_router_dom_3.unstable_HistoryRouter; } });
14
+ console.log('routes', routes_1.routes);
14
15
  var interpolatePath = function (pathTemplate, params) {
15
16
  var pathParts = pathTemplate.split('/');
16
17
  var interpolatedParts = pathParts.map(function (part) {
@@ -146,25 +147,9 @@ var compareURLPatterns = function (urlPatternWithValues, urlPatternWithParams) {
146
147
  return true;
147
148
  };
148
149
  var useLocation = function () {
149
- var _a, _b;
150
150
  var location = (0, react_router_dom_1.useLocation)();
151
151
  var params = (0, react_router_dom_2.useParams)();
152
152
  var search = location.search, hash = location.hash, pathname = location.pathname;
153
153
  console.log('routes2', routes_1.routes);
154
- var pathNameList = (0, exports.getPathNameList)(routes_1.routes);
155
- var name = (_a = pathNameList.find(function (item) {
156
- return (Object.keys(params).length > 0 && compareURLPatterns(pathname, item.path)) ||
157
- item.path === pathname;
158
- })) === null || _a === void 0 ? void 0 : _a.name;
159
- var query = search ? qs_1.default.parse(search.startsWith('?') ? search.slice(1) : search) : {};
160
- return {
161
- name: name,
162
- path: pathname,
163
- pathname: (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.pathname,
164
- search: search,
165
- query: query,
166
- hash: hash,
167
- params: params
168
- };
169
154
  };
170
155
  exports.useLocation = useLocation;