gomtm 0.0.248 → 0.0.250

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.
@@ -12,8 +12,8 @@ export declare const DEFAULT_revalidate_SECONDS = 3;
12
12
  export declare const LOGIN_CALLBACK_URL_KEY = "back";
13
13
  export declare const MTM_API_PREFIX = "/api";
14
14
  export declare const LayoutNameCookie = "layout";
15
+ export declare const IsDebugCookie = "is_debug";
15
16
  export declare const ExtKey_Hostname = "host";
16
- export declare const ExtKey_mtmaccessToken = "access_token";
17
17
  export declare const ItemAction_list_new_item = "list_new_item";
18
18
  export declare const Listview_list_filter = "Listview_list_filter";
19
19
  export declare const ActionEdit = "edit";
@@ -12,8 +12,8 @@ const DEFAULT_revalidate_SECONDS = 3;
12
12
  const LOGIN_CALLBACK_URL_KEY = "back";
13
13
  const MTM_API_PREFIX = "/api";
14
14
  const LayoutNameCookie = "layout";
15
+ const IsDebugCookie = "is_debug";
15
16
  const ExtKey_Hostname = "host";
16
- const ExtKey_mtmaccessToken = "access_token";
17
17
  const ItemAction_list_new_item = "list_new_item";
18
18
  const Listview_list_filter = "Listview_list_filter";
19
19
  const ActionEdit = "edit";
@@ -38,10 +38,10 @@ export {
38
38
  Cookie_Site_Host,
39
39
  DEFAULT_revalidate_SECONDS,
40
40
  ExtKey_Hostname,
41
- ExtKey_mtmaccessToken,
42
41
  HeaderMtmApi,
43
42
  HeaderMtmHost,
44
43
  ImageNoExist,
44
+ IsDebugCookie,
45
45
  ItemAction_list_new_item,
46
46
  LOGIN_CALLBACK_URL_KEY,
47
47
  LayoutNameCookie,
@@ -0,0 +1,11 @@
1
+ import type { Message, PartialMessage } from "@bufbuild/protobuf";
2
+ import { PropsWithChildren } from "react";
3
+ import { MethodUnaryDescriptor } from "../connectquery";
4
+ export declare const curdDetailPageDataAtom: import("jotai").PrimitiveAtom<undefined> & {
5
+ init: undefined;
6
+ };
7
+ export declare function CurdDetailProvider<I extends Message<I>, O extends Message<O>>(props: {
8
+ methodGet: MethodUnaryDescriptor<I, O>;
9
+ params?: PartialMessage<I>;
10
+ } & PropsWithChildren): import("react").JSX.Element;
11
+ export declare const DetailViewDataDlg: () => import("react").JSX.Element;
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { atom, useAtom } from "jotai";
4
+ import { ScopeAtomsHydrator } from "mtxlib/jotai/jotai-helper";
5
+ import { Dialog, DialogContent, DialogTrigger } from "mtxuilib/ui/dialog";
6
+ import { MtButton } from "mtxuilib/ui/ui-mt/Button";
7
+ import { Suspense } from "react";
8
+ import { useSuspenseQuery } from "../connectquery";
9
+ import { isDebugAtom } from "../providers/GomtmProvider";
10
+ const curdDetailPageDataAtom = atom(void 0);
11
+ function CurdDetailProvider(props) {
12
+ const { children, methodGet, params } = props;
13
+ const [isDebug] = useAtom(isDebugAtom);
14
+ const query = useSuspenseQuery(methodGet, params);
15
+ return /* @__PURE__ */ jsxs(ScopeAtomsHydrator, { atomValues: [
16
+ [curdDetailPageDataAtom, query.data]
17
+ ], children: [
18
+ children,
19
+ isDebug && /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(DetailViewDataDlg, {}) })
20
+ ] });
21
+ }
22
+ const DetailViewDataDlg = () => {
23
+ const [curdDetailPageData] = useAtom(curdDetailPageDataAtom);
24
+ return /* @__PURE__ */ jsxs(Dialog, { children: [
25
+ /* @__PURE__ */ jsx(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx(MtButton, { children: "DetailData" }) }),
26
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx("pre", { children: JSON.stringify(curdDetailPageData, null, 2) }) })
27
+ ] });
28
+ };
29
+ export {
30
+ CurdDetailProvider,
31
+ DetailViewDataDlg,
32
+ curdDetailPageDataAtom
33
+ };
@@ -0,0 +1,10 @@
1
+ import type { Message, PartialMessage } from "@bufbuild/protobuf";
2
+ import { PropsWithChildren } from "react";
3
+ import { MethodUnaryDescriptor } from "../connectquery";
4
+ export declare const curdDetailPageDataAtom: import("jotai").PrimitiveAtom<undefined> & {
5
+ init: undefined;
6
+ };
7
+ export declare function CurdDetailPage<I extends Message<I>, O extends Message<O>>(props: {
8
+ methodGet: MethodUnaryDescriptor<I, O>;
9
+ params?: PartialMessage<I>;
10
+ } & PropsWithChildren): import("react").JSX.Element;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { atom } from "jotai";
4
+ import { ScopeAtomsHydrator } from "mtxlib/jotai/jotai-helper";
5
+ import { useSuspenseQuery } from "../connectquery";
6
+ const curdDetailPageDataAtom = atom(void 0);
7
+ function CurdDetailPage(props) {
8
+ const { children, methodGet, params } = props;
9
+ const query = useSuspenseQuery(methodGet, params);
10
+ return /* @__PURE__ */ jsx(ScopeAtomsHydrator, { atomValues: [
11
+ [curdDetailPageDataAtom, query]
12
+ ], children });
13
+ }
14
+ export {
15
+ CurdDetailPage,
16
+ curdDetailPageDataAtom
17
+ };
@@ -13,12 +13,13 @@ import { Suspense } from "react";
13
13
  import { useHotkeys } from "react-hotkeys-hook";
