@lapis-notes/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.
Files changed (51) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE.md +8 -0
  3. package/README.md +20 -0
  4. package/dist/embed.d.ts +5 -0
  5. package/dist/embed.js +4 -0
  6. package/dist/graph-build-generation.d.ts +6 -0
  7. package/dist/graph-build-generation.js +13 -0
  8. package/dist/graph-controls-overlay.svelte +840 -0
  9. package/dist/graph-controls-overlay.svelte.d.ts +30 -0
  10. package/dist/graph-data-coordinator.d.ts +41 -0
  11. package/dist/graph-data-coordinator.js +265 -0
  12. package/dist/graph-data.d.ts +23 -0
  13. package/dist/graph-data.js +493 -0
  14. package/dist/graph-embed.svelte +92 -0
  15. package/dist/graph-embed.svelte.d.ts +12 -0
  16. package/dist/graph-file-preview.svelte +115 -0
  17. package/dist/graph-file-preview.svelte.d.ts +12 -0
  18. package/dist/graph-hover-intent.d.ts +22 -0
  19. package/dist/graph-hover-intent.js +85 -0
  20. package/dist/graph-load-alignment.d.ts +2 -0
  21. package/dist/graph-load-alignment.js +3 -0
  22. package/dist/graph-navigation.d.ts +7 -0
  23. package/dist/graph-navigation.js +78 -0
  24. package/dist/graph-node-activation.d.ts +4 -0
  25. package/dist/graph-node-activation.js +16 -0
  26. package/dist/graph-plugin.d.ts +38 -0
  27. package/dist/graph-plugin.js +177 -0
  28. package/dist/graph-problems.d.ts +15 -0
  29. package/dist/graph-problems.js +46 -0
  30. package/dist/graph-query-resolution.d.ts +9 -0
  31. package/dist/graph-query-resolution.js +44 -0
  32. package/dist/graph-renderer.d.ts +226 -0
  33. package/dist/graph-renderer.js +1350 -0
  34. package/dist/graph-settings.d.ts +20 -0
  35. package/dist/graph-settings.js +125 -0
  36. package/dist/graph-types.d.ts +74 -0
  37. package/dist/graph-types.js +1 -0
  38. package/dist/graph-view.d.ts +62 -0
  39. package/dist/graph-view.js +553 -0
  40. package/dist/graph-viewport-alignment.d.ts +6 -0
  41. package/dist/graph-viewport-alignment.js +9 -0
  42. package/dist/index.d.ts +9 -0
  43. package/dist/index.js +8 -0
  44. package/dist/mount-local-component.svelte.d.ts +7 -0
  45. package/dist/mount-local-component.svelte.js +12 -0
  46. package/dist/public-components.d.ts +2 -0
  47. package/dist/public-components.js +2 -0
  48. package/dist/styles.css +441 -0
  49. package/manifest.json +30 -0
  50. package/package.json +84 -0
  51. package/styles.css +1 -0
