@powerhousedao/knowledge-note 1.0.6 → 1.0.7
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/dist/editors/knowledge-note-editor/components/links-section.d.ts.map +1 -1
- package/dist/editors/knowledge-note-editor/components/links-section.js +18 -2
- package/dist/editors/knowledge-vault/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/knowledge-vault/components/DriveExplorer.js +1 -0
- package/dist/editors/knowledge-vault/components/GraphView.d.ts +1 -0
- package/dist/editors/knowledge-vault/components/GraphView.d.ts.map +1 -1
- package/dist/editors/knowledge-vault/components/GraphView.js +27 -9
- package/dist/editors/moc-editor/editor.d.ts.map +1 -1
- package/dist/editors/moc-editor/editor.js +1 -1
- package/dist/package.json +1 -1
- package/dist/style.css +0 -7
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links-section.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-note-editor/components/links-section.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"links-section.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-note-editor/components/links-section.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACT,MAAM,gEAAgE,CAAC;AAExE,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,CACT,EAAE,EAAE,MAAM,EACV,gBAAgB,EAAE,MAAM,EACxB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,KACf,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;CAC5D,CAAC;AA0BF,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,gBAAgB,GACjB,EAAE,iBAAiB,2CA8FnB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useMemo, useRef, useEffect } from "react";
|
|
3
3
|
import { generateId } from "document-model/core";
|
|
4
|
+
import { setSelectedNode } from "@powerhousedao/reactor-browser";
|
|
4
5
|
import { useKnowledgeNoteDocumentsInSelectedDrive } from "@powerhousedao/knowledge-note/document-models/knowledge-note";
|
|
5
6
|
const LINK_TYPES = [
|
|
6
7
|
"RELATES_TO",
|
|
@@ -59,10 +60,25 @@ export function LinksSection({ links, currentDocId, onAddLink, onRemoveLink, onU
|
|
|
59
60
|
} }, link.id))), isAdding ? (_jsx(AddLinkForm, { docOptions: docOptions, onAdd: handleAdd, onCancel: () => setIsAdding(false) })) : (_jsx("button", { type: "button", onClick: () => setIsAdding(true), className: "w-full rounded-lg border border-dashed border-white/10 py-1.5 text-xs text-gray-500 hover:border-[#cba6f7]/30 hover:text-[#cba6f7]", children: "+ Add link" }))] }));
|
|
60
61
|
}
|
|
61
62
|
function LinkCard({ link, isEditing, allDocOptions, onStartEdit, onCancelEdit, onUpdateLinkType, onRemoveLink, onChangeTarget, }) {
|
|
63
|
+
const editRef = useRef(null);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (!isEditing)
|
|
66
|
+
return;
|
|
67
|
+
function handleClickOutside(e) {
|
|
68
|
+
if (editRef.current && !editRef.current.contains(e.target)) {
|
|
69
|
+
onCancelEdit();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
73
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
74
|
+
}, [isEditing, onCancelEdit]);
|
|
62
75
|
if (isEditing) {
|
|
63
|
-
return (_jsxs("div", { className: "rounded-lg border border-[#cba6f7]/20 bg-[#cba6f7]/5 p-2", children: [_jsx("p", { className: "mb-1.5 text-[10px] font-medium uppercase text-gray-500", children: "Change target document" }), _jsx(DocumentSearch, { options: allDocOptions, onSelect: (doc) => onChangeTarget(doc.id, doc.title), onCancel: onCancelEdit, autoFocus: true })] }));
|
|
76
|
+
return (_jsxs("div", { ref: editRef, className: "rounded-lg border border-[#cba6f7]/20 bg-[#cba6f7]/5 p-2", children: [_jsx("p", { className: "mb-1.5 text-[10px] font-medium uppercase text-gray-500", children: "Change target document" }), _jsx(DocumentSearch, { options: allDocOptions, onSelect: (doc) => onChangeTarget(doc.id, doc.title), onCancel: onCancelEdit, autoFocus: true })] }));
|
|
64
77
|
}
|
|
65
|
-
return (_jsxs("div", { className: "group flex items-center gap-2 rounded-lg border border-white/5 bg-[#1e1e2e] px-3 py-2", children: [_jsx("select", { value: link.linkType ?? "RELATES_TO", onChange: (e) => onUpdateLinkType(link.id, e.target.value), className: `rounded-md border-0 px-2 py-0.5 text-xs font-medium ${LINK_TYPE_COLORS[link.linkType ?? "RELATES_TO"]} bg-transparent`, children: LINK_TYPES.map((lt) => (_jsx("option", { value: lt, children: LINK_TYPE_LABELS[lt] }, lt))) }),
|
|
78
|
+
return (_jsxs("div", { className: "group flex items-center gap-2 rounded-lg border border-white/5 bg-[#1e1e2e] px-3 py-2", children: [_jsx("select", { value: link.linkType ?? "RELATES_TO", onChange: (e) => onUpdateLinkType(link.id, e.target.value), className: `rounded-md border-0 px-2 py-0.5 text-xs font-medium ${LINK_TYPE_COLORS[link.linkType ?? "RELATES_TO"]} bg-transparent`, children: LINK_TYPES.map((lt) => (_jsx("option", { value: lt, children: LINK_TYPE_LABELS[lt] }, lt))) }), _jsxs("button", { type: "button", onClick: () => {
|
|
79
|
+
if (link.targetDocumentId)
|
|
80
|
+
setSelectedNode(link.targetDocumentId);
|
|
81
|
+
}, className: "flex-1 truncate text-left text-sm text-gray-300 hover:text-[#cba6f7] hover:underline", title: `Open: ${link.targetTitle || link.targetDocumentId || "Untitled"}`, children: [link.targetTitle || link.targetDocumentId || "Untitled", _jsxs("svg", { className: "ml-1 inline-block h-3 w-3 opacity-0 group-hover:opacity-50", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6" }), _jsx("polyline", { points: "15 3 21 3 21 9" }), _jsx("line", { x1: "10", y1: "14", x2: "21", y2: "3" })] })] }), _jsx("button", { type: "button", onClick: onStartEdit, className: "text-gray-600 opacity-0 transition-opacity hover:text-[#cba6f7] group-hover:opacity-100", "aria-label": "Change target", title: "Change target document", children: _jsxs("svg", { className: "h-3.5 w-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7" }), _jsx("path", { d: "M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z" })] }) }), _jsx("button", { type: "button", onClick: () => onRemoveLink(link.id), className: "text-gray-600 opacity-0 transition-opacity hover:text-red-400 group-hover:opacity-100", "aria-label": "Remove link", children: "\u00D7" })] }));
|
|
66
82
|
}
|
|
67
83
|
function AddLinkForm({ docOptions, onAdd, onCancel, }) {
|
|
68
84
|
const [selectedDoc, setSelectedDoc] = useState(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-vault/components/DriveExplorer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAmClD,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-vault/components/DriveExplorer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAmClD,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,2CAoXtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphView.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-vault/components/GraphView.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAUzE,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACxB,EAAE,CAAC;IACJ,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,gBAAgB,EAAE,MAAM,CAAC;QACzB,gBAAgB,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B,EAAE,CAAC;IACJ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,GAAG,IAAI,CAAC;AAET,KAAK,OAAO,GAAG;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"GraphView.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-vault/components/GraphView.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAUzE,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE;QACL,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@@ function buildElements(notes, graphState, mocs, tensions) {
|
|
|
184
184
|
}
|
|
185
185
|
// Track existing node IDs for MOC + tension edge targets
|
|
186
186
|
const existingNodeIds = new Set(elements.filter((e) => !e.data.source).map((e) => e.data.id));
|
|
187
|
-
// Add MOC nodes
|
|
187
|
+
// Add MOC nodes + edges (coreIdeas → notes, childRefs → child MOCs)
|
|
188
188
|
if (mocs?.length) {
|
|
189
|
+
// Pre-register MOC IDs so childRef edges between MOCs can resolve
|
|
190
|
+
for (const moc of mocs) {
|
|
191
|
+
existingNodeIds.add(moc.id);
|
|
192
|
+
}
|
|
189
193
|
for (const moc of mocs) {
|
|
190
194
|
elements.push({
|
|
191
195
|
data: {
|
|
@@ -195,7 +199,7 @@ function buildElements(notes, graphState, mocs, tensions) {
|
|
|
195
199
|
noteType: `MOC (${moc.tier ?? "TOPIC"})`,
|
|
196
200
|
description: null,
|
|
197
201
|
topics: [],
|
|
198
|
-
linkCount: moc.coreIdeas.length,
|
|
202
|
+
linkCount: moc.coreIdeas.length + moc.childRefs.length,
|
|
199
203
|
color: MOC_NODE_COLOR,
|
|
200
204
|
isMoc: true,
|
|
201
205
|
},
|
|
@@ -213,6 +217,19 @@ function buildElements(notes, graphState, mocs, tensions) {
|
|
|
213
217
|
});
|
|
214
218
|
}
|
|
215
219
|
}
|
|
220
|
+
for (const childRef of moc.childRefs) {
|
|
221
|
+
if (existingNodeIds.has(childRef)) {
|
|
222
|
+
elements.push({
|
|
223
|
+
data: {
|
|
224
|
+
id: `moc-child-${moc.id}-${childRef}`,
|
|
225
|
+
source: moc.id,
|
|
226
|
+
target: childRef,
|
|
227
|
+
linkType: "CORE_IDEA",
|
|
228
|
+
color: MOC_EDGE_COLOR,
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
216
233
|
}
|
|
217
234
|
}
|
|
218
235
|
// Add tension nodes and edges to involved notes
|
|
@@ -572,16 +589,17 @@ export function GraphView({ notes, graphState, mocs, tensions, }) {
|
|
|
572
589
|
const dx = curr.x - prev.x;
|
|
573
590
|
const dy = curr.y - prev.y;
|
|
574
591
|
mocDragState.set(moc.id(), { x: curr.x, y: curr.y });
|
|
575
|
-
// Move
|
|
592
|
+
// Move CORE_IDEA-connected notes along with the MOC,
|
|
593
|
+
// but skip MOC-to-MOC connections (parent ↔ child MOCs move independently)
|
|
576
594
|
moc.connectedEdges().forEach((edge) => {
|
|
577
595
|
if (edge.data("linkType") !== "CORE_IDEA")
|
|
578
596
|
return;
|
|
579
|
-
const
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
if (
|
|
583
|
-
return; // don't
|
|
584
|
-
|
|
597
|
+
const other = edge.source().id() === moc.id() ? edge.target() : edge.source();
|
|
598
|
+
if (other.grabbed())
|
|
599
|
+
return;
|
|
600
|
+
if (other.data("isMoc"))
|
|
601
|
+
return; // don't drag other MOCs
|
|
602
|
+
other.shift({ x: dx, y: dy });
|
|
585
603
|
});
|
|
586
604
|
});
|
|
587
605
|
// Persist position after manual drag
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/moc-editor/editor.tsx"],"names":[],"mappings":"AAuBA,MAAM,CAAC,OAAO,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/moc-editor/editor.tsx"],"names":[],"mappings":"AAuBA,MAAM,CAAC,OAAO,UAAU,MAAM,4CAgY7B"}
|
|
@@ -58,7 +58,7 @@ export default function Editor() {
|
|
|
58
58
|
backgroundColor: "var(--bai-bg)",
|
|
59
59
|
boxShadow: "0 0 0 1px var(--bai-ring)",
|
|
60
60
|
}, children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("p", { className: "text-xs", style: { color: "var(--bai-text-secondary)" }, children: idea.contextPhrase }), idea.noteRef &&
|
|
61
|
-
(noteTitle ? (_jsxs("button", { type: "button", onClick: () => setSelectedNode(idea.noteRef), className: "mt-0.5 text-[10px] text-left truncate max-w-full transition-colors hover:underline", style: { color: "var(--bai-accent)" }, title: `Open note: ${noteTitle}`, children: [noteTitle, _jsxs("svg", { className: "ml-1 inline h-2.5 w-2.5", style: { color: "var(--bai-text-faint)" }, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6" }), _jsx("path", { d: "M15 3h6v6" }), _jsx("path", { d: "M10 14L21 3" })] })] })) : (
|
|
61
|
+
(noteTitle ? (_jsxs("button", { type: "button", onClick: () => setSelectedNode(idea.noteRef), className: "mt-0.5 text-[10px] text-left truncate max-w-full transition-colors hover:underline", style: { color: "var(--bai-accent)" }, title: `Open note: ${noteTitle}`, children: [noteTitle, _jsxs("svg", { className: "ml-1 inline h-2.5 w-2.5", style: { color: "var(--bai-text-faint)" }, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6" }), _jsx("path", { d: "M15 3h6v6" }), _jsx("path", { d: "M10 14L21 3" })] })] })) : (_jsxs("button", { type: "button", onClick: () => setSelectedNode(idea.noteRef), className: "mt-0.5 text-[10px] font-mono text-left truncate max-w-full transition-colors hover:underline", style: { color: "var(--bai-text-faint)" }, title: `Open document: ${idea.noteRef}`, children: [idea.noteRef.slice(0, 12), "..."] })))] }), _jsx("button", { type: "button", onClick: () => dispatch(actions.removeCoreIdea({ id: idea.id })), className: "opacity-0 hover:text-red-400 group-hover:opacity-100", style: { color: "var(--bai-text-faint)" }, children: "\u00D7" })] }, idea.id));
|
|
62
62
|
}), _jsxs("form", { className: "flex gap-2", onSubmit: (e) => {
|
|
63
63
|
e.preventDefault();
|
|
64
64
|
if (!newIdeaRef.trim() || !newIdeaPhrase.trim())
|
package/dist/package.json
CHANGED
package/dist/style.css
CHANGED
|
@@ -1495,13 +1495,6 @@
|
|
|
1495
1495
|
--tw-outline-style: none;
|
|
1496
1496
|
outline-style: none;
|
|
1497
1497
|
}
|
|
1498
|
-
.group-hover\:inline {
|
|
1499
|
-
&:is(:where(.group):hover *) {
|
|
1500
|
-
@media (hover: hover) {
|
|
1501
|
-
display: inline;
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
1498
|
.group-hover\:text-\[var\(--bai-accent\)\] {
|
|
1506
1499
|
&:is(:where(.group):hover *) {
|
|
1507
1500
|
@media (hover: hover) {
|