@forgedevstack/ink 1.1.9 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -1
- package/dist/common-components/Box/Box.cjs +1 -1
- package/dist/common-components/Box/Box.js +7 -6
- package/dist/common-components/Button/Button.cjs +1 -1
- package/dist/common-components/Button/Button.js +9 -8
- package/dist/common-components/Canvas/Canvas.cjs +1 -1
- package/dist/common-components/Canvas/Canvas.js +3 -2
- package/dist/common-components/ContextMenu/ContextMenu.cjs +1 -1
- package/dist/common-components/ContextMenu/ContextMenu.js +3 -2
- package/dist/common-components/Field/Field.cjs +1 -1
- package/dist/common-components/Field/Field.js +11 -10
- package/dist/common-components/icons/GripIcon.cjs +1 -1
- package/dist/common-components/icons/GripIcon.js +3 -2
- package/dist/components/InkEditor/InkEditor.cjs +1 -1
- package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
- package/dist/components/InkEditor/InkEditor.js +1308 -1028
- package/dist/components/InkEditor/components/AiPanel/AiPanel.cjs +1 -1
- package/dist/components/InkEditor/components/AiPanel/AiPanel.js +13 -12
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.cjs +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.cjs +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.d.ts +20 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.js +25 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.d.ts +4 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.js +61 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.types.d.ts +11 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.cjs +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.d.ts +19 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.js +30 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.test.d.ts +2 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.test.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/index.d.ts +4 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.cjs +1 -1
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.js +7 -6
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.cjs +1 -1
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.d.ts +2 -0
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.d.ts.map +1 -1
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.js +16 -15
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.cjs +1 -1
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.d.ts.map +1 -1
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.js +84 -97
- package/dist/components/InkEditor/components/FindReplace/FindReplace.cjs +1 -1
- package/dist/components/InkEditor/components/FindReplace/FindReplace.js +21 -20
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.cjs +1 -1
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.js +17 -16
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.cjs +1 -1
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.js +3 -2
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.cjs +1 -1
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.js +7 -6
- package/dist/components/InkEditor/components/ImageFrame/ImageFrame.cjs +1 -0
- package/dist/components/InkEditor/components/ImageFrame/ImageFrame.d.ts +8 -0
- package/dist/components/InkEditor/components/ImageFrame/ImageFrame.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ImageFrame/ImageFrame.js +54 -0
- package/dist/components/InkEditor/components/ImageFrame/index.d.ts +3 -0
- package/dist/components/InkEditor/components/ImageFrame/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.cjs +1 -1
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.js +11 -10
- package/dist/components/InkEditor/components/MentionMenu/MentionMenu.cjs +1 -0
- package/dist/components/InkEditor/components/MentionMenu/MentionMenu.d.ts +16 -0
- package/dist/components/InkEditor/components/MentionMenu/MentionMenu.d.ts.map +1 -0
- package/dist/components/InkEditor/components/MentionMenu/MentionMenu.js +21 -0
- package/dist/components/InkEditor/components/MentionMenu/index.d.ts +3 -0
- package/dist/components/InkEditor/components/MentionMenu/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.cjs +1 -1
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.js +11 -10
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.cjs +1 -1
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.js +3 -2
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.cjs +1 -1
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.js +6 -5
- package/dist/components/InkEditor/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/InkEditor/components/SignPad/SignPad.js +7 -6
- package/dist/components/InkEditor/components/SlashMenu/SlashMenu.cjs +1 -1
- package/dist/components/InkEditor/components/SlashMenu/SlashMenu.js +7 -6
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.cjs +1 -1
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.cjs +1 -1
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.js +8 -7
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.js +38 -38
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.cjs +1 -1
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.d.ts.map +1 -1
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.js +56 -39
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.cjs +1 -1
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.js +3 -2
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.js +13 -12
- package/dist/components/InkEditor/components/ToolbarColorPicker/ToolbarColorPicker.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarColorPicker/ToolbarColorPicker.js +9 -8
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.const.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.const.js +9 -8
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.js +9 -8
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.js +19 -18
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.js +6 -5
- package/dist/components/InkEditor/components/VersionHistory/VersionHistory.cjs +1 -0
- package/dist/components/InkEditor/components/VersionHistory/VersionHistory.d.ts +11 -0
- package/dist/components/InkEditor/components/VersionHistory/VersionHistory.d.ts.map +1 -0
- package/dist/components/InkEditor/components/VersionHistory/VersionHistory.js +22 -0
- package/dist/components/InkEditor/components/VersionHistory/index.d.ts +3 -0
- package/dist/components/InkEditor/components/VersionHistory/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/index.d.ts +7 -0
- package/dist/components/InkEditor/components/index.d.ts.map +1 -1
- package/dist/components/InkEditor/helpers/format.utils.cjs +3 -2
- package/dist/components/InkEditor/helpers/format.utils.d.ts +1 -0
- package/dist/components/InkEditor/helpers/format.utils.d.ts.map +1 -1
- package/dist/components/InkEditor/helpers/format.utils.js +106 -84
- package/dist/components/InkEditor/helpers/index.d.ts +1 -1
- package/dist/components/InkEditor/helpers/index.d.ts.map +1 -1
- package/dist/components/InkWorkspace/InkWorkspace.cjs +1 -1
- package/dist/components/InkWorkspace/InkWorkspace.d.ts.map +1 -1
- package/dist/components/InkWorkspace/InkWorkspace.js +136 -144
- package/dist/components/InkWorkspace/hooks/useInkWorkspace.cjs +1 -1
- package/dist/components/InkWorkspace/hooks/useInkWorkspace.js +8 -7
- package/dist/constants/contextMenu.const.cjs +1 -1
- package/dist/constants/contextMenu.const.d.ts +8 -0
- package/dist/constants/contextMenu.const.d.ts.map +1 -1
- package/dist/constants/contextMenu.const.js +30 -22
- package/dist/constants/defaultIcons.cjs +1 -1
- package/dist/constants/defaultIcons.js +6 -5
- package/dist/constants/defaults.const.cjs +1 -1
- package/dist/constants/defaults.const.d.ts.map +1 -1
- package/dist/constants/defaults.const.js +150 -138
- package/dist/constants/numbers.cjs +1 -1
- package/dist/constants/numbers.js +28 -27
- package/dist/constants/toolbar.const.cjs +1 -1
- package/dist/constants/toolbar.const.d.ts +7 -0
- package/dist/constants/toolbar.const.d.ts.map +1 -1
- package/dist/constants/toolbar.const.js +16 -9
- package/dist/constants/toolbarMenu.const.cjs +1 -1
- package/dist/constants/toolbarMenu.const.d.ts.map +1 -1
- package/dist/constants/toolbarMenu.const.js +25 -11
- package/dist/hooks/useInkCollaboration.cjs +1 -1
- package/dist/hooks/useInkCollaboration.js +15 -14
- package/dist/hooks/useToolbarOverflow.cjs +1 -1
- package/dist/hooks/useToolbarOverflow.js +12 -11
- package/dist/index.cjs +1 -1
- package/dist/index.js +145 -144
- package/dist/plugins/ai/demoProvider.cjs +1 -1
- package/dist/plugins/ai/demoProvider.js +3 -2
- package/dist/plugins/ai/index.cjs +1 -1
- package/dist/plugins/ai/index.js +25 -24
- package/dist/plugins/excel/excel.utils.cjs +1 -1
- package/dist/plugins/excel/excel.utils.js +17 -16
- package/dist/plugins/graph/graph.utils.cjs +1 -1
- package/dist/plugins/graph/graph.utils.js +7 -6
- package/dist/plugins/theme/inkTheme.cjs +1 -1
- package/dist/plugins/theme/inkTheme.js +22 -19
- package/dist/plugins/titles/titles.const.cjs +1 -1
- package/dist/plugins/titles/titles.const.js +9 -8
- package/dist/plugins/titles/titles.utils.cjs +1 -1
- package/dist/plugins/titles/titles.utils.js +3 -2
- package/dist/styles.css +1 -1
- package/dist/types/collab.types.d.ts +0 -1
- package/dist/types/collab.types.d.ts.map +1 -1
- package/dist/types/features.types.d.ts +1 -1
- package/dist/types/features.types.d.ts.map +1 -1
- package/dist/types/ink.types.d.ts +1 -3
- package/dist/types/ink.types.d.ts.map +1 -1
- package/dist/utils/blocks.utils.cjs +1 -1
- package/dist/utils/blocks.utils.js +19 -18
- package/dist/utils/collab.utils.cjs +1 -1
- package/dist/utils/collab.utils.js +7 -6
- package/dist/utils/comments.utils.cjs +1 -1
- package/dist/utils/comments.utils.d.ts +4 -0
- package/dist/utils/comments.utils.d.ts.map +1 -1
- package/dist/utils/comments.utils.js +26 -18
- package/dist/utils/comments.utils.test.d.ts +2 -0
- package/dist/utils/comments.utils.test.d.ts.map +1 -0
- package/dist/utils/exportDocument.utils.cjs +2 -0
- package/dist/utils/exportDocument.utils.d.ts +16 -0
- package/dist/utils/exportDocument.utils.d.ts.map +1 -0
- package/dist/utils/exportDocument.utils.js +85 -0
- package/dist/utils/exportDocument.utils.test.d.ts +2 -0
- package/dist/utils/exportDocument.utils.test.d.ts.map +1 -0
- package/dist/utils/formatPainter.utils.cjs +1 -0
- package/dist/utils/formatPainter.utils.d.ts +11 -0
- package/dist/utils/formatPainter.utils.d.ts.map +1 -0
- package/dist/utils/formatPainter.utils.js +20 -0
- package/dist/utils/formatPainter.utils.test.d.ts +2 -0
- package/dist/utils/formatPainter.utils.test.d.ts.map +1 -0
- package/dist/utils/history.utils.cjs +1 -1
- package/dist/utils/history.utils.js +3 -2
- package/dist/utils/image.utils.cjs +1 -0
- package/dist/utils/image.utils.d.ts +14 -0
- package/dist/utils/image.utils.d.ts.map +1 -0
- package/dist/utils/image.utils.js +33 -0
- package/dist/utils/image.utils.test.d.ts +2 -0
- package/dist/utils/image.utils.test.d.ts.map +1 -0
- package/dist/utils/index.d.ts +10 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/license.utils.cjs +1 -1
- package/dist/utils/license.utils.js +8 -7
- package/dist/utils/markdown.utils.cjs +11 -0
- package/dist/utils/markdown.utils.d.ts +7 -0
- package/dist/utils/markdown.utils.d.ts.map +1 -0
- package/dist/utils/markdown.utils.js +87 -0
- package/dist/utils/markdown.utils.test.d.ts +2 -0
- package/dist/utils/markdown.utils.test.d.ts.map +1 -0
- package/dist/utils/mentions.utils.cjs +1 -0
- package/dist/utils/mentions.utils.d.ts +13 -0
- package/dist/utils/mentions.utils.d.ts.map +1 -0
- package/dist/utils/mentions.utils.js +23 -0
- package/dist/utils/mentions.utils.test.d.ts +2 -0
- package/dist/utils/mentions.utils.test.d.ts.map +1 -0
- package/dist/utils/outline.utils.cjs +1 -1
- package/dist/utils/outline.utils.js +9 -8
- package/dist/utils/paste.utils.cjs +1 -1
- package/dist/utils/paste.utils.d.ts +2 -0
- package/dist/utils/paste.utils.d.ts.map +1 -1
- package/dist/utils/paste.utils.js +53 -19
- package/dist/utils/paste.utils.test.d.ts +2 -0
- package/dist/utils/paste.utils.test.d.ts.map +1 -0
- package/dist/utils/premium.utils.cjs +1 -1
- package/dist/utils/premium.utils.js +12 -11
- package/dist/utils/selection.utils.cjs +1 -1
- package/dist/utils/selection.utils.js +3 -2
- package/dist/utils/slash.utils.cjs +1 -1
- package/dist/utils/slash.utils.js +10 -9
- package/dist/utils/table.utils.cjs +1 -1
- package/dist/utils/table.utils.d.ts +8 -0
- package/dist/utils/table.utils.d.ts.map +1 -1
- package/dist/utils/table.utils.js +78 -54
- package/dist/utils/toolbarStorage.utils.cjs +1 -1
- package/dist/utils/toolbarStorage.utils.js +15 -14
- package/dist/utils/trackChanges.utils.cjs +1 -1
- package/dist/utils/trackChanges.utils.js +9 -8
- package/dist/utils/typo.utils.cjs +1 -1
- package/dist/utils/typo.utils.js +8 -7
- package/dist/utils/versions.utils.cjs +1 -0
- package/dist/utils/versions.utils.d.ts +11 -0
- package/dist/utils/versions.utils.d.ts.map +1 -0
- package/dist/utils/versions.utils.js +36 -0
- package/dist/utils/versions.utils.test.d.ts +2 -0
- package/dist/utils/versions.utils.test.d.ts.map +1 -0
- package/dist/utils/words.utils.cjs +1 -1
- package/dist/utils/words.utils.js +3 -2
- package/package.json +1 -1
- package/dist/components/InkEditor/components/ThemePicker/hooks/index.d.ts +0 -3
- package/dist/components/InkEditor/components/ThemePicker/hooks/index.d.ts.map +0 -1
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.cjs +0 -1
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.d.ts +0 -13
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.d.ts.map +0 -1
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.js +0 -39
|
@@ -1 +1 @@
|
|
|
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:
|
|
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("../../../../utils/exportDocument.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:q,onClose:N,onBusyChange:h}=L,[a,H]=i.useState("chat"),[x,g]=i.useState(""),[c,m]=i.useState([]),[l,K]=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=>{K(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:()=>H(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:()=>{q(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;
|
|
@@ -6,36 +6,37 @@ import { INK_AI_DEMO_PROVIDER_ID as z } from "../../../../constants/aiModels.con
|
|
|
6
6
|
import "../../../../constants/openai.const.js";
|
|
7
7
|
import { createInkId as H } from "../../../../utils/id.utils.js";
|
|
8
8
|
import "../../../../utils/paste.utils.js";
|
|
9
|
+
import "../../../../utils/exportDocument.utils.js";
|
|
9
10
|
import "react-dom";
|
|
10
11
|
import { inkAi as J } from "../../../../plugins/ai/aiPlugin.js";
|
|
11
|
-
const
|
|
12
|
+
const ce = (K) => {
|
|
12
13
|
var y, T, C, E;
|
|
13
|
-
const { config: i, documentHtml:
|
|
14
|
-
x(e),
|
|
15
|
-
}, _ = async (e, r,
|
|
14
|
+
const { config: i, documentHtml: p, selectionHtml: k, onApplyHtml: B, onClose: v, onBusyChange: u } = 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) => {
|
|
15
|
+
x(e), u == null || u(e);
|
|
16
|
+
}, _ = async (e, r, m) => {
|
|
16
17
|
var S;
|
|
17
18
|
g(!0);
|
|
18
19
|
try {
|
|
19
|
-
const w = e === "chat" &&
|
|
20
|
+
const w = e === "chat" && m ? [
|
|
20
21
|
...c,
|
|
21
22
|
{
|
|
22
23
|
id: H("turn"),
|
|
23
24
|
role: "user",
|
|
24
|
-
content:
|
|
25
|
+
content: m,
|
|
25
26
|
timestamp: Date.now(),
|
|
26
27
|
capability: e
|
|
27
28
|
}
|
|
28
29
|
] : c;
|
|
29
|
-
e === "chat" &&
|
|
30
|
+
e === "chat" && m && h(w);
|
|
30
31
|
const s = await J.runProvider(M, {
|
|
31
32
|
capability: e,
|
|
32
|
-
html:
|
|
33
|
-
selectionHtml:
|
|
34
|
-
prompt:
|
|
33
|
+
html: p,
|
|
34
|
+
selectionHtml: k || void 0,
|
|
35
|
+
prompt: m,
|
|
35
36
|
history: w,
|
|
36
37
|
options: r,
|
|
37
38
|
modelId: i.modelId,
|
|
38
|
-
documentSnapshot: { html:
|
|
39
|
+
documentSnapshot: { html: p, selectionHtml: k || void 0 }
|
|
39
40
|
});
|
|
40
41
|
(S = s.turns) != null && S.length ? h((A) => [...A, ...s.turns]) : s.text && e !== "chat" && h((A) => [
|
|
41
42
|
...A,
|
|
@@ -185,5 +186,5 @@ const re = (K) => {
|
|
|
185
186
|
);
|
|
186
187
|
};
|
|
187
188
|
export {
|
|
188
|
-
|
|
189
|
+
ce as AiPanel
|
|
189
190
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("react-dom"),e=require("./AiSelectionBubble.const.cjs"),i=t=>{t.preventDefault(),t.stopPropagation()},u=t=>{const{open:s,top:r,left:A,busy:l,preview:_,onAction:S,onApply:c,onDismiss:I}=t;return!s||typeof document>"u"?null:a.createPortal(n.jsxs("div",{className:e.AI_SELECTION_BUBBLE_CLASS,style:{position:"fixed",top:r,left:A},role:"toolbar","aria-label":e.AI_SELECTION_BUBBLE_ARIA_LABEL,onPointerDown:o=>o.stopPropagation(),children:[e.AI_SELECTION_ACTIONS.map(o=>n.jsx("button",{type:"button",className:e.AI_SELECTION_ACTION_CLASS,disabled:l,onPointerDown:i,onClick:()=>S(o.id),children:o.label},o.id)),l?n.jsx("span",{className:"Ink-AiSelection__status",children:e.AI_SELECTION_BUSY_LABEL}):null,_?n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:`${e.AI_SELECTION_ACTION_CLASS} ${e.AI_SELECTION_ACTION_ACTIVE_CLASS}`,onPointerDown:i,onClick:c,children:e.AI_SELECTION_APPLY_LABEL}),n.jsx("button",{type:"button",className:e.AI_SELECTION_ACTION_CLASS,onPointerDown:i,onClick:I,children:e.AI_SELECTION_DISMISS_LABEL})]}):null]}),document.body)};exports.AiSelectionBubble=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../../constants/numbers.cjs"),E="Ink-AiSelection",I="Ink-AiSelection__action",A="Ink-AiSelection__action--active",S="Selection AI",L="Apply",T="Dismiss",t="Ink AI is writing…",i="Spanish",C=_.NUMBER_EIGHT,e=_.NUMBER_EIGHT,N=_.NUMBER_FORTY,n=448,O=28,o=[{id:"improve",label:"Improve",capability:"rewrite"},{id:"shorter",label:"Shorter",capability:"summarize"},{id:"longer",label:"Longer",capability:"expand"},{id:"fix",label:"Fix",capability:"review"},{id:"tone",label:"Tone",capability:"tone"},{id:"translate",label:"Translate",capability:"translate"}];exports.AI_SELECTION_ACTIONS=o;exports.AI_SELECTION_ACTION_ACTIVE_CLASS=A;exports.AI_SELECTION_ACTION_CLASS=I;exports.AI_SELECTION_APPLY_LABEL=L;exports.AI_SELECTION_BUBBLE_ARIA_LABEL=S;exports.AI_SELECTION_BUBBLE_CLASS=E;exports.AI_SELECTION_BUSY_LABEL=t;exports.AI_SELECTION_DISMISS_LABEL=T;exports.AI_SELECTION_EDGE_PX=e;exports.AI_SELECTION_ESTIMATED_HEIGHT_PX=N;exports.AI_SELECTION_ESTIMATED_WIDTH_PX=n;exports.AI_SELECTION_GAP_PX=C;exports.AI_SELECTION_LINE_CAP_PX=O;exports.AI_SELECTION_TRANSLATE_LANGUAGE=i;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { InkAiCapability } from '../../../../types';
|
|
2
|
+
export declare const AI_SELECTION_BUBBLE_CLASS = "Ink-AiSelection";
|
|
3
|
+
export declare const AI_SELECTION_ACTION_CLASS = "Ink-AiSelection__action";
|
|
4
|
+
export declare const AI_SELECTION_ACTION_ACTIVE_CLASS = "Ink-AiSelection__action--active";
|
|
5
|
+
export declare const AI_SELECTION_BUBBLE_ARIA_LABEL = "Selection AI";
|
|
6
|
+
export declare const AI_SELECTION_APPLY_LABEL = "Apply";
|
|
7
|
+
export declare const AI_SELECTION_DISMISS_LABEL = "Dismiss";
|
|
8
|
+
export declare const AI_SELECTION_BUSY_LABEL = "Ink AI is writing\u2026";
|
|
9
|
+
export declare const AI_SELECTION_TRANSLATE_LANGUAGE = "Spanish";
|
|
10
|
+
export declare const AI_SELECTION_GAP_PX = 8;
|
|
11
|
+
export declare const AI_SELECTION_EDGE_PX = 8;
|
|
12
|
+
export declare const AI_SELECTION_ESTIMATED_HEIGHT_PX = 40;
|
|
13
|
+
export declare const AI_SELECTION_ESTIMATED_WIDTH_PX = 448;
|
|
14
|
+
export declare const AI_SELECTION_LINE_CAP_PX = 28;
|
|
15
|
+
export declare const AI_SELECTION_ACTIONS: ReadonlyArray<{
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
capability: InkAiCapability;
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=AiSelectionBubble.const.d.ts.map
|
package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AiSelectionBubble.const.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD,eAAO,MAAM,yBAAyB,oBAAoB,CAAC;AAC3D,eAAO,MAAM,yBAAyB,4BAA4B,CAAC;AACnE,eAAO,MAAM,gCAAgC,oCAAoC,CAAC;AAClF,eAAO,MAAM,8BAA8B,iBAAiB,CAAC;AAC7D,eAAO,MAAM,wBAAwB,UAAU,CAAC;AAChD,eAAO,MAAM,0BAA0B,YAAY,CAAC;AACpD,eAAO,MAAM,uBAAuB,4BAAuB,CAAC;AAC5D,eAAO,MAAM,+BAA+B,YAAY,CAAC;AACzD,eAAO,MAAM,mBAAmB,IAAe,CAAC;AAChD,eAAO,MAAM,oBAAoB,IAAe,CAAC;AACjD,eAAO,MAAM,gCAAgC,KAAe,CAAC;AAC7D,eAAO,MAAM,+BAA+B,MAAM,CAAC;AACnD,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,eAAe,CAAC;CAC7B,CAOA,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NUMBER_EIGHT as _, NUMBER_FORTY as E } from "../../../../constants/numbers.js";
|
|
2
|
+
const A = "Ink-AiSelection", i = "Ink-AiSelection__action", t = "Ink-AiSelection__action--active", n = "Selection AI", e = "Apply", S = "Dismiss", o = "Ink AI is writing…", L = "Spanish", a = _, T = _, c = E, l = 448, s = 28, C = [
|
|
3
|
+
{ id: "improve", label: "Improve", capability: "rewrite" },
|
|
4
|
+
{ id: "shorter", label: "Shorter", capability: "summarize" },
|
|
5
|
+
{ id: "longer", label: "Longer", capability: "expand" },
|
|
6
|
+
{ id: "fix", label: "Fix", capability: "review" },
|
|
7
|
+
{ id: "tone", label: "Tone", capability: "tone" },
|
|
8
|
+
{ id: "translate", label: "Translate", capability: "translate" }
|
|
9
|
+
];
|
|
10
|
+
export {
|
|
11
|
+
C as AI_SELECTION_ACTIONS,
|
|
12
|
+
t as AI_SELECTION_ACTION_ACTIVE_CLASS,
|
|
13
|
+
i as AI_SELECTION_ACTION_CLASS,
|
|
14
|
+
e as AI_SELECTION_APPLY_LABEL,
|
|
15
|
+
n as AI_SELECTION_BUBBLE_ARIA_LABEL,
|
|
16
|
+
A as AI_SELECTION_BUBBLE_CLASS,
|
|
17
|
+
o as AI_SELECTION_BUSY_LABEL,
|
|
18
|
+
S as AI_SELECTION_DISMISS_LABEL,
|
|
19
|
+
T as AI_SELECTION_EDGE_PX,
|
|
20
|
+
c as AI_SELECTION_ESTIMATED_HEIGHT_PX,
|
|
21
|
+
l as AI_SELECTION_ESTIMATED_WIDTH_PX,
|
|
22
|
+
a as AI_SELECTION_GAP_PX,
|
|
23
|
+
s as AI_SELECTION_LINE_CAP_PX,
|
|
24
|
+
L as AI_SELECTION_TRANSLATE_LANGUAGE
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AiSelectionBubble.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAgB,MAAM,OAAO,CAAC;AAY9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAOxE,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAgDxD,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e, Fragment as p } from "react/jsx-runtime";
|
|
2
|
+
import { createPortal as L } from "react-dom";
|
|
3
|
+
import { AI_SELECTION_BUBBLE_ARIA_LABEL as S, AI_SELECTION_BUBBLE_CLASS as u, AI_SELECTION_ACTIONS as C, AI_SELECTION_ACTION_CLASS as t, AI_SELECTION_BUSY_LABEL as d, AI_SELECTION_APPLY_LABEL as m, AI_SELECTION_ACTION_ACTIVE_CLASS as N, AI_SELECTION_DISMISS_LABEL as b } from "./AiSelectionBubble.const.js";
|
|
4
|
+
const l = (n) => {
|
|
5
|
+
n.preventDefault(), n.stopPropagation();
|
|
6
|
+
}, f = (n) => {
|
|
7
|
+
const { open: s, top: _, left: A, busy: i, preview: a, onAction: I, onApply: E, onDismiss: c } = n;
|
|
8
|
+
return !s || typeof document > "u" ? null : L(
|
|
9
|
+
/* @__PURE__ */ r(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
className: u,
|
|
13
|
+
style: { position: "fixed", top: _, left: A },
|
|
14
|
+
role: "toolbar",
|
|
15
|
+
"aria-label": S,
|
|
16
|
+
onPointerDown: (o) => o.stopPropagation(),
|
|
17
|
+
children: [
|
|
18
|
+
C.map((o) => /* @__PURE__ */ e(
|
|
19
|
+
"button",
|
|
20
|
+
{
|
|
21
|
+
type: "button",
|
|
22
|
+
className: t,
|
|
23
|
+
disabled: i,
|
|
24
|
+
onPointerDown: l,
|
|
25
|
+
onClick: () => I(o.id),
|
|
26
|
+
children: o.label
|
|
27
|
+
},
|
|
28
|
+
o.id
|
|
29
|
+
)),
|
|
30
|
+
i ? /* @__PURE__ */ e("span", { className: "Ink-AiSelection__status", children: d }) : null,
|
|
31
|
+
a ? /* @__PURE__ */ r(p, { children: [
|
|
32
|
+
/* @__PURE__ */ e(
|
|
33
|
+
"button",
|
|
34
|
+
{
|
|
35
|
+
type: "button",
|
|
36
|
+
className: `${t} ${N}`,
|
|
37
|
+
onPointerDown: l,
|
|
38
|
+
onClick: E,
|
|
39
|
+
children: m
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ e(
|
|
43
|
+
"button",
|
|
44
|
+
{
|
|
45
|
+
type: "button",
|
|
46
|
+
className: t,
|
|
47
|
+
onPointerDown: l,
|
|
48
|
+
onClick: c,
|
|
49
|
+
children: b
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
] }) : null
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
document.body
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
f as AiSelectionBubble
|
|
61
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface AiSelectionBubbleProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
top: number;
|
|
4
|
+
left: number;
|
|
5
|
+
busy: boolean;
|
|
6
|
+
preview: string;
|
|
7
|
+
onAction: (actionId: string) => void;
|
|
8
|
+
onApply: () => void;
|
|
9
|
+
onDismiss: () => void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=AiSelectionBubble.types.d.ts.map
|
package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.types.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AiSelectionBubble.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("../../../../constants/numbers.cjs"),e=require("./AiSelectionBubble.const.cjs"),c=(t,E)=>{const o=(t.bottom-t.top>e.AI_SELECTION_ESTIMATED_HEIGHT_PX?t.top+e.AI_SELECTION_LINE_CAP_PX:t.bottom)+e.AI_SELECTION_GAP_PX,r=t.top-e.AI_SELECTION_ESTIMATED_HEIGHT_PX-e.AI_SELECTION_GAP_PX,n=o+e.AI_SELECTION_ESTIMATED_HEIGHT_PX<=E.height-e.AI_SELECTION_EDGE_PX?o:Math.max(e.AI_SELECTION_EDGE_PX,r),T=Math.max(e.AI_SELECTION_EDGE_PX,E.width-e.AI_SELECTION_ESTIMATED_WIDTH_PX-e.AI_SELECTION_EDGE_PX),l=Math.min(Math.max(t.left,e.AI_SELECTION_EDGE_PX),T);return{top:Number.isFinite(n)?n:I.NUMBER_ZERO,left:Number.isFinite(l)?l:I.NUMBER_ZERO}},A=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),s=t=>{const E=e.AI_SELECTION_ACTIONS.find(i=>i.id===t);return(E==null?void 0:E.capability)??null},S=t=>{if(t==="translate")return{language:e.AI_SELECTION_TRANSLATE_LANGUAGE}},u=t=>{var i,_;if((i=t.diff)!=null&&i.suggestedHtml)return t.diff.suggestedHtml;if(t.html)return t.html;const E=(_=t.reviewSuggestions)==null?void 0:_.find(o=>o.suggestedText.trim());return E?`<p>${A(E.suggestedText)}</p>`:t.text?`<p>${A(t.text)}</p>`:""};exports.capabilityForSelectionAction=s;exports.htmlFromAiResponse=u;exports.optionsForSelectionAction=S;exports.placeAiSelectionBubble=c;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { InkAiCapability, InkAiResponse } from '../../../../types';
|
|
2
|
+
export interface AiSelectionAnchor {
|
|
3
|
+
top: number;
|
|
4
|
+
left: number;
|
|
5
|
+
bottom: number;
|
|
6
|
+
width: number;
|
|
7
|
+
}
|
|
8
|
+
export interface AiSelectionViewport {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
export declare const placeAiSelectionBubble: (selectionRect: AiSelectionAnchor, viewport: AiSelectionViewport) => {
|
|
13
|
+
top: number;
|
|
14
|
+
left: number;
|
|
15
|
+
};
|
|
16
|
+
export declare const capabilityForSelectionAction: (actionId: string) => InkAiCapability | null;
|
|
17
|
+
export declare const optionsForSelectionAction: (actionId: string) => Record<string, string> | undefined;
|
|
18
|
+
export declare const htmlFromAiResponse: (response: InkAiResponse) => string;
|
|
19
|
+
//# sourceMappingURL=AiSelectionBubble.utils.d.ts.map
|
package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AiSelectionBubble.utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAWxE,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,sBAAsB,GACjC,eAAe,iBAAiB,EAChC,UAAU,mBAAmB,KAC5B;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAmB7B,CAAC;AAQF,eAAO,MAAM,4BAA4B,GAAI,UAAU,MAAM,KAAG,eAAe,GAAG,IAGjF,CAAC;AAEF,eAAO,MAAM,yBAAyB,GACpC,UAAU,MAAM,KACf,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAK3B,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,UAAU,aAAa,KAAG,MAO5D,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NUMBER_ZERO as _ } from "../../../../constants/numbers.js";
|
|
2
|
+
import { AI_SELECTION_ACTIONS as A, AI_SELECTION_TRANSLATE_LANGUAGE as I, AI_SELECTION_ESTIMATED_HEIGHT_PX as l, AI_SELECTION_EDGE_PX as i, AI_SELECTION_ESTIMATED_WIDTH_PX as f, AI_SELECTION_GAP_PX as a, AI_SELECTION_LINE_CAP_PX as c } from "./AiSelectionBubble.const.js";
|
|
3
|
+
const N = (t, o) => {
|
|
4
|
+
const n = (t.bottom - t.top > l ? t.top + c : t.bottom) + a, s = t.top - l - a, E = n + l <= o.height - i ? n : Math.max(i, s), u = Math.max(
|
|
5
|
+
i,
|
|
6
|
+
o.width - f - i
|
|
7
|
+
), m = Math.min(Math.max(t.left, i), u);
|
|
8
|
+
return {
|
|
9
|
+
top: Number.isFinite(E) ? E : _,
|
|
10
|
+
left: Number.isFinite(m) ? m : _
|
|
11
|
+
};
|
|
12
|
+
}, g = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), h = (t) => {
|
|
13
|
+
const o = A.find((e) => e.id === t);
|
|
14
|
+
return (o == null ? void 0 : o.capability) ?? null;
|
|
15
|
+
}, d = (t) => {
|
|
16
|
+
if (t === "translate")
|
|
17
|
+
return { language: I };
|
|
18
|
+
}, L = (t) => {
|
|
19
|
+
var e, r;
|
|
20
|
+
if ((e = t.diff) != null && e.suggestedHtml) return t.diff.suggestedHtml;
|
|
21
|
+
if (t.html) return t.html;
|
|
22
|
+
const o = (r = t.reviewSuggestions) == null ? void 0 : r.find((n) => n.suggestedText.trim());
|
|
23
|
+
return o ? `<p>${g(o.suggestedText)}</p>` : t.text ? `<p>${g(t.text)}</p>` : "";
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
h as capabilityForSelectionAction,
|
|
27
|
+
L as htmlFromAiResponse,
|
|
28
|
+
d as optionsForSelectionAction,
|
|
29
|
+
N as placeAiSelectionBubble
|
|
30
|
+
};
|
package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.test.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AiSelectionBubble.utils.test.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AiSelectionBubble } from './AiSelectionBubble';
|
|
2
|
+
export { capabilityForSelectionAction, htmlFromAiResponse, optionsForSelectionAction, placeAiSelectionBubble, } from './AiSelectionBubble.utils';
|
|
3
|
+
export type { AiSelectionBubbleProps } from './AiSelectionBubble.types';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiSelectionBubble/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("react");require("react-dom");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("../../../../utils/exportDocument.utils.cjs");require("react");require("react-dom");const s=require("../../../../common-components/icons/GripIcon.cjs"),e=require("./BlockHandles.const.cjs"),l=n=>{const{visible:L,top:r,onMoveUp:_,onMoveDown:o,onDragStart:i}=n;return L?t.jsxs("div",{className:e.BLOCK_HANDLES_CLASS,style:{top:r},"aria-hidden":!L,children:[t.jsx("button",{type:"button",className:e.BLOCK_HANDLES_PLUS_CLASS,title:e.BLOCK_HANDLES_TITLE_PLUS,tabIndex:-1,children:e.BLOCK_HANDLES_PLUS_LABEL}),t.jsx("button",{type:"button",className:e.BLOCK_HANDLES_GRIP_CLASS,title:e.BLOCK_HANDLES_TITLE_GRIP,tabIndex:-1,draggable:!0,onDragStart:i,children:t.jsx(s.GripIcon,{})}),t.jsx("button",{type:"button",className:e.BLOCK_HANDLES_BTN_CLASS,title:e.BLOCK_HANDLES_TITLE_UP,onClick:_,children:e.BLOCK_HANDLES_UP_LABEL}),t.jsx("button",{type:"button",className:e.BLOCK_HANDLES_BTN_CLASS,title:e.BLOCK_HANDLES_TITLE_DOWN,onClick:o,children:e.BLOCK_HANDLES_DOWN_LABEL})]}):null};exports.BlockHandles=l;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import "../../../../constants/openai.const.js";
|
|
3
3
|
import "../../../../utils/paste.utils.js";
|
|
4
|
+
import "../../../../utils/exportDocument.utils.js";
|
|
4
5
|
import "react";
|
|
5
6
|
import "react-dom";
|
|
6
7
|
import { GripIcon as S } from "../../../../common-components/icons/GripIcon.js";
|
|
7
|
-
import { BLOCK_HANDLES_CLASS as a, BLOCK_HANDLES_PLUS_LABEL as N, BLOCK_HANDLES_TITLE_PLUS as s, BLOCK_HANDLES_PLUS_CLASS as A, BLOCK_HANDLES_TITLE_GRIP as E, BLOCK_HANDLES_GRIP_CLASS as C, BLOCK_HANDLES_UP_LABEL as c, BLOCK_HANDLES_TITLE_UP as
|
|
8
|
-
const
|
|
8
|
+
import { BLOCK_HANDLES_CLASS as a, BLOCK_HANDLES_PLUS_LABEL as N, BLOCK_HANDLES_TITLE_PLUS as s, BLOCK_HANDLES_PLUS_CLASS as A, BLOCK_HANDLES_TITLE_GRIP as E, BLOCK_HANDLES_GRIP_CLASS as C, BLOCK_HANDLES_UP_LABEL as c, BLOCK_HANDLES_TITLE_UP as m, BLOCK_HANDLES_BTN_CLASS as o, BLOCK_HANDLES_DOWN_LABEL as p, BLOCK_HANDLES_TITLE_DOWN as B } from "./BlockHandles.const.js";
|
|
9
|
+
const T = (_) => {
|
|
9
10
|
const { visible: L, top: e, onMoveUp: n, onMoveDown: r, onDragStart: i } = _;
|
|
10
11
|
return L ? /* @__PURE__ */ l("div", { className: a, style: { top: e }, "aria-hidden": !L, children: [
|
|
11
12
|
/* @__PURE__ */ t(
|
|
@@ -35,7 +36,7 @@ const I = (_) => {
|
|
|
35
36
|
{
|
|
36
37
|
type: "button",
|
|
37
38
|
className: o,
|
|
38
|
-
title:
|
|
39
|
+
title: m,
|
|
39
40
|
onClick: n,
|
|
40
41
|
children: c
|
|
41
42
|
}
|
|
@@ -45,13 +46,13 @@ const I = (_) => {
|
|
|
45
46
|
{
|
|
46
47
|
type: "button",
|
|
47
48
|
className: o,
|
|
48
|
-
title:
|
|
49
|
+
title: B,
|
|
49
50
|
onClick: r,
|
|
50
|
-
children:
|
|
51
|
+
children: p
|
|
51
52
|
}
|
|
52
53
|
)
|
|
53
54
|
] }) : null;
|
|
54
55
|
};
|
|
55
56
|
export {
|
|
56
|
-
|
|
57
|
+
T as BlockHandles
|
|
57
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("react"),C=c=>{const{comments:o,author:r,onAddReply:d,onResolve:u,onReopen:_,onFocus:p,onClose:l}=c,[a,m]=x.useState({}),b=(n,s)=>{var i;n.preventDefault();const t=(i=a[s])==null?void 0:i.trim();t&&(d(s,t),m(j=>({...j,[s]:""})))};return e.jsxs("aside",{className:"Ink-Comments","aria-label":"Comments archive",children:[e.jsxs("div",{className:"Ink-Comments__header",children:[e.jsx("strong",{children:"Comments archive"}),l?e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:l,title:"Close",children:"×"}):null]}),e.jsx("div",{className:"Ink-Comments__list",children:o.length===0?e.jsx("p",{className:"Ink-Comments__empty",children:"Select text and add a comment to start a thread."}):o.map(n=>e.jsxs("article",{className:`Ink-Comments__thread${n.resolved?" Ink-Comments__thread--resolved":""}`,onClick:()=>p(n.id),children:[e.jsxs("header",{className:"Ink-Comments__meta",children:[e.jsx("span",{children:n.author}),e.jsx("time",{children:new Date(n.timestamp).toLocaleString()})]}),e.jsx("p",{className:"Ink-Comments__body",children:n.body}),n.replies.map(s=>e.jsxs("div",{className:"Ink-Comments__reply",children:[e.jsxs("header",{className:"Ink-Comments__meta",children:[e.jsx("span",{children:s.author}),e.jsx("time",{children:new Date(s.timestamp).toLocaleString()})]}),e.jsx("p",{className:"Ink-Comments__body",children:s.body})]},s.id)),n.resolved?e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:()=>_(n.id),children:"Reopen"}):e.jsxs("form",{className:"Ink-Comments__form",onSubmit:s=>b(s,n.id),children:[e.jsx("input",{value:a[n.id]??"",onChange:s=>m(t=>({...t,[n.id]:s.target.value})),placeholder:`Reply as ${r}…`,"aria-label":`Reply to ${n.author}`}),e.jsx("button",{type:"submit",className:"Ink-Editor__button Ink-Editor__button--active",children:"Reply"}),e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:()=>u(n.id),children:"Resolve"})]})]},n.id))})]})};exports.CommentsPanel=C;
|
|
@@ -5,6 +5,8 @@ export interface CommentsPanelProps {
|
|
|
5
5
|
author: string;
|
|
6
6
|
onAddReply: (threadId: string, body: string) => void;
|
|
7
7
|
onResolve: (threadId: string) => void;
|
|
8
|
+
onReopen: (threadId: string) => void;
|
|
9
|
+
onFocus: (threadId: string) => void;
|
|
8
10
|
onClose?: () => void;
|
|
9
11
|
}
|
|
10
12
|
export declare const CommentsPanel: FC<CommentsPanelProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentsPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/CommentsPanel/CommentsPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"CommentsPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/CommentsPanel/CommentsPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA8EhD,CAAC"}
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as o, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as k } from "react";
|
|
3
3
|
const v = (r) => {
|
|
4
|
-
const { comments:
|
|
4
|
+
const { comments: l, author: d, onAddReply: _, onResolve: u, onReopen: p, onFocus: C, onClose: m } = r, [a, i] = k({}), b = (e, t) => {
|
|
5
5
|
var c;
|
|
6
6
|
e.preventDefault();
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const s = (c = a[t]) == null ? void 0 : c.trim();
|
|
8
|
+
s && (_(t, s), i((h) => ({ ...h, [t]: "" })));
|
|
9
9
|
};
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ o("aside", { className: "Ink-Comments", "aria-label": "Comments archive", children: [
|
|
11
|
+
/* @__PURE__ */ o("div", { className: "Ink-Comments__header", children: [
|
|
12
12
|
/* @__PURE__ */ n("strong", { children: "Comments archive" }),
|
|
13
|
-
|
|
13
|
+
m ? /* @__PURE__ */ n("button", { type: "button", className: "Ink-Editor__button", onClick: m, title: "Close", children: "×" }) : null
|
|
14
14
|
] }),
|
|
15
|
-
/* @__PURE__ */ n("div", { className: "Ink-Comments__list", children:
|
|
15
|
+
/* @__PURE__ */ n("div", { className: "Ink-Comments__list", children: l.length === 0 ? /* @__PURE__ */ n("p", { className: "Ink-Comments__empty", children: "Select text and add a comment to start a thread." }) : l.map((e) => /* @__PURE__ */ o(
|
|
16
16
|
"article",
|
|
17
17
|
{
|
|
18
18
|
className: `Ink-Comments__thread${e.resolved ? " Ink-Comments__thread--resolved" : ""}`,
|
|
19
|
+
onClick: () => C(e.id),
|
|
19
20
|
children: [
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
+
/* @__PURE__ */ o("header", { className: "Ink-Comments__meta", children: [
|
|
21
22
|
/* @__PURE__ */ n("span", { children: e.author }),
|
|
22
23
|
/* @__PURE__ */ n("time", { children: new Date(e.timestamp).toLocaleString() })
|
|
23
24
|
] }),
|
|
24
25
|
/* @__PURE__ */ n("p", { className: "Ink-Comments__body", children: e.body }),
|
|
25
|
-
e.replies.map((t) => /* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
26
|
+
e.replies.map((t) => /* @__PURE__ */ o("div", { className: "Ink-Comments__reply", children: [
|
|
27
|
+
/* @__PURE__ */ o("header", { className: "Ink-Comments__meta", children: [
|
|
27
28
|
/* @__PURE__ */ n("span", { children: t.author }),
|
|
28
29
|
/* @__PURE__ */ n("time", { children: new Date(t.timestamp).toLocaleString() })
|
|
29
30
|
] }),
|
|
30
31
|
/* @__PURE__ */ n("p", { className: "Ink-Comments__body", children: t.body })
|
|
31
32
|
] }, t.id)),
|
|
32
|
-
e.resolved ? /* @__PURE__ */ n("
|
|
33
|
+
e.resolved ? /* @__PURE__ */ n("button", { type: "button", className: "Ink-Editor__button", onClick: () => p(e.id), children: "Reopen" }) : /* @__PURE__ */ o("form", { className: "Ink-Comments__form", onSubmit: (t) => b(t, e.id), children: [
|
|
33
34
|
/* @__PURE__ */ n(
|
|
34
35
|
"input",
|
|
35
36
|
{
|
|
36
37
|
value: a[e.id] ?? "",
|
|
37
|
-
onChange: (t) => i((
|
|
38
|
+
onChange: (t) => i((s) => ({ ...s, [e.id]: t.target.value })),
|
|
38
39
|
placeholder: `Reply as ${d}…`,
|
|
39
40
|
"aria-label": `Reply to ${e.author}`
|
|
40
41
|
}
|
|
@@ -45,7 +46,7 @@ const v = (r) => {
|
|
|
45
46
|
{
|
|
46
47
|
type: "button",
|
|
47
48
|
className: "Ink-Editor__button",
|
|
48
|
-
onClick: () =>
|
|
49
|
+
onClick: () => u(e.id),
|
|
49
50
|
children: "Resolve"
|
|
50
51
|
}
|
|
51
52
|
)
|
|
@@ -1 +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"),
|
|
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"),i=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");require("../../../../utils/exportDocument.utils.cjs");const l=require("../../../../plugins/excel/excel.utils.cjs"),V=require("../ToolbarDropdown/ToolbarDropdown.utils.cjs"),k=require("../ToolbarButton/ToolbarButton.cjs"),F=X=>{var h;const{icon:D,disabled:p=!1,hint:I,onHint:w,pluginColor:g,onInsert:x}=X,[S,L]=E.useState(!1),[r,c]=E.useState(l.createEmptyExcelGrid),[v,R]=E.useState(null),[O,m]=E.useState(null),[M,j]=E.useState({top:s.NUMBER_ZERO,left:s.NUMBER_ZERO}),T=E.useRef(null),A=E.useRef(null),f=E.useRef(null),K=E.useRef(null),N=((h=r[s.NUMBER_ZERO])==null?void 0:h.length)??s.NUMBER_ONE,y=r.length<s.INK_EXCEL_SHEET_MAX_ROWS,$=N<s.INK_EXCEL_SHEET_MAX_COLS,q=r.length>s.NUMBER_ONE,H=N>s.NUMBER_ONE;E.useEffect(()=>{if(!S)return;const e=()=>{var C;const a=(C=f.current)==null?void 0:C.getBoundingClientRect().height,d=V.getToolbarDropdownMenuPosition(A.current,a&&a>s.NUMBER_ZERO?a:s.INK_EXCEL_MENU_ESTIMATED_HEIGHT_PX);j({top:d.top,left:d.left})};e();const t=window.requestAnimationFrame(e),u=a=>{var C,b;const d=a.target;(C=T.current)!=null&&C.contains(d)||(b=f.current)!=null&&b.contains(d)||L(!1)},_=a=>{a.key===G.KEY_ESCAPE&&L(!1)};return document.addEventListener("mousedown",u),document.addEventListener("keydown",_),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.cancelAnimationFrame(t),document.removeEventListener("mousedown",u),document.removeEventListener("keydown",_),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[S,r.length,N]);const U=e=>{var _;const t=(_=e.target.files)==null?void 0:_[s.NUMBER_ZERO];if(!t)return;const u=new FileReader;u.onload=()=>{c(l.parseCsvText(String(u.result)))},u.readAsText(t)};return n.jsxs("div",{className:o.INK_CLASS_STYLE_DD,ref:T,children:[n.jsx("div",{ref:A,children:n.jsx(k.ToolbarButton,{icon:D,title:i.INK_EXCEL_TITLE,hint:I,onHint:w,pluginColor:g,disabled:p,onClick:()=>{p||(c(l.createEmptyExcelGrid()),L(e=>!e))}})}),S?B.createPortal(n.jsxs("div",{ref:f,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":i.INK_EXCEL_TITLE,style:{top:M.top,left:M.left},children:[n.jsx("div",{className:o.INK_CLASS_EXCEL_TITLE,children:i.INK_EXCEL_TITLE}),n.jsxs("div",{className:o.INK_CLASS_EXCEL_GRID,style:{gridTemplateColumns:`2rem repeat(${N}, minmax(0, 1fr))`},onMouseLeave:()=>{R(null),m(null)},children:[n.jsx("span",{className:o.INK_CLASS_EXCEL_CORNER}),(r[s.NUMBER_ZERO]??[]).map((e,t)=>n.jsx("span",{className:`${o.INK_CLASS_EXCEL_HEAD}${v===t?` ${o.INK_CLASS_EXCEL_COL_HOVER}`:""}`,onMouseEnter:()=>R(t),children:o.EXCEL_COL_LETTERS[t]??t+s.NUMBER_ONE},`h-${t}`)),r.map((e,t)=>n.jsxs(E.Fragment,{children:[n.jsx("span",{className:`${o.INK_CLASS_EXCEL_HEAD}${O===t?` ${o.INK_CLASS_EXCEL_ROW_HOVER}`:""}`,onMouseEnter:()=>m(t),children:t+s.NUMBER_ONE}),e.map((u,_)=>n.jsx("input",{className:`${o.INK_CLASS_EXCEL_CELL}${v===_?` ${o.INK_CLASS_EXCEL_COL_HOVER}`:""}${O===t?` ${o.INK_CLASS_EXCEL_ROW_HOVER}`:""}`,value:u,onMouseEnter:()=>{R(_),m(t)},onChange:a=>c(l.setExcelCell(r,t,_,a.target.value))},`${t}-${_}`))]},`row-${t}`))]}),n.jsxs("div",{className:o.INK_CLASS_EXCEL_ACTIONS,children:[n.jsx("button",{type:"button",disabled:!y,onMouseDown:e=>{e.preventDefault(),c(l.addExcelRow(r))},children:i.INK_EXCEL_ADD_ROW}),n.jsx("button",{type:"button",disabled:!$,onMouseDown:e=>{e.preventDefault(),c(l.addExcelCol(r))},children:i.INK_EXCEL_ADD_COL}),n.jsx("button",{type:"button",disabled:!q,onMouseDown:e=>{e.preventDefault(),c(l.removeExcelRow(r))},children:i.INK_EXCEL_REMOVE_ROW}),n.jsx("button",{type:"button",disabled:!H,onMouseDown:e=>{e.preventDefault(),c(l.removeExcelCol(r))},children:i.INK_EXCEL_REMOVE_COL}),n.jsx("button",{type:"button",onMouseDown:e=>{e.preventDefault(),c(l.clearExcelGrid(r))},children:i.INK_EXCEL_CLEAR}),n.jsx("button",{type:"button",onMouseDown:e=>{var t;e.preventDefault(),(t=K.current)==null||t.click()},children:i.INK_EXCEL_IMPORT}),n.jsx("button",{type:"button",className:o.INK_CLASS_EXCEL_INSERT,onMouseDown:e=>{e.preventDefault(),x(l.excelGridToTableHtml(r)),L(!1)},children:i.INK_EXCEL_INSERT})]}),n.jsx("input",{ref:K,type:"file",accept:l.CSV_ACCEPT,hidden:!0,onChange:U})]}),document.body):null]})};exports.ExcelSheetPanel=F;
|
|
@@ -1 +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,
|
|
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,CAmNpD,CAAC"}
|