create-ampless 0.2.0-alpha.8 → 1.0.0-alpha.100

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.
Files changed (140) hide show
  1. package/README.ja.md +77 -0
  2. package/README.md +6 -3
  3. package/dist/index.js +1282 -93
  4. package/dist/templates/_shared/AGENTS.ja.md +94 -0
  5. package/dist/templates/_shared/AGENTS.md +94 -0
  6. package/dist/templates/_shared/README.ja.md +239 -0
  7. package/dist/templates/_shared/README.md +239 -0
  8. package/dist/templates/_shared/RUNBOOK.ja.md +120 -0
  9. package/dist/templates/_shared/RUNBOOK.md +32 -58
  10. package/dist/templates/_shared/THEMES.ja.md +495 -0
  11. package/dist/templates/_shared/THEMES.md +523 -0
  12. package/dist/templates/_shared/amplify/auth/post-confirmation/resource.ts +7 -0
  13. package/dist/templates/_shared/amplify/backend.custom.ts +41 -0
  14. package/dist/templates/_shared/amplify/backend.ts +20 -2
  15. package/dist/templates/_shared/amplify/data/get-media-by-src.js +45 -0
  16. package/dist/templates/_shared/amplify/data/get-published-post.js +9 -12
  17. package/dist/templates/_shared/amplify/data/list-posts-by-tag.js +6 -9
  18. package/dist/templates/_shared/amplify/data/list-published-posts.js +10 -11
  19. package/dist/templates/_shared/amplify/data/resource.custom.ts +32 -0
  20. package/dist/templates/_shared/amplify/data/resource.ts +32 -15
  21. package/dist/templates/_shared/amplify/events/dispatcher/resource.ts +1 -0
  22. package/dist/templates/_shared/amplify/events/processor-trusted/resource.ts +1 -0
  23. package/dist/templates/_shared/amplify/events/processor-untrusted/resource.ts +5 -0
  24. package/dist/templates/_shared/amplify/functions/api-key-renewer/resource.ts +1 -0
  25. package/dist/templates/_shared/amplify/functions/mcp-handler/handler.ts +1 -0
  26. package/dist/templates/_shared/amplify/functions/mcp-handler/resource.ts +12 -0
  27. package/dist/templates/_shared/amplify/functions/plugin-secret-handler/handler.ts +11 -0
  28. package/dist/templates/_shared/amplify/functions/plugin-secret-handler/resource.ts +12 -0
  29. package/dist/templates/_shared/amplify/functions/user-admin/handler.ts +4 -0
  30. package/dist/templates/_shared/amplify/functions/user-admin/resource.ts +13 -0
  31. package/dist/templates/_shared/amplify/secrets/.gitkeep +0 -0
  32. package/dist/templates/_shared/amplify/secrets/encryption-key.ts +9 -0
  33. package/dist/templates/_shared/app/(admin)/admin/mcp-tokens/page.tsx +5 -0
  34. package/dist/templates/_shared/app/(admin)/admin/plugins/page.tsx +5 -0
  35. package/dist/templates/_shared/app/(admin)/admin/users/page.tsx +5 -0
  36. package/dist/templates/_shared/app/globals.css +55 -39
  37. package/dist/templates/_shared/app/layout.tsx +51 -16
  38. package/dist/templates/_shared/app/providers.tsx +0 -2
  39. package/dist/templates/_shared/app/raw/[slug]/route.ts +10 -0
  40. package/dist/templates/_shared/app/static/[slug]/[[...path]]/route.ts +14 -0
  41. package/dist/templates/_shared/cms.config.ts +64 -23
  42. package/dist/templates/_shared/components/site-chrome/site-sidebar.tsx +3 -4
  43. package/dist/templates/_shared/components/tag-list.tsx +9 -2
  44. package/dist/templates/_shared/components.json +1 -1
  45. package/dist/templates/_shared/docs/plugin-author-guide.ja.md +934 -0
  46. package/dist/templates/_shared/docs/plugin-author-guide.md +1336 -0
  47. package/dist/templates/_shared/lib/admin.ts +12 -12
  48. package/dist/templates/_shared/lib/ampless.ts +2 -8
  49. package/dist/templates/_shared/lib/amplify.ts +0 -5
  50. package/dist/templates/_shared/package.json +51 -40
  51. package/dist/templates/_shared/plugins/README.ja.md +139 -0
  52. package/dist/templates/_shared/plugins/README.md +143 -0
  53. package/dist/templates/_shared/proxy.ts +23 -8
  54. package/dist/templates/blog/README.ja.md +22 -0
  55. package/dist/templates/blog/README.md +17 -47
  56. package/dist/templates/blog/manifest.ts +1 -1
  57. package/dist/templates/blog/pages/feed.ts +4 -5
  58. package/dist/templates/blog/pages/home.tsx +10 -15
  59. package/dist/templates/blog/pages/post.tsx +42 -14
  60. package/dist/templates/blog/pages/sitemap.ts +4 -5
  61. package/dist/templates/blog/pages/tag.tsx +8 -10
  62. package/dist/templates/blog/tokens.css +26 -40
  63. package/dist/templates/corporate/README.ja.md +18 -0
  64. package/dist/templates/corporate/README.md +12 -14
  65. package/dist/templates/corporate/pages/feed.ts +3 -4
  66. package/dist/templates/corporate/pages/home.tsx +7 -12
  67. package/dist/templates/corporate/pages/post.tsx +20 -14
  68. package/dist/templates/corporate/pages/sitemap.ts +3 -4
  69. package/dist/templates/corporate/pages/tag.tsx +8 -10
  70. package/dist/templates/corporate/tokens.css +17 -39
  71. package/dist/templates/dads/README.ja.md +31 -0
  72. package/dist/templates/dads/README.md +13 -17
  73. package/dist/templates/dads/pages/feed.ts +3 -4
  74. package/dist/templates/dads/pages/home.tsx +7 -12
  75. package/dist/templates/dads/pages/post.tsx +20 -14
  76. package/dist/templates/dads/pages/sitemap.ts +3 -4
  77. package/dist/templates/dads/pages/tag.tsx +8 -10
  78. package/dist/templates/dads/tokens.css +22 -42
  79. package/dist/templates/docs/README.ja.md +24 -0
  80. package/dist/templates/docs/README.md +10 -13
  81. package/dist/templates/docs/pages/feed.ts +3 -4
  82. package/dist/templates/docs/pages/home.tsx +6 -9
  83. package/dist/templates/docs/pages/post.tsx +19 -13
  84. package/dist/templates/docs/pages/sitemap.ts +3 -4
  85. package/dist/templates/docs/pages/tag.tsx +8 -10
  86. package/dist/templates/docs/tokens.css +17 -39
  87. package/dist/templates/landing/README.ja.md +20 -0
  88. package/dist/templates/landing/README.md +14 -19
  89. package/dist/templates/landing/pages/feed.ts +4 -5
  90. package/dist/templates/landing/pages/home.tsx +7 -12
  91. package/dist/templates/landing/pages/post.tsx +20 -14
  92. package/dist/templates/landing/pages/sitemap.ts +3 -4
  93. package/dist/templates/landing/pages/tag.tsx +8 -10
  94. package/dist/templates/landing/tokens.css +17 -39
  95. package/dist/templates/minimal/README.ja.md +14 -0
  96. package/dist/templates/minimal/README.md +9 -47
  97. package/dist/templates/minimal/pages/feed.ts +4 -5
  98. package/dist/templates/minimal/pages/home.tsx +6 -8
  99. package/dist/templates/minimal/pages/post.tsx +19 -12
  100. package/dist/templates/minimal/pages/sitemap.ts +4 -5
  101. package/dist/templates/minimal/pages/tag.tsx +7 -8
  102. package/dist/templates/minimal/tokens.css +17 -39
  103. package/dist/templates/plugin-local/README.md +34 -0
  104. package/dist/templates/plugin-local/index.ts +39 -0
  105. package/dist/templates/plugin-standalone/CHANGELOG.md +1 -0
  106. package/dist/templates/plugin-standalone/README.ja.md +43 -0
  107. package/dist/templates/plugin-standalone/README.md +43 -0
  108. package/dist/templates/plugin-standalone/package.json +47 -0
  109. package/dist/templates/plugin-standalone/src/index.test.ts +16 -0
  110. package/dist/templates/plugin-standalone/src/index.ts +29 -0
  111. package/dist/templates/plugin-standalone/tsconfig.json +16 -0
  112. package/dist/templates/plugin-standalone/tsup.config.ts +8 -0
  113. package/package.json +1 -1
  114. package/dist/templates/_shared/app/(admin)/admin/sites/page.tsx +0 -5
  115. package/dist/templates/_shared/app/site/[siteId]/raw/[slug]/route.ts +0 -5
  116. package/dist/templates/_shared/components/i18n-provider.tsx +0 -15
  117. package/dist/templates/_shared/lib/admin-site-client.ts +0 -10
  118. package/dist/templates/_shared/lib/admin-site.ts +0 -12
  119. package/dist/templates/_shared/lib/amplify-server.ts +0 -7
  120. package/dist/templates/_shared/lib/auth-server.ts +0 -15
  121. package/dist/templates/_shared/lib/cn.ts +0 -5
  122. package/dist/templates/_shared/lib/i18n.ts +0 -35
  123. package/dist/templates/_shared/lib/kv-provider.ts +0 -7
  124. package/dist/templates/_shared/lib/media.ts +0 -6
  125. package/dist/templates/_shared/lib/posts-provider.ts +0 -7
  126. package/dist/templates/_shared/lib/posts-public.ts +0 -27
  127. package/dist/templates/_shared/lib/posts.ts +0 -12
  128. package/dist/templates/_shared/lib/seo.ts +0 -11
  129. package/dist/templates/_shared/lib/site-settings.ts +0 -11
  130. package/dist/templates/_shared/lib/storage.ts +0 -10
  131. package/dist/templates/_shared/lib/theme-actions.ts +0 -5
  132. package/dist/templates/_shared/lib/theme-active.ts +0 -10
  133. package/dist/templates/_shared/lib/theme-config.ts +0 -12
  134. package/dist/templates/_shared/lib/upload.ts +0 -6
  135. /package/dist/templates/_shared/app/{site/[siteId]/[slug] → [slug]}/page.tsx +0 -0
  136. /package/dist/templates/_shared/app/{site/[siteId]/feed.xml → feed.xml}/route.ts +0 -0
  137. /package/dist/templates/_shared/app/{site/[siteId]/og → og}/[slug]/route.ts +0 -0
  138. /package/dist/templates/_shared/app/{site/[siteId]/page.tsx → page.tsx} +0 -0
  139. /package/dist/templates/_shared/app/{site/[siteId]/sitemap.xml → sitemap.xml}/route.ts +0 -0
  140. /package/dist/templates/_shared/app/{site/[siteId]/tag → tag}/[tag]/page.tsx +0 -0
