@ascribed/astro 0.2.1-next.11 → 0.2.1-next.13
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 +3 -1
- package/dist/dev.js +9 -0
- package/dist/dev.js.map +1 -1
- package/dist/files.d.ts +8 -2
- package/dist/files.js +21 -5
- package/dist/files.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +44 -10
- package/dist/index.js.map +1 -1
- package/dist/names.d.ts +5 -0
- package/dist/names.js +5 -0
- package/dist/names.js.map +1 -1
- package/dist/permalinks.d.ts +54 -0
- package/dist/permalinks.js +72 -0
- package/dist/permalinks.js.map +1 -0
- package/dist/project.d.ts +10 -0
- package/dist/project.js +11 -0
- package/dist/project.js.map +1 -1
- package/dist/review/diff.d.ts +13 -0
- package/dist/review/diff.js +34 -1
- package/dist/review/diff.js.map +1 -1
- package/dist/review/server.d.ts +13 -0
- package/dist/review/server.js +44 -0
- package/dist/review/server.js.map +1 -1
- package/dist/run.d.ts +5 -4
- package/dist/run.js +12 -5
- package/dist/run.js.map +1 -1
- package/dist/shapes.d.ts +8 -1
- package/dist/shapes.js.map +1 -1
- package/dist/toolbar/app.js +98 -0
- package/dist/toolbar/app.js.map +1 -1
- package/package.json +15 -8
- package/src/MissingPermalink.astro +56 -0
- package/src/Permalink.astro +77 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ascribed/astro",
|
|
3
|
-
"version": "0.2.1-next.
|
|
3
|
+
"version": "0.2.1-next.13",
|
|
4
4
|
"description": "The Astro integration for Ascribe.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"src/Elements.astro",
|
|
18
|
-
"src/Availability.astro"
|
|
18
|
+
"src/Availability.astro",
|
|
19
|
+
"src/Permalink.astro",
|
|
20
|
+
"src/MissingPermalink.astro"
|
|
19
21
|
],
|
|
20
22
|
"exports": {
|
|
21
23
|
".": {
|
|
@@ -32,18 +34,23 @@
|
|
|
32
34
|
},
|
|
33
35
|
"./Elements.astro": "./src/Elements.astro",
|
|
34
36
|
"./Availability.astro": "./src/Availability.astro",
|
|
37
|
+
"./MissingPermalink.astro": "./src/MissingPermalink.astro",
|
|
35
38
|
"./content": {
|
|
36
39
|
"types": "./dist/content.d.ts",
|
|
37
40
|
"default": "./dist/content.js"
|
|
41
|
+
},
|
|
42
|
+
"./permalinks": {
|
|
43
|
+
"types": "./dist/permalinks.d.ts",
|
|
44
|
+
"default": "./dist/permalinks.js"
|
|
38
45
|
}
|
|
39
46
|
},
|
|
40
47
|
"engines": {
|
|
41
48
|
"node": ">=24"
|
|
42
49
|
},
|
|
43
50
|
"dependencies": {
|
|
44
|
-
"@ascribed/cli": "0.2.1-next.
|
|
45
|
-
"@ascribed/elements": "0.2.1-next.
|
|
46
|
-
"@ascribed/review": "0.2.1-next.
|
|
51
|
+
"@ascribed/cli": "0.2.1-next.13",
|
|
52
|
+
"@ascribed/elements": "0.2.1-next.13",
|
|
53
|
+
"@ascribed/review": "0.2.1-next.13",
|
|
47
54
|
"property-information": "^7.2.0",
|
|
48
55
|
"smol-toml": "^1.9.0"
|
|
49
56
|
},
|
|
@@ -63,9 +70,9 @@
|
|
|
63
70
|
"devDependencies": {
|
|
64
71
|
"@types/hast": "^3.0.4",
|
|
65
72
|
"@types/node": "^24.0.0",
|
|
66
|
-
"astro": "7.3.
|
|
73
|
+
"astro": "7.3.6",
|
|
67
74
|
"hast-util-from-html": "^2.0.3",
|
|
68
|
-
"jsdom": "^30.1.
|
|
75
|
+
"jsdom": "^30.1.2",
|
|
69
76
|
"rehype-raw": "^7.0.0",
|
|
70
77
|
"rehype-stringify": "^10.0.1",
|
|
71
78
|
"remark-gfm": "^4.0.1",
|
|
@@ -78,7 +85,7 @@
|
|
|
78
85
|
"publishConfig": {
|
|
79
86
|
"access": "public"
|
|
80
87
|
},
|
|
81
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "42f00096ceb0f91a736b6a3d485eb38a91fbcc48",
|
|
82
89
|
"scripts": {
|
|
83
90
|
"build": "tsc -p tsconfig.build.json",
|
|
84
91
|
"typecheck": "tsc --noEmit",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
// For a site's not-found page: on an address under the permalinks' path, it
|
|
3
|
+
// says the link came from a product that expected a section of these docs
|
|
4
|
+
// there, and that these docs don't have it. Anywhere else it shows nothing. A
|
|
5
|
+
// static host serves one not-found page for every missing address, so its
|
|
6
|
+
// script decides from the address, and without a script it stays hidden.
|
|
7
|
+
//
|
|
8
|
+
// import MissingPermalink from "@ascribed/astro/MissingPermalink.astro";
|
|
9
|
+
// <MissingPermalink />
|
|
10
|
+
//
|
|
11
|
+
// `home` is where it sends the reader, the site's root by default. Children
|
|
12
|
+
// replace its last paragraph, which offers the home page and searching.
|
|
13
|
+
import { home as root, siteRoot } from "virtual:ascribe/site";
|
|
14
|
+
import { readPermalinks } from "@ascribed/astro/permalinks";
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
home?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const { home = root } = Astro.props;
|
|
21
|
+
const path = readPermalinks(siteRoot)?.path;
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
{
|
|
25
|
+
path !== undefined && (
|
|
26
|
+
<section data-permalinks={path} hidden>
|
|
27
|
+
<p>
|
|
28
|
+
This address is a permalink, <code />: a name a product links to for a section of its
|
|
29
|
+
documentation. These docs have no section by that name. The link may come from a newer or
|
|
30
|
+
older version of the product than they describe.
|
|
31
|
+
</p>
|
|
32
|
+
<slot>
|
|
33
|
+
<p>Start from the <a href={home}>home page</a>, or search the docs for what you need.</p>
|
|
34
|
+
</slot>
|
|
35
|
+
</section>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
<script>
|
|
40
|
+
for (const section of document.querySelectorAll<HTMLElement>("section[data-permalinks]")) {
|
|
41
|
+
const path = section.dataset["permalinks"] ?? "";
|
|
42
|
+
let address: string;
|
|
43
|
+
try {
|
|
44
|
+
address = decodeURIComponent(location.pathname);
|
|
45
|
+
} catch {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (!address.startsWith(path)) continue;
|
|
49
|
+
// One segment after the path, as every permalink's address has.
|
|
50
|
+
const name = address.slice(path.length).replace(/\/$/, "");
|
|
51
|
+
if (name === "" || name.includes("/")) continue;
|
|
52
|
+
const code = section.querySelector("code");
|
|
53
|
+
if (code !== null) code.textContent = name;
|
|
54
|
+
section.hidden = false;
|
|
55
|
+
}
|
|
56
|
+
</script>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
// A permalink's address: a page that sends the reader on to the heading it
|
|
3
|
+
// names, wherever that is now. The integration adds it as a route at
|
|
4
|
+
// `<path>[id]`, one page for each entry of the site output's
|
|
5
|
+
// `_ascribe/permalinks.json`. It forwards without a script, links to the same
|
|
6
|
+
// place for a browser that doesn't follow, and isn't indexed. Its script
|
|
7
|
+
// first takes the reader's choices from the address's parameters
|
|
8
|
+
// (`?platform=macos`), as if they'd picked those tabs, then forwards.
|
|
9
|
+
//
|
|
10
|
+
// A retired permalink with nowhere to lead gets a page that says what was
|
|
11
|
+
// here was removed, gives the reason as its authors wrote it, as text, and
|
|
12
|
+
// links to the docs' home.
|
|
13
|
+
import { home, siteRoot } from "virtual:ascribe/site";
|
|
14
|
+
import { forwardingPaths, type Forwarding } from "@ascribed/astro/permalinks";
|
|
15
|
+
|
|
16
|
+
export function getStaticPaths() {
|
|
17
|
+
return forwardingPaths(siteRoot);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const props = Astro.props as Forwarding;
|
|
21
|
+
const to = "to" in props ? props.to : undefined;
|
|
22
|
+
const dimensions = "to" in props ? props.dimensions : {};
|
|
23
|
+
const reason = "reason" in props ? props.reason : undefined;
|
|
24
|
+
const canonical =
|
|
25
|
+
to === undefined || Astro.site === undefined ? to : new URL(to, Astro.site).href;
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
<!doctype html>
|
|
29
|
+
<html lang="en">
|
|
30
|
+
<head>
|
|
31
|
+
<meta charset="utf-8" />
|
|
32
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
33
|
+
{to === undefined ? <title>Removed from these docs</title> : <title>Redirecting to {to}</title>}
|
|
34
|
+
<meta name="robots" content="noindex" />
|
|
35
|
+
{to !== undefined && <meta http-equiv="refresh" content={`0;url=${to}`} />}
|
|
36
|
+
{canonical !== undefined && <link rel="canonical" href={canonical} />}
|
|
37
|
+
</head>
|
|
38
|
+
<body>
|
|
39
|
+
{
|
|
40
|
+
to === undefined ? (
|
|
41
|
+
<main>
|
|
42
|
+
<h1>Removed from these docs</h1>
|
|
43
|
+
<p>What this link led to was removed from these docs.</p>
|
|
44
|
+
<p data-reason>{reason}</p>
|
|
45
|
+
<p>
|
|
46
|
+
<a href={home}>Go to the docs' home page</a>
|
|
47
|
+
</p>
|
|
48
|
+
</main>
|
|
49
|
+
) : (
|
|
50
|
+
<p>
|
|
51
|
+
This link leads to <a href={to} data-dimensions={JSON.stringify(dimensions)}>{to}</a>.
|
|
52
|
+
</p>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
<script>
|
|
56
|
+
import { choose } from "@ascribed/elements";
|
|
57
|
+
|
|
58
|
+
// A parameter that names one of the content model's dimensions, with one of
|
|
59
|
+
// its values, is the reader's choice for it. Anything else is ignored, so a
|
|
60
|
+
// product sends what it knows without asking what the docs accept.
|
|
61
|
+
const link = document.querySelector<HTMLAnchorElement>("a[data-dimensions]");
|
|
62
|
+
if (link !== null) {
|
|
63
|
+
const dimensions = JSON.parse(link.dataset["dimensions"] ?? "{}") as Record<string, string[]>;
|
|
64
|
+
const chosen = new Set<string>();
|
|
65
|
+
for (const [name, value] of new URLSearchParams(location.search)) {
|
|
66
|
+
if (chosen.has(name) || !Object.hasOwn(dimensions, name)) continue;
|
|
67
|
+
if (dimensions[name]?.includes(value)) {
|
|
68
|
+
chosen.add(name);
|
|
69
|
+
choose(name, value);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Sooner than the refresh, which waits for the page to load.
|
|
73
|
+
location.replace(link.href);
|
|
74
|
+
}
|
|
75
|
+
</script>
|
|
76
|
+
</body>
|
|
77
|
+
</html>
|