14
14
  import { Toaster } from "sonner";
15
15
  import Dash5 from "./dash5";
16
+ import { DebugLayout } from "./debug-layout";
16
17
  import { Demo1Layout } from "./demo-layout";
17
18
  const ALL_Layouts = [
18
19
  "demo1",
19
- // "mail2",
20
20
  "dash5",
21
- "default"
21
+ "default",
22
+ "debug"
22
23
  ];
23
24
  const layoutNameValueAtom = atom("");
24
25
  const layoutNameAtom = atom((get) => {
@@ -39,10 +40,7 @@ const LayoutRender = (props) => {
39
40
  const [layoutName, setLayoutName] = useAtom(layoutNameAtom);
40
41
  return /* @__PURE__ */ jsxs(Fragment, { children: [
41
42
  /* @__PURE__ */ jsxs(TooltipProvider, { delayDuration: 0, children: [
42
- layoutName == "dash5" ? /* @__PURE__ */ jsx(Dash5, { children }) : (
43
- // layoutName == "mail2" ? <Mail2Layout>{children}</Mail2Layout> :
44
- layoutName == "demo1" ? /* @__PURE__ */ jsx(Demo1Layout, { children }) : layoutName == "default" ? /* @__PURE__ */ jsx(Fragment, { children }) : children
45
- ),
43
+ layoutName == "dash5" ? /* @__PURE__ */ jsx(Dash5, { children }) : layoutName == "debug" ? /* @__PURE__ */ jsx(DebugLayout, { children }) : layoutName == "demo1" ? /* @__PURE__ */ jsx(Demo1Layout, { children }) : layoutName == "default" ? /* @__PURE__ */ jsx(Fragment, { children }) : children,
46
44
  /* @__PURE__ */ jsx(
47
45
  ProgressBar,
48
46
  {
@@ -0,0 +1,2 @@
1
+ import { PropsWithChildren } from "react";
2
+ export declare const DebugLayout: (props: PropsWithChildren) => import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ const DebugLayout = (props) => {
4
+ const { children } = props;
5
+ return /* @__PURE__ */ jsx("div", { className: "border bg-slate-200 p-2", children });
6
+ };
7
+ export {
8
+ DebugLayout
9
+ };
@@ -1,11 +1,8 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { jsx } from "react/jsx-runtime";
3
3
  const Demo1Layout = (props) => {
4
4
  const { children } = props;
5
- return /* @__PURE__ */ jsxs("div", { className: "prose p-2", children: [
6
- /* @__PURE__ */ jsx("h1", { children: "Demo1Layout" }),
7
- children
8
- ] });
5
+ return /* @__PURE__ */ jsx("div", { className: "prose p-2", children });
9
6
  };
10
7
  export {
11
8
  Demo1Layout
@@ -110,7 +110,6 @@ const gomtmFetcher = (initGlobal) => {
110
110
  init
111
111
  });
112
112
  const responseData = yield fetcher(input, init);
113
- console.log("[mtmfetch response]", responseData);
114
113
  return responseData;
115
114
  } catch (e) {
116
115
  console.error("[mtmfetch error]", {
@@ -21,10 +21,10 @@ var __async = (__this, __arguments, generator) => {
21
21
  import { Fragment, jsx } from "react/jsx-runtime";
22
22
  import { ScopeAtomsHydrator } from "mtxlib/jotai/jotai-helper";
23
23
  import { cookies, headers } from "next/headers";
24
- import { LayoutNameCookie } from "../consts";
24
+ import { IsDebugCookie, LayoutNameCookie } from "../consts";
25
25
  import { layoutNameAtom } from "../ly/LayoutBase";
26
26
  import { ssrGetBackendUrl } from "../mtmFetcher";
27
- import { GomtmProvider, cookiesAtom } from "./GomtmProvider";
27
+ import { GomtmProvider, cookiesAtom, isDebugAtom } from "./GomtmProvider";
28
28
  function GomtmAppSS(props) {
29
29
  return __async(this, null, function* () {
30
30
  const { children } = props;
@@ -34,9 +34,11 @@ function GomtmAppSS(props) {
34
34
  }
35
35
  const cookiesStr = headers().get("Cookie");
36
36
  const layoutName = cookies().get(LayoutNameCookie);
37
+ const isDebug = cookies().get(IsDebugCookie);
37
38
  return /* @__PURE__ */ jsx(GomtmProvider, { backendUrl: backend, children: /* @__PURE__ */ jsx(ScopeAtomsHydrator, { atomValues: [
38
39
  [cookiesAtom, cookiesStr],
39
- [layoutNameAtom, layoutName]
40
+ [layoutNameAtom, layoutName],
41
+ [isDebugAtom, isDebug]
40
42
  ], children }) });
41
43
  });
42
44
  }