@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 046168d: Uses Quartz's own `preact` instead of bundling a second copy (`noExternal` in the build overrode the externals). Components now share one Preact instance with Quartz and other plugins, so hooks and context work across them, and the bundle is smaller.
|
|
8
|
+
|
|
9
|
+
## 1.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 9c6c593: Bundles `@quartz-community/utils` 1.1.0: a short wikilink to an Obsidian folder note (`[[Topic]]` for `Topic/Topic.md`) reaches the folder page, and anchors to headings use the same slug as heading ids. `github-slugger` is no longer a dependency of this plugin.
|
|
14
|
+
|
|
3
15
|
## 1.0.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/components/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { jsx, jsxs, 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,
|
|
@@ -272,9 +275,9 @@ function getDate(data) {
|
|
|
272
275
|
return dates?.[defaultDateType];
|
|
273
276
|
}
|
|
274
277
|
function byDateAndAlphabetical() {
|
|
275
|
-
return (f1,
|
|
278
|
+
return (f1, f2) => {
|
|
276
279
|
const f1Date = getDate(f1);
|
|
277
|
-
const f2Date = getDate(
|
|
280
|
+
const f2Date = getDate(f2);
|
|
278
281
|
if (f1Date && f2Date) {
|
|
279
282
|
return f2Date.getTime() - f1Date.getTime();
|
|
280
283
|
} else if (f1Date && !f2Date) {
|
|
@@ -283,12 +286,10 @@ function byDateAndAlphabetical() {
|
|
|
283
286
|
return 1;
|
|
284
287
|
}
|
|
285
288
|
const f1Title = (f1.frontmatter?.title ?? "").toLowerCase();
|
|
286
|
-
const f2Title = (
|
|
289
|
+
const f2Title = (f2.frontmatter?.title ?? "").toLowerCase();
|
|
287
290
|
return f1Title.localeCompare(f2Title);
|
|
288
291
|
};
|
|
289
292
|
}
|
|
290
|
-
|
|
291
|
-
// node_modules/@quartz-community/utils/dist/path.js
|
|
292
293
|
function simplifySlug(fp) {
|
|
293
294
|
const res = stripSlashes(trimSuffix(fp, "index"), true);
|
|
294
295
|
return res.length === 0 ? "/" : res;
|
|
@@ -308,23 +309,23 @@ function joinSegments(...args) {
|
|
|
308
309
|
}
|
|
309
310
|
return joined;
|
|
310
311
|
}
|
|
311
|
-
function endsWith(
|
|
312
|
-
return
|
|
312
|
+
function endsWith(s, suffix) {
|
|
313
|
+
return s === suffix || s.endsWith("/" + suffix);
|
|
313
314
|
}
|
|
314
|
-
function trimSuffix(
|
|
315
|
-
if (endsWith(
|
|
316
|
-
|
|
315
|
+
function trimSuffix(s, suffix) {
|
|
316
|
+
if (endsWith(s, suffix)) {
|
|
317
|
+
s = s.slice(0, -suffix.length);
|
|
317
318
|
}
|
|
318
|
-
return
|
|
319
|
+
return s;
|
|
319
320
|
}
|
|
320
|
-
function stripSlashes(
|
|
321
|
-
if (
|
|
322
|
-
|
|
321
|
+
function stripSlashes(s, onlyStripPrefix) {
|
|
322
|
+
if (s.startsWith("/")) {
|
|
323
|
+
s = s.substring(1);
|
|
323
324
|
}
|
|
324
|
-
if (!onlyStripPrefix &&
|
|
325
|
-
|
|
325
|
+
if (!onlyStripPrefix && s.endsWith("/")) {
|
|
326
|
+
s = s.slice(0, -1);
|
|
326
327
|
}
|
|
327
|
-
return
|
|
328
|
+
return s;
|
|
328
329
|
}
|
|
329
330
|
function isFolderPath(fplike) {
|
|
330
331
|
return fplike.endsWith("/") || endsWith(fplike, "index") || endsWith(fplike, "index.md") || endsWith(fplike, "index.html");
|
|
@@ -332,13 +333,13 @@ function isFolderPath(fplike) {
|
|
|
332
333
|
function getAllSegmentPrefixes(path) {
|
|
333
334
|
const segments = path.split("/");
|
|
334
335
|
const results = [];
|
|
335
|
-
for (let
|
|
336
|
-
results.push(segments.slice(0,
|
|
336
|
+
for (let i = 0; i < segments.length; i++) {
|
|
337
|
+
results.push(segments.slice(0, i + 1).join("/"));
|
|
337
338
|
}
|
|
338
339
|
return results;
|
|
339
340
|
}
|
|
340
341
|
function pathToRoot(slug2) {
|
|
341
|
-
let rootPath = slug2.split("/").filter((
|
|
342
|
+
let rootPath = slug2.split("/").filter((x) => x !== "").slice(0, -1).map((_) => "..").join("/");
|
|
342
343
|
if (rootPath.length === 0) {
|
|
343
344
|
rootPath = ".";
|
|
344
345
|
}
|
|
@@ -348,66 +349,26 @@ function resolveRelative(current, target) {
|
|
|
348
349
|
const res = joinSegments(pathToRoot(current), simplifySlug(target));
|
|
349
350
|
return res;
|
|
350
351
|
}
|
|
351
|
-
|
|
352
|
-
// node_modules/preact/dist/preact.mjs
|
|
353
|
-
var n;
|
|
354
|
-
var l;
|
|
355
|
-
var u;
|
|
356
|
-
var w = [];
|
|
357
|
-
function k(l2, u3, t2) {
|
|
358
|
-
var i2, r2, o2, e2 = {};
|
|
359
|
-
for (o2 in u3) "key" == o2 ? i2 = u3[o2] : "ref" == o2 ? r2 = u3[o2] : e2[o2] = u3[o2];
|
|
360
|
-
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]);
|
|
361
|
-
return x(l2, e2, i2, r2, null);
|
|
362
|
-
}
|
|
363
|
-
function x(n2, t2, i2, r2, o2) {
|
|
364
|
-
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 };
|
|
365
|
-
return null != l.vnode && l.vnode(e2), e2;
|
|
366
|
-
}
|
|
367
|
-
function S(n2) {
|
|
368
|
-
return n2.children;
|
|
369
|
-
}
|
|
370
|
-
n = w.slice, l = { __e: function(n2, l2, u3, t2) {
|
|
371
|
-
for (var i2, r2, o2; l2 = l2.__; ) if ((i2 = l2.__c) && !i2.__) try {
|
|
372
|
-
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;
|
|
373
|
-
} catch (l3) {
|
|
374
|
-
n2 = l3;
|
|
375
|
-
}
|
|
376
|
-
throw n2;
|
|
377
|
-
} }, u = 0, "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Math.random().toString(8);
|
|
378
|
-
|
|
379
|
-
// node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
|
|
380
|
-
var f2 = 0;
|
|
381
|
-
function u2(e2, t2, n2, o2, i2, u3) {
|
|
382
|
-
t2 || (t2 = {});
|
|
383
|
-
var a2, c2, p2 = t2;
|
|
384
|
-
if ("ref" in p2) for (c2 in p2 = {}, t2) "ref" == c2 ? a2 = t2[c2] : p2[c2] = t2[c2];
|
|
385
|
-
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 };
|
|
386
|
-
if ("function" == typeof e2 && (a2 = e2.defaultProps)) for (c2 in a2) void 0 === p2[c2] && (p2[c2] = a2[c2]);
|
|
387
|
-
return l.vnode && l.vnode(l2), l2;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
// src/components/PageList.tsx
|
|
391
352
|
function byDateAndAlphabeticalFolderFirst(_cfg) {
|
|
392
|
-
return (f1,
|
|
353
|
+
return (f1, f2) => {
|
|
393
354
|
const f1IsFolder = isFolderPath(f1.slug ?? "");
|
|
394
|
-
const f2IsFolder = isFolderPath(
|
|
355
|
+
const f2IsFolder = isFolderPath(f2.slug ?? "");
|
|
395
356
|
if (f1IsFolder && !f2IsFolder) return -1;
|
|
396
357
|
if (!f1IsFolder && f2IsFolder) return 1;
|
|
397
|
-
if (f1.dates &&
|
|
398
|
-
return (getDate(
|
|
399
|
-
} else if (f1.dates && !
|
|
358
|
+
if (f1.dates && f2.dates) {
|
|
359
|
+
return (getDate(f2)?.getTime() ?? 0) - (getDate(f1)?.getTime() ?? 0);
|
|
360
|
+
} else if (f1.dates && !f2.dates) {
|
|
400
361
|
return -1;
|
|
401
|
-
} else if (!f1.dates &&
|
|
362
|
+
} else if (!f1.dates && f2.dates) {
|
|
402
363
|
return 1;
|
|
403
364
|
}
|
|
404
365
|
const f1Title = f1.frontmatter?.title?.toLowerCase() ?? "";
|
|
405
|
-
const f2Title =
|
|
366
|
+
const f2Title = f2.frontmatter?.title?.toLowerCase() ?? "";
|
|
406
367
|
return f1Title.localeCompare(f2Title);
|
|
407
368
|
};
|
|
408
369
|
}
|
|
409
370
|
function DateDisplay({ date, locale }) {
|
|
410
|
-
return /* @__PURE__ */
|
|
371
|
+
return /* @__PURE__ */ jsx("time", { dateTime: date.toISOString(), children: date.toLocaleDateString(locale, {
|
|
411
372
|
year: "numeric",
|
|
412
373
|
month: "short",
|
|
413
374
|
day: "2-digit"
|
|
@@ -426,18 +387,18 @@ var PageList = ({
|
|
|
426
387
|
list = list.slice(0, limit);
|
|
427
388
|
}
|
|
428
389
|
const fileSlug = fileData?.slug;
|
|
429
|
-
return /* @__PURE__ */
|
|
390
|
+
return /* @__PURE__ */ jsx("ul", { class: "section-ul", children: list.map((page) => {
|
|
430
391
|
const title = page.frontmatter?.title;
|
|
431
392
|
const tags = page.frontmatter?.tags ?? [];
|
|
432
|
-
return /* @__PURE__ */
|
|
433
|
-
/* @__PURE__ */
|
|
393
|
+
return /* @__PURE__ */ jsx("li", { class: "section-li", children: /* @__PURE__ */ jsxs("div", { class: "section", children: [
|
|
394
|
+
/* @__PURE__ */ jsx("p", { class: "meta", children: page.dates && getDate(page) && /* @__PURE__ */ jsx(
|
|
434
395
|
DateDisplay,
|
|
435
396
|
{
|
|
436
397
|
date: getDate(page),
|
|
437
398
|
locale: cfg?.locale ?? "en-US"
|
|
438
399
|
}
|
|
439
400
|
) }),
|
|
440
|
-
/* @__PURE__ */
|
|
401
|
+
/* @__PURE__ */ jsx("div", { class: "desc", children: /* @__PURE__ */ jsx("h3", { children: /* @__PURE__ */ jsx(
|
|
441
402
|
"a",
|
|
442
403
|
{
|
|
443
404
|
href: resolveRelative(fileSlug ?? "", page.slug),
|
|
@@ -445,7 +406,7 @@ var PageList = ({
|
|
|
445
406
|
children: title
|
|
446
407
|
}
|
|
447
408
|
) }) }),
|
|
448
|
-
/* @__PURE__ */
|
|
409
|
+
/* @__PURE__ */ jsx("ul", { class: "tags", children: tags.map((tag) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
449
410
|
"a",
|
|
450
411
|
{
|
|
451
412
|
class: "internal tag-link",
|
|
@@ -704,7 +665,7 @@ var aria = create({
|
|
|
704
665
|
ariaValueText: null,
|
|
705
666
|
role: null
|
|
706
667
|
},
|
|
707
|
-
transform(
|
|
668
|
+
transform(_, property) {
|
|
708
669
|
return property === "role" ? property : "aria-" + property.slice(4).toLowerCase();
|
|
709
670
|
}
|
|
710
671
|
});
|
|
@@ -1669,7 +1630,7 @@ var xlink = create({
|
|
|
1669
1630
|
xLinkType: null
|
|
1670
1631
|
},
|
|
1671
1632
|
space: "xlink",
|
|
1672
|
-
transform(
|
|
1633
|
+
transform(_, property) {
|
|
1673
1634
|
return "xlink:" + property.slice(5).toLowerCase();
|
|
1674
1635
|
}
|
|
1675
1636
|
});
|
|
@@ -1686,7 +1647,7 @@ var xmlns = create({
|
|
|
1686
1647
|
var xml = create({
|
|
1687
1648
|
properties: { xmlBase: null, xmlLang: null, xmlSpace: null },
|
|
1688
1649
|
space: "xml",
|
|
1689
|
-
transform(
|
|
1650
|
+
transform(_, property) {
|
|
1690
1651
|
return "xml:" + property.slice(3).toLowerCase();
|
|
1691
1652
|
}
|
|
1692
1653
|
});
|
|
@@ -2076,7 +2037,7 @@ function root(state, node, key) {
|
|
|
2076
2037
|
addChildren(props, createChildren(state, node));
|
|
2077
2038
|
return state.create(node, state.Fragment, props, key);
|
|
2078
2039
|
}
|
|
2079
|
-
function text(
|
|
2040
|
+
function text(_, node) {
|
|
2080
2041
|
return node.value;
|
|
2081
2042
|
}
|
|
2082
2043
|
function addNode(state, props, type, node) {
|
|
@@ -2092,11 +2053,11 @@ function addChildren(props, children) {
|
|
|
2092
2053
|
}
|
|
2093
2054
|
}
|
|
2094
2055
|
}
|
|
2095
|
-
function productionCreate(
|
|
2056
|
+
function productionCreate(_, jsx4, jsxs4) {
|
|
2096
2057
|
return create2;
|
|
2097
|
-
function create2(
|
|
2058
|
+
function create2(_2, type, props, key) {
|
|
2098
2059
|
const isStaticChildren = Array.isArray(props.children);
|
|
2099
|
-
const fn = isStaticChildren ?
|
|
2060
|
+
const fn = isStaticChildren ? jsxs4 : jsx4;
|
|
2100
2061
|
return key ? fn(type, props, key) : fn(type, props);
|
|
2101
2062
|
}
|
|
2102
2063
|
}
|
|
@@ -2313,23 +2274,21 @@ function transformStyleToCssCasing(from) {
|
|
|
2313
2274
|
function toDash($0) {
|
|
2314
2275
|
return "-" + $0.toLowerCase();
|
|
2315
2276
|
}
|
|
2316
|
-
|
|
2317
|
-
// node_modules/@quartz-community/utils/dist/jsx.js
|
|
2318
2277
|
function childrenToString(children) {
|
|
2319
2278
|
if (typeof children === "string") return children;
|
|
2320
2279
|
if (Array.isArray(children)) return children.map(childrenToString).join("");
|
|
2321
2280
|
return String(children ?? "");
|
|
2322
2281
|
}
|
|
2323
2282
|
var builtinComponents = {
|
|
2324
|
-
table: (props) => /* @__PURE__ */
|
|
2325
|
-
style: ({ children, ...rest }) =>
|
|
2326
|
-
script: ({ children, ...rest }) =>
|
|
2283
|
+
table: (props) => /* @__PURE__ */ jsx("div", { class: "table-container", children: /* @__PURE__ */ jsx("table", { ...props }) }),
|
|
2284
|
+
style: ({ children, ...rest }) => h("style", { ...rest, dangerouslySetInnerHTML: { __html: childrenToString(children) } }),
|
|
2285
|
+
script: ({ children, ...rest }) => h("script", { ...rest, dangerouslySetInnerHTML: { __html: childrenToString(children) } })
|
|
2327
2286
|
};
|
|
2328
2287
|
function htmlToJsx(tree, components) {
|
|
2329
2288
|
return toJsxRuntime(tree, {
|
|
2330
|
-
Fragment
|
|
2331
|
-
jsx:
|
|
2332
|
-
jsxs:
|
|
2289
|
+
Fragment,
|
|
2290
|
+
jsx: jsx,
|
|
2291
|
+
jsxs: jsxs,
|
|
2333
2292
|
elementAttributeNameCase: "html",
|
|
2334
2293
|
components: { ...builtinComponents, ...components }
|
|
2335
2294
|
});
|
|
@@ -2803,8 +2762,8 @@ function i18n(locale) {
|
|
|
2803
2762
|
// src/util/tags.ts
|
|
2804
2763
|
function hasChildTags(tag, allTags) {
|
|
2805
2764
|
const prefix = `${tag}/`;
|
|
2806
|
-
for (const
|
|
2807
|
-
if (
|
|
2765
|
+
for (const t of allTags) {
|
|
2766
|
+
if (t.startsWith(prefix)) return true;
|
|
2808
2767
|
}
|
|
2809
2768
|
return false;
|
|
2810
2769
|
}
|
|
@@ -2815,13 +2774,11 @@ function tagPageSlug(tag, allTags) {
|
|
|
2815
2774
|
|
|
2816
2775
|
// src/components/styles/listPage.scss
|
|
2817
2776
|
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}";
|
|
2818
|
-
|
|
2819
|
-
// src/components/TagContent.tsx
|
|
2820
2777
|
var defaultOptions = {
|
|
2821
2778
|
numPages: 10
|
|
2822
2779
|
};
|
|
2823
2780
|
function concatenateResources(...resources) {
|
|
2824
|
-
const result = resources.filter((
|
|
2781
|
+
const result = resources.filter((r) => r !== void 0).flat();
|
|
2825
2782
|
return result.length === 0 ? void 0 : result;
|
|
2826
2783
|
}
|
|
2827
2784
|
function isListed(file) {
|
|
@@ -2832,15 +2789,15 @@ var TagContent_default = ((opts) => {
|
|
|
2832
2789
|
const TagContent = (props) => {
|
|
2833
2790
|
const { tree, fileData, allFiles, cfg } = props;
|
|
2834
2791
|
const fd = fileData;
|
|
2835
|
-
const
|
|
2792
|
+
const slug = fd.slug;
|
|
2836
2793
|
const locale = cfg?.locale ?? "en-US";
|
|
2837
|
-
if (!(
|
|
2838
|
-
throw new Error(`Component "TagContent" tried to render a non-tag page: ${
|
|
2794
|
+
if (!(slug?.startsWith("tags/") || slug === "tags")) {
|
|
2795
|
+
throw new Error(`Component "TagContent" tried to render a non-tag page: ${slug}`);
|
|
2839
2796
|
}
|
|
2840
|
-
let tag = simplifySlug(
|
|
2797
|
+
let tag = simplifySlug(slug.slice("tags/".length));
|
|
2841
2798
|
if (tag !== "/" && tag.endsWith("/")) tag = tag.slice(0, -1);
|
|
2842
|
-
const allPagesWithTag = (
|
|
2843
|
-
(file) => (file.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes).includes(
|
|
2799
|
+
const allPagesWithTag = (t) => allFiles.filter(isListed).filter(
|
|
2800
|
+
(file) => (file.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes).includes(t)
|
|
2844
2801
|
);
|
|
2845
2802
|
const hastRoot = tree;
|
|
2846
2803
|
const content = hastRoot.children.length === 0 ? fd.description : htmlToJsx(hastRoot);
|
|
@@ -2851,16 +2808,16 @@ var TagContent_default = ((opts) => {
|
|
|
2851
2808
|
...new Set(
|
|
2852
2809
|
allFiles.filter(isListed).flatMap((data) => data.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes)
|
|
2853
2810
|
)
|
|
2854
|
-
].sort((
|
|
2811
|
+
].sort((a, b) => a.localeCompare(b));
|
|
2855
2812
|
const tagItemMap = /* @__PURE__ */ new Map();
|
|
2856
|
-
for (const
|
|
2857
|
-
tagItemMap.set(
|
|
2813
|
+
for (const t of tags) {
|
|
2814
|
+
tagItemMap.set(t, allPagesWithTag(t));
|
|
2858
2815
|
}
|
|
2859
|
-
return /* @__PURE__ */
|
|
2860
|
-
/* @__PURE__ */
|
|
2861
|
-
/* @__PURE__ */
|
|
2862
|
-
/* @__PURE__ */
|
|
2863
|
-
const pages = tagItemMap.get(
|
|
2816
|
+
return /* @__PURE__ */ jsxs("div", { class: "popover-hint", children: [
|
|
2817
|
+
/* @__PURE__ */ jsx("article", { class: classes, children: /* @__PURE__ */ jsx("div", { class: "markdown-preview-view markdown-rendered", children: /* @__PURE__ */ jsx("p", { children: content }) }) }),
|
|
2818
|
+
/* @__PURE__ */ jsx("p", { children: i18n(locale).pages.tagContent.totalTags({ count: tags.length }) }),
|
|
2819
|
+
/* @__PURE__ */ jsx("div", { children: tags.map((t) => {
|
|
2820
|
+
const pages = tagItemMap.get(t);
|
|
2864
2821
|
const listProps = {
|
|
2865
2822
|
...props,
|
|
2866
2823
|
allFiles: pages
|
|
@@ -2871,21 +2828,21 @@ var TagContent_default = ((opts) => {
|
|
|
2871
2828
|
sort: options?.sort
|
|
2872
2829
|
});
|
|
2873
2830
|
const contentPage = allFiles.find(
|
|
2874
|
-
(file) => file.slug === `tags/${
|
|
2831
|
+
(file) => file.slug === `tags/${t}` || file.slug === `tags/${t}/index`
|
|
2875
2832
|
);
|
|
2876
2833
|
const root2 = contentPage?.filePath ? contentPage?.htmlAst : void 0;
|
|
2877
2834
|
const tagDesc = !root2 || root2.children.length === 0 ? contentPage?.description : htmlToJsx(root2);
|
|
2878
|
-
const tagListingPage = contentPage?.slug ?? tagPageSlug(
|
|
2879
|
-
const href = resolveRelative(
|
|
2880
|
-
return /* @__PURE__ */
|
|
2881
|
-
/* @__PURE__ */
|
|
2882
|
-
tagDesc && /* @__PURE__ */
|
|
2883
|
-
/* @__PURE__ */
|
|
2884
|
-
/* @__PURE__ */
|
|
2835
|
+
const tagListingPage = contentPage?.slug ?? tagPageSlug(t, tags);
|
|
2836
|
+
const href = resolveRelative(slug, tagListingPage);
|
|
2837
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
2838
|
+
/* @__PURE__ */ jsx("h2", { children: /* @__PURE__ */ jsx("a", { class: "internal tag-link", href, children: t }) }),
|
|
2839
|
+
tagDesc && /* @__PURE__ */ jsx("p", { children: tagDesc }),
|
|
2840
|
+
/* @__PURE__ */ jsxs("div", { class: "page-listing", children: [
|
|
2841
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
2885
2842
|
i18n(locale).pages.tagContent.itemsUnderTag({ count: pages.length }),
|
|
2886
|
-
pages.length > options.numPages && /* @__PURE__ */
|
|
2843
|
+
pages.length > options.numPages && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2887
2844
|
" ",
|
|
2888
|
-
/* @__PURE__ */
|
|
2845
|
+
/* @__PURE__ */ jsx("span", { children: i18n(locale).pages.tagContent.showingFirst({
|
|
2889
2846
|
count: options.numPages
|
|
2890
2847
|
}) })
|
|
2891
2848
|
] })
|
|
@@ -2905,11 +2862,11 @@ var TagContent_default = ((opts) => {
|
|
|
2905
2862
|
...listProps,
|
|
2906
2863
|
sort: options?.sort
|
|
2907
2864
|
});
|
|
2908
|
-
return /* @__PURE__ */
|
|
2909
|
-
/* @__PURE__ */
|
|
2910
|
-
/* @__PURE__ */
|
|
2911
|
-
/* @__PURE__ */
|
|
2912
|
-
/* @__PURE__ */
|
|
2865
|
+
return /* @__PURE__ */ jsxs("div", { class: "popover-hint", children: [
|
|
2866
|
+
/* @__PURE__ */ jsx("article", { class: classes, children: /* @__PURE__ */ jsx("div", { class: "markdown-preview-view markdown-rendered", children: content }) }),
|
|
2867
|
+
/* @__PURE__ */ jsxs("div", { class: "page-listing", children: [
|
|
2868
|
+
/* @__PURE__ */ jsx("p", { children: i18n(locale).pages.tagContent.itemsUnderTag({ count: pages.length }) }),
|
|
2869
|
+
/* @__PURE__ */ jsx("div", { children: pageListContent })
|
|
2913
2870
|
] })
|
|
2914
2871
|
] });
|
|
2915
2872
|
}
|