seemore 1.12.17 → 1.12.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seemore",
3
- "version": "1.12.17",
3
+ "version": "1.12.18",
4
4
  "description": "Let AI write the Markdown. Let seemore show it better — zero config documentation framework.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -58,8 +58,8 @@
58
58
  "@types/mdast": "^4.0.4",
59
59
  "@vitejs/plugin-react": "^6.1.1",
60
60
  "chokidar": "5.0.0",
61
- "fumadocs-core": "16.15.4",
62
- "fumadocs-ui": "16.15.4",
61
+ "fumadocs-core": "16.16.2",
62
+ "fumadocs-ui": "16.16.2",
63
63
  "gemoji": "8.1.0",
64
64
  "github-slugger": "^2.0.0",
65
65
  "gray-matter": "4.0.3",
@@ -309,16 +309,22 @@ const RUNTIME = `(function () {
309
309
  if (window.__seemoreRememberTheme) window.__seemoreRememberTheme();
310
310
  });
311
311
 
312
+ // A button's accessible name: fumadocs-ui 16.15 set aria-label, 16.16 a visually hidden span.
313
+ function labelOf(button) {
314
+ return (button.getAttribute('aria-label') || button.textContent || '').trim();
315
+ }
316
+
312
317
  document.querySelectorAll('figure').forEach(function (figure) {
313
- var button = figure.querySelector('button[aria-label]');
314
- if (!button || !/copy/i.test(button.getAttribute('aria-label') || '')) return;
318
+ var button = Array.prototype.find.call(figure.querySelectorAll('button'), function (b) { return /copy/i.test(labelOf(b)); });
319
+ if (!button) return;
315
320
  button.addEventListener('click', function () {
316
321
  var code = figure.querySelector('pre, code');
317
322
  if (code && navigator.clipboard) navigator.clipboard.writeText(code.textContent || '');
318
323
  });
319
324
  });
320
325
 
321
- document.querySelectorAll('button[aria-label="Copy Anchor Link"]').forEach(function (button) {
326
+ document.querySelectorAll('h1 button, h2 button, h3 button, h4 button, h5 button, h6 button').forEach(function (button) {
327
+ if (labelOf(button) !== 'Copy Anchor Link') return;
322
328
  var heading = button.closest('h1, h2, h3, h4, h5, h6');
323
329
  var svg = button.querySelector('svg');
324
330
  if (!heading || !heading.id || !navigator.clipboard) return;
@@ -62,6 +62,14 @@ async function renderDiagrams(): Promise<void> {
62
62
  }
63
63
  }
64
64
 
65
+ /**
66
+ * A button's accessible name: fumadocs-ui 16.15 set `aria-label`, 16.16 puts the text in a
67
+ * visually hidden span instead.
68
+ */
69
+ function labelOf(button: Element): string {
70
+ return (button.getAttribute('aria-label') ?? button.textContent ?? '').trim();
71
+ }
72
+
65
73
  function bindBehaviors(): void {
66
74
  const root = document.documentElement;
67
75
  document.querySelector('.seemore-export-theme-toggle')?.addEventListener('click', () => {
@@ -71,15 +79,17 @@ function bindBehaviors(): void {
71
79
  });
72
80
 
73
81
  for (const figure of document.querySelectorAll('figure')) {
74
- const button = figure.querySelector('button[aria-label]');
75
- if (button === null || !/copy/i.test(button.getAttribute('aria-label') ?? '')) continue;
82
+ const button = [...figure.querySelectorAll('button')].find((b) => /copy/i.test(labelOf(b)));
83
+ if (button === undefined) continue;
76
84
  button.addEventListener('click', () => {
77
85
  const code = figure.querySelector('pre, code');
78
86
  if (code !== null) void navigator.clipboard?.writeText(code.textContent ?? '');
79
87
  });
80
88
  }
81
89
 
82
- for (const button of document.querySelectorAll('button[aria-label="Copy Anchor Link"]')) {
90
+ for (const button of [...document.querySelectorAll('h1 button, h2 button, h3 button, h4 button, h5 button, h6 button')].filter(
91
+ (b) => labelOf(b) === 'Copy Anchor Link',
92
+ )) {
83
93
  const heading = button.closest('h1, h2, h3, h4, h5, h6');
84
94
  const svg = button.querySelector('svg');
85
95
  if (heading === null || heading.id === '' || navigator.clipboard === undefined) continue;