booary 6.0.1 → 8.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/README.md ADDED
@@ -0,0 +1,83 @@
1
+
2
+ # Booary
3
+
4
+ Booary is a web component designed to display a reading history in the style of a vintage library card. It uses a JSON file as a database and supports yearly archiving and friend cross-referencing.
5
+ Usage
6
+
7
+ 1. Installation
8
+
9
+ Include the library via CDN in your HTML or Astro project:
10
+
11
+ ```HTML
12
+
13
+ <script src="https://unpkg.com/booary"></script>
14
+ ```
15
+
16
+ 2. Implementation
17
+
18
+ Place the custom element in your code. It requires a link to your local data and can optionally accept an array of friend URLs.
19
+
20
+ ```HTML
21
+ <x-library-card
22
+ cardlink="/library/card.json"
23
+ friends='["https://friend-site.com/library/card.json"]'>
24
+ </x-library-card>
25
+ ```
26
+
27
+ <x-library-card
28
+ cardlink="/library/card.json"
29
+ friends='["https://friend-site.com/library/card.json"]'>
30
+ </x-library-card>
31
+
32
+ ### The CLI
33
+
34
+ The package includes a command-line interface to manage your library without manual JSON editing.
35
+
36
+ To run the CLI:
37
+
38
+ ```Bash
39
+
40
+ pnpm booary
41
+ ```
42
+
43
+ ### Functionality:
44
+
45
+ Initialization: Configures your borrower name and library name on the first run.
46
+
47
+ Book Search: Queries the Open Library API to find book details.
48
+
49
+ Automatic Archiving: New books are filed under the current year. If a year does not exist in your history, the CLI creates it.
50
+
51
+ ### Features:
52
+
53
+ Yearly Navigation: Toggle between different years using the navigation arrows to view historical reading data.
54
+
55
+ Social Discovery: If a friend in your list has read the same book in the same year, their librarian signature will appear next to that book on your card.
56
+
57
+ Encapsulated Design: Built as a standard Web Component that works across all modern browsers and frameworks.
58
+
59
+ ### Data Structure
60
+
61
+ The card.json file is organized by years to allow for historical browsing.
62
+
63
+ ```JSON
64
+
65
+ {
66
+ "borrower": "User Name",
67
+ "library": {
68
+ "name": "Library Name",
69
+ "signature": "JS"
70
+ },
71
+ "years": {
72
+ "2025": [
73
+ {
74
+ "key": "/works/OL12345W",
75
+ "name": "Book Title",
76
+ "author": "Author Name",
77
+ "finishedDate": "01/01/2025"
78
+ }
79
+ ],
80
+ "2026": []
81
+ }
82
+ }
83
+ ```
package/dist/cli.js CHANGED
@@ -7,30 +7,77 @@ import fs from "fs-extra";
7
7
  import path from "path";
8
8
  var DIR_PATH = path.join(process.cwd(), "public/library");
9
9
  var FILE_PATH = path.join(process.cwd(), "public/library/card.json");
10
+ var EMOJI_OPTIONS = [
11
+ "\u{1F43E}",
12
+ "\u{1F408}",
13
+ "\u{1F415}",
14
+ "\u{1F989}",
15
+ "\u{1F98A}",
16
+ "\u{1F43B}",
17
+ "\u{1F43C}",
18
+ "\u{1F428}",
19
+ "\u{1F438}",
20
+ "\u{1F422}",
21
+ "\u{1F41D}",
22
+ "\u{1F98B}",
23
+ "\u{1F419}",
24
+ "\u{1F996}",
25
+ "\u{1F995}",
26
+ "\u{1F409}",
27
+ "\u{1F984}",
28
+ "\u{1F427}",
29
+ "\u{1F9A6}",
30
+ "\u{1F9A5}",
31
+ "\u{1F4DA}",
32
+ "\u{1F58B}\uFE0F",
33
+ "\u2728",
34
+ "\u{1F4DC}",
35
+ "\u{1F56F}\uFE0F",
36
+ "Custom..."
37
+ ];
10
38
  async function runCli() {
11
39
  var _a;
40
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear().toString();
12
41
  await fs.ensureDir(DIR_PATH);
13
- if (!fs.existsSync(FILE_PATH)) {
42
+ let cardData = {
43
+ borrower: "",
44
+ library: { name: "", signature: "" },
45
+ years: {}
46
+ };
47
+ if (fs.existsSync(FILE_PATH)) {
48
+ cardData = await fs.readJson(FILE_PATH);
49
+ } else {
14
50
  const profile = await inquirer.prompt([
15
- {
16
- type: "input",
17
- name: "borrower",
18
- message: "Enter borrower name"
19
- },
51
+ { type: "input", name: "borrower", message: "Enter borrower name:" },
20
52
  {
21
53
  type: "input",
22
54
  name: "libName",
23
- message: "Enter library name",
55
+ message: "Enter library name:",
24
56
  default: "Boo Library"
25
57
  }
26
58
  ]);
27
- const initialData = {
28
- borrower: profile.borrower,
29
- library: { name: profile.libName, signature: "\u{1F43E}" },
30
- books: []
31
- };
32
- await fs.writeJson(FILE_PATH, initialData, { spaces: 2 });
33
- console.log("\u2728 Library card created!");
59
+ const { emojiChoice } = await inquirer.prompt([
60
+ {
61
+ type: "select",
62
+ name: "emojiChoice",
63
+ message: "Select your librarian signature:",
64
+ choices: EMOJI_OPTIONS
65
+ }
66
+ ]);
67
+ let signature = emojiChoice;
68
+ if (emojiChoice === "Custom...") {
69
+ const { custom } = await inquirer.prompt([
70
+ { type: "input", name: "custom", message: "Paste your custom emoji:" }
71
+ ]);
72
+ signature = custom;
73
+ }
74
+ cardData.borrower = profile.borrower;
75
+ cardData.library = { name: profile.libName, signature };
76
+ }
77
+ if (!cardData.years[currentYear]) {
78
+ cardData.years[currentYear] = [];
79
+ console.log(`
80
+ \u{1F38A} Happy New Year! Created archive for ${currentYear}.`);
34
81
  }
35
82
  const { query } = await inquirer.prompt([
36
83
  { type: "input", name: "query", message: "Search for a book:" }
@@ -61,9 +108,8 @@ async function runCli() {
61
108
  })
62
109
  }
63
110
  ]);
64
- const cardData = await fs.readJson(FILE_PATH);
65
- cardData.books.push(selectedBook);
111
+ cardData.years[currentYear].push(selectedBook);
66
112
  await fs.writeJson(FILE_PATH, cardData, { spaces: 2 });
