@quartz-community/tag-page 1.0.1 → 1.0.3
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/CHANGELOG.md +12 -0
- package/dist/components/index.js +96 -139
- package/dist/components/index.js.map +1 -1
- package/dist/index.js +101 -144
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'preact/jsx-runtime';
|
|
2
|
+
import { h } from 'preact';
|
|
3
|
+
|
|
1
4
|
var __create = Object.create;
|
|
2
5
|
var __defProp = Object.defineProperty;
|
|
3
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -56,8 +59,8 @@ var require_cjs = __commonJS({
|
|
|
56
59
|
function updatePosition(str) {
|
|
57
60
|
var lines = str.match(NEWLINE_REGEX);
|
|
58
61
|
if (lines) lineno += lines.length;
|
|
59
|
-
var
|
|
60
|
-
column = ~
|
|
62
|
+
var i = str.lastIndexOf(NEWLINE);
|
|
63
|
+
column = ~i ? str.length - i : column + str.length;
|
|
61
64
|
}
|
|
62
65
|
function position3() {
|
|
63
66
|
var start2 = { line: lineno, column };
|
|
@@ -88,22 +91,22 @@ var require_cjs = __commonJS({
|
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
function match(re2) {
|
|
91
|
-
var
|
|
92
|
-
if (!
|
|
93
|
-
var str =
|
|
94
|
+
var m = re2.exec(style);
|
|
95
|
+
if (!m) return;
|
|
96
|
+
var str = m[0];
|
|
94
97
|
updatePosition(str);
|
|
95
98
|
style = style.slice(str.length);
|
|
96
|
-
return
|
|
99
|
+
return m;
|
|
97
100
|
}
|
|
98
101
|
function whitespace2() {
|
|
99
102
|
match(WHITESPACE_REGEX);
|
|
100
103
|
}
|
|
101
104
|
function comments(rules) {
|
|
102
|
-
var
|
|
105
|
+
var c;
|
|
103
106
|
rules = rules || [];
|
|
104
|
-
while (
|
|
105
|
-
if (
|
|
106
|
-
rules.push(
|
|
107
|
+
while (c = comment()) {
|
|
108
|
+
if (c !== false) {
|
|
109
|
+
rules.push(c);
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
return rules;
|
|
@@ -111,18 +114,18 @@ var require_cjs = __commonJS({
|
|
|
111
114
|
function comment() {
|
|
112
115
|
var pos = position3();
|
|
113
116
|
if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;
|
|
114
|
-
var
|
|
115
|
-
while (EMPTY_STRING != style.charAt(
|
|
116
|
-
++
|
|
117
|
+
var i = 2;
|
|
118
|
+
while (EMPTY_STRING != style.charAt(i) && (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))) {
|
|
119
|
+
++i;
|
|
117
120
|
}
|
|
118
|
-
|
|
119
|
-
if (EMPTY_STRING === style.charAt(
|
|
121
|
+
i += 2;
|
|
122
|
+
if (EMPTY_STRING === style.charAt(i - 1)) {
|
|
120
123
|
return error("End of comment missing");
|
|
121
124
|
}
|
|
122
|
-
var str = style.slice(2,
|
|
125
|
+
var str = style.slice(2, i - 2);
|
|
123
126
|
column += 2;
|
|
124
127
|
updatePosition(str);
|
|
125
|
-
style = style.slice(
|
|
128
|
+
style = style.slice(i);
|
|
126
129
|
column += 2;
|
|
127
130
|
return pos({
|
|
128
131
|
type: TYPE_COMMENT,
|
|
@@ -271,8 +274,6 @@ function getDate(data) {
|
|
|
271
274
|
const dates = data.dates;
|
|
272
275
|
return dates?.[defaultDateType];
|
|
273
276
|
}
|
|
274
|
-
|
|
275
|
-
// node_modules/@quartz-community/utils/dist/path.js
|
|
276
277
|
function simplifySlug(fp) {
|
|
277
278
|
const res = stripSlashes(trimSuffix(fp, "index"), true);
|
|
278
279
|
return res.length === 0 ? "/" : res;
|
|
@@ -292,23 +293,23 @@ function joinSegments(...args) {
|
|
|
292
293
|
}
|
|
293
294
|
return joined;
|
|
294
295
|
}
|
|
295
|
-
function endsWith(
|
|
296
|
-
return
|
|
296
|
+
function endsWith(s, suffix) {
|
|
297
|
+
return s === suffix || s.endsWith("/" + suffix);
|
|
297
298
|
}
|
|
298
|
-
function trimSuffix(
|
|
299
|
-
if (endsWith(
|
|
300
|
-
|
|
299
|
+
function trimSuffix(s, suffix) {
|
|
300
|
+
if (endsWith(s, suffix)) {
|
|
301
|
+
s = s.slice(0, -suffix.length);
|
|
301
302
|
}
|
|
302
|
-
return
|
|
303
|
+
return s;
|
|
303
304
|
}
|
|
304
|
-
function stripSlashes(
|
|
305
|
-
if (
|
|
306
|
-
|
|
305
|
+
function stripSlashes(s, onlyStripPrefix) {
|
|
306
|
+
if (s.startsWith("/")) {
|
|
307
|
+
s = s.substring(1);
|
|
307
308
|
}
|
|
308
|
-
if (!onlyStripPrefix &&
|
|
309
|
-
|
|
309
|
+
if (!onlyStripPrefix && s.endsWith("/")) {
|
|
310
|
+
s = s.slice(0, -1);
|
|
310
311
|
}
|
|
311
|
-
return
|
|
312
|
+
return s;
|
|
312
313
|
}
|
|
313
314
|
function isFolderPath(fplike) {
|
|
314
315
|
return fplike.endsWith("/") || endsWith(fplike, "index") || endsWith(fplike, "index.md") || endsWith(fplike, "index.html");
|
|
@@ -316,13 +317,13 @@ function isFolderPath(fplike) {
|
|
|
316
317
|
function getAllSegmentPrefixes(path) {
|
|
317
318
|
const segments = path.split("/");
|
|
318
319
|
const results = [];
|
|
319
|
-
for (let
|
|
320
|
-
results.push(segments.slice(0,
|
|
320
|
+
for (let i = 0; i < segments.length; i++) {
|
|
321
|
+
results.push(segments.slice(0, i + 1).join("/"));
|
|
321
322
|
}
|
|
322
323
|
return results;
|
|
323
324
|
}
|
|
324
325
|
function pathToRoot(slug2) {
|
|
325
|
-
let rootPath = slug2.split("/").filter((
|
|
326
|
+
let rootPath = slug2.split("/").filter((x) => x !== "").slice(0, -1).map((_) => "..").join("/");
|
|
326
327
|
if (rootPath.length === 0) {
|
|
327
328
|
rootPath = ".";
|
|
328
329
|
}
|
|
@@ -332,66 +333,26 @@ function resolveRelative(current, target) {
|
|
|
332
333
|
const res = joinSegments(pathToRoot(current), simplifySlug(target));
|
|
333
334
|
return res;
|
|
334
335
|
}
|
|
335
|
-
|
|
336
|
-
// node_modules/preact/dist/preact.mjs
|
|
337
|
-
var n;
|
|
338
|
-
var l;
|
|
339
|
-
var u;
|
|
340
|
-
var w = [];
|
|
341
|
-
function k(l2, u3, t2) {
|
|
342
|
-
var i2, r2, o2, e2 = {};
|
|
343
|
-
for (o2 in u3) "key" == o2 ? i2 = u3[o2] : "ref" == o2 ? r2 = u3[o2] : e2[o2] = u3[o2];
|
|
344
|
-
if (arguments.length > 2 && (e2.children = arguments.length > 3 ? n.call(arguments, 2) : t2), "function" == typeof l2 && null != l2.defaultProps) for (o2 in l2.defaultProps) void 0 === e2[o2] && (e2[o2] = l2.defaultProps[o2]);
|
|
345
|
-
return x(l2, e2, i2, r2, null);
|
|
346
|
-
}
|
|
347
|
-
function x(n2, t2, i2, r2, o2) {
|
|
348
|
-
var e2 = { type: n2, props: t2, key: i2, ref: r2, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: null == o2 ? ++u : o2, __i: -1, __u: 0 };
|
|
349
|
-
return null != l.vnode && l.vnode(e2), e2;
|
|
350
|
-
}
|
|
351
|
-
function S(n2) {
|
|
352
|
-
return n2.children;
|
|
353
|
-
}
|
|
354
|
-
n = w.slice, l = { __e: function(n2, l2, u3, t2) {
|
|
355
|
-
for (var i2, r2, o2; l2 = l2.__; ) if ((i2 = l2.__c) && !i2.__) try {
|
|
356
|
-
if ((r2 = i2.constructor) && null != r2.getDerivedStateFromError && (i2.setState(r2.getDerivedStateFromError(n2)), o2 = i2.__d), null != i2.componentDidCatch && (i2.componentDidCatch(n2, t2 || {}), o2 = i2.__d), o2) return i2.__E = i2;
|
|
357
|
-
} catch (l3) {
|
|
358
|
-
n2 = l3;
|
|
359
|
-
}
|
|
360
|
-
throw n2;
|
|
361
|
-
} }, u = 0, "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Math.random().toString(8);
|
|
362
|
-
|
|
363
|
-
// node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
|
|
364
|
-
var f2 = 0;
|
|
365
|
-
function u2(e2, t2, n2, o2, i2, u3) {
|
|
366
|
-
t2 || (t2 = {});
|
|
367
|
-
var a2, c2, p2 = t2;
|
|
368
|
-
if ("ref" in p2) for (c2 in p2 = {}, t2) "ref" == c2 ? a2 = t2[c2] : p2[c2] = t2[c2];
|
|
369
|
-
var l2 = { type: e2, props: p2, key: n2, ref: a2, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --f2, __i: -1, __u: 0, __source: i2, __self: u3 };
|
|
370
|
-
if ("function" == typeof e2 && (a2 = e2.defaultProps)) for (c2 in a2) void 0 === p2[c2] && (p2[c2] = a2[c2]);
|
|
371
|
-
return l.vnode && l.vnode(l2), l2;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
// src/components/PageList.tsx
|
|
375
336
|
function byDateAndAlphabeticalFolderFirst(_cfg) {
|
|
376
|
-
return (f1,
|
|
337
|
+
return (f1, f2) => {
|
|
377
338
|
const f1IsFolder = isFolderPath(f1.slug ?? "");
|
|
378
|
-
const f2IsFolder = isFolderPath(
|
|
339
|
+
const f2IsFolder = isFolderPath(f2.slug ?? "");
|
|
379
340
|
if (f1IsFolder && !f2IsFolder) return -1;
|
|
380
341
|
if (!f1IsFolder && f2IsFolder) return 1;
|
|
381
|
-
if (f1.dates &&
|
|
382
|
-
return (getDate(
|
|
383
|
-
} else if (f1.dates && !
|
|
342
|
+
if (f1.dates && f2.dates) {
|
|
343
|
+
return (getDate(f2)?.getTime() ?? 0) - (getDate(f1)?.getTime() ?? 0);
|
|
344
|
+
} else if (f1.dates && !f2.dates) {
|
|
384
345
|
return -1;
|
|
385
|
-
} else if (!f1.dates &&
|
|
346
|
+
} else if (!f1.dates && f2.dates) {
|
|
386
347
|
return 1;
|
|
387
348
|
}
|
|
388
349
|
const f1Title = f1.frontmatter?.title?.toLowerCase() ?? "";
|
|
389
|
-
const f2Title =
|
|
350
|
+
const f2Title = f2.frontmatter?.title?.toLowerCase() ?? "";
|
|
390
351
|
return f1Title.localeCompare(f2Title);
|
|
391
352
|
};
|
|
392
353
|
}
|
|
393
354
|
function DateDisplay({ date, locale }) {
|
|
394
|
-
return /* @__PURE__ */
|
|
355
|
+
return /* @__PURE__ */ jsx("time", { dateTime: date.toISOString(), children: date.toLocaleDateString(locale, {
|
|
395
356
|
year: "numeric",
|
|
396
357
|
month: "short",
|
|
397
358
|
day: "2-digit"
|
|
@@ -410,18 +371,18 @@ var PageList = ({
|
|
|
410
371
|
list = list.slice(0, limit);
|
|
411
372
|
}
|
|
412
373
|
const fileSlug = fileData?.slug;
|
|
413
|
-
return /* @__PURE__ */
|
|
374
|
+
return /* @__PURE__ */ jsx("ul", { class: "section-ul", children: list.map((page) => {
|
|
414
375
|
const title = page.frontmatter?.title;
|
|
415
376
|
const tags = page.frontmatter?.tags ?? [];
|
|
416
|
-
return /* @__PURE__ */
|
|
417
|
-
/* @__PURE__ */
|
|
377
|
+
return /* @__PURE__ */ jsx("li", { class: "section-li", children: /* @__PURE__ */ jsxs("div", { class: "section", children: [
|
|
378
|
+
/* @__PURE__ */ jsx("p", { class: "meta", children: page.dates && getDate(page) && /* @__PURE__ */ jsx(
|
|
418
379
|
DateDisplay,
|
|
419
380
|
{
|
|
420
381
|
date: getDate(page),
|
|
421
382
|
locale: cfg?.locale ?? "en-US"
|
|
422
383
|
}
|
|
423
384
|
) }),
|
|
424
|
-
/* @__PURE__ */
|
|
385
|
+
/* @__PURE__ */ jsx("div", { class: "desc", children: /* @__PURE__ */ jsx("h3", { children: /* @__PURE__ */ jsx(
|
|
425
386
|
"a",
|
|
426
387
|
{
|
|
427
388
|
href: resolveRelative(fileSlug ?? "", page.slug),
|
|
@@ -429,7 +390,7 @@ var PageList = ({
|
|
|
429
390
|
children: title
|
|
430
391
|
}
|
|
431
392
|
) }) }),
|
|
432
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ jsx("ul", { class: "tags", children: tags.map((tag) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
433
394
|
"a",
|
|
434
395
|
{
|
|
435
396
|
class: "internal tag-link",
|
|
@@ -688,7 +649,7 @@ var aria = create({
|
|
|
688
649
|
ariaValueText: null,
|
|
689
650
|
role: null
|
|
690
651
|
},
|
|
691
|
-
transform(
|
|
652
|
+
transform(_, property) {
|
|
692
653
|
return property === "role" ? property : "aria-" + property.slice(4).toLowerCase();
|
|
693
654
|
}
|
|
694
655
|
});
|
|
@@ -1653,7 +1614,7 @@ var xlink = create({
|
|
|
1653
1614
|
xLinkType: null
|
|
1654
1615
|
},
|
|
1655
1616
|
space: "xlink",
|
|
1656
|
-
transform(
|
|
1617
|
+
transform(_, property) {
|
|
1657
1618
|
return "xlink:" + property.slice(5).toLowerCase();
|
|
1658
1619
|
}
|
|
1659
1620
|
});
|
|
@@ -1670,7 +1631,7 @@ var xmlns = create({
|
|
|
1670
1631
|
var xml = create({
|
|
1671
1632
|
properties: { xmlBase: null, xmlLang: null, xmlSpace: null },
|
|
1672
1633
|
space: "xml",
|
|
1673
|
-
transform(
|
|
1634
|
+
transform(_, property) {
|
|
1674
1635
|
return "xml:" + property.slice(3).toLowerCase();
|
|
1675
1636
|
}
|
|
1676
1637
|
});
|
|
@@ -2060,7 +2021,7 @@ function root(state, node, key) {
|
|
|
2060
2021
|
addChildren(props, createChildren(state, node));
|
|
2061
2022
|
return state.create(node, state.Fragment, props, key);
|
|
2062
2023
|
}
|
|
2063
|
-
function text(
|
|
2024
|
+
function text(_, node) {
|
|
2064
2025
|
return node.value;
|
|
2065
2026
|
}
|
|
2066
2027
|
function addNode(state, props, type, node) {
|
|
@@ -2076,11 +2037,11 @@ function addChildren(props, children) {
|
|
|
2076
2037
|
}
|
|
2077
2038
|
}
|
|
2078
2039
|
}
|
|
2079
|
-
function productionCreate(
|
|
2040
|
+
function productionCreate(_, jsx4, jsxs4) {
|
|
2080
2041
|
return create2;
|
|
2081
|
-
function create2(
|
|
2042
|
+
function create2(_2, type, props, key) {
|
|
2082
2043
|
const isStaticChildren = Array.isArray(props.children);
|
|
2083
|
-
const fn = isStaticChildren ?
|
|
2044
|
+
const fn = isStaticChildren ? jsxs4 : jsx4;
|
|
2084
2045
|
return key ? fn(type, props, key) : fn(type, props);
|
|
2085
2046
|
}
|
|
2086
2047
|
}
|
|
@@ -2297,23 +2258,21 @@ function transformStyleToCssCasing(from) {
|
|
|
2297
2258
|
function toDash($0) {
|
|
2298
2259
|
return "-" + $0.toLowerCase();
|
|
2299
2260
|
}
|
|
2300
|
-
|
|
2301
|
-
// node_modules/@quartz-community/utils/dist/jsx.js
|
|
2302
2261
|
function childrenToString(children) {
|
|
2303
2262
|
if (typeof children === "string") return children;
|
|
2304
2263
|
if (Array.isArray(children)) return children.map(childrenToString).join("");
|
|
2305
2264
|
return String(children ?? "");
|
|
2306
2265
|
}
|
|
2307
2266
|
var builtinComponents = {
|
|
2308
|
-
table: (props) => /* @__PURE__ */
|
|
2309
|
-
style: ({ children, ...rest }) =>
|
|
2310
|
-
script: ({ children, ...rest }) =>
|
|
2267
|
+
table: (props) => /* @__PURE__ */ jsx("div", { class: "table-container", children: /* @__PURE__ */ jsx("table", { ...props }) }),
|
|
2268
|
+
style: ({ children, ...rest }) => h("style", { ...rest, dangerouslySetInnerHTML: { __html: childrenToString(children) } }),
|
|
2269
|
+
script: ({ children, ...rest }) => h("script", { ...rest, dangerouslySetInnerHTML: { __html: childrenToString(children) } })
|
|
2311
2270
|
};
|
|
2312
2271
|
function htmlToJsx(tree, components) {
|
|
2313
2272
|
return toJsxRuntime(tree, {
|
|
2314
|
-
Fragment
|
|
2315
|
-
jsx:
|
|
2316
|
-
jsxs:
|
|
2273
|
+
Fragment,
|
|
2274
|
+
jsx: jsx,
|
|
2275
|
+
jsxs: jsxs,
|
|
2317
2276
|
elementAttributeNameCase: "html",
|
|
2318
2277
|
components: { ...builtinComponents, ...components }
|
|
2319
2278
|
});
|
|
@@ -2787,8 +2746,8 @@ function i18n(locale) {
|
|
|
2787
2746
|
// src/util/tags.ts
|
|
2788
2747
|
function hasChildTags(tag, allTags) {
|
|
2789
2748
|
const prefix = `${tag}/`;
|
|
2790
|
-
for (const
|
|
2791
|
-
if (
|
|
2749
|
+
for (const t of allTags) {
|
|
2750
|
+
if (t.startsWith(prefix)) return true;
|
|
2792
2751
|
}
|
|
2793
2752
|
return false;
|
|
2794
2753
|
}
|
|
@@ -2799,13 +2758,11 @@ function tagPageSlug(tag, allTags) {
|
|
|
2799
2758
|
|
|
2800
2759
|
// src/components/styles/listPage.scss
|
|
2801
2760
|
var listPage_default = "ul.section-ul {\n list-style: none;\n margin-top: 2em;\n padding-left: 0;\n}\n\nli.section-li {\n margin-bottom: 1em;\n}\nli.section-li > .section {\n display: grid;\n grid-template-columns: fit-content(8em) 3fr 1fr;\n}\n@media all and (max-width: 600px) {\n li.section-li > .section > .tags {\n display: none;\n }\n}\nli.section-li > .section > .desc > h3 > a {\n background-color: transparent;\n}\nli.section-li > .section .meta {\n margin: 0 1em 0 0;\n opacity: 0.6;\n}\n\n.popover .section {\n grid-template-columns: fit-content(8em) 1fr !important;\n}\n.popover .section > .tags {\n display: none;\n}";
|
|
2802
|
-
|
|
2803
|
-
// src/components/TagContent.tsx
|
|
2804
2761
|
var defaultOptions = {
|
|
2805
2762
|
numPages: 10
|
|
2806
2763
|
};
|
|
2807
2764
|
function concatenateResources(...resources) {
|
|
2808
|
-
const result = resources.filter((
|
|
2765
|
+
const result = resources.filter((r) => r !== void 0).flat();
|
|
2809
2766
|
return result.length === 0 ? void 0 : result;
|
|
2810
2767
|
}
|
|
2811
2768
|
function isListed(file) {
|
|
@@ -2816,15 +2773,15 @@ var TagContent_default = ((opts) => {
|
|
|
2816
2773
|
const TagContent = (props) => {
|
|
2817
2774
|
const { tree, fileData, allFiles, cfg } = props;
|
|
2818
2775
|
const fd = fileData;
|
|
2819
|
-
const
|
|
2776
|
+
const slug = fd.slug;
|
|
2820
2777
|
const locale = cfg?.locale ?? "en-US";
|
|
2821
|
-
if (!(
|
|
2822
|
-
throw new Error(`Component "TagContent" tried to render a non-tag page: ${
|
|
2778
|
+
if (!(slug?.startsWith("tags/") || slug === "tags")) {
|
|
2779
|
+
throw new Error(`Component "TagContent" tried to render a non-tag page: ${slug}`);
|
|
2823
2780
|
}
|
|
2824
|
-
let tag = simplifySlug(
|
|
2781
|
+
let tag = simplifySlug(slug.slice("tags/".length));
|
|
2825
2782
|
if (tag !== "/" && tag.endsWith("/")) tag = tag.slice(0, -1);
|
|
2826
|
-
const allPagesWithTag = (
|
|
2827
|
-
(file) => (file.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes).includes(
|
|
2783
|
+
const allPagesWithTag = (t) => allFiles.filter(isListed).filter(
|
|
2784
|
+
(file) => (file.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes).includes(t)
|
|
2828
2785
|
);
|
|
2829
2786
|
const hastRoot = tree;
|
|
2830
2787
|
const content = hastRoot.children.length === 0 ? fd.description : htmlToJsx(hastRoot);
|
|
@@ -2835,16 +2792,16 @@ var TagContent_default = ((opts) => {
|
|
|
2835
2792
|
...new Set(
|
|
2836
2793
|
allFiles.filter(isListed).flatMap((data) => data.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes)
|
|
2837
2794
|
)
|
|
2838
|
-
].sort((
|
|
2795
|
+
].sort((a, b) => a.localeCompare(b));
|
|
2839
2796
|
const tagItemMap = /* @__PURE__ */ new Map();
|
|
2840
|
-
for (const
|
|
2841
|
-
tagItemMap.set(
|
|
2797
|
+
for (const t of tags) {
|
|
2798
|
+
tagItemMap.set(t, allPagesWithTag(t));
|
|
2842
2799
|
}
|
|
2843
|
-
return /* @__PURE__ */
|
|
2844
|
-
/* @__PURE__ */
|
|
2845
|
-
/* @__PURE__ */
|
|
2846
|
-
/* @__PURE__ */
|
|
2847
|
-
const pages = tagItemMap.get(
|
|
2800
|
+
return /* @__PURE__ */ jsxs("div", { class: "popover-hint", children: [
|
|
2801
|
+
/* @__PURE__ */ jsx("article", { class: classes, children: /* @__PURE__ */ jsx("div", { class: "markdown-preview-view markdown-rendered", children: /* @__PURE__ */ jsx("p", { children: content }) }) }),
|
|
2802
|
+
/* @__PURE__ */ jsx("p", { children: i18n(locale).pages.tagContent.totalTags({ count: tags.length }) }),
|
|
2803
|
+
/* @__PURE__ */ jsx("div", { children: tags.map((t) => {
|
|
2804
|
+
const pages = tagItemMap.get(t);
|
|
2848
2805
|
const listProps = {
|
|
2849
2806
|
...props,
|
|
2850
2807
|
allFiles: pages
|
|
@@ -2855,21 +2812,21 @@ var TagContent_default = ((opts) => {
|
|
|
2855
2812
|
sort: options?.sort
|
|
2856
2813
|
});
|
|
2857
2814
|
const contentPage = allFiles.find(
|
|
2858
|
-
(file) => file.slug === `tags/${
|
|
2815
|
+
(file) => file.slug === `tags/${t}` || file.slug === `tags/${t}/index`
|
|
2859
2816
|
);
|
|
2860
2817
|
const root2 = contentPage?.filePath ? contentPage?.htmlAst : void 0;
|
|
2861
2818
|
const tagDesc = !root2 || root2.children.length === 0 ? contentPage?.description : htmlToJsx(root2);
|
|
2862
|
-
const tagListingPage = contentPage?.slug ?? tagPageSlug(
|
|
2863
|
-
const href = resolveRelative(
|
|
2864
|
-
return /* @__PURE__ */
|
|
2865
|
-
/* @__PURE__ */
|
|
2866
|
-
tagDesc && /* @__PURE__ */
|
|
2867
|
-
/* @__PURE__ */
|
|
2868
|
-
/* @__PURE__ */
|
|
2819
|
+
const tagListingPage = contentPage?.slug ?? tagPageSlug(t, tags);
|
|
2820
|
+
const href = resolveRelative(slug, tagListingPage);
|
|
2821
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
2822
|
+
/* @__PURE__ */ jsx("h2", { children: /* @__PURE__ */ jsx("a", { class: "internal tag-link", href, children: t }) }),
|
|
2823
|
+
tagDesc && /* @__PURE__ */ jsx("p", { children: tagDesc }),
|
|
2824
|
+
/* @__PURE__ */ jsxs("div", { class: "page-listing", children: [
|
|
2825
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
2869
2826
|
i18n(locale).pages.tagContent.itemsUnderTag({ count: pages.length }),
|
|
2870
|
-
pages.length > options.numPages && /* @__PURE__ */
|
|
2827
|
+
pages.length > options.numPages && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2871
2828
|
" ",
|
|
2872
|
-
/* @__PURE__ */
|
|
2829
|
+
/* @__PURE__ */ jsx("span", { children: i18n(locale).pages.tagContent.showingFirst({
|
|
2873
2830
|
count: options.numPages
|
|
2874
2831
|
}) })
|
|
2875
2832
|
] })
|
|
@@ -2889,11 +2846,11 @@ var TagContent_default = ((opts) => {
|
|
|
2889
2846
|
...listProps,
|
|
2890
2847
|
sort: options?.sort
|
|
2891
2848
|
});
|
|
2892
|
-
return /* @__PURE__ */
|
|
2893
|
-
/* @__PURE__ */
|
|
2894
|
-
/* @__PURE__ */
|
|
2895
|
-
/* @__PURE__ */
|
|
2896
|
-
/* @__PURE__ */
|
|
2849
|
+
return /* @__PURE__ */ jsxs("div", { class: "popover-hint", children: [
|
|
2850
|
+
/* @__PURE__ */ jsx("article", { class: classes, children: /* @__PURE__ */ jsx("div", { class: "markdown-preview-view markdown-rendered", children: content }) }),
|
|
2851
|
+
/* @__PURE__ */ jsxs("div", { class: "page-listing", children: [
|
|
2852
|
+
/* @__PURE__ */ jsx("p", { children: i18n(locale).pages.tagContent.itemsUnderTag({ count: pages.length }) }),
|
|
2853
|
+
/* @__PURE__ */ jsx("div", { children: pageListContent })
|
|
2897
2854
|
] })
|
|
2898
2855
|
] });
|
|
2899
2856
|
}
|
|
@@ -2903,15 +2860,15 @@ var TagContent_default = ((opts) => {
|
|
|
2903
2860
|
});
|
|
2904
2861
|
|
|
2905
2862
|
// src/pageType.ts
|
|
2906
|
-
var tagMatcher = ({ slug
|
|
2907
|
-
return
|
|
2863
|
+
var tagMatcher = ({ slug }) => {
|
|
2864
|
+
return slug.startsWith("tags/") || slug === "tags";
|
|
2908
2865
|
};
|
|
2909
2866
|
var TagPage = (opts) => ({
|
|
2910
2867
|
name: "TagPage",
|
|
2911
2868
|
priority: 10,
|
|
2912
2869
|
match: tagMatcher,
|
|
2913
2870
|
generate({ content, cfg }) {
|
|
2914
|
-
const allFiles = content.map((
|
|
2871
|
+
const allFiles = content.map((c) => c[1].data).filter((d) => d?.unlisted !== true);
|
|
2915
2872
|
const locale = cfg?.locale ?? "en-US";
|
|
2916
2873
|
const tags = new Set(
|
|
2917
2874
|
allFiles.flatMap((data) => data.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes)
|
|
@@ -2919,20 +2876,20 @@ var TagPage = (opts) => ({
|
|
|
2919
2876
|
tags.add("index");
|
|
2920
2877
|
const existingTagSlugs = /* @__PURE__ */ new Set();
|
|
2921
2878
|
for (const [, file] of content) {
|
|
2922
|
-
const
|
|
2923
|
-
if (
|
|
2924
|
-
existingTagSlugs.add(
|
|
2879
|
+
const slug = file.data?.slug;
|
|
2880
|
+
if (slug && slug.startsWith("tags/")) {
|
|
2881
|
+
existingTagSlugs.add(slug);
|
|
2925
2882
|
}
|
|
2926
2883
|
}
|
|
2927
2884
|
const virtualPages = [];
|
|
2928
2885
|
for (const tag of tags) {
|
|
2929
|
-
const
|
|
2886
|
+
const slug = tagPageSlug(tag, tags);
|
|
2930
2887
|
if (existingTagSlugs.has(joinSegments("tags", tag)) || existingTagSlugs.has(joinSegments("tags", tag, "index"))) {
|
|
2931
2888
|
continue;
|
|
2932
2889
|
}
|
|
2933
2890
|
const title = tag === "index" ? i18n(locale).pages.tagContent.tagIndex : opts?.prefixTags ? `${i18n(locale).pages.tagContent.tag}: ${tag}` : tag;
|
|
2934
2891
|
virtualPages.push({
|
|
2935
|
-
slug
|
|
2892
|
+
slug,
|
|
2936
2893
|
title,
|
|
2937
2894
|
data: {}
|
|
2938
2895
|
});
|