@riebeckite/plugin-local-graph 0.0.32 → 0.0.33

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 CHANGED
@@ -7,6 +7,10 @@ outgoing links and backlinks.
7
7
 
8
8
  [日本語](./README_ja.md)
9
9
 
10
+ ## Live example
11
+
12
+ Open [Backlink](/docs/glossary/backlink) to see the local graph at the bottom of the article, centered on that page and its neighbors.
13
+
10
14
  ## Recommended placement
11
15
 
12
16
  `localGraph()` provides a `LocalGraph` component that renders the current note
@@ -22,15 +26,15 @@ neighbor.
22
26
 
23
27
  ```ts
24
28
  import { defineConfig } from "@riebeckite/core";
25
- import { localGraphPlugin } from "@riebeckite/plugin-local-graph";
29
+ import { localGraph } from "@riebeckite/plugin-local-graph";
26
30
 
27
31
  export default defineConfig({
28
32
  // ...
29
- plugins: [localGraphPlugin()],
33
+ plugins: [localGraph()],
30
34
  });
31
35
  ```
32
36
 
33
- `localGraphPlugin()` registers the plugin and bundles `style.css` into the app
37
+ `localGraph()` registers the plugin and bundles `style.css` into the app
34
38
  stylesheet. The Site renders `<LocalGraph />` component itself, normally once
35
39
  after article content, to display the graph output.
36
40
 
@@ -61,7 +65,7 @@ Render the component once per article. Remove the element to remove the UI.
61
65
 
62
66
  ## Configuration
63
67
 
64
- There are no plugin options for `localGraphPlugin`. The `LocalGraph` component
68
+ There are no plugin options for `localGraph`. The `LocalGraph` component
65
69
  accepts `graph` as a required prop.
66
70
 
67
71
  ## Graph layout
@@ -74,7 +78,7 @@ internal selection key `/explore?note=<slug>`.
74
78
 
75
79
  ## Exports
76
80
 
77
- - `localGraphPlugin()` — plugin factory
81
+ - `localGraph()` — plugin factory
78
82
  - `LocalGraph` — SVG graph component (default export of `components/local-graph.tsx`)
79
83
  - `getLocalGraph({ manifest, config, slug, resolveTitle })` — builds nearby-note
80
84
  data for a slug (`null` when the note is absent or unpublished)
package/README_ja.md CHANGED
@@ -2,32 +2,36 @@
2
2
 
3
3
  <!-- Generated from docs/docs/plugins/local-graph.ja.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
4
4
 
5
- 現在のノートと、その前後につながるノートを小さな放射状グラフで表示するプラグインです。
5
+ 現在のノートと、そこから直接つながるノート(リンク先と被リンク元)を小さな放射状グラフで表示するプラグインです。
6
6
 
7
7
  [English](./README.md)
8
8
 
9
+ ## 実行例
10
+
11
+ [Backlink](/ja/docs/glossary/backlink) を開くと、そのページと隣接ページを中心としたローカルグラフが記事の末尾に表示されます。
12
+
9
13
  ## 推奨配置
10
14
 
11
- `getLocalGraph()` はマニフェストからリンク先と被リンク元を集め、公開済みノートだけを残します。各方向は最大 10 件です。`LocalGraph` はそのデータを SVG として描画し、周辺ノートがなければ何も表示しません。Site は `<LocalGraph />` コンポーネントを記事の後などに配置します。
15
+ `getLocalGraph()` はマニフェストからリンク先と被リンク元を集め、公開済みノートだけを残します。リンク先と被リンク元はそれぞれ最大 10 件です。`LocalGraph` はそのデータを SVG として描画し、周辺ノートがなければ何も表示しません。Site は `<LocalGraph />` コンポーネントを記事の後などに配置します。
12
16
 
13
17
  ## クイックスタート
14
18
 
15
19
  ```ts
16
20
  import { defineConfig } from "@riebeckite/core";
17
- import { localGraphPlugin } from "@riebeckite/plugin-local-graph";
21
+ import { localGraph } from "@riebeckite/plugin-local-graph";
18
22
 
19
- export default defineConfig({ plugins: [localGraphPlugin()] });
23
+ export default defineConfig({ plugins: [localGraph()] });
20
24
  ```
21
25
 
22
26
  記事レイアウトで `<LocalGraph />` コンポーネントを一度描画します。
23
27
 
24
28
  ## 設定
25
29
 
26
- `localGraphPlugin()` にはプラグイン用のオプションがありません。`LocalGraph` コンポーネントは `graph` 必須プロップを受け取ります。
30
+ `localGraph()` にはプラグイン用のオプションがありません。`LocalGraph` コンポーネントは必須プロップ `graph` を受け取ります。
27
31
 
28
32
  ## 高度なカスタマイズ
29
33
 
30
- サイト側で配置を決めるには、`getLocalGraph` を使ってデータを取得し、`<LocalGraph graph={...} />` コンポーネントを一度だけ描画してください。グラフの生成と公開済み近傍だけを残すフィルタリングは維持されます。
34
+ サイト側で配置を決めるには、`getLocalGraph` を使ってデータを取得し、`<LocalGraph graph={...} />` コンポーネントを一度だけ描画してください。グラフの生成と、公開済みの近傍だけを残す絞り込みは維持されます。
31
35
 
