@clarify-labs/renderer 0.7.0 → 0.7.1
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/{OpenApiOperation-ZXToVSFC.cjs → OpenApiOperation-C4xZu4i0.cjs} +69 -65
- package/output/OpenApiOperation-C4xZu4i0.cjs.map +1 -0
- package/output/{OpenApiOperation-CWSOhUVa.js → OpenApiOperation-LIL7bqxW.js} +48 -44
- package/output/OpenApiOperation-LIL7bqxW.js.map +1 -0
- package/output/{shell-xxhV0p7k.cjs → PageActions-1RDCHcUY.cjs} +280 -308
- package/output/PageActions-1RDCHcUY.cjs.map +1 -0
- package/output/{shell-CumiARRe.js → PageActions-yoDRjkq8.js} +235 -263
- package/output/PageActions-yoDRjkq8.js.map +1 -0
- package/output/{ThemeRoot-C_ZdzSMu.js → ThemeRoot-CLa0yvRQ.js} +406 -53
- package/output/ThemeRoot-CLa0yvRQ.js.map +1 -0
- package/output/{ThemeRoot-CEvwrGp5.cjs → ThemeRoot-DYS-lcK-.cjs} +457 -80
- package/output/ThemeRoot-DYS-lcK-.cjs.map +1 -0
- package/output/app/AppShell.d.ts +3 -2
- package/output/app/PageActions.d.ts +12 -0
- package/output/app/PageBanner.d.ts +7 -0
- package/output/app/SectionProvider.d.ts +1 -0
- package/output/client.cjs +14 -7
- package/output/client.d.ts +4 -2
- package/output/client.js +4 -4
- package/output/context.d.ts +1 -1
- package/output/core/context.d.ts +5 -5
- package/output/core/index.d.ts +1 -1
- package/output/core/types.d.ts +70 -61
- package/output/index.cjs +56 -28
- package/output/index.cjs.map +1 -1
- package/output/index.d.ts +7 -5
- package/output/index.js +37 -12
- package/output/index.js.map +1 -1
- package/output/mdx/components.d.ts +1 -0
- package/output/mdx/primitives.d.ts +1 -0
- package/output/preview.cjs +7 -7
- package/output/preview.cjs.map +1 -1
- package/output/preview.js +4 -4
- package/output/preview.js.map +1 -1
- package/output/{render-zHU25Nm9.cjs → render-CRTqZzyY.cjs} +8 -7
- package/output/render-CRTqZzyY.cjs.map +1 -0
- package/output/{render-CnUd0XwZ.js → render-D0ls3d2j.js} +6 -5
- package/output/render-D0ls3d2j.js.map +1 -0
- package/output/renderer.css +365 -261
- package/output/server.cjs +8 -7
- package/output/server.cjs.map +1 -1
- package/output/server.js +5 -4
- package/output/server.js.map +1 -1
- package/output/shell/ContentActions.d.ts +0 -1
- package/output/shell/Header.d.ts +3 -2
- package/output/shell/SiteLogo.d.ts +2 -2
- package/output/shell/mobile.d.ts +2 -2
- package/output/theme/ThemeEditor.d.ts +53 -17
- package/output/theme/ThemeProvider.d.ts +2 -1
- package/output/theme/ThemeRoot.d.ts +2 -2
- package/output/theme/cookies.d.ts +11 -0
- package/output/theme/randomTheme.d.ts +2 -2
- package/output/theme/variables.d.ts +58 -20
- package/output/utils/href.d.ts +3 -3
- package/package.json +1 -1
- package/output/OpenApiOperation-CWSOhUVa.js.map +0 -1
- package/output/OpenApiOperation-ZXToVSFC.cjs.map +0 -1
- package/output/ThemeRoot-CEvwrGp5.cjs.map +0 -1
- package/output/ThemeRoot-C_ZdzSMu.js.map +0 -1
- package/output/render-CnUd0XwZ.js.map +0 -1
- package/output/render-zHU25Nm9.cjs.map +0 -1
- package/output/shell-CumiARRe.js.map +0 -1
- package/output/shell-xxhV0p7k.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_ThemeRoot = require("./ThemeRoot-
|
|
1
|
+
const require_PageActions = require("./PageActions-1RDCHcUY.cjs");
|
|
2
|
+
const require_ThemeRoot = require("./ThemeRoot-DYS-lcK-.cjs");
|
|
3
3
|
let react = require("react");
|
|
4
4
|
let react_router_dom = require("react-router-dom");
|
|
5
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -23,22 +23,23 @@ function isHydrationDebugEnabled() {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
function render(options) {
|
|
26
|
-
const { config, routes, navigation, openApis = {}, footerComponent, container, themeEditor = false } = options;
|
|
26
|
+
const { config, routes, navigation, openApis = {}, bannerComponent, footerComponent, container, themeEditor = false } = options;
|
|
27
27
|
const target = container ?? document.getElementById("root");
|
|
28
28
|
if (!target) throw new Error("[clarify] 渲染失败:找不到挂载节点,请确保 HTML 中存在 id=\"root\" 的元素");
|
|
29
29
|
const app = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.StrictMode, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.BrowserRouter, {
|
|
30
30
|
basename: config.routePrefix,
|
|
31
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
31
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.ConfigContext.Provider, {
|
|
32
32
|
value: config,
|
|
33
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
33
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.OpenApisContext.Provider, {
|
|
34
34
|
value: openApis,
|
|
35
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
35
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.ThemeProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ThemeRoot.ThemeRoot, {
|
|
36
36
|
theme: config.theme,
|
|
37
37
|
themeEditor,
|
|
38
38
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ThemeRoot.AppShell, {
|
|
39
39
|
config,
|
|
40
40
|
routes,
|
|
41
41
|
navigation: navigation ?? [],
|
|
42
|
+
bannerComponent,
|
|
42
43
|
footerComponent
|
|
43
44
|
})
|
|
44
45
|
}) })
|
|
@@ -63,4 +64,4 @@ Object.defineProperty(exports, "render", {
|
|
|
63
64
|
}
|
|
64
65
|
});
|
|
65
66
|
|
|
66
|
-
//# sourceMappingURL=render-
|
|
67
|
+
//# sourceMappingURL=render-CRTqZzyY.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-CRTqZzyY.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 { ConfigContext, OpenApisContext } from '../context'\nimport { ThemeProvider } from '../theme/ThemeProvider'\nimport { ThemeRoot } from '../theme/ThemeRoot'\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 = {}, bannerComponent, footerComponent, container, themeEditor = false } = 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 <ConfigContext.Provider value={config}>\n <OpenApisContext.Provider value={openApis}>\n <ThemeProvider>\n <ThemeRoot theme={config.theme} themeEditor={themeEditor}>\n <AppShell config={config} routes={routes} navigation={navigation ?? []} bannerComponent={bannerComponent} footerComponent={footerComponent} />\n </ThemeRoot>\n </ThemeProvider>\n </OpenApisContext.Provider>\n </ConfigContext.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":";;;;;;;;;;;;;;;;;AAoBA,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,iBAAiB,iBAAiB,WAAW,cAAc,UAAU;CAExH,MAAM,SAAS,aAAa,SAAS,eAAe,MAAM;CAC1D,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,qDAAmD;CAGrE,MAAM,MACJ,iBAAA,GAAA,kBAAA,KAAC,MAAA,YAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,iBAAA,eAAD;EAAe,UAAU,OAAO;YAC9B,iBAAA,GAAA,kBAAA,KAAC,oBAAA,cAAc,UAAf;GAAwB,OAAO;aAC7B,iBAAA,GAAA,kBAAA,KAAC,oBAAA,gBAAgB,UAAjB;IAA0B,OAAO;cAC/B,iBAAA,GAAA,kBAAA,KAAC,oBAAA,eAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,kBAAA,WAAD;KAAW,OAAO,OAAO;KAAoB;eAC3C,iBAAA,GAAA,kBAAA,KAAC,kBAAA,UAAD;MAAkB;MAAgB;MAAQ,YAAY,cAAc,CAAC;MAAoB;MAAkC;KAAkB,CAAA;IACpI,CAAA,EACE,CAAA;GACS,CAAA;EACJ,CAAA;CACX,CAAA,EACL,CAAA;CAGd,MAAM,iBAAiB,wBAAwB;CAE/C,IAAI;EACF,CAAA,GAAA,iBAAA,aAAY,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,CAAA,GAAA,iBAAA,YAAW,MAAiB,EAAE,OAAO,GAAG;CAC1C;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as OpenApisContext, O as
|
|
2
|
-
import {
|
|
1
|
+
import { A as OpenApisContext, O as ConfigContext, m as ThemeProvider } from "./PageActions-yoDRjkq8.js";
|
|
2
|
+
import { c as AppShell, t as ThemeRoot } from "./ThemeRoot-CLa0yvRQ.js";
|
|
3
3
|
import { StrictMode } from "react";
|
|
4
4
|
import { BrowserRouter } from "react-router-dom";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -23,12 +23,12 @@ function isHydrationDebugEnabled() {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
function render(options) {
|
|
26
|
-
const { config, routes, navigation, openApis = {}, footerComponent, container, themeEditor = false } = options;
|
|
26
|
+
const { config, routes, navigation, openApis = {}, bannerComponent, footerComponent, container, themeEditor = false } = options;
|
|
27
27
|
const target = container ?? document.getElementById("root");
|
|
28
28
|
if (!target) throw new Error("[clarify] 渲染失败:找不到挂载节点,请确保 HTML 中存在 id=\"root\" 的元素");
|
|
29
29
|
const app = /* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(BrowserRouter, {
|
|
30
30
|
basename: config.routePrefix,
|
|
31
|
-
children: /* @__PURE__ */ jsx(
|
|
31
|
+
children: /* @__PURE__ */ jsx(ConfigContext.Provider, {
|
|
32
32
|
value: config,
|
|
33
33
|
children: /* @__PURE__ */ jsx(OpenApisContext.Provider, {
|
|
34
34
|
value: openApis,
|
|
@@ -39,6 +39,7 @@ function render(options) {
|
|
|
39
39
|
config,
|
|
40
40
|
routes,
|
|
41
41
|
navigation: navigation ?? [],
|
|
42
|
+
bannerComponent,
|
|
42
43
|
footerComponent
|
|
43
44
|
})
|
|
44
45
|
}) })
|
|
@@ -58,4 +59,4 @@ function render(options) {
|
|
|
58
59
|
//#endregion
|
|
59
60
|
export { render as t };
|
|
60
61
|
|
|
61
|
-
//# sourceMappingURL=render-
|
|
62
|
+
//# sourceMappingURL=render-D0ls3d2j.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-D0ls3d2j.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 { ConfigContext, OpenApisContext } from '../context'\nimport { ThemeProvider } from '../theme/ThemeProvider'\nimport { ThemeRoot } from '../theme/ThemeRoot'\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 = {}, bannerComponent, footerComponent, container, themeEditor = false } = 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 <ConfigContext.Provider value={config}>\n <OpenApisContext.Provider value={openApis}>\n <ThemeProvider>\n <ThemeRoot theme={config.theme} themeEditor={themeEditor}>\n <AppShell config={config} routes={routes} navigation={navigation ?? []} bannerComponent={bannerComponent} footerComponent={footerComponent} />\n </ThemeRoot>\n </ThemeProvider>\n </OpenApisContext.Provider>\n </ConfigContext.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":";;;;;;;;;;;;;;;;;AAoBA,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,iBAAiB,iBAAiB,WAAW,cAAc,UAAU;CAExH,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,cAAc,UAAf;GAAwB,OAAO;aAC7B,oBAAC,gBAAgB,UAAjB;IAA0B,OAAO;cAC/B,oBAAC,eAAD,EAAA,UACE,oBAAC,WAAD;KAAW,OAAO,OAAO;KAAoB;eAC3C,oBAAC,UAAD;MAAkB;MAAgB;MAAQ,YAAY,cAAc,CAAC;MAAoB;MAAkC;KAAkB,CAAA;IACpI,CAAA,EACE,CAAA;GACS,CAAA;EACJ,CAAA;CACX,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"}
|