@forgedevstack/ink 1.1.7 → 1.1.9
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 +40 -0
- package/README.md +9 -1
- package/bin/ink.const.mjs +26 -0
- package/bin/ink.mjs +58 -0
- package/dist/components/InkEditor/InkEditor.cjs +1 -1
- package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
- package/dist/components/InkEditor/InkEditor.js +1193 -834
- package/dist/components/InkEditor/components/AiPanel/AiPanel.cjs +1 -1
- package/dist/components/InkEditor/components/AiPanel/AiPanel.d.ts.map +1 -1
- package/dist/components/InkEditor/components/AiPanel/AiPanel.js +58 -52
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.cjs +1 -0
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.d.ts +4 -0
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.js +223 -0
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.types.d.ts +10 -0
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ExcelSheetPanel/index.d.ts +3 -0
- package/dist/components/InkEditor/components/ExcelSheetPanel/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.cjs +1 -0
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.d.ts +4 -0
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.d.ts.map +1 -0
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.js +91 -0
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.types.d.ts +11 -0
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/GraphEditModal/index.d.ts +3 -0
- package/dist/components/InkEditor/components/GraphEditModal/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.cjs +1 -0
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.d.ts +4 -0
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.d.ts.map +1 -0
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.js +98 -0
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.types.d.ts +10 -0
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/GraphPicker/index.d.ts +3 -0
- package/dist/components/InkEditor/components/GraphPicker/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.cjs +1 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.d.ts +4 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.d.ts.map +1 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.js +27 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.types.d.ts +7 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/index.d.ts +3 -0
- package/dist/components/InkEditor/components/HtmlSourcePanel/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.cjs +1 -1
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.d.ts.map +1 -1
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.js +17 -12
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.types.d.ts +1 -0
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.types.d.ts.map +1 -1
- 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 +82 -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 +65 -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/TableSizePicker/TableSizePicker.cjs +1 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.cjs +1 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.d.ts +10 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.js +18 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.d.ts +4 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.d.ts.map +1 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.js +96 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.types.d.ts +11 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/TableSizePicker/index.d.ts +3 -0
- package/dist/components/InkEditor/components/TableSizePicker/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.cjs +1 -0
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.d.ts +4 -0
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.js +65 -0
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.types.d.ts +12 -0
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ThemePicker/hooks/index.d.ts +3 -0
- package/dist/components/InkEditor/components/ThemePicker/hooks/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.cjs +1 -0
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.d.ts +13 -0
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.js +39 -0
- package/dist/components/InkEditor/components/ThemePicker/index.d.ts +3 -0
- package/dist/components/InkEditor/components/ThemePicker/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.cjs +1 -0
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.d.ts +4 -0
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.d.ts.map +1 -0
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.js +79 -0
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.types.d.ts +10 -0
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/TitleGallery/index.d.ts +3 -0
- package/dist/components/InkEditor/components/TitleGallery/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.d.ts.map +1 -1
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.js +41 -18
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.d.ts.map +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.js +25 -23
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.d.ts +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.d.ts.map +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.js +7 -7
- package/dist/components/InkEditor/components/index.d.ts +18 -0
- package/dist/components/InkEditor/components/index.d.ts.map +1 -1
- package/dist/components/InkEditor/helpers/format.utils.cjs +2 -2
- package/dist/components/InkEditor/helpers/format.utils.d.ts +1 -1
- package/dist/components/InkEditor/helpers/format.utils.d.ts.map +1 -1
- package/dist/components/InkEditor/helpers/format.utils.js +72 -72
- 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 +317 -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 +72 -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/colorMode.const.cjs +1 -1
- package/dist/constants/colorMode.const.d.ts +1 -1
- package/dist/constants/colorMode.const.d.ts.map +1 -1
- package/dist/constants/colorMode.const.js +4 -4
- package/dist/constants/contextMenu.const.cjs +1 -1
- package/dist/constants/contextMenu.const.d.ts +2 -0
- package/dist/constants/contextMenu.const.d.ts.map +1 -1
- package/dist/constants/contextMenu.const.js +17 -15
- package/dist/constants/defaultIcons.cjs +1 -1
- package/dist/constants/defaultIcons.d.ts.map +1 -1
- package/dist/constants/defaultIcons.js +20 -13
- package/dist/constants/defaults.const.cjs +1 -1
- package/dist/constants/defaults.const.d.ts +48 -0
- package/dist/constants/defaults.const.d.ts.map +1 -1
- package/dist/constants/defaults.const.js +201 -102
- package/dist/constants/generals.const.cjs +1 -1
- package/dist/constants/generals.const.d.ts +48 -0
- package/dist/constants/generals.const.d.ts.map +1 -1
- package/dist/constants/generals.const.js +71 -28
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/numbers.cjs +1 -1
- package/dist/constants/numbers.d.ts +14 -0
- package/dist/constants/numbers.d.ts.map +1 -1
- package/dist/constants/numbers.js +47 -28
- package/dist/constants/plugins.const.cjs +1 -0
- package/dist/constants/plugins.const.d.ts +13 -0
- package/dist/constants/plugins.const.d.ts.map +1 -0
- package/dist/constants/plugins.const.js +45 -0
- package/dist/constants/table.const.cjs +1 -1
- package/dist/constants/table.const.d.ts +4 -0
- package/dist/constants/table.const.d.ts.map +1 -1
- package/dist/constants/table.const.js +10 -6
- 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 +2 -0
- package/dist/constants/toolbarMenu.const.d.ts.map +1 -1
- package/dist/constants/toolbarMenu.const.js +80 -19
- 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 +4 -0
- package/dist/hooks/index.d.ts.map +1 -0
- 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 +86 -0
- package/dist/hooks/useToolbarOverflow.cjs +1 -0
- package/dist/hooks/useToolbarOverflow.d.ts +8 -0
- package/dist/hooks/useToolbarOverflow.d.ts.map +1 -0
- package/dist/hooks/useToolbarOverflow.js +29 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +150 -104
- package/dist/plugins/excel/excel.utils.cjs +1 -0
- package/dist/plugins/excel/excel.utils.d.ts +13 -0
- package/dist/plugins/excel/excel.utils.d.ts.map +1 -0
- package/dist/plugins/excel/excel.utils.js +40 -0
- package/dist/plugins/excel/index.d.ts +3 -0
- package/dist/plugins/excel/index.d.ts.map +1 -0
- package/dist/plugins/graph/graph.const.cjs +1 -0
- package/dist/plugins/graph/graph.const.d.ts +14 -0
- package/dist/plugins/graph/graph.const.d.ts.map +1 -0
- package/dist/plugins/graph/graph.const.js +24 -0
- package/dist/plugins/graph/graph.types.d.ts +7 -0
- package/dist/plugins/graph/graph.types.d.ts.map +1 -0
- package/dist/plugins/graph/graph.utils.cjs +1 -0
- package/dist/plugins/graph/graph.utils.d.ts +11 -0
- package/dist/plugins/graph/graph.utils.d.ts.map +1 -0
- package/dist/plugins/graph/graph.utils.js +76 -0
- package/dist/plugins/graph/index.d.ts +4 -0
- package/dist/plugins/graph/index.d.ts.map +1 -0
- package/dist/plugins/host/index.d.ts +2 -0
- package/dist/plugins/host/index.d.ts.map +1 -0
- package/dist/plugins/host/inkPlugins.cjs +1 -0
- package/dist/plugins/host/inkPlugins.d.ts +16 -0
- package/dist/plugins/host/inkPlugins.d.ts.map +1 -0
- package/dist/plugins/host/inkPlugins.js +20 -0
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/theme/index.d.ts +4 -0
- package/dist/plugins/theme/index.d.ts.map +1 -0
- package/dist/plugins/theme/inkTheme.cjs +1 -0
- package/dist/plugins/theme/inkTheme.d.ts +5 -0
- package/dist/plugins/theme/inkTheme.d.ts.map +1 -0
- package/dist/plugins/theme/inkTheme.js +27 -0
- package/dist/plugins/theme/theme.const.cjs +1 -0
- package/dist/plugins/theme/theme.const.d.ts +9 -0
- package/dist/plugins/theme/theme.const.d.ts.map +1 -0
- package/dist/plugins/theme/theme.const.js +15 -0
- package/dist/plugins/theme/theme.types.d.ts +12 -0
- package/dist/plugins/theme/theme.types.d.ts.map +1 -0
- package/dist/plugins/titles/index.d.ts +4 -0
- package/dist/plugins/titles/index.d.ts.map +1 -0
- package/dist/plugins/titles/titles.const.cjs +1 -0
- package/dist/plugins/titles/titles.const.d.ts +4 -0
- package/dist/plugins/titles/titles.const.d.ts.map +1 -0
- package/dist/plugins/titles/titles.const.js +15 -0
- package/dist/plugins/titles/titles.types.d.ts +2 -0
- package/dist/plugins/titles/titles.types.d.ts.map +1 -0
- package/dist/plugins/titles/titles.utils.cjs +1 -0
- package/dist/plugins/titles/titles.utils.d.ts +3 -0
- package/dist/plugins/titles/titles.utils.d.ts.map +1 -0
- package/dist/plugins/titles/titles.utils.js +14 -0
- package/dist/styles.css +1 -1
- package/dist/types/collab.types.d.ts +55 -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 +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/ink.types.d.ts +10 -2
- package/dist/types/ink.types.d.ts.map +1 -1
- package/dist/types/plugin.types.d.ts +8 -0
- package/dist/types/plugin.types.d.ts.map +1 -0
- package/dist/types/premium.types.d.ts +1 -1
- package/dist/types/premium.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/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 +32 -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/index.d.ts +3 -1
- 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/outline.utils.cjs +1 -1
- package/dist/utils/outline.utils.d.ts.map +1 -1
- package/dist/utils/outline.utils.js +32 -32
- package/dist/utils/table.utils.cjs +1 -1
- package/dist/utils/table.utils.d.ts +4 -0
- package/dist/utils/table.utils.d.ts.map +1 -1
- package/dist/utils/table.utils.js +84 -45
- 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 +7 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsxs as l, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b } from "react";
|
|
3
|
+
const f = ({
|
|
4
|
+
documents: c,
|
|
5
|
+
activeDocumentId: y,
|
|
6
|
+
onTabSelect: g,
|
|
7
|
+
onTabClose: d,
|
|
8
|
+
onTabAdd: h,
|
|
9
|
+
onTabRename: a,
|
|
10
|
+
className: m = ""
|
|
11
|
+
}) => {
|
|
12
|
+
const [u, s] = b(null), [r, k] = b(""), v = (t, n, o) => {
|
|
13
|
+
o.stopPropagation(), a && (s(t), k(n));
|
|
14
|
+
}, p = (t) => {
|
|
15
|
+
u === t && r.trim() && (a == null || a(t, r.trim())), s(null);
|
|
16
|
+
}, x = (t, n) => {
|
|
17
|
+
n.key === "Enter" ? p(t) : n.key === "Escape" && s(null);
|
|
18
|
+
};
|
|
19
|
+
return /* @__PURE__ */ l(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: `ink-tabs-container ${m}`.trim(),
|
|
23
|
+
role: "tablist",
|
|
24
|
+
"aria-label": "Document tabs",
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ i("div", { className: "ink-tabs-scroll-area", children: c.map((t) => {
|
|
27
|
+
const n = t.id === y, o = u === t.id;
|
|
28
|
+
return /* @__PURE__ */ l(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
role: "tab",
|
|
32
|
+
"aria-selected": n,
|
|
33
|
+
tabIndex: n ? 0 : -1,
|
|
34
|
+
className: `ink-tab-item ${n ? "ink-tab-active" : ""} ${t.isDirty ? "ink-tab-dirty" : ""}`,
|
|
35
|
+
onClick: () => g(t.id),
|
|
36
|
+
onDoubleClick: (e) => v(t.id, t.title, e),
|
|
37
|
+
title: t.title,
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ i("span", { className: "ink-tab-icon", "aria-hidden": "true", children: t.icon || /* @__PURE__ */ l("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
40
|
+
/* @__PURE__ */ i("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
41
|
+
/* @__PURE__ */ i("polyline", { points: "14 2 14 8 20 8" })
|
|
42
|
+
] }) }),
|
|
43
|
+
o ? /* @__PURE__ */ i(
|
|
44
|
+
"input",
|
|
45
|
+
{
|
|
46
|
+
type: "text",
|
|
47
|
+
className: "ink-tab-title-input",
|
|
48
|
+
value: r,
|
|
49
|
+
autoFocus: !0,
|
|
50
|
+
onChange: (e) => k(e.target.value),
|
|
51
|
+
onBlur: () => p(t.id),
|
|
52
|
+
onKeyDown: (e) => x(t.id, e),
|
|
53
|
+
onClick: (e) => e.stopPropagation()
|
|
54
|
+
}
|
|
55
|
+
) : /* @__PURE__ */ i("span", { className: "ink-tab-title", children: t.title || "Untitled" }),
|
|
56
|
+
t.isDirty && /* @__PURE__ */ i(
|
|
57
|
+
"span",
|
|
58
|
+
{
|
|
59
|
+
className: "ink-tab-dirty-indicator",
|
|
60
|
+
title: "Unsaved changes",
|
|
61
|
+
"aria-label": "Unsaved changes"
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
d && c.length > 1 && /* @__PURE__ */ i(
|
|
65
|
+
"button",
|
|
66
|
+
{
|
|
67
|
+
type: "button",
|
|
68
|
+
className: "ink-tab-close-btn",
|
|
69
|
+
"aria-label": `Close ${t.title}`,
|
|
70
|
+
onClick: (e) => {
|
|
71
|
+
e.stopPropagation(), d(t.id);
|
|
72
|
+
},
|
|
73
|
+
children: /* @__PURE__ */ l("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
74
|
+
/* @__PURE__ */ i("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
75
|
+
/* @__PURE__ */ i("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
76
|
+
] })
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
t.id
|
|
82
|
+
);
|
|
83
|
+
}) }),
|
|
84
|
+
h && /* @__PURE__ */ i(
|
|
85
|
+
"button",
|
|
86
|
+
{
|
|
87
|
+
type: "button",
|
|
88
|
+
className: "ink-tab-add-btn",
|
|
89
|
+
"aria-label": "New document",
|
|
90
|
+
title: "New document",
|
|
91
|
+
onClick: h,
|
|
92
|
+
children: /* @__PURE__ */ l("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
93
|
+
/* @__PURE__ */ i("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
94
|
+
/* @__PURE__ */ i("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
95
|
+
] })
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
f as InkTabs
|
|
104
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/InkTabs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),Z=require("react"),Q=require("../../plugins/theme/theme.const.cjs"),Y=require("../InkTabs/InkTabs.cjs"),A=require("../InkEditor/InkEditor.cjs"),$=require("../InkEditor/components/PresenceStack/PresenceStack.cjs"),z=require("./hooks/useInkWorkspace.cjs"),t=require("./components/WorkspaceIcons.cjs"),b=require("../../constants/numbers.cjs"),W=require("../../constants/generals.const.cjs");require("../../constants/openai.const.cjs");const E=require("../../utils/cn.utils.cjs");require("../../utils/paste.utils.cjs");const i=require("../../common-components/Button/Button.cjs");require("react-dom");const n=require("../../constants/workspace.const.cjs"),J=O=>{const{documents:N,activeDocumentId:h,onActiveDocumentChange:u,onDocumentChange:r,onDocumentDelete:p,onDocumentRename:D,onDocumentSave:S,folders:K=[],onFolderCreate:C,onFolderDelete:R,collaboration:_,editorProps:l={},className:v=W.EMPTY_STRING,style:w}=O,{sidebarOpen:I,setSidebarOpen:y,splitMode:d,setSplitMode:T,setSecondaryDocId:g,searchQuery:B,setSearchQuery:M,editingDocId:q,editTitle:F,setEditTitle:U,activeDocument:o,secondaryDocument:c,filteredDocs:H,handleCreateDocument:x,handleStartRename:L,handleSaveRename:j,handleCancelRename:V}=z.useInkWorkspace(O),[f,X]=Z.useState(l.themeId||Q.THEME_DEFAULT),m=l.themeId??f,P=a=>{var k;X(a),(k=l.onThemeChange)==null||k.call(l,a)};return e.jsxs("div",{className:E.cn("ink-workspace-root",v),style:w,"data-split-mode":d,"data-ink-theme":m,children:[e.jsxs("header",{className:"ink-workspace-header",children:[e.jsxs("div",{className:"ink-workspace-header-left",children:[e.jsx(i.Button,{type:"button",className:"ink-workspace-toggle-btn",onClick:()=>y(!I),title:I?n.INK_WORKSPACE_HIDE_EXPLORER_TITLE:n.INK_WORKSPACE_SHOW_EXPLORER_TITLE,"aria-label":I?n.INK_WORKSPACE_HIDE_EXPLORER_TITLE:n.INK_WORKSPACE_SHOW_EXPLORER_TITLE,children:e.jsx(t.SidebarToggleIcon,{})}),e.jsx("span",{className:"ink-workspace-title",children:n.INK_WORKSPACE_TITLE}),e.jsxs("span",{className:"ink-workspace-count",children:["(",N.length," ",n.INK_WORKSPACE_DOCS_SUFFIX,")"]})]}),e.jsxs("div",{className:"ink-workspace-header-right",children:[e.jsxs("div",{className:"ink-workspace-split-controls",role:"group","aria-label":n.INK_WORKSPACE_SPLIT_VIEW_LABEL,children:[e.jsx(i.Button,{type:"button",className:E.cn("ink-workspace-icon-btn",d===n.INK_SPLIT_MODE_NONE&&"ink-active"),onClick:()=>T(n.INK_SPLIT_MODE_NONE),title:n.INK_WORKSPACE_SINGLE_VIEW_TITLE,children:e.jsx(t.SingleViewIcon,{})}),e.jsx(i.Button,{type:"button",className:E.cn("ink-workspace-icon-btn",d===n.INK_SPLIT_MODE_VERTICAL&&"ink-active"),onClick:()=>T(n.INK_SPLIT_MODE_VERTICAL),title:n.INK_WORKSPACE_SPLIT_SIDE_TITLE,children:e.jsx(t.SplitVerticalIcon,{})}),e.jsx(i.Button,{type:"button",className:E.cn("ink-workspace-icon-btn",d===n.INK_SPLIT_MODE_HORIZONTAL&&"ink-active"),onClick:()=>T(n.INK_SPLIT_MODE_HORIZONTAL),title:n.INK_WORKSPACE_SPLIT_STACKED_TITLE,children:e.jsx(t.SplitHorizontalIcon,{})})]}),S&&o&&e.jsx(i.Button,{type:"button",className:"ink-workspace-icon-btn",onClick:()=>S(o.id),title:n.INK_WORKSPACE_SAVE_TITLE,"aria-label":n.INK_WORKSPACE_SAVE_TITLE,children:e.jsx(t.SaveDocIcon,{})}),(_==null?void 0:_.collaborators)&&e.jsx($.PresenceStack,{collaborators:_.collaborators,maxAvatars:_.maxAvatars})]})]}),e.jsxs("div",{className:"ink-workspace-body",children:[I&&e.jsxs("aside",{className:"ink-workspace-sidebar","aria-label":n.INK_WORKSPACE_TITLE,children:[e.jsxs("div",{className:"ink-workspace-sidebar-toolbar",children:[e.jsx("input",{type:"text",className:"ink-workspace-search-input",placeholder:n.INK_WORKSPACE_SEARCH_PLACEHOLDER,value:B,onChange:a=>M(a.target.value)}),e.jsx(i.Button,{type:"button",className:"ink-workspace-new-doc-btn",onClick:x,title:n.INK_WORKSPACE_NEW_DOC_BUTTON,"aria-label":n.INK_WORKSPACE_NEW_DOC_BUTTON,children:n.INK_WORKSPACE_NEW_DOC_BUTTON}),C&&e.jsx(i.Button,{type:"button",className:"ink-workspace-icon-btn",onClick:()=>C(n.INK_WORKSPACE_NEW_FOLDER),title:n.INK_WORKSPACE_NEW_FOLDER,"aria-label":n.INK_WORKSPACE_NEW_FOLDER,children:e.jsx(t.NewFolderIcon,{})})]}),K.length>b.NUMBER_ZERO&&e.jsx("div",{className:"ink-workspace-folders-section",children:K.map(a=>e.jsxs("div",{className:"ink-workspace-folder-item",children:[e.jsx("span",{className:"ink-doc-icon",children:"📁"}),e.jsx("span",{className:"ink-doc-title",children:a.name}),R&&e.jsx(i.Button,{type:"button",className:"ink-doc-action-btn ink-delete",onClick:()=>R(a.id),title:n.INK_WORKSPACE_CLOSE_FOLDER_BUTTON,"aria-label":n.INK_WORKSPACE_CLOSE_FOLDER_BUTTON,children:n.INK_WORKSPACE_CLOSE_FOLDER_BUTTON})]},a.id))}),e.jsx("div",{className:"ink-workspace-doc-list",role:"tree",children:H.map(a=>{const k=a.id===h,G=q===a.id;return e.jsxs("div",{role:"treeitem","aria-selected":k,className:E.cn("ink-workspace-doc-item",k&&"ink-doc-active"),onClick:()=>u(a.id),children:[e.jsx("span",{className:"ink-doc-icon",children:a.icon||e.jsx(t.FileDocumentIcon,{})}),G?e.jsx("input",{type:"text",className:"ink-doc-title-input",value:F,autoFocus:!0,onChange:s=>U(s.target.value),onBlur:()=>j(a.id),onKeyDown:s=>{s.key==="Enter"&&j(a.id),s.key==="Escape"&&V()},onClick:s=>s.stopPropagation()}):e.jsx("span",{className:"ink-doc-title",onDoubleClick:s=>L(a.id,a.title,s),children:a.title||n.INK_WORKSPACE_UNTITLED_FALLBACK}),a.isDirty&&e.jsx("span",{className:"ink-doc-dirty-dot"}),e.jsxs("div",{className:"ink-doc-actions",children:[e.jsx(i.Button,{type:"button",className:"ink-doc-action-btn",onClick:s=>L(a.id,a.title,s),title:n.INK_WORKSPACE_RENAME_TITLE,"aria-label":n.INK_WORKSPACE_RENAME_TITLE,children:e.jsx(t.RenamePencilIcon,{})}),N.length>b.NUMBER_ONE&&p&&e.jsx(i.Button,{type:"button",className:"ink-doc-action-btn ink-delete",onClick:s=>{s.stopPropagation(),p(a.id)},title:n.INK_WORKSPACE_DELETE_TITLE,"aria-label":n.INK_WORKSPACE_DELETE_TITLE,children:e.jsx(t.CloseCrossIcon,{})})]})]},a.id)})})]}),e.jsxs("main",{className:E.cn("ink-workspace-main-area",`ink-split-${d}`),children:[e.jsxs("section",{className:"ink-workspace-pane ink-primary-pane",children:[e.jsx(Y.InkTabs,{documents:N,activeDocumentId:h,onTabSelect:u,onTabClose:p,onTabAdd:x,onTabRename:D}),o&&e.jsx("div",{className:"ink-workspace-editor-wrapper",children:e.jsx(A.InkEditor,{value:o.content,onChange:a=>r==null?void 0:r(o.id,a),readOnly:o.readOnly,collaboration:_,...l,themeId:m,onThemeChange:P},o.id)})]}),d!==n.INK_SPLIT_MODE_NONE&&e.jsxs("section",{className:"ink-workspace-pane ink-secondary-pane",children:[e.jsxs("div",{className:"ink-secondary-pane-header",children:[e.jsx("span",{className:"ink-secondary-pane-label",children:n.INK_WORKSPACE_SPLIT_VIEW_LABEL}),e.jsx("select",{className:"ink-secondary-pane-select",value:(c==null?void 0:c.id)||W.EMPTY_STRING,onChange:a=>g(a.target.value),"aria-label":n.INK_WORKSPACE_SPLIT_VIEW_LABEL,children:N.map(a=>e.jsx("option",{value:a.id,children:a.title},a.id))})]}),c&&e.jsx("div",{className:"ink-workspace-editor-wrapper",children:e.jsx(A.InkEditor,{value:c.content,onChange:a=>r==null?void 0:r(c.id,a),readOnly:c.readOnly,...l,themeId:m,onThemeChange:P},`sec-${c.id}`)})]})]})]})]})};exports.InkWorkspace=J;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkWorkspace.d.ts","sourceRoot":"","sources":["../../../src/components/InkWorkspace/InkWorkspace.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA6CjD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAsTpD,CAAC"}
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as le } from "react";
|
|
3
|
+
import { THEME_DEFAULT as ce } from "../../plugins/theme/theme.const.js";
|
|
4
|
+
import { InkTabs as oe } from "../InkTabs/InkTabs.js";
|
|
5
|
+
import { InkEditor as g } from "../InkEditor/InkEditor.js";
|
|
6
|
+
import { PresenceStack as re } from "../InkEditor/components/PresenceStack/PresenceStack.js";
|
|
7
|
+
import { useInkWorkspace as se } from "./hooks/useInkWorkspace.js";
|
|
8
|
+
import { SidebarToggleIcon as de, SingleViewIcon as me, SplitVerticalIcon as ke, SplitHorizontalIcon as pe, SaveDocIcon as he, NewFolderIcon as Ne, FileDocumentIcon as Ee, RenamePencilIcon as _e, CloseCrossIcon as Ie } from "./components/WorkspaceIcons.js";
|
|
9
|
+
import { NUMBER_ZERO as Te, NUMBER_ONE as Ce } from "../../constants/numbers.js";
|
|
10
|
+
import { EMPTY_STRING as W } from "../../constants/generals.const.js";
|
|
11
|
+
import "../../constants/openai.const.js";
|
|
12
|
+
import { cn as m } from "../../utils/cn.utils.js";
|
|
13
|
+
import "../../utils/paste.utils.js";
|
|
14
|
+
import { Button as t } from "../../common-components/Button/Button.js";
|
|
15
|
+
import "react-dom";
|
|
16
|
+
import { INK_WORKSPACE_HIDE_EXPLORER_TITLE as f, INK_WORKSPACE_SHOW_EXPLORER_TITLE as F, INK_WORKSPACE_TITLE as M, INK_WORKSPACE_DOCS_SUFFIX as Se, INK_WORKSPACE_SPLIT_VIEW_LABEL as I, INK_WORKSPACE_SINGLE_VIEW_TITLE as be, INK_SPLIT_MODE_NONE as T, INK_WORKSPACE_SPLIT_SIDE_TITLE as ue, INK_SPLIT_MODE_VERTICAL as B, INK_WORKSPACE_SPLIT_STACKED_TITLE as Oe, INK_SPLIT_MODE_HORIZONTAL as x, INK_WORKSPACE_SAVE_TITLE as H, INK_WORKSPACE_SEARCH_PLACEHOLDER as Ke, INK_WORKSPACE_NEW_DOC_BUTTON as C, INK_WORKSPACE_NEW_FOLDER as S, INK_WORKSPACE_CLOSE_FOLDER_BUTTON as b, INK_WORKSPACE_UNTITLED_FALLBACK as Re, INK_WORKSPACE_RENAME_TITLE as U, INK_WORKSPACE_DELETE_TITLE as V } from "../../constants/workspace.const.js";
|
|
17
|
+
const Ve = (u) => {
|
|
18
|
+
const {
|
|
19
|
+
documents: p,
|
|
20
|
+
activeDocumentId: O,
|
|
21
|
+
onActiveDocumentChange: K,
|
|
22
|
+
onDocumentChange: r,
|
|
23
|
+
onDocumentDelete: N,
|
|
24
|
+
onDocumentRename: X,
|
|
25
|
+
onDocumentSave: R,
|
|
26
|
+
folders: v = [],
|
|
27
|
+
onFolderCreate: w,
|
|
28
|
+
onFolderDelete: A,
|
|
29
|
+
collaboration: s,
|
|
30
|
+
editorProps: c = {},
|
|
31
|
+
className: j = W,
|
|
32
|
+
style: G
|
|
33
|
+
} = u, {
|
|
34
|
+
sidebarOpen: h,
|
|
35
|
+
setSidebarOpen: Q,
|
|
36
|
+
splitMode: d,
|
|
37
|
+
setSplitMode: E,
|
|
38
|
+
setSecondaryDocId: Z,
|
|
39
|
+
searchQuery: $,
|
|
40
|
+
setSearchQuery: z,
|
|
41
|
+
editingDocId: Y,
|
|
42
|
+
editTitle: q,
|
|
43
|
+
setEditTitle: J,
|
|
44
|
+
activeDocument: o,
|
|
45
|
+
secondaryDocument: l,
|
|
46
|
+
filteredDocs: ee,
|
|
47
|
+
handleCreateDocument: L,
|
|
48
|
+
handleStartRename: y,
|
|
49
|
+
handleSaveRename: P,
|
|
50
|
+
handleCancelRename: ae
|
|
51
|
+
} = se(u), [ie, ne] = le(c.themeId || ce), _ = c.themeId ?? ie, D = (a) => {
|
|
52
|
+
var k;
|
|
53
|
+
ne(a), (k = c.onThemeChange) == null || k.call(c, a);
|
|
54
|
+
};
|
|
55
|
+
return /* @__PURE__ */ i(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
className: m("ink-workspace-root", j),
|
|
59
|
+
style: G,
|
|
60
|
+
"data-split-mode": d,
|
|
61
|
+
"data-ink-theme": _,
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ i("header", { className: "ink-workspace-header", children: [
|
|
64
|
+
/* @__PURE__ */ i("div", { className: "ink-workspace-header-left", children: [
|
|
65
|
+
/* @__PURE__ */ e(
|
|
66
|
+
t,
|
|
67
|
+
{
|
|
68
|
+
type: "button",
|
|
69
|
+
className: "ink-workspace-toggle-btn",
|
|
70
|
+
onClick: () => Q(!h),
|
|
71
|
+
title: h ? f : F,
|
|
72
|
+
"aria-label": h ? f : F,
|
|
73
|
+
children: /* @__PURE__ */ e(de, {})
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ e("span", { className: "ink-workspace-title", children: M }),
|
|
77
|
+
/* @__PURE__ */ i("span", { className: "ink-workspace-count", children: [
|
|
78
|
+
"(",
|
|
79
|
+
p.length,
|
|
80
|
+
" ",
|
|
81
|
+
Se,
|
|
82
|
+
")"
|
|
83
|
+
] })
|
|
84
|
+
] }),
|
|
85
|
+
/* @__PURE__ */ i("div", { className: "ink-workspace-header-right", children: [
|
|
86
|
+
/* @__PURE__ */ i("div", { className: "ink-workspace-split-controls", role: "group", "aria-label": I, children: [
|
|
87
|
+
/* @__PURE__ */ e(
|
|
88
|
+
t,
|
|
89
|
+
{
|
|
90
|
+
type: "button",
|
|
91
|
+
className: m("ink-workspace-icon-btn", d === T && "ink-active"),
|
|
92
|
+
onClick: () => E(T),
|
|
93
|
+
title: be,
|
|
94
|
+
children: /* @__PURE__ */ e(me, {})
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
/* @__PURE__ */ e(
|
|
98
|
+
t,
|
|
99
|
+
{
|
|
100
|
+
type: "button",
|
|
101
|
+
className: m("ink-workspace-icon-btn", d === B && "ink-active"),
|
|
102
|
+
onClick: () => E(B),
|
|
103
|
+
title: ue,
|
|
104
|
+
children: /* @__PURE__ */ e(ke, {})
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
/* @__PURE__ */ e(
|
|
108
|
+
t,
|
|
109
|
+
{
|
|
110
|
+
type: "button",
|
|
111
|
+
className: m("ink-workspace-icon-btn", d === x && "ink-active"),
|
|
112
|
+
onClick: () => E(x),
|
|
113
|
+
title: Oe,
|
|
114
|
+
children: /* @__PURE__ */ e(pe, {})
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
] }),
|
|
118
|
+
R && o && /* @__PURE__ */ e(
|
|
119
|
+
t,
|
|
120
|
+
{
|
|
121
|
+
type: "button",
|
|
122
|
+
className: "ink-workspace-icon-btn",
|
|
123
|
+
onClick: () => R(o.id),
|
|
124
|
+
title: H,
|
|
125
|
+
"aria-label": H,
|
|
126
|
+
children: /* @__PURE__ */ e(he, {})
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
(s == null ? void 0 : s.collaborators) && /* @__PURE__ */ e(
|
|
130
|
+
re,
|
|
131
|
+
{
|
|
132
|
+
collaborators: s.collaborators,
|
|
133
|
+
maxAvatars: s.maxAvatars
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
] })
|
|
137
|
+
] }),
|
|
138
|
+
/* @__PURE__ */ i("div", { className: "ink-workspace-body", children: [
|
|
139
|
+
h && /* @__PURE__ */ i("aside", { className: "ink-workspace-sidebar", "aria-label": M, children: [
|
|
140
|
+
/* @__PURE__ */ i("div", { className: "ink-workspace-sidebar-toolbar", children: [
|
|
141
|
+
/* @__PURE__ */ e(
|
|
142
|
+
"input",
|
|
143
|
+
{
|
|
144
|
+
type: "text",
|
|
145
|
+
className: "ink-workspace-search-input",
|
|
146
|
+
placeholder: Ke,
|
|
147
|
+
value: $,
|
|
148
|
+
onChange: (a) => z(a.target.value)
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
/* @__PURE__ */ e(
|
|
152
|
+
t,
|
|
153
|
+
{
|
|
154
|
+
type: "button",
|
|
155
|
+
className: "ink-workspace-new-doc-btn",
|
|
156
|
+
onClick: L,
|
|
157
|
+
title: C,
|
|
158
|
+
"aria-label": C,
|
|
159
|
+
children: C
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
w && /* @__PURE__ */ e(
|
|
163
|
+
t,
|
|
164
|
+
{
|
|
165
|
+
type: "button",
|
|
166
|
+
className: "ink-workspace-icon-btn",
|
|
167
|
+
onClick: () => w(S),
|
|
168
|
+
title: S,
|
|
169
|
+
"aria-label": S,
|
|
170
|
+
children: /* @__PURE__ */ e(Ne, {})
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
] }),
|
|
174
|
+
v.length > Te && /* @__PURE__ */ e("div", { className: "ink-workspace-folders-section", children: v.map((a) => /* @__PURE__ */ i("div", { className: "ink-workspace-folder-item", children: [
|
|
175
|
+
/* @__PURE__ */ e("span", { className: "ink-doc-icon", children: "📁" }),
|
|
176
|
+
/* @__PURE__ */ e("span", { className: "ink-doc-title", children: a.name }),
|
|
177
|
+
A && /* @__PURE__ */ e(
|
|
178
|
+
t,
|
|
179
|
+
{
|
|
180
|
+
type: "button",
|
|
181
|
+
className: "ink-doc-action-btn ink-delete",
|
|
182
|
+
onClick: () => A(a.id),
|
|
183
|
+
title: b,
|
|
184
|
+
"aria-label": b,
|
|
185
|
+
children: b
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
] }, a.id)) }),
|
|
189
|
+
/* @__PURE__ */ e("div", { className: "ink-workspace-doc-list", role: "tree", children: ee.map((a) => {
|
|
190
|
+
const k = a.id === O, te = Y === a.id;
|
|
191
|
+
return /* @__PURE__ */ i(
|
|
192
|
+
"div",
|
|
193
|
+
{
|
|
194
|
+
role: "treeitem",
|
|
195
|
+
"aria-selected": k,
|
|
196
|
+
className: m("ink-workspace-doc-item", k && "ink-doc-active"),
|
|
197
|
+
onClick: () => K(a.id),
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ e("span", { className: "ink-doc-icon", children: a.icon || /* @__PURE__ */ e(Ee, {}) }),
|
|
200
|
+
te ? /* @__PURE__ */ e(
|
|
201
|
+
"input",
|
|
202
|
+
{
|
|
203
|
+
type: "text",
|
|
204
|
+
className: "ink-doc-title-input",
|
|
205
|
+
value: q,
|
|
206
|
+
autoFocus: !0,
|
|
207
|
+
onChange: (n) => J(n.target.value),
|
|
208
|
+
onBlur: () => P(a.id),
|
|
209
|
+
onKeyDown: (n) => {
|
|
210
|
+
n.key === "Enter" && P(a.id), n.key === "Escape" && ae();
|
|
211
|
+
},
|
|
212
|
+
onClick: (n) => n.stopPropagation()
|
|
213
|
+
}
|
|
214
|
+
) : /* @__PURE__ */ e(
|
|
215
|
+
"span",
|
|
216
|
+
{
|
|
217
|
+
className: "ink-doc-title",
|
|
218
|
+
onDoubleClick: (n) => y(a.id, a.title, n),
|
|
219
|
+
children: a.title || Re
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
a.isDirty && /* @__PURE__ */ e("span", { className: "ink-doc-dirty-dot" }),
|
|
223
|
+
/* @__PURE__ */ i("div", { className: "ink-doc-actions", children: [
|
|
224
|
+
/* @__PURE__ */ e(
|
|
225
|
+
t,
|
|
226
|
+
{
|
|
227
|
+
type: "button",
|
|
228
|
+
className: "ink-doc-action-btn",
|
|
229
|
+
onClick: (n) => y(a.id, a.title, n),
|
|
230
|
+
title: U,
|
|
231
|
+
"aria-label": U,
|
|
232
|
+
children: /* @__PURE__ */ e(_e, {})
|
|
233
|
+
}
|
|
234
|
+
),
|
|
235
|
+
p.length > Ce && N && /* @__PURE__ */ e(
|
|
236
|
+
t,
|
|
237
|
+
{
|
|
238
|
+
type: "button",
|
|
239
|
+
className: "ink-doc-action-btn ink-delete",
|
|
240
|
+
onClick: (n) => {
|
|
241
|
+
n.stopPropagation(), N(a.id);
|
|
242
|
+
},
|
|
243
|
+
title: V,
|
|
244
|
+
"aria-label": V,
|
|
245
|
+
children: /* @__PURE__ */ e(Ie, {})
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
] })
|
|
249
|
+
]
|
|
250
|
+
},
|
|
251
|
+
a.id
|
|
252
|
+
);
|
|
253
|
+
}) })
|
|
254
|
+
] }),
|
|
255
|
+
/* @__PURE__ */ i("main", { className: m("ink-workspace-main-area", `ink-split-${d}`), children: [
|
|
256
|
+
/* @__PURE__ */ i("section", { className: "ink-workspace-pane ink-primary-pane", children: [
|
|
257
|
+
/* @__PURE__ */ e(
|
|
258
|
+
oe,
|
|
259
|
+
{
|
|
260
|
+
documents: p,
|
|
261
|
+
activeDocumentId: O,
|
|
262
|
+
onTabSelect: K,
|
|
263
|
+
onTabClose: N,
|
|
264
|
+
onTabAdd: L,
|
|
265
|
+
onTabRename: X
|
|
266
|
+
}
|
|
267
|
+
),
|
|
268
|
+
o && /* @__PURE__ */ e("div", { className: "ink-workspace-editor-wrapper", children: /* @__PURE__ */ e(
|
|
269
|
+
g,
|
|
270
|
+
{
|
|
271
|
+
value: o.content,
|
|
272
|
+
onChange: (a) => r == null ? void 0 : r(o.id, a),
|
|
273
|
+
readOnly: o.readOnly,
|
|
274
|
+
collaboration: s,
|
|
275
|
+
...c,
|
|
276
|
+
themeId: _,
|
|
277
|
+
onThemeChange: D
|
|
278
|
+
},
|
|
279
|
+
o.id
|
|
280
|
+
) })
|
|
281
|
+
] }),
|
|
282
|
+
d !== T && /* @__PURE__ */ i("section", { className: "ink-workspace-pane ink-secondary-pane", children: [
|
|
283
|
+
/* @__PURE__ */ i("div", { className: "ink-secondary-pane-header", children: [
|
|
284
|
+
/* @__PURE__ */ e("span", { className: "ink-secondary-pane-label", children: I }),
|
|
285
|
+
/* @__PURE__ */ e(
|
|
286
|
+
"select",
|
|
287
|
+
{
|
|
288
|
+
className: "ink-secondary-pane-select",
|
|
289
|
+
value: (l == null ? void 0 : l.id) || W,
|
|
290
|
+
onChange: (a) => Z(a.target.value),
|
|
291
|
+
"aria-label": I,
|
|
292
|
+
children: p.map((a) => /* @__PURE__ */ e("option", { value: a.id, children: a.title }, a.id))
|
|
293
|
+
}
|
|
294
|
+
)
|
|
295
|
+
] }),
|
|
296
|
+
l && /* @__PURE__ */ e("div", { className: "ink-workspace-editor-wrapper", children: /* @__PURE__ */ e(
|
|
297
|
+
g,
|
|
298
|
+
{
|
|
299
|
+
value: l.content,
|
|
300
|
+
onChange: (a) => r == null ? void 0 : r(l.id, a),
|
|
301
|
+
readOnly: l.readOnly,
|
|
302
|
+
...c,
|
|
303
|
+
themeId: _,
|
|
304
|
+
onThemeChange: D
|
|
305
|
+
},
|
|
306
|
+
`sec-${l.id}`
|
|
307
|
+
) })
|
|
308
|
+
] })
|
|
309
|
+
] })
|
|
310
|
+
] })
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
);
|
|
314
|
+
};
|
|
315
|
+
export {
|
|
316
|
+
Ve as InkWorkspace
|
|
317
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]}),t=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"})}),o=()=>e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]}),r=()=>e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"})]}),n=()=>e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),e.jsx("polyline",{points:"17 21 17 13 7 13 7 21"}),e.jsx("polyline",{points:"7 3 7 8 15 8"})]}),s=()=>e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"}),e.jsx("line",{x1:"12",y1:"11",x2:"12",y2:"17"}),e.jsx("line",{x1:"9",y1:"14",x2:"15",y2:"14"})]}),h=()=>e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]}),l=()=>e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),c=()=>e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]});exports.CloseCrossIcon=c;exports.FileDocumentIcon=h;exports.NewFolderIcon=s;exports.RenamePencilIcon=l;exports.SaveDocIcon=n;exports.SidebarToggleIcon=i;exports.SingleViewIcon=t;exports.SplitHorizontalIcon=r;exports.SplitVerticalIcon=o;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare const SidebarToggleIcon: React.FC;
|
|
3
|
+
export declare const SingleViewIcon: React.FC;
|
|
4
|
+
export declare const SplitVerticalIcon: React.FC;
|
|
5
|
+
export declare const SplitHorizontalIcon: React.FC;
|
|
6
|
+
export declare const SaveDocIcon: React.FC;
|
|
7
|
+
export declare const NewFolderIcon: React.FC;
|
|
8
|
+
export declare const FileDocumentIcon: React.FC;
|
|
9
|
+
export declare const RenamePencilIcon: React.FC;
|
|
10
|
+
export declare const CloseCrossIcon: React.FC;
|
|
11
|
+
//# sourceMappingURL=WorkspaceIcons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkspaceIcons.d.ts","sourceRoot":"","sources":["../../../../src/components/InkWorkspace/components/WorkspaceIcons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAKrC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAIlC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAKrC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAKvC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAM/B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAMjC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAKpC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAKpC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAKlC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
const r = () => /* @__PURE__ */ i("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: [
|
|
3
|
+
/* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
4
|
+
/* @__PURE__ */ e("line", { x1: "9", y1: "3", x2: "9", y2: "21" })
|
|
5
|
+
] }), o = () => /* @__PURE__ */ e("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }) }), n = () => /* @__PURE__ */ i("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: [
|
|
6
|
+
/* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
7
|
+
/* @__PURE__ */ e("line", { x1: "12", y1: "3", x2: "12", y2: "21" })
|
|
8
|
+
] }), h = () => /* @__PURE__ */ i("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: [
|
|
9
|
+
/* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
10
|
+
/* @__PURE__ */ e("line", { x1: "3", y1: "12", x2: "21", y2: "12" })
|
|
11
|
+
] }), l = () => /* @__PURE__ */ i("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: [
|
|
12
|
+
/* @__PURE__ */ e("path", { d: "M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" }),
|
|
13
|
+
/* @__PURE__ */ e("polyline", { points: "17 21 17 13 7 13 7 21" }),
|
|
14
|
+
/* @__PURE__ */ e("polyline", { points: "7 3 7 8 15 8" })
|
|
15
|
+
] }), d = () => /* @__PURE__ */ i("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: [
|
|
16
|
+
/* @__PURE__ */ e("path", { d: "M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" }),
|
|
17
|
+
/* @__PURE__ */ e("line", { x1: "12", y1: "11", x2: "12", y2: "17" }),
|
|
18
|
+
/* @__PURE__ */ e("line", { x1: "9", y1: "14", x2: "15", y2: "14" })
|
|
19
|
+
] }), s = () => /* @__PURE__ */ i("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: [
|
|
20
|
+
/* @__PURE__ */ e("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
21
|
+
/* @__PURE__ */ e("polyline", { points: "14 2 14 8 20 8" })
|
|
22
|
+
] }), c = () => /* @__PURE__ */ i("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: [
|
|
23
|
+
/* @__PURE__ */ e("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }),
|
|
24
|
+
/* @__PURE__ */ e("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" })
|
|
25
|
+
] }), a = () => /* @__PURE__ */ i("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: [
|
|
26
|
+
/* @__PURE__ */ e("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
27
|
+
/* @__PURE__ */ e("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
28
|
+
] });
|
|
29
|
+
export {
|
|
30
|
+
a as CloseCrossIcon,
|
|
31
|
+
s as FileDocumentIcon,
|
|
32
|
+
d as NewFolderIcon,
|
|
33
|
+
c as RenamePencilIcon,
|
|
34
|
+
l as SaveDocIcon,
|
|
35
|
+
r as SidebarToggleIcon,
|
|
36
|
+
o as SingleViewIcon,
|
|
37
|
+
h as SplitHorizontalIcon,
|
|
38
|
+
n as SplitVerticalIcon
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),B=require("../../../constants/numbers.cjs"),y=require("../../../constants/generals.const.cjs");require("../../../constants/openai.const.cjs");require("react/jsx-runtime");require("../../../utils/paste.utils.cjs");require("react-dom");const O=require("../../../constants/workspace.const.cjs"),Z=_=>{const{documents:n,activeDocumentId:s,onDocumentCreate:S,onDocumentRename:r,sidebarOpen:p,onSidebarOpenChange:o,splitMode:M,onSplitModeChange:c,secondaryDocumentId:k,onSecondaryDocumentChange:a}=_,[f,E]=t.useState(!0),[T,q]=t.useState(O.INK_SPLIT_MODE_NONE),[N,v]=t.useState(null),[I,R]=t.useState(y.EMPTY_STRING),[m,b]=t.useState(null),[l,C]=t.useState(y.EMPTY_STRING),L=p!==void 0?p:f,P=t.useCallback(e=>{E(e),o==null||o(e)},[o]),w=M!==void 0?M:T,g=t.useCallback(e=>{q(e),c==null||c(e)},[c]),i=k!==void 0?k:N,h=t.useCallback(e=>{v(e),a==null||a(e)},[a]),K=t.useMemo(()=>n.find(e=>e.id===s)||n[B.NUMBER_ZERO],[n,s]),W=t.useMemo(()=>i?n.find(e=>e.id===i)||null:n.find(e=>e.id!==s)||null,[n,i,s]),G=t.useMemo(()=>{const e=I.trim();if(!e)return n;const u=e.toLowerCase();return n.filter(d=>{var D;return d.title.toLowerCase().includes(u)||((D=d.tags)==null?void 0:D.some(A=>A.toLowerCase().includes(u)))})},[n,I]),Q=t.useCallback(()=>{S&&S(O.INK_WORKSPACE_UNTITLED_DOC)},[S]),U=t.useCallback((e,u,d)=>{d.stopPropagation(),b(e),C(u)},[]),Y=t.useCallback(e=>{m===e&&l.trim()&&(r==null||r(e,l.trim())),b(null)},[m,l,r]),j=t.useCallback(()=>{b(null)},[]);return{sidebarOpen:L,setSidebarOpen:P,splitMode:w,setSplitMode:g,secondaryDocId:i,setSecondaryDocId:h,searchQuery:I,setSearchQuery:R,editingDocId:m,editTitle:l,setEditTitle:C,activeDocument:K,secondaryDocument:W,filteredDocs:G,handleCreateDocument:Q,handleStartRename:U,handleSaveRename:Y,handleCancelRename:j}};exports.useInkWorkspace=Z;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { InkDocument, InkWorkspaceProps, InkSplitMode } from '../../../types';
|
|
2
|
+
export interface UseInkWorkspaceReturn {
|
|
3
|
+
sidebarOpen: boolean;
|
|
4
|
+
setSidebarOpen: (open: boolean) => void;
|
|
5
|
+
splitMode: InkSplitMode;
|
|
6
|
+
setSplitMode: (mode: InkSplitMode) => void;
|
|
7
|
+
secondaryDocId: string | null;
|
|
8
|
+
setSecondaryDocId: (id: string | null) => void;
|
|
9
|
+
searchQuery: string;
|
|
10
|
+
setSearchQuery: (query: string) => void;
|
|
11
|
+
editingDocId: string | null;
|
|
12
|
+
editTitle: string;
|
|
13
|
+
setEditTitle: (title: string) => void;
|
|
14
|
+
activeDocument: InkDocument | undefined;
|
|
15
|
+
secondaryDocument: InkDocument | null;
|
|
16
|
+
filteredDocs: InkDocument[];
|
|
17
|
+
handleCreateDocument: () => void;
|
|
18
|
+
handleStartRename: (id: string, currentTitle: string, event: React.MouseEvent) => void;
|
|
19
|
+
handleSaveRename: (id: string) => void;
|
|
20
|
+
handleCancelRename: () => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Custom hook to manage state, split view modes, document filtering,
|
|
24
|
+
* and explorer interactions for the InkWorkspace component.
|
|
25
|
+
*
|
|
26
|
+
* @param props - InkWorkspaceProps containing documents, active ID, and lifecycle callbacks
|
|
27
|
+
* @returns UseInkWorkspaceReturn with state values and interaction handlers
|
|
28
|
+
*/
|
|
29
|
+
export declare const useInkWorkspace: (props: InkWorkspaceProps) => UseInkWorkspaceReturn;
|
|
30
|
+
//# sourceMappingURL=useInkWorkspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInkWorkspace.d.ts","sourceRoot":"","sources":["../../../../src/components/InkWorkspace/hooks/useInkWorkspace.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,YAAY,EACb,MAAM,SAAS,CAAC;AAQjB,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,SAAS,EAAE,YAAY,CAAC;IACxB,YAAY,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3C,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,iBAAiB,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,cAAc,EAAE,WAAW,GAAG,SAAS,CAAC;IACxC,iBAAiB,EAAE,WAAW,GAAG,IAAI,CAAC;IACtC,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,iBAAiB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACvF,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAChC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,iBAAiB,KAAG,qBAyG1D,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useState as o, useCallback as n, useMemo as D } from "react";
|
|
2
|
+
import { NUMBER_ZERO as Z } from "../../../constants/numbers.js";
|
|
3
|
+
import { EMPTY_STRING as N } from "../../../constants/generals.const.js";
|
|
4
|
+
import "../../../constants/openai.const.js";
|
|
5
|
+
import "react/jsx-runtime";
|
|
6
|
+
import "../../../utils/paste.utils.js";
|
|
7
|
+
import "react-dom";
|
|
8
|
+
import { INK_SPLIT_MODE_NONE as j, INK_WORKSPACE_UNTITLED_DOC as z } from "../../../constants/workspace.const.js";
|
|
9
|
+
const nt = (T) => {
|
|
10
|
+
const {
|
|
11
|
+
documents: e,
|
|
12
|
+
activeDocumentId: r,
|
|
13
|
+
onDocumentCreate: p,
|
|
14
|
+
onDocumentRename: s,
|
|
15
|
+
sidebarOpen: O,
|
|
16
|
+
onSidebarOpenChange: i,
|
|
17
|
+
splitMode: y,
|
|
18
|
+
onSplitModeChange: c,
|
|
19
|
+
secondaryDocumentId: E,
|
|
20
|
+
onSecondaryDocumentChange: d
|
|
21
|
+
} = T, [b, v] = o(!0), [C, L] = o(j), [R, w] = o(null), [I, P] = o(N), [S, f] = o(null), [l, M] = o(N), h = O !== void 0 ? O : b, k = n((t) => {
|
|
22
|
+
v(t), i == null || i(t);
|
|
23
|
+
}, [i]), K = y !== void 0 ? y : C, Q = n((t) => {
|
|
24
|
+
L(t), c == null || c(t);
|
|
25
|
+
}, [c]), a = E !== void 0 ? E : R, U = n((t) => {
|
|
26
|
+
w(t), d == null || d(t);
|
|
27
|
+
}, [d]), W = D(
|
|
28
|
+
() => e.find((t) => t.id === r) || e[Z],
|
|
29
|
+
[e, r]
|
|
30
|
+
), g = D(() => a ? e.find((t) => t.id === a) || null : e.find((t) => t.id !== r) || null, [e, a, r]), q = D(() => {
|
|
31
|
+
const t = I.trim();
|
|
32
|
+
if (!t) return e;
|
|
33
|
+
const u = t.toLowerCase();
|
|
34
|
+
return e.filter(
|
|
35
|
+
(m) => {
|
|
36
|
+
var _;
|
|
37
|
+
return m.title.toLowerCase().includes(u) || ((_ = m.tags) == null ? void 0 : _.some((Y) => Y.toLowerCase().includes(u)));
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}, [e, I]), x = n(() => {
|
|
41
|
+
p && p(z);
|
|
42
|
+
}, [p]), A = n((t, u, m) => {
|
|
43
|
+
m.stopPropagation(), f(t), M(u);
|
|
44
|
+
}, []), B = n((t) => {
|
|
45
|
+
S === t && l.trim() && (s == null || s(t, l.trim())), f(null);
|
|
46
|
+
}, [S, l, s]), G = n(() => {
|
|
47
|
+
f(null);
|
|
48
|
+
}, []);
|
|
49
|
+
return {
|
|
50
|
+
sidebarOpen: h,
|
|
51
|
+
setSidebarOpen: k,
|
|
52
|
+
splitMode: K,
|
|
53
|
+
setSplitMode: Q,
|
|
54
|
+
secondaryDocId: a,
|
|
55
|
+
setSecondaryDocId: U,
|
|
56
|
+
searchQuery: I,
|
|
57
|
+
setSearchQuery: P,
|
|
58
|
+
editingDocId: S,
|
|
59
|
+
editTitle: l,
|
|
60
|
+
setEditTitle: M,
|
|
61
|
+
activeDocument: W,
|
|
62
|
+
secondaryDocument: g,
|
|
63
|
+
filteredDocs: q,
|
|
64
|
+
handleCreateDocument: x,
|
|
65
|
+
handleStartRename: A,
|
|
66
|
+
handleSaveRename: B,
|
|
67
|
+
handleCancelRename: G
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export {
|
|
71
|
+
nt as useInkWorkspace
|
|
72
|
+
};
|