1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! Layout and styling constants for the packet renderer.
//!
//! All values faithfully ported from Mermaid JS `defaultConfig.packet` +
//! `PacketDB.getConfig()` (adds 10 to paddingY when showBits=true).
// ---------------------------------------------------------------------------
// Bit geometry (defaultConfig.packet)
// ---------------------------------------------------------------------------
/// Number of bits displayed per row (`bitsPerRow`).
pub const BITS_PER_ROW: u32 = 32;
/// Width of each bit cell in px (`bitWidth`).
pub const BIT_WIDTH: f64 = 32.0;
/// Height of each field box row in px (`rowHeight`).
pub const ROW_HEIGHT: f64 = 32.0;
// ---------------------------------------------------------------------------
// Padding (defaultConfig.packet + showBits adjustment)
// ---------------------------------------------------------------------------
/// Horizontal gap subtracted from the right edge of each block in px (`paddingX`).
pub const PADDING_X: f64 = 5.0;
/// Vertical padding above each row for bit-number labels in px.
/// Base value from config is 5; `showBits=true` (the default) adds 10 → 15.
pub const PADDING_Y: f64 = 15.0;
// ---------------------------------------------------------------------------
// SVG geometry
// ---------------------------------------------------------------------------
/// Total SVG canvas width = `bitWidth × bitsPerRow + 2` px.
pub const SVG_WIDTH: f64 = BIT_WIDTH * BITS_PER_ROW as f64 + 2.0; // 1026
/// Y offset from wordY down to the bit-number label baseline (`bitNumberY = wordY - 2`).
pub const BIT_NUMBER_Y_OFFSET: f64 = 2.0;
// ---------------------------------------------------------------------------
// Typography (defaultPacketStyleOptions)
// ---------------------------------------------------------------------------
/// Font size for field label text (`labelFontSize`).
pub const LABEL_FONT_SIZE: &str = "12px";
/// Font size for bit-number text (`byteFontSize`).
pub const BYTE_FONT_SIZE: &str = "10px";
/// Font size for diagram title text (`titleFontSize`).
pub const TITLE_FONT_SIZE: &str = "14px";
// ---------------------------------------------------------------------------
// Parser limits
// ---------------------------------------------------------------------------
/// Maximum total number of packed words the parser will accept (`maxPacketSize`).
pub const MAX_PACKET_SIZE: usize = 10_000;