@cyguin/docs 0.1.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.
package/src/styles.css ADDED
@@ -0,0 +1,11 @@
1
+ :root {
2
+ --cyguin-docs-bg: var(--cyguin-bg, #ffffff);
3
+ --cyguin-docs-text: var(--cyguin-fg, #0a0a0a);
4
+ --cyguin-docs-border: var(--cyguin-border, #e5e5e5);
5
+ --cyguin-docs-accent: var(--cyguin-accent, #f5a800);
6
+ --cyguin-docs-muted: var(--cyguin-fg-muted, #888888);
7
+ --cyguin-docs-backdrop-opacity: 0.5;
8
+ --cyguin-docs-radius: var(--cyguin-radius, 6px);
9
+ --cyguin-docs-shadow: var(--cyguin-shadow, 0 1px 4px rgba(0,0,0,0.08));
10
+ --cyguin-docs-font: system-ui, sans-serif;
11
+ }
package/src/types.ts ADDED
@@ -0,0 +1,62 @@
1
+ export interface DocArticle {
2
+ id: string
3
+ title: string
4
+ body_md: string
5
+ section: string
6
+ article_order: number
7
+ published_at: number | null
8
+ }
9
+
10
+ export interface CreateArticleInput {
11
+ title: string
12
+ body_md: string
13
+ section: string
14
+ article_order: number
15
+ published_at?: number | null
16
+ }
17
+
18
+ export interface UpdateArticleInput {
19
+ title?: string
20
+ body_md?: string
21
+ }
22
+
23
+ export interface DocsAdapter {
24
+ list(params?: { section?: string; published?: boolean }): Promise<DocArticle[]>
25
+ get(id: string): Promise<DocArticle | null>
26
+ create(data: CreateArticleInput): Promise<DocArticle>
27
+ update(id: string, data: Partial<UpdateArticleInput>): Promise<DocArticle>
28
+ delete(id: string): Promise<void>
29
+ reorder(id: string, newOrder: number): Promise<void>
30
+ moveSection(id: string, newSection: string): Promise<void>
31
+ }
32
+
33
+ export interface DocsHandlerOptions {
34
+ adapter?: DocsAdapter
35
+ secret?: string
36
+ }
37
+
38
+ export type NextHandler = (
39
+ req: Request,
40
+ context?: { params?: Record<string, string | string[]> }
41
+ ) => Promise<Response>
42
+
43
+ export interface DocsWidgetProps {
44
+ apiUrl?: string
45
+ mode?: 'modal' | 'sidebar'
46
+ triggerLabel?: string
47
+ defaultOpen?: boolean
48
+ className?: string
49
+ }
50
+
51
+ export const defaultCssVars = {
52
+ '--cyguin-docs-bg': 'var(--cyguin-surface, #ffffff)',
53
+ '--cyguin-docs-text': 'var(--cyguin-text, #1a1a1a)',
54
+ '--cyguin-docs-border': 'var(--cyguin-border, #e5e5e5)',
55
+ '--cyguin-docs-accent': 'var(--cyguin-primary, #6366f1)',
56
+ '--cyguin-docs-muted': 'var(--cyguin-muted, #737373)',
57
+ '--cyguin-docs-backdrop-opacity': '0.5',
58
+ '--cyguin-docs-radius': 'var(--cyguin-radius, 8px)',
59
+ '--cyguin-docs-shadow': 'var(--cyguin-shadow, 0 4px 24px rgba(0,0,0,0.12))',
60
+ '--cyguin-docs-trigger-size': '48px',
61
+ '--cyguin-docs-font': 'var(--cyguin-font, system-ui, sans-serif)',
62
+ } as const
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "jsx": "react-jsx",
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "outDir": "./dist",
10
+ "rootDir": "./src",
11
+ "strict": true,
12
+ "esModuleInterop": true,
13
+ "skipLibCheck": true,
14
+ "forceConsistentCasingInFileNames": true
15
+ },
16
+ "include": ["src/**/*"],
17
+ "exclude": ["node_modules", "dist"]
18
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { defineConfig } from 'tsup';
2
+
3
+ export default defineConfig({
4
+ entry: {
5
+ index: 'src/index.ts',
6
+ next: 'src/next.ts',
7
+ },
8
+ format: ['esm', 'cjs'],
9
+ dts: true,
10
+ splitting: true,
11
+ external: ['better-sqlite3', 'nanoid'],
12
+ });