@quartz-community/graph 0.1.0
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/CHANGELOG.md +12 -0
- package/LICENSE +21 -0
- package/README.md +147 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +411 -0
- package/dist/components/index.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +411 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +149 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Initial Quartz community plugin template.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Quartz Community
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# @quartz-community/graph
|
|
2
|
+
|
|
3
|
+
The Graph View component for Quartz - visualize your digital garden as an interactive network graph.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🕸️ **Interactive Network Graph** - Visualize connections between your pages
|
|
8
|
+
- 🎨 **Local & Global Views** - See connections to current page or explore the entire graph
|
|
9
|
+
- ⚡ **Smooth Animations** - Built with D3 force simulation and PixiJS rendering
|
|
10
|
+
- 🏷️ **Tag Support** - Visualize tags as nodes in the graph
|
|
11
|
+
- 🖱️ **Interactive Controls** - Drag, zoom, and pan around the graph
|
|
12
|
+
- 💾 **Visited Tracking** - Highlights pages you've already visited
|
|
13
|
+
- ⌨️ **Keyboard Shortcuts** - Press `Ctrl/Cmd + G` to toggle the global graph
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx quartz plugin add github:quartz-community/graph
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```yaml title="quartz.config.yaml"
|
|
24
|
+
plugins:
|
|
25
|
+
- source: github:quartz-community/graph
|
|
26
|
+
enabled: true
|
|
27
|
+
layout:
|
|
28
|
+
position: right
|
|
29
|
+
priority: 10
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
For advanced use cases, you can override in TypeScript:
|
|
33
|
+
|
|
34
|
+
```ts title="quartz.ts (override)"
|
|
35
|
+
import * as ExternalPlugin from "./.quartz/plugins";
|
|
36
|
+
|
|
37
|
+
ExternalPlugin.Graph({
|
|
38
|
+
localGraph: {
|
|
39
|
+
drag: true,
|
|
40
|
+
zoom: true,
|
|
41
|
+
depth: 1,
|
|
42
|
+
},
|
|
43
|
+
globalGraph: {
|
|
44
|
+
drag: true,
|
|
45
|
+
zoom: true,
|
|
46
|
+
depth: -1,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Configuration Options
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
interface D3Config {
|
|
55
|
+
/** Enable node dragging */
|
|
56
|
+
drag: boolean;
|
|
57
|
+
/** Enable zooming */
|
|
58
|
+
zoom: boolean;
|
|
59
|
+
/** Depth of connections to show (-1 for all) */
|
|
60
|
+
depth: number;
|
|
61
|
+
/** Graph scale factor */
|
|
62
|
+
scale: number;
|
|
63
|
+
/** Force repelling strength */
|
|
64
|
+
repelForce: number;
|
|
65
|
+
/** Center force strength */
|
|
66
|
+
centerForce: number;
|
|
67
|
+
/** Distance between linked nodes */
|
|
68
|
+
linkDistance: number;
|
|
69
|
+
/** Label font size */
|
|
70
|
+
fontSize: number;
|
|
71
|
+
/** Opacity multiplier */
|
|
72
|
+
opacityScale: number;
|
|
73
|
+
/** Tags to exclude */
|
|
74
|
+
removeTags: string[];
|
|
75
|
+
/** Show tags as nodes */
|
|
76
|
+
showTags: boolean;
|
|
77
|
+
/** Dim non-hovered nodes on hover */
|
|
78
|
+
focusOnHover?: boolean;
|
|
79
|
+
/** Enable radial layout */
|
|
80
|
+
enableRadial?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface GraphOptions {
|
|
84
|
+
localGraph?: Partial<D3Config>; // Local page graph config
|
|
85
|
+
globalGraph?: Partial<D3Config>; // Global graph config
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Default Behavior
|
|
90
|
+
|
|
91
|
+
### Local Graph
|
|
92
|
+
|
|
93
|
+
By default, the local graph:
|
|
94
|
+
|
|
95
|
+
- Shows 1 level of connections (direct links only)
|
|
96
|
+
- Dragging enabled
|
|
97
|
+
- Zoom enabled
|
|
98
|
+
- Tags shown as nodes
|
|
99
|
+
- 250px height
|
|
100
|
+
- Displays on the right side of pages
|
|
101
|
+
|
|
102
|
+
### Global Graph
|
|
103
|
+
|
|
104
|
+
By default, the global graph:
|
|
105
|
+
|
|
106
|
+
- Shows all connections (depth: -1)
|
|
107
|
+
- Opens in fullscreen modal when clicking the graph icon
|
|
108
|
+
- Keyboard shortcut: `Ctrl/Cmd + G`
|
|
109
|
+
- Focus on hover enabled (dims non-connected nodes)
|
|
110
|
+
- Radial layout enabled
|
|
111
|
+
- Click outside or press Escape to close
|
|
112
|
+
|
|
113
|
+
## How It Works
|
|
114
|
+
|
|
115
|
+
The Graph component fetches connection data from `/static/contentIndex.json` (generated by the ContentIndex emitter) and renders it using:
|
|
116
|
+
|
|
117
|
+
- **D3** for physics simulation (force-directed layout)
|
|
118
|
+
- **PixiJS** for high-performance WebGL rendering
|
|
119
|
+
|
|
120
|
+
External libraries are loaded from CDN when the graph is first rendered.
|
|
121
|
+
|
|
122
|
+
> [!info]
|
|
123
|
+
> Graph View requires the `ContentIndex` emitter plugin to be present in your Quartz configuration.
|
|
124
|
+
|
|
125
|
+
## Development
|
|
126
|
+
|
|
127
|
+
This is a first-party Quartz community plugin. It serves as both:
|
|
128
|
+
|
|
129
|
+
1. A production-ready Graph View component
|
|
130
|
+
2. A reference implementation for building Quartz community plugins
|
|
131
|
+
|
|
132
|
+
To build locally:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
npm install
|
|
136
|
+
npm run build
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The `prepare` script automatically builds during installation.
|
|
140
|
+
|
|
141
|
+
## Documentation
|
|
142
|
+
|
|
143
|
+
See the [Quartz documentation](https://quartz.jzhao.xyz/features/graph%20view) for more information.
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
MIT
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
// node_modules/@quartz-community/utils/dist/lang.js
|
|
2
|
+
function classNames(...classes) {
|
|
3
|
+
return classes.filter(Boolean).join(" ");
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// src/i18n/locales/en-US.ts
|
|
7
|
+
var en_US_default = {
|
|
8
|
+
components: {
|
|
9
|
+
graph: {
|
|
10
|
+
title: "Graph View"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// src/i18n/locales/en-GB.ts
|
|
16
|
+
var en_GB_default = {
|
|
17
|
+
components: {
|
|
18
|
+
graph: {
|
|
19
|
+
title: "Graph View"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// src/i18n/locales/ar-SA.ts
|
|
25
|
+
var ar_SA_default = {
|
|
26
|
+
components: {
|
|
27
|
+
graph: {
|
|
28
|
+
title: "\u0627\u0644\u062A\u0645\u062B\u064A\u0644 \u0627\u0644\u062A\u0641\u0627\u0639\u0644\u064A"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// src/i18n/locales/ca-ES.ts
|
|
34
|
+
var ca_ES_default = {
|
|
35
|
+
components: {
|
|
36
|
+
graph: {
|
|
37
|
+
title: "Vista Gr\xE0fica"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// src/i18n/locales/cs-CZ.ts
|
|
43
|
+
var cs_CZ_default = {
|
|
44
|
+
components: {
|
|
45
|
+
graph: {
|
|
46
|
+
title: "Graf"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// src/i18n/locales/de-DE.ts
|
|
52
|
+
var de_DE_default = {
|
|
53
|
+
components: {
|
|
54
|
+
graph: {
|
|
55
|
+
title: "Graphansicht"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/i18n/locales/es-ES.ts
|
|
61
|
+
var es_ES_default = {
|
|
62
|
+
components: {
|
|
63
|
+
graph: {
|
|
64
|
+
title: "Vista Gr\xE1fica"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/i18n/locales/fa-IR.ts
|
|
70
|
+
var fa_IR_default = {
|
|
71
|
+
components: {
|
|
72
|
+
graph: {
|
|
73
|
+
title: "\u0646\u0645\u0627\u06CC \u06AF\u0631\u0627\u0641"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// src/i18n/locales/fi-FI.ts
|
|
79
|
+
var fi_FI_default = {
|
|
80
|
+
components: {
|
|
81
|
+
graph: {
|
|
82
|
+
title: "Verkkon\xE4kym\xE4"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// src/i18n/locales/fr-FR.ts
|
|
88
|
+
var fr_FR_default = {
|
|
89
|
+
components: {
|
|
90
|
+
graph: {
|
|
91
|
+
title: "Vue Graphique"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// src/i18n/locales/he-IL.ts
|
|
97
|
+
var he_IL_default = {
|
|
98
|
+
components: {
|
|
99
|
+
graph: {
|
|
100
|
+
title: "\u05DE\u05D1\u05D8 \u05D2\u05E8\u05E3"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// src/i18n/locales/hu-HU.ts
|
|
106
|
+
var hu_HU_default = {
|
|
107
|
+
components: {
|
|
108
|
+
graph: {
|
|
109
|
+
title: "Grafikonn\xE9zet"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// src/i18n/locales/id-ID.ts
|
|
115
|
+
var id_ID_default = {
|
|
116
|
+
components: {
|
|
117
|
+
graph: {
|
|
118
|
+
title: "Tampilan Grafik"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// src/i18n/locales/it-IT.ts
|
|
124
|
+
var it_IT_default = {
|
|
125
|
+
components: {
|
|
126
|
+
graph: {
|
|
127
|
+
title: "Vista grafico"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// src/i18n/locales/ja-JP.ts
|
|
133
|
+
var ja_JP_default = {
|
|
134
|
+
components: {
|
|
135
|
+
graph: {
|
|
136
|
+
title: "\u30B0\u30E9\u30D5\u30D3\u30E5\u30FC"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
// src/i18n/locales/kk-KZ.ts
|
|
142
|
+
var kk_KZ_default = {
|
|
143
|
+
components: {
|
|
144
|
+
graph: {
|
|
145
|
+
title: "\u0413\u0440\u0430\u0444 \u043A\u04E9\u0440\u0456\u043D\u0456\u0441\u0456"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// src/i18n/locales/ko-KR.ts
|
|
151
|
+
var ko_KR_default = {
|
|
152
|
+
components: {
|
|
153
|
+
graph: {
|
|
154
|
+
title: "\uADF8\uB798\uD504 \uBDF0"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// src/i18n/locales/lt-LT.ts
|
|
160
|
+
var lt_LT_default = {
|
|
161
|
+
components: {
|
|
162
|
+
graph: {
|
|
163
|
+
title: "Grafiko Vaizdas"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// src/i18n/locales/nb-NO.ts
|
|
169
|
+
var nb_NO_default = {
|
|
170
|
+
components: {
|
|
171
|
+
graph: {
|
|
172
|
+
title: "Graf-visning"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// src/i18n/locales/nl-NL.ts
|
|
178
|
+
var nl_NL_default = {
|
|
179
|
+
components: {
|
|
180
|
+
graph: {
|
|
181
|
+
title: "Grafiekweergave"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// src/i18n/locales/pl-PL.ts
|
|
187
|
+
var pl_PL_default = {
|
|
188
|
+
components: {
|
|
189
|
+
graph: {
|
|
190
|
+
title: "Graf"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// src/i18n/locales/pt-BR.ts
|
|
196
|
+
var pt_BR_default = {
|
|
197
|
+
components: {
|
|
198
|
+
graph: {
|
|
199
|
+
title: "Vis\xE3o de gr\xE1fico"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// src/i18n/locales/ro-RO.ts
|
|
205
|
+
var ro_RO_default = {
|
|
206
|
+
components: {
|
|
207
|
+
graph: {
|
|
208
|
+
title: "Graf"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
// src/i18n/locales/ru-RU.ts
|
|
214
|
+
var ru_RU_default = {
|
|
215
|
+
components: {
|
|
216
|
+
graph: {
|
|
217
|
+
title: "\u0412\u0438\u0434 \u0433\u0440\u0430\u0444\u0430"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// src/i18n/locales/th-TH.ts
|
|
223
|
+
var th_TH_default = {
|
|
224
|
+
components: {
|
|
225
|
+
graph: {
|
|
226
|
+
title: "\u0E21\u0E38\u0E21\u0E21\u0E2D\u0E07\u0E01\u0E23\u0E32\u0E1F"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
// src/i18n/locales/tr-TR.ts
|
|
232
|
+
var tr_TR_default = {
|
|
233
|
+
components: {
|
|
234
|
+
graph: {
|
|
235
|
+
title: "Grafik G\xF6r\xFCn\xFCm\xFC"
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
// src/i18n/locales/uk-UA.ts
|
|
241
|
+
var uk_UA_default = {
|
|
242
|
+
components: {
|
|
243
|
+
graph: {
|
|
244
|
+
title: "\u0412\u0438\u0433\u043B\u044F\u0434 \u0433\u0440\u0430\u0444\u0430"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// src/i18n/locales/vi-VN.ts
|
|
250
|
+
var vi_VN_default = {
|
|
251
|
+
components: {
|
|
252
|
+
graph: {
|
|
253
|
+
title: "S\u01A1 \u0111\u1ED3"
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// src/i18n/locales/zh-CN.ts
|
|
259
|
+
var zh_CN_default = {
|
|
260
|
+
components: {
|
|
261
|
+
graph: {
|
|
262
|
+
title: "\u5173\u7CFB\u56FE\u8C31"
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
// src/i18n/locales/zh-TW.ts
|
|
268
|
+
var zh_TW_default = {
|
|
269
|
+
components: {
|
|
270
|
+
graph: {
|
|
271
|
+
title: "\u95DC\u4FC2\u5716\u8B5C"
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
// src/i18n/index.ts
|
|
277
|
+
var locales = {
|
|
278
|
+
"en-US": en_US_default,
|
|
279
|
+
"en-GB": en_GB_default,
|
|
280
|
+
"ar-SA": ar_SA_default,
|
|
281
|
+
"ca-ES": ca_ES_default,
|
|
282
|
+
"cs-CZ": cs_CZ_default,
|
|
283
|
+
"de-DE": de_DE_default,
|
|
284
|
+
"es-ES": es_ES_default,
|
|
285
|
+
"fa-IR": fa_IR_default,
|
|
286
|
+
"fi-FI": fi_FI_default,
|
|
287
|
+
"fr-FR": fr_FR_default,
|
|
288
|
+
"he-IL": he_IL_default,
|
|
289
|
+
"hu-HU": hu_HU_default,
|
|
290
|
+
"id-ID": id_ID_default,
|
|
291
|
+
"it-IT": it_IT_default,
|
|
292
|
+
"ja-JP": ja_JP_default,
|
|
293
|
+
"kk-KZ": kk_KZ_default,
|
|
294
|
+
"ko-KR": ko_KR_default,
|
|
295
|
+
"lt-LT": lt_LT_default,
|
|
296
|
+
"nb-NO": nb_NO_default,
|
|
297
|
+
"nl-NL": nl_NL_default,
|
|
298
|
+
"pl-PL": pl_PL_default,
|
|
299
|
+
"pt-BR": pt_BR_default,
|
|
300
|
+
"ro-RO": ro_RO_default,
|
|
301
|
+
"ru-RU": ru_RU_default,
|
|
302
|
+
"th-TH": th_TH_default,
|
|
303
|
+
"tr-TR": tr_TR_default,
|
|
304
|
+
"uk-UA": uk_UA_default,
|
|
305
|
+
"vi-VN": vi_VN_default,
|
|
306
|
+
"zh-CN": zh_CN_default,
|
|
307
|
+
"zh-TW": zh_TW_default
|
|
308
|
+
};
|
|
309
|
+
function i18n(locale) {
|
|
310
|
+
return locales[locale] || en_US_default;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// src/components/styles/graph.scss
|
|
314
|
+
var graph_default = ".graph > h3 {\n font-size: 1rem;\n margin: 0;\n}\n.graph > .graph-outer {\n border-radius: 5px;\n border: 1px solid var(--lightgray);\n box-sizing: border-box;\n height: 250px;\n margin: 0.5em 0;\n position: relative;\n overflow: hidden;\n}\n.graph > .graph-outer > .global-graph-icon {\n cursor: pointer;\n background: none;\n border: none;\n color: var(--dark);\n opacity: 0.5;\n width: 24px;\n height: 24px;\n position: absolute;\n padding: 0.2rem;\n margin: 0.3rem;\n top: 0;\n right: 0;\n border-radius: 4px;\n background-color: transparent;\n transition: background-color 0.5s ease;\n}\n.graph > .graph-outer > .global-graph-icon:hover {\n background-color: var(--lightgray);\n}\n.graph > .global-graph-outer {\n position: fixed;\n z-index: 9999;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100%;\n backdrop-filter: blur(4px);\n display: none;\n overflow: hidden;\n}\n.graph > .global-graph-outer.active {\n display: inline-block;\n}\n.graph > .global-graph-outer > .global-graph-container {\n border: 1px solid var(--lightgray);\n background-color: var(--light);\n border-radius: 5px;\n box-sizing: border-box;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n height: 80vh;\n width: 80vw;\n}\n@media all and (max-width: 800px) {\n .graph > .global-graph-outer > .global-graph-container {\n width: 90%;\n }\n}\n\n.graph-container {\n width: 100%;\n height: 100%;\n}";
|
|
315
|
+
|
|
316
|
+
// src/components/scripts/graph.inline.ts
|
|
317
|
+
var graph_inline_default = `var Ct=Object.hasOwnProperty;var pe,y,Ce,tt,J,fe,ve,Ee,Mu,Bu,du,Ae,Iu,Ru,Ou,rt,ge={},bu=[],nt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Su=Array.isArray;function $(u,e){for(var t in e)u[t]=e[t];return u}function zu(u){u&&u.parentNode&&u.parentNode.removeChild(u)}function Uu(u,e,t,a,o){var n={type:u,props:e,key:t,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++Ce,__i:-1,__u:0};return o==null&&y.vnode!=null&&y.vnode(n),n}function cu(u){return u.children}function yu(u,e){this.props=u,this.context=e}function su(u,e){if(e==null)return u.__?su(u.__,u.__i+1):null;for(var t;e<u.__k.length;e++)if((t=u.__k[e])!=null&&t.__e!=null)return t.__e;return typeof u.type=="function"?su(u):null}function ot(u){if(u.__P&&u.__d){var e=u.__v,t=e.__e,a=[],o=[],n=$({},e);n.__v=e.__v+1,y.vnode&&y.vnode(n),be(u.__P,n,e,u.__n,u.__P.namespaceURI,32&e.__u?[t]:null,a,t??su(e),!!(32&e.__u),o),n.__v=e.__v,n.__.__k[n.__i]=n,Dt(a,n,o),e.__e=e.__=null,n.__e!=t&&me(n)}}function me(u){if((u=u.__)!=null&&u.__c!=null)return u.__e=u.__c.base=null,u.__k.some(function(e){if(e!=null&&e.__e!=null)return u.__e=u.__c.base=e.__e}),me(u)}function _e(u){(!u.__d&&(u.__d=!0)&&J.push(u)&&!xu.__r++||fe!=y.debounceRendering)&&((fe=y.debounceRendering)||ve)(xu)}function xu(){try{for(var u,e=1;J.length;)J.length>e&&J.sort(Ee),u=J.shift(),e=J.length,ot(u)}finally{J.length=xu.__r=0}}function Be(u,e,t,a,o,n,s,c,h,D,_){var r,E,f,b,S,B,p,C=a&&a.__k||bu,M=e.length;for(h=at(t,e,C,h,M),r=0;r<M;r++)(f=t.__k[r])!=null&&(E=f.__i!=-1&&C[f.__i]||ge,f.__i=r,B=be(u,f,E,o,n,s,c,h,D,_),b=f.__e,f.ref&&E.ref!=f.ref&&(E.ref&&Hu(E.ref,null,f),_.push(f.ref,f.__c||b,f)),S==null&&b!=null&&(S=b),(p=!!(4&f.__u))||E.__k===f.__k?(h=ye(f,h,u,p),p&&E.__e&&(E.__e=null)):typeof f.type=="function"&&B!==void 0?h=B:b&&(h=b.nextSibling),f.__u&=-7);return t.__e=S,h}function at(u,e,t,a,o){var n,s,c,h,D,_=t.length,r=_,E=0;for(u.__k=new Array(o),n=0;n<o;n++)(s=e[n])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=u.__k[n]=Uu(null,s,null,null,null):Su(s)?s=u.__k[n]=Uu(cu,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=u.__k[n]=Uu(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):u.__k[n]=s,h=n+E,s.__=u,s.__b=u.__b+1,c=null,(D=s.__i=it(s,t,h,r))!=-1&&(r--,(c=t[D])&&(c.__u|=2)),c==null||c.__v==null?(D==-1&&(o>_?E--:o<_&&E++),typeof s.type!="function"&&(s.__u|=4)):D!=h&&(D==h-1?E--:D==h+1?E++:(D>h?E--:E++,s.__u|=4))):u.__k[n]=null;if(r)for(n=0;n<_;n++)(c=t[n])!=null&&(2&c.__u)==0&&(c.__e==a&&(a=su(c)),Se(c,c));return a}function ye(u,e,t,a){var o,n;if(typeof u.type=="function"){for(o=u.__k,n=0;o&&n<o.length;n++)o[n]&&(o[n].__=u,e=ye(o[n],e,t,a));return e}u.__e!=e&&(a&&(e&&u.type&&!e.parentNode&&(e=su(u)),t.insertBefore(u.__e,e||null)),e=u.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function it(u,e,t,a){var o,n,s,c=u.key,h=u.type,D=e[t],_=D!=null&&(2&D.__u)==0;if(D===null&&c==null||_&&c==D.key&&h==D.type)return t;if(a>(_?1:0)){for(o=t-1,n=t+1;o>=0||n<e.length;)if((D=e[s=o>=0?o--:n++])!=null&&(2&D.__u)==0&&c==D.key&&h==D.type)return s}return-1}function de(u,e,t){e[0]=="-"?u.setProperty(e,t??""):u[e]=t==null?"":typeof t!="number"||nt.test(e)?t:t+"px"}function mu(u,e,t,a,o){var n,s;u:if(e=="style")if(typeof t=="string")u.style.cssText=t;else{if(typeof a=="string"&&(u.style.cssText=a=""),a)for(e in a)t&&e in t||de(u.style,e,"");if(t)for(e in t)a&&t[e]==a[e]||de(u.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(Ae,"$1")),s=e.toLowerCase(),e=s in u||e=="onFocusOut"||e=="onFocusIn"?s.slice(2):e.slice(2),u.l||(u.l={}),u.l[e+n]=t,t?a?t[du]=a[du]:(t[du]=Iu,u.addEventListener(e,n?Ou:Ru,n)):u.removeEventListener(e,n?Ou:Ru,n);else{if(o=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in u)try{u[e]=t??"";break u}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?u.removeAttribute(e):u.setAttribute(e,e=="popover"&&t==1?"":t))}}function he(u){return function(e){if(this.l){var t=this.l[e.type+u];if(e[Bu]==null)e[Bu]=Iu++;else if(e[Bu]<t[du])return;return t(y.event?y.event(e):e)}}}function be(u,e,t,a,o,n,s,c,h,D){var _,r,E,f,b,S,B,p,C,M,G,I,Q,X,uu,T=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(h=!!(32&t.__u),n=[c=e.__e=t.__e]),(_=y.__b)&&_(e);u:if(typeof T=="function")try{if(p=e.props,C=T.prototype&&T.prototype.render,M=(_=T.contextType)&&a[_.__c],G=_?M?M.props.value:_.__:a,t.__c?B=(r=e.__c=t.__c).__=r.__E:(C?e.__c=r=new T(p,G):(e.__c=r=new yu(p,G),r.constructor=T,r.render=st),M&&M.sub(r),r.state||(r.state={}),r.__n=a,E=r.__d=!0,r.__h=[],r._sb=[]),C&&r.__s==null&&(r.__s=r.state),C&&T.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=$({},r.__s)),$(r.__s,T.getDerivedStateFromProps(p,r.__s))),f=r.props,b=r.state,r.__v=e,E)C&&T.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),C&&r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(C&&T.getDerivedStateFromProps==null&&p!==f&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(p,G),e.__v==t.__v||!r.__e&&r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(p,r.__s,G)===!1){e.__v!=t.__v&&(r.props=p,r.state=r.__s,r.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(V){V&&(V.__=e)}),bu.push.apply(r.__h,r._sb),r._sb=[],r.__h.length&&s.push(r);break u}r.componentWillUpdate!=null&&r.componentWillUpdate(p,r.__s,G),C&&r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(f,b,S)})}if(r.context=G,r.props=p,r.__P=u,r.__e=!1,I=y.__r,Q=0,C)r.state=r.__s,r.__d=!1,I&&I(e),_=r.render(r.props,r.state,r.context),bu.push.apply(r.__h,r._sb),r._sb=[];else do r.__d=!1,I&&I(e),_=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++Q<25);r.state=r.__s,r.getChildContext!=null&&(a=$($({},a),r.getChildContext())),C&&!E&&r.getSnapshotBeforeUpdate!=null&&(S=r.getSnapshotBeforeUpdate(f,b)),X=_!=null&&_.type===cu&&_.key==null?xe(_.props.children):_,c=Be(u,Su(X)?X:[X],e,t,a,o,n,s,c,h,D),r.base=e.__e,e.__u&=-161,r.__h.length&&s.push(r),B&&(r.__E=r.__=null)}catch(V){if(e.__v=null,h||n!=null)if(V.then){for(e.__u|=h?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;n[n.indexOf(c)]=null,e.__e=c}else{for(uu=n.length;uu--;)zu(n[uu]);Gu(e)}else e.__e=t.__e,e.__k=t.__k,V.then||Gu(e);y.__e(V,e,t)}else n==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):c=e.__e=lt(t.__e,e,t,a,o,n,s,h,D);return(_=y.diffed)&&_(e),128&e.__u?void 0:c}function Gu(u){u&&(u.__c&&(u.__c.__e=!0),u.__k&&u.__k.some(Gu))}function Dt(u,e,t){for(var a=0;a<t.length;a++)Hu(t[a],t[++a],t[++a]);y.__c&&y.__c(e,u),u.some(function(o){try{u=o.__h,o.__h=[],u.some(function(n){n.call(o)})}catch(n){y.__e(n,o.__v)}})}function xe(u){return typeof u!="object"||u==null||u.__b>0?u:Su(u)?u.map(xe):$({},u)}function lt(u,e,t,a,o,n,s,c,h){var D,_,r,E,f,b,S,B=t.props||ge,p=e.props,C=e.type;if(C=="svg"?o="http://www.w3.org/2000/svg":C=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),n!=null){for(D=0;D<n.length;D++)if((f=n[D])&&"setAttribute"in f==!!C&&(C?f.localName==C:f.nodeType==3)){u=f,n[D]=null;break}}if(u==null){if(C==null)return document.createTextNode(p);u=document.createElementNS(o,C,p.is&&p),c&&(y.__m&&y.__m(e,n),c=!1),n=null}if(C==null)B===p||c&&u.data==p||(u.data=p);else{if(n=n&&pe.call(u.childNodes),!c&&n!=null)for(B={},D=0;D<u.attributes.length;D++)B[(f=u.attributes[D]).name]=f.value;for(D in B)f=B[D],D=="dangerouslySetInnerHTML"?r=f:D=="children"||D in p||D=="value"&&"defaultValue"in p||D=="checked"&&"defaultChecked"in p||mu(u,D,null,f,o);for(D in p)f=p[D],D=="children"?E=f:D=="dangerouslySetInnerHTML"?_=f:D=="value"?b=f:D=="checked"?S=f:c&&typeof f!="function"||B[D]===f||mu(u,D,f,B[D],o);if(_)c||r&&(_.__html==r.__html||_.__html==u.innerHTML)||(u.innerHTML=_.__html),e.__k=[];else if(r&&(u.innerHTML=""),Be(e.type=="template"?u.content:u,Su(E)?E:[E],e,t,a,C=="foreignObject"?"http://www.w3.org/1999/xhtml":o,n,s,n?n[0]:t.__k&&su(t,0),c,h),n!=null)for(D=n.length;D--;)zu(n[D]);c||(D="value",C=="progress"&&b==null?u.removeAttribute("value"):b!=null&&(b!==u[D]||C=="progress"&&!b||C=="option"&&b!=B[D])&&mu(u,D,b,B[D],o),D="checked",S!=null&&S!=u[D]&&mu(u,D,S,B[D],o))}return u}function Hu(u,e,t){try{if(typeof u=="function"){var a=typeof u.__u=="function";a&&u.__u(),a&&e==null||(u.__u=u(e))}else u.current=e}catch(o){y.__e(o,t)}}function Se(u,e,t){var a,o;if(y.unmount&&y.unmount(u),(a=u.ref)&&(a.current&&a.current!=u.__e||Hu(a,null,e)),(a=u.__c)!=null){if(a.componentWillUnmount)try{a.componentWillUnmount()}catch(n){y.__e(n,e)}a.base=a.__P=null}if(a=u.__k)for(o=0;o<a.length;o++)a[o]&&Se(a[o],e,t||typeof u.type!="function");t||zu(u.__e),u.__c=u.__=u.__e=void 0}function st(u,e,t){return this.constructor(u,t)}pe=bu.slice,y={__e:function(u,e,t,a){for(var o,n,s;e=e.__;)if((o=e.__c)&&!o.__)try{if((n=o.constructor)&&n.getDerivedStateFromError!=null&&(o.setState(n.getDerivedStateFromError(u)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(u,a||{}),s=o.__d),s)return o.__E=o}catch(c){u=c}throw u}},Ce=0,tt=function(u){return u!=null&&u.constructor===void 0},yu.prototype.setState=function(u,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=$({},this.state),typeof u=="function"&&(u=u($({},t),this.props)),u&&$(t,u),u!=null&&this.__v&&(e&&this._sb.push(e),_e(this))},yu.prototype.forceUpdate=function(u){this.__v&&(this.__e=!0,u&&this.__h.push(u),_e(this))},yu.prototype.render=cu,J=[],ve=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ee=function(u,e){return u.__v.__b-e.__v.__b},xu.__r=0,Mu=Math.random().toString(8),Bu="__d"+Mu,du="__a"+Mu,Ae=/(PointerCapture)$|Capture$/i,Iu=0,Ru=he(!1),Ou=he(!0),rt=0;function Fu(u){let e=_t(ft(u,"index"),!0);return e.length===0?"/":e}function we(){let u=window.location.pathname;return u.endsWith("/")&&(u=u.slice(0,-1)),u.startsWith("/")&&(u=u.slice(1)),u}function Nu(){return typeof document>"u"?"":document.body?.dataset?.basepath??""}function $u(u,e){let t=e??Nu(),a=u.startsWith("/")?u:"/"+u;return t+a}function Ft(u,e){return u===e||u.endsWith("/"+e)}function ft(u,e){return Ft(u,e)&&(u=u.slice(0,-e.length)),u}function _t(u,e){return u.startsWith("/")&&(u=u.substring(1)),!e&&u.endsWith("/")&&(u=u.slice(0,-1)),u}function ke(u){for(;u.firstChild;)u.removeChild(u.firstChild)}(function(){function u(){var a=we(),o=Nu();return o&&a.startsWith(o.replace(/^\\//,""))&&(a=a.slice(o.replace(/^\\//,"").length),a.startsWith("/")&&(a=a.slice(1))),a}function e(a){var o=document.querySelector('script[src="'+a+'"]');return o?Promise.resolve():new Promise(function(n,s){var c=document.createElement("script");c.src=a,c.crossOrigin="anonymous",c.onload=n,c.onerror=s,document.head.appendChild(c)})}Promise.all([e("https://cdn.jsdelivr.net/npm/d3@7/dist/d3.min.js"),e("https://cdn.jsdelivr.net/npm/pixi.js@8/dist/pixi.js")]).then(function(){t()}).catch(function(a){console.error("[Graph] Failed to load libraries:",a);for(var o=document.querySelectorAll(".graph-container"),n=0;n<o.length;n++)o[n].textContent="Graph could not load. Check your network connection.",o[n].style.display="flex",o[n].style.alignItems="center",o[n].style.justifyContent="center",o[n].style.color="var(--gray)",o[n].style.fontSize="0.9rem"});function t(){var a=window.d3,o=window.PIXI;if(!a||!o){console.error("[Graph] Libraries not loaded");return}var n="graph-visited";function s(){return new Set(JSON.parse(localStorage.getItem(n)||"[]"))}function c(d){var w=s();w.add(d),localStorage.setItem(n,JSON.stringify(Array.from(w)))}function h(d,w){if(!d)return w;var g=document.createElement("div");g.style.color=d,g.style.position="absolute",g.style.visibility="hidden",document.body.appendChild(g);var m=getComputedStyle(g).color;return g.remove(),m||w}async function D(d,w,g){var m=Fu(w);m===""&&(m="index");var q=s();if(ke(d),g!==void 0&&g!==E)return console.log("[Graph] Stale render, skipping"),function(){};var x=JSON.parse(d.dataset.cfg||"{}"),fu=x.drag,Le=x.zoom,Vu=x.depth,qu=x.scale||1,Pe=x.repelForce||.5,je=x.centerForce||.3,Te=x.linkDistance||30,We=x.fontSize||.6,Me=x.opacityScale||1,Ue=x.removeTags||[],Re=x.showTags,Oe=x.focusOnHover,Ge=x.enableRadial,eu;try{var Ku=await fetchData;eu=new Map;for(var Ju in Ku)eu.set(Fu(Ju),Ku[Ju])}catch(i){return console.error("[Graph] Error loading data:",i),function(){}}var R=d.offsetWidth,O=Math.max(d.offsetHeight,250),tu=[],hu=[],Xu=new Set(eu.keys());eu.forEach(function(i,l){for(var F=i.links||[],A=0;A<F.length;A++){var v=Fu(F[A]);Xu.has(v)&&tu.push({source:l,target:v})}if(Re)for(var j=i.tags||[],A=0;A<j.length;A++){var N=j[A];if(Ue.indexOf(N)===-1){var K=Fu("tags/"+N);hu.indexOf(K)===-1&&hu.push(K),tu.push({source:l,target:K})}}});var ru=new Set;if(Vu>=0)for(var pu=[m],Cu=new Set([m]),Yu=0;Yu<=Vu&&pu.length>0;Yu++){for(var wu=[],ku=0;ku<pu.length;ku++){var Lu=pu[ku];ru.add(Lu);for(var Pu=0;Pu<tu.length;Pu++){var W=tu[Pu];W.source===Lu&&!Cu.has(W.target)&&(Cu.add(W.target),wu.push(W.target)),W.target===Lu&&!Cu.has(W.source)&&(Cu.add(W.source),wu.push(W.source))}}pu=wu}else{Xu.forEach(function(i){ru.add(i)});for(var k=0;k<hu.length;k++)ru.add(hu[k])}var nu=[],ju=new Map;ru.forEach(function(i){var l=i.startsWith("tags/"),F=l?"#"+i.substring(5):eu.get(i)?.title||i,A=l?[]:eu.get(i)?.tags||[],v={id:i,text:F,tags:A,x:Math.random()*R-R/2,y:Math.random()*O-O/2,vx:0,vy:0};nu.push(v),ju.set(i,v)});for(var H=[],k=0;k<tu.length;k++){var W=tu[k];if(ru.has(W.source)&&ru.has(W.target)){var Zu=ju.get(W.source),Qu=ju.get(W.target);Zu&&Qu&&H.push({source:Zu,target:Qu})}}var Y=getComputedStyle(document.documentElement),Ie=h(Y.getPropertyValue("--secondary").trim(),"#c792ea"),ue=h(Y.getPropertyValue("--tertiary").trim(),"#82aaff"),ee=h(Y.getPropertyValue("--gray").trim(),"#6c6c6c"),te=h(Y.getPropertyValue("--lightgray").trim(),"#d4d4d4"),ze=h(Y.getPropertyValue("--dark").trim(),"#1a1a1a"),He=h(Y.getPropertyValue("--light").trim(),"#f5f5f5"),Ne=Y.getPropertyValue("--bodyFont").trim()||"inherit",Z=new o.Application;await Z.init({width:R,height:O,antialias:!0,backgroundAlpha:0,resolution:window.devicePixelRatio||1,autoDensity:!0,eventMode:"static"}),d.appendChild(Z.canvas);var ou=new o.Container;Z.stage.addChild(ou);var au=a.forceSimulation(nu).force("charge",a.forceManyBody().strength(-100*Pe)).force("center",a.forceCenter().strength(je)).force("link",a.forceLink(H).distance(Te)).force("collide",a.forceCollide().radius(function(i){for(var l=0,F=0;F<H.length;F++)(H[F].source.id===i.id||H[F].target.id===i.id)&&l++;return 2+Math.sqrt(l)}).iterations(3));if(Ge){var Tu=Math.min(R,O)/2*.8;au.force("radial",a.forceRadial(Tu).strength(.2))}var re=new o.Container,ne=new o.Container,vu=new o.Container;ou.addChild(re),ou.addChild(ne),ou.addChild(vu);var L=[],z=[],_u=null,iu=new Set,oe=0,Eu=!1,P=a.zoomIdentity;function ae(i){for(var l=0,F=0;F<H.length;F++)(H[F].source.id===i.id||H[F].target.id===i.id)&&l++;return 2+Math.sqrt(l)}function $e(i){var l=i.id===m;return l?Ie:q.has(i.id)||i.id.startsWith("tags/")?ue:ee}function Wu(i){if(_u=i,i===null){iu=new Set;for(var l=0;l<L.length;l++)L[l].active=!1;for(var l=0;l<z.length;l++)z[l].active=!1}else{iu=new Set;for(var l=0;l<z.length;l++){var F=z[l].simulationData;F.source.id===i||F.target.id===i?(iu.add(F.source.id),iu.add(F.target.id),z[l].active=!0):z[l].active=!1}iu.add(i);for(var l=0;l<L.length;l++)iu.has(L[l].simulationData.id)?L[l].active=!0:L[l].active=!1}}function Ve(){for(var i=0;i<z.length;i++){var l=z[i],F=1;_u!==null&&(F=l.active?1:.2),l.alpha=F,l.color=l.active?ee:te}}function qe(){for(var i=1/qu,l=i*1.1,F=0;F<L.length;F++){var A=L[F];_u===A.simulationData.id?(A.label.alpha=1,A.label.scale.set(l)):A.label.scale.set(i)}}function Ke(){for(var i=0;i<L.length;i++){var l=L[i],F=1;_u!==null&&Oe&&(F=l.active?1:.2),l.gfx.alpha=F}}function Au(){Ke(),Ve(),qe()}for(var k=0;k<nu.length;k++){var Du=nu[k],ie=Du.id,De=ie.startsWith("tags/"),Tu=ae(Du),le=$e(Du),lu=new o.Text({text:Du.text,style:{fontSize:We*15,fill:ze,fontFamily:Ne},resolution:window.devicePixelRatio*4});lu.anchor.set(.5,1.2),lu.alpha=0,lu.scale.set(1/qu),vu.addChild(lu);var U=new o.Graphics;U.circle(0,0,Tu),U.fill({color:De?He:le}),De&&U.stroke({width:2,color:ue}),U.eventMode="static",U.cursor="pointer",U.label=ie,(function(F,A,v){var j=0;A.on("pointerover",function(N){Wu(F.id),j=v.alpha,Eu||Au()}),A.on("pointerleave",function(){Wu(null),v.alpha=j,Eu||Au()})})(Du,U,lu),ne.addChild(U),L.push({simulationData:Du,gfx:U,label:lu,color:le,alpha:1,active:!1})}for(var k=0;k<H.length;k++){var W=H[k],U=new o.Graphics;U.eventMode="none",re.addChild(U),z.push({simulationData:W,gfx:U,color:te,alpha:1,active:!1})}if(fu){var Je=function(i){for(var l=(i.x-P.x)/P.k,F=(i.y-P.y)/P.k,A=0;A<nu.length;A++){var v=nu[A],j=l-v.x-R/2,N=F-v.y-O/2,K=Math.sqrt(j*j+N*N),gu=ae(v);if(K<gu+5)return v}return null},Xe=function(i){i.active||au.alphaTarget(1).restart(),i.subject.fx=i.subject.x,i.subject.fy=i.subject.y;var l=(i.x-P.x)/P.k-R/2,F=(i.y-P.y)/P.k-O/2;i.subject.__dragOffset={x:l-i.subject.x,y:F-i.subject.y},oe=Date.now(),Eu=!0,_u=i.subject.id},Ye=function(i){var l=(i.x-P.x)/P.k-R/2,F=(i.y-P.y)/P.k-O/2;i.subject.fx=l-i.subject.__dragOffset.x,i.subject.fy=F-i.subject.__dragOffset.y},Ze=function(i){if(i.active||au.alphaTarget(0),i.subject.fx=null,i.subject.fy=null,Eu=!1,Wu(null),Au(),Date.now()-oe<500){var l=$u(i.subject.id);window.location.href=l}},Qe=a.drag().container(Z.canvas).subject(Je).on("start",Xe).on("drag",Ye).on("end",Ze);a.select(Z.canvas).call(Qe)}else for(var k=0;k<L.length;k++)(function(l){l.gfx.on("click",function(){var F=$u(l.simulationData.id);window.location.href=F})})(L[k]);if(Le){var ut=function(i){P=i.transform,ou.scale.set(P.k,P.k),ou.position.set(P.x,P.y);for(var l=P.k*Me,F=Math.max((l-1)/3.75,0),A=[],v=0;v<L.length;v++)L[v].active&&A.push(L[v].label);for(var v=0;v<vu.children.length;v++){var j=vu.children[v];A.indexOf(j)===-1&&(j.alpha=F)}},et=a.zoom().extent([[0,0],[R,O]]).scaleExtent([.25,4]).on("zoom",ut);a.select(Z.canvas).call(et)}var se=!1;function ce(){if(!se){for(var i=0;i<L.length;i++){var l=L[i],F=l.simulationData.x,A=l.simulationData.y;F!=null&&A!=null&&(l.gfx.position.set(F+R/2,A+O/2),l.label&&l.label.position.set(F+R/2,A+O/2))}for(var i=0;i<z.length;i++){var v=z[i],j=v.simulationData,N=j.source.x,K=j.source.y,gu=j.target.x,Fe=j.target.y;N!=null&&K!=null&&gu!=null&&Fe!=null&&(v.gfx.clear(),v.gfx.moveTo(N+R/2,K+O/2),v.gfx.lineTo(gu+R/2,Fe+O/2),v.gfx.stroke({alpha:v.alpha,width:1,color:v.color}))}requestAnimationFrame(ce)}}return au.on("tick",function(){}),au.restart(),Au(),ce(),function(){se=!0,au.stop();try{Z.destroy(!0)}catch{}}}var _=[],r=[],E=0;function f(){for(var d=0;d<_.length;d++)_[d]();_=[]}function b(){for(var d=0;d<r.length;d++)r[d]();r=[]}var S=[],B=[],p=null,C=null,M=null;function G(){b();for(var d=0;d<S.length;d++){S[d].classList.remove("active");var w=S[d].closest(".sidebar");w&&(w.style.zIndex="")}}function I(){for(var d=0;d<S.length;d++)if(S[d].classList.contains("active"))return!0;return!1}function Q(){b();for(var d=u(),w=0;w<S.length;w++){var g=S[w];g.classList.add("active");var m=g.closest(".sidebar");m&&(m.style.zIndex="1");var q=g.querySelector(".global-graph-container");q&&(function(x){D(x,d,void 0).then(function(fu){r.push(fu)}).catch(function(fu){console.error("[Graph] Global render error:",fu)})})(q)}}function X(){I()?G():Q()}function uu(){f();var d=++E,w=u();c(w);for(var g=document.querySelectorAll(".graph-container"),m=0;m<g.length;m++)(function(q){D(q,w,d).then(function(x){d===E&&_.push(x)}).catch(function(x){console.error("[Graph] Local render error:",x)})})(g[m])}function T(d){var w=d.detail?d.detail.url:u();if(c(Fu(w)),uu(),S=Array.from(document.querySelectorAll(".global-graph-outer")),M)for(var g=0;g<B.length;g++)B[g].removeEventListener("click",M);B=Array.from(document.querySelectorAll(".global-graph-icon")),M=function(){X()};for(var g=0;g<B.length;g++)B[g].addEventListener("click",M);p&&document.removeEventListener("click",p),p=function(m){if(I()){var q=m.target.closest(".global-graph-container"),x=m.target.closest(".global-graph-icon");!q&&!x&&G()}},document.addEventListener("click",p),C&&document.removeEventListener("keydown",C),C=function(m){if(m.key==="Escape"){I()&&G();return}m.key==="g"&&(m.ctrlKey||m.metaKey)&&!m.shiftKey&&(m.preventDefault(),X())},document.addEventListener("keydown",C),I()&&Q()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){T({detail:{url:u()}})}):T({detail:{url:u()}}),document.addEventListener("prenav",function(){f(),b()}),document.addEventListener("nav",T),document.addEventListener("render",T);function V(){uu(),I()&&Q()}document.addEventListener("themechange",V)}})();
|
|
318
|
+
`;
|
|
319
|
+
var l;
|
|
320
|
+
l = { __e: function(n2, l2, u3, t2) {
|
|
321
|
+
for (var i2, r2, o2; l2 = l2.__; ) if ((i2 = l2.__c) && !i2.__) try {
|
|
322
|
+
if ((r2 = i2.constructor) && null != r2.getDerivedStateFromError && (i2.setState(r2.getDerivedStateFromError(n2)), o2 = i2.__d), null != i2.componentDidCatch && (i2.componentDidCatch(n2, t2 || {}), o2 = i2.__d), o2) return i2.__E = i2;
|
|
323
|
+
} catch (l3) {
|
|
324
|
+
n2 = l3;
|
|
325
|
+
}
|
|
326
|
+
throw n2;
|
|
327
|
+
} }, "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Math.random().toString(8);
|
|
328
|
+
|
|
329
|
+
// node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
|
|
330
|
+
var f2 = 0;
|
|
331
|
+
function u2(e2, t2, n2, o2, i2, u3) {
|
|
332
|
+
t2 || (t2 = {});
|
|
333
|
+
var a2, c2, p2 = t2;
|
|
334
|
+
if ("ref" in p2) for (c2 in p2 = {}, t2) "ref" == c2 ? a2 = t2[c2] : p2[c2] = t2[c2];
|
|
335
|
+
var l2 = { type: e2, props: p2, key: n2, ref: a2, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --f2, __i: -1, __u: 0, __source: i2, __self: u3 };
|
|
336
|
+
if ("function" == typeof e2 && (a2 = e2.defaultProps)) for (c2 in a2) void 0 === p2[c2] && (p2[c2] = a2[c2]);
|
|
337
|
+
return l.vnode && l.vnode(l2), l2;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// src/components/Graph.tsx
|
|
341
|
+
var defaultOptions = {
|
|
342
|
+
localGraph: {
|
|
343
|
+
drag: true,
|
|
344
|
+
zoom: true,
|
|
345
|
+
depth: 1,
|
|
346
|
+
scale: 1.1,
|
|
347
|
+
repelForce: 0.5,
|
|
348
|
+
centerForce: 0.3,
|
|
349
|
+
linkDistance: 30,
|
|
350
|
+
fontSize: 0.6,
|
|
351
|
+
opacityScale: 1,
|
|
352
|
+
showTags: true,
|
|
353
|
+
removeTags: [],
|
|
354
|
+
focusOnHover: false,
|
|
355
|
+
enableRadial: false
|
|
356
|
+
},
|
|
357
|
+
globalGraph: {
|
|
358
|
+
drag: true,
|
|
359
|
+
zoom: true,
|
|
360
|
+
depth: -1,
|
|
361
|
+
scale: 0.9,
|
|
362
|
+
repelForce: 0.5,
|
|
363
|
+
centerForce: 0.2,
|
|
364
|
+
linkDistance: 30,
|
|
365
|
+
fontSize: 0.6,
|
|
366
|
+
opacityScale: 1,
|
|
367
|
+
showTags: true,
|
|
368
|
+
removeTags: [],
|
|
369
|
+
focusOnHover: true,
|
|
370
|
+
enableRadial: true
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
var Graph_default = ((userOpts) => {
|
|
374
|
+
const Graph = ({ displayClass, cfg }) => {
|
|
375
|
+
const localGraph = { ...defaultOptions.localGraph, ...userOpts?.localGraph };
|
|
376
|
+
const globalGraph = { ...defaultOptions.globalGraph, ...userOpts?.globalGraph };
|
|
377
|
+
return /* @__PURE__ */ u2("div", { class: classNames(displayClass, "graph"), children: [
|
|
378
|
+
/* @__PURE__ */ u2("h3", { children: i18n(cfg.locale ?? "en-US").components.graph.title }),
|
|
379
|
+
/* @__PURE__ */ u2("div", { class: "graph-outer", children: [
|
|
380
|
+
/* @__PURE__ */ u2("div", { class: "graph-container", "data-cfg": JSON.stringify(localGraph) }),
|
|
381
|
+
/* @__PURE__ */ u2("button", { class: "global-graph-icon", "aria-label": "Global Graph", children: /* @__PURE__ */ u2(
|
|
382
|
+
"svg",
|
|
383
|
+
{
|
|
384
|
+
version: "1.1",
|
|
385
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
386
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
387
|
+
x: "0px",
|
|
388
|
+
y: "0px",
|
|
389
|
+
viewBox: "0 0 55 55",
|
|
390
|
+
fill: "currentColor",
|
|
391
|
+
xmlSpace: "preserve",
|
|
392
|
+
children: /* @__PURE__ */ u2(
|
|
393
|
+
"path",
|
|
394
|
+
{
|
|
395
|
+
d: "M49,0c-3.309,0-6,2.691-6,6c0,1.035,0.263,2.009,0.726,2.86l-9.829,9.829C32.542,17.634,30.846,17,29,17\n s-3.542,0.634-4.898,1.688l-7.669-7.669C16.785,10.424,17,9.74,17,9c0-2.206-1.794-4-4-4S9,6.794,9,9s1.794,4,4,4\n c0.74,0,1.424-0.215,2.019-0.567l7.669,7.669C21.634,21.458,21,23.154,21,25s0.634,3.542,1.688,4.897L10.024,42.562\n C8.958,41.595,7.549,41,6,41c-3.309,0-6,2.691-6,6s2.691,6,6,6s6-2.691,6-6c0-1.035-0.263-2.009-0.726-2.86l12.829-12.829\n c1.106,0.86,2.44,1.436,3.898,1.619v10.16c-2.833,0.478-5,2.942-5,5.91c0,3.309,2.691,6,6,6s6-2.691,6-6c0-2.967-2.167-5.431-5-5.91\n v-10.16c1.458-0.183,2.792-0.759,3.898-1.619l7.669,7.669C41.215,39.576,41,40.26,41,41c0,2.206,1.794,4,4,4s4-1.794,4-4\n s-1.794-4-4-4c-0.74,0-1.424,0.215-2.019,0.567l-7.669-7.669C36.366,28.542,37,26.846,37,25s-0.634-3.542-1.688-4.897l9.665-9.665\n C46.042,11.405,47.451,12,49,12c3.309,0,6-2.691,6-6S52.309,0,49,0z M11,9c0-1.103,0.897-2,2-2s2,0.897,2,2s-0.897,2-2,2\n S11,10.103,11,9z M6,51c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S8.206,51,6,51z M33,49c0,2.206-1.794,4-4,4s-4-1.794-4-4\n s1.794-4,4-4S33,46.794,33,49z M29,31c-3.309,0-6-2.691-6-6s2.691-6,6-6s6,2.691,6,6S32.309,31,29,31z M47,41c0,1.103-0.897,2-2,2\n s-2-0.897-2-2s0.897-2,2-2S47,39.897,47,41z M49,10c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S51.206,10,49,10z"
|
|
396
|
+
}
|
|
397
|
+
)
|
|
398
|
+
}
|
|
399
|
+
) })
|
|
400
|
+
] }),
|
|
401
|
+
/* @__PURE__ */ u2("div", { class: "global-graph-outer", children: /* @__PURE__ */ u2("div", { class: "global-graph-container", "data-cfg": JSON.stringify(globalGraph) }) })
|
|
402
|
+
] });
|
|
403
|
+
};
|
|
404
|
+
Graph.css = graph_default;
|
|
405
|
+
Graph.afterDOMLoaded = graph_inline_default;
|
|
406
|
+
return Graph;
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
export { Graph_default as Graph };
|
|
410
|
+
//# sourceMappingURL=index.js.map
|
|
411
|
+
//# sourceMappingURL=index.js.map
|