@@ -1,6 +1,8 @@
1
- # {{siteName}}
1
+ > 日本語版: [README.ja.md](./README.ja.md)
2
+ >
3
+ # DADS theme
2
4
 
3
- DADS theme built on the official **[Digital Agency Design System Tailwind plugin](https://github.com/digital-go-jp/tailwind-theme-plugin)** (`@digital-go-jp/tailwind-theme-plugin`, MIT). Color palette and typography conform to DADS specifications, suitable for Japanese government / public-sector / institutional sites.
5
+ Government / public-sector layout following the Digital Agency Design System aesthetic. High contrast, accessibility-first, minimal decoration. Built on the official **[Digital Agency Design System Tailwind plugin](https://github.com/digital-go-jp/tailwind-theme-plugin)** (`@digital-go-jp/tailwind-theme-plugin`, MIT).
4
6
 
5
7
  ## What's plugin-backed
6
8
 
@@ -8,28 +10,22 @@ DADS theme — built on the official **[Digital Agency Design System Tailwind pl
8
10
  - **Typography** — `fontFamily.sans` set to Noto Sans JP via the plugin; surfaced through `--ampless-body-font`
9
11
  - **Border radii** — `rounded-4` / `rounded-6` available
10
12
 
11
- `templates/dads/tokens.css` binds the plugin's CSS variables (`--color-blue-900` etc.) to ampless's standard theme variables (`--primary`, `--background`, ...) so all shared chrome (SiteHeader, SiteFooter, shadcn buttons, etc.) automatically renders in DADS colors.
13
+ `tokens.css` binds the plugin's CSS variables (`--color-blue-900` etc.) to the standard ampless theme variables (`--primary`, `--background`, ...) so all shared chrome (SiteHeader, SiteFooter, shadcn buttons, etc.) automatically renders in DADS colors.
12
14
 
13
- When DADS publishes a new palette version, bumping `@digital-go-jp/tailwind-theme-plugin` in `package.json` is enough — the theme picks it up.
15
+ When DADS publishes a new palette version, bumping `@digital-go-jp/tailwind-theme-plugin` is enough — the theme picks it up.
14
16
 
15
17
  ## Customizing
16
18
 
17
19
  In `/admin/sites/<siteId>/theme`:
18
20
 
19
- - **Logo image URL** — branding (organization mark)
20
- - **Primary color** — defaults to DADS solidBlue. Changing to a non-DADS color makes the site no longer DADS-conformant.
21
- - **Top story slug** — feature one published post between hero and news
22
- - **Header navigation / Footer links / Footer legend**
21
+ - **Logo image URL** — organization mark
22
+ - **Primary color** — defaults to DADS `solidBlue`. Changing to a non-DADS color makes the site no longer DADS-conformant.
23
+ - **Top story slug** — feature one published post between the hero and the news section
24
+ - **Header navigation** label + URL pairs
25
+ - **Footer links** — label + URL pairs
26
+ - **Footer legend** — address / agency info / extra small print
23
27
 
24
28
  ## Notes
25
29
 
26
- - Dark mode uses an inverted approximation. DADS doesn't ship an official dark palette as of plugin 0.3.4; when one lands, update `templates/dads/tokens.css` to bind the dark variables.
30
+ - Dark mode uses an inverted approximation. DADS doesn't ship an official dark palette as of plugin 0.3.4; when one lands, update `tokens.css` to bind the dark variables.
27
31
  - The plugin only provides design tokens. For full DADS components (buttons, alerts, tabs, etc.), see [design-system-example-components](https://github.com/digital-go-jp/design-system-example-components) and adapt as needed.
28
-
29
- ## Getting started
30
-
31
- ```bash
32
- npm install
33
- npx ampx sandbox
34
- npm run dev
35
- ```
@@ -1,12 +1,11 @@
1
- import { publicAssetUrl } from '@/lib/storage'
1
+ import { ampless } from '@/lib/ampless'
2
2
 
3
3
  interface Ctx {
4
- siteId: string
5
4
  request: Request
6
5
  }
7
6
 
8
- export async function dadsFeedHandler({ siteId }: Ctx): Promise<Response> {
9
- const url = publicAssetUrl(`public/plugins/rss/${siteId}/feed.xml`)
7
+ export async function dadsFeedHandler(_ctx: Ctx): Promise<Response> {
8
+ const url = ampless.publicAssetUrl('public/plugins/rss/feed.xml')
10
9
  const upstream = await fetch(url, { cache: 'no-store' })
11
10
  if (!upstream.ok) {
12
11
  return new Response(
@@ -1,9 +1,7 @@
1
1
  import Link from 'next/link'
2
2
  import { formatDate, type ThemeRouteContext } from 'ampless'
3
- import { listPublishedPosts, getPublishedPost } from '@/lib/posts-public'
4
- import { loadSiteSettings } from '@/lib/site-settings'
5
- import { loadThemeConfig } from '@/lib/theme-config'
6
- import { renderBody } from '@/lib/posts'
3
+ import { renderBody } from '@ampless/runtime'
4
+ import { ampless } from '@/lib/ampless'
7
5
  import { SiteHeader } from '@/components/site-chrome/site-header'
8
6
  import { SiteFooter } from '@/components/site-chrome/site-footer'
9
7
 
@@ -11,18 +9,15 @@ import { SiteFooter } from '@/components/site-chrome/site-footer'
11
9
  // formal news list with prominent dates. Layout deliberately
12
10
  // understated — DADS leans on hierarchy and whitespace, not
13
11
  // decoration.
14
- export default async function DadsHome({ params }: ThemeRouteContext) {
15
- const { siteId } = await params
12
+ export default async function DadsHome(_: ThemeRouteContext) {
16
13
  const [settings, theme, postsResult] = await Promise.all([
17
- loadSiteSettings(siteId),
18
- loadThemeConfig(siteId),
19
- listPublishedPosts({ siteId, limit: 10 }),
14
+ ampless.loadSiteSettings(),
15
+ ampless.loadThemeConfig(),
16
+ ampless.listPublishedPosts({ limit: 10 }),
20
17
  ])
21
18
 
22
19
  const featuredSlug = theme.values.featuredSlug?.trim()
23
- const featured = featuredSlug
24
- ? await getPublishedPost(featuredSlug, { siteId })
25
- : null
20
+ const featured = featuredSlug ? await ampless.getPublishedPost(featuredSlug) : null
26
21
  const posts = featured
27
22
  ? postsResult.items.filter((p) => p.slug !== featured.slug)
28
23
  : postsResult.items
@@ -2,35 +2,35 @@ import type { Metadata } from 'next'
2
2
  import Link from 'next/link'
3
3
  import { notFound } from 'next/navigation'
4
4
  import { formatDate, type ThemeRouteContext } from 'ampless'
5
- import { renderBody } from '@/lib/posts'
5
+ import { renderBody } from '@ampless/runtime'
6
+ import { ampless } from '@/lib/ampless'
7
+ import { admin } from '@/lib/admin'
6
8
  import { LightboxBinder } from '@/components/lightbox-content'
7
9
  import { TagList } from '@/components/tag-list'
8
- import { postMetadata } from '@/lib/seo'
9
- import { loadSiteSettings } from '@/lib/site-settings'
10
- import { loadThemeConfig } from '@/lib/theme-config'
11
- import { getPublishedPost } from '@/lib/posts-public'
12
10
  import { SiteHeader } from '@/components/site-chrome/site-header'
13
11
  import { SiteFooter } from '@/components/site-chrome/site-footer'
14
- import { t } from '@/lib/i18n'
15
12
 
16
13
  type PostCtx = ThemeRouteContext<{ slug: string }>
17
14
 
18
15
  export async function generatePostMetadata({ params }: PostCtx): Promise<Metadata> {
19
- const { siteId, slug } = await params
20
- const post = await getPublishedPost(slug, { siteId })
16
+ const { slug } = await params
17
+ const post = await ampless.getPublishedPost(slug)
21
18
  if (!post) return {}
22
- return postMetadata(post, siteId)
19
+ return ampless.postMetadata(post)
23
20
  }
24
21
 
25
22
  export default async function DadsPost({ params }: PostCtx) {
26
- const { siteId, slug } = await params
23
+ const { slug } = await params
27
24
  const [post, settings, theme] = await Promise.all([
28
- getPublishedPost(slug, { siteId }),
29
- loadSiteSettings(siteId),
30
- loadThemeConfig(siteId),
25
+ ampless.getPublishedPost(slug),
26
+ ampless.loadSiteSettings(),
27
+ ampless.loadThemeConfig(),
31
28
  ])
32
29
  if (!post) notFound()
33
30
 
31
+ const postBody = await ampless.publicBodyForPost(post)
32
+ const html = await ampless.publicHtmlForPost(post)
33
+
34
34
  const defaultLightbox = settings.media.imageDisplay === 'lightbox'
35
35
  const maxWidth = settings.media.imageMaxWidth ?? '100%'
36
36
  const proseStyle: React.CSSProperties = {
@@ -54,7 +54,7 @@ export default async function DadsPost({ params }: PostCtx) {
54
54
  href="/"
55
55
  className="text-[var(--primary)] underline-offset-4 hover:underline"
56
56
  >
57
- {t('public.back')}
57
+ {admin.t('public.back')}
58
58
  </Link>
59
59
  </nav>
60
60
 
@@ -72,6 +72,10 @@ export default async function DadsPost({ params }: PostCtx) {
72
72
  )}
73
73
  </header>
74
74
 
75
+ {postBody}
76
+
77
+ {html.beforeContent}
78
+
75
79
  <div
76
80
  id="post-body"
77
81
  className="prose prose-neutral dark:prose-invert max-w-none [&_a]:text-[var(--primary)] [&_a]:underline-offset-4 [&_img]:max-w-[var(--ampless-img-max-width)] [&_img]:mx-auto"
@@ -79,6 +83,8 @@ export default async function DadsPost({ params }: PostCtx) {
79
83
  dangerouslySetInnerHTML={{ __html: renderBody(post) }}
80
84
  />
81
85
 
86
+ {html.afterContent}
87
+
82
88
  <TagList tags={post.tags} className="mt-10 border-t pt-6" />
83
89
  </article>
84
90
 
@@ -1,12 +1,11 @@
1
- import { publicAssetUrl } from '@/lib/storage'
1
+ import { ampless } from '@/lib/ampless'
2
2
 
3
3
  interface Ctx {
4
- siteId: string
5
4
  request: Request
6
5
  }
7
6
 
8
- export async function dadsSitemapHandler({ siteId }: Ctx): Promise<Response> {
9
- const url = publicAssetUrl(`public/plugins/seo/${siteId}/sitemap.xml`)
7
+ export async function dadsSitemapHandler(_ctx: Ctx): Promise<Response> {
8
+ const url = ampless.publicAssetUrl('public/plugins/seo/sitemap.xml')
10
9
  const upstream = await fetch(url, { cache: 'no-store' })
11
10
  if (!upstream.ok) {
12
11
  return new Response(
@@ -1,20 +1,18 @@
1
1
  import Link from 'next/link'
2
2
  import { notFound } from 'next/navigation'
3
3
  import { formatDate, type ThemeRouteContext } from 'ampless'
4
- import { listPostsByTag } from '@/lib/posts-public'
5
- import { loadSiteSettings } from '@/lib/site-settings'
6
- import { loadThemeConfig } from '@/lib/theme-config'
4
+ import { ampless } from '@/lib/ampless'
5
+ import { admin } from '@/lib/admin'
7
6
  import { SiteHeader } from '@/components/site-chrome/site-header'
8
7
  import { SiteFooter } from '@/components/site-chrome/site-footer'
9
- import { t } from '@/lib/i18n'
10
8
 
11
9
  export default async function DadsTag({ params }: ThemeRouteContext<{ tag: string }>) {
12
- const { siteId, tag } = await params
10
+ const { tag } = await params
13
11
  const decodedTag = decodeURIComponent(tag)
14
12
  const [{ items: posts }, settings, theme] = await Promise.all([
15
- listPostsByTag(decodedTag, { siteId, limit: 50 }),
16
- loadSiteSettings(siteId),
17
- loadThemeConfig(siteId),
13
+ ampless.listPostsByTag(decodedTag, { limit: 50 }),
14
+ ampless.loadSiteSettings(),
15
+ ampless.loadThemeConfig(),
18
16
  ])
19
17
  if (posts.length === 0) notFound()
20
18
 
@@ -36,12 +34,12 @@ export default async function DadsTag({ params }: ThemeRouteContext<{ tag: strin
36
34
  href="/"
37
35
  className="text-[var(--primary)] underline-offset-4 hover:underline"
38
36
  >
39
- {t('public.home')}
37
+ {admin.t('public.home')}
40
38
  </Link>
41
39
  </nav>
42
40
 
43
41
  <header className="mb-10">
44
- <p className="text-sm text-[var(--muted-foreground)]">{t('public.tagLabel')}</p>
42
+ <p className="text-sm text-[var(--muted-foreground)]">{admin.t('public.tagLabel')}</p>
45
43
  <h1 className="text-3xl font-bold tracking-tight">#{decodedTag}</h1>
46
44
  </header>
47
45
 
@@ -13,26 +13,31 @@
13
13
  * enough; we don't hardcode hex values here. The fallbacks after
14
14
  * each `var(...)` are the DADS values from version 0.3.4 in case
15
15
  * the plugin isn't loaded for some reason.
16
+ *
17
+ * Dark mode: DADS doesn't ship an official dark palette as of v0.3.4,
18
+ * so the D side of `light-dark()` here is an inverted approximation.
19
+ * When DADS adds a dark variant, bind the D arg to the corresponding
20
+ * plugin variables (e.g. `var(--color-blue-300)` for primary).
16
21
  */
17
22
 
18
23
  [data-theme='dads'] {
19
- --background: #ffffff;
20
- --foreground: #1a1a1c;
21
- --card: #ffffff;
22
- --card-foreground: #1a1a1c;
23
- --primary: var(--color-blue-900, #0017c1);
24
- --primary-foreground: #ffffff;
25
- --secondary: var(--color-blue-50, #e8f1fe);
26
- --secondary-foreground: var(--color-blue-900, #0017c1);
27
- --muted: #f5f5f5;
28
- --muted-foreground: #595959;
29
- --accent: var(--color-blue-50, #e8f1fe);
30
- --accent-foreground: var(--color-blue-900, #0017c1);
31
- --destructive: var(--color-red-900, #ce0000);
32
- --destructive-foreground: #ffffff;
33
- --border: #d9d9d9;
34
- --input: #d9d9d9;
35
- --ring: var(--color-blue-900, #0017c1);
24
+ --background: light-dark(#ffffff, #1a1a1c);
25
+ --foreground: light-dark(#1a1a1c, #f0f0f0);
26
+ --card: light-dark(#ffffff, #232327);
27
+ --card-foreground: light-dark(#1a1a1c, #f0f0f0);
28
+ --primary: light-dark(var(--color-blue-900, #0017c1), var(--color-blue-300, #9db7f9));
29
+ --primary-foreground: light-dark(#ffffff, #1a1a1c);
30
+ --secondary: light-dark(var(--color-blue-50, #e8f1fe), #2c2f3a);
31
+ --secondary-foreground: light-dark(var(--color-blue-900, #0017c1), #f0f0f0);
32
+ --muted: light-dark(#f5f5f5, #28282c);
33
+ --muted-foreground: light-dark(#595959, #b3b3b3);
34
+ --accent: light-dark(var(--color-blue-50, #e8f1fe), #2c2f3a);
35
+ --accent-foreground: light-dark(var(--color-blue-900, #0017c1), #f0f0f0);
36
+ --destructive: light-dark(var(--color-red-900, #ce0000), var(--color-red-700, #fa0000));
37
+ --destructive-foreground: light-dark(#ffffff, #ffffff);
38
+ --border: light-dark(#d9d9d9, #3a3a3f);
39
+ --input: light-dark(#d9d9d9, #3a3a3f);
40
+ --ring: light-dark(var(--color-blue-900, #0017c1), var(--color-blue-300, #9db7f9));
36
41
  --radius: 0.25rem;
37
42
  /* DADS recommends Noto Sans JP for body text. The plugin sets
38
43
  * fontFamily.sans to it; we surface that through our usual
@@ -40,28 +45,3 @@
40
45
  * up consistently. */
41
46
  --ampless-body-font: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
42
47
  }
43
-
44
- @media (prefers-color-scheme: dark) {
45
- [data-theme='dads'] {
46
- /* DADS doesn't ship an official dark palette as of v0.3.4; this
47
- * is an inverted approximation. When DADS adds a dark variant,
48
- * bind these to the corresponding plugin variables. */
49
- --background: #1a1a1c;
50
- --foreground: #f0f0f0;
51
- --card: #232327;
52
- --card-foreground: #f0f0f0;
53
- --primary: var(--color-blue-300, #9db7f9);
54
- --primary-foreground: #1a1a1c;
55
- --secondary: #2c2f3a;
56
- --secondary-foreground: #f0f0f0;
57
- --muted: #28282c;
58
- --muted-foreground: #b3b3b3;
59
- --accent: #2c2f3a;
60
- --accent-foreground: #f0f0f0;
61
- --destructive: var(--color-red-700, #fa0000);
62
- --destructive-foreground: #ffffff;
63
- --border: #3a3a3f;
64
- --input: #3a3a3f;
65
- --ring: var(--color-blue-300, #9db7f9);
66
- }
67
- }
@@ -0,0 +1,24 @@
1
+ > English: [README.md](./README.md)
2
+ >
3
+ # Docs テーマ
4
+
5
+ サイドバー主導のドキュメントレイアウト。サイドバー項目は通常のリンクに加え、**タグ駆動セクション**を組み合わせられます — `tag:<name>` 形式の項目を入れると、そのタグが付いた公開済み投稿の一覧に自動展開されます。タグでコンテンツを整理するだけでナビゲーションに自動反映されます。
6
+
7
+ ## カスタマイズ
8
+
9
+ `/admin/sites/<siteId>/theme` で設定:
10
+
11
+ - **プライマリカラー**
12
+ - **角丸**
13
+ - **コードフォント** — システム等幅 / JetBrains Mono
14
+ - **サイドバーナビ** — 各行は `ラベル` + `URL`。URL には以下を指定可能:
15
+ - パス(`/getting-started`)
16
+ - 外部 URL(`https://...`)
17
+ - タグ参照(`tag:tutorials`)→ 見出し + タグ付き投稿一覧として描画
18
+ - **ロゴ画像 URL**
19
+ - **ヘッダーナビ** — トップレベルのリンク
20
+ - **フッターリンク** — ラベル + URL のペア
21
+
22
+ ## 執筆のヒント
23
+
24
+ 投稿に `guide` タグを付けて、サイドバーに URL `tag:guide` の行を追加するだけ。新しい記事を公開しても手動でリンクを編集する必要はなく、サイドバーに自動で並びます。
@@ -1,27 +1,24 @@
1
- # {{siteName}}
1
+ > 日本語版: [README.ja.md](./README.ja.md)
2
+ >
3
+ # Docs theme
2
4
 
3
- Docs theme: sidebar-led documentation layout. The sidebar combines plain links with **tag-driven sections** — entering a URL like `tag:guide` in the sidebar nav field auto-expands to a list of every published post tagged "guide". Lets writers organize content by tag and have it appear in nav automatically.
5
+ Sidebar-led documentation layout. The sidebar combines plain links with **tag-driven sections** — a sidebar entry of the form `tag:<name>` auto-expands into a list of every published post with that tag. Lets writers organize content by tag and have it appear in nav automatically.
4
6
 
5
7
  ## Customizing
6
8
 
7
9
  In `/admin/sites/<siteId>/theme`:
8
10
 
11
+ - **Primary color**
12
+ - **Corner radius**
13
+ - **Code font** — System monospace / JetBrains Mono
9
14
  - **Sidebar navigation** — each row is `Label` + `URL`. The URL can be:
10
15
  - a path (`/getting-started`)
11
16
  - an external URL (`https://...`)
12
17
  - a tag reference (`tag:tutorials`) → renders as a heading + list of tagged posts
13
- - Header navigation (top-level links)
14
- - Code font (system mono / JetBrains Mono / etc.)
15
- - Primary color, corner radius
18
+ - **Logo image URL**
19
+ - **Header navigation** top-level links
20
+ - **Footer links** label + URL pairs
16
21
 
17
22
  ## Authoring tip
18
23
 
19
24
  Tag a post `guide` (in the post editor) and add a sidebar row with URL `tag:guide`. The sidebar will list that post automatically — no manual link editing every time you publish.
20
-
21
- ## Getting started
22
-
23
- ```bash
24
- npm install
25
- npx ampx sandbox
26
- npm run dev
27
- ```
@@ -1,12 +1,11 @@
1
- import { publicAssetUrl } from '@/lib/storage'
1
+ import { ampless } from '@/lib/ampless'
2
2
 
3
3
  interface Ctx {
4
- siteId: string
5
4
  request: Request
6
5
  }
7
6
 
8
- export async function docsFeedHandler({ siteId }: Ctx): Promise<Response> {
9
- const url = publicAssetUrl(`public/plugins/rss/${siteId}/feed.xml`)
7
+ export async function docsFeedHandler(_ctx: Ctx): Promise<Response> {
8
+ const url = ampless.publicAssetUrl('public/plugins/rss/feed.xml')
10
9
  const upstream = await fetch(url, { cache: 'no-store' })
11
10
  if (!upstream.ok) {
12
11
  return new Response(
@@ -1,8 +1,6 @@
1
1
  import Link from 'next/link'
2
2
  import { formatDate, type ThemeRouteContext } from 'ampless'
3
- import { listPublishedPosts } from '@/lib/posts-public'
4
- import { loadSiteSettings } from '@/lib/site-settings'
5
- import { loadThemeConfig } from '@/lib/theme-config'
3
+ import { ampless } from '@/lib/ampless'
6
4
  import { SiteHeader } from '@/components/site-chrome/site-header'
7
5
  import { SiteSidebar } from '@/components/site-chrome/site-sidebar'
8
6
  import { SiteFooter } from '@/components/site-chrome/site-footer'
@@ -11,12 +9,11 @@ import { CollapsibleSidebar } from '@/components/site-chrome/collapsible-sidebar
11
9
  // Docs home: sidebar nav on the left (with optional tag-driven
12
10
  // sections), latest posts list on the right. Acts as the docs landing
13
11
  // page until the user arranges static pages.
14
- export default async function DocsHome({ params }: ThemeRouteContext) {
15
- const { siteId } = await params
12
+ export default async function DocsHome(_: ThemeRouteContext) {
16
13
  const [settings, theme, postsResult] = await Promise.all([
17
- loadSiteSettings(siteId),
18
- loadThemeConfig(siteId),
19
- listPublishedPosts({ siteId, limit: 12 }),
14
+ ampless.loadSiteSettings(),
15
+ ampless.loadThemeConfig(),
16
+ ampless.listPublishedPosts({ limit: 12 }),
20
17
  ])
21
18
  const posts = postsResult.items
22
19
 
@@ -31,7 +28,7 @@ export default async function DocsHome({ params }: ThemeRouteContext) {
31
28
 
32
29
  <div className="mx-auto grid max-w-6xl gap-6 px-6 py-10 lg:grid-cols-[15rem_1fr] lg:gap-10">
33
30
  <CollapsibleSidebar className="lg:sticky lg:top-6 lg:self-start">
34
- <SiteSidebar links={theme.values.sidebarNav} siteId={siteId} />
31
+ <SiteSidebar links={theme.values.sidebarNav} />
35
32
  </CollapsibleSidebar>
36
33
 
37
34
  <main className="min-w-0">
@@ -2,13 +2,10 @@ import type { Metadata } from 'next'
2
2
  import Link from 'next/link'
3
3
  import { notFound } from 'next/navigation'
4
4
  import { formatDate, type ThemeRouteContext } from 'ampless'
5
- import { renderBody } from '@/lib/posts'
5
+ import { renderBody } from '@ampless/runtime'
6
+ import { ampless } from '@/lib/ampless'
6
7
  import { LightboxBinder } from '@/components/lightbox-content'
7
8
  import { TagList } from '@/components/tag-list'
8
- import { postMetadata } from '@/lib/seo'
9
- import { loadSiteSettings } from '@/lib/site-settings'
10
- import { loadThemeConfig } from '@/lib/theme-config'
11
- import { getPublishedPost } from '@/lib/posts-public'
12
9
  import { SiteHeader } from '@/components/site-chrome/site-header'
13
10
  import { SiteSidebar } from '@/components/site-chrome/site-sidebar'
14
11
  import { SiteFooter } from '@/components/site-chrome/site-footer'
@@ -17,24 +14,27 @@ import { CollapsibleSidebar } from '@/components/site-chrome/collapsible-sidebar
17
14
  type PostCtx = ThemeRouteContext<{ slug: string }>
18
15
 
19
16
  export async function generatePostMetadata({ params }: PostCtx): Promise<Metadata> {
20
- const { siteId, slug } = await params
21
- const post = await getPublishedPost(slug, { siteId })
17
+ const { slug } = await params
18
+ const post = await ampless.getPublishedPost(slug)
22
19
  if (!post) return {}
23
- return postMetadata(post, siteId)
20
+ return ampless.postMetadata(post)
24
21
  }
25
22
 
26
23
  // Docs post page: sidebar always visible while reading. The sidebar
27
24
  // re-uses theme.sidebarNav, so navigation context stays consistent
28
25
  // across the home page and individual articles.
29
26
  export default async function DocsPost({ params }: PostCtx) {
30
- const { siteId, slug } = await params
27
+ const { slug } = await params
31
28
  const [post, settings, theme] = await Promise.all([
32
- getPublishedPost(slug, { siteId }),
33
- loadSiteSettings(siteId),
34
- loadThemeConfig(siteId),
29
+ ampless.getPublishedPost(slug),
30
+ ampless.loadSiteSettings(),
31
+ ampless.loadThemeConfig(),
35
32
  ])
36
33
  if (!post) notFound()
37
34
 
35
+ const postBody = await ampless.publicBodyForPost(post)
36
+ const html = await ampless.publicHtmlForPost(post)
37
+
38
38
  const defaultLightbox = settings.media.imageDisplay === 'lightbox'
39
39
  const maxWidth = settings.media.imageMaxWidth ?? '100%'
40
40
  const proseStyle: React.CSSProperties = {
@@ -52,7 +52,7 @@ export default async function DocsPost({ params }: PostCtx) {
52
52
 
53
53
  <div className="mx-auto grid max-w-6xl gap-6 px-6 py-10 lg:grid-cols-[15rem_1fr] lg:gap-10">
54
54
  <CollapsibleSidebar className="lg:sticky lg:top-6 lg:self-start">
55
- <SiteSidebar links={theme.values.sidebarNav} siteId={siteId} />
55
+ <SiteSidebar links={theme.values.sidebarNav} />
56
56
  </CollapsibleSidebar>
57
57
 
58
58
  <main className="min-w-0">
@@ -69,6 +69,10 @@ export default async function DocsPost({ params }: PostCtx) {
69
69
  )}
70
70
  </header>
71
71
 
72
+ {postBody}
73
+
74
+ {html.beforeContent}
75
+
72
76
  <div
73
77
  id="post-body"
74
78
  className="prose prose-neutral dark:prose-invert max-w-none [&_img]:max-w-[var(--ampless-img-max-width)] [&_img]:mx-auto"
@@ -76,6 +80,8 @@ export default async function DocsPost({ params }: PostCtx) {
76
80
  dangerouslySetInnerHTML={{ __html: renderBody(post) }}
77
81
  />
78
82
 
83
+ {html.afterContent}
84
+
79
85
  <TagList tags={post.tags} className="mt-10 border-t pt-6" />
80
86
  </article>
81
87
  </main>
@@ -1,12 +1,11 @@
1
- import { publicAssetUrl } from '@/lib/storage'
1
+ import { ampless } from '@/lib/ampless'
2
2
 
3
3
  interface Ctx {
4
- siteId: string
5
4
  request: Request
6
5
  }
7
6
 
8
- export async function docsSitemapHandler({ siteId }: Ctx): Promise<Response> {
9
- const url = publicAssetUrl(`public/plugins/seo/${siteId}/sitemap.xml`)
7
+ export async function docsSitemapHandler(_ctx: Ctx): Promise<Response> {
8
+ const url = ampless.publicAssetUrl('public/plugins/seo/sitemap.xml')
10
9
  const upstream = await fetch(url, { cache: 'no-store' })
11
10
  if (!upstream.ok) {
12
11
  return new Response(
@@ -1,22 +1,20 @@
1
1
  import Link from 'next/link'
2
2
  import { notFound } from 'next/navigation'
3
3
  import { formatDate, type ThemeRouteContext } from 'ampless'
4
- import { listPostsByTag } from '@/lib/posts-public'
5
- import { loadSiteSettings } from '@/lib/site-settings'
6
- import { loadThemeConfig } from '@/lib/theme-config'
4
+ import { ampless } from '@/lib/ampless'
5
+ import { admin } from '@/lib/admin'
7
6
  import { SiteHeader } from '@/components/site-chrome/site-header'
8
7
  import { SiteSidebar } from '@/components/site-chrome/site-sidebar'
9
8
  import { SiteFooter } from '@/components/site-chrome/site-footer'
10
9
  import { CollapsibleSidebar } from '@/components/site-chrome/collapsible-sidebar'
11
- import { t } from '@/lib/i18n'
12
10
 
13
11
  export default async function DocsTag({ params }: ThemeRouteContext<{ tag: string }>) {
14
- const { siteId, tag } = await params
12
+ const { tag } = await params
15
13
  const decodedTag = decodeURIComponent(tag)
16
14
  const [{ items: posts }, settings, theme] = await Promise.all([
17
- listPostsByTag(decodedTag, { siteId, limit: 50 }),
18
- loadSiteSettings(siteId),
19
- loadThemeConfig(siteId),
15
+ ampless.listPostsByTag(decodedTag, { limit: 50 }),
16
+ ampless.loadSiteSettings(),
17
+ ampless.loadThemeConfig(),
20
18
  ])
21
19
  if (posts.length === 0) notFound()
22
20
 
@@ -31,12 +29,12 @@ export default async function DocsTag({ params }: ThemeRouteContext<{ tag: strin
31
29
 
32
30
  <div className="mx-auto grid max-w-6xl gap-6 px-6 py-10 lg:grid-cols-[15rem_1fr] lg:gap-10">
33
31
  <CollapsibleSidebar className="lg:sticky lg:top-6 lg:self-start">
34
- <SiteSidebar links={theme.values.sidebarNav} siteId={siteId} />
32
+ <SiteSidebar links={theme.values.sidebarNav} />
35
33
  </CollapsibleSidebar>
36
34
 
37
35
  <main className="min-w-0">
38
36
  <header className="mb-10">
39
- <p className="text-sm text-[var(--muted-foreground)]">{t('public.tagLabel')}</p>
37
+ <p className="text-sm text-[var(--muted-foreground)]">{admin.t('public.tagLabel')}</p>
40
38
  <h1 className="text-3xl font-bold tracking-tight">#{decodedTag}</h1>
41
39
  </header>
42
40
 
@@ -2,50 +2,28 @@
2
2
  * tighter radius, monospace-leaning code styling. */
3
3
 
4
4
  [data-theme='docs'] {
5
- --background: oklch(1 0 0);
6
- --foreground: oklch(0.18 0.02 280);
7
- --card: oklch(0.99 0 0);
8
- --card-foreground: oklch(0.18 0.02 280);
9
- --primary: oklch(0.5 0.18 280);
10
- --primary-foreground: oklch(0.99 0 0);
11
- --secondary: oklch(0.96 0.01 280);
12
- --secondary-foreground: oklch(0.25 0.05 280);
13
- --muted: oklch(0.97 0.005 280);
14
- --muted-foreground: oklch(0.5 0.02 280);
15
- --accent: oklch(0.95 0.04 280);
16
- --accent-foreground: oklch(0.3 0.1 280);
17
- --destructive: oklch(0.55 0.22 25);
18
- --destructive-foreground: oklch(0.99 0 0);
19
- --border: oklch(0.9 0.005 280);
20
- --input: oklch(0.9 0.005 280);
21
- --ring: oklch(0.5 0.18 280);
5
+ --background: light-dark(oklch(1 0 0), oklch(0.16 0.02 280));
6
+ --foreground: light-dark(oklch(0.18 0.02 280), oklch(0.96 0.005 280));
7
+ --card: light-dark(oklch(0.99 0 0), oklch(0.2 0.02 280));
8
+ --card-foreground: light-dark(oklch(0.18 0.02 280), oklch(0.96 0.005 280));
9
+ --primary: light-dark(oklch(0.5 0.18 280), oklch(0.72 0.16 280));
10
+ --primary-foreground: light-dark(oklch(0.99 0 0), oklch(0.16 0.02 280));
11
+ --secondary: light-dark(oklch(0.96 0.01 280), oklch(0.28 0.03 280));
12
+ --secondary-foreground: light-dark(oklch(0.25 0.05 280), oklch(0.96 0.005 280));
13
+ --muted: light-dark(oklch(0.97 0.005 280), oklch(0.24 0.02 280));
14
+ --muted-foreground: light-dark(oklch(0.5 0.02 280), oklch(0.7 0.02 280));
15
+ --accent: light-dark(oklch(0.95 0.04 280), oklch(0.32 0.06 280));
16
+ --accent-foreground: light-dark(oklch(0.3 0.1 280), oklch(0.96 0.005 280));
17
+ --destructive: light-dark(oklch(0.55 0.22 25), oklch(0.55 0.22 25));
18
+ --destructive-foreground: light-dark(oklch(0.99 0 0), oklch(0.99 0 0));
19
+ --border: light-dark(oklch(0.9 0.005 280), oklch(0.32 0.02 280));
20
+ --input: light-dark(oklch(0.9 0.005 280), oklch(0.32 0.02 280));
21
+ --ring: light-dark(oklch(0.5 0.18 280), oklch(0.72 0.16 280));
22
22
  --radius: 0.25rem;
23
23
  --ampless-body-font: system-ui, -apple-system, sans-serif;
24
24
  --ampless-code-font: ui-monospace, SFMono-Regular, Menlo, monospace;
25
25
  }
26
26
 
27
- @media (prefers-color-scheme: dark) {
28
- [data-theme='docs'] {
29
- --background: oklch(0.16 0.02 280);
30
- --foreground: oklch(0.96 0.005 280);
31
- --card: oklch(0.2 0.02 280);
32
- --card-foreground: oklch(0.96 0.005 280);
33
- --primary: oklch(0.72 0.16 280);
34
- --primary-foreground: oklch(0.16 0.02 280);
35
- --secondary: oklch(0.28 0.03 280);
36
- --secondary-foreground: oklch(0.96 0.005 280);
37
- --muted: oklch(0.24 0.02 280);
38
- --muted-foreground: oklch(0.7 0.02 280);
39
- --accent: oklch(0.32 0.06 280);
40
- --accent-foreground: oklch(0.96 0.005 280);
41
- --destructive: oklch(0.55 0.22 25);
42
- --destructive-foreground: oklch(0.99 0 0);
43
- --border: oklch(0.32 0.02 280);
44
- --input: oklch(0.32 0.02 280);
45
- --ring: oklch(0.72 0.16 280);
46
- }
47
- }
48
-
49
27
  /* Code font scope: prose code blocks under the docs theme use the
50
28
  * configurable --ampless-code-font variable. The body font remains the
51
29
  * theme-configured --ampless-body-font (or system fallback). */