yuhwa 1.2.0 → 1.3.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/dist/astro.d.ts +1 -1
- package/dist/browser.d.ts +3 -2
- package/dist/browser.js +3 -2
- package/dist/cli.js +1 -1
- package/dist/editor/assets/index-DAk6b1UB.js +689 -0
- package/dist/editor/assets/{lsp.worker-sZtzIA6-.js → lsp.worker-CMSpDTsX.js} +17 -17
- package/dist/editor/index.html +1 -1
- package/dist/{figure-CA2hy0xh.d.ts → figure-QAwSU1Ry.d.ts} +1 -1
- package/dist/index-6ZPJGThY.d.ts +216 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -1
- package/dist/ironmark.d.ts +1 -1
- package/dist/ironmark.js +1 -1
- package/dist/lsp-browser.js +1 -1
- package/dist/lsp-node.js +2 -2
- package/dist/lsp-server.js +1 -1
- package/dist/lsp.js +1 -1
- package/dist/markdown-it.d.ts +1 -1
- package/dist/markdown-it.js +1 -1
- package/dist/{node-Bzn2uKXZ.js → node-CLu2Pp_2.js} +2 -1
- package/dist/plugin-Bs4eiAuz.js +4166 -0
- package/dist/{index-CnnoZYl0.d.ts → plugin-NSkNyoUj.d.ts} +79 -208
- package/dist/plugin.d.ts +12 -0
- package/dist/plugin.js +1 -0
- package/dist/remark.d.ts +1 -1
- package/dist/remark.js +1 -1
- package/dist/{server-Dxo7OG8K.js → server-D6BSNC1P.js} +1 -1
- package/dist/{service-B1fpOg_L.js → service-D7DNWBAU.js} +3 -2
- package/dist/{shared-Ddw88O9D.js → shared-6aCU_HaV.js} +489 -401
- package/dist/{src-DkQj7aIV.js → src-BjOhvTAB.js} +440 -4512
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +3 -2
- package/dist/vuepress.d.ts +1 -1
- package/dist/yuhwa.iife.js +53 -53
- package/package.json +6 -1
- package/dist/editor/assets/index-BphHLTvA.js +0 -689
|
@@ -62,6 +62,8 @@ interface Theme {
|
|
|
62
62
|
groupTone(t: string): ToneColors | undefined;
|
|
63
63
|
edgeTone(t: string): string | undefined;
|
|
64
64
|
}
|
|
65
|
+
declare const SANS = "Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif";
|
|
66
|
+
declare const MONO = "'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
|
|
65
67
|
declare const THEMES: Record<string, Theme>;
|
|
66
68
|
declare const THEME_NAMES: string[];
|
|
67
69
|
/** a theme as plugins hand it in: `edge.ink` defaults to `edge.text` */
|
|
@@ -72,6 +74,14 @@ type ThemeInput = Omit<Theme, "edge"> & {
|
|
|
72
74
|
};
|
|
73
75
|
/** Add a theme (or replace one with the same name). Plugins call this through `use`. */
|
|
74
76
|
declare function registerTheme(input: ThemeInput): void;
|
|
77
|
+
/**
|
|
78
|
+
* Any CSS colour this library can mix, as `#rrggbb`: `#rgb`, `#rgba`,
|
|
79
|
+
* `#rrggbb(aa)`, `rgb()`/`rgba()`, `hsl()`/`hsla()` (comma or space syntax)
|
|
80
|
+
* and the CSS colour names. Palette names are not CSS colours: see `isColor`.
|
|
81
|
+
*/
|
|
82
|
+
declare function cssHex(v: string): string | undefined;
|
|
83
|
+
/** a `true` / `false` prop value: `false`, `no`, `off`, `0` and `none` are false */
|
|
84
|
+
declare const bool: (v: string | undefined, d: boolean) => boolean;
|
|
75
85
|
type LineStyle$1 = "solid" | "dashed" | "dotted";
|
|
76
86
|
/**
|
|
77
87
|
* A key of a `theme name { … }` block: what it sets, the kind of value it
|
|
@@ -105,8 +115,14 @@ declare const themeNames: (custom?: Record<string, unknown>) => string[];
|
|
|
105
115
|
* (`Diagram.themes`), which win over registered themes of the same name.
|
|
106
116
|
*/
|
|
107
117
|
declare function getTheme(name: string | undefined, custom?: Record<string, Record<string, string>>): Theme;
|
|
118
|
+
/** true for a palette name (`blue`, `blue-600`) or any CSS colour `cssHex` reads */
|
|
119
|
+
declare const isColor: (v: string) => boolean;
|
|
108
120
|
/** @deprecated use `isColor` */
|
|
109
121
|
declare const isToneOrHex: (v: string) => boolean;
|
|
122
|
+
/** regex source for one colour token inside `[...]`: `#hex`, `rgb(…)`, `hsl(…)` or a word */
|
|
123
|
+
declare const COLOR_TOKEN: string;
|
|
124
|
+
/** Resolve a colour value: tone names (`blue`, `blue-500`) or any CSS colour. */
|
|
125
|
+
declare function resolveColor(v: string | undefined, theme: Theme, fallbackLevel: Level): string | undefined;
|
|
110
126
|
/**
|
|
111
127
|
* True when a value can sit inside an SVG attribute or a style rule as is:
|
|
112
128
|
* any CSS colour or font list passes, quotes, angle brackets, `;`, braces,
|
|
@@ -138,10 +154,22 @@ interface InkColors {
|
|
|
138
154
|
sub: string;
|
|
139
155
|
stroke: string;
|
|
140
156
|
}
|
|
157
|
+
/** the theme's node ink, with an optional text and line colour */
|
|
158
|
+
declare const nodeInk: (theme: Theme, text?: string, stroke?: string) => InkColors;
|
|
141
159
|
/** Split one line of text into styled segments. */
|
|
142
160
|
declare function parseInline(s: string): Seg[];
|
|
161
|
+
/** the text without markup */
|
|
162
|
+
declare const plain: (segs: Seg[]) => string;
|
|
163
|
+
declare const esc: (s: string) => string;
|
|
164
|
+
declare const f: (n: number) => string;
|
|
165
|
+
/** a single-line `<text>` centred vertically on `y` */
|
|
166
|
+
declare const textEl: (x: number, y: number, fs: number, fill: string, body: string, extra?: string) => string;
|
|
167
|
+
/** resolve a tone or CSS colour for marks drawn on top of an element */
|
|
168
|
+
declare const inkColor: (c: string | undefined, theme: Theme, fallback: string) => string;
|
|
143
169
|
/** Measure segments (stores each width on the segment) and return the total. */
|
|
144
170
|
declare function segsW(segs: Seg[], fs: number, mono: boolean, m: Measure, weight?: number): number;
|
|
171
|
+
/** total of the widths stored by segsW */
|
|
172
|
+
declare const sumW: (segs: Seg[]) => number;
|
|
145
173
|
/** Draw measured segments left to right from x, centred on cy. */
|
|
146
174
|
declare function renderSegs(segs: Seg[], x: number, cy: number, fs: number, col: InkColors, theme: Theme, muted?: boolean, weight?: number): string;
|
|
147
175
|
/**
|
|
@@ -161,6 +189,16 @@ interface ShapeKind {
|
|
|
161
189
|
};
|
|
162
190
|
/** extra strokes drawn over the fill (a lid, a fold) */
|
|
163
191
|
detail?(b: Box): string | null;
|
|
192
|
+
/** other names accepted by `shape` (`db` for `cylinder`) */
|
|
193
|
+
aliases?: string[];
|
|
194
|
+
/** moves the label down (px) inside the outline, e.g. below a cylinder's lid */
|
|
195
|
+
textOffset?: number;
|
|
196
|
+
/**
|
|
197
|
+
* where an edge meets the outline on `side`; `t` in [-1, 1] slides along
|
|
198
|
+
* that side. Defaults to the bounding box; `portOn` builds one for other
|
|
199
|
+
* outlines.
|
|
200
|
+
*/
|
|
201
|
+
port?(b: Box, side: Side, t: number): Point;
|
|
164
202
|
}
|
|
165
203
|
/** An edge end marker: `[head: cross]`, `[tail: crow]` */
|
|
166
204
|
interface MarkerKind {
|
|
@@ -178,8 +216,8 @@ interface MarkerKind {
|
|
|
178
216
|
inset?: number | ((size: number, width: number) => number);
|
|
179
217
|
}
|
|
180
218
|
/**
|
|
181
|
-
* An edge end marker with its tip at `at`, pointing along `angle`:
|
|
182
|
-
*
|
|
219
|
+
* An edge end marker with its tip at `at`, pointing along `angle`: any
|
|
220
|
+
* registered marker (the built-in ones come from the `markers` plugin). `L` is its length; graph
|
|
183
221
|
* edges size it from the stroke width, panels pass their own.
|
|
184
222
|
*/
|
|
185
223
|
declare function renderHead(at: Point, angle: number, kind: string, color: string, w: number, L?: number): string;
|
|
@@ -675,6 +713,8 @@ interface PanelDecl {
|
|
|
675
713
|
body: string[];
|
|
676
714
|
/** what the panel plugin's `parse` returned */
|
|
677
715
|
data: unknown;
|
|
716
|
+
/** its `parse` threw: the panel is drawn empty and its kind is not asked again */
|
|
717
|
+
failed?: true;
|
|
678
718
|
/** 0-based line range of the block, absent when imported */
|
|
679
719
|
lines?: [number, number];
|
|
680
720
|
/** where the header's `[...]` props sit, for editors */
|
|
@@ -938,221 +978,52 @@ declare const onlyColor: (p: Props) => boolean;
|
|
|
938
978
|
*/
|
|
939
979
|
declare function setLineProp(line: string, head: RegExp, name: string, value: string | null, accept?: (p: Props) => boolean): string;
|
|
940
980
|
declare function serializeProps(props: Props): string;
|
|
981
|
+
declare const unquote: (s: string) => string;
|
|
941
982
|
declare function parse(source: string, opts?: ParseOptions): Diagram;
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
interactive?: boolean;
|
|
947
|
-
/** fixed width attribute; default is the natural size */
|
|
948
|
-
width?: number | string;
|
|
949
|
-
/** drop the background rect */
|
|
950
|
-
transparent?: boolean;
|
|
951
|
-
/** text measuring for panels; the same one layout used */
|
|
952
|
-
measure?: Measure;
|
|
953
|
-
/** draw a dot every n units, from the origin: shows an editor's snap grid */
|
|
954
|
-
snapGrid?: number;
|
|
955
|
-
}
|
|
956
|
-
/** the SVG for a laid out diagram; a plugin that throws becomes a diagnostic on `d` */
|
|
957
|
-
declare function renderSvg(d: Diagram, L: Layout, opts?: RenderOptions): string;
|
|
958
|
-
type Scalar = string | number | boolean;
|
|
959
|
-
type PropBag = Record<string, unknown>;
|
|
960
|
-
interface DiagramJSON {
|
|
961
|
-
title?: string;
|
|
962
|
-
direction?: "right" | "down" | "left" | "up";
|
|
963
|
-
theme?: string;
|
|
964
|
-
settings?: Record<string, Scalar>;
|
|
965
|
-
classes?: Record<string, Record<string, Scalar>>;
|
|
966
|
-
groups?: ({
|
|
967
|
-
id: string;
|
|
968
|
-
label?: string;
|
|
969
|
-
parent?: string;
|
|
970
|
-
class?: string | string[];
|
|
971
|
-
} & PropBag)[];
|
|
972
|
-
nodes?: ({
|
|
973
|
-
id: string;
|
|
974
|
-
label?: string;
|
|
975
|
-
group?: string;
|
|
976
|
-
class?: string | string[];
|
|
977
|
-
body?: string | string[];
|
|
978
|
-
} & PropBag)[];
|
|
979
|
-
edges?: ({
|
|
980
|
-
from: string | string[];
|
|
981
|
-
to: string | string[];
|
|
982
|
-
label?: string;
|
|
983
|
-
arrow?: string;
|
|
984
|
-
class?: string | string[];
|
|
985
|
-
} & PropBag)[];
|
|
986
|
-
}
|
|
987
|
-
interface JsonResult {
|
|
988
|
-
source: string;
|
|
989
|
-
errors: string[];
|
|
990
|
-
}
|
|
991
|
-
declare function fromJSON(input: DiagramJSON | string): JsonResult;
|
|
983
|
+
/**
|
|
984
|
+
* The registered node shapes, in registration order. The built-in ones come
|
|
985
|
+
* from the `shapes` plugin; `use()` adds every plugin's shapes here.
|
|
986
|
+
*/
|
|
992
987
|
declare const SHAPES: ShapeName[];
|
|
988
|
+
declare function normalizeShape(s: string | undefined): ShapeName;
|
|
989
|
+
/** SVG path data for the outline of a shape; a rounded box when no plugin registered it. */
|
|
990
|
+
declare function shapePath(shape: ShapeName, b: Box, radius: number): string;
|
|
991
|
+
declare function rectPath(x: number, y: number, w: number, h: number, r: number): string;
|
|
992
|
+
/**
|
|
993
|
+
* Point on the outline of a box for a port on `side`. `t` in [-1, 1] slides
|
|
994
|
+
* the port along that side (0 = centre); `spread` is how much of the side can
|
|
995
|
+
* host ports (fraction of its half-length). `depth(horiz, rel, u)` gives the
|
|
996
|
+
* distance from the centre to the outline, for outlines that are not a box:
|
|
997
|
+
* `horiz` is true on the top and bottom sides, `rel` the scaled position along
|
|
998
|
+
* the side and `u` the offset in px.
|
|
999
|
+
*/
|
|
1000
|
+
declare function portOn(b: Box, side: Side, t: number, spread?: number, depth?: (horiz: boolean, rel: number, u: number) => number): Point;
|
|
1001
|
+
declare const num: (v: string | undefined, d: number) => number;
|
|
993
1002
|
/**
|
|
994
1003
|
* The line style props ask for: `key` (`style` on edges, `border-style` on
|
|
995
1004
|
* boxes) wins over the `dashed` / `dotted` shorthand flags. Undefined when
|
|
996
1005
|
* nothing is set, so the caller's default applies.
|
|
997
1006
|
*/
|
|
998
1007
|
declare function lineStyle(p: Props, key?: string): LineStyle$1 | undefined;
|
|
999
|
-
/** the `stroke-dasharray` of a line style at a stroke width; null for solid */
|
|
1000
|
-
declare function dashFor(style: string | undefined, width: number): string | null;
|
|
1001
|
-
/** Serialise layout overrides as a `layout { ... }` block (without trailing newline). */
|
|
1002
|
-
declare function formatLayout(o: LayoutOverrides): string;
|
|
1003
|
-
/** Replace (or append, or remove) the layout block. */
|
|
1004
|
-
declare function writeLayout(source: string, o: LayoutOverrides, d?: Diagram): string;
|
|
1005
|
-
type Target = {
|
|
1006
|
-
kind: "node" | "edge" | "group" | "panel";
|
|
1007
|
-
id: string;
|
|
1008
|
-
};
|
|
1009
|
-
/**
|
|
1010
|
-
* Set or remove (text = '') the label of a node, edge, group or panel.
|
|
1011
|
-
* Node, group and panel labels are written quoted; edge labels stay bare when
|
|
1012
|
-
* they can. Every edge of one statement (`a -> b, c: label`) shares the label.
|
|
1013
|
-
*/
|
|
1014
|
-
declare function setLabel(source: string, target: Target, text: string, d?: Diagram): string;
|
|
1015
1008
|
/**
|
|
1016
|
-
*
|
|
1017
|
-
*
|
|
1018
|
-
* Implicit nodes (only mentioned in edges) get a declaration line appended.
|
|
1009
|
+
* `edge-width` when written, else undefined: for a panel whose lines are
|
|
1010
|
+
* thinner than the theme's edges unless the author asks for more
|
|
1019
1011
|
*/
|
|
1020
|
-
declare function
|
|
1021
|
-
/**
|
|
1022
|
-
declare
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
*/
|
|
1028
|
-
declare function
|
|
1029
|
-
|
|
1030
|
-
* Apply one part edit (set a field, move, add, remove) through the panel
|
|
1031
|
-
* kind's `editPart`. `id` is the edited part's id afterwards (it can change
|
|
1032
|
-
* when the part moves or is renamed); the source comes back unchanged when
|
|
1033
|
-
* the edit does not apply.
|
|
1034
|
-
*/
|
|
1035
|
-
declare function editPart(source: string, panelId: string, edit: PartEdit, d?: Diagram): {
|
|
1036
|
-
source: string;
|
|
1037
|
-
id?: string;
|
|
1038
|
-
};
|
|
1039
|
-
/** Finish a panel drag. Prefer the declaration; a purely visual handle uses layout. */
|
|
1040
|
-
declare function writePanelDrag(source: string, d: Diagram, id: string, handle: PanelHandle): string;
|
|
1041
|
-
interface MdBlock {
|
|
1042
|
-
index: number;
|
|
1043
|
-
name: string;
|
|
1044
|
-
source: string;
|
|
1045
|
-
kind: "comment" | "fence";
|
|
1046
|
-
/** line range [start, end] (inclusive) of the block itself */
|
|
1047
|
-
start: number;
|
|
1048
|
-
end: number;
|
|
1049
|
-
/** line range of the generated image reference, if present */
|
|
1050
|
-
image?: [number, number];
|
|
1051
|
-
}
|
|
1052
|
-
interface MdOptions {
|
|
1053
|
-
/** directory for SVGs, relative to the markdown file (default "diagrams") */
|
|
1054
|
-
outDir?: string;
|
|
1055
|
-
/** used to name unnamed blocks: <baseName>-<n> */
|
|
1056
|
-
baseName?: string;
|
|
1057
|
-
/** also write a dark variant and emit a <picture> element */
|
|
1058
|
-
dark?: boolean;
|
|
1059
|
-
/** keep ```yuhwa fences instead of converting them to comments */
|
|
1060
|
-
keepFences?: boolean;
|
|
1061
|
-
/** reads `import "..."` targets, see Options.resolve */
|
|
1062
|
-
resolve?: (path: string) => string | undefined;
|
|
1063
|
-
/** path of the markdown file; imports in blocks resolve against its folder */
|
|
1064
|
-
file?: string;
|
|
1065
|
-
/**
|
|
1066
|
-
* Link each image to this URL, such as a page that pans and zooms the
|
|
1067
|
-
* diagram (`yuhwa md --view`). Gets the block's source.
|
|
1068
|
-
*/
|
|
1069
|
-
view?: (source: string) => string;
|
|
1070
|
-
}
|
|
1071
|
-
interface MdResult {
|
|
1072
|
-
markdown: string;
|
|
1073
|
-
files: {
|
|
1074
|
-
path: string;
|
|
1075
|
-
svg: string;
|
|
1076
|
-
}[];
|
|
1077
|
-
blocks: MdBlock[];
|
|
1078
|
-
diagnostics: {
|
|
1079
|
-
block: string;
|
|
1080
|
-
line: number;
|
|
1081
|
-
message: string;
|
|
1082
|
-
severity: string;
|
|
1083
|
-
}[];
|
|
1084
|
-
}
|
|
1085
|
-
declare function findBlocks(md: string, baseName?: string, outDir?: string): MdBlock[];
|
|
1086
|
-
declare function processMarkdown(md: string, opts?: MdOptions): MdResult;
|
|
1087
|
-
/** Replace the source of block `index` in a markdown document. */
|
|
1088
|
-
declare function replaceBlockSource(md: string, index: number, source: string): string;
|
|
1089
|
-
interface ConvertResult {
|
|
1090
|
-
source: string;
|
|
1091
|
-
warnings: {
|
|
1092
|
-
line: number;
|
|
1093
|
-
message: string;
|
|
1094
|
-
}[];
|
|
1095
|
-
}
|
|
1096
|
-
/** true when the source is Mermaid that yuhwa converts (a flowchart or one of the types above) */
|
|
1097
|
-
declare function isMermaid(source: string): boolean;
|
|
1098
|
-
declare function fromMermaid(source: string): ConvertResult;
|
|
1099
|
-
declare const NODE_PROPS: string[];
|
|
1100
|
-
declare const EDGE_PROPS: string[];
|
|
1101
|
-
declare const GROUP_PROPS: string[];
|
|
1102
|
-
/** frame props every panel takes, next to the plugin's own */
|
|
1103
|
-
declare const PANEL_PROPS: string[];
|
|
1104
|
-
/** allowed values for enum-like props */
|
|
1105
|
-
declare const ENUMS: Record<string, string[]>;
|
|
1106
|
-
/** props whose value must be a colour (or `none`/`transparent`), on nodes, edges, groups and panels */
|
|
1107
|
-
declare const COLORS: string[];
|
|
1108
|
-
declare const BOOLS: string[];
|
|
1109
|
-
declare const NUMBERS: string[];
|
|
1110
|
-
/** a panel kind's typed header props, looked up by kind name */
|
|
1111
|
-
type PanelOptions = (kind: string) => Record<string, PanelOption> | undefined;
|
|
1112
|
-
declare function lint(d: Diagram, panelOptions?: PanelOptions): void;
|
|
1113
|
-
declare const GUIDE: string;
|
|
1114
|
-
declare const themes: YuhwaPlugin;
|
|
1115
|
-
declare const charts: YuhwaPlugin;
|
|
1116
|
-
declare const tables: YuhwaPlugin;
|
|
1117
|
-
declare const frames: YuhwaPlugin;
|
|
1118
|
-
declare const footer: YuhwaPlugin;
|
|
1119
|
-
declare const legend: YuhwaPlugin;
|
|
1120
|
-
declare const sequence: YuhwaPlugin;
|
|
1121
|
-
declare const timeline: YuhwaPlugin;
|
|
1122
|
-
declare const chart: YuhwaPlugin;
|
|
1123
|
-
declare const git: YuhwaPlugin;
|
|
1124
|
-
declare const builtins: YuhwaPlugin[];
|
|
1125
|
-
interface Options extends LayoutOptions, RenderOptions {
|
|
1126
|
-
/**
|
|
1127
|
-
* Reads files named by `import "..."`: gets the resolved path, returns the
|
|
1128
|
-
* source or undefined. In Node: `(p) => readFileSync(p, 'utf8')`.
|
|
1129
|
-
*/
|
|
1130
|
-
resolve?: ParseOptions["resolve"];
|
|
1131
|
-
/** path of the source being rendered; relative imports resolve against it */
|
|
1132
|
-
file?: string;
|
|
1133
|
-
}
|
|
1134
|
-
interface Result {
|
|
1135
|
-
svg: string;
|
|
1136
|
-
/** yuhwa source that was rendered (converted when the input was Mermaid or JSON) */
|
|
1137
|
-
source: string;
|
|
1138
|
-
/** what the input was detected as */
|
|
1139
|
-
format: InputFormat;
|
|
1140
|
-
diagram: Diagram;
|
|
1141
|
-
layout: Layout;
|
|
1142
|
-
diagnostics: Diagnostic[];
|
|
1143
|
-
}
|
|
1144
|
-
type InputFormat = "yuhwa" | "mermaid" | "json";
|
|
1145
|
-
/** Stable short hash, used for deterministic SVG ids. */
|
|
1146
|
-
declare function hash(s: string): string;
|
|
1012
|
+
declare function edgeWidthOf(p: Props): number | undefined;
|
|
1013
|
+
/** a positive number, else undefined */
|
|
1014
|
+
declare const posNum: (v: string | undefined) => number | undefined;
|
|
1015
|
+
declare function effectiveProps(d: Diagram, decl: {
|
|
1016
|
+
props: Props;
|
|
1017
|
+
classes?: string[];
|
|
1018
|
+
}): Props;
|
|
1019
|
+
/** the `stroke-dasharray` of a line style at a stroke width; null for solid */
|
|
1020
|
+
declare function dashFor(style: string | undefined, width: number): string | null;
|
|
1021
|
+
declare function resolveNodeStyle(d: Diagram, n: NodeDecl, p: Props, theme: Theme): ResolvedNodeStyle;
|
|
1147
1022
|
/**
|
|
1148
|
-
*
|
|
1149
|
-
*
|
|
1023
|
+
* `o` without a prototype: a lookup by a name from the source (`theme:
|
|
1024
|
+
* constructor`, `$toString`) then finds only the table's own keys.
|
|
1150
1025
|
*/
|
|
1151
|
-
declare
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
};
|
|
1156
|
-
/** Parse, lay out and render a diagram to an SVG string. Never throws on bad input. */
|
|
1157
|
-
declare function render(input: string | DiagramJSON, opts?: Options): Result;
|
|
1158
|
-
export { LexedLine as $, FrameKind as $t, isMermaid as A, ThemeInput as An, LaidPanel as At, setPartTone as B, canvasMeasure as Bn, PartChange as Bt, GROUP_PROPS as C, LineStyle$1 as Cn, EdgeOverride as Ct, lint as D, THEME_NAMES as Dn, LaidEdge as Dt, PANEL_PROPS as E, THEME_KEYS as En, LabelRef as Et, processMarkdown as F, isToneOrHex as Fn, PanelDecl as Ft, dashFor as G, ResolvedNodeStyle as Gt, setSetting as H, Point as Ht, replaceBlockSource as I, ramp as In, PanelHandle as It, DiagramJSON as J, SourceRef as Jt, lineStyle as K, ShapeName as Kt, editPart as L, registerTheme as Ln, PanelOverride as Lt, MdOptions as M, getTheme as Mn, LayoutOverrides as Mt, MdResult as N, isSafeCss as Nn, NodeDecl as Nt, ConvertResult as O, TONES as On, LaidGroup as Ot, findBlocks as P, isSafeLink as Pn, NodeOverride as Pt, KNOWN_SETTINGS as Q, Decoration as Qt, formatLayout as R, themeNames as Rn, PanelPart as Rt, ENUMS as S, tspans as Sn, EdgeDecl as St, NUMBERS as T, THEMES as Tn, HeadKind as Tt, writeLayout as U, Props as Ut, setProp as V, PartEdit as Vt, writePanelDrag as W, ResolvedEdgeStyle as Wt, fromJSON as X, groupPath as Xt, JsonResult as Y, GRID as Yt, renderSvg as Z, layout as Zt, themes as _, InkColors as _n, Component as _t, render as a, RowPaint as an, blockBraces as at, COLORS as b, renderSegs as bn, Diagram as bt, git as c, optionKind as cn, lex as ct, sequence as d, registry as dn, parseProps as dt, PanelCtx as en, PANELS as et, legend as f, unuse as fn, serializeProps as ft, charts as g, renderHead as gn, Box as gt, tables as h, ShapeKind as hn, splitTrailingProps as ht, hash as i, RowKind as in, TokKind as it, MdBlock as j, createTheme as jn, Layout as jt, fromMermaid as k, Theme as kn, LaidNode as kt, chart as l, perPass as ln, onlyColor as lt, frames as m, MarkerKind as mn, setTrailingProp as mt, Options as n, PanelOption as nn, SETTING_VALUES as nt, toSource as o, StatementKind as on, isYuhwaPath as ot, footer as p, use as pn, setLineProp as pt, SHAPES as q, Side as qt, Result as r, RowCtx as rn, Tok as rt, builtins as s, YuhwaPlugin as sn, joinPath as st, InputFormat as t, PanelKind as tn, ParseOptions as tt, timeline as u, recolor as un, parse as ut, GUIDE as v, Seg as vn, Curve as vt, NODE_PROPS as w, RAMPS as wn, GroupDecl as wt, EDGE_PROPS as x, segsW as xn, Direction as xt, BOOLS as y, parseInline as yn, Diagnostic as yt, setLabel as z, approxMeasure as zn, PartAction as zt };
|
|
1026
|
+
declare const table: <T>(o: Record<string, T>) => Record<string, T>;
|
|
1027
|
+
/** `p` as it is, typed: no annotation needed for the kinds inside */
|
|
1028
|
+
declare const definePlugin: <P extends YuhwaPlugin>(p: P) => P;
|
|
1029
|
+
export { PanelDecl as $, SANS as $t, setLineProp as A, registry as At, EdgeDecl as B, inkColor as Bt, isYuhwaPath as C, RowKind as Ct, parse as D, optionKind as Dt, onlyColor as E, YuhwaPlugin as Et, Component as F, renderHead as Ft, LaidEdge as G, segsW as Gt, GroupDecl as H, parseInline as Ht, Curve as I, InkColors as It, LaidPanel as J, tspans as Jt, LaidGroup as K, sumW as Kt, Diagnostic as L, Seg as Lt, splitTrailingProps as M, use as Mt, unquote as N, MarkerKind as Nt, parseProps as O, perPass as Ot, Box as P, ShapeKind as Pt, NodeOverride as Q, RAMPS as Qt, Diagram as R, esc as Rt, blockBraces as S, RowCtx as St, lex as T, StatementKind as Tt, HeadKind as U, plain as Ut, EdgeOverride as V, nodeInk as Vt, LabelRef as W, renderSegs as Wt, LayoutOverrides as X, LineStyle$1 as Xt, Layout as Y, COLOR_TOKEN as Yt, NodeDecl as Z, MONO as Zt, PANELS as _, themeNames as _n, Decoration as _t, effectiveProps as a, ThemeInput as an, PartEdit as at, Tok as b, canvasMeasure as bn, PanelKind as bt, posNum as c, cssHex as cn, ResolvedEdgeStyle as ct, normalizeShape as d, isSafeCss as dn, Side as dt, THEMES as en, PanelHandle as et, portOn as f, isSafeLink as fn, SourceRef as ft, LexedLine as g, resolveColor as gn, layout as gt, KNOWN_SETTINGS as h, registerTheme as hn, groupPath as ht, edgeWidthOf as i, Theme as in, PartChange as it, setTrailingProp as j, unuse as jt, serializeProps as k, recolor as kt, resolveNodeStyle as l, getTheme as ln, ResolvedNodeStyle as lt, shapePath as m, ramp as mn, LayoutOptions as mt, table as n, THEME_NAMES as nn, PanelPart as nt, lineStyle as o, bool as on, Point as ot, rectPath as p, isToneOrHex as pn, GRID as pt, LaidNode as q, textEl as qt, dashFor as r, TONES as rn, PartAction as rt, num as s, createTheme as sn, Props as st, definePlugin as t, THEME_KEYS as tn, PanelOverride as tt, SHAPES as u, isColor as un, ShapeName as ut, ParseOptions as v, Measure as vn, FrameKind as vt, joinPath as w, RowPaint as wt, TokKind as x, PanelOption as xt, SETTING_VALUES as y, approxMeasure as yn, PanelCtx as yt, Direction as z, f as zt };
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `yuhwa/plugin`: everything needed to write a plugin, in one import. The
|
|
3
|
+
* built-in plugins in `src/plugins` import only from here (a lint rule keeps
|
|
4
|
+
* it so), so a third-party plugin can do whatever a built-in one does.
|
|
5
|
+
*
|
|
6
|
+
* import { definePlugin, esc, f, perPass } from 'yuhwa/plugin';
|
|
7
|
+
* export default definePlugin({ name: 'my-plugin', panels: [myPanel] });
|
|
8
|
+
*
|
|
9
|
+
* Register a plugin with `use` from `yuhwa`.
|
|
10
|
+
*/
|
|
11
|
+
import { $t as SANS, A as setLineProp, Bt as inkColor, Ct as RowKind, Dt as optionKind, E as onlyColor, Et as YuhwaPlugin, Ft as renderHead, Gt as segsW, Ht as parseInline, It as InkColors, Jt as tspans, Kt as sumW, Lt as Seg, M as splitTrailingProps, N as unquote, Nt as MarkerKind, O as parseProps, Ot as perPass, P as Box, Pt as ShapeKind, Qt as RAMPS, R as Diagram, Rt as esc, St as RowCtx, Tt as StatementKind, Ut as plain, Vt as nodeInk, Wt as renderSegs, Xt as LineStyle, Y as Layout, Yt as COLOR_TOKEN, Z as NodeDecl, Zt as MONO, _t as Decoration, a as effectiveProps, an as ThemeInput, at as PartEdit, bt as PanelKind, c as posNum, cn as cssHex, d as normalizeShape, dn as isSafeCss, dt as Side, et as PanelHandle, f as portOn, fn as isSafeLink, gn as resolveColor, i as edgeWidthOf, in as Theme, it as PartChange, j as setTrailingProp, k as serializeProps, kt as recolor, l as resolveNodeStyle, m as shapePath, mn as ramp, n as table, nt as PanelPart, o as lineStyle, on as bool, ot as Point, p as rectPath, qt as textEl, r as dashFor, s as num, sn as createTheme, st as Props, t as definePlugin, un as isColor, vn as Measure, vt as FrameKind, wt as RowPaint, xt as PanelOption, yn as approxMeasure, yt as PanelCtx, zt as f } from "./plugin-NSkNyoUj.js";
|
|
12
|
+
export { type Box, COLOR_TOKEN, type Decoration, type Diagram, type FrameKind, type InkColors, type Layout, type LineStyle, MONO, type MarkerKind, type Measure, type NodeDecl, type PanelCtx, type PanelHandle, type PanelKind, type PanelOption, type PanelPart, type PartChange, type PartEdit, type Point, type Props, RAMPS, type RowCtx, type RowKind, type RowPaint, SANS, type Seg, type ShapeKind, type Side, type StatementKind, type Theme, type ThemeInput, type YuhwaPlugin, approxMeasure, bool, createTheme, cssHex, dashFor, definePlugin, edgeWidthOf, effectiveProps, esc, f, inkColor, isColor, isSafeCss, isSafeLink, lineStyle, nodeInk, normalizeShape, num, onlyColor, optionKind, parseInline, parseProps, perPass, plain, portOn, posNum, ramp, recolor, rectPath, renderHead, renderSegs, resolveColor, resolveNodeStyle, segsW, serializeProps, setLineProp, setTrailingProp, shapePath, splitTrailingProps, sumW, table, textEl, tspans, unquote };
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { jt as COLOR_TOKEN, Mt as MONO, Nt as RAMPS, Pt as SANS, n as approxMeasure, zt as bool, Bt as createTheme, Vt as cssHex, Z as dashFor, t as definePlugin, $ as edgeWidthOf, et as effectiveProps, ft as esc, pt as f, mt as inkColor, Wt as isColor, Gt as isSafeCss, Kt as isSafeLink, tt as lineStyle, gt as nodeInk, B as normalizeShape, nt as num, _ as onlyColor, i as optionKind, _t as parseInline, y as parseProps, a as perPass, yt as plain, V as portOn, it as posNum, Jt as ramp, o as recolor, H as rectPath, Y as renderHead, bt as renderSegs, Xt as resolveColor, ot as resolveNodeStyle, Ct as segsW, S as serializeProps, C as setLineProp, w as setTrailingProp, W as shapePath, T as splitTrailingProps, Dt as sumW, $t as table, Ot as textEl, At as tspans, E as unquote } from "./plugin-Bs4eiAuz.js";
|
package/dist/remark.d.ts
CHANGED
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
* A fence with `no-render` (```yuhwa no-render) stays a code block.
|
|
11
11
|
* ```yuhwa file="diagrams/arch.yu" renders that file instead of the block.
|
|
12
12
|
*/
|
|
13
|
-
import { t as YuhwaDocsOptions } from "./figure-
|
|
13
|
+
import { t as YuhwaDocsOptions } from "./figure-QAwSU1Ry.js";
|
|
14
14
|
export default function remarkYuhwa(opts?: YuhwaDocsOptions): (tree: any, file?: any) => void;
|
|
15
15
|
export { type YuhwaDocsOptions, remarkYuhwa };
|
package/dist/remark.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as wantsRender, n as renderBlock, o as zoomTag } from "./node-
|
|
1
|
+
import { a as wantsRender, n as renderBlock, o as zoomTag } from "./node-CLu2Pp_2.js";
|
|
2
2
|
// src/integrations/remark.ts
|
|
3
3
|
/**
|
|
4
4
|
* remark plugin: replaces ```yuhwa code blocks with a rendered figure.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as YuhwaService, r as applyChange, t as SEMANTIC_LEGEND } from "./service-
|
|
1
|
+
import { n as YuhwaService, r as applyChange, t as SEMANTIC_LEGEND } from "./service-D7DNWBAU.js";
|
|
2
2
|
// \0rolldown/runtime.js
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as isMermaid } from "./src-BjOhvTAB.js";
|
|
2
|
+
import { $t as table, A as ENUMS, D as BOOLS, F as PLACEMENT_PROPS, It as THEME_KEYS, M as NODE_PROPS, N as NUMBERS, O as COLORS, P as PANEL_PROPS, Rt as TONES, S as serializeProps, Zt as themeNames, d as PANELS, dt as SPAN_KEYS, f as SETTING_VALUES, g as lex, h as joinPath, i as optionKind, j as GROUP_PROPS, k as EDGE_PROPS, p as blockBraces, u as KNOWN_SETTINGS, v as parse, vt as parseSpanStyle, wt as spanKey, z as SHAPES } from "./plugin-Bs4eiAuz.js";
|
|
2
3
|
// src/lsp/format.ts
|
|
3
4
|
/**
|
|
4
5
|
* Formatting and text edits, without a parser of their own beyond `lex`.
|
|
@@ -555,7 +556,7 @@ function findQuoted(code, q, props) {
|
|
|
555
556
|
const re = new RegExp(`(?<![\\w-])${q.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?![\\w-])`, "g");
|
|
556
557
|
let first = -1;
|
|
557
558
|
for (const m of code.matchAll(re)) {
|
|
558
|
-
const depth =
|
|
559
|
+
const depth = code.slice(0, m.index).split("").reduce((n, c) => n + (c === "[" ? 1 : c === "]" ? -1 : 0), 0);
|
|
559
560
|
if (props && depth > 0) return m.index;
|
|
560
561
|
if (first < 0) first = m.index;
|
|
561
562
|
}
|