@publier/shell 4.2.2 → 4.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/README.md CHANGED
@@ -39,14 +39,26 @@ nav:
39
39
  href: /contact
40
40
  ```
41
41
 
42
- The default variant serves both marketing and documentation pages. Keep one
43
- canonical configuration; if named variants are needed, reuse the same YAML anchor
44
- instead of copying the items. Only one level is supported. Empty groups, malformed
42
+ Configure marketing navigation in `default` or a named marketing variant, and
43
+ documentation navigation in `docs`. Without a `docs` variant, documentation routes
44
+ derive section links from `docs.tabSections`. Reuse YAML anchors for shared destinations. Only one level is supported. Empty groups, malformed
45
45
  children, and nested groups are omitted. Descriptions are plain text and are
46
46
  escaped along with labels and destinations. Children support local paths,
47
47
  fragments, HTTP(S), mail and telephone links; executable URL schemes are omitted.
48
48
  `external: true` opens a new tab with `noopener noreferrer`.
49
49
 
50
+ Documentation selectors open on click or keyboard activation. Their labels stay
51
+ stationary; the disclosure arrow changes orientation without an entrance animation.
52
+
53
+ Outside the `docs` variant, desktop groups also open on hover for fine pointers.
54
+ Their wider panels arrange destinations in two columns, with a brief Motion
55
+ entrance. Reduced-motion preferences disable the animation. Touch uses tap;
56
+ keyboard opening, selection and Escape remain owned by details-menu. Pointer
57
+ opening informs that element's mouse-modality listener so hover does not steal
58
+ focus. Moving into the panel keeps it open; leaving dismisses after a short grace
59
+ period unless a panel link retains keyboard focus. Astro swaps clear timers and
60
+ animations before wiring the new header. Plain-link variants need no groups.
61
+
50
62
  Desktop menus appear at `lg` (1024px). Each group is a native `<details>` with
51
63
  `data-publier-nav-group` set to its label. Its direct `<details-menu>` child has
52
64
  `data-publier-nav-menu`, `role="menu"`, and links with `role="menuitem"`. The
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,i as t,t as n}from"./integration-DgDVMttc.mjs";export{t as HASHED_ASSET_RE,n as docsShell,e as publierCacheControl};
1
+ import{a as e,i as t,t as n}from"./integration-B__TDsKV.mjs";export{t as HASHED_ASSET_RE,n as docsShell,e as publierCacheControl};
@@ -11,7 +11,7 @@ if (import.meta.hot) {
11
11
  `),i+=t.join(`
12
12
  `),i.endsWith(`
13
13
  `)||(i+=`
14
- `)),i}function we(){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 Te(e,t=6){return e.length===0?`[]`:e.length<=t?`[${e.join(`, `)}]`:`[${e.slice(0,t).join(`, `)}, +${e.length-t} more]`}function Ee(e){let t=[ve,a,i,f(),v(),C()];return e.searchEnabled&&t.push(S(),x()),t.join(`
14
+ `)),i}function we(){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 Te(e,t=6){return e.length===0?`[]`:e.length<=t?`[${e.join(`, `)}]`:`[${e.slice(0,t).join(`, `)}, +${e.length-t} more]`}function Ee(e){let t=[`import '@publier/shell/runtime/marketing-nav';`,ve,a,i,f(),v(),C()];return e.searchEnabled&&t.push(S(),x()),t.join(`
15
15
  `)}function De(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=A.isAbsolute(o.src)&&w(o.src)?o.src:A.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 Oe=[{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=A.join(e,`src`,`content`,t);if(!w(n))return!1;try{return D(n,{recursive:!0}).some(e=>typeof e==`string`&&/\.mdx?$/.test(e))}catch{return!1}}function ke(e={}){let t=null;return{name:`@publier/shell`,hooks:{"astro:config:setup":async({config:n,updateConfig:r,injectScript:i,injectRoute:a,logger:l})=>{let u=n.root?j(n.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 f=c(A.join(u,`package.json`)),p=JSON.stringify(e),m=de(fe(u)??``),h=m.site;t={llms:m.llms,siteName:h.name,siteDescription:h.description??void 0};let g=m.vars,_=m.fonts,v=m.nav,y=m.announcement,b=m.docs,x=typeof h.url==`string`&&h.url.length>0;x&&!n.site&&r({site:h.url});let S=new Set(n.integrations.map(e=>e.name)),C=Oe.filter(({aliases:e})=>!e.some(e=>S.has(e)));C.length>0&&l.warn(`[@publier/shell] Required framework integrations are not registered in
16
16
  astro.config.ts. As of @publier/shell@2.0.0, docsShell() no longer
17
17
  auto-wires these. Add the following to your integrations[] array
@@ -1 +1 @@
1
- import{n as e,r as t,t as n}from"./integration-DgDVMttc.mjs";export{n as docsShell,e as hoistMediaOutOfUtilitiesLayer,t as publierCascadeHoistPlugin};
1
+ import{n as e,r as t,t as n}from"./integration-B__TDsKV.mjs";export{n as docsShell,e as hoistMediaOutOfUtilitiesLayer,t as publierCascadeHoistPlugin};
@@ -0,0 +1 @@
1
+ import "@github/details-menu-element";
@@ -0,0 +1 @@
1
+ import"@github/details-menu-element";const e=matchMedia(`(min-width: 1024px)`),t=matchMedia(`(hover: hover) and (pointer: fine)`),n=matchMedia(`(prefers-reduced-motion: reduce)`);let r,i,a;function o(){return i||=import(`motion/mini`).then(e=>{r=e.animate}).catch(()=>{i=void 0}),i}function s(){a?.();let i=Array.from(document.querySelectorAll(`[data-publier-top-nav]:not([data-publier-docs-header]) details.dropdown[data-publier-nav-group]:not([data-publier-docs-selector])`));if(!i.length)return;let s=new AbortController,c={signal:s.signal},l=new Set;e.matches&&!n.matches&&o();for(let a of i){let i=a.querySelector(`:scope > summary`),u=a.querySelector(`:scope > details-menu`);if(!i||!u)continue;let d,f,p=0,m=!1,h=()=>{clearTimeout(d),d=void 0},g=()=>{p+=1,f?.cancel(),f=void 0},_=()=>{h(),g(),m=!1,a.open=!1};l.add(_),a.addEventListener(`pointerenter`,n=>{n.pointerType===`touch`||!e.matches||!t.matches||(h(),!a.open&&(a.dispatchEvent(new MouseEvent(`mousedown`)),m=!0,a.open=!0))},c),a.addEventListener(`pointerleave`,e=>{e.pointerType!==`touch`&&(h(),d=setTimeout(()=>{u.contains(document.activeElement)||_()},160))},c),i.addEventListener(`click`,e=>{e.detail>0&&m&&a.open&&e.preventDefault(),m=!1},c),document.addEventListener(`keydown`,e=>{e.key===`Escape`&&!e.defaultPrevented&&a.open&&!a.contains(document.activeElement)&&(_(),e.preventDefault())},c),a.addEventListener(`focusout`,()=>{queueMicrotask(()=>{!a.contains(document.activeElement)&&!a.matches(`:hover`)&&_()})},c),a.addEventListener(`toggle`,()=>{if(g(),!a.open){m=!1;return}if(n.matches||!e.matches)return;let t=p;o().then(()=>{t!==p||s.signal.aborted||!a.isConnected||!a.open||n.matches||!e.matches||(f=r?.(u,{opacity:[0,1],transform:[`translateY(6px)`,`translateY(0)`]},{duration:.18,ease:[.16,1,.3,1]}))})},c),n.addEventListener(`change`,g,c)}e.addEventListener(`change`,()=>{for(let e of l)e()},c),t.addEventListener(`change`,()=>{for(let e of l)e()},c),a=()=>{s.abort();for(let e of l)e();a=void 0}}s(),document.addEventListener(`astro:before-swap`,()=>a?.()),document.addEventListener(`astro:after-swap`,s);export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@publier/shell",
3
- "version": "4.2.2",
3
+ "version": "4.3.0",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Qwik + Astro docs layout for Publier sites.",
6
6
  "type": "module",
@@ -101,7 +101,11 @@
101
101
  "import": "./dist/tailwind/loader.mjs"
102
102
  },
103
103
  "./tailwind/preset.css": "./src/tailwind/preset.css",
104
- "./tailwind/themes/*": "./dist/themes/*"
104
+ "./tailwind/themes/*": "./dist/themes/*",
105
+ "./runtime/marketing-nav": {
106
+ "types": "./dist/runtime/marketing-nav.d.mts",
107
+ "import": "./dist/runtime/marketing-nav.mjs"
108
+ }
105
109
  },
106
110
  "publishConfig": {
107
111
  "access": "public"
@@ -133,7 +137,8 @@
133
137
  "remark-gfm": "^4.0.1",
134
138
  "remark-math": "^6.0.0",
135
139
  "unist-util-visit": "^5.1.0",
136
- "yaml": "^2.9.0"
140
+ "yaml": "^2.9.0",
141
+ "motion": "^14.0.0"
137
142
  },
138
143
  "peerDependencies": {
139
144
  "@astrojs/markdown-remark": ">=7.0.0",
@@ -707,3 +707,97 @@ aside[aria-label="Table of contents"] {
707
707
  body:has([data-publier-docs-header]) :is(h2, h3, h4)[id] {
708
708
  scroll-margin-top: calc(var(--publier-header-height, 4rem) + 1rem);
709
709
  }
710
+
711
+ /* Header controls remain stationary while the disclosure indicator changes. */
712
+ [data-publier-docs-header] .btn,
713
+ [data-publier-docs-selector] > summary,
714
+ [data-publier-top-nav] details[data-publier-nav-group] > summary {
715
+ translate: none;
716
+ scale: none;
717
+ }
718
+ [data-publier-docs-selector] > summary {
719
+ color: var(--color-base-content);
720
+ transform: none;
721
+ transition: none;
722
+ background-color: transparent;
723
+ box-shadow: none;
724
+ }
725
+ [data-publier-docs-selector] > summary > span[aria-hidden="true"] {
726
+ display: inline-block;
727
+ width: 0.4rem;
728
+ height: 0.4rem;
729
+ font-size: 0;
730
+ border-right: 1.5px solid currentColor;
731
+ border-bottom: 1.5px solid currentColor;
732
+ transform: rotate(45deg);
733
+ }
734
+ [data-publier-docs-selector][open] > summary > span[aria-hidden="true"] {
735
+ transform: rotate(225deg);
736
+ }
737
+ [data-publier-docs-header] .dropdown-content {
738
+ animation: none;
739
+ transition: none;
740
+ scale: 1;
741
+ }
742
+
743
+ /* Marketing uses the existing menu surface, expanded into an airy link grid.
744
+ * Native disclosure still works without JavaScript; Motion enhances entrance. */
745
+ @media (width >= 64rem) {
746
+ [data-publier-top-nav]:not([data-publier-docs-header])
747
+ details.dropdown[data-publier-nav-group]:not([data-publier-docs-selector]) {
748
+ position: static;
749
+ }
750
+ [data-publier-top-nav]:not([data-publier-docs-header])
751
+ details.dropdown[data-publier-nav-group]:not([data-publier-docs-selector])
752
+ > summary {
753
+ transform: none;
754
+ background-color: transparent;
755
+ box-shadow: none;
756
+ transition: color 150ms ease;
757
+ }
758
+ [data-publier-top-nav]:not([data-publier-docs-header])
759
+ details.dropdown[data-publier-nav-group]
760
+ > summary::after {
761
+ transition: transform 150ms ease;
762
+ }
763
+ [data-publier-top-nav]:not([data-publier-docs-header])
764
+ details.dropdown[data-publier-nav-group]:not([data-publier-docs-selector])
765
+ > [data-publier-nav-menu] {
766
+ inset-inline: 0;
767
+ top: 100%;
768
+ width: min(56rem, calc(100vw - 3rem));
769
+ max-width: none;
770
+ max-height: calc(100dvh - 6rem);
771
+ margin-inline: auto;
772
+ padding: 1.5rem;
773
+ overflow-y: auto;
774
+ border-radius: 0 0 0.75rem 0.75rem;
775
+ box-shadow: 0 18px 32px -16px rgb(0 0 0 / 0.2);
776
+ scale: 1;
777
+ animation: none;
778
+ transition: none;
779
+ transform-origin: top center;
780
+ }
781
+ [data-publier-top-nav]:not([data-publier-docs-header]) [data-publier-nav-menu] > ul {
782
+ display: grid;
783
+ grid-template-columns: repeat(2, minmax(0, 1fr));
784
+ gap: 0.5rem 1.5rem;
785
+ }
786
+ [data-publier-top-nav]:not([data-publier-docs-header]) [data-publier-nav-menu] > ul > li > a {
787
+ height: 100%;
788
+ padding: 1rem;
789
+ border-radius: 0.375rem;
790
+ font-size: 1.0625rem;
791
+ line-height: 1.4;
792
+ }
793
+ [data-publier-top-nav]:not([data-publier-docs-header]) [data-publier-nav-description] {
794
+ margin-top: 0.375rem;
795
+ color: color-mix(in oklab, var(--color-base-content) 70%, transparent);
796
+ line-height: 1.5;
797
+ }
798
+ }
799
+ @media (prefers-reduced-motion: reduce) {
800
+ [data-publier-top-nav] details[data-publier-nav-group] > summary::after {
801
+ transition: none;
802
+ }
803
+ }