@gohanfromgoku/ui-kit 1.0.1 → 1.1.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.
@@ -9,8 +9,8 @@ const createBrowserRouter = (routes, { page404 } = { page404: () => _jsx(_Fragme
9
9
  const { hash, href, origin, pathname, port, protocol, search } = window.location;
10
10
  return { hash, href, origin, pathname, port, protocol, search };
11
11
  };
12
- const { locationDetails, useLocationDetailsState } = createStore("locationDetails", { params: {}, queryParams: {}, ...getLatestLocationDetails() });
13
- const { activeRoute, useActiveRouteState } = createStore("activeRoute", routes.find(r => isRouteMatching(r.pathname)) || { pathname: window.location.pathname, component: page404 });
12
+ const { locationDetails, useLocationDetailsStoreValues } = createStore("locationDetails", { params: {}, queryParams: {}, ...getLatestLocationDetails() });
13
+ const { activeRoute, useActiveRouteStoreValues } = createStore("activeRoute", routes.find(r => isRouteMatching(r.pathname)) || { pathname: window.location.pathname, component: page404 });
14
14
  const navigate = (to, { queryParams, replace } = {}) => {
15
15
  if (typeof to === "number") {
16
16
  window.history.go(to);
@@ -31,10 +31,10 @@ const createBrowserRouter = (routes, { page404 } = { page404: () => _jsx(_Fragme
31
31
  if (routes.length === 0) {
32
32
  throw new Error("useLocationDetails cannot be used without initializing routes. Use createBrowserRouter with routes.");
33
33
  }
34
- return useLocationDetailsState();
34
+ return useLocationDetailsStoreValues();
35
35
  };
36
36
  const Outlet = () => {
37
- const { component } = useActiveRouteState();
37
+ const { component } = useActiveRouteStoreValues();
38
38
  useEffect(() => {
39
39
  const updateLocation = () => {
40
40
  const active = routes.find(r => isRouteMatching(r.pathname)) || { pathname: window.location.pathname, component: page404 };
@@ -13,8 +13,8 @@ const createMemoryRouter = (routes, { page404 } = { page404: () => _jsx(_Fragmen
13
13
  throw "Atleast one route should present";
14
14
  }
15
15
  ;
16
- const { activeRoute, useActiveRouteState } = createStore("activeRoute", routes.find(() => isRouteMatching("/")) || { pathname: "/", component: page404 });
17
- const { locationDetails, useLocationDetailsState } = createStore("locationDetails", { params: {}, queryParams: {}, ...getLatestLocationDetails(), pathname: activeRoute.pathname });
16
+ const { activeRoute, useActiveRouteStoreValues } = createStore("activeRoute", routes.find(() => isRouteMatching("/")) || { pathname: "/", component: page404 });
17
+ const { locationDetails, useLocationDetailsStoreValues } = createStore("locationDetails", { params: {}, queryParams: {}, ...getLatestLocationDetails(), pathname: activeRoute.pathname });
18
18
  const { entries } = createStore("entries", { value: ["/"] });
19
19
  const { currentIndex } = createStore("currentIndex", { value: 0 });
20
20
  const navigate = (to, { queryParams } = {}) => {
@@ -44,12 +44,12 @@ const createMemoryRouter = (routes, { page404 } = { page404: () => _jsx(_Fragmen
44
44
  currentIndex.setState({ value: currentIndex.value + 1 });
45
45
  };
46
46
  const Outlet = () => {
47
- const { component: Component } = useActiveRouteState();
47
+ const { component: Component } = useActiveRouteStoreValues();
48
48
  return _jsx(Component, {});
49
49
  };
50
50
  return {
51
51
  navigate,
52
- useLocationDetails: useLocationDetailsState,
52
+ useLocationDetails: useLocationDetailsStoreValues,
53
53
  Outlet
54
54
  };
55
55
  };
@@ -31,6 +31,6 @@ export default function createStore(name, initialState) {
31
31
  setState,
32
32
  resetState
33
33
  },
34
- [`use${capName}State`]: useStore
34
+ [`use${capName}StoreValues`]: useStore
35
35
  };
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gohanfromgoku/ui-kit",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "ui-kit is a TypeScript based UI component library designed for building modern web applications with ease and efficiency.",
5
5
  "sideEffects": false,
6
6
  "scripts": {
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/react": ">=18",
33
- "react": "^19.2.3",
33
+ "react": ">=18",
34
34
  "tsc-alias": "^1.8.16",
35
35
  "typescript": "^5.9.3"
36
36
  },
@@ -2,4 +2,4 @@ import "../prototypes";
2
2
  export default function createStore<Name extends string, T extends Record<string, any>>(name: Name, initialState: T): { [K in Name]: T & {
3
3
  setState: (partial: Partial<T>) => void;
4
4
  resetState: () => void;
5
- }; } & { [K in `use${Capitalize<Name>}State`]: () => T; };
5
+ }; } & { [K in `use${Capitalize<Name>}StoreValues`]: () => T; };