@farming-labs/astro-theme 0.0.9-beta.1 → 0.0.10

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": "@farming-labs/astro-theme",
3
- "version": "0.0.9-beta.1",
3
+ "version": "0.0.10",
4
4
  "description": "Astro UI components for @farming-labs/docs — layout, sidebar, TOC, search, and theme toggle",
5
5
  "keywords": [
6
6
  "astro",
@@ -79,8 +79,8 @@
79
79
  },
80
80
  "dependencies": {
81
81
  "sugar-high": "^0.9.5",
82
- "@farming-labs/astro": "0.0.9-beta.1",
83
- "@farming-labs/docs": "0.0.9-beta.1"
82
+ "@farming-labs/docs": "0.0.10",
83
+ "@farming-labs/astro": "0.0.10"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "astro": ">=4.0.0"
@@ -392,7 +392,16 @@ const parentUrl = segments.length >= 2
392
392
  const code = btn.getAttribute('data-code')
393
393
  ?.replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"');
394
394
  if (!code) return;
395
+ const block = btn.closest('.fd-codeblock');
396
+ const title = block?.querySelector('.fd-codeblock-title-text')?.textContent?.trim() ?? undefined;
397
+ const language = block?.getAttribute('data-language') ?? undefined;
398
+ const url = typeof window !== 'undefined' ? window.location.href : '';
399
+ const data = { title, content: code, url, language };
395
400
  navigator.clipboard.writeText(code).then(() => {
401
+ try {
402
+ if (typeof window !== 'undefined' && window.__fdOnCopyClick__) window.__fdOnCopyClick__(data);
403
+ if (typeof window !== 'undefined') window.dispatchEvent(new CustomEvent('fd:code-block-copy', { detail: data }));
404
+ } catch (_) {}
396
405
  btn.classList.add('fd-copy-btn-copied');
397
406
  btn.innerHTML = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>';
398
407
  setTimeout(() => {