@starasia/admin 14.0.4 → 15.0.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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),r=require("@tanstack/react-router"),P={useLocation:()=>{const e=r.useLocation();return{pathname:e.pathname,search:e.searchStr??"",hash:e.hash??"",state:e.state}},useParams:()=>r.useParams({strict:!1}),useSearchParams:()=>{const e=r.useNavigate(),a=r.useLocation().searchStr??"",u=c.useMemo(()=>new URLSearchParams(a),[a]),i=c.useCallback((s,n)=>{const o=typeof s=="function"?s(new URLSearchParams(a)):s,l=o instanceof URLSearchParams?o:new URLSearchParams(o),h={};l.forEach((m,S)=>{h[S]=m}),e({to:".",search:h,replace:n==null?void 0:n.replace})},[e,a]);return c.useMemo(()=>[u,i],[u,i])},useNavigate:()=>{const e=r.useNavigate();return(t,a)=>{if(typeof t=="number"){window.history.go(t);return}e({to:t,replace:a==null?void 0:a.replace})}},Link:({to:e,children:t,...a})=>c.createElement(r.Link,{to:e,...a},t),Outlet:r.Outlet};exports.tanstackAdapter=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),a=require("@tanstack/react-router"),g=e=>{if(e!=null)return typeof e=="string"?e:JSON.stringify(e)},P=e=>{if(e==="")return e;try{const t=JSON.parse(e);if(t===null)return e;if(JSON.stringify(t)===e)return t}catch{}return e},d={useLocation:()=>{const e=a.useLocation();return{pathname:e.pathname,search:e.searchStr??"",hash:e.hash??"",state:e.state}},useParams:()=>a.useParams({strict:!1}),useSearchParams:()=>{const e=a.useNavigate(),t=a.useLocation(),r=t.searchStr??"",m=t.search,o=u.useMemo(()=>{const s=new URLSearchParams;return Object.entries(m??{}).forEach(([n,c])=>{const i=g(c);i!==void 0&&s.set(n,i)}),s},[r]),h=u.useCallback((s,n)=>{const c=typeof s=="function"?s(new URLSearchParams(o)):s,i=c instanceof URLSearchParams?c:new URLSearchParams(c),f={};i.forEach((l,S)=>{f[S]=P(l)}),e({to:".",search:f,replace:n==null?void 0:n.replace})},[e,o]);return u.useMemo(()=>[o,h],[o,h])},useNavigate:()=>{const e=a.useNavigate();return(t,r)=>{if(typeof t=="number"){window.history.go(t);return}e({to:t,replace:r==null?void 0:r.replace})}},Link:({to:e,children:t,...r})=>u.createElement(a.Link,{to:e,...r},t),Outlet:a.Outlet};exports.tanstackAdapter=d;
@@ -1,51 +1,66 @@
1
- import S, { useMemo as i, useCallback as L } from "react";
2
- import { Outlet as g, Link as p, useNavigate as m, useLocation as u, useParams as w } from "@tanstack/react-router";
3
- const v = {
1
+ import g, { useMemo as h, useCallback as p } from "react";
2
+ import { Outlet as L, Link as y, useNavigate as f, useLocation as m, useParams as O } from "@tanstack/react-router";
3
+ const d = (e) => {
4
+ if (e != null)
5
+ return typeof e == "string" ? e : JSON.stringify(e);
6
+ }, R = (e) => {
7
+ if (e === "") return e;
8
+ try {
9
+ const r = JSON.parse(e);
10
+ if (r === null) return e;
11
+ if (JSON.stringify(r) === e) return r;
12
+ } catch {
13
+ }
14
+ return e;
15
+ }, k = {
4
16
  useLocation: () => {
5
- const a = u();
17
+ const e = m();
6
18
  return {
7
- pathname: a.pathname,
8
- search: a.searchStr ?? "",
9
- hash: a.hash ?? "",
10
- state: a.state
19
+ pathname: e.pathname,
20
+ search: e.searchStr ?? "",
21
+ hash: e.hash ?? "",
22
+ state: e.state
11
23
  };
12
24
  },
13
- useParams: () => w({ strict: !1 }),
25
+ useParams: () => O({ strict: !1 }),
14
26
  useSearchParams: () => {
15
- const a = m(), e = u().searchStr ?? "", n = i(
16
- () => new URLSearchParams(e),
17
- [e]
18
- ), o = L(
19
- (c, t) => {
20
- const s = typeof c == "function" ? c(new URLSearchParams(e)) : c, l = s instanceof URLSearchParams ? s : new URLSearchParams(s), h = {};
21
- l.forEach((f, P) => {
22
- h[P] = f;
23
- }), a({
27
+ const e = f(), r = m(), t = r.searchStr ?? "", S = r.search, c = h(() => {
28
+ const a = new URLSearchParams();
29
+ return Object.entries(S ?? {}).forEach(([n, s]) => {
30
+ const o = d(s);
31
+ o !== void 0 && a.set(n, o);
32
+ }), a;
33
+ }, [t]), i = p(
34
+ (a, n) => {
35
+ const s = typeof a == "function" ? a(new URLSearchParams(c)) : a, o = s instanceof URLSearchParams ? s : new URLSearchParams(s), u = {};
36
+ o.forEach((l, P) => {
37
+ u[P] = R(l);
38
+ }), e({
24
39
  to: ".",
25
- search: h,
26
- replace: t == null ? void 0 : t.replace
40
+ search: u,
41
+ replace: n == null ? void 0 : n.replace
27
42
  });
28
43
  },
29
- [a, e]
44
+ [e, c]
30
45
  );
31
- return i(
32
- () => [n, o],
33
- [n, o]
46
+ return h(
47
+ () => [c, i],
48
+ [c, i]
34
49
  );
35
50
  },
36
51
  useNavigate: () => {
37
- const a = m();
38
- return (r, e) => {
52
+ const e = f();
53
+ return (r, t) => {
39
54
  if (typeof r == "number") {
40
55
  window.history.go(r);
41
56
  return;
42
57
  }
43
- a({ to: r, replace: e == null ? void 0 : e.replace });
58
+ e({ to: r, replace: t == null ? void 0 : t.replace });
44
59
  };
45
60
  },
46
- Link: ({ to: a, children: r, ...e }) => S.createElement(p, { to: a, ...e }, r),
47
- Outlet: g
61
+ Link: ({ to: e, children: r, ...t }) => g.createElement(y, { to: e, ...t }, r),
62
+ Outlet: L
48
63
  };
49
64
  export {
50
- v as tanstackAdapter
65
+ k as tanstackAdapter
51
66
  };