boltdocs 1.0.1 → 1.0.4

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 (42) hide show
  1. package/dist/{CodeBlock-37XMKCYY.mjs → CodeBlock-V3Z5EKGR.mjs} +0 -1
  2. package/dist/{PackageManagerTabs-4NWXLXQO.mjs → PackageManagerTabs-XEKI3L7P.mjs} +0 -2
  3. package/dist/Playground-B2FA34BC.mjs +6 -0
  4. package/dist/{SearchDialog-ZAZXYIFX.css → SearchDialog-PYF3QMYG.css} +3 -3
  5. package/dist/{SearchDialog-FTOQZ763.mjs → SearchDialog-R36WKAQ7.mjs} +1 -2
  6. package/dist/{Video-I6QY4X7J.mjs → Video-KNTY5BNO.mjs} +0 -1
  7. package/dist/{chunk-ZFCOLEXN.mjs → chunk-TWSRXUFF.mjs} +7 -10
  8. package/dist/{chunk-PN4GCTYG.mjs → chunk-WPT4MWTQ.mjs} +25 -3
  9. package/dist/client/index.css +3 -3
  10. package/dist/client/index.d.mts +34 -4
  11. package/dist/client/index.d.ts +34 -4
  12. package/dist/client/index.js +28 -10
  13. package/dist/client/index.mjs +4 -5
  14. package/dist/client/ssr.css +3 -3
  15. package/dist/client/ssr.d.mts +1 -1
  16. package/dist/client/ssr.d.ts +1 -1
  17. package/dist/client/ssr.js +25 -3
  18. package/dist/client/ssr.mjs +1 -2
  19. package/dist/node/index.mjs +68 -28
  20. package/dist/{index-CRQKWAeo.d.mts → types-CvrzTbEX.d.mts} +1 -28
  21. package/dist/{index-CRQKWAeo.d.ts → types-CvrzTbEX.d.ts} +1 -28
  22. package/package.json +1 -1
  23. package/src/client/app/index.tsx +7 -56
  24. package/src/client/app/preload.tsx +1 -1
  25. package/src/client/index.ts +1 -1
  26. package/src/client/ssr.tsx +2 -1
  27. package/src/client/theme/components/Playground/Playground.tsx +40 -2
  28. package/src/client/theme/styles/markdown.css +3 -3
  29. package/src/client/theme/ui/Breadcrumbs/Breadcrumbs.tsx +1 -1
  30. package/src/client/theme/ui/LanguageSwitcher/LanguageSwitcher.tsx +1 -1
  31. package/src/client/theme/ui/Layout/Layout.tsx +1 -1
  32. package/src/client/theme/ui/Navbar/Navbar.tsx +1 -1
  33. package/src/client/theme/ui/SearchDialog/SearchDialog.tsx +1 -1
  34. package/src/client/theme/ui/VersionSwitcher/VersionSwitcher.tsx +1 -1
  35. package/src/client/types.ts +50 -0
  36. package/dist/Playground-OE2OE6B6.mjs +0 -7
  37. package/dist/chunk-X2TDGMTR.mjs +0 -64
  38. package/dist/chunk-X6BYQHVC.mjs +0 -12
  39. package/dist/node/cli/index.d.mts +0 -1
  40. package/dist/node/cli/index.d.ts +0 -1
  41. package/dist/node/cli/index.js +0 -199
  42. package/dist/node/cli/index.mjs +0 -154
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  CodeBlock
3
3
  } from "./chunk-2YRDWM6O.mjs";
4
- import "./chunk-X6BYQHVC.mjs";
5
4
  export {
6
5
  CodeBlock
7
6
  };
@@ -1,5 +1,3 @@
1
- import "./chunk-X6BYQHVC.mjs";
2
-
3
1
  // src/client/theme/components/PackageManagerTabs/PackageManagerTabs.tsx
4
2
  import { useState, useCallback } from "react";
5
3
  import { Copy, Check } from "lucide-react";
