blume 0.6.7 → 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.
Files changed (211) hide show
  1. package/CHANGELOG.md +618 -0
  2. package/LICENSE +21 -0
  3. package/README.md +107 -0
  4. package/dist/cli/index.js +2609 -1041
  5. package/dist/cli/index.js.map +110 -103
  6. package/dist/types/ai/component-markdown.d.ts +34 -0
  7. package/dist/types/components/content/youtube.d.ts +18 -0
  8. package/dist/types/core/base-path.d.ts +47 -0
  9. package/dist/types/core/config-input.d.ts +110 -12
  10. package/dist/types/core/config.d.ts +6 -4
  11. package/dist/types/core/data.d.ts +4 -0
  12. package/dist/types/core/i18n-ui.d.ts +477 -135
  13. package/dist/types/core/schema.d.ts +309 -195
  14. package/dist/types/core/sources/types.d.ts +2 -0
  15. package/dist/types/core/types.d.ts +6 -1
  16. package/dist/types/index.d.ts +1 -0
  17. package/dist/types/openapi/references.d.ts +60 -0
  18. package/docs/01-quickstart.mdx +5 -2
  19. package/docs/02-deployment.mdx +24 -9
  20. package/docs/03-faq.mdx +46 -16
  21. package/docs/advanced/custom-pages.mdx +1 -1
  22. package/docs/advanced/skills.mdx +1 -1
  23. package/docs/configuration/ai.mdx +49 -10
  24. package/docs/configuration/customization.mdx +11 -0
  25. package/docs/configuration/index.mdx +33 -3
  26. package/docs/configuration/seo.mdx +2 -2
  27. package/docs/content/components.mdx +30 -3
  28. package/docs/content/i18n.mdx +1 -1
  29. package/docs/content/islands.mdx +8 -0
  30. package/docs/content/navigation.mdx +3 -3
  31. package/docs/content/sources.mdx +1 -1
  32. package/docs/content/syntax.mdx +17 -2
  33. package/docs/index.mdx +2 -2
  34. package/docs/reference/cli.mdx +8 -6
  35. package/package.json +15 -4
  36. package/skills/blume/SKILL.md +5 -3
  37. package/skills/blume-update-docs/SKILL.md +3 -2
  38. package/src/ai/agent-readability.ts +11 -5
  39. package/src/ai/ask-context.ts +7 -2
  40. package/src/ai/ask-data.ts +3 -0
  41. package/src/ai/ask.ts +12 -7
  42. package/src/ai/component-markdown.ts +461 -0
  43. package/src/ai/llms.ts +143 -23
  44. package/src/ai/markdown.ts +35 -6
  45. package/src/ai/mcp/data.ts +33 -8
  46. package/src/ai/mcp/discovery.ts +10 -3
  47. package/src/ai/mcp/server.ts +24 -7
  48. package/src/ai/visibility.ts +74 -0
  49. package/src/astro/component-slots.ts +16 -4
  50. package/src/astro/examples.ts +12 -7
  51. package/src/astro/generate.ts +393 -189
  52. package/src/astro/index.ts +5 -1
  53. package/src/astro/integration.ts +9 -5
  54. package/src/astro/islands.ts +11 -5
  55. package/src/astro/markdown-negotiation.ts +2 -2
  56. package/src/astro/pages.ts +89 -22
  57. package/src/astro/templates.ts +259 -25
  58. package/src/blume-modules.d.ts +8 -0
  59. package/src/cli/commands/build.ts +131 -38
  60. package/src/cli/commands/check.ts +1 -1
  61. package/src/cli/commands/dev.ts +71 -17
  62. package/src/cli/commands/doctor.ts +2 -2
  63. package/src/cli/commands/eject.ts +47 -19
  64. package/src/cli/commands/init.ts +120 -180
  65. package/src/cli/commands/preview.ts +4 -1
  66. package/src/cli/commands/validate.ts +44 -2
  67. package/src/cli/dev-lock.ts +34 -19
  68. package/src/cli/eject-scripts.ts +72 -0
  69. package/src/cli/env.ts +15 -5
  70. package/src/cli/init/questions.ts +158 -0
  71. package/src/cli/init/scaffold.ts +380 -0
  72. package/src/cli/required-secrets.ts +2 -1
  73. package/src/components/content/AccordionItem.astro +23 -4
  74. package/src/components/content/Badge.astro +3 -1
  75. package/src/components/content/Card.astro +4 -2
  76. package/src/components/content/CodeBlock.astro +3 -0
  77. package/src/components/content/Component.astro +30 -16
  78. package/src/components/content/Diff.astro +3 -1
  79. package/src/components/content/Step.astro +10 -1
  80. package/src/components/content/Tabs.astro +15 -3
  81. package/src/components/content/Tile.astro +2 -1
  82. package/src/components/content/Tooltip.astro +3 -1
  83. package/src/components/content/Update.astro +9 -2
  84. package/src/components/content/auto-type-table.ts +25 -9
  85. package/src/components/content/base-href.ts +33 -0
  86. package/src/components/content/changelog-element.ts +9 -2
  87. package/src/components/content/diff.ts +12 -6
  88. package/src/components/content/mermaid-element.ts +10 -2
  89. package/src/components/index.ts +23 -1
  90. package/src/components/islands/AskAI.astro +5 -2
  91. package/src/components/islands/ask-ai.tsx +68 -12
  92. package/src/components/islands/base-path.ts +28 -0
  93. package/src/components/islands/hooks.ts +44 -9
  94. package/src/components/layout/Banner.astro +12 -3
  95. package/src/components/layout/Breadcrumbs.astro +2 -1
  96. package/src/components/layout/Favicon.astro +3 -2
  97. package/src/components/layout/Header.astro +15 -5
  98. package/src/components/layout/LanguageSwitcher.astro +2 -1
  99. package/src/components/layout/Logo.astro +13 -4
  100. package/src/components/layout/NavSelector.astro +2 -1
  101. package/src/components/layout/NavTree.astro +22 -7
  102. package/src/components/layout/PageActions.astro +25 -10
  103. package/src/components/layout/PageFeedback.astro +4 -1
  104. package/src/components/layout/PageLayout.astro +51 -9
  105. package/src/components/layout/Pagination.astro +3 -2
  106. package/src/components/layout/ReferenceLayout.astro +8 -1
  107. package/src/components/layout/RootLayout.astro +74 -13
  108. package/src/components/layout/Search.astro +107 -27
  109. package/src/components/layout/nav-utils.ts +18 -10
  110. package/src/components/layout/search/algolia.ts +11 -2
  111. package/src/components/layout/search/endpoint.ts +11 -5
  112. package/src/components/layout/search/orama-cloud.ts +8 -2
  113. package/src/components/layout/search/pagefind.ts +3 -0
  114. package/src/components/layout/search/types.ts +5 -1
  115. package/src/components/layout/search/typesense.ts +4 -1
  116. package/src/components/layout/toc-element.ts +8 -2
  117. package/src/components/openapi/ApiTagOperations.astro +2 -1
  118. package/src/components/openapi/Operation.astro +47 -40
  119. package/src/components/openapi/RequestPanel.astro +8 -2
  120. package/src/components/openapi/helpers.ts +71 -3
  121. package/src/components/openapi/panel.ts +1 -1
  122. package/src/components/openapi/snippets.ts +25 -11
  123. package/src/core/base-path.ts +94 -0
  124. package/src/core/builtin-tags.ts +2 -0
  125. package/src/core/component-overrides.ts +103 -74
  126. package/src/core/config-input.ts +118 -17
  127. package/src/core/config.ts +8 -5
  128. package/src/core/content.ts +2 -0
  129. package/src/core/data.ts +4 -0
  130. package/src/core/diagnostics.ts +54 -34
  131. package/src/core/gitignore.ts +4 -1
  132. package/src/core/graph.ts +166 -88
  133. package/src/core/i18n-ui.ts +63 -3
  134. package/src/core/last-modified.ts +15 -6
  135. package/src/core/links.ts +69 -25
  136. package/src/core/manifest.ts +62 -45
  137. package/src/core/nav-diagnostics.ts +1 -1
  138. package/src/core/navigation.ts +144 -58
  139. package/src/core/package-json.ts +17 -2
  140. package/src/core/project-graph.ts +25 -15
  141. package/src/core/schema.ts +605 -620
  142. package/src/core/sources/assets.ts +6 -1
  143. package/src/core/sources/filesystem.ts +4 -0
  144. package/src/core/sources/github-releases.ts +2 -1
  145. package/src/core/sources/mdx-remote.ts +76 -63
  146. package/src/core/sources/normalize.ts +236 -91
  147. package/src/core/sources/notion.ts +27 -18
  148. package/src/core/sources/types.ts +2 -0
  149. package/src/core/tsconfig-aliases.ts +59 -30
  150. package/src/core/types.ts +6 -1
  151. package/src/core/ui-packs/ar.ts +1 -0
  152. package/src/core/ui-packs/bg.ts +1 -0
  153. package/src/core/ui-packs/bn.ts +1 -0
  154. package/src/core/ui-packs/ca.ts +1 -0
  155. package/src/core/ui-packs/cs.ts +1 -0
  156. package/src/core/ui-packs/da.ts +1 -0
  157. package/src/core/ui-packs/de.ts +1 -0
  158. package/src/core/ui-packs/el.ts +1 -0
  159. package/src/core/ui-packs/es.ts +1 -0
  160. package/src/core/ui-packs/fa.ts +1 -0
  161. package/src/core/ui-packs/fi.ts +1 -0
  162. package/src/core/ui-packs/fr.ts +2 -1
  163. package/src/core/ui-packs/he.ts +1 -0
  164. package/src/core/ui-packs/hi.ts +1 -0
  165. package/src/core/ui-packs/hr.ts +1 -0
  166. package/src/core/ui-packs/hu.ts +1 -0
  167. package/src/core/ui-packs/id.ts +1 -0
  168. package/src/core/ui-packs/it.ts +1 -0
  169. package/src/core/ui-packs/ja.ts +1 -0
  170. package/src/core/ui-packs/ko.ts +1 -0
  171. package/src/core/ui-packs/nl.ts +1 -0
  172. package/src/core/ui-packs/no.ts +1 -0
  173. package/src/core/ui-packs/pl.ts +1 -0
  174. package/src/core/ui-packs/pt-br.ts +1 -0
  175. package/src/core/ui-packs/pt.ts +1 -0
  176. package/src/core/ui-packs/ro.ts +1 -0
  177. package/src/core/ui-packs/ru.ts +1 -0
  178. package/src/core/ui-packs/sk.ts +1 -0
  179. package/src/core/ui-packs/sr.ts +1 -0
  180. package/src/core/ui-packs/sv.ts +1 -0
  181. package/src/core/ui-packs/th.ts +1 -0
  182. package/src/core/ui-packs/tr.ts +1 -0
  183. package/src/core/ui-packs/uk.ts +1 -0
  184. package/src/core/ui-packs/vi.ts +1 -0
  185. package/src/core/ui-packs/zh-tw.ts +1 -0
  186. package/src/core/ui-packs/zh.ts +1 -0
  187. package/src/deploy/adapter-output.ts +18 -8
  188. package/src/deploy/redirects.ts +25 -2
  189. package/src/deploy/robots.ts +6 -1
  190. package/src/deploy/rss.ts +10 -3
  191. package/src/deploy/sitemap.ts +59 -13
  192. package/src/index.ts +5 -0
  193. package/src/markdown/base-links.ts +60 -0
  194. package/src/markdown/code-title.ts +11 -14
  195. package/src/markdown/index.ts +46 -9
  196. package/src/markdown/inline-code.ts +14 -4
  197. package/src/markdown/package-commands.ts +10 -4
  198. package/src/markdown/themes.ts +24 -0
  199. package/src/openapi/model.ts +15 -5
  200. package/src/openapi/parse.ts +21 -0
  201. package/src/openapi/references.ts +75 -21
  202. package/src/openapi/render-mdx.ts +11 -6
  203. package/src/openapi/scalar.ts +32 -16
  204. package/src/openapi/source.ts +59 -10
  205. package/src/registry/eject.ts +247 -19
  206. package/src/registry/registry.ts +0 -3
  207. package/src/search/build.ts +3 -0
  208. package/src/search/documents.ts +36 -4
  209. package/src/search/sync/typesense.ts +6 -4
  210. package/src/seo/jsonld.ts +28 -17
  211. package/src/theme/entry.ts +85 -20
