@nikala-ui/folio 0.14.0 → 0.15.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 (107) hide show
  1. package/README.md +16 -0
  2. package/dist/cli/commands/init.js +21 -2
  3. package/dist/client/app.jsx +6 -3
  4. package/dist/client/components/docs-layout-shell.d.ts +1 -0
  5. package/dist/client/components/docs-layout-shell.jsx +1 -1
  6. package/dist/client/components/docs-page-content.jsx +9 -5
  7. package/dist/client/navigation/page-navigation.js +10 -27
  8. package/dist/client/public/algolia-logo.svg +15 -0
  9. package/dist/client/public/favicon.ico +0 -0
  10. package/dist/client/public/logo.svg +11 -0
  11. package/dist/client/routing/use-docs-router.d.ts +1 -0
  12. package/dist/client/routing/use-docs-router.js +12 -3
  13. package/dist/client/style.css +139 -55
  14. package/dist/components/ui/api-table.jsx +6 -4
  15. package/dist/components/ui/code-block.jsx +6 -4
  16. package/dist/components/ui/command.jsx +9 -5
  17. package/dist/components/ui/list.jsx +3 -1
  18. package/dist/components/ui/logo.d.ts +4 -1
  19. package/dist/components/ui/logo.jsx +8 -22
  20. package/dist/components/ui/package-manager-tabs.jsx +4 -2
  21. package/dist/components/ui/pager.jsx +4 -2
  22. package/dist/components/ui/section-heading.jsx +1 -1
  23. package/dist/components/ui/sidebar.jsx +6 -3
  24. package/dist/components/ui/spinner.jsx +3 -1
  25. package/dist/components/ui/theme-toggle.jsx +14 -12
  26. package/dist/config.d.ts +1 -0
  27. package/dist/config.js +84 -29
  28. package/dist/core/content-scanner.d.ts +2 -1
  29. package/dist/core/content-scanner.js +2 -9
  30. package/dist/core/plugin/index.d.ts +2 -0
  31. package/dist/core/plugin/index.js +1 -0
  32. package/dist/core/plugin/lifecycle-error.d.ts +19 -0
  33. package/dist/core/plugin/lifecycle-error.js +28 -0
  34. package/dist/core/plugin/lifecycle-snapshot.d.ts +1 -0
  35. package/dist/core/plugin/lifecycle-snapshot.js +156 -0
  36. package/dist/core/plugin/lifecycle.d.ts +34 -0
  37. package/dist/core/plugin/lifecycle.js +170 -0
  38. package/dist/core/route-tree.d.ts +3 -2
  39. package/dist/core/route-tree.js +40 -10
  40. package/dist/index.d.ts +5 -3
  41. package/dist/index.js +3 -3
  42. package/dist/plugin.d.ts +60 -0
  43. package/dist/plugin.js +51 -0
  44. package/dist/plugins/i18n/components/site-language-switcher.d.ts +10 -0
  45. package/dist/plugins/i18n/components/site-language-switcher.jsx +39 -0
  46. package/dist/plugins/i18n/constants.d.ts +1 -0
  47. package/dist/plugins/i18n/constants.js +1 -0
  48. package/dist/plugins/i18n/index.d.ts +11 -0
  49. package/dist/plugins/i18n/index.js +89 -0
  50. package/dist/plugins/i18n/navigation.d.ts +5 -0
  51. package/dist/plugins/i18n/navigation.js +33 -0
  52. package/dist/plugins/i18n/runtime.d.ts +19 -0
  53. package/dist/plugins/i18n/runtime.jsx +65 -0
  54. package/dist/plugins/i18n/site-locale.d.ts +12 -0
  55. package/dist/plugins/i18n/site-locale.js +119 -0
  56. package/dist/server/index.d.ts +4 -1
  57. package/dist/server/index.js +69 -33
  58. package/dist/server/module-serialization.d.ts +6 -0
  59. package/dist/server/module-serialization.js +26 -0
  60. package/dist/server/plugin/components.d.ts +7 -0
  61. package/dist/server/plugin/components.js +82 -0
  62. package/dist/server/plugin/constants.d.ts +17 -0
  63. package/dist/server/plugin/constants.js +21 -0
  64. package/dist/server/{plugin.d.ts → plugin/index.d.ts} +3 -1
  65. package/dist/server/plugin/index.js +166 -0
  66. package/dist/server/plugin/lifecycle.d.ts +32 -0
  67. package/dist/server/plugin/lifecycle.js +110 -0
  68. package/dist/server/plugin/styles.d.ts +3 -0
  69. package/dist/server/plugin/styles.js +22 -0
  70. package/dist/server/plugin/virtual-modules.d.ts +11 -0
  71. package/dist/server/plugin/virtual-modules.js +88 -0
  72. package/dist/server/seo.d.ts +4 -0
  73. package/dist/server/seo.js +87 -0
  74. package/dist/themes/default/content/breadcrumbs.jsx +5 -2
  75. package/dist/themes/default/content/table-of-contents.jsx +3 -1
  76. package/dist/themes/default/layout.jsx +39 -12
  77. package/dist/themes/default/navbar.jsx +14 -7
  78. package/dist/themes/default/navigation/mobile-table-of-contents.jsx +3 -1
  79. package/dist/themes/default/navigation/sidebar-tree.d.ts +2 -0
  80. package/dist/themes/default/navigation/sidebar-tree.jsx +11 -2
  81. package/dist/themes/default/overlays/search-dialog.jsx +14 -3
  82. package/dist/themes/default/sidebar.jsx +7 -5
  83. package/dist/themes/types.d.ts +5 -0
  84. package/dist/types.d.ts +36 -0
  85. package/dist/utils/format-title.d.ts +1 -0
  86. package/dist/utils/format-title.js +11 -0
  87. package/dist/vendor/docs-src/components/ui/api-table.tsx +6 -4
  88. package/dist/vendor/docs-src/components/ui/code-block.tsx +6 -4
  89. package/dist/vendor/docs-src/components/ui/command.tsx +9 -5
  90. package/dist/vendor/docs-src/components/ui/list.tsx +4 -2
  91. package/dist/vendor/docs-src/components/ui/logo.tsx +19 -48
  92. package/dist/vendor/docs-src/components/ui/package-manager-tabs.tsx +4 -2
  93. package/dist/vendor/docs-src/components/ui/pager.tsx +4 -2
  94. package/dist/vendor/docs-src/components/ui/section-heading.tsx +5 -1
  95. package/dist/vendor/docs-src/components/ui/sidebar.tsx +7 -4
  96. package/dist/vendor/docs-src/components/ui/spinner.tsx +3 -1
  97. package/dist/vendor/docs-src/components/ui/theme-toggle.tsx +15 -13
  98. package/dist/vendor/docs-src/plugins/i18n/components/site-language-switcher.tsx +56 -0
  99. package/dist/vendor/docs-src/plugins/i18n/constants.ts +1 -0
  100. package/dist/vendor/docs-src/plugins/i18n/index.ts +110 -0
  101. package/dist/vendor/docs-src/plugins/i18n/navigation.ts +49 -0
  102. package/dist/vendor/docs-src/plugins/i18n/runtime.tsx +91 -0
  103. package/dist/vendor/docs-src/plugins/i18n/site-locale.ts +140 -0
  104. package/dist/version.d.ts +1 -1
  105. package/dist/version.js +1 -1
  106. package/package.json +11 -4
  107. package/dist/server/plugin.js +0 -521
