@raystack/chronicle 0.1.0-canary.5a2be79

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/bin/chronicle.js +2 -0
  2. package/dist/cli/index.js +9980 -0
  3. package/next.config.mjs +10 -0
  4. package/package.json +63 -0
  5. package/source.config.ts +50 -0
  6. package/src/app/[[...slug]]/layout.tsx +15 -0
  7. package/src/app/[[...slug]]/page.tsx +57 -0
  8. package/src/app/api/apis-proxy/route.ts +59 -0
  9. package/src/app/api/health/route.ts +3 -0
  10. package/src/app/api/search/route.ts +90 -0
  11. package/src/app/apis/[[...slug]]/layout.module.css +22 -0
  12. package/src/app/apis/[[...slug]]/layout.tsx +26 -0
  13. package/src/app/apis/[[...slug]]/page.tsx +57 -0
  14. package/src/app/layout.tsx +26 -0
  15. package/src/app/llms-full.txt/route.ts +18 -0
  16. package/src/app/llms.txt/route.ts +15 -0
  17. package/src/app/providers.tsx +8 -0
  18. package/src/cli/commands/build.ts +32 -0
  19. package/src/cli/commands/dev.ts +33 -0
  20. package/src/cli/commands/init.ts +155 -0
  21. package/src/cli/commands/serve.ts +53 -0
  22. package/src/cli/commands/start.ts +33 -0
  23. package/src/cli/index.ts +21 -0
  24. package/src/cli/utils/config.ts +43 -0
  25. package/src/cli/utils/index.ts +3 -0
  26. package/src/cli/utils/process.ts +7 -0
  27. package/src/cli/utils/resolve.ts +4 -0
  28. package/src/cli/utils/scaffold.ts +131 -0
  29. package/src/components/api/code-snippets.module.css +7 -0
  30. package/src/components/api/code-snippets.tsx +76 -0
  31. package/src/components/api/endpoint-page.module.css +58 -0
  32. package/src/components/api/endpoint-page.tsx +283 -0
  33. package/src/components/api/field-row.module.css +126 -0
  34. package/src/components/api/field-row.tsx +204 -0
  35. package/src/components/api/field-section.module.css +24 -0
  36. package/src/components/api/field-section.tsx +100 -0
  37. package/src/components/api/index.ts +8 -0
  38. package/src/components/api/json-editor.module.css +9 -0
  39. package/src/components/api/json-editor.tsx +61 -0
  40. package/src/components/api/key-value-editor.module.css +13 -0
  41. package/src/components/api/key-value-editor.tsx +62 -0
  42. package/src/components/api/method-badge.module.css +4 -0
  43. package/src/components/api/method-badge.tsx +29 -0
  44. package/src/components/api/response-panel.module.css +8 -0
  45. package/src/components/api/response-panel.tsx +44 -0
  46. package/src/components/common/breadcrumb.tsx +3 -0
  47. package/src/components/common/button.tsx +3 -0
  48. package/src/components/common/callout.module.css +7 -0
  49. package/src/components/common/callout.tsx +27 -0
  50. package/src/components/common/code-block.tsx +3 -0
  51. package/src/components/common/dialog.tsx +3 -0
  52. package/src/components/common/index.ts +10 -0
  53. package/src/components/common/input-field.tsx +3 -0
  54. package/src/components/common/sidebar.tsx +3 -0
  55. package/src/components/common/switch.tsx +3 -0
  56. package/src/components/common/table.tsx +3 -0
  57. package/src/components/common/tabs.tsx +3 -0
  58. package/src/components/mdx/code.module.css +42 -0
  59. package/src/components/mdx/code.tsx +27 -0
  60. package/src/components/mdx/details.module.css +37 -0
  61. package/src/components/mdx/details.tsx +18 -0
  62. package/src/components/mdx/image.tsx +38 -0
  63. package/src/components/mdx/index.tsx +35 -0
  64. package/src/components/mdx/link.tsx +38 -0
  65. package/src/components/mdx/mermaid.module.css +9 -0
  66. package/src/components/mdx/mermaid.tsx +37 -0
  67. package/src/components/mdx/paragraph.module.css +8 -0
  68. package/src/components/mdx/paragraph.tsx +19 -0
  69. package/src/components/mdx/table.tsx +40 -0
  70. package/src/components/ui/breadcrumbs.tsx +72 -0
  71. package/src/components/ui/client-theme-switcher.tsx +18 -0
  72. package/src/components/ui/footer.module.css +27 -0
  73. package/src/components/ui/footer.tsx +30 -0
  74. package/src/components/ui/search.module.css +104 -0
  75. package/src/components/ui/search.tsx +202 -0
  76. package/src/lib/api-routes.ts +120 -0
  77. package/src/lib/config.ts +55 -0
  78. package/src/lib/get-llm-text.ts +10 -0
  79. package/src/lib/index.ts +2 -0
  80. package/src/lib/openapi.ts +188 -0
  81. package/src/lib/remark-unused-directives.ts +30 -0
  82. package/src/lib/schema.ts +99 -0
  83. package/src/lib/snippet-generators.ts +87 -0
  84. package/src/lib/source.ts +67 -0
  85. package/src/themes/default/Layout.module.css +81 -0
  86. package/src/themes/default/Layout.tsx +133 -0
  87. package/src/themes/default/Page.module.css +46 -0
  88. package/src/themes/default/Page.tsx +21 -0
  89. package/src/themes/default/Toc.module.css +48 -0
  90. package/src/themes/default/Toc.tsx +66 -0
  91. package/src/themes/default/font.ts +6 -0
  92. package/src/themes/default/index.ts +13 -0
  93. package/src/themes/paper/ChapterNav.module.css +71 -0
  94. package/src/themes/paper/ChapterNav.tsx +96 -0
  95. package/src/themes/paper/Layout.module.css +33 -0
  96. package/src/themes/paper/Layout.tsx +25 -0
  97. package/src/themes/paper/Page.module.css +174 -0
  98. package/src/themes/paper/Page.tsx +107 -0
  99. package/src/themes/paper/ReadingProgress.module.css +132 -0
  100. package/src/themes/paper/ReadingProgress.tsx +294 -0
  101. package/src/themes/paper/index.ts +8 -0
  102. package/src/themes/registry.ts +14 -0
  103. package/src/types/config.ts +69 -0
  104. package/src/types/content.ts +35 -0
  105. package/src/types/index.ts +3 -0
  106. package/src/types/theme.ts +22 -0
  107. package/tsconfig.json +30 -0
