@publier/shell 3.1.5
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 +1 -0
- package/dist/build-integration.d.mts +7 -0
- package/dist/build-integration.mjs +1 -0
- package/dist/image-zoom-runtime-Cr8vBrXH.mjs +1 -0
- package/dist/index-Bc-beOEe.d.mts +1033 -0
- package/dist/index.d.mts +33 -0
- package/dist/index.mjs +1 -0
- package/dist/integration-6L__3wwu.mjs +102 -0
- package/dist/integration-DKTmdCWN.d.mts +203 -0
- package/dist/integration.d.mts +2 -0
- package/dist/integration.mjs +1 -0
- package/dist/loaders/index.d.mts +54 -0
- package/dist/loaders/index.mjs +1 -0
- package/dist/plugins/remark-asides.d.mts +8 -0
- package/dist/plugins/remark-asides.mjs +2 -0
- package/dist/plugins/remark-snippets.d.mts +11 -0
- package/dist/plugins/remark-snippets.mjs +1 -0
- package/dist/plugins/remark-structure.d.mts +13 -0
- package/dist/plugins/remark-structure.mjs +1 -0
- package/dist/plugins/remark-vars.d.mts +7 -0
- package/dist/plugins/remark-vars.mjs +1 -0
- package/dist/presets-DL0qjtya.mjs +1 -0
- package/dist/presets-RGpZ_X1B.d.mts +16 -0
- package/dist/runtime/code-group-sync.d.mts +30 -0
- package/dist/runtime/code-group-sync.mjs +103 -0
- package/dist/runtime/lazy-upgrade-registry.d.mts +41 -0
- package/dist/runtime/lazy-upgrade-registry.mjs +1 -0
- package/dist/runtime/tabs-sync.d.mts +25 -0
- package/dist/runtime/tabs-sync.mjs +106 -0
- package/dist/search/index.d.mts +92 -0
- package/dist/search/index.mjs +1 -0
- package/dist/tailwind/css-plugin.d.mts +16 -0
- package/dist/tailwind/css-plugin.mjs +1 -0
- package/dist/tailwind/index.d.mts +6 -0
- package/dist/tailwind/index.mjs +1 -0
- package/dist/tailwind/loader.d.mts +94 -0
- package/dist/tailwind/loader.mjs +2 -0
- package/dist/theme-toggle-element-DzFjxwpS.mjs +1 -0
- package/dist/themes/almond.css +115 -0
- package/dist/themes/aspen.css +95 -0
- package/dist/themes/catppuccin.css +98 -0
- package/dist/themes/dark.css +98 -0
- package/dist/themes/dusk.css +98 -0
- package/dist/themes/emerald.css +95 -0
- package/dist/themes/light.css +95 -0
- package/dist/themes/maple.css +119 -0
- package/dist/themes/neutral.css +73 -0
- package/dist/themes/ocean.css +98 -0
- package/dist/themes/purple.css +95 -0
- package/dist/themes/ruby.css +95 -0
- package/dist/themes/solar.css +98 -0
- package/dist/themes/vitepress.css +95 -0
- package/package.json +178 -0
- package/src/astro-modules.d.ts +20 -0
- package/src/components/LastModified.astro +25 -0
- package/src/components/announcement-banner.astro +25 -0
- package/src/components/aside.astro +17 -0
- package/src/components/ask-ai.tsx +146 -0
- package/src/components/badge.astro +18 -0
- package/src/components/breadcrumbs.astro +23 -0
- package/src/components/callouts/caution.astro +13 -0
- package/src/components/callouts/check.astro +13 -0
- package/src/components/callouts/danger.astro +13 -0
- package/src/components/callouts/info.astro +13 -0
- package/src/components/callouts/note.astro +13 -0
- package/src/components/callouts/tip.astro +13 -0
- package/src/components/callouts/warning.astro +13 -0
- package/src/components/card-grid.astro +14 -0
- package/src/components/card.astro +18 -0
- package/src/components/code-group.astro +55 -0
- package/src/components/columns.astro +18 -0
- package/src/components/docs-layout.astro +25 -0
- package/src/components/file-tree-node.astro +13 -0
- package/src/components/file-tree.astro +9 -0
- package/src/components/icon.astro +18 -0
- package/src/components/index.ts +154 -0
- package/src/components/link-button.astro +21 -0
- package/src/components/link-card.astro +21 -0
- package/src/components/open-in-ai.astro +13 -0
- package/src/components/package-install.astro +17 -0
- package/src/components/panels.astro +16 -0
- package/src/components/search-button.astro +21 -0
- package/src/components/sidebar.astro +12 -0
- package/src/components/skip-link.astro +12 -0
- package/src/components/steps.astro +13 -0
- package/src/components/table-of-contents.astro +22 -0
- package/src/components/tabs.astro +17 -0
- package/src/components/theme-storage.ts +5 -0
- package/src/components/theme-toggle-element.ts +85 -0
- package/src/components/theme-toggle.astro +25 -0
- package/src/components/tile-grid.astro +13 -0
- package/src/components/tile.astro +17 -0
- package/src/components/top-nav-mobile.astro +11 -0
- package/src/components/top-nav.astro +20 -0
- package/src/components/types.ts +522 -0
- package/src/components/ui/blur-image.astro +60 -0
- package/src/components/ui/changelog-entry.astro +56 -0
- package/src/components/ui/cta-band.astro +30 -0
- package/src/components/ui/feature-grid.astro +38 -0
- package/src/components/ui/feature-section.astro +85 -0
- package/src/components/ui/frame.astro +52 -0
- package/src/components/ui/hero.astro +47 -0
- package/src/components/ui/jobs-list.astro +53 -0
- package/src/components/ui/logo-cloud.astro +68 -0
- package/src/components/ui/press-gallery.astro +52 -0
- package/src/components/ui/pricing-comparison-table.astro +73 -0
- package/src/components/ui/pricing-section.astro +113 -0
- package/src/components/ui/pricing-table.astro +54 -0
- package/src/components/ui/status-indicator.astro +38 -0
- package/src/components/ui/team-grid.astro +63 -0
- package/src/components/ui/testimonial-card.astro +42 -0
- package/src/components/ui/types.ts +323 -0
- package/src/components/update-badge.astro +15 -0
- package/src/components/version-switcher.astro +20 -0
- package/src/icons/index.tsx +195 -0
- package/src/layouts/base-layout.astro +65 -0
- package/src/qwik.ts +3 -0
- package/src/routes/blog-index.astro +20 -0
- package/src/routes/blog-rss.xml.ts +40 -0
- package/src/routes/blog-slug.astro +32 -0
- package/src/routes/changelog-index.astro +25 -0
- package/src/routes/changelog-rss.xml.ts +47 -0
- package/src/routes/docs-slug.astro +31 -0
- package/src/routes/not-found.astro +14 -0
- package/src/runtime/banner-init.ts +9 -0
- package/src/runtime/lazy-upgrade-init.ts +5 -0
- package/src/runtime/sidebar-scroll-init.ts +3 -0
- package/src/runtime/theme-init.ts +16 -0
- package/src/schemas/blog.ts +38 -0
- package/src/schemas/changelog.ts +29 -0
- package/src/schemas/common.ts +88 -0
- package/src/schemas/docs.ts +104 -0
- package/src/schemas/index.ts +14 -0
- package/src/schemas/pages.ts +23 -0
- package/src/styles/base.css +627 -0
- package/src/styles/expressive-code.css +41 -0
- package/src/styles/rules.css +66 -0
- package/src/styles/tailwind-sources.css +17 -0
- package/src/tailwind/preset.css +193 -0
- package/src/virtual-modules.d.ts +164 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { Font } from 'astro:assets';
|
|
3
|
+
import { ClientRouter } from 'astro:transitions';
|
|
4
|
+
import { shellRenderBaseLayout, navigationMatchNavPath } from '@publier/native';
|
|
5
|
+
import SearchButton from '../components/search-button.astro';
|
|
6
|
+
import ThemeToggle from '../components/theme-toggle.astro';
|
|
7
|
+
import TopNavMobile from '../components/top-nav-mobile.astro';
|
|
8
|
+
import { TopNav } from '../components/index.ts';
|
|
9
|
+
import { announcement } from 'virtual:publier-announcement';
|
|
10
|
+
import { feeds } from 'virtual:publier-feeds';
|
|
11
|
+
import { fonts } from 'virtual:publier-fonts';
|
|
12
|
+
import { navConfig } from 'virtual:publier-nav-config';
|
|
13
|
+
import { site } from 'virtual:publier-site';
|
|
14
|
+
|
|
15
|
+
interface Props { title: string; description?: string; nav?: string | false; class?: string }
|
|
16
|
+
const { title, description, nav: navProp, class: className } = Astro.props;
|
|
17
|
+
const currentPath = Astro.url.pathname;
|
|
18
|
+
let navVariant: string | false;
|
|
19
|
+
if (navProp !== undefined) {
|
|
20
|
+
navVariant = navProp;
|
|
21
|
+
} else {
|
|
22
|
+
const matched = navigationMatchNavPath(JSON.stringify(navConfig.pathRules), currentPath);
|
|
23
|
+
navVariant = matched === 'false'
|
|
24
|
+
? false
|
|
25
|
+
: matched === 'null'
|
|
26
|
+
? navConfig.defaultVariant
|
|
27
|
+
: (JSON.parse(matched) as string);
|
|
28
|
+
}
|
|
29
|
+
const storageKey = announcement?.storageKey ?? 'publier-announcement';
|
|
30
|
+
|
|
31
|
+
const [head, bodyOpen, bodyClose] = JSON.parse(shellRenderBaseLayout(JSON.stringify({
|
|
32
|
+
title, description, className, favicon: site.favicon, footer: site.footer, serviceWorker: !!site.serviceWorker,
|
|
33
|
+
announcement: announcement && { ...announcement, variant: announcement.variant ?? 'info', storageKey, dismissible: true },
|
|
34
|
+
}))) as [string, string, string];
|
|
35
|
+
---
|
|
36
|
+
<!doctype html>
|
|
37
|
+
<html lang="en">
|
|
38
|
+
<head>
|
|
39
|
+
<Fragment set:html={head} />
|
|
40
|
+
<Font cssVariable="--publier-font-builtin-sans" preload />
|
|
41
|
+
<Font cssVariable="--publier-font-builtin-mono" />
|
|
42
|
+
{fonts.slots.includes('heading') && <Font cssVariable="--publier-font-heading" preload />}
|
|
43
|
+
{fonts.slots.includes('body') && <Font cssVariable="--publier-font-body" preload />}
|
|
44
|
+
{fonts.slots.includes('mono') && <Font cssVariable="--publier-font-mono" />}
|
|
45
|
+
{site.url && feeds.map((f) => (
|
|
46
|
+
<link rel="alternate" type="application/rss+xml" title={f.title} href={`${site.url}${f.href}`} />
|
|
47
|
+
))}
|
|
48
|
+
<ClientRouter />
|
|
49
|
+
<slot name="head" />
|
|
50
|
+
</head>
|
|
51
|
+
<body class={className}>
|
|
52
|
+
|
|
53
|
+
<slot name="skip" />
|
|
54
|
+
<Fragment set:html={bodyOpen} />
|
|
55
|
+
{navVariant !== false && (
|
|
56
|
+
<TopNav variant={navVariant} currentPath={currentPath}>
|
|
57
|
+
{navConfig.searchEnabled && <SearchButton slot="search" />}
|
|
58
|
+
<ThemeToggle slot="theme" />
|
|
59
|
+
<TopNavMobile slot="mobile" variant={navVariant} currentPath={currentPath} />
|
|
60
|
+
</TopNav>
|
|
61
|
+
)}
|
|
62
|
+
<slot />
|
|
63
|
+
<Fragment set:html={bodyClose} />
|
|
64
|
+
</body>
|
|
65
|
+
</html>
|
package/src/qwik.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { getCollection } from 'astro:content';
|
|
3
|
+
import BaseLayout from '../layouts/base-layout.astro';
|
|
4
|
+
import { shellRenderBlogIndex } from '@publier/native';
|
|
5
|
+
|
|
6
|
+
interface BlogEntry {
|
|
7
|
+
id: string;
|
|
8
|
+
data: { title: string; description?: string; author?: string; date?: Date; pubDate?: Date; draft?: boolean };
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const posts = ((await getCollection('blog')) as unknown as BlogEntry[])
|
|
12
|
+
.filter((p) => !p.data.draft)
|
|
13
|
+
.map((p) => ({ ...p, resolvedDate: p.data.date ?? p.data.pubDate ?? new Date(0) }))
|
|
14
|
+
.sort((a, b) => b.resolvedDate.getTime() - a.resolvedDate.getTime());
|
|
15
|
+
const bodyHtml = shellRenderBlogIndex(JSON.stringify({ posts: posts.map((p) => ({ href: `/blog/${p.id.replace(/\.(mdx?|md)$/, '')}`, title: p.data.title, description: p.data.description ?? null, author: p.data.author ?? null, date_ms: p.resolvedDate.getTime() })) }));
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<BaseLayout title="Blog" description="News, updates, and articles." nav="blog">
|
|
19
|
+
<Fragment set:html={bodyHtml} />
|
|
20
|
+
</BaseLayout>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { getCollection } from 'astro:content';
|
|
4
|
+
import { site as siteConfig } from 'virtual:publier-site';
|
|
5
|
+
import rss from '@astrojs/rss';
|
|
6
|
+
|
|
7
|
+
interface BlogEntry {
|
|
8
|
+
id: string;
|
|
9
|
+
data: {
|
|
10
|
+
title: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
author?: string;
|
|
13
|
+
date: Date;
|
|
14
|
+
updated?: Date;
|
|
15
|
+
draft: boolean;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function GET(context: { site?: URL }) {
|
|
20
|
+
const all = (await getCollection('blog')) as unknown as BlogEntry[];
|
|
21
|
+
const items = all
|
|
22
|
+
.filter((entry) => !entry.data.draft)
|
|
23
|
+
.sort((a, b) => b.data.date.getTime() - a.data.date.getTime())
|
|
24
|
+
.map((entry) => ({
|
|
25
|
+
title: entry.data.title,
|
|
26
|
+
description: entry.data.description ?? '',
|
|
27
|
+
pubDate: entry.data.date,
|
|
28
|
+
link: `/blog/${entry.id.replace(/\.(mdx?|md)$/, '')}/`,
|
|
29
|
+
...(entry.data.author ? { author: entry.data.author } : {}),
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
return rss({
|
|
33
|
+
title: `${siteConfig.name || 'Publier'} — Blog`,
|
|
34
|
+
description: siteConfig.description ?? 'Latest blog posts.',
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
site: context.site ?? new URL(siteConfig.url ?? 'https://example.com'),
|
|
38
|
+
items,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { getCollection, render } from 'astro:content';
|
|
3
|
+
import BaseLayout from '../layouts/base-layout.astro';
|
|
4
|
+
import { LastModified } from '../components/index.ts';
|
|
5
|
+
import { shellRenderBlogSlug } from '@publier/native';
|
|
6
|
+
|
|
7
|
+
interface BlogEntry {
|
|
8
|
+
id: string;
|
|
9
|
+
data: { title: string; description?: string; author?: string; date?: Date; pubDate?: Date; updated?: Date };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export async function getStaticPaths() {
|
|
13
|
+
const posts = await getCollection('blog');
|
|
14
|
+
return posts.map((post) => ({
|
|
15
|
+
params: { slug: post.id.replace(/\.(mdx?|md)$/, '') },
|
|
16
|
+
props: { post },
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const { post } = Astro.props as { post: BlogEntry };
|
|
21
|
+
const { Content } = await render(post as unknown as Parameters<typeof render>[0]);
|
|
22
|
+
const d = post.data.date ?? post.data.pubDate;
|
|
23
|
+
const updated = post.data.updated instanceof Date ? post.data.updated : null;
|
|
24
|
+
const [head, tail] = shellRenderBlogSlug(JSON.stringify({ title: post.data.title, description: post.data.description ?? null, author: post.data.author ?? null, date_ms: d ? d.getTime() : null })).split('<!--publier-content-slot-->');
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
<BaseLayout title={post.data.title} description={post.data.description} nav="blog">
|
|
28
|
+
<Fragment set:html={head} />
|
|
29
|
+
<Content />
|
|
30
|
+
{updated && <LastModified date={updated} />}
|
|
31
|
+
<Fragment set:html={tail} />
|
|
32
|
+
</BaseLayout>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { getCollection, render } from 'astro:content';
|
|
3
|
+
import BaseLayout from '../layouts/base-layout.astro';
|
|
4
|
+
import { shellRenderChangelogEntry, shellRenderChangelogFooter, shellRenderChangelogHeader } from '@publier/native';
|
|
5
|
+
|
|
6
|
+
interface ChangelogEntry {
|
|
7
|
+
id: string;
|
|
8
|
+
data: { title: string; description?: string; version?: string; date: Date; draft?: boolean; tags?: string[] };
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const entries = ((await getCollection('changelog')) as unknown as ChangelogEntry[])
|
|
12
|
+
.filter((e) => !e.data.draft)
|
|
13
|
+
.sort((a, b) => b.data.date.getTime() - a.data.date.getTime());
|
|
14
|
+
const rendered = await Promise.all(entries.map(async (entry) => {
|
|
15
|
+
const { Content } = await render(entry as unknown as Parameters<typeof render>[0]);
|
|
16
|
+
const [head, tail] = shellRenderChangelogEntry(JSON.stringify({ title: entry.data.title, date_ms: entry.data.date.getTime(), version: entry.data.version ?? null, tags: entry.data.tags ?? [] })).split('<!--publier-content-slot-->');
|
|
17
|
+
return { head, tail, Content };
|
|
18
|
+
}));
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<BaseLayout title="Changelog" description="Version history and release notes.">
|
|
22
|
+
<Fragment set:html={shellRenderChangelogHeader()} />
|
|
23
|
+
{rendered.map(({ head, tail, Content }) => (<><Fragment set:html={head} /><Content /><Fragment set:html={tail} /></>))}
|
|
24
|
+
<Fragment set:html={shellRenderChangelogFooter()} />
|
|
25
|
+
</BaseLayout>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { getCollection } from 'astro:content';
|
|
4
|
+
import { site as siteConfig } from 'virtual:publier-site';
|
|
5
|
+
import rss from '@astrojs/rss';
|
|
6
|
+
|
|
7
|
+
interface ChangelogEntry {
|
|
8
|
+
id: string;
|
|
9
|
+
data: {
|
|
10
|
+
title: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
version?: string;
|
|
13
|
+
date: Date;
|
|
14
|
+
draft: boolean;
|
|
15
|
+
tags?: string[];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function GET(context: { site?: URL }) {
|
|
20
|
+
const all = (await getCollection('changelog')) as unknown as ChangelogEntry[];
|
|
21
|
+
const items = all
|
|
22
|
+
.filter((entry) => !entry.data.draft)
|
|
23
|
+
.sort((a, b) => b.data.date.getTime() - a.data.date.getTime())
|
|
24
|
+
.map((entry) => {
|
|
25
|
+
const version = entry.data.version;
|
|
26
|
+
const baseTitle = entry.data.title;
|
|
27
|
+
const displayTitle =
|
|
28
|
+
version && !baseTitle.includes(version) ? `${baseTitle} (${version})` : baseTitle;
|
|
29
|
+
return {
|
|
30
|
+
title: displayTitle,
|
|
31
|
+
description: entry.data.description ?? '',
|
|
32
|
+
pubDate: entry.data.date,
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
link: `/changelog/#${entry.id.replace(/\.(mdx?|md)$/, '')}`,
|
|
37
|
+
...(entry.data.tags ? { categories: entry.data.tags } : {}),
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return rss({
|
|
42
|
+
title: `${siteConfig.name || 'Publier'} — Changelog`,
|
|
43
|
+
description: siteConfig.description ?? 'Version history and release notes.',
|
|
44
|
+
site: context.site ?? new URL(siteConfig.url ?? 'https://example.com'),
|
|
45
|
+
items,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { getCollection, render } from 'astro:content';
|
|
3
|
+
import BaseLayout from '../layouts/base-layout.astro';
|
|
4
|
+
import { type BreadcrumbItem, DocsLayout, LastModified, Sidebar, SkipLink, TableOfContents } from '../components/index.ts';
|
|
5
|
+
import { buildSidebar, entryToPage } from '@publier/shell/search';
|
|
6
|
+
import { shellPlanDocsSlug, shellRenderDocsSlug } from '@publier/native';
|
|
7
|
+
import { docsConfig } from 'virtual:publier-docs-config';
|
|
8
|
+
import '../styles/expressive-code.css';
|
|
9
|
+
export async function getStaticPaths() {
|
|
10
|
+
return (await getCollection('docs')).map((entry) => ({ params: { slug: entry.id.replace(/\.(mdx?|md)$/, '').replace(/\/index$/, '').replace(/^index$/, '') || undefined }, props: { entry } }));
|
|
11
|
+
}
|
|
12
|
+
const { entry } = Astro.props;
|
|
13
|
+
const { Content, headings } = await render(entry);
|
|
14
|
+
const all = await getCollection('docs');
|
|
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 ids = new Set(plan.section_entry_ids);
|
|
17
|
+
const sidebarItems = buildSidebar(all.filter((e) => ids.has(e.id)).map((e) => entryToPage({ slug: e.id.replace(/\.(mdx?|md)$/, ''), data: e.data, headings: [] }, { urlPrefix: '/docs' })), { urlPrefix: '/docs', meta: docsConfig.sidebarMeta });
|
|
18
|
+
const [bodyHead, bodyTail] = shellRenderDocsSlug(JSON.stringify({ title: entry.data.title, description: entry.data.description ?? null })).split('<!--publier-content-slot-->');
|
|
19
|
+
const lastUpdated = entry.data.lastUpdated instanceof Date ? entry.data.lastUpdated : null;
|
|
20
|
+
---
|
|
21
|
+
<BaseLayout title={`${entry.data.title} — Docs`} description={entry.data.description} nav="docs">
|
|
22
|
+
<SkipLink slot="skip" targetId="main-content" />
|
|
23
|
+
<DocsLayout breadcrumbs={plan.breadcrumbs.length > 2 ? plan.breadcrumbs : undefined} sidebarPersistKey={plan.sidebar_persist_key}>
|
|
24
|
+
<Sidebar slot="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} />
|
|
25
|
+
<TableOfContents slot="toc" headings={headings} />
|
|
26
|
+
<Fragment set:html={bodyHead} />
|
|
27
|
+
<Content />
|
|
28
|
+
{lastUpdated && <LastModified date={lastUpdated} />}
|
|
29
|
+
<Fragment set:html={bodyTail} />
|
|
30
|
+
</DocsLayout>
|
|
31
|
+
</BaseLayout>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
import BaseLayout from '../layouts/base-layout.astro';
|
|
3
|
+
import { shellRenderNotFound } from '@publier/native';
|
|
4
|
+
|
|
5
|
+
const bodyHtml = shellRenderNotFound();
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<BaseLayout
|
|
9
|
+
title="Page not found"
|
|
10
|
+
description="The page you were looking for could not be found."
|
|
11
|
+
nav="default"
|
|
12
|
+
>
|
|
13
|
+
<Fragment set:html={bodyHtml} />
|
|
14
|
+
</BaseLayout>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { shellBuildBannerInitScript } from '@publier/native';
|
|
4
|
+
|
|
5
|
+
export const BANNER_DEFAULT_STORAGE_KEY = 'publier-banner-dismissed';
|
|
6
|
+
|
|
7
|
+
export function buildBannerInitScript(storageKey: string = BANNER_DEFAULT_STORAGE_KEY): string {
|
|
8
|
+
return shellBuildBannerInitScript(storageKey);
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { shellBuildThemeInitScript } from '@publier/native';
|
|
4
|
+
|
|
5
|
+
export interface AppearanceOptions {
|
|
6
|
+
|
|
7
|
+
default?: 'system' | 'light' | 'dark';
|
|
8
|
+
|
|
9
|
+
strict?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function buildThemeInitScript(appearance: AppearanceOptions = {}): string {
|
|
13
|
+
return shellBuildThemeInitScript(appearance.default ?? 'system', appearance.strict ?? false);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const THEME_INIT_SCRIPT = buildThemeInitScript({ default: 'system', strict: false });
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { z } from 'astro/zod';
|
|
4
|
+
import { DescriptionFieldSchema, DraftFieldSchema, TagsFieldSchema } from './common.ts';
|
|
5
|
+
|
|
6
|
+
export const blogSchema = z.object({
|
|
7
|
+
|
|
8
|
+
title: z.string(),
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
description: DescriptionFieldSchema,
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
date: z.coerce.date(),
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
updated: z.coerce.date().optional(),
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
author: z.string().optional(),
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
tags: TagsFieldSchema,
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
image: z.string().optional(),
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
imageAlt: z.string().optional(),
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
draft: DraftFieldSchema,
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
excerpt: z.string().optional(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export type BlogEntry = z.infer<typeof blogSchema>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { z } from 'astro/zod';
|
|
4
|
+
import { DescriptionFieldSchema, DraftFieldSchema, TagsFieldSchema } from './common.ts';
|
|
5
|
+
|
|
6
|
+
export const changelogSchema = z.object({
|
|
7
|
+
|
|
8
|
+
title: z.string(),
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
description: DescriptionFieldSchema,
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
date: z.coerce.date(),
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
author: z.string().optional(),
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
tags: TagsFieldSchema,
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
version: z.string().optional(),
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
draft: DraftFieldSchema,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export type ChangelogEntry = z.infer<typeof changelogSchema>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from 'astro/zod';
|
|
2
|
+
|
|
3
|
+
export const BadgeConfigSchema = z
|
|
4
|
+
.union([
|
|
5
|
+
z.string(),
|
|
6
|
+
z.object({
|
|
7
|
+
variant: z
|
|
8
|
+
.enum(['note', 'tip', 'caution', 'danger', 'success', 'default'])
|
|
9
|
+
.default('default'),
|
|
10
|
+
text: z.string(),
|
|
11
|
+
class: z.string().optional(),
|
|
12
|
+
}),
|
|
13
|
+
])
|
|
14
|
+
.optional();
|
|
15
|
+
|
|
16
|
+
export const HeadConfigSchema = z
|
|
17
|
+
.array(
|
|
18
|
+
z.object({
|
|
19
|
+
tag: z.enum(['title', 'base', 'link', 'style', 'meta', 'script', 'noscript', 'template']),
|
|
20
|
+
attrs: z.record(z.string(), z.union([z.string(), z.boolean(), z.undefined()])).default({}),
|
|
21
|
+
content: z.string().default(''),
|
|
22
|
+
}),
|
|
23
|
+
)
|
|
24
|
+
.default([]);
|
|
25
|
+
|
|
26
|
+
export const FrontmatterTableOfContentsSchema = z
|
|
27
|
+
.union([
|
|
28
|
+
z.object({
|
|
29
|
+
minHeadingLevel: z.number().int().min(1).max(6).optional(),
|
|
30
|
+
maxHeadingLevel: z.number().int().min(1).max(6).optional(),
|
|
31
|
+
}),
|
|
32
|
+
z.literal(false),
|
|
33
|
+
])
|
|
34
|
+
.optional();
|
|
35
|
+
|
|
36
|
+
export const PrevNextLinkConfigSchema = z
|
|
37
|
+
.union([
|
|
38
|
+
z.boolean(),
|
|
39
|
+
z.string(),
|
|
40
|
+
z.object({
|
|
41
|
+
link: z.string().optional(),
|
|
42
|
+
label: z.string().optional(),
|
|
43
|
+
}),
|
|
44
|
+
])
|
|
45
|
+
.optional();
|
|
46
|
+
|
|
47
|
+
export const HeroSchema = z
|
|
48
|
+
.object({
|
|
49
|
+
title: z.string().optional(),
|
|
50
|
+
tagline: z.string().optional(),
|
|
51
|
+
image: z
|
|
52
|
+
.union([
|
|
53
|
+
z.object({
|
|
54
|
+
alt: z.string(),
|
|
55
|
+
file: z.string(),
|
|
56
|
+
}),
|
|
57
|
+
z.object({
|
|
58
|
+
alt: z.string(),
|
|
59
|
+
dark: z.string(),
|
|
60
|
+
light: z.string(),
|
|
61
|
+
}),
|
|
62
|
+
z.object({
|
|
63
|
+
html: z.string(),
|
|
64
|
+
}),
|
|
65
|
+
])
|
|
66
|
+
.optional(),
|
|
67
|
+
actions: z
|
|
68
|
+
.array(
|
|
69
|
+
z.object({
|
|
70
|
+
text: z.string(),
|
|
71
|
+
link: z.string(),
|
|
72
|
+
variant: z.enum(['primary', 'secondary', 'minimal']).default('primary'),
|
|
73
|
+
icon: z.string().optional(),
|
|
74
|
+
}),
|
|
75
|
+
)
|
|
76
|
+
.default([]),
|
|
77
|
+
})
|
|
78
|
+
.optional();
|
|
79
|
+
|
|
80
|
+
export const SidebarLinkAttrsSchema = z
|
|
81
|
+
.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.undefined()]))
|
|
82
|
+
.default({});
|
|
83
|
+
|
|
84
|
+
export const DescriptionFieldSchema = z.string().optional();
|
|
85
|
+
|
|
86
|
+
export const TagsFieldSchema = z.array(z.string()).optional();
|
|
87
|
+
|
|
88
|
+
export const DraftFieldSchema = z.boolean().default(false);
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { z } from 'astro/zod';
|
|
2
|
+
import {
|
|
3
|
+
BadgeConfigSchema,
|
|
4
|
+
DescriptionFieldSchema,
|
|
5
|
+
DraftFieldSchema,
|
|
6
|
+
FrontmatterTableOfContentsSchema,
|
|
7
|
+
HeadConfigSchema,
|
|
8
|
+
HeroSchema,
|
|
9
|
+
PrevNextLinkConfigSchema,
|
|
10
|
+
SidebarLinkAttrsSchema,
|
|
11
|
+
TagsFieldSchema,
|
|
12
|
+
} from './common.ts';
|
|
13
|
+
|
|
14
|
+
type BaseSchema = z.ZodTypeAny;
|
|
15
|
+
|
|
16
|
+
const PublierDocsFrontmatterSchema = () =>
|
|
17
|
+
z.object({
|
|
18
|
+
|
|
19
|
+
title: z.string(),
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
description: DescriptionFieldSchema,
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
head: HeadConfigSchema,
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
tableOfContents: FrontmatterTableOfContentsSchema,
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
layout: z.enum(['doc', 'splash']).default('doc'),
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
hero: HeroSchema,
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
lastUpdated: z.union([z.date(), z.boolean()]).optional(),
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
prev: PrevNextLinkConfigSchema,
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
next: PrevNextLinkConfigSchema,
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
sidebar: z
|
|
47
|
+
.object({
|
|
48
|
+
|
|
49
|
+
order: z.number().optional(),
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
label: z.string().optional(),
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
hidden: z.boolean().default(false),
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
badge: BadgeConfigSchema,
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
attrs: SidebarLinkAttrsSchema,
|
|
62
|
+
})
|
|
63
|
+
.optional(),
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
banner: z
|
|
67
|
+
.object({
|
|
68
|
+
content: z.string(),
|
|
69
|
+
})
|
|
70
|
+
.optional(),
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
draft: DraftFieldSchema,
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
tags: TagsFieldSchema,
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
order: z.number().optional(),
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
type DefaultSchema = ReturnType<typeof PublierDocsFrontmatterSchema>;
|
|
85
|
+
|
|
86
|
+
type ExtendedSchema<T extends BaseSchema = never> = [T] extends [never]
|
|
87
|
+
? DefaultSchema
|
|
88
|
+
: T extends BaseSchema
|
|
89
|
+
? z.ZodIntersection<DefaultSchema, T>
|
|
90
|
+
: DefaultSchema;
|
|
91
|
+
|
|
92
|
+
interface DocsSchemaOpts<T extends BaseSchema> {
|
|
93
|
+
|
|
94
|
+
extend?: T;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function docsSchema<T extends BaseSchema = never>(
|
|
98
|
+
opts?: DocsSchemaOpts<T>,
|
|
99
|
+
): ExtendedSchema<T> {
|
|
100
|
+
const base = PublierDocsFrontmatterSchema();
|
|
101
|
+
return (opts?.extend ? base.and(opts.extend) : base) as ExtendedSchema<T>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type DocsFrontmatter = z.infer<DefaultSchema>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export { type BlogEntry, blogSchema } from './blog.ts';
|
|
4
|
+
export { type ChangelogEntry, changelogSchema } from './changelog.ts';
|
|
5
|
+
export {
|
|
6
|
+
BadgeConfigSchema,
|
|
7
|
+
FrontmatterTableOfContentsSchema,
|
|
8
|
+
HeadConfigSchema,
|
|
9
|
+
HeroSchema,
|
|
10
|
+
PrevNextLinkConfigSchema,
|
|
11
|
+
SidebarLinkAttrsSchema,
|
|
12
|
+
} from './common.ts';
|
|
13
|
+
export { type DocsFrontmatter, docsSchema } from './docs.ts';
|
|
14
|
+
export { type PageEntry, pagesSchema } from './pages.ts';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { z } from 'astro/zod';
|
|
4
|
+
import { DescriptionFieldSchema, DraftFieldSchema } from './common.ts';
|
|
5
|
+
|
|
6
|
+
export const pagesSchema = z.object({
|
|
7
|
+
|
|
8
|
+
title: z.string(),
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
description: DescriptionFieldSchema,
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
image: z.string().optional(),
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
imageAlt: z.string().optional(),
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
draft: DraftFieldSchema,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type PageEntry = z.infer<typeof pagesSchema>;
|