@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
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),I=require("../../../../constants/generals.const.cjs"),o=require("../../../../constants/defaults.const.cjs"),P=require("../../../../constants/aiModels.const.cjs");require("../../../../constants/openai.const.cjs");const w=require("../../../../utils/id.utils.cjs");require("../../../../utils/paste.utils.cjs");require("react-dom");const G=require("../../../../plugins/ai/aiPlugin.cjs"),U=L=>{var f,y,S,T;const{config:s,documentHtml:v,selectionHtml:b,onApplyHtml:H,onClose:N,onBusyChange:h}=L,[a,K]=i.useState("chat"),[x,g]=i.useState(""),[c,m]=i.useState([]),[l,q]=i.useState(!1),[d,A]=i.useState(null),[B,D]=i.useState([]),[j,R]=i.useState(o.INK_TRANSLATE_LANGUAGES[1]),M=s.providerId||P.INK_AI_DEMO_PROVIDER_ID,O=((f=s.uiTheme)==null?void 0:f.className)||s.className||"",p=t=>{q(t),h==null||h(t)},u=async(t,r,_)=>{var E;p(!0);try{const C=t==="chat"&&_?[...c,{id:w.createInkId("turn"),role:"user",content:_,timestamp:Date.now(),capability:t}]:c;t==="chat"&&_&&m(C);const n=await G.inkAi.runProvider(M,{capability:t,html:v,selectionHtml:b||void 0,prompt:_,history:C,options:r,modelId:s.modelId,documentSnapshot:{html:v,selectionHtml:b||void 0}});(E=n.turns)!=null&&E.length?m(k=>[...k,...n.turns]):n.text&&t!=="chat"&&m(k=>[...k,{id:w.createInkId("turn"),role:"assistant",content:n.text||"",timestamp:Date.now(),capability:t}]),n.diff&&A(n.diff),n.reviewSuggestions&&D(n.reviewSuggestions)}finally{p(!1)}},$=t=>{t.preventDefault();const r=x.trim();!r||l||(g(""),u("chat",void 0,r))};return e.jsxs("aside",{className:`Ink-Ai ${O}`.trim(),"data-placement":s.placement||"sidebar",style:{"--ink-ai-accent":(y=s.uiTheme)==null?void 0:y.accent,"--ink-ai-surface":(S=s.uiTheme)==null?void 0:S.surface,"--ink-ai-border":(T=s.uiTheme)==null?void 0:T.border},"aria-label":"Ink AI",children:[e.jsxs("div",{className:"Ink-Ai__header",children:[e.jsx("strong",{children:"Ink AI"}),N?e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:N,title:"Close AI",children:"×"}):null]}),e.jsx("div",{className:"Ink-Ai__tabs",role:"tablist",children:[["chat",I.INK_AI_TAB_CHAT],["actions",I.INK_AI_TAB_ACTIONS],["review",I.INK_AI_TAB_REVIEW],["translate",I.INK_AI_TAB_TRANSLATE]].map(([t,r])=>e.jsx("button",{type:"button",role:"tab",className:`${o.INK_CLASS_AI_TAB}${a===t?` ${o.INK_CLASS_AI_TAB_ON}`:""}`,"aria-selected":a===t,onClick:()=>K(t),children:r},t))}),e.jsxs("div",{className:"Ink-Ai__body",children:[a==="chat"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"Ink-Ai__history",children:c.length===0?e.jsxs("p",{className:"Ink-Ai__empty",children:["Multi-turn chat with local demo provider. Bring your own LLM via"," ",e.jsx("code",{children:"inkAi.registerProvider"}),"."]}):c.map(t=>e.jsxs("div",{className:`Ink-Ai__turn Ink-Ai__turn--${t.role}`,children:[e.jsx("span",{children:t.role}),e.jsx("p",{children:t.content})]},t.id))}),e.jsxs("form",{className:"Ink-Ai__form",onSubmit:$,children:[e.jsx("input",{value:x,onChange:t=>g(t.target.value),placeholder:"Ask Ink AI…",disabled:l}),e.jsx("button",{type:"submit",className:"Ink-Editor__button Ink-Editor__button--active",disabled:l,children:"Send"})]})]}):null,a==="actions"?e.jsxs("div",{className:"Ink-Ai__actions",children:[e.jsx("p",{className:"Ink-Ai__hint",children:"Quick actions use the current selection (or full document)."}),o.INK_QUICK_ACTIONS.map(t=>e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Ai__action",disabled:l,onClick:()=>void u(t.capability),children:t.label},t.id))]}):null,a==="review"?e.jsxs("div",{className:"Ink-Ai__review",children:[e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",disabled:l,onClick:()=>void u("review"),children:"Run grammar & style review"}),B.map(t=>e.jsxs("article",{className:`Ink-Ai__suggestion Ink-Ai__suggestion--${t.severity}`,children:[e.jsx("strong",{children:t.severity}),e.jsx("p",{children:t.message}),e.jsx("code",{children:t.suggestedText})]},t.id))]}):null,a==="translate"?e.jsxs("div",{className:"Ink-Ai__translate",children:[e.jsxs("label",{children:["Language",e.jsx("select",{value:j,onChange:t=>R(t.target.value),children:o.INK_TRANSLATE_LANGUAGES.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",disabled:l,onClick:()=>void u("translate",{language:j}),children:"Translate"})]}):null,d?e.jsxs("div",{className:"Ink-Ai__diff",children:[e.jsx("strong",{children:"Suggested change"}),e.jsx("p",{children:d.summary}),e.jsx("div",{className:"Ink-Ai__diff-preview",dangerouslySetInnerHTML:{__html:d.suggestedHtml}}),e.jsxs("div",{className:"Ink-Ai__diff-actions",children:[e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",onClick:()=>{H(d.suggestedHtml),A(null)},children:"Apply"}),e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:()=>A(null),children:"Dismiss"})]})]}):null]}),e.jsx("footer",{className:"Ink-Ai__footer",children:"Demo provider · BYO LLM"})]})};exports.AiPanel=U;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiPanel/AiPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AiPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiPanel/AiPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAY1D,OAAO,KAAK,EAEV,WAAW,EAGZ,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAID,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAyOpC,CAAC"}
|
|
@@ -1,45 +1,46 @@
|
|
|
1
1
|
import { jsxs as n, jsx as t, Fragment as P } from "react/jsx-runtime";
|
|
2
2
|
import { useState as l } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { INK_AI_TAB_CHAT as Q, INK_AI_TAB_ACTIONS as U, INK_AI_TAB_REVIEW as V, INK_AI_TAB_TRANSLATE as F } from "../../../../constants/generals.const.js";
|
|
4
|
+
import { INK_TRANSLATE_LANGUAGES as L, INK_CLASS_AI_TAB as W, INK_CLASS_AI_TAB_ON as Y, INK_QUICK_ACTIONS as q } from "../../../../constants/defaults.const.js";
|
|
5
|
+
import { INK_AI_DEMO_PROVIDER_ID as z } from "../../../../constants/aiModels.const.js";
|
|
5
6
|
import "../../../../constants/openai.const.js";
|
|
6
|
-
import { createInkId as
|
|
7
|
+
import { createInkId as H } from "../../../../utils/id.utils.js";
|
|
7
8
|
import "../../../../utils/paste.utils.js";
|
|
8
9
|
import "react-dom";
|
|
9
|
-
import { inkAi as
|
|
10
|
-
const
|
|
11
|
-
var y,
|
|
12
|
-
const { config: i, documentHtml:
|
|
13
|
-
|
|
14
|
-
},
|
|
10
|
+
import { inkAi as J } from "../../../../plugins/ai/aiPlugin.js";
|
|
11
|
+
const re = (K) => {
|
|
12
|
+
var y, T, C, E;
|
|
13
|
+
const { config: i, documentHtml: k, selectionHtml: p, onApplyHtml: B, onClose: v, onBusyChange: m } = K, [o, D] = l("chat"), [b, N] = l(""), [c, h] = l([]), [a, x] = l(!1), [d, I] = l(null), [R, O] = l([]), [f, $] = l(L[1]), M = i.providerId || z, j = ((y = i.uiTheme) == null ? void 0 : y.className) || i.className || "", g = (e) => {
|
|
14
|
+
x(e), m == null || m(e);
|
|
15
|
+
}, _ = async (e, r, u) => {
|
|
15
16
|
var S;
|
|
16
|
-
|
|
17
|
+
g(!0);
|
|
17
18
|
try {
|
|
18
|
-
const
|
|
19
|
-
...
|
|
19
|
+
const w = e === "chat" && u ? [
|
|
20
|
+
...c,
|
|
20
21
|
{
|
|
21
|
-
id:
|
|
22
|
+
id: H("turn"),
|
|
22
23
|
role: "user",
|
|
23
|
-
content:
|
|
24
|
+
content: u,
|
|
24
25
|
timestamp: Date.now(),
|
|
25
26
|
capability: e
|
|
26
27
|
}
|
|
27
|
-
] :
|
|
28
|
-
e === "chat" &&
|
|
29
|
-
const s = await
|
|
28
|
+
] : c;
|
|
29
|
+
e === "chat" && u && h(w);
|
|
30
|
+
const s = await J.runProvider(M, {
|
|
30
31
|
capability: e,
|
|
31
|
-
html:
|
|
32
|
-
selectionHtml:
|
|
33
|
-
prompt:
|
|
34
|
-
history:
|
|
35
|
-
options:
|
|
32
|
+
html: k,
|
|
33
|
+
selectionHtml: p || void 0,
|
|
34
|
+
prompt: u,
|
|
35
|
+
history: w,
|
|
36
|
+
options: r,
|
|
36
37
|
modelId: i.modelId,
|
|
37
|
-
documentSnapshot: { html:
|
|
38
|
+
documentSnapshot: { html: k, selectionHtml: p || void 0 }
|
|
38
39
|
});
|
|
39
|
-
(S = s.turns) != null && S.length ? h((
|
|
40
|
-
...
|
|
40
|
+
(S = s.turns) != null && S.length ? h((A) => [...A, ...s.turns]) : s.text && e !== "chat" && h((A) => [
|
|
41
|
+
...A,
|
|
41
42
|
{
|
|
42
|
-
id:
|
|
43
|
+
id: H("turn"),
|
|
43
44
|
role: "assistant",
|
|
44
45
|
content: s.text || "",
|
|
45
46
|
timestamp: Date.now(),
|
|
@@ -47,12 +48,12 @@ const te = (L) => {
|
|
|
47
48
|
}
|
|
48
49
|
]), s.diff && I(s.diff), s.reviewSuggestions && O(s.reviewSuggestions);
|
|
49
50
|
} finally {
|
|
50
|
-
|
|
51
|
+
g(!1);
|
|
51
52
|
}
|
|
52
53
|
}, G = (e) => {
|
|
53
54
|
e.preventDefault();
|
|
54
|
-
const
|
|
55
|
-
!
|
|
55
|
+
const r = b.trim();
|
|
56
|
+
!r || a || (N(""), _("chat", void 0, r));
|
|
56
57
|
};
|
|
57
58
|
return /* @__PURE__ */ n(
|
|
58
59
|
"aside",
|
|
@@ -60,36 +61,41 @@ const te = (L) => {
|
|
|
60
61
|
className: `Ink-Ai ${j}`.trim(),
|
|
61
62
|
"data-placement": i.placement || "sidebar",
|
|
62
63
|
style: {
|
|
63
|
-
"--ink-ai-accent": (
|
|
64
|
-
"--ink-ai-surface": (
|
|
65
|
-
"--ink-ai-border": (
|
|
64
|
+
"--ink-ai-accent": (T = i.uiTheme) == null ? void 0 : T.accent,
|
|
65
|
+
"--ink-ai-surface": (C = i.uiTheme) == null ? void 0 : C.surface,
|
|
66
|
+
"--ink-ai-border": (E = i.uiTheme) == null ? void 0 : E.border
|
|
66
67
|
},
|
|
67
68
|
"aria-label": "Ink AI",
|
|
68
69
|
children: [
|
|
69
70
|
/* @__PURE__ */ n("div", { className: "Ink-Ai__header", children: [
|
|
70
71
|
/* @__PURE__ */ t("strong", { children: "Ink AI" }),
|
|
71
|
-
|
|
72
|
+
v ? /* @__PURE__ */ t("button", { type: "button", className: "Ink-Editor__button", onClick: v, title: "Close AI", children: "×" }) : null
|
|
72
73
|
] }),
|
|
73
|
-
/* @__PURE__ */ t("div", { className: "Ink-Ai__tabs", role: "tablist", children: [
|
|
74
|
+
/* @__PURE__ */ t("div", { className: "Ink-Ai__tabs", role: "tablist", children: [
|
|
75
|
+
["chat", Q],
|
|
76
|
+
["actions", U],
|
|
77
|
+
["review", V],
|
|
78
|
+
["translate", F]
|
|
79
|
+
].map(([e, r]) => /* @__PURE__ */ t(
|
|
74
80
|
"button",
|
|
75
81
|
{
|
|
76
82
|
type: "button",
|
|
77
83
|
role: "tab",
|
|
78
|
-
className:
|
|
84
|
+
className: `${W}${o === e ? ` ${Y}` : ""}`,
|
|
79
85
|
"aria-selected": o === e,
|
|
80
|
-
onClick: () =>
|
|
81
|
-
children:
|
|
86
|
+
onClick: () => D(e),
|
|
87
|
+
children: r
|
|
82
88
|
},
|
|
83
89
|
e
|
|
84
90
|
)) }),
|
|
85
91
|
/* @__PURE__ */ n("div", { className: "Ink-Ai__body", children: [
|
|
86
92
|
o === "chat" ? /* @__PURE__ */ n(P, { children: [
|
|
87
|
-
/* @__PURE__ */ t("div", { className: "Ink-Ai__history", children:
|
|
93
|
+
/* @__PURE__ */ t("div", { className: "Ink-Ai__history", children: c.length === 0 ? /* @__PURE__ */ n("p", { className: "Ink-Ai__empty", children: [
|
|
88
94
|
"Multi-turn chat with local demo provider. Bring your own LLM via",
|
|
89
95
|
" ",
|
|
90
96
|
/* @__PURE__ */ t("code", { children: "inkAi.registerProvider" }),
|
|
91
97
|
"."
|
|
92
|
-
] }) :
|
|
98
|
+
] }) : c.map((e) => /* @__PURE__ */ n("div", { className: `Ink-Ai__turn Ink-Ai__turn--${e.role}`, children: [
|
|
93
99
|
/* @__PURE__ */ t("span", { children: e.role }),
|
|
94
100
|
/* @__PURE__ */ t("p", { children: e.content })
|
|
95
101
|
] }, e.id)) }),
|
|
@@ -97,8 +103,8 @@ const te = (L) => {
|
|
|
97
103
|
/* @__PURE__ */ t(
|
|
98
104
|
"input",
|
|
99
105
|
{
|
|
100
|
-
value:
|
|
101
|
-
onChange: (e) =>
|
|
106
|
+
value: b,
|
|
107
|
+
onChange: (e) => N(e.target.value),
|
|
102
108
|
placeholder: "Ask Ink AI…",
|
|
103
109
|
disabled: a
|
|
104
110
|
}
|
|
@@ -108,13 +114,13 @@ const te = (L) => {
|
|
|
108
114
|
] }) : null,
|
|
109
115
|
o === "actions" ? /* @__PURE__ */ n("div", { className: "Ink-Ai__actions", children: [
|
|
110
116
|
/* @__PURE__ */ t("p", { className: "Ink-Ai__hint", children: "Quick actions use the current selection (or full document)." }),
|
|
111
|
-
|
|
117
|
+
q.map((e) => /* @__PURE__ */ t(
|
|
112
118
|
"button",
|
|
113
119
|
{
|
|
114
120
|
type: "button",
|
|
115
121
|
className: "Ink-Editor__button Ink-Ai__action",
|
|
116
122
|
disabled: a,
|
|
117
|
-
onClick: () => void
|
|
123
|
+
onClick: () => void _(e.capability),
|
|
118
124
|
children: e.label
|
|
119
125
|
},
|
|
120
126
|
e.id
|
|
@@ -127,11 +133,11 @@ const te = (L) => {
|
|
|
127
133
|
type: "button",
|
|
128
134
|
className: "Ink-Editor__button Ink-Editor__button--active",
|
|
129
135
|
disabled: a,
|
|
130
|
-
onClick: () => void
|
|
136
|
+
onClick: () => void _("review"),
|
|
131
137
|
children: "Run grammar & style review"
|
|
132
138
|
}
|
|
133
139
|
),
|
|
134
|
-
|
|
140
|
+
R.map((e) => /* @__PURE__ */ n("article", { className: `Ink-Ai__suggestion Ink-Ai__suggestion--${e.severity}`, children: [
|
|
135
141
|
/* @__PURE__ */ t("strong", { children: e.severity }),
|
|
136
142
|
/* @__PURE__ */ t("p", { children: e.message }),
|
|
137
143
|
/* @__PURE__ */ t("code", { children: e.suggestedText })
|
|
@@ -140,7 +146,7 @@ const te = (L) => {
|
|
|
140
146
|
o === "translate" ? /* @__PURE__ */ n("div", { className: "Ink-Ai__translate", children: [
|
|
141
147
|
/* @__PURE__ */ n("label", { children: [
|
|
142
148
|
"Language",
|
|
143
|
-
/* @__PURE__ */ t("select", { value:
|
|
149
|
+
/* @__PURE__ */ t("select", { value: f, onChange: (e) => $(e.target.value), children: L.map((e) => /* @__PURE__ */ t("option", { value: e, children: e }, e)) })
|
|
144
150
|
] }),
|
|
145
151
|
/* @__PURE__ */ t(
|
|
146
152
|
"button",
|
|
@@ -148,15 +154,15 @@ const te = (L) => {
|
|
|
148
154
|
type: "button",
|
|
149
155
|
className: "Ink-Editor__button Ink-Editor__button--active",
|
|
150
156
|
disabled: a,
|
|
151
|
-
onClick: () => void
|
|
157
|
+
onClick: () => void _("translate", { language: f }),
|
|
152
158
|
children: "Translate"
|
|
153
159
|
}
|
|
154
160
|
)
|
|
155
161
|
] }) : null,
|
|
156
|
-
|
|
162
|
+
d ? /* @__PURE__ */ n("div", { className: "Ink-Ai__diff", children: [
|
|
157
163
|
/* @__PURE__ */ t("strong", { children: "Suggested change" }),
|
|
158
|
-
/* @__PURE__ */ t("p", { children:
|
|
159
|
-
/* @__PURE__ */ t("div", { className: "Ink-Ai__diff-preview", dangerouslySetInnerHTML: { __html:
|
|
164
|
+
/* @__PURE__ */ t("p", { children: d.summary }),
|
|
165
|
+
/* @__PURE__ */ t("div", { className: "Ink-Ai__diff-preview", dangerouslySetInnerHTML: { __html: d.suggestedHtml } }),
|
|
160
166
|
/* @__PURE__ */ n("div", { className: "Ink-Ai__diff-actions", children: [
|
|
161
167
|
/* @__PURE__ */ t(
|
|
162
168
|
"button",
|
|
@@ -164,7 +170,7 @@ const te = (L) => {
|
|
|
164
170
|
type: "button",
|
|
165
171
|
className: "Ink-Editor__button Ink-Editor__button--active",
|
|
166
172
|
onClick: () => {
|
|
167
|
-
|
|
173
|
+
B(d.suggestedHtml), I(null);
|
|
168
174
|
},
|
|
169
175
|
children: "Apply"
|
|
170
176
|
}
|
|
@@ -179,5 +185,5 @@ const te = (L) => {
|
|
|
179
185
|
);
|
|
180
186
|
};
|
|
181
187
|
export {
|
|
182
|
-
|
|
188
|
+
re as AiPanel
|
|
183
189
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),E=require("react"),B=require("react-dom"),s=require("../../../../constants/numbers.cjs"),c=require("../../../../constants/generals.const.cjs"),P=require("../../../../constants/colorMode.const.cjs"),G=require("../../../../constants/keyboard.const.cjs"),o=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");const u=require("../../../../plugins/excel/excel.utils.cjs"),V=require("../ToolbarDropdown/ToolbarDropdown.utils.cjs"),k=require("../ToolbarButton/ToolbarButton.cjs"),F=X=>{var b;const{icon:D,disabled:O=!1,hint:w,onHint:g,pluginColor:I,onInsert:j}=X,[M,R]=E.useState(!1),[r,i]=E.useState(u.createEmptyExcelGrid),[S,d]=E.useState(null),[m,N]=E.useState(null),[T,y]=E.useState({top:s.NUMBER_ZERO,left:s.NUMBER_ZERO}),A=E.useRef(null),K=E.useRef(null),p=E.useRef(null),h=E.useRef(null),v=((b=r[s.NUMBER_ZERO])==null?void 0:b.length)??s.NUMBER_ONE,$=r.length<s.INK_EXCEL_SHEET_MAX_ROWS,x=v<s.INK_EXCEL_SHEET_MAX_COLS,H=r.length>s.NUMBER_ONE,U=v>s.NUMBER_ONE;E.useEffect(()=>{if(!M)return;const e=()=>{var L;const l=(L=p.current)==null?void 0:L.getBoundingClientRect().height,C=V.getToolbarDropdownMenuPosition(K.current,l&&l>s.NUMBER_ZERO?l:s.INK_EXCEL_MENU_ESTIMATED_HEIGHT_PX);y({top:C.top,left:C.left})};e();const t=window.requestAnimationFrame(e),_=l=>{var L,f;const C=l.target;(L=A.current)!=null&&L.contains(C)||(f=p.current)!=null&&f.contains(C)||R(!1)},a=l=>{l.key===G.KEY_ESCAPE&&R(!1)};return document.addEventListener("mousedown",_),document.addEventListener("keydown",a),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.cancelAnimationFrame(t),document.removeEventListener("mousedown",_),document.removeEventListener("keydown",a),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[M,r.length,v]);const q=e=>{var a;const t=(a=e.target.files)==null?void 0:a[s.NUMBER_ZERO];if(!t)return;const _=new FileReader;_.onload=()=>{i(u.parseCsvText(String(_.result)))},_.readAsText(t)};return n.jsxs("div",{className:o.INK_CLASS_STYLE_DD,ref:A,children:[n.jsx("div",{ref:K,children:n.jsx(k.ToolbarButton,{icon:D,title:c.INK_EXCEL_TITLE,hint:w,onHint:g,pluginColor:I,disabled:O,onClick:()=>{O||(i(u.createEmptyExcelGrid()),R(e=>!e))}})}),M?B.createPortal(n.jsxs("div",{ref:p,className:`${o.INK_CLASS_STYLE_MENU} ${o.INK_CLASS_STYLE_MENU_PORTAL} ${o.INK_CLASS_STYLE_MENU_FORCED} ${o.INK_CLASS_EXCEL_PANEL}`,"data-color-mode":P.COLOR_MODE_LIGHT,role:"dialog","aria-label":c.INK_EXCEL_TITLE,style:{top:T.top,left:T.left},children:[n.jsx("div",{className:o.INK_CLASS_EXCEL_TITLE,children:c.INK_EXCEL_TITLE}),n.jsxs("div",{className:o.INK_CLASS_EXCEL_GRID,style:{gridTemplateColumns:`2rem repeat(${v}, minmax(0, 1fr))`},onMouseLeave:()=>{d(null),N(null)},children:[n.jsx("span",{className:o.INK_CLASS_EXCEL_CORNER}),(r[s.NUMBER_ZERO]??[]).map((e,t)=>{const _=S!==null&&t<=S;return n.jsx("span",{className:`${o.INK_CLASS_EXCEL_HEAD}${_?` ${o.INK_CLASS_EXCEL_COL_HOVER}`:""}`,onMouseEnter:()=>d(t),onMouseMove:()=>d(t),children:o.EXCEL_COL_LETTERS[t]??t+s.NUMBER_ONE},`h-${t}`)}),r.map((e,t)=>{const _=m!==null&&t<=m;return n.jsxs(E.Fragment,{children:[n.jsx("span",{className:`${o.INK_CLASS_EXCEL_HEAD}${_?` ${o.INK_CLASS_EXCEL_ROW_HOVER}`:""}`,onMouseEnter:()=>N(t),onMouseMove:()=>N(t),children:t+s.NUMBER_ONE}),e.map((a,l)=>{const C=S!==null&&l<=S,L=m!==null&&t<=m;return n.jsx("input",{className:`${o.INK_CLASS_EXCEL_CELL}${C?` ${o.INK_CLASS_EXCEL_COL_HOVER}`:""}${L?` ${o.INK_CLASS_EXCEL_ROW_HOVER}`:""}`,value:a,onMouseEnter:()=>{d(l),N(t)},onMouseMove:()=>{d(l),N(t)},onChange:f=>i(u.setExcelCell(r,t,l,f.target.value))},`${t}-${l}`)})]},`row-${t}`)})]}),n.jsxs("div",{className:o.INK_CLASS_EXCEL_ACTIONS,children:[n.jsx("button",{type:"button",disabled:!$,onMouseDown:e=>{e.preventDefault(),i(u.addExcelRow(r))},children:c.INK_EXCEL_ADD_ROW}),n.jsx("button",{type:"button",disabled:!x,onMouseDown:e=>{e.preventDefault(),i(u.addExcelCol(r))},children:c.INK_EXCEL_ADD_COL}),n.jsx("button",{type:"button",disabled:!H,onMouseDown:e=>{e.preventDefault(),i(u.removeExcelRow(r))},children:c.INK_EXCEL_REMOVE_ROW}),n.jsx("button",{type:"button",disabled:!U,onMouseDown:e=>{e.preventDefault(),i(u.removeExcelCol(r))},children:c.INK_EXCEL_REMOVE_COL}),n.jsx("button",{type:"button",onMouseDown:e=>{e.preventDefault(),i(u.clearExcelGrid(r))},children:c.INK_EXCEL_CLEAR}),n.jsx("button",{type:"button",onMouseDown:e=>{var t;e.preventDefault(),(t=h.current)==null||t.click()},children:c.INK_EXCEL_IMPORT}),n.jsx("button",{type:"button",className:o.INK_CLASS_EXCEL_INSERT,onMouseDown:e=>{e.preventDefault(),j(u.excelGridToTableHtml(r)),R(!1)},children:c.INK_EXCEL_INSERT})]}),n.jsx("input",{ref:h,type:"file",accept:u.CSV_ACCEPT,hidden:!0,onChange:q})]}),document.body):null]})};exports.ExcelSheetPanel=F;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExcelSheetPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2D,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAgDzF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAmOpD,CAAC"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { jsxs as m, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as C, useRef as v, useEffect as j, Fragment as z } from "react";
|
|
3
|
+
import { createPortal as q } from "react-dom";
|
|
4
|
+
import { NUMBER_ZERO as c, NUMBER_ONE as d, INK_EXCEL_SHEET_MAX_ROWS as Z, INK_EXCEL_SHEET_MAX_COLS as J, INK_EXCEL_MENU_ESTIMATED_HEIGHT_PX as Q } from "../../../../constants/numbers.js";
|
|
5
|
+
import { INK_EXCEL_TITLE as A, INK_EXCEL_ADD_ROW as x, INK_EXCEL_ADD_COL as ee, INK_EXCEL_REMOVE_ROW as te, INK_EXCEL_REMOVE_COL as ne, INK_EXCEL_CLEAR as oe, INK_EXCEL_IMPORT as re, INK_EXCEL_INSERT as le } from "../../../../constants/generals.const.js";
|
|
6
|
+
import { COLOR_MODE_LIGHT as se } from "../../../../constants/colorMode.const.js";
|
|
7
|
+
import { KEY_ESCAPE as ie } from "../../../../constants/keyboard.const.js";
|
|
8
|
+
import { INK_CLASS_STYLE_DD as Ee, INK_CLASS_STYLE_MENU as ae, INK_CLASS_STYLE_MENU_PORTAL as ce, INK_CLASS_STYLE_MENU_FORCED as ue, INK_CLASS_EXCEL_PANEL as _e, INK_CLASS_EXCEL_TITLE as me, INK_CLASS_EXCEL_GRID as Ce, INK_CLASS_EXCEL_CORNER as de, EXCEL_COL_LETTERS as Le, INK_CLASS_EXCEL_HEAD as b, INK_CLASS_EXCEL_COL_HOVER as O, INK_CLASS_EXCEL_ROW_HOVER as g, INK_CLASS_EXCEL_CELL as pe, INK_CLASS_EXCEL_ACTIONS as fe, INK_CLASS_EXCEL_INSERT as Ne } from "../../../../constants/defaults.const.js";
|
|
9
|
+
import "../../../../constants/openai.const.js";
|
|
10
|
+
import "../../../../utils/paste.utils.js";
|
|
11
|
+
import { createEmptyExcelGrid as $, setExcelCell as Se, addExcelRow as ve, addExcelCol as Re, removeExcelRow as Me, removeExcelCol as Ae, clearExcelGrid as he, excelGridToTableHtml as Te, CSV_ACCEPT as Ke, parseCsvText as De } from "../../../../plugins/excel/excel.utils.js";
|
|
12
|
+
import { getToolbarDropdownMenuPosition as we } from "../ToolbarDropdown/ToolbarDropdown.utils.js";
|
|
13
|
+
import { ToolbarButton as Xe } from "../ToolbarButton/ToolbarButton.js";
|
|
14
|
+
const Ye = (I) => {
|
|
15
|
+
var X;
|
|
16
|
+
const { icon: y, disabled: h = !1, hint: H, onHint: P, pluginColor: G, onInsert: F } = I, [R, L] = C(!1), [o, s] = C($), [p, u] = C(null), [f, _] = C(null), [T, U] = C({ top: c, left: c }), K = v(null), D = v(null), M = v(null), w = v(null), N = ((X = o[c]) == null ? void 0 : X.length) ?? d, k = o.length < Z, V = N < J, Y = o.length > d, B = N > d;
|
|
17
|
+
j(() => {
|
|
18
|
+
if (!R) return;
|
|
19
|
+
const e = () => {
|
|
20
|
+
var a;
|
|
21
|
+
const r = (a = M.current) == null ? void 0 : a.getBoundingClientRect().height, E = we(
|
|
22
|
+
D.current,
|
|
23
|
+
r && r > c ? r : Q
|
|
24
|
+
);
|
|
25
|
+
U({ top: E.top, left: E.left });
|
|
26
|
+
};
|
|
27
|
+
e();
|
|
28
|
+
const t = window.requestAnimationFrame(e), l = (r) => {
|
|
29
|
+
var a, S;
|
|
30
|
+
const E = r.target;
|
|
31
|
+
(a = K.current) != null && a.contains(E) || (S = M.current) != null && S.contains(E) || L(!1);
|
|
32
|
+
}, i = (r) => {
|
|
33
|
+
r.key === ie && L(!1);
|
|
34
|
+
};
|
|
35
|
+
return document.addEventListener("mousedown", l), document.addEventListener("keydown", i), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
36
|
+
window.cancelAnimationFrame(t), document.removeEventListener("mousedown", l), document.removeEventListener("keydown", i), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
37
|
+
};
|
|
38
|
+
}, [R, o.length, N]);
|
|
39
|
+
const W = (e) => {
|
|
40
|
+
var i;
|
|
41
|
+
const t = (i = e.target.files) == null ? void 0 : i[c];
|
|
42
|
+
if (!t) return;
|
|
43
|
+
const l = new FileReader();
|
|
44
|
+
l.onload = () => {
|
|
45
|
+
s(De(String(l.result)));
|
|
46
|
+
}, l.readAsText(t);
|
|
47
|
+
};
|
|
48
|
+
return /* @__PURE__ */ m("div", { className: Ee, ref: K, children: [
|
|
49
|
+
/* @__PURE__ */ n("div", { ref: D, children: /* @__PURE__ */ n(
|
|
50
|
+
Xe,
|
|
51
|
+
{
|
|
52
|
+
icon: y,
|
|
53
|
+
title: A,
|
|
54
|
+
hint: H,
|
|
55
|
+
onHint: P,
|
|
56
|
+
pluginColor: G,
|
|
57
|
+
disabled: h,
|
|
58
|
+
onClick: () => {
|
|
59
|
+
h || (s($()), L((e) => !e));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
) }),
|
|
63
|
+
R ? q(
|
|
64
|
+
/* @__PURE__ */ m(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
ref: M,
|
|
68
|
+
className: `${ae} ${ce} ${ue} ${_e}`,
|
|
69
|
+
"data-color-mode": se,
|
|
70
|
+
role: "dialog",
|
|
71
|
+
"aria-label": A,
|
|
72
|
+
style: { top: T.top, left: T.left },
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ n("div", { className: me, children: A }),
|
|
75
|
+
/* @__PURE__ */ m(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
className: Ce,
|
|
79
|
+
style: {
|
|
80
|
+
gridTemplateColumns: `2rem repeat(${N}, minmax(0, 1fr))`
|
|
81
|
+
},
|
|
82
|
+
onMouseLeave: () => {
|
|
83
|
+
u(null), _(null);
|
|
84
|
+
},
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ n("span", { className: de }),
|
|
87
|
+
(o[c] ?? []).map((e, t) => {
|
|
88
|
+
const l = p !== null && t <= p;
|
|
89
|
+
return /* @__PURE__ */ n(
|
|
90
|
+
"span",
|
|
91
|
+
{
|
|
92
|
+
className: `${b}${l ? ` ${O}` : ""}`,
|
|
93
|
+
onMouseEnter: () => u(t),
|
|
94
|
+
onMouseMove: () => u(t),
|
|
95
|
+
children: Le[t] ?? t + d
|
|
96
|
+
},
|
|
97
|
+
`h-${t}`
|
|
98
|
+
);
|
|
99
|
+
}),
|
|
100
|
+
o.map((e, t) => {
|
|
101
|
+
const l = f !== null && t <= f;
|
|
102
|
+
return /* @__PURE__ */ m(z, { children: [
|
|
103
|
+
/* @__PURE__ */ n(
|
|
104
|
+
"span",
|
|
105
|
+
{
|
|
106
|
+
className: `${b}${l ? ` ${g}` : ""}`,
|
|
107
|
+
onMouseEnter: () => _(t),
|
|
108
|
+
onMouseMove: () => _(t),
|
|
109
|
+
children: t + d
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
e.map((i, r) => {
|
|
113
|
+
const E = p !== null && r <= p, a = f !== null && t <= f;
|
|
114
|
+
return /* @__PURE__ */ n(
|
|
115
|
+
"input",
|
|
116
|
+
{
|
|
117
|
+
className: `${pe}${E ? ` ${O}` : ""}${a ? ` ${g}` : ""}`,
|
|
118
|
+
value: i,
|
|
119
|
+
onMouseEnter: () => {
|
|
120
|
+
u(r), _(t);
|
|
121
|
+
},
|
|
122
|
+
onMouseMove: () => {
|
|
123
|
+
u(r), _(t);
|
|
124
|
+
},
|
|
125
|
+
onChange: (S) => s(Se(o, t, r, S.target.value))
|
|
126
|
+
},
|
|
127
|
+
`${t}-${r}`
|
|
128
|
+
);
|
|
129
|
+
})
|
|
130
|
+
] }, `row-${t}`);
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ m("div", { className: fe, children: [
|
|
136
|
+
/* @__PURE__ */ n(
|
|
137
|
+
"button",
|
|
138
|
+
{
|
|
139
|
+
type: "button",
|
|
140
|
+
disabled: !k,
|
|
141
|
+
onMouseDown: (e) => {
|
|
142
|
+
e.preventDefault(), s(ve(o));
|
|
143
|
+
},
|
|
144
|
+
children: x
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
/* @__PURE__ */ n(
|
|
148
|
+
"button",
|
|
149
|
+
{
|
|
150
|
+
type: "button",
|
|
151
|
+
disabled: !V,
|
|
152
|
+
onMouseDown: (e) => {
|
|
153
|
+
e.preventDefault(), s(Re(o));
|
|
154
|
+
},
|
|
155
|
+
children: ee
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
/* @__PURE__ */ n(
|
|
159
|
+
"button",
|
|
160
|
+
{
|
|
161
|
+
type: "button",
|
|
162
|
+
disabled: !Y,
|
|
163
|
+
onMouseDown: (e) => {
|
|
164
|
+
e.preventDefault(), s(Me(o));
|
|
165
|
+
},
|
|
166
|
+
children: te
|
|
167
|
+
}
|
|
168
|
+
),
|
|
169
|
+
/* @__PURE__ */ n(
|
|
170
|
+
"button",
|
|
171
|
+
{
|
|
172
|
+
type: "button",
|
|
173
|
+
disabled: !B,
|
|
174
|
+
onMouseDown: (e) => {
|
|
175
|
+
e.preventDefault(), s(Ae(o));
|
|
176
|
+
},
|
|
177
|
+
children: ne
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
/* @__PURE__ */ n(
|
|
181
|
+
"button",
|
|
182
|
+
{
|
|
183
|
+
type: "button",
|
|
184
|
+
onMouseDown: (e) => {
|
|
185
|
+
e.preventDefault(), s(he(o));
|
|
186
|
+
},
|
|
187
|
+
children: oe
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
/* @__PURE__ */ n(
|
|
191
|
+
"button",
|
|
192
|
+
{
|
|
193
|
+
type: "button",
|
|
194
|
+
onMouseDown: (e) => {
|
|
195
|
+
var t;
|
|
196
|
+
e.preventDefault(), (t = w.current) == null || t.click();
|
|
197
|
+
},
|
|
198
|
+
children: re
|
|
199
|
+
}
|
|
200
|
+
),
|
|
201
|
+
/* @__PURE__ */ n(
|
|
202
|
+
"button",
|
|
203
|
+
{
|
|
204
|
+
type: "button",
|
|
205
|
+
className: Ne,
|
|
206
|
+
onMouseDown: (e) => {
|
|
207
|
+
e.preventDefault(), F(Te(o)), L(!1);
|
|
208
|
+
},
|
|
209
|
+
children: le
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
] }),
|
|
213
|
+
/* @__PURE__ */ n("input", { ref: w, type: "file", accept: Ke, hidden: !0, onChange: W })
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
),
|
|
217
|
+
document.body
|
|
218
|
+
) : null
|
|
219
|
+
] });
|
|
220
|
+
};
|
|
221
|
+
export {
|
|
222
|
+
Ye as ExcelSheetPanel
|
|
223
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ExcelSheetPanelProps = {
|
|
3
|
+
icon: ReactNode;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
hint?: string;
|
|
6
|
+
onHint?: (hint: string) => void;
|
|
7
|
+
pluginColor?: string;
|
|
8
|
+
onInsert: (html: string) => void;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=ExcelSheetPanel.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExcelSheetPanel.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/ExcelSheetPanel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("react"),N=require("@forgedevstack/bear"),s=require("../../../../constants/numbers.cjs"),l=require("../../../../constants/generals.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("react-dom");const O=require("../../../../plugins/graph/graph.const.cjs"),C=()=>({label:"•",value:s.NUMBER_ONE}),G=j=>{const{open:p,mode:E,points:d,colors:n,onClose:R,onApply:P}=j,[m,_]=h.useState(d),[v,M]=h.useState(n.length>s.NUMBER_ZERO?n:[...O.GRAPH_COLORS]);h.useEffect(()=>{p&&(_(d),M(n.length>s.NUMBER_ZERO?n:[...O.GRAPH_COLORS]))},[p,d,n]);const b=E==="colors"?l.INK_GRAPH_COLORS_TITLE:l.INK_GRAPH_VALUES_TITLE;return e.jsx(N.Modal,{isOpen:p,onClose:R,title:b,size:"md",footer:e.jsxs(e.Fragment,{children:[e.jsx(N.Button,{variant:"outline",onClick:R,children:l.INK_GRAPH_CANCEL}),e.jsx(N.Button,{variant:"primary",onClick:()=>P(m,v),children:l.INK_GRAPH_APPLY})]}),children:E==="values"?e.jsxs("div",{className:"Ink-GraphModal",children:[m.map((r,a)=>e.jsxs("div",{className:"Ink-GraphModal__row",children:[e.jsx("input",{value:r.label,"aria-label":`Label ${a+s.NUMBER_ONE}`,onChange:o=>{const i=o.target.value;_(c=>c.map((t,u)=>u===a?{...t,label:i}:t))}}),e.jsx("input",{type:"number",value:r.value,"aria-label":`Value ${a+s.NUMBER_ONE}`,onChange:o=>{const i=Number(o.target.value)||s.NUMBER_ZERO;_(c=>c.map((t,u)=>u===a?{...t,value:i}:t))}})]},`${r.label}-${a}`)),e.jsx(N.Button,{variant:"outline",size:"sm",onClick:()=>_(r=>[...r,C()]),children:l.INK_GRAPH_ADD_POINT})]}):e.jsx("div",{className:"Ink-GraphModal",children:v.map((r,a)=>e.jsxs("label",{className:"Ink-GraphModal__row",children:[e.jsx("span",{children:a+s.NUMBER_ONE}),e.jsx("input",{type:"color",value:r,onChange:o=>{const i=o.target.value||l.EMPTY_STRING;M(c=>c.map((t,u)=>u===a?i:t))}})]},`${r}-${a}`))})})};exports.GraphEditModal=G;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphEditModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/GraphEditModal/GraphEditModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAcrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAIlE,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA4FlD,CAAC"}
|