@@ -0,0 +1,441 @@
1
+ .graph-view {
2
+ --ui-graph-surface-background: var(
3
+ --ui-workspace-view-background,
4
+ var(--background)
5
+ );
6
+ --ui-graph-surface-foreground: var(
7
+ --ui-workspace-view-foreground,
8
+ var(--foreground)
9
+ );
10
+ --ui-graph-surface-border: var(--ui-workspace-view-border, var(--border));
11
+ --graph-text: var(--ui-graph-surface-foreground);
12
+ --graph-line: var(--input, #d4d4d4);
13
+ --graph-node: var(--muted-foreground);
14
+ --graph-node-unresolved: color-mix(
15
+ in srgb,
16
+ var(--graph-node) 50%,
17
+ var(--ui-graph-surface-background)
18
+ );
19
+ --graph-node-focused: var(--ring, var(--primary));
20
+ --graph-node-tag: var(--success, #16a34a);
21
+ --graph-node-attachment: #e0ac00;
22
+ --ui-graph-link: var(--graph-line);
23
+ --ui-graph-link-active: var(--graph-node-focused);
24
+ --ui-graph-node-note: var(--graph-node);
25
+ --ui-graph-node-attachment: var(--graph-node-attachment);
26
+ --ui-graph-node-tag: var(--graph-node-tag);
27
+ --ui-graph-node-unresolved: var(--graph-node-unresolved);
28
+ --ui-graph-node-neutral: var(--graph-node);
29
+ --ui-graph-node-label: var(--graph-text);
30
+ --ui-graph-node-label-hover: var(--graph-text);
31
+ --ui-graph-node-stroke: var(--ui-graph-surface-background);
32
+ --ui-graph-node-active-stroke: var(--graph-node-focused);
33
+ --ui-graph-node-focus-ring: var(--ring, var(--ui-graph-surface-foreground));
34
+ --ui-graph-stats-background: color-mix(
35
+ in srgb,
36
+ var(--ui-graph-surface-background) 90%,
37
+ transparent
38
+ );
39
+ --ui-graph-stats-foreground: var(--muted-foreground);
40
+ --ui-graph-controls-background: var(
41
+ --popover,
42
+ var(--ui-graph-surface-background)
43
+ );
44
+ --ui-graph-controls-foreground: var(
45
+ --popover-foreground,
46
+ var(--ui-graph-surface-foreground)
47
+ );
48
+ --ui-graph-controls-border: var(--ui-graph-surface-border);
49
+ --ui-graph-controls-hover: var(--muted);
50
+ --ui-graph-controls-muted: var(--muted-foreground);
51
+ --ui-sortable-array-item-focus-background: var(--ui-graph-controls-hover);
52
+ --ui-sortable-array-item-remove-hover-background: var(
53
+ --ui-graph-controls-hover
54
+ );
55
+ --ui-graph-controls-input-background: var(
56
+ --ui-workspace-view-secondary-background,
57
+ var(--background)
58
+ );
59
+ --ui-graph-controls-width: 300px;
60
+ --ui-graph-controls-shadow: var(
61
+ --ui-overlay-shadow,
62
+ 0 10px 28px rgb(0 0 0 / 18%)
63
+ );
64
+ display: flex;
65
+ box-sizing: border-box;
66
+ width: 100%;
67
+ height: 100%;
68
+ min-width: 0;
69
+ min-height: 0;
70
+ padding: 0.75rem;
71
+ overflow: hidden;
72
+ background: var(--ui-graph-surface-background);
73
+ color: var(--ui-graph-surface-foreground);
74
+ }
75
+
76
+ [data-ui-theme="lapis"].dark .graph-view,
77
+ .dark [data-ui-theme="lapis"] .graph-view {
78
+ --graph-node-attachment: #e0de71;
79
+ }
80
+
81
+ .graph-view__layout {
82
+ position: relative;
83
+ display: flex;
84
+ flex: 1;
85
+ width: 100%;
86
+ height: 100%;
87
+ min-width: 0;
88
+ min-height: 0;
89
+ overflow: hidden;
90
+ }
91
+
92
+ .graph-view__surface {
93
+ display: flex;
94
+ flex: 1;
95
+ width: 100%;
96
+ height: 100%;
97
+ min-width: 0;
98
+ min-height: 0;
99
+ background: var(--ui-graph-surface-background);
100
+ }
101
+
102
+ .graph-view__stats,
103
+ .graph-view__status {
104
+ position: absolute;
105
+ z-index: 10;
106
+ left: 0.75rem;
107
+ pointer-events: none;
108
+ }
109
+
110
+ .graph-view__stats {
111
+ top: 0.75rem;
112
+ }
113
+
114
+ .graph-view__status {
115
+ bottom: 0.75rem;
116
+ max-width: calc(100% - 1.5rem);
117
+ padding: 0.45rem 0.65rem;
118
+ border: 1px solid var(--ui-graph-controls-border);
119
+ border-radius: 0.5rem;
120
+ background: var(--ui-graph-stats-background);
121
+ color: var(--ui-graph-stats-foreground);
122
+ font-size: 0.75rem;
123
+ box-shadow: var(--ui-graph-controls-shadow);
124
+ backdrop-filter: blur(8px);
125
+ }
126
+
127
+ .graph-view__status[data-state="error"] {
128
+ border-color: var(--destructive);
129
+ color: var(--destructive);
130
+ }
131
+
132
+ .graph-view__stats-badge {
133
+ display: inline-flex;
134
+ padding: 0.5rem 0.75rem;
135
+ border: 1px solid var(--ui-graph-controls-border);
136
+ border-radius: 999px;
137
+ background: var(--ui-graph-stats-background);
138
+ color: var(--ui-graph-stats-foreground);
139
+ font-size: 0.75rem;
140
+ box-shadow: 0 1px 2px rgb(0 0 0 / 10%);
141
+ backdrop-filter: blur(8px);
142
+ }
143
+
144
+ .graph-controls-toolbar {
145
+ position: absolute;
146
+ z-index: 10;
147
+ top: 0.25rem;
148
+ right: 0.25rem;
149
+ display: flex;
150
+ flex-direction: column;
151
+ overflow: hidden;
152
+ border: 1px solid var(--ui-graph-controls-border);
153
+ border-radius: 5px;
154
+ background: transparent;
155
+ box-shadow: 0 1px 2px rgb(0 0 0 / 14%);
156
+ pointer-events: auto;
157
+ }
158
+
159
+ .graph-view .graph-controls-toolbar-button {
160
+ width: 26px;
161
+ min-width: 26px;
162
+ height: 26px;
163
+ min-height: 26px;
164
+ padding: 4px;
165
+ border: 0;
166
+ border-bottom: 1px solid var(--ui-graph-controls-border);
167
+ border-radius: 0;
168
+ background: var(--ui-graph-surface-background);
169
+ color: var(--ui-graph-controls-muted);
170
+ box-shadow: none;
171
+ }
172
+
173
+ .graph-view .graph-controls-toolbar-button:last-child,
174
+ .graph-view .graph-controls-toolbar-button--last {
175
+ border-bottom: 0;
176
+ }
177
+
178
+ .graph-controls-panel {
179
+ position: absolute;
180
+ z-index: 20;
181
+ top: 2px;
182
+ right: 0;
183
+ display: flex;
184
+ flex-direction: column;
185
+ width: min(var(--ui-graph-controls-width), calc(100% - 0.5rem));
186
+ max-width: calc(100% - 0.5rem);
187
+ max-height: calc(100% - 0.5rem);
188
+ padding: 0;
189
+ overflow: auto;
190
+ border: 1px solid var(--ui-graph-controls-border);
191
+ border-radius: 0.625rem;
192
+ background: var(--ui-graph-controls-background);
193
+ color: var(--ui-graph-controls-foreground);
194
+ box-shadow: var(--ui-graph-controls-shadow);
195
+ pointer-events: auto;
196
+ }
197
+
198
+ .graph-controls-sections,
199
+ .graph-controls-field-list {
200
+ display: flex;
201
+ flex-direction: column;
202
+ }
203
+
204
+ .graph-controls-field-list {
205
+ gap: 1rem;
206
+ }
207
+
208
+ .graph-view .graph-controls-toolbar-button:hover,
209
+ .graph-view .graph-controls-header-button:hover {
210
+ background: var(--ui-graph-controls-hover);
211
+ color: var(--ui-graph-controls-foreground);
212
+ }
213
+
214
+ .graph-view .graph-controls-header-button {
215
+ width: 2rem;
216
+ min-width: 2rem;
217
+ height: 2rem;
218
+ color: var(--ui-graph-controls-muted);
219
+ }
220
+
221
+ .graph-controls-icon {
222
+ width: 0.875rem;
223
+ height: 0.875rem;
224
+ }
225
+
226
+ .graph-view .graph-controls-trigger {
227
+ align-items: center;
228
+ gap: 0.75rem;
229
+ min-height: 40px;
230
+ padding-block: 0;
231
+ padding-inline: 1rem;
232
+ color: var(--ui-graph-controls-foreground);
233
+ font-size: 0.875rem;
234
+ font-weight: 600;
235
+ text-decoration: none;
236
+ }
237
+
238
+ .graph-view .graph-controls-trigger[data-indicator-position="start"] {
239
+ padding-inline-start: 1rem;
240
+ }
241
+
242
+ .graph-view .graph-controls-trigger:is(:hover, :focus, :active) {
243
+ text-decoration: none;
244
+ }
245
+
246
+ .graph-controls-section-header {
247
+ position: relative;
248
+ }
249
+
250
+ .graph-view .graph-controls-trigger--actions {
251
+ width: 100%;
252
+ padding-inline-end: 7.5rem;
253
+ }
254
+
255
+ .graph-controls-trigger__content,
256
+ .graph-controls-trigger__actions,
257
+ .graph-controls-toggle-row,
258
+ .graph-controls-slider__header {
259
+ display: flex;
260
+ align-items: center;
261
+ }
262
+
263
+ .graph-controls-trigger__content {
264
+ flex: 1;
265
+ min-width: 0;
266
+ justify-content: space-between;
267
+ gap: 0.75rem;
268
+ }
269
+
270
+ .graph-controls-trigger__actions {
271
+ gap: 0.25rem;
272
+ }
273
+
274
+ .graph-controls-section-header > .graph-controls-trigger__actions {
275
+ position: absolute;
276
+ z-index: 1;
277
+ top: 0.25rem;
278
+ right: 0.5rem;
279
+ }
280
+
281
+ .graph-controls-section-content {
282
+ padding: 0.5rem 1rem 1.5rem 0.75rem;
283
+ }
284
+
285
+ .graph-view .graph-controls-input {
286
+ height: 2.25rem;
287
+ border-color: var(--ui-graph-controls-border);
288
+ border-radius: var(--radius);
289
+ background: var(--ui-graph-controls-input-background);
290
+ color: var(--ui-graph-controls-foreground);
291
+ font-size: 0.875rem;
292
+ box-shadow: none;
293
+ }
294
+
295
+ .graph-view .graph-controls-input::placeholder {
296
+ color: var(--ui-graph-controls-muted);
297
+ }
298
+
299
+ .graph-view [data-slot="accordion-item"] {
300
+ border-bottom: 1px solid var(--ui-graph-controls-border);
301
+ }
302
+
303
+ .graph-view [data-slot="accordion-item"]:last-child {
304
+ border-bottom: 0;
305
+ }
306
+
307
+ .graph-controls-toggle-row,
308
+ .graph-controls-slider__header {
309
+ justify-content: space-between;
310
+ gap: 1rem;
311
+ }
312
+
313
+ .graph-controls-label,
314
+ .graph-controls-slider__header {
315
+ font-size: 0.875rem;
316
+ }
317
+
318
+ .graph-controls-slider {
319
+ display: flex;
320
+ flex-direction: column;
321
+ gap: 0.75rem;
322
+ }
323
+
324
+ .graph-controls-slider__value {
325
+ color: var(--ui-graph-controls-muted);
326
+ font-size: 0.75rem;
327
+ }
328
+
329
+ .graph-controls-slider__control {
330
+ width: 100%;
331
+ }
332
+
333
+ .graph-controls-section-count {
334
+ color: var(--ui-graph-controls-muted);
335
+ font-size: 0.75rem;
336
+ font-weight: 500;
337
+ }
338
+
339
+ .graph-controls-groups,
340
+ .graph-controls-group {
341
+ display: flex;
342
+ flex-direction: column;
343
+ }
344
+
345
+ .graph-controls-groups {
346
+ --ui-sortable-array-item-focus-background: var(
347
+ --ui-graph-controls-hover,
348
+ var(--muted)
349
+ );
350
+ --ui-sortable-array-item-remove-hover-background: var(
351
+ --ui-graph-controls-hover,
352
+ var(--muted)
353
+ );
354
+ gap: 0.75rem;
355
+ }
356
+
357
+ .graph-controls-group {
358
+ min-width: 0;
359
+ gap: 0.5rem;
360
+ }
361
+
362
+ .graph-controls-group__row {
363
+ display: grid;
364
+ grid-template-columns: minmax(0, 1fr) auto;
365
+ align-items: center;
366
+ gap: 0.375rem;
367
+ min-width: 0;
368
+ }
369
+
370
+ .graph-controls-group__row > :first-child {
371
+ min-width: 0;
372
+ }
373
+
374
+ .graph-controls-groups
375
+ [data-ui-component="sortable-array-item"][data-ui-part="sortable-array-item"][data-inset="normal"]
376
+ [data-ui-part="sortable-array-item-drag"] {
377
+ left: 0.25rem;
378
+ opacity: 0.72;
379
+ }
380
+
381
+ .graph-controls-groups
382
+ [data-ui-component="sortable-array-item"][data-ui-part="sortable-array-item"][data-inset="normal"] {
383
+ box-sizing: border-box;
384
+ width: calc(100% + 0.75rem);
385
+ border-bottom: 0;
386
+ padding-left: 1.5rem;
387
+ padding-right: 1.5rem;
388
+ border-radius: calc(var(--radius) * 0.75);
389
+ }
390
+
391
+ .graph-controls-groups
392
+ [data-ui-part="sortable-array-item-drag"]:hover:not(:focus-visible) {
393
+ outline: 0;
394
+ box-shadow: none;
395
+ }
396
+
397
+ .graph-controls-groups
398
+ [data-ui-component="sortable-array-item"][data-ui-part="sortable-array-item"]
399
+ [data-ui-component="button"].ui-sortable-array-item__remove {
400
+ right: 0.5rem;
401
+ width: 1rem;
402
+ height: 1rem;
403
+ opacity: 1;
404
+ }
405
+
406
+ .graph-view .graph-controls-add-group {
407
+ width: 100%;
408
+ }
409
+
410
+ .graph-view [data-slot="switch"] {
411
+ box-shadow: none;
412
+ }
413
+
414
+ .graph-view [data-slot="slider-track"] {
415
+ background: color-mix(
416
+ in srgb,
417
+ var(--ui-graph-controls-muted) 42%,
418
+ transparent
419
+ );
420
+ }
421
+
422
+ .graph-view [data-slot="slider-range"] {
423
+ background: var(--primary);
424
+ }
425
+
426
+ .graph-view [data-slot="slider-thumb"] {
427
+ background: var(--ui-graph-controls-input-background);
428
+ }
429
+
430
+ .graph-file-preview {
431
+ box-sizing: border-box;
432
+ width: min(26rem, calc(100vw - 2rem));
433
+ max-height: min(24rem, calc(100vh - 2rem));
434
+ padding: 0.75rem;
435
+ }
436
+
437
+ .graph-file-preview__scroll {
438
+ width: 100%;
439
+ height: 21rem;
440
+ min-height: 0;
441
+ }
package/manifest.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "id": "lapis-graph",
3
+ "name": "Graph",
4
+ "version": "0.1.0",
5
+ "minAppVersion": "0.1.0",
6
+ "description": "Global and local graph views powered by indexed metadata",
7
+ "author": "Lapis Notes",
8
+ "authorUrl": "https://app.lapis.md",
9
+ "isDesktopOnly": false,
10
+ "lapis": {
11
+ "manifestVersion": 1,
12
+ "source": "official",
13
+ "locked": false,
14
+ "enabledByDefault": true,
15
+ "runtime": {
16
+ "entries": {
17
+ "workspace": {
18
+ "path": "main.mjs",
19
+ "format": "esm",
20
+ "sharedDependencies": [
21
+ "@lapis-notes/api",
22
+ "@lapis-notes/api/telemetry",
23
+ "@lapis-notes/markdown/embed"
24
+ ],
25
+ "requiresReloadOnUpdate": false
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "@lapis-notes/graph",
3
+ "version": "0.1.0",
4
+ "description": "Lapis Notes global and local graph plugin",
5
+ "license": "AGPL-3.0-or-later",
6
+ "type": "module",
7
+ "files": [
8
+ "dist",
9
+ "manifest.json",
10
+ "styles.css",
11
+ "README.md",
12
+ "CHANGELOG.md",
13
+ "LICENSE.md",
14
+ "!dist/**/*.test.*",
15
+ "!dist/**/*.spec.*"
16
+ ],
17
+ "sideEffects": [
18
+ "**/*.css"
19
+ ],
20
+ "svelte": "./dist/index.js",
21
+ "types": "./dist/index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "svelte": "./dist/index.js",
26
+ "import": "./dist/index.js",
27
+ "default": "./dist/index.js"
28
+ },
29
+ "./embed": {
30
+ "types": "./dist/embed.d.ts",
31
+ "svelte": "./dist/embed.js",
32
+ "import": "./dist/embed.js",
33
+ "default": "./dist/embed.js"
34
+ },
35
+ "./app.css": {
36
+ "default": "./dist/styles.css"
37
+ },
38
+ "./styles.css": "./styles.css",
39
+ "./manifest.json": "./manifest.json"
40
+ },
41
+ "dependencies": {
42
+ "@lapis-notes/api": "^0.1.0",
43
+ "@lapis-notes/markdown": "^0.1.0",
44
+ "@lapismd/design-core": "^0.1.0",
45
+ "@lucide/svelte": "^0.523.0",
46
+ "d3-force": "^3.0.0"
47
+ },
48
+ "peerDependencies": {
49
+ "svelte": "^5.0.0"
50
+ },
51
+ "devDependencies": {
52
+ "@sveltejs/package": "^2.5.0",
53
+ "@sveltejs/vite-plugin-svelte": "^5.1.1",
54
+ "@tsconfig/svelte": "^5.0.5",
55
+ "@types/d3-force": "^3.0.10",
56
+ "publint": "^0.3.12",
57
+ "svelte": "^5.38.2",
58
+ "svelte-check": "^4.3.1",
59
+ "typescript": "~5.8.3",
60
+ "vite": "^6.4.2",
61
+ "vitest": "^4.1.8"
62
+ },
63
+ "repository": {
64
+ "type": "git",
65
+ "url": "git+https://github.com/lapismd/lapis-plugins.git",
66
+ "directory": "packages/graph"
67
+ },
68
+ "homepage": "https://github.com/lapismd/lapis-plugins/tree/main/packages/graph#readme",
69
+ "bugs": {
70
+ "url": "https://github.com/lapismd/lapis-plugins/issues"
71
+ },
72
+ "publishConfig": {
73
+ "access": "public"
74
+ },
75
+ "scripts": {
76
+ "build": "pnpm run prepack",
77
+ "check": "pnpm check:svelte && pnpm check:types",
78
+ "check:svelte": "svelte-check --tsconfig ./tsconfig.app.json --fail-on-warnings --output human",
79
+ "check:types": "tsc -p tsconfig.node.json --noEmit",
80
+ "test": "vitest run --passWithNoTests",
81
+ "publint": "publint",
82
+ "pack": "pnpm pack --pack-destination ../../.release/npm"
83
+ }
84
+ }
package/styles.css ADDED
@@ -0,0 +1 @@
1
+ @import "./dist/styles.css";