@@ -12,25 +12,16 @@ interface TailwindEntryOptions {
12
12
  twoslashCss?: string;
13
13
  }
14
14
 
15
+ /** Dark mode is driven by `data-theme` on the root element (both sheets). */
16
+ const DARK_VARIANT = `/* Dark mode is driven by data-theme on the <html> element. */
17
+ @custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));`;
18
+
15
19
  /**
16
- * Build the single Tailwind v4 entry stylesheet for the generated runtime.
17
- *
18
- * Everything flows through one Tailwind-processed file so utilities are
19
- * generated and design tokens cascade deterministically:
20
- * base defaults -> config tokens -> user theme.css.
20
+ * The default `--blume-*` design tokens (light + dark), shared by the app
21
+ * sheet and the isolated example-preview sheet so previews inherit the site's
22
+ * palette by default.
21
23
  */
22
- export const tailwindEntryTemplate = (options: TailwindEntryOptions): string =>
23
- `/* Generated by Blume. Do not edit. */
24
- @import "tailwindcss";
25
- @plugin "@tailwindcss/typography";
26
-
27
- /* Scan Blume's components and the user's project for utility classes. */
28
- ${options.sources.map((source) => `@source "${source}";`).join("\n")}
29
-
30
- /* Dark mode is driven by data-theme on the <html> element. */
31
- @custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));
32
-
33
- :root {
24
+ const TOKEN_DEFAULTS = `:root {
34
25
  --blume-background: oklch(1 0 0);
35
26
  --blume-background-image: none;
36
27
  --blume-background-image-repeat: no-repeat;
@@ -108,9 +99,15 @@ ${options.sources.map((source) => `@source "${source}";`).join("\n")}
108
99
  --blume-code-remove-border: oklch(0.7 0.2 22 / 0.7);
109
100
  --blume-code-word: oklch(0.7 0.14 255 / 0.22);
110
101
  --blume-code-word-border: oklch(0.7 0.14 255 / 0.55);
111
- }
102
+ }`;
112
103
 
113
- @theme inline {
104
+ /**
105
+ * Tailwind theme mapping from `--blume-*` tokens to utility-facing names
106
+ * (`bg-background`, `border-border`, `rounded-blume`, the font stacks).
107
+ * Shared by both sheets so example code written against Blume's utility
108
+ * vocabulary renders identically inside the isolated preview frame.
109
+ */
110
+ const THEME_MAPPING = `@theme inline {
114
111
  --color-background: var(--blume-background);
115
112
  --color-foreground: var(--blume-foreground);
116
113
  --color-muted: var(--blume-muted);
@@ -125,7 +122,28 @@ ${options.sources.map((source) => `@source "${source}";`).join("\n")}
125
122
  --font-sans: var(--blume-font-body);
126
123
  --font-mono: var(--blume-font-mono);
127
124
  --font-display: var(--blume-font-display);
128
- }
125
+ }`;
126
+
127
+ /**
128
+ * Build the single Tailwind v4 entry stylesheet for the generated runtime.
129
+ *
130
+ * Everything flows through one Tailwind-processed file so utilities are
131
+ * generated and design tokens cascade deterministically:
132
+ * base defaults -> config tokens -> user theme.css.
133
+ */
134
+ export const tailwindEntryTemplate = (options: TailwindEntryOptions): string =>
135
+ `/* Generated by Blume. Do not edit. */
136
+ @import "tailwindcss";
137
+ @plugin "@tailwindcss/typography";
138
+
139
+ /* Scan Blume's components and the user's project for utility classes. */
140
+ ${options.sources.map((source) => `@source "${source}";`).join("\n")}
141
+
142
+ ${DARK_VARIANT}
143
+
144
+ ${TOKEN_DEFAULTS}
145
+
146
+ ${THEME_MAPPING}
129
147
 
