lildocs 0.1.8 → 0.1.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/dist/cli.mjs +15 -1
- package/dist/render/search.js +19 -3
- package/dist/render/styles.css +18 -0
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1388,6 +1388,7 @@ function Layout({ page, nav, pageNavigation, css, searchIndexJson, logo, favicon
|
|
|
1388
1388
|
const transition = navigation?.transition ?? "fade";
|
|
1389
1389
|
const documentTitle = projectName ? `${page.title} • ${projectName}` : page.title;
|
|
1390
1390
|
const repoIconUrl = rootRelativeUrl(page.route, "assets/github-icon.svg");
|
|
1391
|
+
const issueUrl = issueUrlForRepository(repositoryUrl);
|
|
1391
1392
|
return /* @__PURE__ */ jsxs("html", {
|
|
1392
1393
|
lang: "en",
|
|
1393
1394
|
children: [/* @__PURE__ */ jsxs("head", { children: [
|
|
@@ -1474,7 +1475,7 @@ function Layout({ page, nav, pageNavigation, css, searchIndexJson, logo, favicon
|
|
|
1474
1475
|
]
|
|
1475
1476
|
})]
|
|
1476
1477
|
}),
|
|
1477
|
-
/* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: `window.lildocsSearchUrl = ${JSON.stringify(rootRelativeUrl(page.route, "search-index.json"))};` } }),
|
|
1478
|
+
/* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: `window.lildocsSearchUrl = ${JSON.stringify(rootRelativeUrl(page.route, "search-index.json"))};${issueUrl ? `window.lildocsIssueUrl = ${JSON.stringify(issueUrl)};` : ""}` } }),
|
|
1478
1479
|
/* @__PURE__ */ jsx("script", {
|
|
1479
1480
|
type: "application/json",
|
|
1480
1481
|
id: "lildocs-search-index",
|
|
@@ -1496,6 +1497,19 @@ function Layout({ page, nav, pageNavigation, css, searchIndexJson, logo, favicon
|
|
|
1496
1497
|
] })]
|
|
1497
1498
|
});
|
|
1498
1499
|
}
|
|
1500
|
+
function issueUrlForRepository(repositoryUrl) {
|
|
1501
|
+
if (!repositoryUrl) return;
|
|
1502
|
+
let url;
|
|
1503
|
+
try {
|
|
1504
|
+
url = new URL(repositoryUrl);
|
|
1505
|
+
} catch {
|
|
1506
|
+
return;
|
|
1507
|
+
}
|
|
1508
|
+
if (url.hostname !== "github.com") return;
|
|
1509
|
+
const [owner, repo] = url.pathname.split("/").filter(Boolean);
|
|
1510
|
+
if (!owner || !repo) return;
|
|
1511
|
+
return `https://github.com/${owner}/${repo}/issues/new`;
|
|
1512
|
+
}
|
|
1499
1513
|
function assetSrc(pageRoute, image) {
|
|
1500
1514
|
if (/^(?:[a-z]+:)?\/\//i.test(image) || image.startsWith("data:") || image.startsWith("/")) return image;
|
|
1501
1515
|
return rootRelativeUrl(pageRoute, image);
|
package/dist/render/search.js
CHANGED
|
@@ -3051,10 +3051,11 @@ const open = y$1(false);
|
|
|
3051
3051
|
anchorElement: root,
|
|
3052
3052
|
index,
|
|
3053
3053
|
siteRoot,
|
|
3054
|
-
preloadedUrls
|
|
3054
|
+
preloadedUrls,
|
|
3055
|
+
issueUrl: window.lildocsIssueUrl
|
|
3055
3056
|
}), root);
|
|
3056
3057
|
})();
|
|
3057
|
-
function SearchBox({ anchorElement, index, siteRoot, preloadedUrls }) {
|
|
3058
|
+
function SearchBox({ anchorElement, index, siteRoot, preloadedUrls, issueUrl }) {
|
|
3058
3059
|
const inputRef = A$1(null);
|
|
3059
3060
|
const selectedRef = A$1(null);
|
|
3060
3061
|
const [query, setQuery] = d$2("");
|
|
@@ -3137,7 +3138,13 @@ function SearchBox({ anchorElement, index, siteRoot, preloadedUrls }) {
|
|
|
3137
3138
|
sameWidth: false,
|
|
3138
3139
|
children: /* @__PURE__ */ u("div", {
|
|
3139
3140
|
id: "lildocs-search-results",
|
|
3140
|
-
children: matches.length === 0 ? /* @__PURE__ */ u("
|
|
3141
|
+
children: matches.length === 0 ? /* @__PURE__ */ u("div", {
|
|
3142
|
+
className: "searchEmpty",
|
|
3143
|
+
children: [/* @__PURE__ */ u("p", { children: "No results" }), issueUrl ? /* @__PURE__ */ u("a", {
|
|
3144
|
+
href: issueUrlForQuery(issueUrl, query),
|
|
3145
|
+
children: "Create a GitHub issue"
|
|
3146
|
+
}) : null]
|
|
3147
|
+
}) : matches.map((match, matchIndex) => {
|
|
3141
3148
|
const selected = matchIndex === selectedIndex;
|
|
3142
3149
|
return /* @__PURE__ */ u("a", {
|
|
3143
3150
|
ref: selected ? selectedRef : void 0,
|
|
@@ -3154,6 +3161,15 @@ function SearchBox({ anchorElement, index, siteRoot, preloadedUrls }) {
|
|
|
3154
3161
|
})
|
|
3155
3162
|
] });
|
|
3156
3163
|
}
|
|
3164
|
+
function issueUrlForQuery(issueUrl, query) {
|
|
3165
|
+
const url = new URL(issueUrl);
|
|
3166
|
+
const trimmedQuery = query.trim();
|
|
3167
|
+
if (trimmedQuery) {
|
|
3168
|
+
url.searchParams.set("title", `Missing docs for ${trimmedQuery}`);
|
|
3169
|
+
url.searchParams.set("body", `I searched the docs for "${trimmedQuery}" but did not find a result.`);
|
|
3170
|
+
}
|
|
3171
|
+
return url.href;
|
|
3172
|
+
}
|
|
3157
3173
|
function searchIndex(index, query) {
|
|
3158
3174
|
const normalizedQuery = normalizeQuery(query);
|
|
3159
3175
|
if (!normalizedQuery) return [];
|
package/dist/render/styles.css
CHANGED
|
@@ -411,6 +411,9 @@ html.is-animating .transition-scale {
|
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
.content table {
|
|
414
|
+
display: block;
|
|
415
|
+
max-width: 100%;
|
|
416
|
+
overflow-x: auto;
|
|
414
417
|
width: 100%;
|
|
415
418
|
border-collapse: collapse;
|
|
416
419
|
}
|
|
@@ -652,6 +655,21 @@ html.is-animating .transition-scale {
|
|
|
652
655
|
font-size: 0.84rem;
|
|
653
656
|
}
|
|
654
657
|
|
|
658
|
+
.searchEmpty p {
|
|
659
|
+
color: var(--ld-color-muted-text);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
.searchResults .searchEmpty a {
|
|
663
|
+
padding-top: 0;
|
|
664
|
+
color: var(--ld-color-link);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
.searchResults .searchEmpty a:hover,
|
|
668
|
+
.searchResults .searchEmpty a:focus-visible {
|
|
669
|
+
background: transparent;
|
|
670
|
+
text-decoration: underline;
|
|
671
|
+
}
|
|
672
|
+
|
|
655
673
|
.searchResults mark {
|
|
656
674
|
border-radius: 3px;
|
|
657
675
|
background: color-mix(in srgb, var(--ld-color-link) 18%, transparent);
|
package/package.json
CHANGED