ritext 1.0.14 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +28 -28
  2. package/dist/chunk-CU67RXD7.mjs +53 -0
  3. package/dist/chunk-E4PPKAVK.mjs +37 -0
  4. package/dist/chunk-LO4RJXQF.mjs +37 -0
  5. package/dist/chunk-TQTCTY3E.mjs +52 -0
  6. package/dist/chunk-ZLCVIW2P.mjs +90 -0
  7. package/dist/extension/bold.d.mts +8 -0
  8. package/dist/extension/bold.d.ts +8 -0
  9. package/dist/extension/bold.js +260 -0
  10. package/dist/extension/bold.mjs +69 -0
  11. package/dist/extension/italic.d.mts +8 -0
  12. package/dist/extension/italic.d.ts +8 -0
  13. package/dist/extension/italic.js +264 -0
  14. package/dist/extension/italic.mjs +73 -0
  15. package/dist/extension/strike.d.mts +8 -0
  16. package/dist/extension/strike.d.ts +8 -0
  17. package/dist/extension/strike.js +264 -0
  18. package/dist/extension/strike.mjs +73 -0
  19. package/dist/extension/subandsuperscript.d.mts +21 -0
  20. package/dist/extension/subandsuperscript.d.ts +21 -0
  21. package/dist/extension/subandsuperscript.js +443 -0
  22. package/dist/extension/subandsuperscript.mjs +243 -0
  23. package/dist/extension/subscript.d.mts +8 -0
  24. package/dist/extension/subscript.d.ts +8 -0
  25. package/dist/extension/subscript.js +264 -0
  26. package/dist/extension/subscript.mjs +45 -0
  27. package/dist/extension/superscript.d.mts +8 -0
  28. package/dist/extension/superscript.d.ts +8 -0
  29. package/dist/extension/superscript.js +264 -0
  30. package/dist/extension/superscript.mjs +45 -0
  31. package/dist/extension/underline.d.mts +8 -0
  32. package/dist/extension/underline.d.ts +8 -0
  33. package/dist/extension/underline.js +263 -0
  34. package/dist/extension/underline.mjs +72 -0
  35. package/dist/index.css +101 -2
  36. package/dist/index.d.mts +6 -32
  37. package/dist/index.d.ts +6 -32
  38. package/dist/index.js +26 -537
  39. package/dist/index.mjs +30 -548
  40. package/dist/tiptap-ext.type-D61hoEX5.d.mts +32 -0
  41. package/dist/tiptap-ext.type-D61hoEX5.d.ts +32 -0
  42. package/package.json +29 -6
