@publier/shell 3.4.3 → 3.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/runtime/lazy-upgrade-registry.d.mts +2 -1
- package/dist/runtime/lazy-upgrade-registry.mjs +1 -1
- package/package.json +3 -2
- package/src/components/index.ts +1 -0
- package/src/components/section-switcher.astro +25 -0
- package/src/routes/docs-slug.astro +20 -4
- package/src/styles/base.css +20 -0
|
@@ -37,5 +37,6 @@ declare const upgradeThemeToggle: () => Promise<unknown>;
|
|
|
37
37
|
* itself on `astro:page-load` after the first import.
|
|
38
38
|
*/
|
|
39
39
|
declare const upgradeImageZoom: () => Promise<unknown>;
|
|
40
|
+
declare const upgradeDetailsMenu: () => Promise<unknown>;
|
|
40
41
|
//#endregion
|
|
41
|
-
export { upgradeClipboardCopy, upgradeImageZoom, upgradeRelativeTime, upgradeTabContainer, upgradeThemeToggle };
|
|
42
|
+
export { upgradeClipboardCopy, upgradeDetailsMenu, upgradeImageZoom, upgradeRelativeTime, upgradeTabContainer, upgradeThemeToggle };
|
|
@@ -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-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};
|
|
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`),a=()=>import(`@github/details-menu-element`);export{e as upgradeClipboardCopy,a as upgradeDetailsMenu,i as upgradeImageZoom,n as upgradeRelativeTime,t as upgradeTabContainer,r as upgradeThemeToggle};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@publier/shell",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.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",
|
|
@@ -113,9 +113,10 @@
|
|
|
113
113
|
"@fontsource-variable/inter": "^5.2.8",
|
|
114
114
|
"@fontsource-variable/jetbrains-mono": "^5.2.8",
|
|
115
115
|
"@github/clipboard-copy-element": "^1.3.2",
|
|
116
|
+
"@github/details-menu-element": "^1.0.13",
|
|
116
117
|
"@github/relative-time-element": "^5.3.1",
|
|
117
118
|
"@github/tab-container-element": "^4.9.0",
|
|
118
|
-
"@publier/native": "2.2.
|
|
119
|
+
"@publier/native": "2.2.2",
|
|
119
120
|
"@tailwindcss/typography": "^0.5.20",
|
|
120
121
|
"astro-pagefind": "^2.0.1",
|
|
121
122
|
"daisyui": "^5.7.22",
|
package/src/components/index.ts
CHANGED
|
@@ -37,6 +37,7 @@ export { default as OpenInAI } from './open-in-ai.astro';
|
|
|
37
37
|
export { default as PackageInstall } from './package-install.astro';
|
|
38
38
|
export { default as Panels } from './panels.astro';
|
|
39
39
|
export { default as SearchButton } from './search-button.astro';
|
|
40
|
+
export { default as SectionSwitcher } from './section-switcher.astro';
|
|
40
41
|
export { default as Sidebar } from './sidebar.astro';
|
|
41
42
|
export { default as SkipLink } from './skip-link.astro';
|
|
42
43
|
export { default as Steps } from './steps.astro';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { navigationActiveIndex } from '@publier/native';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
sections: { label: string; href: string }[];
|
|
6
|
+
currentPath: string;
|
|
7
|
+
}
|
|
8
|
+
const { sections, currentPath } = Astro.props;
|
|
9
|
+
const active = navigationActiveIndex(JSON.stringify(sections), currentPath);
|
|
10
|
+
---
|
|
11
|
+
{sections.length > 1 && (
|
|
12
|
+
<nav aria-label="Documentation sections" class="mb-4">
|
|
13
|
+
<details class="dropdown w-full">
|
|
14
|
+
<summary class="btn btn-outline w-full justify-between font-normal" aria-label={`Documentation: ${sections[active]?.label ?? 'Choose a section'}`}>
|
|
15
|
+
<span class="truncate">{sections[active]?.label ?? 'Choose a section'}</span>
|
|
16
|
+
<span aria-hidden="true">⌄</span>
|
|
17
|
+
</summary>
|
|
18
|
+
<details-menu role="menu" class="dropdown-content menu bg-base-100 rounded-box border border-base-300 shadow-lg z-30 w-full p-2">
|
|
19
|
+
{sections.map((section, index) => (
|
|
20
|
+
<li role="none"><a role="menuitem" href={section.href} aria-current={index === active ? 'location' : undefined}>{section.label}</a></li>
|
|
21
|
+
))}
|
|
22
|
+
</details-menu>
|
|
23
|
+
</details>
|
|
24
|
+
</nav>
|
|
25
|
+
)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { getCollection, render } from 'astro:content';
|
|
3
3
|
import BaseLayout from '../layouts/base-layout.astro';
|
|
4
|
-
import { type BreadcrumbItem, DocsLayout, LastModified, Sidebar, SkipLink, TableOfContents } from '../components/index.ts';
|
|
4
|
+
import { type BreadcrumbItem, DocsLayout, LastModified, SectionSwitcher, Sidebar, SkipLink, TableOfContents } from '../components/index.ts';
|
|
5
5
|
import { buildSidebar, entryToPage } from '@publier/shell/search';
|
|
6
6
|
import { shellPlanDocsSlug, shellRenderDocsSlug } from '@publier/native';
|
|
7
7
|
import { docsConfig } from 'virtual:publier-docs-config';
|
|
@@ -13,15 +13,31 @@ const { entry } = Astro.props;
|
|
|
13
13
|
const { Content, headings } = await render(entry);
|
|
14
14
|
const all = await getCollection('docs');
|
|
15
15
|
const plan = JSON.parse(shellPlanDocsSlug(JSON.stringify({ entry_id: entry.id, title: entry.data.title, description: entry.data.description ?? null, tab_sections: docsConfig.tabSections, all_entry_ids: all.map((e) => e.id) }))) as { breadcrumbs: BreadcrumbItem[]; section_entry_ids: string[]; scope: string; current_path: string; sidebar_persist_key: string };
|
|
16
|
+
const pages = all.map((e) => entryToPage({ slug: e.id.replace(/\.(mdx?|md)$/, ''), data: e.data, headings: [] }, { urlPrefix: '/docs' }));
|
|
17
|
+
const sections = [
|
|
18
|
+
...(pages.some((page) => page.url === '/docs') ? [{ label: 'All documentation', href: '/docs' }] : []),
|
|
19
|
+
...docsConfig.tabSections.flatMap((section) => {
|
|
20
|
+
const path = `/docs/${section}`;
|
|
21
|
+
const page = pages.find((page) => page.url === path) ?? pages.find((page) => page.url.startsWith(`${path}/`));
|
|
22
|
+
return page ? [{ label: page.url === path ? page.frontmatter.title : section, href: page.url }] : [];
|
|
23
|
+
}),
|
|
24
|
+
];
|
|
25
|
+
const breadcrumbs = plan.breadcrumbs.map((crumb) => {
|
|
26
|
+
const page = pages.find((page) => page.url === crumb.href);
|
|
27
|
+
return page && crumb.href !== '/docs' ? { ...crumb, label: page.frontmatter.title } : crumb;
|
|
28
|
+
});
|
|
16
29
|
const ids = new Set(plan.section_entry_ids);
|
|
17
|
-
const sidebarItems = buildSidebar(
|
|
30
|
+
const sidebarItems = buildSidebar(pages.filter((_, index) => ids.has(all[index].id)), { urlPrefix: '/docs', meta: docsConfig.sidebarMeta });
|
|
18
31
|
const [bodyHead, bodyTail] = shellRenderDocsSlug(JSON.stringify({ title: entry.data.title, description: entry.data.description ?? null })).split('<!--publier-content-slot-->');
|
|
19
32
|
const lastUpdated = entry.data.lastUpdated instanceof Date ? entry.data.lastUpdated : null;
|
|
20
33
|
---
|
|
21
34
|
<BaseLayout title={`${entry.data.title} — Docs`} description={entry.data.description} nav="docs">
|
|
22
35
|
<SkipLink slot="skip" targetId="main-content" />
|
|
23
|
-
<DocsLayout breadcrumbs={
|
|
24
|
-
<
|
|
36
|
+
<DocsLayout breadcrumbs={breadcrumbs.length > 2 ? breadcrumbs : undefined}>
|
|
37
|
+
<Fragment slot="sidebar">
|
|
38
|
+
<SectionSwitcher sections={sections} currentPath={plan.current_path} />
|
|
39
|
+
<Sidebar items={sidebarItems} currentPath={plan.current_path} versions={docsConfig.versions.length > 0 ? docsConfig.versions : undefined} anchors={docsConfig.anchors.length > 0 ? docsConfig.anchors : undefined} scope={plan.scope} />
|
|
40
|
+
</Fragment>
|
|
25
41
|
<TableOfContents slot="toc" headings={headings} />
|
|
26
42
|
<Fragment set:html={bodyHead} />
|
|
27
43
|
<Content />
|
package/src/styles/base.css
CHANGED
|
@@ -625,3 +625,23 @@ header.alert[data-publier-banner] [data-publier-banner-dismiss] {
|
|
|
625
625
|
margin-inline-start: 0;
|
|
626
626
|
color: var(--color-base-content);
|
|
627
627
|
}
|
|
628
|
+
|
|
629
|
+
/* Native dialog top-layer placement keeps mobile docs above the sticky header. */
|
|
630
|
+
.publier-docs-dialog {
|
|
631
|
+
justify-items: start;
|
|
632
|
+
align-items: stretch;
|
|
633
|
+
}
|
|
634
|
+
.publier-docs-dialog .modal-box {
|
|
635
|
+
width: min(20rem, calc(100vw - 2rem));
|
|
636
|
+
max-width: none;
|
|
637
|
+
max-height: 100dvh;
|
|
638
|
+
height: 100dvh;
|
|
639
|
+
border-radius: 0;
|
|
640
|
+
padding: 1rem;
|
|
641
|
+
}
|
|
642
|
+
[data-publier-mobile-toc] .publier-toc__label {
|
|
643
|
+
display: none;
|
|
644
|
+
}
|
|
645
|
+
.prose :where(h2, h3, h4, h5, h6)[id] {
|
|
646
|
+
scroll-margin-top: 5rem;
|
|
647
|
+
}
|