mirror of
https://github.com/quartz-community/plugin-template.git
synced 2026-07-22 02:50:24 +00:00
- Update types/globals.d.ts with centralized type declarations - Use fetchData global instead of hardcoded /static/contentIndex.json - Revert @quartz-community/types from file:../types to github:quartz-community/types - Add .prettierignore, update .eslintrc.json with triple-slash-reference override - Remove duplicate scripts.d.ts/styles.d.ts
28 lines
No EOL
2.3 KiB
JavaScript
28 lines
No EOL
2.3 KiB
JavaScript
import { jsx } from 'preact/jsx-runtime';
|
|
|
|
// src/util/lang.ts
|
|
function classNames(...classes) {
|
|
return classes.filter(Boolean).join(" ");
|
|
}
|
|
|
|
// src/components/styles/example.scss
|
|
var example_default = ".example-component {\n padding: 8px 16px;\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n color: white;\n border-radius: 4px;\n font-weight: 600;\n display: inline-block;\n}";
|
|
|
|
// src/components/scripts/example.inline.ts
|
|
var example_inline_default = 'function l(){let e=window.location.pathname;return e.startsWith("/")&&(e=e.slice(1)),e.endsWith("/")&&(e=e.slice(0,-1)),e||"index"}function r(){let e=document.querySelectorAll(".example-component");if(e.length===0)return;let t=[];function o(n){(n.ctrlKey||n.metaKey)&&n.shiftKey&&n.key.toLowerCase()==="e"&&(n.preventDefault(),console.log("[ExampleComponent] Keyboard shortcut triggered!"))}document.addEventListener("keydown",o),t.push(()=>document.removeEventListener("keydown",o));for(let n of e){let i=()=>{console.log("[ExampleComponent] Clicked!")};n.addEventListener("click",i),t.push(()=>n.removeEventListener("click",i))}typeof window<"u"&&window.addCleanup&&window.addCleanup(()=>{t.forEach(n=>n())}),console.log("[ExampleComponent] Initialized with",e.length,"component(s)")}document.addEventListener("nav",e=>{let t=e.detail?.url||l();console.log("[ExampleComponent] Navigation to:",t),r()});document.addEventListener("render",()=>{console.log("[ExampleComponent] Render event - re-initializing"),r()});document.addEventListener("prenav",()=>{let e=document.querySelector(".example-component");e&&sessionStorage.setItem("exampleScrollTop",e.scrollTop?.toString()||"0")});\n';
|
|
var ExampleComponent_default = ((opts) => {
|
|
const { prefix = "", suffix = "", className = "example-component" } = opts ?? {};
|
|
const Component = (props) => {
|
|
const frontmatter = props.fileData?.frontmatter;
|
|
const title = frontmatter?.title ?? "Untitled";
|
|
const fullText = `${prefix}${title}${suffix}`;
|
|
return /* @__PURE__ */ jsx("div", { class: classNames(className), children: fullText });
|
|
};
|
|
Component.css = example_default;
|
|
Component.afterDOMLoaded = example_inline_default;
|
|
return Component;
|
|
});
|
|
|
|
export { ExampleComponent_default as ExampleComponent };
|
|
//# sourceMappingURL=index.js.map
|
|
//# sourceMappingURL=index.js.map
|