@publier/shell 2.1.1
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/index-DWtFsw7E.d.mts +1033 -0
- package/dist/index.d.mts +33 -0
- package/dist/index.mjs +1 -0
- package/dist/integration-BIJIcnAT.mjs +99 -0
- package/dist/integration-CKjtSkwa.d.mts +183 -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-C7z73xlB.d.mts +16 -0
- package/dist/presets-DL0qjtya.mjs +1 -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 +29 -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 +189 -0
- package/publier-gate +0 -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 +155 -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 +510 -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 +246 -0
- package/src/icons/resolve.tsx +45 -0
- package/src/layouts/base-layout.astro +63 -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 +37 -0
- package/src/schemas/changelog.ts +28 -0
- package/src/schemas/common.ts +82 -0
- package/src/schemas/docs.ts +101 -0
- package/src/schemas/index.ts +14 -0
- package/src/schemas/pages.ts +22 -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,155 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export { getIconDef, ICON_DEFS, type IconDef, type IconName } from '../icons/index';
|
|
4
|
+
export { resolveIcon } from '../icons/resolve';
|
|
5
|
+
export {
|
|
6
|
+
BANNER_DEFAULT_STORAGE_KEY,
|
|
7
|
+
buildBannerInitScript,
|
|
8
|
+
} from '../runtime/banner-init.ts';
|
|
9
|
+
export { LAZY_UPGRADE_SCRIPT } from '../runtime/lazy-upgrade-init.ts';
|
|
10
|
+
export { SIDEBAR_SCROLL_STORAGE_KEY } from '../runtime/sidebar-scroll-init.ts';
|
|
11
|
+
export {
|
|
12
|
+
type AppearanceOptions,
|
|
13
|
+
buildThemeInitScript,
|
|
14
|
+
THEME_INIT_SCRIPT,
|
|
15
|
+
} from '../runtime/theme-init.ts';
|
|
16
|
+
export { default as AnnouncementBanner } from './announcement-banner.astro';
|
|
17
|
+
export { default as Aside } from './aside.astro';
|
|
18
|
+
export { default as Badge } from './badge.astro';
|
|
19
|
+
export { default as Breadcrumbs } from './breadcrumbs.astro';
|
|
20
|
+
export { default as Caution } from './callouts/caution.astro';
|
|
21
|
+
export { default as Check } from './callouts/check.astro';
|
|
22
|
+
export { default as Danger } from './callouts/danger.astro';
|
|
23
|
+
export { default as Info } from './callouts/info.astro';
|
|
24
|
+
export { default as Note } from './callouts/note.astro';
|
|
25
|
+
export { default as Tip } from './callouts/tip.astro';
|
|
26
|
+
export { default as Warning } from './callouts/warning.astro';
|
|
27
|
+
export { default as Card } from './card.astro';
|
|
28
|
+
export { default as CardGrid } from './card-grid.astro';
|
|
29
|
+
export { default as CodeGroup } from './code-group.astro';
|
|
30
|
+
export { default as Columns } from './columns.astro';
|
|
31
|
+
export { default as DocsLayout } from './docs-layout.astro';
|
|
32
|
+
export { default as FileTree } from './file-tree.astro';
|
|
33
|
+
export { default as Icon } from './icon.astro';
|
|
34
|
+
export { default as LastModified } from './LastModified.astro';
|
|
35
|
+
export { default as LinkButton } from './link-button.astro';
|
|
36
|
+
export { default as LinkCard } from './link-card.astro';
|
|
37
|
+
export { default as OpenInAI } from './open-in-ai.astro';
|
|
38
|
+
export { default as PackageInstall } from './package-install.astro';
|
|
39
|
+
export { default as Panels } from './panels.astro';
|
|
40
|
+
export { default as SearchButton } from './search-button.astro';
|
|
41
|
+
export { default as Sidebar } from './sidebar.astro';
|
|
42
|
+
export { default as SkipLink } from './skip-link.astro';
|
|
43
|
+
export { default as Steps } from './steps.astro';
|
|
44
|
+
export { default as TableOfContents } from './table-of-contents.astro';
|
|
45
|
+
export { default as Tabs } from './tabs.astro';
|
|
46
|
+
export { THEME_STORAGE_KEY, type Theme } from './theme-storage.ts';
|
|
47
|
+
export { default as ThemeToggle } from './theme-toggle.astro';
|
|
48
|
+
export { default as Tile } from './tile.astro';
|
|
49
|
+
export { default as TileGrid } from './tile-grid.astro';
|
|
50
|
+
export { default as TopNav } from './top-nav.astro';
|
|
51
|
+
export { default as TopNavMobile } from './top-nav-mobile.astro';
|
|
52
|
+
|
|
53
|
+
export type {
|
|
54
|
+
AnnouncementBannerProps,
|
|
55
|
+
AnnouncementBannerVariant,
|
|
56
|
+
AsideProps,
|
|
57
|
+
AsideType,
|
|
58
|
+
BadgeProps,
|
|
59
|
+
BadgeSize,
|
|
60
|
+
BadgeVariant,
|
|
61
|
+
BreadcrumbItem,
|
|
62
|
+
BreadcrumbsProps,
|
|
63
|
+
CalloutProps,
|
|
64
|
+
CardGridProps,
|
|
65
|
+
CardProps,
|
|
66
|
+
CardVariant,
|
|
67
|
+
CodeGroupItem,
|
|
68
|
+
CodeGroupProps,
|
|
69
|
+
ColumnCount,
|
|
70
|
+
ColumnGap,
|
|
71
|
+
ColumnsProps,
|
|
72
|
+
DocsLayoutProps,
|
|
73
|
+
DocVersion,
|
|
74
|
+
FileTreeDirectory,
|
|
75
|
+
FileTreeEntry,
|
|
76
|
+
FileTreeFile,
|
|
77
|
+
FileTreePlaceholder,
|
|
78
|
+
FileTreeProps,
|
|
79
|
+
IconProps,
|
|
80
|
+
LinkButtonIconPlacement,
|
|
81
|
+
LinkButtonProps,
|
|
82
|
+
LinkButtonVariant,
|
|
83
|
+
LinkCardProps,
|
|
84
|
+
OpenInAIProps,
|
|
85
|
+
PackageInstallProps,
|
|
86
|
+
PanelsProps,
|
|
87
|
+
PanelVariant,
|
|
88
|
+
SidebarAnchor,
|
|
89
|
+
SidebarEntry,
|
|
90
|
+
SidebarGroupEntry,
|
|
91
|
+
SidebarLink,
|
|
92
|
+
SidebarProps,
|
|
93
|
+
SidebarSection,
|
|
94
|
+
SkipLinkProps,
|
|
95
|
+
StepsProps,
|
|
96
|
+
TableOfContentsProps,
|
|
97
|
+
TileGridProps,
|
|
98
|
+
TileProps,
|
|
99
|
+
TocHeading,
|
|
100
|
+
TopNavMobileProps,
|
|
101
|
+
TopNavProps,
|
|
102
|
+
UpdateBadgeProps,
|
|
103
|
+
UpdateBadgeType,
|
|
104
|
+
VersionSwitcherProps,
|
|
105
|
+
} from './types.ts';
|
|
106
|
+
|
|
107
|
+
export { default as BlurImage } from './ui/blur-image.astro';
|
|
108
|
+
export { default as ChangelogEntry } from './ui/changelog-entry.astro';
|
|
109
|
+
export { default as CtaBand } from './ui/cta-band.astro';
|
|
110
|
+
export { default as FeatureGrid } from './ui/feature-grid.astro';
|
|
111
|
+
export { default as FeatureSection } from './ui/feature-section.astro';
|
|
112
|
+
export { default as Frame } from './ui/frame.astro';
|
|
113
|
+
export { default as Hero } from './ui/hero.astro';
|
|
114
|
+
export { default as JobsList } from './ui/jobs-list.astro';
|
|
115
|
+
export { default as LogoCloud } from './ui/logo-cloud.astro';
|
|
116
|
+
export { default as PressGallery } from './ui/press-gallery.astro';
|
|
117
|
+
export { default as PricingComparisonTable } from './ui/pricing-comparison-table.astro';
|
|
118
|
+
export { default as PricingSection } from './ui/pricing-section.astro';
|
|
119
|
+
export { default as PricingTable } from './ui/pricing-table.astro';
|
|
120
|
+
export { default as StatusIndicator } from './ui/status-indicator.astro';
|
|
121
|
+
export { default as TeamGrid } from './ui/team-grid.astro';
|
|
122
|
+
export { default as TestimonialCard } from './ui/testimonial-card.astro';
|
|
123
|
+
|
|
124
|
+
export type {
|
|
125
|
+
BillingPeriod,
|
|
126
|
+
BlurImageProps,
|
|
127
|
+
ChangelogEntryProps,
|
|
128
|
+
ChangelogEntryType,
|
|
129
|
+
CtaBandProps,
|
|
130
|
+
FeatureGridItem,
|
|
131
|
+
FeatureGridProps,
|
|
132
|
+
FeatureSectionProps,
|
|
133
|
+
FrameProps,
|
|
134
|
+
HeroProps,
|
|
135
|
+
JobsListItem,
|
|
136
|
+
JobsListProps,
|
|
137
|
+
LogoCloudItem,
|
|
138
|
+
LogoCloudProps,
|
|
139
|
+
PressGalleryItem,
|
|
140
|
+
PressGalleryProps,
|
|
141
|
+
PricingCellValue,
|
|
142
|
+
PricingComparisonCategory,
|
|
143
|
+
PricingComparisonRow,
|
|
144
|
+
PricingComparisonTableProps,
|
|
145
|
+
PricingSectionProps,
|
|
146
|
+
PricingTableProps,
|
|
147
|
+
PricingTier,
|
|
148
|
+
StatusIndicatorProps,
|
|
149
|
+
StatusLevel,
|
|
150
|
+
TeamGridMember,
|
|
151
|
+
TeamGridProps,
|
|
152
|
+
TestimonialCardProps,
|
|
153
|
+
} from './ui/types.ts';
|
|
154
|
+
export { default as UpdateBadge } from './update-badge.astro';
|
|
155
|
+
export { default as VersionSwitcher } from './version-switcher.astro';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderLinkButton } from '@publier/native';
|
|
3
|
+
|
|
4
|
+
export type LinkButtonVariant = 'primary' | 'secondary' | 'minimal';
|
|
5
|
+
export type LinkButtonIconPlacement = 'start' | 'end';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
href: string;
|
|
9
|
+
variant?: LinkButtonVariant;
|
|
10
|
+
iconPlacement?: LinkButtonIconPlacement;
|
|
11
|
+
rel?: string;
|
|
12
|
+
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
13
|
+
class?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const { href, variant = 'primary', iconPlacement = 'end', rel, target, class: customClass } = Astro.props;
|
|
17
|
+
const slotHtml = await Astro.slots.render('default');
|
|
18
|
+
const html = shellRenderLinkButton(href, variant, iconPlacement, rel ?? null, target ?? null, customClass ?? null, slotHtml);
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<Fragment set:html={html} />
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderLinkCard } from '@publier/native';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
title: string;
|
|
6
|
+
href: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
rel?: string;
|
|
9
|
+
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const p = Astro.props;
|
|
14
|
+
|
|
15
|
+
const isOutbound = /^https?:\/\//i.test(p.href);
|
|
16
|
+
const target = p.target ?? (isOutbound ? '_blank' : null);
|
|
17
|
+
const rel = p.rel ?? (isOutbound ? 'noopener noreferrer' : null);
|
|
18
|
+
const html = shellRenderLinkCard(p.title, p.href, p.description ?? null, rel, target, p.class ?? null);
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<Fragment set:html={html} />
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderOpenInAi } from '@publier/native';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
pageUrl?: string;
|
|
6
|
+
pageTitle?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { pageUrl = '', pageTitle = '' } = Astro.props;
|
|
10
|
+
const html = shellRenderOpenInAi(pageUrl, pageTitle);
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<Fragment set:html={html} />
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderPackageInstall } from '@publier/native';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
pkg?: string;
|
|
6
|
+
type?: 'prod' | 'dev' | 'exec';
|
|
7
|
+
command?: string;
|
|
8
|
+
syncKey?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { pkg, type, command, syncKey } = Astro.props;
|
|
12
|
+
const id = `publier-tabs-${Math.random().toString(36).slice(2, 10)}`;
|
|
13
|
+
const html = shellRenderPackageInstall(
|
|
14
|
+
JSON.stringify({ type, pkg, command, syncKey, id }),
|
|
15
|
+
);
|
|
16
|
+
---
|
|
17
|
+
<Fragment set:html={html} />
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderPanels } from '@publier/native';
|
|
3
|
+
|
|
4
|
+
export type PanelVariant = 'default' | 'outlined' | 'filled';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
title?: string;
|
|
8
|
+
variant?: PanelVariant;
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { title, variant = 'default', class: customClass } = Astro.props;
|
|
13
|
+
const slotHtml = await Astro.slots.render('default');
|
|
14
|
+
const html = shellRenderPanels(JSON.stringify({ title, variant, customClass, slotHtml }));
|
|
15
|
+
---
|
|
16
|
+
<Fragment set:html={html} />
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderSearchButton } from '@publier/native';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
label?: string;
|
|
6
|
+
shortcut?: string;
|
|
7
|
+
'aria-label'?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
label,
|
|
13
|
+
shortcut,
|
|
14
|
+
'aria-label': ariaLabel,
|
|
15
|
+
class: customClass,
|
|
16
|
+
} = Astro.props;
|
|
17
|
+
const html = shellRenderSearchButton(
|
|
18
|
+
JSON.stringify({ label, shortcut, ariaLabel, customClass }),
|
|
19
|
+
);
|
|
20
|
+
---
|
|
21
|
+
<Fragment set:html={html} />
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderSidebar } from '@publier/native';
|
|
3
|
+
import VersionSwitcher from './version-switcher.astro';
|
|
4
|
+
import type { SidebarProps } from './types.ts';
|
|
5
|
+
|
|
6
|
+
const { items, currentPath = '', label = 'Primary', class: customClass, versions, anchors, scope } = Astro.props as SidebarProps;
|
|
7
|
+
const hasVersions = Array.isArray(versions) && versions.length > 0;
|
|
8
|
+
const [prefix, suffix] = shellRenderSidebar(
|
|
9
|
+
JSON.stringify({ items, currentPath, label, customClass, scope, anchors: anchors ?? [] }),
|
|
10
|
+
).split('<!--publier-sidebar-vs-slot-->');
|
|
11
|
+
---
|
|
12
|
+
<Fragment set:html={prefix} />{hasVersions && <div class="px-2"><VersionSwitcher versions={versions!} currentPath={currentPath} /></div>}<Fragment set:html={suffix} />
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderSkipLink } from '@publier/native';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
targetId?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { targetId = 'publier-main', label = 'Skip to content' } = Astro.props;
|
|
10
|
+
const html = shellRenderSkipLink(JSON.stringify({ targetId, label }));
|
|
11
|
+
---
|
|
12
|
+
<Fragment set:html={html} />
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderSteps } from '@publier/native';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
start?: number;
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { start, class: customClass } = Astro.props;
|
|
10
|
+
const slotHtml = await Astro.slots.render('default');
|
|
11
|
+
const html = shellRenderSteps(JSON.stringify({ start, customClass, slotHtml }));
|
|
12
|
+
---
|
|
13
|
+
<Fragment set:html={html} />
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderTableOfContents } from '@publier/native';
|
|
3
|
+
|
|
4
|
+
interface TocHeading {
|
|
5
|
+
slug: string;
|
|
6
|
+
text: string;
|
|
7
|
+
depth: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
headings: TocHeading[];
|
|
12
|
+
label?: string;
|
|
13
|
+
minDepth?: number;
|
|
14
|
+
class?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { headings, label, minDepth, class: customClass } = Astro.props;
|
|
18
|
+
const html = shellRenderTableOfContents(
|
|
19
|
+
JSON.stringify({ headings, label, minDepth, customClass }),
|
|
20
|
+
);
|
|
21
|
+
---
|
|
22
|
+
<Fragment set:html={html} />
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderTabs } from '@publier/native';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
labels: string[];
|
|
6
|
+
defaultIndex?: number;
|
|
7
|
+
syncKey?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { labels, defaultIndex = 0, syncKey, class: customClass } = Astro.props;
|
|
12
|
+
const id = `publier-tabs-${Math.random().toString(36).slice(2, 10)}`;
|
|
13
|
+
const slots = await Promise.all(labels.map((_l, i) => Astro.slots.render(`tab-${i}`)));
|
|
14
|
+
const html = shellRenderTabs(JSON.stringify(labels), JSON.stringify(slots), defaultIndex, syncKey ?? null, id, customClass ?? null);
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<Fragment set:html={html} />
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { THEME_STORAGE_KEY, type Theme } from './theme-storage.ts';
|
|
4
|
+
|
|
5
|
+
function parseMode(value: unknown): Theme {
|
|
6
|
+
return value === 'light' || value === 'dark' ? value : 'auto';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function nextMode(current: Theme): Theme {
|
|
10
|
+
return current === 'auto' ? 'light' : current === 'light' ? 'dark' : 'auto';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
class PublierThemeToggleElement extends HTMLElement {
|
|
14
|
+
#mq: MediaQueryList | null = null;
|
|
15
|
+
#onSystemChange: (() => void) | null = null;
|
|
16
|
+
#onClick: ((e: Event) => void) | null = null;
|
|
17
|
+
|
|
18
|
+
connectedCallback(): void {
|
|
19
|
+
const button = this.querySelector('button');
|
|
20
|
+
if (!button) return;
|
|
21
|
+
|
|
22
|
+
this.#onClick = (e) => {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
this.#cycle();
|
|
25
|
+
};
|
|
26
|
+
button.addEventListener('click', this.#onClick);
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
if ((this.dataset.defaultScheme ?? 'system') === 'system') {
|
|
32
|
+
this.#mq = window.matchMedia('(prefers-color-scheme: dark)');
|
|
33
|
+
this.#onSystemChange = () => {
|
|
34
|
+
if ((this.dataset.mode ?? 'auto') === 'auto') this.#applyTheme();
|
|
35
|
+
};
|
|
36
|
+
this.#mq.addEventListener('change', this.#onSystemChange);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
disconnectedCallback(): void {
|
|
41
|
+
const button = this.querySelector('button');
|
|
42
|
+
if (button && this.#onClick) button.removeEventListener('click', this.#onClick);
|
|
43
|
+
if (this.#mq && this.#onSystemChange) {
|
|
44
|
+
this.#mq.removeEventListener('change', this.#onSystemChange);
|
|
45
|
+
}
|
|
46
|
+
this.#mq = null;
|
|
47
|
+
this.#onSystemChange = null;
|
|
48
|
+
this.#onClick = null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#cycle(): void {
|
|
52
|
+
const current = parseMode(this.dataset.mode);
|
|
53
|
+
const next = nextMode(current);
|
|
54
|
+
try {
|
|
55
|
+
if (next === 'auto') localStorage.removeItem(THEME_STORAGE_KEY);
|
|
56
|
+
else localStorage.setItem(THEME_STORAGE_KEY, next);
|
|
57
|
+
} catch {
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
this.dataset.mode = next;
|
|
62
|
+
const label = this.dataset[`label${next.charAt(0).toUpperCase() + next.slice(1)}`];
|
|
63
|
+
const button = this.querySelector('button');
|
|
64
|
+
if (button && label) {
|
|
65
|
+
button.setAttribute('aria-label', label);
|
|
66
|
+
button.setAttribute('title', label);
|
|
67
|
+
}
|
|
68
|
+
this.#applyTheme();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
#applyTheme(): void {
|
|
72
|
+
const mode = parseMode(this.dataset.mode);
|
|
73
|
+
const defaultScheme = this.dataset.defaultScheme ?? 'system';
|
|
74
|
+
const systemDark =
|
|
75
|
+
typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
76
|
+
const autoDark = defaultScheme === 'dark' || (defaultScheme === 'system' && systemDark);
|
|
77
|
+
const isDark = mode === 'dark' || (mode === 'auto' && autoDark);
|
|
78
|
+
document.documentElement.classList.toggle('dark', isDark);
|
|
79
|
+
document.documentElement.dataset.theme = isDark ? 'dark' : 'light';
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (typeof customElements !== 'undefined' && !customElements.get('publier-theme-toggle')) {
|
|
84
|
+
customElements.define('publier-theme-toggle', PublierThemeToggleElement);
|
|
85
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderThemeToggle } from '@publier/native';
|
|
3
|
+
import type { Theme } from './theme-storage.ts';
|
|
4
|
+
|
|
5
|
+
export interface Props {
|
|
6
|
+
labels?: Partial<Record<Theme, string>>;
|
|
7
|
+
class?: string;
|
|
8
|
+
strict?: boolean;
|
|
9
|
+
default?: 'system' | 'light' | 'dark';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { labels = {}, class: customClass, strict = false, default: defaultScheme = 'system' } =
|
|
13
|
+
Astro.props;
|
|
14
|
+
const html = shellRenderThemeToggle(
|
|
15
|
+
JSON.stringify({
|
|
16
|
+
labelAuto: labels.auto,
|
|
17
|
+
labelLight: labels.light,
|
|
18
|
+
labelDark: labels.dark,
|
|
19
|
+
customClass,
|
|
20
|
+
strict,
|
|
21
|
+
defaultScheme,
|
|
22
|
+
}),
|
|
23
|
+
);
|
|
24
|
+
---
|
|
25
|
+
<Fragment set:html={html} />
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderTileGrid } from '@publier/native';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
minColumnWidth?: string;
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { minColumnWidth = '200px', class: customClass } = Astro.props;
|
|
10
|
+
const slotHtml = await Astro.slots.render('default');
|
|
11
|
+
const html = shellRenderTileGrid(JSON.stringify({ minColumnWidth, customClass, slotHtml }));
|
|
12
|
+
---
|
|
13
|
+
<Fragment set:html={html} />
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderTile } from '@publier/native';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
href?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { title, description, href, class: customClass } = Astro.props;
|
|
12
|
+
const iconSlotHtml = Astro.slots.has('icon') ? await Astro.slots.render('icon') : null;
|
|
13
|
+
const html = shellRenderTile(
|
|
14
|
+
JSON.stringify({ title, description, href, customClass, iconSlotHtml }),
|
|
15
|
+
);
|
|
16
|
+
---
|
|
17
|
+
<Fragment set:html={html} />
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderTopNavMobile } from '@publier/native';
|
|
3
|
+
import { navConfig, type NavVariant } from 'virtual:publier-nav-config';
|
|
4
|
+
import type { TopNavMobileProps } from './types.ts';
|
|
5
|
+
|
|
6
|
+
const EMPTY: NavVariant = { brand: '', logo: null, tabs: [], links: [], cta: null };
|
|
7
|
+
const { variant = 'default', currentPath = '' } = Astro.props as TopNavMobileProps;
|
|
8
|
+
const v = navConfig.variants[variant] ?? navConfig.variants.default ?? EMPTY;
|
|
9
|
+
const html = shellRenderTopNavMobile(JSON.stringify({ currentPath, v }));
|
|
10
|
+
---
|
|
11
|
+
<Fragment set:html={html} />
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { shellRenderTopNav } from '@publier/native';
|
|
3
|
+
import { navConfig, type NavVariant } from 'virtual:publier-nav-config';
|
|
4
|
+
import type { TopNavProps } from './types.ts';
|
|
5
|
+
|
|
6
|
+
const EMPTY: NavVariant = { brand: '', logo: null, tabs: [], links: [], cta: null };
|
|
7
|
+
const { variant = 'default', currentPath = '' } = Astro.props as TopNavProps;
|
|
8
|
+
const v = navConfig.variants[variant] ?? navConfig.variants.default ?? EMPTY;
|
|
9
|
+
const [searchSlotHtml, themeSlotHtml, mobileSlotHtml] = await Promise.all([
|
|
10
|
+
Astro.slots.has('search') ? Astro.slots.render('search') : Promise.resolve(null),
|
|
11
|
+
Astro.slots.has('theme') ? Astro.slots.render('theme') : Promise.resolve(null),
|
|
12
|
+
Astro.slots.has('mobile') ? Astro.slots.render('mobile') : Promise.resolve(null),
|
|
13
|
+
]);
|
|
14
|
+
const html = shellRenderTopNav(JSON.stringify({
|
|
15
|
+
variant, currentPath, v,
|
|
16
|
+
searchEnabled: navConfig.searchEnabled,
|
|
17
|
+
searchSlotHtml, themeSlotHtml, mobileSlotHtml,
|
|
18
|
+
}));
|
|
19
|
+
---
|
|
20
|
+
<Fragment set:html={html} />
|