@monolith-forensics/monolith-ui 1.9.1-dev.9 → 1.9.3-dev.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 (91) hide show
  1. package/dist/DropDownMenu/components/MenuItemList.js +32 -12
  2. package/dist/DropDownMenu/components/StyledContent.js +1 -1
  3. package/dist/DropDownMenu/components/StyledInnerItemContainer.js +1 -0
  4. package/dist/FileViewer/FileViewer.js +32 -8
  5. package/dist/FileViewer/viewers/ImageViewer.d.ts +1 -0
  6. package/dist/FileViewer/viewers/ImageViewer.js +36 -15
  7. package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +23 -0
  8. package/dist/RichTextEditor/Components/BubbleMenu.d.ts +3 -3
  9. package/dist/RichTextEditor/Components/BubbleMenu.js +190 -51
  10. package/dist/RichTextEditor/Components/CodeBlockBaseButton.d.ts +18 -0
  11. package/dist/RichTextEditor/Components/CodeBlockBaseButton.js +6 -0
  12. package/dist/RichTextEditor/Components/CodeBlockCopyButton.d.ts +9 -0
  13. package/dist/RichTextEditor/Components/CodeBlockCopyButton.js +42 -0
  14. package/dist/RichTextEditor/Components/CodeBlockFormatButton.d.ts +10 -0
  15. package/dist/RichTextEditor/Components/CodeBlockFormatButton.js +60 -0
  16. package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.d.ts +9 -0
  17. package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.js +30 -0
  18. package/dist/RichTextEditor/Components/CodeBlockNodeView.d.ts +3 -0
  19. package/dist/RichTextEditor/Components/CodeBlockNodeView.js +28 -0
  20. package/dist/RichTextEditor/Components/CodeBlockWrapButton.d.ts +10 -0
  21. package/dist/RichTextEditor/Components/CodeBlockWrapButton.js +17 -0
  22. package/dist/RichTextEditor/Components/LinkEditor.d.ts +8 -0
  23. package/dist/RichTextEditor/Components/LinkEditor.js +94 -0
  24. package/dist/RichTextEditor/Components/TableCornerMenu.d.ts +16 -0
  25. package/dist/RichTextEditor/Components/TableCornerMenu.js +202 -0
  26. package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.d.ts +2 -0
  27. package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.js +19 -0
  28. package/dist/RichTextEditor/Components/TableTools/TableInsertControls.d.ts +2 -0
  29. package/dist/RichTextEditor/Components/TableTools/TableInsertControls.js +24 -0
  30. package/dist/RichTextEditor/Components/TableTools/TableRails.d.ts +2 -0
  31. package/dist/RichTextEditor/Components/TableTools/TableRails.js +180 -0
  32. package/dist/RichTextEditor/Components/TableTools/TableToolMenu.d.ts +5 -0
  33. package/dist/RichTextEditor/Components/TableTools/TableToolMenu.js +6 -0
  34. package/dist/RichTextEditor/Components/TableTools/TableTools.actions.d.ts +5 -0
  35. package/dist/RichTextEditor/Components/TableTools/TableTools.actions.js +183 -0
  36. package/dist/RichTextEditor/Components/TableTools/TableTools.commands.d.ts +16 -0
  37. package/dist/RichTextEditor/Components/TableTools/TableTools.commands.js +217 -0
  38. package/dist/RichTextEditor/Components/TableTools/TableTools.constants.d.ts +8 -0
  39. package/dist/RichTextEditor/Components/TableTools/TableTools.constants.js +11 -0
  40. package/dist/RichTextEditor/Components/TableTools/TableTools.d.ts +3 -0
  41. package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.d.ts +23 -0
  42. package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.js +75 -0
  43. package/dist/RichTextEditor/Components/TableTools/TableTools.js +3 -0
  44. package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.d.ts +16 -0
  45. package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.js +53 -0
  46. package/dist/RichTextEditor/Components/TableTools/TableTools.styled.d.ts +40 -0
  47. package/dist/RichTextEditor/Components/TableTools/TableTools.styled.js +167 -0
  48. package/dist/RichTextEditor/Components/TableTools/TableTools.types.d.ts +76 -0
  49. package/dist/RichTextEditor/Components/TableTools/TableTools.types.js +1 -0
  50. package/dist/RichTextEditor/Components/TableTools/TableTools.utils.d.ts +4 -0
  51. package/dist/RichTextEditor/Components/TableTools/TableTools.utils.js +4 -0
  52. package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.d.ts +2 -0
  53. package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.js +12 -0
  54. package/dist/RichTextEditor/Components/TableTools/index.d.ts +3 -0
  55. package/dist/RichTextEditor/Components/TableTools/index.js +2 -0
  56. package/dist/RichTextEditor/Components/TableTools.d.ts +44 -0
  57. package/dist/RichTextEditor/Components/TableTools.js +790 -0
  58. package/dist/RichTextEditor/Enums/Controls.d.ts +7 -1
  59. package/dist/RichTextEditor/Enums/Controls.js +6 -0
  60. package/dist/RichTextEditor/Enums/Extensions.d.ts +4 -0
  61. package/dist/RichTextEditor/Enums/Extensions.js +4 -0
  62. package/dist/RichTextEditor/Enums/HighlightColors.d.ts +9 -0
  63. package/dist/RichTextEditor/Enums/HighlightColors.js +10 -0
  64. package/dist/RichTextEditor/Enums/SlashCommands.d.ts +4 -1
  65. package/dist/RichTextEditor/Enums/SlashCommands.js +3 -0
  66. package/dist/RichTextEditor/Extensions/SlashCommandList.js +0 -1
  67. package/dist/RichTextEditor/Extensions/getSlashCommand.js +39 -1
  68. package/dist/RichTextEditor/Extensions/getTiptapExtensions.d.ts +10 -0
  69. package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +157 -24
  70. package/dist/RichTextEditor/Plugins/ImageActionsPlugin.js +4 -7
  71. package/dist/RichTextEditor/RichTextEditor.d.ts +3 -1
  72. package/dist/RichTextEditor/RichTextEditor.js +352 -14
  73. package/dist/RichTextEditor/Toolbar/Control.d.ts +6 -2
  74. package/dist/RichTextEditor/Toolbar/Control.js +13 -6
  75. package/dist/RichTextEditor/Toolbar/Controls.d.ts +6 -0
  76. package/dist/RichTextEditor/Toolbar/Controls.js +118 -1
  77. package/dist/RichTextEditor/Toolbar/ControlsGroup.js +17 -6
  78. package/dist/RichTextEditor/Toolbar/Labels.d.ts +1 -0
  79. package/dist/RichTextEditor/Toolbar/Labels.js +1 -0
  80. package/dist/RichTextEditor/Toolbar/Toolbar.d.ts +1 -2
  81. package/dist/RichTextEditor/Toolbar/Toolbar.js +32 -67
  82. package/dist/RichTextEditor/Utils/codeBlockUtils.d.ts +20 -0
  83. package/dist/RichTextEditor/Utils/codeBlockUtils.js +137 -0
  84. package/dist/RichTextEditor/Utils/codeUtils.d.ts +3 -0
  85. package/dist/RichTextEditor/Utils/codeUtils.js +12 -0
  86. package/dist/RichTextEditor/Utils/linkUtils.d.ts +19 -0
  87. package/dist/RichTextEditor/Utils/linkUtils.js +57 -0
  88. package/dist/RichTextEditor/Utils/tableUtils.d.ts +1 -0
  89. package/dist/RichTextEditor/Utils/tableUtils.js +1 -0
  90. package/dist/theme/variants.js +46 -0
  91. package/package.json +8 -1
