| 1 | #[cfg(all(feature = "tty", not(feature = "reexport_crossterm")))] |
| 2 | mod attribute; |
| 3 | mod cell; |
| 4 | #[cfg(all(feature = "tty", not(feature = "reexport_crossterm")))] |
| 5 | mod color; |
| 6 | mod column; |
| 7 | /// Contains modifiers, that can be used to alter certain parts of a preset.\ |
| 8 | /// For instance, the [UTF8_ROUND_CORNERS](modifiers::UTF8_ROUND_CORNERS) replaces all corners with |
| 9 | /// round UTF8 box corners. |
| 10 | pub mod modifiers; |
| 11 | /// This module provides styling presets for tables.\ |
| 12 | /// Every preset has an example preview. |
| 13 | pub mod presets; |
| 14 | mod table; |
| 15 | |
| 16 | pub use cell::CellAlignment; |
| 17 | pub use column::{ColumnConstraint, Width}; |
| 18 | #[cfg(feature = "tty")] |
| 19 | pub use styling_enums::{Attribute, Color}; |
| 20 | #[cfg(feature = "tty")] |
| 21 | pub(crate) use styling_enums::{map_attribute, map_color}; |
| 22 | pub use table::{ContentArrangement, TableComponent}; |
| 23 | |
| 24 | /// Convenience module to have cleaner and "identical" conditional re-exports for style enums. |
| 25 | #[cfg(all(feature = "tty", not(feature = "reexport_crossterm")))] |
| 26 | mod styling_enums { |
| 27 | pub use super::{attribute::*, color::*}; |
| 28 | } |
| 29 | |
| 30 | /// Re-export the crossterm type directly instead of using the internal mirrored types. |
| 31 | /// This result in possible ABI incompatibilities when using comfy_table and crossterm in the same |
| 32 | /// project with different versions, but may also be very convenient for developers. |
| 33 | #[cfg(all(feature = "tty", feature = "reexport_crossterm"))] |
| 34 | mod styling_enums { |
| 35 | /// Attributes used for styling cell content. Reexport of crossterm's |
| 36 | /// [Attributes](crossterm::style::Attribute) enum. |
| 37 | pub use crossterm::style::Attribute; |
| 38 | /// Colors used for styling cell content. Reexport of crossterm's |
| 39 | /// [Color](crossterm::style::Color) enum. |
| 40 | pub use crossterm::style::Color; |
| 41 | |
| 42 | /// Convenience function to have the same mapping code for reexported types. |
| 43 | #[inline] |
| 44 | pub(crate) fn map_attribute(attribute: Attribute) -> Attribute { |
| 45 | attribute |
| 46 | } |
| 47 | |
| 48 | /// Convenience function to have the same mapping code for reexported types. |
| 49 | #[inline] |
| 50 | pub(crate) fn map_color(color: Color) -> Color { |
| 51 | color |
| 52 | } |
| 53 | } |