Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | 7x 7x 7x 7x 7x 7x 7x 7x | /**
* Type definitions for Rirekisho (履歴書) generator
* Based on 厚生労働省 履歴書様式例 format
*/
import type { ChronologicalOrder, PaperSize } from '../../types/config.js';
import type { CVMetadata } from '../../types/metadata.js';
import type { ParsedSection } from '../../types/sections.js';
// Re-export PaperSize for use in other modules
export type { PaperSize } from '../../types/config.js';
// ============================================================================
// Input Types
// ============================================================================
/** Options for Rirekisho generation */
export interface RirekishoOptions {
readonly paperSize: PaperSize;
readonly chronologicalOrder?: ChronologicalOrder;
readonly hideMotivation?: boolean;
/** Base64 encoded photo data URI (e.g., "data:image/png;base64,...") */
readonly photoDataUri?: string;
/** Custom CSS stylesheet content to append after default styles */
readonly customStylesheet?: string;
}
/** Input data for the Rirekisho generator */
export interface RirekishoInput {
readonly metadata: CVMetadata;
readonly sections: readonly ParsedSection[];
}
// ============================================================================
// Paper & Dimensions
// ============================================================================
/** Paper dimensions in mm (landscape orientation) */
export interface PaperDimensions {
readonly width: number;
readonly height: number;
}
/** Paper sizes in mm (landscape orientation: width > height) */
export const PAPER_SIZES: Record<PaperSize, PaperDimensions> = {
a3: { width: 420, height: 297 },
a4: { width: 297, height: 210 },
b4: { width: 364, height: 257 },
b5: { width: 257, height: 182 },
letter: { width: 279.4, height: 215.9 },
};
/** Scale factors relative to A3 base size */
export const SCALE_FACTORS: Record<PaperSize, number> = {
a3: 1.0,
a4: 0.71,
b4: 0.86,
b5: 0.61,
letter: 0.67,
};
/** Minimum row counts per paper size */
export interface MinRowCounts {
readonly rightHistory: number;
readonly license: number;
}
/** Minimum row counts for each paper size */
export const MIN_ROW_COUNTS: Record<PaperSize, MinRowCounts> = {
a3: { rightHistory: 1, license: 1 },
a4: { rightHistory: 1, license: 1 },
b4: { rightHistory: 1, license: 1 },
b5: { rightHistory: 1, license: 1 },
letter: { rightHistory: 1, license: 1 },
};
/** Preferred row counts per paper size (used when space allows) */
export interface PreferredRowCounts {
readonly rightHistory: number;
readonly license: number;
}
/** Preferred row counts for each paper size */
export const PREFERRED_ROW_COUNTS: Record<PaperSize, PreferredRowCounts> = {
a3: { rightHistory: 9, license: 7 },
a4: { rightHistory: 7, license: 6 },
b4: { rightHistory: 8, license: 7 },
b5: { rightHistory: 6, license: 5 },
letter: { rightHistory: 7, license: 6 },
};
/** Section height constraints for right page (at scale 1.0) */
export const SECTION_HEIGHTS = {
/** Minimum height for motivation section (mm) */
motivationMin: 25,
/** Minimum height for notes section (mm) */
notesMin: 20,
/** Section header height (mm) */
sectionHeader: 8,
} as const;
// ============================================================================
// Layout Configuration
// ============================================================================
/** Row height constraints in mm (at scale 1.0) */
export const ROW_HEIGHT = {
default: 9.0,
min: 5.0,
max: 11.0,
} as const;
/** Font size constraints in pt (at scale 1.0) */
export const FONT_SIZE = {
default: 11,
min: 6,
} as const;
/** Fixed layout dimensions in mm (at scale 1.0) */
export const FIXED_DIMENSIONS = {
margin: 25,
marginBottom: 20,
centerGap: 12,
photoWidth: 62,
contactWidth: 45,
genderWidth: 33,
headerHeight: 11, // title row + margin
nameRowHeight: 8,
nameMainHeight: 25,
birthGenderHeight: 8.5,
addressRowHeight: 21,
addressFuriganaHeight: 7.2,
footerHeight: 4,
tableMargin: 3,
sectionHeaderHeight: 8,
yearColumnWidth: 18.75,
monthColumnWidth: 10.5,
} as const;
// ============================================================================
// Layout Result Types
// ============================================================================
/** Calculated layout dimensions */
export interface LayoutDimensions {
// Paper & scale
readonly paper: PaperDimensions;
readonly scale: number;
// Page dimensions
readonly margin: number;
readonly marginBottom: number;
readonly centerGap: number;
readonly pageWidth: number;
readonly pageHeight: number;
// Header section
readonly photoWidth: number;
readonly contactWidth: number;
readonly genderWidth: number;
readonly headerHeight: number;
readonly nameRowHeight: number;
readonly nameMainHeight: number;
readonly birthGenderHeight: number;
readonly addressRowHeight: number;
readonly addressFuriganaHeight: number;
// Table dimensions
readonly tableRowHeight: number;
readonly tableFontSize: number;
readonly tableMargin: number;
readonly yearColumnWidth: number;
readonly monthColumnWidth: number;
// Row counts
readonly leftHistoryRows: number;
readonly rightHistoryRows: number;
readonly licenseRows: number;
// Section heights (minimum heights, actual determined by CSS flex)
readonly leftTableHeight: number;
readonly rightHistoryTableHeight: number;
readonly licenseTableHeight: number;
readonly motivationMinHeight: number;
readonly notesMinHeight: number;
// Footer
readonly footerHeight: number;
// Options
readonly hideMotivation: boolean;
// Overflow flag
readonly overflows: boolean;
}
/** Data counts for layout calculation */
export interface DataCounts {
readonly historyDataRows: number;
readonly licenseDataRows: number;
}
/** Layout calculation input */
export interface LayoutInput {
readonly paperSize: PaperSize;
readonly hideMotivation: boolean;
readonly dataCounts: DataCounts;
}
// ============================================================================
// Personal Information
// ============================================================================
/** Formatted date of birth */
export interface FormattedDOB {
readonly year: string;
readonly month: string;
readonly day: string;
}
/** Personal information extracted from metadata */
export interface PersonalInfo {
readonly name: string;
readonly furigana: string;
readonly phone: string;
readonly phone2: string;
readonly address: string;
readonly addressFurigana: string;
readonly postCode: string;
readonly address2: string;
readonly address2Furigana: string;
readonly postCode2: string;
readonly email: string;
readonly email2: string;
readonly gender: string;
readonly dob: FormattedDOB | null;
readonly age: number | null;
}
// ============================================================================
// History Data
// ============================================================================
/** History row data [year, month, content] */
export type HistoryRow = readonly [string, string, string];
/** Today's date for display */
export interface TodayDate {
readonly year: number;
readonly month: number;
readonly day: number;
}
|