diff options
Diffstat (limited to 'out/_next/static/chunks/pages')
-rw-r--r-- | out/_next/static/chunks/pages/index-5cea1a6a4f484642ff08.js (renamed from out/_next/static/chunks/pages/index-e63523b4f2b01b501b4a.js) | 221 |
1 files changed, 113 insertions, 108 deletions
diff --git a/out/_next/static/chunks/pages/index-e63523b4f2b01b501b4a.js b/out/_next/static/chunks/pages/index-5cea1a6a4f484642ff08.js index c28b350..b4b355e 100644 --- a/out/_next/static/chunks/pages/index-e63523b4f2b01b501b4a.js +++ b/out/_next/static/chunks/pages/index-5cea1a6a4f484642ff08.js @@ -2316,7 +2316,12 @@ children: (0, l.jsx)( je, de( - { ref: K, nodeById: L.current, linksByNodeId: B.current }, + { + ref: K, + nodeById: L.current, + linksByNodeId: B.current, + webSocket: J.current, + }, { physics: t, graphData: v, @@ -2349,14 +2354,17 @@ v = (e.behavior, e.mouse), y = e.scope, C = e.setScope, - k = (0, x.iP)(), - S = (0, a.Z)(k, 2), - I = S[0], - O = S[1], - N = (0, d.useState)(null), - z = N[0], - R = N[1], - T = function (e, n) { + k = e.webSocket, + S = (0, x.iP)(), + I = (0, a.Z)(S, 2), + O = I[0], + N = I[1], + z = (0, d.useState)(null), + R = z[0], + T = z[1], + D = (0, j.useTheme)(), + H = (0, d.useContext)(ee.N).emacsTheme, + E = function (e, n) { switch (e) { case v.local: if (y.nodeIds.includes(n.id)) break @@ -2365,24 +2373,24 @@ }) break case v.follow: - window.open('org-protocol://roam-node?node=' + n.id, '_self') + k.send(n.id) } }, - D = (0, d.useRef)(null) + Z = (0, d.useRef)(null) ;(0, d.useEffect)( function () { - p && R(m[p]) + p && T(m[p]) }, [p], ), - (D.current = z) - var H = (0, d.useMemo)( + (Z.current = R) + var P = (0, d.useMemo)( function () { - if (!D.current) return {} - var e = u[D.current.id] + if (!Z.current) return {} + var e = u[Z.current.id] return e ? Object.fromEntries( - [D.current.id] + [Z.current.id] .concat( (0, s.Z)( e.flatMap(function (e) { @@ -2396,9 +2404,9 @@ ) : {} }, - [D.current, u], + [Z.current, u], ), - E = (0, d.useMemo)( + F = (0, d.useMemo)( function () { var e = i.nodes.filter(function (e) { var n, @@ -2480,46 +2488,43 @@ }, [t], ) - var Z = (0, d.useRef)(0), - P = (0, d.useState)(1), - F = P[0], - L = P[1], - B = (0, f._7)( + var L = (0, d.useRef)(0), + B = (0, d.useState)(1), + M = B[0], + W = B[1], + X = (0, f._7)( function (e) { - return L(e) + return W(e) }, { duration: b.animationSpeed, algorithm: w[b.algorithmName] }, ), - M = (0, a.Z)(B, 2), - W = M[0], - X = M[1], - A = (0, f._7)( + A = (0, a.Z)(X, 2), + _ = A[0], + q = A[1], + U = (0, f._7)( function (e) { - return L(Math.min(F, -1 * (e - 1))) + return W(Math.min(M, -1 * (e - 1))) }, { duration: b.animationSpeed, algorithm: w[b.algorithmName] }, ), - _ = (0, a.Z)(A, 2), - q = _[0], - U = _[1], - Q = (0, d.useRef)(null) + Q = (0, a.Z)(U, 2), + V = Q[0], + K = Q[1], + J = (0, d.useRef)(null) ;(0, d.useEffect)( function () { - if ((z && (Q.current = z), !b.highlightAnim)) return L(z ? 1 : 0) - z ? W() : (X(), F > 0.5 ? q() : L(0)) + if ((R && (J.current = R), !b.highlightAnim)) return W(R ? 1 : 0) + R ? _() : (q(), M > 0.5 ? V() : W(0)) }, - [z], + [R], ) - var V = (0, j.useTheme)(), - K = - ((0, d.useContext)(ee.N), - function (e) { - if (V) - return e.split('.').reduce(function (e, n) { - return e[n] - }, V.colors) - }), - J = (0, d.useMemo)( + var Y = function (e) { + if (D) + return e.split('.').reduce(function (e, n) { + return e[n] + }, D.colors) + }, + G = (0, d.useMemo)( function () { var e = b.nodeColorScheme.concat( b.linkColorScheme || [], @@ -2528,28 +2533,28 @@ ) return Object.fromEntries( e.map(function (n) { - var t = K(n), + var t = Y(n), i = e.map(function (e) { - return [e, g.Z(t, K(e))] + return [e, g.Z(t, Y(e))] }) return [n, Object.fromEntries(i)] }), ) }, - [b.nodeColorScheme, b.linkHighlight, b.nodeHighlight, b.linkColorScheme], + [b.nodeColorScheme, b.linkHighlight, b.nodeHighlight, b.linkColorScheme, H], ), - Y = (0, d.useMemo)( + $ = (0, d.useMemo)( function () { var e, n, t, i = - null !== (e = u[null === (n = Q.current) || void 0 === n ? void 0 : n.id]) && + null !== (e = u[null === (n = J.current) || void 0 === n ? void 0 : n.id]) && void 0 !== e ? e : [] return Object.fromEntries( - [null === (t = Q.current) || void 0 === t ? void 0 : t.id] + [null === (t = J.current) || void 0 === t ? void 0 : t.id] .concat( (0, s.Z)( i.flatMap(function (e) { @@ -2562,9 +2567,9 @@ }), ) }, - [JSON.stringify(z), Q.current], + [JSON.stringify(R), J.current], ), - G = function (e) { + ne = function (e) { var n, t, i, @@ -2588,10 +2593,10 @@ ((r = a), (o = 0), (l = b.nodeColorScheme.length - 1), Math.min(Math.max(r, o), l)) ] }, - $ = function (e, n) { - return u[e] > u[n] ? G(e) : G(n) + te = function (e, n) { + return u[e] > u[n] ? ne(e) : ne(n) }, - ne = function (e, n) { + ie = function (e, n) { return ( 'rgba(' + (e = e.replace('#', '')) @@ -2604,34 +2609,34 @@ ')' ) }, - te = (0, d.useMemo)( + re = (0, d.useMemo)( function () { - return K(b.labelTextColor) + return Y(b.labelTextColor) }, - [b.labelTextColor], + [b.labelTextColor, H], ), - ie = (0, d.useMemo)( + oe = (0, d.useMemo)( function () { - return K(b.labelBackgroundColor) + return Y(b.labelBackgroundColor) }, - [b.labelBackgroundColor], + [b.labelBackgroundColor, H], ), - re = { - graphData: E, - width: I, - height: O, - backgroundColor: V.colors.gray[b.backgroundColor], + le = { + graphData: F, + width: O, + height: N, + backgroundColor: D.colors.gray[b.backgroundColor], nodeLabel: function (e) { return e.title }, nodeColor: function (e) { return (function (e) { - var n = H[e.id] || Y[e.id] + var n = P[e.id] || $[e.id] return b.emacsNodeColor && e.id === p - ? K(b.emacsNodeColor) + ? Y(b.emacsNodeColor) : n && b.nodeHighlight - ? J[G(e.id)][b.nodeHighlight](F) - : K(G(e.id)) + ? G[ne(e.id)][b.nodeHighlight](M) + : Y(ne(e.id)) })(e) }, nodeRelSize: b.nodeRel, @@ -2645,13 +2650,13 @@ : 0 return ( (3 + t.length - (h.parents ? 0 : i)) * - (H[e.id] || Y[e.id] ? 1 + F * (b.highlightNodeSize - 1) : 1) + (P[e.id] || $[e.id] ? 1 + M * (b.highlightNodeSize - 1) : 1) ) }, nodeCanvasObject: function (e, n, t) { if (e && b.labels) { - var i = Y[e.id] - if (!(t <= b.labelScale || 1 === b.labels) || H[e.id] || i) { + var i = $[e.id] + if (!(t <= b.labelScale || 1 === b.labels) || P[e.id] || i) { var r = e.title, o = r.substring(0, Math.min(r.length, 40)), l = 12 / t, @@ -2661,20 +2666,20 @@ a = Math.min((3 * (t - b.labelScale)) / b.labelScale, 1), d = function () { return 1 === b.labels || t <= b.labelScale - ? F - : H[e.id] || Y[e.id] - ? Math.max(a, F) - : 1 * a * (-1 * (0.5 * F - 1)) + ? M + : P[e.id] || $[e.id] + ? Math.max(a, M) + : 1 * a * (-1 * (0.5 * M - 1)) } if (b.labelBackgroundColor && b.labelBackgroundOpacity) { var u = d() * b.labelBackgroundOpacity, - h = ne(ie, u) + h = ie(oe, u) ;(n.fillStyle = h), n.fillRect.apply(n, [e.x - c[0] / 2, e.y - c[1] / 2].concat((0, s.Z)(c))) } var g = d() ;(n.textAlign = 'center'), (n.textBaseline = 'middle') - var x = ne(te, g) + var x = ie(re, g) ;(n.fillStyle = x), (n.font = ''.concat(l, 'px Sans-Serif')), n.fillText(o, e.x, e.y) @@ -2688,54 +2693,54 @@ linkColor: function (e) { var n = 'object' === typeof e.source ? e.source.id : e.source, t = 'object' === typeof e.target ? e.target.id : e.target, - i = pe(e, D.current), - r = pe(e, Q.current) + i = pe(e, Z.current), + r = pe(e, J.current) return (function (e, n, t) { if (!b.linkHighlight && !b.linkColorScheme && !t) { - var i = $(e, n) - return K(i) + var i = te(e, n) + return Y(i) } if (!t && !b.linkColorScheme) { - var r = $(e, n) - return K(r) + var r = te(e, n) + return Y(r) } - if (!t) return K(b.linkColorScheme) + if (!t) return Y(b.linkColorScheme) if (!b.linkHighlight && !b.linkColorScheme) { - var o = $(e, n) - return K(o) + var o = te(e, n) + return Y(o) } return b.linkHighlight ? b.linkColorScheme - ? J[b.linkColorScheme][b.linkHighlight](F) - : J[$(e, n)][b.linkHighlight](F) - : K(b.linkColorScheme) + ? G[b.linkColorScheme][b.linkHighlight](M) + : G[te(e, n)][b.linkHighlight](M) + : Y(b.linkColorScheme) })(n, t, i || r) }, linkWidth: function (e) { - var n = pe(e, D.current), - t = pe(e, Q.current) - return n || t ? b.linkWidth * (1 + F * (b.highlightLinkSize - 1)) : b.linkWidth + var n = pe(e, Z.current), + t = pe(e, J.current) + return n || t ? b.linkWidth * (1 + M * (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 - Z.current < 400 - return (Z.current = n.timeStamp), T(t ? 'double' : 'click', e) + var t = n.timeStamp - L.current < 400 + return (L.current = n.timeStamp), E(t ? 'double' : 'click', e) }, onBackgroundClick: function () { - R(null), + T(null), 0 !== y.nodeIds.length && C(function (e) { return de(de({}, e), {}, { nodeIds: [] }) }) }, onNodeHover: function (e) { - b.highlight && (z || (U(), L(0)), R(e)) + b.highlight && (R || (K(), W(0)), T(e)) }, onNodeRightClick: function (e) { - T('right', e) + E('right', e) }, } return (0, l.jsx)('div', { @@ -2743,20 +2748,20 @@ ? (0, l.jsx)( ge, de( - de({ ref: n }, re), + de({ ref: n }, le), {}, { nodeThreeObjectExtend: !0, - backgroundColor: V.colors.white, + backgroundColor: D.colors.white, nodeOpacity: b.nodeOpacity, nodeResolution: b.nodeResolution, linkOpacity: b.linkOpacity, nodeThreeObject: function (e) { - if (b.labels && (!(b.labels < 3) || H[e.id])) { + if (b.labels && (!(b.labels < 3) || P[e.id])) { var n = new se.Z(e.title.substring(0, 40)) return ( - (n.color = K(b.labelTextColor)), - (n.backgroundColor = K(b.labelBackgroundColor)), + (n.color = Y(b.labelTextColor)), + (n.backgroundColor = Y(b.labelBackgroundColor)), (n.padding = 2), (n.textHeight = 8), n @@ -2766,7 +2771,7 @@ }, ), ) - : (0, l.jsx)(he, de({ ref: n }, re)), + : (0, l.jsx)(he, de({ ref: n }, le)), }) }) function pe(e, n) { |