@@ -3,6 +3,7 @@ import { createKeybindings } from "@/hooks/create-keybindings";
3
3
  import { Dialog } from "@kobalte/core/dialog";
4
4
  import { Search, ArrowUp, ArrowDown, CornerDownLeft } from "lucide-solid";
5
5
  import { cn } from "@/lib/cn";
6
+ import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
6
7
  import { Kbd, KbdGroup } from "../ui/kbd";
7
8
  import { InputGroup, InputGroupInput, InputGroupAddon } from "../ui/input-group";
8
9
  import { List, ListGroup, ListHeader, ListItem } from "../ui/list";
@@ -123,6 +124,7 @@ export const CommandDialog = (props) => {
123
124
  export const CommandInput = (props) => {
124
125
  const [local, rest] = splitProps(props, ["class", "value", "onInput"]);
125
126
  const { search, setSearch } = useCommand();
127
+ const siteLocale = useSiteLocale();
126
128
  return (<InputGroup class="border-0 border-b border-border rounded-none bg-transparent px-3 py-1 shadow-none focus-within:ring-0 focus-within:border-border">
127
129
  <InputGroupAddon align="inline-start">
128
130
  <Search class="w-4 h-4 text-muted-foreground"/>
@@ -133,7 +135,7 @@ export const CommandInput = (props) => {
133
135
  if (typeof local.onInput === "function") {
134
136
  local.onInput(e);
135
137
  }
136
- }} placeholder="Type a command or search..." class="h-11 text-base sm:text-sm font-medium" {...rest}/>
138
+ }} placeholder={siteLocale.t("search.commandPlaceholder")} class="h-11 text-base sm:text-sm font-medium" {...rest}/>
137
139
  </InputGroup>);
138
140
  };
