Compare commits
2 Commits
v4
...
feat/curso
Author | SHA1 | Date | |
---|---|---|---|
|
df66d9678b | ||
|
a72aeae429 |
@ -6,6 +6,7 @@ const config: QuartzConfig = {
|
|||||||
pageTitle: "🪴 Quartz 4.0",
|
pageTitle: "🪴 Quartz 4.0",
|
||||||
enableSPA: true,
|
enableSPA: true,
|
||||||
enablePopovers: true,
|
enablePopovers: true,
|
||||||
|
enableCursorChat: false,
|
||||||
analytics: {
|
analytics: {
|
||||||
provider: "plausible",
|
provider: "plausible",
|
||||||
},
|
},
|
||||||
|
@ -26,6 +26,8 @@ export interface GlobalConfiguration {
|
|||||||
enableSPA: boolean
|
enableSPA: boolean
|
||||||
/** Whether to display Wikipedia-style popovers when hovering over links */
|
/** Whether to display Wikipedia-style popovers when hovering over links */
|
||||||
enablePopovers: boolean
|
enablePopovers: boolean
|
||||||
|
/** Whether to enable cursor-chat */
|
||||||
|
enableCursorChat: boolean
|
||||||
/** Analytics mode */
|
/** Analytics mode */
|
||||||
analytics: Analytics
|
analytics: Analytics
|
||||||
/** Glob patterns to not search */
|
/** Glob patterns to not search */
|
||||||
|
@ -235,6 +235,11 @@ export function renderPage(
|
|||||||
</Body>
|
</Body>
|
||||||
<Footer {...componentData} />
|
<Footer {...componentData} />
|
||||||
</div>
|
</div>
|
||||||
|
{cfg.enableCursorChat && (
|
||||||
|
<div id="cursor-chat-layer">
|
||||||
|
<input type="text" id="cursor-chat-box" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</body>
|
</body>
|
||||||
{pageResources.js
|
{pageResources.js
|
||||||
.filter((resource) => resource.loadTime === "afterDOMReady")
|
.filter((resource) => resource.loadTime === "afterDOMReady")
|
||||||
|
@ -138,6 +138,21 @@ function addGlobalPageResources(
|
|||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cfg.enableCursorChat) {
|
||||||
|
staticResources.css.push("https://unpkg.com/cursor-chat/dist/style.css")
|
||||||
|
staticResources.js.push({
|
||||||
|
script: `
|
||||||
|
document.addEventListener('nav', async () => {
|
||||||
|
const chat = await import('https://esm.sh/cursor-chat')
|
||||||
|
chat.initCursorChat(\`cursor-chat-room-\${window.location.host + window.location.pathname}\`, { triggerKey: '.' })
|
||||||
|
})
|
||||||
|
`,
|
||||||
|
loadTime: "afterDOMReady",
|
||||||
|
moduleType: "module",
|
||||||
|
contentType: "inline",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
let wsUrl = `ws://localhost:${ctx.argv.wsPort}`
|
let wsUrl = `ws://localhost:${ctx.argv.wsPort}`
|
||||||
|
|
||||||
if (ctx.argv.remoteDevHost) {
|
if (ctx.argv.remoteDevHost) {
|
||||||
@ -186,7 +201,7 @@ export const ComponentResources: QuartzEmitterPlugin<Options> = (opts?: Partial<
|
|||||||
|
|
||||||
addGlobalPageResources(ctx, resources, componentResources)
|
addGlobalPageResources(ctx, resources, componentResources)
|
||||||
|
|
||||||
const stylesheet = joinStyles(ctx.cfg.configuration.theme, ...componentResources.css, styles)
|
const stylesheet = joinStyles(ctx.cfg.configuration, ...componentResources.css, styles)
|
||||||
const [prescript, postscript] = await Promise.all([
|
const [prescript, postscript] = await Promise.all([
|
||||||
joinScripts(componentResources.beforeDOMLoaded),
|
joinScripts(componentResources.beforeDOMLoaded),
|
||||||
joinScripts(componentResources.afterDOMLoaded),
|
joinScripts(componentResources.afterDOMLoaded),
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { GlobalConfiguration } from "../cfg"
|
||||||
|
|
||||||
export interface ColorScheme {
|
export interface ColorScheme {
|
||||||
light: string
|
light: string
|
||||||
lightgray: string
|
lightgray: string
|
||||||
@ -30,8 +32,20 @@ export function googleFontHref(theme: Theme) {
|
|||||||
return `https://fonts.googleapis.com/css2?family=${code}&family=${header}:wght@400;700&family=${body}:ital,wght@0,400;0,600;1,400;1,600&display=swap`
|
return `https://fonts.googleapis.com/css2?family=${code}&family=${header}:wght@400;700&family=${body}:ital,wght@0,400;0,600;1,400;1,600&display=swap`
|
||||||
}
|
}
|
||||||
|
|
||||||
export function joinStyles(theme: Theme, ...stylesheet: string[]) {
|
export function joinStyles(cfg: GlobalConfiguration, ...stylesheet: string[]) {
|
||||||
|
const theme = cfg.theme
|
||||||
return `
|
return `
|
||||||
|
${
|
||||||
|
cfg.enableCursorChat &&
|
||||||
|
`
|
||||||
|
input#cursor-chat-box {
|
||||||
|
outline: none;
|
||||||
|
background-color: var(--light);
|
||||||
|
font-family: "${cfg.theme.typography.body}", ${DEFAULT_SANS_SERIF} !important;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
${stylesheet.join("\n\n")}
|
${stylesheet.join("\n\n")}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
|
Loading…
Reference in New Issue
Block a user