cladogram 0.5.5-beta.4 → 0.5.5-beta.6
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 +2 -2
- package/docs/release.md +12 -0
- package/package.json +1 -3
- package/plugins/agent/index.js +167 -33
- package/plugins/agent/style.css +384 -94
- package/plugins/brand/index.js +12 -1
- package/plugins/brand/style.css +48 -29
- package/plugins/directory/style.css +131 -24
- package/plugins/view-controls/style.css +6 -9
- package/src/agent/runtime.js +1 -1
- package/src/core/parse.js +56 -6
- package/src/core/tags.js +197 -0
- package/src/html/app-css.js +27 -10
- package/src/html/canvas-focus.js +1 -1
- package/src/html/canvas-ui.css +122 -36
- package/src/html/canvas-wires.js +5 -2
- package/src/html/media-anchors.js +233 -5
- package/src/html/mindmap-connectors.js +7 -3
- package/src/html/page.js +2 -1
- package/src/html/plugin-ui.css +115 -96
- package/src/html/runtime.js +74 -5
- package/src/server/assets/library.css +3 -3
- package/src/server/assets/library.html +1 -1
- package/src/workspace/references.js +32 -4
- package/docs/plugin-development.md +0 -135
- package/docs/plugin-ui.md +0 -43
package/plugins/brand/index.js
CHANGED
|
@@ -126,9 +126,20 @@
|
|
|
126
126
|
function mountBrand(host, { setTheme, capture, plugins }) {
|
|
127
127
|
const brand = document.createElement('div');
|
|
128
128
|
brand.className = 'clado-brand-plugin';
|
|
129
|
+
const brandLogo = '<svg viewBox="0 0 64 64" fill="none" aria-hidden="true">' +
|
|
130
|
+
'<defs>' +
|
|
131
|
+
'<linearGradient id="cladoLogoBg" x1="8" y1="6" x2="56" y2="58" gradientUnits="userSpaceOnUse"><stop offset="0%" stop-color="#333842"/><stop offset="100%" stop-color="#14171d"/></linearGradient>' +
|
|
132
|
+
'<linearGradient id="cladoLogoAura" x1="12" y1="56" x2="52" y2="56" gradientUnits="userSpaceOnUse"><stop offset="0%" stop-color="#38bdf8" stop-opacity="0"/><stop offset="28%" stop-color="#38bdf8" stop-opacity="0.95"/><stop offset="50%" stop-color="#818cf8" stop-opacity="1"/><stop offset="72%" stop-color="#e879f9" stop-opacity="0.9"/><stop offset="100%" stop-color="#f472b6" stop-opacity="0"/></linearGradient>' +
|
|
133
|
+
'</defs>' +
|
|
134
|
+
'<rect x="4" y="4" width="56" height="56" rx="16" fill="url(#cladoLogoBg)"/>' +
|
|
135
|
+
'<rect x="4.5" y="4.5" width="55" height="55" rx="15.5" stroke="rgba(255,255,255,0.14)"/>' +
|
|
136
|
+
'<path d="M40.5 23.2C38.6 20.6 35.6 19 32.1 19C25.5 19 20.5 24.4 20.5 32C20.5 39.6 25.5 45 32.1 45C35.7 45 38.7 43.3 40.6 40.6" stroke="#ffffff" stroke-width="5.2" stroke-linecap="round"/>' +
|
|
137
|
+
'<circle cx="43.5" cy="32" r="3" fill="#60a5fa"/>' +
|
|
138
|
+
'<rect x="12" y="57.2" width="40" height="2.4" rx="1.2" fill="url(#cladoLogoAura)"/>' +
|
|
139
|
+
'</svg>';
|
|
129
140
|
brand.innerHTML = `
|
|
130
141
|
<button type="button" class="clado-ui-glass clado-ui-button clado-brand" aria-label="Clado 设置" aria-expanded="false" aria-controls="clado-brand-settings" title="Clado 设置">
|
|
131
|
-
<span class="clado-brand-mark" aria-hidden="true"
|
|
142
|
+
<span class="clado-brand-mark" aria-hidden="true">${brandLogo}</span><strong>clado</strong>
|
|
132
143
|
</button>
|
|
133
144
|
<div class="clado-ui-glass clado-ui-glass-panel clado-brand-settings" id="clado-brand-settings" role="group" aria-labelledby="clado-brand-settings-title" hidden>
|
|
134
145
|
<p id="clado-brand-settings-title">设置</p>
|
package/plugins/brand/style.css
CHANGED
|
@@ -14,37 +14,41 @@
|
|
|
14
14
|
place-items: center;
|
|
15
15
|
width: 28px;
|
|
16
16
|
height: 28px;
|
|
17
|
-
border-radius:
|
|
18
|
-
background:
|
|
19
|
-
box-shadow: inset 0 1px 1px #fff4, 0 2px 4px #17171738;
|
|
20
|
-
color: #fff;
|
|
21
|
-
font-weight: 750;
|
|
22
|
-
font-size: 15px;
|
|
17
|
+
border-radius: 8px;
|
|
18
|
+
background: transparent;
|
|
23
19
|
flex: none;
|
|
24
20
|
}
|
|
21
|
+
.clado-brand-mark svg {
|
|
22
|
+
display: block;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
}
|
|
25
26
|
.clado-brand-settings {
|
|
26
27
|
position: absolute;
|
|
27
28
|
inset: calc(100% + 8px) auto auto 0;
|
|
28
|
-
width: min(
|
|
29
|
+
width: min(192px, calc(100vw - 32px));
|
|
29
30
|
display: grid;
|
|
30
|
-
gap:
|
|
31
|
+
gap: 3px;
|
|
31
32
|
padding: 8px;
|
|
33
|
+
border-radius: 18px;
|
|
32
34
|
}
|
|
33
35
|
.clado-brand-settings p {
|
|
34
36
|
margin: 0;
|
|
35
|
-
padding: 3px
|
|
36
|
-
color: var(--clado-ui-
|
|
37
|
+
padding: 3px 9px 4px;
|
|
38
|
+
color: var(--clado-ui-subtle);
|
|
37
39
|
font-size: 11px;
|
|
38
40
|
font-weight: 600;
|
|
39
41
|
}
|
|
40
42
|
.clado-brand-choice {
|
|
41
|
-
min-height:
|
|
42
|
-
padding-inline:
|
|
43
|
+
min-height: 36px;
|
|
44
|
+
padding-inline: 10px;
|
|
43
45
|
display: grid;
|
|
44
46
|
grid-template-columns: 16px 1fr 14px;
|
|
45
47
|
align-items: center;
|
|
46
48
|
gap: 8px;
|
|
47
49
|
text-align: start;
|
|
50
|
+
color: var(--clado-ui-text);
|
|
51
|
+
border-radius: 11px;
|
|
48
52
|
}
|
|
49
53
|
.clado-brand-choice[aria-pressed="true"] { font-weight: 600; }
|
|
50
54
|
.clado-brand-choice svg {
|
|
@@ -57,9 +61,9 @@
|
|
|
57
61
|
stroke-linecap: round;
|
|
58
62
|
stroke-linejoin: round;
|
|
59
63
|
}
|
|
60
|
-
.clado-brand-check { visibility: hidden; }
|
|
64
|
+
.clado-brand-check { visibility: hidden; color: var(--clado-ui-brand); }
|
|
61
65
|
.clado-brand-choice[aria-pressed="true"] .clado-brand-check { visibility: visible; }
|
|
62
|
-
.clado-brand-check svg { width: 14px; height: 14px; }
|
|
66
|
+
.clado-brand-check svg { width: 14px; height: 14px; stroke-width: 2.2; }
|
|
63
67
|
.clado-brand-capture {
|
|
64
68
|
margin-block-start: 3px;
|
|
65
69
|
grid-template-columns: 16px 1fr;
|
|
@@ -84,19 +88,19 @@
|
|
|
84
88
|
:is(.clado-plugin-manager,.clado-plugin-editor) h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
|
|
85
89
|
.clado-plugin-manager-actions { display: flex; align-items: center; gap: 6px; }
|
|
86
90
|
.clado-plugin-manager .clado-plugin-install-trigger {
|
|
87
|
-
background:
|
|
88
|
-
border-color:
|
|
89
|
-
color:
|
|
91
|
+
background: var(--clado-ui-accent);
|
|
92
|
+
border-color: var(--clado-ui-accent);
|
|
93
|
+
color: var(--clado-ui-solid);
|
|
90
94
|
}
|
|
91
|
-
.clado-plugin-manager .clado-plugin-install-trigger:hover {
|
|
95
|
+
.clado-plugin-manager .clado-plugin-install-trigger:hover { opacity: .88; }
|
|
92
96
|
.clado-plugin-install {
|
|
93
97
|
margin-top: 12px;
|
|
94
98
|
padding: 10px 12px;
|
|
95
|
-
border: 1px solid
|
|
99
|
+
border: 1px solid var(--clado-ui-edge);
|
|
96
100
|
border-radius: 11px;
|
|
97
|
-
background:
|
|
101
|
+
background: var(--clado-ui-well);
|
|
98
102
|
}
|
|
99
|
-
.clado-plugin-install p { margin: 0 0 8px; overflow-wrap: anywhere; color:
|
|
103
|
+
.clado-plugin-install p { margin: 0 0 8px; overflow-wrap: anywhere; color: var(--clado-ui-muted); }
|
|
100
104
|
.clado-plugin-install .clado-plugin-manager-actions { justify-content: end; }
|
|
101
105
|
.clado-plugin-manager-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
|
|
102
106
|
.clado-plugin-manager-list article {
|
|
@@ -107,13 +111,13 @@
|
|
|
107
111
|
gap: 6px;
|
|
108
112
|
min-height: 116px;
|
|
109
113
|
padding: 12px;
|
|
110
|
-
border: 1px solid
|
|
114
|
+
border: 1px solid var(--clado-ui-edge);
|
|
111
115
|
border-radius: calc(var(--clado-ui-radius) - 4px);
|
|
112
|
-
background:
|
|
116
|
+
background: color-mix(in srgb, var(--clado-ui-well) 70%, transparent);
|
|
113
117
|
}
|
|
114
|
-
.clado-plugin-manager-list article:has(input:not(:checked)) { background:
|
|
115
|
-
.clado-plugin-card-icon { grid-area: 1 / 1; display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid
|
|
116
|
-
.clado-plugin-card-icon svg { width: 17px; height: 17px; fill: none; stroke:
|
|
118
|
+
.clado-plugin-manager-list article:has(input:not(:checked)) { background: transparent; }
|
|
119
|
+
.clado-plugin-card-icon { grid-area: 1 / 1; display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid var(--clado-ui-edge); border-radius: 9px; background: color-mix(in srgb, var(--clado-ui-solid) 75%, transparent); }
|
|
120
|
+
.clado-plugin-card-icon svg { width: 17px; height: 17px; fill: none; stroke: var(--clado-ui-text); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
|
|
117
121
|
.clado-plugin-manager-list strong {
|
|
118
122
|
grid-area: 2 / 1 / auto / -1;
|
|
119
123
|
align-self: center;
|
|
@@ -140,7 +144,7 @@
|
|
|
140
144
|
width: 13px;
|
|
141
145
|
height: 13px;
|
|
142
146
|
border-radius: 50%;
|
|
143
|
-
background:
|
|
147
|
+
background: var(--clado-ui-solid);
|
|
144
148
|
}
|
|
145
149
|
.clado-plugin-manager-list input:checked { background: var(--clado-ui-accent); }
|
|
146
150
|
.clado-plugin-manager-list input:checked::before { transform: translateX(14px); }
|
|
@@ -152,11 +156,26 @@
|
|
|
152
156
|
box-sizing: border-box;
|
|
153
157
|
width: 100%;
|
|
154
158
|
padding: 10px;
|
|
155
|
-
border: 1px solid
|
|
159
|
+
border: 1px solid var(--clado-ui-edge);
|
|
156
160
|
border-radius: 10px;
|
|
157
|
-
background:
|
|
161
|
+
background: var(--clado-ui-well);
|
|
162
|
+
color: var(--clado-ui-text);
|
|
158
163
|
font: 13px/1.5 ui-monospace, monospace;
|
|
159
164
|
resize: vertical;
|
|
160
165
|
}
|
|
161
166
|
.clado-plugin-editor details { padding: 10px 0; color: var(--clado-ui-muted); }
|
|
162
167
|
.clado-plugin-editor pre { max-height: 180px; overflow: auto; }
|
|
168
|
+
@media (max-width: 680px) {
|
|
169
|
+
.clado-brand { width: 42px; height: 42px; padding: 6px; justify-content: center; }
|
|
170
|
+
.clado-brand strong { display: none; }
|
|
171
|
+
.clado-plugin-manager, .clado-plugin-editor {
|
|
172
|
+
inset: auto 0 0 0;
|
|
173
|
+
margin: 0;
|
|
174
|
+
width: 100vw;
|
|
175
|
+
max-width: 100vw;
|
|
176
|
+
max-height: 82dvh;
|
|
177
|
+
border-radius: 22px 22px 0 0;
|
|
178
|
+
padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
|
|
179
|
+
}
|
|
180
|
+
.clado-plugin-manager-list { grid-template-columns: minmax(0, 1fr); }
|
|
181
|
+
}
|
|
@@ -5,21 +5,61 @@
|
|
|
5
5
|
#currentFileName { min-width: 0; padding-inline-start: 8px; border-inline-start: 1px solid var(--clado-ui-edge); color: var(--clado-ui-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
|
|
6
6
|
.directory-toggle[data-sync="error"] #fileCount { color: #a45900; }
|
|
7
7
|
[data-theme="dark"] .directory-toggle[data-sync="error"] #fileCount { color: #f1ba73; }
|
|
8
|
-
#directory { position: absolute; left: 0; bottom: calc(100% + 8px); width: min(308px, calc(100vw - 32px)); }
|
|
9
|
-
.directory-scroll { max-height: calc(100dvh - 94px); overflow: auto; border-radius: inherit; padding:
|
|
10
|
-
.directory-
|
|
8
|
+
#directory { position: absolute; left: 0; bottom: calc(100% + 8px); width: min(308px, calc(100vw - 32px)); border-radius: 20px; }
|
|
9
|
+
.directory-scroll { max-height: calc(100dvh - 94px); overflow: auto; border-radius: inherit; padding: 13px 10px 10px; }
|
|
10
|
+
.directory-scroll::-webkit-scrollbar { width: 4px; }
|
|
11
|
+
.directory-scroll::-webkit-scrollbar-thumb { background: rgb(120 130 150 / .24); border-radius: 99px; }
|
|
12
|
+
.directory-heading { padding: 0 8px 10px; }
|
|
13
|
+
.directory-heading strong { font-size: 12.5px; font-weight: 650; color: var(--clado-ui-text); }
|
|
14
|
+
.directory-heading span { display: block; font-size: 10px; color: var(--clado-ui-muted); margin-top: 4px; }
|
|
15
|
+
#documentList { display: flex; flex-direction: column; gap: 3px; }
|
|
16
|
+
.document-button {
|
|
17
|
+
position: relative;
|
|
18
|
+
display: block;
|
|
19
|
+
text-align: left;
|
|
20
|
+
padding: 9px 10px 9px 16px;
|
|
21
|
+
white-space: normal;
|
|
22
|
+
width: 100%;
|
|
23
|
+
border-radius: 11px;
|
|
24
|
+
color: var(--clado-ui-text);
|
|
25
|
+
}
|
|
26
|
+
.document-button::before {
|
|
27
|
+
content: "";
|
|
28
|
+
position: absolute;
|
|
29
|
+
left: 6px;
|
|
30
|
+
top: 50%;
|
|
31
|
+
transform: translateY(-50%);
|
|
32
|
+
width: 3px;
|
|
33
|
+
height: 16px;
|
|
34
|
+
border-radius: 99px;
|
|
35
|
+
background: transparent;
|
|
36
|
+
transition: background 150ms ease;
|
|
37
|
+
}
|
|
38
|
+
.document-button[aria-current="page"]::before {
|
|
39
|
+
background: var(--clado-ui-brand);
|
|
40
|
+
}
|
|
41
|
+
.document-button strong { font-size: 12.5px; font-weight: 500; display: block; color: var(--clado-ui-text); }
|
|
42
|
+
.document-button small { font-size: 10.5px; color: var(--clado-ui-subtle); display: block; margin-top: 2px; overflow-wrap: anywhere; }
|
|
11
43
|
.document-button[aria-current="page"] strong {
|
|
12
|
-
color: var(--clado-ui-
|
|
13
|
-
font-weight:
|
|
44
|
+
color: var(--clado-ui-text);
|
|
45
|
+
font-weight: 620;
|
|
14
46
|
}
|
|
47
|
+
.directory-current { padding: 10px 8px 8px; margin-top: 10px; border-top: 1px solid var(--clado-ui-edge); }
|
|
48
|
+
.directory-current strong { font-size: 10px; font-weight: 500; display: block; color: var(--clado-ui-muted); }
|
|
49
|
+
.directory-current span { display: block; color: var(--clado-ui-subtle); font-size: 10.5px; margin-top: 2px; overflow-wrap: anywhere; }
|
|
50
|
+
.directory-actions { display: flex; gap: 4px; padding: 0 4px; }
|
|
51
|
+
.directory-actions button { min-height: 28px; font-size: 11.5px; padding: 4px 8px; border-radius: 9px; }
|
|
52
|
+
.directory-actions #sourceButton { margin-left: auto; }
|
|
53
|
+
.skipped { margin-top: 10px; border: 0; border-top: 1px solid var(--clado-ui-edge); border-radius: 0; width: 100%; text-align: left; padding: 11px 10px 2px; font-size: 10.5px; color: var(--clado-ui-muted); white-space: normal; }
|
|
15
54
|
|
|
16
|
-
.sync-error{color
|
|
55
|
+
.sync-error { color: #b88628 !important; }
|
|
56
|
+
.sync-good:before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #10b981; vertical-align: middle; margin-right: 6px; }
|
|
17
57
|
.clado-directory-plugin dialog {
|
|
18
58
|
position: fixed;
|
|
19
59
|
width: min(660px, calc(100vw - 32px));
|
|
20
60
|
max-height: calc(100vh - 36px);
|
|
21
|
-
border: 1px solid var(--
|
|
22
|
-
border-radius:
|
|
61
|
+
border: 1px solid var(--clado-ui-glass-outline);
|
|
62
|
+
border-radius: 20px;
|
|
23
63
|
padding: 0;
|
|
24
64
|
}
|
|
25
65
|
.clado-directory-plugin dialog > header {
|
|
@@ -27,7 +67,7 @@
|
|
|
27
67
|
align-items: center;
|
|
28
68
|
gap: 12px;
|
|
29
69
|
padding: 15px 20px;
|
|
30
|
-
border-bottom: 1px solid var(--
|
|
70
|
+
border-bottom: 1px solid var(--clado-ui-edge);
|
|
31
71
|
}
|
|
32
72
|
.clado-directory-plugin dialog > header strong { font-size: 13px; font-weight: 600; }
|
|
33
73
|
.clado-directory-plugin dialog > header button {
|
|
@@ -37,23 +77,90 @@
|
|
|
37
77
|
border: 0;
|
|
38
78
|
}
|
|
39
79
|
#detailsBody { padding: 18px 20px; max-height: calc(100vh - 130px); overflow: auto; }
|
|
40
|
-
#detailsBody p { font-size:
|
|
80
|
+
#detailsBody p { font-size: 11.5px; color: var(--clado-ui-muted); line-height: 1.8; margin: 0 0 14px; }
|
|
41
81
|
#detailsBody pre {
|
|
42
|
-
font:
|
|
82
|
+
font: 11.5px/1.9 ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
43
83
|
white-space: pre-wrap;
|
|
44
84
|
overflow-wrap: anywhere;
|
|
45
85
|
margin: 0;
|
|
46
86
|
}
|
|
47
|
-
.skip-item{padding:10px 0;border-bottom:1px solid var(--
|
|
48
|
-
.
|
|
49
|
-
|
|
50
|
-
.
|
|
51
|
-
.directory-
|
|
52
|
-
.directory-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
87
|
+
.skip-item { padding: 10px 0; border-bottom: 1px solid var(--clado-ui-edge); }
|
|
88
|
+
.skip-item strong { font-size: 12px; }
|
|
89
|
+
.skip-item p { margin: 5px 0 !important; }
|
|
90
|
+
.skip-item code { font-size: 10.5px; }
|
|
91
|
+
.directory-search { display: block; padding: 0 4px 10px; }
|
|
92
|
+
.directory-search input {
|
|
93
|
+
box-sizing: border-box;
|
|
94
|
+
width: 100%;
|
|
95
|
+
border: 1px solid var(--clado-ui-well-border);
|
|
96
|
+
border-radius: 11px;
|
|
97
|
+
background: var(--clado-ui-well);
|
|
98
|
+
color: var(--clado-ui-text);
|
|
99
|
+
font: inherit;
|
|
100
|
+
font-size: 12.5px;
|
|
101
|
+
padding: 7px 11px;
|
|
102
|
+
outline: none;
|
|
103
|
+
box-shadow: inset 0 1px 0 rgb(255 255 255 / .40);
|
|
104
|
+
transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
|
|
105
|
+
}
|
|
106
|
+
[data-theme="dark"] .directory-search input {
|
|
107
|
+
box-shadow: inset 0 1px 0 rgb(255 255 255 / .06);
|
|
108
|
+
}
|
|
109
|
+
.directory-search input:focus {
|
|
110
|
+
background: var(--clado-ui-well-focus);
|
|
111
|
+
border-color: color-mix(in srgb, var(--clado-ui-brand) 48%, transparent);
|
|
112
|
+
box-shadow: 0 0 0 3px var(--clado-ui-brand-soft);
|
|
113
|
+
}
|
|
114
|
+
.tree-folder > summary { cursor: pointer; padding: 7px 8px; color: var(--clado-ui-text); font-size: 12px; font-weight: 560; border-radius: 9px; }
|
|
115
|
+
.tree-folder > summary:hover { background: var(--clado-ui-hover); }
|
|
116
|
+
.tree-children { margin-left: 11px; padding-left: 5px; border-left: 1px solid var(--clado-ui-edge); }
|
|
117
|
+
.tree-empty { padding: 8px; color: var(--clado-ui-muted); font-size: 12px; }
|
|
118
|
+
#currentWorkspaceName { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-inline-end: 8px; border-inline-end: 1px solid var(--clado-ui-edge); color: var(--clado-ui-brand); font-size: 12px; font-weight: 600; }
|
|
119
|
+
.directory-workspaces { padding: 0 4px 10px; margin-bottom: 10px; border-bottom: 1px solid var(--clado-ui-edge); }
|
|
120
|
+
.directory-workspaces-title { font-size: 10.5px; font-weight: 600; color: var(--clado-ui-subtle); margin-bottom: 6px; padding-inline: 4px; }
|
|
121
|
+
.directory-workspace-list { display: flex; flex-direction: column; gap: 3px; max-height: 160px; overflow: auto; }
|
|
122
|
+
.workspace-row { display: flex; align-items: center; gap: 4px; }
|
|
123
|
+
.workspace-button { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; text-align: left; font-size: 12px; border-radius: 10px; }
|
|
124
|
+
.workspace-button[aria-current="page"] { color: var(--clado-ui-text); font-weight: 600; }
|
|
125
|
+
.workspace-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
126
|
+
.workspace-button small { flex: none; font-size: 10.5px; color: var(--clado-ui-subtle); }
|
|
127
|
+
.workspace-open-tab { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; font-size: 11px; text-decoration: none; color: var(--clado-ui-muted); border-radius: 8px; }
|
|
128
|
+
.workspace-open-tab:hover { color: var(--clado-ui-text); background: var(--clado-ui-hover); }
|
|
129
|
+
@media (max-width: 680px) {
|
|
130
|
+
.directory-toggle { max-width: calc(100vw - 116px); height: 42px; padding: 7px 11px; }
|
|
131
|
+
#currentWorkspaceName { max-width: 72px; }
|
|
132
|
+
#directory {
|
|
133
|
+
position: fixed;
|
|
134
|
+
left: 10px;
|
|
135
|
+
right: 10px;
|
|
136
|
+
bottom: max(10px, env(safe-area-inset-bottom));
|
|
137
|
+
width: auto;
|
|
138
|
+
max-width: 440px;
|
|
139
|
+
margin: 0 auto;
|
|
140
|
+
border-radius: 26px;
|
|
141
|
+
z-index: 29;
|
|
142
|
+
}
|
|
143
|
+
.directory-scroll {
|
|
144
|
+
max-height: 70dvh;
|
|
145
|
+
padding: 14px 12px 14px;
|
|
146
|
+
}
|
|
147
|
+
.directory-scroll::before {
|
|
148
|
+
content: "";
|
|
149
|
+
display: block;
|
|
150
|
+
width: 36px;
|
|
151
|
+
height: 4px;
|
|
152
|
+
border-radius: 99px;
|
|
153
|
+
background: var(--clado-ui-edge);
|
|
154
|
+
margin: -4px auto 10px;
|
|
155
|
+
}
|
|
156
|
+
.document-button { min-height: 44px; padding: 10px 12px 10px 18px; }
|
|
157
|
+
.directory-search input { font-size: 16px; min-height: 40px; }
|
|
158
|
+
.clado-directory-plugin dialog {
|
|
159
|
+
inset: auto 10px max(10px, env(safe-area-inset-bottom)) 10px;
|
|
160
|
+
margin: 0 auto;
|
|
161
|
+
width: auto;
|
|
162
|
+
max-width: 440px;
|
|
163
|
+
max-height: 80dvh;
|
|
164
|
+
border-radius: 24px;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
padding-inline: 14px;
|
|
14
14
|
background: transparent;
|
|
15
15
|
border-color: transparent;
|
|
16
|
+
box-shadow: none;
|
|
16
17
|
border-radius: calc(var(--clado-ui-radius) - 5px);
|
|
17
18
|
}
|
|
18
19
|
.clado-view-modes .clado-ui-button:hover:where(:not(:disabled):not([aria-pressed="true"])) {
|
|
@@ -27,17 +28,13 @@
|
|
|
27
28
|
inset: 0 auto 0 0;
|
|
28
29
|
width: calc(100% / 3);
|
|
29
30
|
border-radius: calc(var(--clado-ui-radius) - 5px);
|
|
30
|
-
border: 1px solid
|
|
31
|
-
background:
|
|
32
|
-
box-shadow:
|
|
31
|
+
border: 1px solid var(--clado-ui-glass-outline);
|
|
32
|
+
background: var(--clado-ui-active);
|
|
33
|
+
box-shadow: var(--clado-ui-active-shadow);
|
|
33
34
|
transform: translateX(calc(var(--clado-view-index, 0) * 100%));
|
|
34
35
|
transition: transform 220ms cubic-bezier(.22,.75,.24,1);
|
|
35
36
|
pointer-events: none;
|
|
36
37
|
}
|
|
37
|
-
[data-theme="dark"] .clado-view-thumb {
|
|
38
|
-
border-color: rgb(255 255 255 / .22);
|
|
39
|
-
background: rgb(255 255 255 / .11);
|
|
40
|
-
}
|
|
41
38
|
@media (prefers-reduced-motion: reduce) {
|
|
42
39
|
.clado-view-thumb { transition: none; }
|
|
43
40
|
}
|
|
@@ -61,6 +58,6 @@
|
|
|
61
58
|
[data-theme="dark"] .clado-view-status .clado-issue-count { color: #efb860; }
|
|
62
59
|
[data-theme="dark"] .clado-view-status .has-errors { color: #ffacb6; }
|
|
63
60
|
|
|
64
|
-
@media (max-width:
|
|
65
|
-
.clado-view-modes .clado-ui-button { padding-inline:
|
|
61
|
+
@media (max-width: 680px) {
|
|
62
|
+
.clado-view-modes .clado-ui-button { padding-inline: 11px; min-height: 36px; font-size: 12.5px; }
|
|
66
63
|
}
|
package/src/agent/runtime.js
CHANGED
|
@@ -21,7 +21,7 @@ const MODE_PROMPTS = {
|
|
|
21
21
|
'当前工作模式:【研发设计与代码架构】',
|
|
22
22
|
'1. 涉及存量代码时,先调用 probe_tree / probe_search / probe_read 核对真实类名、方法名与边界,绝不编造。',
|
|
23
23
|
'2. 先用 clado_templates 读取对应模板(如 call-chain / data-design / business-flow)再创建或修改 .md 画布。',
|
|
24
|
-
'3.
|
|
24
|
+
'3. 同画布跨卡连线支持「卡片 + Tag」二元目标:可在目标行打唯一语义 Tag(有字胶囊 `[新增]{#id .green}`、无字小圆点 `[]{#id .amber}`、代码行尾 `// {#id .blue}`、Mermaid `%% {#node .green}`),再以 `[文案](#id)` 精准连线,也可兼容 `clado:code:` / `clado:to:`;避免卡片末尾裸卡片连卡片。',
|
|
25
25
|
'4. 遇到需求歧义或方案二选一时,优先调用 ask_user 给出清晰选项让观察者拍板,不要替用户擅自猜测。',
|
|
26
26
|
'5. 每次修改后核对 diagnostics,确保 0 error 再给 3–5 行精炼汇报。',
|
|
27
27
|
].join('\n'),
|
package/src/core/parse.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { parse as parseYaml } from 'yaml';
|
|
8
8
|
import { markdownLinks } from './links.js';
|
|
9
9
|
import { hasTargetSpec, isTargetOnlyTitle, mediaLinkLocations, mediaTargetPoint, targetPointFits } from './media-links.js';
|
|
10
|
+
import { extractTagsFromBody } from './tags.js';
|
|
10
11
|
|
|
11
12
|
/** 开头 `---` 包的 front matter */
|
|
12
13
|
const FRONT_MATTER = /^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/;
|
|
@@ -65,6 +66,7 @@ export function contentLength(md) {
|
|
|
65
66
|
if (fence) continue;
|
|
66
67
|
const visible = line
|
|
67
68
|
.replace(/!?\[([^\]]*)\]\([^()\s]*(?:\s+"[^"]*")?\)/g, '$1') // [文字](url) → 文字
|
|
69
|
+
.replace(/\[([^\]]*)\]\{[^{}\r\n]+\}/g, '$1') // [文字]{#id .green} → 文字
|
|
68
70
|
.replace(/^\s{0,3}#{1,6}\s+/, '') // 行内小标题的 #
|
|
69
71
|
.replace(/^\s{0,3}>\s?/, '') // 引用
|
|
70
72
|
.replace(/[*_`~]/g, '');
|
|
@@ -320,13 +322,39 @@ export function parseDocument(text, opts = {}) {
|
|
|
320
322
|
* 字段,把线连到对方的 `## id` 上才说得清是哪个字段对哪个字段。
|
|
321
323
|
* 键和 targets 一样用链接的**原文**(客户端是拿渲染出来的 href 查表的)。
|
|
322
324
|
*/
|
|
323
|
-
const anchors = Object.create(null), targetNodes = Object.create(null),
|
|
325
|
+
const anchors = Object.create(null), targetNodes = Object.create(null), tagTargets = Object.create(null), tags = Object.create(null);
|
|
326
|
+
const titleOf = new Map(), bodyOf = new Map();
|
|
327
|
+
const collectTags = (body, cardId, nodeId, baseLine) => {
|
|
328
|
+
for (const tag of extractTagsFromBody(body, { cardId, nodeId, baseLine })) {
|
|
329
|
+
if (!tag.id) continue;
|
|
330
|
+
if (tags[tag.id]) {
|
|
331
|
+
at('error', 'MD_TAG_DUPLICATE_ID',
|
|
332
|
+
`Tag ID「#${tag.id}」重复定义`,
|
|
333
|
+
'每个文档内的 Tag ID 必须唯一,修改其中一个 ID', tag.line);
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
tags[tag.id] = {
|
|
337
|
+
id: tag.id,
|
|
338
|
+
cardId: tag.cardId,
|
|
339
|
+
nodeId: tag.nodeId,
|
|
340
|
+
color: tag.color,
|
|
341
|
+
text: tag.text,
|
|
342
|
+
kind: tag.kind,
|
|
343
|
+
blockIndex: tag.blockIndex || 0,
|
|
344
|
+
codeLine: tag.codeLine || 0,
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
};
|
|
324
348
|
for (const c of cards) {
|
|
349
|
+
const cBody = c._entry.body.join('\n');
|
|
325
350
|
titleOf.set(c.id, c.title);
|
|
326
|
-
bodyOf.set(c.id,
|
|
351
|
+
bodyOf.set(c.id, cBody);
|
|
352
|
+
collectTags(cBody, c.id, c.id, c._entry.line + 1);
|
|
327
353
|
const walk = ns => ns.forEach(n => {
|
|
354
|
+
const nBody = n._entry.body.join('\n');
|
|
328
355
|
titleOf.set(n.id, n.title);
|
|
329
|
-
bodyOf.set(n.id,
|
|
356
|
+
bodyOf.set(n.id, nBody);
|
|
357
|
+
collectTags(nBody, c.id, n.id, n._entry.line + 1);
|
|
330
358
|
walk(n.kids);
|
|
331
359
|
});
|
|
332
360
|
walk(c.nodes);
|
|
@@ -401,7 +429,21 @@ export function parseDocument(text, opts = {}) {
|
|
|
401
429
|
try { got = resolve(decodeURIComponent(t)); } catch { got = null; }
|
|
402
430
|
if (got) { head = t; anchor = ''; }
|
|
403
431
|
}
|
|
404
|
-
|
|
432
|
+
// 二元目标模型:若未命中卡片/小节标题,再查文档内唯一 Tag ID(支持 [文字](#tagId))。
|
|
433
|
+
if (!got) {
|
|
434
|
+
let tagHit = tags[t];
|
|
435
|
+
if (!tagHit && t.includes('%')) {
|
|
436
|
+
try { tagHit = tags[decodeURIComponent(t)]; } catch { tagHit = null; }
|
|
437
|
+
}
|
|
438
|
+
if (!tagHit) continue;
|
|
439
|
+
const mine = e.level === 1 ? card.id : node.id;
|
|
440
|
+
const theirs = tagHit.cardId;
|
|
441
|
+
targets[raw] = theirs;
|
|
442
|
+
tagTargets[raw] = tagHit.id;
|
|
443
|
+
if (tagHit.nodeId && tagHit.nodeId !== theirs) targetNodes[raw] = tagHit.nodeId;
|
|
444
|
+
edgePairs.push([mine, theirs]);
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
405
447
|
if (got.ambiguous) {
|
|
406
448
|
at('error', 'MD_EDGE_AMBIGUOUS',
|
|
407
449
|
`「${t}」能对上 ${got.ambiguous.length} 个地方:${got.ambiguous.join('、')}`,
|
|
@@ -421,8 +463,14 @@ export function parseDocument(text, opts = {}) {
|
|
|
421
463
|
if (got.id === mine && !anchor) continue;
|
|
422
464
|
// 键用 raw —— 客户端是拿**渲染出来的 href** 去查表的,剥过 `#` 就查不到了
|
|
423
465
|
targets[raw] = theirs;
|
|
424
|
-
|
|
425
|
-
if (anchor
|
|
466
|
+
// 若 `卡片#tagId` 的 `#` 后半段命中该卡内的 Tag ID,也视为 Tag 精准落点。
|
|
467
|
+
if (anchor && tags[anchor] && tags[anchor].cardId === theirs) {
|
|
468
|
+
tagTargets[raw] = tags[anchor].id;
|
|
469
|
+
if (tags[anchor].nodeId && tags[anchor].nodeId !== theirs) targetNodes[raw] = tags[anchor].nodeId;
|
|
470
|
+
} else {
|
|
471
|
+
if (!anchor && got.id !== theirs) { anchor = titleOf.get(got.id); targetNodes[raw] = got.id; }
|
|
472
|
+
if (anchor) anchors[raw] = anchor;
|
|
473
|
+
}
|
|
426
474
|
edgePairs.push([mine, theirs]);
|
|
427
475
|
}
|
|
428
476
|
|
|
@@ -492,6 +540,8 @@ export function parseDocument(text, opts = {}) {
|
|
|
492
540
|
targets: { ...targets },
|
|
493
541
|
anchors: { ...anchors },
|
|
494
542
|
targetNodes: { ...targetNodes },
|
|
543
|
+
tags: { ...tags },
|
|
544
|
+
tagTargets: { ...tagTargets },
|
|
495
545
|
edges: cardEdges,
|
|
496
546
|
hasMermaid,
|
|
497
547
|
};
|