@@ -0,0 +1,14 @@
1
+ import type { Theme } from '@/types'
2
+ import { defaultTheme } from './default'
3
+ import { paperTheme } from './paper'
4
+
5
+ const themes: Record<string, Theme> = {
6
+ default: defaultTheme,
7
+ paper: paperTheme,
8
+ }
9
+
10
+ export function getTheme(name?: string): Theme {
11
+ if (!name || !themes[name]) return defaultTheme
12
+
13
+ return themes[name]
14
+ }
@@ -0,0 +1,69 @@
1
+ export interface ChronicleConfig {
2
+ title: string
3
+ description?: string
4
+ logo?: LogoConfig
5
+ theme?: ThemeConfig
6
+ navigation?: NavigationConfig
7
+ search?: SearchConfig
8
+ footer?: FooterConfig
9
+ api?: ApiConfig[]
10
+ llms?: LlmsConfig
11
+ }
12
+
13
+ export interface LlmsConfig {
14
+ enabled?: boolean
15
+ }
16
+
17
+ export interface ApiConfig {
18
+ name: string
19
+ spec: string
20
+ basePath: string
21
+ server: ApiServerConfig
22
+ auth?: ApiAuthConfig
23
+ }
24
+
25
+ export interface ApiServerConfig {
26
+ url: string
27
+ description?: string
28
+ }
29
+
30
+ export interface ApiAuthConfig {
31
+ type: string
32
+ header: string
33
+ placeholder?: string
34
+ }
35
+
36
+ export interface LogoConfig {
37
+ light?: string
38
+ dark?: string
39
+ }
40
+
41
+ export interface ThemeConfig {
42
+ name: 'default' | 'paper'
43
+ colors?: Record<string, string>
44
+ }
45
+
46
+ export interface NavigationConfig {
47
+ links?: NavLink[]
48
+ social?: SocialLink[]
49
+ }
50
+
51
+ export interface NavLink {
52
+ label: string
53
+ href: string
54
+ }
55
+
56
+ export interface SocialLink {
57
+ type: 'github' | 'twitter' | 'discord' | string
58
+ href: string
59
+ }
60
+
61
+ export interface SearchConfig {
62
+ enabled?: boolean
63
+ placeholder?: string
64
+ }
65
+
66
+ export interface FooterConfig {
67
+ copyright?: string
68
+ links?: NavLink[]
69
+ }
@@ -0,0 +1,35 @@
1
+ import type { ReactNode } from 'react'
2
+
3
+ export interface Frontmatter {
4
+ title: string
5
+ description?: string
6
+ order?: number
7
+ icon?: string
8
+ }
9
+
10
+ export interface Page {
11
+ slug: string[]
12
+ frontmatter: Frontmatter
13
+ content: ReactNode
14
+ toc: TocItem[]
15
+ }
16
+
17
+ export interface TocItem {
18
+ title: string
19
+ url: string
20
+ depth: number
21
+ }
22
+
23
+ export interface PageTreeItem {
24
+ type: 'page' | 'folder' | 'separator'
25
+ name: string
26
+ url?: string
27
+ order?: number
28
+ icon?: string
29
+ children?: PageTreeItem[]
30
+ }
31
+
32
+ export interface PageTree {
33
+ name: string
34
+ children: PageTreeItem[]
35
+ }
@@ -0,0 +1,3 @@
1
+ export * from './config'
2
+ export * from './content'
3
+ export * from './theme'
@@ -0,0 +1,22 @@
1
+ import type { ReactNode } from 'react'
2
+ import type { ChronicleConfig } from './config'
3
+ import type { Page, PageTree } from './content'
4
+
5
+ export interface ThemeLayoutProps {
6
+ children: ReactNode
7
+ config: ChronicleConfig
8
+ tree: PageTree
9
+ classNames?: { layout?: string; body?: string; sidebar?: string; content?: string }
10
+ }
11
+
12
+ export interface ThemePageProps {
13
+ page: Page
14
+ config: ChronicleConfig
15
+ tree: PageTree
16
+ }
17
+
18
+ export interface Theme {
19
+ Layout: React.ComponentType<ThemeLayoutProps>
20
+ Page: React.ComponentType<ThemePageProps>
21
+ className?: string
22
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": false,
4
+ "declaration": true,
5
+ "declarationMap": true,
6
+ "esModuleInterop": true,
7
+ "forceConsistentCasingInFileNames": true,
8
+ "inlineSources": false,
9
+ "isolatedModules": true,
10
+ "noUnusedLocals": false,
11
+ "noUnusedParameters": false,
12
+ "preserveWatchOutput": true,
13
+ "skipLibCheck": true,
14
+ "strict": true,
15
+ "jsx": "react-jsx",
16
+ "module": "ESNext",
17
+ "target": "es6",
18
+ "outDir": "dist",
19
+ "rootDir": ".",
20
+ "baseUrl": ".",
21
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
22
+ "moduleResolution": "bundler",
23
+ "paths": {
24
+ "@/*": ["./src/*"],
25
+ "@/.source/*": ["./.source/*"]
26
+ }
27
+ },
28
+ "include": ["src", ".source", "source.config.ts"],
29
+ "exclude": ["node_modules", "dist"]
30
+ }