@forgedevstack/ink 1.1.8 → 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.
Files changed (116) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/components/InkEditor/InkEditor.cjs +1 -1
  3. package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
  4. package/dist/components/InkEditor/InkEditor.js +845 -830
  5. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.cjs +1 -1
  6. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.d.ts.map +1 -1
  7. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.js +96 -82
  8. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.cjs +1 -0
  9. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.cjs +1 -0
  10. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.d.ts +7 -0
  11. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.d.ts.map +1 -0
  12. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.js +9 -0
  13. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.d.ts +4 -0
  14. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.d.ts.map +1 -0
  15. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.js +82 -0
  16. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.types.d.ts +8 -0
  17. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.types.d.ts.map +1 -0
  18. package/dist/components/InkEditor/components/PresenceStack/index.d.ts +3 -0
  19. package/dist/components/InkEditor/components/PresenceStack/index.d.ts.map +1 -0
  20. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.cjs +1 -0
  21. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.cjs +1 -0
  22. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.d.ts +7 -0
  23. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.d.ts.map +1 -0
  24. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.js +10 -0
  25. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.d.ts +4 -0
  26. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.d.ts.map +1 -0
  27. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.js +65 -0
  28. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.types.d.ts +6 -0
  29. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.types.d.ts.map +1 -0
  30. package/dist/components/InkEditor/components/RemoteCursors/index.d.ts +3 -0
  31. package/dist/components/InkEditor/components/RemoteCursors/index.d.ts.map +1 -0
  32. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.cjs +1 -1
  33. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.js +35 -34
  34. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.cjs +1 -1
  35. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.d.ts.map +1 -1
  36. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.js +39 -55
  37. package/dist/components/InkEditor/components/ThemePicker/hooks/index.d.ts +3 -0
  38. package/dist/components/InkEditor/components/ThemePicker/hooks/index.d.ts.map +1 -0
  39. package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.cjs +1 -0
  40. package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.d.ts +13 -0
  41. package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.d.ts.map +1 -0
  42. package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.js +39 -0
  43. package/dist/components/InkEditor/components/index.d.ts +4 -0
  44. package/dist/components/InkEditor/components/index.d.ts.map +1 -1
  45. package/dist/components/InkTabs/InkTabs.cjs +1 -0
  46. package/dist/components/InkTabs/InkTabs.d.ts +4 -0
  47. package/dist/components/InkTabs/InkTabs.d.ts.map +1 -0
  48. package/dist/components/InkTabs/InkTabs.js +104 -0
  49. package/dist/components/InkTabs/index.d.ts +2 -0
  50. package/dist/components/InkTabs/index.d.ts.map +1 -0
  51. package/dist/components/InkWorkspace/InkWorkspace.cjs +1 -0
  52. package/dist/components/InkWorkspace/InkWorkspace.d.ts +4 -0
  53. package/dist/components/InkWorkspace/InkWorkspace.d.ts.map +1 -0
  54. package/dist/components/InkWorkspace/InkWorkspace.js +317 -0
  55. package/dist/components/InkWorkspace/components/WorkspaceIcons.cjs +1 -0
  56. package/dist/components/InkWorkspace/components/WorkspaceIcons.d.ts +11 -0
  57. package/dist/components/InkWorkspace/components/WorkspaceIcons.d.ts.map +1 -0
  58. package/dist/components/InkWorkspace/components/WorkspaceIcons.js +39 -0
  59. package/dist/components/InkWorkspace/hooks/useInkWorkspace.cjs +1 -0
  60. package/dist/components/InkWorkspace/hooks/useInkWorkspace.d.ts +30 -0
  61. package/dist/components/InkWorkspace/hooks/useInkWorkspace.d.ts.map +1 -0
  62. package/dist/components/InkWorkspace/hooks/useInkWorkspace.js +72 -0
  63. package/dist/components/InkWorkspace/index.d.ts +4 -0
  64. package/dist/components/InkWorkspace/index.d.ts.map +1 -0
  65. package/dist/components/index.d.ts +2 -0
  66. package/dist/components/index.d.ts.map +1 -1
  67. package/dist/constants/collab.const.cjs +1 -0
  68. package/dist/constants/collab.const.d.ts +20 -0
  69. package/dist/constants/collab.const.d.ts.map +1 -0
  70. package/dist/constants/collab.const.js +54 -0
  71. package/dist/constants/index.d.ts +2 -0
  72. package/dist/constants/index.d.ts.map +1 -1
  73. package/dist/constants/numbers.cjs +1 -1
  74. package/dist/constants/numbers.js +42 -37
  75. package/dist/constants/workspace.const.cjs +1 -0
  76. package/dist/constants/workspace.const.d.ts +24 -0
  77. package/dist/constants/workspace.const.d.ts.map +1 -0
  78. package/dist/constants/workspace.const.js +23 -0
  79. package/dist/hooks/index.d.ts +2 -0
  80. package/dist/hooks/index.d.ts.map +1 -1
  81. package/dist/hooks/useInkCollaboration.cjs +1 -0
  82. package/dist/hooks/useInkCollaboration.d.ts +4 -0
  83. package/dist/hooks/useInkCollaboration.d.ts.map +1 -0
  84. package/dist/hooks/useInkCollaboration.js +86 -0
  85. package/dist/index.cjs +1 -1
  86. package/dist/index.d.ts +5 -3
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +150 -135
  89. package/dist/plugins/theme/inkTheme.cjs +1 -1
  90. package/dist/plugins/theme/inkTheme.js +19 -22
  91. package/dist/styles.css +1 -1
  92. package/dist/types/collab.types.d.ts +55 -0
  93. package/dist/types/collab.types.d.ts.map +1 -0
  94. package/dist/types/index.d.ts +2 -0
  95. package/dist/types/index.d.ts.map +1 -1
  96. package/dist/types/ink.types.d.ts +4 -0
  97. package/dist/types/ink.types.d.ts.map +1 -1
  98. package/dist/types/workspace.types.d.ts +54 -0
  99. package/dist/types/workspace.types.d.ts.map +1 -0
  100. package/dist/utils/collab.utils.cjs +1 -0
  101. package/dist/utils/collab.utils.d.ts +5 -0
  102. package/dist/utils/collab.utils.d.ts.map +1 -0
  103. package/dist/utils/collab.utils.js +32 -0
  104. package/dist/utils/collab.utils.test.d.ts +2 -0
  105. package/dist/utils/collab.utils.test.d.ts.map +1 -0
  106. package/dist/utils/index.d.ts +2 -0
  107. package/dist/utils/index.d.ts.map +1 -1
  108. package/dist/utils/ink.brand.test.d.ts +2 -0
  109. package/dist/utils/ink.brand.test.d.ts.map +1 -0
  110. package/dist/utils/workspace.utils.cjs +1 -0
  111. package/dist/utils/workspace.utils.d.ts +5 -0
  112. package/dist/utils/workspace.utils.d.ts.map +1 -0
  113. package/dist/utils/workspace.utils.js +26 -0
  114. package/dist/utils/workspace.utils.test.d.ts +2 -0
  115. package/dist/utils/workspace.utils.test.d.ts.map +1 -0
  116. package/package.json +1 -1
