diff --git a/deno.lock b/deno.lock index fa6eab6..f960175 100644 --- a/deno.lock +++ b/deno.lock @@ -62,6 +62,7 @@ "npm:typescript@^5.8.3": "5.9.2", "npm:vite@^6.3.5": "6.3.5_@types+node@24.3.0_yaml@2.8.1_picomatch@4.0.3", "npm:vitest@^3.1.3": "3.2.4_@types+node@24.3.0_vite@6.3.5__@types+node@24.3.0__yaml@2.8.1__picomatch@4.0.3_yaml@2.8.1", + "npm:ws@^8.18.3": "8.18.3", "npm:yaml@^2.5.0": "2.8.1" }, "jsr": { @@ -326,261 +327,131 @@ "tslib" ] }, - "@esbuild/aix-ppc64@0.25.7": { - "integrity": "sha512-uD0kKFHh6ETr8TqEtaAcV+dn/2qnYbH/+8wGEdY70Qf7l1l/jmBUbrmQqwiPKAQE6cOQ7dTj6Xr0HzQDGHyceQ==", - "os": ["aix"], - "cpu": ["ppc64"] - }, "@esbuild/aix-ppc64@0.25.9": { "integrity": "sha512-OaGtL73Jck6pBKjNIe24BnFE6agGl+6KxDtTfHhy1HmhthfKouEcOhqpSL64K4/0WCtbKFLOdzD/44cJ4k9opA==", "os": ["aix"], "cpu": ["ppc64"] }, - "@esbuild/android-arm64@0.25.7": { - "integrity": "sha512-p0ohDnwyIbAtztHTNUTzN5EGD/HJLs1bwysrOPgSdlIA6NDnReoVfoCyxG6W1d85jr2X80Uq5KHftyYgaK9LPQ==", - "os": ["android"], - "cpu": ["arm64"] - }, "@esbuild/android-arm64@0.25.9": { "integrity": "sha512-IDrddSmpSv51ftWslJMvl3Q2ZT98fUSL2/rlUXuVqRXHCs5EUF1/f+jbjF5+NG9UffUDMCiTyh8iec7u8RlTLg==", "os": ["android"], "cpu": ["arm64"] }, - "@esbuild/android-arm@0.25.7": { - "integrity": "sha512-Jhuet0g1k9rAJHrXGIh7sFknFuT4sfytYZpZpuZl7YKDhnPByVAm5oy2LEBmMbuYf3ejWVYCc2seX81Mk+madA==", - "os": ["android"], - "cpu": ["arm"] - }, "@esbuild/android-arm@0.25.9": { "integrity": "sha512-5WNI1DaMtxQ7t7B6xa572XMXpHAaI/9Hnhk8lcxF4zVN4xstUgTlvuGDorBguKEnZO70qwEcLpfifMLoxiPqHQ==", "os": ["android"], "cpu": ["arm"] }, - "@esbuild/android-x64@0.25.7": { - "integrity": "sha512-mMxIJFlSgVK23HSsII3ZX9T2xKrBCDGyk0qiZnIW10LLFFtZLkFD6imZHu7gUo2wkNZwS9Yj3mOtZD3ZPcjCcw==", - "os": ["android"], - "cpu": ["x64"] - }, "@esbuild/android-x64@0.25.9": { "integrity": "sha512-I853iMZ1hWZdNllhVZKm34f4wErd4lMyeV7BLzEExGEIZYsOzqDWDf+y082izYUE8gtJnYHdeDpN/6tUdwvfiw==", "os": ["android"], "cpu": ["x64"] }, - "@esbuild/darwin-arm64@0.25.7": { - "integrity": "sha512-jyOFLGP2WwRwxM8F1VpP6gcdIJc8jq2CUrURbbTouJoRO7XCkU8GdnTDFIHdcifVBT45cJlOYsZ1kSlfbKjYUQ==", - "os": ["darwin"], - "cpu": ["arm64"] - }, "@esbuild/darwin-arm64@0.25.9": { "integrity": "sha512-XIpIDMAjOELi/9PB30vEbVMs3GV1v2zkkPnuyRRURbhqjyzIINwj+nbQATh4H9GxUgH1kFsEyQMxwiLFKUS6Rg==", "os": ["darwin"], "cpu": ["arm64"] }, - "@esbuild/darwin-x64@0.25.7": { - "integrity": "sha512-m9bVWqZCwQ1BthruifvG64hG03zzz9gE2r/vYAhztBna1/+qXiHyP9WgnyZqHgGeXoimJPhAmxfbeU+nMng6ZA==", - "os": ["darwin"], - "cpu": ["x64"] - }, "@esbuild/darwin-x64@0.25.9": { "integrity": "sha512-jhHfBzjYTA1IQu8VyrjCX4ApJDnH+ez+IYVEoJHeqJm9VhG9Dh2BYaJritkYK3vMaXrf7Ogr/0MQ8/MeIefsPQ==", "os": ["darwin"], "cpu": ["x64"] }, - "@esbuild/freebsd-arm64@0.25.7": { - "integrity": "sha512-Bss7P4r6uhr3kDzRjPNEnTm/oIBdTPRNQuwaEFWT/uvt6A1YzK/yn5kcx5ZxZ9swOga7LqeYlu7bDIpDoS01bA==", - "os": ["freebsd"], - "cpu": ["arm64"] - }, "@esbuild/freebsd-arm64@0.25.9": { "integrity": "sha512-z93DmbnY6fX9+KdD4Ue/H6sYs+bhFQJNCPZsi4XWJoYblUqT06MQUdBCpcSfuiN72AbqeBFu5LVQTjfXDE2A6Q==", "os": ["freebsd"], "cpu": ["arm64"] }, - "@esbuild/freebsd-x64@0.25.7": { - "integrity": "sha512-S3BFyjW81LXG7Vqmr37ddbThrm3A84yE7ey/ERBlK9dIiaWgrjRlre3pbG7txh1Uaxz8N7wGGQXmC9zV+LIpBQ==", - "os": ["freebsd"], - "cpu": ["x64"] - }, "@esbuild/freebsd-x64@0.25.9": { "integrity": "sha512-mrKX6H/vOyo5v71YfXWJxLVxgy1kyt1MQaD8wZJgJfG4gq4DpQGpgTB74e5yBeQdyMTbgxp0YtNj7NuHN0PoZg==", "os": ["freebsd"], "cpu": ["x64"] }, - "@esbuild/linux-arm64@0.25.7": { - "integrity": "sha512-HfQZQqrNOfS1Okn7PcsGUqHymL1cWGBslf78dGvtrj8q7cN3FkapFgNA4l/a5lXDwr7BqP2BSO6mz9UremNPbg==", - "os": ["linux"], - "cpu": ["arm64"] - }, "@esbuild/linux-arm64@0.25.9": { "integrity": "sha512-BlB7bIcLT3G26urh5Dmse7fiLmLXnRlopw4s8DalgZ8ef79Jj4aUcYbk90g8iCa2467HX8SAIidbL7gsqXHdRw==", "os": ["linux"], "cpu": ["arm64"] }, - "@esbuild/linux-arm@0.25.7": { - "integrity": "sha512-JZMIci/1m5vfQuhKoFXogCKVYVfYQmoZJg8vSIMR4TUXbF+0aNlfXH3DGFEFMElT8hOTUF5hisdZhnrZO/bkDw==", - "os": ["linux"], - "cpu": ["arm"] - }, "@esbuild/linux-arm@0.25.9": { "integrity": "sha512-HBU2Xv78SMgaydBmdor38lg8YDnFKSARg1Q6AT0/y2ezUAKiZvc211RDFHlEZRFNRVhcMamiToo7bDx3VEOYQw==", "os": ["linux"], "cpu": ["arm"] }, - "@esbuild/linux-ia32@0.25.7": { - "integrity": "sha512-9Jex4uVpdeofiDxnwHRgen+j6398JlX4/6SCbbEFEXN7oMO2p0ueLN+e+9DdsdPLUdqns607HmzEFnxwr7+5wQ==", - "os": ["linux"], - "cpu": ["ia32"] - }, "@esbuild/linux-ia32@0.25.9": { "integrity": "sha512-e7S3MOJPZGp2QW6AK6+Ly81rC7oOSerQ+P8L0ta4FhVi+/j/v2yZzx5CqqDaWjtPFfYz21Vi1S0auHrap3Ma3A==", "os": ["linux"], "cpu": ["ia32"] }, - "@esbuild/linux-loong64@0.25.7": { - "integrity": "sha512-TG1KJqjBlN9IHQjKVUYDB0/mUGgokfhhatlay8aZ/MSORMubEvj/J1CL8YGY4EBcln4z7rKFbsH+HeAv0d471w==", - "os": ["linux"], - "cpu": ["loong64"] - }, "@esbuild/linux-loong64@0.25.9": { "integrity": "sha512-Sbe10Bnn0oUAB2AalYztvGcK+o6YFFA/9829PhOCUS9vkJElXGdphz0A3DbMdP8gmKkqPmPcMJmJOrI3VYB1JQ==", "os": ["linux"], "cpu": ["loong64"] }, - "@esbuild/linux-mips64el@0.25.7": { - "integrity": "sha512-Ty9Hj/lx7ikTnhOfaP7ipEm/ICcBv94i/6/WDg0OZ3BPBHhChsUbQancoWYSO0WNkEiSW5Do4febTTy4x1qYQQ==", - "os": ["linux"], - "cpu": ["mips64el"] - }, "@esbuild/linux-mips64el@0.25.9": { "integrity": "sha512-YcM5br0mVyZw2jcQeLIkhWtKPeVfAerES5PvOzaDxVtIyZ2NUBZKNLjC5z3/fUlDgT6w89VsxP2qzNipOaaDyA==", "os": ["linux"], "cpu": ["mips64el"] }, - "@esbuild/linux-ppc64@0.25.7": { - "integrity": "sha512-MrOjirGQWGReJl3BNQ58BLhUBPpWABnKrnq8Q/vZWWwAB1wuLXOIxS2JQ1LT3+5T+3jfPh0tyf5CpbyQHqnWIQ==", - "os": ["linux"], - "cpu": ["ppc64"] - }, "@esbuild/linux-ppc64@0.25.9": { "integrity": "sha512-++0HQvasdo20JytyDpFvQtNrEsAgNG2CY1CLMwGXfFTKGBGQT3bOeLSYE2l1fYdvML5KUuwn9Z8L1EWe2tzs1w==", "os": ["linux"], "cpu": ["ppc64"] }, - "@esbuild/linux-riscv64@0.25.7": { - "integrity": "sha512-9pr23/pqzyqIZEZmQXnFyqp3vpa+KBk5TotfkzGMqpw089PGm0AIowkUppHB9derQzqniGn3wVXgck19+oqiOw==", - "os": ["linux"], - "cpu": ["riscv64"] - }, "@esbuild/linux-riscv64@0.25.9": { "integrity": "sha512-uNIBa279Y3fkjV+2cUjx36xkx7eSjb8IvnL01eXUKXez/CBHNRw5ekCGMPM0BcmqBxBcdgUWuUXmVWwm4CH9kg==", "os": ["linux"], "cpu": ["riscv64"] }, - "@esbuild/linux-s390x@0.25.7": { - "integrity": "sha512-4dP11UVGh9O6Y47m8YvW8eoA3r8qL2toVZUbBKyGta8j6zdw1cn9F/Rt59/Mhv0OgY68pHIMjGXWOUaykCnx+w==", - "os": ["linux"], - "cpu": ["s390x"] - }, "@esbuild/linux-s390x@0.25.9": { "integrity": "sha512-Mfiphvp3MjC/lctb+7D287Xw1DGzqJPb/J2aHHcHxflUo+8tmN/6d4k6I2yFR7BVo5/g7x2Monq4+Yew0EHRIA==", "os": ["linux"], "cpu": ["s390x"] }, - "@esbuild/linux-x64@0.25.7": { - "integrity": "sha512-ghJMAJTdw/0uhz7e7YnpdX1xVn7VqA0GrWrAO2qKMuqbvgHT2VZiBv1BQ//VcHsPir4wsL3P2oPggfKPzTKoCA==", - "os": ["linux"], - "cpu": ["x64"] - }, "@esbuild/linux-x64@0.25.9": { "integrity": "sha512-iSwByxzRe48YVkmpbgoxVzn76BXjlYFXC7NvLYq+b+kDjyyk30J0JY47DIn8z1MO3K0oSl9fZoRmZPQI4Hklzg==", "os": ["linux"], "cpu": ["x64"] }, - "@esbuild/netbsd-arm64@0.25.7": { - "integrity": "sha512-bwXGEU4ua45+u5Ci/a55B85KWaDSRS8NPOHtxy2e3etDjbz23wlry37Ffzapz69JAGGc4089TBo+dGzydQmydg==", - "os": ["netbsd"], - "cpu": ["arm64"] - }, "@esbuild/netbsd-arm64@0.25.9": { "integrity": "sha512-9jNJl6FqaUG+COdQMjSCGW4QiMHH88xWbvZ+kRVblZsWrkXlABuGdFJ1E9L7HK+T0Yqd4akKNa/lO0+jDxQD4Q==", "os": ["netbsd"], "cpu": ["arm64"] }, - "@esbuild/netbsd-x64@0.25.7": { - "integrity": "sha512-tUZRvLtgLE5OyN46sPSYlgmHoBS5bx2URSrgZdW1L1teWPYVmXh+QN/sKDqkzBo/IHGcKcHLKDhBeVVkO7teEA==", - "os": ["netbsd"], - "cpu": ["x64"] - }, "@esbuild/netbsd-x64@0.25.9": { "integrity": "sha512-RLLdkflmqRG8KanPGOU7Rpg829ZHu8nFy5Pqdi9U01VYtG9Y0zOG6Vr2z4/S+/3zIyOxiK6cCeYNWOFR9QP87g==", "os": ["netbsd"], "cpu": ["x64"] }, - "@esbuild/openbsd-arm64@0.25.7": { - "integrity": "sha512-bTJ50aoC+WDlDGBReWYiObpYvQfMjBNlKztqoNUL0iUkYtwLkBQQeEsTq/I1KyjsKA5tyov6VZaPb8UdD6ci6Q==", - "os": ["openbsd"], - "cpu": ["arm64"] - }, "@esbuild/openbsd-arm64@0.25.9": { "integrity": "sha512-YaFBlPGeDasft5IIM+CQAhJAqS3St3nJzDEgsgFixcfZeyGPCd6eJBWzke5piZuZ7CtL656eOSYKk4Ls2C0FRQ==", "os": ["openbsd"], "cpu": ["arm64"] }, - "@esbuild/openbsd-x64@0.25.7": { - "integrity": "sha512-TA9XfJrgzAipFUU895jd9j2SyDh9bbNkK2I0gHcvqb/o84UeQkBpi/XmYX3cO1q/9hZokdcDqQxIi6uLVrikxg==", - "os": ["openbsd"], - "cpu": ["x64"] - }, "@esbuild/openbsd-x64@0.25.9": { "integrity": "sha512-1MkgTCuvMGWuqVtAvkpkXFmtL8XhWy+j4jaSO2wxfJtilVCi0ZE37b8uOdMItIHz4I6z1bWWtEX4CJwcKYLcuA==", "os": ["openbsd"], "cpu": ["x64"] }, - "@esbuild/openharmony-arm64@0.25.7": { - "integrity": "sha512-5VTtExUrWwHHEUZ/N+rPlHDwVFQ5aME7vRJES8+iQ0xC/bMYckfJ0l2n3yGIfRoXcK/wq4oXSItZAz5wslTKGw==", - "os": ["openharmony"], - "cpu": ["arm64"] - }, "@esbuild/openharmony-arm64@0.25.9": { "integrity": "sha512-4Xd0xNiMVXKh6Fa7HEJQbrpP3m3DDn43jKxMjxLLRjWnRsfxjORYJlXPO4JNcXtOyfajXorRKY9NkOpTHptErg==", "os": ["openharmony"], "cpu": ["arm64"] }, - "@esbuild/sunos-x64@0.25.7": { - "integrity": "sha512-umkbn7KTxsexhv2vuuJmj9kggd4AEtL32KodkJgfhNOHMPtQ55RexsaSrMb+0+jp9XL4I4o2y91PZauVN4cH3A==", - "os": ["sunos"], - "cpu": ["x64"] - }, "@esbuild/sunos-x64@0.25.9": { "integrity": "sha512-WjH4s6hzo00nNezhp3wFIAfmGZ8U7KtrJNlFMRKxiI9mxEK1scOMAaa9i4crUtu+tBr+0IN6JCuAcSBJZfnphw==", "os": ["sunos"], "cpu": ["x64"] }, - "@esbuild/win32-arm64@0.25.7": { - "integrity": "sha512-j20JQGP/gz8QDgzl5No5Gr4F6hurAZvtkFxAKhiv2X49yi/ih8ECK4Y35YnjlMogSKJk931iNMcd35BtZ4ghfw==", - "os": ["win32"], - "cpu": ["arm64"] - }, "@esbuild/win32-arm64@0.25.9": { "integrity": "sha512-mGFrVJHmZiRqmP8xFOc6b84/7xa5y5YvR1x8djzXpJBSv/UsNK6aqec+6JDjConTgvvQefdGhFDAs2DLAds6gQ==", "os": ["win32"], "cpu": ["arm64"] }, - "@esbuild/win32-ia32@0.25.7": { - "integrity": "sha512-4qZ6NUfoiiKZfLAXRsvFkA0hoWVM+1y2bSHXHkpdLAs/+r0LgwqYohmfZCi985c6JWHhiXP30mgZawn/XrqAkQ==", - "os": ["win32"], - "cpu": ["ia32"] - }, "@esbuild/win32-ia32@0.25.9": { "integrity": "sha512-b33gLVU2k11nVx1OhX3C8QQP6UHQK4ZtN56oFWvVXvz2VkDoe6fbG8TOgHFxEvqeqohmRnIHe5A1+HADk4OQww==", "os": ["win32"], "cpu": ["ia32"] }, - "@esbuild/win32-x64@0.25.7": { - "integrity": "sha512-FaPsAHTwm+1Gfvn37Eg3E5HIpfR3i6x1AIcla/MkqAIupD4BW3MrSeUqfoTzwwJhk3WE2/KqUn4/eenEJC76VA==", - "os": ["win32"], - "cpu": ["x64"] - }, "@esbuild/win32-x64@0.25.9": { "integrity": "sha512-PPOl1mi6lpLNQxnGoyAfschAodRFYXJ+9fs6WHXz7CSWKbOqiMZsubC+BQsVKuul+3vKLuwTHsS2c2y9EoKwxQ==", "os": ["win32"], @@ -2128,32 +1999,32 @@ "esbuild@0.25.9": { "integrity": "sha512-CRbODhYyQx3qp7ZEwzxOk4JBqmD/seJrzPa/cGjY1VtIn5E09Oi9/dB4JwctnfZ8Q8iT7rioVv5k/FNT/uf54g==", "optionalDependencies": [ - "@esbuild/aix-ppc64@0.25.9", - "@esbuild/android-arm@0.25.9", - "@esbuild/android-arm64@0.25.9", - "@esbuild/android-x64@0.25.9", - "@esbuild/darwin-arm64@0.25.9", - "@esbuild/darwin-x64@0.25.9", - "@esbuild/freebsd-arm64@0.25.9", - "@esbuild/freebsd-x64@0.25.9", - "@esbuild/linux-arm@0.25.9", - "@esbuild/linux-arm64@0.25.9", - "@esbuild/linux-ia32@0.25.9", - "@esbuild/linux-loong64@0.25.9", - "@esbuild/linux-mips64el@0.25.9", - "@esbuild/linux-ppc64@0.25.9", - "@esbuild/linux-riscv64@0.25.9", - "@esbuild/linux-s390x@0.25.9", - "@esbuild/linux-x64@0.25.9", - "@esbuild/netbsd-arm64@0.25.9", - "@esbuild/netbsd-x64@0.25.9", - "@esbuild/openbsd-arm64@0.25.9", - "@esbuild/openbsd-x64@0.25.9", - "@esbuild/openharmony-arm64@0.25.9", - "@esbuild/sunos-x64@0.25.9", - "@esbuild/win32-arm64@0.25.9", - "@esbuild/win32-ia32@0.25.9", - "@esbuild/win32-x64@0.25.9" + "@esbuild/aix-ppc64", + "@esbuild/android-arm", + "@esbuild/android-arm64", + "@esbuild/android-x64", + "@esbuild/darwin-arm64", + "@esbuild/darwin-x64", + "@esbuild/freebsd-arm64", + "@esbuild/freebsd-x64", + "@esbuild/linux-arm", + "@esbuild/linux-arm64", + "@esbuild/linux-ia32", + "@esbuild/linux-loong64", + "@esbuild/linux-mips64el", + "@esbuild/linux-ppc64", + "@esbuild/linux-riscv64", + "@esbuild/linux-s390x", + "@esbuild/linux-x64", + "@esbuild/netbsd-arm64", + "@esbuild/netbsd-x64", + "@esbuild/openbsd-arm64", + "@esbuild/openbsd-x64", + "@esbuild/openharmony-arm64", + "@esbuild/sunos-x64", + "@esbuild/win32-arm64", + "@esbuild/win32-ia32", + "@esbuild/win32-x64" ], "scripts": true, "bin": true @@ -3650,6 +3521,9 @@ "wrappy@1.0.2": { "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, + "ws@8.18.3": { + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==" + }, "y18n@4.0.3": { "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" }, diff --git a/src/lib/a/cards/AEventPreview.svelte b/src/lib/a/cards/AEventPreview.svelte index 52ac27f..e8bf925 100644 --- a/src/lib/a/cards/AEventPreview.svelte +++ b/src/lib/a/cards/AEventPreview.svelte @@ -1,77 +1,77 @@ @@ -84,15 +90,21 @@ {#each $visualizationConfig.eventConfigs as ec} {@const isEnabled = ec.enabled !== false} {@const isLoaded = (eventCounts[ec.kind] || 0) > 0} - {@const borderColor = isLoaded ? 'border-green-500' : 'border-red-500'} + {@const borderColor = isLoaded ? "border-green-500" : "border-red-500"} {/each} - + {#if !showAddInput} - {/if} - - - + {#if showAddInput}
- - + - -
+ {#snippet footer()} +
+ + +
+ {/snippet} {:else} @@ -335,10 +337,9 @@ {#if isEditing} - toggleEditing(rootId, false)} - /> + {#snippet right()} + toggleEditing(rootId, false)} /> + {/snippet} @@ -727,14 +868,18 @@ {#if isExpanded}
{#each sortedHighlights as highlight} - {@const truncated = useMockHighlights ? "test data" : truncateHighlight(highlight.content)} + {@const truncated = useMockHighlights + ? "test data" + : truncateHighlight(highlight.content)} {@const showCopied = copyFeedback === highlight.id}
@@ -744,12 +889,30 @@ title="Copy naddr" > {#if showCopied} - - + + {:else} - - + + {/if} @@ -776,8 +939,9 @@ animation: flash 1.5s ease-in-out; } - @keyframes :global(flash) { - 0%, 100% { + @keyframes -global-flash { + 0%, + 100% { filter: brightness(1); } 50% { diff --git a/src/lib/components/publications/HighlightSelectionHandler.svelte b/src/lib/components/publications/HighlightSelectionHandler.svelte index 1a17986..3e2efd6 100644 --- a/src/lib/components/publications/HighlightSelectionHandler.svelte +++ b/src/lib/components/publications/HighlightSelectionHandler.svelte @@ -73,7 +73,7 @@ tags: tags, content: selectedText, id: "", - sig: "" + sig: "", }; }); @@ -110,7 +110,7 @@ address: sectionAddress, eventId: sectionEventId, allDataAttrs: publicationSection.dataset, - sectionId: publicationSection.id + sectionId: publicationSection.id, }); currentSelection = selection; @@ -151,13 +151,14 @@ event.pubkey = $userStore.pubkey; // Set pubkey from user store // Use the specific section's address/ID if available, otherwise fall back to publication event - const useAddress = selectedSectionAddress || publicationEvent.tagAddress(); + const useAddress = + selectedSectionAddress || publicationEvent.tagAddress(); const useEventId = selectedSectionEventId || publicationEvent.id; console.log("[HighlightSelectionHandler] Creating highlight with:", { address: useAddress, eventId: useEventId, - fallbackUsed: !selectedSectionAddress + fallbackUsed: !selectedSectionAddress, }); const tags: string[][] = []; @@ -202,7 +203,11 @@ content: String(event.content), }; - if (typeof window !== "undefined" && window.nostr && window.nostr.signEvent) { + if ( + typeof window !== "undefined" && + window.nostr && + window.nostr.signEvent + ) { const signed = await window.nostr.signEvent(plainEvent); event.sig = signed.sig; if ("id" in signed) { @@ -222,7 +227,10 @@ // Remove duplicates const uniqueRelays = Array.from(new Set(relays)); - console.log("[HighlightSelectionHandler] Publishing to relays:", uniqueRelays); + console.log( + "[HighlightSelectionHandler] Publishing to relays:", + uniqueRelays, + ); const signedEvent = { ...plainEvent, @@ -248,11 +256,15 @@ clearTimeout(timeout); if (ok) { publishedCount++; - console.log(`[HighlightSelectionHandler] Published to ${relayUrl}`); + console.log( + `[HighlightSelectionHandler] Published to ${relayUrl}`, + ); WebSocketPool.instance.release(ws); resolve(); } else { - console.warn(`[HighlightSelectionHandler] ${relayUrl} rejected: ${message}`); + console.warn( + `[HighlightSelectionHandler] ${relayUrl} rejected: ${message}`, + ); WebSocketPool.instance.release(ws); reject(new Error(message)); } @@ -263,7 +275,10 @@ ws.send(JSON.stringify(["EVENT", signedEvent])); }); } catch (e) { - console.error(`[HighlightSelectionHandler] Failed to publish to ${relayUrl}:`, e); + console.error( + `[HighlightSelectionHandler] Failed to publish to ${relayUrl}:`, + e, + ); } } @@ -271,7 +286,10 @@ throw new Error("Failed to publish to any relays"); } - showFeedbackMessage(`Highlight created and published to ${publishedCount} relay(s)!`, "success"); + showFeedbackMessage( + `Highlight created and published to ${publishedCount} relay(s)!`, + "success", + ); // Clear the selection if (currentSelection) { @@ -294,7 +312,10 @@ } } catch (error) { console.error("Failed to create highlight:", error); - showFeedbackMessage("Failed to create highlight. Please try again.", "error"); + showFeedbackMessage( + "Failed to create highlight. Please try again.", + "error", + ); } finally { isSubmitting = false; } @@ -349,11 +370,18 @@ {#if showConfirmModal} - +

Selected Text:

-
+

"{selectedText}"

@@ -366,16 +394,21 @@ id="comment" bind:value={comment} placeholder="Share your thoughts about this highlight..." - rows="3" + rows={3} class="w-full" />
{#if showJsonPreview && previewJson} -
+

Event JSON Preview:

-
{JSON.stringify(previewJson, null, 2)}
+
{JSON.stringify(previewJson, null, 2)}
{/if} @@ -383,7 +416,7 @@
- -
@@ -409,7 +450,9 @@ {#if showFeedback}
diff --git a/src/lib/components/publications/Publication.svelte b/src/lib/components/publications/Publication.svelte index 422abf6..fdfc7b1 100644 --- a/src/lib/components/publications/Publication.svelte +++ b/src/lib/components/publications/Publication.svelte @@ -7,7 +7,8 @@ SidebarGroup, SidebarWrapper, Heading, - CloseButton, uiHelpers + CloseButton, + uiHelpers, } from "flowbite-svelte"; import { getContext, onDestroy, onMount } from "svelte"; import { @@ -37,13 +38,14 @@ import { Textarea, P } from "flowbite-svelte"; import { userStore } from "$lib/stores/userStore"; - let { rootAddress, publicationType, indexEvent, publicationTree, toc } = $props<{ - rootAddress: string; - publicationType: string; - indexEvent: NDKEvent; - publicationTree: SveltePublicationTree; - toc: TocType; - }>(); + let { rootAddress, publicationType, indexEvent, publicationTree, toc } = + $props<{ + rootAddress: string; + publicationType: string; + indexEvent: NDKEvent; + publicationTree: SveltePublicationTree; + toc: TocType; + }>(); const ndk = getNdkContext(); @@ -64,23 +66,25 @@ // Toggle between mock and real data for testing (DEBUG MODE) // Can be controlled via VITE_USE_MOCK_COMMENTS and VITE_USE_MOCK_HIGHLIGHTS environment variables - let useMockComments = $state(import.meta.env.VITE_USE_MOCK_COMMENTS === "true"); - let useMockHighlights = $state(import.meta.env.VITE_USE_MOCK_HIGHLIGHTS === "true"); + let useMockComments = $state( + import.meta.env.VITE_USE_MOCK_COMMENTS === "true", + ); + let useMockHighlights = $state( + import.meta.env.VITE_USE_MOCK_HIGHLIGHTS === "true", + ); // Log initial state for debugging - console.log('[Publication] Mock data initialized:', { - useMockComments, - useMockHighlights, + console.log("[Publication] Mock data initialized:", { envVars: { VITE_USE_MOCK_COMMENTS: import.meta.env.VITE_USE_MOCK_COMMENTS, VITE_USE_MOCK_HIGHLIGHTS: import.meta.env.VITE_USE_MOCK_HIGHLIGHTS, - } + }, }); // Derive all event IDs and addresses for highlight fetching let allEventIds = $derived.by(() => { const ids = [indexEvent.id]; - leaves.forEach(leaf => { + leaves.forEach((leaf) => { if (leaf?.id) ids.push(leaf.id); }); return ids; @@ -88,7 +92,7 @@ let allEventAddresses = $derived.by(() => { const addresses = [rootAddress]; - leaves.forEach(leaf => { + leaves.forEach((leaf) => { if (leaf) { const addr = leaf.tagAddress(); if (addr) addresses.push(addr); @@ -99,11 +103,11 @@ // Filter comments for the root publication (kind 30040) let articleComments = $derived( - comments.filter(comment => { + comments.filter((comment) => { // Check if comment targets the root publication via #a tag - const aTag = comment.tags.find(t => t[0] === 'a'); + const aTag = comment.tags.find((t) => t[0] === "a"); return aTag && aTag[1] === rootAddress; - }) + }), ); // #region Loading @@ -124,9 +128,11 @@ console.warn("[Publication] publicationTree is not available"); return; } - - console.log(`[Publication] Loading ${count} more events. Current leaves: ${leaves.length}, loaded addresses: ${loadedAddresses.size}`); - + + console.log( + `[Publication] Loading ${count} more events. Current leaves: ${leaves.length}, loaded addresses: ${loadedAddresses.size}`, + ); + isLoading = true; try { @@ -159,7 +165,9 @@ console.error("[Publication] Error loading more content:", error); } finally { isLoading = false; - console.log(`[Publication] Finished loading. Total leaves: ${leaves.length}, loaded addresses: ${loadedAddresses.size}`); + console.log( + `[Publication] Finished loading. Total leaves: ${leaves.length}, loaded addresses: ${loadedAddresses.size}`, + ); } } @@ -196,12 +204,12 @@ lastElementRef = null; loadedAddresses = new Set(); hasInitialized = false; - + // Reset the publication tree iterator to prevent duplicate events - if (typeof publicationTree.resetIterator === 'function') { + if (typeof publicationTree.resetIterator === "function") { publicationTree.resetIterator(); } - + // AI-NOTE: Use setTimeout to ensure iterator reset completes before loading // This prevents race conditions where loadMore is called before the iterator is fully reset setTimeout(() => { @@ -298,7 +306,9 @@ const kind = parseInt(kindStr); // Create comment event (kind 1111) - const commentEvent = new (await import("@nostr-dev-kit/ndk")).NDKEvent(ndk); + const commentEvent = new (await import("@nostr-dev-kit/ndk")).NDKEvent( + ndk, + ); commentEvent.kind = 1111; commentEvent.content = articleCommentContent; @@ -330,10 +340,10 @@ articleCommentSuccess = false; handleCommentPosted(); }, 1500); - } catch (err) { console.error("[Publication] Error posting article comment:", err); - articleCommentError = err instanceof Error ? err.message : "Failed to post comment"; + articleCommentError = + err instanceof Error ? err.message : "Failed to post comment"; } finally { isSubmittingArticleComment = false; } @@ -344,30 +354,36 @@ */ async function handleDeletePublication() { const confirmed = confirm( - "Are you sure you want to delete this entire publication? This action will publish a deletion request to all relays." + "Are you sure you want to delete this entire publication? This action will publish a deletion request to all relays.", ); if (!confirmed) return; try { - await deleteEvent({ - eventAddress: indexEvent.tagAddress(), - eventKind: indexEvent.kind, - reason: "User deleted publication", - onSuccess: (deletionEventId) => { - console.log("[Publication] Deletion event published:", deletionEventId); - publicationDeleted = true; - - // Redirect after 2 seconds - setTimeout(() => { - goto("/publications"); - }, 2000); + await deleteEvent( + { + eventAddress: indexEvent.tagAddress(), + eventKind: indexEvent.kind, + reason: "User deleted publication", + onSuccess: (deletionEventId) => { + console.log( + "[Publication] Deletion event published:", + deletionEventId, + ); + publicationDeleted = true; + + // Redirect after 2 seconds + setTimeout(() => { + goto("/publications"); + }, 2000); + }, + onError: (error) => { + console.error("[Publication] Failed to delete publication:", error); + alert(`Failed to delete publication: ${error}`); + }, }, - onError: (error) => { - console.error("[Publication] Failed to delete publication:", error); - alert(`Failed to delete publication: ${error}`); - }, - }); + ndk, + ); } catch (error) { console.error("[Publication] Error deleting publication:", error); alert(`Error: ${error}`); @@ -422,14 +438,19 @@ observer = new IntersectionObserver( (entries) => { entries.forEach((entry) => { - if (entry.isIntersecting && !isLoading && !isDone && publicationTree) { + if ( + entry.isIntersecting && + !isLoading && + !isDone && + publicationTree + ) { loadMore(1); } }); }, { threshold: 0.5 }, ); - + // AI-NOTE: Removed duplicate loadMore call // Initial content loading is handled by the $effect that watches publicationTree // This prevents duplicate loading when both onMount and $effect trigger @@ -450,14 +471,11 @@ -
+
- - +
-
+
{#if publicationType !== "blog" && !isLeaf} {#if $publicationColumnVisibility.toc} - + publicationTree.setBookmark(address)} + onSectionFocused={(address: string) => + publicationTree.setBookmark(address)} onLoadMore={() => { - if (!isLoading && !isDone && publicationTree) { - loadMore(4); - } - }} + if (!isLoading && !isDone && publicationTree) { + loadMore(4); + } + }} /> - {/if} {/if} -
{#if $publicationColumnVisibility.main} -
+
@@ -521,7 +549,10 @@
-
+
{#if publicationDeleted} @@ -542,7 +573,9 @@
-