@rse/specbook 1.2.10 → 1.2.11
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.
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
the table header and the headings of all enclosing objects, and
|
|
12
12
|
every matched word is highlighted with a <mark> element (an SVG
|
|
13
13
|
<tspan> element underlaid with a <rect> inside a diagram), while
|
|
14
|
-
the table of contents (page and side panel) is filtered along
|
|
14
|
+
the table of contents (page and side panel) is filtered along; the
|
|
15
|
+
explicit anchor id of an object (invisible in the document) is
|
|
16
|
+
searched like its text, a hit marking the anchor symbol instead */
|
|
15
17
|
(function () {
|
|
16
18
|
const tab = document.getElementById("search")
|
|
17
19
|
const toggle = document.getElementById("search-toggle")
|
|
@@ -52,7 +54,9 @@
|
|
|
52
54
|
one not nested inside another unit (like a paragraph or diagram
|
|
53
55
|
in a table cell, which is covered by its table row), where a
|
|
54
56
|
diagram is searched by its SVG text labels, joined by spaces,
|
|
55
|
-
as its raw text content would run them together
|
|
57
|
+
as its raw text content would run them together, and where the
|
|
58
|
+
explicit anchor id of an object heading or table row joins the
|
|
59
|
+
searched text */
|
|
56
60
|
const index = () => {
|
|
57
61
|
if (indexed)
|
|
58
62
|
return
|
|
@@ -66,12 +70,13 @@
|
|
|
66
70
|
return
|
|
67
71
|
parent = parent.parentElement
|
|
68
72
|
}
|
|
69
|
-
const
|
|
73
|
+
const id = (el.dataset.id ?? "").toLowerCase()
|
|
74
|
+
const text = ((el.classList.contains("diagram") ?
|
|
70
75
|
Array.from(el.querySelectorAll("text")).map((t) => t.textContent ?? "").join(" ") :
|
|
71
|
-
(el.textContent ?? "")).toLowerCase()
|
|
76
|
+
(el.textContent ?? "")) + " " + id).toLowerCase()
|
|
72
77
|
const words = new Set(text.split(/[^\p{L}\p{N}]+/u).filter((w) => w !== ""))
|
|
73
78
|
words.forEach((w) => { vocab.add(w) })
|
|
74
|
-
units.push({ el, text, words, keep: false })
|
|
79
|
+
units.push({ el, id, text, words, keep: false })
|
|
75
80
|
})
|
|
76
81
|
})
|
|
77
82
|
|
|
@@ -319,12 +324,24 @@
|
|
|
319
324
|
el.classList.add("search-hide")
|
|
320
325
|
})
|
|
321
326
|
|
|
322
|
-
/* highlight every matched word within the kept units
|
|
327
|
+
/* highlight every matched word within the kept units, plus the
|
|
328
|
+
anchor symbol of a unit whose explicit anchor id matched, as
|
|
329
|
+
the id itself is nowhere visible */
|
|
323
330
|
const words = Array.from(new Set(parts.flat()))
|
|
324
331
|
const regex = buildRegex(words, Array.from(variants))
|
|
325
332
|
units.forEach((unit) => {
|
|
326
|
-
if (unit.el.classList.contains("search-keep"))
|
|
327
|
-
|
|
333
|
+
if (!unit.el.classList.contains("search-keep"))
|
|
334
|
+
return
|
|
335
|
+
highlight(unit.el, regex)
|
|
336
|
+
regex.lastIndex = 0
|
|
337
|
+
const symbol = unit.el.querySelector("span.anchor-symbol")
|
|
338
|
+
if (unit.id === "" || symbol === null || !regex.test(unit.id))
|
|
339
|
+
return
|
|
340
|
+
const mark = document.createElement("mark")
|
|
341
|
+
mark.classList.add("search-hit")
|
|
342
|
+
while (symbol.firstChild !== null)
|
|
343
|
+
mark.appendChild(symbol.firstChild)
|
|
344
|
+
symbol.appendChild(mark)
|
|
328
345
|
})
|
|
329
346
|
|
|
330
347
|
/* filter the table of contents (its page rows and its side
|
|
@@ -152,7 +152,7 @@ const templates = {
|
|
|
152
152
|
/* <Object/> */
|
|
153
153
|
"Object": textframe `
|
|
154
154
|
<section>
|
|
155
|
-
<h{{ Object.level }} id="{{ Object.id }}"><span class="object-kind"{% if Object.info %} data-info="{{ Object.info }}" data-info-path="{{ Object.infopath }}"{% endif %}>{{ Object.kind }}:</span> <span class="object-name"{% if Object.spec %} data-info-spec="{{ Object.spec }}" data-info-path="{{ Object.specpath }}"{% endif %}>{{ Object.name }}</span>{% if Object.primary %} <span class="primary-marker">⌘</span>{% endif %}{% if Object.paren %} <span class="anchor-paren">({{ Object.paren }})</span>{% endif %} <a href="#{{ Object.id }}"><span class="anchor-symbol">⚓︎</span></a></h{{ Object.level }}>
|
|
155
|
+
<h{{ Object.level }} id="{{ Object.id }}"{% if Object.anchor %} data-id="{{ Object.anchor }}"{% endif %}><span class="object-kind"{% if Object.info %} data-info="{{ Object.info }}" data-info-path="{{ Object.infopath }}"{% endif %}>{{ Object.kind }}:</span> <span class="object-name"{% if Object.spec %} data-info-spec="{{ Object.spec }}" data-info-path="{{ Object.specpath }}"{% endif %}>{{ Object.name }}</span>{% if Object.primary %} <span class="primary-marker">⌘</span>{% endif %}{% if Object.paren %} <span class="anchor-paren">({{ Object.paren }})</span>{% endif %} <a href="#{{ Object.id }}"><span class="anchor-symbol">⚓︎</span></a></h{{ Object.level }}>
|
|
156
156
|
{{ Object.diagram }}
|
|
157
157
|
{{ Object.properties }}
|
|
158
158
|
{{ Object.description }}
|
|
@@ -206,7 +206,7 @@ const templates = {
|
|
|
206
206
|
</thead>
|
|
207
207
|
<tbody>
|
|
208
208
|
{% for row in Table.rows %}
|
|
209
|
-
<tr id="{{ row.id }}"{% if row.even %} class="even"{% endif %}>
|
|
209
|
+
<tr id="{{ row.id }}"{% if row.anchor %} data-id="{{ row.anchor }}"{% endif %}{% if row.even %} class="even"{% endif %}>
|
|
210
210
|
<td><span{% if row.spec %} data-info-spec="{{ row.spec }}" data-info-path="{{ row.specpath }}"{% endif %}>{{ row.name }}</span>{% if row.primary %} <span class="primary-marker">⌘</span>{% endif %}{% if row.paren %} <span class="anchor-paren">({{ row.paren }})</span>{% endif %} <a href="#{{ row.id }}"><span class="anchor-symbol">⚓︎</span></a></td>
|
|
211
211
|
{%- for value in row.values %}<td>{{ value }}</td>{% endfor %}
|
|
212
212
|
{%- if Table.desc %}<td>{{ row.description }}</td>{% endif %}
|
|
@@ -226,7 +226,7 @@ const templates = {
|
|
|
226
226
|
</thead>
|
|
227
227
|
<tbody>
|
|
228
228
|
{% for row in Table.rows %}
|
|
229
|
-
<tr id="{{ row.id }}"{% if row.even %} class="even"{% endif %}>
|
|
229
|
+
<tr id="{{ row.id }}"{% if row.anchor %} data-id="{{ row.anchor }}"{% endif %}{% if row.even %} class="even"{% endif %}>
|
|
230
230
|
<td><span{% if row.spec %} data-info-spec="{{ row.spec }}" data-info-path="{{ row.specpath }}"{% endif %}>{{ row.name }}</span>{% if row.primary %} <span class="primary-marker">⌘</span>{% endif %}{% if row.paren %} <span class="anchor-paren">({{ row.paren }})</span>{% endif %} <a href="#{{ row.id }}"><span class="anchor-symbol">⚓︎</span></a></td>
|
|
231
231
|
<td class="chunks">
|
|
232
232
|
<table class="chunks">
|
|
@@ -1460,6 +1460,7 @@ const renderTable = (children, maxColumns) => {
|
|
|
1460
1460
|
width: Math.round(200 / (keys.length + 3)),
|
|
1461
1461
|
rows: children.map((child, i) => scoped(child, () => ({
|
|
1462
1462
|
id: anchorOf(child),
|
|
1463
|
+
anchor: child.anchor,
|
|
1463
1464
|
paren: child.paren,
|
|
1464
1465
|
primary: child.primary,
|
|
1465
1466
|
spec: infoParents !== null ? anchorOf(child) : undefined,
|
|
@@ -1500,6 +1501,7 @@ const renderTable = (children, maxColumns) => {
|
|
|
1500
1501
|
chunks.unshift([{ key: "Diagram", desc: true, span: size, value: diagram }]);
|
|
1501
1502
|
return {
|
|
1502
1503
|
id: anchorOf(child),
|
|
1504
|
+
anchor: child.anchor,
|
|
1503
1505
|
paren: child.paren,
|
|
1504
1506
|
primary: child.primary,
|
|
1505
1507
|
spec: infoParents !== null ? anchorOf(child) : undefined,
|
|
@@ -1522,6 +1524,7 @@ const renderObject = (object, level, concise) => {
|
|
|
1522
1524
|
spec: infoParents !== null ? anchorOf(object) : undefined,
|
|
1523
1525
|
specpath: infoPathOf(object),
|
|
1524
1526
|
id: anchorOf(object),
|
|
1527
|
+
anchor: object.anchor,
|
|
1525
1528
|
paren: object.paren,
|
|
1526
1529
|
primary: object.primary,
|
|
1527
1530
|
name: inline(object.name),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rse/specbook",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.11",
|
|
4
4
|
"publishConfig": { "access": "public" },
|
|
5
5
|
"description": "Markdown-based Specification Format (API, CLI and MCP service)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
},
|
|
18
18
|
"files": [ "dst" ],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"marked": "18.0.
|
|
20
|
+
"marked": "18.0.13",
|
|
21
21
|
"marked-smartypants": "1.1.12",
|
|
22
|
-
"yaml": "2.9.
|
|
22
|
+
"yaml": "2.9.1",
|
|
23
23
|
"json5": "2.2.3",
|
|
24
24
|
"pdf-lib": "1.17.1",
|
|
25
25
|
"subset-font": "2.7.0",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"glob": "13.0.6",
|
|
41
41
|
"picomatch": "4.0.7",
|
|
42
42
|
"es-toolkit": "1.52.0",
|
|
43
|
-
"fastify": "5.12.
|
|
43
|
+
"fastify": "5.12.4",
|
|
44
44
|
"@fastify/websocket": "11.3.0",
|
|
45
45
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
46
|
-
"zod": "4.6.
|
|
46
|
+
"zod": "4.6.5"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"chokidar-cli": "3.0.0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"globals": "17.12.0",
|
|
56
56
|
"markdownlint": "0.41.1",
|
|
57
57
|
"markdownlint-cli2": "0.23.2",
|
|
58
|
-
"@types/node": "26.5.
|
|
58
|
+
"@types/node": "26.5.1",
|
|
59
59
|
"@types/picomatch": "4.0.3",
|
|
60
60
|
"@types/subset-font": "2.3.0",
|
|
61
61
|
"@types/nunjucks": "3.2.6",
|