@estiva-app/conversation 0.23.1 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/README.md +3 -2
- package/dist/boxCard.d.ts +25 -6
- package/dist/boxCard.d.ts.map +1 -1
- package/dist/boxCard.js +27 -9
- package/dist/boxCard.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/openingWords.d.ts +45 -1
- package/dist/openingWords.d.ts.map +1 -1
- package/dist/openingWords.js +83 -17
- package/dist/openingWords.js.map +1 -1
- package/dist/references.d.ts +36 -1
- package/dist/references.d.ts.map +1 -1
- package/dist/references.js +39 -2
- package/dist/references.js.map +1 -1
- package/package.json +1 -1
- package/src/boxCard.ts +38 -9
- package/src/index.ts +6 -2
- package/src/openingWords.ts +109 -17
- package/src/references.ts +69 -3
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,45 @@ none. A change to how an event is read is a MINOR in `0.x` even when no
|
|
|
6
6
|
signature moved, because two apps on different versions would then disagree
|
|
7
7
|
about a conversation.
|
|
8
8
|
|
|
9
|
+
## 0.24.0 — 2026-10-30
|
|
10
|
+
|
|
11
|
+
Three of Katerina's calls from the widget review (30 October), once for
|
|
12
|
+
every app.
|
|
13
|
+
|
|
14
|
+
**`[` lists Files first, and finds a message by its own words** (item 19).
|
|
15
|
+
`referenceSectionsOf(ranked)` gives `rankReferences`' two sections in the
|
|
16
|
+
order every app draws them: Files, then Messages (CON-26's ranking had
|
|
17
|
+
Messages above Files, so typing a file's word picked a message instead).
|
|
18
|
+
`messageCandidate(message, tier, nameOf, { resolveLink })` builds a
|
|
19
|
+
message's row as Peek, Ship and Leaf each built their own: its reference,
|
|
20
|
+
its author, its opening words as the caption, and `messageWords(body,
|
|
21
|
+
nameOf)` to be found by — what its writer wrote, with no URL and no type
|
|
22
|
+
word for a file or message it names, so a message is no longer found by the
|
|
23
|
+
raw text of a link in it. Each app passed the raw body as `search`.
|
|
24
|
+
|
|
25
|
+
**A link in a message preview reads as what it names** (item 20).
|
|
26
|
+
`openingWords(body, nameOf, { resolveLink })` reads a bare app URL the app
|
|
27
|
+
has resolved (§7.7) as the reference it names, "Issue" or "Message", as its
|
|
28
|
+
chip would (§13.6.2, "A bare app link reads as a reference"), never as the
|
|
29
|
+
raw URL. One nothing claims, one not answered yet, one in code and one in a
|
|
30
|
+
link's words stay as written. Without `resolveLink` it reads as before.
|
|
31
|
+
|
|
32
|
+
**An edit box shows the message's card, with its ✕** (item 36). With the
|
|
33
|
+
message's folded `embed` set as `folded`, `boxLinksOf` and `boxReadOf` give
|
|
34
|
+
the edit box the card the message has, while the edit still names its file,
|
|
35
|
+
so it can be seen and taken off there; otherwise, as before, the default
|
|
36
|
+
for a file the edit names first. A value the set holds as `none` (✕ after
|
|
37
|
+
sending) gets no default again, even when its link is taken out and put
|
|
38
|
+
back: a card taken off stays off (SPEC §13.6.2 lets a writer give it one;
|
|
39
|
+
these apps no longer do). `embedsToEdit` follows: the message's own card
|
|
40
|
+
kept leaves the set as it was (`undefined`, where it carried the set with
|
|
41
|
+
that card `detailed`, which draws the same); ✕ on it sets it `none` — which
|
|
42
|
+
also fixes ✕ on a link put back whose card the set still carried, which
|
|
43
|
+
used to keep the card.
|
|
44
|
+
|
|
45
|
+
SPEC: none changed. Nothing is read differently; what an edit writes stays
|
|
46
|
+
within §13.6.2's "The default on an edit".
|
|
47
|
+
|
|
9
48
|
## 0.23.1 — 2026-10-30
|
|
10
49
|
|
|
11
50
|
**A word typed right after a chip is sent a space apart from it.** A chip
|
package/README.md
CHANGED
|
@@ -27,8 +27,9 @@ pass, the clock is a `createdAtMs` you pass, and drafts take their storage.
|
|
|
27
27
|
| writing | §6.4, §13.6 | `buildComment`, `buildReply`, `placeOf`, `referenceTagsFor`, `mentionTagsFor` |
|
|
28
28
|
| what a composer's pick writes | §13.1 | `mentionText`, `messageReference`, `urgentTagsFor`, `URGENT_TAG` |
|
|
29
29
|
| what the shared comment box holds, as the message it writes, and back | §13.1 | `composerText`, `composerDocument`, `withoutNewUrgency`, `composerDraft` |
|
|
30
|
-
| what a box shows under itself while a comment is written: the one file's card and each block link's part, and the `embed` a send or an edit writes | §13.6.1, §13.6.2 | `boxReadOf`, `boxLinksOf`, `embedsToSend`, `embedsToEdit`, `namedBefore`, `withoutCard`, `linkTargetOf` |
|
|
31
|
-
| what `[` offers, and in what order | §13.1 | `rankReferences`, `referenceMatch`, `fileReference`, `referenceSearch`, `MESSAGE_TIER`, `FILE_TIER`, `REFERENCE_CAPS` |
|
|
30
|
+
| what a box shows under itself while a comment is written or edited: the one file's card (an edit's own card, with its ✕) and each block link's part, and the `embed` a send or an edit writes | §13.6.1, §13.6.2 | `boxReadOf`, `boxLinksOf`, `embedsToSend`, `embedsToEdit`, `namedBefore`, `withoutCard`, `linkTargetOf` |
|
|
31
|
+
| what `[` offers, and in what order: Files, then Messages, a message found by its own words | §13.1 | `rankReferences`, `referenceSectionsOf`, `messageCandidate`, `referenceMatch`, `fileReference`, `referenceSearch`, `MESSAGE_TIER`, `FILE_TIER`, `REFERENCE_CAPS` |
|
|
32
|
+
| a message as a preview line says it, a link as what it names; the words it is found by | §13.1, §13.6.2 | `openingWords`, `referenceWord`, `messageWords` |
|
|
32
33
|
| ordering | §6.2, §6.3 | `trustedTs`, `orderingMs`, `byOrder` |
|
|
33
34
|
| edits and attachments | §6.8 | `editTargetOf`, `foldEdits`, `foldAttachments` |
|
|
34
35
|
| reactions | §6.6 | `REACTION_HORIZON`, `reactionHorizon`, `reactionTargetOf`, `reactionEmojiOf`, `foldReactions` |
|
package/dist/boxCard.d.ts
CHANGED
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
* a Folder, a person, a message and the file the conversation is on do not
|
|
10
10
|
* count, a link on words counts by its target, and a plain web link counts
|
|
11
11
|
* for nothing. ✕ takes it off (the box's to keep).
|
|
12
|
+
* - **An edit's card.** The message's own card while the edit still names its
|
|
13
|
+
* file, with its ✕, so it can be seen and taken off there; otherwise the
|
|
14
|
+
* default for a file the edit names first. A card taken off before, with ✕
|
|
15
|
+
* on the sent message, never comes back in an edit (Katerina, 2026-10-30,
|
|
16
|
+
* widget review item 36).
|
|
12
17
|
* - **The live part of each block link**, as the `part` the message will
|
|
13
18
|
* carry, one per file. A part counts as its file and draws instead of a card,
|
|
14
19
|
* so linking an issue and a block of a page shows the block and no card. A
|
|
@@ -28,7 +33,12 @@ export interface BoxLinks {
|
|
|
28
33
|
values: string[];
|
|
29
34
|
/** The block links' parts, one per file, the first link's; none of the conversation's own file. */
|
|
30
35
|
parts: PartPointer[];
|
|
31
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* The card under the box, before any ✕: for a new message, the file that
|
|
38
|
+
* gets the default card; for an edit (`folded` given), the message's own
|
|
39
|
+
* card while the edit still names it, else the default for a file the edit
|
|
40
|
+
* names first.
|
|
41
|
+
*/
|
|
32
42
|
card?: string;
|
|
33
43
|
/**
|
|
34
44
|
* Every URL the text names, bare or as a link's target, once each: what the
|
|
@@ -45,6 +55,13 @@ export interface BoxLinkContext {
|
|
|
45
55
|
here?: string;
|
|
46
56
|
/** An edit's: the values the message named before it, which get no default again. */
|
|
47
57
|
previous?: readonly string[];
|
|
58
|
+
/**
|
|
59
|
+
* An edit's: the message's folded `embed` set (`foldEmbeds`). Its card shows
|
|
60
|
+
* under the box while the edit names its file, and a value it holds as
|
|
61
|
+
* `none` — a card taken off with ✕ after sending — gets no default again,
|
|
62
|
+
* even named afresh.
|
|
63
|
+
*/
|
|
64
|
+
folded?: readonly Embed[];
|
|
48
65
|
}
|
|
49
66
|
/**
|
|
50
67
|
* What an app link in the box draws as: the file or message it names, or, for
|
|
@@ -52,7 +69,7 @@ export interface BoxLinkContext {
|
|
|
52
69
|
* file's chip, the block live under the box.
|
|
53
70
|
*/
|
|
54
71
|
export declare function linkTargetOf(url: string, context: Pick<BoxLinkContext, 'resolveLink' | 'blockOf'>): string | undefined;
|
|
55
|
-
/** What a marker text names, and the one
|
|
72
|
+
/** What a marker text names, and the one card it shows under the box. */
|
|
56
73
|
export declare function boxLinksOf(text: string, context: BoxLinkContext): BoxLinks;
|
|
57
74
|
/** {@link boxLinksOf} of a composer's document (`CommentBox`'s JSON), read as {@link composerText} writes it. */
|
|
58
75
|
export declare function boxReadOf(doc: EditorDocument | EditorNode, context: BoxLinkContext): BoxLinks;
|
|
@@ -65,10 +82,12 @@ export declare function namedBefore(text: string, context: Pick<BoxLinkContext,
|
|
|
65
82
|
export declare function embedsToSend(links: Pick<BoxLinks, 'card'>, removed: ReadonlySet<string>): Embed[];
|
|
66
83
|
/**
|
|
67
84
|
* The `embed` set an edit sends, or undefined to leave the message's as it
|
|
68
|
-
* was.
|
|
69
|
-
*
|
|
70
|
-
* set
|
|
71
|
-
*
|
|
85
|
+
* was. `links` is read with `previous` and `folded`, so its card is the
|
|
86
|
+
* message's own or the default for a file the edit names first. The message's
|
|
87
|
+
* own card, kept, leaves the set as it was; taken off with ✕ in the edit box,
|
|
88
|
+
* it is set `none`. A file named first adds its default; ✕ on that one writes
|
|
89
|
+
* nothing. Either way the whole folded set goes with it, since a set replaces
|
|
90
|
+
* (§13.6.2), and a card removed with ✕, before sending or after, stays removed.
|
|
72
91
|
*/
|
|
73
92
|
export declare function embedsToEdit(links: Pick<BoxLinks, 'card'>, removed: ReadonlySet<string>, folded: readonly Embed[] | undefined): Embed[] | undefined;
|
|
74
93
|
/** ✕ on a sent message's card: the folded set, with that card `none` and every other kept. */
|
package/dist/boxCard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boxCard.d.ts","sourceRoot":"","sources":["../src/boxCard.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"boxCard.d.ts","sourceRoot":"","sources":["../src/boxCard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0B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AG,SAAS,CAAC,GAAG,MAAM,EAAE,CAI5G;AAED,4GAA4G;AAC5G,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,KAAK,EAAE,CAEjG;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,KAAK,EAAE,GAAG,SAAS,GAAG,KAAK,EAAE,GAAG,SAAS,CAKnJ;AAED,8FAA8F;AAC9F,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,CAExF"}
|
package/dist/boxCard.js
CHANGED
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
* a Folder, a person, a message and the file the conversation is on do not
|
|
10
10
|
* count, a link on words counts by its target, and a plain web link counts
|
|
11
11
|
* for nothing. ✕ takes it off (the box's to keep).
|
|
12
|
+
* - **An edit's card.** The message's own card while the edit still names its
|
|
13
|
+
* file, with its ✕, so it can be seen and taken off there; otherwise the
|
|
14
|
+
* default for a file the edit names first. A card taken off before, with ✕
|
|
15
|
+
* on the sent message, never comes back in an edit (Katerina, 2026-10-30,
|
|
16
|
+
* widget review item 36).
|
|
12
17
|
* - **The live part of each block link**, as the `part` the message will
|
|
13
18
|
* carry, one per file. A part counts as its file and draws instead of a card,
|
|
14
19
|
* so linking an issue and a block of a page shows the block and no card. A
|
|
@@ -20,7 +25,7 @@
|
|
|
20
25
|
*
|
|
21
26
|
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md
|
|
22
27
|
*/
|
|
23
|
-
import { defaultCardOf, toRenderTree, valuesIn, withCard, } from '@estiva-app/protocol';
|
|
28
|
+
import { cardsIn, defaultCardOf, toRenderTree, valuesIn, withCard, } from '@estiva-app/protocol';
|
|
24
29
|
import { composerText } from './composer.js';
|
|
25
30
|
/** At most this many blocks show live under one message (SPEC §13.6.1). */
|
|
26
31
|
export const MAX_PARTS = 6;
|
|
@@ -32,13 +37,14 @@ export const MAX_PARTS = 6;
|
|
|
32
37
|
export function linkTargetOf(url, context) {
|
|
33
38
|
return context.resolveLink(url) ?? context.blockOf(url)?.address;
|
|
34
39
|
}
|
|
35
|
-
/** What a marker text names, and the one
|
|
40
|
+
/** What a marker text names, and the one card it shows under the box. */
|
|
36
41
|
export function boxLinksOf(text, context) {
|
|
37
42
|
// valuesIn asks the resolver about exactly the URLs a reader counts (not one
|
|
38
43
|
// in a code span, nor one in a link's words), so recording its questions
|
|
39
44
|
// gives the URLs without a second URL finder.
|
|
40
45
|
const urls = [];
|
|
41
|
-
const
|
|
46
|
+
const tree = text ? toRenderTree(text, 'marker') : [];
|
|
47
|
+
const values = valuesIn(tree, (url) => {
|
|
42
48
|
if (!urls.includes(url))
|
|
43
49
|
urls.push(url);
|
|
44
50
|
return context.resolveLink(url);
|
|
@@ -50,7 +56,12 @@ export function boxLinksOf(text, context) {
|
|
|
50
56
|
parts.set(part.address, part);
|
|
51
57
|
}
|
|
52
58
|
const kept = [...parts.values()].slice(0, MAX_PARTS);
|
|
53
|
-
const
|
|
59
|
+
const folded = context.folded ?? [];
|
|
60
|
+
// The card a reader draws under the message once the edit is saved: the first its folded set holds for what the edit names.
|
|
61
|
+
const current = cardsIn(folded, tree, kept, context.resolveLink).find((embed) => embed.layout !== 'none')?.value;
|
|
62
|
+
const takenOff = folded.filter((embed) => embed.layout === 'none').map((embed) => embed.value);
|
|
63
|
+
const previous = takenOff.length > 0 ? [...(context.previous ?? []), ...takenOff] : context.previous;
|
|
64
|
+
const card = current ?? defaultCardOf(values, kept, { here: context.here, previous });
|
|
54
65
|
return { values, parts: kept, card, urls };
|
|
55
66
|
}
|
|
56
67
|
/** {@link boxLinksOf} of a composer's document (`CommentBox`'s JSON), read as {@link composerText} writes it. */
|
|
@@ -72,13 +83,20 @@ export function embedsToSend(links, removed) {
|
|
|
72
83
|
}
|
|
73
84
|
/**
|
|
74
85
|
* The `embed` set an edit sends, or undefined to leave the message's as it
|
|
75
|
-
* was.
|
|
76
|
-
*
|
|
77
|
-
* set
|
|
78
|
-
*
|
|
86
|
+
* was. `links` is read with `previous` and `folded`, so its card is the
|
|
87
|
+
* message's own or the default for a file the edit names first. The message's
|
|
88
|
+
* own card, kept, leaves the set as it was; taken off with ✕ in the edit box,
|
|
89
|
+
* it is set `none`. A file named first adds its default; ✕ on that one writes
|
|
90
|
+
* nothing. Either way the whole folded set goes with it, since a set replaces
|
|
91
|
+
* (§13.6.2), and a card removed with ✕, before sending or after, stays removed.
|
|
79
92
|
*/
|
|
80
93
|
export function embedsToEdit(links, removed, folded) {
|
|
81
|
-
|
|
94
|
+
if (!links.card)
|
|
95
|
+
return undefined;
|
|
96
|
+
const own = (folded ?? []).some((embed) => embed.value === links.card && embed.layout !== 'none');
|
|
97
|
+
if (removed.has(links.card))
|
|
98
|
+
return own ? withCard(folded ?? [], links.card, 'none') : undefined;
|
|
99
|
+
return own ? undefined : withCard(folded ?? [], links.card, 'detailed');
|
|
82
100
|
}
|
|
83
101
|
/** ✕ on a sent message's card: the folded set, with that card `none` and every other kept. */
|
|
84
102
|
export function withoutCard(folded, value) {
|
package/dist/boxCard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boxCard.js","sourceRoot":"","sources":["../src/boxCard.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"boxCard.js","sourceRoot":"","sources":["../src/boxCard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,QAAQ,GAMT,MAAM,sBAAsB,CAAA;AAC7B,O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C,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;AACzE,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,WAAW,CAAC,MAAoC,EAAE,KAAa;IAC7E,OAAO,QAAQ,CAAC,MAAM,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;AAC9C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* apps: it imports no app's data layer, opens no socket, and takes every
|
|
13
13
|
* environment touch — the relay read, the clock, storage — as a parameter.
|
|
14
14
|
*/
|
|
15
|
-
export declare const CONVERSATION_VERSION = "0.
|
|
15
|
+
export declare const CONVERSATION_VERSION = "0.24.0";
|
|
16
16
|
export { KIND_MESSAGE, KIND_COMMENT, KIND_EDIT, KIND_REACTION, KIND_DELETION, KIND_ASSERTION, isConversationKind, isEventId, } from './kinds.js';
|
|
17
17
|
export { trustedTs, orderingMs, byOrder } from './order.js';
|
|
18
18
|
export { namedInBody, isReply, anchorsOf, isCommentOn, referencesAddress, strengthOn, threadStrength, referenceTagsFor, mentionTagsFor, peopleNamedInBody, MAX_MENTIONED_PEOPLE, type Strength, } from './strength.js';
|
|
@@ -24,13 +24,13 @@ export { buildComment, buildReply, offersEditAndDelete, placeOf, type CommentRef
|
|
|
24
24
|
export { eventsNamedInBody, mentionText, messageReference, quoteTagsFor, URGENT_TAG, urgentTagsFor } from './compose.js';
|
|
25
25
|
export { composerDocument, composerDraft, composerText, withoutNewUrgency, type ComposerDraft, type ComposerLabels, type ComposerText, } from './composer.js';
|
|
26
26
|
export { MAX_PARTS, boxLinksOf, boxReadOf, embedsToEdit, embedsToSend, linkTargetOf, namedBefore, withoutCard, type BoxLinkContext, type BoxLinks, } from './boxCard.js';
|
|
27
|
-
export { FILE_TIER, fileReference, MESSAGE_TIER, rankReferences, REFERENCE_CAPS, referenceMatch, referenceSearch, refMatch, type RankedReferences, type RankReferencesInput, type ReferenceCandidate, type ReferenceSearch, type ReferenceSearchFn, type ReferenceSearchOptions, type ReferenceType, } from './references.js';
|
|
27
|
+
export { FILE_TIER, fileReference, MESSAGE_TIER, messageCandidate, rankReferences, REFERENCE_CAPS, referenceMatch, referenceSearch, referenceSectionsOf, refMatch, type RankedReferences, type RankedSection, type RankReferencesInput, type ReferableMessage, type ReferenceCandidate, type ReferenceSearch, type ReferenceSearchFn, type ReferenceSearchOptions, type ReferenceType, } from './references.js';
|
|
28
28
|
export { KIND_CHANGE, MEMBER_FIELD_PREFIX, memberField, memberOfField, mentions, streamOf, membershipOf, membersOf, membershipFilters, candidateFilesOf, buildMembershipChange, MUTED_D_TAG, APPDATA_TAG, parseMutedBlob, serializeMutedBlob, buildMutedEvent, mutedFilter, mutedFromFollowed, type Membership, type MutedList, } from './membership.js';
|
|
29
29
|
export { READ_STATE_TAG, READ_STATE_D_PREFIX, MAX_CONTEXTS, MAX_CONTEXT_ID_BYTES, MAX_TIMESTAMP, MAX_CLIENT_ID_BYTES, MAX_BLOB_BYTES, MAX_CONTEXTS_BYTES, READ_STATE_HORIZON_DAYS, channelContext, fileContext, threadContext, messageContext, toContextSeconds, isPublishableContextId, loadSlotIdentity, rotateSlotId, readStateDTag, parseReadStateBlob, serializeReadStateBlob, capContextsToBytes, capReadStateContexts, THREAD_RULE_FROM, REPLY_FLOOR_CONTEXT, advanceContexts, buildReadStateEvent, allSlotsFilter, mergeSlots, classifyOwnSlots, effectiveReadAt, threadReadAt, belowReplyFloor, fetchReadState, createSlotCache, publishReadState, type SlotCache, type SlotIdentity, type SlotStorage, type SlotSource, type RandomBytes, type ReadStateBlob, type CappedContexts, type SlotBlob, type OwnSlotVerdict, type Nip44, type FetchedReadState, } from './readState.js';
|
|
30
30
|
export { unreadIn, isUnread, type StreamJudge } from './unread.js';
|
|
31
31
|
export { peopleNamedInText, newlyNamedPeople, mentionAddsFor, type FileText } from './textMentions.js';
|
|
32
32
|
export { KIND_MEMBERSHIP_LIST, namedProfilesOf, rosterOf, byName, mentionablePeople, type NamedProfile } from './people.js';
|
|
33
|
-
export { openingWords, referenceWord } from './openingWords.js';
|
|
33
|
+
export { messageWords, openingWords, referenceWord, type OpeningWordsOptions } from './openingWords.js';
|
|
34
34
|
export { archivedLine } from './archivedLine.js';
|
|
35
35
|
export { createDraftStore, draftKeys, NO_DRAFTS, DRAFT_MAX_AGE_MS, DRAFT_MAX_CHARS, type Draft, type DraftStore, type DraftStorage, } from './drafts.js';
|
|
36
36
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,WAAW,CAAA;AAE5C,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,aAAa,EACb,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,SAAS,GACV,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3D,OAAO,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,QAAQ,GACd,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEpE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE/G,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,gBAAgB,EA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e,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,gBAAgB,GACtB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAElE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAEtG,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAE3H,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAEvG,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,YAAY,GAClB,MAAM,aAAa,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* apps: it imports no app's data layer, opens no socket, and takes every
|
|
13
13
|
* environment touch — the relay read, the clock, storage — as a parameter.
|
|
14
14
|
*/
|
|
15
|
-
export const CONVERSATION_VERSION = '0.
|
|
15
|
+
export const CONVERSATION_VERSION = '0.24.0';
|
|
16
16
|
export { KIND_MESSAGE, KIND_COMMENT, KIND_EDIT, KIND_REACTION, KIND_DELETION, KIND_ASSERTION, isConversationKind, isEventId, } from './kinds.js';
|
|
17
17
|
export { trustedTs, orderingMs, byOrder } from './order.js';
|
|
18
18
|
export { namedInBody, isReply, anchorsOf, isCommentOn, referencesAddress, strengthOn, threadStrength, referenceTagsFor, mentionTagsFor, peopleNamedInBody, MAX_MENTIONED_PEOPLE, } from './strength.js';
|
|
@@ -24,13 +24,13 @@ export { buildComment, buildReply, offersEditAndDelete, placeOf } from './builde
|
|
|
24
24
|
export { eventsNamedInBody, mentionText, messageReference, quoteTagsFor, URGENT_TAG, urgentTagsFor } from './compose.js';
|
|
25
25
|
export { composerDocument, composerDraft, composerText, withoutNewUrgency, } from './composer.js';
|
|
26
26
|
export { MAX_PARTS, boxLinksOf, boxReadOf, embedsToEdit, embedsToSend, linkTargetOf, namedBefore, withoutCard, } from './boxCard.js';
|
|
27
|
-
export { FILE_TIER, fileReference, MESSAGE_TIER, rankReferences, REFERENCE_CAPS, referenceMatch, referenceSearch, refMatch, } from './references.js';
|
|
27
|
+
export { FILE_TIER, fileReference, MESSAGE_TIER, messageCandidate, rankReferences, REFERENCE_CAPS, referenceMatch, referenceSearch, referenceSectionsOf, refMatch, } from './references.js';
|
|
28
28
|
export { KIND_CHANGE, MEMBER_FIELD_PREFIX, memberField, memberOfField, mentions, streamOf, membershipOf, membersOf, membershipFilters, candidateFilesOf, buildMembershipChange, MUTED_D_TAG, APPDATA_TAG, parseMutedBlob, serializeMutedBlob, buildMutedEvent, mutedFilter, mutedFromFollowed, } from './membership.js';
|
|
29
29
|
export { READ_STATE_TAG, READ_STATE_D_PREFIX, MAX_CONTEXTS, MAX_CONTEXT_ID_BYTES, MAX_TIMESTAMP, MAX_CLIENT_ID_BYTES, MAX_BLOB_BYTES, MAX_CONTEXTS_BYTES, READ_STATE_HORIZON_DAYS, channelContext, fileContext, threadContext, messageContext, toContextSeconds, isPublishableContextId, loadSlotIdentity, rotateSlotId, readStateDTag, parseReadStateBlob, serializeReadStateBlob, capContextsToBytes, capReadStateContexts, THREAD_RULE_FROM, REPLY_FLOOR_CONTEXT, advanceContexts, buildReadStateEvent, allSlotsFilter, mergeSlots, classifyOwnSlots, effectiveReadAt, threadReadAt, belowReplyFloor, fetchReadState, createSlotCache, publishReadState, } from './readState.js';
|
|
30
30
|
export { unreadIn, isUnread } from './unread.js';
|
|
31
31
|
export { peopleNamedInText, newlyNamedPeople, mentionAddsFor } from './textMentions.js';
|
|
32
32
|
export { KIND_MEMBERSHIP_LIST, namedProfilesOf, rosterOf, byName, mentionablePeople } from './people.js';
|
|
33
|
-
export { openingWords, referenceWord } from './openingWords.js';
|
|
33
|
+
export { messageWords, openingWords, referenceWord } from './openingWords.js';
|
|
34
34
|
export { archivedLine } from './archivedLine.js';
|
|
35
35
|
export { createDraftStore, draftKeys, NO_DRAFTS, DRAFT_MAX_AGE_MS, DRAFT_MAX_CHARS, } from './drafts.js';
|
|
36
36
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAA;AAE5C,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,aAAa,EACb,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,SAAS,GACV,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3D,OAAO,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,GAErB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAiB,MAAM,cAAc,CAAA;AAEpE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAiB,MAAM,Y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nB,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,WAAW,EACX,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,eAAe,EACf,gBAAgB,GAYjB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAoB,MAAM,aAAa,CAAA;AAElE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,EAAiB,MAAM,mBAAmB,CAAA;AAEtG,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAqB,MAAM,aAAa,CAAA;AAE3H,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAA4B,MAAM,mBAAmB,CAAA;AAEvG,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,eAAe,GAIhB,MAAM,aAAa,CAAA"}
|
package/dist/openingWords.d.ts
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A message's opening words, as a caption — what `[`'s row for a comment
|
|
3
|
+
* shows under its author, and any preview of a message, the same in every app
|
|
4
|
+
* (PEEKM-6).
|
|
5
|
+
*
|
|
6
|
+
* One line of plain words: marks and line prefixes gone, a link on words as
|
|
7
|
+
* its words, a fenced code block's fences dropped. A `nostr:` reference reads
|
|
8
|
+
* as its chip would without resolving anything (SPEC §13.1: "the URI's own
|
|
9
|
+
* label or its shortened form, never blank"):
|
|
10
|
+
*
|
|
11
|
+
* - a person as `@Name`, or `@` and the key's shortened form when nobody here
|
|
12
|
+
* can name them;
|
|
13
|
+
* - a message as "Message", a file by its type word ("Issue", "Project",
|
|
14
|
+
* "Topic", "Document"), any other address as "File" — never by its title,
|
|
15
|
+
* so the same comment reads the same in an app that has the file loaded and
|
|
16
|
+
* one that does not (Miky, 27 October, PEEKM-6's kickoff).
|
|
17
|
+
*
|
|
18
|
+
* A bare app URL that names a file or a message reads as that reference would
|
|
19
|
+
* (§13.6.2, "A bare app link reads as a reference"), never as the raw URL
|
|
20
|
+
* (Katerina, 30 October, widget review item 20). A URL nothing claims stays
|
|
21
|
+
* as written (§13.1), and so does one in code.
|
|
22
|
+
*
|
|
23
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-conversation-is-one-shared-thing-and-only-its-colours-are-the-apps.md
|
|
24
|
+
*/
|
|
25
|
+
import { type LinkResolver } from '@estiva-app/protocol';
|
|
26
|
+
export interface OpeningWordsOptions {
|
|
27
|
+
/**
|
|
28
|
+
* What an app link names (§7.7), as answered so far — the resolver the app
|
|
29
|
+
* gives its box (`BoxLinkContext.resolveLink`). A bare app URL it answers
|
|
30
|
+
* reads as the reference it names ("Issue", "Message"); one it does not —
|
|
31
|
+
* nothing claims it, or the answer has not come back yet — stays as
|
|
32
|
+
* written. Without it, every URL stays as written.
|
|
33
|
+
*/
|
|
34
|
+
resolveLink?: LinkResolver;
|
|
35
|
+
}
|
|
1
36
|
/** What a `nostr:` reference reads as in a caption, by its kind alone, or a person by name. */
|
|
2
37
|
export declare function referenceWord(uri: string, nameOf: (pubkey: string) => string | undefined): string;
|
|
3
38
|
/** A message body's opening words on one line, as a caption: see the module's note. */
|
|
4
|
-
export declare function openingWords(body: string, nameOf: (pubkey: string) => string | undefined): string;
|
|
39
|
+
export declare function openingWords(body: string, nameOf: (pubkey: string) => string | undefined, options?: OpeningWordsOptions): string;
|
|
40
|
+
/**
|
|
41
|
+
* The words a message is found by in `[` (Katerina, 30 October, widget review
|
|
42
|
+
* item 19): what its writer wrote, read as {@link openingWords} reads it, but
|
|
43
|
+
* with no link's raw text — no bare URL, resolved or not — and no type word
|
|
44
|
+
* for a file or a message it names, so typing a file's word finds the file,
|
|
45
|
+
* not every message that links to it. A link on words keeps its words, a
|
|
46
|
+
* person reads as `@Name`, and code is kept as written.
|
|
47
|
+
*/
|
|
48
|
+
export declare function messageWords(body: string, nameOf: (pubkey: string) => string | undefined): string;
|
|
5
49
|
//# sourceMappingURL=openingWords.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openingWords.d.ts","sourceRoot":"","sources":["../src/openingWords.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"openingWords.d.ts","sourceRoot":"","sources":["../src/openingWords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAgF,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAmBtI,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,YAAY,CAAA;CAC3B;AAOD,+FAA+F;AAC/F,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAAG,MAAM,CAoBjG;AAmFD,uFAAuF;AACvF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM,CAEpI;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAAG,MAAM,CAEjG"}
|
package/dist/openingWords.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A message's opening words, as a caption — what `[`'s row for a comment
|
|
3
|
-
* shows under its author, the same in every app
|
|
3
|
+
* shows under its author, and any preview of a message, the same in every app
|
|
4
|
+
* (PEEKM-6).
|
|
4
5
|
*
|
|
5
6
|
* One line of plain words: marks and line prefixes gone, a link on words as
|
|
6
7
|
* its words, a fenced code block's fences dropped. A `nostr:` reference reads
|
|
@@ -14,9 +15,14 @@
|
|
|
14
15
|
* so the same comment reads the same in an app that has the file loaded and
|
|
15
16
|
* one that does not (Miky, 27 October, PEEKM-6's kickoff).
|
|
16
17
|
*
|
|
18
|
+
* A bare app URL that names a file or a message reads as that reference would
|
|
19
|
+
* (§13.6.2, "A bare app link reads as a reference"), never as the raw URL
|
|
20
|
+
* (Katerina, 30 October, widget review item 20). A URL nothing claims stays
|
|
21
|
+
* as written (§13.1), and so does one in code.
|
|
22
|
+
*
|
|
17
23
|
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-conversation-is-one-shared-thing-and-only-its-colours-are-the-apps.md
|
|
18
24
|
*/
|
|
19
|
-
import { decodeNpub, parseInlineMarks, referenceToPointer } from '@estiva-app/protocol';
|
|
25
|
+
import { decodeNpub, parseInlineMarks, referenceOfLink, referenceToPointer, urlRunsIn } from '@estiva-app/protocol';
|
|
20
26
|
/** A file's type word by its kind, as `[`'s Files rows name it. */
|
|
21
27
|
const TYPE_WORDS = { 30850: 'Project', 30851: 'Issue', 30840: 'Topic', 30842: 'Document', 39000: 'Folder' };
|
|
22
28
|
const FENCE = /^\s*(?:```|~~~)/;
|
|
@@ -29,6 +35,8 @@ const LINE_PREFIX = /^\s*(?:(?:>|#{1,6})\s+)*(?:(?:[-*+]|\d+[.)])\s+(?:\[[ xX]\]
|
|
|
29
35
|
*/
|
|
30
36
|
const LINK_ON_WORDS = /(?<!!)\[([^[\]\n]+)\]\(((?:https?:\/\/|mailto:)[^\s)]+)\)/g;
|
|
31
37
|
const linkWords = (whole, words, url) => (url.split('(').length > url.split(')').length ? whole : words);
|
|
38
|
+
/** A reference to a file or a message: the ones a caption names by a type word, not by anything its writer typed. */
|
|
39
|
+
const OBJECT_REFERENCE = /^nostr:(?:naddr1|nevent1|note1)/i;
|
|
32
40
|
/** The shortened form §13.1 asks for when a reference names nobody here. */
|
|
33
41
|
function shortened(uri) {
|
|
34
42
|
return `${uri.replace(/^nostr:/i, '').slice(0, 12)}…`;
|
|
@@ -58,29 +66,87 @@ export function referenceWord(uri, nameOf) {
|
|
|
58
66
|
return 'Message';
|
|
59
67
|
return `@${shortened(uri)}`;
|
|
60
68
|
}
|
|
69
|
+
/** A character `text` does not hold, from the private use area. */
|
|
70
|
+
function unusedCharacter(text) {
|
|
71
|
+
for (let code = 0xe000; code <= 0xf8ff; code++) {
|
|
72
|
+
const ch = String.fromCharCode(code);
|
|
73
|
+
if (!text.includes(ch))
|
|
74
|
+
return ch;
|
|
75
|
+
}
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
/** A bare URL as the line reads it: the reference's word in a caption, as written in code or when nothing claims it. */
|
|
79
|
+
function urlWord(url, reading) {
|
|
80
|
+
if (reading.code)
|
|
81
|
+
return url;
|
|
82
|
+
if (reading.mode === 'words')
|
|
83
|
+
return '';
|
|
84
|
+
const reference = reading.resolveLink ? referenceOfLink(url, reading.resolveLink) : undefined;
|
|
85
|
+
return reference ? referenceWord(reference, reading.nameOf) : url;
|
|
86
|
+
}
|
|
87
|
+
/** Each bare URL in a run of plain text, as the line reads it; the rest as it is. */
|
|
88
|
+
function withUrlsRead(text, reading) {
|
|
89
|
+
let out = '';
|
|
90
|
+
let at = 0;
|
|
91
|
+
for (const { url, from, to } of urlRunsIn(text)) {
|
|
92
|
+
out += text.slice(at, from) + urlWord(url, reading);
|
|
93
|
+
at = to;
|
|
94
|
+
}
|
|
95
|
+
return out + text.slice(at);
|
|
96
|
+
}
|
|
97
|
+
/** A `nostr:` reference as the line reads it: its word, or nothing in a message's own words when it names a file or a message. */
|
|
98
|
+
function referenceAs(uri, reading) {
|
|
99
|
+
return reading.mode === 'words' && OBJECT_REFERENCE.test(uri) ? '' : referenceWord(uri, reading.nameOf);
|
|
100
|
+
}
|
|
61
101
|
/**
|
|
62
|
-
* One line's words.
|
|
63
|
-
*
|
|
64
|
-
*
|
|
102
|
+
* One line's words. A bare URL is found in the text the marks leave, as a reader finds it (`urlRunsIn`), and read by
|
|
103
|
+
* {@link urlWord}. A URL written in a link's words names nothing (§13.6.2), so its `://` is broken by a character the
|
|
104
|
+
* line does not hold until the line is read. Protocol's mark reader recurses once per mark, so a line of a few thousand
|
|
105
|
+
* (anyone can post one) overflows the stack; that line then reads as its text with the marker characters dropped,
|
|
106
|
+
* rather than taking down every `[` list that captions it (Peek: Feedback & Bugs 4acb43ac is the reader's own fix).
|
|
65
107
|
*/
|
|
66
|
-
function lineWords(line,
|
|
108
|
+
function lineWords(line, reading) {
|
|
109
|
+
const mark = line.includes('://') ? unusedCharacter(line) : undefined;
|
|
110
|
+
const text = line.replace(LINK_ON_WORDS, (whole, words, url) => {
|
|
111
|
+
const read = linkWords(whole, words, url);
|
|
112
|
+
return read !== whole && mark ? read.replaceAll('://', `:${mark}//`) : read;
|
|
113
|
+
});
|
|
114
|
+
const unmark = (words) => (mark ? words.replaceAll(mark, '') : words);
|
|
67
115
|
try {
|
|
68
|
-
return parseInlineMarks(
|
|
69
|
-
.map((span) => (span.reference ?
|
|
116
|
+
return parseInlineMarks(text)
|
|
117
|
+
.map((span) => (span.reference ? referenceAs(span.reference, reading) : unmark(span.code ? span.text : withUrlsRead(span.text, reading))))
|
|
70
118
|
.join('');
|
|
71
119
|
}
|
|
72
120
|
catch {
|
|
73
|
-
return
|
|
121
|
+
return unmark(withUrlsRead(text.replace(/[*_~`]+/g, ''), reading));
|
|
74
122
|
}
|
|
75
123
|
}
|
|
124
|
+
/** A body's lines on one line, read as `reading` says, a code block's fences dropped. */
|
|
125
|
+
function bodyWords(body, reading) {
|
|
126
|
+
let inCode = false;
|
|
127
|
+
const lines = [];
|
|
128
|
+
for (const line of body.split('\n')) {
|
|
129
|
+
if (FENCE.test(line)) {
|
|
130
|
+
inCode = !inCode;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
lines.push(lineWords(line.replace(LINE_PREFIX, ''), { ...reading, code: inCode }));
|
|
134
|
+
}
|
|
135
|
+
return lines.join(' ').replace(/\s+/g, ' ').trim();
|
|
136
|
+
}
|
|
76
137
|
/** A message body's opening words on one line, as a caption: see the module's note. */
|
|
77
|
-
export function openingWords(body, nameOf) {
|
|
78
|
-
return body
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
138
|
+
export function openingWords(body, nameOf, options = {}) {
|
|
139
|
+
return bodyWords(body, { mode: 'caption', nameOf, resolveLink: options.resolveLink });
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The words a message is found by in `[` (Katerina, 30 October, widget review
|
|
143
|
+
* item 19): what its writer wrote, read as {@link openingWords} reads it, but
|
|
144
|
+
* with no link's raw text — no bare URL, resolved or not — and no type word
|
|
145
|
+
* for a file or a message it names, so typing a file's word finds the file,
|
|
146
|
+
* not every message that links to it. A link on words keeps its words, a
|
|
147
|
+
* person reads as `@Name`, and code is kept as written.
|
|
148
|
+
*/
|
|
149
|
+
export function messageWords(body, nameOf) {
|
|
150
|
+
return bodyWords(body, { mode: 'words', nameOf });
|
|
85
151
|
}
|
|
86
152
|
//# sourceMappingURL=openingWords.js.map
|
package/dist/openingWords.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openingWords.js","sourceRoot":"","sources":["../src/openingWords.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"openingWords.js","sourceRoot":"","sources":["../src/openingWords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,U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AAS,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;IACpF,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;AACpD,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,MAA8C,EAAE,UAA+B,EAAE;IAC1H,OAAO,SAAS,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;AACvF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,MAA8C;IACvF,OAAO,SAAS,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;AACnD,CAAC"}
|
package/dist/references.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type OpeningWordsOptions } from './openingWords.js';
|
|
1
2
|
/** What a reference names, as the row's type word says it (label objects by type, not app). */
|
|
2
3
|
export type ReferenceType = 'message' | 'issue' | 'project' | 'topic' | 'document';
|
|
3
4
|
/** Something `[` can offer. */
|
|
@@ -18,7 +19,10 @@ export interface ReferenceCandidate {
|
|
|
18
19
|
* none, and on a message. Not matched: search keeps to titles.
|
|
19
20
|
*/
|
|
20
21
|
summary?: string;
|
|
21
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Matched beside `title`: a message's own words ({@link messageWords}), an
|
|
24
|
+
* issue's ref (`CON-33`). A message without it is matched on `caption`.
|
|
25
|
+
*/
|
|
22
26
|
search?: string;
|
|
23
27
|
/** 0 is closest: {@link MESSAGE_TIER} or {@link FILE_TIER}. */
|
|
24
28
|
tier: number;
|
|
@@ -52,6 +56,37 @@ export interface RankedReferences {
|
|
|
52
56
|
messages: ReferenceCandidate[];
|
|
53
57
|
files: ReferenceCandidate[];
|
|
54
58
|
}
|
|
59
|
+
/** One of `[`'s sections, by name: the app gives it its heading. */
|
|
60
|
+
export interface RankedSection {
|
|
61
|
+
name: 'files' | 'messages';
|
|
62
|
+
items: ReferenceCandidate[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* {@link rankReferences}' sections in the order `[` draws them: Files, then
|
|
66
|
+
* Messages (Katerina, 2026-10-30), in every app. An empty one is kept: the
|
|
67
|
+
* menu draws no heading for it.
|
|
68
|
+
*/
|
|
69
|
+
export declare function referenceSectionsOf(ranked: RankedReferences): RankedSection[];
|
|
70
|
+
/** A message `[` can offer, as the app holds it. */
|
|
71
|
+
export interface ReferableMessage {
|
|
72
|
+
/** Its event id. */
|
|
73
|
+
id: string;
|
|
74
|
+
/** Its kind, carried in the reference so a reader fetches the right thing: 9 for chat, 1111 for a comment. */
|
|
75
|
+
kind: number;
|
|
76
|
+
/** Who wrote it, as the row names them. */
|
|
77
|
+
author: string;
|
|
78
|
+
body: string;
|
|
79
|
+
/** When it was written, in seconds, or any number that is higher for a newer one. */
|
|
80
|
+
at?: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A message as `[`'s row offers it, the same in every app: its reference
|
|
84
|
+
* (`messageReference`), its author as the title, its opening words as the
|
|
85
|
+
* caption ({@link openingWords}, an app link read as what it names when
|
|
86
|
+
* `resolveLink` has answered for it), and its own words to be found by
|
|
87
|
+
* ({@link messageWords}) — not the raw text of a link in it.
|
|
88
|
+
*/
|
|
89
|
+
export declare function messageCandidate(message: ReferableMessage, tier: number, nameOf: (pubkey: string) => string | undefined, options?: OpeningWordsOptions): ReferenceCandidate;
|
|
55
90
|
export interface RankReferencesInput {
|
|
56
91
|
messages: readonly ReferenceCandidate[];
|
|
57
92
|
files: readonly ReferenceCandidate[];
|
package/dist/references.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AA2BA,OAAO,EAA8B,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAExF,+FAA+F;AAC/F,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,CAAA;AAElF,+BAA+B;AAC/B,MAAM,WAAW,kBAAkB;IACjC,gGAAgG;IAChG,EAAE,EAAE,MAAM,CAAA;IACV,iGAAiG;IACjG,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,aAAa,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAA;IACb,oFAAoF;IACpF,OAAO,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAA;IACZ,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gFAAgF;IAChF,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,mEAAmE;AACnE,eAAO,MAAM,YAAY;;;CAAkC,CAAA;AAE3D,+EAA+E;AAC/E,eAAO,MAAM,SAAS;;;;CAA+C,CAAA;AAErE,mGAAmG;AACnG,eAAO,MAAM,cAAc;;;CAAqC,CAAA;AAEhE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,kBAAkB,EAAE,CAAA;IAC9B,KAAK,EAAE,kBAAkB,EAAE,CAAA;CAC5B;AAED,oEAAoE;AACpE,MAAM,WAAW,aAAa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S,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvE;AAcD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,QAAa,EAAE,IAAqB,EAAE,OAAY,EAAE,EAAE,mBAAmB,GAAG,gBAAgB,CAgCpJ;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,8FAA8F;AAC9F,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,kBAAkB,EAAE,CAAC,CAAA;AAKzF,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,kBAAkB,EAAE,CAAA;IAClD,4DAA4D;IAC5D,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAA;IAC3C;;;;OAIG;IACH,KAAK,IAAI,IAAI,CAAA;CACd;AAED,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,MAAM,EAAE,iBAAiB,CAAA;IACzB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,OAAa,EAAE,OAAc,EAAE,SAAa,EAAE,EAAE,sBAAsB,GAAG,eAAe,CAgFjI"}
|
package/dist/references.js
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
* What `[` offers, and in what order — CON-26's ranking (Miky, 2026-10-02),
|
|
3
3
|
* in one place for every app (PEE-21).
|
|
4
4
|
*
|
|
5
|
-
* Two capped sections,
|
|
5
|
+
* Two capped sections, Files above Messages ({@link referenceSectionsOf};
|
|
6
|
+
* Katerina, 2026-10-30, widget review item 19 — Messages led until then, and
|
|
7
|
+
* typing a file's word picked a message):
|
|
6
8
|
*
|
|
7
|
-
* - **Messages:** this thread or file first, then the parent file's.
|
|
8
9
|
* - **Files:** this Folder first, then files you read recently (your §11 read
|
|
9
10
|
* markers), then everything else, which you reach only by typing (relay
|
|
10
11
|
* search).
|
|
12
|
+
* - **Messages:** this thread or file first, then the parent file's. A message
|
|
13
|
+
* is found by its own words ({@link messageWords}), never by a link's raw
|
|
14
|
+
* text: a row built by {@link messageCandidate} carries them.
|
|
11
15
|
*
|
|
12
16
|
* With nothing typed the tiers set the order. Once you type, a better title
|
|
13
17
|
* match beats a higher tier; an open issue goes before a done or cancelled
|
|
@@ -20,12 +24,45 @@
|
|
|
20
24
|
* markers, a relay search — is the app's: each app holds them differently.
|
|
21
25
|
*/
|
|
22
26
|
import { addrToNaddr } from '@estiva-app/protocol';
|
|
27
|
+
import { messageReference } from './compose.js';
|
|
28
|
+
import { messageWords, openingWords } from './openingWords.js';
|
|
23
29
|
/** Where a message sits relative to the box you are writing in. */
|
|
24
30
|
export const MESSAGE_TIER = { here: 0, parent: 1 };
|
|
25
31
|
/** Where a file sits relative to you. `search` only ever comes from typing. */
|
|
26
32
|
export const FILE_TIER = { folder: 0, recent: 1, search: 2 };
|
|
27
33
|
/** How many rows each section shows (Miky, 2026-10-03): the box stays at the old list's height. */
|
|
28
34
|
export const REFERENCE_CAPS = { messages: 4, files: 6 };
|
|
35
|
+
/**
|
|
36
|
+
* {@link rankReferences}' sections in the order `[` draws them: Files, then
|
|
37
|
+
* Messages (Katerina, 2026-10-30), in every app. An empty one is kept: the
|
|
38
|
+
* menu draws no heading for it.
|
|
39
|
+
*/
|
|
40
|
+
export function referenceSectionsOf(ranked) {
|
|
41
|
+
return [
|
|
42
|
+
{ name: 'files', items: ranked.files },
|
|
43
|
+
{ name: 'messages', items: ranked.messages },
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A message as `[`'s row offers it, the same in every app: its reference
|
|
48
|
+
* (`messageReference`), its author as the title, its opening words as the
|
|
49
|
+
* caption ({@link openingWords}, an app link read as what it names when
|
|
50
|
+
* `resolveLink` has answered for it), and its own words to be found by
|
|
51
|
+
* ({@link messageWords}) — not the raw text of a link in it.
|
|
52
|
+
*/
|
|
53
|
+
export function messageCandidate(message, tier, nameOf, options = {}) {
|
|
54
|
+
return {
|
|
55
|
+
id: message.id,
|
|
56
|
+
uri: messageReference(message.id, message.kind),
|
|
57
|
+
type: 'message',
|
|
58
|
+
kind: message.kind,
|
|
59
|
+
title: message.author,
|
|
60
|
+
caption: openingWords(message.body, nameOf, options),
|
|
61
|
+
search: messageWords(message.body, nameOf),
|
|
62
|
+
tier,
|
|
63
|
+
...(message.at === undefined ? {} : { at: message.at }),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
29
66
|
const normalize = (text) => text.toLowerCase().replace(/\s+/g, ' ').trim();
|
|
30
67
|
const isWordStart = (text, at) => at === 0 || !/[\p{L}\p{N}]/u.test(text[at - 1]);
|
|
31
68
|
/** The words of `text`: its runs of letters and digits, so `SUM-7.` is `sum`, `7`. */
|
package/dist/references.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.js","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAsClD,mEAAmE;AACnE,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAW,CAAA;AAE3D,+EAA+E;AAC/E,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAW,CAAA;AAErE,mGAAmG;AACnG,MAAM,CAAC,MAAM,cAA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7B,CAAC;YACD,OAAO,EAAE,CAAA;QACX,CAAC;QACD,SAAS,CAAC,QAAQ;YAChB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YACvB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QACzC,CAAC;QACD,KAAK;YACH,MAAM,EAAE,CAAA;YACR,MAAM,CAAC,KAAK,EAAE,CAAA;YACd,QAAQ,CAAC,KAAK,EAAE,CAAA;QAClB,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@estiva-app/conversation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "The conversation rules of the Estiva SPEC (§6.2–§6.8, §11): comment and mention strengths, threading, the edit, reaction and attachment folds, NIP-22 comment and reply builders, drafts, NIP-RS read state, membership and unread. A convenience an app adopts, never a requirement.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/boxCard.ts
CHANGED
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
* a Folder, a person, a message and the file the conversation is on do not
|
|
10
10
|
* count, a link on words counts by its target, and a plain web link counts
|
|
11
11
|
* for nothing. ✕ takes it off (the box's to keep).
|
|
12
|
+
* - **An edit's card.** The message's own card while the edit still names its
|
|
13
|
+
* file, with its ✕, so it can be seen and taken off there; otherwise the
|
|
14
|
+
* default for a file the edit names first. A card taken off before, with ✕
|
|
15
|
+
* on the sent message, never comes back in an edit (Katerina, 2026-10-30,
|
|
16
|
+
* widget review item 36).
|
|
12
17
|
* - **The live part of each block link**, as the `part` the message will
|
|
13
18
|
* carry, one per file. A part counts as its file and draws instead of a card,
|
|
14
19
|
* so linking an issue and a block of a page shows the block and no card. A
|
|
@@ -21,6 +26,7 @@
|
|
|
21
26
|
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md
|
|
22
27
|
*/
|
|
23
28
|
import {
|
|
29
|
+
cardsIn,
|
|
24
30
|
defaultCardOf,
|
|
25
31
|
toRenderTree,
|
|
26
32
|
valuesIn,
|
|
@@ -41,7 +47,12 @@ export interface BoxLinks {
|
|
|
41
47
|
values: string[]
|
|
42
48
|
/** The block links' parts, one per file, the first link's; none of the conversation's own file. */
|
|
43
49
|
parts: PartPointer[]
|
|
44
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* The card under the box, before any ✕: for a new message, the file that
|
|
52
|
+
* gets the default card; for an edit (`folded` given), the message's own
|
|
53
|
+
* card while the edit still names it, else the default for a file the edit
|
|
54
|
+
* names first.
|
|
55
|
+
*/
|
|
45
56
|
card?: string
|
|
46
57
|
/**
|
|
47
58
|
* Every URL the text names, bare or as a link's target, once each: what the
|
|
@@ -59,6 +70,13 @@ export interface BoxLinkContext {
|
|
|
59
70
|
here?: string
|
|
60
71
|
/** An edit's: the values the message named before it, which get no default again. */
|
|
61
72
|
previous?: readonly string[]
|
|
73
|
+
/**
|
|
74
|
+
* An edit's: the message's folded `embed` set (`foldEmbeds`). Its card shows
|
|
75
|
+
* under the box while the edit names its file, and a value it holds as
|
|
76
|
+
* `none` — a card taken off with ✕ after sending — gets no default again,
|
|
77
|
+
* even named afresh.
|
|
78
|
+
*/
|
|
79
|
+
folded?: readonly Embed[]
|
|
62
80
|
}
|
|
63
81
|
|
|
64
82
|
/**
|
|
@@ -70,13 +88,14 @@ export function linkTargetOf(url: string, context: Pick<BoxLinkContext, 'resolve
|
|
|
70
88
|
return context.resolveLink(url) ?? context.blockOf(url)?.address
|
|
71
89
|
}
|
|
72
90
|
|
|
73
|
-
/** What a marker text names, and the one
|
|
91
|
+
/** What a marker text names, and the one card it shows under the box. */
|
|
74
92
|
export function boxLinksOf(text: string, context: BoxLinkContext): BoxLinks {
|
|
75
93
|
// valuesIn asks the resolver about exactly the URLs a reader counts (not one
|
|
76
94
|
// in a code span, nor one in a link's words), so recording its questions
|
|
77
95
|
// gives the URLs without a second URL finder.
|
|
78
96
|
const urls: string[] = []
|
|
79
|
-
const
|
|
97
|
+
const tree = text ? toRenderTree(text, 'marker') : []
|
|
98
|
+
const values = valuesIn(tree, (url) => {
|
|
80
99
|
if (!urls.includes(url)) urls.push(url)
|
|
81
100
|
return context.resolveLink(url)
|
|
82
101
|
})
|
|
@@ -86,7 +105,12 @@ export function boxLinksOf(text: string, context: BoxLinkContext): BoxLinks {
|
|
|
86
105
|
if (part && part.address !== context.here && !parts.has(part.address)) parts.set(part.address, part)
|
|
87
106
|
}
|
|
88
107
|
const kept = [...parts.values()].slice(0, MAX_PARTS)
|
|
89
|
-
const
|
|
108
|
+
const folded = context.folded ?? []
|
|
109
|
+
// The card a reader draws under the message once the edit is saved: the first its folded set holds for what the edit names.
|
|
110
|
+
const current = cardsIn(folded, tree, kept, context.resolveLink).find((embed) => embed.layout !== 'none')?.value
|
|
111
|
+
const takenOff = folded.filter((embed) => embed.layout === 'none').map((embed) => embed.value)
|
|
112
|
+
const previous = takenOff.length > 0 ? [...(context.previous ?? []), ...takenOff] : context.previous
|
|
113
|
+
const card = current ?? defaultCardOf(values, kept, { here: context.here, previous })
|
|
90
114
|
return { values, parts: kept, card, urls }
|
|
91
115
|
}
|
|
92
116
|
|
|
@@ -112,13 +136,18 @@ export function embedsToSend(links: Pick<BoxLinks, 'card'>, removed: ReadonlySet
|
|
|
112
136
|
|
|
113
137
|
/**
|
|
114
138
|
* The `embed` set an edit sends, or undefined to leave the message's as it
|
|
115
|
-
* was.
|
|
116
|
-
*
|
|
117
|
-
* set
|
|
118
|
-
*
|
|
139
|
+
* was. `links` is read with `previous` and `folded`, so its card is the
|
|
140
|
+
* message's own or the default for a file the edit names first. The message's
|
|
141
|
+
* own card, kept, leaves the set as it was; taken off with ✕ in the edit box,
|
|
142
|
+
* it is set `none`. A file named first adds its default; ✕ on that one writes
|
|
143
|
+
* nothing. Either way the whole folded set goes with it, since a set replaces
|
|
144
|
+
* (§13.6.2), and a card removed with ✕, before sending or after, stays removed.
|
|
119
145
|
*/
|
|
120
146
|
export function embedsToEdit(links: Pick<BoxLinks, 'card'>, removed: ReadonlySet<string>, folded: readonly Embed[] | undefined): Embed[] | undefined {
|
|
121
|
-
|
|
147
|
+
if (!links.card) return undefined
|
|
148
|
+
const own = (folded ?? []).some((embed) => embed.value === links.card && embed.layout !== 'none')
|
|
149
|
+
if (removed.has(links.card)) return own ? withCard(folded ?? [], links.card, 'none') : undefined
|
|
150
|
+
return own ? undefined : withCard(folded ?? [], links.card, 'detailed')
|
|
122
151
|
}
|
|
123
152
|
|
|
124
153
|
/** ✕ on a sent message's card: the folded set, with that card `none` and every other kept. */
|
package/src/index.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* apps: it imports no app's data layer, opens no socket, and takes every
|
|
13
13
|
* environment touch — the relay read, the clock, storage — as a parameter.
|
|
14
14
|
*/
|
|
15
|
-
export const CONVERSATION_VERSION = '0.
|
|
15
|
+
export const CONVERSATION_VERSION = '0.24.0'
|
|
16
16
|
|
|
17
17
|
export {
|
|
18
18
|
KIND_MESSAGE,
|
|
@@ -93,13 +93,17 @@ export {
|
|
|
93
93
|
FILE_TIER,
|
|
94
94
|
fileReference,
|
|
95
95
|
MESSAGE_TIER,
|
|
96
|
+
messageCandidate,
|
|
96
97
|
rankReferences,
|
|
97
98
|
REFERENCE_CAPS,
|
|
98
99
|
referenceMatch,
|
|
99
100
|
referenceSearch,
|
|
101
|
+
referenceSectionsOf,
|
|
100
102
|
refMatch,
|
|
101
103
|
type RankedReferences,
|
|
104
|
+
type RankedSection,
|
|
102
105
|
type RankReferencesInput,
|
|
106
|
+
type ReferableMessage,
|
|
103
107
|
type ReferenceCandidate,
|
|
104
108
|
type ReferenceSearch,
|
|
105
109
|
type ReferenceSearchFn,
|
|
@@ -185,7 +189,7 @@ export { peopleNamedInText, newlyNamedPeople, mentionAddsFor, type FileText } fr
|
|
|
185
189
|
|
|
186
190
|
export { KIND_MEMBERSHIP_LIST, namedProfilesOf, rosterOf, byName, mentionablePeople, type NamedProfile } from './people.js'
|
|
187
191
|
|
|
188
|
-
export { openingWords, referenceWord } from './openingWords.js'
|
|
192
|
+
export { messageWords, openingWords, referenceWord, type OpeningWordsOptions } from './openingWords.js'
|
|
189
193
|
|
|
190
194
|
export { archivedLine } from './archivedLine.js'
|
|
191
195
|
|
package/src/openingWords.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A message's opening words, as a caption — what `[`'s row for a comment
|
|
3
|
-
* shows under its author, the same in every app
|
|
3
|
+
* shows under its author, and any preview of a message, the same in every app
|
|
4
|
+
* (PEEKM-6).
|
|
4
5
|
*
|
|
5
6
|
* One line of plain words: marks and line prefixes gone, a link on words as
|
|
6
7
|
* its words, a fenced code block's fences dropped. A `nostr:` reference reads
|
|
@@ -14,9 +15,14 @@
|
|
|
14
15
|
* so the same comment reads the same in an app that has the file loaded and
|
|
15
16
|
* one that does not (Miky, 27 October, PEEKM-6's kickoff).
|
|
16
17
|
*
|
|
18
|
+
* A bare app URL that names a file or a message reads as that reference would
|
|
19
|
+
* (§13.6.2, "A bare app link reads as a reference"), never as the raw URL
|
|
20
|
+
* (Katerina, 30 October, widget review item 20). A URL nothing claims stays
|
|
21
|
+
* as written (§13.1), and so does one in code.
|
|
22
|
+
*
|
|
17
23
|
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-conversation-is-one-shared-thing-and-only-its-colours-are-the-apps.md
|
|
18
24
|
*/
|
|
19
|
-
import { decodeNpub, parseInlineMarks, referenceToPointer } from '@estiva-app/protocol'
|
|
25
|
+
import { decodeNpub, parseInlineMarks, referenceOfLink, referenceToPointer, urlRunsIn, type LinkResolver } from '@estiva-app/protocol'
|
|
20
26
|
|
|
21
27
|
/** A file's type word by its kind, as `[`'s Files rows name it. */
|
|
22
28
|
const TYPE_WORDS: Record<number, string> = { 30850: 'Project', 30851: 'Issue', 30840: 'Topic', 30842: 'Document', 39000: 'Folder' }
|
|
@@ -32,6 +38,20 @@ const LINE_PREFIX = /^\s*(?:(?:>|#{1,6})\s+)*(?:(?:[-*+]|\d+[.)])\s+(?:\[[ xX]\]
|
|
|
32
38
|
const LINK_ON_WORDS = /(?<!!)\[([^[\]\n]+)\]\(((?:https?:\/\/|mailto:)[^\s)]+)\)/g
|
|
33
39
|
const linkWords = (whole: string, words: string, url: string) => (url.split('(').length > url.split(')').length ? whole : words)
|
|
34
40
|
|
|
41
|
+
/** A reference to a file or a message: the ones a caption names by a type word, not by anything its writer typed. */
|
|
42
|
+
const OBJECT_REFERENCE = /^nostr:(?:naddr1|nevent1|note1)/i
|
|
43
|
+
|
|
44
|
+
export interface OpeningWordsOptions {
|
|
45
|
+
/**
|
|
46
|
+
* What an app link names (§7.7), as answered so far — the resolver the app
|
|
47
|
+
* gives its box (`BoxLinkContext.resolveLink`). A bare app URL it answers
|
|
48
|
+
* reads as the reference it names ("Issue", "Message"); one it does not —
|
|
49
|
+
* nothing claims it, or the answer has not come back yet — stays as
|
|
50
|
+
* written. Without it, every URL stays as written.
|
|
51
|
+
*/
|
|
52
|
+
resolveLink?: LinkResolver
|
|
53
|
+
}
|
|
54
|
+
|
|
35
55
|
/** The shortened form §13.1 asks for when a reference names nobody here. */
|
|
36
56
|
function shortened(uri: string): string {
|
|
37
57
|
return `${uri.replace(/^nostr:/i, '').slice(0, 12)}…`
|
|
@@ -61,27 +81,99 @@ export function referenceWord(uri: string, nameOf: (pubkey: string) => string |
|
|
|
61
81
|
}
|
|
62
82
|
|
|
63
83
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
|
|
84
|
+
* How a line is read: `caption`, as a preview shows it ({@link openingWords}); `words`, only what its writer
|
|
85
|
+
* wrote ({@link messageWords}). `code` is a line of a fenced code block, where a URL is literal (§13.1).
|
|
86
|
+
*/
|
|
87
|
+
interface Reading {
|
|
88
|
+
mode: 'caption' | 'words'
|
|
89
|
+
nameOf: (pubkey: string) => string | undefined
|
|
90
|
+
resolveLink?: LinkResolver
|
|
91
|
+
code?: boolean
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** A character `text` does not hold, from the private use area. */
|
|
95
|
+
function unusedCharacter(text: string): string | undefined {
|
|
96
|
+
for (let code = 0xe000; code <= 0xf8ff; code++) {
|
|
97
|
+
const ch = String.fromCharCode(code)
|
|
98
|
+
if (!text.includes(ch)) return ch
|
|
99
|
+
}
|
|
100
|
+
return undefined
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** A bare URL as the line reads it: the reference's word in a caption, as written in code or when nothing claims it. */
|
|
104
|
+
function urlWord(url: string, reading: Reading): string {
|
|
105
|
+
if (reading.code) return url
|
|
106
|
+
if (reading.mode === 'words') return ''
|
|
107
|
+
const reference = reading.resolveLink ? referenceOfLink(url, reading.resolveLink) : undefined
|
|
108
|
+
return reference ? referenceWord(reference, reading.nameOf) : url
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Each bare URL in a run of plain text, as the line reads it; the rest as it is. */
|
|
112
|
+
function withUrlsRead(text: string, reading: Reading): string {
|
|
113
|
+
let out = ''
|
|
114
|
+
let at = 0
|
|
115
|
+
for (const { url, from, to } of urlRunsIn(text)) {
|
|
116
|
+
out += text.slice(at, from) + urlWord(url, reading)
|
|
117
|
+
at = to
|
|
118
|
+
}
|
|
119
|
+
return out + text.slice(at)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** A `nostr:` reference as the line reads it: its word, or nothing in a message's own words when it names a file or a message. */
|
|
123
|
+
function referenceAs(uri: string, reading: Reading): string {
|
|
124
|
+
return reading.mode === 'words' && OBJECT_REFERENCE.test(uri) ? '' : referenceWord(uri, reading.nameOf)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* One line's words. A bare URL is found in the text the marks leave, as a reader finds it (`urlRunsIn`), and read by
|
|
129
|
+
* {@link urlWord}. A URL written in a link's words names nothing (§13.6.2), so its `://` is broken by a character the
|
|
130
|
+
* line does not hold until the line is read. Protocol's mark reader recurses once per mark, so a line of a few thousand
|
|
131
|
+
* (anyone can post one) overflows the stack; that line then reads as its text with the marker characters dropped,
|
|
132
|
+
* rather than taking down every `[` list that captions it (Peek: Feedback & Bugs 4acb43ac is the reader's own fix).
|
|
67
133
|
*/
|
|
68
|
-
function lineWords(line: string,
|
|
134
|
+
function lineWords(line: string, reading: Reading): string {
|
|
135
|
+
const mark = line.includes('://') ? unusedCharacter(line) : undefined
|
|
136
|
+
const text = line.replace(LINK_ON_WORDS, (whole: string, words: string, url: string) => {
|
|
137
|
+
const read = linkWords(whole, words, url)
|
|
138
|
+
return read !== whole && mark ? read.replaceAll('://', `:${mark}//`) : read
|
|
139
|
+
})
|
|
140
|
+
const unmark = (words: string) => (mark ? words.replaceAll(mark, '') : words)
|
|
69
141
|
try {
|
|
70
|
-
return parseInlineMarks(
|
|
71
|
-
.map((span) => (span.reference ?
|
|
142
|
+
return parseInlineMarks(text)
|
|
143
|
+
.map((span) => (span.reference ? referenceAs(span.reference, reading) : unmark(span.code ? span.text : withUrlsRead(span.text, reading))))
|
|
72
144
|
.join('')
|
|
73
145
|
} catch {
|
|
74
|
-
return
|
|
146
|
+
return unmark(withUrlsRead(text.replace(/[*_~`]+/g, ''), reading))
|
|
75
147
|
}
|
|
76
148
|
}
|
|
77
149
|
|
|
150
|
+
/** A body's lines on one line, read as `reading` says, a code block's fences dropped. */
|
|
151
|
+
function bodyWords(body: string, reading: Omit<Reading, 'code'>): string {
|
|
152
|
+
let inCode = false
|
|
153
|
+
const lines: string[] = []
|
|
154
|
+
for (const line of body.split('\n')) {
|
|
155
|
+
if (FENCE.test(line)) {
|
|
156
|
+
inCode = !inCode
|
|
157
|
+
continue
|
|
158
|
+
}
|
|
159
|
+
lines.push(lineWords(line.replace(LINE_PREFIX, ''), { ...reading, code: inCode }))
|
|
160
|
+
}
|
|
161
|
+
return lines.join(' ').replace(/\s+/g, ' ').trim()
|
|
162
|
+
}
|
|
163
|
+
|
|
78
164
|
/** A message body's opening words on one line, as a caption: see the module's note. */
|
|
79
|
-
export function openingWords(body: string, nameOf: (pubkey: string) => string | undefined): string {
|
|
80
|
-
return body
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
165
|
+
export function openingWords(body: string, nameOf: (pubkey: string) => string | undefined, options: OpeningWordsOptions = {}): string {
|
|
166
|
+
return bodyWords(body, { mode: 'caption', nameOf, resolveLink: options.resolveLink })
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The words a message is found by in `[` (Katerina, 30 October, widget review
|
|
171
|
+
* item 19): what its writer wrote, read as {@link openingWords} reads it, but
|
|
172
|
+
* with no link's raw text — no bare URL, resolved or not — and no type word
|
|
173
|
+
* for a file or a message it names, so typing a file's word finds the file,
|
|
174
|
+
* not every message that links to it. A link on words keeps its words, a
|
|
175
|
+
* person reads as `@Name`, and code is kept as written.
|
|
176
|
+
*/
|
|
177
|
+
export function messageWords(body: string, nameOf: (pubkey: string) => string | undefined): string {
|
|
178
|
+
return bodyWords(body, { mode: 'words', nameOf })
|
|
87
179
|
}
|
package/src/references.ts
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
* What `[` offers, and in what order — CON-26's ranking (Miky, 2026-10-02),
|
|
3
3
|
* in one place for every app (PEE-21).
|
|
4
4
|
*
|
|
5
|
-
* Two capped sections,
|
|
5
|
+
* Two capped sections, Files above Messages ({@link referenceSectionsOf};
|
|
6
|
+
* Katerina, 2026-10-30, widget review item 19 — Messages led until then, and
|
|
7
|
+
* typing a file's word picked a message):
|
|
6
8
|
*
|
|
7
|
-
* - **Messages:** this thread or file first, then the parent file's.
|
|
8
9
|
* - **Files:** this Folder first, then files you read recently (your §11 read
|
|
9
10
|
* markers), then everything else, which you reach only by typing (relay
|
|
10
11
|
* search).
|
|
12
|
+
* - **Messages:** this thread or file first, then the parent file's. A message
|
|
13
|
+
* is found by its own words ({@link messageWords}), never by a link's raw
|
|
14
|
+
* text: a row built by {@link messageCandidate} carries them.
|
|
11
15
|
*
|
|
12
16
|
* With nothing typed the tiers set the order. Once you type, a better title
|
|
13
17
|
* match beats a higher tier; an open issue goes before a done or cancelled
|
|
@@ -20,6 +24,8 @@
|
|
|
20
24
|
* markers, a relay search — is the app's: each app holds them differently.
|
|
21
25
|
*/
|
|
22
26
|
import { addrToNaddr } from '@estiva-app/protocol'
|
|
27
|
+
import { messageReference } from './compose.js'
|
|
28
|
+
import { messageWords, openingWords, type OpeningWordsOptions } from './openingWords.js'
|
|
23
29
|
|
|
24
30
|
/** What a reference names, as the row's type word says it (label objects by type, not app). */
|
|
25
31
|
export type ReferenceType = 'message' | 'issue' | 'project' | 'topic' | 'document'
|
|
@@ -42,7 +48,10 @@ export interface ReferenceCandidate {
|
|
|
42
48
|
* none, and on a message. Not matched: search keeps to titles.
|
|
43
49
|
*/
|
|
44
50
|
summary?: string
|
|
45
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Matched beside `title`: a message's own words ({@link messageWords}), an
|
|
53
|
+
* issue's ref (`CON-33`). A message without it is matched on `caption`.
|
|
54
|
+
*/
|
|
46
55
|
search?: string
|
|
47
56
|
/** 0 is closest: {@link MESSAGE_TIER} or {@link FILE_TIER}. */
|
|
48
57
|
tier: number
|
|
@@ -71,6 +80,63 @@ export interface RankedReferences {
|
|
|
71
80
|
files: ReferenceCandidate[]
|
|
72
81
|
}
|
|
73
82
|
|
|
83
|
+
/** One of `[`'s sections, by name: the app gives it its heading. */
|
|
84
|
+
export interface RankedSection {
|
|
85
|
+
name: 'files' | 'messages'
|
|
86
|
+
items: ReferenceCandidate[]
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* {@link rankReferences}' sections in the order `[` draws them: Files, then
|
|
91
|
+
* Messages (Katerina, 2026-10-30), in every app. An empty one is kept: the
|
|
92
|
+
* menu draws no heading for it.
|
|
93
|
+
*/
|
|
94
|
+
export function referenceSectionsOf(ranked: RankedReferences): RankedSection[] {
|
|
95
|
+
return [
|
|
96
|
+
{ name: 'files', items: ranked.files },
|
|
97
|
+
{ name: 'messages', items: ranked.messages },
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** A message `[` can offer, as the app holds it. */
|
|
102
|
+
export interface ReferableMessage {
|
|
103
|
+
/** Its event id. */
|
|
104
|
+
id: string
|
|
105
|
+
/** Its kind, carried in the reference so a reader fetches the right thing: 9 for chat, 1111 for a comment. */
|
|
106
|
+
kind: number
|
|
107
|
+
/** Who wrote it, as the row names them. */
|
|
108
|
+
author: string
|
|
109
|
+
body: string
|
|
110
|
+
/** When it was written, in seconds, or any number that is higher for a newer one. */
|
|
111
|
+
at?: number
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* A message as `[`'s row offers it, the same in every app: its reference
|
|
116
|
+
* (`messageReference`), its author as the title, its opening words as the
|
|
117
|
+
* caption ({@link openingWords}, an app link read as what it names when
|
|
118
|
+
* `resolveLink` has answered for it), and its own words to be found by
|
|
119
|
+
* ({@link messageWords}) — not the raw text of a link in it.
|
|
120
|
+
*/
|
|
121
|
+
export function messageCandidate(
|
|
122
|
+
message: ReferableMessage,
|
|
123
|
+
tier: number,
|
|
124
|
+
nameOf: (pubkey: string) => string | undefined,
|
|
125
|
+
options: OpeningWordsOptions = {},
|
|
126
|
+
): ReferenceCandidate {
|
|
127
|
+
return {
|
|
128
|
+
id: message.id,
|
|
129
|
+
uri: messageReference(message.id, message.kind),
|
|
130
|
+
type: 'message',
|
|
131
|
+
kind: message.kind,
|
|
132
|
+
title: message.author,
|
|
133
|
+
caption: openingWords(message.body, nameOf, options),
|
|
134
|
+
search: messageWords(message.body, nameOf),
|
|
135
|
+
tier,
|
|
136
|
+
...(message.at === undefined ? {} : { at: message.at }),
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
74
140
|
export interface RankReferencesInput {
|
|
75
141
|
messages: readonly ReferenceCandidate[]
|
|
76
142
|
files: readonly ReferenceCandidate[]
|