@qwanyx/stack 0.2.39 → 0.2.40

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/index.cjs.js CHANGED
@@ -145,7 +145,7 @@ React keys must be passed directly to JSX without using spread:
145
145
  from { transform: rotate(0deg); }
146
146
  to { transform: rotate(360deg); }
147
147
  }
148
- `;return p.jsxs("div",{className:i,style:{border:`1px solid ${w.border}`,borderRadius:"8px",background:w.background,overflow:"hidden",display:"flex",flexDirection:"column",height:"100%",minHeight:l},children:[p.jsx("style",{children:xe}),y,p.jsxs(Pc,{initialConfig:se,children:[p.jsx(nf,{theme:w,disabled:o,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:N,aiProcessingAction:j,onAiAction:Y,hasContent:ce}),p.jsx("div",{style:{position:"relative",flex:1,display:"flex",flexDirection:"column"},children:p.jsx(_d,{contentEditable:p.jsx(Dd,{className:"mail-editor-content",style:{outline:"none",flex:1,minHeight:"100px",padding:"16px",fontSize:"14px",lineHeight:1.6,color:w.text}}),placeholder:p.jsx("div",{className:"mail-editor-placeholder",children:t}),ErrorBoundary:Md})}),p.jsx(Qd,{}),p.jsx(ef,{}),p.jsx(Ld,{}),p.jsx(Pd,{onChange:ie}),p.jsx(sf,{html:x?k:r,isExternalUpdate:x,onImportComplete:R}),p.jsx(of,{text:u,trigger:c})]}),n&&p.jsx(lf,{replyTo:n,theme:w})]})}const af={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6",inputBackground:"#ffffff",inputBorder:"#d1d5db",inputFocus:"#3b82f6",buttonPrimary:"#3b82f6",buttonPrimaryHover:"#2563eb",buttonSecondary:"#f3f4f6",buttonSecondaryHover:"#e5e7eb",attachmentBackground:"#f9fafb",attachmentBorder:"#e5e7eb"};function uf({to:r="",subject:e="",body:t="",replyTo:n,onSend:s,onCancel:o,onBodyChange:i,externalUpdate:l,insertText:a,insertTextTrigger:u,theme:c={},disabled:d=!1,showCcBcc:f=!1,placeholder:h="Write your message...",className:g="",minHeight:m="200px",sendButtonText:y="Send",hideCancelButton:w=!1,onAiRestructure:x,onAiProofread:E,onAiRewrite:C,renderAboveToolbar:k}){const v={...af,...c},[_,S]=D.useState(r),[T,I]=D.useState(""),[N,j]=D.useState(""),[R,L]=D.useState(e),[O,Y]=D.useState(t),[ce,se]=D.useState([]),[ie,xe]=D.useState(!1),[he,be]=D.useState(""),[De,Le]=D.useState(f),[Se,_e]=D.useState(!1),qe=D.useRef(void 0);D.useEffect(()=>{l!==void 0&&l!==qe.current&&(qe.current=l,Y(t),_e(!0))},[l,t]);const Me=G=>{Y(G),_e(!1),i==null||i(G)},pe=D.useRef(null),[Re,lt]=D.useState(!1),xt=G=>{const ve=G.target.files;ve&&se(He=>[...He,...Array.from(ve)]),pe.current&&(pe.current.value="")},Ot=G=>{G.preventDefault(),G.stopPropagation(),lt(!0)},tt=G=>{G.preventDefault(),G.stopPropagation(),lt(!1)},rt=G=>{G.preventDefault(),G.stopPropagation(),lt(!1),G.dataTransfer.files&&se(ve=>[...ve,...Array.from(G.dataTransfer.files)])},at=G=>G.type.startsWith("image/")?"image":G.type==="application/pdf"?"picture_as_pdf":G.type.includes("spreadsheet")||G.type.includes("excel")?"table_chart":G.type.includes("document")||G.type.includes("word")?"description":"attach_file",Mt=G=>{se(ve=>ve.filter((He,U)=>U!==G))},It=G=>G<1024?`${G} B`:G<1024*1024?`${(G/1024).toFixed(1)} KB`:`${(G/(1024*1024)).toFixed(1)} MB`,bt=async()=>{if(!_.trim()){be("Recipient email is required");return}if(!R.trim()){be("Subject is required");return}xe(!0),be("");try{const G=await Promise.all(ce.map(async He=>{const U=await He.arrayBuffer(),B=btoa(new Uint8Array(U).reduce((X,J)=>X+String.fromCharCode(J),""));return{filename:He.name,content_type:He.type||"application/octet-stream",data:B,size:He.size}})),ve=O.replace(/>\n+</g,"><").replace(/<p class="[^"]*"><\/p>/g,"<br>").trim();await s({to:_.trim(),cc:T.trim()||void 0,bcc:N.trim()||void 0,subject:R.trim(),html:ve,attachments:G,inReplyTo:n==null?void 0:n.messageId}),S(""),I(""),j(""),L(""),Y(""),se([])}catch(G){be(G instanceof Error?G.message:"Failed to send email")}finally{xe(!1)}},ut={width:"100%",padding:"8px 12px",fontSize:"14px",border:`1px solid ${v.inputBorder}`,borderRadius:"6px",background:v.inputBackground,color:v.text,outline:"none"},nt={display:"block",fontSize:"12px",fontWeight:500,color:v.textSecondary,marginBottom:"4px",textTransform:"uppercase"},_t=G=>({padding:"10px 20px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",cursor:d||ie?"not-allowed":"pointer",opacity:d||ie?.6:1,background:G?v.buttonPrimary:v.buttonSecondary,color:G?"#ffffff":v.text,display:"flex",alignItems:"center",gap:"8px"});return p.jsxs("div",{className:g,style:{display:"flex",flexDirection:"column",gap:"16px",background:v.background},children:[he&&p.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:"6px",color:"#dc2626",fontSize:"14px"},children:he}),p.jsxs("div",{children:[p.jsx("label",{style:nt,children:"To"}),p.jsx("input",{type:"email",value:_,onChange:G=>S(G.target.value),placeholder:"recipient@example.com",disabled:d||ie,style:ut})]}),!De&&p.jsx("button",{type:"button",onClick:()=>Le(!0),disabled:d||ie,style:{background:"none",border:"none",padding:0,fontSize:"12px",color:v.primary,cursor:"pointer",textAlign:"left"},children:"+ Add CC/BCC"}),De&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{children:[p.jsx("label",{style:nt,children:"CC"}),p.jsx("input",{type:"email",value:T,onChange:G=>I(G.target.value),placeholder:"cc@example.com",disabled:d||ie,style:ut})]}),p.jsxs("div",{children:[p.jsx("label",{style:nt,children:"BCC"}),p.jsx("input",{type:"email",value:N,onChange:G=>j(G.target.value),placeholder:"bcc@example.com",disabled:d||ie,style:ut})]})]}),p.jsxs("div",{children:[p.jsx("label",{style:nt,children:"Subject"}),p.jsx("input",{type:"text",value:R,onChange:G=>L(G.target.value),placeholder:"Email subject",disabled:d||ie,style:ut})]}),p.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[p.jsx("label",{style:nt,children:"Message"}),p.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:p.jsx(Ba,{value:O,onChange:Me,placeholder:h,replyTo:n,theme:v,disabled:d||ie,minHeight:m,externalUpdate:Se?l:void 0,insertText:a,insertTextTrigger:u,onAiRestructure:x,onAiProofread:E,onAiRewrite:C,renderAboveToolbar:k})})]}),p.jsxs("div",{children:[p.jsx("label",{style:{...nt,marginBottom:"8px"},children:"Attachments"}),p.jsx("input",{ref:pe,type:"file",multiple:!0,onChange:xt,style:{display:"none"}}),p.jsxs("div",{onClick:()=>{var G;return(G=pe.current)==null?void 0:G.click()},onDragOver:Ot,onDragLeave:tt,onDrop:rt,style:{width:"100%",padding:"24px 16px",border:`2px dashed ${Re?v.primary:v.border}`,borderRadius:"8px",background:Re?`${v.primary}10`:"transparent",color:Re?v.primary:v.textSecondary,cursor:d||ie?"not-allowed":"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s",marginBottom:ce.length>0?"12px":0},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"24px"},children:Re?"file_download":"attach_file"}),p.jsx("span",{style:{fontSize:"14px"},children:Re?"Drop files here":"Drop files or click to add"})]}),ce.length>0&&p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:ce.map((G,ve)=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:v.attachmentBackground,borderRadius:"8px"},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:v.textSecondary},children:at(G)}),p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:v.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:G.name}),p.jsx("div",{style:{fontSize:"12px",color:v.textSecondary},children:It(G.size)})]}),p.jsx("button",{type:"button",onClick:()=>Mt(ve),disabled:d||ie,style:{background:"none",border:"none",padding:"4px",cursor:"pointer",color:v.textSecondary,display:"flex",borderRadius:"4px"},children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px"},children:"close"})})]},`${G.name}-${ve}`))})]}),p.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"12px"},children:[!w&&o&&p.jsx("button",{type:"button",onClick:o,disabled:d||ie,style:_t(!1),children:"Cancel"}),p.jsxs("button",{type:"button",onClick:bt,disabled:d||ie||!_.trim()||!R.trim(),style:_t(!0),children:[p.jsx("span",{className:"material-icons",style:{fontSize:"18px",animation:ie?"spin 1s linear infinite":"none"},children:ie?"sync":"send"}),ie?"Sending...":y]})]}),p.jsx("style",{children:`
148
+ `;return p.jsxs("div",{className:i,style:{border:`1px solid ${w.border}`,borderRadius:"8px",background:w.background,overflow:"hidden",display:"flex",flexDirection:"column",height:"100%",minHeight:l},children:[p.jsx("style",{children:xe}),y,p.jsxs(Pc,{initialConfig:se,children:[p.jsx(nf,{theme:w,disabled:o,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:N,aiProcessingAction:j,onAiAction:Y,hasContent:ce}),p.jsx("div",{style:{position:"relative",flex:1,display:"flex",flexDirection:"column"},children:p.jsx(_d,{contentEditable:p.jsx(Dd,{className:"mail-editor-content",style:{outline:"none",flex:1,minHeight:"100px",padding:"16px",fontSize:"14px",lineHeight:1.6,color:w.text}}),placeholder:p.jsx("div",{className:"mail-editor-placeholder",children:t}),ErrorBoundary:Md})}),p.jsx(Qd,{}),p.jsx(ef,{}),p.jsx(Ld,{}),p.jsx(Pd,{onChange:ie}),p.jsx(sf,{html:x?k:r,isExternalUpdate:x,onImportComplete:R}),p.jsx(of,{text:u,trigger:c})]}),n&&p.jsx(lf,{replyTo:n,theme:w})]})}const af={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6",inputBackground:"#ffffff",inputBorder:"#d1d5db",inputFocus:"#3b82f6",buttonPrimary:"#3b82f6",buttonPrimaryHover:"#2563eb",buttonSecondary:"#f3f4f6",buttonSecondaryHover:"#e5e7eb",attachmentBackground:"#f9fafb",attachmentBorder:"#e5e7eb"};function uf({to:r="",subject:e="",body:t="",replyTo:n,onSend:s,onCancel:o,onBodyChange:i,externalUpdate:l,insertText:a,insertTextTrigger:u,theme:c={},disabled:d=!1,showCcBcc:f=!1,placeholder:h="Write your message...",className:g="",minHeight:m="200px",sendButtonText:y="Send",hideCancelButton:w=!1,onAiRestructure:x,onAiProofread:E,onAiRewrite:C,renderAboveToolbar:k}){const v={...af,...c},[_,S]=D.useState(r),[T,I]=D.useState(""),[N,j]=D.useState(""),[R,L]=D.useState(e),[O,Y]=D.useState(t),[ce,se]=D.useState([]),[ie,xe]=D.useState(!1),[he,be]=D.useState(""),[De,Le]=D.useState(f),[Se,_e]=D.useState(!1),qe=D.useRef(void 0);D.useEffect(()=>{l!==void 0&&l!==qe.current&&(qe.current=l,Y(t),_e(!0))},[l,t]);const Me=G=>{Y(G),_e(!1),i==null||i(G)},pe=D.useRef(null),[Re,lt]=D.useState(!1),xt=G=>{const ve=G.target.files;ve&&se(He=>[...He,...Array.from(ve)]),pe.current&&(pe.current.value="")},Ot=G=>{G.preventDefault(),G.stopPropagation(),lt(!0)},tt=G=>{G.preventDefault(),G.stopPropagation(),lt(!1)},rt=G=>{G.preventDefault(),G.stopPropagation(),lt(!1),G.dataTransfer.files&&se(ve=>[...ve,...Array.from(G.dataTransfer.files)])},at=G=>G.type.startsWith("image/")?"image":G.type==="application/pdf"?"picture_as_pdf":G.type.includes("spreadsheet")||G.type.includes("excel")?"table_chart":G.type.includes("document")||G.type.includes("word")?"description":"attach_file",Mt=G=>{se(ve=>ve.filter((He,U)=>U!==G))},It=G=>G<1024?`${G} B`:G<1024*1024?`${(G/1024).toFixed(1)} KB`:`${(G/(1024*1024)).toFixed(1)} MB`,bt=async()=>{if(!_.trim()){be("Recipient email is required");return}if(!R.trim()){be("Subject is required");return}xe(!0),be("");try{const G=await Promise.all(ce.map(async He=>{const U=await He.arrayBuffer(),B=btoa(new Uint8Array(U).reduce((X,J)=>X+String.fromCharCode(J),""));return{filename:He.name,content_type:He.type||"application/octet-stream",data:B,size:He.size}})),ve=O.replace(/>\n+</g,"><").replace(/<p class="[^"]*"><\/p>/g,"<br>").trim();await s({to:_.trim(),cc:T.trim()||void 0,bcc:N.trim()||void 0,subject:R.trim(),html:ve,attachments:G,inReplyTo:n==null?void 0:n.messageId}),S(""),I(""),j(""),L(""),Y(""),se([])}catch(G){be(G instanceof Error?G.message:"Failed to send email")}finally{xe(!1)}},ut={width:"100%",padding:"8px 12px",fontSize:"14px",border:`1px solid ${v.inputBorder}`,borderRadius:"6px",background:v.inputBackground,color:v.text,outline:"none"},nt={display:"block",fontSize:"12px",fontWeight:500,color:v.textSecondary,marginBottom:"4px",textTransform:"uppercase"},_t=G=>({padding:"10px 20px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",cursor:d||ie?"not-allowed":"pointer",opacity:d||ie?.6:1,background:G?v.buttonPrimary:v.buttonSecondary,color:G?"#ffffff":v.text,display:"flex",alignItems:"center",gap:"8px"});return p.jsxs("div",{className:g,style:{display:"flex",flexDirection:"column",gap:"16px",padding:"16px",background:v.background},children:[he&&p.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:"6px",color:"#dc2626",fontSize:"14px"},children:he}),p.jsxs("div",{children:[p.jsx("label",{style:nt,children:"To"}),p.jsx("input",{type:"email",value:_,onChange:G=>S(G.target.value),placeholder:"recipient@example.com",disabled:d||ie,style:ut})]}),!De&&p.jsx("button",{type:"button",onClick:()=>Le(!0),disabled:d||ie,style:{background:"none",border:"none",padding:0,fontSize:"12px",color:v.primary,cursor:"pointer",textAlign:"left"},children:"+ Add CC/BCC"}),De&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{children:[p.jsx("label",{style:nt,children:"CC"}),p.jsx("input",{type:"email",value:T,onChange:G=>I(G.target.value),placeholder:"cc@example.com",disabled:d||ie,style:ut})]}),p.jsxs("div",{children:[p.jsx("label",{style:nt,children:"BCC"}),p.jsx("input",{type:"email",value:N,onChange:G=>j(G.target.value),placeholder:"bcc@example.com",disabled:d||ie,style:ut})]})]}),p.jsxs("div",{children:[p.jsx("label",{style:nt,children:"Subject"}),p.jsx("input",{type:"text",value:R,onChange:G=>L(G.target.value),placeholder:"Email subject",disabled:d||ie,style:ut})]}),p.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[p.jsx("label",{style:nt,children:"Message"}),p.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:p.jsx(Ba,{value:O,onChange:Me,placeholder:h,replyTo:n,theme:v,disabled:d||ie,minHeight:m,externalUpdate:Se?l:void 0,insertText:a,insertTextTrigger:u,onAiRestructure:x,onAiProofread:E,onAiRewrite:C,renderAboveToolbar:k})})]}),p.jsxs("div",{children:[p.jsx("label",{style:{...nt,marginBottom:"8px"},children:"Attachments"}),p.jsx("input",{ref:pe,type:"file",multiple:!0,onChange:xt,style:{display:"none"}}),p.jsxs("div",{onClick:()=>{var G;return(G=pe.current)==null?void 0:G.click()},onDragOver:Ot,onDragLeave:tt,onDrop:rt,style:{width:"100%",padding:"24px 16px",border:`2px dashed ${Re?v.primary:v.border}`,borderRadius:"8px",background:Re?`${v.primary}10`:"transparent",color:Re?v.primary:v.textSecondary,cursor:d||ie?"not-allowed":"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s",marginBottom:ce.length>0?"12px":0},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"24px"},children:Re?"file_download":"attach_file"}),p.jsx("span",{style:{fontSize:"14px"},children:Re?"Drop files here":"Drop files or click to add"})]}),ce.length>0&&p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:ce.map((G,ve)=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:v.attachmentBackground,borderRadius:"8px"},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:v.textSecondary},children:at(G)}),p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:v.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:G.name}),p.jsx("div",{style:{fontSize:"12px",color:v.textSecondary},children:It(G.size)})]}),p.jsx("button",{type:"button",onClick:()=>Mt(ve),disabled:d||ie,style:{background:"none",border:"none",padding:"4px",cursor:"pointer",color:v.textSecondary,display:"flex",borderRadius:"4px"},children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px"},children:"close"})})]},`${G.name}-${ve}`))})]}),p.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"12px"},children:[!w&&o&&p.jsx("button",{type:"button",onClick:o,disabled:d||ie,style:_t(!1),children:"Cancel"}),p.jsxs("button",{type:"button",onClick:bt,disabled:d||ie||!_.trim()||!R.trim(),style:_t(!0),children:[p.jsx("span",{className:"material-icons",style:{fontSize:"18px",animation:ie?"spin 1s linear infinite":"none"},children:ie?"sync":"send"}),ie?"Sending...":y]})]}),p.jsx("style",{children:`
149
149
  @keyframes spin {
150
150
  from { transform: rotate(0deg); }
151
151
  to { transform: rotate(360deg); }
package/dist/index.esm.js CHANGED
@@ -12452,6 +12452,7 @@ function Sf({
12452
12452
  display: "flex",
12453
12453
  flexDirection: "column",
12454
12454
  gap: "16px",
12455
+ padding: "16px",
12455
12456
  background: v.background
12456
12457
  },
12457
12458
  children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwanyx/stack",
3
- "version": "0.2.39",
3
+ "version": "0.2.40",
4
4
  "description": "Modern HyperCard for React - All-in-one data management (REST + Graph API + Auth + Hooks + UI)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",