@@ -0,0 +1,6 @@
1
+ import {
2
+ Playground
3
+ } from "./chunk-WPT4MWTQ.mjs";
4
+ export {
5
+ Playground
6
+ };
@@ -1142,11 +1142,11 @@ a {
1142
1142
  background-color: transparent !important;
1143
1143
  }
1144
1144
  .code-block-wrapper pre > code {
1145
- padding: 1.25rem !important;
1146
- display: block !important;
1145
+ display: grid !important;
1146
+ padding: 1.25rem 1rem !important;
1147
1147
  }
1148
1148
  .code-block-wrapper pre > code .line {
1149
- padding: 0;
1149
+ padding: 0 1.25rem;
1150
1150
  }
1151
1151
  .boltdocs-page pre {
1152
1152
  margin: 1.5rem 0;
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  Link
3
- } from "./chunk-ZFCOLEXN.mjs";
4
- import "./chunk-X6BYQHVC.mjs";
3
+ } from "./chunk-TWSRXUFF.mjs";
5
4
 
6
5
  // src/client/theme/ui/SearchDialog/SearchDialog.tsx
7
6
  import React, { useState, useEffect, useRef } from "react";
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  Video
3
3
  } from "./chunk-Z7JHYNAS.mjs";
4
- import "./chunk-X6BYQHVC.mjs";
5
4
  export {
6
5
  Video
7
6
  };
@@ -897,20 +897,20 @@ function useConfig() {
897
897
  return useContext2(ConfigContext);
898
898
  }
