@quartz-community/tag-page 0.1.0 → 1.0.1
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 +17 -0
- package/dist/components/index.js +42 -19
- package/dist/components/index.js.map +1 -1
- package/dist/index.js +46 -21
- package/dist/index.js.map +1 -1
- package/package.json +8 -5
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
|
|
31
31
|
// node_modules/inline-style-parser/cjs/index.js
|
|
32
32
|
var require_cjs = __commonJS({
|
|
33
|
-
"node_modules/inline-style-parser/cjs/index.js"(exports
|
|
33
|
+
"node_modules/inline-style-parser/cjs/index.js"(exports, module) {
|
|
34
34
|
var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
|
|
35
35
|
var NEWLINE_REGEX = /\n/g;
|
|
36
36
|
var WHITESPACE_REGEX = /^\s*/;
|
|
@@ -168,12 +168,12 @@ var require_cjs = __commonJS({
|
|
|
168
168
|
|
|
169
169
|
// node_modules/style-to-object/cjs/index.js
|
|
170
170
|
var require_cjs2 = __commonJS({
|
|
171
|
-
"node_modules/style-to-object/cjs/index.js"(exports
|
|
172
|
-
var __importDefault = exports
|
|
171
|
+
"node_modules/style-to-object/cjs/index.js"(exports) {
|
|
172
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
173
173
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
174
174
|
};
|
|
175
|
-
Object.defineProperty(exports
|
|
176
|
-
exports
|
|
175
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
176
|
+
exports.default = StyleToObject;
|
|
177
177
|
var inline_style_parser_1 = __importDefault(require_cjs());
|
|
178
178
|
function StyleToObject(style, iterator) {
|
|
179
179
|
let styleObject = null;
|
|
@@ -201,9 +201,9 @@ var require_cjs2 = __commonJS({
|
|
|
201
201
|
|
|
202
202
|
// node_modules/style-to-js/cjs/utilities.js
|
|
203
203
|
var require_utilities = __commonJS({
|
|
204
|
-
"node_modules/style-to-js/cjs/utilities.js"(exports
|
|
205
|
-
Object.defineProperty(exports
|
|
206
|
-
exports
|
|
204
|
+
"node_modules/style-to-js/cjs/utilities.js"(exports) {
|
|
205
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
206
|
+
exports.camelCase = void 0;
|
|
207
207
|
var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;
|
|
208
208
|
var HYPHEN_REGEX = /-([a-z])/g;
|
|
209
209
|
var NO_HYPHEN_REGEX = /^[^-]+$/;
|
|
@@ -233,14 +233,14 @@ var require_utilities = __commonJS({
|
|
|
233
233
|
}
|
|
234
234
|
return property.replace(HYPHEN_REGEX, capitalize);
|
|
235
235
|
};
|
|
236
|
-
exports
|
|
236
|
+
exports.camelCase = camelCase;
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
239
|
|
|
240
240
|
// node_modules/style-to-js/cjs/index.js
|
|
241
241
|
var require_cjs3 = __commonJS({
|
|
242
|
-
"node_modules/style-to-js/cjs/index.js"(exports
|
|
243
|
-
var __importDefault = exports
|
|
242
|
+
"node_modules/style-to-js/cjs/index.js"(exports, module) {
|
|
243
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
244
244
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
245
245
|
};
|
|
246
246
|
var style_to_object_1 = __importDefault(require_cjs2());
|
|
@@ -723,6 +723,7 @@ var html = create({
|
|
|
723
723
|
allowFullScreen: boolean,
|
|
724
724
|
allowPaymentRequest: boolean,
|
|
725
725
|
allowUserMedia: boolean,
|
|
726
|
+
alpha: boolean,
|
|
726
727
|
alt: null,
|
|
727
728
|
as: null,
|
|
728
729
|
async: boolean,
|
|
@@ -736,8 +737,12 @@ var html = create({
|
|
|
736
737
|
checked: boolean,
|
|
737
738
|
cite: null,
|
|
738
739
|
className: spaceSeparated,
|
|
740
|
+
closedBy: null,
|
|
741
|
+
colorSpace: null,
|
|
739
742
|
cols: number,
|
|
740
|
-
colSpan:
|
|
743
|
+
colSpan: number,
|
|
744
|
+
command: null,
|
|
745
|
+
commandFor: null,
|
|
741
746
|
content: null,
|
|
742
747
|
contentEditable: booleanish,
|
|
743
748
|
controls: boolean,
|
|
@@ -917,8 +922,10 @@ var html = create({
|
|
|
917
922
|
seamless: boolean,
|
|
918
923
|
selected: boolean,
|
|
919
924
|
shadowRootClonable: boolean,
|
|
925
|
+
shadowRootCustomElementRegistry: boolean,
|
|
920
926
|
shadowRootDelegatesFocus: boolean,
|
|
921
927
|
shadowRootMode: null,
|
|
928
|
+
shadowRootSerializable: boolean,
|
|
922
929
|
shape: null,
|
|
923
930
|
size: number,
|
|
924
931
|
sizes: null,
|
|
@@ -1055,8 +1062,11 @@ var html = create({
|
|
|
1055
1062
|
allowTransparency: null,
|
|
1056
1063
|
autoCorrect: null,
|
|
1057
1064
|
autoSave: null,
|
|
1065
|
+
credentialless: boolean,
|
|
1058
1066
|
disablePictureInPicture: boolean,
|
|
1059
1067
|
disableRemotePlayback: boolean,
|
|
1068
|
+
exportParts: commaSeparated,
|
|
1069
|
+
part: spaceSeparated,
|
|
1060
1070
|
prefix: null,
|
|
1061
1071
|
property: null,
|
|
1062
1072
|
results: number,
|
|
@@ -1110,6 +1120,7 @@ var svg = create({
|
|
|
1110
1120
|
markerEnd: "marker-end",
|
|
1111
1121
|
markerMid: "marker-mid",
|
|
1112
1122
|
markerStart: "marker-start",
|
|
1123
|
+
maskType: "mask-type",
|
|
1113
1124
|
navDown: "nav-down",
|
|
1114
1125
|
navDownLeft: "nav-down-left",
|
|
1115
1126
|
navDownRight: "nav-down-right",
|
|
@@ -1380,6 +1391,7 @@ var svg = create({
|
|
|
1380
1391
|
markerWidth: null,
|
|
1381
1392
|
mask: null,
|
|
1382
1393
|
maskContentUnits: null,
|
|
1394
|
+
maskType: null,
|
|
1383
1395
|
maskUnits: null,
|
|
1384
1396
|
mathematical: null,
|
|
1385
1397
|
max: null,
|
|
@@ -2293,10 +2305,7 @@ function childrenToString(children) {
|
|
|
2293
2305
|
return String(children ?? "");
|
|
2294
2306
|
}
|
|
2295
2307
|
var builtinComponents = {
|
|
2296
|
-
table: (props) => /* @__PURE__ */ u2("div", {
|
|
2297
|
-
class: "table-container",
|
|
2298
|
-
children: /* @__PURE__ */ u2("table", { ...props })
|
|
2299
|
-
}),
|
|
2308
|
+
table: (props) => /* @__PURE__ */ u2("div", { class: "table-container", children: /* @__PURE__ */ u2("table", { ...props }) }),
|
|
2300
2309
|
style: ({ children, ...rest }) => k("style", { ...rest, dangerouslySetInnerHTML: { __html: childrenToString(children) } }),
|
|
2301
2310
|
script: ({ children, ...rest }) => k("script", { ...rest, dangerouslySetInnerHTML: { __html: childrenToString(children) } })
|
|
2302
2311
|
};
|
|
@@ -2775,6 +2784,19 @@ function i18n(locale) {
|
|
|
2775
2784
|
return locales[locale] || en_US_default;
|
|
2776
2785
|
}
|
|
2777
2786
|
|
|
2787
|
+
// src/util/tags.ts
|
|
2788
|
+
function hasChildTags(tag, allTags) {
|
|
2789
|
+
const prefix = `${tag}/`;
|
|
2790
|
+
for (const t2 of allTags) {
|
|
2791
|
+
if (t2.startsWith(prefix)) return true;
|
|
2792
|
+
}
|
|
2793
|
+
return false;
|
|
2794
|
+
}
|
|
2795
|
+
function tagPageSlug(tag, allTags) {
|
|
2796
|
+
if (tag === "index") return "tags/index";
|
|
2797
|
+
return hasChildTags(tag, allTags) ? joinSegments("tags", tag, "index") : joinSegments("tags", tag);
|
|
2798
|
+
}
|
|
2799
|
+
|
|
2778
2800
|
// src/components/styles/listPage.scss
|
|
2779
2801
|
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}";
|
|
2780
2802
|
|
|
@@ -2799,7 +2821,8 @@ var TagContent_default = ((opts) => {
|
|
|
2799
2821
|
if (!(slug2?.startsWith("tags/") || slug2 === "tags")) {
|
|
2800
2822
|
throw new Error(`Component "TagContent" tried to render a non-tag page: ${slug2}`);
|
|
2801
2823
|
}
|
|
2802
|
-
|
|
2824
|
+
let tag = simplifySlug(slug2.slice("tags/".length));
|
|
2825
|
+
if (tag !== "/" && tag.endsWith("/")) tag = tag.slice(0, -1);
|
|
2803
2826
|
const allPagesWithTag = (t2) => allFiles.filter(isListed).filter(
|
|
2804
2827
|
(file) => (file.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes).includes(t2)
|
|
2805
2828
|
);
|
|
@@ -2832,11 +2855,11 @@ var TagContent_default = ((opts) => {
|
|
|
2832
2855
|
sort: options?.sort
|
|
2833
2856
|
});
|
|
2834
2857
|
const contentPage = allFiles.find(
|
|
2835
|
-
(file) => file.slug === `tags/${t2}`
|
|
2858
|
+
(file) => file.slug === `tags/${t2}` || file.slug === `tags/${t2}/index`
|
|
2836
2859
|
);
|
|
2837
2860
|
const root2 = contentPage?.filePath ? contentPage?.htmlAst : void 0;
|
|
2838
2861
|
const tagDesc = !root2 || root2.children.length === 0 ? contentPage?.description : htmlToJsx(root2);
|
|
2839
|
-
const tagListingPage =
|
|
2862
|
+
const tagListingPage = contentPage?.slug ?? tagPageSlug(t2, tags);
|
|
2840
2863
|
const href = resolveRelative(slug2, tagListingPage);
|
|
2841
2864
|
return /* @__PURE__ */ u2("div", { children: [
|
|
2842
2865
|
/* @__PURE__ */ u2("h2", { children: /* @__PURE__ */ u2("a", { class: "internal tag-link", href, children: t2 }) }),
|
|
@@ -2903,8 +2926,10 @@ var TagPage = (opts) => ({
|
|
|
2903
2926
|
}
|
|
2904
2927
|
const virtualPages = [];
|
|
2905
2928
|
for (const tag of tags) {
|
|
2906
|
-
const slug2 =
|
|
2907
|
-
if (existingTagSlugs.has(
|
|
2929
|
+
const slug2 = tagPageSlug(tag, tags);
|
|
2930
|
+
if (existingTagSlugs.has(joinSegments("tags", tag)) || existingTagSlugs.has(joinSegments("tags", tag, "index"))) {
|
|
2931
|
+
continue;
|
|
2932
|
+
}
|
|
2908
2933
|
const title = tag === "index" ? i18n(locale).pages.tagContent.tagIndex : opts?.prefixTags ? `${i18n(locale).pages.tagContent.tag}: ${tag}` : tag;
|
|
2909
2934
|
virtualPages.push({
|
|
2910
2935
|
slug: slug2,
|