@erxes/ui 3.3.3-next.4 → 3.3.4
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/chunks/chunk-4EIP6AVX.js +29 -0
- package/chunks/chunk-4J36M6XR.js +14 -0
- package/chunks/{chunk-OOHRHIWY.js → chunk-4WSQJAH2.js} +1 -1
- package/chunks/chunk-7T23XKCT.js +24 -0
- package/chunks/chunk-B2WUSPB5.js +50 -0
- package/chunks/chunk-B6WEOYCY.js +11 -0
- package/chunks/chunk-CAV3X4PT.js +14 -0
- package/chunks/chunk-CPF6PSFR.js +56 -0
- package/chunks/chunk-EKACQ5FS.js +45 -0
- package/chunks/{chunk-RB23BDYH.js → chunk-F2R6ZFEK.js} +1 -1
- package/chunks/chunk-I3I7T4UD.js +21 -0
- package/chunks/chunk-IJVY23RC.js +20 -0
- package/chunks/chunk-IN7H6TNM.js +28 -0
- package/chunks/chunk-JWRKTKTI.js +57 -0
- package/chunks/chunk-MWRDVBYJ.js +121 -0
- package/chunks/{chunk-V7OK6ZT2.js → chunk-O76CR475.js} +1 -1
- package/chunks/chunk-QTFBJ6EE.js +31 -0
- package/chunks/{chunk-KNEXXBOP.js → chunk-QWNOJAU5.js} +1 -1
- package/chunks/{chunk-5UVGUD5O.js → chunk-SN5JDDNY.js} +9 -9
- package/chunks/{chunk-5L7RF4AD.js → chunk-TDTZBA63.js} +1345 -1130
- package/chunks/chunk-TRZXPKUK.js +17 -0
- package/chunks/chunk-Z3U4QH2C.js +9 -0
- package/components/choicebox-group.js +73 -59
- package/components/collapsible.js +73 -59
- package/components/color-picker.js +73 -59
- package/components/index.js +73 -59
- package/components/multiselect.js +73 -59
- package/components/sidebar/context.js +1 -1
- package/components/sidebar/menu-sub.js +1 -1
- package/components/sidebar/menu.js +1 -1
- package/components/sidebar/root.js +1 -1
- package/components/sidebar/trigger.js +1 -1
- package/components/sidebar.js +3 -3
- package/components/string-array.js +3 -1
- package/components/upload.js +73 -59
- package/constants/SexCodes.js +2 -2
- package/constants/index.js +2 -2
- package/hooks/index.js +73 -59
- package/hooks/use-confirm.js +73 -59
- package/hooks/use-cursor-pagination.js +8 -8
- package/hooks/use-upload-chunked.js +8 -8
- package/hooks/use-upload-new.js +8 -8
- package/hooks/use-upload.js +73 -59
- package/index.js +121 -107
- package/modules/attachments/attachments.js +73 -59
- package/modules/attachments/index.js +73 -59
- package/modules/blocks/components/BarcodeAttribute.js +73 -59
- package/modules/blocks/components/BlockEditor.d.ts +2 -2
- package/modules/blocks/components/BlockEditor.js +73 -59
- package/modules/blocks/components/BlockEditorReadOnly.js +73 -59
- package/modules/blocks/components/CustomFileBlock.js +73 -59
- package/modules/blocks/components/CustomImageBlock.js +73 -59
- package/modules/blocks/components/CustomVideoBlock.js +8 -8
- package/modules/blocks/components/Editor.js +73 -59
- package/modules/blocks/components/FontFamilyButton.js +3 -1
- package/modules/blocks/components/GalleryBlock.js +73 -59
- package/modules/blocks/components/ImageStyleButton.js +73 -59
- package/modules/blocks/components/SlashMenu.js +73 -59
- package/modules/blocks/components/SuggestionMenu.js +73 -59
- package/modules/blocks/components/Toolbar.js +73 -59
- package/modules/blocks/components/index.js +73 -59
- package/modules/blocks/components/toolbar/ToolbarContents.d.ts +1 -0
- package/modules/blocks/components/toolbar/ToolbarContents.js +265 -0
- package/modules/blocks/components/toolbar/ToolbarRoot.d.ts +2 -0
- package/modules/blocks/components/toolbar/ToolbarRoot.js +10 -0
- package/modules/blocks/components/toolbar/buttons/ToolbarButton.d.ts +1 -0
- package/modules/blocks/components/toolbar/buttons/ToolbarButton.js +265 -0
- package/modules/blocks/components/toolbar/buttons/ToolbarFormattingButton.d.ts +2 -0
- package/modules/blocks/components/toolbar/buttons/ToolbarFormattingButton.js +10 -0
- package/modules/blocks/components/toolbar/buttons/ToolbarToggle.js +265 -0
- package/modules/blocks/components/toolbar/menus/ToolbarMenuDropdown.d.ts +2 -0
- package/modules/blocks/components/toolbar/menus/ToolbarMenuDropdown.js +10 -0
- package/modules/blocks/components/toolbar/menus/ToolbarMenuItem.d.ts +2 -0
- package/modules/blocks/components/toolbar/menus/ToolbarMenuItem.js +265 -0
- package/modules/blocks/components/toolbar/menus/ToolbarSelect.d.ts +2 -0
- package/modules/blocks/components/toolbar/menus/ToolbarSelect.js +265 -0
- package/modules/blocks/constant/blockEditorSchema.d.ts +9 -7
- package/modules/blocks/constant/blockEditorSchema.js +73 -59
- package/modules/blocks/constant/index.js +73 -59
- package/modules/blocks/constant/toolbar/codeIncompatibleControls.d.ts +1 -0
- package/modules/blocks/constant/toolbar/codeIncompatibleControls.js +6 -0
- package/modules/blocks/constant/toolbar/editorUIComponents.js +263 -0
- package/modules/blocks/constant/toolbar/fontFamilies.d.ts +4 -0
- package/modules/blocks/constant/toolbar/fontFamilies.js +6 -0
- package/modules/blocks/constant/toolbar/imageStyleOptions.d.ts +2 -0
- package/modules/blocks/constant/toolbar/imageStyleOptions.js +6 -0
- package/modules/blocks/hooks/toolbar/useCodeActive.d.ts +1 -0
- package/modules/blocks/hooks/toolbar/useCodeActive.js +7 -0
- package/modules/blocks/hooks/toolbar/useFontFamily.d.ts +2 -0
- package/modules/blocks/hooks/toolbar/useFontFamily.js +7 -0
- package/modules/blocks/hooks/toolbar/useToolbarComponents.d.ts +2 -0
- package/modules/blocks/hooks/toolbar/useToolbarComponents.js +264 -0
- package/modules/blocks/hooks/useBlockEditor.d.ts +1 -1
- package/modules/blocks/hooks/useBlockEditor.js +73 -59
- package/modules/blocks/index.js +73 -59
- package/modules/blocks/types/EditorBlock.d.ts +2 -0
- package/modules/blocks/types/EditorBlock.js +0 -0
- package/modules/blocks/types/TextEditor.d.ts +2 -1
- package/modules/blocks/types/toolbar/EditorVisibleBounds.d.ts +6 -0
- package/modules/blocks/types/toolbar/EditorVisibleBounds.js +0 -0
- package/modules/blocks/types/toolbar/FontFamily.d.ts +5 -0
- package/modules/blocks/types/toolbar/FontFamily.js +0 -0
- package/modules/blocks/types/toolbar/FormattingShortcut.d.ts +7 -0
- package/modules/blocks/types/toolbar/FormattingShortcut.js +0 -0
- package/modules/blocks/types/toolbar/ImageStyleOption.d.ts +7 -0
- package/modules/blocks/types/toolbar/ImageStyleOption.js +0 -0
- package/modules/blocks/types/toolbar/ToolbarFormattingButtonProps.d.ts +5 -0
- package/modules/blocks/types/toolbar/ToolbarFormattingButtonProps.js +0 -0
- package/modules/blocks/types/toolbar/ToolbarMenuItemProps.d.ts +4 -0
- package/modules/blocks/types/toolbar/ToolbarMenuItemProps.js +0 -0
- package/modules/blocks/types/toolbar/ToolbarPositioningOptions.d.ts +3 -0
- package/modules/blocks/types/toolbar/ToolbarPositioningOptions.js +0 -0
- package/modules/blocks/utils/getSlashMenuItems.d.ts +3 -0
- package/modules/blocks/utils/getSlashMenuItems.js +8 -0
- package/modules/blocks/utils/isEmptyBlock.d.ts +2 -0
- package/modules/blocks/utils/isEmptyBlock.js +6 -0
- package/modules/blocks/utils/removeCodeFormattingFromHTML.d.ts +1 -0
- package/modules/blocks/utils/removeCodeFormattingFromHTML.js +6 -0
- package/modules/blocks/utils/toolbar/getEditorVisibleBounds.d.ts +2 -0
- package/modules/blocks/utils/toolbar/getEditorVisibleBounds.js +6 -0
- package/modules/blocks/utils/toolbar/getToolbarPositioning.d.ts +2 -0
- package/modules/blocks/utils/toolbar/getToolbarPositioning.js +7 -0
- package/modules/blocks/utils/toolbar/isCodeFormattingShortcut.d.ts +2 -0
- package/modules/blocks/utils/toolbar/isCodeFormattingShortcut.js +6 -0
- package/modules/board/components/Board.js +73 -59
- package/modules/board/index.js +73 -59
- package/modules/chat-viz/components/ChatVizArea.js +2 -2
- package/modules/chat-viz/components/ChatVizBar.js +2 -2
- package/modules/chat-viz/components/ChatVizLine.js +2 -2
- package/modules/chat-viz/components/ChatVizMessage.js +7 -7
- package/modules/chat-viz/index.js +19 -19
- package/modules/display/components/CurrencyDisplay.js +8 -8
- package/modules/display/components/EmailDisplay.d.ts +2 -2
- package/modules/display/components/EmailDisplay.js +73 -59
- package/modules/display/components/PhoneDisplay.js +73 -59
- package/modules/display/components/RelativeDateDisplay.js +73 -59
- package/modules/display/components/SexDisplay.js +2 -2
- package/modules/display/index.js +75 -61
- package/modules/display/types/emailDisplay.d.ts +6 -0
- package/modules/display/types/emailDisplay.js +0 -0
- package/modules/display/utils/formatPhones.js +2 -2
- package/modules/email-editor/components/EmailEditor.js +73 -59
- package/modules/email-editor/components/EmailPreviewDeviceToggle.js +73 -59
- package/modules/email-editor/components/EmailTableBackground.js +73 -59
- package/modules/email-editor/components/EmailTableToolbar.js +73 -59
- package/modules/email-editor/components/index.js +74 -60
- package/modules/email-editor/index.js +76 -62
- package/modules/filter/components/Filter.js +73 -59
- package/modules/filter/date-filter/components/DateFilterCommand.js +73 -59
- package/modules/filter/date-filter/components/DialogDateView.js +73 -59
- package/modules/filter/date-filter/index.js +73 -59
- package/modules/filter/date-filter/utils/parseDateRangeFromString.js +8 -8
- package/modules/filter/index.js +73 -59
- package/modules/focus-sheet/components/focus-sheet.js +73 -59
- package/modules/hotkey/components/PopoverScoped.js +73 -59
- package/modules/hotkey/hooks/usePreviousHotkeyScope.js +2 -2
- package/modules/hotkey/hooks/useSequenceHotkeys.js +4 -4
- package/modules/hotkey/index.js +73 -59
- package/modules/icons/components/IconPicker.js +73 -59
- package/modules/icons/index.js +73 -59
- package/modules/index.js +101 -87
- package/modules/inputs/components/CurrencyField.js +73 -59
- package/modules/inputs/components/EmailField.js +73 -59
- package/modules/inputs/components/FullNameField.js +73 -59
- package/modules/inputs/components/LanguageSelect.js +73 -59
- package/modules/inputs/components/PhoneField.js +73 -59
- package/modules/inputs/components/SexField.js +73 -59
- package/modules/inputs/components/TimezoneSelect.js +73 -59
- package/modules/inputs/index.js +75 -61
- package/modules/layout/components/AppLayout.js +4 -4
- package/modules/layout/index.js +4 -4
- package/modules/navigation-menu/components/NavigationMenu.js +73 -59
- package/modules/navigation-menu/index.js +75 -61
- package/modules/preview/components/Preview.js +73 -59
- package/modules/record-field/components/NumberField.js +73 -59
- package/modules/record-field/components/TextField.js +73 -59
- package/modules/record-field/index.js +73 -59
- package/modules/record-field/meta-inputs/components/EmailVerificationInput.js +73 -59
- package/modules/record-field/meta-inputs/components/PhoneInput.js +73 -59
- package/modules/record-field/meta-inputs/components/PhoneVerificationInput.js +73 -59
- package/modules/record-field/meta-inputs/components/TextFieldInput.js +73 -59
- package/modules/record-table/components/MoreColumn.js +73 -59
- package/modules/record-table/components/RecordTableArrowEffect.js +73 -59
- package/modules/record-table/components/RecordTableCell.js +73 -59
- package/modules/record-table/components/RecordTableCellInline.js +73 -59
- package/modules/record-table/components/RecordTableColumnSelector.js +73 -59
- package/modules/record-table/components/RecordTableCursor.js +73 -59
- package/modules/record-table/components/RecordTableHead.js +73 -59
- package/modules/record-table/components/RecordTableHeader.js +73 -59
- package/modules/record-table/components/RecordTableHotkeyCell.js +73 -59
- package/modules/record-table/components/RecordTableProvider.js +2 -2
- package/modules/record-table/components/RecordTableRoot.js +73 -59
- package/modules/record-table/components/RecordTableRow.js +73 -59
- package/modules/record-table/components/RecordTableRowList.js +73 -59
- package/modules/record-table/components/RecordTableRowSkeleton.js +73 -59
- package/modules/record-table/components/RecordTableScroll.js +73 -59
- package/modules/record-table/components/RecordTableTree.js +73 -59
- package/modules/record-table/contexts/RecordTableHotkeyContext.js +73 -59
- package/modules/record-table/hooks/usePopoverOnEnter.js +73 -59
- package/modules/record-table/index.js +74 -60
- package/modules/report/components/report-page-container.js +73 -59
- package/modules/report/index.js +73 -59
- package/modules/select-operation/components/SelectOperation.js +73 -59
- package/modules/select-operation/index.js +73 -59
- package/modules/select-tree/components/SelectTree.js +73 -59
- package/modules/select-tree/hooks/useSelectTreeHide.js +2 -2
- package/modules/select-tree/index.js +73 -59
- package/modules/side-menu/components/SideMenu.js +73 -59
- package/package.json +10 -2
- package/styles.css +1 -1
- package/types/index.js +4 -4
- package/utils/core.js +8 -8
- package/utils/index.js +26 -26
- package/utils/localization/index.js +3 -3
- package/LICENSE.md +0 -672
- package/chunks/chunk-AHUBVFX5.js +0 -63
- package/chunks/chunk-YYNRA3GZ.js +0 -104
- package/chunks/{chunk-UQJA4TBO.js → chunk-AQEBKBOC.js} +3 -3
- package/chunks/{chunk-XREHNAPK.js → chunk-MBEYRZZN.js} +3 -3
- package/chunks/{chunk-2G6X7LOG.js → chunk-MSSVDJPS.js} +3 -3
- package/chunks/{chunk-XDSYT6EE.js → chunk-R7LIWID7.js} +3 -3
- package/chunks/{chunk-NLPBCYLN.js → chunk-RGR6MIXH.js} +3 -3
- package/chunks/{chunk-2RKVJ44N.js → chunk-UXDXIN6Q.js} +3 -3
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/modules/blocks/utils/toolbar/getEditorVisibleBounds.ts
|
|
2
|
+
var getEditorVisibleBounds = (editor) => {
|
|
3
|
+
const bounds = editor.getBoundingClientRect();
|
|
4
|
+
let top = 0;
|
|
5
|
+
let bottom = window.innerHeight;
|
|
6
|
+
let left = Math.max(0, bounds.left);
|
|
7
|
+
let right = Math.min(window.innerWidth, bounds.right);
|
|
8
|
+
for (let parent = editor.parentElement; parent; parent = parent.parentElement) {
|
|
9
|
+
const style = getComputedStyle(parent);
|
|
10
|
+
const clipsY = /(auto|scroll|hidden|clip)/.test(style.overflowY);
|
|
11
|
+
const clipsX = /(auto|scroll|hidden|clip)/.test(style.overflowX);
|
|
12
|
+
if (!clipsY && !clipsX)
|
|
13
|
+
continue;
|
|
14
|
+
const rect = parent.getBoundingClientRect();
|
|
15
|
+
if (clipsY) {
|
|
16
|
+
top = Math.max(top, rect.top);
|
|
17
|
+
bottom = Math.min(bottom, rect.bottom);
|
|
18
|
+
}
|
|
19
|
+
if (clipsX) {
|
|
20
|
+
left = Math.max(left, rect.left);
|
|
21
|
+
right = Math.min(right, rect.right);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return { top, bottom, left, right };
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
getEditorVisibleBounds
|
|
29
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/modules/blocks/utils/removeCodeFormattingFromHTML.ts
|
|
2
|
+
var removeCodeFormattingFromHTML = (html) => {
|
|
3
|
+
const template = document.createElement("template");
|
|
4
|
+
template.innerHTML = html;
|
|
5
|
+
template.content.querySelectorAll("code").forEach((code) => {
|
|
6
|
+
code.replaceChildren(document.createTextNode(code.textContent ?? ""));
|
|
7
|
+
code.removeAttribute("class");
|
|
8
|
+
});
|
|
9
|
+
return template.innerHTML;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
removeCodeFormattingFromHTML
|
|
14
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-KTBDECJI.js";
|
|
4
|
+
|
|
5
|
+
// src/modules/blocks/components/toolbar/menus/ToolbarMenuDropdown.tsx
|
|
6
|
+
import { components } from "@blocknote/shadcn";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var ToolbarMenuDropdown = ({
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}) => /* @__PURE__ */ jsx(
|
|
12
|
+
components.Generic.Menu.Dropdown,
|
|
13
|
+
{
|
|
14
|
+
...props,
|
|
15
|
+
className: cn(
|
|
16
|
+
"max-h-[min(20rem,50dvh)]! overflow-y-auto! overscroll-contain",
|
|
17
|
+
className
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
ToolbarMenuDropdown
|
|
24
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FONT_FAMILIES
|
|
3
|
+
} from "./chunk-IN7H6TNM.js";
|
|
4
|
+
import {
|
|
5
|
+
useFontFamily
|
|
6
|
+
} from "./chunk-EKACQ5FS.js";
|
|
7
|
+
|
|
8
|
+
// src/modules/blocks/components/FontFamilyButton.tsx
|
|
9
|
+
import { useComponentsContext } from "@blocknote/react";
|
|
10
|
+
import { IconTypography } from "@tabler/icons-react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
var FontFamilyButton = () => {
|
|
13
|
+
const Components = useComponentsContext();
|
|
14
|
+
const { currentFont, isFileBlock, handleFontChange } = useFontFamily();
|
|
15
|
+
if (!Components || isFileBlock) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return /* @__PURE__ */ jsxs(Components.Generic.Menu.Root, { children: [
|
|
19
|
+
/* @__PURE__ */ jsx(Components.Generic.Menu.Trigger, { children: /* @__PURE__ */ jsx(
|
|
20
|
+
Components.FormattingToolbar.Button,
|
|
21
|
+
{
|
|
22
|
+
"data-test": "fontFamily",
|
|
23
|
+
className: "bn-button",
|
|
24
|
+
label: "Font",
|
|
25
|
+
mainTooltip: "Font Family",
|
|
26
|
+
icon: /* @__PURE__ */ jsx(IconTypography, { size: 16 })
|
|
27
|
+
}
|
|
28
|
+
) }),
|
|
29
|
+
/* @__PURE__ */ jsx(Components.Generic.Menu.Dropdown, { className: "bn-menu-dropdown bn-drag-handle-menu", children: FONT_FAMILIES.map((font) => /* @__PURE__ */ jsx(
|
|
30
|
+
Components.Generic.Menu.Item,
|
|
31
|
+
{
|
|
32
|
+
checked: currentFont === font.value,
|
|
33
|
+
onClick: () => handleFontChange(font.value),
|
|
34
|
+
children: /* @__PURE__ */ jsx(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: "flex items-center gap-2 w-full",
|
|
38
|
+
style: { fontFamily: font.value },
|
|
39
|
+
children: font.name
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
},
|
|
43
|
+
font.value || "default"
|
|
44
|
+
)) })
|
|
45
|
+
] });
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
FontFamilyButton
|
|
50
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// src/modules/blocks/utils/getSlashMenuItems.tsx
|
|
2
|
+
import { getDefaultReactSlashMenuItems } from "@blocknote/react";
|
|
3
|
+
import { filterSuggestionItems } from "@blocknote/core";
|
|
4
|
+
import { IconPhoto } from "@tabler/icons-react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
var getSlashMenuItems = (query, editor, additionalSlashMenuItems) => {
|
|
7
|
+
const items = getDefaultReactSlashMenuItems(editor);
|
|
8
|
+
const hasImageItem = items.some((item) => item.title === "Image");
|
|
9
|
+
const hasCustomImageBlock = "image" in editor.schema.blockSchema;
|
|
10
|
+
const filePanelPlugin = editor.filePanel?.plugins[0];
|
|
11
|
+
if (!hasImageItem && hasCustomImageBlock && filePanelPlugin) {
|
|
12
|
+
items.splice(9, 0, {
|
|
13
|
+
title: editor.dictionary.slash_menu.image.title,
|
|
14
|
+
subtext: editor.dictionary.slash_menu.image.subtext,
|
|
15
|
+
aliases: editor.dictionary.slash_menu.image.aliases,
|
|
16
|
+
badge: void 0,
|
|
17
|
+
group: editor.dictionary.slash_menu.image.group,
|
|
18
|
+
onItemClick: () => {
|
|
19
|
+
const currentBlock = editor.getTextCursorPosition().block;
|
|
20
|
+
const insertedBlock = editor.insertBlocks(
|
|
21
|
+
[{ type: "image" }],
|
|
22
|
+
currentBlock,
|
|
23
|
+
"after"
|
|
24
|
+
)[0];
|
|
25
|
+
editor.transact(
|
|
26
|
+
(tr) => tr.setMeta(filePanelPlugin, {
|
|
27
|
+
block: insertedBlock
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if ("gallery" in editor.schema.blockSchema) {
|
|
34
|
+
items.push({
|
|
35
|
+
title: "Gallery",
|
|
36
|
+
subtext: "Insert a multi-image gallery grid",
|
|
37
|
+
aliases: ["gallery", "images", "grid"],
|
|
38
|
+
badge: void 0,
|
|
39
|
+
group: editor.dictionary.slash_menu.image.group,
|
|
40
|
+
icon: /* @__PURE__ */ jsx(IconPhoto, { size: 18 }),
|
|
41
|
+
onItemClick: () => {
|
|
42
|
+
const currentBlock = editor.getTextCursorPosition().block;
|
|
43
|
+
editor.insertBlocks([{ type: "gallery" }], currentBlock, "after");
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const customItems = typeof additionalSlashMenuItems === "function" ? additionalSlashMenuItems(editor) : additionalSlashMenuItems;
|
|
48
|
+
if (customItems?.length) {
|
|
49
|
+
items.push(...customItems);
|
|
50
|
+
}
|
|
51
|
+
return Promise.resolve(filterSuggestionItems(items, query));
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
getSlashMenuItems
|
|
56
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// src/modules/blocks/hooks/toolbar/useFontFamily.ts
|
|
2
|
+
import {
|
|
3
|
+
useBlockNoteEditor,
|
|
4
|
+
useEditorContentOrSelectionChange
|
|
5
|
+
} from "@blocknote/react";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
var useFontFamily = () => {
|
|
8
|
+
const editor = useBlockNoteEditor();
|
|
9
|
+
const [currentFont, setCurrentFont] = useState(() => {
|
|
10
|
+
const styles = editor.getActiveStyles();
|
|
11
|
+
return styles.fontFamily || "";
|
|
12
|
+
});
|
|
13
|
+
const [isFileBlock, setIsFileBlock] = useState(false);
|
|
14
|
+
useEditorContentOrSelectionChange(() => {
|
|
15
|
+
if (!editor)
|
|
16
|
+
return;
|
|
17
|
+
try {
|
|
18
|
+
const styles = editor.getActiveStyles();
|
|
19
|
+
setCurrentFont(styles?.fontFamily || "");
|
|
20
|
+
const block = editor.getTextCursorPosition()?.block;
|
|
21
|
+
const blockSpec = block ? editor.schema.blockSpecs[block.type] : null;
|
|
22
|
+
setIsFileBlock(!!blockSpec?.config?.isFileBlock);
|
|
23
|
+
} catch {
|
|
24
|
+
}
|
|
25
|
+
}, editor);
|
|
26
|
+
const handleFontChange = (fontValue) => {
|
|
27
|
+
if (!editor)
|
|
28
|
+
return;
|
|
29
|
+
try {
|
|
30
|
+
if (fontValue === "") {
|
|
31
|
+
editor.removeStyles({ fontFamily: "" });
|
|
32
|
+
} else {
|
|
33
|
+
editor.addStyles({ fontFamily: fontValue });
|
|
34
|
+
}
|
|
35
|
+
editor.focus();
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error("Error changing font:", error);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return { currentFont, isFileBlock, handleFontChange };
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
useFontFamily
|
|
45
|
+
};
|
|
@@ -45,7 +45,7 @@ var SidebarMenuSubButton = React.forwardRef(({ asChild = false, size = "md", isA
|
|
|
45
45
|
"data-size": size,
|
|
46
46
|
"data-active": isActive,
|
|
47
47
|
className: cn(
|
|
48
|
-
"flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded px-2 outline-hidden font-
|
|
48
|
+
"flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded px-2 outline-hidden font-normal hover:bg-accent focus-visible:ring-2 active:bg-accent disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
49
49
|
"data-[active=true]:bg-primary/10 data-[active=true]:text-primary data-[active=true]:font-semibold data-[active=true]:[&>svg]:text-primary data-[active=true]:[&>svg]:animate-icon-pop motion-reduce:[&>svg]:animate-none [&>svg]:transition-transform active:[&>svg]:scale-90",
|
|
50
50
|
size === "sm" && "text-xs",
|
|
51
51
|
size === "md" && "text-sm",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-KTBDECJI.js";
|
|
4
|
+
|
|
5
|
+
// src/modules/blocks/components/toolbar/ToolbarRoot.tsx
|
|
6
|
+
import { components } from "@blocknote/shadcn";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var ToolbarRoot = ({
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}) => /* @__PURE__ */ jsx(
|
|
12
|
+
components.FormattingToolbar.Root,
|
|
13
|
+
{
|
|
14
|
+
...props,
|
|
15
|
+
className: cn("min-w-0 max-w-full flex-wrap!", className)
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
ToolbarRoot
|
|
21
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/modules/blocks/hooks/toolbar/useCodeActive.ts
|
|
2
|
+
import {
|
|
3
|
+
useBlockNoteEditor,
|
|
4
|
+
useEditorContentOrSelectionChange
|
|
5
|
+
} from "@blocknote/react";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
var useCodeActive = () => {
|
|
8
|
+
const editor = useBlockNoteEditor();
|
|
9
|
+
const [codeActive, setCodeActive] = useState(
|
|
10
|
+
Boolean(editor.getActiveStyles().code)
|
|
11
|
+
);
|
|
12
|
+
useEditorContentOrSelectionChange(() => {
|
|
13
|
+
setCodeActive(Boolean(editor.getActiveStyles().code));
|
|
14
|
+
}, editor);
|
|
15
|
+
return codeActive;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
useCodeActive
|
|
20
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/modules/blocks/constant/toolbar/fontFamilies.ts
|
|
2
|
+
var FONT_FAMILIES = [
|
|
3
|
+
{ name: "Default", value: "" },
|
|
4
|
+
{ name: "Arial", value: "Arial, sans-serif" },
|
|
5
|
+
{ name: "Helvetica", value: "Helvetica, sans-serif" },
|
|
6
|
+
{ name: "Times New Roman", value: '"Times New Roman", serif' },
|
|
7
|
+
{ name: "Georgia", value: "Georgia, serif" },
|
|
8
|
+
{ name: "Garamond", value: "Garamond, serif" },
|
|
9
|
+
{ name: "Courier New", value: '"Courier New", monospace' },
|
|
10
|
+
{ name: "Verdana", value: "Verdana, sans-serif" },
|
|
11
|
+
{ name: "Trebuchet MS", value: '"Trebuchet MS", sans-serif' },
|
|
12
|
+
{ name: "Palatino", value: "Palatino, serif" },
|
|
13
|
+
{ name: "Tahoma", value: "Tahoma, sans-serif" },
|
|
14
|
+
{ name: "Century Gothic", value: '"Century Gothic", sans-serif' },
|
|
15
|
+
{ name: "Lucida Sans", value: '"Lucida Sans", sans-serif' },
|
|
16
|
+
{ name: "Monaco", value: "Monaco, monospace" },
|
|
17
|
+
{ name: "Consolas", value: "Consolas, monospace" },
|
|
18
|
+
{ name: "Calibri", value: "Calibri, sans-serif" },
|
|
19
|
+
{ name: "Cambria", value: "Cambria, serif" },
|
|
20
|
+
{ name: "Didot", value: "Didot, serif" },
|
|
21
|
+
{ name: "Rockwell", value: "Rockwell, serif" },
|
|
22
|
+
{ name: "Franklin Gothic", value: '"Franklin Gothic Medium", sans-serif' },
|
|
23
|
+
{ name: "Impact", value: "Impact, fantasy" }
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
FONT_FAMILIES
|
|
28
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getEditorVisibleBounds
|
|
3
|
+
} from "./chunk-4EIP6AVX.js";
|
|
4
|
+
|
|
5
|
+
// src/modules/blocks/utils/toolbar/getToolbarPositioning.ts
|
|
6
|
+
var getToolbarPositioning = (getEditorElement) => ({
|
|
7
|
+
middleware: [
|
|
8
|
+
{
|
|
9
|
+
name: "editorBoundary",
|
|
10
|
+
fn: ({ elements, rects, x, y }) => {
|
|
11
|
+
const editor = getEditorElement();
|
|
12
|
+
if (!editor)
|
|
13
|
+
return { x, y };
|
|
14
|
+
const { top, bottom, left, right } = getEditorVisibleBounds(editor);
|
|
15
|
+
const anchor = elements.reference.getBoundingClientRect();
|
|
16
|
+
const maxWidth = `${Math.floor(Math.max(0, right - left))}px`;
|
|
17
|
+
if (elements.floating.style.maxWidth !== maxWidth) {
|
|
18
|
+
elements.floating.style.maxWidth = maxWidth;
|
|
19
|
+
return { reset: { rects: true } };
|
|
20
|
+
}
|
|
21
|
+
const originX = anchor.left - rects.reference.x;
|
|
22
|
+
const originY = anchor.top - rects.reference.y;
|
|
23
|
+
const above = anchor.top - rects.floating.height - 10;
|
|
24
|
+
elements.floating.style.visibility = anchor.bottom <= top || anchor.top >= bottom ? "hidden" : "";
|
|
25
|
+
return {
|
|
26
|
+
x: Math.max(
|
|
27
|
+
left,
|
|
28
|
+
Math.min(x + originX, right - rects.floating.width)
|
|
29
|
+
) - originX,
|
|
30
|
+
y: Math.max(
|
|
31
|
+
top,
|
|
32
|
+
Math.min(
|
|
33
|
+
above >= top ? above : anchor.bottom + 10,
|
|
34
|
+
bottom - rects.floating.height
|
|
35
|
+
)
|
|
36
|
+
) - originY
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
whileElementsMounted: (_reference, _floating, update) => {
|
|
42
|
+
update();
|
|
43
|
+
const editor = getEditorElement();
|
|
44
|
+
if (!editor)
|
|
45
|
+
return () => void 0;
|
|
46
|
+
editor.ownerDocument.addEventListener("scroll", update, true);
|
|
47
|
+
window.addEventListener("resize", update);
|
|
48
|
+
return () => {
|
|
49
|
+
editor.ownerDocument.removeEventListener("scroll", update, true);
|
|
50
|
+
window.removeEventListener("resize", update);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
getToolbarPositioning
|
|
57
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import {
|
|
2
|
+
handleStringArrayPaste
|
|
3
|
+
} from "./chunk-WLKDIP4Y.js";
|
|
4
|
+
import {
|
|
5
|
+
Input
|
|
6
|
+
} from "./chunk-KT3H4JCX.js";
|
|
7
|
+
import {
|
|
8
|
+
buttonVariants
|
|
9
|
+
} from "./chunk-DCCZEG7Z.js";
|
|
10
|
+
import {
|
|
11
|
+
cn
|
|
12
|
+
} from "./chunk-KTBDECJI.js";
|
|
13
|
+
|
|
14
|
+
// src/components/string-array.tsx
|
|
15
|
+
import { IconX } from "@tabler/icons-react";
|
|
16
|
+
import { useRef, useState } from "react";
|
|
17
|
+
import { Button, Tag, TagGroup, TagList } from "react-aria-components";
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
function StringArrayInput({
|
|
20
|
+
value,
|
|
21
|
+
onValueChange,
|
|
22
|
+
id,
|
|
23
|
+
placeholder,
|
|
24
|
+
styleClasses,
|
|
25
|
+
onBlur,
|
|
26
|
+
splitOnPaste = false
|
|
27
|
+
}) {
|
|
28
|
+
const [draft, setDraft] = useState("");
|
|
29
|
+
const inputRef = useRef(null);
|
|
30
|
+
const lastTagRef = useRef(null);
|
|
31
|
+
return /* @__PURE__ */ jsxs(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: cn(
|
|
35
|
+
"flex items-center rounded bg-background border-none transition-[color,box-shadow] focus-within:shadow-focus outline-none min-h-8 h-auto p-0 px-1 gap-1 flex-wrap",
|
|
36
|
+
styleClasses?.inlineTagsContainer
|
|
37
|
+
),
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
TagGroup,
|
|
41
|
+
{
|
|
42
|
+
"aria-label": placeholder || "Tags",
|
|
43
|
+
className: "contents",
|
|
44
|
+
onRemove: (keys) => {
|
|
45
|
+
if (inputRef.current?.matches(":disabled"))
|
|
46
|
+
return;
|
|
47
|
+
const nextValue = value.filter((_, index) => !keys.has(index));
|
|
48
|
+
onValueChange(nextValue);
|
|
49
|
+
if (!nextValue.length)
|
|
50
|
+
inputRef.current?.focus();
|
|
51
|
+
},
|
|
52
|
+
children: /* @__PURE__ */ jsx(TagList, { className: "flex flex-wrap gap-1", children: value.map((tag, index) => /* @__PURE__ */ jsxs(
|
|
53
|
+
Tag,
|
|
54
|
+
{
|
|
55
|
+
id: index,
|
|
56
|
+
textValue: tag,
|
|
57
|
+
ref: index === value.length - 1 ? lastTagRef : void 0,
|
|
58
|
+
className: cn(
|
|
59
|
+
"flex items-center h-6 relative bg-background border border-input hover:bg-background rounded-md font-medium text-xs ps-2 pe-5 outline-none data-[focus-visible]:shadow-focus",
|
|
60
|
+
styleClasses?.tag?.body
|
|
61
|
+
),
|
|
62
|
+
children: [
|
|
63
|
+
tag,
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
Button,
|
|
66
|
+
{
|
|
67
|
+
slot: "remove",
|
|
68
|
+
type: "button",
|
|
69
|
+
className: cn(
|
|
70
|
+
buttonVariants({ variant: "ghost", size: "icon" }),
|
|
71
|
+
"absolute -inset-y-px -end-px p-0 rounded-e-md flex size-6 transition-[color,box-shadow] outline-none text-muted-foreground/80 hover:text-foreground",
|
|
72
|
+
styleClasses?.tag?.closeButton
|
|
73
|
+
),
|
|
74
|
+
children: /* @__PURE__ */ jsx(IconX, { className: "size-3", "aria-hidden": "true" })
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
index
|
|
80
|
+
)) })
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ jsx(
|
|
84
|
+
Input,
|
|
85
|
+
{
|
|
86
|
+
ref: inputRef,
|
|
87
|
+
id,
|
|
88
|
+
placeholder: placeholder || "Add a tag",
|
|
89
|
+
"aria-label": placeholder || "Add a tag",
|
|
90
|
+
className: cn(
|
|
91
|
+
"flex-1 w-full min-w-[80px] shadow-none px-2 h-7",
|
|
92
|
+
styleClasses?.input
|
|
93
|
+
),
|
|
94
|
+
value: draft,
|
|
95
|
+
onChange: (event) => setDraft(event.target.value),
|
|
96
|
+
onKeyDown: (event) => {
|
|
97
|
+
if (event.nativeEvent.isComposing)
|
|
98
|
+
return;
|
|
99
|
+
if (event.key === "Enter" || event.key === ",") {
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
const tag = draft.trim();
|
|
102
|
+
if (tag && !value.includes(tag))
|
|
103
|
+
onValueChange([...value, tag]);
|
|
104
|
+
setDraft("");
|
|
105
|
+
} else if (event.key === "ArrowLeft" && !draft && value.length) {
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
lastTagRef.current?.focus();
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
onBlur,
|
|
111
|
+
onPaste: (event) => splitOnPaste && handleStringArrayPaste({ event, value, onValueChange })
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export {
|
|
120
|
+
StringArrayInput
|
|
121
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useCodeActive
|
|
3
|
+
} from "./chunk-IJVY23RC.js";
|
|
4
|
+
import {
|
|
5
|
+
CODE_INCOMPATIBLE_CONTROLS
|
|
6
|
+
} from "./chunk-CAV3X4PT.js";
|
|
7
|
+
|
|
8
|
+
// src/modules/blocks/components/toolbar/buttons/ToolbarFormattingButton.tsx
|
|
9
|
+
import { components } from "@blocknote/shadcn";
|
|
10
|
+
import { forwardRef } from "react";
|
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
|
+
var ToolbarFormattingButton = forwardRef((props, ref) => {
|
|
13
|
+
const codeActive = useCodeActive();
|
|
14
|
+
const codeIncompatible = CODE_INCOMPATIBLE_CONTROLS.includes(
|
|
15
|
+
props["data-test"] ?? ""
|
|
16
|
+
);
|
|
17
|
+
const disabledByCode = codeActive && codeIncompatible;
|
|
18
|
+
const buttonProps = {
|
|
19
|
+
...props,
|
|
20
|
+
ref,
|
|
21
|
+
disabled: props.disabled || props.isDisabled || disabledByCode,
|
|
22
|
+
isDisabled: props.isDisabled || disabledByCode,
|
|
23
|
+
isSelected: disabledByCode && props.isSelected !== void 0 ? false : props.isSelected
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ jsx(components.FormattingToolbar.Button, { ...buttonProps });
|
|
26
|
+
});
|
|
27
|
+
ToolbarFormattingButton.displayName = "ToolbarFormattingButton";
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
ToolbarFormattingButton
|
|
31
|
+
};
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChatVizPie
|
|
3
|
-
} from "./chunk-XD4PKWF4.js";
|
|
4
|
-
import {
|
|
5
|
-
sanitizeChartVizPayload
|
|
6
|
-
} from "./chunk-FJLBHW7X.js";
|
|
7
1
|
import {
|
|
8
2
|
applyChartVizTransforms,
|
|
9
3
|
getChartVizInteractiveDomain,
|
|
@@ -11,13 +5,19 @@ import {
|
|
|
11
5
|
} from "./chunk-W5KVCFS2.js";
|
|
12
6
|
import {
|
|
13
7
|
ChatVizArea
|
|
14
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-R7LIWID7.js";
|
|
15
9
|
import {
|
|
16
10
|
ChatVizBar
|
|
17
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-RGR6MIXH.js";
|
|
18
12
|
import {
|
|
19
13
|
ChatVizLine
|
|
20
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MSSVDJPS.js";
|
|
15
|
+
import {
|
|
16
|
+
ChatVizPie
|
|
17
|
+
} from "./chunk-XD4PKWF4.js";
|
|
18
|
+
import {
|
|
19
|
+
sanitizeChartVizPayload
|
|
20
|
+
} from "./chunk-FJLBHW7X.js";
|
|
21
21
|
import {
|
|
22
22
|
Slider
|
|
23
23
|
} from "./chunk-FTTQ6J3Y.js";
|