@publier/shell 0.4.0 → 0.5.0

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/index.mjs CHANGED
@@ -1 +1 @@
1
- export{i as HASHED_ASSET_RE,t as docsShell,a as publierCacheControl}from"./integration-DW8qcS1_.mjs";
1
+ export{i as HASHED_ASSET_RE,t as docsShell,a as publierCacheControl}from"./integration-B8fpR1il.mjs";
@@ -0,0 +1,147 @@
1
+ import{remarkAsides as e,remarkDirectivesRestoration as t}from"./plugins/remark-asides.mjs";import n from"./plugins/remark-snippets.mjs";import r from"./plugins/remark-vars.mjs";import{CODE_GROUP_SYNC_SCRIPT as i}from"./runtime/code-group-sync.mjs";import{TABS_SYNC_SCRIPT as a}from"./runtime/tabs-sync.mjs";import{publierCssPlugin as o,publierThemeCssPlugin as s}from"./tailwind/css-plugin.mjs";import{a as c,c as l,l as u,n as d,t as f}from"./presets-BV7ycax-.mjs";import{createRequire as p}from"node:module";import{configResolveShellConfig as m,contentGenerateLlmsTxt as h,generateAnalyticsBodyScripts as ee,generateAnalyticsScripts as te,resolvePublierConfig as g,shellAnnouncementBannerScript as _,shellBuildHeaders as v,shellBuildLicenseErrorMessage as ne,shellCacheControl as y,shellCollectTailwindClassTokens as b,shellComposeTailwindEntry as re,shellInjectBodyScripts as ie,shellInjectHeadScripts as ae,shellLazyUpgradeScript as oe,shellOpenInAiScript as x,shellPlanDefaultRoutes as se,shellPlanRehypePlugins as ce,shellPlanRemarkPlugins as le,shellResolvePrefetch as ue,shellResolveSnippetsConfig as de,shellRewriteHead as fe,shellRewriteModulepreload as S,shellSearchButtonScript as pe,shellSearchDialogScript as C,shellTableOfContentsScript as w,verifyLicense as me}from"@publier/native";import{existsSync as T,lstatSync as E,mkdirSync as D,readFileSync as O,readdirSync as he,writeFileSync as k}from"node:fs";import{writeFile as A}from"node:fs/promises";import j from"node:path";import{fileURLToPath as ge}from"node:url";import{fontProviders as M}from"astro/config";import{fromHtml as N}from"hast-util-from-html";import{toMdast as P}from"hast-util-to-mdast";import{gfmToMarkdown as F}from"mdast-util-gfm";import{toMarkdown as I}from"mdast-util-to-markdown";import{parse as L}from"yaml";import R from"rehype-autolink-headings";import _e from"rehype-external-links";import ve from"remark-directive";const z=/^\/(?:_astro|assets|build)\//;function B(){return v()}function ye(e){return y(e)}function be(e,t){let n=t.map(e=>e.pathname),r=fe(e,n);return{stylesheetsCount:r.stylesheetsCount,modulesCount:r.modulesCount,pagesRewritten:r.pagesRewritten,stylesheets:r.stylesheets,modules:r.modules}}function V(e,t){for(let n of e.children){if(n.type!==`element`)continue;if(t(n))return n;let e=V(n,t);if(e)return e}}function H(e){return e.children.map(e=>e.type===`text`?e.value:e.type===`element`?H(e):``).join(``)}function U(e){let t=e.replace(/^\//,``).replace(/\/$/,``);if(!t)return`/`;for(let e of t.split(`/`)){let t;try{t=decodeURIComponent(e)}catch{return}if(!t||t===`.`||t===`..`||/[\\/?#]/.test(t)||[...t].some(e=>e.charCodeAt(0)<32||e.charCodeAt(0)===127))return}return`/${t}`}function W(e){try{return E(e),!0}catch(e){if(e.code===`ENOENT`)return!1;throw e}}function G(e,t){let n=j.resolve(e),r=j.resolve(n,t);if(!r.startsWith(`${n}${j.sep}`))throw Error(`Unsafe export path: ${t}`);let i=n;for(let e of j.relative(n,r).split(j.sep))if(i=j.join(i,e),W(i)&&E(i).isSymbolicLink())throw Error(`Symlink in export path: ${t}`);return r}function K(e){return!!V(e,e=>e.tagName===`meta`&&String(e.properties.name).toLowerCase()===`robots`&&/(?:^|[\s,])(noindex|none)(?:$|[\s,])/i.test(String(e.properties.content)))}function q(e,t){let n=t.slice(1),r=(n?[`${n}/index.html`,`${n}.html`]:[`index.html`]).find(t=>W(G(e,t)));if(!r)return;let i=G(e,r);return E(i).isFile()?{relative:r,file:i}:void 0}function J(e,t){let n=[],r=/* @__PURE__ */ new Set;for(let{pathname:i}of t){let t=U(i);if(!t||r.has(t)||t===`/404`||t===`/500`)continue;let a=`${t}${t!==`/`&&i.endsWith(`/`)?`/`:``}`,o=t.slice(1),s=q(e,t);if(!s)continue;let{relative:c,file:l}=s,u=N(O(l,`utf-8`));if(K(u)||V(u,e=>e.tagName===`meta`&&String(e.properties.httpEquiv).toLowerCase()===`refresh`))continue;let d=V(u,e=>e.tagName===`title`),f=d&&H(d).replace(/\s+/g,` `).trim();if(!f)continue;let p=V(u,e=>e.tagName===`meta`&&String(e.properties.name).toLowerCase()===`description`),m=String(p?.properties.content??``).replace(/\s+/g,` `).trim()||void 0;r.add(t),n.push({url:a,title:f,description:m,collection:o.split(`/`)[0]||void 0,tree:u,directory:c===`index.html`||c.endsWith(`/index.html`)})}return n.sort((e,t)=>e.url.localeCompare(t.url))}function xe(e,t){return J(e,t).map(({url:e,title:t,description:n,collection:r})=>({url:e,title:t,description:n,collection:r}))}function Se(e,t,n){let r=G(e,`llms.txt`);if(W(r))return{written:!1,pageCount:0,skipped:`existing-file`};let i=xe(e,t);if(i.length===0)return{written:!1,pageCount:0,skipped:`no-pages`};let a=h(JSON.stringify({siteName:n.siteName,siteDescription:n.siteDescription,pages:i,collections:n.collections}));return k(r,a,{encoding:`utf-8`,flag:`wx`}),{written:!0,pageCount:i.length}}function Ce(e,t){let n=t.map(e=>e.pathname),r=S(e,n);return{jsCount:r.jsCount,fontsCount:r.fontsCount,pagesRewritten:r.pagesRewritten}}function we(e,t=[]){for(let n of e.children){if(n.type!==`element`)continue;let e=n.data,r=n.properties.dataPagefindBody===void 0?void 0:e?.position?.properties?.dataPagefindBody;r?.start.offset!==void 0&&r.end.offset!==void 0&&t.push({start:r.start.offset,end:r.end.offset}),we(n,t)}return t}function Te(e){if(!e.includes(`data-pagefind-body`)||!/noindex|none/i.test(e))return;let t=N(e,{verbose:!0});if(!K(t))return;let n=we(t).sort((e,t)=>t.start-e.start);if(n.length===0)return;let r=e;for(let{start:e,end:t}of n){let n=e;for(;n>0&&/\s/.test(r.charAt(n-1));)n--;r=r.slice(0,n)+r.slice(t)}return r}function Ee(e,t){let n=0,r=/* @__PURE__ */ new Set;for(let{pathname:i}of t){let t=U(i);if(!t||r.has(t))continue;r.add(t);let a=q(e,t);if(!a)continue;let o=Te(O(a.file,`utf-8`));o!==void 0&&(k(a.file,o,`utf-8`),n++)}return{pagesRewritten:n}}const De=/* @__PURE__ */ new Set([`nav`,`footer`,`script`,`style`,`noscript`,`template`,`button`,`input`,`select`,`textarea`,`form`,`svg`]),Oe=/* @__PURE__ */ new Set([`navigation`,`search`,`tablist`,`tab`,`button`,`menu`,`toolbar`]);function ke(e){return De.has(e.tagName)||Oe.has(String(e.properties.role))||`dataPagefindIgnore`in e.properties||`dataPublierMarkdownExclude`in e.properties||String(e.properties.dataMdast)===`ignore`}function Ae(e){e.children=e.children.filter(e=>e.type!==`comment`&&(e.type!==`element`||!ke(e)));for(let t of e.children)t.type===`element`&&Ae(t)}function je(e,t,n,r){delete e.properties.hidden,delete e.properties.ariaHidden,delete e.properties.style;for(let i of[`href`,`src`,`poster`]){let a=e.properties[i];if(typeof a!=`string`||!a)continue;let o=new URL(a,t);e.properties[i]=n||o.origin!==r?o.href:`${o.pathname}${o.search}${o.hash}`}if(e.tagName===`pre`){let t=V(e,e=>e.tagName===`code`);if(t){let n=[],r=e=>{for(let t of e.children)t.type===`element`&&(Array.isArray(t.properties.className)&&t.properties.className.includes(`ec-line`)?n.push(t):r(t))};r(t),n.length&&(t.children=[{type:`text`,value:n.map(e=>H(V(e,e=>Array.isArray(e.properties.className)&&e.properties.className.includes(`code`))??e)).join(`
2
+ `)}]);let i=e.properties.dataLanguage;typeof i==`string`&&(t.properties.className=[`language-${i}`])}}for(let i of e.children)i.type===`element`&&je(i,t,n,r)}function Me(e,t){let n=structuredClone(e.tree);Ae(n);let r=V(n,e=>e.tagName===`main`)??V(n,e=>e.tagName===`article`);if(!r)return;let i=e.url===`/`?`/`:e.url.replace(/\/$/,``),a=`${i}${e.directory&&i!==`/`?`/`:``}`,o=new URL(a,t||`https:`),s=o,c=V(e.tree,e=>e.tagName===`base`&&`href`in e.properties)?.properties.href;if(typeof c==`string`)try{let e=new URL(c,o);(e.protocol===`https:`||e.protocol===`http:`)&&(s=e)}catch{}je(r,s,!!t,o.origin);let l=I(P({type:`root`,children:[r]}),{fences:!0,extensions:[F()]});return l.trim()?l:void 0}function Ne(e,t,n){let r=J(e,t).filter(e=>n.collections.length===0||n.collections.includes(e.collection??`pages`)).flatMap(e=>{let t=Me(e,n.siteUrl);return t?[{page:e,markdown:t,relative:`${e.url===`/`?`index`:e.url.slice(1).replace(/\/$/,``)}.md`}]:[]}),i=G(e,`llms-full.txt`),a=/* @__PURE__ */ new Set,o=t=>{if(W(t)&&!E(t).isFile())throw Error(`Markdown export collision: ${j.relative(e,t)}`)};r.length&&(o(i),a.add(i));for(let t of r){let n=G(e,t.relative);if([...a].some(e=>n===e||n.startsWith(`${e}${j.sep}`)||e.startsWith(`${n}${j.sep}`)))throw Error(`Markdown export collision: ${t.relative}`);o(n),a.add(n)}let s={pageCount:r.length,written:0,existing:0,fullWritten:!1};for(let t of r){let n=G(e,t.relative);W(n)?s.existing++:(D(j.dirname(n),{recursive:!0}),k(n,t.markdown,{encoding:`utf-8`,flag:`wx`}),s.written++)}if(r.length&&!W(i)){let e=I({type:`root`,children:[{type:`heading`,depth:1,children:[{type:`text`,value:n.siteName}]},...n.siteDescription?[{type:`blockquote`,children:[{type:`paragraph`,children:[{type:`text`,value:n.siteDescription}]}]}]:[]]}),t=r.map(({page:e,markdown:t})=>{let r=n.siteUrl?new URL(e.url,n.siteUrl).href:e.url;return`${I({type:`root`,children:[{type:`heading`,depth:2,children:[{type:`link`,url:r,children:[{type:`text`,value:e.title}]}]}]})}\n${t}`}).join(`
3
+ ---
4
+
5
+ `);k(i,`${e}\n${t}`,{encoding:`utf-8`,flag:`wx`}),s.fullWritten=!0}return s}function Pe(e,t,n){return n?ae(e,t.map(e=>e.pathname),n):0}function Fe(e,t,n){return n?ie(e,t.map(e=>e.pathname),n):0}const Ie={enabled:!1,full:!1,collections:[]},Le={enabled:!0,hotkey:`k`};function Re(e){let t=m(e),{config:n,errors:r}=JSON.parse(t);if(r.length>0){let e=r.map(e=>` - [${e.code}] ${e.path}: ${e.message}`);throw Error(`Invalid publier.config.yaml:\n${e.join(`
6
+ `)}`)}return{...n,announcement:n.announcement??null,llms:n.llms??Ie,search:n.search??Le}}function ze(e){try{let{errors:t}=g(L(e));return t.filter(e=>e.code===`unknown-key`).map(e=>`[@publier/shell] publier.config.yaml \`${e.path}\` has no effect and is ignored. ${e.message}`)}catch{return[]}}function Be(e){let t=j.join(e,`publier.config.yaml`);if(!T(t))return null;try{return O(t,`utf-8`)}catch{return null}}function Ve(e){e.children&&=e.children.map(t=>t.type===`element`&&t.tagName===`table`?e.properties?.dataPublierTableScroll?t:{type:`element`,tagName:`publier-table-scroll`,properties:{className:[`publier-table-scroll`],dataPublierTableScroll:!0},children:[t]}:(Ve(t),t))}function He(){return Ve}function Ue(e,t){let n=p(import.meta.url);for(let t of[e,n])try{let e=t(`remark-math`),n=t(`rehype-katex`);return{remarkMath:e.default??e,rehypeKatex:n.default??n}}catch{}return t.warn("[@publier/shell] remark-math / rehype-katex unavailable in both project and shell. Reinstall node_modules, or set `docsShell({ math: false })` to opt out."),null}function We(e,t){let n=p(import.meta.url);for(let t of[e,n])try{let e=t(`@astrojs/markdown-remark`);if(typeof e.unified==`function`)return e.unified}catch{}return t.warn("[@publier/shell] @astrojs/markdown-remark is not resolvable. On Astro 7 (Sätteri is the default Markdown processor) this means callouts, {{vars}}, <Snippet>, and math will NOT render — add `@astrojs/markdown-remark` to your dependencies."),null}function Ge(i,a,o){let s=JSON.parse(i),c=[];for(let i of s)switch(i.id){case`remark-vars`:a&&c.push([r,a]);break;case`remark-directive`:c.push(ve);break;case`remark-asides`:c.push(e);break;case`remark-directives-restoration`:c.push(t);break;case`remark-snippets`:c.push([n,i.options]);break;case`remark-math`:o&&c.push(o.remarkMath)}return c}function Ke(e,t){let n=JSON.parse(e),r=[];for(let e of n)switch(e.id){case`rehype-tables`:r.push([He,e.options]);break;case`rehype-autolink-headings`:r.push([R,e.options]);break;case`rehype-external-links`:r.push([_e,e.options]);break;case`rehype-katex`:t&&r.push(t.rehypeKatex)}return r}async function qe(e,t,n,r){if(e.mermaid===!1||t.some(e=>e.name===`astro-mermaid`))return;let i=p(import.meta.url),a=i(`node:fs`),o=i(`node:path`),{pathToFileURL:s}=i(`node:url`),c=o.join(n,`node_modules/astro-mermaid`),l;try{let e=JSON.parse(a.readFileSync(o.join(c,`package.json`),`utf8`)),t=e.exports?.[`.`]?.import??e.main;if(!t)return;l=o.join(c,t)}catch{return}let u=Function(`url`,`return import(url)`),d;try{d=await u(s(l).href)}catch{return}r({integrations:[(d.default??d)({autoTheme:!0})]})}const Je=oe();function Ye({root:e,mathEnabled:t}){let n=p(import.meta.url),r=t=>{try{return j.dirname(n.resolve(`${t}/package.json`,{paths:[e]}))}catch{return null}},i=(e,t)=>{let n=r(e);return n?{abs_path:j.join(n,t).split(j.sep).join(`/`)}:null},a=[i(`@publier/shell`,`src/components`),i(`@publier/shell`,`src/components/ui`),i(`@publier/shell`,`src/routes`),i(`@publier/primitives`,`src/components`)].filter(e=>e!==null),o=null;if(t)try{o=n.resolve(`katex/dist/katex.min.css`).split(j.sep).join(`/`)}catch{o=null}let s=re(JSON.stringify(a),o??void 0),c=b(),l=j.join(e,`.astro`);if(c.length>0){T(l)||D(l,{recursive:!0});let e=j.join(l,`publier-class-safelist.html`),t=c.split(/\s+/).filter(Boolean),n=[];for(let e=0;e<t.length;e+=200)n.push(t.slice(e,e+200).join(` `));let r=n.map(e=>`<div class="${e}"></div>`).join(`
7
+ `);k(e,r,`utf8`);let i=e.split(j.sep).join(`/`);s+=`@source "${i}";\n`}let u=j.join(l,`publier-tailwind-entry.css`);return(T(u)?O(u,`utf8`):``)!==s&&(D(l,{recursive:!0}),k(u,s)),u}function Xe(e,t,n){if(Ze(n))return[];try{let n=e(`@tailwindcss/vite`),r=typeof n==`function`?n:n.default;if(!r)return t.warn(`[@publier/shell] @tailwindcss/vite resolved but has no callable default export. Tailwind v4 + daisyUI utilities WILL NOT be emitted.`),[];let i=r();return Array.isArray(i)?i:[i]}catch{return t.warn('[@publier/shell] @tailwindcss/vite is not installed in this project. Tailwind v4 + daisyUI utilities WILL NOT be emitted — the site will render unstyled. Add `"@tailwindcss/vite": "^4"` to your package.json alongside `tailwindcss`.'),[]}}function Ze(e){for(let t of e){if(!t)continue;if(Array.isArray(t)){if(Ze(t))return!0;continue}let e=t.name;if(typeof e==`string`&&e.startsWith(`@tailwindcss/vite`))return!0}return!1}const Qe=[`light`,`dark`,`system`];function $e(e){return typeof e==`string`&&Qe.includes(e)}function et(e){let t=j.join(e,`theme.yaml`);if(!T(t))return{preset:`light`};let n;try{n=L(O(t,`utf8`))}catch{return{preset:`light`}}let r=n&&typeof n==`object`?n:{},i=typeof r.preset==`string`&&f.includes(r.preset)?r.preset:`light`,a=r.appearance?.default;return{preset:i,appearance:$e(a)?a:void 0}}function tt(e){if(e)try{let t=L(e)?.appearance?.default;return $e(t)?t:void 0}catch{return}}function nt(e,t,n){return n??t??l(e)}function rt(e,t=/* @__PURE__ */ new Set){let n=d[e],r=n?[...t.has(`heading`)?[]:[n.heading],...t.has(`body`)?[]:[n.body]]:t.has(`body`)?[]:[`inter`];return[...new Set(r)].map(e=>({id:e,cssVariable:u(e),name:c[e].family,weights:c[e].weights,fallbacks:c[e].serif?[`Georgia`,`serif`]:[`system-ui`,`sans-serif`],packageName:`@fontsource-variable/${e}`}))}function it(e){return{name:`publier-tailwind-entry-hmr-shim`,apply:`serve`,configureServer(t){let n=t.config.root,r=e.entryPath.startsWith(n)?e.entryPath.slice(n.length).split(j.sep).join(`/`):null;r&&t.middlewares.use(r,(e,t,n)=>{if((e.url??``).includes(`?`)||e.method!==`GET`&&e.method!==`HEAD`)return n();t.setHeader(`Content-Type`,`application/javascript`),t.setHeader(`Cache-Control`,`no-cache`),t.statusCode=200,t.end(`
8
+ if (import.meta.hot) {
9
+ import.meta.hot.accept();
10
+ }
11
+ `)})}}}const at=`import 'astro:scripts/page-ssr.js';
12
+ `;function ot(){return{name:`publier-dev-page-ssr-propagation`,apply:`serve`,enforce:`post`,transform(e,t){let n=t.split(`?`)[0];return!n.endsWith(`.astro`)||!n.includes(`/src/pages/`)||e.includes(at)?null:{code:at+e,map:null}}}}function Y(e,t){let n=e[t];if(n===`\\`&&t+1<e.length)return t+2;if(n===`"`||n===`'`){let r=n,i=t+1;for(;i<e.length&&e[i]!==r;)e[i]===`\\`&&i+1<e.length?i+=2:i++;return i+1}if(n===`/`&&e[t+1]===`*`){let n=e.indexOf(`*/`,t+2);return n===-1?e.length:n+2}return t}function X(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=Y(e,r);if(t!==r){r=t;continue}let i=e[r];i===`{`?n++:i===`}`&&n--,r++}return r}function Z(e){let t=[],n=(r,i)=>{let a=r,o=``,s=r;for(;a<i;){let r=Y(e,a);if(r!==a){a=r;continue}let c=e[a];if(c===`@`&&e.startsWith(`@media`,a)&&/[\s(]/.test(e[a+6]??``)){let n=e.indexOf(`{`,a);if(n===-1||n>=i){a++;continue}let r=X(e,n);o+=e.slice(s,a),t.push(e.slice(a,r)),a=r,s=a}else if(c===`{`){let t=X(e,a);if(t>i)break;let r=n(a+1,t-1);o+=e.slice(s,a+1)+r+`}`,a=t,s=a}else a++}return o+=e.slice(s,i),o},r=0,i=``;for(;r<e.length;){let t=Y(e,r);if(t!==r){r=t;continue}let a=e.indexOf(`@layer utilities`,r);if(a===-1){i+=e.slice(r);break}let o=e[a+16];if(o!==` `&&o!==` `&&o!==`
13
+ `&&o!==`\r`&&o!==`{`){r=a+16;continue}let s=r,c=!1;for(;s<a;){let t=Y(e,s);if(t!==s){if(t>a){c=!0,r=t;break}s=t}else s++}if(c)continue;let l=e.indexOf(`{`,a);if(l===-1){i+=e.slice(r);break}i+=e.slice(r,l+1);let u=X(e,l);i+=n(l+1,u-1),i+=`}`,r=u}return t.length>0&&(i.endsWith(`
14
+ `)||(i+=`
15
+ `),i+=t.join(`
16
+ `),i.endsWith(`
17
+ `)||(i+=`
18
+ `)),i}function st(){return{name:`publier-cascade-hoist`,enforce:`post`,transform(e,t){if(!t.endsWith(`.css`)&&!t.includes(`.css?`))return null;let n=Z(e);return n===e?null:{code:n,map:null}},generateBundle(e,t){for(let e of Object.keys(t)){if(!e.endsWith(`.css`))continue;let n=t[e];if(!n||n.type!==`asset`)continue;let r=typeof n.source==`string`?n.source:new TextDecoder().decode(n.source),i=Z(r);i!==r&&(n.source=i)}}}}function Q(e,t,n){let r=`\0${e}`,i=`export const ${t} = ${JSON.stringify(n)};`;return{name:`publier-${e.replace(/^virtual:publier-/,``)}`,resolveId(t){if(t===e)return r},load(e){if(e===r)return i}}}function ct(e,t=6){return e.length===0?`[]`:e.length<=t?`[${e.join(`, `)}]`:`[${e.slice(0,t).join(`, `)}, +${e.length-t} more]`}function lt(e){let t=[`import '@publier/shell/runtime/marketing-nav';`,Je,a,i,`
19
+ (() => {
20
+ if (customElements.get('publier-table-scroll')) return;
21
+ class PublierTableScroll extends HTMLElement {
22
+ observer;
23
+ frame;
24
+ connectedCallback() {
25
+
26
+ this.frame = requestAnimationFrame(() => {
27
+ if (!this.isConnected) return;
28
+ this.observer = new ResizeObserver(() => this.update());
29
+ this.observer.observe(this);
30
+ const table = this.querySelector('table');
31
+ if (table) this.observer.observe(table);
32
+ this.update();
33
+ });
34
+ }
35
+ disconnectedCallback() {
36
+ cancelAnimationFrame(this.frame);
37
+ this.observer?.disconnect();
38
+ }
39
+ update() {
40
+ if (this.clientWidth > 0 && this.scrollWidth > this.clientWidth) {
41
+ this.setAttribute('tabindex', '0');
42
+ this.setAttribute('role', 'region');
43
+ this.setAttribute('aria-label', this.querySelector('caption')?.textContent.trim() || 'Scrollable table');
44
+ } else {
45
+ this.removeAttribute('tabindex');
46
+ this.removeAttribute('role');
47
+ this.removeAttribute('aria-label');
48
+ }
49
+ }
50
+ }
51
+ customElements.define('publier-table-scroll', PublierTableScroll);
52
+ })();
53
+ `,_(),x(),w()];return e.searchEnabled&&t.push(C(e.searchHotkey),pe()),t.join(`
54
+ `)}function ut(e,t){let n=[],r=[],i=[];for(let a of[`heading`,`body`,`mono`]){let o=e[a];if(!o?.family)continue;let s=`--publier-font-${a}`,c=a===`mono`?[`monospace`]:[`system-ui`,`sans-serif`],l=[o.weight??`400`],u=[o.style??`normal`];if(o.googleFontsUrl)n.push({name:o.family,cssVariable:s,provider:M.google(),fallbacks:c,weights:l,styles:u,subsets:[`latin`]}),r.push(a);else if(o.src){let e=j.isAbsolute(o.src)&&T(o.src)?o.src:j.join(t,`public`,o.src.replace(/^\/+/,``));n.push({name:o.family,cssVariable:s,provider:M.local(),fallbacks:c,weights:l,styles:u,subsets:[`latin`],options:{variants:[{weight:l[0],style:u[0],src:[e]}]}}),r.push(a)}else i.push(`${s}:"${o.family}",${c.join(`,`)};`)}return{entries:n,familyOnlyCss:i.length?`:root{${i.join(``)}}`:``,slots:r}}const dt=[{pkg:`astro-expressive-code`,aliases:[`astro-expressive-code`]},{pkg:`@astrojs/mdx`,aliases:[`@astrojs/mdx`]},{pkg:`@astrojs/sitemap`,aliases:[`@astrojs/sitemap`]},{pkg:`astro-pagefind`,aliases:[`astro-pagefind`,`pagefind`]},{pkg:`@qwik.dev/astro`,aliases:[`@qwik.dev/astro`]}];function $(e,t){let n=j.join(e,`src`,`content`,t);if(!T(n))return!1;try{return he(n,{recursive:!0}).some(e=>typeof e==`string`&&/\.mdx?$/.test(e))}catch{return!1}}function ft(e){return JSON.stringify(e).replace(/</g,`\\u003c`)}function pt(e={}){let t=null,n=``,r=``,i={name:`@publier/shell`,hooks:{"astro:config:setup":async({command:a,config:c,updateConfig:l,injectScript:u,injectRoute:d,logger:f})=>{let m=c.root?ge(c.root):process.cwd();try{me()}catch(e){let t=e instanceof Error?e.message:String(e),n=ne(t);throw n?Error(n):e}let h=p(j.join(m,`package.json`)),g=JSON.stringify(e),_=Be(m),v=Re(_??``);if(_)for(let e of ze(_))f.warn(e);let y=v.site;t={llms:v.llms,siteName:y.name,siteUrl:y.url??void 0,siteDescription:y.description??void 0};let b=v.vars,re=v.fonts,ie=v.nav,ae=v.announcement,oe=v.docs,x=typeof y.url==`string`&&y.url.length>0;x&&!c.site&&l({site:y.url});let fe=new Set(c.integrations.map(e=>e.name)),S=dt.filter(({aliases:e})=>!e.some(e=>fe.has(e)));S.length>0&&f.warn(`[@publier/shell] Required framework integrations are not registered in
55
+ astro.config.ts. As of @publier/shell@2.0.0, docsShell() no longer
56
+ auto-wires these. Add the following to your integrations[] array
57
+ (import statements + entries shown). Order matters: docsShell() must
58
+ come FIRST (astro-expressive-code >=0.43 registers into the Markdown
59
+ processor it finds at its own setup — docsShell's pinned unified()
60
+ processor must already be in place), and expressive-code must precede
61
+ mdx.
62
+
63
+ import expressiveCode from 'astro-expressive-code';
64
+ import mdx from '@astrojs/mdx';
65
+ import sitemap from '@astrojs/sitemap';
66
+ import pagefind from 'astro-pagefind';
67
+ import qwik from '@qwik.dev/astro';
68
+
69
+ integrations: [
70
+ docsShell({ /* options */ }),
71
+ expressiveCode(),
72
+ mdx(),
73
+ sitemap(),
74
+ pagefind(),
75
+ qwik({ clientRouter: true }),
76
+ ]
77
+
78
+ Missing:\n ${S.map(e=>e.pkg).join(`
79
+ `)}\n`);let pe=dt.find(({pkg:e})=>e===`astro-pagefind`)?.aliases??[],C=c.integrations.findIndex(e=>e.name===i.name),w=c.integrations.findIndex(e=>pe.includes(e.name)),E=c.integrations[w];C>=0&&E&&w<C&&f.warn(`[@publier/shell] "${E.name}" is registered before docsShell() in integrations[]. Pagefind indexes dist/ in its own astro:build:done, before docsShell() removes noindex pages from the search index, so pages marked noindex stay in reader search. Fix: move docsShell() BEFORE pagefind() in astro.config.ts integrations[].`);let D=c.prefetch;ue(D===void 0?void 0:JSON.stringify(D),g)&&l({prefetch:{prefetchAll:!0,defaultStrategy:`viewport`}});let{entries:O,familyOnlyCss:he,slots:k}=re?ut(re,m):{entries:[],familyOnlyCss:``,slots:[]},A=et(m),N=nt(A.preset,A.appearance,tt(_)),P=rt(A.preset,new Set(k)),F=v.snippets??null,I=F==null?null:F===!1?`false`:JSON.stringify(F),L=de(g,I??void 0,T(j.join(m,`content/snippets`))),R=JSON.parse(L),_e={...e,snippets:R===null?void 0:R},ve=JSON.stringify(_e),z=e.math!==!1,B=z?Ue(h,f):null,ye=le(ve,!!(b&&Object.keys(b).length>0),R!==null&&R!==!1,z&&B!==null),be=ce(g,z&&B!==null),V=Ge(ye,b,B),H=Ke(be,B),U=We(h,f);await qe(e,c.integrations,m,l);let W=Ye({root:m,mathEnabled:z}),G=lt({searchEnabled:e.search!==!1,searchHotkey:v.search.hotkey}),K=JSON.stringify({docs:$(m,`docs`),blog:$(m,`blog`),changelog:$(m,`changelog`)}),q=JSON.parse(se(g,x,K)),J=q.filter(e=>e.pattern.endsWith(`/rss.xml`)).map(e=>({title:e.pattern===`/blog/rss.xml`?`Blog feed`:e.pattern===`/changelog/rss.xml`?`Changelog feed`:e.pattern,href:e.pattern}));if(U){let e=c.markdown?.processor,t=e?.options?.hastPlugins;e?.name!==`unified`&&Array.isArray(t)&&t.length>0&&f.warn(`[@publier/shell] docsShell() is replacing the configured "${e?.name}" Markdown processor, discarding ${t.length} HAST plugin(s) another integration already registered on it — typically astro-expressive-code >=0.43, which registers into the processor it finds at its own setup. Code fences will silently lose ALL processing (plain <pre><code>, no syntax highlighting). Fix: move docsShell() BEFORE expressiveCode() (and any other Markdown-processor-touching integration) in astro.config.ts integrations[] so they register into docsShell's unified() processor instead.`)}l({markdown:U?{processor:U({remarkPlugins:V,rehypePlugins:H})}:{remarkPlugins:[...V],rehypePlugins:[...H]},vite:{ssr:{noExternal:[`@publier/shell`],external:[`@publier/native`]},build:{rollupOptions:{external:[`@publier/native`]}},optimizeDeps:{exclude:[`@publier/shell`,`@publier/native`]},plugins:[...Xe(h,f,c.vite?.plugins??[]),s({root:m}),o({root:m}),Q(`virtual:publier-nav-config`,`navConfig`,ie),it({entryPath:W}),ot(),Q(`virtual:publier-announcement`,`announcement`,ae),Q(`virtual:publier-site`,`site`,y),Q(`virtual:publier-docs-config`,`docsConfig`,oe),Q(`virtual:publier-appearance`,`appearance`,{...v.appearance,default:N}),Q(`virtual:publier-feeds`,`feeds`,J),Q(`virtual:publier-fonts`,`fonts`,{slots:k,faces:P.map(e=>e.cssVariable)}),st()]}}),l({fonts:[...P.map(e=>({name:e.name,cssVariable:e.cssVariable,provider:M.npm({remote:!1}),fallbacks:e.fallbacks,weights:[e.weights],styles:[`normal`],subsets:[`latin`],options:{package:e.packageName}})),{name:`JetBrains Mono Variable`,cssVariable:`--publier-font-builtin-mono`,provider:M.npm({remote:!1}),fallbacks:[`monospace`],weights:[`100 800`],styles:[`normal`],subsets:[`latin`],options:{package:`@fontsource-variable/jetbrains-mono`}},...O]}),u(`page-ssr`,[`import ${JSON.stringify(W)};`,`import 'virtual:publier-theme-css';`,`import 'virtual:publier-custom-css';`,`import '@publier/shell/styles/base.css';`].join(`
80
+ `)),u(`page`,G),u(`head-inline`,`(function(){
81
+ if (typeof window === 'undefined' || !window.sessionStorage || !window.fetch) return;
82
+ var store = window.sessionStorage;
83
+ var ResponseCtor = window.Response;
84
+ var origFetch = window.fetch.bind(window);
85
+ var NS = 'publier:bg:';
86
+ var PATTERN = /^\\/(?:_astro|assets|build)\\/(?:[^\\/]*bundle-graph[^\\/]*\\.json|q-manifest[^\\/]*\\.json)(?:\\?.*)?$/;
87
+
88
+
89
+
90
+
91
+ var inflight = Object.create(null);
92
+ function serve(body){
93
+ return new ResponseCtor(body, {
94
+ status: 200,
95
+ headers: { 'content-type': 'application/json' }
96
+ });
97
+ }
98
+ window.fetch = function(input, init){
99
+ var url = typeof input === 'string' ? input : (input && input.url) || '';
100
+ var method = (init && init.method) || (input && input.method) || 'GET';
101
+ if (!url || method !== 'GET' || !PATTERN.test(url)) {
102
+ return origFetch(input, init);
103
+ }
104
+ var key = NS + url;
105
+
106
+ try {
107
+ var hit = store.getItem(key);
108
+ if (hit !== null) return Promise.resolve(serve(hit));
109
+ } catch (_) {}
110
+
111
+
112
+ if (inflight[url]) return inflight[url].then(serve);
113
+
114
+
115
+ var pending = origFetch(input, init).then(function(res){
116
+ if (res && res.ok) {
117
+ return res.clone().text().then(function(body){
118
+ try { store.setItem(key, body); } catch (_) {}
119
+ delete inflight[url];
120
+ return res;
121
+ });
122
+ }
123
+ delete inflight[url];
124
+ return res;
125
+ }, function(err){
126
+ delete inflight[url];
127
+ throw err;
128
+ });
129
+
130
+ inflight[url] = pending.then(function(res){
131
+ return res && res.ok ? res.clone().text() : '';
132
+ });
133
+ return pending;
134
+ };
135
+ })();`),he&&u(`head-inline`,`
136
+ const _pFonts = document.createElement('style');
137
+ _pFonts.textContent = ${JSON.stringify(he)};
138
+ document.head.appendChild(_pFonts);
139
+ `);{n=``,r=``;let e=v.analytics;e&&(n=te(e),r=ee(e),a===`dev`&&(n&&u(`head-inline`,`
140
+ const _pAnalytics = document.createRange().createContextualFragment(${ft(n)});
141
+ document.head.appendChild(_pAnalytics);
142
+ `),r&&u(`head-inline`,`
143
+ const _pAnalyticsBody = ${ft(r)};
144
+ const _pInjectBody = () => document.body.appendChild(document.createRange().createContextualFragment(_pAnalyticsBody));
145
+ if (document.body) _pInjectBody();
146
+ else document.addEventListener('DOMContentLoaded', _pInjectBody, { once: true });
147
+ `)))}for(let e of q)d({pattern:e.pattern,entrypoint:e.entrypoint,prerender:e.prerender});q.length>0&&f.info(`[@publier/shell] Injected default routes: ${q.map(e=>e.pattern).join(`, `)}.`),f.info(`[@publier/shell] Plugin pipeline wired.`)},"astro:build:done":async({dir:e,pages:i,logger:a})=>{let o=ge(e),s=j.join(o,`_headers`);await A(s,B(),`utf-8`),a.info(`[@publier/shell] Wrote 5 header rules to dist/_headers.`);let c=be(o,i);c.pagesRewritten>0&&a.info(`[@publier/shell] Backfilled head tags on ${c.pagesRewritten} HTML file(s) (stylesheets=${ct(c.stylesheets)}, modules=${ct(c.modules)}).`);let l=Ce(o,i);l.pagesRewritten>0&&a.info(`[@publier/shell] Injected preload tags into ${l.pagesRewritten} HTML file(s) (js=${l.jsCount}, fonts=${l.fontsCount}).`);let u=Ee(o,i);if(u.pagesRewritten>0&&a.info(`[@publier/shell] Kept ${u.pagesRewritten} noindex page(s) out of search.`),t?.llms.enabled){let e=Se(o,i,{siteName:t.siteName,siteDescription:t.siteDescription,collections:t.llms.collections});if(e.written?a.info(`[@publier/shell] Wrote dist/llms.txt (${e.pageCount} page(s)).`):e.skipped===`existing-file`?a.info(`[@publier/shell] dist/llms.txt already exists — left as-is.`):a.warn(`[@publier/shell] llms.enabled is set but no page had a <title> to index; no llms.txt written.`),t.llms.full){let e=Ne(o,i,{siteName:t.siteName,siteDescription:t.siteDescription,siteUrl:t.siteUrl,collections:t.llms.collections});a.info(`[@publier/shell] Markdown exports: ${e.written} written, ${e.existing} existing; llms-full.txt ${e.fullWritten?`written`:`unchanged`}.`)}}let d=Pe(o,i,n);d>0&&a.info(`[@publier/shell] Injected head scripts into ${d} HTML file(s).`);let f=Fe(o,i,r);f>0&&a.info(`[@publier/shell] Injected body scripts into ${f} HTML file(s).`)}}};return i}export{ye as a,z as i,Z as n,st as r,pt as t};
@@ -1 +1 @@
1
- export{t as docsShell,n as hoistMediaOutOfUtilitiesLayer,r as publierCascadeHoistPlugin}from"./integration-DW8qcS1_.mjs";
1
+ export{t as docsShell,n as hoistMediaOutOfUtilitiesLayer,r as publierCascadeHoistPlugin}from"./integration-B8fpR1il.mjs";
@@ -0,0 +1 @@
1
+ const e=/* @__PURE__ */ `almond.aspen.atrium.broadsheet.canopy.catppuccin.dark.dusk.emerald.enterprise.folio.hearth.lattice.light.maple.marigold.meridian.monolith.neutral.nocturne.ocean.prism.purple.ruby.solar.vitepress`.split(`.`);function t(){return e}function n(t){return e.includes(t)}const r=[`display-xl`,`display-lg`,`display-md`,`heading-lg`,`heading-md`,`heading-sm`,`title`,`body-lg`,`body-md`,`body-sm`,`caption`,`label`,`button`,`code`],i=[`size`,`weight`,`line-height`,`tracking`],a={inter:{family:`Inter Variable`,weights:`100 900`,serif:!1},"plus-jakarta-sans":{family:`Plus Jakarta Sans Variable`,weights:`200 800`,serif:!1},"source-serif-4":{family:`Source Serif 4 Variable`,weights:`200 900`,serif:!0},geist:{family:`Geist Variable`,weights:`100 900`,serif:!1},newsreader:{family:`Newsreader Variable`,weights:`200 800`,serif:!0},"ibm-plex-sans":{family:`IBM Plex Sans Variable`,weights:`100 700`,serif:!1},nunito:{family:`Nunito Variable`,weights:`200 1000`,serif:!1},"dm-sans":{family:`DM Sans Variable`,weights:`100 1000`,serif:!1},"space-grotesk":{family:`Space Grotesk Variable`,weights:`300 700`,serif:!1},manrope:{family:`Manrope Variable`,weights:`200 800`,serif:!1},outfit:{family:`Outfit Variable`,weights:`100 900`,serif:!1}},o={atrium:{heading:`plus-jakarta-sans`,body:`plus-jakarta-sans`},broadsheet:{heading:`source-serif-4`,body:`inter`},canopy:{heading:`geist`,body:`geist`},folio:{heading:`newsreader`,body:`newsreader`},hearth:{heading:`inter`,body:`inter`},lattice:{heading:`ibm-plex-sans`,body:`ibm-plex-sans`},marigold:{heading:`nunito`,body:`nunito`},meridian:{heading:`dm-sans`,body:`dm-sans`},monolith:{heading:`space-grotesk`,body:`inter`},nocturne:{heading:`manrope`,body:`manrope`},prism:{heading:`outfit`,body:`outfit`}};function s(e){return e===`inter`?`--publier-font-builtin-sans`:`--publier-font-builtin-${e}`}const c={canopy:`dark`,nocturne:`dark`};function l(e){return c[e??``]??`system`}export{a,l as c,r as i,s as l,o as n,n as o,i as r,t as s,e as t};
@@ -1 +1 @@
1
- import{a as e,i as t,t as n}from"../presets-BHvXbtBH.mjs";const r=`@publier/shell/tailwind/preset.css`;export{n as AVAILABLE_THEMES,r as PRESET_CSS_PATH,t as isValidPreset,e as listPresets};
1
+ import{o as e,s as t,t as n}from"../presets-BV7ycax-.mjs";const r=`@publier/shell/tailwind/preset.css`;export{n as AVAILABLE_THEMES,r as PRESET_CSS_PATH,e as isValidPreset,t as listPresets};
@@ -14,6 +14,11 @@ interface ThemeYaml {
14
14
  */
15
15
  name?: string;
16
16
  preset?: string;
17
+ /** Default appearance for a first-time visitor; overrides the preset's own. */
18
+ appearance?: {
19
+ default?: 'light' | 'dark' | 'system';
20
+ strict?: boolean;
21
+ };
17
22
  colors?: Record<string, string>;
18
23
  typography?: {
19
24
  heading?: string;
@@ -1,2 +1,2 @@
1
- import{a as e,i as t,n,r,t as i}from"../presets-BHvXbtBH.mjs";import{tailwindComposeThemeCss as a,tailwindReadPresetCss as o,tailwindResolveTheme as s}from"@publier/native";import{fileURLToPath as c}from"node:url";const l=[`colors`,`typography`,`layout`,`prose`,`code`,`spacing`,`radius`,`elevation`,`motion`,`variants`],u={colors:[`primary`,`primary-content`,`secondary`,`secondary-content`,`accent`,`accent-content`,`neutral`,`neutral-content`,`base-100`,`base-200`,`base-300`,`base-content`,`info`,`info-content`,`success`,`success-content`,`warning`,`warning-content`,`error`,`error-content`],typography:[`heading`,`body`,`mono`,`body-weight`,`heading-weight`,...r.flatMap(e=>n.map(t=>`scale-${e}-${t}`))],layout:[`nav-height`,`sidebar-width`,`toc-width`,`page-max-width`],prose:[`content-gap-y`,`line-height`,`heading-line-height`],code:[`block-radius`,`inline-radius`,`inline-padding-y`,`inline-padding-x`],spacing:[`xxs`,`xs`,`sm`,`md`,`base`,`lg`,`xl`,`xxl`,`section`],radius:[`button`,`control`,`card`,`panel`,`chip`],elevation:[`flat`,`raised`,`overlay`],motion:[`duration-fast`,`duration-base`,`duration-slow`,`easing`],variants:[`nav`,`button`,`card`,`hero`,`section`]};function d(e){if(!e||typeof e!=`object`||Array.isArray(e))return{preset:void 0,overrides:{},overrideCss:``,errors:[]};let t=s(JSON.stringify(e));return{preset:t.preset??void 0,overrides:t.overrides,overrideCss:t.overrideCss,errors:t.errors.map(e=>({code:e.code,message:e.message,path:e.path}))}}function f(e){let t=Object.keys(e).sort();return t.length===0?``:`:root[data-theme="light"], :root[data-theme="dark"] {\n${t.map(t=>`\t${t}: ${e[t]};`).join(`
2
- `)}\n}\n`}function p(e,t){let n=d(e),r=t.defaultPreset;return n.preset!==void 0&&(t.isValidPreset(n.preset)?r=n.preset:n.errors.push({code:`unknown-preset`,message:`Unknown preset "${n.preset}". Theme will fall back to "${t.defaultPreset}".`,path:`preset`})),{...n,preset:r}}function m(e,t){return a(e,t)}const h=c(new URL(`./themes/`,import.meta.url));function g(e){return`${h}${e}.css`}async function _(e){return o(h,e)}export{i as AVAILABLE_THEMES,u as THEME_KEYS,l as THEME_SECTIONS,m as composeThemeCss,t as isValidPreset,e as listPresets,_ as loadPresetCss,g as presetPath,f as renderOverrideCss,d as resolveTheme,p as resolveThemeWithPreset};
1
+ import{i as e,o as t,r as n,s as r,t as i}from"../presets-BV7ycax-.mjs";import{tailwindComposeThemeCss as a,tailwindReadPresetCss as o,tailwindResolveTheme as s}from"@publier/native";import{fileURLToPath as c}from"node:url";const l=[`colors`,`typography`,`layout`,`prose`,`code`,`spacing`,`radius`,`elevation`,`motion`,`variants`],u={colors:[`primary`,`primary-content`,`secondary`,`secondary-content`,`accent`,`accent-content`,`neutral`,`neutral-content`,`base-100`,`base-200`,`base-300`,`base-content`,`info`,`info-content`,`success`,`success-content`,`warning`,`warning-content`,`error`,`error-content`],typography:[`heading`,`body`,`mono`,`body-weight`,`heading-weight`,...e.flatMap(e=>n.map(t=>`scale-${e}-${t}`))],layout:[`nav-height`,`sidebar-width`,`toc-width`,`page-max-width`],prose:[`content-gap-y`,`line-height`,`heading-line-height`],code:[`block-radius`,`inline-radius`,`inline-padding-y`,`inline-padding-x`],spacing:[`xxs`,`xs`,`sm`,`md`,`base`,`lg`,`xl`,`xxl`,`section`],radius:[`button`,`control`,`card`,`panel`,`chip`],elevation:[`flat`,`raised`,`overlay`],motion:[`duration-fast`,`duration-base`,`duration-slow`,`easing`],variants:[`nav`,`button`,`card`,`hero`,`section`]};function d(e){if(!e||typeof e!=`object`||Array.isArray(e))return{preset:void 0,overrides:{},overrideCss:``,errors:[]};let t=s(JSON.stringify(e));return{preset:t.preset??void 0,overrides:t.overrides,overrideCss:t.overrideCss,errors:t.errors.map(e=>({code:e.code,message:e.message,path:e.path}))}}function f(e){let t=Object.keys(e).sort();return t.length===0?``:`:root[data-theme="light"], :root[data-theme="dark"] {\n${t.map(t=>`\t${t}: ${e[t]};`).join(`
2
+ `)}\n}\n`}function p(e,t){let n=d(e),r=t.defaultPreset;return n.preset!==void 0&&(t.isValidPreset(n.preset)?r=n.preset:n.errors.push({code:`unknown-preset`,message:`Unknown preset "${n.preset}". Theme will fall back to "${t.defaultPreset}".`,path:`preset`})),{...n,preset:r}}function m(e,t){return a(e,t)}const h=c(new URL(`./themes/`,import.meta.url));function g(e){return`${h}${e}.css`}async function _(e){return o(h,e)}export{i as AVAILABLE_THEMES,u as THEME_KEYS,l as THEME_SECTIONS,m as composeThemeCss,t as isValidPreset,r as listPresets,_ as loadPresetCss,g as presetPath,f as renderOverrideCss,d as resolveTheme,p as resolveThemeWithPreset};
@@ -140,6 +140,9 @@ color-scheme: dark;
140
140
  --publier-font-weight-body: 400;
141
141
  --publier-font-weight-heading: 600;
142
142
 
143
+ --publier-font-preset-heading: var(--publier-font-builtin-plus-jakarta-sans);
144
+ --publier-font-preset-body: var(--publier-font-builtin-plus-jakarta-sans);
145
+
143
146
  --publier-space-xxs: 0.25rem;
144
147
  --publier-space-xs: 0.5rem;
145
148
  --publier-space-sm: 0.75rem;
@@ -140,6 +140,9 @@ color-scheme: dark;
140
140
  --publier-font-weight-body: 400;
141
141
  --publier-font-weight-heading: 700;
142
142
 
143
+ --publier-font-preset-heading: var(--publier-font-builtin-source-serif-4);
144
+ --publier-font-preset-body: var(--publier-font-builtin-sans);
145
+
143
146
  --publier-space-xxs: 0.125rem;
144
147
  --publier-space-xs: 0.25rem;
145
148
  --publier-space-sm: 0.5rem;
@@ -140,6 +140,9 @@ color-scheme: dark;
140
140
  --publier-font-weight-body: 400;
141
141
  --publier-font-weight-heading: 500;
142
142
 
143
+ --publier-font-preset-heading: var(--publier-font-builtin-geist);
144
+ --publier-font-preset-body: var(--publier-font-builtin-geist);
145
+
143
146
  --publier-space-xxs: 0.125rem;
144
147
  --publier-space-xs: 0.25rem;
145
148
  --publier-space-sm: 0.5rem;
@@ -140,6 +140,9 @@ color-scheme: dark;
140
140
  --publier-font-weight-body: 400;
141
141
  --publier-font-weight-heading: 600;
142
142
 
143
+ --publier-font-preset-heading: var(--publier-font-builtin-newsreader);
144
+ --publier-font-preset-body: var(--publier-font-builtin-newsreader);
145
+
143
146
  --publier-space-xxs: 0.25rem;
144
147
  --publier-space-xs: 0.5rem;
145
148
  --publier-space-sm: 0.75rem;
@@ -140,6 +140,9 @@ color-scheme: dark;
140
140
  --publier-font-weight-body: 400;
141
141
  --publier-font-weight-heading: 600;
142
142
 
143
+ --publier-font-preset-heading: var(--publier-font-builtin-sans);
144
+ --publier-font-preset-body: var(--publier-font-builtin-sans);
145
+
143
146
  --publier-space-xxs: 0.125rem;
144
147
  --publier-space-xs: 0.25rem;
145
148
  --publier-space-sm: 0.5rem;
@@ -140,6 +140,9 @@ color-scheme: dark;
140
140
  --publier-font-weight-body: 400;
141
141
  --publier-font-weight-heading: 400;
142
142
 
143
+ --publier-font-preset-heading: var(--publier-font-builtin-ibm-plex-sans);
144
+ --publier-font-preset-body: var(--publier-font-builtin-ibm-plex-sans);
145
+
143
146
  --publier-space-xxs: 0.125rem;
144
147
  --publier-space-xs: 0.25rem;
145
148
  --publier-space-sm: 0.5rem;
@@ -140,6 +140,9 @@ color-scheme: dark;
140
140
  --publier-font-weight-body: 400;
141
141
  --publier-font-weight-heading: 700;
142
142
 
143
+ --publier-font-preset-heading: var(--publier-font-builtin-nunito);
144
+ --publier-font-preset-body: var(--publier-font-builtin-nunito);
145
+
143
146
  --publier-space-xxs: 0.125rem;
144
147
  --publier-space-xs: 0.25rem;
145
148
  --publier-space-sm: 0.5rem;
@@ -140,6 +140,9 @@ color-scheme: dark;
140
140
  --publier-font-weight-body: 400;
141
141
  --publier-font-weight-heading: 400;
142
142
 
143
+ --publier-font-preset-heading: var(--publier-font-builtin-dm-sans);
144
+ --publier-font-preset-body: var(--publier-font-builtin-dm-sans);
145
+
143
146
  --publier-space-xxs: 0.125rem;
144
147
  --publier-space-xs: 0.25rem;
145
148
  --publier-space-sm: 0.5rem;
@@ -140,6 +140,9 @@ color-scheme: dark;
140
140
  --publier-font-weight-body: 400;
141
141
  --publier-font-weight-heading: 600;
142
142
 
143
+ --publier-font-preset-heading: var(--publier-font-builtin-space-grotesk);
144
+ --publier-font-preset-body: var(--publier-font-builtin-sans);
145
+
143
146
  --publier-space-xxs: 0.125rem;
144
147
  --publier-space-xs: 0.25rem;
145
148
  --publier-space-sm: 0.5rem;
@@ -140,6 +140,9 @@ color-scheme: dark;
140
140
  --publier-font-weight-body: 400;
141
141
  --publier-font-weight-heading: 510;
142
142
 
143
+ --publier-font-preset-heading: var(--publier-font-builtin-manrope);
144
+ --publier-font-preset-body: var(--publier-font-builtin-manrope);
145
+
143
146
  --publier-space-xxs: 0.25rem;
144
147
  --publier-space-xs: 0.5rem;
145
148
  --publier-space-sm: 0.75rem;
@@ -140,6 +140,9 @@ color-scheme: dark;
140
140
  --publier-font-weight-body: 400;
141
141
  --publier-font-weight-heading: 700;
142
142
 
143
+ --publier-font-preset-heading: var(--publier-font-builtin-outfit);
144
+ --publier-font-preset-body: var(--publier-font-builtin-outfit);
145
+
143
146
  --publier-space-xxs: 0.25rem;
144
147
  --publier-space-xs: 0.5rem;
145
148
  --publier-space-sm: 0.75rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@publier/shell",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Qwik + Astro docs layout for Publier sites.",
6
6
  "type": "module",
@@ -113,13 +113,23 @@
113
113
  "dependencies": {
114
114
  "@astrojs/rss": "^4.0.19",
115
115
  "@astrojs/sitemap": "^3.7.4",
116
+ "@fontsource-variable/dm-sans": "^5.3.0",
117
+ "@fontsource-variable/geist": "^5.3.0",
118
+ "@fontsource-variable/ibm-plex-sans": "^5.3.0",
116
119
  "@fontsource-variable/inter": "^5.3.0",
117
120
  "@fontsource-variable/jetbrains-mono": "^5.3.0",
121
+ "@fontsource-variable/manrope": "^5.3.0",
122
+ "@fontsource-variable/newsreader": "^5.3.0",
123
+ "@fontsource-variable/nunito": "^5.3.0",
124
+ "@fontsource-variable/outfit": "^5.3.0",
125
+ "@fontsource-variable/plus-jakarta-sans": "^5.3.0",
126
+ "@fontsource-variable/source-serif-4": "^5.3.1",
127
+ "@fontsource-variable/space-grotesk": "^5.3.0",
118
128
  "@github/clipboard-copy-element": "^1.3.2",
119
129
  "@github/details-menu-element": "^1.0.13",
120
130
  "@github/relative-time-element": "^5.3.1",
121
131
  "@github/tab-container-element": "^4.9.0",
122
- "@publier/native": "0.3.0",
132
+ "@publier/native": "0.4.0",
123
133
  "@tailwindcss/typography": "^0.5.20",
124
134
  "astro-pagefind": "^2.0.1",
125
135
  "daisyui": "^5.7.50",
@@ -46,7 +46,7 @@ const [head, bodyOpen, bodyClose] = JSON.parse(shellRenderBaseLayout(JSON.string
46
46
  <html lang={lang} {...htmlHooks}>
47
47
  <head>
48
48
  <Fragment set:html={head} />
49
- <Font cssVariable="--publier-font-builtin-sans" preload />
49
+ {fonts.faces.map((face) => <Font cssVariable={face} preload />)}
50
50
  <Font cssVariable="--publier-font-builtin-mono" />
51
51
  {fonts.slots.includes('heading') && <Font cssVariable="--publier-font-heading" preload />}
52
52
  {fonts.slots.includes('body') && <Font cssVariable="--publier-font-body" preload />}
@@ -39,7 +39,11 @@
39
39
  * configured Google/local
40
40
  * fonts with metric
41
41
  * optimization.
42
- * `--publier-font-builtin-{sans,mono}` — Astro Fonts API output
42
+ * `--publier-font-preset-{body,heading}` — a full preset's own families
43
+ * (themes/<id>.css), each
44
+ * pointing at a built-in
45
+ * face below.
46
+ * `--publier-font-builtin-*` — Astro Fonts API output
43
47
  * for the bundled Inter +
44
48
  * JetBrains Mono (with
45
49
  * optimized fallback
@@ -49,7 +53,7 @@
49
53
  * `--default-font-family`,
50
54
  * base.css read here).
51
55
  *
52
- * Resolution at every step: customer override → built-in → system.
56
+ * Resolution at every step: customer override → preset → built-in → system.
53
57
  * `--font-sans` aliases body so a customer who sets a body font also
54
58
  * gets it from the `font-sans` utility class. Headings inherit body by
55
59
  * default, so a single typography override on body cascades to h1–h6
@@ -63,9 +67,12 @@
63
67
  */
64
68
  --font-body: var(
65
69
  --publier-font-body,
66
- var(--publier-font-builtin-sans, ui-sans-serif, system-ui, sans-serif)
70
+ var(
71
+ --publier-font-preset-body,
72
+ var(--publier-font-builtin-sans, ui-sans-serif, system-ui, sans-serif)
73
+ )
67
74
  );
68
- --font-heading: var(--publier-font-heading, var(--font-body));
75
+ --font-heading: var(--publier-font-heading, var(--publier-font-preset-heading, var(--font-body)));
69
76
  --font-mono: var(
70
77
  --publier-font-mono,
71
78
  var(--publier-font-builtin-mono, ui-monospace, SFMono-Regular, Menlo, monospace)
@@ -198,6 +198,11 @@ declare module 'virtual:publier-fonts' {
198
198
  */
199
199
  export interface FontsConfig {
200
200
  slots: Array<'heading' | 'body' | 'mono'>;
201
+ /**
202
+ * CSS variables of the built-in faces the active preset renders (its
203
+ * heading and body typefaces). base-layout emits a `<Font />` for each.
204
+ */
205
+ faces: string[];
201
206
  }
202
207
  export const fonts: FontsConfig;
203
208
  }
@@ -1,147 +0,0 @@
1
- import{remarkAsides as e,remarkDirectivesRestoration as t}from"./plugins/remark-asides.mjs";import n from"./plugins/remark-snippets.mjs";import r from"./plugins/remark-vars.mjs";import{CODE_GROUP_SYNC_SCRIPT as i}from"./runtime/code-group-sync.mjs";import{TABS_SYNC_SCRIPT as a}from"./runtime/tabs-sync.mjs";import{publierCssPlugin as o,publierThemeCssPlugin as s}from"./tailwind/css-plugin.mjs";import{createRequire as c}from"node:module";import{configResolveShellConfig as l,contentGenerateLlmsTxt as u,generateAnalyticsBodyScripts as d,generateAnalyticsScripts as f,resolvePublierConfig as p,shellAnnouncementBannerScript as m,shellBuildHeaders as h,shellBuildLicenseErrorMessage as ee,shellCacheControl as g,shellCollectTailwindClassTokens as _,shellComposeTailwindEntry as v,shellInjectBodyScripts as y,shellInjectHeadScripts as b,shellLazyUpgradeScript as x,shellOpenInAiScript as S,shellPlanDefaultRoutes as te,shellPlanRehypePlugins as ne,shellPlanRemarkPlugins as re,shellResolvePrefetch as ie,shellResolveSnippetsConfig as ae,shellRewriteHead as C,shellRewriteModulepreload as oe,shellSearchButtonScript as se,shellSearchDialogScript as ce,shellTableOfContentsScript as w,verifyLicense as le}from"@publier/native";import{existsSync as T,lstatSync as E,mkdirSync as D,readFileSync as O,readdirSync as k,writeFileSync as A}from"node:fs";import{writeFile as j}from"node:fs/promises";import M from"node:path";import{fileURLToPath as ue}from"node:url";import{fontProviders as N}from"astro/config";import{fromHtml as P}from"hast-util-from-html";import{toMdast as de}from"hast-util-to-mdast";import{gfmToMarkdown as F}from"mdast-util-gfm";import{toMarkdown as I}from"mdast-util-to-markdown";import{parse as L}from"yaml";import fe from"rehype-autolink-headings";import pe from"rehype-external-links";import R from"remark-directive";const me=/^\/(?:_astro|assets|build)\//;function he(){return h()}function z(e){return g(e)}function B(e,t){let n=t.map(e=>e.pathname),r=C(e,n);return{stylesheetsCount:r.stylesheetsCount,modulesCount:r.modulesCount,pagesRewritten:r.pagesRewritten,stylesheets:r.stylesheets,modules:r.modules}}function V(e,t){for(let n of e.children){if(n.type!==`element`)continue;if(t(n))return n;let e=V(n,t);if(e)return e}}function H(e){return e.children.map(e=>e.type===`text`?e.value:e.type===`element`?H(e):``).join(``)}function U(e){let t=e.replace(/^\//,``).replace(/\/$/,``);if(!t)return`/`;for(let e of t.split(`/`)){let t;try{t=decodeURIComponent(e)}catch{return}if(!t||t===`.`||t===`..`||/[\\/?#]/.test(t)||[...t].some(e=>e.charCodeAt(0)<32||e.charCodeAt(0)===127))return}return`/${t}`}function W(e){try{return E(e),!0}catch(e){if(e.code===`ENOENT`)return!1;throw e}}function G(e,t){let n=M.resolve(e),r=M.resolve(n,t);if(!r.startsWith(`${n}${M.sep}`))throw Error(`Unsafe export path: ${t}`);let i=n;for(let e of M.relative(n,r).split(M.sep))if(i=M.join(i,e),W(i)&&E(i).isSymbolicLink())throw Error(`Symlink in export path: ${t}`);return r}function K(e){return!!V(e,e=>e.tagName===`meta`&&String(e.properties.name).toLowerCase()===`robots`&&/(?:^|[\s,])(noindex|none)(?:$|[\s,])/i.test(String(e.properties.content)))}function q(e,t){let n=t.slice(1),r=(n?[`${n}/index.html`,`${n}.html`]:[`index.html`]).find(t=>W(G(e,t)));if(!r)return;let i=G(e,r);return E(i).isFile()?{relative:r,file:i}:void 0}function J(e,t){let n=[],r=/* @__PURE__ */ new Set;for(let{pathname:i}of t){let t=U(i);if(!t||r.has(t)||t===`/404`||t===`/500`)continue;let a=`${t}${t!==`/`&&i.endsWith(`/`)?`/`:``}`,o=t.slice(1),s=q(e,t);if(!s)continue;let{relative:c,file:l}=s,u=P(O(l,`utf-8`));if(K(u)||V(u,e=>e.tagName===`meta`&&String(e.properties.httpEquiv).toLowerCase()===`refresh`))continue;let d=V(u,e=>e.tagName===`title`),f=d&&H(d).replace(/\s+/g,` `).trim();if(!f)continue;let p=V(u,e=>e.tagName===`meta`&&String(e.properties.name).toLowerCase()===`description`),m=String(p?.properties.content??``).replace(/\s+/g,` `).trim()||void 0;r.add(t),n.push({url:a,title:f,description:m,collection:o.split(`/`)[0]||void 0,tree:u,directory:c===`index.html`||c.endsWith(`/index.html`)})}return n.sort((e,t)=>e.url.localeCompare(t.url))}function Y(e,t){return J(e,t).map(({url:e,title:t,description:n,collection:r})=>({url:e,title:t,description:n,collection:r}))}function ge(e,t,n){let r=G(e,`llms.txt`);if(W(r))return{written:!1,pageCount:0,skipped:`existing-file`};let i=Y(e,t);if(i.length===0)return{written:!1,pageCount:0,skipped:`no-pages`};let a=u(JSON.stringify({siteName:n.siteName,siteDescription:n.siteDescription,pages:i,collections:n.collections}));return A(r,a,{encoding:`utf-8`,flag:`wx`}),{written:!0,pageCount:i.length}}function _e(e,t){let n=t.map(e=>e.pathname),r=oe(e,n);return{jsCount:r.jsCount,fontsCount:r.fontsCount,pagesRewritten:r.pagesRewritten}}function ve(e,t=[]){for(let n of e.children){if(n.type!==`element`)continue;let e=n.data,r=n.properties.dataPagefindBody===void 0?void 0:e?.position?.properties?.dataPagefindBody;r?.start.offset!==void 0&&r.end.offset!==void 0&&t.push({start:r.start.offset,end:r.end.offset}),ve(n,t)}return t}function ye(e){if(!e.includes(`data-pagefind-body`)||!/noindex|none/i.test(e))return;let t=P(e,{verbose:!0});if(!K(t))return;let n=ve(t).sort((e,t)=>t.start-e.start);if(n.length===0)return;let r=e;for(let{start:e,end:t}of n){let n=e;for(;n>0&&/\s/.test(r.charAt(n-1));)n--;r=r.slice(0,n)+r.slice(t)}return r}function be(e,t){let n=0,r=/* @__PURE__ */ new Set;for(let{pathname:i}of t){let t=U(i);if(!t||r.has(t))continue;r.add(t);let a=q(e,t);if(!a)continue;let o=ye(O(a.file,`utf-8`));o!==void 0&&(A(a.file,o,`utf-8`),n++)}return{pagesRewritten:n}}const xe=/* @__PURE__ */ new Set([`nav`,`footer`,`script`,`style`,`noscript`,`template`,`button`,`input`,`select`,`textarea`,`form`,`svg`]),Se=/* @__PURE__ */ new Set([`navigation`,`search`,`tablist`,`tab`,`button`,`menu`,`toolbar`]);function Ce(e){return xe.has(e.tagName)||Se.has(String(e.properties.role))||`dataPagefindIgnore`in e.properties||`dataPublierMarkdownExclude`in e.properties||String(e.properties.dataMdast)===`ignore`}function we(e){e.children=e.children.filter(e=>e.type!==`comment`&&(e.type!==`element`||!Ce(e)));for(let t of e.children)t.type===`element`&&we(t)}function Te(e,t,n,r){delete e.properties.hidden,delete e.properties.ariaHidden,delete e.properties.style;for(let i of[`href`,`src`,`poster`]){let a=e.properties[i];if(typeof a!=`string`||!a)continue;let o=new URL(a,t);e.properties[i]=n||o.origin!==r?o.href:`${o.pathname}${o.search}${o.hash}`}if(e.tagName===`pre`){let t=V(e,e=>e.tagName===`code`);if(t){let n=[],r=e=>{for(let t of e.children)t.type===`element`&&(Array.isArray(t.properties.className)&&t.properties.className.includes(`ec-line`)?n.push(t):r(t))};r(t),n.length&&(t.children=[{type:`text`,value:n.map(e=>H(V(e,e=>Array.isArray(e.properties.className)&&e.properties.className.includes(`code`))??e)).join(`
2
- `)}]);let i=e.properties.dataLanguage;typeof i==`string`&&(t.properties.className=[`language-${i}`])}}for(let i of e.children)i.type===`element`&&Te(i,t,n,r)}function Ee(e,t){let n=structuredClone(e.tree);we(n);let r=V(n,e=>e.tagName===`main`)??V(n,e=>e.tagName===`article`);if(!r)return;let i=e.url===`/`?`/`:e.url.replace(/\/$/,``),a=`${i}${e.directory&&i!==`/`?`/`:``}`,o=new URL(a,t||`https:`),s=o,c=V(e.tree,e=>e.tagName===`base`&&`href`in e.properties)?.properties.href;if(typeof c==`string`)try{let e=new URL(c,o);(e.protocol===`https:`||e.protocol===`http:`)&&(s=e)}catch{}Te(r,s,!!t,o.origin);let l=I(de({type:`root`,children:[r]}),{fences:!0,extensions:[F()]});return l.trim()?l:void 0}function De(e,t,n){let r=J(e,t).filter(e=>n.collections.length===0||n.collections.includes(e.collection??`pages`)).flatMap(e=>{let t=Ee(e,n.siteUrl);return t?[{page:e,markdown:t,relative:`${e.url===`/`?`index`:e.url.slice(1).replace(/\/$/,``)}.md`}]:[]}),i=G(e,`llms-full.txt`),a=/* @__PURE__ */ new Set,o=t=>{if(W(t)&&!E(t).isFile())throw Error(`Markdown export collision: ${M.relative(e,t)}`)};r.length&&(o(i),a.add(i));for(let t of r){let n=G(e,t.relative);if([...a].some(e=>n===e||n.startsWith(`${e}${M.sep}`)||e.startsWith(`${n}${M.sep}`)))throw Error(`Markdown export collision: ${t.relative}`);o(n),a.add(n)}let s={pageCount:r.length,written:0,existing:0,fullWritten:!1};for(let t of r){let n=G(e,t.relative);W(n)?s.existing++:(D(M.dirname(n),{recursive:!0}),A(n,t.markdown,{encoding:`utf-8`,flag:`wx`}),s.written++)}if(r.length&&!W(i)){let e=I({type:`root`,children:[{type:`heading`,depth:1,children:[{type:`text`,value:n.siteName}]},...n.siteDescription?[{type:`blockquote`,children:[{type:`paragraph`,children:[{type:`text`,value:n.siteDescription}]}]}]:[]]}),t=r.map(({page:e,markdown:t})=>{let r=n.siteUrl?new URL(e.url,n.siteUrl).href:e.url;return`${I({type:`root`,children:[{type:`heading`,depth:2,children:[{type:`link`,url:r,children:[{type:`text`,value:e.title}]}]}]})}\n${t}`}).join(`
3
- ---
4
-
5
- `);A(i,`${e}\n${t}`,{encoding:`utf-8`,flag:`wx`}),s.fullWritten=!0}return s}function Oe(e,t,n){return n?b(e,t.map(e=>e.pathname),n):0}function ke(e,t,n){return n?y(e,t.map(e=>e.pathname),n):0}const Ae={enabled:!1,full:!1,collections:[]},je={enabled:!0,hotkey:`k`};function Me(e){let t=l(e),{config:n,errors:r}=JSON.parse(t);if(r.length>0){let e=r.map(e=>` - [${e.code}] ${e.path}: ${e.message}`);throw Error(`Invalid publier.config.yaml:\n${e.join(`
6
- `)}`)}return{...n,announcement:n.announcement??null,llms:n.llms??Ae,search:n.search??je}}function Ne(e){try{let{errors:t}=p(L(e));return t.filter(e=>e.code===`unknown-key`).map(e=>`[@publier/shell] publier.config.yaml \`${e.path}\` has no effect and is ignored. ${e.message}`)}catch{return[]}}function Pe(e){let t=M.join(e,`publier.config.yaml`);if(!T(t))return null;try{return O(t,`utf-8`)}catch{return null}}function Fe(e){e.children&&=e.children.map(t=>t.type===`element`&&t.tagName===`table`?e.properties?.dataPublierTableScroll?t:{type:`element`,tagName:`publier-table-scroll`,properties:{className:[`publier-table-scroll`],dataPublierTableScroll:!0},children:[t]}:(Fe(t),t))}function Ie(){return Fe}function Le(e,t){let n=c(import.meta.url);for(let t of[e,n])try{let e=t(`remark-math`),n=t(`rehype-katex`);return{remarkMath:e.default??e,rehypeKatex:n.default??n}}catch{}return t.warn("[@publier/shell] remark-math / rehype-katex unavailable in both project and shell. Reinstall node_modules, or set `docsShell({ math: false })` to opt out."),null}function Re(e,t){let n=c(import.meta.url);for(let t of[e,n])try{let e=t(`@astrojs/markdown-remark`);if(typeof e.unified==`function`)return e.unified}catch{}return t.warn("[@publier/shell] @astrojs/markdown-remark is not resolvable. On Astro 7 (Sätteri is the default Markdown processor) this means callouts, {{vars}}, <Snippet>, and math will NOT render — add `@astrojs/markdown-remark` to your dependencies."),null}function ze(i,a,o){let s=JSON.parse(i),c=[];for(let i of s)switch(i.id){case`remark-vars`:a&&c.push([r,a]);break;case`remark-directive`:c.push(R);break;case`remark-asides`:c.push(e);break;case`remark-directives-restoration`:c.push(t);break;case`remark-snippets`:c.push([n,i.options]);break;case`remark-math`:o&&c.push(o.remarkMath)}return c}function Be(e,t){let n=JSON.parse(e),r=[];for(let e of n)switch(e.id){case`rehype-tables`:r.push([Ie,e.options]);break;case`rehype-autolink-headings`:r.push([fe,e.options]);break;case`rehype-external-links`:r.push([pe,e.options]);break;case`rehype-katex`:t&&r.push(t.rehypeKatex)}return r}async function Ve(e,t,n,r){if(e.mermaid===!1||t.some(e=>e.name===`astro-mermaid`))return;let i=c(import.meta.url),a=i(`node:fs`),o=i(`node:path`),{pathToFileURL:s}=i(`node:url`),l=o.join(n,`node_modules/astro-mermaid`),u;try{let e=JSON.parse(a.readFileSync(o.join(l,`package.json`),`utf8`)),t=e.exports?.[`.`]?.import??e.main;if(!t)return;u=o.join(l,t)}catch{return}let d=Function(`url`,`return import(url)`),f;try{f=await d(s(u).href)}catch{return}r({integrations:[(f.default??f)({autoTheme:!0})]})}const He=x();function Ue({root:e,mathEnabled:t}){let n=c(import.meta.url),r=t=>{try{return M.dirname(n.resolve(`${t}/package.json`,{paths:[e]}))}catch{return null}},i=(e,t)=>{let n=r(e);return n?{abs_path:M.join(n,t).split(M.sep).join(`/`)}:null},a=[i(`@publier/shell`,`src/components`),i(`@publier/shell`,`src/components/ui`),i(`@publier/shell`,`src/routes`),i(`@publier/primitives`,`src/components`)].filter(e=>e!==null),o=null;if(t)try{o=n.resolve(`katex/dist/katex.min.css`).split(M.sep).join(`/`)}catch{o=null}let s=v(JSON.stringify(a),o??void 0),l=_(),u=M.join(e,`.astro`);if(l.length>0){T(u)||D(u,{recursive:!0});let e=M.join(u,`publier-class-safelist.html`),t=l.split(/\s+/).filter(Boolean),n=[];for(let e=0;e<t.length;e+=200)n.push(t.slice(e,e+200).join(` `));let r=n.map(e=>`<div class="${e}"></div>`).join(`
7
- `);A(e,r,`utf8`);let i=e.split(M.sep).join(`/`);s+=`@source "${i}";\n`}let d=M.join(u,`publier-tailwind-entry.css`);return(T(d)?O(d,`utf8`):``)!==s&&(D(u,{recursive:!0}),A(d,s)),d}function We(e,t,n){if(Ge(n))return[];try{let n=e(`@tailwindcss/vite`),r=typeof n==`function`?n:n.default;if(!r)return t.warn(`[@publier/shell] @tailwindcss/vite resolved but has no callable default export. Tailwind v4 + daisyUI utilities WILL NOT be emitted.`),[];let i=r();return Array.isArray(i)?i:[i]}catch{return t.warn('[@publier/shell] @tailwindcss/vite is not installed in this project. Tailwind v4 + daisyUI utilities WILL NOT be emitted — the site will render unstyled. Add `"@tailwindcss/vite": "^4"` to your package.json alongside `tailwindcss`.'),[]}}function Ge(e){for(let t of e){if(!t)continue;if(Array.isArray(t)){if(Ge(t))return!0;continue}let e=t.name;if(typeof e==`string`&&e.startsWith(`@tailwindcss/vite`))return!0}return!1}function Ke(e){return{name:`publier-tailwind-entry-hmr-shim`,apply:`serve`,configureServer(t){let n=t.config.root,r=e.entryPath.startsWith(n)?e.entryPath.slice(n.length).split(M.sep).join(`/`):null;r&&t.middlewares.use(r,(e,t,n)=>{if((e.url??``).includes(`?`)||e.method!==`GET`&&e.method!==`HEAD`)return n();t.setHeader(`Content-Type`,`application/javascript`),t.setHeader(`Cache-Control`,`no-cache`),t.statusCode=200,t.end(`
8
- if (import.meta.hot) {
9
- import.meta.hot.accept();
10
- }
11
- `)})}}}const qe=`import 'astro:scripts/page-ssr.js';
12
- `;function Je(){return{name:`publier-dev-page-ssr-propagation`,apply:`serve`,enforce:`post`,transform(e,t){let n=t.split(`?`)[0];return!n.endsWith(`.astro`)||!n.includes(`/src/pages/`)||e.includes(qe)?null:{code:qe+e,map:null}}}}function X(e,t){let n=e[t];if(n===`\\`&&t+1<e.length)return t+2;if(n===`"`||n===`'`){let r=n,i=t+1;for(;i<e.length&&e[i]!==r;)e[i]===`\\`&&i+1<e.length?i+=2:i++;return i+1}if(n===`/`&&e[t+1]===`*`){let n=e.indexOf(`*/`,t+2);return n===-1?e.length:n+2}return t}function Z(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=X(e,r);if(t!==r){r=t;continue}let i=e[r];i===`{`?n++:i===`}`&&n--,r++}return r}function Q(e){let t=[],n=(r,i)=>{let a=r,o=``,s=r;for(;a<i;){let r=X(e,a);if(r!==a){a=r;continue}let c=e[a];if(c===`@`&&e.startsWith(`@media`,a)&&/[\s(]/.test(e[a+6]??``)){let n=e.indexOf(`{`,a);if(n===-1||n>=i){a++;continue}let r=Z(e,n);o+=e.slice(s,a),t.push(e.slice(a,r)),a=r,s=a}else if(c===`{`){let t=Z(e,a);if(t>i)break;let r=n(a+1,t-1);o+=e.slice(s,a+1)+r+`}`,a=t,s=a}else a++}return o+=e.slice(s,i),o},r=0,i=``;for(;r<e.length;){let t=X(e,r);if(t!==r){r=t;continue}let a=e.indexOf(`@layer utilities`,r);if(a===-1){i+=e.slice(r);break}let o=e[a+16];if(o!==` `&&o!==` `&&o!==`
13
- `&&o!==`\r`&&o!==`{`){r=a+16;continue}let s=r,c=!1;for(;s<a;){let t=X(e,s);if(t!==s){if(t>a){c=!0,r=t;break}s=t}else s++}if(c)continue;let l=e.indexOf(`{`,a);if(l===-1){i+=e.slice(r);break}i+=e.slice(r,l+1);let u=Z(e,l);i+=n(l+1,u-1),i+=`}`,r=u}return t.length>0&&(i.endsWith(`
14
- `)||(i+=`
15
- `),i+=t.join(`
16
- `),i.endsWith(`
17
- `)||(i+=`
18
- `)),i}function Ye(){return{name:`publier-cascade-hoist`,enforce:`post`,transform(e,t){if(!t.endsWith(`.css`)&&!t.includes(`.css?`))return null;let n=Q(e);return n===e?null:{code:n,map:null}},generateBundle(e,t){for(let e of Object.keys(t)){if(!e.endsWith(`.css`))continue;let n=t[e];if(!n||n.type!==`asset`)continue;let r=typeof n.source==`string`?n.source:new TextDecoder().decode(n.source),i=Q(r);i!==r&&(n.source=i)}}}}function $(e,t,n){let r=`\0${e}`,i=`export const ${t} = ${JSON.stringify(n)};`;return{name:`publier-${e.replace(/^virtual:publier-/,``)}`,resolveId(t){if(t===e)return r},load(e){if(e===r)return i}}}function Xe(e,t=6){return e.length===0?`[]`:e.length<=t?`[${e.join(`, `)}]`:`[${e.slice(0,t).join(`, `)}, +${e.length-t} more]`}function Ze(e){let t=[`import '@publier/shell/runtime/marketing-nav';`,He,a,i,`
19
- (() => {
20
- if (customElements.get('publier-table-scroll')) return;
21
- class PublierTableScroll extends HTMLElement {
22
- observer;
23
- frame;
24
- connectedCallback() {
25
-
26
- this.frame = requestAnimationFrame(() => {
27
- if (!this.isConnected) return;
28
- this.observer = new ResizeObserver(() => this.update());
29
- this.observer.observe(this);
30
- const table = this.querySelector('table');
31
- if (table) this.observer.observe(table);
32
- this.update();
33
- });
34
- }
35
- disconnectedCallback() {
36
- cancelAnimationFrame(this.frame);
37
- this.observer?.disconnect();
38
- }
39
- update() {
40
- if (this.clientWidth > 0 && this.scrollWidth > this.clientWidth) {
41
- this.setAttribute('tabindex', '0');
42
- this.setAttribute('role', 'region');
43
- this.setAttribute('aria-label', this.querySelector('caption')?.textContent.trim() || 'Scrollable table');
44
- } else {
45
- this.removeAttribute('tabindex');
46
- this.removeAttribute('role');
47
- this.removeAttribute('aria-label');
48
- }
49
- }
50
- }
51
- customElements.define('publier-table-scroll', PublierTableScroll);
52
- })();
53
- `,m(),S(),w()];return e.searchEnabled&&t.push(ce(e.searchHotkey),se()),t.join(`
54
- `)}function Qe(e,t){let n=[],r=[],i=[];for(let a of[`heading`,`body`,`mono`]){let o=e[a];if(!o?.family)continue;let s=`--publier-font-${a}`,c=a===`mono`?[`monospace`]:[`system-ui`,`sans-serif`],l=[o.weight??`400`],u=[o.style??`normal`];if(o.googleFontsUrl)n.push({name:o.family,cssVariable:s,provider:N.google(),fallbacks:c,weights:l,styles:u,subsets:[`latin`]}),r.push(a);else if(o.src){let e=M.isAbsolute(o.src)&&T(o.src)?o.src:M.join(t,`public`,o.src.replace(/^\/+/,``));n.push({name:o.family,cssVariable:s,provider:N.local(),fallbacks:c,weights:l,styles:u,subsets:[`latin`],options:{variants:[{weight:l[0],style:u[0],src:[e]}]}}),r.push(a)}else i.push(`${s}:"${o.family}",${c.join(`,`)};`)}return{entries:n,familyOnlyCss:i.length?`:root{${i.join(``)}}`:``,slots:r}}const $e=[{pkg:`astro-expressive-code`,aliases:[`astro-expressive-code`]},{pkg:`@astrojs/mdx`,aliases:[`@astrojs/mdx`]},{pkg:`@astrojs/sitemap`,aliases:[`@astrojs/sitemap`]},{pkg:`astro-pagefind`,aliases:[`astro-pagefind`,`pagefind`]},{pkg:`@qwik.dev/astro`,aliases:[`@qwik.dev/astro`]}];function et(e,t){let n=M.join(e,`src`,`content`,t);if(!T(n))return!1;try{return k(n,{recursive:!0}).some(e=>typeof e==`string`&&/\.mdx?$/.test(e))}catch{return!1}}function tt(e){return JSON.stringify(e).replace(/</g,`\\u003c`)}function nt(e={}){let t=null,n=``,r=``,i={name:`@publier/shell`,hooks:{"astro:config:setup":async({command:a,config:l,updateConfig:u,injectScript:p,injectRoute:m,logger:h})=>{let g=l.root?ue(l.root):process.cwd();try{le()}catch(e){let t=e instanceof Error?e.message:String(e),n=ee(t);throw n?Error(n):e}let _=c(M.join(g,`package.json`)),v=JSON.stringify(e),y=Pe(g),b=Me(y??``);if(y)for(let e of Ne(y))h.warn(e);let x=b.site;t={llms:b.llms,siteName:x.name,siteUrl:x.url??void 0,siteDescription:x.description??void 0};let S=b.vars,C=b.fonts,oe=b.nav,se=b.announcement,ce=b.docs,w=typeof x.url==`string`&&x.url.length>0;w&&!l.site&&u({site:x.url});let E=new Set(l.integrations.map(e=>e.name)),D=$e.filter(({aliases:e})=>!e.some(e=>E.has(e)));D.length>0&&h.warn(`[@publier/shell] Required framework integrations are not registered in
55
- astro.config.ts. As of @publier/shell@2.0.0, docsShell() no longer
56
- auto-wires these. Add the following to your integrations[] array
57
- (import statements + entries shown). Order matters: docsShell() must
58
- come FIRST (astro-expressive-code >=0.43 registers into the Markdown
59
- processor it finds at its own setup — docsShell's pinned unified()
60
- processor must already be in place), and expressive-code must precede
61
- mdx.
62
-
63
- import expressiveCode from 'astro-expressive-code';
64
- import mdx from '@astrojs/mdx';
65
- import sitemap from '@astrojs/sitemap';
66
- import pagefind from 'astro-pagefind';
67
- import qwik from '@qwik.dev/astro';
68
-
69
- integrations: [
70
- docsShell({ /* options */ }),
71
- expressiveCode(),
72
- mdx(),
73
- sitemap(),
74
- pagefind(),
75
- qwik({ clientRouter: true }),
76
- ]
77
-
78
- Missing:\n ${D.map(e=>e.pkg).join(`
79
- `)}\n`);let O=$e.find(({pkg:e})=>e===`astro-pagefind`)?.aliases??[],k=l.integrations.findIndex(e=>e.name===i.name),A=l.integrations.findIndex(e=>O.includes(e.name)),j=l.integrations[A];k>=0&&j&&A<k&&h.warn(`[@publier/shell] "${j.name}" is registered before docsShell() in integrations[]. Pagefind indexes dist/ in its own astro:build:done, before docsShell() removes noindex pages from the search index, so pages marked noindex stay in reader search. Fix: move docsShell() BEFORE pagefind() in astro.config.ts integrations[].`);let P=l.prefetch;ie(P===void 0?void 0:JSON.stringify(P),v)&&u({prefetch:{prefetchAll:!0,defaultStrategy:`viewport`}});let{entries:de,familyOnlyCss:F,slots:I}=C?Qe(C,g):{entries:[],familyOnlyCss:``,slots:[]},L=b.snippets??null,fe=L==null?null:L===!1?`false`:JSON.stringify(L),pe=ae(v,fe??void 0,T(M.join(g,`content/snippets`))),R=JSON.parse(pe),me={...e,snippets:R===null?void 0:R},he=JSON.stringify(me),z=e.math!==!1,B=z?Le(_,h):null,V=re(he,!!(S&&Object.keys(S).length>0),R!==null&&R!==!1,z&&B!==null),H=ne(v,z&&B!==null),U=ze(V,S,B),W=Be(H,B),G=Re(_,h);await Ve(e,l.integrations,g,u);let K=Ue({root:g,mathEnabled:z}),q=Ze({searchEnabled:e.search!==!1,searchHotkey:b.search.hotkey}),J=JSON.stringify({docs:et(g,`docs`),blog:et(g,`blog`),changelog:et(g,`changelog`)}),Y=JSON.parse(te(v,w,J)),ge=Y.filter(e=>e.pattern.endsWith(`/rss.xml`)).map(e=>({title:e.pattern===`/blog/rss.xml`?`Blog feed`:e.pattern===`/changelog/rss.xml`?`Changelog feed`:e.pattern,href:e.pattern}));if(G){let e=l.markdown?.processor,t=e?.options?.hastPlugins;e?.name!==`unified`&&Array.isArray(t)&&t.length>0&&h.warn(`[@publier/shell] docsShell() is replacing the configured "${e?.name}" Markdown processor, discarding ${t.length} HAST plugin(s) another integration already registered on it — typically astro-expressive-code >=0.43, which registers into the processor it finds at its own setup. Code fences will silently lose ALL processing (plain <pre><code>, no syntax highlighting). Fix: move docsShell() BEFORE expressiveCode() (and any other Markdown-processor-touching integration) in astro.config.ts integrations[] so they register into docsShell's unified() processor instead.`)}u({markdown:G?{processor:G({remarkPlugins:U,rehypePlugins:W})}:{remarkPlugins:[...U],rehypePlugins:[...W]},vite:{ssr:{noExternal:[`@publier/shell`],external:[`@publier/native`]},build:{rollupOptions:{external:[`@publier/native`]}},optimizeDeps:{exclude:[`@publier/shell`,`@publier/native`]},plugins:[...We(_,h,l.vite?.plugins??[]),s({root:g}),o({root:g}),$(`virtual:publier-nav-config`,`navConfig`,oe),Ke({entryPath:K}),Je(),$(`virtual:publier-announcement`,`announcement`,se),$(`virtual:publier-site`,`site`,x),$(`virtual:publier-docs-config`,`docsConfig`,ce),$(`virtual:publier-appearance`,`appearance`,b.appearance),$(`virtual:publier-feeds`,`feeds`,ge),$(`virtual:publier-fonts`,`fonts`,{slots:I}),Ye()]}}),u({fonts:[{name:`Inter Variable`,cssVariable:`--publier-font-builtin-sans`,provider:N.npm({remote:!1}),fallbacks:[`system-ui`,`sans-serif`],weights:[`100 900`],styles:[`normal`],subsets:[`latin`],options:{package:`@fontsource-variable/inter`}},{name:`JetBrains Mono Variable`,cssVariable:`--publier-font-builtin-mono`,provider:N.npm({remote:!1}),fallbacks:[`monospace`],weights:[`100 800`],styles:[`normal`],subsets:[`latin`],options:{package:`@fontsource-variable/jetbrains-mono`}},...de]}),p(`page-ssr`,[`import ${JSON.stringify(K)};`,`import 'virtual:publier-theme-css';`,`import 'virtual:publier-custom-css';`,`import '@publier/shell/styles/base.css';`].join(`
80
- `)),p(`page`,q),p(`head-inline`,`(function(){
81
- if (typeof window === 'undefined' || !window.sessionStorage || !window.fetch) return;
82
- var store = window.sessionStorage;
83
- var ResponseCtor = window.Response;
84
- var origFetch = window.fetch.bind(window);
85
- var NS = 'publier:bg:';
86
- var PATTERN = /^\\/(?:_astro|assets|build)\\/(?:[^\\/]*bundle-graph[^\\/]*\\.json|q-manifest[^\\/]*\\.json)(?:\\?.*)?$/;
87
-
88
-
89
-
90
-
91
- var inflight = Object.create(null);
92
- function serve(body){
93
- return new ResponseCtor(body, {
94
- status: 200,
95
- headers: { 'content-type': 'application/json' }
96
- });
97
- }
98
- window.fetch = function(input, init){
99
- var url = typeof input === 'string' ? input : (input && input.url) || '';
100
- var method = (init && init.method) || (input && input.method) || 'GET';
101
- if (!url || method !== 'GET' || !PATTERN.test(url)) {
102
- return origFetch(input, init);
103
- }
104
- var key = NS + url;
105
-
106
- try {
107
- var hit = store.getItem(key);
108
- if (hit !== null) return Promise.resolve(serve(hit));
109
- } catch (_) {}
110
-
111
-
112
- if (inflight[url]) return inflight[url].then(serve);
113
-
114
-
115
- var pending = origFetch(input, init).then(function(res){
116
- if (res && res.ok) {
117
- return res.clone().text().then(function(body){
118
- try { store.setItem(key, body); } catch (_) {}
119
- delete inflight[url];
120
- return res;
121
- });
122
- }
123
- delete inflight[url];
124
- return res;
125
- }, function(err){
126
- delete inflight[url];
127
- throw err;
128
- });
129
-
130
- inflight[url] = pending.then(function(res){
131
- return res && res.ok ? res.clone().text() : '';
132
- });
133
- return pending;
134
- };
135
- })();`),F&&p(`head-inline`,`
136
- const _pFonts = document.createElement('style');
137
- _pFonts.textContent = ${JSON.stringify(F)};
138
- document.head.appendChild(_pFonts);
139
- `);{n=``,r=``;let e=b.analytics;e&&(n=f(e),r=d(e),a===`dev`&&(n&&p(`head-inline`,`
140
- const _pAnalytics = document.createRange().createContextualFragment(${tt(n)});
141
- document.head.appendChild(_pAnalytics);
142
- `),r&&p(`head-inline`,`
143
- const _pAnalyticsBody = ${tt(r)};
144
- const _pInjectBody = () => document.body.appendChild(document.createRange().createContextualFragment(_pAnalyticsBody));
145
- if (document.body) _pInjectBody();
146
- else document.addEventListener('DOMContentLoaded', _pInjectBody, { once: true });
147
- `)))}for(let e of Y)m({pattern:e.pattern,entrypoint:e.entrypoint,prerender:e.prerender});Y.length>0&&h.info(`[@publier/shell] Injected default routes: ${Y.map(e=>e.pattern).join(`, `)}.`),h.info(`[@publier/shell] Plugin pipeline wired.`)},"astro:build:done":async({dir:e,pages:i,logger:a})=>{let o=ue(e),s=M.join(o,`_headers`);await j(s,he(),`utf-8`),a.info(`[@publier/shell] Wrote 5 header rules to dist/_headers.`);let c=B(o,i);c.pagesRewritten>0&&a.info(`[@publier/shell] Backfilled head tags on ${c.pagesRewritten} HTML file(s) (stylesheets=${Xe(c.stylesheets)}, modules=${Xe(c.modules)}).`);let l=_e(o,i);l.pagesRewritten>0&&a.info(`[@publier/shell] Injected preload tags into ${l.pagesRewritten} HTML file(s) (js=${l.jsCount}, fonts=${l.fontsCount}).`);let u=be(o,i);if(u.pagesRewritten>0&&a.info(`[@publier/shell] Kept ${u.pagesRewritten} noindex page(s) out of search.`),t?.llms.enabled){let e=ge(o,i,{siteName:t.siteName,siteDescription:t.siteDescription,collections:t.llms.collections});if(e.written?a.info(`[@publier/shell] Wrote dist/llms.txt (${e.pageCount} page(s)).`):e.skipped===`existing-file`?a.info(`[@publier/shell] dist/llms.txt already exists — left as-is.`):a.warn(`[@publier/shell] llms.enabled is set but no page had a <title> to index; no llms.txt written.`),t.llms.full){let e=De(o,i,{siteName:t.siteName,siteDescription:t.siteDescription,siteUrl:t.siteUrl,collections:t.llms.collections});a.info(`[@publier/shell] Markdown exports: ${e.written} written, ${e.existing} existing; llms-full.txt ${e.fullWritten?`written`:`unchanged`}.`)}}let d=Oe(o,i,n);d>0&&a.info(`[@publier/shell] Injected head scripts into ${d} HTML file(s).`);let f=ke(o,i,r);f>0&&a.info(`[@publier/shell] Injected body scripts into ${f} HTML file(s).`)}}};return i}export{z as a,me as i,Q as n,Ye as r,nt as t};
@@ -1 +0,0 @@
1
- const e=/* @__PURE__ */ `almond.aspen.atrium.broadsheet.canopy.catppuccin.dark.dusk.emerald.enterprise.folio.hearth.lattice.light.maple.marigold.meridian.monolith.neutral.nocturne.ocean.prism.purple.ruby.solar.vitepress`.split(`.`);function t(){return e}function n(t){return e.includes(t)}const r=[`display-xl`,`display-lg`,`display-md`,`heading-lg`,`heading-md`,`heading-sm`,`title`,`body-lg`,`body-md`,`body-sm`,`caption`,`label`,`button`,`code`],i=[`size`,`weight`,`line-height`,`tracking`];export{t as a,n as i,i as n,r,e as t};