@examplary/ui 1.55.0 → 1.58.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.
Files changed (106) hide show
  1. package/dist/components/ai/ai-icon.js +2 -25
  2. package/dist/components/ai/ai-prompt-suggestion.js +3 -26
  3. package/dist/components/brand/tick-icon.js +2 -25
  4. package/dist/components/chat/chat-input.js +8 -31
  5. package/dist/components/chat/chat-typing-indicator.js +2 -2
  6. package/dist/components/chat/chat-view.js +6 -34
  7. package/dist/components/loading/ai-spinner.js +2 -13
  8. package/dist/components/loading/tick-loader.js +39 -104
  9. package/dist/components/print/answer-box.js +2 -25
  10. package/dist/components/question-types/fetch-component.js +65 -106
  11. package/dist/components/question-types/format-question-type.d.ts +41 -41
  12. package/dist/components/question-types/format-question-type.js +36 -37
  13. package/dist/components/rich-text/minimal-rich-text-field.d.ts +2 -2
  14. package/dist/components/rich-text/minimal-rich-text-field.js +47 -85
  15. package/dist/components/rich-text/rich-text-display.js +15 -33
  16. package/dist/components/rich-text/rich-text-field.js +2 -25
  17. package/dist/components/rich-text/rich-text-toolbar.d.ts +3 -2
  18. package/dist/components/rich-text/rich-text-toolbar.js +5 -6
  19. package/dist/components/rich-text/tiptap/collaboration-caret.js +24 -34
  20. package/dist/components/rich-text/tiptap/comments/comment-bubble.d.ts +1 -1
  21. package/dist/components/rich-text/tiptap/comments/comment-bubble.js +36 -41
  22. package/dist/components/rich-text/tiptap/content-reference.js +6 -7
  23. package/dist/components/rich-text/tiptap/crop-page-clipping-modal.d.ts +3 -3
  24. package/dist/components/rich-text/tiptap/crop-page-clipping-modal.js +20 -25
  25. package/dist/components/rich-text/tiptap/extensions.d.ts +2 -2
  26. package/dist/components/rich-text/tiptap/extensions.js +6 -16
  27. package/dist/components/rich-text/tiptap/file-attachment.js +9 -11
  28. package/dist/components/rich-text/tiptap/file-handler.d.ts +2 -2
  29. package/dist/components/rich-text/tiptap/file-handler.js +110 -185
  30. package/dist/components/rich-text/tiptap/image.js +18 -23
  31. package/dist/components/rich-text/tiptap/mathematics-component.js +25 -30
  32. package/dist/components/rich-text/tiptap/mathematics.js +56 -82
  33. package/dist/components/rich-text/tiptap/page-clipping.js +3 -4
  34. package/dist/components/rich-text/tiptap/png-scanner.js +63 -108
  35. package/dist/components/rich-text/tiptap/rich-text-formatting-menu.d.ts +1 -1
  36. package/dist/components/rich-text/tiptap/rich-text-formatting-menu.js +31 -46
  37. package/dist/components/ui/alert.d.ts +3 -3
  38. package/dist/components/ui/alert.js +7 -32
  39. package/dist/components/ui/avatar.js +18 -14
  40. package/dist/components/ui/badge.d.ts +3 -3
  41. package/dist/components/ui/badge.js +4 -27
  42. package/dist/components/ui/button.d.ts +4 -4
  43. package/dist/components/ui/button.js +4 -27
  44. package/dist/components/ui/card.js +6 -46
  45. package/dist/components/ui/checkbox.js +1 -26
  46. package/dist/components/ui/color-picker.js +11 -22
  47. package/dist/components/ui/command-palette.d.ts +2 -2
  48. package/dist/components/ui/command-palette.js +38 -72
  49. package/dist/components/ui/command.js +18 -49
  50. package/dist/components/ui/comments.js +37 -107
  51. package/dist/components/ui/context-menu.js +30 -67
  52. package/dist/components/ui/dialog.js +15 -61
  53. package/dist/components/ui/dropdown.js +17 -64
  54. package/dist/components/ui/floating-menu.js +2 -25
  55. package/dist/components/ui/floating-resizable.d.ts +5 -0
  56. package/dist/components/ui/floating-resizable.js +24 -0
  57. package/dist/components/ui/help-icon.js +1 -2
  58. package/dist/components/ui/icon-picker.js +50 -130
  59. package/dist/components/ui/index.d.ts +1 -0
  60. package/dist/components/ui/index.js +1 -0
  61. package/dist/components/ui/input.js +2 -25
  62. package/dist/components/ui/label.d.ts +1 -1
  63. package/dist/components/ui/label.js +2 -27
  64. package/dist/components/ui/popover.d.ts +2 -2
  65. package/dist/components/ui/popover.js +4 -32
  66. package/dist/components/ui/progress-bar.js +2 -3
  67. package/dist/components/ui/radio-group.js +4 -28
  68. package/dist/components/ui/resizable.d.ts +6 -9
  69. package/dist/components/ui/resizable.js +13 -60
  70. package/dist/components/ui/select.js +12 -55
  71. package/dist/components/ui/separator.js +1 -26
  72. package/dist/components/ui/sheet.d.ts +3 -3
  73. package/dist/components/ui/sheet.js +11 -51
  74. package/dist/components/ui/skeleton.js +2 -25
  75. package/dist/components/ui/slider.js +7 -32
  76. package/dist/components/ui/sortable.d.ts +1 -1
  77. package/dist/components/ui/sortable.js +131 -155
  78. package/dist/components/ui/switch.d.ts +3 -3
  79. package/dist/components/ui/switch.js +3 -28
  80. package/dist/components/ui/table.js +8 -54
  81. package/dist/components/ui/tabs.js +8 -34
  82. package/dist/components/ui/text-selection-menu.d.ts +1 -1
  83. package/dist/components/ui/text-selection-menu.js +19 -25
  84. package/dist/components/ui/textarea.js +7 -30
  85. package/dist/components/ui/tooltip.js +4 -29
  86. package/dist/components/web-components/content-reference.js +81 -106
  87. package/dist/components/web-components/file-attachment.js +9 -30
  88. package/dist/components/web-components/index.js +1 -1
  89. package/dist/components/web-components/inline-comment-reply.js +3 -24
  90. package/dist/components/web-components/inline-comment.js +3 -24
  91. package/dist/components/web-components/inline-math.js +14 -36
  92. package/dist/components/web-components/page-clipping.js +13 -34
  93. package/dist/lib/compose-refs.js +10 -18
  94. package/dist/lib/use-spin-loop.js +19 -69
  95. package/dist/src/global.css +2 -2
  96. package/dist/utils.js +1 -5
  97. package/package.json +7 -6
  98. package/src/global.css +6 -1
  99. package/dist/components/rich-text/tiptap/comments/comment-reply.d.ts +0 -21
  100. package/dist/components/rich-text/tiptap/comments/comment-reply.js +0 -230
  101. package/dist/components/rich-text/tiptap/comments/comment.d.ts +0 -22
  102. package/dist/components/rich-text/tiptap/comments/comment.js +0 -199
  103. package/dist/components/rich-text/tiptap/comments/helpers.d.ts +0 -19
  104. package/dist/components/rich-text/tiptap/comments/helpers.js +0 -95
  105. package/dist/components/rich-text/tiptap/comments/types.d.ts +0 -29
  106. package/dist/components/rich-text/tiptap/comments/types.js +0 -1