130
148
  @layer base {
131
149
  /* Nothing refuses to shrink below its intrinsic content width. This global
@@ -670,3 +688,50 @@ ${options.twoslashCss ?? ""}
670
688
  ${options.configTokens}
671
689
  ${options.userTheme}
672
690
  `;
691
+
692
+ interface ExamplesEntryOptions {
693
+ /** Config-derived token overrides (`:root { --blume-accent: ... }`). */
694
+ configTokens: string;
695
+ /** Globs to scan for utility classes (example files and their imports). */
696
+ sources: string[];
697
+ /** Raw contents of the configured `examples.css`, if any. */
698
+ userCss: string;
699
+ }
700
+
701
+ /**
702
+ * Build the Tailwind entry for `<Component />` preview frames. Each example
703
+ * renders in its own iframe so none of the app sheet above — prose typography,
704
+ * component chrome, base overrides — can reach it. This sheet provides only
705
+ * what an example needs to look like it does in an app: Tailwind (preflight +
706
+ * utilities scanned from the example sources), the `--blume-*` tokens and
707
+ * their utility mapping (so `bg-background`-style classes keep working and
708
+ * previews follow the site palette by default), and the user's example CSS
709
+ * (shadcn variables, `@theme` mappings, custom styles) last so it wins.
710
+ */
711
+ export const examplesEntryTemplate = (options: ExamplesEntryOptions): string =>
712
+ `/* Generated by Blume. Do not edit. */
713
+ @import "tailwindcss";
714
+
715
+ /* Scan the example files and the project sources they import. */
716
+ ${options.sources.map((source) => `@source "${source}";`).join("\n")}
717
+
718
+ ${DARK_VARIANT}
719
+
720
+ ${TOKEN_DEFAULTS}
721
+
722
+ ${THEME_MAPPING}
723
+
724
+ /* Frame defaults: readable text in both modes, transparent so the docs pane's
725
+ surface shows through. Base layer, so any user/example CSS wins. */
726
+ @layer base {
727
+ body {
728
+ background: transparent;
729
+ color: var(--blume-foreground);
730
+ }
731
+ }
732
+
733
+ /* Token overrides: config first, then the configured examples css (highest
734
+ priority) — the place for shadcn variables and other component tokens. */
735
+ ${options.configTokens}
736
+ ${options.userCss}
737
+ `;