mtxuilib 0.0.312 → 0.0.317
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/common/NotFoundGoBack.cjs +47 -0
- package/dist/components/common/react-markdown/Code.cjs +64 -0
- package/dist/components/common/react-markdown/MarkdownToolbar.cjs +43 -0
- package/dist/components/common/react-markdown/ReactMarkdownExample.cjs +65 -0
- package/dist/components/common/theme/mode-toggle.cjs +48 -0
- package/dist/components/common/theme/theme-toggle.cjs +48 -0
- package/dist/components/common/tiptap/MenuBar.cjs +189 -0
- package/dist/components/common/tiptap/TiptapEditor.cjs +99 -0
- package/dist/components/common/tiptap/examples/Demo-Default.cjs +249 -0
- package/dist/components/common/tiptap/examples/Demo-Tiptap.cjs +50 -0
- package/dist/esm/common/tailwind-indicator.js +1 -1
- package/dist/esm/components/common/NotFoundGoBack.d.ts +2 -0
- package/dist/esm/components/common/NotFoundGoBack.js +23 -0
- package/dist/esm/components/common/react-markdown/Code.d.ts +7 -0
- package/dist/esm/components/common/react-markdown/Code.js +40 -0
- package/dist/esm/components/common/react-markdown/MarkdownToolbar.d.ts +5 -0
- package/dist/esm/components/common/react-markdown/MarkdownToolbar.js +23 -0
- package/dist/esm/components/common/react-markdown/ReactMarkdownExample.d.ts +2 -0
- package/dist/esm/components/common/react-markdown/ReactMarkdownExample.js +31 -0
- package/dist/esm/components/common/theme/mode-toggle.d.ts +2 -0
- package/dist/esm/components/common/theme/mode-toggle.js +24 -0
- package/dist/esm/components/common/theme/theme-toggle.d.ts +2 -0
- package/dist/esm/components/common/theme/theme-toggle.js +24 -0
- package/dist/esm/components/common/tiptap/MenuBar.d.ts +2 -0
- package/dist/esm/components/common/tiptap/MenuBar.js +165 -0
- package/dist/esm/components/common/tiptap/TiptapEditor.d.ts +6 -0
- package/dist/esm/components/common/tiptap/TiptapEditor.js +65 -0
- package/dist/esm/components/common/tiptap/examples/Demo-Default.d.ts +2 -0
- package/dist/esm/components/common/tiptap/examples/Demo-Default.js +219 -0
- package/dist/esm/components/common/tiptap/examples/Demo-Tiptap.d.ts +2 -0
- package/dist/esm/components/common/tiptap/examples/Demo-Tiptap.js +16 -0
- package/dist/esm/index.d.ts +1 -2
- package/dist/esm/index.js +0 -2
- package/dist/esm/tailwind.d.cts +2 -91
- package/dist/index.cjs +0 -2
- package/dist/tailwind.cjs +6 -7
- package/dist/tsconfig.type.tsbuildinfo +1 -1
- package/package.json +10 -12
- package/dist/browser/index.min.js +0 -8
- package/dist/esm/ui/alert copy.d.ts +0 -9
- package/dist/esm/ui/alert copy.js +0 -85
- package/dist/esm/ui/form copy.d.ts +0 -24
- package/dist/esm/ui/form copy.js +0 -144
- package/dist/ui/alert copy.cjs +0 -119
- package/dist/ui/form copy.cjs +0 -179
|
@@ -0,0 +1,47 @@
|
|
|
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 NotFoundGoBack_exports = {};
|
|
21
|
+
__export(NotFoundGoBack_exports, {
|
|
22
|
+
NotFoundGoBack: () => NotFoundGoBack
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(NotFoundGoBack_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_navigation = require("next/navigation");
|
|
27
|
+
var import_button = require("../../ui/button");
|
|
28
|
+
const NotFoundGoBack = () => {
|
|
29
|
+
const router = (0, import_navigation.useRouter)();
|
|
30
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "container flex flex-col", children: [
|
|
31
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mx-auto p-8", children: "not found" }),
|
|
32
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
33
|
+
import_button.Button,
|
|
34
|
+
{
|
|
35
|
+
className: "mx-auto p-8",
|
|
36
|
+
onClick: () => {
|
|
37
|
+
router.back();
|
|
38
|
+
},
|
|
39
|
+
children: "Go back"
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
] });
|
|
43
|
+
};
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
NotFoundGoBack
|
|
47
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __objRest = (source, exclude) => {
|
|
9
|
+
var target = {};
|
|
10
|
+
for (var prop in source)
|
|
11
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
12
|
+
target[prop] = source[prop];
|
|
13
|
+
if (source != null && __getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
15
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
16
|
+
target[prop] = source[prop];
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __export = (target, all) => {
|
|
21
|
+
for (var name in all)
|
|
22
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
23
|
+
};
|
|
24
|
+
var __copyProps = (to, from, except, desc) => {
|
|
25
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
26
|
+
for (let key of __getOwnPropNames(from))
|
|
27
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
28
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
29
|
+
}
|
|
30
|
+
return to;
|
|
31
|
+
};
|
|
32
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
|
+
var Code_exports = {};
|
|
34
|
+
__export(Code_exports, {
|
|
35
|
+
CodeBlock: () => CodeBlock,
|
|
36
|
+
Pre: () => Pre
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(Code_exports);
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
var import_react_syntax_highlighter = require("react-syntax-highlighter");
|
|
41
|
+
var import_prism = require("react-syntax-highlighter/dist/cjs/styles/prism");
|
|
42
|
+
const CodeBlock = (_a) => {
|
|
43
|
+
var props = __objRest(_a, []);
|
|
44
|
+
var _a2;
|
|
45
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
46
|
+
import_react_syntax_highlighter.Prism,
|
|
47
|
+
{
|
|
48
|
+
language: (_a2 = props.className) == null ? void 0 : _a2.replace(/(?:lang(?:uage)?-)/, ""),
|
|
49
|
+
style: import_prism.materialOceanic,
|
|
50
|
+
wrapLines: true,
|
|
51
|
+
className: "not-prose rounded-md",
|
|
52
|
+
children: props.children
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
const Pre = (_b) => {
|
|
57
|
+
var props = __objRest(_b, []);
|
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "not-prose", children: props.children });
|
|
59
|
+
};
|
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
+
0 && (module.exports = {
|
|
62
|
+
CodeBlock,
|
|
63
|
+
Pre
|
|
64
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
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 MarkdownToolbar_exports = {};
|
|
20
|
+
__export(MarkdownToolbar_exports, {
|
|
21
|
+
default: () => MarkdownToolbar_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(MarkdownToolbar_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_button = require("../../../ui/button");
|
|
26
|
+
const MarkdownToolbar = ({ feedElement }) => {
|
|
27
|
+
const btns = [
|
|
28
|
+
{ name: "B", syntax: "**Bold**" },
|
|
29
|
+
{ name: "I", syntax: "*Italic*" },
|
|
30
|
+
{ name: "S", syntax: "~Strikethrough~" },
|
|
31
|
+
{ name: "H1", syntax: "# " }
|
|
32
|
+
];
|
|
33
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("header", { className: " flex gap-1 bg-[#253237]", children: btns.map((btn) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
34
|
+
import_button.Button,
|
|
35
|
+
{
|
|
36
|
+
className: "flex rounded-md",
|
|
37
|
+
onClick: () => feedElement(btn.syntax),
|
|
38
|
+
children: btn.name
|
|
39
|
+
},
|
|
40
|
+
btn.syntax
|
|
41
|
+
)) });
|
|
42
|
+
};
|
|
43
|
+
var MarkdownToolbar_default = MarkdownToolbar;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var ReactMarkdownExample_exports = {};
|
|
31
|
+
__export(ReactMarkdownExample_exports, {
|
|
32
|
+
ReactMarkdownExample: () => ReactMarkdownExample
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(ReactMarkdownExample_exports);
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react_markdown = __toESM(require("react-markdown"), 1);
|
|
37
|
+
var import_rehype_external_links = __toESM(require("rehype-external-links"), 1);
|
|
38
|
+
var import_rehype_sanitize = __toESM(require("rehype-sanitize"), 1);
|
|
39
|
+
var import_remark_gfm = __toESM(require("remark-gfm"), 1);
|
|
40
|
+
var import_Code = require("./Code");
|
|
41
|
+
const ReactMarkdownExample = () => {
|
|
42
|
+
const options = {
|
|
43
|
+
code: import_Code.CodeBlock,
|
|
44
|
+
pre: import_Code.Pre
|
|
45
|
+
};
|
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "bg-slate-500", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex h-screen justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("article", { className: "w-full pl-6 pt-5", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
47
|
+
import_react_markdown.default,
|
|
48
|
+
{
|
|
49
|
+
className: "prose prose-invert min-w-full",
|
|
50
|
+
remarkPlugins: [import_remark_gfm.default],
|
|
51
|
+
rehypePlugins: [
|
|
52
|
+
import_rehype_sanitize.default,
|
|
53
|
+
[
|
|
54
|
+
import_rehype_external_links.default,
|
|
55
|
+
{ content: { type: "text", value: "\u{1F517}" } }
|
|
56
|
+
]
|
|
57
|
+
],
|
|
58
|
+
components: options
|
|
59
|
+
}
|
|
60
|
+
) }) }) });
|
|
61
|
+
};
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
ReactMarkdownExample
|
|
65
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
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 mode_toggle_exports = {};
|
|
21
|
+
__export(mode_toggle_exports, {
|
|
22
|
+
ModeToggle: () => ModeToggle
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(mode_toggle_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_react_icons = require("@radix-ui/react-icons");
|
|
27
|
+
var import_next_themes = require("next-themes");
|
|
28
|
+
var import_button = require("../../../ui/button");
|
|
29
|
+
var import_dropdown_menu = require("../../../ui/dropdown-menu");
|
|
30
|
+
function ModeToggle() {
|
|
31
|
+
const { setTheme } = (0, import_next_themes.useTheme)();
|
|
32
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenu, { children: [
|
|
33
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_button.Button, { variant: "ghost", className: "w-9 px-0", children: [
|
|
34
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_icons.SunIcon, { className: "h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" }),
|
|
35
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_icons.MoonIcon, { className: "absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" }),
|
|
36
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Toggle theme" })
|
|
37
|
+
] }) }),
|
|
38
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenuContent, { align: "end", children: [
|
|
39
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuItem, { onClick: () => setTheme("light"), children: "Light" }),
|
|
40
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuItem, { onClick: () => setTheme("dark"), children: "Dark" }),
|
|
41
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuItem, { onClick: () => setTheme("system"), children: "System" })
|
|
42
|
+
] })
|
|
43
|
+
] });
|
|
44
|
+
}
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
ModeToggle
|
|
48
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
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 theme_toggle_exports = {};
|
|
21
|
+
__export(theme_toggle_exports, {
|
|
22
|
+
ThemeToggle: () => ThemeToggle
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(theme_toggle_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_lucide_react = require("lucide-react");
|
|
27
|
+
var import_next_themes = require("next-themes");
|
|
28
|
+
var import_button = require("../../../ui/button");
|
|
29
|
+
function ThemeToggle() {
|
|
30
|
+
const { setTheme, theme } = (0, import_next_themes.useTheme)();
|
|
31
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
32
|
+
import_button.Button,
|
|
33
|
+
{
|
|
34
|
+
variant: "ghost",
|
|
35
|
+
size: "icon",
|
|
36
|
+
onClick: () => setTheme(theme === "light" ? "dark" : "light"),
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Sun, { className: "h-6 w-[1.3rem] dark:hidden" }),
|
|
39
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Moon, { className: "hidden h-5 w-5 dark:block" }),
|
|
40
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Toggle theme" })
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
ThemeToggle
|
|
48
|
+
});
|
|
@@ -0,0 +1,189 @@
|
|
|
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 MenuBar_exports = {};
|
|
21
|
+
__export(MenuBar_exports, {
|
|
22
|
+
MenuBar: () => MenuBar
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(MenuBar_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_react = require("@tiptap/react");
|
|
27
|
+
const MenuBar = () => {
|
|
28
|
+
const { editor } = (0, import_react.useCurrentEditor)();
|
|
29
|
+
if (!editor) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bg-slate-100 p-1", children: [
|
|
33
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
34
|
+
"button",
|
|
35
|
+
{
|
|
36
|
+
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
37
|
+
disabled: !editor.can().chain().focus().toggleBold().run(),
|
|
38
|
+
className: editor.isActive("bold") ? "is-active" : "",
|
|
39
|
+
children: "bold"
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
43
|
+
"button",
|
|
44
|
+
{
|
|
45
|
+
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
46
|
+
disabled: !editor.can().chain().focus().toggleItalic().run(),
|
|
47
|
+
className: editor.isActive("italic") ? "is-active" : "",
|
|
48
|
+
children: "italic"
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
52
|
+
"button",
|
|
53
|
+
{
|
|
54
|
+
onClick: () => editor.chain().focus().toggleStrike().run(),
|
|
55
|
+
disabled: !editor.can().chain().focus().toggleStrike().run(),
|
|
56
|
+
className: editor.isActive("strike") ? "is-active" : "",
|
|
57
|
+
children: "strike"
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
61
|
+
"button",
|
|
62
|
+
{
|
|
63
|
+
onClick: () => editor.chain().focus().toggleCode().run(),
|
|
64
|
+
disabled: !editor.can().chain().focus().toggleCode().run(),
|
|
65
|
+
className: editor.isActive("code") ? "is-active" : "",
|
|
66
|
+
children: "code"
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick: () => editor.chain().focus().unsetAllMarks().run(), children: "clear marks" }),
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick: () => editor.chain().focus().clearNodes().run(), children: "clear nodes" }),
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
72
|
+
"button",
|
|
73
|
+
{
|
|
74
|
+
onClick: () => editor.chain().focus().setParagraph().run(),
|
|
75
|
+
className: editor.isActive("paragraph") ? "is-active" : "",
|
|
76
|
+
children: "paragraph"
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
|
+
"button",
|
|
81
|
+
{
|
|
82
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
83
|
+
className: editor.isActive("heading", { level: 1 }) ? "is-active" : "",
|
|
84
|
+
children: "h1"
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
88
|
+
"button",
|
|
89
|
+
{
|
|
90
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
91
|
+
className: editor.isActive("heading", { level: 2 }) ? "is-active" : "",
|
|
92
|
+
children: "h2"
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96
|
+
"button",
|
|
97
|
+
{
|
|
98
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
99
|
+
className: editor.isActive("heading", { level: 3 }) ? "is-active" : "",
|
|
100
|
+
children: "h3"
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
104
|
+
"button",
|
|
105
|
+
{
|
|
106
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 4 }).run(),
|
|
107
|
+
className: editor.isActive("heading", { level: 4 }) ? "is-active" : "",
|
|
108
|
+
children: "h4"
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
112
|
+
"button",
|
|
113
|
+
{
|
|
114
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 5 }).run(),
|
|
115
|
+
className: editor.isActive("heading", { level: 5 }) ? "is-active" : "",
|
|
116
|
+
children: "h5"
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
120
|
+
"button",
|
|
121
|
+
{
|
|
122
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 6 }).run(),
|
|
123
|
+
className: editor.isActive("heading", { level: 6 }) ? "is-active" : "",
|
|
124
|
+
children: "h6"
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
128
|
+
"button",
|
|
129
|
+
{
|
|
130
|
+
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
131
|
+
className: editor.isActive("bulletList") ? "is-active" : "",
|
|
132
|
+
children: "bullet list"
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
136
|
+
"button",
|
|
137
|
+
{
|
|
138
|
+
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
139
|
+
className: editor.isActive("orderedList") ? "is-active" : "",
|
|
140
|
+
children: "ordered list"
|
|
141
|
+
}
|
|
142
|
+
),
|
|
143
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
144
|
+
"button",
|
|
145
|
+
{
|
|
146
|
+
onClick: () => editor.chain().focus().toggleCodeBlock().run(),
|
|
147
|
+
className: editor.isActive("codeBlock") ? "is-active" : "",
|
|
148
|
+
children: "code block"
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
152
|
+
"button",
|
|
153
|
+
{
|
|
154
|
+
onClick: () => editor.chain().focus().toggleBlockquote().run(),
|
|
155
|
+
className: editor.isActive("blockquote") ? "is-active" : "",
|
|
156
|
+
children: "blockquote"
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick: () => editor.chain().focus().setHorizontalRule().run(), children: "horizontal rule" }),
|
|
160
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick: () => editor.chain().focus().setHardBreak().run(), children: "hard break" }),
|
|
161
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
162
|
+
"button",
|
|
163
|
+
{
|
|
164
|
+
onClick: () => editor.chain().focus().undo().run(),
|
|
165
|
+
disabled: !editor.can().chain().focus().undo().run(),
|
|
166
|
+
children: "undo"
|
|
167
|
+
}
|
|
168
|
+
),
|
|
169
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
170
|
+
"button",
|
|
171
|
+
{
|
|
172
|
+
onClick: () => editor.chain().focus().redo().run(),
|
|
173
|
+
disabled: !editor.can().chain().focus().redo().run(),
|
|
174
|
+
children: "redo"
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
178
|
+
"button",
|
|
179
|
+
{
|
|
180
|
+
className: editor.isActive("textStyle", { color: "#958DF1" }) ? "is-active" : "",
|
|
181
|
+
children: "purple"
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
] });
|
|
185
|
+
};
|
|
186
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
187
|
+
0 && (module.exports = {
|
|
188
|
+
MenuBar
|
|
189
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var TiptapEditor_exports = {};
|
|
31
|
+
__export(TiptapEditor_exports, {
|
|
32
|
+
TiptapEditorV1: () => TiptapEditorV1
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(TiptapEditor_exports);
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_extension_color = require("@tiptap/extension-color");
|
|
37
|
+
var import_extension_list_item = __toESM(require("@tiptap/extension-list-item"), 1);
|
|
38
|
+
var import_extension_text_style = __toESM(require("@tiptap/extension-text-style"), 1);
|
|
39
|
+
var import_react = require("@tiptap/react");
|
|
40
|
+
var import_starter_kit = __toESM(require("@tiptap/starter-kit"), 1);
|
|
41
|
+
var import_MenuBar = require("./MenuBar");
|
|
42
|
+
var import_utils = require("../../../lib/utils");
|
|
43
|
+
var import_Button = require("../../../ui/ui-mt/Button");
|
|
44
|
+
const SaveButton = (props) => {
|
|
45
|
+
const { onSave } = props;
|
|
46
|
+
const { editor } = (0, import_react.useCurrentEditor)();
|
|
47
|
+
if (!editor) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const handleSave = () => {
|
|
51
|
+
const html = editor == null ? void 0 : editor.getHTML();
|
|
52
|
+
console.log("html", html);
|
|
53
|
+
if (html) {
|
|
54
|
+
onSave && onSave(html);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.MtButton, { onClick: handleSave, children: "Save" }) }) });
|
|
58
|
+
};
|
|
59
|
+
const extensions = [
|
|
60
|
+
import_extension_color.Color.configure({ types: [import_extension_text_style.default.name, import_extension_list_item.default.name] }),
|
|
61
|
+
// TextStyle.configure({ types: [ListItem.name] }),
|
|
62
|
+
import_starter_kit.default.configure({
|
|
63
|
+
bulletList: {
|
|
64
|
+
keepMarks: true,
|
|
65
|
+
keepAttributes: false
|
|
66
|
+
// TODO : Making this as `false` becase marks are not preserved when I try to preserve attrs, awaiting a bit of help
|
|
67
|
+
},
|
|
68
|
+
orderedList: {
|
|
69
|
+
keepMarks: true,
|
|
70
|
+
keepAttributes: false
|
|
71
|
+
// TODO : Making this as `false` becase marks are not preserved when I try to preserve attrs, awaiting a bit of help
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
];
|
|
75
|
+
const TiptapEditorV1 = (props) => {
|
|
76
|
+
const { value, onUpdate } = props;
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
78
|
+
import_react.EditorProvider,
|
|
79
|
+
{
|
|
80
|
+
slotBefore: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_MenuBar.MenuBar, {}) }),
|
|
81
|
+
extensions,
|
|
82
|
+
content: value,
|
|
83
|
+
onUpdate,
|
|
84
|
+
editorProps: {
|
|
85
|
+
attributes: {
|
|
86
|
+
class: (0, import_utils.cn)(
|
|
87
|
+
"prose dark:prose-invert prose-sm sm:prose-base lg:prose-lg xl:prose-2xl focus:outline-none",
|
|
88
|
+
"mr-0 h-[700px] overflow-auto pr-0"
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {})
|
|
93
|
+
}
|
|
94
|
+
) });
|
|
95
|
+
};
|
|
96
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
+
0 && (module.exports = {
|
|
98
|
+
TiptapEditorV1
|
|
99
|
+
});
|