139
141
  export const CommandList = (props) => {
@@ -145,9 +147,10 @@ export const CommandList = (props) => {
145
147
  export const CommandEmpty = (props) => {
146
148
  const [local, rest] = splitProps(props, ["class", "children"]);
147
149
  const { search } = useCommand();
150
+ const siteLocale = useSiteLocale();
148
151
  return (<Show when={search().trim().length > 0}>
149
152
  <div class={cn("py-8 text-center text-sm text-muted-foreground font-medium select-none", local.class)} {...rest}>
150
- {local.children || `No results found for "${search()}".`}
153
+ {local.children || siteLocale.t("search.noResults", { query: search() })}
151
154
  </div>
152
155
  </Show>);
153
156
  };
@@ -197,6 +200,7 @@ export const CommandItem = (props) => {
197
200
  };
198
201
  export const CommandFooter = (props) => {
199
202
  const [local, rest] = splitProps(props, ["class", "children"]);
203
+ const siteLocale = useSiteLocale();
200
204
  return (<div class={cn("flex items-center justify-between border-t border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground select-none", local.class)} {...rest}>
201
205
  <div class="flex items-center gap-3">
202
206
  <span class="flex items-center gap-1">
@@ -204,17 +208,17 @@ export const CommandFooter = (props) => {
204
208
  <Kbd size="sm"><ArrowUp class="w-2.5 h-2.5"/></Kbd>
205
209
  <Kbd size="sm"><ArrowDown class="w-2.5 h-2.5"/></Kbd>
206
210
  </KbdGroup>
207
- <span>Navigate</span>
211
+ <span>{siteLocale.t("command.navigate")}</span>
208
212
  </span>
209
213
 
210
214
  <span class="flex items-center gap-1">
211
215
  <Kbd size="sm"><CornerDownLeft class="w-2.5 h-2.5"/></Kbd>
212
- <span>Select</span>
216
+ <span>{siteLocale.t("command.select")}</span>
213
217
  </span>
214
218
 
215
219
  <span class="flex items-center gap-1">
216
220
  <Kbd size="sm">Esc</Kbd>
217
- <span>Close</span>
221
+ <span>{siteLocale.t("command.close")}</span>
218
222
  </span>
219
223
  </div>
220
224
 
@@ -4,6 +4,7 @@ import { Dynamic } from "solid-js/web";
4
4
  import { cva } from "class-variance-authority";
5
5
  import { ChevronRight } from "lucide-solid";
6
6
  import { cn } from "@/lib/cn";
7
+ import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
7
8
  export const List = (props) => {
8
9
  const [local, rest] = splitProps(props, ["class", "children"]);
9
10
  return (<div role="list" class={cn("flex flex-col gap-1 w-full p-1", local.class)} {...rest}>
@@ -67,11 +68,12 @@ export const ListItem = (props) => {
67
68
  "class",
68
69
  "children",
69
70
  ]);
71
+ const siteLocale = useSiteLocale();
70
72
  const content = () => (<>
71
73
  {/* Left Visual: Icon, Avatar, or Image */}
72
74
  <div class="flex items-center gap-2.5 min-w-0">
73
75
  <Show when={local.avatar}>
74
- <img src={local.avatar} alt={local.title || "Avatar"} class="w-10 h-10 rounded-lg object-cover shrink-0 border border-border"/>
76
+ <img src={local.avatar} alt={local.title || siteLocale.t("image.avatar")} class="w-10 h-10 rounded-lg object-cover shrink-0 border border-border"/>
75
77
  </Show>
76
78
 
77
79
  <Show when={!local.avatar && local.avatarFallback}>
@@ -3,6 +3,9 @@ export interface LogoProps extends JSX.SvgSVGAttributes<SVGSVGElement> {
3
3
  class?: string;
4
4
  }
5
5
  /**
6
- * Official Nikala UI Logo Component with dynamic contrast stroke and accent fill.
6
+ * Folio mark with a theme-aware accent fill.
7
+ *
8
+ * The paths intentionally use currentColor so the mark follows the
9
+ * consuming project's primary theme token instead of a fixed brand color.
7
10
  */
8
11
  export declare const Logo: Component<LogoProps>;
@@ -1,30 +1,16 @@
1
1
  import { splitProps } from "solid-js";
2
2
  import { cn } from "@/lib/cn";
3
3
  /**
4
- * Official Nikala UI Logo Component with dynamic contrast stroke and accent fill.
4
+ * Folio mark with a theme-aware accent fill.
5
+ *
6
+ * The paths intentionally use currentColor so the mark follows the
7
+ * consuming project's primary theme token instead of a fixed brand color.
5
8
  */
6
9
  export const Logo = (props) => {
7
10
  const [local, rest] = splitProps(props, ["class"]);
8
- return (<svg viewBox="0 0 223 223" fill="none" xmlns="http://www.w3.org/2000/svg" class={cn("h-7 w-7 shrink-0 select-none", local.class)} {...rest}>
9
- <g clip-path="url(#nikala-logo-clip0)">
10
- {/* Background Box with Dynamic Theme Accent */}
11
- <path d="M0 10C0 4.47716 4.47715 0 10 0H213C218.523 0 223 4.47715 223 10V213C223 218.523 218.523 223 213 223H10C4.47716 223 0 218.523 0 213V10Z" fill="currentColor" class="text-primary"/>
12
- <g clip-path="url(#nikala-logo-clip1)">
13
- {/* Paintbrush Vector Paths Adapting to --primary-foreground */}
14
- <path d="M304.406 364.173C303.147 366.03 301.738 366.903 299.847 368.109C299.093 368.594 298.339 369.08 297.563 369.58C296.746 370.096 295.929 370.613 295.087 371.145C294.245 371.684 293.402 372.224 292.56 372.764C290.346 374.183 288.127 375.594 285.907 377.003C283.642 378.443 281.381 379.891 279.119 381.338C274.684 384.175 270.243 387.003 265.799 389.826C263.196 387.86 261.543 385.492 259.734 382.813C257.432 379.465 255.089 376.207 252.52 373.055C249.122 368.864 246.081 364.457 243.017 360.02C240.337 356.141 237.507 352.385 234.645 348.639C233.944 347.722 233.244 346.804 232.544 345.886C232.19 345.421 231.836 344.956 231.471 344.477C228.856 341.031 226.35 337.519 223.876 333.97C222.068 331.395 220.171 328.922 218.188 326.48C214.782 322.267 211.726 317.844 208.65 313.389C205.969 309.51 203.14 305.755 200.277 302.009C199.577 301.091 198.877 300.173 198.177 299.255C197.823 298.79 197.468 298.326 197.103 297.847C194.79 294.798 192.553 291.706 190.364 288.567C188.267 285.56 186.094 282.644 183.786 279.794C179.935 275.035 176.476 270.016 173.005 264.978C176.445 262.305 179.941 259.802 183.612 257.457C184.099 257.143 184.587 256.829 185.089 256.505C186.679 255.481 188.271 254.461 189.863 253.441C190.975 252.726 192.086 252.011 193.197 251.296C196.106 249.425 199.016 247.557 201.927 245.689C204.903 243.779 207.878 241.866 210.853 239.953C216.678 236.208 222.505 232.466 228.333 228.726C230.86 230.623 232.252 232.791 233.788 235.512C234.053 235.974 234.319 236.435 234.592 236.911C236.235 239.797 237.775 242.723 239.261 245.694C241.392 249.953 243.79 254.007 246.245 258.083C248.04 261.081 249.715 264.098 251.272 267.229C253.667 272.041 256.413 276.612 259.173 281.219C261.596 285.264 263.845 289.394 266.071 293.549C266.617 294.566 267.163 295.584 267.709 296.601C267.986 297.115 268.262 297.63 268.547 298.161C270.366 301.528 272.256 304.843 274.208 308.135C276.068 311.27 277.812 314.435 279.438 317.698C281.864 322.542 284.628 327.154 287.41 331.798C289.839 335.853 292.092 339.995 294.328 344.159C294.597 344.658 294.866 345.158 295.143 345.673C295.7 346.71 296.256 347.748 296.81 348.786C298.15 351.28 299.518 353.74 300.998 356.154C301.259 356.583 301.519 357.012 301.788 357.454C302.503 358.619 303.23 359.775 303.958 360.931C304.8 362.85 304.8 362.85 304.406 364.173Z" fill="var(--primary-foreground, #ffffff)"/>
15
- <path d="M147.908 159.434C143.029 162.624 138.255 165.222 132.524 166.53C131.568 166.759 131.568 166.759 130.593 166.992C117.641 169.419 104.681 165.652 93.8424 158.557C84.6301 151.709 78.5873 142.443 75.2903 131.528C75.0234 130.675 75.0234 130.675 74.7511 129.804C72.9741 122.986 73.9008 115.665 74.4194 108.713C75.7267 91.1539 72.9686 78.0313 62.8484 63.365C61.808 61.5353 61.808 61.5353 62.2756 59.3756C74.2777 52.1095 87.8993 50.9005 101.359 53.9904C102.212 54.1829 103.066 54.3753 103.945 54.5736C110.197 56.0433 115.833 57.7788 121.484 60.8918C121.926 61.1331 122.368 61.3745 122.823 61.6232C141.727 72.123 158.382 89.1592 164.804 110.159C170.072 129.189 164.608 147.982 147.908 159.434Z" fill="var(--primary-foreground, #ffffff)"/>
16
- <path d="M224.945 222.724C223.467 224.948 221.157 226.154 218.937 227.554C218.142 228.066 218.142 228.067 217.331 228.589C215.58 229.716 213.822 230.833 212.065 231.95C210.849 232.73 209.634 233.51 208.418 234.291C205.22 236.344 202.016 238.389 198.811 240.432C195.542 242.519 192.277 244.613 189.012 246.706C182.605 250.813 176.192 254.911 169.776 259.003C163.425 254.055 159.038 246.461 154.501 239.887C151.859 236.063 149.162 232.301 146.129 228.777C140.59 220.962 138.709 211.47 139.907 202.042C141.806 192.774 145.937 185.415 153.125 179.281C153.821 178.654 154.516 178.028 155.232 177.382C161.199 173.349 167.362 171.636 174.492 171.096C175.187 171.029 175.187 171.029 175.896 170.961C185.36 171.183 194.837 174.7 201.562 181.385C202.406 182.334 203.235 183.298 204.044 184.277C204.596 184.933 204.596 184.933 205.159 185.602C207.879 189.006 209.907 192.696 211.94 196.538C212.966 198.458 213.996 200.376 215.027 202.293C215.301 202.803 215.574 203.312 215.856 203.837C218.216 208.207 220.709 212.489 223.254 216.754C225.579 220.827 225.579 220.827 224.945 222.724Z" fill="var(--primary-foreground, #ffffff)"/>
17
- <path d="M346.445 469.84C341.579 473.016 337.792 473.996 331.992 473.069C323.666 471.041 319.697 464.544 315.142 457.786C314.41 456.773 313.671 455.764 312.923 454.762C312.555 454.269 312.187 453.775 311.808 453.267C310.744 451.858 309.676 450.454 308.605 449.052C304.588 443.792 300.674 438.482 296.873 433.064C294.268 429.365 291.554 425.754 288.807 422.16C288.108 421.244 287.41 420.328 286.711 419.412C286.181 418.717 286.181 418.717 285.639 418.007C283.312 414.94 281.064 411.828 278.863 408.669C275.954 404.511 272.86 400.557 269.591 396.676C270.596 393.987 272.077 392.99 274.463 391.469C275.568 390.758 275.568 390.758 276.694 390.032C277.891 389.276 277.891 389.276 279.111 388.505C279.926 387.983 280.74 387.461 281.58 386.923C283.742 385.538 285.909 384.16 288.077 382.784C290.29 381.378 292.498 379.965 294.707 378.552C299.039 375.782 303.376 373.02 307.716 370.264C310.189 371.73 310.549 372.854 311.779 375.43C313.714 379.343 315.815 383.09 318.072 386.826C320.626 391.064 322.954 395.349 325.158 399.782C326.672 402.673 328.329 405.458 330.013 408.252C332.566 412.491 334.894 416.776 337.098 421.209C338.613 424.099 340.27 426.884 341.953 429.678C344.974 434.704 347.722 439.785 350.305 445.052C350.628 445.646 350.95 446.239 351.282 446.851C355.467 454.895 353.749 464.19 346.445 469.84Z" fill="var(--primary-foreground, #ffffff)"/>
18
- <path d="M175.175 164.461C174.611 164.495 174.047 164.529 173.466 164.565C161.822 165.517 151.451 170.117 143.632 178.98C141.188 182.058 138.963 185.278 136.798 188.557C134.916 187.16 133.636 185.817 132.364 183.853C132.04 183.352 131.717 182.852 131.383 182.336C131.053 181.817 130.724 181.297 130.384 180.762C130.043 180.241 129.703 179.719 129.351 179.182C129.031 178.682 128.711 178.182 128.381 177.668C128.089 177.211 127.796 176.755 127.495 176.285C126.898 175.109 126.898 175.109 127.21 173.669C127.885 173.594 127.885 173.594 128.573 173.517C144.325 171.353 156.368 162.585 166.151 150.449C168.977 152.315 170.506 155.002 172.283 157.806C172.597 158.285 172.911 158.765 173.234 159.26C175.527 162.839 175.527 162.839 175.175 164.461Z" fill="var(--primary-foreground, #ffffff)"/>
19
- </g>
20
- </g>
21
- <defs>
22
- <clipPath id="nikala-logo-clip0">
23
- <rect width="223" height="223" rx="10" fill="white"/>
24
- </clipPath>
25
- <clipPath id="nikala-logo-clip1">
26
- <rect width="377.121" height="377.121" fill="white" transform="translate(431.932 116.81) rotate(102.218)"/>
27
- </clipPath>
28
- </defs>
11
+ return (<svg viewBox="0 0 111 134" fill="none" xmlns="http://www.w3.org/2000/svg" class={cn("h-7 w-auto shrink-0 select-none text-primary", local.class)} {...rest}>
12
+ <path d="M36.1777 0.00543119C36.9886 0.00499311 37.7994 0.00455503 38.6349 0.00410368C41.2808 0.00617229 43.9262 0.0294108 46.572 0.0530386C48.42 0.0586414 50.268 0.0629083 52.1161 0.0659018C56.9543 0.0772964 61.7923 0.106717 66.6305 0.140014C71.5778 0.170831 76.5251 0.184432 81.4724 0.199523C91.1607 0.231592 100.849 0.282723 110.537 0.346007C110.61 3.53599 110.654 6.72575 110.693 9.91632C110.725 11.2608 110.725 11.2608 110.757 12.6324C110.828 20.4476 109.466 26.0515 104.537 32.346C98.5344 38.2899 92.6817 40.5932 84.2432 40.6014C83.527 40.605 82.8108 40.6086 82.0729 40.6124C80.5233 40.6192 78.9737 40.6218 77.4242 40.6204C74.9635 40.6194 72.503 40.6324 70.0426 40.6494C63.0485 40.6955 56.0544 40.7202 49.06 40.7269C44.7747 40.7319 40.4898 40.7563 36.2046 40.7922C34.5801 40.8019 32.9555 40.8044 31.331 40.799C19.2921 40.7614 9.61779 41.743 0.536854 50.346C0.448685 46.7003 0.396074 43.0549 0.349354 39.4085C0.324217 38.3869 0.29908 37.3653 0.273182 36.3128C0.173253 25.8869 2.62732 17.3394 9.53685 9.34601C17.2641 2.66649 26.0794 -0.141013 36.1777 0.00543119Z" fill="currentColor"/>
13
+ <path d="M22.0491 48.169C22.9608 48.1562 23.8728 48.1434 24.8118 48.1301C26.2884 48.119 26.2884 48.119 27.7947 48.1077C28.8123 48.0997 29.83 48.0916 30.8784 48.0833C33.0354 48.0694 35.1924 48.0587 37.3494 48.0509C40.6285 48.0337 43.9065 47.9898 47.1853 47.9456C49.2843 47.9355 51.3833 47.927 53.4822 47.9202C54.4544 47.9027 55.4266 47.8852 56.4283 47.8672C63.3556 47.889 69.7844 49.012 75.1263 53.7582C79.2822 58.4605 81.032 62.8674 80.8533 69.1585C80.0862 74.4616 77.9359 78.9471 74.1619 82.721C73.2957 83.2573 72.4295 83.7935 71.5369 84.346C70.7322 84.8676 69.9275 85.3892 69.0984 85.9266C64.0178 87.9514 59.3464 87.7288 53.9275 87.682C51.6228 87.6945 49.3182 87.7075 47.0135 87.721C43.4017 87.7249 39.7902 87.721 36.1785 87.7064C32.6778 87.6978 29.1782 87.7196 25.6775 87.7445C24.6105 87.7311 23.5435 87.7178 22.4442 87.704C13.6607 87.7897 7.75397 90.5347 0.536912 95.346C0.386963 91.1144 0.278963 86.8842 0.207322 82.6507C0.177416 81.2152 0.136674 79.7799 0.0842755 78.345C-0.242774 69.1492 0.0895104 61.5914 6.53691 54.346C11.3525 50.524 15.8247 48.2455 22.0491 48.169Z" fill="currentColor"/>
14
+ <path d="M20.8612 95.2484C21.8892 95.2516 22.9173 95.2548 23.9764 95.2581C25.5842 95.2707 25.5842 95.2707 27.2245 95.2835C28.3079 95.288 29.3912 95.2926 30.5077 95.2972C33.1842 95.309 35.8606 95.3255 38.537 95.346C38.6543 99.0124 38.7246 102.678 38.787 106.346C38.8205 107.376 38.854 108.406 38.8885 109.467C38.9806 116.694 38.1397 122.373 33.1595 127.865C28.2702 132.292 23.1029 133.85 16.5526 133.662C10.763 132.754 6.1827 128.721 2.53699 124.346C0.114874 119.156 -0.478718 113.766 1.15417 108.268C3.56015 102.689 7.36624 99.4145 12.537 96.346C15.5962 95.3263 17.6612 95.2307 20.8612 95.2484Z" fill="currentColor"/>
29
15
  </svg>);
30
16
  };
@@ -4,6 +4,7 @@ import { Button } from "@/components/ui/button";
4
4
  import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
5
5
  import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
6
6
  import { createClipboard } from "@/hooks/create-clipboard";
7
+ import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
7
8
  import { cn } from "@/lib/cn";
8
9
  /**
9
10
  * Automatically formats a command string for a specific package manager.
@@ -125,6 +126,7 @@ export const PackageManagerTabs = (props) => {
125
126
  return "";
126
127
  });
127
128
  const clipboard = createClipboard();
129
+ const siteLocale = useSiteLocale();
128
130
  const copyable = () => local.copyable ?? true;
129
131
  const handleCopy = async () => {
130
132
  const text = currentCommand();
@@ -149,13 +151,13 @@ export const PackageManagerTabs = (props) => {
149
151
  {/* Copy Button */}
150
152
  <Show when={copyable() && currentCommand()}>
151
153
  <Tooltip>
152
- <TooltipTrigger as={Button} variant="ghost" size="icon" onClick={handleCopy} aria-label={clipboard.copied() ? "Copied command" : "Copy command"} class="size-6 p-0 rounded-xs text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer">
154
+ <TooltipTrigger as={Button} variant="ghost" size="icon" onClick={handleCopy} aria-label={clipboard.copied() ? siteLocale.t("code.copied") : siteLocale.t("code.copy")} class="size-6 p-0 rounded-xs text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer">
153
155
  <Show when={clipboard.copied()} fallback={<Copy class="size-3.5"/>}>
154
156
  <Check class="size-3.5 text-emerald-500 dark:text-emerald-400"/>
155
157
  </Show>
156
158
  </TooltipTrigger>
157
159
  <TooltipContent class="text-[10px] py-1 px-2">
158
- {clipboard.copied() ? "Copied!" : "Copy command"}
160
+ {clipboard.copied() ? siteLocale.t("actions.copied") : siteLocale.t("code.copy")}
159
161
  </TooltipContent>
160
162
  </Tooltip>
161
163
  </Show>
@@ -2,11 +2,13 @@ import { splitProps, Show, children } from "solid-js";
2
2
  import { ChevronLeft, ChevronRight } from "lucide-solid";
3
3
  import { Card, CardHeader, CardTitle, CardDescription, } from "@/components/ui/card";
4
4
  import { cn } from "@/lib/cn";
5
+ import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
5
6
  /**
6
7
  * Individual Next or Previous page navigation card.
7
8
  */
8
9
  export const PagerLink = (props) => {
9
10
  const [local, rest] = splitProps(props, ["title", "href", "type", "class"]);
11
+ const siteLocale = useSiteLocale();
10
12
  const isNext = () => local.type === "next";
11
13
  return (<a href={local.href} class={cn("group block rounded-lg transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", isNext() && "sm:col-start-2", local.class)} {...rest}>
12
14
  <Card class="h-full transition-all group-hover:bg-accent/40 group-hover:shadow-2xs">
@@ -14,10 +16,10 @@ export const PagerLink = (props) => {
14
16
  <CardDescription class="flex items-center gap-1 text-xs font-medium text-muted-foreground">
15
17
  <Show when={!isNext()}>
16
18
  <ChevronLeft class="size-3.5 transition-transform group-hover:-translate-x-0.5"/>
17
- <span>Previous</span>
19
+ <span>{siteLocale.t("pagination.previous")}</span>
18
20
  </Show>
19
21
  <Show when={isNext()}>
20
- <span>Next</span>
22
+ <span>{siteLocale.t("pagination.next")}</span>
21
23
  <ChevronRight class="size-3.5 transition-transform group-hover:translate-x-0.5"/>
22
24
  </Show>
23
25
  </CardDescription>
@@ -42,7 +42,7 @@ export const SectionHeading = (props) => {
42
42
  ]);
43
43
  const v = () => local.variant || "section";
44
44
  return (<div class={cn("space-y-2", local.class)} {...rest}>
45
- <div class={cn("flex items-center justify-between gap-2", v() === "section" && "w-full")}>
45
+ <div class={cn("flex justify-between gap-2", v() === "page" ? "flex-col items-start sm:flex-row sm:items-center" : "items-center", v() === "section" && "w-full")}>
46
46
  <div class="flex min-w-0 items-center gap-2">
47
47
  <Show when={v() === "page"}>
48
48
  <h1 class={headingVariants({ variant: v() })}>
@@ -5,6 +5,7 @@ import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip
5
5
  import { Skeleton } from "@/components/ui/skeleton";
6
6
  import { Separator } from "@/components/ui/separator";
7
7
  import { cn } from "@/lib/cn";
8
+ import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
8
9
  /* --- Constants --- */
9
10
  const SIDEBAR_COOKIE_NAME = "nikala_sidebar_state";
10
11
  const SIDEBAR_WIDTH = "17rem";
@@ -140,7 +141,8 @@ export const Sidebar = (props) => {
140
141
  export const SidebarTrigger = (props) => {
141
142
  const [local, rest] = splitProps(props, ["class", "onClick"]);
142
143
  const { toggleSidebar, side, isMobile, openMobile, setOpenMobile } = useSidebar();
143
- return (<button type="button" aria-label="Toggle Sidebar" onClick={(e) => {
144
+ const siteLocale = useSiteLocale();
145
+ return (<button type="button" aria-label={siteLocale.t("navigation.sidebar")} onClick={(e) => {
144
146
  if (typeof local.onClick === "function")
145
147
  local.onClick(e);
146
148
  if (isMobile())
@@ -151,13 +153,14 @@ export const SidebarTrigger = (props) => {
151
153
  <Show when={side() === "right"} fallback={<PanelLeft class="size-4"/>}>
152
154
  <PanelRight class="size-4"/>
153
155
  </Show>
154
- <span class="sr-only">Toggle Sidebar</span>
156
+ <span class="sr-only">{siteLocale.t("navigation.sidebar")}</span>
155
157
  </button>);
156
158
  };
157
159
  export const SidebarRail = (props) => {
158
160
  const [local, rest] = splitProps(props, ["class"]);
159
161
  const { toggleSidebar } = useSidebar();
160
- return (<button type="button" data-sidebar="rail" aria-label="Toggle Sidebar Rail" tabIndex={-1} onClick={toggleSidebar} title="Toggle Sidebar" class={cn("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex cursor-w-resize", local.class)} {...rest}/>);
162
+ const siteLocale = useSiteLocale();
163
+ return (<button type="button" data-sidebar="rail" aria-label={siteLocale.t("navigation.toggleSidebarRail")} tabIndex={-1} onClick={toggleSidebar} title={siteLocale.t("navigation.sidebar")} class={cn("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex cursor-w-resize", local.class)} {...rest}/>);
161
164
  };
162
165
  export const SidebarInset = (props) => {
163
166
  const [local, rest] = splitProps(props, ["class", "children"]);
@@ -1,6 +1,7 @@
1
1
  import { splitProps } from "solid-js";
2
2
  import { cva } from "class-variance-authority";
3
3
  import { cn } from "@/lib/cn";
4
+ import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
4
5
  export const spinnerVariants = cva("inline-block animate-spin rounded-lg border-2 border-current border-r-transparent text-primary", {
5
6
  variants: {
6
7
  size: {
@@ -16,5 +17,6 @@ export const spinnerVariants = cva("inline-block animate-spin rounded-lg border-
16
17
  /** A compact, accessible loading indicator for async UI states. */
17
18
  export const Spinner = (props) => {
18
19
  const [local, rest] = splitProps(props, ["size", "label", "class"]);
19
- return (<span role="status" aria-label={local.label || "Loading"} class={cn(spinnerVariants({ size: local.size }), local.class)} {...rest}/>);
20
+ const siteLocale = useSiteLocale();
21
+ return (<span role="status" aria-label={local.label || siteLocale.t("status.loadingLabel")} class={cn(spinnerVariants({ size: local.size }), local.class)} {...rest}/>);
20
22
  };
@@ -5,6 +5,7 @@ import { runThemeTransition, } from "../../providers/theme-transitions";
5
5
  import { Button } from "./button";
6
6
  import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuSeparator, } from "./dropdown-menu";
7
7
  import { cn } from "@/lib/cn";
8
+ import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
8
9
  const ACCENT_OPTIONS = [
9
10
  { name: "yellow", label: "Yellow", color: "bg-yellow-500" },
10
11
  { name: "red", label: "Red", color: "bg-red-500" },
@@ -24,6 +25,7 @@ const RADIUS_OPTIONS = [
24
25
  * Interactive UI theme switcher supporting button, mini (dropdown), and max (customizer panel) modes with View Transition animations.
25
26
  */
26
27
  export const ThemeToggle = (props) => {
28
+ const siteLocale = useSiteLocale();
27
29
  const [local, rest] = splitProps(props, ["mode", "effect", "variant", "size", "class"]);
28
30
  const { theme, setTheme, accent, setAccent, radius, setRadius } = useTheme();
29
31
  const mode = () => local.mode || "mini";
@@ -51,11 +53,11 @@ export const ThemeToggle = (props) => {
51
53
  };
52
54
  return (<Show when={mode() !== "button"} fallback={
53
55
  /* Button Mode: Direct 1-click Dark/Light switcher without dropdown */
54
- <Button variant={local.variant || "ghost"} size={local.size || "icon"} onClick={handleToggleClick} class={cn("relative cursor-pointer", local.class)} aria-label="Toggle theme" {...rest}>
56
+ <Button variant={local.variant || "ghost"} size={local.size || "icon"} onClick={handleToggleClick} class={cn("relative cursor-pointer", local.class)} aria-label={siteLocale.t("theme.toggle")} {...rest}>
55
57
  <Show when={isDarkMode()} fallback={<Sun class="h-4 w-4 text-foreground transition-transform"/>}>
56
58
  <Moon class="h-4 w-4 text-foreground transition-transform"/>
57
59
  </Show>
58
- <span class="sr-only">Toggle theme</span>
60
+ <span class="sr-only">{siteLocale.t("theme.toggle")}</span>
59
61
  </Button>}>
60
62
  <DropdownMenu placement="bottom-end">
61
63
  <DropdownMenuTrigger as={Button} variant={local.variant || "ghost"} size={local.size || "icon"} class={cn("relative cursor-pointer", local.class)} {...rest}>
@@ -63,7 +65,7 @@ export const ThemeToggle = (props) => {
63
65
  <Show when={isDarkMode()} fallback={<Sun class="h-4 w-4 text-foreground transition-transform"/>}>
64
66
  <Moon class="h-4 w-4 text-foreground transition-transform"/>
65
67
  </Show>
66
- <span class="sr-only">Toggle theme</span>
68
+ <span class="sr-only">{siteLocale.t("theme.toggle")}</span>
67
69
  </DropdownMenuTrigger>
68
70
 
69
71
  <Show when={mode() === "max"} fallback={
@@ -71,17 +73,17 @@ export const ThemeToggle = (props) => {
71
73
  <DropdownMenuContent>
72
74
  <DropdownMenuItem onClick={(e) => changeThemeWithEffect("light", e)}>
73
75
  <Sun class="mr-2 h-4 w-4 text-muted-foreground"/>
74
- Light
76
+ {siteLocale.t("theme.light")}
75
77
  </DropdownMenuItem>
76
78
 
77
79
  <DropdownMenuItem onClick={(e) => changeThemeWithEffect("dark", e)}>
78
80
  <Moon class="mr-2 h-4 w-4 text-muted-foreground"/>
79
- Dark
81
+ {siteLocale.t("theme.dark")}
80
82
  </DropdownMenuItem>
81
83
 
82
84
  <DropdownMenuItem onClick={(e) => changeThemeWithEffect("system", e)}>
83
85
  <Monitor class="mr-2 h-4 w-4 text-muted-foreground"/>
84
- System
86
+ {siteLocale.t("theme.system")}
85
87
  </DropdownMenuItem>
86
88
  </DropdownMenuContent>}>
87
89
  {/* Max Mode: Full Theme Customizer Panel */}
@@ -89,17 +91,17 @@ export const ThemeToggle = (props) => {
89
91
  <div class="p-2 space-y-2">
90
92
  <DropdownMenuGroup>
91
93
  <DropdownMenuLabel class="px-0 pt-0 text-xs font-semibold uppercase tracking-wider text-muted-foreground">
92
- Theme Mode
94
+ {siteLocale.t("theme.mode")}
93
95
  </DropdownMenuLabel>
94
96
  <div class="grid grid-cols-3 gap-1 my-1.5">
95
97
  <Button variant={theme() === "light" ? "default" : "outline"} size="sm" onClick={(e) => changeThemeWithEffect("light", e)} class="h-8 text-xs cursor-pointer">
96
- Light
98
+ {siteLocale.t("theme.light")}
97
99
  </Button>
98
100
  <Button variant={theme() === "dark" ? "default" : "outline"} size="sm" onClick={(e) => changeThemeWithEffect("dark", e)} class="h-8 text-xs cursor-pointer">
99
- Dark
101
+ {siteLocale.t("theme.dark")}
100
102
  </Button>
101
103
  <Button variant={theme() === "system" ? "default" : "outline"} size="sm" onClick={(e) => changeThemeWithEffect("system", e)} class="h-8 text-xs cursor-pointer">
102
- System
104
+ {siteLocale.t("theme.system")}
103
105
  </Button>
104
106
  </div>
105
107
  </DropdownMenuGroup>
@@ -108,7 +110,7 @@ export const ThemeToggle = (props) => {
108
110
 
109
111
  <DropdownMenuGroup>
110
112
  <DropdownMenuLabel class="px-0 text-xs font-semibold uppercase tracking-wider text-muted-foreground">
111
- Brand Accent Color
113
+ {siteLocale.t("theme.brandAccentColor")}
112
114
  </DropdownMenuLabel>
113
115
  <div class="flex flex-wrap gap-1.5 my-1.5">
114
116
  <For each={ACCENT_OPTIONS}>
@@ -123,7 +125,7 @@ export const ThemeToggle = (props) => {
123
125
 
124
126
  <DropdownMenuGroup>
125
127
  <DropdownMenuLabel class="px-0 text-xs font-semibold uppercase tracking-wider text-muted-foreground">
126
- Border Radius
128
+ {siteLocale.t("theme.borderRadius")}
127
129
  </DropdownMenuLabel>
128
130
  <div class="grid grid-cols-5 gap-1 my-1.5">
129
131
  <For each={RADIUS_OPTIONS}>
package/dist/config.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { DocsConfig } from "./types.js";
2
2
  export declare const DEFAULT_DOCS_CONFIG: Required<Pick<DocsConfig, "title" | "description" | "contentDir">> & DocsConfig;
3
3
  export declare function defineDocsConfig(config: DocsConfig): DocsConfig;
4
+ export declare function resolvePluginConfig(config: DocsConfig): DocsConfig;
4
5
  export declare const loadConfig: typeof resolveDocsConfig;
5
6
  export declare function resolveDocsConfig(cwd?: string): Promise<DocsConfig>;
package/dist/config.js CHANGED
@@ -2,6 +2,8 @@
2
2
  import path from "node:path";
3
3
  import { pathToFileURL } from "node:url";
4
4
  import fs from "fs-extra";
5
+ import { validateFolioPlugins } from "./plugin.js";
6
+ import { loadSiteTranslations } from "./plugins/i18n/site-locale.js";
5
7
  export const DEFAULT_DOCS_CONFIG = {
6
8
  title: "Folio",
7
9
  description: "Documentation built with Nikala UI",
@@ -41,10 +43,31 @@ export const DEFAULT_DOCS_CONFIG = {
41
43
  enabled: true,
42
44
  provider: "local",
43
45
  },
46
+ uiLocale: {
47
+ defaultLocale: "en",
48
+ directory: "locales",
49
+ locale: "en",
50
+ },
44
51
  };
45
52
  export function defineDocsConfig(config) {
53
+ validateFolioPlugins(config.plugins);
54
+ if (config.uiLocale !== undefined) {
55
+ throw new Error("[folio] Configure site translations through createI18nPlugin() in DocsConfig.plugins");
56
+ }
46
57
  return config;
47
58
  }
59
+ export function resolvePluginConfig(config) {
60
+ validateFolioPlugins(config.plugins);
61
+ const pluginConfig = config.plugins?.reduce((merged, plugin) => ({ ...merged, ...(plugin.config || {}) }), {}) || {};
62
+ return {
63
+ ...config,
64
+ ...pluginConfig,
65
+ uiLocale: {
66
+ ...(config.uiLocale || {}),
67
+ ...(pluginConfig.uiLocale || {}),
68
+ },
69
+ };
70
+ }
48
71
  const CONFIG_FILENAMES = [
49
72
  "docs.config.ts",
50
73
  "docs.config.js",
@@ -56,6 +79,7 @@ const CONFIG_FILENAMES = [
56
79
  "nikala.config.ts",
57
80
  "nikala.config.js",
58
81
  ];
82
+ let configReloadRevision = 0;
59
83
  export const loadConfig = resolveDocsConfig;
60
84
  export async function resolveDocsConfig(cwd = process.cwd()) {
61
85
  for (const filename of CONFIG_FILENAMES) {
@@ -64,41 +88,72 @@ export async function resolveDocsConfig(cwd = process.cwd()) {
64
88
  try {
65
89
  // Config is reloaded by the dev watcher without restarting the
66
90
  // process. Bust Bun/Node's ESM module cache so changed values apply.
67
- const mod = await import(`${pathToFileURL(fullPath).href}?t=${Date.now()}`);
68
- const resolvedUserConfig = mod.default || mod.config || {};
69
- return {
70
- ...DEFAULT_DOCS_CONFIG,
71
- ...resolvedUserConfig,
72
- theme: {
73
- ...DEFAULT_DOCS_CONFIG.theme,
74
- ...resolvedUserConfig.theme,
75
- },
76
- navigation: {
77
- ...DEFAULT_DOCS_CONFIG.navigation,
78
- ...resolvedUserConfig.navigation,
79
- sidebar: {
80
- ...DEFAULT_DOCS_CONFIG.navigation?.sidebar,
81
- ...resolvedUserConfig.navigation?.sidebar,
91
+ const cacheKey = `${Date.now()}-${++configReloadRevision}`;
92
+ let importPath = fullPath;
93
+ let temporaryConfigPath;
94
+ if (process.versions.bun) {
95
+ temporaryConfigPath = path.join(path.dirname(fullPath), `.folio-config-${cacheKey}-${path.basename(fullPath)}`);
96
+ await fs.copyFile(fullPath, temporaryConfigPath);
97
+ importPath = temporaryConfigPath;
98
+ }
99
+ try {
100
+ const mod = await import(`${pathToFileURL(importPath).href}?t=${cacheKey}`);
101
+ const resolvedUserConfig = mod.default || mod.config || {};
102
+ if (resolvedUserConfig.uiLocale !== undefined) {
103
+ throw new Error("[folio] Configure site translations through createI18nPlugin() in DocsConfig.plugins");
104
+ }
105
+ const resolvedPluginConfig = resolvePluginConfig(resolvedUserConfig);
106
+ const pluginConfig = resolvedPluginConfig;
107
+ const mergedConfig = {
108
+ ...DEFAULT_DOCS_CONFIG,
109
+ ...pluginConfig,
110
+ ...resolvedUserConfig,
111
+ theme: {
112
+ ...DEFAULT_DOCS_CONFIG.theme,
113
+ ...resolvedUserConfig.theme,
114
+ },
115
+ navigation: {
116
+ ...DEFAULT_DOCS_CONFIG.navigation,
117
+ ...resolvedUserConfig.navigation,
118
+ sidebar: {
119
+ ...DEFAULT_DOCS_CONFIG.navigation?.sidebar,
120
+ ...resolvedUserConfig.navigation?.sidebar,
121
+ },
122
+ },
123
+ shiki: {
124
+ ...DEFAULT_DOCS_CONFIG.shiki,
125
+ ...resolvedUserConfig.shiki,
126
+ themes: {
127
+ ...DEFAULT_DOCS_CONFIG.shiki?.themes,
128
+ ...resolvedUserConfig.shiki?.themes,
129
+ },
130
+ },
131
+ seo: {
132
+ ...resolvedUserConfig.seo,
133
+ },
134
+ search: {
135
+ ...DEFAULT_DOCS_CONFIG.search,
136
+ ...resolvedUserConfig.search,
82
137
  },
83
- },
84
- shiki: {
85
- ...DEFAULT_DOCS_CONFIG.shiki,
86
- ...resolvedUserConfig.shiki,
87
- themes: {
88
- ...DEFAULT_DOCS_CONFIG.shiki?.themes,
89
- ...resolvedUserConfig.shiki?.themes,
138
+ uiLocale: {
139
+ ...DEFAULT_DOCS_CONFIG.uiLocale,
140
+ ...pluginConfig.uiLocale,
90
141
  },
91
- },
92
- search: {
93
- ...DEFAULT_DOCS_CONFIG.search,
94
- ...resolvedUserConfig.search,
95
- },
96
- };
142
+ };
143
+ mergedConfig.uiLocale = await loadSiteTranslations(cwd, mergedConfig.uiLocale);
144
+ return mergedConfig;
145
+ }
146
+ finally {
147
+ if (temporaryConfigPath)
148
+ await fs.remove(temporaryConfigPath);
149
+ }
97
150
  }
98
151
  catch (error) {
152
+ if (error instanceof Error && error.message.startsWith("[folio]"))
153
+ throw error;
99
154
  console.warn(`[folio] Failed to load config from ${filename}:`, error);
100
155
  }
101
156
  }
102
157
  }
103
- return DEFAULT_DOCS_CONFIG;
158
+ return { ...DEFAULT_DOCS_CONFIG, uiLocale: await loadSiteTranslations(cwd, DEFAULT_DOCS_CONFIG.uiLocale) };
104
159
  }
@@ -1,9 +1,10 @@
1
1
  import type { PageData, TocItem } from "../types.js";
2
+ import { formatTitleFromFilename } from "../utils/format-title.js";
3
+ export { formatTitleFromFilename };
2
4
  export declare function slugify(text: string): string;
3
5
  export declare function extractToc(content: string): TocItem[];
4
6
  export declare function extractTitle(content: string, fallback: string): string;
5
7
  export declare function filePathToUrl(relativeFilePath: string): string;
6
- export declare function formatTitleFromFilename(filename: string): string;
7
8
  export declare function parseMdxFile(filePath: string, contentDir: string): Promise<PageData>;
8
9
  export declare function scanContent(contentDir: string): Promise<PageData[]>;
9
10
  export declare function scanContentDirectories(contentDir: string): Promise<string[]>;
@@ -2,6 +2,8 @@
2
2
  import path from "node:path";
3
3
  import fs from "fs-extra";
4
4
  import matter from "gray-matter";
5
+ import { formatTitleFromFilename } from "../utils/format-title.js";
6
+ export { formatTitleFromFilename };
5
7
  function isWhitespace(character) {
6
8
  if (!character)
7
9
  return false;
@@ -142,15 +144,6 @@ export function filePathToUrl(relativeFilePath) {
142
144
  }
143
145
  return cleanPath.startsWith("/") ? cleanPath : `/${cleanPath}`;
144
146
  }
145
- export function formatTitleFromFilename(filename) {
146
- const base = path.basename(filename, path.extname(filename));
147
- if (base === "index")
148
- return "Overview";
149
- return base
150
- .split(/[-_]/)
151
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
152
- .join(" ");
153
- }
154
147
  export async function parseMdxFile(filePath, contentDir) {
155
148
  const raw = await fs.readFile(filePath, "utf-8");
156
149
  const parsed = matter(raw);
@@ -0,0 +1,2 @@
1
+ export { createFolioPluginLifecycleManager, FolioPluginHookError, FolioPluginLifecycleManager, } from "./lifecycle.js";
2
+ export type { FolioPluginHookMetadata, FolioPluginLifecycleOptions, LifecycleHook, } from "./lifecycle.js";
@@ -0,0 +1 @@
1
+ export { createFolioPluginLifecycleManager, FolioPluginHookError, FolioPluginLifecycleManager, } from "./lifecycle.js";
@@ -0,0 +1,19 @@
1
+ import type { FolioPage, FolioPluginContext } from "../../plugin.js";
2
+ export type LifecycleHook = "configResolved" | "buildStart" | "pagesGenerated" | "pageCollected" | "pageTransformed" | "pageActions" | "generate" | "buildEnd";
3
+ export interface FolioPluginHookMetadata {
4
+ pluginName: string;
5
+ hook: LifecycleHook;
6
+ mode: FolioPluginContext["mode"];
7
+ pageRoute?: string;
8
+ sourcePath?: string;
9
+ }
10
+ export declare class FolioPluginHookError extends Error {
11
+ readonly pluginName: string;
12
+ readonly hook: LifecycleHook;
13
+ readonly mode: FolioPluginContext["mode"];
14
+ readonly pageRoute?: string;
15
+ readonly sourcePath?: string;
16
+ readonly metadata: FolioPluginHookMetadata;
17
+ readonly cause: unknown;
18
+ constructor(pluginName: string, hook: LifecycleHook, cause: unknown, mode?: FolioPluginContext["mode"], page?: FolioPage);
19
+ }