@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.
- package/CHANGELOG.md +9 -0
- package/dist/components/InkEditor/InkEditor.cjs +1 -1
- package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
- package/dist/components/InkEditor/InkEditor.js +845 -830
- 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 +96 -82
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.cjs +1 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.cjs +1 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.d.ts +7 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.js +9 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.d.ts +4 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.d.ts.map +1 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.js +82 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.types.d.ts +8 -0
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/PresenceStack/index.d.ts +3 -0
- package/dist/components/InkEditor/components/PresenceStack/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.cjs +1 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.cjs +1 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.d.ts +7 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.js +10 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.d.ts +4 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.d.ts.map +1 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.js +65 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.types.d.ts +6 -0
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/RemoteCursors/index.d.ts +3 -0
- package/dist/components/InkEditor/components/RemoteCursors/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.cjs +1 -1
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.js +35 -34
- 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 +39 -55
- package/dist/components/InkEditor/components/ThemePicker/hooks/index.d.ts +3 -0
- package/dist/components/InkEditor/components/ThemePicker/hooks/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.cjs +1 -0
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.d.ts +13 -0
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.js +39 -0
- package/dist/components/InkEditor/components/index.d.ts +4 -0
- package/dist/components/InkEditor/components/index.d.ts.map +1 -1
- package/dist/components/InkTabs/InkTabs.cjs +1 -0
- package/dist/components/InkTabs/InkTabs.d.ts +4 -0
- package/dist/components/InkTabs/InkTabs.d.ts.map +1 -0
- package/dist/components/InkTabs/InkTabs.js +104 -0
- package/dist/components/InkTabs/index.d.ts +2 -0
- package/dist/components/InkTabs/index.d.ts.map +1 -0
- package/dist/components/InkWorkspace/InkWorkspace.cjs +1 -0
- package/dist/components/InkWorkspace/InkWorkspace.d.ts +4 -0
- package/dist/components/InkWorkspace/InkWorkspace.d.ts.map +1 -0
- package/dist/components/InkWorkspace/InkWorkspace.js +317 -0
- package/dist/components/InkWorkspace/components/WorkspaceIcons.cjs +1 -0
- package/dist/components/InkWorkspace/components/WorkspaceIcons.d.ts +11 -0
- package/dist/components/InkWorkspace/components/WorkspaceIcons.d.ts.map +1 -0
- package/dist/components/InkWorkspace/components/WorkspaceIcons.js +39 -0
- package/dist/components/InkWorkspace/hooks/useInkWorkspace.cjs +1 -0
- package/dist/components/InkWorkspace/hooks/useInkWorkspace.d.ts +30 -0
- package/dist/components/InkWorkspace/hooks/useInkWorkspace.d.ts.map +1 -0
- package/dist/components/InkWorkspace/hooks/useInkWorkspace.js +72 -0
- package/dist/components/InkWorkspace/index.d.ts +4 -0
- package/dist/components/InkWorkspace/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/constants/collab.const.cjs +1 -0
- package/dist/constants/collab.const.d.ts +20 -0
- package/dist/constants/collab.const.d.ts.map +1 -0
- package/dist/constants/collab.const.js +54 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/numbers.cjs +1 -1
- package/dist/constants/numbers.js +42 -37
- package/dist/constants/workspace.const.cjs +1 -0
- package/dist/constants/workspace.const.d.ts +24 -0
- package/dist/constants/workspace.const.d.ts.map +1 -0
- package/dist/constants/workspace.const.js +23 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useInkCollaboration.cjs +1 -0
- package/dist/hooks/useInkCollaboration.d.ts +4 -0
- package/dist/hooks/useInkCollaboration.d.ts.map +1 -0
- package/dist/hooks/useInkCollaboration.js +86 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +150 -135
- package/dist/plugins/theme/inkTheme.cjs +1 -1
- package/dist/plugins/theme/inkTheme.js +19 -22
- package/dist/styles.css +1 -1
- package/dist/types/collab.types.d.ts +55 -0
- package/dist/types/collab.types.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/ink.types.d.ts +4 -0
- package/dist/types/ink.types.d.ts.map +1 -1
- package/dist/types/workspace.types.d.ts +54 -0
- package/dist/types/workspace.types.d.ts.map +1 -0
- package/dist/utils/collab.utils.cjs +1 -0
- package/dist/utils/collab.utils.d.ts +5 -0
- package/dist/utils/collab.utils.d.ts.map +1 -0
- package/dist/utils/collab.utils.js +32 -0
- package/dist/utils/collab.utils.test.d.ts +2 -0
- package/dist/utils/collab.utils.test.d.ts.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/ink.brand.test.d.ts +2 -0
- package/dist/utils/ink.brand.test.d.ts.map +1 -0
- package/dist/utils/workspace.utils.cjs +1 -0
- package/dist/utils/workspace.utils.d.ts +5 -0
- package/dist/utils/workspace.utils.d.ts.map +1 -0
- package/dist/utils/workspace.utils.js +26 -0
- package/dist/utils/workspace.utils.test.d.ts +2 -0
- package/dist/utils/workspace.utils.test.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as a, jsx as E } from "react/jsx-runtime";
|
|
2
|
+
import { useState as l, useRef as L, useEffect as B } from "react";
|
|
3
3
|
import { createPortal as O } from "react-dom";
|
|
4
4
|
import { INK_TABLE_PICKER_MAX as n, NUMBER_ONE as A } from "../../../../constants/numbers.js";
|
|
5
5
|
import { INK_TABLE_INSERT_TITLE as C, SPACE_STRING as $ } from "../../../../constants/generals.const.js";
|
|
@@ -10,45 +10,45 @@ import "../../../../constants/openai.const.js";
|
|
|
10
10
|
import "../../../../utils/paste.utils.js";
|
|
11
11
|
import { getToolbarDropdownMenuPosition as G } from "../ToolbarDropdown/ToolbarDropdown.utils.js";
|
|
12
12
|
import { ToolbarButton as H } from "../ToolbarButton/ToolbarButton.js";
|
|
13
|
-
import { TABLE_PICKER_INITIAL_HOVER as N, TABLE_PICKER_EMPTY_POSITION as j, TABLE_PICKER_TIMES_MARK as
|
|
14
|
-
const
|
|
15
|
-
const { icon:
|
|
13
|
+
import { TABLE_PICKER_INITIAL_HOVER as N, TABLE_PICKER_EMPTY_POSITION as j, TABLE_PICKER_TIMES_MARK as w } from "./TableSizePicker.const.js";
|
|
14
|
+
const so = (v) => {
|
|
15
|
+
const { icon: K, disabled: d = !1, onSelect: R } = v, [c, s] = l(!1), [i, m] = l(N), [f, P] = l(j), u = L(null), I = L(null), S = L(null);
|
|
16
16
|
B(() => {
|
|
17
17
|
if (!c) return;
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
P({ top:
|
|
18
|
+
const o = () => {
|
|
19
|
+
const e = G(I.current);
|
|
20
|
+
P({ top: e.top, left: e.left });
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
const t = (
|
|
22
|
+
o();
|
|
23
|
+
const t = (e) => {
|
|
24
24
|
var p, T;
|
|
25
|
-
const _ =
|
|
25
|
+
const _ = e.target;
|
|
26
26
|
(p = u.current) != null && p.contains(_) || (T = S.current) != null && T.contains(_) || s(!1);
|
|
27
|
-
}, r = (
|
|
28
|
-
|
|
27
|
+
}, r = (e) => {
|
|
28
|
+
e.key === b && s(!1);
|
|
29
29
|
};
|
|
30
|
-
return document.addEventListener("mousedown", t), document.addEventListener("keydown", r), window.addEventListener("resize",
|
|
31
|
-
document.removeEventListener("mousedown", t), document.removeEventListener("keydown", r), window.removeEventListener("resize",
|
|
30
|
+
return document.addEventListener("mousedown", t), document.addEventListener("keydown", r), window.addEventListener("resize", o), window.addEventListener("scroll", o, !0), () => {
|
|
31
|
+
document.removeEventListener("mousedown", t), document.removeEventListener("keydown", r), window.removeEventListener("resize", o), window.removeEventListener("scroll", o, !0);
|
|
32
32
|
};
|
|
33
33
|
}, [c]);
|
|
34
|
-
const M = Array.from({ length: n * n }, (
|
|
35
|
-
const r = Math.floor(t / n) + A,
|
|
36
|
-
return { rows: r, cols:
|
|
34
|
+
const M = Array.from({ length: n * n }, (o, t) => {
|
|
35
|
+
const r = Math.floor(t / n) + A, e = t % n + A, _ = r <= i.rows && e <= i.cols;
|
|
36
|
+
return { rows: r, cols: e, isOn: _, key: `${r}-${e}` };
|
|
37
37
|
});
|
|
38
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ a("div", { className: g, ref: u, children: [
|
|
39
39
|
/* @__PURE__ */ E("div", { ref: I, children: /* @__PURE__ */ E(
|
|
40
40
|
H,
|
|
41
41
|
{
|
|
42
|
-
icon:
|
|
42
|
+
icon: K,
|
|
43
43
|
title: C,
|
|
44
|
-
disabled:
|
|
44
|
+
disabled: d,
|
|
45
45
|
onClick: () => {
|
|
46
|
-
|
|
46
|
+
d || (m(N), s((o) => !o));
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
) }),
|
|
50
|
-
c
|
|
51
|
-
/* @__PURE__ */
|
|
50
|
+
c && O(
|
|
51
|
+
/* @__PURE__ */ a(
|
|
52
52
|
"div",
|
|
53
53
|
{
|
|
54
54
|
ref: S,
|
|
@@ -63,33 +63,34 @@ const se = (R) => {
|
|
|
63
63
|
{
|
|
64
64
|
className: Y,
|
|
65
65
|
style: { gridTemplateColumns: `repeat(${n}, 1fr)` },
|
|
66
|
-
children: M.map((
|
|
66
|
+
children: M.map((o) => /* @__PURE__ */ E(
|
|
67
67
|
"button",
|
|
68
68
|
{
|
|
69
69
|
type: "button",
|
|
70
|
-
className: `${U}${
|
|
71
|
-
"aria-label": `${
|
|
72
|
-
onMouseEnter: () =>
|
|
70
|
+
className: `${U}${o.isOn ? `${$}${x}` : ""}`,
|
|
71
|
+
"aria-label": `${o.rows}${w}${o.cols}`,
|
|
72
|
+
onMouseEnter: () => m({ rows: o.rows, cols: o.cols }),
|
|
73
|
+
onMouseMove: () => m({ rows: o.rows, cols: o.cols }),
|
|
73
74
|
onMouseDown: (t) => {
|
|
74
|
-
t.preventDefault(),
|
|
75
|
+
t.preventDefault(), R(o.rows, o.cols), s(!1);
|
|
75
76
|
}
|
|
76
77
|
},
|
|
77
|
-
|
|
78
|
+
o.key
|
|
78
79
|
))
|
|
79
80
|
}
|
|
80
81
|
),
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ a("div", { className: z, children: [
|
|
82
83
|
i.rows,
|
|
83
|
-
|
|
84
|
+
w,
|
|
84
85
|
i.cols
|
|
85
86
|
] })
|
|
86
87
|
]
|
|
87
88
|
}
|
|
88
89
|
),
|
|
89
90
|
document.body
|
|
90
|
-
)
|
|
91
|
+
)
|
|
91
92
|
] });
|
|
92
93
|
};
|
|
93
94
|
export {
|
|
94
|
-
|
|
95
|
+
so as TableSizePicker
|
|
95
96
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),S=require("react-dom"),c=require("../../../../constants/generals.const.cjs"),b=require("../../../../constants/colorMode.const.cjs"),n=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("react");const m=require("../../../../plugins/theme/theme.const.cjs");require("../../../../plugins/host/inkPlugins.cjs");const L=require("../ToolbarButton/ToolbarButton.cjs"),N=require("./hooks/useThemePickerMenu.cjs"),I=u=>{const{icon:a,disabled:i=!1,hint:_,onHint:d,pluginColor:T,value:E,onChange:s}=u,{open:f,setOpen:r,menuPosition:l,rootRef:p,triggerRef:q,menuRef:M}=N.useThemePickerMenu();return o.jsxs("div",{ref:p,children:[o.jsx("div",{ref:q,children:o.jsx(L.ToolbarButton,{icon:a,title:c.INK_THEME_TITLE,hint:_,onHint:d,pluginColor:T,disabled:i,onClick:()=>{i||r(e=>!e)}})}),f&&S.createPortal(o.jsx("div",{ref:M,className:`${n.INK_CLASS_STYLE_MENU} ${n.INK_CLASS_STYLE_MENU_PORTAL} ${n.INK_CLASS_STYLE_MENU_FORCED}`,"data-color-mode":b.COLOR_MODE_LIGHT,role:"listbox","aria-label":c.INK_THEME_TITLE,style:{top:l.top,left:l.left},children:m.INK_THEMES.map(e=>o.jsx("button",{type:"button",role:"option","aria-selected":e.id===E,className:"Ink-Editor__style-option",onMouseDown:t=>{t.preventDefault(),s(e.id),r(!1)},onClick:t=>{t.preventDefault(),s(e.id),r(!1)},children:e.label},e.id))}),document.body)]})};exports.ThemePicker=I;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/ThemePicker/ThemePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ThemePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/ThemePicker/ThemePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAYhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAwD5C,CAAC"}
|
|
@@ -1,81 +1,65 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { COLOR_MODE_LIGHT as g } from "../../../../constants/colorMode.const.js";
|
|
7
|
-
import { KEY_ESCAPE as K } from "../../../../constants/keyboard.const.js";
|
|
8
|
-
import { INK_CLASS_STYLE_MENU as O, INK_CLASS_STYLE_MENU_PORTAL as k, INK_CLASS_STYLE_MENU_FORCED as x } from "../../../../constants/defaults.const.js";
|
|
1
|
+
import { jsxs as L, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { createPortal as N } from "react-dom";
|
|
3
|
+
import { INK_THEME_TITLE as m } from "../../../../constants/generals.const.js";
|
|
4
|
+
import { COLOR_MODE_LIGHT as S } from "../../../../constants/colorMode.const.js";
|
|
5
|
+
import { INK_CLASS_STYLE_MENU as C, INK_CLASS_STYLE_MENU_PORTAL as b, INK_CLASS_STYLE_MENU_FORCED as I } from "../../../../constants/defaults.const.js";
|
|
9
6
|
import "../../../../constants/openai.const.js";
|
|
10
7
|
import "../../../../utils/paste.utils.js";
|
|
11
|
-
import
|
|
8
|
+
import "react";
|
|
9
|
+
import { INK_THEMES as M } from "../../../../plugins/theme/theme.const.js";
|
|
12
10
|
import "../../../../plugins/host/inkPlugins.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
const
|
|
16
|
-
const { icon:
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const o = D(c.current);
|
|
21
|
-
R({ top: o.top, left: o.left });
|
|
22
|
-
};
|
|
23
|
-
e();
|
|
24
|
-
const n = (o) => {
|
|
25
|
-
var p, E;
|
|
26
|
-
const u = o.target;
|
|
27
|
-
(p = m.current) != null && p.contains(u) || (E = a.current) != null && E.contains(u) || t(!1);
|
|
28
|
-
}, f = (o) => {
|
|
29
|
-
o.key === K && t(!1);
|
|
30
|
-
};
|
|
31
|
-
return document.addEventListener("mousedown", n), document.addEventListener("keydown", f), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
32
|
-
document.removeEventListener("mousedown", n), document.removeEventListener("keydown", f), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
33
|
-
};
|
|
34
|
-
}, [i]), /* @__PURE__ */ y("div", { ref: m, children: [
|
|
35
|
-
/* @__PURE__ */ r("div", { ref: c, children: /* @__PURE__ */ r(
|
|
36
|
-
h,
|
|
11
|
+
import { ToolbarButton as v } from "../ToolbarButton/ToolbarButton.js";
|
|
12
|
+
import { useThemePickerMenu as O } from "./hooks/useThemePickerMenu.js";
|
|
13
|
+
const Y = (a) => {
|
|
14
|
+
const { icon: p, disabled: i = !1, hint: f, onHint: s, pluginColor: d, value: c, onChange: n } = a, { open: _, setOpen: r, menuPosition: l, rootRef: u, triggerRef: E, menuRef: T } = O();
|
|
15
|
+
return /* @__PURE__ */ L("div", { ref: u, children: [
|
|
16
|
+
/* @__PURE__ */ e("div", { ref: E, children: /* @__PURE__ */ e(
|
|
17
|
+
v,
|
|
37
18
|
{
|
|
38
|
-
icon:
|
|
39
|
-
title:
|
|
40
|
-
hint:
|
|
41
|
-
onHint:
|
|
42
|
-
pluginColor:
|
|
43
|
-
disabled:
|
|
19
|
+
icon: p,
|
|
20
|
+
title: m,
|
|
21
|
+
hint: f,
|
|
22
|
+
onHint: s,
|
|
23
|
+
pluginColor: d,
|
|
24
|
+
disabled: i,
|
|
44
25
|
onClick: () => {
|
|
45
|
-
|
|
26
|
+
i || r((o) => !o);
|
|
46
27
|
}
|
|
47
28
|
}
|
|
48
29
|
) }),
|
|
49
|
-
|
|
50
|
-
/* @__PURE__ */
|
|
30
|
+
_ && N(
|
|
31
|
+
/* @__PURE__ */ e(
|
|
51
32
|
"div",
|
|
52
33
|
{
|
|
53
|
-
ref:
|
|
54
|
-
className: `${
|
|
55
|
-
"data-color-mode":
|
|
34
|
+
ref: T,
|
|
35
|
+
className: `${C} ${b} ${I}`,
|
|
36
|
+
"data-color-mode": S,
|
|
56
37
|
role: "listbox",
|
|
57
|
-
"aria-label":
|
|
58
|
-
style: { top:
|
|
59
|
-
children:
|
|
38
|
+
"aria-label": m,
|
|
39
|
+
style: { top: l.top, left: l.left },
|
|
40
|
+
children: M.map((o) => /* @__PURE__ */ e(
|
|
60
41
|
"button",
|
|
61
42
|
{
|
|
62
43
|
type: "button",
|
|
63
44
|
role: "option",
|
|
64
|
-
"aria-selected":
|
|
45
|
+
"aria-selected": o.id === c,
|
|
65
46
|
className: "Ink-Editor__style-option",
|
|
66
|
-
onMouseDown: (
|
|
67
|
-
|
|
47
|
+
onMouseDown: (t) => {
|
|
48
|
+
t.preventDefault(), n(o.id), r(!1);
|
|
68
49
|
},
|
|
69
|
-
|
|
50
|
+
onClick: (t) => {
|
|
51
|
+
t.preventDefault(), n(o.id), r(!1);
|
|
52
|
+
},
|
|
53
|
+
children: o.label
|
|
70
54
|
},
|
|
71
|
-
|
|
55
|
+
o.id
|
|
72
56
|
))
|
|
73
57
|
}
|
|
74
58
|
),
|
|
75
59
|
document.body
|
|
76
|
-
)
|
|
60
|
+
)
|
|
77
61
|
] });
|
|
78
62
|
};
|
|
79
63
|
export {
|
|
80
|
-
|
|
64
|
+
Y as ThemePicker
|
|
81
65
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/InkEditor/components/ThemePicker/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),m=require("../../../../../constants/numbers.cjs"),w=require("../../../../../constants/keyboard.const.cjs");require("../../../../../constants/openai.const.cjs");require("react/jsx-runtime");require("../../../../../utils/paste.utils.cjs");require("react-dom");const R=require("../../ToolbarDropdown/ToolbarDropdown.utils.cjs"),p=()=>{const[o,r]=t.useState(!1),[E,v]=t.useState({top:m.NUMBER_ZERO,left:m.NUMBER_ZERO}),s=t.useRef(null),u=t.useRef(null),i=t.useRef(null);return t.useEffect(()=>{if(!o)return;const n=()=>{const e=R.getToolbarDropdownMenuPosition(u.current);v({top:e.top,left:e.left})};n();const c=e=>{var a,f;const l=e.target;(a=s.current)!=null&&a.contains(l)||(f=i.current)!=null&&f.contains(l)||r(!1)},d=e=>{e.key===w.KEY_ESCAPE&&r(!1)};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0)}},[o]),{open:o,setOpen:r,menuPosition:E,rootRef:s,triggerRef:u,menuRef:i}};exports.useThemePickerMenu=p;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface UseThemePickerMenuReturn {
|
|
2
|
+
open: boolean;
|
|
3
|
+
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
4
|
+
menuPosition: {
|
|
5
|
+
top: number;
|
|
6
|
+
left: number;
|
|
7
|
+
};
|
|
8
|
+
rootRef: React.RefObject<HTMLDivElement>;
|
|
9
|
+
triggerRef: React.RefObject<HTMLDivElement>;
|
|
10
|
+
menuRef: React.RefObject<HTMLDivElement>;
|
|
11
|
+
}
|
|
12
|
+
export declare const useThemePickerMenu: () => UseThemePickerMenuReturn;
|
|
13
|
+
//# sourceMappingURL=useThemePickerMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useThemePickerMenu.d.ts","sourceRoot":"","sources":["../../../../../../src/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,YAAY,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACzC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC5C,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;CAC1C;AAED,eAAO,MAAM,kBAAkB,QAAO,wBA0CrC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useState as p, useRef as r, useEffect as w } from "react";
|
|
2
|
+
import { NUMBER_ZERO as a } from "../../../../../constants/numbers.js";
|
|
3
|
+
import { KEY_ESCAPE as L } from "../../../../../constants/keyboard.const.js";
|
|
4
|
+
import "../../../../../constants/openai.const.js";
|
|
5
|
+
import "react/jsx-runtime";
|
|
6
|
+
import "../../../../../utils/paste.utils.js";
|
|
7
|
+
import "react-dom";
|
|
8
|
+
import { getToolbarDropdownMenuPosition as P } from "../../ToolbarDropdown/ToolbarDropdown.utils.js";
|
|
9
|
+
const O = () => {
|
|
10
|
+
const [n, o] = p(!1), [E, v] = p({ top: a, left: a }), s = r(null), i = r(null), u = r(null);
|
|
11
|
+
return w(() => {
|
|
12
|
+
if (!n) return;
|
|
13
|
+
const t = () => {
|
|
14
|
+
const e = P(i.current);
|
|
15
|
+
v({ top: e.top, left: e.left });
|
|
16
|
+
};
|
|
17
|
+
t();
|
|
18
|
+
const c = (e) => {
|
|
19
|
+
var f, l;
|
|
20
|
+
const d = e.target;
|
|
21
|
+
(f = s.current) != null && f.contains(d) || (l = u.current) != null && l.contains(d) || o(!1);
|
|
22
|
+
}, m = (e) => {
|
|
23
|
+
e.key === L && o(!1);
|
|
24
|
+
};
|
|
25
|
+
return document.addEventListener("mousedown", c), document.addEventListener("keydown", m), window.addEventListener("resize", t), window.addEventListener("scroll", t, !0), () => {
|
|
26
|
+
document.removeEventListener("mousedown", c), document.removeEventListener("keydown", m), window.removeEventListener("resize", t), window.removeEventListener("scroll", t, !0);
|
|
27
|
+
};
|
|
28
|
+
}, [n]), {
|
|
29
|
+
open: n,
|
|
30
|
+
setOpen: o,
|
|
31
|
+
menuPosition: E,
|
|
32
|
+
rootRef: s,
|
|
33
|
+
triggerRef: i,
|
|
34
|
+
menuRef: u
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
O as useThemePickerMenu
|
|
39
|
+
};
|
|
@@ -30,4 +30,8 @@ export { GraphEditModal } from './GraphEditModal';
|
|
|
30
30
|
export type { GraphEditModalProps, GraphEditMode } from './GraphEditModal';
|
|
31
31
|
export { ThemePicker } from './ThemePicker';
|
|
32
32
|
export type { ThemePickerProps } from './ThemePicker';
|
|
33
|
+
export { PresenceStack } from './PresenceStack';
|
|
34
|
+
export type { PresenceStackProps } from './PresenceStack';
|
|
35
|
+
export { RemoteCursors } from './RemoteCursors';
|
|
36
|
+
export type { RemoteCursorsProps } from './RemoteCursors';
|
|
33
37
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/InkEditor/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,cAAc,EACd,2BAA2B,EAC3B,gCAAgC,EAChC,mCAAmC,EACnC,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EACL,YAAY,EACZ,8BAA8B,EAC9B,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,0BAA0B,EAC1B,wBAAwB,EACxB,8BAA8B,EAC9B,kCAAkC,EAClC,iCAAiC,EACjC,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/InkEditor/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,cAAc,EACd,2BAA2B,EAC3B,gCAAgC,EAChC,mCAAmC,EACnC,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EACL,YAAY,EACZ,8BAA8B,EAC9B,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,0BAA0B,EAC1B,wBAAwB,EACxB,8BAA8B,EAC9B,kCAAkC,EAClC,iCAAiC,EACjC,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),k=require("react"),v=({documents:o,activeDocumentId:b,onTabSelect:y,onTabClose:c,onTabAdd:d,onTabRename:s,className:j=""})=>{const[h,l]=k.useState(null),[a,u]=k.useState(""),p=(t,n,r)=>{r.stopPropagation(),s&&(l(t),u(n))},x=t=>{h===t&&a.trim()&&(s==null||s(t,a.trim())),l(null)},g=(t,n)=>{n.key==="Enter"?x(t):n.key==="Escape"&&l(null)};return i.jsxs("div",{className:`ink-tabs-container ${j}`.trim(),role:"tablist","aria-label":"Document tabs",children:[i.jsx("div",{className:"ink-tabs-scroll-area",children:o.map(t=>{const n=t.id===b,r=h===t.id;return i.jsxs("div",{role:"tab","aria-selected":n,tabIndex:n?0:-1,className:`ink-tab-item ${n?"ink-tab-active":""} ${t.isDirty?"ink-tab-dirty":""}`,onClick:()=>y(t.id),onDoubleClick:e=>p(t.id,t.title,e),title:t.title,children:[i.jsx("span",{className:"ink-tab-icon","aria-hidden":"true",children:t.icon||i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),i.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),r?i.jsx("input",{type:"text",className:"ink-tab-title-input",value:a,autoFocus:!0,onChange:e=>u(e.target.value),onBlur:()=>x(t.id),onKeyDown:e=>g(t.id,e),onClick:e=>e.stopPropagation()}):i.jsx("span",{className:"ink-tab-title",children:t.title||"Untitled"}),t.isDirty&&i.jsx("span",{className:"ink-tab-dirty-indicator",title:"Unsaved changes","aria-label":"Unsaved changes"}),c&&o.length>1&&i.jsx("button",{type:"button",className:"ink-tab-close-btn","aria-label":`Close ${t.title}`,onClick:e=>{e.stopPropagation(),c(t.id)},children:i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},t.id)})}),d&&i.jsx("button",{type:"button",className:"ink-tab-add-btn","aria-label":"New document",title:"New document",onClick:d,children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})})]})};exports.InkTabs=v;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkTabs.d.ts","sourceRoot":"","sources":["../../../src/components/InkTabs/InkTabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA6H1C,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsxs as l, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b } from "react";
|
|
3
|
+
const f = ({
|
|
4
|
+
documents: c,
|
|
5
|
+
activeDocumentId: y,
|
|
6
|
+
onTabSelect: g,
|
|
7
|
+
onTabClose: d,
|
|
8
|
+
onTabAdd: h,
|
|
9
|
+
onTabRename: a,
|
|
10
|
+
className: m = ""
|
|
11
|
+
}) => {
|
|
12
|
+
const [u, s] = b(null), [r, k] = b(""), v = (t, n, o) => {
|
|
13
|
+
o.stopPropagation(), a && (s(t), k(n));
|
|
14
|
+
}, p = (t) => {
|
|
15
|
+
u === t && r.trim() && (a == null || a(t, r.trim())), s(null);
|
|
16
|
+
}, x = (t, n) => {
|
|
17
|
+
n.key === "Enter" ? p(t) : n.key === "Escape" && s(null);
|
|
18
|
+
};
|
|
19
|
+
return /* @__PURE__ */ l(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: `ink-tabs-container ${m}`.trim(),
|
|
23
|
+
role: "tablist",
|
|
24
|
+
"aria-label": "Document tabs",
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ i("div", { className: "ink-tabs-scroll-area", children: c.map((t) => {
|
|
27
|
+
const n = t.id === y, o = u === t.id;
|
|
28
|
+
return /* @__PURE__ */ l(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
role: "tab",
|
|
32
|
+
"aria-selected": n,
|
|
33
|
+
tabIndex: n ? 0 : -1,
|
|
34
|
+
className: `ink-tab-item ${n ? "ink-tab-active" : ""} ${t.isDirty ? "ink-tab-dirty" : ""}`,
|
|
35
|
+
onClick: () => g(t.id),
|
|
36
|
+
onDoubleClick: (e) => v(t.id, t.title, e),
|
|
37
|
+
title: t.title,
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ i("span", { className: "ink-tab-icon", "aria-hidden": "true", children: t.icon || /* @__PURE__ */ l("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
40
|
+
/* @__PURE__ */ i("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
41
|
+
/* @__PURE__ */ i("polyline", { points: "14 2 14 8 20 8" })
|
|
42
|
+
] }) }),
|
|
43
|
+
o ? /* @__PURE__ */ i(
|
|
44
|
+
"input",
|
|
45
|
+
{
|
|
46
|
+
type: "text",
|
|
47
|
+
className: "ink-tab-title-input",
|
|
48
|
+
value: r,
|
|
49
|
+
autoFocus: !0,
|
|
50
|
+
onChange: (e) => k(e.target.value),
|
|
51
|
+
onBlur: () => p(t.id),
|
|
52
|
+
onKeyDown: (e) => x(t.id, e),
|
|
53
|
+
onClick: (e) => e.stopPropagation()
|
|
54
|
+
}
|
|
55
|
+
) : /* @__PURE__ */ i("span", { className: "ink-tab-title", children: t.title || "Untitled" }),
|
|
56
|
+
t.isDirty && /* @__PURE__ */ i(
|
|
57
|
+
"span",
|
|
58
|
+
{
|
|
59
|
+
className: "ink-tab-dirty-indicator",
|
|
60
|
+
title: "Unsaved changes",
|
|
61
|
+
"aria-label": "Unsaved changes"
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
d && c.length > 1 && /* @__PURE__ */ i(
|
|
65
|
+
"button",
|
|
66
|
+
{
|
|
67
|
+
type: "button",
|
|
68
|
+
className: "ink-tab-close-btn",
|
|
69
|
+
"aria-label": `Close ${t.title}`,
|
|
70
|
+
onClick: (e) => {
|
|
71
|
+
e.stopPropagation(), d(t.id);
|
|
72
|
+
},
|
|
73
|
+
children: /* @__PURE__ */ l("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
74
|
+
/* @__PURE__ */ i("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
75
|
+
/* @__PURE__ */ i("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
76
|
+
] })
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
t.id
|
|
82
|
+
);
|
|
83
|
+
}) }),
|
|
84
|
+
h && /* @__PURE__ */ i(
|
|
85
|
+
"button",
|
|
86
|
+
{
|
|
87
|
+
type: "button",
|
|
88
|
+
className: "ink-tab-add-btn",
|
|
89
|
+
"aria-label": "New document",
|
|
90
|
+
title: "New document",
|
|
91
|
+
onClick: h,
|
|
92
|
+
children: /* @__PURE__ */ l("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
93
|
+
/* @__PURE__ */ i("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
94
|
+
/* @__PURE__ */ i("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
95
|
+
] })
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
f as InkTabs
|
|
104
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/InkTabs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),Z=require("react"),Q=require("../../plugins/theme/theme.const.cjs"),Y=require("../InkTabs/InkTabs.cjs"),A=require("../InkEditor/InkEditor.cjs"),$=require("../InkEditor/components/PresenceStack/PresenceStack.cjs"),z=require("./hooks/useInkWorkspace.cjs"),t=require("./components/WorkspaceIcons.cjs"),b=require("../../constants/numbers.cjs"),W=require("../../constants/generals.const.cjs");require("../../constants/openai.const.cjs");const E=require("../../utils/cn.utils.cjs");require("../../utils/paste.utils.cjs");const i=require("../../common-components/Button/Button.cjs");require("react-dom");const n=require("../../constants/workspace.const.cjs"),J=O=>{const{documents:N,activeDocumentId:h,onActiveDocumentChange:u,onDocumentChange:r,onDocumentDelete:p,onDocumentRename:D,onDocumentSave:S,folders:K=[],onFolderCreate:C,onFolderDelete:R,collaboration:_,editorProps:l={},className:v=W.EMPTY_STRING,style:w}=O,{sidebarOpen:I,setSidebarOpen:y,splitMode:d,setSplitMode:T,setSecondaryDocId:g,searchQuery:B,setSearchQuery:M,editingDocId:q,editTitle:F,setEditTitle:U,activeDocument:o,secondaryDocument:c,filteredDocs:H,handleCreateDocument:x,handleStartRename:L,handleSaveRename:j,handleCancelRename:V}=z.useInkWorkspace(O),[f,X]=Z.useState(l.themeId||Q.THEME_DEFAULT),m=l.themeId??f,P=a=>{var k;X(a),(k=l.onThemeChange)==null||k.call(l,a)};return e.jsxs("div",{className:E.cn("ink-workspace-root",v),style:w,"data-split-mode":d,"data-ink-theme":m,children:[e.jsxs("header",{className:"ink-workspace-header",children:[e.jsxs("div",{className:"ink-workspace-header-left",children:[e.jsx(i.Button,{type:"button",className:"ink-workspace-toggle-btn",onClick:()=>y(!I),title:I?n.INK_WORKSPACE_HIDE_EXPLORER_TITLE:n.INK_WORKSPACE_SHOW_EXPLORER_TITLE,"aria-label":I?n.INK_WORKSPACE_HIDE_EXPLORER_TITLE:n.INK_WORKSPACE_SHOW_EXPLORER_TITLE,children:e.jsx(t.SidebarToggleIcon,{})}),e.jsx("span",{className:"ink-workspace-title",children:n.INK_WORKSPACE_TITLE}),e.jsxs("span",{className:"ink-workspace-count",children:["(",N.length," ",n.INK_WORKSPACE_DOCS_SUFFIX,")"]})]}),e.jsxs("div",{className:"ink-workspace-header-right",children:[e.jsxs("div",{className:"ink-workspace-split-controls",role:"group","aria-label":n.INK_WORKSPACE_SPLIT_VIEW_LABEL,children:[e.jsx(i.Button,{type:"button",className:E.cn("ink-workspace-icon-btn",d===n.INK_SPLIT_MODE_NONE&&"ink-active"),onClick:()=>T(n.INK_SPLIT_MODE_NONE),title:n.INK_WORKSPACE_SINGLE_VIEW_TITLE,children:e.jsx(t.SingleViewIcon,{})}),e.jsx(i.Button,{type:"button",className:E.cn("ink-workspace-icon-btn",d===n.INK_SPLIT_MODE_VERTICAL&&"ink-active"),onClick:()=>T(n.INK_SPLIT_MODE_VERTICAL),title:n.INK_WORKSPACE_SPLIT_SIDE_TITLE,children:e.jsx(t.SplitVerticalIcon,{})}),e.jsx(i.Button,{type:"button",className:E.cn("ink-workspace-icon-btn",d===n.INK_SPLIT_MODE_HORIZONTAL&&"ink-active"),onClick:()=>T(n.INK_SPLIT_MODE_HORIZONTAL),title:n.INK_WORKSPACE_SPLIT_STACKED_TITLE,children:e.jsx(t.SplitHorizontalIcon,{})})]}),S&&o&&e.jsx(i.Button,{type:"button",className:"ink-workspace-icon-btn",onClick:()=>S(o.id),title:n.INK_WORKSPACE_SAVE_TITLE,"aria-label":n.INK_WORKSPACE_SAVE_TITLE,children:e.jsx(t.SaveDocIcon,{})}),(_==null?void 0:_.collaborators)&&e.jsx($.PresenceStack,{collaborators:_.collaborators,maxAvatars:_.maxAvatars})]})]}),e.jsxs("div",{className:"ink-workspace-body",children:[I&&e.jsxs("aside",{className:"ink-workspace-sidebar","aria-label":n.INK_WORKSPACE_TITLE,children:[e.jsxs("div",{className:"ink-workspace-sidebar-toolbar",children:[e.jsx("input",{type:"text",className:"ink-workspace-search-input",placeholder:n.INK_WORKSPACE_SEARCH_PLACEHOLDER,value:B,onChange:a=>M(a.target.value)}),e.jsx(i.Button,{type:"button",className:"ink-workspace-new-doc-btn",onClick:x,title:n.INK_WORKSPACE_NEW_DOC_BUTTON,"aria-label":n.INK_WORKSPACE_NEW_DOC_BUTTON,children:n.INK_WORKSPACE_NEW_DOC_BUTTON}),C&&e.jsx(i.Button,{type:"button",className:"ink-workspace-icon-btn",onClick:()=>C(n.INK_WORKSPACE_NEW_FOLDER),title:n.INK_WORKSPACE_NEW_FOLDER,"aria-label":n.INK_WORKSPACE_NEW_FOLDER,children:e.jsx(t.NewFolderIcon,{})})]}),K.length>b.NUMBER_ZERO&&e.jsx("div",{className:"ink-workspace-folders-section",children:K.map(a=>e.jsxs("div",{className:"ink-workspace-folder-item",children:[e.jsx("span",{className:"ink-doc-icon",children:"📁"}),e.jsx("span",{className:"ink-doc-title",children:a.name}),R&&e.jsx(i.Button,{type:"button",className:"ink-doc-action-btn ink-delete",onClick:()=>R(a.id),title:n.INK_WORKSPACE_CLOSE_FOLDER_BUTTON,"aria-label":n.INK_WORKSPACE_CLOSE_FOLDER_BUTTON,children:n.INK_WORKSPACE_CLOSE_FOLDER_BUTTON})]},a.id))}),e.jsx("div",{className:"ink-workspace-doc-list",role:"tree",children:H.map(a=>{const k=a.id===h,G=q===a.id;return e.jsxs("div",{role:"treeitem","aria-selected":k,className:E.cn("ink-workspace-doc-item",k&&"ink-doc-active"),onClick:()=>u(a.id),children:[e.jsx("span",{className:"ink-doc-icon",children:a.icon||e.jsx(t.FileDocumentIcon,{})}),G?e.jsx("input",{type:"text",className:"ink-doc-title-input",value:F,autoFocus:!0,onChange:s=>U(s.target.value),onBlur:()=>j(a.id),onKeyDown:s=>{s.key==="Enter"&&j(a.id),s.key==="Escape"&&V()},onClick:s=>s.stopPropagation()}):e.jsx("span",{className:"ink-doc-title",onDoubleClick:s=>L(a.id,a.title,s),children:a.title||n.INK_WORKSPACE_UNTITLED_FALLBACK}),a.isDirty&&e.jsx("span",{className:"ink-doc-dirty-dot"}),e.jsxs("div",{className:"ink-doc-actions",children:[e.jsx(i.Button,{type:"button",className:"ink-doc-action-btn",onClick:s=>L(a.id,a.title,s),title:n.INK_WORKSPACE_RENAME_TITLE,"aria-label":n.INK_WORKSPACE_RENAME_TITLE,children:e.jsx(t.RenamePencilIcon,{})}),N.length>b.NUMBER_ONE&&p&&e.jsx(i.Button,{type:"button",className:"ink-doc-action-btn ink-delete",onClick:s=>{s.stopPropagation(),p(a.id)},title:n.INK_WORKSPACE_DELETE_TITLE,"aria-label":n.INK_WORKSPACE_DELETE_TITLE,children:e.jsx(t.CloseCrossIcon,{})})]})]},a.id)})})]}),e.jsxs("main",{className:E.cn("ink-workspace-main-area",`ink-split-${d}`),children:[e.jsxs("section",{className:"ink-workspace-pane ink-primary-pane",children:[e.jsx(Y.InkTabs,{documents:N,activeDocumentId:h,onTabSelect:u,onTabClose:p,onTabAdd:x,onTabRename:D}),o&&e.jsx("div",{className:"ink-workspace-editor-wrapper",children:e.jsx(A.InkEditor,{value:o.content,onChange:a=>r==null?void 0:r(o.id,a),readOnly:o.readOnly,collaboration:_,...l,themeId:m,onThemeChange:P},o.id)})]}),d!==n.INK_SPLIT_MODE_NONE&&e.jsxs("section",{className:"ink-workspace-pane ink-secondary-pane",children:[e.jsxs("div",{className:"ink-secondary-pane-header",children:[e.jsx("span",{className:"ink-secondary-pane-label",children:n.INK_WORKSPACE_SPLIT_VIEW_LABEL}),e.jsx("select",{className:"ink-secondary-pane-select",value:(c==null?void 0:c.id)||W.EMPTY_STRING,onChange:a=>g(a.target.value),"aria-label":n.INK_WORKSPACE_SPLIT_VIEW_LABEL,children:N.map(a=>e.jsx("option",{value:a.id,children:a.title},a.id))})]}),c&&e.jsx("div",{className:"ink-workspace-editor-wrapper",children:e.jsx(A.InkEditor,{value:c.content,onChange:a=>r==null?void 0:r(c.id,a),readOnly:c.readOnly,...l,themeId:m,onThemeChange:P},`sec-${c.id}`)})]})]})]})]})};exports.InkWorkspace=J;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkWorkspace.d.ts","sourceRoot":"","sources":["../../../src/components/InkWorkspace/InkWorkspace.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA6CjD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAsTpD,CAAC"}
|