@clarify-labs/renderer 0.2.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 -79
  23. package/output/components/patterns.d.ts +4 -2
  24. package/output/context.d.ts +1 -6
  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 -0
  30. package/output/index.cjs +135 -766
  31. package/output/index.cjs.map +1 -1
  32. package/output/index.d.ts +15 -4
  33. package/output/index.js +108 -751
  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/components/ExamplePanels.d.ts +36 -0
  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 -20
  48. package/output/openapi/lib/helpers.d.ts +25 -0
  49. package/output/openapi/lib/request-code.d.ts +18 -0
  50. package/output/openapi/lib/spec-path.d.ts +2 -0
  51. package/output/openapi/types.d.ts +70 -0
  52. package/output/preview/openapi.d.ts +28 -0
  53. package/output/preview.cjs +734 -0
  54. package/output/preview.cjs.map +1 -0
  55. package/output/preview.d.ts +19 -0
  56. package/output/preview.js +731 -0
  57. package/output/preview.js.map +1 -0
  58. package/output/remark-DNOdJz5i.cjs +14 -0
  59. package/output/remark-DNOdJz5i.cjs.map +1 -0
  60. package/output/remark-o5sg9Ilv.js +7 -0
  61. package/output/remark-o5sg9Ilv.js.map +1 -0
  62. package/output/{render-bPMMBoDH.js → render-BpavVnAe.js} +3 -2
  63. package/output/render-BpavVnAe.js.map +1 -0
  64. package/output/{render-z9rSQ00n.cjs → render-CjZt3edL.cjs} +6 -5
  65. package/output/render-CjZt3edL.cjs.map +1 -0
  66. package/output/renderer.css +1702 -591
  67. package/output/server.cjs +7 -5
  68. package/output/server.cjs.map +1 -1
  69. package/output/server.js +4 -2
  70. package/output/server.js.map +1 -1
  71. package/output/shell/ContentActions.d.ts +1 -0
  72. package/output/shell/Header.d.ts +4 -3
  73. package/output/shell/Navigation.d.ts +3 -2
  74. package/output/shell/Search.d.ts +6 -4
  75. package/output/{components → shell}/SiteLogo.d.ts +1 -1
  76. package/output/shell/icons.d.ts +5 -0
  77. package/output/shell/mobile.d.ts +5 -3
  78. package/output/{AppShell-Ci894P_0.js → shell-BlMMdTpZ.js} +1228 -867
  79. package/output/shell-BlMMdTpZ.js.map +1 -0
  80. package/output/{AppShell-4KB3lU-n.cjs → shell-_MyLsMUI.cjs} +1403 -1036
  81. package/output/shell-_MyLsMUI.cjs.map +1 -0
  82. package/output/{components → theme}/ThemeProvider.d.ts +3 -2
  83. package/output/types.d.ts +1 -121
  84. package/output/utils/clipboard.d.ts +1 -0
  85. package/output/utils/hash.d.ts +1 -0
  86. package/output/utils/href.d.ts +5 -0
  87. package/output/utils/lucide.d.ts +17 -0
  88. package/output/utils/path.d.ts +2 -0
  89. package/package.json +24 -10
  90. package/output/AppShell-4KB3lU-n.cjs.map +0 -1
  91. package/output/AppShell-Ci894P_0.js.map +0 -1
  92. package/output/render-bPMMBoDH.js.map +0 -1
  93. package/output/render-z9rSQ00n.cjs.map +0 -1
  94. /package/output/{components → app}/BuiltWithClarify.d.ts +0 -0
  95. /package/output/{components → app}/PageFooter.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/server.cjs CHANGED
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_AppShell = require("./AppShell-4KB3lU-n.cjs");
2
+ const require_shell = require("./shell-_MyLsMUI.cjs");
3
+ const require_AppShell = require("./AppShell-DeaJ-rgo.cjs");
3
4
  let react = require("react");
4
5
  let react_router_dom = require("react-router-dom");
5
6
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -12,14 +13,15 @@ let react_dom_server = require("react-dom/server");
12
13
  */
