mtxuilib 0.0.486 → 0.0.487

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,29 @@
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 exampleAsyncExampleAtom: import("jotai").Atom<Promise<unknown>>;
@@ -0,0 +1 @@
1
+ "use client";var p=(e,o,t)=>new Promise((c,m)=>{var x=l=>{try{r(t.next(l))}catch(s){m(s)}},A=l=>{try{r(t.throw(l))}catch(s){m(s)}},r=l=>l.done?c(l.value):Promise.resolve(l.value).then(x,A);r((t=t.apply(e,o)).next())});import{atom as n}from"jotai";const a=n(1),b=n({callback:e=>e*2}),h=n((e,o)=>({getValue1:()=>e(a)}),(e,o,t)=>(o(a,t),{set1:c=>{console.log("set1 called"),o(a,10)}})),f=n("valueexample102Atom "),u=n("https://jsonplaceholder.typicode.com/posts"),g=n(e=>p(void 0,null,function*(){const o=e(u);return console.log("to fetch url",o),yield(yield fetch(e(u),{next:{revalidate:0}})).json()}));export{h as demo1Atom,b as doublerAtom,f as example102Atom,g as exampleAsyncExampleAtom,a as exampleValue100Atom};
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const AtomMain: () => import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use client";import{Fragment as v,jsx as t,jsxs as e}from"react/jsx-runtime";import{useAtom as o}from"jotai";import{useHydrateAtoms as u}from"jotai/utils";import{MtButton as i}from"../../ui/ui-mt/Button";import{demo1Atom as n,doublerAtom as c,example102Atom as m,exampleValue100Atom as x}from"./AtomExample1.atom";import{ExampleAsync1 as A}from"./ExampleAsync";const k=()=>{const[l]=o(c),a=l.callback(50),[p,d]=o(n),[r,b]=o(x);u([[m,"example102(hydratedValue)---"]]);const[s,V]=o(m);return e(v,{children:[e("div",{className:"bg-blue-100 p-2",children:["example102Atom:",s]}),e("div",{children:["exampleValue100Atom: ",r]}),e("div",{children:["doubledValue: ",a]}),e("div",{children:[t(i,{onClick:()=>{d(100)},children:"set1"}),t("pre",{children:JSON.stringify(p,null,2)})]}),t(A,{})]})};export{k as AtomMain};
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const ExampleAsync1: () => import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use client";import{jsx as e}from"react/jsx-runtime";import{useAtom as p}from"jotai";import{exampleAsyncExampleAtom as l}from"./AtomExample1.atom";const n=()=>{const[m,r]=p(l);return e("div",{className:"border bg-red-200 p-2",children:e("pre",{children:JSON.stringify(m,null,2)})})};export{n as ExampleAsync1};
@@ -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};