| 1 |
package tw |
| 2 |
|
| 3 |
import "fmt" |
| 4 |
|
| 5 |
// Symbols defines the interface for table border symbols |
| 6 |
type Symbols interface { |
| 7 |
// Name returns the style name |
| 8 |
Name() string |
| 9 |
|
| 10 |
// Basic component symbols |
| 11 |
Center() string // Junction symbol (where lines cross) |
| 12 |
Row() string // Horizontal line symbol |
| 13 |
Column() string // Vertical line symbol |
| 14 |
|
| 15 |
// Corner and junction symbols |
| 16 |
TopLeft() string // LevelHeader-left corner |
| 17 |
TopMid() string // LevelHeader junction |
| 18 |
TopRight() string // LevelHeader-right corner |
| 19 |
MidLeft() string // Left junction |
| 20 |
MidRight() string // Right junction |
| 21 |
BottomLeft() string // LevelFooter-left corner |
| 22 |
BottomMid() string // LevelFooter junction |
| 23 |
BottomRight() string // LevelFooter-right corner |
| 24 |
|
| 25 |
// Optional header-specific symbols |
| 26 |
HeaderLeft() string |
| 27 |
HeaderMid() string |
| 28 |
HeaderRight() string |
| 29 |
} |
| 30 |
|
| 31 |
// BorderStyle defines different border styling options |
| 32 |
type BorderStyle int |
| 33 |
|
| 34 |
// Border style constants |
| 35 |
const ( |
| 36 |
StyleNone BorderStyle = iota |
| 37 |
StyleASCII |
| 38 |
StyleLight |
| 39 |
StyleHeavy |
| 40 |
StyleDouble |
| 41 |
StyleDoubleLong |
| 42 |
StyleLightHeavy |
| 43 |
StyleHeavyLight |
| 44 |
StyleLightDouble |
| 45 |
StyleDoubleLight |
| 46 |
StyleRounded |
| 47 |
StyleMarkdown |
| 48 |
StyleGraphical |
| 49 |
StyleMerger |
| 50 |
StyleDefault |
| 51 |
StyleDotted |
| 52 |
StyleArrow |
| 53 |
StyleStarry |
| 54 |
StyleHearts |
| 55 |
StyleCircuit // Renamed from StyleTech |
| 56 |
StyleNature |
| 57 |
StyleArtistic |
| 58 |
Style8Bit |
| 59 |
StyleChaos |
| 60 |
StyleDots |
| 61 |
StyleBlocks |
| 62 |
StyleZen |
| 63 |
StyleVintage |
| 64 |
StyleSketch |
| 65 |
StyleArrowDouble |
| 66 |
StyleCelestial |
| 67 |
StyleCyber |
| 68 |
StyleRunic |
| 69 |
StyleIndustrial |
| 70 |
StyleInk |
| 71 |
StyleArcade |
| 72 |
StyleBlossom |
| 73 |
StyleFrosted |
| 74 |
StyleMosaic |
| 75 |
StyleUFO |
| 76 |
StyleSteampunk |
| 77 |
StyleGalaxy |
| 78 |
StyleJazz |
| 79 |
StylePuzzle |
| 80 |
StyleHypno |
| 81 |
) |
| 82 |
|
| 83 |
// StyleName defines names for border styles |
| 84 |
type StyleName string |
| 85 |
|
| 86 |
func (s StyleName) String() string { |
| 87 |
return string(s) |
| 88 |
} |
| 89 |
|
| 90 |
const ( |
| 91 |
StyleNameNothing StyleName = "nothing" |
| 92 |
StyleNameASCII StyleName = "ascii" |
| 93 |
StyleNameLight StyleName = "light" |
| 94 |
StyleNameHeavy StyleName = "heavy" |
| 95 |
StyleNameDouble StyleName = "double" |
| 96 |
StyleNameDoubleLong StyleName = "doublelong" |
| 97 |
StyleNameLightHeavy StyleName = "lightheavy" |
| 98 |
StyleNameHeavyLight StyleName = "heavylight" |
| 99 |
StyleNameLightDouble StyleName = "lightdouble" |
| 100 |
StyleNameDoubleLight StyleName = "doublelight" |
| 101 |
StyleNameRounded StyleName = "rounded" |
| 102 |
StyleNameMarkdown StyleName = "markdown" |
| 103 |
StyleNameGraphical StyleName = "graphical" |
| 104 |
StyleNameMerger StyleName = "merger" |
| 105 |
StyleNameDotted StyleName = "dotted" |
| 106 |
StyleNameArrow StyleName = "arrow" |
| 107 |
StyleNameStarry StyleName = "starry" |
| 108 |
StyleNameHearts StyleName = "hearts" |
| 109 |
StyleNameCircuit StyleName = "circuit" // Renamed from Tech |
| 110 |
StyleNameNature StyleName = "nature" |
| 111 |
StyleNameArtistic StyleName = "artistic" |
| 112 |
StyleName8Bit StyleName = "8bit" |
| 113 |
StyleNameChaos StyleName = "chaos" |
| 114 |
StyleNameDots StyleName = "dots" |
| 115 |
StyleNameBlocks StyleName = "blocks" |
| 116 |
StyleNameZen StyleName = "zen" |
| 117 |
StyleNameVintage StyleName = "vintage" |
| 118 |
StyleNameSketch StyleName = "sketch" |
| 119 |
StyleNameArrowDouble StyleName = "arrowdouble" |
| 120 |
StyleNameCelestial StyleName = "celestial" |
| 121 |
StyleNameCyber StyleName = "cyber" |
| 122 |
StyleNameRunic StyleName = "runic" |
| 123 |
StyleNameIndustrial StyleName = "industrial" |
| 124 |
StyleNameInk StyleName = "ink" |
| 125 |
StyleNameArcade StyleName = "arcade" |
| 126 |
StyleNameBlossom StyleName = "blossom" |
| 127 |
StyleNameFrosted StyleName = "frosted" |
| 128 |
StyleNameMosaic StyleName = "mosaic" |
| 129 |
StyleNameUFO StyleName = "ufo" |
| 130 |
StyleNameSteampunk StyleName = "steampunk" |
| 131 |
StyleNameGalaxy StyleName = "galaxy" |
| 132 |
StyleNameJazz StyleName = "jazz" |
| 133 |
StyleNamePuzzle StyleName = "puzzle" |
| 134 |
StyleNameHypno StyleName = "hypno" |
| 135 |
) |
| 136 |
|
| 137 |
// Styles maps BorderStyle to StyleName |
| 138 |
var Styles = map[BorderStyle]StyleName{ |
| 139 |
StyleNone: StyleNameNothing, |
| 140 |
StyleASCII: StyleNameASCII, |
| 141 |
StyleLight: StyleNameLight, |
| 142 |
StyleHeavy: StyleNameHeavy, |
| 143 |
StyleDouble: StyleNameDouble, |
| 144 |
StyleDoubleLong: StyleNameDoubleLong, |
| 145 |
StyleLightHeavy: StyleNameLightHeavy, |
| 146 |
StyleHeavyLight: StyleNameHeavyLight, |
| 147 |
StyleLightDouble: StyleNameLightDouble, |
| 148 |
StyleDoubleLight: StyleNameDoubleLight, |
| 149 |
StyleRounded: StyleNameRounded, |
| 150 |
StyleMarkdown: StyleNameMarkdown, |
| 151 |
StyleGraphical: StyleNameGraphical, |
| 152 |
StyleMerger: StyleNameMerger, |
| 153 |
StyleDefault: StyleNameLight, |
| 154 |
StyleDotted: StyleNameDotted, |
| 155 |
StyleArrow: StyleNameArrow, |
| 156 |
StyleStarry: StyleNameStarry, |
| 157 |
StyleHearts: StyleNameHearts, |
| 158 |
StyleCircuit: StyleNameCircuit, |
| 159 |
StyleNature: StyleNameNature, |
| 160 |
StyleArtistic: StyleNameArtistic, |
| 161 |
Style8Bit: StyleName8Bit, |
| 162 |
StyleChaos: StyleNameChaos, |
| 163 |
StyleDots: StyleNameDots, |
| 164 |
StyleBlocks: StyleNameBlocks, |
| 165 |
StyleZen: StyleNameZen, |
| 166 |
StyleVintage: StyleNameVintage, |
| 167 |
StyleSketch: StyleNameSketch, |
| 168 |
StyleArrowDouble: StyleNameArrowDouble, |
| 169 |
StyleCelestial: StyleNameCelestial, |
| 170 |
StyleCyber: StyleNameCyber, |
| 171 |
StyleRunic: StyleNameRunic, |
| 172 |
StyleIndustrial: StyleNameIndustrial, |
| 173 |
StyleInk: StyleNameInk, |
| 174 |
StyleArcade: StyleNameArcade, |
| 175 |
StyleBlossom: StyleNameBlossom, |
| 176 |
StyleFrosted: StyleNameFrosted, |
| 177 |
StyleMosaic: StyleNameMosaic, |
| 178 |
StyleUFO: StyleNameUFO, |
| 179 |
StyleSteampunk: StyleNameSteampunk, |
| 180 |
StyleGalaxy: StyleNameGalaxy, |
| 181 |
StyleJazz: StyleNameJazz, |
| 182 |
StylePuzzle: StyleNamePuzzle, |
| 183 |
StyleHypno: StyleNameHypno, |
| 184 |
} |
| 185 |
|
| 186 |
// String returns the string representation of a border style |
| 187 |
func (s BorderStyle) String() string { |
| 188 |
return [...]string{ |
| 189 |
"None", |
| 190 |
"ASCII", |
| 191 |
"Light", |
| 192 |
"Heavy", |
| 193 |
"Double", |
| 194 |
"DoubleLong", |
| 195 |
"LightHeavy", |
| 196 |
"HeavyLight", |
| 197 |
"LightDouble", |
| 198 |
"DoubleLight", |
| 199 |
"Rounded", |
| 200 |
"Markdown", |
| 201 |
"Graphical", |
| 202 |
"Merger", |
| 203 |
"Default", |
| 204 |
"Dotted", |
| 205 |
"Arrow", |
| 206 |
"Starry", |
| 207 |
"Hearts", |
| 208 |
"Circuit", |
| 209 |
"Nature", |
| 210 |
"Artistic", |
| 211 |
"8Bit", |
| 212 |
"Chaos", |
| 213 |
"Dots", |
| 214 |
"Blocks", |
| 215 |
"Zen", |
| 216 |
"Vintage", |
| 217 |
"Sketch", |
| 218 |
"ArrowDouble", |
| 219 |
"Celestial", |
| 220 |
"Cyber", |
| 221 |
"Runic", |
| 222 |
"Industrial", |
| 223 |
"Ink", |
| 224 |
"Arcade", |
| 225 |
"Blossom", |
| 226 |
"Frosted", |
| 227 |
"Mosaic", |
| 228 |
"UFO", |
| 229 |
"Steampunk", |
| 230 |
"Galaxy", |
| 231 |
"Jazz", |
| 232 |
"Puzzle", |
| 233 |
"Hypno", |
| 234 |
}[s] |
| 235 |
} |
| 236 |
|
| 237 |
// NewSymbols creates a new Symbols instance with the specified style |
| 238 |
func NewSymbols(style BorderStyle) Symbols { |
| 239 |
switch style { |
| 240 |
case StyleASCII: |
| 241 |
return &Glyphs{ |
| 242 |
name: StyleNameASCII, |
| 243 |
row: "-", |
| 244 |
column: "|", |
| 245 |
center: "+", |
| 246 |
corners: [9]string{ |
| 247 |
"+", "+", "+", |
| 248 |
"+", "+", "+", |
| 249 |
"+", "+", "+", |
| 250 |
}, |
| 251 |
headerLeft: "+", |
| 252 |
headerMid: "+", |
| 253 |
headerRight: "+", |
| 254 |
} |
| 255 |
case StyleLight, StyleDefault: |
| 256 |
return &Glyphs{ |
| 257 |
name: StyleNameLight, |
| 258 |
row: "─", |
| 259 |
column: "│", |
| 260 |
center: "┼", |
| 261 |
corners: [9]string{ |
| 262 |
"┌", "┬", "┐", |
| 263 |
"├", "┼", "┤", |
| 264 |
"└", "┴", "┘", |
| 265 |
}, |
| 266 |
headerLeft: "├", |
| 267 |
headerMid: "┼", |
| 268 |
headerRight: "┤", |
| 269 |
} |
| 270 |
case StyleHeavy: |
| 271 |
return &Glyphs{ |
| 272 |
name: StyleNameHeavy, |
| 273 |
row: "━", |
| 274 |
column: "┃", |
| 275 |
center: "╋", |
| 276 |
corners: [9]string{ |
| 277 |
"┏", "┳", "┓", |
| 278 |
"┣", "╋", "┫", |
| 279 |
"┗", "┻", "┛", |
| 280 |
}, |
| 281 |
headerLeft: "┣", |
| 282 |
headerMid: "╋", |
| 283 |
headerRight: "┫", |
| 284 |
} |
| 285 |
case StyleDouble: |
| 286 |
return &Glyphs{ |
| 287 |
name: StyleNameDouble, |
| 288 |
row: "═", |
| 289 |
column: "║", |
| 290 |
center: "╬", |
| 291 |
corners: [9]string{ |
| 292 |
"╔", "╦", "╗", |
| 293 |
"╠", "╬", "╣", |
| 294 |
"╚", "╩", "╝", |
| 295 |
}, |
| 296 |
headerLeft: "╠", |
| 297 |
headerMid: "╬", |
| 298 |
headerRight: "╣", |
| 299 |
} |
| 300 |
case StyleDoubleLong: |
| 301 |
return &Glyphs{ |
| 302 |
name: StyleNameDoubleLong, |
| 303 |
row: "═╡═", |
| 304 |
column: "╞", |
| 305 |
center: "╪", |
| 306 |
corners: [9]string{ |
| 307 |
"╔═╡", "═╤═", "╡═╗", |
| 308 |
"╟ ", "╪ ", " ╢", |
| 309 |
"╚═╡", "═╧═", "╡═╝", |
| 310 |
}, |
| 311 |
headerLeft: "╟═╡", |
| 312 |
headerMid: "╪═╡", |
| 313 |
headerRight: "╡═╢", |
| 314 |
} |
| 315 |
case StyleLightHeavy: |
| 316 |
return &Glyphs{ |
| 317 |
name: StyleNameLightHeavy, |
| 318 |
row: "─", |
| 319 |
column: "┃", |
| 320 |
center: "╂", |
| 321 |
corners: [9]string{ |
| 322 |
"┍", "┯", "┑", |
| 323 |
"┝", "╂", "┥", |
| 324 |
"┕", "┷", "┙", |
| 325 |
}, |
| 326 |
headerLeft: "┝", |
| 327 |
headerMid: "╂", |
| 328 |
headerRight: "┥", |
| 329 |
} |
| 330 |
case StyleHeavyLight: |
| 331 |
return &Glyphs{ |
| 332 |
name: StyleNameHeavyLight, |
| 333 |
row: "━", |
| 334 |
column: "│", |
| 335 |
center: "┿", |
| 336 |
corners: [9]string{ |
| 337 |
"┎", "┰", "┒", |
| 338 |
"┠", "┿", "┨", |
| 339 |
"┖", "┸", "┚", |
| 340 |
}, |
| 341 |
headerLeft: "┠", |
| 342 |
headerMid: "┿", |
| 343 |
headerRight: "┨", |
| 344 |
} |
| 345 |
case StyleLightDouble: |
| 346 |
return &Glyphs{ |
| 347 |
name: StyleNameLightDouble, |
| 348 |
row: "─", |
| 349 |
column: "║", |
| 350 |
center: "╫", |
| 351 |
corners: [9]string{ |
| 352 |
"╓", "╥", "╖", |
| 353 |
"╟", "╫", "╢", |
| 354 |
"╙", "╨", "╜", |
| 355 |
}, |
| 356 |
headerLeft: "╟", |
| 357 |
headerMid: "╫", |
| 358 |
headerRight: "╢", |
| 359 |
} |
| 360 |
case StyleDoubleLight: |
| 361 |
return &Glyphs{ |
| 362 |
name: StyleNameDoubleLight, |
| 363 |
row: "═", |
| 364 |
column: "│", |
| 365 |
center: "╪", |
| 366 |
corners: [9]string{ |
| 367 |
"╒", "╤", "╕", |
| 368 |
"╞", "╪", "╡", |
| 369 |
"╘", "╧", "╛", |
| 370 |
}, |
| 371 |
headerLeft: "╞", |
| 372 |
headerMid: "╪", |
| 373 |
headerRight: "╡", |
| 374 |
} |
| 375 |
case StyleRounded: |
| 376 |
return &Glyphs{ |
| 377 |
name: StyleNameRounded, |
| 378 |
row: "─", |
| 379 |
column: "│", |
| 380 |
center: "┼", |
| 381 |
corners: [9]string{ |
| 382 |
"╭", "┬", "╮", |
| 383 |
"├", "┼", "┤", |
| 384 |
"╰", "┴", "╯", |
| 385 |
}, |
| 386 |
headerLeft: "├", |
| 387 |
headerMid: "┼", |
| 388 |
headerRight: "┤", |
| 389 |
} |
| 390 |
case StyleMarkdown: |
| 391 |
return &Glyphs{ |
| 392 |
name: StyleNameMarkdown, |
| 393 |
row: "-", |
| 394 |
column: "|", |
| 395 |
center: "|", |
| 396 |
corners: [9]string{ |
| 397 |
"", "", "", |
| 398 |
"|", "|", "|", |
| 399 |
"", "", "", |
| 400 |
}, |
| 401 |
headerLeft: "|", |
| 402 |
headerMid: "|", |
| 403 |
headerRight: "|", |
| 404 |
} |
| 405 |
case StyleGraphical: |
| 406 |
return &Glyphs{ |
| 407 |
name: StyleNameGraphical, |
| 408 |
row: "┄┄", |
| 409 |
column: "┆", |
| 410 |
center: "╂", |
| 411 |
corners: [9]string{ |
| 412 |
"┌┄", "┄┄", "┄┐", |
| 413 |
"┆ ", "╂ ", " ┆", |
| 414 |
"└┄", "┄┄", "┄┘", |
| 415 |
}, |
| 416 |
headerLeft: "├┄", |
| 417 |
headerMid: "╂┄", |
| 418 |
headerRight: "┄┤", |
| 419 |
} |
| 420 |
case StyleMerger: |
| 421 |
return &Glyphs{ |
| 422 |
name: StyleNameMerger, |
| 423 |
row: "─", |
| 424 |
column: "│", |
| 425 |
center: "+", |
| 426 |
corners: [9]string{ |
| 427 |
"┌", "┬", "┐", |
| 428 |
"├", "┼", "┤", |
| 429 |
"└", "┴", "┘", |
| 430 |
}, |
| 431 |
headerLeft: "├", |
| 432 |
headerMid: "+", |
| 433 |
headerRight: "┤", |
| 434 |
} |
| 435 |
case StyleDotted: |
| 436 |
return &Glyphs{ |
| 437 |
name: StyleNameDotted, |
| 438 |
row: "·", |
| 439 |
column: ":", |
| 440 |
center: "+", |
| 441 |
corners: [9]string{ |
| 442 |
".", "·", ".", |
| 443 |
":", "+", ":", |
| 444 |
"'", "·", "'", |
| 445 |
}, |
| 446 |
headerLeft: ":", |
| 447 |
headerMid: "+", |
| 448 |
headerRight: ":", |
| 449 |
} |
| 450 |
case StyleArrow: |
| 451 |
return &Glyphs{ |
| 452 |
name: StyleNameArrow, |
| 453 |
row: "→", |
| 454 |
column: "↓", |
| 455 |
center: "↔", |
| 456 |
corners: [9]string{ |
| 457 |
"↗", "↑", "↖", |
| 458 |
"→", "↔", "←", |
| 459 |
"↘", "↓", "↙", |
| 460 |
}, |
| 461 |
headerLeft: "→", |
| 462 |
headerMid: "↔", |
| 463 |
headerRight: "←", |
| 464 |
} |
| 465 |
case StyleStarry: |
| 466 |
return &Glyphs{ |
| 467 |
name: StyleNameStarry, |
| 468 |
row: "★", |
| 469 |
column: "☆", |
| 470 |
center: "✶", |
| 471 |
corners: [9]string{ |
| 472 |
"✧", "✯", "✧", |
| 473 |
"✦", "✶", "✦", |
| 474 |
"✧", "✯", "✧", |
| 475 |
}, |
| 476 |
headerLeft: "✦", |
| 477 |
headerMid: "✶", |
| 478 |
headerRight: "✦", |
| 479 |
} |
| 480 |
case StyleHearts: |
| 481 |
return &Glyphs{ |
| 482 |
name: StyleNameHearts, |
| 483 |
row: "♥", |
| 484 |
column: "❤", |
| 485 |
center: "✚", |
| 486 |
corners: [9]string{ |
| 487 |
"❥", "♡", "❥", |
| 488 |
"❣", "✚", "❣", |
| 489 |
"❦", "♡", "❦", |
| 490 |
}, |
| 491 |
headerLeft: "❣", |
| 492 |
headerMid: "✚", |
| 493 |
headerRight: "❣", |
| 494 |
} |
| 495 |
case StyleCircuit: |
| 496 |
return &Glyphs{ |
| 497 |
name: StyleNameCircuit, |
| 498 |
row: "=", |
| 499 |
column: "||", |
| 500 |
center: "<>", |
| 501 |
corners: [9]string{ |
| 502 |
"/*", "##", "*/", |
| 503 |
"//", "<>", "\\", |
| 504 |
"\\*", "##", "*/", |
| 505 |
}, |
| 506 |
headerLeft: "//", |
| 507 |
headerMid: "<>", |
| 508 |
headerRight: "\\", |
| 509 |
} |
| 510 |
case StyleNature: |
| 511 |
return &Glyphs{ |
| 512 |
name: StyleNameNature, |
| 513 |
row: "~", |
| 514 |
column: "|", |
| 515 |
center: "❀", |
| 516 |
corners: [9]string{ |
| 517 |
"🌱", "🌿", "🌱", |
| 518 |
"🍃", "❀", "🍃", |
| 519 |
"🌻", "🌾", "🌻", |
| 520 |
}, |
| 521 |
headerLeft: "🍃", |
| 522 |
headerMid: "❀", |
| 523 |
headerRight: "🍃", |
| 524 |
} |
| 525 |
case StyleArtistic: |
| 526 |
return &Glyphs{ |
| 527 |
name: StyleNameArtistic, |
| 528 |
row: "▬", |
| 529 |
column: "▐", |
| 530 |
center: "⬔", |
| 531 |
corners: [9]string{ |
| 532 |
"◈", "◊", "◈", |
| 533 |
"◀", "⬔", "▶", |
| 534 |
"◭", "▣", "◮", |
| 535 |
}, |
| 536 |
headerLeft: "◀", |
| 537 |
headerMid: "⬔", |
| 538 |
headerRight: "▶", |
| 539 |
} |
| 540 |
case Style8Bit: |
| 541 |
return &Glyphs{ |
| 542 |
name: StyleName8Bit, |
| 543 |
row: "■", |
| 544 |
column: "█", |
| 545 |
center: "♦", |
| 546 |
corners: [9]string{ |
| 547 |
"╔", "▲", "╗", |
| 548 |
"◄", "♦", "►", |
| 549 |
"╚", "▼", "╝", |
| 550 |
}, |
| 551 |
headerLeft: "◄", |
| 552 |
headerMid: "♦", |
| 553 |
headerRight: "►", |
| 554 |
} |
| 555 |
case StyleChaos: |
| 556 |
return &Glyphs{ |
| 557 |
name: StyleNameChaos, |
| 558 |
row: "≈", |
| 559 |
column: "§", |
| 560 |
center: "☯", |
| 561 |
corners: [9]string{ |
| 562 |
"⌘", "∞", "⌥", |
| 563 |
"⚡", "☯", "♞", |
| 564 |
"⌂", "∆", "◊", |
| 565 |
}, |
| 566 |
headerLeft: "⚡", |
| 567 |
headerMid: "☯", |
| 568 |
headerRight: "♞", |
| 569 |
} |
| 570 |
case StyleDots: |
| 571 |
return &Glyphs{ |
| 572 |
name: StyleNameDots, |
| 573 |
row: "·", |
| 574 |
column: " ", |
| 575 |
center: "·", |
| 576 |
corners: [9]string{ |
| 577 |
"·", "·", "·", |
| 578 |
" ", "·", " ", |
| 579 |
"·", "·", "·", |
| 580 |
}, |
| 581 |
headerLeft: " ", |
| 582 |
headerMid: "·", |
| 583 |
headerRight: " ", |
| 584 |
} |
| 585 |
case StyleBlocks: |
| 586 |
return &Glyphs{ |
| 587 |
name: StyleNameBlocks, |
| 588 |
row: "▀", |
| 589 |
column: "█", |
| 590 |
center: "█", |
| 591 |
corners: [9]string{ |
| 592 |
"▛", "▀", "▜", |
| 593 |
"▌", "█", "▐", |
| 594 |
"▙", "▄", "▟", |
| 595 |
}, |
| 596 |
headerLeft: "▌", |
| 597 |
headerMid: "█", |
| 598 |
headerRight: "▐", |
| 599 |
} |
| 600 |
case StyleZen: |
| 601 |
return &Glyphs{ |
| 602 |
name: StyleNameZen, |
| 603 |
row: "~", |
| 604 |
column: " ", |
| 605 |
center: "☯", |
| 606 |
corners: [9]string{ |
| 607 |
" ", "♨", " ", |
| 608 |
" ", "☯", " ", |
| 609 |
" ", "♨", " ", |
| 610 |
}, |
| 611 |
headerLeft: " ", |
| 612 |
headerMid: "☯", |
| 613 |
headerRight: " ", |
| 614 |
} |
| 615 |
case StyleVintage: |
| 616 |
return &Glyphs{ |
| 617 |
name: StyleNameVintage, |
| 618 |
row: "────", |
| 619 |
column: " ⁜ ", |
| 620 |
center: " ✠ ", |
| 621 |
corners: [9]string{ |
| 622 |
"╔══", "══╤", "══╗", |
| 623 |
" ⁜ ", " ✠ ", " ⁜ ", |
| 624 |
"╚══", "══╧", "══╝", |
| 625 |
}, |
| 626 |
headerLeft: " ├─", |
| 627 |
headerMid: "─✠─", |
| 628 |
headerRight: "─┤ ", |
| 629 |
} |
| 630 |
case StyleSketch: |
| 631 |
return &Glyphs{ |
| 632 |
name: StyleNameSketch, |
| 633 |
row: "~~", |
| 634 |
column: "/", |
| 635 |
center: "+", |
| 636 |
corners: [9]string{ |
| 637 |
" .", "~~", ". ", |
| 638 |
"/ ", "+ ", " \\", |
| 639 |
" '", "~~", "` ", |
| 640 |
}, |
| 641 |
headerLeft: "/~", |
| 642 |
headerMid: "+~", |
| 643 |
headerRight: "~\\", |
| 644 |
} |
| 645 |
case StyleArrowDouble: |
| 646 |
return &Glyphs{ |
| 647 |
name: StyleNameArrowDouble, |
| 648 |
row: "»»", |
| 649 |
column: "⫸", |
| 650 |
center: "✿", |
| 651 |
corners: [9]string{ |
| 652 |
"⌜»", "»»", "»⌝", |
| 653 |
"⫸ ", "✿ ", " ⫷", |
| 654 |
"⌞»", "»»", "»⌟", |
| 655 |
}, |
| 656 |
headerLeft: "⫸»", |
| 657 |
headerMid: "✿»", |
| 658 |
headerRight: "»⫷", |
| 659 |
} |
| 660 |
case StyleCelestial: |
| 661 |
return &Glyphs{ |
| 662 |
name: StyleNameCelestial, |
| 663 |
row: "✦✧", |
| 664 |
column: "☽", |
| 665 |
center: "☀", |
| 666 |
corners: [9]string{ |
| 667 |
"✧✦", "✦✧", "✦✧", |
| 668 |
"☽ ", "☀ ", " ☾", |
| 669 |
"✧✦", "✦✧", "✦✧", |
| 670 |
}, |
| 671 |
headerLeft: "☽✦", |
| 672 |
headerMid: "☀✧", |
| 673 |
headerRight: "✦☾", |
| 674 |
} |
| 675 |
case StyleCyber: |
| 676 |
return &Glyphs{ |
| 677 |
name: StyleNameCyber, |
| 678 |
row: "═╦═", |
| 679 |
column: "║", |
| 680 |
center: "╬", |
| 681 |
corners: [9]string{ |
| 682 |
"╔╦═", "╦═╦", "═╦╗", |
| 683 |
"║ ", "╬ ", " ║", |
| 684 |
"╚╩═", "╩═╩", "═╩╝", |
| 685 |
}, |
| 686 |
headerLeft: "╠╦═", |
| 687 |
headerMid: "╬═╦", |
| 688 |
headerRight: "═╦╣", |
| 689 |
} |
| 690 |
case StyleRunic: |
| 691 |
return &Glyphs{ |
| 692 |
name: StyleNameRunic, |
| 693 |
row: "ᛖᛖᛖ", |
| 694 |
column: "ᛟ", |
| 695 |
center: "ᛞ", |
| 696 |
corners: [9]string{ |
| 697 |
"ᛏᛖᛖ", "ᛖᛖᛖ", "ᛖᛖᛏ", |
| 698 |
"ᛟ ", "ᛞ ", " ᛟ", |
| 699 |
"ᛗᛖᛖ", "ᛖᛖᛖ", "ᛖᛖᛗ", |
| 700 |
}, |
| 701 |
headerLeft: "ᛟᛖᛖ", |
| 702 |
headerMid: "ᛞᛖᛖ", |
| 703 |
headerRight: "ᛖᛖᛟ", |
| 704 |
} |
| 705 |
case StyleIndustrial: |
| 706 |
return &Glyphs{ |
| 707 |
name: StyleNameIndustrial, |
| 708 |
row: "━╋━", |
| 709 |
column: "┃", |
| 710 |
center: "╋", |
| 711 |
corners: [9]string{ |
| 712 |
"┏╋━", "╋━╋", "━╋┓", |
| 713 |
"┃ ", "╋ ", " ┃", |
| 714 |
"┗╋━", "╋━╋", "━╋┛", |
| 715 |
}, |
| 716 |
headerLeft: "┣╋━", |
| 717 |
headerMid: "╋━╋", |
| 718 |
headerRight: "━╋┫", |
| 719 |
} |
| 720 |
case StyleInk: |
| 721 |
return &Glyphs{ |
| 722 |
name: StyleNameInk, |
| 723 |
row: "﹌", |
| 724 |
column: "︱", |
| 725 |
center: "✒", |
| 726 |
corners: [9]string{ |
| 727 |
"﹏", "﹌", "﹏", |
| 728 |
"︱ ", "✒ ", " ︱", |
| 729 |
"﹋", "﹌", "﹋", |
| 730 |
}, |
| 731 |
headerLeft: "︱﹌", |
| 732 |
headerMid: "✒﹌", |
| 733 |
headerRight: "﹌︱", |
| 734 |
} |
| 735 |
case StyleArcade: |
| 736 |
return &Glyphs{ |
| 737 |
name: StyleNameArcade, |
| 738 |
row: "■□", |
| 739 |
column: "▐", |
| 740 |
center: "◉", |
| 741 |
corners: [9]string{ |
| 742 |
"▞■", "■□", "□▚", |
| 743 |
"▐ ", "◉ ", " ▐", |
| 744 |
"▚■", "■□", "□▞", |
| 745 |
}, |
| 746 |
headerLeft: "▐■", |
| 747 |
headerMid: "◉□", |
| 748 |
headerRight: "■▐", |
| 749 |
} |
| 750 |
case StyleBlossom: |
| 751 |
return &Glyphs{ |
| 752 |
name: StyleNameBlossom, |
| 753 |
row: "🌸", |
| 754 |
column: "🌿", |
| 755 |
center: "✿", |
| 756 |
corners: [9]string{ |
| 757 |
"🌷", "🌸", "🌷", |
| 758 |
"🌿", "✿", "🌿", |
| 759 |
"🌱", "🌸", "🌱", |
| 760 |
}, |
| 761 |
headerLeft: "🌿🌸", |
| 762 |
headerMid: "✿🌸", |
| 763 |
headerRight: "🌸🌿", |
| 764 |
} |
| 765 |
case StyleFrosted: |
| 766 |
return &Glyphs{ |
| 767 |
name: StyleNameFrosted, |
| 768 |
row: "░▒░", |
| 769 |
column: "▓", |
| 770 |
center: "◍", |
| 771 |
corners: [9]string{ |
| 772 |
"◌░▒", "░▒░", "▒░◌", |
| 773 |
"▓ ", "◍ ", " ▓", |
| 774 |
"◌░▒", "░▒░", "▒░◌", |
| 775 |
}, |
| 776 |
headerLeft: "▓░▒", |
| 777 |
headerMid: "◍▒░", |
| 778 |
headerRight: "░▒▓", |
| 779 |
} |
| 780 |
case StyleMosaic: |
| 781 |
return &Glyphs{ |
| 782 |
name: StyleNameMosaic, |
| 783 |
row: "▰▱", |
| 784 |
column: "⧉", |
| 785 |
center: "⬖", |
| 786 |
corners: [9]string{ |
| 787 |
"⧠▰", "▰▱", "▱⧠", |
| 788 |
"⧉ ", "⬖ ", " ⧉", |
| 789 |
"⧅▰", "▰▱", "▱⧅", |
| 790 |
}, |
| 791 |
headerLeft: "⧉▰", |
| 792 |
headerMid: "⬖▱", |
| 793 |
headerRight: "▰⧉", |
| 794 |
} |
| 795 |
case StyleUFO: |
| 796 |
return &Glyphs{ |
| 797 |
name: StyleNameUFO, |
| 798 |
row: "⊚⊚", |
| 799 |
column: "☽", |
| 800 |
center: "☢", |
| 801 |
corners: [9]string{ |
| 802 |
"⌖⊚", "⊚⊚", "⊚⌖", |
| 803 |
"☽ ", "☢ ", " ☽", |
| 804 |
"⌗⊚", "⊚⊚", "⊚⌗", |
| 805 |
}, |
| 806 |
headerLeft: "☽⊚", |
| 807 |
headerMid: "☢⊚", |
| 808 |
headerRight: "⊚☽", |
| 809 |
} |
| 810 |
case StyleSteampunk: |
| 811 |
return &Glyphs{ |
| 812 |
name: StyleNameSteampunk, |
| 813 |
row: "═⚙═", |
| 814 |
column: "⛓️", |
| 815 |
center: "⚔️", |
| 816 |
corners: [9]string{ |
| 817 |
"🜂⚙═", "═⚙═", "═⚙🜂", |
| 818 |
"⛓️ ", "⚔️ ", " ⛓️", |
| 819 |
"🜄⚙═", "═⚙═", "═⚙🜄", |
| 820 |
}, |
| 821 |
headerLeft: "⛓️⚙═", |
| 822 |
headerMid: "⚔️═⚙", |
| 823 |
headerRight: "═⚙⛓️", |
| 824 |
} |
| 825 |
case StyleGalaxy: |
| 826 |
return &Glyphs{ |
| 827 |
name: StyleNameGalaxy, |
| 828 |
row: "≋≋", |
| 829 |
column: "♆", |
| 830 |
center: "☄️", |
| 831 |
corners: [9]string{ |
| 832 |
"⌇≋", "≋≋", "≋⌇", |
| 833 |
"♆ ", "☄️ ", " ♆", |
| 834 |
"⌇≋", "≋≋", "≋⌇", |
| 835 |
}, |
| 836 |
headerLeft: "♆≋", |
| 837 |
headerMid: "☄️≋", |
| 838 |
headerRight: "≋♆", |
| 839 |
} |
| 840 |
case StyleJazz: |
| 841 |
return &Glyphs{ |
| 842 |
name: StyleNameJazz, |
| 843 |
row: "♬♬", |
| 844 |
column: "▷", |
| 845 |
center: "★", |
| 846 |
corners: [9]string{ |
| 847 |
"♔♬", "♬♬", "♬♔", |
| 848 |
"▷ ", "★ ", " ◁", |
| 849 |
"♕♬", "♬♬", "♬♕", |
| 850 |
}, |
| 851 |
headerLeft: "▷♬", |
| 852 |
headerMid: "★♬", |
| 853 |
headerRight: "♬◁", |
| 854 |
} |
| 855 |
case StylePuzzle: |
| 856 |
return &Glyphs{ |
| 857 |
name: StyleNamePuzzle, |
| 858 |
row: "▣▣", |
| 859 |
column: "◫", |
| 860 |
center: "✚", |
| 861 |
corners: [9]string{ |
| 862 |
"◩▣", "▣▣", "▣◪", |
| 863 |
"◫ ", "✚ ", " ◫", |
| 864 |
"◧▣", "▣▣", "▣◨", |
| 865 |
}, |
| 866 |
headerLeft: "◫▣", |
| 867 |
headerMid: "✚▣", |
| 868 |
headerRight: "▣◫", |
| 869 |
} |
| 870 |
case StyleHypno: |
| 871 |
return &Glyphs{ |
| 872 |
name: StyleNameHypno, |
| 873 |
row: "◜◝", |
| 874 |
column: "꩜", |
| 875 |
center: "⃰", |
| 876 |
corners: [9]string{ |
| 877 |
"◟◜", "◜◝", "◝◞", |
| 878 |
"꩜ ", "⃰ ", " ꩜", |
| 879 |
"◟◜", "◜◝", "◝◞", |
| 880 |
}, |
| 881 |
headerLeft: "꩜◜", |
| 882 |
headerMid: "⃰◝", |
| 883 |
headerRight: "◜꩜", |
| 884 |
} |
| 885 |
default: |
| 886 |
return &Glyphs{ |
| 887 |
name: StyleNameNothing, |
| 888 |
row: "", |
| 889 |
column: "", |
| 890 |
center: "", |
| 891 |
corners: [9]string{ |
| 892 |
"", "", "", |
| 893 |
"", "", "", |
| 894 |
"", "", "", |
| 895 |
}, |
| 896 |
headerLeft: "", |
| 897 |
headerMid: "", |
| 898 |
headerRight: "", |
| 899 |
} |
| 900 |
} |
| 901 |
} |
| 902 |
|
| 903 |
// SymbolCustom implements the Symbols interface with fully configurable symbols |
| 904 |
type SymbolCustom struct { |
| 905 |
name string |
| 906 |
center string |
| 907 |
row string |
| 908 |
column string |
| 909 |
topLeft string |
| 910 |
topMid string |
| 911 |
topRight string |
| 912 |
midLeft string |
| 913 |
midRight string |
| 914 |
bottomLeft string |
| 915 |
bottomMid string |
| 916 |
bottomRight string |
| 917 |
headerLeft string |
| 918 |
headerMid string |
| 919 |
headerRight string |
| 920 |
} |
| 921 |
|
| 922 |
// NewSymbolCustom creates a new customizable border style |
| 923 |
func NewSymbolCustom(name string) *SymbolCustom { |
| 924 |
return &SymbolCustom{ |
| 925 |
name: name, |
| 926 |
center: "+", |
| 927 |
row: "-", |
| 928 |
column: "|", |
| 929 |
} |
| 930 |
} |
| 931 |
|
| 932 |
// Implement all Symbols interface methods |
| 933 |
func (c *SymbolCustom) Name() string { return c.name } |
| 934 |
func (c *SymbolCustom) Center() string { return c.center } |
| 935 |
func (c *SymbolCustom) Row() string { return c.row } |
| 936 |
func (c *SymbolCustom) Column() string { return c.column } |
| 937 |
func (c *SymbolCustom) TopLeft() string { return c.topLeft } |
| 938 |
func (c *SymbolCustom) TopMid() string { return c.topMid } |
| 939 |
func (c *SymbolCustom) TopRight() string { return c.topRight } |
| 940 |
func (c *SymbolCustom) MidLeft() string { return c.midLeft } |
| 941 |
func (c *SymbolCustom) MidRight() string { return c.midRight } |
| 942 |
func (c *SymbolCustom) BottomLeft() string { return c.bottomLeft } |
| 943 |
func (c *SymbolCustom) BottomMid() string { return c.bottomMid } |
| 944 |
func (c *SymbolCustom) BottomRight() string { return c.bottomRight } |
| 945 |
func (c *SymbolCustom) HeaderLeft() string { return c.headerLeft } |
| 946 |
func (c *SymbolCustom) HeaderMid() string { return c.headerMid } |
| 947 |
func (c *SymbolCustom) HeaderRight() string { return c.headerRight } |
| 948 |
|
| 949 |
// Builder methods for fluent configuration |
| 950 |
func (c *SymbolCustom) WithCenter(s string) *SymbolCustom { c.center = s; return c } |
| 951 |
func (c *SymbolCustom) WithRow(s string) *SymbolCustom { c.row = s; return c } |
| 952 |
func (c *SymbolCustom) WithColumn(s string) *SymbolCustom { c.column = s; return c } |
| 953 |
func (c *SymbolCustom) WithTopLeft(s string) *SymbolCustom { c.topLeft = s; return c } |
| 954 |
func (c *SymbolCustom) WithTopMid(s string) *SymbolCustom { c.topMid = s; return c } |
| 955 |
func (c *SymbolCustom) WithTopRight(s string) *SymbolCustom { c.topRight = s; return c } |
| 956 |
func (c *SymbolCustom) WithMidLeft(s string) *SymbolCustom { c.midLeft = s; return c } |
| 957 |
func (c *SymbolCustom) WithMidRight(s string) *SymbolCustom { c.midRight = s; return c } |
| 958 |
func (c *SymbolCustom) WithBottomLeft(s string) *SymbolCustom { c.bottomLeft = s; return c } |
| 959 |
func (c *SymbolCustom) WithBottomMid(s string) *SymbolCustom { c.bottomMid = s; return c } |
| 960 |
func (c *SymbolCustom) WithBottomRight(s string) *SymbolCustom { c.bottomRight = s; return c } |
| 961 |
func (c *SymbolCustom) WithHeaderLeft(s string) *SymbolCustom { c.headerLeft = s; return c } |
| 962 |
func (c *SymbolCustom) WithHeaderMid(s string) *SymbolCustom { c.headerMid = s; return c } |
| 963 |
func (c *SymbolCustom) WithHeaderRight(s string) *SymbolCustom { c.headerRight = s; return c } |
| 964 |
|
| 965 |
// Preview renders a small sample table to visualize the border style |
| 966 |
func (s *SymbolCustom) Preview() string { |
| 967 |
return fmt.Sprintf( |
| 968 |
"%s%s%s\n%s %s %s\n%s%s%s", |
| 969 |
s.TopLeft(), s.Row(), s.TopRight(), |
| 970 |
s.Column(), s.Center(), s.Column(), |
| 971 |
s.BottomLeft(), s.Row(), s.BottomRight(), |
| 972 |
) |
| 973 |
} |
| 974 |
|
| 975 |
// Glyphs provides fully independent border symbols with a corners array |
| 976 |
type Glyphs struct { |
| 977 |
name StyleName |
| 978 |
row string |
| 979 |
column string |
| 980 |
center string |
| 981 |
corners [9]string // [TopLeft, TopMid, TopRight, MidLeft, Center, MidRight, BottomLeft, BottomMid, BottomRight] |
| 982 |
headerLeft string |
| 983 |
headerMid string |
| 984 |
headerRight string |
| 985 |
} |
| 986 |
|
| 987 |
// Glyphs symbol methods |
| 988 |
func (s *Glyphs) Name() string { return s.name.String() } |
| 989 |
func (s *Glyphs) Center() string { return s.center } |
| 990 |
func (s *Glyphs) Row() string { return s.row } |
| 991 |
func (s *Glyphs) Column() string { return s.column } |
| 992 |
func (s *Glyphs) TopLeft() string { return s.corners[0] } |
| 993 |
func (s *Glyphs) TopMid() string { return s.corners[1] } |
| 994 |
func (s *Glyphs) TopRight() string { return s.corners[2] } |
| 995 |
func (s *Glyphs) MidLeft() string { return s.corners[3] } |
| 996 |
func (s *Glyphs) MidRight() string { return s.corners[5] } |
| 997 |
func (s *Glyphs) BottomLeft() string { return s.corners[6] } |
| 998 |
func (s *Glyphs) BottomMid() string { return s.corners[7] } |
| 999 |
func (s *Glyphs) BottomRight() string { return s.corners[8] } |
| 1000 |
func (s *Glyphs) HeaderLeft() string { return s.headerLeft } |
| 1001 |
func (s *Glyphs) HeaderMid() string { return s.headerMid } |
| 1002 |
func (s *Glyphs) HeaderRight() string { return s.headerRight } |
| 1003 |
|
| 1004 |
// Preview renders a small sample table to visualize the border style |
| 1005 |
func (s *Glyphs) Preview() string { |
| 1006 |
return fmt.Sprintf( |
| 1007 |
"%s%s%s\n%s %s %s\n%s%s%s", |
| 1008 |
s.TopLeft(), s.Row(), s.TopRight(), |
| 1009 |
s.Column(), s.Center(), s.Column(), |
| 1010 |
s.BottomLeft(), s.Row(), s.BottomRight(), |
| 1011 |
) |
| 1012 |
} |