@clarify-labs/templates 0.7.1 → 0.8.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.
@@ -1,6 +1,8 @@
1
1
  import { defineConfig } from '@clarify-labs/cli'
2
+ import demoSlotsPlugin from './source/plugins/index.js'
2
3
 
3
4
  export default defineConfig({
5
+ plugins: [demoSlotsPlugin],
4
6
  title: 'Clarify Docs',
5
7
  description: 'A full-featured documentation starter powered by Clarify.',
6
8
  logo: '/logo.svg',
@@ -0,0 +1,15 @@
1
+ import { useSlot } from 'virtual:clarify/slot'
2
+
3
+ export default function CustomBanner() {
4
+ const { locale, DefaultComponent } = useSlot()
5
+
6
+ return (
7
+ <div className="bg-gradient-to-r from-purple-600 to-indigo-600 text-white py-3">
8
+ <div className="max-w-7xl mx-auto px-4 text-center text-sm">
9
+ {locale === 'zh-CN'
10
+ ? '🎉 欢迎!这是自定义横幅。'
11
+ : '🎉 Welcome! This is a custom banner.'}
12
+ </div>
13
+ </div>
14
+ )
15
+ }
@@ -0,0 +1,22 @@
1
+ import { useSlot } from 'virtual:clarify/slot'
2
+
3
+ export default function CustomFooter() {
4
+ const { DefaultComponent, locale } = useSlot()
5
+
6
+ return (
7
+ <div className="py-8 border-t">
8
+ <div className="max-w-7xl mx-auto px-4">
9
+ <div className="text-center text-sm text-gray-600 dark:text-gray-400">
10
+ <p>
11
+ {locale === 'zh-CN' ? '这是自定义页脚,来自插件!' : 'This is a custom footer from a plugin!'}
12
+ </p>
13
+ </div>
14
+
15
+ {/* 也可以选择性地渲染默认页脚 */}
16
+ <div className="mt-4">
17
+ <DefaultComponent />
18
+ </div>
19
+ </div>
20
+ </div>
21
+ )
22
+ }
@@ -0,0 +1,13 @@
1
+ import { useSlot } from 'virtual:clarify/slot'
2
+
3
+ export default function FooterExtra() {
4
+ const { locale, plugin } = useSlot()
5
+
6
+ return (
7
+ <div className="py-2 text-center text-xs text-gray-500 dark:text-gray-400">
8
+ {locale === 'zh-CN'
9
+ ? `来自插件 "${plugin}" 的额外内容`
10
+ : `Extra content from plugin "${plugin}"`}
11
+ </div>
12
+ )
13
+ }
@@ -0,0 +1,22 @@
1
+ import type { ClarifyPlugin } from '@clarify-labs/cli'
2
+
3
+ const plugin: ClarifyPlugin = {
4
+ name: 'demo-slots-plugin',
5
+ hooks: {},
6
+ slots: [
7
+ {
8
+ name: 'page.banner.replace',
9
+ component: '/source/plugins/custom-banner.tsx'
10
+ },
11
+ {
12
+ name: 'page.footer.before',
13
+ component: '/source/plugins/footer-extra.tsx'
14
+ },
15
+ {
16
+ name: 'page.footer.replace',
17
+ component: '/source/plugins/custom-footer.tsx'
18
+ },
19
+ ],
20
+ }
21
+
22
+ export default plugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clarify-labs/templates",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "repository": {