mtxuilib 0.0.475 → 0.0.476
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.
- package/dist/esm/lib/trpc/TrpcAppProvider.d.ts +71 -0
- package/dist/esm/lib/trpc/TrpcAppProvider.js +1 -0
- package/dist/esm/lib/trpc/hydrateCore.d.ts +2 -0
- package/dist/esm/lib/trpc/hydrateCore.js +1 -0
- package/dist/esm/list-view/ListViewShell.d.ts +2 -0
- package/dist/esm/list-view/ListViewShell.js +1 -0
- package/dist/esm/list-view/SimpleListView.d.ts +35 -0
- package/dist/esm/list-view/SimpleListView.js +1 -0
- package/dist/tsconfig.type.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export declare const mtmAppStore: {
|
|
3
|
+
get: <Value>(atom: import("jotai").Atom<Value>) => Value;
|
|
4
|
+
set: <Value_1, Args extends unknown[], Result>(atom: import("jotai").WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
|
|
5
|
+
sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
|
|
6
|
+
dev_subscribe_store: (l: (action: {
|
|
7
|
+
type: "write";
|
|
8
|
+
flushed: Set<import("jotai").Atom<unknown>>;
|
|
9
|
+
} | {
|
|
10
|
+
type: "async-write";
|
|
11
|
+
flushed: Set<import("jotai").Atom<unknown>>;
|
|
12
|
+
} | {
|
|
13
|
+
type: "sub";
|
|
14
|
+
flushed: Set<import("jotai").Atom<unknown>>;
|
|
15
|
+
} | {
|
|
16
|
+
type: "unsub";
|
|
17
|
+
} | {
|
|
18
|
+
type: "restore";
|
|
19
|
+
flushed: Set<import("jotai").Atom<unknown>>;
|
|
20
|
+
}) => void, rev: 2) => () => void;
|
|
21
|
+
dev_get_mounted_atoms: () => IterableIterator<import("jotai").Atom<unknown>>;
|
|
22
|
+
dev_get_atom_state: (a: import("jotai").Atom<unknown>) => ({
|
|
23
|
+
d: Map<import("jotai").Atom<unknown>, any & ({
|
|
24
|
+
e: unknown;
|
|
25
|
+
} | {
|
|
26
|
+
v: unknown;
|
|
27
|
+
})>;
|
|
28
|
+
} & ({
|
|
29
|
+
e: unknown;
|
|
30
|
+
} | {
|
|
31
|
+
v: unknown;
|
|
32
|
+
})) | undefined;
|
|
33
|
+
dev_get_mounted: (a: import("jotai").Atom<unknown>) => {
|
|
34
|
+
l: Set<() => void>;
|
|
35
|
+
t: Set<import("jotai").Atom<unknown>>;
|
|
36
|
+
u?: (() => void) | undefined;
|
|
37
|
+
} | undefined;
|
|
38
|
+
dev_restore_atoms: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>) => void;
|
|
39
|
+
} | {
|
|
40
|
+
get: <Value_2>(atom: import("jotai").Atom<Value_2>) => Value_2;
|
|
41
|
+
set: <Value_1_1, Args_1 extends unknown[], Result_1>(atom: import("jotai").WritableAtom<Value_1_1, Args_1, Result_1>, ...args: Args_1) => Result_1;
|
|
42
|
+
sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
|
|
43
|
+
dev_subscribe_store?: undefined;
|
|
44
|
+
dev_get_mounted_atoms?: undefined;
|
|
45
|
+
dev_get_atom_state?: undefined;
|
|
46
|
+
dev_get_mounted?: undefined;
|
|
47
|
+
dev_restore_atoms?: undefined;
|
|
48
|
+
};
|
|
49
|
+
export type ActionHandler = (props: {
|
|
50
|
+
action: string;
|
|
51
|
+
values?: any;
|
|
52
|
+
}) => void;
|
|
53
|
+
interface IAppContext {
|
|
54
|
+
extKv: Record<string, any>;
|
|
55
|
+
token?: string | null;
|
|
56
|
+
hostname?: string | null;
|
|
57
|
+
backendUrl?: string | null;
|
|
58
|
+
trpcBackendUrl?: string | null;
|
|
59
|
+
}
|
|
60
|
+
export declare function TrpcAppProvider(props: {
|
|
61
|
+
initExtKv: Record<string, any | undefined>;
|
|
62
|
+
} & PropsWithChildren): import("react").JSX.Element;
|
|
63
|
+
export declare function useTrpcApp(): IAppContext;
|
|
64
|
+
export declare const useMtmBackendUrl: () => string | null | undefined;
|
|
65
|
+
export declare const useHostname: () => string;
|
|
66
|
+
export declare const useExtInfo: () => (key: string) => string | null | undefined;
|
|
67
|
+
export declare const useToken: () => {
|
|
68
|
+
token: string;
|
|
69
|
+
setToken: (newToken: string) => void;
|
|
70
|
+
};
|
|
71
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as s}from"react/jsx-runtime";import{createContext as k,useCallback as v,useContext as h,useMemo as o,useState as C}from"react";import{getCookie as w}from"gomtm/clientlib";import{ExtKey_Hostname as p,ExtKey_SelfBackend as u,ExtKey_mtmaccessToken as d,ExtKey_mtmbackend as a,MtM_TOKEN_NAME as l}from"gomtm/consts";import{MtConnectProvider as y}from"gomtm/providers/MtConnectProvider";import{MtReactQueryProvider as P}from"gomtm/providers/ReactQueryProvider";import{Provider as A,createStore as E}from"jotai";const g=E(),m=k(void 0);function S(t){const{children:n,initExtKv:e}=t,c=o(()=>e[u],[e]),r=o(()=>e[a],[e]),f=o(()=>e[p],[e]),x=o(()=>e[d],[e]);return s(A,{store:g,children:s(m.Provider,{value:{extKv:e,token:x,hostname:f,backendUrl:r,trpcBackendUrl:c},children:s(y,{children:s(P,{children:n})})})})}function i(){const t=h(m);if(t===void 0)throw new Error("useTrpcApp must be used within a TrpcAppProvider");return t}const K=()=>{const{backendUrl:t}=i();return t},M=()=>{const{hostname:t}=i();return t||window.location.host},I=()=>{const t=K(),n=M(),{token:e}=i();return v(r=>{switch(r){case a:return t;case p:return n;case d:return e;case u:return;default:throw new Error(`extinfo key error: ${r}`)}},[t,n,e])},$=()=>{const[t]=C(typeof window!="undefined"?w(l):"");return{token:t||"",setToken:n=>{typeof window!="undefined"&&(document.cookie=`${l}=${n}`)}}};export{S as TrpcAppProvider,g as mtmAppStore,I as useExtInfo,M as useHostname,K as useMtmBackendUrl,$ as useToken,i as useTrpcApp};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=(t,i,o)=>new Promise((n,d)=>{var y=e=>{try{m(o.next(e))}catch(c){d(c)}},E=e=>{try{m(o.throw(e))}catch(c){d(c)}},m=e=>e.done?n(e.value):Promise.resolve(e.value).then(y,E);m((o=o.apply(t,i)).next())});import{Fragment as _,jsx as x}from"react/jsx-runtime";import{ExtKey_Hostname as p,ExtKey_SelfBackend as f,ExtKey_mtmaccessToken as s,ExtKey_mtmbackend as k}from"gomtm/consts";import{ExtinfoSS as r}from"gomtm/sscore";import{headers as h}from"next/headers";import{ExtKey_CookieHeadValue as l}from"../../consts";import{TrpcAppProvider as K}from"./TrpcAppProvider";function C(t){return a(this,null,function*(){const{children:i}=t;if(!r(p))return x(_,{children:"missing backend"});const n=h().get("Cookie");return x(K,{initExtKv:{[p]:r(p),[s]:r(s),[k]:r(k),[f]:r(f),[l]:n},children:i})})}export{C as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Separator as r}from"@radix-ui/react-separator";import{Tabs as i,TabsContent as n,TabsList as o,TabsTrigger as s}from"../ui/tabs";const b=t=>{const{children:l}=t;return a(i,{defaultValue:"all",children:[a("div",{className:"flex items-center px-4 py-2",children:[e("h1",{className:"text-xl font-bold",children:"users"}),a(o,{className:"ml-auto",children:[e(s,{value:"all",className:"text-zinc-600 dark:text-zinc-200",children:"All"}),e(s,{value:"unread",className:"text-zinc-600 dark:text-zinc-200",children:"Unread"})]})]}),e(r,{}),e(n,{value:"all",className:"m-0",children:l})]})};export{b as ListViewShell};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { InfiniteData } from "@tanstack/react-query";
|
|
3
|
+
import { DecoratedQuery } from "@trpc/react-query/dist/createTRPCReact";
|
|
4
|
+
import { DefaultErrorShape } from "@trpc/server/unstable-core-do-not-import";
|
|
5
|
+
interface ListItem extends Record<string, any> {
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
interface InfiniteDef<T> {
|
|
9
|
+
input: {
|
|
10
|
+
limit?: number | null | undefined;
|
|
11
|
+
cursor?: string | null | undefined;
|
|
12
|
+
q?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
output: {
|
|
15
|
+
items: T[];
|
|
16
|
+
nextCursor: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
transformer: true;
|
|
19
|
+
errorShape: DefaultErrorShape;
|
|
20
|
+
}
|
|
21
|
+
export declare function SimpleListViewQuery<T extends ListItem>(props: {
|
|
22
|
+
listq: DecoratedQuery<InfiniteDef<T>>;
|
|
23
|
+
itemRender: (props: {
|
|
24
|
+
item: T;
|
|
25
|
+
}) => JSX.Element;
|
|
26
|
+
}): import("react").JSX.Element;
|
|
27
|
+
export declare function SimpleListView<T extends ListItem>(props: {
|
|
28
|
+
data: InfiniteData<{
|
|
29
|
+
items: T[];
|
|
30
|
+
}, any>;
|
|
31
|
+
itemRender: (props: {
|
|
32
|
+
item: T;
|
|
33
|
+
}) => JSX.Element;
|
|
34
|
+
}): import("react").JSX.Element;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{Fragment as u,jsx as r}from"react/jsx-runtime";function S(t){const{listq:i,itemRender:n}=t,[m,s]=i.useSuspenseInfiniteQuery({limit:30},{getNextPageParam:e=>e.nextCursor});return r(a,{data:s.data,itemRender:n})}function a(t){const{data:i,itemRender:n}=t;return r(u,{children:i.pages.map((m,s)=>m.items.map((e,o)=>r(n,{item:e},e.id)))})}export{a as SimpleListView,S as SimpleListViewQuery};
|