booary 2.0.1 → 3.0.0

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/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var b=Object.create;var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var f=(o,r,a,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of d(r))!g.call(o,e)&&e!==a&&l(o,e,{get:()=>r[e],enumerable:!(n=u(r,e))||n.enumerable});return o};var s=(o,r,a)=>(a=o!=null?b(y(o)):{},f(r||!o||!o.__esModule?l(a,"default",{value:o,enumerable:!0}):a,o));var c=s(require("inquirer"),1),p=s(require("axios"),1),t=s(require("fs-extra"),1),m=s(require("path"),1),k=m.default.join(process.cwd(),"public/library"),i=m.default.join(process.cwd(),"public/library/card.json");async function h(){if(await t.default.ensureDir(k),!t.default.existsSync(i)){let e=await c.default.prompt([{type:"input",name:"borrower",message:"Enter borrower name"},{type:"input",name:"libName",message:"Enter library name",default:"Boo Library"}]),w={borrower:e.borrower,library:{name:e.libName,signature:"\u{1F43E}"},books:[]};await t.default.writeJson(i,w,{spaces:2}),console.log("\u2728 Library card created!")}let{query:o}=await c.default.prompt([{type:"input",name:"query",message:"Search for a book:"}]),{data:r}=await p.default.get(`https://openlibrary.org/search.json?q=${encodeURIComponent(o)}`);if(!r.docs?.length){console.log("No books found.");return}let{selectedBook:a}=await c.default.prompt([{type:"select",name:"selectedBook",message:"Select a book:",choices:r.docs.slice(0,5).map(e=>({name:`${e.title} (${e.author_name?.[0]||"Unknown"})`,value:{key:e.key,name:e.title,borrowDate:new Date().toLocaleDateString("en-IN")}}))}]),n=await t.default.readJson(i);n.books.push(a),await t.default.writeJson(i,n,{spaces:2}),console.log(`Added ${a.name}`)}h();
2
+ "use strict";var b=Object.create;var p=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var f=(o,r,a,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of d(r))!g.call(o,e)&&e!==a&&p(o,e,{get:()=>r[e],enumerable:!(n=u(r,e))||n.enumerable});return o};var s=(o,r,a)=>(a=o!=null?b(y(o)):{},f(r||!o||!o.__esModule?p(a,"default",{value:o,enumerable:!0}):a,o));var c=s(require("inquirer"),1),l=s(require("axios"),1),t=s(require("fs-extra"),1),m=s(require("path"),1),k=m.default.join(process.cwd(),"public/library"),i=m.default.join(process.cwd(),"public/library/card.json");async function h(){if(await t.default.ensureDir(k),!t.default.existsSync(i)){let e=await c.default.prompt([{type:"input",name:"borrower",message:"Enter borrower name"},{type:"input",name:"libName",message:"Enter library name",default:"Boo Library"}]),w={borrower:e.borrower,library:{name:e.libName,signature:"\u{1F43E}"},books:[]};await t.default.writeJson(i,w,{spaces:2}),console.log("\u2728 Library card created!")}let{query:o}=await c.default.prompt([{type:"input",name:"query",message:"Search for a book:"}]),{data:r}=await l.default.get(`https://openlibrary.org/search.json?q=${encodeURIComponent(o)}`);if(!r.docs?.length){console.log("No books found.");return}let{selectedBook:a}=await c.default.prompt([{type:"select",name:"selectedBook",message:"Select a book:",choices:r.docs.map(e=>({name:`${e.title} (${e.author_name?.[0]||"Unknown"})`,value:{key:e.key,name:e.title,borrowDate:new Date().toLocaleDateString("en-IN")}}))}]),n=await t.default.readJson(i);n.books.push(a),await t.default.writeJson(i,n,{spaces:2}),console.log(`Added ${a.name}`)}h();
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import a from"inquirer";import l from"axios";import o from"fs-extra";import i from"path";var p=i.join(process.cwd(),"public/library"),r=i.join(process.cwd(),"public/library/card.json");async function w(){if(await o.ensureDir(p),!o.existsSync(r)){let e=await a.prompt([{type:"input",name:"borrower",message:"Enter borrower name"},{type:"input",name:"libName",message:"Enter library name",default:"Boo Library"}]),m={borrower:e.borrower,library:{name:e.libName,signature:"\u{1F43E}"},books:[]};await o.writeJson(r,m,{spaces:2}),console.log("\u2728 Library card created!")}let{query:c}=await a.prompt([{type:"input",name:"query",message:"Search for a book:"}]),{data:t}=await l.get(`https://openlibrary.org/search.json?q=${encodeURIComponent(c)}`);if(!t.docs?.length){console.log("No books found.");return}let{selectedBook:n}=await a.prompt([{type:"select",name:"selectedBook",message:"Select a book:",choices:t.docs.slice(0,5).map(e=>({name:`${e.title} (${e.author_name?.[0]||"Unknown"})`,value:{key:e.key,name:e.title,borrowDate:new Date().toLocaleDateString("en-IN")}}))}]),s=await o.readJson(r);s.books.push(n),await o.writeJson(r,s,{spaces:2}),console.log(`Added ${n.name}`)}w();
2
+ import a from"inquirer";import p from"axios";import o from"fs-extra";import i from"path";var l=i.join(process.cwd(),"public/library"),r=i.join(process.cwd(),"public/library/card.json");async function w(){if(await o.ensureDir(l),!o.existsSync(r)){let e=await a.prompt([{type:"input",name:"borrower",message:"Enter borrower name"},{type:"input",name:"libName",message:"Enter library name",default:"Boo Library"}]),m={borrower:e.borrower,library:{name:e.libName,signature:"\u{1F43E}"},books:[]};await o.writeJson(r,m,{spaces:2}),console.log("\u2728 Library card created!")}let{query:c}=await a.prompt([{type:"input",name:"query",message:"Search for a book:"}]),{data:t}=await p.get(`https://openlibrary.org/search.json?q=${encodeURIComponent(c)}`);if(!t.docs?.length){console.log("No books found.");return}let{selectedBook:n}=await a.prompt([{type:"select",name:"selectedBook",message:"Select a book:",choices:t.docs.map(e=>({name:`${e.title} (${e.author_name?.[0]||"Unknown"})`,value:{key:e.key,name:e.title,borrowDate:new Date().toLocaleDateString("en-IN")}}))}]),s=await o.readJson(r);s.books.push(n),await o.writeJson(r,s,{spaces:2}),console.log(`Added ${n.name}`)}w();
package/dist/index.cjs CHANGED
@@ -1,2 +1,3 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var p=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var v=(t,a)=>{for(var s in a)p(t,s,{get:a[s],enumerable:!0})},f=(t,a,s,d)=>{if(a&&typeof a=="object"||typeof a=="function")for(let i of u(a))!x.call(t,i)&&i!==s&&p(t,i,{get:()=>a[i],enumerable:!(d=g(a,i))||d.enumerable});return t};var h=t=>f(p({},"__esModule",{value:!0}),t);var N={};v(N,{LibraryCard:()=>y});module.exports=h(N);var l=require("react"),e=require("react/jsx-runtime"),y=({cardUrl:t,friends:a=[]})=>{let[s,d]=(0,l.useState)(null),[i,m]=(0,l.useState)([]);return(0,l.useEffect)(()=>{fetch(t).then(r=>r.json()).then(d).catch(r=>console.error("Booary Error:",r)),a.length>0&&Promise.all(a.map(r=>fetch(r).then(n=>n.json()).then(n=>({...n,url:r})))).then(m).catch(r=>console.error("Friend Sync Error:",r))},[t,a]),s?(0,e.jsx)("div",{className:"relative max-w-sm border-2 border-gray-800 bg-white p-6 font-mono shadow-sm",children:(0,e.jsxs)("div",{className:"-rotate-1",children:[(0,e.jsxs)("div",{className:"flex justify-between border-b-2 border-gray-800 pb-2 mb-4",children:[(0,e.jsx)("span",{className:"text-xs uppercase font-bold",children:"20"}),(0,e.jsx)("span",{className:"text-xs uppercase font-bold",children:"26"})]}),(0,e.jsx)("div",{className:"flex justify-between items-center border-b-2 border-gray-800 pb-2 mb-4",children:(0,e.jsx)("h2",{className:"text-xl font-black tracking-widest uppercase italic",children:s.library.name})}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-lg leading-tight",children:s.borrower}),(0,e.jsx)("label",{className:"block text-[10px] uppercase text-gray-500 underline decoration-dotted",children:"Borrower's Name"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-2xl",children:s.library.signature}),(0,e.jsx)("label",{className:"block text-[10px] uppercase text-gray-500 underline decoration-dotted",children:"Librarian's Signature"})]}),(0,e.jsxs)("div",{className:"border-t-2 border-gray-800 pt-2",children:[(0,e.jsxs)("div",{className:"grid grid-cols-2 text-[10px] uppercase font-bold mb-2 text-gray-400",children:[(0,e.jsx)("span",{children:"Book Name"}),(0,e.jsx)("span",{className:"text-right",children:"Due Date"})]}),(0,e.jsx)("ul",{className:"space-y-2",children:s.books.map((r,n)=>{let b=i.filter(o=>o.books.some(c=>c.isbn===r.isbn));return(0,e.jsxs)("li",{className:"relative group grid grid-cols-2 items-end border-b border-gray-100 pb-1",children:[(0,e.jsx)("span",{className:"text-sm font-medium leading-none truncate pr-2",children:r.name}),(0,e.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,e.jsx)("span",{className:"text-[10px] text-right text-gray-400 italic",children:r.borrowDate}),(0,e.jsx)("div",{className:"absolute -right-8 flex -space-x-2",children:b.map((o,c)=>(0,e.jsx)("a",{href:o.url?new URL(o.url).origin:void 0,target:"_blank",rel:"noopener noreferrer",title:`${o.borrower} has also read this`,className:"text-lg hover:scale-125 hover:z-10 transition-transform cursor-pointer drop-shadow-sm",children:o.library.signature},c))})]})]},n)})})]})]})]})}):(0,e.jsx)("div",{className:"p-4 italic font-mono",children:"Loading library card..."})};0&&(module.exports={LibraryCard});
2
+ "use strict";var p=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var y=(r,t)=>{for(var a in t)p(r,a,{get:t[a],enumerable:!0})},x=(r,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of u(t))!h.call(r,s)&&s!==a&&p(r,s,{get:()=>t[s],enumerable:!(i=b(t,s))||i.enumerable});return r};var N=r=>x(p({},"__esModule",{value:!0}),r);var k={};y(k,{LibraryCard:()=>v});module.exports=N(k);var d=require("react");function c(r,{insertAt:t}={}){if(!r||typeof document>"u")return;let a=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",t==="top"&&a.firstChild?a.insertBefore(i,a.firstChild):a.appendChild(i),i.styleSheet?i.styleSheet.cssText=r:i.appendChild(document.createTextNode(r))}c(`.card{position:relative;max-width:384px;border:2px solid #1f2937;background-color:#fff;padding:1.5rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;box-shadow:0 1px 2px #0000000d}.inner{transform:rotate(-1deg)}.header{display:flex;justify-content:space-between;border-bottom:2px solid #1f2937;padding-bottom:.5rem;margin-bottom:1rem}.year{font-size:.75rem;text-transform:uppercase;font-weight:700}.libraryTitle{font-size:1.25rem;font-weight:900;letter-spacing:.1em;text-transform:uppercase;font-style:italic;margin:0}.fieldGroup{margin-bottom:1rem}.fieldValue{margin:0;line-height:1.2}.nameValue{font-size:1.125rem}.signatureValue{font-size:1.5rem}.label{display:block;font-size:10px;text-transform:uppercase;color:#6b7280;text-decoration:underline dotted}.bookSection{border-top:2px solid #1f2937;padding-top:.5rem}.bookList{list-style:none;padding:0;margin:0}.bookRow{position:relative;display:grid;grid-template-cols:1fr 1fr;align-items:flex-end;border-bottom:1px solid #f3f4f6;padding-bottom:.25rem;margin-bottom:.5rem}.bookName{font-size:.875rem;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-right:.5rem}.bookDate{font-size:10px;text-align:right;color:#9ca3af;font-style:italic}.friendSignatures{position:absolute;right:-2rem;display:flex;gap:-.5rem}.signatureLink{font-size:1.125rem;transition:transform .2s;text-decoration:none;color:inherit}.signatureLink:hover{transform:scale(1.25);z-index:10}
3
+ `);var e=require("react/jsx-runtime"),v=({cardUrl:r,friends:t=[]})=>{let[a,i]=(0,d.useState)(null),[s,f]=(0,d.useState)([]);return(0,d.useEffect)(()=>{fetch(r).then(o=>o.json()).then(i),t.length>0&&Promise.all(t.map(o=>fetch(o).then(l=>l.json()).then(l=>({...l,url:o})))).then(f)},[r,t]),a?(0,e.jsx)("div",{className:"card",children:(0,e.jsxs)("div",{className:"inner",children:[(0,e.jsxs)("div",{className:"header",children:[(0,e.jsx)("span",{className:"year",children:"20"}),(0,e.jsx)("span",{className:"year",children:"26"})]}),(0,e.jsx)("div",{className:"header",children:(0,e.jsx)("h2",{className:"libraryTitle",children:a.library.name})}),(0,e.jsxs)("div",{className:"fieldGroup",children:[(0,e.jsx)("p",{className:"fieldValue nameValue",children:a.borrower}),(0,e.jsx)("label",{className:"label",children:"Borrower's Name"})]}),(0,e.jsxs)("div",{className:"fieldGroup",children:[(0,e.jsx)("p",{className:"fieldValue signatureValue",children:a.library.signature}),(0,e.jsx)("label",{className:"label",children:"Librarian's Signature"})]}),(0,e.jsx)("div",{className:"bookSection",children:(0,e.jsx)("ul",{className:"bookList",children:a.books.map((o,l)=>{let g=s.filter(n=>n.books.some(m=>m.isbn===o.isbn));return(0,e.jsxs)("li",{className:"bookRow",children:[(0,e.jsx)("span",{className:"bookName",children:o.name}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:[(0,e.jsx)("span",{className:"bookDate",children:o.borrowDate}),(0,e.jsx)("div",{className:"friendSignatures",children:g.map((n,m)=>(0,e.jsx)("a",{href:n.url?new URL(n.url).origin:"#",className:"signatureLink",title:`${n.borrower} read this too`,children:n.library.signature},m))})]})]},l)})})})]})}):(0,e.jsx)("div",{className:"loading",children:"Loading library card..."})};0&&(module.exports={LibraryCard});
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{useState as d,useEffect as g}from"react";import{jsx as e,jsxs as r}from"react/jsx-runtime";var x=({cardUrl:l,friends:o=[]})=>{let[s,c]=d(null),[p,m]=d([]);return g(()=>{fetch(l).then(a=>a.json()).then(c).catch(a=>console.error("Booary Error:",a)),o.length>0&&Promise.all(o.map(a=>fetch(a).then(i=>i.json()).then(i=>({...i,url:a})))).then(m).catch(a=>console.error("Friend Sync Error:",a))},[l,o]),s?e("div",{className:"relative max-w-sm border-2 border-gray-800 bg-white p-6 font-mono shadow-sm",children:r("div",{className:"-rotate-1",children:[r("div",{className:"flex justify-between border-b-2 border-gray-800 pb-2 mb-4",children:[e("span",{className:"text-xs uppercase font-bold",children:"20"}),e("span",{className:"text-xs uppercase font-bold",children:"26"})]}),e("div",{className:"flex justify-between items-center border-b-2 border-gray-800 pb-2 mb-4",children:e("h2",{className:"text-xl font-black tracking-widest uppercase italic",children:s.library.name})}),r("div",{className:"space-y-4",children:[r("div",{children:[e("p",{className:"text-lg leading-tight",children:s.borrower}),e("label",{className:"block text-[10px] uppercase text-gray-500 underline decoration-dotted",children:"Borrower's Name"})]}),r("div",{children:[e("p",{className:"text-2xl",children:s.library.signature}),e("label",{className:"block text-[10px] uppercase text-gray-500 underline decoration-dotted",children:"Librarian's Signature"})]}),r("div",{className:"border-t-2 border-gray-800 pt-2",children:[r("div",{className:"grid grid-cols-2 text-[10px] uppercase font-bold mb-2 text-gray-400",children:[e("span",{children:"Book Name"}),e("span",{className:"text-right",children:"Due Date"})]}),e("ul",{className:"space-y-2",children:s.books.map((a,i)=>{let b=p.filter(t=>t.books.some(n=>n.isbn===a.isbn));return r("li",{className:"relative group grid grid-cols-2 items-end border-b border-gray-100 pb-1",children:[e("span",{className:"text-sm font-medium leading-none truncate pr-2",children:a.name}),r("div",{className:"flex justify-end items-center gap-2",children:[e("span",{className:"text-[10px] text-right text-gray-400 italic",children:a.borrowDate}),e("div",{className:"absolute -right-8 flex -space-x-2",children:b.map((t,n)=>e("a",{href:t.url?new URL(t.url).origin:void 0,target:"_blank",rel:"noopener noreferrer",title:`${t.borrower} has also read this`,className:"text-lg hover:scale-125 hover:z-10 transition-transform cursor-pointer drop-shadow-sm",children:t.library.signature},n))})]})]},i)})})]})]})]})}):e("div",{className:"p-4 italic font-mono",children:"Loading library card..."})};export{x as LibraryCard};
2
+ import{useState as p,useEffect as b}from"react";function m(i,{insertAt:n}={}){if(!i||typeof document>"u")return;let a=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css",n==="top"&&a.firstChild?a.insertBefore(t,a.firstChild):a.appendChild(t),t.styleSheet?t.styleSheet.cssText=i:t.appendChild(document.createTextNode(i))}m(`.card{position:relative;max-width:384px;border:2px solid #1f2937;background-color:#fff;padding:1.5rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;box-shadow:0 1px 2px #0000000d}.inner{transform:rotate(-1deg)}.header{display:flex;justify-content:space-between;border-bottom:2px solid #1f2937;padding-bottom:.5rem;margin-bottom:1rem}.year{font-size:.75rem;text-transform:uppercase;font-weight:700}.libraryTitle{font-size:1.25rem;font-weight:900;letter-spacing:.1em;text-transform:uppercase;font-style:italic;margin:0}.fieldGroup{margin-bottom:1rem}.fieldValue{margin:0;line-height:1.2}.nameValue{font-size:1.125rem}.signatureValue{font-size:1.5rem}.label{display:block;font-size:10px;text-transform:uppercase;color:#6b7280;text-decoration:underline dotted}.bookSection{border-top:2px solid #1f2937;padding-top:.5rem}.bookList{list-style:none;padding:0;margin:0}.bookRow{position:relative;display:grid;grid-template-cols:1fr 1fr;align-items:flex-end;border-bottom:1px solid #f3f4f6;padding-bottom:.25rem;margin-bottom:.5rem}.bookName{font-size:.875rem;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-right:.5rem}.bookDate{font-size:10px;text-align:right;color:#9ca3af;font-style:italic}.friendSignatures{position:absolute;right:-2rem;display:flex;gap:-.5rem}.signatureLink{font-size:1.125rem;transition:transform .2s;text-decoration:none;color:inherit}.signatureLink:hover{transform:scale(1.25);z-index:10}
3
+ `);import{jsx as e,jsxs as s}from"react/jsx-runtime";var N=({cardUrl:i,friends:n=[]})=>{let[a,t]=p(null),[c,f]=p([]);return b(()=>{fetch(i).then(r=>r.json()).then(t),n.length>0&&Promise.all(n.map(r=>fetch(r).then(l=>l.json()).then(l=>({...l,url:r})))).then(f)},[i,n]),a?e("div",{className:"card",children:s("div",{className:"inner",children:[s("div",{className:"header",children:[e("span",{className:"year",children:"20"}),e("span",{className:"year",children:"26"})]}),e("div",{className:"header",children:e("h2",{className:"libraryTitle",children:a.library.name})}),s("div",{className:"fieldGroup",children:[e("p",{className:"fieldValue nameValue",children:a.borrower}),e("label",{className:"label",children:"Borrower's Name"})]}),s("div",{className:"fieldGroup",children:[e("p",{className:"fieldValue signatureValue",children:a.library.signature}),e("label",{className:"label",children:"Librarian's Signature"})]}),e("div",{className:"bookSection",children:e("ul",{className:"bookList",children:a.books.map((r,l)=>{let g=c.filter(o=>o.books.some(d=>d.isbn===r.isbn));return s("li",{className:"bookRow",children:[e("span",{className:"bookName",children:r.name}),s("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:[e("span",{className:"bookDate",children:r.borrowDate}),e("div",{className:"friendSignatures",children:g.map((o,d)=>e("a",{href:o.url?new URL(o.url).origin:"#",className:"signatureLink",title:`${o.borrower} read this too`,children:o.library.signature},d))})]})]},l)})})})]})}):e("div",{className:"loading",children:"Loading library card..."})};export{N as LibraryCard};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "booary",
3
- "version": "2.0.1",
3
+ "version": "3.0.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
package/dist/styles.css DELETED
@@ -1 +0,0 @@
1
- @import"tailwindcss";
package/dist/styles.d.cts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }
package/dist/styles.d.ts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }