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
|
@@ -188,14 +188,14 @@ import {
|
|
|
188
188
|
whyNoLines,
|
|
189
189
|
withFile,
|
|
190
190
|
withoutCredentials
|
|
191
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-PCLXMWZ2.js";
|
|
192
192
|
import {
|
|
193
193
|
escapingLinks,
|
|
194
194
|
relativeInside,
|
|
195
195
|
within
|
|
196
196
|
} from "./chunk-42YJX3W5.js";
|
|
197
|
-
import "./chunk-
|
|
198
|
-
import "./chunk-
|
|
197
|
+
import "./chunk-XOXF2ILO.js";
|
|
198
|
+
import "./chunk-NF4OJYKC.js";
|
|
199
199
|
import "./chunk-WNTS7ZO4.js";
|
|
200
200
|
export {
|
|
201
201
|
ARBITRARY,
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createRequire as __youiRequire } from "node:module"; import { dirname as __youiDir } from "node:path"; import { fileURLToPath as __youiPath } from "node:url"; const require = __youiRequire(import.meta.url); const __youiDirname = __youiDir(__youiPath(import.meta.url));
|
|
2
|
+
import {
|
|
3
|
+
INDEX_FILE,
|
|
4
|
+
Lock,
|
|
5
|
+
MIGRATIONS,
|
|
6
|
+
SCHEMA_VERSION,
|
|
7
|
+
SqlStore,
|
|
8
|
+
checkpointSqlite,
|
|
9
|
+
defaultIndexPath,
|
|
10
|
+
governedComponents,
|
|
11
|
+
indexHome,
|
|
12
|
+
inventoryRun,
|
|
13
|
+
nearDuplicatePairs,
|
|
14
|
+
nodeId,
|
|
15
|
+
numbered,
|
|
16
|
+
openPglite,
|
|
17
|
+
openPostgres,
|
|
18
|
+
openSqlite,
|
|
19
|
+
openStore,
|
|
20
|
+
pageInteger,
|
|
21
|
+
postgresAdapter,
|
|
22
|
+
projectGraph,
|
|
23
|
+
redactUrl,
|
|
24
|
+
searchTerms,
|
|
25
|
+
sqliteAdapter,
|
|
26
|
+
storeLocation
|
|
27
|
+
} from "./chunk-ZWVWENSB.js";
|
|
28
|
+
import "./chunk-NF4OJYKC.js";
|
|
29
|
+
import "./chunk-WNTS7ZO4.js";
|
|
30
|
+
export {
|
|
31
|
+
INDEX_FILE,
|
|
32
|
+
Lock,
|
|
33
|
+
MIGRATIONS,
|
|
34
|
+
SCHEMA_VERSION,
|
|
35
|
+
SqlStore,
|
|
36
|
+
checkpointSqlite,
|
|
37
|
+
defaultIndexPath,
|
|
38
|
+
governedComponents,
|
|
39
|
+
indexHome,
|
|
40
|
+
inventoryRun,
|
|
41
|
+
nearDuplicatePairs,
|
|
42
|
+
nodeId,
|
|
43
|
+
numbered,
|
|
44
|
+
openPglite,
|
|
45
|
+
openPostgres,
|
|
46
|
+
openSqlite,
|
|
47
|
+
openStore,
|
|
48
|
+
pageInteger,
|
|
49
|
+
postgresAdapter,
|
|
50
|
+
projectGraph,
|
|
51
|
+
redactUrl,
|
|
52
|
+
searchTerms,
|
|
53
|
+
sqliteAdapter,
|
|
54
|
+
storeLocation
|
|
55
|
+
};
|
|
@@ -117,8 +117,9 @@ import {
|
|
|
117
117
|
writeHttpCache,
|
|
118
118
|
writeJson,
|
|
119
119
|
writeSources
|
|
120
|
-
} from "./chunk-
|
|
121
|
-
import "./chunk-
|
|
120
|
+
} from "./chunk-ZOQW6LNH.js";
|
|
121
|
+
import "./chunk-ZWVWENSB.js";
|
|
122
|
+
import "./chunk-NF4OJYKC.js";
|
|
122
123
|
import "./chunk-WNTS7ZO4.js";
|
|
123
124
|
export {
|
|
124
125
|
ALL_INDEX_FILE,
|
|
@@ -2,7 +2,7 @@ import { createRequire as __youiRequire } from "node:module"; import { dirname a
|
|
|
2
2
|
import {
|
|
3
3
|
RequestStore,
|
|
4
4
|
requestBrief
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PWGZRP3C.js";
|
|
6
6
|
import {
|
|
7
7
|
PROJECT_FILE,
|
|
8
8
|
ScanCache,
|
|
@@ -30,13 +30,13 @@ import {
|
|
|
30
30
|
shotsText,
|
|
31
31
|
tokenRows,
|
|
32
32
|
whereUsed
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-PCLXMWZ2.js";
|
|
34
34
|
import "./chunk-42YJX3W5.js";
|
|
35
35
|
import {
|
|
36
36
|
SHADCN_SLOTS,
|
|
37
37
|
launchBrowser,
|
|
38
38
|
libraryOfPackage
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-5I2VHSEN.js";
|
|
40
40
|
import {
|
|
41
41
|
DISCOVER_RULE,
|
|
42
42
|
DiscoverConstraints,
|
|
@@ -50,10 +50,12 @@ import {
|
|
|
50
50
|
readNeed,
|
|
51
51
|
searchCatalog,
|
|
52
52
|
sharedStore,
|
|
53
|
-
showFromCatalog
|
|
53
|
+
showFromCatalog
|
|
54
|
+
} from "./chunk-ZOQW6LNH.js";
|
|
55
|
+
import {
|
|
54
56
|
storeLocation
|
|
55
|
-
} from "./chunk-
|
|
56
|
-
import "./chunk-
|
|
57
|
+
} from "./chunk-ZWVWENSB.js";
|
|
58
|
+
import "./chunk-XOXF2ILO.js";
|
|
57
59
|
import {
|
|
58
60
|
$ZodObject,
|
|
59
61
|
$ZodType,
|
|
@@ -93,7 +95,7 @@ import {
|
|
|
93
95
|
toJSONSchema,
|
|
94
96
|
union,
|
|
95
97
|
unknown
|
|
96
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-NF4OJYKC.js";
|
|
97
99
|
import {
|
|
98
100
|
__commonJS,
|
|
99
101
|
__toESM
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
COMPONENT_STATES,
|
|
10
10
|
CSS_SAFE_NAME,
|
|
11
11
|
CheckIdentity,
|
|
12
|
+
CiRecord,
|
|
12
13
|
ColorValue,
|
|
13
14
|
ComponentContract,
|
|
14
15
|
CubicBezierValue,
|
|
@@ -72,6 +73,7 @@ import {
|
|
|
72
73
|
MCP_TOOLS,
|
|
73
74
|
MigrationChange,
|
|
74
75
|
MigrationSpec,
|
|
76
|
+
OrgView,
|
|
75
77
|
OutputConfig,
|
|
76
78
|
PACKAGE_NAME,
|
|
77
79
|
PUBLISHED_SCHEMAS,
|
|
@@ -83,6 +85,7 @@ import {
|
|
|
83
85
|
PropValue,
|
|
84
86
|
REQUEST_ID,
|
|
85
87
|
REQUEST_STATUSES,
|
|
88
|
+
RepoName,
|
|
86
89
|
RequestAuthor,
|
|
87
90
|
RequestDoc,
|
|
88
91
|
RequestEntry,
|
|
@@ -159,7 +162,7 @@ import {
|
|
|
159
162
|
validateTokenSets,
|
|
160
163
|
walkGlob,
|
|
161
164
|
writeFileAtomic
|
|
162
|
-
} from "./chunk-
|
|
165
|
+
} from "./chunk-NF4OJYKC.js";
|
|
163
166
|
import "./chunk-WNTS7ZO4.js";
|
|
164
167
|
export {
|
|
165
168
|
AST_GREP_LANGUAGES,
|
|
@@ -171,6 +174,7 @@ export {
|
|
|
171
174
|
COMPONENT_STATES,
|
|
172
175
|
CSS_SAFE_NAME,
|
|
173
176
|
CheckIdentity,
|
|
177
|
+
CiRecord,
|
|
174
178
|
ColorValue,
|
|
175
179
|
ComponentContract,
|
|
176
180
|
CubicBezierValue,
|
|
@@ -234,6 +238,7 @@ export {
|
|
|
234
238
|
MCP_TOOLS,
|
|
235
239
|
MigrationChange,
|
|
236
240
|
MigrationSpec,
|
|
241
|
+
OrgView,
|
|
237
242
|
OutputConfig,
|
|
238
243
|
PACKAGE_NAME,
|
|
239
244
|
PUBLISHED_SCHEMAS,
|
|
@@ -245,6 +250,7 @@ export {
|
|
|
245
250
|
PropValue,
|
|
246
251
|
REQUEST_ID,
|
|
247
252
|
REQUEST_STATUSES,
|
|
253
|
+
RepoName,
|
|
248
254
|
RequestAuthor,
|
|
249
255
|
RequestDoc,
|
|
250
256
|
RequestEntry,
|
|
@@ -57,11 +57,11 @@ import {
|
|
|
57
57
|
validateContent,
|
|
58
58
|
validateLibraryContent,
|
|
59
59
|
validateStyleContent
|
|
60
|
-
} from "./chunk-
|
|
61
|
-
import "./chunk-
|
|
60
|
+
} from "./chunk-PWGZRP3C.js";
|
|
61
|
+
import "./chunk-PCLXMWZ2.js";
|
|
62
62
|
import "./chunk-42YJX3W5.js";
|
|
63
|
-
import "./chunk-
|
|
64
|
-
import "./chunk-
|
|
63
|
+
import "./chunk-XOXF2ILO.js";
|
|
64
|
+
import "./chunk-NF4OJYKC.js";
|
|
65
65
|
import "./chunk-WNTS7ZO4.js";
|
|
66
66
|
export {
|
|
67
67
|
DesignFiles,
|
|
@@ -56,8 +56,8 @@ import {
|
|
|
56
56
|
tokenVariables,
|
|
57
57
|
variableSuffixes,
|
|
58
58
|
youiTypeVariables
|
|
59
|
-
} from "./chunk-
|
|
60
|
-
import "./chunk-
|
|
59
|
+
} from "./chunk-XOXF2ILO.js";
|
|
60
|
+
import "./chunk-NF4OJYKC.js";
|
|
61
61
|
import "./chunk-WNTS7ZO4.js";
|
|
62
62
|
export {
|
|
63
63
|
AAA_TEXT,
|
|
@@ -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{t as i}from"./CopyButton-DE8drl4P.js";import{t as a}from"./circle-alert-DT2LC4yf.js";import{t as o}from"./circle-check-DkwBMT62.js";import{dt as s,s as c}from"./main-CfbpuT4Y.js";import{a as l,n as u}from"./workflow-DbBdiOmA.js";import{a as d}from"./Field-LwrJXoOs.js";import{o as f,s as p}from"./discover-CFhyKler.js";import{t as m}from"./LicenceBadge-CLCUMMHE.js";import{a as h,i as g,t as _}from"./Specimens-DuaE0WeO.js";import{n as v,t as y}from"./try-live-CX04d2L2.js";var b={name:`bookmark-plus`,size:24,node:[[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M15 10H9`,key:`o6yqo3`}],[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]};b.node;var x=r(b),S={name:`package-plus`,size:24,node:[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]};S.node;var C=r(S),w=e(t(),1),T=`__youi/discover-preview`,E=new Map,D=[];function O(e,t){let n=`${e}\0${t??``}`,r=E.get(n);return r||(D.push(e),r=k(e,t),E.set(n,r),r.then(e=>e.status===`error`&&E.delete(n))),r}async function k(e,t){let n=new URLSearchParams({id:e,...t?{project:t}:{}}),r;try{r=await fetch(`/${T}?${n}`,{cache:`no-store`})}catch{return{status:`error`,message:`Previews need the hub's own server (youiyoux ui or pnpm dev), which did not answer; the listing stands.`,offline:!0}}let i=await r.json().catch(()=>null);return r.ok&&i&&`id`in i?{status:`ready`,answer:i}:i&&typeof i.error==`string`?{status:`error`,message:i.error,offline:!1}:{status:`error`,message:`Previews need the hub's own server (youiyoux ui or pnpm dev); this host only serves files, so the listing stands.`,offline:!0}}var A=`script, iframe, frame, frameset, object, embed, link, meta, base, style, noscript, template, portal`,j=[`href`,`src`,`srcset`,`action`,`formaction`,`xlink:href`,`poster`,`background`,`ping`];function M(e){if(typeof document>`u`)return``;let t=document.createElement(`template`);t.innerHTML=e.slice(0,2e5);for(let e of t.content.querySelectorAll(A))e.remove();for(let e of t.content.querySelectorAll(`*`))for(let t of[...e.attributes]){let n=t.name.toLowerCase();if(n.startsWith(`on`))e.removeAttribute(t.name);else if(j.includes(n)){let r=t.value.trim();!(n===`href`&&r.startsWith(`#`))&&!/^data:image\/(?:png|gif|jpeg|webp);/i.test(r)&&e.setAttribute(t.name,n===`href`?`#`:``)}else n===`style`&&/url\s*\(|expression\s*\(|@import/i.test(t.value)&&e.removeAttribute(t.name)}return t.innerHTML}var N=new Map,P=new Set;function F(e,t){let n=M(t);n.trim()&&N.get(e)!==n&&(N.set(e,n),P.forEach(e=>e()))}function I(e){return(0,w.useSyncExternalStore)(e=>(P.add(e),()=>P.delete(e)),()=>e?N.get(e)??null:null,()=>null)}var L=n(),R=15e3,z={height:null,paddingX:null,paddingY:null,radius:null,fontSize:null,fontWeight:null};function B(e,t){let[n,r]=(0,w.useState)(null);return(0,w.useEffect)(()=>{if(!e)return;let n=!1;return O(e,t).then(t=>!n&&r({id:e,state:t})),()=>{n=!0}},[e,t]),e&&n?.id===e?n.state:null}function V({answer:e,onFail:t}){let n=(0,w.useRef)(null),r=(0,w.useRef)(t);r.current=t;let i=I(e.id)!==null;return(0,w.useEffect)(()=>{if(i)return;let t=t=>{let i=n.current;if(!i||t.source===null||t.source!==i.contentWindow)return;let a=t.data;a&&a.youi===`try`&&(a.type===`html`&&typeof a.html==`string`?F(e.id,a.html):a.type===`error`&&r.current(`It failed when it ran (${typeof a.message==`string`?a.message.slice(0,200):`an error`}); the listing stands.`))};window.addEventListener(`message`,t);let a=setTimeout(()=>r.current(`It did not draw within ${R/1e3}s; the listing stands.`),R);return()=>{window.removeEventListener(`message`,t),clearTimeout(a)}},[e.id,i]),i||!e.script||!e.css?null:(0,L.jsx)(`iframe`,{ref:n,title:`Drawing ${e.name}`,"aria-hidden":!0,tabIndex:-1,sandbox:y,srcDoc:v(``,e.css.light,`light`,e.script),"data-draw-probe":e.id,className:`pointer-events-none fixed top-0 -left-[9999px] border-0 opacity-0`,style:{width:_,height:480}})}function H(e,t,n,r=`${e.id}:${n}`){return{key:r,project:e.project,specimen:t?{kind:`component`,html:t}:null,css:t&&e.css?e.css[n]:null,shape:z,count:1,place:e.entry.source.ref??e.name,script:e.script}}var U=`Saving and adopting are drafts for approval: they need the workflow service (open the hub with youiyoux ui --project).`;function W(e,t){return e===`unknown`?`${t}'s licence is unknown: nothing backs one, so it cannot be adopted. Save it to the Library as a reference instead, or find its licence first.`:null}function G(){let[e,t]=(0,w.useState)(`checking`);return(0,w.useEffect)(()=>{let e=!1;return l.info().then(()=>!e&&t(`up`),n=>!e&&t(u(n).offline?`down`:`up`)),()=>{e=!0}},[]),e}function K({entry:e,licence:t,install:n,family:r}){let a=G(),[o,f]=(0,w.useState)(!1),[p,m]=(0,w.useState)(``),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(null),[y,b]=(0,w.useState)(null),S=W(t,e?.title??e?.name??`This item`),T=a===`down`?U:e===null?`Drafting needs the full listing, which comes with its preview from the hub's own server.`:null,E=async t=>{if(e){g(t),v(null);try{let n=await l.createLibrary({entry:e,request:t,reason:t===`adopt`?p.trim():``,swapsWith:r?[r]:[]});b({id:n.id,request:t}),f(!1)}catch(e){v(u(e))}finally{g(null)}}};return(0,L.jsxs)(`section`,{"aria-labelledby":`candidate-actions`,className:`space-y-3`,"data-testid":`candidate-actions`,children:[(0,L.jsx)(`h3`,{id:`candidate-actions`,className:`text-heading`,children:`Keep it, or ask for it`}),n&&(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(`p`,{className:`text-small text-muted`,children:`Install command, for after adoption: copy it, the hub never runs it.`}),(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 rounded-md bg-sunken px-2 py-1`,children:[(0,L.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-mono-sm text-ink-2`,"data-install":!0,children:n}),(0,L.jsx)(i,{value:n,label:`Copy install command`,className:`max-md:size-11`})]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(c,{disabled:T!==null||h!==null||a===`checking`,onClick:()=>void E(`save`),className:`max-md:h-11`,"data-action":`save`,children:[(0,L.jsx)(x,{}),` `,h===`save`?`Saving…`:`Save to Library`]}),(0,L.jsxs)(c,{variant:`primary`,disabled:T!==null||S!==null||h!==null||a===`checking`,"aria-describedby":S?`adopt-refusal`:void 0,onClick:()=>f(!0),className:`max-md:h-11`,"data-action":`adopt`,children:[(0,L.jsx)(C,{}),` Add to my project`]})]}),S&&(0,L.jsx)(`p`,{id:`adopt-refusal`,className:`text-small text-warning`,"data-refusal":!0,children:S}),T&&(0,L.jsx)(`p`,{className:`text-small text-muted`,children:T}),o&&!S&&(0,L.jsxs)(`form`,{className:`space-y-2 rounded-md border border-line p-3`,onSubmit:e=>{e.preventDefault(),E(`adopt`)},children:[(0,L.jsx)(`p`,{className:`text-small text-ink-2`,children:`This drafts an adoption request for a person to approve in Changes. Nothing is installed; after adoption, the command above adds it.`}),(0,L.jsxs)(`label`,{className:`block space-y-1`,children:[(0,L.jsx)(`span`,{className:`text-small text-muted`,children:`Why does the system need it?`}),(0,L.jsx)(d,{value:p,onChange:e=>m(e.target.value),rows:2,required:!0})]}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(c,{type:`submit`,variant:`primary`,disabled:!p.trim()||h!==null,children:h===`adopt`?`Drafting…`:`Draft adoption request`}),(0,L.jsx)(c,{variant:`ghost`,onClick:()=>f(!1),children:`Cancel`})]})]}),y&&(0,L.jsxs)(`p`,{role:`status`,className:`text-small text-success`,children:[y.request===`adopt`?`Adoption request drafted`:`Saved to the Library as a draft`,` for approval:`,` `,(0,L.jsx)(s,{href:`/changes/${y.id}`,className:`underline`,children:`open it in Changes`}),`.`]}),_&&(0,L.jsxs)(`div`,{role:`alert`,className:`text-small text-danger`,children:[(0,L.jsx)(`p`,{children:_.offline?U:_.message}),_.problems.map(e=>(0,L.jsx)(`p`,{children:e},e))]})]})}var q={light:`#fcfcfd`,dark:`#0f1011`};function J({answer:e,failure:t,scheme:n}){let r=I(e.id),i=e.error??t;return i?(0,L.jsx)(`p`,{className:`rounded-md border border-dashed border-line-strong p-3 text-small text-muted`,"data-preview-error":!0,children:`No drawing: ${i.replace(/\.$/,``)}.`}):r?(0,L.jsxs)(`div`,{className:`space-y-3`,"data-drawn":e.id,children:[(0,L.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 max-sm:grid-cols-1`,"aria-label":`In your theme, light and dark`,children:[`light`,`dark`].map(t=>(0,L.jsxs)(`li`,{className:`min-w-0 space-y-1`,children:[(0,L.jsx)(`p`,{className:`text-caption text-muted`,children:t===`light`?`Light`:`Dark`}),(0,L.jsx)(g,{tile:H(e,r,t),scheme:t,size:`large`,as:`div`,caption:!1,tryIt:!0,backdrop:q[t]})]},t))}),(0,L.jsx)(h,{tile:H(e,r,n,`${e.id}:states`),scheme:n,label:e.name})]}):(0,L.jsx)(`p`,{"aria-busy":`true`,className:`grid place-items-center rounded-md border border-line bg-sunken text-small text-faint`,style:{height:136},children:`Drawing it in your theme…`})}function Y({title:e,icon:t,lines:n,tone:r,empty:i}){return(0,L.jsxs)(`section`,{className:`min-w-0 space-y-1.5`,children:[(0,L.jsxs)(`h4`,{className:`flex items-center gap-1.5 text-small font-medium text-ink-2`,children:[t,e]}),n.length===0?(0,L.jsx)(`p`,{className:`text-small text-muted`,children:i}):(0,L.jsx)(`ul`,{className:`space-y-1`,"data-fit":r===`success`?`themed`:`unthemed`,children:n.map(e=>(0,L.jsx)(`li`,{className:`text-small text-ink-2`,children:e},e))})]})}function X({hit:e,state:t,scheme:n,family:r,failure:i}){let s=t?.status===`ready`?t.answer:null,c=f(e);return(0,L.jsxs)(`div`,{className:`space-y-6 px-5 py-4`,"data-candidate":e.id,children:[(0,L.jsxs)(`section`,{className:`space-y-2`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`code`,{className:`font-mono text-mono-sm text-ink-2`,children:e.source.ref??e.name}),(0,L.jsx)(m,{licence:e.license}),c.map(e=>(0,L.jsx)(`span`,{className:`tabular text-caption text-muted`,children:e},e))]}),(0,L.jsx)(`p`,{className:`text-small text-ink-2`,children:e.summary}),(0,L.jsxs)(`p`,{className:`text-caption text-muted`,children:[`An outside reference from `,p(e),`: not in your system and not approved.`]})]}),(0,L.jsxs)(`section`,{"aria-labelledby":`candidate-drawing`,className:`space-y-2`,children:[(0,L.jsx)(`h3`,{id:`candidate-drawing`,className:`text-heading`,children:`In your theme`}),t===null?(0,L.jsx)(`p`,{"aria-busy":`true`,className:`text-small text-faint`,children:`Fetching only this item's source, then drawing it with your project's CSS…`}):t.status===`error`?(0,L.jsx)(`p`,{className:`rounded-md border border-dashed border-line-strong p-3 text-small text-muted`,"data-preview-error":!0,children:t.message}):(0,L.jsx)(J,{answer:t.answer,failure:i,scheme:n})]}),s&&!s.error&&(0,L.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,L.jsx)(Y,{title:`Themed with your tokens`,icon:(0,L.jsx)(o,{"aria-hidden":!0,className:`size-3.5 text-success`}),lines:s.fit.themed,tone:`success`,empty:`Nothing it uses maps to a token of yours.`}),(0,L.jsx)(Y,{title:`Could not be themed`,icon:(0,L.jsx)(a,{"aria-hidden":!0,className:`size-3.5 text-warning`}),lines:s.fit.unthemed,tone:`warning`,empty:`Everything measured draws with your tokens.`})]}),s&&(s.parts.length>0||s.notes.length>0||s.implicitDeps.length>0)&&(0,L.jsxs)(`section`,{"aria-labelledby":`candidate-built`,className:`space-y-1.5`,children:[(0,L.jsx)(`h3`,{id:`candidate-built`,className:`text-heading`,children:`What it is built from`}),(0,L.jsxs)(`ul`,{className:`space-y-1 text-small text-ink-2`,children:[s.parts.map(e=>(0,L.jsx)(`li`,{children:e.detail},e.name)),s.notes.map(e=>(0,L.jsx)(`li`,{children:e},e)),s.implicitDeps.length>0&&(0,L.jsxs)(`li`,{"data-implicit":!0,children:[`Imports without declaring: `,s.implicitDeps.join(`, `),` (an install would need `,s.implicitDeps.length===1?`it`:`them`,` too)`]})]})]}),(0,L.jsx)(K,{entry:s?.entry??null,licence:e.license,install:e.install?.command??s?.install?.command??null,family:r})]})}export{B as a,H as i,q as n,I as o,V as r,X as t};
|
|
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"./circle-check-DkwBMT62.js";import{dt as s,s as c}from"./main-cvOFSjox.js";import{a as l,n as u}from"./workflow-C53UBmRZ.js";import{a as d}from"./Field-LwrJXoOs.js";import{o as f,s as p}from"./discover-va2KFuK_.js";import{t as m}from"./LicenceBadge-CLCUMMHE.js";import{a as h,i as g,t as _}from"./Specimens-D_9hjlJH.js";import{n as v,t as y}from"./try-live-Iys3nCBG.js";var b={name:`bookmark-plus`,size:24,node:[[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M15 10H9`,key:`o6yqo3`}],[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]};b.node;var x=r(b),S={name:`package-plus`,size:24,node:[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]};S.node;var C=r(S),w=e(t(),1),T=`__youi/discover-preview`,E=new Map,D=[];function O(e,t){let n=`${e}\0${t??``}`,r=E.get(n);return r||(D.push(e),r=k(e,t),E.set(n,r),r.then(e=>e.status===`error`&&E.delete(n))),r}async function k(e,t){let n=new URLSearchParams({id:e,...t?{project:t}:{}}),r;try{r=await fetch(`/${T}?${n}`,{cache:`no-store`})}catch{return{status:`error`,message:`Previews need the hub's own server (youiyoux ui or pnpm dev), which did not answer; the listing stands.`,offline:!0}}let i=await r.json().catch(()=>null);return r.ok&&i&&`id`in i?{status:`ready`,answer:i}:i&&typeof i.error==`string`?{status:`error`,message:i.error,offline:!1}:{status:`error`,message:`Previews need the hub's own server (youiyoux ui or pnpm dev); this host only serves files, so the listing stands.`,offline:!0}}var A=`script, iframe, frame, frameset, object, embed, link, meta, base, style, noscript, template, portal`,j=[`href`,`src`,`srcset`,`action`,`formaction`,`xlink:href`,`poster`,`background`,`ping`];function M(e){if(typeof document>`u`)return``;let t=document.createElement(`template`);t.innerHTML=e.slice(0,2e5);for(let e of t.content.querySelectorAll(A))e.remove();for(let e of t.content.querySelectorAll(`*`))for(let t of[...e.attributes]){let n=t.name.toLowerCase();if(n.startsWith(`on`))e.removeAttribute(t.name);else if(j.includes(n)){let r=t.value.trim();!(n===`href`&&r.startsWith(`#`))&&!/^data:image\/(?:png|gif|jpeg|webp);/i.test(r)&&e.setAttribute(t.name,n===`href`?`#`:``)}else n===`style`&&/url\s*\(|expression\s*\(|@import/i.test(t.value)&&e.removeAttribute(t.name)}return t.innerHTML}var N=new Map,P=new Set;function F(e,t){let n=M(t);n.trim()&&N.get(e)!==n&&(N.set(e,n),P.forEach(e=>e()))}function I(e){return(0,w.useSyncExternalStore)(e=>(P.add(e),()=>P.delete(e)),()=>e?N.get(e)??null:null,()=>null)}var L=n(),R=15e3,z={height:null,paddingX:null,paddingY:null,radius:null,fontSize:null,fontWeight:null};function B(e,t){let[n,r]=(0,w.useState)(null);return(0,w.useEffect)(()=>{if(!e)return;let n=!1;return O(e,t).then(t=>!n&&r({id:e,state:t})),()=>{n=!0}},[e,t]),e&&n?.id===e?n.state:null}function V({answer:e,onFail:t}){let n=(0,w.useRef)(null),r=(0,w.useRef)(t);r.current=t;let i=I(e.id)!==null;return(0,w.useEffect)(()=>{if(i)return;let t=t=>{let i=n.current;if(!i||t.source===null||t.source!==i.contentWindow)return;let a=t.data;a&&a.youi===`try`&&(a.type===`html`&&typeof a.html==`string`?F(e.id,a.html):a.type===`error`&&r.current(`It failed when it ran (${typeof a.message==`string`?a.message.slice(0,200):`an error`}); the listing stands.`))};window.addEventListener(`message`,t);let a=setTimeout(()=>r.current(`It did not draw within ${R/1e3}s; the listing stands.`),R);return()=>{window.removeEventListener(`message`,t),clearTimeout(a)}},[e.id,i]),i||!e.script||!e.css?null:(0,L.jsx)(`iframe`,{ref:n,title:`Drawing ${e.name}`,"aria-hidden":!0,tabIndex:-1,sandbox:y,srcDoc:v(``,e.css.light,`light`,e.script),"data-draw-probe":e.id,className:`pointer-events-none fixed top-0 -left-[9999px] border-0 opacity-0`,style:{width:_,height:480}})}function H(e,t,n,r=`${e.id}:${n}`){return{key:r,project:e.project,specimen:t?{kind:`component`,html:t}:null,css:t&&e.css?e.css[n]:null,shape:z,count:1,place:e.entry.source.ref??e.name,script:e.script}}var U=`Saving and adopting are drafts for approval: they need the workflow service (open the hub with youiyoux ui --project).`;function W(e,t){return e===`unknown`?`${t}'s licence is unknown: nothing backs one, so it cannot be adopted. Save it to the Library as a reference instead, or find its licence first.`:null}function G(){let[e,t]=(0,w.useState)(`checking`);return(0,w.useEffect)(()=>{let e=!1;return l.info().then(()=>!e&&t(`up`),n=>!e&&t(u(n).offline?`down`:`up`)),()=>{e=!0}},[]),e}function K({entry:e,licence:t,install:n,family:r}){let a=G(),[o,f]=(0,w.useState)(!1),[p,m]=(0,w.useState)(``),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(null),[y,b]=(0,w.useState)(null),S=W(t,e?.title??e?.name??`This item`),T=a===`down`?U:e===null?`Drafting needs the full listing, which comes with its preview from the hub's own server.`:null,E=async t=>{if(e){g(t),v(null);try{let n=await l.createLibrary({entry:e,request:t,reason:t===`adopt`?p.trim():``,swapsWith:r?[r]:[]});b({id:n.id,request:t}),f(!1)}catch(e){v(u(e))}finally{g(null)}}};return(0,L.jsxs)(`section`,{"aria-labelledby":`candidate-actions`,className:`space-y-3`,"data-testid":`candidate-actions`,children:[(0,L.jsx)(`h3`,{id:`candidate-actions`,className:`text-heading`,children:`Keep it, or ask for it`}),n&&(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(`p`,{className:`text-small text-muted`,children:`Install command, for after adoption: copy it, the hub never runs it.`}),(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 rounded-md bg-sunken px-2 py-1`,children:[(0,L.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-mono-sm text-ink-2`,"data-install":!0,children:n}),(0,L.jsx)(i,{value:n,label:`Copy install command`,className:`max-md:size-11`})]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(c,{disabled:T!==null||h!==null||a===`checking`,onClick:()=>void E(`save`),className:`max-md:h-11`,"data-action":`save`,children:[(0,L.jsx)(x,{}),` `,h===`save`?`Saving…`:`Save to Library`]}),(0,L.jsxs)(c,{variant:`primary`,disabled:T!==null||S!==null||h!==null||a===`checking`,"aria-describedby":S?`adopt-refusal`:void 0,onClick:()=>f(!0),className:`max-md:h-11`,"data-action":`adopt`,children:[(0,L.jsx)(C,{}),` Add to my project`]})]}),S&&(0,L.jsx)(`p`,{id:`adopt-refusal`,className:`text-small text-warning`,"data-refusal":!0,children:S}),T&&(0,L.jsx)(`p`,{className:`text-small text-muted`,children:T}),o&&!S&&(0,L.jsxs)(`form`,{className:`space-y-2 rounded-md border border-line p-3`,onSubmit:e=>{e.preventDefault(),E(`adopt`)},children:[(0,L.jsx)(`p`,{className:`text-small text-ink-2`,children:`This drafts an adoption request for a person to approve in Changes. Nothing is installed; after adoption, the command above adds it.`}),(0,L.jsxs)(`label`,{className:`block space-y-1`,children:[(0,L.jsx)(`span`,{className:`text-small text-muted`,children:`Why does the system need it?`}),(0,L.jsx)(d,{value:p,onChange:e=>m(e.target.value),rows:2,required:!0})]}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(c,{type:`submit`,variant:`primary`,disabled:!p.trim()||h!==null,children:h===`adopt`?`Drafting…`:`Draft adoption request`}),(0,L.jsx)(c,{variant:`ghost`,onClick:()=>f(!1),children:`Cancel`})]})]}),y&&(0,L.jsxs)(`p`,{role:`status`,className:`text-small text-success`,children:[y.request===`adopt`?`Adoption request drafted`:`Saved to the Library as a draft`,` for approval:`,` `,(0,L.jsx)(s,{href:`/changes/${y.id}`,className:`underline`,children:`open it in Changes`}),`.`]}),_&&(0,L.jsxs)(`div`,{role:`alert`,className:`text-small text-danger`,children:[(0,L.jsx)(`p`,{children:_.offline?U:_.message}),_.problems.map(e=>(0,L.jsx)(`p`,{children:e},e))]})]})}var q={light:`#fcfcfd`,dark:`#0f1011`};function J({answer:e,failure:t,scheme:n}){let r=I(e.id),i=e.error??t;return i?(0,L.jsx)(`p`,{className:`rounded-md border border-dashed border-line-strong p-3 text-small text-muted`,"data-preview-error":!0,children:`No drawing: ${i.replace(/\.$/,``)}.`}):r?(0,L.jsxs)(`div`,{className:`space-y-3`,"data-drawn":e.id,children:[(0,L.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 max-sm:grid-cols-1`,"aria-label":`In your theme, light and dark`,children:[`light`,`dark`].map(t=>(0,L.jsxs)(`li`,{className:`min-w-0 space-y-1`,children:[(0,L.jsx)(`p`,{className:`text-caption text-muted`,children:t===`light`?`Light`:`Dark`}),(0,L.jsx)(g,{tile:H(e,r,t),scheme:t,size:`large`,as:`div`,caption:!1,tryIt:!0,backdrop:q[t]})]},t))}),(0,L.jsx)(h,{tile:H(e,r,n,`${e.id}:states`),scheme:n,label:e.name})]}):(0,L.jsx)(`p`,{"aria-busy":`true`,className:`grid place-items-center rounded-md border border-line bg-sunken text-small text-faint`,style:{height:136},children:`Drawing it in your theme…`})}function Y({title:e,icon:t,lines:n,tone:r,empty:i}){return(0,L.jsxs)(`section`,{className:`min-w-0 space-y-1.5`,children:[(0,L.jsxs)(`h4`,{className:`flex items-center gap-1.5 text-small font-medium text-ink-2`,children:[t,e]}),n.length===0?(0,L.jsx)(`p`,{className:`text-small text-muted`,children:i}):(0,L.jsx)(`ul`,{className:`space-y-1`,"data-fit":r===`success`?`themed`:`unthemed`,children:n.map(e=>(0,L.jsx)(`li`,{className:`text-small text-ink-2`,children:e},e))})]})}function X({hit:e,state:t,scheme:n,family:r,failure:i}){let s=t?.status===`ready`?t.answer:null,c=f(e);return(0,L.jsxs)(`div`,{className:`space-y-6 px-5 py-4`,"data-candidate":e.id,children:[(0,L.jsxs)(`section`,{className:`space-y-2`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`code`,{className:`font-mono text-mono-sm text-ink-2`,children:e.source.ref??e.name}),(0,L.jsx)(m,{licence:e.license}),c.map(e=>(0,L.jsx)(`span`,{className:`tabular text-caption text-muted`,children:e},e))]}),(0,L.jsx)(`p`,{className:`text-small text-ink-2`,children:e.summary}),(0,L.jsxs)(`p`,{className:`text-caption text-muted`,children:[`An outside reference from `,p(e),`: not in your system and not approved.`]})]}),(0,L.jsxs)(`section`,{"aria-labelledby":`candidate-drawing`,className:`space-y-2`,children:[(0,L.jsx)(`h3`,{id:`candidate-drawing`,className:`text-heading`,children:`In your theme`}),t===null?(0,L.jsx)(`p`,{"aria-busy":`true`,className:`text-small text-faint`,children:`Fetching only this item's source, then drawing it with your project's CSS…`}):t.status===`error`?(0,L.jsx)(`p`,{className:`rounded-md border border-dashed border-line-strong p-3 text-small text-muted`,"data-preview-error":!0,children:t.message}):(0,L.jsx)(J,{answer:t.answer,failure:i,scheme:n})]}),s&&!s.error&&(0,L.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,L.jsx)(Y,{title:`Themed with your tokens`,icon:(0,L.jsx)(o,{"aria-hidden":!0,className:`size-3.5 text-success`}),lines:s.fit.themed,tone:`success`,empty:`Nothing it uses maps to a token of yours.`}),(0,L.jsx)(Y,{title:`Could not be themed`,icon:(0,L.jsx)(a,{"aria-hidden":!0,className:`size-3.5 text-warning`}),lines:s.fit.unthemed,tone:`warning`,empty:`Everything measured draws with your tokens.`})]}),s&&(s.parts.length>0||s.notes.length>0||s.implicitDeps.length>0)&&(0,L.jsxs)(`section`,{"aria-labelledby":`candidate-built`,className:`space-y-1.5`,children:[(0,L.jsx)(`h3`,{id:`candidate-built`,className:`text-heading`,children:`What it is built from`}),(0,L.jsxs)(`ul`,{className:`space-y-1 text-small text-ink-2`,children:[s.parts.map(e=>(0,L.jsx)(`li`,{children:e.detail},e.name)),s.notes.map(e=>(0,L.jsx)(`li`,{children:e},e)),s.implicitDeps.length>0&&(0,L.jsxs)(`li`,{"data-implicit":!0,children:[`Imports without declaring: `,s.implicitDeps.join(`, `),` (an install would need `,s.implicitDeps.length===1?`it`:`them`,` too)`]})]})]}),(0,L.jsx)(K,{entry:s?.entry??null,licence:e.license,install:e.install?.command??s?.install?.command??null,family:r})]})}export{B as a,H as i,q as n,I as o,V as r,X as t};
|
|
@@ -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{a as i,c as a,d as o,f as s,i as c,l,o as u,r as d,s as f,t as p,u as m}from"./ScreenImage-DLeA3nRh.js";import{t as h}from"./KindIcon-BJ6bz-ny.js";import{n as g,r as _,t as v}from"./CopyButton-DE8drl4P.js";import{t as y}from"./download-BQI-Si9R.js";import{t as b}from"./git-pull-request-arrow-RqUUIRCU.js";import{t as x}from"./TokenDetail-BICobLK1.js";import{r as S,t as ee}from"./RuleDetail-BDhZ1gCd.js";import{c as te}from"./contrast-B-uhyF_b.js";import{t as C}from"./x-MLbFVa4v.js";import{t as w}from"./clsx-DB0hHKMi.js";import{$ as T,H as ne,J as E,L as re,Q as D,R as ie,U as O,X as ae,Y as oe,Z as se,a as ce,at as le,dt as k,et as ue,f as A,g as de,i as fe,it as pe,k as me,m as j,mt as he,n as ge,nt as _e,o as M,pt as N,q as P,rt as ve,s as F,st as ye,tt as I}from"./main-CfbpuT4Y.js";import{t as L}from"./plural-BbGQPQKA.js";import{useSearch as be}from"./client-BXHiuV_w.js";import{i as R,r as z,t as B}from"./Badge-CUJUit4d.js";import{t as xe}from"./Swatch-KDz4qxdM.js";import{n as V,r as Se,t as Ce}from"./Section-BTnvUq_W.js";import{n as we}from"./TokenValue-CsPRc2ai.js";import{i as H,n as U,r as Te,t as Ee}from"./Tabs-Cbh9BCKW.js";import{t as De}from"./CodeBlock-CsiGFgvI.js";import{r as W,t as Oe}from"./Preview-CgW-FMB7.js";import{t as ke}from"./Segmented-Dzi1x49S.js";import{n as Ae}from"./format-DxAYNTN_.js";import{t as je}from"./esm-NPpg23M8.js";import{t as Me}from"./SearchField-DtEgq9-Q.js";var Ne={name:`circle-question-mark`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`help-circle`,`circle-help`]};Ne.node;var Pe=r(Ne),Fe={name:`clipboard-copy`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2`,key:`4jdomd`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v4`,key:`3hqy98`}],[`path`,{d:`M21 14H11`,key:`1bme5i`}],[`path`,{d:`m15 10-4 4 4 4`,key:`5dvupr`}]]};Fe.node;var Ie=r(Fe),Le={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};Le.node;var Re=r(Le),ze={name:`file-question-mark`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]],aliases:[`file-question`]};ze.node;var Be=r(ze),G={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};G.node;var Ve=r(G),He={name:`map-pin-off`,size:24,node:[[`path`,{d:`M12.75 7.09a3 3 0 0 1 2.16 2.16`,key:`1d4wjd`}],[`path`,{d:`M17.072 17.072c-1.634 2.17-3.527 3.912-4.471 4.727a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 1.432-4.568`,key:`12yil7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.475 2.818A8 8 0 0 1 20 10c0 1.183-.31 2.377-.81 3.533`,key:`lhrkcz`}],[`path`,{d:`M9.13 9.13a3 3 0 0 0 3.74 3.74`,key:`13wojd`}]]};He.node;var Ue=r(He),We={name:`package-open`,size:24,node:[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]};We.node;var Ge=r(We),Ke={name:`square-dashed`,size:24,node:[[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M21 19a2 2 0 0 1-2 2`,key:`1j7049`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M9 3h1`,key:`1yesri`}],[`path`,{d:`M9 21h1`,key:`15o7lz`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M14 21h1`,key:`v9vybs`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M21 9v1`,key:`mxsmne`}],[`path`,{d:`M3 14v1`,key:`vnatye`}],[`path`,{d:`M21 14v1`,key:`169vum`}]],aliases:[`box-select`]};Ke.node;var qe=r(Ke),K=e(t(),1),q=n();function Je({label:e,children:t,items:n}){let[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(`first`),s=(0,K.useRef)(null),c=(0,K.useRef)(null),l=(0,K.useId)(),u=()=>[...c.current?.querySelectorAll(`[role=menuitem]`)??[]],d=e=>{i(!1),e&&s.current?.focus()};return(0,K.useEffect)(()=>{if(!r)return;let e=u();(a===`first`?e[0]:e.at(-1))?.focus();let t=e=>{let t=e.target;!c.current?.contains(t)&&!s.current?.contains(t)&&i(!1)};return document.addEventListener(`pointerdown`,t),()=>document.removeEventListener(`pointerdown`,t)},[r,a]),(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(F,{ref:s,"aria-label":e,"aria-haspopup":`menu`,"aria-expanded":r,"aria-controls":r?l:void 0,onClick:()=>{o(`first`),i(e=>!e)},onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),o(e.key===`ArrowDown`?`first`:`last`),i(!0))},children:t}),r&&(0,q.jsx)(`div`,{ref:c,id:l,role:`menu`,"aria-label":e,onKeyDown:e=>{let t=u(),n=t.findIndex(e=>e===document.activeElement),r=n=>{e.preventDefault(),t[(n+t.length)%t.length]?.focus()};e.key===`ArrowDown`?r(n+1):e.key===`ArrowUp`?r(n-1):e.key===`Home`?r(0):e.key===`End`?r(t.length-1):e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),d(!0)):e.key===`Tab`&&d(!1)},className:`absolute top-full right-0 z-20 mt-1 w-72 rounded-lg border border-line bg-surface p-1 shadow-popover origin-top-right animate-menu`,children:n.map(e=>(0,q.jsxs)(`button`,{type:`button`,role:`menuitem`,tabIndex:-1,onClick:()=>{e.onSelect(),d(!0)},className:`flex w-full items-start gap-2.5 rounded-md px-2 py-1.5 text-left outline-none hover:bg-raised focus-visible:bg-raised focus-visible:outline-none`,children:[e.icon&&(0,q.jsx)(e.icon,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0 text-muted`}),(0,q.jsxs)(`span`,{className:`min-w-0`,children:[(0,q.jsx)(`span`,{className:`block text-body text-ink`,children:e.label}),e.detail&&(0,q.jsx)(`span`,{className:`block truncate font-mono text-mono-sm text-muted`,children:e.detail})]})]},e.label))})]})}function Ye({token:e,scheme:t}){let n=e[t];return(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[e.type===`color`&&(0,q.jsx)(xe,{color:n,size:`sm`}),(0,q.jsx)(`span`,{className:`truncate font-mono text-mono-sm text-ink-2`,title:n,children:n})]})}function Xe({model:e,contract:t}){let n=Object.entries(t.tokens);return n.length===0?null:(0,q.jsx)(V,{title:`Token bindings`,count:n.length,children:(0,q.jsx)(Se,{head:[`Role`,`Token`,`Light`,`Dark`],children:n.map(([t,n])=>{let r=e.tokens.get(n);return(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{className:`font-mono text-mono whitespace-nowrap text-ink`,children:t}),(0,q.jsx)(`td`,{className:`whitespace-nowrap`,children:(0,q.jsx)(k,{href:I(n),className:`font-mono text-mono text-accent hover:underline`,children:pe(n)})}),(0,q.jsx)(`td`,{className:`max-w-56`,children:r?(0,q.jsx)(Ye,{token:r,scheme:`light`}):(0,q.jsx)(`span`,{className:`text-danger`,children:`Unknown token`})}),(0,q.jsx)(`td`,{className:`max-w-56`,children:r&&(0,q.jsx)(Ye,{token:r,scheme:`dark`})})]},t)})})})}function Ze({spec:e}){return e.type===`enum`?(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.values.map(t=>(0,q.jsx)(B,{tone:t===e.default?`accent`:`neutral`,className:`font-mono`,children:t},t))}):(0,q.jsx)(`span`,{className:`font-mono text-mono-sm text-ink-2`,children:e.type})}var Qe=e=>`default`in e&&e.default!==void 0?String(e.default):null;function $e({items:e,tone:t}){let n=t===`do`?_:C;return(0,q.jsxs)(`ul`,{className:`space-y-2 rounded-md border border-line p-3`,children:[(0,q.jsx)(`li`,{className:`text-caption text-muted`,children:t===`do`?`Do`:`Don't`}),e.map(e=>(0,q.jsxs)(`li`,{className:`flex gap-2 text-body text-ink-2`,children:[(0,q.jsx)(n,{className:t===`do`?`mt-0.5 size-3.5 shrink-0 text-success`:`mt-0.5 size-3.5 shrink-0 text-danger`}),e]},e))]})}function et({model:e,entry:t}){let{contract:n,files:r}=t,i=Object.entries(n.props);return(0,q.jsxs)(`div`,{className:`space-y-8 p-6 max-sm:px-4`,children:[(0,q.jsx)(V,{title:`Props`,count:i.length,aside:n.passthrough&&(0,q.jsxs)(`span`,{className:`text-small text-muted`,children:[`Other props pass through to `,(0,q.jsxs)(`code`,{className:`font-mono text-ink-2`,children:[`<`,n.passthrough,`>`]})]}),children:(0,q.jsx)(Se,{head:[`Prop`,`Type`,`Default`,`Description`],children:i.map(([e,t])=>(0,q.jsxs)(`tr`,{children:[(0,q.jsxs)(`td`,{className:`font-mono text-mono whitespace-nowrap text-ink`,children:[e,t.required&&(0,q.jsx)(`span`,{className:`text-danger`,"aria-label":`required`,children:`*`})]}),(0,q.jsx)(`td`,{children:(0,q.jsx)(Ze,{spec:t})}),(0,q.jsx)(`td`,{className:`font-mono text-mono-sm text-muted`,children:Qe(t)??`–`}),(0,q.jsxs)(`td`,{className:`min-w-56 text-small text-ink-2`,children:[t.description??``,t.deprecated&&(0,q.jsxs)(`span`,{className:`block text-warning`,children:[`Deprecated: `,t.deprecated]})]})]},e))})}),(0,q.jsx)(Xe,{model:e,contract:n}),(0,q.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-2`,children:[(0,q.jsxs)(V,{title:`Accessibility`,children:[(0,q.jsx)(Ce,{rows:[[`Role`,n.a11y.role?(0,q.jsx)(`code`,{className:`font-mono text-mono`,children:n.a11y.role}):`–`],[`Touch target`,n.a11y.minTouchTarget?`${n.a11y.minTouchTarget}px minimum`:`–`]]}),n.a11y.notes.length>0&&(0,q.jsx)(`ul`,{className:`space-y-1.5 pt-1`,children:n.a11y.notes.map(e=>(0,q.jsxs)(`li`,{className:`flex gap-2 text-body text-ink-2`,children:[(0,q.jsx)(o,{className:`mt-1 size-3 shrink-0 text-faint`}),e]},e))})]}),(0,q.jsx)(V,{title:`Source`,children:(0,q.jsx)(Ce,{rows:[[`Export`,(0,q.jsx)(`code`,{className:`font-mono text-mono`,children:n.source.export})],[`Also exports`,n.source.also.length?(0,q.jsx)(`code`,{className:`font-mono text-mono`,children:n.source.also.join(`, `)}):`–`],[`Aliases`,n.aliases.length?(0,q.jsx)(`code`,{className:`font-mono text-mono`,children:n.aliases.join(`, `)}):`–`],[`File`,(0,q.jsx)(`code`,{className:`font-mono text-mono`,children:n.source.file})]]})})]}),(n.guidance.do.length>0||n.guidance.dont.length>0)&&(0,q.jsx)(V,{title:`Guidance`,children:(0,q.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[n.guidance.do.length>0&&(0,q.jsx)($e,{items:n.guidance.do,tone:`do`}),n.guidance.dont.length>0&&(0,q.jsx)($e,{items:n.guidance.dont,tone:`dont`})]})}),(0,q.jsx)(V,{title:`Owned files`,count:r.length,children:(0,q.jsx)(`div`,{className:`grid gap-3`,children:r.map(e=>(0,q.jsx)(De,{title:e.path,code:e.code},e.path))})})]})}function tt({model:e,contract:t,index:n}){let r=n.sitesByElement.get(t.id)??[],i=D(r),a=P(n,t),o=m(l(n,e.manifest),t.id),s=I(t.id,`usage`);if(r.length===0&&a.total===0)return(0,q.jsxs)(`p`,{className:`rounded-lg border border-dashed border-line px-4 py-3 text-small text-muted`,children:[`No scanned project renders `,t.name,` yet.`]});let c=[a.lookalikes>0&&`${a.lookalikes} lookalike${a.lookalikes===1?``:`s`}`,a.unset&&`${a.unset.count} without ${a.unset.prop}`,a.unresolved>0&&`${a.unresolved} unresolved`].filter(Boolean),u=o[0];return(0,q.jsxs)(`p`,{"data-headline":!0,className:`text-title text-ink-2`,children:[(0,q.jsx)(W,{value:i.sites,href:s}),` `,L(i.sites,`use`),` in `,i.files,` `,L(i.files,`file`),` across `,i.projects,` `,L(i.projects,`project`),`, on `,(0,q.jsx)(W,{value:i.screens,href:s}),` `,L(i.screens,`screen`),u&&(0,q.jsxs)(q.Fragment,{children:[` `,`(most on `,(0,q.jsx)(`span`,{className:`font-mono text-mono`,children:f(u.screen.route)}),`)`]}),a.total>0?(0,q.jsxs)(q.Fragment,{children:[`, with `,(0,q.jsx)(W,{value:a.total,href:s}),` to look at: `,c.join(`, `),`.`]}):(0,q.jsxs)(q.Fragment,{children:[`, with `,(0,q.jsx)(W,{value:`nothing`,clean:!0}),` flagged.`]})]})}var nt=[`min(36rem, 100%)`,`min(22rem, 70%)`];function rt({model:e,name:t,contract:n,usage:r}){return(0,q.jsxs)(`div`,{className:`space-y-8 p-6 max-sm:px-4`,children:[(0,q.jsx)(Oe,{name:t,contract:n,paper:{light:we(e,`light`).background,dark:we(e,`dark`).background}}),r.status===`ready`?(0,q.jsx)(tt,{model:e,contract:n,index:r.value}):(0,q.jsx)(`div`,{"aria-busy":r.status!==`error`,"aria-label":r.status===`error`?`Usage could not be loaded`:`Loading usage`,className:`space-y-2`,children:nt.map((e,t)=>(0,q.jsx)(`div`,{className:`h-4 rounded-xs bg-raised`,style:{width:e}},t))}),n.examples.length>0&&(0,q.jsx)(V,{title:`Examples`,count:n.examples.length,children:(0,q.jsx)(`div`,{className:`grid gap-3`,children:n.examples.map(e=>(0,q.jsx)(De,{title:e.title,code:e.code,maxHeight:`sm`},e.title))})})]})}function J({icon:e,count:t,title:n,body:r,onShow:i}){return(0,q.jsxs)(`li`,{className:`flex items-start gap-3 px-3 py-2.5`,children:[(0,q.jsx)(e,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-warning`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`p`,{className:`text-body text-ink`,children:[(0,q.jsx)(`span`,{className:`tabular font-medium`,children:t}),` `,n]}),(0,q.jsx)(`p`,{className:`text-small text-muted`,children:r})]}),(0,q.jsx)(`button`,{type:`button`,onClick:i,"aria-label":`Show the ${t} ${n}`,className:`shrink-0 rounded-sm px-1.5 py-0.5 text-small text-accent hover:bg-accent-soft`,children:`Show`})]})}function it({issues:e,name:t,onShow:n}){if(e.total===0)return null;let{unset:r}=e;return(0,q.jsx)(V,{title:`To look at`,count:e.total,children:(0,q.jsxs)(`ul`,{className:`divide-y divide-line rounded-md border border-line`,children:[e.lookalikes>0&&(0,q.jsx)(J,{icon:g,count:e.lookalikes,title:e.lookalikes===1?`lookalike`:`lookalikes`,body:`Local components named ${t} that resolve elsewhere: candidates to replace with the owned one. Never counted as uses.`,onShow:()=>n({view:`lookalikes`})}),r&&(0,q.jsx)(J,{icon:qe,count:r.count,title:`${r.count===1?`site doesn't`:`sites don't`} set ${r.prop}`,body:`The contract gives ${r.prop} no default, so these render without one. Worth checking that each one means it.`,onShow:()=>n({filter:[r.prop,`unset`]})}),e.unresolved>0&&(0,q.jsx)(J,{icon:Pe,count:e.unresolved,title:e.unresolved===1?`unresolved site`:`unresolved sites`,body:`The scanner couldn't tell whether these render ${t}. They are not counted either way.`,onShow:()=>n({view:`unresolved`})})]})})}function at({prop:e,fallback:t,counts:n,active:r,onToggle:i}){let[a,o]=(0,K.useState)(!1),s=n.reduce((e,t)=>e+t.count,0),c=Math.max(1,...n.map(e=>e.count)),l=n.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),u=n.filter(e=>e.count===0&&e.value!==`unset`&&e.value!==`dynamic`),d=a?[...l,...u]:l;return(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`h4`,{className:`px-1.5 font-mono text-mono-sm text-muted`,children:e}),(0,q.jsx)(`ul`,{className:`space-y-0.5`,children:d.map(({value:n,count:a})=>{let o=r===n,l=n===`unset`||n===`dynamic`;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,"aria-pressed":o,disabled:a===0,onClick:()=>i(n),"aria-label":`${e} ${T(n,t)}: ${a} ${a===1?`site`:`sites`}`,title:a===0?`No site uses this value`:`${Math.round(a/s*100)}% of sites. Click to filter the list.`,className:w(`grid w-full grid-cols-[6.5rem_1fr_2.5rem] items-center gap-2.5 rounded-sm px-1.5 py-1 text-left transition-colors duration-100 disabled:cursor-default`,o?`bg-accent-soft`:`enabled:hover:bg-raised`),children:[(0,q.jsx)(`span`,{className:w(`truncate text-small`,l?`text-muted italic`:`font-mono text-ink-2`,a===0&&`text-faint`),children:T(n,t)}),(0,q.jsx)(`span`,{className:`h-1.5 overflow-hidden rounded-full bg-neutral-soft`,children:(0,q.jsx)(`span`,{className:w(`block h-full rounded-full`,o?`bg-accent`:l?`bg-line-strong`:`bg-ink-2`),style:{width:`${a/c*100}%`}})}),(0,q.jsx)(`span`,{className:w(`tabular text-right text-small`,a===0?`text-faint`:`text-ink-2`),children:a})]})},n)})}),u.length>0&&(0,q.jsx)(`button`,{type:`button`,onClick:()=>o(e=>!e),"aria-expanded":a,className:`px-1.5 text-left text-small text-muted hover:text-ink`,children:a?`Hide unused values`:`${u.length} unused: ${u.map(e=>e.value).join(`, `)}`})]})}function ot({contract:e,distribution:t,filters:n,onToggle:r}){return t.size===0?null:(0,q.jsx)(V,{title:`How it's used`,aside:(0,q.jsx)(`span`,{className:`text-small text-muted max-sm:hidden`,children:`Click a value to filter the sites`}),children:(0,q.jsx)(`div`,{className:`grid gap-x-10 gap-y-5 md:grid-cols-2`,children:[...t].map(([t,i])=>(0,q.jsx)(at,{prop:t,fallback:E(e,t),counts:i,active:n[t],onToggle:e=>r(t,e)},t))})})}var st=4;function ct({list:e,scheme:t,select:n}){if(e.length===0)return null;let r=e.slice(0,st),i=r.some(({screen:e})=>e.shot);return(0,q.jsx)(V,{title:`Top screens`,children:(0,q.jsx)(`ul`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:r.map(({screen:e,sites:r})=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(k,{href:a(e.project,e.route,n),className:`group block overflow-hidden rounded-md border border-line transition-colors duration-100 hover:border-line-strong hover:bg-raised`,children:[(0,q.jsx)(p,{shot:e.shot,scheme:t,size:`thumb`,label:`${e.project} ${f(e.route)}`,whenMissing:i?`placeholder`:`none`,className:`border-b border-line`}),(0,q.jsxs)(`span`,{className:`flex items-center gap-2 px-2.5 py-1.5`,children:[(0,q.jsx)(`span`,{className:`truncate font-mono text-mono-sm text-ink`,children:f(e.route)}),(0,q.jsxs)(`span`,{className:`ml-auto tabular text-small text-muted`,children:[(0,q.jsx)(`span`,{className:`text-ink-2`,children:r}),` `,r===1?`site`:`sites`]})]})]})},`${e.project}:${e.route}`))})})}var lt=24,ut={"route-file":`screen file`,"imported-by":`imported by a screen`,shell:`app shell`,unrouted:`not on a screen`};function dt({sites:e,contract:t,showAll:n}){let r=(0,K.useMemo)(()=>ae(e),[e]),c=u(t),[l,f]=(0,K.useState)({}),p=e.length<=lt;return e.length===0?(0,q.jsx)(`p`,{className:`rounded-md border border-line px-3 py-4 text-small text-muted`,children:`No site matches these filters.`}):(0,q.jsx)(`div`,{className:`space-y-4`,children:r.map(e=>(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[r.length>1&&(0,q.jsxs)(`h4`,{className:`flex items-baseline gap-2 text-small text-muted`,children:[(0,q.jsx)(`span`,{className:`font-medium text-ink`,children:e.project}),e.commit&&(0,q.jsxs)(`span`,{className:`font-mono text-mono-sm`,children:[`@`,Ae(e.commit)]})]}),(0,q.jsx)(`div`,{className:`rounded-md border border-line`,children:e.screens.map(r=>{let u=`${e.project}\u0000${r.route}`,m=l[u]??p,h=r.route===`*`?`every screen`:r.route;return(0,q.jsxs)(`div`,{className:`border-b border-line last:border-b-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center pr-2 hover:bg-raised`,children:[(0,q.jsxs)(`button`,{type:`button`,"aria-expanded":m,onClick:()=>f(e=>({...e,[u]:!m})),className:`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left`,children:[(0,q.jsx)(o,{"aria-hidden":!0,className:w(`size-3.5 shrink-0 text-faint transition-transform duration-100`,m&&`rotate-90`)}),(0,q.jsx)(`span`,{className:`truncate font-mono text-mono text-ink`,children:h}),r.route===`*`&&(0,q.jsx)(B,{tone:`outline`,children:`app shell`}),(0,q.jsx)(`span`,{className:`tabular text-small text-muted`,children:r.sites.length})]}),r.route!==`(no screen)`&&(0,q.jsx)(k,{href:a(e.project,r.route,t.id),className:`grid size-6 shrink-0 place-items-center rounded-xs text-muted hover:bg-neutral-soft hover:text-ink`,"aria-label":`Open the ${h} screen`,title:`Open the screen`,children:(0,q.jsx)(s,{className:`size-3.5`})})]}),m&&(0,q.jsx)(`ul`,{className:`pb-1.5`,children:(0,q.jsx)(d,{items:r.sites,render:e=>(0,q.jsx)(i,{site:e,choices:c,contract:t,showAll:n,aside:e.via?`via ${e.via.split(`/`).pop()}`:ut[e.routeSource]},`${e.fingerprint}:${e.line}:${e.column}`)})})]},u)})})]},e.project))})}function ft({rows:e,intro:t}){return(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`p`,{className:`text-small text-muted`,children:t}),(0,q.jsx)(`ul`,{className:`divide-y divide-line rounded-md border border-line`,children:(0,q.jsx)(d,{items:e,render:e=>(0,q.jsxs)(`li`,{className:`space-y-0.5 px-3 py-2`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,q.jsx)(c,{site:e,className:`min-w-0`}),(0,q.jsx)(`code`,{className:`shrink-0 font-mono text-mono-sm text-ink`,children:e.label})]}),(0,q.jsx)(`p`,{className:`text-small break-words text-muted`,children:e.detail})]},`${e.project}:${e.file}:${e.line}:${e.column}:${e.label}`)})})]})}function pt({model:e,contract:t,index:n}){let{scheme:r}=j(),i=(0,K.useMemo)(()=>n.sitesByElement.get(t.id)??[],[n,t.id]),[a,o]=(0,K.useState)({}),[s,c]=(0,K.useState)(`sites`),[u,d]=(0,K.useState)(!1),f=(0,K.useMemo)(()=>se(i,t),[i,t]),p=(0,K.useMemo)(()=>oe(i,a),[i,a]),h=(0,K.useMemo)(()=>P(n,t),[n,t]),g=(0,K.useMemo)(()=>m(l(n,e.manifest),t.id),[n,e.manifest,t.id]),_=n.lookalikesByElement.get(t.id)??[],v=n.unknownsByCandidate.get(t.id)??[],y=(0,K.useRef)(null),b=D(i),x=n.reports[0],S=(e,t)=>{c(`sites`),o(n=>{let{[e]:r,...i}=n;return r===t?i:{...i,[e]:t}})},ee=e=>{`view`in e?c(e.view):(c(`sites`),o({[e.filter[0]]:e.filter[1]})),requestAnimationFrame(()=>y.current?.scrollIntoView({block:`start`}))};if(i.length===0&&h.total===0)return(0,q.jsxs)(M,{icon:Ue,title:`Not used yet`,children:[`No scanned project renders `,t.name,`. It may be new, or only reached through code the scanner could not resolve.`]});let te=Object.entries(a);return(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,q.jsxs)(`div`,{className:`space-y-8 p-6 max-sm:px-4`,children:[(0,q.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-small text-muted`,children:[(0,q.jsxs)(`span`,{className:`tabular`,children:[(0,q.jsx)(`span`,{className:`text-heading text-ink`,children:b.sites}),` uses · `,(0,q.jsx)(`span`,{className:`text-ink-2`,children:b.screens}),` screens · `,(0,q.jsx)(`span`,{className:`text-ink-2`,children:b.files}),` files · `,(0,q.jsx)(`span`,{className:`text-ink-2`,children:b.projects}),` `,b.projects===1?`project`:`projects`]}),x?.status===`partial`&&(0,q.jsx)(B,{tone:`warning`,title:x.scanner,children:`Partial scan`})]}),(0,q.jsx)(it,{issues:h,name:t.name,onShow:ee}),(0,q.jsx)(ot,{contract:t,distribution:f,filters:a,onToggle:S}),(0,q.jsx)(ct,{list:g,scheme:r,select:t.id}),(0,q.jsxs)(`section`,{ref:y,"aria-labelledby":`usage-sites`,className:`scroll-mt-4 space-y-3`,children:[(0,q.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h3`,{id:`usage-sites`,className:`text-heading`,children:`Where`}),(_.length>0||v.length>0)&&(0,q.jsx)(ke,{label:`Show`,value:s,onChange:c,options:[{value:`sites`,label:`Sites`,count:p.length},..._.length>0?[{value:`lookalikes`,label:`Lookalikes`,count:_.length}]:[],...v.length>0?[{value:`unresolved`,label:`Unresolved`,count:v.length}]:[]]}),s===`sites`&&te.map(([e,n])=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>S(e,n),className:`inline-flex h-6 items-center gap-1 rounded-sm bg-accent-soft px-2 text-small text-accent hover:bg-accent-soft/70`,"aria-label":`Remove filter ${e} ${T(n,E(t,e))}`,children:[(0,q.jsx)(`span`,{className:`font-mono`,children:e}),` `,T(n,E(t,e)),` `,(0,q.jsx)(C,{className:`size-3`})]},e)),s===`sites`&&(0,q.jsxs)(`label`,{className:`ml-auto flex cursor-pointer items-center gap-1.5 text-small text-muted hover:text-ink`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked),className:`accent-accent`}),`All props`]})]}),s===`sites`&&(0,q.jsx)(dt,{sites:p,contract:t,showAll:u},JSON.stringify(a)),s===`lookalikes`&&(0,q.jsx)(ft,{intro:`Components named like ${t.name} that resolve elsewhere: candidates to replace with the owned one. Not counted as uses.`,rows:_.map(e=>({project:e.project,file:e.file,line:e.line,column:e.column,label:`<${e.local}>`,detail:`Resolves to ${e.resolved}`}))}),s===`unresolved`&&(0,q.jsx)(ft,{intro:`Sites the scanner could not resolve. They might be this component; they are never counted as zero.`,rows:v.map(e=>({project:e.project,file:e.file,line:e.line,column:e.column,label:e.name,detail:`${e.reason}: ${e.detail}`}))})]})]})})}function mt({model:e,contract:t,usage:n}){return n.status===`ready`?(0,q.jsx)(pt,{model:e,contract:t,index:n.value}):(0,q.jsx)(fe,{state:n,onRetry:ie,what:`the usage map`})}var ht=1600,Y=`youiyoux sync`,gt=`@/components/ui`;function _t(e){let t=new Set;for(let{code:n}of e)for(let e of n.matchAll(/from\s+"([^".][^"]*)"/g)){let n=e[1],r=n.startsWith(`@`)?n.split(`/`).slice(0,2).join(`/`):n.split(`/`)[0];r!==`react`&&r!==`react-dom`&&t.add(r)}return[...t].sort()}function vt(e){let{source:t}=e.contract;return`import { ${[t.export,...t.also].join(`, `)} } from "${gt}";`}function yt({entry:e,onClose:t}){let n=_t(e.files);return(0,q.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg border border-line bg-sunken p-4 animate-enter`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-line bg-surface py-1 pr-1 pl-3 font-mono text-mono`,children:[(0,q.jsx)(`span`,{className:`text-faint select-none`,children:`$`}),(0,q.jsx)(`span`,{className:`flex-1 text-ink`,children:Y}),(0,q.jsx)(v,{value:Y,label:`Copy sync command`})]}),(0,q.jsxs)(`p`,{className:`text-small text-muted`,children:[`Run in a project, it vendors every component of the system, `,e.contract.name,`’s `,(0,q.jsx)(`span`,{className:`font-mono text-ink-2`,children:e.files.map(e=>e.path).join(`, `)}),` among them, into the project’s components folder as owned code, records each file in `,(0,q.jsx)(`span`,{className:`font-mono text-ink-2`,children:`youi.lock.json`}),`, and merges later updates with the project’s own edits. A project not set up yet starts with `,(0,q.jsx)(`span`,{className:`font-mono text-ink-2`,children:`youiyoux init --design <dir>`}),`.`]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-small text-muted`,children:[n.length>0&&(0,q.jsxs)(q.Fragment,{children:[`Adds`,n.map(e=>(0,q.jsx)(B,{tone:`outline`,className:`font-mono`,children:e},e))]}),(0,q.jsx)(`button`,{type:`button`,onClick:t,className:`ml-auto text-small text-muted hover:text-ink`,children:`Close`})]})]})}function bt(){let[e,t]=(0,K.useState)(``);return(0,K.useEffect)(()=>{if(!e)return;let n=setTimeout(()=>t(``),ht);return()=>clearTimeout(n)},[e]),{status:e,copy:(e,n)=>{navigator.clipboard.writeText(e).then(()=>t(`Copied ${n}`),()=>t(`The browser blocked the clipboard`))}}}function xt({model:e,entry:t,tab:n}){let{contract:r}=t,[,i]=N(),[a,o]=(0,K.useState)(!1),{status:s,copy:c}=bt(),l=O(),u=l.status===`ready`?l.value.sitesByElement.get(r.id)?.length??0:void 0,d=l.status===`ready`?P(l.value,r).total:0,f=ve(r.id)?.name??r.name.toLowerCase(),p=r.owners.map(e=>e.replace(/^group:/,``));return(0,q.jsxs)(`article`,{className:`flex min-h-0 flex-1 flex-col animate-enter`,children:[(0,q.jsxs)(`header`,{className:`shrink-0 px-6 pt-5 pb-4 max-sm:px-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h2`,{"data-detail-heading":!0,tabIndex:-1,className:`truncate text-title outline-none`,children:r.name}),(0,q.jsx)(R,{status:r.status})]}),(0,q.jsx)(`p`,{className:`max-w-2xl text-reading text-ink-2`,children:r.summary})]}),(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,q.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-small text-muted max-md:sr-only`,children:s}),(0,q.jsx)(F,{variant:`primary`,asChild:!0,children:(0,q.jsxs)(k,{href:`/changes`,children:[(0,q.jsx)(b,{}),` `,(0,q.jsx)(`span`,{className:`max-sm:hidden`,children:`Propose change`})]})}),(0,q.jsx)(Je,{label:`More for ${r.name}`,items:[{label:`Copy sync command`,detail:Y,icon:y,onSelect:()=>c(Y,`the sync command`)},{label:`Copy import`,detail:vt(t),icon:Ie,onSelect:()=>c(vt(t),`the import`)},{label:`Copy element id`,detail:r.id,icon:Ve,onSelect:()=>c(r.id,`the element id`)},{label:`What sync does`,detail:`Files, lockfile and dependencies`,icon:Ge,onSelect:()=>o(!0)}],children:(0,q.jsx)(Re,{})})]})]}),(0,q.jsxs)(`p`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-small text-muted`,children:[(0,q.jsxs)(`span`,{className:`tabular`,children:[`v`,r.version]}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-faint`,children:`·`}),(0,q.jsx)(`span`,{children:r.platforms.join(`, `)}),p.length>0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-faint`,children:`·`}),(0,q.jsx)(`span`,{children:p.join(`, `)})]}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-faint`,children:`·`}),(0,q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center font-mono text-mono-sm text-faint`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:r.id}),(0,q.jsx)(v,{value:r.id,label:`Copy element id`,className:`size-5`})]})]}),a&&(0,q.jsx)(yt,{entry:t,onClose:()=>o(!1)})]}),(0,q.jsxs)(Ee,{value:n,onValueChange:e=>{let t=I(r.id,e);me(t),i(t,{replace:!0})},className:`flex min-h-0 flex-1 flex-col`,children:[(0,q.jsxs)(Te,{"aria-label":`${r.name} sections`,className:`max-sm:px-4`,children:[(0,q.jsx)(H,{value:`overview`,children:`Overview`}),(0,q.jsxs)(H,{value:`usage`,count:u,children:[`Usage`,d>0&&(0,q.jsx)(`span`,{"aria-label":`${d} to look at`,className:`size-1.5 rounded-full bg-warning`})]}),(0,q.jsx)(H,{value:`contract`,children:`Contract & tokens`}),(0,q.jsx)(H,{value:`rules`,count:r.rules.length,children:`Rules`})]}),(0,q.jsx)(U,{value:`overview`,className:`min-h-0 flex-1 overflow-y-auto outline-none`,children:(0,q.jsx)(rt,{model:e,name:f,contract:r,usage:l})}),(0,q.jsx)(U,{value:`usage`,className:`flex min-h-0 flex-1 flex-col outline-none`,children:(0,q.jsx)(mt,{model:e,contract:r,usage:l})}),(0,q.jsx)(U,{value:`contract`,className:`min-h-0 flex-1 overflow-y-auto outline-none`,children:(0,q.jsx)(et,{model:e,entry:t})}),(0,q.jsx)(U,{value:`rules`,className:`min-h-0 flex-1 overflow-y-auto outline-none`,children:(0,q.jsx)(S,{model:e,contract:r})})]})]})}function St({model:e,id:t,tab:n}){let r=e.components.get(t);if(r)return(0,q.jsx)(xt,{model:e,entry:r,tab:n},t);let i=e.tokens.get(t);if(i)return(0,q.jsx)(x,{model:e,token:i},t);let a=e.rules.get(t);return a?(0,q.jsx)(ee,{model:e,rule:a},t):(0,q.jsxs)(M,{icon:Be,title:`No such element`,actions:(0,q.jsx)(F,{asChild:!0,children:(0,q.jsx)(k,{href:`/elements`,children:`All elements`})}),children:[(0,q.jsx)(`code`,{className:`font-mono text-mono-sm`,children:t}),` is not part of `,e.catalog.system.name,` v`,e.catalog.system.version,`.`]})}var Ct=32,wt=30,Tt=12,Et={component:`Components`,rule:`Rules`},X=e=>Et[e.group]??`${e.group[0].toUpperCase()}${e.group.slice(1)} tokens`;function Dt(e,t){if(!t)return e.map((e,t)=>({type:`item`,element:e,index:t}));let n=new Map;for(let t of e)n.set(X(t),(n.get(X(t))??0)+1);let r=[],i=``;return e.forEach((e,t)=>{let a=X(e);a!==i&&(r.push({type:`header`,label:a,count:n.get(a)??0}),i=a),r.push({type:`item`,element:e,index:t})}),r}function Ot({element:e}){return e.status?e.status===`stable`?null:(0,q.jsx)(R,{status:e.status}):e.severity?(0,q.jsx)(z,{severity:e.severity}):null}function kt({model:e,results:t,grouped:n,selectedId:r,tab:i,query:a,onQuery:o,filter:s,onFilter:c,counts:l,total:u,searchMs:d}){let[,f]=N(),{scheme:p}=j(),m=(0,K.useRef)(null),g=(0,K.useMemo)(()=>Dt(t,n),[t,n]),_=je({count:g.length,getScrollElement:()=>m.current,estimateSize:e=>g[e]?.type===`header`?wt:Ct,getItemKey:(0,K.useCallback)(e=>{let t=g[e];return t?t.type===`header`?`h:${t.label}`:t.element.id:e},[g]),overscan:Tt}),v=t.findIndex(e=>e.id===r),y=e=>I(e.id,e.kind===`component`?i:void 0);return de({count:t.length,index:v,onMove:e=>{let n=t[e];n&&(me(y(n)),f(y(n),{replace:!0}))},onOpen:()=>document.querySelector(`[data-detail-heading]`)?.focus()}),(0,K.useEffect)(()=>{let e=g.findIndex(e=>e.type===`item`&&e.element.id===r);e>=0&&_.scrollToIndex(e,{align:`auto`})},[g,r,_]),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ge,{title:`Elements`,count:e.elements.length}),(0,q.jsxs)(`div`,{className:`space-y-2 border-b border-line p-3`,children:[(0,q.jsx)(Me,{value:a,onChange:o,label:`Search elements`,placeholder:`Search name, value, prop, rule…`}),(0,q.jsx)(ke,{label:`Element kind`,value:s,onChange:c,className:`w-full [&>button]:flex-1 [&>button]:justify-center`,options:[{value:`all`,label:`All`,count:u},{value:`component`,label:`Components`,count:l.component},{value:`token`,label:`Tokens`,count:l.token},{value:`rule`,label:`Rules`,count:l.rule}]})]}),t.length===0?(0,q.jsxs)(M,{icon:te,title:`No matches`,actions:(0,q.jsx)(F,{size:`sm`,onClick:()=>(o(``),c(`all`)),children:`Clear search`}),children:[`Nothing in `,e.catalog.system.name,` matches “`,a.trim(),`”`,s===`all`?``:` among ${s}s`,`.`]}):(0,q.jsx)(`div`,{ref:m,"data-list-pane":!0,className:`min-h-0 flex-1 overflow-y-auto py-1.5`,children:(0,q.jsx)(`div`,{role:`list`,"aria-label":`Elements`,className:`relative w-full`,style:{height:_.getTotalSize()},children:_.getVirtualItems().map(e=>{let t=g[e.index],n={height:e.size,transform:`translateY(${e.start}px)`};if(t.type===`header`)return(0,q.jsxs)(`div`,{role:`presentation`,className:`absolute inset-x-0 top-0 flex items-end gap-2 px-4.5 pb-1 text-caption text-muted`,style:n,children:[t.label,(0,q.jsx)(`span`,{className:`tabular text-faint`,children:t.count})]},e.key);let{element:i}=t,a=i.id===r;return(0,q.jsx)(`div`,{role:`listitem`,className:`absolute inset-x-0 top-0 px-1.5`,style:n,children:(0,q.jsxs)(k,{href:y(i),"aria-current":a?`true`:void 0,className:w(`flex h-full items-center gap-2.5 rounded-md px-3 transition-colors duration-75`,a?`bg-accent-soft text-ink`:`text-ink-2 hover:bg-raised hover:text-ink`),children:[(0,q.jsx)(h,{element:i,scheme:p}),(0,q.jsx)(`span`,{className:w(`truncate`,a?`font-medium`:``),children:i.name}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-mono-sm text-faint`,children:i.kind===`rule`||i.key!==i.name?i.kind===`token`?``:i.key:``}),(0,q.jsx)(Ot,{element:i})]})},e.key)})})}),(0,q.jsxs)(`footer`,{className:`flex h-8 shrink-0 items-center justify-between border-t border-line px-4 text-caption text-muted`,children:[(0,q.jsx)(`span`,{className:`tabular`,children:t.length===e.elements.length?`${t.length} elements`:`${t.length} of ${e.elements.length}`}),d!==null&&(0,q.jsxs)(`span`,{className:`tabular`,children:[`searched in `,d.toFixed(1),` ms`]})]})]})}var At=[`token`,`component`,`rule`,`migration`];function jt(e){let[t,n,r,i]=e.split(`/`),a=At.find(e=>e===n);return{id:t&&a&&r?_e(t,a,r):null,tab:le(i)}}function Mt(){let e=ne();return e.status===`ready`?(0,q.jsx)(Nt,{model:e.value}):(0,q.jsx)(fe,{state:e,onRetry:re,what:`the catalog`})}function Nt({model:e}){let{id:t,tab:n}=jt(he()[`*`]??``),[r,i]=(0,K.useState)(``),[a,o]=(0,K.useState)(`all`),s=be(e,r),c=(0,K.useMemo)(()=>s.ids===null?e.elements:s.ids.flatMap(t=>e.byId.get(t)??[]),[e,s.ids]),l=(0,K.useMemo)(()=>a===`all`?c:c.filter(e=>e.kind===a),[c,a]),u=(0,K.useMemo)(()=>ue(c),[c]);return(0,q.jsx)(ce,{listLabel:`Elements`,backHref:`/elements`,hasDetail:t!==null,list:(0,q.jsx)(kt,{model:e,results:l,grouped:s.ids===null,selectedId:t,tab:n,query:r,onQuery:i,filter:a,onFilter:o,counts:u,total:c.length,searchMs:s.totalMs}),detail:t?(0,q.jsx)(St,{model:e,id:t,tab:n}):(0,q.jsx)(Lt,{model:e})})}var Pt=16,Ft=3,Z=`flex min-h-10 items-center gap-3 px-3 py-2 hover:bg-raised`,Q=`divide-y divide-line overflow-hidden rounded-md border border-line`;function It({value:e,unit:t}){return e===null?(0,q.jsx)(`span`,{className:`tabular text-small text-faint`,children:`–`}):(0,q.jsxs)(`span`,{className:`shrink-0 tabular text-small text-muted`,children:[(0,q.jsx)(`span`,{className:`text-ink`,children:e}),` `,t]})}function Lt({model:e}){let{scheme:t}=j(),n=O();return(0,q.jsx)($,{model:e,index:n.status===`ready`?n.value:null,scheme:t})}function $({model:e,index:t,scheme:n}){let r=ue(e.elements),{system:i}=e.catalog,a=e.elements.filter(e=>e.kind===`component`),o=e.elements.filter(e=>e.kind===`rule`),s=new Map;for(let t of e.elements)t.kind===`token`&&ye(s,t.group,t);let c=[...s];return(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,q.jsxs)(`div`,{"data-system-overview":!0,className:`mx-auto max-w-4xl space-y-8 px-8 py-8 max-md:px-5`,children:[(0,q.jsxs)(`header`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,q.jsx)(`h2`,{className:`text-display`,children:i.name}),(0,q.jsxs)(B,{tone:`outline`,className:`tabular`,children:[`v`,i.version]})]}),(0,q.jsxs)(`p`,{className:`text-reading text-muted`,children:[r.component,` `,L(r.component,`component`),`, `,r.token,` `,L(r.token,`token`),` and `,r.rule,` `,L(r.rule,`rule`),`. Pick one to see its contract, tokens, rules and where it lives.`]}),(0,q.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5 text-small text-muted`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(A,{keys:[`j`]}),` `,(0,q.jsx)(A,{keys:[`k`]}),` browse`]}),(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(A,{keys:[`/`]}),` search`]}),(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(A,{keys:[`⌘`,`K`]}),` jump anywhere`]})]})]}),(0,q.jsx)(V,{title:`Components`,count:a.length,children:(0,q.jsx)(`ul`,{className:Q,children:a.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(k,{href:I(e.id),className:Z,children:[(0,q.jsx)(h,{element:e,scheme:n}),(0,q.jsx)(`span`,{className:`shrink-0 font-medium text-ink`,children:e.name}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-small text-muted`,children:e.summary}),e.status&&e.status!==`stable`&&(0,q.jsx)(R,{status:e.status}),(0,q.jsx)(It,{value:t?t.sitesByElement.get(e.id)?.length??0:null,unit:`sites`})]})},e.id))})}),(0,q.jsx)(V,{title:`Tokens`,count:r.token,children:(0,q.jsx)(`ul`,{className:Q,children:c.map(([e,t])=>{let r=t.flatMap(e=>e.swatch?[e.swatch[n]]:[]);return(0,q.jsx)(`li`,{children:(0,q.jsxs)(k,{href:I(t[0].id),className:Z,children:[(0,q.jsx)(`span`,{className:`w-28 shrink-0 font-medium text-ink capitalize`,children:e}),(0,q.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1 overflow-hidden`,children:r.length>0?r.slice(0,Pt).map((e,t)=>(0,q.jsx)(xe,{color:e,size:`sm`},t)):(0,q.jsx)(`span`,{className:`truncate font-mono text-mono-sm text-muted`,children:t.slice(0,Ft).map(e=>e.name).join(` `)})}),(0,q.jsx)(`span`,{className:`shrink-0 tabular text-small text-muted`,children:t.length})]})},e)})})}),(0,q.jsx)(V,{title:`Rules`,count:o.length,children:(0,q.jsx)(`ul`,{className:Q,children:o.map(e=>{let r=t?t.violationsByRule.get(e.id)?.length??0:null;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(k,{href:I(e.id),className:Z,children:[(0,q.jsx)(h,{element:e,scheme:n}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ink`,children:e.name}),e.severity&&(0,q.jsx)(z,{severity:e.severity}),r===0?(0,q.jsx)(`span`,{className:`shrink-0 text-small text-success`,children:`Clean`}):(0,q.jsx)(It,{value:r,unit:r===1?`violation`:`violations`})]})},e.id)})})})]})})}export{Mt as CatalogScreen,$ as SystemOverview,jt as readSelection};
|
|
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{a as i,c as a,d as o,f as s,i as c,l,o as u,r as d,s as f,t as p,u as m}from"./ScreenImage-CyhKm_nj.js";import{t as h}from"./KindIcon-BJ6bz-ny.js";import{n as g,r as _,t as v}from"./CopyButton-DE8drl4P.js";import{t as y}from"./download-BQI-Si9R.js";import{t as b}from"./git-pull-request-arrow-RqUUIRCU.js";import{t as x}from"./TokenDetail-CDY1xxb9.js";import{r as S,t as ee}from"./RuleDetail-C2fTlLJL.js";import{c as te}from"./contrast-B-uhyF_b.js";import{t as C}from"./x-MLbFVa4v.js";import{t as w}from"./clsx-DB0hHKMi.js";import{$ as T,H as ne,J as E,L as re,Q as D,R as ie,U as O,X as ae,Y as oe,Z as se,a as ce,at as le,dt as k,et as ue,f as A,g as de,i as fe,it as pe,k as me,m as j,mt as he,n as ge,nt as _e,o as M,pt as N,q as P,rt as ve,s as F,st as ye,tt as I}from"./main-cvOFSjox.js";import{t as L}from"./plural-BbGQPQKA.js";import{i as R,r as z,t as B}from"./Badge-CUJUit4d.js";import{useSearch as be}from"./client-Bdgr12LP.js";import{t as xe}from"./Swatch-KDz4qxdM.js";import{n as V,r as Se,t as Ce}from"./Section-BTnvUq_W.js";import{n as we}from"./TokenValue-CsPRc2ai.js";import{i as H,n as U,r as Te,t as Ee}from"./Tabs-DU-fFRDV.js";import{t as De}from"./CodeBlock-CsiGFgvI.js";import{r as W,t as Oe}from"./Preview-DWFP0BIe.js";import{t as ke}from"./Segmented-Dzi1x49S.js";import{n as Ae}from"./format-DxAYNTN_.js";import{t as je}from"./esm-NPpg23M8.js";import{t as Me}from"./SearchField-hF-6-YDM.js";var Ne={name:`circle-question-mark`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`help-circle`,`circle-help`]};Ne.node;var Pe=r(Ne),Fe={name:`clipboard-copy`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2`,key:`4jdomd`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v4`,key:`3hqy98`}],[`path`,{d:`M21 14H11`,key:`1bme5i`}],[`path`,{d:`m15 10-4 4 4 4`,key:`5dvupr`}]]};Fe.node;var Ie=r(Fe),Le={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};Le.node;var Re=r(Le),ze={name:`file-question-mark`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]],aliases:[`file-question`]};ze.node;var Be=r(ze),G={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};G.node;var Ve=r(G),He={name:`map-pin-off`,size:24,node:[[`path`,{d:`M12.75 7.09a3 3 0 0 1 2.16 2.16`,key:`1d4wjd`}],[`path`,{d:`M17.072 17.072c-1.634 2.17-3.527 3.912-4.471 4.727a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 1.432-4.568`,key:`12yil7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.475 2.818A8 8 0 0 1 20 10c0 1.183-.31 2.377-.81 3.533`,key:`lhrkcz`}],[`path`,{d:`M9.13 9.13a3 3 0 0 0 3.74 3.74`,key:`13wojd`}]]};He.node;var Ue=r(He),We={name:`package-open`,size:24,node:[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]};We.node;var Ge=r(We),Ke={name:`square-dashed`,size:24,node:[[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M21 19a2 2 0 0 1-2 2`,key:`1j7049`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M9 3h1`,key:`1yesri`}],[`path`,{d:`M9 21h1`,key:`15o7lz`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M14 21h1`,key:`v9vybs`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M21 9v1`,key:`mxsmne`}],[`path`,{d:`M3 14v1`,key:`vnatye`}],[`path`,{d:`M21 14v1`,key:`169vum`}]],aliases:[`box-select`]};Ke.node;var qe=r(Ke),K=e(t(),1),q=n();function Je({label:e,children:t,items:n}){let[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(`first`),s=(0,K.useRef)(null),c=(0,K.useRef)(null),l=(0,K.useId)(),u=()=>[...c.current?.querySelectorAll(`[role=menuitem]`)??[]],d=e=>{i(!1),e&&s.current?.focus()};return(0,K.useEffect)(()=>{if(!r)return;let e=u();(a===`first`?e[0]:e.at(-1))?.focus();let t=e=>{let t=e.target;!c.current?.contains(t)&&!s.current?.contains(t)&&i(!1)};return document.addEventListener(`pointerdown`,t),()=>document.removeEventListener(`pointerdown`,t)},[r,a]),(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(F,{ref:s,"aria-label":e,"aria-haspopup":`menu`,"aria-expanded":r,"aria-controls":r?l:void 0,onClick:()=>{o(`first`),i(e=>!e)},onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),o(e.key===`ArrowDown`?`first`:`last`),i(!0))},children:t}),r&&(0,q.jsx)(`div`,{ref:c,id:l,role:`menu`,"aria-label":e,onKeyDown:e=>{let t=u(),n=t.findIndex(e=>e===document.activeElement),r=n=>{e.preventDefault(),t[(n+t.length)%t.length]?.focus()};e.key===`ArrowDown`?r(n+1):e.key===`ArrowUp`?r(n-1):e.key===`Home`?r(0):e.key===`End`?r(t.length-1):e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),d(!0)):e.key===`Tab`&&d(!1)},className:`absolute top-full right-0 z-20 mt-1 w-72 rounded-lg border border-line bg-surface p-1 shadow-popover origin-top-right animate-menu`,children:n.map(e=>(0,q.jsxs)(`button`,{type:`button`,role:`menuitem`,tabIndex:-1,onClick:()=>{e.onSelect(),d(!0)},className:`flex w-full items-start gap-2.5 rounded-md px-2 py-1.5 text-left outline-none hover:bg-raised focus-visible:bg-raised focus-visible:outline-none`,children:[e.icon&&(0,q.jsx)(e.icon,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0 text-muted`}),(0,q.jsxs)(`span`,{className:`min-w-0`,children:[(0,q.jsx)(`span`,{className:`block text-body text-ink`,children:e.label}),e.detail&&(0,q.jsx)(`span`,{className:`block truncate font-mono text-mono-sm text-muted`,children:e.detail})]})]},e.label))})]})}function Ye({token:e,scheme:t}){let n=e[t];return(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[e.type===`color`&&(0,q.jsx)(xe,{color:n,size:`sm`}),(0,q.jsx)(`span`,{className:`truncate font-mono text-mono-sm text-ink-2`,title:n,children:n})]})}function Xe({model:e,contract:t}){let n=Object.entries(t.tokens);return n.length===0?null:(0,q.jsx)(V,{title:`Token bindings`,count:n.length,children:(0,q.jsx)(Se,{head:[`Role`,`Token`,`Light`,`Dark`],children:n.map(([t,n])=>{let r=e.tokens.get(n);return(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{className:`font-mono text-mono whitespace-nowrap text-ink`,children:t}),(0,q.jsx)(`td`,{className:`whitespace-nowrap`,children:(0,q.jsx)(k,{href:I(n),className:`font-mono text-mono text-accent hover:underline`,children:pe(n)})}),(0,q.jsx)(`td`,{className:`max-w-56`,children:r?(0,q.jsx)(Ye,{token:r,scheme:`light`}):(0,q.jsx)(`span`,{className:`text-danger`,children:`Unknown token`})}),(0,q.jsx)(`td`,{className:`max-w-56`,children:r&&(0,q.jsx)(Ye,{token:r,scheme:`dark`})})]},t)})})})}function Ze({spec:e}){return e.type===`enum`?(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.values.map(t=>(0,q.jsx)(B,{tone:t===e.default?`accent`:`neutral`,className:`font-mono`,children:t},t))}):(0,q.jsx)(`span`,{className:`font-mono text-mono-sm text-ink-2`,children:e.type})}var Qe=e=>`default`in e&&e.default!==void 0?String(e.default):null;function $e({items:e,tone:t}){let n=t===`do`?_:C;return(0,q.jsxs)(`ul`,{className:`space-y-2 rounded-md border border-line p-3`,children:[(0,q.jsx)(`li`,{className:`text-caption text-muted`,children:t===`do`?`Do`:`Don't`}),e.map(e=>(0,q.jsxs)(`li`,{className:`flex gap-2 text-body text-ink-2`,children:[(0,q.jsx)(n,{className:t===`do`?`mt-0.5 size-3.5 shrink-0 text-success`:`mt-0.5 size-3.5 shrink-0 text-danger`}),e]},e))]})}function et({model:e,entry:t}){let{contract:n,files:r}=t,i=Object.entries(n.props);return(0,q.jsxs)(`div`,{className:`space-y-8 p-6 max-sm:px-4`,children:[(0,q.jsx)(V,{title:`Props`,count:i.length,aside:n.passthrough&&(0,q.jsxs)(`span`,{className:`text-small text-muted`,children:[`Other props pass through to `,(0,q.jsxs)(`code`,{className:`font-mono text-ink-2`,children:[`<`,n.passthrough,`>`]})]}),children:(0,q.jsx)(Se,{head:[`Prop`,`Type`,`Default`,`Description`],children:i.map(([e,t])=>(0,q.jsxs)(`tr`,{children:[(0,q.jsxs)(`td`,{className:`font-mono text-mono whitespace-nowrap text-ink`,children:[e,t.required&&(0,q.jsx)(`span`,{className:`text-danger`,"aria-label":`required`,children:`*`})]}),(0,q.jsx)(`td`,{children:(0,q.jsx)(Ze,{spec:t})}),(0,q.jsx)(`td`,{className:`font-mono text-mono-sm text-muted`,children:Qe(t)??`–`}),(0,q.jsxs)(`td`,{className:`min-w-56 text-small text-ink-2`,children:[t.description??``,t.deprecated&&(0,q.jsxs)(`span`,{className:`block text-warning`,children:[`Deprecated: `,t.deprecated]})]})]},e))})}),(0,q.jsx)(Xe,{model:e,contract:n}),(0,q.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-2`,children:[(0,q.jsxs)(V,{title:`Accessibility`,children:[(0,q.jsx)(Ce,{rows:[[`Role`,n.a11y.role?(0,q.jsx)(`code`,{className:`font-mono text-mono`,children:n.a11y.role}):`–`],[`Touch target`,n.a11y.minTouchTarget?`${n.a11y.minTouchTarget}px minimum`:`–`]]}),n.a11y.notes.length>0&&(0,q.jsx)(`ul`,{className:`space-y-1.5 pt-1`,children:n.a11y.notes.map(e=>(0,q.jsxs)(`li`,{className:`flex gap-2 text-body text-ink-2`,children:[(0,q.jsx)(o,{className:`mt-1 size-3 shrink-0 text-faint`}),e]},e))})]}),(0,q.jsx)(V,{title:`Source`,children:(0,q.jsx)(Ce,{rows:[[`Export`,(0,q.jsx)(`code`,{className:`font-mono text-mono`,children:n.source.export})],[`Also exports`,n.source.also.length?(0,q.jsx)(`code`,{className:`font-mono text-mono`,children:n.source.also.join(`, `)}):`–`],[`Aliases`,n.aliases.length?(0,q.jsx)(`code`,{className:`font-mono text-mono`,children:n.aliases.join(`, `)}):`–`],[`File`,(0,q.jsx)(`code`,{className:`font-mono text-mono`,children:n.source.file})]]})})]}),(n.guidance.do.length>0||n.guidance.dont.length>0)&&(0,q.jsx)(V,{title:`Guidance`,children:(0,q.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[n.guidance.do.length>0&&(0,q.jsx)($e,{items:n.guidance.do,tone:`do`}),n.guidance.dont.length>0&&(0,q.jsx)($e,{items:n.guidance.dont,tone:`dont`})]})}),(0,q.jsx)(V,{title:`Owned files`,count:r.length,children:(0,q.jsx)(`div`,{className:`grid gap-3`,children:r.map(e=>(0,q.jsx)(De,{title:e.path,code:e.code},e.path))})})]})}function tt({model:e,contract:t,index:n}){let r=n.sitesByElement.get(t.id)??[],i=D(r),a=P(n,t),o=m(l(n,e.manifest),t.id),s=I(t.id,`usage`);if(r.length===0&&a.total===0)return(0,q.jsxs)(`p`,{className:`rounded-lg border border-dashed border-line px-4 py-3 text-small text-muted`,children:[`No scanned project renders `,t.name,` yet.`]});let c=[a.lookalikes>0&&`${a.lookalikes} lookalike${a.lookalikes===1?``:`s`}`,a.unset&&`${a.unset.count} without ${a.unset.prop}`,a.unresolved>0&&`${a.unresolved} unresolved`].filter(Boolean),u=o[0];return(0,q.jsxs)(`p`,{"data-headline":!0,className:`text-title text-ink-2`,children:[(0,q.jsx)(W,{value:i.sites,href:s}),` `,L(i.sites,`use`),` in `,i.files,` `,L(i.files,`file`),` across `,i.projects,` `,L(i.projects,`project`),`, on `,(0,q.jsx)(W,{value:i.screens,href:s}),` `,L(i.screens,`screen`),u&&(0,q.jsxs)(q.Fragment,{children:[` `,`(most on `,(0,q.jsx)(`span`,{className:`font-mono text-mono`,children:f(u.screen.route)}),`)`]}),a.total>0?(0,q.jsxs)(q.Fragment,{children:[`, with `,(0,q.jsx)(W,{value:a.total,href:s}),` to look at: `,c.join(`, `),`.`]}):(0,q.jsxs)(q.Fragment,{children:[`, with `,(0,q.jsx)(W,{value:`nothing`,clean:!0}),` flagged.`]})]})}var nt=[`min(36rem, 100%)`,`min(22rem, 70%)`];function rt({model:e,name:t,contract:n,usage:r}){return(0,q.jsxs)(`div`,{className:`space-y-8 p-6 max-sm:px-4`,children:[(0,q.jsx)(Oe,{name:t,contract:n,paper:{light:we(e,`light`).background,dark:we(e,`dark`).background}}),r.status===`ready`?(0,q.jsx)(tt,{model:e,contract:n,index:r.value}):(0,q.jsx)(`div`,{"aria-busy":r.status!==`error`,"aria-label":r.status===`error`?`Usage could not be loaded`:`Loading usage`,className:`space-y-2`,children:nt.map((e,t)=>(0,q.jsx)(`div`,{className:`h-4 rounded-xs bg-raised`,style:{width:e}},t))}),n.examples.length>0&&(0,q.jsx)(V,{title:`Examples`,count:n.examples.length,children:(0,q.jsx)(`div`,{className:`grid gap-3`,children:n.examples.map(e=>(0,q.jsx)(De,{title:e.title,code:e.code,maxHeight:`sm`},e.title))})})]})}function J({icon:e,count:t,title:n,body:r,onShow:i}){return(0,q.jsxs)(`li`,{className:`flex items-start gap-3 px-3 py-2.5`,children:[(0,q.jsx)(e,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-warning`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`p`,{className:`text-body text-ink`,children:[(0,q.jsx)(`span`,{className:`tabular font-medium`,children:t}),` `,n]}),(0,q.jsx)(`p`,{className:`text-small text-muted`,children:r})]}),(0,q.jsx)(`button`,{type:`button`,onClick:i,"aria-label":`Show the ${t} ${n}`,className:`shrink-0 rounded-sm px-1.5 py-0.5 text-small text-accent hover:bg-accent-soft`,children:`Show`})]})}function it({issues:e,name:t,onShow:n}){if(e.total===0)return null;let{unset:r}=e;return(0,q.jsx)(V,{title:`To look at`,count:e.total,children:(0,q.jsxs)(`ul`,{className:`divide-y divide-line rounded-md border border-line`,children:[e.lookalikes>0&&(0,q.jsx)(J,{icon:g,count:e.lookalikes,title:e.lookalikes===1?`lookalike`:`lookalikes`,body:`Local components named ${t} that resolve elsewhere: candidates to replace with the owned one. Never counted as uses.`,onShow:()=>n({view:`lookalikes`})}),r&&(0,q.jsx)(J,{icon:qe,count:r.count,title:`${r.count===1?`site doesn't`:`sites don't`} set ${r.prop}`,body:`The contract gives ${r.prop} no default, so these render without one. Worth checking that each one means it.`,onShow:()=>n({filter:[r.prop,`unset`]})}),e.unresolved>0&&(0,q.jsx)(J,{icon:Pe,count:e.unresolved,title:e.unresolved===1?`unresolved site`:`unresolved sites`,body:`The scanner couldn't tell whether these render ${t}. They are not counted either way.`,onShow:()=>n({view:`unresolved`})})]})})}function at({prop:e,fallback:t,counts:n,active:r,onToggle:i}){let[a,o]=(0,K.useState)(!1),s=n.reduce((e,t)=>e+t.count,0),c=Math.max(1,...n.map(e=>e.count)),l=n.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),u=n.filter(e=>e.count===0&&e.value!==`unset`&&e.value!==`dynamic`),d=a?[...l,...u]:l;return(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`h4`,{className:`px-1.5 font-mono text-mono-sm text-muted`,children:e}),(0,q.jsx)(`ul`,{className:`space-y-0.5`,children:d.map(({value:n,count:a})=>{let o=r===n,l=n===`unset`||n===`dynamic`;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,"aria-pressed":o,disabled:a===0,onClick:()=>i(n),"aria-label":`${e} ${T(n,t)}: ${a} ${a===1?`site`:`sites`}`,title:a===0?`No site uses this value`:`${Math.round(a/s*100)}% of sites. Click to filter the list.`,className:w(`grid w-full grid-cols-[6.5rem_1fr_2.5rem] items-center gap-2.5 rounded-sm px-1.5 py-1 text-left transition-colors duration-100 disabled:cursor-default`,o?`bg-accent-soft`:`enabled:hover:bg-raised`),children:[(0,q.jsx)(`span`,{className:w(`truncate text-small`,l?`text-muted italic`:`font-mono text-ink-2`,a===0&&`text-faint`),children:T(n,t)}),(0,q.jsx)(`span`,{className:`h-1.5 overflow-hidden rounded-full bg-neutral-soft`,children:(0,q.jsx)(`span`,{className:w(`block h-full rounded-full`,o?`bg-accent`:l?`bg-line-strong`:`bg-ink-2`),style:{width:`${a/c*100}%`}})}),(0,q.jsx)(`span`,{className:w(`tabular text-right text-small`,a===0?`text-faint`:`text-ink-2`),children:a})]})},n)})}),u.length>0&&(0,q.jsx)(`button`,{type:`button`,onClick:()=>o(e=>!e),"aria-expanded":a,className:`px-1.5 text-left text-small text-muted hover:text-ink`,children:a?`Hide unused values`:`${u.length} unused: ${u.map(e=>e.value).join(`, `)}`})]})}function ot({contract:e,distribution:t,filters:n,onToggle:r}){return t.size===0?null:(0,q.jsx)(V,{title:`How it's used`,aside:(0,q.jsx)(`span`,{className:`text-small text-muted max-sm:hidden`,children:`Click a value to filter the sites`}),children:(0,q.jsx)(`div`,{className:`grid gap-x-10 gap-y-5 md:grid-cols-2`,children:[...t].map(([t,i])=>(0,q.jsx)(at,{prop:t,fallback:E(e,t),counts:i,active:n[t],onToggle:e=>r(t,e)},t))})})}var st=4;function ct({list:e,scheme:t,select:n}){if(e.length===0)return null;let r=e.slice(0,st),i=r.some(({screen:e})=>e.shot);return(0,q.jsx)(V,{title:`Top screens`,children:(0,q.jsx)(`ul`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:r.map(({screen:e,sites:r})=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(k,{href:a(e.project,e.route,n),className:`group block overflow-hidden rounded-md border border-line transition-colors duration-100 hover:border-line-strong hover:bg-raised`,children:[(0,q.jsx)(p,{shot:e.shot,scheme:t,size:`thumb`,label:`${e.project} ${f(e.route)}`,whenMissing:i?`placeholder`:`none`,className:`border-b border-line`}),(0,q.jsxs)(`span`,{className:`flex items-center gap-2 px-2.5 py-1.5`,children:[(0,q.jsx)(`span`,{className:`truncate font-mono text-mono-sm text-ink`,children:f(e.route)}),(0,q.jsxs)(`span`,{className:`ml-auto tabular text-small text-muted`,children:[(0,q.jsx)(`span`,{className:`text-ink-2`,children:r}),` `,r===1?`site`:`sites`]})]})]})},`${e.project}:${e.route}`))})})}var lt=24,ut={"route-file":`screen file`,"imported-by":`imported by a screen`,shell:`app shell`,unrouted:`not on a screen`};function dt({sites:e,contract:t,showAll:n}){let r=(0,K.useMemo)(()=>ae(e),[e]),c=u(t),[l,f]=(0,K.useState)({}),p=e.length<=lt;return e.length===0?(0,q.jsx)(`p`,{className:`rounded-md border border-line px-3 py-4 text-small text-muted`,children:`No site matches these filters.`}):(0,q.jsx)(`div`,{className:`space-y-4`,children:r.map(e=>(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[r.length>1&&(0,q.jsxs)(`h4`,{className:`flex items-baseline gap-2 text-small text-muted`,children:[(0,q.jsx)(`span`,{className:`font-medium text-ink`,children:e.project}),e.commit&&(0,q.jsxs)(`span`,{className:`font-mono text-mono-sm`,children:[`@`,Ae(e.commit)]})]}),(0,q.jsx)(`div`,{className:`rounded-md border border-line`,children:e.screens.map(r=>{let u=`${e.project}\u0000${r.route}`,m=l[u]??p,h=r.route===`*`?`every screen`:r.route;return(0,q.jsxs)(`div`,{className:`border-b border-line last:border-b-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center pr-2 hover:bg-raised`,children:[(0,q.jsxs)(`button`,{type:`button`,"aria-expanded":m,onClick:()=>f(e=>({...e,[u]:!m})),className:`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left`,children:[(0,q.jsx)(o,{"aria-hidden":!0,className:w(`size-3.5 shrink-0 text-faint transition-transform duration-100`,m&&`rotate-90`)}),(0,q.jsx)(`span`,{className:`truncate font-mono text-mono text-ink`,children:h}),r.route===`*`&&(0,q.jsx)(B,{tone:`outline`,children:`app shell`}),(0,q.jsx)(`span`,{className:`tabular text-small text-muted`,children:r.sites.length})]}),r.route!==`(no screen)`&&(0,q.jsx)(k,{href:a(e.project,r.route,t.id),className:`grid size-6 shrink-0 place-items-center rounded-xs text-muted hover:bg-neutral-soft hover:text-ink`,"aria-label":`Open the ${h} screen`,title:`Open the screen`,children:(0,q.jsx)(s,{className:`size-3.5`})})]}),m&&(0,q.jsx)(`ul`,{className:`pb-1.5`,children:(0,q.jsx)(d,{items:r.sites,render:e=>(0,q.jsx)(i,{site:e,choices:c,contract:t,showAll:n,aside:e.via?`via ${e.via.split(`/`).pop()}`:ut[e.routeSource]},`${e.fingerprint}:${e.line}:${e.column}`)})})]},u)})})]},e.project))})}function ft({rows:e,intro:t}){return(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`p`,{className:`text-small text-muted`,children:t}),(0,q.jsx)(`ul`,{className:`divide-y divide-line rounded-md border border-line`,children:(0,q.jsx)(d,{items:e,render:e=>(0,q.jsxs)(`li`,{className:`space-y-0.5 px-3 py-2`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,q.jsx)(c,{site:e,className:`min-w-0`}),(0,q.jsx)(`code`,{className:`shrink-0 font-mono text-mono-sm text-ink`,children:e.label})]}),(0,q.jsx)(`p`,{className:`text-small break-words text-muted`,children:e.detail})]},`${e.project}:${e.file}:${e.line}:${e.column}:${e.label}`)})})]})}function pt({model:e,contract:t,index:n}){let{scheme:r}=j(),i=(0,K.useMemo)(()=>n.sitesByElement.get(t.id)??[],[n,t.id]),[a,o]=(0,K.useState)({}),[s,c]=(0,K.useState)(`sites`),[u,d]=(0,K.useState)(!1),f=(0,K.useMemo)(()=>se(i,t),[i,t]),p=(0,K.useMemo)(()=>oe(i,a),[i,a]),h=(0,K.useMemo)(()=>P(n,t),[n,t]),g=(0,K.useMemo)(()=>m(l(n,e.manifest),t.id),[n,e.manifest,t.id]),_=n.lookalikesByElement.get(t.id)??[],v=n.unknownsByCandidate.get(t.id)??[],y=(0,K.useRef)(null),b=D(i),x=n.reports[0],S=(e,t)=>{c(`sites`),o(n=>{let{[e]:r,...i}=n;return r===t?i:{...i,[e]:t}})},ee=e=>{`view`in e?c(e.view):(c(`sites`),o({[e.filter[0]]:e.filter[1]})),requestAnimationFrame(()=>y.current?.scrollIntoView({block:`start`}))};if(i.length===0&&h.total===0)return(0,q.jsxs)(M,{icon:Ue,title:`Not used yet`,children:[`No scanned project renders `,t.name,`. It may be new, or only reached through code the scanner could not resolve.`]});let te=Object.entries(a);return(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,q.jsxs)(`div`,{className:`space-y-8 p-6 max-sm:px-4`,children:[(0,q.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-small text-muted`,children:[(0,q.jsxs)(`span`,{className:`tabular`,children:[(0,q.jsx)(`span`,{className:`text-heading text-ink`,children:b.sites}),` uses · `,(0,q.jsx)(`span`,{className:`text-ink-2`,children:b.screens}),` screens · `,(0,q.jsx)(`span`,{className:`text-ink-2`,children:b.files}),` files · `,(0,q.jsx)(`span`,{className:`text-ink-2`,children:b.projects}),` `,b.projects===1?`project`:`projects`]}),x?.status===`partial`&&(0,q.jsx)(B,{tone:`warning`,title:x.scanner,children:`Partial scan`})]}),(0,q.jsx)(it,{issues:h,name:t.name,onShow:ee}),(0,q.jsx)(ot,{contract:t,distribution:f,filters:a,onToggle:S}),(0,q.jsx)(ct,{list:g,scheme:r,select:t.id}),(0,q.jsxs)(`section`,{ref:y,"aria-labelledby":`usage-sites`,className:`scroll-mt-4 space-y-3`,children:[(0,q.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h3`,{id:`usage-sites`,className:`text-heading`,children:`Where`}),(_.length>0||v.length>0)&&(0,q.jsx)(ke,{label:`Show`,value:s,onChange:c,options:[{value:`sites`,label:`Sites`,count:p.length},..._.length>0?[{value:`lookalikes`,label:`Lookalikes`,count:_.length}]:[],...v.length>0?[{value:`unresolved`,label:`Unresolved`,count:v.length}]:[]]}),s===`sites`&&te.map(([e,n])=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>S(e,n),className:`inline-flex h-6 items-center gap-1 rounded-sm bg-accent-soft px-2 text-small text-accent hover:bg-accent-soft/70`,"aria-label":`Remove filter ${e} ${T(n,E(t,e))}`,children:[(0,q.jsx)(`span`,{className:`font-mono`,children:e}),` `,T(n,E(t,e)),` `,(0,q.jsx)(C,{className:`size-3`})]},e)),s===`sites`&&(0,q.jsxs)(`label`,{className:`ml-auto flex cursor-pointer items-center gap-1.5 text-small text-muted hover:text-ink`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked),className:`accent-accent`}),`All props`]})]}),s===`sites`&&(0,q.jsx)(dt,{sites:p,contract:t,showAll:u},JSON.stringify(a)),s===`lookalikes`&&(0,q.jsx)(ft,{intro:`Components named like ${t.name} that resolve elsewhere: candidates to replace with the owned one. Not counted as uses.`,rows:_.map(e=>({project:e.project,file:e.file,line:e.line,column:e.column,label:`<${e.local}>`,detail:`Resolves to ${e.resolved}`}))}),s===`unresolved`&&(0,q.jsx)(ft,{intro:`Sites the scanner could not resolve. They might be this component; they are never counted as zero.`,rows:v.map(e=>({project:e.project,file:e.file,line:e.line,column:e.column,label:e.name,detail:`${e.reason}: ${e.detail}`}))})]})]})})}function mt({model:e,contract:t,usage:n}){return n.status===`ready`?(0,q.jsx)(pt,{model:e,contract:t,index:n.value}):(0,q.jsx)(fe,{state:n,onRetry:ie,what:`the usage map`})}var ht=1600,Y=`youiyoux sync`,gt=`@/components/ui`;function _t(e){let t=new Set;for(let{code:n}of e)for(let e of n.matchAll(/from\s+"([^".][^"]*)"/g)){let n=e[1],r=n.startsWith(`@`)?n.split(`/`).slice(0,2).join(`/`):n.split(`/`)[0];r!==`react`&&r!==`react-dom`&&t.add(r)}return[...t].sort()}function vt(e){let{source:t}=e.contract;return`import { ${[t.export,...t.also].join(`, `)} } from "${gt}";`}function yt({entry:e,onClose:t}){let n=_t(e.files);return(0,q.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg border border-line bg-sunken p-4 animate-enter`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-line bg-surface py-1 pr-1 pl-3 font-mono text-mono`,children:[(0,q.jsx)(`span`,{className:`text-faint select-none`,children:`$`}),(0,q.jsx)(`span`,{className:`flex-1 text-ink`,children:Y}),(0,q.jsx)(v,{value:Y,label:`Copy sync command`})]}),(0,q.jsxs)(`p`,{className:`text-small text-muted`,children:[`Run in a project, it vendors every component of the system, `,e.contract.name,`’s `,(0,q.jsx)(`span`,{className:`font-mono text-ink-2`,children:e.files.map(e=>e.path).join(`, `)}),` among them, into the project’s components folder as owned code, records each file in `,(0,q.jsx)(`span`,{className:`font-mono text-ink-2`,children:`youi.lock.json`}),`, and merges later updates with the project’s own edits. A project not set up yet starts with `,(0,q.jsx)(`span`,{className:`font-mono text-ink-2`,children:`youiyoux init --design <dir>`}),`.`]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-small text-muted`,children:[n.length>0&&(0,q.jsxs)(q.Fragment,{children:[`Adds`,n.map(e=>(0,q.jsx)(B,{tone:`outline`,className:`font-mono`,children:e},e))]}),(0,q.jsx)(`button`,{type:`button`,onClick:t,className:`ml-auto text-small text-muted hover:text-ink`,children:`Close`})]})]})}function bt(){let[e,t]=(0,K.useState)(``);return(0,K.useEffect)(()=>{if(!e)return;let n=setTimeout(()=>t(``),ht);return()=>clearTimeout(n)},[e]),{status:e,copy:(e,n)=>{navigator.clipboard.writeText(e).then(()=>t(`Copied ${n}`),()=>t(`The browser blocked the clipboard`))}}}function xt({model:e,entry:t,tab:n}){let{contract:r}=t,[,i]=N(),[a,o]=(0,K.useState)(!1),{status:s,copy:c}=bt(),l=O(),u=l.status===`ready`?l.value.sitesByElement.get(r.id)?.length??0:void 0,d=l.status===`ready`?P(l.value,r).total:0,f=ve(r.id)?.name??r.name.toLowerCase(),p=r.owners.map(e=>e.replace(/^group:/,``));return(0,q.jsxs)(`article`,{className:`flex min-h-0 flex-1 flex-col animate-enter`,children:[(0,q.jsxs)(`header`,{className:`shrink-0 px-6 pt-5 pb-4 max-sm:px-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h2`,{"data-detail-heading":!0,tabIndex:-1,className:`truncate text-title outline-none`,children:r.name}),(0,q.jsx)(R,{status:r.status})]}),(0,q.jsx)(`p`,{className:`max-w-2xl text-reading text-ink-2`,children:r.summary})]}),(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,q.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-small text-muted max-md:sr-only`,children:s}),(0,q.jsx)(F,{variant:`primary`,asChild:!0,children:(0,q.jsxs)(k,{href:`/changes`,children:[(0,q.jsx)(b,{}),` `,(0,q.jsx)(`span`,{className:`max-sm:hidden`,children:`Propose change`})]})}),(0,q.jsx)(Je,{label:`More for ${r.name}`,items:[{label:`Copy sync command`,detail:Y,icon:y,onSelect:()=>c(Y,`the sync command`)},{label:`Copy import`,detail:vt(t),icon:Ie,onSelect:()=>c(vt(t),`the import`)},{label:`Copy element id`,detail:r.id,icon:Ve,onSelect:()=>c(r.id,`the element id`)},{label:`What sync does`,detail:`Files, lockfile and dependencies`,icon:Ge,onSelect:()=>o(!0)}],children:(0,q.jsx)(Re,{})})]})]}),(0,q.jsxs)(`p`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-small text-muted`,children:[(0,q.jsxs)(`span`,{className:`tabular`,children:[`v`,r.version]}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-faint`,children:`·`}),(0,q.jsx)(`span`,{children:r.platforms.join(`, `)}),p.length>0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-faint`,children:`·`}),(0,q.jsx)(`span`,{children:p.join(`, `)})]}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-faint`,children:`·`}),(0,q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center font-mono text-mono-sm text-faint`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:r.id}),(0,q.jsx)(v,{value:r.id,label:`Copy element id`,className:`size-5`})]})]}),a&&(0,q.jsx)(yt,{entry:t,onClose:()=>o(!1)})]}),(0,q.jsxs)(Ee,{value:n,onValueChange:e=>{let t=I(r.id,e);me(t),i(t,{replace:!0})},className:`flex min-h-0 flex-1 flex-col`,children:[(0,q.jsxs)(Te,{"aria-label":`${r.name} sections`,className:`max-sm:px-4`,children:[(0,q.jsx)(H,{value:`overview`,children:`Overview`}),(0,q.jsxs)(H,{value:`usage`,count:u,children:[`Usage`,d>0&&(0,q.jsx)(`span`,{"aria-label":`${d} to look at`,className:`size-1.5 rounded-full bg-warning`})]}),(0,q.jsx)(H,{value:`contract`,children:`Contract & tokens`}),(0,q.jsx)(H,{value:`rules`,count:r.rules.length,children:`Rules`})]}),(0,q.jsx)(U,{value:`overview`,className:`min-h-0 flex-1 overflow-y-auto outline-none`,children:(0,q.jsx)(rt,{model:e,name:f,contract:r,usage:l})}),(0,q.jsx)(U,{value:`usage`,className:`flex min-h-0 flex-1 flex-col outline-none`,children:(0,q.jsx)(mt,{model:e,contract:r,usage:l})}),(0,q.jsx)(U,{value:`contract`,className:`min-h-0 flex-1 overflow-y-auto outline-none`,children:(0,q.jsx)(et,{model:e,entry:t})}),(0,q.jsx)(U,{value:`rules`,className:`min-h-0 flex-1 overflow-y-auto outline-none`,children:(0,q.jsx)(S,{model:e,contract:r})})]})]})}function St({model:e,id:t,tab:n}){let r=e.components.get(t);if(r)return(0,q.jsx)(xt,{model:e,entry:r,tab:n},t);let i=e.tokens.get(t);if(i)return(0,q.jsx)(x,{model:e,token:i},t);let a=e.rules.get(t);return a?(0,q.jsx)(ee,{model:e,rule:a},t):(0,q.jsxs)(M,{icon:Be,title:`No such element`,actions:(0,q.jsx)(F,{asChild:!0,children:(0,q.jsx)(k,{href:`/elements`,children:`All elements`})}),children:[(0,q.jsx)(`code`,{className:`font-mono text-mono-sm`,children:t}),` is not part of `,e.catalog.system.name,` v`,e.catalog.system.version,`.`]})}var Ct=32,wt=30,Tt=12,Et={component:`Components`,rule:`Rules`},X=e=>Et[e.group]??`${e.group[0].toUpperCase()}${e.group.slice(1)} tokens`;function Dt(e,t){if(!t)return e.map((e,t)=>({type:`item`,element:e,index:t}));let n=new Map;for(let t of e)n.set(X(t),(n.get(X(t))??0)+1);let r=[],i=``;return e.forEach((e,t)=>{let a=X(e);a!==i&&(r.push({type:`header`,label:a,count:n.get(a)??0}),i=a),r.push({type:`item`,element:e,index:t})}),r}function Ot({element:e}){return e.status?e.status===`stable`?null:(0,q.jsx)(R,{status:e.status}):e.severity?(0,q.jsx)(z,{severity:e.severity}):null}function kt({model:e,results:t,grouped:n,selectedId:r,tab:i,query:a,onQuery:o,filter:s,onFilter:c,counts:l,total:u,searchMs:d}){let[,f]=N(),{scheme:p}=j(),m=(0,K.useRef)(null),g=(0,K.useMemo)(()=>Dt(t,n),[t,n]),_=je({count:g.length,getScrollElement:()=>m.current,estimateSize:e=>g[e]?.type===`header`?wt:Ct,getItemKey:(0,K.useCallback)(e=>{let t=g[e];return t?t.type===`header`?`h:${t.label}`:t.element.id:e},[g]),overscan:Tt}),v=t.findIndex(e=>e.id===r),y=e=>I(e.id,e.kind===`component`?i:void 0);return de({count:t.length,index:v,onMove:e=>{let n=t[e];n&&(me(y(n)),f(y(n),{replace:!0}))},onOpen:()=>document.querySelector(`[data-detail-heading]`)?.focus()}),(0,K.useEffect)(()=>{let e=g.findIndex(e=>e.type===`item`&&e.element.id===r);e>=0&&_.scrollToIndex(e,{align:`auto`})},[g,r,_]),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ge,{title:`Elements`,count:e.elements.length}),(0,q.jsxs)(`div`,{className:`space-y-2 border-b border-line p-3`,children:[(0,q.jsx)(Me,{value:a,onChange:o,label:`Search elements`,placeholder:`Search name, value, prop, rule…`}),(0,q.jsx)(ke,{label:`Element kind`,value:s,onChange:c,className:`w-full [&>button]:flex-1 [&>button]:justify-center`,options:[{value:`all`,label:`All`,count:u},{value:`component`,label:`Components`,count:l.component},{value:`token`,label:`Tokens`,count:l.token},{value:`rule`,label:`Rules`,count:l.rule}]})]}),t.length===0?(0,q.jsxs)(M,{icon:te,title:`No matches`,actions:(0,q.jsx)(F,{size:`sm`,onClick:()=>(o(``),c(`all`)),children:`Clear search`}),children:[`Nothing in `,e.catalog.system.name,` matches “`,a.trim(),`”`,s===`all`?``:` among ${s}s`,`.`]}):(0,q.jsx)(`div`,{ref:m,"data-list-pane":!0,className:`min-h-0 flex-1 overflow-y-auto py-1.5`,children:(0,q.jsx)(`div`,{role:`list`,"aria-label":`Elements`,className:`relative w-full`,style:{height:_.getTotalSize()},children:_.getVirtualItems().map(e=>{let t=g[e.index],n={height:e.size,transform:`translateY(${e.start}px)`};if(t.type===`header`)return(0,q.jsxs)(`div`,{role:`presentation`,className:`absolute inset-x-0 top-0 flex items-end gap-2 px-4.5 pb-1 text-caption text-muted`,style:n,children:[t.label,(0,q.jsx)(`span`,{className:`tabular text-faint`,children:t.count})]},e.key);let{element:i}=t,a=i.id===r;return(0,q.jsx)(`div`,{role:`listitem`,className:`absolute inset-x-0 top-0 px-1.5`,style:n,children:(0,q.jsxs)(k,{href:y(i),"aria-current":a?`true`:void 0,className:w(`flex h-full items-center gap-2.5 rounded-md px-3 transition-colors duration-75`,a?`bg-accent-soft text-ink`:`text-ink-2 hover:bg-raised hover:text-ink`),children:[(0,q.jsx)(h,{element:i,scheme:p}),(0,q.jsx)(`span`,{className:w(`truncate`,a?`font-medium`:``),children:i.name}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-mono-sm text-faint`,children:i.kind===`rule`||i.key!==i.name?i.kind===`token`?``:i.key:``}),(0,q.jsx)(Ot,{element:i})]})},e.key)})})}),(0,q.jsxs)(`footer`,{className:`flex h-8 shrink-0 items-center justify-between border-t border-line px-4 text-caption text-muted`,children:[(0,q.jsx)(`span`,{className:`tabular`,children:t.length===e.elements.length?`${t.length} elements`:`${t.length} of ${e.elements.length}`}),d!==null&&(0,q.jsxs)(`span`,{className:`tabular`,children:[`searched in `,d.toFixed(1),` ms`]})]})]})}var At=[`token`,`component`,`rule`,`migration`];function jt(e){let[t,n,r,i]=e.split(`/`),a=At.find(e=>e===n);return{id:t&&a&&r?_e(t,a,r):null,tab:le(i)}}function Mt(){let e=ne();return e.status===`ready`?(0,q.jsx)(Nt,{model:e.value}):(0,q.jsx)(fe,{state:e,onRetry:re,what:`the catalog`})}function Nt({model:e}){let{id:t,tab:n}=jt(he()[`*`]??``),[r,i]=(0,K.useState)(``),[a,o]=(0,K.useState)(`all`),s=be(e,r),c=(0,K.useMemo)(()=>s.ids===null?e.elements:s.ids.flatMap(t=>e.byId.get(t)??[]),[e,s.ids]),l=(0,K.useMemo)(()=>a===`all`?c:c.filter(e=>e.kind===a),[c,a]),u=(0,K.useMemo)(()=>ue(c),[c]);return(0,q.jsx)(ce,{listLabel:`Elements`,backHref:`/elements`,hasDetail:t!==null,list:(0,q.jsx)(kt,{model:e,results:l,grouped:s.ids===null,selectedId:t,tab:n,query:r,onQuery:i,filter:a,onFilter:o,counts:u,total:c.length,searchMs:s.totalMs}),detail:t?(0,q.jsx)(St,{model:e,id:t,tab:n}):(0,q.jsx)(Lt,{model:e})})}var Pt=16,Ft=3,Z=`flex min-h-10 items-center gap-3 px-3 py-2 hover:bg-raised`,Q=`divide-y divide-line overflow-hidden rounded-md border border-line`;function It({value:e,unit:t}){return e===null?(0,q.jsx)(`span`,{className:`tabular text-small text-faint`,children:`–`}):(0,q.jsxs)(`span`,{className:`shrink-0 tabular text-small text-muted`,children:[(0,q.jsx)(`span`,{className:`text-ink`,children:e}),` `,t]})}function Lt({model:e}){let{scheme:t}=j(),n=O();return(0,q.jsx)($,{model:e,index:n.status===`ready`?n.value:null,scheme:t})}function $({model:e,index:t,scheme:n}){let r=ue(e.elements),{system:i}=e.catalog,a=e.elements.filter(e=>e.kind===`component`),o=e.elements.filter(e=>e.kind===`rule`),s=new Map;for(let t of e.elements)t.kind===`token`&&ye(s,t.group,t);let c=[...s];return(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,q.jsxs)(`div`,{"data-system-overview":!0,className:`mx-auto max-w-4xl space-y-8 px-8 py-8 max-md:px-5`,children:[(0,q.jsxs)(`header`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,q.jsx)(`h2`,{className:`text-display`,children:i.name}),(0,q.jsxs)(B,{tone:`outline`,className:`tabular`,children:[`v`,i.version]})]}),(0,q.jsxs)(`p`,{className:`text-reading text-muted`,children:[r.component,` `,L(r.component,`component`),`, `,r.token,` `,L(r.token,`token`),` and `,r.rule,` `,L(r.rule,`rule`),`. Pick one to see its contract, tokens, rules and where it lives.`]}),(0,q.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5 text-small text-muted`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(A,{keys:[`j`]}),` `,(0,q.jsx)(A,{keys:[`k`]}),` browse`]}),(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(A,{keys:[`/`]}),` search`]}),(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(A,{keys:[`⌘`,`K`]}),` jump anywhere`]})]})]}),(0,q.jsx)(V,{title:`Components`,count:a.length,children:(0,q.jsx)(`ul`,{className:Q,children:a.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(k,{href:I(e.id),className:Z,children:[(0,q.jsx)(h,{element:e,scheme:n}),(0,q.jsx)(`span`,{className:`shrink-0 font-medium text-ink`,children:e.name}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-small text-muted`,children:e.summary}),e.status&&e.status!==`stable`&&(0,q.jsx)(R,{status:e.status}),(0,q.jsx)(It,{value:t?t.sitesByElement.get(e.id)?.length??0:null,unit:`sites`})]})},e.id))})}),(0,q.jsx)(V,{title:`Tokens`,count:r.token,children:(0,q.jsx)(`ul`,{className:Q,children:c.map(([e,t])=>{let r=t.flatMap(e=>e.swatch?[e.swatch[n]]:[]);return(0,q.jsx)(`li`,{children:(0,q.jsxs)(k,{href:I(t[0].id),className:Z,children:[(0,q.jsx)(`span`,{className:`w-28 shrink-0 font-medium text-ink capitalize`,children:e}),(0,q.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1 overflow-hidden`,children:r.length>0?r.slice(0,Pt).map((e,t)=>(0,q.jsx)(xe,{color:e,size:`sm`},t)):(0,q.jsx)(`span`,{className:`truncate font-mono text-mono-sm text-muted`,children:t.slice(0,Ft).map(e=>e.name).join(` `)})}),(0,q.jsx)(`span`,{className:`shrink-0 tabular text-small text-muted`,children:t.length})]})},e)})})}),(0,q.jsx)(V,{title:`Rules`,count:o.length,children:(0,q.jsx)(`ul`,{className:Q,children:o.map(e=>{let r=t?t.violationsByRule.get(e.id)?.length??0:null;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(k,{href:I(e.id),className:Z,children:[(0,q.jsx)(h,{element:e,scheme:n}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ink`,children:e.name}),e.severity&&(0,q.jsx)(z,{severity:e.severity}),r===0?(0,q.jsx)(`span`,{className:`shrink-0 text-small text-success`,children:`Clean`}):(0,q.jsx)(It,{value:r,unit:r===1?`violation`:`violations`})]})},e.id)})})})]})})}export{Mt as CatalogScreen,$ as SystemOverview,jt as readSelection};
|
|
@@ -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{a as i,i as a,n as o,o as s,r as c,t as l}from"./DraftEditor-
|
|
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{a as i,i as a,n as o,o as s,r as c,t as l}from"./DraftEditor-QH9Sa_Uc.js";import{t as u}from"./git-pull-request-arrow-RqUUIRCU.js";import{t as d}from"./paintbrush-DOkEgSTO.js";import{n as f,t as p}from"./ServiceDown-S4ya0Cob.js";import{t as m}from"./shield-check-0ka0kQct.js";import{dt as h,mt as g,n as _,o as v,r as y,s as b}from"./main-cvOFSjox.js";import{n as x}from"./plural-BbGQPQKA.js";import{a as S,i as C}from"./workflow-C53UBmRZ.js";import{t as w}from"./Badge-CUJUit4d.js";import{t as T}from"./Segmented-Dzi1x49S.js";var E=e(t(),1),D=n(),O=[`draft`,`waiting`,`approved`,`review`,`rolled-out`];function k(){let e=g(),t=/^d-[0-9a-f]{10}$/.exec(e[`*`]??``)?.[0]??null,{state:n,reload:r}=C(()=>S.drafts(),`changes`);return t?(0,D.jsx)(F,{id:t,onChanged:r}):n.status===`loading`?(0,D.jsx)(y,{}):n.status===`error`?(0,D.jsx)(j,{error:n.error,onRetry:r}):(0,D.jsx)(P,{drafts:n.value.drafts})}function A({count:e}){return(0,D.jsxs)(_,{title:`Changes`,...e===void 0?{}:{count:e},children:[(0,D.jsx)(b,{size:`sm`,asChild:!0,children:(0,D.jsxs)(h,{href:`/style`,children:[(0,D.jsx)(d,{}),` Style`]})}),(0,D.jsx)(b,{size:`sm`,asChild:!0,children:(0,D.jsxs)(h,{href:`/rules`,children:[(0,D.jsx)(m,{}),` Rules`]})})]})}function j({error:e,onRetry:t}){return(0,D.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,D.jsx)(A,{}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,D.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-8 p-6 max-sm:p-4`,children:[(0,D.jsx)(f,{error:e,onRetry:t}),(0,D.jsxs)(`section`,{"aria-labelledby":`change-path`,className:`space-y-3`,children:[(0,D.jsx)(`h2`,{id:`change-path`,className:`text-heading`,children:`How a change moves`}),(0,D.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-2`,children:O.map((e,t)=>(0,D.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[t>0&&(0,D.jsx)(r,{"aria-hidden":!0,className:`size-3.5 text-faint`}),(0,D.jsx)(w,{tone:c[e].tone,children:c[e].label})]},e))}),(0,D.jsx)(`p`,{className:`max-w-2xl text-body text-muted`,children:`Start one from Rules (edit a rule, or a new rule) or from Style (tokens and component states). Style edits and previews work now; saving a draft needs the editor.`})]})]})})]})}var M=e=>e.kind===`rule`?`/rules/draft/${e.id}`:`/changes/${e.id}`;function N(e){if(e.kind===`rule`)return`${e.mode===`edit`?`Edit`:`New rule`} · revision ${e.revision}${e.preview?` · flags ${e.preview.flagged}`:``}`;if(e.kind===`library`)return`${e.content.request===`adopt`?`Adoption request`:`Library reference`} · revision ${e.revision}${e.content.swapsWith.length?` · swaps with ${e.content.swapsWith.join(`, `)}`:``}`;let t=e.preview;return`${x(e.content.tokens.length,`token`)}, ${x(e.content.states.length,`state binding`)} · revision ${e.revision}${t?` · ${x(t.totals.sites,`site`)} on ${x(t.totals.routes,`screen`)}`:``}`}function P({drafts:e}){let[t,n]=(0,E.useState)(`all`),r=(0,E.useMemo)(()=>e.flatMap(e=>{let t=a(e);return t===`discarded`?[]:[{draft:e,stage:t}]}),[e]),l=t===`all`?r:r.filter(e=>e.stage===t),d=[{value:`all`,label:`All`,count:r.length},...O.map(e=>({value:e,label:c[e].label,count:r.filter(t=>t.stage===e).length}))];return(0,D.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,D.jsx)(A,{count:r.length}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,D.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-4 p-6 animate-enter max-sm:p-4`,children:[(0,D.jsx)(T,{label:`Status`,value:t,options:d,onChange:n,className:`max-w-full overflow-x-auto`}),l.length===0?(0,D.jsx)(v,{icon:u,title:r.length===0?`No changes yet`:`Nothing in this status`,children:`Changes to the system appear here, from draft to rolled out. Start one from Rules (Edit a rule, or New rule) or from Style (tokens and component states).`}):(0,D.jsx)(`ul`,{className:`divide-y divide-line overflow-hidden rounded-md border border-line`,children:l.map(({draft:e})=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(h,{href:M(e),className:`flex items-center gap-3 px-4 py-3 hover:bg-raised`,children:[(0,D.jsx)(w,{tone:`outline`,children:e.kind===`rule`?`Rule`:e.kind===`style`?`Style`:`Library`}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`p`,{className:`truncate text-body text-ink`,children:e.kind===`rule`?e.content.rule.title||`Untitled rule`:e.kind===`style`?i(e):s(e)}),(0,D.jsxs)(`p`,{className:`truncate text-small text-muted`,children:[N(e),e.handoff?` · ${e.handoff.branch}`:``,e.needsRebase?` · needs rebase`:``,` · `,new Date(e.updatedAt).toLocaleString()]})]}),(0,D.jsx)(o,{draft:e})]})},e.id))})]})})]})}function F({id:e,onChanged:t}){let n=(0,E.useCallback)(async()=>{let[t,n]=await Promise.all([S.draft(e),S.info()]);return{draft:t,info:n}},[e]),{state:r,reload:a,set:o}=C(n,e);if(r.status===`loading`)return(0,D.jsx)(y,{});if(r.status===`error`)return(0,D.jsx)(p,{error:r.error,onRetry:a});let{draft:c,info:u}=r.value;return(0,D.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,D.jsxs)(`nav`,{"aria-label":`Breadcrumb`,className:`flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-6 text-small text-muted max-sm:px-4`,children:[(0,D.jsx)(h,{href:`/changes`,className:`hover:text-ink`,children:`Changes`}),(0,D.jsx)(`span`,{children:`/`}),(0,D.jsx)(`span`,{className:`truncate text-ink-2`,children:c.kind===`style`?i(c):c.kind===`library`?s(c):c.content.rule.title}),c.kind===`rule`&&(0,D.jsx)(h,{href:`/rules/draft/${c.id}`,className:`ml-auto hover:text-ink`,children:`Open on its rule`})]}),(0,D.jsx)(l,{draft:c,info:u,onUpdate:e=>{o({draft:e,info:u}),t()}})]})}export{k as ChangesScreen,M as draftHref};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./x-MLbFVa4v.js";import{f as n,h as r}from"./main-
|
|
1
|
+
import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./x-MLbFVa4v.js";import{f as n,h as r}from"./main-cvOFSjox.js";import{a as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./dist-C8tf4g8c.js";var d=e();function f({onClose:e}){return(0,d.jsx)(u,{open:!0,onOpenChange:t=>!t&&e(),children:(0,d.jsxs)(s,{children:[(0,d.jsx)(i,{className:`fixed inset-0 z-50 bg-scrim animate-fade`}),(0,d.jsxs)(c,{className:`fixed inset-x-0 top-[14vh] z-50 mx-auto w-[min(480px,calc(100vw-24px))] rounded-xl border border-line bg-surface shadow-popover outline-none animate-pop`,children:[(0,d.jsxs)(`header`,{className:`flex h-12 items-center border-b border-line px-5`,children:[(0,d.jsx)(l,{className:`text-heading`,children:`Keyboard shortcuts`}),(0,d.jsx)(o,{"aria-label":`Close`,className:`ml-auto grid size-7 place-items-center rounded-md text-muted hover:bg-raised hover:text-ink`,children:(0,d.jsx)(t,{className:`size-4`})})]}),(0,d.jsx)(a,{className:`sr-only`,children:`Shortcuts work anywhere except while typing in a field.`}),(0,d.jsx)(`div`,{className:`grid gap-5 p-5`,children:r.map(e=>(0,d.jsxs)(`section`,{className:`space-y-1.5`,children:[(0,d.jsx)(`h3`,{className:`text-caption text-muted`,children:e.group}),(0,d.jsx)(`ul`,{className:`divide-y divide-line`,children:e.items.map(e=>(0,d.jsxs)(`li`,{className:`flex h-8 items-center justify-between text-body`,children:[(0,d.jsx)(`span`,{className:`text-ink-2`,children:e.label}),(0,d.jsx)(n,{keys:e.keys})]},e.label))})]},e.group))})]})]})})}export{f as CheatSheet};
|