@clarify-labs/renderer 0.4.0 → 0.5.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 (97) hide show
  1. package/output/AppShell-D3FsVHQK.js +390 -0
  2. package/output/AppShell-D3FsVHQK.js.map +1 -0
  3. package/output/AppShell-DeaJ-rgo.cjs +409 -0
  4. package/output/AppShell-DeaJ-rgo.cjs.map +1 -0
  5. package/output/OpenApiOperation-DYXG-6Rw.js +1772 -0
  6. package/output/OpenApiOperation-DYXG-6Rw.js.map +1 -0
  7. package/output/OpenApiOperation-mhoi-s4N.cjs +1840 -0
  8. package/output/OpenApiOperation-mhoi-s4N.cjs.map +1 -0
  9. package/output/app/PageNavigation.d.ts +7 -0
  10. package/output/app/PageSkeleton.d.ts +1 -0
  11. package/output/{components → app}/SectionProvider.d.ts +3 -2
  12. package/output/chunk-DakpK96I.cjs +43 -0
  13. package/output/client.cjs +1 -1
  14. package/output/client.js +1 -1
  15. package/output/components/Button.d.ts +18 -0
  16. package/output/components/Code.d.ts +11 -7
  17. package/output/components/Collapse.d.ts +9 -0
  18. package/output/components/Heading.d.ts +10 -0
  19. package/output/components/Logo.d.ts +2 -0
  20. package/output/components/Prose.d.ts +7 -0
  21. package/output/components/Tag.d.ts +34 -0
  22. package/output/components/index.d.ts +9 -80
  23. package/output/components/patterns.d.ts +4 -2
  24. package/output/context.d.ts +1 -8
  25. package/output/core/context.d.ts +8 -0
  26. package/output/core/i18n.d.ts +5 -0
  27. package/output/core/index.d.ts +3 -0
  28. package/output/core/types.d.ts +174 -0
  29. package/output/i18n.d.ts +1 -5
  30. package/output/index.cjs +105 -1741
  31. package/output/index.cjs.map +1 -1
  32. package/output/index.d.ts +15 -4
  33. package/output/index.js +71 -1719
  34. package/output/index.js.map +1 -1
  35. package/output/markdown.cjs +3 -0
  36. package/output/markdown.d.ts +1 -0
  37. package/output/markdown.js +2 -0
  38. package/output/mdx/DocShell.d.ts +7 -0
  39. package/output/mdx/Markdown.d.ts +7 -0
  40. package/output/mdx/components.d.ts +7 -7
  41. package/output/mdx/primitives.d.ts +18 -12
  42. package/output/mdx/remark.d.ts +2 -0
  43. package/output/openapi/{example-panels.d.ts → components/ExamplePanels.d.ts} +14 -9
  44. package/output/openapi/components/OpenApiOperation.d.ts +33 -0
  45. package/output/openapi/components/SchemaProperties.d.ts +20 -0
  46. package/output/openapi/entry.d.ts +13 -0
  47. package/output/openapi/index.d.ts +3 -3
  48. package/output/openapi/{helpers.d.ts → lib/helpers.d.ts} +7 -6
  49. package/output/openapi/{request-code.d.ts → lib/request-code.d.ts} +7 -5
  50. package/output/openapi/types.d.ts +5 -1
  51. package/output/preview/openapi.d.ts +28 -0
  52. package/output/preview.cjs +734 -0
  53. package/output/preview.cjs.map +1 -0
  54. package/output/preview.d.ts +19 -0
  55. package/output/preview.js +731 -0
  56. package/output/preview.js.map +1 -0
  57. package/output/remark-DNOdJz5i.cjs +14 -0
  58. package/output/remark-DNOdJz5i.cjs.map +1 -0
  59. package/output/remark-o5sg9Ilv.js +7 -0
  60. package/output/remark-o5sg9Ilv.js.map +1 -0
  61. package/output/{render-BCiQn6Q1.js → render-BpavVnAe.js} +3 -2
  62. package/output/render-BpavVnAe.js.map +1 -0
  63. package/output/{render-CZsdzmme.cjs → render-CjZt3edL.cjs} +6 -5
  64. package/output/render-CjZt3edL.cjs.map +1 -0
  65. package/output/renderer.css +403 -63
  66. package/output/server.cjs +7 -5
  67. package/output/server.cjs.map +1 -1
  68. package/output/server.js +4 -2
  69. package/output/server.js.map +1 -1
  70. package/output/shell/Navigation.d.ts +3 -2
  71. package/output/shell/Search.d.ts +6 -4
  72. package/output/{components → shell}/SiteLogo.d.ts +1 -1
  73. package/output/shell/icons.d.ts +3 -2
  74. package/output/shell/mobile.d.ts +3 -2
  75. package/output/{AppShell-nQnuKyn2.js → shell-BlMMdTpZ.js} +1118 -1320
  76. package/output/shell-BlMMdTpZ.js.map +1 -0
  77. package/output/{AppShell-CZw1MrPG.cjs → shell-_MyLsMUI.cjs} +1192 -1394
  78. package/output/shell-_MyLsMUI.cjs.map +1 -0
  79. package/output/{components → theme}/ThemeProvider.d.ts +3 -2
  80. package/output/types.d.ts +1 -174
  81. package/output/utils/clipboard.d.ts +1 -0
  82. package/output/utils/hash.d.ts +1 -0
  83. package/output/utils/href.d.ts +5 -0
  84. package/output/utils/lucide.d.ts +17 -0
  85. package/package.json +15 -2
  86. package/output/AppShell-CZw1MrPG.cjs.map +0 -1
  87. package/output/AppShell-nQnuKyn2.js.map +0 -1
  88. package/output/components/PageNavigation.d.ts +0 -5
  89. package/output/openapi/openapi-page.d.ts +0 -19
  90. package/output/openapi/schema-properties.d.ts +0 -15
  91. package/output/render-BCiQn6Q1.js.map +0 -1
  92. package/output/render-CZsdzmme.cjs.map +0 -1
  93. /package/output/{components → app}/BuiltWithClarify.d.ts +0 -0
  94. /package/output/{components → app}/PageFooter.d.ts +0 -0
  95. /package/output/openapi/{spec-path.d.ts → lib/spec-path.d.ts} +0 -0
  96. /package/output/openapi/{utils.d.ts → lib/utils.d.ts} +0 -0
  97. /package/output/{components → theme}/ThemeToggle.d.ts +0 -0
