@brett_lamy/docstream 1.18.1 → 1.19.1
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/README.md +65 -19
- package/dist/docs/DocsRenderer.d.ts.map +1 -1
- package/dist/docs/DocsRenderer.js +14 -3
- package/dist/docs/DocsRenderer.js.map +1 -1
- package/dist/gitbook/parse.js +10 -2
- package/dist/gitbook/parse.js.map +1 -1
- package/dist/openapi/OpenApiOperation.d.ts.map +1 -1
- package/dist/openapi/OpenApiOperation.js +13 -5
- package/dist/openapi/OpenApiOperation.js.map +1 -1
- package/dist/replay/ReplayStageImpl.d.ts.map +1 -1
- package/dist/replay/ReplayStageImpl.js +4 -1
- package/dist/replay/ReplayStageImpl.js.map +1 -1
- package/dist/site/DocsSite.d.ts +74 -0
- package/dist/site/DocsSite.d.ts.map +1 -0
- package/dist/site/DocsSite.js +479 -0
- package/dist/site/DocsSite.js.map +1 -0
- package/dist/site/index.d.ts +7 -0
- package/dist/site/index.d.ts.map +1 -0
- package/dist/site/index.js +5 -0
- package/dist/site/index.js.map +1 -0
- package/dist/site/search.d.ts +28 -0
- package/dist/site/search.d.ts.map +1 -0
- package/dist/site/search.js +125 -0
- package/dist/site/search.js.map +1 -0
- package/dist/site/site.css +816 -0
- package/dist/site/tree.d.ts +105 -0
- package/dist/site/tree.d.ts.map +1 -0
- package/dist/site/tree.js +411 -0
- package/dist/site/tree.js.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +8 -1
- package/src/docs/DocsRenderer.tsx +14 -3
- package/src/gitbook/parse.ts +10 -2
- package/src/openapi/OpenApiOperation.tsx +13 -5
- package/src/replay/ReplayStageImpl.tsx +4 -1
- package/src/site/DocsSite.tsx +958 -0
- package/src/site/index.ts +18 -0
- package/src/site/search.ts +138 -0
- package/src/site/site.css +816 -0
- package/src/site/tree.ts +482 -0
- package/src/styles.css +1 -0
package/src/gitbook/parse.ts
CHANGED
|
@@ -1099,6 +1099,14 @@ interface ParsedList {
|
|
|
1099
1099
|
|
|
1100
1100
|
const LIST_ITEM_RE = /^(\s*)([-*+]|\d+[.)])(\s+)(.*)$/
|
|
1101
1101
|
|
|
1102
|
+
/** Whether `marker` continues a list opened by `first`: CommonMark starts a new list when the
|
|
1103
|
+
bullet character (`-`, `*`, `+`) or the ordered delimiter (`.`, `)`) changes. */
|
|
1104
|
+
function sameListKind(first: string, marker: string): boolean {
|
|
1105
|
+
const ordered = /^\d/.test(first)
|
|
1106
|
+
if (ordered !== /^\d/.test(marker)) return false
|
|
1107
|
+
return ordered ? first.slice(-1) === marker.slice(-1) : first === marker
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1102
1110
|
// Indent-aware list parser: deeper-indented marker lines become nested lists
|
|
1103
1111
|
// inside the item (handled recursively via parseBlocks on dedented lines).
|
|
1104
1112
|
// The markers, numbering, padding, continuation indent and blank lines between items are recorded
|
|
@@ -1123,7 +1131,7 @@ function parseList(lines: string[], start: number): ParsedList {
|
|
|
1123
1131
|
|
|
1124
1132
|
while (i < lines.length) {
|
|
1125
1133
|
const m = lines[i].match(LIST_ITEM_RE)
|
|
1126
|
-
if (!m || m[1].length !== baseIndent ||
|
|
1134
|
+
if (!m || m[1].length !== baseIndent || !sameListKind(first[2], m[2])) break
|
|
1127
1135
|
|
|
1128
1136
|
let content = m[4]
|
|
1129
1137
|
let checked: boolean | undefined
|
|
@@ -1184,7 +1192,7 @@ function parseList(lines: string[], start: number): ParsedList {
|
|
|
1184
1192
|
// skip a single blank line between sibling items
|
|
1185
1193
|
if (i < lines.length && !lines[i].trim()) {
|
|
1186
1194
|
const after = lines[i + 1]?.match(/^(\s*)([-*+]|\d+[.)])\s+/)
|
|
1187
|
-
if (after && after[1].length === baseIndent &&
|
|
1195
|
+
if (after && after[1].length === baseIndent && sameListKind(first[2], after[2])) {
|
|
1188
1196
|
gap = 1
|
|
1189
1197
|
blankLine = lines[i]
|
|
1190
1198
|
i++
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from "react"
|
|
2
2
|
import { parse as parseYaml } from "yaml"
|
|
3
3
|
|
|
4
|
+
import { useAsset } from "../asset-resolver"
|
|
4
5
|
import { MarkdownContent } from "../docs/DocsRenderer"
|
|
5
6
|
import { HighlightedCode } from "../docs/HighlightedCode"
|
|
6
7
|
|
|
@@ -98,15 +99,22 @@ export function OpenApiOperation({
|
|
|
98
99
|
}) {
|
|
99
100
|
const [spec, setSpec] = useState<any>(null)
|
|
100
101
|
const [error, setError] = useState<string | null>(null)
|
|
102
|
+
// The spec link goes through the host's asset resolver like any other file the page points
|
|
103
|
+
// at, so `[api](openapi.json)` can name a file in the host's VFS. Undefined while it resolves.
|
|
104
|
+
const url = useAsset(specUrl)
|
|
101
105
|
|
|
102
106
|
useEffect(() => {
|
|
103
|
-
if (!
|
|
107
|
+
if (!url) return
|
|
108
|
+
let live = true
|
|
104
109
|
setSpec(null)
|
|
105
110
|
setError(null)
|
|
106
|
-
loadSpec(
|
|
107
|
-
.then(setSpec)
|
|
108
|
-
.catch((e) => setError(String(e.message ?? e)))
|
|
109
|
-
|
|
111
|
+
loadSpec(url)
|
|
112
|
+
.then((s) => live && setSpec(s))
|
|
113
|
+
.catch((e) => live && setError(String(e.message ?? e)))
|
|
114
|
+
return () => {
|
|
115
|
+
live = false
|
|
116
|
+
}
|
|
117
|
+
}, [url])
|
|
110
118
|
|
|
111
119
|
if (!specUrl) return <div className="oas oas-empty">Set an OpenAPI spec URL…</div>
|
|
112
120
|
if (error) return <div className="oas oas-empty">⚠︎ {error}</div>
|
|
@@ -178,7 +178,10 @@ const ReplayStageImpl = forwardRef<ReplayStageHandle, ReplayStageProps>(function
|
|
|
178
178
|
callbacks.current.onFinish?.()
|
|
179
179
|
}
|
|
180
180
|
})
|
|
181
|
-
|
|
181
|
+
// rrweb applies only events stamped before the pause point, so pausing at 0 would leave out the
|
|
182
|
+
// mutations recorded with the first snapshot (a trimmed recording stamps everything before its
|
|
183
|
+
// window there): 1ms in, the first frame is the page as recorded at the start.
|
|
184
|
+
replayer.pause(Math.max(initialTime, 1))
|
|
182
185
|
replayerRef.current = replayer
|
|
183
186
|
fedCountRef.current = prepared.length
|
|
184
187
|
let duration = meta.duration
|