@publier/shell 3.1.5 → 3.3.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/build-integration.d.mts +0 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +1 -1
- package/dist/integration-B0X8DWmx.mjs +103 -0
- package/dist/{integration-DKTmdCWN.d.mts → integration-De40K0ol.d.mts} +1 -14
- package/dist/integration.d.mts +2 -2
- package/dist/integration.mjs +1 -1
- package/dist/loaders/index.d.mts +4 -6
- package/dist/plugins/remark-asides.d.mts +1 -2
- package/dist/plugins/remark-snippets.d.mts +1 -2
- package/dist/plugins/remark-snippets.mjs +1 -1
- package/dist/plugins/remark-structure.d.mts +1 -2
- package/dist/plugins/remark-vars.d.mts +1 -2
- package/dist/{presets-RGpZ_X1B.d.mts → presets-BpOSAh0T.d.mts} +1 -1
- package/dist/runtime/code-group-sync.d.mts +1 -1
- package/dist/runtime/lazy-upgrade-registry.mjs +1 -1
- package/dist/runtime/tabs-sync.d.mts +1 -1
- package/dist/search/index.d.mts +0 -1
- package/dist/tailwind/css-plugin.d.mts +0 -1
- package/dist/tailwind/index.d.mts +2 -3
- package/dist/tailwind/index.mjs +1 -1
- package/dist/tailwind/loader.d.mts +5 -4
- package/dist/tailwind/loader.mjs +1 -1
- package/dist/theme-toggle-element-DJTP9Mbw.mjs +1 -0
- package/package.json +21 -18
- package/src/components/theme-storage.ts +11 -0
- package/src/components/theme-toggle-element.ts +11 -4
- package/dist/integration-6L__3wwu.mjs +0 -102
- package/dist/theme-toggle-element-DzFjxwpS.mjs +0 -1
- /package/dist/{image-zoom-runtime-Cr8vBrXH.mjs → image-zoom-runtime-CnJeWrYp.mjs} +0 -0
- /package/dist/{index-Bc-beOEe.d.mts → index-CbxBu1jA.d.mts} +0 -0
- /package/dist/{presets-DL0qjtya.mjs → presets-BSnEdPYj.mjs} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { i as DocsShellOptions, p as docsShell } from "./integration-
|
|
1
|
+
import { i as DocsShellOptions, p as docsShell } from "./integration-De40K0ol.mjs";
|
|
2
|
+
import "astro/zod";
|
|
2
3
|
//#region src/build/headers.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* Cache-control + security headers emitted by `docsShell()` during
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as e,i as t,t as n}from"./integration-B0X8DWmx.mjs";export{t as HASHED_ASSET_RE,n as docsShell,e as publierCacheControl};
|
|
@@ -0,0 +1,103 @@
|
|
|
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,generateAnalyticsScripts as u,shellAnnouncementBannerScript as d,shellBuildHeaders as f,shellBuildLicenseErrorMessage as ee,shellCacheControl as p,shellCollectTailwindClassTokens as m,shellComposeTailwindEntry as h,shellLazyUpgradeScript as g,shellOpenInAiScript as _,shellPlanDefaultRoutes as te,shellPlanRehypePlugins as ne,shellPlanRemarkPlugins as re,shellResolvePrefetch as ie,shellResolveSnippetsConfig as ae,shellRewriteHead as v,shellRewriteModulepreload as y,shellSearchButtonScript as b,shellSearchDialogScript as x,shellTableOfContentsScript as S,verifyLicense as oe}from"@publier/native";import{existsSync as C,mkdirSync as w,readFileSync as T,readdirSync as E,writeFileSync as D}from"node:fs";import{writeFile as O}from"node:fs/promises";import k from"node:path";import{fileURLToPath as A}from"node:url";import{fontProviders as j}from"astro/config";import M from"rehype-autolink-headings";import N from"rehype-external-links";import P from"remark-directive";const F=/^\/(?:_astro|assets|build)\//;function I(){return f()}function L(e){return p(e)}function R(e,t){let n=t.map(e=>e.pathname),r=v(e,n);return{stylesheetsCount:r.stylesheetsCount,modulesCount:r.modulesCount,pagesRewritten:r.pagesRewritten,stylesheets:r.stylesheets,modules:r.modules}}function z(e,t){let n=t.map(e=>e.pathname),r=y(e,n);return{jsCount:r.jsCount,fontsCount:r.fontsCount,pagesRewritten:r.pagesRewritten}}function se(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(`
|
|
2
|
+
`)}`)}return{...n,announcement:n.announcement??null}}function ce(e){let t=k.join(e,`publier.config.yaml`);if(!C(t))return null;try{return T(t,`utf-8`)}catch{return null}}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 ue(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 de(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(P);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 B(e,t){let n=JSON.parse(e),r=[];for(let e of n)switch(e.id){case`rehype-autolink-headings`:r.push([M,e.options]);break;case`rehype-external-links`:r.push([N,e.options]);break;case`rehype-katex`:t&&r.push(t.rehypeKatex)}return r}async function V(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 H=g();function fe({root:e,mathEnabled:t}){let n=c(import.meta.url),r=t=>{try{return k.dirname(n.resolve(`${t}/package.json`,{paths:[e]}))}catch{return null}},i=(e,t)=>{let n=r(e);return n?{abs_path:k.join(n,t).split(k.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(k.sep).join(`/`)}catch{o=null}let s=h(JSON.stringify(a),o??void 0),l=m(),u=k.join(e,`.astro`);if(l.length>0){C(u)||w(u,{recursive:!0});let e=k.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(`
|
|
3
|
+
`);D(e,r,`utf8`);let i=e.split(k.sep).join(`/`);s+=`@source "${i}";\n`}let d=k.join(u,`publier-tailwind-entry.css`);return(C(d)?T(d,`utf8`):``)!==s&&(w(u,{recursive:!0}),D(d,s)),d}function pe(e,t,n){if(U(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 U(e){for(let t of e){if(!t)continue;if(Array.isArray(t)){if(U(t))return!0;continue}let e=t.name;if(typeof e==`string`&&e.startsWith(`@tailwindcss/vite`))return!0}return!1}function me(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(k.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(`
|
|
4
|
+
if (import.meta.hot) {
|
|
5
|
+
import.meta.hot.accept();
|
|
6
|
+
}
|
|
7
|
+
`)})}}}const W=`import 'astro:scripts/page-ssr.js';
|
|
8
|
+
`;function he(){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(W)?null:{code:W+e,map:null}}}}function G(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 K(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=G(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=G(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=K(e,n);o+=e.slice(s,a),t.push(e.slice(a,r)),a=r,s=a;continue}if(c===`{`){let t=K(e,a);if(t>i)break;let r=n(a+1,t-1);o+=e.slice(s,a+1)+r+`}`,a=t,s=a;continue}a++}return o+=e.slice(s,i),o},r=0,i=``;for(;r<e.length;){let t=G(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!==`
|
|
9
|
+
`&&o!==`\r`&&o!==`{`){r=a+16;continue}let s=r,c=!1;for(;s<a;){let t=G(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=K(e,l);i+=n(l+1,u-1),i+=`}`,r=u}return t.length>0&&(i.endsWith(`
|
|
10
|
+
`)||(i+=`
|
|
11
|
+
`),i+=t.join(`
|
|
12
|
+
`),i.endsWith(`
|
|
13
|
+
`)||(i+=`
|
|
14
|
+
`)),i}function J(){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 Y(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 X(e,t=6){return e.length===0?`[]`:e.length<=t?`[${e.join(`, `)}]`:`[${e.slice(0,t).join(`, `)}, +${e.length-t} more]`}function Z(e){let t=[H,a,i,d(),_(),S()];return e.searchEnabled&&t.push(x(),b()),t.join(`
|
|
15
|
+
`)}function ge(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:j.google(),fallbacks:c,weights:l,styles:u,subsets:[`latin`]}),r.push(a);else if(o.src){let e=k.isAbsolute(o.src)&&C(o.src)?o.src:k.join(t,`public`,o.src.replace(/^\/+/,``));n.push({name:o.family,cssVariable:s,provider:j.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 Q(e,t){let n=k.join(e,`src`,`content`,t);if(!C(n))return!1;try{return E(n,{recursive:!0}).some(e=>typeof e==`string`&&/\.mdx?$/.test(e))}catch{return!1}}function $(e={}){return{name:`@publier/shell`,hooks:{"astro:config:setup":async({config:t,updateConfig:n,injectScript:r,injectRoute:i,logger:a})=>{let l=t.root?A(t.root):process.cwd();try{oe()}catch(e){let t=e instanceof Error?e.message:String(e),n=ee(t);throw n?Error(n):e}let d=c(k.join(l,`package.json`)),f=JSON.stringify(e),p=se(ce(l)??``),m=p.site,h=p.vars,g=p.fonts,_=p.nav,v=p.announcement,y=p.docs,b=typeof m.url==`string`&&m.url.length>0;b&&!t.site&&n({site:m.url});let x=new Set(t.integrations.map(e=>e.name)),S=_e.filter(({aliases:e})=>!e.some(e=>x.has(e)));S.length>0&&a.warn(`[@publier/shell] Required framework integrations are not registered in
|
|
16
|
+
astro.config.ts. As of @publier/shell@2.0.0, docsShell() no longer
|
|
17
|
+
auto-wires these. Add the following to your integrations[] array
|
|
18
|
+
(import statements + entries shown). Order matters: docsShell() must
|
|
19
|
+
come FIRST (astro-expressive-code >=0.43 registers into the Markdown
|
|
20
|
+
processor it finds at its own setup — docsShell's pinned unified()
|
|
21
|
+
processor must already be in place), and expressive-code must precede
|
|
22
|
+
mdx.
|
|
23
|
+
|
|
24
|
+
import expressiveCode from 'astro-expressive-code';
|
|
25
|
+
import mdx from '@astrojs/mdx';
|
|
26
|
+
import sitemap from '@astrojs/sitemap';
|
|
27
|
+
import pagefind from 'astro-pagefind';
|
|
28
|
+
import qwik from '@qwik.dev/astro';
|
|
29
|
+
|
|
30
|
+
integrations: [
|
|
31
|
+
docsShell({ /* options */ }),
|
|
32
|
+
expressiveCode(),
|
|
33
|
+
mdx(),
|
|
34
|
+
sitemap(),
|
|
35
|
+
pagefind(),
|
|
36
|
+
qwik({ clientRouter: true }),
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
Missing:\n ${S.map(e=>e.pkg).join(`
|
|
40
|
+
`)}\n`);let w=t.prefetch;ie(w===void 0?void 0:JSON.stringify(w),f)&&n({prefetch:{prefetchAll:!0,defaultStrategy:`viewport`}});let{entries:T,familyOnlyCss:E,slots:D}=g?ge(g,l):{entries:[],familyOnlyCss:``,slots:[]},O=p.snippets??null,M=O==null?null:O===!1?`false`:JSON.stringify(O),N=ae(f,M??void 0,C(k.join(l,`content/snippets`))),P=JSON.parse(N),F={...e,snippets:P===null?void 0:P},I=JSON.stringify(F),L=e.math!==!1,R=L?le(d,a):null,z=re(I,!!(h&&Object.keys(h).length>0),P!==null&&P!==!1,L&&R!==null),H=ne(f,L&&R!==null),U=de(z,h,R),W=B(H,R),G=ue(d,a);await V(e,t.integrations,l,n);let K=fe({root:l,mathEnabled:L}),q=Z({searchEnabled:e.search!==!1}),X=JSON.stringify({docs:Q(l,`docs`),blog:Q(l,`blog`),changelog:Q(l,`changelog`)}),$=JSON.parse(te(f,b,X)),ve=$.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=t.markdown?.processor,n=e?.options?.hastPlugins;e?.name!==`unified`&&Array.isArray(n)&&n.length>0&&a.warn(`[@publier/shell] docsShell() is replacing the configured "${e?.name}" Markdown processor, discarding ${n.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.`)}n({markdown:G?{processor:G({remarkPlugins:U,rehypePlugins:W})}:{remarkPlugins:[...U],rehypePlugins:[...W]},vite:{ssr:{noExternal:[`@publier/shell`,`@qwik.dev/core`,`@qwik.dev/astro`],external:[`@publier/native`]},build:{rollupOptions:{external:[`@publier/native`]}},optimizeDeps:{exclude:[`@publier/shell`,`@publier/native`]},plugins:[...pe(d,a,t.vite?.plugins??[]),s({root:l}),o({root:l}),Y(`virtual:publier-nav-config`,`navConfig`,_),me({entryPath:K}),he(),Y(`virtual:publier-announcement`,`announcement`,v),Y(`virtual:publier-site`,`site`,m),Y(`virtual:publier-docs-config`,`docsConfig`,y),Y(`virtual:publier-feeds`,`feeds`,ve),Y(`virtual:publier-fonts`,`fonts`,{slots:D}),J()]}}),n({fonts:[{name:`Inter Variable`,cssVariable:`--publier-font-builtin-sans`,provider:j.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:j.npm({remote:!1}),fallbacks:[`monospace`],weights:[`100 800`],styles:[`normal`],subsets:[`latin`],options:{package:`@fontsource-variable/jetbrains-mono`}},...T]}),r(`page-ssr`,[`import ${JSON.stringify(K)};`,`import 'virtual:publier-theme-css';`,`import 'virtual:publier-custom-css';`,`import '@publier/shell/styles/base.css';`].join(`
|
|
41
|
+
`)),r(`page`,q),r(`head-inline`,`(function(){
|
|
42
|
+
if (typeof window === 'undefined' || !window.sessionStorage || !window.fetch) return;
|
|
43
|
+
var store = window.sessionStorage;
|
|
44
|
+
var ResponseCtor = window.Response;
|
|
45
|
+
var origFetch = window.fetch.bind(window);
|
|
46
|
+
var NS = 'publier:bg:';
|
|
47
|
+
var PATTERN = /^\\/(?:_astro|assets|build)\\/(?:[^\\/]*bundle-graph[^\\/]*\\.json|q-manifest[^\\/]*\\.json)(?:\\?.*)?$/;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
var inflight = Object.create(null);
|
|
53
|
+
function serve(body){
|
|
54
|
+
return new ResponseCtor(body, {
|
|
55
|
+
status: 200,
|
|
56
|
+
headers: { 'content-type': 'application/json' }
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
window.fetch = function(input, init){
|
|
60
|
+
var url = typeof input === 'string' ? input : (input && input.url) || '';
|
|
61
|
+
var method = (init && init.method) || (input && input.method) || 'GET';
|
|
62
|
+
if (!url || method !== 'GET' || !PATTERN.test(url)) {
|
|
63
|
+
return origFetch(input, init);
|
|
64
|
+
}
|
|
65
|
+
var key = NS + url;
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
var hit = store.getItem(key);
|
|
69
|
+
if (hit !== null) return Promise.resolve(serve(hit));
|
|
70
|
+
} catch (_) {}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
if (inflight[url]) return inflight[url].then(serve);
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
var pending = origFetch(input, init).then(function(res){
|
|
77
|
+
if (res && res.ok) {
|
|
78
|
+
return res.clone().text().then(function(body){
|
|
79
|
+
try { store.setItem(key, body); } catch (_) {}
|
|
80
|
+
delete inflight[url];
|
|
81
|
+
return res;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
delete inflight[url];
|
|
85
|
+
return res;
|
|
86
|
+
}, function(err){
|
|
87
|
+
delete inflight[url];
|
|
88
|
+
throw err;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
inflight[url] = pending.then(function(res){
|
|
92
|
+
return res && res.ok ? res.clone().text() : '';
|
|
93
|
+
});
|
|
94
|
+
return pending;
|
|
95
|
+
};
|
|
96
|
+
})();`),E&&r(`head-inline`,`
|
|
97
|
+
const _pFonts = document.createElement('style');
|
|
98
|
+
_pFonts.textContent = ${JSON.stringify(E)};
|
|
99
|
+
document.head.appendChild(_pFonts);
|
|
100
|
+
`);{let e=p.analytics;if(e){let t=u(e);t&&r(`head-inline`,`
|
|
101
|
+
const _pAnalytics = document.createRange().createContextualFragment(${JSON.stringify(t)});
|
|
102
|
+
document.head.appendChild(_pAnalytics);
|
|
103
|
+
`)}}for(let e of $)i({pattern:e.pattern,entrypoint:e.entrypoint,prerender:e.prerender});$.length>0&&a.info(`[@publier/shell] Injected default routes: ${$.map(e=>e.pattern).join(`, `)}.`),a.info(`[@publier/shell] Plugin pipeline wired.`)},"astro:build:done":async({dir:e,pages:t,logger:n})=>{let r=A(e),i=k.join(r,`_headers`);await O(i,I(),`utf-8`),n.info(`[@publier/shell] Wrote 5 header rules to dist/_headers.`);let a=R(r,t);a.pagesRewritten>0&&n.info(`[@publier/shell] Backfilled head tags on ${a.pagesRewritten} HTML file(s) (stylesheets=${X(a.stylesheets)}, modules=${X(a.modules)}).`);let o=z(r,t);o.pagesRewritten>0&&n.info(`[@publier/shell] Injected preload tags into ${o.pagesRewritten} HTML file(s) (js=${o.jsCount}, fonts=${o.fontsCount}).`)}}}}export{L as a,F as i,q as n,J as r,$ as t};
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
import { FontsConfig } from "@publier/native";
|
|
2
1
|
import { AstroIntegration } from "astro";
|
|
3
2
|
import { Plugin } from "vite";
|
|
4
|
-
|
|
5
|
-
//#region src/config/yaml-extract.d.ts
|
|
6
|
-
declare function extractVarsFromYaml(yaml: string): Record<string, string> | undefined;
|
|
7
|
-
declare function extractFontsFromYaml(yaml: string): FontsConfig | undefined;
|
|
8
|
-
declare function extractAnnouncementFromYaml(yaml: string): AnnouncementConfig | null;
|
|
9
|
-
declare function extractSnippetsFromYaml(yaml: string): false | {
|
|
10
|
-
directory?: string;
|
|
11
|
-
} | undefined;
|
|
12
|
-
declare function extractSiteFromYaml(yaml: string): SiteConfig;
|
|
13
|
-
declare function extractDocsConfigFromYaml(yaml: string): DocsConfig;
|
|
14
|
-
declare function extractNavFromYaml(yaml: string): NavConfig;
|
|
15
|
-
//#endregion
|
|
16
3
|
//#region src/vite/css-chain.d.ts
|
|
17
4
|
/**
|
|
18
5
|
* Move every `@media` block found anywhere inside an outer `@layer utilities`
|
|
@@ -200,4 +187,4 @@ interface NavConfig {
|
|
|
200
187
|
}
|
|
201
188
|
declare function docsShell(options?: DocsShellOptions): AstroIntegration;
|
|
202
189
|
//#endregion
|
|
203
|
-
export {
|
|
190
|
+
export { DocsSidebarMetaOverride as a, NavLink as c, SidebarAnchorConfig as d, SiteConfig as f, publierCascadeHoistPlugin as h, DocsShellOptions as i, NavPathRule as l, hoistMediaOutOfUtilitiesLayer as m, DocVersionConfig as n, NavConfig as o, docsShell as p, DocsConfig as r, NavCta as s, AnnouncementConfig as t, NavVariant as u };
|
package/dist/integration.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { AnnouncementConfig, DocVersionConfig, DocsConfig, DocsShellOptions, DocsSidebarMetaOverride, NavConfig, NavCta, NavLink, NavPathRule, NavVariant, SidebarAnchorConfig, SiteConfig, docsShell,
|
|
1
|
+
import { a as DocsSidebarMetaOverride, c as NavLink, d as SidebarAnchorConfig, f as SiteConfig, h as publierCascadeHoistPlugin, i as DocsShellOptions, l as NavPathRule, m as hoistMediaOutOfUtilitiesLayer, n as DocVersionConfig, o as NavConfig, p as docsShell, r as DocsConfig, s as NavCta, t as AnnouncementConfig, u as NavVariant } from "./integration-De40K0ol.mjs";
|
|
2
|
+
export { AnnouncementConfig, DocVersionConfig, DocsConfig, DocsShellOptions, DocsSidebarMetaOverride, NavConfig, NavCta, NavLink, NavPathRule, NavVariant, SidebarAnchorConfig, SiteConfig, docsShell, hoistMediaOutOfUtilitiesLayer, publierCascadeHoistPlugin };
|
package/dist/integration.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as e,r as t,t as n}from"./integration-B0X8DWmx.mjs";export{n as docsShell,e as hoistMediaOutOfUtilitiesLayer,t as publierCascadeHoistPlugin};
|
package/dist/loaders/index.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as _$astro_loaders0 from "astro/loaders";
|
|
2
|
-
|
|
3
1
|
//#region src/loaders/index.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* Astro content-collection loaders for Publier.
|
|
@@ -27,21 +25,21 @@ import * as _$astro_loaders0 from "astro/loaders";
|
|
|
27
25
|
declare function docsLoader(options?: {
|
|
28
26
|
base?: string;
|
|
29
27
|
pattern?: string;
|
|
30
|
-
}):
|
|
28
|
+
}): import("astro/loaders").Loader;
|
|
31
29
|
/**
|
|
32
30
|
* Content loader for the `blog` collection.
|
|
33
31
|
*/
|
|
34
32
|
declare function blogLoader(options?: {
|
|
35
33
|
base?: string;
|
|
36
34
|
pattern?: string;
|
|
37
|
-
}):
|
|
35
|
+
}): import("astro/loaders").Loader;
|
|
38
36
|
/**
|
|
39
37
|
* Content loader for the `pages` collection.
|
|
40
38
|
*/
|
|
41
39
|
declare function pagesLoader(options?: {
|
|
42
40
|
base?: string;
|
|
43
41
|
pattern?: string;
|
|
44
|
-
}):
|
|
42
|
+
}): import("astro/loaders").Loader;
|
|
45
43
|
/**
|
|
46
44
|
* Generic content loader for any MDX collection (changelog, recipes, press,
|
|
47
45
|
* careers, etc.).
|
|
@@ -49,6 +47,6 @@ declare function pagesLoader(options?: {
|
|
|
49
47
|
declare function contentLoader(options: {
|
|
50
48
|
base: string;
|
|
51
49
|
pattern?: string;
|
|
52
|
-
}):
|
|
50
|
+
}): import("astro/loaders").Loader;
|
|
53
51
|
//#endregion
|
|
54
52
|
export { blogLoader, contentLoader, docsLoader, pagesLoader };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { t as Root } from "../index-
|
|
1
|
+
import { t as Root } from "../index-CbxBu1jA.mjs";
|
|
2
2
|
import { Plugin } from "unified";
|
|
3
|
-
|
|
4
3
|
//#region src/plugins/remark-asides.d.ts
|
|
5
4
|
declare const remarkAsides: Plugin<[], Root>;
|
|
6
5
|
declare const remarkDirectivesRestoration: Plugin<[], Root>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@publier/native";import{resolve as t}from"node:path";import{fromMarkdown as n}from"mdast-util-from-markdown";function r(e){return typeof e==`object`&&!!e&&e.type===`mdxJsxFlowElement`}const i=i=>a=>{let o=
|
|
1
|
+
import e from"@publier/native";import{resolve as t}from"node:path";import{fromMarkdown as n}from"mdast-util-from-markdown";function r(e){return typeof e==`object`&&!!e&&e.type===`mdxJsxFlowElement`}const i=i=>a=>{let o=i?.contentRoot??`.`,s=t(o,i?.directory??`content/snippets`),c=a.children;for(let t=0;t<c.length;t++){let i=c[t];if(!r(i)||i.name!==`Snippet`)continue;let a=i,o={};for(let e of a.attributes??[])e.type===`mdxJsxAttribute`&&typeof e.value==`string`&&(o[e.name]=e.value);let l=o.file;if(!l)continue;let u;try{u=e.remarkResolveSnippet(s,l,JSON.stringify(o))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`[remark-snippets] Failed to resolve "${l}" from "${s}": ${t}`)}if(u==null)continue;let d=n(u);c.splice(t,1,...d.children),t+=d.children.length-1}};export{i as default};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { t as Root } from "../index-
|
|
1
|
+
import { t as Root } from "../index-CbxBu1jA.mjs";
|
|
2
2
|
import { StructuredSection } from "@publier/native";
|
|
3
3
|
import { Plugin } from "unified";
|
|
4
|
-
|
|
5
4
|
//#region src/plugins/remark-structure.d.ts
|
|
6
5
|
declare module 'vfile' {
|
|
7
6
|
interface DataMap {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Node-side introspection (reading CSS files, computing contrast) lives in
|
|
7
7
|
* `./loader.ts` to keep `node:fs` out of the browser bundle path.
|
|
8
8
|
*/
|
|
9
|
-
declare const AVAILABLE_THEMES: readonly [
|
|
9
|
+
declare const AVAILABLE_THEMES: readonly ['almond', 'aspen', 'catppuccin', 'dark', 'dusk', 'emerald', 'light', 'maple', 'neutral', 'ocean', 'purple', 'ruby', 'solar', 'vitepress'];
|
|
10
10
|
type ThemePreset = (typeof AVAILABLE_THEMES)[number];
|
|
11
11
|
/** Return a read-only copy of the built-in preset list. */
|
|
12
12
|
declare function listPresets(): readonly ThemePreset[];
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
* toggle a `tab-active` class (would leave a stale highlight once
|
|
26
26
|
* `<tab-container>` upgrades and starts managing aria-selected alone).
|
|
27
27
|
*/
|
|
28
|
-
declare const CODE_GROUP_SYNC_SCRIPT = "\n(() => {\n\tconst SYNC_PREFIX = 'publier-code-group-sync:';\n\n\tconst activateByLabel = (root, label) => {\n\t\tconst tabs = Array.from(root.querySelectorAll('[role=\"tab\"]'));\n\t\tconst index = tabs.findIndex((t) => t.dataset.tabLabel === label);\n\t\tif (index < 0) return;\n\t\tconst target = tabs[index];\n\t\t// Idempotence guard: tab-container fires 'tab-container-changed'\n\t\t// unconditionally when selectTab runs, even when the index doesn't\n\t\t// change. Without this check, peer sync loops: root 0 syncs peer 1\n\t\t//
|
|
28
|
+
declare const CODE_GROUP_SYNC_SCRIPT = "\n(() => {\n\tconst SYNC_PREFIX = 'publier-code-group-sync:';\n\n\tconst activateByLabel = (root, label) => {\n\t\tconst tabs = Array.from(root.querySelectorAll('[role=\"tab\"]'));\n\t\tconst index = tabs.findIndex((t) => t.dataset.tabLabel === label);\n\t\tif (index < 0) return;\n\t\tconst target = tabs[index];\n\t\t// Idempotence guard: tab-container fires 'tab-container-changed'\n\t\t// unconditionally when selectTab runs, even when the index doesn't\n\t\t// change. Without this check, peer sync loops: root 0 syncs peer 1\n\t\t// → peer 1 fires changed → peer 1 syncs peers including root 0 →\n\t\t// stack-overflow. Skip if already on the requested label.\n\t\tif (target.getAttribute('aria-selected') === 'true') return;\n\t\t// tab-container-element's selectTab(index) expects a NUMBER, not an\n\t\t// element. Passing the tab button directly silently no-ops (coerces\n\t\t// to NaN). Pass the resolved index instead.\n\t\tif (typeof root.selectTab === 'function') {\n\t\t\troot.selectTab(index);\n\t\t\treturn;\n\t\t}\n\t\t// Pre-upgrade fallback: toggle ARIA + panel visibility manually so\n\t\t// SSR state stays coherent while the custom element is still loading.\n\t\t// aria-selected is the SINGLE source of truth here — daisyUI v5\n\t\t// styles `[aria-selected=true]` directly, so we deliberately do NOT\n\t\t// touch a `tab-active` class.\n\t\tconst panels = Array.from(root.querySelectorAll('[role=\"tabpanel\"]'));\n\t\tfor (const tab of tabs) {\n\t\t\tconst isActive = tab === target;\n\t\t\ttab.setAttribute('aria-selected', isActive ? 'true' : 'false');\n\t\t\ttab.setAttribute('tabindex', isActive ? '0' : '-1');\n\t\t}\n\t\tconst activeId = target.getAttribute('aria-controls');\n\t\tfor (const panel of panels) {\n\t\t\tpanel.hidden = panel.id !== activeId;\n\t\t}\n\t};\n\n\tconst wire = () => {\n\t\tfor (const root of document.querySelectorAll('[data-publier-cg]')) {\n\t\t\tif (root.dataset.wired === '1') continue;\n\t\t\troot.dataset.wired = '1';\n\n\t\t\tconst syncKey = root.dataset.syncKey || null;\n\t\t\tconst storageKey = syncKey ? SYNC_PREFIX + syncKey : null;\n\n\t\t\tif (storageKey) {\n\t\t\t\ttry {\n\t\t\t\t\tconst saved = localStorage.getItem(storageKey);\n\t\t\t\t\tif (saved) activateByLabel(root, saved);\n\t\t\t\t} catch {}\n\t\t\t}\n\n\t\t\t// Listen for 'tab-container-changed' (past tense), NOT\n\t\t\t// 'tab-container-change'. The former fires AFTER the state is\n\t\t\t// applied; the latter fires BEFORE (it's the cancelable phase),\n\t\t\t// so the idempotence guard in activateByLabel reads stale\n\t\t\t// aria-selected and ends up looping infinitely.\n\t\t\troot.addEventListener('tab-container-changed', (ev) => {\n\t\t\t\t// tab-container-element exposes a typed 'tab' getter on the event;\n\t\t\t\t// 'ev.detail' is deprecated upstream and returns the PANEL (not\n\t\t\t\t// the tab button) behind a console.warn. Read '.tab' directly.\n\t\t\t\tconst tab = ev.tab;\n\t\t\t\tconst label = tab && tab.dataset ? tab.dataset.tabLabel : null;\n\t\t\t\tif (!label) return;\n\t\t\t\tif (storageKey) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlocalStorage.setItem(storageKey, label);\n\t\t\t\t\t} catch {}\n\t\t\t\t}\n\t\t\t\tif (syncKey) {\n\t\t\t\t\tconst peers = document.querySelectorAll(\n\t\t\t\t\t\t'[data-publier-cg][data-sync-key=\"' + syncKey + '\"]',\n\t\t\t\t\t);\n\t\t\t\t\tfor (const peer of peers) {\n\t\t\t\t\t\tif (peer === root) continue;\n\t\t\t\t\t\tactivateByLabel(peer, label);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n\n\tif (!window.__publierCgStorageWired) {\n\t\twindow.__publierCgStorageWired = true;\n\t\twindow.addEventListener('storage', (ev) => {\n\t\t\tif (!ev.key || ev.key.indexOf(SYNC_PREFIX) !== 0 || ev.newValue == null) return;\n\t\t\tconst syncKey = ev.key.slice(SYNC_PREFIX.length);\n\t\t\tconst label = ev.newValue;\n\t\t\tconst peers = document.querySelectorAll(\n\t\t\t\t'[data-publier-cg][data-sync-key=\"' + syncKey + '\"]',\n\t\t\t);\n\t\t\tfor (const root of peers) {\n\t\t\t\tactivateByLabel(root, label);\n\t\t\t}\n\t\t});\n\t}\n\n\twire();\n\tdocument.addEventListener('astro:page-load', wire);\n})();\n";
|
|
29
29
|
//#endregion
|
|
30
30
|
export { CODE_GROUP_SYNC_SCRIPT };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=()=>import(`@github/clipboard-copy-element`),t=()=>import(`@github/tab-container-element`),n=()=>import(`@github/relative-time-element`),r=()=>import(`../theme-toggle-element-
|
|
1
|
+
const e=()=>import(`@github/clipboard-copy-element`),t=()=>import(`@github/tab-container-element`),n=()=>import(`@github/relative-time-element`),r=()=>import(`../theme-toggle-element-DJTP9Mbw.mjs`),i=()=>import(`../image-zoom-runtime-CnJeWrYp.mjs`);export{e as upgradeClipboardCopy,i as upgradeImageZoom,n as upgradeRelativeTime,t as upgradeTabContainer,r as upgradeThemeToggle};
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
* the lazy-upgrade bootstrap (`runtime/lazy-upgrade-init.ts`) defines it.
|
|
21
21
|
* This script only layers peer / storage sync on top.
|
|
22
22
|
*/
|
|
23
|
-
declare const TABS_SYNC_SCRIPT = "\n(() => {\n\tconst SYNC_PREFIX = 'publier-tabs-sync:';\n\n\tconst activateByLabel = (root, label) => {\n\t\tconst tabs = Array.from(root.querySelectorAll('[role=\"tab\"]'));\n\t\tconst index = tabs.findIndex((t) => t.dataset.tabLabel === label);\n\t\tif (index < 0) return;\n\t\tconst target = tabs[index];\n\t\t// Idempotence guard: tab-container fires 'tab-container-change'\n\t\t// unconditionally when selectTab runs, even when the index doesn't\n\t\t// change. Without this check, peer sync loops: root 0 syncs peer 1\n\t\t//
|
|
23
|
+
declare const TABS_SYNC_SCRIPT = "\n(() => {\n\tconst SYNC_PREFIX = 'publier-tabs-sync:';\n\n\tconst activateByLabel = (root, label) => {\n\t\tconst tabs = Array.from(root.querySelectorAll('[role=\"tab\"]'));\n\t\tconst index = tabs.findIndex((t) => t.dataset.tabLabel === label);\n\t\tif (index < 0) return;\n\t\tconst target = tabs[index];\n\t\t// Idempotence guard: tab-container fires 'tab-container-change'\n\t\t// unconditionally when selectTab runs, even when the index doesn't\n\t\t// change. Without this check, peer sync loops: root 0 syncs peer 1\n\t\t// → peer 1 fires change → peer 1 syncs peers including root 0 →\n\t\t// stack-overflow. Skip if already on the requested label.\n\t\tif (target.getAttribute('aria-selected') === 'true') return;\n\t\t// tab-container-element's selectTab(index) expects a NUMBER, not an\n\t\t// element. Passing the tab button directly silently no-ops (coerces\n\t\t// to NaN). Pass the resolved index instead.\n\t\tif (typeof root.selectTab === 'function') {\n\t\t\troot.selectTab(index);\n\t\t\treturn;\n\t\t}\n\t\t// Pre-upgrade fallback: toggle ARIA + panel visibility manually so\n\t\t// SSR state stays coherent while the custom element is still loading.\n\t\t// aria-selected is the SINGLE source of truth here — daisyUI v5\n\t\t// styles `[aria-selected=true]` directly, so we deliberately do NOT\n\t\t// touch a `tab-active` class. (Toggling both would let a stale\n\t\t// `tab-active` linger on the previously-active tab once\n\t\t// `<tab-container>` upgrades and starts managing aria-selected\n\t\t// alone, which is what produced the double-highlight bug.)\n\t\tconst panels = Array.from(root.querySelectorAll('[role=\"tabpanel\"]'));\n\t\tfor (const tab of tabs) {\n\t\t\tconst isActive = tab === target;\n\t\t\ttab.setAttribute('aria-selected', isActive ? 'true' : 'false');\n\t\t\ttab.setAttribute('tabindex', isActive ? '0' : '-1');\n\t\t}\n\t\tconst activeId = target.getAttribute('aria-controls');\n\t\tfor (const panel of panels) {\n\t\t\tpanel.hidden = panel.id !== activeId;\n\t\t}\n\t};\n\n\tconst wire = () => {\n\t\tfor (const root of document.querySelectorAll('[data-publier-tabs]')) {\n\t\t\tif (root.dataset.wired === '1') continue;\n\t\t\troot.dataset.wired = '1';\n\n\t\t\tconst syncKey = root.dataset.syncKey || null;\n\t\t\tconst storageKey = syncKey ? SYNC_PREFIX + syncKey : null;\n\n\t\t\tif (storageKey) {\n\t\t\t\ttry {\n\t\t\t\t\tconst saved = localStorage.getItem(storageKey);\n\t\t\t\t\tif (saved) activateByLabel(root, saved);\n\t\t\t\t} catch {}\n\t\t\t}\n\n\t\t\t// Listen for 'tab-container-changed' (past tense), NOT\n\t\t\t// 'tab-container-change'. The former fires AFTER the state is\n\t\t\t// applied; the latter fires BEFORE (it's the cancelable phase),\n\t\t\t// so the idempotence guard in activateByLabel reads stale\n\t\t\t// aria-selected and ends up looping infinitely.\n\t\t\troot.addEventListener('tab-container-changed', (ev) => {\n\t\t\t\t// tab-container-element exposes a typed 'tab' getter on the event;\n\t\t\t\t// 'ev.detail' is deprecated upstream and returns the PANEL (not\n\t\t\t\t// the tab button) behind a console.warn. Read '.tab' directly.\n\t\t\t\tconst tab = ev.tab;\n\t\t\t\tconst label = tab && tab.dataset ? tab.dataset.tabLabel : null;\n\t\t\t\tif (!label) return;\n\t\t\t\tif (storageKey) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlocalStorage.setItem(storageKey, label);\n\t\t\t\t\t} catch {}\n\t\t\t\t}\n\t\t\t\tif (syncKey) {\n\t\t\t\t\tconst peers = document.querySelectorAll(\n\t\t\t\t\t\t'[data-publier-tabs][data-sync-key=\"' + syncKey + '\"]',\n\t\t\t\t\t);\n\t\t\t\t\tfor (const peer of peers) {\n\t\t\t\t\t\tif (peer === root) continue;\n\t\t\t\t\t\tactivateByLabel(peer, label);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n\n\tif (!window.__publierTabsStorageWired) {\n\t\twindow.__publierTabsStorageWired = true;\n\t\twindow.addEventListener('storage', (ev) => {\n\t\t\tif (!ev.key || ev.key.indexOf(SYNC_PREFIX) !== 0 || ev.newValue == null) return;\n\t\t\tconst syncKey = ev.key.slice(SYNC_PREFIX.length);\n\t\t\tconst label = ev.newValue;\n\t\t\tconst peers = document.querySelectorAll(\n\t\t\t\t'[data-publier-tabs][data-sync-key=\"' + syncKey + '\"]',\n\t\t\t);\n\t\t\tfor (const root of peers) {\n\t\t\t\tactivateByLabel(root, label);\n\t\t\t}\n\t\t});\n\t}\n\n\twire();\n\tdocument.addEventListener('astro:page-load', wire);\n})();\n";
|
|
24
24
|
//#endregion
|
|
25
25
|
export { TABS_SYNC_SCRIPT };
|
package/dist/search/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { i as listPresets, n as ThemePreset, r as isValidPreset, t as AVAILABLE_THEMES } from "../presets-
|
|
2
|
-
|
|
1
|
+
import { i as listPresets, n as ThemePreset, r as isValidPreset, t as AVAILABLE_THEMES } from "../presets-BpOSAh0T.mjs";
|
|
3
2
|
//#region src/tailwind/index.d.ts
|
|
4
|
-
declare const PRESET_CSS_PATH:
|
|
3
|
+
declare const PRESET_CSS_PATH: '@publier/shell/tailwind/preset.css';
|
|
5
4
|
//#endregion
|
|
6
5
|
export { AVAILABLE_THEMES, PRESET_CSS_PATH, type ThemePreset, isValidPreset, listPresets };
|
package/dist/tailwind/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"../presets-
|
|
1
|
+
import{n as e,r as t,t as n}from"../presets-BSnEdPYj.mjs";const r=`@publier/shell/tailwind/preset.css`;export{n as AVAILABLE_THEMES,r as PRESET_CSS_PATH,e as isValidPreset,t as listPresets};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { i as listPresets, n as ThemePreset, r as isValidPreset, t as AVAILABLE_THEMES } from "../presets-
|
|
2
|
-
|
|
1
|
+
import { i as listPresets, n as ThemePreset, r as isValidPreset, t as AVAILABLE_THEMES } from "../presets-BpOSAh0T.mjs";
|
|
3
2
|
//#region src/tailwind/override.d.ts
|
|
4
3
|
/** Shape of a parsed `theme.yaml`. Fields match `content-spec/theme.schema.json`. */
|
|
5
4
|
interface ThemeYaml {
|
|
@@ -22,7 +21,7 @@ interface ThemeYaml {
|
|
|
22
21
|
favicon?: string;
|
|
23
22
|
}
|
|
24
23
|
/** Allow-listed override sections — parallel to the JSON Schema. */
|
|
25
|
-
declare const THEME_SECTIONS: readonly [
|
|
24
|
+
declare const THEME_SECTIONS: readonly ['colors', 'typography', 'layout', 'prose', 'code'];
|
|
26
25
|
type ThemeSection = (typeof THEME_SECTIONS)[number];
|
|
27
26
|
/**
|
|
28
27
|
* Keys accepted under each section. Mirrors content-spec/theme.schema.json.
|
|
@@ -68,7 +67,9 @@ declare function renderOverrideCss(overrides: Record<string, string>): string;
|
|
|
68
67
|
* inside the returned ResolvedTheme (doctor-friendly — never throws).
|
|
69
68
|
*/
|
|
70
69
|
declare function resolveThemeWithPreset(input: ThemeYaml | null | undefined, options: {
|
|
71
|
-
/** Fallback preset when `theme.yaml` doesn't specify one. */
|
|
70
|
+
/** Fallback preset when `theme.yaml` doesn't specify one. */
|
|
71
|
+
defaultPreset: ThemePreset;
|
|
72
|
+
/** Tester for whether a preset name is allowed. */
|
|
72
73
|
isValidPreset: (name: string) => boolean;
|
|
73
74
|
}): ResolvedTheme & {
|
|
74
75
|
preset: ThemePreset;
|
package/dist/tailwind/loader.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"../presets-
|
|
1
|
+
import{n as e,r as t,t as n}from"../presets-BSnEdPYj.mjs";import{tailwindComposeThemeCss as r,tailwindReadPresetCss as i,tailwindResolveTheme as a}from"@publier/native";import{fileURLToPath as o}from"node:url";const s=[`colors`,`typography`,`layout`,`prose`,`code`],c={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`],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`]};function l(e){if(!e||typeof e!=`object`||Array.isArray(e))return{preset:void 0,overrides:{},overrideCss:``,errors:[]};let t=a(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 u(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
2
|
`)}\n}\n`}function d(e,t){let n=l(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 f(e,t){return r(e,t)}const p=o(new URL(`./themes/`,import.meta.url));function m(e){return`${p}${e}.css`}async function h(e){return i(p,e)}export{n as AVAILABLE_THEMES,c as THEME_KEYS,s as THEME_SECTIONS,f as composeThemeCss,e as isValidPreset,t as listPresets,h as loadPresetCss,m as presetPath,u as renderOverrideCss,l as resolveTheme,d as resolveThemeWithPreset};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=`publier-theme`;function t(e,t,n){return e===`dark`||e===`auto`&&(t===`dark`||t===`system`&&n)}function n(e){return e===`light`||e===`dark`?e:`auto`}function r(e){return e===`auto`?`light`:e===`light`?`dark`:`auto`}var i=class extends HTMLElement{#e=null;#t=null;#n=null;connectedCallback(){let e=this.querySelector(`button`);e&&(this.#n=e=>{e.preventDefault(),this.#r()},e.addEventListener(`click`,this.#n),(this.dataset.defaultScheme??`system`)===`system`&&(this.#e=window.matchMedia(`(prefers-color-scheme: dark)`),this.#t=()=>{(this.dataset.mode??`auto`)===`auto`&&this.#i()},this.#e.addEventListener(`change`,this.#t)))}disconnectedCallback(){let e=this.querySelector(`button`);e&&this.#n&&e.removeEventListener(`click`,this.#n),this.#e&&this.#t&&this.#e.removeEventListener(`change`,this.#t),this.#e=null,this.#t=null,this.#n=null}#r(){let t=r(n(this.dataset.mode));try{t===`auto`?localStorage.removeItem(e):localStorage.setItem(e,t)}catch{}this.dataset.mode=t;let i=this.dataset[`label${t.charAt(0).toUpperCase()+t.slice(1)}`],a=this.querySelector(`button`);a&&i&&(a.setAttribute(`aria-label`,i),a.setAttribute(`title`,i)),this.#i()}#i(){let e=t(n(this.dataset.mode),this.dataset.defaultScheme??`system`,typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches);document.documentElement.classList.toggle(`dark`,e),document.documentElement.dataset.theme=e?`dark`:`light`}};typeof customElements<`u`&&!customElements.get(`publier-theme-toggle`)&&customElements.define(`publier-theme-toggle`,i);export{};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@publier/shell",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "Qwik + Astro docs layout for Publier sites.",
|
|
6
6
|
"_filesRationale": "mixed: dist for build-time TS + source globs for shipped .astro components",
|
|
@@ -108,18 +108,19 @@
|
|
|
108
108
|
"access": "public"
|
|
109
109
|
},
|
|
110
110
|
"dependencies": {
|
|
111
|
-
"@astrojs/rss": "^4.0.
|
|
112
|
-
"@astrojs/sitemap": "^3.7.
|
|
111
|
+
"@astrojs/rss": "^4.0.19",
|
|
112
|
+
"@astrojs/sitemap": "^3.7.3",
|
|
113
113
|
"@fontsource-variable/inter": "^5.2.8",
|
|
114
114
|
"@fontsource-variable/jetbrains-mono": "^5.2.8",
|
|
115
|
-
"@github/clipboard-copy-element": "^1.3.
|
|
116
|
-
"@github/relative-time-element": "^5.
|
|
117
|
-
"@github/tab-container-element": "^4.
|
|
118
|
-
"@
|
|
119
|
-
"
|
|
120
|
-
"
|
|
115
|
+
"@github/clipboard-copy-element": "^1.3.2",
|
|
116
|
+
"@github/relative-time-element": "^5.3.1",
|
|
117
|
+
"@github/tab-container-element": "^4.9.0",
|
|
118
|
+
"@publier/native": "2.0.0",
|
|
119
|
+
"@tailwindcss/typography": "^0.5.20",
|
|
120
|
+
"astro-pagefind": "^2.0.1",
|
|
121
|
+
"daisyui": "^5.7.22",
|
|
121
122
|
"hastscript": "^9.0.1",
|
|
122
|
-
"katex": "^0.
|
|
123
|
+
"katex": "^0.18.4",
|
|
123
124
|
"mdast-util-directive": "^3.1.0",
|
|
124
125
|
"mdast-util-from-markdown": "^2.0.3",
|
|
125
126
|
"mdast-util-to-markdown": "^2.1.2",
|
|
@@ -132,8 +133,7 @@
|
|
|
132
133
|
"remark-gfm": "^4.0.1",
|
|
133
134
|
"remark-math": "^6.0.0",
|
|
134
135
|
"unist-util-visit": "^5.1.0",
|
|
135
|
-
"yaml": "^2.9.0"
|
|
136
|
-
"@publier/native": "1.1.3"
|
|
136
|
+
"yaml": "^2.9.0"
|
|
137
137
|
},
|
|
138
138
|
"peerDependencies": {
|
|
139
139
|
"@astrojs/markdown-remark": ">=7.0.0",
|
|
@@ -151,18 +151,21 @@
|
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
153
|
"devDependencies": {
|
|
154
|
-
"@astrojs/
|
|
155
|
-
"@
|
|
154
|
+
"@astrojs/markdown-remark": "7.2.4",
|
|
155
|
+
"@astrojs/mdx": "^7.0.8",
|
|
156
|
+
"@qwik.dev/astro": "^1.1.0",
|
|
157
|
+
"@qwik.dev/core": "2.0.0-beta.40",
|
|
156
158
|
"@types/mdast": "^4.0.4",
|
|
157
|
-
"astro": "7.
|
|
159
|
+
"astro": "7.2.6",
|
|
160
|
+
"astro-expressive-code": "^0.44.0",
|
|
158
161
|
"rehype-stringify": "^10.0.1",
|
|
159
162
|
"remark-parse": "^11.0.0",
|
|
160
163
|
"remark-rehype": "^11.1.2",
|
|
161
|
-
"tsdown": "^0.22.
|
|
162
|
-
"typescript": "^
|
|
164
|
+
"tsdown": "^0.22.14",
|
|
165
|
+
"typescript": "^7.0.2",
|
|
163
166
|
"unified": "^11.0.5",
|
|
164
167
|
"vfile": "^6.0.3",
|
|
165
|
-
"vite": "
|
|
168
|
+
"vite": "~8.2.2"
|
|
166
169
|
},
|
|
167
170
|
"repository": {
|
|
168
171
|
"type": "git",
|
|
@@ -3,3 +3,14 @@
|
|
|
3
3
|
export const THEME_STORAGE_KEY = 'publier-theme';
|
|
4
4
|
|
|
5
5
|
export type Theme = 'light' | 'dark' | 'auto';
|
|
6
|
+
|
|
7
|
+
export type DefaultScheme = 'system' | 'light' | 'dark';
|
|
8
|
+
|
|
9
|
+
export function resolveIsDark(
|
|
10
|
+
mode: Theme,
|
|
11
|
+
defaultScheme: DefaultScheme,
|
|
12
|
+
systemDark: boolean,
|
|
13
|
+
): boolean {
|
|
14
|
+
const autoDark = defaultScheme === 'dark' || (defaultScheme === 'system' && systemDark);
|
|
15
|
+
return mode === 'dark' || (mode === 'auto' && autoDark);
|
|
16
|
+
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type DefaultScheme,
|
|
5
|
+
resolveIsDark,
|
|
6
|
+
THEME_STORAGE_KEY,
|
|
7
|
+
type Theme,
|
|
8
|
+
} from './theme-storage.ts';
|
|
4
9
|
|
|
5
10
|
function parseMode(value: unknown): Theme {
|
|
6
11
|
return value === 'light' || value === 'dark' ? value : 'auto';
|
|
@@ -70,11 +75,13 @@ class PublierThemeToggleElement extends HTMLElement {
|
|
|
70
75
|
|
|
71
76
|
#applyTheme(): void {
|
|
72
77
|
const mode = parseMode(this.dataset.mode);
|
|
73
|
-
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
const defaultScheme = (this.dataset.defaultScheme ?? 'system') as DefaultScheme;
|
|
74
82
|
const systemDark =
|
|
75
83
|
typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
76
|
-
const
|
|
77
|
-
const isDark = mode === 'dark' || (mode === 'auto' && autoDark);
|
|
84
|
+
const isDark = resolveIsDark(mode, defaultScheme, systemDark);
|
|
78
85
|
document.documentElement.classList.toggle('dark', isDark);
|
|
79
86
|
document.documentElement.dataset.theme = isDark ? 'dark' : 'light';
|
|
80
87
|
}
|
|
@@ -1,102 +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{generateAnalyticsScripts as l,shellAnnouncementBannerScript as u,shellBuildHeaders as d,shellBuildLicenseErrorMessage as f,shellCacheControl as p,shellCollectTailwindClassTokens as m,shellComposeTailwindEntry as h,shellExtractAnalyticsFromYaml as g,shellExtractAnnouncementFromYaml as _,shellExtractDocsConfigFromYaml as v,shellExtractFontsFromYaml as y,shellExtractNavFromYaml as b,shellExtractSiteFromYaml as x,shellExtractSnippetsFromYaml as S,shellExtractVarsFromYaml as C,shellLazyUpgradeScript as w,shellOpenInAiScript as T,shellPlanDefaultRoutes as ee,shellPlanRehypePlugins as te,shellPlanRemarkPlugins as ne,shellResolvePrefetch as re,shellResolveSnippetsConfig as ie,shellRewriteHead as ae,shellRewriteModulepreload as E,shellSearchButtonScript as D,shellSearchDialogScript as O,shellTableOfContentsScript as k,verifyLicense as oe}from"@publier/native";import{existsSync as A,mkdirSync as j,readFileSync as M,readdirSync as N,writeFileSync as P}from"node:fs";import{writeFile as se}from"node:fs/promises";import F from"node:path";import{fileURLToPath as I}from"node:url";import{fontProviders as L}from"astro/config";import R from"rehype-autolink-headings";import z from"rehype-external-links";import B from"remark-directive";const V=/^\/(?:_astro|assets|build)\//;function H(){return d()}function U(e){return p(e)}function W(e,t){let n=ae(e,t.map(e=>e.pathname));return{stylesheetsCount:n.stylesheetsCount,modulesCount:n.modulesCount,pagesRewritten:n.pagesRewritten,stylesheets:n.stylesheets,modules:n.modules}}function G(e,t){let n=E(e,t.map(e=>e.pathname));return{jsCount:n.jsCount,fontsCount:n.fontsCount,pagesRewritten:n.pagesRewritten}}function K(e){let t=C(e);return t?JSON.parse(t):void 0}function q(e){let t=y(e);return t?JSON.parse(t):void 0}function ce(e){let t=g(e);return t?JSON.parse(t):void 0}function J(e){let t=_(e);return t?JSON.parse(t):null}function le(e){let t=S(e);if(t)return t===`false`?!1:JSON.parse(t)}function ue(e){return JSON.parse(x(e))}function de(e){return JSON.parse(v(e))}function fe(e){return JSON.parse(b(e))}function pe(e){let t=F.join(e,`publier.config.yaml`);if(!A(t))return null;try{return M(t,`utf-8`)}catch{return null}}function me(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 he(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 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(B);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);break}return c}function _e(e,t){let n=JSON.parse(e),r=[];for(let e of n)switch(e.id){case`rehype-autolink-headings`:r.push([R,e.options]);break;case`rehype-external-links`:r.push([z,e.options]);break;case`rehype-katex`:t&&r.push(t.rehypeKatex);break}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 ye=w();function be({root:e,mathEnabled:t}){let n=c(import.meta.url),r=t=>{try{return F.dirname(n.resolve(`${t}/package.json`,{paths:[e]}))}catch{return null}},i=(e,t)=>{let n=r(e);return n?{abs_path:F.join(n,t).split(F.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(F.sep).join(`/`)}catch{o=null}let s=h(JSON.stringify(a),o??void 0),l=m(),u=F.join(e,`.astro`);if(l.length>0){A(u)||j(u,{recursive:!0});let e=F.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(` `));P(e,n.map(e=>`<div class="${e}"></div>`).join(`
|
|
2
|
-
`),`utf8`);let r=e.split(F.sep).join(`/`);s+=`@source "${r}";\n`}let d=F.join(u,`publier-tailwind-entry.css`);return(A(d)?M(d,`utf8`):``)!==s&&(j(u,{recursive:!0}),P(d,s)),d}function xe(e,t,n){if(Se(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 Se(e){for(let t of e){if(!t)continue;if(Array.isArray(t)){if(Se(t))return!0;continue}let e=t.name;if(typeof e==`string`&&e.startsWith(`@tailwindcss/vite`))return!0}return!1}function Ce(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(F.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(`
|
|
3
|
-
if (import.meta.hot) {
|
|
4
|
-
import.meta.hot.accept();
|
|
5
|
-
}
|
|
6
|
-
`)})}}}const we=`import 'astro:scripts/page-ssr.js';
|
|
7
|
-
`;function Te(){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(we)?null:{code:we+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;continue}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;continue}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!==`
|
|
8
|
-
`&&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(`
|
|
9
|
-
`)||(i+=`
|
|
10
|
-
`),i+=t.join(`
|
|
11
|
-
`),i.endsWith(`
|
|
12
|
-
`)||(i+=`
|
|
13
|
-
`)),i}function Ee(){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 De(e,t=6){return e.length===0?`[]`:e.length<=t?`[${e.join(`, `)}]`:`[${e.slice(0,t).join(`, `)}, +${e.length-t} more]`}function Oe(e){let t=[ye,a,i,u(),T(),k()];return e.searchEnabled&&t.push(O(),D()),t.join(`
|
|
14
|
-
`)}function ke(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:L.google(),fallbacks:c,weights:l,styles:u,subsets:[`latin`]}),r.push(a);else if(o.src){let e=F.isAbsolute(o.src)&&A(o.src)?o.src:F.join(t,`public`,o.src.replace(/^\/+/,``));n.push({name:o.family,cssVariable:s,provider:L.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 Ae=[{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=F.join(e,`src`,`content`,t);if(!A(n))return!1;try{return N(n,{recursive:!0}).some(e=>typeof e==`string`&&/\.mdx?$/.test(e))}catch{return!1}}function je(e={}){return{name:`@publier/shell`,hooks:{"astro:config:setup":async({config:t,updateConfig:n,injectScript:r,injectRoute:i,logger:a})=>{let u=t.root?I(t.root):process.cwd();try{oe()}catch(e){let t=f(e instanceof Error?e.message:String(e));throw t?Error(t):e}let d=c(F.join(u,`package.json`)),p=JSON.stringify(e),m=pe(u),h=m?ue(m):{name:``,url:null,description:null,logo:null,favicon:null,footer:null,serviceWorker:!1},g=typeof h.url==`string`&&h.url.length>0;g&&!t.site&&n({site:h.url});let _=new Set(t.integrations.map(e=>e.name)),v=Ae.filter(({aliases:e})=>!e.some(e=>_.has(e)));v.length>0&&a.warn(`[@publier/shell] Required framework integrations are not registered in
|
|
15
|
-
astro.config.ts. As of @publier/shell@2.0.0, docsShell() no longer
|
|
16
|
-
auto-wires these. Add the following to your integrations[] array
|
|
17
|
-
(import statements + entries shown). Order matters: docsShell() must
|
|
18
|
-
come FIRST (astro-expressive-code >=0.43 registers into the Markdown
|
|
19
|
-
processor it finds at its own setup — docsShell's pinned unified()
|
|
20
|
-
processor must already be in place), and expressive-code must precede
|
|
21
|
-
mdx.
|
|
22
|
-
|
|
23
|
-
import expressiveCode from 'astro-expressive-code';
|
|
24
|
-
import mdx from '@astrojs/mdx';
|
|
25
|
-
import sitemap from '@astrojs/sitemap';
|
|
26
|
-
import pagefind from 'astro-pagefind';
|
|
27
|
-
import qwik from '@qwik.dev/astro';
|
|
28
|
-
|
|
29
|
-
integrations: [
|
|
30
|
-
docsShell({ /* options */ }),
|
|
31
|
-
expressiveCode(),
|
|
32
|
-
mdx(),
|
|
33
|
-
sitemap(),
|
|
34
|
-
pagefind(),
|
|
35
|
-
qwik({ clientRouter: true }),
|
|
36
|
-
]
|
|
37
|
-
|
|
38
|
-
Missing:\n ${v.map(e=>e.pkg).join(`
|
|
39
|
-
`)}\n`);let y=t.prefetch;re(y===void 0?void 0:JSON.stringify(y),p)&&n({prefetch:{prefetchAll:!0,defaultStrategy:`viewport`}});let b=m?K(m):void 0,x=m?q(m):void 0,{entries:S,familyOnlyCss:C,slots:w}=x?ke(x,u):{entries:[],familyOnlyCss:``,slots:[]},T=m?fe(m):{variants:{},pathRules:[],defaultVariant:`default`,searchEnabled:!0},ae=m?J(m):null,E=m?de(m):{tabSections:[],sidebarMeta:{},versions:[],anchors:[]},D=m?le(m):null,O=ie(p,(D==null?null:D===!1?`false`:JSON.stringify(D))??void 0,A(F.join(u,`content/snippets`))),k=JSON.parse(O),j={...e,snippets:k===null?void 0:k},M=JSON.stringify(j),N=e.math!==!1,P=N?me(d,a):null,se=ne(M,!!(b&&Object.keys(b).length>0),k!==null&&k!==!1,N&&P!==null),R=te(p,N&&P!==null),z=ge(se,b,P),B=_e(R,P),V=he(d,a);await ve(e,t.integrations,u,n);let H=be({root:u,mathEnabled:N}),U=Oe({searchEnabled:e.search!==!1}),W=JSON.stringify({docs:$(u,`docs`),blog:$(u,`blog`),changelog:$(u,`changelog`)}),G=JSON.parse(ee(p,g,W)),ye=G.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(V){let e=t.markdown?.processor,n=e?.options?.hastPlugins;e?.name!==`unified`&&Array.isArray(n)&&n.length>0&&a.warn(`[@publier/shell] docsShell() is replacing the configured "${e?.name}" Markdown processor, discarding ${n.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.`)}if(n({markdown:V?{processor:V({remarkPlugins:z,rehypePlugins:B})}:{remarkPlugins:[...z],rehypePlugins:[...B]},vite:{ssr:{noExternal:[`@publier/shell`,`@qwik.dev/core`,`@qwik.dev/astro`],external:[`@publier/native`]},build:{rollupOptions:{external:[`@publier/native`]}},optimizeDeps:{exclude:[`@publier/shell`,`@publier/native`]},plugins:[...xe(d,a,t.vite?.plugins??[]),s({root:u}),o({root:u}),Q(`virtual:publier-nav-config`,`navConfig`,T),Ce({entryPath:H}),Te(),Q(`virtual:publier-announcement`,`announcement`,ae),Q(`virtual:publier-site`,`site`,h),Q(`virtual:publier-docs-config`,`docsConfig`,E),Q(`virtual:publier-feeds`,`feeds`,ye),Q(`virtual:publier-fonts`,`fonts`,{slots:w}),Ee()]}}),n({fonts:[{name:`Inter Variable`,cssVariable:`--publier-font-builtin-sans`,provider:L.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:L.npm({remote:!1}),fallbacks:[`monospace`],weights:[`100 800`],styles:[`normal`],subsets:[`latin`],options:{package:`@fontsource-variable/jetbrains-mono`}},...S]}),r(`page-ssr`,[`import ${JSON.stringify(H)};`,`import 'virtual:publier-theme-css';`,`import 'virtual:publier-custom-css';`,`import '@publier/shell/styles/base.css';`].join(`
|
|
40
|
-
`)),r(`page`,U),r(`head-inline`,`(function(){
|
|
41
|
-
if (typeof window === 'undefined' || !window.sessionStorage || !window.fetch) return;
|
|
42
|
-
var store = window.sessionStorage;
|
|
43
|
-
var ResponseCtor = window.Response;
|
|
44
|
-
var origFetch = window.fetch.bind(window);
|
|
45
|
-
var NS = 'publier:bg:';
|
|
46
|
-
var PATTERN = /^\\/(?:_astro|assets|build)\\/(?:[^\\/]*bundle-graph[^\\/]*\\.json|q-manifest[^\\/]*\\.json)(?:\\?.*)?$/;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var inflight = Object.create(null);
|
|
52
|
-
function serve(body){
|
|
53
|
-
return new ResponseCtor(body, {
|
|
54
|
-
status: 200,
|
|
55
|
-
headers: { 'content-type': 'application/json' }
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
window.fetch = function(input, init){
|
|
59
|
-
var url = typeof input === 'string' ? input : (input && input.url) || '';
|
|
60
|
-
var method = (init && init.method) || (input && input.method) || 'GET';
|
|
61
|
-
if (!url || method !== 'GET' || !PATTERN.test(url)) {
|
|
62
|
-
return origFetch(input, init);
|
|
63
|
-
}
|
|
64
|
-
var key = NS + url;
|
|
65
|
-
|
|
66
|
-
try {
|
|
67
|
-
var hit = store.getItem(key);
|
|
68
|
-
if (hit !== null) return Promise.resolve(serve(hit));
|
|
69
|
-
} catch (_) {}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (inflight[url]) return inflight[url].then(serve);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var pending = origFetch(input, init).then(function(res){
|
|
76
|
-
if (res && res.ok) {
|
|
77
|
-
return res.clone().text().then(function(body){
|
|
78
|
-
try { store.setItem(key, body); } catch (_) {}
|
|
79
|
-
delete inflight[url];
|
|
80
|
-
return res;
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
delete inflight[url];
|
|
84
|
-
return res;
|
|
85
|
-
}, function(err){
|
|
86
|
-
delete inflight[url];
|
|
87
|
-
throw err;
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
inflight[url] = pending.then(function(res){
|
|
91
|
-
return res && res.ok ? res.clone().text() : '';
|
|
92
|
-
});
|
|
93
|
-
return pending;
|
|
94
|
-
};
|
|
95
|
-
})();`),C&&r(`head-inline`,`
|
|
96
|
-
const _pFonts = document.createElement('style');
|
|
97
|
-
_pFonts.textContent = ${JSON.stringify(C)};
|
|
98
|
-
document.head.appendChild(_pFonts);
|
|
99
|
-
`),m){let e=ce(m);if(e){let t=l(e);t&&r(`head-inline`,`
|
|
100
|
-
const _pAnalytics = document.createRange().createContextualFragment(${JSON.stringify(t)});
|
|
101
|
-
document.head.appendChild(_pAnalytics);
|
|
102
|
-
`)}}for(let e of G)i({pattern:e.pattern,entrypoint:e.entrypoint,prerender:e.prerender});G.length>0&&a.info(`[@publier/shell] Injected default routes: ${G.map(e=>e.pattern).join(`, `)}.`),a.info(`[@publier/shell] Plugin pipeline wired.`)},"astro:build:done":async({dir:e,pages:t,logger:n})=>{let r=I(e);await se(F.join(r,`_headers`),H(),`utf-8`),n.info(`[@publier/shell] Wrote 5 header rules to dist/_headers.`);let i=W(r,t);i.pagesRewritten>0&&n.info(`[@publier/shell] Backfilled head tags on ${i.pagesRewritten} HTML file(s) (stylesheets=${De(i.stylesheets)}, modules=${De(i.modules)}).`);let a=G(r,t);a.pagesRewritten>0&&n.info(`[@publier/shell] Injected preload tags into ${a.pagesRewritten} HTML file(s) (js=${a.jsCount}, fonts=${a.fontsCount}).`)}}}}export{de as a,ue as c,V as d,U as f,J as i,le as l,Z as n,q as o,Ee as r,fe as s,je as t,K as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=`publier-theme`;function t(e){return e===`light`||e===`dark`?e:`auto`}function n(e){return e===`auto`?`light`:e===`light`?`dark`:`auto`}var r=class extends HTMLElement{#e=null;#t=null;#n=null;connectedCallback(){let e=this.querySelector(`button`);e&&(this.#n=e=>{e.preventDefault(),this.#r()},e.addEventListener(`click`,this.#n),(this.dataset.defaultScheme??`system`)===`system`&&(this.#e=window.matchMedia(`(prefers-color-scheme: dark)`),this.#t=()=>{(this.dataset.mode??`auto`)===`auto`&&this.#i()},this.#e.addEventListener(`change`,this.#t)))}disconnectedCallback(){let e=this.querySelector(`button`);e&&this.#n&&e.removeEventListener(`click`,this.#n),this.#e&&this.#t&&this.#e.removeEventListener(`change`,this.#t),this.#e=null,this.#t=null,this.#n=null}#r(){let r=n(t(this.dataset.mode));try{r===`auto`?localStorage.removeItem(e):localStorage.setItem(e,r)}catch{}this.dataset.mode=r;let i=this.dataset[`label${r.charAt(0).toUpperCase()+r.slice(1)}`],a=this.querySelector(`button`);a&&i&&(a.setAttribute(`aria-label`,i),a.setAttribute(`title`,i)),this.#i()}#i(){let e=t(this.dataset.mode),n=this.dataset.defaultScheme??`system`,r=typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches,i=e===`dark`||e===`auto`&&(n===`dark`||n===`system`&&r);document.documentElement.classList.toggle(`dark`,i),document.documentElement.dataset.theme=i?`dark`:`light`}};typeof customElements<`u`&&!customElements.get(`publier-theme-toggle`)&&customElements.define(`publier-theme-toggle`,r);export{};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|