cladogram 0.6.0-beta.3 → 0.6.0-beta.4
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/docs/agent-context.md +62 -0
- package/docs/agent-reference.md +126 -0
- package/docs/release.md +7 -0
- package/package.json +3 -1
- package/plugins/agent/index.js +148 -18
- package/plugins/agent/style.css +54 -14
- package/src/agent/pi-bridge.js +75 -5
- package/src/agent/pi-config.js +97 -57
- package/src/html/app-css.js +65 -1
- package/src/html/canvas-live-diff.js +329 -0
- package/src/html/canvas-ui.css +143 -0
- package/src/html/page.js +4 -2
- package/src/html/runtime-api.js +6 -0
- package/src/html/runtime.js +339 -3
- package/src/server/agent.js +15 -0
- package/src/server/assets/library-canvas.js +12 -4
- package/src/server/assets/library.js +42 -1
- package/src/server/workspace.js +6 -1
|
@@ -719,6 +719,7 @@ function hotPatchCanvasDoc(nextDoc, diagnostics, nextVersion, touch, follow) {
|
|
|
719
719
|
|
|
720
720
|
playCanvasLiveDiff(prevSnap, touch, follow);
|
|
721
721
|
animateNewCanvasWires(prevEdgeKeys);
|
|
722
|
+
if (typeof cladoSyncAllCardPresenceDom === 'function') cladoSyncAllCardPresenceDom();
|
|
722
723
|
if (typeof CustomEvent === 'function') document.dispatchEvent(new CustomEvent('clado:view-state'));
|
|
723
724
|
return true;
|
|
724
725
|
}
|
|
@@ -925,3 +926,331 @@ function startCanvasLinkPick(sourceSpec) {
|
|
|
925
926
|
document.addEventListener('click', onClick, true);
|
|
926
927
|
cladoLinkPickState = { source: sourceSpec, banner: banner, onClick: onClick, onKey: onKey };
|
|
927
928
|
}
|
|
929
|
+
|
|
930
|
+
/* ── 多角色卡片空间协同(方案 1 · 底部一体状态栏 + 1px 发丝光 + 向下垂落呼吸柔光) ── */
|
|
931
|
+
var cladoPresenceStore = new Map(); // cardId -> Map<sessionId, entry>
|
|
932
|
+
var cladoPresenceAfterglowMs = 15000;
|
|
933
|
+
var CLADO_PRESENCE_MAX_ACTIVE_MS = 30 * 60 * 1000;
|
|
934
|
+
var cladoPresenceRotTick = 0;
|
|
935
|
+
var cladoPresenceRotTimer = 0;
|
|
936
|
+
var cladoPresenceSweepTimer = 0;
|
|
937
|
+
|
|
938
|
+
function cladoNormalizeTone(tone) {
|
|
939
|
+
return (tone === 'sky' || tone === 'emerald' || tone === 'violet' || tone === 'amber') ? tone : 'sky';
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
function cladoResolvePresenceCardIds(cards) {
|
|
943
|
+
var list = Array.isArray(cards) ? cards : [];
|
|
944
|
+
if (!list.length) return [];
|
|
945
|
+
var records = Object.values(canvasRecords || {});
|
|
946
|
+
var ids = [];
|
|
947
|
+
var seen = new Set();
|
|
948
|
+
list.forEach(function (raw) {
|
|
949
|
+
var path = Array.isArray(raw) ? raw : (typeof raw === 'string' && raw.trim() ? [raw.trim()] : []);
|
|
950
|
+
if (!path.length) return;
|
|
951
|
+
var rootTitle = String(path[0] || '').trim();
|
|
952
|
+
var match = records.find(function (r) {
|
|
953
|
+
return !r.parent && (r.title === rootTitle || r.id === rootTitle || r.fullPath === rootTitle);
|
|
954
|
+
});
|
|
955
|
+
if (!match) {
|
|
956
|
+
match = records.find(function (r) {
|
|
957
|
+
return r.titlePath.length === path.length && path.every(function (p, i) { return p === r.titlePath[i]; });
|
|
958
|
+
}) || records.find(function (r) { return r.title === path[path.length - 1]; });
|
|
959
|
+
}
|
|
960
|
+
var cid = match ? (match.card || match.id) : '';
|
|
961
|
+
if (cid && !seen.has(cid)) {
|
|
962
|
+
seen.add(cid);
|
|
963
|
+
ids.push(cid);
|
|
964
|
+
}
|
|
965
|
+
});
|
|
966
|
+
return ids;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
function cladoEnsurePresenceTimers() {
|
|
970
|
+
var hasAny = cladoPresenceStore.size > 0;
|
|
971
|
+
var hasMulti = false;
|
|
972
|
+
cladoPresenceStore.forEach(function (map) {
|
|
973
|
+
if (map && map.size >= 2) hasMulti = true;
|
|
974
|
+
});
|
|
975
|
+
if (hasAny && !cladoPresenceSweepTimer) {
|
|
976
|
+
cladoPresenceSweepTimer = setInterval(cladoSweepExpiredPresence, 1000);
|
|
977
|
+
} else if (!hasAny && cladoPresenceSweepTimer) {
|
|
978
|
+
clearInterval(cladoPresenceSweepTimer);
|
|
979
|
+
cladoPresenceSweepTimer = 0;
|
|
980
|
+
}
|
|
981
|
+
if (hasMulti && !cladoPresenceRotTimer) {
|
|
982
|
+
cladoPresenceRotTimer = setInterval(function () {
|
|
983
|
+
cladoPresenceRotTick++;
|
|
984
|
+
cladoSyncAllCardPresenceDom();
|
|
985
|
+
}, 2800);
|
|
986
|
+
} else if (!hasMulti && cladoPresenceRotTimer) {
|
|
987
|
+
clearInterval(cladoPresenceRotTimer);
|
|
988
|
+
cladoPresenceRotTimer = 0;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
function cladoSweepExpiredPresence() {
|
|
993
|
+
var now = Date.now();
|
|
994
|
+
var changed = false;
|
|
995
|
+
cladoPresenceStore.forEach(function (map, cardId) {
|
|
996
|
+
map.forEach(function (entry, sid) {
|
|
997
|
+
if (entry.phase === 'active' && (now - (entry.ts || now)) > CLADO_PRESENCE_MAX_ACTIVE_MS) {
|
|
998
|
+
if (cladoPresenceAfterglowMs <= 0) {
|
|
999
|
+
map.delete(sid);
|
|
1000
|
+
} else {
|
|
1001
|
+
entry.phase = 'afterglow';
|
|
1002
|
+
entry.label = '超时自动释放';
|
|
1003
|
+
entry.expiresAt = now + cladoPresenceAfterglowMs;
|
|
1004
|
+
}
|
|
1005
|
+
changed = true;
|
|
1006
|
+
} else if (entry.phase === 'afterglow' && entry.expiresAt && now >= entry.expiresAt) {
|
|
1007
|
+
map.delete(sid);
|
|
1008
|
+
changed = true;
|
|
1009
|
+
}
|
|
1010
|
+
});
|
|
1011
|
+
if (!map.size) {
|
|
1012
|
+
cladoPresenceStore.delete(cardId);
|
|
1013
|
+
changed = true;
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1016
|
+
cladoEnsurePresenceTimers();
|
|
1017
|
+
if (changed) cladoSyncAllCardPresenceDom();
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
function cladoClearCardPresenceByCardId(cardId) {
|
|
1021
|
+
if (!cardId || !cladoPresenceStore.has(cardId)) return;
|
|
1022
|
+
cladoPresenceStore.delete(cardId);
|
|
1023
|
+
cladoEnsurePresenceTimers();
|
|
1024
|
+
cladoSyncAllCardPresenceDom();
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
function cladoRenderCardPresenceDom(cardId, cardEl, entries) {
|
|
1028
|
+
if (!cardEl) return;
|
|
1029
|
+
if (!entries || !entries.length) {
|
|
1030
|
+
var had = cardEl.classList.contains('clado-has-presence');
|
|
1031
|
+
cardEl.classList.remove('clado-has-presence', 'is-afterglow');
|
|
1032
|
+
cardEl.removeAttribute('data-presence-tone');
|
|
1033
|
+
var oldBar = cardEl.querySelector(':scope > .clado-presence-bar');
|
|
1034
|
+
var oldLine = cardEl.querySelector(':scope > .clado-presence-line');
|
|
1035
|
+
var oldGlow = cardEl.querySelector(':scope > .clado-presence-glow');
|
|
1036
|
+
if (oldBar) oldBar.remove();
|
|
1037
|
+
if (oldLine) oldLine.remove();
|
|
1038
|
+
if (oldGlow) oldGlow.remove();
|
|
1039
|
+
return had;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
var sorted = entries.slice().sort(function (a, b) {
|
|
1043
|
+
if (a.phase !== b.phase) return a.phase === 'active' ? -1 : 1;
|
|
1044
|
+
return (b.ts || 0) - (a.ts || 0);
|
|
1045
|
+
});
|
|
1046
|
+
var activeOnly = sorted.filter(function (e) { return e.phase === 'active'; });
|
|
1047
|
+
var cyclePool = activeOnly.length ? activeOnly : sorted;
|
|
1048
|
+
var cur = cyclePool[cladoPresenceRotTick % cyclePool.length];
|
|
1049
|
+
var tone = cladoNormalizeTone(cur.tone);
|
|
1050
|
+
var allAfterglow = activeOnly.length === 0;
|
|
1051
|
+
|
|
1052
|
+
var heightChanged = !cardEl.classList.contains('clado-has-presence');
|
|
1053
|
+
cardEl.classList.add('clado-has-presence');
|
|
1054
|
+
cardEl.classList.toggle('is-afterglow', allAfterglow);
|
|
1055
|
+
cardEl.dataset.presenceTone = tone;
|
|
1056
|
+
|
|
1057
|
+
var bar = cardEl.querySelector(':scope > .clado-presence-bar');
|
|
1058
|
+
if (!bar) {
|
|
1059
|
+
bar = document.createElement('div');
|
|
1060
|
+
bar.className = 'clado-presence-bar';
|
|
1061
|
+
var rz = cardEl.querySelector(':scope > .rz');
|
|
1062
|
+
if (rz) cardEl.insertBefore(bar, rz);
|
|
1063
|
+
else cardEl.appendChild(bar);
|
|
1064
|
+
bar.addEventListener('click', function (ev) {
|
|
1065
|
+
if (ev.target.closest('.clado-presence-dismiss')) {
|
|
1066
|
+
ev.preventDefault();
|
|
1067
|
+
ev.stopPropagation();
|
|
1068
|
+
cladoClearCardPresenceByCardId(cardId);
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
ev.preventDefault();
|
|
1072
|
+
ev.stopPropagation();
|
|
1073
|
+
var targetRow = ev.target.closest('.clado-presence-tip-row');
|
|
1074
|
+
var sid = (targetRow && targetRow.dataset.sid) || bar.dataset.sid || '';
|
|
1075
|
+
var rid = (targetRow && targetRow.dataset.rid) || bar.dataset.rid || '';
|
|
1076
|
+
var cpath = (targetRow && targetRow.dataset.codePath) || bar.dataset.codePath || '';
|
|
1077
|
+
try {
|
|
1078
|
+
window.parent.postMessage({
|
|
1079
|
+
type: 'clado-library:presence-click',
|
|
1080
|
+
sessionId: sid,
|
|
1081
|
+
roleId: rid,
|
|
1082
|
+
codePath: cpath,
|
|
1083
|
+
}, '*');
|
|
1084
|
+
} catch (e) {}
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
bar.dataset.sid = cur.sessionId || '';
|
|
1088
|
+
bar.dataset.rid = cur.roleId || '';
|
|
1089
|
+
bar.dataset.codePath = cur.codePath || '';
|
|
1090
|
+
|
|
1091
|
+
var actionText = cur.label
|
|
1092
|
+
? (cur.roleName + ' · ' + cur.label)
|
|
1093
|
+
: (cur.roleName + (cur.phase === 'active' ? ' · 正在协作' : ' · 刚刚完成'));
|
|
1094
|
+
var multiHtml = '';
|
|
1095
|
+
if (sorted.length >= 2) {
|
|
1096
|
+
var dots = sorted.map(function (item) {
|
|
1097
|
+
var isCur = item.sessionId === cur.sessionId;
|
|
1098
|
+
return '<i class="clado-presence-mdot' + (isCur ? ' is-cur' : '') + '" data-tone="' + esc(cladoNormalizeTone(item.tone)) + '"></i>';
|
|
1099
|
+
}).join('');
|
|
1100
|
+
multiHtml = '<span class="clado-presence-dots">' + dots + '</span><span class="clado-presence-count">' + sorted.length + ' 角色</span>';
|
|
1101
|
+
}
|
|
1102
|
+
var tipRows = sorted.map(function (item) {
|
|
1103
|
+
var itemTone = cladoNormalizeTone(item.tone);
|
|
1104
|
+
var statusLabel = item.phase === 'active' ? '进行中' : '余韵';
|
|
1105
|
+
return '<div class="clado-presence-tip-row" data-sid="' + esc(item.sessionId || '') + '" data-rid="' + esc(item.roleId || '') + '" data-code-path="' + esc(item.codePath || '') + '">'
|
|
1106
|
+
+ '<span class="clado-presence-tip-main"><i class="clado-presence-mdot is-cur" data-tone="' + esc(itemTone) + '"></i><strong>' + esc(item.roleName || '角色') + '</strong>' + (item.label ? ' · ' + esc(item.label) : '') + '</span>'
|
|
1107
|
+
+ '<span class="clado-presence-tip-phase">' + statusLabel + '</span>'
|
|
1108
|
+
+ '</div>';
|
|
1109
|
+
}).join('');
|
|
1110
|
+
|
|
1111
|
+
bar.innerHTML =
|
|
1112
|
+
'<div class="clado-presence-left">'
|
|
1113
|
+
+ '<i class="clado-presence-dot" aria-hidden="true"></i>'
|
|
1114
|
+
+ '<span class="clado-presence-text">' + esc(actionText) + '</span>'
|
|
1115
|
+
+ '</div>'
|
|
1116
|
+
+ '<div class="clado-presence-right">'
|
|
1117
|
+
+ multiHtml
|
|
1118
|
+
+ '<button type="button" class="clado-presence-dismiss" title="清除此卡协同提示">×</button>'
|
|
1119
|
+
+ '</div>'
|
|
1120
|
+
+ '<div class="clado-presence-tip">' + tipRows + '</div>';
|
|
1121
|
+
|
|
1122
|
+
if (!cardEl.querySelector(':scope > .clado-presence-line')) {
|
|
1123
|
+
var line = document.createElement('span');
|
|
1124
|
+
line.className = 'clado-presence-line';
|
|
1125
|
+
line.setAttribute('aria-hidden', 'true');
|
|
1126
|
+
cardEl.appendChild(line);
|
|
1127
|
+
}
|
|
1128
|
+
if (!cardEl.querySelector(':scope > .clado-presence-glow')) {
|
|
1129
|
+
var glow = document.createElement('span');
|
|
1130
|
+
glow.className = 'clado-presence-glow';
|
|
1131
|
+
glow.setAttribute('aria-hidden', 'true');
|
|
1132
|
+
cardEl.appendChild(glow);
|
|
1133
|
+
}
|
|
1134
|
+
return heightChanged;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
function cladoSyncAllCardPresenceDom() {
|
|
1138
|
+
var anyLayoutDelta = false;
|
|
1139
|
+
Object.keys(render.card || {}).forEach(function (cardId) {
|
|
1140
|
+
var cardEl = render.card[cardId];
|
|
1141
|
+
if (!cardEl) return;
|
|
1142
|
+
var map = cladoPresenceStore.get(cardId);
|
|
1143
|
+
var entries = map ? Array.from(map.values()) : [];
|
|
1144
|
+
if (cladoRenderCardPresenceDom(cardId, cardEl, entries)) anyLayoutDelta = true;
|
|
1145
|
+
});
|
|
1146
|
+
if (anyLayoutDelta && document.body.dataset.mode === 'cards') {
|
|
1147
|
+
try { repinPorts(); drawWires(); } catch (e) {}
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
function cladoSetPresenceConfig(cfg) {
|
|
1152
|
+
if (!cfg || typeof cfg !== 'object') return;
|
|
1153
|
+
if (typeof cfg.afterglowMs === 'number' && isFinite(cfg.afterglowMs) && cfg.afterglowMs >= 0) {
|
|
1154
|
+
cladoPresenceAfterglowMs = Math.min(300000, Math.round(cfg.afterglowMs));
|
|
1155
|
+
var now = Date.now();
|
|
1156
|
+
cladoPresenceStore.forEach(function (map, cardId) {
|
|
1157
|
+
map.forEach(function (entry, sid) {
|
|
1158
|
+
if (entry.phase === 'afterglow') {
|
|
1159
|
+
if (cladoPresenceAfterglowMs <= 0) map.delete(sid);
|
|
1160
|
+
else entry.expiresAt = Math.min(entry.expiresAt || (now + cladoPresenceAfterglowMs), now + cladoPresenceAfterglowMs);
|
|
1161
|
+
}
|
|
1162
|
+
});
|
|
1163
|
+
if (!map.size) cladoPresenceStore.delete(cardId);
|
|
1164
|
+
});
|
|
1165
|
+
cladoEnsurePresenceTimers();
|
|
1166
|
+
cladoSyncAllCardPresenceDom();
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
function cladoSetCardPresence(ev) {
|
|
1171
|
+
if (!ev || typeof ev !== 'object') return;
|
|
1172
|
+
var sid = String(ev.sessionId || ev.roleId || 'agent');
|
|
1173
|
+
var phase = ev.phase || 'active';
|
|
1174
|
+
var now = Date.now();
|
|
1175
|
+
|
|
1176
|
+
if (phase === 'clear') {
|
|
1177
|
+
var clearIds = cladoResolvePresenceCardIds(ev.cards);
|
|
1178
|
+
if (clearIds.length) {
|
|
1179
|
+
clearIds.forEach(function (cid) {
|
|
1180
|
+
var m = cladoPresenceStore.get(cid);
|
|
1181
|
+
if (m) {
|
|
1182
|
+
m.delete(sid);
|
|
1183
|
+
if (!m.size) cladoPresenceStore.delete(cid);
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
} else {
|
|
1187
|
+
cladoPresenceStore.forEach(function (m, cid) {
|
|
1188
|
+
m.delete(sid);
|
|
1189
|
+
if (!m.size) cladoPresenceStore.delete(cid);
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
cladoEnsurePresenceTimers();
|
|
1193
|
+
cladoSyncAllCardPresenceDom();
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
if (phase === 'afterglow') {
|
|
1198
|
+
cladoPresenceStore.forEach(function (m, cid) {
|
|
1199
|
+
var existing = m.get(sid);
|
|
1200
|
+
if (!existing) return;
|
|
1201
|
+
if (cladoPresenceAfterglowMs <= 0) {
|
|
1202
|
+
m.delete(sid);
|
|
1203
|
+
if (!m.size) cladoPresenceStore.delete(cid);
|
|
1204
|
+
} else {
|
|
1205
|
+
existing.phase = 'afterglow';
|
|
1206
|
+
existing.expiresAt = now + cladoPresenceAfterglowMs;
|
|
1207
|
+
if (ev.label && !existing.label) existing.label = ev.label;
|
|
1208
|
+
}
|
|
1209
|
+
});
|
|
1210
|
+
cladoEnsurePresenceTimers();
|
|
1211
|
+
cladoSyncAllCardPresenceDom();
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
// phase === 'active'
|
|
1216
|
+
var targetIds = cladoResolvePresenceCardIds(ev.cards);
|
|
1217
|
+
if (!targetIds.length) return;
|
|
1218
|
+
var targetSet = new Set(targetIds);
|
|
1219
|
+
|
|
1220
|
+
// Transition any previously active cards of this same session that are no longer targeted into afterglow
|
|
1221
|
+
cladoPresenceStore.forEach(function (m, cid) {
|
|
1222
|
+
if (targetSet.has(cid)) return;
|
|
1223
|
+
var existing = m.get(sid);
|
|
1224
|
+
if (existing && existing.phase === 'active') {
|
|
1225
|
+
if (cladoPresenceAfterglowMs <= 0) {
|
|
1226
|
+
m.delete(sid);
|
|
1227
|
+
if (!m.size) cladoPresenceStore.delete(cid);
|
|
1228
|
+
} else {
|
|
1229
|
+
existing.phase = 'afterglow';
|
|
1230
|
+
existing.expiresAt = now + cladoPresenceAfterglowMs;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
});
|
|
1234
|
+
|
|
1235
|
+
targetIds.forEach(function (cid) {
|
|
1236
|
+
var m = cladoPresenceStore.get(cid);
|
|
1237
|
+
if (!m) {
|
|
1238
|
+
m = new Map();
|
|
1239
|
+
cladoPresenceStore.set(cid, m);
|
|
1240
|
+
}
|
|
1241
|
+
m.set(sid, {
|
|
1242
|
+
sessionId: sid,
|
|
1243
|
+
roleId: String(ev.roleId || ''),
|
|
1244
|
+
roleName: String(ev.roleName || 'AI 角色'),
|
|
1245
|
+
tone: cladoNormalizeTone(ev.tone),
|
|
1246
|
+
label: String(ev.label || ''),
|
|
1247
|
+
codePath: String(ev.codePath || ''),
|
|
1248
|
+
phase: 'active',
|
|
1249
|
+
ts: now,
|
|
1250
|
+
expiresAt: 0,
|
|
1251
|
+
});
|
|
1252
|
+
});
|
|
1253
|
+
|
|
1254
|
+
cladoEnsurePresenceTimers();
|
|
1255
|
+
cladoSyncAllCardPresenceDom();
|
|
1256
|
+
}
|
package/src/html/canvas-ui.css
CHANGED
|
@@ -642,3 +642,146 @@ body.clado-link-picking .clado-tag:hover{
|
|
|
642
642
|
.clado-sel-quickbar .sep{
|
|
643
643
|
width:1px;height:14px;background:var(--line);margin:0 1px;
|
|
644
644
|
}
|
|
645
|
+
|
|
646
|
+
/* ── 多角色卡片空间协同(方案 1 · 底部一体状态栏 + 1px 羽化光丝 + 向下垂落呼吸柔光) ── */
|
|
647
|
+
@keyframes clado-presence-breathe{
|
|
648
|
+
0%,100%{opacity:.52;transform:scaleX(.95) scaleY(.88)}
|
|
649
|
+
50%{opacity:1;transform:scaleX(1.03) scaleY(1.16)}
|
|
650
|
+
}
|
|
651
|
+
@keyframes clado-presence-dot-pulse{
|
|
652
|
+
0%,100%{opacity:.55;transform:scale(.88)}
|
|
653
|
+
50%{opacity:1;transform:scale(1.18)}
|
|
654
|
+
}
|
|
655
|
+
.card.clado-has-presence{
|
|
656
|
+
--p-rgb:56,189,248;
|
|
657
|
+
--p-rgb2:129,140,248;
|
|
658
|
+
--p-fg:#0369a1;
|
|
659
|
+
--p-fg-dark:#7dd3fc;
|
|
660
|
+
}
|
|
661
|
+
.card.clado-has-presence[data-presence-tone="sky"]{
|
|
662
|
+
--p-rgb:56,189,248;--p-rgb2:129,140,248;--p-fg:#0369a1;--p-fg-dark:#7dd3fc;
|
|
663
|
+
}
|
|
664
|
+
.card.clado-has-presence[data-presence-tone="emerald"]{
|
|
665
|
+
--p-rgb:16,185,129;--p-rgb2:45,212,191;--p-fg:#047857;--p-fg-dark:#6ee7b7;
|
|
666
|
+
}
|
|
667
|
+
.card.clado-has-presence[data-presence-tone="violet"]{
|
|
668
|
+
--p-rgb:139,92,246;--p-rgb2:244,114,182;--p-fg:#6d28d9;--p-fg-dark:#c4b5fd;
|
|
669
|
+
}
|
|
670
|
+
.card.clado-has-presence[data-presence-tone="amber"]{
|
|
671
|
+
--p-rgb:245,158,11;--p-rgb2:251,146,60;--p-fg:#b45309;--p-fg-dark:#fcd34d;
|
|
672
|
+
}
|
|
673
|
+
.card.clado-has-presence .clado-presence-bar{
|
|
674
|
+
flex:0 0 auto;
|
|
675
|
+
position:relative;
|
|
676
|
+
display:flex;align-items:center;justify-content:space-between;gap:8px;
|
|
677
|
+
padding:6px 12px 7px;
|
|
678
|
+
border-top:1px solid rgba(var(--p-rgb),.15);
|
|
679
|
+
border-radius:0 0 calc(var(--proto-radius, 11px) - 1px) calc(var(--proto-radius, 11px) - 1px);
|
|
680
|
+
background:linear-gradient(180deg,rgba(var(--p-rgb),.04),rgba(var(--p-rgb),.095));
|
|
681
|
+
color:var(--p-fg);
|
|
682
|
+
font-size:11px;font-weight:560;line-height:1.3;
|
|
683
|
+
cursor:pointer;user-select:none;
|
|
684
|
+
transition:background .35s ease,border-color .35s ease,color .35s ease,opacity .35s ease;
|
|
685
|
+
}
|
|
686
|
+
[data-theme="dark"] .card.clado-has-presence .clado-presence-bar{
|
|
687
|
+
color:var(--p-fg-dark);
|
|
688
|
+
border-top-color:rgba(var(--p-rgb),.22);
|
|
689
|
+
background:linear-gradient(180deg,rgba(var(--p-rgb),.06),rgba(var(--p-rgb),.13));
|
|
690
|
+
}
|
|
691
|
+
.card.clado-has-presence.is-afterglow .clado-presence-bar{
|
|
692
|
+
opacity:.72;
|
|
693
|
+
}
|
|
694
|
+
.clado-presence-left{
|
|
695
|
+
display:flex;align-items:center;gap:6px;min-width:0;flex:1;
|
|
696
|
+
}
|
|
697
|
+
.clado-presence-dot{
|
|
698
|
+
width:6px;height:6px;border-radius:50%;flex:none;
|
|
699
|
+
background:rgb(var(--p-rgb));
|
|
700
|
+
box-shadow:0 0 8px rgba(var(--p-rgb),.75);
|
|
701
|
+
animation:clado-presence-dot-pulse 2.2s ease-in-out infinite;
|
|
702
|
+
}
|
|
703
|
+
.card.clado-has-presence.is-afterglow .clado-presence-dot{
|
|
704
|
+
animation:none;opacity:.65;box-shadow:0 0 4px rgba(var(--p-rgb),.4);
|
|
705
|
+
}
|
|
706
|
+
.clado-presence-text{
|
|
707
|
+
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
|
|
708
|
+
}
|
|
709
|
+
.clado-presence-right{
|
|
710
|
+
display:flex;align-items:center;gap:6px;flex:none;
|
|
711
|
+
}
|
|
712
|
+
.clado-presence-dots{
|
|
713
|
+
display:inline-flex;align-items:center;gap:4px;
|
|
714
|
+
}
|
|
715
|
+
.clado-presence-mdot{
|
|
716
|
+
width:6px;height:6px;border-radius:50%;opacity:.38;
|
|
717
|
+
transition:opacity .25s ease,transform .25s ease;
|
|
718
|
+
}
|
|
719
|
+
.clado-presence-mdot.is-cur{opacity:1;transform:scale(1.22)}
|
|
720
|
+
.clado-presence-mdot[data-tone="sky"]{background:#38bdf8}
|
|
721
|
+
.clado-presence-mdot[data-tone="emerald"]{background:#10b981}
|
|
722
|
+
.clado-presence-mdot[data-tone="violet"]{background:#8b5cf6}
|
|
723
|
+
.clado-presence-mdot[data-tone="amber"]{background:#f59e0b}
|
|
724
|
+
.clado-presence-count{
|
|
725
|
+
font-size:10px;opacity:.72;font-weight:520;
|
|
726
|
+
}
|
|
727
|
+
.clado-presence-dismiss{
|
|
728
|
+
appearance:none;border:0;background:transparent;color:currentColor;
|
|
729
|
+
width:16px;height:16px;padding:0;border-radius:50%;
|
|
730
|
+
display:grid;place-items:center;font-size:12px;line-height:1;
|
|
731
|
+
opacity:0;cursor:pointer;transition:opacity 140ms ease,background-color 140ms ease;
|
|
732
|
+
}
|
|
733
|
+
.clado-presence-bar:hover .clado-presence-dismiss{opacity:.65}
|
|
734
|
+
.clado-presence-dismiss:hover{opacity:1!important;background:rgba(var(--p-rgb),.18)}
|
|
735
|
+
.clado-presence-tip{
|
|
736
|
+
position:absolute;left:10px;right:10px;bottom:calc(100% + 6px);z-index:12;
|
|
737
|
+
padding:8px 10px;border-radius:10px;
|
|
738
|
+
background:color-mix(in srgb,var(--panel) 94%,transparent);
|
|
739
|
+
backdrop-filter:blur(16px) saturate(160%);
|
|
740
|
+
-webkit-backdrop-filter:blur(16px) saturate(160%);
|
|
741
|
+
border:1px solid var(--line);
|
|
742
|
+
box-shadow:0 12px 28px -10px rgba(15,23,42,.24);
|
|
743
|
+
color:var(--fg);font-size:11px;font-weight:480;
|
|
744
|
+
display:flex;flex-direction:column;gap:5px;
|
|
745
|
+
opacity:0;visibility:hidden;pointer-events:none;
|
|
746
|
+
transform:translateY(4px);
|
|
747
|
+
transition:opacity 150ms ease,transform 150ms ease,visibility 0s linear 150ms;
|
|
748
|
+
}
|
|
749
|
+
.clado-presence-bar:hover .clado-presence-tip{
|
|
750
|
+
opacity:1;visibility:visible;pointer-events:auto;transform:translateY(0);
|
|
751
|
+
transition:opacity 150ms ease,transform 150ms ease,visibility 0s;
|
|
752
|
+
}
|
|
753
|
+
.clado-presence-tip-row{
|
|
754
|
+
display:flex;align-items:center;justify-content:space-between;gap:8px;
|
|
755
|
+
}
|
|
756
|
+
.clado-presence-tip-main{
|
|
757
|
+
display:flex;align-items:center;gap:6px;min-width:0;
|
|
758
|
+
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
|
|
759
|
+
}
|
|
760
|
+
.clado-presence-tip-phase{
|
|
761
|
+
font-size:10px;color:var(--fg-2);flex:none;
|
|
762
|
+
}
|
|
763
|
+
.card.clado-has-presence .clado-presence-line{
|
|
764
|
+
position:absolute;left:7%;right:7%;bottom:-.5px;height:1px;
|
|
765
|
+
pointer-events:none;z-index:4;
|
|
766
|
+
background:linear-gradient(90deg,transparent 0%,rgba(var(--p-rgb),.8) 26%,rgba(var(--p-rgb2),.8) 74%,transparent 100%);
|
|
767
|
+
transition:background .45s ease,opacity .45s ease;
|
|
768
|
+
}
|
|
769
|
+
.card.clado-has-presence.is-afterglow .clado-presence-line{opacity:.42}
|
|
770
|
+
.card.clado-has-presence .clado-presence-glow{
|
|
771
|
+
position:absolute;left:8%;right:8%;top:calc(100% - 1px);height:22px;
|
|
772
|
+
pointer-events:none;z-index:-1;transform-origin:50% 0%;
|
|
773
|
+
background:radial-gradient(ellipse 56% 92% at 50% 0%,rgba(var(--p-rgb),.32) 0%,rgba(var(--p-rgb2),.14) 50%,transparent 80%);
|
|
774
|
+
filter:blur(8px);
|
|
775
|
+
animation:clado-presence-breathe 2.8s ease-in-out infinite;
|
|
776
|
+
transition:background .45s ease,opacity .45s ease;
|
|
777
|
+
}
|
|
778
|
+
[data-theme="dark"] .card.clado-has-presence .clado-presence-glow{
|
|
779
|
+
background:radial-gradient(ellipse 56% 92% at 50% 0%,rgba(var(--p-rgb),.42) 0%,rgba(var(--p-rgb2),.18) 50%,transparent 80%);
|
|
780
|
+
}
|
|
781
|
+
.card.clado-has-presence.is-afterglow .clado-presence-glow{
|
|
782
|
+
animation:none;opacity:.34;
|
|
783
|
+
}
|
|
784
|
+
@media(prefers-reduced-motion:reduce){
|
|
785
|
+
.card.clado-has-presence .clado-presence-glow,
|
|
786
|
+
.clado-presence-dot{animation:none}
|
|
787
|
+
}
|
package/src/html/page.js
CHANGED
|
@@ -93,8 +93,10 @@ export function renderHtml(doc, diagnostics = [], options = {}) {
|
|
|
93
93
|
.replace('/*__MERMAID__*/', () => (doc.hasMermaid ? read('mermaid.min.js') : ''));
|
|
94
94
|
|
|
95
95
|
runtime = fixCanvasRuntime(runtime);
|
|
96
|
-
const
|
|
97
|
-
|
|
96
|
+
const helperFiles = ['canvas-wires.js','mindmap-connectors.js','mindmap-media.js','canvas-focus.js','canvas-chain.js'];
|
|
97
|
+
if (options.library || options.workspaceChrome) helperFiles.push('canvas-live-diff.js');
|
|
98
|
+
helperFiles.push('runtime-api.js');
|
|
99
|
+
const helpers = helperFiles.map(name => readFileSync(join(HERE, name), 'utf8')).join('\n');
|
|
98
100
|
const end = runtime.lastIndexOf('})();');
|
|
99
101
|
runtime = runtime.slice(0, end) + helpers + runtime.slice(end);
|
|
100
102
|
runtime = runtime.replace(/<(?:!--|\/?script\b)/gi, match => '\\x3c' + match.slice(1));
|
package/src/html/runtime-api.js
CHANGED
|
@@ -291,6 +291,12 @@
|
|
|
291
291
|
setDraftCard: function (draft) {
|
|
292
292
|
if (typeof renderCanvasDraftGhost === 'function') renderCanvasDraftGhost(draft);
|
|
293
293
|
},
|
|
294
|
+
setCardPresence: function (ev) {
|
|
295
|
+
if (typeof cladoSetCardPresence === 'function') cladoSetCardPresence(ev);
|
|
296
|
+
},
|
|
297
|
+
setPresenceConfig: function (cfg) {
|
|
298
|
+
if (typeof cladoSetPresenceConfig === 'function') cladoSetPresenceConfig(cfg);
|
|
299
|
+
},
|
|
294
300
|
startLinkPick: function (sourceSpec) {
|
|
295
301
|
if (typeof startCanvasLinkPick === 'function') startCanvasLinkPick(sourceSpec);
|
|
296
302
|
},
|