Bump welshman

This commit is contained in:
Jon Staab
2025-01-17 15:01:05 -08:00
parent e15fb3ce9c
commit 86928fc12c
13 changed files with 70 additions and 80 deletions
+15 -15
View File
@@ -1,12 +1,12 @@
{
"name": "flotilla",
"version": "0.2.3",
"version": "0.2.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "flotilla",
"version": "0.2.3",
"version": "0.2.4",
"dependencies": {
"@capacitor/android": "^6.1.2",
"@capacitor/cli": "^6.1.2",
@@ -30,16 +30,16 @@
"@types/qrcode": "^1.5.5",
"@vite-pwa/assets-generator": "^0.2.6",
"@vite-pwa/sveltekit": "^0.6.6",
"@welshman/app": "~0.0.37",
"@welshman/app": "~0.0.39",
"@welshman/content": "~0.0.15",
"@welshman/dvm": "~0.0.13",
"@welshman/editor": "~0.0.6",
"@welshman/editor": "~0.0.7",
"@welshman/feeds": "~0.0.30",
"@welshman/lib": "~0.0.37",
"@welshman/net": "~0.0.45",
"@welshman/signer": "~0.0.19",
"@welshman/store": "~0.0.15",
"@welshman/util": "~0.0.57",
"@welshman/util": "~0.0.59",
"daisyui": "^4.12.10",
"date-picker-svelte": "^2.13.0",
"dotenv": "^16.4.5",
@@ -4843,9 +4843,9 @@
}
},
"node_modules/@welshman/app": {
"version": "0.0.37",
"resolved": "https://registry.npmjs.org/@welshman/app/-/app-0.0.37.tgz",
"integrity": "sha512-EhhLx10PE6r/soiuaR0GF+NSH9H3ilTaXwmfx2cHHR1PE2LXXvf1oWMJl0ZPFmYe0VWfNiu98SLbTLYwe1Y4dQ==",
"version": "0.0.39",
"resolved": "https://registry.npmjs.org/@welshman/app/-/app-0.0.39.tgz",
"integrity": "sha512-lEEG8Tp2TZLN1VfqR9JRJj2TtT16zozqaJBTMt6thggxVYxxFEGtLAyYA5s73kDqhvsTC/TlGoxt6a6OV5CLHw==",
"license": "MIT",
"dependencies": {
"@types/throttle-debounce": "^5.0.2",
@@ -4855,7 +4855,7 @@
"@welshman/net": "~0.0.45",
"@welshman/signer": "~0.0.19",
"@welshman/store": "~0.0.15",
"@welshman/util": "~0.0.54",
"@welshman/util": "~0.0.58",
"fuse.js": "^7.0.0",
"idb": "^8.0.0",
"svelte": "^4.2.18",
@@ -4902,9 +4902,9 @@
}
},
"node_modules/@welshman/editor": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/@welshman/editor/-/editor-0.0.6.tgz",
"integrity": "sha512-7ZnjrsBX/5Z2OiHStCSBqNlspX/weURcP8yrH9CTcOEqJZfPx5UWfeYmzsbXttvCPBph+Cv9jfHkeVreyLkeKQ==",
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/@welshman/editor/-/editor-0.0.7.tgz",
"integrity": "sha512-dnhntOisr+mSTGH9DXFcH4gvKvs5XyAghucm2WwunlISNHgbFnUcAyUyrCnw5Fzuq5k8k8Fawf4K9bcfKAxDXw==",
"peerDependencies": {
"@tiptap/core": "^2.9.1",
"@tiptap/extension-code": "^2.9.1",
@@ -5004,9 +5004,9 @@
}
},
"node_modules/@welshman/util": {
"version": "0.0.57",
"resolved": "https://registry.npmjs.org/@welshman/util/-/util-0.0.57.tgz",
"integrity": "sha512-YflD6sfqdhIfHioJVlLydvyKOgACFL0dAcWHymlDz/FszIAl2k0XQXKgAjf0lT2uoXfrCdPsfSZwMTW7qUAY6Q==",
"version": "0.0.59",
"resolved": "https://registry.npmjs.org/@welshman/util/-/util-0.0.59.tgz",
"integrity": "sha512-ACSwQqE0G4GSlHnW4Lbt1M1Wg8NVA5gQwod+fbH5+Z3d1RVtz8cKZvCsljaWT2bNyyi5xnh9B5E2ZfajexAxwQ==",
"license": "MIT",
"dependencies": {
"@types/ws": "^8.5.13",
+3 -3
View File
@@ -59,16 +59,16 @@
"@types/qrcode": "^1.5.5",
"@vite-pwa/assets-generator": "^0.2.6",
"@vite-pwa/sveltekit": "^0.6.6",
"@welshman/app": "~0.0.37",
"@welshman/app": "~0.0.39",
"@welshman/content": "~0.0.15",
"@welshman/dvm": "~0.0.13",
"@welshman/editor": "~0.0.6",
"@welshman/editor": "~0.0.7",
"@welshman/feeds": "~0.0.30",
"@welshman/lib": "~0.0.37",
"@welshman/net": "~0.0.45",
"@welshman/signer": "~0.0.19",
"@welshman/store": "~0.0.15",
"@welshman/util": "~0.0.57",
"@welshman/util": "~0.0.59",
"daisyui": "^4.12.10",
"date-picker-svelte": "^2.13.0",
"dotenv": "^16.4.5",
+7 -29
View File
@@ -46,7 +46,7 @@ import {
loadFollows,
loadMutes,
tagEvent,
tagReactionTo,
tagEventForReaction,
getRelayUrls,
userRelaySelections,
userInboxRelaySelections,
@@ -55,6 +55,7 @@ import {
addSession,
clearStorage,
dropSession,
tagEventForComment,
} from "@welshman/app"
import type {Thunk} from "@welshman/app"
import {
@@ -459,7 +460,7 @@ export type ReactionParams = {
}
export const makeReaction = ({event, content}: ReactionParams) => {
const tags = [["k", String(event.kind)], ...tagReactionTo(event)]
const tags = tagEventForReaction(event)
const groupTag = getTag("h", event.tags)
if (groupTag) {
@@ -473,37 +474,14 @@ export const makeReaction = ({event, content}: ReactionParams) => {
export const publishReaction = ({relays, ...params}: ReactionParams & {relays: string[]}) =>
publishThunk({event: makeReaction(params), relays})
export type ReplyParams = {
export type CommentParams = {
event: TrustedEvent
content: string
tags?: string[][]
}
export const makeComment = ({event, content, tags = []}: ReplyParams) => {
const seenRoots = new Set<string>()
export const makeComment = ({event, content, tags = []}: CommentParams) =>
createEvent(COMMENT, {content, tags: [...tags, ...tagEventForComment(event)]})
for (const [raw, ...tag] of event.tags.filter(t => t[0].match(/^(k|e|a|i)$/i))) {
const T = raw.toUpperCase()
const t = raw.toLowerCase()
if (seenRoots.has(T)) {
tags.push([t, ...tag])
} else {
tags.push([T, ...tag])
seenRoots.add(T)
}
}
if (seenRoots.size === 0) {
tags.push(["K", String(event.kind)])
tags.push(["E", event.id])
}
tags.push(["k", String(event.kind)])
tags.push(["e", event.id])
return createEvent(COMMENT, {content, tags})
}
export const publishComment = ({relays, ...params}: ReplyParams & {relays: string[]}) =>
export const publishComment = ({relays, ...params}: CommentParams & {relays: string[]}) =>
publishThunk({event: makeComment(params), relays})
+1 -1
View File
@@ -30,7 +30,7 @@
}
onMount(() => {
editor = getEditor({autofocus: !isMobile, element, submit, uploading})
editor = getEditor({autofocus: !isMobile, element, submit, uploading, aggressive: true})
$editor!.chain().setContent(content).run()
})
+4 -1
View File
@@ -34,7 +34,10 @@
<div class="flex flex-col justify-start gap-1">
<div class="flex items-center justify-between gap-2">
<div class="flex min-w-0 items-center gap-2">
{#if others.length === 1}
{#if others.length === 0}
<ProfileCircle pubkey={$pubkey} size={5} />
Note to self
{:else if others.length === 1}
<ProfileCircle pubkey={others[0]} size={5} />
<ProfileName pubkey={others[0]} />
{:else}
+2 -1
View File
@@ -112,7 +112,8 @@
</div>
</Button>
{/if}
<span class="text-xs opacity-50">{formatTimestampAsTime(event.created_at)}</span>
<span class="whitespace-nowrap text-xs opacity-50"
>{formatTimestampAsTime(event.created_at)}</span>
</div>
{/if}
<div class="text-sm">
+4 -8
View File
@@ -1,7 +1,6 @@
<script lang="ts">
import {onMount} from "svelte"
import {first, sortBy, ctx} from "@welshman/lib"
import {getAncestorTags} from "@welshman/util"
import {ctx} from "@welshman/lib"
import type {Filter} from "@welshman/util"
import {deriveEvents} from "@welshman/store"
import {repository, load, loadRelaySelections, formatTimestampRelative} from "@welshman/app"
@@ -13,11 +12,9 @@
export let pubkey
const filters: Filter[] = [{authors: [pubkey]}]
const filters: Filter[] = [{authors: [pubkey], limit: 1}]
const events = deriveEvents(repository, {filters})
$: roots = $events.filter(e => getAncestorTags(e.tags).replies.length === 0)
onMount(async () => {
// Make sure we have their relay selections before we load their posts
await loadRelaySelections(pubkey)
@@ -39,10 +36,9 @@
</Link>
</div>
<ProfileInfo {pubkey} />
{#if roots.length > 0}
{@const event = first(sortBy(e => -e.created_at, roots))}
{#if $events.length > 0}
<div class="bg-alt badge badge-neutral border-none">
Last active {formatTimestampRelative(event.created_at)}
Last active {formatTimestampRelative($events[0].created_at)}
</div>
{/if}
<Link class="btn btn-primary sm:hidden" href={makeChatPath([pubkey])}>
+2 -2
View File
@@ -2,7 +2,7 @@
import {onMount} from "svelte"
import {sortBy, uniqBy} from "@welshman/lib"
import {feedFromFilter, makeIntersectionFeed, makeRelayFeed} from "@welshman/feeds"
import {NOTE, getAncestorTags} from "@welshman/util"
import {NOTE, getReplyTags} from "@welshman/util"
import type {TrustedEvent} from "@welshman/util"
import {createFeedController} from "@welshman/app"
import {createScroller} from "@lib/html"
@@ -22,7 +22,7 @@
feedFromFilter({kinds: [NOTE], authors: [pubkey]}),
),
onEvent: (event: TrustedEvent) => {
if (getAncestorTags(event.tags).replies.length === 0) {
if (getReplyTags(event.tags).replies.length === 0) {
buffer.push(event)
}
},
+12 -10
View File
@@ -36,16 +36,18 @@
)
onMount(() => {
load({
relays: [url],
filters: [{kinds: [REACTION, REPORT, DELETE], "#e": [event.id]}],
onEvent: batch(300, (events: TrustedEvent[]) => {
load({
relays: [url],
filters: [{kinds: [DELETE], "#e": events.map(e => e.id)}],
})
}),
})
if (url) {
load({
relays: [url],
filters: [{kinds: [REACTION, REPORT, DELETE], "#e": [event.id]}],
onEvent: batch(300, (events: TrustedEvent[]) => {
load({
relays: [url],
filters: [{kinds: [DELETE], "#e": events.map(e => e.id)}],
})
}),
})
}
})
</script>
+7
View File
@@ -26,6 +26,7 @@ export const signWithAssert = async (template: StampedEvent) => {
}
export const getEditor = ({
aggressive = false,
autofocus = false,
charCount,
content = "",
@@ -35,6 +36,7 @@ export const getEditor = ({
uploading,
wordCount,
}: {
aggressive?: boolean
autofocus?: boolean
charCount?: Writable<number>
content?: string
@@ -60,6 +62,11 @@ export const getEditor = ({
placeholder,
},
},
breakOrSubmit: {
config: {
aggressive,
},
},
fileUpload: {
config: {
onDrop() {
+11 -8
View File
@@ -421,19 +421,22 @@ export const chats = derived(
pushToMapKey(messagesByChatId, chatId, message)
}
const displayPubkey = (pubkey: string) => {
const profile = $profilesByPubkey.get(pubkey)
return profile ? displayProfile(profile) : ""
}
return sortBy(
c => -c.last_activity,
Array.from(messagesByChatId.entries()).map(([id, events]): Chat => {
const pubkeys = splitChatId(id)
const pubkeys = remove($pubkey!, splitChatId(id))
const messages = sortBy(e => -e.created_at, events)
const last_activity = messages[0].created_at
const search_text = remove($pubkey as string, pubkeys)
.map(pubkey => {
const profile = $profilesByPubkey.get(pubkey)
return profile ? displayProfile(profile) : ""
})
.join(" ")
const search_text =
pubkeys.length === 0
? displayPubkey($pubkey!) + " note to self"
: pubkeys.map(displayPubkey).join(" ")
return {id, pubkeys, messages, last_activity, search_text}
}),
+1 -1
View File
@@ -25,7 +25,7 @@
let term = ""
$: chats = $chatSearch.searchOptions(term).filter(c => c.pubkeys.length > 1)
$: chats = $chatSearch.searchOptions(term)
</script>
<SecondaryNav>
+1 -1
View File
@@ -17,7 +17,7 @@
const openMenu = () => pushModal(ChatMenuMobile)
$: chats = $chatSearch.searchOptions(term).filter(c => c.pubkeys.length > 1)
$: chats = $chatSearch.searchOptions(term)
onDestroy(() => {
setChecked($page.url.pathname)