@@ -0,0 +1,243 @@
1
+ import {
2
+ SubIcon_default
3
+ } from "../chunk-LO4RJXQF.mjs";
4
+ import {
5
+ SupIcon_default
6
+ } from "../chunk-E4PPKAVK.mjs";
7
+ import {
8
+ Tooltip_default
9
+ } from "../chunk-ZLCVIW2P.mjs";
10
+ import {
11
+ __objRest,
12
+ __spreadProps,
13
+ __spreadValues,
14
+ useEditor
15
+ } from "../chunk-TQTCTY3E.mjs";
16
+
17
+ // src/extension/SubAndSuperscript.tsx
18
+ import { Extension } from "@tiptap/react";
19
+ import TiptapSubscript from "@tiptap/extension-subscript";
20
+ import TiptapSuperscript from "@tiptap/extension-superscript";
21
+
22
+ // src/lib/icon/SubAndSupIcon.tsx
23
+ import { jsx, jsxs } from "react/jsx-runtime";
24
+ var SubAndSupIcon = (_a) => {
25
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
26
+ return /* @__PURE__ */ jsxs(
27
+ "svg",
28
+ __spreadProps(__spreadValues({
29
+ xmlns: "http://www.w3.org/2000/svg",
30
+ viewBox: "0 0 24 24",
31
+ fill: "none",
32
+ stroke: "currentColor",
33
+ strokeWidth: 2,
34
+ strokeLinecap: "round",
35
+ strokeLinejoin: "round",
36
+ width: size,
37
+ height: size,
38
+ className
39
+ }, props), {
40
+ children: [
41
+ /* @__PURE__ */ jsx("path", { d: "M12 4v16" }),
42
+ /* @__PURE__ */ jsx("path", { d: "M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2" }),
43
+ /* @__PURE__ */ jsx("path", { d: "M9 20h6" })
44
+ ]
45
+ })
46
+ );
47
+ };
48
+ var SubAndSupIcon_default = SubAndSupIcon;
49
+
50
+ // src/lib/components/DropdownComponent.tsx
51
+ import { useState, Fragment, useId, Children, isValidElement, cloneElement } from "react";
52
+ import { twMerge } from "tailwind-merge";
53
+ import { useFloating, offset, flip, shift, autoUpdate, useInteractions, useClick, useDismiss, FloatingPortal } from "@floating-ui/react";
54
+
55
+ // src/lib/icon/ArrowIcon.tsx
56
+ import { jsx as jsx2 } from "react/jsx-runtime";
57
+ var ArrowIcon = (_a) => {
58
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
59
+ return /* @__PURE__ */ jsx2(
60
+ "svg",
61
+ __spreadProps(__spreadValues({
62
+ xmlns: "http://www.w3.org/2000/svg",
63
+ viewBox: "0 0 48 48",
64
+ fill: "none",
65
+ stroke: "currentColor",
66
+ strokeWidth: 2,
67
+ strokeLinecap: "round",
68
+ strokeLinejoin: "round",
69
+ width: size,
70
+ height: size,
71
+ className
72
+ }, props), {
73
+ children: /* @__PURE__ */ jsx2("path", { fill: "currentColor", stroke: "currentColor", strokeLinejoin: "round", strokeWidth: "4", d: "M36 19L24 31L12 19z" })
74
+ })
75
+ );
76
+ };
77
+ var ArrowIcon_default = ArrowIcon;
78
+
79
+ // src/lib/components/DropdownComponent.tsx
80
+ import { AnimatePresence, motion } from "motion/react";
81
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
82
+ var DropdownComponent = ({ children, className, showArrow = true, content, dropdownClassName, style, tooltip, tooltipClassName, tooltipPlacement, _tooltipContent, _internalContent, _dropdownClassName }) => {
83
+ const [open, setOpen] = useState(false);
84
+ const { x, y, refs, strategy, context } = useFloating({
85
+ open,
86
+ onOpenChange: setOpen,
87
+ placement: "bottom",
88
+ middleware: [offset(4), flip(), shift({ padding: 8 })],
89
+ whileElementsMounted: autoUpdate
90
+ });
91
+ const click = useClick(context);
92
+ const dismiss = useDismiss(context);
93
+ const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss]);
94
+ const listId = useId();
95
+ const tooltipContent = /* @__PURE__ */ jsx3("p", { children: typeof tooltip === "string" ? tooltip : _tooltipContent });
96
+ const initialMotion = { opacity: 0, scale: 0.95 };
97
+ const animateMotion = { opacity: 1, scale: 1 };
98
+ const enhancedChildren = Children.map(children, (child) => {
99
+ if (!isValidElement(child)) return child;
100
+ if (!("onSelect" in child.props)) return child;
101
+ const prevOnSelect = child.props.onSelect;
102
+ const combinedOnSelect = () => {
103
+ prevOnSelect == null ? void 0 : prevOnSelect();
104
+ setOpen(false);
105
+ };
106
+ return cloneElement(child, { onSelect: combinedOnSelect });
107
+ });
108
+ const btn = /* @__PURE__ */ jsxs2(
109
+ "button",
110
+ __spreadProps(__spreadValues({}, getReferenceProps({
111
+ ref: refs.setReference,
112
+ type: "button",
113
+ "aria-controls": open ? listId : void 0
114
+ })), {
115
+ className: twMerge(
116
+ "p-1.5 rounded-md hover:bg-gray-100 flex gap-x-px",
117
+ className
118
+ ),
119
+ style,
120
+ children: [
121
+ /* @__PURE__ */ jsx3("span", { children: content != null ? content : _internalContent }),
122
+ showArrow && /* @__PURE__ */ jsx3(ArrowIcon_default, { size: 14, className: "text-gray-500 block mt-0.5" })
123
+ ]
124
+ })
125
+ );
126
+ return /* @__PURE__ */ jsxs2(Fragment, { children: [
127
+ tooltip === false ? btn : /* @__PURE__ */ jsx3(
128
+ Tooltip_default,
129
+ {
130
+ content: tooltipContent,
131
+ className: tooltipClassName,
132
+ placement: tooltipPlacement,
133
+ children: btn
134
+ }
135
+ ),
136
+ /* @__PURE__ */ jsx3(FloatingPortal, { children: /* @__PURE__ */ jsx3(AnimatePresence, { children: open && /* @__PURE__ */ jsx3(
137
+ motion.div,
138
+ __spreadProps(__spreadValues({}, getFloatingProps({
139
+ ref: refs.setFloating,
140
+ style: {
141
+ position: strategy,
142
+ top: y != null ? y : 0,
143
+ left: x != null ? x : 0
144
+ },
145
+ role: "listbox",
146
+ id: listId
147
+ })), {
148
+ initial: initialMotion,
149
+ animate: animateMotion,
150
+ exit: initialMotion,
151
+ className: twMerge("bg-white border border-solid border-gray-200 p-2 space-y-1 rounded-lg shadow-sm shadow-gray-200/40", _dropdownClassName, dropdownClassName),
152
+ children: enhancedChildren
153
+ })
154
+ ) }) })
155
+ ] });
156
+ };
157
+ var DropdownComponent_default = DropdownComponent;
158
+
159
+ // src/lib/components/DropdownItemComponent.tsx
160
+ import { twMerge as twMerge2 } from "tailwind-merge";
161
+ import { useEditorState } from "@tiptap/react";
162
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
163
+ var DropdownItemComponent = ({ item, onSelect, activeClassName, itemClassName, _itemClassName }) => {
164
+ const { editor } = useEditor();
165
+ const editorState = useEditorState({
166
+ editor,
167
+ selector: ({ editor: editor2 }) => ({ isActive: (editor2 == null ? void 0 : editor2.isActive(item.id)) || false })
168
+ });
169
+ return /* @__PURE__ */ jsxs3("div", { className: twMerge2(
170
+ "flex items-center gap-x-2.5 transition-all duration-100 cursor-pointer select-none px-2 py-1.5 rounded-md",
171
+ _itemClassName,
172
+ (editorState == null ? void 0 : editorState.isActive) ? "bg-gray-200/60" : "hover:bg-gray-100",
173
+ itemClassName,
174
+ (editorState == null ? void 0 : editorState.isActive) ? activeClassName : "hover:bg-gray-100"
175
+ ), onClick: onSelect, children: [
176
+ item.icon,
177
+ /* @__PURE__ */ jsx4("span", { className: "flex-1", children: item.text }),
178
+ /* @__PURE__ */ jsx4("span", { className: "ml-6 text-gray-400", children: item.keyBind })
179
+ ] });
180
+ };
181
+ var DropdownItemComponent_default = DropdownItemComponent;
182
+
183
+ // src/extension/SubAndSuperscript.tsx
184
+ import { jsx as jsx5 } from "react/jsx-runtime";
185
+ var SubAndSuperscript = Extension.create({
186
+ name: "subAndSuperScript",
187
+ addOptions() {
188
+ var _a;
189
+ return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
190
+ component: ({ options, editor, dropdownContainerClassName, dropdownItemClassName }) => {
191
+ const list = [{
192
+ icon: /* @__PURE__ */ jsx5(SubIcon_default, {}),
193
+ text: "Subscript",
194
+ onClick: () => editor.chain().focus().toggleSubscript().run(),
195
+ keyBind: "\u2318 .",
196
+ id: "subscript"
197
+ }, {
198
+ icon: /* @__PURE__ */ jsx5(SupIcon_default, {}),
199
+ text: "Superscript",
200
+ onClick: () => editor.chain().focus().toggleSuperscript().run(),
201
+ keyBind: "\u2318 ,",
202
+ id: "superscript"
203
+ }];
204
+ return /* @__PURE__ */ jsx5(
205
+ DropdownComponent_default,
206
+ {
207
+ className: options.className,
208
+ showArrow: options.showArrow,
209
+ content: options.content,
210
+ dropdownClassName: options.dropdownClassName,
211
+ style: options.style,
212
+ tooltip: options.tooltip,
213
+ tooltipClassName: options.tooltipClassName,
214
+ tooltipPlacement: options.tooltipPlacement,
215
+ _tooltipContent: "More text styles",
216
+ _internalContent: /* @__PURE__ */ jsx5(SubAndSupIcon_default, {}),
217
+ _dropdownClassName: dropdownContainerClassName,
218
+ children: list.map((item) => /* @__PURE__ */ jsx5(
219
+ DropdownItemComponent_default,
220
+ {
221
+ onSelect: item.onClick,
222
+ item,
223
+ activeClassName: options.activeClassName || "",
224
+ itemClassName: options.itemClassName || "",
225
+ _itemClassName: dropdownItemClassName
226
+ },
227
+ item.id
228
+ ))
229
+ }
230
+ );
231
+ }
232
+ });
233
+ },
234
+ addExtensions() {
235
+ const extensions = [];
236
+ if (this.options.subscript !== false) extensions.push(TiptapSubscript);
237
+ if (this.options.superscript !== false) extensions.push(TiptapSuperscript);
238
+ return extensions;
239
+ }
240
+ });
241
+ export {
242
+ SubAndSuperscript
243
+ };
@@ -0,0 +1,8 @@
1
+ import { Mark } from '@tiptap/react';
2
+ import { E as ExtButtonOptions } from '../tiptap-ext.type-D61hoEX5.mjs';
3
+ import 'react';
4
+ import '@floating-ui/react';
5
+
6
+ declare const Subscript: Mark<ExtButtonOptions>;
7
+
8
+ export { Subscript };
@@ -0,0 +1,8 @@
1
+ import { Mark } from '@tiptap/react';
2
+ import { E as ExtButtonOptions } from '../tiptap-ext.type-D61hoEX5.js';
3
+ import 'react';
4
+ import '@floating-ui/react';
5
+
6
+ declare const Subscript: Mark<ExtButtonOptions>;
7
+
8
+ export { Subscript };
@@ -0,0 +1,264 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, { get: all[name], enumerable: true });
40
+ };
41
+ var __copyProps = (to, from, except, desc) => {
42
+ if (from && typeof from === "object" || typeof from === "function") {
43
+ for (let key of __getOwnPropNames(from))
44
+ if (!__hasOwnProp.call(to, key) && key !== except)
45
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
+ }
47
+ return to;
48
+ };
49
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
50
+ // If the importer is in node compatibility mode or this is not an ESM
51
+ // file that has been converted to a CommonJS file using a Babel-
52
+ // compatible transform (i.e. "__esModule" has not been set), then set
53
+ // "default" to the CommonJS "module.exports" for node compatibility.
54
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
55
+ mod
56
+ ));
57
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
58
+
59
+ // src/extension/Subscript.tsx
60
+ var Subscript_exports = {};
61
+ __export(Subscript_exports, {
62
+ Subscript: () => Subscript
63
+ });
64
+ module.exports = __toCommonJS(Subscript_exports);
65
+ var import_extension_subscript = __toESM(require("@tiptap/extension-subscript"));
66
+
67
+ // src/lib/icon/SubIcon.tsx
68
+ var import_jsx_runtime = require("react/jsx-runtime");
69
+ var SubIcon = (_a) => {
70
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
71
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
72
+ "svg",
73
+ __spreadProps(__spreadValues({
74
+ xmlns: "http://www.w3.org/2000/svg",
75
+ viewBox: "0 0 24 24",
76
+ fill: "none",
77
+ stroke: "currentColor",
78
+ strokeWidth: 2,
79
+ strokeLinecap: "round",
80
+ strokeLinejoin: "round",
81
+ width: size,
82
+ height: size,
83
+ className
84
+ }, props), {
85
+ children: [
86
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m4 5 8 8" }),
87
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m12 5-8 8" }),
88
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07" })
89
+ ]
90
+ })
91
+ );
92
+ };
93
+ var SubIcon_default = SubIcon;
94
+
95
+ // src/lib/components/ButtonComponent.tsx
96
+ var import_tailwind_merge2 = require("tailwind-merge");
97
+
98
+ // src/lib/components/_com/Tooltip.tsx
99
+ var import_react = require("react");
100
+ var import_react2 = require("@floating-ui/react");
101
+ var import_react3 = require("motion/react");
102
+ var import_tailwind_merge = require("tailwind-merge");
103
+ var import_jsx_runtime2 = require("react/jsx-runtime");
104
+ var Tooltip = ({ placement = "top", children, content, className }) => {
105
+ const [open, setOpen] = (0, import_react.useState)(false);
106
+ const { x, y, refs, strategy, context, placement: resolvedPlacement } = (0, import_react2.useFloating)({
107
+ open,
108
+ onOpenChange: setOpen,
109
+ placement,
110
+ middleware: [(0, import_react2.offset)(8), (0, import_react2.flip)(), (0, import_react2.shift)({ padding: 8 })],
111
+ whileElementsMounted: import_react2.autoUpdate
112
+ });
113
+ const hover = (0, import_react2.useHover)(context);
114
+ const dismiss = (0, import_react2.useDismiss)(context);
115
+ const { getReferenceProps, getFloatingProps } = (0, import_react2.useInteractions)([hover, dismiss]);
116
+ const id = (0, import_react.useId)();
117
+ function mergeRefs(...refsToMerge) {
118
+ return (node) => {
119
+ for (const r of refsToMerge) {
120
+ if (!r) continue;
121
+ if (typeof r === "function") r(node);
122
+ else r.current = node;
123
+ }
124
+ };
125
+ }
126
+ const side = resolvedPlacement.split("-")[0];
127
+ const enterOffset = 6;
128
+ const getInitial = () => {
129
+ switch (side) {
130
+ case "top":
131
+ return { opacity: 0, y: enterOffset };
132
+ case "bottom":
133
+ return { opacity: 0, y: -enterOffset };
134
+ case "left":
135
+ return { opacity: 0, x: enterOffset };
136
+ case "right":
137
+ return { opacity: 0, x: -enterOffset };
138
+ default:
139
+ return { opacity: 0 };
140
+ }
141
+ };
142
+ const getExit = () => __spreadProps(__spreadValues({}, getInitial()), { opacity: 0 });
143
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react.Fragment, { children: [
144
+ (0, import_react.isValidElement)(children) ? (0, import_react.cloneElement)(children, __spreadProps(__spreadValues({}, getReferenceProps({
145
+ onFocus: () => setOpen(true),
146
+ onBlur: () => setOpen(false),
147
+ "aria-describedby": open ? id : void 0
148
+ /* eslint-disable @typescript-eslint/no-explicit-any */
149
+ })), {
150
+ /* eslint-disable @typescript-eslint/no-explicit-any */
151
+ ref: mergeRefs(children.props.ref, refs.setReference)
152
+ })) : children,
153
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react3.AnimatePresence, { children: open && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
154
+ import_react3.motion.div,
155
+ __spreadProps(__spreadValues({
156
+ ref: refs.setFloating
157
+ }, getFloatingProps({
158
+ role: "tooltip",
159
+ id,
160
+ style: {
161
+ position: strategy,
162
+ top: y != null ? y : 0,
163
+ left: x != null ? x : 0,
164
+ pointerEvents: "none"
165
+ }
166
+ })), {
167
+ initial: getInitial(),
168
+ animate: { opacity: 1, x: 0, y: 0, scale: 1 },
169
+ exit: getExit(),
170
+ transition: { type: "spring", stiffness: 420, damping: 30, mass: 0.6 },
171
+ className: (0, import_tailwind_merge.twMerge)("bg-white border border-solid border-gray-200/50 py-1 px-3 rounded-lg text-sm shadow-lg shadow-gray-50 text-center", className),
172
+ children: content
173
+ }),
174
+ "tooltip"
175
+ ) }) })
176
+ ] });
177
+ };
178
+ var Tooltip_default = Tooltip;
179
+
180
+ // src/lib/context/editor.context.tsx
181
+ var import_react4 = require("react");
182
+ var import_jsx_runtime3 = require("react/jsx-runtime");
183
+ var EditorContext = (0, import_react4.createContext)({ editor: null });
184
+ var useEditor = () => {
185
+ const ctx = (0, import_react4.useContext)(EditorContext);
186
+ if (!ctx) throw new Error("<Toolbar/> & <Content/> component must be used inside <Editor>...</Editor/>");
187
+ return ctx;
188
+ };
189
+
190
+ // src/lib/components/ButtonComponent.tsx
191
+ var import_react5 = require("@tiptap/react");
192
+ var import_jsx_runtime4 = require("react/jsx-runtime");
193
+ var ButtonComponent = ({ className, activeClassName, icon, style, tooltip = true, tooltipClassName, tooltipPlacement, _extName, _internalIcon, _tooltipContent, _onToggle, _interShortcut, _buttonClassName }) => {
194
+ const { editor } = useEditor();
195
+ const editorState = (0, import_react5.useEditorState)({
196
+ editor,
197
+ selector: ({ editor: editor2 }) => ({ isActive: (editor2 == null ? void 0 : editor2.isActive(_extName)) || false })
198
+ });
199
+ const tooltipContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { children: [
200
+ typeof tooltip === "string" ? tooltip : _tooltipContent,
201
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("br", {}),
202
+ _interShortcut
203
+ ] });
204
+ const btn = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
205
+ "button",
206
+ {
207
+ onClick: _onToggle,
208
+ className: (0, import_tailwind_merge2.twMerge)(
209
+ "p-1.5 rounded-md",
210
+ _buttonClassName,
211
+ (editorState == null ? void 0 : editorState.isActive) ? "bg-gray-200/60" : "hover:bg-gray-100",
212
+ className,
213
+ (editorState == null ? void 0 : editorState.isActive) ? activeClassName : "hover:bg-gray-100"
214
+ ),
215
+ style,
216
+ children: icon != null ? icon : _internalIcon
217
+ }
218
+ );
219
+ if (tooltip === false) return btn;
220
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
221
+ Tooltip_default,
222
+ {
223
+ content: tooltipContent,
224
+ className: tooltipClassName,
225
+ placement: tooltipPlacement,
226
+ children: btn
227
+ }
228
+ );
229
+ };
230
+ var ButtonComponent_default = ButtonComponent;
231
+
232
+ // src/extension/Subscript.tsx
233
+ var import_jsx_runtime5 = require("react/jsx-runtime");
234
+ var Subscript = import_extension_subscript.default.extend({
235
+ addOptions() {
236
+ var _a;
237
+ return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
238
+ component: ({ options, editor, buttonClassName }) => {
239
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
240
+ ButtonComponent_default,
241
+ {
242
+ className: options.className,
243
+ icon: options.icon,
244
+ style: options.style,
245
+ activeClassName: options.activeClassName,
246
+ tooltip: options.tooltip,
247
+ tooltipClassName: options.tooltipClassName,
248
+ tooltipPlacement: options.tooltipPlacement,
249
+ _internalIcon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SubIcon_default, {}),
250
+ _extName: "subscript",
251
+ _onToggle: () => editor.chain().focus().toggleSubscript().run(),
252
+ _interShortcut: "\u2318 + ,",
253
+ _tooltipContent: "Subscript",
254
+ _buttonClassName: buttonClassName
255
+ }
256
+ );
257
+ }
258
+ });
259
+ }
260
+ });
261
+ // Annotate the CommonJS export names for ESM import in node:
262
+ 0 && (module.exports = {
263
+ Subscript
264
+ });
@@ -0,0 +1,45 @@
1
+ import {
2
+ ButtonComponent_default
3
+ } from "../chunk-CU67RXD7.mjs";
4
+ import {
5
+ SubIcon_default
6
+ } from "../chunk-LO4RJXQF.mjs";
7
+ import "../chunk-ZLCVIW2P.mjs";
8
+ import {
9
+ __spreadProps,
10
+ __spreadValues
11
+ } from "../chunk-TQTCTY3E.mjs";
12
+
13
+ // src/extension/Subscript.tsx
14
+ import TiptapSubscript from "@tiptap/extension-subscript";
15
+ import { jsx } from "react/jsx-runtime";
16
+ var Subscript = TiptapSubscript.extend({
17
+ addOptions() {
18
+ var _a;
19
+ return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
20
+ component: ({ options, editor, buttonClassName }) => {
21
+ return /* @__PURE__ */ jsx(
22
+ ButtonComponent_default,
23
+ {
24
+ className: options.className,
25
+ icon: options.icon,
26
+ style: options.style,
27
+ activeClassName: options.activeClassName,
28
+ tooltip: options.tooltip,
29
+ tooltipClassName: options.tooltipClassName,
30
+ tooltipPlacement: options.tooltipPlacement,
31
+ _internalIcon: /* @__PURE__ */ jsx(SubIcon_default, {}),
32
+ _extName: "subscript",
33
+ _onToggle: () => editor.chain().focus().toggleSubscript().run(),
34
+ _interShortcut: "\u2318 + ,",
35
+ _tooltipContent: "Subscript",
36
+ _buttonClassName: buttonClassName
37
+ }
38
+ );
39
+ }
40
+ });
41
+ }
42
+ });
43
+ export {
44
+ Subscript
45
+ };
@@ -0,0 +1,8 @@
1
+ import { Mark } from '@tiptap/react';
2
+ import { E as ExtButtonOptions } from '../tiptap-ext.type-D61hoEX5.mjs';
3
+ import 'react';
4
+ import '@floating-ui/react';
5
+
6
+ declare const Superscript: Mark<ExtButtonOptions>;
7
+
8
+ export { Superscript };
@@ -0,0 +1,8 @@
1
+ import { Mark } from '@tiptap/react';
2
+ import { E as ExtButtonOptions } from '../tiptap-ext.type-D61hoEX5.js';
3
+ import 'react';
4
+ import '@floating-ui/react';
5
+
6
+ declare const Superscript: Mark<ExtButtonOptions>;
7
+
8
+ export { Superscript };