@instincthub/react-ui 0.1.52 → 0.1.54
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/dist/src/assets/css/forms/input-fields.css +2 -0
- package/dist/src/assets/css/forms/time-picker.css +0 -5
- package/dist/src/assets/css/ui/content-viewer.css +171 -1
- package/dist/src/assets/css/ui/dropdown-styles.css +2 -0
- package/dist/src/components/ui/viewer/ContentViewOrEdit.js +1 -1
- package/dist/src/components/ui/viewer/ContentViewer.js +1 -1
- package/dist/src/components/ui/viewer/codeCopyEnhancer.js +2 -0
- package/dist/src/components/ui/viewer/codeCopyEnhancer.js.map +1 -0
- package/dist/src/types/__examples__/.next/types/app/api/auth/[...nextauth]/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/auth/login/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/components/docs/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/components/recommend/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/components/search/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/fallback/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/generate/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/help/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/mcp/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/auth/layout.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/auth/login/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/auth/password-match/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/code-display/layout.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/code-display/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/auth/client-detector/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/auth/login-form/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/auth/signup-form/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/auth/username-email-checker/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/charts/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/action-dropdown/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/animated-box/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/checkboxes/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/chips-input/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/date-input/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/date-input-picker/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/date-range-picker/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/drop-file/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/email-list/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/file-uploader/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/filter-array/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/filter-objects/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/form-error/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/input-amount/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/input-number/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/input-text/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/input-textarea/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/message-display/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/multiple-email/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/password-field/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/radio-button/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/search-field/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/search-objects-from-db/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/searchable-dropdown/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/time-picker/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/toggle-button/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/uploads/ihub-file-uploader/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/navbars/breadcrumb/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/navbars/responsive-navbar/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/navbars/sidenav/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/navbars/tabs/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/actions/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/badges/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/card-grid/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/card-list/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/cards/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/color-picker/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/content-view-or-edit/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/content-viewer/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/create-button/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/dangerous-renderer/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/dialogs/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/dropdowns/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/ihub-text-editor/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/modals/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/or-divider/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/pagination/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/random-gradient-image/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/table-examples/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/table-server-examples/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/text-editor/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/cursors/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/examples/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/libs/examples/loadscript/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/libs/examples/modals/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/libs/examples/paystacks/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/libs/page.d.ts +13 -0
- package/dist/src/types/components/ui/viewer/ContentViewOrEdit.d.ts +23 -0
- package/dist/src/types/components/ui/viewer/ContentViewer.d.ts +8 -1
- package/dist/src/types/components/ui/viewer/codeCopyEnhancer.d.ts +58 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
package/dist/src/types/__examples__/.next/types/app/components/ui/random-gradient-image/page.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
package/dist/src/types/__examples__/.next/types/app/components/ui/table-server-examples/page.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -9,6 +9,29 @@ interface ContentViewOrEditProps {
|
|
|
9
9
|
lastUpdated?: string;
|
|
10
10
|
showEditBtn?: boolean;
|
|
11
11
|
showPreviewBtn?: boolean;
|
|
12
|
+
/** Show a copy button on fenced code blocks (default: true) */
|
|
13
|
+
enableCodeCopy?: boolean;
|
|
14
|
+
/** Allow inline `code` snippets to be copied on click (default: true) */
|
|
15
|
+
enableInlineCodeCopy?: boolean;
|
|
16
|
+
/** Draw a line-number gutter on multi-line code blocks (default: true) */
|
|
17
|
+
showCodeLineNumbers?: boolean;
|
|
12
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Toggles between an editable rich-text editor and a read-only ContentViewer.
|
|
21
|
+
*
|
|
22
|
+
* @component
|
|
23
|
+
* @example
|
|
24
|
+
* ```jsx
|
|
25
|
+
* import { ContentViewOrEdit } from "@instincthub/react-ui";
|
|
26
|
+
* <ContentViewOrEdit
|
|
27
|
+
* content={content}
|
|
28
|
+
* setContent={setContent}
|
|
29
|
+
* title="Lesson notes"
|
|
30
|
+
* showToolbar
|
|
31
|
+
* placeholder="Write something..."
|
|
32
|
+
* charLimit={5000}
|
|
33
|
+
* />
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
13
36
|
export default function ContentViewOrEdit(props: ContentViewOrEditProps): JSX.Element;
|
|
14
37
|
export {};
|
|
@@ -9,6 +9,9 @@ interface ContentViewerProps {
|
|
|
9
9
|
showToolbar?: boolean;
|
|
10
10
|
showEditBtn?: boolean;
|
|
11
11
|
isMarkdown?: boolean;
|
|
12
|
+
enableCodeCopy?: boolean;
|
|
13
|
+
enableInlineCodeCopy?: boolean;
|
|
14
|
+
showCodeLineNumbers?: boolean;
|
|
12
15
|
}
|
|
13
16
|
/**
|
|
14
17
|
*
|
|
@@ -28,6 +31,10 @@ interface ContentViewerProps {
|
|
|
28
31
|
* @param {boolean} showToolbar - Whether to show the toolbar
|
|
29
32
|
* @param {boolean} showEditBtn - Whether to show the edit button
|
|
30
33
|
* @param {boolean} isMarkdown - Whether the content is Markdown
|
|
34
|
+
* @param {boolean} enableCodeCopy - Whether code blocks get a copy button
|
|
35
|
+
* @param {boolean} enableInlineCodeCopy - Whether inline code can be clicked to copy
|
|
36
|
+
* @param {boolean} showCodeLineNumbers - Whether multi-line code blocks get a line-number gutter
|
|
31
37
|
*/
|
|
32
|
-
export default function ContentViewer({ content, title, className, editable, onContentChange, isEditing, setIsEditing, showToolbar, showEditBtn, isMarkdown,
|
|
38
|
+
export default function ContentViewer({ content, title, className, editable, onContentChange, isEditing, setIsEditing, showToolbar, showEditBtn, isMarkdown, // Default to false for backward compatibility
|
|
39
|
+
enableCodeCopy, enableInlineCodeCopy, showCodeLineNumbers, }: ContentViewerProps): import("react/jsx-runtime").JSX.Element;
|
|
33
40
|
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers that upgrade the plain `<pre>` / `<code>` markup rendered by
|
|
3
|
+
* ContentViewer into accessible, click-to-copy code blocks.
|
|
4
|
+
*
|
|
5
|
+
* The markup is injected with `dangerouslySetInnerHTML`, so the copy controls
|
|
6
|
+
* are built as real DOM nodes here and driven through event delegation on the
|
|
7
|
+
* viewer container instead of React event handlers.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CODE_COPY_ATTR = "data-ihub-copy";
|
|
10
|
+
export declare const CODE_BLOCK_WRAPPER_CLASS = "ihub-code-block-wrapper";
|
|
11
|
+
export declare const INLINE_COPIED_CLASS = "ihub-inline-copied";
|
|
12
|
+
export declare const COPIED_CLASS = "ihub-copied";
|
|
13
|
+
export declare const CODE_LINE_CLASS = "ihub-code-line";
|
|
14
|
+
export declare const LINE_NUMBERS_CLASS = "ihub-line-numbers";
|
|
15
|
+
/** Milliseconds the "Copied!" confirmation stays visible */
|
|
16
|
+
export declare const COPIED_FEEDBACK_MS = 2000;
|
|
17
|
+
export type CodeCopyKind = "block" | "inline";
|
|
18
|
+
export interface CodeCopyTarget {
|
|
19
|
+
/** Element that should receive the transient "copied" styling */
|
|
20
|
+
element: HTMLElement;
|
|
21
|
+
/** Text that should land on the clipboard */
|
|
22
|
+
text: string;
|
|
23
|
+
kind: CodeCopyKind;
|
|
24
|
+
}
|
|
25
|
+
interface EnhanceOptions {
|
|
26
|
+
/** Add a toolbar with a copy button above every fenced code block */
|
|
27
|
+
enableBlockCopy?: boolean;
|
|
28
|
+
/** Allow single-line `<code>` snippets to be copied on click */
|
|
29
|
+
enableInlineCopy?: boolean;
|
|
30
|
+
/** Draw a line-number gutter on code blocks with more than one line */
|
|
31
|
+
showLineNumbers?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Read the language of a code block from the `language-*` / `lang-*` class that
|
|
35
|
+
* marked (and most editors) attach to `<pre>` or its inner `<code>`.
|
|
36
|
+
*/
|
|
37
|
+
export declare const detectCodeLanguage: (pre: Element) => string;
|
|
38
|
+
/**
|
|
39
|
+
* Add copy affordances to every code block and inline snippet inside `root`.
|
|
40
|
+
* Safe to call repeatedly — already-enhanced nodes are skipped.
|
|
41
|
+
*/
|
|
42
|
+
export declare const enhanceCodeBlocks: (root: HTMLElement, { enableBlockCopy, enableInlineCopy, showLineNumbers, }?: EnhanceOptions) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Map a click/keyboard event target onto the code that should be copied.
|
|
45
|
+
* Returns null when the event did not originate from a copy affordance.
|
|
46
|
+
*/
|
|
47
|
+
export declare const resolveCodeCopyTarget: (eventTarget: EventTarget | null) => CodeCopyTarget | null;
|
|
48
|
+
/**
|
|
49
|
+
* Write text to the clipboard, falling back to a hidden textarea when the
|
|
50
|
+
* async Clipboard API is unavailable (insecure origins, older browsers).
|
|
51
|
+
*/
|
|
52
|
+
export declare const copyTextToClipboard: (text: string) => Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Flip a copy button (or inline snippet) into its confirmation state and
|
|
55
|
+
* restore it afterwards. Returns a cleanup timer id.
|
|
56
|
+
*/
|
|
57
|
+
export declare const showCopiedFeedback: (target: CodeCopyTarget) => ReturnType<typeof setTimeout>;
|
|
58
|
+
export {};
|