package/output/types.d.ts CHANGED
@@ -1,174 +1 @@
1
- import { ComponentType } from 'react';
2
- import { OpenAPISpec } from './openapi/utils';
3
- export type RouteComponent = ComponentType | (() => Promise<{
4
- default: ComponentType;
5
- }>);
6
- export type RouteSection = {
7
- id: string;
8
- title: string;
9
- badge?: string;
10
- tags?: string[];
11
- };
12
- export type NavigationNode = {
13
- path: string;
14
- title: string;
15
- icon?: string;
16
- children?: NavigationNode[];
17
- sections?: RouteSection[];
18
- };
19
- export type RouteItem = {
20
- path: string;
21
- basePath?: string;
22
- locale?: string;
23
- isFallback?: boolean;
24
- alternates?: Record<string, string>;
25
- title: string;
26
- description?: string;
27
- keywords?: string[];
28
- component: RouteComponent;
29
- lazy?: boolean;
30
- kind?: 'mdx' | 'openapi';
31
- sections?: RouteSection[];
32
- contentArtifactUrl?: string;
33
- };
34
- export type ClarifyLogoConfig = string | {
35
- light?: string;
36
- dark?: string;
37
- };
38
- export type ClarifyFaviconConfig = string | {
39
- light?: string;
40
- dark?: string;
41
- };
42
- export type ClarifyLocalizedText = string | Record<string, string>;
43
- export type ClarifyLocaleConfig = {
44
- code: string;
45
- label: string;
46
- dir?: 'ltr' | 'rtl';
47
- };
48
- export type ClarifyI18nConfig = {
49
- defaultLocale: string;
50
- missing: 'fallback' | '404' | 'hide';
51
- locales: ClarifyLocaleConfig[];
52
- };
53
- export type ClarifyNavbarLink = {
54
- label: ClarifyLocalizedText;
55
- href: string;
56
- external?: boolean;
57
- };
58
- export type ClarifyBannerConfig = {
59
- content: ClarifyLocalizedText;
60
- dismissible?: boolean;
61
- };
62
- export type ClarifyFooterConfig = {
63
- links?: ClarifyNavbarLink[];
64
- socials?: Record<string, string>;
65
- copyright?: ClarifyLocalizedText;
66
- };
67
- export type ClarifyThemePreset = 'default' | 'base';
68
- export type ClarifyThemeColorTokensConfig = {
69
- primary: string;
70
- accent: string;
71
- background: string;
72
- foreground: string;
73
- surface: string;
74
- muted: string;
75
- border: string;
76
- codeBackground: string;
77
- };
78
- export type ClarifyThemeRadiusTokensConfig = {
79
- sm: string;
80
- md: string;
81
- lg: string;
82
- xl: string;
83
- };
84
- export type ClarifyThemeTokensConfig = {
85
- colors: ClarifyThemeColorTokensConfig;
86
- radius: ClarifyThemeRadiusTokensConfig;
87
- };
88
- export type ClarifyThemeLayoutConfig = {
89
- maxWidth: string;
90
- };
91
- export type ClarifyThemeConfig = {
92
- preset: ClarifyThemePreset;
93
- tokens: ClarifyThemeTokensConfig;
94
- layout: ClarifyThemeLayoutConfig;
95
- };
96
- export type ClarifyPagesItem = string | {
97
- page: string;
98
- title?: ClarifyLocalizedText;
99
- icon?: string;
100
- redirect?: string;
101
- } | {
102
- openapi: string;
103
- icon?: string;
104
- title?: ClarifyLocalizedText;
105
- };
106
- export type ClarifyPagesGroup = {
107
- group: ClarifyLocalizedText;
108
- icon?: string;
109
- pages: ClarifyPagesItem[];
110
- };
111
- export type ClarifyPagesConfig = ClarifyPagesGroup[] | 'FileTree';
112
- export type ClarifyTabItem = {
113
- tab: ClarifyLocalizedText;
114
- icon?: string;
115
- pages?: ClarifyPagesConfig;
116
- };
117
- export type ClarifyTabsConfig = ClarifyTabItem[];
118
- export type ClarifyConfig = {
119
- title: string;
120
- logo?: ClarifyLogoConfig;
121
- favicon?: ClarifyFaviconConfig;
122
- theme: ClarifyThemeConfig;
123
- description: string;
124
- rootDirectory: string;
125
- routePrefix: string;
126
- outputDirectory: string;
127
- navbar?: {
128
- links?: ClarifyNavbarLink[];
129
- };
130
- banner?: ClarifyBannerConfig;
131
- footer?: ClarifyFooterConfig;
132
- i18n?: ClarifyI18nConfig;
133
- tabs?: ClarifyTabsConfig;
134
- };
135
- export type NavigationTab = {
136
- type: 'tab';
137
- path: string;
138
- title: string;
139
- icon?: string;
140
- children: NavigationNode[];
141
- };
142
- export type TabbedNavigation = {
143
- tabs: NavigationTab[];
144
- };
145
- export type LocalizedNavigation = Record<string, NavigationNode[]>;
146
- export type LocalizedTabbedNavigation = Record<string, TabbedNavigation>;
147
- export type NavigationTree = NavigationNode[] | LocalizedNavigation | TabbedNavigation | LocalizedTabbedNavigation;
148
- export type RenderOptions = {
149
- /** 从 virtual:clarify-config 导入的 config */
150
- config: ClarifyConfig;
151
- /** 从 virtual:clarify-routes 导入的路由数组 */
152
- routes: RouteItem[];
153
- /** 从 virtual:clarify-routes 导入的导航树;启用 i18n 时为按 locale 分组的导航树 */
154
- navigation?: NavigationTree;
155
- /** 从 virtual:clarify-openapi-registry 导入的 OpenAPI 规范表 */
156
- openApis?: Record<string, OpenAPISpec>;
157
- /** 挂载节点,默认 document.getElementById('root') */
158
- container?: Element | null;
159
- };
160
- export type ServerRouteItem = Omit<RouteItem, 'component'> & {
161
- component: ComponentType;
162
- };
163
- export type ServerRenderOptions = {
164
- /** 从 virtual:clarify-config 导入的 config */
165
- config: ClarifyConfig;
166
- /** 从 virtual:clarify-routes 导入的服务端路由数组 */
167
- routes: ServerRouteItem[];
168
- /** 从 virtual:clarify-routes 导入的导航树;启用 i18n 时为按 locale 分组的导航树 */
169
- navigation?: NavigationTree;
170
- /** 从 virtual:clarify-openapi-registry 导入的 OpenAPI 规范表 */
171
- openApis?: Record<string, OpenAPISpec>;
172
- /** 当前请求的 URL */
173
- url: string;
174
- };
1
+ export type * from './core/types';
@@ -0,0 +1 @@
1
+ export declare function copyTextToClipboard(text: string): Promise<boolean>;
@@ -0,0 +1 @@
1
+ export declare function safeDecodeURIComponent(value: string): string;
@@ -0,0 +1,5 @@
1
+ import { ClarifyConfig } from '../types';
2
+ export declare function isExternalHref(href: string): boolean;
3
+ export declare function hasLocalePrefix(href: string, config: ClarifyConfig): boolean;
4
+ export declare function localizeHref(href: string, config: ClarifyConfig, locale?: string): string;
5
+ export declare function prefixHref(href: string, routePrefix?: string): string;
@@ -0,0 +1,17 @@
1
+ import { ComponentType, SVGProps } from 'react';
2
+ export type LucideIconComponent = ComponentType<SVGProps<SVGSVGElement>>;
3
+ /**
4
+ * Registry of all Lucide icon components keyed by their PascalCase export name.
5
+ *
6
+ * Access icons via index lookup (e.g. `lucideIconRegistry[name]`) so React
7
+ * tooling does not mistake the access for a component created during render.
8
+ */
9
+ export declare const lucideIconRegistry: Record<string, LucideIconComponent | undefined>;
10
+ /**
11
+ * Resolve an icon name into the matching Lucide registry key.
12
+ *
13
+ * Accepts both the exact PascalCase export name (e.g. `ArrowRight`) and
14
+ * kebab/space/snake variants (e.g. `arrow-right`), returning `undefined`
15
+ * when no matching icon exists.
16
+ */
17
+ export declare function resolveLucideIconName(name: string | undefined): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clarify-labs/renderer",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "repository": {
@@ -18,6 +18,18 @@
18
18
  "require": "./output/index.cjs",
