@molecule/app-feature-graph-view-solid 0.0.0-stage → 0.0.1-stage
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/LICENSE +202 -0
- package/README.md +10 -2
- package/dist/GraphView.d.ts +23 -0
- package/dist/GraphView.d.ts.map +1 -0
- package/dist/GraphView.jsx +112 -0
- package/dist/GraphView.jsx.map +1 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/layout.d.ts +101 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +239 -0
- package/dist/layout.js.map +1 -0
- package/dist/types.d.ts +80 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +66 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @molecule/app-feature-graph-view-solid
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Force-directed graph view (Obsidian-style) for visualizing note / page linkages
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install @molecule/app-feature-graph-view-solid
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Part of the [Molecule](https://www.molecule.dev) package fleet. This page carries the manifest summary; the full generated documentation ships with the package's first committed version.
|
|
10
|
+
|
|
11
|
+
License: Apache-2.0
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Component } from 'solid-js';
|
|
2
|
+
import type { GraphViewProps } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Force-directed graph view (Obsidian-style).
|
|
5
|
+
*
|
|
6
|
+
* Renders nodes + edges into an SVG, computing positions via a built-in
|
|
7
|
+
* minimal velocity-Verlet simulation. Three layouts are supported —
|
|
8
|
+
* `force` (default), `circular` and `grid` — and either nodes or edges
|
|
9
|
+
* can be overridden via custom renderers.
|
|
10
|
+
*
|
|
11
|
+
* This is the Solid counterpart of `@molecule/app-feature-graph-view-react`:
|
|
12
|
+
* the same props (React names), the same ClassMap tokens, and the same DOM for
|
|
13
|
+
* the same input.
|
|
14
|
+
*
|
|
15
|
+
* Style is driven by `getClassMap()`. Inline styles are reserved for
|
|
16
|
+
* SVG geometry — `transform`, viewBox computation, stroke widths — which
|
|
17
|
+
* classes can't express.
|
|
18
|
+
*
|
|
19
|
+
* @param props - Component props (see {@link GraphViewProps}).
|
|
20
|
+
* @returns The graph-view element.
|
|
21
|
+
*/
|
|
22
|
+
export declare const GraphView: Component<GraphViewProps>;
|
|
23
|
+
//# sourceMappingURL=GraphView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphView.d.ts","sourceRoot":"","sources":["../src/GraphView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAO,MAAM,UAAU,CAAA;AAO9C,OAAO,KAAK,EAAa,cAAc,EAAkB,MAAM,YAAY,CAAA;AA0C3E;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,CAAC,cAAc,CA4H/C,CAAA"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createMemo } from 'solid-js';
|
|
2
|
+
import { useTranslation } from '@molecule/app-solid';
|
|
3
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
4
|
+
import { boundingBox, layoutNodes } from './layout.js';
|
|
5
|
+
/** Default base radius (world units) of an unweighted node. */
|
|
6
|
+
const NODE_RADIUS = 8;
|
|
7
|
+
/**
|
|
8
|
+
* Render the default circle + label for one node. Pulled out so the
|
|
9
|
+
* component stays small.
|
|
10
|
+
*
|
|
11
|
+
* @param node - The positioned node.
|
|
12
|
+
* @param isSelected - Whether the node is currently selected.
|
|
13
|
+
* @returns The default node SVG markup.
|
|
14
|
+
*/
|
|
15
|
+
function defaultNode(node, isSelected) {
|
|
16
|
+
const r = NODE_RADIUS * Math.sqrt(Math.max(0.25, node.weight ?? 1));
|
|
17
|
+
return (<g data-mol-id={`graph-view-node-${node.id}`} data-selected={isSelected ? 'true' : 'false'} transform={`translate(${node.x}, ${node.y})`}>
|
|
18
|
+
<circle r={r} fill="currentColor" opacity={isSelected ? 1 : 0.85} stroke="currentColor" stroke-width={isSelected ? 2 : 0}/>
|
|
19
|
+
<text x={r + 4} y={4} font-size="11" fill="currentColor" opacity={isSelected ? 1 : 0.75} style={{ 'pointer-events': 'none', 'user-select': 'none' }}>
|
|
20
|
+
{node.label}
|
|
21
|
+
</text>
|
|
22
|
+
</g>);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Force-directed graph view (Obsidian-style).
|
|
26
|
+
*
|
|
27
|
+
* Renders nodes + edges into an SVG, computing positions via a built-in
|
|
28
|
+
* minimal velocity-Verlet simulation. Three layouts are supported —
|
|
29
|
+
* `force` (default), `circular` and `grid` — and either nodes or edges
|
|
30
|
+
* can be overridden via custom renderers.
|
|
31
|
+
*
|
|
32
|
+
* This is the Solid counterpart of `@molecule/app-feature-graph-view-react`:
|
|
33
|
+
* the same props (React names), the same ClassMap tokens, and the same DOM for
|
|
34
|
+
* the same input.
|
|
35
|
+
*
|
|
36
|
+
* Style is driven by `getClassMap()`. Inline styles are reserved for
|
|
37
|
+
* SVG geometry — `transform`, viewBox computation, stroke widths — which
|
|
38
|
+
* classes can't express.
|
|
39
|
+
*
|
|
40
|
+
* @param props - Component props (see {@link GraphViewProps}).
|
|
41
|
+
* @returns The graph-view element.
|
|
42
|
+
*/
|
|
43
|
+
export const GraphView = (props) => {
|
|
44
|
+
const cm = getClassMap();
|
|
45
|
+
const { t } = useTranslation();
|
|
46
|
+
// Positions depend only on (nodes, edges, layout, forceOptions), and the
|
|
47
|
+
// simulation is deterministic given a fixed seed — the same computation
|
|
48
|
+
// React memoizes.
|
|
49
|
+
const positioned = createMemo(() => layoutNodes(props.nodes, props.edges, props.layout ?? 'force', props.forceOptions));
|
|
50
|
+
const nodeById = createMemo(() => {
|
|
51
|
+
const m = new Map();
|
|
52
|
+
for (const n of positioned())
|
|
53
|
+
m.set(n.id, n);
|
|
54
|
+
return m;
|
|
55
|
+
});
|
|
56
|
+
// Compute viewBox so the graph always fits the SVG bounds, regardless of
|
|
57
|
+
// the world-space size produced by the layout.
|
|
58
|
+
const viewBox = createMemo(() => {
|
|
59
|
+
const box = boundingBox(positioned(), 40);
|
|
60
|
+
return box
|
|
61
|
+
? `${box.minX} ${box.minY} ${Math.max(1, box.maxX - box.minX)} ${Math.max(1, box.maxY - box.minY)}`
|
|
62
|
+
: '-100 -100 200 200';
|
|
63
|
+
});
|
|
64
|
+
const ariaLabel = () => t('graphView.aria.canvas', {}, { defaultValue: 'Graph view' });
|
|
65
|
+
const emptyLabel = () => t('graphView.empty', {}, { defaultValue: 'No nodes to display' });
|
|
66
|
+
/**
|
|
67
|
+
* One edge: a custom renderer's nodes inside a per-edge group, or the
|
|
68
|
+
* default `<line>`. An edge whose endpoints are missing renders nothing.
|
|
69
|
+
*
|
|
70
|
+
* @param edge - The edge.
|
|
71
|
+
* @returns The edge's element, or null when an endpoint is missing.
|
|
72
|
+
*/
|
|
73
|
+
const renderEdge = (edge) => {
|
|
74
|
+
const src = nodeById().get(edge.source);
|
|
75
|
+
const tgt = nodeById().get(edge.target);
|
|
76
|
+
if (!src || !tgt)
|
|
77
|
+
return null;
|
|
78
|
+
if (props.edgeRenderer)
|
|
79
|
+
return <g data-mol-id={`graph-view-edge-${edge.id}`}>{props.edgeRenderer(edge, src, tgt)}</g>;
|
|
80
|
+
return (<line data-mol-id={`graph-view-edge-${edge.id}`} x1={src.x} y1={src.y} x2={tgt.x} y2={tgt.y} stroke="currentColor" stroke-width={1} opacity={0.4}/>);
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* One node's keyboard-activatable hit group, containing the custom
|
|
84
|
+
* renderer's node or the default circle + label.
|
|
85
|
+
*
|
|
86
|
+
* @param node - The positioned node.
|
|
87
|
+
* @returns The node's hit-group element.
|
|
88
|
+
*/
|
|
89
|
+
const renderNode = (node) => {
|
|
90
|
+
const isSelected = () => node.id === props.selectedNodeId;
|
|
91
|
+
return (<g data-mol-id={`graph-view-node-hit-${node.id}`} role="button" aria-label={t('graphView.aria.node', { label: node.label }, { defaultValue: 'Node {{label}}' })} tabindex={0} onClick={() => props.onNodeClick?.(node)} onKeyDown={(event) => {
|
|
92
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
props.onNodeClick?.(node);
|
|
95
|
+
}
|
|
96
|
+
}} style={{
|
|
97
|
+
cursor: props.onNodeClick ? 'pointer' : 'default',
|
|
98
|
+
outline: 'none',
|
|
99
|
+
}}>
|
|
100
|
+
{props.nodeRenderer ? props.nodeRenderer(node) : defaultNode(node, isSelected())}
|
|
101
|
+
</g>);
|
|
102
|
+
};
|
|
103
|
+
return (<div role="application" aria-label={ariaLabel()} data-mol-id="graph-view" class={cm.cn(cm.position('relative'), cm.surfaceSecondary, props.className)} style={{ width: '100%', height: '100%', overflow: 'hidden' }}>
|
|
104
|
+
{positioned().length === 0 ? (<div data-mol-id="graph-view-empty" role="status" class={cm.cn(cm.position('absolute'), cm.sp('p', 6))} style={{ inset: '0px', display: 'grid', 'place-items': 'center' }}>
|
|
105
|
+
{emptyLabel()}
|
|
106
|
+
</div>) : (<svg data-mol-id="graph-view-svg" width="100%" height="100%" viewBox={viewBox()} preserveAspectRatio="xMidYMid meet" style={{ display: 'block' }}>
|
|
107
|
+
<g data-mol-id="graph-view-edges">{props.edges.map(renderEdge)}</g>
|
|
108
|
+
<g data-mol-id="graph-view-nodes">{positioned().map(renderNode)}</g>
|
|
109
|
+
</svg>)}
|
|
110
|
+
</div>);
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=GraphView.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphView.jsx","sourceRoot":"","sources":["../src/GraphView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGtD,+DAA+D;AAC/D,MAAM,WAAW,GAAG,CAAC,CAAA;AAErB;;;;;;;GAOG;AACH,SAAS,WAAW,CAAC,IAAoB,EAAE,UAAmB;IAC5D,MAAM,CAAC,GAAG,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAA;IACnE,OAAO,CACL,CAAC,CAAC,CACA,WAAW,CAAC,CAAC,mBAAmB,IAAI,CAAC,EAAE,EAAE,CAAC,CAC1C,aAAa,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAC7C,SAAS,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAE7C;MAAA,CAAC,MAAM,CACL,CAAC,CAAC,CAAC,CAAC,CAAC,CACL,IAAI,CAAC,cAAc,CACnB,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAC/B,M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C,gBAAgB,CAC5B,KAAK,CAAC,MAAM,CACZ,MAAM,CAAC,MAAM,CACb,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,CACnB,mBAAmB,CAAC,eAAe,CACnC,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAE5B;UAAA,CAAC,CAAC,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAClE;UAAA,CAAC,CAAC,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CACrE;QAAA,EAAE,GAAG,CAAC,CACP,CACH;IAAA,EAAE,GAAG,CAAC,CACP,CAAA;AACH,CAAC,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solid force-directed graph view (Obsidian-style) — the Solid counterpart of
|
|
3
|
+
* `@molecule/app-feature-graph-view-react`: the same exports, the same props
|
|
4
|
+
* (React names), and the same DOM for the same input.
|
|
5
|
+
*
|
|
6
|
+
* Exports:
|
|
7
|
+
* - `<GraphView>` — top-level node-and-edge visualization with built-in
|
|
8
|
+
* `force`, `circular`, and `grid` layouts, click + selection support,
|
|
9
|
+
* and pluggable node / edge renderers.
|
|
10
|
+
* - `GraphNode`, `GraphEdge`, `GraphLayout`, `GraphPoint`, `PositionedNode`,
|
|
11
|
+
* `GraphNodeRenderer`, `GraphEdgeRenderer`, `GraphViewProps` types.
|
|
12
|
+
* - Pure layout helpers (`forceLayout`, `circularLayout`, `gridLayout`,
|
|
13
|
+
* `layoutNodes`, `boundingBox`, `createRng`).
|
|
14
|
+
*
|
|
15
|
+
* Used by note-taking and other apps to visualize page / note linkages
|
|
16
|
+
* the same way Obsidian does — a force-directed map of which notes link
|
|
17
|
+
* to which.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* import { GraphView, type GraphEdge, type GraphNode } from '@molecule/app-feature-graph-view-solid'
|
|
22
|
+
*
|
|
23
|
+
* export function NoteGraph(props: { notes: Note[]; links: Link[] }) {
|
|
24
|
+
* const nodes = (): GraphNode[] =>
|
|
25
|
+
* props.notes.map((n) => ({ id: n.id, label: n.title, weight: n.linkCount }))
|
|
26
|
+
* const edges = (): GraphEdge[] =>
|
|
27
|
+
* props.links.map((l) => ({ id: l.id, source: l.from, target: l.to }))
|
|
28
|
+
* return <GraphView nodes={nodes()} edges={edges()} onNodeClick={(n) => open(n.id)} />
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* The root element fills 100% of its parent — the PARENT must have an
|
|
34
|
+
* explicit height (e.g. a fixed-height panel or a flex/grid track) or
|
|
35
|
+
* the graph renders zero-tall and appears blank.
|
|
36
|
+
*
|
|
37
|
+
* Interaction surface is click / keyboard-activate + `selectedNodeId`
|
|
38
|
+
* highlighting only. Nodes are NOT draggable and there is no built-in
|
|
39
|
+
* pan / zoom — the SVG `viewBox` auto-fits the layout bounds. For a
|
|
40
|
+
* pannable / zoomable surface, compose with
|
|
41
|
+
* `@molecule/app-feature-canvas-solid` instead.
|
|
42
|
+
*
|
|
43
|
+
* Layout is deterministic (seeded RNG), computed once per
|
|
44
|
+
* `(nodes, edges, layout, forceOptions)` change. `forceOptions` is
|
|
45
|
+
* ignored by the `circular` and `grid` layouts.
|
|
46
|
+
*
|
|
47
|
+
* @module
|
|
48
|
+
*/
|
|
49
|
+
export * from './GraphView.jsx';
|
|
50
|
+
export * from './layout.js';
|
|
51
|
+
export * from './types.js';
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solid force-directed graph view (Obsidian-style) — the Solid counterpart of
|
|
3
|
+
* `@molecule/app-feature-graph-view-react`: the same exports, the same props
|
|
4
|
+
* (React names), and the same DOM for the same input.
|
|
5
|
+
*
|
|
6
|
+
* Exports:
|
|
7
|
+
* - `<GraphView>` — top-level node-and-edge visualization with built-in
|
|
8
|
+
* `force`, `circular`, and `grid` layouts, click + selection support,
|
|
9
|
+
* and pluggable node / edge renderers.
|
|
10
|
+
* - `GraphNode`, `GraphEdge`, `GraphLayout`, `GraphPoint`, `PositionedNode`,
|
|
11
|
+
* `GraphNodeRenderer`, `GraphEdgeRenderer`, `GraphViewProps` types.
|
|
12
|
+
* - Pure layout helpers (`forceLayout`, `circularLayout`, `gridLayout`,
|
|
13
|
+
* `layoutNodes`, `boundingBox`, `createRng`).
|
|
14
|
+
*
|
|
15
|
+
* Used by note-taking and other apps to visualize page / note linkages
|
|
16
|
+
* the same way Obsidian does — a force-directed map of which notes link
|
|
17
|
+
* to which.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* import { GraphView, type GraphEdge, type GraphNode } from '@molecule/app-feature-graph-view-solid'
|
|
22
|
+
*
|
|
23
|
+
* export function NoteGraph(props: { notes: Note[]; links: Link[] }) {
|
|
24
|
+
* const nodes = (): GraphNode[] =>
|
|
25
|
+
* props.notes.map((n) => ({ id: n.id, label: n.title, weight: n.linkCount }))
|
|
26
|
+
* const edges = (): GraphEdge[] =>
|
|
27
|
+
* props.links.map((l) => ({ id: l.id, source: l.from, target: l.to }))
|
|
28
|
+
* return <GraphView nodes={nodes()} edges={edges()} onNodeClick={(n) => open(n.id)} />
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* The root element fills 100% of its parent — the PARENT must have an
|
|
34
|
+
* explicit height (e.g. a fixed-height panel or a flex/grid track) or
|
|
35
|
+
* the graph renders zero-tall and appears blank.
|
|
36
|
+
*
|
|
37
|
+
* Interaction surface is click / keyboard-activate + `selectedNodeId`
|
|
38
|
+
* highlighting only. Nodes are NOT draggable and there is no built-in
|
|
39
|
+
* pan / zoom — the SVG `viewBox` auto-fits the layout bounds. For a
|
|
40
|
+
* pannable / zoomable surface, compose with
|
|
41
|
+
* `@molecule/app-feature-canvas-solid` instead.
|
|
42
|
+
*
|
|
43
|
+
* Layout is deterministic (seeded RNG), computed once per
|
|
44
|
+
* `(nodes, edges, layout, forceOptions)` change. `forceOptions` is
|
|
45
|
+
* ignored by the `circular` and `grid` layouts.
|
|
46
|
+
*
|
|
47
|
+
* @module
|
|
48
|
+
*/
|
|
49
|
+
export * from './GraphView.jsx';
|
|
50
|
+
export * from './layout.js';
|
|
51
|
+
export * from './types.js';
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
|
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { GraphEdge, GraphLayout, GraphNode, PositionedNode } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Pure (framework-free) layout helpers for `<GraphView>`. Extracted so the
|
|
4
|
+
* math is unit-testable without a component library or jsdom.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
/** Default cap on force-layout iterations. */
|
|
9
|
+
export declare const DEFAULT_FORCE_ITERATIONS = 200;
|
|
10
|
+
/** Default repulsion strength used by `forceLayout`. */
|
|
11
|
+
export declare const DEFAULT_REPULSION = 800;
|
|
12
|
+
/** Default spring stiffness used by `forceLayout`. */
|
|
13
|
+
export declare const DEFAULT_SPRING = 0.05;
|
|
14
|
+
/** Default ideal edge length used by `forceLayout`. */
|
|
15
|
+
export declare const DEFAULT_REST_LENGTH = 80;
|
|
16
|
+
/** Default velocity damping used by `forceLayout`. */
|
|
17
|
+
export declare const DEFAULT_DAMPING = 0.85;
|
|
18
|
+
/** Convergence threshold (max per-node displacement squared). */
|
|
19
|
+
export declare const CONVERGENCE_EPSILON = 0.01;
|
|
20
|
+
/** Force-layout tunables. */
|
|
21
|
+
export interface ForceLayoutOptions {
|
|
22
|
+
/** Hard cap on iterations. Defaults to {@link DEFAULT_FORCE_ITERATIONS}. */
|
|
23
|
+
iterations?: number;
|
|
24
|
+
/** Repulsive constant between every pair of nodes. */
|
|
25
|
+
repulsion?: number;
|
|
26
|
+
/** Spring (Hooke) constant for edges. */
|
|
27
|
+
spring?: number;
|
|
28
|
+
/** Ideal edge length (rest distance). */
|
|
29
|
+
restLength?: number;
|
|
30
|
+
/** Velocity damping per step (0–1). */
|
|
31
|
+
damping?: number;
|
|
32
|
+
/** Optional deterministic seed (for tests). Defaults to a fixed value. */
|
|
33
|
+
seed?: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Tiny deterministic PRNG (mulberry32). Allows reproducible initial
|
|
37
|
+
* positions in tests without depending on `Math.random()`.
|
|
38
|
+
*
|
|
39
|
+
* @param seed - 32-bit unsigned seed.
|
|
40
|
+
* @returns A function returning floats in `[0, 1)`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function createRng(seed: number): () => number;
|
|
43
|
+
/**
|
|
44
|
+
* Place nodes evenly around the unit circle (scaled by `radius`).
|
|
45
|
+
*
|
|
46
|
+
* @param nodes - Nodes to position.
|
|
47
|
+
* @param radius - Circle radius in world units.
|
|
48
|
+
* @returns Positioned nodes, in input order.
|
|
49
|
+
*/
|
|
50
|
+
export declare function circularLayout(nodes: GraphNode[], radius: number): PositionedNode[];
|
|
51
|
+
/**
|
|
52
|
+
* Place nodes on a square-ish grid, centred on the origin.
|
|
53
|
+
*
|
|
54
|
+
* @param nodes - Nodes to position.
|
|
55
|
+
* @param spacing - Pixel spacing between adjacent grid cells.
|
|
56
|
+
* @returns Positioned nodes, in input order.
|
|
57
|
+
*/
|
|
58
|
+
export declare function gridLayout(nodes: GraphNode[], spacing: number): PositionedNode[];
|
|
59
|
+
/**
|
|
60
|
+
* Run a minimal velocity-Verlet force-directed simulation.
|
|
61
|
+
*
|
|
62
|
+
* Implements:
|
|
63
|
+
* - Pairwise repulsion (Coulomb-like, O(n²)) between every node pair.
|
|
64
|
+
* - Spring (Hooke) attraction along each edge toward `restLength`.
|
|
65
|
+
* - Per-step velocity damping for stability.
|
|
66
|
+
*
|
|
67
|
+
* Stops early once the maximum per-node displacement-squared drops below
|
|
68
|
+
* {@link CONVERGENCE_EPSILON}, or after `iterations` steps — whichever
|
|
69
|
+
* comes first.
|
|
70
|
+
*
|
|
71
|
+
* @param nodes - Nodes to lay out.
|
|
72
|
+
* @param edges - Edges (used only for attractive springs).
|
|
73
|
+
* @param options - Force-layout tunables.
|
|
74
|
+
* @returns Positioned nodes, in input order.
|
|
75
|
+
*/
|
|
76
|
+
export declare function forceLayout(nodes: GraphNode[], edges: GraphEdge[], options?: ForceLayoutOptions): PositionedNode[];
|
|
77
|
+
/**
|
|
78
|
+
* Compute world-space positions for every node using the chosen layout.
|
|
79
|
+
*
|
|
80
|
+
* @param nodes - Nodes to position.
|
|
81
|
+
* @param edges - Edges (consumed only by `force`).
|
|
82
|
+
* @param layout - Layout strategy.
|
|
83
|
+
* @param options - Optional force-layout tunables (ignored for non-force).
|
|
84
|
+
* @returns Positioned nodes.
|
|
85
|
+
*/
|
|
86
|
+
export declare function layoutNodes(nodes: GraphNode[], edges: GraphEdge[], layout: GraphLayout, options?: ForceLayoutOptions): PositionedNode[];
|
|
87
|
+
/**
|
|
88
|
+
* Compute the world-space bounding box of a set of positioned nodes,
|
|
89
|
+
* with a small padding for visual breathing room.
|
|
90
|
+
*
|
|
91
|
+
* @param nodes - Positioned nodes.
|
|
92
|
+
* @param padding - Padding (world units) added to every side. Default 40.
|
|
93
|
+
* @returns Bounding box `{ minX, minY, maxX, maxY }` — or `null` if empty.
|
|
94
|
+
*/
|
|
95
|
+
export declare function boundingBox(nodes: PositionedNode[], padding?: number): {
|
|
96
|
+
minX: number;
|
|
97
|
+
minY: number;
|
|
98
|
+
maxX: number;
|
|
99
|
+
maxY: number;
|
|
100
|
+
} | null;
|
|
101
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEnF;;;;;GAKG;AAEH,8CAA8C;AAC9C,eAAO,MAAM,wBAAwB,MAAM,CAAA;AAE3C,wDAAwD;AACxD,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC,sDAAsD;AACtD,eAAO,MAAM,cAAc,OAAO,CAAA;AAElC,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC,sDAAsD;AACtD,eAAO,MAAM,eAAe,OAAO,CAAA;AAEnC,iEAAiE;AACjE,eAAO,MAAM,mBAAmB,OAAO,CAAA;AAEvC,6BAA6B;AAC7B,MAAM,WAAW,kBAAkB;IACjC,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,MAAM,CASpD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,EAAE,CAOnF;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,EAAE,CAWhF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,EAAE,EAClB,KAAK,EAAE,SAAS,EAAE,EAClB,OAAO,GAAE,kBAAuB,GAC/B,cAAc,EAAE,CA0GlB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,EAAE,EAClB,KAAK,EAAE,SAAS,EAAE,EAClB,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,cAAc,EAAE,CAUlB;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,SAAK,GACX;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAanE"}
|
package/dist/layout.js
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure (framework-free) layout helpers for `<GraphView>`. Extracted so the
|
|
3
|
+
* math is unit-testable without a component library or jsdom.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
/** Default cap on force-layout iterations. */
|
|
8
|
+
export const DEFAULT_FORCE_ITERATIONS = 200;
|
|
9
|
+
/** Default repulsion strength used by `forceLayout`. */
|
|
10
|
+
export const DEFAULT_REPULSION = 800;
|
|
11
|
+
/** Default spring stiffness used by `forceLayout`. */
|
|
12
|
+
export const DEFAULT_SPRING = 0.05;
|
|
13
|
+
/** Default ideal edge length used by `forceLayout`. */
|
|
14
|
+
export const DEFAULT_REST_LENGTH = 80;
|
|
15
|
+
/** Default velocity damping used by `forceLayout`. */
|
|
16
|
+
export const DEFAULT_DAMPING = 0.85;
|
|
17
|
+
/** Convergence threshold (max per-node displacement squared). */
|
|
18
|
+
export const CONVERGENCE_EPSILON = 0.01;
|
|
19
|
+
/**
|
|
20
|
+
* Tiny deterministic PRNG (mulberry32). Allows reproducible initial
|
|
21
|
+
* positions in tests without depending on `Math.random()`.
|
|
22
|
+
*
|
|
23
|
+
* @param seed - 32-bit unsigned seed.
|
|
24
|
+
* @returns A function returning floats in `[0, 1)`.
|
|
25
|
+
*/
|
|
26
|
+
export function createRng(seed) {
|
|
27
|
+
let s = seed >>> 0;
|
|
28
|
+
return function rand() {
|
|
29
|
+
s = (s + 0x6d2b79f5) >>> 0;
|
|
30
|
+
let t = s;
|
|
31
|
+
t = Math.imul(t ^ (t >>> 15), t | 1);
|
|
32
|
+
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
|
|
33
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Place nodes evenly around the unit circle (scaled by `radius`).
|
|
38
|
+
*
|
|
39
|
+
* @param nodes - Nodes to position.
|
|
40
|
+
* @param radius - Circle radius in world units.
|
|
41
|
+
* @returns Positioned nodes, in input order.
|
|
42
|
+
*/
|
|
43
|
+
export function circularLayout(nodes, radius) {
|
|
44
|
+
if (nodes.length === 0)
|
|
45
|
+
return [];
|
|
46
|
+
if (nodes.length === 1)
|
|
47
|
+
return [{ ...nodes[0], x: 0, y: 0 }];
|
|
48
|
+
return nodes.map((n, i) => {
|
|
49
|
+
const angle = (i / nodes.length) * Math.PI * 2;
|
|
50
|
+
return { ...n, x: Math.cos(angle) * radius, y: Math.sin(angle) * radius };
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Place nodes on a square-ish grid, centred on the origin.
|
|
55
|
+
*
|
|
56
|
+
* @param nodes - Nodes to position.
|
|
57
|
+
* @param spacing - Pixel spacing between adjacent grid cells.
|
|
58
|
+
* @returns Positioned nodes, in input order.
|
|
59
|
+
*/
|
|
60
|
+
export function gridLayout(nodes, spacing) {
|
|
61
|
+
if (nodes.length === 0)
|
|
62
|
+
return [];
|
|
63
|
+
const cols = Math.max(1, Math.ceil(Math.sqrt(nodes.length)));
|
|
64
|
+
const rows = Math.ceil(nodes.length / cols);
|
|
65
|
+
const offsetX = ((cols - 1) * spacing) / 2;
|
|
66
|
+
const offsetY = ((rows - 1) * spacing) / 2;
|
|
67
|
+
return nodes.map((n, i) => {
|
|
68
|
+
const col = i % cols;
|
|
69
|
+
const row = Math.floor(i / cols);
|
|
70
|
+
return { ...n, x: col * spacing - offsetX, y: row * spacing - offsetY };
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Run a minimal velocity-Verlet force-directed simulation.
|
|
75
|
+
*
|
|
76
|
+
* Implements:
|
|
77
|
+
* - Pairwise repulsion (Coulomb-like, O(n²)) between every node pair.
|
|
78
|
+
* - Spring (Hooke) attraction along each edge toward `restLength`.
|
|
79
|
+
* - Per-step velocity damping for stability.
|
|
80
|
+
*
|
|
81
|
+
* Stops early once the maximum per-node displacement-squared drops below
|
|
82
|
+
* {@link CONVERGENCE_EPSILON}, or after `iterations` steps — whichever
|
|
83
|
+
* comes first.
|
|
84
|
+
*
|
|
85
|
+
* @param nodes - Nodes to lay out.
|
|
86
|
+
* @param edges - Edges (used only for attractive springs).
|
|
87
|
+
* @param options - Force-layout tunables.
|
|
88
|
+
* @returns Positioned nodes, in input order.
|
|
89
|
+
*/
|
|
90
|
+
export function forceLayout(nodes, edges, options = {}) {
|
|
91
|
+
const iterations = options.iterations ?? DEFAULT_FORCE_ITERATIONS;
|
|
92
|
+
const repulsion = options.repulsion ?? DEFAULT_REPULSION;
|
|
93
|
+
const spring = options.spring ?? DEFAULT_SPRING;
|
|
94
|
+
const restLength = options.restLength ?? DEFAULT_REST_LENGTH;
|
|
95
|
+
const damping = options.damping ?? DEFAULT_DAMPING;
|
|
96
|
+
const rand = createRng(options.seed ?? 0x9e3779b9);
|
|
97
|
+
const n = nodes.length;
|
|
98
|
+
if (n === 0)
|
|
99
|
+
return [];
|
|
100
|
+
// Seed positions on a small circle so all-pairs repulsion has somewhere
|
|
101
|
+
// to push from on iteration 0 (true zero-vectors give NaN directions).
|
|
102
|
+
const seedRadius = Math.max(20, Math.sqrt(n) * 10);
|
|
103
|
+
const x = new Float64Array(n);
|
|
104
|
+
const y = new Float64Array(n);
|
|
105
|
+
const vx = new Float64Array(n);
|
|
106
|
+
const vy = new Float64Array(n);
|
|
107
|
+
for (let i = 0; i < n; i++) {
|
|
108
|
+
const angle = (i / Math.max(1, n)) * Math.PI * 2 + rand() * 0.5;
|
|
109
|
+
const jitter = 1 + rand() * 0.5;
|
|
110
|
+
x[i] = Math.cos(angle) * seedRadius * jitter;
|
|
111
|
+
y[i] = Math.sin(angle) * seedRadius * jitter;
|
|
112
|
+
}
|
|
113
|
+
// Map id → index once (edges reference ids).
|
|
114
|
+
const idx = new Map();
|
|
115
|
+
for (let i = 0; i < n; i++)
|
|
116
|
+
idx.set(nodes[i].id, i);
|
|
117
|
+
// Precompute valid edges (both endpoints present, not self-loops).
|
|
118
|
+
const ea = [];
|
|
119
|
+
const eb = [];
|
|
120
|
+
const ew = [];
|
|
121
|
+
for (const e of edges) {
|
|
122
|
+
const a = idx.get(e.source);
|
|
123
|
+
const b = idx.get(e.target);
|
|
124
|
+
if (a === undefined || b === undefined || a === b)
|
|
125
|
+
continue;
|
|
126
|
+
ea.push(a);
|
|
127
|
+
eb.push(b);
|
|
128
|
+
ew.push(e.weight ?? 1);
|
|
129
|
+
}
|
|
130
|
+
for (let step = 0; step < iterations; step++) {
|
|
131
|
+
// Reset force accumulator (we reuse vx/vy as fx/fy then integrate).
|
|
132
|
+
const fx = new Float64Array(n);
|
|
133
|
+
const fy = new Float64Array(n);
|
|
134
|
+
// Pairwise repulsion — O(n²). Acceptable for the small graphs the
|
|
135
|
+
// note-taking app will throw at this (hundreds, not millions, of nodes).
|
|
136
|
+
for (let i = 0; i < n; i++) {
|
|
137
|
+
for (let j = i + 1; j < n; j++) {
|
|
138
|
+
let dx = x[i] - x[j];
|
|
139
|
+
let dy = y[i] - y[j];
|
|
140
|
+
let distSq = dx * dx + dy * dy;
|
|
141
|
+
if (distSq < 1e-4) {
|
|
142
|
+
// Two nodes on top of each other — nudge them apart.
|
|
143
|
+
dx = (rand() - 0.5) * 0.1;
|
|
144
|
+
dy = (rand() - 0.5) * 0.1;
|
|
145
|
+
distSq = dx * dx + dy * dy + 1e-4;
|
|
146
|
+
}
|
|
147
|
+
const dist = Math.sqrt(distSq);
|
|
148
|
+
const f = repulsion / distSq;
|
|
149
|
+
const fxi = (dx / dist) * f;
|
|
150
|
+
const fyi = (dy / dist) * f;
|
|
151
|
+
fx[i] += fxi;
|
|
152
|
+
fy[i] += fyi;
|
|
153
|
+
fx[j] -= fxi;
|
|
154
|
+
fy[j] -= fyi;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Edge springs.
|
|
158
|
+
for (let k = 0; k < ea.length; k++) {
|
|
159
|
+
const a = ea[k];
|
|
160
|
+
const b = eb[k];
|
|
161
|
+
const w = ew[k];
|
|
162
|
+
const dx = x[b] - x[a];
|
|
163
|
+
const dy = y[b] - y[a];
|
|
164
|
+
const dist = Math.sqrt(dx * dx + dy * dy) || 1e-4;
|
|
165
|
+
const displacement = dist - restLength;
|
|
166
|
+
const f = spring * displacement * w;
|
|
167
|
+
const fxk = (dx / dist) * f;
|
|
168
|
+
const fyk = (dy / dist) * f;
|
|
169
|
+
fx[a] += fxk;
|
|
170
|
+
fy[a] += fyk;
|
|
171
|
+
fx[b] -= fxk;
|
|
172
|
+
fy[b] -= fyk;
|
|
173
|
+
}
|
|
174
|
+
// Integrate (semi-implicit Euler with damping).
|
|
175
|
+
let maxDispSq = 0;
|
|
176
|
+
for (let i = 0; i < n; i++) {
|
|
177
|
+
vx[i] = (vx[i] + fx[i]) * damping;
|
|
178
|
+
vy[i] = (vy[i] + fy[i]) * damping;
|
|
179
|
+
const dx = vx[i];
|
|
180
|
+
const dy = vy[i];
|
|
181
|
+
x[i] += dx;
|
|
182
|
+
y[i] += dy;
|
|
183
|
+
const dispSq = dx * dx + dy * dy;
|
|
184
|
+
if (dispSq > maxDispSq)
|
|
185
|
+
maxDispSq = dispSq;
|
|
186
|
+
}
|
|
187
|
+
if (maxDispSq < CONVERGENCE_EPSILON)
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
return nodes.map((node, i) => ({ ...node, x: x[i], y: y[i] }));
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Compute world-space positions for every node using the chosen layout.
|
|
194
|
+
*
|
|
195
|
+
* @param nodes - Nodes to position.
|
|
196
|
+
* @param edges - Edges (consumed only by `force`).
|
|
197
|
+
* @param layout - Layout strategy.
|
|
198
|
+
* @param options - Optional force-layout tunables (ignored for non-force).
|
|
199
|
+
* @returns Positioned nodes.
|
|
200
|
+
*/
|
|
201
|
+
export function layoutNodes(nodes, edges, layout, options) {
|
|
202
|
+
switch (layout) {
|
|
203
|
+
case 'circular':
|
|
204
|
+
return circularLayout(nodes, Math.max(40, Math.sqrt(nodes.length) * 30));
|
|
205
|
+
case 'grid':
|
|
206
|
+
return gridLayout(nodes, 60);
|
|
207
|
+
case 'force':
|
|
208
|
+
default:
|
|
209
|
+
return forceLayout(nodes, edges, options);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Compute the world-space bounding box of a set of positioned nodes,
|
|
214
|
+
* with a small padding for visual breathing room.
|
|
215
|
+
*
|
|
216
|
+
* @param nodes - Positioned nodes.
|
|
217
|
+
* @param padding - Padding (world units) added to every side. Default 40.
|
|
218
|
+
* @returns Bounding box `{ minX, minY, maxX, maxY }` — or `null` if empty.
|
|
219
|
+
*/
|
|
220
|
+
export function boundingBox(nodes, padding = 40) {
|
|
221
|
+
if (nodes.length === 0)
|
|
222
|
+
return null;
|
|
223
|
+
let minX = Infinity;
|
|
224
|
+
let minY = Infinity;
|
|
225
|
+
let maxX = -Infinity;
|
|
226
|
+
let maxY = -Infinity;
|
|
227
|
+
for (const n of nodes) {
|
|
228
|
+
if (n.x < minX)
|
|
229
|
+
minX = n.x;
|
|
230
|
+
if (n.y < minY)
|
|
231
|
+
minY = n.y;
|
|
232
|
+
if (n.x > maxX)
|
|
233
|
+
maxX = n.x;
|
|
234
|
+
if (n.y > maxY)
|
|
235
|
+
maxY = n.y;
|
|
236
|
+
}
|
|
237
|
+
return { minX: minX - padding, minY: minY - padding, maxX: maxX + padding, maxY: maxY + padding };
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAA;AAE3C,wDAAwD;AACxD,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAEpC,sDAAsD;AACtD,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAA;AAElC,uDAAuD;AACvD,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAErC,sDAAsD;AACtD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAA;AAEnC,iEAAiE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O,CAAC,CAAA;IAC7C,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CACzB,KAAuB,EACvB,OAAO,GAAG,EAAE;IAEZ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACnC,IAAI,IAAI,GAAG,QAAQ,CAAA;IACnB,IAAI,IAAI,GAAG,QAAQ,CAAA;IACnB,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAA;IACpB,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAA;IACpB,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI;YAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAA;QAC1B,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI;YAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAA;QAC1B,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI;YAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAA;QAC1B,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI;YAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAA;IAC5B,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,EAAE,CAAA;AACnG,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { JSX } from 'solid-js';
|
|
2
|
+
import type { ForceLayoutOptions } from './layout.js';
|
|
3
|
+
/**
|
|
4
|
+
* Graph-view types: nodes, edges, layout choice and renderer hooks for
|
|
5
|
+
* `<GraphView>`.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
/** A 2-D point in graph (world) coordinates. */
|
|
10
|
+
export interface GraphPoint {
|
|
11
|
+
/** X coordinate. */
|
|
12
|
+
x: number;
|
|
13
|
+
/** Y coordinate. */
|
|
14
|
+
y: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Single node in the graph.
|
|
18
|
+
*
|
|
19
|
+
* `group` is an opaque grouping discriminator (e.g. tag, folder) the
|
|
20
|
+
* caller can use for colouring; `weight` scales the rendered radius.
|
|
21
|
+
*/
|
|
22
|
+
export interface GraphNode {
|
|
23
|
+
/** Unique node id. */
|
|
24
|
+
id: string;
|
|
25
|
+
/** Human-readable label rendered next to the node. */
|
|
26
|
+
label: string;
|
|
27
|
+
/** Optional grouping discriminator (e.g. tag id). */
|
|
28
|
+
group?: string;
|
|
29
|
+
/** Optional weight; default 1. Scales the rendered radius. */
|
|
30
|
+
weight?: number;
|
|
31
|
+
}
|
|
32
|
+
/** Edge connecting two nodes by id. */
|
|
33
|
+
export interface GraphEdge {
|
|
34
|
+
/** Unique edge id. */
|
|
35
|
+
id: string;
|
|
36
|
+
/** Source node id. */
|
|
37
|
+
source: string;
|
|
38
|
+
/** Target node id. */
|
|
39
|
+
target: string;
|
|
40
|
+
/** Optional weight; default 1. Stronger edges pull harder under force layout. */
|
|
41
|
+
weight?: number;
|
|
42
|
+
}
|
|
43
|
+
/** Available layout strategies. */
|
|
44
|
+
export type GraphLayout = 'force' | 'circular' | 'grid';
|
|
45
|
+
/**
|
|
46
|
+
* Internal positioned node used by the renderer; the `x`/`y` coordinates
|
|
47
|
+
* are in world (graph) space, with `(0, 0)` at the canvas centre.
|
|
48
|
+
*/
|
|
49
|
+
export interface PositionedNode extends GraphNode {
|
|
50
|
+
/** World-space X coordinate. */
|
|
51
|
+
x: number;
|
|
52
|
+
/** World-space Y coordinate. */
|
|
53
|
+
y: number;
|
|
54
|
+
}
|
|
55
|
+
/** Renderer for an individual node. Receives the positioned node. */
|
|
56
|
+
export type GraphNodeRenderer = (node: PositionedNode) => JSX.Element;
|
|
57
|
+
/** Renderer for an individual edge. Receives the edge plus both endpoints. */
|
|
58
|
+
export type GraphEdgeRenderer = (edge: GraphEdge, source: PositionedNode, target: PositionedNode) => JSX.Element;
|
|
59
|
+
/** `<GraphView>` props. */
|
|
60
|
+
export interface GraphViewProps {
|
|
61
|
+
/** Nodes to render. */
|
|
62
|
+
nodes: GraphNode[];
|
|
63
|
+
/** Edges to render. */
|
|
64
|
+
edges: GraphEdge[];
|
|
65
|
+
/** Fired when the user clicks (or activates) a node. */
|
|
66
|
+
onNodeClick?: (node: GraphNode) => void;
|
|
67
|
+
/** Currently-selected node id (highlighted in the view). */
|
|
68
|
+
selectedNodeId?: string;
|
|
69
|
+
/** Layout strategy. Defaults to `'force'`. */
|
|
70
|
+
layout?: GraphLayout;
|
|
71
|
+
/** Custom node renderer (overrides the default circle + label). */
|
|
72
|
+
nodeRenderer?: GraphNodeRenderer;
|
|
73
|
+
/** Custom edge renderer (overrides the default `<line>`). */
|
|
74
|
+
edgeRenderer?: GraphEdgeRenderer;
|
|
75
|
+
/** Force-layout tunables; ignored for non-force layouts. */
|
|
76
|
+
forceOptions?: ForceLayoutOptions;
|
|
77
|
+
/** Extra classes merged onto the outer wrapper. */
|
|
78
|
+
className?: string;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD;;;;;GAKG;AAEH,gDAAgD;AAChD,MAAM,WAAW,UAAU;IACzB,oBAAoB;IACpB,CAAC,EAAE,MAAM,CAAA;IACT,oBAAoB;IACpB,CAAC,EAAE,MAAM,CAAA;CACV;AAED;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,sBAAsB;IACtB,EAAE,EAAE,MAAM,CA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IAChC,6DAA6D;IAC7D,YAAY,CAAC,EAAE,iBAAiB,CAAA;IAChC,4DAA4D;IAC5D,YAAY,CAAC,EAAE,kBAAkB,CAAA;IACjC,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-feature-graph-view-solid",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.1-stage",
|
|
4
|
+
"description": "Force-directed graph view (Obsidian-style) for visualizing note / page linkages",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/app-feature-graph-view-solid",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"dev": "tsc --watch",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"molecule",
|
|
27
|
+
"graph",
|
|
28
|
+
"force-directed",
|
|
29
|
+
"visualization",
|
|
30
|
+
"obsidian",
|
|
31
|
+
"notes",
|
|
32
|
+
"solid"
|
|
33
|
+
],
|
|
34
|
+
"author": "Molecule Dev, Inc. (https://molecule.dev)",
|
|
35
|
+
"license": "Apache-2.0",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
39
|
+
"directory": "packages/app/features/feature-graph-view-solid"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=20"
|
|
43
|
+
},
|
|
44
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@molecule/app-solid": "^3.5.0",
|
|
50
|
+
"@molecule/app-ui": "^1.0.1",
|
|
51
|
+
"@molecule/app-ui-solid": "^1.1.0",
|
|
52
|
+
"solid-js": "^1.8.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@molecule/app-framework-conformance": "0.0.0",
|
|
56
|
+
"@molecule/app-i18n": "1.2.2",
|
|
57
|
+
"@molecule/app-icons": "1.0.4",
|
|
58
|
+
"@molecule/app-solid": "3.7.2",
|
|
59
|
+
"@molecule/app-ui": "1.4.0",
|
|
60
|
+
"@molecule/app-ui-solid": "1.1.5",
|
|
61
|
+
"@types/node": "26.6.5",
|
|
62
|
+
"jsdom": "30.1.3",
|
|
63
|
+
"solid-js": "1.9.17",
|
|
64
|
+
"typescript": "6.0.3",
|
|
65
|
+
"vite-plugin-solid": "2.11.15",
|
|
66
|
+
"vitest": "4.1.12"
|
|
67
|
+
}
|
|
68
|
+
}
|