notra-editor 0.5.0 → 0.7.0
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/components/blockquote-button/blockquote-button.d.cts +2 -2
- package/dist/components/blockquote-button/blockquote-button.d.ts +2 -2
- package/dist/components/code-block-button/code-block-button.d.cts +2 -2
- package/dist/components/code-block-button/code-block-button.d.ts +2 -2
- package/dist/components/code-block-view/code-block-shell.cjs +41 -0
- package/dist/components/code-block-view/code-block-shell.cjs.map +1 -0
- package/dist/components/code-block-view/code-block-shell.d.cts +11 -0
- package/dist/components/code-block-view/code-block-shell.d.ts +11 -0
- package/dist/components/code-block-view/code-block-shell.mjs +17 -0
- package/dist/components/code-block-view/code-block-shell.mjs.map +1 -0
- package/dist/components/{code-block-view.cjs → code-block-view/code-block-view.cjs} +16 -8
- package/dist/components/code-block-view/code-block-view.cjs.map +1 -0
- package/dist/components/code-block-view/code-block-view.d.cts +6 -0
- package/dist/components/code-block-view/code-block-view.d.ts +6 -0
- package/dist/components/code-block-view/code-block-view.mjs +26 -0
- package/dist/components/code-block-view/code-block-view.mjs.map +1 -0
- package/dist/components/code-block-view/language-select.cjs +91 -0
- package/dist/components/code-block-view/language-select.cjs.map +1 -0
- package/dist/components/code-block-view/language-select.d.cts +11 -0
- package/dist/components/code-block-view/language-select.d.ts +11 -0
- package/dist/components/code-block-view/language-select.mjs +74 -0
- package/dist/components/code-block-view/language-select.mjs.map +1 -0
- package/dist/components/heading-dropdown-menu/heading-dropdown-menu.d.cts +2 -2
- package/dist/components/heading-dropdown-menu/heading-dropdown-menu.d.ts +2 -2
- package/dist/components/heading-dropdown-menu/heading-menu-item.d.cts +2 -2
- package/dist/components/heading-dropdown-menu/heading-menu-item.d.ts +2 -2
- package/dist/components/image-popover/image-popover.d.cts +2 -2
- package/dist/components/image-popover/image-popover.d.ts +2 -2
- package/dist/components/image-popover/use-image-popover.d.cts +3 -3
- package/dist/components/image-popover/use-image-popover.d.ts +3 -3
- package/dist/components/link-popover/link-popover.d.cts +2 -2
- package/dist/components/link-popover/link-popover.d.ts +2 -2
- package/dist/components/link-popover/use-link-popover.d.cts +2 -2
- package/dist/components/link-popover/use-link-popover.d.ts +2 -2
- package/dist/components/list-dropdown-menu/list-dropdown-menu.d.cts +2 -2
- package/dist/components/list-dropdown-menu/list-dropdown-menu.d.ts +2 -2
- package/dist/components/list-dropdown-menu/list-menu-item.d.cts +2 -2
- package/dist/components/list-dropdown-menu/list-menu-item.d.ts +2 -2
- package/dist/components/mark-button/mark-button.d.cts +2 -2
- package/dist/components/mark-button/mark-button.d.ts +2 -2
- package/dist/components/toolbar/toolbar.d.cts +2 -2
- package/dist/components/toolbar/toolbar.d.ts +2 -2
- package/dist/components/ui/button.d.cts +2 -2
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/command.cjs +207 -0
- package/dist/components/ui/command.cjs.map +1 -0
- package/dist/components/ui/command.d.cts +22 -0
- package/dist/components/ui/command.d.ts +22 -0
- package/dist/components/ui/command.mjs +181 -0
- package/dist/components/ui/command.mjs.map +1 -0
- package/dist/components/ui/dialog.cjs +188 -0
- package/dist/components/ui/dialog.cjs.map +1 -0
- package/dist/components/ui/dialog.d.cts +20 -0
- package/dist/components/ui/dialog.d.ts +20 -0
- package/dist/components/ui/dialog.mjs +155 -0
- package/dist/components/ui/dialog.mjs.map +1 -0
- package/dist/components/ui/dropdown-menu.cjs +3 -2
- package/dist/components/ui/dropdown-menu.cjs.map +1 -1
- package/dist/components/ui/dropdown-menu.d.cts +16 -16
- package/dist/components/ui/dropdown-menu.d.ts +16 -16
- package/dist/components/ui/dropdown-menu.mjs +3 -2
- package/dist/components/ui/dropdown-menu.mjs.map +1 -1
- package/dist/components/ui/input-group.cjs +175 -0
- package/dist/components/ui/input-group.cjs.map +1 -0
- package/dist/components/ui/input-group.d.cts +20 -0
- package/dist/components/ui/input-group.d.ts +20 -0
- package/dist/components/ui/input-group.mjs +146 -0
- package/dist/components/ui/input-group.mjs.map +1 -0
- package/dist/components/ui/input.cjs +1 -1
- package/dist/components/ui/input.cjs.map +1 -1
- package/dist/components/ui/input.d.cts +2 -2
- package/dist/components/ui/input.d.ts +2 -2
- package/dist/components/ui/input.mjs +1 -1
- package/dist/components/ui/input.mjs.map +1 -1
- package/dist/components/ui/popover.cjs +46 -6
- package/dist/components/ui/popover.cjs.map +1 -1
- package/dist/components/ui/popover.d.cts +9 -6
- package/dist/components/ui/popover.d.ts +9 -6
- package/dist/components/ui/popover.mjs +43 -6
- package/dist/components/ui/popover.mjs.map +1 -1
- package/dist/components/ui/separator.cjs +2 -1
- package/dist/components/ui/separator.cjs.map +1 -1
- package/dist/components/ui/separator.d.cts +2 -2
- package/dist/components/ui/separator.d.ts +2 -2
- package/dist/components/ui/separator.mjs +2 -1
- package/dist/components/ui/separator.mjs.map +1 -1
- package/dist/components/ui/textarea.cjs +43 -0
- package/dist/components/ui/textarea.cjs.map +1 -0
- package/dist/components/ui/textarea.d.cts +6 -0
- package/dist/components/ui/textarea.d.ts +6 -0
- package/dist/components/ui/textarea.mjs +19 -0
- package/dist/components/ui/textarea.mjs.map +1 -0
- package/dist/components/undo-redo-button/undo-redo-button.d.cts +2 -2
- package/dist/components/undo-redo-button/undo-redo-button.d.ts +2 -2
- package/dist/components/undo-redo-button/use-undo-redo.d.cts +2 -2
- package/dist/components/undo-redo-button/use-undo-redo.d.ts +2 -2
- package/dist/extensions/code-block.cjs +76 -19
- package/dist/extensions/code-block.cjs.map +1 -1
- package/dist/extensions/code-block.d.cts +7 -3
- package/dist/extensions/code-block.d.ts +7 -3
- package/dist/extensions/code-block.mjs +73 -8
- package/dist/extensions/code-block.mjs.map +1 -1
- package/dist/extensions/editor.d.cts +3 -3
- package/dist/extensions/editor.d.ts +3 -3
- package/dist/extensions/index.d.cts +1 -1
- package/dist/extensions/index.d.ts +1 -1
- package/dist/extensions/shared.cjs +5 -1
- package/dist/extensions/shared.cjs.map +1 -1
- package/dist/extensions/shared.d.cts +2 -1
- package/dist/extensions/shared.d.ts +2 -1
- package/dist/extensions/shared.mjs +5 -1
- package/dist/extensions/shared.mjs.map +1 -1
- package/dist/index.cjs +20 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +16 -1
- package/dist/index.mjs.map +1 -1
- package/dist/lib/highlight-code-to-html.cjs +38 -0
- package/dist/lib/highlight-code-to-html.cjs.map +1 -0
- package/dist/lib/highlight-code-to-html.d.cts +6 -0
- package/dist/lib/highlight-code-to-html.d.ts +6 -0
- package/dist/lib/highlight-code-to-html.mjs +14 -0
- package/dist/lib/highlight-code-to-html.mjs.map +1 -0
- package/dist/lib/languages.cjs +181 -0
- package/dist/lib/languages.cjs.map +1 -0
- package/dist/lib/languages.d.cts +24 -0
- package/dist/lib/languages.d.ts +24 -0
- package/dist/lib/languages.mjs +155 -0
- package/dist/lib/languages.mjs.map +1 -0
- package/dist/notra-reader.cjs +32 -3
- package/dist/notra-reader.cjs.map +1 -1
- package/dist/notra-reader.d.cts +11 -1
- package/dist/notra-reader.d.ts +11 -1
- package/dist/notra-reader.mjs +32 -3
- package/dist/notra-reader.mjs.map +1 -1
- package/dist/styles/globals.css +1022 -165
- package/dist/themes/default/editor.css +69 -0
- package/dist/themes/default/shared.css +165 -5
- package/package.json +7 -1
- package/dist/components/code-block-view.cjs.map +0 -1
- package/dist/components/code-block-view.d.cts +0 -12
- package/dist/components/code-block-view.d.ts +0 -12
- package/dist/components/code-block-view.mjs +0 -17
- package/dist/components/code-block-view.mjs.map +0 -1
- package/dist/icons/redo-icon.cjs +0 -54
- package/dist/icons/redo-icon.cjs.map +0 -1
- package/dist/icons/redo-icon.d.cts +0 -7
- package/dist/icons/redo-icon.d.ts +0 -7
- package/dist/icons/redo-icon.mjs +0 -30
- package/dist/icons/redo-icon.mjs.map +0 -1
- package/dist/icons/undo-icon.cjs +0 -54
- package/dist/icons/undo-icon.cjs.map +0 -1
- package/dist/icons/undo-icon.d.cts +0 -7
- package/dist/icons/undo-icon.d.ts +0 -7
- package/dist/icons/undo-icon.mjs +0 -30
- package/dist/icons/undo-icon.mjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
import { Editor } from '@tiptap/core';
|
|
3
3
|
|
|
4
4
|
interface BlockquoteButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
|
|
5
5
|
editor: Editor | null;
|
|
6
6
|
}
|
|
7
|
-
declare const BlockquoteButton:
|
|
7
|
+
declare const BlockquoteButton: React$1.ForwardRefExoticComponent<BlockquoteButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
8
8
|
|
|
9
9
|
export { BlockquoteButton, type BlockquoteButtonProps };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
import { Editor } from '@tiptap/core';
|
|
3
3
|
|
|
4
4
|
interface BlockquoteButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
|
|
5
5
|
editor: Editor | null;
|
|
6
6
|
}
|
|
7
|
-
declare const BlockquoteButton:
|
|
7
|
+
declare const BlockquoteButton: React$1.ForwardRefExoticComponent<BlockquoteButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
8
8
|
|
|
9
9
|
export { BlockquoteButton, type BlockquoteButtonProps };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
import { Editor } from '@tiptap/core';
|
|
3
3
|
|
|
4
4
|
interface CodeBlockButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
|
|
5
5
|
editor: Editor | null;
|
|
6
6
|
}
|
|
7
|
-
declare const CodeBlockButton:
|
|
7
|
+
declare const CodeBlockButton: React$1.ForwardRefExoticComponent<CodeBlockButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
8
8
|
|
|
9
9
|
export { CodeBlockButton, type CodeBlockButtonProps };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
import { Editor } from '@tiptap/core';
|
|
3
3
|
|
|
4
4
|
interface CodeBlockButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
|
|
5
5
|
editor: Editor | null;
|
|
6
6
|
}
|
|
7
|
-
declare const CodeBlockButton:
|
|
7
|
+
declare const CodeBlockButton: React$1.ForwardRefExoticComponent<CodeBlockButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
8
8
|
|
|
9
9
|
export { CodeBlockButton, type CodeBlockButtonProps };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var code_block_shell_exports = {};
|
|
20
|
+
__export(code_block_shell_exports, {
|
|
21
|
+
CodeBlockShell: () => CodeBlockShell
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(code_block_shell_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_copy_button = require("../copy-button");
|
|
26
|
+
const CodeBlockShell = ({
|
|
27
|
+
value,
|
|
28
|
+
languageSlot,
|
|
29
|
+
children
|
|
30
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "nt:relative", children: [
|
|
31
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "nt:absolute nt:inset-x-0 nt:top-0 nt:flex nt:h-9 nt:items-center nt:justify-between nt:px-2", children: [
|
|
32
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "nt:min-w-0 nt:flex-1", children: languageSlot }),
|
|
33
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_copy_button.CopyButton, { value })
|
|
34
|
+
] }),
|
|
35
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { className: "nt:!pt-9 hljs", children })
|
|
36
|
+
] });
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
CodeBlockShell
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=code-block-shell.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/code-block-view/code-block-shell.tsx"],"sourcesContent":["import { CopyButton } from '../copy-button';\n\nimport type { ReactNode } from 'react';\n\ninterface CodeBlockShellProps {\n\tvalue: string;\n\tlanguageSlot: ReactNode;\n\tchildren: ReactNode;\n}\n\n// Visual frame shared by the editor (NodeView) and reader (nodeMapping).\n// `languageSlot` lets each consumer plug its own widget into the top bar:\n// the editor passes <LanguageSelect>, the reader passes a static label.\n// `children` is the <code> element (NodeViewContent in the editor, a\n// dangerouslySetInnerHTML <code> in the reader).\nexport const CodeBlockShell = ({\n\tvalue,\n\tlanguageSlot,\n\tchildren\n}: CodeBlockShellProps) => (\n\t<div className=\"nt:relative\">\n\t\t<div className=\"nt:absolute nt:inset-x-0 nt:top-0 nt:flex nt:h-9 nt:items-center nt:justify-between nt:px-2\">\n\t\t\t<div className=\"nt:min-w-0 nt:flex-1\">{languageSlot}</div>\n\t\t\t<CopyButton value={value} />\n\t\t</div>\n\t\t<pre className=\"nt:!pt-9 hljs\">{children}</pre>\n\t</div>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBE;AArBF,yBAA2B;AAepB,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,MACC,6CAAC,SAAI,WAAU,eACd;AAAA,+CAAC,SAAI,WAAU,+FACd;AAAA,gDAAC,SAAI,WAAU,wBAAwB,wBAAa;AAAA,IACpD,4CAAC,iCAAW,OAAc;AAAA,KAC3B;AAAA,EACA,4CAAC,SAAI,WAAU,iBAAiB,UAAS;AAAA,GAC1C;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface CodeBlockShellProps {
|
|
5
|
+
value: string;
|
|
6
|
+
languageSlot: ReactNode;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const CodeBlockShell: ({ value, languageSlot, children }: CodeBlockShellProps) => react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { CodeBlockShell };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface CodeBlockShellProps {
|
|
5
|
+
value: string;
|
|
6
|
+
languageSlot: ReactNode;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const CodeBlockShell: ({ value, languageSlot, children }: CodeBlockShellProps) => react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { CodeBlockShell };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CopyButton } from "../copy-button";
|
|
3
|
+
const CodeBlockShell = ({
|
|
4
|
+
value,
|
|
5
|
+
languageSlot,
|
|
6
|
+
children
|
|
7
|
+
}) => /* @__PURE__ */ jsxs("div", { className: "nt:relative", children: [
|
|
8
|
+
/* @__PURE__ */ jsxs("div", { className: "nt:absolute nt:inset-x-0 nt:top-0 nt:flex nt:h-9 nt:items-center nt:justify-between nt:px-2", children: [
|
|
9
|
+
/* @__PURE__ */ jsx("div", { className: "nt:min-w-0 nt:flex-1", children: languageSlot }),
|
|
10
|
+
/* @__PURE__ */ jsx(CopyButton, { value })
|
|
11
|
+
] }),
|
|
12
|
+
/* @__PURE__ */ jsx("pre", { className: "nt:!pt-9 hljs", children })
|
|
13
|
+
] });
|
|
14
|
+
export {
|
|
15
|
+
CodeBlockShell
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=code-block-shell.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/code-block-view/code-block-shell.tsx"],"sourcesContent":["import { CopyButton } from '../copy-button';\n\nimport type { ReactNode } from 'react';\n\ninterface CodeBlockShellProps {\n\tvalue: string;\n\tlanguageSlot: ReactNode;\n\tchildren: ReactNode;\n}\n\n// Visual frame shared by the editor (NodeView) and reader (nodeMapping).\n// `languageSlot` lets each consumer plug its own widget into the top bar:\n// the editor passes <LanguageSelect>, the reader passes a static label.\n// `children` is the <code> element (NodeViewContent in the editor, a\n// dangerouslySetInnerHTML <code> in the reader).\nexport const CodeBlockShell = ({\n\tvalue,\n\tlanguageSlot,\n\tchildren\n}: CodeBlockShellProps) => (\n\t<div className=\"nt:relative\">\n\t\t<div className=\"nt:absolute nt:inset-x-0 nt:top-0 nt:flex nt:h-9 nt:items-center nt:justify-between nt:px-2\">\n\t\t\t<div className=\"nt:min-w-0 nt:flex-1\">{languageSlot}</div>\n\t\t\t<CopyButton value={value} />\n\t\t</div>\n\t\t<pre className=\"nt:!pt-9 hljs\">{children}</pre>\n\t</div>\n);\n"],"mappings":"AAqBE,SACC,KADD;AArBF,SAAS,kBAAkB;AAepB,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,MACC,qBAAC,SAAI,WAAU,eACd;AAAA,uBAAC,SAAI,WAAU,+FACd;AAAA,wBAAC,SAAI,WAAU,wBAAwB,wBAAa;AAAA,IACpD,oBAAC,cAAW,OAAc;AAAA,KAC3B;AAAA,EACA,oBAAC,SAAI,WAAU,iBAAiB,UAAS;AAAA,GAC1C;","names":[]}
|
|
@@ -19,21 +19,29 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
var code_block_view_exports = {};
|
|
21
21
|
__export(code_block_view_exports, {
|
|
22
|
-
CodeBlockShell: () => CodeBlockShell,
|
|
23
22
|
CodeBlockView: () => CodeBlockView
|
|
24
23
|
});
|
|
25
24
|
module.exports = __toCommonJS(code_block_view_exports);
|
|
26
25
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
26
|
var import_react = require("@tiptap/react");
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
var import_code_block_shell = require("./code-block-shell");
|
|
28
|
+
var import_language_select = require("./language-select");
|
|
29
|
+
const CodeBlockView = ({ node, updateAttributes }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
30
|
+
import_code_block_shell.CodeBlockShell,
|
|
31
|
+
{
|
|
32
|
+
languageSlot: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
33
|
+
import_language_select.LanguageSelect,
|
|
34
|
+
{
|
|
35
|
+
language: node.attrs.language ?? "",
|
|
36
|
+
onLanguageChange: (language) => updateAttributes({ language })
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
value: node.textContent,
|
|
40
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.NodeViewContent, { as: "code", className: "hljs" })
|
|
41
|
+
}
|
|
42
|
+
) });
|
|
34
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
35
44
|
0 && (module.exports = {
|
|
36
|
-
CodeBlockShell,
|
|
37
45
|
CodeBlockView
|
|
38
46
|
});
|
|
39
47
|
//# sourceMappingURL=code-block-view.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/code-block-view/code-block-view.tsx"],"sourcesContent":["'use client';\n\nimport {\n\tNodeViewContent,\n\tNodeViewWrapper,\n\ttype NodeViewProps\n} from '@tiptap/react';\n\nimport { CodeBlockShell } from './code-block-shell';\nimport { LanguageSelect } from './language-select';\n\n// Editor-side React NodeView. Tiptap mounts content-editable DOM directly\n// onto the <code> rendered by NodeViewContent. lowlight decorates that\n// content with <span class=\"hljs-*\"> spans on every transaction.\nexport const CodeBlockView = ({ node, updateAttributes }: NodeViewProps) => (\n\t<NodeViewWrapper>\n\t\t<CodeBlockShell\n\t\t\tlanguageSlot={\n\t\t\t\t<LanguageSelect\n\t\t\t\t\tlanguage={(node.attrs.language as string) ?? ''}\n\t\t\t\t\tonLanguageChange={(language) => updateAttributes({ language })}\n\t\t\t\t/>\n\t\t\t}\n\t\t\tvalue={node.textContent}\n\t\t>\n\t\t\t<NodeViewContent<'code'> as=\"code\" className=\"hljs\" />\n\t\t</CodeBlockShell>\n\t</NodeViewWrapper>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBI;AAhBJ,mBAIO;AAEP,8BAA+B;AAC/B,6BAA+B;AAKxB,MAAM,gBAAgB,CAAC,EAAE,MAAM,iBAAiB,MACtD,4CAAC,gCACA;AAAA,EAAC;AAAA;AAAA,IACA,cACC;AAAA,MAAC;AAAA;AAAA,QACA,UAAW,KAAK,MAAM,YAAuB;AAAA,QAC7C,kBAAkB,CAAC,aAAa,iBAAiB,EAAE,SAAS,CAAC;AAAA;AAAA,IAC9D;AAAA,IAED,OAAO,KAAK;AAAA,IAEZ,sDAAC,gCAAwB,IAAG,QAAO,WAAU,QAAO;AAAA;AACrD,GACD;","names":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
NodeViewContent,
|
|
5
|
+
NodeViewWrapper
|
|
6
|
+
} from "@tiptap/react";
|
|
7
|
+
import { CodeBlockShell } from "./code-block-shell";
|
|
8
|
+
import { LanguageSelect } from "./language-select";
|
|
9
|
+
const CodeBlockView = ({ node, updateAttributes }) => /* @__PURE__ */ jsx(NodeViewWrapper, { children: /* @__PURE__ */ jsx(
|
|
10
|
+
CodeBlockShell,
|
|
11
|
+
{
|
|
12
|
+
languageSlot: /* @__PURE__ */ jsx(
|
|
13
|
+
LanguageSelect,
|
|
14
|
+
{
|
|
15
|
+
language: node.attrs.language ?? "",
|
|
16
|
+
onLanguageChange: (language) => updateAttributes({ language })
|
|
17
|
+
}
|
|
18
|
+
),
|
|
19
|
+
value: node.textContent,
|
|
20
|
+
children: /* @__PURE__ */ jsx(NodeViewContent, { as: "code", className: "hljs" })
|
|
21
|
+
}
|
|
22
|
+
) });
|
|
23
|
+
export {
|
|
24
|
+
CodeBlockView
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=code-block-view.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/code-block-view/code-block-view.tsx"],"sourcesContent":["'use client';\n\nimport {\n\tNodeViewContent,\n\tNodeViewWrapper,\n\ttype NodeViewProps\n} from '@tiptap/react';\n\nimport { CodeBlockShell } from './code-block-shell';\nimport { LanguageSelect } from './language-select';\n\n// Editor-side React NodeView. Tiptap mounts content-editable DOM directly\n// onto the <code> rendered by NodeViewContent. lowlight decorates that\n// content with <span class=\"hljs-*\"> spans on every transaction.\nexport const CodeBlockView = ({ node, updateAttributes }: NodeViewProps) => (\n\t<NodeViewWrapper>\n\t\t<CodeBlockShell\n\t\t\tlanguageSlot={\n\t\t\t\t<LanguageSelect\n\t\t\t\t\tlanguage={(node.attrs.language as string) ?? ''}\n\t\t\t\t\tonLanguageChange={(language) => updateAttributes({ language })}\n\t\t\t\t/>\n\t\t\t}\n\t\t\tvalue={node.textContent}\n\t\t>\n\t\t\t<NodeViewContent<'code'> as=\"code\" className=\"hljs\" />\n\t\t</CodeBlockShell>\n\t</NodeViewWrapper>\n);\n"],"mappings":";AAkBI;AAhBJ;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AAEP,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAKxB,MAAM,gBAAgB,CAAC,EAAE,MAAM,iBAAiB,MACtD,oBAAC,mBACA;AAAA,EAAC;AAAA;AAAA,IACA,cACC;AAAA,MAAC;AAAA;AAAA,QACA,UAAW,KAAK,MAAM,YAAuB;AAAA,QAC7C,kBAAkB,CAAC,aAAa,iBAAiB,EAAE,SAAS,CAAC;AAAA;AAAA,IAC9D;AAAA,IAED,OAAO,KAAK;AAAA,IAEZ,8BAAC,mBAAwB,IAAG,QAAO,WAAU,QAAO;AAAA;AACrD,GACD;","names":[]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var language_select_exports = {};
|
|
21
|
+
__export(language_select_exports, {
|
|
22
|
+
LanguageSelect: () => LanguageSelect
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(language_select_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_lucide_react = require("lucide-react");
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_languages = require("../../lib/languages");
|
|
29
|
+
var import_utils = require("../../lib/utils");
|
|
30
|
+
var import_button = require("../ui/button");
|
|
31
|
+
var import_command = require("../ui/command");
|
|
32
|
+
var import_popover = require("../ui/popover");
|
|
33
|
+
const LanguageSelect = ({
|
|
34
|
+
language,
|
|
35
|
+
onLanguageChange
|
|
36
|
+
}) => {
|
|
37
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
38
|
+
const current = language || "auto";
|
|
39
|
+
const label = (0, import_languages.getLanguageLabel)(current);
|
|
40
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_popover.Popover, { open, onOpenChange: setOpen, children: [
|
|
41
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popover.PopoverTrigger, { asChild: true, onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
42
|
+
import_button.Button,
|
|
43
|
+
{
|
|
44
|
+
"aria-expanded": open,
|
|
45
|
+
className: "nt:h-7 nt:gap-1 nt:px-2 nt:text-xs",
|
|
46
|
+
size: "sm",
|
|
47
|
+
tabIndex: -1,
|
|
48
|
+
type: "button",
|
|
49
|
+
variant: "ghost",
|
|
50
|
+
children: [
|
|
51
|
+
label,
|
|
52
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronDownIcon, { className: "nt:size-3 nt:opacity-50" })
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
) }),
|
|
56
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popover.PopoverContent, { align: "start", className: "nt:w-[200px] nt:p-0", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_command.Command, { children: [
|
|
57
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandInput, { placeholder: "Search language..." }),
|
|
58
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_command.CommandList, { children: [
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandEmpty, { children: "No language found." }),
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandGroup, { children: import_languages.LANGUAGES.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
61
|
+
import_command.CommandItem,
|
|
62
|
+
{
|
|
63
|
+
value: item.value,
|
|
64
|
+
onSelect: (value) => {
|
|
65
|
+
onLanguageChange(value);
|
|
66
|
+
setOpen(false);
|
|
67
|
+
},
|
|
68
|
+
children: [
|
|
69
|
+
item.label,
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
|
+
import_lucide_react.CheckIcon,
|
|
72
|
+
{
|
|
73
|
+
className: (0, import_utils.cn)(
|
|
74
|
+
"nt:ml-auto nt:size-4",
|
|
75
|
+
current === item.value ? "nt:opacity-100" : "nt:opacity-0"
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
item.value
|
|
82
|
+
)) })
|
|
83
|
+
] })
|
|
84
|
+
] }) })
|
|
85
|
+
] });
|
|
86
|
+
};
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
LanguageSelect
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=language-select.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/code-block-view/language-select.tsx"],"sourcesContent":["'use client';\n\nimport { CheckIcon, ChevronDownIcon } from 'lucide-react';\nimport { useState } from 'react';\n\nimport { LANGUAGES, getLanguageLabel } from '../../lib/languages';\nimport { cn } from '../../lib/utils';\nimport { Button } from '../ui/button';\nimport {\n\tCommand,\n\tCommandEmpty,\n\tCommandGroup,\n\tCommandInput,\n\tCommandItem,\n\tCommandList\n} from '../ui/command';\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';\n\nexport interface LanguageSelectProps {\n\t/** Current language value (e.g. \"typescript\"); empty / \"auto\" → \"Auto\" label */\n\tlanguage: string;\n\t/** Called with the new value when the user picks a language */\n\tonLanguageChange: (language: string) => void;\n}\n\nexport const LanguageSelect = ({\n\tlanguage,\n\tonLanguageChange\n}: LanguageSelectProps) => {\n\tconst [open, setOpen] = useState(false);\n\tconst current = language || 'auto';\n\tconst label = getLanguageLabel(current);\n\n\treturn (\n\t\t<Popover open={open} onOpenChange={setOpen}>\n\t\t\t<PopoverTrigger asChild onClick={(e) => e.stopPropagation()}>\n\t\t\t\t<Button\n\t\t\t\t\taria-expanded={open}\n\t\t\t\t\tclassName=\"nt:h-7 nt:gap-1 nt:px-2 nt:text-xs\"\n\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t\t<ChevronDownIcon className=\"nt:size-3 nt:opacity-50\" />\n\t\t\t\t</Button>\n\t\t\t</PopoverTrigger>\n\t\t\t<PopoverContent align=\"start\" className=\"nt:w-[200px] nt:p-0\">\n\t\t\t\t<Command>\n\t\t\t\t\t<CommandInput placeholder=\"Search language...\" />\n\t\t\t\t\t<CommandList>\n\t\t\t\t\t\t<CommandEmpty>No language found.</CommandEmpty>\n\t\t\t\t\t\t<CommandGroup>\n\t\t\t\t\t\t\t{LANGUAGES.map((item) => (\n\t\t\t\t\t\t\t\t<CommandItem\n\t\t\t\t\t\t\t\t\tkey={item.value}\n\t\t\t\t\t\t\t\t\tvalue={item.value}\n\t\t\t\t\t\t\t\t\tonSelect={(value) => {\n\t\t\t\t\t\t\t\t\t\tonLanguageChange(value);\n\t\t\t\t\t\t\t\t\t\tsetOpen(false);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{item.label}\n\t\t\t\t\t\t\t\t\t<CheckIcon\n\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t'nt:ml-auto nt:size-4',\n\t\t\t\t\t\t\t\t\t\t\tcurrent === item.value ? 'nt:opacity-100' : 'nt:opacity-0'\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</CommandItem>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</CommandGroup>\n\t\t\t\t\t</CommandList>\n\t\t\t\t</Command>\n\t\t\t</PopoverContent>\n\t\t</Popover>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCI;AAlCJ,0BAA2C;AAC3C,mBAAyB;AAEzB,uBAA4C;AAC5C,mBAAmB;AACnB,oBAAuB;AACvB,qBAOO;AACP,qBAAwD;AASjD,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA;AACD,MAA2B;AAC1B,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAS,KAAK;AACtC,QAAM,UAAU,YAAY;AAC5B,QAAM,YAAQ,mCAAiB,OAAO;AAEtC,SACC,6CAAC,0BAAQ,MAAY,cAAc,SAClC;AAAA,gDAAC,iCAAe,SAAO,MAAC,SAAS,CAAC,MAAM,EAAE,gBAAgB,GACzD;AAAA,MAAC;AAAA;AAAA,QACA,iBAAe;AAAA,QACf,WAAU;AAAA,QACV,MAAK;AAAA,QACL,UAAU;AAAA,QACV,MAAK;AAAA,QACL,SAAQ;AAAA,QAEP;AAAA;AAAA,UACD,4CAAC,uCAAgB,WAAU,2BAA0B;AAAA;AAAA;AAAA,IACtD,GACD;AAAA,IACA,4CAAC,iCAAe,OAAM,SAAQ,WAAU,uBACvC,uDAAC,0BACA;AAAA,kDAAC,+BAAa,aAAY,sBAAqB;AAAA,MAC/C,6CAAC,8BACA;AAAA,oDAAC,+BAAa,gCAAkB;AAAA,QAChC,4CAAC,+BACC,qCAAU,IAAI,CAAC,SACf;AAAA,UAAC;AAAA;AAAA,YAEA,OAAO,KAAK;AAAA,YACZ,UAAU,CAAC,UAAU;AACpB,+BAAiB,KAAK;AACtB,sBAAQ,KAAK;AAAA,YACd;AAAA,YAEC;AAAA,mBAAK;AAAA,cACN;AAAA,gBAAC;AAAA;AAAA,kBACA,eAAW;AAAA,oBACV;AAAA,oBACA,YAAY,KAAK,QAAQ,mBAAmB;AAAA,kBAC7C;AAAA;AAAA,cACD;AAAA;AAAA;AAAA,UAbK,KAAK;AAAA,QAcX,CACA,GACF;AAAA,SACD;AAAA,OACD,GACD;AAAA,KACD;AAEF;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface LanguageSelectProps {
|
|
4
|
+
/** Current language value (e.g. "typescript"); empty / "auto" → "Auto" label */
|
|
5
|
+
language: string;
|
|
6
|
+
/** Called with the new value when the user picks a language */
|
|
7
|
+
onLanguageChange: (language: string) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const LanguageSelect: ({ language, onLanguageChange }: LanguageSelectProps) => react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { LanguageSelect, type LanguageSelectProps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface LanguageSelectProps {
|
|
4
|
+
/** Current language value (e.g. "typescript"); empty / "auto" → "Auto" label */
|
|
5
|
+
language: string;
|
|
6
|
+
/** Called with the new value when the user picks a language */
|
|
7
|
+
onLanguageChange: (language: string) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const LanguageSelect: ({ language, onLanguageChange }: LanguageSelectProps) => react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { LanguageSelect, type LanguageSelectProps };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CheckIcon, ChevronDownIcon } from "lucide-react";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { LANGUAGES, getLanguageLabel } from "../../lib/languages";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
import { Button } from "../ui/button";
|
|
8
|
+
import {
|
|
9
|
+
Command,
|
|
10
|
+
CommandEmpty,
|
|
11
|
+
CommandGroup,
|
|
12
|
+
CommandInput,
|
|
13
|
+
CommandItem,
|
|
14
|
+
CommandList
|
|
15
|
+
} from "../ui/command";
|
|
16
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
|
|
17
|
+
const LanguageSelect = ({
|
|
18
|
+
language,
|
|
19
|
+
onLanguageChange
|
|
20
|
+
}) => {
|
|
21
|
+
const [open, setOpen] = useState(false);
|
|
22
|
+
const current = language || "auto";
|
|
23
|
+
const label = getLanguageLabel(current);
|
|
24
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
25
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxs(
|
|
26
|
+
Button,
|
|
27
|
+
{
|
|
28
|
+
"aria-expanded": open,
|
|
29
|
+
className: "nt:h-7 nt:gap-1 nt:px-2 nt:text-xs",
|
|
30
|
+
size: "sm",
|
|
31
|
+
tabIndex: -1,
|
|
32
|
+
type: "button",
|
|
33
|
+
variant: "ghost",
|
|
34
|
+
children: [
|
|
35
|
+
label,
|
|
36
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, { className: "nt:size-3 nt:opacity-50" })
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
) }),
|
|
40
|
+
/* @__PURE__ */ jsx(PopoverContent, { align: "start", className: "nt:w-[200px] nt:p-0", children: /* @__PURE__ */ jsxs(Command, { children: [
|
|
41
|
+
/* @__PURE__ */ jsx(CommandInput, { placeholder: "Search language..." }),
|
|
42
|
+
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
43
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: "No language found." }),
|
|
44
|
+
/* @__PURE__ */ jsx(CommandGroup, { children: LANGUAGES.map((item) => /* @__PURE__ */ jsxs(
|
|
45
|
+
CommandItem,
|
|
46
|
+
{
|
|
47
|
+
value: item.value,
|
|
48
|
+
onSelect: (value) => {
|
|
49
|
+
onLanguageChange(value);
|
|
50
|
+
setOpen(false);
|
|
51
|
+
},
|
|
52
|
+
children: [
|
|
53
|
+
item.label,
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
CheckIcon,
|
|
56
|
+
{
|
|
57
|
+
className: cn(
|
|
58
|
+
"nt:ml-auto nt:size-4",
|
|
59
|
+
current === item.value ? "nt:opacity-100" : "nt:opacity-0"
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
item.value
|
|
66
|
+
)) })
|
|
67
|
+
] })
|
|
68
|
+
] }) })
|
|
69
|
+
] });
|
|
70
|
+
};
|
|
71
|
+
export {
|
|
72
|
+
LanguageSelect
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=language-select.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/code-block-view/language-select.tsx"],"sourcesContent":["'use client';\n\nimport { CheckIcon, ChevronDownIcon } from 'lucide-react';\nimport { useState } from 'react';\n\nimport { LANGUAGES, getLanguageLabel } from '../../lib/languages';\nimport { cn } from '../../lib/utils';\nimport { Button } from '../ui/button';\nimport {\n\tCommand,\n\tCommandEmpty,\n\tCommandGroup,\n\tCommandInput,\n\tCommandItem,\n\tCommandList\n} from '../ui/command';\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';\n\nexport interface LanguageSelectProps {\n\t/** Current language value (e.g. \"typescript\"); empty / \"auto\" → \"Auto\" label */\n\tlanguage: string;\n\t/** Called with the new value when the user picks a language */\n\tonLanguageChange: (language: string) => void;\n}\n\nexport const LanguageSelect = ({\n\tlanguage,\n\tonLanguageChange\n}: LanguageSelectProps) => {\n\tconst [open, setOpen] = useState(false);\n\tconst current = language || 'auto';\n\tconst label = getLanguageLabel(current);\n\n\treturn (\n\t\t<Popover open={open} onOpenChange={setOpen}>\n\t\t\t<PopoverTrigger asChild onClick={(e) => e.stopPropagation()}>\n\t\t\t\t<Button\n\t\t\t\t\taria-expanded={open}\n\t\t\t\t\tclassName=\"nt:h-7 nt:gap-1 nt:px-2 nt:text-xs\"\n\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t\t<ChevronDownIcon className=\"nt:size-3 nt:opacity-50\" />\n\t\t\t\t</Button>\n\t\t\t</PopoverTrigger>\n\t\t\t<PopoverContent align=\"start\" className=\"nt:w-[200px] nt:p-0\">\n\t\t\t\t<Command>\n\t\t\t\t\t<CommandInput placeholder=\"Search language...\" />\n\t\t\t\t\t<CommandList>\n\t\t\t\t\t\t<CommandEmpty>No language found.</CommandEmpty>\n\t\t\t\t\t\t<CommandGroup>\n\t\t\t\t\t\t\t{LANGUAGES.map((item) => (\n\t\t\t\t\t\t\t\t<CommandItem\n\t\t\t\t\t\t\t\t\tkey={item.value}\n\t\t\t\t\t\t\t\t\tvalue={item.value}\n\t\t\t\t\t\t\t\t\tonSelect={(value) => {\n\t\t\t\t\t\t\t\t\t\tonLanguageChange(value);\n\t\t\t\t\t\t\t\t\t\tsetOpen(false);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{item.label}\n\t\t\t\t\t\t\t\t\t<CheckIcon\n\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t'nt:ml-auto nt:size-4',\n\t\t\t\t\t\t\t\t\t\t\tcurrent === item.value ? 'nt:opacity-100' : 'nt:opacity-0'\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</CommandItem>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</CommandGroup>\n\t\t\t\t\t</CommandList>\n\t\t\t\t</Command>\n\t\t\t</PopoverContent>\n\t\t</Popover>\n\t);\n};\n"],"mappings":";AAoCI,SASC,KATD;AAlCJ,SAAS,WAAW,uBAAuB;AAC3C,SAAS,gBAAgB;AAEzB,SAAS,WAAW,wBAAwB;AAC5C,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,SAAS,gBAAgB,sBAAsB;AASjD,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA;AACD,MAA2B;AAC1B,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,QAAM,UAAU,YAAY;AAC5B,QAAM,QAAQ,iBAAiB,OAAO;AAEtC,SACC,qBAAC,WAAQ,MAAY,cAAc,SAClC;AAAA,wBAAC,kBAAe,SAAO,MAAC,SAAS,CAAC,MAAM,EAAE,gBAAgB,GACzD;AAAA,MAAC;AAAA;AAAA,QACA,iBAAe;AAAA,QACf,WAAU;AAAA,QACV,MAAK;AAAA,QACL,UAAU;AAAA,QACV,MAAK;AAAA,QACL,SAAQ;AAAA,QAEP;AAAA;AAAA,UACD,oBAAC,mBAAgB,WAAU,2BAA0B;AAAA;AAAA;AAAA,IACtD,GACD;AAAA,IACA,oBAAC,kBAAe,OAAM,SAAQ,WAAU,uBACvC,+BAAC,WACA;AAAA,0BAAC,gBAAa,aAAY,sBAAqB;AAAA,MAC/C,qBAAC,eACA;AAAA,4BAAC,gBAAa,gCAAkB;AAAA,QAChC,oBAAC,gBACC,oBAAU,IAAI,CAAC,SACf;AAAA,UAAC;AAAA;AAAA,YAEA,OAAO,KAAK;AAAA,YACZ,UAAU,CAAC,UAAU;AACpB,+BAAiB,KAAK;AACtB,sBAAQ,KAAK;AAAA,YACd;AAAA,YAEC;AAAA,mBAAK;AAAA,cACN;AAAA,gBAAC;AAAA;AAAA,kBACA,WAAW;AAAA,oBACV;AAAA,oBACA,YAAY,KAAK,QAAQ,mBAAmB;AAAA,kBAC7C;AAAA;AAAA,cACD;AAAA;AAAA;AAAA,UAbK,KAAK;AAAA,QAcX,CACA,GACF;AAAA,SACD;AAAA,OACD,GACD;AAAA,KACD;AAEF;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { ComponentProps } from 'react';
|
|
3
3
|
import { HeadingLevel } from './use-heading.cjs';
|
|
4
4
|
import { Button } from '../ui/button.cjs';
|
|
@@ -12,6 +12,6 @@ interface HeadingDropdownMenuProps extends Omit<ComponentProps<typeof Button>, '
|
|
|
12
12
|
editor: Editor | null;
|
|
13
13
|
levels?: HeadingLevel[];
|
|
14
14
|
}
|
|
15
|
-
declare const HeadingDropdownMenu:
|
|
15
|
+
declare const HeadingDropdownMenu: React.ForwardRefExoticComponent<Omit<HeadingDropdownMenuProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
16
16
|
|
|
17
17
|
export { HeadingDropdownMenu, type HeadingDropdownMenuProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { ComponentProps } from 'react';
|
|
3
3
|
import { HeadingLevel } from './use-heading.js';
|
|
4
4
|
import { Button } from '../ui/button.js';
|
|
@@ -12,6 +12,6 @@ interface HeadingDropdownMenuProps extends Omit<ComponentProps<typeof Button>, '
|
|
|
12
12
|
editor: Editor | null;
|
|
13
13
|
levels?: HeadingLevel[];
|
|
14
14
|
}
|
|
15
|
-
declare const HeadingDropdownMenu:
|
|
15
|
+
declare const HeadingDropdownMenu: React.ForwardRefExoticComponent<Omit<HeadingDropdownMenuProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
16
16
|
|
|
17
17
|
export { HeadingDropdownMenu, type HeadingDropdownMenuProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { HeadingLevel } from './use-heading.cjs';
|
|
3
3
|
import { Editor } from '@tiptap/core';
|
|
4
4
|
import 'lucide-react';
|
|
@@ -7,6 +7,6 @@ interface HeadingMenuItemProps {
|
|
|
7
7
|
editor: Editor | null;
|
|
8
8
|
level: HeadingLevel;
|
|
9
9
|
}
|
|
10
|
-
declare const HeadingMenuItem:
|
|
10
|
+
declare const HeadingMenuItem: React.ForwardRefExoticComponent<HeadingMenuItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
|
|
12
12
|
export { HeadingMenuItem, type HeadingMenuItemProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { HeadingLevel } from './use-heading.js';
|
|
3
3
|
import { Editor } from '@tiptap/core';
|
|
4
4
|
import 'lucide-react';
|
|
@@ -7,6 +7,6 @@ interface HeadingMenuItemProps {
|
|
|
7
7
|
editor: Editor | null;
|
|
8
8
|
level: HeadingLevel;
|
|
9
9
|
}
|
|
10
|
-
declare const HeadingMenuItem:
|
|
10
|
+
declare const HeadingMenuItem: React.ForwardRefExoticComponent<HeadingMenuItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
|
|
12
12
|
export { HeadingMenuItem, type HeadingMenuItemProps };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
import { Editor } from '@tiptap/core';
|
|
3
3
|
|
|
4
4
|
interface ImagePopoverProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
|
|
5
5
|
editor: Editor | null;
|
|
6
6
|
}
|
|
7
|
-
declare const ImagePopover:
|
|
7
|
+
declare const ImagePopover: React$1.ForwardRefExoticComponent<ImagePopoverProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
8
8
|
|
|
9
9
|
export { ImagePopover, type ImagePopoverProps };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
import { Editor } from '@tiptap/core';
|
|
3
3
|
|
|
4
4
|
interface ImagePopoverProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
|
|
5
5
|
editor: Editor | null;
|
|
6
6
|
}
|
|
7
|
-
declare const ImagePopover:
|
|
7
|
+
declare const ImagePopover: React$1.ForwardRefExoticComponent<ImagePopoverProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
8
8
|
|
|
9
9
|
export { ImagePopover, type ImagePopoverProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { Editor } from '@tiptap/core';
|
|
3
3
|
|
|
4
4
|
interface UseImagePopoverConfig {
|
|
@@ -6,9 +6,9 @@ interface UseImagePopoverConfig {
|
|
|
6
6
|
}
|
|
7
7
|
declare function useImagePopover({ editor }: UseImagePopoverConfig): {
|
|
8
8
|
url: string;
|
|
9
|
-
setUrl:
|
|
9
|
+
setUrl: React.Dispatch<React.SetStateAction<string>>;
|
|
10
10
|
alt: string;
|
|
11
|
-
setAlt:
|
|
11
|
+
setAlt: React.Dispatch<React.SetStateAction<string>>;
|
|
12
12
|
isActive: boolean;
|
|
13
13
|
canSet: boolean;
|
|
14
14
|
setImage: () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { Editor } from '@tiptap/core';
|
|
3
3
|
|
|
4
4
|
interface UseImagePopoverConfig {
|
|
@@ -6,9 +6,9 @@ interface UseImagePopoverConfig {
|
|
|
6
6
|
}
|
|
7
7
|
declare function useImagePopover({ editor }: UseImagePopoverConfig): {
|
|
8
8
|
url: string;
|
|
9
|
-
setUrl:
|
|
9
|
+
setUrl: React.Dispatch<React.SetStateAction<string>>;
|
|
10
10
|
alt: string;
|
|
11
|
-
setAlt:
|
|
11
|
+
setAlt: React.Dispatch<React.SetStateAction<string>>;
|
|
12
12
|
isActive: boolean;
|
|
13
13
|
canSet: boolean;
|
|
14
14
|
setImage: () => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
import { Editor } from '@tiptap/core';
|
|
3
3
|
|
|
4
4
|
interface LinkPopoverProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
|
|
5
5
|
editor: Editor | null;
|
|
6
6
|
}
|
|
7
|
-
declare const LinkPopover:
|
|
7
|
+
declare const LinkPopover: React$1.ForwardRefExoticComponent<LinkPopoverProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
8
8
|
|
|
9
9
|
export { LinkPopover, type LinkPopoverProps };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
import { Editor } from '@tiptap/core';
|
|
3
3
|
|
|
4
4
|
interface LinkPopoverProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
|
|
5
5
|
editor: Editor | null;
|
|
6
6
|
}
|
|
7
|
-
declare const LinkPopover:
|
|
7
|
+
declare const LinkPopover: React$1.ForwardRefExoticComponent<LinkPopoverProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
8
8
|
|
|
9
9
|
export { LinkPopover, type LinkPopoverProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { Editor } from '@tiptap/core';
|
|
3
3
|
|
|
4
4
|
interface UseLinkPopoverConfig {
|
|
@@ -6,7 +6,7 @@ interface UseLinkPopoverConfig {
|
|
|
6
6
|
}
|
|
7
7
|
declare function useLinkPopover({ editor }: UseLinkPopoverConfig): {
|
|
8
8
|
url: string;
|
|
9
|
-
setUrl:
|
|
9
|
+
setUrl: React.Dispatch<React.SetStateAction<string>>;
|
|
10
10
|
isActive: boolean;
|
|
11
11
|
canSet: boolean;
|
|
12
12
|
setLink: () => void;
|