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.
@@ -168,7 +168,202 @@ function canvasMermaidBend(x, y, right, diagram, obstacles) {
168
168
  return null;
169
169
  }
170
170
 
171
+ var CLADO_TAG_COLORS = {
172
+ green: 'green', add: 'green',
173
+ amber: 'amber', mod: 'amber', yellow: 'amber', warn: 'amber',
174
+ red: 'red', del: 'red', danger: 'red',
175
+ blue: 'blue', spec: 'blue', info: 'blue',
176
+ purple: 'purple', note: 'purple',
177
+ gray: 'gray', neutral: 'gray',
178
+ };
179
+ var CLADO_EMOJI_TAGS = [
180
+ ['🟩', '新增', 'green'],
181
+ ['🟨', '修改', 'amber'],
182
+ ['🟥', '删除', 'red'],
183
+ ['🟦', '需求原文', 'blue'],
184
+ ['🟪', '特别说明', 'purple'],
185
+ ];
186
+ var CLADO_CODE_COMMENT_TAG_RE = /(?:\/\/|#|--|\/\*|<!--)\s*\{([^{}\r\n]+)\}\s*(?:\*\/|-->)?\s*$/;
187
+
188
+ function canvasParseTagAttrs(raw) {
189
+ if (!raw || typeof raw !== 'string') return null;
190
+ var tokens = raw.trim().split(/\s+/).filter(Boolean);
191
+ if (!tokens.length) return null;
192
+ var id = null, color = null, extra = [];
193
+ for (var i = 0; i < tokens.length; i++) {
194
+ var tok = tokens[i];
195
+ if (!id && /^#[a-zA-Z0-9\u4e00-\u9fff_:-]{1,64}$/.test(tok)) { id = tok.slice(1); continue; }
196
+ if (!color && /^\.[a-zA-Z]+$/.test(tok)) {
197
+ var mapped = CLADO_TAG_COLORS[tok.slice(1).toLowerCase()];
198
+ if (mapped) { color = mapped; continue; }
199
+ return null;
200
+ }
201
+ if (tok[0] === '#' || tok[0] === '.') return null;
202
+ extra.push(tok);
203
+ }
204
+ if (!id && !color) return null;
205
+ return { id: id, color: color || 'gray', extraText: extra.join(' ').slice(0, 40) };
206
+ }
207
+
208
+ function canvasStripCodeRanges(code, ranges) {
209
+ if (!ranges.length) return;
210
+ var walker = document.createTreeWalker(code, NodeFilter.SHOW_TEXT);
211
+ var nodes = [], offset = 0;
212
+ while (walker.nextNode()) {
213
+ var n = walker.currentNode;
214
+ nodes.push({ node: n, start: offset, end: offset + n.length });
215
+ offset += n.length;
216
+ }
217
+ for (var r = ranges.length - 1; r >= 0; r--) {
218
+ var seg = ranges[r];
219
+ for (var i = 0; i < nodes.length; i++) {
220
+ var entry = nodes[i];
221
+ if (entry.end <= seg.start || entry.start >= seg.end) continue;
222
+ var cutStart = Math.max(0, seg.start - entry.start);
223
+ var cutEnd = Math.min(entry.node.length, seg.end - entry.start);
224
+ var val = entry.node.nodeValue || '';
225
+ entry.node.nodeValue = val.slice(0, cutStart) + val.slice(cutEnd);
226
+ }
227
+ }
228
+ }
229
+
230
+ function canvasMakeTagEl(id, color, text) {
231
+ var el = document.createElement('span');
232
+ el.dataset.color = color || 'gray';
233
+ if (id) el.dataset.tagId = id;
234
+ if (text) {
235
+ el.className = 'clado-tag';
236
+ el.textContent = text;
237
+ if (id) el.title = '#' + id;
238
+ } else {
239
+ el.className = 'clado-tag-dot';
240
+ el.setAttribute('aria-label', id ? 'Tag #' + id : 'Tag');
241
+ if (id) el.title = '#' + id;
242
+ }
243
+ return el;
244
+ }
245
+
246
+ function canvasRenderTags(box) {
247
+ // 1) 正文 / 列表 / 表格中的 [文字]{#id .color}、[]{#id .color} 与传统五色方块标记
248
+ var walker = document.createTreeWalker(box, NodeFilter.SHOW_TEXT);
249
+ var textNodes = [];
250
+ while (walker.nextNode()) {
251
+ var cur = walker.currentNode;
252
+ if (!cur.nodeValue || !cur.parentElement) continue;
253
+ if (cur.parentElement.closest('pre,code,a,.clado-tag,.clado-tag-dot')) continue;
254
+ if (/[\[{🟩🟨🟥🟦🟪]/.test(cur.nodeValue)) textNodes.push(cur);
255
+ }
256
+ var tokenRe = /\[([^\[\]\r\n]{0,40})\]\{([^{}\r\n]+)\}|(🟩|🟨|🟥|🟦|🟪)[ \t]*(新增|修改|删除|需求原文|特别说明)/g;
257
+ textNodes.forEach(function (node) {
258
+ var src = node.nodeValue || '';
259
+ tokenRe.lastIndex = 0;
260
+ var m, last = 0, frag = null;
261
+ while ((m = tokenRe.exec(src))) {
262
+ var el = null;
263
+ if (m[2] !== undefined) {
264
+ var parsed = canvasParseTagAttrs(m[2]);
265
+ if (!parsed) continue;
266
+ el = canvasMakeTagEl(parsed.id, parsed.color, (m[1] || '').trim());
267
+ } else if (m[3]) {
268
+ var color = 'gray';
269
+ for (var j = 0; j < CLADO_EMOJI_TAGS.length; j++) {
270
+ if (CLADO_EMOJI_TAGS[j][0] === m[3]) { color = CLADO_EMOJI_TAGS[j][2]; break; }
271
+ }
272
+ el = canvasMakeTagEl(null, color, m[4]);
273
+ }
274
+ if (!el) continue;
275
+ if (!frag) frag = document.createDocumentFragment();
276
+ if (m.index > last) frag.appendChild(document.createTextNode(src.slice(last, m.index)));
277
+ frag.appendChild(el);
278
+ last = m.index + m[0].length;
279
+ }
280
+ if (frag) {
281
+ if (last < src.length) frag.appendChild(document.createTextNode(src.slice(last)));
282
+ node.parentNode.replaceChild(frag, node);
283
+ }
284
+ });
285
+
286
+ // 2) 无字小圆点视觉一律归左:无论作者写在行首还是行中/行尾,都平稳钉在该行最左侧承接入线
287
+ $$('.clado-tag-dot', box).forEach(function (dot) {
288
+ if (dot.closest('pre,.clado-code-gutter-tag')) return;
289
+ var li = dot.closest('li');
290
+ if (li && box.contains(li)) {
291
+ if (li.firstChild !== dot) li.insertBefore(dot, li.firstChild);
292
+ if (dot.nextSibling && dot.nextSibling.nodeType === 3) {
293
+ dot.nextSibling.nodeValue = dot.nextSibling.nodeValue.replace(/^[ \t]+/, '');
294
+ }
295
+ li.classList.add('clado-li-dot-tag');
296
+ return;
297
+ }
298
+ var block = dot.closest('p,td,th,blockquote');
299
+ if (block && box.contains(block)) {
300
+ if (block.firstChild !== dot) block.insertBefore(dot, block.firstChild);
301
+ if (dot.nextSibling && dot.nextSibling.nodeType === 3) {
302
+ dot.nextSibling.nodeValue = dot.nextSibling.nodeValue.replace(/^[ \t]+/, '');
303
+ }
304
+ block.classList.add('clado-block-dot-tag');
305
+ }
306
+ });
307
+
308
+ // 3) 代码块行尾注释 Tag(如 verifySign(req); // {#verify-sign .blue}):
309
+ // 视觉上剥离行尾注释语法、原样保持代码换行,同时在代码块最左侧边槽精确渲染小圆点/胶囊锚点
310
+ $$('pre > code', box).forEach(function (code) {
311
+ if (code.closest('.mermaid')) return;
312
+ var pre = code.parentElement;
313
+ var raw = code.textContent || '';
314
+ var lines = raw.split('\n');
315
+ var codeTags = [], stripRanges = [], lineStart = 0;
316
+ for (var i = 0; i < lines.length; i++) {
317
+ var line = lines[i];
318
+ var cm = CLADO_CODE_COMMENT_TAG_RE.exec(line);
319
+ if (cm) {
320
+ var parsed = canvasParseTagAttrs(cm[1]);
321
+ if (parsed) {
322
+ var trimBefore = cm.index;
323
+ while (trimBefore > 0 && (line[trimBefore - 1] === ' ' || line[trimBefore - 1] === '\t')) trimBefore--;
324
+ codeTags.push({ line: i + 1, id: parsed.id, color: parsed.color, text: parsed.extraText });
325
+ stripRanges.push({ start: lineStart + trimBefore, end: lineStart + line.length });
326
+ }
327
+ }
328
+ lineStart += line.length + 1;
329
+ }
330
+ if (!codeTags.length) return;
331
+ canvasStripCodeRanges(code, stripRanges);
332
+ pre.classList.add('has-code-tags');
333
+ if (codeTags.some(function (t) { return !!t.text; })) pre.classList.add('has-code-pill-tags');
334
+ codeTags.forEach(function (item) {
335
+ var wrap = document.createElement('span');
336
+ wrap.className = 'clado-code-gutter-tag' + (item.text ? ' has-text' : '');
337
+ wrap.dataset.codeLine = String(item.line);
338
+ wrap.dataset.color = item.color;
339
+ if (item.id) wrap.dataset.tagId = item.id;
340
+ var inner = canvasMakeTagEl(null, item.color, item.text);
341
+ if (item.id) inner.title = '#' + item.id;
342
+ wrap.appendChild(inner);
343
+ pre.appendChild(wrap);
344
+ });
345
+ });
346
+ }
347
+
348
+ function canvasPlaceCodeTags(root) {
349
+ if (!root) return;
350
+ $$('pre.has-code-tags', root).forEach(function (pre) {
351
+ var code = $('code', pre);
352
+ if (!code) return;
353
+ var preRect = pre.getBoundingClientRect();
354
+ var k = pre.offsetWidth ? preRect.width / pre.offsetWidth : 1;
355
+ if (!preRect.height || !k) return;
356
+ $$('.clado-code-gutter-tag', pre).forEach(function (tagEl) {
357
+ var lineRect = canvasCodeLine(code, +tagEl.dataset.codeLine);
358
+ if (!lineRect || !lineRect.height) { tagEl.hidden = true; return; }
359
+ tagEl.hidden = false;
360
+ tagEl.style.top = ((lineRect.top + lineRect.height / 2 - preRect.top) / k - pre.clientTop) + 'px';
361
+ });
362
+ });
363
+ }
364
+
171
365
  function canvasPlaceMediaJumps(root) {
366
+ canvasPlaceCodeTags(root);
172
367
  $$('.media-jump', root).forEach(function (trigger) {
173
368
  var link = trigger.mediaLink, block = link.mediaBlock;
174
369
  var card = block.closest('.card,.mnode');
@@ -288,6 +483,38 @@ function canvasTargetAnchor(container, targetId, detail) {
288
483
  return null;
289
484
  }
290
485
 
486
+ function canvasTagTarget(container, tagId) {
487
+ if (!container || !tagId) return null;
488
+ var el = $$('[data-tag-id]', container).find(function (n) { return n.dataset.tagId === tagId; });
489
+ if (el) {
490
+ var rect = el.getBoundingClientRect();
491
+ if (rect.height) {
492
+ var flashEl = el.closest('li,tr,pre,p,blockquote') || el;
493
+ return { x: rect.left - 2, y: rect.top + rect.height / 2, element: flashEl, isTag: true };
494
+ }
495
+ }
496
+ var tagMeta = DOC.tags && DOC.tags[tagId];
497
+ if (tagMeta && tagMeta.kind === 'mermaid') {
498
+ var diagrams = $$('.mermaid svg', container);
499
+ var diagram = diagrams[(tagMeta.blockIndex || 1) - 1] || diagrams[0];
500
+ if (diagram) {
501
+ var m = canvasFindMermaidNode(diagram, tagId);
502
+ if (m.node) {
503
+ var mRect = m.node.getBoundingClientRect();
504
+ if (mRect.height) return { x: mRect.left, y: mRect.top + mRect.height / 2, element: m.node, isTag: true };
505
+ }
506
+ }
507
+ }
508
+ return null;
509
+ }
510
+
511
+ function canvasCardTagTarget(card, tagId) {
512
+ var hit = canvasTagTarget(card, tagId);
513
+ if (!hit) return null;
514
+ var body = $('.body', card).getBoundingClientRect();
515
+ return hit.y >= body.top && hit.y <= body.bottom && hit.x <= body.right ? { x: hit.x, y: hit.y, isTag: true } : null;
516
+ }
517
+
291
518
  function canvasMediaTarget(card, targetId, detail) {
292
519
  var hit = canvasTargetAnchor(card, targetId, detail);
293
520
  if (!hit) return null;
@@ -297,12 +524,13 @@ function canvasMediaTarget(card, targetId, detail) {
297
524
 
298
525
  function canvasRevealMediaTarget(link, id) {
299
526
  var record = canvasRecords[id];
300
- if (!record || !canvasHasTargetSpec(link.dataset.mediaPoint)) return;
527
+ var tagId = link.dataset.tagTarget;
528
+ if (!record || (!tagId && !canvasHasTargetSpec(link.dataset.mediaPoint))) return;
301
529
  var mode = document.body.dataset.mode, container;
302
530
  if (mode === 'cards') container = render.card[record.card];
303
531
  else if (mode === 'mindmap') container = $('#mind .mnode[data-path="' + record.mindPath + '"]');
304
532
  else container = $('#article .slice[data-path="' + record.docPath + '"]');
305
- var hit = container && canvasTargetAnchor(container, id, link.dataset.mediaPoint);
533
+ var hit = container && (tagId ? canvasTagTarget(container, tagId) : canvasTargetAnchor(container, id, link.dataset.mediaPoint));
306
534
  if (!hit || !hit.element) return;
307
535
  hit.element.classList.add('media-target-flash');
308
536
  if (mode === 'doc') hit.element.scrollIntoView({ block: 'center', inline: 'nearest' });
@@ -333,7 +561,7 @@ function canvasMediaStem(port, point, incoming) {
333
561
  var a = canvasLocalPoint(layer, point.x, point.y);
334
562
  var b = canvasPort(layer, port);
335
563
  var stem = document.createElementNS(layer.namespaceURI, 'path');
336
- stem.dataset.mediaPoint = port.dataset.mediaPoint;
564
+ stem.dataset.mediaPoint = port.dataset.mediaPoint || (port.dataset.tagTarget ? 'tag:' + port.dataset.tagTarget : '');
337
565
  stem.dataset.sourceId = port.dataset.sourceId || '';
338
566
  stem.dataset.targetId = port.dataset.anchorId || port.dataset.edge || '';
339
567
  var path = 'M' + a.x + ' ' + a.y;
@@ -347,10 +575,10 @@ function canvasMediaStem(port, point, incoming) {
347
575
  }
348
576
  stem.setAttribute('d', path + ' H' + b.x);
349
577
  layer.appendChild(stem);
350
- if (!incoming && port.mediaLink?.mediaTrigger) return;
578
+ if (point.isTag || (!incoming && port.mediaLink?.mediaTrigger)) return;
351
579
  var marker = document.createElementNS(layer.namespaceURI, 'circle');
352
580
  marker.setAttribute('cx', a.x); marker.setAttribute('cy', a.y); marker.setAttribute('r', '3');
353
- marker.dataset.mediaPoint = port.dataset.mediaPoint;
581
+ marker.dataset.mediaPoint = stem.dataset.mediaPoint;
354
582
  marker.dataset.sourceId = stem.dataset.sourceId;
355
583
  marker.dataset.targetId = stem.dataset.targetId;
356
584
  marker.classList.toggle('media-landing', incoming);
@@ -39,15 +39,19 @@ function canvasDrawMindWires() {
39
39
  var anchored = Object.keys(nodes).find(function (key) { return key.indexOf(parentPath + '.') === 0 && nodes[key].record.title === link.dataset.anchor; });
40
40
  if (anchored) target = nodes[anchored];
41
41
  }
42
- var dedupKey = target.path + '|' + (link.dataset.mediaPoint || '');
42
+ var dedupKey = target.path + '|' + (link.dataset.tagTarget || '') + '|' + (link.dataset.mediaPoint || '');
43
43
  if (target === source || (!link.mediaBlock && seen[dedupKey])) return;
44
44
  if (!link.mediaBlock) seen[dedupKey] = true;
45
- var landing = link.dataset.mediaPoint ? canvasMediaTarget(target.el, target.record.id, link.dataset.mediaPoint) : null;
45
+ var landing = link.dataset.tagTarget
46
+ ? canvasTagTarget(target.el, link.dataset.tagTarget)
47
+ : (link.dataset.mediaPoint ? canvasMediaTarget(target.el, target.record.id, link.dataset.mediaPoint) : null);
46
48
  var to;
47
49
  if (landing) {
48
50
  var input = document.createElement('span'); input.className = 'hbar incoming-anchor';
49
51
  input.style.top = (canvasLocalPoint(svg, landing.x, landing.y).y - target.bounds.top - 10) + 'px';
50
- input.dataset.mediaPoint = link.dataset.mediaPoint; input.dataset.sourceId = source.record.id; input.dataset.edge = target.record.id;
52
+ if (link.dataset.mediaPoint) input.dataset.mediaPoint = link.dataset.mediaPoint;
53
+ if (link.dataset.tagTarget) input.dataset.tagTarget = link.dataset.tagTarget;
54
+ input.dataset.sourceId = source.record.id; input.dataset.edge = target.record.id;
51
55
  target.el.append(input); canvasMediaStem(input, landing, true); to = canvasPort(svg, input);
52
56
  } else if (canvasHasTargetSpec(link.dataset.mediaPoint)) return;
53
57
  if (link.mediaBlock) {
package/src/html/page.js CHANGED
@@ -107,8 +107,9 @@ export function renderHtml(doc, diagnostics = [], options = {}) {
107
107
  <html lang="zh-CN" data-theme="${theme}">
108
108
  <head>
109
109
  <meta charset="utf-8">
110
- <meta name="viewport" content="width=device-width, initial-scale=1">
110
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
111
111
  <title>${escapeHtml(title)}</title>
112
+ <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect x='2' y='2' width='60' height='60' rx='16' fill='%231c2028'/%3E%3Cpath 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' fill='none' stroke='%23fff' stroke-width='5.4' stroke-linecap='round'/%3E%3Ccircle cx='43.5' cy='32' r='3.2' fill='%2360a5fa'/%3E%3C/svg%3E">
112
113
  <meta name="generator" content="clado ${escapeHtml(version)}">
113
114
  <style>
114
115
  ${vendorCss()}
@@ -1,51 +1,73 @@
1
1
  :root {
2
- --clado-ui-text: #191919;
3
- --clado-ui-muted: #565656;
4
- --clado-ui-accent: #252525;
5
- --clado-ui-surface: rgb(252 252 252 / .04);
6
- --clado-ui-panel-surface: rgb(250 250 250 / .13);
7
- --clado-ui-well: rgb(231 231 231 / .46);
8
- --clado-ui-solid: #f8f8f8;
9
- --clado-ui-edge: #17171724;
10
- --clado-ui-active: #e9e9e9;
11
- --clado-ui-highlight: rgb(255 255 255 / .34);
12
- --clado-ui-rim: rgb(93 93 93 / .08);
13
- --clado-ui-shadow: 0 3px 12px rgb(21 21 21 / .10), 0 1px 3px rgb(21 21 21 / .06);
14
- --clado-ui-glass-outline: rgb(100 100 100 / .17);
15
- --clado-ui-glass-shadow: 0 5px 22px rgb(21 21 21 / .09);
16
- --clado-ui-control-blur: 14px;
2
+ --clado-ui-text: #14171f;
3
+ --clado-ui-muted: #5a6273;
4
+ --clado-ui-subtle: #8790a2;
5
+ --clado-ui-accent: #181a20;
6
+ --clado-ui-brand: #2563eb;
7
+ --clado-ui-brand-soft: rgb(37 99 235 / .11);
8
+ --clado-ui-surface: rgb(255 255 255 / .30);
9
+ --clado-ui-panel-surface: rgb(255 255 255 / .30);
10
+ --clado-ui-well: rgb(255 255 255 / .18);
11
+ --clado-ui-well-border: rgb(255 255 255 / .58);
12
+ --clado-ui-well-focus: rgb(255 255 255 / .38);
13
+ --clado-ui-track: rgb(255 255 255 / .14);
14
+ --clado-ui-hover: rgb(255 255 255 / .26);
15
+ --clado-ui-hover-border: rgb(255 255 255 / .64);
16
+ --clado-ui-active: rgb(255 255 255 / .40);
17
+ --clado-ui-active-shadow: 0 2px 10px rgb(15 23 42 / .08), 0 .5px 1px rgb(15 23 42 / .05), inset 0 1px 0 rgb(255 255 255 / .92);
18
+ --clado-ui-popover: rgb(255 255 255 / .84);
19
+ --clado-ui-solid: #f8f9fc;
20
+ --clado-ui-edge: rgb(15 23 42 / .09);
21
+ --clado-ui-highlight: rgb(255 255 255 / .94);
22
+ --clado-ui-rim: rgb(255 255 255 / .46);
23
+ --clado-ui-shadow: 0 10px 30px rgb(15 23 42 / .10), 0 2px 6px rgb(15 23 42 / .05);
24
+ --clado-ui-glass-outline: rgb(255 255 255 / .78);
25
+ --clado-ui-glass-outer: rgb(15 23 42 / .08);
26
+ --clado-ui-glass-shadow: 0 18px 48px rgb(15 23 42 / .12), 0 3px 12px rgb(15 23 42 / .05), 0 0 0 .5px var(--clado-ui-glass-outer), inset 0 1px 0 var(--clado-ui-highlight), inset 0 0 20px rgb(255 255 255 / .18);
27
+ --clado-ui-control-blur: 18px;
17
28
  --clado-ui-panel-blur: 18px;
18
29
  --clado-ui-radius: 16px;
19
30
  --clado-ui-gap: 8px;
20
31
  }
21
32
  :root[data-theme="dark"] {
22
33
  color-scheme: dark;
23
- --clado-ui-text: #f3f3f3;
24
- --clado-ui-muted: #b4b4b4;
25
- --clado-ui-accent: #ededed;
26
- --clado-ui-surface: rgb(33 33 33 / .38);
27
- --clado-ui-panel-surface: rgb(30 30 30 / .68);
28
- --clado-ui-well: rgb(128 128 128 / .16);
29
- --clado-ui-solid: #292929;
30
- --clado-ui-edge: #ffffff2a;
31
- --clado-ui-active: #424242;
32
- --clado-ui-highlight: #ffffff23;
33
- --clado-ui-rim: #ffffff23;
34
- --clado-ui-shadow: 0 8px 26px #0005, 0 2px 6px #0003;
35
- --clado-ui-glass-outline: rgb(180 180 180 / .23);
36
- --clado-ui-glass-shadow: 0 6px 24px #0005;
37
- --clado-ui-control-blur: 14px;
38
- --clado-ui-panel-blur: 30px;
34
+ --clado-ui-text: #f3f6fb;
35
+ --clado-ui-muted: #a4aec2;
36
+ --clado-ui-subtle: #78839a;
37
+ --clado-ui-accent: #f3f6fb;
38
+ --clado-ui-brand: #60a5fa;
39
+ --clado-ui-brand-soft: rgb(96 165 250 / .16);
40
+ --clado-ui-surface: rgb(18 22 32 / .34);
41
+ --clado-ui-panel-surface: rgb(18 22 32 / .34);
42
+ --clado-ui-well: rgb(255 255 255 / .06);
43
+ --clado-ui-well-border: rgb(255 255 255 / .14);
44
+ --clado-ui-well-focus: rgb(255 255 255 / .11);
45
+ --clado-ui-track: rgb(255 255 255 / .05);
46
+ --clado-ui-hover: rgb(255 255 255 / .085);
47
+ --clado-ui-hover-border: rgb(255 255 255 / .15);
48
+ --clado-ui-active: rgb(255 255 255 / .14);
49
+ --clado-ui-active-shadow: 0 2px 10px rgb(0 0 0 / .28), inset 0 1px 0 rgb(255 255 255 / .24);
50
+ --clado-ui-popover: rgb(22 27 40 / .88);
51
+ --clado-ui-solid: #181c26;
52
+ --clado-ui-edge: rgb(255 255 255 / .10);
53
+ --clado-ui-highlight: rgb(255 255 255 / .24);
54
+ --clado-ui-rim: rgb(255 255 255 / .12);
55
+ --clado-ui-shadow: 0 12px 34px rgb(0 0 0 / .44), 0 2px 8px rgb(0 0 0 / .24);
56
+ --clado-ui-glass-outline: rgb(255 255 255 / .18);
57
+ --clado-ui-glass-outer: rgb(0 0 0 / .46);
58
+ --clado-ui-glass-shadow: 0 22px 56px rgb(0 0 0 / .56), 0 4px 14px rgb(0 0 0 / .30), 0 0 0 .5px var(--clado-ui-glass-outer), inset 0 1px 0 var(--clado-ui-highlight), inset 0 0 20px rgb(255 255 255 / .04);
59
+ --clado-ui-control-blur: 18px;
60
+ --clado-ui-panel-blur: 18px;
39
61
  }
40
62
  .clado-plugin-slot {
41
63
  position: fixed;
42
64
  display: flex;
43
65
  gap: var(--clado-ui-gap);
44
66
  z-index: 18;
45
- font: 13px/1.35 system-ui, sans-serif;
67
+ font: 13px/1.35 system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
46
68
  pointer-events: none;
47
69
  opacity: 1;
48
- transform: translateY(0);
70
+ transform: none;
49
71
  transition: opacity 160ms ease, transform 160ms ease;
50
72
  }
51
73
  .clado-plugin-slot.clado-slot-hidden {
@@ -59,10 +81,10 @@
59
81
  }
60
82
  .clado-plugin-slot[hidden], .clado-plugin-slot [hidden] { display: none !important; }
61
83
  .clado-plugin-slot > * { pointer-events: auto; }
62
- .clado-plugin-slot[data-slot="top-left"] { top: 14px; left: 16px; max-width: calc(100vw - 250px); flex-direction: column; align-items: start; }
63
- .clado-plugin-slot[data-slot="top-right"] { top: 14px; right: 16px; flex-direction: column; align-items: end; }
64
- .clado-plugin-slot[data-slot="bottom-left"] { bottom: 16px; left: 16px; align-items: end; }
65
- .clado-plugin-slot[data-slot="bottom-right"] { bottom: 16px; right: 16px; flex-direction: column-reverse; align-items: end; }
84
+ .clado-plugin-slot[data-slot="top-left"] { top: max(14px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); max-width: calc(100vw - 250px); flex-direction: column; align-items: start; }
85
+ .clado-plugin-slot[data-slot="top-right"] { top: max(14px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); flex-direction: column; align-items: end; }
86
+ .clado-plugin-slot[data-slot="bottom-left"] { bottom: max(16px, env(safe-area-inset-bottom)); left: max(16px, env(safe-area-inset-left)); align-items: end; }
87
+ .clado-plugin-slot[data-slot="bottom-right"] { bottom: max(16px, env(safe-area-inset-bottom)); right: max(16px, env(safe-area-inset-right)); flex-direction: column-reverse; align-items: end; }
66
88
  :where(.clado-ui-glass) {
67
89
  position: relative;
68
90
  z-index: 0;
@@ -70,7 +92,6 @@
70
92
  .clado-ui-glass {
71
93
  --clado-ui-glass-fill: var(--clado-ui-surface);
72
94
  --clado-ui-glass-blur: var(--clado-ui-control-blur);
73
- --clado-ui-glass-feather: 3px;
74
95
  color: var(--clado-ui-text);
75
96
  background: var(--clado-ui-solid);
76
97
  border: 1px solid var(--clado-ui-edge);
@@ -80,7 +101,7 @@
80
101
  .clado-ui-glass.clado-ui-glass-panel {
81
102
  --clado-ui-glass-fill: var(--clado-ui-panel-surface);
82
103
  --clado-ui-glass-blur: var(--clado-ui-panel-blur);
83
- --clado-ui-glass-feather: 5px;
104
+ border-radius: 20px;
84
105
  }
85
106
  .clado-ui-button {
86
107
  appearance: none;
@@ -94,37 +115,58 @@
94
115
  padding: 5px 10px;
95
116
  cursor: pointer;
96
117
  white-space: nowrap;
118
+ transition: background 150ms cubic-bezier(.22,.75,.24,1), border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 120ms ease;
119
+ }
120
+ .clado-ui-button:hover:where(:not(:disabled)) {
121
+ color: var(--clado-ui-text);
122
+ background: var(--clado-ui-hover);
123
+ border-color: var(--clado-ui-hover-border);
97
124
  }
98
- .clado-ui-button:where(:hover:not(:disabled), [aria-pressed="true"], [aria-expanded="true"], [aria-current="page"], .clado-ui-button-primary) {
99
- color: var(--clado-ui-accent);
125
+ .clado-ui-button:is([aria-pressed="true"], [aria-expanded="true"], [aria-current="page"]) {
126
+ color: var(--clado-ui-text);
100
127
  background: var(--clado-ui-active);
128
+ border-color: var(--clado-ui-glass-outline);
129
+ box-shadow: var(--clado-ui-active-shadow);
130
+ }
131
+ .clado-ui-button.clado-ui-button-primary {
132
+ background: var(--clado-ui-accent);
133
+ border-color: transparent;
134
+ color: var(--clado-ui-solid);
135
+ font-weight: 600;
136
+ box-shadow: 0 2px 10px rgb(15 23 42 / .14);
101
137
  }
102
- .clado-ui-button:focus-visible { outline: 2px solid var(--clado-ui-accent); outline-offset: 2px; }
103
- .clado-ui-button:disabled { opacity: .5; cursor: default; }
138
+ .clado-ui-button.clado-ui-button-primary:hover:where(:not(:disabled)) {
139
+ opacity: .9;
140
+ background: var(--clado-ui-accent);
141
+ color: var(--clado-ui-solid);
142
+ border-color: transparent;
143
+ }
144
+ .clado-ui-button:focus-visible { outline: 2px solid var(--clado-ui-brand); outline-offset: 2px; }
145
+ .clado-ui-button:disabled { opacity: .48; cursor: default; }
104
146
  .clado-ui-dialog {
105
- color-scheme: light;
106
- --clado-ui-text: #191919;
107
- --clado-ui-muted: #565656;
108
- --clado-ui-accent: #252525;
109
- --clado-ui-edge: #17171724;
110
- --clado-ui-active: #e9e9e9;
111
147
  --ink: var(--clado-ui-text);
112
148
  --muted: var(--clado-ui-muted);
113
- --line: #e3e3e3;
149
+ --line: var(--clado-ui-edge);
114
150
  color: var(--clado-ui-text);
115
- background: #fff;
116
- border: 1px solid #e3e3e3;
117
- border-radius: var(--clado-ui-radius);
118
- box-shadow: 0 10px 36px rgb(21 21 21 / .14);
151
+ background: var(--clado-ui-popover);
152
+ backdrop-filter: blur(24px) saturate(185%);
153
+ -webkit-backdrop-filter: blur(24px) saturate(185%);
154
+ border: 1px solid var(--clado-ui-glass-outline);
155
+ border-radius: 20px;
156
+ box-shadow: var(--clado-ui-glass-shadow);
157
+ }
158
+ .clado-ui-dialog::backdrop {
159
+ background: rgba(15, 23, 42, .14);
160
+ backdrop-filter: blur(3px);
161
+ }
162
+ [data-theme="dark"] .clado-ui-dialog::backdrop {
163
+ background: rgba(0, 0, 0, .40);
119
164
  }
120
- .clado-ui-dialog::backdrop { background: transparent; }
121
165
  .clado-ui-glass.clado-ui-button {
166
+ color: var(--clado-ui-text);
122
167
  background-color: var(--clado-ui-solid);
123
168
  border-color: var(--clado-ui-edge);
124
169
  }
125
- .clado-ui-glass.clado-ui-button:where(:hover:not(:disabled), [aria-expanded="true"], [aria-pressed="true"], [aria-current="page"], .clado-ui-button-primary) {
126
- background-color: var(--clado-ui-active);
127
- }
128
170
  @supports (backdrop-filter: blur(1px)) {
129
171
  @media (prefers-reduced-transparency: no-preference) {
130
172
  .clado-ui-glass {
@@ -140,49 +182,26 @@
140
182
  border-radius: inherit;
141
183
  pointer-events: none;
142
184
  background: var(--clado-ui-glass-fill);
143
- backdrop-filter: blur(var(--clado-ui-glass-blur)) saturate(145%);
144
- /* Retain enough blur at the edge to keep text behind the glass indistinct. */
145
- mask-image:
146
- linear-gradient(to right, rgb(0 0 0 / .95), #000 var(--clado-ui-glass-feather), #000 calc(100% - var(--clado-ui-glass-feather)), rgb(0 0 0 / .95)),
147
- linear-gradient(to bottom, rgb(0 0 0 / .95), #000 var(--clado-ui-glass-feather), #000 calc(100% - var(--clado-ui-glass-feather)), rgb(0 0 0 / .95));
148
- mask-composite: intersect;
149
- }
150
- .clado-ui-button, .clado-ui-glass.clado-ui-button {
151
- --clado-ui-button-tint: 4%;
152
- --clado-ui-button-outline: color-mix(in srgb, var(--clado-ui-edge) 36%, transparent);
153
- background: color-mix(in srgb, var(--clado-ui-accent) var(--clado-ui-button-tint), transparent) padding-box;
154
- border-color: var(--clado-ui-button-outline);
155
- }
156
- .clado-ui-button:hover:where(:not(:disabled)) {
157
- --clado-ui-button-tint: 8%;
158
- }
159
- .clado-ui-button:is([aria-expanded="true"], [aria-pressed="true"], [aria-current="page"], .clado-ui-button-primary) {
160
- --clado-ui-button-tint: 12%;
161
- --clado-ui-button-outline: color-mix(in srgb, var(--clado-ui-accent) 16%, transparent);
185
+ backdrop-filter: blur(var(--clado-ui-glass-blur)) saturate(205%);
186
+ -webkit-backdrop-filter: blur(var(--clado-ui-glass-blur)) saturate(205%);
162
187
  }
163
188
  .clado-ui-glass.clado-ui-button {
189
+ background: transparent;
164
190
  border-color: var(--clado-ui-glass-outline);
191
+ box-shadow: var(--clado-ui-glass-shadow);
165
192
  }
166
- @supports (mask-composite: exclude) {
167
- /* Keep the highlights on a thin rim so a white canvas does not become a white fill. */
168
- .clado-ui-glass::after {
169
- content: "";
170
- position: absolute;
171
- z-index: 1;
172
- inset: -1px;
173
- padding: 1px;
174
- border-radius: inherit;
175
- pointer-events: none;
176
- background: linear-gradient(146deg, var(--clado-ui-highlight), transparent 32% 58%, var(--clado-ui-rim));
177
- mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
178
- mask-composite: exclude;
179
- }
193
+ .clado-ui-glass.clado-ui-button:hover:where(:not(:disabled)),
194
+ .clado-ui-glass.clado-ui-button:is([aria-expanded="true"], [aria-pressed="true"], [aria-current="page"]) {
195
+ --clado-ui-glass-fill: var(--clado-ui-active);
196
+ background: transparent;
197
+ border-color: var(--clado-ui-glass-outline);
198
+ box-shadow: var(--clado-ui-glass-shadow);
180
199
  }
181
200
  }
182
201
  }
183
- @media (max-width: 460px) {
184
- .clado-plugin-slot[data-slot="top-left"] { top: 10px; left: 10px; max-width: calc(100vw - 207px); }
185
- .clado-plugin-slot[data-slot="top-right"] { top: 10px; right: 10px; }
186
- .clado-plugin-slot[data-slot="bottom-left"] { bottom: 10px; left: 10px; }
187
- .clado-plugin-slot[data-slot="bottom-right"] { bottom: 10px; right: 10px; }
202
+ @media (max-width: 680px) {
203
+ .clado-plugin-slot[data-slot="top-left"] { top: max(10px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); max-width: calc(100vw - 210px); }
204
+ .clado-plugin-slot[data-slot="top-right"] { top: max(10px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
205
+ .clado-plugin-slot[data-slot="bottom-left"] { bottom: max(12px, env(safe-area-inset-bottom)); left: max(12px, env(safe-area-inset-left)); }
206
+ .clado-plugin-slot[data-slot="bottom-right"] { bottom: max(12px, env(safe-area-inset-bottom)); right: max(12px, env(safe-area-inset-right)); }
188
207
  }