@clarify-labs/renderer 0.2.0 → 0.4.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-4KB3lU-n.cjs → AppShell-CZw1MrPG.cjs} +977 -408
- package/output/AppShell-CZw1MrPG.cjs.map +1 -0
- package/output/{AppShell-Ci894P_0.js → AppShell-nQnuKyn2.js} +974 -411
- package/output/AppShell-nQnuKyn2.js.map +1 -0
- package/output/client.cjs +1 -1
- package/output/client.js +1 -1
- package/output/components/PageNavigation.d.ts +5 -0
- package/output/components/index.d.ts +1 -0
- package/output/context.d.ts +2 -0
- package/output/i18n.d.ts +5 -0
- package/output/index.cjs +1351 -346
- package/output/index.cjs.map +1 -1
- package/output/index.js +1351 -346
- package/output/index.js.map +1 -1
- package/output/openapi/example-panels.d.ts +31 -0
- package/output/openapi/helpers.d.ts +24 -0
- package/output/openapi/index.d.ts +2 -19
- package/output/openapi/openapi-page.d.ts +19 -0
- package/output/openapi/request-code.d.ts +16 -0
- package/output/openapi/schema-properties.d.ts +15 -0
- package/output/openapi/spec-path.d.ts +2 -0
- package/output/openapi/types.d.ts +66 -0
- package/output/{render-bPMMBoDH.js → render-BCiQn6Q1.js} +2 -2
- package/output/{render-bPMMBoDH.js.map → render-BCiQn6Q1.js.map} +1 -1
- package/output/{render-z9rSQ00n.cjs → render-CZsdzmme.cjs} +2 -2
- package/output/{render-z9rSQ00n.cjs.map → render-CZsdzmme.cjs.map} +1 -1
- package/output/renderer.css +1374 -603
- package/output/server.cjs +1 -1
- package/output/server.js +1 -1
- package/output/shell/ContentActions.d.ts +1 -0
- package/output/shell/Header.d.ts +4 -3
- package/output/shell/icons.d.ts +4 -0
- package/output/shell/mobile.d.ts +2 -1
- package/output/types.d.ts +62 -9
- package/output/utils/path.d.ts +2 -0
- package/package.json +10 -9
- package/output/AppShell-4KB3lU-n.cjs.map +0 -1
- package/output/AppShell-Ci894P_0.js.map +0 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type { OpenAPIOperation, OpenAPISpec } from './utils';
|
|
2
|
+
export type OpenApiRecord = Record<string, unknown>;
|
|
3
|
+
export type OpenApiParameter = {
|
|
4
|
+
name?: string;
|
|
5
|
+
in?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
description?: string;
|
|
8
|
+
schema?: unknown;
|
|
9
|
+
};
|
|
10
|
+
export type OpenApiMediaType = {
|
|
11
|
+
schema?: unknown;
|
|
12
|
+
example?: unknown;
|
|
13
|
+
examples?: Record<string, unknown>;
|
|
14
|
+
encoding?: Record<string, {
|
|
15
|
+
contentType?: string;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
export type OpenApiResponse = {
|
|
19
|
+
description?: string;
|
|
20
|
+
content?: Record<string, OpenApiMediaType>;
|
|
21
|
+
};
|
|
22
|
+
export type OpenApiServerVariable = {
|
|
23
|
+
default?: string;
|
|
24
|
+
enum?: string[];
|
|
25
|
+
description?: string;
|
|
26
|
+
};
|
|
27
|
+
export type OpenApiServer = {
|
|
28
|
+
url?: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
variables?: Record<string, OpenApiServerVariable>;
|
|
31
|
+
};
|
|
32
|
+
export type OpenApiSecurityScheme = {
|
|
33
|
+
type?: string;
|
|
34
|
+
scheme?: string;
|
|
35
|
+
bearerFormat?: string;
|
|
36
|
+
in?: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
flows?: unknown;
|
|
39
|
+
openIdConnectUrl?: string;
|
|
40
|
+
};
|
|
41
|
+
export type OpenApiSecurityRequirement = Record<string, string[]>;
|
|
42
|
+
export type RequestAuthInput = {
|
|
43
|
+
name: string;
|
|
44
|
+
value: string;
|
|
45
|
+
scheme: OpenApiSecurityScheme;
|
|
46
|
+
};
|
|
47
|
+
export type MediaTypeEntry = {
|
|
48
|
+
mediaType: string;
|
|
49
|
+
value: OpenApiMediaType;
|
|
50
|
+
};
|
|
51
|
+
export type ExampleEntry = {
|
|
52
|
+
key: string;
|
|
53
|
+
title: string;
|
|
54
|
+
summary?: string;
|
|
55
|
+
value: unknown;
|
|
56
|
+
generated?: boolean;
|
|
57
|
+
};
|
|
58
|
+
export type RequestCodeExample = {
|
|
59
|
+
key: string;
|
|
60
|
+
title: string;
|
|
61
|
+
language: string;
|
|
62
|
+
languageKey: string;
|
|
63
|
+
clientKey: string;
|
|
64
|
+
clientTitle: string;
|
|
65
|
+
code: string;
|
|
66
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as OpenApisContext, t as AppShell, u as ThemeProvider, w as ClarifyConfigContext } from "./AppShell-nQnuKyn2.js";
|
|
2
2
|
import { StrictMode } from "react";
|
|
3
3
|
import { BrowserRouter } from "react-router-dom";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -52,4 +52,4 @@ function render(options) {
|
|
|
52
52
|
//#endregion
|
|
53
53
|
export { render as t };
|
|
54
54
|
|
|
55
|
-
//# sourceMappingURL=render-
|
|
55
|
+
//# sourceMappingURL=render-BCiQn6Q1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-
|
|
1
|
+
{"version":3,"file":"render-BCiQn6Q1.js","names":[],"sources":["../source/runtime/render.tsx"],"sourcesContent":["import { StrictMode } from 'react'\nimport { hydrateRoot, createRoot } from 'react-dom/client'\nimport { BrowserRouter } from 'react-router-dom'\n\nimport { AppShell } from '../app/AppShell'\nimport { ThemeProvider } from '../components/ThemeProvider'\nimport { ClarifyConfigContext, OpenApisContext } from '../context'\nimport type { RenderOptions } from '../types'\n\n/**\n * Clarify 客户端 Hydration 入口。\n * 在文档项目的 main.tsx 中调用:\n * ```ts\n * import { render } from '@clarify-labs/renderer';\n * import { routes } from 'virtual:clarify-routes';\n * import { config } from 'virtual:clarify-config';\n * render({ config, routes });\n * ```\n */\nfunction isHydrationDebugEnabled(): boolean {\n try {\n const params = new URLSearchParams(window.location.search)\n return params.get('clarifyHydrationDebug') === '1' || window.localStorage.getItem('clarify:hydration-debug') === '1'\n } catch {\n return false\n }\n}\n\nexport function render(options: RenderOptions) {\n const { config, routes, navigation, openApis = {}, container } = options\n\n const target = container ?? document.getElementById('root')\n if (!target) {\n throw new Error('[clarify] 渲染失败:找不到挂载节点,请确保 HTML 中存在 id=\"root\" 的元素')\n }\n\n const app = (\n <StrictMode>\n <BrowserRouter basename={config.routePrefix}>\n <ClarifyConfigContext.Provider value={config}>\n <OpenApisContext.Provider value={openApis}>\n <ThemeProvider>\n <AppShell config={config} routes={routes} navigation={navigation ?? []} />\n </ThemeProvider>\n </OpenApisContext.Provider>\n </ClarifyConfigContext.Provider>\n </BrowserRouter>\n </StrictMode>\n )\n\n const hydrationDebug = isHydrationDebugEnabled()\n\n try {\n hydrateRoot(target as Element, app, {\n onRecoverableError(error, errorInfo) {\n // Phase 1: suppress hydration mismatch noise by default. React 19\n // recovers automatically, but diagnostics can be enabled explicitly.\n if (hydrationDebug) {\n console.warn('[clarify] Recoverable hydration error:', error, errorInfo)\n }\n },\n })\n } catch (err) {\n console.warn('[clarify] Hydration failed, falling back to client render:', err)\n createRoot(target as Element).render(app)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,SAAS,0BAAmC;CAC1C,IAAI;EAEF,OAAO,IADY,gBAAgB,OAAO,SAAS,MAC5C,EAAO,IAAI,uBAAuB,MAAM,OAAO,OAAO,aAAa,QAAQ,yBAAyB,MAAM;CACnH,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,OAAO,SAAwB;CAC7C,MAAM,EAAE,QAAQ,QAAQ,YAAY,WAAW,CAAC,GAAG,cAAc;CAEjE,MAAM,SAAS,aAAa,SAAS,eAAe,MAAM;CAC1D,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,qDAAmD;CAGrE,MAAM,MACJ,oBAAC,YAAD,EAAA,UACE,oBAAC,eAAD;EAAe,UAAU,OAAO;YAC9B,oBAAC,qBAAqB,UAAtB;GAA+B,OAAO;aACpC,oBAAC,gBAAgB,UAAjB;IAA0B,OAAO;cAC/B,oBAAC,eAAD,EAAA,UACE,oBAAC,UAAD;KAAkB;KAAgB;KAAQ,YAAY,cAAc,CAAC;IAAI,CAAA,EAC5D,CAAA;GACS,CAAA;EACG,CAAA;CAClB,CAAA,EACL,CAAA;CAGd,MAAM,iBAAiB,wBAAwB;CAE/C,IAAI;EACF,YAAY,QAAmB,KAAK,EAClC,mBAAmB,OAAO,WAAW;GAGnC,IAAI,gBACF,QAAQ,KAAK,0CAA0C,OAAO,SAAS;EAE3E,EACF,CAAC;CACH,SAAS,KAAK;EACZ,QAAQ,KAAK,8DAA8D,GAAG;EAC9E,WAAW,MAAiB,EAAE,OAAO,GAAG;CAC1C;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_AppShell = require("./AppShell-
|
|
1
|
+
const require_AppShell = require("./AppShell-CZw1MrPG.cjs");
|
|
2
2
|
let react = require("react");
|
|
3
3
|
let react_router_dom = require("react-router-dom");
|
|
4
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -57,4 +57,4 @@ Object.defineProperty(exports, "render", {
|
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
//# sourceMappingURL=render-
|
|
60
|
+
//# sourceMappingURL=render-CZsdzmme.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-
|
|
1
|
+
{"version":3,"file":"render-CZsdzmme.cjs","names":[],"sources":["../source/runtime/render.tsx"],"sourcesContent":["import { StrictMode } from 'react'\nimport { hydrateRoot, createRoot } from 'react-dom/client'\nimport { BrowserRouter } from 'react-router-dom'\n\nimport { AppShell } from '../app/AppShell'\nimport { ThemeProvider } from '../components/ThemeProvider'\nimport { ClarifyConfigContext, OpenApisContext } from '../context'\nimport type { RenderOptions } from '../types'\n\n/**\n * Clarify 客户端 Hydration 入口。\n * 在文档项目的 main.tsx 中调用:\n * ```ts\n * import { render } from '@clarify-labs/renderer';\n * import { routes } from 'virtual:clarify-routes';\n * import { config } from 'virtual:clarify-config';\n * render({ config, routes });\n * ```\n */\nfunction isHydrationDebugEnabled(): boolean {\n try {\n const params = new URLSearchParams(window.location.search)\n return params.get('clarifyHydrationDebug') === '1' || window.localStorage.getItem('clarify:hydration-debug') === '1'\n } catch {\n return false\n }\n}\n\nexport function render(options: RenderOptions) {\n const { config, routes, navigation, openApis = {}, container } = options\n\n const target = container ?? document.getElementById('root')\n if (!target) {\n throw new Error('[clarify] 渲染失败:找不到挂载节点,请确保 HTML 中存在 id=\"root\" 的元素')\n }\n\n const app = (\n <StrictMode>\n <BrowserRouter basename={config.routePrefix}>\n <ClarifyConfigContext.Provider value={config}>\n <OpenApisContext.Provider value={openApis}>\n <ThemeProvider>\n <AppShell config={config} routes={routes} navigation={navigation ?? []} />\n </ThemeProvider>\n </OpenApisContext.Provider>\n </ClarifyConfigContext.Provider>\n </BrowserRouter>\n </StrictMode>\n )\n\n const hydrationDebug = isHydrationDebugEnabled()\n\n try {\n hydrateRoot(target as Element, app, {\n onRecoverableError(error, errorInfo) {\n // Phase 1: suppress hydration mismatch noise by default. React 19\n // recovers automatically, but diagnostics can be enabled explicitly.\n if (hydrationDebug) {\n console.warn('[clarify] Recoverable hydration error:', error, errorInfo)\n }\n },\n })\n } catch (err) {\n console.warn('[clarify] Hydration failed, falling back to client render:', err)\n createRoot(target as Element).render(app)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,SAAS,0BAAmC;CAC1C,IAAI;EAEF,OAAO,IADY,gBAAgB,OAAO,SAAS,MAC5C,EAAO,IAAI,uBAAuB,MAAM,OAAO,OAAO,aAAa,QAAQ,yBAAyB,MAAM;CACnH,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,OAAO,SAAwB;CAC7C,MAAM,EAAE,QAAQ,QAAQ,YAAY,WAAW,CAAC,GAAG,cAAc;CAEjE,MAAM,SAAS,aAAa,SAAS,eAAe,MAAM;CAC1D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