mtxuilib 0.0.486 → 0.0.488

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.
@@ -14,6 +14,7 @@ export declare const curdStore: {
14
14
  get: <Value>(atom: import("jotai").Atom<Value>) => Value;
15
15
  set: <Value_1, Args extends unknown[], Result>(atom: import("jotai").WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
16
16
  sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
17
+ } & Partial<{
17
18
  dev_subscribe_store: (l: (action: {
18
19
  type: "write";
19
20
  flushed: Set<import("jotai").Atom<unknown>>;
@@ -47,16 +48,7 @@ export declare const curdStore: {
47
48
  u?: (() => void) | undefined;
48
49
  } | undefined;
49
50
  dev_restore_atoms: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>) => void;
50
- } | {
51
- get: <Value_2>(atom: import("jotai").Atom<Value_2>) => Value_2;
52
- 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;
53
- sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
54
- dev_subscribe_store?: undefined;
55
- dev_get_mounted_atoms?: undefined;
56
- dev_get_atom_state?: undefined;
57
- dev_get_mounted?: undefined;
58
- dev_restore_atoms?: undefined;
59
- };
51
+ }>;
60
52
  export declare const CurdViewView: (props: {
61
53
  idOrName: string;
62
54
  } & PropsWithChildren) => import("react").JSX.Element;
@@ -0,0 +1,31 @@
1
+ export declare const exampleValue100Atom: import("jotai").PrimitiveAtom<number> & {
2
+ init: number;
3
+ };
4
+ export declare const doublerAtom: import("jotai").PrimitiveAtom<{
5
+ callback: (n: number) => number;
6
+ }> & {
7
+ init: {
8
+ callback: (n: number) => number;
9
+ };
10
+ };
11
+ export declare const demo1Atom: import("jotai").WritableAtom<(get: <Value>(atom: import("jotai").Atom<Value>) => Value, set: {
12
+ readonly signal: AbortSignal;
13
+ readonly setSelf: <A extends unknown[]>(...args: A) => unknown;
14
+ }) => {
15
+ getValue1: () => number;
16
+ }, [value: number], {
17
+ set1: (value: number) => void;
18
+ }> & {
19
+ init: (get: <Value>(atom: import("jotai").Atom<Value>) => Value, set: {
20
+ readonly signal: AbortSignal;
21
+ readonly setSelf: <A extends unknown[]>(...args: A) => unknown;
22
+ }) => {
23
+ getValue1: () => number;
24
+ };
25
+ };
26
+ export declare const example102Atom: import("jotai").PrimitiveAtom<string> & {
27
+ init: string;
28
+ };
29
+ export declare const fetchPosts: (url: string) => Promise<unknown>;
30
+ export declare const exampleAsyncExampleAtom2: import("jotai").WritableAtom<any, [value: any], void>;
31
+ export declare const cached101Atom: import("jotai").Atom<Promise<unknown>>;
@@ -0,0 +1 @@
1
+ "use client";var c=(e,t,o)=>new Promise((p,u)=>{var x=s=>{try{a(o.next(s))}catch(l){u(l)}},i=s=>{try{a(o.throw(s))}catch(l){u(l)}},a=s=>s.done?p(s.value):Promise.resolve(s.value).then(x,i);a((o=o.apply(e,t)).next())});import{atom as n}from"jotai";import{atomWithCache as A}from"jotai-cache";const m=n(1),b=n({callback:e=>e*2}),g=n((e,t)=>({getValue1:()=>e(m)}),(e,t,o)=>(t(m,o),{set1:p=>{console.log("set1 called"),t(m,10)}})),v=n("valueexample102Atom "),w=e=>c(void 0,null,function*(){return yield(yield fetch(e,{next:{revalidate:0}})).json()}),r=n(null),V=n(e=>{if(e(r))return console.log("return atom value",e(r)),e(r)},(e,t,o)=>{console.log("exampleAsyncExampleAtom2 set",o),t(r,o)}),d=n("1"),j=A(e=>c(void 0,null,function*(){const t=e(d);return(yield fetch(`https://reqres.in/api/users/${t}?delay=1`,{next:{revalidate:0}})).json()}));export{j as cached101Atom,g as demo1Atom,b as doublerAtom,v as example102Atom,V as exampleAsyncExampleAtom2,m as exampleValue100Atom,w as fetchPosts};
@@ -0,0 +1,5 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export declare const AtomMain: () => import("react").JSX.Element;
3
+ export declare const CacheAtom1Example: () => import("react").JSX.Element;
4
+ export declare const ReactUseExample: () => import("react").JSX.Element;
5
+ export declare const HydratePosts: (props: PropsWithChildren) => import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use client";var u=(e,s,o)=>new Promise((n,p)=>{var i=a=>{try{l(o.next(a))}catch(d){p(d)}},c=a=>{try{l(o.throw(a))}catch(d){p(d)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(i,c);l((o=o.apply(e,s)).next())});import{Fragment as A,jsx as t,jsxs as m}from"react/jsx-runtime";import{useAtom as r}from"jotai";import{useHydrateAtoms as f}from"jotai/utils";import{Suspense as b,use as x}from"react";import{AtomsHydrator as v}from"../../lib/jotai-helper";import{MtButton as g}from"../../ui/ui-mt/Button";import{cached101Atom as E,demo1Atom as C,doublerAtom as H,example102Atom as y,exampleAsyncExampleAtom2 as N,exampleValue100Atom as S}from"./AtomExample1.atom";import{ExampleAsync1 as V}from"./ExampleAsync";const D=()=>{const[e]=r(H),s=e.callback(50),[o,n]=r(C),[p,i]=r(S);f([[y,"example102(hydratedValue)---"]]);const[c,l]=r(y);return m(A,{children:[m("div",{className:"bg-blue-100 p-2",children:["example102Atom:",c]}),m("div",{children:[t(g,{onClick:()=>{n(100)},children:"set1"}),t("pre",{children:JSON.stringify(o,null,2)})]}),t(b,{fallback:t(A,{children:"loading HydratePosts "}),children:t(P,{children:t(V,{})})})]})},L=()=>{const[e,s]=r(E);return m("div",{className:"bg-blue-300 p-2",children:["CacheAtom1Example",t("pre",{children:JSON.stringify(e,null,2)})]})},h=()=>u(void 0,null,function*(){return yield fetch(new URL("/api.v1/demo/posts","http://localhost:3338").toString()).then(e=>e.json())}),j=()=>{const e=x(h());return m("div",{className:"max-h-96 overflow-scroll bg-red-200 p-2",children:["react use data:",t("pre",{children:JSON.stringify(e,null,2)})]})},P=e=>{const s=x(h()),{children:o}=e;return t(v,{atomValues:[[N,s]],children:o})};export{D as AtomMain,L as CacheAtom1Example,P as HydratePosts,j as ReactUseExample};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const ExampleAsync1: () => import("react").JSX.Element;
3
+ export declare const ExampleAsync1Inner: () => import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use client";import{jsx as e}from"react/jsx-runtime";import{useAtom as m}from"jotai";import{exampleAsyncExampleAtom2 as l}from"./AtomExample1.atom";const c=()=>e("div",{className:"max-h-96 overflow-scroll border bg-red-200 p-2",children:e(s,{})}),s=()=>{const[r,t]=m(l);return e("div",{className:"border bg-red-200 p-2",children:r==null?void 0:r.map((n,o)=>e("li",{children:n.title},o))})};export{c as ExampleAsync1,s as ExampleAsync1Inner};
@@ -1 +1 @@
1
- "use client";var c=(i,a,o)=>new Promise((d,r)=>{var n=e=>{try{s(o.next(e))}catch(t){r(t)}},m=e=>{try{s(o.throw(e))}catch(t){r(t)}},s=e=>e.done?d(e.value):Promise.resolve(e.value).then(n,m);s((o=o.apply(i,a)).next())});import{Fragment as g,jsx as l,jsxs as u}from"react/jsx-runtime";import{useSuspenseQuery as y}from"@tanstack/react-query";import{MtUnaryCallErrorView as E}from"../../components/MtUnaryCallErrorView";import{fakeFetchUser as p}from"./lib";const f=(i,a)=>c(void 0,null,function*(){try{return{code:"",data:yield p(i,!a)}}catch(o){return{error_code:"some_error_code",error_message:"error message"}}});function I(i){var n,m,s,e,t;const{userId:a,randomError:o,isHardError:d}=i,r=y({queryKey:["userId",a],queryFn:()=>c(this,null,function*(){if(d)throw console.log("isHardError",d),new Error("isHardError=true");return f(a,o)})});return r.error?u("div",{children:["query error:",JSON.stringify(r.error)]}):u("div",{className:"border-spacing-1 border p-2",children:[u("div",{className:"bg-slate-200",children:["userId:",a,",randomError:",o,",isHardError:",d]}),r.data&&((n=r.data)!=null&&n.error_code)?l(g,{children:l(E,{unaryError:r.data})}):u("pre",{children:[(s=(m=r.data)==null?void 0:m.data)==null?void 0:s.id,",",JSON.stringify((t=(e=r.data)==null?void 0:e.data)==null?void 0:t.id,null,2)]})]})}export{I as DemoUserDetail};
1
+ "use client";var c=(i,a,o)=>new Promise((d,r)=>{var n=e=>{try{s(o.next(e))}catch(t){r(t)}},m=e=>{try{s(o.throw(e))}catch(t){r(t)}},s=e=>e.done?d(e.value):Promise.resolve(e.value).then(n,m);s((o=o.apply(i,a)).next())});import{Fragment as g,jsx as l,jsxs as u}from"react/jsx-runtime";import{useSuspenseQuery as y}from"@tanstack/react-query";import{MtUnaryCallErrorView as E}from"../../components/MtUnaryCallErrorView";import{fakeFetchUser as p}from"../lib";const f=(i,a)=>c(void 0,null,function*(){try{return{code:"",data:yield p(i,!a)}}catch(o){return{error_code:"some_error_code",error_message:"error message"}}});function I(i){var n,m,s,e,t;const{userId:a,randomError:o,isHardError:d}=i,r=y({queryKey:["userId",a],queryFn:()=>c(this,null,function*(){if(d)throw console.log("isHardError",d),new Error("isHardError=true");return f(a,o)})});return r.error?u("div",{children:["query error:",JSON.stringify(r.error)]}):u("div",{className:"border-spacing-1 border p-2",children:[u("div",{className:"bg-slate-200",children:["userId:",a,",randomError:",o,",isHardError:",d]}),r.data&&((n=r.data)!=null&&n.error_code)?l(g,{children:l(E,{unaryError:r.data})}):u("pre",{children:[(s=(m=r.data)==null?void 0:m.data)==null?void 0:s.id,",",JSON.stringify((t=(e=r.data)==null?void 0:e.data)==null?void 0:t.id,null,2)]})]})}export{I as DemoUserDetail};
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as i}from"react/jsx-runtime";import{useSuspenseQuery as s}from"@tanstack/react-query";import{fetchPost as d}from"./lib";const n=o=>{const{postId:t}=o,r=s({queryKey:["examples","post",t],queryFn:()=>d(t)});return r.data?r.error?e("div",{children:"post error"}):e("div",{className:"prose dark:prose-invert m-4 border p-2 shadow-md",children:i("div",{children:[e("h2",{children:r.data.title}),e("article",{children:r.data.body})]})}):null};export{n as ExamplePostDetail};
1
+ "use client";import{jsx as e,jsxs as i}from"react/jsx-runtime";import{useSuspenseQuery as s}from"@tanstack/react-query";import{fetchPost as d}from"../lib";const n=o=>{const{postId:t}=o,r=s({queryKey:["examples","post",t],queryFn:()=>d(t)});return r.data?r.error?e("div",{children:"post error"}):e("div",{className:"prose dark:prose-invert m-4 border p-2 shadow-md",children:i("div",{children:[e("h2",{children:r.data.title}),e("article",{children:r.data.body})]})}):null};export{n as ExamplePostDetail};
@@ -1 +1 @@
1
- "use client";import{Fragment as d,jsx as e,jsxs as a}from"react/jsx-runtime";import{useSuspenseQuery as i}from"@tanstack/react-query";import m from"next/link";import{fetchPosts as s}from"./lib";import{MtLink as n}from"../../common/mtlink";const y=()=>{var o;const t=i({queryKey:["examples","posts"],queryFn:()=>s()});return a(d,{children:[e("h2",{children:" examples posts "}),e(n,{variant:"ghost",href:"/demo/hydrate-demo",children:"to post list"}),e("div",{children:(o=t==null?void 0:t.data)==null?void 0:o.map(r=>e("li",{children:e(m,{href:`/demo/hydrate-demo/${r.id}`,children:r.title})},r.id))})]})};export{y as ExamplePosts};
1
+ "use client";import{Fragment as d,jsx as e,jsxs as a}from"react/jsx-runtime";import{useSuspenseQuery as i}from"@tanstack/react-query";import m from"next/link";import{MtLink as s}from"../../common/mtlink";import{fetchPosts as n}from"../lib";const y=()=>{var o;const t=i({queryKey:["examples","posts"],queryFn:()=>n()});return a(d,{children:[e("h2",{children:" examples posts "}),e(s,{variant:"ghost",href:"/demo/hydrate-demo",children:"to post list"}),e("div",{children:(o=t==null?void 0:t.data)==null?void 0:o.map(r=>e("li",{children:e(m,{href:`/demo/hydrate-demo/${r.id}`,children:r.title})},r.id))})]})};export{y as ExamplePosts};
@@ -20,6 +20,7 @@ export declare const mailLayoutStore: {
20
20
  get: <Value>(atom: import("jotai").Atom<Value>) => Value;
21
21
  set: <Value_1, Args extends unknown[], Result>(atom: import("jotai").WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
22
22
  sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
23
+ } & Partial<{
23
24
  dev_subscribe_store: (l: (action: {
24
25
  type: "write";
25
26
  flushed: Set<import("jotai").Atom<unknown>>;
@@ -53,16 +54,7 @@ export declare const mailLayoutStore: {
53
54
  u?: (() => void) | undefined;
54
55
  } | undefined;
55
56
  dev_restore_atoms: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>) => void;
56
- } | {
57
- get: <Value_2>(atom: import("jotai").Atom<Value_2>) => Value_2;
58
- 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;
59
- sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
60
- dev_subscribe_store?: undefined;
61
- dev_get_mounted_atoms?: undefined;
62
- dev_get_atom_state?: undefined;
63
- dev_get_mounted?: undefined;
64
- dev_restore_atoms?: undefined;
65
- };
57
+ }>;
66
58
  export declare const MailLayout: (props: {} & PropsWithChildren) => import("react").JSX.Element;
67
59
  export declare const MailLayoutSidenav: (props: PropsWithChildren) => import("react").JSX.Element;
68
60
  export declare const MailLayoutList: (props: PropsWithChildren) => import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare const appBackendUrlAtom: import("jotai").PrimitiveAtom<string> & {
2
+ init: string;
3
+ };
@@ -0,0 +1 @@
1
+ "use client";import{atom as t}from"jotai";const p=t("http://localhost:3338");export{p as appBackendUrlAtom};
@@ -2,6 +2,7 @@ export declare const novelStore: {
2
2
  get: <Value>(atom: import("jotai").Atom<Value>) => Value;
3
3
  set: <Value_1, Args extends unknown[], Result>(atom: import("jotai").WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
4
4
  sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
5
+ } & Partial<{
5
6
  dev_subscribe_store: (l: (action: {
6
7
  type: "write";
7
8
  flushed: Set<import("jotai").Atom<unknown>>;
@@ -35,13 +36,4 @@ export declare const novelStore: {
35
36
  u?: (() => void) | undefined;
36
37
  } | undefined;
37
38
  dev_restore_atoms: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>) => void;
38
- } | {
39
- get: <Value_2>(atom: import("jotai").Atom<Value_2>) => Value_2;
40
- 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;
41
- sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
42
- dev_subscribe_store?: undefined;
43
- dev_get_mounted_atoms?: undefined;
44
- dev_get_atom_state?: undefined;
45
- dev_get_mounted?: undefined;
46
- dev_restore_atoms?: undefined;
47
- };
39
+ }>;