git-truck 3.0.0-0 → 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/LICENSE +21 -21
- package/README.md +44 -44
- package/build/client/assets/FullscreenButton-CFqdBqf-.js +1 -0
- package/build/client/assets/GitTruckInfo-C1VOiqSW.js +1 -0
- package/build/client/assets/RepoTabs-4-CQeS6M.js +1 -0
- package/build/client/assets/UnionAuthorsModal-D-H775E5.js +1 -0
- package/build/client/assets/browse-7BJg-qfM.js +9 -0
- package/build/client/assets/browse-CPjwuHQe.js +1 -0
- package/build/client/assets/chunk-JPUPSTYD-XO4UPun8.js +1 -0
- package/build/client/assets/chunk-LFPYN7LY-CPTP6242.js +26 -0
- package/build/client/assets/clear-cache-82hexQD7.js +1 -0
- package/build/client/assets/clear-cache-CrL0weu5.js +1 -0
- package/build/client/assets/compare-Br3z3FUS-OODPzXmX.js +2 -0
- package/build/client/assets/{entry.client-CeNBN1wN.js → entry.client-NklqTk8N.js} +3 -3
- package/build/client/assets/jsx-runtime-BVRj4wYA.js +1 -0
- package/build/client/assets/manifest-c5f30ffe.js +1 -0
- package/build/client/assets/react-dom-_FKEaPb7.js +1 -0
- package/build/client/assets/{root-DNsTpdCR.js → root-Djh_4EO9.js} +2 -2
- package/build/client/assets/root-qwQAVU-u.css +1 -0
- package/build/client/assets/styling-B8OEge8x.js +1 -0
- package/build/client/assets/{ui-hQKhrcY0.js → ui-CGg0wrDR.js} +1 -1
- package/build/client/assets/util-1G1Ez1rt.js +1 -0
- package/build/client/assets/view-ZFr-KZ5c.js +1 -0
- package/build/client/assets/view._index-CjsEuBV6.js +1 -0
- package/build/client/assets/view.commits-D4Q38_m5.js +1 -0
- package/build/client/assets/view.details-CVK0Sh-y.js +1 -0
- package/build/client/assets/view.merge-authors-VwPHWL-d.js +1 -0
- package/build/server/assets/{server-build-B3xsYUth.js → server-build-SmQQTUGx.js} +3506 -3433
- package/build/server/index.js +1 -1
- package/cli.mjs +11145 -3384
- package/package.json +10 -11
- package/build/client/assets/FullscreenButton-eA5ndnic.js +0 -1
- package/build/client/assets/RepoTabs-Bgf-xuY9.js +0 -1
- package/build/client/assets/browse-DDk8iI78.js +0 -1
- package/build/client/assets/clear-cache-CdwFm6ZE.js +0 -1
- package/build/client/assets/clear-cache-Czl2OQQZ.js +0 -1
- package/build/client/assets/jsx-runtime-ha_HlXYM.js +0 -26
- package/build/client/assets/manifest-4256a673.js +0 -1
- package/build/client/assets/react-dom-BwfFinSy.js +0 -1
- package/build/client/assets/root-D7Ku_Aq-.css +0 -1
- package/build/client/assets/util-lodwDQIO.js +0 -10
- package/build/client/assets/view-CzWNrYQt.js +0 -1
- package/build/client/assets/view._index-l6Xp0UBf.js +0 -1
- package/build/client/assets/view.commits-HFn10ETB.js +0 -1
- package/build/client/assets/view.details-V1cDc3K2.js +0 -1
- package/build/client/assets/view.merge-authors-DBFNXRql.js +0 -1
- /package/build/client/assets/{_index-BnEQn2aI.js → _index-J0jvF8An.js} +0 -0
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 git-truck
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 git-truck
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
# Git Truck 🚛 · [](https://github.com/git-truck/git-truck/blob/main/LICENSE) [](https://www.npmjs.com/git-truck)
|
|
2
|
-
|
|
3
|
-
Git Truck is a tool that provides you with a truckload of visualizations of your git repository.
|
|
4
|
-
|
|
5
|
-
With Git Truck you can:
|
|
6
|
-
|
|
7
|
-
- See who worked on different parts of the project
|
|
8
|
-
- Get an overview of the file structure
|
|
9
|
-
- See where there is the most activity in your project
|
|
10
|
-
- See how your project has looked at different points in time
|
|
11
|
-
|
|
12
|
-
| | |
|
|
13
|
-
| ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
14
|
-
| <img src="./teaser-images/readme1.png" alt="Where has the most work been done recently?"> | <img src="./teaser-images/readme2.png" alt="Who worked on different subsystems in the past?"> |
|
|
15
|
-
|
|
16
|
-
You can read more about the features in the [feature overview](https://git-truck.github.io/git-truck/GitTruckTeaser), [in papers about Git Truck](https://github.com/git-truck/papers/blob/master/README.md), or just try it and start exploring your projects!
|
|
17
|
-
|
|
18
|
-
## [Get started](#get-started)
|
|
19
|
-
|
|
20
|
-
1. In your terminal, navigate to a git repository or a folder containing several repositories
|
|
21
|
-
|
|
22
|
-
2. Run the command `npm install -g git-truck@latest` to install or update Git Truck.
|
|
23
|
-
|
|
24
|
-
3. Now you can run Git Truck using the command `git truck`
|
|
25
|
-
|
|
26
|
-
4. The application will now open in your default browser. Happy trucking!
|
|
27
|
-
|
|
28
|
-
> [!NOTE]
|
|
29
|
-
> To use Git Truck, you will need to have the following programs installed:
|
|
30
|
-
>
|
|
31
|
-
> - [Node.js](https://nodejs.org/en/) 22.0.0 or newer and npm 10.0 or newer
|
|
32
|
-
> - [git](https://git-scm.com/downloads) 2.29 or newer
|
|
33
|
-
>
|
|
34
|
-
> Check your installed versions using `node --version`, `npm --version` and `git --version`.
|
|
35
|
-
|
|
36
|
-
## [What makes Git Truck different?](#what-makes-git-truck-different)
|
|
37
|
-
|
|
38
|
-
🔒 Private by design
|
|
39
|
-
|
|
40
|
-
🏝️ Works offline
|
|
41
|
-
|
|
42
|
-
🤷 Git provider agnostic - works with any git repository
|
|
43
|
-
|
|
44
|
-
😊 No tracking, no ads, no cloud, no servers, no subscription
|
|
1
|
+
# Git Truck 🚛 · [](https://github.com/git-truck/git-truck/blob/main/LICENSE) [](https://www.npmjs.com/git-truck)
|
|
2
|
+
|
|
3
|
+
Git Truck is a tool that provides you with a truckload of visualizations of your git repository.
|
|
4
|
+
|
|
5
|
+
With Git Truck you can:
|
|
6
|
+
|
|
7
|
+
- See who worked on different parts of the project
|
|
8
|
+
- Get an overview of the file structure
|
|
9
|
+
- See where there is the most activity in your project
|
|
10
|
+
- See how your project has looked at different points in time
|
|
11
|
+
|
|
12
|
+
| | |
|
|
13
|
+
| ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
14
|
+
| <img src="./teaser-images/readme1.png" alt="Where has the most work been done recently?"> | <img src="./teaser-images/readme2.png" alt="Who worked on different subsystems in the past?"> |
|
|
15
|
+
|
|
16
|
+
You can read more about the features in the [feature overview](https://git-truck.github.io/git-truck/GitTruckTeaser), [in papers about Git Truck](https://github.com/git-truck/papers/blob/master/README.md), or just try it and start exploring your projects!
|
|
17
|
+
|
|
18
|
+
## [Get started](#get-started)
|
|
19
|
+
|
|
20
|
+
1. In your terminal, navigate to a git repository or a folder containing several repositories
|
|
21
|
+
|
|
22
|
+
2. Run the command `npm install -g git-truck@latest` to install or update Git Truck.
|
|
23
|
+
|
|
24
|
+
3. Now you can run Git Truck using the command `git truck`
|
|
25
|
+
|
|
26
|
+
4. The application will now open in your default browser. Happy trucking!
|
|
27
|
+
|
|
28
|
+
> [!NOTE]
|
|
29
|
+
> To use Git Truck, you will need to have the following programs installed:
|
|
30
|
+
>
|
|
31
|
+
> - [Node.js](https://nodejs.org/en/) 22.0.0 or newer and npm 10.0 or newer
|
|
32
|
+
> - [git](https://git-scm.com/downloads) 2.29 or newer
|
|
33
|
+
>
|
|
34
|
+
> Check your installed versions using `node --version`, `npm --version` and `git --version`.
|
|
35
|
+
|
|
36
|
+
## [What makes Git Truck different?](#what-makes-git-truck-different)
|
|
37
|
+
|
|
38
|
+
🔒 Private by design
|
|
39
|
+
|
|
40
|
+
🏝️ Works offline
|
|
41
|
+
|
|
42
|
+
🤷 Git provider agnostic - works with any git repository
|
|
43
|
+
|
|
44
|
+
😊 No tracking, no ads, no cloud, no servers, no subscription
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,t}from"./jsx-runtime-BVRj4wYA.js";import"./styling-B8OEge8x.js";t();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,t}from"./jsx-runtime-BVRj4wYA.js";import{N as n}from"./chunk-LFPYN7LY-CPTP6242.js";import{N as r,U as i,Wt as a,mt as o,t as s,v as c}from"./styling-B8OEge8x.js";import{U as l,W as u,i as d}from"./util-1G1Ez1rt.js";var f=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAHuElEQVR4Xu2dsW8cVRCHL30sBEoqQKK1EI3/gasc6oBEQ41k5ILO3VV2eugiRRE9Tf6Ao3FL4QbRWCJCMjVVJEqj5CwB0nt3nt/N7s7sfCmdN2/nfb/5vOuN7TxY8AcChQk8KHx2jg6BBQIwBKUJIEDp+Dk8AjADpQkgQOn4OTwCMAOlCSBA6fg5PAIwA6UJIEDp+Dk8AjADpQkgQOn4OTwCMAOlCSBA6fg5PAIwA6UJIEDp+Dk8AjADpQkgQOn4OTwCMAOlCSBA6fg5PAIwA6UJIEDp+Dk8AjADpQkgQOn4OTwCMAOlCSBA6fg5PAIwA6UJIEDp+Dk8AjADpQkgQOn4OTwCMAOlCSBA6fg5PAIwA6UJIEDp+Dk8AjADpQkgQOn4OTwCMAOlCSBA6fg5PAIwA6UJIEDp+Dk8AjADpQkgQOn4OTwCMAOlCSBA6fg5PAIwA6UJIEDp+Dk8AjADpQkgQOn4ObybAJeXl7fgjEdguVy6ZRzvdPt35AYHAfYPY4gdEGA7VQQYYuoC7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.0`);return(0,p.jsxs)(l,{popoverTitle:n?`Experimental version`:`Update available`,trigger:({onClick:e})=>{let r=n?`You are using an experimental version`:`Version ${t} available`,c=n?o:i,l=!n;return(0,p.jsxs)(`button`,{title:r,className:s(`aspect-square`,n?`btn text-primary-text-dark bg-purple-500`:`btn relative self-center rounded-full p-1`),onClick:e,children:[l&&(0,p.jsx)(`div`,{className:`absolute top-0.5 right-0.5 size-2 rounded-full border border-green-400 bg-green-600`}),(0,p.jsx)(a,{path:c,size:`1.25em`})]})},children:[n?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`p`,{children:`You are using an experimental build of Git Truck`}),(0,p.jsx)(`p`,{className:`text-sm`,children:`If you want to use the stable version, close the application and run: `})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`p`,{children:[t?(0,p.jsxs)(`a`,{className:`text-blue-500 hover:underline`,href:c({currentVersion:e,latestVersion:t}),target:`_blank`,rel:`noopener noreferrer`,title:`See what's new`,children:[`Git Truck v`,t,` is now available!`]}):null,` `]}),(0,p.jsx)(`p`,{className:`text-sm`,children:`To update, run`})]}),(0,p.jsx)(d,{inline:!0,children:`npm install -g git-truck@latest`})]})}function h({className:e=``,installedVersion:t,latestVersion:i}){let a=i&&r(i,t)===1,o=n().state!==`idle`;return(0,p.jsx)(`div`,{className:s(`flex flex-row justify-between gap-2`,e),children:(0,p.jsx)(`div`,{className:`flex items-center justify-between gap-2`,children:(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a?(0,p.jsx)(m,{installedVersion:t,latestVersion:i}):(0,p.jsx)(`img`,{src:o?u:f,alt:`Git Truck Logo`,className:`tertiary size-10 rounded-full border p-1`}),(0,p.jsxs)(`div`,{className:`flex flex-col items-start`,children:[(0,p.jsx)(`h1`,{className:`text-secondary-text dark:text-secondary-text-dark font-semibold`,children:(0,p.jsx)(`a`,{href:`https://github.com/git-truck/git-truck`,className:`text-secondary-text dark:text-secondary-text-dark text-xl`,target:`_blank`,rel:`noopener noreferrer`,title:`View on GitHub`,children:`Git Truck`})}),(0,p.jsxs)(`span`,{className:`text-tertiary-text dark:text-tertiary-text-dark text-xs`,children:[`Version `,t]})]})]})})})}export{f as n,h as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,t}from"./jsx-runtime-BVRj4wYA.js";import{A as n,M as r,j as i}from"./chunk-LFPYN7LY-CPTP6242.js";import{r as a}from"./chunk-JPUPSTYD-XO4UPun8.js";import{Bt as o,yt as s}from"./styling-B8OEge8x.js";import{m as c}from"./browse-7BJg-qfM.js";var l=e(t());function u(){let e=r(),t=n(),u=i(a(`/view/commits`));return(0,l.jsx)(c,{large:!0,group:{"/details":`Details`,"/commits":`Commits`},iconMap:{"/details":s,"/commits":o},defaultValue:u?`/commits`:`/details`,onChange:n=>{e(a(`/view${n}`)+t.search,{state:t.state})}})}export{u as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-BVRj4wYA.js";import{A as r,N as i,R as a,r as o}from"./chunk-LFPYN7LY-CPTP6242.js";import{r as s}from"./chunk-JPUPSTYD-XO4UPun8.js";import{t as c}from"./react-dom-_FKEaPb7.js";import{H as l,Wt as u,o as d,z as f}from"./styling-B8OEge8x.js";import{V as p,r as m,s as h,t as g,w as _}from"./util-1G1Ez1rt.js";var v=e(t()),y=c(),b=e(n());function x({open:e,onClose:t}){let{databaseInfo:n}=p(),c=a(),{authors:x}=n,C=n.authorUnions,[w,T]=(0,v.useState)([]),[E,D]=(0,v.useState)(``),O=i(),[,k]=_(),[,A]=(0,v.useTransition)(),j=r(),M=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(M.current){if(e){M.current.showModal();return}M.current.close()}},[e]);let N=C.reduce((e,t)=>[...e,...t],[]).sort(S);function P(e){let t=C.filter((t,n)=>n!==e),n=new FormData;n.append(`unionedAuthors`,JSON.stringify(t)),c(n,{action:s(`/view`)+j.search,method:`post`})}function F(){let e=new FormData;e.append(`unionedAuthors`,JSON.stringify([])),c(e,{action:s(`/view`)+j.search,method:`post`})}function I(){if(w.length===0)return;let e=new FormData;e.append(`unionedAuthors`,JSON.stringify([...C,w])),c(e,{action:s(`/view`)+j.search,method:`post`}),T([])}function L(e,t){let n=C.map((n,r)=>r===t?[e,...n.filter(t=>t!==e)]:n),r=new FormData;r.append(`unionedAuthors`,JSON.stringify(n)),c(r,{action:s(`/view`)+j.search,method:`post`})}let R=O.state!==`idle`,z=x.filter(e=>!N.includes(e)).slice(0).sort(S);d({key:`Escape`},t);let B=e=>k.get(e)??`#333`;if(!e)return null;let V=z.length===0?`All detected authors have been grouped`:`Select the authors that you know are the same person`,H=z.filter(e=>e.toLowerCase().includes(E.toLowerCase())),U=H.map(e=>(0,b.jsx)(g,{className:`hover:opacity-70`,checked:w.includes(e),onChange:t=>{T(t.target?.checked?[...w,e]:w.filter(t=>t!==e))},children:(0,b.jsxs)(`div`,{className:`inline-flex flex-row place-items-center gap-2`,children:[(0,b.jsx)(h,{dotColor:B(e)}),e]})},e)),W=C.map((e,t)=>{let n=e[0],r=O.state!==`idle`;return(0,b.jsxs)(`div`,{className:`card group m-0 flex h-full flex-col p-2`,children:[(0,b.jsxs)(`div`,{className:`inline-flex flex-row place-items-center gap-2`,children:[(0,b.jsx)(h,{dotColor:B(n)}),(0,b.jsx)(`b`,{className:`truncate`,title:n,children:n})]}),e.slice(1).sort(S).map(e=>(0,b.jsx)(G,{alias:e,disabled:r,onClick:()=>L(e,t)},e)),(0,b.jsx)(`div`,{className:`grow`}),(0,b.jsxs)(`div`,{className:`flex items-end justify-end gap-2 opacity-0 transition-opacity duration-200 group-hover:opacity-100`,children:[(0,b.jsxs)(o,{action:s(`/view`)+j.search,method:`post`,children:[(0,b.jsx)(`input`,{type:`hidden`,name:`unionedAuthors`,value:JSON.stringify(C)}),(0,b.jsx)(`button`,{className:`btn`,title:`Add selected authors to this group`,disabled:r||w.length===0,onClick:()=>{let e=C.map(([e,...n],r)=>r===t?[e,...n,...w]:[e,...n]),n=new FormData;n.append(`unionedAuthors`,JSON.stringify(e)),c(n,{action:s(`/view`)+j.search,method:`post`}),T([])},children:`Add selected`})]}),(0,b.jsx)(`button`,{className:`btn`,title:`Ungroup`,disabled:r,onClick:()=>P(t),children:`Ungroup`})]})]},t)});return(0,y.createPortal)((0,b.jsx)(`dialog`,{ref:M,"aria-modal":!0,className:`z-10 m-auto flex h-full w-full flex-col items-start justify-stretch bg-transparent text-inherit backdrop:bg-gray-500/75 backdrop:p-0`,children:(0,b.jsxs)(`div`,{className:`card m-auto grid h-full w-full max-w-(--breakpoint-2xl) grow grid-cols-[1fr_1fr] grid-rows-[max-content_max-content_max-content_1fr_max-content] gap-2 overflow-hidden p-2 shadow-sm`,children:[(0,b.jsx)(`h2`,{className:`text-2xl`,children:`Group authors`}),(0,b.jsx)(m,{absolute:!1,className:`justify-self-end`,onClick:t}),(0,b.jsxs)(`h3`,{className:`text-center text-lg font-bold`,children:[`Ungrouped authors (`,z.length,`)`]}),(0,b.jsx)(`h3`,{className:`text-center text-lg font-bold`,children:`Grouped authors`}),(0,b.jsx)(`div`,{className:`flex justify-end gap-2`,children:(0,b.jsxs)(`button`,{className:`btn btn--primary justify-self-end`,title:`Group the selected authors`,disabled:R||w.length===0,onClick:I,children:[(0,b.jsx)(u,{path:f,size:1}),`Create group`]})}),(0,b.jsx)(`div`,{className:`flex justify-end gap-4`,children:(0,b.jsx)(`button`,{className:`btn btn--danger`,disabled:R||C.length===0,onClick:()=>{confirm(`Are you sure you want to ungroup all grouped authors?`)&&F()},children:`Ungroup all`})}),(0,b.jsx)(`div`,{className:`overflow-y-auto`,children:(0,b.jsxs)(`div`,{className:`flex h-min min-h-0 flex-col gap-2 rounded-md bg-white p-4 pt-2 shadow-sm dark:bg-gray-700`,children:[(0,b.jsxs)(`div`,{className:`sticky top-0 flex gap-2 bg-inherit pt-2`,children:[(0,b.jsx)(`input`,{className:`input min-w-0`,type:`search`,placeholder:`Filter...`,disabled:z.length===0,onChange:e=>A(()=>D(e.target.value))}),(0,b.jsx)(`button`,{disabled:R||w.length===0,className:`btn btn--outlined w-max grow`,title:`Clear selection`,onClick:()=>T([]),children:`Clear`}),(0,b.jsx)(`button`,{disabled:z.length===0,className:`btn btn--outlined w-max grow`,title:`Clear selection`,onClick:()=>w.length===H.length?T([]):T(e=>Array.from(new Set([...e,...H]))),children:w.length===H.length?`Deselect all`:`Select all`})]}),U.length>0?U:(0,b.jsx)(`p`,{className:`place-self-center`,children:E.length>0?`No authors found`:`All authors have been grouped`})]})}),(0,b.jsx)(`div`,{className:`overflow-y-auto`,children:(0,b.jsx)(`div`,{className:`grid h-min min-h-0 grid-cols-1 gap-4 rounded-md bg-white p-4 shadow-sm lg:grid-cols-2 xl:grid-cols-3 dark:bg-gray-700`,children:C.length>0?W:(0,b.jsx)(`p`,{className:`place-self-center`,children:`No authors have been grouped yet`})})}),(0,b.jsxs)(`div`,{className:`col-span-2 mr-6 grid w-full grid-cols-2 gap-4`,children:[(0,b.jsx)(`p`,{children:V}),(0,b.jsx)(`button`,{className:`btn btn--primary justify-self-end`,onClick:t,children:`Done`})]})]})}),document.body);function G({alias:e,onClick:t,disabled:n}){return(0,b.jsxs)(`button`,{className:`btn flex grid-flow-col gap-2 text-sm [&:hover>svg]:opacity-50 [&>svg]:opacity-0`,disabled:n,title:`Make display name for this grouping`,onClick:t,children:[(0,b.jsx)(u,{path:l,size:.75}),(0,b.jsx)(`label`,{title:e,className:`label truncate`,children:e})]},e)}}var S=(e,t)=>e.toLowerCase().localeCompare(t.toLowerCase());export{x as t};
|