@draftably/markdown 0.2.1 → 0.2.2

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/mermaid.js CHANGED
@@ -61,7 +61,7 @@ async function S() {
61
61
  globalThis.fetch = async () => {
62
62
  throw Error("Mermaid resource loading is disabled.");
63
63
  };
64
- const { JSDOM: i } = await import("jsdom"), { createMermaidFlowParser: s, makePlainLabel: e } = await import("./chunks/mermaid-facade-BoLWBerE.js"), { importMermaidFlow: t } = await import("./chunks/mermaid-importer-D9i_Vfxl.js"), r = new i("<!doctype html><html><body></body></html>", {
64
+ const { JSDOM: i } = await import("jsdom"), { createMermaidFlowParser: s, makePlainLabel: e } = await import("./chunks/mermaid-facade-BoLWBerE.js"), { importMermaidFlow: t } = await import("./chunks/mermaid-importer-BHKoojYC.js"), r = new i("<!doctype html><html><body></body></html>", {
65
65
  url: "https://import.invalid/"
66
66
  });
67
67
  Object.assign(globalThis, {
@@ -15,6 +15,7 @@ export interface CellInput {
15
15
  size?: {
16
16
  width: number;
17
17
  height?: number;
18
+ minHeight?: number;
18
19
  };
19
20
  }
20
21
  export interface CellBox {
@@ -99,11 +99,12 @@ export declare function layoutFor(m: Model, scope: string): ModelLayout;
99
99
  /**
100
100
  * Size of a node: its requested size, or the default width with a height that fits the title in
101
101
  * the theme's type and padding. A requested size is kept exactly; `overflow` reports a title that
102
- * no longer fits in it.
102
+ * no longer fits in it. With `height=auto`, `min-height` is a floor under the title's height.
103
103
  */
104
104
  export declare function leafSize(o: ModelObject, size: {
105
105
  width: number;
106
106
  height?: number;
107
+ minHeight?: number;
107
108
  } | undefined, look: ResolvedAppearance): {
108
109
  w: number;
109
110
  h: number;
@@ -1,3 +1,17 @@
1
+ /**
2
+ * `check` advice on the key and the prose round a drawing: a key that leaves a color or a line
3
+ * style unexplained, a `legend` swatch drawn in a shade that no node of its family uses, and
4
+ * heading prose that the drawing should say instead.
5
+ */
6
+ import { type Shade } from '../model/appearance';
1
7
  import type { Diagnostic } from './compile';
2
8
  import type { Model } from './syntax';
3
9
  export declare function legendNotes(m: Model): Diagnostic[];
10
+ /**
11
+ * The shade a `legend family` swatch draws when its line sets none: what the family's nodes draw.
12
+ * When no node names the family and its nodes are all member cards (they inherit it from a group
13
+ * on a quiet surface shade), that is the member card's shade; otherwise it is a colored node's.
14
+ */
15
+ export declare function legendShade(m: Model, family: string): Shade;
16
+ /** Give each `legend family` line with no `shade=` the shade its family's nodes draw. */
17
+ export declare function settleLegendShades(m: Model): void;
@@ -210,11 +210,13 @@ export type Hint = {
210
210
  line: number;
211
211
  }
212
212
  /** `height` is unset for `height=auto`: the title's height at that width, as without a size. */
213
+ /** `minHeight` is a floor under `height=auto`, for a host that draws more than the title. */
213
214
  | {
214
215
  type: 'size';
215
216
  id: string;
216
217
  width: number;
217
218
  height?: number;
219
+ minHeight?: number;
218
220
  line: number;
219
221
  };
220
222
  export type Strength = 'prefer' | 'required';
@@ -18,6 +18,12 @@ export type Shade = (typeof SHADES)[number];
18
18
  export declare const isShade: (n: unknown) => n is Shade;
19
19
  /** Shade of a node that names a color without a shade. */
20
20
  export declare const NODE_SHADE: Shade;
21
+ /**
22
+ * Shade of a member card: a node drawn in its container's family with no shade of its own. It is
23
+ * the palest stop on the canvas side of the frame (50 in light themes, 950 in dark ones), so the
24
+ * card stands apart from its frame by fill and keeps the family's outline and ink.
25
+ */
26
+ export declare const memberShadeFor: (theme: ThemeId) => Shade;
21
27
  /**
22
28
  * Shade of a group that names a color without a shade. Groups are quiet surfaces behind nodes, so
23
29
  * this is a pale shade in light themes and a deep one in dark themes; the scale itself never flips.
@@ -148,6 +154,8 @@ interface Preset {
148
154
  hues?: Partial<Record<string, [number, number]>>;
149
155
  }
150
156
  export declare const PRESETS: Record<ThemeId, Preset>;
157
+ /** `a` moved toward `b` by `t` (0–1), in sRGB. */
158
+ export declare function mixColors(a: string, b: string, t: number): string;
151
159
  export declare function contrast(a: string, b: string): number;
152
160
  /** Contrast targets (WCAG ratios) every generated color meets. */
153
161
  export declare const CONTRAST: {
@@ -184,6 +192,8 @@ export interface ResolvedAppearance {
184
192
  radius: number;
185
193
  shadow: boolean;
186
194
  title: TypeProfile;
195
+ /** A node title's detail lines (after its first `\n`): a step smaller and lighter. */
196
+ detail: TypeProfile;
187
197
  groupTitle: TypeProfile;
188
198
  annotation: TypeProfile;
189
199
  /** Space above a group's content; the group title sits in it. */
@@ -204,6 +214,15 @@ export declare function resolveAppearance(appearance?: DiagramAppearance): Resol
204
214
  * default surface; the file parser reports them before they get here.
205
215
  */
206
216
  export declare function swatchFor(r: ResolvedAppearance, family: string | undefined, shade: Shade | undefined, kind?: 'node' | 'group'): Swatch;
217
+ /**
218
+ * The quiet panel behind notes and a sequence diagram: slate 50 in light themes, and the theme's
219
+ * own group surface in dark ones, so the theme's text ink reads on it.
220
+ */
221
+ export declare const panelSwatch: (r: ResolvedAppearance) => Swatch;
222
+ /** Bands and dividers drawn over that panel. */
223
+ export declare const bandSwatch: (r: ResolvedAppearance) => Swatch;
224
+ /** Ink for a link in a note or footnote, held to 4.5:1 on `against`. */
225
+ export declare const linkInk: (r: ResolvedAppearance, against: string) => string;
207
226
  /** Shades a family defines, in numeric order. */
208
227
  export declare const shadesOf: (r: ResolvedAppearance, family: string) => Shade[];
209
228
  export {};
@@ -12,10 +12,25 @@ export interface TitleArea {
12
12
  maxHeight: number;
13
13
  }
14
14
  export declare function titleArea(shape: ShapeKind, w: number, h: number, r: ResolvedAppearance, icon?: boolean): TitleArea;
15
- /** Height a shape needs for `lines` title lines; never less than `base`. */
16
- export declare function titleHeight(shape: ShapeKind, lines: number, base: number, r: ResolvedAppearance): number;
17
- /** A shape's title in balanced lines no wider than `width` (see `wrapLines`). */
18
- export declare const wrapTitle: (text: string, width: number, r: ResolvedAppearance) => string[];
15
+ /** Height a shape needs for a title block `text` px tall; never less than `base`. */
16
+ export declare function titleHeight(shape: ShapeKind, text: number, base: number, r: ResolvedAppearance): number;
17
+ /** One line of a shape's title: part of its name, or of its detail. */
18
+ export interface TitleLine {
19
+ text: string;
20
+ /** A detail line, from the text after the title's first `\n`, drawn in `r.detail`. */
21
+ detail: boolean;
22
+ }
23
+ /**
24
+ * A shape's title in balanced lines no wider than `width` (see `wrapLines`). The text before the
25
+ * first `\n` is the name, in the title type; the rest is detail, in the smaller detail type.
26
+ */
27
+ export declare function wrapTitle(text: string, width: number, r: ResolvedAppearance): TitleLine[];
28
+ /** The type a title line is set in. */
29
+ export declare const lineType: (l: TitleLine, r: ResolvedAppearance) => TypeProfile;
30
+ /** Height of a block of title lines. */
31
+ export declare const textHeight: (lines: TitleLine[], r: ResolvedAppearance) => number;
32
+ /** Each line's centre, measured from the middle of the block. */
33
+ export declare function lineOffsets(lines: TitleLine[], r: ResolvedAppearance): number[];
19
34
  /**
20
35
  * Line width for a diamond's title, `s` its side. A text block W wide and H tall fits inside a
21
36
  * square diamond when W + H <= s, so this takes the widest measure whose wrapped lines still fit:
@@ -37,9 +52,10 @@ export interface NodeLabel {
37
52
  y: number;
38
53
  width: number;
39
54
  height: number;
40
- lines: string[];
55
+ lines: TitleLine[];
56
+ /** Each line's centre, relative to `y`. */
57
+ offsets: number[];
41
58
  mode: LabelMode;
42
- lineHeight: number;
43
59
  leader: boolean;
44
60
  }
45
61
  /** Where a shape's title is drawn, relative to the shape. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftably/markdown",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Build static SVG diagram assets from Markdown draft fences.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "jsdom": "26.1.0",
37
37
  "mermaid": "12.2.0",
38
- "@draftably/runtime": "0.3.0"
38
+ "@draftably/runtime": "0.4.0"
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=22.21.0"