@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.
- package/output/AppShell-D3FsVHQK.js +390 -0
- package/output/AppShell-D3FsVHQK.js.map +1 -0
- package/output/AppShell-DeaJ-rgo.cjs +409 -0
- package/output/AppShell-DeaJ-rgo.cjs.map +1 -0
- package/output/OpenApiOperation-DYXG-6Rw.js +1772 -0
- package/output/OpenApiOperation-DYXG-6Rw.js.map +1 -0
- package/output/OpenApiOperation-mhoi-s4N.cjs +1840 -0
- package/output/OpenApiOperation-mhoi-s4N.cjs.map +1 -0
- package/output/app/PageNavigation.d.ts +7 -0
- package/output/app/PageSkeleton.d.ts +1 -0
- package/output/{components → app}/SectionProvider.d.ts +3 -2
- package/output/chunk-DakpK96I.cjs +43 -0
- package/output/client.cjs +1 -1
- package/output/client.js +1 -1
- package/output/components/Button.d.ts +18 -0
- package/output/components/Code.d.ts +11 -7
- package/output/components/Collapse.d.ts +9 -0
- package/output/components/Heading.d.ts +10 -0
- package/output/components/Logo.d.ts +2 -0
- package/output/components/Prose.d.ts +7 -0
- package/output/components/Tag.d.ts +34 -0
- package/output/components/index.d.ts +9 -80
- package/output/components/patterns.d.ts +4 -2
- package/output/context.d.ts +1 -8
- package/output/core/context.d.ts +8 -0
- package/output/core/i18n.d.ts +5 -0
- package/output/core/index.d.ts +3 -0
- package/output/core/types.d.ts +174 -0
- package/output/i18n.d.ts +1 -5
- package/output/index.cjs +105 -1741
- package/output/index.cjs.map +1 -1
- package/output/index.d.ts +15 -4
- package/output/index.js +71 -1719
- package/output/index.js.map +1 -1
- package/output/markdown.cjs +3 -0
- package/output/markdown.d.ts +1 -0
- package/output/markdown.js +2 -0
- package/output/mdx/DocShell.d.ts +7 -0
- package/output/mdx/Markdown.d.ts +7 -0
- package/output/mdx/components.d.ts +7 -7
- package/output/mdx/primitives.d.ts +18 -12
- package/output/mdx/remark.d.ts +2 -0
- package/output/openapi/{example-panels.d.ts → components/ExamplePanels.d.ts} +14 -9
- package/output/openapi/components/OpenApiOperation.d.ts +33 -0
- package/output/openapi/components/SchemaProperties.d.ts +20 -0
- package/output/openapi/entry.d.ts +13 -0
- package/output/openapi/index.d.ts +3 -3
- package/output/openapi/{helpers.d.ts → lib/helpers.d.ts} +7 -6
- package/output/openapi/{request-code.d.ts → lib/request-code.d.ts} +7 -5
- package/output/openapi/types.d.ts +5 -1
- package/output/preview/openapi.d.ts +28 -0
- package/output/preview.cjs +734 -0
- package/output/preview.cjs.map +1 -0
- package/output/preview.d.ts +19 -0
- package/output/preview.js +731 -0
- package/output/preview.js.map +1 -0
- package/output/remark-DNOdJz5i.cjs +14 -0
- package/output/remark-DNOdJz5i.cjs.map +1 -0
- package/output/remark-o5sg9Ilv.js +7 -0
- package/output/remark-o5sg9Ilv.js.map +1 -0
- package/output/{render-BCiQn6Q1.js → render-BpavVnAe.js} +3 -2
- package/output/render-BpavVnAe.js.map +1 -0
- package/output/{render-CZsdzmme.cjs → render-CjZt3edL.cjs} +6 -5
- package/output/render-CjZt3edL.cjs.map +1 -0
- package/output/renderer.css +403 -63
- package/output/server.cjs +7 -5
- package/output/server.cjs.map +1 -1
- package/output/server.js +4 -2
- package/output/server.js.map +1 -1
- package/output/shell/Navigation.d.ts +3 -2
- package/output/shell/Search.d.ts +6 -4
- package/output/{components → shell}/SiteLogo.d.ts +1 -1
- package/output/shell/icons.d.ts +3 -2
- package/output/shell/mobile.d.ts +3 -2
- package/output/{AppShell-nQnuKyn2.js → shell-BlMMdTpZ.js} +1118 -1320
- package/output/shell-BlMMdTpZ.js.map +1 -0
- package/output/{AppShell-CZw1MrPG.cjs → shell-_MyLsMUI.cjs} +1192 -1394
- package/output/shell-_MyLsMUI.cjs.map +1 -0
- package/output/{components → theme}/ThemeProvider.d.ts +3 -2
- package/output/types.d.ts +1 -174
- package/output/utils/clipboard.d.ts +1 -0
- package/output/utils/hash.d.ts +1 -0
- package/output/utils/href.d.ts +5 -0
- package/output/utils/lucide.d.ts +17 -0
- package/package.json +15 -2
- package/output/AppShell-CZw1MrPG.cjs.map +0 -1
- package/output/AppShell-nQnuKyn2.js.map +0 -1
- package/output/components/PageNavigation.d.ts +0 -5
- package/output/openapi/openapi-page.d.ts +0 -19
- package/output/openapi/schema-properties.d.ts +0 -15
- package/output/render-BCiQn6Q1.js.map +0 -1
- package/output/render-CZsdzmme.cjs.map +0 -1
- /package/output/{components → app}/BuiltWithClarify.d.ts +0 -0
- /package/output/{components → app}/PageFooter.d.ts +0 -0
- /package/output/openapi/{spec-path.d.ts → lib/spec-path.d.ts} +0 -0
- /package/output/openapi/{utils.d.ts → lib/utils.d.ts} +0 -0
- /package/output/{components → theme}/ThemeToggle.d.ts +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OpenAPISpec } from '../openapi/lib/utils';
|
|
2
|
+
import { ClarifyConfig } from './types';
|
|
3
|
+
export declare const ClarifyConfigContext: import('react').Context<ClarifyConfig | null>;
|
|
4
|
+
export declare const ClarifyLocaleContext: import('react').Context<string | undefined>;
|
|
5
|
+
export declare const OpenApisContext: import('react').Context<Record<string, OpenAPISpec>>;
|
|
6
|
+
export declare function useClarifyConfig(): ClarifyConfig;
|
|
7
|
+
export declare function useClarifyLocale(): string | undefined;
|
|
8
|
+
export declare function useOpenApis(): Record<string, OpenAPISpec>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type BuiltInLocale = 'en' | 'zh-CN';
|
|
2
|
+
export type BuiltInTextKey = 'actions.code' | 'actions.copy' | 'actions.copied' | 'builtWith.label' | 'builtWith.prefix' | 'callout.danger' | 'callout.info' | 'callout.note' | 'callout.success' | 'callout.tip' | 'callout.warning' | 'contentActions.copyContent' | 'contentActions.copyContentDescription' | 'contentActions.copyLink' | 'contentActions.copyLinkDescription' | 'contentActions.copyLlms' | 'contentActions.copyLlmsDescription' | 'contentActions.copiedLlms' | 'contentActions.copyOptions' | 'contentActions.copiedContent' | 'contentActions.copiedLink' | 'contentActions.viewMarkdown' | 'contentActions.viewMarkdownDescription' | 'contentActions.viewOpenApi' | 'contentActions.viewOpenApiDescription' | 'feedback.no' | 'feedback.prompt' | 'feedback.thanks' | 'feedback.yes' | 'navigation.documentation' | 'navigation.next' | 'navigation.previous' | 'navigation.previousNext' | 'navigation.toggle' | 'navbar.home' | 'navbar.openLinks' | 'navbar.sections' | 'openapi.apiDocumentation' | 'openapi.bodyProperties' | 'openapi.collapse' | 'openapi.endpointNotFound' | 'openapi.example' | 'openapi.expand' | 'openapi.headers' | 'openapi.language' | 'openapi.client' | 'openapi.mediaType' | 'openapi.openApiReference' | 'openapi.operationParameter' | 'openapi.optional' | 'openapi.parameter' | 'openapi.pathParameters' | 'openapi.queryParameters' | 'openapi.request' | 'openapi.requestBody' | 'openapi.required' | 'openapi.requiredBadge' | 'openapi.response' | 'openapi.responses' | 'openapi.schemaExample' | 'openapi.scrollExamplesLeft' | 'openapi.scrollExamplesRight' | 'openapi.specNotFound' | 'openapi.specPathMissing' | 'openapi.status' | 'openapi.version' | 'search.button' | 'search.noResults' | 'search.placeholder' | 'search.shortcutCtrl' | 'theme.switchToDark' | 'theme.switchToLight' | 'language.switch';
|
|
3
|
+
export declare function resolveBuiltInLocale(locale?: string): BuiltInLocale;
|
|
4
|
+
export declare function translateBuiltInText(locale: string | undefined, key: BuiltInTextKey, replacements?: Record<string, string>): string;
|
|
5
|
+
export declare function useBuiltInText(locale?: string): (key: BuiltInTextKey, replacements?: Record<string, string>) => string;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { OpenAPISpec } from '../openapi/lib/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
|
+
};
|
package/output/i18n.d.ts
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export type BuiltInTextKey = 'actions.code' | 'actions.copy' | 'actions.copied' | 'builtWith.label' | 'builtWith.prefix' | 'callout.danger' | 'callout.info' | 'callout.note' | 'callout.success' | 'callout.tip' | 'callout.warning' | 'contentActions.copyContent' | 'contentActions.copyContentDescription' | 'contentActions.copyLink' | 'contentActions.copyLinkDescription' | 'contentActions.copyOptions' | 'contentActions.copiedContent' | 'contentActions.copiedLink' | 'contentActions.viewMarkdown' | 'contentActions.viewMarkdownDescription' | 'contentActions.viewOpenApi' | 'contentActions.viewOpenApiDescription' | 'feedback.no' | 'feedback.prompt' | 'feedback.thanks' | 'feedback.yes' | 'navigation.documentation' | 'navigation.next' | 'navigation.previous' | 'navigation.previousNext' | 'navigation.toggle' | 'navbar.home' | 'navbar.openLinks' | 'navbar.sections' | 'openapi.apiDocumentation' | 'openapi.bodyProperties' | 'openapi.collapse' | 'openapi.endpointNotFound' | 'openapi.example' | 'openapi.expand' | 'openapi.headers' | 'openapi.language' | 'openapi.client' | 'openapi.mediaType' | 'openapi.openApiReference' | 'openapi.operationParameter' | 'openapi.optional' | 'openapi.parameter' | 'openapi.pathParameters' | 'openapi.queryParameters' | 'openapi.request' | 'openapi.requestBody' | 'openapi.required' | 'openapi.requiredBadge' | 'openapi.response' | 'openapi.responses' | 'openapi.schemaExample' | 'openapi.scrollExamplesLeft' | 'openapi.scrollExamplesRight' | 'openapi.specNotFound' | 'openapi.specPathMissing' | 'openapi.status' | 'openapi.version' | 'search.button' | 'search.noResults' | 'search.placeholder' | 'search.shortcutCtrl' | 'theme.switchToDark' | 'theme.switchToLight' | 'language.switch';
|
|
3
|
-
export declare function resolveBuiltInLocale(locale?: string): BuiltInLocale;
|
|
4
|
-
export declare function translateBuiltInText(locale: string | undefined, key: BuiltInTextKey, replacements?: Record<string, string>): string;
|
|
5
|
-
export declare function useBuiltInText(locale?: string): (key: BuiltInTextKey, replacements?: Record<string, string>) => string;
|
|
1
|
+
export { resolveBuiltInLocale, translateBuiltInText, useBuiltInText } from './core/i18n';
|