67
- console.log(`Added ${selectedBook.name}`);
113
+ console.log(`Added ${selectedBook.name} to ${currentYear} card!`);
68
114
  }
69
115
  runCli();
@@ -1,2 +1,2 @@
1
- (function(exports){'use strict';var U,d,fe,H,se,pe,de,he,Z,J,K,F={},me=[],We=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,$=Array.isArray;function C(e,t){for(var n in t)e[n]=t[n];return e}function X(e){e&&e.parentNode&&e.parentNode.removeChild(e);}function P(e,t,n){var o,_,r,i={};for(r in t)r=="key"?o=t[r]:r=="ref"?_=t[r]:i[r]=t[r];if(arguments.length>2&&(i.children=arguments.length>3?U.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)i[r]===void 0&&(i[r]=e.defaultProps[r]);return j(e,i,o,_,null)}function j(e,t,n,o,_){var r={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:_??++fe,__i:-1,__u:0};return _==null&&d.vnode!=null&&d.vnode(r),r}function S(e){return e.children}function V(e,t){this.props=e,this.context=t;}function T(e,t){if(t==null)return e.__?T(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?T(e):null}function ve(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return ve(e)}}function le(e){(!e.__d&&(e.__d=true)&&H.push(e)&&!W.__r++||se!=d.debounceRendering)&&((se=d.debounceRendering)||pe)(W);}function W(){for(var e,t,n,o,_,r,i,l=1;H.length;)H.length>l&&H.sort(de),e=H.shift(),l=H.length,e.__d&&(n=void 0,o=void 0,_=(o=(t=e).__v).__e,r=[],i=[],t.__P&&((n=C({},o)).__v=o.__v+1,d.vnode&&d.vnode(n),Y(t.__P,n,o,t.__n,t.__P.namespaceURI,32&o.__u?[_]:null,r,_??T(o),!!(32&o.__u),i),n.__v=o.__v,n.__.__k[n.__i]=n,be(r,n,i),o.__e=o.__=null,n.__e!=_&&ve(n)));W.__r=0;}function ye(e,t,n,o,_,r,i,l,u,s,c){var a,p,f,b,x,k,m,h=o&&o.__k||me,N=t.length;for(u=$e(n,t,h,u,N),a=0;a<N;a++)(f=n.__k[a])!=null&&(p=f.__i==-1?F:h[f.__i]||F,f.__i=a,k=Y(e,f,p,_,r,i,l,u,s,c),b=f.__e,f.ref&&p.ref!=f.ref&&(p.ref&&ee(p.ref,null,f),c.push(f.ref,f.__c||b,f)),x==null&&b!=null&&(x=b),(m=!!(4&f.__u))||p.__k===f.__k?u=ge(f,u,e,m):typeof f.type=="function"&&k!==void 0?u=k:b&&(u=b.nextSibling),f.__u&=-7);return n.__e=x,u}function $e(e,t,n,o,_){var r,i,l,u,s,c=n.length,a=c,p=0;for(e.__k=new Array(_),r=0;r<_;r++)(i=t[r])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[r]=j(null,i,null,null,null):$(i)?i=e.__k[r]=j(S,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[r]=j(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[r]=i,u=r+p,i.__=e,i.__b=e.__b+1,l=null,(s=i.__i=Be(i,n,u,a))!=-1&&(a--,(l=n[s])&&(l.__u|=2)),l==null||l.__v==null?(s==-1&&(_>c?p--:_<c&&p++),typeof i.type!="function"&&(i.__u|=4)):s!=u&&(s==u-1?p--:s==u+1?p++:(s>u?p--:p++,i.__u|=4))):e.__k[r]=null;if(a)for(r=0;r<c;r++)(l=n[r])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=T(l)),xe(l,l));return o}function ge(e,t,n,o){var _,r;if(typeof e.type=="function"){for(_=e.__k,r=0;_&&r<_.length;r++)_[r]&&(_[r].__=e,t=ge(_[r],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=T(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Be(e,t,n,o){var _,r,i,l=e.key,u=e.type,s=t[n],c=s!=null&&(2&s.__u)==0;if(s===null&&l==null||c&&l==s.key&&u==s.type)return n;if(o>(c?1:0)){for(_=n-1,r=n+1;_>=0||r<t.length;)if((s=t[i=_>=0?_--:r++])!=null&&(2&s.__u)==0&&l==s.key&&u==s.type)return i}return -1}function ue(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||We.test(t)?n:n+"px";}function R(e,t,n,o,_){var r,i;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else {if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||ue(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||ue(e.style,t,n[t]);}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(he,"$1")),i=t.toLowerCase(),t=i in e||t=="onFocusOut"||t=="onFocusIn"?i.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?o?n.u=o.u:(n.u=Z,e.addEventListener(t,r?K:J,r)):e.removeEventListener(t,r?K:J,r);else {if(_=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===false&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n));}}function ce(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=Z++;else if(t.t<n.u)return;return n(d.event?d.event(t):t)}}}function Y(e,t,n,o,_,r,i,l,u,s){var c,a,p,f,b,x,k,m,h,N,E,O,A,ae,z,L,G,w=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(u=!!(32&n.__u),r=[l=t.__e=n.__e]),(c=d.__b)&&c(t);e:if(typeof w=="function")try{if(m=t.props,h="prototype"in w&&w.prototype.render,N=(c=w.contextType)&&o[c.__c],E=c?N?N.props.value:c.__:o,n.__c?k=(a=t.__c=n.__c).__=a.__E:(h?t.__c=a=new w(m,E):(t.__c=a=new V(m,E),a.constructor=w,a.render=qe),N&&N.sub(a),a.state||(a.state={}),a.__n=o,p=a.__d=!0,a.__h=[],a._sb=[]),h&&a.__s==null&&(a.__s=a.state),h&&w.getDerivedStateFromProps!=null&&(a.__s==a.state&&(a.__s=C({},a.__s)),C(a.__s,w.getDerivedStateFromProps(m,a.__s))),f=a.props,b=a.state,a.__v=t,p)h&&w.getDerivedStateFromProps==null&&a.componentWillMount!=null&&a.componentWillMount(),h&&a.componentDidMount!=null&&a.__h.push(a.componentDidMount);else {if(h&&w.getDerivedStateFromProps==null&&m!==f&&a.componentWillReceiveProps!=null&&a.componentWillReceiveProps(m,E),t.__v==n.__v||!a.__e&&a.shouldComponentUpdate!=null&&a.shouldComponentUpdate(m,a.__s,E)===!1){for(t.__v!=n.__v&&(a.props=m,a.state=a.__s,a.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(D){D&&(D.__=t);}),O=0;O<a._sb.length;O++)a.__h.push(a._sb[O]);a._sb=[],a.__h.length&&i.push(a);break e}a.componentWillUpdate!=null&&a.componentWillUpdate(m,a.__s,E),h&&a.componentDidUpdate!=null&&a.__h.push(function(){a.componentDidUpdate(f,b,x);});}if(a.context=E,a.props=m,a.__P=e,a.__e=!1,A=d.__r,ae=0,h){for(a.state=a.__s,a.__d=!1,A&&A(t),c=a.render(a.props,a.state,a.context),z=0;z<a._sb.length;z++)a.__h.push(a._sb[z]);a._sb=[];}else do a.__d=!1,A&&A(t),c=a.render(a.props,a.state,a.context),a.state=a.__s;while(a.__d&&++ae<25);a.state=a.__s,a.getChildContext!=null&&(o=C(C({},o),a.getChildContext())),h&&!p&&a.getSnapshotBeforeUpdate!=null&&(x=a.getSnapshotBeforeUpdate(f,b)),L=c,c!=null&&c.type===S&&c.key==null&&(L=ke(c.props.children)),l=ye(e,$(L)?L:[L],t,n,o,_,r,i,l,u,s),a.base=t.__e,t.__u&=-161,a.__h.length&&i.push(a),k&&(a.__E=a.__=null);}catch(D){if(t.__v=null,u||r!=null)if(D.then){for(t.__u|=u?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;r[r.indexOf(l)]=null,t.__e=l;}else {for(G=r.length;G--;)X(r[G]);Q(t);}else t.__e=n.__e,t.__k=n.__k,D.then||Q(t);d.__e(D,t,n);}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=Ie(n.__e,t,n,o,_,r,i,u,s);return (c=d.diffed)&&c(t),128&t.__u?void 0:l}function Q(e){e&&e.__c&&(e.__c.__e=true),e&&e.__k&&e.__k.forEach(Q);}function be(e,t,n){for(var o=0;o<n.length;o++)ee(n[o],n[++o],n[++o]);d.__c&&d.__c(t,e),e.some(function(_){try{e=_.__h,_.__h=[],e.some(function(r){r.call(_);});}catch(r){d.__e(r,_.__v);}});}function ke(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:$(e)?e.map(ke):C({},e)}function Ie(e,t,n,o,_,r,i,l,u){var s,c,a,p,f,b,x,k=n.props||F,m=t.props,h=t.type;if(h=="svg"?_="http://www.w3.org/2000/svg":h=="math"?_="http://www.w3.org/1998/Math/MathML":_||(_="http://www.w3.org/1999/xhtml"),r!=null){for(s=0;s<r.length;s++)if((f=r[s])&&"setAttribute"in f==!!h&&(h?f.localName==h:f.nodeType==3)){e=f,r[s]=null;break}}if(e==null){if(h==null)return document.createTextNode(m);e=document.createElementNS(_,h,m.is&&m),l&&(d.__m&&d.__m(t,r),l=false),r=null;}if(h==null)k===m||l&&e.data==m||(e.data=m);else {if(r=r&&U.call(e.childNodes),!l&&r!=null)for(k={},s=0;s<e.attributes.length;s++)k[(f=e.attributes[s]).name]=f.value;for(s in k)if(f=k[s],s!="children"){if(s=="dangerouslySetInnerHTML")a=f;else if(!(s in m)){if(s=="value"&&"defaultValue"in m||s=="checked"&&"defaultChecked"in m)continue;R(e,s,null,f,_);}}for(s in m)f=m[s],s=="children"?p=f:s=="dangerouslySetInnerHTML"?c=f:s=="value"?b=f:s=="checked"?x=f:l&&typeof f!="function"||k[s]===f||R(e,s,f,k[s],_);if(c)l||a&&(c.__html==a.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(a&&(e.innerHTML=""),ye(t.type=="template"?e.content:e,$(p)?p:[p],t,n,o,h=="foreignObject"?"http://www.w3.org/1999/xhtml":_,r,i,r?r[0]:n.__k&&T(n,0),l,u),r!=null)for(s=r.length;s--;)X(r[s]);l||(s="value",h=="progress"&&b==null?e.removeAttribute("value"):b!=null&&(b!==e[s]||h=="progress"&&!b||h=="option"&&b!=k[s])&&R(e,s,b,k[s],_),s="checked",x!=null&&x!=e[s]&&R(e,s,x,k[s],_));}return e}function ee(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t));}else e.current=t;}catch(_){d.__e(_,n);}}function xe(e,t,n){var o,_;if(d.unmount&&d.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||ee(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount();}catch(r){d.__e(r,t);}o.base=o.__P=null;}if(o=e.__k)for(_=0;_<o.length;_++)o[_]&&xe(o[_],t,n||typeof e.type!="function");n||X(e.__e),e.__c=e.__=e.__e=void 0;}function qe(e,t,n){return this.constructor(e,n)}function M(e,t,n){var o,_,r,i;t==document&&(t=document.documentElement),d.__&&d.__(e,t),_=(o=typeof n=="function")?null:n&&n.__k||t.__k,r=[],i=[],Y(t,e=(!o&&n||t).__k=P(S,null,[e]),_||F,F,t.namespaceURI,!o&&n?[n]:_?null:t.firstChild?U.call(t.childNodes):null,r,!o&&n?n:_?_.__e:t.firstChild,o,i),be(r,e,i);}function te(e,t){M(e,t,te);}function ne(e,t,n){var o,_,r,i,l=C({},e.props);for(r in e.type&&e.type.defaultProps&&(i=e.type.defaultProps),t)r=="key"?o=t[r]:r=="ref"?_=t[r]:l[r]=t[r]===void 0&&i!=null?i[r]:t[r];return arguments.length>2&&(l.children=arguments.length>3?U.call(arguments,2):n),j(e.type,l,o||e.key,_||e.ref,null)}U=me.slice,d={__e:function(e,t,n,o){for(var _,r,i;t=t.__;)if((_=t.__c)&&!_.__)try{if((r=_.constructor)&&r.getDerivedStateFromError!=null&&(_.setState(r.getDerivedStateFromError(e)),i=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(e,o||{}),i=_.__d),i)return _.__E=_}catch(l){e=l;}throw e}},fe=0,V.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=C({},this.state),typeof e=="function"&&(e=e(C({},n),this.props)),e&&C(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),le(this));},V.prototype.forceUpdate=function(e){this.__v&&(this.__e=true,e&&this.__h.push(e),le(this));},V.prototype.render=S,H=[],pe=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,de=function(e,t){return e.__v.__b-t.__v.__b},W.__r=0,he=/(PointerCapture)$|Capture$/i,Z=0,J=ce(false),K=ce(true);var I,y,re,we,oe=0,Te=[],g=d,Ce=g.__b,Ne=g.__r,Se=g.diffed,Ee=g.__c,He=g.unmount,Pe=g.__;function Ae(e,t){g.__h&&g.__h(y,e,oe||t),oe=0;var n=y.__H||(y.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ie(e){return oe=1,Ge(je,e)}function Ge(e,t,n){var o=Ae(I++,2);if(o.t=e,!o.__c&&(o.__=[je(void 0,t),function(l){var u=o.__N?o.__N[0]:o.__[0],s=o.t(u,l);u!==s&&(o.__N=[s,o.__[1]],o.__c.setState({}));}],o.__c=y,!y.__f)){var _=function(l,u,s){if(!o.__c.__H)return true;var c=o.__c.__H.__.filter(function(p){return !!p.__c});if(c.every(function(p){return !p.__N}))return !r||r.call(this,l,u,s);var a=o.__c.props!==l;return c.forEach(function(p){if(p.__N){var f=p.__[0];p.__=p.__N,p.__N=void 0,f!==p.__[0]&&(a=true);}}),r&&r.call(this,l,u,s)||a};y.__f=true;var r=y.shouldComponentUpdate,i=y.componentWillUpdate;y.componentWillUpdate=function(l,u,s){if(this.__e){var c=r;r=void 0,_(l,u,s),r=c;}i&&i.call(this,l,u,s);},y.shouldComponentUpdate=_;}return o.__N||o.__}function Le(e,t){var n=Ae(I++,3);!g.__s&&Qe(n.__H,t)&&(n.__=e,n.u=t,y.__H.__h.push(n));}function Je(){for(var e;e=Te.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(B),e.__H.__h.forEach(_e),e.__H.__h=[];}catch(t){e.__H.__h=[],g.__e(t,e.__v);}}g.__b=function(e){y=null,Ce&&Ce(e);},g.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Pe&&Pe(e,t);},g.__r=function(e){Ne&&Ne(e),I=0;var t=(y=e.__c).__H;t&&(re===y?(t.__h=[],y.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0;})):(t.__h.forEach(B),t.__h.forEach(_e),t.__h=[],I=0)),re=y;},g.diffed=function(e){Se&&Se(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Te.push(t)!==1&&we===g.requestAnimationFrame||((we=g.requestAnimationFrame)||Ke)(Je)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0;})),re=y=null;},g.__c=function(e,t){t.some(function(n){try{n.__h.forEach(B),n.__h=n.__h.filter(function(o){return !o.__||_e(o)});}catch(o){t.some(function(_){_.__h&&(_.__h=[]);}),t=[],g.__e(o,n.__v);}}),Ee&&Ee(e,t);},g.unmount=function(e){He&&He(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(o){try{B(o);}catch(_){t=_;}}),n.__H=void 0,t&&g.__e(t,n.__v));};var De=typeof requestAnimationFrame=="function";function Ke(e){var t,n=function(){clearTimeout(o),De&&cancelAnimationFrame(t),setTimeout(e);},o=setTimeout(n,35);De&&(t=requestAnimationFrame(n));}function B(e){var t=y,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),y=t;}function _e(e){var t=y;e.__c=e.__(),y=t;}function Qe(e,t){return !e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function je(e,t){return typeof t=="function"?t(e):t}function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);}return e},q.apply(this,arguments)}function Ue(e,t){if(e==null)return {};var n,o,_={},r=Object.keys(e);for(o=0;o<r.length;o++)t.indexOf(n=r[o])>=0||(_[n]=e[n]);return _}var Ze=["context","children"],Xe=["useFragment"];function Me(e,t,n,o){function _(){var r,i=Reflect.construct(HTMLElement,[],_);return i._vdomComponent=e,o&&o.shadow?(i._root=i.attachShadow({mode:o.mode||"open",serializable:(r=o.serializable)!=null&&r}),o.adoptedStyleSheets&&(i._root.adoptedStyleSheets=o.adoptedStyleSheets)):i._root=i,i}return (_.prototype=Object.create(HTMLElement.prototype)).constructor=_,_.prototype.connectedCallback=function(){et.call(this,o);},_.prototype.attributeChangedCallback=tt,_.prototype.disconnectedCallback=nt,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),_.observedAttributes=n,e.formAssociated&&(_.formAssociated=true),n.forEach(function(r){Object.defineProperty(_.prototype,r,{get:function(){return this._vdom?this._vdom.props[r]:this._props[r]},set:function(i){this._vdom?this.attributeChangedCallback(r,null,i):(this._props||(this._props={}),this._props[r]=i);var l=typeof i;i!=null&&l!=="string"&&l!=="boolean"&&l!=="number"||this.setAttribute(r,i);}});}),customElements.define(t,_),_}function Ye(e){this.getChildContext=function(){return e.context};var t=e.children,n=Ue(e,Ze);return ne(t,n)}function et(e){var t=new CustomEvent("_preact",{detail:{},bubbles:true,cancelable:true});this.dispatchEvent(t),this._vdom=P(Ye,q({},this._props,{context:t.detail.context}),ze(this,this._vdomComponent,e)),(this.hasAttribute("hydrate")?te:M)(this._vdom,this._root);}function Oe(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function tt(e,t,n){if(this._vdom){var o={};o[e]=n=n??void 0,o[Oe(e)]=n,this._vdom=ne(this._vdom,o),M(this._vdom,this._root);}}function nt(){M(this._vdom=null,this._root);}function Fe(e,t){var n=this,o=e.useFragment,_=Ue(e,Xe);return P(o?S:"slot",q({},_,{ref:function(r){r?(n.ref=r,n._listener||(n._listener=function(i){i.stopPropagation(),i.detail.context=t;},r.addEventListener("_preact",n._listener))):n.ref.removeEventListener("_preact",n._listener);}}))}function ze(e,t,n){if(e.nodeType===3)return e.data;if(e.nodeType!==1)return null;var o=[],_={},r=0,i=e.attributes,l=e.childNodes;for(r=i.length;r--;)i[r].name!=="slot"&&(_[i[r].name]=i[r].value,_[Oe(i[r].name)]=i[r].value);for(r=l.length;r--;){var u=ze(l[r],null,n),s=l[r].slot;s?_[s]=P(Fe,{name:s},u):o[r]=u;}var c=!(!n||!n.shadow),a=t?P(Fe,{useFragment:!c},o):o;return !c&&t&&(e.innerHTML=""),P(t||e.nodeName.toLowerCase(),_,a)}var rt=0;function v(e,t,n,o,_,r){t||(t={});var i,l,u=t;if("ref"in u)for(l in u={},t)l=="ref"?i=t[l]:u[l]=t[l];var s={type:e,props:u,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--rt,__i:-1,__u:0,__source:_,__self:r};if(typeof e=="function"&&(i=e.defaultProps))for(l in i)u[l]===void 0&&(u[l]=i[l]);return d.vnode&&d.vnode(s),s}var ot=({cardlink:e,friends:t=[]})=>{let[n,o]=ie(null),[_,r]=ie([]);return Le(()=>{let i=typeof t=="string"?JSON.parse(t):t;fetch(e).then(l=>l.json()).then(o),Array.isArray(i)&&i.length>0&&Promise.all(i.map(l=>fetch(l).then(u=>u.json()).then(u=>({...u,url:l})))).then(r);},[e,t]),n?v("div",{className:"card",children:v("div",{className:"inner",children:[v("div",{className:"header",children:[v("span",{className:"year",children:"20"}),v("span",{className:"year",children:"26"})]}),v("div",{className:"header",children:v("h2",{className:"libraryTitle",children:n.library.name})}),v("div",{className:"fieldGroup",children:[v("p",{className:"fieldValue nameValue",children:n.borrower}),v("label",{className:"label",children:"Borrower's Name"})]}),v("div",{className:"fieldGroup",children:[v("p",{className:"fieldValue signatureValue",children:n.library.signature}),v("label",{className:"label",children:"Librarian's Signature"})]}),v("div",{className:"bookSection",children:v("ul",{className:"bookList",children:n.books.map((i,l)=>{console.log("friendsData",_,n);let u=_.filter(s=>s.books.some(c=>c.key===i.key));return console.log("readersOfThisBook",u),v("li",{className:"bookRow",children:[v("span",{className:"bookName",children:[i.name," by ",i.author]}),v("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:[v("span",{className:"bookDate",children:i.finishedDate}),v("div",{className:"friendSignatures",children:u.length>0&&v("div",{className:"friendSignatures",children:u.map((s,c)=>v("a",{href:s.url?new URL(s.url).origin:"#",className:"signatureLink",title:`${s.borrower} also read this`,target:"_blank",rel:"noopener noreferrer",children:s.library.signature},c))})})]})]},l)})})})]})}):v("div",{className:"loading",children:"Loading library card..."})};Me(ot,"x-library-card",["cardlink","friends"],{shadow:false});
2
- exports.LibraryCard=ot;return exports;})({});
1
+ (function(exports){'use strict';var M,v,pe,H,le,de,he,me,Z,J,K,F={},ve=[],Re=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,R=Array.isArray;function C(e,t){for(var n in t)e[n]=t[n];return e}function X(e){e&&e.parentNode&&e.parentNode.removeChild(e);}function T(e,t,n){var o,_,r,a={};for(r in t)r=="key"?o=t[r]:r=="ref"?_=t[r]:a[r]=t[r];if(arguments.length>2&&(a.children=arguments.length>3?M.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)a[r]===void 0&&(a[r]=e.defaultProps[r]);return L(e,a,o,_,null)}function L(e,t,n,o,_){var r={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:_??++pe,__i:-1,__u:0};return _==null&&v.vnode!=null&&v.vnode(r),r}function N(e){return e.children}function W(e,t){this.props=e,this.context=t;}function A(e,t){if(t==null)return e.__?A(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?A(e):null}function ye(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return ye(e)}}function ce(e){(!e.__d&&(e.__d=true)&&H.push(e)&&!I.__r++||le!=v.debounceRendering)&&((le=v.debounceRendering)||de)(I);}function I(){for(var e,t,n,o,_,r,a,s=1;H.length;)H.length>s&&H.sort(he),e=H.shift(),s=H.length,e.__d&&(n=void 0,o=void 0,_=(o=(t=e).__v).__e,r=[],a=[],t.__P&&((n=C({},o)).__v=o.__v+1,v.vnode&&v.vnode(n),ee(t.__P,n,o,t.__n,t.__P.namespaceURI,32&o.__u?[_]:null,r,_??A(o),!!(32&o.__u),a),n.__v=o.__v,n.__.__k[n.__i]=n,ke(r,n,a),o.__e=o.__=null,n.__e!=_&&ye(n)));I.__r=0;}function ge(e,t,n,o,_,r,a,s,u,l,f){var i,p,c,d,k,g,h,y=o&&o.__k||ve,S=t.length;for(u=Be(n,t,y,u,S),i=0;i<S;i++)(c=n.__k[i])!=null&&(p=c.__i==-1?F:y[c.__i]||F,c.__i=i,g=ee(e,c,p,_,r,a,s,u,l,f),d=c.__e,c.ref&&p.ref!=c.ref&&(p.ref&&te(p.ref,null,c),f.push(c.ref,c.__c||d,c)),k==null&&d!=null&&(k=d),(h=!!(4&c.__u))||p.__k===c.__k?u=be(c,u,e,h):typeof c.type=="function"&&g!==void 0?u=g:d&&(u=d.nextSibling),c.__u&=-7);return n.__e=k,u}function Be(e,t,n,o,_){var r,a,s,u,l,f=n.length,i=f,p=0;for(e.__k=new Array(_),r=0;r<_;r++)(a=t[r])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[r]=L(null,a,null,null,null):R(a)?a=e.__k[r]=L(N,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=L(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[r]=a,u=r+p,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=$e(a,n,u,i))!=-1&&(i--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(_>f?p--:_<f&&p++),typeof a.type!="function"&&(a.__u|=4)):l!=u&&(l==u-1?p--:l==u+1?p++:(l>u?p--:p++,a.__u|=4))):e.__k[r]=null;if(i)for(r=0;r<f;r++)(s=n[r])!=null&&(2&s.__u)==0&&(s.__e==o&&(o=A(s)),we(s,s));return o}function be(e,t,n,o){var _,r;if(typeof e.type=="function"){for(_=e.__k,r=0;_&&r<_.length;r++)_[r]&&(_[r].__=e,t=be(_[r],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=A(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function $e(e,t,n,o){var _,r,a,s=e.key,u=e.type,l=t[n],f=l!=null&&(2&l.__u)==0;if(l===null&&s==null||f&&s==l.key&&u==l.type)return n;if(o>(f?1:0)){for(_=n-1,r=n+1;_>=0||r<t.length;)if((l=t[a=_>=0?_--:r++])!=null&&(2&l.__u)==0&&s==l.key&&u==l.type)return a}return -1}function ue(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Re.test(t)?n:n+"px";}function V(e,t,n,o,_){var r,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else {if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||ue(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||ue(e.style,t,n[t]);}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(me,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?o?n.u=o.u:(n.u=Z,e.addEventListener(t,r?K:J,r)):e.removeEventListener(t,r?K:J,r);else {if(_=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===false&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n));}}function fe(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=Z++;else if(t.t<n.u)return;return n(v.event?v.event(t):t)}}}function ee(e,t,n,o,_,r,a,s,u,l){var f,i,p,c,d,k,g,h,y,S,E,O,j,se,z,D,G,w=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(u=!!(32&n.__u),r=[s=t.__e=n.__e]),(f=v.__b)&&f(t);e:if(typeof w=="function")try{if(h=t.props,y="prototype"in w&&w.prototype.render,S=(f=w.contextType)&&o[f.__c],E=f?S?S.props.value:f.__:o,n.__c?g=(i=t.__c=n.__c).__=i.__E:(y?t.__c=i=new w(h,E):(t.__c=i=new W(h,E),i.constructor=w,i.render=Ye),S&&S.sub(i),i.state||(i.state={}),i.__n=o,p=i.__d=!0,i.__h=[],i._sb=[]),y&&i.__s==null&&(i.__s=i.state),y&&w.getDerivedStateFromProps!=null&&(i.__s==i.state&&(i.__s=C({},i.__s)),C(i.__s,w.getDerivedStateFromProps(h,i.__s))),c=i.props,d=i.state,i.__v=t,p)y&&w.getDerivedStateFromProps==null&&i.componentWillMount!=null&&i.componentWillMount(),y&&i.componentDidMount!=null&&i.__h.push(i.componentDidMount);else {if(y&&w.getDerivedStateFromProps==null&&h!==c&&i.componentWillReceiveProps!=null&&i.componentWillReceiveProps(h,E),t.__v==n.__v||!i.__e&&i.shouldComponentUpdate!=null&&i.shouldComponentUpdate(h,i.__s,E)===!1){for(t.__v!=n.__v&&(i.props=h,i.state=i.__s,i.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(P){P&&(P.__=t);}),O=0;O<i._sb.length;O++)i.__h.push(i._sb[O]);i._sb=[],i.__h.length&&a.push(i);break e}i.componentWillUpdate!=null&&i.componentWillUpdate(h,i.__s,E),y&&i.componentDidUpdate!=null&&i.__h.push(function(){i.componentDidUpdate(c,d,k);});}if(i.context=E,i.props=h,i.__P=e,i.__e=!1,j=v.__r,se=0,y){for(i.state=i.__s,i.__d=!1,j&&j(t),f=i.render(i.props,i.state,i.context),z=0;z<i._sb.length;z++)i.__h.push(i._sb[z]);i._sb=[];}else do i.__d=!1,j&&j(t),f=i.render(i.props,i.state,i.context),i.state=i.__s;while(i.__d&&++se<25);i.state=i.__s,i.getChildContext!=null&&(o=C(C({},o),i.getChildContext())),y&&!p&&i.getSnapshotBeforeUpdate!=null&&(k=i.getSnapshotBeforeUpdate(c,d)),D=f,f!=null&&f.type===N&&f.key==null&&(D=xe(f.props.children)),s=ge(e,R(D)?D:[D],t,n,o,_,r,a,s,u,l),i.base=t.__e,t.__u&=-161,i.__h.length&&a.push(i),g&&(i.__E=i.__=null);}catch(P){if(t.__v=null,u||r!=null)if(P.then){for(t.__u|=u?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;r[r.indexOf(s)]=null,t.__e=s;}else {for(G=r.length;G--;)X(r[G]);Q(t);}else t.__e=n.__e,t.__k=n.__k,P.then||Q(t);v.__e(P,t,n);}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=qe(n.__e,t,n,o,_,r,a,u,l);return (f=v.diffed)&&f(t),128&t.__u?void 0:s}function Q(e){e&&e.__c&&(e.__c.__e=true),e&&e.__k&&e.__k.forEach(Q);}function ke(e,t,n){for(var o=0;o<n.length;o++)te(n[o],n[++o],n[++o]);v.__c&&v.__c(t,e),e.some(function(_){try{e=_.__h,_.__h=[],e.some(function(r){r.call(_);});}catch(r){v.__e(r,_.__v);}});}function xe(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:R(e)?e.map(xe):C({},e)}function qe(e,t,n,o,_,r,a,s,u){var l,f,i,p,c,d,k,g=n.props||F,h=t.props,y=t.type;if(y=="svg"?_="http://www.w3.org/2000/svg":y=="math"?_="http://www.w3.org/1998/Math/MathML":_||(_="http://www.w3.org/1999/xhtml"),r!=null){for(l=0;l<r.length;l++)if((c=r[l])&&"setAttribute"in c==!!y&&(y?c.localName==y:c.nodeType==3)){e=c,r[l]=null;break}}if(e==null){if(y==null)return document.createTextNode(h);e=document.createElementNS(_,y,h.is&&h),s&&(v.__m&&v.__m(t,r),s=false),r=null;}if(y==null)g===h||s&&e.data==h||(e.data=h);else {if(r=r&&M.call(e.childNodes),!s&&r!=null)for(g={},l=0;l<e.attributes.length;l++)g[(c=e.attributes[l]).name]=c.value;for(l in g)if(c=g[l],l!="children"){if(l=="dangerouslySetInnerHTML")i=c;else if(!(l in h)){if(l=="value"&&"defaultValue"in h||l=="checked"&&"defaultChecked"in h)continue;V(e,l,null,c,_);}}for(l in h)c=h[l],l=="children"?p=c:l=="dangerouslySetInnerHTML"?f=c:l=="value"?d=c:l=="checked"?k=c:s&&typeof c!="function"||g[l]===c||V(e,l,c,g[l],_);if(f)s||i&&(f.__html==i.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(i&&(e.innerHTML=""),ge(t.type=="template"?e.content:e,R(p)?p:[p],t,n,o,y=="foreignObject"?"http://www.w3.org/1999/xhtml":_,r,a,r?r[0]:n.__k&&A(n,0),s,u),r!=null)for(l=r.length;l--;)X(r[l]);s||(l="value",y=="progress"&&d==null?e.removeAttribute("value"):d!=null&&(d!==e[l]||y=="progress"&&!d||y=="option"&&d!=g[l])&&V(e,l,d,g[l],_),l="checked",k!=null&&k!=e[l]&&V(e,l,k,g[l],_));}return e}function te(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t));}else e.current=t;}catch(_){v.__e(_,n);}}function we(e,t,n){var o,_;if(v.unmount&&v.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||te(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount();}catch(r){v.__e(r,t);}o.base=o.__P=null;}if(o=e.__k)for(_=0;_<o.length;_++)o[_]&&we(o[_],t,n||typeof e.type!="function");n||X(e.__e),e.__c=e.__=e.__e=void 0;}function Ye(e,t,n){return this.constructor(e,n)}function U(e,t,n){var o,_,r,a;t==document&&(t=document.documentElement),v.__&&v.__(e,t),_=(o=typeof n=="function")?null:n&&n.__k||t.__k,r=[],a=[],ee(t,e=(!o&&n||t).__k=T(N,null,[e]),_||F,F,t.namespaceURI,!o&&n?[n]:_?null:t.firstChild?M.call(t.childNodes):null,r,!o&&n?n:_?_.__e:t.firstChild,o,a),ke(r,e,a);}function ne(e,t){U(e,t,ne);}function oe(e,t,n){var o,_,r,a,s=C({},e.props);for(r in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)r=="key"?o=t[r]:r=="ref"?_=t[r]:s[r]=t[r]===void 0&&a!=null?a[r]:t[r];return arguments.length>2&&(s.children=arguments.length>3?M.call(arguments,2):n),L(e.type,s,o||e.key,_||e.ref,null)}M=ve.slice,v={__e:function(e,t,n,o){for(var _,r,a;t=t.__;)if((_=t.__c)&&!_.__)try{if((r=_.constructor)&&r.getDerivedStateFromError!=null&&(_.setState(r.getDerivedStateFromError(e)),a=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(e,o||{}),a=_.__d),a)return _.__E=_}catch(s){e=s;}throw e}},pe=0,W.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=C({},this.state),typeof e=="function"&&(e=e(C({},n),this.props)),e&&C(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ce(this));},W.prototype.forceUpdate=function(e){this.__v&&(this.__e=true,e&&this.__h.push(e),ce(this));},W.prototype.render=N,H=[],de=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,he=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0,me=/(PointerCapture)$|Capture$/i,Z=0,J=fe(false),K=fe(true);var $,b,re,Ce,_e=0,je=[],x=v,Ne=x.__b,Se=x.__r,Ee=x.diffed,He=x.__c,Te=x.unmount,Pe=x.__;function De(e,t){x.__h&&x.__h(b,e,_e||t),_e=0;var n=b.__H||(b.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function q(e){return _e=1,Ge(Fe,e)}function Ge(e,t,n){var o=De($++,2);if(o.t=e,!o.__c&&(o.__=[Fe(void 0,t),function(s){var u=o.__N?o.__N[0]:o.__[0],l=o.t(u,s);u!==l&&(o.__N=[l,o.__[1]],o.__c.setState({}));}],o.__c=b,!b.__f)){var _=function(s,u,l){if(!o.__c.__H)return true;var f=o.__c.__H.__.filter(function(p){return !!p.__c});if(f.every(function(p){return !p.__N}))return !r||r.call(this,s,u,l);var i=o.__c.props!==s;return f.forEach(function(p){if(p.__N){var c=p.__[0];p.__=p.__N,p.__N=void 0,c!==p.__[0]&&(i=true);}}),r&&r.call(this,s,u,l)||i};b.__f=true;var r=b.shouldComponentUpdate,a=b.componentWillUpdate;b.componentWillUpdate=function(s,u,l){if(this.__e){var f=r;r=void 0,_(s,u,l),r=f;}a&&a.call(this,s,u,l);},b.shouldComponentUpdate=_;}return o.__N||o.__}function Le(e,t){var n=De($++,3);!x.__s&&Qe(n.__H,t)&&(n.__=e,n.u=t,b.__H.__h.push(n));}function Je(){for(var e;e=je.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(B),e.__H.__h.forEach(ie),e.__H.__h=[];}catch(t){e.__H.__h=[],x.__e(t,e.__v);}}x.__b=function(e){b=null,Ne&&Ne(e);},x.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Pe&&Pe(e,t);},x.__r=function(e){Se&&Se(e),$=0;var t=(b=e.__c).__H;t&&(re===b?(t.__h=[],b.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0;})):(t.__h.forEach(B),t.__h.forEach(ie),t.__h=[],$=0)),re=b;},x.diffed=function(e){Ee&&Ee(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(je.push(t)!==1&&Ce===x.requestAnimationFrame||((Ce=x.requestAnimationFrame)||Ke)(Je)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0;})),re=b=null;},x.__c=function(e,t){t.some(function(n){try{n.__h.forEach(B),n.__h=n.__h.filter(function(o){return !o.__||ie(o)});}catch(o){t.some(function(_){_.__h&&(_.__h=[]);}),t=[],x.__e(o,n.__v);}}),He&&He(e,t);},x.unmount=function(e){Te&&Te(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(o){try{B(o);}catch(_){t=_;}}),n.__H=void 0,t&&x.__e(t,n.__v));};var Ae=typeof requestAnimationFrame=="function";function Ke(e){var t,n=function(){clearTimeout(o),Ae&&cancelAnimationFrame(t),setTimeout(e);},o=setTimeout(n,35);Ae&&(t=requestAnimationFrame(n));}function B(e){var t=b,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),b=t;}function ie(e){var t=b;e.__c=e.__(),b=t;}function Qe(e,t){return !e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Fe(e,t){return typeof t=="function"?t(e):t}function ae(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",t==="top"&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e));}ae(`.card{position:relative;width:auto;min-width:380px;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;transition:opacity .2s ease-in-out}.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:16px;display:flex;top:-4px}.signatureLink{font-size:1.125rem;transition:transform .2s;text-decoration:none;color:inherit}.signatureLink:hover{transform:scale(1.25);z-index:10}.card-container{display:flex;flex-direction:column;align-items:center;gap:10px}.nav-controls{display:flex;align-items:center;gap:20px}.nav-controls button{background:none;border:1px solid #ccc;border-radius:50%;width:30px;height:30px;cursor:pointer;transition:opacity .2s}.nav-controls button:disabled{opacity:.2;cursor:not-allowed}.current-view-label{font-family:monospace;font-weight:700;text-transform:uppercase;letter-spacing:1px}.header{display:flex;justify-content:space-between;width:100%}
2
+ `);function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);}return e},Y.apply(this,arguments)}function Ue(e,t){if(e==null)return {};var n,o,_={},r=Object.keys(e);for(o=0;o<r.length;o++)t.indexOf(n=r[o])>=0||(_[n]=e[n]);return _}var Ze=["context","children"],Xe=["useFragment"];function Oe(e,t,n,o){function _(){var a=Reflect.construct(HTMLElement,[],_);return a._vdomComponent=e,a._root=a,a}return (_.prototype=Object.create(HTMLElement.prototype)).constructor=_,_.prototype.connectedCallback=function(){tt.call(this,o);},_.prototype.attributeChangedCallback=nt,_.prototype.disconnectedCallback=ot,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),_.observedAttributes=n,e.formAssociated&&(_.formAssociated=true),n.forEach(function(r){Object.defineProperty(_.prototype,r,{get:function(){return this._vdom?this._vdom.props[r]:this._props[r]},set:function(a){this._vdom?this.attributeChangedCallback(r,null,a):(this._props||(this._props={}),this._props[r]=a);var s=typeof a;a!=null&&s!=="string"&&s!=="boolean"&&s!=="number"||this.setAttribute(r,a);}});}),customElements.define(t,_),_}function et(e){this.getChildContext=function(){return e.context};var t=e.children,n=Ue(e,Ze);return oe(t,n)}function tt(e){var t=new CustomEvent("_preact",{detail:{},bubbles:true,cancelable:true});this.dispatchEvent(t),this._vdom=T(et,Y({},this._props,{context:t.detail.context}),Ve(this,this._vdomComponent,e)),(this.hasAttribute("hydrate")?ne:U)(this._vdom,this._root);}function ze(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function nt(e,t,n){if(this._vdom){var o={};o[e]=n=n??void 0,o[ze(e)]=n,this._vdom=oe(this._vdom,o),U(this._vdom,this._root);}}function ot(){U(this._vdom=null,this._root);}function Me(e,t){var n=this,o=e.useFragment,_=Ue(e,Xe);return T(o?N:"slot",Y({},_,{ref:function(r){r?(n.ref=r,n._listener||(n._listener=function(a){a.stopPropagation(),a.detail.context=t;},r.addEventListener("_preact",n._listener))):n.ref.removeEventListener("_preact",n._listener);}}))}function Ve(e,t,n){if(e.nodeType===3)return e.data;if(e.nodeType!==1)return null;var o=[],_={},r=0,a=e.attributes,s=e.childNodes;for(r=a.length;r--;)a[r].name!=="slot"&&(_[a[r].name]=a[r].value,_[ze(a[r].name)]=a[r].value);for(r=s.length;r--;){var u=Ve(s[r],null,n),l=s[r].slot;l?_[l]=T(Me,{name:l},u):o[r]=u;}var f=!(!n||!n.shadow),i=t?T(Me,{useFragment:!f},o):o;return !f&&t&&(e.innerHTML=""),T(t||e.nodeName.toLowerCase(),_,i)}var rt=0;function m(e,t,n,o,_,r){t||(t={});var a,s,u=t;if("ref"in u)for(s in u={},t)s=="ref"?a=t[s]:u[s]=t[s];var l={type:e,props:u,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--rt,__i:-1,__u:0,__source:_,__self:r};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)u[s]===void 0&&(u[s]=a[s]);return v.vnode&&v.vnode(l),l}var _t=({cardlink:e,friends:t=[],hidenav:n=false})=>{let[o,_]=q(null),[r,a]=q([]),[s,u]=q(new Date().getFullYear().toString());if(Le(()=>{let c=typeof t=="string"?JSON.parse(t):t;fetch(e).then(d=>d.json()).then(d=>{_(d);let k=Object.keys(d.years).sort(),g=k[k.length-1];u(h=>h&&d.years[h]?h:g);}),Array.isArray(c)&&c.length>0&&Promise.all(c.map(d=>fetch(d).then(k=>k.json()).then(k=>({...k,url:d})))).then(a);},[e,t]),!o)return m("div",{className:"loading",children:"Loading..."});let l=Object.keys(o.years).sort((c,d)=>Number(c)-Number(d)),f=l.indexOf(s),i=o.years[s]||[],p=c=>{let d=f+c;d>=0&&d<l.length&&u(l[d]);};return m("div",{className:"card-container",children:[!n&&m(N,{children:m("div",{className:"nav-controls",children:[m("button",{class:"btn-left",onClick:()=>p(-1),disabled:f===0,children:"\u2190"}),m("button",{class:"btn-right",onClick:()=>p(1),disabled:f===l.length-1,children:"\u2192"})]})}),m("div",{className:"card",children:m("div",{className:"inner",children:[m("div",{className:"header",children:[m("span",{className:"year",children:s.slice(0,2)}),m("span",{className:"year",children:s.slice(2,4)})]}),m("div",{className:"header",children:m("h2",{className:"libraryTitle",children:o.library.name})}),m("div",{className:"fieldGroup",children:[m("p",{className:"fieldValue nameValue",children:o.borrower}),m("label",{className:"label",children:"Borrower's Name"})]}),m("div",{className:"fieldGroup",children:[m("p",{className:"fieldValue signatureValue",children:o.library.signature}),m("label",{className:"label",children:"Librarian's Signature"})]}),m("div",{className:"bookSection",children:m("ul",{className:"bookList",children:i.map((c,d)=>{let k=r.filter(g=>{var h;return (h=g.years[s])==null?void 0:h.some(y=>y.key===c.key)});return m("li",{className:"bookRow",children:[m("span",{className:"bookName",children:[c.name," ",m("small",{children:["by ",c.author]})]}),m("div",{className:"bookMeta",children:[m("span",{className:"bookDate",children:c.finishedDate}),m("div",{className:"friendSignatures",children:k.map((g,h)=>m("span",{title:g.borrower,className:"sig",children:g.library.signature},h))})]})]},d)})})})]})})]})};Oe(_t,"x-library-card",["cardlink","friends","hidenav"]);exports.LibraryCard=_t;return exports;})({});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "booary",
3
3
  "private": false,
4
- "version": "6.0.1",
4
+ "version": "8.0.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.global.js",
7
7
  "unpkg": "./dist/index.global.js",
package/dist/index.css DELETED
@@ -1 +0,0 @@
1
- .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:16px;display:flex;top:-4px}.signatureLink{font-size:1.125rem;transition:transform .2s;text-decoration:none;color:inherit}.signatureLink:hover{transform:scale(1.25);z-index:10}