@aiquants/markdown 13.0.0 → 13.2.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.
- package/README.md +303 -21
- package/dist/components/MarkdownRenderer.d.ts +6 -2
- package/dist/components/MermaidDiagram.d.ts +20 -0
- package/dist/components/blockNotice.d.ts +15 -0
- package/dist/components/fileSave.d.ts +1 -0
- package/dist/components/mermaidAccessibility.d.ts +11 -0
- package/dist/components/mermaidExport.d.ts +24 -0
- package/dist/components/mermaidLabels.d.ts +84 -0
- package/dist/components/spreadsheetClipboard.d.ts +1 -1
- package/dist/components/svgRaster.d.ts +2 -2
- package/dist/components/viewerLabels.d.ts +3 -2
- package/dist/extractHeadings-BfYlTVvN.js +6773 -0
- package/dist/extractHeadings-CZPJi4gM.cjs +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.client.cjs +1 -1
- package/dist/index.client.d.ts +4 -1
- package/dist/index.client.js +50 -48
- package/dist/index.js +50 -48
- package/dist/index.server.cjs +1 -1
- package/dist/index.server.d.ts +1 -1
- package/dist/index.server.js +95 -86
- package/dist/{markdownServiceClient-C47z3Ynu.cjs → markdownServiceClient-Dle7LnFB.cjs} +1 -1
- package/dist/{markdownServiceClient-uDeklhtG.js → markdownServiceClient-OrOuExUG.js} +7 -6
- package/dist/markdownServiceClient.d.ts +1 -0
- package/dist/mermaidFrame/NOTICES.md +1 -1
- package/dist/mermaidFrame/browserPaintView.d.ts +3 -0
- package/dist/mermaidFrame/cssCleaner.d.ts +16 -0
- package/dist/mermaidFrame/diagramPalette.d.ts +24 -0
- package/dist/mermaidFrame/diagramTheme.d.ts +7 -0
- package/dist/mermaidFrame/drawableTypes.d.ts +6 -0
- package/dist/mermaidFrame/drawer.d.ts +15 -2
- package/dist/mermaidFrame/frame.js +379 -378
- package/dist/mermaidFrame/insertion.d.ts +11 -0
- package/dist/mermaidFrame/namespaces.d.ts +3 -0
- package/dist/mermaidFrame/paintCheck.d.ts +2 -0
- package/dist/mermaidFrame/paintContract.d.ts +3 -0
- package/dist/mermaidFrame/paintDiagram.d.ts +3 -0
- package/dist/mermaidFrame/paintMap.d.ts +103 -0
- package/dist/mermaidFrame/paintRules.d.ts +18 -0
- package/dist/mermaidFrame/protocol.d.ts +5 -0
- package/dist/mermaidFrame/serve.d.ts +10 -5
- package/dist/remarkProcessor.server.d.ts +2 -0
- package/dist/serviceClient.cjs +1 -1
- package/dist/serviceClient.js +1 -1
- package/dist/styles/markdown.css +1 -1
- package/dist/styles/markdown.standalone.css +1 -1
- package/package.json +7 -5
- package/dist/extractHeadings-BAhmauKo.js +0 -5296
- package/dist/extractHeadings-qiJXegCx.cjs +0 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createClient as T, ConnectError as k, Code as s } from "@connectrpc/connect";
|
|
2
|
-
import {
|
|
2
|
+
import { a as f, b as g, e as v, i as M, d as y, c as b, B as S } from "./errors-CapTNE7l.js";
|
|
3
3
|
import { Message as u, proto3 as a, MethodKind as p } from "@bufbuild/protobuf";
|
|
4
4
|
class l extends u {
|
|
5
5
|
/**
|
|
@@ -386,8 +386,8 @@ const E = {
|
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
}, x = "X-Storage-Auth-Mode", B = "oauth2", _ = (n, e) => {
|
|
389
|
-
if (
|
|
390
|
-
throw new RangeError(`${e}: timeoutMs must be a positive integer of at most ${
|
|
389
|
+
if (v(n, e), n.timeoutMs !== void 0 && !M(n.timeoutMs))
|
|
390
|
+
throw new RangeError(`${e}: timeoutMs must be a positive integer of at most ${y}, got ${n.timeoutMs}`);
|
|
391
391
|
}, O = (n, e) => n.length > e ? !0 : n.length * 3 <= e ? !1 : new TextEncoder().encode(n).byteLength > e, C = /^[\w\-.~+/]+=*$/, J = (n, e) => {
|
|
392
392
|
const t = { [x]: B };
|
|
393
393
|
if (n.userOAuthToken) {
|
|
@@ -423,7 +423,7 @@ const E = {
|
|
|
423
423
|
} catch (r) {
|
|
424
424
|
throw r instanceof k ? t.signal?.aborted === !0 ? r.code === s.Canceled ? r : new k(r.rawMessage, s.Canceled, void 0, void 0, r) : r.code === s.ResourceExhausted ? new b(r.rawMessage, { cause: r }) : r : r;
|
|
425
425
|
}
|
|
426
|
-
const m = t.includeStreamingHints === !0 ? i.blockOffsets : void 0, w =
|
|
426
|
+
const m = t.includeStreamingHints === !0 ? i.blockOffsets : void 0, w = S * (m?.length ?? 0);
|
|
427
427
|
if (O(i.htmlContent, t.maxHtmlBytes - w))
|
|
428
428
|
throw new b(`the conversion's HTML${w > 0 ? " with its block offsets" : ""} is longer than maxHtmlBytes (${t.maxHtmlBytes})`);
|
|
429
429
|
const h = {
|
|
@@ -449,7 +449,7 @@ const E = {
|
|
|
449
449
|
if (H(n)) return new f("unavailable", n.rawMessage, { cause: n });
|
|
450
450
|
switch (n.code) {
|
|
451
451
|
case s.DeadlineExceeded:
|
|
452
|
-
return new
|
|
452
|
+
return new g(t ?? null, { cause: n });
|
|
453
453
|
case s.InvalidArgument:
|
|
454
454
|
return new f("invalid_argument", n.rawMessage, { cause: n });
|
|
455
455
|
case s.Internal:
|
|
@@ -474,7 +474,8 @@ const E = {
|
|
|
474
474
|
export {
|
|
475
475
|
E as M,
|
|
476
476
|
_ as a,
|
|
477
|
+
A as b,
|
|
477
478
|
U as c,
|
|
478
479
|
H as l,
|
|
479
|
-
|
|
480
|
+
L as s
|
|
480
481
|
};
|
|
@@ -15,6 +15,7 @@ export type MarkdownServiceClient = {
|
|
|
15
15
|
export declare const assertServiceOptions: (options: MarkdownServiceCallOptions, caller: string) => void;
|
|
16
16
|
export declare const sendConversion: (client: MarkdownServiceConnectClient, input: MarkdownServiceConversion, options: MarkdownServiceCallOptions) => Promise<ParseResult>;
|
|
17
17
|
export declare const lostTheService: (error: ConnectError) => boolean;
|
|
18
|
+
export declare const serviceFailureOf: (error: unknown, { signal, timeoutMs }: MarkdownServiceCallOptions) => unknown;
|
|
18
19
|
export declare const createMarkdownServiceClient: ({ transport }: {
|
|
19
20
|
readonly transport: Transport;
|
|
20
21
|
}) => MarkdownServiceClient;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`frame.js` next to this file (`@aiquants/markdown/mermaid-frame`) bundles the drawing place's script of this package with Mermaid. It contains code of the following npm packages.
|
|
4
4
|
|
|
5
|
-
## @aiquants/markdown 13.
|
|
5
|
+
## @aiquants/markdown 13.2.0
|
|
6
6
|
|
|
7
7
|
```text
|
|
8
8
|
MIT License
|
|
@@ -7,7 +7,23 @@ export interface CssToken {
|
|
|
7
7
|
}
|
|
8
8
|
export declare function tokenizeCss(text: string): readonly CssToken[];
|
|
9
9
|
export type DeclarationTarget = "root" | "inside";
|
|
10
|
+
export declare const URL_REFERENCE_NAMES: ReadonlySet<string>;
|
|
10
11
|
export declare const FRAGMENT_REFERENCE: RegExp;
|
|
11
12
|
export declare function cleanStyleSheet(sheet: string, svgId: string, classPrefix: string): string | null;
|
|
12
13
|
export declare function cleanDeclarations(declarations: string, target: DeclarationTarget): string | null;
|
|
13
14
|
export declare function isCleanAttributeValue(name: string, value: string): boolean;
|
|
15
|
+
export interface CssDeclaration {
|
|
16
|
+
readonly property: string;
|
|
17
|
+
readonly value: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function readDeclarations(declarations: string): readonly CssDeclaration[];
|
|
20
|
+
export declare function readStyleSheetDeclarations(sheet: string): readonly CssDeclaration[];
|
|
21
|
+
export declare function withoutDeclarations(declarations: string, properties: ReadonlySet<string>): string | null;
|
|
22
|
+
export interface IdRenaming {
|
|
23
|
+
readonly prefix: string;
|
|
24
|
+
readonly ids: ReadonlySet<string>;
|
|
25
|
+
}
|
|
26
|
+
export declare const namesHeldId: (reference: string, renaming: IdRenaming) => boolean;
|
|
27
|
+
export declare function renameStyleSheetIds(sheet: string, renaming: IdRenaming): string | null;
|
|
28
|
+
export declare function renameDeclarationIds(declarations: string, renaming: IdRenaming): string | null;
|
|
29
|
+
export declare function renameAttributeValueIds(value: string, renaming: IdRenaming): string | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type DiagramScheme = "light" | "dark";
|
|
2
|
+
export type DiagramSurfaceRole = "primary" | "secondary" | "tertiary" | "note";
|
|
3
|
+
export type DiagramPalette = {
|
|
4
|
+
readonly ground: string;
|
|
5
|
+
readonly text: string;
|
|
6
|
+
readonly surface: Readonly<Record<DiagramSurfaceRole, string>>;
|
|
7
|
+
readonly line: string;
|
|
8
|
+
readonly series: readonly [
|
|
9
|
+
string,
|
|
10
|
+
string,
|
|
11
|
+
string,
|
|
12
|
+
string,
|
|
13
|
+
string,
|
|
14
|
+
string,
|
|
15
|
+
string,
|
|
16
|
+
string,
|
|
17
|
+
string,
|
|
18
|
+
string,
|
|
19
|
+
string,
|
|
20
|
+
string
|
|
21
|
+
];
|
|
22
|
+
readonly seriesText: string;
|
|
23
|
+
};
|
|
24
|
+
export declare const DIAGRAM_PALETTES: Readonly<Record<DiagramScheme, DiagramPalette>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MermaidConfig } from "mermaid";
|
|
2
|
+
import { DiagramPalette, DiagramScheme } from "./diagramPalette.ts";
|
|
3
|
+
export type DiagramThemeVariables = Readonly<Record<string, string | boolean | Readonly<Record<string, string>>>>;
|
|
4
|
+
export type DiagramAppearance = Required<Pick<MermaidConfig, "theme" | "themeVariables" | "c4" | "journey" | "sankey" | "xyChart">>;
|
|
5
|
+
export declare const diagramThemeVariables: (palette: DiagramPalette, darkMode: boolean) => DiagramThemeVariables;
|
|
6
|
+
export declare const diagramC4Colours: (palette: DiagramPalette) => NonNullable<MermaidConfig["c4"]>;
|
|
7
|
+
export declare const diagramAppearance: (scheme: DiagramScheme) => DiagramAppearance;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MermaidFrameFailure } from "./protocol.ts";
|
|
1
|
+
import { MermaidDrawForm, MermaidFrameFailure } from "./protocol.ts";
|
|
2
2
|
export interface MermaidDrawerSetup {
|
|
3
3
|
readonly frameScriptUrl: string | URL;
|
|
4
4
|
readonly fontStylesheetUrls: readonly (string | URL)[];
|
|
@@ -6,6 +6,7 @@ export interface MermaidDrawerSetup {
|
|
|
6
6
|
export interface MermaidDrawRequest {
|
|
7
7
|
readonly source: string;
|
|
8
8
|
readonly theme: "light" | "dark";
|
|
9
|
+
readonly form: MermaidDrawForm;
|
|
9
10
|
readonly width: number;
|
|
10
11
|
readonly fontFamily: string;
|
|
11
12
|
readonly lang: string;
|
|
@@ -17,10 +18,17 @@ export interface DrawnMermaidDiagram {
|
|
|
17
18
|
readonly length: number;
|
|
18
19
|
readonly [DRAWN_MERMAID_DIAGRAM]: true;
|
|
19
20
|
}
|
|
21
|
+
export type MermaidNotExportableReason = "html-label" | "unsized" | "unlike-text";
|
|
22
|
+
export declare const MERMAID_NOT_EXPORTABLE_REASONS: readonly MermaidNotExportableReason[];
|
|
23
|
+
export type MermaidDrawFailure = MermaidFrameFailure | {
|
|
24
|
+
readonly kind: "not-exportable";
|
|
25
|
+
readonly reason: MermaidNotExportableReason;
|
|
26
|
+
readonly message: string;
|
|
27
|
+
};
|
|
20
28
|
export type MermaidDrawResult = {
|
|
21
29
|
readonly diagram: DrawnMermaidDiagram;
|
|
22
30
|
} | {
|
|
23
|
-
readonly failure:
|
|
31
|
+
readonly failure: MermaidDrawFailure;
|
|
24
32
|
};
|
|
25
33
|
export type MermaidDrawer = (request: MermaidDrawRequest) => Promise<MermaidDrawResult>;
|
|
26
34
|
export declare const FRAME_NOT_LISTENING_MESSAGE = "the drawing place's script did not load, or threw before it listened";
|
|
@@ -28,7 +36,12 @@ export declare const FRAME_RELOADED_MESSAGE = "the drawing place's frame loaded
|
|
|
28
36
|
export declare const FRAME_REMOVED_MESSAGE = "the drawing place's frame left the page, and the diagrams it held were lost";
|
|
29
37
|
export declare const NO_BODY_MESSAGE = "the page has no body to hold the drawing place's frame";
|
|
30
38
|
export declare const UNCLEAN_ANSWER_MESSAGE = "the drawing place answered with something other than one svg of the requested id";
|
|
39
|
+
export declare const OFF_PALETTE_ANSWER_MESSAGE = "the drawing place answered with a paint off the diagram palette";
|
|
31
40
|
export declare const MALFORMED_ANSWER_MESSAGE = "the drawing place answered in a shape the page does not read";
|
|
41
|
+
export declare const HTML_LABEL_EXPORT_MESSAGE = "the drawing holds a foreignObject, a label drawn as HTML, which not every reader of an image file draws";
|
|
42
|
+
export declare const UNSIZED_EXPORT_MESSAGE = "the drawing has no viewBox of a positive width and height to take its size from";
|
|
43
|
+
export declare const UNLIKE_TEXT_EXPORT_MESSAGE = "the drawing's text, white space aside, differs from that of the shown drawing, as when a label holds HTML or an icon the export form writes out as characters";
|
|
44
|
+
export declare const drawingCharactersOf: (root: Element) => string;
|
|
32
45
|
export declare const cleanedSvgOf: (value: unknown) => SVGSVGElement | undefined;
|
|
33
46
|
export declare function createMermaidDrawer(setup: MermaidDrawerSetup): MermaidDrawer;
|
|
34
47
|
export {};
|