diff options
author | Thomas F. K. Jorna <[email protected]> | 2021-08-03 17:16:08 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-08-03 17:16:08 +0200 |
commit | f144e2bba9dd8cad216151d2b9d4d4e23662e538 (patch) | |
tree | 64db6ab471669fe2a6c384007f39bba1eb944f6f | |
parent | 528e2ce90f365c8d399410ee9cfb7a05f1ca638a (diff) | |
parent | f2c340d2292a002cc9f51c00124590c41082a328 (diff) |
Merge branch 'main' into main
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | components/config.ts | 7 | ||||
-rw-r--r-- | components/tweaks.tsx | 49 | ||||
-rw-r--r-- | out/404.html | 8 | ||||
-rw-r--r-- | out/_next/static/chunks/13-b599b309c84d7675574b.js (renamed from out/_next/static/chunks/13-03ddeff07567357a392f.js) | 2 | ||||
-rw-r--r-- | out/_next/static/chunks/pages/_app-b9a9a4081d35806300d5.js (renamed from out/_next/static/chunks/pages/_app-3e86b1cac997ecd07336.js) | 4 | ||||
-rw-r--r-- | out/_next/static/chunks/pages/index-2b9ae36e1ad717aff37d.js | 2873 | ||||
-rw-r--r-- | out/_next/static/chunks/pages/index-45f2a558d86856abeaa9.js | 1 | ||||
-rw-r--r-- | out/_next/static/faIfNptb0fH0Ziqoouvmn/_buildManifest.js | 12 | ||||
-rw-r--r-- | out/_next/static/faIfNptb0fH0Ziqoouvmn/_ssgManifest.js | 1 | ||||
-rw-r--r-- | out/_next/static/zMdEAFWLCg5pI2rbcMn9E/_buildManifest.js | 1 | ||||
-rw-r--r-- | out/_next/static/zMdEAFWLCg5pI2rbcMn9E/_ssgManifest.js | 1 | ||||
-rw-r--r-- | out/index.html | 12 | ||||
-rw-r--r-- | pages/index.tsx | 85 |
14 files changed, 132 insertions, 2940 deletions
@@ -11,7 +11,7 @@ Org-Roam-UI is meant a successor of [org-roam-server](https://github.com/org-roa `org-roam-ui` is not (yet!) on MELPA. Should your Emacs miss any of the dependencies, please install them manually! -org-roam-ui requires `org-roam`, `websocket`, `simple-httpd`, `f` and Emacs >27 for fast JSON parsing. +org-roam-ui requires `org-roam`, `websocket`, `simple-httpd`, `f` and Emacs >= 27 for fast JSON parsing. ### Manually @@ -190,6 +190,18 @@ By default, org-roam-ui will try to open itself in your default browser. To disa ## FAQ 🗨 +## Q: Aaaaand it broke: what do? + +Sorry! This is still alpha software, so expect it to break from time to time. Best thing you can try is to remove your settings by going to "Storage > Local Storage" on Firefox or "Application > Local Storage" on Chromium and deleting everything there. + +If the issue still persists, please file a bug report with + +1. Your browsers console log +2. Your browsers +3. What you were doing when it broke + +and we'll try to help you ASAP! + ### Q: Graph Slow! Faster? While we try to optimize the display of the graph, there is only so much we can do. For largish networks (>2k nodes) dragging the graph around a lot can cause some performance issues, but there are a few things you can do to speed it up. @@ -228,7 +240,7 @@ In our experience, once the graph has actually settled and nothing needs to be r ### Q: Some of my links are not showing up? -At the moment we aren't showing citation links made with `org-roam-bibtex` yet, but we will soon! +Links which do not refer to a valid id are filtered out to prevent crashes. In the future we will handle this a bit more gracefully by notifying you about this, but for now we're just removing them. ### Q: Will you implement X? diff --git a/components/config.ts b/components/config.ts index 5cc7775..db450d7 100644 --- a/components/config.ts +++ b/components/config.ts @@ -35,7 +35,8 @@ export const initialFilter = { orphans: false, parents: true, fileless_cites: false, - tags: [], + tagsBlacklist: [], + tagsWhitelist: [], nodes: [], links: [], date: [], @@ -86,11 +87,13 @@ export const initialVisuals = { citeDashLength: 35, citeGapLength: 15, citeLinkColor: 'gray.600', + citeLinkHighlightColor: '', citeNodeColor: 'black', refDashes: true, refDashLength: 35, refGapLength: 15, - refLinkColor: 'gray.200', + refLinkColor: 'gray.400', + refLinkHighlightColor: ''. refNodeColor: 'black', } diff --git a/components/tweaks.tsx b/components/tweaks.tsx index ff7054f..8456766 100644 --- a/components/tweaks.tsx +++ b/components/tweaks.tsx @@ -255,6 +255,14 @@ export const Tweaks = (props: TweakProps) => { filter={filter} setFilter={setFilter} tags={tags} + mode="blacklist" + /> + <TagPanel + highlightColor={highlightColor} + filter={filter} + setFilter={setFilter} + tags={tags} + mode="whitelist" /> </AccordionPanel> </AccordionItem> @@ -765,13 +773,20 @@ export const Tweaks = (props: TweakProps) => { /> <ColorMenu colorList={colorList} - label="Citationlink color" + label="Citation link color" visuals={visuals} setVisuals={setVisuals} value={'citeLinkColor'} visValue={visuals.citeLinkColor} /> - + <ColorMenu + colorList={colorList} + label="Reference link highlight" + visuals={visuals} + setVisuals={setVisuals} + value={'citeLinkHighlightColor'} + visValue={visuals.citeLinkHighlightColor} + /> <EnableSection label="Dash ref links" infoText="Add dashes to citation links, whose target has a note, made with org-roam-bibtex" @@ -801,11 +816,18 @@ export const Tweaks = (props: TweakProps) => { /> <ColorMenu colorList={colorList} - label="Referencelink color" + label="Reference link color" visuals={visuals} setVisuals={setVisuals} value={'refLinkColor'} visValue={visuals.refLinkColor} + <ColorMenu + colorList={colorList} + label="Reference link highlight" + visuals={visuals} + setVisuals={setVisuals} + value={'refLinkHighlightColor'} + visValue={visuals.refLinkHighlightColor} /> <Box> <Flex alignItems="center" justifyContent="space-between"> @@ -1335,21 +1357,26 @@ export interface TagPanelProps { filter: typeof initialFilter setFilter: any highlightColor: string + mode: string } export const TagPanel = (props: TagPanelProps) => { - const { filter, setFilter, tags, highlightColor } = props + const { filter, setFilter, tags, highlightColor, mode } = props const tagArray = tags.map((tag) => { return { value: tag, label: tag } }) - // .concat[{ value: 'placeholder', label: 'New filter' }] - const [selectedItems, setSelectedItems] = useState<typeof tagArray>([]) + const currentTags = mode === 'blacklist' ? 'tagsBlacklist' : 'tagsWhitelist' + const [selectedItems, setSelectedItems] = useState<typeof tagArray>( + filter[currentTags].map((tag) => { + return { value: tag, label: tag } + }), + ) return ( <CUIAutoComplete items={tagArray} - label="Add tag to filter" + label={'Add tag to ' + mode} placeholder=" " onCreateItem={(item) => null} disableCreateItem={true} @@ -1357,7 +1384,7 @@ export const TagPanel = (props: TagPanelProps) => { onSelectedItemsChange={(changes) => { if (changes.selectedItems) { setSelectedItems(changes.selectedItems) - setFilter({ ...filter, tags: selectedItems.map((item) => item.value) }) + setFilter({ ...filter, [currentTags]: changes.selectedItems.map((item) => item.value) }) } }} listItemStyleProps={{ overflow: 'hidden' }} @@ -1394,7 +1421,11 @@ export const TagColorPanel = (props: TagColorPanelProps) => { return { value: tag, label: tag } }) - const [selectedItems, setSelectedItems] = useState<typeof tagArray>([]) + const [selectedItems, setSelectedItems] = useState<typeof tagArray>( + Object.keys(tagColors).map((tag) => { + return { value: tag, label: tag } + }), + ) return ( <Box> diff --git a/out/404.html b/out/404.html index 6db5702..78e2fca 100644 --- a/out/404.html +++ b/out/404.html @@ -16,10 +16,10 @@ <script src="/_next/static/chunks/webpack-9c7513cc478a82b87a1b.js" defer=""></script> <script src="/_next/static/chunks/framework-2f612445bd50b211f15a.js" defer=""></script> <script src="/_next/static/chunks/main-ae68c11529959c16c50f.js" defer=""></script> - <script src="/_next/static/chunks/pages/_app-3e86b1cac997ecd07336.js" defer=""></script> + <script src="/_next/static/chunks/pages/_app-b9a9a4081d35806300d5.js" defer=""></script> <script src="/_next/static/chunks/pages/_error-f5e67a79c709c2df06b8.js" defer=""></script> - <script src="/_next/static/faIfNptb0fH0Ziqoouvmn/_buildManifest.js" defer=""></script> - <script src="/_next/static/faIfNptb0fH0Ziqoouvmn/_ssgManifest.js" defer=""></script> + <script src="/_next/static/zMdEAFWLCg5pI2rbcMn9E/_buildManifest.js" defer=""></script> + <script src="/_next/static/zMdEAFWLCg5pI2rbcMn9E/_ssgManifest.js" defer=""></script> </head> <body> <div id="__next"> @@ -753,7 +753,7 @@ "props": { "pageProps": { "statusCode": 404 } }, "page": "/_error", "query": {}, - "buildId": "faIfNptb0fH0Ziqoouvmn", + "buildId": "zMdEAFWLCg5pI2rbcMn9E", "nextExport": true, "isFallback": false, "gip": true, diff --git a/out/_next/static/chunks/13-03ddeff07567357a392f.js b/out/_next/static/chunks/13-b599b309c84d7675574b.js index 5d11283..ede208b 100644 --- a/out/_next/static/chunks/13-03ddeff07567357a392f.js +++ b/out/_next/static/chunks/13-b599b309c84d7675574b.js @@ -14895,7 +14895,7 @@ c = (0, o.lw)(u, (e, t) => (0, r.isStyleProp)(t)), l = (0, i.Pu)(t, e), f = Object.assign({}, a, l, (0, o.YU)(c), s), - h = (0, r.css)(f)(e.theme) + h = (0, r.iv)(f)(e.theme) return n ? [h, n] : h } })({ baseStyle: s }) diff --git a/out/_next/static/chunks/pages/_app-3e86b1cac997ecd07336.js b/out/_next/static/chunks/pages/_app-b9a9a4081d35806300d5.js index 12e97d4..fb6e8c4 100644 --- a/out/_next/static/chunks/pages/_app-3e86b1cac997ecd07336.js +++ b/out/_next/static/chunks/pages/_app-b9a9a4081d35806300d5.js @@ -1444,7 +1444,7 @@ 9421: function (r, e, t) { 'use strict' t.d(e, { - css: function () { + iv: function () { return n.i }, isStyleProp: function () { @@ -1714,7 +1714,7 @@ styles: (e) => { var t = (0, a.Wf)(e, 'styles.global'), n = (0, i.Pu)(t, { theme: e, colorMode: r }) - if (n) return (0, o.css)(n)(e) + if (n) return (0, o.iv)(n)(e) }, }) } diff --git a/out/_next/static/chunks/pages/index-2b9ae36e1ad717aff37d.js b/out/_next/static/chunks/pages/index-2b9ae36e1ad717aff37d.js deleted file mode 100644 index 2f612cd..0000000 --- a/out/_next/static/chunks/pages/index-2b9ae36e1ad717aff37d.js +++ /dev/null @@ -1,2873 +0,0 @@ -;(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push([ - [405], - { - 374: function (e, n, t) { - 'use strict' - t.r(n), - t.d(n, { - Graph: function () { - return Ce - }, - GraphPage: function () { - return be - }, - default: function () { - return ve - }, - }) - var r = t(809), - i = t.n(r), - o = t(92447), - l = t(85893), - s = t(59999), - a = t(26265), - c = t(64121), - u = t(67294) - function d(e, n) { - var t, - r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, - i = h(e, null !== (t = r.storage) && void 0 !== t ? t : localStorage), - o = i.get(), - l = void 0 !== o ? o : n - l !== o && i.update(l) - var s = (0, u.useState)(l), - a = s[0], - c = s[1] - ;(0, u.useEffect)( - function () { - a !== l && c(l) - }, - [e], - ) - var d = function (e) { - e instanceof Function - ? c(function (n) { - var t = e(n) - return i.update(t), t - }) - : (c(e), i.update(e)) - } - return [a, d] - } - function h(e, n) { - return { - get: function () { - var t = n.getItem(e) - if (t && 'undefined' !== t) return JSON.parse(t) - }, - update: function (t) { - n.setItem(e, JSON.stringify(t)) - }, - remove: function () { - n.removeItem(e) - }, - } - } - var g = t(54533), - f = t(54309), - x = t(20233), - p = t(40980), - j = t(48017), - m = t(36194), - v = [], - b = {} - for (var C in m.oY) - for (var y in m.oY[C]) { - var k = C + y - 'LinearNone' === k && (k = 'Linear'), v.push(k), (b[k] = m.oY[C][y]) - } - var w = b, - S = { - enabled: !0, - charge: -700, - collision: !0, - collisionStrength: 20, - centering: !0, - centeringStrength: 0.05, - linkStrength: 0.1, - linkIts: 1, - alphaDecay: 0.02, - alphaTarget: 0, - alphaMin: 0, - velocityDecay: 0.25, - gravity: 0.3, - gravityOn: !0, - }, - I = { orphans: !1, parents: !0, tags: [], nodes: [], links: [], date: [] }, - O = { - particles: !1, - particlesNumber: 0, - particlesWidth: 4, - arrows: !1, - arrowsLength: 1, - arrowsPos: 0.5, - arrowsColor: '', - linkOpacity: 0.8, - linkWidth: 1, - nodeRel: 4, - nodeOpacity: 1, - nodeResolution: 12, - labels: 2, - labelScale: 1.5, - highlight: !0, - highlightNodeSize: 2, - highlightLinkSize: 2, - highlightAnim: !0, - animationSpeed: 700, - algorithmOptions: v, - algorithmName: 'BackOut', - linkColorScheme: 'gray.500', - nodeColorScheme: [ - 'red.500', - 'gray.600', - 'yellow.500', - 'green.500', - 'cyan.500', - 'blue.500', - 'pink.500', - 'purple.500', - 'orange.500', - ], - nodeHighlight: '', - linkHighlight: 'purple.500', - backgroundColor: 'white', - emacsNodeColor: 'gray.800', - labelTextColor: 'black', - labelBackgroundColor: 'white', - labelBackgroundOpacity: 0.7, - citeDashes: !0, - citeDashLength: 35, - citeGapLength: 15, - citeLinkColor: 'gray.600', - citeNodeColor: 'black', - }, - N = { follow: 'zoom', localSame: 'add', zoomPadding: 200, zoomSpeed: 2e3 }, - L = { highlight: 'hover', local: 'click', follow: 'double' }, - z = t(38347), - T = t(93924), - R = t(83986), - D = t(48931), - P = t(67546), - E = t(93441), - Z = t(6569), - H = t(24189), - B = t(2827), - A = t(90454), - F = t(48420), - M = t(96699), - V = t(40155), - X = t(56769), - W = t(336), - _ = t(72026), - U = t(94096), - Q = t(64115), - q = t(88134), - K = t(48235), - G = t(67273), - J = t(15267), - Y = t(46049), - $ = t(95818), - ee = t(47647), - ne = t(86658), - te = t(29356) - function re(e, n) { - var t = Object.keys(e) - if (Object.getOwnPropertySymbols) { - var r = Object.getOwnPropertySymbols(e) - n && - (r = r.filter(function (n) { - return Object.getOwnPropertyDescriptor(e, n).enumerable - })), - t.push.apply(t, r) - } - return t - } - function ie(e) { - for (var n = 1; n < arguments.length; n++) { - var t = null != arguments[n] ? arguments[n] : {} - n % 2 - ? re(Object(t), !0).forEach(function (n) { - ;(0, a.Z)(e, n, t[n]) - }) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) - : re(Object(t)).forEach(function (n) { - Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(t, n)) - }) - } - return e - } - var oe = function (e) { - var n = e.physics, - t = e.setPhysics, - r = e.threeDim, - i = e.setThreeDim, - o = e.filter, - a = e.setFilter, - d = e.visuals, - h = e.setVisuals, - g = e.mouse, - f = e.setMouse, - x = e.behavior, - p = e.setBehavior, - m = e.tags, - v = e.tagColors, - b = e.setTagColors, - C = (0, u.useState)(!0), - y = C[0], - k = C[1], - w = (0, u.useContext)(te.N), - H = w.highlightColor, - B = w.setHighlightColor, - $ = [ - 'red.500', - 'orange.500', - 'yellow.500', - 'green.500', - 'cyan.500', - 'blue.500', - 'pink.500', - 'purple.500', - 'white', - 'gray.100', - 'gray.200', - 'gray.300', - 'gray.400', - 'gray.500', - 'gray.600', - 'gray.700', - 'gray.800', - 'gray.900', - 'black', - ] - return (0, l.jsxs)(l.Fragment, { - children: [ - (0, l.jsx)(A.R, { - in: !y, - children: (0, l.jsx)(j.xu, { - position: 'absolute', - zIndex: 'overlay', - marginTop: 10, - marginLeft: 10, - display: y ? 'none' : 'block', - children: (0, l.jsx)(F.h, { - 'aria-label': 'Settings', - icon: (0, l.jsx)(T.e, {}), - onClick: function () { - return k(!0) - }, - }), - }), - }), - (0, l.jsx)(A.R, { - in: y, - children: (0, l.jsxs)(j.xu, { - bg: 'alt.100', - w: 'xs', - marginTop: 10, - marginLeft: 10, - borderRadius: 'xl', - maxH: 650, - paddingBottom: 5, - zIndex: 300, - position: 'relative', - boxShadow: 'xl', - children: [ - (0, l.jsxs)(j.xu, { - display: 'flex', - justifyContent: 'space-between', - alignItems: 'center', - paddingRight: 2, - paddingTop: 1, - children: [ - (0, l.jsx)(M.u, { - label: '2D', - children: (0, l.jsx)(V.z, { - onClick: function () { - return i(!r) - }, - variant: 'ghost', - zIndex: 'overlay', - children: r ? '3D' : '2D', - }), - }), - (0, l.jsxs)(j.xu, { - display: 'flex', - alignItems: 'center', - children: [ - (0, l.jsx)(M.u, { - label: 'Reset settings to defaults', - children: (0, l.jsx)(F.h, { - 'aria-label': 'Reset Defaults', - icon: (0, l.jsx)(R.A, {}), - onClick: function () { - h(O), a(I), f(L), t(S), p(N) - }, - variant: 'none', - size: 'sm', - }), - }), - (0, l.jsx)(F.h, { - size: 'sm', - icon: (0, l.jsx)(D.T, {}), - 'aria-label': 'Close Tweak Panel', - variant: 'ghost', - onClick: function () { - return k(!1) - }, - }), - ], - }), - ], - }), - (0, l.jsx)(ne.ZP, { - autoHeight: !0, - autoHeightMax: 600, - autoHide: !0, - renderThumbVertical: function (e) { - var n = e.style, - t = (0, z.Z)(e, ['style']) - return (0, l.jsx)( - j.xu, - ie( - ie({}, t), - {}, - { style: ie(ie({}, n), {}, { borderRadius: 10 }), bg: H }, - ), - ) - }, - children: (0, l.jsxs)(X.UQ, { - allowMultiple: !0, - allowToggle: !0, - color: 'black', - children: [ - (0, l.jsxs)(X.Qd, { - children: [ - (0, l.jsxs)(X.KF, { - children: [ - (0, l.jsx)(X.XE, { marginRight: 2 }), - (0, l.jsx)(W.X, { size: 'sm', children: 'Filter' }), - ], - }), - (0, l.jsxs)(X.Hk, { - children: [ - (0, l.jsxs)(_.gC, { - spacing: 2, - justifyContent: 'flex-start', - divider: (0, l.jsx)(_.cX, { borderColor: 'gray.500' }), - align: 'stretch', - paddingLeft: 7, - color: 'gray.800', - children: [ - (0, l.jsxs)(U.k, { - justifyContent: 'space-between', - children: [ - (0, l.jsx)(Q.x, { children: 'Orphans' }), - (0, l.jsx)(q.r, { - onChange: function () { - a(ie(ie({}, o), {}, { orphans: !o.orphans })) - }, - isChecked: o.orphans, - }), - ], - }), - (0, l.jsxs)(U.k, { - justifyContent: 'space-between', - children: [ - (0, l.jsx)(Q.x, { - children: 'Link nodes with parent file', - }), - (0, l.jsx)(q.r, { - onChange: function () { - a(ie(ie({}, o), {}, { parents: !o.parents })) - }, - isChecked: o.parents, - }), - ], - }), - ], - }), - (0, l.jsxs)(X.UQ, { - padding: 0, - allowToggle: !0, - allowMultiple: !0, - paddingLeft: 3, - children: [ - (0, l.jsxs)(X.Qd, { - children: [ - (0, l.jsxs)(X.KF, { - children: ['Tag filters', (0, l.jsx)(X.XE, {})], - }), - (0, l.jsx)(X.Hk, { - pr: 0, - mr: 0, - children: (0, l.jsx)(ue, { - highlightColor: H, - filter: o, - setFilter: a, - tags: m, - }), - }), - ], - }), - (0, l.jsxs)(X.Qd, { - children: [ - (0, l.jsxs)(X.KF, { - children: ['Tag Colors', (0, l.jsx)(X.XE, {})], - }), - (0, l.jsx)(X.Hk, { - pr: 0, - mr: 0, - children: (0, l.jsx)(de, { - tags: m, - colorList: $, - tagColors: v, - setTagColors: b, - highlightColor: H, - }), - }), - ], - }), - ], - }), - ], - }), - ], - }), - (0, l.jsxs)(X.Qd, { - children: [ - (0, l.jsx)(X.KF, { - display: 'flex', - justifyContent: 'space-between', - children: (0, l.jsxs)(j.xu, { - display: 'flex', - children: [ - (0, l.jsx)(X.XE, { marginRight: 2 }), - (0, l.jsx)(W.X, { size: 'sm', children: 'Physics' }), - ], - }), - }), - (0, l.jsxs)(X.Hk, { - children: [ - (0, l.jsxs)(_.gC, { - spacing: 2, - justifyContent: 'flex-start', - divider: (0, l.jsx)(_.cX, { borderColor: 'gray.500' }), - align: 'stretch', - paddingLeft: 7, - color: 'gray.800', - children: [ - (0, l.jsx)(ae, { - label: 'Gravity', - value: n.gravityOn, - onChange: function () { - return t(ie(ie({}, n), {}, { gravityOn: !n.gravityOn })) - }, - children: (0, l.jsx)(se, { - label: 'Strength', - value: 10 * n.gravity, - onChange: function (e) { - return t(ie(ie({}, n), {}, { gravity: e / 10 })) - }, - }), - }), - (0, l.jsx)(se, { - value: -n.charge / 100, - onChange: function (e) { - return t(ie(ie({}, n), {}, { charge: -100 * e })) - }, - label: 'Repulsive Force', - }), - (0, l.jsx)(ae, { - label: 'Collision', - infoText: 'Perfomance sap, disable if slow', - value: n.collision, - onChange: function () { - return t(ie(ie({}, n), {}, { collision: !n.collision })) - }, - children: (0, l.jsx)(se, { - value: n.collisionStrength / 5, - onChange: function (e) { - return t( - ie(ie({}, n), {}, { collisionStrength: 5 * e }), - ) - }, - label: 'Collision Radius', - infoText: - 'Easy with this one, high values can lead to a real jiggly mess', - }), - }), - (0, l.jsx)(se, { - value: 5 * n.linkStrength, - onChange: function (e) { - return t(ie(ie({}, n), {}, { linkStrength: e / 5 })) - }, - label: 'Link Force', - }), - (0, l.jsx)(se, { - label: 'Link Iterations', - value: n.linkIts, - onChange: function (e) { - return t(ie(ie({}, n), {}, { linkIts: e })) - }, - min: 0, - max: 6, - step: 1, - infoText: - 'How many links down the line the physics of a single node affects (Slow)', - }), - (0, l.jsx)(se, { - label: 'Viscosity', - value: 10 * n.velocityDecay, - onChange: function (e) { - return t(ie(ie({}, n), {}, { velocityDecay: e / 10 })) - }, - }), - ], - }), - (0, l.jsx)(j.xu, { - children: (0, l.jsx)(X.UQ, { - paddingLeft: 3, - allowToggle: !0, - children: (0, l.jsxs)(X.Qd, { - children: [ - (0, l.jsxs)(X.KF, { - children: [ - (0, l.jsx)(Q.x, { children: 'Advanced' }), - (0, l.jsx)(X.XE, { marginRight: 2 }), - ], - }), - (0, l.jsx)(X.Hk, { - children: (0, l.jsxs)(_.gC, { - spacing: 2, - justifyContent: 'flex-start', - divider: (0, l.jsx)(_.cX, { - borderColor: 'gray.500', - }), - align: 'stretch', - paddingLeft: 3, - color: 'gray.800', - children: [ - (0, l.jsx)(se, { - label: 'Stabilization rate', - value: 50 * n.alphaDecay, - onChange: function (e) { - return t( - ie(ie({}, n), {}, { alphaDecay: e / 50 }), - ) - }, - }), - (0, l.jsx)(ae, { - label: 'Center nodes', - value: n.centering, - onChange: function () { - return t( - ie( - ie({}, n), - {}, - { centering: !n.centering }, - ), - ) - }, - infoText: - 'Keeps the nodes in the center of the viewport. If disabled you can drag the nodes anywhere you want.', - children: (0, l.jsx)(se, { - label: 'Centering Strength', - value: n.centeringStrength, - max: 2, - step: 0.01, - onChange: function (e) { - return t( - ie(ie({}, n), {}, { centeringStrength: e }), - ) - }, - }), - }), - ], - }), - }), - ], - }), - }), - }), - ], - }), - ], - }), - (0, l.jsxs)(X.Qd, { - children: [ - (0, l.jsxs)(X.KF, { - children: [ - (0, l.jsx)(X.XE, { marginRight: 2 }), - (0, l.jsx)(W.X, { size: 'sm', children: 'Visual' }), - ], - }), - (0, l.jsx)(X.Hk, { - children: (0, l.jsxs)(_.gC, { - justifyContent: 'flex-start', - align: 'stretch', - children: [ - (0, l.jsx)(X.UQ, { - allowToggle: !0, - defaultIndex: [0], - paddingLeft: 3, - children: (0, l.jsxs)(X.Qd, { - children: [ - (0, l.jsx)(X.KF, { - children: (0, l.jsxs)(U.k, { - justifyContent: 'space-between', - w: '100%', - children: [ - (0, l.jsx)(Q.x, { children: 'Colors' }), - (0, l.jsx)(X.XE, { marginRight: 2 }), - ], - }), - }), - (0, l.jsx)(X.Hk, { - children: (0, l.jsx)(_.gC, { - spacing: 2, - justifyContent: 'flex-start', - divider: (0, l.jsx)(_.cX, { - borderColor: 'gray.500', - }), - align: 'stretch', - color: 'gray.800', - children: (0, l.jsxs)(j.xu, { - children: [ - (0, l.jsxs)(U.k, { - alignItems: 'center', - justifyContent: 'space-between', - children: [ - (0, l.jsx)(Q.x, { children: 'Nodes' }), - (0, l.jsx)(M.u, { - label: 'Shuffle node colors', - children: (0, l.jsx)(F.h, { - 'aria-label': 'Shuffle node colors', - size: 'sm', - icon: (0, l.jsx)(P.n, {}), - variant: 'ghost', - onClick: function () { - var e, - n = - null !== (e = d.nodeColorScheme) && - void 0 !== e - ? e - : [] - h( - ie( - ie({}, d), - {}, - { - nodeColorScheme: n - .map(function (e) { - return [Math.random(), e] - }) - .sort(function (e, n) { - return ( - (0, c.Z)(e, 1)[0] - - (0, c.Z)(n, 1)[0] - ) - }) - .map(function (e) { - var n = (0, c.Z)(e, 2) - n[0] - return n[1] - }), - }, - ), - ) - }, - }), - }), - (0, l.jsx)(M.u, { - label: 'Cycle node colors', - children: (0, l.jsx)(F.h, { - 'aria-label': 'Shift node colors', - icon: (0, l.jsx)(E.L, {}), - size: 'sm', - variant: 'ghost', - onClick: function () { - var e, - n = - null !== (e = d.nodeColorScheme) && - void 0 !== e - ? e - : [] - h( - ie( - ie({}, d), - {}, - { - nodeColorScheme: [].concat( - (0, s.Z)(n.slice(1, n.length)), - [n[0]], - ), - }, - ), - ) - }, - }), - }), - (0, l.jsxs)(K.v2, { - placement: 'right', - closeOnSelect: !1, - matchWidth: !0, - children: [ - (0, l.jsx)(K.j2, { - width: 20, - as: V.z, - colorScheme: '', - color: 'black', - rightIcon: (0, l.jsx)(Z.v, {}), - children: (0, l.jsx)(U.k, { - height: 6, - width: 6, - flexDirection: 'column', - flexWrap: 'wrap', - children: d.nodeColorScheme.map( - function (e) { - return (0, l.jsx)( - j.xu, - { - bgColor: e, - flex: '1 1 8px', - borderRadius: '2xl', - }, - e, - ) - }, - ), - }), - }), - (0, l.jsxs)(G.h, { - children: [ - ' ', - (0, l.jsx)(K.qy, { - minW: 10, - zIndex: 'popover', - bgColor: 'gray.200', - children: (0, l.jsx)(K.__, { - width: 500, - type: 'checkbox', - defaultValue: d.nodeColorScheme, - onChange: function (e) { - e.length && - h( - ie( - ie({}, d), - {}, - { nodeColorScheme: e }, - ), - ) - }, - children: $.map(function (e) { - return (0, l.jsx)( - K.ii, - { - isChecked: - d.nodeColorScheme.some( - function (n) { - return n === e - }, - ), - value: e, - isDisabled: - 1 === - d.nodeColorScheme - .length && - d.nodeColorScheme[0] === - e, - children: (0, l.jsx)(j.xu, { - justifyContent: - 'space-between', - alignItems: 'center', - display: 'flex', - children: (0, l.jsx)( - j.xu, - { - bgColor: e, - borderRadius: 'sm', - height: 6, - width: 6, - }, - ), - }), - }, - e, - ) - }), - }), - }), - ], - }), - ], - }), - ], - }), - (0, l.jsxs)(U.k, { - alignItems: 'center', - justifyContent: 'space-between', - children: [ - (0, l.jsx)(Q.x, { children: 'Links' }), - (0, l.jsxs)(K.v2, { - placement: 'right', - children: [ - (0, l.jsx)(K.j2, { - as: V.z, - colorScheme: '', - color: 'black', - rightIcon: (0, l.jsx)(Z.v, {}), - children: (0, l.jsx)(j.xu, { - children: d.linkColorScheme - ? (0, l.jsx)(j.xu, { - bgColor: d.linkColorScheme, - borderRadius: 'sm', - height: 6, - width: 6, - }) - : (0, l.jsx)(U.k, { - height: 6, - width: 6, - flexDirection: 'column', - flexWrap: 'wrap', - children: d.nodeColorScheme.map( - function (e) { - return (0, l.jsx)( - j.xu, - { - bgColor: e, - flex: '1 1 8px', - borderRadius: '2xl', - }, - e, - ) - }, - ), - }), - }), - }), - (0, l.jsxs)(G.h, { - children: [ - ' ', - (0, l.jsxs)(K.qy, { - minW: 10, - zIndex: 'popover', - bgColor: 'gray.200', - children: [ - (0, l.jsx)(K.sN, { - onClick: function () { - return h( - ie( - ie({}, d), - {}, - { linkColorScheme: '' }, - ), - ) - }, - justifyContent: 'space-between', - alignItems: 'center', - display: 'flex', - children: (0, l.jsx)(U.k, { - height: 6, - width: 6, - flexDirection: 'column', - flexWrap: 'wrap', - children: - d.nodeColorScheme.map( - function (e) { - return (0, l.jsx)( - j.xu, - { - bgColor: e, - flex: '1 1 8px', - borderRadius: '2xl', - }, - e, - ) - }, - ), - }), - }), - $.map(function (e) { - return (0, l.jsx)( - K.sN, - { - onClick: function () { - return h( - ie( - ie({}, d), - {}, - { - linkColorScheme: e, - }, - ), - ) - }, - justifyContent: - 'space-between', - alignItems: 'center', - display: 'flex', - children: (0, l.jsx)(j.xu, { - bgColor: e, - borderRadius: 'sm', - height: 6, - width: 6, - }), - }, - e, - ) - }), - ], - }), - ], - }), - ], - }), - ], - }), - (0, l.jsxs)(U.k, { - alignItems: 'center', - justifyContent: 'space-between', - children: [ - (0, l.jsx)(Q.x, { children: 'Accent' }), - (0, l.jsxs)(K.v2, { - placement: 'right', - children: [ - (0, l.jsx)(K.j2, { - as: V.z, - colorScheme: '', - color: 'black', - rightIcon: (0, l.jsx)(Z.v, {}), - children: (0, l.jsx)(j.xu, { - bgColor: H, - borderRadius: 'sm', - height: 6, - width: 6, - }), - }), - (0, l.jsxs)(G.h, { - children: [ - ' ', - (0, l.jsx)(K.qy, { - minW: 10, - zIndex: 'popover', - bgColor: 'gray.200', - children: $.map(function (e) { - return (0, l.jsx)( - K.sN, - { - onClick: function () { - return B(e) - }, - justifyContent: - 'space-between', - alignItems: 'center', - display: 'flex', - children: (0, l.jsx)(j.xu, { - bgColor: e, - borderRadius: 'sm', - height: 6, - width: 6, - }), - }, - e, - ) - }), - }), - ], - }), - ], - }), - ], - }), - (0, l.jsx)(ce, { - colorList: $, - label: 'Link highlight', - visuals: d, - setVisuals: h, - value: 'linkHighlight', - visValue: d.linkHighlight, - }), - (0, l.jsx)(ce, { - colorList: $, - label: 'Node highlight', - visuals: d, - setVisuals: h, - value: 'nodeHighlight', - visValue: d.nodeHighlight, - }), - (0, l.jsx)(ce, { - colorList: $, - label: 'Background', - visuals: d, - setVisuals: h, - value: 'backgroundColor', - visValue: d.backgroundColor, - }), - (0, l.jsx)(ce, { - colorList: $, - label: 'Emacs node', - visuals: d, - setVisuals: h, - value: 'emacsNodeColor', - visValue: d.emacsNodeColor, - }), - ], - }), - }), - }), - ], - }), - }), - (0, l.jsxs)(_.gC, { - spacing: 2, - justifyContent: 'flex-start', - divider: (0, l.jsx)(_.cX, { borderColor: 'gray.500' }), - align: 'stretch', - paddingLeft: 7, - color: 'gray.800', - children: [ - (0, l.jsx)(se, { - label: 'Node size', - value: d.nodeRel, - onChange: function (e) { - return h(ie(ie({}, d), {}, { nodeRel: e })) - }, - }), - r && - (0, l.jsxs)(l.Fragment, { - children: [ - (0, l.jsx)(se, { - label: 'Node opacity', - value: d.nodeOpacity, - min: 0, - max: 1, - onChange: function (e) { - return h(ie(ie({}, d), {}, { nodeOpacity: e })) - }, - }), - (0, l.jsx)(se, { - label: 'Node resolution', - value: d.nodeResolution, - min: 5, - max: 32, - step: 1, - onChange: function (e) { - return h(ie(ie({}, d), {}, { nodeResolution: e })) - }, - }), - ], - }), - (0, l.jsx)(se, { - label: 'Link width', - value: d.linkWidth, - onChange: function (e) { - return h(ie(ie({}, d), {}, { linkWidth: e })) - }, - }), - r && - (0, l.jsx)(se, { - label: 'Link opacity', - min: 0, - max: 1, - value: d.linkOpacity, - onChange: function (e) { - return h(ie(ie({}, d), {}, { linkOpacity: e })) - }, - }), - (0, l.jsxs)(ae, { - label: 'Dash cite links', - infoText: - 'Add dashes to citation links made with org-roam-bibtex', - value: d.citeDashes, - onChange: function () { - return h( - ie(ie({}, d), {}, { citeDashes: !d.citeDashes }), - ) - }, - children: [ - (0, l.jsx)(se, { - label: 'Dash length', - value: d.citeDashLength / 10, - onChange: function (e) { - return h( - ie(ie({}, d), {}, { citeDashLength: 10 * e }), - ) - }, - }), - (0, l.jsx)(se, { - label: 'Gap length', - value: d.citeGapLength / 5, - onChange: function (e) { - return h( - ie(ie({}, d), {}, { citeGapLength: 5 * e }), - ) - }, - }), - ], - }), - (0, l.jsx)(ce, { - colorList: $, - label: 'Citation node color', - visuals: d, - setVisuals: h, - value: 'citeNodeColor', - visValue: d.citeNodeColor, - }), - (0, l.jsx)(ce, { - colorList: $, - label: 'Citationlink color', - visuals: d, - setVisuals: h, - value: 'citeLinkColor', - visValue: d.citeLinkColor, - }), - (0, l.jsxs)(j.xu, { - children: [ - (0, l.jsxs)(U.k, { - alignItems: 'center', - justifyContent: 'space-between', - children: [ - (0, l.jsx)(Q.x, { children: 'Labels' }), - (0, l.jsxs)(K.v2, { - placement: 'right', - children: [ - (0, l.jsx)(K.j2, { - as: V.z, - colorScheme: '', - color: 'black', - rightIcon: (0, l.jsx)(Z.v, {}), - children: d.labels - ? d.labels < 2 - ? 'On Highlight' - : 'Always' - : 'Never', - }), - (0, l.jsxs)(G.h, { - children: [ - ' ', - (0, l.jsxs)(K.qy, { - zIndex: 'popover', - bgColor: 'gray.200', - children: [ - (0, l.jsx)(K.sN, { - onClick: function () { - return h( - ie(ie({}, d), {}, { labels: 0 }), - ) - }, - children: 'Never', - }), - (0, l.jsx)(K.sN, { - onClick: function () { - return h( - ie(ie({}, d), {}, { labels: 1 }), - ) - }, - children: 'On Highlight', - }), - (0, l.jsx)(K.sN, { - onClick: function () { - return h( - ie(ie({}, d), {}, { labels: 2 }), - ) - }, - children: 'Always', - }), - (0, l.jsx)(K.sN, { - onClick: function () { - return h( - ie(ie({}, d), {}, { labels: 3 }), - ) - }, - children: 'Always (even in 3D)', - }), - ], - }), - ], - }), - ], - }), - ], - }), - (0, l.jsx)(J.U, { - in: d.labels > 0, - animateOpacity: !0, - children: (0, l.jsxs)(_.gC, { - spacing: 1, - justifyContent: 'flex-start', - divider: (0, l.jsx)(_.cX, { - borderColor: 'gray.400', - }), - align: 'stretch', - paddingLeft: 2, - color: 'gray.800', - children: [ - (0, l.jsx)(ce, { - colorList: $, - label: 'Text', - visuals: d, - setVisuals: h, - value: 'labelTextColor', - visValue: d.labelTextColor, - }), - (0, l.jsx)(ce, { - colorList: $, - label: 'Text', - visuals: d, - setVisuals: h, - value: 'labelBackgroundColor', - visValue: d.labelBackgroundColor, - }), - (0, l.jsx)(J.U, { - in: !!d.labelBackgroundColor, - animateOpacity: !0, - children: (0, l.jsx)(j.xu, { - paddingTop: 2, - children: (0, l.jsx)(se, { - label: 'Background opacity', - value: d.labelBackgroundOpacity, - onChange: function (e) { - console.log(d.labelBackgroundOpacity), - h( - ie( - ie({}, d), - {}, - { labelBackgroundOpacity: e }, - ), - ) - }, - min: 0, - max: 1, - step: 0.01, - }), - }), - }), - (0, l.jsx)(J.U, { - in: d.labels > 1, - animateOpacity: !0, - children: (0, l.jsx)(j.xu, { - paddingTop: 2, - children: (0, l.jsx)(se, { - label: 'Label Appearance Scale', - value: 5 * d.labelScale, - onChange: function (e) { - return h( - ie( - ie({}, d), - {}, - { labelScale: e / 5 }, - ), - ) - }, - }), - }), - }), - ], - }), - }), - ], - }), - (0, l.jsxs)(ae, { - label: 'Link arrows', - value: d.arrows, - onChange: function () { - return h(ie(ie({}, d), {}, { arrows: !d.arrows })) - }, - children: [ - (0, l.jsx)(se, { - label: 'Arrow size', - value: d.arrowsLength / 10, - onChange: function (e) { - return h( - ie(ie({}, d), {}, { arrowsLength: 10 * e }), - ) - }, - }), - (0, l.jsx)(se, { - label: 'Arrow Position', - value: d.arrowsPos, - min: 0, - max: 1, - step: 0.01, - onChange: function (e) { - return h(ie(ie({}, d), {}, { arrowsPos: e })) - }, - }), - (0, l.jsx)(ce, { - colorList: $, - label: 'Arrow Color', - visuals: d, - setVisuals: h, - value: 'arrowsColor', - visValue: d.arrowsColor, - }), - ], - }), - (0, l.jsxs)(ae, { - label: 'Directional Particles', - value: d.particles, - onChange: function () { - return h(ie(ie({}, d), {}, { particles: !d.particles })) - }, - children: [ - (0, l.jsx)(se, { - label: 'Particle Number', - value: d.particlesNumber, - max: 5, - step: 1, - onChange: function (e) { - return h(ie(ie({}, d), {}, { particlesNumber: e })) - }, - }), - (0, l.jsx)(se, { - label: 'Particle Size', - value: d.particlesWidth, - onChange: function (e) { - return h(ie(ie({}, d), {}, { particlesWidth: e })) - }, - }), - ], - }), - (0, l.jsx)(ae, { - label: 'Highlight', - onChange: function () { - return h(ie(ie({}, d), {}, { highlight: !d.highlight })) - }, - value: d.highlight, - children: (0, l.jsxs)(_.gC, { - spacing: 1, - justifyContent: 'flex-start', - divider: (0, l.jsx)(_.cX, { borderColor: 'gray.400' }), - align: 'stretch', - paddingLeft: 0, - children: [ - (0, l.jsx)(se, { - label: 'Highlight Link Thickness', - value: d.highlightLinkSize, - onChange: function (e) { - return h( - ie(ie({}, d), {}, { highlightLinkSize: e }), - ) - }, - }), - (0, l.jsx)(se, { - label: 'Highlight Node Size', - value: d.highlightNodeSize, - onChange: function (e) { - return h( - ie(ie({}, d), {}, { highlightNodeSize: e }), - ) - }, - }), - (0, l.jsxs)(ae, { - label: 'Highlight Animation', - onChange: function () { - h( - ie( - ie({}, d), - {}, - { highlightAnim: !d.highlightAnim }, - ), - ) - }, - value: d.highlightAnim, - children: [ - (0, l.jsx)(se, { - label: 'Animation speed', - onChange: function (e) { - return h( - ie(ie({}, d), {}, { animationSpeed: e }), - ) - }, - value: d.animationSpeed, - infoText: - 'Slower speed has a chance of being buggy', - min: 50, - max: 1e3, - step: 10, - }), - (0, l.jsx)(Y.Ph, { - placeholder: d.algorithmName, - onChange: function (e) { - h( - ie( - ie({}, d), - {}, - { algorithmName: e.target.value }, - ), - ) - }, - children: d.algorithmOptions.map(function (e) { - return (0, - l.jsx)('option', { value: e, children: e }, e) - }), - }), - ], - }), - ], - }), - }), - ], - }), - ], - }), - }), - ], - }), - (0, l.jsxs)(X.Qd, { - children: [ - (0, l.jsxs)(X.KF, { - children: [ - (0, l.jsx)(X.XE, { marginRight: 2 }), - (0, l.jsx)(W.X, { size: 'sm', children: 'Behavior' }), - ], - }), - (0, l.jsx)(X.Hk, { - children: (0, l.jsxs)(_.gC, { - spacing: 2, - justifyContent: 'flex-start', - divider: (0, l.jsx)(_.cX, { borderColor: 'gray.500' }), - align: 'stretch', - paddingLeft: 7, - color: 'gray.800', - children: [ - (0, l.jsxs)(U.k, { - alignItems: 'center', - justifyContent: 'space-between', - children: [ - (0, l.jsxs)(U.k, { - children: [ - (0, l.jsx)(Q.x, { children: 'Expand Node' }), - (0, l.jsx)(le, { - infoText: - 'View only the node and its direct neighbors', - }), - ], - }), - (0, l.jsxs)(K.v2, { - placement: 'right', - children: [ - (0, l.jsx)(K.j2, { - as: V.z, - rightIcon: (0, l.jsx)(Z.v, {}), - colorScheme: '', - color: 'black', - children: (0, l.jsx)(Q.x, { - children: g.local - ? g.local[0].toUpperCase() + g.local.slice(1) - : 'Never', - }), - }), - (0, l.jsxs)(G.h, { - children: [ - ' ', - (0, l.jsxs)(K.qy, { - zIndex: 'popover', - bgColor: 'gray.200', - children: [ - (0, l.jsx)(K.sN, { - onClick: function () { - return f(ie(ie({}, g), {}, { local: '' })) - }, - children: 'Never', - }), - (0, l.jsx)(K.sN, { - onClick: function () { - return f( - ie(ie({}, g), {}, { local: 'click' }), - ) - }, - children: 'Click', - }), - (0, l.jsx)(K.sN, { - onClick: function () { - return f( - ie(ie({}, g), {}, { local: 'double' }), - ) - }, - children: 'Double Click', - }), - (0, l.jsx)(K.sN, { - onClick: function () { - return f( - ie(ie({}, g), {}, { local: 'right' }), - ) - }, - children: 'Right Click', - }), - ], - }), - ], - }), - ], - }), - ], - }), - (0, l.jsxs)(U.k, { - alignItems: 'center', - justifyContent: 'space-between', - children: [ - (0, l.jsx)(Q.x, { children: 'Open in Emacs' }), - (0, l.jsxs)(K.v2, { - placement: 'right', - children: [ - (0, l.jsx)(K.j2, { - as: V.z, - rightIcon: (0, l.jsx)(Z.v, {}), - colorScheme: '', - color: 'black', - children: (0, l.jsx)(Q.x, { - children: g.follow - ? g.follow[0].toUpperCase() + g.follow.slice(1) - : 'Never', - }), - }), - (0, l.jsxs)(G.h, { - children: [ - ' ', - (0, l.jsxs)(K.qy, { - bgColor: 'gray.200', - zIndex: 'popover', - children: [ - (0, l.jsx)(K.sN, { - onClick: function () { - return f(ie(ie({}, g), {}, { follow: '' })) - }, - children: 'Never', - }), - (0, l.jsx)(K.sN, { - onClick: function () { - return f( - ie(ie({}, g), {}, { follow: 'click' }), - ) - }, - children: 'Click', - }), - (0, l.jsx)(K.sN, { - onClick: function () { - return f( - ie(ie({}, g), {}, { follow: 'double' }), - ) - }, - children: 'Double Click', - }), - (0, l.jsx)(K.sN, { - onClick: function () { - return f( - ie(ie({}, g), {}, { follow: 'right' }), - ) - }, - children: 'Right Click', - }), - ], - }), - ], - }), - ], - }), - ], - }), - (0, l.jsxs)(U.k, { - alignItems: 'center', - justifyContent: 'space-between', - children: [ - (0, l.jsx)(Q.x, { children: 'Follow Emacs by...' }), - (0, l.jsxs)(K.v2, { - placement: 'right', - children: [ - (0, l.jsx)(K.j2, { - as: V.z, - rightIcon: (0, l.jsx)(Z.v, {}), - colorScheme: '', - color: 'black', - children: (0, l.jsx)(Q.x, { - children: - x.follow[0].toUpperCase() + x.follow.slice(1), - }), - }), - (0, l.jsxs)(G.h, { - children: [ - ' ', - (0, l.jsxs)(K.qy, { - bgColor: 'gray.200', - zIndex: 'popover', - children: [ - (0, l.jsx)(K.sN, { - onClick: function () { - return p( - ie(ie({}, x), {}, { follow: 'local' }), - ) - }, - children: 'Opening the local graph', - }), - (0, l.jsx)(K.sN, { - onClick: function () { - return p( - ie(ie({}, x), {}, { follow: 'zoom' }), - ) - }, - children: 'Zooming to the current node', - }), - ], - }), - ], - }), - ], - }), - ], - }), - (0, l.jsx)(se, { - label: 'Zoom speed', - value: x.zoomSpeed, - min: 0, - max: 4e3, - step: 100, - onChange: function (e) { - return p(ie(ie({}, x), {}, { zoomSpeed: e })) - }, - }), - (0, l.jsx)(se, { - label: 'Zoom padding', - value: x.zoomPadding, - min: 0, - max: 400, - step: 1, - onChange: function (e) { - return p(ie(ie({}, x), {}, { zoomPadding: e })) - }, - infoText: - 'How much to zoom out to accomodate all nodes when changing the view.', - }), - ], - }), - }), - ], - }), - ], - }), - }), - ], - }), - }), - ], - }) - }, - le = function (e) { - var n = e.infoText - return (0, l.jsx)(j.xu, { - paddingLeft: '1', - children: (0, l.jsx)(M.u, { - label: n, - placement: 'top', - color: 'gray.100', - bg: 'gray.800', - hasArrow: !0, - children: (0, l.jsx)(H.h, {}), - }), - }) - }, - se = function (e) { - var n = e.min, - t = void 0 === n ? 0 : n, - r = e.max, - i = void 0 === r ? 10 : r, - o = e.step, - s = void 0 === o ? 0.1 : o, - a = e.value, - c = void 0 === a ? 1 : a, - d = (0, z.Z)(e, ['min', 'max', 'step', 'value']), - h = d.onChange, - g = d.label, - f = d.infoText, - x = (0, u.useContext)(te.N).highlightColor - return (0, l.jsxs)(j.xu, { - children: [ - (0, l.jsxs)(j.xu, { - display: 'flex', - alignItems: 'flex-end', - children: [(0, l.jsx)(Q.x, { children: g }), f && (0, l.jsx)(le, { infoText: f })], - }), - (0, l.jsxs)($.iR, { - value: c, - onChange: h, - min: t, - max: i, - step: s, - children: [ - (0, l.jsx)($.Uj, { children: (0, l.jsx)($.Ms, {}) }), - (0, l.jsx)(M.u, { - bg: x, - label: c.toFixed(1), - children: (0, l.jsx)($.gs, { bg: 'white' }), - }), - ], - }), - ], - }) - }, - ae = function (e) { - var n = e.value, - t = e.onChange, - r = e.label, - i = e.infoText, - o = e.children - return (0, l.jsxs)(j.xu, { - paddingTop: 2, - children: [ - (0, l.jsxs)(j.xu, { - display: 'flex', - justifyContent: 'space-between', - paddingBottom: 2, - children: [ - (0, l.jsxs)(j.xu, { - display: 'flex', - alignItems: 'center', - children: [ - (0, l.jsx)(Q.x, { children: r }), - i && (0, l.jsx)(le, { infoText: i }), - ], - }), - (0, l.jsx)(q.r, { isChecked: !!n, onChange: t }), - ], - }), - (0, l.jsx)(J.U, { - in: !!n, - animateOpacity: !0, - children: (0, l.jsx)(j.xu, { - paddingLeft: 4, - paddingTop: 2, - paddingBottom: 2, - children: o, - }), - }), - ], - }) - }, - ce = function (e) { - var n = e.label, - t = e.colorList, - r = e.value, - i = e.visuals, - o = e.visValue, - s = e.setVisuals - return (0, l.jsxs)(U.k, { - alignItems: 'center', - justifyContent: 'space-between', - children: [ - (0, l.jsx)(Q.x, { children: n }), - (0, l.jsxs)(K.v2, { - placement: 'right', - children: [ - (0, l.jsx)(K.j2, { - as: V.z, - colorScheme: '', - color: 'black', - rightIcon: (0, l.jsx)(Z.v, {}), - children: (0, l.jsx)(j.xu, { - bgColor: o, - borderRadius: 'sm', - height: 6, - width: 6, - }), - }), - (0, l.jsxs)(G.h, { - children: [ - ' ', - (0, l.jsxs)(K.qy, { - minW: 10, - zIndex: 'popover', - bgColor: 'gray.200', - children: [ - (0, l.jsx)(K.sN, { - onClick: function () { - return s(ie(ie({}, i), {}, (0, a.Z)({}, r, ''))) - }, - justifyContent: 'space-between', - alignItems: 'center', - display: 'flex', - children: (0, l.jsx)(j.xu, { height: 6, width: 6 }), - }), - t.map(function (e) { - return (0, l.jsx)( - K.sN, - { - onClick: function () { - return s(ie(ie({}, i), {}, (0, a.Z)({}, r, e))) - }, - justifyContent: 'space-between', - alignItems: 'center', - display: 'flex', - children: (0, l.jsx)(j.xu, { - bgColor: e, - borderRadius: 'sm', - height: 6, - width: 6, - }), - }, - e, - ) - }), - ], - }), - ], - }), - ], - }), - ], - }) - }, - ue = function (e) { - var n = e.filter, - t = e.setFilter, - r = e.tags, - i = e.highlightColor, - o = r.map(function (e) { - return { value: e, label: e } - }), - s = (0, u.useState)([]), - a = s[0], - c = s[1] - return (0, l.jsx)(ee.CUIAutoComplete, { - items: o, - label: 'Add tag to filter', - placeholder: ' ', - onCreateItem: function (e) { - return null - }, - disableCreateItem: !0, - selectedItems: a, - onSelectedItemsChange: function (e) { - e.selectedItems && - (c(e.selectedItems), - t( - ie( - ie({}, n), - {}, - { - tags: a.map(function (e) { - return e.value - }), - }, - ), - )) - }, - listItemStyleProps: { overflow: 'hidden' }, - highlightItemBg: 'gray.400', - toggleButtonStyleProps: { variant: 'outline' }, - inputStyleProps: { focusBorderColor: i, color: 'gray.800', borderColor: 'gray.600' }, - tagStyleProps: { - rounded: 'full', - bg: i, - height: 8, - paddingLeft: 4, - fontWeight: 'bold', - }, - hideToggleButton: !0, - itemRenderer: function (e) { - return e.label - }, - }) - }, - de = function (e) { - var n = e.colorList, - t = e.tagColors, - r = e.setTagColors, - i = e.highlightColor, - o = e.tags.map(function (e) { - return { value: e, label: e } - }), - s = (0, u.useState)([]), - c = s[0], - d = s[1] - return (0, l.jsxs)(j.xu, { - children: [ - (0, l.jsx)(ee.CUIAutoComplete, { - items: o, - label: 'Add tag to filter', - placeholder: ' ', - disableCreateItem: !0, - selectedItems: c, - onSelectedItemsChange: function (e) { - e.selectedItems && - (d(Array.from(new Set(e.selectedItems))), - r( - Object.fromEntries( - Array.from(new Set(e.selectedItems)).map(function (e) { - var n - return [ - e.label, - null !== (n = t[e.label]) && void 0 !== n ? n : 'gray.600', - ] - }), - ), - )) - }, - listItemStyleProps: { overflow: 'hidden' }, - highlightItemBg: 'gray.400', - toggleButtonStyleProps: { variant: 'outline' }, - inputStyleProps: { - focusBorderColor: i, - color: 'gray.800', - borderColor: 'gray.600', - }, - tagStyleProps: { - display: 'none', - rounded: 'full', - bg: i, - height: 8, - paddingLeft: 4, - fontWeight: 'bold', - }, - hideToggleButton: !0, - itemRenderer: function (e) { - return e.label - }, - }), - (0, l.jsx)(_.gC, { - spacing: 2, - justifyContent: 'flex-start', - divider: (0, l.jsx)(_.cX, { borderColor: 'gray.500' }), - align: 'stretch', - color: 'gray.800', - children: Object.keys(t).map(function (e) { - return (0, l.jsxs)( - U.k, - { - alignItems: 'center', - justifyContent: 'space-between', - width: '100%', - pl: 2, - children: [ - (0, l.jsx)(j.xu, { - width: '100%', - children: (0, l.jsx)(Q.x, { fontWeight: 'bold', children: e }), - }), - (0, l.jsxs)(K.v2, { - isLazy: !0, - placement: 'right', - children: [ - (0, l.jsx)(K.j2, { - as: V.z, - colorScheme: '', - color: 'black', - children: (0, l.jsx)(j.xu, { - bgColor: t[e], - borderRadius: 'sm', - height: 6, - width: 6, - }), - }), - (0, l.jsxs)(G.h, { - children: [ - ' ', - (0, l.jsx)(K.qy, { - minW: 10, - zIndex: 'popover', - bgColor: 'gray.200', - children: n.map(function (n) { - return (0, l.jsx)( - K.sN, - { - onClick: function () { - return r(ie(ie({}, t), {}, (0, a.Z)({}, e, n))) - }, - justifyContent: 'space-between', - alignItems: 'center', - display: 'flex', - children: (0, l.jsx)(j.xu, { - bgColor: n, - borderRadius: 'sm', - height: 6, - width: 6, - }), - }, - n, - ) - }), - }), - ], - }), - ], - }), - (0, l.jsx)(F.h, { - 'aria-label': 'Delete tag color', - variant: 'ghost', - icon: (0, l.jsx)(B.p, {}), - onClick: function () { - r( - Object.fromEntries( - Array.from(new Set(c)).map(function (e) { - var n - return [ - e.label, - null !== (n = t[e.label]) && void 0 !== n ? n : 'gray.600', - ] - }), - ), - ), - d( - c.filter(function (n) { - return n.value !== e - }), - ) - }, - }), - ], - }, - e, - ) - }), - }), - ], - }) - }, - he = t(31122), - ge = t(22003) - function fe(e, n) { - var t = Object.keys(e) - if (Object.getOwnPropertySymbols) { - var r = Object.getOwnPropertySymbols(e) - n && - (r = r.filter(function (n) { - return Object.getOwnPropertyDescriptor(e, n).enumerable - })), - t.push.apply(t, r) - } - return t - } - function xe(e) { - for (var n = 1; n < arguments.length; n++) { - var t = null != arguments[n] ? arguments[n] : {} - n % 2 - ? fe(Object(t), !0).forEach(function (n) { - ;(0, a.Z)(e, n, t[n]) - }) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) - : fe(Object(t)).forEach(function (n) { - Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(t, n)) - }) - } - return e - } - var pe = t.e(4).then(t.bind(t, 57004)), - je = t.g.window ? t(61957).f$ : null, - me = t.g.window ? t(61957).s6 : null - function ve() { - var e = (0, u.useState)(!1), - n = e[0], - t = e[1] - return ( - (0, u.useEffect)(function () { - t(!0) - }, []), - n ? (0, l.jsx)(be, {}) : null - ) - } - function be() { - var e = d('physics', S), - n = (0, c.Z)(e, 2), - t = n[0], - r = n[1], - i = d('filter', I), - o = (0, c.Z)(i, 2), - h = o[0], - g = o[1], - f = d('visuals', O), - x = (0, c.Z)(f, 2), - p = x[0], - m = x[1], - v = (0, u.useState)(null), - b = v[0], - C = v[1], - y = (0, u.useState)(null), - k = y[0], - w = y[1], - z = d('behavior', N), - T = (0, c.Z)(z, 2), - R = T[0], - D = T[1], - P = d('mouse', L), - E = (0, c.Z)(P, 2), - Z = E[0], - H = E[1], - B = (0, u.useRef)({}), - A = (0, u.useRef)({}), - F = (0, u.useRef)([]), - M = (0, u.useContext)(te.N).setEmacsTheme, - V = d('3d', !1), - X = (0, c.Z)(V, 2), - W = X[0], - _ = X[1], - U = d('tagCols', {}), - Q = (0, c.Z)(U, 2), - q = Q[0], - K = Q[1], - G = (0, u.useState)({ nodeIds: [] }), - J = G[0], - Y = G[1], - $ = (0, u.useRef)({ nodeIds: [] }), - ee = (0, u.useRef)(N) - ee.current = R - var ne = (0, u.useRef)(null), - re = (0, u.useRef)(null) - $.current = J - var ie = function (e, n) { - var t, - r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 2e3, - i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 200, - o = ne.current, - l = $.current, - a = ee.current, - c = null !== (t = A.current[n]) && void 0 !== t ? t : [], - u = Object.fromEntries( - [n] - .concat( - (0, s.Z)( - c.flatMap(function (e) { - return [e.source, e.target] - }), - ), - ) - .map(function (e) { - return [e, {}] - }), - ) - return 'zoom' === e - ? (console.log(l), - l.nodeIds.length && - (console.log('emptying'), console.log('scope ' + l.nodeIds), Y({ nodeIds: [] })), - void setTimeout(function () { - return o.zoomToFit(r, i, function (e) { - return u[e.id] - }) - }, 50)) - : l.nodeIds.length - ? 'add' !== a.localSame - ? (Y({ nodeIds: [n] }), - void setTimeout(function () { - o.centerAt(0, 0, r) - }, 50)) - : l.nodeIds.includes(n) && - l.nodeIds.some(function (e) { - return u[e] - }) - ? (Y(function (e) { - return xe(xe({}, e), {}, { nodeIds: [].concat((0, s.Z)(e.nodeIds), [n]) }) - }), - void setTimeout(function () { - return o.zoomToFit(r, i, function (e) { - return u[e.id] - }) - }, 50)) - : (Y({ nodeIds: [n] }), - void setTimeout(function () { - o.centerAt(0, 0, r) - }, 50)) - : (Y({ nodeIds: [n] }), - void setTimeout(function () { - o.centerAt(0, 0, r) - }, 50)) - } - return ( - (0, u.useEffect)(function () { - ;(re.current = new ge.Z('ws://localhost:35903')), - re.current.addEventListener('open', function (e) { - console.log('Connection with Emacs established') - }), - re.current.addEventListener('message', function (e) { - ne.current - var n = ee.current, - t = JSON.parse(e.data) - switch (t.type) { - case 'graphdata': - return (function (e) { - F.current = e.tags - var n = e.nodes.reduce(function (e, n) { - var t - return xe( - xe({}, e), - {}, - (0, a.Z)( - {}, - n.file, - [].concat( - (0, s.Z)(null !== (t = e[n.file]) && void 0 !== t ? t : []), - [n], - ), - ), - ) - }, {}), - t = Object.keys(n).flatMap(function (e) { - var t, - r = null !== (t = n[e]) && void 0 !== t ? t : [], - i = r.find(function (e) { - return 0 === e.level - }), - o = r.filter(function (e) { - return 0 !== e.level - }) - return i - ? o.map(function (e) { - return { source: e.id, target: i.id, type: 'parent' } - }) - : [] - }) - B.current = Object.fromEntries( - e.nodes.map(function (e) { - return [e.id, e] - }), - ) - var r = [].concat((0, s.Z)(e.links), (0, s.Z)(t)).filter(function (e) { - var n = e.source, - t = e.target - return B.current[n] && B.current[t] - }) - A.current = r.reduce(function (e, n) { - var t, r, i - return xe( - xe({}, e), - {}, - ((i = {}), - (0, a.Z)( - i, - n.source, - [].concat( - (0, s.Z)(null !== (t = e[n.source]) && void 0 !== t ? t : []), - [n], - ), - ), - (0, a.Z)( - i, - n.target, - [].concat( - (0, s.Z)(null !== (r = e[n.target]) && void 0 !== r ? r : []), - [n], - ), - ), - i), - ) - }, {}) - var i = xe(xe({}, e), {}, { links: r }), - o = JSON.parse(JSON.stringify(i)) - C(o) - })(t.data) - case 'theme': - return M(t.data) - case 'command': - switch (t.data.commandName) { - case 'local': - var r = R.zoomSpeed, - i = R.zoomPadding - ie('local', t.data.id, r, i), w(t.data.id) - break - case 'zoom': - var o, - l, - c = - (null === t || void 0 === t || null === (o = t.data) || void 0 === o - ? void 0 - : o.speed) || n.zoomSpeed, - u = - (null === t || void 0 === t || null === (l = t.data) || void 0 === l - ? void 0 - : l.padding) || n.zoomPadding - ie('zoom', t.data.id, c, u), w(t.data.id) - break - case 'follow': - ie(n.follow, t.data.id, n.zoomSpeed, n.zoomPadding), w(t.data.id) - break - default: - return console.error('unknown message type', t.type) - } - } - }) - }, []), - b - ? (0, l.jsxs)(j.xu, { - display: 'flex', - alignItems: 'flex-start', - flexDirection: 'row', - height: '100%', - children: [ - (0, l.jsx)( - oe, - xe( - xe( - {}, - { - physics: t, - setPhysics: r, - threeDim: W, - setThreeDim: _, - filter: h, - setFilter: g, - visuals: p, - setVisuals: m, - mouse: Z, - setMouse: H, - behavior: R, - setBehavior: D, - tagColors: q, - setTagColors: K, - }, - ), - {}, - { tags: F.current }, - ), - ), - (0, l.jsx)(j.xu, { - position: 'absolute', - alignItems: 'top', - children: (0, l.jsx)( - Ce, - xe( - { - ref: ne, - nodeById: B.current, - linksByNodeId: A.current, - webSocket: re.current, - }, - { - physics: t, - graphData: b, - threeDim: W, - emacsNodeId: k, - filter: h, - visuals: p, - behavior: R, - mouse: Z, - scope: J, - setScope: Y, - tagColors: q, - }, - ), - ), - }), - ], - }) - : null - ) - } - var Ce = (0, u.forwardRef)(function (e, n) { - var t = e.physics, - r = e.graphData, - a = e.threeDim, - d = e.linksByNodeId, - h = e.filter, - j = e.emacsNodeId, - m = e.nodeById, - v = e.visuals, - b = (e.behavior, e.mouse), - C = e.scope, - y = e.setScope, - k = e.webSocket, - S = e.tagColors, - I = (0, f.iP)(), - O = (0, c.Z)(I, 2), - N = O[0], - L = O[1], - z = (0, u.useState)(null), - T = z[0], - R = z[1], - D = (0, p.useTheme)(), - P = (0, u.useContext)(te.N).emacsTheme, - E = function (e, n) { - switch (e) { - case b.local: - if (C.nodeIds.includes(n.id)) break - y(function (e) { - return xe(xe({}, e), {}, { nodeIds: [].concat((0, s.Z)(e.nodeIds), [n.id]) }) - }) - break - case b.follow: - k.send(n.id) - } - }, - Z = (0, u.useRef)(null) - ;(0, u.useEffect)( - function () { - j && R(m[j]) - }, - [j], - ), - (Z.current = T) - var H = (0, u.useMemo)( - function () { - if (!Z.current) return {} - var e = d[Z.current.id] - return e - ? Object.fromEntries( - [Z.current.id] - .concat( - (0, s.Z)( - e.flatMap(function (e) { - return [e.source, e.target] - }), - ), - ) - .map(function (e) { - return [e, {}] - }), - ) - : {} - }, - [Z.current, d], - ), - B = (0, u.useMemo)( - function () { - var e = r.nodes.filter(function (e) { - var n, - t = e, - r = null !== (n = d[t.id]) && void 0 !== n ? n : [] - return h.tags.length && t.tags.length - ? !h.tags.some(function (e) { - return t.tags.indexOf(e) > -1 - }) - : !h.orphans || - (h.parents - ? 0 !== r.length - : 0 !== r.length && - r.some(function (e) { - return !['parent', 'ref'].includes(e.type) - })) - }), - n = e.map(function (e) { - return e.id - }) - return { - filteredNodes: e, - filteredLinks: r.links.filter(function (e) { - if (h.tags.length) { - var t = 'object' === typeof e.source ? e.source.id : e.source, - r = 'object' === typeof e.target ? e.target.id : e.target - return n.includes(t) && n.includes(r) - } - var i = e - return h.parents || 'parent' !== i.type - }), - } - }, - [h, r], - ), - A = (0, u.useMemo)( - function () { - var e = B.filteredNodes.filter(function (e) { - var n, - t = null !== (n = d[e.id]) && void 0 !== n ? n : [] - return ( - C.nodeIds.includes(e.id) || - t.some(function (e) { - return C.nodeIds.includes(e.source) || C.nodeIds.includes(e.target) - }) - ) - }), - n = e.map(function (e) { - return e.id - }), - t = B.filteredLinks.filter(function (e) { - var t = 'object' === typeof e.source ? e.source.id : e.source, - r = 'object' === typeof e.target ? e.target.id : e.target - return n.includes(t) && n.includes(r) - }) - return 0 === C.nodeIds.length - ? { nodes: B.filteredNodes, links: B.filteredLinks } - : { nodes: e, links: t } - }, - [h, C, r], - ) - ;(0, u.useEffect)(function () { - ;(0, o.Z)( - i().mark(function e() { - var r, o - return i().wrap(function (e) { - for (;;) - switch ((e.prev = e.next)) { - case 0: - return (r = n.current), (e.next = 3), pe - case 3: - ;(o = e.sent), - t.gravityOn - ? (r.d3Force('x', o.forceX().strength(t.gravity)), - r.d3Force('y', o.forceY().strength(t.gravity)), - a && r.d3Force('z', o.forceZ().strength(t.gravity))) - : (r.d3Force('x', null), r.d3Force('y', null), a && r.d3Force('z', null)), - t.centering - ? r.d3Force('center', o.forceCenter().strength(t.centeringStrength)) - : r.d3Force('center', null), - t.linkStrength && r.d3Force('link').strength(t.linkStrength), - t.linkIts && r.d3Force('link').iterations(t.linkIts), - t.charge && r.d3Force('charge').strength(t.charge), - r.d3Force( - 'collide', - t.collision ? o.forceCollide().radius(t.collisionStrength) : null, - ) - case 10: - case 'end': - return e.stop() - } - }, e) - }), - )() - }), - (0, u.useEffect)( - function () { - var e - null === (e = n.current) || void 0 === e || e.d3ReheatSimulation() - }, - [t], - ) - var F = (0, u.useRef)(0), - M = (0, u.useState)(1), - V = M[0], - X = M[1], - W = (0, x._7)( - function (e) { - return X(e) - }, - { duration: v.animationSpeed, algorithm: w[v.algorithmName] }, - ), - _ = (0, c.Z)(W, 2), - U = _[0], - Q = _[1], - q = (0, x._7)( - function (e) { - return X(Math.min(V, -1 * (e - 1))) - }, - { duration: v.animationSpeed, algorithm: w[v.algorithmName] }, - ), - K = (0, c.Z)(q, 2), - G = K[0], - J = K[1], - Y = (0, u.useRef)(null) - ;(0, u.useEffect)( - function () { - if ((T && (Y.current = T), !v.highlightAnim)) return X(T ? 1 : 0) - T ? U() : (Q(), V > 0.5 ? G() : X(0)) - }, - [T], - ) - var $ = function (e) { - if (D) - return e.split('.').reduce(function (e, n) { - return e[n] - }, D.colors) - }, - ee = (0, u.useMemo)( - function () { - var e = v.nodeColorScheme.concat( - v.linkColorScheme || [], - v.linkHighlight || [], - v.nodeHighlight || [], - v.citeNodeColor || [], - v.citeLinkColor || [], - ) - return Object.fromEntries( - e.map(function (n) { - var t = $(n), - r = e.map(function (e) { - return [e, g.Z(t, $(e))] - }) - return [n, Object.fromEntries(r)] - }), - ) - }, - [v.nodeColorScheme, v.linkHighlight, v.nodeHighlight, v.linkColorScheme, P], - ), - ne = (0, u.useMemo)( - function () { - var e, - n, - t, - r = - null !== (e = d[null === (n = Y.current) || void 0 === n ? void 0 : n.id]) && - void 0 !== e - ? e - : [] - return Object.fromEntries( - [null === (t = Y.current) || void 0 === t ? void 0 : t.id] - .concat( - (0, s.Z)( - r.flatMap(function (e) { - return [e.source, e.target] - }), - ), - ) - .map(function (e) { - return [e, {}] - }), - ) - }, - [JSON.stringify(T), Y.current], - ), - re = function (e) { - var n, - t, - r, - i, - o, - l, - s = - null !== (n = null === (t = d[e]) || void 0 === t ? void 0 : t.length) && - void 0 !== n - ? n - : 0, - a = s - ? null === (r = d[e]) || void 0 === r - ? void 0 - : r.filter(function (e) { - return 'parent' === e.type || 'cite' === e.type - }).length - : 0, - c = h.parents ? s : s - a - return v.nodeColorScheme[ - ((i = c), (o = 0), (l = v.nodeColorScheme.length - 1), Math.min(Math.max(i, o), l)) - ] - }, - ie = function (e, n) { - return d[e] > d[n] ? re(e) : re(n) - }, - oe = function (e, n) { - return ( - 'rgba(' + - (e = e.replace('#', '')) - .match(new RegExp('(.{' + e.length / 3 + '})', 'g')) - .map(function (n) { - return parseInt(e.length % 2 ? n + n : n, 16) - }) - .concat(isFinite(n) ? n : 1) - .join(',') + - ')' - ) - }, - le = (0, u.useMemo)( - function () { - return $(v.labelTextColor) - }, - [v.labelTextColor, P], - ), - se = (0, u.useMemo)( - function () { - return $(v.labelBackgroundColor) - }, - [v.labelBackgroundColor, P], - ), - ae = { - graphData: A, - width: N, - height: L, - backgroundColor: D.colors.gray[v.backgroundColor], - nodeLabel: function (e) { - return e.title - }, - nodeColor: function (e) { - return (function (e) { - var n = H[e.id] || ne[e.id] - if (v.emacsNodeColor && e.id === j) return $(v.emacsNodeColor) - if ( - S && - e.tags.some(function (e) { - return S[e] - }) - ) { - var t = - S[ - e.tags.filter(function (e) { - return S[e] - })[0] - ] - return $(t) - } - return v.citeNodeColor && e.properties.ROAM_REFS - ? $(v.citeNodeColor) - : n && v.nodeHighlight - ? ee[re(e.id)][v.nodeHighlight](V) - : $(re(e.id)) - })(e) - }, - nodeRelSize: v.nodeRel, - nodeVal: function (e) { - var n, - t = null !== (n = d[e.id]) && void 0 !== n ? n : [], - r = t.length - ? t.filter(function (e) { - return 'parent' === e.type || 'cite' === e.type - }).length - : 0 - return ( - (3 + t.length - (h.parents ? 0 : r)) * - (H[e.id] || ne[e.id] ? 1 + V * (v.highlightNodeSize - 1) : 1) - ) - }, - nodeCanvasObject: function (e, n, t) { - if (e && v.labels) { - var r = ne[e.id] - if (!(t <= v.labelScale || 1 === v.labels) || H[e.id] || r) { - var i = e.title, - o = i.substring(0, Math.min(i.length, 40)), - l = 12 / t, - a = [1.1 * n.measureText(o).width, l].map(function (e) { - return e + 0.5 * l - }), - c = Math.min((3 * (t - v.labelScale)) / v.labelScale, 1), - u = function () { - return 1 === v.labels || t <= v.labelScale - ? V - : H[e.id] || ne[e.id] - ? Math.max(c, V) - : 1 * c * (-1 * (0.5 * V - 1)) - } - if (v.labelBackgroundColor && v.labelBackgroundOpacity) { - var d = u() * v.labelBackgroundOpacity, - h = oe(se, d) - ;(n.fillStyle = h), - n.fillRect.apply(n, [e.x - a[0] / 2, e.y - a[1] / 2].concat((0, s.Z)(a))) - } - var g = u() - ;(n.textAlign = 'center'), (n.textBaseline = 'middle') - var f = oe(le, g) - ;(n.fillStyle = f), - (n.font = ''.concat(l, 'px Sans-Serif')), - n.fillText(o, e.x, e.y) - } - } - }, - nodeCanvasObjectMode: function () { - return 'after' - }, - linkDirectionalParticles: v.particles ? v.particlesNumber : void 0, - linkDirectionalArrowLength: v.arrows ? v.arrowsLength : void 0, - linkDirectionalArrowRelPos: v.arrowsPos, - linkDirectionalArrowColor: v.arrowsColor - ? function (e) { - return $(v.arrowsColor) - } - : void 0, - linkColor: function (e) { - var n = 'object' === typeof e.source ? e.source.id : e.source, - t = 'object' === typeof e.target ? e.target.id : e.target, - r = ye(e, Z.current), - i = ye(e, Y.current), - o = r || i, - l = e - return v.citeLinkColor && 'cite' === l.type - ? $(v.citeLinkColor) - : (function (e, n, t) { - if (!v.linkHighlight && !v.linkColorScheme && !t) { - var r = ie(e, n) - return $(r) - } - if (!t && !v.linkColorScheme) { - var i = ie(e, n) - return $(i) - } - if (!t) return $(v.linkColorScheme) - if (!v.linkHighlight && !v.linkColorScheme) { - var o = ie(e, n) - return $(o) - } - return v.linkHighlight - ? v.linkColorScheme - ? ee[v.linkColorScheme][v.linkHighlight](V) - : ee[ie(e, n)][v.linkHighlight](V) - : $(v.linkColorScheme) - })(n, t, o) - }, - linkWidth: function (e) { - var n = ye(e, Z.current), - t = ye(e, Y.current) - return n || t ? v.linkWidth * (1 + V * (v.highlightLinkSize - 1)) : v.linkWidth - }, - linkDirectionalParticleWidth: v.particlesWidth, - d3AlphaDecay: t.alphaDecay, - d3AlphaMin: t.alphaMin, - d3VelocityDecay: t.velocityDecay, - onNodeClick: function (e, n) { - var t = n.timeStamp - F.current < 400 - return (F.current = n.timeStamp), E(t ? 'double' : 'click', e) - }, - onBackgroundClick: function () { - R(null), - 0 !== C.nodeIds.length && - y(function (e) { - return xe(xe({}, e), {}, { nodeIds: [] }) - }) - }, - onNodeHover: function (e) { - v.highlight && (T || (J(), X(0)), R(e)) - }, - onNodeRightClick: function (e) { - E('right', e) - }, - } - return (0, l.jsx)('div', { - children: a - ? (0, l.jsx)( - me, - xe( - xe({ ref: n }, ae), - {}, - { - nodeThreeObjectExtend: !0, - backgroundColor: D.colors.white, - nodeOpacity: v.nodeOpacity, - nodeResolution: v.nodeResolution, - linkOpacity: v.linkOpacity, - nodeThreeObject: function (e) { - if (v.labels && (!(v.labels < 3) || H[e.id])) { - var n = new he.Z(e.title.substring(0, 40)) - return ( - (n.color = $(v.labelTextColor)), - (n.backgroundColor = $(v.labelBackgroundColor)), - (n.padding = 2), - (n.textHeight = 8), - n - ) - } - }, - }, - ), - ) - : (0, l.jsx)( - je, - xe( - xe({ ref: n }, ae), - {}, - { - linkLineDash: function (e) { - var n = e - return v.citeDashes && 'cite' === n.type - ? [v.citeDashLength, v.citeGapLength] - : null - }, - }, - ), - ), - }) - }) - function ye(e, n) { - return ( - e.source.id === (null === n || void 0 === n ? void 0 : n.id) || - e.target.id === (null === n || void 0 === n ? void 0 : n.id) - ) - } - }, - 45301: function (e, n, t) { - ;(window.__NEXT_P = window.__NEXT_P || []).push([ - '/', - function () { - return t(374) - }, - ]) - }, - }, - function (e) { - e.O(0, [774, 737, 446, 13, 888, 179], function () { - return (n = 45301), e((e.s = n)) - var n - }) - var n = e.O() - _N_E = n - }, -]) diff --git a/out/_next/static/chunks/pages/index-45f2a558d86856abeaa9.js b/out/_next/static/chunks/pages/index-45f2a558d86856abeaa9.js new file mode 100644 index 0000000..a1ebe2a --- /dev/null +++ b/out/_next/static/chunks/pages/index-45f2a558d86856abeaa9.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{374:function(e,n,t){"use strict";t.r(n),t.d(n,{Graph:function(){return Ce},GraphPage:function(){return be},default:function(){return ve}});var r=t(809),i=t.n(r),o=t(92447),l=t(85893),s=t(59999),a=t(26265),c=t(64121),u=t(67294);function d(e,n){var t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=h(e,null!==(t=r.storage)&&void 0!==t?t:localStorage),o=i.get(),l=void 0!==o?o:n;l!==o&&i.update(l);var s=(0,u.useState)(l),a=s[0],c=s[1];(0,u.useEffect)((function(){a!==l&&c(l)}),[e]);var d=function(e){e instanceof Function?c((function(n){var t=e(n);return i.update(t),t})):(c(e),i.update(e))};return[a,d]}function h(e,n){return{get:function(){var t=n.getItem(e);if(t&&"undefined"!==t)return JSON.parse(t)},update:function(t){n.setItem(e,JSON.stringify(t))},remove:function(){n.removeItem(e)}}}var g=t(54533),f=t(54309),x=t(20233),p=t(40980),j=t(48017),m=t(36194),v=[],b={};for(var C in m.oY)for(var y in m.oY[C]){var k=C+y;"LinearNone"===k&&(k="Linear"),v.push(k),b[k]=m.oY[C][y]}var w=b,S={enabled:!0,charge:-700,collision:!0,collisionStrength:20,centering:!0,centeringStrength:.05,linkStrength:.1,linkIts:1,alphaDecay:.02,alphaTarget:0,alphaMin:0,velocityDecay:.25,gravity:.3,gravityOn:!0},I={orphans:!1,parents:!0,tagsBlacklist:[],tagsWhitelist:[],nodes:[],links:[],date:[]},O={particles:!1,particlesNumber:0,particlesWidth:4,arrows:!1,arrowsLength:1,arrowsPos:.5,arrowsColor:"",linkOpacity:.8,linkWidth:1,nodeRel:4,nodeOpacity:1,nodeResolution:12,labels:2,labelScale:1.5,highlight:!0,highlightNodeSize:2,highlightLinkSize:2,highlightAnim:!0,animationSpeed:700,algorithmOptions:v,algorithmName:"BackOut",linkColorScheme:"gray.500",nodeColorScheme:["red.500","gray.600","yellow.500","green.500","cyan.500","blue.500","pink.500","purple.500","orange.500"],nodeHighlight:"",linkHighlight:"purple.500",backgroundColor:"white",emacsNodeColor:"gray.800",labelTextColor:"black",labelBackgroundColor:"white",labelBackgroundOpacity:.7,citeDashes:!0,citeDashLength:35,citeGapLength:15,citeLinkColor:"gray.600",citeLinkHighlightColor:"",citeNodeColor:"black"},N={follow:"zoom",localSame:"add",zoomPadding:200,zoomSpeed:2e3},L={highlight:"hover",local:"click",follow:"double"},z=t(38347),T=t(93924),R=t(83986),D=t(48931),P=t(67546),H=t(93441),Z=t(6569),E=t(24189),B=t(2827),F=t(90454),A=t(48420),V=t(96699),M=t(40155),W=t(56769),X=t(336),_=t(72026),U=t(94096),Q=t(64115),q=t(88134),K=t(48235),G=t(67273),J=t(15267),Y=t(46049),$=t(95818),ee=t(47647),ne=t(86658),te=t(29356);function re(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function ie(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?re(Object(t),!0).forEach((function(n){(0,a.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):re(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var oe=function(e){var n=e.physics,t=e.setPhysics,r=e.threeDim,i=e.setThreeDim,o=e.filter,a=e.setFilter,d=e.visuals,h=e.setVisuals,g=e.mouse,f=e.setMouse,x=e.behavior,p=e.setBehavior,m=e.tags,v=e.tagColors,b=e.setTagColors,C=(0,u.useState)(!0),y=C[0],k=C[1],w=(0,u.useContext)(te.N),E=w.highlightColor,B=w.setHighlightColor,$=["red.500","orange.500","yellow.500","green.500","cyan.500","blue.500","pink.500","purple.500","white","gray.100","gray.200","gray.300","gray.400","gray.500","gray.600","gray.700","gray.800","gray.900","black"];return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(F.R,{in:!y,children:(0,l.jsx)(j.xu,{position:"absolute",zIndex:"overlay",marginTop:10,marginLeft:10,display:y?"none":"block",children:(0,l.jsx)(A.h,{"aria-label":"Settings",icon:(0,l.jsx)(T.e,{}),onClick:function(){return k(!0)}})})}),(0,l.jsx)(F.R,{in:y,children:(0,l.jsxs)(j.xu,{bg:"alt.100",w:"xs",marginTop:10,marginLeft:10,borderRadius:"xl",maxH:650,paddingBottom:5,zIndex:300,position:"relative",boxShadow:"xl",children:[(0,l.jsxs)(j.xu,{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:2,paddingTop:1,children:[(0,l.jsx)(V.u,{label:"2D",children:(0,l.jsx)(M.z,{onClick:function(){return i(!r)},variant:"ghost",zIndex:"overlay",children:r?"3D":"2D"})}),(0,l.jsxs)(j.xu,{display:"flex",alignItems:"center",children:[(0,l.jsx)(V.u,{label:"Reset settings to defaults",children:(0,l.jsx)(A.h,{"aria-label":"Reset Defaults",icon:(0,l.jsx)(R.A,{}),onClick:function(){h(O),a(I),f(L),t(S),p(N)},variant:"none",size:"sm"})}),(0,l.jsx)(A.h,{size:"sm",icon:(0,l.jsx)(D.T,{}),"aria-label":"Close Tweak Panel",variant:"ghost",onClick:function(){return k(!1)}})]})]}),(0,l.jsx)(ne.ZP,{autoHeight:!0,autoHeightMax:600,autoHide:!0,renderThumbVertical:function(e){var n=e.style,t=(0,z.Z)(e,["style"]);return(0,l.jsx)(j.xu,ie(ie({},t),{},{style:ie(ie({},n),{},{borderRadius:10}),bg:E}))},children:(0,l.jsxs)(W.UQ,{allowMultiple:!0,allowToggle:!0,color:"black",children:[(0,l.jsxs)(W.Qd,{children:[(0,l.jsxs)(W.KF,{children:[(0,l.jsx)(W.XE,{marginRight:2}),(0,l.jsx)(X.X,{size:"sm",children:"Filter"})]}),(0,l.jsxs)(W.Hk,{children:[(0,l.jsxs)(_.gC,{spacing:2,justifyContent:"flex-start",divider:(0,l.jsx)(_.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:7,color:"gray.800",children:[(0,l.jsxs)(U.k,{justifyContent:"space-between",children:[(0,l.jsx)(Q.x,{children:"Orphans"}),(0,l.jsx)(q.r,{onChange:function(){a(ie(ie({},o),{},{orphans:!o.orphans}))},isChecked:o.orphans})]}),(0,l.jsxs)(U.k,{justifyContent:"space-between",children:[(0,l.jsx)(Q.x,{children:"Link nodes with parent file"}),(0,l.jsx)(q.r,{onChange:function(){a(ie(ie({},o),{},{parents:!o.parents}))},isChecked:o.parents})]})]}),(0,l.jsxs)(W.UQ,{padding:0,allowToggle:!0,allowMultiple:!0,paddingLeft:3,children:[(0,l.jsxs)(W.Qd,{children:[(0,l.jsxs)(W.KF,{children:["Tag filters",(0,l.jsx)(W.XE,{})]}),(0,l.jsxs)(W.Hk,{pr:0,mr:0,children:[(0,l.jsx)(ue,{highlightColor:E,filter:o,setFilter:a,tags:m,mode:"blacklist"}),(0,l.jsx)(ue,{highlightColor:E,filter:o,setFilter:a,tags:m,mode:"whitelist"})]})]}),(0,l.jsxs)(W.Qd,{children:[(0,l.jsxs)(W.KF,{children:["Tag Colors",(0,l.jsx)(W.XE,{})]}),(0,l.jsx)(W.Hk,{pr:0,mr:0,children:(0,l.jsx)(de,{tags:m,colorList:$,tagColors:v,setTagColors:b,highlightColor:E})})]})]})]})]}),(0,l.jsxs)(W.Qd,{children:[(0,l.jsx)(W.KF,{display:"flex",justifyContent:"space-between",children:(0,l.jsxs)(j.xu,{display:"flex",children:[(0,l.jsx)(W.XE,{marginRight:2}),(0,l.jsx)(X.X,{size:"sm",children:"Physics"})]})}),(0,l.jsxs)(W.Hk,{children:[(0,l.jsxs)(_.gC,{spacing:2,justifyContent:"flex-start",divider:(0,l.jsx)(_.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:7,color:"gray.800",children:[(0,l.jsx)(ae,{label:"Gravity",value:n.gravityOn,onChange:function(){return t(ie(ie({},n),{},{gravityOn:!n.gravityOn}))},children:(0,l.jsx)(se,{label:"Strength",value:10*n.gravity,onChange:function(e){return t(ie(ie({},n),{},{gravity:e/10}))}})}),(0,l.jsx)(se,{value:-n.charge/100,onChange:function(e){return t(ie(ie({},n),{},{charge:-100*e}))},label:"Repulsive Force"}),(0,l.jsx)(ae,{label:"Collision",infoText:"Perfomance sap, disable if slow",value:n.collision,onChange:function(){return t(ie(ie({},n),{},{collision:!n.collision}))},children:(0,l.jsx)(se,{value:n.collisionStrength/5,onChange:function(e){return t(ie(ie({},n),{},{collisionStrength:5*e}))},label:"Collision Radius",infoText:"Easy with this one, high values can lead to a real jiggly mess"})}),(0,l.jsx)(se,{value:5*n.linkStrength,onChange:function(e){return t(ie(ie({},n),{},{linkStrength:e/5}))},label:"Link Force"}),(0,l.jsx)(se,{label:"Link Iterations",value:n.linkIts,onChange:function(e){return t(ie(ie({},n),{},{linkIts:e}))},min:0,max:6,step:1,infoText:"How many links down the line the physics of a single node affects (Slow)"}),(0,l.jsx)(se,{label:"Viscosity",value:10*n.velocityDecay,onChange:function(e){return t(ie(ie({},n),{},{velocityDecay:e/10}))}})]}),(0,l.jsx)(j.xu,{children:(0,l.jsx)(W.UQ,{paddingLeft:3,allowToggle:!0,children:(0,l.jsxs)(W.Qd,{children:[(0,l.jsxs)(W.KF,{children:[(0,l.jsx)(Q.x,{children:"Advanced"}),(0,l.jsx)(W.XE,{marginRight:2})]}),(0,l.jsx)(W.Hk,{children:(0,l.jsxs)(_.gC,{spacing:2,justifyContent:"flex-start",divider:(0,l.jsx)(_.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:3,color:"gray.800",children:[(0,l.jsx)(se,{label:"Stabilization rate",value:50*n.alphaDecay,onChange:function(e){return t(ie(ie({},n),{},{alphaDecay:e/50}))}}),(0,l.jsx)(ae,{label:"Center nodes",value:n.centering,onChange:function(){return t(ie(ie({},n),{},{centering:!n.centering}))},infoText:"Keeps the nodes in the center of the viewport. If disabled you can drag the nodes anywhere you want.",children:(0,l.jsx)(se,{label:"Centering Strength",value:n.centeringStrength,max:2,step:.01,onChange:function(e){return t(ie(ie({},n),{},{centeringStrength:e}))}})})]})})]})})})]})]}),(0,l.jsxs)(W.Qd,{children:[(0,l.jsxs)(W.KF,{children:[(0,l.jsx)(W.XE,{marginRight:2}),(0,l.jsx)(X.X,{size:"sm",children:"Visual"})]}),(0,l.jsx)(W.Hk,{children:(0,l.jsxs)(_.gC,{justifyContent:"flex-start",align:"stretch",children:[(0,l.jsx)(W.UQ,{allowToggle:!0,defaultIndex:[0],paddingLeft:3,children:(0,l.jsxs)(W.Qd,{children:[(0,l.jsx)(W.KF,{children:(0,l.jsxs)(U.k,{justifyContent:"space-between",w:"100%",children:[(0,l.jsx)(Q.x,{children:"Colors"}),(0,l.jsx)(W.XE,{marginRight:2})]})}),(0,l.jsx)(W.Hk,{children:(0,l.jsx)(_.gC,{spacing:2,justifyContent:"flex-start",divider:(0,l.jsx)(_.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:(0,l.jsxs)(j.xu,{children:[(0,l.jsxs)(U.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsx)(Q.x,{children:"Nodes"}),(0,l.jsx)(V.u,{label:"Shuffle node colors",children:(0,l.jsx)(A.h,{"aria-label":"Shuffle node colors",size:"sm",icon:(0,l.jsx)(P.n,{}),variant:"ghost",onClick:function(){var e,n=null!==(e=d.nodeColorScheme)&&void 0!==e?e:[];h(ie(ie({},d),{},{nodeColorScheme:n.map((function(e){return[Math.random(),e]})).sort((function(e,n){return(0,c.Z)(e,1)[0]-(0,c.Z)(n,1)[0]})).map((function(e){var n=(0,c.Z)(e,2);n[0];return n[1]}))}))}})}),(0,l.jsx)(V.u,{label:"Cycle node colors",children:(0,l.jsx)(A.h,{"aria-label":"Shift node colors",icon:(0,l.jsx)(H.L,{}),size:"sm",variant:"ghost",onClick:function(){var e,n=null!==(e=d.nodeColorScheme)&&void 0!==e?e:[];h(ie(ie({},d),{},{nodeColorScheme:[].concat((0,s.Z)(n.slice(1,n.length)),[n[0]])}))}})}),(0,l.jsxs)(K.v2,{placement:"right",closeOnSelect:!1,matchWidth:!0,children:[(0,l.jsx)(K.j2,{width:20,as:M.z,colorScheme:"",color:"black",rightIcon:(0,l.jsx)(Z.v,{}),children:(0,l.jsx)(U.k,{height:6,width:6,flexDirection:"column",flexWrap:"wrap",children:d.nodeColorScheme.map((function(e){return(0,l.jsx)(j.xu,{bgColor:e,flex:"1 1 8px",borderRadius:"2xl"},e)}))})}),(0,l.jsxs)(G.h,{children:[" ",(0,l.jsx)(K.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:(0,l.jsx)(K.__,{width:500,type:"checkbox",defaultValue:d.nodeColorScheme,onChange:function(e){e.length&&h(ie(ie({},d),{},{nodeColorScheme:e}))},children:$.map((function(e){return(0,l.jsx)(K.ii,{isChecked:d.nodeColorScheme.some((function(n){return n===e})),value:e,isDisabled:1===d.nodeColorScheme.length&&d.nodeColorScheme[0]===e,children:(0,l.jsx)(j.xu,{justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,l.jsx)(j.xu,{bgColor:e,borderRadius:"sm",height:6,width:6})})},e)}))})})]})]})]}),(0,l.jsxs)(U.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsx)(Q.x,{children:"Links"}),(0,l.jsxs)(K.v2,{placement:"right",children:[(0,l.jsx)(K.j2,{as:M.z,colorScheme:"",color:"black",rightIcon:(0,l.jsx)(Z.v,{}),children:(0,l.jsx)(j.xu,{children:d.linkColorScheme?(0,l.jsx)(j.xu,{bgColor:d.linkColorScheme,borderRadius:"sm",height:6,width:6}):(0,l.jsx)(U.k,{height:6,width:6,flexDirection:"column",flexWrap:"wrap",children:d.nodeColorScheme.map((function(e){return(0,l.jsx)(j.xu,{bgColor:e,flex:"1 1 8px",borderRadius:"2xl"},e)}))})})}),(0,l.jsxs)(G.h,{children:[" ",(0,l.jsxs)(K.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:[(0,l.jsx)(K.sN,{onClick:function(){return h(ie(ie({},d),{},{linkColorScheme:""}))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,l.jsx)(U.k,{height:6,width:6,flexDirection:"column",flexWrap:"wrap",children:d.nodeColorScheme.map((function(e){return(0,l.jsx)(j.xu,{bgColor:e,flex:"1 1 8px",borderRadius:"2xl"},e)}))})}),$.map((function(e){return(0,l.jsx)(K.sN,{onClick:function(){return h(ie(ie({},d),{},{linkColorScheme:e}))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,l.jsx)(j.xu,{bgColor:e,borderRadius:"sm",height:6,width:6})},e)}))]})]})]})]}),(0,l.jsxs)(U.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsx)(Q.x,{children:"Accent"}),(0,l.jsxs)(K.v2,{placement:"right",children:[(0,l.jsx)(K.j2,{as:M.z,colorScheme:"",color:"black",rightIcon:(0,l.jsx)(Z.v,{}),children:(0,l.jsx)(j.xu,{bgColor:E,borderRadius:"sm",height:6,width:6})}),(0,l.jsxs)(G.h,{children:[" ",(0,l.jsx)(K.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:$.map((function(e){return(0,l.jsx)(K.sN,{onClick:function(){return B(e)},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,l.jsx)(j.xu,{bgColor:e,borderRadius:"sm",height:6,width:6})},e)}))})]})]})]}),(0,l.jsx)(ce,{colorList:$,label:"Link highlight",visuals:d,setVisuals:h,value:"linkHighlight",visValue:d.linkHighlight}),(0,l.jsx)(ce,{colorList:$,label:"Node highlight",visuals:d,setVisuals:h,value:"nodeHighlight",visValue:d.nodeHighlight}),(0,l.jsx)(ce,{colorList:$,label:"Background",visuals:d,setVisuals:h,value:"backgroundColor",visValue:d.backgroundColor}),(0,l.jsx)(ce,{colorList:$,label:"Emacs node",visuals:d,setVisuals:h,value:"emacsNodeColor",visValue:d.emacsNodeColor})]})})})]})}),(0,l.jsxs)(_.gC,{spacing:2,justifyContent:"flex-start",divider:(0,l.jsx)(_.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:7,color:"gray.800",children:[(0,l.jsx)(se,{label:"Node size",value:d.nodeRel,onChange:function(e){return h(ie(ie({},d),{},{nodeRel:e}))}}),r&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(se,{label:"Node opacity",value:d.nodeOpacity,min:0,max:1,onChange:function(e){return h(ie(ie({},d),{},{nodeOpacity:e}))}}),(0,l.jsx)(se,{label:"Node resolution",value:d.nodeResolution,min:5,max:32,step:1,onChange:function(e){return h(ie(ie({},d),{},{nodeResolution:e}))}})]}),(0,l.jsx)(se,{label:"Link width",value:d.linkWidth,onChange:function(e){return h(ie(ie({},d),{},{linkWidth:e}))}}),r&&(0,l.jsx)(se,{label:"Link opacity",min:0,max:1,value:d.linkOpacity,onChange:function(e){return h(ie(ie({},d),{},{linkOpacity:e}))}}),(0,l.jsxs)(ae,{label:"Dash cite links",infoText:"Add dashes to citation links made with org-roam-bibtex",value:d.citeDashes,onChange:function(){return h(ie(ie({},d),{},{citeDashes:!d.citeDashes}))},children:[(0,l.jsx)(se,{label:"Dash length",value:d.citeDashLength/10,onChange:function(e){return h(ie(ie({},d),{},{citeDashLength:10*e}))}}),(0,l.jsx)(se,{label:"Gap length",value:d.citeGapLength/5,onChange:function(e){return h(ie(ie({},d),{},{citeGapLength:5*e}))}})]}),(0,l.jsx)(ce,{colorList:$,label:"Citation node color",visuals:d,setVisuals:h,value:"citeNodeColor",visValue:d.citeNodeColor}),(0,l.jsx)(ce,{colorList:$,label:"Citation link color",visuals:d,setVisuals:h,value:"citeLinkColor",visValue:d.citeLinkColor}),(0,l.jsx)(ce,{colorList:$,label:"Citation link highlight",visuals:d,setVisuals:h,value:"citeLinkHighlightColor",visValue:d.citeLinkHighlightColor}),(0,l.jsxs)(j.xu,{children:[(0,l.jsxs)(U.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsx)(Q.x,{children:"Labels"}),(0,l.jsxs)(K.v2,{placement:"right",children:[(0,l.jsx)(K.j2,{as:M.z,colorScheme:"",color:"black",rightIcon:(0,l.jsx)(Z.v,{}),children:d.labels?d.labels<2?"On Highlight":"Always":"Never"}),(0,l.jsxs)(G.h,{children:[" ",(0,l.jsxs)(K.qy,{zIndex:"popover",bgColor:"gray.200",children:[(0,l.jsx)(K.sN,{onClick:function(){return h(ie(ie({},d),{},{labels:0}))},children:"Never"}),(0,l.jsx)(K.sN,{onClick:function(){return h(ie(ie({},d),{},{labels:1}))},children:"On Highlight"}),(0,l.jsx)(K.sN,{onClick:function(){return h(ie(ie({},d),{},{labels:2}))},children:"Always"}),(0,l.jsx)(K.sN,{onClick:function(){return h(ie(ie({},d),{},{labels:3}))},children:"Always (even in 3D)"})]})]})]})]}),(0,l.jsx)(J.U,{in:d.labels>0,animateOpacity:!0,children:(0,l.jsxs)(_.gC,{spacing:1,justifyContent:"flex-start",divider:(0,l.jsx)(_.cX,{borderColor:"gray.400"}),align:"stretch",paddingLeft:2,color:"gray.800",children:[(0,l.jsx)(ce,{colorList:$,label:"Text",visuals:d,setVisuals:h,value:"labelTextColor",visValue:d.labelTextColor}),(0,l.jsx)(ce,{colorList:$,label:"Text",visuals:d,setVisuals:h,value:"labelBackgroundColor",visValue:d.labelBackgroundColor}),(0,l.jsx)(J.U,{in:!!d.labelBackgroundColor,animateOpacity:!0,children:(0,l.jsx)(j.xu,{paddingTop:2,children:(0,l.jsx)(se,{label:"Background opacity",value:d.labelBackgroundOpacity,onChange:function(e){console.log(d.labelBackgroundOpacity),h(ie(ie({},d),{},{labelBackgroundOpacity:e}))},min:0,max:1,step:.01})})}),(0,l.jsx)(J.U,{in:d.labels>1,animateOpacity:!0,children:(0,l.jsx)(j.xu,{paddingTop:2,children:(0,l.jsx)(se,{label:"Label Appearance Scale",value:5*d.labelScale,onChange:function(e){return h(ie(ie({},d),{},{labelScale:e/5}))}})})})]})})]}),(0,l.jsxs)(ae,{label:"Link arrows",value:d.arrows,onChange:function(){return h(ie(ie({},d),{},{arrows:!d.arrows}))},children:[(0,l.jsx)(se,{label:"Arrow size",value:d.arrowsLength/10,onChange:function(e){return h(ie(ie({},d),{},{arrowsLength:10*e}))}}),(0,l.jsx)(se,{label:"Arrow Position",value:d.arrowsPos,min:0,max:1,step:.01,onChange:function(e){return h(ie(ie({},d),{},{arrowsPos:e}))}}),(0,l.jsx)(ce,{colorList:$,label:"Arrow Color",visuals:d,setVisuals:h,value:"arrowsColor",visValue:d.arrowsColor})]}),(0,l.jsxs)(ae,{label:"Directional Particles",value:d.particles,onChange:function(){return h(ie(ie({},d),{},{particles:!d.particles}))},children:[(0,l.jsx)(se,{label:"Particle Number",value:d.particlesNumber,max:5,step:1,onChange:function(e){return h(ie(ie({},d),{},{particlesNumber:e}))}}),(0,l.jsx)(se,{label:"Particle Size",value:d.particlesWidth,onChange:function(e){return h(ie(ie({},d),{},{particlesWidth:e}))}})]}),(0,l.jsx)(ae,{label:"Highlight",onChange:function(){return h(ie(ie({},d),{},{highlight:!d.highlight}))},value:d.highlight,children:(0,l.jsxs)(_.gC,{spacing:1,justifyContent:"flex-start",divider:(0,l.jsx)(_.cX,{borderColor:"gray.400"}),align:"stretch",paddingLeft:0,children:[(0,l.jsx)(se,{label:"Highlight Link Thickness",value:d.highlightLinkSize,onChange:function(e){return h(ie(ie({},d),{},{highlightLinkSize:e}))}}),(0,l.jsx)(se,{label:"Highlight Node Size",value:d.highlightNodeSize,onChange:function(e){return h(ie(ie({},d),{},{highlightNodeSize:e}))}}),(0,l.jsxs)(ae,{label:"Highlight Animation",onChange:function(){h(ie(ie({},d),{},{highlightAnim:!d.highlightAnim}))},value:d.highlightAnim,children:[(0,l.jsx)(se,{label:"Animation speed",onChange:function(e){return h(ie(ie({},d),{},{animationSpeed:e}))},value:d.animationSpeed,infoText:"Slower speed has a chance of being buggy",min:50,max:1e3,step:10}),(0,l.jsx)(Y.Ph,{placeholder:d.algorithmName,onChange:function(e){h(ie(ie({},d),{},{algorithmName:e.target.value}))},children:d.algorithmOptions.map((function(e){return(0,l.jsx)("option",{value:e,children:e},e)}))})]})]})})]})]})})]}),(0,l.jsxs)(W.Qd,{children:[(0,l.jsxs)(W.KF,{children:[(0,l.jsx)(W.XE,{marginRight:2}),(0,l.jsx)(X.X,{size:"sm",children:"Behavior"})]}),(0,l.jsx)(W.Hk,{children:(0,l.jsxs)(_.gC,{spacing:2,justifyContent:"flex-start",divider:(0,l.jsx)(_.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:7,color:"gray.800",children:[(0,l.jsxs)(U.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsxs)(U.k,{children:[(0,l.jsx)(Q.x,{children:"Expand Node"}),(0,l.jsx)(le,{infoText:"View only the node and its direct neighbors"})]}),(0,l.jsxs)(K.v2,{placement:"right",children:[(0,l.jsx)(K.j2,{as:M.z,rightIcon:(0,l.jsx)(Z.v,{}),colorScheme:"",color:"black",children:(0,l.jsx)(Q.x,{children:g.local?g.local[0].toUpperCase()+g.local.slice(1):"Never"})}),(0,l.jsxs)(G.h,{children:[" ",(0,l.jsxs)(K.qy,{zIndex:"popover",bgColor:"gray.200",children:[(0,l.jsx)(K.sN,{onClick:function(){return f(ie(ie({},g),{},{local:""}))},children:"Never"}),(0,l.jsx)(K.sN,{onClick:function(){return f(ie(ie({},g),{},{local:"click"}))},children:"Click"}),(0,l.jsx)(K.sN,{onClick:function(){return f(ie(ie({},g),{},{local:"double"}))},children:"Double Click"}),(0,l.jsx)(K.sN,{onClick:function(){return f(ie(ie({},g),{},{local:"right"}))},children:"Right Click"})]})]})]})]}),(0,l.jsxs)(U.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsx)(Q.x,{children:"Open in Emacs"}),(0,l.jsxs)(K.v2,{placement:"right",children:[(0,l.jsx)(K.j2,{as:M.z,rightIcon:(0,l.jsx)(Z.v,{}),colorScheme:"",color:"black",children:(0,l.jsx)(Q.x,{children:g.follow?g.follow[0].toUpperCase()+g.follow.slice(1):"Never"})}),(0,l.jsxs)(G.h,{children:[" ",(0,l.jsxs)(K.qy,{bgColor:"gray.200",zIndex:"popover",children:[(0,l.jsx)(K.sN,{onClick:function(){return f(ie(ie({},g),{},{follow:""}))},children:"Never"}),(0,l.jsx)(K.sN,{onClick:function(){return f(ie(ie({},g),{},{follow:"click"}))},children:"Click"}),(0,l.jsx)(K.sN,{onClick:function(){return f(ie(ie({},g),{},{follow:"double"}))},children:"Double Click"}),(0,l.jsx)(K.sN,{onClick:function(){return f(ie(ie({},g),{},{follow:"right"}))},children:"Right Click"})]})]})]})]}),(0,l.jsxs)(U.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsx)(Q.x,{children:"Follow Emacs by..."}),(0,l.jsxs)(K.v2,{placement:"right",children:[(0,l.jsx)(K.j2,{as:M.z,rightIcon:(0,l.jsx)(Z.v,{}),colorScheme:"",color:"black",children:(0,l.jsx)(Q.x,{children:x.follow[0].toUpperCase()+x.follow.slice(1)})}),(0,l.jsxs)(G.h,{children:[" ",(0,l.jsxs)(K.qy,{bgColor:"gray.200",zIndex:"popover",children:[(0,l.jsx)(K.sN,{onClick:function(){return p(ie(ie({},x),{},{follow:"local"}))},children:"Opening the local graph"}),(0,l.jsx)(K.sN,{onClick:function(){return p(ie(ie({},x),{},{follow:"zoom"}))},children:"Zooming to the current node"})]})]})]})]}),(0,l.jsx)(se,{label:"Zoom speed",value:x.zoomSpeed,min:0,max:4e3,step:100,onChange:function(e){return p(ie(ie({},x),{},{zoomSpeed:e}))}}),(0,l.jsx)(se,{label:"Zoom padding",value:x.zoomPadding,min:0,max:400,step:1,onChange:function(e){return p(ie(ie({},x),{},{zoomPadding:e}))},infoText:"How much to zoom out to accomodate all nodes when changing the view."})]})})]})]})})]})})]})},le=function(e){var n=e.infoText;return(0,l.jsx)(j.xu,{paddingLeft:"1",children:(0,l.jsx)(V.u,{label:n,placement:"top",color:"gray.100",bg:"gray.800",hasArrow:!0,children:(0,l.jsx)(E.h,{})})})},se=function(e){var n=e.min,t=void 0===n?0:n,r=e.max,i=void 0===r?10:r,o=e.step,s=void 0===o?.1:o,a=e.value,c=void 0===a?1:a,d=(0,z.Z)(e,["min","max","step","value"]),h=d.onChange,g=d.label,f=d.infoText,x=(0,u.useContext)(te.N).highlightColor;return(0,l.jsxs)(j.xu,{children:[(0,l.jsxs)(j.xu,{display:"flex",alignItems:"flex-end",children:[(0,l.jsx)(Q.x,{children:g}),f&&(0,l.jsx)(le,{infoText:f})]}),(0,l.jsxs)($.iR,{value:c,onChange:h,min:t,max:i,step:s,children:[(0,l.jsx)($.Uj,{children:(0,l.jsx)($.Ms,{})}),(0,l.jsx)(V.u,{bg:x,label:c.toFixed(1),children:(0,l.jsx)($.gs,{bg:"white"})})]})]})},ae=function(e){var n=e.value,t=e.onChange,r=e.label,i=e.infoText,o=e.children;return(0,l.jsxs)(j.xu,{paddingTop:2,children:[(0,l.jsxs)(j.xu,{display:"flex",justifyContent:"space-between",paddingBottom:2,children:[(0,l.jsxs)(j.xu,{display:"flex",alignItems:"center",children:[(0,l.jsx)(Q.x,{children:r}),i&&(0,l.jsx)(le,{infoText:i})]}),(0,l.jsx)(q.r,{isChecked:!!n,onChange:t})]}),(0,l.jsx)(J.U,{in:!!n,animateOpacity:!0,children:(0,l.jsx)(j.xu,{paddingLeft:4,paddingTop:2,paddingBottom:2,children:o})})]})},ce=function(e){var n=e.label,t=e.colorList,r=e.value,i=e.visuals,o=e.visValue,s=e.setVisuals;return(0,l.jsxs)(U.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsx)(Q.x,{children:n}),(0,l.jsxs)(K.v2,{placement:"right",children:[(0,l.jsx)(K.j2,{as:M.z,colorScheme:"",color:"black",rightIcon:(0,l.jsx)(Z.v,{}),children:(0,l.jsx)(j.xu,{bgColor:o,borderRadius:"sm",height:6,width:6})}),(0,l.jsxs)(G.h,{children:[" ",(0,l.jsxs)(K.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:[(0,l.jsx)(K.sN,{onClick:function(){return s(ie(ie({},i),{},(0,a.Z)({},r,"")))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,l.jsx)(j.xu,{height:6,width:6})}),t.map((function(e){return(0,l.jsx)(K.sN,{onClick:function(){return s(ie(ie({},i),{},(0,a.Z)({},r,e)))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,l.jsx)(j.xu,{bgColor:e,borderRadius:"sm",height:6,width:6})},e)}))]})]})]})]})},ue=function(e){var n=e.filter,t=e.setFilter,r=e.tags,i=e.highlightColor,o=e.mode,s=r.map((function(e){return{value:e,label:e}})),c="blacklist"===o?"tagsBlacklist":"tagsWhitelist",d=(0,u.useState)(n[c].map((function(e){return{value:e,label:e}}))),h=d[0],g=d[1];return(0,l.jsx)(ee.CUIAutoComplete,{items:s,label:"Add tag to "+o,placeholder:" ",onCreateItem:function(e){return null},disableCreateItem:!0,selectedItems:h,onSelectedItemsChange:function(e){e.selectedItems&&(g(e.selectedItems),t(ie(ie({},n),{},(0,a.Z)({},c,e.selectedItems.map((function(e){return e.value}))))))},listItemStyleProps:{overflow:"hidden"},highlightItemBg:"gray.400",toggleButtonStyleProps:{variant:"outline"},inputStyleProps:{focusBorderColor:i,color:"gray.800",borderColor:"gray.600"},tagStyleProps:{rounded:"full",bg:i,height:8,paddingLeft:4,fontWeight:"bold"},hideToggleButton:!0,itemRenderer:function(e){return e.label}})},de=function(e){var n=e.colorList,t=e.tagColors,r=e.setTagColors,i=e.highlightColor,o=e.tags.map((function(e){return{value:e,label:e}})),s=(0,u.useState)(Object.keys(t).map((function(e){return{value:e,label:e}}))),c=s[0],d=s[1];return(0,l.jsxs)(j.xu,{children:[(0,l.jsx)(ee.CUIAutoComplete,{items:o,label:"Add tag to filter",placeholder:" ",disableCreateItem:!0,selectedItems:c,onSelectedItemsChange:function(e){e.selectedItems&&(d(Array.from(new Set(e.selectedItems))),r(Object.fromEntries(Array.from(new Set(e.selectedItems)).map((function(e){var n;return[e.label,null!==(n=t[e.label])&&void 0!==n?n:"gray.600"]})))))},listItemStyleProps:{overflow:"hidden"},highlightItemBg:"gray.400",toggleButtonStyleProps:{variant:"outline"},inputStyleProps:{focusBorderColor:i,color:"gray.800",borderColor:"gray.600"},tagStyleProps:{display:"none",rounded:"full",bg:i,height:8,paddingLeft:4,fontWeight:"bold"},hideToggleButton:!0,itemRenderer:function(e){return e.label}}),(0,l.jsx)(_.gC,{spacing:2,justifyContent:"flex-start",divider:(0,l.jsx)(_.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:Object.keys(t).map((function(e){return(0,l.jsxs)(U.k,{alignItems:"center",justifyContent:"space-between",width:"100%",pl:2,children:[(0,l.jsx)(j.xu,{width:"100%",children:(0,l.jsx)(Q.x,{fontWeight:"bold",children:e})}),(0,l.jsxs)(K.v2,{isLazy:!0,placement:"right",children:[(0,l.jsx)(K.j2,{as:M.z,colorScheme:"",color:"black",children:(0,l.jsx)(j.xu,{bgColor:t[e],borderRadius:"sm",height:6,width:6})}),(0,l.jsxs)(G.h,{children:[" ",(0,l.jsx)(K.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:n.map((function(n){return(0,l.jsx)(K.sN,{onClick:function(){return r(ie(ie({},t),{},(0,a.Z)({},e,n)))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,l.jsx)(j.xu,{bgColor:n,borderRadius:"sm",height:6,width:6})},n)}))})]})]}),(0,l.jsx)(A.h,{"aria-label":"Delete tag color",variant:"ghost",icon:(0,l.jsx)(B.p,{}),onClick:function(){r(Object.fromEntries(Array.from(new Set(c)).map((function(e){var n;return[e.label,null!==(n=t[e.label])&&void 0!==n?n:"gray.600"]})))),d(c.filter((function(n){return n.value!==e})))}})]},e)}))})]})},he=t(31122),ge=t(22003);function fe(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function xe(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?fe(Object(t),!0).forEach((function(n){(0,a.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):fe(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var pe=t.e(4).then(t.bind(t,57004)),je=t.g.window?t(61957).f$:null,me=t.g.window?t(61957).s6:null;function ve(){var e=(0,u.useState)(!1),n=e[0],t=e[1];return(0,u.useEffect)((function(){t(!0)}),[]),n?(0,l.jsx)(be,{}):null}function be(){var e=d("physics",S),n=(0,c.Z)(e,2),t=n[0],r=n[1],i=d("filter",I),o=(0,c.Z)(i,2),h=o[0],g=o[1],f=d("visuals",O),x=(0,c.Z)(f,2),p=x[0],m=x[1],v=(0,u.useState)(null),b=v[0],C=v[1],y=(0,u.useState)(null),k=y[0],w=y[1],z=d("behavior",N),T=(0,c.Z)(z,2),R=T[0],D=T[1],P=d("mouse",L),H=(0,c.Z)(P,2),Z=H[0],E=H[1],B=(0,u.useRef)({}),F=(0,u.useRef)({}),A=(0,u.useRef)([]),V=(0,u.useContext)(te.N).setEmacsTheme,M=d("3d",!1),W=(0,c.Z)(M,2),X=W[0],_=W[1],U=d("tagCols",{}),Q=(0,c.Z)(U,2),q=Q[0],K=Q[1],G=(0,u.useState)({nodeIds:[]}),J=G[0],Y=G[1],$=(0,u.useRef)({nodeIds:[]}),ee=(0,u.useRef)(N);ee.current=R;var ne=(0,u.useRef)(null),re=(0,u.useRef)(null);$.current=J;var ie=function(e,n){var t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2e3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:200,o=ne.current,l=$.current,a=ee.current,c=null!==(t=F.current[n])&&void 0!==t?t:[],u=Object.fromEntries([n].concat((0,s.Z)(c.flatMap((function(e){return[e.source,e.target]})))).map((function(e){return[e,{}]})));return"zoom"===e?(console.log(l),l.nodeIds.length&&(console.log("emptying"),console.log("scope "+l.nodeIds),Y({nodeIds:[]})),void setTimeout((function(){return o.zoomToFit(r,i,(function(e){return u[e.id]}))}),50)):l.nodeIds.length?"add"!==a.localSame?(Y({nodeIds:[n]}),void setTimeout((function(){o.centerAt(0,0,r)}),50)):l.nodeIds.includes(n)&&l.nodeIds.some((function(e){return u[e]}))?(Y((function(e){return xe(xe({},e),{},{nodeIds:[].concat((0,s.Z)(e.nodeIds),[n])})})),void setTimeout((function(){return o.zoomToFit(r,i,(function(e){return u[e.id]}))}),50)):(Y({nodeIds:[n]}),void setTimeout((function(){o.centerAt(0,0,r)}),50)):(Y({nodeIds:[n]}),void setTimeout((function(){o.centerAt(0,0,r)}),50))};return(0,u.useEffect)((function(){re.current=new ge.Z("ws://localhost:35903"),re.current.addEventListener("open",(function(e){console.log("Connection with Emacs established")})),re.current.addEventListener("message",(function(e){ne.current;var n=ee.current,t=JSON.parse(e.data);switch(t.type){case"graphdata":return function(e){var n;A.current=null!==(n=e.tags)&&void 0!==n?n:[];var t=e.nodes.reduce((function(e,n){var t;return xe(xe({},e),{},(0,a.Z)({},n.file,[].concat((0,s.Z)(null!==(t=e[n.file])&&void 0!==t?t:[]),[n])))}),{}),r=Object.keys(t).flatMap((function(e){var n,r=null!==(n=t[e])&&void 0!==n?n:[],i=r.find((function(e){return 0===e.level})),o=r.filter((function(e){return 0!==e.level}));return i?o.map((function(e){return{source:e.id,target:i.id,type:"parent"}})):[]}));B.current=Object.fromEntries(e.nodes.map((function(e){return[e.id,e]})));var i=[].concat((0,s.Z)(e.links),(0,s.Z)(r)).filter((function(e){var n=e.source,t=e.target;return B.current[n]&&B.current[t]}));F.current=i.reduce((function(e,n){var t,r,i;return xe(xe({},e),{},(i={},(0,a.Z)(i,n.source,[].concat((0,s.Z)(null!==(t=e[n.source])&&void 0!==t?t:[]),[n])),(0,a.Z)(i,n.target,[].concat((0,s.Z)(null!==(r=e[n.target])&&void 0!==r?r:[]),[n])),i))}),{});var o=xe(xe({},e),{},{links:i}),l=JSON.parse(JSON.stringify(o));C(l)}(t.data);case"theme":return V(t.data);case"command":switch(t.data.commandName){case"local":var r=R.zoomSpeed,i=R.zoomPadding;ie("local",t.data.id,r,i),w(t.data.id);break;case"zoom":var o,l,c=(null===t||void 0===t||null===(o=t.data)||void 0===o?void 0:o.speed)||n.zoomSpeed,u=(null===t||void 0===t||null===(l=t.data)||void 0===l?void 0:l.padding)||n.zoomPadding;ie("zoom",t.data.id,c,u),w(t.data.id);break;case"follow":ie(n.follow,t.data.id,n.zoomSpeed,n.zoomPadding),w(t.data.id);break;default:return console.error("unknown message type",t.type)}}}))}),[]),b?(0,l.jsxs)(j.xu,{display:"flex",alignItems:"flex-start",flexDirection:"row",height:"100%",children:[(0,l.jsx)(oe,xe(xe({},{physics:t,setPhysics:r,threeDim:X,setThreeDim:_,filter:h,setFilter:g,visuals:p,setVisuals:m,mouse:Z,setMouse:E,behavior:R,setBehavior:D,tagColors:q,setTagColors:K}),{},{tags:A.current})),(0,l.jsx)(j.xu,{position:"absolute",alignItems:"top",children:(0,l.jsx)(Ce,xe({ref:ne,nodeById:B.current,linksByNodeId:F.current,webSocket:re.current},{physics:t,graphData:b,threeDim:X,emacsNodeId:k,filter:h,visuals:p,behavior:R,mouse:Z,scope:J,setScope:Y,tagColors:q}))})]}):null}var Ce=(0,u.forwardRef)((function(e,n){var t=e.physics,r=e.graphData,d=e.threeDim,h=e.linksByNodeId,j=e.filter,m=e.emacsNodeId,v=e.nodeById,b=e.visuals,C=(e.behavior,e.mouse),y=e.scope,k=e.setScope,S=e.webSocket,I=e.tagColors,O=(0,f.iP)(),N=(0,c.Z)(O,2),L=N[0],z=N[1],T=(0,u.useState)(null),R=T[0],D=T[1],P=(0,p.useTheme)(),H=(0,u.useContext)(te.N).emacsTheme,Z=function(e,n){switch(e){case C.local:if(y.nodeIds.includes(n.id))break;k((function(e){return xe(xe({},e),{},{nodeIds:[].concat((0,s.Z)(e.nodeIds),[n.id])})}));break;case C.follow:S.send(n.id)}},E=(0,u.useRef)(null);(0,u.useEffect)((function(){m&&D(v[m])}),[m]),E.current=R;var B=(0,u.useMemo)((function(){if(!E.current)return{};var e=h[E.current.id];return e?Object.fromEntries([E.current.id].concat((0,s.Z)(e.flatMap((function(e){return[e.source,e.target]})))).map((function(e){return[e,{}]}))):{}}),[E.current,h]),F=(0,u.useRef)({}),A=(0,u.useMemo)((function(){F.current={};var e=r.nodes.filter((function(e){var n=e;return j.tagsBlacklist.length&&j.tagsBlacklist.some((function(e){return n.tags.indexOf(e)>-1}))?(F.current=xe(xe({},F.current),{},(0,a.Z)({},n.id,n)),!1):!(j.tagsWhitelist.length>0&&!j.tagsWhitelist.some((function(e){return n.tags.indexOf(e)>-1})))||(F.current=xe(xe({},F.current),{},(0,a.Z)({},n.id,n)),!1)})).filter((function(e){var n,t=(null!==(n=h[e.id])&&void 0!==n?n:[]).filter((function(e){return!F.current[e.source]&&!F.current[e.target]}));return!j.orphans||(j.parents?0!==t.length:0!==t.length&&t.some((function(e){return!["parent","ref"].includes(e.type)})))})),n=e.map((function(e){return e.id}));return{filteredNodes:e,filteredLinks:r.links.filter((function(e){if(j.tagsBlacklist.length||j.tagsWhitelist.length){var t="object"===typeof e.source?e.source.id:e.source,r="object"===typeof e.target?e.target.id:e.target;return n.includes(t)&&n.includes(r)}var i=e;return j.parents||"parent"!==i.type}))}}),[j,r]),V=(0,u.useMemo)((function(){var e=A.filteredNodes.filter((function(e){var n,t=null!==(n=h[e.id])&&void 0!==n?n:[];return y.nodeIds.includes(e.id)||t.some((function(e){return y.nodeIds.includes(e.source)||y.nodeIds.includes(e.target)}))})),n=e.map((function(e){return e.id})),t=A.filteredLinks.filter((function(e){var t="object"===typeof e.source?e.source.id:e.source,r="object"===typeof e.target?e.target.id:e.target;return n.includes(t)&&n.includes(r)}));return 0===y.nodeIds.length?{nodes:A.filteredNodes,links:A.filteredLinks}:{nodes:e,links:t}}),[j,y,r]);(0,u.useEffect)((function(){(0,o.Z)(i().mark((function e(){var r,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.current,e.next=3,pe;case 3:o=e.sent,t.gravityOn?(r.d3Force("x",o.forceX().strength(t.gravity)),r.d3Force("y",o.forceY().strength(t.gravity)),d&&r.d3Force("z",o.forceZ().strength(t.gravity))):(r.d3Force("x",null),r.d3Force("y",null),d&&r.d3Force("z",null)),t.centering?r.d3Force("center",o.forceCenter().strength(t.centeringStrength)):r.d3Force("center",null),t.linkStrength&&r.d3Force("link").strength(t.linkStrength),t.linkIts&&r.d3Force("link").iterations(t.linkIts),t.charge&&r.d3Force("charge").strength(t.charge),r.d3Force("collide",t.collision?o.forceCollide().radius(t.collisionStrength):null);case 10:case"end":return e.stop()}}),e)})))()})),(0,u.useEffect)((function(){var e;null===(e=n.current)||void 0===e||e.d3ReheatSimulation()}),[t]);var M=(0,u.useRef)(0),W=(0,u.useState)(1),X=W[0],_=W[1],U=(0,x._7)((function(e){return _(e)}),{duration:b.animationSpeed,algorithm:w[b.algorithmName]}),Q=(0,c.Z)(U,2),q=Q[0],K=Q[1],G=(0,x._7)((function(e){return _(Math.min(X,-1*(e-1)))}),{duration:b.animationSpeed,algorithm:w[b.algorithmName]}),J=(0,c.Z)(G,2),Y=J[0],$=J[1],ee=(0,u.useRef)(null);(0,u.useEffect)((function(){if(R&&(ee.current=R),!b.highlightAnim)return _(R?1:0);R?q():(K(),X>.5?Y():_(0))}),[R]);var ne=function(e){if(P)return e.split(".").reduce((function(e,n){return e[n]}),P.colors)},re=(0,u.useMemo)((function(){var e=b.nodeColorScheme.concat(b.linkColorScheme||[],b.linkHighlight||[],b.nodeHighlight||[],b.citeNodeColor||[],b.citeLinkColor||[],b.citeLinkHighlightColor||[]);return Object.fromEntries(e.map((function(n){var t=ne(n),r=e.map((function(e){return[e,g.Z(t,ne(e))]}));return[n,Object.fromEntries(r)]})))}),[b.nodeColorScheme,b.linkHighlight,b.nodeHighlight,b.linkColorScheme,H]),ie=(0,u.useMemo)((function(){var e,n,t,r=null!==(e=h[null===(n=ee.current)||void 0===n?void 0:n.id])&&void 0!==e?e:[];return Object.fromEntries([null===(t=ee.current)||void 0===t?void 0:t.id].concat((0,s.Z)(r.flatMap((function(e){return[e.source,e.target]})))).map((function(e){return[e,{}]})))}),[JSON.stringify(R),ee.current]),oe=function(e){var n,t,r,i,o,l,s=null!==(n=null===(t=h[e])||void 0===t?void 0:t.length)&&void 0!==n?n:0,a=s?null===(r=h[e])||void 0===r?void 0:r.filter((function(e){return"parent"===e.type||"cite"===e.type})).length:0,c=j.parents?s:s-a;return b.nodeColorScheme[(i=c,o=0,l=b.nodeColorScheme.length-1,Math.min(Math.max(i,o),l))]},le=function(e,n){return h[e]>h[n]?oe(e):oe(n)},se=function(e,n){return"rgba("+(e=e.replace("#","")).match(new RegExp("(.{"+e.length/3+"})","g")).map((function(n){return parseInt(e.length%2?n+n:n,16)})).concat(isFinite(n)?n:1).join(",")+")"},ae=(0,u.useMemo)((function(){return ne(b.labelTextColor)}),[b.labelTextColor,H]),ce=(0,u.useMemo)((function(){return ne(b.labelBackgroundColor)}),[b.labelBackgroundColor,H]),ue={graphData:V,width:L,height:z,backgroundColor:P.colors.gray[b.backgroundColor],nodeLabel:function(e){return e.title},nodeColor:function(e){return function(e){var n=B[e.id]||ie[e.id];if(b.emacsNodeColor&&e.id===m)return ne(b.emacsNodeColor);if(I&&e.tags.some((function(e){return I[e]}))){var t=I[e.tags.filter((function(e){return I[e]}))[0]];return ne(t)}return b.citeNodeColor&&e.properties.ROAM_REFS?ne(b.citeNodeColor):n&&b.nodeHighlight?re[oe(e.id)][b.nodeHighlight](X):ne(oe(e.id))}(e)},nodeRelSize:b.nodeRel,nodeVal:function(e){var n,t=null!==(n=h[e.id])&&void 0!==n?n:[],r=t.length?t.filter((function(e){return"parent"===e.type})).length:0;return(3+t.length-(j.parents?0:r))*(B[e.id]||ie[e.id]?1+X*(b.highlightNodeSize-1):1)},nodeCanvasObject:function(e,n,t){if(e&&b.labels){var r=ie[e.id];if(!(t<=b.labelScale||1===b.labels)||B[e.id]||r){var i=e.title,o=i.substring(0,Math.min(i.length,40)),l=12/t,a=[1.1*n.measureText(o).width,l].map((function(e){return e+.5*l})),c=Math.min(3*(t-b.labelScale)/b.labelScale,1),u=function(){return 1===b.labels||t<=b.labelScale?X:B[e.id]||ie[e.id]?Math.max(c,X):1*c*(-1*(.5*X-1))};if(b.labelBackgroundColor&&b.labelBackgroundOpacity){var d=u()*b.labelBackgroundOpacity,h=se(ce,d);n.fillStyle=h,n.fillRect.apply(n,[e.x-a[0]/2,e.y-a[1]/2].concat((0,s.Z)(a)))}var g=u();n.textAlign="center",n.textBaseline="middle";var f=se(ae,g);n.fillStyle=f,n.font="".concat(l,"px Sans-Serif"),n.fillText(o,e.x,e.y)}}},nodeCanvasObjectMode:function(){return"after"},linkDirectionalParticles:b.particles?b.particlesNumber:void 0,linkDirectionalArrowLength:b.arrows?b.arrowsLength:void 0,linkDirectionalArrowRelPos:b.arrowsPos,linkDirectionalArrowColor:b.arrowsColor?function(e){return ne(b.arrowsColor)}:void 0,linkColor:function(e){var n="object"===typeof e.source?e.source.id:e.source,t="object"===typeof e.target?e.target.id:e.target,r=ye(e,E.current),i=ye(e,ee.current),o=r||i,l=e;return b.citeLinkColor&&"cite"===l.type?o&&(b.citeLinkHighlightColor||b.linkHighlight)?re[b.citeLinkColor][b.citeLinkHighlightColor||b.linkHighlight](X):ne(b.citeLinkColor):function(e,n,t){if(!b.linkHighlight&&!b.linkColorScheme&&!t){var r=le(e,n);return ne(r)}if(!t&&!b.linkColorScheme){var i=le(e,n);return ne(i)}if(!t)return ne(b.linkColorScheme);if(!b.linkHighlight&&!b.linkColorScheme){var o=le(e,n);return ne(o)}return b.linkHighlight?b.linkColorScheme?re[b.linkColorScheme][b.linkHighlight](X):re[le(e,n)][b.linkHighlight](X):ne(b.linkColorScheme)}(n,t,o)},linkWidth:function(e){var n=ye(e,E.current),t=ye(e,ee.current);return n||t?b.linkWidth*(1+X*(b.highlightLinkSize-1)):b.linkWidth},linkDirectionalParticleWidth:b.particlesWidth,d3AlphaDecay:t.alphaDecay,d3AlphaMin:t.alphaMin,d3VelocityDecay:t.velocityDecay,onNodeClick:function(e,n){var t=n.timeStamp-M.current<400;return M.current=n.timeStamp,Z(t?"double":"click",e)},onBackgroundClick:function(){D(null),0!==y.nodeIds.length&&k((function(e){return xe(xe({},e),{},{nodeIds:[]})}))},onNodeHover:function(e){b.highlight&&(R||($(),_(0)),D(e))},onNodeRightClick:function(e){Z("right",e)}};return(0,l.jsx)("div",{children:d?(0,l.jsx)(me,xe(xe({ref:n},ue),{},{nodeThreeObjectExtend:!0,backgroundColor:P.colors.white,nodeOpacity:b.nodeOpacity,nodeResolution:b.nodeResolution,linkOpacity:b.linkOpacity,nodeThreeObject:function(e){if(b.labels&&(!(b.labels<3)||B[e.id])){var n=new he.Z(e.title.substring(0,40));return n.color=ne(b.labelTextColor),n.backgroundColor=ne(b.labelBackgroundColor),n.padding=2,n.textHeight=8,n}}})):(0,l.jsx)(je,xe(xe({ref:n},ue),{},{linkLineDash:function(e){var n=e;return b.citeDashes&&"cite"===n.type?[b.citeDashLength,b.citeGapLength]:null}}))})}));function ye(e,n){return e.source.id===(null===n||void 0===n?void 0:n.id)||e.target.id===(null===n||void 0===n?void 0:n.id)}},45301:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return t(374)}])}},function(e){e.O(0,[774,737,446,13,888,179],(function(){return n=45301,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
\ No newline at end of file diff --git a/out/_next/static/faIfNptb0fH0Ziqoouvmn/_buildManifest.js b/out/_next/static/faIfNptb0fH0Ziqoouvmn/_buildManifest.js deleted file mode 100644 index 5374ec2..0000000 --- a/out/_next/static/faIfNptb0fH0Ziqoouvmn/_buildManifest.js +++ /dev/null @@ -1,12 +0,0 @@ -;(self.__BUILD_MANIFEST = { - __rewrites: { beforeFiles: [], afterFiles: [], fallback: [] }, - '/': [ - 'static/chunks/fb7d5399-0d6001c72a29ebec41eb.js', - 'static/chunks/d25bd147-2c59edc357c0e2372258.js', - 'static/chunks/13-03ddeff07567357a392f.js', - 'static/chunks/pages/index-2b9ae36e1ad717aff37d.js', - ], - '/_error': ['static/chunks/pages/_error-f5e67a79c709c2df06b8.js'], - sortedPages: ['/', '/_app', '/_error'], -}), - self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB() diff --git a/out/_next/static/faIfNptb0fH0Ziqoouvmn/_ssgManifest.js b/out/_next/static/faIfNptb0fH0Ziqoouvmn/_ssgManifest.js deleted file mode 100644 index 82bedd6..0000000 --- a/out/_next/static/faIfNptb0fH0Ziqoouvmn/_ssgManifest.js +++ /dev/null @@ -1 +0,0 @@ -;(self.__SSG_MANIFEST = new Set()), self.__SSG_MANIFEST_CB && self.__SSG_MANIFEST_CB() diff --git a/out/_next/static/zMdEAFWLCg5pI2rbcMn9E/_buildManifest.js b/out/_next/static/zMdEAFWLCg5pI2rbcMn9E/_buildManifest.js new file mode 100644 index 0000000..1607f30 --- /dev/null +++ b/out/_next/static/zMdEAFWLCg5pI2rbcMn9E/_buildManifest.js @@ -0,0 +1 @@ +self.__BUILD_MANIFEST={__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":["static/chunks/fb7d5399-0d6001c72a29ebec41eb.js","static/chunks/d25bd147-2c59edc357c0e2372258.js","static/chunks/13-b599b309c84d7675574b.js","static/chunks/pages/index-45f2a558d86856abeaa9.js"],"/_error":["static/chunks/pages/_error-f5e67a79c709c2df06b8.js"],sortedPages:["/","/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
\ No newline at end of file diff --git a/out/_next/static/zMdEAFWLCg5pI2rbcMn9E/_ssgManifest.js b/out/_next/static/zMdEAFWLCg5pI2rbcMn9E/_ssgManifest.js new file mode 100644 index 0000000..0511aa8 --- /dev/null +++ b/out/_next/static/zMdEAFWLCg5pI2rbcMn9E/_ssgManifest.js @@ -0,0 +1 @@ +self.__SSG_MANIFEST=new Set,self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB();
\ No newline at end of file diff --git a/out/index.html b/out/index.html index 47d6ab1..9c0ab8c 100644 --- a/out/index.html +++ b/out/index.html @@ -15,13 +15,13 @@ <script src="/_next/static/chunks/webpack-9c7513cc478a82b87a1b.js" defer=""></script> <script src="/_next/static/chunks/framework-2f612445bd50b211f15a.js" defer=""></script> <script src="/_next/static/chunks/main-ae68c11529959c16c50f.js" defer=""></script> - <script src="/_next/static/chunks/pages/_app-3e86b1cac997ecd07336.js" defer=""></script> + <script src="/_next/static/chunks/pages/_app-b9a9a4081d35806300d5.js" defer=""></script> <script src="/_next/static/chunks/fb7d5399-0d6001c72a29ebec41eb.js" defer=""></script> <script src="/_next/static/chunks/d25bd147-2c59edc357c0e2372258.js" defer=""></script> - <script src="/_next/static/chunks/13-03ddeff07567357a392f.js" defer=""></script> - <script src="/_next/static/chunks/pages/index-2b9ae36e1ad717aff37d.js" defer=""></script> - <script src="/_next/static/faIfNptb0fH0Ziqoouvmn/_buildManifest.js" defer=""></script> - <script src="/_next/static/faIfNptb0fH0Ziqoouvmn/_ssgManifest.js" defer=""></script> + <script src="/_next/static/chunks/13-b599b309c84d7675574b.js" defer=""></script> + <script src="/_next/static/chunks/pages/index-45f2a558d86856abeaa9.js" defer=""></script> + <script src="/_next/static/zMdEAFWLCg5pI2rbcMn9E/_buildManifest.js" defer=""></script> + <script src="/_next/static/zMdEAFWLCg5pI2rbcMn9E/_ssgManifest.js" defer=""></script> </head> <body> <div id="__next"> @@ -697,7 +697,7 @@ "props": { "pageProps": {} }, "page": "/", "query": {}, - "buildId": "faIfNptb0fH0Ziqoouvmn", + "buildId": "zMdEAFWLCg5pI2rbcMn9E", "nextExport": true, "autoExport": true, "isFallback": false, diff --git a/pages/index.tsx b/pages/index.tsx index 7d947e0..c829fef 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -92,7 +92,7 @@ export function GraphPage() { const tagsRef = useRef<Tags>([]) const updateGraphData = (orgRoamGraphData: OrgRoamGraphReponse) => { - tagsRef.current = orgRoamGraphData.tags + tagsRef.current = orgRoamGraphData.tags ?? [] const nodesByFile = orgRoamGraphData.nodes.reduce<NodesByFile>((acc, node) => { return { ...acc, @@ -417,44 +417,64 @@ export const Graph = forwardRef(function (props: GraphProps, graphRef: any) { ) }, [centralHighlightedNode.current, linksByNodeId]) + const hiddenNodeIdsRef = useRef<NodeById>({}) const filteredGraphData = useMemo(() => { - const filteredNodes = graphData.nodes.filter((nodeArg) => { - const node = nodeArg as OrgRoamNode - const links = linksByNodeId[node.id as string] ?? [] - if (filter.tags.length && node.tags.length) { - return !filter.tags.some((tag) => node.tags.indexOf(tag) > -1) - } - if (filter.fileless_cites && node.properties.FILELESS) { - return false + hiddenNodeIdsRef.current = {} + const filteredNodes = graphData.nodes + .filter((nodeArg) => { + const node = nodeArg as OrgRoamNode + if ( + filter.tagsBlacklist.length && + filter.tagsBlacklist.some((tag) => node.tags.indexOf(tag) > -1) + ) { + hiddenNodeIdsRef.current = { ...hiddenNodeIdsRef.current, [node.id]: node } + return false + } + if ( + filter.tagsWhitelist.length > 0 && + !filter.tagsWhitelist.some((tag) => node.tags.indexOf(tag) > -1) + ) { + hiddenNodeIdsRef.current = { ...hiddenNodeIdsRef.current, [node.id]: node } + return false + } + if (filter.fileless_cites && node.properties.FILELESS) { + hiddenNodeIdsRef.current = { ...hiddenNodeIdsRef.current, [node.id]: node } + return false } - - if (!filter.orphans) { return true - } + }) + .filter((nodeArg) => { + const node = nodeArg as OrgRoamNode + const links = linksByNodeId[node.id as string] ?? [] + const unhiddenLinks = links.filter( + (link) => + !hiddenNodeIdsRef.current[link.source] && !hiddenNodeIdsRef.current[link.target], + ) - if (filter.parents) { - return links.length !== 0 - } + if (!filter.orphans) { + return true + } - if (links.length === 0) { - return false - } + if (filter.parents) { + return unhiddenLinks.length !== 0 + } - return links.some((link) => !['parent', 'ref'].includes(link.type)) - }) + if (unhiddenLinks.length === 0) { + return false + } + + return unhiddenLinks.some((link) => !['parent', 'ref'].includes(link.type)) + }) const filteredNodeIds = filteredNodes.map((node) => node.id as string) const filteredLinks = graphData.links.filter((link) => { const [sourceId, targetId] = normalizeLinkEnds(link) - if ( - !( + if (filter.tagsBlacklist.length || filter.tagsWhitelist.length){ + return ( filteredNodeIds.includes(sourceId as string) && filteredNodeIds.includes(targetId as string) ) - ) { - return false } - const linkRoam = link as OrgRoamLink return filter.parents || linkRoam.type !== 'parent' }) @@ -571,6 +591,7 @@ export const Graph = forwardRef(function (props: GraphProps, graphRef: any) { visuals.nodeHighlight || [], visuals.citeNodeColor || [], visuals.citeLinkColor || [], + visuals.citeLinkHighlightColor || [], ) return Object.fromEntries( @@ -711,7 +732,7 @@ export const Graph = forwardRef(function (props: GraphProps, graphRef: any) { nodeVal: (node) => { const links = linksByNodeId[node.id!] ?? [] const parentNeighbors = links.length - ? links.filter((link) => link.type === 'parent' || link.type === 'cite').length + ? links.filter((link) => link.type === 'parent').length : 0 const basicSize = 3 + links.length - (!filter.parents ? parentNeighbors : 0) const highlightSize = @@ -799,10 +820,18 @@ export const Graph = forwardRef(function (props: GraphProps, graphRef: any) { const needsHighlighting = linkIsHighlighted || linkWasHighlighted const roamLink = link as OrgRoamLink if (visuals.refLinkColor && roamLink.type === 'ref') { - return getThemeColor(visuals.refLinkColor) + return needsHighlighting && (visuals.refLinkHighlightColor || visuals.linkHighlight) + ? highlightColors[visuals.refLinkColor][ + visuals.refLinkHighlightColor || visuals.linkHighlight + ](opacity) + : getThemeColor(visuals.refLinkColor) } if (visuals.citeLinkColor && roamLink.type === 'cite') { - return getThemeColor(visuals.citeLinkColor) + return needsHighlighting && (visuals.citeLinkHighlightColor || visuals.linkHighlight) + ? highlightColors[visuals.citeLinkColor][ + visuals.citeLinkHighlightColor || visuals.linkHighlight + ](opacity) + : getThemeColor(visuals.citeLinkColor) } return getLinkColor(sourceId as string, targetId as string, needsHighlighting) |