899
899
  var CodeBlock = lazy(
900
- () => import("./CodeBlock-37XMKCYY.mjs").then((m) => ({
900
+ () => import("./CodeBlock-V3Z5EKGR.mjs").then((m) => ({
901
901
  default: m.CodeBlock
902
902
  }))
903
903
  );
904
904
  var Video = lazy(
905
- () => import("./Video-I6QY4X7J.mjs").then((m) => ({ default: m.Video }))
905
+ () => import("./Video-KNTY5BNO.mjs").then((m) => ({ default: m.Video }))
906
906
  );
907
907
  var PackageManagerTabs = lazy(
908
- () => import("./PackageManagerTabs-4NWXLXQO.mjs").then((m) => ({
908
+ () => import("./PackageManagerTabs-XEKI3L7P.mjs").then((m) => ({
909
909
  default: m.PackageManagerTabs
910
910
  }))
911
911
  );
912
912
  var Playground = lazy(
913
- () => import("./Playground-OE2OE6B6.mjs").then((m) => ({
913
+ () => import("./Playground-B2FA34BC.mjs").then((m) => ({
914
914
  default: m.Playground
915
915
  }))
916
916
  );
@@ -1105,11 +1105,8 @@ function createBoltdocsApp(options) {
1105
1105
  components: options.components
1106
1106
  }
1107
1107
  ) }) });
1108
- if (import.meta.env.PROD && container.innerHTML.trim() !== "") {
1109
- ReactDOM.hydrateRoot(container, app);
1110
- } else {
1111
- ReactDOM.createRoot(container).render(app);
1112
- }
1108
+ container.innerHTML = "";
1109
+ ReactDOM.createRoot(container).render(app);
1113
1110
  }
1114
1111
 
1115
1112
  // src/client/theme/ui/Link/Link.tsx
@@ -1525,7 +1522,7 @@ var XformerlyTwitter = (props) => /* @__PURE__ */ jsx24("svg", { ...props, fill:
1525
1522
  // src/client/theme/ui/Navbar/Navbar.tsx
1526
1523
  import { jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
1527
1524
  var SearchDialog = React11.lazy(
1528
- () => import("./SearchDialog-FTOQZ763.mjs").then((m) => ({ default: m.SearchDialog }))
1525
+ () => import("./SearchDialog-R36WKAQ7.mjs").then((m) => ({ default: m.SearchDialog }))
1529
1526
  );
1530
1527
  var ICON_MAP3 = {
1531
1528
  discord: Discord,
@@ -3,18 +3,40 @@ import React, { useState } from "react";
3
3
  import { LiveProvider, LiveEditor, LiveError, LivePreview } from "react-live";
4
4
  import { Copy, Check, Terminal, Play } from "lucide-react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ function prepareCode(raw) {
7
+ const trimmed = raw.trim();
8
+ const fnMatch = trimmed.match(/export\s+default\s+function\s+(\w+)/);
9
+ if (fnMatch) {
10
+ const name = fnMatch[1];
11
+ const code = trimmed.replace(/export\s+default\s+/, "") + `
12
+
13
+ render(<${name} />);`;
14
+ return { code, noInline: true };
15
+ }
16
+ const varMatch = trimmed.match(/export\s+default\s+(\w+)\s*;?\s*$/);
17
+ if (varMatch) {
18
+ const name = varMatch[1];
19
+ const code = trimmed.replace(/export\s+default\s+\w+\s*;?\s*$/, "") + `
20
+ render(<${name} />);`;
21
+ return { code, noInline: true };
22
+ }
23
+ return { code: trimmed, noInline: false };
24
+ }
6
25
  function Playground({
7
26
  code,
8
27
  children,
9
28
  scope = {},
10
- readonly = false
29
+ readonly = false,
30
+ noInline: forceNoInline
11
31
  }) {
12
32
  let initialCode = code || "";
13
33
  if (!initialCode && typeof children === "string") {
14
34
  initialCode = children;
15
35
  }
36
+ const prepared = prepareCode(initialCode);
37
+ const useNoInline = forceNoInline ?? prepared.noInline;
16
38
  const [copied, setCopied] = useState(false);
17
- const [activeCode, setActiveCode] = useState(initialCode.trim());
39
+ const [activeCode, setActiveCode] = useState(prepared.code);
18
40
  const handleCopy = () => {
19
41
  navigator.clipboard.writeText(activeCode);
20
42
  setCopied(true);
@@ -27,7 +49,7 @@ function Playground({
27
49
  code: activeCode,
28
50
  scope: extendedScope,
29
51
  theme: void 0,
30
- noInline: false,
52
+ noInline: useNoInline,
31
53
  children: /* @__PURE__ */ jsxs("div", { className: "playground-split-container", children: [
32
54
  /* @__PURE__ */ jsxs("div", { className: "playground-panel playground-editor-panel", children: [
33
55
  /* @__PURE__ */ jsxs("div", { className: "playground-panel-header", children: [
@@ -1142,11 +1142,11 @@ a {
1142
1142
  background-color: transparent !important;
1143
1143
  }
1144
1144
  .code-block-wrapper pre > code {
1145
- padding: 1.25rem !important;
1146
- display: block !important;
1145
+ display: grid !important;
1146
+ padding: 1.25rem 1rem !important;
1147
1147
  }
1148
1148
  .code-block-wrapper pre > code .line {
1149
- padding: 0;
1149
+ padding: 0 1.25rem;
1150
1150
  }
1151
1151
  .boltdocs-page pre {
1152
1152
  margin: 1.5rem 0;
@@ -1,11 +1,38 @@
1
1
  import { B as BoltdocsConfig } from '../config-D2XmHJYe.mjs';
2
2
  export { a as BoltdocsThemeConfig } from '../config-D2XmHJYe.mjs';
3
- import { C as ComponentRoute } from '../index-CRQKWAeo.mjs';
4
- export { a as CreateBoltdocsAppOptions, c as createBoltdocsApp } from '../index-CRQKWAeo.mjs';
3
+ import { C as CreateBoltdocsAppOptions, a as ComponentRoute } from '../types-CvrzTbEX.mjs';
5
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
5
  import React from 'react';
7
6
  import 'vite';
8
7
 
8
+ declare global {
9
+ interface ImportMeta {
10
+ env: Record<string, any>;
11
+ }
12
+ }
13
+ /**
14
+ * Creates and mounts the Boltdocs documentation app.
15
+ *
16
+ * Usage:
17
+ * ```tsx
18
+ * import { createBoltdocsApp } from 'boltdocs/client'
19
+ * import routes from 'virtual:boltdocs-routes'
20
+ * import config from 'virtual:boltdocs-config'
21
+ * import 'boltdocs/style.css'
22
+ * import HomePage from './HomePage'
23
+ *
24
+ * createBoltdocsApp({
25
+ * target: '#root',
26
+ * routes,
27
+ * config,
28
+ * modules: import.meta.glob('/docs/**\/*.{md,mdx}'),
29
+ * hot: import.meta.hot,
30
+ * homePage: HomePage,
31
+ * })
32
+ * ```
33
+ */
34
+ declare function createBoltdocsApp(options: CreateBoltdocsAppOptions): void;
35
+
9
36
  /**
10
37
  * The top navigation bar of the documentation site.
11
38
  */
@@ -109,12 +136,15 @@ interface PlaygroundProps {
109
136
  children?: string | React.ReactNode;
110
137
  scope?: Record<string, any>;
111
138
  readonly?: boolean;
139
+ noInline?: boolean;
112
140
  }
113
141
  /**
114
142
  * A live React playground component.
115
143
  * Features a split layout with a live editor and a preview section.
144
+ *
145
+ * Supports `export default function App()` style code out of the box.
116
146
  */
117
- declare function Playground({ code, children, scope, readonly, }: PlaygroundProps): react_jsx_runtime.JSX.Element;
147
+ declare function Playground({ code, children, scope, readonly, noInline: forceNoInline, }: PlaygroundProps): react_jsx_runtime.JSX.Element;
118
148
 
119
149
  declare function NotFound(): react_jsx_runtime.JSX.Element;
120
150
 
@@ -295,4 +325,4 @@ interface ListProps extends React.HTMLAttributes<HTMLUListElement> {
295
325
  */
296
326
  declare function List({ variant, children, className, ...rest }: ListProps): react_jsx_runtime.JSX.Element;
297
327
 
298
- export { Admonition, type AdmonitionProps, BackgroundGradient, Badge, type BadgeProps, BoltdocsConfig, Breadcrumbs, Button, type ButtonProps, Card, type CardProps, Cards, type CardsProps, CodeBlock, ComponentRoute, Danger, Head, InfoBox, List, type ListProps, Loading, Navbar, NotFound, Note, OnThisPage, Playground, Sidebar, Tab, type TabProps, Tabs, type TabsProps, ThemeLayout, Tip, Video, Warning };
328
+ export { Admonition, type AdmonitionProps, BackgroundGradient, Badge, type BadgeProps, BoltdocsConfig, Breadcrumbs, Button, type ButtonProps, Card, type CardProps, Cards, type CardsProps, CodeBlock, ComponentRoute, CreateBoltdocsAppOptions, Danger, Head, InfoBox, List, type ListProps, Loading, Navbar, NotFound, Note, OnThisPage, Playground, Sidebar, Tab, type TabProps, Tabs, type TabsProps, ThemeLayout, Tip, Video, Warning, createBoltdocsApp };
@@ -1,11 +1,38 @@
1
1
  import { B as BoltdocsConfig } from '../config-D2XmHJYe.js';
2
2
  export { a as BoltdocsThemeConfig } from '../config-D2XmHJYe.js';
3
- import { C as ComponentRoute } from '../index-CRQKWAeo.js';
4
- export { a as CreateBoltdocsAppOptions, c as createBoltdocsApp } from '../index-CRQKWAeo.js';
3
+ import { C as CreateBoltdocsAppOptions, a as ComponentRoute } from '../types-CvrzTbEX.js';
5
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
5
  import React from 'react';
7
6
  import 'vite';
8
7
 
8
+ declare global {
9
+ interface ImportMeta {
10
+ env: Record<string, any>;
11
+ }
12
+ }
13
+ /**
14
+ * Creates and mounts the Boltdocs documentation app.
15
+ *
16
+ * Usage:
17
+ * ```tsx
18
+ * import { createBoltdocsApp } from 'boltdocs/client'
19
+ * import routes from 'virtual:boltdocs-routes'
20
+ * import config from 'virtual:boltdocs-config'
21
+ * import 'boltdocs/style.css'
22
+ * import HomePage from './HomePage'
23
+ *
24
+ * createBoltdocsApp({
25
+ * target: '#root',
26
+ * routes,
27
+ * config,
28
+ * modules: import.meta.glob('/docs/**\/*.{md,mdx}'),
29
+ * hot: import.meta.hot,
30
+ * homePage: HomePage,
31
+ * })
32
+ * ```
33
+ */
34
+ declare function createBoltdocsApp(options: CreateBoltdocsAppOptions): void;
35
+
9
36
  /**
10
37
  * The top navigation bar of the documentation site.
11
38
  */
@@ -109,12 +136,15 @@ interface PlaygroundProps {
109
136
  children?: string | React.ReactNode;
110
137
  scope?: Record<string, any>;
111
138
  readonly?: boolean;
139
+ noInline?: boolean;
112
140
  }
113
141
  /**
114
142
  * A live React playground component.
115
143
  * Features a split layout with a live editor and a preview section.
144
+ *
145
+ * Supports `export default function App()` style code out of the box.
116
146
  */
117
- declare function Playground({ code, children, scope, readonly, }: PlaygroundProps): react_jsx_runtime.JSX.Element;
147
+ declare function Playground({ code, children, scope, readonly, noInline: forceNoInline, }: PlaygroundProps): react_jsx_runtime.JSX.Element;
118
148
 
119
149
  declare function NotFound(): react_jsx_runtime.JSX.Element;
120
150
 
@@ -295,4 +325,4 @@ interface ListProps extends React.HTMLAttributes<HTMLUListElement> {
295
325
  */
296
326
  declare function List({ variant, children, className, ...rest }: ListProps): react_jsx_runtime.JSX.Element;
297
327
 
298
- export { Admonition, type AdmonitionProps, BackgroundGradient, Badge, type BadgeProps, BoltdocsConfig, Breadcrumbs, Button, type ButtonProps, Card, type CardProps, Cards, type CardsProps, CodeBlock, ComponentRoute, Danger, Head, InfoBox, List, type ListProps, Loading, Navbar, NotFound, Note, OnThisPage, Playground, Sidebar, Tab, type TabProps, Tabs, type TabsProps, ThemeLayout, Tip, Video, Warning };
328
+ export { Admonition, type AdmonitionProps, BackgroundGradient, Badge, type BadgeProps, BoltdocsConfig, Breadcrumbs, Button, type ButtonProps, Card, type CardProps, Cards, type CardsProps, CodeBlock, ComponentRoute, CreateBoltdocsAppOptions, Danger, Head, InfoBox, List, type ListProps, Loading, Navbar, NotFound, Note, OnThisPage, Playground, Sidebar, Tab, type TabProps, Tabs, type TabsProps, ThemeLayout, Tip, Video, Warning, createBoltdocsApp };
@@ -2396,18 +2396,40 @@ var init_PackageManagerTabs2 = __esm({
2396
2396
  });
2397
2397
 
2398
2398
  // src/client/theme/components/Playground/Playground.tsx
2399
+ function prepareCode(raw) {
2400
+ const trimmed = raw.trim();
2401
+ const fnMatch = trimmed.match(/export\s+default\s+function\s+(\w+)/);
2402
+ if (fnMatch) {
2403
+ const name = fnMatch[1];
2404
+ const code = trimmed.replace(/export\s+default\s+/, "") + `
2405
+
2406
+ render(<${name} />);`;
2407
+ return { code, noInline: true };
2408
+ }
2409
+ const varMatch = trimmed.match(/export\s+default\s+(\w+)\s*;?\s*$/);
2410
+ if (varMatch) {
2411
+ const name = varMatch[1];
2412
+ const code = trimmed.replace(/export\s+default\s+\w+\s*;?\s*$/, "") + `
2413
+ render(<${name} />);`;
2414
+ return { code, noInline: true };
2415
+ }
2416
+ return { code: trimmed, noInline: false };
2417
+ }
2399
2418
  function Playground({
2400
2419
  code,
2401
2420
  children,
2402
2421
  scope = {},
2403
- readonly = false
2422
+ readonly = false,
2423
+ noInline: forceNoInline
2404
2424
  }) {
2405
2425
  let initialCode = code || "";
2406
2426
  if (!initialCode && typeof children === "string") {
2407
2427
  initialCode = children;
2408
2428
  }
2429
+ const prepared = prepareCode(initialCode);
2430
+ const useNoInline = forceNoInline ?? prepared.noInline;
2409
2431
  const [copied, setCopied] = (0, import_react18.useState)(false);
2410
- const [activeCode, setActiveCode] = (0, import_react18.useState)(initialCode.trim());
2432
+ const [activeCode, setActiveCode] = (0, import_react18.useState)(prepared.code);
2411
2433
  const handleCopy = () => {
2412
2434
  navigator.clipboard.writeText(activeCode);
2413
2435
  setCopied(true);
@@ -2420,7 +2442,7 @@ function Playground({
2420
2442
  code: activeCode,
2421
2443
  scope: extendedScope,
2422
2444
  theme: void 0,
2423
- noInline: false,
2445
+ noInline: useNoInline,
2424
2446
  children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "playground-split-container", children: [
2425
2447
  /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "playground-panel playground-editor-panel", children: [
2426
2448
  /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "playground-panel-header", children: [
@@ -2634,13 +2656,10 @@ function createBoltdocsApp(options) {
2634
2656
  components: options.components
2635
2657
  }
2636
2658
  ) }) });
2637
- if (import_meta.env.PROD && container.innerHTML.trim() !== "") {
2638
- import_client.default.hydrateRoot(container, app);
2639
- } else {
2640
- import_client.default.createRoot(container).render(app);
2641
- }
2659
+ container.innerHTML = "";
2660
+ import_client.default.createRoot(container).render(app);
2642
2661
  }
2643
- var import_react19, import_client, import_react_router_dom9, import_react20, import_react21, import_lucide_react17, import_jsx_runtime34, import_meta, ConfigContext, CodeBlock2, Video2, PackageManagerTabs2, Playground2, Heading, mdxComponents;
2662
+ var import_react19, import_client, import_react_router_dom9, import_react20, import_react21, import_lucide_react17, import_jsx_runtime34, ConfigContext, CodeBlock2, Video2, PackageManagerTabs2, Playground2, Heading, mdxComponents;
2644
2663
  var init_app = __esm({
2645
2664
  "src/client/app/index.tsx"() {
2646
2665
  "use strict";
@@ -2656,7 +2675,6 @@ var init_app = __esm({
2656
2675
  init_mdx();
2657
2676
  init_preload();
2658
2677
  import_jsx_runtime34 = require("react/jsx-runtime");
2659
- import_meta = {};
2660
2678
  ConfigContext = (0, import_react21.createContext)(null);
2661
2679
  CodeBlock2 = (0, import_react21.lazy)(
2662
2680
  () => Promise.resolve().then(() => (init_CodeBlock2(), CodeBlock_exports)).then((m) => ({
@@ -1,6 +1,3 @@
1
- import {
2
- Playground
3
- } from "../chunk-PN4GCTYG.mjs";
4
1
  import {
5
2
  Admonition,
6
3
  BackgroundGradient,
@@ -25,14 +22,16 @@ import {
25
22
  Tip,
26
23
  Warning,
27
24
  createBoltdocsApp
28
- } from "../chunk-ZFCOLEXN.mjs";
25
+ } from "../chunk-TWSRXUFF.mjs";
29
26
  import {
30
27
  CodeBlock
31
28
  } from "../chunk-2YRDWM6O.mjs";
32
29
  import {
33
30
  Video
34
31
  } from "../chunk-Z7JHYNAS.mjs";
35
- import "../chunk-X6BYQHVC.mjs";
32
+ import {
33
+ Playground
34
+ } from "../chunk-WPT4MWTQ.mjs";
36
35
  export {
37
36
  Admonition,
38
37
  BackgroundGradient,
@@ -1142,11 +1142,11 @@ a {
1142
1142
  background-color: transparent !important;
1143
1143
  }
1144
1144
  .code-block-wrapper pre > code {
1145
- padding: 1.25rem !important;
1146
- display: block !important;
1145
+ display: grid !important;
1146
+ padding: 1.25rem 1rem !important;
1147
1147
  }
1148
1148
  .code-block-wrapper pre > code .line {
1149
- padding: 0;
1149
+ padding: 0 1.25rem;
1150
1150
  }
1151
1151
  .boltdocs-page pre {
1152
1152
  margin: 1.5rem 0;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { C as ComponentRoute } from '../index-CRQKWAeo.mjs';
2
+ import { a as ComponentRoute } from '../types-CvrzTbEX.mjs';
3
3
 
4
4
  /**
5
5
  * Options for rendering the Boltdocs application on the server (SSG).
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { C as ComponentRoute } from '../index-CRQKWAeo.js';
2
+ import { a as ComponentRoute } from '../types-CvrzTbEX.js';
3
3
 
4
4
  /**
5
5
  * Options for rendering the Boltdocs application on the server (SSG).
@@ -2396,18 +2396,40 @@ var init_PackageManagerTabs2 = __esm({
2396
2396
  });
2397
2397
 
2398
2398
  // src/client/theme/components/Playground/Playground.tsx
2399
+ function prepareCode(raw) {
2400
+ const trimmed = raw.trim();
2401
+ const fnMatch = trimmed.match(/export\s+default\s+function\s+(\w+)/);
2402
+ if (fnMatch) {
2403
+ const name = fnMatch[1];
2404
+ const code = trimmed.replace(/export\s+default\s+/, "") + `
2405
+
2406
+ render(<${name} />);`;
2407
+ return { code, noInline: true };
2408
+ }
2409
+ const varMatch = trimmed.match(/export\s+default\s+(\w+)\s*;?\s*$/);
2410
+ if (varMatch) {
2411
+ const name = varMatch[1];
2412
+ const code = trimmed.replace(/export\s+default\s+\w+\s*;?\s*$/, "") + `
2413
+ render(<${name} />);`;
2414
+ return { code, noInline: true };
2415
+ }
2416
+ return { code: trimmed, noInline: false };
2417
+ }
2399
2418
  function Playground({
2400
2419
  code,
2401
2420
  children,
2402
2421
  scope = {},
2403
- readonly = false
2422
+ readonly = false,
2423
+ noInline: forceNoInline
2404
2424
  }) {
2405
2425
  let initialCode = code || "";
2406
2426
  if (!initialCode && typeof children === "string") {
2407
2427
  initialCode = children;
2408
2428
  }
2429
+ const prepared = prepareCode(initialCode);
2430
+ const useNoInline = forceNoInline ?? prepared.noInline;
2409
2431
  const [copied, setCopied] = (0, import_react18.useState)(false);
2410
- const [activeCode, setActiveCode] = (0, import_react18.useState)(initialCode.trim());
2432
+ const [activeCode, setActiveCode] = (0, import_react18.useState)(prepared.code);
2411
2433
  const handleCopy = () => {
2412
2434
  navigator.clipboard.writeText(activeCode);
2413
2435
  setCopied(true);
@@ -2420,7 +2442,7 @@ function Playground({
2420
2442
  code: activeCode,
2421
2443
  scope: extendedScope,
2422
2444
  theme: void 0,
2423
- noInline: false,
2445
+ noInline: useNoInline,
2424
2446
  children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "playground-split-container", children: [
2425
2447
  /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "playground-panel playground-editor-panel", children: [
2426
2448
  /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "playground-panel-header", children: [
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  AppShell
3
- } from "../chunk-ZFCOLEXN.mjs";
4
- import "../chunk-X6BYQHVC.mjs";
3
+ } from "../chunk-TWSRXUFF.mjs";
5
4
 
6
5
  // src/client/ssr.tsx
7
6
  import React from "react";