@whzxc/agent-design-gallery 0.0.0-stage → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +69 -0
- package/README.md +218 -2
- package/package.json +43 -4
- package/public/access.css +10 -0
- package/public/app.js +1674 -0
- package/public/arrangement-worker.js +11 -0
- package/public/arrangement.js +49 -0
- package/public/assets.js +356 -0
- package/public/auth.js +69 -0
- package/public/favicon.svg +6 -0
- package/public/hub.css +67 -0
- package/public/hub.html +33 -0
- package/public/hub.js +165 -0
- package/public/icons.js +50 -0
- package/public/index.html +70 -0
- package/public/instance-actions.js +27 -0
- package/public/labels.js +122 -0
- package/public/layout.js +119 -0
- package/public/relationships.js +28 -0
- package/public/selection.js +20 -0
- package/public/style.css +194 -0
- package/public/switcher.css +37 -0
- package/public/switcher.js +176 -0
- package/public/token-catalog.js +129 -0
- package/public/tokens.css +61 -0
- package/public/view-route.js +66 -0
- package/src/cli-output.mjs +236 -0
- package/src/cli.mjs +176 -0
- package/src/http.mjs +38 -0
- package/src/hub/auth.mjs +41 -0
- package/src/hub/instances.mjs +99 -0
- package/src/hub/proxy.mjs +30 -0
- package/src/hub/registry.mjs +181 -0
- package/src/hub.mjs +128 -0
- package/src/lifecycle.mjs +109 -0
- package/src/link.mjs +55 -0
- package/src/open.mjs +61 -0
- package/src/perf.mjs +12 -0
- package/src/server.mjs +679 -0
- package/src/service.mjs +184 -0
- package/src/toolkit/arch-browser.mjs +40 -0
- package/src/toolkit/arch-git.mjs +55 -0
- package/src/toolkit/arch-overlay.mjs +225 -0
- package/src/toolkit/arch.mjs +221 -0
- package/src/toolkit/asset-rules.mjs +14 -0
- package/src/toolkit/browser.mjs +33 -0
- package/src/toolkit/build-store.mjs +266 -0
- package/src/toolkit/build-worker.mjs +35 -0
- package/src/toolkit/build.mjs +147 -0
- package/src/toolkit/commands.mjs +345 -0
- package/src/toolkit/compare.mjs +222 -0
- package/src/toolkit/config.mjs +136 -0
- package/src/toolkit/document.mjs +85 -0
- package/src/toolkit/migrate.mjs +85 -0
- package/src/toolkit/project.mjs +172 -0
- package/src/toolkit/results.mjs +44 -0
- package/src/toolkit/runtime.d.ts +14 -0
- package/src/toolkit/runtime.mjs +54 -0
- package/src/toolkit/text.mjs +12 -0
- package/src/toolkit/tokens.mjs +37 -0
- package/src/viewer-cache.mjs +85 -0
package/public/style.css
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
:root { color-scheme:light; font:var(--text-body)/1.2 var(--font-ui); color:var(--text); background:var(--canvas); }
|
|
2
|
+
:root[data-theme="dark"] { color-scheme:dark; }
|
|
3
|
+
* { box-sizing:border-box; }
|
|
4
|
+
html,body,.gallery { margin:0; width:100%; height:100%; overflow:hidden; }
|
|
5
|
+
button,input { font:inherit; color:inherit; }
|
|
6
|
+
button { border:0; background:none; cursor:pointer; white-space:nowrap; border-radius:var(--radius-row); padding:0; }
|
|
7
|
+
button:disabled { opacity:.45; cursor:default; }
|
|
8
|
+
button:hover,button[aria-pressed="true"],button[aria-current="true"],button[aria-current="location"] { background:var(--surface-sunken); }
|
|
9
|
+
button:focus-visible,input:focus-visible,.gallery-viewport:focus-visible { outline:1px solid var(--accent); outline-offset:-1px; }
|
|
10
|
+
[hidden] { display:none!important; }
|
|
11
|
+
h1,h2,h3,p { margin:0; }
|
|
12
|
+
h4,h5 { margin:0; font:inherit; }
|
|
13
|
+
h1 { font-size:var(--text-section); font-weight:650; }
|
|
14
|
+
h2 { font-size:var(--text-title); font-weight:650; line-height:20px; }
|
|
15
|
+
h3 { font-size:var(--text-meta); color:var(--text-tertiary); font-weight:550; line-height:16px; }
|
|
16
|
+
.icon { display:block; flex:none; pointer-events:none; }
|
|
17
|
+
[data-icon] { display:inline-flex; flex:none; }
|
|
18
|
+
.icon-button { display:flex; align-items:center; justify-content:center; width:32px; height:32px; flex:none; color:var(--text-secondary); }
|
|
19
|
+
.gallery-viewport { position:absolute; inset:0; overflow:hidden; touch-action:none; user-select:none; cursor:grab; outline:none; }
|
|
20
|
+
.gallery-viewport:active { cursor:grabbing; }
|
|
21
|
+
.gallery-viewport>canvas { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
|
|
22
|
+
#drawings { will-change:transform; }
|
|
23
|
+
#labels { position:absolute; inset:0; overflow:hidden; pointer-events:none; contain:layout style; }
|
|
24
|
+
.label-layer { position:absolute; inset:0; will-change:transform; }
|
|
25
|
+
.canvas-label { position:absolute; top:0; left:0; display:flex; align-items:center; white-space:nowrap; line-height:1.2; }
|
|
26
|
+
.label-copy { display:inline-flex; align-items:center; gap:4px; pointer-events:auto; text-align:left; }
|
|
27
|
+
.label-copy-icon { display:flex; flex:none; color:var(--text-tertiary); opacity:0; }
|
|
28
|
+
.label-copy:hover .label-copy-icon, .label-copy:focus-visible .label-copy-icon, .label-copy[data-copied] .label-copy-icon { opacity:1; }
|
|
29
|
+
.floating { position:fixed; background:var(--surface); border-radius:var(--radius-panel); box-shadow:var(--shadow-float); }
|
|
30
|
+
.gallery { --panel-top:64px; }
|
|
31
|
+
#sidebar { top:var(--panel-top); left:12px; width:min(260px, calc(100vw - 24px)); max-height:calc(100% - var(--panel-top) - 76px); overflow:auto; z-index:1; }
|
|
32
|
+
.picker { display:flex; align-items:center; gap:10px; height:32px; background:var(--surface-sunken); border-radius:var(--radius-field); padding:0 10px; text-align:left; font-weight:550; }
|
|
33
|
+
.picker>.directory-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; }
|
|
34
|
+
.picker>[data-icon]:first-child { color:var(--text-secondary); }
|
|
35
|
+
.picker>[data-icon]:last-child { color:var(--text-tertiary); }
|
|
36
|
+
#scope-tabs { display:flex; gap:2px; align-items:center; min-width:0; overflow:auto; scrollbar-width:none; }
|
|
37
|
+
#scope-tabs button { height:var(--control-size); flex:none; padding:0 12px; color:var(--text-secondary); font-weight:550; }
|
|
38
|
+
#scope-tabs button[aria-selected="true"], .icon-button[aria-expanded="true"] { background:var(--surface-sunken); color:var(--text); }
|
|
39
|
+
.scope-row { display:flex; align-items:center; position:relative; }
|
|
40
|
+
.scope-row>.tree-row { min-width:0; width:auto; flex:1; }
|
|
41
|
+
#sidebar.scoped .file { padding-left:8px; }
|
|
42
|
+
#sidebar.scoped .scope-row-indent .file { padding-left:28px; }
|
|
43
|
+
#modules .scope-only { align-self:center; height:28px; }
|
|
44
|
+
@media (hover:hover) {
|
|
45
|
+
.scope-row:not(:hover):not(:focus-within) .scope-only { position:absolute; right:0; opacity:0; }
|
|
46
|
+
}
|
|
47
|
+
.search-field { width:216px; flex:none; height:32px; display:flex; align-items:center; background:var(--surface-sunken); border-radius:var(--radius-field); color:var(--text-tertiary); }
|
|
48
|
+
.search-field>[data-icon] { margin-left:10px; }
|
|
49
|
+
.search-field:focus-within,.searching .search-field { background:var(--surface); outline:1px solid var(--accent); outline-offset:-1px; }
|
|
50
|
+
#search { width:100%; min-width:0; height:32px; padding:0 8px; background:none; border:0; outline:none; font-size:var(--text-body); }
|
|
51
|
+
#search::-webkit-search-cancel-button { display:none; }
|
|
52
|
+
#search::placeholder { color:var(--text-tertiary); opacity:1; }
|
|
53
|
+
#search-key { font-size:var(--text-caption); margin-right:10px; }
|
|
54
|
+
#search-clear { height:32px; width:30px; display:grid; place-items:center; flex:none; }
|
|
55
|
+
#modules { padding:12px; }
|
|
56
|
+
.tree-row { display:flex; align-items:center; width:100%; height:28px; border-radius:var(--radius-row); padding:0 8px; gap:8px; text-align:left; }
|
|
57
|
+
.tree-row>span:not([data-icon]):not(.count) { min-width:0; overflow:hidden; text-overflow:ellipsis; }
|
|
58
|
+
.tree-row>.icon,.tree-row>[data-icon] { color:var(--text-tertiary); }
|
|
59
|
+
.count { margin-left:auto; flex:none; color:var(--text-tertiary); font-size:var(--text-meta); font-weight:400; }
|
|
60
|
+
#all { font-weight:550; }
|
|
61
|
+
.rule { height:1px; flex:none; background:var(--border); }
|
|
62
|
+
#modules>.rule { margin:4px 0 7px; }
|
|
63
|
+
.group-row { display:flex; align-items:flex-start; height:30px; }
|
|
64
|
+
.group-row>button:first-child { width:28px; height:28px; display:grid; place-items:center; color:var(--text-tertiary); flex:none; }
|
|
65
|
+
.group-name { flex:1; min-width:0; display:flex; align-items:center; height:28px; text-align:left; font-size:var(--text-body); font-weight:550; padding-right:8px; }
|
|
66
|
+
.group-name>span:first-child { overflow:hidden; text-overflow:ellipsis; }
|
|
67
|
+
.group-files { margin-bottom:6px; }
|
|
68
|
+
.file { padding-left:28px; color:var(--text-secondary); }
|
|
69
|
+
.file[aria-current="true"] { color:var(--text); }
|
|
70
|
+
.search-count { margin:6px 0 6px 2px; }
|
|
71
|
+
.search-result { padding-left:8px; }
|
|
72
|
+
.tokens-mode .gallery-viewport > :not(#canvas-background), .tokens-mode #minimap { visibility:hidden; }
|
|
73
|
+
#token-catalog { inset:var(--panel-top) 12px 12px; display:flex; flex-direction:column; overflow:hidden; }
|
|
74
|
+
#token-catalog header { display:flex; align-items:center; justify-content:space-between; flex:none; gap:16px; padding:16px 20px; border-bottom:1px solid var(--border); }
|
|
75
|
+
#token-title { line-height:1.5; }
|
|
76
|
+
#token-source { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text-secondary); }
|
|
77
|
+
#token-catalog code { font:var(--text-meta)/1.5 var(--font-mono); overflow-wrap:anywhere; }
|
|
78
|
+
.token-scroll { min-height:0; overflow:auto; padding:0 20px 12px; }
|
|
79
|
+
#token-table { width:100%; table-layout:fixed; border-collapse:collapse; text-align:left; line-height:1.5; }
|
|
80
|
+
#token-table thead { position:sticky; top:0; background:var(--surface); color:var(--text-secondary); font-size:var(--text-meta); }
|
|
81
|
+
#token-table th, #token-table td { border-bottom:1px solid var(--border); padding-right:20px; }
|
|
82
|
+
#token-table thead th { width:36%; padding-block:12px; font-weight:550; }
|
|
83
|
+
#token-table thead th:first-child { width:28%; }
|
|
84
|
+
#token-table th[scope="rowgroup"] { padding-block:16px 8px; font-weight:650; }
|
|
85
|
+
#token-table th[scope="row"] { padding-block:4px; font-weight:400; }
|
|
86
|
+
#token-table td { padding-block:8px; }
|
|
87
|
+
.token-value { display:flex; align-items:center; gap:8px; }
|
|
88
|
+
.token-value code[title] { color:var(--text-secondary); }
|
|
89
|
+
.token-copy { display:flex; align-items:center; gap:4px; min-height:28px; max-width:100%; text-align:left; white-space:normal; }
|
|
90
|
+
.token-copy:hover { background:none; }
|
|
91
|
+
.token-copy:not([data-copied]):not(:hover):not(:focus-visible) .icon { opacity:0; }
|
|
92
|
+
.token-copy .icon, .token-category { color:var(--text-secondary); }
|
|
93
|
+
.token-category[aria-current="true"], .token-all { color:var(--text); }
|
|
94
|
+
.token-category[aria-current="true"]>.icon, .token-all[aria-current="true"]>.icon { color:var(--text); }
|
|
95
|
+
.token-all { font-weight:550; }
|
|
96
|
+
.token-swatch { flex:none; width:20px; height:20px; border:1px solid var(--border); border-radius:var(--radius-artboard); }
|
|
97
|
+
.token-length, .token-radius { flex:none; width:56px; }
|
|
98
|
+
.token-length span { display:flex; align-items:center; height:8px; max-width:100%; border-inline:1px solid var(--text-tertiary); }
|
|
99
|
+
.token-length span::before { content:''; width:100%; height:1px; background:var(--text-tertiary); }
|
|
100
|
+
.token-radius { height:48px; border:1px solid var(--border); background:var(--surface-sunken); }
|
|
101
|
+
#token-status { margin:16px 0; color:var(--text-secondary); }
|
|
102
|
+
@media (max-width:600px) {
|
|
103
|
+
#token-table .token-length, #token-table .token-radius { display:none; }
|
|
104
|
+
#token-table th, #token-table td { padding-right:8px; }
|
|
105
|
+
}
|
|
106
|
+
#app-bar { top:12px; left:12px; height:44px; display:flex; align-items:center; padding:6px; gap:8px; z-index:2; }
|
|
107
|
+
#app-bar #app-directory { width:220px; }
|
|
108
|
+
#tools { z-index:2; }
|
|
109
|
+
@media (max-width:1060px) {
|
|
110
|
+
.gallery { --panel-top:104px; }
|
|
111
|
+
#app-bar { right:104px; height:auto; flex-wrap:wrap; }
|
|
112
|
+
#app-bar #app-directory { width:auto; flex:1; min-width:0; }
|
|
113
|
+
#app-bar .search-field { width:clamp(98px, 22vw, 216px); }
|
|
114
|
+
#app-bar .separator { display:none; }
|
|
115
|
+
#scope-tabs { order:1; flex:1 1 100%; }
|
|
116
|
+
}
|
|
117
|
+
@media (max-width:600px) {
|
|
118
|
+
#search-key { display:none; }
|
|
119
|
+
}
|
|
120
|
+
#app-bar .separator { margin:0; }
|
|
121
|
+
#tools { top:12px; right:12px; height:44px; display:flex; align-items:center; gap:4px; padding:6px; }
|
|
122
|
+
.separator { width:1px; height:20px; background:var(--border); flex:none; margin-left:4px; }
|
|
123
|
+
.zoom { left:50%; bottom:16px; height:44px; display:flex; align-items:center; gap:4px; padding:6px; transform:translateX(-50%); }
|
|
124
|
+
#zoom-options { display:flex; align-items:center; gap:4px; height:32px; padding:0 10px; font-weight:550; }
|
|
125
|
+
#zoom-options>[data-icon] { color:var(--text-tertiary); }
|
|
126
|
+
#minimap { right:12px; bottom:16px; width:200px; height:132px; border-radius:12px; cursor:crosshair; }
|
|
127
|
+
#source { top:var(--panel-top); right:12px; width:min(300px, calc(100vw - 24px)); max-height:calc(100% - var(--panel-top) - 76px); overflow:auto; z-index:1; }
|
|
128
|
+
.inspector-heading { padding:16px 16px 12px; position:relative; }
|
|
129
|
+
#source-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
130
|
+
#source-path { min-width:0; overflow-wrap:anywhere; white-space:normal; }
|
|
131
|
+
.detail-copy { display:flex; align-items:center; gap:8px; min-width:0; max-width:100%; text-align:left; line-height:16px; }
|
|
132
|
+
.detail-copy .icon { color:var(--text-tertiary); }
|
|
133
|
+
#copy-path { margin-top:4px; font-family:var(--font-mono); font-size:var(--text-meta); color:var(--text-secondary); }
|
|
134
|
+
#frame-detail { margin-top:12px; display:flex; align-items:center; justify-content:space-between; gap:8px; line-height:16px; }
|
|
135
|
+
#frame-name { min-width:0; overflow-wrap:anywhere; white-space:normal; }
|
|
136
|
+
#frame-size { font-size:var(--text-meta); color:var(--text-tertiary); flex:none; }
|
|
137
|
+
#source>.rule { margin:0 16px; }
|
|
138
|
+
#source h3 { margin:12px 16px 6px; }
|
|
139
|
+
#forms { padding:0 8px 12px; max-height:220px; overflow:auto; }
|
|
140
|
+
#forms .tree-row { gap:6px; }
|
|
141
|
+
.frame-row,.relationship-row { height:auto; min-height:28px; padding-top:6px; padding-bottom:6px; }
|
|
142
|
+
.frame-row { min-height:31.2px; }
|
|
143
|
+
.frame-row>span:not(.count),.relationship-row>span { white-space:normal; overflow-wrap:anywhere; }
|
|
144
|
+
.frame-note { margin:4px 8px 8px; color:var(--text-secondary); }
|
|
145
|
+
#source .count { font-size:var(--text-meta); }
|
|
146
|
+
#relationships { padding:12px 16px 16px; }
|
|
147
|
+
#source #relationships>h3 { margin:0 0 12px; font-size:var(--text-body); color:var(--text); }
|
|
148
|
+
#relationships>section+section { margin-top:12px; }
|
|
149
|
+
#relationships h4 { font-size:var(--text-meta); line-height:16px; font-weight:550; color:var(--text-tertiary); margin-bottom:4px; }
|
|
150
|
+
.relationship-directory { font-size:var(--text-meta); line-height:16px; font-weight:400; color:var(--text-tertiary); margin:4px 8px 0; }
|
|
151
|
+
.relationship-row { color:var(--text-secondary); line-height:1.5; }
|
|
152
|
+
.relationship-row.indirect { color:var(--text-tertiary); }
|
|
153
|
+
.relationship-empty { margin:0 8px; font-size:var(--text-meta); line-height:16px; color:var(--text-secondary); }
|
|
154
|
+
#hover-outline,#selection-outline { position:absolute; pointer-events:none; border:1px dashed var(--accent); border-radius:2px; }
|
|
155
|
+
#selection-outline { border:2px solid var(--accent); }
|
|
156
|
+
.menu { position:fixed; margin:0; border:0; border-radius:var(--radius-menu); padding:6px; background:var(--surface); color:var(--text); box-shadow:var(--shadow-menu); }
|
|
157
|
+
.menu button { display:flex; align-items:center; text-align:left; width:100%; height:30px; padding:0 10px; }
|
|
158
|
+
.menu button .key { margin-left:auto; color:var(--text-tertiary); font-family:var(--font-mono); font-size:var(--text-meta); }
|
|
159
|
+
.menu h3 { display:flex; align-items:center; height:24px; padding:0 10px; font-size:var(--text-caption); }
|
|
160
|
+
.menu .rule { margin:4px 2px; }
|
|
161
|
+
#themes button,#backgrounds button { padding-left:32px; position:relative; }
|
|
162
|
+
#themes button .icon,#backgrounds button .icon { position:absolute; left:10px; }
|
|
163
|
+
#more-menu :is(#themes,#backgrounds) button[aria-pressed="true"] { background:none; }
|
|
164
|
+
#more-menu { inset:64px 54px auto auto; width:min(240px, calc(100vw - 66px)); max-height:calc(100% - 76px); overflow:auto; }
|
|
165
|
+
#zoom-menu { inset:auto auto 68px 50%; width:200px; transform:translateX(-50%); }
|
|
166
|
+
#tooltip { position:fixed; z-index:10; background:var(--tooltip); color:var(--on-tooltip); font-size:var(--text-meta); height:26px; padding:6px 8px; line-height:14px; border-radius:var(--radius-row); pointer-events:none; white-space:nowrap; }
|
|
167
|
+
dialog { width:440px; max-width:calc(100vw - 32px); border:0; border-radius:var(--radius-dialog); color:var(--text); background:var(--surface); padding:24px 24px 22px; box-shadow:var(--shadow-menu); }
|
|
168
|
+
dialog::backdrop { background:color-mix(in srgb,var(--canvas) 60%,transparent); }
|
|
169
|
+
.dialog-close { position:absolute; right:16px; top:18px; }
|
|
170
|
+
.dialog-description { font-size:var(--text-body); color:var(--text-secondary); margin-top:8px; line-height:16px; }
|
|
171
|
+
#path { margin-top:16px; width:100%; height:32px; padding:0 12px; border:0; border-radius:var(--radius-field); background:var(--surface-sunken); font:var(--text-meta)/1.2 var(--font-mono); }
|
|
172
|
+
#path::placeholder { color:var(--text-tertiary); opacity:1; }
|
|
173
|
+
#path[aria-invalid="true"] { outline:1px solid var(--danger); outline-offset:-1px; }
|
|
174
|
+
#recent-heading { margin:16px 0 6px; }
|
|
175
|
+
#recent { margin:0 -8px; display:flex; flex-direction:column; gap:2px; max-height:276px; overflow:auto; }
|
|
176
|
+
#recent button { height:44px; min-height:44px; width:100%; padding:0 10px; display:flex; align-items:center; gap:10px; text-align:left; }
|
|
177
|
+
#recent button>[data-icon] { color:var(--text-tertiary); }
|
|
178
|
+
#recent button[aria-current="true"]>[data-icon] { color:var(--text); }
|
|
179
|
+
.recent-text { display:flex; flex-direction:column; gap:2px; min-width:0; }
|
|
180
|
+
.recent-text strong { font-weight:550; }
|
|
181
|
+
.recent-text small { font-family:var(--font-mono); font-size:var(--text-caption); color:var(--text-tertiary); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
182
|
+
footer { display:flex; justify-content:flex-end; margin-top:16px; }
|
|
183
|
+
.primary { height:32px; background:var(--accent); color:var(--on-accent); border-radius:var(--radius-field); padding:0 14px; font-weight:550; }
|
|
184
|
+
.primary:hover { background:var(--accent); }
|
|
185
|
+
#open-error { display:flex; align-items:center; gap:6px; margin-top:10px; line-height:14px; color:var(--danger); font-size:var(--text-meta); }
|
|
186
|
+
#keys { width:380px; height:314px; padding:20px 20px 12px; }
|
|
187
|
+
#keys dl { margin:24px 0 0; }
|
|
188
|
+
#keys dl>div { display:flex; align-items:flex-start; justify-content:space-between; height:34px; line-height:22px; }
|
|
189
|
+
#keys dt { color:var(--text-secondary); }
|
|
190
|
+
#keys dd { margin:0; display:flex; gap:6px; }
|
|
191
|
+
kbd { display:inline-flex; align-items:center; height:22px; padding:0 7px; border-radius:7px; background:var(--surface-sunken); font:var(--text-meta)/1 var(--font-mono); color:var(--text-secondary); }
|
|
192
|
+
#error { position:fixed; bottom:72px; left:50%; transform:translateX(-50%); background:var(--surface); color:var(--danger); border-radius:var(--radius-field); padding:12px; box-shadow:var(--shadow-float); max-width:80vw; }
|
|
193
|
+
#empty { position:absolute; inset:45% 0 auto; text-align:center; color:var(--text-tertiary); }
|
|
194
|
+
.sr { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#project-switcher { position:fixed; margin:0; inset:auto; width:360px; padding:6px; border:0; border-radius:var(--radius-menu); background:var(--surface); color:var(--text); box-shadow:var(--shadow-menu); overflow:auto; font:var(--text-body)/1.5 var(--font-ui); }
|
|
2
|
+
#project-switcher:popover-open { display:flex; flex-direction:column; gap:4px; }
|
|
3
|
+
#project-switcher a { color:inherit; text-decoration:none; }
|
|
4
|
+
#project-switcher a:hover, #project-switcher a:focus-visible { background:var(--surface-sunken); outline:1px solid var(--accent); outline-offset:-1px; }
|
|
5
|
+
#project-switcher h3 { display:flex; align-items:center; height:var(--menu-label-height); margin:0; padding:0 10px; font-size:var(--text-caption); font-weight:550; color:var(--text-tertiary); line-height:16px; }
|
|
6
|
+
.switcher-home { line-height:16px; display:flex; align-items:center; justify-content:space-between; height:var(--menu-item-height); padding:0 10px; border-radius:var(--radius-row); }
|
|
7
|
+
.switcher-home .switcher-icon { color:var(--text-tertiary); }
|
|
8
|
+
.switcher-rule { height:1px; margin:4px 0; background:var(--border); }
|
|
9
|
+
.switcher-search { display:flex; align-items:center; height:var(--field-height); margin:0 4px 4px; padding:0 10px; background:var(--surface-sunken); border-radius:var(--radius-field); color:var(--text-tertiary); }
|
|
10
|
+
.switcher-search:focus-within { outline:1px solid var(--accent); outline-offset:-1px; background:var(--surface); }
|
|
11
|
+
.switcher-search input { flex:1; width:0; min-width:0; padding:0 8px; border:0; outline:none; background:none; font:inherit; }
|
|
12
|
+
.switcher-search input::placeholder { color:var(--text-tertiary); opacity:1; }
|
|
13
|
+
.switcher-search input::-webkit-search-cancel-button { display:none; }
|
|
14
|
+
.switcher-clear { display:flex; align-items:center; border:0; background:none; padding:0; color:var(--text-tertiary); }
|
|
15
|
+
.switcher-icon { display:flex; flex:none; color:var(--text-secondary); }
|
|
16
|
+
.switcher-search .switcher-icon { color:var(--text-tertiary); }
|
|
17
|
+
.switcher-search .icon { width:14px; height:14px; }
|
|
18
|
+
.switcher-targets, .switcher-targets>[role="group"] { display:flex; flex-direction:column; gap:4px; }
|
|
19
|
+
.switcher-row { display:flex; align-items:center; gap:12px; padding:12px 10px; margin:0; border-radius:var(--radius-row); }
|
|
20
|
+
.switcher-row[aria-current="page"] { background:var(--surface-sunken); }
|
|
21
|
+
.switcher-instance { display:flex; align-items:center; gap:4px; padding-right:6px; border-radius:var(--radius-row); }
|
|
22
|
+
.switcher-instance-current { background:var(--surface-sunken); }
|
|
23
|
+
.switcher-instance .switcher-row { flex:1; min-width:0; }
|
|
24
|
+
.switcher-close:hover:not(:disabled) { color:var(--text); }
|
|
25
|
+
.switcher-labels { display:flex; flex-direction:column; flex:1; min-width:0; gap:4px; }
|
|
26
|
+
.switcher-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:550; }
|
|
27
|
+
.switcher-detail { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:var(--text-meta); color:var(--text-secondary); }
|
|
28
|
+
.switcher-danger { color:var(--danger); }
|
|
29
|
+
.switcher-empty { margin:0; padding:12px 10px; color:var(--text-secondary); }
|
|
30
|
+
.picker[aria-expanded="true"] { outline:1px solid var(--accent); outline-offset:-1px; }
|
|
31
|
+
.switcher-chevron { display:flex; color:var(--text-tertiary); }
|
|
32
|
+
#app-bar:not(:has(#scope-tabs)) .picker[aria-controls="project-switcher"] { width:240px; }
|
|
33
|
+
@media (max-width:600px) {
|
|
34
|
+
:root[data-hub-viewer]:not(:has(#scope-tabs)) #tools { display:none; }
|
|
35
|
+
#project-switcher { width:calc(100vw - 24px); }
|
|
36
|
+
#app-bar:not(:has(#scope-tabs)) .picker[aria-controls="project-switcher"] { width:220px; }
|
|
37
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { dataFetch, isUnauthorized } from './auth.js';
|
|
2
|
+
import { icon } from './icons.js';
|
|
3
|
+
import { instanceCloseButton } from './instance-actions.js';
|
|
4
|
+
|
|
5
|
+
const route = location.pathname.match(/^\/(p|i)\/([^/]+)\//);
|
|
6
|
+
if (route) document.documentElement.dataset.hubViewer = 'true';
|
|
7
|
+
let current, kind, targets = [], triggers = [], opener;
|
|
8
|
+
const menu = document.createElement('nav');
|
|
9
|
+
menu.id = 'project-switcher';
|
|
10
|
+
menu.setAttribute('popover', 'auto');
|
|
11
|
+
menu.setAttribute('aria-label', 'Project switcher');
|
|
12
|
+
const element = (tag, className, text) => {
|
|
13
|
+
const node = document.createElement(tag);
|
|
14
|
+
node.className = className;
|
|
15
|
+
if (text !== undefined) node.textContent = text;
|
|
16
|
+
return node;
|
|
17
|
+
};
|
|
18
|
+
const glyph = (name, size = 16) => {
|
|
19
|
+
const node = element('span', 'switcher-icon');
|
|
20
|
+
node.innerHTML = icon(name, size);
|
|
21
|
+
return node;
|
|
22
|
+
};
|
|
23
|
+
export function updateSwitcherLabels() {
|
|
24
|
+
if (!current) return;
|
|
25
|
+
for (const trigger of triggers) {
|
|
26
|
+
trigger.querySelector('.directory-name').textContent = current.name;
|
|
27
|
+
trigger.setAttribute('aria-label', `Switch project: ${current.name}`);
|
|
28
|
+
trigger.title = current.design ?? current.path ?? current.directory ?? '';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function position() {
|
|
32
|
+
if (!opener) return;
|
|
33
|
+
const rect = opener.getBoundingClientRect();
|
|
34
|
+
const phone = innerWidth <= 600;
|
|
35
|
+
const bottom = opener.closest('#app-bar')?.getBoundingClientRect().bottom ?? rect.bottom;
|
|
36
|
+
menu.style.left = `${phone ? 12 : Math.min(rect.left, Math.max(12, innerWidth - 372))}px`;
|
|
37
|
+
menu.style.top = `${bottom + 6}px`;
|
|
38
|
+
menu.style.maxHeight = `${Math.max(80, innerHeight - bottom - 18)}px`;
|
|
39
|
+
}
|
|
40
|
+
function close() {
|
|
41
|
+
menu.hidePopover();
|
|
42
|
+
opener?.focus({ preventScroll: true });
|
|
43
|
+
}
|
|
44
|
+
function open(trigger) {
|
|
45
|
+
opener = trigger;
|
|
46
|
+
render();
|
|
47
|
+
position();
|
|
48
|
+
menu.showPopover();
|
|
49
|
+
(menu.querySelector('a[aria-current="page"]') ?? menu.querySelector('a')).focus({ preventScroll: true });
|
|
50
|
+
}
|
|
51
|
+
function render() {
|
|
52
|
+
const home = element('a', 'switcher-home', 'All projects');
|
|
53
|
+
home.href = '/';
|
|
54
|
+
home.append(glyph('arrow-up-left', 14));
|
|
55
|
+
menu.replaceChildren(home, element('div', 'switcher-rule'));
|
|
56
|
+
if (targets.length >= 5) {
|
|
57
|
+
const field = element('div', 'switcher-search');
|
|
58
|
+
const input = element('input', '');
|
|
59
|
+
input.type = 'search';
|
|
60
|
+
input.placeholder = 'Find project or instance…';
|
|
61
|
+
input.setAttribute('aria-label', 'Find project or instance');
|
|
62
|
+
input.autocomplete = 'off';
|
|
63
|
+
const clear = element('button', 'switcher-clear');
|
|
64
|
+
clear.type = 'button'; clear.setAttribute('aria-label', 'Clear project search');
|
|
65
|
+
clear.append(glyph('x')); clear.hidden = true;
|
|
66
|
+
clear.onclick = () => { input.value = ''; input.dispatchEvent(new Event('input')); input.focus(); };
|
|
67
|
+
field.append(glyph('search'), input, clear);
|
|
68
|
+
input.oninput = () => { clear.hidden = !input.value; renderTargets(input.value); };
|
|
69
|
+
menu.append(field);
|
|
70
|
+
}
|
|
71
|
+
menu.append(element('div', 'switcher-targets'));
|
|
72
|
+
renderTargets('');
|
|
73
|
+
}
|
|
74
|
+
function renderTargets(query) {
|
|
75
|
+
const container = menu.querySelector('.switcher-targets');
|
|
76
|
+
container.replaceChildren();
|
|
77
|
+
const matches = targets.filter(item => [item.name, item.design, item.path, item.directory, item.branch].some(value => value?.toLowerCase().includes(query.trim().toLowerCase())));
|
|
78
|
+
for (const [type, title] of [['p', 'Projects'], ['i', 'Live instances']]) {
|
|
79
|
+
const items = matches.filter(item => item.kind === type);
|
|
80
|
+
if (!items.length) continue;
|
|
81
|
+
if (container.childElementCount) container.append(element('div', 'switcher-rule'));
|
|
82
|
+
const section = element('section', '');
|
|
83
|
+
section.setAttribute('role', 'group');
|
|
84
|
+
section.setAttribute('aria-label', title);
|
|
85
|
+
section.append(element('h3', '', title));
|
|
86
|
+
for (const item of items) {
|
|
87
|
+
const disabled = item.compatibility?.compatible === false || item.proxyable === false || item.error;
|
|
88
|
+
const selected = item.kind === kind && (item.slug ?? item.id) === (current.slug ?? current.id);
|
|
89
|
+
const row = element(disabled ? 'div' : 'a', 'switcher-row');
|
|
90
|
+
if (disabled) row.setAttribute('aria-disabled', 'true');
|
|
91
|
+
else row.href = item.url ?? `/${item.kind}/${encodeURIComponent(item.slug ?? item.id)}/`;
|
|
92
|
+
if (selected) row.setAttribute('aria-current', 'page');
|
|
93
|
+
row.append(glyph(type === 'i' ? 'radio' : 'folder'));
|
|
94
|
+
const labels = element('span', 'switcher-labels');
|
|
95
|
+
labels.append(element('span', 'switcher-name', item.name));
|
|
96
|
+
const detail = item.compatibility?.compatible === false
|
|
97
|
+
? `Requires ADG ${item.compatibility.requires?.replace(/>=/g, '≥')} · hub ${item.compatibility.version}`
|
|
98
|
+
: item.proxyable === false ? 'Proxy unavailable' : type === 'i' ? `:${item.port} · ${item.directory}`
|
|
99
|
+
: item.error ?? item.design ?? item.path ?? item.directory;
|
|
100
|
+
const meta = element('span', `switcher-detail${disabled ? ' switcher-danger' : ''}`, detail);
|
|
101
|
+
meta.title = detail ?? '';
|
|
102
|
+
labels.append(meta); row.append(labels);
|
|
103
|
+
if (selected) row.append(glyph('check', 14));
|
|
104
|
+
if (disabled) { const alert = glyph('circle-alert', 14); alert.classList.add('switcher-danger'); row.append(alert); }
|
|
105
|
+
if (type !== 'i' || !item.stoppable) { section.append(row); continue; }
|
|
106
|
+
const instance = element('div', 'switcher-instance');
|
|
107
|
+
if (selected) instance.classList.add('switcher-instance-current');
|
|
108
|
+
const stop = instanceCloseButton(item, 'icon-button switcher-close', () => {
|
|
109
|
+
if (selected) { location.replace('/'); return; }
|
|
110
|
+
targets = targets.filter(target => target !== item);
|
|
111
|
+
renderTargets(menu.querySelector('input')?.value ?? '');
|
|
112
|
+
(menu.querySelector('a[aria-current="page"]') ?? menu.querySelector('a')).focus({ preventScroll: true });
|
|
113
|
+
}, failure => {
|
|
114
|
+
const alert = document.querySelector('#error');
|
|
115
|
+
alert.textContent = failure.message;
|
|
116
|
+
alert.hidden = false;
|
|
117
|
+
});
|
|
118
|
+
instance.append(row, stop);
|
|
119
|
+
section.append(instance);
|
|
120
|
+
}
|
|
121
|
+
container.append(section);
|
|
122
|
+
}
|
|
123
|
+
if (!matches.length) container.append(element('p', 'switcher-empty', 'No matches'));
|
|
124
|
+
}
|
|
125
|
+
export async function initSwitcher() {
|
|
126
|
+
if (!route) return;
|
|
127
|
+
kind = route[1];
|
|
128
|
+
triggers = [...document.querySelectorAll('#directory, #app-directory')];
|
|
129
|
+
try {
|
|
130
|
+
const responses = await Promise.all(['/api/projects', '/api/instances'].map(url => dataFetch(url)));
|
|
131
|
+
for (const response of responses) if (!response.ok) throw new Error(`Cannot load project switcher: HTTP ${response.status}`);
|
|
132
|
+
const [projects, instances] = await Promise.all(responses.map(response => response.json()));
|
|
133
|
+
targets = [...projects.map(item => ({ ...item, kind: 'p' })), ...instances.map(item => ({ ...item, kind: 'i' }))];
|
|
134
|
+
current = targets.find(item => item.kind === kind && (item.slug ?? item.id) === route[2]);
|
|
135
|
+
if (!current) return;
|
|
136
|
+
document.body.append(menu);
|
|
137
|
+
for (const trigger of triggers) {
|
|
138
|
+
trigger.setAttribute('aria-expanded', 'false');
|
|
139
|
+
trigger.setAttribute('aria-controls', menu.id);
|
|
140
|
+
trigger.querySelector('[data-icon]').innerHTML = icon(kind === 'i' ? 'radio' : 'folder', 14);
|
|
141
|
+
const chevron = trigger.querySelector('.switcher-chevron') ?? element('span', 'switcher-chevron');
|
|
142
|
+
chevron.innerHTML = icon('chevron-down', 12);
|
|
143
|
+
chevron.hidden = false;
|
|
144
|
+
trigger.append(chevron);
|
|
145
|
+
trigger.onclick = () => menu.matches(':popover-open') ? close() : open(trigger);
|
|
146
|
+
trigger.onkeydown = event => {
|
|
147
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); open(trigger); }
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
updateSwitcherLabels();
|
|
151
|
+
menu.addEventListener('toggle', event => {
|
|
152
|
+
for (const trigger of triggers) trigger.setAttribute('aria-expanded', String(event.newState === 'open' && trigger === opener));
|
|
153
|
+
});
|
|
154
|
+
window.addEventListener('resize', position);
|
|
155
|
+
document.addEventListener('keydown', event => {
|
|
156
|
+
if (!menu.matches(':popover-open') || document.querySelector('dialog[open]')) return;
|
|
157
|
+
if (event.key === 'Escape') { event.preventDefault(); event.stopImmediatePropagation(); close(); return; }
|
|
158
|
+
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 'f') {
|
|
159
|
+
const input = menu.querySelector('input');
|
|
160
|
+
if (input) { event.preventDefault(); event.stopImmediatePropagation(); input.focus(); }
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (!['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) return;
|
|
164
|
+
if (event.target.matches('input') && ['Home', 'End'].includes(event.key)) return;
|
|
165
|
+
const actions = [...menu.querySelectorAll('a, .switcher-close:not(:disabled)')];
|
|
166
|
+
const index = actions.indexOf(document.activeElement);
|
|
167
|
+
const next = event.key === 'Home' ? 0 : event.key === 'End' ? actions.length - 1
|
|
168
|
+
: (index + (event.key === 'ArrowDown' ? 1 : -1) + actions.length) % actions.length;
|
|
169
|
+
event.preventDefault(); event.stopImmediatePropagation(); actions[next]?.focus();
|
|
170
|
+
}, true);
|
|
171
|
+
} catch (failure) {
|
|
172
|
+
if (isUnauthorized()) return;
|
|
173
|
+
// Keep the current target visible when hub discovery is temporarily unavailable.
|
|
174
|
+
window.dispatchEvent(new CustomEvent('adg-switcher-error', { detail: failure }));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { icon } from './icons.js';
|
|
2
|
+
|
|
3
|
+
const categories = [
|
|
4
|
+
['Colors', 'palette'], ['Typography', 'type'], ['Spacing & size', 'ruler'], ['Radii', 'corner-up-right'],
|
|
5
|
+
['Shadows', 'layers'], ['Motion', 'timer'], ['Other', 'list'],
|
|
6
|
+
];
|
|
7
|
+
|
|
8
|
+
function resolveValue(name, values) {
|
|
9
|
+
const seen = new Set();
|
|
10
|
+
while (!seen.has(name)) {
|
|
11
|
+
seen.add(name);
|
|
12
|
+
const value = values.get(name) ?? '';
|
|
13
|
+
const alias = /^var\(\s*(--[\w-]+)\s*\)$/.exec(value);
|
|
14
|
+
if (!alias) return value;
|
|
15
|
+
name = alias[1];
|
|
16
|
+
}
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function isColor(value) {
|
|
21
|
+
return !/\bvar\(/i.test(value) && !/^(?:inherit|initial|revert|revert-layer|unset|currentcolor)$/i.test(value) && CSS.supports('color', value);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function categoryFor(name, value) {
|
|
25
|
+
if (isColor(value)) return 'Colors';
|
|
26
|
+
if (/^--(?:font|text|leading|tracking|line-height|letter-spacing)(?:-|$)/.test(name)) return 'Typography';
|
|
27
|
+
if (/^--radius(?:-|$)/.test(name)) return 'Radii';
|
|
28
|
+
if (/^--shadow(?:-|$)/.test(name)) return 'Shadows';
|
|
29
|
+
if (/(?:^|-)(?:duration|delay|easing|motion|transition|animation)(?:-|$)/.test(name) || /^-?[\d.]+m?s$/i.test(value)) return 'Motion';
|
|
30
|
+
if (/(?:^|-)(?:space|spacing|size|gap|width|height|padding|margin|inset)(?:-|$)/.test(name) ||
|
|
31
|
+
/^-?[\d.]+(?:px|rem|em|ch|ex|vw|vh|vmin|vmax|%)$/i.test(value)) return 'Spacing & size';
|
|
32
|
+
return 'Other';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function groupTokens(tokens) {
|
|
36
|
+
const light = new Map(tokens.map(([name, value]) => [name, value]));
|
|
37
|
+
const dark = new Map(tokens.map(([name, value, override]) => [name, override ?? value]));
|
|
38
|
+
const grouped = Map.groupBy(tokens.map(([name, value, override]) => ({
|
|
39
|
+
name, light: value, dark: override ?? value, inherited: override === null,
|
|
40
|
+
lightPreview: resolveValue(name, light), darkPreview: resolveValue(name, dark),
|
|
41
|
+
})), row => categoryFor(row.name, row.lightPreview || row.darkPreview));
|
|
42
|
+
return categories.filter(([label]) => grouped.has(label)).map(([label, glyph]) => ({ label, glyph, rows: grouped.get(label) }));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function element(tag, className, text) {
|
|
46
|
+
const node = document.createElement(tag);
|
|
47
|
+
if (className) node.className = className;
|
|
48
|
+
if (text !== undefined) node.textContent = text;
|
|
49
|
+
return node;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function valuePreview(group, value) {
|
|
53
|
+
let preview;
|
|
54
|
+
if (group === 'Colors' && isColor(value)) {
|
|
55
|
+
preview = element('span', 'token-swatch');
|
|
56
|
+
preview.style.backgroundColor = value;
|
|
57
|
+
} else if (/^(?:\d+(?:\.\d+)?|\.\d+)px$/i.test(value) || value === '0') {
|
|
58
|
+
if (group === 'Spacing & size' && parseFloat(value) > 0) {
|
|
59
|
+
preview = element('span', 'token-length');
|
|
60
|
+
const length = element('span');
|
|
61
|
+
length.style.width = value;
|
|
62
|
+
preview.append(length);
|
|
63
|
+
} else if (group === 'Radii') {
|
|
64
|
+
preview = element('span', 'token-radius');
|
|
65
|
+
preview.style.borderRadius = value;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
preview?.setAttribute('aria-hidden', 'true');
|
|
69
|
+
return preview;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function valueCell(group, value, resolved, inherited = false) {
|
|
73
|
+
const cell = element('td'), content = element('div', 'token-value');
|
|
74
|
+
const code = element('code', '', value), preview = valuePreview(group, resolved);
|
|
75
|
+
if (inherited) code.title = 'Inherits light declaration';
|
|
76
|
+
if (preview) content.append(preview);
|
|
77
|
+
content.append(code);
|
|
78
|
+
cell.append(content);
|
|
79
|
+
return cell;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function tokenName(name, onCopyError) {
|
|
83
|
+
const cell = element('th'), button = element('button', 'token-copy'), glyph = element('span');
|
|
84
|
+
cell.scope = 'row';
|
|
85
|
+
button.type = 'button';
|
|
86
|
+
button.setAttribute('aria-label', `Copy ${name}`);
|
|
87
|
+
glyph.innerHTML = icon('copy', 12);
|
|
88
|
+
button.append(element('code', '', name), glyph);
|
|
89
|
+
let timer;
|
|
90
|
+
button.onclick = async () => {
|
|
91
|
+
try {
|
|
92
|
+
await navigator.clipboard.writeText(name);
|
|
93
|
+
button.setAttribute('data-copied', '');
|
|
94
|
+
button.setAttribute('aria-label', `Copied ${name}`);
|
|
95
|
+
glyph.innerHTML = icon('check', 12);
|
|
96
|
+
clearTimeout(timer);
|
|
97
|
+
timer = setTimeout(() => {
|
|
98
|
+
button.removeAttribute('data-copied');
|
|
99
|
+
button.setAttribute('aria-label', `Copy ${name}`);
|
|
100
|
+
glyph.innerHTML = icon('copy', 12);
|
|
101
|
+
}, 1200);
|
|
102
|
+
onCopyError(null);
|
|
103
|
+
} catch (error) { onCopyError(error); }
|
|
104
|
+
};
|
|
105
|
+
cell.append(button);
|
|
106
|
+
return cell;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function renderTokenTable(panel, data, category, query, onCopyError) {
|
|
110
|
+
const source = panel.querySelector('#token-source'), table = panel.querySelector('table'), status = panel.querySelector('#token-status');
|
|
111
|
+
source.title = source.textContent = data.tokenSource;
|
|
112
|
+
const bodies = [];
|
|
113
|
+
for (const { label, rows } of data.tokenGroups) {
|
|
114
|
+
if (category && category !== label) continue;
|
|
115
|
+
const matches = rows.filter(row => !query || [row.name, row.light, row.dark].some(value => value.toLowerCase().includes(query)));
|
|
116
|
+
if (!matches.length) continue;
|
|
117
|
+
const body = element('tbody'), heading = body.insertRow(), title = element('th', '', label);
|
|
118
|
+
title.scope = 'rowgroup';
|
|
119
|
+
title.colSpan = 3;
|
|
120
|
+
heading.append(title);
|
|
121
|
+
for (const row of matches) body.insertRow().append(tokenName(row.name, onCopyError),
|
|
122
|
+
valueCell(label, row.light, row.lightPreview), valueCell(label, row.dark, row.darkPreview, row.inherited));
|
|
123
|
+
bodies.push(body);
|
|
124
|
+
}
|
|
125
|
+
table.replaceChildren(table.tHead, ...bodies);
|
|
126
|
+
table.hidden = !bodies.length;
|
|
127
|
+
status.hidden = !!bodies.length;
|
|
128
|
+
status.textContent = data.tokenError ?? 'No matching tokens.';
|
|
129
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* Shared tokens for TSX design frames and the viewer. */
|
|
2
|
+
:root {
|
|
3
|
+
--font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Segoe UI", "Microsoft YaHei", Inter, "WenQuanYi Zen Hei", sans-serif;
|
|
4
|
+
--font-mono: "SF Mono", ui-monospace, Menlo, Consolas, "JetBrains Mono", monospace;
|
|
5
|
+
--text-title: 15px;
|
|
6
|
+
--text-section: 14px;
|
|
7
|
+
--text-body: 13px;
|
|
8
|
+
--text-meta: 12px;
|
|
9
|
+
--text-caption: 11px;
|
|
10
|
+
--radius-dialog: 16px;
|
|
11
|
+
--radius-panel: 14px;
|
|
12
|
+
--radius-menu: 12px;
|
|
13
|
+
--radius-field: 9px;
|
|
14
|
+
--radius-row: 8px;
|
|
15
|
+
--radius-artboard: 6px;
|
|
16
|
+
--radius-keycap: 6px;
|
|
17
|
+
--toolbar-height: 44px;
|
|
18
|
+
--field-height: 32px;
|
|
19
|
+
--row-height: 28px;
|
|
20
|
+
--row-height-two-line: 44px;
|
|
21
|
+
--menu-item-height: 30px;
|
|
22
|
+
--menu-label-height: 24px;
|
|
23
|
+
--control-size: 32px;
|
|
24
|
+
--keycap-size: 22px;
|
|
25
|
+
|
|
26
|
+
--canvas: #ecece9;
|
|
27
|
+
--dot: #d2d2ce;
|
|
28
|
+
--surface: #ffffff;
|
|
29
|
+
--surface-section: #f5f5f3;
|
|
30
|
+
--surface-sunken: #f1f1ee;
|
|
31
|
+
--border: #e2e2de;
|
|
32
|
+
--text: #1c1c1a;
|
|
33
|
+
--text-secondary: #5b5b57;
|
|
34
|
+
--text-tertiary: #7c7c77;
|
|
35
|
+
--accent: #1c1c1a;
|
|
36
|
+
--on-accent: #ffffff;
|
|
37
|
+
--danger: #c2453b;
|
|
38
|
+
--tooltip: #1c1c1a;
|
|
39
|
+
--on-tooltip: #ffffff;
|
|
40
|
+
--shadow-float: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 8%);
|
|
41
|
+
--shadow-menu: 0 2px 4px rgb(0 0 0 / 6%), 0 12px 32px rgb(0 0 0 / 14%);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:root[data-theme="dark"] {
|
|
45
|
+
--canvas: #121212;
|
|
46
|
+
--dot: #262626;
|
|
47
|
+
--surface: #1f1f1f;
|
|
48
|
+
--surface-section: #191919;
|
|
49
|
+
--surface-sunken: #2a2a2a;
|
|
50
|
+
--border: #2d2d2d;
|
|
51
|
+
--text: #efefed;
|
|
52
|
+
--text-secondary: #a8a8a4;
|
|
53
|
+
--text-tertiary: #85857f;
|
|
54
|
+
--accent: #efefed;
|
|
55
|
+
--on-accent: #1c1c1a;
|
|
56
|
+
--danger: #f08b80;
|
|
57
|
+
--tooltip: #efefed;
|
|
58
|
+
--on-tooltip: #1c1c1a;
|
|
59
|
+
--shadow-float: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 45%);
|
|
60
|
+
--shadow-menu: 0 2px 4px rgb(0 0 0 / 40%), 0 12px 32px rgb(0 0 0 / 55%);
|
|
61
|
+
}
|