From 8ac59ae70d65a620dde8bddf8428f27a68d67833 Mon Sep 17 00:00:00 2001 From: saberzero1 Date: Sat, 14 Mar 2026 22:00:25 +0100 Subject: [PATCH] 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. --- .gitignore | 1 - dist/components/index.js | 199 ++++++++++++++++++ dist/components/index.js.map | 1 + dist/index.js | 391 +++++++++++++++++++++++++++++++++++ dist/index.js.map | 1 + dist/types.js | 3 + dist/types.js.map | 1 + package-lock.json | 142 ++++--------- package.json | 1 - 9 files changed, 637 insertions(+), 103 deletions(-) create mode 100644 dist/components/index.js create mode 100644 dist/components/index.js.map create mode 100644 dist/index.js create mode 100644 dist/index.js.map create mode 100644 dist/types.js create mode 100644 dist/types.js.map diff --git a/.gitignore b/.gitignore index 657842b..ef88793 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ node_modules/ .pnp.js # Build output -dist/ build/ *.tsbuildinfo diff --git a/dist/components/index.js b/dist/components/index.js new file mode 100644 index 0000000..e7ca704 --- /dev/null +++ b/dist/components/index.js @@ -0,0 +1,199 @@ +import { joinSegments, simplifySlug as simplifySlug$1 } from '@quartz-community/utils'; +import { jsxs, jsx, Fragment } from 'preact/jsx-runtime'; + +// src/util/lang.ts +function classNames(...classes) { + return classes.filter(Boolean).join(" "); +} +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; +} + +// src/i18n/locales/en-US.ts +var en_US_default = { + components: { + noteProperties: { + title: "Properties" + } + } +}; + +// src/i18n/index.ts +var locales = { + "en-US": en_US_default +}; +function i18n(locale) { + return locales[locale] || en_US_default; +} + +// src/components/styles/noteProperties.scss +var noteProperties_default = '.note-properties {\n margin: 0.5rem 0 1rem;\n border: 1px solid var(--lightgray);\n border-radius: 5px;\n font-size: 0.9rem;\n}\n.note-properties[open] > .note-properties-header {\n border-bottom: 1px solid var(--lightgray);\n}\n.note-properties .note-properties-header {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.4rem 0.8rem;\n cursor: pointer;\n user-select: none;\n list-style: none;\n color: var(--darkgray);\n font-weight: 600;\n}\n.note-properties .note-properties-header::-webkit-details-marker {\n display: none;\n}\n.note-properties .note-properties-header::before {\n content: "";\n display: inline-block;\n width: 0.5em;\n height: 0.5em;\n border-right: 2px solid var(--darkgray);\n border-bottom: 2px solid var(--darkgray);\n transform: rotate(-45deg);\n transition: transform 0.2s ease;\n}\n.note-properties[open] > .note-properties-header::before {\n transform: rotate(45deg);\n}\n.note-properties .note-properties-count {\n margin-left: auto;\n font-size: 0.75rem;\n color: var(--gray);\n font-weight: 400;\n}\n.note-properties .note-properties-table {\n width: 100%;\n border-collapse: collapse;\n table-layout: fixed;\n}\n.note-properties .note-properties-row {\n border-bottom: 1px solid var(--lightgray);\n}\n.note-properties .note-properties-row:last-child {\n border-bottom: none;\n}\n.note-properties .note-properties-key {\n width: 35%;\n padding: 0.35rem 0.8rem;\n color: var(--gray);\n font-size: 0.85rem;\n vertical-align: top;\n word-break: break-word;\n}\n.note-properties .note-properties-value {\n padding: 0.35rem 0.8rem;\n vertical-align: top;\n word-break: break-word;\n}\n.note-properties .note-properties-empty {\n color: var(--gray);\n font-style: italic;\n}\n.note-properties .note-properties-boolean input[type=checkbox] {\n pointer-events: none;\n margin: 0;\n vertical-align: middle;\n}\n.note-properties .note-properties-number {\n font-family: var(--codeFont);\n font-size: 0.85em;\n}\n.note-properties .note-properties-link {\n text-decoration: none;\n color: var(--secondary);\n}\n.note-properties .note-properties-link:hover {\n text-decoration: underline;\n}\n.note-properties .note-properties-separator {\n color: var(--gray);\n}\n.note-properties .note-properties-list {\n display: inline;\n}\n.note-properties .note-properties-tags {\n display: inline;\n}\n.note-properties .note-properties-tags .tag-link {\n display: inline-block;\n padding: 0.1rem 0.4rem;\n border-radius: 3px;\n background: var(--highlight);\n color: var(--secondary);\n font-size: 0.85em;\n text-decoration: none;\n}\n.note-properties .note-properties-tags .tag-link:hover {\n background: var(--secondary);\n color: var(--light);\n}\n.note-properties .note-properties-object code {\n font-size: 0.85em;\n padding: 0.1rem 0.3rem;\n border-radius: 3px;\n background: var(--highlight);\n word-break: break-all;\n}'; + +// src/components/scripts/noteProperties.inline.ts +var noteProperties_inline_default = 'var o="note-properties-collapsed";function d(){let e=document.querySelector("details.note-properties");if(!e)return;let t=localStorage.getItem(o);if(t!==null){let i=t==="true";e.open=!i}let n=()=>{localStorage.setItem(o,String(!e.open))};e.addEventListener("toggle",n),typeof window<"u"&&window.addCleanup&&window.addCleanup(()=>{e.removeEventListener("toggle",n)})}document.addEventListener("nav",()=>{d()});document.addEventListener("render",()=>{d()});\n'; +var WIKILINK_RE = /\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g; +var MDLINK_RE = /\[([^\]]*)\]\(([^)]+)\)/g; +var URL_RE = /https?:\/\/[^\s<>]+/g; +function renderTextWithLinks(text, ctx) { + const segments = []; + for (const match of text.matchAll(WIKILINK_RE)) { + const target = match[1]; + const display = match[2] ?? target; + const href = resolveRelative(ctx.slug, target); + segments.push({ + start: match.index, + end: match.index + match[0].length, + node: /* @__PURE__ */ jsx("a", { href, class: "internal note-properties-link", children: display }) + }); + } + for (const match of text.matchAll(MDLINK_RE)) { + const overlaps = segments.some( + (s) => match.index < s.end && match.index + match[0].length > s.start + ); + if (overlaps) continue; + const display = match[1]; + const href = match[2]; + const isExternal = href.startsWith("http://") || href.startsWith("https://"); + const resolvedHref = isExternal ? href : resolveRelative(ctx.slug, href); + segments.push({ + start: match.index, + end: match.index + match[0].length, + node: /* @__PURE__ */ jsx( + "a", + { + href: resolvedHref, + class: classNames(isExternal ? "external" : "internal", "note-properties-link"), + ...isExternal ? { target: "_blank", rel: "noopener noreferrer" } : {}, + children: display || href + } + ) + }); + } + for (const match of text.matchAll(URL_RE)) { + const overlaps = segments.some( + (s) => match.index < s.end && match.index + match[0].length > s.start + ); + if (overlaps) continue; + segments.push({ + start: match.index, + end: match.index + match[0].length, + node: /* @__PURE__ */ jsx( + "a", + { + href: match[0], + class: "external note-properties-link", + target: "_blank", + rel: "noopener noreferrer", + children: match[0] + } + ) + }); + } + if (segments.length === 0) return [text]; + segments.sort((a, b) => a.start - b.start); + const result = []; + let cursor = 0; + for (const seg of segments) { + if (seg.start > cursor) { + result.push(text.slice(cursor, seg.start)); + } + result.push(seg.node); + cursor = seg.end; + } + if (cursor < text.length) { + result.push(text.slice(cursor)); + } + return result; +} +function renderValue(value, ctx) { + if (value === null || value === void 0) { + return /* @__PURE__ */ jsx("span", { class: "note-properties-empty", children: "\u2014" }); + } + if (typeof value === "boolean") { + return /* @__PURE__ */ jsx("span", { class: classNames("note-properties-boolean", value ? "is-true" : "is-false"), children: /* @__PURE__ */ jsx("input", { type: "checkbox", checked: value, disabled: true }) }); + } + if (typeof value === "number") { + return /* @__PURE__ */ jsx("span", { class: "note-properties-number", children: value }); + } + if (typeof value === "string") { + const parts = renderTextWithLinks(value, ctx); + return /* @__PURE__ */ jsx("span", { class: "note-properties-text", children: parts }); + } + if (Array.isArray(value)) { + const items = value.map((item, idx) => { + const rendered = renderValue(item, ctx); + return /* @__PURE__ */ jsxs(Fragment, { children: [ + idx > 0 && /* @__PURE__ */ jsx("span", { class: "note-properties-separator", children: ", " }), + rendered + ] }); + }); + return /* @__PURE__ */ jsx("span", { class: "note-properties-list", children: items }); + } + if (typeof value === "object") { + return /* @__PURE__ */ jsx("span", { class: "note-properties-object", children: /* @__PURE__ */ jsx("code", { children: JSON.stringify(value) }) }); + } + return String(value); +} +function renderTagList(tags, ctx) { + const items = tags.map((tag, idx) => { + const href = resolveRelative(ctx.slug, `tags/${tag}`); + return /* @__PURE__ */ jsxs(Fragment, { children: [ + idx > 0 && /* @__PURE__ */ jsx("span", { class: "note-properties-separator", children: ", " }), + /* @__PURE__ */ jsx("a", { href, class: "internal tag-link", children: tag }) + ] }); + }); + return /* @__PURE__ */ jsx("span", { class: "note-properties-tags", children: items }); +} +var NoteProperties_default = ((opts) => { + const { collapsed = false } = opts ?? {}; + const Component = (props) => { + const noteProps = props.fileData?.noteProperties; + if (!noteProps) return null; + if (noteProps.showProperties === false) return null; + if (noteProps.showProperties !== true && noteProps.hideView) return null; + const properties = noteProps.properties; + const entries = Object.entries(properties); + if (entries.length === 0) return null; + const locale = props.cfg?.locale || "en-US"; + const i18nData = i18n(locale); + const ctx = { slug: props.fileData?.slug ?? "" }; + const isCollapsed = noteProps.collapseProperties ?? collapsed; + return /* @__PURE__ */ jsxs( + "details", + { + class: classNames(props.displayClass, "note-properties"), + open: !isCollapsed, + "data-collapsed": isCollapsed, + children: [ + /* @__PURE__ */ jsxs("summary", { class: "note-properties-header", children: [ + /* @__PURE__ */ jsx("span", { class: "note-properties-title", children: i18nData.components.noteProperties.title }), + /* @__PURE__ */ jsx("span", { class: "note-properties-count", children: entries.length }) + ] }), + /* @__PURE__ */ jsx("table", { class: "note-properties-table", children: /* @__PURE__ */ jsx("tbody", { children: entries.map(([key, value]) => /* @__PURE__ */ jsxs("tr", { class: "note-properties-row", children: [ + /* @__PURE__ */ jsx("td", { class: "note-properties-key", children: key }), + /* @__PURE__ */ jsx("td", { class: "note-properties-value", children: key === "tags" && Array.isArray(value) ? renderTagList(value, ctx) : renderValue(value, ctx) }) + ] }, key)) }) }) + ] + } + ); + }; + Component.css = noteProperties_default; + Component.afterDOMLoaded = noteProperties_inline_default; + return Component; +}); + +export { NoteProperties_default as NotePropertiesComponent }; +//# sourceMappingURL=index.js.map +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/components/index.js.map b/dist/components/index.js.map new file mode 100644 index 0000000..13e36aa --- /dev/null +++ b/dist/components/index.js.map @@ -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/styles/noteProperties.scss","../../src/components/scripts/noteProperties.inline.ts","../../src/components/NoteProperties.tsx"],"names":["utilSimplifySlug"],"mappings":";;;;AAAO,SAAS,cAAc,OAAA,EAAwD;AACpF,EAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,OAAO,CAAA,CAAE,KAAK,GAAG,CAAA;AACzC;ACAO,SAAS,aAAa,EAAA,EAAoB;AAC/C,EAAA,OAAOA,eAAiB,EAAE,CAAA;AAC5B;AAEO,SAAS,eAAA,CAAgB,SAAiB,MAAA,EAAwB;AACvE,EAAA,MAAM,UAAA,GAAa,aAAa,MAAM,CAAA;AACtC,EAAA,MAAM,QAAA,GAAW,WAAW,OAAO,CAAA;AACnC,EAAA,OAAO,YAAA,CAAa,UAAU,UAAU,CAAA;AAC1C;AAEA,SAAS,WAAW,IAAA,EAAsB;AACxC,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;;;ACzBA,IAAO,aAAA,GAAQ;AAAA,EACb,UAAA,EAAY;AAAA,IACV,cAAA,EAAgB;AAAA,MACd,KAAA,EAAO;AAAA;AACT;AAEJ,CAAA;;;ACJA,IAAM,OAAA,GAAuC;AAAA,EAC3C,OAAA,EAAS;AACX,CAAA;AAEO,SAAS,KAAK,MAAA,EAAgB;AACnC,EAAA,OAAO,OAAA,CAAQ,MAAM,CAAA,IAAK,aAAA;AAC5B;;;ACRA,IAAA,sBAA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AA,EAAM,qBAAA,EAAuB,QAAA,EAAA,GAAA,EAAI,CAAA;AAAA,gCACpC,IAAA,EAAA,EAAG,KAAA,EAAM,uBAAA,EACP,QAAA,EAAA,GAAA,KAAQ,UAAU,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,GAClC,cAAc,KAAA,EAAmB,GAAG,IACpC,WAAA,CAAY,KAAA,EAAO,GAAG,CAAA,EAC5B;AAAA,WAAA,EAAA,EANO,GAOT,CACD,CAAA,EACH,CAAA,EACF;AAAA;AAAA;AAAA,KACF;AAAA,EAEJ,CAAA;AAEA,EAAA,SAAA,CAAU,GAAA,GAAM,sBAAA;AAChB,EAAA,SAAA,CAAU,cAAA,GAAiB,6BAAA;AAE3B,EAAA,OAAO,SAAA;AACT,CAAA","file":"index.js","sourcesContent":["export function classNames(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n","import { simplifySlug as utilSimplifySlug, joinSegments } from \"@quartz-community/utils\";\n\nexport function simplifySlug(fp: string): string {\n return utilSimplifySlug(fp);\n}\n\nexport function resolveRelative(current: string, target: string): string {\n const simplified = simplifySlug(target);\n const rootPath = pathToRoot(current);\n return joinSegments(rootPath, simplified);\n}\n\nfunction 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 components: {\n noteProperties: {\n title: \"Properties\",\n },\n },\n};\n","import enUS from \"./locales/en-US\";\n\nconst locales: Record = {\n \"en-US\": enUS,\n};\n\nexport function i18n(locale: string) {\n return locales[locale] || enUS;\n}\n",".note-properties {\n margin: 0.5rem 0 1rem;\n border: 1px solid var(--lightgray);\n border-radius: 5px;\n font-size: 0.9rem;\n}\n.note-properties[open] > .note-properties-header {\n border-bottom: 1px solid var(--lightgray);\n}\n.note-properties .note-properties-header {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.4rem 0.8rem;\n cursor: pointer;\n user-select: none;\n list-style: none;\n color: var(--darkgray);\n font-weight: 600;\n}\n.note-properties .note-properties-header::-webkit-details-marker {\n display: none;\n}\n.note-properties .note-properties-header::before {\n content: \"\";\n display: inline-block;\n width: 0.5em;\n height: 0.5em;\n border-right: 2px solid var(--darkgray);\n border-bottom: 2px solid var(--darkgray);\n transform: rotate(-45deg);\n transition: transform 0.2s ease;\n}\n.note-properties[open] > .note-properties-header::before {\n transform: rotate(45deg);\n}\n.note-properties .note-properties-count {\n margin-left: auto;\n font-size: 0.75rem;\n color: var(--gray);\n font-weight: 400;\n}\n.note-properties .note-properties-table {\n width: 100%;\n border-collapse: collapse;\n table-layout: fixed;\n}\n.note-properties .note-properties-row {\n border-bottom: 1px solid var(--lightgray);\n}\n.note-properties .note-properties-row:last-child {\n border-bottom: none;\n}\n.note-properties .note-properties-key {\n width: 35%;\n padding: 0.35rem 0.8rem;\n color: var(--gray);\n font-size: 0.85rem;\n vertical-align: top;\n word-break: break-word;\n}\n.note-properties .note-properties-value {\n padding: 0.35rem 0.8rem;\n vertical-align: top;\n word-break: break-word;\n}\n.note-properties .note-properties-empty {\n color: var(--gray);\n font-style: italic;\n}\n.note-properties .note-properties-boolean input[type=checkbox] {\n pointer-events: none;\n margin: 0;\n vertical-align: middle;\n}\n.note-properties .note-properties-number {\n font-family: var(--codeFont);\n font-size: 0.85em;\n}\n.note-properties .note-properties-link {\n text-decoration: none;\n color: var(--secondary);\n}\n.note-properties .note-properties-link:hover {\n text-decoration: underline;\n}\n.note-properties .note-properties-separator {\n color: var(--gray);\n}\n.note-properties .note-properties-list {\n display: inline;\n}\n.note-properties .note-properties-tags {\n display: inline;\n}\n.note-properties .note-properties-tags .tag-link {\n display: inline-block;\n padding: 0.1rem 0.4rem;\n border-radius: 3px;\n background: var(--highlight);\n color: var(--secondary);\n font-size: 0.85em;\n text-decoration: none;\n}\n.note-properties .note-properties-tags .tag-link:hover {\n background: var(--secondary);\n color: var(--light);\n}\n.note-properties .note-properties-object code {\n font-size: 0.85em;\n padding: 0.1rem 0.3rem;\n border-radius: 3px;\n background: var(--highlight);\n word-break: break-all;\n}","var o=\"note-properties-collapsed\";function d(){let e=document.querySelector(\"details.note-properties\");if(!e)return;let t=localStorage.getItem(o);if(t!==null){let i=t===\"true\";e.open=!i}let n=()=>{localStorage.setItem(o,String(!e.open))};e.addEventListener(\"toggle\",n),typeof window<\"u\"&&window.addCleanup&&window.addCleanup(()=>{e.removeEventListener(\"toggle\",n)})}document.addEventListener(\"nav\",()=>{d()});document.addEventListener(\"render\",()=>{d()});\n","import type {\n QuartzComponent,\n QuartzComponentProps,\n QuartzComponentConstructor,\n} from \"@quartz-community/types\";\nimport { classNames } from \"../util/lang\";\nimport { resolveRelative } from \"../util/path\";\nimport { i18n } from \"../i18n\";\nimport style from \"./styles/noteProperties.scss\";\n// @ts-expect-error - inline script import handled by Quartz bundler\nimport script from \"./scripts/noteProperties.inline.ts\";\n\nexport interface NotePropertiesComponentOptions {\n collapsed?: boolean;\n}\n\nconst WIKILINK_RE = /\\[\\[([^\\]|]+)(?:\\|([^\\]]+))?\\]\\]/g;\nconst MDLINK_RE = /\\[([^\\]]*)\\]\\(([^)]+)\\)/g;\nconst URL_RE = /https?:\\/\\/[^\\s<>]+/g;\n\ntype RenderCtx = { slug: string };\n\nfunction renderTextWithLinks(text: string, ctx: RenderCtx): (preact.JSX.Element | string)[] {\n const segments: { start: number; end: number; node: preact.JSX.Element }[] = [];\n for (const match of text.matchAll(WIKILINK_RE)) {\n const target = match[1]!;\n const display = match[2] ?? target;\n const href = resolveRelative(ctx.slug, target);\n segments.push({\n start: match.index,\n end: match.index + match[0].length,\n node: (\n \n {display}\n \n ),\n });\n }\n\n for (const match of text.matchAll(MDLINK_RE)) {\n const overlaps = segments.some(\n (s) => match.index < s.end && match.index + match[0].length > s.start,\n );\n if (overlaps) continue;\n const display = match[1]!;\n const href = match[2]!;\n const isExternal = href.startsWith(\"http://\") || href.startsWith(\"https://\");\n const resolvedHref = isExternal ? href : resolveRelative(ctx.slug, href);\n segments.push({\n start: match.index,\n end: match.index + match[0].length,\n node: (\n \n {display || href}\n \n ),\n });\n }\n\n for (const match of text.matchAll(URL_RE)) {\n const overlaps = segments.some(\n (s) => match.index < s.end && match.index + match[0].length > s.start,\n );\n if (overlaps) continue;\n\n segments.push({\n start: match.index,\n end: match.index + match[0].length,\n node: (\n \n {match[0]}\n \n ),\n });\n }\n\n if (segments.length === 0) return [text];\n\n segments.sort((a, b) => a.start - b.start);\n\n const result: (preact.JSX.Element | string)[] = [];\n let cursor = 0;\n for (const seg of segments) {\n if (seg.start > cursor) {\n result.push(text.slice(cursor, seg.start));\n }\n result.push(seg.node);\n cursor = seg.end;\n }\n if (cursor < text.length) {\n result.push(text.slice(cursor));\n }\n\n return result;\n}\n\nfunction renderValue(value: unknown, ctx: RenderCtx): preact.JSX.Element | string {\n if (value === null || value === undefined) {\n return ;\n }\n\n if (typeof value === \"boolean\") {\n return (\n \n \n \n );\n }\n\n if (typeof value === \"number\") {\n return {value};\n }\n\n if (typeof value === \"string\") {\n const parts = renderTextWithLinks(value, ctx);\n return {parts};\n }\n\n if (Array.isArray(value)) {\n const items = value.map((item, idx) => {\n const rendered = renderValue(item, ctx);\n return (\n <>\n {idx > 0 && , }\n {rendered}\n \n );\n });\n return {items};\n }\n\n if (typeof value === \"object\") {\n return (\n \n {JSON.stringify(value)}\n \n );\n }\n\n return String(value);\n}\n\nfunction renderTagList(tags: string[], ctx: RenderCtx): preact.JSX.Element {\n const items = tags.map((tag, idx) => {\n const href = resolveRelative(ctx.slug, `tags/${tag}`);\n return (\n <>\n {idx > 0 && , }\n \n {tag}\n \n \n );\n });\n return {items};\n}\n\nexport default ((opts?: NotePropertiesComponentOptions) => {\n const { collapsed = false } = opts ?? {};\n\n const Component: QuartzComponent = (props: QuartzComponentProps) => {\n const noteProps = props.fileData?.noteProperties as\n | {\n properties: Record;\n hideView: boolean;\n showProperties?: boolean;\n collapseProperties?: boolean;\n }\n | undefined;\n if (!noteProps) return null;\n\n // Per-note override takes precedence over global config\n // showProperties: true = force show, false = force hide, undefined = follow hideView config\n if (noteProps.showProperties === false) return null;\n if (noteProps.showProperties !== true && noteProps.hideView) return null;\n\n const properties = noteProps.properties;\n const entries = Object.entries(properties);\n if (entries.length === 0) return null;\n\n const locale = props.cfg?.locale || \"en-US\";\n const i18nData = i18n(locale);\n const ctx: RenderCtx = { slug: (props.fileData?.slug as string) ?? \"\" };\n\n // Per-note collapse override takes precedence over component option\n const isCollapsed = noteProps.collapseProperties ?? collapsed;\n return (\n \n \n {i18nData.components.noteProperties.title}\n {entries.length}\n \n \n \n {entries.map(([key, value]) => (\n \n \n \n \n ))}\n \n
{key}\n {key === \"tags\" && Array.isArray(value)\n ? renderTagList(value as string[], ctx)\n : renderValue(value, ctx)}\n
\n \n );\n };\n\n Component.css = style;\n Component.afterDOMLoaded = script;\n\n return Component;\n}) satisfies QuartzComponentConstructor;\n"]} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..1c93eb1 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,391 @@ +import matter from 'gray-matter'; +import remarkFrontmatter from 'remark-frontmatter'; +import yaml from 'js-yaml'; +import toml from 'toml'; +import { joinSegments, simplifySlug as simplifySlug$1 } from '@quartz-community/utils'; +import { jsxs, jsx, Fragment } from 'preact/jsx-runtime'; + +// src/transformer.ts +var defaultOptions = { + includeAll: false, + includedProperties: ["description", "tags", "aliases"], + excludedProperties: [], + hidePropertiesView: false, + delimiters: "---", + language: "yaml" +}; +function coalesceAliases(data, aliases) { + for (const alias of aliases) { + if (data[alias] !== void 0 && data[alias] !== null) return data[alias]; + } +} +function coerceToArray(input) { + if (input === void 0 || input === null) return void 0; + if (!Array.isArray(input)) { + return String(input).split(",").map((s) => s.trim()); + } + return input.filter((v) => typeof v === "string" || typeof v === "number").map((v) => v.toString()); +} +function slugTag(tag) { + return tag.split("/").map( + (segment) => segment.replace(/\s+/g, "-").replace(/[^\w\p{L}\p{M}\p{N}/-]/gu, "").toLowerCase() + ).join("/"); +} +function getFileExtension(fp) { + return fp.split(".").pop() ?? ""; +} +function slugifyFilePath(fp) { + fp = fp.replace(/\\/g, "/"); + fp = fp.replace(/\.md$/, ""); + let slug = fp.split("/").map((segment) => segment.replace(/\s+/g, "-").replace(/[^\w\p{L}\p{M}\p{N}/-]/gu, "")).join("/"); + slug = slug.replace(/\/$/, ""); + return slug; +} +function getAliasSlugs(aliases) { + return aliases.map((alias) => { + const isMd = getFileExtension(alias) === "md"; + const mockFp = isMd ? alias : alias + ".md"; + return slugifyFilePath(mockFp); + }); +} +var WIKILINK_PATTERN = /\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g; +var MDLINK_PATTERN = /\[(?:[^\]]*)\]\(([^)]+)\)/g; +function extractLinksFromValue(value) { + if (typeof value === "string") { + const links = []; + let match; + WIKILINK_PATTERN.lastIndex = 0; + while ((match = WIKILINK_PATTERN.exec(value)) !== null) { + links.push(match[1]); + } + MDLINK_PATTERN.lastIndex = 0; + while ((match = MDLINK_PATTERN.exec(value)) !== null) { + links.push(match[1]); + } + return links; + } + if (Array.isArray(value)) { + return value.flatMap((item) => extractLinksFromValue(item)); + } + if (value !== null && typeof value === "object") { + return Object.values(value).flatMap((v) => extractLinksFromValue(v)); + } + return []; +} +var QUARTZ_INTERNAL_KEYS = /* @__PURE__ */ new Set([ + "quartz-properties", + "quartzProperties", + "quartz-properties-collapse", + "quartzPropertiesCollapse" +]); +function coerceToBool(value) { + if (value === void 0 || value === null) return void 0; + if (typeof value === "boolean") return value; + if (typeof value === "string") { + const lower = value.toLowerCase(); + if (lower === "true") return true; + if (lower === "false") return false; + } + return void 0; +} +function getVisibleProperties(data, opts) { + const excluded = new Set(opts.excludedProperties); + for (const key of QUARTZ_INTERNAL_KEYS) { + excluded.add(key); + } + if (opts.includeAll) { + const result2 = {}; + for (const [key, value] of Object.entries(data)) { + if (!excluded.has(key)) { + result2[key] = value; + } + } + return result2; + } + const result = {}; + for (const key of opts.includedProperties) { + if (!excluded.has(key) && data[key] !== void 0) { + result[key] = data[key]; + } + } + return result; +} +var NoteProperties = (userOpts) => { + const opts = { ...defaultOptions, ...userOpts }; + return { + name: "NoteProperties", + markdownPlugins(_ctx) { + const { allSlugs } = _ctx; + return [ + [remarkFrontmatter, ["yaml", "toml"]], + () => { + return (_, file) => { + const fileData = Buffer.from(file.value); + const { data } = matter(fileData, { + delimiters: opts.delimiters, + language: opts.language, + engines: { + yaml: (s) => yaml.load(s, { schema: yaml.JSON_SCHEMA }), + toml: (s) => toml.parse(s) + } + }); + if (data.title != null && data.title.toString() !== "") { + data.title = data.title.toString(); + } else { + data.title = file.stem ?? "Untitled"; + } + const tags = coerceToArray(coalesceAliases(data, ["tags", "tag"])); + if (tags) data.tags = [...new Set(tags.map((tag) => slugTag(tag)))]; + const aliases = coerceToArray(coalesceAliases(data, ["aliases", "alias"])); + if (aliases) { + data.aliases = aliases; + file.data.aliases = getAliasSlugs(aliases); + allSlugs.push(...file.data.aliases); + } + if (data.permalink != null && data.permalink.toString() !== "") { + data.permalink = data.permalink.toString(); + const fileAliases = file.data.aliases ?? []; + fileAliases.push(data.permalink); + file.data.aliases = fileAliases; + allSlugs.push(data.permalink); + } + const cssclasses = coerceToArray(coalesceAliases(data, ["cssclasses", "cssclass"])); + if (cssclasses) data.cssclasses = cssclasses; + const socialImage = coalesceAliases(data, ["socialImage", "image", "cover"]); + const created = coalesceAliases(data, ["created", "date"]); + if (created) data.created = created; + const modified = coalesceAliases(data, [ + "modified", + "lastmod", + "updated", + "last-modified" + ]); + if (modified) data.modified = modified; + data.modified ||= created; + const published = coalesceAliases(data, ["published", "publishDate", "date"]); + if (published) data.published = published; + if (socialImage) data.socialImage = socialImage; + const uniqueSlugs = [...new Set(allSlugs)]; + allSlugs.splice(0, allSlugs.length, ...uniqueSlugs); + const frontmatterLinks = extractLinksFromValue(data); + if (frontmatterLinks.length > 0) { + const existingLinks = file.data.frontmatterLinks ?? []; + file.data.frontmatterLinks = [...existingLinks, ...frontmatterLinks]; + } + const showProperties = coerceToBool( + coalesceAliases(data, ["quartz-properties", "quartzProperties"]) + ); + const collapseProperties = coerceToBool( + coalesceAliases(data, ["quartz-properties-collapse", "quartzPropertiesCollapse"]) + ); + const visibleProps = getVisibleProperties(data, opts); + file.data.noteProperties = { + properties: visibleProps, + hideView: opts.hidePropertiesView, + showProperties, + collapseProperties + }; + file.data.frontmatter = data; + }; + } + ]; + } + }; +}; + +// src/util/lang.ts +function classNames(...classes) { + return classes.filter(Boolean).join(" "); +} +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; +} + +// src/i18n/locales/en-US.ts +var en_US_default = { + components: { + noteProperties: { + title: "Properties" + } + } +}; + +// src/i18n/index.ts +var locales = { + "en-US": en_US_default +}; +function i18n(locale) { + return locales[locale] || en_US_default; +} + +// src/components/styles/noteProperties.scss +var noteProperties_default = '.note-properties {\n margin: 0.5rem 0 1rem;\n border: 1px solid var(--lightgray);\n border-radius: 5px;\n font-size: 0.9rem;\n}\n.note-properties[open] > .note-properties-header {\n border-bottom: 1px solid var(--lightgray);\n}\n.note-properties .note-properties-header {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.4rem 0.8rem;\n cursor: pointer;\n user-select: none;\n list-style: none;\n color: var(--darkgray);\n font-weight: 600;\n}\n.note-properties .note-properties-header::-webkit-details-marker {\n display: none;\n}\n.note-properties .note-properties-header::before {\n content: "";\n display: inline-block;\n width: 0.5em;\n height: 0.5em;\n border-right: 2px solid var(--darkgray);\n border-bottom: 2px solid var(--darkgray);\n transform: rotate(-45deg);\n transition: transform 0.2s ease;\n}\n.note-properties[open] > .note-properties-header::before {\n transform: rotate(45deg);\n}\n.note-properties .note-properties-count {\n margin-left: auto;\n font-size: 0.75rem;\n color: var(--gray);\n font-weight: 400;\n}\n.note-properties .note-properties-table {\n width: 100%;\n border-collapse: collapse;\n table-layout: fixed;\n}\n.note-properties .note-properties-row {\n border-bottom: 1px solid var(--lightgray);\n}\n.note-properties .note-properties-row:last-child {\n border-bottom: none;\n}\n.note-properties .note-properties-key {\n width: 35%;\n padding: 0.35rem 0.8rem;\n color: var(--gray);\n font-size: 0.85rem;\n vertical-align: top;\n word-break: break-word;\n}\n.note-properties .note-properties-value {\n padding: 0.35rem 0.8rem;\n vertical-align: top;\n word-break: break-word;\n}\n.note-properties .note-properties-empty {\n color: var(--gray);\n font-style: italic;\n}\n.note-properties .note-properties-boolean input[type=checkbox] {\n pointer-events: none;\n margin: 0;\n vertical-align: middle;\n}\n.note-properties .note-properties-number {\n font-family: var(--codeFont);\n font-size: 0.85em;\n}\n.note-properties .note-properties-link {\n text-decoration: none;\n color: var(--secondary);\n}\n.note-properties .note-properties-link:hover {\n text-decoration: underline;\n}\n.note-properties .note-properties-separator {\n color: var(--gray);\n}\n.note-properties .note-properties-list {\n display: inline;\n}\n.note-properties .note-properties-tags {\n display: inline;\n}\n.note-properties .note-properties-tags .tag-link {\n display: inline-block;\n padding: 0.1rem 0.4rem;\n border-radius: 3px;\n background: var(--highlight);\n color: var(--secondary);\n font-size: 0.85em;\n text-decoration: none;\n}\n.note-properties .note-properties-tags .tag-link:hover {\n background: var(--secondary);\n color: var(--light);\n}\n.note-properties .note-properties-object code {\n font-size: 0.85em;\n padding: 0.1rem 0.3rem;\n border-radius: 3px;\n background: var(--highlight);\n word-break: break-all;\n}'; + +// src/components/scripts/noteProperties.inline.ts +var noteProperties_inline_default = 'var o="note-properties-collapsed";function d(){let e=document.querySelector("details.note-properties");if(!e)return;let t=localStorage.getItem(o);if(t!==null){let i=t==="true";e.open=!i}let n=()=>{localStorage.setItem(o,String(!e.open))};e.addEventListener("toggle",n),typeof window<"u"&&window.addCleanup&&window.addCleanup(()=>{e.removeEventListener("toggle",n)})}document.addEventListener("nav",()=>{d()});document.addEventListener("render",()=>{d()});\n'; +var WIKILINK_RE = /\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g; +var MDLINK_RE = /\[([^\]]*)\]\(([^)]+)\)/g; +var URL_RE = /https?:\/\/[^\s<>]+/g; +function renderTextWithLinks(text, ctx) { + const segments = []; + for (const match of text.matchAll(WIKILINK_RE)) { + const target = match[1]; + const display = match[2] ?? target; + const href = resolveRelative(ctx.slug, target); + segments.push({ + start: match.index, + end: match.index + match[0].length, + node: /* @__PURE__ */ jsx("a", { href, class: "internal note-properties-link", children: display }) + }); + } + for (const match of text.matchAll(MDLINK_RE)) { + const overlaps = segments.some( + (s) => match.index < s.end && match.index + match[0].length > s.start + ); + if (overlaps) continue; + const display = match[1]; + const href = match[2]; + const isExternal = href.startsWith("http://") || href.startsWith("https://"); + const resolvedHref = isExternal ? href : resolveRelative(ctx.slug, href); + segments.push({ + start: match.index, + end: match.index + match[0].length, + node: /* @__PURE__ */ jsx( + "a", + { + href: resolvedHref, + class: classNames(isExternal ? "external" : "internal", "note-properties-link"), + ...isExternal ? { target: "_blank", rel: "noopener noreferrer" } : {}, + children: display || href + } + ) + }); + } + for (const match of text.matchAll(URL_RE)) { + const overlaps = segments.some( + (s) => match.index < s.end && match.index + match[0].length > s.start + ); + if (overlaps) continue; + segments.push({ + start: match.index, + end: match.index + match[0].length, + node: /* @__PURE__ */ jsx( + "a", + { + href: match[0], + class: "external note-properties-link", + target: "_blank", + rel: "noopener noreferrer", + children: match[0] + } + ) + }); + } + if (segments.length === 0) return [text]; + segments.sort((a, b) => a.start - b.start); + const result = []; + let cursor = 0; + for (const seg of segments) { + if (seg.start > cursor) { + result.push(text.slice(cursor, seg.start)); + } + result.push(seg.node); + cursor = seg.end; + } + if (cursor < text.length) { + result.push(text.slice(cursor)); + } + return result; +} +function renderValue(value, ctx) { + if (value === null || value === void 0) { + return /* @__PURE__ */ jsx("span", { class: "note-properties-empty", children: "\u2014" }); + } + if (typeof value === "boolean") { + return /* @__PURE__ */ jsx("span", { class: classNames("note-properties-boolean", value ? "is-true" : "is-false"), children: /* @__PURE__ */ jsx("input", { type: "checkbox", checked: value, disabled: true }) }); + } + if (typeof value === "number") { + return /* @__PURE__ */ jsx("span", { class: "note-properties-number", children: value }); + } + if (typeof value === "string") { + const parts = renderTextWithLinks(value, ctx); + return /* @__PURE__ */ jsx("span", { class: "note-properties-text", children: parts }); + } + if (Array.isArray(value)) { + const items = value.map((item, idx) => { + const rendered = renderValue(item, ctx); + return /* @__PURE__ */ jsxs(Fragment, { children: [ + idx > 0 && /* @__PURE__ */ jsx("span", { class: "note-properties-separator", children: ", " }), + rendered + ] }); + }); + return /* @__PURE__ */ jsx("span", { class: "note-properties-list", children: items }); + } + if (typeof value === "object") { + return /* @__PURE__ */ jsx("span", { class: "note-properties-object", children: /* @__PURE__ */ jsx("code", { children: JSON.stringify(value) }) }); + } + return String(value); +} +function renderTagList(tags, ctx) { + const items = tags.map((tag, idx) => { + const href = resolveRelative(ctx.slug, `tags/${tag}`); + return /* @__PURE__ */ jsxs(Fragment, { children: [ + idx > 0 && /* @__PURE__ */ jsx("span", { class: "note-properties-separator", children: ", " }), + /* @__PURE__ */ jsx("a", { href, class: "internal tag-link", children: tag }) + ] }); + }); + return /* @__PURE__ */ jsx("span", { class: "note-properties-tags", children: items }); +} +var NoteProperties_default = ((opts) => { + const { collapsed = false } = opts ?? {}; + const Component = (props) => { + const noteProps = props.fileData?.noteProperties; + if (!noteProps) return null; + if (noteProps.showProperties === false) return null; + if (noteProps.showProperties !== true && noteProps.hideView) return null; + const properties = noteProps.properties; + const entries = Object.entries(properties); + if (entries.length === 0) return null; + const locale = props.cfg?.locale || "en-US"; + const i18nData = i18n(locale); + const ctx = { slug: props.fileData?.slug ?? "" }; + const isCollapsed = noteProps.collapseProperties ?? collapsed; + return /* @__PURE__ */ jsxs( + "details", + { + class: classNames(props.displayClass, "note-properties"), + open: !isCollapsed, + "data-collapsed": isCollapsed, + children: [ + /* @__PURE__ */ jsxs("summary", { class: "note-properties-header", children: [ + /* @__PURE__ */ jsx("span", { class: "note-properties-title", children: i18nData.components.noteProperties.title }), + /* @__PURE__ */ jsx("span", { class: "note-properties-count", children: entries.length }) + ] }), + /* @__PURE__ */ jsx("table", { class: "note-properties-table", children: /* @__PURE__ */ jsx("tbody", { children: entries.map(([key, value]) => /* @__PURE__ */ jsxs("tr", { class: "note-properties-row", children: [ + /* @__PURE__ */ jsx("td", { class: "note-properties-key", children: key }), + /* @__PURE__ */ jsx("td", { class: "note-properties-value", children: key === "tags" && Array.isArray(value) ? renderTagList(value, ctx) : renderValue(value, ctx) }) + ] }, key)) }) }) + ] + } + ); + }; + Component.css = noteProperties_default; + Component.afterDOMLoaded = noteProperties_inline_default; + return Component; +}); + +export { NoteProperties, NoteProperties_default as NotePropertiesComponent }; +//# sourceMappingURL=index.js.map +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 0000000..ef70768 --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/transformer.ts","../src/util/lang.ts","../src/util/path.ts","../src/i18n/locales/en-US.ts","../src/i18n/index.ts","../src/components/styles/noteProperties.scss","../src/components/scripts/noteProperties.inline.ts","../src/components/NoteProperties.tsx"],"names":["result","utilSimplifySlug"],"mappings":";;;;;;;;AAaA,IAAM,cAAA,GAAwC;AAAA,EAC5C,UAAA,EAAY,KAAA;AAAA,EACZ,kBAAA,EAAoB,CAAC,aAAA,EAAe,MAAA,EAAQ,SAAS,CAAA;AAAA,EACrD,oBAAoB,EAAC;AAAA,EACrB,kBAAA,EAAoB,KAAA;AAAA,EACpB,UAAA,EAAY,KAAA;AAAA,EACZ,QAAA,EAAU;AACZ,CAAA;AAEA,SAAS,eAAA,CAAgB,MAA+B,O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port remarkFrontmatter from \"remark-frontmatter\";\nimport yaml from \"js-yaml\";\nimport toml from \"toml\";\nimport type {\n QuartzTransformerPlugin,\n BuildCtx,\n QuartzPluginData,\n FullSlug,\n FilePath,\n} from \"@quartz-community/types\";\nimport type { NotePropertiesOptions } from \"./types\";\n\nconst defaultOptions: NotePropertiesOptions = {\n includeAll: false,\n includedProperties: [\"description\", \"tags\", \"aliases\"],\n excludedProperties: [],\n hidePropertiesView: false,\n delimiters: \"---\",\n language: \"yaml\",\n};\n\nfunction coalesceAliases(data: Record, aliases: string[]): unknown | undefined {\n for (const alias of aliases) {\n if (data[alias] !== undefined && data[alias] !== null) return data[alias];\n }\n}\n\nfunction coerceToArray(input: unknown): string[] | undefined {\n if (input === undefined || input === null) return undefined;\n\n if (!Array.isArray(input)) {\n return String(input)\n .split(\",\")\n .map((s: string) => s.trim());\n }\n\n return input\n .filter((v: unknown) => typeof v === \"string\" || typeof v === \"number\")\n .map((v: string | number) => v.toString());\n}\n\nfunction slugTag(tag: string): string {\n return tag\n .split(\"/\")\n .map((segment) =>\n segment\n .replace(/\\s+/g, \"-\")\n .replace(/[^\\w\\p{L}\\p{M}\\p{N}/-]/gu, \"\")\n .toLowerCase(),\n )\n .join(\"/\");\n}\n\nfunction getFileExtension(fp: string): string {\n return fp.split(\".\").pop() ?? \"\";\n}\n\nfunction slugifyFilePath(fp: string): FullSlug {\n fp = fp.replace(/\\\\/g, \"/\");\n fp = fp.replace(/\\.md$/, \"\");\n let slug = fp\n .split(\"/\")\n .map((segment) => segment.replace(/\\s+/g, \"-\").replace(/[^\\w\\p{L}\\p{M}\\p{N}/-]/gu, \"\"))\n .join(\"/\");\n slug = slug.replace(/\\/$/, \"\");\n return slug as FullSlug;\n}\n\nfunction getAliasSlugs(aliases: string[]): FullSlug[] {\n return aliases.map((alias) => {\n const isMd = getFileExtension(alias) === \"md\";\n const mockFp = isMd ? alias : alias + \".md\";\n return slugifyFilePath(mockFp as FilePath);\n });\n}\n\n// Wikilink pattern: [[target|display]] or [[target]]\nconst WIKILINK_PATTERN = /\\[\\[([^\\]|]+)(?:\\|[^\\]]+)?\\]\\]/g;\n// Markdown link pattern: [text](target)\nconst MDLINK_PATTERN = /\\[(?:[^\\]]*)\\]\\(([^)]+)\\)/g;\n\nfunction extractLinksFromValue(value: unknown): string[] {\n if (typeof value === \"string\") {\n const links: string[] = [];\n let match: RegExpExecArray | null;\n\n WIKILINK_PATTERN.lastIndex = 0;\n while ((match = WIKILINK_PATTERN.exec(value)) !== null) {\n links.push(match[1]!);\n }\n\n MDLINK_PATTERN.lastIndex = 0;\n while ((match = MDLINK_PATTERN.exec(value)) !== null) {\n links.push(match[1]!);\n }\n\n return links;\n }\n\n if (Array.isArray(value)) {\n return value.flatMap((item) => extractLinksFromValue(item));\n }\n\n if (value !== null && typeof value === \"object\") {\n return Object.values(value).flatMap((v) => extractLinksFromValue(v));\n }\n\n return [];\n}\n\n/** Quartz-internal frontmatter keys that should never appear in the properties table. */\nconst QUARTZ_INTERNAL_KEYS = new Set([\n \"quartz-properties\",\n \"quartzProperties\",\n \"quartz-properties-collapse\",\n \"quartzPropertiesCollapse\",\n]);\n\nfunction coerceToBool(value: unknown): boolean | undefined {\n if (value === undefined || value === null) return undefined;\n if (typeof value === \"boolean\") return value;\n if (typeof value === \"string\") {\n const lower = value.toLowerCase();\n if (lower === \"true\") return true;\n if (lower === \"false\") return false;\n }\n return undefined;\n}\nfunction getVisibleProperties(\n data: Record,\n opts: NotePropertiesOptions,\n): Record {\n const excluded = new Set(opts.excludedProperties);\n // Always exclude Quartz-internal keys from the visible properties table\n for (const key of QUARTZ_INTERNAL_KEYS) {\n excluded.add(key);\n }\n if (opts.includeAll) {\n const result: Record = {};\n for (const [key, value] of Object.entries(data)) {\n if (!excluded.has(key)) {\n result[key] = value;\n }\n }\n return result;\n }\n\n const result: Record = {};\n for (const key of opts.includedProperties) {\n if (!excluded.has(key) && data[key] !== undefined) {\n result[key] = data[key];\n }\n }\n return result;\n}\n\nexport const NoteProperties: QuartzTransformerPlugin> = (\n userOpts,\n) => {\n const opts = { ...defaultOptions, ...userOpts };\n return {\n name: \"NoteProperties\",\n markdownPlugins(_ctx: BuildCtx) {\n const { allSlugs } = _ctx;\n return [\n [remarkFrontmatter, [\"yaml\", \"toml\"]],\n () => {\n return (_, file) => {\n const fileData = Buffer.from(file.value as Uint8Array);\n const { data } = matter(fileData, {\n delimiters: opts.delimiters,\n language: opts.language,\n engines: {\n yaml: (s) => yaml.load(s, { schema: yaml.JSON_SCHEMA }) as object,\n toml: (s) => toml.parse(s) as object,\n },\n });\n\n if (data.title != null && data.title.toString() !== \"\") {\n data.title = data.title.toString();\n } else {\n data.title = file.stem ?? \"Untitled\";\n }\n\n const tags = coerceToArray(coalesceAliases(data, [\"tags\", \"tag\"]));\n if (tags) data.tags = [...new Set(tags.map((tag: string) => slugTag(tag)))];\n\n const aliases = coerceToArray(coalesceAliases(data, [\"aliases\", \"alias\"]));\n if (aliases) {\n data.aliases = aliases;\n file.data.aliases = getAliasSlugs(aliases);\n allSlugs.push(...file.data.aliases);\n }\n\n if (data.permalink != null && data.permalink.toString() !== \"\") {\n data.permalink = data.permalink.toString() as FullSlug;\n const fileAliases = (file.data.aliases as FullSlug[]) ?? [];\n fileAliases.push(data.permalink);\n file.data.aliases = fileAliases;\n allSlugs.push(data.permalink);\n }\n\n const cssclasses = coerceToArray(coalesceAliases(data, [\"cssclasses\", \"cssclass\"]));\n if (cssclasses) data.cssclasses = cssclasses;\n\n const socialImage = coalesceAliases(data, [\"socialImage\", \"image\", \"cover\"]);\n\n const created = coalesceAliases(data, [\"created\", \"date\"]);\n if (created) data.created = created;\n\n const modified = coalesceAliases(data, [\n \"modified\",\n \"lastmod\",\n \"updated\",\n \"last-modified\",\n ]);\n if (modified) data.modified = modified;\n data.modified ||= created;\n\n const published = coalesceAliases(data, [\"published\", \"publishDate\", \"date\"]);\n if (published) data.published = published;\n\n if (socialImage) data.socialImage = socialImage;\n\n const uniqueSlugs = [...new Set(allSlugs)];\n allSlugs.splice(0, allSlugs.length, ...uniqueSlugs);\n\n const frontmatterLinks = extractLinksFromValue(data);\n if (frontmatterLinks.length > 0) {\n const existingLinks = (file.data.frontmatterLinks as string[]) ?? [];\n file.data.frontmatterLinks = [...existingLinks, ...frontmatterLinks];\n }\n\n // Read per-note overrides for properties view visibility and collapsed state\n const showProperties = coerceToBool(\n coalesceAliases(data, [\"quartz-properties\", \"quartzProperties\"]),\n );\n const collapseProperties = coerceToBool(\n coalesceAliases(data, [\"quartz-properties-collapse\", \"quartzPropertiesCollapse\"]),\n );\n const visibleProps = getVisibleProperties(data, opts);\n file.data.noteProperties = {\n properties: visibleProps,\n hideView: opts.hidePropertiesView,\n showProperties,\n collapseProperties,\n };\n\n file.data.frontmatter = data as QuartzPluginData[\"frontmatter\"];\n };\n },\n ];\n },\n };\n};\n\ndeclare module \"vfile\" {\n interface DataMap {\n aliases: FullSlug[];\n frontmatter: { [key: string]: unknown } & {\n title: string;\n } & Partial<{\n tags: string[];\n aliases: string[];\n modified: string;\n created: string;\n published: string;\n description: string;\n socialDescription: string;\n publish: boolean | string;\n draft: boolean | string;\n lang: string;\n enableToc: string;\n cssclasses: string[];\n socialImage: string;\n comments: boolean | string;\n }>;\n frontmatterLinks: string[];\n noteProperties: {\n properties: Record;\n hideView: boolean;\n /** Per-note override: true = show, false = hide, undefined = follow config */\n showProperties?: boolean;\n /** Per-note override: true = collapsed, false = expanded, undefined = follow component option */\n collapseProperties?: boolean;\n };\n }\n}\n","export function classNames(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n","import { simplifySlug as utilSimplifySlug, joinSegments } from \"@quartz-community/utils\";\n\nexport function simplifySlug(fp: string): string {\n return utilSimplifySlug(fp);\n}\n\nexport function resolveRelative(current: string, target: string): string {\n const simplified = simplifySlug(target);\n const rootPath = pathToRoot(current);\n return joinSegments(rootPath, simplified);\n}\n\nfunction 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 components: {\n noteProperties: {\n title: \"Properties\",\n },\n },\n};\n","import enUS from \"./locales/en-US\";\n\nconst locales: Record = {\n \"en-US\": enUS,\n};\n\nexport function i18n(locale: string) {\n return locales[locale] || enUS;\n}\n",".note-properties {\n margin: 0.5rem 0 1rem;\n border: 1px solid var(--lightgray);\n border-radius: 5px;\n font-size: 0.9rem;\n}\n.note-properties[open] > .note-properties-header {\n border-bottom: 1px solid var(--lightgray);\n}\n.note-properties .note-properties-header {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.4rem 0.8rem;\n cursor: pointer;\n user-select: none;\n list-style: none;\n color: var(--darkgray);\n font-weight: 600;\n}\n.note-properties .note-properties-header::-webkit-details-marker {\n display: none;\n}\n.note-properties .note-properties-header::before {\n content: \"\";\n display: inline-block;\n width: 0.5em;\n height: 0.5em;\n border-right: 2px solid var(--darkgray);\n border-bottom: 2px solid var(--darkgray);\n transform: rotate(-45deg);\n transition: transform 0.2s ease;\n}\n.note-properties[open] > .note-properties-header::before {\n transform: rotate(45deg);\n}\n.note-properties .note-properties-count {\n margin-left: auto;\n font-size: 0.75rem;\n color: var(--gray);\n font-weight: 400;\n}\n.note-properties .note-properties-table {\n width: 100%;\n border-collapse: collapse;\n table-layout: fixed;\n}\n.note-properties .note-properties-row {\n border-bottom: 1px solid var(--lightgray);\n}\n.note-properties .note-properties-row:last-child {\n border-bottom: none;\n}\n.note-properties .note-properties-key {\n width: 35%;\n padding: 0.35rem 0.8rem;\n color: var(--gray);\n font-size: 0.85rem;\n vertical-align: top;\n word-break: break-word;\n}\n.note-properties .note-properties-value {\n padding: 0.35rem 0.8rem;\n vertical-align: top;\n word-break: break-word;\n}\n.note-properties .note-properties-empty {\n color: var(--gray);\n font-style: italic;\n}\n.note-properties .note-properties-boolean input[type=checkbox] {\n pointer-events: none;\n margin: 0;\n vertical-align: middle;\n}\n.note-properties .note-properties-number {\n font-family: var(--codeFont);\n font-size: 0.85em;\n}\n.note-properties .note-properties-link {\n text-decoration: none;\n color: var(--secondary);\n}\n.note-properties .note-properties-link:hover {\n text-decoration: underline;\n}\n.note-properties .note-properties-separator {\n color: var(--gray);\n}\n.note-properties .note-properties-list {\n display: inline;\n}\n.note-properties .note-properties-tags {\n display: inline;\n}\n.note-properties .note-properties-tags .tag-link {\n display: inline-block;\n padding: 0.1rem 0.4rem;\n border-radius: 3px;\n background: var(--highlight);\n color: var(--secondary);\n font-size: 0.85em;\n text-decoration: none;\n}\n.note-properties .note-properties-tags .tag-link:hover {\n background: var(--secondary);\n color: var(--light);\n}\n.note-properties .note-properties-object code {\n font-size: 0.85em;\n padding: 0.1rem 0.3rem;\n border-radius: 3px;\n background: var(--highlight);\n word-break: break-all;\n}","var o=\"note-properties-collapsed\";function d(){let e=document.querySelector(\"details.note-properties\");if(!e)return;let t=localStorage.getItem(o);if(t!==null){let i=t===\"true\";e.open=!i}let n=()=>{localStorage.setItem(o,String(!e.open))};e.addEventListener(\"toggle\",n),typeof window<\"u\"&&window.addCleanup&&window.addCleanup(()=>{e.removeEventListener(\"toggle\",n)})}document.addEventListener(\"nav\",()=>{d()});document.addEventListener(\"render\",()=>{d()});\n","import type {\n QuartzComponent,\n QuartzComponentProps,\n QuartzComponentConstructor,\n} from \"@quartz-community/types\";\nimport { classNames } from \"../util/lang\";\nimport { resolveRelative } from \"../util/path\";\nimport { i18n } from \"../i18n\";\nimport style from \"./styles/noteProperties.scss\";\n// @ts-expect-error - inline script import handled by Quartz bundler\nimport script from \"./scripts/noteProperties.inline.ts\";\n\nexport interface NotePropertiesComponentOptions {\n collapsed?: boolean;\n}\n\nconst WIKILINK_RE = /\\[\\[([^\\]|]+)(?:\\|([^\\]]+))?\\]\\]/g;\nconst MDLINK_RE = /\\[([^\\]]*)\\]\\(([^)]+)\\)/g;\nconst URL_RE = /https?:\\/\\/[^\\s<>]+/g;\n\ntype RenderCtx = { slug: string };\n\nfunction renderTextWithLinks(text: string, ctx: RenderCtx): (preact.JSX.Element | string)[] {\n const segments: { start: number; end: number; node: preact.JSX.Element }[] = [];\n for (const match of text.matchAll(WIKILINK_RE)) {\n const target = match[1]!;\n const display = match[2] ?? target;\n const href = resolveRelative(ctx.slug, target);\n segments.push({\n start: match.index,\n end: match.index + match[0].length,\n node: (\n \n {display}\n \n ),\n });\n }\n\n for (const match of text.matchAll(MDLINK_RE)) {\n const overlaps = segments.some(\n (s) => match.index < s.end && match.index + match[0].length > s.start,\n );\n if (overlaps) continue;\n const display = match[1]!;\n const href = match[2]!;\n const isExternal = href.startsWith(\"http://\") || href.startsWith(\"https://\");\n const resolvedHref = isExternal ? href : resolveRelative(ctx.slug, href);\n segments.push({\n start: match.index,\n end: match.index + match[0].length,\n node: (\n \n {display || href}\n \n ),\n });\n }\n\n for (const match of text.matchAll(URL_RE)) {\n const overlaps = segments.some(\n (s) => match.index < s.end && match.index + match[0].length > s.start,\n );\n if (overlaps) continue;\n\n segments.push({\n start: match.index,\n end: match.index + match[0].length,\n node: (\n \n {match[0]}\n \n ),\n });\n }\n\n if (segments.length === 0) return [text];\n\n segments.sort((a, b) => a.start - b.start);\n\n const result: (preact.JSX.Element | string)[] = [];\n let cursor = 0;\n for (const seg of segments) {\n if (seg.start > cursor) {\n result.push(text.slice(cursor, seg.start));\n }\n result.push(seg.node);\n cursor = seg.end;\n }\n if (cursor < text.length) {\n result.push(text.slice(cursor));\n }\n\n return result;\n}\n\nfunction renderValue(value: unknown, ctx: RenderCtx): preact.JSX.Element | string {\n if (value === null || value === undefined) {\n return ;\n }\n\n if (typeof value === \"boolean\") {\n return (\n \n \n \n );\n }\n\n if (typeof value === \"number\") {\n return {value};\n }\n\n if (typeof value === \"string\") {\n const parts = renderTextWithLinks(value, ctx);\n return {parts};\n }\n\n if (Array.isArray(value)) {\n const items = value.map((item, idx) => {\n const rendered = renderValue(item, ctx);\n return (\n <>\n {idx > 0 && , }\n {rendered}\n \n );\n });\n return {items};\n }\n\n if (typeof value === \"object\") {\n return (\n \n {JSON.stringify(value)}\n \n );\n }\n\n return String(value);\n}\n\nfunction renderTagList(tags: string[], ctx: RenderCtx): preact.JSX.Element {\n const items = tags.map((tag, idx) => {\n const href = resolveRelative(ctx.slug, `tags/${tag}`);\n return (\n <>\n {idx > 0 && , }\n \n {tag}\n \n \n );\n });\n return {items};\n}\n\nexport default ((opts?: NotePropertiesComponentOptions) => {\n const { collapsed = false } = opts ?? {};\n\n const Component: QuartzComponent = (props: QuartzComponentProps) => {\n const noteProps = props.fileData?.noteProperties as\n | {\n properties: Record;\n hideView: boolean;\n showProperties?: boolean;\n collapseProperties?: boolean;\n }\n | undefined;\n if (!noteProps) return null;\n\n // Per-note override takes precedence over global config\n // showProperties: true = force show, false = force hide, undefined = follow hideView config\n if (noteProps.showProperties === false) return null;\n if (noteProps.showProperties !== true && noteProps.hideView) return null;\n\n const properties = noteProps.properties;\n const entries = Object.entries(properties);\n if (entries.length === 0) return null;\n\n const locale = props.cfg?.locale || \"en-US\";\n const i18nData = i18n(locale);\n const ctx: RenderCtx = { slug: (props.fileData?.slug as string) ?? \"\" };\n\n // Per-note collapse override takes precedence over component option\n const isCollapsed = noteProps.collapseProperties ?? collapsed;\n return (\n \n \n {i18nData.components.noteProperties.title}\n {entries.length}\n \n \n \n {entries.map(([key, value]) => (\n \n \n \n \n ))}\n \n
{key}\n {key === \"tags\" && Array.isArray(value)\n ? renderTagList(value as string[], ctx)\n : renderValue(value, ctx)}\n
\n \n );\n };\n\n Component.css = style;\n Component.afterDOMLoaded = script;\n\n return Component;\n}) satisfies QuartzComponentConstructor;\n"]} \ No newline at end of file diff --git a/dist/types.js b/dist/types.js new file mode 100644 index 0000000..6bd95cc --- /dev/null +++ b/dist/types.js @@ -0,0 +1,3 @@ + +//# sourceMappingURL=types.js.map +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/dist/types.js.map b/dist/types.js.map new file mode 100644 index 0000000..efc9e48 --- /dev/null +++ b/dist/types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index fd5902c..6441b70 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,15 +10,7 @@ "license": "MIT", "dependencies": { "@quartz-community/types": "github:quartz-community/types", - "@quartz-community/utils": "github:quartz-community/utils", - "gray-matter": "^4.0.3", - "js-yaml": "^4.1.0", - "remark-frontmatter": "^5.0.0", - "toml": "^3.0.0", - "tsup": "^8.5.0", - "typescript": "^5.9.3", - "unified": "^11.0.5", - "vfile": "^6.0.3" + "@quartz-community/utils": "github:quartz-community/utils" }, "devDependencies": { "@types/hast": "^3.0.4", @@ -32,6 +24,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": { @@ -40,14 +34,38 @@ }, "peerDependencies": { "@jackyzha0/quartz": "^4.5.2", - "preact": "^10.0.0" + "gray-matter": "^4.0.3", + "js-yaml": "^4.1.0", + "preact": "^10.0.0", + "remark-frontmatter": "^5.0.0", + "toml": "^3.0.0", + "unified": "^11.0.5", + "vfile": "^6.0.3" }, "peerDependenciesMeta": { "@jackyzha0/quartz": { "optional": true }, + "gray-matter": { + "optional": true + }, + "js-yaml": { + "optional": true + }, "preact": { "optional": false + }, + "remark-frontmatter": { + "optional": true + }, + "toml": { + "optional": true + }, + "unified": { + "optional": true + }, + "vfile": { + "optional": true } } }, @@ -1850,6 +1868,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "devOptional": true, "license": "Python-2.0" }, "node_modules/array-union": { @@ -2447,6 +2466,7 @@ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "license": "BSD-2-Clause", + "optional": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -2542,6 +2562,7 @@ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", "license": "MIT", + "optional": true, "dependencies": { "is-extendable": "^0.1.0" }, @@ -2610,19 +2631,6 @@ "reusify": "^1.0.4" } }, - "node_modules/fault": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fault/-/fault-2.0.1.tgz", - "integrity": "sha512-WtySTkS4OKev5JtpHXnib4Gxiurzh5NCGvWrFaZ34m6JehfTUhKZvn9njTfw48t6JumVQOmrKqpmGcdwxnhqBQ==", - "license": "MIT", - "dependencies": { - "format": "^0.2.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -2699,14 +2707,6 @@ "dev": true, "license": "ISC" }, - "node_modules/format": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", - "integrity": "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==", - "engines": { - "node": ">=0.4.x" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2842,6 +2842,7 @@ "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-4.0.3.tgz", "integrity": "sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==", "license": "MIT", + "optional": true, "dependencies": { "js-yaml": "^3.13.1", "kind-of": "^6.0.2", @@ -2857,6 +2858,7 @@ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "license": "MIT", + "optional": true, "dependencies": { "sprintf-js": "~1.0.2" } @@ -2866,6 +2868,7 @@ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz", "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==", "license": "MIT", + "optional": true, "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -3032,6 +3035,7 @@ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==", "license": "MIT", + "optional": true, "engines": { "node": ">=0.10.0" } @@ -3121,6 +3125,7 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "devOptional": true, "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -3165,6 +3170,7 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "license": "MIT", + "optional": true, "engines": { "node": ">=0.10.0" } @@ -3283,36 +3289,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/mdast-util-frontmatter": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/mdast-util-frontmatter/-/mdast-util-frontmatter-2.0.1.tgz", - "integrity": "sha512-LRqI9+wdgC25P0URIJY9vwocIzCcksduHQ9OF2joxQoyTNVduwLAFUzjoopuRJbJAReaKrNQKAZKL3uCMugWJA==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "devlop": "^1.0.0", - "escape-string-regexp": "^5.0.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0", - "micromark-extension-frontmatter": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-frontmatter/node_modules/escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/mdast-util-mdx-expression": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz", @@ -3500,22 +3476,6 @@ "micromark-util-types": "^2.0.0" } }, - "node_modules/micromark-extension-frontmatter": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/micromark-extension-frontmatter/-/micromark-extension-frontmatter-2.0.0.tgz", - "integrity": "sha512-C4AkuM3dA58cgZha7zVnuVxBhDsbttIMiytjgsM2XbHAB2faRVaHRle40558FBN+DJcrLNCoqG5mlrpdU4cRtg==", - "license": "MIT", - "dependencies": { - "fault": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/micromark-factory-destination": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", @@ -4204,7 +4164,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -4347,22 +4306,6 @@ "url": "https://paulmillr.com/funding/" } }, - "node_modules/remark-frontmatter": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-frontmatter/-/remark-frontmatter-5.0.0.tgz", - "integrity": "sha512-XTFYvNASMe5iPN0719nPrdItC9aU0ssC4v14mH1BCi1u0n1gAocqcujWUrByftZTbLhRtiKRyjYTSIOcr69UVQ==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "mdast-util-frontmatter": "^2.0.0", - "micromark-extension-frontmatter": "^2.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -4496,6 +4439,7 @@ "resolved": "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz", "integrity": "sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==", "license": "MIT", + "optional": true, "dependencies": { "extend-shallow": "^2.0.1", "kind-of": "^6.0.0" @@ -4590,7 +4534,8 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "license": "BSD-3-Clause" + "license": "BSD-3-Clause", + "optional": true }, "node_modules/stackback": { "version": "0.0.2", @@ -4638,6 +4583,7 @@ "resolved": "https://registry.npmjs.org/strip-bom-string/-/strip-bom-string-1.0.0.tgz", "integrity": "sha512-uCC2VHvQRYu+lMh4My/sFNmF2klFymLX1wHJeXnbEJERpV/ZsVuonzerjfrGpIGF7LBVa1O7i9kjiWvJiFck8g==", "license": "MIT", + "optional": true, "engines": { "node": ">=0.10.0" } @@ -4838,12 +4784,6 @@ "node": ">=8.0" } }, - "node_modules/toml": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz", - "integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==", - "license": "MIT" - }, "node_modules/tree-kill": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", diff --git a/package.json b/package.json index 6124c2e..7d35533 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "sideEffects": false, "scripts": { "build": "tsup", - "prepare": "npm run build", "dev": "tsup --watch", "lint": "eslint . --max-warnings=0", "format": "prettier . --check",