@ascribed/astro 0.2.0 → 0.2.1-next.10
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 +2 -0
- package/dist/attributes.js +6 -5
- package/dist/attributes.js.map +1 -1
- package/dist/content.d.ts +1 -1
- package/dist/content.js +1 -1
- package/dist/content.js.map +1 -1
- package/dist/names.d.ts +95 -0
- package/dist/names.js +99 -0
- package/dist/names.js.map +1 -0
- package/dist/review/diff.d.ts +3 -3
- package/dist/review/diff.js +1 -0
- package/dist/review/diff.js.map +1 -1
- package/dist/review/protocol.d.ts +12 -30
- package/dist/review/protocol.js.map +1 -1
- package/dist/review/routes.d.ts +3 -0
- package/dist/review/routes.js +49 -35
- package/dist/review/routes.js.map +1 -1
- package/dist/review/server.d.ts +2 -0
- package/dist/review/server.js +14 -7
- package/dist/review/server.js.map +1 -1
- package/dist/satteri.js +2 -0
- package/dist/satteri.js.map +1 -1
- package/dist/shapes.d.ts +158 -0
- package/dist/shapes.js +8 -0
- package/dist/shapes.js.map +1 -0
- package/dist/toolbar/app.js +14 -13
- package/dist/toolbar/app.js.map +1 -1
- package/dist/toolbar/page.d.ts +3 -5
- package/dist/toolbar/page.js +7 -6
- package/dist/toolbar/page.js.map +1 -1
- package/dist/toolbar/text.d.ts +3 -3
- package/dist/toolbar/text.js.map +1 -1
- package/package.json +16 -5
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@ It runs `ascribe build --emit site` before Astro loads content, gives you a cont
|
|
|
8
8
|
npm install @ascribed/astro
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
`satteri` and `@types/hast` are optional peer dependencies: the declarations of `@ascribed/astro/satteri` and `@ascribed/astro/rehype` import types from them. Astro's default Sätteri processor brings the first, and a `unified()` processor the second, so a project that uses one of those plugins has what it needs.
|
|
12
|
+
|
|
11
13
|
```js
|
|
12
14
|
// astro.config.mjs
|
|
13
15
|
import { defineConfig } from "astro/config";
|
package/dist/attributes.js
CHANGED
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
// processor's adapter applies the edits with its own means (`rehype.ts`
|
|
12
12
|
// mutates the tree, `satteri.ts` queues commands).
|
|
13
13
|
import { find, html } from "property-information";
|
|
14
|
-
|
|
15
|
-
const
|
|
14
|
+
import { COMMENT_ANCHOR, DATA_SOURCE, DATA_VIA, ELEMENT_ATTRIBUTES } from "./names.js";
|
|
15
|
+
const OPEN = new RegExp(`^<${ELEMENT_ATTRIBUTES}((?: [a-z][a-z0-9-]*="[^"\\r\\n]*")*)>$`);
|
|
16
|
+
const CLOSE = `</${ELEMENT_ATTRIBUTES}>`;
|
|
16
17
|
const ATTRIBUTE = / ([a-z][a-z0-9-]*)="([^"]*)"/g;
|
|
17
18
|
const HEADING = /^h[1-6]$/;
|
|
18
19
|
/** Finds every marker that applies to a heading, an image, or a link in `root`. */
|
|
@@ -115,7 +116,7 @@ export function toProperty([name, value]) {
|
|
|
115
116
|
return [info.property, value.split(/\s*,\s*/)];
|
|
116
117
|
return [info.property, value];
|
|
117
118
|
}
|
|
118
|
-
const ANCHOR =
|
|
119
|
+
const ANCHOR = new RegExp(`^<!--${COMMENT_ANCHOR}((?: [a-z][a-z0-9-]*="[^"\\r\\n]*")+)-->\\s*$`);
|
|
119
120
|
/** Finds every source anchor comment in `root`, and what it applies to. */
|
|
120
121
|
export function findAnchors(root) {
|
|
121
122
|
const edits = [];
|
|
@@ -205,9 +206,9 @@ function parseAnchor(text) {
|
|
|
205
206
|
};
|
|
206
207
|
}
|
|
207
208
|
function anchorAttributes(source, via) {
|
|
208
|
-
const attributes = [[
|
|
209
|
+
const attributes = [[DATA_SOURCE, source]];
|
|
209
210
|
if (via !== undefined)
|
|
210
|
-
attributes.push([
|
|
211
|
+
attributes.push([DATA_VIA, via]);
|
|
211
212
|
return attributes;
|
|
212
213
|
}
|
|
213
214
|
/** Raw HTML with the anchor's attributes after the name of its first tag, when that tag opens the element the anchor names. */
|
package/dist/attributes.js.map
CHANGED
|
@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K,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,CACrC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAC5E,CAAC;AACJ,CAAC","sourcesContent":["// The site output's attribute marker (`<ascribe-attributes>`) and source\n// anchors (`<!--ascribe-anchor …-->`), found and applied on a hast tree.\n//\n// Both markdown processors Astro 7.3 can run hand a user plugin the same tree\n// at the same point: after markdown became hast, before Astro's own image and\n// heading-id passes. A marker is then two adjacent `raw` nodes (an open tag and\n// a close tag), and the elements it applies to are `<h1>`–`<h6>`, `<img>`,\n// and `<a>`.\n// An anchor comment is a `raw` node beside the block it names. So the rules\n// live here once, as pure functions from a tree to a list of edits, and each\n// processor's adapter applies the edits with its own means (`rehype.ts`\n// mutates the tree, `satteri.ts` queues commands).\n\nimport { find, html } from \"property-information\";\n\n/** The parts of a hast node the rules read. Both processors' trees fit it. */\nexport interface HastNode {\n type: string;\n tagName?: string;\n value?: string;\n properties?: Record<string, unknown> | undefined;\n children?: HastNode[];\n}\n\n/** A marker's attribute: a name and its decoded value. */\nexport type Attribute = readonly [name: string, value: string];\n\n/** What applying one marker changes. */\nexport interface Edit {\n /** The heading, image, or link that gets the attributes. */\n target: HastNode;\n /** The marker's attributes, in the order written. */\n attributes: Attribute[];\n /** The marker's nodes, which are removed. */\n remove: HastNode[];\n /**\n * For a heading: the text nodes directly before the marker, whose trailing\n * whitespace is removed. A node whose text becomes empty is removed\n * (`value` is `\"\"`).\n */\n trim: { node: HastNode; value: string }[];\n}\n\nconst OPEN = /^<ascribe-attributes((?: [a-z][a-z0-9-]*=\"[^\"\\r\\n]*\")*)>$/;\nconst CLOSE = \"</ascribe-attributes>\";\nconst ATTRIBUTE = / ([a-z][a-z0-9-]*)=\"([^\"]*)\"/g;\nconst HEADING = /^h[1-6]$/;\n\n/** Finds every marker that applies to a heading, an image, or a link in `root`. */\nexport function findEdits(root: HastNode): Edit[] {\n const edits: Edit[] = [];\n visitParents(root, (parent) => {\n const children = parent.children ?? [];\n const isHeading = parent.type === \"element\" && HEADING.test(parent.tagName ?? \"\");\n for (let i = 0; i < children.length; i++) {\n const found = markerAt(children, i);\n if (found === undefined) continue;\n const { attributes, length } = found;\n const last = i + length - 1;\n const marker = children.slice(i, last + 1);\n const before = children[i - 1];\n if (\n before !== undefined &&\n before.type === \"element\" &&\n (before.tagName === \"img\" || before.tagName === \"a\")\n ) {\n // Directly after an image or a link, whatever else the marker ends.\n edits.push({ target: before, attributes, remove: marker, trim: [] });\n } else if (isHeading && last === children.length - 1) {\n edits.push({\n target: parent,\n attributes,\n remove: marker,\n trim: trailingWhitespace(children, i),\n });\n }\n i = last;\n }\n });\n return edits;\n}\n\n/** The marker starting at `children[i]`: its attributes and how many nodes it spans. */\nfunction markerAt(\n children: HastNode[],\n i: number,\n): { attributes: Attribute[]; length: number } | undefined {\n const first = children[i];\n if (first?.type !== \"raw\" || first.value === undefined) return undefined;\n if (first.value.endsWith(CLOSE)) {\n // One node holding both tags.\n const open = first.value.slice(0, -CLOSE.length);\n const attributes = parseOpen(open);\n return attributes && { attributes, length: 1 };\n }\n const second = children[i + 1];\n if (second?.type !== \"raw\" || second.value !== CLOSE) return undefined;\n const attributes = parseOpen(first.value);\n return attributes && { attributes, length: 2 };\n}\n\nfunction parseOpen(tag: string): Attribute[] | undefined {\n const match = OPEN.exec(tag);\n if (match === null) return undefined;\n const attributes: Attribute[] = [];\n for (const [, name, value] of (match[1] ?? \"\").matchAll(ATTRIBUTE)) {\n if (name !== undefined && value !== undefined) attributes.push([name, decode(value)]);\n }\n return attributes;\n}\n\n/** The marker's four escapes; any other `&` is literal. */\nfunction decode(value: string): string {\n return value.replace(/&(quot|amp|lt|gt);/g, (_, name: string) =>\n name === \"quot\" ? '\"' : name === \"amp\" ? \"&\" : name === \"lt\" ? \"<\" : \">\",\n );\n}\n\n/** The spaces, tabs, and line breaks directly before `children[i]`, which a heading's marker removes. */\nfunction trailingWhitespace(children: HastNode[], i: number): Edit[\"trim\"] {\n const trim: Edit[\"trim\"] = [];\n for (let j = i - 1; j >= 0; j--) {\n const node = children[j];\n if (node?.type !== \"text\" || node.value === undefined) break;\n const value = node.value.replace(/[ \\t\\r\\n]+$/, \"\");\n if (value === node.value) break;\n trim.push({ node, value });\n if (value !== \"\") break;\n }\n return trim;\n}\n\nfunction visitParents(node: HastNode, visit: (parent: HastNode) => void): void {\n if (node.children === undefined) return;\n visit(node);\n for (const child of node.children) visitParents(child, visit);\n}\n\n/**\n * A marker attribute as a hast property: the property name hast and Astro use\n * (`class` is `className`) and a value of the shape that property has.\n */\nexport function toProperty([name, value]: Attribute): [string, string | string[]] {\n const info = find(html, name);\n if (info.spaceSeparated) return [info.property, value.split(/\\s+/).filter((s) => s !== \"\")];\n if (info.commaSeparated) return [info.property, value.split(/\\s*,\\s*/)];\n return [info.property, value];\n}\n\n/** What applying one source anchor (site-render contract §7) changes. */\nexport interface AnchorEdit {\n /** The anchor comment, and the whitespace-only text directly after it, which are removed. */\n remove: HastNode[];\n /** Elements that get attributes: the block, and a list's items. Empty when the anchor applies to nothing. */\n targets: { node: HastNode; attributes: Attribute[] }[];\n /** Raw HTML whose first tag gets the anchor's attributes: the node and its new text. */\n replace?: { node: HastNode; value: string };\n}\n\nconst ANCHOR = /^<!--ascribe-anchor((?: [a-z][a-z0-9-]*=\"[^\"\\r\\n]*\")+)-->\\s*$/;\n\n/** Finds every source anchor comment in `root`, and what it applies to. */\nexport function findAnchors(root: HastNode): AnchorEdit[] {\n const edits: AnchorEdit[] = [];\n visitParents(root, (parent) => {\n const children = parent.children ?? [];\n for (let i = 0; i < children.length; i++) {\n const node = children[i];\n if (node?.type !== \"raw\" || node.value === undefined) continue;\n const anchor = parseAnchor(node.value);\n if (anchor === undefined) continue;\n const edit: AnchorEdit = { remove: [node], targets: [] };\n let next = i + 1;\n const after = children[next];\n if (after?.type === \"text\" && after.value?.trim() === \"\") {\n edit.remove.push(after);\n next++;\n }\n const target = children[next];\n if (anchor.tag === \"pre\" && target !== undefined && isCodeTitle(target)) {\n // A titled code block, which the code-titles transformer put in a\n // figure: the anchor marks the figure, so the mark holds the caption.\n edit.targets.push({\n node: target,\n attributes: anchorAttributes(anchor.source, anchor.via),\n });\n } else if (target?.type === \"element\" && target.tagName?.toLowerCase() === anchor.tag) {\n edit.targets.push({\n node: target,\n attributes: anchorAttributes(anchor.source, anchor.via),\n });\n if ((anchor.tag === \"ul\" || anchor.tag === \"ol\") && anchor.items.length > 0) {\n const items = (target.children ?? []).filter(\n (child) => child.type === \"element\" && child.tagName === \"li\",\n );\n const path = anchor.source.slice(0, anchor.source.lastIndexOf(\":\"));\n if (items.length === anchor.items.length) {\n items.forEach((item, n) =>\n edit.targets.push({\n node: item,\n attributes: anchorAttributes(`${path}:${anchor.items[n]}`, anchor.via),\n }),\n );\n }\n }\n } else if (target?.type === \"raw\" && target.value !== undefined) {\n const value = intoFirstTag(target.value, anchor);\n if (value !== undefined) edit.replace = { node: target, value };\n }\n edits.push(edit);\n }\n });\n return edits;\n}\n\n/** Whether a node is a `<figure class=\"code-title\">` holding a `<pre>` (`code-titles.ts`). */\nfunction isCodeTitle(node: HastNode): boolean {\n if (node.type !== \"element\" || node.tagName?.toLowerCase() !== \"figure\") return false;\n const className = node.properties?.[\"className\"] ?? node.properties?.[\"class\"];\n const classes = Array.isArray(className)\n ? className.map(String)\n : typeof className === \"string\"\n ? className.split(/\\s+/)\n : [];\n return (\n classes.includes(\"code-title\") &&\n (node.children ?? []).some(\n (child) => child.type === \"element\" && child.tagName?.toLowerCase() === \"pre\",\n )\n );\n}\n\ninterface Anchor {\n tag: string;\n source: string;\n via: string | undefined;\n items: string[];\n}\n\nfunction parseAnchor(text: string): Anchor | undefined {\n const match = ANCHOR.exec(text);\n if (match === null) return undefined;\n const attributes = new Map<string, string>();\n for (const [, name, value] of (match[1] ?? \"\").matchAll(ATTRIBUTE)) {\n if (name !== undefined && value !== undefined) attributes.set(name, decode(value));\n }\n const tag = attributes.get(\"tag\");\n const source = attributes.get(\"source\");\n if (tag === undefined || source === undefined) return undefined;\n const via = attributes.get(\"via\");\n return {\n tag: tag.toLowerCase(),\n source,\n via: via === \"\" ? undefined : via,\n items: (attributes.get(\"items\") ?? \"\").split(/\\s+/).filter((s) => s !== \"\"),\n };\n}\n\nfunction anchorAttributes(source: string, via: string | undefined): Attribute[] {\n const attributes: Attribute[] = [[\"data-ascribe-source\", source]];\n if (via !== undefined) attributes.push([\"data-ascribe-via\", via]);\n return attributes;\n}\n\n/** Raw HTML with the anchor's attributes after the name of its first tag, when that tag opens the element the anchor names. */\nfunction intoFirstTag(html: string, anchor: Anchor): string | undefined {\n const open = /^<([A-Za-z][A-Za-z0-9-]*)(?=[\\s>/])/.exec(html);\n if (open?.[1] === undefined || open[1].toLowerCase() !== anchor.tag) return undefined;\n const written = anchorAttributes(anchor.source, anchor.via)\n .map(([name, value]) => ` ${name}=\"${encode(value)}\"`)\n .join(\"\");\n return html.slice(0, open[0].length) + written + html.slice(open[0].length);\n}\n\nfunction encode(value: string): string {\n return value.replace(/[&<>\"]/g, (ch) =>\n ch === \"&\" ? \"&\" : ch === \"<\" ? \"<\" : ch === \">\" ? \">\" : \""\",\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"attributes.js","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,yEAAyE;AACzE,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,gFAAgF;AAChF,2EAA2E;AAC3E,aAAa;AACb,4EAA4E;AAC5E,6EAA6E;AAC7E,wEAAwE;AACxE,mDAAmD;AAEnD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,WAAW,E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KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAC5E,CAAC;AACJ,CAAC","sourcesContent":["// The site output's attribute marker (`<ascribe-attributes>`) and source\n// anchors (`<!--ascribe-anchor …-->`), found and applied on a hast tree.\n//\n// Both markdown processors Astro 7.3 can run hand a user plugin the same tree\n// at the same point: after markdown became hast, before Astro's own image and\n// heading-id passes. A marker is then two adjacent `raw` nodes (an open tag and\n// a close tag), and the elements it applies to are `<h1>`–`<h6>`, `<img>`,\n// and `<a>`.\n// An anchor comment is a `raw` node beside the block it names. So the rules\n// live here once, as pure functions from a tree to a list of edits, and each\n// processor's adapter applies the edits with its own means (`rehype.ts`\n// mutates the tree, `satteri.ts` queues commands).\n\nimport { find, html } from \"property-information\";\nimport { COMMENT_ANCHOR, DATA_SOURCE, DATA_VIA, ELEMENT_ATTRIBUTES } from \"./names.js\";\n\n/** The parts of a hast node the rules read. Both processors' trees fit it. */\nexport interface HastNode {\n type: string;\n tagName?: string;\n value?: string;\n properties?: Record<string, unknown> | undefined;\n children?: HastNode[];\n}\n\n/** A marker's attribute: a name and its decoded value. */\nexport type Attribute = readonly [name: string, value: string];\n\n/** What applying one marker changes. */\nexport interface Edit {\n /** The heading, image, or link that gets the attributes. */\n target: HastNode;\n /** The marker's attributes, in the order written. */\n attributes: Attribute[];\n /** The marker's nodes, which are removed. */\n remove: HastNode[];\n /**\n * For a heading: the text nodes directly before the marker, whose trailing\n * whitespace is removed. A node whose text becomes empty is removed\n * (`value` is `\"\"`).\n */\n trim: { node: HastNode; value: string }[];\n}\n\nconst OPEN = new RegExp(`^<${ELEMENT_ATTRIBUTES}((?: [a-z][a-z0-9-]*=\"[^\"\\\\r\\\\n]*\")*)>$`);\nconst CLOSE = `</${ELEMENT_ATTRIBUTES}>`;\nconst ATTRIBUTE = / ([a-z][a-z0-9-]*)=\"([^\"]*)\"/g;\nconst HEADING = /^h[1-6]$/;\n\n/** Finds every marker that applies to a heading, an image, or a link in `root`. */\nexport function findEdits(root: HastNode): Edit[] {\n const edits: Edit[] = [];\n visitParents(root, (parent) => {\n const children = parent.children ?? [];\n const isHeading = parent.type === \"element\" && HEADING.test(parent.tagName ?? \"\");\n for (let i = 0; i < children.length; i++) {\n const found = markerAt(children, i);\n if (found === undefined) continue;\n const { attributes, length } = found;\n const last = i + length - 1;\n const marker = children.slice(i, last + 1);\n const before = children[i - 1];\n if (\n before !== undefined &&\n before.type === \"element\" &&\n (before.tagName === \"img\" || before.tagName === \"a\")\n ) {\n // Directly after an image or a link, whatever else the marker ends.\n edits.push({ target: before, attributes, remove: marker, trim: [] });\n } else if (isHeading && last === children.length - 1) {\n edits.push({\n target: parent,\n attributes,\n remove: marker,\n trim: trailingWhitespace(children, i),\n });\n }\n i = last;\n }\n });\n return edits;\n}\n\n/** The marker starting at `children[i]`: its attributes and how many nodes it spans. */\nfunction markerAt(\n children: HastNode[],\n i: number,\n): { attributes: Attribute[]; length: number } | undefined {\n const first = children[i];\n if (first?.type !== \"raw\" || first.value === undefined) return undefined;\n if (first.value.endsWith(CLOSE)) {\n // One node holding both tags.\n const open = first.value.slice(0, -CLOSE.length);\n const attributes = parseOpen(open);\n return attributes && { attributes, length: 1 };\n }\n const second = children[i + 1];\n if (second?.type !== \"raw\" || second.value !== CLOSE) return undefined;\n const attributes = parseOpen(first.value);\n return attributes && { attributes, length: 2 };\n}\n\nfunction parseOpen(tag: string): Attribute[] | undefined {\n const match = OPEN.exec(tag);\n if (match === null) return undefined;\n const attributes: Attribute[] = [];\n for (const [, name, value] of (match[1] ?? \"\").matchAll(ATTRIBUTE)) {\n if (name !== undefined && value !== undefined) attributes.push([name, decode(value)]);\n }\n return attributes;\n}\n\n/** The marker's four escapes; any other `&` is literal. */\nfunction decode(value: string): string {\n return value.replace(/&(quot|amp|lt|gt);/g, (_, name: string) =>\n name === \"quot\" ? '\"' : name === \"amp\" ? \"&\" : name === \"lt\" ? \"<\" : \">\",\n );\n}\n\n/** The spaces, tabs, and line breaks directly before `children[i]`, which a heading's marker removes. */\nfunction trailingWhitespace(children: HastNode[], i: number): Edit[\"trim\"] {\n const trim: Edit[\"trim\"] = [];\n for (let j = i - 1; j >= 0; j--) {\n const node = children[j];\n if (node?.type !== \"text\" || node.value === undefined) break;\n const value = node.value.replace(/[ \\t\\r\\n]+$/, \"\");\n if (value === node.value) break;\n trim.push({ node, value });\n if (value !== \"\") break;\n }\n return trim;\n}\n\nfunction visitParents(node: HastNode, visit: (parent: HastNode) => void): void {\n if (node.children === undefined) return;\n visit(node);\n for (const child of node.children) visitParents(child, visit);\n}\n\n/**\n * A marker attribute as a hast property: the property name hast and Astro use\n * (`class` is `className`) and a value of the shape that property has.\n */\nexport function toProperty([name, value]: Attribute): [string, string | string[]] {\n const info = find(html, name);\n if (info.spaceSeparated) return [info.property, value.split(/\\s+/).filter((s) => s !== \"\")];\n if (info.commaSeparated) return [info.property, value.split(/\\s*,\\s*/)];\n return [info.property, value];\n}\n\n/** What applying one source anchor (site-render contract §7) changes. */\nexport interface AnchorEdit {\n /** The anchor comment, and the whitespace-only text directly after it, which are removed. */\n remove: HastNode[];\n /** Elements that get attributes: the block, and a list's items. Empty when the anchor applies to nothing. */\n targets: { node: HastNode; attributes: Attribute[] }[];\n /** Raw HTML whose first tag gets the anchor's attributes: the node and its new text. */\n replace?: { node: HastNode; value: string };\n}\n\nconst ANCHOR = new RegExp(`^<!--${COMMENT_ANCHOR}((?: [a-z][a-z0-9-]*=\"[^\"\\\\r\\\\n]*\")+)-->\\\\s*$`);\n\n/** Finds every source anchor comment in `root`, and what it applies to. */\nexport function findAnchors(root: HastNode): AnchorEdit[] {\n const edits: AnchorEdit[] = [];\n visitParents(root, (parent) => {\n const children = parent.children ?? [];\n for (let i = 0; i < children.length; i++) {\n const node = children[i];\n if (node?.type !== \"raw\" || node.value === undefined) continue;\n const anchor = parseAnchor(node.value);\n if (anchor === undefined) continue;\n const edit: AnchorEdit = { remove: [node], targets: [] };\n let next = i + 1;\n const after = children[next];\n if (after?.type === \"text\" && after.value?.trim() === \"\") {\n edit.remove.push(after);\n next++;\n }\n const target = children[next];\n if (anchor.tag === \"pre\" && target !== undefined && isCodeTitle(target)) {\n // A titled code block, which the code-titles transformer put in a\n // figure: the anchor marks the figure, so the mark holds the caption.\n edit.targets.push({\n node: target,\n attributes: anchorAttributes(anchor.source, anchor.via),\n });\n } else if (target?.type === \"element\" && target.tagName?.toLowerCase() === anchor.tag) {\n edit.targets.push({\n node: target,\n attributes: anchorAttributes(anchor.source, anchor.via),\n });\n if ((anchor.tag === \"ul\" || anchor.tag === \"ol\") && anchor.items.length > 0) {\n const items = (target.children ?? []).filter(\n (child) => child.type === \"element\" && child.tagName === \"li\",\n );\n const path = anchor.source.slice(0, anchor.source.lastIndexOf(\":\"));\n if (items.length === anchor.items.length) {\n items.forEach((item, n) =>\n edit.targets.push({\n node: item,\n attributes: anchorAttributes(`${path}:${anchor.items[n]}`, anchor.via),\n }),\n );\n }\n }\n } else if (target?.type === \"raw\" && target.value !== undefined) {\n const value = intoFirstTag(target.value, anchor);\n if (value !== undefined) edit.replace = { node: target, value };\n }\n edits.push(edit);\n }\n });\n return edits;\n}\n\n/** Whether a node is a `<figure class=\"code-title\">` holding a `<pre>` (`code-titles.ts`). */\nfunction isCodeTitle(node: HastNode): boolean {\n if (node.type !== \"element\" || node.tagName?.toLowerCase() !== \"figure\") return false;\n const className = node.properties?.[\"className\"] ?? node.properties?.[\"class\"];\n const classes = Array.isArray(className)\n ? className.map(String)\n : typeof className === \"string\"\n ? className.split(/\\s+/)\n : [];\n return (\n classes.includes(\"code-title\") &&\n (node.children ?? []).some(\n (child) => child.type === \"element\" && child.tagName?.toLowerCase() === \"pre\",\n )\n );\n}\n\ninterface Anchor {\n tag: string;\n source: string;\n via: string | undefined;\n items: string[];\n}\n\nfunction parseAnchor(text: string): Anchor | undefined {\n const match = ANCHOR.exec(text);\n if (match === null) return undefined;\n const attributes = new Map<string, string>();\n for (const [, name, value] of (match[1] ?? \"\").matchAll(ATTRIBUTE)) {\n if (name !== undefined && value !== undefined) attributes.set(name, decode(value));\n }\n const tag = attributes.get(\"tag\");\n const source = attributes.get(\"source\");\n if (tag === undefined || source === undefined) return undefined;\n const via = attributes.get(\"via\");\n return {\n tag: tag.toLowerCase(),\n source,\n via: via === \"\" ? undefined : via,\n items: (attributes.get(\"items\") ?? \"\").split(/\\s+/).filter((s) => s !== \"\"),\n };\n}\n\nfunction anchorAttributes(source: string, via: string | undefined): Attribute[] {\n const attributes: Attribute[] = [[DATA_SOURCE, source]];\n if (via !== undefined) attributes.push([DATA_VIA, via]);\n return attributes;\n}\n\n/** Raw HTML with the anchor's attributes after the name of its first tag, when that tag opens the element the anchor names. */\nfunction intoFirstTag(html: string, anchor: Anchor): string | undefined {\n const open = /^<([A-Za-z][A-Za-z0-9-]*)(?=[\\s>/])/.exec(html);\n if (open?.[1] === undefined || open[1].toLowerCase() !== anchor.tag) return undefined;\n const written = anchorAttributes(anchor.source, anchor.via)\n .map(([name, value]) => ` ${name}=\"${encode(value)}\"`)\n .join(\"\");\n return html.slice(0, open[0].length) + written + html.slice(open[0].length);\n}\n\nfunction encode(value: string): string {\n return value.replace(/[&<>\"]/g, (ch) =>\n ch === \"&\" ? \"&\" : ch === \"<\" ? \"<\" : ch === \">\" ? \">\" : \""\",\n );\n}\n"]}
|
package/dist/content.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { glob } from "astro/loaders";
|
|
|
4
4
|
* pages, with the generated Zod schema (`_ascribe/schema.ts`'s `schema`).
|
|
5
5
|
*
|
|
6
6
|
* Entry ids are Astro's own (`guides/my-setup` for `Guides/My Setup.md`, `index`
|
|
7
|
-
* for the root page), which is what `AstroRouter` in `
|
|
7
|
+
* for the root page), which is what `AstroRouter` in `ascribe-resolve`
|
|
8
8
|
* computes, so a page's route is the base path plus its id, and the root page is
|
|
9
9
|
* at the base path itself.
|
|
10
10
|
*/
|
package/dist/content.js
CHANGED
|
@@ -15,7 +15,7 @@ import { siteRoot } from "virtual:ascribe/site";
|
|
|
15
15
|
* pages, with the generated Zod schema (`_ascribe/schema.ts`'s `schema`).
|
|
16
16
|
*
|
|
17
17
|
* Entry ids are Astro's own (`guides/my-setup` for `Guides/My Setup.md`, `index`
|
|
18
|
-
* for the root page), which is what `AstroRouter` in `
|
|
18
|
+
* for the root page), which is what `AstroRouter` in `ascribe-resolve`
|
|
19
19
|
* computes, so a page's route is the base path plus its id, and the root page is
|
|
20
20
|
* at the base path itself.
|
|
21
21
|
*/
|
package/dist/content.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","sourceRoot":"","sources":["../src/content.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,6EAA6E;AAC7E,2EAA2E;AAC3E,EAAE;AACF,sDAAsD;AACtD,iEAAiE;AACjE,6EAA6E;AAC7E,0FAA0F;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAI,OAAsB;IAIzD,iEAAiE;IACjE,MAAM,IAAI,GAAG,aAAa,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAChD,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;AAClG,CAAC","sourcesContent":["// The content collection over a build's site output. Import it from\n// `content.config.ts`, which Vite loads, so it can read what the integration\n// resolved (`virtual:ascribe/site`) instead of finding the project itself.\n//\n// import { defineCollection } from \"astro:content\";\n// import { ascribeCollection } from \"@ascribed/astro/content\";\n// import { schema } from \"../.ascribe/build/site/site/_ascribe/schema.ts\";\n// export const collections = { docs: defineCollection(ascribeCollection({ schema })) };\nimport { pathToFileURL } from \"node:url\";\nimport path from \"node:path\";\nimport { glob } from \"astro/loaders\";\nimport { siteRoot } from \"virtual:ascribe/site\";\n\n/**\n * The collection's loader and schema: the `glob` loader on the site output's\n * pages, with the generated Zod schema (`_ascribe/schema.ts`'s `schema`).\n *\n * Entry ids are Astro's own (`guides/my-setup` for `Guides/My Setup.md`, `index`\n * for the root page), which is what `AstroRouter` in `
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../src/content.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,6EAA6E;AAC7E,2EAA2E;AAC3E,EAAE;AACF,sDAAsD;AACtD,iEAAiE;AACjE,6EAA6E;AAC7E,0FAA0F;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAI,OAAsB;IAIzD,iEAAiE;IACjE,MAAM,IAAI,GAAG,aAAa,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAChD,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;AAClG,CAAC","sourcesContent":["// The content collection over a build's site output. Import it from\n// `content.config.ts`, which Vite loads, so it can read what the integration\n// resolved (`virtual:ascribe/site`) instead of finding the project itself.\n//\n// import { defineCollection } from \"astro:content\";\n// import { ascribeCollection } from \"@ascribed/astro/content\";\n// import { schema } from \"../.ascribe/build/site/site/_ascribe/schema.ts\";\n// export const collections = { docs: defineCollection(ascribeCollection({ schema })) };\nimport { pathToFileURL } from \"node:url\";\nimport path from \"node:path\";\nimport { glob } from \"astro/loaders\";\nimport { siteRoot } from \"virtual:ascribe/site\";\n\n/**\n * The collection's loader and schema: the `glob` loader on the site output's\n * pages, with the generated Zod schema (`_ascribe/schema.ts`'s `schema`).\n *\n * Entry ids are Astro's own (`guides/my-setup` for `Guides/My Setup.md`, `index`\n * for the root page), which is what `AstroRouter` in `ascribe-resolve`\n * computes, so a page's route is the base path plus its id, and the root page is\n * at the base path itself.\n */\nexport function ascribeCollection<S>(options: { schema: S }): {\n loader: ReturnType<typeof glob>;\n schema: S;\n} {\n // `_ascribe/` holds the schema and published files, never pages.\n const base = pathToFileURL(siteRoot + path.sep);\n return { loader: glob({ pattern: [\"**/*.md\", \"!_ascribe/**\"], base }), schema: options.schema };\n}\n"]}
|
package/dist/names.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/** `<ascribe-note>`: a note (packages/elements/CONTRACT.md §1). */
|
|
2
|
+
export declare const ELEMENT_NOTE = "ascribe-note";
|
|
3
|
+
/** `<ascribe-steps>`: a procedure (packages/elements/CONTRACT.md §2). */
|
|
4
|
+
export declare const ELEMENT_STEPS = "ascribe-steps";
|
|
5
|
+
/** `<ascribe-tabs>`: a variant group of several arms (packages/elements/CONTRACT.md §3). */
|
|
6
|
+
export declare const ELEMENT_TABS = "ascribe-tabs";
|
|
7
|
+
/** `<ascribe-tab>`: one arm of `<ascribe-tabs>` (packages/elements/CONTRACT.md §3). */
|
|
8
|
+
export declare const ELEMENT_TAB = "ascribe-tab";
|
|
9
|
+
/** `<ascribe-availability>`: a badge or filter (packages/elements/CONTRACT.md §4). */
|
|
10
|
+
export declare const ELEMENT_AVAILABILITY = "ascribe-availability";
|
|
11
|
+
/**
|
|
12
|
+
* `<ascribe-availability-target>`: one target of `<ascribe-availability>`
|
|
13
|
+
* (packages/elements/CONTRACT.md §4).
|
|
14
|
+
*/
|
|
15
|
+
export declare const ELEMENT_AVAILABILITY_TARGET = "ascribe-availability-target";
|
|
16
|
+
/** `<ascribe-group>`: a project widget's group (packages/elements/CONTRACT.md §6). */
|
|
17
|
+
export declare const ELEMENT_GROUP = "ascribe-group";
|
|
18
|
+
/** `<ascribe-attributes>`: the attribute marker (site-render contract §1). */
|
|
19
|
+
export declare const ELEMENT_ATTRIBUTES = "ascribe-attributes";
|
|
20
|
+
/** The name an anchor comment starts with, `<!--ascribe-anchor` (site-render contract §7.3). */
|
|
21
|
+
export declare const COMMENT_ANCHOR = "ascribe-anchor";
|
|
22
|
+
/** A block's source anchor (site-render contract §7.1). */
|
|
23
|
+
export declare const DATA_SOURCE = "data-ascribe-source";
|
|
24
|
+
/** The includes a block came through (site-render contract §7.1). */
|
|
25
|
+
export declare const DATA_VIA = "data-ascribe-via";
|
|
26
|
+
/** A glossary term's id, on its link (packages/elements/CONTRACT.md §7). */
|
|
27
|
+
export declare const DATA_TERM = "data-ascribe-term";
|
|
28
|
+
/** The element the report draws into. */
|
|
29
|
+
export declare const ID_REPORT = "ascribe-review";
|
|
30
|
+
/** The `<script type="application/json">` holding the report's data. */
|
|
31
|
+
export declare const ID_REPORT_DATA = "ascribe-review-data";
|
|
32
|
+
/**
|
|
33
|
+
* The page's light or dark scheme, `light` or `dark`, on the root
|
|
34
|
+
* element (docs/content/guides/astro.md).
|
|
35
|
+
*/
|
|
36
|
+
export declare const DATA_SCHEME = "data-ascribe-scheme";
|
|
37
|
+
/** On a marked page's root: what it shows, `changes`, `will`, or `was`. */
|
|
38
|
+
export declare const DATA_SHOW = "data-ascribe-show";
|
|
39
|
+
/**
|
|
40
|
+
* On a marked block: its change, `added`, `changed`, `removed`, `moved`,
|
|
41
|
+
* or `moved-from`.
|
|
42
|
+
*/
|
|
43
|
+
export declare const DATA_CHANGE = "data-ascribe-change";
|
|
44
|
+
/** On every element review adds to the page, so it can be taken away again. */
|
|
45
|
+
export declare const DATA_UI = "data-ascribe-ui";
|
|
46
|
+
/** On a change's label: the change. */
|
|
47
|
+
export declare const DATA_LABEL = "data-ascribe-label";
|
|
48
|
+
/** On a tab's hint: `added` or `changed`. */
|
|
49
|
+
export declare const DATA_HINT = "data-ascribe-hint";
|
|
50
|
+
/** On a moved block: the id its "moved from" link points at. */
|
|
51
|
+
export declare const DATA_MOVE = "data-ascribe-move";
|
|
52
|
+
/** On a changed block whose copy as it was follows it. */
|
|
53
|
+
export declare const DATA_HAS_WAS = "data-ascribe-has-was";
|
|
54
|
+
/** On a copy of a block as it was, shown only with the page as it was. */
|
|
55
|
+
export declare const DATA_WAS_ONLY = "data-ascribe-was-only";
|
|
56
|
+
/** On a changed, removed, or moved block: its source anchor as it was. */
|
|
57
|
+
export declare const DATA_WAS_SOURCE = "data-ascribe-was-source";
|
|
58
|
+
/** On the elements that hold the threads' overlay. */
|
|
59
|
+
export declare const DATA_OVERLAY = "data-ascribe-overlay";
|
|
60
|
+
/** On the style element the Astro dev toolbar adds for the marks. */
|
|
61
|
+
export declare const DATA_REVIEW = "data-ascribe-review";
|
|
62
|
+
/** On the root of a page whose changes are marked. */
|
|
63
|
+
export declare const CLASS_MARKS = "ascribe-marks";
|
|
64
|
+
/** A change's label. */
|
|
65
|
+
export declare const CLASS_LABEL = "ascribe-label";
|
|
66
|
+
/** A label placed before its block rather than over it. */
|
|
67
|
+
export declare const CLASS_LABEL_BEFORE = "ascribe-label-before";
|
|
68
|
+
/** Inserted text. */
|
|
69
|
+
export declare const CLASS_INS = "ascribe-ins";
|
|
70
|
+
/** Deleted text. */
|
|
71
|
+
export declare const CLASS_DEL = "ascribe-del";
|
|
72
|
+
/** A removed block. */
|
|
73
|
+
export declare const CLASS_REMOVED = "ascribe-removed";
|
|
74
|
+
/** A removed block's content. */
|
|
75
|
+
export declare const CLASS_REMOVED_BODY = "ascribe-removed-body";
|
|
76
|
+
/** The button that shows or collapses a removed block. */
|
|
77
|
+
export declare const CLASS_TOGGLE = "ascribe-toggle";
|
|
78
|
+
/** On a removed block that's shown. */
|
|
79
|
+
export declare const CLASS_OPEN = "ascribe-open";
|
|
80
|
+
/** What stands where a moved block was. */
|
|
81
|
+
export declare const CLASS_MOVED_FROM = "ascribe-moved-from";
|
|
82
|
+
/** The note with a moved block's link. */
|
|
83
|
+
export declare const CLASS_MOVE_NOTE = "ascribe-move-note";
|
|
84
|
+
/** A move note after its block, not inside it. */
|
|
85
|
+
export declare const CLASS_MOVE_AFTER = "ascribe-move-after";
|
|
86
|
+
/** The link between a moved block and where it was. */
|
|
87
|
+
export declare const CLASS_MOVE_LINK = "ascribe-move-link";
|
|
88
|
+
/** A moved block's copy as it was, where it was. */
|
|
89
|
+
export declare const CLASS_WAS_COPY = "ascribe-was-copy";
|
|
90
|
+
/** A tab's hint that it holds changes. */
|
|
91
|
+
export declare const CLASS_HINT = "ascribe-hint";
|
|
92
|
+
/** A block flashed after going to it. */
|
|
93
|
+
export declare const CLASS_FLASH = "ascribe-flash";
|
|
94
|
+
/** The tip that shows a block's source on hover and focus. */
|
|
95
|
+
export declare const CLASS_WHERE = "ascribe-where";
|
package/dist/names.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// The names Ascribe puts on a page: elements, attributes, classes, and ids.
|
|
2
|
+
// Generated from crates/ascribe-core/src/names.rs by
|
|
3
|
+
// `ASCRIBE_BLESS=1 cargo test -p ascribe-core --test names`. Don't edit it.
|
|
4
|
+
/** `<ascribe-note>`: a note (packages/elements/CONTRACT.md §1). */
|
|
5
|
+
export const ELEMENT_NOTE = "ascribe-note";
|
|
6
|
+
/** `<ascribe-steps>`: a procedure (packages/elements/CONTRACT.md §2). */
|
|
7
|
+
export const ELEMENT_STEPS = "ascribe-steps";
|
|
8
|
+
/** `<ascribe-tabs>`: a variant group of several arms (packages/elements/CONTRACT.md §3). */
|
|
9
|
+
export const ELEMENT_TABS = "ascribe-tabs";
|
|
10
|
+
/** `<ascribe-tab>`: one arm of `<ascribe-tabs>` (packages/elements/CONTRACT.md §3). */
|
|
11
|
+
export const ELEMENT_TAB = "ascribe-tab";
|
|
12
|
+
/** `<ascribe-availability>`: a badge or filter (packages/elements/CONTRACT.md §4). */
|
|
13
|
+
export const ELEMENT_AVAILABILITY = "ascribe-availability";
|
|
14
|
+
/**
|
|
15
|
+
* `<ascribe-availability-target>`: one target of `<ascribe-availability>`
|
|
16
|
+
* (packages/elements/CONTRACT.md §4).
|
|
17
|
+
*/
|
|
18
|
+
export const ELEMENT_AVAILABILITY_TARGET = "ascribe-availability-target";
|
|
19
|
+
/** `<ascribe-group>`: a project widget's group (packages/elements/CONTRACT.md §6). */
|
|
20
|
+
export const ELEMENT_GROUP = "ascribe-group";
|
|
21
|
+
/** `<ascribe-attributes>`: the attribute marker (site-render contract §1). */
|
|
22
|
+
export const ELEMENT_ATTRIBUTES = "ascribe-attributes";
|
|
23
|
+
/** The name an anchor comment starts with, `<!--ascribe-anchor` (site-render contract §7.3). */
|
|
24
|
+
export const COMMENT_ANCHOR = "ascribe-anchor";
|
|
25
|
+
/** A block's source anchor (site-render contract §7.1). */
|
|
26
|
+
export const DATA_SOURCE = "data-ascribe-source";
|
|
27
|
+
/** The includes a block came through (site-render contract §7.1). */
|
|
28
|
+
export const DATA_VIA = "data-ascribe-via";
|
|
29
|
+
/** A glossary term's id, on its link (packages/elements/CONTRACT.md §7). */
|
|
30
|
+
export const DATA_TERM = "data-ascribe-term";
|
|
31
|
+
/** The element the report draws into. */
|
|
32
|
+
export const ID_REPORT = "ascribe-review";
|
|
33
|
+
/** The `<script type="application/json">` holding the report's data. */
|
|
34
|
+
export const ID_REPORT_DATA = "ascribe-review-data";
|
|
35
|
+
/**
|
|
36
|
+
* The page's light or dark scheme, `light` or `dark`, on the root
|
|
37
|
+
* element (docs/content/guides/astro.md).
|
|
38
|
+
*/
|
|
39
|
+
export const DATA_SCHEME = "data-ascribe-scheme";
|
|
40
|
+
/** On a marked page's root: what it shows, `changes`, `will`, or `was`. */
|
|
41
|
+
export const DATA_SHOW = "data-ascribe-show";
|
|
42
|
+
/**
|
|
43
|
+
* On a marked block: its change, `added`, `changed`, `removed`, `moved`,
|
|
44
|
+
* or `moved-from`.
|
|
45
|
+
*/
|
|
46
|
+
export const DATA_CHANGE = "data-ascribe-change";
|
|
47
|
+
/** On every element review adds to the page, so it can be taken away again. */
|
|
48
|
+
export const DATA_UI = "data-ascribe-ui";
|
|
49
|
+
/** On a change's label: the change. */
|
|
50
|
+
export const DATA_LABEL = "data-ascribe-label";
|
|
51
|
+
/** On a tab's hint: `added` or `changed`. */
|
|
52
|
+
export const DATA_HINT = "data-ascribe-hint";
|
|
53
|
+
/** On a moved block: the id its "moved from" link points at. */
|
|
54
|
+
export const DATA_MOVE = "data-ascribe-move";
|
|
55
|
+
/** On a changed block whose copy as it was follows it. */
|
|
56
|
+
export const DATA_HAS_WAS = "data-ascribe-has-was";
|
|
57
|
+
/** On a copy of a block as it was, shown only with the page as it was. */
|
|
58
|
+
export const DATA_WAS_ONLY = "data-ascribe-was-only";
|
|
59
|
+
/** On a changed, removed, or moved block: its source anchor as it was. */
|
|
60
|
+
export const DATA_WAS_SOURCE = "data-ascribe-was-source";
|
|
61
|
+
/** On the elements that hold the threads' overlay. */
|
|
62
|
+
export const DATA_OVERLAY = "data-ascribe-overlay";
|
|
63
|
+
/** On the style element the Astro dev toolbar adds for the marks. */
|
|
64
|
+
export const DATA_REVIEW = "data-ascribe-review";
|
|
65
|
+
/** On the root of a page whose changes are marked. */
|
|
66
|
+
export const CLASS_MARKS = "ascribe-marks";
|
|
67
|
+
/** A change's label. */
|
|
68
|
+
export const CLASS_LABEL = "ascribe-label";
|
|
69
|
+
/** A label placed before its block rather than over it. */
|
|
70
|
+
export const CLASS_LABEL_BEFORE = "ascribe-label-before";
|
|
71
|
+
/** Inserted text. */
|
|
72
|
+
export const CLASS_INS = "ascribe-ins";
|
|
73
|
+
/** Deleted text. */
|
|
74
|
+
export const CLASS_DEL = "ascribe-del";
|
|
75
|
+
/** A removed block. */
|
|
76
|
+
export const CLASS_REMOVED = "ascribe-removed";
|
|
77
|
+
/** A removed block's content. */
|
|
78
|
+
export const CLASS_REMOVED_BODY = "ascribe-removed-body";
|
|
79
|
+
/** The button that shows or collapses a removed block. */
|
|
80
|
+
export const CLASS_TOGGLE = "ascribe-toggle";
|
|
81
|
+
/** On a removed block that's shown. */
|
|
82
|
+
export const CLASS_OPEN = "ascribe-open";
|
|
83
|
+
/** What stands where a moved block was. */
|
|
84
|
+
export const CLASS_MOVED_FROM = "ascribe-moved-from";
|
|
85
|
+
/** The note with a moved block's link. */
|
|
86
|
+
export const CLASS_MOVE_NOTE = "ascribe-move-note";
|
|
87
|
+
/** A move note after its block, not inside it. */
|
|
88
|
+
export const CLASS_MOVE_AFTER = "ascribe-move-after";
|
|
89
|
+
/** The link between a moved block and where it was. */
|
|
90
|
+
export const CLASS_MOVE_LINK = "ascribe-move-link";
|
|
91
|
+
/** A moved block's copy as it was, where it was. */
|
|
92
|
+
export const CLASS_WAS_COPY = "ascribe-was-copy";
|
|
93
|
+
/** A tab's hint that it holds changes. */
|
|
94
|
+
export const CLASS_HINT = "ascribe-hint";
|
|
95
|
+
/** A block flashed after going to it. */
|
|
96
|
+
export const CLASS_FLASH = "ascribe-flash";
|
|
97
|
+
/** The tip that shows a block's source on hover and focus. */
|
|
98
|
+
export const CLASS_WHERE = "ascribe-where";
|
|
99
|
+
//# sourceMappingURL=names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.js","sourceRoot":"","sources":["../src/names.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,qDAAqD;AACrD,4EAA4E;AAE5E,mEAAmE;AACnE,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAE3C,yEAAyE;AACzE,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;AAE7C,4FAA4F;AAC5F,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAE3C,uFAAuF;AACvF,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,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;AAEzC,yCAAyC;AACzC,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC;AAE3C,8DAA8D;AAC9D,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC","sourcesContent":["// The names Ascribe puts on a page: elements, attributes, classes, and ids.\n// Generated from crates/ascribe-core/src/names.rs by\n// `ASCRIBE_BLESS=1 cargo test -p ascribe-core --test names`. Don't edit it.\n\n/** `<ascribe-note>`: a note (packages/elements/CONTRACT.md §1). */\nexport const ELEMENT_NOTE = \"ascribe-note\";\n\n/** `<ascribe-steps>`: a procedure (packages/elements/CONTRACT.md §2). */\nexport const ELEMENT_STEPS = \"ascribe-steps\";\n\n/** `<ascribe-tabs>`: a variant group of several arms (packages/elements/CONTRACT.md §3). */\nexport const ELEMENT_TABS = \"ascribe-tabs\";\n\n/** `<ascribe-tab>`: one arm of `<ascribe-tabs>` (packages/elements/CONTRACT.md §3). */\nexport const ELEMENT_TAB = \"ascribe-tab\";\n\n/** `<ascribe-availability>`: a badge or filter (packages/elements/CONTRACT.md §4). */\nexport const ELEMENT_AVAILABILITY = \"ascribe-availability\";\n\n/**\n * `<ascribe-availability-target>`: one target of `<ascribe-availability>`\n * (packages/elements/CONTRACT.md §4).\n */\nexport const ELEMENT_AVAILABILITY_TARGET = \"ascribe-availability-target\";\n\n/** `<ascribe-group>`: a project widget's group (packages/elements/CONTRACT.md §6). */\nexport const ELEMENT_GROUP = \"ascribe-group\";\n\n/** `<ascribe-attributes>`: the attribute marker (site-render contract §1). */\nexport const ELEMENT_ATTRIBUTES = \"ascribe-attributes\";\n\n/** The name an anchor comment starts with, `<!--ascribe-anchor` (site-render contract §7.3). */\nexport const COMMENT_ANCHOR = \"ascribe-anchor\";\n\n/** A block's source anchor (site-render contract §7.1). */\nexport const DATA_SOURCE = \"data-ascribe-source\";\n\n/** The includes a block came through (site-render contract §7.1). */\nexport const DATA_VIA = \"data-ascribe-via\";\n\n/** A glossary term's id, on its link (packages/elements/CONTRACT.md §7). */\nexport const DATA_TERM = \"data-ascribe-term\";\n\n/** The element the report draws into. */\nexport const ID_REPORT = \"ascribe-review\";\n\n/** The `<script type=\"application/json\">` holding the report's data. */\nexport const ID_REPORT_DATA = \"ascribe-review-data\";\n\n/**\n * The page's light or dark scheme, `light` or `dark`, on the root\n * element (docs/content/guides/astro.md).\n */\nexport const DATA_SCHEME = \"data-ascribe-scheme\";\n\n/** On a marked page's root: what it shows, `changes`, `will`, or `was`. */\nexport const DATA_SHOW = \"data-ascribe-show\";\n\n/**\n * On a marked block: its change, `added`, `changed`, `removed`, `moved`,\n * or `moved-from`.\n */\nexport const DATA_CHANGE = \"data-ascribe-change\";\n\n/** On every element review adds to the page, so it can be taken away again. */\nexport const DATA_UI = \"data-ascribe-ui\";\n\n/** On a change's label: the change. */\nexport const DATA_LABEL = \"data-ascribe-label\";\n\n/** On a tab's hint: `added` or `changed`. */\nexport const DATA_HINT = \"data-ascribe-hint\";\n\n/** On a moved block: the id its \"moved from\" link points at. */\nexport const DATA_MOVE = \"data-ascribe-move\";\n\n/** On a changed block whose copy as it was follows it. */\nexport const DATA_HAS_WAS = \"data-ascribe-has-was\";\n\n/** On a copy of a block as it was, shown only with the page as it was. */\nexport const DATA_WAS_ONLY = \"data-ascribe-was-only\";\n\n/** On a changed, removed, or moved block: its source anchor as it was. */\nexport const DATA_WAS_SOURCE = \"data-ascribe-was-source\";\n\n/** On the elements that hold the threads' overlay. */\nexport const DATA_OVERLAY = \"data-ascribe-overlay\";\n\n/** On the style element the Astro dev toolbar adds for the marks. */\nexport const DATA_REVIEW = \"data-ascribe-review\";\n\n/** On the root of a page whose changes are marked. */\nexport const CLASS_MARKS = \"ascribe-marks\";\n\n/** A change's label. */\nexport const CLASS_LABEL = \"ascribe-label\";\n\n/** A label placed before its block rather than over it. */\nexport const CLASS_LABEL_BEFORE = \"ascribe-label-before\";\n\n/** Inserted text. */\nexport const CLASS_INS = \"ascribe-ins\";\n\n/** Deleted text. */\nexport const CLASS_DEL = \"ascribe-del\";\n\n/** A removed block. */\nexport const CLASS_REMOVED = \"ascribe-removed\";\n\n/** A removed block's content. */\nexport const CLASS_REMOVED_BODY = \"ascribe-removed-body\";\n\n/** The button that shows or collapses a removed block. */\nexport const CLASS_TOGGLE = \"ascribe-toggle\";\n\n/** On a removed block that's shown. */\nexport const CLASS_OPEN = \"ascribe-open\";\n\n/** What stands where a moved block was. */\nexport const CLASS_MOVED_FROM = \"ascribe-moved-from\";\n\n/** The note with a moved block's link. */\nexport const CLASS_MOVE_NOTE = \"ascribe-move-note\";\n\n/** A move note after its block, not inside it. */\nexport const CLASS_MOVE_AFTER = \"ascribe-move-after\";\n\n/** The link between a moved block and where it was. */\nexport const CLASS_MOVE_LINK = \"ascribe-move-link\";\n\n/** A moved block's copy as it was, where it was. */\nexport const CLASS_WAS_COPY = \"ascribe-was-copy\";\n\n/** A tab's hint that it holds changes. */\nexport const CLASS_HINT = \"ascribe-hint\";\n\n/** A block flashed after going to it. */\nexport const CLASS_FLASH = \"ascribe-flash\";\n\n/** The tip that shows a block's source on hover and focus. */\nexport const CLASS_WHERE = \"ascribe-where\";\n"]}
|
package/dist/review/diff.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BaseInfo, PageDiff } from "./protocol.js";
|
|
2
2
|
/** One build's changes against a base. */
|
|
3
3
|
export interface DiffResult {
|
|
4
|
-
base:
|
|
5
|
-
pages:
|
|
4
|
+
base: BaseInfo;
|
|
5
|
+
pages: PageDiff[];
|
|
6
6
|
/** How many errors `ascribe check` finds in the working tree for the build. */
|
|
7
7
|
errors: number;
|
|
8
8
|
}
|
package/dist/review/diff.js
CHANGED
|
@@ -36,6 +36,7 @@ export function runDiff(options) {
|
|
|
36
36
|
}
|
|
37
37
|
/** The build's part of `ascribe diff --format json`'s output. */
|
|
38
38
|
export function parseDiff(json, build) {
|
|
39
|
+
// Checked as far as telling a diff report from other JSON.
|
|
39
40
|
const report = JSON.parse(json);
|
|
40
41
|
if (report.base === undefined || !Array.isArray(report.builds)) {
|
|
41
42
|
throw new Error("not a diff report");
|
package/dist/review/diff.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/review/diff.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/review/diff.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAY9C;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,OAMvB;IACC,MAAM,IAAI,GAAG;QACX,MAAM;QACN,UAAU;QACV,MAAM;QACN,SAAS;QACT,OAAO,CAAC,KAAK;QACb,UAAU;QACV,OAAO,CAAC,UAAU;QAClB,SAAS;QACT,OAAO;KACR,CAAC;IACF,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS;QAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,QAAQ,CACN,OAAO,CAAC,MAAM,EACd,IAAI,EACJ,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,EACrE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACxB,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBACnB,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC7B,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;gBAC5E,OAAO;YACT,CAAC;YACD,IAAI,CAAC;gBACH,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YAC5C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,IAAI,KAAK,CAAC,kDAAkD,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YACnF,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,2DAA2D;IAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAwB,CAAC;IACvD,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/D,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;IACxE,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,mBAAmB,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/F,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC9C,CAAC","sourcesContent":["// Running `ascribe diff --format json` for the integration's build.\nimport { execFile } from \"node:child_process\";\nimport type { DiffReport } from \"../shapes.js\";\nimport type { BaseInfo, PageDiff } from \"./protocol.js\";\n\n/** One build's changes against a base. */\nexport interface DiffResult {\n base: BaseInfo;\n pages: PageDiff[];\n /** How many errors `ascribe check` finds in the working tree for the build. */\n errors: number;\n}\n\n/**\n * Compares the build's pages with `base` (the default branch when it's\n * `undefined`). Rejects with `ascribe diff`'s reason as the message.\n */\nexport function runDiff(options: {\n binary: string;\n configPath: string;\n build: string;\n cwd: string;\n base: string | undefined;\n}): Promise<DiffResult> {\n const args = [\n \"diff\",\n \"--format\",\n \"json\",\n \"--build\",\n options.build,\n \"--config\",\n options.configPath,\n \"--color\",\n \"never\",\n ];\n if (options.base !== undefined) args.push(\"--base\", options.base);\n return new Promise((resolve, reject) => {\n execFile(\n options.binary,\n args,\n { cwd: options.cwd, maxBuffer: 256 * 1024 * 1024, windowsHide: true },\n (error, stdout, stderr) => {\n if (error !== null) {\n const reason = stderr.trim();\n reject(new Error(reason === \"\" ? error.message : reason, { cause: error }));\n return;\n }\n try {\n resolve(parseDiff(stdout, options.build));\n } catch (cause) {\n reject(new Error(\"`ascribe diff` wrote output that isn't its JSON.\", { cause }));\n }\n },\n );\n });\n}\n\n/** The build's part of `ascribe diff --format json`'s output. */\nexport function parseDiff(json: string, build: string): DiffResult {\n // Checked as far as telling a diff report from other JSON.\n const report = JSON.parse(json) as Partial<DiffReport>;\n if (report.base === undefined || !Array.isArray(report.builds)) {\n throw new Error(\"not a diff report\");\n }\n const pages = report.builds.find((b) => b.build === build)?.pages ?? [];\n const errors = typeof report.working_tree_errors === \"number\" ? report.working_tree_errors : 0;\n return { base: report.base, pages, errors };\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { BaseInfo, PageDiff } from "../shapes.js";
|
|
2
|
+
import type { FormattedPiece } from "@ascribed/review/overlay";
|
|
3
|
+
/** `ascribe diff --format json`'s types: a changed page, its block changes, and the base. */
|
|
4
|
+
export type { BaseInfo, Change, Counts, PageDiff } from "../shapes.js";
|
|
4
5
|
/** The toolbar app's id, also the prefix of its events. */
|
|
5
6
|
export declare const APP_ID = "ascribe:review";
|
|
6
7
|
export declare const REQUEST_EVENT = "ascribe:review:request";
|
|
@@ -22,33 +23,14 @@ export interface Result {
|
|
|
22
23
|
code?: string;
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
/** A changed page, as `ascribe diff --format json` lists it. */
|
|
32
|
-
export interface DiffPage {
|
|
33
|
-
path: string;
|
|
34
|
-
route: string;
|
|
35
|
-
status: "added" | "removed" | "changed";
|
|
36
|
-
own_file_changed: boolean;
|
|
37
|
-
because: string[];
|
|
38
|
-
page_changed: string[];
|
|
39
|
-
counts: Counts;
|
|
40
|
-
changes: Change[];
|
|
41
|
-
}
|
|
42
|
-
/** A changed page in the list: without its changes, and with its title when the build has it. */
|
|
43
|
-
export type ChangedPage = Omit<DiffPage, "changes"> & {
|
|
26
|
+
/**
|
|
27
|
+
* A changed page in the list: without its changes, and with its title when
|
|
28
|
+
* the build has it, formatted when its field sets `inline = "code"`.
|
|
29
|
+
*/
|
|
30
|
+
export type ChangedPage = Omit<PageDiff, "changes"> & {
|
|
44
31
|
title: string | null;
|
|
32
|
+
formatted_title: FormattedPiece[] | null;
|
|
45
33
|
};
|
|
46
|
-
/** The base compared with, as `ascribe diff` reports it. */
|
|
47
|
-
export interface DiffBase {
|
|
48
|
-
requested: string;
|
|
49
|
-
commit: string;
|
|
50
|
-
merge_base: string | null;
|
|
51
|
-
}
|
|
52
34
|
/** How the checkout's `HEAD` relates to the pull request's head commit. */
|
|
53
35
|
export type LocalState = "same" | "behind" | "ahead" | "diverged" | "missing";
|
|
54
36
|
/** The review threads: on, or why not, with a sentence to show. */
|
|
@@ -81,8 +63,8 @@ export interface PageView {
|
|
|
81
63
|
/** The page's content path; `null` for a route that isn't one. */
|
|
82
64
|
path: string | null;
|
|
83
65
|
/** The page's changes; `null` when it didn't change. */
|
|
84
|
-
page:
|
|
85
|
-
base:
|
|
66
|
+
page: PageDiff | null;
|
|
67
|
+
base: BaseInfo | null;
|
|
86
68
|
/** Why the changes couldn't be read, when they couldn't. */
|
|
87
69
|
problem: string | null;
|
|
88
70
|
/** How many errors `ascribe check` finds in the working tree for the build. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/review/protocol.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,wEAAwE;AACxE,EAAE;AACF,8EAA8E;AAC9E,yEAAyE;AACzE,8EAA8E;AAC9E,wEAAwE;AACxE,mCAAmC;
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/review/protocol.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,wEAAwE;AACxE,EAAE;AACF,8EAA8E;AAC9E,yEAAyE;AACzE,8EAA8E;AAC9E,wEAAwE;AACxE,mCAAmC;AAQnC,2DAA2D;AAC3D,MAAM,CAAC,MAAM,MAAM,GAAG,gBAAgB,CAAC;AACvC,MAAM,CAAC,MAAM,aAAa,GAAG,wBAAwB,CAAC;AACtD,MAAM,CAAC,MAAM,YAAY,GAAG,uBAAuB,CAAC;AACpD,MAAM,CAAC,MAAM,aAAa,GAAG,wBAAwB,CAAC","sourcesContent":["// The messages between the toolbar app (in the page) and the dev server,\n// over Astro's dev toolbar channel. Types only: both sides import them.\n//\n// The page sends `ascribe:review:request` with `{ tab, id, method, params }`;\n// the server answers that page with `ascribe:review:result` and the same\n// `tab` and `id`. When a page's request changes the threads, or review stops,\n// the server tells every page with `ascribe:review:changed`, naming the\n// `from` tab, which already knows.\n\nimport type { BaseInfo, PageDiff } from \"../shapes.js\";\nimport type { FormattedPiece } from \"@ascribed/review/overlay\";\n\n/** `ascribe diff --format json`'s types: a changed page, its block changes, and the base. */\nexport type { BaseInfo, Change, Counts, PageDiff } from \"../shapes.js\";\n\n/** The toolbar app's id, also the prefix of its events. */\nexport const APP_ID = \"ascribe:review\";\nexport const REQUEST_EVENT = \"ascribe:review:request\";\nexport const RESULT_EVENT = \"ascribe:review:result\";\nexport const CHANGED_EVENT = \"ascribe:review:changed\";\n\nexport interface Request {\n /** The page's own id, made when it loads. */\n tab: string;\n id: number;\n method: string;\n params: Record<string, unknown>;\n}\n\nexport interface Result {\n tab: string;\n id: number;\n result?: unknown;\n error?: { message: string; code?: string };\n}\n\n/**\n * A changed page in the list: without its changes, and with its title when\n * the build has it, formatted when its field sets `inline = \"code\"`.\n */\nexport type ChangedPage = Omit<PageDiff, \"changes\"> & {\n title: string | null;\n formatted_title: FormattedPiece[] | null;\n};\n\n/** How the checkout's `HEAD` relates to the pull request's head commit. */\nexport type LocalState = \"same\" | \"behind\" | \"ahead\" | \"diverged\" | \"missing\";\n\n/** The review threads: on, or why not, with a sentence to show. */\nexport type ThreadsState =\n | {\n state: \"on\";\n pullRequest: { number: number; url: string; baseRefName: string };\n local: { state: LocalState; behind: number; ahead: number };\n }\n /** No pull request, no GitHub CLI, no sign-in, a channel other pages could use, or a failure. */\n | {\n state: \"no-pull-request\" | \"gh-missing\" | \"signed-out\" | \"unprotected\" | \"error\";\n message: string;\n };\n\n/** `status`'s answer. */\nexport interface Status {\n on: boolean;\n}\n\n/** `page`'s answer: what the app shows for the page at a route. */\nexport interface PageView {\n /** `\"page\"` for a page of the Ascribe build, `\"not-page\"` for the site's own routes. */\n kind: \"page\" | \"not-page\";\n /** The page's content path; `null` for a route that isn't one. */\n path: string | null;\n /** The page's changes; `null` when it didn't change. */\n page: PageDiff | null;\n base: BaseInfo | null;\n /** Why the changes couldn't be read, when they couldn't. */\n problem: string | null;\n /** How many errors `ascribe check` finds in the working tree for the build. */\n errors: number;\n threads: ThreadsState;\n /** The build's changed pages, in path order. */\n changedPages: ChangedPage[];\n /** The content root, absolute, and the platform's path separator: for opening a source file. */\n contentRoot: string;\n separator: string;\n}\n"]}
|
package/dist/review/routes.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FormattedPiece } from "@ascribed/review/overlay";
|
|
1
2
|
/** A route as compared: decoded, without a trailing `/` (except the root's). */
|
|
2
3
|
export declare function normalizeRoute(route: string): string;
|
|
3
4
|
/** A page of the build, as its JSON output names it. */
|
|
@@ -5,6 +6,8 @@ export interface RoutedPage {
|
|
|
5
6
|
/** The content path. */
|
|
6
7
|
path: string;
|
|
7
8
|
title: string | null;
|
|
9
|
+
/** The title formatted, when its field sets `inline = "code"`. */
|
|
10
|
+
formatted_title: FormattedPiece[] | null;
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
10
13
|
* Every page of the build's JSON output (`<output-dir>/<build>/json/`), by
|