markstream-angular 0.0.1-alpha.6 → 0.0.1-alpha.7
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/README.md +14 -0
- package/dist/index.css +1 -1
- package/dist/index.js +274 -259
- package/dist/types/components/CodeBlockNode/CodeBlockNode.component.d.ts +1 -0
- package/dist/types/components/NodeRenderer/NodeRenderer.component.d.ts +3 -2
- package/dist/types/components/TextNode/TextNode.component.d.ts +1 -0
- package/dist/types/components/shared/node-helpers.d.ts +11 -9
- package/dist/types/index.d.ts +2 -0
- package/dist/types/types/monaco.d.ts +64 -0
- package/package.json +2 -2
|
@@ -45,6 +45,7 @@ export declare class CodeBlockNodeComponent implements AfterViewInit, OnChanges,
|
|
|
45
45
|
get rawLanguage(): string;
|
|
46
46
|
get canonicalLanguage(): string;
|
|
47
47
|
get monacoLanguage(): string;
|
|
48
|
+
get isPlainTextLanguage(): boolean;
|
|
48
49
|
get displayLanguage(): string;
|
|
49
50
|
get languageIconDataUrl(): string;
|
|
50
51
|
get resolvedCode(): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AfterViewInit, OnChanges, OnDestroy, OnInit, EventEmitter } from '@angular/core';
|
|
1
|
+
import { AfterViewInit, OnChanges, OnDestroy, OnInit, SimpleChanges, EventEmitter } from '@angular/core';
|
|
2
2
|
import { AngularRenderableNode, AngularRenderContext, NodeRendererProps } from '../shared/node-helpers';
|
|
3
3
|
interface VisibleNodeEntry {
|
|
4
4
|
node: AngularRenderableNode;
|
|
@@ -64,6 +64,7 @@ export declare class NodeRendererComponent implements NodeRendererProps, OnChang
|
|
|
64
64
|
private readonly nodeVisibility;
|
|
65
65
|
private readonly nodeSeen;
|
|
66
66
|
private readonly textStreamState;
|
|
67
|
+
private streamRenderVersion;
|
|
67
68
|
private readonly slotElements;
|
|
68
69
|
private readonly observedElements;
|
|
69
70
|
private observer;
|
|
@@ -89,7 +90,7 @@ export declare class NodeRendererComponent implements NodeRendererProps, OnChang
|
|
|
89
90
|
get incrementalRenderingActive(): boolean;
|
|
90
91
|
get deferNodesActive(): boolean;
|
|
91
92
|
get shouldObserveSlots(): boolean;
|
|
92
|
-
ngOnChanges(): void;
|
|
93
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
93
94
|
ngOnInit(): void;
|
|
94
95
|
ngAfterViewInit(): void;
|
|
95
96
|
ngOnDestroy(): void;
|
|
@@ -8,6 +8,7 @@ export declare class TextNodeComponent implements OnChanges {
|
|
|
8
8
|
settledText: string;
|
|
9
9
|
streamedDelta: string;
|
|
10
10
|
private streamFadeVersion;
|
|
11
|
+
private lastStreamRenderVersion?;
|
|
11
12
|
ngOnChanges(): void;
|
|
12
13
|
get centered(): boolean;
|
|
13
14
|
get streamedDeltaClass(): "markstream-angular-text__stream-delta--a" | "markstream-angular-text__stream-delta--b";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Type } from '@angular/core';
|
|
2
2
|
import { BaseNode, MarkdownIt, ParsedNode, ParseOptions } from 'stream-markdown-parser';
|
|
3
|
+
import { CodeBlockMonacoOptions, CodeBlockMonacoTheme } from '../../types/monaco';
|
|
3
4
|
export type AngularRenderableNode = (ParsedNode | BaseNode) & Record<string, unknown>;
|
|
4
5
|
export interface NodeRendererEvents {
|
|
5
6
|
onCopy?: (code: string) => void;
|
|
@@ -15,9 +16,9 @@ export interface NodeRendererProps {
|
|
|
15
16
|
customHtmlTags?: readonly string[];
|
|
16
17
|
viewportPriority?: boolean;
|
|
17
18
|
codeBlockStream?: boolean;
|
|
18
|
-
codeBlockDarkTheme?:
|
|
19
|
-
codeBlockLightTheme?:
|
|
20
|
-
codeBlockMonacoOptions?:
|
|
19
|
+
codeBlockDarkTheme?: CodeBlockMonacoTheme;
|
|
20
|
+
codeBlockLightTheme?: CodeBlockMonacoTheme;
|
|
21
|
+
codeBlockMonacoOptions?: CodeBlockMonacoOptions;
|
|
21
22
|
renderCodeBlocksAsPre?: boolean;
|
|
22
23
|
codeBlockMinWidth?: string | number;
|
|
23
24
|
codeBlockMaxWidth?: string | number;
|
|
@@ -27,7 +28,7 @@ export interface NodeRendererProps {
|
|
|
27
28
|
infographicProps?: Record<string, any>;
|
|
28
29
|
customComponents?: Record<string, Type<any>>;
|
|
29
30
|
showTooltips?: boolean;
|
|
30
|
-
themes?:
|
|
31
|
+
themes?: CodeBlockMonacoTheme[];
|
|
31
32
|
isDark?: boolean;
|
|
32
33
|
customId?: string;
|
|
33
34
|
indexKey?: number | string;
|
|
@@ -50,6 +51,7 @@ export interface AngularRenderContext {
|
|
|
50
51
|
final?: boolean;
|
|
51
52
|
typewriter?: boolean;
|
|
52
53
|
textStreamState?: Map<string, string>;
|
|
54
|
+
streamRenderVersion?: number;
|
|
53
55
|
showTooltips?: boolean;
|
|
54
56
|
codeBlockStream?: boolean;
|
|
55
57
|
renderCodeBlocksAsPre?: boolean;
|
|
@@ -63,17 +65,17 @@ export interface AngularRenderContext {
|
|
|
63
65
|
infographicProps?: Record<string, any>;
|
|
64
66
|
customComponents?: Record<string, Type<any>>;
|
|
65
67
|
codeBlockThemes?: {
|
|
66
|
-
themes?:
|
|
67
|
-
darkTheme?:
|
|
68
|
-
lightTheme?:
|
|
69
|
-
monacoOptions?:
|
|
68
|
+
themes?: CodeBlockMonacoTheme[];
|
|
69
|
+
darkTheme?: CodeBlockMonacoTheme;
|
|
70
|
+
lightTheme?: CodeBlockMonacoTheme;
|
|
71
|
+
monacoOptions?: CodeBlockMonacoOptions;
|
|
70
72
|
minWidth?: string | number;
|
|
71
73
|
maxWidth?: string | number;
|
|
72
74
|
};
|
|
73
75
|
events: NodeRendererEvents;
|
|
74
76
|
}
|
|
75
77
|
export declare const BLOCK_LEVEL_TYPES: Set<string>;
|
|
76
|
-
export declare function buildRenderContext(props: NodeRendererProps, events?: NodeRendererEvents, textStreamState?: Map<string, string
|
|
78
|
+
export declare function buildRenderContext(props: NodeRendererProps, events?: NodeRendererEvents, textStreamState?: Map<string, string>, streamRenderVersion?: number): AngularRenderContext;
|
|
77
79
|
export declare function resolveParsedNodes(props: NodeRendererProps): AngularRenderableNode[];
|
|
78
80
|
export declare function getNodeList(value: unknown): AngularRenderableNode[];
|
|
79
81
|
export declare function getString(value: unknown): string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export { setDefaultI18nMap, useSafeI18n } from './i18n/useSafeI18n';
|
|
|
52
52
|
export { MarkstreamAngularComponent } from './markstream-angular.component';
|
|
53
53
|
export { MarkstreamAngularComponent as MarkdownRenderComponent } from './markstream-angular.component';
|
|
54
54
|
export { MarkstreamAngularComponent as default } from './markstream-angular.component';
|
|
55
|
+
export type { MarkstreamAngularComponentProps } from './markstream-angular.component';
|
|
55
56
|
export type { D2Loader } from './optional/d2';
|
|
56
57
|
export { disableD2, enableD2, isD2Enabled, setD2Loader, } from './optional/d2';
|
|
57
58
|
export type { KatexLoader } from './optional/katex';
|
|
@@ -63,6 +64,7 @@ export type { NestedMarkdownNodesInput, NestedMarkdownNodesOptions, } from './pa
|
|
|
63
64
|
export { renderMarkdownNodesToHtml, renderMarkdownNodeToHtml, renderMarkdownToHtml, renderNestedMarkdownToHtml, } from './renderMarkdownHtml';
|
|
64
65
|
export type { MarkstreamAngularRenderOptions, NestedMarkdownHtmlInput, NestedMarkdownHtmlOptions, RenderableMarkdownNode, } from './renderMarkdownHtml';
|
|
65
66
|
export { sanitizeHtmlContent } from './sanitizeHtmlContent';
|
|
67
|
+
export type { CodeBlockDiffAppearance, CodeBlockDiffHideUnchangedRegions, CodeBlockDiffHideUnchangedRegionsOptions, CodeBlockDiffHunkActionContext, CodeBlockDiffHunkActionKind, CodeBlockDiffHunkSide, CodeBlockDiffLineStyle, CodeBlockDiffUnchangedRegionStyle, CodeBlockMonacoLanguage, CodeBlockMonacoOptions, CodeBlockMonacoTheme, CodeBlockMonacoThemeObject, } from './types/monaco';
|
|
66
68
|
export { getLanguageIcon, languageMap, normalizeLanguageIdentifier, resolveMonacoLanguageId, setLanguageIconResolver, } from './utils/languageIcon';
|
|
67
69
|
export type { LanguageIconResolver } from './utils/languageIcon';
|
|
68
70
|
export * from './workers/katexCdnWorker';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export interface CodeBlockMonacoThemeObject {
|
|
2
|
+
name: string;
|
|
3
|
+
base?: string;
|
|
4
|
+
inherit?: boolean;
|
|
5
|
+
colors?: Record<string, string>;
|
|
6
|
+
rules?: Array<Record<string, unknown>>;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export type CodeBlockMonacoTheme = string | CodeBlockMonacoThemeObject;
|
|
10
|
+
export type CodeBlockMonacoLanguage = string | ((...args: any[]) => unknown);
|
|
11
|
+
export interface CodeBlockDiffHideUnchangedRegionsOptions {
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
contextLineCount?: number;
|
|
14
|
+
minimumLineCount?: number;
|
|
15
|
+
revealLineCount?: number;
|
|
16
|
+
}
|
|
17
|
+
export type CodeBlockDiffHideUnchangedRegions = boolean | CodeBlockDiffHideUnchangedRegionsOptions;
|
|
18
|
+
export type CodeBlockDiffLineStyle = 'background' | 'bar';
|
|
19
|
+
export type CodeBlockDiffAppearance = 'auto' | 'light' | 'dark';
|
|
20
|
+
export type CodeBlockDiffUnchangedRegionStyle = 'line-info' | 'line-info-basic' | 'metadata' | 'simple';
|
|
21
|
+
export type CodeBlockDiffHunkActionKind = 'revert' | 'stage';
|
|
22
|
+
export type CodeBlockDiffHunkSide = 'upper' | 'lower';
|
|
23
|
+
export interface CodeBlockDiffHunkActionContext {
|
|
24
|
+
action: CodeBlockDiffHunkActionKind;
|
|
25
|
+
side: CodeBlockDiffHunkSide;
|
|
26
|
+
lineChange: unknown;
|
|
27
|
+
originalModel: unknown;
|
|
28
|
+
modifiedModel: unknown;
|
|
29
|
+
}
|
|
30
|
+
export interface CodeBlockMonacoOptions {
|
|
31
|
+
MAX_HEIGHT?: number | string;
|
|
32
|
+
fontSize?: number;
|
|
33
|
+
lineHeight?: number;
|
|
34
|
+
fontFamily?: string;
|
|
35
|
+
tabSize?: number;
|
|
36
|
+
readOnly?: boolean;
|
|
37
|
+
wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded' | string;
|
|
38
|
+
wrappingIndent?: 'none' | 'same' | 'indent' | 'deepIndent' | string;
|
|
39
|
+
theme?: string;
|
|
40
|
+
themes?: CodeBlockMonacoTheme[];
|
|
41
|
+
languages?: CodeBlockMonacoLanguage[];
|
|
42
|
+
renderSideBySide?: boolean;
|
|
43
|
+
enableSplitViewResizing?: boolean;
|
|
44
|
+
ignoreTrimWhitespace?: boolean;
|
|
45
|
+
maxComputationTime?: number;
|
|
46
|
+
diffAlgorithm?: string;
|
|
47
|
+
renderIndicators?: boolean;
|
|
48
|
+
originalEditable?: boolean;
|
|
49
|
+
revealDebounceMs?: number;
|
|
50
|
+
revealStrategy?: 'bottom' | 'centerIfOutside' | 'center';
|
|
51
|
+
revealBatchOnIdleMs?: number;
|
|
52
|
+
updateThrottleMs?: number;
|
|
53
|
+
diffUpdateThrottleMs?: number;
|
|
54
|
+
diffAutoScroll?: boolean;
|
|
55
|
+
diffHideUnchangedRegions?: CodeBlockDiffHideUnchangedRegions;
|
|
56
|
+
diffLineStyle?: CodeBlockDiffLineStyle;
|
|
57
|
+
diffAppearance?: CodeBlockDiffAppearance;
|
|
58
|
+
diffUnchangedRegionStyle?: CodeBlockDiffUnchangedRegionStyle;
|
|
59
|
+
diffHunkActionsOnHover?: boolean;
|
|
60
|
+
diffHunkHoverHideDelayMs?: number;
|
|
61
|
+
onDiffHunkAction?: (context: CodeBlockDiffHunkActionContext) => void | boolean | Promise<void | boolean>;
|
|
62
|
+
scrollbar?: Record<string, any>;
|
|
63
|
+
[key: string]: any;
|
|
64
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markstream-angular",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.1-alpha.
|
|
4
|
+
"version": "0.0.1-alpha.7",
|
|
5
5
|
"description": "Experimental Angular Markdown renderer for Markstream, built on stream-markdown AST and a stable HTML baseline renderer.",
|
|
6
6
|
"author": "Simon He",
|
|
7
7
|
"license": "MIT",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@floating-ui/dom": "^1.7.6",
|
|
71
|
-
"stream-markdown-parser": "0.0.
|
|
71
|
+
"stream-markdown-parser": "0.0.76"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@types/node": "^18.19.130",
|