chore: commit dist/ and remove prepare script

Pre-built output is now committed to the repository so that
Quartz can skip the build step during plugin installation.
The prepare script is removed to prevent redundant builds
when installing from npm/git.
This commit is contained in:
saberzero1 2026-03-14 21:56:19 +01:00
parent eecd82fc11
commit 0703f64b0a
No known key found for this signature in database
9 changed files with 242 additions and 6 deletions

1
.gitignore vendored
View file

@ -4,7 +4,6 @@ node_modules/
.pnp.js
# Build output
dist/
build/
*.tsbuildinfo

2
dist/components/index.d.ts vendored Normal file
View file

@ -0,0 +1,2 @@
export { Backlinks, BacklinksOptions } from '../index.js';
import '@quartz-community/types';

113
dist/components/index.js vendored Normal file
View file

@ -0,0 +1,113 @@
import { simplifySlug as simplifySlug$1, joinSegments } from '@quartz-community/utils';
import { jsxs, jsx } from 'preact/jsx-runtime';
// src/util/lang.ts
function classNames(...classes) {
return classes.filter(Boolean).join(" ");
}
// src/i18n/locales/en-US.ts
var en_US_default = {
components: {
backlinks: {
title: "Backlinks",
noBacklinksFound: "No backlinks found"
}
}
};
// src/i18n/index.ts
var locales = {
"en-US": en_US_default
};
function i18n(locale) {
return locales[locale] || en_US_default;
}
// src/components/styles/backlinks.scss
var backlinks_default = ".backlinks {\n flex-direction: column;\n}\n.backlinks > h3 {\n font-size: 1rem;\n margin: 0;\n}\n.backlinks > ul.overflow {\n list-style: none;\n padding: 0;\n margin: 0.5rem 0;\n max-height: calc(100% - 2rem);\n overscroll-behavior: contain;\n}\n.backlinks > ul.overflow > li > a {\n background-color: transparent;\n}";
function simplifySlug(fp) {
return simplifySlug$1(fp);
}
function resolveRelative(current, target) {
const simplified = simplifySlug(target);
const rootPath = pathToRoot(current);
return joinSegments(rootPath, simplified);
}
function pathToRoot(slug) {
let rootPath = slug.split("/").filter((x) => x !== "").slice(0, -1).map((_) => "..").join("/");
if (rootPath.length === 0) {
rootPath = ".";
}
return rootPath;
}
var OverflowList = ({
children,
...props
}) => {
return /* @__PURE__ */ jsxs("ul", { ...props, class: [props.class, "overflow"].filter(Boolean).join(" "), id: props.id, children: [
children,
/* @__PURE__ */ jsx("li", { class: "overflow-end" })
] });
};
var numLists = 0;
var OverflowList_default = () => {
const id = `list-${numLists++}`;
return {
OverflowList: (props) => /* @__PURE__ */ jsx(OverflowList, { ...props, id }),
overflowListAfterDOMLoaded: `
document.addEventListener("nav", (e) => {
const observer = new IntersectionObserver((entries) => {
for (const entry of entries) {
const parentUl = entry.target.parentElement
if (!parentUl) return
if (entry.isIntersecting) {
parentUl.classList.remove("gradient-active")
} else {
parentUl.classList.add("gradient-active")
}
}
})
const ul = document.getElementById("${id}")
if (!ul) return
const end = ul.querySelector(".overflow-end")
if (!end) return
observer.observe(end)
})
`
};
};
var defaultOptions = {
hideWhenEmpty: true
};
var Backlinks_default = ((opts) => {
const options = { ...defaultOptions, ...opts };
const { OverflowList: OverflowList2, overflowListAfterDOMLoaded } = OverflowList_default();
const Backlinks = ({
fileData,
allFiles,
displayClass,
cfg
}) => {
const slug = simplifySlug(fileData.slug);
const locale = cfg.locale ?? "en-US";
const backlinkFiles = allFiles.filter((file) => file.links?.includes(slug));
if (options.hideWhenEmpty && backlinkFiles.length === 0) {
return null;
}
return /* @__PURE__ */ jsxs("div", { class: classNames(displayClass, "backlinks"), children: [
/* @__PURE__ */ jsx("h3", { children: i18n(locale).components.backlinks.title }),
/* @__PURE__ */ jsx(OverflowList2, { children: backlinkFiles.length > 0 ? backlinkFiles.map((f) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", { href: resolveRelative(fileData.slug, f.slug), class: "internal", children: f.frontmatter?.title }) })) : /* @__PURE__ */ jsx("li", { children: i18n(locale).components.backlinks.noBacklinksFound }) })
] });
};
Backlinks.css = backlinks_default;
Backlinks.afterDOMLoaded = overflowListAfterDOMLoaded;
return Backlinks;
});
export { Backlinks_default as Backlinks };
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map

1
dist/components/index.js.map vendored Normal file

File diff suppressed because one or more lines are too long

9
dist/index.d.ts vendored Normal file
View file

@ -0,0 +1,9 @@
import { QuartzComponent } from '@quartz-community/types';
export { QuartzComponent, QuartzComponentProps, StringResource } from '@quartz-community/types';
interface BacklinksOptions {
hideWhenEmpty: boolean;
}
declare const _default: (opts?: Partial<BacklinksOptions>) => QuartzComponent;
export { _default as Backlinks, type BacklinksOptions };

113
dist/index.js vendored Normal file
View file

@ -0,0 +1,113 @@
import { simplifySlug as simplifySlug$1, joinSegments } from '@quartz-community/utils';
import { jsxs, jsx } from 'preact/jsx-runtime';
// src/util/lang.ts
function classNames(...classes) {
return classes.filter(Boolean).join(" ");
}
// src/i18n/locales/en-US.ts
var en_US_default = {
components: {
backlinks: {
title: "Backlinks",
noBacklinksFound: "No backlinks found"
}
}
};
// src/i18n/index.ts
var locales = {
"en-US": en_US_default
};
function i18n(locale) {
return locales[locale] || en_US_default;
}
// src/components/styles/backlinks.scss
var backlinks_default = ".backlinks {\n flex-direction: column;\n}\n.backlinks > h3 {\n font-size: 1rem;\n margin: 0;\n}\n.backlinks > ul.overflow {\n list-style: none;\n padding: 0;\n margin: 0.5rem 0;\n max-height: calc(100% - 2rem);\n overscroll-behavior: contain;\n}\n.backlinks > ul.overflow > li > a {\n background-color: transparent;\n}";
function simplifySlug(fp) {
return simplifySlug$1(fp);
}
function resolveRelative(current, target) {
const simplified = simplifySlug(target);
const rootPath = pathToRoot(current);
return joinSegments(rootPath, simplified);
}
function pathToRoot(slug) {
let rootPath = slug.split("/").filter((x) => x !== "").slice(0, -1).map((_) => "..").join("/");
if (rootPath.length === 0) {
rootPath = ".";
}
return rootPath;
}
var OverflowList = ({
children,
...props
}) => {
return /* @__PURE__ */ jsxs("ul", { ...props, class: [props.class, "overflow"].filter(Boolean).join(" "), id: props.id, children: [
children,
/* @__PURE__ */ jsx("li", { class: "overflow-end" })
] });
};
var numLists = 0;
var OverflowList_default = () => {
const id = `list-${numLists++}`;
return {
OverflowList: (props) => /* @__PURE__ */ jsx(OverflowList, { ...props, id }),
overflowListAfterDOMLoaded: `
document.addEventListener("nav", (e) => {
const observer = new IntersectionObserver((entries) => {
for (const entry of entries) {
const parentUl = entry.target.parentElement
if (!parentUl) return
if (entry.isIntersecting) {
parentUl.classList.remove("gradient-active")
} else {
parentUl.classList.add("gradient-active")
}
}
})
const ul = document.getElementById("${id}")
if (!ul) return
const end = ul.querySelector(".overflow-end")
if (!end) return
observer.observe(end)
})
`
};
};
var defaultOptions = {
hideWhenEmpty: true
};
var Backlinks_default = ((opts) => {
const options = { ...defaultOptions, ...opts };
const { OverflowList: OverflowList2, overflowListAfterDOMLoaded } = OverflowList_default();
const Backlinks = ({
fileData,
allFiles,
displayClass,
cfg
}) => {
const slug = simplifySlug(fileData.slug);
const locale = cfg.locale ?? "en-US";
const backlinkFiles = allFiles.filter((file) => file.links?.includes(slug));
if (options.hideWhenEmpty && backlinkFiles.length === 0) {
return null;
}
return /* @__PURE__ */ jsxs("div", { class: classNames(displayClass, "backlinks"), children: [
/* @__PURE__ */ jsx("h3", { children: i18n(locale).components.backlinks.title }),
/* @__PURE__ */ jsx(OverflowList2, { children: backlinkFiles.length > 0 ? backlinkFiles.map((f) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", { href: resolveRelative(fileData.slug, f.slug), class: "internal", children: f.frontmatter?.title }) })) : /* @__PURE__ */ jsx("li", { children: i18n(locale).components.backlinks.noBacklinksFound }) })
] });
};
Backlinks.css = backlinks_default;
Backlinks.afterDOMLoaded = overflowListAfterDOMLoaded;
return Backlinks;
});
export { Backlinks_default as Backlinks };
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map

1
dist/index.js.map vendored Normal file

File diff suppressed because one or more lines are too long

7
package-lock.json generated
View file

@ -10,9 +10,7 @@
"license": "MIT",
"dependencies": {
"@quartz-community/types": "github:quartz-community/types",
"@quartz-community/utils": "github:quartz-community/utils",
"tsup": "^8.5.0",
"typescript": "^5.9.3"
"@quartz-community/utils": "github:quartz-community/utils"
},
"devDependencies": {
"@types/hast": "^3.0.4",
@ -25,6 +23,8 @@
"preact": "^10.28.2",
"prettier": "^3.6.2",
"sass": "^1.97.3",
"tsup": "^8.5.0",
"typescript": "^5.9.3",
"vitest": "^2.1.9"
},
"engines": {
@ -4045,7 +4045,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"nanoid": "^3.3.11",
"picocolors": "^1.1.1",

View file

@ -38,7 +38,6 @@
"sideEffects": false,
"scripts": {
"build": "tsup",
"prepare": "npm run build",
"dev": "tsup --watch",
"lint": "eslint . --max-warnings=0",
"format": "prettier . --check",