@estiva-app/conversation 0.35.0 → 0.36.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 +18 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lines.d.ts +27 -13
- package/dist/lines.d.ts.map +1 -1
- package/dist/lines.js +54 -1
- package/dist/lines.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -2
- package/src/lines.ts +61 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,24 @@ 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.36.0 — 2026-11-09
|
|
10
|
+
|
|
11
|
+
**SPEC §13.6.2: a line that is only a link to the file a comment is on draws
|
|
12
|
+
nothing** (ONE-11; Miky, 2026-11-09).
|
|
13
|
+
|
|
14
|
+
- `placeLines` takes `ownFile`, the values naming the file the comment is on
|
|
15
|
+
(its NIP-22 `A` address, its `O` id). A line that is only a link to it, a
|
|
16
|
+
`nostr:` reference or an app URL, draws nothing, as a file whose card is
|
|
17
|
+
under the message already does. A message left with no words draws them as
|
|
18
|
+
before. Ship ended every issue comment with such a line (`\n\nnostr:naddr…`)
|
|
19
|
+
and hid it on its own page, while Peek and Leaf drew it as a row; every
|
|
20
|
+
comment already on the relay now reads the same in each app. A link to the
|
|
21
|
+
file inside a sentence keeps its place.
|
|
22
|
+
- `ownFileOf(event)`: a comment's `A` and `O` values, none for a `kind:9`.
|
|
23
|
+
- `withoutOwnFileLines(body, ownFile)`: the words an edit box opens with, less
|
|
24
|
+
each line that is only a `nostr:` reference to the comment's own file, so an
|
|
25
|
+
edit made in any app drops Ship's old line, as an edit made in Ship did.
|
|
26
|
+
|
|
9
27
|
## 0.35.0 — 2026-11-06
|
|
10
28
|
|
|
11
29
|
**SPEC §6.5 and C51: a comment the read did not return is in its replies'
|
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.36.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, anchorIdsOf, isAbout, isCrossedComment, isCrossedCommentOn, isCommentOn, referencesAddress, strengthOn, threadStrength, referenceTagsFor, mentionTagsFor, peopleNamedInBody, MAX_MENTIONED_PEOPLE, type Strength, } from './strength.js';
|
|
@@ -22,7 +22,7 @@ export { REACTION_HORIZON, REACTION_EMOJI, reactionTargetOf, reactionEmojiOf, re
|
|
|
22
22
|
export { decorationsOf, type Decoration, type Decorations, type QueryFn } from './decorations.js';
|
|
23
23
|
export { resolutionOf, resolutionOfEvent, resolutionTargetOf, resolutionsByTarget, byResolutionOrder, type Resolution, } from './resolution.js';
|
|
24
24
|
export { foldThreads, type Message, type Thread, type RootState } from './shape.js';
|
|
25
|
-
export { placeLines, writtenUrlOf, urlNames, ROW_BLOCK, type RowLine, type PlacedLines, type LineContext } from './lines.js';
|
|
25
|
+
export { placeLines, ownFileOf, withoutOwnFileLines, writtenUrlOf, urlNames, ROW_BLOCK, type RowLine, type PlacedLines, type LineContext } from './lines.js';
|
|
26
26
|
export { buildComment, buildReply, offersEditAndDelete, placeOf, type CommentRef } from './builders.js';
|
|
27
27
|
export { eventsNamedInBody, mentionText, messageReference, quoteTagsFor, URGENT_TAG, urgentTagsFor } from './compose.js';
|
|
28
28
|
export { composerDocument, composerDraft, composerText, withoutNewUrgency, type ComposerDraft, type ComposerLabels, type ComposerText, } from './composer.js';
|
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,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,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,EAChB,aAAa,EACb,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,QAAQ,GACd,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAEjG,OAAO,EACL,YAAY,EACZ,iBAAiB,EACj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ACjB,KAAK,WAAW,GACjB,MAAM,eAAe,CAAA;AAEtB,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.36.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, anchorIdsOf, isAbout, isCrossedComment, isCrossedCommentOn, isCommentOn, referencesAddress, strengthOn, threadStrength, referenceTagsFor, mentionTagsFor, peopleNamedInBody, MAX_MENTIONED_PEOPLE, } from './strength.js';
|
|
@@ -22,7 +22,7 @@ export { REACTION_HORIZON, REACTION_EMOJI, reactionTargetOf, reactionEmojiOf, re
|
|
|
22
22
|
export { decorationsOf } from './decorations.js';
|
|
23
23
|
export { resolutionOf, resolutionOfEvent, resolutionTargetOf, resolutionsByTarget, byResolutionOrder, } from './resolution.js';
|
|
24
24
|
export { foldThreads } from './shape.js';
|
|
25
|
-
export { placeLines, writtenUrlOf, urlNames, ROW_BLOCK } from './lines.js';
|
|
25
|
+
export { placeLines, ownFileOf, withoutOwnFileLines, writtenUrlOf, urlNames, ROW_BLOCK } from './lines.js';
|
|
26
26
|
export { buildComment, buildReply, offersEditAndDelete, placeOf } from './builders.js';
|
|
27
27
|
export { eventsNamedInBody, mentionText, messageReference, quoteTagsFor, URGENT_TAG, urgentTagsFor } from './compose.js';
|
|
28
28
|
export { composerDocument, composerDraft, composerText, withoutNewUrgency, } from './composer.js';
|
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,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,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,YAAY,CAAA;AAE/G,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,cAAc,GAIf,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAmD,MAAM,kBAAkB,CAAA;AAEjG,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,GAElB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,WAAW,EAA6C,MAAM,YAAY,CAAA;AAEnF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAA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ule (SPEC §13.2, §13.6.2, C21),
|
|
3
|
-
* shared since ONE-2. It replaces Peek's and Ship's `messageLines.ts`, Leaf's
|
|
4
|
-
* `commentLines.ts` and Peek's `urlNames`, three copies that had drifted.
|
|
5
|
-
*
|
|
6
|
-
* A sentence keeps its chips; a line that is only a link to a file or a
|
|
7
|
-
* message is that file's row; and one whose file has a card or a part under
|
|
8
|
-
* the message draws nothing, since the card stands for it (C26). A person or a
|
|
9
|
-
* Folder alone on its line stays a chip, and a quote's or a heading's line is a
|
|
10
|
-
* sentence (protocol `lineDrawOf`).
|
|
11
|
-
*
|
|
12
|
-
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md
|
|
13
|
-
*/
|
|
14
1
|
import { type Embed, type LinkResolver, type PartPointer, type RenderBlock, type RenderInline } from '@estiva-app/protocol';
|
|
15
2
|
/**
|
|
16
3
|
* A line of a message that is only a link to a file or a message, drawn as
|
|
@@ -52,7 +39,34 @@ export interface LineContext {
|
|
|
52
39
|
* is shown on draws no row of itself there (Miky, WID-3).
|
|
53
40
|
*/
|
|
54
41
|
stayChip?: (value: string) => boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The file a comment is on, by each value it names it with (its NIP-22 `A`
|
|
44
|
+
* address, its `O` id): a line that is only a link to it, a `nostr:`
|
|
45
|
+
* reference or an app URL, draws nothing, as a file whose card is under the
|
|
46
|
+
* message does. The comment already says which file it is on. A message
|
|
47
|
+
* that would then draw no words at all draws them as before. Ship ended
|
|
48
|
+
* every issue comment with such a line until ONE-11 (Miky, 2026-11-09).
|
|
49
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-comment-draws-no-line-for-the-file-it-is-on.md
|
|
50
|
+
*/
|
|
51
|
+
ownFile?: readonly string[];
|
|
55
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* The values naming the file a comment is on, for `LineContext.ownFile`: its
|
|
55
|
+
* NIP-22 `A` address and its `O` id (SPEC §6.4). None for chat (`kind:9`),
|
|
56
|
+
* whose `a` names what it mentions, not where it is.
|
|
57
|
+
*/
|
|
58
|
+
export declare function ownFileOf(event: {
|
|
59
|
+
kind: number;
|
|
60
|
+
tags: readonly (readonly string[])[];
|
|
61
|
+
}): string[];
|
|
62
|
+
/**
|
|
63
|
+
* A comment's words for its edit box, less each line that is only a `nostr:`
|
|
64
|
+
* reference to the file it is on: the line Ship appended to every issue
|
|
65
|
+
* comment until ONE-11, which no reader draws, so an edit made in any app
|
|
66
|
+
* drops it, as an edit made in Ship always has. A URL or a sentence naming
|
|
67
|
+
* the file stays, being words somebody typed.
|
|
68
|
+
*/
|
|
69
|
+
export declare function withoutOwnFileLines(body: string, ownFile: readonly string[]): string;
|
|
56
70
|
/**
|
|
57
71
|
* The URL a run wrote for its reference, when the URL names that same file:
|
|
58
72
|
* what its chip or row opens (LTX-6). A marker or a block comment can set any
|
package/dist/lines.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lines.d.ts","sourceRoot":"","sources":["../src/lines.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lines.d.ts","sourceRoot":"","sources":["../src/lines.ts"],"names":[],"mappings":"AAcA,OAAO,EAML,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAA;AAE7B;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,IAAI,CAAA;IACjB,0GAA0G;IAC1G,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,kHAAkH;AAClH,eAAO,MAAM,SAAS,YAAY,CAAA;AAElC,wCAAwC;AACxC,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,uDAAuD;IACvD,KA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EAAE,SAAS,WAAW,EAAE,EAAE,OAAO,GAAE,WAAgB,GAAG,WAAW,CA8DjG"}
|
package/dist/lines.js
CHANGED
|
@@ -11,9 +11,52 @@
|
|
|
11
11
|
*
|
|
12
12
|
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
14
|
+
import { KIND_COMMENT } from './kinds.js';
|
|
15
|
+
import { lineDrawOf, linesOf, referenceOfLink, sameFile, valueOfReference, } from '@estiva-app/protocol';
|
|
15
16
|
/** A paragraph's line that is a row, lifted out as a block of its own, so the row is not drawn inside a `<p>`. */
|
|
16
17
|
export const ROW_BLOCK = 'linkRow';
|
|
18
|
+
/**
|
|
19
|
+
* The values naming the file a comment is on, for `LineContext.ownFile`: its
|
|
20
|
+
* NIP-22 `A` address and its `O` id (SPEC §6.4). None for chat (`kind:9`),
|
|
21
|
+
* whose `a` names what it mentions, not where it is.
|
|
22
|
+
*/
|
|
23
|
+
export function ownFileOf(event) {
|
|
24
|
+
if (event.kind !== KIND_COMMENT)
|
|
25
|
+
return [];
|
|
26
|
+
return event.tags.filter((t) => (t[0] === 'A' || t[0] === 'O') && !!t[1]).map((t) => t[1]);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A comment's words for its edit box, less each line that is only a `nostr:`
|
|
30
|
+
* reference to the file it is on: the line Ship appended to every issue
|
|
31
|
+
* comment until ONE-11, which no reader draws, so an edit made in any app
|
|
32
|
+
* drops it, as an edit made in Ship always has. A URL or a sentence naming
|
|
33
|
+
* the file stays, being words somebody typed.
|
|
34
|
+
*/
|
|
35
|
+
export function withoutOwnFileLines(body, ownFile) {
|
|
36
|
+
if (!ownFile.length)
|
|
37
|
+
return body;
|
|
38
|
+
const isOwn = (line) => {
|
|
39
|
+
const text = line.trim();
|
|
40
|
+
if (!/^nostr:[a-z0-9]+$/i.test(text))
|
|
41
|
+
return false;
|
|
42
|
+
const value = valueOfReference(text);
|
|
43
|
+
return !!value && ownFile.some((own) => sameFile(value, own));
|
|
44
|
+
};
|
|
45
|
+
const lines = body.split('\n');
|
|
46
|
+
// A line inside a fenced code block is code, drawn as written, never a link.
|
|
47
|
+
let inCode = false;
|
|
48
|
+
const kept = lines.filter((line) => {
|
|
49
|
+
if (/^\s*```/.test(line))
|
|
50
|
+
inCode = !inCode;
|
|
51
|
+
return inCode || !isOwn(line);
|
|
52
|
+
});
|
|
53
|
+
if (kept.length === lines.length)
|
|
54
|
+
return body;
|
|
55
|
+
// Only the blank lines the dropped line leaves at the end go: every other space is the writer's.
|
|
56
|
+
const words = kept.join('\n').replace(/\s+$/, '');
|
|
57
|
+
// Nothing else written: the link is the message, and a reader draws it, so the edit keeps it too.
|
|
58
|
+
return words || body;
|
|
59
|
+
}
|
|
17
60
|
/**
|
|
18
61
|
* The URL a run wrote for its reference, when the URL names that same file:
|
|
19
62
|
* what its chip or row opens (LTX-6). A marker or a block comment can set any
|
|
@@ -41,6 +84,9 @@ export function urlNames(url, address) {
|
|
|
41
84
|
const BREAK = { text: '\n', marks: [] };
|
|
42
85
|
function rowLineOf(line, block, context) {
|
|
43
86
|
const drawn = lineDrawOf(line, block, context);
|
|
87
|
+
// A link alone on its line to the file the comment is on: nothing (`LineContext.ownFile`).
|
|
88
|
+
if ((drawn.draw === 'row' || drawn.draw === 'nothing') && context.ownFile?.some((own) => sameFile(drawn.value, own)))
|
|
89
|
+
return 'nothing';
|
|
44
90
|
if ((drawn.draw === 'row' || drawn.draw === 'nothing') && context.stayChip?.(drawn.value))
|
|
45
91
|
return undefined;
|
|
46
92
|
if (drawn.draw === 'nothing')
|
|
@@ -121,6 +167,13 @@ export function placeLines(blocks, context = {}) {
|
|
|
121
167
|
}
|
|
122
168
|
out.push(block);
|
|
123
169
|
}
|
|
170
|
+
// Nothing left, not even a card or a part under it: the message keeps its link, as the chip or row it would be without the rule.
|
|
171
|
+
const underIt = (context.cards ?? []).some((card) => card.layout !== 'none') || !!context.parts?.length;
|
|
172
|
+
if (!out.length && blocks.length && context.ownFile?.length && !underIt) {
|
|
173
|
+
const own = context.ownFile;
|
|
174
|
+
// Its chip, in every app, whether or not the app keeps the page it is on as a chip (WID-3's `stayChip`).
|
|
175
|
+
return placeLines(blocks, { ...context, ownFile: undefined, stayChip: (value) => own.some((o) => sameFile(value, o)) || !!context.stayChip?.(value) });
|
|
176
|
+
}
|
|
124
177
|
return { blocks: out, rowOf: (block) => rows.get(block), rowRuns };
|
|
125
178
|
}
|
|
126
179
|
//# sourceMappingURL=lines.js.map
|
package/dist/lines.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lines.js","sourceRoot":"","sources":["../src/lines.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,UAAU,EACV,OAAO,EACP,eAAe,
|
|
1
|
+
{"version":3,"file":"lines.js","sourceRoot":"","sources":["../src/lines.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EACL,UAAU,EACV,OAAO,EACP,eAAe,EACf,QAAQ,EACR,gBAAgB,GAMjB,MAAM,sBAAsB,CAAA;AAiB7B,kHAAkH;AAClH,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAA;AAoClC;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,KAA6D;IACrF,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,EAAE,CAAA;IAC1C,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAA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json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@estiva-app/conversation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"description": "The conversation rules of the Estiva SPEC (§6.2–§6.8, §11): comment and mention strengths, threading, one shape for a message and a thread, resolving a thread, the line rule, 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/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.36.0'
|
|
16
16
|
|
|
17
17
|
export {
|
|
18
18
|
KIND_MESSAGE,
|
|
@@ -77,7 +77,7 @@ export {
|
|
|
77
77
|
|
|
78
78
|
export { foldThreads, type Message, type Thread, type RootState } from './shape.js'
|
|
79
79
|
|
|
80
|
-
export { placeLines, writtenUrlOf, urlNames, ROW_BLOCK, type RowLine, type PlacedLines, type LineContext } from './lines.js'
|
|
80
|
+
export { placeLines, ownFileOf, withoutOwnFileLines, writtenUrlOf, urlNames, ROW_BLOCK, type RowLine, type PlacedLines, type LineContext } from './lines.js'
|
|
81
81
|
|
|
82
82
|
export { buildComment, buildReply, offersEditAndDelete, placeOf, type CommentRef } from './builders.js'
|
|
83
83
|
|
package/src/lines.ts
CHANGED
|
@@ -11,10 +11,13 @@
|
|
|
11
11
|
*
|
|
12
12
|
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md
|
|
13
13
|
*/
|
|
14
|
+
import { KIND_COMMENT } from './kinds.js'
|
|
14
15
|
import {
|
|
15
16
|
lineDrawOf,
|
|
16
17
|
linesOf,
|
|
17
18
|
referenceOfLink,
|
|
19
|
+
sameFile,
|
|
20
|
+
valueOfReference,
|
|
18
21
|
type Embed,
|
|
19
22
|
type LinkResolver,
|
|
20
23
|
type PartPointer,
|
|
@@ -62,6 +65,55 @@ export interface LineContext {
|
|
|
62
65
|
* is shown on draws no row of itself there (Miky, WID-3).
|
|
63
66
|
*/
|
|
64
67
|
stayChip?: (value: string) => boolean
|
|
68
|
+
/**
|
|
69
|
+
* The file a comment is on, by each value it names it with (its NIP-22 `A`
|
|
70
|
+
* address, its `O` id): a line that is only a link to it, a `nostr:`
|
|
71
|
+
* reference or an app URL, draws nothing, as a file whose card is under the
|
|
72
|
+
* message does. The comment already says which file it is on. A message
|
|
73
|
+
* that would then draw no words at all draws them as before. Ship ended
|
|
74
|
+
* every issue comment with such a line until ONE-11 (Miky, 2026-11-09).
|
|
75
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-comment-draws-no-line-for-the-file-it-is-on.md
|
|
76
|
+
*/
|
|
77
|
+
ownFile?: readonly string[]
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The values naming the file a comment is on, for `LineContext.ownFile`: its
|
|
82
|
+
* NIP-22 `A` address and its `O` id (SPEC §6.4). None for chat (`kind:9`),
|
|
83
|
+
* whose `a` names what it mentions, not where it is.
|
|
84
|
+
*/
|
|
85
|
+
export function ownFileOf(event: { kind: number; tags: readonly (readonly string[])[] }): string[] {
|
|
86
|
+
if (event.kind !== KIND_COMMENT) return []
|
|
87
|
+
return event.tags.filter((t) => (t[0] === 'A' || t[0] === 'O') && !!t[1]).map((t) => t[1])
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* A comment's words for its edit box, less each line that is only a `nostr:`
|
|
92
|
+
* reference to the file it is on: the line Ship appended to every issue
|
|
93
|
+
* comment until ONE-11, which no reader draws, so an edit made in any app
|
|
94
|
+
* drops it, as an edit made in Ship always has. A URL or a sentence naming
|
|
95
|
+
* the file stays, being words somebody typed.
|
|
96
|
+
*/
|
|
97
|
+
export function withoutOwnFileLines(body: string, ownFile: readonly string[]): string {
|
|
98
|
+
if (!ownFile.length) return body
|
|
99
|
+
const isOwn = (line: string) => {
|
|
100
|
+
const text = line.trim()
|
|
101
|
+
if (!/^nostr:[a-z0-9]+$/i.test(text)) return false
|
|
102
|
+
const value = valueOfReference(text)
|
|
103
|
+
return !!value && ownFile.some((own) => sameFile(value, own))
|
|
104
|
+
}
|
|
105
|
+
const lines = body.split('\n')
|
|
106
|
+
// A line inside a fenced code block is code, drawn as written, never a link.
|
|
107
|
+
let inCode = false
|
|
108
|
+
const kept = lines.filter((line) => {
|
|
109
|
+
if (/^\s*```/.test(line)) inCode = !inCode
|
|
110
|
+
return inCode || !isOwn(line)
|
|
111
|
+
})
|
|
112
|
+
if (kept.length === lines.length) return body
|
|
113
|
+
// Only the blank lines the dropped line leaves at the end go: every other space is the writer's.
|
|
114
|
+
const words = kept.join('\n').replace(/\s+$/, '')
|
|
115
|
+
// Nothing else written: the link is the message, and a reader draws it, so the edit keeps it too.
|
|
116
|
+
return words || body
|
|
65
117
|
}
|
|
66
118
|
|
|
67
119
|
/**
|
|
@@ -92,6 +144,8 @@ const BREAK: RenderInline = { text: '\n', marks: [] }
|
|
|
92
144
|
|
|
93
145
|
function rowLineOf(line: readonly RenderInline[], block: Pick<RenderBlock, 'type'>, context: LineContext): RowLine | 'nothing' | undefined {
|
|
94
146
|
const drawn = lineDrawOf(line, block, context)
|
|
147
|
+
// A link alone on its line to the file the comment is on: nothing (`LineContext.ownFile`).
|
|
148
|
+
if ((drawn.draw === 'row' || drawn.draw === 'nothing') && context.ownFile?.some((own) => sameFile(drawn.value, own))) return 'nothing'
|
|
95
149
|
if ((drawn.draw === 'row' || drawn.draw === 'nothing') && context.stayChip?.(drawn.value)) return undefined
|
|
96
150
|
if (drawn.draw === 'nothing') return 'nothing'
|
|
97
151
|
if (drawn.draw === 'unreadable') return { reference: drawn.reference, unreadable: true }
|
|
@@ -162,5 +216,12 @@ export function placeLines(blocks: readonly RenderBlock[], context: LineContext
|
|
|
162
216
|
}
|
|
163
217
|
out.push(block)
|
|
164
218
|
}
|
|
219
|
+
// Nothing left, not even a card or a part under it: the message keeps its link, as the chip or row it would be without the rule.
|
|
220
|
+
const underIt = (context.cards ?? []).some((card) => card.layout !== 'none') || !!context.parts?.length
|
|
221
|
+
if (!out.length && blocks.length && context.ownFile?.length && !underIt) {
|
|
222
|
+
const own = context.ownFile
|
|
223
|
+
// Its chip, in every app, whether or not the app keeps the page it is on as a chip (WID-3's `stayChip`).
|
|
224
|
+
return placeLines(blocks, { ...context, ownFile: undefined, stayChip: (value) => own.some((o) => sameFile(value, o)) || !!context.stayChip?.(value) })
|
|
225
|
+
}
|
|
165
226
|
return { blocks: out, rowOf: (block) => rows.get(block), rowRuns }
|
|
166
227
|
}
|