youiyoux 0.1.10 → 0.1.13
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/chunks/{chunk-HDJ2TOWZ.js → chunk-5I2VHSEN.js} +1 -1
- package/dist/chunks/{chunk-T3KNPVQG.js → chunk-DX2NKY2M.js} +4 -4
- package/dist/chunks/{chunk-75DBKEAH.js → chunk-EV62TUDV.js} +1119 -619
- package/dist/chunks/{chunk-3RP664IP.js → chunk-N5Z5A637.js} +2 -2
- package/dist/chunks/{chunk-DWYDHVLZ.js → chunk-NF4OJYKC.js} +106 -66
- package/dist/chunks/{chunk-X2YYMHR4.js → chunk-PCLXMWZ2.js} +3 -3
- package/dist/chunks/{chunk-OCZJ3JGH.js → chunk-PWGZRP3C.js} +3 -3
- package/dist/chunks/{chunk-FLBRX6Y3.js → chunk-XOXF2ILO.js} +1 -1
- package/dist/chunks/{chunk-6GITMASZ.js → chunk-ZOQW6LNH.js} +56 -900
- package/dist/chunks/chunk-ZWVWENSB.js +899 -0
- package/dist/chunks/{src-XTNHB65M.js → src-4QOHR5GC.js} +3 -3
- package/dist/chunks/src-624TVB6T.js +55 -0
- package/dist/chunks/{src-DPFJ4S2N.js → src-E6ZPFKPR.js} +3 -2
- package/dist/chunks/{src-75ODGHE3.js → src-HVYMF4S2.js} +9 -7
- package/dist/chunks/{src-BYNWPNRT.js → src-IKDQ2BZO.js} +7 -1
- package/dist/chunks/{src-ZG7JU6YJ.js → src-PBM76LFQ.js} +2 -2
- package/dist/chunks/{src-6SNQVIZS.js → src-R7JGKOYI.js} +4 -4
- package/dist/chunks/{src-PURAHRCR.js → src-YC64NNQ3.js} +2 -2
- package/dist/hub/assets/{CandidatePanel-ZzbsyZo3.js → CandidatePanel-DfntneYT.js} +1 -1
- package/dist/hub/assets/{CatalogScreen-DDYlvOHy.js → CatalogScreen-kpFYZqX3.js} +1 -1
- package/dist/hub/assets/{ChangesScreen-C8_EyHgJ.js → ChangesScreen-Chu-Ui1B.js} +1 -1
- package/dist/hub/assets/{CheatSheet-DfcPiXdS.js → CheatSheet-B1dXTYTW.js} +1 -1
- package/dist/hub/assets/{CommandPalette-DfFkDTVg.js → CommandPalette-LBZHJ659.js} +1 -1
- package/dist/hub/assets/{DiscoverScreen-D6NTgEgk.js → DiscoverScreen-Yd3gVUG4.js} +2 -2
- package/dist/hub/assets/DraftEditor-QH9Sa_Uc.js +5 -0
- package/dist/hub/assets/{GapsScreen-CqedCj4z.js → GapsScreen-DPYGlNnA.js} +1 -1
- package/dist/hub/assets/{HomeScreen-CIj1QTkw.js → HomeScreen-BCPPk7mz.js} +1 -1
- package/dist/hub/assets/{InventoryScreen-CyvFXa2_.js → InventoryScreen-SleB733C.js} +1 -1
- package/dist/hub/assets/{LibraryScreen-C4WU0f42.js → LibraryScreen-BVXhOVPU.js} +1 -1
- package/dist/hub/assets/{Opened-CeRWkA7c.js → Opened-CJyMbxqV.js} +1 -1
- package/dist/hub/assets/OrgApp-Dxs_7CxZ.js +1 -0
- package/dist/hub/assets/{Preview-CgW-FMB7.js → Preview-DWFP0BIe.js} +1 -1
- package/dist/hub/assets/{RuleDetail-BDhZ1gCd.js → RuleDetail-C2fTlLJL.js} +3 -3
- package/dist/hub/assets/{RulesScreen-D3rSo_z2.js → RulesScreen-BABeAGJg.js} +3 -3
- package/dist/hub/assets/{ScreenImage-DLeA3nRh.js → ScreenImage-CyhKm_nj.js} +1 -1
- package/dist/hub/assets/ScreensScreen-8Ih8byGy.js +1 -0
- package/dist/hub/assets/{SearchField-DtEgq9-Q.js → SearchField-hF-6-YDM.js} +1 -1
- package/dist/hub/assets/{ServiceDown-Bn6AcA3J.js → ServiceDown-S4ya0Cob.js} +1 -1
- package/dist/hub/assets/{SpecimenCapture-p6YErF5y.js → SpecimenCapture-e_pgT4Sp.js} +1 -1
- package/dist/hub/assets/{Specimens-DuaE0WeO.js → Specimens-D_9hjlJH.js} +2 -2
- package/dist/hub/assets/{StackScreen-DHDulDng.js → StackScreen-J2FQilLW.js} +1 -1
- package/dist/hub/assets/{StubScreens-CmhVNX_Z.js → StubScreens-DAkMph3i.js} +1 -1
- package/dist/hub/assets/StyleScreen-C5WytSZU.js +1 -0
- package/dist/hub/assets/{Tabs-Cbh9BCKW.js → Tabs-DU-fFRDV.js} +1 -1
- package/dist/hub/assets/{TokenDetail-BICobLK1.js → TokenDetail-CDY1xxb9.js} +1 -1
- package/dist/hub/assets/{TokensScreen-CyTHn55q.js → TokensScreen-Sx4aICWk.js} +1 -1
- package/dist/hub/assets/{WorkspaceScreen-uPWqfklh.js → WorkspaceScreen-CzZ16fPZ.js} +1 -1
- package/dist/hub/assets/{client-BXHiuV_w.js → client-Bdgr12LP.js} +1 -1
- package/dist/hub/assets/{discover-CFhyKler.js → discover-va2KFuK_.js} +1 -1
- package/dist/hub/assets/{dist-DYNYuTjI.js → dist-C8tf4g8c.js} +1 -1
- package/dist/hub/assets/{dist-VmEpVQjP.js → dist-CC_p8DIj.js} +1 -1
- package/dist/hub/assets/{dist-C6iTWL0b.js → dist-YTWqg5sS.js} +1 -1
- package/dist/hub/assets/{family-tiles-B8_onXUi.js → family-tiles-qaK1-_c8.js} +1 -1
- package/dist/hub/assets/main-cvOFSjox.js +2 -0
- package/dist/hub/assets/main-pNY4iNRo.css +2 -0
- package/dist/hub/assets/{try-live-CX04d2L2.js → try-live-Iys3nCBG.js} +1 -1
- package/dist/hub/assets/when-COrv5lkZ.js +1 -0
- package/dist/hub/assets/{workflow-DbBdiOmA.js → workflow-C53UBmRZ.js} +1 -1
- package/dist/hub/index.html +2 -2
- package/dist/hub-previews.js +6 -5
- package/dist/hub-server.js +3 -3
- package/dist/hub-snapshot.js +1 -1
- package/dist/schema/youi.org.schema.json +438 -0
- package/dist/schema/youi.record.schema.json +338 -0
- package/dist/youi.js +7 -6
- package/dist/youiyoux.js +7 -6
- package/package.json +4 -4
- package/dist/hub/assets/DraftEditor-CUNGYbg0.js +0 -5
- package/dist/hub/assets/ScreensScreen-bGuFIyWj.js +0 -1
- package/dist/hub/assets/StyleScreen-LwTqfGID.js +0 -1
- package/dist/hub/assets/main-7snyIdoi.css +0 -2
- package/dist/hub/assets/main-CfbpuT4Y.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,t}from"./react-DB-4Zxce.js";import{i as n,t as r}from"./jsx-runtime-D6zNwnaE.js";import{t as i}from"./arrow-right-DcbNDzqs.js";import{t as a}from"./KindIcon-BJ6bz-ny.js";import{E as o,H as s,_ as c,b as l,d as u,f as d,k as f,l as p,m,p as h,pt as ee,tt as g,u as _,v,x as y,y as b}from"./main-CfbpuT4Y.js";import{useSearch as x}from"./client-BXHiuV_w.js";import{o as S}from"./dist-VmEpVQjP.js";import{a as C,o as w,r as T,s as E,t as D}from"./dist-DYNYuTjI.js";var O=1,k=.9,A=.8,j=.17,M=.1,N=.999,P=.9999,F=.99,I=/[\\\/_+.#"@\[\(\{&]/,L=/[\\\/_+.#"@\[\(\{&]/g,te=/[\s-]/,ne=/[\s-]/g;function R(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?O:F;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=R(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=O:I.test(e.charAt(l-1))?(d*=A,p=e.slice(i,l-1).match(L),p&&i>0&&(d*=N**+p.length)):te.test(e.charAt(l-1))?(d*=k,m=e.slice(i,l-1).match(ne),m&&i>0&&(d*=N**+m.length)):(d*=j,i>0&&(d*=N**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=P)),(d<M&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=R(e,t,n,r,l+1,a+2,o),f*M>d&&(d=f*M)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function re(e){return e.toLowerCase().replace(ne,` `)}function ie(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,R(e,t,re(e),re(t),0,0,{})}var ae=e(n(),1),z=e(t(),1),oe=Object.defineProperty,B=(e,t)=>oe(e,`name`,{value:t,configurable:!0});function se(e){let t=z.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];V(r)&&typeof H==`function`&&(r=H(r._payload)),z.Children.forEach(r,e=>{if(pe(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;V(n)&&typeof H==`function`&&(n=H(n._payload)),a=ue(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=z.cloneElement(a,void 0,s):!o&&z.Children.count(r)===1&&z.isValidElement(r)&&(a=r);let c=a?fe(a):void 0,l=_(n,c);if(!a){if(r||r===0)throw Error(o?ve(e):_e(e));return r}let u=de(i,a.props??{});return a.type!==z.Fragment&&(u.ref=n?l:c),z.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}B(se,`createSlot`);var ce=Symbol.for(`radix.slottable`);function le(e){let t=B(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=ce,t}B(le,`createSlottable`);var ue=B((e,t)=>{if(`child`in e.props){let t=e.props.child;return z.isValidElement(t)?z.cloneElement(t,void 0,e.props.children(t.props.children)):null}return z.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function de(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`?n[r]=[i,a].filter(Boolean).join(` `):r===`aria-describedby`&&(n[r]=ge(a,i))}return{...e,...n}}B(de,`mergeProps`);function fe(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}B(fe,`getElementRef`);function pe(e){return z.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===ce}B(pe,`isSlottable`);var me=Symbol.for(`react.lazy`);function V(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===me&&`_payload`in e&&he(e._payload)}B(V,`isLazyComponent`);function he(e){return typeof e==`object`&&!!e&&`then`in e}B(he,`isPromiseLike`);function ge(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}B(ge,`concatAriaDescribedby`);var _e=B(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),ve=B(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),H=z.use,U=r(),ye=Object.defineProperty,be=(e,t)=>ye(e,`name`,{value:t,configurable:!0}),W=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=se(`Primitive.${t}`),r=z.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,U.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function xe(e,t){e&&ae.flushSync(()=>e.dispatchEvent(t))}be(xe,`dispatchDiscreteCustomEvent`);var G=`[cmdk-group=""]`,K=`[cmdk-group-items=""]`,Se=`[cmdk-group-heading=""]`,Ce=`[cmdk-item=""]`,we=`${Ce}:not([aria-disabled="true"])`,Te=`cmdk-item-select`,q=`data-value`,Ee=(e,t,n)=>ie(e,t,n),De=z.createContext(void 0),J=()=>z.useContext(De),Oe=z.createContext(void 0),ke=()=>z.useContext(Oe),Ae=z.createContext(void 0),je=z.forwardRef((e,t)=>{let n=Z(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Z(()=>new Set),i=Z(()=>new Map),a=Z(()=>new Map),o=Z(()=>new Set),s=He(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:ee=!0,...g}=e,_=S(),v=S(),y=S(),b=z.useRef(null),x=We();X(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),X(()=>{x(6,k)},[]);let C=z.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),x(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(y);e?e.focus():(i=document.getElementById(_))==null||i.focus()}if(x(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||x(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=z.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),x(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),x(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();x(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:_,inputId:y,labelId:v,listInnerRef:b}),[]);function T(e,t){let r=s.current?.filter??Ee;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=b.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(K);t?t.appendChild(e.parentElement===t?e:e.closest(`${K} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${K} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=b.current?.querySelector(`${G}[${q}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(q);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(G)?.querySelector(Se))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return b.current?.querySelector(`${Ce}[aria-selected="true"]`)}function j(){return Array.from(b.current?.querySelectorAll(we)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(q))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(q))}function P(e){let t=A()?.closest(G),n;for(;t&&!n;)t=e>0?Be(t,G):Ve(t,G),n=t?.querySelector(we);n?C.setState(`value`,n.getAttribute(q)):N(e)}let F=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},L=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return z.createElement(W.div,{ref:t,tabIndex:-1,...g,"cmdk-root":``,onKeyDown:e=>{var t;(t=g.onKeyDown)==null||t.call(g,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:ee&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:ee&&e.ctrlKey&&L(e);break;case`ArrowUp`:L(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(Te);t.dispatchEvent(e)}}}}},z.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:Ke},c),$(e,e=>z.createElement(Oe.Provider,{value:C},z.createElement(De.Provider,{value:w},e))))}),Me=z.forwardRef((e,t)=>{let n=S(),r=z.useRef(null),i=z.useContext(Ae),a=J(),o=He(e),s=o.current?.forceMount??i?.forceMount;X(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=Ue(n,r,[e.value,e.children,r],e.keywords),l=ke(),u=Q(e=>e.value&&e.value===c.current),d=Q(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);z.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(Te,f),()=>t.removeEventListener(Te,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;m(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function m(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:h,value:ee,onSelect:g,forceMount:_,keywords:v,...y}=e;return z.createElement(W.div,{ref:p(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!u,"data-disabled":!!h,"data-selected":!!u,onPointerMove:h||a.getDisablePointerSelection()?void 0:m,onClick:h?void 0:f},e.children)}),Ne=z.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=S(),s=z.useRef(null),c=z.useRef(null),l=S(),u=J(),d=Q(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));X(()=>u.group(o),[]),Ue(o,s,[e.value,e.heading,c]);let f=z.useMemo(()=>({id:o,forceMount:i}),[i]);return z.createElement(W.div,{ref:p(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&z.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),$(e,e=>z.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},z.createElement(Ae.Provider,{value:f},e))))}),Pe=z.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=z.useRef(null),a=Q(e=>!e.search);return!n&&!a?null:z.createElement(W.div,{ref:p(i,t),...r,"cmdk-separator":``,role:`separator`})}),Fe=z.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=ke(),o=Q(e=>e.search),s=Q(e=>e.selectedItemId),c=J();return z.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),z.createElement(W.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Ie=z.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=z.useRef(null),o=z.useRef(null),s=Q(e=>e.selectedItemId),c=J();return z.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),z.createElement(W.div,{ref:p(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},$(e,e=>z.createElement(`div`,{ref:p(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Le=z.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return z.createElement(D,{open:n,onOpenChange:r},z.createElement(w,{container:o},z.createElement(C,{"cmdk-overlay":``,className:i}),z.createElement(T,{"aria-label":e.label,"cmdk-dialog":``,className:a},z.createElement(je,{ref:t,...s}))))}),Re=z.forwardRef((e,t)=>Q(e=>e.filtered.count===0)?z.createElement(W.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ze=z.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return z.createElement(W.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},$(e,e=>z.createElement(`div`,{"aria-hidden":!0},e)))}),Y=Object.assign(je,{List:Ie,Item:Me,Input:Fe,Group:Ne,Separator:Pe,Dialog:Le,Empty:Re,Loading:ze});function Be(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Ve(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function He(e){let t=z.useRef(e);return X(()=>{t.current=e}),t}var X=typeof window>`u`?z.useEffect:z.useLayoutEffect;function Z(e){let t=z.useRef();return t.current===void 0&&(t.current=e()),t}function Q(e){let t=ke(),n=()=>e(t.snapshot());return z.useSyncExternalStore(t.subscribe,n,n)}function Ue(e,t,n,r=[]){let i=z.useRef(),a=J();return X(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(q,s),i.current=s}),i}var We=()=>{let[e,t]=z.useState(),n=Z(()=>new Map);return X(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Ge(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function $({asChild:e,children:t},n){return e&&z.isValidElement(t)?z.cloneElement(Ge(t),{ref:t.ref},n(t.props.children)):n(t)}var Ke={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},qe=12,Je={component:`Component`,token:`Token`,rule:`Rule`,migration:`Migration`},Ye=[{choice:`system`,label:`Theme: follow the system`,icon:l},{choice:`light`,label:`Theme: light`,icon:b},{choice:`dark`,label:`Theme: dark`,icon:o}],Xe=`flex h-9 cursor-default items-center gap-2.5 rounded-md px-2.5 text-body text-ink-2 select-none data-[selected=true]:bg-raised data-[selected=true]:text-ink [&_svg]:shrink-0`,Ze=`max-h-[min(60vh,440px)] scroll-py-1.5 overflow-y-auto p-1.5 [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:pt-2.5 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:text-caption [&_[cmdk-group-heading]]:text-muted`,Qe=(e,t)=>e.toLowerCase().includes(t.trim().toLowerCase());function $e({onClose:e}){let[t,n]=(0,z.useState)(``),[,r]=ee(),{scheme:o}=m(),l=s(),p=l.status===`ready`?l.value:null,_=x(p,t),b=(0,z.useMemo)(()=>p?_.ids===null?p.elements.filter(e=>e.kind===`component`):_.ids.slice(0,qe).flatMap(e=>p.byId.get(e)??[]):[],[p,_.ids]),S=c.filter(e=>Qe(e.label,t)||Qe(`go ${e.label}`,t)),O=Ye.filter(e=>Qe(e.label,t)),k=b[0]?.id??(S[0]?`go ${S[0].href}`:O[0]?`theme ${O[0].choice}`:``),[A,j]=(0,z.useState)(k);(0,z.useEffect)(()=>j(k),[k]);let M=t=>{t!==location.pathname&&f(t),r(t),e()};return(0,U.jsx)(D,{open:!0,onOpenChange:t=>!t&&e(),children:(0,U.jsxs)(w,{children:[(0,U.jsx)(C,{className:`fixed inset-0 z-50 bg-scrim animate-fade`}),(0,U.jsxs)(T,{"aria-describedby":void 0,className:`fixed inset-x-0 top-[12vh] z-50 mx-auto w-[min(640px,calc(100vw-24px))] overflow-hidden rounded-xl border border-line bg-surface shadow-popover outline-none animate-pop`,children:[(0,U.jsx)(E,{className:`sr-only`,children:`Command palette`}),(0,U.jsxs)(Y,{shouldFilter:!1,loop:!0,label:`Command palette`,value:A,onValueChange:j,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-line px-4`,children:[(0,U.jsx)(y,{"aria-hidden":!0,className:`size-4 text-muted`}),(0,U.jsx)(Y.Input,{value:t,onValueChange:n,placeholder:`Search elements, tokens and rules, or jump to a screen…`,className:`h-12 min-w-0 flex-1 bg-transparent text-reading text-ink outline-none placeholder:text-muted`}),(0,U.jsx)(u,{children:`esc`})]}),(0,U.jsxs)(Y.List,{className:Ze,children:[(0,U.jsxs)(Y.Empty,{className:`px-3 py-8 text-center text-small text-muted`,children:[`Nothing matches “`,t.trim(),`”.`]}),b.length>0&&(0,U.jsx)(Y.Group,{heading:_.ids===null?`Components`:`Elements`,children:b.map(e=>(0,U.jsxs)(Y.Item,{value:e.id,onSelect:()=>M(g(e.id)),className:Xe,children:[(0,U.jsx)(a,{element:e,scheme:o}),(0,U.jsx)(`span`,{className:`truncate font-medium text-ink`,children:e.name}),e.key!==e.name&&(0,U.jsx)(`span`,{className:`truncate font-mono text-mono-sm text-muted`,children:e.key}),(0,U.jsx)(`span`,{className:`ml-auto text-caption text-muted`,children:Je[e.kind]})]},e.id))}),S.length>0&&(0,U.jsx)(Y.Group,{heading:`Go to`,children:S.map(e=>(0,U.jsxs)(Y.Item,{value:`go ${e.href}`,onSelect:()=>M(e.href),className:Xe,children:[(0,U.jsx)(e.icon,{className:`size-4 text-muted`}),(0,U.jsx)(`span`,{children:e.label}),v[e.section].label!==e.label&&(0,U.jsx)(`span`,{className:`text-caption text-muted`,children:v[e.section].label}),(0,U.jsx)(d,{keys:[`g`,e.key],className:`ml-auto`})]},e.href))}),O.length>0&&(0,U.jsx)(Y.Group,{heading:`Appearance`,children:O.map(t=>(0,U.jsxs)(Y.Item,{value:`theme ${t.choice}`,onSelect:()=>(h(t.choice),e()),className:Xe,children:[(0,U.jsx)(t.icon,{className:`size-4 text-muted`}),(0,U.jsx)(`span`,{children:t.label})]},t.choice))})]}),(0,U.jsxs)(`footer`,{className:`flex h-9 items-center gap-4 border-t border-line bg-sunken px-4 text-caption text-muted`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(d,{keys:[`↑`,`↓`]}),` move`]}),(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(u,{children:`↵`}),` open`]}),_.totalMs!==null&&(0,U.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 tabular`,children:[(0,U.jsx)(i,{className:`size-3`}),` `,_.ids?.length??0,` in `,_.totalMs.toFixed(1),` ms`]})]})]})]})]})})}export{$e as CommandPalette};
|
|
1
|
+
import{i as e,t}from"./react-DB-4Zxce.js";import{i as n,t as r}from"./jsx-runtime-D6zNwnaE.js";import{t as i}from"./arrow-right-DcbNDzqs.js";import{t as a}from"./KindIcon-BJ6bz-ny.js";import{E as o,H as s,_ as c,b as l,d as u,f as d,k as f,l as p,m,p as h,pt as ee,tt as g,u as _,v,x as y,y as b}from"./main-cvOFSjox.js";import{useSearch as x}from"./client-Bdgr12LP.js";import{o as S}from"./dist-CC_p8DIj.js";import{a as C,o as w,r as T,s as E,t as D}from"./dist-C8tf4g8c.js";var O=1,k=.9,A=.8,j=.17,M=.1,N=.999,P=.9999,F=.99,I=/[\\\/_+.#"@\[\(\{&]/,L=/[\\\/_+.#"@\[\(\{&]/g,te=/[\s-]/,ne=/[\s-]/g;function R(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?O:F;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=R(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=O:I.test(e.charAt(l-1))?(d*=A,p=e.slice(i,l-1).match(L),p&&i>0&&(d*=N**+p.length)):te.test(e.charAt(l-1))?(d*=k,m=e.slice(i,l-1).match(ne),m&&i>0&&(d*=N**+m.length)):(d*=j,i>0&&(d*=N**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=P)),(d<M&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=R(e,t,n,r,l+1,a+2,o),f*M>d&&(d=f*M)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function re(e){return e.toLowerCase().replace(ne,` `)}function ie(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,R(e,t,re(e),re(t),0,0,{})}var ae=e(n(),1),z=e(t(),1),oe=Object.defineProperty,B=(e,t)=>oe(e,`name`,{value:t,configurable:!0});function se(e){let t=z.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];V(r)&&typeof H==`function`&&(r=H(r._payload)),z.Children.forEach(r,e=>{if(pe(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;V(n)&&typeof H==`function`&&(n=H(n._payload)),a=ue(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=z.cloneElement(a,void 0,s):!o&&z.Children.count(r)===1&&z.isValidElement(r)&&(a=r);let c=a?fe(a):void 0,l=_(n,c);if(!a){if(r||r===0)throw Error(o?ve(e):_e(e));return r}let u=de(i,a.props??{});return a.type!==z.Fragment&&(u.ref=n?l:c),z.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}B(se,`createSlot`);var ce=Symbol.for(`radix.slottable`);function le(e){let t=B(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=ce,t}B(le,`createSlottable`);var ue=B((e,t)=>{if(`child`in e.props){let t=e.props.child;return z.isValidElement(t)?z.cloneElement(t,void 0,e.props.children(t.props.children)):null}return z.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function de(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`?n[r]=[i,a].filter(Boolean).join(` `):r===`aria-describedby`&&(n[r]=ge(a,i))}return{...e,...n}}B(de,`mergeProps`);function fe(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}B(fe,`getElementRef`);function pe(e){return z.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===ce}B(pe,`isSlottable`);var me=Symbol.for(`react.lazy`);function V(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===me&&`_payload`in e&&he(e._payload)}B(V,`isLazyComponent`);function he(e){return typeof e==`object`&&!!e&&`then`in e}B(he,`isPromiseLike`);function ge(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}B(ge,`concatAriaDescribedby`);var _e=B(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),ve=B(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),H=z.use,U=r(),ye=Object.defineProperty,be=(e,t)=>ye(e,`name`,{value:t,configurable:!0}),W=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=se(`Primitive.${t}`),r=z.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,U.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function xe(e,t){e&&ae.flushSync(()=>e.dispatchEvent(t))}be(xe,`dispatchDiscreteCustomEvent`);var G=`[cmdk-group=""]`,K=`[cmdk-group-items=""]`,Se=`[cmdk-group-heading=""]`,Ce=`[cmdk-item=""]`,we=`${Ce}:not([aria-disabled="true"])`,Te=`cmdk-item-select`,q=`data-value`,Ee=(e,t,n)=>ie(e,t,n),De=z.createContext(void 0),J=()=>z.useContext(De),Oe=z.createContext(void 0),ke=()=>z.useContext(Oe),Ae=z.createContext(void 0),je=z.forwardRef((e,t)=>{let n=Z(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Z(()=>new Set),i=Z(()=>new Map),a=Z(()=>new Map),o=Z(()=>new Set),s=He(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:ee=!0,...g}=e,_=S(),v=S(),y=S(),b=z.useRef(null),x=We();X(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),X(()=>{x(6,k)},[]);let C=z.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),x(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(y);e?e.focus():(i=document.getElementById(_))==null||i.focus()}if(x(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||x(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=z.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),x(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),x(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();x(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:_,inputId:y,labelId:v,listInnerRef:b}),[]);function T(e,t){let r=s.current?.filter??Ee;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=b.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(K);t?t.appendChild(e.parentElement===t?e:e.closest(`${K} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${K} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=b.current?.querySelector(`${G}[${q}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(q);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(G)?.querySelector(Se))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return b.current?.querySelector(`${Ce}[aria-selected="true"]`)}function j(){return Array.from(b.current?.querySelectorAll(we)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(q))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(q))}function P(e){let t=A()?.closest(G),n;for(;t&&!n;)t=e>0?Be(t,G):Ve(t,G),n=t?.querySelector(we);n?C.setState(`value`,n.getAttribute(q)):N(e)}let F=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},L=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return z.createElement(W.div,{ref:t,tabIndex:-1,...g,"cmdk-root":``,onKeyDown:e=>{var t;(t=g.onKeyDown)==null||t.call(g,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:ee&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:ee&&e.ctrlKey&&L(e);break;case`ArrowUp`:L(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(Te);t.dispatchEvent(e)}}}}},z.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:Ke},c),$(e,e=>z.createElement(Oe.Provider,{value:C},z.createElement(De.Provider,{value:w},e))))}),Me=z.forwardRef((e,t)=>{let n=S(),r=z.useRef(null),i=z.useContext(Ae),a=J(),o=He(e),s=o.current?.forceMount??i?.forceMount;X(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=Ue(n,r,[e.value,e.children,r],e.keywords),l=ke(),u=Q(e=>e.value&&e.value===c.current),d=Q(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);z.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(Te,f),()=>t.removeEventListener(Te,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;m(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function m(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:h,value:ee,onSelect:g,forceMount:_,keywords:v,...y}=e;return z.createElement(W.div,{ref:p(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!u,"data-disabled":!!h,"data-selected":!!u,onPointerMove:h||a.getDisablePointerSelection()?void 0:m,onClick:h?void 0:f},e.children)}),Ne=z.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=S(),s=z.useRef(null),c=z.useRef(null),l=S(),u=J(),d=Q(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));X(()=>u.group(o),[]),Ue(o,s,[e.value,e.heading,c]);let f=z.useMemo(()=>({id:o,forceMount:i}),[i]);return z.createElement(W.div,{ref:p(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&z.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),$(e,e=>z.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},z.createElement(Ae.Provider,{value:f},e))))}),Pe=z.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=z.useRef(null),a=Q(e=>!e.search);return!n&&!a?null:z.createElement(W.div,{ref:p(i,t),...r,"cmdk-separator":``,role:`separator`})}),Fe=z.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=ke(),o=Q(e=>e.search),s=Q(e=>e.selectedItemId),c=J();return z.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),z.createElement(W.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Ie=z.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=z.useRef(null),o=z.useRef(null),s=Q(e=>e.selectedItemId),c=J();return z.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),z.createElement(W.div,{ref:p(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},$(e,e=>z.createElement(`div`,{ref:p(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Le=z.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return z.createElement(D,{open:n,onOpenChange:r},z.createElement(w,{container:o},z.createElement(C,{"cmdk-overlay":``,className:i}),z.createElement(T,{"aria-label":e.label,"cmdk-dialog":``,className:a},z.createElement(je,{ref:t,...s}))))}),Re=z.forwardRef((e,t)=>Q(e=>e.filtered.count===0)?z.createElement(W.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ze=z.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return z.createElement(W.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},$(e,e=>z.createElement(`div`,{"aria-hidden":!0},e)))}),Y=Object.assign(je,{List:Ie,Item:Me,Input:Fe,Group:Ne,Separator:Pe,Dialog:Le,Empty:Re,Loading:ze});function Be(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Ve(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function He(e){let t=z.useRef(e);return X(()=>{t.current=e}),t}var X=typeof window>`u`?z.useEffect:z.useLayoutEffect;function Z(e){let t=z.useRef();return t.current===void 0&&(t.current=e()),t}function Q(e){let t=ke(),n=()=>e(t.snapshot());return z.useSyncExternalStore(t.subscribe,n,n)}function Ue(e,t,n,r=[]){let i=z.useRef(),a=J();return X(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(q,s),i.current=s}),i}var We=()=>{let[e,t]=z.useState(),n=Z(()=>new Map);return X(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Ge(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function $({asChild:e,children:t},n){return e&&z.isValidElement(t)?z.cloneElement(Ge(t),{ref:t.ref},n(t.props.children)):n(t)}var Ke={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},qe=12,Je={component:`Component`,token:`Token`,rule:`Rule`,migration:`Migration`},Ye=[{choice:`system`,label:`Theme: follow the system`,icon:l},{choice:`light`,label:`Theme: light`,icon:b},{choice:`dark`,label:`Theme: dark`,icon:o}],Xe=`flex h-9 cursor-default items-center gap-2.5 rounded-md px-2.5 text-body text-ink-2 select-none data-[selected=true]:bg-raised data-[selected=true]:text-ink [&_svg]:shrink-0`,Ze=`max-h-[min(60vh,440px)] scroll-py-1.5 overflow-y-auto p-1.5 [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:pt-2.5 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:text-caption [&_[cmdk-group-heading]]:text-muted`,Qe=(e,t)=>e.toLowerCase().includes(t.trim().toLowerCase());function $e({onClose:e}){let[t,n]=(0,z.useState)(``),[,r]=ee(),{scheme:o}=m(),l=s(),p=l.status===`ready`?l.value:null,_=x(p,t),b=(0,z.useMemo)(()=>p?_.ids===null?p.elements.filter(e=>e.kind===`component`):_.ids.slice(0,qe).flatMap(e=>p.byId.get(e)??[]):[],[p,_.ids]),S=c.filter(e=>Qe(e.label,t)||Qe(`go ${e.label}`,t)),O=Ye.filter(e=>Qe(e.label,t)),k=b[0]?.id??(S[0]?`go ${S[0].href}`:O[0]?`theme ${O[0].choice}`:``),[A,j]=(0,z.useState)(k);(0,z.useEffect)(()=>j(k),[k]);let M=t=>{t!==location.pathname&&f(t),r(t),e()};return(0,U.jsx)(D,{open:!0,onOpenChange:t=>!t&&e(),children:(0,U.jsxs)(w,{children:[(0,U.jsx)(C,{className:`fixed inset-0 z-50 bg-scrim animate-fade`}),(0,U.jsxs)(T,{"aria-describedby":void 0,className:`fixed inset-x-0 top-[12vh] z-50 mx-auto w-[min(640px,calc(100vw-24px))] overflow-hidden rounded-xl border border-line bg-surface shadow-popover outline-none animate-pop`,children:[(0,U.jsx)(E,{className:`sr-only`,children:`Command palette`}),(0,U.jsxs)(Y,{shouldFilter:!1,loop:!0,label:`Command palette`,value:A,onValueChange:j,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-line px-4`,children:[(0,U.jsx)(y,{"aria-hidden":!0,className:`size-4 text-muted`}),(0,U.jsx)(Y.Input,{value:t,onValueChange:n,placeholder:`Search elements, tokens and rules, or jump to a screen…`,className:`h-12 min-w-0 flex-1 bg-transparent text-reading text-ink outline-none placeholder:text-muted`}),(0,U.jsx)(u,{children:`esc`})]}),(0,U.jsxs)(Y.List,{className:Ze,children:[(0,U.jsxs)(Y.Empty,{className:`px-3 py-8 text-center text-small text-muted`,children:[`Nothing matches “`,t.trim(),`”.`]}),b.length>0&&(0,U.jsx)(Y.Group,{heading:_.ids===null?`Components`:`Elements`,children:b.map(e=>(0,U.jsxs)(Y.Item,{value:e.id,onSelect:()=>M(g(e.id)),className:Xe,children:[(0,U.jsx)(a,{element:e,scheme:o}),(0,U.jsx)(`span`,{className:`truncate font-medium text-ink`,children:e.name}),e.key!==e.name&&(0,U.jsx)(`span`,{className:`truncate font-mono text-mono-sm text-muted`,children:e.key}),(0,U.jsx)(`span`,{className:`ml-auto text-caption text-muted`,children:Je[e.kind]})]},e.id))}),S.length>0&&(0,U.jsx)(Y.Group,{heading:`Go to`,children:S.map(e=>(0,U.jsxs)(Y.Item,{value:`go ${e.href}`,onSelect:()=>M(e.href),className:Xe,children:[(0,U.jsx)(e.icon,{className:`size-4 text-muted`}),(0,U.jsx)(`span`,{children:e.label}),v[e.section].label!==e.label&&(0,U.jsx)(`span`,{className:`text-caption text-muted`,children:v[e.section].label}),(0,U.jsx)(d,{keys:[`g`,e.key],className:`ml-auto`})]},e.href))}),O.length>0&&(0,U.jsx)(Y.Group,{heading:`Appearance`,children:O.map(t=>(0,U.jsxs)(Y.Item,{value:`theme ${t.choice}`,onSelect:()=>(h(t.choice),e()),className:Xe,children:[(0,U.jsx)(t.icon,{className:`size-4 text-muted`}),(0,U.jsx)(`span`,{children:t.label})]},t.choice))})]}),(0,U.jsxs)(`footer`,{className:`flex h-9 items-center gap-4 border-t border-line bg-sunken px-4 text-caption text-muted`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(d,{keys:[`↑`,`↓`]}),` move`]}),(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(u,{children:`↵`}),` open`]}),_.totalMs!==null&&(0,U.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 tabular`,children:[(0,U.jsx)(i,{className:`size-3`}),` `,_.ids?.length??0,` in `,_.totalMs.toFixed(1),` ms`]})]})]})]})]})})}export{$e as CommandPalette};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Opened-
|
|
2
|
-
import{i as e,t}from"./react-DB-4Zxce.js";import{n,t as r}from"./jsx-runtime-D6zNwnaE.js";import{t as i}from"./createLucideIcon-CGDJWtKO.js";import{t as a}from"./arrow-right-DcbNDzqs.js";import{t as o}from"./CopyButton-DE8drl4P.js";import{t as s}from"./compass-BkKOZPYe.js";import{t as c}from"./layout-grid-xFY9L9Oc.js";import{t as l}from"./clsx-DB0hHKMi.js";import{ht as u,m as d,n as f,o as p,pt as m,s as h}from"./main-CfbpuT4Y.js";import{t as g}from"./Badge-CUJUit4d.js";import{t as _}from"./SearchField-DtEgq9-Q.js";import{a as v,i as y,o as b,r as x,s as S}from"./discover-CFhyKler.js";import{t as C}from"./LicenceBadge-CLCUMMHE.js";var w={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};w.node;var T=i(w),E={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};E.node;var D=i(E),O=e(t(),1),k=`__youi/discover-thumbs`,A=e=>{let t=e;return!!t&&typeof t.project==`string`&&typeof t.items==`object`&&t.items!==null&&typeof t.failed==`object`&&t.failed!==null},j=null;function M(){return j??=fetch(`/${k}`,{headers:{Accept:`application/json`}}).then(async e=>{if(!e.ok||!e.headers.get(`Content-Type`)?.includes(`application/json`))return null;let t=await e.json().catch(()=>null);return A(t)?t:null},()=>null),j}function N(){let[e,t]=(0,O.useState)(void 0);return(0,O.useEffect)(()=>{let e=!1;return M().then(n=>!e&&t(n)),()=>{e=!0}},[]),e}var P=e=>!!e&&Object.keys(e.items).length>0;function F(e){let t=/^it needs @\/registry\/[^/]+\/(?:ui|blocks|components)\/([\w.-]+)/i.exec(e);if(t)return`Needs its ${t[1]} part`;let n=/^it needs (?:radix-ui's )?([@\w./-]+?)(?:,| \(|$)/i.exec(e);return n?`Needs ${n[1]}`:/failed when it ran/i.test(e)?`Fails when drawn alone`:/draws nothing visible/i.test(e)?`Draws nothing on its own`:/did not draw within|took over/i.test(e)?`Timed out drawing`:/exports no component/i.test(e)?`Nothing to draw`:`Not drawn on its own`}var I=r(),L=()=>n(()=>import(`./Opened-CeRWkA7c.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34])),R=(0,O.lazy)(()=>L().then(e=>({default:e.PinnedSection}))),z=(0,O.lazy)(()=>L().then(e=>({default:e.CandidateLayer}))),B=[`command menu`,`date picker`,`toast`,`dialog`,`tabs`],V=250,H=12,U=8,W=4;function G(e){let[t,n]=(0,O.useState)({status:`loading`}),r=y({...e,open:null,family:null});return(0,O.useEffect)(()=>{let t=new AbortController;return n(e=>e.status===`ready`?e:{status:`loading`}),v(e,{signal:t.signal}).then(e=>n({status:`ready`,page:e}),e=>!t.signal.aborted&&n({status:`error`,message:e instanceof Error?e.message:String(e)})),()=>t.abort()},[r]),t}function K(){return(0,I.jsx)(q,{})}function q({inventory:e}){let t=u(),[n,r]=m(),i=(0,O.useMemo)(()=>x(t),[t]),a=(0,O.useCallback)(e=>r(`${n}${y(e)}`,{replace:!0}),[n,r]),{scheme:o}=d(),[s,c]=(0,O.useState)(null),[l,p]=(0,O.useState)(i.q),h=(0,O.useRef)(i);h.current=i,(0,O.useEffect)(()=>p(i.q),[i.q]),(0,O.useEffect)(()=>{if(l===h.current.q)return;let e=setTimeout(()=>a({...h.current,q:l,offset:0}),V);return()=>clearTimeout(e)},[l,a]);let v=G(i),b=v.status===`ready`?v.page:null,S=N(),C=i.view?i.view===`gallery`:P(S),w=(0,O.useRef)(new Map);for(let e of b?.hits??[])w.current.set(e.id,e);let[T,E]=(0,O.useState)(()=>i.open?[i.open]:[]),[D,k]=(0,O.useState)(null),A=e=>{w.current.set(e.id,e),E(t=>t.includes(e.id)?t:[...t,e.id]),a({...i,open:e.id})},j=i.open?w.current.get(i.open)??null:null,M=(0,O.useCallback)(()=>a({...h.current,open:null}),[a]),F=e=>a({...i,...e,offset:0,open:null});return(0,I.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-screen":`discover`,children:[(0,I.jsx)(f,{title:`Discover`,count:b?.matched,children:(0,I.jsx)(g,{tone:`outline`,children:`Outside references · not built with`})}),(0,I.jsx)(`div`,{ref:c,className:`min-h-0 flex-1 overflow-y-auto`,children:(0,I.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-6 px-6 py-6 max-sm:space-y-4 max-sm:px-4`,children:[(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(_,{value:l,onChange:p,placeholder:`Search by need: command menu, date picker, toast…`,label:`Search by need`,touch:!0,className:`max-w-2xl`}),!i.q&&(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-small text-muted`,children:[(0,I.jsx)(`span`,{children:`Try`}),B.map(e=>(0,I.jsx)(`button`,{type:`button`,onClick:()=>p(e),className:`rounded-sm border border-line px-2 py-0.5 text-ink-2 hover:bg-raised max-md:py-2.5`,children:e},e))]})]}),i.family&&(0,I.jsx)(O.Suspense,{fallback:(0,I.jsx)(`p`,{className:`text-small text-faint`,children:`Loading the pinned family…`}),children:(0,I.jsx)(R,{id:i.family,opened:T,scheme:o,role:i.role,inventory:e,scroller:s,onClear:()=>F({family:null}),onProject:k})}),(0,I.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-[13rem_minmax(0,1fr)]`,children:[(0,I.jsx)(Y,{query:i,page:b,onChange:F}),(0,I.jsxs)(`section`,{"aria-labelledby":`discover-results`,className:`min-w-0 space-y-3`,children:[(0,I.jsx)(`h2`,{id:`discover-results`,className:`sr-only`,children:`Results`}),(0,I.jsx)(X,{listings:v,query:i,onOpen:A,onPage:e=>a({...i,offset:e,open:null}),gallery:C,thumbs:S??null,scheme:o,onView:e=>a({...i,view:e,open:null}),onRole:e=>F({role:e})})]})]})]})}),(T.length>0||j)&&(0,I.jsx)(O.Suspense,{fallback:null,children:(0,I.jsx)(z,{openHit:j,opened:T,project:i.family?D:null,scheme:o,family:i.family,onClose:M})})]})}function J({label:e,value:t,options:n,onChange:r,disabled:i}){return(0,I.jsxs)(`fieldset`,{className:`min-w-0 space-y-1`,disabled:i!==void 0,children:[(0,I.jsx)(`legend`,{className:`mb-1 text-caption font-medium tracking-wide text-muted uppercase`,children:e}),i===void 0?(0,I.jsx)(`ul`,{className:`flex flex-col gap-0.5 max-md:flex-row max-md:flex-wrap`,children:[{value:``,label:`Any`,count:null},...n].map(e=>{let n=(t??``)===e.value;return(0,I.jsx)(`li`,{children:(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:()=>r(e.value||null),className:l(`flex w-full min-w-0 items-center gap-2 rounded-sm px-2 py-1 text-left text-small max-md:h-11 max-md:w-auto max-md:border max-md:border-line`,n?`bg-accent-soft text-accent`:`text-ink-2 hover:bg-raised`),children:[(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count!==null&&(0,I.jsx)(`span`,{className:`tabular text-caption text-faint`,children:e.count})]})},e.value||`any`)})}):(0,I.jsx)(`p`,{className:`text-small text-faint`,children:i})]})}function Y({query:e,page:t,onChange:n}){let r=t?.facets??{role:{},source:{},licence:{},style:{}},i=e=>Object.entries(e),a=(e,t)=>t&&!e.some(e=>e.value===t)?[...e,{value:t,label:t.replace(/-/g,` `),count:null}]:e,o=r.licence.unknown??0,s=i(r.licence).reduce((e,[t,n])=>e+(t===`unknown`?0:n),0);return(0,I.jsxs)(`aside`,{"aria-label":`Facets`,className:`space-y-4 max-md:space-y-3`,"data-facets":!0,children:[(0,I.jsx)(J,{label:`Role`,value:e.role,onChange:e=>n({role:e}),options:a(i(r.role).slice(0,H).map(([e,t])=>({value:e,label:e.replace(/-/g,` `),count:t})),e.role)}),(0,I.jsx)(J,{label:`Source`,value:e.source,onChange:e=>n({source:e}),options:a(i(r.source).map(([e,t])=>({value:e,label:e,count:t})),e.source)}),(0,I.jsx)(J,{label:`Licence`,value:e.licence,onChange:e=>n({licence:e}),options:[{value:`known`,label:`Known`,count:t?s:null},{value:`unknown`,label:`Unknown`,count:t?o:null}]}),(0,I.jsx)(J,{label:`Style`,value:e.style,onChange:e=>n({style:e}),options:[{value:`headless`,label:`Headless`,count:t?r.style.headless??0:null},{value:`styled`,label:`Styled`,count:t?r.style.styled??0:null}]}),(0,I.jsx)(J,{label:`Seen on`,value:null,onChange:()=>void 0,options:[],disabled:`Later: which sites you know use it.`})]})}function X({listings:e,query:t,onOpen:n,onPage:r,gallery:i,thumbs:o,scheme:c,onView:l,onRole:u}){if(e.status===`loading`)return(0,I.jsx)(`p`,{"aria-busy":`true`,className:`text-small text-faint`,children:`Searching the listings…`});if(e.status===`error`)return(0,I.jsx)(p,{icon:s,title:`No listings to search`,children:e.message});let{page:d}=e;if(d.hits.length===0)return(0,I.jsx)(p,{icon:s,title:t.q?`Nothing for “${t.q}”`:`No listings match`,children:`Try another need, or loosen a facet.`});let f=Math.min(d.offset+d.hits.length,d.matched),m=Object.entries(d.facets.role).slice(0,H),g=i&&P(o)&&!t.q&&!t.role&&d.offset===0&&m.length>0;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,I.jsxs)(`p`,{className:`min-w-0 flex-1 text-small text-muted`,"data-results-summary":!0,children:[g?`Browsing by type: the ${Math.min(U,m.length)} commonest of ${d.matched}`:(0,I.jsxs)(I.Fragment,{children:[t.q?`For “${t.q}”: `:t.role?`${t.role.replace(/-/g,` `)}: `:`Browsing, official first: `,d.offset+1,`–`,f,` of `,d.matched]}),d.from===`snapshot`?` · from this snapshot's listings${d.capped?` (the first of more)`:``}`:``]}),P(o)&&(0,I.jsx)(Q,{gallery:i,onView:l})]}),g?(0,I.jsx)(`div`,{className:`space-y-8`,"data-shelves":!0,children:m.slice(0,U).map(([e,r])=>(0,I.jsx)(ee,{query:t,role:e,count:r,thumbs:o,scheme:c,onOpen:n,onRole:u},e))}):i?(0,I.jsx)(`ul`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-label":`Candidates`,"data-gallery":!0,children:d.hits.map(e=>(0,I.jsx)($,{hit:e,thumbs:o,scheme:c,onOpen:n},e.id))}):(0,I.jsx)(`ul`,{className:`grid gap-3 lg:grid-cols-2`,"aria-label":`Candidates`,children:d.hits.map(e=>(0,I.jsx)(Z,{hit:e,onOpen:n},e.id))}),!g&&(d.offset>0||f<d.matched)&&(0,I.jsxs)(`nav`,{"aria-label":`Pages`,className:`flex items-center gap-2`,children:[(0,I.jsxs)(h,{disabled:d.offset===0,onClick:()=>r(Math.max(0,d.offset-20)),className:`max-md:h-11`,children:[(0,I.jsx)(T,{}),` Previous`]}),(0,I.jsxs)(h,{disabled:f>=d.matched,onClick:()=>r(d.offset+20),className:`max-md:h-11`,children:[`Next `,(0,I.jsx)(a,{})]})]})]})}function Z({hit:e,onOpen:t}){let n=b(e);return(0,I.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-2 rounded-lg border border-line bg-surface p-3`,"data-hit":e.id,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`h3`,{className:`truncate text-body font-medium text-ink`,children:e.title??e.name}),(0,I.jsx)(`p`,{className:`truncate font-mono text-mono-sm text-muted`,children:e.source.ref??e.name})]}),(0,I.jsx)(C,{licence:e.license})]}),(0,I.jsx)(`p`,{className:`line-clamp-2 text-small text-ink-2`,children:e.summary}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-caption text-muted`,children:[(0,I.jsx)(`span`,{children:S(e)}),n.map(e=>(0,I.jsx)(`span`,{className:`tabular`,"data-signal":!0,children:e},e))]}),e.install&&(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 rounded-md bg-sunken px-2 py-0.5`,children:[(0,I.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-mono-sm text-ink-2`,"data-install":!0,children:e.install.command}),(0,I.jsx)(o,{value:e.install.command,label:`Copy install command for ${e.name}`,className:`max-md:size-11`})]}),(0,I.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,I.jsx)(h,{size:`sm`,onClick:()=>t(e),className:`max-md:h-11`,"aria-label":`Preview ${e.title??e.name} in your theme`,"data-open":e.id,children:`Preview in your theme`})})]})}function Q({gallery:e,onView:t}){return(0,I.jsx)(`div`,{role:`group`,"aria-label":`Layout`,className:`inline-flex rounded-md border border-line p-0.5`,"data-view-switch":!0,children:[`gallery`,`list`].map(n=>{let r=n===`gallery`===e,i=n===`gallery`?c:D;return(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":r,onClick:()=>t(n),className:l(`inline-flex items-center gap-1.5 rounded-sm px-2 py-1 text-small transition-colors duration-100 max-md:h-11 max-md:px-3`,r?`bg-raised text-ink`:`text-muted hover:text-ink`),children:[(0,I.jsx)(i,{"aria-hidden":!0,className:`size-3.5`}),n===`gallery`?`Gallery`:`List`]},n)})})}function $({hit:e,thumbs:t,scheme:n,onOpen:r}){let i=t?.items[e.id],a=t?.failed[e.id],o=e.title??e.name,s=b(e);return(0,I.jsxs)(`li`,{className:`group flex min-w-0 flex-col overflow-hidden rounded-lg border border-line bg-surface transition-colors duration-100 hover:border-line-strong`,"data-hit":e.id,"data-picture":i?`yes`:a?`failed`:`none`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:()=>r(e),"aria-label":`Preview ${o} in your theme`,"data-open":e.id,className:`block border-b border-line bg-sunken outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,children:(0,I.jsx)(`span`,{className:`relative block aspect-[5/3] overflow-hidden`,children:i?(0,I.jsx)(`img`,{src:i[n],width:i.width,height:i.height,alt:``,loading:`lazy`,decoding:`async`,className:`absolute inset-0 size-full object-cover`}):(0,I.jsx)(`span`,{className:`absolute inset-0 grid place-items-center p-4 text-center text-small text-faint`,title:a,children:a?F(a):`No picture yet`})})}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 p-3`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,I.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-body font-medium text-ink`,children:o}),(0,I.jsx)(C,{licence:e.license})]}),(0,I.jsx)(`p`,{className:`truncate font-mono text-mono-sm text-muted`,children:e.source.ref??e.name}),s.length>0&&(0,I.jsx)(`p`,{className:`flex flex-wrap gap-x-3 text-caption text-muted`,children:s.map(e=>(0,I.jsx)(`span`,{className:`tabular`,"data-signal":!0,children:e},e))})]})]})}function ee({query:e,role:t,count:n,thumbs:r,scheme:i,onOpen:o,onRole:s}){let c=G({...e,role:t,offset:0}),l=t.replace(/-/g,` `),u=c.status===`ready`?c.page.hits:[],d=u.filter(e=>r?.items[e.id]),f=(d.length>0?d:u).slice(0,W);return(0,I.jsxs)(`section`,{"aria-labelledby":`shelf-${t}`,className:`space-y-3`,"data-shelf":t,children:[(0,I.jsxs)(`header`,{className:`flex items-baseline gap-3`,children:[(0,I.jsx)(`h3`,{id:`shelf-${t}`,className:`text-heading first-letter:uppercase`,children:l}),(0,I.jsx)(`span`,{className:`tabular text-small text-faint`,children:n}),(0,I.jsxs)(`button`,{type:`button`,onClick:()=>s(t),className:`ml-auto inline-flex items-center gap-1 text-small text-accent hover:underline max-md:h-11`,children:[`All `,n,` `,(0,I.jsx)(a,{"aria-hidden":!0,className:`size-3.5`})]})]}),c.status===`error`?(0,I.jsx)(`p`,{className:`text-small text-muted`,children:c.message}):(0,I.jsx)(`ul`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-4`,"aria-label":`${l} candidates`,"aria-busy":c.status===`loading`||void 0,children:f.map(e=>(0,I.jsx)($,{hit:e,thumbs:r,scheme:i,onOpen:o},e.id))})]})}export{K as DiscoverScreen,q as DiscoverView};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Opened-CJyMbxqV.js","assets/react-DB-4Zxce.js","assets/jsx-runtime-D6zNwnaE.js","assets/createLucideIcon-CGDJWtKO.js","assets/CandidatePanel-DfntneYT.js","assets/CopyButton-DE8drl4P.js","assets/clsx-DB0hHKMi.js","assets/circle-alert-DT2LC4yf.js","assets/circle-check-DkwBMT62.js","assets/main-cvOFSjox.js","assets/library-W5R8GwvG.js","assets/compass-BkKOZPYe.js","assets/folder-tree-YghfTmlZ.js","assets/git-pull-request-arrow-RqUUIRCU.js","assets/layers-DfzdK_wG.js","assets/layout-grid-xFY9L9Oc.js","assets/monitor-X_lELkcU.js","assets/paintbrush-DOkEgSTO.js","assets/dist-BogNzeK9.js","assets/main-pNY4iNRo.css","assets/workflow-C53UBmRZ.js","assets/Field-LwrJXoOs.js","assets/discover-va2KFuK_.js","assets/LicenceBadge-CLCUMMHE.js","assets/Badge-CUJUit4d.js","assets/Specimens-D_9hjlJH.js","assets/x-MLbFVa4v.js","assets/inventory-BI8QBdar.js","assets/esm-NPpg23M8.js","assets/dist-C8tf4g8c.js","assets/dist-CC_p8DIj.js","assets/try-live-Iys3nCBG.js","assets/inventory-source-lZYzcA8O.js","assets/Segmented-Dzi1x49S.js","assets/family-tiles-qaK1-_c8.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,t}from"./react-DB-4Zxce.js";import{n,t as r}from"./jsx-runtime-D6zNwnaE.js";import{t as i}from"./createLucideIcon-CGDJWtKO.js";import{t as a}from"./arrow-right-DcbNDzqs.js";import{t as o}from"./CopyButton-DE8drl4P.js";import{t as s}from"./compass-BkKOZPYe.js";import{t as c}from"./layout-grid-xFY9L9Oc.js";import{t as l}from"./clsx-DB0hHKMi.js";import{ht as u,m as d,n as f,o as p,pt as m,s as h}from"./main-cvOFSjox.js";import{t as g}from"./Badge-CUJUit4d.js";import{t as _}from"./SearchField-hF-6-YDM.js";import{a as v,i as y,o as b,r as x,s as S}from"./discover-va2KFuK_.js";import{t as C}from"./LicenceBadge-CLCUMMHE.js";var w={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};w.node;var T=i(w),E={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};E.node;var D=i(E),O=e(t(),1),k=`__youi/discover-thumbs`,A=e=>{let t=e;return!!t&&typeof t.project==`string`&&typeof t.items==`object`&&t.items!==null&&typeof t.failed==`object`&&t.failed!==null},j=null;function M(){return j??=fetch(`/${k}`,{headers:{Accept:`application/json`}}).then(async e=>{if(!e.ok||!e.headers.get(`Content-Type`)?.includes(`application/json`))return null;let t=await e.json().catch(()=>null);return A(t)?t:null},()=>null),j}function N(){let[e,t]=(0,O.useState)(void 0);return(0,O.useEffect)(()=>{let e=!1;return M().then(n=>!e&&t(n)),()=>{e=!0}},[]),e}var P=e=>!!e&&Object.keys(e.items).length>0;function F(e){let t=/^it needs @\/registry\/[^/]+\/(?:ui|blocks|components)\/([\w.-]+)/i.exec(e);if(t)return`Needs its ${t[1]} part`;let n=/^it needs (?:radix-ui's )?([@\w./-]+?)(?:,| \(|$)/i.exec(e);return n?`Needs ${n[1]}`:/failed when it ran/i.test(e)?`Fails when drawn alone`:/draws nothing visible/i.test(e)?`Draws nothing on its own`:/did not draw within|took over/i.test(e)?`Timed out drawing`:/exports no component/i.test(e)?`Nothing to draw`:`Not drawn on its own`}var I=r(),L=()=>n(()=>import(`./Opened-CJyMbxqV.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34])),R=(0,O.lazy)(()=>L().then(e=>({default:e.PinnedSection}))),z=(0,O.lazy)(()=>L().then(e=>({default:e.CandidateLayer}))),B=[`command menu`,`date picker`,`toast`,`dialog`,`tabs`],V=250,H=12,U=8,W=4;function G(e){let[t,n]=(0,O.useState)({status:`loading`}),r=y({...e,open:null,family:null});return(0,O.useEffect)(()=>{let t=new AbortController;return n(e=>e.status===`ready`?e:{status:`loading`}),v(e,{signal:t.signal}).then(e=>n({status:`ready`,page:e}),e=>!t.signal.aborted&&n({status:`error`,message:e instanceof Error?e.message:String(e)})),()=>t.abort()},[r]),t}function K(){return(0,I.jsx)(q,{})}function q({inventory:e}){let t=u(),[n,r]=m(),i=(0,O.useMemo)(()=>x(t),[t]),a=(0,O.useCallback)(e=>r(`${n}${y(e)}`,{replace:!0}),[n,r]),{scheme:o}=d(),[s,c]=(0,O.useState)(null),[l,p]=(0,O.useState)(i.q),h=(0,O.useRef)(i);h.current=i,(0,O.useEffect)(()=>p(i.q),[i.q]),(0,O.useEffect)(()=>{if(l===h.current.q)return;let e=setTimeout(()=>a({...h.current,q:l,offset:0}),V);return()=>clearTimeout(e)},[l,a]);let v=G(i),b=v.status===`ready`?v.page:null,S=N(),C=i.view?i.view===`gallery`:P(S),w=(0,O.useRef)(new Map);for(let e of b?.hits??[])w.current.set(e.id,e);let[T,E]=(0,O.useState)(()=>i.open?[i.open]:[]),[D,k]=(0,O.useState)(null),A=e=>{w.current.set(e.id,e),E(t=>t.includes(e.id)?t:[...t,e.id]),a({...i,open:e.id})},j=i.open?w.current.get(i.open)??null:null,M=(0,O.useCallback)(()=>a({...h.current,open:null}),[a]),F=e=>a({...i,...e,offset:0,open:null});return(0,I.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-screen":`discover`,children:[(0,I.jsx)(f,{title:`Discover`,count:b?.matched,children:(0,I.jsx)(g,{tone:`outline`,children:`Outside references · not built with`})}),(0,I.jsx)(`div`,{ref:c,className:`min-h-0 flex-1 overflow-y-auto`,children:(0,I.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-6 px-6 py-6 max-sm:space-y-4 max-sm:px-4`,children:[(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(_,{value:l,onChange:p,placeholder:`Search by need: command menu, date picker, toast…`,label:`Search by need`,touch:!0,className:`max-w-2xl`}),!i.q&&(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-small text-muted`,children:[(0,I.jsx)(`span`,{children:`Try`}),B.map(e=>(0,I.jsx)(`button`,{type:`button`,onClick:()=>p(e),className:`rounded-sm border border-line px-2 py-0.5 text-ink-2 hover:bg-raised max-md:py-2.5`,children:e},e))]})]}),i.family&&(0,I.jsx)(O.Suspense,{fallback:(0,I.jsx)(`p`,{className:`text-small text-faint`,children:`Loading the pinned family…`}),children:(0,I.jsx)(R,{id:i.family,opened:T,scheme:o,role:i.role,inventory:e,scroller:s,onClear:()=>F({family:null}),onProject:k})}),(0,I.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-[13rem_minmax(0,1fr)]`,children:[(0,I.jsx)(Y,{query:i,page:b,onChange:F}),(0,I.jsxs)(`section`,{"aria-labelledby":`discover-results`,className:`min-w-0 space-y-3`,children:[(0,I.jsx)(`h2`,{id:`discover-results`,className:`sr-only`,children:`Results`}),(0,I.jsx)(X,{listings:v,query:i,onOpen:A,onPage:e=>a({...i,offset:e,open:null}),gallery:C,thumbs:S??null,scheme:o,onView:e=>a({...i,view:e,open:null}),onRole:e=>F({role:e})})]})]})]})}),(T.length>0||j)&&(0,I.jsx)(O.Suspense,{fallback:null,children:(0,I.jsx)(z,{openHit:j,opened:T,project:i.family?D:null,scheme:o,family:i.family,onClose:M})})]})}function J({label:e,value:t,options:n,onChange:r,disabled:i}){return(0,I.jsxs)(`fieldset`,{className:`min-w-0 space-y-1`,disabled:i!==void 0,children:[(0,I.jsx)(`legend`,{className:`mb-1 text-caption font-medium tracking-wide text-muted uppercase`,children:e}),i===void 0?(0,I.jsx)(`ul`,{className:`flex flex-col gap-0.5 max-md:flex-row max-md:flex-wrap`,children:[{value:``,label:`Any`,count:null},...n].map(e=>{let n=(t??``)===e.value;return(0,I.jsx)(`li`,{children:(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:()=>r(e.value||null),className:l(`flex w-full min-w-0 items-center gap-2 rounded-sm px-2 py-1 text-left text-small max-md:h-11 max-md:w-auto max-md:border max-md:border-line`,n?`bg-accent-soft text-accent`:`text-ink-2 hover:bg-raised`),children:[(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count!==null&&(0,I.jsx)(`span`,{className:`tabular text-caption text-faint`,children:e.count})]})},e.value||`any`)})}):(0,I.jsx)(`p`,{className:`text-small text-faint`,children:i})]})}function Y({query:e,page:t,onChange:n}){let r=t?.facets??{role:{},source:{},licence:{},style:{}},i=e=>Object.entries(e),a=(e,t)=>t&&!e.some(e=>e.value===t)?[...e,{value:t,label:t.replace(/-/g,` `),count:null}]:e,o=r.licence.unknown??0,s=i(r.licence).reduce((e,[t,n])=>e+(t===`unknown`?0:n),0);return(0,I.jsxs)(`aside`,{"aria-label":`Facets`,className:`space-y-4 max-md:space-y-3`,"data-facets":!0,children:[(0,I.jsx)(J,{label:`Role`,value:e.role,onChange:e=>n({role:e}),options:a(i(r.role).slice(0,H).map(([e,t])=>({value:e,label:e.replace(/-/g,` `),count:t})),e.role)}),(0,I.jsx)(J,{label:`Source`,value:e.source,onChange:e=>n({source:e}),options:a(i(r.source).map(([e,t])=>({value:e,label:e,count:t})),e.source)}),(0,I.jsx)(J,{label:`Licence`,value:e.licence,onChange:e=>n({licence:e}),options:[{value:`known`,label:`Known`,count:t?s:null},{value:`unknown`,label:`Unknown`,count:t?o:null}]}),(0,I.jsx)(J,{label:`Style`,value:e.style,onChange:e=>n({style:e}),options:[{value:`headless`,label:`Headless`,count:t?r.style.headless??0:null},{value:`styled`,label:`Styled`,count:t?r.style.styled??0:null}]}),(0,I.jsx)(J,{label:`Seen on`,value:null,onChange:()=>void 0,options:[],disabled:`Later: which sites you know use it.`})]})}function X({listings:e,query:t,onOpen:n,onPage:r,gallery:i,thumbs:o,scheme:c,onView:l,onRole:u}){if(e.status===`loading`)return(0,I.jsx)(`p`,{"aria-busy":`true`,className:`text-small text-faint`,children:`Searching the listings…`});if(e.status===`error`)return(0,I.jsx)(p,{icon:s,title:`No listings to search`,children:e.message});let{page:d}=e;if(d.hits.length===0)return(0,I.jsx)(p,{icon:s,title:t.q?`Nothing for “${t.q}”`:`No listings match`,children:`Try another need, or loosen a facet.`});let f=Math.min(d.offset+d.hits.length,d.matched),m=Object.entries(d.facets.role).slice(0,H),g=i&&P(o)&&!t.q&&!t.role&&d.offset===0&&m.length>0;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,I.jsxs)(`p`,{className:`min-w-0 flex-1 text-small text-muted`,"data-results-summary":!0,children:[g?`Browsing by type: the ${Math.min(U,m.length)} commonest of ${d.matched}`:(0,I.jsxs)(I.Fragment,{children:[t.q?`For “${t.q}”: `:t.role?`${t.role.replace(/-/g,` `)}: `:`Browsing, official first: `,d.offset+1,`–`,f,` of `,d.matched]}),d.from===`snapshot`?` · from this snapshot's listings${d.capped?` (the first of more)`:``}`:``]}),P(o)&&(0,I.jsx)(Q,{gallery:i,onView:l})]}),g?(0,I.jsx)(`div`,{className:`space-y-8`,"data-shelves":!0,children:m.slice(0,U).map(([e,r])=>(0,I.jsx)(ee,{query:t,role:e,count:r,thumbs:o,scheme:c,onOpen:n,onRole:u},e))}):i?(0,I.jsx)(`ul`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-label":`Candidates`,"data-gallery":!0,children:d.hits.map(e=>(0,I.jsx)($,{hit:e,thumbs:o,scheme:c,onOpen:n},e.id))}):(0,I.jsx)(`ul`,{className:`grid gap-3 lg:grid-cols-2`,"aria-label":`Candidates`,children:d.hits.map(e=>(0,I.jsx)(Z,{hit:e,onOpen:n},e.id))}),!g&&(d.offset>0||f<d.matched)&&(0,I.jsxs)(`nav`,{"aria-label":`Pages`,className:`flex items-center gap-2`,children:[(0,I.jsxs)(h,{disabled:d.offset===0,onClick:()=>r(Math.max(0,d.offset-20)),className:`max-md:h-11`,children:[(0,I.jsx)(T,{}),` Previous`]}),(0,I.jsxs)(h,{disabled:f>=d.matched,onClick:()=>r(d.offset+20),className:`max-md:h-11`,children:[`Next `,(0,I.jsx)(a,{})]})]})]})}function Z({hit:e,onOpen:t}){let n=b(e);return(0,I.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-2 rounded-lg border border-line bg-surface p-3`,"data-hit":e.id,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`h3`,{className:`truncate text-body font-medium text-ink`,children:e.title??e.name}),(0,I.jsx)(`p`,{className:`truncate font-mono text-mono-sm text-muted`,children:e.source.ref??e.name})]}),(0,I.jsx)(C,{licence:e.license})]}),(0,I.jsx)(`p`,{className:`line-clamp-2 text-small text-ink-2`,children:e.summary}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-caption text-muted`,children:[(0,I.jsx)(`span`,{children:S(e)}),n.map(e=>(0,I.jsx)(`span`,{className:`tabular`,"data-signal":!0,children:e},e))]}),e.install&&(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 rounded-md bg-sunken px-2 py-0.5`,children:[(0,I.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-mono-sm text-ink-2`,"data-install":!0,children:e.install.command}),(0,I.jsx)(o,{value:e.install.command,label:`Copy install command for ${e.name}`,className:`max-md:size-11`})]}),(0,I.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,I.jsx)(h,{size:`sm`,onClick:()=>t(e),className:`max-md:h-11`,"aria-label":`Preview ${e.title??e.name} in your theme`,"data-open":e.id,children:`Preview in your theme`})})]})}function Q({gallery:e,onView:t}){return(0,I.jsx)(`div`,{role:`group`,"aria-label":`Layout`,className:`inline-flex rounded-md border border-line p-0.5`,"data-view-switch":!0,children:[`gallery`,`list`].map(n=>{let r=n===`gallery`===e,i=n===`gallery`?c:D;return(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":r,onClick:()=>t(n),className:l(`inline-flex items-center gap-1.5 rounded-sm px-2 py-1 text-small transition-colors duration-100 max-md:h-11 max-md:px-3`,r?`bg-raised text-ink`:`text-muted hover:text-ink`),children:[(0,I.jsx)(i,{"aria-hidden":!0,className:`size-3.5`}),n===`gallery`?`Gallery`:`List`]},n)})})}function $({hit:e,thumbs:t,scheme:n,onOpen:r}){let i=t?.items[e.id],a=t?.failed[e.id],o=e.title??e.name,s=b(e);return(0,I.jsxs)(`li`,{className:`group flex min-w-0 flex-col overflow-hidden rounded-lg border border-line bg-surface transition-colors duration-100 hover:border-line-strong`,"data-hit":e.id,"data-picture":i?`yes`:a?`failed`:`none`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:()=>r(e),"aria-label":`Preview ${o} in your theme`,"data-open":e.id,className:`block border-b border-line bg-sunken outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,children:(0,I.jsx)(`span`,{className:`relative block aspect-[5/3] overflow-hidden`,children:i?(0,I.jsx)(`img`,{src:i[n],width:i.width,height:i.height,alt:``,loading:`lazy`,decoding:`async`,className:`absolute inset-0 size-full object-cover`}):(0,I.jsx)(`span`,{className:`absolute inset-0 grid place-items-center p-4 text-center text-small text-faint`,title:a,children:a?F(a):`No picture yet`})})}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 p-3`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,I.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-body font-medium text-ink`,children:o}),(0,I.jsx)(C,{licence:e.license})]}),(0,I.jsx)(`p`,{className:`truncate font-mono text-mono-sm text-muted`,children:e.source.ref??e.name}),s.length>0&&(0,I.jsx)(`p`,{className:`flex flex-wrap gap-x-3 text-caption text-muted`,children:s.map(e=>(0,I.jsx)(`span`,{className:`tabular`,"data-signal":!0,children:e},e))})]})]})}function ee({query:e,role:t,count:n,thumbs:r,scheme:i,onOpen:o,onRole:s}){let c=G({...e,role:t,offset:0}),l=t.replace(/-/g,` `),u=c.status===`ready`?c.page.hits:[],d=u.filter(e=>r?.items[e.id]),f=(d.length>0?d:u).slice(0,W);return(0,I.jsxs)(`section`,{"aria-labelledby":`shelf-${t}`,className:`space-y-3`,"data-shelf":t,children:[(0,I.jsxs)(`header`,{className:`flex items-baseline gap-3`,children:[(0,I.jsx)(`h3`,{id:`shelf-${t}`,className:`text-heading first-letter:uppercase`,children:l}),(0,I.jsx)(`span`,{className:`tabular text-small text-faint`,children:n}),(0,I.jsxs)(`button`,{type:`button`,onClick:()=>s(t),className:`ml-auto inline-flex items-center gap-1 text-small text-accent hover:underline max-md:h-11`,children:[`All `,n,` `,(0,I.jsx)(a,{"aria-hidden":!0,className:`size-3.5`})]})]}),c.status===`error`?(0,I.jsx)(`p`,{className:`text-small text-muted`,children:c.message}):(0,I.jsx)(`ul`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-4`,"aria-label":`${l} candidates`,"aria-busy":c.status===`loading`||void 0,children:f.map(e=>(0,I.jsx)($,{hit:e,thumbs:r,scheme:i,onOpen:o},e.id))})]})}export{K as DiscoverScreen,q as DiscoverView};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./createLucideIcon-CGDJWtKO.js";import{t as i}from"./CopyButton-DE8drl4P.js";import{t as a}from"./circle-alert-DT2LC4yf.js";import{t as o}from"./paintbrush-DOkEgSTO.js";import{i as s}from"./ServiceDown-S4ya0Cob.js";import{t as c}from"./shield-check-0ka0kQct.js";import{t as l}from"./trash-B7aEfJps.js";import{t as u}from"./triangle-alert-Dkdi9eDR.js";import{t as d}from"./x-MLbFVa4v.js";import{t as f}from"./clsx-DB0hHKMi.js";import{C as p,H as m,dt as h,f as g,s as _}from"./main-cvOFSjox.js";import{n as v}from"./plural-BbGQPQKA.js";import{a as y,n as b}from"./workflow-C53UBmRZ.js";import{t as x}from"./Badge-CUJUit4d.js";import{a as S,i as C,n as w,o as T,r as E}from"./Field-LwrJXoOs.js";import{t as ee}from"./Swatch-KDz4qxdM.js";import{n as D}from"./Section-BTnvUq_W.js";import{t as te}from"./CodeBlock-CsiGFgvI.js";import{t as O}from"./Segmented-Dzi1x49S.js";import{i as ne,u as re}from"./values-cLekxBZj.js";import{a as ie,i as ae,n as oe,o as se,r as ce,s as le,t as ue}from"./dist-C8tf4g8c.js";var k={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};k.node;var A=r(k),j={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};j.node;var de=r(j),M=n(),fe={text:`text`,large:`large text`,ui:`UI part`};function pe({failing:e,revision:t,onConfirm:n,onClose:r}){return(0,M.jsx)(ue,{open:!0,onOpenChange:e=>!e&&r(),children:(0,M.jsxs)(se,{children:[(0,M.jsx)(ie,{className:`fixed inset-0 z-50 bg-scrim animate-fade`}),(0,M.jsxs)(ce,{className:`fixed inset-x-0 top-[10vh] z-50 mx-auto flex max-h-[80vh] w-[min(560px,calc(100vw-24px))] flex-col rounded-xl border border-line bg-surface shadow-popover outline-none animate-pop`,children:[(0,M.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-2 border-b border-line px-5`,children:[(0,M.jsx)(u,{"aria-hidden":!0,className:`size-4 text-danger`}),(0,M.jsxs)(le,{className:`text-heading`,children:[`Approve with `,e.length,` contrast failure(s)?`]}),(0,M.jsx)(oe,{"aria-label":`Close`,className:`ml-auto grid size-7 place-items-center rounded-md text-muted hover:bg-raised hover:text-ink`,children:(0,M.jsx)(d,{className:`size-4`})})]}),(0,M.jsxs)(`div`,{className:`min-h-0 space-y-3 overflow-y-auto p-5`,children:[(0,M.jsxs)(ae,{className:`text-small text-ink-2`,children:[`Revision `,t,` puts these colour pairs below WCAG AA. Each passed before this draft, or did not exist. Approving records that you accepted exactly these pairs, and the review branch's commit names them.`]}),(0,M.jsx)(`ul`,{"aria-label":`Colour pairs this draft puts below WCAG AA`,className:`divide-y divide-line overflow-hidden rounded-md border border-line`,children:e.map(e=>(0,M.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,M.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`span`,{className:`block text-small text-ink`,children:e.label}),(0,M.jsxs)(`span`,{className:`block text-caption text-muted`,children:[(0,M.jsx)(`span`,{className:`capitalize`,children:e.scheme}),` · `,fe[e.kind],` · needs `,e.required,`:1`,e.before===null?` · new pair`:` · was ${e.before.toFixed(2)}:1`,e.unreadable&&(0,M.jsx)(`span`,{className:`block text-danger`,children:e.unreadable})]})]}),(0,M.jsx)(`span`,{className:`tabular font-mono text-mono-sm text-ink`,children:e.after===null?`?`:`${e.after.toFixed(2)}:1`}),(0,M.jsx)(x,{tone:`danger`,children:e.after===null?`Unreadable`:`Below AA`})]},e.key))})]}),(0,M.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-line px-5 py-3`,children:[(0,M.jsx)(oe,{asChild:!0,children:(0,M.jsx)(_,{autoFocus:!0,children:`Keep editing`})}),(0,M.jsxs)(_,{variant:`primary`,onClick:n,children:[(0,M.jsx)(c,{}),` Approve with these `,e.length,` failure(s)`]})]})]})]})})}var N=e(t(),1),P=150,F={new:{label:`New`,tone:`accent`},kept:{label:`Already flagged`,tone:`neutral`},resolved:{label:`No longer flagged`,tone:`success`}};function me({preview:e,project:t,stale:n}){let[r,i]=(0,N.useState)(`all`),a=r===`all`||e.findings.some(e=>e.change===r)?r:`all`,o=(0,N.useMemo)(()=>a===`all`?e.findings:e.findings.filter(e=>e.change===a),[e,a]),s=[{value:`all`,label:`All`,count:e.findings.length},{value:`new`,label:`New`,count:e.counts.new},...e.counts.kept?[{value:`kept`,label:`Already`,count:e.counts.kept}]:[],...e.counts.resolved?[{value:`resolved`,label:`No longer`,count:e.counts.resolved}]:[]];return(0,M.jsxs)(`div`,{className:f(`space-y-4`,n&&`opacity-60`),children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(`p`,{className:`text-title`,children:e.enforced?(0,M.jsxs)(M.Fragment,{children:[`Would flag `,(0,M.jsx)(`span`,{className:`tabular`,children:v(e.flagged,`place`)}),e.flagged>0&&(0,M.jsxs)(`span`,{className:`text-muted`,children:[` in `,v(e.files,`file`)]})]}):`Flags nothing`}),(0,M.jsxs)(`p`,{className:`text-small text-muted`,children:[(0,M.jsx)(`span`,{className:`tabular`,children:e.counts.new}),` new · `,(0,M.jsx)(`span`,{className:`tabular`,children:e.counts.kept}),` already flagged · `,(0,M.jsx)(`span`,{className:`tabular`,children:e.counts.resolved}),` no longer flagged`,e.counts.suppressed>0&&(0,M.jsxs)(M.Fragment,{children:[` `,`· `,(0,M.jsx)(`span`,{className:`tabular`,children:e.counts.suppressed}),` silenced by youi-ignore`]})]}),(0,M.jsxs)(`p`,{className:`font-mono text-mono-sm text-muted`,children:[t,e.snapshot.projectCommit?` @ ${e.snapshot.projectCommit.slice(0,7)}`:``,e.snapshot.projectChanges?` + uncommitted edits`:``,` · `,v(e.scan.files,`file`),` scanned · `,e.durationMs,` ms · `,new Date(e.at).toLocaleTimeString()]})]}),e.limits.length>0&&(0,M.jsx)(`ul`,{className:`space-y-1.5 rounded-md bg-warning-soft px-3 py-2`,children:e.limits.map(e=>(0,M.jsxs)(`li`,{className:`flex gap-2 text-small text-ink-2`,children:[(0,M.jsx)(u,{className:`mt-0.5 size-3.5 shrink-0 text-warning`}),e]},e))}),e.findings.length>0&&(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(O,{label:`Show`,value:a,options:s,onChange:i}),(0,M.jsx)(`ul`,{className:`max-h-[28rem] divide-y divide-line overflow-y-auto rounded-md border border-line`,children:o.slice(0,P).map(e=>(0,M.jsxs)(`li`,{className:`space-y-1 px-3 py-2`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,M.jsx)(x,{tone:F[e.change].tone,children:F[e.change].label}),(0,M.jsxs)(`span`,{className:`min-w-0 truncate font-mono text-mono-sm text-ink-2`,children:[e.file,(0,M.jsxs)(`span`,{className:`text-muted`,children:[`:`,e.line]})]})]}),(0,M.jsx)(`p`,{className:`text-small text-ink-2`,children:e.message}),(0,M.jsx)(`code`,{className:`block truncate font-mono text-mono-sm text-muted`,children:e.text}),e.suggestion&&(0,M.jsxs)(`p`,{className:`text-small text-muted`,children:[`Try: `,e.suggestion]})]},`${e.change}:${e.file}:${e.line}:${e.column}:${e.text}`))}),(o.length>P||e.truncated)&&(0,M.jsxs)(`p`,{className:`text-small text-muted`,children:[`Showing the first `,Math.min(o.length,P),`. Run youiyoux check in the project for the full list.`]})]})]})}var he=[{value:`error`,label:`Error`},{value:`warn`,label:`Warning`},{value:`off`,label:`Off`}],I=[`button`,`input`,`textarea`,`select`,`a`,`label`,`dialog`];function ge(e,t){let n=e.find(e=>e.startsWith(`${t}:`)||e.startsWith(`${t}.`));return n?.slice(n.indexOf(`:`)+1).trim()}var L=e=>e.split(`
|
|
2
|
+
`),R=e=>e.toLowerCase().replace(/[^a-z0-9.]+/g,`-`).replace(/^[-.]+|[-.]+$/g,``),z=e=>e.engine===`youi`?e.id:e.engine;function _e(e,t){let n=t.find(t=>(t.id??t.engine)===e);return!n||n.engine===`advisory`?{engine:`advisory`}:{engine:`youi`,id:n.id,options:{...n.defaults}}}function ve({value:e,onChange:t,info:n,mode:r,readOnly:i,problems:a}){let o=e.rule,s=n=>t({...e,rule:{...o,...n}}),c=`youi:${n.project.system}/rule/`,l=o.id.startsWith(c)?o.id.slice(c.length):o.id,u=n.checks.find(e=>(e.id??e.engine)===z(o.check)),[d]=(0,N.useState)(o.check.engine===`ast-grep`?o.check:null),f=e=>ge(a,e),p=e=>{let t=r===`create`&&(l===``||l===R(o.title));s({title:e,...t?{id:`${c}${R(e)}`}:{}})};return(0,M.jsxs)(`fieldset`,{disabled:i,className:`min-w-0 space-y-8`,children:[(0,M.jsx)(D,{title:`What it says`,children:(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(E,{label:`Title`,error:f(`title`),children:(e,t)=>(0,M.jsx)(T,{id:e,"aria-describedby":t,value:o.title,placeholder:`Use the owned Select, not a native select`,onChange:e=>p(e.target.value)})}),(0,M.jsx)(E,{label:`Rule id`,error:f(`id`),hint:r===`edit`?`An existing rule keeps its id.`:`Lowercase words joined by dots or dashes, e.g. components.no-native-select.`,children:(e,t)=>(0,M.jsxs)(`div`,{className:`flex items-center rounded-md border border-line bg-sunken font-mono text-mono-sm`,children:[(0,M.jsx)(`span`,{className:`shrink-0 pl-2.5 text-muted`,children:c}),(0,M.jsx)(T,{id:e,"aria-describedby":t,value:l,readOnly:r===`edit`,onChange:e=>s({id:`${c}${e.target.value.trim()}`}),className:`h-8 border-0 bg-transparent pl-0 font-mono text-mono-sm`})]})}),(0,M.jsx)(E,{label:`Statement`,hint:`The rule, for people: one or two sentences.`,error:f(`statement`),children:(e,t)=>(0,M.jsx)(S,{id:e,"aria-describedby":t,value:o.statement,onChange:e=>s({statement:e.target.value})})}),(0,M.jsx)(E,{label:`Why`,hint:`What goes wrong without it. Reviewers and agents read this when the rule seems inconvenient.`,error:f(`rationale`),children:(e,t)=>(0,M.jsx)(S,{id:e,"aria-describedby":t,value:o.rationale,onChange:e=>s({rationale:e.target.value})})}),(0,M.jsx)(E,{label:`Instruction for agents`,hint:`One imperative line. Agents get it from system_get_rules and the AGENTS.md block.`,error:f(`agent`),children:(e,t)=>(0,M.jsx)(S,{id:e,"aria-describedby":t,rows:2,value:o.agent,placeholder:`Never render a native <select>; use <Select> from the components directory.`,onChange:e=>s({agent:e.target.value})})})]})}),(0,M.jsx)(D,{title:`How hard it bites`,children:(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(O,{label:`Severity`,value:o.severity,options:he,onChange:e=>s({severity:e,...e===`warn`?{}:{rollout:null}})}),(0,M.jsx)(`p`,{className:`text-small text-muted`,children:o.severity===`error`?`Fails youiyoux check.`:o.severity===`warn`?`Reported by youiyoux check; never fails it.`:`Published, but never checked.`}),o.severity===`warn`&&(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 rounded-md border border-line bg-sunken px-3 py-2.5`,children:[(0,M.jsx)(w,{label:`Plan to tighten it to an error`,checked:o.rollout!==null,onChange:e=>s({rollout:e.target.checked?{to:`error`}:null})}),o.rollout&&(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-small text-muted`,children:[`after`,(0,M.jsx)(T,{type:`date`,value:o.rollout.after??``,onChange:e=>s({rollout:{to:`error`,...e.target.value?{after:e.target.value}:{},...o.rollout?.note?{note:o.rollout.note}:{}}}),className:`h-7 w-auto`})]}),(0,M.jsx)(`p`,{className:`w-full text-small text-muted`,children:`Warn first, then tighten. Tightening is its own reviewed change, made from this rule once the places it flags are fixed.`})]}),f(`severity`)&&(0,M.jsx)(`p`,{className:`text-small text-danger`,children:f(`severity`)})]})}),(0,M.jsx)(D,{title:`How it is checked`,children:(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(E,{label:`Check`,hint:u?.description??(d&&o.check.engine===`ast-grep`?`youiyoux check runs this ast-grep rule on ${d.language} files; its body stays as written in the rule file.`:`This check cannot run here yet; pick one that can.`),error:f(`check`),children:(e,t)=>(0,M.jsxs)(C,{id:e,"aria-describedby":t,value:u?z(o.check):o.check.engine===`ast-grep`?`ast-grep`:`unsupported`,onChange:e=>s({check:e.target.value===`ast-grep`&&d?d:_e(e.target.value,n.checks)}),children:[d&&(0,M.jsxs)(`option`,{value:`ast-grep`,children:[`Custom ast-grep rule (`,d.language,`, kept as written)`]}),!u&&o.check.engine!==`ast-grep`&&(0,M.jsx)(`option`,{value:`unsupported`,children:`Custom check (cannot run yet)`}),n.checks.map(e=>(0,M.jsx)(`option`,{value:e.id??e.engine,children:e.label},e.id??e.engine))]})}),u?.options===`native-elements`&&o.check.engine===`youi`&&(0,M.jsx)(be,{options:o.check.options,info:n,onChange:e=>s({check:{...o.check,options:e}})}),(0,M.jsx)(E,{label:`Files`,hint:`Globs, one per line, relative to the project root.`,error:f(`files`),children:(e,t)=>(0,M.jsx)(S,{id:e,"aria-describedby":t,rows:2,value:o.files.join(`
|
|
3
|
+
`),onChange:e=>s({files:L(e.target.value)}),className:`font-mono text-mono-sm`})})]})}),(0,M.jsx)(D,{title:`Examples`,children:(0,M.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,M.jsx)(E,{label:`Breaks the rule`,hint:`One example per line.`,error:f(`examples`),children:(e,t)=>(0,M.jsx)(S,{id:e,"aria-describedby":t,rows:4,value:o.examples.bad.join(`
|
|
4
|
+
`),onChange:e=>s({examples:{...o.examples,bad:L(e.target.value)}}),className:`font-mono text-mono-sm`})}),(0,M.jsx)(E,{label:`Follows the rule`,hint:`One example per line.`,children:(e,t)=>(0,M.jsx)(S,{id:e,"aria-describedby":t,rows:4,value:o.examples.good.join(`
|
|
5
|
+
`),onChange:e=>s({examples:{...o.examples,good:L(e.target.value)}}),className:`font-mono text-mono-sm`})})]})}),(0,M.jsxs)(D,{title:`Components that follow it`,count:e.components.length,children:[(0,M.jsx)(`p`,{className:`text-small text-muted`,children:`Listed on each component's Rules tab. The check runs on every matching file either way.`}),(0,M.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-2 sm:grid-cols-3`,children:n.components.map(n=>(0,M.jsx)(w,{label:n.name,checked:e.components.includes(n.id),onChange:r=>t({...e,components:r.target.checked?[...e.components,n.id]:e.components.filter(e=>e!==n.id)})},n.id))}),f(`components`)&&(0,M.jsx)(`p`,{className:`text-small text-danger`,children:f(`components`)})]})]})}var B=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function ye({value:e,onChange:t}){let[n,r]=(0,N.useState)(e.join(`, `)),i=B(n).join(`,`)===e.join(`,`)?n:e.join(`, `);return(0,M.jsx)(E,{label:`Input types that stay native`,hint:`Comma-separated, e.g. hidden, checkbox, file.`,children:(e,n)=>(0,M.jsx)(T,{id:e,"aria-describedby":n,value:i,onChange:e=>{r(e.target.value),t(B(e.target.value))},className:`font-mono text-mono-sm`})})}function be({options:e,info:t,onChange:n}){let r=e.elements??{},i=e.allowInputTypes??[],a=Object.entries(r),o=(e,t=i)=>n({elements:e,allowInputTypes:t}),c=I.find(e=>!(e in r)),l=t.components[0];return(0,M.jsxs)(`div`,{className:`space-y-2.5 rounded-md border border-line p-3`,children:[(0,M.jsx)(`p`,{className:`text-small font-medium text-ink-2`,children:`Native tag → the component to render instead`}),a.length===0&&(0,M.jsx)(`p`,{className:`text-small text-muted`,children:`No tags yet: this check flags nothing until you add one.`}),a.map(([e,n])=>(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`div`,{className:`w-36 shrink-0`,children:(0,M.jsx)(C,{"aria-label":`Native tag`,value:e,className:`font-mono text-mono-sm`,onChange:t=>o(Object.fromEntries(a.map(([n,r])=>n===e?[t.target.value,r]:[n,r]))),children:I.filter(t=>t===e||!(t in r)).map(e=>(0,M.jsx)(`option`,{value:e,children:`<${e}>`},e))})}),(0,M.jsx)(`span`,{className:`text-muted`,children:`→`}),(0,M.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,M.jsx)(C,{"aria-label":`Component for <${e}>`,value:n,onChange:t=>o({...r,[e]:t.target.value}),children:t.components.map(e=>(0,M.jsx)(`option`,{value:e.id,children:e.name},e.id))})}),(0,M.jsx)(_,{variant:`ghost`,size:`icon`,"aria-label":`Remove <${e}>`,onClick:()=>o(Object.fromEntries(a.filter(([t])=>t!==e))),children:(0,M.jsx)(d,{})})]},e)),c&&l&&(0,M.jsxs)(_,{size:`sm`,onClick:()=>o({...r,[c]:l.id}),children:[(0,M.jsx)(s,{}),` Add a tag`]}),(0,M.jsx)(ye,{value:i,onChange:e=>o(r,e)})]})}var xe=e=>e.content.entry.license&&e.content.entry.license!==`unknown`?e.content.entry.license.spdx:`unknown`;function V(e){let t=e.content.entry.source.ref??e.content.entry.name;return e.content.request===`adopt`?`Adopt ${t}`:`Save ${t} to the Library`}function Se({draft:e,info:t,onUpdate:n}){let{busy:r,failure:a,run:o}=J(n),{entry:s,request:c,reason:l,swapsWith:u}=e.content,d=xe(e),f=e.preview;return(0,M.jsxs)(`article`,{className:`min-h-0 flex-1 overflow-y-auto animate-enter`,children:[(0,M.jsx)(Y,{draft:e,title:V(e),kind:c===`adopt`?`Adoption request`:`Library`,detail:`${e.id} · revision ${e.revision} · from ${e.base.branch}@${e.base.commit.slice(0,7)}`,busy:r,run:o}),(0,M.jsx)(X,{draft:e,busy:r,run:o,failure:a}),(0,M.jsxs)(`div`,{className:`grid min-w-0 lg:grid-cols-[minmax(0,1fr)_minmax(0,34rem)]`,children:[(0,M.jsx)(`div`,{className:`min-w-0 space-y-6 p-6`,children:(0,M.jsxs)(D,{title:`The item`,children:[(0,M.jsxs)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-1.5 text-small`,children:[(0,M.jsx)(`dt`,{className:`text-muted`,children:`Name`}),(0,M.jsx)(`dd`,{className:`text-ink`,children:s.title??s.name}),(0,M.jsx)(`dt`,{className:`text-muted`,children:`Source`}),(0,M.jsx)(`dd`,{className:`font-mono text-mono-sm text-ink-2`,children:s.source.ref??s.source.name}),(0,M.jsx)(`dt`,{className:`text-muted`,children:`Licence`}),(0,M.jsx)(`dd`,{children:d===`unknown`?(0,M.jsx)(x,{tone:`warning`,children:`licence unknown`}):(0,M.jsx)(`span`,{className:`text-ink`,children:d})}),(0,M.jsx)(`dt`,{className:`text-muted`,children:`Stage`}),(0,M.jsx)(`dd`,{className:`font-mono text-mono-sm text-ink-2`,children:c===`adopt`?`candidate (a person decides)`:`library (a reference)`}),(0,M.jsx)(`dt`,{className:`text-muted`,children:`Swaps with`}),(0,M.jsx)(`dd`,{className:`text-ink-2`,children:u.length?u.join(`, `):`nothing named`}),l&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`dt`,{className:`text-muted`,children:`Why`}),(0,M.jsx)(`dd`,{className:`text-ink-2`,children:l})]})]}),s.install&&(0,M.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[(0,M.jsx)(`p`,{className:`text-small text-muted`,children:`Install, after adoption (copy only: the hub never runs it)`}),(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 rounded-md bg-sunken px-2 py-1`,children:[(0,M.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-mono-sm text-ink-2`,children:s.install.command}),(0,M.jsx)(i,{value:s.install.command,label:`Copy install command`})]})]})]})}),(0,M.jsx)(Z,{draft:e,info:t,busy:r,run:o,dirty:!1,previewStale:e.previewStale,onPreview:()=>void o(`preview`,()=>y.preview(e.id)),intro:`Checks the item is a valid youi.library/v1 entry, where it is written, and what swapping it in for each named family touches.`,impact:f&&(0,M.jsxs)(`div`,{className:`space-y-2 text-small`,"data-testid":`library-preview`,children:[(0,M.jsxs)(`p`,{className:`text-ink-2`,children:[`Writes `,(0,M.jsx)(`code`,{className:`font-mono text-mono-sm`,children:f.file}),` (`,f.exists?`an edit`:`a new file`,`), stage `,f.stage,`, licence `,f.license,`.`]}),f.swaps.length>0&&(0,M.jsx)(`ul`,{className:`space-y-0.5`,children:f.swaps.map(e=>(0,M.jsxs)(`li`,{className:`text-ink-2`,children:[(0,M.jsx)(`span`,{className:`font-mono text-mono-sm`,children:e.target}),` `,e.looks===null?(0,M.jsx)(`span`,{className:`text-muted`,children:`· not counted`}):(0,M.jsxs)(`span`,{className:`text-muted`,children:[`· `,v(e.looks,`look`),` in `,v(e.files??0,`file`),` on `,v(e.routes??0,`route`)]})]},e.target))}),f.limits.map(e=>(0,M.jsx)(`p`,{className:`text-muted`,children:e},e))]})})]})]})}var H=40,Ce=/^(?:#[0-9a-f]{3,8}|rgb\()/i,U={new:{label:`Below AA`,tone:`danger`},kept:{label:`Still below AA`,tone:`warning`},fixed:{label:`Now passes`,tone:`success`}};function W({css:e}){return(0,M.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5`,children:[Ce.test(e)&&(0,M.jsx)(ee,{color:e,size:`xs`}),(0,M.jsx)(`code`,{className:`truncate font-mono text-mono-sm text-ink-2`,title:e,children:e})]})}function G({before:e,after:t}){return e===t?(0,M.jsx)(`span`,{className:`text-small text-faint`,children:`unchanged`}):(0,M.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,M.jsx)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-muted line-through decoration-faint`,children:(0,M.jsx)(W,{css:e})}),(0,M.jsx)(W,{css:t})]})}function we(e,t){let n=new Map;for(let r of e){let e=t===`file`?[r.file]:r.routes.length>0?r.routes:[r.routeSource===`shell`?`* (app shell)`:`Not on any screen`];for(let t of e)n.set(t,[...n.get(t)??[],r])}return[...n].sort((e,t)=>t[1].length-e[1].length||e[0].localeCompare(t[0]))}function Te({preview:e}){let[t,n]=(0,N.useState)(`file`),[r,i]=(0,N.useState)(1),a=(0,N.useMemo)(()=>we(e.sites,t),[e,t]),o=a.slice(0,r*H);return(0,M.jsx)(D,{title:`Where it shows`,count:`${e.totals.sites} site(s)`,aside:(0,M.jsx)(O,{label:`Group sites by`,value:t,onChange:e=>{n(e),i(1)},options:[{value:`file`,label:`By file`},{value:`route`,label:`By screen`}]}),children:e.sites.length===0?(0,M.jsx)(`p`,{className:`text-small text-muted`,children:`No component that changes is used in the project.`}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`ul`,{className:`divide-y divide-line overflow-hidden rounded-md border border-line`,children:o.map(([e,n])=>(0,M.jsxs)(`li`,{className:`px-3 py-2`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-mono-sm text-ink`,children:e}),(0,M.jsx)(`span`,{className:`tabular text-small text-muted`,children:n.length})]}),(0,M.jsx)(`ul`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-0.5`,children:n.map(n=>(0,M.jsxs)(`li`,{className:`font-mono text-mono-sm text-muted`,children:[t===`route`&&(0,M.jsx)(`span`,{className:`text-ink-2`,children:n.file}),`:`,n.line,` `,(0,M.jsx)(`span`,{className:`text-ink-2`,children:n.export})]},`${n.file}:${n.line}:${n.column}:${e}`))})]},e))}),(0,M.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-small text-muted`,children:[`Showing `,o.length,` of `,a.length,` `,t===`file`?`files`:`screens`,` (`,v(e.sites.length,`site`),e.truncated?` listed of ${e.totals.sites}`:``,`).`,o.length<a.length&&(0,M.jsxs)(_,{size:`sm`,onClick:()=>i(e=>e+1),children:[`Show `,Math.min(H,a.length-o.length),` more`]})]})]})})}function Ee({preview:e,project:t,stale:n}){let{totals:r}=e,[i,a]=(0,N.useState)(!1),o=e.tokens.filter(e=>e.cause===`edited`),s=e.tokens.filter(e=>e.cause===`follows`),c=e.contrast.filter(e=>e.change!==`fixed`);return(0,M.jsxs)(`div`,{className:f(`space-y-6`,n&&`opacity-60`),children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsxs)(`p`,{className:`text-title`,children:[`Changes `,(0,M.jsx)(`span`,{className:`tabular`,children:v(r.tokens,`token`)}),` and `,(0,M.jsx)(`span`,{className:`tabular`,children:v(r.contracts,`component`)})]}),(0,M.jsxs)(`p`,{className:`text-small text-muted`,children:[(0,M.jsx)(`span`,{className:`tabular`,children:r.sites}),` component site(s) and `,(0,M.jsx)(`span`,{className:`tabular`,children:r.direct}),` direct use(s) in `,(0,M.jsx)(`span`,{className:`tabular`,children:v(r.files,`file`)}),`, on `,(0,M.jsx)(`span`,{className:`tabular`,children:v(r.routes,`screen`)}),e.everyScreen?`, and possibly every screen`:``]}),(0,M.jsxs)(`p`,{className:`font-mono text-mono-sm text-muted`,children:[t,e.snapshot.projectCommit?` @ ${e.snapshot.projectCommit.slice(0,7)}`:``,e.snapshot.projectChanges?` + uncommitted edits`:``,` · `,v(e.scan.files,`file`),` scanned · `,e.durationMs,` ms · `,new Date(e.at).toLocaleTimeString()]})]}),e.contrast.length>0&&(0,M.jsx)(D,{title:`Contrast`,count:c.length?`${c.length} below AA`:`all pass`,children:(0,M.jsx)(`ul`,{className:`divide-y divide-line overflow-hidden rounded-md border border-line`,children:e.contrast.map(e=>(0,M.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,M.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`span`,{className:`block truncate text-small text-ink`,children:e.label}),(0,M.jsxs)(`span`,{className:`block text-caption text-muted capitalize`,children:[e.scheme,` · needs `,e.required,`:1 · was `,e.before?.toFixed(2)??`–`]})]}),(0,M.jsx)(`span`,{className:`tabular font-mono text-mono-sm text-ink`,children:e.after?.toFixed(2)??`–`}),(0,M.jsx)(x,{tone:U[e.change].tone,children:U[e.change].label})]},`${e.label}|${e.scheme}`))})}),e.limits.length>0&&(0,M.jsx)(`ul`,{className:`space-y-1.5 rounded-md bg-warning-soft px-3 py-2`,children:e.limits.map(e=>(0,M.jsxs)(`li`,{className:`flex gap-2 text-small text-ink-2`,children:[(0,M.jsx)(u,{className:`mt-0.5 size-3.5 shrink-0 text-warning`}),e]},e))}),(0,M.jsxs)(D,{title:`Tokens`,count:r.tokens,children:[(0,M.jsx)(`ul`,{className:`divide-y divide-line overflow-hidden rounded-md border border-line`,children:[...o,...i?s:[]].map(e=>(0,M.jsxs)(`li`,{className:`grid gap-1.5 px-3 py-2 sm:grid-cols-[minmax(0,10rem)_minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,M.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,M.jsx)(`span`,{className:`truncate font-mono text-mono-sm text-ink`,children:e.path}),e.cause===`follows`&&(0,M.jsx)(x,{tone:`neutral`,children:`follows`})]}),(0,M.jsxs)(`span`,{className:`min-w-0 text-small`,children:[(0,M.jsx)(`span`,{className:`text-caption text-muted`,children:`Light `}),(0,M.jsx)(G,{...e.light})]}),(0,M.jsxs)(`span`,{className:`min-w-0 text-small`,children:[(0,M.jsx)(`span`,{className:`text-caption text-muted`,children:`Dark `}),(0,M.jsx)(G,{...e.dark})]})]},e.path))}),s.length>0&&(0,M.jsxs)(_,{size:`sm`,variant:`ghost`,onClick:()=>a(e=>!e),children:[i?`Hide`:`Show`,` `,v(s.length,`token`),` that follow through aliases`]})]}),(0,M.jsx)(D,{title:`Components`,count:r.contracts,children:e.contracts.length===0?(0,M.jsx)(`p`,{className:`text-small text-muted`,children:`No contract binds or implements these tokens.`}):(0,M.jsx)(`ul`,{className:`divide-y divide-line overflow-hidden rounded-md border border-line`,children:e.contracts.map(e=>(0,M.jsxs)(`li`,{className:`flex h-9 items-center gap-2 px-3`,children:[(0,M.jsx)(`span`,{className:`font-medium text-ink`,children:e.name}),(0,M.jsx)(x,{tone:`outline`,children:e.via===`binding`?`binds a changed token`:e.via===`state`?`state re-bound`:`implementation uses one`}),(0,M.jsx)(`span`,{className:`ml-auto tabular text-small text-muted`,children:v(e.sites,`site`)})]},e.id))})}),e.routes.length>0&&(0,M.jsx)(D,{title:`Screens`,count:r.routes,children:(0,M.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,children:e.routes.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(x,{tone:`neutral`,children:[(0,M.jsx)(`span`,{className:`font-mono`,children:e.route}),` `,e.sites+e.direct]})},e.route))})}),(0,M.jsx)(Te,{preview:e}),(0,M.jsxs)(D,{title:`Direct uses`,count:`${r.direct} in ${v(r.directFiles,`file`)}`,children:[e.direct.length===0?(0,M.jsx)(`p`,{className:`text-small text-muted`,children:`No file outside the owned components reads these tokens' variables or utilities.`}):(0,M.jsx)(`ul`,{className:`max-h-[24rem] divide-y divide-line overflow-y-auto rounded-md border border-line`,children:e.direct.map(e=>(0,M.jsxs)(`li`,{className:`space-y-0.5 px-3 py-2`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,M.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-mono-sm text-ink`,children:[e.file,(0,M.jsxs)(`span`,{className:`text-muted`,children:[`:`,e.line]})]}),(0,M.jsx)(`span`,{className:`tabular text-small text-muted`,children:v(e.uses,`use`)})]}),(0,M.jsx)(`code`,{className:`block truncate font-mono text-mono-sm text-muted`,children:e.text})]},e.file))}),e.direct.length<r.directFiles&&(0,M.jsxs)(`p`,{role:`note`,className:`flex items-center gap-1.5 text-small text-ink-2`,children:[(0,M.jsx)(u,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-warning`}),`Showing `,e.direct.length.toLocaleString(`en-US`),` of `,r.directFiles.toLocaleString(`en-US`),` files with direct uses; the count above includes them all.`]})]})]})}function De(e,t){if(t===null)return`follows light`;if(typeof t==`string`&&/^\{[^{}]+\}$/.test(t))return t;if(e===`spring`){let{stiffness:e,damping:n,mass:r,velocity:i}=t;return`stiffness ${e}, damping ${n}, mass ${r}${i===void 0?``:`, velocity ${i}`}`}try{return e?ne(e,t,e=>`{${e}}`):JSON.stringify(t)}catch{return JSON.stringify(t)}}function Oe(e){let{tokens:t,states:n}=e.content;return e.content.title.trim()||[t.length&&`${t.length} token(s)`,n.length&&`${n.length} state binding(s)`].filter(Boolean).join(`, `)||`Empty style change`}function ke({draft:e,info:t,onUpdate:n}){let{busy:r,failure:i,run:a}=J(n),s=m(),c=new Map(s.status===`ready`?[...s.value.tokens.values()].map(e=>[e.path,e]):[]),l=new Map([...c].map(([e,t])=>[e,t.type])),{tokens:u,states:d}=e.content;return(0,M.jsxs)(`article`,{className:`min-h-0 flex-1 overflow-y-auto animate-enter`,children:[(0,M.jsx)(Y,{draft:e,title:Oe(e),kind:`Style`,detail:`${e.id} · revision ${e.revision} · from ${e.base.branch}@${e.base.commit.slice(0,7)}`,busy:r,run:a}),(0,M.jsx)(X,{draft:e,busy:r,run:a,failure:i}),(0,M.jsxs)(`div`,{className:`grid min-w-0 lg:grid-cols-[minmax(0,1fr)_minmax(0,34rem)]`,children:[(0,M.jsx)(`div`,{className:`min-w-0 space-y-6 p-6`,children:(0,M.jsx)(D,{title:`Edits`,count:u.length+d.length,aside:q(e)&&(0,M.jsx)(_,{size:`sm`,asChild:!0,children:(0,M.jsxs)(h,{href:`/style/draft/${e.id}`,children:[(0,M.jsx)(o,{}),` Edit in Style`]})}),children:u.length+d.length===0?(0,M.jsx)(`p`,{className:`text-small text-muted`,children:`Nothing yet. Open it in Style to change tokens and states with a live preview.`}):(0,M.jsxs)(`ul`,{className:`divide-y divide-line overflow-hidden rounded-md border border-line`,children:[u.map(e=>(0,M.jsxs)(`li`,{className:`space-y-0.5 px-3 py-2`,children:[(0,M.jsx)(`p`,{className:`font-mono text-mono text-ink`,children:e.path}),e.light!==void 0&&(0,M.jsxs)(`p`,{className:`truncate text-small text-muted`,children:[`light`,e.dark===void 0&&!c.get(e.path)?.darkOwn?` (and dark, which follows it)`:``,`: `,(0,M.jsx)(`code`,{className:`font-mono text-mono-sm text-ink-2`,children:De(l.get(e.path),e.light)})]}),e.dark!==void 0&&(0,M.jsxs)(`p`,{className:`truncate text-small text-muted`,children:[`dark: `,(0,M.jsx)(`code`,{className:`font-mono text-mono-sm text-ink-2`,children:De(l.get(e.path),e.dark)})]})]},e.path)),d.map(e=>(0,M.jsxs)(`li`,{className:`px-3 py-2 text-small text-ink-2`,children:[(0,M.jsx)(`span`,{className:`font-medium`,children:e.component.split(`/`).at(-1)}),` `,e.state,` `,(0,M.jsx)(`code`,{className:`font-mono text-mono-sm`,children:e.role}),` → `,(0,M.jsx)(`code`,{className:`font-mono text-mono-sm`,children:e.token.split(`/token/`)[1]})]},`${e.component}|${e.state}|${e.role}`))]})})}),(0,M.jsx)(Z,{draft:e,info:t,busy:r,run:a,dirty:!1,previewStale:e.previewStale,onPreview:()=>void a(`preview`,()=>y.preview(e.id)),intro:`Builds the tokens as published and as drafted, then traces every changed value through one fresh scan of ${t.project.id}.`,impact:e.preview&&(0,M.jsx)(Ee,{preview:e.preview,project:t.project.id,stale:e.previewStale.length>0})})]})]})}var Ae={draft:{label:`Draft`,tone:`neutral`},waiting:{label:`Waiting for approval`,tone:`warning`},approved:{label:`Approved`,tone:`success`},review:{label:`Sent for review`,tone:`accent`},"rolled-out":{label:`Rolled out`,tone:`success`},discarded:{label:`Discarded`,tone:`outline`}};function K(e){switch(e.status){case`previewed`:return e.previewStale.length>0||e.problems.length>0||e.needsRebase?`draft`:`waiting`;case`handed-off`:return`review`;default:return e.status}}function je({draft:e}){let t=Ae[K(e)];return(0,M.jsx)(x,{tone:t.tone,children:t.label})}var q=e=>e.status!==`handed-off`&&e.status!==`rolled-out`&&e.status!==`discarded`;function J(e){let[t,n]=(0,N.useState)(null),[r,i]=(0,N.useState)(null);return{busy:t,failure:r,run:(0,N.useCallback)(async(t,r)=>{n(t),i(null);try{e(await r())}catch(e){i(b(e))}finally{n(null)}},[e])}}function Me({draft:e,info:t,onUpdate:n}){return e.kind===`library`?(0,M.jsx)(Se,{draft:e,info:t,onUpdate:n}):e.kind===`style`?(0,M.jsx)(ke,{draft:e,info:t,onUpdate:n}):(0,M.jsx)(Ne,{draft:e,info:t,onUpdate:n})}function Ne({draft:e,info:t,onUpdate:n}){let[r,i]=(0,N.useState)(e.content),{busy:a,failure:o,run:s}=J(n),{id:c,revision:l}=e;(0,N.useEffect)(()=>i(e.content),[c,l]);let u=!re(r,e.content),d=q(e),f=(0,N.useCallback)(()=>s(`save`,()=>y.save(c,l,r)),[s,c,l,r]),p=()=>s(`preview`,async()=>(u&&n(await y.save(c,l,r)),y.preview(c)));(0,N.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),u&&d&&!a&&f())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[u,d,a,f]);let m=u?[`You have unsaved changes; running the preview saves them first.`]:e.previewStale,h=e.content.rule;return(0,M.jsxs)(`article`,{className:`min-h-0 flex-1 overflow-y-auto animate-enter`,children:[(0,M.jsx)(Y,{draft:e,title:h.title||`New rule`,kind:e.mode===`edit`?`Edit`:`New rule`,detail:`${e.ruleId||`new rule`} · revision ${l} · from ${e.base.branch}@${e.base.commit.slice(0,7)}`,busy:a,run:s}),(0,M.jsx)(X,{draft:e,busy:a,run:s,failure:o}),(0,M.jsxs)(`div`,{className:`grid min-w-0 lg:grid-cols-[minmax(0,1fr)_minmax(0,28rem)]`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 p-6 pb-0`,children:[(0,M.jsx)(ve,{value:r,onChange:i,info:t,mode:e.mode,readOnly:!d||a!==null,problems:u?[]:e.problems}),d&&(0,M.jsxs)(`div`,{className:`sticky bottom-0 -mx-6 mt-6 flex items-center gap-3 border-t border-line bg-surface px-6 py-3`,children:[(0,M.jsx)(_,{variant:u?`primary`:`outline`,disabled:!u||a!==null,onClick:()=>void f(),children:a===`save`?`Saving…`:`Save draft`}),(0,M.jsx)(`span`,{className:`flex items-center gap-1.5 text-small text-muted`,children:u?(0,M.jsxs)(M.Fragment,{children:[`Unsaved changes `,(0,M.jsx)(g,{keys:[`⌘`,`S`]})]}):`Saved as revision ${l}. Saving never publishes anything.`})]})]}),(0,M.jsx)(Z,{draft:e,info:t,busy:a,run:s,dirty:u,previewStale:m,onPreview:()=>void p(),intro:`Runs this draft and today's published rule over one fresh scan of ${t.project.id}.`,impact:e.preview&&(0,M.jsx)(me,{preview:e.preview,project:t.project.id,stale:m.length>0})})]})]})}function Y({draft:e,title:t,kind:n,detail:r,busy:i,run:a}){return(0,M.jsxs)(`header`,{className:`border-b border-line px-6 pt-5 pb-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`h2`,{"data-detail-heading":!0,tabIndex:-1,className:`text-title outline-none`,children:t}),(0,M.jsx)(je,{draft:e}),(0,M.jsx)(x,{tone:`outline`,children:n}),q(e)&&(0,M.jsxs)(_,{variant:`ghost`,size:`sm`,className:`ml-auto`,disabled:i!==null,onClick:()=>void a(`discard`,()=>y.discard(e.id)),children:[(0,M.jsx)(l,{}),` Discard`]})]}),(0,M.jsx)(`p`,{className:`mt-1 font-mono text-mono-sm text-muted`,children:r})]})}function X({draft:e,busy:t,run:n,failure:r}){return(0,M.jsxs)(M.Fragment,{children:[e.baseStale.length>0&&q(e)&&(0,M.jsx)($,{tone:`warning`,action:e.needsRebase?(0,M.jsx)(_,{size:`sm`,disabled:t!==null,onClick:()=>void n(`rebase`,()=>y.rebase(e.id)),children:`Rebase`}):null,children:e.baseStale.map(e=>(0,M.jsx)(`p`,{children:e},e))}),r&&(0,M.jsxs)($,{tone:`danger`,children:[(0,M.jsx)(`p`,{className:`font-medium`,children:r.message}),r.problems.map(e=>(0,M.jsx)(`p`,{children:e},e))]})]})}function Z({draft:e,info:t,busy:n,run:r,dirty:i,previewStale:o,onPreview:s,intro:l,impact:u}){let d=q(e),{id:m,revision:h}=e,[g,v]=(0,N.useState)(!1),b=e.kind===`style`&&e.preview?e.preview.contrast:[],x=b.filter(e=>e.change===`new`),S=new Set(b.filter(e=>e.change===`kept`).map(e=>e.key)).size,C=t=>void r(`approve`,()=>y.approve(m,h,e.preview.id,t));return(0,M.jsxs)(`aside`,{className:`min-w-0 space-y-8 border-line p-6 lg:border-l`,children:[(0,M.jsxs)(Q,{n:1,title:`Impact preview`,done:e.preview!==null&&o.length===0,children:[(0,M.jsx)(`p`,{className:`text-small text-muted`,children:l}),e.problems.length>0&&!i&&(0,M.jsx)(`ul`,{className:`space-y-1 text-small text-danger`,children:e.problems.map(e=>(0,M.jsx)(`li`,{children:e},e))}),e.preview&&o.length>0&&(0,M.jsx)(Pe,{reasons:o}),d&&(0,M.jsxs)(_,{variant:e.preview&&o.length===0?`outline`:`primary`,disabled:n!==null||!i&&e.problems.length>0,onClick:s,children:[(0,M.jsx)(p,{className:f(n===`preview`&&`animate-spin`)}),` `,n===`preview`?`Scanning…`:e.preview?`Run again`:`Run preview`]}),u]}),(0,M.jsxs)(Q,{n:2,title:`Approve`,done:e.approval!==null,children:[e.approval?(0,M.jsxs)(`p`,{className:`flex items-center gap-2 text-body text-ink-2`,children:[(0,M.jsx)(c,{className:`size-4 shrink-0 text-success`}),` Approved by `,e.approval.by.name,`, `,new Date(e.approval.at).toLocaleString(),`, revision `,e.approval.draftRevision,`.`]}):(0,M.jsxs)(`p`,{className:`text-small text-muted`,children:[`You approve exactly revision `,h,` and the preview above. Saving again, a new commit on `,e.base.branch,`, or a change in `,t.project.id,` withdraws the approval.`]}),d&&!e.approval&&x.length>0&&(0,M.jsxs)(`p`,{className:`flex items-start gap-2 text-small text-ink-2`,children:[(0,M.jsx)(a,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-danger`}),`This draft puts `,x.length,` colour pair(s) below WCAG AA. Approving asks you to confirm them by name.`]}),d&&!e.approval&&S>0&&(0,M.jsxs)(`p`,{className:`text-small text-muted`,children:[S,` pair(s) this draft touches were already below WCAG AA before it; they are listed in the preview and need no confirmation.`]}),e.approval?.contrastAcknowledged&&e.approval.contrastAcknowledged.length>0&&(0,M.jsxs)(`p`,{className:`text-small text-muted`,children:[`Confirmed `,e.approval.contrastAcknowledged.length,` colour pair(s) this draft puts below WCAG AA.`]}),d&&!e.approval&&(0,M.jsxs)(_,{variant:`primary`,disabled:!e.canApprove||i||n!==null,onClick:()=>x.length>0?v(!0):C(),children:[(0,M.jsx)(c,{}),` Approve revision `,h]}),g&&(0,M.jsx)(pe,{failing:x,revision:h,onClose:()=>v(!1),onConfirm:()=>{v(!1),C(x.map(e=>e.key))}})]}),(0,M.jsx)(Q,{n:3,title:`Send for review`,done:e.handoff!==null,children:e.handoff?(0,M.jsx)(Fe,{draft:e}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`p`,{className:`text-small text-muted`,children:[`Creates a branch in the design repository holding only this change. Nothing is pushed or merged, and `,e.base.branch,` is never touched.`]}),d&&(0,M.jsxs)(_,{variant:`primary`,disabled:!e.canHandoff||i||n!==null,onClick:()=>void r(`handoff`,()=>y.handoff(m)),children:[(0,M.jsx)(A,{}),` Create review branch`]})]})}),(0,M.jsx)(Ie,{draft:e})]})}function Q({n:e,title:t,done:n,children:r}){return(0,M.jsxs)(`section`,{className:`space-y-3`,children:[(0,M.jsxs)(`header`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:f(`grid size-5 place-items-center rounded-full text-caption tabular`,n?`bg-success-soft text-success`:`bg-raised text-muted`),children:e}),(0,M.jsx)(`h3`,{className:`text-heading`,children:t})]}),r]})}function $({tone:e,action:t,children:n}){return(0,M.jsxs)(`div`,{role:e===`danger`?`alert`:`status`,className:f(`flex items-start gap-3 border-b border-line px-6 py-3 text-small text-ink-2`,e===`danger`?`bg-danger-soft`:`bg-warning-soft`),children:[(0,M.jsx)(a,{className:f(`mt-0.5 size-4 shrink-0`,e===`danger`?`text-danger`:`text-warning`)}),(0,M.jsx)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:n}),t]})}function Pe({reasons:e}){return(0,M.jsxs)(`div`,{className:`rounded-md bg-warning-soft px-3 py-2 text-small text-ink-2`,children:[(0,M.jsx)(`p`,{className:`font-medium`,children:`This preview is out of date. Run it again before approving.`}),e.map(e=>(0,M.jsx)(`p`,{children:e},e))]})}function Fe({draft:e}){let t=e.handoff;return(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 font-mono text-mono-sm text-ink`,children:[(0,M.jsx)(A,{className:`size-3.5 shrink-0 text-muted`}),(0,M.jsx)(`span`,{className:`truncate`,children:t.branch}),(0,M.jsx)(i,{value:t.branch,label:`Copy branch name`}),(0,M.jsx)(`span`,{className:`text-muted`,children:t.commit.slice(0,7)})]}),(0,M.jsx)(`p`,{className:`text-small text-muted`,children:`Take it to review from the design repository:`}),(0,M.jsx)(`div`,{className:`space-y-1.5`,children:t.next.map(e=>(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 rounded-md bg-sunken px-2 py-1`,children:[(0,M.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-mono-sm text-ink-2`,children:e}),(0,M.jsx)(i,{value:e,label:`Copy command`})]},e))}),e.kind===`rule`?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`p`,{className:`text-small text-muted`,children:[`Once merged into the design checkout agents use, they get it on their next lookup: `,(0,M.jsx)(`code`,{className:`font-mono text-mono-sm`,children:`system_get_rules`}),` and `,(0,M.jsx)(`code`,{className:`font-mono text-mono-sm`,children:`youiyoux check`}),` read that checkout, and`,` `,(0,M.jsx)(`code`,{className:`font-mono text-mono-sm`,children:`youiyoux sync`}),` refreshes the project's AGENTS.md block. Agents will read:`]}),(0,M.jsx)(`blockquote`,{className:`rounded-md border-l-2 border-line-strong bg-sunken px-3 py-2 text-body text-ink-2`,children:e.content.rule.agent})]}):e.kind===`library`?(0,M.jsxs)(`p`,{className:`text-small text-muted`,children:[`Once merged, the item is in the Library`,e.content.request===`adopt`?` as a candidate, for a person to adopt into the System`:` as a reference: not in the System, and not built with`,`. Nothing was installed in any project.`]}):(0,M.jsxs)(`p`,{className:`text-small text-muted`,children:[`Once merged, `,(0,M.jsx)(`code`,{className:`font-mono text-mono-sm`,children:`youiyoux sync`}),` in each project writes the new values into its tokens (CSS variables, Tailwind theme, TS and React Native), and the hub shows them after the next snapshot.`]}),(0,M.jsx)(te,{code:t.diff,title:`${t.files.length} file(s) changed`,maxHeight:`sm`})]})}function Ie({draft:e}){return(0,M.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,M.jsxs)(`header`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(de,{className:`size-3.5 text-muted`}),(0,M.jsx)(`h3`,{className:`text-heading`,children:`History`})]}),(0,M.jsx)(`ol`,{className:`space-y-1.5`,children:[...e.events].reverse().map((e,t)=>(0,M.jsxs)(`li`,{className:`text-small`,children:[(0,M.jsx)(`span`,{className:`tabular text-muted`,children:new Date(e.at).toLocaleString()}),` `,(0,M.jsx)(`span`,{className:`font-medium text-ink-2`,children:e.type.replace(`-`,` `)}),e.note&&(0,M.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.note]})]},`${e.at}:${t}`))})]})}export{Oe as a,K as i,je as n,V as o,Ae as r,Me as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./arrow-right-DcbNDzqs.js";import{B as n,F as r,S as i,dt as a,i as o,n as s,o as c,w as l}from"./main-
|
|
1
|
+
import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./arrow-right-DcbNDzqs.js";import{B as n,F as r,S as i,dt as a,i as o,n as s,o as c,w as l}from"./main-cvOFSjox.js";import{n as u}from"./plural-BbGQPQKA.js";import{t as d}from"./Badge-CUJUit4d.js";import{n as f,t as p}from"./Section-BTnvUq_W.js";import{i as m,t as h}from"./discover-va2KFuK_.js";import{t as g}from"./LicenceBadge-CLCUMMHE.js";var _=e(),v=(e,t=null)=>`/discover${m({...h,q:e.name,role:e.concept,open:t})}`,y=e=>/^[a-z]{1,3}$/.test(e)?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1);function b(e){return`${[e.count?`${u(e.count,`component`)} named for it`:null,e.uses?u(e.uses,`use`):null].filter(Boolean).join(`, `)} in ${u(e.files,`file`)}`}function x({concept:e,discover:t}){return e.candidates===null||t===`not-synced`?(0,_.jsx)(`p`,{className:`text-small text-muted`,children:`No candidates yet: Discover is not synced.`}):e.candidates.length===0?(0,_.jsx)(`p`,{className:`text-small text-muted`,children:`No licensed candidate in the index.`}):(0,_.jsx)(`ul`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1.5`,"aria-label":`Candidates for ${e.name}`,children:e.candidates.map(t=>(0,_.jsxs)(`li`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,_.jsx)(a,{href:v(e,t.id),className:`truncate text-small font-medium text-accent hover:underline`,children:t.name}),(0,_.jsx)(`span`,{className:`text-caption text-muted`,children:t.source}),(0,_.jsx)(g,{licence:t.licence})]},t.id))})}function S({concept:e,discover:n}){return(0,_.jsxs)(`li`,{className:`space-y-2.5 rounded-lg border border-line p-4`,"data-gap":e.concept,"data-status":`hand-built`,children:[(0,_.jsxs)(`header`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,_.jsx)(`h4`,{className:`text-body font-medium text-ink`,children:y(e.name)}),(0,_.jsx)(`span`,{className:`text-small text-muted`,children:b(e)}),(0,_.jsxs)(a,{href:v(e),className:`ml-auto inline-flex items-center gap-1 text-small text-muted hover:text-ink max-sm:ml-0`,children:[`All in Discover `,(0,_.jsx)(t,{className:`size-3.5`})]})]}),e.definitions.length>0&&(0,_.jsxs)(`ul`,{className:`space-y-0.5 font-mono text-mono-sm text-ink-2`,children:[e.definitions.slice(0,3).map(e=>(0,_.jsxs)(`li`,{className:`truncate`,children:[(0,_.jsx)(`span`,{className:`text-ink`,children:e.name}),` `,(0,_.jsxs)(`span`,{className:`text-muted`,children:[e.file,`:`,e.line]})]},`${e.file}:${e.line}`)),e.count>3&&(0,_.jsxs)(`li`,{className:`text-muted`,children:[`+`,e.count-3,` more`]})]}),(0,_.jsx)(x,{concept:e,discover:n})]})}function C({concept:e,discover:t}){let n=e.candidates?.[0];return(0,_.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1 rounded-md border border-line px-3 py-2.5`,"data-gap":e.concept,"data-status":`missing`,children:[(0,_.jsx)(a,{href:v(e),className:`text-small font-medium text-ink hover:text-accent`,children:y(e.name)}),n?(0,_.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-caption text-muted`,children:[(0,_.jsxs)(a,{href:v(e,n.id),className:`truncate hover:text-ink`,children:[n.name,` · `,n.source]}),(0,_.jsx)(g,{licence:n.licence})]}):(0,_.jsx)(`span`,{className:`text-caption text-muted`,children:t===`not-synced`?`Discover not synced`:`No licensed candidate`})]})}function w({project:e,report:t}){let n=t=>e.concepts.filter(e=>e.status===t),r=n(`hand-built`),i=n(`missing`),a=n(`system`),o=n(`library`);return(0,_.jsx)(f,{title:e.id,count:`${r.length} built by hand · ${i.length} not in it`,aside:(0,_.jsxs)(_.Fragment,{children:[!e.complete&&(0,_.jsx)(d,{tone:`warning`,title:`Some files could not be read: counts are a lower bound`,children:`Partial`}),e.dependencies===`unread`&&(0,_.jsx)(d,{tone:`outline`,title:`Its package.json was not read: libraries are known only from its imports`,children:`No package.json`})]}),children:(0,_.jsxs)(`div`,{className:`space-y-6`,"data-project":e.id,children:[r.length>0&&(0,_.jsxs)(`div`,{className:`space-y-2`,children:[(0,_.jsx)(`h4`,{className:`text-small font-medium text-ink-2`,children:`Built by hand, with what could stand in`}),(0,_.jsx)(`ul`,{className:`space-y-2`,children:r.map(e=>(0,_.jsx)(S,{concept:e,discover:t.discover},e.concept))})]}),i.length>0&&(0,_.jsxs)(`div`,{className:`space-y-2`,children:[(0,_.jsx)(`h4`,{className:`text-small font-medium text-ink-2`,children:`Not in it, from the standard kit`}),(0,_.jsx)(`ul`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(e=>(0,_.jsx)(C,{concept:e,discover:t.discover},e.concept))})]}),(a.length>0||o.length>0)&&(0,_.jsx)(p,{className:`text-small`,rows:[...a.length?[[`In the System${t.system?` (${t.system})`:``}`,a.map(e=>e.name).join(`, `)]]:[],...o.length?[[`From libraries`,o.map(e=>`${e.name} (${e.packages.join(`, `)})`).join(`, `)]]:[]]})]})})}function T({report:e}){return(0,_.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl min-w-0 space-y-8 px-8 py-8 animate-enter max-sm:px-4`,children:[(0,_.jsx)(`p`,{className:`max-w-2xl text-small text-ink-2`,children:`For each project, the kinds of element it builds by hand and the ones the standard kit has that it lacks, with licensed candidates from Discover. Suggestions only: open one to preview it in your theme and draft a request; nothing is installed.`}),e.discover===`not-synced`&&(0,_.jsxs)(`p`,{className:`rounded-md border border-line bg-sunken px-3 py-2 text-small text-ink-2`,"data-not-synced":!0,children:[`No candidates yet: run `,(0,_.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:`youiyoux discover sync`}),`, then open the hub again.`]}),e.across.length>0&&(0,_.jsx)(f,{title:`Built by hand in more than one project`,count:e.across.length,aside:(0,_.jsx)(`span`,{className:`text-small text-muted`,children:`Worth adding to the System once`}),children:(0,_.jsx)(`ul`,{className:`divide-y divide-line rounded-lg border border-line`,"data-across":!0,children:e.across.map(e=>(0,_.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 px-4 py-2.5`,children:[(0,_.jsx)(a,{href:v(e),className:`text-small font-medium text-ink hover:text-accent`,children:y(e.name)}),(0,_.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.projects.map(e=>(0,_.jsx)(d,{tone:`neutral`,children:e},e))}),(0,_.jsx)(`span`,{className:`ml-auto tabular text-small text-muted`,children:u(e.uses,`use`)})]},e.concept))})}),e.projects.map(t=>(0,_.jsx)(w,{project:t,report:e},t.id))]})}function E(){return(0,_.jsx)(c,{icon:i,title:`No gaps to show yet`,children:(0,_.jsxs)(`p`,{children:[`Gaps come with an inventory: run `,(0,_.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:`youiyoux inventory`}),` in a project, then open the hub with `,(0,_.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:`youiyoux ui --inventory .youi/inventory.json`}),`. Or run`,` `,(0,_.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:`youiyoux gaps`}),` in the terminal.`]})})}function D(){let e=n(),t=e.status===`ready`?e.value:null,i=t?t.projects.reduce((e,t)=>e+t.concepts.filter(e=>e.status===`hand-built`||e.status===`missing`).length,0):void 0;return(0,_.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,_.jsx)(s,{title:`Gaps`,count:i,children:(0,_.jsxs)(d,{tone:`outline`,children:[(0,_.jsx)(l,{}),` Suggestions, never installed`]})}),(0,_.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto`,children:e.status===`ready`?t?(0,_.jsx)(T,{report:t}):(0,_.jsx)(E,{}):(0,_.jsx)(o,{state:e,onRetry:r,what:`the gaps`})})]})}export{E as GapsEmpty,T as GapsReportView,D as GapsScreen,v as discoverHref,b as evidence,y as kindLabel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./arrow-right-DcbNDzqs.js";import{t as i}from"./KindIcon-BJ6bz-ny.js";import{A as a,H as o,L as s,M as c,O as l,Q as u,U as d,dt as f,et as p,i as m,m as h,rt as g,s as _,tt as v}from"./main-CfbpuT4Y.js";import{n as y,t as b}from"./plural-BbGQPQKA.js";import{r as x,t as S}from"./Badge-CUJUit4d.js";import{n as C,r as w}from"./Section-BTnvUq_W.js";import{n as T}from"./TokenValue-CsPRc2ai.js";import{i as E,n as D,r as O,t as k}from"./dist-C6iTWL0b.js";import{n as A,r as j}from"./Preview-CgW-FMB7.js";import{n as M}from"./format-DxAYNTN_.js";import{t as N}from"./Disclosure-B1kTgPgk.js";var P=e(t(),1),F=n(),I=8,L=6,R=5;function z(e){let t=new Map;for(let n of e){let e=`${n.project}\0${n.file}`,r=t.get(e)??{project:n.project,file:n.file,lines:[]};r.lines.push(n.line),t.set(e,r)}return[...t.values()].map(e=>({...e,lines:e.lines.sort((e,t)=>e-t)})).sort((e,t)=>t.lines.length-e.lines.length||e.file.localeCompare(t.file))}function B({model:e,index:t,scheme:n}){let r=[...e.components.values()].map(({contract:e})=>({contract:e,sites:t.sitesByElement.get(e.id)??[]})).sort((e,t)=>t.sites.length-e.sites.length).slice(0,I),[i,a]=(0,P.useState)(r[0]?.contract.id??``);if(r.length===0)return(0,F.jsx)(`p`,{className:`text-body text-muted`,children:`The system defines no components.`});let o=t.reports.length>1;return(0,F.jsxs)(O,{value:i,onValueChange:a,orientation:`vertical`,className:`grid gap-4 md:grid-cols-[minmax(0,15rem)_minmax(0,1fr)]`,children:[(0,F.jsx)(D,{"aria-label":`Most used components`,className:`-mx-2 flex flex-col gap-0.5 max-md:mx-0`,children:r.map(({contract:e,sites:t})=>(0,F.jsxs)(E,{value:e.id,className:`flex items-baseline gap-3 rounded-md px-2 py-1.5 text-left text-body text-ink-2 outline-none hover:bg-raised hover:text-ink focus-visible:ring-2 focus-visible:ring-focus data-[state=active]:bg-raised data-[state=active]:text-ink`,children:[(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,F.jsx)(`span`,{className:`tabular text-small text-muted`,children:t.length})]},e.id))}),r.map(({contract:t,sites:r})=>(0,F.jsx)(k,{value:t.id,className:`min-w-0 outline-none`,children:(0,F.jsx)(V,{model:e,contract:t,sites:r,scheme:n,manyProjects:o})},t.id))]})}function V({model:e,contract:t,sites:n,scheme:i,manyProjects:a}){let o=z(n),s=new Set(n.map(e=>e.project)).size,c=o.slice(0,L),l=v(t.id,`usage`);return(0,F.jsxs)(`div`,{"data-chosen":t.id,className:`overflow-hidden rounded-lg border border-line`,children:[(0,F.jsx)(H,{model:e,contract:t,scheme:i}),(0,F.jsxs)(`div`,{className:`space-y-3 border-t border-line p-4`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,F.jsx)(`p`,{"data-uses":!0,className:`text-body text-ink`,children:n.length===0?`Not used in any scanned project yet.`:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`font-medium`,children:y(n.length,`use`)}),` in `,y(o.length,`file`),a&&(0,F.jsxs)(F.Fragment,{children:[` across `,y(s,`project`)]})]})}),(0,F.jsx)(_,{asChild:!0,size:`sm`,className:`ml-auto`,children:(0,F.jsxs)(f,{href:v(t.id),children:[`Open `,t.name,` `,(0,F.jsx)(r,{})]})})]}),c.length>0&&(0,F.jsx)(`ul`,{className:`space-y-1`,children:c.map(e=>(0,F.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-3`,children:[(0,F.jsxs)(`span`,{className:`flex min-w-0 flex-1 font-mono text-mono-sm`,title:`${e.file}: lines ${e.lines.join(`, `)}`,children:[(0,F.jsx)(`span`,{className:`min-w-0 truncate text-faint`,children:e.file.slice(0,e.file.lastIndexOf(`/`)+1)}),(0,F.jsx)(`span`,{className:`shrink-0 text-ink-2`,children:e.file.slice(e.file.lastIndexOf(`/`)+1)}),(0,F.jsxs)(`span`,{className:`shrink-0 text-muted`,children:[e.lines.slice(0,R).map(e=>`:${e}`).join(` `),e.lines.length>R&&` +${e.lines.length-R}`]})]}),a&&(0,F.jsx)(`span`,{className:`shrink-0 text-caption text-faint`,children:e.project}),(0,F.jsx)(`span`,{className:`w-6 shrink-0 text-right tabular text-small text-muted`,children:e.lines.length})]},`${e.project}:${e.file}`))}),n.length>0&&(0,F.jsx)(f,{href:l,className:`inline-block text-small text-accent hover:underline`,children:o.length>c.length?`And ${y(o.length-c.length,`more file`)}: every use`:`Every use with its props`})]})]})}function H({model:e,contract:t,scheme:n}){let[r,a]=(0,P.useState)(!1),o=g(t.id)?.name??t.name.toLowerCase(),s=e.byId.get(t.id);return(0,F.jsx)(`div`,{className:`grid min-h-24 place-items-start overflow-hidden`,style:{background:T(e,n).background},children:r?(0,F.jsxs)(`span`,{className:`flex h-24 w-full items-center justify-center gap-2 text-small text-muted`,children:[s&&(0,F.jsx)(i,{element:s,scheme:n}),` No captured look for `,t.name,` yet`]}):(0,F.jsx)(`img`,{src:A(o,n),srcSet:`${A(o,n)} 2x`,alt:`${t.name} in the ${n} scheme`,decoding:`async`,onError:()=>a(!0),className:`block h-auto max-h-56 w-auto max-w-full object-contain object-left-top`},`${o}.${n}`)})}function U({counts:e,projects:t,sites:n,violations:r}){return(0,F.jsxs)(`p`,{"data-headline":!0,className:`max-w-3xl text-title text-ink-2`,children:[(0,F.jsx)(j,{value:e.component,href:`/elements`}),` `,b(e.component,`component`),`, `,(0,F.jsx)(j,{value:e.token,href:`/tokens`}),` `,b(e.token,`token`),` and `,(0,F.jsx)(j,{value:e.rule,href:`/elements`}),` `,b(e.rule,`rule`),t!==null&&n!==null&&r!==null?(0,F.jsxs)(F.Fragment,{children:[`, used at `,(0,F.jsx)(j,{value:n,href:`/screens`}),` `,b(n,`site`),` in `,(0,F.jsx)(j,{value:t,href:`/screens`}),` `,b(t,`project`),r>0?(0,F.jsxs)(F.Fragment,{children:[` `,`with `,(0,F.jsx)(j,{value:r}),` `,b(r,`violation`),`.`]}):(0,F.jsxs)(F.Fragment,{children:[` `,`with `,(0,F.jsx)(j,{value:`no`,clean:!0}),` violations.`]})]}):`.`]})}function W({label:e,value:t,max:n,href:r,trailing:i}){return(0,F.jsx)(`li`,{children:(0,F.jsxs)(f,{href:r,className:`group grid grid-cols-[minmax(0,42%)_1fr_auto] items-center gap-3 rounded-md px-2 py-1 hover:bg-raised`,children:[(0,F.jsx)(`span`,{className:`truncate text-body text-ink-2 group-hover:text-ink`,children:e}),(0,F.jsx)(`span`,{className:`h-1.5 overflow-hidden rounded-full bg-raised`,children:(0,F.jsx)(`span`,{className:`block h-full rounded-full bg-ink-2`,style:{width:`${n?t/n*100:0}%`}})}),(0,F.jsxs)(`span`,{className:`flex items-center gap-2 tabular text-small text-muted`,children:[i,t]})]})})}function G({label:e,samples:t,budget:n}){let r=a(t,50),i=a(t,95);return r===null||i===null?(0,F.jsxs)(`span`,{children:[e,` no samples yet`]}):(0,F.jsxs)(`span`,{className:`tabular`,children:[e,` `,r.toFixed(1),` ms median, p95 `,i.toFixed(1),` ms`,` `,i<=n?`(budget ${n} ms)`:(0,F.jsxs)(`span`,{className:`text-danger`,children:[`over its `,n,` ms budget`]})]})}function K({samples:e}){return(0,F.jsxs)(`p`,{"data-speed":!0,className:`border-t border-line pt-4 text-small text-muted`,children:[`Speed in this tab: `,(0,F.jsx)(G,{label:`search`,samples:e.search,budget:l.searchMs}),`; `,(0,F.jsx)(G,{label:`navigation`,samples:e.navigation,budget:l.navigationMs}),`.`]})}function q({rules:e}){return e.length===0?null:(0,F.jsx)(N,{className:`mt-1`,summaryClassName:`-mx-2 rounded-md px-2 py-1 text-body hover:bg-raised`,summary:(0,F.jsxs)(`span`,{className:`text-success`,children:[e.length,` `,e.length===1?`rule`:`rules`,` clean`]}),children:(0,F.jsx)(`ul`,{className:`-mx-2 mt-0.5 space-y-0.5`,children:e.map(e=>(0,F.jsx)(`li`,{children:(0,F.jsxs)(f,{href:v(e.id),className:`flex items-center gap-3 rounded-md px-2 py-1 text-body text-ink-2 hover:bg-raised hover:text-ink`,children:[(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,F.jsx)(`span`,{className:`tabular text-small text-muted`,children:`0`})]})},e.id))})})}function J({model:e,index:t,scheme:n}){let r=[...e.rules.values()].map(e=>({rule:e,count:t.violationsByRule.get(e.id)?.length??0})).sort((e,t)=>t.count-e.count),i=r.filter(e=>e.count>0),a=r.filter(e=>e.count===0).map(e=>e.rule),o=i[0]?.count??0;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(C,{title:`Where ${e.catalog.system.name} lives`,count:t.reports.length,children:(0,F.jsx)(w,{head:[`Project`,`Commit`,`Scan`,`Sites`,`Screens`,`Violations`],children:t.reports.map(e=>{let t=u(e.usages.map(t=>({...t,project:e.project,commit:e.commit})));return(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`font-medium text-ink`,children:e.project}),(0,F.jsx)(`td`,{className:`font-mono text-mono-sm text-muted`,children:e.commit==null?`–`:M(e.commit)}),(0,F.jsx)(`td`,{children:(0,F.jsx)(S,{tone:e.status===`complete`?`success`:`warning`,title:e.scanner,children:e.status})}),(0,F.jsx)(`td`,{className:`tabular text-ink-2`,children:t.sites}),(0,F.jsx)(`td`,{className:`tabular text-ink-2`,children:t.screens}),(0,F.jsx)(`td`,{className:`tabular text-ink-2`,children:e.violations.length})]},e.project)})})}),(0,F.jsx)(C,{title:`Most used components`,aside:(0,F.jsx)(`span`,{className:`text-small text-muted`,children:`uses in scanned projects`}),children:(0,F.jsx)(B,{model:e,index:t,scheme:n})}),(0,F.jsxs)(C,{title:`Rule health`,aside:(0,F.jsx)(`span`,{className:`text-small text-muted`,children:`violations in projects`}),children:[i.length>0&&(0,F.jsx)(`ul`,{className:`-mx-2 space-y-0.5`,children:i.map(({rule:e,count:t})=>(0,F.jsx)(W,{label:e.title,value:t,max:o,href:v(e.id),trailing:(0,F.jsx)(x,{severity:e.severity})},e.id))}),(0,F.jsx)(q,{rules:a})]})]})}function Y(){let e=o();return e.status===`ready`?(0,F.jsx)(X,{model:e.value}):(0,F.jsx)(m,{state:e,onRetry:s,what:`the design language`})}function X({model:e}){let t=d(),n=c(),{scheme:i}=h(),a=p(e.elements),{system:o}=e.catalog,s=t.status===`ready`?t.value:null,l=s?s.reports.reduce((e,t)=>e+t.usages.length,0):null,u=s?s.reports.reduce((e,t)=>e+t.violations.length,0):null,g=e.manifest.source.commit;return(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,F.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-10 px-8 py-10 animate-enter max-md:px-5`,children:[(0,F.jsxs)(`header`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,F.jsx)(`h1`,{className:`text-display`,children:o.name}),(0,F.jsxs)(S,{tone:`outline`,className:`tabular`,children:[`v`,o.version]}),g&&(0,F.jsxs)(`span`,{className:`font-mono text-mono-sm text-muted`,title:`The commit that last changed these definitions`,children:[`@`,M(g)]}),u!==null&&u>0&&(0,F.jsx)(_,{asChild:!0,className:`ml-auto`,children:(0,F.jsxs)(f,{href:`/rules`,children:[`Review `,u===1?`the violation`:`${u} violations`,` `,(0,F.jsx)(r,{})]})})]}),(0,F.jsx)(U,{counts:a,projects:s?s.reports.length:null,sites:l,violations:u}),(0,F.jsx)(`p`,{className:`max-w-2xl text-reading text-muted`,children:o.description})]}),s?(0,F.jsx)(J,{model:e,index:s,scheme:i}):(0,F.jsx)(m,{state:t,onRetry:()=>location.reload(),what:`the usage map`}),(0,F.jsx)(K,{samples:n})]})})}export{Y as HomeScreen,K as SpeedNote,J as Usage};
|
|
1
|
+
import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./arrow-right-DcbNDzqs.js";import{t as i}from"./KindIcon-BJ6bz-ny.js";import{A as a,H as o,L as s,M as c,O as l,Q as u,U as d,dt as f,et as p,i as m,m as h,rt as g,s as _,tt as v}from"./main-cvOFSjox.js";import{n as y,t as b}from"./plural-BbGQPQKA.js";import{r as x,t as S}from"./Badge-CUJUit4d.js";import{n as C,r as w}from"./Section-BTnvUq_W.js";import{n as T}from"./TokenValue-CsPRc2ai.js";import{i as E,n as D,r as O,t as k}from"./dist-YTWqg5sS.js";import{n as A,r as j}from"./Preview-DWFP0BIe.js";import{n as M}from"./format-DxAYNTN_.js";import{t as N}from"./Disclosure-B1kTgPgk.js";var P=e(t(),1),F=n(),I=8,L=6,R=5;function z(e){let t=new Map;for(let n of e){let e=`${n.project}\0${n.file}`,r=t.get(e)??{project:n.project,file:n.file,lines:[]};r.lines.push(n.line),t.set(e,r)}return[...t.values()].map(e=>({...e,lines:e.lines.sort((e,t)=>e-t)})).sort((e,t)=>t.lines.length-e.lines.length||e.file.localeCompare(t.file))}function B({model:e,index:t,scheme:n}){let r=[...e.components.values()].map(({contract:e})=>({contract:e,sites:t.sitesByElement.get(e.id)??[]})).sort((e,t)=>t.sites.length-e.sites.length).slice(0,I),[i,a]=(0,P.useState)(r[0]?.contract.id??``);if(r.length===0)return(0,F.jsx)(`p`,{className:`text-body text-muted`,children:`The system defines no components.`});let o=t.reports.length>1;return(0,F.jsxs)(O,{value:i,onValueChange:a,orientation:`vertical`,className:`grid gap-4 md:grid-cols-[minmax(0,15rem)_minmax(0,1fr)]`,children:[(0,F.jsx)(D,{"aria-label":`Most used components`,className:`-mx-2 flex flex-col gap-0.5 max-md:mx-0`,children:r.map(({contract:e,sites:t})=>(0,F.jsxs)(E,{value:e.id,className:`flex items-baseline gap-3 rounded-md px-2 py-1.5 text-left text-body text-ink-2 outline-none hover:bg-raised hover:text-ink focus-visible:ring-2 focus-visible:ring-focus data-[state=active]:bg-raised data-[state=active]:text-ink`,children:[(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,F.jsx)(`span`,{className:`tabular text-small text-muted`,children:t.length})]},e.id))}),r.map(({contract:t,sites:r})=>(0,F.jsx)(k,{value:t.id,className:`min-w-0 outline-none`,children:(0,F.jsx)(V,{model:e,contract:t,sites:r,scheme:n,manyProjects:o})},t.id))]})}function V({model:e,contract:t,sites:n,scheme:i,manyProjects:a}){let o=z(n),s=new Set(n.map(e=>e.project)).size,c=o.slice(0,L),l=v(t.id,`usage`);return(0,F.jsxs)(`div`,{"data-chosen":t.id,className:`overflow-hidden rounded-lg border border-line`,children:[(0,F.jsx)(H,{model:e,contract:t,scheme:i}),(0,F.jsxs)(`div`,{className:`space-y-3 border-t border-line p-4`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,F.jsx)(`p`,{"data-uses":!0,className:`text-body text-ink`,children:n.length===0?`Not used in any scanned project yet.`:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`font-medium`,children:y(n.length,`use`)}),` in `,y(o.length,`file`),a&&(0,F.jsxs)(F.Fragment,{children:[` across `,y(s,`project`)]})]})}),(0,F.jsx)(_,{asChild:!0,size:`sm`,className:`ml-auto`,children:(0,F.jsxs)(f,{href:v(t.id),children:[`Open `,t.name,` `,(0,F.jsx)(r,{})]})})]}),c.length>0&&(0,F.jsx)(`ul`,{className:`space-y-1`,children:c.map(e=>(0,F.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-3`,children:[(0,F.jsxs)(`span`,{className:`flex min-w-0 flex-1 font-mono text-mono-sm`,title:`${e.file}: lines ${e.lines.join(`, `)}`,children:[(0,F.jsx)(`span`,{className:`min-w-0 truncate text-faint`,children:e.file.slice(0,e.file.lastIndexOf(`/`)+1)}),(0,F.jsx)(`span`,{className:`shrink-0 text-ink-2`,children:e.file.slice(e.file.lastIndexOf(`/`)+1)}),(0,F.jsxs)(`span`,{className:`shrink-0 text-muted`,children:[e.lines.slice(0,R).map(e=>`:${e}`).join(` `),e.lines.length>R&&` +${e.lines.length-R}`]})]}),a&&(0,F.jsx)(`span`,{className:`shrink-0 text-caption text-faint`,children:e.project}),(0,F.jsx)(`span`,{className:`w-6 shrink-0 text-right tabular text-small text-muted`,children:e.lines.length})]},`${e.project}:${e.file}`))}),n.length>0&&(0,F.jsx)(f,{href:l,className:`inline-block text-small text-accent hover:underline`,children:o.length>c.length?`And ${y(o.length-c.length,`more file`)}: every use`:`Every use with its props`})]})]})}function H({model:e,contract:t,scheme:n}){let[r,a]=(0,P.useState)(!1),o=g(t.id)?.name??t.name.toLowerCase(),s=e.byId.get(t.id);return(0,F.jsx)(`div`,{className:`grid min-h-24 place-items-start overflow-hidden`,style:{background:T(e,n).background},children:r?(0,F.jsxs)(`span`,{className:`flex h-24 w-full items-center justify-center gap-2 text-small text-muted`,children:[s&&(0,F.jsx)(i,{element:s,scheme:n}),` No captured look for `,t.name,` yet`]}):(0,F.jsx)(`img`,{src:A(o,n),srcSet:`${A(o,n)} 2x`,alt:`${t.name} in the ${n} scheme`,decoding:`async`,onError:()=>a(!0),className:`block h-auto max-h-56 w-auto max-w-full object-contain object-left-top`},`${o}.${n}`)})}function U({counts:e,projects:t,sites:n,violations:r}){return(0,F.jsxs)(`p`,{"data-headline":!0,className:`max-w-3xl text-title text-ink-2`,children:[(0,F.jsx)(j,{value:e.component,href:`/elements`}),` `,b(e.component,`component`),`, `,(0,F.jsx)(j,{value:e.token,href:`/tokens`}),` `,b(e.token,`token`),` and `,(0,F.jsx)(j,{value:e.rule,href:`/elements`}),` `,b(e.rule,`rule`),t!==null&&n!==null&&r!==null?(0,F.jsxs)(F.Fragment,{children:[`, used at `,(0,F.jsx)(j,{value:n,href:`/screens`}),` `,b(n,`site`),` in `,(0,F.jsx)(j,{value:t,href:`/screens`}),` `,b(t,`project`),r>0?(0,F.jsxs)(F.Fragment,{children:[` `,`with `,(0,F.jsx)(j,{value:r}),` `,b(r,`violation`),`.`]}):(0,F.jsxs)(F.Fragment,{children:[` `,`with `,(0,F.jsx)(j,{value:`no`,clean:!0}),` violations.`]})]}):`.`]})}function W({label:e,value:t,max:n,href:r,trailing:i}){return(0,F.jsx)(`li`,{children:(0,F.jsxs)(f,{href:r,className:`group grid grid-cols-[minmax(0,42%)_1fr_auto] items-center gap-3 rounded-md px-2 py-1 hover:bg-raised`,children:[(0,F.jsx)(`span`,{className:`truncate text-body text-ink-2 group-hover:text-ink`,children:e}),(0,F.jsx)(`span`,{className:`h-1.5 overflow-hidden rounded-full bg-raised`,children:(0,F.jsx)(`span`,{className:`block h-full rounded-full bg-ink-2`,style:{width:`${n?t/n*100:0}%`}})}),(0,F.jsxs)(`span`,{className:`flex items-center gap-2 tabular text-small text-muted`,children:[i,t]})]})})}function G({label:e,samples:t,budget:n}){let r=a(t,50),i=a(t,95);return r===null||i===null?(0,F.jsxs)(`span`,{children:[e,` no samples yet`]}):(0,F.jsxs)(`span`,{className:`tabular`,children:[e,` `,r.toFixed(1),` ms median, p95 `,i.toFixed(1),` ms`,` `,i<=n?`(budget ${n} ms)`:(0,F.jsxs)(`span`,{className:`text-danger`,children:[`over its `,n,` ms budget`]})]})}function K({samples:e}){return(0,F.jsxs)(`p`,{"data-speed":!0,className:`border-t border-line pt-4 text-small text-muted`,children:[`Speed in this tab: `,(0,F.jsx)(G,{label:`search`,samples:e.search,budget:l.searchMs}),`; `,(0,F.jsx)(G,{label:`navigation`,samples:e.navigation,budget:l.navigationMs}),`.`]})}function q({rules:e}){return e.length===0?null:(0,F.jsx)(N,{className:`mt-1`,summaryClassName:`-mx-2 rounded-md px-2 py-1 text-body hover:bg-raised`,summary:(0,F.jsxs)(`span`,{className:`text-success`,children:[e.length,` `,e.length===1?`rule`:`rules`,` clean`]}),children:(0,F.jsx)(`ul`,{className:`-mx-2 mt-0.5 space-y-0.5`,children:e.map(e=>(0,F.jsx)(`li`,{children:(0,F.jsxs)(f,{href:v(e.id),className:`flex items-center gap-3 rounded-md px-2 py-1 text-body text-ink-2 hover:bg-raised hover:text-ink`,children:[(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,F.jsx)(`span`,{className:`tabular text-small text-muted`,children:`0`})]})},e.id))})})}function J({model:e,index:t,scheme:n}){let r=[...e.rules.values()].map(e=>({rule:e,count:t.violationsByRule.get(e.id)?.length??0})).sort((e,t)=>t.count-e.count),i=r.filter(e=>e.count>0),a=r.filter(e=>e.count===0).map(e=>e.rule),o=i[0]?.count??0;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(C,{title:`Where ${e.catalog.system.name} lives`,count:t.reports.length,children:(0,F.jsx)(w,{head:[`Project`,`Commit`,`Scan`,`Sites`,`Screens`,`Violations`],children:t.reports.map(e=>{let t=u(e.usages.map(t=>({...t,project:e.project,commit:e.commit})));return(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`font-medium text-ink`,children:e.project}),(0,F.jsx)(`td`,{className:`font-mono text-mono-sm text-muted`,children:e.commit==null?`–`:M(e.commit)}),(0,F.jsx)(`td`,{children:(0,F.jsx)(S,{tone:e.status===`complete`?`success`:`warning`,title:e.scanner,children:e.status})}),(0,F.jsx)(`td`,{className:`tabular text-ink-2`,children:t.sites}),(0,F.jsx)(`td`,{className:`tabular text-ink-2`,children:t.screens}),(0,F.jsx)(`td`,{className:`tabular text-ink-2`,children:e.violations.length})]},e.project)})})}),(0,F.jsx)(C,{title:`Most used components`,aside:(0,F.jsx)(`span`,{className:`text-small text-muted`,children:`uses in scanned projects`}),children:(0,F.jsx)(B,{model:e,index:t,scheme:n})}),(0,F.jsxs)(C,{title:`Rule health`,aside:(0,F.jsx)(`span`,{className:`text-small text-muted`,children:`violations in projects`}),children:[i.length>0&&(0,F.jsx)(`ul`,{className:`-mx-2 space-y-0.5`,children:i.map(({rule:e,count:t})=>(0,F.jsx)(W,{label:e.title,value:t,max:o,href:v(e.id),trailing:(0,F.jsx)(x,{severity:e.severity})},e.id))}),(0,F.jsx)(q,{rules:a})]})]})}function Y(){let e=o();return e.status===`ready`?(0,F.jsx)(X,{model:e.value}):(0,F.jsx)(m,{state:e,onRetry:s,what:`the design language`})}function X({model:e}){let t=d(),n=c(),{scheme:i}=h(),a=p(e.elements),{system:o}=e.catalog,s=t.status===`ready`?t.value:null,l=s?s.reports.reduce((e,t)=>e+t.usages.length,0):null,u=s?s.reports.reduce((e,t)=>e+t.violations.length,0):null,g=e.manifest.source.commit;return(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,F.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-10 px-8 py-10 animate-enter max-md:px-5`,children:[(0,F.jsxs)(`header`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,F.jsx)(`h1`,{className:`text-display`,children:o.name}),(0,F.jsxs)(S,{tone:`outline`,className:`tabular`,children:[`v`,o.version]}),g&&(0,F.jsxs)(`span`,{className:`font-mono text-mono-sm text-muted`,title:`The commit that last changed these definitions`,children:[`@`,M(g)]}),u!==null&&u>0&&(0,F.jsx)(_,{asChild:!0,className:`ml-auto`,children:(0,F.jsxs)(f,{href:`/rules`,children:[`Review `,u===1?`the violation`:`${u} violations`,` `,(0,F.jsx)(r,{})]})})]}),(0,F.jsx)(U,{counts:a,projects:s?s.reports.length:null,sites:l,violations:u}),(0,F.jsx)(`p`,{className:`max-w-2xl text-reading text-muted`,children:o.description})]}),s?(0,F.jsx)(J,{model:e,index:s,scheme:i}):(0,F.jsx)(m,{state:t,onRetry:()=>location.reload(),what:`the usage map`}),(0,F.jsx)(K,{samples:n})]})})}export{Y as HomeScreen,K as SpeedNote,J as Usage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./createLucideIcon-CGDJWtKO.js";import{n as i,r as a}from"./CopyButton-DE8drl4P.js";import{t as o}from"./compass-BkKOZPYe.js";import{t as s}from"./layers-DfzdK_wG.js";import{t as c}from"./triangle-alert-Dkdi9eDR.js";import{t as l}from"./clsx-DB0hHKMi.js";import{I as u,S as d,V as f,dt as p,ht as m,i as h,m as g,n as _,o as v,pt as y,s as b,z as x}from"./main-CfbpuT4Y.js";import{a as S,i as C,n as w}from"./inventory-BI8QBdar.js";import{useParts as T}from"./inventory-source-lZYzcA8O.js";import{t as E}from"./Badge-CUJUit4d.js";import{i as D,n as O,r as k,t as ee}from"./Tabs-Cbh9BCKW.js";import{t as te}from"./CodeBlock-CsiGFgvI.js";import{t as A}from"./Segmented-Dzi1x49S.js";import{n as ne}from"./format-DxAYNTN_.js";import{t as re}from"./SearchField-DtEgq9-Q.js";import{i as ie,n as ae,t as oe}from"./discover-CFhyKler.js";import{A as se,C as ce,D as le,E as ue,M as de,N as fe,O as pe,P as me,S as he,T as j,_ as M,a as N,b as ge,d as P,f as _e,g as ve,h as ye,j as be,k as F,m as xe,n as I,o as Se,p as L,r as R,s as Ce,v as we,w as Te,x as Ee,y as De}from"./Specimens-DuaE0WeO.js";import{n as z,t as B}from"./family-tiles-B8_onXUi.js";import{t as Oe}from"./Disclosure-B1kTgPgk.js";var V={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};V.node;var ke=r(V),H=e(t(),1),U=n();function Ae(e){let t=m(),[n,r]=y();return[(0,H.useMemo)(()=>pe(t,e),[t,e]),(0,H.useCallback)(e=>r(`${n}${j(e)}`,{replace:!0}),[n,r])]}var W=`__all`,G=`max-md:h-11`;function je({label:e,count:t}){return(0,U.jsxs)(U.Fragment,{children:[e,(0,U.jsx)(`span`,{className:`tabular text-caption text-faint`,title:t===null?`Counting once its looks load`:void 0,children:t===null?`…`:t})]})}function K({label:e,value:t,all:n,options:r,onChange:i}){return(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3 max-md:flex-col max-md:gap-1.5`,children:[(0,U.jsx)(`span`,{className:`w-16 shrink-0 pt-1 text-small text-muted md:text-right`,children:e}),(0,U.jsx)(A,{label:e,wrap:!0,touch:!0,value:t??W,onChange:e=>i(e===W?null:e),options:[{value:W,label:(0,U.jsx)(je,{label:`All`,count:n})},...r.map(e=>({value:e.value,label:(0,U.jsx)(je,{label:e.label,count:e.count})}))]})]})}function Me({filters:e,onChange:t,counts:n}){return(0,U.jsxs)(`div`,{className:`space-y-2.5`,"data-testid":`filter-controls`,children:[(0,U.jsx)(K,{label:`Type`,value:e.type,all:n.all.type,options:n.types,onChange:n=>t({...e,type:n})}),(0,U.jsx)(K,{label:`Library`,value:e.lib,all:n.all.lib,options:n.libs,onChange:n=>t({...e,lib:n})}),(0,U.jsx)(K,{label:`Project`,value:e.project,all:n.all.project,options:n.projects,onChange:n=>t({...e,project:n})})]})}function Ne({filters:e,onChange:t,counts:n}){return(0,U.jsxs)(b,{"aria-pressed":e.near,onClick:()=>t({...e,near:!e.near}),className:l(`inv-press`,G,e.near&&`border-warning text-warning`),children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:l(`grid size-3.5 place-items-center rounded-xs border`,e.near?`border-warning bg-warning text-on-accent`:`border-line-strong`),children:e.near&&(0,U.jsx)(a,{className:`size-2.5!`})}),`Near-duplicates only`,(0,U.jsx)(`span`,{className:`tabular text-caption text-faint`,children:n.near===null?`…`:n.near})]})}function Pe({filters:e,onChange:t}){return(0,U.jsx)(re,{value:e.q,onChange:n=>t({...e,q:n}),label:`Search by name or file`,placeholder:`Search by name or file`,touch:!0,className:`w-full md:w-72`})}function Fe({shown:e,total:t,filters:n,onChange:r}){return(0,U.jsxs)(`p`,{className:`flex items-center gap-2 text-small text-muted`,"aria-live":`polite`,children:[(0,U.jsx)(`span`,{className:`tabular`,children:e===null?`Counting ${t} families…`:`${e} of ${t} ${t===1?`family`:`families`}`}),M(n)>0&&(0,U.jsx)(`button`,{type:`button`,className:`inv-link inv-press text-accent max-md:min-h-11`,onClick:()=>r(ve),children:`Clear filters`})]})}function Ie({filters:e,onChange:t,counts:n,shown:r,total:i}){let[a,o]=(0,H.useState)(!1),s=M(e);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`section`,{"aria-label":`Filters`,className:`space-y-3 rounded-lg border border-line bg-surface p-4 max-md:hidden`,"data-testid":`filter-bar`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,U.jsx)(Pe,{filters:e,onChange:t}),(0,U.jsx)(Ne,{filters:e,onChange:t,counts:n}),(0,U.jsx)(`div`,{className:`ml-auto`,children:(0,U.jsx)(Fe,{shown:r,total:i,filters:e,onChange:t})})]}),(0,U.jsx)(Me,{filters:e,onChange:t,counts:n})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 md:hidden`,"data-testid":`filter-phone`,children:[(0,U.jsxs)(b,{onClick:()=>o(!0),className:l(`inv-press`,G),children:[(0,U.jsx)(ke,{}),` Filters`,s>0&&(0,U.jsx)(`span`,{className:`tabular text-caption text-accent`,children:s})]}),(0,U.jsx)(Fe,{shown:r,total:i,filters:e,onChange:t})]}),(0,U.jsx)(L,{open:a,onOpenChange:o,variant:`sheet`,title:`Filters`,description:`They combine, and stay in the page's address.`,testId:`filter-sheet`,footer:(0,U.jsx)(b,{variant:`primary`,className:l(`inv-press w-full`,G),onClick:()=>o(!1),children:r===null?`Show families`:`Show ${r} ${r===1?`family`:`families`}`}),children:(0,U.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[(0,U.jsx)(Pe,{filters:e,onChange:t}),(0,U.jsx)(Ne,{filters:e,onChange:t,counts:n}),(0,U.jsx)(Me,{filters:e,onChange:t,counts:n})]})})]})}var q=(e,t)=>`${e.project} · ${t.primary(e.kit).label}`,J=(e,t)=>`${e.id}:${t.project}:${t.kit??`plain`}`;function Y({view:e,chunks:t,source:n,scheme:r},i,a){let o=B(e.family,t,n,r,(e,t)=>e===i.project&&t===i.kit);return z(o,e.family,`${a}:${J(e.family,i)}`)}var X=e=>`compare-${e}`,Z=e=>`fix-${e}`,Q=5;function Le(e){let{view:t,libraries:n}=e,r=ge(t.family),[i,a]=(0,H.useState)(`overlay`),[o,s]=(0,H.useState)(50),c=(0,H.useRef)(null),u=(0,H.useRef)(null);if(!r)return null;let[d,f]=r,p=t.family.sides.length-2,m=Y(e,d,`compare-a`),h=Y(e,f,`compare-b`),g=we({shape:F(d,t.looks,t.family.shape),uses:d.looks,projects:[d.project]},{shape:F(f,t.looks,t.family.shape),uses:f.looks,projects:[f.project]}),_=e=>{let t=c.current?.getBoundingClientRect();t&&s(se(e,t.left,t.width))},v=e=>{(e.pointerType!==`mouse`||e.button===0)&&(e.currentTarget.setPointerCapture?.(e.pointerId),u.current=e.pointerId,_(e.clientX))},y=e=>{u.current===e.pointerId&&_(e.clientX)},b=e=>{u.current===e.pointerId&&(u.current=null)};return(0,U.jsxs)(`article`,{id:X(t.family.id),"aria-labelledby":`${X(t.family.id)}-title`,className:`min-w-0 scroll-mt-4 space-y-3 rounded-lg border border-line bg-surface p-4`,"data-compare":t.family.id,children:[(0,U.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,U.jsx)(`h3`,{id:`${X(t.family.id)}-title`,className:`text-heading text-ink`,children:t.name}),(0,U.jsxs)(E,{tone:`warning`,children:[`Built `,t.family.sides.length,` ways`]}),(0,U.jsx)(A,{className:`ml-auto`,label:`Compare as`,touch:!0,value:i,onChange:a,options:[{value:`overlay`,label:`Overlay`},{value:`side`,label:`Side by side`},{value:`states`,label:`States`}]})]}),i===`overlay`?(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsxs)(`div`,{className:`mx-auto flex max-w-80 justify-between gap-3 text-caption text-muted`,children:[(0,U.jsxs)(`span`,{className:`truncate`,children:[`← `,q(d,n)]}),(0,U.jsxs)(`span`,{className:`truncate`,children:[q(f,n),` →`]})]}),(0,U.jsxs)(`div`,{ref:c,className:`relative mx-auto max-w-80 touch-none select-none overflow-hidden rounded-md`,style:{height:136},onPointerDown:v,onPointerMove:y,onPointerUp:b,onPointerCancel:b,"data-testid":`compare-stage`,children:[(0,U.jsx)(`div`,{className:`absolute inset-0`,"data-layer":`bottom`,children:(0,U.jsx)(I,{tiles:m,scheme:e.scheme,size:`large`,as:`div`,caption:!1})}),(0,U.jsx)(`div`,{className:`absolute inset-0`,"data-layer":`top`,style:{clipPath:De(o)},children:(0,U.jsx)(I,{tiles:h,scheme:e.scheme,size:`large`,as:`div`,caption:!1})}),(0,U.jsxs)(`div`,{role:`slider`,tabIndex:0,"aria-label":`Wipe between ${q(d,n)} and ${q(f,n)}`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,"aria-valuetext":`${Math.round(o)}% from the left`,onKeyDown:e=>{let t={ArrowLeft:o-Q,ArrowDown:o-Q,ArrowRight:o+Q,ArrowUp:o+Q,PageDown:o-50,PageUp:o+50,Home:0,End:100}[e.key];t!==void 0&&(e.preventDefault(),s(Math.min(100,Math.max(0,t))))},className:`absolute inset-y-0 w-6 -translate-x-1/2 cursor-ew-resize rounded-md outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus focus-visible:outline-solid focus-visible:[&>span]:bg-focus max-md:w-11`,style:{left:`${o}%`},children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-y-0 left-1/2 w-0.5 -translate-x-1/2 bg-accent`}),(0,U.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-1/2 left-1/2 size-4 -translate-1/2 rounded-full border-2 border-surface bg-accent shadow-raise`})]})]})]}):i===`states`?(0,U.jsx)(`div`,{className:`space-y-3`,"data-testid":`compare-states`,children:[{side:d,tiles:m},{side:f,tiles:h}].map(({side:r,tiles:i})=>(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,U.jsx)(`p`,{className:`truncate text-caption text-muted`,children:q(r,n)}),(0,U.jsx)(N,{tile:i[0],scheme:e.scheme,label:q(r,n)})]},J(t.family,r)))}):(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,"data-testid":`compare-side-by-side`,children:[{side:d,tiles:m},{side:f,tiles:h}].map(({side:r,tiles:i})=>(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,U.jsx)(`p`,{className:`truncate text-caption text-muted`,children:q(r,n)}),(0,U.jsx)(I,{tiles:i,scheme:e.scheme,size:`large`,as:`div`,caption:!1})]},J(t.family,r)))}),(0,U.jsxs)(`table`,{className:`w-full border-collapse text-left text-small`,"aria-label":`Attributes`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{className:`border-b border-line text-muted`,children:[(0,U.jsx)(`th`,{scope:`col`,className:`h-8 pr-3 font-medium`,children:`Attribute`}),(0,U.jsx)(`th`,{scope:`col`,className:`h-8 pr-3 font-medium`,children:q(d,n)}),(0,U.jsx)(`th`,{scope:`col`,className:`h-8 font-medium`,children:q(f,n)})]})}),(0,U.jsx)(`tbody`,{children:g.map(e=>(0,U.jsxs)(`tr`,{"data-differs":e.differs||void 0,className:l(`border-b border-line last:border-0`,e.differs&&`bg-warning-soft`),children:[(0,U.jsxs)(`th`,{scope:`row`,className:l(`py-1.5 pr-3 font-normal`,e.differs?`text-warning`:`text-muted`),children:[e.label,e.differs&&(0,U.jsx)(`span`,{className:`sr-only`,children:` (differs)`})]}),(0,U.jsx)(`td`,{className:`tabular py-1.5 pr-3 text-ink`,children:e.a}),(0,U.jsx)(`td`,{className:`tabular py-1.5 text-ink`,children:e.b})]},e.label))})]}),p>0&&(0,U.jsxs)(`p`,{className:`text-caption text-muted`,children:[p,` more `,p===1?`way to build it is`:`ways to build it are`,` in its fix below.`]})]})}function Re(e){let t=e.looks.length>0?e.looks.map(e=>`${e.project}:${e.file}`):e.family.sides.flatMap(e=>e.examples.map(e=>`${e.project}:${e.file}`));return[...new Set(t)].sort()}function ze(e){let{view:t,libraries:n}=e,r=Re(t),i=`${Z(t.family.id)}-reason`;return(0,U.jsxs)(`li`,{id:Z(t.family.id),className:`min-w-0 scroll-mt-4 space-y-3 rounded-lg border border-line bg-surface p-4`,"data-fix":t.family.id,children:[(0,U.jsxs)(`header`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,U.jsx)(`h3`,{className:`text-heading text-ink`,children:t.name}),(0,U.jsxs)(`span`,{className:`tabular text-small text-muted`,children:[t.uses,` `,t.uses===1?`use`:`uses`,` · built `,t.family.sides.length,` ways in `,t.projects,` `,t.projects===1?`project`:`projects`]})]}),(0,U.jsx)(`ul`,{className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2 max-md:grid-cols-2`,"aria-label":`Ways it is built`,children:t.family.sides.map(r=>(0,U.jsxs)(`li`,{className:`min-w-0 space-y-1`,children:[(0,U.jsx)(I,{tiles:Y(e,r,`fix`),scheme:e.scheme,as:`div`,caption:!1}),(0,U.jsxs)(`p`,{className:`truncate text-caption text-muted`,title:q(r,n),children:[(0,U.jsx)(`span`,{className:`font-medium text-ink-2`,children:r.project}),` · `,n.primary(r.kit).label,` · `,r.looks,` `,r.looks===1?`use`:`uses`]})]},J(t.family,r)))}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(`p`,{className:`text-small text-muted`,children:[r.length,` `,r.length===1?`file`:`files`,` to change`]}),(0,U.jsx)(`ul`,{className:`space-y-0.5`,children:r.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)(`code`,{className:`font-mono text-mono-sm break-all text-ink-2`,children:e})},e))})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,U.jsx)(b,{disabled:!0,"aria-describedby":i,className:G,children:`Merge into one`}),(0,U.jsx)(`span`,{id:i,className:`text-small text-muted`,children:`Not available yet: the hub reads your projects and never changes them.`})]})]})}var Be=e=>`/discover${ie({...oe,family:e.id,role:ae(e.role)})}`,$=12;function Ve({view:e,source:t,scheme:n,onClose:r}){let i=xe(),a=(0,H.useRef)(null);e&&(a.current=e);let o=e??a.current;return(0,U.jsx)(L,{open:e!==null,onOpenChange:e=>!e&&r(),variant:i?`drawer`:`sheet`,testId:`family-drawer`,title:o?He(o):``,description:o?.name,children:(0,U.jsx)(R.Provider,{value:null,children:o&&(0,U.jsx)(Ue,{view:o,source:t,scheme:n})})})}function He(e){let t=`${e.stories} ${e.stories===1?`story`:`stories`}`;return e.authored?`Only in Storybook: ${t}`:`${e.uses} ${e.uses===1?`use`:`uses`} across ${e.projects} ${e.projects===1?`project`:`projects`}${e.stories>0?` · ${t}`:``}`}function Ue({view:e,source:t,scheme:n}){let r=t.index.roles.find(t=>t.role===e.family.role),i=(0,H.useMemo)(()=>e.family.projects.flatMap(e=>r?.chunks[e]?[r.chunks[e]]:[]),[e.family.projects,r]),a=T(t,i,!0),s=a.every(e=>e.status===`ready`),c=a.find(e=>e.status===`error`),l=s?a.map(e=>e.value):[],u=l.flatMap(t=>t.looks.filter(t=>t.family===e.family.id).map(e=>({...e,project:t.project}))),d=fe({family:e.family,looks:u}),f=be({looks:u}),m=s?B(e.family,l,t,n):[],h=m.filter(e=>e.specimen!==null);return c?.status===`error`?(0,U.jsx)(`p`,{className:`px-5 py-4 text-small text-danger`,children:c.message}):(0,U.jsxs)(ee,{defaultValue:`usage`,className:`flex min-h-0 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-5 pb-2`,children:[(0,U.jsx)(b,{size:`sm`,asChild:!0,className:`max-md:h-11`,children:(0,U.jsxs)(p,{href:Be(e.family),"data-find-alternatives":e.family.id,children:[(0,U.jsx)(o,{}),` Find alternatives`]})}),(0,U.jsx)(`span`,{className:`text-caption text-muted`,children:`Outside candidates, compared beside this one.`})]}),(0,U.jsxs)(k,{className:`px-5 max-md:h-12`,children:[(0,U.jsx)(D,{value:`usage`,count:s?d.length:void 0,children:`Usage`}),(0,U.jsx)(D,{value:`variants`,count:s?m.length:void 0,children:`Variants`}),(0,U.jsx)(D,{value:`code`,children:`Code`})]}),s?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(O,{value:`usage`,className:`space-y-4 px-5 py-4 outline-none`,children:[d.length===0&&(0,U.jsx)(`p`,{className:`text-small text-muted`,children:`No project renders this shape: only its Storybook stories do. Its stories are below, and drawn in Variants.`}),(0,U.jsx)(`ul`,{className:`divide-y divide-line`,"aria-label":`Every use`,children:d.map(e=>(0,U.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5 py-2 text-small`,"data-use":!0,children:[(0,U.jsx)(`span`,{className:`font-medium text-ink`,children:e.project}),(0,U.jsx)(`code`,{className:`font-mono text-mono-sm break-all text-ink-2`,children:e.place}),(0,U.jsx)(`span`,{className:`text-caption text-muted`,children:e.routes.length>0?e.routes.join(` `):`no route found`})]},e.key))}),f.length>0&&(0,U.jsxs)(`section`,{"aria-labelledby":`family-stories`,className:`space-y-1`,children:[(0,U.jsxs)(`h3`,{id:`family-stories`,className:`text-small font-medium text-ink`,children:[`Stories `,(0,U.jsx)(`span`,{className:`tabular font-normal text-muted`,children:f.length})]}),(0,U.jsx)(`p`,{className:`text-caption text-muted`,children:`Authored states from Storybook, drawn with this project's code and CSS. They are not uses, so the counts above leave them out.`}),(0,U.jsx)(`ul`,{className:`divide-y divide-line`,"aria-label":`Storybook stories`,children:f.map(e=>(0,U.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5 py-2 text-small`,"data-story-row":!0,children:[(0,U.jsx)(`span`,{className:`font-medium text-ink`,children:e.story}),(0,U.jsx)(`code`,{className:`font-mono text-mono-sm break-all text-ink-2`,children:e.place})]},e.key))})]})]}),(0,U.jsx)(O,{value:`variants`,className:`px-5 py-4 outline-none`,children:(0,U.jsx)(We,{tiles:m,scheme:n})}),(0,U.jsx)(O,{value:`code`,className:`space-y-3 px-5 py-4 outline-none`,children:h.length===0?(0,U.jsx)(`p`,{className:`text-small text-muted`,children:`No specimen was built for this family, so there is no HTML to show: its looks draw their measured shape.`}):(0,U.jsxs)(U.Fragment,{children:[h.slice(0,$).map(e=>(0,U.jsx)(te,{title:e.story?`${P(e.story)} · ${e.place}`:`${e.project} · ${e.place}`,code:e.specimen.html,maxHeight:`sm`,touch:!0},e.key)),h.length>$&&(0,U.jsxs)(`p`,{className:`text-small text-muted`,children:[h.length-$,` more in Variants.`]})]})})]}):(0,U.jsx)(`p`,{"aria-busy":`true`,className:`px-5 py-4 text-small text-faint`,children:`Loading its uses…`})]})}function We({tiles:e,scheme:t}){let[n,r]=(0,H.useState)(`looks`),i=e.filter(e=>e.specimen!==null&&e.css!==null);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,U.jsx)(`p`,{className:`min-w-0 flex-1 text-small text-muted`,children:n===`looks`?`Each distinct way it is drawn, per project; looks drawn the same share a tile. Storybook stories follow, each labeled.`:`Each drawn look default, hover, focus, pressed and disabled, from its project's own CSS.`}),(0,U.jsx)(A,{label:`Show`,touch:!0,value:n,onChange:r,options:[{value:`looks`,label:`Looks`},{value:`states`,label:`States`,count:i.length}]})]}),n===`looks`?(0,U.jsx)(Ce,{tiles:e,scheme:t,tryIt:!0}):i.length===0?(0,U.jsx)(`p`,{className:`text-small text-muted`,children:`No look of this family was drawn from its project's code and CSS, so there are no states to show.`}):(0,U.jsx)(`ul`,{className:`space-y-4`,"aria-label":`States of each look`,children:i.map(e=>(0,U.jsxs)(`li`,{className:`min-w-0 space-y-1`,children:[e.story?(0,U.jsx)(Se,{story:e.story,place:e.place}):(0,U.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-1.5 text-caption text-muted`,children:[(0,U.jsx)(`span`,{className:`shrink-0 font-medium text-ink-2`,children:e.project}),e.count>1&&(0,U.jsxs)(`span`,{className:`shrink-0 tabular`,children:[`×`,e.count]}),(0,U.jsx)(`span`,{className:`truncate font-mono`,title:e.place,children:e.place})]}),(0,U.jsx)(N,{tile:e,scheme:t,label:e.story?`${e.project} ${P(e.story)}`:`${e.project} ${e.place}`})]},e.key))})]})}var Ge=232,Ke=4;function qe(){let e=f(),t=x();return e.status===`ready`?(0,U.jsx)(Je,{inventory:e.value,detect:t.status===`ready`?t.value:null}):(0,U.jsx)(h,{state:e,onRetry:u,what:`the inventory`})}function Je({inventory:e,detect:t=null}){let n=e?.index;return!e||!n||n.summary.looks===0?(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(_,{title:`Inventory`,count:0}),(0,U.jsx)(v,{icon:d,title:n?`No elements found`:`No inventory yet`,children:n?`The inventoried projects render no buttons, inputs, cards, badges, dialogs or tabs this scanner recognises.`:`Run youiyoux inventory --project <dir> (once per project), then open the hub with youiyoux ui --inventory .youi/inventory.json.`})]}):(0,U.jsx)(Ye,{source:e,detect:t})}function Ye({source:e,detect:t}){let n=e.index,{scheme:r}=g(),[i,a]=(0,H.useState)(null),[o,s]=Ae(n),c=(0,H.useRef)(!0),l=(0,H.useRef)(j(o));j(o)!==l.current&&(c.current=!1);let u=(0,H.useCallback)(e=>{c.current=!1,s(e)},[s]),d=Xe(),f=(0,H.useMemo)(()=>le(n,o),[n,o]),p=T(e,f,!1);Qe(e,f,d);let[m]=T(e,[n.extras],d),h=m?.status===`ready`?m.value:null,v=(0,H.useMemo)(()=>new ye(h,t),[h,t]),y=p.map(e=>e.status).join(`|`),b=(0,H.useMemo)(()=>p.flatMap(e=>e.status===`ready`?[e.value]:[]),[y,f]),x=(0,H.useMemo)(()=>h?he(b,v):[],[b,v,h]),S=h!==null&&p.every(e=>e.status===`ready`),C=ce(n,x,o,t=>h!==null&&e.get(t).status===`ready`,v),w=(0,H.useMemo)(()=>Te(x,o),[x,o]),D=w.filter(e=>e.family.nearDuplicate),[O,k]=(0,H.useState)(null),ee=O?x.find(e=>e.family.id===O)??null:null;return(0,U.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-screen":`inventory`,children:[(0,U.jsxs)(_,{title:`Inventory`,count:n.summary.families,children:[(0,U.jsxs)(E,{tone:`outline`,children:[n.projects.length,` `,n.projects.length===1?`project`:`projects`]}),n.summary.nearDuplicates>0&&(0,U.jsxs)(E,{tone:`warning`,children:[n.summary.nearDuplicates,` `,n.summary.nearDuplicates===1?`near-duplicate`:`near-duplicates`]})]}),(0,U.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-y-auto`,children:(0,U.jsx)(R.Provider,{value:i,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-8 px-6 py-6 max-sm:space-y-6 max-sm:px-4`,children:[(0,U.jsx)(Ie,{filters:o,onChange:u,counts:C,shown:S?w.length:null,total:n.summary.families}),(0,U.jsx)(et,{index:n,views:w,ready:S,filtered:M(o)>0}),(0,U.jsxs)(`section`,{"aria-labelledby":`inventory-wall`,className:`space-y-6`,children:[(0,U.jsx)(`h2`,{id:`inventory-wall`,className:`sr-only`,children:`Specimen wall`}),(0,U.jsx)(rt,{index:n,filters:o,scope:f,views:w,chunks:b,source:e,scheme:r,libraries:v,extras:h!==null,ready:S,stagger:c.current,onOpen:k})]}),S&&D.length>0&&(0,U.jsxs)(`section`,{"aria-labelledby":`inventory-compare`,className:`space-y-3`,children:[(0,U.jsx)($e,{id:`inventory-compare`,title:`Near-duplicates, compared`,count:D.length,children:`The same look built more than once: drag across a pair to see where they part.`}),(0,U.jsx)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:D.map(t=>(0,U.jsx)(Le,{view:t,chunks:b,source:e,scheme:r,libraries:v},t.family.id))})]}),S&&D.length>0&&(0,U.jsxs)(`section`,{"aria-labelledby":`inventory-fixes`,className:`space-y-3`,children:[(0,U.jsx)($e,{id:`inventory-fixes`,title:`Fix list`,count:D.length,children:`Each near-duplicate, every way it is built and the files that would change.`}),(0,U.jsx)(`ul`,{className:`space-y-4`,children:D.map(t=>(0,U.jsx)(ze,{view:t,chunks:b,source:e,scheme:r,libraries:v},t.family.id))})]}),h&&h.flags.length>0&&(0,U.jsx)(ot,{flags:h.flags}),h&&(0,U.jsx)(ct,{extras:h}),(0,U.jsxs)(`p`,{className:`text-small text-muted`,children:[n.summary.notClustered,` breakpoint and state classes recorded, not clustered: a family is decided by the resting shape.`,n.summary.unshaped>0&&` ${n.summary.unshaped} ${n.summary.unshaped===1?`look has`:`looks have`} no resolved shape and ${n.summary.unshaped===1?`is`:`are`} not grouped.`]})]})})}),(0,U.jsx)(Ve,{view:ee,source:e,scheme:r,onClose:()=>k(null)})]})}function Xe(){let[e,t]=(0,H.useState)(!1);return(0,H.useEffect)(()=>{if(typeof requestAnimationFrame!=`function`){let e=setTimeout(()=>t(!0),0);return()=>clearTimeout(e)}let e=0,n=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>t(!0))});return()=>{cancelAnimationFrame(n),cancelAnimationFrame(e)}},[]),e}var Ze=2e3;function Qe(e,t,n){let r=t.join(`\0`);(0,H.useEffect)(()=>{if(!n)return;let t=r.split(`\0`).filter(Boolean),i=()=>{},a=!1,o=e=>{if(typeof requestIdleCallback==`function`){let t=requestIdleCallback(e,{timeout:Ze});i=()=>cancelIdleCallback(t)}else{let t=setTimeout(e,0);i=()=>clearTimeout(t)}},s=n=>{if(!t.some(t=>e.get(t).status===`loading`))return n();let r=e.subscribe(()=>{t.some(t=>e.get(t).status===`loading`)||(r(),a||n())});i=r},c=()=>{let n=t.find(t=>e.get(t).status===`idle`);n&&!a&&o(()=>{a||(e.load(n),s(c))})};return s(c),()=>{a=!0,i()}},[e,r,n])}function $e({id:e,title:t,count:n,children:r}){return(0,U.jsxs)(`header`,{className:`space-y-0.5`,children:[(0,U.jsxs)(`h2`,{id:e,className:`flex items-baseline gap-2 text-heading`,children:[t,` `,(0,U.jsx)(`span`,{className:`tabular text-small font-normal text-muted`,children:n})]}),(0,U.jsx)(`p`,{className:`text-small text-muted`,children:r})]})}function et({index:e,views:t,ready:n,filtered:r}){let i=e.tolerance,a=t.filter(e=>!e.authored),o=n?a.length:r?null:e.summary.families,s=n?Ee(a,i):null,c=n?de(a):[],l=s?s.families-s.estimate:0;return(0,U.jsxs)(`section`,{"aria-labelledby":`inventory-headline`,className:`space-y-4`,"data-testid":`inventory-headline`,children:[(0,U.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-line bg-surface p-4`,children:[(0,U.jsxs)(`h2`,{id:`inventory-headline`,className:`text-display tabular text-ink`,"data-testid":`consolidation`,children:[o===null?`Counting families…`:`${o} ${o===1?`family`:`families`}`,(0,U.jsx)(`span`,{"aria-hidden":!0,className:`text-muted`,children:` → `}),(0,U.jsxs)(`span`,{className:`text-muted`,children:[`could be ~`,s?s.estimate:`…`]})]}),(0,U.jsx)(`div`,{"aria-hidden":!0,className:`flex h-2 overflow-hidden rounded-full bg-raised`,children:s&&s.families>0&&(0,U.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${s.estimate/s.families*100}%`}})}),(0,U.jsxs)(`p`,{className:`text-small text-muted`,children:[s?l>0?`${l} ${l===1?`family sits`:`families sit`} within one tolerance step of another of the same element, and ${nt(a)}.`:`No two families of the same element sit within one tolerance step; ${nt(a)}.`:`Looking at every family in view…`,e.projects.length>0&&` Across ${tt(e.projects.map(e=>e.id))}.`]})]}),c.length>0&&(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`h3`,{className:`text-heading`,children:[`Top `,c.length===1?`fix`:`${c.length} fixes`]}),(0,U.jsx)(`ol`,{className:`grid gap-3 md:grid-cols-3`,"data-testid":`top-fixes`,children:c.map((e,t)=>(0,U.jsxs)(`li`,{className:`space-y-1.5 rounded-lg border border-line bg-surface p-3`,children:[(0,U.jsxs)(`p`,{className:`flex items-baseline gap-2`,children:[(0,U.jsx)(`span`,{className:`tabular text-caption text-faint`,children:t+1}),(0,U.jsx)(`span`,{className:`font-medium text-ink`,children:e.name})]}),(0,U.jsxs)(`p`,{className:`tabular text-small text-muted`,children:[`Built `,e.family.sides.length,` ways · `,e.uses,` `,e.uses===1?`use`:`uses`,` · `,e.projects,` `,e.projects===1?`project`:`projects`]}),(0,U.jsxs)(`p`,{className:`flex gap-3 text-small`,children:[(0,U.jsx)(`a`,{href:`#${X(e.family.id)}`,className:`inv-link text-accent max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:`Compare`}),(0,U.jsx)(`a`,{href:`#${Z(e.family.id)}`,className:`inv-link text-accent max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:`Fix`})]})]},e.family.id))})]}),(0,U.jsx)(Oe,{className:`rounded-lg border border-line bg-surface px-4 py-3 text-small max-md:py-0`,summaryClassName:`justify-between font-medium text-ink max-md:min-h-11 max-md:py-3`,summary:`How grouping works`,children:(0,U.jsxs)(`div`,{className:`mt-2 space-y-2 text-ink-2 max-md:mt-0 max-md:pb-3`,children:[(0,U.jsx)(`p`,{children:`Every button, input, card, badge, dialog, tab and link-as-button is grouped into families by its resolved shape: height, padding, radius, font size and weight, from Tailwind classes and CSS rules with each project’s own theme. Colour is ignored.`}),(0,U.jsxs)(`p`,{children:[`A family’s looks are all within height ±`,i.height,`px, padding ±`,i.padding,`px, radius ±`,i.radius,`px, font size ±`,i.fontSize,`px and weight ±`,i.fontWeight,` of each other, so look-alikes never chain into one family.`]}),(0,U.jsx)(`p`,{children:`“Could be ~N” is an estimate, not a regrouping: a near-duplicate (one look built in more than one project or kit) counts once, and families of the same element whose usual shapes are within one tolerance step of each other on every dimension count as one.`}),(0,U.jsx)(`ul`,{className:`space-y-0.5 text-muted`,children:e.projects.map(e=>(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`span`,{className:`font-medium text-ink`,children:e.id}),` · `,e.files,` files`,e.commit?` @${ne(e.commit)}`:``,` · routes: `,e.routes,e.status===`partial`&&(0,U.jsxs)(`span`,{className:`text-warning`,children:[` · partial (`,e.failed,` not fully read)`]})]},e.id))})]})})]})}function tt(e){return e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`}function nt(e){let t=e.filter(e=>e.family.nearDuplicate).length;return t===0?`none is built more than once`:`${t} ${t===1?`is`:`are`} built more than once`}function rt(e){let{index:t,filters:n,views:r,ready:i}=e,a=t.roles.filter(e=>(!n.type||e.role===n.type)&&(!n.project||(e.cells[n.project]?.looks??0)>0)),o=M(n)>0,s=0,c=a.flatMap(t=>{let n=r.filter(e=>e.family.role===t.role);if(e.extras&&Object.values(t.chunks).every(t=>!e.scope.includes(t)||e.source.get(t).status===`ready`)&&n.length===0&&o)return[];let i=s;return s+=n.length,[{row:t,mine:n,start:i}]});return i&&c.length===0?(0,U.jsx)(v,{icon:d,title:`No families match`,children:`Try fewer filters, or clear them.`}):(0,U.jsx)(U.Fragment,{children:c.map(({row:t,mine:n,start:r})=>(0,U.jsx)(it,{...e,row:t,views:n,start:r},t.role))})}function it({row:e,views:t,start:n,filters:r,scope:i,extras:a,chunks:o,source:s,scheme:c,libraries:l,stagger:u,onOpen:d}){let f=(0,H.useRef)(null),p=_e(f,`800px`,`100000px`),m=(0,H.useMemo)(()=>Object.values(e.chunks).filter(e=>i.includes(e)),[e.chunks,i]),h=T(s,m,p),g=h.find(e=>e.status===`error`),_=a&&h.every(e=>e.status===`ready`),v=ue(t),y=r.project?e.cells[r.project]?.families??0:e.families,b=n;return(0,U.jsxs)(`section`,{ref:f,id:S(e.role),"aria-labelledby":`${S(e.role)}-title`,className:`scroll-mt-4 space-y-3`,"data-role":e.role,children:[(0,U.jsxs)(`header`,{className:`flex flex-wrap items-baseline gap-x-3 border-b border-line pb-2`,children:[(0,U.jsx)(`h2`,{id:`${S(e.role)}-title`,className:`text-heading`,children:w[e.role]}),(0,U.jsxs)(`span`,{className:`tabular text-small text-muted`,children:[_?`${t.length} ${t.length===1?`family`:`families`}`:`${y} ${y===1?`family`:`families`}`,` · `,e.looks,` `,e.looks===1?`look`:`looks`,e.unshaped>0&&` · ${e.unshaped} without a resolved shape`]})]}),g?.status===`error`?(0,U.jsx)(`p`,{className:`text-small text-danger`,children:g.message}):_?t.length===0?(0,U.jsx)(`p`,{className:`text-small text-muted`,children:`No look of this role has a resolved shape.`}):(0,U.jsx)(`div`,{className:`flex flex-wrap gap-4 max-md:flex-col`,children:v.map(e=>(0,U.jsxs)(`div`,{className:`min-w-0 space-y-2 md:flex-(--cell-flex)`,style:{"--cell-flex":`${e.families.length} 1 ${Math.min(e.families.length,3)*200}px`},"data-kit-cell":e.group.id,children:[(0,U.jsxs)(`p`,{className:`flex items-baseline gap-1.5 text-small`,children:[(0,U.jsx)(`span`,{className:`font-medium text-ink-2`,children:e.group.label}),(0,U.jsx)(`span`,{className:`tabular text-caption text-faint`,children:e.families.length})]}),(0,U.jsx)(`ul`,{className:`grid grid-cols-[repeat(auto-fill,minmax(200px,1fr))] gap-3 max-md:grid-cols-2 max-md:gap-2`,children:e.families.map(e=>(0,U.jsx)(at,{view:e,chunks:o,source:s,scheme:c,libraries:l,stagger:u?b++:null,onOpen:d},e.family.id))})]},e.group.id))}):y>0&&(0,U.jsxs)(`div`,{"aria-busy":`true`,className:`text-small text-faint`,style:{minHeight:Math.ceil(y/Ke)*Ge},children:[`Loading `,y,` `,y===1?`family`:`families`,`…`]})]})}function at({view:e,chunks:t,source:n,scheme:r,libraries:i,stagger:a,onOpen:o}){let s=z(B(e.family,t,n,r,(t,n)=>i.primary(n).id===e.primary.id),e.family,`wall:${e.family.id}`),c=()=>o(e.family.id);return(0,U.jsxs)(`li`,{className:l(`inv-tile inv-press flex min-w-0 cursor-pointer flex-col gap-2 rounded-lg border border-line bg-surface p-2`,a!==null&&`inv-enter`),style:a===null?void 0:{"--inv-i":a},"data-family":e.family.id,"data-stagger":a??void 0,onClick:e=>!e.target.closest(`button`)&&c(),children:[(0,U.jsx)(I,{tiles:s,scheme:r,size:`large`,as:`div`,caption:!1,tryIt:!0}),(0,U.jsxs)(`div`,{className:`min-w-0 space-y-0.5 px-1`,children:[(0,U.jsx)(`h3`,{className:`inv-tile-name text-small font-medium break-words text-ink`,children:e.name}),(0,U.jsx)(`p`,{className:`tabular text-caption text-muted`,"data-uses":``,children:me(e)})]}),(0,U.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-2 px-1 pb-1`,children:[e.family.nearDuplicate&&(0,U.jsx)(E,{tone:`warning`,children:`Near-duplicate`}),(0,U.jsx)(b,{size:`sm`,className:l(`inv-press ml-auto max-md:px-3`,G),onClick:c,"aria-label":`Open ${e.name}`,children:`Open`})]})]})}function ot({flags:e}){return(0,U.jsxs)(`section`,{"aria-labelledby":`inventory-flags`,className:`space-y-3`,children:[(0,U.jsxs)(`h2`,{id:`inventory-flags`,className:`flex items-center gap-2 text-heading`,children:[(0,U.jsx)(c,{"aria-hidden":!0,className:`size-4 text-warning`}),` Flags `,(0,U.jsx)(`span`,{className:`tabular text-small font-normal text-muted`,children:e.length})]}),(0,U.jsx)(`ul`,{className:`space-y-2`,children:e.map(e=>(0,U.jsx)(`li`,{className:`rounded-md border border-line p-3 text-small`,children:e.kind===`duplicate-definition`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`text-ink`,children:[(0,U.jsx)(i,{"aria-hidden":!0,className:`mr-1.5 inline size-3.5 text-muted`}),(0,U.jsx)(`code`,{className:`font-mono text-mono-sm`,children:e.name}),` is defined `,e.locations.length,` times`]}),(0,U.jsx)(`ul`,{className:`mt-1.5 space-y-0.5`,children:e.locations.map(e=>(0,U.jsxs)(`li`,{className:`text-muted`,children:[(0,U.jsx)(st,{project:e.project,file:e.file,line:e.line}),` · `,C(e.kit)]},`${e.project}:${e.file}`))})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`text-ink`,children:[(0,U.jsx)(s,{"aria-hidden":!0,className:`mr-1.5 inline size-3.5 text-muted`}),(0,U.jsx)(st,{project:e.project,file:e.file}),` imports `,new Set(e.imports.map(e=>e.kit)).size,` kits’ `,e.role,` in `,e.imports.length,` `,e.imports.length===1?`import`:`imports`]}),(0,U.jsx)(`ul`,{className:`mt-1.5 space-y-0.5`,children:e.imports.map(e=>(0,U.jsxs)(`li`,{className:`text-muted`,children:[(0,U.jsx)(`code`,{className:`font-mono text-mono-sm text-ink-2`,children:e.name}),` from `,C(e.kit),` · line `,e.line]},`${e.specifier}:${e.line}:${e.kit}`))})]})},e.kind===`duplicate-definition`?`d:${e.name}`:`m:${e.project}:${e.file}:${e.role}`))})]})}function st({project:e,file:t,line:n}){return(0,U.jsxs)(`code`,{className:`font-mono text-mono-sm break-all text-ink-2`,children:[(0,U.jsxs)(`span`,{className:`text-muted`,children:[e,`:`]}),t,n!==void 0&&`:${n}`]})}function ct({extras:e}){return e.kits.length===0&&e.primitives.length===0?null:(0,U.jsxs)(`section`,{"aria-labelledby":`inventory-kits`,className:`space-y-3`,children:[(0,U.jsx)(`h2`,{id:`inventory-kits`,className:`text-heading`,children:`Kits and primitives`}),(0,U.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[e.kits.map(e=>(0,U.jsx)(lt,{title:C(e.id),aside:`${e.project} · ${e.kind===`cva-folder`?`CVA folder`:`class kit ${e.prefix??``}`}`,children:e.members.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(`code`,{className:`font-mono text-mono-sm text-ink-2`,children:e.name}),Object.keys(e.variants).length>0&&(0,U.jsx)(`span`,{className:`text-caption text-muted`,children:Object.entries(e.variants).map(([e,t])=>`${e}: ${t.length}`).join(`, `)})]},e.name))},e.id)),e.primitives.map(e=>(0,U.jsx)(lt,{title:e.package,aside:`${e.project} · ${e.count} ${e.count===1?`site`:`sites`}`,children:e.exports.map(e=>(0,U.jsx)(`code`,{className:`font-mono text-mono-sm text-ink-2`,children:e},e))},`${e.project}:${e.package}`))]})]})}function lt({title:e,aside:t,children:n}){return(0,U.jsxs)(`div`,{className:`space-y-2 rounded-md border border-line p-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,U.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:e}),(0,U.jsx)(`span`,{className:`text-caption text-muted`,children:t})]}),(0,U.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:n})]})}export{qe as InventoryScreen,Je as InventoryView};
|
|
1
|
+
import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./createLucideIcon-CGDJWtKO.js";import{n as i,r as a}from"./CopyButton-DE8drl4P.js";import{t as o}from"./compass-BkKOZPYe.js";import{t as s}from"./layers-DfzdK_wG.js";import{t as c}from"./triangle-alert-Dkdi9eDR.js";import{t as l}from"./clsx-DB0hHKMi.js";import{I as u,S as d,V as f,dt as p,ht as m,i as h,m as g,n as _,o as v,pt as y,s as b,z as x}from"./main-cvOFSjox.js";import{a as S,i as C,n as w}from"./inventory-BI8QBdar.js";import{useParts as T}from"./inventory-source-lZYzcA8O.js";import{t as E}from"./Badge-CUJUit4d.js";import{i as D,n as O,r as k,t as ee}from"./Tabs-DU-fFRDV.js";import{t as te}from"./CodeBlock-CsiGFgvI.js";import{t as A}from"./Segmented-Dzi1x49S.js";import{n as ne}from"./format-DxAYNTN_.js";import{t as re}from"./SearchField-hF-6-YDM.js";import{i as ie,n as ae,t as oe}from"./discover-va2KFuK_.js";import{A as se,C as ce,D as le,E as ue,M as de,N as fe,O as pe,P as me,S as he,T as j,_ as M,a as N,b as ge,d as P,f as _e,g as ve,h as ye,j as be,k as F,m as xe,n as I,o as Se,p as L,r as R,s as Ce,v as we,w as Te,x as Ee,y as De}from"./Specimens-D_9hjlJH.js";import{n as z,t as B}from"./family-tiles-qaK1-_c8.js";import{t as Oe}from"./Disclosure-B1kTgPgk.js";var V={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};V.node;var ke=r(V),H=e(t(),1),U=n();function Ae(e){let t=m(),[n,r]=y();return[(0,H.useMemo)(()=>pe(t,e),[t,e]),(0,H.useCallback)(e=>r(`${n}${j(e)}`,{replace:!0}),[n,r])]}var W=`__all`,G=`max-md:h-11`;function je({label:e,count:t}){return(0,U.jsxs)(U.Fragment,{children:[e,(0,U.jsx)(`span`,{className:`tabular text-caption text-faint`,title:t===null?`Counting once its looks load`:void 0,children:t===null?`…`:t})]})}function K({label:e,value:t,all:n,options:r,onChange:i}){return(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3 max-md:flex-col max-md:gap-1.5`,children:[(0,U.jsx)(`span`,{className:`w-16 shrink-0 pt-1 text-small text-muted md:text-right`,children:e}),(0,U.jsx)(A,{label:e,wrap:!0,touch:!0,value:t??W,onChange:e=>i(e===W?null:e),options:[{value:W,label:(0,U.jsx)(je,{label:`All`,count:n})},...r.map(e=>({value:e.value,label:(0,U.jsx)(je,{label:e.label,count:e.count})}))]})]})}function Me({filters:e,onChange:t,counts:n}){return(0,U.jsxs)(`div`,{className:`space-y-2.5`,"data-testid":`filter-controls`,children:[(0,U.jsx)(K,{label:`Type`,value:e.type,all:n.all.type,options:n.types,onChange:n=>t({...e,type:n})}),(0,U.jsx)(K,{label:`Library`,value:e.lib,all:n.all.lib,options:n.libs,onChange:n=>t({...e,lib:n})}),(0,U.jsx)(K,{label:`Project`,value:e.project,all:n.all.project,options:n.projects,onChange:n=>t({...e,project:n})})]})}function Ne({filters:e,onChange:t,counts:n}){return(0,U.jsxs)(b,{"aria-pressed":e.near,onClick:()=>t({...e,near:!e.near}),className:l(`inv-press`,G,e.near&&`border-warning text-warning`),children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:l(`grid size-3.5 place-items-center rounded-xs border`,e.near?`border-warning bg-warning text-on-accent`:`border-line-strong`),children:e.near&&(0,U.jsx)(a,{className:`size-2.5!`})}),`Near-duplicates only`,(0,U.jsx)(`span`,{className:`tabular text-caption text-faint`,children:n.near===null?`…`:n.near})]})}function Pe({filters:e,onChange:t}){return(0,U.jsx)(re,{value:e.q,onChange:n=>t({...e,q:n}),label:`Search by name or file`,placeholder:`Search by name or file`,touch:!0,className:`w-full md:w-72`})}function Fe({shown:e,total:t,filters:n,onChange:r}){return(0,U.jsxs)(`p`,{className:`flex items-center gap-2 text-small text-muted`,"aria-live":`polite`,children:[(0,U.jsx)(`span`,{className:`tabular`,children:e===null?`Counting ${t} families…`:`${e} of ${t} ${t===1?`family`:`families`}`}),M(n)>0&&(0,U.jsx)(`button`,{type:`button`,className:`inv-link inv-press text-accent max-md:min-h-11`,onClick:()=>r(ve),children:`Clear filters`})]})}function Ie({filters:e,onChange:t,counts:n,shown:r,total:i}){let[a,o]=(0,H.useState)(!1),s=M(e);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`section`,{"aria-label":`Filters`,className:`space-y-3 rounded-lg border border-line bg-surface p-4 max-md:hidden`,"data-testid":`filter-bar`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,U.jsx)(Pe,{filters:e,onChange:t}),(0,U.jsx)(Ne,{filters:e,onChange:t,counts:n}),(0,U.jsx)(`div`,{className:`ml-auto`,children:(0,U.jsx)(Fe,{shown:r,total:i,filters:e,onChange:t})})]}),(0,U.jsx)(Me,{filters:e,onChange:t,counts:n})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 md:hidden`,"data-testid":`filter-phone`,children:[(0,U.jsxs)(b,{onClick:()=>o(!0),className:l(`inv-press`,G),children:[(0,U.jsx)(ke,{}),` Filters`,s>0&&(0,U.jsx)(`span`,{className:`tabular text-caption text-accent`,children:s})]}),(0,U.jsx)(Fe,{shown:r,total:i,filters:e,onChange:t})]}),(0,U.jsx)(L,{open:a,onOpenChange:o,variant:`sheet`,title:`Filters`,description:`They combine, and stay in the page's address.`,testId:`filter-sheet`,footer:(0,U.jsx)(b,{variant:`primary`,className:l(`inv-press w-full`,G),onClick:()=>o(!1),children:r===null?`Show families`:`Show ${r} ${r===1?`family`:`families`}`}),children:(0,U.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[(0,U.jsx)(Pe,{filters:e,onChange:t}),(0,U.jsx)(Ne,{filters:e,onChange:t,counts:n}),(0,U.jsx)(Me,{filters:e,onChange:t,counts:n})]})})]})}var q=(e,t)=>`${e.project} · ${t.primary(e.kit).label}`,J=(e,t)=>`${e.id}:${t.project}:${t.kit??`plain`}`;function Y({view:e,chunks:t,source:n,scheme:r},i,a){let o=B(e.family,t,n,r,(e,t)=>e===i.project&&t===i.kit);return z(o,e.family,`${a}:${J(e.family,i)}`)}var X=e=>`compare-${e}`,Z=e=>`fix-${e}`,Q=5;function Le(e){let{view:t,libraries:n}=e,r=ge(t.family),[i,a]=(0,H.useState)(`overlay`),[o,s]=(0,H.useState)(50),c=(0,H.useRef)(null),u=(0,H.useRef)(null);if(!r)return null;let[d,f]=r,p=t.family.sides.length-2,m=Y(e,d,`compare-a`),h=Y(e,f,`compare-b`),g=we({shape:F(d,t.looks,t.family.shape),uses:d.looks,projects:[d.project]},{shape:F(f,t.looks,t.family.shape),uses:f.looks,projects:[f.project]}),_=e=>{let t=c.current?.getBoundingClientRect();t&&s(se(e,t.left,t.width))},v=e=>{(e.pointerType!==`mouse`||e.button===0)&&(e.currentTarget.setPointerCapture?.(e.pointerId),u.current=e.pointerId,_(e.clientX))},y=e=>{u.current===e.pointerId&&_(e.clientX)},b=e=>{u.current===e.pointerId&&(u.current=null)};return(0,U.jsxs)(`article`,{id:X(t.family.id),"aria-labelledby":`${X(t.family.id)}-title`,className:`min-w-0 scroll-mt-4 space-y-3 rounded-lg border border-line bg-surface p-4`,"data-compare":t.family.id,children:[(0,U.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,U.jsx)(`h3`,{id:`${X(t.family.id)}-title`,className:`text-heading text-ink`,children:t.name}),(0,U.jsxs)(E,{tone:`warning`,children:[`Built `,t.family.sides.length,` ways`]}),(0,U.jsx)(A,{className:`ml-auto`,label:`Compare as`,touch:!0,value:i,onChange:a,options:[{value:`overlay`,label:`Overlay`},{value:`side`,label:`Side by side`},{value:`states`,label:`States`}]})]}),i===`overlay`?(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsxs)(`div`,{className:`mx-auto flex max-w-80 justify-between gap-3 text-caption text-muted`,children:[(0,U.jsxs)(`span`,{className:`truncate`,children:[`← `,q(d,n)]}),(0,U.jsxs)(`span`,{className:`truncate`,children:[q(f,n),` →`]})]}),(0,U.jsxs)(`div`,{ref:c,className:`relative mx-auto max-w-80 touch-none select-none overflow-hidden rounded-md`,style:{height:136},onPointerDown:v,onPointerMove:y,onPointerUp:b,onPointerCancel:b,"data-testid":`compare-stage`,children:[(0,U.jsx)(`div`,{className:`absolute inset-0`,"data-layer":`bottom`,children:(0,U.jsx)(I,{tiles:m,scheme:e.scheme,size:`large`,as:`div`,caption:!1})}),(0,U.jsx)(`div`,{className:`absolute inset-0`,"data-layer":`top`,style:{clipPath:De(o)},children:(0,U.jsx)(I,{tiles:h,scheme:e.scheme,size:`large`,as:`div`,caption:!1})}),(0,U.jsxs)(`div`,{role:`slider`,tabIndex:0,"aria-label":`Wipe between ${q(d,n)} and ${q(f,n)}`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,"aria-valuetext":`${Math.round(o)}% from the left`,onKeyDown:e=>{let t={ArrowLeft:o-Q,ArrowDown:o-Q,ArrowRight:o+Q,ArrowUp:o+Q,PageDown:o-50,PageUp:o+50,Home:0,End:100}[e.key];t!==void 0&&(e.preventDefault(),s(Math.min(100,Math.max(0,t))))},className:`absolute inset-y-0 w-6 -translate-x-1/2 cursor-ew-resize rounded-md outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus focus-visible:outline-solid focus-visible:[&>span]:bg-focus max-md:w-11`,style:{left:`${o}%`},children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-y-0 left-1/2 w-0.5 -translate-x-1/2 bg-accent`}),(0,U.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-1/2 left-1/2 size-4 -translate-1/2 rounded-full border-2 border-surface bg-accent shadow-raise`})]})]})]}):i===`states`?(0,U.jsx)(`div`,{className:`space-y-3`,"data-testid":`compare-states`,children:[{side:d,tiles:m},{side:f,tiles:h}].map(({side:r,tiles:i})=>(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,U.jsx)(`p`,{className:`truncate text-caption text-muted`,children:q(r,n)}),(0,U.jsx)(N,{tile:i[0],scheme:e.scheme,label:q(r,n)})]},J(t.family,r)))}):(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,"data-testid":`compare-side-by-side`,children:[{side:d,tiles:m},{side:f,tiles:h}].map(({side:r,tiles:i})=>(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,U.jsx)(`p`,{className:`truncate text-caption text-muted`,children:q(r,n)}),(0,U.jsx)(I,{tiles:i,scheme:e.scheme,size:`large`,as:`div`,caption:!1})]},J(t.family,r)))}),(0,U.jsxs)(`table`,{className:`w-full border-collapse text-left text-small`,"aria-label":`Attributes`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{className:`border-b border-line text-muted`,children:[(0,U.jsx)(`th`,{scope:`col`,className:`h-8 pr-3 font-medium`,children:`Attribute`}),(0,U.jsx)(`th`,{scope:`col`,className:`h-8 pr-3 font-medium`,children:q(d,n)}),(0,U.jsx)(`th`,{scope:`col`,className:`h-8 font-medium`,children:q(f,n)})]})}),(0,U.jsx)(`tbody`,{children:g.map(e=>(0,U.jsxs)(`tr`,{"data-differs":e.differs||void 0,className:l(`border-b border-line last:border-0`,e.differs&&`bg-warning-soft`),children:[(0,U.jsxs)(`th`,{scope:`row`,className:l(`py-1.5 pr-3 font-normal`,e.differs?`text-warning`:`text-muted`),children:[e.label,e.differs&&(0,U.jsx)(`span`,{className:`sr-only`,children:` (differs)`})]}),(0,U.jsx)(`td`,{className:`tabular py-1.5 pr-3 text-ink`,children:e.a}),(0,U.jsx)(`td`,{className:`tabular py-1.5 text-ink`,children:e.b})]},e.label))})]}),p>0&&(0,U.jsxs)(`p`,{className:`text-caption text-muted`,children:[p,` more `,p===1?`way to build it is`:`ways to build it are`,` in its fix below.`]})]})}function Re(e){let t=e.looks.length>0?e.looks.map(e=>`${e.project}:${e.file}`):e.family.sides.flatMap(e=>e.examples.map(e=>`${e.project}:${e.file}`));return[...new Set(t)].sort()}function ze(e){let{view:t,libraries:n}=e,r=Re(t),i=`${Z(t.family.id)}-reason`;return(0,U.jsxs)(`li`,{id:Z(t.family.id),className:`min-w-0 scroll-mt-4 space-y-3 rounded-lg border border-line bg-surface p-4`,"data-fix":t.family.id,children:[(0,U.jsxs)(`header`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,U.jsx)(`h3`,{className:`text-heading text-ink`,children:t.name}),(0,U.jsxs)(`span`,{className:`tabular text-small text-muted`,children:[t.uses,` `,t.uses===1?`use`:`uses`,` · built `,t.family.sides.length,` ways in `,t.projects,` `,t.projects===1?`project`:`projects`]})]}),(0,U.jsx)(`ul`,{className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2 max-md:grid-cols-2`,"aria-label":`Ways it is built`,children:t.family.sides.map(r=>(0,U.jsxs)(`li`,{className:`min-w-0 space-y-1`,children:[(0,U.jsx)(I,{tiles:Y(e,r,`fix`),scheme:e.scheme,as:`div`,caption:!1}),(0,U.jsxs)(`p`,{className:`truncate text-caption text-muted`,title:q(r,n),children:[(0,U.jsx)(`span`,{className:`font-medium text-ink-2`,children:r.project}),` · `,n.primary(r.kit).label,` · `,r.looks,` `,r.looks===1?`use`:`uses`]})]},J(t.family,r)))}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(`p`,{className:`text-small text-muted`,children:[r.length,` `,r.length===1?`file`:`files`,` to change`]}),(0,U.jsx)(`ul`,{className:`space-y-0.5`,children:r.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)(`code`,{className:`font-mono text-mono-sm break-all text-ink-2`,children:e})},e))})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,U.jsx)(b,{disabled:!0,"aria-describedby":i,className:G,children:`Merge into one`}),(0,U.jsx)(`span`,{id:i,className:`text-small text-muted`,children:`Not available yet: the hub reads your projects and never changes them.`})]})]})}var Be=e=>`/discover${ie({...oe,family:e.id,role:ae(e.role)})}`,$=12;function Ve({view:e,source:t,scheme:n,onClose:r}){let i=xe(),a=(0,H.useRef)(null);e&&(a.current=e);let o=e??a.current;return(0,U.jsx)(L,{open:e!==null,onOpenChange:e=>!e&&r(),variant:i?`drawer`:`sheet`,testId:`family-drawer`,title:o?He(o):``,description:o?.name,children:(0,U.jsx)(R.Provider,{value:null,children:o&&(0,U.jsx)(Ue,{view:o,source:t,scheme:n})})})}function He(e){let t=`${e.stories} ${e.stories===1?`story`:`stories`}`;return e.authored?`Only in Storybook: ${t}`:`${e.uses} ${e.uses===1?`use`:`uses`} across ${e.projects} ${e.projects===1?`project`:`projects`}${e.stories>0?` · ${t}`:``}`}function Ue({view:e,source:t,scheme:n}){let r=t.index.roles.find(t=>t.role===e.family.role),i=(0,H.useMemo)(()=>e.family.projects.flatMap(e=>r?.chunks[e]?[r.chunks[e]]:[]),[e.family.projects,r]),a=T(t,i,!0),s=a.every(e=>e.status===`ready`),c=a.find(e=>e.status===`error`),l=s?a.map(e=>e.value):[],u=l.flatMap(t=>t.looks.filter(t=>t.family===e.family.id).map(e=>({...e,project:t.project}))),d=fe({family:e.family,looks:u}),f=be({looks:u}),m=s?B(e.family,l,t,n):[],h=m.filter(e=>e.specimen!==null);return c?.status===`error`?(0,U.jsx)(`p`,{className:`px-5 py-4 text-small text-danger`,children:c.message}):(0,U.jsxs)(ee,{defaultValue:`usage`,className:`flex min-h-0 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-5 pb-2`,children:[(0,U.jsx)(b,{size:`sm`,asChild:!0,className:`max-md:h-11`,children:(0,U.jsxs)(p,{href:Be(e.family),"data-find-alternatives":e.family.id,children:[(0,U.jsx)(o,{}),` Find alternatives`]})}),(0,U.jsx)(`span`,{className:`text-caption text-muted`,children:`Outside candidates, compared beside this one.`})]}),(0,U.jsxs)(k,{className:`px-5 max-md:h-12`,children:[(0,U.jsx)(D,{value:`usage`,count:s?d.length:void 0,children:`Usage`}),(0,U.jsx)(D,{value:`variants`,count:s?m.length:void 0,children:`Variants`}),(0,U.jsx)(D,{value:`code`,children:`Code`})]}),s?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(O,{value:`usage`,className:`space-y-4 px-5 py-4 outline-none`,children:[d.length===0&&(0,U.jsx)(`p`,{className:`text-small text-muted`,children:`No project renders this shape: only its Storybook stories do. Its stories are below, and drawn in Variants.`}),(0,U.jsx)(`ul`,{className:`divide-y divide-line`,"aria-label":`Every use`,children:d.map(e=>(0,U.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5 py-2 text-small`,"data-use":!0,children:[(0,U.jsx)(`span`,{className:`font-medium text-ink`,children:e.project}),(0,U.jsx)(`code`,{className:`font-mono text-mono-sm break-all text-ink-2`,children:e.place}),(0,U.jsx)(`span`,{className:`text-caption text-muted`,children:e.routes.length>0?e.routes.join(` `):`no route found`})]},e.key))}),f.length>0&&(0,U.jsxs)(`section`,{"aria-labelledby":`family-stories`,className:`space-y-1`,children:[(0,U.jsxs)(`h3`,{id:`family-stories`,className:`text-small font-medium text-ink`,children:[`Stories `,(0,U.jsx)(`span`,{className:`tabular font-normal text-muted`,children:f.length})]}),(0,U.jsx)(`p`,{className:`text-caption text-muted`,children:`Authored states from Storybook, drawn with this project's code and CSS. They are not uses, so the counts above leave them out.`}),(0,U.jsx)(`ul`,{className:`divide-y divide-line`,"aria-label":`Storybook stories`,children:f.map(e=>(0,U.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5 py-2 text-small`,"data-story-row":!0,children:[(0,U.jsx)(`span`,{className:`font-medium text-ink`,children:e.story}),(0,U.jsx)(`code`,{className:`font-mono text-mono-sm break-all text-ink-2`,children:e.place})]},e.key))})]})]}),(0,U.jsx)(O,{value:`variants`,className:`px-5 py-4 outline-none`,children:(0,U.jsx)(We,{tiles:m,scheme:n})}),(0,U.jsx)(O,{value:`code`,className:`space-y-3 px-5 py-4 outline-none`,children:h.length===0?(0,U.jsx)(`p`,{className:`text-small text-muted`,children:`No specimen was built for this family, so there is no HTML to show: its looks draw their measured shape.`}):(0,U.jsxs)(U.Fragment,{children:[h.slice(0,$).map(e=>(0,U.jsx)(te,{title:e.story?`${P(e.story)} · ${e.place}`:`${e.project} · ${e.place}`,code:e.specimen.html,maxHeight:`sm`,touch:!0},e.key)),h.length>$&&(0,U.jsxs)(`p`,{className:`text-small text-muted`,children:[h.length-$,` more in Variants.`]})]})})]}):(0,U.jsx)(`p`,{"aria-busy":`true`,className:`px-5 py-4 text-small text-faint`,children:`Loading its uses…`})]})}function We({tiles:e,scheme:t}){let[n,r]=(0,H.useState)(`looks`),i=e.filter(e=>e.specimen!==null&&e.css!==null);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,U.jsx)(`p`,{className:`min-w-0 flex-1 text-small text-muted`,children:n===`looks`?`Each distinct way it is drawn, per project; looks drawn the same share a tile. Storybook stories follow, each labeled.`:`Each drawn look default, hover, focus, pressed and disabled, from its project's own CSS.`}),(0,U.jsx)(A,{label:`Show`,touch:!0,value:n,onChange:r,options:[{value:`looks`,label:`Looks`},{value:`states`,label:`States`,count:i.length}]})]}),n===`looks`?(0,U.jsx)(Ce,{tiles:e,scheme:t,tryIt:!0}):i.length===0?(0,U.jsx)(`p`,{className:`text-small text-muted`,children:`No look of this family was drawn from its project's code and CSS, so there are no states to show.`}):(0,U.jsx)(`ul`,{className:`space-y-4`,"aria-label":`States of each look`,children:i.map(e=>(0,U.jsxs)(`li`,{className:`min-w-0 space-y-1`,children:[e.story?(0,U.jsx)(Se,{story:e.story,place:e.place}):(0,U.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-1.5 text-caption text-muted`,children:[(0,U.jsx)(`span`,{className:`shrink-0 font-medium text-ink-2`,children:e.project}),e.count>1&&(0,U.jsxs)(`span`,{className:`shrink-0 tabular`,children:[`×`,e.count]}),(0,U.jsx)(`span`,{className:`truncate font-mono`,title:e.place,children:e.place})]}),(0,U.jsx)(N,{tile:e,scheme:t,label:e.story?`${e.project} ${P(e.story)}`:`${e.project} ${e.place}`})]},e.key))})]})}var Ge=232,Ke=4;function qe(){let e=f(),t=x();return e.status===`ready`?(0,U.jsx)(Je,{inventory:e.value,detect:t.status===`ready`?t.value:null}):(0,U.jsx)(h,{state:e,onRetry:u,what:`the inventory`})}function Je({inventory:e,detect:t=null}){let n=e?.index;return!e||!n||n.summary.looks===0?(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(_,{title:`Inventory`,count:0}),(0,U.jsx)(v,{icon:d,title:n?`No elements found`:`No inventory yet`,children:n?`The inventoried projects render no buttons, inputs, cards, badges, dialogs or tabs this scanner recognises.`:`Run youiyoux inventory --project <dir> (once per project), then open the hub with youiyoux ui --inventory .youi/inventory.json.`})]}):(0,U.jsx)(Ye,{source:e,detect:t})}function Ye({source:e,detect:t}){let n=e.index,{scheme:r}=g(),[i,a]=(0,H.useState)(null),[o,s]=Ae(n),c=(0,H.useRef)(!0),l=(0,H.useRef)(j(o));j(o)!==l.current&&(c.current=!1);let u=(0,H.useCallback)(e=>{c.current=!1,s(e)},[s]),d=Xe(),f=(0,H.useMemo)(()=>le(n,o),[n,o]),p=T(e,f,!1);Qe(e,f,d);let[m]=T(e,[n.extras],d),h=m?.status===`ready`?m.value:null,v=(0,H.useMemo)(()=>new ye(h,t),[h,t]),y=p.map(e=>e.status).join(`|`),b=(0,H.useMemo)(()=>p.flatMap(e=>e.status===`ready`?[e.value]:[]),[y,f]),x=(0,H.useMemo)(()=>h?he(b,v):[],[b,v,h]),S=h!==null&&p.every(e=>e.status===`ready`),C=ce(n,x,o,t=>h!==null&&e.get(t).status===`ready`,v),w=(0,H.useMemo)(()=>Te(x,o),[x,o]),D=w.filter(e=>e.family.nearDuplicate),[O,k]=(0,H.useState)(null),ee=O?x.find(e=>e.family.id===O)??null:null;return(0,U.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-screen":`inventory`,children:[(0,U.jsxs)(_,{title:`Inventory`,count:n.summary.families,children:[(0,U.jsxs)(E,{tone:`outline`,children:[n.projects.length,` `,n.projects.length===1?`project`:`projects`]}),n.summary.nearDuplicates>0&&(0,U.jsxs)(E,{tone:`warning`,children:[n.summary.nearDuplicates,` `,n.summary.nearDuplicates===1?`near-duplicate`:`near-duplicates`]})]}),(0,U.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-y-auto`,children:(0,U.jsx)(R.Provider,{value:i,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-8 px-6 py-6 max-sm:space-y-6 max-sm:px-4`,children:[(0,U.jsx)(Ie,{filters:o,onChange:u,counts:C,shown:S?w.length:null,total:n.summary.families}),(0,U.jsx)(et,{index:n,views:w,ready:S,filtered:M(o)>0}),(0,U.jsxs)(`section`,{"aria-labelledby":`inventory-wall`,className:`space-y-6`,children:[(0,U.jsx)(`h2`,{id:`inventory-wall`,className:`sr-only`,children:`Specimen wall`}),(0,U.jsx)(rt,{index:n,filters:o,scope:f,views:w,chunks:b,source:e,scheme:r,libraries:v,extras:h!==null,ready:S,stagger:c.current,onOpen:k})]}),S&&D.length>0&&(0,U.jsxs)(`section`,{"aria-labelledby":`inventory-compare`,className:`space-y-3`,children:[(0,U.jsx)($e,{id:`inventory-compare`,title:`Near-duplicates, compared`,count:D.length,children:`The same look built more than once: drag across a pair to see where they part.`}),(0,U.jsx)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:D.map(t=>(0,U.jsx)(Le,{view:t,chunks:b,source:e,scheme:r,libraries:v},t.family.id))})]}),S&&D.length>0&&(0,U.jsxs)(`section`,{"aria-labelledby":`inventory-fixes`,className:`space-y-3`,children:[(0,U.jsx)($e,{id:`inventory-fixes`,title:`Fix list`,count:D.length,children:`Each near-duplicate, every way it is built and the files that would change.`}),(0,U.jsx)(`ul`,{className:`space-y-4`,children:D.map(t=>(0,U.jsx)(ze,{view:t,chunks:b,source:e,scheme:r,libraries:v},t.family.id))})]}),h&&h.flags.length>0&&(0,U.jsx)(ot,{flags:h.flags}),h&&(0,U.jsx)(ct,{extras:h}),(0,U.jsxs)(`p`,{className:`text-small text-muted`,children:[n.summary.notClustered,` breakpoint and state classes recorded, not clustered: a family is decided by the resting shape.`,n.summary.unshaped>0&&` ${n.summary.unshaped} ${n.summary.unshaped===1?`look has`:`looks have`} no resolved shape and ${n.summary.unshaped===1?`is`:`are`} not grouped.`]})]})})}),(0,U.jsx)(Ve,{view:ee,source:e,scheme:r,onClose:()=>k(null)})]})}function Xe(){let[e,t]=(0,H.useState)(!1);return(0,H.useEffect)(()=>{if(typeof requestAnimationFrame!=`function`){let e=setTimeout(()=>t(!0),0);return()=>clearTimeout(e)}let e=0,n=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>t(!0))});return()=>{cancelAnimationFrame(n),cancelAnimationFrame(e)}},[]),e}var Ze=2e3;function Qe(e,t,n){let r=t.join(`\0`);(0,H.useEffect)(()=>{if(!n)return;let t=r.split(`\0`).filter(Boolean),i=()=>{},a=!1,o=e=>{if(typeof requestIdleCallback==`function`){let t=requestIdleCallback(e,{timeout:Ze});i=()=>cancelIdleCallback(t)}else{let t=setTimeout(e,0);i=()=>clearTimeout(t)}},s=n=>{if(!t.some(t=>e.get(t).status===`loading`))return n();let r=e.subscribe(()=>{t.some(t=>e.get(t).status===`loading`)||(r(),a||n())});i=r},c=()=>{let n=t.find(t=>e.get(t).status===`idle`);n&&!a&&o(()=>{a||(e.load(n),s(c))})};return s(c),()=>{a=!0,i()}},[e,r,n])}function $e({id:e,title:t,count:n,children:r}){return(0,U.jsxs)(`header`,{className:`space-y-0.5`,children:[(0,U.jsxs)(`h2`,{id:e,className:`flex items-baseline gap-2 text-heading`,children:[t,` `,(0,U.jsx)(`span`,{className:`tabular text-small font-normal text-muted`,children:n})]}),(0,U.jsx)(`p`,{className:`text-small text-muted`,children:r})]})}function et({index:e,views:t,ready:n,filtered:r}){let i=e.tolerance,a=t.filter(e=>!e.authored),o=n?a.length:r?null:e.summary.families,s=n?Ee(a,i):null,c=n?de(a):[],l=s?s.families-s.estimate:0;return(0,U.jsxs)(`section`,{"aria-labelledby":`inventory-headline`,className:`space-y-4`,"data-testid":`inventory-headline`,children:[(0,U.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-line bg-surface p-4`,children:[(0,U.jsxs)(`h2`,{id:`inventory-headline`,className:`text-display tabular text-ink`,"data-testid":`consolidation`,children:[o===null?`Counting families…`:`${o} ${o===1?`family`:`families`}`,(0,U.jsx)(`span`,{"aria-hidden":!0,className:`text-muted`,children:` → `}),(0,U.jsxs)(`span`,{className:`text-muted`,children:[`could be ~`,s?s.estimate:`…`]})]}),(0,U.jsx)(`div`,{"aria-hidden":!0,className:`flex h-2 overflow-hidden rounded-full bg-raised`,children:s&&s.families>0&&(0,U.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${s.estimate/s.families*100}%`}})}),(0,U.jsxs)(`p`,{className:`text-small text-muted`,children:[s?l>0?`${l} ${l===1?`family sits`:`families sit`} within one tolerance step of another of the same element, and ${nt(a)}.`:`No two families of the same element sit within one tolerance step; ${nt(a)}.`:`Looking at every family in view…`,e.projects.length>0&&` Across ${tt(e.projects.map(e=>e.id))}.`]})]}),c.length>0&&(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`h3`,{className:`text-heading`,children:[`Top `,c.length===1?`fix`:`${c.length} fixes`]}),(0,U.jsx)(`ol`,{className:`grid gap-3 md:grid-cols-3`,"data-testid":`top-fixes`,children:c.map((e,t)=>(0,U.jsxs)(`li`,{className:`space-y-1.5 rounded-lg border border-line bg-surface p-3`,children:[(0,U.jsxs)(`p`,{className:`flex items-baseline gap-2`,children:[(0,U.jsx)(`span`,{className:`tabular text-caption text-faint`,children:t+1}),(0,U.jsx)(`span`,{className:`font-medium text-ink`,children:e.name})]}),(0,U.jsxs)(`p`,{className:`tabular text-small text-muted`,children:[`Built `,e.family.sides.length,` ways · `,e.uses,` `,e.uses===1?`use`:`uses`,` · `,e.projects,` `,e.projects===1?`project`:`projects`]}),(0,U.jsxs)(`p`,{className:`flex gap-3 text-small`,children:[(0,U.jsx)(`a`,{href:`#${X(e.family.id)}`,className:`inv-link text-accent max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:`Compare`}),(0,U.jsx)(`a`,{href:`#${Z(e.family.id)}`,className:`inv-link text-accent max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:`Fix`})]})]},e.family.id))})]}),(0,U.jsx)(Oe,{className:`rounded-lg border border-line bg-surface px-4 py-3 text-small max-md:py-0`,summaryClassName:`justify-between font-medium text-ink max-md:min-h-11 max-md:py-3`,summary:`How grouping works`,children:(0,U.jsxs)(`div`,{className:`mt-2 space-y-2 text-ink-2 max-md:mt-0 max-md:pb-3`,children:[(0,U.jsx)(`p`,{children:`Every button, input, card, badge, dialog, tab and link-as-button is grouped into families by its resolved shape: height, padding, radius, font size and weight, from Tailwind classes and CSS rules with each project’s own theme. Colour is ignored.`}),(0,U.jsxs)(`p`,{children:[`A family’s looks are all within height ±`,i.height,`px, padding ±`,i.padding,`px, radius ±`,i.radius,`px, font size ±`,i.fontSize,`px and weight ±`,i.fontWeight,` of each other, so look-alikes never chain into one family.`]}),(0,U.jsx)(`p`,{children:`“Could be ~N” is an estimate, not a regrouping: a near-duplicate (one look built in more than one project or kit) counts once, and families of the same element whose usual shapes are within one tolerance step of each other on every dimension count as one.`}),(0,U.jsx)(`ul`,{className:`space-y-0.5 text-muted`,children:e.projects.map(e=>(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`span`,{className:`font-medium text-ink`,children:e.id}),` · `,e.files,` files`,e.commit?` @${ne(e.commit)}`:``,` · routes: `,e.routes,e.status===`partial`&&(0,U.jsxs)(`span`,{className:`text-warning`,children:[` · partial (`,e.failed,` not fully read)`]})]},e.id))})]})})]})}function tt(e){return e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`}function nt(e){let t=e.filter(e=>e.family.nearDuplicate).length;return t===0?`none is built more than once`:`${t} ${t===1?`is`:`are`} built more than once`}function rt(e){let{index:t,filters:n,views:r,ready:i}=e,a=t.roles.filter(e=>(!n.type||e.role===n.type)&&(!n.project||(e.cells[n.project]?.looks??0)>0)),o=M(n)>0,s=0,c=a.flatMap(t=>{let n=r.filter(e=>e.family.role===t.role);if(e.extras&&Object.values(t.chunks).every(t=>!e.scope.includes(t)||e.source.get(t).status===`ready`)&&n.length===0&&o)return[];let i=s;return s+=n.length,[{row:t,mine:n,start:i}]});return i&&c.length===0?(0,U.jsx)(v,{icon:d,title:`No families match`,children:`Try fewer filters, or clear them.`}):(0,U.jsx)(U.Fragment,{children:c.map(({row:t,mine:n,start:r})=>(0,U.jsx)(it,{...e,row:t,views:n,start:r},t.role))})}function it({row:e,views:t,start:n,filters:r,scope:i,extras:a,chunks:o,source:s,scheme:c,libraries:l,stagger:u,onOpen:d}){let f=(0,H.useRef)(null),p=_e(f,`800px`,`100000px`),m=(0,H.useMemo)(()=>Object.values(e.chunks).filter(e=>i.includes(e)),[e.chunks,i]),h=T(s,m,p),g=h.find(e=>e.status===`error`),_=a&&h.every(e=>e.status===`ready`),v=ue(t),y=r.project?e.cells[r.project]?.families??0:e.families,b=n;return(0,U.jsxs)(`section`,{ref:f,id:S(e.role),"aria-labelledby":`${S(e.role)}-title`,className:`scroll-mt-4 space-y-3`,"data-role":e.role,children:[(0,U.jsxs)(`header`,{className:`flex flex-wrap items-baseline gap-x-3 border-b border-line pb-2`,children:[(0,U.jsx)(`h2`,{id:`${S(e.role)}-title`,className:`text-heading`,children:w[e.role]}),(0,U.jsxs)(`span`,{className:`tabular text-small text-muted`,children:[_?`${t.length} ${t.length===1?`family`:`families`}`:`${y} ${y===1?`family`:`families`}`,` · `,e.looks,` `,e.looks===1?`look`:`looks`,e.unshaped>0&&` · ${e.unshaped} without a resolved shape`]})]}),g?.status===`error`?(0,U.jsx)(`p`,{className:`text-small text-danger`,children:g.message}):_?t.length===0?(0,U.jsx)(`p`,{className:`text-small text-muted`,children:`No look of this role has a resolved shape.`}):(0,U.jsx)(`div`,{className:`flex flex-wrap gap-4 max-md:flex-col`,children:v.map(e=>(0,U.jsxs)(`div`,{className:`min-w-0 space-y-2 md:flex-(--cell-flex)`,style:{"--cell-flex":`${e.families.length} 1 ${Math.min(e.families.length,3)*200}px`},"data-kit-cell":e.group.id,children:[(0,U.jsxs)(`p`,{className:`flex items-baseline gap-1.5 text-small`,children:[(0,U.jsx)(`span`,{className:`font-medium text-ink-2`,children:e.group.label}),(0,U.jsx)(`span`,{className:`tabular text-caption text-faint`,children:e.families.length})]}),(0,U.jsx)(`ul`,{className:`grid grid-cols-[repeat(auto-fill,minmax(200px,1fr))] gap-3 max-md:grid-cols-2 max-md:gap-2`,children:e.families.map(e=>(0,U.jsx)(at,{view:e,chunks:o,source:s,scheme:c,libraries:l,stagger:u?b++:null,onOpen:d},e.family.id))})]},e.group.id))}):y>0&&(0,U.jsxs)(`div`,{"aria-busy":`true`,className:`text-small text-faint`,style:{minHeight:Math.ceil(y/Ke)*Ge},children:[`Loading `,y,` `,y===1?`family`:`families`,`…`]})]})}function at({view:e,chunks:t,source:n,scheme:r,libraries:i,stagger:a,onOpen:o}){let s=z(B(e.family,t,n,r,(t,n)=>i.primary(n).id===e.primary.id),e.family,`wall:${e.family.id}`),c=()=>o(e.family.id);return(0,U.jsxs)(`li`,{className:l(`inv-tile inv-press flex min-w-0 cursor-pointer flex-col gap-2 rounded-lg border border-line bg-surface p-2`,a!==null&&`inv-enter`),style:a===null?void 0:{"--inv-i":a},"data-family":e.family.id,"data-stagger":a??void 0,onClick:e=>!e.target.closest(`button`)&&c(),children:[(0,U.jsx)(I,{tiles:s,scheme:r,size:`large`,as:`div`,caption:!1,tryIt:!0}),(0,U.jsxs)(`div`,{className:`min-w-0 space-y-0.5 px-1`,children:[(0,U.jsx)(`h3`,{className:`inv-tile-name text-small font-medium break-words text-ink`,children:e.name}),(0,U.jsx)(`p`,{className:`tabular text-caption text-muted`,"data-uses":``,children:me(e)})]}),(0,U.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-2 px-1 pb-1`,children:[e.family.nearDuplicate&&(0,U.jsx)(E,{tone:`warning`,children:`Near-duplicate`}),(0,U.jsx)(b,{size:`sm`,className:l(`inv-press ml-auto max-md:px-3`,G),onClick:c,"aria-label":`Open ${e.name}`,children:`Open`})]})]})}function ot({flags:e}){return(0,U.jsxs)(`section`,{"aria-labelledby":`inventory-flags`,className:`space-y-3`,children:[(0,U.jsxs)(`h2`,{id:`inventory-flags`,className:`flex items-center gap-2 text-heading`,children:[(0,U.jsx)(c,{"aria-hidden":!0,className:`size-4 text-warning`}),` Flags `,(0,U.jsx)(`span`,{className:`tabular text-small font-normal text-muted`,children:e.length})]}),(0,U.jsx)(`ul`,{className:`space-y-2`,children:e.map(e=>(0,U.jsx)(`li`,{className:`rounded-md border border-line p-3 text-small`,children:e.kind===`duplicate-definition`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`text-ink`,children:[(0,U.jsx)(i,{"aria-hidden":!0,className:`mr-1.5 inline size-3.5 text-muted`}),(0,U.jsx)(`code`,{className:`font-mono text-mono-sm`,children:e.name}),` is defined `,e.locations.length,` times`]}),(0,U.jsx)(`ul`,{className:`mt-1.5 space-y-0.5`,children:e.locations.map(e=>(0,U.jsxs)(`li`,{className:`text-muted`,children:[(0,U.jsx)(st,{project:e.project,file:e.file,line:e.line}),` · `,C(e.kit)]},`${e.project}:${e.file}`))})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`text-ink`,children:[(0,U.jsx)(s,{"aria-hidden":!0,className:`mr-1.5 inline size-3.5 text-muted`}),(0,U.jsx)(st,{project:e.project,file:e.file}),` imports `,new Set(e.imports.map(e=>e.kit)).size,` kits’ `,e.role,` in `,e.imports.length,` `,e.imports.length===1?`import`:`imports`]}),(0,U.jsx)(`ul`,{className:`mt-1.5 space-y-0.5`,children:e.imports.map(e=>(0,U.jsxs)(`li`,{className:`text-muted`,children:[(0,U.jsx)(`code`,{className:`font-mono text-mono-sm text-ink-2`,children:e.name}),` from `,C(e.kit),` · line `,e.line]},`${e.specifier}:${e.line}:${e.kit}`))})]})},e.kind===`duplicate-definition`?`d:${e.name}`:`m:${e.project}:${e.file}:${e.role}`))})]})}function st({project:e,file:t,line:n}){return(0,U.jsxs)(`code`,{className:`font-mono text-mono-sm break-all text-ink-2`,children:[(0,U.jsxs)(`span`,{className:`text-muted`,children:[e,`:`]}),t,n!==void 0&&`:${n}`]})}function ct({extras:e}){return e.kits.length===0&&e.primitives.length===0?null:(0,U.jsxs)(`section`,{"aria-labelledby":`inventory-kits`,className:`space-y-3`,children:[(0,U.jsx)(`h2`,{id:`inventory-kits`,className:`text-heading`,children:`Kits and primitives`}),(0,U.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[e.kits.map(e=>(0,U.jsx)(lt,{title:C(e.id),aside:`${e.project} · ${e.kind===`cva-folder`?`CVA folder`:`class kit ${e.prefix??``}`}`,children:e.members.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(`code`,{className:`font-mono text-mono-sm text-ink-2`,children:e.name}),Object.keys(e.variants).length>0&&(0,U.jsx)(`span`,{className:`text-caption text-muted`,children:Object.entries(e.variants).map(([e,t])=>`${e}: ${t.length}`).join(`, `)})]},e.name))},e.id)),e.primitives.map(e=>(0,U.jsx)(lt,{title:e.package,aside:`${e.project} · ${e.count} ${e.count===1?`site`:`sites`}`,children:e.exports.map(e=>(0,U.jsx)(`code`,{className:`font-mono text-mono-sm text-ink-2`,children:e},e))},`${e.project}:${e.package}`))]})]})}function lt({title:e,aside:t,children:n}){return(0,U.jsxs)(`div`,{className:`space-y-2 rounded-md border border-line p-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,U.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:e}),(0,U.jsx)(`span`,{className:`text-caption text-muted`,children:t})]}),(0,U.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:n})]})}export{qe as InventoryScreen,Je as InventoryView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./arrow-right-DcbNDzqs.js";import{t as n}from"./bot-B3gC9oUR.js";import{n as r,t as i}from"./library-W5R8GwvG.js";import{T as a,dt as o,n as s,s as c}from"./main-
|
|
1
|
+
import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./arrow-right-DcbNDzqs.js";import{t as n}from"./bot-B3gC9oUR.js";import{n as r,t as i}from"./library-W5R8GwvG.js";import{T as a,dt as o,n as s,s as c}from"./main-cvOFSjox.js";import{t as l}from"./Badge-CUJUit4d.js";var u=e(),d={library:{by:`Ingested`,body:`Pulled in from a source, categorized, with the System elements it could replace.`},candidate:{by:`Requested by a person or an agent`,body:`Proposed for the System, or as a swap for an element already in use.`},adopted:{by:`Approved by a person`,body:`In the System with a contract, tokens and rules. Products may build with it.`},"in-use":{by:`Read off the usage map`,body:`Used on at least one scanned screen; every site is listed under Where.`}},f=[{name:`library_search`,does:`Browse Library items and what each could swap in for`},{name:`library_request`,does:`Draft an adoption request for a person to approve`},{name:`system_*`,does:`Look up, check and plan with System elements: the only things agents build with`}];function p(){let e=Object.entries(d);return(0,u.jsxs)(`section`,{"aria-labelledby":`library-stages`,className:`space-y-3`,children:[(0,u.jsx)(`h2`,{id:`library-stages`,className:`text-heading`,children:`How an element moves into the System`}),(0,u.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[`library`,`system`].map(n=>(0,u.jsxs)(`div`,{className:`space-y-2`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line pb-1.5 text-small font-medium text-ink-2`,children:[n===`library`?(0,u.jsx)(i,{className:`size-3.5 text-muted`}):(0,u.jsx)(r,{className:`size-3.5 text-muted`}),n===`library`?`Library · browse and propose`:`System · build with`]}),(0,u.jsx)(`ol`,{className:`grid gap-2 sm:grid-cols-2`,children:e.slice(n===`library`?0:2,n===`library`?2:4).map(([e,n])=>(0,u.jsxs)(`li`,{className:`space-y-1.5 rounded-lg border border-line p-3`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,u.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:e}),e!==`in-use`&&(0,u.jsx)(t,{"aria-hidden":!0,className:`ml-auto size-3 text-muted`})]}),(0,u.jsx)(`p`,{className:`text-caption text-muted`,children:n.by}),(0,u.jsx)(`p`,{className:`text-small text-ink-2`,children:n.body})]},e))})]},n))})]})}function m(){return(0,u.jsxs)(`section`,{"aria-labelledby":`library-agents`,className:`space-y-3 rounded-lg border border-line bg-raised p-4`,children:[(0,u.jsxs)(`h2`,{id:`library-agents`,className:`flex items-center gap-2 text-heading`,children:[(0,u.jsx)(n,{className:`size-4 text-muted`}),` What agents may do here`]}),(0,u.jsx)(`p`,{className:`text-small text-ink-2`,children:`Agents browse the Library and draft requests; they never import, copy or restyle a Library item, and only a person adopts one into the System.`}),(0,u.jsx)(`dl`,{className:`grid gap-x-4 gap-y-1.5 sm:grid-cols-[auto_minmax(0,1fr)]`,children:f.map(e=>(0,u.jsxs)(`div`,{className:`contents`,children:[(0,u.jsx)(`dt`,{className:`font-mono text-mono-sm text-ink`,children:e.name}),(0,u.jsx)(`dd`,{className:`text-small text-muted max-sm:mb-1.5`,children:e.does})]},e.name))})]})}function h(){return(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,u.jsx)(s,{title:`Library`,count:0,children:(0,u.jsx)(l,{tone:`outline`,children:`Not built with`})}),(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,u.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 px-8 py-12 animate-enter max-sm:px-4 max-sm:py-8`,children:[(0,u.jsxs)(`div`,{className:`space-y-3`,children:[(0,u.jsx)(`span`,{className:`grid size-9 place-items-center rounded-lg border border-line bg-raised text-muted`,children:(0,u.jsx)(i,{className:`size-4`})}),(0,u.jsx)(`p`,{className:`max-w-xl text-reading text-ink-2`,children:`The Library holds what YouIyouX pulls in from outside: other design systems, UI kits and references. Browse it, sort it into categories, and propose an item as a new System element or a swap for one already in use. Nothing here ships in a product until a person adopts it into the System.`})]}),(0,u.jsxs)(`section`,{"aria-labelledby":`library-sources`,className:`flex items-start gap-3 rounded-lg border border-dashed border-line-strong p-4`,children:[(0,u.jsx)(a,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-muted`}),(0,u.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,u.jsx)(`h2`,{id:`library-sources`,className:`text-heading`,children:`No sources connected yet`}),(0,u.jsx)(`p`,{className:`text-small text-muted`,children:`Sources come later. Each one will add its elements here, categorized and linked to the System elements they could replace, with how widely each of those is used.`})]})]}),(0,u.jsx)(p,{}),(0,u.jsx)(m,{}),(0,u.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,u.jsx)(c,{asChild:!0,children:(0,u.jsx)(o,{href:`/elements`,children:`Browse System elements`})}),(0,u.jsx)(`span`,{className:`text-small text-muted`,children:`The System is what products and agents build with.`})]})]})})]})}export{h as LibraryScreen,d as STAGES};
|