@@ -56,11 +56,18 @@ const buildGroupedDisplayList = (items) => {
56
56
  const ListViewPort = styled.div.attrs({ className: "ListViewPort" }) `
57
57
  display: flex;
58
58
  flex-direction: column;
59
+ flex: 1 1 auto;
60
+ min-height: 0;
59
61
  width: 100%;
60
62
  `;
63
+ const MenuItemListRoot = styled.div `
64
+ display: flex;
65
+ flex-direction: column;
66
+ height: 100%;
67
+ min-height: 0;
68
+ `;
61
69
  const ListScroller = styled.div `
62
70
  scrollbar-color: ${({ theme }) => `${theme.scrollbar.thumb} ${theme.scrollbar.track}`};
63
- scrollbar-gutter: stable;
64
71
  scrollbar-width: thin;
65
72
 
66
73
  &::-webkit-scrollbar {
@@ -234,16 +241,6 @@ export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, dy
234
241
  list.addEventListener("scroll", handleOnScroll);
235
242
  return () => list.removeEventListener("scroll", handleOnScroll);
236
243
  }, [dynamicOptionHeight, handleOnScroll, isLoading, renderOption]);
237
- useLayoutEffect(() => {
238
- var _a;
239
- if (targetElm.current) {
240
- const viewPortDimensions = (_a = targetElm.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
241
- setViewPortDimensions({
242
- width: viewPortDimensions.width,
243
- height: viewPortDimensions.height,
244
- });
245
- }
246
- }, [targetElm.current, isLoading]);
247
244
  const overscanCount = 10;
248
245
  const sizeTokens = getControlSizeTokens(size || "sm");
249
246
  const itemHeight = sizeTokens.menuRowHeight;
@@ -267,6 +264,29 @@ export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, dy
267
264
  ? estimatedHeight
268
265
  : 200;
269
266
  const width = "100%";
267
+ useLayoutEffect(() => {
268
+ const target = targetElm.current;
269
+ if (!target)
270
+ return;
271
+ const updateDimensions = () => {
272
+ const nextDimensions = target.getBoundingClientRect();
273
+ setViewPortDimensions((currentDimensions) => {
274
+ const width = Math.ceil(nextDimensions.width);
275
+ const height = Math.floor(nextDimensions.height);
276
+ if (currentDimensions.width === width &&
277
+ currentDimensions.height === height) {
278
+ return currentDimensions;
279
+ }
280
+ return { width, height };
281
+ });
282
+ };
283
+ updateDimensions();
284
+ if (typeof ResizeObserver === "undefined")
285
+ return;
286
+ const observer = new ResizeObserver(updateDimensions);
287
+ observer.observe(target);
288
+ return () => observer.disconnect();
289
+ }, [displayItemsKey, isLoading]);
270
290
  const setItemSize = useCallback((index, measuredSize) => {
271
291
  var _a;
272
292
  if (itemSizeMap.current[index] === measuredSize)
@@ -335,7 +355,7 @@ export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, dy
335
355
  (item === null || item === void 0 ? void 0 : item.label) ||
336
356
  (typeof item === "string" || typeof item === "number" ? item : null) }, index));
337
357
  };
338
- return (_jsxs("div", { children: [searchable && (_jsx(SearchInput, { variant: "outlined", size: size, placeholder: "Search", defaultValue: searchValue, onChange: (e) => {
358
+ return (_jsxs(MenuItemListRoot, { children: [searchable && (_jsx(SearchInput, { variant: "outlined", size: size, placeholder: "Search", defaultValue: searchValue, onChange: (e) => {
339
359
  if (!manualSearch) {
340
360
  handleSearch(e);
341
361
  }
@@ -7,7 +7,7 @@ export const StyledContent = styled.div `
7
7
  overflow-y: hidden;
8
8
  overflow-x: hidden;
9
9
 
10
- width: var(--mfui-dropdown-reference-width, 150px);
10
+ width: max(var(--mfui-dropdown-reference-width, 0px), 180px);
11
11
  max-width: 400px;
12
12
  max-height: ${({ maxDropdownHeight }) => Number.isInteger(maxDropdownHeight)
13
13
  ? `${maxDropdownHeight}px`
@@ -5,5 +5,6 @@ export const StyledInnerItemContainer = styled.div.attrs({
5
5
  display: flex;
6
6
  flex-direction: column;
7
7
  flex: 1 1 auto;
8
+ min-height: 0;
8
9
  overflow: hidden;
9
10
  `;
@@ -2,9 +2,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import styled from "styled-components";
3
3
  import { CodeViewer, ImageViewer, OfficeViewer, PdfViewer, VideoViewer, } from "./viewers";
4
4
  import { FloatingPortal } from "@floating-ui/react";
5
- import { DownloadIcon, XIcon, ZoomInIcon, ZoomOutIcon } from "lucide-react";
5
+ import { DownloadIcon, RotateCwIcon, XIcon, ZoomInIcon, ZoomOutIcon, } from "lucide-react";
6
6
  import { Button } from "../Button";
7
- import { useState } from "react";
7
+ import { useEffect, useState } from "react";
8
8
  import Loader from "../Loader";
9
9
  var ViewerTypes;
10
10
  (function (ViewerTypes) {
@@ -24,7 +24,18 @@ const ZoomableViewerTypes = [
24
24
  ];
25
25
  const RotatableViewerTypes = [ViewerTypes.Image];
26
26
  const OfficeExtensions = ["doc", "docx", "xls", "xlsx", "ppt", "pptx"];
27
- const ImageExtensions = ["jpg", "jpeg", "png", "gif"];
27
+ const ImageExtensions = [
28
+ "jpg",
29
+ "jpeg",
30
+ "png",
31
+ "gif",
32
+ "webp",
33
+ "bmp",
34
+ "svg",
35
+ "avif",
36
+ "tif",
37
+ "tiff",
38
+ ];
28
39
  const VideoExtensions = ["mp4", "webm", "mov"];
29
40
  const AudioExtensions = ["mp3", "wav"];
30
41
  const PDFExtensions = ["pdf"];
@@ -125,10 +136,14 @@ const StyledInnerContainer = styled.div.attrs({
125
136
  }
126
137
  `;
127
138
  const resolveViewerType = (file) => {
128
- var _a, _b;
139
+ var _a, _b, _c;
129
140
  let ext = (_a = file === null || file === void 0 ? void 0 : file.ext) === null || _a === void 0 ? void 0 : _a.toLowerCase();
141
+ const type = (_b = file === null || file === void 0 ? void 0 : file.type) === null || _b === void 0 ? void 0 : _b.toLowerCase();
130
142
  if (!ext) {
131
- ext = (_b = file.name.split(".").pop()) === null || _b === void 0 ? void 0 : _b.toLowerCase();
143
+ ext = (_c = file.name.split(".").pop()) === null || _c === void 0 ? void 0 : _c.toLowerCase();
144
+ }
145
+ if (type === null || type === void 0 ? void 0 : type.startsWith("image/")) {
146
+ return ViewerTypes.Image;
132
147
  }
133
148
  if (!ext) {
134
149
  return ViewerTypes.Code;
@@ -158,19 +173,28 @@ const resolveViewerType = (file) => {
158
173
  };
159
174
  export const FileViewer = ({ file, open, isPending, onClose }) => {
160
175
  const [zoomFactor, setZoomFactor] = useState(1);
176
+ const [rotation, setRotation] = useState(0);
177
+ useEffect(() => {
178
+ setZoomFactor(1);
179
+ setRotation(0);
180
+ }, [file === null || file === void 0 ? void 0 : file.url, file === null || file === void 0 ? void 0 : file.name, open]);
161
181
  if (!open)
162
182
  return null;
163
183
  if (!file)
164
184
  return null;
165
185
  const viewerType = resolveViewerType(file);
186
+ const resetViewerState = () => {
187
+ setZoomFactor(1);
188
+ setRotation(0);
189
+ };
166
190
  const handleBackgroundClick = (e) => {
167
191
  onClose === null || onClose === void 0 ? void 0 : onClose();
168
- setZoomFactor(1);
192
+ resetViewerState();
169
193
  };
170
194
  return (_jsx(FloatingPortal, { preserveTabOrder: true, children: _jsxs(StyledContainer, { className: "mfui-FileViewer", children: [_jsxs(StyledMenu, { className: "FileViewer-menu", children: [_jsx(Button, { variant: "text", onClick: () => {
171
195
  onClose === null || onClose === void 0 ? void 0 : onClose();
172
- setZoomFactor(1);
173
- }, children: _jsx(XIcon, { size: 18 }) }), _jsx("div", { children: file.name }), _jsxs(StyledActionsMenu, { children: [ZoomableViewerTypes.includes(viewerType) && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "text", disabled: !file.url, children: _jsx(ZoomInIcon, { size: 18, onClick: () => setZoomFactor((prev) => prev * 1.1) }) }), _jsx(Button, { variant: "text", disabled: !file.url, children: _jsx(ZoomOutIcon, { size: 18, onClick: () => setZoomFactor((prev) => prev * 0.9) }) })] })), _jsx("a", { href: file.url, download: file.name, style: { pointerEvents: !file.url ? "none" : "auto" }, children: _jsx(Button, { variant: "text", disabled: !file.url, children: _jsx(DownloadIcon, { size: 18 }) }) })] })] }), file.url ? (_jsxs(StyledInnerContainer, { onClick: handleBackgroundClick, "data-type": viewerType, children: [viewerType === ViewerTypes.PDF && (_jsx(PdfViewer, { file: file, zoomFactor: zoomFactor, isPending: isPending })), viewerType === ViewerTypes.Image && (_jsx(ImageViewer, { file: file, zoomFactor: zoomFactor, isPending: isPending })), viewerType === ViewerTypes.Video && (_jsx(VideoViewer, { file: file, zoomFactor: zoomFactor, isPending: isPending })), viewerType === ViewerTypes.Audio && (_jsx(VideoViewer, { file: file, zoomFactor: zoomFactor, isPending: isPending })), viewerType === ViewerTypes.Office && (_jsx(OfficeViewer, { file: file, isPending: isPending })), viewerType === ViewerTypes.Text && (_jsx(CodeViewer, { file: file, zoomFactor: zoomFactor, isPending: isPending })), viewerType === ViewerTypes.Code && (_jsx(CodeViewer, { file: file, zoomFactor: zoomFactor, isPending: isPending }))] })) : (_jsx(StyledInnerContainer, { children: _jsxs("div", { style: {
196
+ resetViewerState();
197
+ }, children: _jsx(XIcon, { size: 18 }) }), _jsx("div", { children: file.name }), _jsxs(StyledActionsMenu, { children: [ZoomableViewerTypes.includes(viewerType) && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "text", disabled: !file.url, "aria-label": "Zoom in", title: "Zoom in", onClick: () => setZoomFactor((prev) => prev * 1.1), children: _jsx(ZoomInIcon, { size: 18 }) }), _jsx(Button, { variant: "text", disabled: !file.url, "aria-label": "Zoom out", title: "Zoom out", onClick: () => setZoomFactor((prev) => prev * 0.9), children: _jsx(ZoomOutIcon, { size: 18 }) })] })), RotatableViewerTypes.includes(viewerType) && (_jsx(Button, { variant: "text", disabled: !file.url, "aria-label": "Rotate image", title: "Rotate image", onClick: () => setRotation((prev) => (prev + 90) % 360), children: _jsx(RotateCwIcon, { size: 18 }) })), _jsx("a", { href: file.url, download: file.name, style: { pointerEvents: !file.url ? "none" : "auto" }, children: _jsx(Button, { variant: "text", disabled: !file.url, children: _jsx(DownloadIcon, { size: 18 }) }) })] })] }), file.url ? (_jsxs(StyledInnerContainer, { onClick: handleBackgroundClick, "data-type": viewerType, children: [viewerType === ViewerTypes.PDF && (_jsx(PdfViewer, { file: file, zoomFactor: zoomFactor, isPending: isPending })), viewerType === ViewerTypes.Image && (_jsx(ImageViewer, { file: file, zoomFactor: zoomFactor, rotation: rotation, isPending: isPending })), viewerType === ViewerTypes.Video && (_jsx(VideoViewer, { file: file, zoomFactor: zoomFactor, isPending: isPending })), viewerType === ViewerTypes.Audio && (_jsx(VideoViewer, { file: file, zoomFactor: zoomFactor, isPending: isPending })), viewerType === ViewerTypes.Office && (_jsx(OfficeViewer, { file: file, isPending: isPending })), viewerType === ViewerTypes.Text && (_jsx(CodeViewer, { file: file, zoomFactor: zoomFactor, isPending: isPending })), viewerType === ViewerTypes.Code && (_jsx(CodeViewer, { file: file, zoomFactor: zoomFactor, isPending: isPending }))] })) : (_jsx(StyledInnerContainer, { children: _jsxs("div", { style: {
174
198
  margin: "auto",
175
199
  display: "flex",
176
200
  gap: "10px",
@@ -2,5 +2,6 @@ import { File } from "../FileViewer";
2
2
  export declare const ImageViewer: React.FC<{
3
3
  file: File;
4
4
  zoomFactor?: number;
5
+ rotation?: number;
5
6
  isPending?: boolean;
6
7
  }>;
@@ -10,9 +10,7 @@ const ImageViewerContainer = styled.div `
10
10
  overflow: auto;
11
11
  `;
12
12
  const ImageCanvas = styled.div `
13
- display: flex;
14
- align-items: center;
15
- justify-content: center;
13
+ position: relative;
16
14
  flex: 0 0 auto;
17
15
  min-width: 100%;
18
16
  min-height: 100%;
@@ -20,8 +18,11 @@ const ImageCanvas = styled.div `
20
18
  const Image = styled.img `
21
19
  box-sizing: border-box;
22
20
  display: block;
23
- flex: 0 0 auto;
21
+ position: absolute;
22
+ top: 50%;
23
+ left: 50%;
24
24
  object-fit: contain;
25
+ transform-origin: center;
25
26
 
26
27
  // set orientation
27
28
  image-orientation: from-image;
@@ -36,7 +37,7 @@ const StyledLoader = styled.div `
36
37
  gap: 10px;
37
38
  height: 100%;
38
39
  `;
39
- export const ImageViewer = ({ file, zoomFactor = 1, isPending }) => {
40
+ export const ImageViewer = ({ file, zoomFactor = 1, rotation = 0, isPending }) => {
40
41
  const containerRef = useRef(null);
41
42
  const [imageLoaded, setImageLoaded] = useState(false);
42
43
  const [containerSize, setContainerSize] = useState({
@@ -47,6 +48,8 @@ export const ImageViewer = ({ file, zoomFactor = 1, isPending }) => {
47
48
  naturalWidth: 0,
48
49
  naturalHeight: 0,
49
50
  });
51
+ const normalizedRotation = ((rotation % 360) + 360) % 360;
52
+ const isRotatedSideways = normalizedRotation % 180 !== 0;
50
53
  const fittedDimensions = useMemo(() => {
51
54
  const { naturalWidth, naturalHeight } = originalDimensions;
52
55
  if (naturalWidth === 0 ||
@@ -54,16 +57,33 @@ export const ImageViewer = ({ file, zoomFactor = 1, isPending }) => {
54
57
  containerSize.width === 0 ||
55
58
  containerSize.height === 0) {
56
59
  return {
57
- width: naturalWidth,
58
- height: naturalHeight,
60
+ canvasWidth: isRotatedSideways ? naturalHeight : naturalWidth,
61
+ canvasHeight: isRotatedSideways ? naturalWidth : naturalHeight,
62
+ imageWidth: naturalWidth,
63
+ imageHeight: naturalHeight,
59
64
  };
60
65
  }
61
- const fitScale = Math.min(containerSize.width / naturalWidth, containerSize.height / naturalHeight);
66
+ const rotatedNaturalWidth = isRotatedSideways
67
+ ? naturalHeight
68
+ : naturalWidth;
69
+ const rotatedNaturalHeight = isRotatedSideways
70
+ ? naturalWidth
71
+ : naturalHeight;
72
+ const fitScale = Math.min(containerSize.width / rotatedNaturalWidth, containerSize.height / rotatedNaturalHeight);
73
+ const imageWidth = naturalWidth * fitScale * zoomFactor;
74
+ const imageHeight = naturalHeight * fitScale * zoomFactor;
62
75
  return {
63
- width: naturalWidth * fitScale * zoomFactor,
64
- height: naturalHeight * fitScale * zoomFactor,
76
+ canvasWidth: isRotatedSideways ? imageHeight : imageWidth,
77
+ canvasHeight: isRotatedSideways ? imageWidth : imageHeight,
78
+ imageWidth,
79
+ imageHeight,
65
80
  };
66
- }, [containerSize, originalDimensions, zoomFactor]);
81
+ }, [
82
+ containerSize,
83
+ isRotatedSideways,
84
+ originalDimensions,
85
+ zoomFactor,
86
+ ]);
67
87
  useEffect(() => {
68
88
  if (!file.url)
69
89
  return;
@@ -104,11 +124,12 @@ export const ImageViewer = ({ file, zoomFactor = 1, isPending }) => {
104
124
  return (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading Image..." })] }));
105
125
  }
106
126
  return (_jsxs(ImageViewerContainer, { ref: containerRef, className: "mfui-ImageViewer", children: [!showImage && (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading Image..." })] })), showImage && (_jsx(ImageCanvas, { style: {
107
- width: fittedDimensions.width,
108
- height: fittedDimensions.height,
127
+ width: fittedDimensions.canvasWidth,
128
+ height: fittedDimensions.canvasHeight,
109
129
  }, children: _jsx(Image, { src: file.url, alt: file.name ? file.name : "Image", style: {
110
- width: fittedDimensions.width,
111
- height: fittedDimensions.height,
130
+ width: fittedDimensions.imageWidth,
131
+ height: fittedDimensions.imageHeight,
132
+ transform: `translate(-50%, -50%) rotate(${normalizedRotation}deg)`,
112
133
  }, onClick: (e) => {
113
134
  e.stopPropagation();
114
135
  } }) }))] }));
@@ -81,6 +81,29 @@ export interface MonolithDefaultTheme {
81
81
  action: {
82
82
  hover: string;
83
83
  };
84
+ codeBlock?: {
85
+ background: string;
86
+ text: string;
87
+ border: string;
88
+ selection: string;
89
+ syntax: {
90
+ comment: string;
91
+ punctuation: string;
92
+ property: string;
93
+ selector: string;
94
+ operator: string;
95
+ keyword: string;
96
+ string: string;
97
+ number: string;
98
+ function: string;
99
+ variable: string;
100
+ tag: string;
101
+ attribute: string;
102
+ literal: string;
103
+ deleted: string;
104
+ inserted: string;
105
+ };
106
+ };
84
107
  divider: string;
85
108
  };
86
109
  header: {
@@ -1,6 +1,6 @@
1
1
  import { Extensions } from "../Enums";
2
2
  import { DropDownItem, DropDownMenuProps } from "../../DropDownMenu";
3
- import { ReactElement } from "react";
3
+ import { ReactElement, ReactNode } from "react";
4
4
  import { ButtonProps } from "../../Button";
5
5
  import { Editor } from "@tiptap/react";
6
6
  export interface BubbleMenuContentProps {
@@ -17,7 +17,7 @@ export type BubbleItem = {
17
17
  name: Extensions | string;
18
18
  icon?: React.FC<any>;
19
19
  type: "menu";
20
- label?: string | Element;
20
+ label?: ReactNode;
21
21
  items: BubbleMenuDropDownItem[];
22
22
  arrow?: boolean;
23
23
  isActive?: (editor: Editor) => boolean;
@@ -29,7 +29,7 @@ export type BubbleItem = {
29
29
  name: Extensions | string;
30
30
  icon?: React.FC<any>;
31
31
  type: "button";
32
- label?: string | Element;
32
+ label?: ReactNode;
33
33
  arrow?: boolean;
34
34
  isActive?: (editor: Editor) => boolean;
35
35
  buttonRender?: (props: any) => ReactElement;