@@ -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"),a=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 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,i]=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,H=r.length>s.NUMBER_ONE,U=N>s.NUMBER_ONE;E.useEffect(()=>{if(!S)return;const e=()=>{var C;const c=(C=f.current)==null?void 0:C.getBoundingClientRect().height,d=V.getToolbarDropdownMenuPosition(A.current,c&&c>s.NUMBER_ZERO?c:s.INK_EXCEL_MENU_ESTIMATED_HEIGHT_PX);j({top:d.top,left:d.left})};e();const t=window.requestAnimationFrame(e),u=c=>{var C,b;const d=c.target;(C=T.current)!=null&&C.contains(d)||(b=f.current)!=null&&b.contains(d)||L(!1)},_=c=>{c.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 q=e=>{var _;const t=(_=e.target.files)==null?void 0:_[s.NUMBER_ZERO];if(!t)return;const u=new FileReader;u.onload=()=>{i(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:a.INK_EXCEL_TITLE,hint:I,onHint:w,pluginColor:g,disabled:p,onClick:()=>{p||(i(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":a.INK_EXCEL_TITLE,style:{top:M.top,left:M.left},children:[n.jsx("div",{className:o.INK_CLASS_EXCEL_TITLE,children:a.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:c=>i(l.setExcelCell(r,t,_,c.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(),i(l.addExcelRow(r))},children:a.INK_EXCEL_ADD_ROW}),n.jsx("button",{type:"button",disabled:!$,onMouseDown:e=>{e.preventDefault(),i(l.addExcelCol(r))},children:a.INK_EXCEL_ADD_COL}),n.jsx("button",{type:"button",disabled:!H,onMouseDown:e=>{e.preventDefault(),i(l.removeExcelRow(r))},children:a.INK_EXCEL_REMOVE_ROW}),n.jsx("button",{type:"button",disabled:!U,onMouseDown:e=>{e.preventDefault(),i(l.removeExcelCol(r))},children:a.INK_EXCEL_REMOVE_COL}),n.jsx("button",{type:"button",onMouseDown:e=>{e.preventDefault(),i(l.clearExcelGrid(r))},children:a.INK_EXCEL_CLEAR}),n.jsx("button",{type:"button",onMouseDown:e=>{var t;e.preventDefault(),(t=K.current)==null||t.click()},children:a.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:a.INK_EXCEL_INSERT})]}),n.jsx("input",{ref:K,type:"file",accept:l.CSV_ACCEPT,hidden:!0,onChange:q})]}),document.body):null]})};exports.ExcelSheetPanel=F;
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;
@@ -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,CAmNpD,CAAC"}
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"}
@@ -1,124 +1,138 @@
1
- import { jsxs as _, jsx as n } from "react/jsx-runtime";
2
- import { useState as u, useRef as L, useEffect as j, Fragment as x } from "react";
3
- import { createPortal as z } from "react-dom";
4
- import { NUMBER_ZERO as i, NUMBER_ONE as d, INK_EXCEL_SHEET_MAX_ROWS as q, INK_EXCEL_SHEET_MAX_COLS as Z, INK_EXCEL_MENU_ESTIMATED_HEIGHT_PX as J } from "../../../../constants/numbers.js";
5
- import { INK_EXCEL_TITLE as v, INK_EXCEL_ADD_ROW as Q, 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";
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
6
  import { COLOR_MODE_LIGHT as se } from "../../../../constants/colorMode.const.js";
7
- import { KEY_ESCAPE as Ee } from "../../../../constants/keyboard.const.js";
8
- import { INK_CLASS_STYLE_DD as ie, INK_CLASS_STYLE_MENU as ae, INK_CLASS_STYLE_MENU_PORTAL as ce, INK_CLASS_STYLE_MENU_FORCED as _e, INK_CLASS_EXCEL_PANEL as ue, INK_CLASS_EXCEL_TITLE as de, INK_CLASS_EXCEL_GRID as me, INK_CLASS_EXCEL_CORNER as Ce, 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";
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
9
  import "../../../../constants/openai.const.js";
10
10
  import "../../../../utils/paste.utils.js";
11
- import { createEmptyExcelGrid as I, setExcelCell as Se, addExcelRow as ve, addExcelCol as Re, removeExcelRow as Ae, removeExcelCol as he, clearExcelGrid as Te, excelGridToTableHtml as Ke, CSV_ACCEPT as De, parseCsvText as Me } from "../../../../plugins/excel/excel.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
12
  import { getToolbarDropdownMenuPosition as we } from "../ToolbarDropdown/ToolbarDropdown.utils.js";
13
13
  import { ToolbarButton as Xe } from "../ToolbarButton/ToolbarButton.js";
14
- const Ye = ($) => {
15
- var w;
16
- const { icon: y, disabled: R = !1, hint: H, onHint: P, pluginColor: G, onInsert: F } = $, [p, m] = u(!1), [o, s] = u(I), [A, f] = u(null), [h, N] = u(null), [T, U] = u({ top: i, left: i }), K = L(null), D = L(null), S = L(null), M = L(null), C = ((w = o[i]) == null ? void 0 : w.length) ?? d, k = o.length < q, V = C < Z, Y = o.length > d, B = C > d;
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
17
  j(() => {
18
- if (!p) return;
18
+ if (!R) return;
19
19
  const e = () => {
20
- var c;
21
- const l = (c = S.current) == null ? void 0 : c.getBoundingClientRect().height, a = we(
20
+ var a;
21
+ const r = (a = M.current) == null ? void 0 : a.getBoundingClientRect().height, E = we(
22
22
  D.current,
23
- l && l > i ? l : J
23
+ r && r > c ? r : Q
24
24
  );
25
- U({ top: a.top, left: a.left });
25
+ U({ top: E.top, left: E.left });
26
26
  };
27
27
  e();
28
- const t = window.requestAnimationFrame(e), E = (l) => {
29
- var c, X;
30
- const a = l.target;
31
- (c = K.current) != null && c.contains(a) || (X = S.current) != null && X.contains(a) || m(!1);
32
- }, r = (l) => {
33
- l.key === Ee && m(!1);
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
34
  };
35
- return document.addEventListener("mousedown", E), document.addEventListener("keydown", r), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
36
- window.cancelAnimationFrame(t), document.removeEventListener("mousedown", E), document.removeEventListener("keydown", r), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
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
37
  };
38
- }, [p, o.length, C]);
38
+ }, [R, o.length, N]);
39
39
  const W = (e) => {
40
- var r;
41
- const t = (r = e.target.files) == null ? void 0 : r[i];
40
+ var i;
41
+ const t = (i = e.target.files) == null ? void 0 : i[c];
42
42
  if (!t) return;
43
- const E = new FileReader();
44
- E.onload = () => {
45
- s(Me(String(E.result)));
46
- }, E.readAsText(t);
43
+ const l = new FileReader();
44
+ l.onload = () => {
45
+ s(De(String(l.result)));
46
+ }, l.readAsText(t);
47
47
  };
48
- return /* @__PURE__ */ _("div", { className: ie, ref: K, children: [
48
+ return /* @__PURE__ */ m("div", { className: Ee, ref: K, children: [
49
49
  /* @__PURE__ */ n("div", { ref: D, children: /* @__PURE__ */ n(
50
50
  Xe,
51
51
  {
52
52
  icon: y,
53
- title: v,
53
+ title: A,
54
54
  hint: H,
55
55
  onHint: P,
56
56
  pluginColor: G,
57
- disabled: R,
57
+ disabled: h,
58
58
  onClick: () => {
59
- R || (s(I()), m((e) => !e));
59
+ h || (s($()), L((e) => !e));
60
60
  }
61
61
  }
62
62
  ) }),
63
- p ? z(
64
- /* @__PURE__ */ _(
63
+ R ? q(
64
+ /* @__PURE__ */ m(
65
65
  "div",
66
66
  {
67
- ref: S,
68
- className: `${ae} ${ce} ${_e} ${ue}`,
67
+ ref: M,
68
+ className: `${ae} ${ce} ${ue} ${_e}`,
69
69
  "data-color-mode": se,
70
70
  role: "dialog",
71
- "aria-label": v,
71
+ "aria-label": A,
72
72
  style: { top: T.top, left: T.left },
73
73
  children: [
74
- /* @__PURE__ */ n("div", { className: de, children: v }),
75
- /* @__PURE__ */ _(
74
+ /* @__PURE__ */ n("div", { className: me, children: A }),
75
+ /* @__PURE__ */ m(
76
76
  "div",
77
77
  {
78
- className: me,
78
+ className: Ce,
79
79
  style: {
80
- gridTemplateColumns: `2rem repeat(${C}, minmax(0, 1fr))`
80
+ gridTemplateColumns: `2rem repeat(${N}, minmax(0, 1fr))`
81
81
  },
82
82
  onMouseLeave: () => {
83
- f(null), N(null);
83
+ u(null), _(null);
84
84
  },
85
85
  children: [
86
- /* @__PURE__ */ n("span", { className: Ce }),
87
- (o[i] ?? []).map((e, t) => /* @__PURE__ */ n(
88
- "span",
89
- {
90
- className: `${b}${A === t ? ` ${O}` : ""}`,
91
- onMouseEnter: () => f(t),
92
- children: Le[t] ?? t + d
93
- },
94
- `h-${t}`
95
- )),
96
- o.map((e, t) => /* @__PURE__ */ _(x, { children: [
97
- /* @__PURE__ */ n(
86
+ /* @__PURE__ */ n("span", { className: de }),
87
+ (o[c] ?? []).map((e, t) => {
88
+ const l = p !== null && t <= p;
89
+ return /* @__PURE__ */ n(
98
90
  "span",
99
91
  {
100
- className: `${b}${h === t ? ` ${g}` : ""}`,
101
- onMouseEnter: () => N(t),
102
- children: t + d
103
- }
104
- ),
105
- e.map((E, r) => /* @__PURE__ */ n(
106
- "input",
107
- {
108
- className: `${pe}${A === r ? ` ${O}` : ""}${h === t ? ` ${g}` : ""}`,
109
- value: E,
110
- onMouseEnter: () => {
111
- f(r), N(t);
112
- },
113
- onChange: (l) => s(Se(o, t, r, l.target.value))
92
+ className: `${b}${l ? ` ${O}` : ""}`,
93
+ onMouseEnter: () => u(t),
94
+ onMouseMove: () => u(t),
95
+ children: Le[t] ?? t + d
114
96
  },
115
- `${t}-${r}`
116
- ))
117
- ] }, `row-${t}`))
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
+ })
118
132
  ]
119
133
  }
120
134
  ),
121
- /* @__PURE__ */ _("div", { className: fe, children: [
135
+ /* @__PURE__ */ m("div", { className: fe, children: [
122
136
  /* @__PURE__ */ n(
123
137
  "button",
124
138
  {
@@ -127,7 +141,7 @@ const Ye = ($) => {
127
141
  onMouseDown: (e) => {
128
142
  e.preventDefault(), s(ve(o));
129
143
  },
130
- children: Q
144
+ children: x
131
145
  }
132
146
  ),
133
147
  /* @__PURE__ */ n(
@@ -147,7 +161,7 @@ const Ye = ($) => {
147
161
  type: "button",
148
162
  disabled: !Y,
149
163
  onMouseDown: (e) => {
150
- e.preventDefault(), s(Ae(o));
164
+ e.preventDefault(), s(Me(o));
151
165
  },
152
166
  children: te
153
167
  }
@@ -158,7 +172,7 @@ const Ye = ($) => {
158
172
  type: "button",
159
173
  disabled: !B,
160
174
  onMouseDown: (e) => {
161
- e.preventDefault(), s(he(o));
175
+ e.preventDefault(), s(Ae(o));
162
176
  },
163
177
  children: ne
164
178
  }
@@ -168,7 +182,7 @@ const Ye = ($) => {
168
182
  {
169
183
  type: "button",
170
184
  onMouseDown: (e) => {
171
- e.preventDefault(), s(Te(o));
185
+ e.preventDefault(), s(he(o));
172
186
  },
173
187
  children: oe
174
188
  }
@@ -179,7 +193,7 @@ const Ye = ($) => {
179
193
  type: "button",
180
194
  onMouseDown: (e) => {
181
195
  var t;
182
- e.preventDefault(), (t = M.current) == null || t.click();
196
+ e.preventDefault(), (t = w.current) == null || t.click();
183
197
  },
184
198
  children: re
185
199
  }
@@ -190,13 +204,13 @@ const Ye = ($) => {
190
204
  type: "button",
191
205
  className: Ne,
192
206
  onMouseDown: (e) => {
193
- e.preventDefault(), F(Ke(o)), m(!1);
207
+ e.preventDefault(), F(Te(o)), L(!1);
194
208
  },
195
209
  children: le
196
210
  }
197
211
  )
198
212
  ] }),
199
- /* @__PURE__ */ n("input", { ref: M, type: "file", accept: De, hidden: !0, onChange: W })
213
+ /* @__PURE__ */ n("input", { ref: w, type: "file", accept: Ke, hidden: !0, onChange: W })
200
214
  ]
201
215
  }
202
216
  ),
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),a=require("./PresenceStack.const.cjs"),r=require("../../../../constants/numbers.cjs"),c=require("../../../../constants/generals.const.cjs");require("../../../../constants/openai.const.cjs");const o=require("../../../../utils/cn.utils.cjs");require("../../../../utils/paste.utils.cjs");const S=require("../../../../utils/collab.utils.cjs"),A=require("../../../../common-components/Button/Button.cjs");require("react");require("react-dom");const E=require("../../../../constants/collab.const.cjs"),k=n=>n.avatarUrl?s.jsx("img",{src:n.avatarUrl,alt:n.name,className:"ink-presence-avatar-img"}):s.jsx("span",{className:"ink-presence-initials",children:S.getCollaboratorInitials(n.name)}),v=n=>{const{collaborators:i,maxAvatars:u=a.INK_PRESENCE_DEFAULT_MAX_AVATARS,onFollow:l,className:N=c.EMPTY_STRING}=n;if(!i||i.length===r.NUMBER_ZERO)return null;const R=i.slice(r.NUMBER_ZERO,u),t=Math.max(r.NUMBER_ZERO,i.length-u);return s.jsx("div",{className:o.cn("ink-presence-stack",N),role:"region","aria-label":a.COLLAB_ARIA_REGION,children:s.jsxs("div",{className:"ink-presence-avatars",children:[R.map(e=>{const _=e.status===E.INK_STATUS_IDLE,m=e.role||E.INK_ROLE_EDITOR,d=_?a.IDLE_LABEL_SUFFIX:c.EMPTY_STRING,I=`${e.name} (${m})${d}`;return s.jsxs(A.Button,{type:"button",className:"ink-presence-avatar-btn",style:{backgroundColor:e.color},title:I,onClick:()=>l==null?void 0:l(e),"aria-label":`${a.COLLAB_ARIA_LABEL_PREFIX}${e.name}`,children:[k(e),s.jsx("span",{className:o.cn("ink-presence-status-dot",_?"ink-presence-idle":"ink-presence-active")})]},e.id)}),t>r.NUMBER_ZERO&&s.jsxs("div",{className:"ink-presence-avatar-overflow",title:`${t} more collaborator${t>r.NUMBER_ONE?"s":c.EMPTY_STRING}`,"aria-label":`${t} more collaborator${t>r.NUMBER_ONE?"s":c.EMPTY_STRING}`,children:[a.PLUS_SIGN,t]})]})})};exports.PresenceStack=v;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("../../../../constants/numbers.cjs"),_=A.NUMBER_FOUR,L="+",E=" - Idle",I="Active collaborators",o="Collaborator ";exports.COLLAB_ARIA_LABEL_PREFIX=o;exports.COLLAB_ARIA_REGION=I;exports.IDLE_LABEL_SUFFIX=E;exports.INK_PRESENCE_DEFAULT_MAX_AVATARS=_;exports.PLUS_SIGN=L;
@@ -0,0 +1,7 @@
1
+ export declare const INK_PRESENCE_DEFAULT_MAX_AVATARS = 4;
2
+ export declare const PLUS_SIGN = "+";
3
+ export declare const DEFAULT_INITIAL = "?";
4
+ export declare const IDLE_LABEL_SUFFIX = " - Idle";
5
+ export declare const COLLAB_ARIA_REGION = "Active collaborators";
6
+ export declare const COLLAB_ARIA_LABEL_PREFIX = "Collaborator ";
7
+ //# sourceMappingURL=PresenceStack.const.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PresenceStack.const.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/PresenceStack/PresenceStack.const.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gCAAgC,IAAc,CAAC;AAC5D,eAAO,MAAM,SAAS,MAAM,CAAC;AAC7B,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,kBAAkB,yBAAyB,CAAC;AACzD,eAAO,MAAM,wBAAwB,kBAAkB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { NUMBER_FOUR as o } from "../../../../constants/numbers.js";
2
+ const _ = o, L = "+", t = " - Idle", E = "Active collaborators", I = "Collaborator ";
3
+ export {
4
+ I as COLLAB_ARIA_LABEL_PREFIX,
5
+ E as COLLAB_ARIA_REGION,
6
+ t as IDLE_LABEL_SUFFIX,
7
+ _ as INK_PRESENCE_DEFAULT_MAX_AVATARS,
8
+ L as PLUS_SIGN
9
+ };
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { PresenceStackProps } from './PresenceStack.types';
3
+ export declare const PresenceStack: React.FC<PresenceStackProps>;
4
+ //# sourceMappingURL=PresenceStack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PresenceStack.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/PresenceStack/PresenceStack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAoChE,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA8DtD,CAAC"}
@@ -0,0 +1,82 @@
1
+ import { jsx as i, jsxs as c } from "react/jsx-runtime";
2
+ import { INK_PRESENCE_DEFAULT_MAX_AVATARS as I, COLLAB_ARIA_REGION as v, IDLE_LABEL_SUFFIX as L, COLLAB_ARIA_LABEL_PREFIX as f, PLUS_SIGN as k } from "./PresenceStack.const.js";
3
+ import { NUMBER_ZERO as s, NUMBER_ONE as p } from "../../../../constants/numbers.js";
4
+ import { EMPTY_STRING as a } from "../../../../constants/generals.const.js";
5
+ import "../../../../constants/openai.const.js";
6
+ import { cn as _ } from "../../../../utils/cn.utils.js";
7
+ import "../../../../utils/paste.utils.js";
8
+ import { getCollaboratorInitials as R } from "../../../../utils/collab.utils.js";
9
+ import { Button as S } from "../../../../common-components/Button/Button.js";
10
+ import "react";
11
+ import "react-dom";
12
+ import { INK_STATUS_IDLE as h, INK_ROLE_EDITOR as C } from "../../../../constants/collab.const.js";
13
+ const $ = (t) => t.avatarUrl ? /* @__PURE__ */ i(
14
+ "img",
15
+ {
16
+ src: t.avatarUrl,
17
+ alt: t.name,
18
+ className: "ink-presence-avatar-img"
19
+ }
20
+ ) : /* @__PURE__ */ i("span", { className: "ink-presence-initials", children: R(t.name) }), K = (t) => {
21
+ const {
22
+ collaborators: n,
23
+ maxAvatars: l = I,
24
+ onFollow: m,
25
+ className: N = a
26
+ } = t;
27
+ if (!n || n.length === s)
28
+ return null;
29
+ const E = n.slice(s, l), r = Math.max(s, n.length - l);
30
+ return /* @__PURE__ */ i(
31
+ "div",
32
+ {
33
+ className: _("ink-presence-stack", N),
34
+ role: "region",
35
+ "aria-label": v,
36
+ children: /* @__PURE__ */ c("div", { className: "ink-presence-avatars", children: [
37
+ E.map((e) => {
38
+ const o = e.status === h, d = e.role || C, A = o ? L : a, u = `${e.name} (${d})${A}`;
39
+ return /* @__PURE__ */ c(
40
+ S,
41
+ {
42
+ type: "button",
43
+ className: "ink-presence-avatar-btn",
44
+ style: { backgroundColor: e.color },
45
+ title: u,
46
+ onClick: () => m == null ? void 0 : m(e),
47
+ "aria-label": `${f}${e.name}`,
48
+ children: [
49
+ $(e),
50
+ /* @__PURE__ */ i(
51
+ "span",
52
+ {
53
+ className: _(
54
+ "ink-presence-status-dot",
55
+ o ? "ink-presence-idle" : "ink-presence-active"
56
+ )
57
+ }
58
+ )
59
+ ]
60
+ },
61
+ e.id
62
+ );
63
+ }),
64
+ r > s && /* @__PURE__ */ c(
65
+ "div",
66
+ {
67
+ className: "ink-presence-avatar-overflow",
68
+ title: `${r} more collaborator${r > p ? "s" : a}`,
69
+ "aria-label": `${r} more collaborator${r > p ? "s" : a}`,
70
+ children: [
71
+ k,
72
+ r
73
+ ]
74
+ }
75
+ )
76
+ ] })
77
+ }
78
+ );
79
+ };
80
+ export {
81
+ K as PresenceStack
82
+ };
@@ -0,0 +1,8 @@
1
+ import { InkCollaborator } from '../../../../types';
2
+ export interface PresenceStackProps {
3
+ collaborators: InkCollaborator[];
4
+ maxAvatars?: number;
5
+ onFollow?: (collaborator: InkCollaborator) => void;
6
+ className?: string;
7
+ }
8
+ //# sourceMappingURL=PresenceStack.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PresenceStack.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/PresenceStack/PresenceStack.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,eAAe,EAAE,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,eAAe,KAAK,IAAI,CAAC;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,3 @@
1
+ export { PresenceStack } from './PresenceStack';
2
+ export type { PresenceStackProps } from './PresenceStack.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/PresenceStack/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),r=require("./RemoteCursors.const.cjs"),t=require("../../../../constants/numbers.cjs"),l=require("../../../../constants/generals.const.cjs");require("../../../../constants/openai.const.cjs");const m=require("../../../../utils/cn.utils.cjs");require("../../../../utils/paste.utils.cjs");require("react");require("react-dom");const T=({collaborators:c,className:u=l.EMPTY_STRING})=>{const n=(c||[]).filter(e=>e.cursor&&(e.cursor.offset!==void 0||e.cursor.line!==void 0));return n.length===t.NUMBER_ZERO?null:s.jsx("div",{className:m.cn("ink-remote-cursors-layer",u),"aria-hidden":"true",children:n.map(e=>{var i,o;const _=((i=e.cursor)==null?void 0:i.line)??t.NUMBER_ONE,R=((o=e.cursor)==null?void 0:o.col)??t.NUMBER_ZERO,E=Math.max(r.REMOTE_CURSOR_MIN_TOP_PX,(_-t.NUMBER_ONE)*r.REMOTE_CURSOR_LINE_HEIGHT_PX+r.REMOTE_CURSOR_TOP_OFFSET_PX),O=Math.max(r.REMOTE_CURSOR_MIN_LEFT_PX,R*r.REMOTE_CURSOR_CHAR_WIDTH_PX+r.REMOTE_CURSOR_LEFT_OFFSET_PX);return s.jsxs("div",{className:"ink-remote-cursor-item",style:{top:`${E}px`,left:`${O}px`},children:[s.jsx("div",{className:"ink-remote-cursor-caret",style:{backgroundColor:e.color}}),s.jsx("div",{className:"ink-remote-cursor-tag",style:{backgroundColor:e.color},children:e.name})]},e.id)})})};exports.RemoteCursors=T;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../../constants/numbers.cjs"),E=_.NUMBER_TWENTY_EIGHT,R=_.NUMBER_FOURTEEN,T=_.NUMBER_TWELVE,O=8.5,M=_.NUMBER_TWENTY_FOUR,S=_.NUMBER_SIXTEEN;exports.REMOTE_CURSOR_CHAR_WIDTH_PX=O;exports.REMOTE_CURSOR_LEFT_OFFSET_PX=M;exports.REMOTE_CURSOR_LINE_HEIGHT_PX=E;exports.REMOTE_CURSOR_MIN_LEFT_PX=S;exports.REMOTE_CURSOR_MIN_TOP_PX=T;exports.REMOTE_CURSOR_TOP_OFFSET_PX=R;
@@ -0,0 +1,7 @@
1
+ export declare const REMOTE_CURSOR_LINE_HEIGHT_PX = 28;
2
+ export declare const REMOTE_CURSOR_TOP_OFFSET_PX = 14;
3
+ export declare const REMOTE_CURSOR_MIN_TOP_PX = 12;
4
+ export declare const REMOTE_CURSOR_CHAR_WIDTH_PX = 8.5;
5
+ export declare const REMOTE_CURSOR_LEFT_OFFSET_PX = 24;
6
+ export declare const REMOTE_CURSOR_MIN_LEFT_PX = 16;
7
+ //# sourceMappingURL=RemoteCursors.const.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RemoteCursors.const.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/RemoteCursors/RemoteCursors.const.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,4BAA4B,KAAsB,CAAC;AAChE,eAAO,MAAM,2BAA2B,KAAkB,CAAC;AAC3D,eAAO,MAAM,wBAAwB,KAAgB,CAAC;AACtD,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,eAAO,MAAM,4BAA4B,KAAqB,CAAC;AAC/D,eAAO,MAAM,yBAAyB,KAAiB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { NUMBER_SIXTEEN as E, NUMBER_TWELVE as _, NUMBER_TWENTY_FOUR as R, NUMBER_TWENTY_EIGHT as T, NUMBER_FOURTEEN as O } from "../../../../constants/numbers.js";
2
+ const U = T, N = O, o = _, S = 8.5, t = R, F = E;
3
+ export {
4
+ S as REMOTE_CURSOR_CHAR_WIDTH_PX,
5
+ t as REMOTE_CURSOR_LEFT_OFFSET_PX,
6
+ U as REMOTE_CURSOR_LINE_HEIGHT_PX,
7
+ F as REMOTE_CURSOR_MIN_LEFT_PX,
8
+ o as REMOTE_CURSOR_MIN_TOP_PX,
9
+ N as REMOTE_CURSOR_TOP_OFFSET_PX
10
+ };
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { RemoteCursorsProps } from './RemoteCursors.types';
3
+ export declare const RemoteCursors: React.FC<RemoteCursorsProps>;
4
+ //# sourceMappingURL=RemoteCursors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RemoteCursors.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/RemoteCursors/RemoteCursors.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAYhE,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAuDtD,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { jsx as e, jsxs as u } from "react/jsx-runtime";
2
+ import { REMOTE_CURSOR_MIN_LEFT_PX as T, REMOTE_CURSOR_CHAR_WIDTH_PX as p, REMOTE_CURSOR_LEFT_OFFSET_PX as d, REMOTE_CURSOR_MIN_TOP_PX as l, REMOTE_CURSOR_LINE_HEIGHT_PX as M, REMOTE_CURSOR_TOP_OFFSET_PX as f } from "./RemoteCursors.const.js";
3
+ import { NUMBER_ZERO as i, NUMBER_ONE as m } from "../../../../constants/numbers.js";
4
+ import { EMPTY_STRING as C } from "../../../../constants/generals.const.js";
5
+ import "../../../../constants/openai.const.js";
6
+ import { cn as N } from "../../../../utils/cn.utils.js";
7
+ import "../../../../utils/paste.utils.js";
8
+ import "react";
9
+ import "react-dom";
10
+ const I = ({
11
+ collaborators: _,
12
+ className: n = C
13
+ }) => {
14
+ const o = (_ || []).filter(
15
+ (r) => r.cursor && (r.cursor.offset !== void 0 || r.cursor.line !== void 0)
16
+ );
17
+ return o.length === i ? null : /* @__PURE__ */ e(
18
+ "div",
19
+ {
20
+ className: N("ink-remote-cursors-layer", n),
21
+ "aria-hidden": "true",
22
+ children: o.map((r) => {
23
+ var t, s;
24
+ const c = ((t = r.cursor) == null ? void 0 : t.line) ?? m, R = ((s = r.cursor) == null ? void 0 : s.col) ?? i, E = Math.max(
25
+ l,
26
+ (c - m) * M + f
27
+ ), O = Math.max(
28
+ T,
29
+ R * p + d
30
+ );
31
+ return /* @__PURE__ */ u(
32
+ "div",
33
+ {
34
+ className: "ink-remote-cursor-item",
35
+ style: {
36
+ top: `${E}px`,
37
+ left: `${O}px`
38
+ },
39
+ children: [
40
+ /* @__PURE__ */ e(
41
+ "div",
42
+ {
43
+ className: "ink-remote-cursor-caret",
44
+ style: { backgroundColor: r.color }
45
+ }
46
+ ),
47
+ /* @__PURE__ */ e(
48
+ "div",
49
+ {
50
+ className: "ink-remote-cursor-tag",
51
+ style: { backgroundColor: r.color },
52
+ children: r.name
53
+ }
54
+ )
55
+ ]
56
+ },
57
+ r.id
58
+ );
59
+ })
60
+ }
61
+ );
62
+ };
63
+ export {
64
+ I as RemoteCursors
65
+ };
@@ -0,0 +1,6 @@
1
+ import { InkCollaborator } from '../../../../types';
2
+ export interface RemoteCursorsProps {
3
+ collaborators: InkCollaborator[];
4
+ className?: string;
5
+ }
6
+ //# sourceMappingURL=RemoteCursors.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RemoteCursors.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/RemoteCursors/RemoteCursors.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,eAAe,EAAE,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,3 @@
1
+ export { RemoteCursors } from './RemoteCursors';
2
+ export type { RemoteCursorsProps } from './RemoteCursors.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/RemoteCursors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("react"),v=require("react-dom"),_=require("../../../../constants/numbers.cjs"),L=require("../../../../constants/generals.const.cjs"),w=require("../../../../constants/colorMode.const.cjs"),B=require("../../../../constants/keyboard.const.cjs"),t=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");const b=require("../ToolbarDropdown/ToolbarDropdown.utils.cjs"),O=require("../ToolbarButton/ToolbarButton.cjs"),c=require("./TableSizePicker.const.cjs"),p=C=>{const{icon:f,disabled:I=!1,onSelect:P}=C,[a,E]=s.useState(!1),[u,d]=s.useState(c.TABLE_PICKER_INITIAL_HOVER),[T,m]=s.useState(c.TABLE_PICKER_EMPTY_POSITION),A=s.useRef(null),S=s.useRef(null),R=s.useRef(null);s.useEffect(()=>{if(!a)return;const e=()=>{const o=b.getToolbarDropdownMenuPosition(S.current);m({top:o.top,left:o.left})};e();const r=o=>{var K,N;const l=o.target;(K=A.current)!=null&&K.contains(l)||(N=R.current)!=null&&N.contains(l)||E(!1)},i=o=>{o.key===B.KEY_ESCAPE&&E(!1)};return document.addEventListener("mousedown",r),document.addEventListener("keydown",i),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",i),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[a]);const M=Array.from({length:_.INK_TABLE_PICKER_MAX*_.INK_TABLE_PICKER_MAX},(e,r)=>{const i=Math.floor(r/_.INK_TABLE_PICKER_MAX)+_.NUMBER_ONE,o=r%_.INK_TABLE_PICKER_MAX+_.NUMBER_ONE,l=i<=u.rows&&o<=u.cols;return{rows:i,cols:o,isOn:l,key:`${i}-${o}`}});return n.jsxs("div",{className:t.INK_CLASS_TABLE_PICKER,ref:A,children:[n.jsx("div",{ref:S,children:n.jsx(O.ToolbarButton,{icon:f,title:L.INK_TABLE_INSERT_TITLE,disabled:I,onClick:()=>{I||(d(c.TABLE_PICKER_INITIAL_HOVER),E(e=>!e))}})}),a?v.createPortal(n.jsxs("div",{ref:R,className:`${t.INK_CLASS_STYLE_MENU} ${t.INK_CLASS_STYLE_MENU_PORTAL} ${t.INK_CLASS_STYLE_MENU_FORCED}`,"data-color-mode":w.COLOR_MODE_LIGHT,role:"grid","aria-label":L.INK_TABLE_INSERT_TITLE,style:{top:T.top,left:T.left},children:[n.jsx("div",{className:t.INK_CLASS_TABLE_PICKER_GRID,style:{gridTemplateColumns:`repeat(${_.INK_TABLE_PICKER_MAX}, 1fr)`},children:M.map(e=>n.jsx("button",{type:"button",className:`${t.INK_CLASS_TABLE_PICKER_CELL}${e.isOn?`${L.SPACE_STRING}${t.INK_CLASS_TABLE_PICKER_CELL_ON}`:""}`,"aria-label":`${e.rows}${c.TABLE_PICKER_TIMES_MARK}${e.cols}`,onMouseEnter:()=>d({rows:e.rows,cols:e.cols}),onMouseDown:r=>{r.preventDefault(),P(e.rows,e.cols),E(!1)}},e.key))}),n.jsxs("div",{className:t.INK_CLASS_TABLE_PICKER_LABEL,children:[u.rows,c.TABLE_PICKER_TIMES_MARK,u.cols]})]}),document.body):null]})};exports.TableSizePicker=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),n=require("react"),w=require("react-dom"),_=require("../../../../constants/numbers.cjs"),I=require("../../../../constants/generals.const.cjs"),v=require("../../../../constants/colorMode.const.cjs"),B=require("../../../../constants/keyboard.const.cjs"),t=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");const b=require("../ToolbarDropdown/ToolbarDropdown.utils.cjs"),O=require("../ToolbarButton/ToolbarButton.cjs"),c=require("./TableSizePicker.const.cjs"),p=C=>{const{icon:f,disabled:d=!1,onSelect:P}=C,[l,E]=n.useState(!1),[u,L]=n.useState(c.TABLE_PICKER_INITIAL_HOVER),[T,m]=n.useState(c.TABLE_PICKER_EMPTY_POSITION),A=n.useRef(null),S=n.useRef(null),R=n.useRef(null);n.useEffect(()=>{if(!l)return;const e=()=>{const o=b.getToolbarDropdownMenuPosition(S.current);m({top:o.top,left:o.left})};e();const r=o=>{var K,N;const a=o.target;(K=A.current)!=null&&K.contains(a)||(N=R.current)!=null&&N.contains(a)||E(!1)},i=o=>{o.key===B.KEY_ESCAPE&&E(!1)};return document.addEventListener("mousedown",r),document.addEventListener("keydown",i),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",i),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[l]);const M=Array.from({length:_.INK_TABLE_PICKER_MAX*_.INK_TABLE_PICKER_MAX},(e,r)=>{const i=Math.floor(r/_.INK_TABLE_PICKER_MAX)+_.NUMBER_ONE,o=r%_.INK_TABLE_PICKER_MAX+_.NUMBER_ONE,a=i<=u.rows&&o<=u.cols;return{rows:i,cols:o,isOn:a,key:`${i}-${o}`}});return s.jsxs("div",{className:t.INK_CLASS_TABLE_PICKER,ref:A,children:[s.jsx("div",{ref:S,children:s.jsx(O.ToolbarButton,{icon:f,title:I.INK_TABLE_INSERT_TITLE,disabled:d,onClick:()=>{d||(L(c.TABLE_PICKER_INITIAL_HOVER),E(e=>!e))}})}),l&&w.createPortal(s.jsxs("div",{ref:R,className:`${t.INK_CLASS_STYLE_MENU} ${t.INK_CLASS_STYLE_MENU_PORTAL} ${t.INK_CLASS_STYLE_MENU_FORCED}`,"data-color-mode":v.COLOR_MODE_LIGHT,role:"grid","aria-label":I.INK_TABLE_INSERT_TITLE,style:{top:T.top,left:T.left},children:[s.jsx("div",{className:t.INK_CLASS_TABLE_PICKER_GRID,style:{gridTemplateColumns:`repeat(${_.INK_TABLE_PICKER_MAX}, 1fr)`},children:M.map(e=>s.jsx("button",{type:"button",className:`${t.INK_CLASS_TABLE_PICKER_CELL}${e.isOn?`${I.SPACE_STRING}${t.INK_CLASS_TABLE_PICKER_CELL_ON}`:""}`,"aria-label":`${e.rows}${c.TABLE_PICKER_TIMES_MARK}${e.cols}`,onMouseEnter:()=>L({rows:e.rows,cols:e.cols}),onMouseMove:()=>L({rows:e.rows,cols:e.cols}),onMouseDown:r=>{r.preventDefault(),P(e.rows,e.cols),E(!1)}},e.key))}),s.jsxs("div",{className:t.INK_CLASS_TABLE_PICKER_LABEL,children:[u.rows,c.TABLE_PICKER_TIMES_MARK,u.cols]})]}),document.body)]})};exports.TableSizePicker=p;