gomtm 0.0.150 → 0.0.152

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.
@@ -0,0 +1,12 @@
1
+ import { InfiniteData, UseSuspenseInfiniteQueryResult } from "@tanstack/react-query";
2
+ import type { ConnectError, Message, PlainMessage } from "gomtm";
3
+ import { MethodUnaryDescriptor } from "gomtm/connectquery";
4
+ import { MtmError } from "gomtm/gomtmpb/mtm/sppb/mtm_pb";
5
+ import { PropsWithChildren } from "react";
6
+ export declare function CommonListViewProvider<I extends Message<I>, O extends Message<O>>(props: {
7
+ methodList: MethodUnaryDescriptor<I, any>;
8
+ } & PropsWithChildren): import("react").JSX.Element;
9
+ export declare function CommonListView<I extends Message<I>, O extends Message<O>>(): import("react").JSX.Element | null;
10
+ export declare function useCommonListView<T extends Message<T>>(): {
11
+ listQuery: UseSuspenseInfiniteQueryResult<InfiniteData<T & PlainMessage<MtmError>, unknown>, ConnectError> | null;
12
+ };
@@ -0,0 +1,92 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useSuspenseInfiniteQuery } from "gomtm/connectquery";
4
+ import { ListViewLayout } from "gomtm/gomtmpb/mtm/sppb/mtm_pb";
5
+ import { atom, useAtom } from "jotai";
6
+ import { useHydrateAtoms } from "jotai/utils";
7
+ import { ListItemView } from "mtxuilib/components/ListItem";
8
+ import { MtUnaryCallErrorView } from "mtxuilib/components/MtUnaryCallErrorView";
9
+ import { cn } from "mtxuilib/lib/utils";
10
+ import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "mtxuilib/ui/pagination";
11
+ const listQueryAtom = atom(null);
12
+ function CommonListViewProvider(props) {
13
+ const { children, methodList } = props;
14
+ const listquery = useSuspenseInfiniteQuery(methodList, {
15
+ //@ts-ignore
16
+ page: 1
17
+ }, {
18
+ pageParamKey: "pagination",
19
+ getNextPageParam: (res, b, c) => {
20
+ return {
21
+ //@ts-ignore
22
+ page: ((c == null ? void 0 : c.page) || 0) + 1
23
+ };
24
+ }
25
+ });
26
+ useHydrateAtoms([
27
+ [
28
+ listQueryAtom,
29
+ listquery
30
+ ]
31
+ ]);
32
+ return /* @__PURE__ */ jsx(Fragment, { children });
33
+ }
34
+ function CommonListView() {
35
+ const [listQuery, setListQuery] = useAtom(listQueryAtom);
36
+ if (!(listQuery == null ? void 0 : listQuery.data)) {
37
+ return null;
38
+ }
39
+ return /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
40
+ /* @__PURE__ */ jsx(
41
+ "div",
42
+ {
43
+ className: cn(
44
+ "w-full"
45
+ // 滚动设置
46
+ // " max-h-[700px] overflow-y-auto"
47
+ ),
48
+ children: listQuery.data.pages.map((page, i) => {
49
+ var _a;
50
+ if (page.error_code) {
51
+ return /* @__PURE__ */ jsx(MtUnaryCallErrorView, { unaryError: page }, i);
52
+ } else {
53
+ return /* @__PURE__ */ jsx(ListLayout, { layout: page.listLayout, children: (_a = page == null ? void 0 : page.items) == null ? void 0 : _a.map((item, j) => /* @__PURE__ */ jsx(ListItemView, { item }, `${i}-${j}`)) }, i);
54
+ }
55
+ })
56
+ }
57
+ ),
58
+ /* @__PURE__ */ jsx(Pagination, { children: /* @__PURE__ */ jsxs(PaginationContent, { children: [
59
+ /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationPrevious, { href: "#" }) }),
60
+ /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { href: "#", children: "1" }) }),
61
+ /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { href: "#", isActive: true, children: "2" }) }),
62
+ /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { href: "#", children: "3" }) }),
63
+ /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationEllipsis, {}) }),
64
+ /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationNext, { href: "#" }) })
65
+ ] }) }),
66
+ /* @__PURE__ */ jsx("div", { className: "absolute right-1 top-1" })
67
+ ] });
68
+ }
69
+ const ListLayout = (props) => {
70
+ const { children } = props;
71
+ switch (props.layout) {
72
+ case ListViewLayout.simple:
73
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1 rounded-md p-2 shadow-sm", children });
74
+ case ListViewLayout.grid:
75
+ return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
76
+ case ListViewLayout.card:
77
+ return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
78
+ default:
79
+ return children;
80
+ }
81
+ };
82
+ function useCommonListView() {
83
+ const [listQuery, setListQuery] = useAtom(listQueryAtom);
84
+ return {
85
+ listQuery
86
+ };
87
+ }
88
+ export {
89
+ CommonListView,
90
+ CommonListViewProvider,
91
+ useCommonListView
92
+ };
@@ -0,0 +1,17 @@
1
+ import type { Message } from "gomtm";
2
+ import { PartialMessage } from "gomtm";
3
+ import { MethodUnaryDescriptor } from "gomtm/connectquery";
4
+ import { PropsWithChildren } from "react";
5
+ import { DefaultValues } from "react-hook-form";
6
+ export declare function useCreateForm<I extends Message<I>, O extends Message<O>>(props: {
7
+ defaultValues: DefaultValues<PartialMessage<I>>;
8
+ mutationSig: MethodUnaryDescriptor<I, any>;
9
+ }): {
10
+ form: import("react-hook-form").UseFormReturn<PartialMessage<I>, any, undefined>;
11
+ handleSubmit: (values: any) => void;
12
+ handleFormSubmit: () => (e?: import("react").BaseSyntheticEvent<object, any, any> | undefined) => Promise<void>;
13
+ handleCancel: () => void;
14
+ };
15
+ export declare function CreateFormV2<I extends Message<I>, O extends Message<O>>(props: {
16
+ createForm: ReturnType<typeof useCreateForm>;
17
+ } & PropsWithChildren): import("react").JSX.Element;
@@ -0,0 +1,81 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ var __objRest = (source, exclude) => {
22
+ var target = {};
23
+ for (var prop in source)
24
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
+ target[prop] = source[prop];
26
+ if (source != null && __getOwnPropSymbols)
27
+ for (var prop of __getOwnPropSymbols(source)) {
28
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
+ target[prop] = source[prop];
30
+ }
31
+ return target;
32
+ };
33
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
34
+ import { useMutation } from "gomtm/connectquery";
35
+ import { EditFormToolbar } from "mtxuilib/form/EditFormToolbar";
36
+ import { useMtRouter } from "mtxuilib/hooks/use-router";
37
+ import { Dialog, DialogContent, DialogFooter } from "mtxuilib/ui/dialog";
38
+ import { useCallback } from "react";
39
+ import { FormProvider, useForm } from "react-hook-form";
40
+ function useCreateForm(props) {
41
+ const { defaultValues, mutationSig } = props;
42
+ const form = useForm({
43
+ defaultValues
44
+ });
45
+ const mutation = useMutation(mutationSig);
46
+ const handleValuesSubmit = useCallback((values) => {
47
+ mutation.mutateAsync(values);
48
+ }, [mutation]);
49
+ const handleFormSubmit = useCallback(() => {
50
+ return form.handleSubmit(handleValuesSubmit);
51
+ }, [form, handleValuesSubmit]);
52
+ return {
53
+ form,
54
+ handleSubmit: handleValuesSubmit,
55
+ handleFormSubmit,
56
+ handleCancel: () => {
57
+ }
58
+ };
59
+ }
60
+ function CreateFormV2(props) {
61
+ const _a = props, { children, createForm } = _a, etc = __objRest(_a, ["children", "createForm"]);
62
+ const router = useMtRouter();
63
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Dialog, { open: true, onOpenChange: () => {
64
+ router.back();
65
+ }, children: /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(FormProvider, __spreadProps(__spreadValues({}, createForm.form), { children: /* @__PURE__ */ jsxs("form", { onSubmit: createForm.handleFormSubmit, children: [
66
+ children,
67
+ /* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsx(
68
+ EditFormToolbar,
69
+ {
70
+ onSubmit: (values) => {
71
+ createForm.handleSubmit(values);
72
+ },
73
+ onCancel: () => router.back()
74
+ }
75
+ ) })
76
+ ] }) })) }) }) });
77
+ }
78
+ export {
79
+ CreateFormV2,
80
+ useCreateForm
81
+ };
@@ -0,0 +1,65 @@
1
+ import { PlainMessage } from "gomtm";
2
+ import { CurdView } from "gomtm/gomtmpb/mtm/sppb/mtm_pb";
3
+ import { PropsWithChildren } from "react";
4
+ export declare const activateIdAtom: import("jotai").PrimitiveAtom<string> & {
5
+ init: string;
6
+ };
7
+ export declare const curdViewAtom: import("jotai").PrimitiveAtom<PlainMessage<CurdView> | null | undefined> & {
8
+ init: PlainMessage<CurdView> | null | undefined;
9
+ };
10
+ export declare const curdViewIdAtom: import("jotai").PrimitiveAtom<string> & {
11
+ init: string;
12
+ };
13
+ export declare const curdStore: {
14
+ get: <Value>(atom: import("jotai").Atom<Value>) => Value;
15
+ set: <Value_1, Args extends unknown[], Result>(atom: import("jotai").WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
16
+ sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
17
+ } & Partial<{
18
+ dev_subscribe_store: (l: (action: {
19
+ type: "write";
20
+ flushed: Set<import("jotai").Atom<unknown>>;
21
+ } | {
22
+ type: "async-write";
23
+ flushed: Set<import("jotai").Atom<unknown>>;
24
+ } | {
25
+ type: "sub";
26
+ flushed: Set<import("jotai").Atom<unknown>>;
27
+ } | {
28
+ type: "unsub";
29
+ } | {
30
+ type: "restore";
31
+ flushed: Set<import("jotai").Atom<unknown>>;
32
+ }) => void, rev: 2) => () => void;
33
+ dev_get_mounted_atoms: () => IterableIterator<import("jotai").Atom<unknown>>;
34
+ dev_get_atom_state: (a: import("jotai").Atom<unknown>) => ({
35
+ d: Map<import("jotai").Atom<unknown>, any & ({
36
+ e: unknown;
37
+ } | {
38
+ v: unknown;
39
+ })>;
40
+ } & ({
41
+ e: unknown;
42
+ } | {
43
+ v: unknown;
44
+ })) | undefined;
45
+ dev_get_mounted: (a: import("jotai").Atom<unknown>) => {
46
+ l: Set<() => void>;
47
+ t: Set<import("jotai").Atom<unknown>>;
48
+ u?: (() => void) | undefined;
49
+ } | undefined;
50
+ dev_restore_atoms: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>) => void;
51
+ }>;
52
+ export declare const CurdViewView: (props: {
53
+ idOrName: string;
54
+ } & PropsWithChildren) => import("react").JSX.Element;
55
+ export declare function useCurdView(): {
56
+ curdView: CurdView;
57
+ openShow: (id: string) => void;
58
+ invalidateList: () => Promise<void>;
59
+ invalidateGet: () => Promise<void>;
60
+ activateId: string;
61
+ setActivateId: (args_0: string | ((prev: string) => string)) => void;
62
+ editLink: (id: string) => string;
63
+ createLink: string;
64
+ showLink: (id: string) => string;
65
+ };
@@ -0,0 +1,128 @@
1
+ "use client";
2
+ var __async = (__this, __arguments, generator) => {
3
+ return new Promise((resolve, reject) => {
4
+ var fulfilled = (value) => {
5
+ try {
6
+ step(generator.next(value));
7
+ } catch (e) {
8
+ reject(e);
9
+ }
10
+ };
11
+ var rejected = (value) => {
12
+ try {
13
+ step(generator.throw(value));
14
+ } catch (e) {
15
+ reject(e);
16
+ }
17
+ };
18
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
19
+ step((generator = generator.apply(__this, __arguments)).next());
20
+ });
21
+ };
22
+ import { Fragment, jsx } from "react/jsx-runtime";
23
+ import { useQueryClient } from "@tanstack/react-query";
24
+ import { useSuspenseQuery } from "gomtm/connectquery";
25
+ import { curdViewGet } from "gomtm/gomtmpb/mtm/sppb/mtm-MtmService_connectquery";
26
+ import { createInfiniteQueryKey, createQueryKey } from "gomtm/mtmquery";
27
+ import { atom, createStore, useAtom } from "jotai";
28
+ import { useMtRouter } from "mtxuilib/hooks/use-router";
29
+ import { usePathname } from "next/navigation";
30
+ import { compile, match } from "path-to-regexp";
31
+ import { useCallback, useMemo } from "react";
32
+ const activateIdAtom = atom("0");
33
+ const curdViewAtom = atom(null);
34
+ const curdViewIdAtom = atom("");
35
+ const curdStore = createStore();
36
+ const CurdViewView = (props) => {
37
+ const { idOrName, children } = props;
38
+ useMemo(() => {
39
+ curdStore.set(curdViewIdAtom, idOrName);
40
+ }, [idOrName]);
41
+ return /* @__PURE__ */ jsx(Fragment, { children });
42
+ };
43
+ function useCurdView() {
44
+ const pathName = usePathname();
45
+ const [activateId, setActivateId] = useAtom(activateIdAtom, { store: curdStore });
46
+ const [curdViewId, setCurdViewId] = useAtom(curdViewIdAtom, { store: curdStore });
47
+ const router = useMtRouter();
48
+ const queryClient = useQueryClient();
49
+ const query = useSuspenseQuery(curdViewGet, { id: curdViewId });
50
+ const curdView = useMemo(() => {
51
+ var _a, _b;
52
+ return (_b = (_a = query.data) == null ? void 0 : _a.item) == null ? void 0 : _b.value;
53
+ }, [query.data]);
54
+ const showLink = useCallback((id) => {
55
+ if (curdView == null ? void 0 : curdView.routeShow) {
56
+ const toPath = compile(curdView == null ? void 0 : curdView.routeShow, { encode: encodeURIComponent });
57
+ return toPath({ id });
58
+ }
59
+ return "";
60
+ }, [curdView == null ? void 0 : curdView.routeShow]);
61
+ const openShow = useCallback((id) => {
62
+ if (showLink) {
63
+ router.push(showLink(id));
64
+ }
65
+ }, [router, showLink]);
66
+ const invalidateList = useCallback(() => __async(this, null, function* () {
67
+ if (curdView) {
68
+ yield queryClient.invalidateQueries({
69
+ queryKey: createInfiniteQueryKey(curdView.svcName, curdView.methodList)
70
+ });
71
+ }
72
+ }), [curdView, queryClient]);
73
+ const invalidateGet = useCallback(() => __async(this, null, function* () {
74
+ if (curdView) {
75
+ yield queryClient.invalidateQueries({
76
+ queryKey: createQueryKey(curdView.svcName, curdView.methodGet)
77
+ });
78
+ }
79
+ }), [curdView, queryClient]);
80
+ const editLink = useCallback((id) => {
81
+ if (curdView == null ? void 0 : curdView.routeEdit) {
82
+ const toPath = compile(curdView == null ? void 0 : curdView.routeEdit, { encode: encodeURIComponent });
83
+ return toPath({ id });
84
+ }
85
+ return "";
86
+ }, [curdView == null ? void 0 : curdView.routeEdit]);
87
+ const createLink = useMemo(() => {
88
+ if (curdView == null ? void 0 : curdView.routeCreate) {
89
+ return (curdView == null ? void 0 : curdView.routeCreate) || "";
90
+ }
91
+ return "";
92
+ }, [curdView == null ? void 0 : curdView.routeCreate]);
93
+ useMemo(() => {
94
+ if (curdView == null ? void 0 : curdView.routeShow) {
95
+ const show = match(curdView.routeShow)(pathName);
96
+ if (show) {
97
+ setActivateId(show.params["id"]);
98
+ }
99
+ } else if (curdView == null ? void 0 : curdView.routeEdit) {
100
+ const matchEditObj = match(curdView.routeShow)(pathName);
101
+ if (matchEditObj) {
102
+ setActivateId(matchEditObj.params["id"]);
103
+ }
104
+ }
105
+ }, [curdView == null ? void 0 : curdView.routeEdit, curdView == null ? void 0 : curdView.routeShow, pathName, setActivateId]);
106
+ return {
107
+ curdView,
108
+ // canEdit,
109
+ // canCreate,
110
+ // canDelete,
111
+ openShow,
112
+ invalidateList,
113
+ invalidateGet,
114
+ activateId,
115
+ setActivateId,
116
+ editLink,
117
+ createLink,
118
+ showLink
119
+ };
120
+ }
121
+ export {
122
+ CurdViewView,
123
+ activateIdAtom,
124
+ curdStore,
125
+ curdViewAtom,
126
+ curdViewIdAtom,
127
+ useCurdView
128
+ };
@@ -0,0 +1,3 @@
1
+ import { PropsWithChildren } from "react";
2
+ export declare function CurdViewShow<T>(props: PropsWithChildren): import("react").JSX.Element | null;
3
+ export declare const DetailViewActions: () => import("react").JSX.Element;
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useAtom } from "jotai";
4
+ import { useSearchParams } from "next/navigation";
5
+ import { createContext, useMemo, useState } from "react";
6
+ import { Icons } from "mtxuilib/icons/icons";
7
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
8
+ import { MtButton } from "mtxuilib/ui/ui-mt/Button";
9
+ import { activateIdAtom, useCurdView } from "./CurdViewView";
10
+ const curdDetailViewContext = createContext(void 0);
11
+ function CurdViewDetailProvider(props) {
12
+ const [isOpenEdit, setIsOpenEdit] = useState(false);
13
+ return /* @__PURE__ */ jsx(curdDetailViewContext.Provider, { value: {
14
+ isOpenEdit,
15
+ setIsOpenEdit
16
+ }, children: props.children });
17
+ }
18
+ function CurdViewShow(props) {
19
+ const { children } = props;
20
+ const [activateId, setActivateId] = useAtom(activateIdAtom);
21
+ const search = useSearchParams();
22
+ useMemo(() => {
23
+ const id = search.get("id");
24
+ if (id) {
25
+ setActivateId(id);
26
+ }
27
+ }, [search, setActivateId]);
28
+ if (!activateId) {
29
+ return null;
30
+ }
31
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(CurdViewDetailProvider, {}) });
32
+ }
33
+ const DetailViewActions = () => {
34
+ const curd = useCurdView();
35
+ return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
36
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(MtButton, { variant: "ghost", className: "m-0 flex h-10 w-10 items-center justify-center border p-0 shadow-sm backdrop-blur", children: /* @__PURE__ */ jsx(Icons.ellipsis, {}) }) }),
37
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56", children: [
38
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Edit" }),
39
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
40
+ /* @__PURE__ */ jsx(DropdownMenuGroup, {}),
41
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {})
42
+ ] })
43
+ ] });
44
+ };
45
+ export {
46
+ CurdViewShow,
47
+ DetailViewActions
48
+ };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const CurdEditButton: () => import("react").JSX.Element;
3
+ export declare const CurdCreateButton: () => import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { Fragment, jsx } from "react/jsx-runtime";
3
+ import { MtLink } from "mtxuilib/common/mtlink";
4
+ import { useCurdView } from "./CurdViewView";
5
+ const CurdEditButton = () => {
6
+ const curd = useCurdView();
7
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(MtLink, { variant: "ghost", href: curd.editLink(curd.activateId), children: "edit" }) });
8
+ };
9
+ const CurdCreateButton = () => {
10
+ const curd = useCurdView();
11
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(MtLink, { variant: "ghost", href: curd.createLink, children: "new" }) });
12
+ };
13
+ export {
14
+ CurdCreateButton,
15
+ CurdEditButton
16
+ };
@@ -0,0 +1,2 @@
1
+ import { PropsWithChildren } from "react";
2
+ export declare function GomtmAppSS(props: {} & PropsWithChildren): Promise<import("react").JSX.Element>;
@@ -0,0 +1,48 @@
1
+ var __async = (__this, __arguments, generator) => {
2
+ return new Promise((resolve, reject) => {
3
+ var fulfilled = (value) => {
4
+ try {
5
+ step(generator.next(value));
6
+ } catch (e) {
7
+ reject(e);
8
+ }
9
+ };
10
+ var rejected = (value) => {
11
+ try {
12
+ step(generator.throw(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ };
17
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
+ step((generator = generator.apply(__this, __arguments)).next());
19
+ });
20
+ };
21
+ import { Fragment, jsx } from "react/jsx-runtime";
22
+ import { ExtKey_Hostname, ExtKey_SelfBackend, ExtKey_mtmaccessToken, ExtKey_mtmbackend } from "gomtm/consts";
23
+ import { ExtinfoSS } from "gomtm/sscore";
24
+ import { GomtmProvider } from "./GomtmProvider";
25
+ function GomtmAppSS(props) {
26
+ return __async(this, null, function* () {
27
+ const { children } = props;
28
+ const backend = ExtinfoSS(ExtKey_Hostname);
29
+ if (!backend) {
30
+ return /* @__PURE__ */ jsx(Fragment, { children: "missing backend" });
31
+ }
32
+ return /* @__PURE__ */ jsx(
33
+ GomtmProvider,
34
+ {
35
+ initExtKv: {
36
+ [ExtKey_Hostname]: ExtinfoSS(ExtKey_Hostname),
37
+ [ExtKey_mtmaccessToken]: ExtinfoSS(ExtKey_mtmaccessToken),
38
+ [ExtKey_mtmbackend]: ExtinfoSS(ExtKey_mtmbackend),
39
+ [ExtKey_SelfBackend]: ExtinfoSS(ExtKey_SelfBackend)
40
+ },
41
+ children
42
+ }
43
+ );
44
+ });
45
+ }
46
+ export {
47
+ GomtmAppSS
48
+ };
@@ -2,7 +2,7 @@
2
2
  import { Fragment, jsx } from "react/jsx-runtime";
3
3
  import { createContext, useCallback, useContext, useMemo, useState } from "react";
4
4
  import { createStore } from "jotai";
5
- import { getCookie } from "../clientlib";
5
+ import { getCookie } from "mtxlib/clientlib";
6
6
  import { ExtKey_Hostname, ExtKey_SelfBackend, ExtKey_mtmaccessToken, ExtKey_mtmbackend, MtM_TOKEN_NAME } from "../consts";
7
7
  import { MtConnectProvider } from "./MtConnectProvider";
8
8
  import { MtReactQueryProvider } from "./ReactQueryProvider";
package/dist/gomtm ADDED
Binary file