32
36
  ```tsx
33
37
  import LocalGraph, { getLocalGraph } from "@riebeckite/plugin-local-graph";
@@ -35,11 +39,11 @@ const graph = getLocalGraph({ manifest: await content.getManifest(), config, slu
35
39
  return <aside>{graph ? <LocalGraph graph={graph} /> : null}</aside>;
36
40
  ```
37
41
 
38
- グラフのノード位置は `layoutRadialGraph()`、辺は `buildGraphEdges()` が計算します。各ノードのリンクは解決済みの `permalink` を使い、見出しは internal selection key `/explore?note=<slug>` で Explorer を開きます。
42
+ グラフのノード位置は `layoutRadialGraph()`、辺は `buildGraphEdges()` が計算します。各ノードのリンクは解決済みの `permalink` を使い、ヘッダーは内部セレクションキー `/explore?note=<slug>` で Explorer を開きます。
39
43
 
40
44
  ## 公開 API
41
45
 
42
- - `localGraphPlugin()`、`LocalGraph`
46
+ - `localGraph()`、`LocalGraph`
43
47
  - `getLocalGraph({ manifest, config, slug, resolveTitle })`
44
48
  - `buildGraphEdges(nodes, visibleSlugs?)`、`layoutRadialGraph(nodes, options)`
45
49
  - `LocalGraphData`、`LocalGraphNode`
@@ -1,5 +1,5 @@
1
1
  // components/local-graph.tsx
2
- import { buildGraphEdges, layoutRadialGraph } from "@riebeckite/core";
2
+ import { buildGraphEdges, layoutRadialGraph } from "@riebeckite/core/client";
3
3
  import { useArticleContext, useSiteContext } from "@riebeckite/ui";
4
4
  import { html } from "hono/html";
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { buildGraphEdges, layoutRadialGraph } from "@riebeckite/core";
1
+ import { buildGraphEdges, layoutRadialGraph } from "@riebeckite/core/client";
2
2
  export type { LocalGraphProps } from "./components/local-graph.js";
3
3
  export { default as LocalGraph } from "./components/local-graph.js";
4
4
  export type { LocalGraphData, LocalGraphNode, LocalGraphNodeRelation, } from "./src/local-graph.js";
5
5
  export { buildLocalGraph, getLocalGraph, } from "./src/local-graph.server.js";
6
6
  export { buildGraphEdges, layoutRadialGraph };
7
7
  export type LocalGraphOptions = Record<never, never>;
8
- export declare function localGraphPlugin(options?: LocalGraphOptions): import("@riebeckite/core").RiebeckitePlugin<LocalGraphOptions>;
8
+ export declare function localGraph(options?: LocalGraphOptions): import("@riebeckite/core").RiebeckitePlugin<LocalGraphOptions>;
package/dist/index.js CHANGED
@@ -1,12 +1,9 @@
1
1
  // index.ts
2
- import {
3
- buildGraphEdges as buildGraphEdges2,
4
- definePlugin,
5
- layoutRadialGraph as layoutRadialGraph2
6
- } from "@riebeckite/core";
2
+ import { definePlugin } from "@riebeckite/core";
3
+ import { buildGraphEdges as buildGraphEdges2, layoutRadialGraph as layoutRadialGraph2 } from "@riebeckite/core/client";
7
4
 
8
5
  // components/local-graph.tsx
9
- import { buildGraphEdges, layoutRadialGraph } from "@riebeckite/core";
6
+ import { buildGraphEdges, layoutRadialGraph } from "@riebeckite/core/client";
10
7
  import { useArticleContext, useSiteContext } from "@riebeckite/ui";
11
8
  import { html } from "hono/html";
12
9
 
@@ -206,7 +203,7 @@ var LocalGraph = (async (props) => {
206
203
  var local_graph_default = LocalGraph;
207
204
 
208
205
  // index.ts
209
- function localGraphPlugin(options = {}) {
206
+ function localGraph(options = {}) {
210
207
  return definePlugin({
211
208
  name: "local-graph",
212
209
  order: 400,
@@ -226,5 +223,5 @@ export {
226
223
  buildLocalGraph,
227
224
  getLocalGraph,
228
225
  layoutRadialGraph2 as layoutRadialGraph,
229
- localGraphPlugin
226
+ localGraph
230
227
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-local-graph",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,13 +21,13 @@
21
21
  "./style.css": "./style.css"
22
22
  },
23
23
  "dependencies": {
24
- "hono": "^4.12.25",
25
- "@riebeckite/core": "0.0.32",
26
- "@riebeckite/ui": "0.0.32"
24
+ "@riebeckite/core": "0.0.33",
25
+ "@riebeckite/ui": "0.0.33",
26
+ "hono": "^4.12.25"
27
27
  },
28
28
  "devDependencies": {
29
- "tsx": "^4.22.4",
30
- "@riebeckite/test": "0.0.32"
29
+ "@riebeckite/test": "0.0.33",
30
+ "tsx": "^4.22.4"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"