@lofcz/streamdown 2.14.1 → 2.15.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/dist/block-KAMYR4TF.js +3 -0
- package/dist/chunk-BSY33EDM.js +51 -0
- package/dist/chunk-GKDS2YGT.js +2 -0
- package/dist/highlighted-body-M2KTRTZG.js +2 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.js +1 -1
- package/dist/lib/controls.d.ts +2 -2
- package/dist/lib/diagram/adapter.d.ts +11 -0
- package/dist/lib/diagram/block.d.ts +10 -0
- package/dist/lib/diagram/context.d.ts +2 -0
- package/dist/lib/diagram/controls.d.ts +4 -0
- package/dist/lib/diagram/download-button.d.ts +15 -0
- package/dist/lib/diagram/fullscreen-button.d.ts +23 -0
- package/dist/lib/diagram/index.d.ts +13 -0
- package/dist/lib/diagram/labels.d.ts +6 -0
- package/dist/lib/diagram/options.d.ts +1 -0
- package/dist/lib/mermaid/download-button.d.ts +1 -1
- package/dist/lib/mermaid/fullscreen-button.d.ts +1 -1
- package/dist/lib/mermaid/index.d.ts +3 -3
- package/dist/lib/plantuml/download-button.d.ts +1 -1
- package/dist/lib/plantuml/fullscreen-button.d.ts +1 -1
- package/dist/lib/plantuml/index.d.ts +3 -3
- package/dist/lib/plugin-context.d.ts +18 -1
- package/dist/lib/plugin-types.d.ts +96 -1
- package/dist/lib/preprocess-custom-tags.d.ts +5 -0
- package/dist/lib/smiles/compact.d.ts +8 -0
- package/dist/lib/smiles/notation-toggle.d.ts +6 -0
- package/dist/lib/streamdown-context.d.ts +39 -19
- package/dist/lib/tailwind-classes.d.ts +1 -1
- package/dist/lib/tailwind-classes.js +1 -1
- package/dist/lib/translations-context.d.ts +23 -0
- package/dist/openscad-VI3FNOEN.js +2 -0
- package/dist/{viewer-A5T7PMUM.js → viewer-SB7OV4V7.js} +1 -1
- package/package.json +1 -1
- package/dist/chunk-EMUDB4GM.js +0 -2
- package/dist/chunk-FYGB27SX.js +0 -50
- package/dist/highlighted-body-PPVGTFLS.js +0 -2
- package/dist/mermaid-HNKQSOWL.js +0 -2
- package/dist/openscad-6N3MT4TE.js +0 -2
- package/dist/plantuml-GGYHKHKF.js +0 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { PlantUmlConfig } from "../plugin-types";
|
|
2
1
|
interface PlantUmlProps {
|
|
3
2
|
chart: string;
|
|
4
3
|
className?: string;
|
|
5
|
-
config?:
|
|
4
|
+
config?: unknown;
|
|
6
5
|
fullscreen?: boolean;
|
|
6
|
+
language?: string;
|
|
7
7
|
showControls?: boolean;
|
|
8
8
|
}
|
|
9
|
-
export declare const PlantUml: ({ chart, className, config, fullscreen, showControls, }: PlantUmlProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const PlantUml: ({ chart, className, config, fullscreen, language, showControls, }: PlantUmlProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginConfig } from "./plugin-types";
|
|
1
|
+
import type { PluginConfig, SvgDiagramPlugin } from "./plugin-types";
|
|
2
2
|
/**
|
|
3
3
|
* Context for Streamdown plugins
|
|
4
4
|
*/
|
|
@@ -19,6 +19,23 @@ export declare const useMermaidPlugin: () => import("./plugin-types").DiagramPlu
|
|
|
19
19
|
* Hook to access the PlantUML plugin
|
|
20
20
|
*/
|
|
21
21
|
export declare const usePlantUmlPlugin: () => import("./plugin-types").PlantUmlPlugin | null;
|
|
22
|
+
/**
|
|
23
|
+
* Hook to access the Vega plugin
|
|
24
|
+
*/
|
|
25
|
+
export declare const useVegaPlugin: () => SvgDiagramPlugin | import("./plugin-types").VegaPlugin | null;
|
|
26
|
+
/**
|
|
27
|
+
* Hook to access the SMILES plugin
|
|
28
|
+
*/
|
|
29
|
+
export declare const useSmilesPlugin: () => import("./plugin-types").SmilesPlugin | SvgDiagramPlugin | null;
|
|
30
|
+
/**
|
|
31
|
+
* All SVG diagram plugins, including named mermaid / plantuml / vega / smiles
|
|
32
|
+
* slots and extras from `plugins.diagrams`.
|
|
33
|
+
*/
|
|
34
|
+
export declare const useDiagramPlugins: () => SvgDiagramPlugin[];
|
|
35
|
+
/**
|
|
36
|
+
* Find an SVG diagram plugin for a fence language.
|
|
37
|
+
*/
|
|
38
|
+
export declare const useDiagramPlugin: (language: string) => SvgDiagramPlugin | null;
|
|
22
39
|
/**
|
|
23
40
|
* Hook to access the OpenSCAD plugin
|
|
24
41
|
*/
|
|
@@ -91,6 +91,62 @@ export interface DiagramPlugin {
|
|
|
91
91
|
name: "mermaid";
|
|
92
92
|
type: "diagram";
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Shared SVG diagram contract used by the generic renderer.
|
|
96
|
+
* Mermaid and PlantUML are adapted to this shape in core; Vega implements it
|
|
97
|
+
* natively. Extra engines (Graphviz, D2, …) can be passed via `plugins.diagrams`.
|
|
98
|
+
*/
|
|
99
|
+
export interface SvgDiagramPlugin {
|
|
100
|
+
/**
|
|
101
|
+
* Language identifiers for code blocks
|
|
102
|
+
*/
|
|
103
|
+
language: string | readonly string[];
|
|
104
|
+
name: string;
|
|
105
|
+
/**
|
|
106
|
+
* Render source to an SVG string. `options` is plugin-specific and may
|
|
107
|
+
* include a `language` field for engines that handle multiple fences.
|
|
108
|
+
*/
|
|
109
|
+
render: (source: string, options?: unknown) => Promise<{
|
|
110
|
+
svg: string;
|
|
111
|
+
}>;
|
|
112
|
+
/**
|
|
113
|
+
* File extension (no dot) used when downloading the source.
|
|
114
|
+
* @default "txt"
|
|
115
|
+
*/
|
|
116
|
+
sourceExtension?: string;
|
|
117
|
+
type: "diagram";
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Structural type for Vega / Vega-Lite configuration.
|
|
121
|
+
* Avoids a hard dependency on `vega` / `vega-lite` in the core bundle.
|
|
122
|
+
*/
|
|
123
|
+
export interface VegaConfig {
|
|
124
|
+
/**
|
|
125
|
+
* How to interpret the spec. `"auto"` uses the fence language and `$schema`.
|
|
126
|
+
*/
|
|
127
|
+
mode?: "auto" | "vega" | "vega-lite";
|
|
128
|
+
}
|
|
129
|
+
export interface VegaInstance {
|
|
130
|
+
render: (source: string, options?: VegaConfig) => Promise<{
|
|
131
|
+
svg: string;
|
|
132
|
+
}>;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Plugin for diagram rendering (Vega / Vega-Lite)
|
|
136
|
+
*/
|
|
137
|
+
export interface VegaPlugin {
|
|
138
|
+
/**
|
|
139
|
+
* Get the Vega instance (initialized with optional config)
|
|
140
|
+
*/
|
|
141
|
+
getVega: (config?: VegaConfig) => VegaInstance;
|
|
142
|
+
/**
|
|
143
|
+
* Language identifiers for code blocks (`vega`, `vega-lite`, `vegalite`)
|
|
144
|
+
*/
|
|
145
|
+
language: string | readonly string[];
|
|
146
|
+
name: "vega";
|
|
147
|
+
sourceExtension?: string;
|
|
148
|
+
type: "diagram";
|
|
149
|
+
}
|
|
94
150
|
/**
|
|
95
151
|
* Structural type for PlantUML configuration.
|
|
96
152
|
* Avoids a hard dependency on `@plantuml/core` in the core bundle.
|
|
@@ -189,10 +245,42 @@ export interface OpenScadPlugin {
|
|
|
189
245
|
name: "openscad";
|
|
190
246
|
type: "model";
|
|
191
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Structural type for SMILES configuration.
|
|
250
|
+
* Avoids a hard dependency on `smiles-drawer` in the core bundle.
|
|
251
|
+
*/
|
|
252
|
+
export interface SmilesConfig {
|
|
253
|
+
compactDrawing?: boolean;
|
|
254
|
+
elementColors?: boolean;
|
|
255
|
+
height?: number;
|
|
256
|
+
theme?: "light" | "dark" | "oldschool" | "auto";
|
|
257
|
+
width?: number;
|
|
258
|
+
}
|
|
259
|
+
export interface SmilesInstance {
|
|
260
|
+
render: (source: string, options?: SmilesConfig) => Promise<{
|
|
261
|
+
svg: string;
|
|
262
|
+
}>;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Plugin for chemical structure rendering (SMILES)
|
|
266
|
+
*/
|
|
267
|
+
export interface SmilesPlugin {
|
|
268
|
+
/**
|
|
269
|
+
* Get the SMILES instance (initialized with optional config)
|
|
270
|
+
*/
|
|
271
|
+
getSmiles: (config?: SmilesConfig) => SmilesInstance;
|
|
272
|
+
/**
|
|
273
|
+
* Language identifiers for code blocks (`smiles`, `smi`)
|
|
274
|
+
*/
|
|
275
|
+
language: string | readonly string[];
|
|
276
|
+
name: "smiles";
|
|
277
|
+
sourceExtension?: string;
|
|
278
|
+
type: "diagram";
|
|
279
|
+
}
|
|
192
280
|
/**
|
|
193
281
|
* Union type for all plugins
|
|
194
282
|
*/
|
|
195
|
-
export type StreamdownPlugin = CodeHighlighterPlugin | DiagramPlugin | PlantUmlPlugin | MathPlugin | CjkPlugin | OpenScadPlugin;
|
|
283
|
+
export type StreamdownPlugin = CodeHighlighterPlugin | DiagramPlugin | PlantUmlPlugin | VegaPlugin | SmilesPlugin | SvgDiagramPlugin | MathPlugin | CjkPlugin | OpenScadPlugin;
|
|
196
284
|
export interface CustomRendererProps {
|
|
197
285
|
code: string;
|
|
198
286
|
isIncomplete: boolean;
|
|
@@ -212,9 +300,16 @@ export interface CustomRenderer {
|
|
|
212
300
|
export interface PluginConfig {
|
|
213
301
|
cjk?: CjkPlugin;
|
|
214
302
|
code?: CodeHighlighterPlugin;
|
|
303
|
+
/**
|
|
304
|
+
* Extra SVG diagram engines, looked up by fence language after the named
|
|
305
|
+
* mermaid / plantuml / vega / smiles slots.
|
|
306
|
+
*/
|
|
307
|
+
diagrams?: SvgDiagramPlugin[];
|
|
215
308
|
math?: MathPlugin;
|
|
216
309
|
mermaid?: DiagramPlugin;
|
|
217
310
|
openscad?: OpenScadPlugin;
|
|
218
311
|
plantuml?: PlantUmlPlugin;
|
|
219
312
|
renderers?: CustomRenderer[];
|
|
313
|
+
smiles?: SmilesPlugin | SvgDiagramPlugin;
|
|
314
|
+
vega?: VegaPlugin | SvgDiagramPlugin;
|
|
220
315
|
}
|
|
@@ -43,4 +43,9 @@
|
|
|
43
43
|
* 6. **Tags inside code** (fenced blocks, inline code spans) are ignored in
|
|
44
44
|
* every pass — they are examples being shown, not markup being used.
|
|
45
45
|
*/
|
|
46
|
+
/**
|
|
47
|
+
* Rewrite `<tag ... />` to `<tag ...></tag>` so rehype-raw does not treat
|
|
48
|
+
* unknown custom tags as non-void containers that swallow following text.
|
|
49
|
+
*/
|
|
50
|
+
export declare const rewriteSelfClosingCustomTags: (markdown: string, tagNames: string[]) => string;
|
|
46
51
|
export declare const preprocessCustomTags: (markdown: string, tagNames: string[]) => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Same default as `@streamdown/smiles` `resolveCompactDrawing` when the
|
|
3
|
+
* option is omitted: reaction SMILES start compact, molecules start skeletal.
|
|
4
|
+
* Kept here so core UI does not import the plugin package.
|
|
5
|
+
*/
|
|
6
|
+
export declare function defaultSmilesCompactDrawing(source: string): boolean;
|
|
7
|
+
export declare function readConfiguredCompactDrawing(config: unknown): boolean | undefined;
|
|
8
|
+
export declare function withSmilesCompactDrawing(config: unknown, compactDrawing: boolean): unknown;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ComponentProps, type ComponentType, type CSSProperties } from "react";
|
|
2
2
|
import type { PluggableList } from "unified";
|
|
3
3
|
import type { Components } from "./markdown";
|
|
4
|
-
import type { MermaidConfig, OpenScadConfig, PlantUmlConfig, ThemeInput } from "./plugin-types";
|
|
4
|
+
import type { MermaidConfig, OpenScadConfig, PlantUmlConfig, SmilesConfig, ThemeInput, VegaConfig } from "./plugin-types";
|
|
5
5
|
import type { CSVSeparator } from "./table/utils";
|
|
6
6
|
export type DownloadControlConfig = boolean | {
|
|
7
7
|
filename: string;
|
|
@@ -11,6 +11,14 @@ export type CopyControlConfig<TOnCopy = () => void> = boolean | {
|
|
|
11
11
|
onCopy?: TOnCopy;
|
|
12
12
|
onError?: (error: Error) => void;
|
|
13
13
|
};
|
|
14
|
+
export type DiagramControls = boolean | {
|
|
15
|
+
download?: DownloadControlConfig;
|
|
16
|
+
copy?: CopyControlConfig;
|
|
17
|
+
/** SMILES only: skeletal structures vs compact CH₃ / COOH notation. */
|
|
18
|
+
compact?: boolean;
|
|
19
|
+
fullscreen?: boolean;
|
|
20
|
+
panZoom?: boolean;
|
|
21
|
+
};
|
|
14
22
|
export type ControlsConfig = boolean | {
|
|
15
23
|
table?: boolean | {
|
|
16
24
|
copy?: CopyControlConfig<(format: TableCopyFormat) => void>;
|
|
@@ -22,18 +30,15 @@ export type ControlsConfig = boolean | {
|
|
|
22
30
|
copy?: CopyControlConfig;
|
|
23
31
|
download?: DownloadControlConfig;
|
|
24
32
|
};
|
|
25
|
-
mermaid?:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
fullscreen?: boolean;
|
|
35
|
-
panZoom?: boolean;
|
|
36
|
-
};
|
|
33
|
+
mermaid?: DiagramControls;
|
|
34
|
+
plantuml?: DiagramControls;
|
|
35
|
+
smiles?: DiagramControls;
|
|
36
|
+
vega?: DiagramControls;
|
|
37
|
+
/**
|
|
38
|
+
* Per-engine controls for extra SVG diagrams registered via
|
|
39
|
+
* `plugins.diagrams`, keyed by plugin `name`.
|
|
40
|
+
*/
|
|
41
|
+
diagrams?: Record<string, DiagramControls>;
|
|
37
42
|
openscad?: boolean | {
|
|
38
43
|
download?: DownloadControlConfig;
|
|
39
44
|
copy?: CopyControlConfig;
|
|
@@ -55,24 +60,35 @@ export interface LinkSafetyConfig {
|
|
|
55
60
|
onLinkCheck?: (url: string) => Promise<boolean> | boolean;
|
|
56
61
|
renderModal?: (props: LinkSafetyModalProps) => React.ReactNode;
|
|
57
62
|
}
|
|
58
|
-
export interface
|
|
63
|
+
export interface DiagramErrorComponentProps {
|
|
59
64
|
chart: string;
|
|
60
65
|
error: string;
|
|
61
66
|
retry: () => void;
|
|
62
67
|
}
|
|
68
|
+
export interface DiagramOptions {
|
|
69
|
+
config?: unknown;
|
|
70
|
+
errorComponent?: React.ComponentType<DiagramErrorComponentProps>;
|
|
71
|
+
}
|
|
72
|
+
export type MermaidErrorComponentProps = DiagramErrorComponentProps;
|
|
63
73
|
export interface MermaidOptions {
|
|
64
74
|
config?: MermaidConfig;
|
|
65
75
|
errorComponent?: React.ComponentType<MermaidErrorComponentProps>;
|
|
66
76
|
}
|
|
67
|
-
export
|
|
68
|
-
chart: string;
|
|
69
|
-
error: string;
|
|
70
|
-
retry: () => void;
|
|
71
|
-
}
|
|
77
|
+
export type PlantUmlErrorComponentProps = DiagramErrorComponentProps;
|
|
72
78
|
export interface PlantUmlOptions {
|
|
73
79
|
config?: PlantUmlConfig;
|
|
74
80
|
errorComponent?: React.ComponentType<PlantUmlErrorComponentProps>;
|
|
75
81
|
}
|
|
82
|
+
export type VegaErrorComponentProps = DiagramErrorComponentProps;
|
|
83
|
+
export interface VegaOptions {
|
|
84
|
+
config?: VegaConfig;
|
|
85
|
+
errorComponent?: React.ComponentType<VegaErrorComponentProps>;
|
|
86
|
+
}
|
|
87
|
+
export type SmilesErrorComponentProps = DiagramErrorComponentProps;
|
|
88
|
+
export interface SmilesOptions {
|
|
89
|
+
config?: SmilesConfig;
|
|
90
|
+
errorComponent?: React.ComponentType<SmilesErrorComponentProps>;
|
|
91
|
+
}
|
|
76
92
|
export interface OpenScadErrorComponentProps {
|
|
77
93
|
code: string;
|
|
78
94
|
error: string;
|
|
@@ -128,6 +144,8 @@ export interface StreamdownContextType {
|
|
|
128
144
|
/** Merged components/plugins so custom renderers (e.g. callout body) can re-parse nested markdown identically to the outer pass. */
|
|
129
145
|
components?: Components;
|
|
130
146
|
controls: ControlsConfig;
|
|
147
|
+
/** Per-engine options for extra SVG diagrams, keyed by plugin `name`. */
|
|
148
|
+
diagrams?: Record<string, DiagramOptions>;
|
|
131
149
|
isAnimating: boolean;
|
|
132
150
|
/** Show line numbers in code blocks. @default true */
|
|
133
151
|
lineNumbers: boolean;
|
|
@@ -145,8 +163,10 @@ export interface StreamdownContextType {
|
|
|
145
163
|
/** Component used for horizontal-scroll regions (code body, table). @default plain div */
|
|
146
164
|
scrollable?: ScrollableComponent;
|
|
147
165
|
shikiTheme: [ThemeInput, ThemeInput];
|
|
166
|
+
smiles?: SmilesOptions;
|
|
148
167
|
/** Max height for tables (px number or CSS length). `0` / `Infinity` disables. @default 300 */
|
|
149
168
|
tableMaxHeight?: number | string;
|
|
169
|
+
vega?: VegaOptions;
|
|
150
170
|
}
|
|
151
171
|
export declare const defaultStreamdownContext: StreamdownContextType;
|
|
152
172
|
export declare const StreamdownContext: import("react").Context<StreamdownContextType>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Complete list of Tailwind CSS utility classes used by streamdown and its
|
|
3
3
|
* official plugins (@streamdown/code, @streamdown/math, @streamdown/mermaid,
|
|
4
|
-
* @streamdown/plantuml, @streamdown/cjk).
|
|
4
|
+
* @streamdown/plantuml, @streamdown/vega, @streamdown/smiles, @streamdown/cjk).
|
|
5
5
|
*
|
|
6
6
|
* Use this list to configure Tailwind v4's `@source inline()` directive when
|
|
7
7
|
* you need a custom prefix. See the README for details.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var s=["-mt-10","[&>p]:inline","[&>p:last-child]:mb-0","[&>svg]:inline-block","[&_svg]:h-auto","[&_svg]:w-auto","[counter-increment:line_0]","[counter-reset:line]","[li_&]:pl-6","absolute","animate-spin","appearance-none","backdrop-blur-sm","before:[counter-increment:line]","before:content-[counter(line)]","before:font-mono","before:inline-block","before:mr-4","before:select-none","before:text-[13px]","before:text-muted-foreground/50","before:text-right","before:w-6","bg-[var(--sdm-bg,inherit)]","bg-[var(--sdm-tbg)]","bg-background","bg-background/50","bg-background/80","bg-background/90","bg-background/95","bg-black/10","bg-muted","bg-muted/40","bg-muted/80","bg-primary","bg-red-100","bg-red-50","bg-sidebar","bg-sidebar/80","block","border","border-b","border-b-2","border-border","border-collapse","border-current","border-l-4","border-muted-foreground/30","border-red-200","border-sidebar","border-t","bottom-2","bottom-4","break-all","cursor-pointer","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit))]","dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]","disabled:cursor-not-allowed","disabled:opacity-50","divide-border","divide-y","duration-150","duration-200","ease-out","fixed","flex","flex-1","flex-col","font-medium","font-mono","font-semibold","gap-1","gap-2","gap-4","group","group-hover:block","group-hover:opacity-100","h-4","h-8","h-[400px]","h-[46px]","h-auto","h-full","hidden","hover:bg-background","hover:bg-muted","hover:bg-muted/40","hover:bg-primary/90","hover:text-foreground","inline-block","inset-0","italic","items-center","justify-between","justify-center","justify-end","left-2","left-4","line-clamp-2","list-decimal","list-disc","list-inside","lowercase","max-h-32","max-w-full","max-w-md","mb-2","min-h-28","min-h-[200px]","min-w-0","min-w-[120px]","ml-1","mt-1","mt-2","mt-6","mx-4","my-4","my-6","opacity-0","origin-center","overflow-hidden","overflow-x-auto","overflow-y-auto","overscroll-y-auto","p-1","p-1.5","p-2","p-3","p-4","p-6","pl-4","pointer-events-auto","pointer-events-none","px-1.5","px-3","px-4","py-0.5","py-1","py-2","relative","right-0","right-2","right-4","rounded","rounded-full","rounded-lg","rounded-md","rounded-r-md","rounded-xl","shadow-lg","shadow-sm","shrink-0","size-4","size-full","space-x-2","space-y-2","space-y-4","sticky","table-fixed","supports-[backdrop-filter]:backdrop-blur","supports-[backdrop-filter]:backdrop-blur-sm","supports-[backdrop-filter]:bg-background/70","supports-[backdrop-filter]:bg-sidebar/70","text-2xl","text-3xl","text-[var(--sdm-c,inherit)]","text-base","text-left","text-lg","text-muted-foreground","text-primary","text-primary-foreground","text-red-600","text-red-700","text-red-800","text-sm","text-xl","text-xs","top-2","top-4","top-full","transition-all","transition-colors","transition-transform","w-4","w-8","w-full","whitespace-normal","wrap-anywhere","z-10","z-50"];function a(r){let i=[...s],d=e=>r?`${r}:${e}`:e,t=[],n=[];for(let e of i)e.includes(",")?n.push(e):t.push(e);let o=[];if(t.length>0){let e=r?`${r}:{${t.join(",")}}`:`{${t.join(",")}}`;o.push(`@source inline("${e}");`);}for(let e of n)o.push(`@source inline("${d(e)}");`);return o.join(`
|
|
1
|
+
var s=["-mt-10","[&>p]:inline","[&>p:last-child]:mb-0","[&>svg]:inline-block","[&_svg]:h-auto","[&_svg]:w-auto","[counter-increment:line_0]","[counter-reset:line]","[li_&]:pl-6","absolute","animate-spin","appearance-none","backdrop-blur-sm","before:[counter-increment:line]","before:content-[counter(line)]","before:font-mono","before:inline-block","before:mr-4","before:select-none","before:text-[13px]","before:text-muted-foreground/50","before:text-right","before:w-6","bg-[var(--sdm-bg,inherit)]","bg-[var(--sdm-tbg)]","bg-background","bg-background/50","bg-background/80","bg-background/90","bg-background/95","bg-black/10","bg-muted","bg-muted/40","bg-muted/80","bg-primary","bg-red-100","bg-red-50","bg-sidebar","bg-sidebar/80","block","border","border-b","border-b-2","border-border","border-collapse","border-current","border-l-4","border-muted-foreground/30","border-red-200","border-sidebar","border-t","bottom-2","bottom-4","break-all","cursor-pointer","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit))]","dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]","disabled:cursor-not-allowed","disabled:opacity-50","divide-border","divide-y","duration-150","duration-200","ease-out","fixed","flex","flex-1","flex-col","font-medium","font-mono","font-semibold","gap-1","gap-2","gap-4","group","group-hover:block","group-hover:opacity-100","h-4","h-8","h-[400px]","h-[46px]","h-auto","h-full","hidden","hover:bg-background","hover:bg-muted","hover:bg-muted/40","hover:bg-primary/90","hover:text-foreground","inline-block","inset-0","italic","items-center","justify-between","justify-center","justify-end","left-2","left-4","line-clamp-2","list-decimal","list-disc","list-inside","lowercase","max-h-32","max-h-[min(70vh,40rem)]","max-w-full","max-w-md","mb-2","min-h-28","min-h-[200px]","min-w-0","min-w-[120px]","ml-1","mt-1","mt-2","mt-6","mx-4","my-4","my-6","opacity-0","origin-center","overflow-hidden","overflow-x-auto","overflow-y-auto","overscroll-y-auto","p-1","p-1.5","p-2","p-3","p-4","p-6","pl-4","pointer-events-auto","pointer-events-none","px-1.5","px-3","px-4","py-0.5","py-1","py-2","relative","right-0","right-2","right-4","rounded","rounded-full","rounded-lg","rounded-md","rounded-r-md","rounded-xl","shadow-lg","shadow-sm","shrink-0","size-4","size-full","space-x-2","space-y-2","space-y-4","sticky","table-fixed","supports-[backdrop-filter]:backdrop-blur","supports-[backdrop-filter]:backdrop-blur-sm","supports-[backdrop-filter]:bg-background/70","supports-[backdrop-filter]:bg-sidebar/70","text-2xl","text-3xl","text-[var(--sdm-c,inherit)]","text-base","text-left","text-lg","text-muted-foreground","text-primary","text-primary-foreground","text-red-600","text-red-700","text-red-800","text-sm","text-xl","text-xs","top-2","top-4","top-full","transition-all","transition-colors","transition-transform","w-4","w-8","w-full","whitespace-normal","wrap-anywhere","z-10","z-50"];function a(r){let i=[...s],d=e=>r?`${r}:${e}`:e,t=[],n=[];for(let e of i)e.includes(",")?n.push(e):t.push(e);let o=[];if(t.length>0){let e=r?`${r}:{${t.join(",")}}`:`{${t.join(",")}}`;o.push(`@source inline("${e}");`);}for(let e of n)o.push(`@source inline("${d(e)}");`);return o.join(`
|
|
2
2
|
`)}export{s as STREAMDOWN_CLASSES,a as getSourceInline};
|
|
@@ -14,11 +14,20 @@ export interface StreamdownTranslations {
|
|
|
14
14
|
copyTableAsCsv: string;
|
|
15
15
|
copyTableAsMarkdown: string;
|
|
16
16
|
copyTableAsTsv: string;
|
|
17
|
+
diagramChart: string;
|
|
18
|
+
diagramErrorLabel: string;
|
|
19
|
+
diagramFormatSource: string;
|
|
17
20
|
diagramLoading: string;
|
|
21
|
+
diagramPluginMissing: string;
|
|
22
|
+
diagramRenderFailed: string;
|
|
23
|
+
diagramWriting: string;
|
|
18
24
|
downloadDiagram: string;
|
|
25
|
+
downloadDiagramAsJson: string;
|
|
19
26
|
downloadDiagramAsMmd: string;
|
|
20
27
|
downloadDiagramAsPng: string;
|
|
21
28
|
downloadDiagramAsPuml: string;
|
|
29
|
+
downloadDiagramAsSmi: string;
|
|
30
|
+
downloadDiagramAsSource: string;
|
|
22
31
|
downloadDiagramAsSvg: string;
|
|
23
32
|
downloadFile: string;
|
|
24
33
|
downloadImage: string;
|
|
@@ -59,9 +68,23 @@ export interface StreamdownTranslations {
|
|
|
59
68
|
plantumlRenderFailed: string;
|
|
60
69
|
resetView: string;
|
|
61
70
|
showCode: string;
|
|
71
|
+
smilesChart: string;
|
|
72
|
+
smilesErrorLabel: string;
|
|
73
|
+
smilesFormatSmi: string;
|
|
74
|
+
smilesPluginMissing: string;
|
|
75
|
+
smilesRenderFailed: string;
|
|
76
|
+
smilesShowCompact: string;
|
|
77
|
+
smilesShowStructures: string;
|
|
62
78
|
tableFormatCsv: string;
|
|
63
79
|
tableFormatMarkdown: string;
|
|
64
80
|
tableFormatTsv: string;
|
|
81
|
+
vegaChart: string;
|
|
82
|
+
vegaErrorLabel: string;
|
|
83
|
+
vegaFormatJson: string;
|
|
84
|
+
vegaFormatPng: string;
|
|
85
|
+
vegaFormatSvg: string;
|
|
86
|
+
vegaPluginMissing: string;
|
|
87
|
+
vegaRenderFailed: string;
|
|
65
88
|
viewFullscreen: string;
|
|
66
89
|
zoomIn: string;
|
|
67
90
|
zoomOut: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {f,i}from'./chunk-
|
|
2
|
+
import {f,i}from'./chunk-GKDS2YGT.js';import {useRef,useEffect}from'react';import {jsx}from'react/jsx-runtime';var z=p=>{p.traverse(i=>{let o=i;if(o.geometry&&o.geometry.dispose(),Array.isArray(o.material))for(let u of o.material)u.dispose();else o.material&&o.material.dispose();});},q=({className:p,data:i$1,format:o,fullscreen:u=false})=>{let P=f(),R=i(),b=useRef(null);return useEffect(()=>{let m=b.current;if(!m)return;let y=false,g=()=>{};return (async()=>{let e=await import('three'),[{STLLoader:j},{ThreeMFLoader:E},{OrbitControls:V}]=await Promise.all([import('three/examples/jsm/loaders/STLLoader.js'),import('three/examples/jsm/loaders/3MFLoader.js'),import('three/examples/jsm/controls/OrbitControls.js')]);if(y)return;let n=new e.WebGLRenderer({alpha:true,antialias:true});n.setPixelRatio(window.devicePixelRatio),m.appendChild(n.domElement);let c=new e.Scene,t=new e.PerspectiveCamera(45,1,.1,2e3),x=new e.Vector3(50,40,60).normalize();t.position.copy(x.clone().multiplyScalar(100));let s=new V(t,n.domElement);s.enableDamping=true,s.dampingFactor=.08;let A=new e.HemisphereLight(16777215,3159357,1.5);c.add(A);let M=new e.DirectionalLight(16777215,2.6);M.position.set(1,1.7,1.2),c.add(M);let v=new e.DirectionalLight(16777215,.7);v.position.set(-1,.5,-1),c.add(v);let r=new e.Group;c.add(r);let C=()=>{for(;r.children.length>0;){let a=r.children[0];r.remove(a),z(a);}let l=i$1.buffer.slice(i$1.byteOffset,i$1.byteOffset+i$1.byteLength);if(o==="3mf"){let a=new E().parse(l);r.add(a);}else {let a=new j().parse(l);a.computeVertexNormals();let F=new e.MeshStandardMaterial({color:9081504,roughness:.55,metalness:.1});r.add(new e.Mesh(a,F));}let d=new e.Box3().setFromObject(r),h=d.getSize(new e.Vector3),w=Math.max(h.x,h.y,h.z)||1,L=d.getCenter(new e.Vector3),T=w*2.2,f=t.position.clone().sub(s.target).normalize();(!Number.isFinite(f.x)||f.lengthSq()===0)&&f.copy(x),s.target.copy(L),t.position.copy(L).add(f.multiplyScalar(T)),t.near=Math.max(w/1e3,.01),t.far=Math.max(w*100,1e3),t.updateProjectionMatrix(),s.update();},O=()=>{let{clientHeight:l,clientWidth:d}=m;d===0||l===0||(t.aspect=d/l,t.updateProjectionMatrix(),n.setSize(d,l));},D=new ResizeObserver(O);D.observe(m),O(),C(),n.setAnimationLoop(()=>{s.update(),n.render(c,t);}),g=()=>{D.disconnect(),n.setAnimationLoop(null),s.dispose(),z(r),c.clear(),n.dispose(),n.domElement.remove();};})().catch(()=>{}),()=>{y=true,g();}},[i$1,o]),jsx("div",{"aria-label":R.openscadModel,className:P(u?"size-full":"h-[400px] w-full",p),"data-streamdown":"openscad-viewer",ref:b,role:"img"})};export{q as OpenScadViewer};
|
package/package.json
CHANGED
package/dist/chunk-EMUDB4GM.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {createContext,useContext}from'react';var t=(...n)=>twMerge(clsx(n)),D=n=>{if(n!==void 0)return typeof n=="number"?!Number.isFinite(n)||n<=0?void 0:`${n}px`:n},g=(n,a)=>{if(!n||!a)return a;let r=`${n}:`;return a.split(/\s+/).filter(Boolean).map(o=>o.startsWith(r)?o:`${n}:${o}`).join(" ")},S=n=>n?(...a)=>g(n,twMerge(clsx(a))):t,y=(n,a,r)=>{let o=typeof a=="string"&&r.startsWith("text/csv")?"\uFEFF":"",s=typeof a=="string"?new Blob([o+a],{type:r}):a,i=URL.createObjectURL(s),e=document.createElement("a");e.href=i,e.download=n,document.body.appendChild(e),e.click(),document.body.removeChild(e),URL.revokeObjectURL(i);};var c=createContext(t),T=()=>useContext(c);var C={alertNote:"Note",alertTip:"Tip",alertImportant:"Important",alertWarning:"Warning",alertCaution:"Caution",copyCode:"Copy Code",copyDiagram:"Copy diagram",copyModel:"Copy model",downloadFile:"Download file",mermaidChart:"Mermaid chart",downloadDiagram:"Download diagram",downloadDiagramAsSvg:"Download diagram as SVG",downloadDiagramAsPng:"Download diagram as PNG",downloadDiagramAsMmd:"Download diagram as MMD",downloadDiagramAsPuml:"Download diagram as PlantUML",viewFullscreen:"View fullscreen",exitFullscreen:"Exit fullscreen",mermaidFormatSvg:"SVG",mermaidFormatPng:"PNG",mermaidFormatMmd:"MMD",diagramLoading:"Loading diagram...",showCode:"Show Code",mermaidErrorLabel:"Mermaid Error",mermaidPluginMissing:"Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.",mermaidRenderFailed:"Failed to render Mermaid chart",plantumlChart:"PlantUML chart",plantumlErrorLabel:"PlantUML Error",plantumlPluginMissing:"PlantUML plugin not available. Please add the plantuml plugin to enable diagram rendering.",plantumlRenderFailed:"Failed to render PlantUML chart",openscadErrorLabel:"OpenSCAD Error",openscadModel:"OpenSCAD model",openscadLoading:"Loading OpenSCAD engine and rendering model...",openscadPluginMissing:"OpenSCAD plugin not available. Please add the openscad plugin to enable model rendering.",openscadRenderFailed:"Failed to render model",openscadWriting:"Waiting for the model code...",downloadModel:"Download model",downloadModelAsScad:"Download model as SCAD",downloadModelAsStl:"Download model as STL",downloadModelAs3mf:"Download model as 3MF",openscadFormatScad:"SCAD",openscadFormatStl:"STL",openscadFormat3mf:"3MF",plantumlFormatSvg:"SVG",plantumlFormatPng:"PNG",plantumlFormatPuml:"PUML",zoomIn:"Zoom in",zoomOut:"Zoom out",resetView:"Reset zoom and pan",copyTable:"Copy table",copyTableAsMarkdown:"Copy table as Markdown",copyTableAsCsv:"Copy table as CSV",copyTableAsTsv:"Copy table as TSV",downloadTable:"Download table",downloadTableAsCsv:"Download table as CSV",downloadTableAsMarkdown:"Download table as Markdown",tableFormatMarkdown:"Markdown",tableFormatCsv:"CSV",tableFormatTsv:"TSV",imageNotAvailable:"Image not available",downloadImage:"Download image",openExternalLink:"Open external link?",externalLinkWarning:"You're about to visit an external website.",close:"Close",copyLink:"Copy link",copied:"Copied",openLink:"Open link"},b=createContext(C),x=()=>useContext(b);export{t as a,D as b,S as c,y as d,c as e,T as f,C as g,b as h,x as i};
|