mirror of
https://github.com/quartz-community/plugin-template.git
synced 2026-07-22 02:50:24 +00:00
51 lines
No EOL
3.3 KiB
JavaScript
51 lines
No EOL
3.3 KiB
JavaScript
import { createRequire } from 'module';
|
|
|
|
createRequire(import.meta.url);
|
|
|
|
// node_modules/@quartz-community/utils/dist/lang.js
|
|
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 l;
|
|
l = { __e: function(n2, l2, u3, t2) {
|
|
for (var i2, o2, r2; l2 = l2.__; ) if ((i2 = l2.__c) && !i2.__) try {
|
|
if ((o2 = i2.constructor) && null != o2.getDerivedStateFromError && (i2.setState(o2.getDerivedStateFromError(n2)), r2 = i2.__d), null != i2.componentDidCatch && (i2.componentDidCatch(n2, t2 || {}), r2 = i2.__d), r2) return i2.__E = i2;
|
|
} catch (l3) {
|
|
n2 = l3;
|
|
}
|
|
throw n2;
|
|
} }, "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout;
|
|
|
|
// node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
|
|
var f2 = 0;
|
|
function u2(e2, t2, n2, o2, i2, u3) {
|
|
t2 || (t2 = {});
|
|
var a2, c2, p2 = t2;
|
|
if ("ref" in p2) for (c2 in p2 = {}, t2) "ref" == c2 ? a2 = t2[c2] : p2[c2] = t2[c2];
|
|
var l2 = { type: e2, props: p2, key: n2, ref: a2, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --f2, __i: -1, __u: 0, __source: i2, __self: u3 };
|
|
return l.vnode && l.vnode(l2), l2;
|
|
}
|
|
|
|
// src/components/ExampleComponent.tsx
|
|
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__ */ u2("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
|