@@ -1,199 +1,124 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
1
  import toast from "react-hot-toast";
38
2
  import FileHandler from "@tiptap/extension-file-handler";
39
3
  import { getImageSize } from "./png-scanner";
40
- export var processFilesAsString = function (uploadFile, files) {
41
- return new Promise(function (resolve) {
42
- toast.promise(function () { return __awaiter(void 0, void 0, void 0, function () {
43
- var items, e_1;
44
- return __generator(this, function (_a) {
45
- switch (_a.label) {
46
- case 0:
47
- _a.trys.push([0, 2, , 3]);
48
- return [4 /*yield*/, Promise.all(Array.from(files).map(function (file) { return __awaiter(void 0, void 0, void 0, function () {
49
- var _a, url, name_1, isImage, attrs, width, _1, e_2;
50
- return __generator(this, function (_b) {
51
- switch (_b.label) {
52
- case 0:
53
- _b.trys.push([0, 6, , 7]);
54
- return [4 /*yield*/, uploadFile(file)];
55
- case 1:
56
- _a = _b.sent(), url = _a.url, name_1 = _a.name;
57
- console.log({ url: url, name: name_1 });
58
- isImage = file.type.startsWith("image/");
59
- attrs = {
60
- src: url,
61
- title: name_1,
62
- type: file.type,
63
- };
64
- if (!isImage) return [3 /*break*/, 5];
65
- _b.label = 2;
66
- case 2:
67
- _b.trys.push([2, 4, , 5]);
68
- return [4 /*yield*/, getImageSize(file)];
69
- case 3:
70
- width = (_b.sent()).width;
71
- if (width)
72
- attrs.width = width;
73
- return [3 /*break*/, 5];
74
- case 4:
75
- _1 = _b.sent();
76
- return [3 /*break*/, 5];
77
- case 5:
78
- if (isImage) {
79
- return [2 /*return*/, "<img src=\"".concat(url, "\" title=\"").concat(name_1, "\" width=\"").concat(attrs.width, "\" alt=\"").concat(name_1, "\"/>")];
80
- }
81
- else {
82
- return [2 /*return*/, "<file-attachment title=\"".concat(name_1, "\" type=\"").concat(file.type, "\" href=\"").concat(url, "\">").concat(name_1, "</file-attachment>")];
83
- }
84
- return [3 /*break*/, 7];
85
- case 6:
86
- e_2 = _b.sent();
87
- console.log(e_2);
88
- throw e_2;
89
- case 7: return [2 /*return*/];
90
- }
91
- });
92
- }); }))];
93
- case 1:
94
- items = _a.sent();
95
- resolve(items.join(""));
96
- return [3 /*break*/, 3];
97
- case 2:
98
- e_1 = _a.sent();
99
- console.log(e_1);
100
- throw e_1;
101
- case 3: return [2 /*return*/];
102
- }
103
- });
104
- }); }, {
105
- loading: "Uploading file...",
106
- success: "Uploaded successfully!",
107
- error: "Failed to upload file",
108
- });
109
- });
110
- };
111
- export var processFiles = function (uploadFile, currentEditor, files, pos) {
112
- toast.promise(Promise.all(files.map(function (file) { return __awaiter(void 0, void 0, void 0, function () {
113
- var _a, url, name_2, isImage, attrs, width, _2, content, e_3;
114
- return __generator(this, function (_b) {
115
- switch (_b.label) {
116
- case 0:
117
- _b.trys.push([0, 6, , 7]);
118
- return [4 /*yield*/, uploadFile(file)];
119
- case 1:
120
- _a = _b.sent(), url = _a.url, name_2 = _a.name;
121
- isImage = file.type.startsWith("image/");
122
- attrs = {
4
+ export const processFilesAsString = (uploadFile, files) => new Promise((resolve) => {
5
+ toast.promise(async () => {
6
+ try {
7
+ const items = await Promise.all(Array.from(files).map(async (file) => {
8
+ try {
9
+ const { url, name } = await uploadFile(file);
10
+ console.log({ url, name });
11
+ const isImage = file.type.startsWith("image/");
12
+ const attrs = {
123
13
  src: url,
124
- title: name_2,
14
+ title: name,
125
15
  type: file.type,
126
16
  };
127
- if (!isImage) return [3 /*break*/, 5];
128
- _b.label = 2;
129
- case 2:
130
- _b.trys.push([2, 4, , 5]);
131
- return [4 /*yield*/, getImageSize(file)];
132
- case 3:
133
- width = (_b.sent()).width;
134
- if (width)
135
- attrs.width = width;
136
- return [3 /*break*/, 5];
137
- case 4:
138
- _2 = _b.sent();
139
- return [3 /*break*/, 5];
140
- case 5:
141
- content = isImage
142
- ? {
143
- type: "image",
144
- attrs: attrs,
17
+ if (isImage) {
18
+ try {
19
+ const { width } = await getImageSize(file);
20
+ if (width)
21
+ attrs.width = width;
145
22
  }
146
- : {
147
- type: "file-attachment",
148
- attrs: attrs,
149
- content: [
150
- {
151
- type: "text",
152
- href: url,
153
- text: name_2,
154
- },
155
- ],
156
- };
157
- currentEditor.chain().insertContentAt(pos, content).focus().run();
158
- return [3 /*break*/, 7];
159
- case 6:
160
- e_3 = _b.sent();
161
- console.log(e_3);
162
- throw e_3;
163
- case 7: return [2 /*return*/];
164
- }
165
- });
166
- }); })), {
23
+ catch (_) {
24
+ // do nothing
25
+ }
26
+ }
27
+ if (isImage) {
28
+ return `<img src="${url}" title="${name}" width="${attrs.width}" alt="${name}"/>`;
29
+ }
30
+ else {
31
+ return `<file-attachment title="${name}" type="${file.type}" href="${url}">${name}</file-attachment>`;
32
+ }
33
+ }
34
+ catch (e) {
35
+ console.log(e);
36
+ throw e;
37
+ }
38
+ }));
39
+ resolve(items.join(""));
40
+ }
41
+ catch (e) {
42
+ console.log(e);
43
+ throw e;
44
+ }
45
+ }, {
167
46
  loading: "Uploading file...",
168
47
  success: "Uploaded successfully!",
169
48
  error: "Failed to upload file",
170
49
  });
171
- };
172
- export var fileHandler = function (uploadFile) {
173
- return FileHandler.configure({
174
- allowedMimeTypes: [
175
- "image/png",
176
- "image/jpeg",
177
- "image/gif",
178
- "image/webp",
179
- "application/pdf",
180
- "text/html",
181
- "text/plain",
182
- "application/msword",
183
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
184
- ],
185
- onDrop: function (currentEditor, files, pos) {
186
- processFiles(uploadFile, currentEditor, files, pos);
187
- },
188
- onPaste: function (currentEditor, files, htmlContent) {
189
- files.forEach(function (file) {
190
- if (htmlContent) {
191
- // if there is htmlContent, stop manual insertion & let other extensions handle insertion via inputRule
192
- // you could extract the pasted file from this url string and upload it to a server for example
193
- return false;
50
+ });
51
+ export const processFiles = (uploadFile, currentEditor, files, pos) => {
52
+ toast.promise(Promise.all(files.map(async (file) => {
53
+ try {
54
+ const { url, name } = await uploadFile(file);
55
+ const isImage = file.type.startsWith("image/");
56
+ const attrs = {
57
+ src: url,
58
+ title: name,
59
+ type: file.type,
60
+ };
61
+ if (isImage) {
62
+ try {
63
+ const { width } = await getImageSize(file);
64
+ if (width)
65
+ attrs.width = width;
66
+ }
67
+ catch (_) {
68
+ // do nothing
194
69
  }
195
- processFiles(uploadFile, currentEditor, [file], currentEditor.state.selection.anchor);
196
- });
197
- },
70
+ }
71
+ const content = isImage
72
+ ? {
73
+ type: "image",
74
+ attrs,
75
+ }
76
+ : {
77
+ type: "file-attachment",
78
+ attrs,
79
+ content: [
80
+ {
81
+ type: "text",
82
+ href: url,
83
+ text: name,
84
+ },
85
+ ],
86
+ };
87
+ currentEditor.chain().insertContentAt(pos, content).focus().run();
88
+ }
89
+ catch (e) {
90
+ console.log(e);
91
+ throw e;
92
+ }
93
+ })), {
94
+ loading: "Uploading file...",
95
+ success: "Uploaded successfully!",
96
+ error: "Failed to upload file",
198
97
  });
199
98
  };
99
+ export const fileHandler = (uploadFile) => FileHandler.configure({
100
+ allowedMimeTypes: [
101
+ "image/png",
102
+ "image/jpeg",
103
+ "image/gif",
104
+ "image/webp",
105
+ "application/pdf",
106
+ "text/html",
107
+ "text/plain",
108
+ "application/msword",
109
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
110
+ ],
111
+ onDrop: (currentEditor, files, pos) => {
112
+ processFiles(uploadFile, currentEditor, files, pos);
113
+ },
114
+ onPaste: (currentEditor, files, htmlContent) => {
115
+ files.forEach((file) => {
116
+ if (htmlContent) {
117
+ // if there is htmlContent, stop manual insertion & let other extensions handle insertion via inputRule
118
+ // you could extract the pasted file from this url string and upload it to a server for example
119
+ return false;
120
+ }
121
+ processFiles(uploadFile, currentEditor, [file], currentEditor.state.selection.anchor);
122
+ });
123
+ },
124
+ });
@@ -2,28 +2,28 @@ import { mergeAttributes, Node, nodeInputRule } from "@tiptap/core";
2
2
  /**
3
3
  * Matches an image to a ![image](src "title") on input.
4
4
  */
5
- export var inputRegex = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;
5
+ export const inputRegex = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;
6
6
  /**
7
7
  * This extension allows you to insert images.
8
8
  * @see https://www.tiptap.dev/api/nodes/image
9
9
  */
10
- var Image = Node.create({
10
+ const Image = Node.create({
11
11
  name: "image",
12
- addOptions: function () {
12
+ addOptions() {
13
13
  return {
14
14
  inline: false,
15
15
  allowBase64: false,
16
16
  HTMLAttributes: {},
17
17
  };
18
18
  },
19
- inline: function () {
19
+ inline() {
20
20
  return this.options.inline;
21
21
  },
22
- group: function () {
22
+ group() {
23
23
  return this.options.inline ? "inline" : "block";
24
24
  },
25
25
  draggable: true,
26
- addAttributes: function () {
26
+ addAttributes() {
27
27
  return {
28
28
  src: {
29
29
  default: null,
@@ -42,7 +42,7 @@ var Image = Node.create({
42
42
  },
43
43
  };
44
44
  },
45
- parseHTML: function () {
45
+ parseHTML() {
46
46
  return [
47
47
  {
48
48
  tag: this.options.allowBase64
@@ -51,35 +51,30 @@ var Image = Node.create({
51
51
  },
52
52
  ];
53
53
  },
54
- renderHTML: function (_a) {
55
- var HTMLAttributes = _a.HTMLAttributes;
54
+ renderHTML({ HTMLAttributes }) {
56
55
  return [
57
56
  "img",
58
57
  mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
59
58
  ];
60
59
  },
61
- addCommands: function () {
62
- var _this = this;
60
+ addCommands() {
63
61
  return {
64
- setImage: function (options) {
65
- return function (_a) {
66
- var commands = _a.commands;
67
- return commands.insertContent({
68
- type: _this.name,
69
- attrs: options,
70
- });
71
- };
62
+ setImage: (options) => ({ commands }) => {
63
+ return commands.insertContent({
64
+ type: this.name,
65
+ attrs: options,
66
+ });
72
67
  },
73
68
  };
74
69
  },
75
- addInputRules: function () {
70
+ addInputRules() {
76
71
  return [
77
72
  nodeInputRule({
78
73
  find: inputRegex,
79
74
  type: this.type,
80
- getAttributes: function (match) {
81
- var alt = match[2], src = match[3], title = match[4];
82
- return { src: src, alt: alt, title: title };
75
+ getAttributes: (match) => {
76
+ const [, , alt, src, title] = match;
77
+ return { src, alt, title };
83
78
  },
84
79
  }),
85
80
  ];
@@ -6,63 +6,58 @@ import { convertLatexToMathMl } from "mathlive";
6
6
  import { cn } from "../../../utils.js";
7
7
  import { Popover, PopoverTrigger, PopoverContent } from "../../ui/popover.js";
8
8
  import "mathlive";
9
- export var MathematicsEditComponent = function (_a) {
10
- var node = _a.node, editor = _a.editor;
11
- return (_jsx(NodeViewWrapper, { as: "span", children: _jsx(InlineMathView, { children: node.attrs.latex, onEdit: function (newLatex) {
9
+ export const MathematicsEditComponent = ({ node, editor }) => {
10
+ return (_jsx(NodeViewWrapper, { as: "span", children: _jsx(InlineMathView, { children: node.attrs.latex, onEdit: (newLatex) => {
12
11
  editor.commands.updateInlineMath({ latex: newLatex });
13
12
  } }, node.attrs.latex) }));
14
13
  };
15
- export var InlineMathView = function (_a) {
16
- var children = _a.children, onEdit = _a.onEdit;
17
- var _b = useState(false), menuOpen = _b[0], setMenuOpen = _b[1];
18
- var _c = useState(children || ""), value = _c[0], setValue = _c[1];
19
- var html = useMemo(function () {
14
+ export const InlineMathView = ({ children, onEdit, }) => {
15
+ const [menuOpen, setMenuOpen] = useState(false);
16
+ const [value, setValue] = useState(children || "");
17
+ const html = useMemo(() => {
20
18
  try {
21
19
  return convertLatexToMathMl(value);
22
20
  }
23
- catch (_a) {
21
+ catch {
24
22
  return value;
25
23
  }
26
24
  }, [value]);
27
- return (_jsxs(Popover, { open: menuOpen, onOpenChange: function (open) {
28
- var _a;
25
+ return (_jsxs(Popover, { open: menuOpen, onOpenChange: (open) => {
29
26
  setMenuOpen(open);
30
27
  if (!open && value !== children) {
31
- onEdit === null || onEdit === void 0 ? void 0 : onEdit(value);
32
- var keyboard = document.querySelector(".ML__keyboard");
28
+ onEdit?.(value);
29
+ const keyboard = document.querySelector(".ML__keyboard");
33
30
  if (keyboard)
34
- (_a = keyboard.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(keyboard);
31
+ keyboard.parentNode?.removeChild(keyboard);
35
32
  }
36
- }, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("span", { className: cn("rounded-2xl bg-pink-50 min-h-6 px-1.5 py-0.25 inline-flex gap-2.5 items-center cursor-pointer hover:bg-pink-200 group transition-all", menuOpen && "bg-pink-200"), children: [_jsx("math", { dangerouslySetInnerHTML: { __html: html } }), _jsx(EditIcon, { className: cn("text-pink-500 size-3 hidden group-hover:block shrink-0", menuOpen && "block") })] }) }), _jsx(PopoverContent, { align: "center", side: "bottom", sideOffset: -30, collisionPadding: 12, className: "border border-black p-0 bg-white rounded-md shadow-md max-w-none", onPointerDownOutside: function (event) {
37
- var mathKeyboard = document.querySelector(".ML__keyboard");
38
- if (mathKeyboard === null || mathKeyboard === void 0 ? void 0 : mathKeyboard.contains(event.target)) {
33
+ }, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("span", { className: cn("rounded-2xl bg-pink-50 min-h-6 px-1.5 py-0.25 inline-flex gap-2.5 items-center cursor-pointer hover:bg-pink-200 group transition-all", menuOpen && "bg-pink-200"), children: [_jsx("math", { dangerouslySetInnerHTML: { __html: html } }), _jsx(EditIcon, { className: cn("text-pink-500 size-3 hidden group-hover:block shrink-0", menuOpen && "block") })] }) }), _jsx(PopoverContent, { align: "center", side: "bottom", sideOffset: -30, collisionPadding: 12, className: "border border-black p-0 bg-white rounded-md shadow-md max-w-none", onPointerDownOutside: (event) => {
34
+ const mathKeyboard = document.querySelector(".ML__keyboard");
35
+ if (mathKeyboard?.contains(event.target)) {
39
36
  // Prevent closing when clicking on the math keyboard
40
37
  event.preventDefault();
41
38
  }
42
- var mathField = document.querySelector("math-field");
43
- if (mathField === null || mathField === void 0 ? void 0 : mathField.contains(event.target)) {
39
+ const mathField = document.querySelector("math-field");
40
+ if (mathField?.contains(event.target)) {
44
41
  // Prevent closing when clicking on the math field
45
42
  event.preventDefault();
46
43
  }
47
- }, children: _jsx("math-field", { className: "min-w-64 max-w-128 p-2 rounded-lg outline-none border-0 focus:ring-0", onInput: function (event) {
44
+ }, children: _jsx("math-field", { className: "min-w-64 max-w-128 p-2 rounded-lg outline-none border-0 focus:ring-0", onInput: (event) => {
48
45
  setValue(event.target.value);
49
- var inputType = event.nativeEvent.inputType;
46
+ const inputType = event.nativeEvent.inputType;
50
47
  if (inputType === "insertLineBreak") {
51
48
  // Close popover on Enter
52
49
  setMenuOpen(false);
53
50
  if (value !== children) {
54
- onEdit === null || onEdit === void 0 ? void 0 : onEdit(value);
51
+ onEdit?.(value);
55
52
  }
56
53
  }
57
- }, ref: function (el) {
54
+ }, ref: (el) => {
58
55
  if (!el)
59
56
  return;
60
- el.menuItems = el.menuItems.filter(function (item) {
61
- return !item.id ||
62
- (item.id !== "insert-matrix" &&
63
- item.id !== "mode" &&
64
- item.id !== "color" &&
65
- item.id !== "background-color");
66
- });
57
+ el.menuItems = el.menuItems.filter((item) => !item.id ||
58
+ (item.id !== "insert-matrix" &&
59
+ item.id !== "mode" &&
60
+ item.id !== "color" &&
61
+ item.id !== "background-color"));
67
62
  }, children: value }) })] }));
68
63
  };