PageSourceSearch

https://tanstack.com/assets/blog.index-CLzhvW5K.js

js tanstack.com collected 2026-10-02 02:12:50 UTC 8,852 bytes, 1 lines download raw bytes

1import{$ as G,H as ee,Y as Q,m as s,p as e}from"./tanstack-query-Cs_IuARx.js";import{t as te}from"./Check.es-CgXTWu3X.js";import{t as se}from"./Rss.es-BdKKuJ9z.js";import{t as ae}from"./SlidersHorizontal.es-Cecw8KTb.js";import{$s as Z,Hn as re,Js as ne,Ns as g,Qi as J,Vr as le,Zi as H,Zn as j,ai as C,ca as U,ci as z,di as R,ea as ie,ec as Y,fi as oe,gi as ce,la as K,li as de,mr as he,na as me,si as V,ta as ue}from"./index-DKdzJYfK.js";import{t as pe}from"./PartnerRail-CsOPwsrd.js";import{t as ge}from"./PageHeader-nJeLyV0W.js";var A="max-[899px]:border-border-default max-[899px]:bg-transparent max-[899px]:shadow-none";function $({value:r}){return s("span",{className:"text-text-muted",children:[" (",r,")"]})}function k({selected:r,onSelect:i,children:l}){return s(de,{onSelect:i,className:g("justify-between",r&&"text-text-primary"),children:[e("span",{className:"flex min-w-0 items-center gap-2 truncate",children:l}),r?e(te,{weight:"bold",className:"h-4 w-4 shrink-0 text-blue-600 dark:text-blue-400"}):null]})}function fe({searchQuery:r,onSearchChange:i,topics:l,totalCount:c,selectedLibrary:o,onLibraryToggle:f,authors:P,selectedAuthor:d,onAuthorChange:p,years:F,selectedYear:v,onYearToggle:w,hasActiveFilters:y,onClearAll:E}){const[x,M]=Q(!1),b=d&&P.includes(d)?d:void 0,h=l.find(({library:m})=>m.id===o),L=h?h.library.name.replace("TanStack ",""):"All topics",S=h?Y[h.library.id]??"tooling":void 0,I=h?K[h.library.id]??U:null,B=(m=!1)=>{const T=m?"h-10 w-full justify-between":"h-10 shrink-0";return s(G,{children:[s(V,{children:[e(R,{children:s(C,{variant:o?"secondary":"ghost",className:g(T,!o&&A),children:[I?e(I,{className:g("h-4 w-4 shrink-0",S?Z[S]:void 0)}):null,e("span",{className:"max-w-[16ch] truncate",children:L}),e(H,{className:"h-4 w-4 shrink-0 text-text-muted"})]})}),s(z,{align:"start",maxHeight:"20rem",children:[e(k,{selected:!o,onSelect:()=>f(void 0),children:s("span",{className:"truncate",children:["All topics",e($,{value:c})]})}),l.map(({library:n,count:u})=>{const N=K[n.id]??U,O=Y[n.id]??"tooling",D=o===n.id;return s(k,{selected:D,onSelect:()=>f(D?void 0:n.id),children:[e(N,{className:g("h-4 w-4 shrink-0",Z[O])}),s("span",{className:"truncate",children:[n.name.replace("TanStack ",""),e($,{value:u})]})]},n.id)})]})]}),P.length?s(V,{children:[e(R,{children:s(C,{variant:b?"secondary":"ghost",className:g(T,!b&&A),children:[e("span",{className:"max-w-[16ch] truncate",children:b??"All authors"}),e(H,{className:"h-4 w-4 shrink-0 text-text-muted"})]})}),s(z,{align:"start",maxHeight:"20rem",children:[e(k,{selected:!b,onSelect:()=>p(void 0),children:e("span",{className:"truncate",children:"All authors"})}),P.map(n=>{const u=b===n;return e(k,{selected:u,onSelect:()=>p(u?void 0:n),children:e("span",{className:"truncate",children:n})},n)})]})]}):null,F.length?s(V,{children:[e(R,{children:s(C,{variant:v?"secondary":"ghost",className:g(T,!v&&A),children:[e("span",{className:"truncate",children:v??"All years"}),e(H,{className:"h-4 w-4 shrink-0 text-text-muted"})]})}),s(z,{align:"start",maxHeight:"20rem",children:[e(k,{selected:!v,onSelect:()=>w(void 0),children:e("span",{className:"truncate",children:"All years"})}),F.map(({year:n,count:u})=>{const N=v===n;return e(k,{selected:N,onSelect:()=>w(N?void 0:n),children:s("span",{className:"truncate",children:[n,e($,{value:u})]})},n)})]})]}):null,y?e(C,{variant:"link",color:"blue",size:"sm",onClick:E,className:m?"w-full":"shrink-0",children:"Clear"}):null]})};return s("div",{className:"w-full",children:[s("div",{className:"flex items-center gap-3",children:[e("div",{className:"min-w-0 flex-1 sm:max-w-sm",children:e(ce,{"aria-label":"Search posts",placeholder:"Search posts...",value:r,onChange:m=>i(m.currentTarget.value)})}),s("div",{className:"ml-auto flex items-center gap-2",children:[e("div",{className:"hidden items-center gap-2 md:flex",children:B()}),s(C,{variant:"ghost",size:"icon-md","aria-label":"Filters","aria-expanded":x,onClick:()=>M(m=>!m),className:g("relative h-10 w-10 md:hidden",A,x&&"bg-background-subtle max-[899px]:bg-background-subtle"),children:[e(ae,{weight:"bold",className:"h-[18px] w-[18px]"}),y?e("span",{className:"pointer-events-none absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-blue-500 ring-2 ring-background-surface"}):null]}),e(C,{as:"a",href:"/rss.xml",target:"_blank",rel:"noreferrer",title:"RSS feed","aria-label":"RSS feed",variant:"ghost",size:"icon-md",className:g("h-10 w-10 shrink-0",A),children:e(se,{weight:"bold",className:"h-[18px] w-[18px]"})})]})]}),e("div",{"aria-hidden":!x,inert:x?void 0:!0,className:g("grid transition-[grid-template-rows] duration-300 ease-out motion-reduce:transition-none md:hidden",x?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:e("div",{className:"min-h-0 overflow-hidden",children:e("div",{className:"flex flex-col gap-2 pt-3",children:B(!0)})})})]})}var q=12;function be(r,i){return r.library?.split(",").some(l=>l.trim()===i)??!1}function ve(r){const i=[];for(const l of r){const c=l.published?.slice(0,4)||"Undated",o=i[i.length-1];o?.year===c?o.posts.push(l):i.push({year:c,posts:[l]})}return i}function xe(r){const i=new Set;for(const l of r)if(l.library)for(const c of l.library.split(","))i.add(c.trim());return ne.filter(l=>i.has(l.id))}function Ie(){const r=j.useLoaderData(),{author:i,q:l,library:c,year:o}=j.useSearch(),f=j.useNavigate(),P=re.filter(t=>t.status==="active"),d=i?ue(i):void 0,p=l??"",F=ie(r),v=xe(r),w=new Map,y=new Map;for(const t of r){if(t.library)for(const _ of t.library.split(",")){const W=_.trim();w.set(W,(w.get(W)??0)+1)}const a=t.published?.slice(0,4);a&&y.set(a,(y.get(a)??0)+1)}const E=v.map(t=>({library:t,count:w.get(t.id)??0}
1)),x=[...y.entries()].sort((t,a)=>a[0].localeCompare(t[0])).map(([t,a])=>({year:t,count:a})),M=d?r.filter(t=>t.authors.includes(d)):r,b=c?M.filter(t=>be(t,c)):M,h=me(o?b.filter(t=>t.published?.slice(0,4)===o):b,p),L=!!(p||d||c||o),S=L?void 0:h[0],I=S?h.slice(1):h,[B,m]=Q(q),[T,n]=Q(Number.POSITIVE_INFINITY);ee(()=>{m(q),n(Number.POSITIVE_INFINITY)},[p,d,c,o]);const u=I.slice(0,B),N=I.length-u.length,O=new Map(u.map((t,a)=>[t.slug,a])),X={searchQuery:p,onSearchChange:t=>f({search:a=>({...a,q:t||void 0}),replace:!0}),topics:E,totalCount:r.length,selectedLibrary:c,onLibraryToggle:t=>f({search:a=>({...a,library:t}),replace:!0}),authors:F,selectedAuthor:d,onAuthorChange:t=>f({search:a=>({...a,author:t}),replace:!0}),years:x,selectedYear:o,onYearToggle:t=>f({search:a=>({...a,year:t}),replace:!0}),hasActiveFilters:L,onClearAll:()=>f({search:()=>({}),replace:!0})};return e("div",{className:"flex flex-col max-w-full min-h-screen",children:s("div",{className:"relative flex-1 w-full mb-16",children:[e("div",{className:"p-4 md:p-8",children:s("div",{className:"mx-auto w-full max-w-[1280px]",children:[s("div",{className:"space-y-6 pt-6",children:[e(ge,{align:"center",title:"Blog",lede:"The latest news and blog posts from TanStack"}),e(fe,{...X})]}),e("div",{className:"mt-2 border-t border-border-subtle"}),e("div",{className:"mt-10",children:s("div",{className:"min-w-0 space-y-8",children:[S?e("section",{"aria-label":"Latest post",children:e(J,{post:S,featured:!0,showCategory:!0,showLibraryBadges:!1})}):null,e("div",{className:"space-y-10",children:ve(u).map(t=>s("section",{className:"space-y-5",children:[s("div",{className:"flex items-center gap-3",children:[e(
1oe,{tone:"muted",children:t.year}),e("span",{className:"h-px flex-1 bg-border-subtle"})]}),e("div",{className:"blog-year-grid",children:t.posts.map(a=>{const _=(O.get(a.slug)??0)-T;return e(J,{post:a,size:"lg",showCategory:!0,showLibraryBadges:!1,className:_>=0?`blog-card-enter enter-${Math.min(_,5)}`:void 0},a.slug)})})]},t.year))}),N>0?e("div",{className:"flex justify-center",children:s("button",{type:"button",onClick:()=>{n(B),m(t=>t+q)},className:"inline-flex items-center gap-2 rounded-lg border border-border-default px-5 py-2.5 text-sm font-bold transition-colors hover:border-blue-500 hover:text-blue-500",children:["Load more posts",s("span",{className:"font-medium text-text-muted",children:[N," more"]})]})}):null,h.length===0?s("div",{className:"py-8 text-center text-text-secondary",children:["No posts found",p?s(G,{children:[" ","matching"," ",e("span",{className:"font-medium",children:p})]}):null,d?s(G,{children:[" ","by ",e("span",{className:"font-medium",children:d})]}):null,"."]}):null]})})]})}),e("div",{className:"pointer-events-none absolute inset-y-0 right-0 hidden min-[1900px]:block",children:e("div",{className:"pointer-events-auto sticky top-[calc(var(--navbar-height)+1.5rem)] mr-4 flex max-h-[calc(100dvh-var(--navbar-height)-2rem)] w-[220px] flex-col overflow-y-auto pb-4 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:e(pe,{analyticsPlacement:"blog_rail",partners:P})})})]})})}var Be=()=>le(),Te=()=>e(he,{});export{Ie as component,Be as loader,Te as notFoundComponent};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.