@whzxc/agent-design-gallery 0.14.1 → 0.15.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/README.md +26 -16
- package/package.json +1 -1
- package/public/access.css +15 -2
- package/public/app.js +708 -483
- package/public/arrangement-worker.js +7 -7
- package/public/arrangement.js +35 -30
- package/public/assets.js +60 -38
- package/public/auth.js +59 -4
- package/public/boards.js +124 -0
- package/public/comment-anchors.js +50 -0
- package/public/comments.css +400 -0
- package/public/comments.js +1106 -0
- package/public/context-menu.js +97 -0
- package/public/frame-identity.js +26 -2
- package/public/hub.css +25 -3
- package/public/hub.html +10 -2
- package/public/hub.js +127 -23
- package/public/icons.js +2 -0
- package/public/index.html +13 -9
- package/public/instance-actions.js +9 -2
- package/public/layout.js +156 -86
- package/public/selection.js +1 -1
- package/public/style.css +74 -152
- package/public/switcher.css +5 -4
- package/public/switcher.js +109 -34
- package/public/token-catalog.js +8 -3
- package/public/tokens.css +14 -1
- package/public/view-route.js +0 -1
- package/src/boards/board.mjs +30 -0
- package/src/boards/token-board.mjs +196 -0
- package/src/cli-output.mjs +8 -5
- package/src/cli.mjs +49 -29
- package/src/comments.mjs +293 -0
- package/src/http.mjs +2 -3
- package/src/hub/project-link.mjs +41 -0
- package/src/hub/registry.mjs +5 -0
- package/src/hub.mjs +14 -10
- package/src/link.mjs +13 -1
- package/src/server.mjs +57 -93
- package/src/service.mjs +46 -12
- package/src/toolkit/arch.mjs +3 -2
- package/src/toolkit/asset-rules.mjs +24 -1
- package/src/toolkit/commands.mjs +12 -7
- package/{public/review.js → src/toolkit/diff-document.mjs} +137 -43
- package/src/toolkit/diff-inputs.mjs +66 -30
- package/src/toolkit/diff.mjs +181 -39
- package/src/toolkit/impact-selection.mjs +25 -10
- package/src/toolkit/impact.mjs +32 -12
- package/src/toolkit/move-pairing.mjs +140 -0
- package/src/toolkit/project-index.mjs +2 -2
- package/src/toolkit/results.mjs +1 -1
- package/src/toolkit/review-document.mjs +435 -0
- package/src/toolkit/review-groups.mjs +29 -0
- package/src/toolkit/review-observation.mjs +131 -0
- package/src/toolkit/review-sheet.mjs +117 -0
- package/src/toolkit/review-specimens.mjs +60 -0
- package/src/toolkit/review.mjs +140 -0
- package/src/toolkit/runtime.mjs +1 -1
- package/src/toolkit/theme.mjs +16 -0
- package/public/annotations.js +0 -816
- package/public/labels.js +0 -122
- package/src/annotations.mjs +0 -238
package/public/style.css
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
|
|
1
|
+
:root {
|
|
2
|
+
color-scheme:light;
|
|
3
|
+
font:var(--text-body)/1.2 var(--font-ui);
|
|
4
|
+
color:var(--text);
|
|
5
|
+
background:var(--canvas);
|
|
6
|
+
--stage-canvas:var(--canvas);
|
|
7
|
+
--stage-border:var(--border);
|
|
8
|
+
--stage-checker-a:var(--surface-sunken);
|
|
9
|
+
--stage-checker-b:var(--surface);
|
|
10
|
+
}
|
|
11
|
+
:root[data-theme="dark"] { color-scheme:dark; }
|
|
3
12
|
* { box-sizing:border-box; }
|
|
4
13
|
html,body,.gallery { margin:0; width:100%; height:100%; overflow:hidden; }
|
|
5
14
|
button,input { font:inherit; color:inherit; }
|
|
@@ -15,45 +24,48 @@ h2 { font-size:var(--text-title); font-weight:650; line-height:20px; }
|
|
|
15
24
|
h3 { font-size:var(--text-meta); color:var(--text-tertiary); font-weight:550; line-height:16px; }
|
|
16
25
|
.icon { display:block; flex:none; pointer-events:none; }
|
|
17
26
|
[data-icon] { display:inline-flex; flex:none; }
|
|
18
|
-
.icon-button { display:flex; align-items:center; justify-content:center; width:
|
|
27
|
+
.icon-button { display:flex; align-items:center; justify-content:center; width:var(--control-size); height:var(--control-size); flex:none; color:var(--text-secondary); }
|
|
19
28
|
.gallery-viewport { position:absolute; inset:0; overflow:hidden; touch-action:none; user-select:none; cursor:grab; outline:none; }
|
|
29
|
+
.gallery-viewport[data-hover-hit="true"]:not(:active) { cursor:pointer; }
|
|
20
30
|
.gallery-viewport:active { cursor:grabbing; }
|
|
21
31
|
.gallery-viewport>canvas { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
|
|
22
32
|
#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
33
|
.floating { position:fixed; background:var(--surface); border-radius:var(--radius-panel); box-shadow:var(--shadow-float); }
|
|
30
34
|
.gallery { --panel-top:64px; }
|
|
31
35
|
#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:
|
|
36
|
+
.picker { display:flex; align-items:center; gap:10px; height:var(--field-height); background:var(--surface-sunken); border-radius:var(--radius-field); padding:0 10px; text-align:left; font-weight:550; }
|
|
33
37
|
.picker>.directory-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; }
|
|
34
38
|
.picker>[data-icon]:first-child { color:var(--text-secondary); }
|
|
35
39
|
.picker>[data-icon]:last-child { color:var(--text-tertiary); }
|
|
36
40
|
#scope-tabs { display:flex; gap:2px; align-items:center; min-width:0; overflow:auto; scrollbar-width:none; }
|
|
37
41
|
#scope-tabs button { height:var(--control-size); flex:none; padding:0 12px; color:var(--text-secondary); font-weight:550; }
|
|
38
42
|
#scope-tabs button[aria-selected="true"], .icon-button[aria-expanded="true"] { background:var(--surface-sunken); color:var(--text); }
|
|
43
|
+
.isolation-pill, .view-pill { display:inline-flex; align-items:center; gap:6px; height:var(--control-size); flex:none; padding:0 10px; border-radius:var(--radius-row); background:var(--surface-sunken); color:var(--text); font-size:var(--text-body); font-weight:550; max-width:220px; }
|
|
44
|
+
.isolation-pill>span:not([data-icon]), .view-pill>span:not([data-icon]) { min-width:0; overflow:hidden; text-overflow:ellipsis; }
|
|
45
|
+
.isolation-pill .icon, .view-pill .icon { color:var(--text-secondary); }
|
|
46
|
+
.isolation-pill:hover, .view-pill:hover { background:color-mix(in srgb, var(--text) 8%, var(--surface-sunken)); }
|
|
39
47
|
.scope-row { display:flex; align-items:center; position:relative; }
|
|
40
48
|
.scope-row>.tree-row { min-width:0; width:auto; flex:1; }
|
|
41
49
|
#sidebar.scoped .file { padding-left:8px; }
|
|
42
50
|
#sidebar.scoped .scope-row-indent .file { padding-left:28px; }
|
|
43
|
-
#modules .scope-only {
|
|
51
|
+
#modules .scope-only { position:absolute; right:4px; top:50%; transform:translateY(-50%); width:var(--row-height); height:var(--row-height); z-index:1; }
|
|
44
52
|
@media (hover:hover) {
|
|
45
|
-
.scope-row:not(:hover):not(:focus-within) .scope-only {
|
|
53
|
+
.scope-row:not(:hover):not(:focus-within) .scope-only { opacity:0; }
|
|
54
|
+
.scope-row:is(:hover, :focus-within)>:is(.tree-row, .group-name) { padding-right:36px; }
|
|
55
|
+
}
|
|
56
|
+
@media (hover:none) {
|
|
57
|
+
.scope-row>:is(.tree-row, .group-name) { padding-right:36px; }
|
|
46
58
|
}
|
|
47
|
-
.search-field { width:216px; flex:none; height:
|
|
59
|
+
.search-field { width:216px; flex:none; height:var(--field-height); display:flex; align-items:center; background:var(--surface-sunken); border-radius:var(--radius-field); color:var(--text-tertiary); }
|
|
48
60
|
.search-field>[data-icon] { margin-left:10px; }
|
|
49
61
|
.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:
|
|
62
|
+
#search { width:100%; min-width:0; height:var(--field-height); padding:0 8px; background:none; border:0; outline:none; font-size:var(--text-body); }
|
|
51
63
|
#search::-webkit-search-cancel-button { display:none; }
|
|
52
64
|
#search::placeholder { color:var(--text-tertiary); opacity:1; }
|
|
53
65
|
#search-key { font-size:var(--text-caption); margin-right:10px; }
|
|
54
|
-
#search-clear { height:
|
|
66
|
+
#search-clear { height:var(--field-height); width:30px; display:grid; place-items:center; flex:none; }
|
|
55
67
|
#modules { padding:12px; }
|
|
56
|
-
.tree-row { display:flex; align-items:center; width:100%; height:
|
|
68
|
+
.tree-row { display:flex; align-items:center; width:100%; height:var(--row-height); border-radius:var(--radius-row); padding:0 8px; gap:8px; text-align:left; }
|
|
57
69
|
.tree-row>span:not([data-icon]):not(.count) { min-width:0; overflow:hidden; text-overflow:ellipsis; }
|
|
58
70
|
.tree-row>.icon,.tree-row>[data-icon] { color:var(--text-tertiary); }
|
|
59
71
|
.count { margin-left:auto; flex:none; color:var(--text-tertiary); font-size:var(--text-meta); font-weight:400; }
|
|
@@ -61,8 +73,8 @@ h3 { font-size:var(--text-meta); color:var(--text-tertiary); font-weight:550; li
|
|
|
61
73
|
.rule { height:1px; flex:none; background:var(--border); }
|
|
62
74
|
#modules>.rule { margin:4px 0 7px; }
|
|
63
75
|
.group-row { display:flex; align-items:flex-start; height:30px; }
|
|
64
|
-
.group-row>button:first-child { width:
|
|
65
|
-
.group-name { flex:1; min-width:0; display:flex; align-items:center; height:
|
|
76
|
+
.group-row>button:first-child { width:var(--row-height); height:var(--row-height); display:grid; place-items:center; color:var(--text-tertiary); flex:none; }
|
|
77
|
+
.group-name { flex:1; min-width:0; display:flex; align-items:center; height:var(--row-height); text-align:left; font-size:var(--text-body); font-weight:550; padding-right:8px; }
|
|
66
78
|
.group-name>span:first-child { overflow:hidden; text-overflow:ellipsis; }
|
|
67
79
|
.group-files { margin-bottom:6px; }
|
|
68
80
|
.file { padding-left:28px; color:var(--text-secondary); }
|
|
@@ -71,7 +83,12 @@ h3 { font-size:var(--text-meta); color:var(--text-tertiary); font-weight:550; li
|
|
|
71
83
|
.search-result { padding-left:8px; }
|
|
72
84
|
.tokens-mode .gallery-viewport > :not(#canvas-background), .tokens-mode #minimap { visibility:hidden; }
|
|
73
85
|
#token-catalog { inset:var(--panel-top) 12px 12px; display:flex; flex-direction:column; overflow:hidden; }
|
|
86
|
+
@media (min-width:720px) {
|
|
87
|
+
.gallery:has(#sidebar:not([hidden])) #token-catalog { left:284px; }
|
|
88
|
+
}
|
|
74
89
|
#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); }
|
|
90
|
+
.token-header-meta { display:flex; align-items:baseline; gap:12px; min-width:0; flex:1; }
|
|
91
|
+
#token-catalog header:has(#token-board-button[hidden]) .token-header-meta { justify-content:space-between; }
|
|
75
92
|
#token-title { line-height:1.5; }
|
|
76
93
|
#token-source { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text-secondary); }
|
|
77
94
|
#token-catalog code { font:var(--text-meta)/1.5 var(--font-mono); overflow-wrap:anywhere; }
|
|
@@ -86,10 +103,11 @@ h3 { font-size:var(--text-meta); color:var(--text-tertiary); font-weight:550; li
|
|
|
86
103
|
#token-table td { padding-block:8px; }
|
|
87
104
|
.token-value { display:flex; align-items:center; gap:8px; }
|
|
88
105
|
.token-value code[title] { color:var(--text-secondary); }
|
|
89
|
-
.token-copy { display:flex; align-items:center; gap:4px; min-height:
|
|
106
|
+
.token-copy { display:flex; align-items:center; gap:4px; min-height:var(--row-height); max-width:100%; text-align:left; white-space:normal; }
|
|
90
107
|
.token-copy:hover { background:none; }
|
|
91
108
|
.token-copy:not([data-copied]):not(:hover):not(:focus-visible) .icon { opacity:0; }
|
|
92
109
|
.token-copy .icon, .token-category { color:var(--text-secondary); }
|
|
110
|
+
.token-copy[data-copied] .icon { color:var(--text); }
|
|
93
111
|
.token-category[aria-current="true"], .token-all { color:var(--text); }
|
|
94
112
|
.token-category[aria-current="true"]>.icon, .token-all[aria-current="true"]>.icon { color:var(--text); }
|
|
95
113
|
.token-all { font-weight:550; }
|
|
@@ -99,47 +117,11 @@ h3 { font-size:var(--text-meta); color:var(--text-tertiary); font-weight:550; li
|
|
|
99
117
|
.token-length span::before { content:''; width:100%; height:1px; background:var(--text-tertiary); }
|
|
100
118
|
.token-radius { height:48px; border:1px solid var(--border); background:var(--surface-sunken); }
|
|
101
119
|
#token-status { margin:16px 0; color:var(--text-secondary); }
|
|
102
|
-
#review-page { inset:var(--panel-top) 12px 12px; display:flex; flex-direction:column; overflow:hidden; }
|
|
103
|
-
.review-header { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px 20px; padding:16px 20px; border-bottom:1px solid var(--border); flex:none; }
|
|
104
|
-
.review-heading { display:flex; align-items:baseline; flex-wrap:wrap; gap:8px 12px; min-width:0; }
|
|
105
|
-
.review-heading h1 { font-size:var(--text-title); font-weight:650; line-height:20px; margin:0; }
|
|
106
|
-
.review-revisions { font:var(--text-meta)/1.4 var(--font-mono); color:var(--text-secondary); }
|
|
107
|
-
.review-counts { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
|
|
108
|
-
.review-count { display:inline-flex; align-items:center; gap:5px; padding:4px 10px; border-radius:999px; background:var(--surface-sunken); font-size:var(--text-meta); color:var(--text-secondary); }
|
|
109
|
-
.review-count strong { font-family:var(--font-mono); font-weight:650; color:var(--text); }
|
|
110
|
-
.review-scroll { min-height:0; flex:1; overflow:auto; padding:20px; display:flex; flex-direction:column; gap:28px; }
|
|
111
|
-
.review-section { display:flex; flex-direction:column; gap:14px; }
|
|
112
|
-
.review-section-title { display:flex; align-items:center; gap:8px; font-size:var(--text-section); font-weight:650; color:var(--text); margin:0; }
|
|
113
|
-
.review-section-count { display:inline-flex; align-items:center; justify-content:center; min-width:22px; height:20px; padding:0 6px; border-radius:999px; background:var(--surface-sunken); font:600 var(--text-caption)/1 var(--font-mono); color:var(--text-secondary); }
|
|
114
|
-
.review-section-list { display:flex; flex-direction:column; gap:16px; }
|
|
115
|
-
.review-frame { border:1px solid var(--border); border-radius:var(--radius-menu); background:var(--surface-section); overflow:hidden; }
|
|
116
|
-
.review-frame-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 16px; border-bottom:1px solid var(--border); background:var(--surface); }
|
|
117
|
-
.review-frame-head h3 { display:flex; align-items:baseline; flex-wrap:wrap; gap:6px; margin:0; font-size:var(--text-body); font-weight:600; color:var(--text); }
|
|
118
|
-
.review-frame-head code { font:var(--text-meta)/1.4 var(--font-mono); color:var(--text-secondary); }
|
|
119
|
-
.review-dot { color:var(--text-tertiary); }
|
|
120
|
-
.review-status-pill { flex:none; padding:2px 8px; border-radius:999px; background:var(--surface-sunken); font-size:var(--text-caption); font-weight:600; text-transform:capitalize; color:var(--text-secondary); }
|
|
121
|
-
.review-themes { display:flex; flex-direction:column; gap:1px; background:var(--border); }
|
|
122
|
-
.review-theme { background:var(--surface); padding:14px 16px 16px; display:flex; flex-direction:column; gap:10px; }
|
|
123
|
-
.review-theme-head { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; }
|
|
124
|
-
.review-theme-name { font-size:var(--text-meta); font-weight:650; text-transform:capitalize; color:var(--text); }
|
|
125
|
-
.review-theme-meta { font:var(--text-caption)/1.4 var(--font-mono); color:var(--text-tertiary); }
|
|
126
|
-
.review-columns { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:12px; align-items:start; }
|
|
127
|
-
@media (max-width:900px) { .review-columns { grid-template-columns:1fr; } }
|
|
128
|
-
.review-pane { margin:0; display:flex; flex-direction:column; gap:6px; min-width:0; }
|
|
129
|
-
.review-pane figcaption { font-size:var(--text-caption); font-weight:550; color:var(--text-secondary); }
|
|
130
|
-
.review-stage { border:1px solid var(--border); border-radius:var(--radius-row); padding:10px; display:flex; align-items:center; justify-content:center; min-height:96px; overflow:auto; background:#ecece9; }
|
|
131
|
-
.review-stage[data-stage-theme="dark"] { background:#121212; border-color:#2d2d2d; }
|
|
132
|
-
.review-stage-diff { background:repeating-conic-gradient(var(--surface-sunken) 0% 25%, var(--surface) 0% 50%) 50% / 14px 14px; }
|
|
133
|
-
.review-stage-diff[data-stage-theme="dark"] { background:repeating-conic-gradient(#1f1f1f 0% 25%, #161616 0% 50%) 50% / 14px 14px; }
|
|
134
|
-
.review-stage img { display:block; max-width:100%; height:auto; }
|
|
135
|
-
.review-absent { border:1px dashed var(--border); border-radius:var(--radius-row); min-height:96px; padding:12px; display:flex; align-items:center; justify-content:center; text-align:center; font-size:var(--text-meta); color:var(--text-tertiary); background:var(--surface-sunken); }
|
|
136
|
-
.review-empty { margin:12px 0; color:var(--text-secondary); font-size:var(--text-body); }
|
|
137
|
-
.review-empty code { font:var(--text-meta)/1.4 var(--font-mono); }
|
|
138
120
|
@media (max-width:600px) {
|
|
139
121
|
#token-table .token-length, #token-table .token-radius { display:none; }
|
|
140
122
|
#token-table th, #token-table td { padding-right:8px; }
|
|
141
123
|
}
|
|
142
|
-
#app-bar { top:12px; left:12px; height:
|
|
124
|
+
#app-bar { top:12px; left:12px; height:var(--toolbar-height); display:flex; align-items:center; padding:6px; gap:8px; z-index:2; }
|
|
143
125
|
#app-bar #app-directory { width:220px; }
|
|
144
126
|
#tools { z-index:2; }
|
|
145
127
|
@media (max-width:1060px) {
|
|
@@ -148,24 +130,27 @@ h3 { font-size:var(--text-meta); color:var(--text-tertiary); font-weight:550; li
|
|
|
148
130
|
#app-bar #app-directory { width:auto; flex:1; min-width:0; }
|
|
149
131
|
#app-bar .search-field { width:clamp(98px, 22vw, 216px); }
|
|
150
132
|
#app-bar .separator { display:none; }
|
|
151
|
-
#scope-tabs { order:1; flex:1 1
|
|
133
|
+
#scope-tabs { order:1; flex:1 1 auto; }
|
|
134
|
+
#scope-isolation, #token-view-toggle { order:1; }
|
|
152
135
|
}
|
|
153
136
|
@media (max-width:600px) {
|
|
154
137
|
#search-key { display:none; }
|
|
155
138
|
}
|
|
156
139
|
#app-bar .separator { margin:0; }
|
|
157
|
-
#tools { top:12px; right:12px; height:
|
|
140
|
+
#tools { top:12px; right:12px; height:var(--toolbar-height); display:flex; align-items:center; gap:4px; padding:6px; }
|
|
158
141
|
.separator { width:1px; height:20px; background:var(--border); flex:none; margin-left:4px; }
|
|
159
|
-
.zoom { left:50%; bottom:16px; height:
|
|
160
|
-
#
|
|
142
|
+
.zoom { left:50%; bottom:16px; height:var(--toolbar-height); display:flex; align-items:center; gap:4px; padding:6px; transform:translateX(-50%); }
|
|
143
|
+
body:has(#comment-tool[aria-pressed="true"]) #board-chrome :is(button, .board-caption, [data-adg-token] code) { pointer-events:none; }
|
|
144
|
+
#zoom-options { display:flex; align-items:center; gap:4px; height:var(--control-size); padding:0 10px; font-weight:550; }
|
|
161
145
|
#zoom-options>[data-icon] { color:var(--text-tertiary); }
|
|
162
|
-
#minimap { right:12px; bottom:16px; width:200px; height:132px; border-radius:12px; cursor:crosshair; }
|
|
146
|
+
#minimap { right:12px; bottom:16px; width:200px; height:132px; border-radius:var(--radius-card, 12px); cursor:crosshair; touch-action:none; }
|
|
163
147
|
#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; }
|
|
164
148
|
.inspector-heading { padding:16px 16px 12px; position:relative; }
|
|
165
149
|
#source-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
166
150
|
#source-path { min-width:0; overflow-wrap:anywhere; white-space:normal; }
|
|
167
151
|
.detail-copy { display:flex; align-items:center; gap:8px; min-width:0; max-width:100%; text-align:left; line-height:16px; }
|
|
168
152
|
.detail-copy .icon { color:var(--text-tertiary); }
|
|
153
|
+
.detail-copy[data-copied="true"] .icon { color:var(--text); }
|
|
169
154
|
#copy-path { margin-top:4px; font-family:var(--font-mono); font-size:var(--text-meta); color:var(--text-secondary); }
|
|
170
155
|
#frame-detail { margin-top:12px; display:flex; align-items:center; justify-content:space-between; gap:8px; line-height:16px; }
|
|
171
156
|
#frame-name { min-width:0; overflow-wrap:anywhere; white-space:normal; }
|
|
@@ -174,7 +159,7 @@ h3 { font-size:var(--text-meta); color:var(--text-tertiary); font-weight:550; li
|
|
|
174
159
|
#source h3 { margin:12px 16px 6px; }
|
|
175
160
|
#forms { padding:0 8px 12px; max-height:220px; overflow:auto; }
|
|
176
161
|
#forms .tree-row { gap:6px; }
|
|
177
|
-
.frame-row,.relationship-row { height:auto; min-height:
|
|
162
|
+
.frame-row,.relationship-row { height:auto; min-height:var(--row-height); padding-top:6px; padding-bottom:6px; }
|
|
178
163
|
.frame-row { min-height:31.2px; }
|
|
179
164
|
.frame-row>span:not(.count),.relationship-row>span { white-space:normal; overflow-wrap:anywhere; }
|
|
180
165
|
.frame-note { margin:4px 8px 8px; color:var(--text-secondary); }
|
|
@@ -190,9 +175,9 @@ h3 { font-size:var(--text-meta); color:var(--text-tertiary); font-weight:550; li
|
|
|
190
175
|
#hover-outline,#selection-outline { position:absolute; pointer-events:none; border:1px dashed var(--accent); border-radius:2px; }
|
|
191
176
|
#selection-outline { border:2px solid var(--accent); }
|
|
192
177
|
.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); }
|
|
193
|
-
.menu button { display:flex; align-items:center; text-align:left; width:100%; height:
|
|
178
|
+
.menu button { display:flex; align-items:center; text-align:left; width:100%; height:var(--menu-item-height); padding:0 10px; }
|
|
194
179
|
.menu button .key { margin-left:auto; color:var(--text-tertiary); font-family:var(--font-mono); font-size:var(--text-meta); }
|
|
195
|
-
.menu h3 { display:flex; align-items:center; height:
|
|
180
|
+
.menu h3 { display:flex; align-items:center; height:var(--menu-label-height); padding:0 10px; font-size:var(--text-caption); }
|
|
196
181
|
.menu .rule { margin:4px 2px; }
|
|
197
182
|
#themes button,#backgrounds button { padding-left:32px; position:relative; }
|
|
198
183
|
#themes button .icon,#backgrounds button .icon { position:absolute; left:10px; }
|
|
@@ -203,98 +188,35 @@ h3 { font-size:var(--text-meta); color:var(--text-tertiary); font-weight:550; li
|
|
|
203
188
|
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); }
|
|
204
189
|
dialog::backdrop { background:color-mix(in srgb,var(--canvas) 60%,transparent); }
|
|
205
190
|
.dialog-close { position:absolute; right:16px; top:18px; }
|
|
206
|
-
|
|
207
|
-
#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); }
|
|
208
|
-
#path::placeholder { color:var(--text-tertiary); opacity:1; }
|
|
209
|
-
#path[aria-invalid="true"] { outline:1px solid var(--danger); outline-offset:-1px; }
|
|
210
|
-
#recent-heading { margin:16px 0 6px; }
|
|
211
|
-
#recent { margin:0 -8px; display:flex; flex-direction:column; gap:2px; max-height:276px; overflow:auto; }
|
|
212
|
-
#recent button { height:44px; min-height:44px; width:100%; padding:0 10px; display:flex; align-items:center; gap:10px; text-align:left; }
|
|
213
|
-
#recent button>[data-icon] { color:var(--text-tertiary); }
|
|
214
|
-
#recent button[aria-current="true"]>[data-icon] { color:var(--text); }
|
|
215
|
-
.recent-text { display:flex; flex-direction:column; gap:2px; min-width:0; }
|
|
216
|
-
.recent-text strong { font-weight:550; }
|
|
217
|
-
.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; }
|
|
218
|
-
footer { display:flex; justify-content:flex-end; margin-top:16px; }
|
|
219
|
-
.primary { height:32px; background:var(--accent); color:var(--on-accent); border-radius:var(--radius-field); padding:0 14px; font-weight:550; }
|
|
220
|
-
.primary:hover { background:var(--accent); }
|
|
221
|
-
#open-error { display:flex; align-items:center; gap:6px; margin-top:10px; line-height:14px; color:var(--danger); font-size:var(--text-meta); }
|
|
222
|
-
#keys { width:380px; height:314px; padding:20px 20px 12px; }
|
|
191
|
+
#keys { width:380px; min-height:382px; padding:20px 20px 12px; }
|
|
223
192
|
#keys dl { margin:24px 0 0; }
|
|
224
|
-
#keys dl>div { display:flex; align-items:flex-start; justify-content:space-between; height:34px; line-height:
|
|
193
|
+
#keys dl>div { display:flex; align-items:flex-start; justify-content:space-between; height:34px; line-height:var(--keycap-size); }
|
|
225
194
|
#keys dt { color:var(--text-secondary); }
|
|
226
195
|
#keys dd { margin:0; display:flex; gap:6px; }
|
|
227
|
-
kbd { display:inline-flex; align-items:center; height:
|
|
196
|
+
kbd { display:inline-flex; align-items:center; height:var(--keycap-size); padding:0 7px; border-radius:var(--radius-keycap); background:var(--surface-sunken); font:var(--text-meta)/1 var(--font-mono); color:var(--text-secondary); }
|
|
228
197
|
#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; }
|
|
229
198
|
#empty { position:absolute; inset:45% 0 auto; text-align:center; color:var(--text-tertiary); }
|
|
230
199
|
.sr { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
|
|
231
200
|
#context-menu { min-width:220px; max-width:min(288px, calc(100vw - 16px)); z-index:8; }
|
|
232
|
-
#
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
.
|
|
238
|
-
.
|
|
239
|
-
.
|
|
240
|
-
.
|
|
241
|
-
.
|
|
242
|
-
.
|
|
243
|
-
.
|
|
244
|
-
.
|
|
245
|
-
.
|
|
246
|
-
.
|
|
247
|
-
.
|
|
248
|
-
.
|
|
249
|
-
.
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
.annotation-row-action { flex:none; align-self:center; height:24px; padding:0 8px; font-size:var(--text-caption); color:var(--text-secondary); background:var(--surface-sunken); }
|
|
255
|
-
.annotation-number { font-family:var(--font-mono); font-size:var(--text-caption); font-weight:650; color:var(--text); flex:none; }
|
|
256
|
-
.annotation-badge { display:inline-flex; align-items:center; height:18px; padding:0 6px; border-radius:999px; font-size:10px; font-weight:600; text-transform:capitalize; flex:none; background:var(--surface-sunken); color:var(--text-secondary); }
|
|
257
|
-
.annotation-badge[data-status="open"] { color:var(--note-open); background:color-mix(in srgb, var(--note-open) 14%, var(--surface)); }
|
|
258
|
-
.annotation-badge[data-status="addressed"] { color:var(--note-addressed); background:color-mix(in srgb, var(--note-addressed) 16%, var(--surface)); }
|
|
259
|
-
.annotation-badge[data-stale="true"] { color:var(--note-stale); background:color-mix(in srgb, var(--note-stale) 16%, var(--surface)); }
|
|
260
|
-
.annotation-layer { position:absolute; inset:0; pointer-events:none; overflow:visible; will-change:transform; }
|
|
261
|
-
.annotation-layer svg { position:absolute; width:100%; height:100%; overflow:visible; }
|
|
262
|
-
.annotation-layer polyline { fill:none; stroke:var(--note-open); stroke-width:1.5; }
|
|
263
|
-
.annotation-layer polyline[data-state="addressed"] { stroke:var(--note-addressed); }
|
|
264
|
-
.annotation-layer polyline[data-stale="true"] { stroke:var(--note-stale); stroke-dasharray:4 3; }
|
|
265
|
-
.annotation-point,.annotation-card,.annotation-frame-badge { position:absolute; pointer-events:auto; }
|
|
266
|
-
.annotation-point { transform:translate(-50%,-50%); display:grid; place-items:center; width:26px; height:26px; border-radius:50%; border:2px solid var(--surface); background:var(--note-open); color:#fff; font-size:var(--text-caption); font-weight:650; box-shadow:var(--shadow-float); }
|
|
267
|
-
.annotation-point:hover { background:var(--note-open); filter:brightness(1.06); }
|
|
268
|
-
.annotation-point[data-state="addressed"] { background:var(--note-addressed); border-radius:8px; }
|
|
269
|
-
.annotation-point[data-stale="true"] { background:var(--surface); color:var(--note-stale); border:2px dashed var(--note-stale); }
|
|
270
|
-
.annotation-point[data-highlighted="true"] { outline:2px solid var(--accent); outline-offset:2px; }
|
|
271
|
-
.annotation-frame-badge { transform:translate(-50%,-50%); display:inline-flex; align-items:center; justify-content:center; min-width:22px; height:22px; padding:0 6px; border-radius:999px; border:2px solid var(--surface); background:var(--note-open); color:#fff; font-size:var(--text-caption); font-weight:650; box-shadow:var(--shadow-float); }
|
|
272
|
-
.annotation-frame-badge[data-status="addressed"] { background:var(--note-addressed); }
|
|
273
|
-
.annotation-frame-badge[data-stale="true"] { border-style:dashed; border-color:var(--note-stale); }
|
|
274
|
-
.annotation-card { width:244px; background:var(--surface); color:var(--text); border:1px solid color-mix(in srgb, var(--note-open) 55%, var(--border)); border-left:3px solid var(--note-open); border-radius:var(--radius-menu); padding:8px 10px; box-shadow:var(--shadow-float); display:flex; flex-direction:column; gap:6px; }
|
|
275
|
-
.annotation-card[data-state="addressed"] { border-color:color-mix(in srgb, var(--note-addressed) 55%, var(--border)); border-left-color:var(--note-addressed); background:color-mix(in srgb, var(--note-addressed) 5%, var(--surface)); }
|
|
276
|
-
.annotation-card[data-stale="true"] { border:1px dashed var(--note-stale); border-left:3px dashed var(--note-stale); }
|
|
277
|
-
.annotation-card[data-highlighted="true"] { outline:2px solid var(--accent); outline-offset:1px; }
|
|
278
|
-
.annotation-card-header { display:flex; align-items:center; gap:5px; min-width:0; }
|
|
279
|
-
.annotation-owner { margin-left:auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-family:var(--font-mono); font-size:10px; color:var(--text-tertiary); }
|
|
280
|
-
.annotation-card .annotation-note { display:block; width:100%; padding:2px 4px; margin:0 -4px; border-radius:6px; text-align:left; white-space:pre-wrap; overflow:auto; max-height:64px; font-size:var(--text-body); line-height:1.35; overflow-wrap:anywhere; }
|
|
281
|
-
.annotation-thread { display:flex; flex-direction:column; gap:4px; padding-top:4px; border-top:1px solid var(--border); max-height:96px; overflow:auto; }
|
|
282
|
-
.annotation-reply { font-size:var(--text-meta); line-height:1.35; padding:4px 6px; border-radius:6px; background:var(--surface-sunken); }
|
|
283
|
-
.annotation-reply[data-author="agent"] { border-left:2px solid var(--note-addressed); }
|
|
284
|
-
.annotation-reply-author { display:block; font-size:10px; font-weight:600; color:var(--text-tertiary); margin-bottom:1px; }
|
|
285
|
-
.annotation-reply-body { white-space:pre-wrap; overflow-wrap:anywhere; color:var(--text); }
|
|
286
|
-
.annotation-actions { display:flex; flex-wrap:wrap; gap:2px; padding-top:2px; }
|
|
287
|
-
.annotation-actions button { height:22px; padding:0 6px; font-size:var(--text-caption); color:var(--text-secondary); border-radius:6px; }
|
|
288
|
-
.annotation-actions button:hover { color:var(--text); background:var(--surface-sunken); }
|
|
289
|
-
.annotation-editor { width:400px; padding:18px; border-radius:var(--radius-dialog); border:1px solid var(--border); background:var(--surface); color:var(--text); box-shadow:var(--shadow-menu); }
|
|
290
|
-
.annotation-editor-meta { margin-top:4px; font:var(--text-caption)/1.3 var(--font-mono); color:var(--text-tertiary); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
291
|
-
.annotation-editor textarea { margin-top:12px; width:100%; min-height:88px; resize:vertical; padding:8px 10px; border:1px solid var(--border); border-radius:var(--radius-field); background:var(--surface-sunken); color:var(--text); font:var(--text-body)/1.4 var(--font-ui); outline:none; }
|
|
292
|
-
.annotation-editor textarea:focus-visible { border-color:var(--accent); }
|
|
293
|
-
.annotation-editor-footer { margin-top:12px; display:flex; align-items:center; justify-content:space-between; gap:8px; }
|
|
294
|
-
.annotation-editor-hint { font-size:var(--text-caption); color:var(--text-tertiary); }
|
|
295
|
-
.annotation-editor-buttons { display:flex; gap:6px; }
|
|
296
|
-
.annotation-editor-buttons button:not(.primary) { height:32px; padding:0 12px; border-radius:var(--radius-field); color:var(--text-secondary); }
|
|
297
|
-
.annotating { cursor:crosshair !important; }
|
|
298
|
-
@media (prefers-reduced-motion: reduce) {
|
|
299
|
-
.annotation-layer, .annotation-point, .annotation-card, .annotation-row { transition:none !important; animation:none !important; }
|
|
300
|
-
}
|
|
201
|
+
#board-chrome {position:absolute;left:0;top:0;transform-origin:0 0;pointer-events:none;will-change:transform;color:var(--text);font-family:var(--font-ui,system-ui,sans-serif)}
|
|
202
|
+
.chapter-board {position:absolute;padding:64px 80px 80px}
|
|
203
|
+
.chapter-board header {display:grid;grid-template-columns:1fr 440px;gap:64px;align-items:end;padding-bottom:56px}
|
|
204
|
+
.chapter-board header h1 {margin:16px 0 0;font:600 48px/56px var(--font-ui,system-ui);letter-spacing:-.02em}
|
|
205
|
+
.chapter-board header>p {font-size:13px;color:var(--text-secondary);line-height:1.6}
|
|
206
|
+
.board-eyebrow {display:flex;align-items:center;gap:12px;text-transform:uppercase;letter-spacing:.16em;font-size:11px;font-weight:600;color:var(--text-tertiary)}
|
|
207
|
+
.board-eyebrow b {display:grid;place-items:center;min-width:var(--row-height);height:var(--row-height);border-radius:var(--radius-pill, 999px);background:var(--action,var(--text));color:var(--on-action,var(--surface));letter-spacing:0;font-family:var(--font-mono,monospace)}
|
|
208
|
+
.board-source {position:absolute;border-top:1px solid var(--border);padding-top:48px}
|
|
209
|
+
.board-source button {display:block;pointer-events:auto;white-space:normal;text-align:left;width:280px;font:600 22px/28px var(--font-ui,system-ui);overflow-wrap:anywhere}
|
|
210
|
+
.board-copy-icon {display:inline-flex;vertical-align:middle;margin-left:6px;color:var(--text-tertiary);opacity:0}
|
|
211
|
+
.board-source button:is(:hover,:focus-visible,[data-copied="true"]) .board-copy-icon {opacity:1}
|
|
212
|
+
.board-source button[data-copied="true"] .board-copy-icon {color:var(--text)}
|
|
213
|
+
.board-path {display:flex;align-items:flex-start;gap:6px;width:280px;margin-top:20px;font:var(--text-caption)/1.6 var(--font-mono,monospace);color:var(--text-tertiary);overflow-wrap:anywhere}
|
|
214
|
+
.board-path svg {flex:none;margin-top:2px}
|
|
215
|
+
.board-modified {margin-top:8px;font-size:var(--text-caption);color:var(--text-tertiary)}
|
|
216
|
+
.board-caption {position:absolute;font:var(--text-meta)/17px var(--font-mono,monospace);overflow-wrap:anywhere;pointer-events:auto;cursor:pointer}
|
|
217
|
+
.board-caption:hover>span {text-decoration:underline;text-underline-offset:2px}
|
|
218
|
+
.board-caption small {display:block;font:var(--text-meta)/17px var(--font-ui,system-ui);color:var(--text-tertiary)}
|
|
219
|
+
#board-chrome [data-adg-token] code {pointer-events:auto;cursor:pointer;border-radius:4px}
|
|
220
|
+
#board-chrome [data-adg-token] code:hover {text-decoration:underline;text-underline-offset:2px}
|
|
221
|
+
#board-chrome [data-adg-token] code[data-copied="true"] {color:var(--accent)}
|
|
222
|
+
#board-chrome [data-adg-token] code[data-copied="true"]::after {content:" ✓"}
|
package/public/switcher.css
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
@keyframes switcher-spin { to { transform:rotate(360deg); } }
|
|
1
2
|
#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
3
|
#project-switcher:popover-open { display:flex; flex-direction:column; gap:4px; }
|
|
3
4
|
#project-switcher a { color:inherit; text-decoration:none; }
|
|
4
|
-
#project-switcher a:hover
|
|
5
|
+
#project-switcher a:hover { background:var(--surface-sunken); }
|
|
6
|
+
#project-switcher a:focus-visible { background:var(--surface-sunken); outline:1px solid var(--accent); outline-offset:-1px; }
|
|
5
7
|
#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
8
|
.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
9
|
.switcher-home .switcher-icon { color:var(--text-tertiary); }
|
|
@@ -15,6 +17,7 @@
|
|
|
15
17
|
.switcher-icon { display:flex; flex:none; color:var(--text-secondary); }
|
|
16
18
|
.switcher-search .switcher-icon { color:var(--text-tertiary); }
|
|
17
19
|
.switcher-search .icon { width:14px; height:14px; }
|
|
20
|
+
.switcher-error { margin:0 4px; padding:6px 10px; border-radius:var(--radius-row); background:var(--surface-sunken); color:var(--danger); font-size:var(--text-meta); }
|
|
18
21
|
.switcher-targets, .switcher-targets>[role="group"] { display:flex; flex-direction:column; gap:4px; }
|
|
19
22
|
.switcher-row { display:flex; align-items:center; gap:12px; padding:12px 10px; margin:0; border-radius:var(--radius-row); }
|
|
20
23
|
.switcher-row[aria-current="page"] { background:var(--surface-sunken); }
|
|
@@ -22,6 +25,7 @@
|
|
|
22
25
|
.switcher-instance-current { background:var(--surface-sunken); }
|
|
23
26
|
.switcher-instance .switcher-row { flex:1; min-width:0; }
|
|
24
27
|
.switcher-close:hover:not(:disabled) { color:var(--text); }
|
|
28
|
+
.switcher-close[data-loading] .icon { animation:switcher-spin .9s linear infinite; }
|
|
25
29
|
.switcher-labels { display:flex; flex-direction:column; flex:1; min-width:0; gap:4px; }
|
|
26
30
|
.switcher-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:550; }
|
|
27
31
|
.switcher-detail { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:var(--text-meta); color:var(--text-secondary); }
|
|
@@ -29,9 +33,6 @@
|
|
|
29
33
|
.switcher-empty { margin:0; padding:12px 10px; color:var(--text-secondary); }
|
|
30
34
|
.picker[aria-expanded="true"] { outline:1px solid var(--accent); outline-offset:-1px; }
|
|
31
35
|
.switcher-chevron { display:flex; color:var(--text-tertiary); }
|
|
32
|
-
#app-bar:not(:has(#scope-tabs)) .picker[aria-controls="project-switcher"] { width:240px; }
|
|
33
36
|
@media (max-width:600px) {
|
|
34
|
-
:root[data-hub-viewer]:not(:has(#scope-tabs)) #tools { display:none; }
|
|
35
37
|
#project-switcher { width:calc(100vw - 24px); }
|
|
36
|
-
#app-bar:not(:has(#scope-tabs)) .picker[aria-controls="project-switcher"] { width:220px; }
|
|
37
38
|
}
|
package/public/switcher.js
CHANGED
|
@@ -4,14 +4,14 @@ import { instanceCloseButton } from './instance-actions.js';
|
|
|
4
4
|
|
|
5
5
|
const route = location.pathname.match(/^\/(p|i)\/([^/]+)\//);
|
|
6
6
|
if (route) document.documentElement.dataset.hubViewer = 'true';
|
|
7
|
-
let current, kind, targets = [], triggers = [], opener;
|
|
7
|
+
let current, kind, targets = [], triggers = [], opener, refreshingTargets = null;
|
|
8
8
|
const menu = document.createElement('nav');
|
|
9
9
|
menu.id = 'project-switcher';
|
|
10
10
|
menu.setAttribute('popover', 'auto');
|
|
11
11
|
menu.setAttribute('aria-label', 'Project switcher');
|
|
12
12
|
const element = (tag, className, text) => {
|
|
13
13
|
const node = document.createElement(tag);
|
|
14
|
-
node.className = className;
|
|
14
|
+
if (className) node.className = className;
|
|
15
15
|
if (text !== undefined) node.textContent = text;
|
|
16
16
|
return node;
|
|
17
17
|
};
|
|
@@ -20,6 +20,11 @@ const glyph = (name, size = 16) => {
|
|
|
20
20
|
node.innerHTML = icon(name, size);
|
|
21
21
|
return node;
|
|
22
22
|
};
|
|
23
|
+
function proxyReason(reason) {
|
|
24
|
+
if (reason === 'proxy-auth-unsupported') return 'Update ADG to proxy';
|
|
25
|
+
if (reason === 'health-unavailable') return 'Viewer not responding';
|
|
26
|
+
return 'Proxy unavailable';
|
|
27
|
+
}
|
|
23
28
|
export function updateSwitcherLabels() {
|
|
24
29
|
if (!current) return;
|
|
25
30
|
for (const trigger of triggers) {
|
|
@@ -41,40 +46,104 @@ function close() {
|
|
|
41
46
|
menu.hidePopover();
|
|
42
47
|
opener?.focus({ preventScroll: true });
|
|
43
48
|
}
|
|
49
|
+
async function loadTargets() {
|
|
50
|
+
const responses = await Promise.all(['/api/projects', '/api/instances'].map(url => dataFetch(url)));
|
|
51
|
+
for (const response of responses) if (!response.ok) throw new Error(`Cannot load project switcher: HTTP ${response.status}`);
|
|
52
|
+
const [projects, instances] = await Promise.all(responses.map(response => response.json()));
|
|
53
|
+
return {
|
|
54
|
+
projects,
|
|
55
|
+
all: [...projects.map(item => ({ ...item, kind: 'p' })), ...instances.map(item => ({ ...item, kind: 'i' }))],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function makeSearchField() {
|
|
59
|
+
const field = element('div', 'switcher-search');
|
|
60
|
+
const input = element('input', '');
|
|
61
|
+
input.type = 'search';
|
|
62
|
+
input.placeholder = 'Find project or instance…';
|
|
63
|
+
input.setAttribute('aria-label', 'Find project or instance');
|
|
64
|
+
input.autocomplete = 'off';
|
|
65
|
+
const clear = element('button', 'switcher-clear');
|
|
66
|
+
clear.type = 'button';
|
|
67
|
+
clear.setAttribute('aria-label', 'Clear project search');
|
|
68
|
+
clear.append(glyph('x'));
|
|
69
|
+
clear.hidden = true;
|
|
70
|
+
clear.onclick = () => { input.value = ''; input.dispatchEvent(new Event('input')); input.focus(); };
|
|
71
|
+
field.append(glyph('search'), input, clear);
|
|
72
|
+
input.oninput = () => { clear.hidden = !input.value; renderTargets(input.value); };
|
|
73
|
+
return field;
|
|
74
|
+
}
|
|
75
|
+
async function refreshOpenMenu() {
|
|
76
|
+
if (refreshingTargets) return refreshingTargets;
|
|
77
|
+
refreshingTargets = (async () => {
|
|
78
|
+
try {
|
|
79
|
+
const { all } = await loadTargets();
|
|
80
|
+
targets = all;
|
|
81
|
+
const nextCurrent = targets.find(item => item.kind === kind && (item.slug ?? item.id) === route[2]);
|
|
82
|
+
if (nextCurrent) {
|
|
83
|
+
current = nextCurrent;
|
|
84
|
+
updateSwitcherLabels();
|
|
85
|
+
}
|
|
86
|
+
if (!menu.matches(':popover-open')) return;
|
|
87
|
+
const existingSearch = menu.querySelector('.switcher-search');
|
|
88
|
+
if (targets.length >= 5 && !existingSearch) {
|
|
89
|
+
menu.querySelector('.switcher-error')?.before(makeSearchField());
|
|
90
|
+
} else if (targets.length < 5 && existingSearch && !existingSearch.querySelector('input')?.value) {
|
|
91
|
+
existingSearch.remove();
|
|
92
|
+
}
|
|
93
|
+
const query = menu.querySelector('input')?.value ?? '';
|
|
94
|
+
const activeHref = document.activeElement?.getAttribute?.('href');
|
|
95
|
+
const searchFocused = document.activeElement?.tagName === 'INPUT';
|
|
96
|
+
renderTargets(query);
|
|
97
|
+
position();
|
|
98
|
+
if (!searchFocused && activeHref) {
|
|
99
|
+
menu.querySelector(`a[href="${CSS.escape(activeHref)}"]`)?.focus({ preventScroll: true });
|
|
100
|
+
}
|
|
101
|
+
} catch {} finally {
|
|
102
|
+
refreshingTargets = null;
|
|
103
|
+
}
|
|
104
|
+
})();
|
|
105
|
+
return refreshingTargets;
|
|
106
|
+
}
|
|
44
107
|
function open(trigger) {
|
|
45
108
|
opener = trigger;
|
|
46
109
|
render();
|
|
47
110
|
position();
|
|
48
111
|
menu.showPopover();
|
|
49
|
-
(menu.querySelector('a[aria-current="page"]') ?? menu.querySelector('a'))
|
|
112
|
+
(menu.querySelector('a[aria-current="page"]') ?? menu.querySelector('a'))?.focus({ preventScroll: true });
|
|
113
|
+
void refreshOpenMenu();
|
|
114
|
+
}
|
|
115
|
+
function showSwitcherError(message) {
|
|
116
|
+
const inline = menu.querySelector('.switcher-error');
|
|
117
|
+
if (menu.matches(':popover-open') && inline) {
|
|
118
|
+
inline.textContent = message;
|
|
119
|
+
inline.hidden = !message;
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const alert = document.querySelector('#error');
|
|
123
|
+
if (alert) {
|
|
124
|
+
alert.textContent = message;
|
|
125
|
+
alert.hidden = !message;
|
|
126
|
+
}
|
|
50
127
|
}
|
|
51
128
|
function render() {
|
|
52
129
|
const home = element('a', 'switcher-home', 'All projects');
|
|
53
130
|
home.href = '/';
|
|
54
131
|
home.append(glyph('arrow-up-left', 14));
|
|
132
|
+
const inlineError = element('p', 'switcher-error');
|
|
133
|
+
inlineError.setAttribute('role', 'alert');
|
|
134
|
+
inlineError.hidden = true;
|
|
55
135
|
menu.replaceChildren(home, element('div', 'switcher-rule'));
|
|
56
|
-
if (targets.length >= 5)
|
|
57
|
-
|
|
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'));
|
|
136
|
+
if (targets.length >= 5) menu.append(makeSearchField());
|
|
137
|
+
menu.append(inlineError, element('div', 'switcher-targets'));
|
|
72
138
|
renderTargets('');
|
|
73
139
|
}
|
|
74
140
|
function renderTargets(query) {
|
|
75
141
|
const container = menu.querySelector('.switcher-targets');
|
|
142
|
+
if (!container) return;
|
|
76
143
|
container.replaceChildren();
|
|
77
|
-
const
|
|
144
|
+
const normalized = query.trim().toLowerCase();
|
|
145
|
+
const matches = targets.filter(item => [item.name, item.design, item.path, item.directory, item.branch, item.port != null ? `:${item.port}` : '']
|
|
146
|
+
.some(value => value?.toLowerCase().includes(normalized)));
|
|
78
147
|
for (const [type, title] of [['p', 'Projects'], ['i', 'Live instances']]) {
|
|
79
148
|
const items = matches.filter(item => item.kind === type);
|
|
80
149
|
if (!items.length) continue;
|
|
@@ -92,10 +161,10 @@ function renderTargets(query) {
|
|
|
92
161
|
if (selected) row.setAttribute('aria-current', 'page');
|
|
93
162
|
row.append(glyph(type === 'i' ? 'radio' : 'folder'));
|
|
94
163
|
const labels = element('span', 'switcher-labels');
|
|
95
|
-
labels.append(element('span', 'switcher-name', item.name));
|
|
164
|
+
labels.append(element('span', 'switcher-name', item.name ?? item.projectName ?? item.id));
|
|
96
165
|
const detail = item.compatibility?.compatible === false
|
|
97
166
|
? `Requires ADG ${item.compatibility.requires?.replace(/>=/g, '≥')} · hub ${item.compatibility.version}`
|
|
98
|
-
: item.proxyable === false ?
|
|
167
|
+
: item.proxyable === false ? proxyReason(item.reason) : type === 'i' ? [item.port != null ? `:${item.port}` : null, item.directory].filter(Boolean).join(' · ')
|
|
99
168
|
: item.error ?? item.design ?? item.path ?? item.directory;
|
|
100
169
|
const meta = element('span', `switcher-detail${disabled ? ' switcher-danger' : ''}`, detail);
|
|
101
170
|
meta.title = detail ?? '';
|
|
@@ -107,14 +176,11 @@ function renderTargets(query) {
|
|
|
107
176
|
if (selected) instance.classList.add('switcher-instance-current');
|
|
108
177
|
const stop = instanceCloseButton(item, 'icon-button switcher-close', () => {
|
|
109
178
|
if (selected) { location.replace('/'); return; }
|
|
179
|
+
showSwitcherError('');
|
|
110
180
|
targets = targets.filter(target => target !== item);
|
|
111
181
|
renderTargets(menu.querySelector('input')?.value ?? '');
|
|
112
|
-
(menu.querySelector('a[aria-current="page"]') ?? menu.querySelector('a'))
|
|
113
|
-
}, failure =>
|
|
114
|
-
const alert = document.querySelector('#error');
|
|
115
|
-
alert.textContent = failure.message;
|
|
116
|
-
alert.hidden = false;
|
|
117
|
-
});
|
|
182
|
+
(menu.querySelector('a[aria-current="page"]') ?? menu.querySelector('a'))?.focus({ preventScroll: true });
|
|
183
|
+
}, failure => showSwitcherError(failure.message));
|
|
118
184
|
instance.append(row, stop);
|
|
119
185
|
section.append(instance);
|
|
120
186
|
}
|
|
@@ -125,14 +191,22 @@ function renderTargets(query) {
|
|
|
125
191
|
export async function initSwitcher() {
|
|
126
192
|
if (!route) return;
|
|
127
193
|
kind = route[1];
|
|
128
|
-
triggers = [...document.querySelectorAll('#
|
|
194
|
+
triggers = [...document.querySelectorAll('#app-directory')];
|
|
129
195
|
try {
|
|
130
|
-
const
|
|
131
|
-
|
|
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' }))];
|
|
196
|
+
const { projects, all } = await loadTargets();
|
|
197
|
+
targets = all;
|
|
134
198
|
current = targets.find(item => item.kind === kind && (item.slug ?? item.id) === route[2]);
|
|
135
|
-
if (!current)
|
|
199
|
+
if (!current) {
|
|
200
|
+
if (kind === 'p') {
|
|
201
|
+
const matches = projects.filter(project => project.path.split(/[/\\]/).at(-1) === route[2]);
|
|
202
|
+
if (matches.length === 1) {
|
|
203
|
+
const url = new URL(location.href);
|
|
204
|
+
url.pathname = matches[0].url + url.pathname.slice(route[0].length);
|
|
205
|
+
location.replace(url);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
136
210
|
document.body.append(menu);
|
|
137
211
|
for (const trigger of triggers) {
|
|
138
212
|
trigger.setAttribute('aria-expanded', 'false');
|
|
@@ -163,6 +237,7 @@ export async function initSwitcher() {
|
|
|
163
237
|
if (!['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) return;
|
|
164
238
|
if (event.target.matches('input') && ['Home', 'End'].includes(event.key)) return;
|
|
165
239
|
const actions = [...menu.querySelectorAll('a, .switcher-close:not(:disabled)')];
|
|
240
|
+
if (!actions.length) return;
|
|
166
241
|
const index = actions.indexOf(document.activeElement);
|
|
167
242
|
const next = event.key === 'Home' ? 0 : event.key === 'End' ? actions.length - 1
|
|
168
243
|
: (index + (event.key === 'ArrowDown' ? 1 : -1) + actions.length) % actions.length;
|