@farming-labs/docs 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.
Files changed (2) hide show
  1. package/dist/index.d.mts +33 -1
  2. package/package.json +1 -1
package/dist/index.d.mts CHANGED
@@ -962,6 +962,20 @@ interface OrderingItem {
962
962
  /** Ordering for child pages within this folder */
963
963
  children?: OrderingItem[];
964
964
  }
965
+ /**
966
+ * Data passed to the `onCopyClick` callback when the user clicks the copy button
967
+ * on a code block in the docs.
968
+ */
969
+ interface CodeBlockCopyData {
970
+ /** Title of the code block (e.g. from the fenced code block meta string), if present */
971
+ title?: string;
972
+ /** Raw code content (the text that was copied to the clipboard) */
973
+ content: string;
974
+ /** Current page URL at the time of copy */
975
+ url: string;
976
+ /** Language / syntax hint (e.g. "tsx", "bash"), if present */
977
+ language?: string;
978
+ }
965
979
  interface DocsConfig {
966
980
  /** Entry folder for docs (e.g. "docs" → /docs) */
967
981
  entry: string;
@@ -1058,6 +1072,24 @@ interface DocsConfig {
1058
1072
  * ```
1059
1073
  */
1060
1074
  components?: Record<string, unknown>;
1075
+ /**
1076
+ * Callback fired when the user clicks the copy button on a code block.
1077
+ * Called in addition to the default copy-to-clipboard behavior.
1078
+ * Use it for analytics, logging, or custom behavior.
1079
+ *
1080
+ * @example
1081
+ * ```ts
1082
+ * export default defineDocs({
1083
+ * entry: "docs",
1084
+ * theme: fumadocs(),
1085
+ * onCopyClick(data) {
1086
+ * console.log("Code copied", data.title, data.language, data.url);
1087
+ * analytics.track("code_block_copy", { title: data.title, url: data.url });
1088
+ * },
1089
+ * });
1090
+ * ```
1091
+ */
1092
+ onCopyClick?: (data: CodeBlockCopyData) => void;
1061
1093
  /**
1062
1094
  * Icon registry for sidebar items.
1063
1095
  *
@@ -1282,4 +1314,4 @@ declare function resolveTitle(pageTitle: string, metadata?: DocsMetadata): strin
1282
1314
  */
1283
1315
  declare function resolveOGImage(page: PageFrontmatter, ogConfig?: OGConfig, baseUrl?: string): string | undefined;
1284
1316
  //#endregion
1285
- export { type AIConfig, type BreadcrumbConfig, type CopyMarkdownConfig, type DocsConfig, type DocsMetadata, type DocsNav, type DocsTheme, type FontStyle, type GithubConfig, type LastUpdatedConfig, type LlmsTxtConfig, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, type OrderingItem, type PageActionsConfig, type PageFrontmatter, type SidebarComponentProps, type SidebarConfig, type SidebarFolderNode, type SidebarNode, type SidebarPageNode, type SidebarTree, type ThemeToggleConfig, type TypographyConfig, type UIConfig, createTheme, deepMerge, defineDocs, extendTheme, resolveOGImage, resolveTitle };
1317
+ export { type AIConfig, type BreadcrumbConfig, type CodeBlockCopyData, type CopyMarkdownConfig, type DocsConfig, type DocsMetadata, type DocsNav, type DocsTheme, type FontStyle, type GithubConfig, type LastUpdatedConfig, type LlmsTxtConfig, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, type OrderingItem, type PageActionsConfig, type PageFrontmatter, type SidebarComponentProps, type SidebarConfig, type SidebarFolderNode, type SidebarNode, type SidebarPageNode, type SidebarTree, type ThemeToggleConfig, type TypographyConfig, type UIConfig, createTheme, deepMerge, defineDocs, extendTheme, resolveOGImage, resolveTitle };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/docs",
3
- "version": "0.0.9-beta.1",
3
+ "version": "0.0.10",
4
4
  "description": "Modern, flexible MDX-based docs framework — core types, config, and CLI",
5
5
  "keywords": [
6
6
  "docs",