mirror of
https://github.com/quartz-community/page-title.git
synced 2026-07-22 02:50:31 +00:00
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:
parent
b059af1065
commit
40d288808b
9 changed files with 109 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -4,7 +4,6 @@ node_modules/
|
|||
.pnp.js
|
||||
|
||||
# Build output
|
||||
dist/
|
||||
build/
|
||||
*.tsbuildinfo
|
||||
|
||||
|
|
|
|||
2
dist/components/index.d.ts
vendored
Normal file
2
dist/components/index.d.ts
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export { PageTitle } from '../index.js';
|
||||
import '@quartz-community/types';
|
||||
48
dist/components/index.js
vendored
Normal file
48
dist/components/index.js
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import { jsx } from 'preact/jsx-runtime';
|
||||
|
||||
// src/util/lang.ts
|
||||
function classNames(...classes) {
|
||||
return classes.filter(Boolean).join(" ");
|
||||
}
|
||||
|
||||
// src/util/path.ts
|
||||
function pathToRoot(slug) {
|
||||
let rootPath = slug.split("/").filter((x) => x !== "").slice(0, -1).map((_) => "..").join("/");
|
||||
if (rootPath.length === 0) {
|
||||
rootPath = ".";
|
||||
}
|
||||
return rootPath;
|
||||
}
|
||||
|
||||
// src/i18n/locales/en-US.ts
|
||||
var en_US_default = {
|
||||
propertyDefaults: {
|
||||
title: "Untitled"
|
||||
}
|
||||
};
|
||||
|
||||
// src/i18n/index.ts
|
||||
var locales = {
|
||||
"en-US": en_US_default
|
||||
};
|
||||
function i18n(locale) {
|
||||
return locales[locale] || en_US_default;
|
||||
}
|
||||
var PageTitle = ({ fileData, cfg, displayClass }) => {
|
||||
const locale = cfg?.locale ?? "en-US";
|
||||
const title = cfg?.pageTitle ?? i18n(locale).propertyDefaults.title;
|
||||
const baseDir = pathToRoot(fileData.slug);
|
||||
return /* @__PURE__ */ jsx("h2", { class: classNames(displayClass, "page-title"), children: /* @__PURE__ */ jsx("a", { href: baseDir, children: title }) });
|
||||
};
|
||||
PageTitle.css = `
|
||||
.page-title {
|
||||
font-size: 1.75rem;
|
||||
margin: 0;
|
||||
font-family: var(--titleFont);
|
||||
}
|
||||
`;
|
||||
var PageTitle_default = (() => PageTitle);
|
||||
|
||||
export { PageTitle_default as PageTitle };
|
||||
//# sourceMappingURL=index.js.map
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dist/components/index.js.map
vendored
Normal file
1
dist/components/index.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../src/util/lang.ts","../../src/util/path.ts","../../src/i18n/locales/en-US.ts","../../src/i18n/index.ts","../../src/components/PageTitle.tsx"],"names":[],"mappings":";;;AAAO,SAAS,cAAc,OAAA,EAAwD;AACpF,EAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,OAAO,CAAA,CAAE,KAAK,GAAG,CAAA;AACzC;;;ACEO,SAAS,WAAW,IAAA,EAAsB;AAC/C,EAAA,IAAI,QAAA,GAAW,KACZ,KAAA,CAAM,GAAG,EACT,MAAA,CAAO,CAAC,MAAM,CAAA,KAAM,EAAE,EACtB,KAAA,CAAM,CAAA,EAAG,EAAE,CAAA,CACX,GAAA,CAAI,CAAC,CAAA,KAAM,IAAI,CAAA,CACf,IAAA,CAAK,GAAG,CAAA;AAEX,EAAA,IAAI,QAAA,CAAS,WAAW,CAAA,EAAG;AACzB,IAAA,QAAA,GAAW,GAAA;AAAA,EACb;AAEA,EAAA,OAAO,QAAA;AACT;;;ACjBA,IAAO,aAAA,GAAQ;AAAA,EACb,gBAAA,EAAkB;AAAA,IAChB,KAAA,EAAO;AAAA;AAEX,CAAA;;;ACFA,IAAM,OAAA,GAAuC;AAAA,EAC3C,OAAA,EAAS;AACX,CAAA;AAEO,SAAS,KAAK,MAAA,EAAgB;AACnC,EAAA,OAAO,OAAA,CAAQ,MAAM,CAAA,IAAK,aAAA;AAC5B;ACCA,IAAM,YAA6B,CAAC,EAAE,QAAA,EAAU,GAAA,EAAK,cAAa,KAA4B;AAC5F,EAAA,MAAM,MAAA,GAAS,KAAK,MAAA,IAAU,OAAA;AAC9B,EAAA,MAAM,QAAQ,GAAA,EAAK,SAAA,IAAa,IAAA,CAAK,MAAM,EAAE,gBAAA,CAAiB,KAAA;AAC9D,EAAA,MAAM,OAAA,GAAU,UAAA,CAAW,QAAA,CAAS,IAAc,CAAA;AAClD,EAAA,uBACE,GAAA,CAAC,IAAA,EAAA,EAAG,KAAA,EAAO,UAAA,CAAW,YAAA,EAAc,YAAY,CAAA,EAC9C,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAE,IAAA,EAAM,OAAA,EAAU,QAAA,EAAA,KAAA,EAAM,CAAA,EAC3B,CAAA;AAEJ,CAAA;AAEA,SAAA,CAAU,GAAA,GAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQhB,IAAO,qBAAS,MAAM,SAAA","file":"index.js","sourcesContent":["export function classNames(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n","/**\n * Gets the path to root from a given slug.\n * For example, \"a/b/c\" becomes \"../..\"\n */\nexport function pathToRoot(slug: string): string {\n let rootPath = slug\n .split(\"/\")\n .filter((x) => x !== \"\")\n .slice(0, -1)\n .map((_) => \"..\")\n .join(\"/\");\n\n if (rootPath.length === 0) {\n rootPath = \".\";\n }\n\n return rootPath;\n}\n","export default {\n propertyDefaults: {\n title: \"Untitled\",\n },\n};\n","import enUS from \"./locales/en-US\";\n\nconst locales: Record<string, typeof enUS> = {\n \"en-US\": enUS,\n};\n\nexport function i18n(locale: string) {\n return locales[locale] || enUS;\n}\n","import type {\n QuartzComponent,\n QuartzComponentProps,\n QuartzComponentConstructor,\n} from \"@quartz-community/types\";\nimport { classNames } from \"../util/lang\";\nimport { pathToRoot } from \"../util/path\";\nimport { i18n } from \"../i18n\";\n\nconst PageTitle: QuartzComponent = ({ fileData, cfg, displayClass }: QuartzComponentProps) => {\n const locale = cfg?.locale ?? \"en-US\";\n const title = cfg?.pageTitle ?? i18n(locale).propertyDefaults.title;\n const baseDir = pathToRoot(fileData.slug as string);\n return (\n <h2 class={classNames(displayClass, \"page-title\")}>\n <a href={baseDir}>{title}</a>\n </h2>\n );\n};\n\nPageTitle.css = `\n.page-title {\n font-size: 1.75rem;\n margin: 0;\n font-family: var(--titleFont);\n}\n`;\n\nexport default (() => PageTitle) satisfies QuartzComponentConstructor;\n"]}
|
||||
6
dist/index.d.ts
vendored
Normal file
6
dist/index.d.ts
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import { QuartzComponent } from '@quartz-community/types';
|
||||
export { QuartzComponent, QuartzComponentProps, StringResource } from '@quartz-community/types';
|
||||
|
||||
declare const _default: () => QuartzComponent;
|
||||
|
||||
export { _default as PageTitle };
|
||||
48
dist/index.js
vendored
Normal file
48
dist/index.js
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import { jsx } from 'preact/jsx-runtime';
|
||||
|
||||
// src/util/lang.ts
|
||||
function classNames(...classes) {
|
||||
return classes.filter(Boolean).join(" ");
|
||||
}
|
||||
|
||||
// src/util/path.ts
|
||||
function pathToRoot(slug) {
|
||||
let rootPath = slug.split("/").filter((x) => x !== "").slice(0, -1).map((_) => "..").join("/");
|
||||
if (rootPath.length === 0) {
|
||||
rootPath = ".";
|
||||
}
|
||||
return rootPath;
|
||||
}
|
||||
|
||||
// src/i18n/locales/en-US.ts
|
||||
var en_US_default = {
|
||||
propertyDefaults: {
|
||||
title: "Untitled"
|
||||
}
|
||||
};
|
||||
|
||||
// src/i18n/index.ts
|
||||
var locales = {
|
||||
"en-US": en_US_default
|
||||
};
|
||||
function i18n(locale) {
|
||||
return locales[locale] || en_US_default;
|
||||
}
|
||||
var PageTitle = ({ fileData, cfg, displayClass }) => {
|
||||
const locale = cfg?.locale ?? "en-US";
|
||||
const title = cfg?.pageTitle ?? i18n(locale).propertyDefaults.title;
|
||||
const baseDir = pathToRoot(fileData.slug);
|
||||
return /* @__PURE__ */ jsx("h2", { class: classNames(displayClass, "page-title"), children: /* @__PURE__ */ jsx("a", { href: baseDir, children: title }) });
|
||||
};
|
||||
PageTitle.css = `
|
||||
.page-title {
|
||||
font-size: 1.75rem;
|
||||
margin: 0;
|
||||
font-family: var(--titleFont);
|
||||
}
|
||||
`;
|
||||
var PageTitle_default = (() => PageTitle);
|
||||
|
||||
export { PageTitle_default as PageTitle };
|
||||
//# sourceMappingURL=index.js.map
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dist/index.js.map
vendored
Normal file
1
dist/index.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../src/util/lang.ts","../src/util/path.ts","../src/i18n/locales/en-US.ts","../src/i18n/index.ts","../src/components/PageTitle.tsx"],"names":[],"mappings":";;;AAAO,SAAS,cAAc,OAAA,EAAwD;AACpF,EAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,OAAO,CAAA,CAAE,KAAK,GAAG,CAAA;AACzC;;;ACEO,SAAS,WAAW,IAAA,EAAsB;AAC/C,EAAA,IAAI,QAAA,GAAW,KACZ,KAAA,CAAM,GAAG,EACT,MAAA,CAAO,CAAC,MAAM,CAAA,KAAM,EAAE,EACtB,KAAA,CAAM,CAAA,EAAG,EAAE,CAAA,CACX,GAAA,CAAI,CAAC,CAAA,KAAM,IAAI,CAAA,CACf,IAAA,CAAK,GAAG,CAAA;AAEX,EAAA,IAAI,QAAA,CAAS,WAAW,CAAA,EAAG;AACzB,IAAA,QAAA,GAAW,GAAA;AAAA,EACb;AAEA,EAAA,OAAO,QAAA;AACT;;;ACjBA,IAAO,aAAA,GAAQ;AAAA,EACb,gBAAA,EAAkB;AAAA,IAChB,KAAA,EAAO;AAAA;AAEX,CAAA;;;ACFA,IAAM,OAAA,GAAuC;AAAA,EAC3C,OAAA,EAAS;AACX,CAAA;AAEO,SAAS,KAAK,MAAA,EAAgB;AACnC,EAAA,OAAO,OAAA,CAAQ,MAAM,CAAA,IAAK,aAAA;AAC5B;ACCA,IAAM,YAA6B,CAAC,EAAE,QAAA,EAAU,GAAA,EAAK,cAAa,KAA4B;AAC5F,EAAA,MAAM,MAAA,GAAS,KAAK,MAAA,IAAU,OAAA;AAC9B,EAAA,MAAM,QAAQ,GAAA,EAAK,SAAA,IAAa,IAAA,CAAK,MAAM,EAAE,gBAAA,CAAiB,KAAA;AAC9D,EAAA,MAAM,OAAA,GAAU,UAAA,CAAW,QAAA,CAAS,IAAc,CAAA;AAClD,EAAA,uBACE,GAAA,CAAC,IAAA,EAAA,EAAG,KAAA,EAAO,UAAA,CAAW,YAAA,EAAc,YAAY,CAAA,EAC9C,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAE,IAAA,EAAM,OAAA,EAAU,QAAA,EAAA,KAAA,EAAM,CAAA,EAC3B,CAAA;AAEJ,CAAA;AAEA,SAAA,CAAU,GAAA,GAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQhB,IAAO,qBAAS,MAAM,SAAA","file":"index.js","sourcesContent":["export function classNames(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n","/**\n * Gets the path to root from a given slug.\n * For example, \"a/b/c\" becomes \"../..\"\n */\nexport function pathToRoot(slug: string): string {\n let rootPath = slug\n .split(\"/\")\n .filter((x) => x !== \"\")\n .slice(0, -1)\n .map((_) => \"..\")\n .join(\"/\");\n\n if (rootPath.length === 0) {\n rootPath = \".\";\n }\n\n return rootPath;\n}\n","export default {\n propertyDefaults: {\n title: \"Untitled\",\n },\n};\n","import enUS from \"./locales/en-US\";\n\nconst locales: Record<string, typeof enUS> = {\n \"en-US\": enUS,\n};\n\nexport function i18n(locale: string) {\n return locales[locale] || enUS;\n}\n","import type {\n QuartzComponent,\n QuartzComponentProps,\n QuartzComponentConstructor,\n} from \"@quartz-community/types\";\nimport { classNames } from \"../util/lang\";\nimport { pathToRoot } from \"../util/path\";\nimport { i18n } from \"../i18n\";\n\nconst PageTitle: QuartzComponent = ({ fileData, cfg, displayClass }: QuartzComponentProps) => {\n const locale = cfg?.locale ?? \"en-US\";\n const title = cfg?.pageTitle ?? i18n(locale).propertyDefaults.title;\n const baseDir = pathToRoot(fileData.slug as string);\n return (\n <h2 class={classNames(displayClass, \"page-title\")}>\n <a href={baseDir}>{title}</a>\n </h2>\n );\n};\n\nPageTitle.css = `\n.page-title {\n font-size: 1.75rem;\n margin: 0;\n font-family: var(--titleFont);\n}\n`;\n\nexport default (() => PageTitle) satisfies QuartzComponentConstructor;\n"]}
|
||||
7
package-lock.json
generated
7
package-lock.json
generated
|
|
@ -9,9 +9,7 @@
|
|||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "github:quartz-community/types",
|
||||
"tsup": "^8.5.0",
|
||||
"typescript": "^5.9.3"
|
||||
"@quartz-community/types": "github:quartz-community/types"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/hast": "^3.0.4",
|
||||
|
|
@ -23,6 +21,8 @@
|
|||
"eslint-config-prettier": "^9.1.0",
|
||||
"preact": "^10.28.2",
|
||||
"prettier": "^3.6.2",
|
||||
"tsup": "^8.5.0",
|
||||
"typescript": "^5.9.3",
|
||||
"vitest": "^2.1.9"
|
||||
},
|
||||
"engines": {
|
||||
|
|
@ -2862,7 +2862,6 @@
|
|||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.11",
|
||||
"picocolors": "^1.1.1",
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"prepare": "npm run build",
|
||||
"dev": "tsup --watch",
|
||||
"lint": "eslint . --max-warnings=0",
|
||||
"format": "prettier . --check",
|
||||
|
|
|
|||
Loading…
Reference in a new issue