gomtm 0.0.268 → 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.
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Icons } from "mtxuilib/icons/icons";
|
|
3
4
|
import { CommandDialog, CommandEmpty, CommandInput, CommandList, CommandSeparator } from "mtxuilib/ui/command";
|
|
5
|
+
import { Dialog, DialogContent, DialogTrigger } from "mtxuilib/ui/dialog";
|
|
4
6
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
5
7
|
import { useState } from "react";
|
|
6
8
|
import { useMtmApp } from "../../providers/GomtmProvider";
|
|
@@ -10,19 +12,32 @@ const GoMtmDebug = () => {
|
|
|
10
12
|
if (!mtapp.isDebug) {
|
|
11
13
|
return null;
|
|
12
14
|
}
|
|
13
|
-
return /* @__PURE__ */ jsxs("div", { className: "fixed bottom-12 right-
|
|
14
|
-
/* @__PURE__ */ jsx(MtButton, {
|
|
15
|
+
return /* @__PURE__ */ jsxs("div", { className: "fixed bottom-12 right-2 bg-red-300", children: [
|
|
16
|
+
/* @__PURE__ */ jsx(MtButton, { onClick: () => {
|
|
17
|
+
setOpen(true);
|
|
18
|
+
}, children: /* @__PURE__ */ jsx(Icons.bug, {}) }),
|
|
15
19
|
/* @__PURE__ */ jsxs(CommandDialog, { open, onOpenChange: setOpen, children: [
|
|
16
20
|
/* @__PURE__ */ jsx(CommandInput, { placeholder: "Type a command or search...", onValueChange: (s) => {
|
|
17
21
|
setOpen(false);
|
|
18
22
|
} }),
|
|
19
23
|
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
20
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, {}) }),
|
|
21
26
|
/* @__PURE__ */ jsx(CommandSeparator, {})
|
|
22
27
|
] })
|
|
23
28
|
] })
|
|
24
29
|
] });
|
|
25
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
|
+
};
|
|
26
41
|
export {
|
|
27
42
|
GoMtmDebug
|
|
28
43
|
};
|
package/dist/esm/consts.d.ts
CHANGED
|
@@ -26,4 +26,5 @@ export declare const ImageNoExist = "/images/404.jpg";
|
|
|
26
26
|
export declare const ADMIN_ROLE = "admin";
|
|
27
27
|
export declare const MEMBER_ROLE = "member";
|
|
28
28
|
export declare const TRPC_API_PREFIX = "/api.v1/trpc";
|
|
29
|
-
export declare const HOTKEY_Debug = "
|
|
29
|
+
export declare const HOTKEY_Debug = "alt+j";
|
|
30
|
+
export declare const HOTKEY_Switchlayout = "alt+l";
|
package/dist/esm/consts.js
CHANGED
|
@@ -26,7 +26,8 @@ const ImageNoExist = "/images/404.jpg";
|
|
|
26
26
|
const ADMIN_ROLE = "admin";
|
|
27
27
|
const MEMBER_ROLE = "member";
|
|
28
28
|
const TRPC_API_PREFIX = "/api.v1/trpc";
|
|
29
|
-
const HOTKEY_Debug = "
|
|
29
|
+
const HOTKEY_Debug = "alt+j";
|
|
30
|
+
const HOTKEY_Switchlayout = "alt+l";
|
|
30
31
|
export {
|
|
31
32
|
ADMIN_ROLE,
|
|
32
33
|
ActionCreate,
|
|
@@ -40,6 +41,7 @@ export {
|
|
|
40
41
|
DEFAULT_revalidate_SECONDS,
|
|
41
42
|
ExtKey_Hostname,
|
|
42
43
|
HOTKEY_Debug,
|
|
44
|
+
HOTKEY_Switchlayout,
|
|
43
45
|
HeaderMtmApi,
|
|
44
46
|
HeaderMtmHost,
|
|
45
47
|
ImageNoExist,
|
|
@@ -10,6 +10,7 @@ import { AppProgressBar as ProgressBar } from "next-nprogress-bar";
|
|
|
10
10
|
import { Suspense, lazy } from "react";
|
|
11
11
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
12
12
|
import { Toaster } from "sonner";
|
|
13
|
+
import { HOTKEY_Switchlayout } from "../consts";
|
|
13
14
|
import { useMtmApp } from "../providers/GomtmProvider";
|
|
14
15
|
const ALL_Layouts = [
|
|
15
16
|
"demo1",
|
|
@@ -48,9 +49,9 @@ const LayoutBase = (props) => {
|
|
|
48
49
|
};
|
|
49
50
|
const LayoutSwitchDlg = () => {
|
|
50
51
|
const mtapp = useMtmApp();
|
|
51
|
-
useHotkeys(
|
|
52
|
-
mtapp.setOpenLayoutSwitchDlg(!
|
|
53
|
-
}, []);
|
|
52
|
+
useHotkeys(HOTKEY_Switchlayout, () => {
|
|
53
|
+
mtapp.setOpenLayoutSwitchDlg((pre) => !pre);
|
|
54
|
+
}, [mtapp.setOpenLayoutSwitchDlg, mtapp.openLayoutSwitchDlg]);
|
|
54
55
|
return /* @__PURE__ */ jsx(Dialog, { open: mtapp.openLayoutSwitchDlg, onOpenChange: mtapp.setOpenLayoutSwitchDlg, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
55
56
|
/* @__PURE__ */ jsxs(DialogTitle, { children: [
|
|
56
57
|
"LayoutSwitch,",
|
|
@@ -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,22 +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
|
-
setDebug(!
|
|
40
|
+
setDebug((pre) => !pre);
|
|
44
41
|
}, [_isDebug, setDebug]);
|
|
45
42
|
const searchParams = useSearchParams();
|
|
43
|
+
const setGlobalSearchParams = useCallback(debounce((values) => {
|
|
44
|
+
_setGlobalSearchParams(values);
|
|
45
|
+
}, 200), [_setGlobalSearchParams]);
|
|
46
46
|
const globalSearchParams = useMemo(() => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (q) {
|
|
51
|
-
setGlobalSearchParams((pre) => {
|
|
52
|
-
return __spreadProps(__spreadValues({}, pre), { q });
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}, 500);
|
|
56
|
-
}, [searchParams]);
|
|
47
|
+
const q = searchParams.get("q");
|
|
48
|
+
return __spreadValues({ q }, _globalSearchParams);
|
|
49
|
+
}, [searchParams, _globalSearchParams]);
|
|
57
50
|
return /* @__PURE__ */ jsx(AppContext.Provider, { value: {
|
|
58
51
|
isDebug: _isDebug,
|
|
59
52
|
setIsDebug: setDebug,
|