@riebeckite/plugin-garden-explorer 0.0.13 → 0.0.15
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/README.md +72 -19
- package/README_ja.md +46 -16
- package/dist/client.js +331 -50
- package/dist/components/garden-explorer.js +331 -50
- package/dist/index.d.ts +3 -2
- package/dist/index.js +362 -57
- package/dist/src/garden-explorer.d.ts +15 -0
- package/dist/src/garden-explorer.server.d.ts +3 -1
- package/package.json +4 -3
- package/style.css +63 -0
package/README.md
CHANGED
|
@@ -1,28 +1,59 @@
|
|
|
1
1
|
# @riebeckite/plugin-garden-explorer
|
|
2
2
|
|
|
3
|
-
Interactive note garden explorer: a graph, search box,
|
|
4
|
-
note details in a single page.
|
|
3
|
+
Interactive note garden explorer: a local/global content graph, search box,
|
|
4
|
+
tag/folder filters, and note details in a single page.
|
|
5
5
|
|
|
6
6
|
[日本語](./README_ja.md)
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
`
|
|
11
|
-
panels:
|
|
10
|
+
`gardenExplorerPlugin()` provides an interactive `GardenExplorer` component with
|
|
11
|
+
three panels:
|
|
12
12
|
|
|
13
|
-
- **Explorer** — search box plus tag and folder filter chips (with
|
|
14
|
-
a filtered note list
|
|
15
|
-
- **Graph** — an
|
|
16
|
-
|
|
13
|
+
- **Explorer** — search box plus optional tag and folder filter chips (with
|
|
14
|
+
counts) and a filtered note list
|
|
15
|
+
- **Graph** — an SVG graph of published notes and internal links with local and
|
|
16
|
+
global modes, force or radial layout, hover neighbor emphasis, node drag,
|
|
17
|
+
wheel/button zoom, canvas pan, reset, and click-to-open navigation
|
|
17
18
|
- **Details** — the selected note's links, tags, excerpt, and related notes
|
|
18
19
|
|
|
19
20
|
Selection state is mirrored to the URL query (`?note=`, `?tag=`, `?folder=`),
|
|
20
21
|
so the view is shareable and the filter list adapts to the current selection.
|
|
21
22
|
|
|
22
|
-
`getGardenExplorerData()` builds the note set from
|
|
23
|
-
headings, a plain-text body (truncated to 4,000
|
|
24
|
-
links, and backlinks.
|
|
25
|
-
|
|
23
|
+
`getGardenExplorerData()` builds the note set from `manifest.discoverableEntries`
|
|
24
|
+
and `manifest.graph`, including headings, a plain-text body (truncated to 4,000
|
|
25
|
+
chars), tags, folders, outgoing links, and backlinks. The graph only contains
|
|
26
|
+
published/discoverable notes and resolved note links, so unpublished, excluded,
|
|
27
|
+
or missing pages do not appear as graph nodes.
|
|
28
|
+
|
|
29
|
+
The note list in the Explorer panel shows the first 80 filtered notes for UI
|
|
30
|
+
performance. The Global Graph uses all filtered notes. If a URL-selected note
|
|
31
|
+
falls outside the first 80, it is preserved in the Global Graph.
|
|
32
|
+
|
|
33
|
+
## Local and global graph
|
|
34
|
+
|
|
35
|
+
- **Local graph** starts at the selected note and shows neighbors up to `depth`
|
|
36
|
+
hops. The default is `depth: 1`, matching the common Obsidian/Quartz model of
|
|
37
|
+
direct backlinks and outgoing links. Use `depth: 0` to show only the selected
|
|
38
|
+
note.
|
|
39
|
+
- **Global graph** shows all currently filtered public notes and their published
|
|
40
|
+
internal links.
|
|
41
|
+
|
|
42
|
+
This is intentionally close to Obsidian's exploration model, but it uses
|
|
43
|
+
Riebeckite's Page System, public manifest, permalinks, and content graph instead
|
|
44
|
+
of rescanning the vault in the browser.
|
|
45
|
+
|
|
46
|
+
## Layouts
|
|
47
|
+
|
|
48
|
+
- **Force layout** (`layout: "force"`, default) uses a small deterministic
|
|
49
|
+
built-in simulation: repulsion, link distance, centering, damping, and bounded
|
|
50
|
+
stabilization. It adds no large dependency. With large graphs (>300 nodes) the
|
|
51
|
+
force layout computation becomes noticeable; a warning is shown in the toolbar.
|
|
52
|
+
For large Global Graphs, consider using the radial layout. Above 500 nodes,
|
|
53
|
+
explicit user approval is required before the force layout runs.
|
|
54
|
+
- **Radial layout** (`layout: "radial"`) keeps the existing Riebeckite radial
|
|
55
|
+
layout available for compact or deterministic presentations. It runs in
|
|
56
|
+
near-linear time and handles thousands of nodes instantly.
|
|
26
57
|
|
|
27
58
|
## Usage
|
|
28
59
|
|
|
@@ -36,6 +67,23 @@ export default defineConfig({
|
|
|
36
67
|
});
|
|
37
68
|
```
|
|
38
69
|
|
|
70
|
+
With configuration:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
plugins: [
|
|
74
|
+
gardenExplorerPlugin({
|
|
75
|
+
layout: "force",
|
|
76
|
+
depth: 1,
|
|
77
|
+
showTags: true,
|
|
78
|
+
showFolders: false,
|
|
79
|
+
nodeSize: 1,
|
|
80
|
+
linkDistance: 84,
|
|
81
|
+
repulsion: 1800,
|
|
82
|
+
showLabels: true,
|
|
83
|
+
}),
|
|
84
|
+
];
|
|
85
|
+
```
|
|
86
|
+
|
|
39
87
|
`gardenExplorerPlugin()` registers the `/explore` page type and bundles
|
|
40
88
|
`style.css` and its client hydrator into the app. A catch-all route using
|
|
41
89
|
`resolveRiebeckiteRoute()` and `pluginPageSsgParams()` renders and emits it;
|
|
@@ -58,14 +106,16 @@ const data = getGardenExplorerData({
|
|
|
58
106
|
manifest,
|
|
59
107
|
config,
|
|
60
108
|
resolveTitle: getArticleTitle,
|
|
109
|
+
options: { layout: "radial", depth: 2 },
|
|
61
110
|
});
|
|
62
111
|
|
|
63
112
|
// ...in a site-owned component
|
|
64
113
|
return <GardenExplorer data={data} />;
|
|
65
114
|
```
|
|
66
115
|
|
|
67
|
-
The component is client-side interactive and expects `window` to be available
|
|
68
|
-
|
|
116
|
+
The component is client-side interactive and expects `window` to be available in
|
|
117
|
+
the browser. The server-rendered fallback still exposes the surrounding
|
|
118
|
+
explorer/detail structure and links in semantic lists.
|
|
69
119
|
|
|
70
120
|
## Data
|
|
71
121
|
|
|
@@ -76,18 +126,21 @@ in the browser.
|
|
|
76
126
|
- `edges` — note-to-note graph edges between published notes
|
|
77
127
|
- `tags` — tag counts, most frequent first
|
|
78
128
|
- `folders` — folder counts, alphabetical; root-level notes are `"Root"`
|
|
129
|
+
- `options` — resolved graph options used by the hydrated component
|
|
79
130
|
|
|
80
131
|
## Exports
|
|
81
132
|
|
|
82
|
-
- `gardenExplorerPlugin()` — plugin factory
|
|
133
|
+
- `gardenExplorerPlugin(options?)` — plugin factory
|
|
83
134
|
- `GardenExplorer` — interactive explorer component (default export of
|
|
84
135
|
`components/garden-explorer.tsx`)
|
|
85
|
-
- `getGardenExplorerData({ manifest, config, resolveTitle })` — builds
|
|
86
|
-
explorer dataset
|
|
136
|
+
- `getGardenExplorerData({ manifest, config, resolveTitle, options? })` — builds
|
|
137
|
+
the explorer dataset
|
|
87
138
|
- Types: `GardenExplorerData`, `GardenExplorerEdge`, `GardenExplorerFolder`,
|
|
88
|
-
`
|
|
139
|
+
`GardenExplorerGraphLayout`, `GardenExplorerGraphMode`, `GardenExplorerNote`,
|
|
140
|
+
`GardenExplorerOptions`, `GardenExplorerPluginOptions`, `GardenExplorerTag`
|
|
89
141
|
|
|
90
142
|
## See also
|
|
91
143
|
|
|
92
|
-
- [Plugin guide](../../../docs/en/reference/plugin-api.md)
|
|
144
|
+
- [Plugin guide](../../../docs/en/docs/reference/plugin-api.md)
|
|
93
145
|
- [`@riebeckite/plugin-local-graph`](../local-graph/README.md)
|
|
146
|
+
|
package/README_ja.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @riebeckite/plugin-garden-explorer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ノート一覧、検索、タグ・フォルダーによる絞り込み、Local / Global Graph、詳細パネルを一画面にまとめる探索 UI です。公開済みのノートだけを対象にするため、そのまま公開サイトの `/explore` などに置けます。
|
|
4
4
|
|
|
5
5
|
[English](./README.md)
|
|
6
6
|
|
|
@@ -8,12 +8,28 @@
|
|
|
8
8
|
|
|
9
9
|
`gardenExplorerPlugin()` は、次の三つの領域を持つ `GardenExplorer` コンポーネントとスタイルを提供します。
|
|
10
10
|
|
|
11
|
-
- **一覧**:
|
|
12
|
-
- **グラフ**:
|
|
11
|
+
- **一覧**: キーワード検索、任意表示のタグ・フォルダーフィルター、該当ノートの一覧
|
|
12
|
+
- **グラフ**: 公開ノートと内部リンクを表示する SVG グラフ。Local / Global の切り替え、force / radial layout、hover 時の隣接ノート強調、ノード drag、wheel / button zoom、canvas pan、reset、クリックで記事へ移動に対応
|
|
13
13
|
- **詳細**: 選択したノートのリンク、タグ、抜粋、関連ノート
|
|
14
14
|
|
|
15
15
|
選択状態は `?note=`、`?tag=`、`?folder=` として URL に反映されます。表示中の状態をそのまま共有できます。
|
|
16
16
|
|
|
17
|
+
`getGardenExplorerData()` は `manifest.discoverableEntries` と `manifest.graph` から表示データを作ります。見出し、本文テキストの先頭 4,000 文字、タグ、フォルダー、送信リンク、被リンクを含みます。Graph のノードは公開・発見可能なページと解決済み note link だけなので、未公開・除外・存在しないページは表示されません。
|
|
18
|
+
|
|
19
|
+
Explorer パネルのノート一覧は、UI 性能のため先頭 80 件に制限して表示します。Global Graph は絞り込み後の全ノートを使用します。URL で選択されたノートが先頭 80 件の外にある場合、Global Graph で保持されます。
|
|
20
|
+
|
|
21
|
+
## Local Graph と Global Graph
|
|
22
|
+
|
|
23
|
+
- **Local Graph** は選択中のノートを起点に、`depth` で指定した hop 数までの隣接ノートを表示します。既定値は `depth: 1` で、Obsidian / Quartz と同じく直接の outgoing link と backlink を見る用途に合わせています。`depth: 0` では選択中のノートだけを表示します。
|
|
24
|
+
- **Global Graph** は現在の検索・タグ・フォルダー条件で絞り込まれた公開ノート全体と、その公開内部リンクを表示します。
|
|
25
|
+
|
|
26
|
+
操作感は Obsidian の Graph View に寄せていますが、Vault をブラウザ側で再探索するのではなく、Riebeckite の Page System、public manifest、permalink、Content Graph をそのまま使います。
|
|
27
|
+
|
|
28
|
+
## Layout
|
|
29
|
+
|
|
30
|
+
- **Force layout**(`layout: "force"`、既定): 小さな組み込み実装で repulsion、link distance、centering、damping、安定化を行います。重い依存は追加していません。大きなグラフ(300 ノード以上)では force layout の計算時間が目立つようになり、ツールバーに警告が表示されます。大きな Global Graph には radial layout の使用を推奨します。500 ノード以上では、ユーザーの明示的な承認なしに force layout は実行されません。
|
|
31
|
+
- **Radial layout**(`layout: "radial"`): 既存の Riebeckite の放射状 layout を使います。コンパクトで決定的な見た目にしたい場合に使えます。近似線形時間で動作し、数千ノードでも瞬時に描画できます。
|
|
32
|
+
|
|
17
33
|
## 設定してページに配置する
|
|
18
34
|
|
|
19
35
|
```ts
|
|
@@ -26,15 +42,26 @@ export default defineConfig({
|
|
|
26
42
|
});
|
|
27
43
|
```
|
|
28
44
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
45
|
+
設定例:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
plugins: [
|
|
49
|
+
gardenExplorerPlugin({
|
|
50
|
+
layout: "force",
|
|
51
|
+
depth: 1,
|
|
52
|
+
showTags: true,
|
|
53
|
+
showFolders: false,
|
|
54
|
+
nodeSize: 1,
|
|
55
|
+
linkDistance: 84,
|
|
56
|
+
repulsion: 1800,
|
|
57
|
+
showLabels: true,
|
|
58
|
+
}),
|
|
59
|
+
];
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`gardenExplorerPlugin()` は `/explore` の Page Type、スタイル、クライアント側の hydrator を登録します。`resolveRiebeckiteRoute()` と `pluginPageSsgParams()` を使う共通 catch-all route が表示と SSG を担当するため、Plugin 固有の route は不要です。ページはまずサーバーで描画し、読み込み後に登録済みの client entry がグラフ、フィルター、URL 状態を hydration します。
|
|
35
63
|
|
|
36
|
-
コンポーネントを別の site-owned component に埋め込む場合だけ、manifest
|
|
37
|
-
表示用データを作って渡します。
|
|
64
|
+
コンポーネントを別の site-owned component に埋め込む場合だけ、manifest から表示用データを作って渡します。
|
|
38
65
|
|
|
39
66
|
```tsx
|
|
40
67
|
import GardenExplorer, {
|
|
@@ -46,12 +73,13 @@ const data = getGardenExplorerData({
|
|
|
46
73
|
manifest,
|
|
47
74
|
config,
|
|
48
75
|
resolveTitle: getArticleTitle,
|
|
76
|
+
options: { layout: "radial", depth: 2 },
|
|
49
77
|
});
|
|
50
78
|
|
|
51
79
|
return <GardenExplorer data={data} />;
|
|
52
80
|
```
|
|
53
81
|
|
|
54
|
-
`GardenExplorer`
|
|
82
|
+
`GardenExplorer` はブラウザで操作するクライアントコンポーネントです。サーバー描画時にも周辺の一覧・詳細パネルは semantic なリンク一覧として読める構造を残します。
|
|
55
83
|
|
|
56
84
|
## データに含まれる範囲
|
|
57
85
|
|
|
@@ -61,17 +89,19 @@ return <GardenExplorer data={data} />;
|
|
|
61
89
|
- `edges`: 公開ノート間のグラフの辺
|
|
62
90
|
- `tags`: 件数の多い順のタグ
|
|
63
91
|
- `folders`: 名前順のフォルダー。ルート直下のノートは `Root`
|
|
92
|
+
- `options`: hydration 後の component が使う解決済み graph 設定
|
|
64
93
|
|
|
65
94
|
探索画面の検索はプラグイン内で完結しており、`@riebeckite/plugin-search` は不要です。
|
|
66
95
|
|
|
67
96
|
## 主なエクスポート
|
|
68
97
|
|
|
69
|
-
- `gardenExplorerPlugin()`: プラグインを作成する
|
|
98
|
+
- `gardenExplorerPlugin(options?)`: プラグインを作成する
|
|
70
99
|
- `GardenExplorer`: 探索画面のコンポーネント
|
|
71
|
-
- `getGardenExplorerData({ manifest, config, resolveTitle })`: 表示データを構築する
|
|
72
|
-
- 型: `GardenExplorerData`、`GardenExplorerEdge`、`GardenExplorerFolder`、`GardenExplorerNote`、`GardenExplorerTag`
|
|
100
|
+
- `getGardenExplorerData({ manifest, config, resolveTitle, options? })`: 表示データを構築する
|
|
101
|
+
- 型: `GardenExplorerData`、`GardenExplorerEdge`、`GardenExplorerFolder`、`GardenExplorerGraphLayout`、`GardenExplorerGraphMode`、`GardenExplorerNote`、`GardenExplorerOptions`、`GardenExplorerPluginOptions`、`GardenExplorerTag`
|
|
73
102
|
|
|
74
103
|
## 関連資料
|
|
75
104
|
|
|
76
|
-
- [プラグインシステム](../../../docs/ja/reference/plugin-api.md)
|
|
105
|
+
- [プラグインシステム](../../../docs/ja/docs/reference/plugin-api.md)
|
|
77
106
|
- [`@riebeckite/plugin-local-graph`](../local-graph/README_ja.md)
|
|
107
|
+
|