@estiva-app/protocol 0.28.1 → 0.30.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 +46 -0
- package/dist/blocks.d.ts +40 -0
- package/dist/blocks.d.ts.map +1 -1
- package/dist/blocks.js +57 -0
- package/dist/blocks.js.map +1 -1
- package/dist/bridge-content.d.ts +15 -2
- package/dist/bridge-content.d.ts.map +1 -1
- package/dist/bridge-content.js +61 -13
- package/dist/bridge-content.js.map +1 -1
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +89 -5
- package/dist/editor.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/render.d.ts +18 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +18 -2
- package/dist/render.js.map +1 -1
- package/package.json +1 -1
- package/src/blocks.ts +62 -0
- package/src/bridge-content.ts +71 -12
- package/src/editor.ts +96 -6
- package/src/index.ts +8 -1
- package/src/render.ts +32 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,52 @@ Every entry answers the wire question explicitly, including when the answer is
|
|
|
4
4
|
nothing (ADR 0002 §4b). A change to the bytes an app publishes is a MAJOR — in
|
|
5
5
|
`0.x`, a MINOR — even when no TypeScript signature moved.
|
|
6
6
|
|
|
7
|
+
## 0.30.0 — 2026-10-13
|
|
8
|
+
|
|
9
|
+
**Wire behaviour: a block document can hold a checklist item and a callout**
|
|
10
|
+
(RIC-19, SPEC §13.3). Both are an attribute on a block that already exists, so a
|
|
11
|
+
reader on 0.29 still draws a plain list item and a plain quote with all their
|
|
12
|
+
text; its editor's save drops the attribute but no text and no id.
|
|
13
|
+
|
|
14
|
+
- A `listItem`'s `attrs.checked` is `true` or `false` on a checklist item —
|
|
15
|
+
per item, on either list type, independent of `indent`. Absent, or any other
|
|
16
|
+
value, is a plain item and never a reason to reject the document.
|
|
17
|
+
`listItemChecked(item)` reads it; `toEditorDocument` drops a non-boolean one.
|
|
18
|
+
- A `blockquote`'s `attrs.tone` makes it a callout. `CALLOUT_TONES` are
|
|
19
|
+
GitHub's alert names — `note`, `tip`, `important`, `warning`, `caution` (Miky,
|
|
20
|
+
2026-10-13). `calloutTone(block)` reads it: not a string is a plain quote, and
|
|
21
|
+
a string it does not know is a `note`; an editor keeps the string as written.
|
|
22
|
+
- `RenderBlock.checked` and `RenderBlock.tone`, from those two readers.
|
|
23
|
+
- `blockDocumentToMarkerText(doc, { description: true })` spells a checklist
|
|
24
|
+
item `- [ ] ` / `- [x] ` and a callout as a quote whose first line is
|
|
25
|
+
`[!WARNING]`; `markerTextToBlockDocument(text, previous, { description: true })`
|
|
26
|
+
reads them back. Without the option nothing changes: a message stays §13.2's
|
|
27
|
+
dialect, where `[x]` is text (Miky, 2026-10-13).
|
|
28
|
+
|
|
29
|
+
## 0.29.0 — 2026-10-12
|
|
30
|
+
|
|
31
|
+
**Wire behaviour: a block document can hold an indented list item** (MAN-13,
|
|
32
|
+
SPEC §13.3). An editor's save used to drop an item indented with Tab, text and
|
|
33
|
+
all; it now writes it.
|
|
34
|
+
|
|
35
|
+
- A list stays flat on the wire, and an indented `listItem` carries
|
|
36
|
+
`attrs.indent` (a whole number, absent means 0). A reader on 0.28 still draws
|
|
37
|
+
every item, level, and its editor's save drops the depth but no text and no id.
|
|
38
|
+
- `listItemDepths(items)` is how a reader must read it: anything but a whole
|
|
39
|
+
number ≥ 0 is 0, and no item sits more than one level below the item before
|
|
40
|
+
it, so the first is at 0 and the children of a deleted parent hang from the
|
|
41
|
+
item above. None is deeper than `MAX_LIST_DEPTH` (8, SPEC's MUST; Miky,
|
|
42
|
+
2026-10-12): a list one level deeper per item fits ~4,300 levels in 256 KiB
|
|
43
|
+
and overflowed the stack on save.
|
|
44
|
+
- `toEditorDocument` nests indented items the way ProseMirror's Tab does, each
|
|
45
|
+
inner list taking the outer list's type and no id; `fromEditorDocument` flattens
|
|
46
|
+
them back, keeping every item's id. An inner list of the other type saves as
|
|
47
|
+
the outer list's (Miky, 2026-10-12).
|
|
48
|
+
- `RenderBlock.indent` on a list item, from `listItemDepths`; a list's items stay
|
|
49
|
+
its flat `children`.
|
|
50
|
+
- `blockDocumentToMarkerText` spells an indented item two spaces a level, each
|
|
51
|
+
level numbered from 1. §13.2 has no nesting, so it reads back level.
|
|
52
|
+
|
|
7
53
|
## 0.28.1 — 2026-10-07
|
|
8
54
|
|
|
9
55
|
**Wire behaviour: no builder's bytes changed.** `absenceOf` was too trusting
|
package/dist/blocks.d.ts
CHANGED
|
@@ -73,6 +73,46 @@ export declare function assignMissingBlockIds(doc: BlockDocument): BlockDocument
|
|
|
73
73
|
export declare function blockIds(doc: BlockDocument): string[];
|
|
74
74
|
/** The block an anchor points at, or `undefined` if it is gone. */
|
|
75
75
|
export declare function findBlock(doc: BlockDocument, id: string): Block | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* How deep each item of a list sits — §13.3's `attrs.indent`, as a reader must
|
|
78
|
+
* read it (MAN-13).
|
|
79
|
+
*
|
|
80
|
+
* A list is flat on the wire and an item says how far it is indented, so a
|
|
81
|
+
* reader that does not know `indent` still draws every item, just level. That
|
|
82
|
+
* leaves two shapes the editor never writes and a reader still has to place:
|
|
83
|
+
* a first item that is indented, and an item more than one level deeper than
|
|
84
|
+
* the one above — the children of a parent that was deleted. Each sits at most
|
|
85
|
+
* one level below the item before it, so the first item is at 0 and an orphan
|
|
86
|
+
* hangs from the item above. Anything that is not a whole number ≥ 0 is 0.
|
|
87
|
+
*
|
|
88
|
+
* And none deeper than {@link MAX_LIST_DEPTH}: a list whose every item is one
|
|
89
|
+
* deeper than the last fits ~4,300 levels in §12.3's 256 KiB, and an editor
|
|
90
|
+
* walking that tree runs out of stack (review of MAN-13).
|
|
91
|
+
*/
|
|
92
|
+
export declare function listItemDepths(items: readonly Block[]): number[];
|
|
93
|
+
/** The deepest a list item is drawn or edited; deeper is drawn here. §13.3's MUST (Miky, 2026-10-12). */
|
|
94
|
+
export declare const MAX_LIST_DEPTH = 8;
|
|
95
|
+
/**
|
|
96
|
+
* Whether a list item is a checklist item, and ticked — §13.3's
|
|
97
|
+
* `attrs.checked` (RIC-19). `true` or `false` makes it one; absent, or any other
|
|
98
|
+
* value (`"true"`, `1`), leaves it a plain item, and is never a reason to
|
|
99
|
+
* reject the document. Per item, on either list type, and independent of
|
|
100
|
+
* `indent`: an indented item does not take its parent's tick.
|
|
101
|
+
*/
|
|
102
|
+
export declare function listItemChecked(item: Block): boolean | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* A callout's tones — §13.3's `attrs.tone` on a `blockquote` (RIC-19): GitHub's
|
|
105
|
+
* alert names, so `> [!NOTE]` and its kind map one to one (Miky, 2026-10-13).
|
|
106
|
+
*/
|
|
107
|
+
export declare const CALLOUT_TONES: readonly ["note", "tip", "important", "warning", "caution"];
|
|
108
|
+
export type CalloutTone = (typeof CALLOUT_TONES)[number];
|
|
109
|
+
/**
|
|
110
|
+
* Which callout a quote is, if it is one. Absent, or not a string, is a plain
|
|
111
|
+
* quote; a string this list does not know is still a callout — the author
|
|
112
|
+
* meant it to stand out — and is drawn as a `note`. Read without regard to
|
|
113
|
+
* case, as the description text reads `> [!WARNING]`.
|
|
114
|
+
*/
|
|
115
|
+
export declare function calloutTone(block: Block): CalloutTone | undefined;
|
|
76
116
|
/**
|
|
77
117
|
* A block's text, including its children's.
|
|
78
118
|
*
|
package/dist/blocks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../src/blocks.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,cAAc,CAAA;AAErE;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,0JAYpB,CAAA;AAEV,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/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AQ,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,EAAE,CAUrD;AAED,mEAAmE;AACnE,wBAAgB,SAAS,CAAC,GAAG,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAY3E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,GAAG,MAAM,EAAE,CAShE;AAED,yGAAyG;AACzG,eAAO,MAAM,cAAc,IAAI,CAAA;AAE/B;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,SAAS,CAGhE;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,6DAA8D,CAAA;AACxF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA;AAExD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,GAAG,SAAS,CAKjE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAIjD;AAED,uFAAuF;AACvF,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAEvD"}
|
package/dist/blocks.js
CHANGED
|
@@ -232,6 +232,63 @@ export function findBlock(doc, id) {
|
|
|
232
232
|
};
|
|
233
233
|
return walk(doc.content);
|
|
234
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* How deep each item of a list sits — §13.3's `attrs.indent`, as a reader must
|
|
237
|
+
* read it (MAN-13).
|
|
238
|
+
*
|
|
239
|
+
* A list is flat on the wire and an item says how far it is indented, so a
|
|
240
|
+
* reader that does not know `indent` still draws every item, just level. That
|
|
241
|
+
* leaves two shapes the editor never writes and a reader still has to place:
|
|
242
|
+
* a first item that is indented, and an item more than one level deeper than
|
|
243
|
+
* the one above — the children of a parent that was deleted. Each sits at most
|
|
244
|
+
* one level below the item before it, so the first item is at 0 and an orphan
|
|
245
|
+
* hangs from the item above. Anything that is not a whole number ≥ 0 is 0.
|
|
246
|
+
*
|
|
247
|
+
* And none deeper than {@link MAX_LIST_DEPTH}: a list whose every item is one
|
|
248
|
+
* deeper than the last fits ~4,300 levels in §12.3's 256 KiB, and an editor
|
|
249
|
+
* walking that tree runs out of stack (review of MAN-13).
|
|
250
|
+
*/
|
|
251
|
+
export function listItemDepths(items) {
|
|
252
|
+
const out = [];
|
|
253
|
+
for (const item of items) {
|
|
254
|
+
const raw = item.attrs?.indent;
|
|
255
|
+
const asked = typeof raw === 'number' && Number.isInteger(raw) && raw > 0 ? raw : 0;
|
|
256
|
+
const ceiling = out.length === 0 ? 0 : out[out.length - 1] + 1;
|
|
257
|
+
out.push(Math.min(asked, ceiling, MAX_LIST_DEPTH));
|
|
258
|
+
}
|
|
259
|
+
return out;
|
|
260
|
+
}
|
|
261
|
+
/** The deepest a list item is drawn or edited; deeper is drawn here. §13.3's MUST (Miky, 2026-10-12). */
|
|
262
|
+
export const MAX_LIST_DEPTH = 8;
|
|
263
|
+
/**
|
|
264
|
+
* Whether a list item is a checklist item, and ticked — §13.3's
|
|
265
|
+
* `attrs.checked` (RIC-19). `true` or `false` makes it one; absent, or any other
|
|
266
|
+
* value (`"true"`, `1`), leaves it a plain item, and is never a reason to
|
|
267
|
+
* reject the document. Per item, on either list type, and independent of
|
|
268
|
+
* `indent`: an indented item does not take its parent's tick.
|
|
269
|
+
*/
|
|
270
|
+
export function listItemChecked(item) {
|
|
271
|
+
const raw = item.attrs?.checked;
|
|
272
|
+
return typeof raw === 'boolean' ? raw : undefined;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* A callout's tones — §13.3's `attrs.tone` on a `blockquote` (RIC-19): GitHub's
|
|
276
|
+
* alert names, so `> [!NOTE]` and its kind map one to one (Miky, 2026-10-13).
|
|
277
|
+
*/
|
|
278
|
+
export const CALLOUT_TONES = ['note', 'tip', 'important', 'warning', 'caution'];
|
|
279
|
+
/**
|
|
280
|
+
* Which callout a quote is, if it is one. Absent, or not a string, is a plain
|
|
281
|
+
* quote; a string this list does not know is still a callout — the author
|
|
282
|
+
* meant it to stand out — and is drawn as a `note`. Read without regard to
|
|
283
|
+
* case, as the description text reads `> [!WARNING]`.
|
|
284
|
+
*/
|
|
285
|
+
export function calloutTone(block) {
|
|
286
|
+
const raw = block.attrs?.tone;
|
|
287
|
+
if (typeof raw !== 'string')
|
|
288
|
+
return undefined;
|
|
289
|
+
const tone = raw.toLowerCase();
|
|
290
|
+
return CALLOUT_TONES.includes(tone) ? tone : 'note';
|
|
291
|
+
}
|
|
235
292
|
/**
|
|
236
293
|
* A block's text, including its children's.
|
|
237
294
|
*
|
package/dist/blocks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.js","sourceRoot":"","sources":["../src/blocks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAuB,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAErE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,WAAW;IACX,SAAS;IACT,YAAY;IACZ,aAAa;IACb,UAAU;IACV,YAAY;IACZ,WAAW;IACX,OAAO;IACP,gBAAgB;IAChB,YAAY;IACZ,QAAQ;CACA,CAAA;AAmBV,gGAAgG;AAChG,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,QAAQ,CAAU;IAC3B,YAAY,QAAkB;QAC5B,KAAK,CAAC,yBAAyB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACrD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAA;QAChC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;CACF;AAED,MAAM,QAAQ,GAAG,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13.2 has no marker for (RIC-19):
|
|
4
|
+
* a checklist item as `- [ ] ` / `- [x] `, GFM's task list, and a callout as a
|
|
5
|
+
* quote whose first line is `[!NOTE]`, GitHub's alert. **Descriptions only**
|
|
6
|
+
* (Miky, 2026-10-13): a message stays §13.2's dialect, where `[x]` is text.
|
|
7
|
+
*/
|
|
8
|
+
export interface DescriptionTextOptions {
|
|
9
|
+
description?: boolean;
|
|
10
|
+
}
|
|
2
11
|
/**
|
|
3
12
|
* Marker text as a block document, keeping `previous`'s ids wherever a block
|
|
4
13
|
* still corresponds. The matching rule is in this module's header.
|
|
5
14
|
*/
|
|
6
|
-
export declare function markerTextToBlockDocument(text: string, previous?: BlockDocument): BlockDocument;
|
|
15
|
+
export declare function markerTextToBlockDocument(text: string, previous?: BlockDocument, options?: DescriptionTextOptions): BlockDocument;
|
|
7
16
|
/**
|
|
8
17
|
* A block document back as marker text, for an editor that edits text.
|
|
9
18
|
*
|
|
@@ -12,6 +21,10 @@ export declare function markerTextToBlockDocument(text: string, previous?: Block
|
|
|
12
21
|
* written by a *block* editor may hold a table or a nested list, and §13.2 has
|
|
13
22
|
* no marker for either — those degrade to their text rather than vanishing,
|
|
14
23
|
* which is the rule §13.3 already gives a reader for an unknown block.
|
|
24
|
+
*
|
|
25
|
+
* With `{ description: true }` a checklist item and a callout are spelled too
|
|
26
|
+
* ({@link DescriptionTextOptions}); without it they read as a plain item and a
|
|
27
|
+
* plain quote, as §13.2 has them.
|
|
15
28
|
*/
|
|
16
|
-
export declare function blockDocumentToMarkerText(doc: BlockDocument): string;
|
|
29
|
+
export declare function blockDocumentToMarkerText(doc: BlockDocument, options?: DescriptionTextOptions): string;
|
|
17
30
|
//# sourceMappingURL=bridge-content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge-content.d.ts","sourceRoot":"","sources":["../src/bridge-content.ts"],"names":[],"mappings":"AAuCA,OAAO,EAAc,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"bridge-content.d.ts","sourceRoot":"","sources":["../src/bridge-content.ts"],"names":[],"mappings":"AAuCA,OAAO,EAAc,KAAK,aAAa,EAA+C,MAAM,aAAa,CAAA;AA0BzG;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AA0DD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,EAAE,OAAO,GAAE,sBAA2B,GAAG,aAAa,CAwDrI;AAKD;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,GAAE,sBAA2B,GAAG,MAAM,CAyD1G"}
|
package/dist/bridge-content.js
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* anchor is broken regardless of this rule.
|
|
32
32
|
*/
|
|
33
33
|
import { markersToInlineNodes, inlineNodesToMarkers, parseBodySegments, } from './content.js';
|
|
34
|
-
import { newBlockId } from './blocks.js';
|
|
34
|
+
import { newBlockId, listItemDepths, listItemChecked } from './blocks.js';
|
|
35
35
|
const isInlineRun = (content) => Array.isArray(content) &&
|
|
36
36
|
content.length > 0 &&
|
|
37
37
|
typeof content[0] === 'object' &&
|
|
@@ -54,7 +54,30 @@ function textOf(block) {
|
|
|
54
54
|
carries the same warning for the same reason.
|
|
55
55
|
*/
|
|
56
56
|
const keyOf = (block) => `${block.type}\u0000${textOf(block)}`;
|
|
57
|
-
|
|
57
|
+
const TASK = /^\[( |x|X)\] /;
|
|
58
|
+
const ALERT = /^\[!([A-Za-z]+)\]$/;
|
|
59
|
+
function itemFromText(item, description) {
|
|
60
|
+
const task = description ? TASK.exec(item) : null;
|
|
61
|
+
if (!task)
|
|
62
|
+
return { type: 'listItem', id: '', content: markersToInlineNodes(item) };
|
|
63
|
+
return {
|
|
64
|
+
type: 'listItem',
|
|
65
|
+
id: '',
|
|
66
|
+
attrs: { checked: task[1] !== ' ' },
|
|
67
|
+
content: markersToInlineNodes(item.slice(task[0].length)),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function quoteFromLines(lines, description) {
|
|
71
|
+
const alert = description && lines.length > 0 ? ALERT.exec(lines[0].trim()) : null;
|
|
72
|
+
if (!alert)
|
|
73
|
+
return { type: 'blockquote', id: '', content: markersToInlineNodes(lines.join('\n')) };
|
|
74
|
+
/*
|
|
75
|
+
The kind is kept as written, lowercased: a tone this version does not know
|
|
76
|
+
is still a callout, and the next save must not turn it into a `note`.
|
|
77
|
+
*/
|
|
78
|
+
return { type: 'blockquote', id: '', attrs: { tone: alert[1].toLowerCase() }, content: markersToInlineNodes(lines.slice(1).join('\n')) };
|
|
79
|
+
}
|
|
80
|
+
function blockFromSegment(seg, description) {
|
|
58
81
|
switch (seg.type) {
|
|
59
82
|
case 'heading':
|
|
60
83
|
return { type: 'heading', id: '', attrs: { level: seg.level }, content: markersToInlineNodes(seg.text) };
|
|
@@ -62,17 +85,17 @@ function blockFromSegment(seg) {
|
|
|
62
85
|
return {
|
|
63
86
|
type: 'bulletList',
|
|
64
87
|
id: '',
|
|
65
|
-
content: seg.items.map((item) => (
|
|
88
|
+
content: seg.items.map((item) => itemFromText(item, description)),
|
|
66
89
|
};
|
|
67
90
|
case 'numbered':
|
|
68
91
|
return {
|
|
69
92
|
type: 'orderedList',
|
|
70
93
|
id: '',
|
|
71
94
|
...(seg.start ? { attrs: { start: seg.start } } : {}),
|
|
72
|
-
content: seg.items.map((item) => (
|
|
95
|
+
content: seg.items.map((item) => itemFromText(item, description)),
|
|
73
96
|
};
|
|
74
97
|
case 'quote':
|
|
75
|
-
return
|
|
98
|
+
return quoteFromLines(seg.lines, description);
|
|
76
99
|
case 'code':
|
|
77
100
|
return {
|
|
78
101
|
type: 'codeBlock',
|
|
@@ -89,8 +112,8 @@ function blockFromSegment(seg) {
|
|
|
89
112
|
* Marker text as a block document, keeping `previous`'s ids wherever a block
|
|
90
113
|
* still corresponds. The matching rule is in this module's header.
|
|
91
114
|
*/
|
|
92
|
-
export function markerTextToBlockDocument(text, previous) {
|
|
93
|
-
const fresh = parseBodySegments(text).map(blockFromSegment);
|
|
115
|
+
export function markerTextToBlockDocument(text, previous, options = {}) {
|
|
116
|
+
const fresh = parseBodySegments(text).map((seg) => blockFromSegment(seg, options.description === true));
|
|
94
117
|
const old = previous?.content ?? [];
|
|
95
118
|
const takenIds = new Set();
|
|
96
119
|
const usedOld = new Set();
|
|
@@ -157,8 +180,13 @@ const itemText = (item) => isInlineRun(item.content) ? inlineNodesToMarkers(item
|
|
|
157
180
|
* written by a *block* editor may hold a table or a nested list, and §13.2 has
|
|
158
181
|
* no marker for either — those degrade to their text rather than vanishing,
|
|
159
182
|
* which is the rule §13.3 already gives a reader for an unknown block.
|
|
183
|
+
*
|
|
184
|
+
* With `{ description: true }` a checklist item and a callout are spelled too
|
|
185
|
+
* ({@link DescriptionTextOptions}); without it they read as a plain item and a
|
|
186
|
+
* plain quote, as §13.2 has them.
|
|
160
187
|
*/
|
|
161
|
-
export function blockDocumentToMarkerText(doc) {
|
|
188
|
+
export function blockDocumentToMarkerText(doc, options = {}) {
|
|
189
|
+
const description = options.description === true;
|
|
162
190
|
const lines = [];
|
|
163
191
|
for (const block of doc.content) {
|
|
164
192
|
const inline = isInlineRun(block.content) ? inlineNodesToMarkers(block.content) : '';
|
|
@@ -169,18 +197,38 @@ export function blockDocumentToMarkerText(doc) {
|
|
|
169
197
|
break;
|
|
170
198
|
}
|
|
171
199
|
case 'bulletList':
|
|
172
|
-
for (const item of block.content ?? [])
|
|
173
|
-
lines.push(`- ${itemText(item)}`);
|
|
174
|
-
break;
|
|
175
200
|
case 'orderedList': {
|
|
201
|
+
/*
|
|
202
|
+
An indented item (MAN-13) is spelled two spaces a level, as Markdown
|
|
203
|
+
does. §13.2 has no nesting, so it reads back level — still every
|
|
204
|
+
item, which is why the agent's text edit treats such a list as one it
|
|
205
|
+
cannot spell and keeps it whole.
|
|
206
|
+
*/
|
|
207
|
+
const items = block.content ?? [];
|
|
208
|
+
const depths = listItemDepths(items);
|
|
176
209
|
const start = typeof block.attrs?.start === 'number' ? block.attrs.start : 1;
|
|
177
|
-
|
|
210
|
+
// The next number at each depth; a shallower item restarts the ones below it.
|
|
211
|
+
const next = [];
|
|
212
|
+
items.forEach((item, i) => {
|
|
213
|
+
const depth = depths[i];
|
|
214
|
+
next.length = depth + 1;
|
|
215
|
+
next[depth] ??= depth === 0 ? start : 1;
|
|
216
|
+
const marker = block.type === 'bulletList' ? '-' : `${next[depth]++}.`;
|
|
217
|
+
const checked = description ? listItemChecked(item) : undefined;
|
|
218
|
+
const task = checked === undefined ? '' : checked ? '[x] ' : '[ ] ';
|
|
219
|
+
lines.push(`${' '.repeat(depth)}${marker} ${task}${itemText(item)}`);
|
|
220
|
+
});
|
|
178
221
|
break;
|
|
179
222
|
}
|
|
180
|
-
case 'blockquote':
|
|
223
|
+
case 'blockquote': {
|
|
224
|
+
// The tone as written, not as `calloutTone` reads it: the next save reads back what this spelled.
|
|
225
|
+
const tone = description && typeof block.attrs?.tone === 'string' && /^[A-Za-z]+$/.test(block.attrs.tone) ? block.attrs.tone : '';
|
|
226
|
+
if (tone)
|
|
227
|
+
lines.push(`> [!${tone.toUpperCase()}]`);
|
|
181
228
|
for (const line of inline.split('\n'))
|
|
182
229
|
lines.push(`> ${line}`);
|
|
183
230
|
break;
|
|
231
|
+
}
|
|
184
232
|
case 'codeBlock': {
|
|
185
233
|
const language = typeof block.attrs?.language === 'string' ? block.attrs.language : '';
|
|
186
234
|
lines.push('```' + language, inline, '```');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge-content.js","sourceRoot":"","sources":["../src/bridge-content.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAGL,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,cAAc,CAAA;AACrB,OAAO,EAA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,KAAK,WAAW,CAAC,CAAC,CAAC;gBACjB,MAAM,QAAQ,GAAG,OAAO,KAAK,CAAC,KAAK,EAAE,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAA;gBACtF,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;gBAC3C,MAAK;YACP,CAAC;YACD,KAAK,gBAAgB;gBACnB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;gBACjB,MAAK;YACP;gBACE,oEAAoE;gBACpE,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;QACvC,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAChB,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AAC7C,CAAC"}
|
package/dist/editor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,aAAa,EACnB,MAAM,aAAa,CAAA;AAGpB,OAAO,EAAE,qBAAqB,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,0CAA0C;AAC1C,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;IACtB,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EAAE,CAAA;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,KAAK,CAAA;IACX,OAAO,EAAE,UAAU,EAAE,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAcjD,CAAA;AAeF,8FAA8F;AAC9F,eAAO,MAAM,kBAAkB,iBAAiB,CAAA;AAChD,kGAAkG;AAClG,eAAO,MAAM,cAAc,cAAc,CAAA;AA4IzC;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,aAAa,CAetF;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,aAAa,GAAG,cAAc,CAExE;AAuMD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,GAAG,aAAa,CAO1E;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,cAAc,GAAG;IAC/D,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,CAAC,EAAE,OAAO,qBAAqB,CAAA;CAC7C,CAOA"}
|
package/dist/editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { newBlockId, parseBlockDocument, serializeBlockDocument, inlineTextOf } from './blocks.js';
|
|
1
|
+
import { newBlockId, parseBlockDocument, serializeBlockDocument, inlineTextOf, listItemDepths, } from './blocks.js';
|
|
2
2
|
import { markerTextToBlockDocument } from './bridge-content.js';
|
|
3
3
|
import { BLOCK_DOCUMENT_FORMAT } from './render.js';
|
|
4
4
|
/**
|
|
@@ -46,6 +46,8 @@ export const EDITOR_BLOCK_TYPES = new Set([
|
|
|
46
46
|
* whole table came back empty the first time.
|
|
47
47
|
*/
|
|
48
48
|
const BLOCK_CONTAINERS = new Set(['bulletList', 'orderedList', 'table', 'tableRow', 'tableHeader', 'tableCell']);
|
|
49
|
+
/** The two lists — flat on the wire, nested in the editor (MAN-13). */
|
|
50
|
+
const LISTS = new Set(['bulletList', 'orderedList']);
|
|
49
51
|
/** The node type an unknown block is parked in — `@estiva-app/ui/editor`'s `UnknownBlock`. */
|
|
50
52
|
export const UNKNOWN_BLOCK_NODE = 'unknownBlock';
|
|
51
53
|
/** The node type a `nostr:` reference is drawn as — `@estiva-app/ui/editor`'s `ReferenceNode`. */
|
|
@@ -123,10 +125,18 @@ function blockToEditor(block) {
|
|
|
123
125
|
paragraph is that wrapper and nothing else — see `RichText`, which draws
|
|
124
126
|
a list item's *inline* content, so a list item that held anything but one
|
|
125
127
|
paragraph would render empty there.
|
|
128
|
+
|
|
129
|
+
Its `indent` is spent by `listToEditor`, which nests the item instead.
|
|
130
|
+
A `checked` rides along as written, like any attribute: one that is not
|
|
131
|
+
a boolean is a plain item to the editor too (§13.3, RIC-19), and the
|
|
132
|
+
save hands it back unchanged rather than erasing what another app wrote.
|
|
126
133
|
*/
|
|
134
|
+
const { indent: _depth, ...itemAttrs } = attrs;
|
|
127
135
|
const inline = isInlineRun(block.content) ? inlineToEditor(block.content) : [];
|
|
128
|
-
return { type: 'listItem', attrs, content: [{ type: 'paragraph', content: inline }] };
|
|
136
|
+
return { type: 'listItem', attrs: itemAttrs, content: [{ type: 'paragraph', content: inline }] };
|
|
129
137
|
}
|
|
138
|
+
if (LISTS.has(block.type))
|
|
139
|
+
return listToEditor(block, attrs);
|
|
130
140
|
if (block.content === undefined)
|
|
131
141
|
return { type: block.type, attrs };
|
|
132
142
|
const content = isInlineRun(block.content)
|
|
@@ -134,6 +144,46 @@ function blockToEditor(block) {
|
|
|
134
144
|
: block.content.map(blockToEditor);
|
|
135
145
|
return { type: block.type, attrs, ...(content.length ? { content } : {}) };
|
|
136
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* A flat list, nested the way an editor holds it (MAN-13).
|
|
149
|
+
*
|
|
150
|
+
* §13.3 keeps a list flat and says how deep each item is (`attrs.indent`, read
|
|
151
|
+
* by `listItemDepths`); ProseMirror puts a deeper item in a list inside the
|
|
152
|
+
* item above, which is what its Tab does. The lists built here are the
|
|
153
|
+
* editor's alone: they have no id because the wire has no such block, and
|
|
154
|
+
* each takes the type of the list it sits in (Miky, 2026-10-12).
|
|
155
|
+
*/
|
|
156
|
+
function listToEditor(block, attrs) {
|
|
157
|
+
const items = Array.isArray(block.content) && !isInlineRun(block.content) ? block.content : [];
|
|
158
|
+
const depths = listItemDepths(items);
|
|
159
|
+
const root = { type: block.type, attrs, content: [] };
|
|
160
|
+
// The list each depth is filling. A depth one deeper than the last opens a
|
|
161
|
+
// list inside the last item; a shallower one closes the lists below it.
|
|
162
|
+
const open = [root];
|
|
163
|
+
items.forEach((item, i) => {
|
|
164
|
+
// At most one below the deepest list open: an item that could not nest
|
|
165
|
+
// (below) leaves the ones after it a level short of what they say.
|
|
166
|
+
let depth = Math.min(depths[i], open.length);
|
|
167
|
+
open.length = Math.min(open.length, depth + 1);
|
|
168
|
+
if (open.length === depth) {
|
|
169
|
+
const parent = open[depth - 1].content.at(-1);
|
|
170
|
+
if (parent.type === 'listItem') {
|
|
171
|
+
const nested = { type: block.type, content: [] };
|
|
172
|
+
parent.content = [...(parent.content ?? []), nested];
|
|
173
|
+
open.push(nested);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
// Only a list item can hold a list: under a block this version does
|
|
177
|
+
// not know, the item stays at that block's depth.
|
|
178
|
+
depth -= 1;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
open[depth].content.push(blockToEditor(item));
|
|
182
|
+
});
|
|
183
|
+
if (root.content.length === 0)
|
|
184
|
+
delete root.content;
|
|
185
|
+
return root;
|
|
186
|
+
}
|
|
137
187
|
/**
|
|
138
188
|
* The document a stored value is edited as, whichever model it arrived in —
|
|
139
189
|
* `format` is `contentFormatOf`'s classification of the event it came from.
|
|
@@ -200,6 +250,11 @@ function claimIds(nodes, owners) {
|
|
|
200
250
|
}
|
|
201
251
|
if (BLOCK_CONTAINERS.has(node.type))
|
|
202
252
|
claimIds(node.content ?? [], owners);
|
|
253
|
+
// A list inside a list item is the editor's, and has no id to claim; its
|
|
254
|
+
// items are the outer list's, one level in (MAN-13).
|
|
255
|
+
if (node.type === 'listItem')
|
|
256
|
+
for (const list of nestedLists(node))
|
|
257
|
+
claimIds(list.content ?? [], owners);
|
|
203
258
|
}
|
|
204
259
|
}
|
|
205
260
|
/** Mints on a missing id and on a repeat that lost — see the header on duplicates. */
|
|
@@ -257,6 +312,28 @@ function sameMarks(a, b) {
|
|
|
257
312
|
return false;
|
|
258
313
|
return a.every((m, i) => m.type === b[i].type);
|
|
259
314
|
}
|
|
315
|
+
const nestedLists = (item) => (item.content ?? []).filter((child) => LISTS.has(child.type));
|
|
316
|
+
/**
|
|
317
|
+
* A list's items, flattened back onto the wire: an item in a list inside an
|
|
318
|
+
* item comes right after it, one `indent` deeper (MAN-13). Whatever type that
|
|
319
|
+
* inner list was, its items are now the outer list's (Miky, 2026-10-12).
|
|
320
|
+
*/
|
|
321
|
+
function listItemsFromEditor(list, depth, claims) {
|
|
322
|
+
const out = [];
|
|
323
|
+
for (const child of list.content ?? []) {
|
|
324
|
+
const block = blockFromEditor(child, claims);
|
|
325
|
+
if (block === null)
|
|
326
|
+
continue;
|
|
327
|
+
if (child.type !== 'listItem') {
|
|
328
|
+
out.push(block);
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
out.push(depth > 0 ? { ...block, attrs: { ...block.attrs, indent: depth } } : block);
|
|
332
|
+
for (const inner of nestedLists(child))
|
|
333
|
+
out.push(...listItemsFromEditor(inner, depth + 1, claims));
|
|
334
|
+
}
|
|
335
|
+
return out;
|
|
336
|
+
}
|
|
260
337
|
function blockFromEditor(node, claims) {
|
|
261
338
|
if (node.type === UNKNOWN_BLOCK_NODE) {
|
|
262
339
|
/*
|
|
@@ -297,10 +374,17 @@ function blockFromEditor(node, claims) {
|
|
|
297
374
|
}
|
|
298
375
|
if (node.type === 'listItem') {
|
|
299
376
|
// Back out of the paragraph wrapper. A list item carries inline runs on
|
|
300
|
-
// the wire — see `blockToEditor`.
|
|
301
|
-
|
|
302
|
-
|
|
377
|
+
// the wire — see `blockToEditor`. A list inside it is the caller's: its
|
|
378
|
+
// items follow this one (`listItemsFromEditor`), and its depth is the
|
|
379
|
+
// caller's to set, never one an attribute claims.
|
|
380
|
+
const { indent: _depth, ...itemAttrs } = attrs;
|
|
381
|
+
const inline = (node.content ?? [])
|
|
382
|
+
.filter((child) => !LISTS.has(child.type))
|
|
383
|
+
.flatMap((child) => inlineFromEditor(child.content ?? []));
|
|
384
|
+
return { type: node.type, id, ...(Object.keys(itemAttrs).length ? { attrs: itemAttrs } : {}), content: inline };
|
|
303
385
|
}
|
|
386
|
+
if (LISTS.has(node.type))
|
|
387
|
+
return { ...base, content: listItemsFromEditor(node, 0, claims) };
|
|
304
388
|
if (BLOCK_CONTAINERS.has(node.type)) {
|
|
305
389
|
const children = (node.content ?? [])
|
|
306
390
|
.map((child) => blockFromEditor(child, claims))
|