@brett_lamy/docstream 0.3.4 → 0.3.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brett_lamy/docstream",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "GitBook-aware readonly markdown and AI stream renderer.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -75,4 +75,4 @@
75
75
  "@types/react": "^18.3.3",
76
76
  "typescript": "^5.5.4"
77
77
  }
78
- }
78
+ }
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { PlaygroundStreamdown as GitbookStreamdown } from "./playground/PlaygroundStreamdown"
2
2
  export type { PlaygroundStreamdownProps as GitbookStreamdownProps } from "./playground/PlaygroundStreamdown"
3
3
  export { DocsRenderer, MarkdownContent } from "./docs/DocsRenderer"
4
+ export type { LivePreviewProps, LivePreviewRenderer } from "./docs/DocsRenderer"
4
5
  export { ReplayEmbed, ReplayPreview } from "./replay"
5
6
  export type {
6
7
  ReplayEventsSource,
@@ -4,6 +4,7 @@ import {
4
4
  createReactDemoFiles,
5
5
  type AlmostNodeFiles,
6
6
  type AlmostNodeWorkspace,
7
+ type AlmostNodeWorkspaceOptions,
7
8
  } from "./filesystem"
8
9
 
9
10
  export interface ReactDemoProps {
@@ -21,6 +22,8 @@ export interface ReactDemoProps {
21
22
  autoStart?: boolean
22
23
  /** iframe sandbox value. The same-origin permission lets the almost-node service worker route the preview. */
23
24
  sandbox?: string
25
+ /** Extra options spread into `createAlmostNodeWorkspace` (e.g. `basePath` for static hosting). */
26
+ workspaceOptions?: Partial<AlmostNodeWorkspaceOptions>
24
27
  className?: string
25
28
  onReady?: (url: string) => void
26
29
  onError?: (error: Error) => void
@@ -49,6 +52,7 @@ export function ReactDemo({
49
52
  title = "Live React preview",
50
53
  autoStart = true,
51
54
  sandbox = "allow-scripts allow-same-origin allow-forms allow-modals",
55
+ workspaceOptions,
52
56
  className,
53
57
  onReady,
54
58
  onError,
@@ -77,9 +81,11 @@ export function ReactDemo({
77
81
  try {
78
82
  const projectFiles = createReactDemoFiles(files, { entry })
79
83
  workspace = await createAlmostNodeWorkspace(projectFiles, {
80
- env: DETACHED_SERVER_ENV,
81
- onServerReady: (_port, serverUrl) => {
84
+ ...workspaceOptions,
85
+ env: { ...DETACHED_SERVER_ENV, ...workspaceOptions?.env },
86
+ onServerReady: (serverPort, serverUrl) => {
82
87
  readyUrl = serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`
88
+ workspaceOptions?.onServerReady?.(serverPort, serverUrl)
83
89
  },
84
90
  })
85
91
 
@@ -114,7 +120,7 @@ export function ReactDemo({
114
120
  cancelled = true
115
121
  workspace?.dispose()
116
122
  }
117
- }, [entry, files, onError, onReady, port, run])
123
+ }, [entry, files, onError, onReady, port, run, workspaceOptions])
118
124
 
119
125
  const wrapperClass = className ? `docs-react-demo ${className}` : "docs-react-demo"
120
126
  const running = state === "starting"
package/src/styles.css CHANGED
@@ -713,27 +713,27 @@
713
713
  .hljs-type,
714
714
  .hljs-tag,
715
715
  .hljs-name {
716
- color: var(--chart-4, var(--gb-primary));
716
+ color: var(--chart-4, #cf222e);
717
717
  }
718
718
 
719
719
  .hljs-string,
720
720
  .hljs-attr,
721
721
  .hljs-symbol,
722
722
  .hljs-bullet {
723
- color: var(--chart-1, var(--gb-primary));
723
+ color: var(--chart-1, #0a7a4b);
724
724
  }
725
725
 
726
726
  .hljs-title,
727
727
  .hljs-section,
728
728
  .hljs-function .hljs-title {
729
- color: var(--chart-2, var(--gb-primary));
729
+ color: var(--chart-2, #8250df);
730
730
  }
731
731
 
732
732
  .hljs-number,
733
733
  .hljs-literal,
734
734
  .hljs-variable,
735
735
  .hljs-template-variable {
736
- color: var(--chart-3, var(--gb-primary));
736
+ color: var(--chart-3, #0550ae);
737
737
  }
738
738
 
739
739
  .hljs-comment,