13
14
  function renderToHTML(options) {
14
15
  const { config, routes, navigation, openApis = {}, url } = options;
16
+ const location = require_shell.prefixHref(url, config.routePrefix);
15
17
  return (0, react_dom_server.renderToString)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.StrictMode, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.StaticRouter, {
16
18
  basename: config.routePrefix,
17
- location: url,
18
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AppShell.ClarifyConfigContext.Provider, {
19
+ location,
20
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_shell.ClarifyConfigContext.Provider, {
19
21
  value: config,
20
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AppShell.OpenApisContext.Provider, {
22
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_shell.OpenApisContext.Provider, {
21
23
  value: openApis,
22
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AppShell.ThemeProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AppShell.AppShell, {
24
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_shell.ThemeProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AppShell.AppShell, {
23
25
  config,
24
26
  routes,
25
27
  navigation: navigation ?? []
@@ -1 +1 @@
1
- {"version":3,"file":"server.cjs","names":[],"sources":["../source/runtime/server.tsx"],"sourcesContent":["import { StrictMode } from 'react'\nimport { renderToString } from 'react-dom/server'\nimport { StaticRouter } from 'react-router-dom'\n\nimport { AppShell } from '../app/AppShell'\nimport { ThemeProvider } from '../components/ThemeProvider'\nimport { ClarifyConfigContext, OpenApisContext } from '../context'\nimport type { ServerRenderOptions } from '../types'\n\n/**\n * Clarify 服务端渲染入口。\n * 由 @clarify-labs/cli 在构建时调用,为每条路由生成 React HTML 片段。\n * 返回 `div#root` 内部的 HTML,由 Clarify CLI 组装为完整的 HTML 文档。\n */\nexport function renderToHTML(options: ServerRenderOptions): string {\n const { config, routes, navigation, openApis = {}, url } = options\n\n return renderToString(\n <StrictMode>\n <StaticRouter basename={config.routePrefix} location={url}>\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 </StaticRouter>\n </StrictMode>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAcA,SAAgB,aAAa,SAAsC;CACjE,MAAM,EAAE,QAAQ,QAAQ,YAAY,WAAW,CAAC,GAAG,QAAQ;CAE3D,QAAA,GAAA,iBAAA,gBACE,iBAAA,GAAA,kBAAA,KAAC,MAAA,YAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,iBAAA,cAAD;EAAc,UAAU,OAAO;EAAa,UAAU;YACpD,iBAAA,GAAA,kBAAA,KAAC,iBAAA,qBAAqB,UAAtB;GAA+B,OAAO;aACpC,iBAAA,GAAA,kBAAA,KAAC,iBAAA,gBAAgB,UAAjB;IAA0B,OAAO;cAC/B,iBAAA,GAAA,kBAAA,KAAC,iBAAA,eAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,iBAAA,UAAD;KAAkB;KAAgB;KAAQ,YAAY,cAAc,CAAC;IAAI,CAAA,EAC5D,CAAA;GACS,CAAA;EACG,CAAA;CACnB,CAAA,EACJ,CAAA,CACd;AACF"}
1
+ {"version":3,"file":"server.cjs","names":[],"sources":["../source/runtime/server.tsx"],"sourcesContent":["import { StrictMode } from 'react'\nimport { renderToString } from 'react-dom/server'\nimport { StaticRouter } from 'react-router-dom'\n\nimport { AppShell } from '../app/AppShell'\nimport { ClarifyConfigContext, OpenApisContext } from '../context'\nimport { ThemeProvider } from '../theme/ThemeProvider'\nimport type { ServerRenderOptions } from '../types'\nimport { prefixHref } from '../utils/href'\n\n/**\n * Clarify 服务端渲染入口。\n * 由 @clarify-labs/cli 在构建时调用,为每条路由生成 React HTML 片段。\n * 返回 `div#root` 内部的 HTML,由 Clarify CLI 组装为完整的 HTML 文档。\n */\nexport function renderToHTML(options: ServerRenderOptions): string {\n const { config, routes, navigation, openApis = {}, url } = options\n const location = prefixHref(url, config.routePrefix)\n\n return renderToString(\n <StrictMode>\n <StaticRouter basename={config.routePrefix} location={location}>\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 </StaticRouter>\n </StrictMode>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,SAAgB,aAAa,SAAsC;CACjE,MAAM,EAAE,QAAQ,QAAQ,YAAY,WAAW,CAAC,GAAG,QAAQ;CAC3D,MAAM,WAAW,cAAA,WAAW,KAAK,OAAO,WAAW;CAEnD,QAAA,GAAA,iBAAA,gBACE,iBAAA,GAAA,kBAAA,KAAC,MAAA,YAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,iBAAA,cAAD;EAAc,UAAU,OAAO;EAAuB;YACpD,iBAAA,GAAA,kBAAA,KAAC,cAAA,qBAAqB,UAAtB;GAA+B,OAAO;aACpC,iBAAA,GAAA,kBAAA,KAAC,cAAA,gBAAgB,UAAjB;IAA0B,OAAO;cAC/B,iBAAA,GAAA,kBAAA,KAAC,cAAA,eAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,iBAAA,UAAD;KAAkB;KAAgB;KAAQ,YAAY,cAAc,CAAC;IAAI,CAAA,EAC5D,CAAA;GACS,CAAA;EACG,CAAA;CACnB,CAAA,EACJ,CAAA,CACd;AACF"}
package/output/server.js CHANGED
@@ -1,4 +1,5 @@
1
- import { m as OpenApisContext, p as ClarifyConfigContext, t as AppShell, u as ThemeProvider } from "./AppShell-Ci894P_0.js";
1
+ import { A as prefixHref, F as OpenApisContext, N as ClarifyConfigContext, T as ThemeProvider } from "./shell-BlMMdTpZ.js";
2
+ import { t as AppShell } from "./AppShell-D3FsVHQK.js";
2
3
  import { StrictMode } from "react";
3
4
  import { StaticRouter } from "react-router-dom";
4
5
  import { jsx } from "react/jsx-runtime";
@@ -11,9 +12,10 @@ import { renderToString } from "react-dom/server";
11
12
  */
12
13
  function renderToHTML(options) {
13
14
  const { config, routes, navigation, openApis = {}, url } = options;
15
+ const location = prefixHref(url, config.routePrefix);
14
16
  return renderToString(/* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(StaticRouter, {
15
17
  basename: config.routePrefix,
16
- location: url,
18
+ location,
17
19
  children: /* @__PURE__ */ jsx(ClarifyConfigContext.Provider, {
18
20
  value: config,
19
21
  children: /* @__PURE__ */ jsx(OpenApisContext.Provider, {
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","names":[],"sources":["../source/runtime/server.tsx"],"sourcesContent":["import { StrictMode } from 'react'\nimport { renderToString } from 'react-dom/server'\nimport { StaticRouter } from 'react-router-dom'\n\nimport { AppShell } from '../app/AppShell'\nimport { ThemeProvider } from '../components/ThemeProvider'\nimport { ClarifyConfigContext, OpenApisContext } from '../context'\nimport type { ServerRenderOptions } from '../types'\n\n/**\n * Clarify 服务端渲染入口。\n * 由 @clarify-labs/cli 在构建时调用,为每条路由生成 React HTML 片段。\n * 返回 `div#root` 内部的 HTML,由 Clarify CLI 组装为完整的 HTML 文档。\n */\nexport function renderToHTML(options: ServerRenderOptions): string {\n const { config, routes, navigation, openApis = {}, url } = options\n\n return renderToString(\n <StrictMode>\n <StaticRouter basename={config.routePrefix} location={url}>\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 </StaticRouter>\n </StrictMode>\n )\n}\n"],"mappings":";;;;;;;;;;;AAcA,SAAgB,aAAa,SAAsC;CACjE,MAAM,EAAE,QAAQ,QAAQ,YAAY,WAAW,CAAC,GAAG,QAAQ;CAE3D,OAAO,eACL,oBAAC,YAAD,EAAA,UACE,oBAAC,cAAD;EAAc,UAAU,OAAO;EAAa,UAAU;YACpD,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;CACnB,CAAA,EACJ,CAAA,CACd;AACF"}
1
+ {"version":3,"file":"server.js","names":[],"sources":["../source/runtime/server.tsx"],"sourcesContent":["import { StrictMode } from 'react'\nimport { renderToString } from 'react-dom/server'\nimport { StaticRouter } from 'react-router-dom'\n\nimport { AppShell } from '../app/AppShell'\nimport { ClarifyConfigContext, OpenApisContext } from '../context'\nimport { ThemeProvider } from '../theme/ThemeProvider'\nimport type { ServerRenderOptions } from '../types'\nimport { prefixHref } from '../utils/href'\n\n/**\n * Clarify 服务端渲染入口。\n * 由 @clarify-labs/cli 在构建时调用,为每条路由生成 React HTML 片段。\n * 返回 `div#root` 内部的 HTML,由 Clarify CLI 组装为完整的 HTML 文档。\n */\nexport function renderToHTML(options: ServerRenderOptions): string {\n const { config, routes, navigation, openApis = {}, url } = options\n const location = prefixHref(url, config.routePrefix)\n\n return renderToString(\n <StrictMode>\n <StaticRouter basename={config.routePrefix} location={location}>\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 </StaticRouter>\n </StrictMode>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAeA,SAAgB,aAAa,SAAsC;CACjE,MAAM,EAAE,QAAQ,QAAQ,YAAY,WAAW,CAAC,GAAG,QAAQ;CAC3D,MAAM,WAAW,WAAW,KAAK,OAAO,WAAW;CAEnD,OAAO,eACL,oBAAC,YAAD,EAAA,UACE,oBAAC,cAAD;EAAc,UAAU,OAAO;EAAuB;YACpD,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;CACnB,CAAA,EACJ,CAAA,CACd;AACF"}
@@ -1,5 +1,6 @@
1
1
  import { RouteItem } from '../types';
2
2
  type ContentActionsProps = {
3
+ hasTabs?: boolean;
3
4
  route?: RouteItem;
4
5
  routePrefix?: string;
5
6
  };
@@ -1,8 +1,9 @@
1
- import { ClarifyConfig, NavigationNode, RouteItem } from '../types';
2
- export declare const Header: import('react').ForwardRefExoticComponent<Omit<Omit<import('framer-motion').HTMLMotionProps<"div">, "ref"> & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
1
+ import { ClarifyConfig, NavigationNode, NavigationTab, RouteItem } from '../types';
2
+ export declare const Header: import('react').ForwardRefExoticComponent<Omit<Omit<import('framer-motion').HTMLMotionProps<"header">, "ref"> & import('react').RefAttributes<HTMLElement>, "ref"> & {
3
3
  config: ClarifyConfig;
4
4
  navigation: NavigationNode[];
5
+ tabs?: NavigationTab[];
5
6
  routes: RouteItem[];
6
7
  currentLocale?: string;
7
8
  currentRoute?: RouteItem;
8
- } & import('react').RefAttributes<HTMLDivElement>>;
9
+ } & import('react').RefAttributes<HTMLElement>>;
@@ -1,5 +1,6 @@
1
1
  import { NavigationNode } from '../types';
2
- export declare function Navigation(arg0: {
2
+ export type NavigationProps = {
3
3
  navigation: NavigationNode[];
4
4
  className?: string;
5
- }): import("react").JSX.Element;
5
+ };
6
+ export declare function Navigation(arg0: NavigationProps): import("react").JSX.Element;
@@ -1,10 +1,12 @@
1
1
  import { NavigationNode, RouteItem } from '../types';
2
- export declare function Search(arg0: {
2
+ export type SearchProps = {
3
3
  routes: RouteItem[];
4
4
  navigation: NavigationNode[];
5
- }): import("react").JSX.Element;
6
- export declare function MobileSearch(arg0: {
5
+ };
6
+ export declare function Search(arg0: SearchProps): import("react").JSX.Element;
7
+ export type MobileSearchProps = {
7
8
  routes: RouteItem[];
8
9
  navigation: NavigationNode[];
9
10
  onNavigate?: () => void;
10
- }): import("react").JSX.Element;
11
+ };
12
+ export declare function MobileSearch(arg0: MobileSearchProps): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { ClarifyLogoConfig } from '../types';
1
+ import { ClarifyLogoConfig } from '../core/types';
2
2
  export type SiteLogoProps = {
3
3
  logo?: ClarifyLogoConfig;
4
4
  className?: string;
@@ -0,0 +1,5 @@
1
+ export type NavigationIconProps = {
2
+ name?: string;
3
+ className?: string;
4
+ };
5
+ export declare function NavigationIcon(arg0: NavigationIconProps): import("react").JSX.Element | null;
@@ -1,4 +1,4 @@
1
- import { ClarifyConfig, NavigationNode, RouteItem } from '../types';
1
+ import { ClarifyConfig, NavigationNode, NavigationTab, RouteItem } from '../types';
2
2
  export declare function useIsInsideMobileNavigation(): boolean;
3
3
  export declare const useMobileNavigationStore: import('zustand').UseBoundStore<import('zustand').StoreApi<{
4
4
  isOpen: boolean;
@@ -6,10 +6,12 @@ export declare const useMobileNavigationStore: import('zustand').UseBoundStore<i
6
6
  close: () => void;
7
7
  toggle: () => void;
8
8
  }>>;
9
- export declare function MobileNavigation(arg0: {
9
+ export type MobileNavigationProps = {
10
10
  config: ClarifyConfig;
11
11
  navigation: NavigationNode[];
12
+ tabs?: NavigationTab[];
12
13
  routes: RouteItem[];
13
14
  currentLocale?: string;
14
15
  currentRoute?: RouteItem;
15
- }): import("react").JSX.Element;
16
+ };
17
+ export declare function MobileNavigation(arg0: MobileNavigationProps): import("react").JSX.Element;