inplan 0.1.30 → 0.1.31
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.
|
@@ -43230,17 +43230,17 @@ function addSpanComment(doc2, selectedText, fields, span) {
|
|
|
43230
43230
|
if (!range) return null;
|
|
43231
43231
|
const id2 = genId(takenIds(doc2));
|
|
43232
43232
|
const body = wrapSpanWithComment(doc2.body, range.start, range.end, id2);
|
|
43233
|
-
const comment2 = { id: id2, author: fields.author, date: nowIso(), resolved: false, text: fields.text, ...fields.question ? { question: fields.question } : {}, ...fields.agent === false ? { agent: false } : {} };
|
|
43233
|
+
const comment2 = { id: id2, author: fields.author, date: nowIso(), resolved: false, text: fields.text, ...fields.question ? { question: fields.question } : {}, ...fields.agent === false ? { agent: false } : {}, ...fields.mentions?.length ? { mentions: fields.mentions } : {} };
|
|
43234
43234
|
return { doc: { body, comments: [...doc2.comments, comment2] }, id: id2 };
|
|
43235
43235
|
}
|
|
43236
43236
|
function addDocComment(doc2, fields) {
|
|
43237
43237
|
const id2 = genId(takenIds(doc2));
|
|
43238
|
-
const comment2 = { id: id2, anchor: "doc", author: fields.author, date: nowIso(), resolved: false, text: fields.text, ...fields.question ? { question: fields.question } : {}, ...fields.agent === false ? { agent: false } : {} };
|
|
43238
|
+
const comment2 = { id: id2, anchor: "doc", author: fields.author, date: nowIso(), resolved: false, text: fields.text, ...fields.question ? { question: fields.question } : {}, ...fields.agent === false ? { agent: false } : {}, ...fields.mentions?.length ? { mentions: fields.mentions } : {} };
|
|
43239
43239
|
return { doc: { ...doc2, comments: [...doc2.comments, comment2] }, id: id2 };
|
|
43240
43240
|
}
|
|
43241
|
-
function addReply(doc2, parentId, text2, author) {
|
|
43241
|
+
function addReply(doc2, parentId, text2, author, mentions) {
|
|
43242
43242
|
const id2 = genId(takenIds(doc2));
|
|
43243
|
-
const comment2 = { id: id2, parentId, author, date: nowIso(), resolved: false, text: text2 };
|
|
43243
|
+
const comment2 = { id: id2, parentId, author, date: nowIso(), resolved: false, text: text2, ...mentions?.length ? { mentions } : {} };
|
|
43244
43244
|
return { doc: { ...doc2, comments: [...doc2.comments, comment2] }, id: id2 };
|
|
43245
43245
|
}
|
|
43246
43246
|
function addAnswer(doc2, parentId, selected, text2, author) {
|
|
@@ -43982,6 +43982,203 @@ var IconImage = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children:
|
|
|
43982
43982
|
/* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
43983
43983
|
/* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "21 15 16 10 5 21" })
|
|
43984
43984
|
] });
|
|
43985
|
+
function detectMentionTrigger(value, caret) {
|
|
43986
|
+
if (caret < 0 || caret > value.length) return null;
|
|
43987
|
+
const upTo = value.slice(0, caret);
|
|
43988
|
+
const at = upTo.lastIndexOf("@");
|
|
43989
|
+
if (at === -1) return null;
|
|
43990
|
+
const query = upTo.slice(at + 1);
|
|
43991
|
+
if (/[\s@]/.test(query)) return null;
|
|
43992
|
+
const before = upTo[at - 1];
|
|
43993
|
+
if (before !== void 0 && !/\s/.test(before)) return null;
|
|
43994
|
+
return { start: at, query };
|
|
43995
|
+
}
|
|
43996
|
+
function filterMentionCandidates(users, query) {
|
|
43997
|
+
const q2 = query.toLowerCase();
|
|
43998
|
+
const matches = q2 ? users.filter((u2) => u2.email.toLowerCase().includes(q2) || u2.name?.toLowerCase().includes(q2)) : users;
|
|
43999
|
+
return matches.slice(0, 6);
|
|
44000
|
+
}
|
|
44001
|
+
function escapeRegExp(s) {
|
|
44002
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
44003
|
+
}
|
|
44004
|
+
var sharedRosterCache = null;
|
|
44005
|
+
var sharedRosterPromise = null;
|
|
44006
|
+
var rosterGeneration = 0;
|
|
44007
|
+
function resetMentionRoster() {
|
|
44008
|
+
sharedRosterCache = null;
|
|
44009
|
+
sharedRosterPromise = null;
|
|
44010
|
+
rosterGeneration++;
|
|
44011
|
+
}
|
|
44012
|
+
function loadSharedRoster() {
|
|
44013
|
+
if (sharedRosterCache) return Promise.resolve(sharedRosterCache);
|
|
44014
|
+
if (!sharedRosterPromise) {
|
|
44015
|
+
const generation = rosterGeneration;
|
|
44016
|
+
const list2 = hostApi()?.listMentionableUsers?.();
|
|
44017
|
+
sharedRosterPromise = list2 ? list2.then((u2) => {
|
|
44018
|
+
if (generation === rosterGeneration) sharedRosterCache = u2;
|
|
44019
|
+
return u2;
|
|
44020
|
+
}) : Promise.resolve([]);
|
|
44021
|
+
sharedRosterPromise.catch(() => {
|
|
44022
|
+
if (generation === rosterGeneration) sharedRosterPromise = null;
|
|
44023
|
+
});
|
|
44024
|
+
}
|
|
44025
|
+
return sharedRosterPromise;
|
|
44026
|
+
}
|
|
44027
|
+
function useMentionAutocomplete(taRef, text2, setText) {
|
|
44028
|
+
const [users, setUsers] = reactExports.useState(sharedRosterCache);
|
|
44029
|
+
const [open, setOpen] = reactExports.useState(false);
|
|
44030
|
+
const [query, setQuery] = reactExports.useState("");
|
|
44031
|
+
const [activeIndex, setActiveIndex] = reactExports.useState(0);
|
|
44032
|
+
const mentionsRef = reactExports.useRef(/* @__PURE__ */ new Set());
|
|
44033
|
+
const pendingCaretRef = reactExports.useRef(null);
|
|
44034
|
+
const requestedRosterRef = reactExports.useRef(false);
|
|
44035
|
+
const listboxId = reactExports.useId();
|
|
44036
|
+
reactExports.useEffect(() => {
|
|
44037
|
+
if (pendingCaretRef.current == null) return;
|
|
44038
|
+
const caret = pendingCaretRef.current;
|
|
44039
|
+
pendingCaretRef.current = null;
|
|
44040
|
+
taRef.current?.setSelectionRange(caret, caret);
|
|
44041
|
+
}, [text2, taRef]);
|
|
44042
|
+
const candidates = open && users && users.length ? filterMentionCandidates(users, query) : [];
|
|
44043
|
+
const isOpen = open && candidates.length > 0;
|
|
44044
|
+
const sync = reactExports.useCallback(() => {
|
|
44045
|
+
const el2 = taRef.current;
|
|
44046
|
+
if (!el2) {
|
|
44047
|
+
setOpen(false);
|
|
44048
|
+
return;
|
|
44049
|
+
}
|
|
44050
|
+
const trigger = detectMentionTrigger(el2.value, el2.selectionStart ?? el2.value.length);
|
|
44051
|
+
if (!trigger) {
|
|
44052
|
+
setOpen(false);
|
|
44053
|
+
return;
|
|
44054
|
+
}
|
|
44055
|
+
if (users == null) {
|
|
44056
|
+
setOpen(false);
|
|
44057
|
+
if (!requestedRosterRef.current) {
|
|
44058
|
+
requestedRosterRef.current = true;
|
|
44059
|
+
void loadSharedRoster().then(
|
|
44060
|
+
(u2) => setUsers((prev) => prev ?? u2),
|
|
44061
|
+
() => {
|
|
44062
|
+
requestedRosterRef.current = false;
|
|
44063
|
+
}
|
|
44064
|
+
);
|
|
44065
|
+
}
|
|
44066
|
+
return;
|
|
44067
|
+
}
|
|
44068
|
+
if (!users.length) {
|
|
44069
|
+
setOpen(false);
|
|
44070
|
+
return;
|
|
44071
|
+
}
|
|
44072
|
+
setQuery(trigger.query);
|
|
44073
|
+
setActiveIndex(0);
|
|
44074
|
+
setOpen(true);
|
|
44075
|
+
}, [users, taRef]);
|
|
44076
|
+
reactExports.useEffect(() => {
|
|
44077
|
+
if (users) sync();
|
|
44078
|
+
}, [users, sync]);
|
|
44079
|
+
const pick = reactExports.useCallback(
|
|
44080
|
+
(c) => {
|
|
44081
|
+
const el2 = taRef.current;
|
|
44082
|
+
if (!el2) return;
|
|
44083
|
+
const caret = el2.selectionStart ?? el2.value.length;
|
|
44084
|
+
const trigger = detectMentionTrigger(el2.value, caret);
|
|
44085
|
+
if (!trigger) return;
|
|
44086
|
+
const before = el2.value.slice(0, trigger.start);
|
|
44087
|
+
const after = el2.value.slice(caret);
|
|
44088
|
+
const inserted = `@${c.email} `;
|
|
44089
|
+
mentionsRef.current.add(c.email);
|
|
44090
|
+
pendingCaretRef.current = before.length + inserted.length;
|
|
44091
|
+
setText(before + inserted + after);
|
|
44092
|
+
setOpen(false);
|
|
44093
|
+
el2.focus();
|
|
44094
|
+
},
|
|
44095
|
+
[taRef, setText]
|
|
44096
|
+
);
|
|
44097
|
+
const onKeyDown = reactExports.useCallback(
|
|
44098
|
+
(e) => {
|
|
44099
|
+
if (!isOpen) return false;
|
|
44100
|
+
if (e.key === "ArrowDown") {
|
|
44101
|
+
e.preventDefault();
|
|
44102
|
+
setActiveIndex((i) => (i + 1) % candidates.length);
|
|
44103
|
+
return true;
|
|
44104
|
+
}
|
|
44105
|
+
if (e.key === "ArrowUp") {
|
|
44106
|
+
e.preventDefault();
|
|
44107
|
+
setActiveIndex((i) => (i - 1 + candidates.length) % candidates.length);
|
|
44108
|
+
return true;
|
|
44109
|
+
}
|
|
44110
|
+
if (e.key === "Escape") {
|
|
44111
|
+
e.preventDefault();
|
|
44112
|
+
setOpen(false);
|
|
44113
|
+
return true;
|
|
44114
|
+
}
|
|
44115
|
+
if (e.key === "Tab" || e.key === "Enter" && !e.metaKey && !e.ctrlKey) {
|
|
44116
|
+
e.preventDefault();
|
|
44117
|
+
const c = candidates[activeIndex];
|
|
44118
|
+
if (c) pick(c);
|
|
44119
|
+
return true;
|
|
44120
|
+
}
|
|
44121
|
+
return false;
|
|
44122
|
+
},
|
|
44123
|
+
[isOpen, candidates, activeIndex, pick]
|
|
44124
|
+
);
|
|
44125
|
+
const activeMentions = reactExports.useCallback((currentText) => {
|
|
44126
|
+
return Array.from(mentionsRef.current).filter((email) => new RegExp(`(?:^|\\s)@${escapeRegExp(email)}(?=$|\\s|[.,;:!?)\\]])`).test(currentText));
|
|
44127
|
+
}, []);
|
|
44128
|
+
const reset = reactExports.useCallback(() => {
|
|
44129
|
+
mentionsRef.current.clear();
|
|
44130
|
+
setOpen(false);
|
|
44131
|
+
}, []);
|
|
44132
|
+
const optionId = reactExports.useCallback((index) => `${listboxId}-opt-${index}`, [listboxId]);
|
|
44133
|
+
return {
|
|
44134
|
+
/** A trigger word is active. Prefer {@link isOpen} for anything UI-visible (aria-expanded,
|
|
44135
|
+
* aria-controls) — `open` can be true with zero matches (e.g. "@zzz"). */
|
|
44136
|
+
open,
|
|
44137
|
+
/** The dropdown is actually visibly showing candidates. */
|
|
44138
|
+
isOpen,
|
|
44139
|
+
candidates,
|
|
44140
|
+
activeIndex,
|
|
44141
|
+
sync,
|
|
44142
|
+
pick,
|
|
44143
|
+
onKeyDown,
|
|
44144
|
+
activeMentions,
|
|
44145
|
+
reset,
|
|
44146
|
+
setActiveIndex,
|
|
44147
|
+
listboxId,
|
|
44148
|
+
optionId,
|
|
44149
|
+
activeDescendantId: isOpen && candidates[activeIndex] ? optionId(activeIndex) : void 0
|
|
44150
|
+
};
|
|
44151
|
+
}
|
|
44152
|
+
function MentionDropdown({
|
|
44153
|
+
candidates,
|
|
44154
|
+
activeIndex,
|
|
44155
|
+
onPick,
|
|
44156
|
+
onHover,
|
|
44157
|
+
listboxId,
|
|
44158
|
+
optionId
|
|
44159
|
+
}) {
|
|
44160
|
+
if (candidates.length === 0) return null;
|
|
44161
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-mention-dropdown", role: "listbox", id: listboxId, children: candidates.map((c, i) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
44162
|
+
"button",
|
|
44163
|
+
{
|
|
44164
|
+
id: optionId(i),
|
|
44165
|
+
type: "button",
|
|
44166
|
+
role: "option",
|
|
44167
|
+
"aria-selected": i === activeIndex,
|
|
44168
|
+
className: `ap-mention-item${i === activeIndex ? " active" : ""}`,
|
|
44169
|
+
onMouseEnter: () => onHover(i),
|
|
44170
|
+
onMouseDown: (e) => {
|
|
44171
|
+
e.preventDefault();
|
|
44172
|
+
onPick(c);
|
|
44173
|
+
},
|
|
44174
|
+
children: [
|
|
44175
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-mention-email", children: c.email }),
|
|
44176
|
+
c.name && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-mention-name", children: c.name })
|
|
44177
|
+
]
|
|
44178
|
+
},
|
|
44179
|
+
c.email
|
|
44180
|
+
)) });
|
|
44181
|
+
}
|
|
43985
44182
|
function ComposerPopover({
|
|
43986
44183
|
target,
|
|
43987
44184
|
pos,
|
|
@@ -43996,6 +44193,7 @@ function ComposerPopover({
|
|
|
43996
44193
|
const box = reactExports.useRef(null);
|
|
43997
44194
|
const ta2 = reactExports.useRef(null);
|
|
43998
44195
|
const drag = reactExports.useRef(null);
|
|
44196
|
+
const mention = useMentionAutocomplete(ta2, text2, setText);
|
|
43999
44197
|
reactExports.useEffect(() => {
|
|
44000
44198
|
ta2.current?.focus();
|
|
44001
44199
|
}, []);
|
|
@@ -44025,33 +44223,54 @@ function ComposerPopover({
|
|
|
44025
44223
|
el2.style.height = `${Math.min(el2.scrollHeight, 8 * 22)}px`;
|
|
44026
44224
|
};
|
|
44027
44225
|
const submit = () => {
|
|
44028
|
-
if (text2.trim()) onSubmit(text2.trim(), talkToAgent);
|
|
44226
|
+
if (text2.trim()) onSubmit(text2.trim(), talkToAgent, mention.activeMentions(text2));
|
|
44029
44227
|
};
|
|
44030
44228
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-composer ap-composer-float", ref: box, style: { left: p2.x, top: p2.y, right: "auto" }, children: [
|
|
44031
44229
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-composer-head", onMouseDown: (e) => drag.current = { dx: e.clientX - p2.x, dy: e.clientY - p2.y }, children: [
|
|
44032
44230
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-quote", children: target ? t2("composer.on", { target }) : t2("composer.docLevel") }),
|
|
44033
44231
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-drag", title: t2("composer.dragToMove"), children: "⠿" })
|
|
44034
44232
|
] }),
|
|
44035
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
44036
|
-
|
|
44037
|
-
|
|
44038
|
-
|
|
44039
|
-
|
|
44040
|
-
|
|
44041
|
-
|
|
44042
|
-
|
|
44043
|
-
|
|
44044
|
-
|
|
44045
|
-
|
|
44046
|
-
|
|
44047
|
-
|
|
44048
|
-
|
|
44049
|
-
|
|
44050
|
-
|
|
44233
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { position: "relative" }, children: [
|
|
44234
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
44235
|
+
"textarea",
|
|
44236
|
+
{
|
|
44237
|
+
ref: ta2,
|
|
44238
|
+
className: "ap-grow",
|
|
44239
|
+
placeholder: t2("composer.placeholder", { mod: MOD_KEY }),
|
|
44240
|
+
value: text2,
|
|
44241
|
+
disabled,
|
|
44242
|
+
role: "combobox",
|
|
44243
|
+
"aria-expanded": mention.isOpen,
|
|
44244
|
+
"aria-controls": mention.isOpen ? mention.listboxId : void 0,
|
|
44245
|
+
"aria-autocomplete": "list",
|
|
44246
|
+
"aria-activedescendant": mention.activeDescendantId,
|
|
44247
|
+
onChange: (e) => {
|
|
44248
|
+
setText(e.target.value);
|
|
44249
|
+
grow(e.target);
|
|
44250
|
+
mention.sync();
|
|
44251
|
+
},
|
|
44252
|
+
onSelect: () => mention.sync(),
|
|
44253
|
+
onKeyDown: (e) => {
|
|
44254
|
+
if (mention.onKeyDown(e)) return;
|
|
44255
|
+
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
|
|
44256
|
+
e.preventDefault();
|
|
44257
|
+
submit();
|
|
44258
|
+
}
|
|
44051
44259
|
}
|
|
44052
44260
|
}
|
|
44053
|
-
|
|
44054
|
-
|
|
44261
|
+
),
|
|
44262
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
44263
|
+
MentionDropdown,
|
|
44264
|
+
{
|
|
44265
|
+
candidates: mention.candidates,
|
|
44266
|
+
activeIndex: mention.activeIndex,
|
|
44267
|
+
onPick: mention.pick,
|
|
44268
|
+
onHover: mention.setActiveIndex,
|
|
44269
|
+
listboxId: mention.listboxId,
|
|
44270
|
+
optionId: mention.optionId
|
|
44271
|
+
}
|
|
44272
|
+
)
|
|
44273
|
+
] }),
|
|
44055
44274
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-row", children: [
|
|
44056
44275
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "ap-agent-toggle", role: "radiogroup", "aria-label": t2("composer.audience"), children: [
|
|
44057
44276
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -45705,6 +45924,7 @@ function App(props = {}) {
|
|
|
45705
45924
|
const docPathRef = reactExports.useRef("");
|
|
45706
45925
|
const railRef = reactExports.useRef(null);
|
|
45707
45926
|
const editorRef = reactExports.useRef(null);
|
|
45927
|
+
const [pendingFocusCommentId, setPendingFocusCommentId] = reactExports.useState(null);
|
|
45708
45928
|
const autosaveTimer = reactExports.useRef(null);
|
|
45709
45929
|
const history2 = reactExports.useRef([]);
|
|
45710
45930
|
const future = reactExports.useRef([]);
|
|
@@ -45734,9 +45954,10 @@ function App(props = {}) {
|
|
|
45734
45954
|
setStatus(t2("msg.proposedReview"));
|
|
45735
45955
|
};
|
|
45736
45956
|
const commentStore = hostApi().commentStore ?? null;
|
|
45737
|
-
hostApi().load().then(({ content: content2, path, readOnly: ro }) => {
|
|
45957
|
+
hostApi().load().then(({ content: content2, path, readOnly: ro, focusCommentId }) => {
|
|
45738
45958
|
docPathRef.current = path;
|
|
45739
45959
|
setReadOnly(!!ro);
|
|
45960
|
+
setPendingFocusCommentId(focusCommentId ?? null);
|
|
45740
45961
|
const parsed = parse(content2);
|
|
45741
45962
|
const d = commentStore ? { ...parsed, comments: commentStore.list() } : parsed;
|
|
45742
45963
|
setDoc(d);
|
|
@@ -45772,10 +45993,12 @@ function App(props = {}) {
|
|
|
45772
45993
|
hostApi().onAgentMessage?.((msg) => setAgentMessages((prev) => [...prev, msg])),
|
|
45773
45994
|
// Desktop only: the window followed a link to another doc — reset to it (a fresh
|
|
45774
45995
|
// load), clearing any in-flight proposal/turn state, then re-show a parked proposal.
|
|
45775
|
-
hostApi().onNavigated?.(({ content: content2, path, readOnly: ro }) => {
|
|
45996
|
+
hostApi().onNavigated?.(({ content: content2, path, readOnly: ro, focusCommentId }) => {
|
|
45776
45997
|
if (docPathRef.current) historyByDoc.current.set(docPathRef.current, { undo: history2.current, redo: future.current });
|
|
45777
45998
|
docPathRef.current = path;
|
|
45778
45999
|
setReadOnly(!!ro);
|
|
46000
|
+
resetMentionRoster();
|
|
46001
|
+
setPendingFocusCommentId(focusCommentId ?? null);
|
|
45779
46002
|
const parsed = parse(content2);
|
|
45780
46003
|
const d = commentStore ? { ...parsed, comments: commentStore.list() } : parsed;
|
|
45781
46004
|
setDoc(d);
|
|
@@ -46135,7 +46358,7 @@ function App(props = {}) {
|
|
|
46135
46358
|
});
|
|
46136
46359
|
}, [props.onboarding]);
|
|
46137
46360
|
const addComment = reactExports.useCallback(
|
|
46138
|
-
(text2, target, span, question2, talkToAgent = true) => {
|
|
46361
|
+
(text2, target, span, question2, talkToAgent = true, mentions = []) => {
|
|
46139
46362
|
const agent = talkToAgent ? void 0 : false;
|
|
46140
46363
|
const memoPayload = talkToAgent ? {} : { agent: false };
|
|
46141
46364
|
if (target) {
|
|
@@ -46144,7 +46367,7 @@ function App(props = {}) {
|
|
|
46144
46367
|
setStatus(blocker === "overlap" ? t2("topbar.cantOverlap") : t2("msg.cantAnchor"));
|
|
46145
46368
|
return;
|
|
46146
46369
|
}
|
|
46147
|
-
const res = addSpanComment(docRef.current, target, { text: text2, author: userAuthorRef.current, question: question2, agent }, span ?? void 0);
|
|
46370
|
+
const res = addSpanComment(docRef.current, target, { text: text2, author: userAuthorRef.current, question: question2, agent, mentions }, span ?? void 0);
|
|
46148
46371
|
if (!res) {
|
|
46149
46372
|
setStatus(t2("msg.cantAnchor"));
|
|
46150
46373
|
return;
|
|
@@ -46153,7 +46376,7 @@ function App(props = {}) {
|
|
|
46153
46376
|
hostApi().telemetry?.("comment_created", { kind: "span" });
|
|
46154
46377
|
setFocused(res.id);
|
|
46155
46378
|
} else {
|
|
46156
|
-
const res = addDocComment(docRef.current, { text: text2, author: userAuthorRef.current, question: question2, agent });
|
|
46379
|
+
const res = addDocComment(docRef.current, { text: text2, author: userAuthorRef.current, question: question2, agent, mentions });
|
|
46157
46380
|
apply(res.doc, { type: "comment_created", payload: { id: res.id, anchor: "doc", ...memoPayload } });
|
|
46158
46381
|
hostApi().telemetry?.("comment_created", { kind: "doc" });
|
|
46159
46382
|
setFocused(res.id);
|
|
@@ -46517,6 +46740,16 @@ function App(props = {}) {
|
|
|
46517
46740
|
const visible = ordered.filter((o) => showResolvedOrphaned || !o.thread.root.resolved && !o.orphaned);
|
|
46518
46741
|
const resolvedCount = ordered.filter((o) => o.thread.root.resolved).length;
|
|
46519
46742
|
const orphanedCount = ordered.filter((o) => o.orphaned).length;
|
|
46743
|
+
reactExports.useEffect(() => {
|
|
46744
|
+
if (!loaded || !pendingFocusCommentId) return;
|
|
46745
|
+
const id2 = pendingFocusCommentId;
|
|
46746
|
+
setPendingFocusCommentId(null);
|
|
46747
|
+
const c = doc2.comments.find((x2) => x2.id === id2);
|
|
46748
|
+
const rootId = c?.parentId ?? id2;
|
|
46749
|
+
if (!visible.some((o) => o.thread.root.id === rootId)) setShowResolvedOrphaned(true);
|
|
46750
|
+
const raf = requestAnimationFrame(() => focusComment(id2));
|
|
46751
|
+
return () => cancelAnimationFrame(raf);
|
|
46752
|
+
}, [loaded, pendingFocusCommentId, focusComment, doc2.comments, visible]);
|
|
46520
46753
|
const revealTip = resolvedCount > 0 && orphanedCount > 0 ? t2("rail.showResolved", { resolved: resolvedCount, orphaned: orphanedCount }) : resolvedCount > 0 ? t2("rail.showResolvedOnly", { resolved: resolvedCount }) : t2("rail.showOrphanedOnly", { orphaned: orphanedCount });
|
|
46521
46754
|
const selBlocker = reactExports.useMemo(() => {
|
|
46522
46755
|
const sel = window.getSelection();
|
|
@@ -46777,8 +47010,8 @@ function App(props = {}) {
|
|
|
46777
47010
|
target: composer.target,
|
|
46778
47011
|
pos: composer.pos,
|
|
46779
47012
|
disabled: editingLocked,
|
|
46780
|
-
onSubmit: (text2, talkToAgent) => {
|
|
46781
|
-
addComment(text2, composer.target, composer.span, void 0, talkToAgent);
|
|
47013
|
+
onSubmit: (text2, talkToAgent, mentions) => {
|
|
47014
|
+
addComment(text2, composer.target, composer.span, void 0, talkToAgent, mentions);
|
|
46782
47015
|
setComposer(null);
|
|
46783
47016
|
},
|
|
46784
47017
|
onClose: () => setComposer(null)
|
|
@@ -47021,7 +47254,7 @@ function App(props = {}) {
|
|
|
47021
47254
|
synced: syncedCommentId === o.thread.root.id,
|
|
47022
47255
|
disabled: editingLocked,
|
|
47023
47256
|
onFocus: () => focusComment(o.thread.root.id, false, true),
|
|
47024
|
-
onReply: (text2) => apply(addReply(docRef.current, o.thread.root.id, text2, userAuthorRef.current).doc, { type: "comment_created", payload: { parentId: o.thread.root.id } }),
|
|
47257
|
+
onReply: (text2, mentions) => apply(addReply(docRef.current, o.thread.root.id, text2, userAuthorRef.current, mentions).doc, { type: "comment_created", payload: { parentId: o.thread.root.id } }),
|
|
47025
47258
|
onAnswer: (selected, text2) => apply(setAnswer(docRef.current, o.thread.root.id, selected, text2, userAuthorRef.current).doc, { type: "comment_answered", payload: { parentId: o.thread.root.id, selected } }),
|
|
47026
47259
|
onAnswerPending: (p2) => setQuestionPending(o.thread.root.id, p2),
|
|
47027
47260
|
onResolve: (r2) => apply(setResolved(docRef.current, o.thread.root.id, r2), { type: "comment_resolved", payload: { id: o.thread.root.id, resolved: r2 } }),
|
|
@@ -47250,7 +47483,7 @@ function TopBar(props) {
|
|
|
47250
47483
|
)
|
|
47251
47484
|
] });
|
|
47252
47485
|
}
|
|
47253
|
-
var
|
|
47486
|
+
var escapeRegExp2 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
47254
47487
|
function FindReplaceBar({
|
|
47255
47488
|
doc: doc2,
|
|
47256
47489
|
seed,
|
|
@@ -47278,7 +47511,7 @@ function FindReplaceBar({
|
|
|
47278
47511
|
const flags = "g" + (ci2 ? "i" : "");
|
|
47279
47512
|
const out = [];
|
|
47280
47513
|
const scan = (text2, make) => {
|
|
47281
|
-
const re2 = new RegExp(
|
|
47514
|
+
const re2 = new RegExp(escapeRegExp2(find2), flags);
|
|
47282
47515
|
let m2;
|
|
47283
47516
|
while (m2 = re2.exec(text2)) {
|
|
47284
47517
|
out.push(make(m2.index, m2.index + m2[0].length));
|
|
@@ -47314,8 +47547,8 @@ function FindReplaceBar({
|
|
|
47314
47547
|
const replaceAll2 = () => {
|
|
47315
47548
|
if (!find2) return;
|
|
47316
47549
|
const flags = "g" + (ci2 ? "i" : "");
|
|
47317
|
-
const body = inPreview || inEditor ? doc2.body.replace(new RegExp(
|
|
47318
|
-
const comments = inComments ? doc2.comments.map((c) => ({ ...c, text: c.text.replace(new RegExp(
|
|
47550
|
+
const body = inPreview || inEditor ? doc2.body.replace(new RegExp(escapeRegExp2(find2), flags), replace2) : doc2.body;
|
|
47551
|
+
const comments = inComments ? doc2.comments.map((c) => ({ ...c, text: c.text.replace(new RegExp(escapeRegExp2(find2), flags), replace2) })) : doc2.comments;
|
|
47319
47552
|
onApply({ body, comments }, { type: "document_edited", payload: { findReplace: "all" } });
|
|
47320
47553
|
};
|
|
47321
47554
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-find", children: [
|
|
@@ -47551,6 +47784,8 @@ function ThreadCard(props) {
|
|
|
47551
47784
|
const [replying, setReplying] = reactExports.useState(false);
|
|
47552
47785
|
const [editingId, setEditingId] = reactExports.useState(null);
|
|
47553
47786
|
const [editText, setEditText] = reactExports.useState("");
|
|
47787
|
+
const replyTa = reactExports.useRef(null);
|
|
47788
|
+
const replyMention = useMentionAutocomplete(replyTa, replyText, setReplyText);
|
|
47554
47789
|
const [menuOpenId, setMenuOpenId] = reactExports.useState(null);
|
|
47555
47790
|
reactExports.useEffect(() => {
|
|
47556
47791
|
if (!menuOpenId) return;
|
|
@@ -47675,32 +47910,58 @@ function ThreadCard(props) {
|
|
|
47675
47910
|
thread.replies.map((r2) => renderComment(r2, true)),
|
|
47676
47911
|
!replying && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-row ap-thread-actions", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-link", disabled, onClick: () => setReplying(true), children: t2("rail.reply") }) }),
|
|
47677
47912
|
replying && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-reply-box", children: [
|
|
47678
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
47679
|
-
|
|
47680
|
-
|
|
47681
|
-
|
|
47682
|
-
|
|
47683
|
-
|
|
47684
|
-
|
|
47685
|
-
|
|
47686
|
-
|
|
47687
|
-
|
|
47688
|
-
|
|
47689
|
-
|
|
47690
|
-
|
|
47691
|
-
|
|
47913
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { position: "relative" }, children: [
|
|
47914
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47915
|
+
"textarea",
|
|
47916
|
+
{
|
|
47917
|
+
ref: replyTa,
|
|
47918
|
+
className: "ap-grow",
|
|
47919
|
+
placeholder: t2("thread.replyPlaceholder"),
|
|
47920
|
+
value: replyText,
|
|
47921
|
+
disabled,
|
|
47922
|
+
autoFocus: true,
|
|
47923
|
+
role: "combobox",
|
|
47924
|
+
"aria-expanded": replyMention.isOpen,
|
|
47925
|
+
"aria-controls": replyMention.isOpen ? replyMention.listboxId : void 0,
|
|
47926
|
+
"aria-autocomplete": "list",
|
|
47927
|
+
"aria-activedescendant": replyMention.activeDescendantId,
|
|
47928
|
+
onChange: (e) => {
|
|
47929
|
+
setReplyText(e.target.value);
|
|
47930
|
+
replyMention.sync();
|
|
47931
|
+
},
|
|
47932
|
+
onSelect: () => replyMention.sync(),
|
|
47933
|
+
onKeyDown: (e) => {
|
|
47934
|
+
if (replyMention.onKeyDown(e)) return;
|
|
47935
|
+
if ((e.metaKey || e.ctrlKey) && e.key === "Enter" && replyText.trim()) {
|
|
47936
|
+
props.onReply(replyText.trim(), replyMention.activeMentions(replyText));
|
|
47937
|
+
setReplyText("");
|
|
47938
|
+
replyMention.reset();
|
|
47939
|
+
setReplying(false);
|
|
47940
|
+
}
|
|
47692
47941
|
}
|
|
47693
47942
|
}
|
|
47694
|
-
|
|
47695
|
-
|
|
47943
|
+
),
|
|
47944
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47945
|
+
MentionDropdown,
|
|
47946
|
+
{
|
|
47947
|
+
candidates: replyMention.candidates,
|
|
47948
|
+
activeIndex: replyMention.activeIndex,
|
|
47949
|
+
onPick: replyMention.pick,
|
|
47950
|
+
onHover: replyMention.setActiveIndex,
|
|
47951
|
+
listboxId: replyMention.listboxId,
|
|
47952
|
+
optionId: replyMention.optionId
|
|
47953
|
+
}
|
|
47954
|
+
)
|
|
47955
|
+
] }),
|
|
47696
47956
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-row", children: [
|
|
47697
47957
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47698
47958
|
"button",
|
|
47699
47959
|
{
|
|
47700
47960
|
disabled: disabled || !replyText.trim(),
|
|
47701
47961
|
onClick: () => {
|
|
47702
|
-
props.onReply(replyText.trim());
|
|
47962
|
+
props.onReply(replyText.trim(), replyMention.activeMentions(replyText));
|
|
47703
47963
|
setReplyText("");
|
|
47964
|
+
replyMention.reset();
|
|
47704
47965
|
setReplying(false);
|
|
47705
47966
|
},
|
|
47706
47967
|
children: t2("thread.comment")
|
|
@@ -47712,6 +47973,7 @@ function ThreadCard(props) {
|
|
|
47712
47973
|
className: "ap-link",
|
|
47713
47974
|
onClick: () => {
|
|
47714
47975
|
setReplyText("");
|
|
47976
|
+
replyMention.reset();
|
|
47715
47977
|
setReplying(false);
|
|
47716
47978
|
},
|
|
47717
47979
|
children: t2("thread.cancel")
|
|
@@ -462,6 +462,11 @@ input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outlin
|
|
|
462
462
|
::highlight(ap-comment-target) { background: #bcd5cc; color: inherit; }
|
|
463
463
|
/* Preview right-click context menu. */
|
|
464
464
|
.ap-ctxmenu { position: fixed; z-index: 40; display: flex; flex-direction: column; min-width: 168px; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
|
|
465
|
+
.ap-mention-dropdown { position: absolute; top: 100%; left: 0; z-index: 45; margin-top: 4px; width: 260px; max-height: 180px; overflow-y: auto; display: flex; flex-direction: column; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
|
|
466
|
+
.ap-mention-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; font: inherit; text-align: left; background: none; border: 0; border-radius: 6px; padding: 5px 9px; cursor: pointer; color: var(--fg); }
|
|
467
|
+
.ap-mention-item:hover, .ap-mention-item.active { background: var(--accent-soft); color: var(--accent); }
|
|
468
|
+
.ap-mention-email { font-size: 12.5px; }
|
|
469
|
+
.ap-mention-name { font-size: 11px; opacity: 0.7; }
|
|
465
470
|
.ap-ctxmenu-item { font: inherit; text-align: left; background: none; border: 0; border-radius: 6px; padding: 6px 10px; cursor: pointer; color: var(--fg); }
|
|
466
471
|
.ap-ctxmenu-item:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
|
|
467
472
|
.ap-ctxmenu-item:disabled { opacity: 0.4; cursor: default; }
|
package/app/renderer/index.html
CHANGED
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
content="default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' inplan-plugin:; img-src 'self' file: https:; connect-src 'self' inplan-plugin: ws://127.0.0.1:* ws://localhost:*; frame-src https://inplan.ai http://127.0.0.1:* http://localhost:*"
|
|
22
22
|
/>
|
|
23
23
|
<title>inplan</title>
|
|
24
|
-
<script type="module" crossorigin src="./assets/index-
|
|
25
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
24
|
+
<script type="module" crossorigin src="./assets/index-Bw5_Se2f.js"></script>
|
|
25
|
+
<link rel="stylesheet" crossorigin href="./assets/index-CabM852h.css">
|
|
26
26
|
</head>
|
|
27
27
|
<body>
|
|
28
28
|
<div id="root"></div>
|
package/bin/cli.js
CHANGED
|
@@ -9,7 +9,7 @@ import { homedir as homedir7 } from "os";
|
|
|
9
9
|
import { basename as basename3, dirname as dirname10, extname, isAbsolute as isAbsolute2, join as join10, relative as relative4, resolve as resolve3 } from "path";
|
|
10
10
|
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "url";
|
|
11
11
|
|
|
12
|
-
// ../core/dist/chunk-
|
|
12
|
+
// ../core/dist/chunk-JVBKYN5I.js
|
|
13
13
|
function isReply(c) {
|
|
14
14
|
return c.parentId !== void 0;
|
|
15
15
|
}
|