19
19
  "default": "./output/index.js"
20
20
  },
21
+ "./markdown": {
22
+ "types": "./output/markdown.d.ts",
23
+ "import": "./output/markdown.js",
24
+ "require": "./output/markdown.cjs",
25
+ "default": "./output/markdown.js"
26
+ },
27
+ "./preview": {
28
+ "types": "./output/preview.d.ts",
29
+ "import": "./output/preview.js",
30
+ "require": "./output/preview.cjs",
31
+ "default": "./output/preview.js"
32
+ },
21
33
  "./client": {
22
34
  "types": "./output/client.d.ts",
23
35
  "import": "./output/client.js",
@@ -51,7 +63,6 @@
51
63
  },
52
64
  "devDependencies": {
53
65
  "@tailwindcss/vite": "^4.1.11",
54
- "@types/github-slugger": "^2.0.0",
55
66
  "@types/react": "^19.1.8",
56
67
  "@types/react-dom": "^19.1.6",
57
68
  "@vitejs/plugin-react": "^5.0.5",
@@ -72,6 +83,8 @@
72
83
  "github-slugger": "^2.0.0",
73
84
  "lucide-react": "^1.20.0",
74
85
  "openapi-types": "^12.1.3",
86
+ "react-markdown": "^10.1.0",
87
+ "remark-gfm": "^4.0.1",
75
88
  "zustand": "^5.0.14"
76
89
  }
77
90
  }