gomtm 0.0.269 → 0.0.270
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.
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Icons } from "mtxuilib/icons/icons";
|
|
4
4
|
import { CommandDialog, CommandEmpty, CommandInput, CommandList, CommandSeparator } from "mtxuilib/ui/command";
|
|
5
|
+
import { Dialog, DialogContent, DialogTrigger } from "mtxuilib/ui/dialog";
|
|
5
6
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
6
7
|
import { useState } from "react";
|
|
7
8
|
import { useMtmApp } from "../../providers/GomtmProvider";
|
|
@@ -21,11 +22,22 @@ const GoMtmDebug = () => {
|
|
|
21
22
|
} }),
|
|
22
23
|
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
23
24
|
/* @__PURE__ */ jsx(CommandEmpty, { children: "No results found." }),
|
|
25
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-2 bg-slate-100 p-2", children: /* @__PURE__ */ jsx(DebugAppMainStateDlg, {}) }),
|
|
24
26
|
/* @__PURE__ */ jsx(CommandSeparator, {})
|
|
25
27
|
] })
|
|
26
28
|
] })
|
|
27
29
|
] });
|
|
28
30
|
};
|
|
31
|
+
const DebugAppMainStateDlg = () => {
|
|
32
|
+
const matpp = useMtmApp();
|
|
33
|
+
return /* @__PURE__ */ jsxs(Dialog, { children: [
|
|
34
|
+
/* @__PURE__ */ jsx(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx(MtButton, { children: "appState" }) }),
|
|
35
|
+
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
36
|
+
"appstate",
|
|
37
|
+
/* @__PURE__ */ jsx("pre", { children: JSON.stringify(matpp.globalSearchParams || "null", null, 2) })
|
|
38
|
+
] })
|
|
39
|
+
] });
|
|
40
|
+
};
|
|
29
41
|
export {
|
|
30
42
|
GoMtmDebug
|
|
31
43
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
3
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -17,9 +15,8 @@ var __spreadValues = (a, b) => {
|
|
|
17
15
|
}
|
|
18
16
|
return a;
|
|
19
17
|
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
18
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
-
import { createContext, useContext, useMemo, useState } from "react";
|
|
19
|
+
import { createContext, useCallback, useContext, useMemo, useState } from "react";
|
|
23
20
|
import { createConnectTransport } from "@connectrpc/connect-web";
|
|
24
21
|
import { debounce } from "lodash";
|
|
25
22
|
import { useSearchParams } from "next/navigation";
|
|
@@ -38,23 +35,18 @@ function GomtmProvider(props) {
|
|
|
38
35
|
const [_layoutName, setLayoutName] = useState("front");
|
|
39
36
|
const [openLayoutSwitchDlg, setOpenLayoutSwitchDlg] = useState(false);
|
|
40
37
|
const [_cookieStr, setCookieStr] = useState("");
|
|
41
|
-
const [_globalSearchParams,
|
|
38
|
+
const [_globalSearchParams, _setGlobalSearchParams] = useState({});
|
|
42
39
|
useHotkeys(HOTKEY_Debug, () => {
|
|
43
|
-
console.log("set debug");
|
|
44
40
|
setDebug((pre) => !pre);
|
|
45
41
|
}, [_isDebug, setDebug]);
|
|
46
42
|
const searchParams = useSearchParams();
|
|
43
|
+
const setGlobalSearchParams = useCallback(debounce((values) => {
|
|
44
|
+
_setGlobalSearchParams(values);
|
|
45
|
+
}, 200), [_setGlobalSearchParams]);
|
|
47
46
|
const globalSearchParams = useMemo(() => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (q) {
|
|
52
|
-
setGlobalSearchParams((pre) => {
|
|
53
|
-
return __spreadProps(__spreadValues({}, pre), { q });
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}, 500);
|
|
57
|
-
}, [searchParams]);
|
|
47
|
+
const q = searchParams.get("q");
|
|
48
|
+
return __spreadValues({ q }, _globalSearchParams);
|
|
49
|
+
}, [searchParams, _globalSearchParams]);
|
|
58
50
|
return /* @__PURE__ */ jsx(AppContext.Provider, { value: {
|
|
59
51
|
isDebug: _isDebug,
|
|
60
52
|
setIsDebug: setDebug,
|