@tenphi/renderer 0.20.3 → 0.20.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/navigation.js +6 -0
- package/dist/client/navigation.js.map +1 -1
- package/dist/client/search.js +4 -0
- package/dist/client/search.js.map +1 -1
- package/dist/components/GlobalStyles.js +91 -30
- package/dist/components/LayoutComponents.js +16 -2
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/overrides/Search.astro +4 -3
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +7 -3
- package/dist/ui.js.map +1 -1
- package/package.json +2 -2
|
@@ -93,6 +93,12 @@ var CookbookHeaderLinks = class extends HTMLElement {
|
|
|
93
93
|
const close = () => {
|
|
94
94
|
if (panel?.matches(":popover-open")) panel.hidePopover();
|
|
95
95
|
};
|
|
96
|
+
panel?.addEventListener("toggle", () => {
|
|
97
|
+
if (panel.matches(":popover-open")) {
|
|
98
|
+
panel.getBoundingClientRect();
|
|
99
|
+
panel.setAttribute("data-open", "");
|
|
100
|
+
} else panel.removeAttribute("data-open");
|
|
101
|
+
}, { signal });
|
|
96
102
|
desktop.addEventListener("change", () => {
|
|
97
103
|
if (desktop.matches) close();
|
|
98
104
|
}, { signal });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","names":[],"sources":["../../src/client/navigation.ts"],"sourcesContent":["export {};\n\nclass CookbookSidebarPane extends HTMLElement {\n #listeners?: AbortController;\n #inert = new Map<HTMLElement, boolean>();\n #trigger: HTMLButtonElement | undefined;\n\n connectedCallback() {\n this.#listeners?.abort();\n this.#listeners = new AbortController();\n const { signal } = this.#listeners;\n this.#trigger =\n document.querySelector<HTMLButtonElement>(\n '.td-menu-button[popovertarget=\"cookbook__sidebar\"]',\n ) ?? undefined;\n const desktop = matchMedia(\"(min-width: 50rem)\");\n const syncViewport = () => {\n if (desktop.matches) {\n if (this.matches(\":popover-open\")) this.hidePopover();\n this.#release();\n this.popover = null;\n this.removeAttribute(\"role\");\n this.removeAttribute(\"aria-modal\");\n } else {\n this.popover = \"auto\";\n this.setAttribute(\"role\", \"dialog\");\n this.setAttribute(\"aria-modal\", \"true\");\n }\n };\n syncViewport();\n desktop.addEventListener(\"change\", syncViewport, { signal });\n this.addEventListener(\n \"toggle\",\n () => {\n const open = !desktop.matches && this.matches(\":popover-open\");\n this.#trigger?.setAttribute(\"aria-expanded\", String(open));\n if (open) {\n // Establish the closed position after the popover enters the top\n // layer so its attribute change transitions from an actual layout.\n // Tasty's global SSR renderer does not preserve @starting-style.\n this.getBoundingClientRect();\n this.setAttribute(\"data-open\", \"\");\n for (const element of document.querySelectorAll<HTMLElement>(\n \".header, .main-frame, .cookbook-skip-link\",\n )) {\n this.#inert.set(element, element.inert);\n element.inert = true;\n }\n this.querySelector<HTMLElement>(\"[autofocus]\")?.focus({\n preventScroll: true,\n });\n } else {\n const restoreFocus =\n this.contains(document.activeElement) ||\n document.activeElement === document.body;\n this.#release();\n if (restoreFocus && !desktop.matches) this.#trigger?.focus();\n }\n },\n { signal },\n );\n this.addEventListener(\n \"keydown\",\n (event) => {\n if (desktop.matches || !this.matches(\":popover-open\")) return;\n const sections = this.querySelector<HTMLDetailsElement>(\n \".td-mobile-tabs details[open]\",\n );\n if (event.key === \"Escape\" && sections) {\n event.preventDefault();\n sections.open = false;\n sections.querySelector(\"summary\")?.focus();\n return;\n }\n if (event.key !== \"Tab\") return;\n const focusable = Array.from(\n this.querySelectorAll<HTMLElement>(\n 'a[href], button:not([disabled]), select:not([disabled]), input:not([disabled]), summary, [tabindex=\"0\"]',\n ),\n ).filter(\n (element) =>\n element.tabIndex >= 0 && element.getClientRects().length > 0,\n );\n const first = focusable[0];\n const last = focusable.at(-1);\n if (!first || !last) {\n event.preventDefault();\n this.focus();\n return;\n }\n if (\n event.shiftKey &&\n (document.activeElement === first || document.activeElement === this)\n ) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && document.activeElement === last) {\n event.preventDefault();\n first.focus();\n }\n },\n { signal },\n );\n this.addEventListener(\n \"click\",\n (event) => {\n if (\n !event.defaultPrevented &&\n event.target instanceof Element &&\n event.target.closest(\"a[href]\") &&\n this.matches(\":popover-open\")\n )\n this.hidePopover();\n },\n { signal },\n );\n }\n\n #release() {\n this.removeAttribute(\"data-open\");\n for (const [element, inert] of this.#inert) element.inert = inert;\n this.#inert.clear();\n this.#trigger?.setAttribute(\"aria-expanded\", \"false\");\n }\n\n disconnectedCallback() {\n this.#listeners?.abort();\n this.#release();\n }\n}\n\nclass CookbookHeaderLinks extends HTMLElement {\n #listeners?: AbortController;\n connectedCallback() {\n this.#listeners?.abort();\n this.#listeners = new AbortController();\n const { signal } = this.#listeners;\n const panel = this.querySelector<HTMLElement>(\"[popover]\");\n const desktop = matchMedia(\"(min-width: 50rem)\");\n const close = () => {\n if (panel?.matches(\":popover-open\")) panel.hidePopover();\n };\n desktop.addEventListener(\n \"change\",\n () => {\n if (desktop.matches) close();\n },\n { signal },\n );\n panel?.addEventListener(\n \"click\",\n (event) => {\n if (event.target instanceof Element && event.target.closest(\"a[href]\"))\n close();\n },\n { signal },\n );\n }\n disconnectedCallback() {\n this.#listeners?.abort();\n }\n}\n\nif (!customElements.get(\"cookbook-sidebar-pane\"))\n customElements.define(\"cookbook-sidebar-pane\", CookbookSidebarPane);\nif (!customElements.get(\"cookbook-header-links\"))\n customElements.define(\"cookbook-header-links\", CookbookHeaderLinks);\n"],"mappings":";AAEA,IAAM,sBAAN,cAAkC,YAAY;CAC5C;CACA,yBAAS,IAAI,IAA0B;CACvC;CAEA,oBAAoB;EAClB,KAAK,YAAY,MAAM;EACvB,KAAK,aAAa,IAAI,gBAAgB;EACtC,MAAM,EAAE,WAAW,KAAK;EACxB,KAAK,WACH,SAAS,cACP,sDACF,KAAK,KAAA;EACP,MAAM,UAAU,WAAW,oBAAoB;EAC/C,MAAM,qBAAqB;GACzB,IAAI,QAAQ,SAAS;IACnB,IAAI,KAAK,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B,WAAW,MAAM,OAAO,QAAQ,SAAS,GACnE,MAAM;EACV,GACA,EAAE,OAAO,CACX;CACF;CACA,uBAAuB;EACrB,KAAK,YAAY,MAAM;CACzB;AACF;AAEA,IAAI,CAAC,eAAe,IAAI,uBAAuB,GAC7C,eAAe,OAAO,yBAAyB,mBAAmB;AACpE,IAAI,CAAC,eAAe,IAAI,uBAAuB,GAC7C,eAAe,OAAO,yBAAyB,mBAAmB"}
|
|
1
|
+
{"version":3,"file":"navigation.js","names":[],"sources":["../../src/client/navigation.ts"],"sourcesContent":["export {};\n\nclass CookbookSidebarPane extends HTMLElement {\n #listeners?: AbortController;\n #inert = new Map<HTMLElement, boolean>();\n #trigger: HTMLButtonElement | undefined;\n\n connectedCallback() {\n this.#listeners?.abort();\n this.#listeners = new AbortController();\n const { signal } = this.#listeners;\n this.#trigger =\n document.querySelector<HTMLButtonElement>(\n '.td-menu-button[popovertarget=\"cookbook__sidebar\"]',\n ) ?? undefined;\n const desktop = matchMedia(\"(min-width: 50rem)\");\n const syncViewport = () => {\n if (desktop.matches) {\n if (this.matches(\":popover-open\")) this.hidePopover();\n this.#release();\n this.popover = null;\n this.removeAttribute(\"role\");\n this.removeAttribute(\"aria-modal\");\n } else {\n this.popover = \"auto\";\n this.setAttribute(\"role\", \"dialog\");\n this.setAttribute(\"aria-modal\", \"true\");\n }\n };\n syncViewport();\n desktop.addEventListener(\"change\", syncViewport, { signal });\n this.addEventListener(\n \"toggle\",\n () => {\n const open = !desktop.matches && this.matches(\":popover-open\");\n this.#trigger?.setAttribute(\"aria-expanded\", String(open));\n if (open) {\n // Establish the closed position after the popover enters the top\n // layer so its attribute change transitions from an actual layout.\n // Tasty's global SSR renderer does not preserve @starting-style.\n this.getBoundingClientRect();\n this.setAttribute(\"data-open\", \"\");\n for (const element of document.querySelectorAll<HTMLElement>(\n \".header, .main-frame, .cookbook-skip-link\",\n )) {\n this.#inert.set(element, element.inert);\n element.inert = true;\n }\n this.querySelector<HTMLElement>(\"[autofocus]\")?.focus({\n preventScroll: true,\n });\n } else {\n const restoreFocus =\n this.contains(document.activeElement) ||\n document.activeElement === document.body;\n this.#release();\n if (restoreFocus && !desktop.matches) this.#trigger?.focus();\n }\n },\n { signal },\n );\n this.addEventListener(\n \"keydown\",\n (event) => {\n if (desktop.matches || !this.matches(\":popover-open\")) return;\n const sections = this.querySelector<HTMLDetailsElement>(\n \".td-mobile-tabs details[open]\",\n );\n if (event.key === \"Escape\" && sections) {\n event.preventDefault();\n sections.open = false;\n sections.querySelector(\"summary\")?.focus();\n return;\n }\n if (event.key !== \"Tab\") return;\n const focusable = Array.from(\n this.querySelectorAll<HTMLElement>(\n 'a[href], button:not([disabled]), select:not([disabled]), input:not([disabled]), summary, [tabindex=\"0\"]',\n ),\n ).filter(\n (element) =>\n element.tabIndex >= 0 && element.getClientRects().length > 0,\n );\n const first = focusable[0];\n const last = focusable.at(-1);\n if (!first || !last) {\n event.preventDefault();\n this.focus();\n return;\n }\n if (\n event.shiftKey &&\n (document.activeElement === first || document.activeElement === this)\n ) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && document.activeElement === last) {\n event.preventDefault();\n first.focus();\n }\n },\n { signal },\n );\n this.addEventListener(\n \"click\",\n (event) => {\n if (\n !event.defaultPrevented &&\n event.target instanceof Element &&\n event.target.closest(\"a[href]\") &&\n this.matches(\":popover-open\")\n )\n this.hidePopover();\n },\n { signal },\n );\n }\n\n #release() {\n this.removeAttribute(\"data-open\");\n for (const [element, inert] of this.#inert) element.inert = inert;\n this.#inert.clear();\n this.#trigger?.setAttribute(\"aria-expanded\", \"false\");\n }\n\n disconnectedCallback() {\n this.#listeners?.abort();\n this.#release();\n }\n}\n\nclass CookbookHeaderLinks extends HTMLElement {\n #listeners?: AbortController;\n connectedCallback() {\n this.#listeners?.abort();\n this.#listeners = new AbortController();\n const { signal } = this.#listeners;\n const panel = this.querySelector<HTMLElement>(\"[popover]\");\n const desktop = matchMedia(\"(min-width: 50rem)\");\n const close = () => {\n if (panel?.matches(\":popover-open\")) panel.hidePopover();\n };\n panel?.addEventListener(\n \"toggle\",\n () => {\n if (panel.matches(\":popover-open\")) {\n panel.getBoundingClientRect();\n panel.setAttribute(\"data-open\", \"\");\n } else {\n panel.removeAttribute(\"data-open\");\n }\n },\n { signal },\n );\n desktop.addEventListener(\n \"change\",\n () => {\n if (desktop.matches) close();\n },\n { signal },\n );\n panel?.addEventListener(\n \"click\",\n (event) => {\n if (event.target instanceof Element && event.target.closest(\"a[href]\"))\n close();\n },\n { signal },\n );\n }\n disconnectedCallback() {\n this.#listeners?.abort();\n }\n}\n\nif (!customElements.get(\"cookbook-sidebar-pane\"))\n customElements.define(\"cookbook-sidebar-pane\", CookbookSidebarPane);\nif (!customElements.get(\"cookbook-header-links\"))\n customElements.define(\"cookbook-header-links\", CookbookHeaderLinks);\n"],"mappings":";AAEA,IAAM,sBAAN,cAAkC,YAAY;CAC5C;CACA,yBAAS,IAAI,IAA0B;CACvC;CAEA,oBAAoB;EAClB,KAAK,YAAY,MAAM;EACvB,KAAK,aAAa,IAAI,gBAAgB;EACtC,MAAM,EAAE,WAAW,KAAK;EACxB,KAAK,WACH,SAAS,cACP,sDACF,KAAK,KAAA;EACP,MAAM,UAAU,WAAW,oBAAoB;EAC/C,MAAM,qBAAqB;GACzB,IAAI,QAAQ,SAAS;IACnB,IAAI,KAAK,QAAQ,eAAe,GAAG,KAAK,YAAY;IACpD,KAAK,SAAS;IACd,KAAK,UAAU;IACf,KAAK,gBAAgB,MAAM;IAC3B,KAAK,gBAAgB,YAAY;GACnC,OAAO;IACL,KAAK,UAAU;IACf,KAAK,aAAa,QAAQ,QAAQ;IAClC,KAAK,aAAa,cAAc,MAAM;GACxC;EACF;EACA,aAAa;EACb,QAAQ,iBAAiB,UAAU,cAAc,EAAE,OAAO,CAAC;EAC3D,KAAK,iBACH,gBACM;GACJ,MAAM,OAAO,CAAC,QAAQ,WAAW,KAAK,QAAQ,eAAe;GAC7D,KAAK,UAAU,aAAa,i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AAe,IAAI,uBAAuB,GAC7C,eAAe,OAAO,yBAAyB,mBAAmB"}
|
package/dist/client/search.js
CHANGED
|
@@ -52,7 +52,10 @@ function initializeSearch(element, options, development, base) {
|
|
|
52
52
|
const show = async () => {
|
|
53
53
|
if (dialog.open) return;
|
|
54
54
|
returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : open;
|
|
55
|
+
dialog.removeAttribute("data-open");
|
|
55
56
|
dialog.showModal();
|
|
57
|
+
dialog.getBoundingClientRect();
|
|
58
|
+
dialog.setAttribute("data-open", "");
|
|
56
59
|
document.body.setAttribute("data-search-modal-open", "");
|
|
57
60
|
if (!development && status) status.hidden = true;
|
|
58
61
|
try {
|
|
@@ -70,6 +73,7 @@ function initializeSearch(element, options, development, base) {
|
|
|
70
73
|
if (event.target.closest("a[href]") || !frame.contains(event.target)) dialog.close();
|
|
71
74
|
});
|
|
72
75
|
dialog.addEventListener("close", () => {
|
|
76
|
+
dialog.removeAttribute("data-open");
|
|
73
77
|
document.body.removeAttribute("data-search-modal-open");
|
|
74
78
|
returnFocus?.focus();
|
|
75
79
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","names":[],"sources":["../../src/client/search.ts"],"sourcesContent":["type SearchResult = { url: string; sub_results?: SearchResult[] };\ntype PagefindOptions = Record<string, unknown> & {\n processResult?: (result: SearchResult) => SearchResult | void;\n};\n\n/** Own the dialog lifecycle; Pagefind owns indexing, filtering and result rendering. */\nexport function initializeSearch(\n element: HTMLElement,\n options: PagefindOptions,\n development: boolean,\n base: string,\n): void {\n if (element.dataset.initialized) return;\n element.dataset.initialized = \"true\";\n const open = element.querySelector<HTMLButtonElement>(\"[data-open-modal]\")!;\n const close = element.querySelector<HTMLButtonElement>(\"[data-close-modal]\")!;\n const dialog = element.querySelector(\"dialog\")!;\n const frame = element.querySelector(\".dialog-frame\")!;\n const status = element.querySelector<HTMLElement>(\"[data-search-status]\");\n const shortcut = open.querySelector(\"kbd\")!;\n if (/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)) {\n shortcut.querySelector(\"kbd\")!.textContent = \"⌘\";\n open.setAttribute(\"aria-keyshortcuts\", \"Meta+K\");\n }\n delete shortcut.dataset.pending;\n let initialized: Promise<void> | undefined;\n let returnFocus: HTMLElement | null = null;\n const initialize = () => {\n if (development) return Promise.resolve();\n return (initialized ??= (async () => {\n // @ts-expect-error Pagefind publishes no declarations for its default UI.\n const { PagefindUI } = await import(\"@pagefind/default-ui\");\n const translations = JSON.parse(element.dataset.translations ?? \"{}\");\n const format = (url: string) =>\n element.hasAttribute(\"data-strip-trailing-slash\")\n ? url.replace(/(.)\\/(#.*)?$/, \"$1$2\")\n : url;\n new PagefindUI({\n ...options,\n element: \"#cookbook__search\",\n baseUrl: base,\n bundlePath: `${base.replace(/\\/$/, \"\")}/pagefind/`,\n showImages: false,\n showSubResults: true,\n translations,\n processResult(result: SearchResult) {\n result = options.processResult?.(result) ?? result;\n result.url = format(result.url);\n result.sub_results?.forEach((child) => {\n child.url = format(child.url);\n });\n return result;\n },\n });\n })().catch((error: unknown) => {\n initialized = undefined;\n if (status) {\n status.hidden = false;\n // Reuse the localized Pagefind error, with a plain fallback.\n const translations = JSON.parse(element.dataset.translations ?? \"{}\");\n status.textContent =\n translations.error ?? \"Search could not load. Close and try again.\";\n }\n throw error;\n }));\n };\n const show = async () => {\n if (dialog.open) return;\n returnFocus =\n document.activeElement instanceof HTMLElement\n ? document.activeElement\n : open;\n dialog.showModal();\n document.body.setAttribute(\"data-search-modal-open\", \"\");\n if (!development && status) status.hidden = true;\n try {\n await initialize();\n // Pagefind mounts synchronously. Only focus if the user has not closed it.\n if (dialog.open) element.querySelector(\"input\")?.focus();\n } catch {\n /* Keep the close control usable when the search bundle fails. */\n }\n };\n open.addEventListener(\"click\", () => {\n void show();\n });\n open.disabled = false;\n close.addEventListener(\"click\", () => dialog.close());\n dialog.addEventListener(\"click\", (event) => {\n if (!(event.target instanceof Element)) return;\n if (event.target.closest(\"a[href]\") || !frame.contains(event.target))\n dialog.close();\n });\n dialog.addEventListener(\"close\", () => {\n document.body.removeAttribute(\"data-search-modal-open\");\n returnFocus?.focus();\n });\n window.addEventListener(\"keydown\", (event) => {\n if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === \"k\") {\n event.preventDefault();\n if (dialog.open) dialog.close();\n else void show();\n }\n });\n}\n"],"mappings":";;AAMA,SAAgB,iBACd,SACA,SACA,aACA,MACM;CACN,IAAI,QAAQ,QAAQ,aAAa;CACjC,QAAQ,QAAQ,cAAc;CAC9B,MAAM,OAAO,QAAQ,cAAiC,mBAAmB;CACzE,MAAM,QAAQ,QAAQ,cAAiC,oBAAoB;CAC3E,MAAM,SAAS,QAAQ,cAAc,QAAQ;CAC7C,MAAM,QAAQ,QAAQ,cAAc,eAAe;CACnD,MAAM,SAAS,QAAQ,cAA2B,sBAAsB;CACxE,MAAM,WAAW,KAAK,cAAc,KAAK;CACzC,IAAI,0BAA0B,KAAK,UAAU,QAAQ,GAAG;EACtD,SAAS,cAAc,KAAK,CAAC,CAAE,cAAc;EAC7C,KAAK,aAAa,qBAAqB,QAAQ;CACjD;CACA,OAAO,SAAS,QAAQ;CACxB,IAAI;CACJ,IAAI,cAAkC;CACtC,MAAM,mBAAmB;EACvB,IAAI,aAAa,OAAO,QAAQ,QAAQ;EACxC,OAAQ,iBAAiB,YAAY;GAEnC,MAAM,EAAE,eAAe,MAAM,OAAO;GACpC,MAAM,eAAe,KAAK,MAAM,QAAQ,QAAQ,gBAAgB,IAAI;GACpE,MAAM,UAAU,QACd,QAAQ,aAAa,2BAA2B,IAC5C,IAAI,QAAQ,gBAAgB,MAAM,IAClC;GACN,IAAI,WAAW;IACb,GAAG;IACH,SAAS;IACT,SAAS;IACT,YAAY,GAAG,KAAK,QAAQ,OAAO,EAAE,EAAE;IACvC,YAAY;IACZ,gBAAgB;IAChB;IACA,cAAc,QAAsB;KAClC,SAAS,QAAQ,gBAAgB,MAAM,KAAK;KAC5C,OAAO,MAAM,OAAO,OAAO,GAAG;KAC9B,OAAO,aAAa,SAAS,UAAU;MACrC,MAAM,MAAM,OAAO,MAAM,GAAG;KAC9B,CAAC;KACD,OAAO;IACT;GACF,CAAC;EACH,EAAA,CAAG,CAAC,CAAC,OAAO,UAAmB;GAC7B,cAAc,KAAA;GACd,IAAI,QAAQ;IACV,OAAO,SAAS;IAEhB,MAAM,eAAe,KAAK,MAAM,QAAQ,QAAQ,gBAAgB,IAAI;IACpE,OAAO,cACL,aAAa,SAAS;GAC1B;GACA,MAAM;EACR,CAAC;CACH;CACA,MAAM,OAAO,YAAY;EACvB,IAAI,OAAO,MAAM;EACjB,cACE,SAAS,yBAAyB,cAC9B,SAAS,gBACT;EACN,OAAO,UAAU;
|
|
1
|
+
{"version":3,"file":"search.js","names":[],"sources":["../../src/client/search.ts"],"sourcesContent":["type SearchResult = { url: string; sub_results?: SearchResult[] };\ntype PagefindOptions = Record<string, unknown> & {\n processResult?: (result: SearchResult) => SearchResult | void;\n};\n\n/** Own the dialog lifecycle; Pagefind owns indexing, filtering and result rendering. */\nexport function initializeSearch(\n element: HTMLElement,\n options: PagefindOptions,\n development: boolean,\n base: string,\n): void {\n if (element.dataset.initialized) return;\n element.dataset.initialized = \"true\";\n const open = element.querySelector<HTMLButtonElement>(\"[data-open-modal]\")!;\n const close = element.querySelector<HTMLButtonElement>(\"[data-close-modal]\")!;\n const dialog = element.querySelector(\"dialog\")!;\n const frame = element.querySelector(\".dialog-frame\")!;\n const status = element.querySelector<HTMLElement>(\"[data-search-status]\");\n const shortcut = open.querySelector(\"kbd\")!;\n if (/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)) {\n shortcut.querySelector(\"kbd\")!.textContent = \"⌘\";\n open.setAttribute(\"aria-keyshortcuts\", \"Meta+K\");\n }\n delete shortcut.dataset.pending;\n let initialized: Promise<void> | undefined;\n let returnFocus: HTMLElement | null = null;\n const initialize = () => {\n if (development) return Promise.resolve();\n return (initialized ??= (async () => {\n // @ts-expect-error Pagefind publishes no declarations for its default UI.\n const { PagefindUI } = await import(\"@pagefind/default-ui\");\n const translations = JSON.parse(element.dataset.translations ?? \"{}\");\n const format = (url: string) =>\n element.hasAttribute(\"data-strip-trailing-slash\")\n ? url.replace(/(.)\\/(#.*)?$/, \"$1$2\")\n : url;\n new PagefindUI({\n ...options,\n element: \"#cookbook__search\",\n baseUrl: base,\n bundlePath: `${base.replace(/\\/$/, \"\")}/pagefind/`,\n showImages: false,\n showSubResults: true,\n translations,\n processResult(result: SearchResult) {\n result = options.processResult?.(result) ?? result;\n result.url = format(result.url);\n result.sub_results?.forEach((child) => {\n child.url = format(child.url);\n });\n return result;\n },\n });\n })().catch((error: unknown) => {\n initialized = undefined;\n if (status) {\n status.hidden = false;\n // Reuse the localized Pagefind error, with a plain fallback.\n const translations = JSON.parse(element.dataset.translations ?? \"{}\");\n status.textContent =\n translations.error ?? \"Search could not load. Close and try again.\";\n }\n throw error;\n }));\n };\n const show = async () => {\n if (dialog.open) return;\n returnFocus =\n document.activeElement instanceof HTMLElement\n ? document.activeElement\n : open;\n dialog.removeAttribute(\"data-open\");\n dialog.showModal();\n // Establish the initial state after entering the top layer. The global\n // style renderer does not preserve @starting-style in server output.\n dialog.getBoundingClientRect();\n dialog.setAttribute(\"data-open\", \"\");\n document.body.setAttribute(\"data-search-modal-open\", \"\");\n if (!development && status) status.hidden = true;\n try {\n await initialize();\n // Pagefind mounts synchronously. Only focus if the user has not closed it.\n if (dialog.open) element.querySelector(\"input\")?.focus();\n } catch {\n /* Keep the close control usable when the search bundle fails. */\n }\n };\n open.addEventListener(\"click\", () => {\n void show();\n });\n open.disabled = false;\n close.addEventListener(\"click\", () => dialog.close());\n dialog.addEventListener(\"click\", (event) => {\n if (!(event.target instanceof Element)) return;\n if (event.target.closest(\"a[href]\") || !frame.contains(event.target))\n dialog.close();\n });\n dialog.addEventListener(\"close\", () => {\n dialog.removeAttribute(\"data-open\");\n document.body.removeAttribute(\"data-search-modal-open\");\n returnFocus?.focus();\n });\n window.addEventListener(\"keydown\", (event) => {\n if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === \"k\") {\n event.preventDefault();\n if (dialog.open) dialog.close();\n else void show();\n }\n });\n}\n"],"mappings":";;AAMA,SAAgB,iBACd,SACA,SACA,aACA,MACM;CACN,IAAI,QAAQ,QAAQ,aAAa;CACjC,QAAQ,QAAQ,cAAc;CAC9B,MAAM,OAAO,QAAQ,cAAiC,mBAAmB;CACzE,MAAM,QAAQ,QAAQ,cAAiC,oBAAoB;CAC3E,MAAM,SAAS,QAAQ,cAAc,QAAQ;CAC7C,MAAM,QAAQ,QAAQ,cAAc,eAAe;CACnD,MAAM,SAAS,QAAQ,cAA2B,sBAAsB;CACxE,MAAM,WAAW,KAAK,cAAc,KAAK;CACzC,IAAI,0BAA0B,KAAK,UAAU,QAAQ,GAAG;EACtD,SAAS,cAAc,KAAK,CAAC,CAAE,cAAc;EAC7C,KAAK,aAAa,qBAAqB,QAAQ;CACjD;CACA,OAAO,SAAS,QAAQ;CACxB,IAAI;CACJ,IAAI,cAAkC;CACtC,MAAM,mBAAmB;EACvB,IAAI,aAAa,OAAO,QAAQ,QAAQ;EACxC,OAAQ,iBAAiB,YAAY;GAEnC,MAAM,EAAE,eAAe,MAAM,OAAO;GACpC,MAAM,eAAe,KAAK,MAAM,QAAQ,QAAQ,gBAAgB,IAAI;GACpE,MAAM,UAAU,QACd,QAAQ,aAAa,2BAA2B,IAC5C,IAAI,QAAQ,gBAAgB,MAAM,IAClC;GACN,IAAI,WAAW;IACb,GAAG;IACH,SAAS;IACT,SAAS;IACT,YAAY,GAAG,KAAK,QAAQ,OAAO,EAAE,EAAE;IACvC,YAAY;IACZ,gBAAgB;IAChB;IACA,cAAc,QAAsB;KAClC,SAAS,QAAQ,gBAAgB,MAAM,KAAK;KAC5C,OAAO,MAAM,OAAO,OAAO,GAAG;KAC9B,OAAO,aAAa,SAAS,UAAU;MACrC,MAAM,MAAM,OAAO,MAAM,GAAG;KA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
|
|
@@ -40,7 +40,7 @@ export default function GlobalStyles() {
|
|
|
40
40
|
colorScheme: "dark",
|
|
41
41
|
"$docs-nav-height": {
|
|
42
42
|
"": "4.5rem",
|
|
43
|
-
":has(.td-top-tabs)": "
|
|
43
|
+
":has(.td-top-tabs)": "7.25rem",
|
|
44
44
|
"@mobile": "3.5rem",
|
|
45
45
|
"@mobile & [data-has-sidebar]": "6.5rem",
|
|
46
46
|
},
|
|
@@ -313,6 +313,7 @@ export default function GlobalStyles() {
|
|
|
313
313
|
"site-search",
|
|
314
314
|
resolveComponentStyles("Search", {
|
|
315
315
|
display: "contents",
|
|
316
|
+
"$dialog-transition": "120ms",
|
|
316
317
|
Status: {
|
|
317
318
|
$: "[data-search-status]",
|
|
318
319
|
margin: "auto",
|
|
@@ -323,7 +324,7 @@ export default function GlobalStyles() {
|
|
|
323
324
|
Dialog: {
|
|
324
325
|
$: "dialog",
|
|
325
326
|
radius: { "": "$card-radius", "@mobile": "0" },
|
|
326
|
-
inlineSize: { "": "90%
|
|
327
|
+
inlineSize: { "": "0 90% 40rem", "@mobile": "100%" },
|
|
327
328
|
blockSize: { "": "max-content", "@mobile": "100%" },
|
|
328
329
|
maxBlockSize: { "": "(100% - 8rem)", "@mobile": "100%" },
|
|
329
330
|
minBlockSize: { "": "15rem", "@mobile": "100%" },
|
|
@@ -333,6 +334,13 @@ export default function GlobalStyles() {
|
|
|
333
334
|
border: true,
|
|
334
335
|
fill: "#surface",
|
|
335
336
|
shadow: "0 1rem 3rem #shadow",
|
|
337
|
+
opacity: "0",
|
|
338
|
+
scale: { "": "0.98", "@mobile": "1" },
|
|
339
|
+
transition: {
|
|
340
|
+
"": "none",
|
|
341
|
+
"!@reduced-motion":
|
|
342
|
+
"opacity $dialog-transition ease-out, scale $dialog-transition ease-out, display $dialog-transition allow-discrete, overlay $dialog-transition allow-discrete",
|
|
343
|
+
},
|
|
336
344
|
},
|
|
337
345
|
CloseIcon: {
|
|
338
346
|
$: "button[data-close-modal]::before",
|
|
@@ -347,46 +355,58 @@ export default function GlobalStyles() {
|
|
|
347
355
|
mask: `url("${svgIconUrl(closeIcon)}") center / contain no-repeat`,
|
|
348
356
|
},
|
|
349
357
|
OpenDialog: { $: "dialog[open]", display: "flex" },
|
|
358
|
+
EnteredDialog: {
|
|
359
|
+
$: "dialog[open][data-open]",
|
|
360
|
+
opacity: "1",
|
|
361
|
+
scale: "1",
|
|
362
|
+
},
|
|
350
363
|
Backdrop: {
|
|
351
364
|
$: "dialog::backdrop",
|
|
352
365
|
fill: "#overlay",
|
|
353
366
|
backdropFilter: "blur(0.25rem)",
|
|
367
|
+
opacity: "0",
|
|
368
|
+
transition: {
|
|
369
|
+
"": "none",
|
|
370
|
+
"!@reduced-motion":
|
|
371
|
+
"opacity $dialog-transition ease-out, display $dialog-transition allow-discrete, overlay $dialog-transition allow-discrete",
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
EnteredBackdrop: {
|
|
375
|
+
$: "dialog[open][data-open]::backdrop",
|
|
376
|
+
opacity: "1",
|
|
354
377
|
},
|
|
355
378
|
Frame: {
|
|
356
379
|
$: ".dialog-frame",
|
|
357
|
-
position: "relative",
|
|
358
380
|
display: "flex",
|
|
359
381
|
flow: "column",
|
|
360
382
|
flexGrow: "1",
|
|
383
|
+
minBlockSize: "0",
|
|
361
384
|
gap: "($gap * 2)",
|
|
362
|
-
padding: { "": "($gap * 3)", "@mobile": "($gap * 2)" },
|
|
363
|
-
overflow: "
|
|
385
|
+
padding: { "": "($gap * 3)", "@mobile": "($gap * 2) ($gap * 2) 0" },
|
|
386
|
+
overflow: "hidden",
|
|
364
387
|
},
|
|
365
388
|
Container: {
|
|
366
389
|
$: ".search-container",
|
|
390
|
+
display: "flex",
|
|
391
|
+
flow: "column",
|
|
392
|
+
flexGrow: "1",
|
|
367
393
|
inlineSize: "100%",
|
|
368
|
-
|
|
394
|
+
minBlockSize: "0",
|
|
369
395
|
},
|
|
370
396
|
Close: {
|
|
371
397
|
$: "button[data-close-modal]",
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
blockSize: "3rem",
|
|
381
|
-
minBlockSize: "3rem",
|
|
382
|
-
paddingInlineStart: "0.625rem",
|
|
383
|
-
paddingInlineEnd: "0.625rem",
|
|
398
|
+
display: { "": "none", "@mobile": "grid" },
|
|
399
|
+
placeItems: "center",
|
|
400
|
+
alignSelf: "flex-end",
|
|
401
|
+
flexShrink: "0",
|
|
402
|
+
inlineSize: "$docs-menu-button-size",
|
|
403
|
+
blockSize: "$docs-menu-button-size",
|
|
404
|
+
minBlockSize: "$docs-menu-button-size",
|
|
405
|
+
padding: "0",
|
|
384
406
|
color: "#text-soft",
|
|
385
|
-
border:
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
fill: "#surface-3",
|
|
389
|
-
preset: "small / strong",
|
|
407
|
+
border: "0",
|
|
408
|
+
radius: "$header-control-radius",
|
|
409
|
+
fill: "#clear",
|
|
390
410
|
boxShadow: "none",
|
|
391
411
|
cursor: "pointer",
|
|
392
412
|
transition: "color $transition, background-color $transition",
|
|
@@ -394,12 +414,12 @@ export default function GlobalStyles() {
|
|
|
394
414
|
HoverClose: {
|
|
395
415
|
$: "button[data-close-modal]:hover",
|
|
396
416
|
color: "#text",
|
|
397
|
-
fill: "#surface-
|
|
417
|
+
fill: "#surface-2-hover",
|
|
398
418
|
},
|
|
399
419
|
ActiveClose: {
|
|
400
420
|
$: "button[data-close-modal]:active",
|
|
401
421
|
color: "#text",
|
|
402
|
-
fill: "#surface-
|
|
422
|
+
fill: "#surface-2-pressed",
|
|
403
423
|
},
|
|
404
424
|
}),
|
|
405
425
|
);
|
|
@@ -600,7 +620,7 @@ export default function GlobalStyles() {
|
|
|
600
620
|
minBlockSize: "100%",
|
|
601
621
|
inlinePadding: "$docs-sidebar-pad-x",
|
|
602
622
|
gap: "($gap * 2)",
|
|
603
|
-
paddingBlockStart: "($gap * 2)",
|
|
623
|
+
paddingBlockStart: { "": "($gap * 3)", "@mobile": "($gap * 2)" },
|
|
604
624
|
paddingBlockEnd: "($gap * 6)",
|
|
605
625
|
},
|
|
606
626
|
Tree: { $: "cookbook-sidebar", display: "block" },
|
|
@@ -723,7 +743,7 @@ export default function GlobalStyles() {
|
|
|
723
743
|
},
|
|
724
744
|
TopLevelLink: {
|
|
725
745
|
$: 'a.large:not([aria-current="page"])',
|
|
726
|
-
color: "#text",
|
|
746
|
+
color: "#sidebar-text",
|
|
727
747
|
preset: "navigation",
|
|
728
748
|
},
|
|
729
749
|
}),
|
|
@@ -734,7 +754,7 @@ export default function GlobalStyles() {
|
|
|
734
754
|
resolveComponentStyles("TableOfContents", {
|
|
735
755
|
display: "block",
|
|
736
756
|
hide: { "": false, "@narrow-layout": true },
|
|
737
|
-
paddingBlockStart: "($gap *
|
|
757
|
+
paddingBlockStart: "($gap * 4)",
|
|
738
758
|
paddingInlineStart: "$docs-sidebar-pad-x",
|
|
739
759
|
paddingInlineEnd: "$docs-sidebar-pad-x",
|
|
740
760
|
Heading: {
|
|
@@ -1367,6 +1387,10 @@ export default function GlobalStyles() {
|
|
|
1367
1387
|
gap: "$gap",
|
|
1368
1388
|
inlineSize: { "": "100%", "@mobile": "$docs-menu-button-size" },
|
|
1369
1389
|
maxInlineSize: "22rem",
|
|
1390
|
+
marginInlineStart: {
|
|
1391
|
+
"": "0",
|
|
1392
|
+
"@media(w >= 80rem)": "min(5rem, max(0px, calc(100% - 22rem)))",
|
|
1393
|
+
},
|
|
1370
1394
|
blockSize: { "": "$control-height", "@mobile": "$docs-menu-button-size" },
|
|
1371
1395
|
minBlockSize: "0",
|
|
1372
1396
|
padding: { "": "0 $gap 0 ($gap * 1.5)", "@mobile": "0" },
|
|
@@ -1454,6 +1478,10 @@ export default function GlobalStyles() {
|
|
|
1454
1478
|
useGlobalStyles(
|
|
1455
1479
|
"#cookbook__search",
|
|
1456
1480
|
resolveComponentStyles("SearchResults", {
|
|
1481
|
+
display: "flex",
|
|
1482
|
+
flow: "column",
|
|
1483
|
+
flexGrow: "1",
|
|
1484
|
+
minBlockSize: "0",
|
|
1457
1485
|
"$pagefind-ui-primary": "#accent-text",
|
|
1458
1486
|
"$pagefind-ui-text": "#text-soft",
|
|
1459
1487
|
"$pagefind-ui-background": "#surface",
|
|
@@ -1461,9 +1489,31 @@ export default function GlobalStyles() {
|
|
|
1461
1489
|
"$pagefind-ui-border-width": "$border-width",
|
|
1462
1490
|
"$pagefind-ui-tag": "#surface-3",
|
|
1463
1491
|
preset: "body",
|
|
1464
|
-
|
|
1492
|
+
UI: {
|
|
1493
|
+
$: ".pagefind-ui",
|
|
1494
|
+
display: "flex",
|
|
1495
|
+
flow: "column",
|
|
1496
|
+
flexGrow: "1",
|
|
1497
|
+
minBlockSize: "0",
|
|
1498
|
+
},
|
|
1499
|
+
Form: {
|
|
1500
|
+
$: ".pagefind-ui__form",
|
|
1501
|
+
position: "relative",
|
|
1502
|
+
display: "flex",
|
|
1503
|
+
flow: "column",
|
|
1504
|
+
flexGrow: "1",
|
|
1505
|
+
minBlockSize: "0",
|
|
1506
|
+
},
|
|
1507
|
+
Drawer: {
|
|
1508
|
+
$: ".pagefind-ui__drawer",
|
|
1509
|
+
display: "flex",
|
|
1510
|
+
flow: "column",
|
|
1511
|
+
flexGrow: "1",
|
|
1512
|
+
minBlockSize: "0",
|
|
1513
|
+
},
|
|
1465
1514
|
Input: {
|
|
1466
1515
|
$: ".pagefind-ui__search-input",
|
|
1516
|
+
flexShrink: "0",
|
|
1467
1517
|
inlineSize: "100%",
|
|
1468
1518
|
minBlockSize: "3rem",
|
|
1469
1519
|
paddingInlineStart: "2.75rem",
|
|
@@ -1494,7 +1544,15 @@ export default function GlobalStyles() {
|
|
|
1494
1544
|
},
|
|
1495
1545
|
Results: {
|
|
1496
1546
|
$: ".pagefind-ui__results-area",
|
|
1497
|
-
|
|
1547
|
+
flexGrow: "1",
|
|
1548
|
+
minBlockSize: "0",
|
|
1549
|
+
overflowY: "auto",
|
|
1550
|
+
marginBlockStart: { "": "($gap * 3)", "@mobile": "($gap * 2)" },
|
|
1551
|
+
borderBlockStart: "$border-width solid #border",
|
|
1552
|
+
inlineSize: { "@mobile": "(100% + ($gap * 4))" },
|
|
1553
|
+
inlineMargin: { "@mobile": "(-1 * $gap * 2)" },
|
|
1554
|
+
inlinePadding: { "@mobile": "($gap * 2)" },
|
|
1555
|
+
paddingBlockEnd: { "@mobile": "($gap * 2)" },
|
|
1498
1556
|
},
|
|
1499
1557
|
Result: {
|
|
1500
1558
|
$: ".pagefind-ui__result",
|
|
@@ -1544,6 +1602,9 @@ export default function GlobalStyles() {
|
|
|
1544
1602
|
},
|
|
1545
1603
|
More: {
|
|
1546
1604
|
$: ".pagefind-ui__button",
|
|
1605
|
+
display: { "@mobile": "block" },
|
|
1606
|
+
inlineSize: { "@mobile": "max-content" },
|
|
1607
|
+
marginInlineStart: { "@mobile": "auto" },
|
|
1547
1608
|
padding: "1x 2x",
|
|
1548
1609
|
border: true,
|
|
1549
1610
|
radius: "$radius",
|
|
@@ -182,7 +182,7 @@ export const TopNavigationRoot = customizeComponent(
|
|
|
182
182
|
alignItems: "stretch",
|
|
183
183
|
gap: "clamp(1.25rem, 2.5vw, 2.5rem)",
|
|
184
184
|
inlineSize: "100%",
|
|
185
|
-
blockSize: "min 2.
|
|
185
|
+
blockSize: "min 2.75rem",
|
|
186
186
|
blockBorder: "1bw solid #border start",
|
|
187
187
|
overflowX: "auto",
|
|
188
188
|
scrollbar: "none",
|
|
@@ -196,7 +196,7 @@ export const TopNavigationRoot = customizeComponent(
|
|
|
196
196
|
flexGrow: "0",
|
|
197
197
|
flexShrink: "0",
|
|
198
198
|
flexBasis: "auto",
|
|
199
|
-
blockPadding: "($gap *
|
|
199
|
+
blockPadding: "($gap * 1.25) start, $gap end",
|
|
200
200
|
color: "#text-soft",
|
|
201
201
|
preset: "navigation",
|
|
202
202
|
textDecoration: "none",
|
|
@@ -674,6 +674,7 @@ export const HeaderLinksRoot = customizeComponent(
|
|
|
674
674
|
display: "flex",
|
|
675
675
|
flexShrink: "0",
|
|
676
676
|
order: { "": "0", "@mobile": "2" },
|
|
677
|
+
"$popover-transition": "120ms",
|
|
677
678
|
Desktop: {
|
|
678
679
|
$: ".td-header-links__desktop",
|
|
679
680
|
display: "flex",
|
|
@@ -742,6 +743,19 @@ export const HeaderLinksRoot = customizeComponent(
|
|
|
742
743
|
border: true,
|
|
743
744
|
radius: "$card-radius",
|
|
744
745
|
shadow: "0 0.75rem 2rem #shadow",
|
|
746
|
+
opacity: "0",
|
|
747
|
+
scale: "1 0.96",
|
|
748
|
+
transformOrigin: "top right",
|
|
749
|
+
transition: {
|
|
750
|
+
"": "none",
|
|
751
|
+
"!@reduced-motion":
|
|
752
|
+
"opacity $popover-transition ease-out, scale $popover-transition ease-out, display $popover-transition allow-discrete, overlay $popover-transition allow-discrete",
|
|
753
|
+
},
|
|
754
|
+
},
|
|
755
|
+
OpenPanel: {
|
|
756
|
+
$: ".td-header-links__panel:popover-open[data-open]",
|
|
757
|
+
opacity: "1",
|
|
758
|
+
scale: "1",
|
|
745
759
|
},
|
|
746
760
|
PanelNavigation: {
|
|
747
761
|
$: ".td-header-links__panel nav",
|
package/dist/index.js
CHANGED
|
@@ -175,6 +175,17 @@ function assertTastyOutput(html, path) {
|
|
|
175
175
|
visit(tree);
|
|
176
176
|
}
|
|
177
177
|
//#endregion
|
|
178
|
+
//#region src/pagefind-adapter.ts
|
|
179
|
+
/** Pagefind's text clear button measures itself and writes inline padding.
|
|
180
|
+
* Cookbook renders an icon and owns the reserved space in SearchResults.Input.
|
|
181
|
+
* Fail on an upstream change so a dependency upgrade cannot silently restore it.
|
|
182
|
+
*/
|
|
183
|
+
function adaptPagefindUI(source) {
|
|
184
|
+
const assignment = /input_el\.style\.paddingRight = `\$\{width \+ 2\}px`/g;
|
|
185
|
+
if ([...source.matchAll(assignment)].length !== 1) throw new Error("Pagefind's UI sizing changed. Update Cookbook's Tasty adapter before upgrading @pagefind/default-ui.");
|
|
186
|
+
return source.replace(assignment, "undefined");
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
178
189
|
//#region src/markdown/rehype-mermaid.ts
|
|
179
190
|
const sourceStyleDirective = /^\s*(?:classDef|style|linkStyle)\s+.*$/gim;
|
|
180
191
|
const accessibilityDirective = /^\s*acc(?:Title|Descr):\s*.*$/gim;
|
|
@@ -1263,12 +1274,21 @@ function configuredCookbook(options) {
|
|
|
1263
1274
|
shikiConfig: cookbookShikiConfig(context.config.markdown.shikiConfig)
|
|
1264
1275
|
},
|
|
1265
1276
|
vite: {
|
|
1277
|
+
optimizeDeps: { exclude: ["@pagefind/default-ui"] },
|
|
1266
1278
|
ssr: { external: [
|
|
1267
1279
|
"@tenphi/docs",
|
|
1268
1280
|
"react",
|
|
1269
1281
|
"react-dom"
|
|
1270
1282
|
] },
|
|
1271
1283
|
plugins: [
|
|
1284
|
+
{
|
|
1285
|
+
name: "cookbook-pagefind-ui",
|
|
1286
|
+
enforce: "pre",
|
|
1287
|
+
transform(source, id) {
|
|
1288
|
+
const modulePath = id.replaceAll("\\", "/").replace(/\?.*$/, "");
|
|
1289
|
+
if (modulePath.includes("/@pagefind/default-ui/npm_dist/") && /\/ui-core\.(?:mjs|cjs)$/.test(modulePath)) return adaptPagefindUI(source);
|
|
1290
|
+
}
|
|
1291
|
+
},
|
|
1272
1292
|
{
|
|
1273
1293
|
name: "cookbook-server-only-styling",
|
|
1274
1294
|
enforce: "pre",
|