@forgedevstack/ink 1.1.8 → 1.2.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.
- package/CHANGELOG.md +25 -1
- package/dist/common-components/Box/Box.cjs +1 -1
- package/dist/common-components/Box/Box.js +7 -6
- package/dist/common-components/Button/Button.cjs +1 -1
- package/dist/common-components/Button/Button.js +9 -8
- package/dist/common-components/Canvas/Canvas.cjs +1 -1
- package/dist/common-components/Canvas/Canvas.js +3 -2
- package/dist/common-components/ContextMenu/ContextMenu.cjs +1 -1
- package/dist/common-components/ContextMenu/ContextMenu.js +3 -2
- package/dist/common-components/Field/Field.cjs +1 -1
- package/dist/common-components/Field/Field.js +11 -10
- package/dist/common-components/icons/GripIcon.cjs +1 -1
- package/dist/common-components/icons/GripIcon.js +3 -2
- package/dist/components/InkEditor/InkEditor.cjs +1 -1
- package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
- package/dist/components/InkEditor/InkEditor.js +1301 -1006
- package/dist/components/InkEditor/components/AiPanel/AiPanel.cjs +1 -1
- package/dist/components/InkEditor/components/AiPanel/AiPanel.js +13 -12
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.cjs +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.cjs +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.d.ts +20 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.js +25 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.d.ts +4 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.js +61 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.types.d.ts +11 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.cjs +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.d.ts +19 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.js +30 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.test.d.ts +2 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.test.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/index.d.ts +4 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.cjs +1 -1
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.js +7 -6
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.cjs +1 -1
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.d.ts +2 -0
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.d.ts.map +1 -1
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.js +16 -15
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.cjs +1 -1
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.js +14 -13
- package/dist/components/InkEditor/components/FindReplace/FindReplace.cjs +1 -1
- package/dist/components/InkEditor/components/FindReplace/FindReplace.js +21 -20
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.cjs +1 -1
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.js +17 -16
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.cjs +1 -1
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.js +3 -2
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.cjs +1 -1
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.js +7 -6
- package/dist/components/InkEditor/components/ImageFrame/ImageFrame.cjs +1 -0
- package/dist/components/InkEditor/components/ImageFrame/ImageFrame.d.ts +8 -0
- package/dist/components/InkEditor/components/ImageFrame/ImageFrame.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ImageFrame/ImageFrame.js +54 -0
- package/dist/components/InkEditor/components/ImageFrame/index.d.ts +3 -0
- package/dist/components/InkEditor/components/ImageFrame/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.cjs +1 -1
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.js +11 -10
- package/dist/components/InkEditor/components/MentionMenu/MentionMenu.cjs +1 -0
- package/dist/components/InkEditor/components/MentionMenu/MentionMenu.d.ts +16 -0
- package/dist/components/InkEditor/components/MentionMenu/MentionMenu.d.ts.map +1 -0
- package/dist/components/InkEditor/components/MentionMenu/MentionMenu.js +21 -0
- package/dist/components/InkEditor/components/MentionMenu/index.d.ts +3 -0
- package/dist/components/InkEditor/components/MentionMenu/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.cjs +1 -1
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.js +11 -10
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.cjs +1 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.cjs +1 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.d.ts +7 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.js +9 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.d.ts +4 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.d.ts.map +1 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.js +83 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.types.d.ts +8 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/PresenceStack/index.d.ts +3 -0
- package/dist/components/InkEditor/components/PresenceStack/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.cjs +1 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.cjs +1 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.d.ts +7 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.js +10 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.d.ts +4 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.d.ts.map +1 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.js +66 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.types.d.ts +6 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/RemoteCursors/index.d.ts +3 -0
- package/dist/components/InkEditor/components/RemoteCursors/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/InkEditor/components/SignPad/SignPad.js +7 -6
- package/dist/components/InkEditor/components/SlashMenu/SlashMenu.cjs +1 -1
- package/dist/components/InkEditor/components/SlashMenu/SlashMenu.js +7 -6
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.cjs +1 -1
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.cjs +1 -1
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.js +8 -7
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.js +7 -6
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.cjs +1 -1
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.js +7 -6
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.cjs +1 -1
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.js +3 -2
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.js +13 -12
- package/dist/components/InkEditor/components/ToolbarColorPicker/ToolbarColorPicker.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarColorPicker/ToolbarColorPicker.js +9 -8
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.const.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.const.js +9 -8
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.js +9 -8
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.js +19 -18
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.js +6 -5
- package/dist/components/InkEditor/components/VersionHistory/VersionHistory.cjs +1 -0
- package/dist/components/InkEditor/components/VersionHistory/VersionHistory.d.ts +11 -0
- package/dist/components/InkEditor/components/VersionHistory/VersionHistory.d.ts.map +1 -0
- package/dist/components/InkEditor/components/VersionHistory/VersionHistory.js +22 -0
- package/dist/components/InkEditor/components/VersionHistory/index.d.ts +3 -0
- package/dist/components/InkEditor/components/VersionHistory/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/index.d.ts +11 -0
- package/dist/components/InkEditor/components/index.d.ts.map +1 -1
- package/dist/components/InkEditor/helpers/format.utils.cjs +3 -2
- package/dist/components/InkEditor/helpers/format.utils.d.ts +1 -0
- package/dist/components/InkEditor/helpers/format.utils.d.ts.map +1 -1
- package/dist/components/InkEditor/helpers/format.utils.js +106 -84
- package/dist/components/InkEditor/helpers/index.d.ts +1 -1
- package/dist/components/InkEditor/helpers/index.d.ts.map +1 -1
- package/dist/components/InkTabs/InkTabs.cjs +1 -0
- package/dist/components/InkTabs/InkTabs.d.ts +4 -0
- package/dist/components/InkTabs/InkTabs.d.ts.map +1 -0
- package/dist/components/InkTabs/InkTabs.js +104 -0
- package/dist/components/InkTabs/index.d.ts +2 -0
- package/dist/components/InkTabs/index.d.ts.map +1 -0
- package/dist/components/InkWorkspace/InkWorkspace.cjs +1 -0
- package/dist/components/InkWorkspace/InkWorkspace.d.ts +4 -0
- package/dist/components/InkWorkspace/InkWorkspace.d.ts.map +1 -0
- package/dist/components/InkWorkspace/InkWorkspace.js +309 -0
- package/dist/components/InkWorkspace/components/WorkspaceIcons.cjs +1 -0
- package/dist/components/InkWorkspace/components/WorkspaceIcons.d.ts +11 -0
- package/dist/components/InkWorkspace/components/WorkspaceIcons.d.ts.map +1 -0
- package/dist/components/InkWorkspace/components/WorkspaceIcons.js +39 -0
- package/dist/components/InkWorkspace/hooks/useInkWorkspace.cjs +1 -0
- package/dist/components/InkWorkspace/hooks/useInkWorkspace.d.ts +30 -0
- package/dist/components/InkWorkspace/hooks/useInkWorkspace.d.ts.map +1 -0
- package/dist/components/InkWorkspace/hooks/useInkWorkspace.js +73 -0
- package/dist/components/InkWorkspace/index.d.ts +4 -0
- package/dist/components/InkWorkspace/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/constants/collab.const.cjs +1 -0
- package/dist/constants/collab.const.d.ts +20 -0
- package/dist/constants/collab.const.d.ts.map +1 -0
- package/dist/constants/collab.const.js +54 -0
- package/dist/constants/contextMenu.const.cjs +1 -1
- package/dist/constants/contextMenu.const.d.ts +8 -0
- package/dist/constants/contextMenu.const.d.ts.map +1 -1
- package/dist/constants/contextMenu.const.js +30 -22
- package/dist/constants/defaultIcons.cjs +1 -1
- package/dist/constants/defaultIcons.js +6 -5
- package/dist/constants/defaults.const.cjs +1 -1
- package/dist/constants/defaults.const.d.ts.map +1 -1
- package/dist/constants/defaults.const.js +150 -138
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/numbers.cjs +1 -1
- package/dist/constants/numbers.js +43 -37
- package/dist/constants/toolbar.const.cjs +1 -1
- package/dist/constants/toolbar.const.d.ts +7 -0
- package/dist/constants/toolbar.const.d.ts.map +1 -1
- package/dist/constants/toolbar.const.js +16 -9
- package/dist/constants/toolbarMenu.const.cjs +1 -1
- package/dist/constants/toolbarMenu.const.d.ts.map +1 -1
- package/dist/constants/toolbarMenu.const.js +25 -11
- package/dist/constants/workspace.const.cjs +1 -0
- package/dist/constants/workspace.const.d.ts +24 -0
- package/dist/constants/workspace.const.d.ts.map +1 -0
- package/dist/constants/workspace.const.js +23 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useInkCollaboration.cjs +1 -0
- package/dist/hooks/useInkCollaboration.d.ts +4 -0
- package/dist/hooks/useInkCollaboration.d.ts.map +1 -0
- package/dist/hooks/useInkCollaboration.js +87 -0
- package/dist/hooks/useToolbarOverflow.cjs +1 -1
- package/dist/hooks/useToolbarOverflow.js +12 -11
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +151 -135
- package/dist/plugins/ai/demoProvider.cjs +1 -1
- package/dist/plugins/ai/demoProvider.js +3 -2
- package/dist/plugins/ai/index.cjs +1 -1
- package/dist/plugins/ai/index.js +25 -24
- package/dist/plugins/excel/excel.utils.cjs +1 -1
- package/dist/plugins/excel/excel.utils.js +17 -16
- package/dist/plugins/graph/graph.utils.cjs +1 -1
- package/dist/plugins/graph/graph.utils.js +7 -6
- package/dist/plugins/titles/titles.const.cjs +1 -1
- package/dist/plugins/titles/titles.const.js +9 -8
- package/dist/plugins/titles/titles.utils.cjs +1 -1
- package/dist/plugins/titles/titles.utils.js +3 -2
- package/dist/styles.css +1 -1
- package/dist/types/collab.types.d.ts +54 -0
- package/dist/types/collab.types.d.ts.map +1 -0
- package/dist/types/features.types.d.ts +1 -1
- package/dist/types/features.types.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/ink.types.d.ts +3 -1
- package/dist/types/ink.types.d.ts.map +1 -1
- package/dist/types/workspace.types.d.ts +54 -0
- package/dist/types/workspace.types.d.ts.map +1 -0
- package/dist/utils/blocks.utils.cjs +1 -1
- package/dist/utils/blocks.utils.js +19 -18
- package/dist/utils/collab.utils.cjs +1 -0
- package/dist/utils/collab.utils.d.ts +5 -0
- package/dist/utils/collab.utils.d.ts.map +1 -0
- package/dist/utils/collab.utils.js +33 -0
- package/dist/utils/collab.utils.test.d.ts +2 -0
- package/dist/utils/collab.utils.test.d.ts.map +1 -0
- package/dist/utils/comments.utils.cjs +1 -1
- package/dist/utils/comments.utils.d.ts +4 -0
- package/dist/utils/comments.utils.d.ts.map +1 -1
- package/dist/utils/comments.utils.js +26 -18
- package/dist/utils/comments.utils.test.d.ts +2 -0
- package/dist/utils/comments.utils.test.d.ts.map +1 -0
- package/dist/utils/exportDocument.utils.cjs +2 -0
- package/dist/utils/exportDocument.utils.d.ts +16 -0
- package/dist/utils/exportDocument.utils.d.ts.map +1 -0
- package/dist/utils/exportDocument.utils.js +85 -0
- package/dist/utils/exportDocument.utils.test.d.ts +2 -0
- package/dist/utils/exportDocument.utils.test.d.ts.map +1 -0
- package/dist/utils/formatPainter.utils.cjs +1 -0
- package/dist/utils/formatPainter.utils.d.ts +11 -0
- package/dist/utils/formatPainter.utils.d.ts.map +1 -0
- package/dist/utils/formatPainter.utils.js +20 -0
- package/dist/utils/formatPainter.utils.test.d.ts +2 -0
- package/dist/utils/formatPainter.utils.test.d.ts.map +1 -0
- package/dist/utils/history.utils.cjs +1 -1
- package/dist/utils/history.utils.js +3 -2
- package/dist/utils/image.utils.cjs +1 -0
- package/dist/utils/image.utils.d.ts +14 -0
- package/dist/utils/image.utils.d.ts.map +1 -0
- package/dist/utils/image.utils.js +33 -0
- package/dist/utils/image.utils.test.d.ts +2 -0
- package/dist/utils/image.utils.test.d.ts.map +1 -0
- package/dist/utils/index.d.ts +12 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/ink.brand.test.d.ts +2 -0
- package/dist/utils/ink.brand.test.d.ts.map +1 -0
- package/dist/utils/license.utils.cjs +1 -1
- package/dist/utils/license.utils.js +8 -7
- package/dist/utils/markdown.utils.cjs +11 -0
- package/dist/utils/markdown.utils.d.ts +7 -0
- package/dist/utils/markdown.utils.d.ts.map +1 -0
- package/dist/utils/markdown.utils.js +87 -0
- package/dist/utils/markdown.utils.test.d.ts +2 -0
- package/dist/utils/markdown.utils.test.d.ts.map +1 -0
- package/dist/utils/mentions.utils.cjs +1 -0
- package/dist/utils/mentions.utils.d.ts +13 -0
- package/dist/utils/mentions.utils.d.ts.map +1 -0
- package/dist/utils/mentions.utils.js +23 -0
- package/dist/utils/mentions.utils.test.d.ts +2 -0
- package/dist/utils/mentions.utils.test.d.ts.map +1 -0
- package/dist/utils/outline.utils.cjs +1 -1
- package/dist/utils/outline.utils.js +9 -8
- package/dist/utils/paste.utils.cjs +1 -1
- package/dist/utils/paste.utils.d.ts +2 -0
- package/dist/utils/paste.utils.d.ts.map +1 -1
- package/dist/utils/paste.utils.js +53 -19
- package/dist/utils/paste.utils.test.d.ts +2 -0
- package/dist/utils/paste.utils.test.d.ts.map +1 -0
- package/dist/utils/premium.utils.cjs +1 -1
- package/dist/utils/premium.utils.js +12 -11
- package/dist/utils/selection.utils.cjs +1 -1
- package/dist/utils/selection.utils.js +3 -2
- package/dist/utils/slash.utils.cjs +1 -1
- package/dist/utils/slash.utils.js +10 -9
- package/dist/utils/table.utils.cjs +1 -1
- package/dist/utils/table.utils.d.ts +8 -0
- package/dist/utils/table.utils.d.ts.map +1 -1
- package/dist/utils/table.utils.js +78 -54
- package/dist/utils/toolbarStorage.utils.cjs +1 -1
- package/dist/utils/toolbarStorage.utils.js +15 -14
- package/dist/utils/trackChanges.utils.cjs +1 -1
- package/dist/utils/trackChanges.utils.js +9 -8
- package/dist/utils/typo.utils.cjs +1 -1
- package/dist/utils/typo.utils.js +8 -7
- package/dist/utils/versions.utils.cjs +1 -0
- package/dist/utils/versions.utils.d.ts +11 -0
- package/dist/utils/versions.utils.d.ts.map +1 -0
- package/dist/utils/versions.utils.js +36 -0
- package/dist/utils/versions.utils.test.d.ts +2 -0
- package/dist/utils/versions.utils.test.d.ts.map +1 -0
- package/dist/utils/words.utils.cjs +1 -1
- package/dist/utils/words.utils.js +3 -2
- package/dist/utils/workspace.utils.cjs +1 -0
- package/dist/utils/workspace.utils.d.ts +5 -0
- package/dist/utils/workspace.utils.d.ts.map +1 -0
- package/dist/utils/workspace.utils.js +26 -0
- package/dist/utils/workspace.utils.test.d.ts +2 -0
- package/dist/utils/workspace.utils.test.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1,37 +1,45 @@
|
|
|
1
|
-
import { INK_COMMENT_HIGHLIGHT_COLOR as
|
|
2
|
-
import { INK_CLASS_COMMENT_MARK as
|
|
1
|
+
import { INK_COMMENT_HIGHLIGHT_COLOR as s } from "../constants/numbers.js";
|
|
2
|
+
import { INK_CLASS_COMMENT_MARK as a } from "../constants/defaults.const.js";
|
|
3
3
|
import "../constants/openai.const.js";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import { createInkId as c } from "./id.utils.js";
|
|
6
6
|
import "./paste.utils.js";
|
|
7
|
+
import "./exportDocument.utils.js";
|
|
7
8
|
import "react";
|
|
8
9
|
import "react-dom";
|
|
9
|
-
const
|
|
10
|
+
const I = (r, e, t) => ({
|
|
10
11
|
id: c("cmt"),
|
|
11
12
|
author: r,
|
|
12
13
|
body: e,
|
|
13
14
|
timestamp: Date.now(),
|
|
14
|
-
highlightId:
|
|
15
|
+
highlightId: t,
|
|
15
16
|
replies: []
|
|
16
|
-
}),
|
|
17
|
+
}), S = (r) => {
|
|
17
18
|
const e = window.getSelection();
|
|
18
19
|
if (!e || e.rangeCount === 0 || e.isCollapsed) return !1;
|
|
19
|
-
const
|
|
20
|
-
|
|
20
|
+
const t = e.getRangeAt(0), n = document.createElement("mark");
|
|
21
|
+
n.className = a, n.dataset.inkComment = r, n.style.backgroundColor = s;
|
|
21
22
|
try {
|
|
22
|
-
return
|
|
23
|
+
return t.surroundContents(n), e.removeAllRanges(), !0;
|
|
23
24
|
} catch {
|
|
24
|
-
const
|
|
25
|
-
return
|
|
25
|
+
const m = t.extractContents();
|
|
26
|
+
return n.appendChild(m), t.insertNode(n), e.removeAllRanges(), !0;
|
|
26
27
|
}
|
|
27
|
-
},
|
|
28
|
-
const
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
}, l = "Ink-comment-mark--resolved", o = (r, e) => {
|
|
29
|
+
const t = r.querySelector(`mark[data-ink-comment="${e}"]`);
|
|
30
|
+
return t instanceof HTMLElement ? t : null;
|
|
31
|
+
}, _ = (r, e) => {
|
|
32
|
+
const t = o(r, e);
|
|
33
|
+
return t ? (t.scrollIntoView({ block: "center" }), !0) : !1;
|
|
34
|
+
}, A = (r, e, t) => {
|
|
35
|
+
const n = o(r, e);
|
|
36
|
+
return n ? (n.classList.toggle(l, t), !0) : !1;
|
|
32
37
|
};
|
|
33
38
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
l as COMMENT_RESOLVED_CLASS,
|
|
40
|
+
I as createCommentThread,
|
|
41
|
+
o as findCommentMark,
|
|
42
|
+
_ as scrollToComment,
|
|
43
|
+
A as setCommentResolvedMark,
|
|
44
|
+
S as wrapSelectionAsComment
|
|
37
45
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.utils.test.d.ts","sourceRoot":"","sources":["../../src/utils/comments.utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=3988292384,L=67324752,P=33639248,R=101010256,g=20,f=new Uint32Array(256);for(let t=0;t<f.length;t+=1){let e=t;for(let n=0;n<8;n+=1)e=e&1?C^e>>>1:e>>>1;f[t]=e>>>0}const T=t=>{let e=4294967295;return t.forEach(n=>{e=f[(e^n)&255]^e>>>8}),(e^4294967295)>>>0},l=(t,e,n)=>{t.setUint16(e,n,!0)},c=(t,e,n)=>{t.setUint32(e,n,!0)},b=t=>{const e=new TextEncoder,n=[],s=[];let m=0;t.forEach(o=>{const a=e.encode(o.name),E=T(o.data),u=new Uint8Array(30+a.length+o.data.length),d=new DataView(u.buffer);c(d,0,L),l(d,4,g),l(d,8,0),c(d,14,E),c(d,18,o.data.length),c(d,22,o.data.length),l(d,26,a.length),u.set(a,30),u.set(o.data,30+a.length),n.push(u);const w=new Uint8Array(46+a.length),r=new DataView(w.buffer);c(r,0,P),l(r,4,g),l(r,6,g),c(r,16,E),c(r,20,o.data.length),c(r,24,o.data.length),l(r,28,a.length),c(r,42,m),w.set(a,46),s.push(w),m+=u.length});const p=s.reduce((o,a)=>o+a.length,0),i=new Uint8Array(22),h=new DataView(i.buffer);c(h,0,R),l(h,8,t.length),l(h,10,t.length),c(h,12,p),c(h,16,m);const _=m+p+i.length,x=new Uint8Array(_);let y=0;return[...n,...s,i].forEach(o=>{x.set(o,y),y+=o.length}),x},D=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),I=t=>{const e=document.createElement("div");e.innerHTML=t;const n=Array.from(e.childNodes).map(s=>(s.textContent??"").replace(/\s+/g," ").trim()).filter(s=>s.length>0);return n.length>0?n:[""]},v=t=>`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2
|
+
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:body>${t.map(n=>`<w:p><w:r><w:t xml:space="preserve">${D(n)}</w:t></w:r></w:p>`).join("")}<w:sectPr/></w:body></w:document>`,O="document.docx",N="application/vnd.openxmlformats-officedocument.wordprocessingml.document",U="Ink document",k=t=>{const e=new TextEncoder,n=[{name:"[Content_Types].xml",data:e.encode('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/></Types>')},{name:"_rels/.rels",data:e.encode('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/></Relationships>')},{name:"word/document.xml",data:e.encode(v(I(t)))}];return b(n)},A=(t,e=U)=>`<!DOCTYPE html><html><head><meta charset="utf-8"><title>${D(e)}</title></head><body>${t}</body></html>`,M=(t,e,n)=>{const s=new Uint8Array(e.byteLength);s.set(e);const m=new Blob([s],{type:n}),p=URL.createObjectURL(m),i=document.createElement("a");i.href=p,i.download=t,i.click(),URL.revokeObjectURL(p)},V=t=>{const e=document.createElement("iframe");e.setAttribute("aria-hidden","true"),e.style.position="fixed",e.style.width="0",e.style.height="0",e.style.border="0",document.body.appendChild(e);const n=e.contentDocument;if(!n||!e.contentWindow){e.remove();return}n.open(),n.write(A(t)),n.close(),e.contentWindow.focus(),e.contentWindow.print(),window.setTimeout(()=>e.remove(),1e3)};exports.DOCX_FILENAME=O;exports.DOCX_MIME=N;exports.PRINT_TITLE=U;exports.buildDocx=k;exports.buildPrintDocument=A;exports.crc32=T;exports.createStoredZip=b;exports.downloadBytes=M;exports.htmlToDocxParagraphs=I;exports.printHtmlDocument=V;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const crc32: (data: Uint8Array) => number;
|
|
2
|
+
interface ZipEntry {
|
|
3
|
+
name: string;
|
|
4
|
+
data: Uint8Array;
|
|
5
|
+
}
|
|
6
|
+
export declare const createStoredZip: (entries: ZipEntry[]) => Uint8Array;
|
|
7
|
+
export declare const htmlToDocxParagraphs: (html: string) => string[];
|
|
8
|
+
export declare const DOCX_FILENAME = "document.docx";
|
|
9
|
+
export declare const DOCX_MIME = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
10
|
+
export declare const PRINT_TITLE = "Ink document";
|
|
11
|
+
export declare const buildDocx: (html: string) => Uint8Array;
|
|
12
|
+
export declare const buildPrintDocument: (html: string, title?: string) => string;
|
|
13
|
+
export declare const downloadBytes: (filename: string, bytes: Uint8Array, mime: string) => void;
|
|
14
|
+
export declare const printHtmlDocument: (html: string) => void;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=exportDocument.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exportDocument.utils.d.ts","sourceRoot":"","sources":["../../src/utils/exportDocument.utils.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,KAAK,GAAI,MAAM,UAAU,KAAG,MAMxC,CAAC;AAEF,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;CAClB;AAUD,eAAO,MAAM,eAAe,GAAI,SAAS,QAAQ,EAAE,KAAG,UAmDrD,CAAC;AAQF,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,KAAG,MAAM,EAOzD,CAAC;AAUF,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,eAAO,MAAM,SAAS,4EAA4E,CAAC;AACnG,eAAO,MAAM,WAAW,iBAAiB,CAAC;AAE1C,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,UAqBxC,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,cAAmB,KAAG,MACkD,CAAC;AAE1H,eAAO,MAAM,aAAa,GAAI,UAAU,MAAM,EAAE,OAAO,UAAU,EAAE,MAAM,MAAM,KAAG,IAUjF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,IAmBhD,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const g = new Uint32Array(256);
|
|
2
|
+
for (let t = 0; t < g.length; t += 1) {
|
|
3
|
+
let e = t;
|
|
4
|
+
for (let n = 0; n < 8; n += 1)
|
|
5
|
+
e = e & 1 ? 3988292384 ^ e >>> 1 : e >>> 1;
|
|
6
|
+
g[t] = e >>> 0;
|
|
7
|
+
}
|
|
8
|
+
const I = (t) => {
|
|
9
|
+
let e = 4294967295;
|
|
10
|
+
return t.forEach((n) => {
|
|
11
|
+
e = g[(e ^ n) & 255] ^ e >>> 8;
|
|
12
|
+
}), (e ^ 4294967295) >>> 0;
|
|
13
|
+
}, r = (t, e, n) => {
|
|
14
|
+
t.setUint16(e, n, !0);
|
|
15
|
+
}, c = (t, e, n) => {
|
|
16
|
+
t.setUint32(e, n, !0);
|
|
17
|
+
}, T = (t) => {
|
|
18
|
+
const e = new TextEncoder(), n = [], s = [];
|
|
19
|
+
let m = 0;
|
|
20
|
+
t.forEach((o) => {
|
|
21
|
+
const a = e.encode(o.name), x = I(o.data), u = new Uint8Array(30 + a.length + o.data.length), d = new DataView(u.buffer);
|
|
22
|
+
c(d, 0, 67324752), r(d, 4, 20), r(d, 8, 0), c(d, 14, x), c(d, 18, o.data.length), c(d, 22, o.data.length), r(d, 26, a.length), u.set(a, 30), u.set(o.data, 30 + a.length), n.push(u);
|
|
23
|
+
const w = new Uint8Array(46 + a.length), l = new DataView(w.buffer);
|
|
24
|
+
c(l, 0, 33639248), r(l, 4, 20), r(l, 6, 20), c(l, 16, x), c(l, 20, o.data.length), c(l, 24, o.data.length), r(l, 28, a.length), c(l, 42, m), w.set(a, 46), s.push(w), m += u.length;
|
|
25
|
+
});
|
|
26
|
+
const p = s.reduce((o, a) => o + a.length, 0), i = new Uint8Array(22), h = new DataView(i.buffer);
|
|
27
|
+
c(h, 0, 101010256), r(h, 8, t.length), r(h, 10, t.length), c(h, 12, p), c(h, 16, m);
|
|
28
|
+
const D = m + p + i.length, f = new Uint8Array(D);
|
|
29
|
+
let E = 0;
|
|
30
|
+
return [...n, ...s, i].forEach((o) => {
|
|
31
|
+
f.set(o, E), E += o.length;
|
|
32
|
+
}), f;
|
|
33
|
+
}, y = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), _ = (t) => {
|
|
34
|
+
const e = document.createElement("div");
|
|
35
|
+
e.innerHTML = t;
|
|
36
|
+
const n = Array.from(e.childNodes).map((s) => (s.textContent ?? "").replace(/\s+/g, " ").trim()).filter((s) => s.length > 0);
|
|
37
|
+
return n.length > 0 ? n : [""];
|
|
38
|
+
}, b = (t) => `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
39
|
+
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:body>${t.map((n) => `<w:p><w:r><w:t xml:space="preserve">${y(n)}</w:t></w:r></w:p>`).join("")}<w:sectPr/></w:body></w:document>`, L = "document.docx", P = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", R = "Ink document", C = (t) => {
|
|
40
|
+
const e = new TextEncoder(), n = [
|
|
41
|
+
{
|
|
42
|
+
name: "[Content_Types].xml",
|
|
43
|
+
data: e.encode(
|
|
44
|
+
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/></Types>'
|
|
45
|
+
)
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "_rels/.rels",
|
|
49
|
+
data: e.encode(
|
|
50
|
+
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/></Relationships>'
|
|
51
|
+
)
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "word/document.xml",
|
|
55
|
+
data: e.encode(b(_(t)))
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
return T(n);
|
|
59
|
+
}, A = (t, e = R) => `<!DOCTYPE html><html><head><meta charset="utf-8"><title>${y(e)}</title></head><body>${t}</body></html>`, U = (t, e, n) => {
|
|
60
|
+
const s = new Uint8Array(e.byteLength);
|
|
61
|
+
s.set(e);
|
|
62
|
+
const m = new Blob([s], { type: n }), p = URL.createObjectURL(m), i = document.createElement("a");
|
|
63
|
+
i.href = p, i.download = t, i.click(), URL.revokeObjectURL(p);
|
|
64
|
+
}, O = (t) => {
|
|
65
|
+
const e = document.createElement("iframe");
|
|
66
|
+
e.setAttribute("aria-hidden", "true"), e.style.position = "fixed", e.style.width = "0", e.style.height = "0", e.style.border = "0", document.body.appendChild(e);
|
|
67
|
+
const n = e.contentDocument;
|
|
68
|
+
if (!n || !e.contentWindow) {
|
|
69
|
+
e.remove();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
n.open(), n.write(A(t)), n.close(), e.contentWindow.focus(), e.contentWindow.print(), window.setTimeout(() => e.remove(), 1e3);
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
L as DOCX_FILENAME,
|
|
76
|
+
P as DOCX_MIME,
|
|
77
|
+
R as PRINT_TITLE,
|
|
78
|
+
C as buildDocx,
|
|
79
|
+
A as buildPrintDocument,
|
|
80
|
+
I as crc32,
|
|
81
|
+
T as createStoredZip,
|
|
82
|
+
U as downloadBytes,
|
|
83
|
+
_ as htmlToDocxParagraphs,
|
|
84
|
+
O as printHtmlDocument
|
|
85
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exportDocument.utils.test.d.ts","sourceRoot":"","sources":["../../src/utils/exportDocument.utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a="bold",r="italic",c="underline",s="insertText",i=(e,t)=>t==="upper"?e.toUpperCase():t==="lower"?e.toLowerCase():e.replace(/\S+/g,n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()),d=()=>({bold:document.queryCommandState(a),italic:document.queryCommandState(r),underline:document.queryCommandState(c)}),o=(e,t)=>{document.queryCommandState(e)!==t&&document.execCommand(e)},l=e=>{o(a,e.bold),o(r,e.italic),o(c,e.underline)},C=e=>{const t=window.getSelection();if(!t||t.isCollapsed||t.rangeCount===0)return!1;const n=i(t.toString(),e);return document.execCommand(s,!1,n)};exports.applyCaseToSelection=C;exports.applyPaintedFormat=l;exports.changeCase=i;exports.readPaintedFormat=d;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type CaseMode = 'upper' | 'lower' | 'title';
|
|
2
|
+
export interface PaintedFormat {
|
|
3
|
+
bold: boolean;
|
|
4
|
+
italic: boolean;
|
|
5
|
+
underline: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const changeCase: (value: string, mode: CaseMode) => string;
|
|
8
|
+
export declare const readPaintedFormat: () => PaintedFormat;
|
|
9
|
+
export declare const applyPaintedFormat: (format: PaintedFormat) => void;
|
|
10
|
+
export declare const applyCaseToSelection: (mode: CaseMode) => boolean;
|
|
11
|
+
//# sourceMappingURL=formatPainter.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatPainter.utils.d.ts","sourceRoot":"","sources":["../../src/utils/formatPainter.utils.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEnD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB;AAOD,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,EAAE,MAAM,QAAQ,KAAG,MAI1D,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO,aAInC,CAAC;AAQH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,aAAa,KAAG,IAI1D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,MAAM,QAAQ,KAAG,OAKrD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const a = "bold", c = "italic", r = "underline", s = "insertText", i = (e, t) => t === "upper" ? e.toUpperCase() : t === "lower" ? e.toLowerCase() : e.replace(/\S+/g, (n) => n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()), d = () => ({
|
|
2
|
+
bold: document.queryCommandState(a),
|
|
3
|
+
italic: document.queryCommandState(c),
|
|
4
|
+
underline: document.queryCommandState(r)
|
|
5
|
+
}), o = (e, t) => {
|
|
6
|
+
document.queryCommandState(e) !== t && document.execCommand(e);
|
|
7
|
+
}, C = (e) => {
|
|
8
|
+
o(a, e.bold), o(c, e.italic), o(r, e.underline);
|
|
9
|
+
}, l = (e) => {
|
|
10
|
+
const t = window.getSelection();
|
|
11
|
+
if (!t || t.isCollapsed || t.rangeCount === 0) return !1;
|
|
12
|
+
const n = i(t.toString(), e);
|
|
13
|
+
return document.execCommand(s, !1, n);
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
l as applyCaseToSelection,
|
|
17
|
+
C as applyPaintedFormat,
|
|
18
|
+
i as changeCase,
|
|
19
|
+
d as readPaintedFormat
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatPainter.utils.test.d.ts","sourceRoot":"","sources":["../../src/utils/formatPainter.utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../constants/numbers.cjs");require("../constants/openai.const.cjs");require("react/jsx-runtime");require("./paste.utils.cjs");require("react");require("react-dom");class e{constructor(t=""){this.past=[],this.future=[],this.current="",this.current=t}push(t){t!==this.current&&(this.past.push(this.current),this.past.length>r.INK_HISTORY_MAX&&this.past.shift(),this.current=t,this.future=[])}undo(){const t=this.past.pop();return t===void 0?null:(this.future.push(this.current),this.current=t,this.current)}redo(){const t=this.future.pop();return t===void 0?null:(this.past.push(this.current),this.current=t,this.current)}canUndo(){return this.past.length>0}canRedo(){return this.future.length>0}getCurrent(){return this.current}}exports.InkHistoryStack=e;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../constants/numbers.cjs");require("../constants/openai.const.cjs");require("react/jsx-runtime");require("./paste.utils.cjs");require("./exportDocument.utils.cjs");require("react");require("react-dom");class e{constructor(t=""){this.past=[],this.future=[],this.current="",this.current=t}push(t){t!==this.current&&(this.past.push(this.current),this.past.length>r.INK_HISTORY_MAX&&this.past.shift(),this.current=t,this.future=[])}undo(){const t=this.past.pop();return t===void 0?null:(this.future.push(this.current),this.current=t,this.current)}redo(){const t=this.future.pop();return t===void 0?null:(this.past.push(this.current),this.current=t,this.current)}canUndo(){return this.past.length>0}canRedo(){return this.future.length>0}getCurrent(){return this.current}}exports.InkHistoryStack=e;
|
|
@@ -2,9 +2,10 @@ import { INK_HISTORY_MAX as r } from "../constants/numbers.js";
|
|
|
2
2
|
import "../constants/openai.const.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "./paste.utils.js";
|
|
5
|
+
import "./exportDocument.utils.js";
|
|
5
6
|
import "react";
|
|
6
7
|
import "react-dom";
|
|
7
|
-
class
|
|
8
|
+
class c {
|
|
8
9
|
constructor(t = "") {
|
|
9
10
|
this.past = [], this.future = [], this.current = "", this.current = t;
|
|
10
11
|
}
|
|
@@ -30,5 +31,5 @@ class o {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
export {
|
|
33
|
-
|
|
34
|
+
c as InkHistoryStack
|
|
34
35
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a="Ink-figure",c=80,l=720,r=240,g="left",i="center",o="right",I=t=>{const n=t.parentElement;if(n instanceof HTMLElement&&n.tagName==="FIGURE")return n;const e=document.createElement("figure");e.className=a,t.replaceWith(e),e.appendChild(t);const s=document.createElement("figcaption");return e.appendChild(s),e},A=(t,n)=>{t.style.width=`${n}px`,t.style.height="auto"},E=(t,n)=>{const e=I(t);e.style.display="table",n===i?(e.style.marginLeft="auto",e.style.marginRight="auto"):n===o?(e.style.marginLeft="auto",e.style.marginRight="0"):(e.style.marginLeft="0",e.style.marginRight="auto")},_=(t,n)=>{t.alt=n},G=(t,n)=>{const e=I(t);let s=e.querySelector("figcaption");s||(s=document.createElement("figcaption"),e.appendChild(s)),s.textContent=n};exports.IMAGE_ALIGN_CENTER=i;exports.IMAGE_ALIGN_LEFT=g;exports.IMAGE_ALIGN_RIGHT=o;exports.IMAGE_FIGURE_CLASS=a;exports.IMAGE_WIDTH_DEFAULT=r;exports.IMAGE_WIDTH_MAX=l;exports.IMAGE_WIDTH_MIN=c;exports.ensureImageFigure=I;exports.setImageAlign=E;exports.setImageAlt=_;exports.setImageCaption=G;exports.setImageWidth=A;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const IMAGE_FIGURE_CLASS = "Ink-figure";
|
|
2
|
+
export declare const IMAGE_WIDTH_MIN = 80;
|
|
3
|
+
export declare const IMAGE_WIDTH_MAX = 720;
|
|
4
|
+
export declare const IMAGE_WIDTH_DEFAULT = 240;
|
|
5
|
+
export declare const IMAGE_ALIGN_LEFT = "left";
|
|
6
|
+
export declare const IMAGE_ALIGN_CENTER = "center";
|
|
7
|
+
export declare const IMAGE_ALIGN_RIGHT = "right";
|
|
8
|
+
export type ImageAlign = typeof IMAGE_ALIGN_LEFT | typeof IMAGE_ALIGN_CENTER | typeof IMAGE_ALIGN_RIGHT;
|
|
9
|
+
export declare const ensureImageFigure: (image: HTMLImageElement) => HTMLElement;
|
|
10
|
+
export declare const setImageWidth: (image: HTMLImageElement, width: number) => void;
|
|
11
|
+
export declare const setImageAlign: (image: HTMLImageElement, align: ImageAlign) => void;
|
|
12
|
+
export declare const setImageAlt: (image: HTMLImageElement, alt: string) => void;
|
|
13
|
+
export declare const setImageCaption: (image: HTMLImageElement, caption: string) => void;
|
|
14
|
+
//# sourceMappingURL=image.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.utils.d.ts","sourceRoot":"","sources":["../../src/utils/image.utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,eAAe,CAAC;AAC/C,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,gBAAgB,SAAS,CAAC;AACvC,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAC3C,eAAO,MAAM,iBAAiB,UAAU,CAAC;AAEzC,MAAM,MAAM,UAAU,GAAG,OAAO,gBAAgB,GAAG,OAAO,kBAAkB,GAAG,OAAO,iBAAiB,CAAC;AAExG,eAAO,MAAM,iBAAiB,GAAI,OAAO,gBAAgB,KAAG,WAU3D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,gBAAgB,EAAE,OAAO,MAAM,KAAG,IAGtE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,gBAAgB,EAAE,OAAO,UAAU,KAAG,IAa1E,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,EAAE,KAAK,MAAM,KAAG,IAElE,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,OAAO,gBAAgB,EAAE,SAAS,MAAM,KAAG,IAQ1E,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const a = "Ink-figure", l = 80, r = 720, g = 240, I = "left", i = "center", c = "right", o = (e) => {
|
|
2
|
+
const n = e.parentElement;
|
|
3
|
+
if (n instanceof HTMLElement && n.tagName === "FIGURE") return n;
|
|
4
|
+
const t = document.createElement("figure");
|
|
5
|
+
t.className = a, e.replaceWith(t), t.appendChild(e);
|
|
6
|
+
const s = document.createElement("figcaption");
|
|
7
|
+
return t.appendChild(s), t;
|
|
8
|
+
}, m = (e, n) => {
|
|
9
|
+
e.style.width = `${n}px`, e.style.height = "auto";
|
|
10
|
+
}, u = (e, n) => {
|
|
11
|
+
const t = o(e);
|
|
12
|
+
t.style.display = "table", n === i ? (t.style.marginLeft = "auto", t.style.marginRight = "auto") : n === c ? (t.style.marginLeft = "auto", t.style.marginRight = "0") : (t.style.marginLeft = "0", t.style.marginRight = "auto");
|
|
13
|
+
}, E = (e, n) => {
|
|
14
|
+
e.alt = n;
|
|
15
|
+
}, f = (e, n) => {
|
|
16
|
+
const t = o(e);
|
|
17
|
+
let s = t.querySelector("figcaption");
|
|
18
|
+
s || (s = document.createElement("figcaption"), t.appendChild(s)), s.textContent = n;
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
i as IMAGE_ALIGN_CENTER,
|
|
22
|
+
I as IMAGE_ALIGN_LEFT,
|
|
23
|
+
c as IMAGE_ALIGN_RIGHT,
|
|
24
|
+
a as IMAGE_FIGURE_CLASS,
|
|
25
|
+
g as IMAGE_WIDTH_DEFAULT,
|
|
26
|
+
r as IMAGE_WIDTH_MAX,
|
|
27
|
+
l as IMAGE_WIDTH_MIN,
|
|
28
|
+
o as ensureImageFigure,
|
|
29
|
+
u as setImageAlign,
|
|
30
|
+
E as setImageAlt,
|
|
31
|
+
f as setImageCaption,
|
|
32
|
+
m as setImageWidth
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.utils.test.d.ts","sourceRoot":"","sources":["../../src/utils/image.utils.test.ts"],"names":[],"mappings":""}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { cn } from './cn.utils';
|
|
2
2
|
export { applyTypoAutoFix } from './typo.utils';
|
|
3
3
|
export { createInkId } from './id.utils';
|
|
4
|
-
export { buildTableHtml, getTableCellFromSelection, insertTableRow, insertTableColumn, deleteTableRow, deleteTableColumn, toggleTableHeaderRow, getColumnResizeIndex, setTableColumnWidth, ensureTableColgroup, } from './table.utils';
|
|
4
|
+
export { buildTableHtml, getTableCellFromSelection, insertTableRow, insertTableColumn, deleteTableRow, deleteTableColumn, toggleTableHeaderRow, getColumnResizeIndex, setTableColumnWidth, mergeTableCellRight, splitTableCell, setTableCellBackground, setTableCellVerticalAlign, ensureTableColgroup, } from './table.utils';
|
|
5
5
|
export { getBlockElement, moveBlock, reorderBlockBefore, reorderBlockAfter, resolveDropPosition, clearBlockDragClasses, markDraggingBlock, markDropTarget, markActiveBlock, } from './blocks.utils';
|
|
6
6
|
export type { BlockDropPosition } from './blocks.utils';
|
|
7
7
|
export { wrapInsertHtml, wrapDeleteHtml, createTrackChange, acceptTrackChangeInHtml, rejectTrackChangeInHtml, } from './trackChanges.utils';
|
|
8
|
-
export { createCommentThread, wrapSelectionAsComment, removeCommentMark, } from './comments.utils';
|
|
8
|
+
export { createCommentThread, wrapSelectionAsComment, removeCommentMark, scrollToComment, setCommentResolvedMark, } from './comments.utils';
|
|
9
9
|
export { InkHistoryStack } from './history.utils';
|
|
10
10
|
export { filterSlashCommands, extractSlashQuery, groupSlashCommands } from './slash.utils';
|
|
11
11
|
export type { SlashCommandGroup } from './slash.utils';
|
|
@@ -13,11 +13,20 @@ export { countWords } from './words.utils';
|
|
|
13
13
|
export { collectOutlineItems, getCaretLineCol, scrollOutlineHeading } from './outline.utils';
|
|
14
14
|
export { resolveInkPremium, hasInkPremiumFeature, isInkPremiumLicenseKey, themeTokensToStyle, } from './premium.utils';
|
|
15
15
|
export { mintInkPremiumLicenseKey } from './license.utils';
|
|
16
|
-
export { sanitizePastedHtml, extractClipboardHtml, extractClipboardText, } from './paste.utils';
|
|
16
|
+
export { sanitizePastedHtml, cleanOfficeHtml, isOfficeHtml, extractClipboardHtml, extractClipboardText, } from './paste.utils';
|
|
17
17
|
export { buildInkMemoryKey, readInkMemory, writeInkMemory, clearInkMemory, } from './memory.utils';
|
|
18
18
|
export { isLocalStorageAvailable } from './storage.utils';
|
|
19
19
|
export { replaceInHtml, countOccurrences } from './findReplace.utils';
|
|
20
|
+
export { listVersions, saveVersion } from './versions.utils';
|
|
21
|
+
export type { InkDocumentVersion } from './versions.utils';
|
|
22
|
+
export { downloadTextFile, htmlToMarkdown, markdownToHtml, MARKDOWN_ACCEPT, MARKDOWN_EXPORT_FILENAME, MARKDOWN_MIME, } from './markdown.utils';
|
|
23
|
+
export { buildDocx, buildPrintDocument, downloadBytes, printHtmlDocument, DOCX_FILENAME, DOCX_MIME, } from './exportDocument.utils';
|
|
24
|
+
export { buildMentionHtml, deleteMentionQuery, extractMentionQuery, filterMentionPeople, } from './mentions.utils';
|
|
25
|
+
export { applyCaseToSelection, applyPaintedFormat, readPaintedFormat, } from './formatPainter.utils';
|
|
26
|
+
export type { CaseMode, PaintedFormat } from './formatPainter.utils';
|
|
20
27
|
export { captureSelectionInRoot, restoreSelectionInRoot, withPreservedSelection, } from './selection.utils';
|
|
21
28
|
export type { SavedSelection } from './selection.utils';
|
|
22
29
|
export { buildToolbarStorageKey, buildVisibleToolbarItems, isSessionStorageAvailable, listCustomizableToolbarOptions, normalizeToolbarItems, parseToolbarItems, readToolbarHidden, readToolbarItems, writeToolbarHidden, writeToolbarItems, } from './toolbarStorage.utils';
|
|
30
|
+
export { getCollaboratorInitials, filterActiveCollaborators, createDefaultCollaborator, } from './collab.utils';
|
|
31
|
+
export { createDefaultDocument, filterDocuments, sortDocuments, } from './workspace.utils';
|
|
23
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EACL,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EACL,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC3F,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,eAAe,EACf,wBAAwB,EACxB,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,SAAS,GACV,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,aAAa,GACd,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ink.brand.test.d.ts","sourceRoot":"","sources":["../../src/utils/ink.brand.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../constants/openai.const.cjs");const n=require("../constants/premium.const.cjs");require("react/jsx-runtime");require("./paste.utils.cjs");require("react");require("react-dom");const t="ABCDEFGHJKLMNPQRSTUVWXYZ23456789",o=4,i=4,u=()=>{const e=new Uint8Array(o);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(let r=0;r<e.length;r+=1)e[r]=Math.floor(Math.random()*256);return Array.from(e,r=>t[r%t.length]).join("")},c=()=>{const e=Array.from({length:i},()=>u()).join("_");return`${n.INK_PREMIUM_LICENSE_PREFIX}${e}`};exports.mintInkPremiumLicenseKey=c;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../constants/openai.const.cjs");const n=require("../constants/premium.const.cjs");require("react/jsx-runtime");require("./paste.utils.cjs");require("./exportDocument.utils.cjs");require("react");require("react-dom");const t="ABCDEFGHJKLMNPQRSTUVWXYZ23456789",o=4,i=4,u=()=>{const e=new Uint8Array(o);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(let r=0;r<e.length;r+=1)e[r]=Math.floor(Math.random()*256);return Array.from(e,r=>t[r%t.length]).join("")},c=()=>{const e=Array.from({length:i},()=>u()).join("_");return`${n.INK_PREMIUM_LICENSE_PREFIX}${e}`};exports.mintInkPremiumLicenseKey=c;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import "../constants/openai.const.js";
|
|
2
|
-
import { INK_PREMIUM_LICENSE_PREFIX as
|
|
2
|
+
import { INK_PREMIUM_LICENSE_PREFIX as n } from "../constants/premium.const.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "./paste.utils.js";
|
|
5
|
+
import "./exportDocument.utils.js";
|
|
5
6
|
import "react";
|
|
6
7
|
import "react-dom";
|
|
7
|
-
const
|
|
8
|
+
const r = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789", e = 4, m = 4, i = () => {
|
|
8
9
|
const t = new Uint8Array(e);
|
|
9
10
|
if (typeof crypto < "u" && typeof crypto.getRandomValues == "function")
|
|
10
11
|
crypto.getRandomValues(t);
|
|
11
12
|
else
|
|
12
13
|
for (let o = 0; o < t.length; o += 1)
|
|
13
14
|
t[o] = Math.floor(Math.random() * 256);
|
|
14
|
-
return Array.from(t, (o) =>
|
|
15
|
-
},
|
|
16
|
-
const t = Array.from({ length: m }, () =>
|
|
17
|
-
return `${
|
|
15
|
+
return Array.from(t, (o) => r[o % r.length]).join("");
|
|
16
|
+
}, N = () => {
|
|
17
|
+
const t = Array.from({ length: m }, () => i()).join("_");
|
|
18
|
+
return `${n}${t}`;
|
|
18
19
|
};
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
+
N as mintInkPremiumLicenseKey
|
|
21
22
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),l=e=>{if(e.nodeType===Node.TEXT_NODE)return e.textContent??"";if(!(e instanceof HTMLElement))return"";const t=e.tagName.toLowerCase(),r=Array.from(e.childNodes).map(n=>l(n)).join("");return t==="strong"||t==="b"?`**${r}**`:t==="em"||t==="i"?`*${r}*`:t==="code"?`\`${r}\``:t==="a"?`[${r}](${e.getAttribute("href")??""})`:t==="br"?`
|
|
2
|
+
`:r},u=e=>{const t=e.tagName.toLowerCase()==="ol";return Array.from(e.children).map((r,n)=>`${t?`${n+1}. `:"- "}${l(r).trim()}`).join(`
|
|
3
|
+
`)},m=e=>{const t=Array.from(e.querySelectorAll("tr")).map(i=>Array.from(i.children).map(c=>l(c).trim().replace(/\|/g,"\\|")));if(t.length===0)return"";const r=Math.max(...t.map(i=>i.length)),n=t.map(i=>{const c=[...i];for(;c.length<r;)c.push("");return`| ${c.join(" | ")} |`}),o=`| ${Array.from({length:r},()=>"---").join(" | ")} |`;return[n[0],o,...n.slice(1)].join(`
|
|
4
|
+
`)},h=e=>{if(!(e instanceof HTMLElement))return(e.textContent??"").trim();const t=e.tagName.toLowerCase();if(/^h[1-6]$/.test(t)){const r=Number(t.slice(1));return`${"#".repeat(r)} ${l(e).trim()}`}return t==="ul"||t==="ol"?u(e):t==="pre"?`\`\`\`
|
|
5
|
+
${e.textContent??""}
|
|
6
|
+
\`\`\``:t==="blockquote"?`> ${l(e).trim()}`:t==="hr"?"---":t==="table"?m(e):l(e).trim()},p=e=>{const t=document.createElement("div");return t.innerHTML=e,Array.from(t.childNodes).map(r=>h(r)).filter(r=>r.trim().length>0).join(`
|
|
7
|
+
|
|
8
|
+
`)},s=e=>a(e).replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>').replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/\*([^*]+)\*/g,"<em>$1</em>"),d=e=>{const t=e.replace(/\r\n/g,`
|
|
9
|
+
`).split(`
|
|
10
|
+
`),r=[];let n=0;for(;n<t.length;){const o=t[n]??"";if(o.startsWith("```")){const i=[];for(n+=1;n<t.length&&!(t[n]??"").startsWith("```");)i.push(a(t[n]??"")),n+=1;r.push(`<pre><code>${i.join(`
|
|
11
|
+
`)}</code></pre>`),n+=1;continue}if(!o.trim()){n+=1;continue}if(o.startsWith("- ")||o.startsWith("* ")){const i=[];for(;n<t.length&&/^[-*] /.test(t[n]??"");)i.push(`<li>${s((t[n]??"").slice(2))}</li>`),n+=1;r.push(`<ul>${i.join("")}</ul>`);continue}if(/^\d+\. /.test(o)){const i=[];for(;n<t.length&&/^\d+\. /.test(t[n]??"");)i.push(`<li>${s((t[n]??"").replace(/^\d+\. /,""))}</li>`),n+=1;r.push(`<ol>${i.join("")}</ol>`);continue}o.trim()==="---"?r.push("<hr />"):o.startsWith("### ")?r.push(`<h3>${s(o.slice(4))}</h3>`):o.startsWith("## ")?r.push(`<h2>${s(o.slice(3))}</h2>`):o.startsWith("# ")?r.push(`<h1>${s(o.slice(2))}</h1>`):o.startsWith("> ")?r.push(`<blockquote><p>${s(o.slice(2))}</p></blockquote>`):r.push(`<p>${s(o)}</p>`),n+=1}return r.join("")},f="document.md",g=".md,text/markdown,text/plain",$="text/markdown",w=(e,t,r)=>{const n=new Blob([t],{type:r}),o=URL.createObjectURL(n),i=document.createElement("a");i.href=o,i.download=e,i.click(),URL.revokeObjectURL(o)};exports.MARKDOWN_ACCEPT=g;exports.MARKDOWN_EXPORT_FILENAME=f;exports.MARKDOWN_MIME=$;exports.downloadTextFile=w;exports.htmlToMarkdown=p;exports.markdownToHtml=d;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const htmlToMarkdown: (html: string) => string;
|
|
2
|
+
export declare const markdownToHtml: (markdown: string) => string;
|
|
3
|
+
export declare const MARKDOWN_EXPORT_FILENAME = "document.md";
|
|
4
|
+
export declare const MARKDOWN_ACCEPT = ".md,text/markdown,text/plain";
|
|
5
|
+
export declare const MARKDOWN_MIME = "text/markdown";
|
|
6
|
+
export declare const downloadTextFile: (filename: string, contents: string, mime: string) => void;
|
|
7
|
+
//# sourceMappingURL=markdown.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.utils.d.ts","sourceRoot":"","sources":["../../src/utils/markdown.utils.ts"],"names":[],"mappings":"AA2DA,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,KAAG,MAO7C,CAAC;AAWF,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,KAAG,MAyDjD,CAAC;AAEF,eAAO,MAAM,wBAAwB,gBAAgB,CAAC;AACtD,eAAO,MAAM,eAAe,iCAAiC,CAAC;AAC9D,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAE7C,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,EAAE,UAAU,MAAM,EAAE,MAAM,MAAM,KAAG,IAQnF,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
const a = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), l = (e) => {
|
|
2
|
+
if (e.nodeType === Node.TEXT_NODE) return e.textContent ?? "";
|
|
3
|
+
if (!(e instanceof HTMLElement)) return "";
|
|
4
|
+
const t = e.tagName.toLowerCase(), r = Array.from(e.childNodes).map((n) => l(n)).join("");
|
|
5
|
+
return t === "strong" || t === "b" ? `**${r}**` : t === "em" || t === "i" ? `*${r}*` : t === "code" ? `\`${r}\`` : t === "a" ? `[${r}](${e.getAttribute("href") ?? ""})` : t === "br" ? `
|
|
6
|
+
` : r;
|
|
7
|
+
}, h = (e) => {
|
|
8
|
+
const t = e.tagName.toLowerCase() === "ol";
|
|
9
|
+
return Array.from(e.children).map((r, n) => `${t ? `${n + 1}. ` : "- "}${l(r).trim()}`).join(`
|
|
10
|
+
`);
|
|
11
|
+
}, u = (e) => {
|
|
12
|
+
const t = Array.from(e.querySelectorAll("tr")).map(
|
|
13
|
+
(i) => Array.from(i.children).map((c) => l(c).trim().replace(/\|/g, "\\|"))
|
|
14
|
+
);
|
|
15
|
+
if (t.length === 0) return "";
|
|
16
|
+
const r = Math.max(...t.map((i) => i.length)), n = t.map((i) => {
|
|
17
|
+
const c = [...i];
|
|
18
|
+
for (; c.length < r; ) c.push("");
|
|
19
|
+
return `| ${c.join(" | ")} |`;
|
|
20
|
+
}), o = `| ${Array.from({ length: r }, () => "---").join(" | ")} |`;
|
|
21
|
+
return [n[0], o, ...n.slice(1)].join(`
|
|
22
|
+
`);
|
|
23
|
+
}, m = (e) => {
|
|
24
|
+
if (!(e instanceof HTMLElement)) return (e.textContent ?? "").trim();
|
|
25
|
+
const t = e.tagName.toLowerCase();
|
|
26
|
+
if (/^h[1-6]$/.test(t)) {
|
|
27
|
+
const r = Number(t.slice(1));
|
|
28
|
+
return `${"#".repeat(r)} ${l(e).trim()}`;
|
|
29
|
+
}
|
|
30
|
+
return t === "ul" || t === "ol" ? h(e) : t === "pre" ? `\`\`\`
|
|
31
|
+
${e.textContent ?? ""}
|
|
32
|
+
\`\`\`` : t === "blockquote" ? `> ${l(e).trim()}` : t === "hr" ? "---" : t === "table" ? u(e) : l(e).trim();
|
|
33
|
+
}, p = (e) => {
|
|
34
|
+
const t = document.createElement("div");
|
|
35
|
+
return t.innerHTML = e, Array.from(t.childNodes).map((r) => m(r)).filter((r) => r.trim().length > 0).join(`
|
|
36
|
+
|
|
37
|
+
`);
|
|
38
|
+
}, s = (e) => a(e).replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>').replace(/`([^`]+)`/g, "<code>$1</code>").replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(/\*([^*]+)\*/g, "<em>$1</em>"), f = (e) => {
|
|
39
|
+
const t = e.replace(/\r\n/g, `
|
|
40
|
+
`).split(`
|
|
41
|
+
`), r = [];
|
|
42
|
+
let n = 0;
|
|
43
|
+
for (; n < t.length; ) {
|
|
44
|
+
const o = t[n] ?? "";
|
|
45
|
+
if (o.startsWith("```")) {
|
|
46
|
+
const i = [];
|
|
47
|
+
for (n += 1; n < t.length && !(t[n] ?? "").startsWith("```"); )
|
|
48
|
+
i.push(a(t[n] ?? "")), n += 1;
|
|
49
|
+
r.push(`<pre><code>${i.join(`
|
|
50
|
+
`)}</code></pre>`), n += 1;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (!o.trim()) {
|
|
54
|
+
n += 1;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (o.startsWith("- ") || o.startsWith("* ")) {
|
|
58
|
+
const i = [];
|
|
59
|
+
for (; n < t.length && /^[-*] /.test(t[n] ?? ""); )
|
|
60
|
+
i.push(`<li>${s((t[n] ?? "").slice(2))}</li>`), n += 1;
|
|
61
|
+
r.push(`<ul>${i.join("")}</ul>`);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (/^\d+\. /.test(o)) {
|
|
65
|
+
const i = [];
|
|
66
|
+
for (; n < t.length && /^\d+\. /.test(t[n] ?? ""); )
|
|
67
|
+
i.push(
|
|
68
|
+
`<li>${s((t[n] ?? "").replace(/^\d+\. /, ""))}</li>`
|
|
69
|
+
), n += 1;
|
|
70
|
+
r.push(`<ol>${i.join("")}</ol>`);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
o.trim() === "---" ? r.push("<hr />") : o.startsWith("### ") ? r.push(`<h3>${s(o.slice(4))}</h3>`) : o.startsWith("## ") ? r.push(`<h2>${s(o.slice(3))}</h2>`) : o.startsWith("# ") ? r.push(`<h1>${s(o.slice(2))}</h1>`) : o.startsWith("> ") ? r.push(`<blockquote><p>${s(o.slice(2))}</p></blockquote>`) : r.push(`<p>${s(o)}</p>`), n += 1;
|
|
74
|
+
}
|
|
75
|
+
return r.join("");
|
|
76
|
+
}, d = "document.md", $ = ".md,text/markdown,text/plain", g = "text/markdown", w = (e, t, r) => {
|
|
77
|
+
const n = new Blob([t], { type: r }), o = URL.createObjectURL(n), i = document.createElement("a");
|
|
78
|
+
i.href = o, i.download = e, i.click(), URL.revokeObjectURL(o);
|
|
79
|
+
};
|
|
80
|
+
export {
|
|
81
|
+
$ as MARKDOWN_ACCEPT,
|
|
82
|
+
d as MARKDOWN_EXPORT_FILENAME,
|
|
83
|
+
g as MARKDOWN_MIME,
|
|
84
|
+
w as downloadTextFile,
|
|
85
|
+
p as htmlToMarkdown,
|
|
86
|
+
f as markdownToHtml
|
|
87
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.utils.test.d.ts","sourceRoot":"","sources":["../../src/utils/markdown.utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c="Ink-mention",l=t=>t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<"),i=t=>{const n=t.slice(-40).match(/(?:^|\s)@([^\s@]*)$/);return n?n[1]??"":null},a=(t,e)=>`<span class="${c}" data-mention-id="${l(t)}" contenteditable="false">@${l(e)}</span> `,u=(t,e)=>{const n=e.trim().toLowerCase();return n?t.filter(o=>o.label.toLowerCase().includes(n)):t},d=t=>{const e=window.getSelection();if(!e||!e.isCollapsed||e.rangeCount===0)return!1;const n=e.anchorNode;if(!n||n.nodeType!==Node.TEXT_NODE)return!1;const o=`@${t}`,r=e.anchorOffset;if((n.textContent??"").slice(r-o.length,r)!==o)return!1;const s=e.getRangeAt(0);return s.setStart(n,r-o.length),s.deleteContents(),!0};exports.MENTION_CLASS=c;exports.buildMentionHtml=a;exports.deleteMentionQuery=d;exports.extractMentionQuery=i;exports.filterMentionPeople=u;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const MENTION_CLASS = "Ink-mention";
|
|
2
|
+
export declare const MENTION_QUERY_LIMIT = 40;
|
|
3
|
+
export declare const extractMentionQuery: (text: string) => string | null;
|
|
4
|
+
export declare const buildMentionHtml: (id: string, label: string) => string;
|
|
5
|
+
export declare const filterMentionPeople: (people: Array<{
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
}>, query: string) => Array<{
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const deleteMentionQuery: (query: string) => boolean;
|
|
13
|
+
//# sourceMappingURL=mentions.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mentions.utils.d.ts","sourceRoot":"","sources":["../../src/utils/mentions.utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,gBAAgB,CAAC;AAC3C,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAKtC,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,IAK3D,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,IAAI,MAAM,EAAE,OAAO,MAAM,KAAG,MACoE,CAAC;AAElI,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,EAC5C,OAAO,MAAM,KACZ,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAIrC,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,KAAG,OAalD,CAAC"}
|