notra-editor 0.5.0 → 0.6.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/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/ui/command.cjs +144 -0
- package/dist/components/ui/command.cjs.map +1 -0
- package/dist/components/ui/command.d.cts +12 -0
- package/dist/components/ui/command.d.ts +12 -0
- package/dist/components/ui/command.mjs +115 -0
- package/dist/components/ui/command.mjs.map +1 -0
- 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 +109 -0
- package/dist/themes/default/shared.css +132 -5
- package/package.json +5 -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
|
@@ -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":[]}
|
|
@@ -0,0 +1,144 @@
|
|
|
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 command_exports = {};
|
|
20
|
+
__export(command_exports, {
|
|
21
|
+
Command: () => Command,
|
|
22
|
+
CommandEmpty: () => CommandEmpty,
|
|
23
|
+
CommandGroup: () => CommandGroup,
|
|
24
|
+
CommandInput: () => CommandInput,
|
|
25
|
+
CommandItem: () => CommandItem,
|
|
26
|
+
CommandList: () => CommandList
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(command_exports);
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
var import_cmdk = require("cmdk");
|
|
31
|
+
var import_lucide_react = require("lucide-react");
|
|
32
|
+
var import_utils = require("../../lib/utils");
|
|
33
|
+
function Command({
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}) {
|
|
37
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
38
|
+
import_cmdk.Command,
|
|
39
|
+
{
|
|
40
|
+
className: (0, import_utils.cn)(
|
|
41
|
+
"nt:flex nt:h-full nt:w-full nt:flex-col nt:overflow-hidden nt:rounded-lg nt:bg-popover nt:text-popover-foreground",
|
|
42
|
+
className
|
|
43
|
+
),
|
|
44
|
+
"data-slot": "command",
|
|
45
|
+
...props
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
function CommandInput({
|
|
50
|
+
className,
|
|
51
|
+
...props
|
|
52
|
+
}) {
|
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: "nt:flex nt:items-center nt:gap-2 nt:border-b nt:border-foreground/10 nt:px-3",
|
|
57
|
+
"data-slot": "command-input-wrapper",
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.SearchIcon, { className: "nt:size-4 nt:shrink-0 nt:opacity-50" }),
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
61
|
+
import_cmdk.Command.Input,
|
|
62
|
+
{
|
|
63
|
+
className: (0, import_utils.cn)(
|
|
64
|
+
"nt:flex nt:h-9 nt:w-full nt:rounded-md nt:bg-transparent nt:py-3 nt:text-sm nt:outline-hidden nt:placeholder:text-muted-foreground nt:disabled:cursor-not-allowed nt:disabled:opacity-50",
|
|
65
|
+
className
|
|
66
|
+
),
|
|
67
|
+
"data-slot": "command-input",
|
|
68
|
+
...props
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
function CommandList({
|
|
76
|
+
className,
|
|
77
|
+
...props
|
|
78
|
+
}) {
|
|
79
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
|
+
import_cmdk.Command.List,
|
|
81
|
+
{
|
|
82
|
+
className: (0, import_utils.cn)(
|
|
83
|
+
"nt:max-h-[300px] nt:scroll-py-1 nt:overflow-x-hidden nt:overflow-y-auto",
|
|
84
|
+
className
|
|
85
|
+
),
|
|
86
|
+
"data-slot": "command-list",
|
|
87
|
+
...props
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
function CommandEmpty({
|
|
92
|
+
...props
|
|
93
|
+
}) {
|
|
94
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
95
|
+
import_cmdk.Command.Empty,
|
|
96
|
+
{
|
|
97
|
+
className: "nt:py-6 nt:text-center nt:text-sm",
|
|
98
|
+
"data-slot": "command-empty",
|
|
99
|
+
...props
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function CommandGroup({
|
|
104
|
+
className,
|
|
105
|
+
...props
|
|
106
|
+
}) {
|
|
107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
108
|
+
import_cmdk.Command.Group,
|
|
109
|
+
{
|
|
110
|
+
className: (0, import_utils.cn)(
|
|
111
|
+
"nt:overflow-hidden nt:p-1 nt:text-foreground nt:[&_[cmdk-group-heading]]:px-2 nt:[&_[cmdk-group-heading]]:py-1.5 nt:[&_[cmdk-group-heading]]:text-xs nt:[&_[cmdk-group-heading]]:font-medium nt:[&_[cmdk-group-heading]]:text-muted-foreground",
|
|
112
|
+
className
|
|
113
|
+
),
|
|
114
|
+
"data-slot": "command-group",
|
|
115
|
+
...props
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
function CommandItem({
|
|
120
|
+
className,
|
|
121
|
+
...props
|
|
122
|
+
}) {
|
|
123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
124
|
+
import_cmdk.Command.Item,
|
|
125
|
+
{
|
|
126
|
+
className: (0, import_utils.cn)(
|
|
127
|
+
"nt:relative nt:flex nt:cursor-default nt:items-center nt:gap-2 nt:rounded-md nt:px-2 nt:py-1.5 nt:text-sm nt:outline-hidden nt:select-none nt:data-[selected=true]:bg-accent nt:data-[selected=true]:text-accent-foreground nt:data-[disabled=true]:pointer-events-none nt:data-[disabled=true]:opacity-50",
|
|
128
|
+
className
|
|
129
|
+
),
|
|
130
|
+
"data-slot": "command-item",
|
|
131
|
+
...props
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
136
|
+
0 && (module.exports = {
|
|
137
|
+
Command,
|
|
138
|
+
CommandEmpty,
|
|
139
|
+
CommandGroup,
|
|
140
|
+
CommandInput,
|
|
141
|
+
CommandItem,
|
|
142
|
+
CommandList
|
|
143
|
+
});
|
|
144
|
+
//# sourceMappingURL=command.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/command.tsx"],"sourcesContent":["import { Command as CommandPrimitive } from 'cmdk';\nimport { SearchIcon } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\nfunction Command({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive>) {\n\treturn (\n\t\t<CommandPrimitive\n\t\t\tclassName={cn(\n\t\t\t\t'nt:flex nt:h-full nt:w-full nt:flex-col nt:overflow-hidden nt:rounded-lg nt:bg-popover nt:text-popover-foreground',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"command\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction CommandInput({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n\treturn (\n\t\t<div\n\t\t\tclassName=\"nt:flex nt:items-center nt:gap-2 nt:border-b nt:border-foreground/10 nt:px-3\"\n\t\t\tdata-slot=\"command-input-wrapper\"\n\t\t>\n\t\t\t<SearchIcon className=\"nt:size-4 nt:shrink-0 nt:opacity-50\" />\n\t\t\t<CommandPrimitive.Input\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'nt:flex nt:h-9 nt:w-full nt:rounded-md nt:bg-transparent nt:py-3 nt:text-sm nt:outline-hidden nt:placeholder:text-muted-foreground nt:disabled:cursor-not-allowed nt:disabled:opacity-50',\n\t\t\t\t\tclassName\n\t\t\t\t)}\n\t\t\t\tdata-slot=\"command-input\"\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction CommandList({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive.List>) {\n\treturn (\n\t\t<CommandPrimitive.List\n\t\t\tclassName={cn(\n\t\t\t\t'nt:max-h-[300px] nt:scroll-py-1 nt:overflow-x-hidden nt:overflow-y-auto',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"command-list\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction CommandEmpty({\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n\treturn (\n\t\t<CommandPrimitive.Empty\n\t\t\tclassName=\"nt:py-6 nt:text-center nt:text-sm\"\n\t\t\tdata-slot=\"command-empty\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction CommandGroup({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n\treturn (\n\t\t<CommandPrimitive.Group\n\t\t\tclassName={cn(\n\t\t\t\t'nt:overflow-hidden nt:p-1 nt:text-foreground nt:[&_[cmdk-group-heading]]:px-2 nt:[&_[cmdk-group-heading]]:py-1.5 nt:[&_[cmdk-group-heading]]:text-xs nt:[&_[cmdk-group-heading]]:font-medium nt:[&_[cmdk-group-heading]]:text-muted-foreground',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"command-group\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction CommandItem({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive.Item>) {\n\treturn (\n\t\t<CommandPrimitive.Item\n\t\t\tclassName={cn(\n\t\t\t\t'nt:relative nt:flex nt:cursor-default nt:items-center nt:gap-2 nt:rounded-md nt:px-2 nt:py-1.5 nt:text-sm nt:outline-hidden nt:select-none nt:data-[selected=true]:bg-accent nt:data-[selected=true]:text-accent-foreground nt:data-[disabled=true]:pointer-events-none nt:data-[disabled=true]:opacity-50',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"command-item\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tCommand,\n\tCommandEmpty,\n\tCommandGroup,\n\tCommandInput,\n\tCommandItem,\n\tCommandList\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWE;AAXF,kBAA4C;AAC5C,0BAA2B;AAG3B,mBAAmB;AAEnB,SAAS,QAAQ;AAAA,EAChB;AAAA,EACA,GAAG;AACJ,GAAkD;AACjD,SACC;AAAA,IAAC,YAAAA;AAAA,IAAA;AAAA,MACA,eAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;AAEA,SAAS,aAAa;AAAA,EACrB;AAAA,EACA,GAAG;AACJ,GAAwD;AACvD,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,aAAU;AAAA,MAEV;AAAA,oDAAC,kCAAW,WAAU,uCAAsC;AAAA,QAC5D;AAAA,UAAC,YAAAA,QAAiB;AAAA,UAAjB;AAAA,YACA,eAAW;AAAA,cACV;AAAA,cACA;AAAA,YACD;AAAA,YACA,aAAU;AAAA,YACT,GAAG;AAAA;AAAA,QACL;AAAA;AAAA;AAAA,EACD;AAEF;AAEA,SAAS,YAAY;AAAA,EACpB;AAAA,EACA,GAAG;AACJ,GAAuD;AACtD,SACC;AAAA,IAAC,YAAAA,QAAiB;AAAA,IAAjB;AAAA,MACA,eAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;AAEA,SAAS,aAAa;AAAA,EACrB,GAAG;AACJ,GAAwD;AACvD,SACC;AAAA,IAAC,YAAAA,QAAiB;AAAA,IAAjB;AAAA,MACA,WAAU;AAAA,MACV,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;AAEA,SAAS,aAAa;AAAA,EACrB;AAAA,EACA,GAAG;AACJ,GAAwD;AACvD,SACC;AAAA,IAAC,YAAAA,QAAiB;AAAA,IAAjB;AAAA,MACA,eAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;AAEA,SAAS,YAAY;AAAA,EACpB;AAAA,EACA,GAAG;AACJ,GAAuD;AACtD,SACC;AAAA,IAAC,YAAAA,QAAiB;AAAA,IAAjB;AAAA,MACA,eAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;","names":["CommandPrimitive"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Command as Command$1 } from 'cmdk';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
|
|
5
|
+
declare function Command({ className, ...props }: react.ComponentProps<typeof Command$1>): react_jsx_runtime.JSX.Element;
|
|
6
|
+
declare function CommandInput({ className, ...props }: react.ComponentProps<typeof Command$1.Input>): react_jsx_runtime.JSX.Element;
|
|
7
|
+
declare function CommandList({ className, ...props }: react.ComponentProps<typeof Command$1.List>): react_jsx_runtime.JSX.Element;
|
|
8
|
+
declare function CommandEmpty({ ...props }: react.ComponentProps<typeof Command$1.Empty>): react_jsx_runtime.JSX.Element;
|
|
9
|
+
declare function CommandGroup({ className, ...props }: react.ComponentProps<typeof Command$1.Group>): react_jsx_runtime.JSX.Element;
|
|
10
|
+
declare function CommandItem({ className, ...props }: react.ComponentProps<typeof Command$1.Item>): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Command as Command$1 } from 'cmdk';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
|
|
5
|
+
declare function Command({ className, ...props }: react.ComponentProps<typeof Command$1>): react_jsx_runtime.JSX.Element;
|
|
6
|
+
declare function CommandInput({ className, ...props }: react.ComponentProps<typeof Command$1.Input>): react_jsx_runtime.JSX.Element;
|
|
7
|
+
declare function CommandList({ className, ...props }: react.ComponentProps<typeof Command$1.List>): react_jsx_runtime.JSX.Element;
|
|
8
|
+
declare function CommandEmpty({ ...props }: react.ComponentProps<typeof Command$1.Empty>): react_jsx_runtime.JSX.Element;
|
|
9
|
+
declare function CommandGroup({ className, ...props }: react.ComponentProps<typeof Command$1.Group>): react_jsx_runtime.JSX.Element;
|
|
10
|
+
declare function CommandItem({ className, ...props }: react.ComponentProps<typeof Command$1.Item>): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList };
|