# cjm-fasthtml-tailwind
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
## Install
``` bash
pip install cjm-fasthtml-tailwind
```
## Project Structure
nbs/
├── builders/ (2)
│ ├── colors.ipynb # Color system builders for Tailwind CSS utilities
│ └── scales.ipynb # Numeric and named scale builders for Tailwind CSS utilities
├── cli/ (10)
│ ├── core_utils_discovery.ipynb # Functions to discover and display core utility functions like combine_classes:
│ ├── example_discovery.ipynb # Functions to discover and extract test example functions:
│ ├── explorer.ipynb # CLI tool for API exploration of cjm-fasthtml-tailwind utilities
│ ├── factory_extraction.ipynb # Functions to extract BaseFactory instances from modules:
│ ├── helper_discovery.ipynb # Functions to discover and extract helper functions:
│ ├── imports.ipynb # Functions for getting import statements.
│ ├── pattern_scanner.ipynb # Scan Python code for replaceable CSS class patterns
│ ├── search.ipynb # Functions to search across all library components:
│ ├── test_code.ipynb # Functions to test code snippets using the library:
│ └── utils.ipynb # Utility functions for CLI tools
├── core/ (3)
│ ├── base.ipynb # Base classes, types, and protocols for Tailwind CSS abstractions
│ ├── resources.ipynb # CDN resources and headers for Tailwind CSS
│ └── testing.ipynb # Standardized test page creation for Jupyter notebooks with FastHTML
└── utilities/ (15)
├── accessibility.ipynb # Accessibility utilities for Tailwind CSS
├── backgrounds.ipynb # Background utilities for Tailwind CSS
├── borders.ipynb # Border utilities for Tailwind CSS
├── effects.ipynb # Shadow, opacity and other visual effect utilities for Tailwind CSS
├── filters.ipynb # Filter utilities for Tailwind CSS
├── flexbox_and_grid.ipynb # Flexbox and CSS Grid utilities for Tailwind CSS
├── interactivity.ipynb # Interactivity utilities for Tailwind CSS
├── layout.ipynb # Display, position, overflow, z-index and other layout utilities for Tailwind CSS
├── sizing.ipynb # Width, height, and min/max sizing utilities for Tailwind CSS
├── spacing.ipynb # Padding and margin utilities for Tailwind CSS
├── svg.ipynb # SVG utilities for Tailwind CSS
├── tables.ipynb # Table utilities for Tailwind CSS
├── transforms.ipynb # Transform, rotate, scale, skew, translate and other transformation utilities for Tailwind CSS
├── transitions_and_animation.ipynb # Transition and animation utilities for Tailwind CSS
└── typography.ipynb # Typography utilities for Tailwind CSS
Total: 30 notebooks across 4 directories
## Module Dependencies
``` mermaid
graph LR
builders_colors[builders.colors<br/>colors]
builders_scales[builders.scales<br/>scales]
cli_core_utils_discovery[cli.core_utils_discovery<br/>Core Utilities Discovery]
cli_example_discovery[cli.example_discovery<br/>Example Discovery]
cli_explorer[cli.explorer<br/>explorer]
cli_factory_extraction[cli.factory_extraction<br/>Factory Extraction]
cli_helper_discovery[cli.helper_discovery<br/>Helper Function Discovery]
cli_imports[cli.imports<br/>imports]
cli_pattern_scanner[cli.pattern_scanner<br/>pattern_scanner]
cli_search[cli.search<br/>Search Functions]
cli_test_code[cli.test_code<br/>Test Code Functionality]
cli_utils[cli.utils<br/>utils]
core_base[core.base<br/>base]
core_resources[core.resources<br/>resources]
core_testing[core.testing<br/>testing]
utilities_accessibility[utilities.accessibility<br/>accessibility]
utilities_backgrounds[utilities.backgrounds<br/>backgrounds]
utilities_borders[utilities.borders<br/>borders]
utilities_effects[utilities.effects<br/>effects]
utilities_filters[utilities.filters<br/>filters]
utilities_flexbox_and_grid[utilities.flexbox_and_grid<br/>flexbox_and_grid]
utilities_interactivity[utilities.interactivity<br/>interactivity]
utilities_layout[utilities.layout<br/>layout]
utilities_sizing[utilities.sizing<br/>sizing]
utilities_spacing[utilities.spacing<br/>spacing]
utilities_svg[utilities.svg<br/>svg]
utilities_tables[utilities.tables<br/>tables]
utilities_transforms[utilities.transforms<br/>transforms]
utilities_transitions_and_animation[utilities.transitions_and_animation<br/>transitions_and_animation]
utilities_typography[utilities.typography<br/>typography]
builders_colors --> core_base
builders_scales --> core_base
cli_example_discovery --> cli_utils
cli_explorer --> cli_utils
cli_explorer --> cli_test_code
cli_explorer --> cli_factory_extraction
cli_explorer --> cli_pattern_scanner
cli_explorer --> cli_helper_discovery
cli_explorer --> cli_core_utils_discovery
cli_explorer --> cli_example_discovery
cli_explorer --> cli_search
cli_explorer --> cli_imports
cli_factory_extraction --> cli_utils
cli_factory_extraction --> core_base
cli_helper_discovery --> cli_utils
cli_helper_discovery --> cli_example_discovery
cli_imports --> cli_factory_extraction
cli_imports --> cli_core_utils_discovery
cli_imports --> cli_helper_discovery
cli_imports --> cli_utils
cli_search --> cli_utils
cli_search --> cli_example_discovery
cli_search --> cli_factory_extraction
cli_search --> cli_helper_discovery
cli_test_code --> cli_factory_extraction
cli_test_code --> cli_utils
cli_test_code --> cli_helper_discovery
core_testing --> utilities_flexbox_and_grid
core_testing --> utilities_borders
core_testing --> utilities_transitions_and_animation
core_testing --> utilities_sizing
core_testing --> utilities_backgrounds
core_testing --> utilities_layout
core_testing --> utilities_effects
core_testing --> core_resources
core_testing --> core_base
core_testing --> utilities_spacing
core_testing --> utilities_typography
utilities_accessibility --> builders_scales
utilities_accessibility --> utilities_layout
utilities_accessibility --> core_base
utilities_backgrounds --> core_base
utilities_backgrounds --> builders_colors
utilities_backgrounds --> builders_scales
utilities_borders --> core_base
utilities_borders --> builders_colors
utilities_borders --> builders_scales
utilities_effects --> core_base
utilities_effects --> builders_colors
utilities_effects --> builders_scales
utilities_filters --> builders_colors
utilities_filters --> core_base
utilities_filters --> builders_scales
utilities_flexbox_and_grid --> core_base
utilities_flexbox_and_grid --> builders_scales
utilities_interactivity --> core_base
utilities_interactivity --> builders_scales
utilities_interactivity --> builders_colors
utilities_layout --> core_base
utilities_layout --> builders_scales
utilities_sizing --> builders_scales
utilities_sizing --> core_base
utilities_spacing --> builders_scales
utilities_spacing --> core_base
utilities_svg --> builders_colors
utilities_svg --> core_base
utilities_svg --> builders_scales
utilities_tables --> core_base
utilities_tables --> builders_scales
utilities_transforms --> core_base
utilities_transforms --> builders_scales
utilities_transitions_and_animation --> core_base
utilities_transitions_and_animation --> builders_scales
utilities_typography --> core_base
utilities_typography --> builders_scales
utilities_typography --> builders_colors
```
*76 cross-module dependencies detected*
## CLI Reference
### `cjm-tailwind-explore` Command
usage: cjm-tailwind-explore [-h]
{modules,factories,factory,examples,example,helpers,helper,search,test-code,core-utils,core-util,imports,scan}
...
cjm-fasthtml-tailwind CLI Explorer
This tool helps you explore the cjm-fasthtml-tailwind library, which provides:
- Python-native Tailwind CSS v4 utility class builders for FastHTML projects
- Type-safe, dynamic CSS class generation without hardcoded strings
- Comprehensive utility factories (forced_color_adjust, not_sr_only, sr_only, etc.)
- Helper functions for common patterns
- Full integration with FastHTML components
Purpose: This CLI tool enables autonomous exploration of the library's API by:
- Discovering all available utility modules and their documentation
- Listing factory instances with their built-in documentation
- Showing usage examples from test functions
- Providing source code for helper functions
- Searching across all library components
- Testing code snippets with automatic imports
- Generating recommended import statements
- Scanning existing code for replaceable CSS patterns
All information is dynamically extracted from the library itself - nothing is hardcoded.
positional arguments:
{modules,factories,factory,examples,example,helpers,helper,search,test-code,core-utils,core-util,imports,scan}
Available commands
modules List all utility modules
factories List factories
factory Show detailed info for a specific factory
examples Show usage examples
example Show source code for a specific example
helpers Show helper functions
helper Show source code for a specific helper
search Search across all library components
test-code Test code snippets using the library
core-utils List core utility functions
core-util Show source code for a core utility
imports Show recommended import statements
scan Scan code for replaceable CSS patterns
options:
-h, --help show this help message and exit
Getting Started:
1. List all modules: cjm-tailwind-explore modules
2. View factories: cjm-tailwind-explore factories
3. Search for patterns: cjm-tailwind-explore search <query>
4. Test code: cjm-tailwind-explore test-code "<code>"
5. Get imports: cjm-tailwind-explore imports
6. Scan existing code: cjm-tailwind-explore scan <file>
Exploration Workflow:
- Start with 'modules' to see available utility categories
- Use 'factories -m <module>' to explore specific modules
- Use 'factory <module> <name>' for detailed factory information
- Use 'examples' to see test-based usage patterns
- Use 'search' to find specific functionality
- Use 'test-code' to verify your understanding
- Use 'scan' to analyze existing code for migration opportunities
Key Concepts:
- Factories: Objects that generate CSS classes (e.g., forced_color_adjust, not_sr_only, sr_only)
- Modules: Categories of utilities (accessibility, backgrounds, borders, etc.)
- Examples: Test functions demonstrating usage patterns
- Helpers: Convenience functions for common patterns
Tips for Coding Assistants:
- Use 'search --include-source' to find usage patterns in code
- Use 'test-code' to validate generated code before using it
- Use 'imports' to get all necessary import statements
- Use 'scan' to identify replaceable hardcoded CSS classes
- Factory names are intuitive: forced_color_adjust, not_sr_only, sr_only
- Combine utilities with combine_classes() function
- All factories support method chaining and attribute access
Example Usage Flow:
cjm-tailwind-explore modules # See what's available
cjm-tailwind-explore factories -m accessibility # Explore accessibility utilities
cjm-tailwind-explore factory accessibility forced_color_adjust # Learn about forced_color_adjust factory
cjm-tailwind-explore example accessibility forced_color_adjust # See usage examples
cjm-tailwind-explore test-code 'print(str(forced_color_adjust.auto))' # Test your understanding
cjm-tailwind-explore scan app.py # Analyze existing code
For detailed help on any command, use
`cjm-tailwind-explore <command> --help`.
## Module Overview
Detailed documentation for each module in the project:
### accessibility (`accessibility.ipynb`)
> Accessibility utilities for Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.utilities.accessibility import (
FORCED_COLOR_ADJUST_VALUES,
forced_color_adjust,
test_accessibility_forced_color_adjust_examples,
test_accessibility_screen_reader_examples,
test_accessibility_practical_examples,
test_accessibility_factory_documentation,
visually_hidden,
high_contrast_safe,
test_accessibility_helper_examples
)
```
#### Functions
``` python
def test_accessibility_forced_color_adjust_examples(
)
"Test forced color adjust utilities."
```
``` python
def test_accessibility_screen_reader_examples(
)
"Test screen reader utilities imported from layout module."
```
``` python
def test_accessibility_practical_examples(
)
"Test accessibility utilities in practical FastHTML component examples."
```
``` python
def test_accessibility_factory_documentation(
)
"Test that factories have accessible documentation."
```
``` python
def visually_hidden(
focusable: bool = False # Whether the element should be visible when focused
) -> str: # CSS classes for hiding element visually
"""
Hide an element visually but keep it available to screen readers.
Args:
focusable: If True, element becomes visible when focused (useful for skip links)
Returns:
CSS classes for visual hiding with optional focus visibility
"""
```
``` python
def high_contrast_safe(
*classes: str # Additional CSS classes to combine
) -> str: # CSS classes including forced color adjust
"""
Create classes that work well with high contrast mode.
Args:
*classes: Additional CSS classes to include
Returns:
Combined CSS classes with forced-color-adjust-auto
"""
```
``` python
def test_accessibility_helper_examples(
)
"Test helper functions for common accessibility patterns."
```
#### Variables
``` python
FORCED_COLOR_ADJUST_VALUES = {2 items}
```
### backgrounds (`backgrounds.ipynb`)
> Background utilities for Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.utilities.backgrounds import (
bg_attachment,
bg_clip,
bg,
bg_none,
bg_linear,
bg_radial,
bg_conic,
from_color,
via_color,
to_color,
bg_origin,
bg_position,
bg_repeat,
bg_size,
test_backgrounds_attachment_examples,
test_backgrounds_clip_examples,
test_backgrounds_color_examples,
test_backgrounds_opacity_examples,
GradientUtility,
GradientFactory,
GradientStopUtility,
GradientStopFactory,
test_backgrounds_gradient_examples,
test_backgrounds_gradient_stops_examples,
test_backgrounds_gradient_composition_examples,
test_backgrounds_origin_examples,
test_backgrounds_position_examples,
test_backgrounds_repeat_examples,
test_backgrounds_size_examples,
test_backgrounds_arbitrary_examples,
test_backgrounds_practical_examples,
test_backgrounds_factory_documentation
)
```
#### Functions
``` python
def test_backgrounds_attachment_examples()
"Test background attachment utilities."
```
``` python
def test_backgrounds_clip_examples()
"Test background clip utilities."
```
``` python
def test_backgrounds_color_examples()
"Test background color utilities with various color values."
```
``` python
def test_backgrounds_opacity_examples()
"Test background colors with opacity modifiers."
```
``` python
def test_backgrounds_gradient_examples()
"Test gradient background utilities."
```
``` python
def test_backgrounds_gradient_stops_examples()
"Test gradient color stop utilities."
```
``` python
def test_backgrounds_gradient_composition_examples()
"Test composing gradient backgrounds with color stops."
```
``` python
def test_backgrounds_origin_examples()
"Test background origin utilities."
```
``` python
def test_backgrounds_position_examples()
"Test background position utilities."
```
``` python
def test_backgrounds_repeat_examples()
"Test background repeat utilities."
```
``` python
def test_backgrounds_size_examples()
"Test background size utilities."
```
``` python
def test_backgrounds_arbitrary_examples()
"Test background utilities with arbitrary values."
```
``` python
def test_backgrounds_practical_examples()
"Test background utilities in practical FastHTML component examples."
```
``` python
def test_backgrounds_factory_documentation()
"Test that background factories have accessible documentation."
```
#### Classes
``` python
class GradientUtility:
def __init__(
self,
gradient_type: str, # Type of gradient (linear, radial, conic)
value: Optional[Union[str, int]] = None, # Direction, angle, or custom value
negative: bool = False # Whether to negate the angle
)
"Utility class for gradient backgrounds with angle support."
def __init__(
self,
gradient_type: str, # Type of gradient (linear, radial, conic)
value: Optional[Union[str, int]] = None, # Direction, angle, or custom value
negative: bool = False # Whether to negate the angle
)
"Initialize gradient utility."
```
``` python
class GradientFactory:
def __init__(
self,
gradient_type: str, # Type of gradient (linear, radial, conic)
doc: Optional[str] = None # Documentation
)
"Factory for gradient utilities with angle and direction support."
def __init__(
self,
gradient_type: str, # Type of gradient (linear, radial, conic)
doc: Optional[str] = None # Documentation
)
"Initialize gradient factory."
def get_info(
self
) -> Dict[str, Any]: # Factory information
"Get information about this gradient factory."
```
``` python
class GradientStopUtility:
def __init__(
self,
stop_type: str, # Type of stop (from, via, to)
value: Optional[Union[ColorValue, str, int]] = None, # Color or percentage
is_position: bool = False # Whether this is a position value
)
"Utility class for gradient color stops with percentage support."
def __init__(
self,
stop_type: str, # Type of stop (from, via, to)
value: Optional[Union[ColorValue, str, int]] = None, # Color or percentage
is_position: bool = False # Whether this is a position value
)
"Initialize gradient stop utility."
```
``` python
class GradientStopFactory:
def __init__(
self,
stop_type: str, # Type of stop (from, via, to)
doc: Optional[str] = None # Documentation
)
"Enhanced factory for gradient color stops with percentage support."
def __init__(
self,
stop_type: str, # Type of stop (from, via, to)
doc: Optional[str] = None # Documentation
)
"Initialize gradient stop factory."
```
#### Variables
``` python
bg # The background color factory
bg_none # Remove background image
```
### base (`base.ipynb`)
> Base classes, types, and protocols for Tailwind CSS abstractions
#### Import
``` python
from cjm_fasthtml_tailwind.core.base import (
TailwindScale,
TailwindFraction,
TailwindArbitrary,
TailwindCustomProperty,
TailwindValue,
PSEUDO_CLASS_MODIFIERS,
PSEUDO_ELEMENT_MODIFIERS,
RESPONSIVE_MODIFIERS,
THEME_MODIFIERS,
MOTION_MODIFIERS,
PRINT_MODIFIERS,
ORIENTATION_MODIFIERS,
CONTRAST_MODIFIERS,
DIRECTION_MODIFIERS,
STATE_MODIFIERS,
CHILD_MODIFIERS,
ALL_MODIFIER_GROUPS,
CONTAINER_SCALES,
BREAKPOINTS,
T,
DIRECTIONS,
is_numeric_scale,
is_fraction,
is_custom_property,
is_arbitrary_value,
TailwindBuilder,
BaseUtility,
ModifierMixin,
ModifierGroup,
StandardUtility,
NamedScale,
Breakpoint,
BaseFactory,
UtilityFactory,
combine_classes,
SingleValueUtility,
SingleValueFactory,
Direction,
DirectionalUtility,
NegativeableUtility
)
```
#### Functions
``` python
def is_numeric_scale(
value: Any # The value to check - can be int, float, or string
) -> bool: # True if the value is a valid numeric scale, False otherwise
"Check if value is a valid numeric scale (int, float, or 'px')."
```
``` python
def is_fraction(
value: Any # The value to check for fraction format
) -> bool: # True if the value is a valid fraction string, False otherwise
"Check if value is a valid fraction string (e.g., '1/2', '3/4')."
```
``` python
def is_custom_property(
value: Any # The value to check for CSS custom property format
) -> bool: # True if the value is a CSS custom property, False otherwise
"Check if value is a CSS custom property (starts with --)."
```
``` python
def is_arbitrary_value(
value: Any # The value to check for arbitrary CSS value format
) -> bool: # True if the value contains CSS units or calc(), False otherwise
"Check if value is an arbitrary value (contains units or special chars)."
```
``` python
def combine_classes(
*args: Union[str, BaseUtility, TailwindBuilder, BaseFactory, None]
) -> str: # Space-separated class string
"Combine multiple class builders or strings into a single class string."
```
#### Classes
``` python
@runtime_checkable
class TailwindBuilder(Protocol):
"Protocol for all Tailwind utility builders."
def build(
self,
*args,
**kwargs
) -> str: # The built CSS class string
"Build and return the CSS class string."
```
``` python
class BaseUtility:
def __init__(
self,
prefix: str # The utility prefix (e.g., 'w' for width, 'p' for padding)
)
"Base class for all Tailwind utility builders."
def __init__(
self,
prefix: str # The utility prefix (e.g., 'w' for width, 'p' for padding)
)
"Initialize with a utility prefix."
def build(
self,
value: Optional[TailwindValue] = None # Optional value to override the stored value
) -> str: # The built CSS class string
"Build and return the CSS class string."
def with_modifiers(
self,
*modifiers: str # Modifier strings to apply (e.g., 'hover', 'focus', 'dark')
) -> 'BaseUtility': # A new instance with the modifiers applied
"Create a new instance with additional modifiers.
Modifiers are applied in the order they are passed."
```
``` python
class ModifierMixin:
"Mixin to add modifier support to any utility with convenient property access."
def hover(self) -> 'BaseUtility':
"""Apply hover modifier."""
return self.with_modifiers("hover")
@property
def focus(self) -> 'BaseUtility'
"Apply hover modifier."
def focus(self) -> 'BaseUtility':
"""Apply focus modifier."""
return self.with_modifiers("focus")
@property
def active(self) -> 'BaseUtility'
"Apply focus modifier."
def active(self) -> 'BaseUtility':
"""Apply active modifier."""
return self.with_modifiers("active")
@property
def visited(self) -> 'BaseUtility'
"Apply active modifier."
def visited(self) -> 'BaseUtility':
"""Apply visited modifier."""
return self.with_modifiers("visited")
@property
def disabled(self) -> 'BaseUtility'
"Apply visited modifier."
def disabled(self) -> 'BaseUtility':
"""Apply disabled modifier."""
return self.with_modifiers("disabled")
@property
def checked(self) -> 'BaseUtility'
"Apply disabled modifier."
def checked(self) -> 'BaseUtility':
"""Apply checked modifier."""
return self.with_modifiers("checked")
@property
def required(self) -> 'BaseUtility'
"Apply checked modifier."
def required(self) -> 'BaseUtility':
"""Apply required modifier."""
return self.with_modifiers("required")
@property
def invalid(self) -> 'BaseUtility'
"Apply required modifier."
def invalid(self) -> 'BaseUtility':
"""Apply invalid modifier."""
return self.with_modifiers("invalid")
@property
def valid(self) -> 'BaseUtility'
"Apply invalid modifier."
def valid(self) -> 'BaseUtility':
"""Apply valid modifier."""
return self.with_modifiers("valid")
# Pseudo-element modifiers
@property
def before(self) -> 'BaseUtility'
"Apply valid modifier."
def before(self) -> 'BaseUtility':
"""Apply before pseudo-element modifier."""
return self.with_modifiers("before")
@property
def after(self) -> 'BaseUtility'
"Apply before pseudo-element modifier."
def after(self) -> 'BaseUtility':
"""Apply after pseudo-element modifier."""
return self.with_modifiers("after")
@property
def placeholder(self) -> 'BaseUtility'
"Apply after pseudo-element modifier."
def placeholder(self) -> 'BaseUtility':
"""Apply placeholder modifier."""
return self.with_modifiers("placeholder")
@property
def selection(self) -> 'BaseUtility'
"Apply placeholder modifier."
def selection(self) -> 'BaseUtility':
"""Apply selection modifier."""
return self.with_modifiers("selection")
# Responsive modifiers
@property
def sm(self) -> 'BaseUtility'
"Apply selection modifier."
def sm(self) -> 'BaseUtility':
"""Apply small breakpoint modifier."""
return self.with_modifiers("sm")
@property
def max_sm(self) -> 'BaseUtility'
"Apply small breakpoint modifier."
def max_sm(self) -> 'BaseUtility':
"""Apply max small breakpoint modifier variant."""
return self.with_modifiers("max-sm")
@property
def md(self) -> 'BaseUtility'
"Apply max small breakpoint modifier variant."
def md(self) -> 'BaseUtility':
"""Apply medium breakpoint modifier."""
return self.with_modifiers("md")
@property
def max_md(self) -> 'BaseUtility'
"Apply medium breakpoint modifier."
def max_md(self) -> 'BaseUtility':
"""Apply max medium breakpoint modifier variant."""
return self.with_modifiers("max-md")
@property
def lg(self) -> 'BaseUtility'
"Apply max medium breakpoint modifier variant."
def lg(self) -> 'BaseUtility':
"""Apply large breakpoint modifier."""
return self.with_modifiers("lg")
@property
def xl(self) -> 'BaseUtility'
"Apply large breakpoint modifier."
def xl(self) -> 'BaseUtility':
"""Apply extra large breakpoint modifier."""
return self.with_modifiers("xl")
@property
def _2xl(self) -> 'BaseUtility'
"Apply extra large breakpoint modifier."
def dark(self) -> 'BaseUtility':
"""Apply dark mode modifier."""
return self.with_modifiers("dark")
# Motion modifiers
@property
def motion_reduce(self) -> 'BaseUtility'
"Apply dark mode modifier."
def motion_reduce(self) -> 'BaseUtility':
"""Apply reduced motion modifier."""
return self.with_modifiers("motion-reduce")
@property
def motion_safe(self) -> 'BaseUtility'
"Apply reduced motion modifier."
def motion_safe(self) -> 'BaseUtility':
"""Apply safe motion modifier."""
return self.with_modifiers("motion-safe")
# Structural modifiers
@property
def first(self) -> 'BaseUtility'
"Apply safe motion modifier."
def first(self) -> 'BaseUtility':
"""Apply first child modifier."""
return self.with_modifiers("first")
@property
def last(self) -> 'BaseUtility'
"Apply first child modifier."
def last(self) -> 'BaseUtility':
"""Apply last child modifier."""
return self.with_modifiers("last")
@property
def odd(self) -> 'BaseUtility'
"Apply last child modifier."
def odd(self) -> 'BaseUtility':
"""Apply odd child modifier."""
return self.with_modifiers("odd")
@property
def even(self) -> 'BaseUtility'
"Apply odd child modifier."
def even(self) -> 'BaseUtility':
"""Apply even child modifier."""
return self.with_modifiers("even")
# Group and peer modifiers
def group(
self,
state: Optional[str] = None, # Optional state like 'hover', 'focus'
name: Optional[str] = None # Optional group name for nested groups
) -> 'BaseUtility': # The utility with group modifier applied
"Apply even child modifier."
def group(
self,
state: Optional[str] = None, # Optional state like 'hover', 'focus'
name: Optional[str] = None # Optional group name for nested groups
) -> 'BaseUtility': # The utility with group modifier applied
"Apply group modifier with optional state and name."
def peer(
self,
state: Optional[str] = None, # Optional state like 'hover', 'focus'
name: Optional[str] = None # Optional peer name for multiple peers
) -> 'BaseUtility': # The utility with peer modifier applied
"Apply peer modifier with optional state and name."
def has(
self,
selector: str # CSS selector for :has() pseudo-class
) -> 'BaseUtility': # The utility with has modifier applied
"Apply has modifier with a selector."
def aria(
self,
attribute: str, # ARIA attribute name
value: Optional[str] = None # Optional value for the attribute
) -> 'BaseUtility': # The utility with aria modifier applied
"Apply aria modifier with attribute and optional value."
def data(
self,
attribute: str, # Data attribute name
value: Optional[str] = None # Optional value for the attribute
) -> 'BaseUtility': # The utility with data modifier applied
"Apply data modifier with attribute and optional value."
def arbitrary(
self,
selector: str # Arbitrary CSS selector
) -> 'BaseUtility': # The utility with arbitrary modifier applied
"Apply arbitrary modifier with custom selector."
```
``` python
@dataclass
class ModifierGroup:
"Group of related modifiers with descriptions."
name: str
description: str
modifiers: Dict[str, str] # modifier_name -> tailwind_variant
```
``` python
class StandardUtility(BaseUtility, ModifierMixin):
"Standard utility class with common value formatting and modifier support."
```
``` python
@dataclass
class NamedScale:
"Represents a named scale with optional CSS variable."
name: str
var: Optional[str]
comment: Optional[str]
def format(
self
) -> str: # The name of the scale for use in CSS classes
"Format as Tailwind class suffix."
```
``` python
@dataclass
class Breakpoint:
"Responsive breakpoint definition."
name: str
min_width: Optional[str]
```
``` python
class BaseFactory:
def __init__(
self,
doc: str # Documentation string describing what this factory creates
)
"Base factory class with documentation support."
def __init__(
self,
doc: str # Documentation string describing what this factory creates
)
"Initialize with documentation string."
def describe(
self
) -> str: # A formatted description of the factory
"Return a formatted description of this factory."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get detailed information about this factory's options and valid inputs.
Should return a dictionary with keys like:
- 'description': Factory description
- 'valid_inputs': List/description of valid input values
- 'options': Available options or methods"
```
``` python
class UtilityFactory:
def __init__(
self,
utility_class: type[T], # The utility class to instantiate
prefix: str, # The prefix to use for the utilities
doc: Optional[str] = None # Optional documentation string
)
"Factory for creating utility instances with fluent API."
def __init__(
self,
utility_class: type[T], # The utility class to instantiate
prefix: str, # The prefix to use for the utilities
doc: Optional[str] = None # Optional documentation string
)
"Initialize factory with a utility class and prefix."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about this utility factory."
```
``` python
class SingleValueUtility:
def __init__(
self,
value: str # The complete utility class string (e.g., "container", "sr-only")
)
"A utility that represents a single fixed value."
def __init__(
self,
value: str # The complete utility class string (e.g., "container", "sr-only")
)
"Initialize with a complete utility value."
```
``` python
class SingleValueFactory:
def __init__(
self,
value: str, # The utility class string (e.g., "container")
doc: str # Documentation describing what this utility does
)
"Factory for a single utility class with modifier support."
def __init__(
self,
value: str, # The utility class string (e.g., "container")
doc: str # Documentation describing what this utility does
)
"Initialize with a value and documentation."
def build(
self
) -> str: # The utility class string
"Build and return the utility class string."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about this single-value factory."
```
``` python
@dataclass
class Direction:
"Represents a directional variant."
suffix: str
css_suffix: str
```
``` python
class DirectionalUtility:
def __init__(
self,
prefix: str, # Base prefix (e.g., 'p' for padding)
direction: Optional[str] = None # Optional direction ('t', 'r', 'b', 'l', 'x', 'y')
)
"Base class for utilities with directional variants."
def __init__(
self,
prefix: str, # Base prefix (e.g., 'p' for padding)
direction: Optional[str] = None # Optional direction ('t', 'r', 'b', 'l', 'x', 'y')
)
"Initialize with prefix and optional direction."
```
``` python
class NegativeableUtility:
def __init__(
self,
prefix: str, # Base prefix
negative: bool = False # Whether this is a negative variant
)
"Utility class that supports negative values."
def __init__(
self,
prefix: str, # Base prefix
negative: bool = False # Whether this is a negative variant
)
"Initialize with prefix and negative flag."
```
#### Variables
``` python
TailwindScale # Numeric scales like 1, 2.5, "px"
TailwindFraction # Fractions like "1/2", "2/3"
TailwindArbitrary # Arbitrary values like "123px", "10rem"
TailwindCustomProperty # CSS custom properties like "--spacing-lg"
TailwindValue # Union of all possible value types
PSEUDO_CLASS_MODIFIERS
PSEUDO_ELEMENT_MODIFIERS
RESPONSIVE_MODIFIERS
THEME_MODIFIERS
MOTION_MODIFIERS
PRINT_MODIFIERS
ORIENTATION_MODIFIERS
CONTRAST_MODIFIERS
DIRECTION_MODIFIERS
STATE_MODIFIERS
CHILD_MODIFIERS
ALL_MODIFIER_GROUPS = [11 items]
CONTAINER_SCALES = [13 items] # Common named scales used across utilities
BREAKPOINTS = {5 items} # Common breakpoints
STATE_MODIFIERS = [39 items] # Common state modifiers
T
DIRECTIONS = {6 items} # Common directions
```
### borders (`borders.ipynb`)
> Border utilities for Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.utilities.borders import (
RADIUS_SCALES,
RADIUS_CONFIG,
rounded,
BORDER_WIDTH_CONFIG,
border,
divide,
border_color,
divide_color,
border_style,
divide_style,
OUTLINE_WIDTH_CONFIG,
outline,
outline_color,
outline_style,
outline_hidden,
OUTLINE_OFFSET_CONFIG,
outline_offset,
RoundedFactory,
test_borders_radius_examples,
BorderWidthUtility,
BorderWidthFactory,
BorderDirectionalFactory,
test_borders_width_examples,
DivideFactory,
test_borders_divide_examples,
BorderColorFactory,
test_borders_color_examples,
test_borders_divide_color_examples,
test_borders_style_examples,
test_borders_divide_style_examples,
OutlineWidthFactory,
test_borders_outline_width_examples,
test_borders_outline_color_examples,
test_borders_outline_style_examples,
test_borders_outline_offset_examples,
test_borders_practical_examples,
test_borders_factory_documentation
)
```
#### Functions
``` python
def test_borders_radius_examples()
"Test border radius utilities with all variants."
```
``` python
def test_borders_width_examples()
"Test border width utilities with all variants."
```
``` python
def test_borders_divide_examples()
"Test divide utilities for adding borders between children."
```
``` python
def test_borders_color_examples()
"Test border color utilities with all variants."
```
``` python
def test_borders_divide_color_examples()
"Test divide color utilities for borders between children."
```
``` python
def test_borders_style_examples()
"Test border style utilities."
```
``` python
def test_borders_divide_style_examples()
"Test divide style utilities."
```
``` python
def test_borders_outline_width_examples()
"Test outline width utilities."
```
``` python
def test_borders_outline_color_examples()
"Test outline color utilities."
```
``` python
def test_borders_outline_style_examples()
"Test outline style utilities."
```
``` python
def test_borders_outline_offset_examples()
"Test outline offset utilities."
```
``` python
def test_borders_practical_examples()
"Test border utilities in practical FastHTML component examples."
```
``` python
def test_borders_factory_documentation()
"Test that border factories have accessible documentation."
```
#### Classes
``` python
class RoundedFactory:
def __init__(
self,
doc: Optional[str] = None # Optional documentation string
)
"Factory for creating border radius utilities with all variants."
def __init__(
self,
doc: Optional[str] = None # Optional documentation string
)
"Initialize with documentation and create all sub-factories."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get detailed information about the rounded factory."
```
``` python
class BorderWidthUtility:
def __init__(
self,
prefix: str, # The utility prefix (e.g., 'border', 'border-t')
config: ScaleConfig = BORDER_WIDTH_CONFIG, # Configuration for valid values
has_default: bool = True # Whether this utility has a default value (1px)
)
"Utility class for border width with default value support."
def __init__(
self,
prefix: str, # The utility prefix (e.g., 'border', 'border-t')
config: ScaleConfig = BORDER_WIDTH_CONFIG, # Configuration for valid values
has_default: bool = True # Whether this utility has a default value (1px)
)
"Initialize with prefix and configuration."
```
``` python
class BorderWidthFactory:
def __init__(
self,
doc: Optional[str] = None # Optional documentation string
)
"Factory for creating border width utilities with directional variants."
def __init__(
self,
doc: Optional[str] = None # Optional documentation string
)
"Initialize with documentation and create all sub-factories."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get detailed information about the border width factory."
```
``` python
class BorderDirectionalFactory:
def __init__(
self,
prefix: str, # The utility prefix (e.g., 'border-t')
doc: str # Documentation
)
"Factory for directional border width utilities."
def __init__(
self,
prefix: str, # The utility prefix (e.g., 'border-t')
doc: str # Documentation
)
"Initialize with prefix and documentation."
def describe(self) -> str
"Return the documentation for this factory."
```
``` python
class DivideFactory:
def __init__(self):
"""Initialize with divide utilities and reverse modifiers."""
super().__init__("Divide utilities for adding borders between child elements")
# Create divide width factories
self.x = BorderDirectionalFactory("divide-x", "Horizontal divide between children")
self.y = BorderDirectionalFactory("divide-y", "Vertical divide between children")
# Create reverse utilities
self.x_reverse = SingleValueFactory("divide-x-reverse", "Reverse the order of horizontal divide")
self.y_reverse = SingleValueFactory("divide-y-reverse", "Reverse the order of vertical divide")
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Factory for creating divide utilities that add borders between children."
def __init__(self):
"""Initialize with divide utilities and reverse modifiers."""
super().__init__("Divide utilities for adding borders between child elements")
# Create divide width factories
self.x = BorderDirectionalFactory("divide-x", "Horizontal divide between children")
self.y = BorderDirectionalFactory("divide-y", "Vertical divide between children")
# Create reverse utilities
self.x_reverse = SingleValueFactory("divide-x-reverse", "Reverse the order of horizontal divide")
self.y_reverse = SingleValueFactory("divide-y-reverse", "Reverse the order of vertical divide")
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Initialize with divide utilities and reverse modifiers."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the divide factory."
```
``` python
class BorderColorFactory:
def __init__(
self,
doc: Optional[str] = None # Optional documentation string
)
"Factory for creating border color utilities with directional variants."
def __init__(
self,
doc: Optional[str] = None # Optional documentation string
)
"Initialize with documentation and create all sub-factories."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get detailed information about the border color factory."
```
``` python
class OutlineWidthFactory:
def __init__(
self,
doc: Optional[str] = None # Optional documentation string
)
"Factory for creating outline width utilities."
def __init__(
self,
doc: Optional[str] = None # Optional documentation string
)
"Initialize with documentation."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get detailed information about the outline width factory."
```
#### Variables
``` python
RADIUS_SCALES = [8 items] # Border radius named scales
RADIUS_CONFIG # Border radius configuration
BORDER_WIDTH_CONFIG # Border width configuration
OUTLINE_WIDTH_CONFIG # Outline width configuration
OUTLINE_OFFSET_CONFIG # Outline offset configuration
```
### colors (`colors.ipynb`)
> Color system builders for Tailwind CSS utilities
#### Import
``` python
from cjm_fasthtml_tailwind.builders.colors import (
SPECIAL_COLORS,
ColorSpec,
ColorValue,
ColorFamily,
ColorShade,
is_valid_color_family,
is_valid_shade,
parse_color_spec,
ColoredUtility,
ColoredFactory,
ColorFamilyProxy,
test_colors_enum_examples,
test_colors_validation_examples,
test_colors_factory_examples,
test_colors_opacity_examples,
test_colors_arbitrary_examples,
test_colors_proxy_examples,
test_colors_multiple_utilities_examples,
test_colors_practical_usage_examples,
test_colors_modifier_examples,
get_all_color_families,
get_all_shades,
get_all_color_specs,
test_colors_factory_documentation
)
```
#### Functions
``` python
def is_valid_color_family(
value: str # The value to check
) -> bool: # True if value is a valid color family
"Check if a value is a valid Tailwind color family."
```
``` python
def is_valid_shade(
value: str # The value to check
) -> bool: # True if value is a valid shade
"Check if a value is a valid Tailwind shade."
```
``` python
def parse_color_spec(
value: ColorSpec # The color specification to parse
) -> tuple[str, Optional[str]]: # Tuple of (color_family, shade) or (special_color, None)
"""
Parse a color specification into family and shade.
Examples:
- "red-500" -> ("red", "500")
- ("red", "500") -> ("red", "500")
- "transparent" -> ("transparent", None)
"""
```
``` python
def test_colors_enum_examples()
"Test color family and shade enums."
```
``` python
def test_colors_validation_examples()
"Test color validation functions."
```
``` python
def test_colors_factory_examples()
"Test ColoredFactory with various color specifications."
```
``` python
def test_colors_opacity_examples()
"Test opacity modifiers with color utilities."
```
``` python
def test_colors_arbitrary_examples()
"Test arbitrary color values and custom properties."
```
``` python
def test_colors_proxy_examples()
"Test ColorFamilyProxy for dot notation access."
```
``` python
def test_colors_multiple_utilities_examples()
"Test color system with multiple utility types."
```
``` python
def test_colors_practical_usage_examples()
"Test practical usage patterns with FastHTML components."
```
``` python
def test_colors_modifier_examples()
"Test color utilities with modifiers for conditional styling."
```
``` python
def get_all_color_families() -> List[str]
"Get list of all Tailwind color family names."
```
``` python
def get_all_shades() -> List[str]
"Get list of all Tailwind shade values."
```
``` python
def get_all_color_specs() -> List[str]:
"""Get list of all valid color-shade combinations."""
specs = []
for family in ColorFamily
"Get list of all valid color-shade combinations."
```
``` python
def test_colors_factory_documentation()
"Test that color factories have proper documentation."
```
#### Classes
``` python
class ColorFamily(str, Enum):
"Tailwind CSS color families."
```
``` python
class ColorShade(str, Enum):
"Tailwind CSS color shade values."
```
``` python
class ColoredUtility:
def __init__(
self,
prefix: str, # The utility prefix (e.g., 'bg', 'text', 'border')
color: Optional[ColorValue] = None, # The color value
opacity: Optional[Union[int, str]] = None # Optional opacity value (0-100 or arbitrary)
)
"Utility class with color and opacity support."
def __init__(
self,
prefix: str, # The utility prefix (e.g., 'bg', 'text', 'border')
color: Optional[ColorValue] = None, # The color value
opacity: Optional[Union[int, str]] = None # Optional opacity value (0-100 or arbitrary)
)
"Initialize with prefix, optional color, and optional opacity."
def opacity(
self,
value: Union[int, str] # Opacity value (0-100 or arbitrary)
) -> 'ColoredUtility': # A new instance with opacity set
"Return a new ColoredUtility instance with opacity value."
```
``` python
class ColoredFactory:
def __init__(
self,
prefix: str, # The utility prefix (e.g., 'bg', 'text', 'border')
doc: Optional[str] = None # Optional documentation string
)
"Factory for creating color-based utilities."
def __init__(
self,
prefix: str, # The utility prefix (e.g., 'bg', 'text', 'border')
doc: Optional[str] = None # Optional documentation string
)
"Initialize factory with prefix and documentation."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get detailed information about this color factory."
```
``` python
class ColorFamilyProxy:
def __init__(
self,
prefix: str, # The utility prefix
color_family: str # The color family name
)
"Proxy for accessing color shades via dot notation."
def __init__(
self,
prefix: str, # The utility prefix
color_family: str # The color family name
)
"Initialize with prefix and color family."
```
#### Variables
``` python
SPECIAL_COLORS = {5 items}
```
### Core Utilities Discovery (`core_utils_discovery.ipynb`)
> Functions to discover and display core utility functions like
> combine_classes:
#### Import
``` python
from cjm_fasthtml_tailwind.cli.core_utils_discovery import (
CoreUtilityInfo,
get_core_utilities
)
```
#### Functions
``` python
def get_core_utilities(
) -> List[CoreUtilityInfo]: # TODO: Add return description
"Get information about core utility functions."
```
#### Classes
``` python
@dataclass
class CoreUtilityInfo:
"Information about a core utility function."
name: str # Function name
module: str # Module path (e.g., 'cjm_fasthtml_tailwind.core.base')
function: Any # The actual function object
signature: str # Function signature
docstring: str # Function docstring
source: str # Source code
import_statement: str # How to import this utility
```
### effects (`effects.ipynb`)
> Shadow, opacity and other visual effect utilities for Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.utilities.effects import (
SHADOW_SIZE_CONFIG,
shadow,
shadow_color,
INSET_SHADOW_SIZE_CONFIG,
inset_shadow,
inset_shadow_color,
RING_WIDTH_CONFIG,
ring,
ring_color,
INSET_RING_WIDTH_CONFIG,
inset_ring,
inset_ring_color,
TEXT_SHADOW_SIZE_CONFIG,
text_shadow,
text_shadow_color,
OPACITY_CONFIG,
opacity,
mix_blend,
bg_blend,
mask_clip,
mask_composite,
mask,
mask_linear,
mask_t_from,
mask_t_to,
mask_r_from,
mask_r_to,
mask_b_from,
mask_b_to,
mask_l_from,
mask_l_to,
mask_x_from,
mask_x_to,
mask_y_from,
mask_y_to,
mask_radial,
mask_circle,
mask_ellipse,
mask_radial_closest_corner,
mask_radial_closest_side,
mask_radial_farthest_corner,
mask_radial_farthest_side,
mask_radial_at_top_left,
mask_radial_at_top,
mask_radial_at_top_right,
mask_radial_at_left,
mask_radial_at_center,
mask_radial_at_right,
mask_radial_at_bottom_left,
mask_radial_at_bottom,
mask_radial_at_bottom_right,
mask_radial_from,
mask_radial_to,
mask_conic,
mask_conic_from,
mask_conic_to,
mask_mode,
mask_origin,
mask_position,
mask_repeat,
mask_size,
mask_type,
test_effects_shadow_size_examples,
test_effects_shadow_arbitrary_examples,
test_effects_shadow_color_examples,
test_effects_shadow_color_arbitrary_examples,
test_effects_inset_shadow_size_examples,
test_effects_inset_shadow_arbitrary_examples,
test_effects_inset_shadow_color_examples,
test_effects_ring_width_examples,
test_effects_ring_color_examples,
test_effects_inset_ring_width_examples,
test_effects_inset_ring_color_examples,
test_effects_text_shadow_size_examples,
test_effects_text_shadow_arbitrary_examples,
test_effects_text_shadow_color_examples,
test_effects_opacity_examples,
test_effects_mix_blend_examples,
test_effects_bg_blend_examples,
test_effects_mask_clip_examples,
test_effects_mask_composite_examples,
MaskImageUtility,
MaskImageFactory,
MaskLinearUtility,
MaskLinearFactory,
MaskDirectionalUtility,
MaskDirectionalFactory,
MaskRadialUtility,
MaskRadialFactory,
MaskConicUtility,
MaskConicFactory,
test_effects_mask_basic_examples,
test_effects_mask_linear_examples,
test_effects_mask_directional_examples,
test_effects_mask_radial_examples,
test_effects_mask_conic_examples,
test_effects_mask_properties_examples,
test_effects_shadow_practical_examples,
test_effects_shadow_composition_examples,
test_effects_comprehensive_examples,
test_effects_mask_practical_examples,
test_effects_factory_documentation
)
```
#### Functions
``` python
def test_effects_shadow_size_examples()
"Test shadow size utilities."
```
``` python
def test_effects_shadow_arbitrary_examples()
"Test shadow utilities with arbitrary and custom values."
```
``` python
def test_effects_shadow_color_examples()
"Test shadow color utilities with various color values."
```
``` python
def test_effects_shadow_color_arbitrary_examples()
"Test shadow color utilities with arbitrary values."
```
``` python
def test_effects_inset_shadow_size_examples()
"Test inset shadow size utilities."
```
``` python
def test_effects_inset_shadow_arbitrary_examples()
"Test inset shadow utilities with arbitrary and custom values."
```
``` python
def test_effects_inset_shadow_color_examples()
"Test inset shadow color utilities with various color values."
```
``` python
def test_effects_ring_width_examples()
"Test ring width utilities."
```
``` python
def test_effects_ring_color_examples()
"Test ring color utilities with various color values."
```
``` python
def test_effects_inset_ring_width_examples()
"Test inset ring width utilities."
```
``` python
def test_effects_inset_ring_color_examples()
"Test inset ring color utilities with various color values."
```
``` python
def test_effects_text_shadow_size_examples()
"Test text shadow size utilities."
```
``` python
def test_effects_text_shadow_arbitrary_examples()
"Test text shadow utilities with arbitrary and custom values."
```
``` python
def test_effects_text_shadow_color_examples()
"Test text shadow color utilities with various color values."
```
``` python
def test_effects_opacity_examples()
"Test opacity utilities with various values."
```
``` python
def test_effects_mix_blend_examples()
"Test mix blend mode utilities."
```
``` python
def test_effects_bg_blend_examples()
"Test background blend mode utilities."
```
``` python
def test_effects_mask_clip_examples()
"Test mask clip utilities."
```
``` python
def test_effects_mask_composite_examples()
"Test mask composite utilities."
```
``` python
def test_effects_mask_basic_examples()
"Test basic mask image utilities."
```
``` python
def test_effects_mask_linear_examples()
"Test linear gradient mask utilities."
```
``` python
def test_effects_mask_directional_examples()
"Test directional mask gradient utilities."
```
``` python
def test_effects_mask_radial_examples()
"Test radial gradient mask utilities."
```
``` python
def test_effects_mask_conic_examples()
"Test conic gradient mask utilities."
```
``` python
def test_effects_mask_properties_examples()
"Test mask property utilities (mode, origin, position, etc.)."
```
``` python
def test_effects_shadow_practical_examples()
"Test shadow utilities in practical FastHTML component examples."
```
``` python
def test_effects_shadow_composition_examples()
"Test composing shadow size and color utilities."
```
``` python
def test_effects_comprehensive_examples()
"Test comprehensive usage of all effect utilities."
```
``` python
def test_effects_mask_practical_examples()
"Test mask utilities in practical FastHTML component examples."
```
``` python
def test_effects_factory_documentation()
"Test that effect factories have accessible documentation."
```
#### Classes
``` python
class MaskImageUtility:
def __init__(
self,
value: Optional[str] = None, # Mask image value (none, custom property, or arbitrary)
)
"Utility class for mask images."
def __init__(
self,
value: Optional[str] = None, # Mask image value (none, custom property, or arbitrary)
)
"Initialize mask image utility with optional value."
```
``` python
class MaskImageFactory:
def __init__(
self,
doc: Optional[str] = None # Documentation
)
"Factory for basic mask image utilities."
def __init__(
self,
doc: Optional[str] = None # Documentation
)
"Initialize mask image factory."
def get_info(
self
) -> Dict[str, Any]: # Factory information
"Get information about the mask image factory."
```
``` python
class MaskLinearUtility:
def __init__(
self,
angle: Optional[Union[int, str]] = None, # Angle in degrees or custom value
negative: bool = False # Whether to negate the angle
)
"Utility class for linear gradient masks with angle support."
def __init__(
self,
angle: Optional[Union[int, str]] = None, # Angle in degrees or custom value
negative: bool = False # Whether to negate the angle
)
"Initialize linear gradient mask utility."
```
``` python
class MaskLinearFactory:
def __init__(
self,
doc: Optional[str] = None # Documentation
)
"Factory for linear gradient mask utilities with angle support."
def __init__(
self,
doc: Optional[str] = None # Documentation
)
"Initialize linear gradient mask factory."
def get_info(
self
) -> Dict[str, Any]: # Factory information
"Get information about the linear gradient mask factory."
```
``` python
class MaskDirectionalUtility:
def __init__(
self,
direction: str, # Direction (t, r, b, l, x, y)
position: str, # Position type (from or to)
value: Optional[Union[int, str]] = None, # Value (number, percentage, color, etc.)
)
"Utility class for directional mask gradients with from/to support."
def __init__(
self,
direction: str, # Direction (t, r, b, l, x, y)
position: str, # Position type (from or to)
value: Optional[Union[int, str]] = None, # Value (number, percentage, color, etc.)
)
"Initialize directional mask gradient utility."
```
``` python
class MaskDirectionalFactory:
def __init__(
self,
direction: str, # Direction (t, r, b, l, x, y)
position: str, # Position type (from or to)
doc: Optional[str] = None # Documentation
)
"Factory for directional mask gradient utilities."
def __init__(
self,
direction: str, # Direction (t, r, b, l, x, y)
position: str, # Position type (from or to)
doc: Optional[str] = None # Documentation
)
"Initialize directional mask factory."
def get_info(
self
) -> Dict[str, Any]: # Factory information
"Get information about this directional mask factory."
```
``` python
class MaskRadialUtility:
def __init__(
self,
value: Optional[str] = None, # Arbitrary radial gradient value
)
"Utility class for radial gradient masks."
def __init__(
self,
value: Optional[str] = None, # Arbitrary radial gradient value
)
"Initialize radial gradient mask utility."
```
``` python
class MaskRadialFactory:
def __init__(
self,
doc: Optional[str] = None # Documentation
)
"Factory for radial gradient mask utilities."
def __init__(
self,
doc: Optional[str] = None # Documentation
)
"Initialize radial gradient mask factory."
def get_info(
self
) -> Dict[str, Any]: # Factory information
"Get information about the radial gradient mask factory."
```
``` python
class MaskConicUtility:
def __init__(
self,
angle: Optional[Union[int, str]] = None, # Starting angle in degrees or custom value
negative: bool = False # Whether to negate the angle
)
"Utility class for conic gradient masks with angle support."
def __init__(
self,
angle: Optional[Union[int, str]] = None, # Starting angle in degrees or custom value
negative: bool = False # Whether to negate the angle
)
"Initialize conic gradient mask utility."
```
``` python
class MaskConicFactory:
def __init__(
self,
doc: Optional[str] = None # Documentation
)
"Factory for conic gradient mask utilities with angle support."
def __init__(
self,
doc: Optional[str] = None # Documentation
)
"Initialize conic gradient mask factory."
def get_info(
self
) -> Dict[str, Any]: # Factory information
"Get information about the conic gradient mask factory."
```
#### Variables
``` python
SHADOW_SIZE_CONFIG
shadow # Box shadow factory
shadow_color # Create shadow color factory using the existing ColoredFactory
INSET_SHADOW_SIZE_CONFIG
inset_shadow # Inset box shadow factory
inset_shadow_color # Create inset shadow color factory using the existing ColoredFactory
RING_WIDTH_CONFIG
ring # Ring width factory
ring_color # Create ring color factory using the existing ColoredFactory
INSET_RING_WIDTH_CONFIG
inset_ring # Inset ring width factory
inset_ring_color # Create inset ring color factory using the existing ColoredFactory
TEXT_SHADOW_SIZE_CONFIG
text_shadow # Text shadow factory
text_shadow_color # Create text shadow color factory using the existing ColoredFactory
OPACITY_CONFIG
opacity # Opacity factory
mask # Create the basic mask image factory instance
mask_linear # Create the linear gradient mask factory instance
mask_t_from # Top direction - from
mask_t_to # Top direction - to
mask_r_from # Right direction - from
mask_r_to # Right direction - to
mask_b_from # Bottom direction - from
mask_b_to # Bottom direction - to
mask_l_from # Left direction - from
mask_l_to # Left direction - to
mask_x_from # Horizontal (x) direction - from
mask_x_to # Horizontal (x) direction - to
mask_y_from # Vertical (y) direction - from
mask_y_to # Vertical (y) direction - to
mask_radial # Create the radial gradient mask factory instance
```
### Example Discovery (`example_discovery.ipynb`)
> Functions to discover and extract test example functions:
#### Import
``` python
from cjm_fasthtml_tailwind.cli.example_discovery import (
ExampleInfo,
extract_test_examples_from_module,
list_all_examples,
list_module_examples,
get_example_by_name
)
```
#### Functions
``` python
def extract_test_examples_from_module(
module: Any, # The module to extract test examples from
module_name: str # The name of the module
) -> List[ExampleInfo]: # List of ExampleInfo objects
"Extract all test example functions from a module."
```
``` python
def list_all_examples(
) -> Dict[str, List[ExampleInfo]]: # Dictionary mapping module names to their examples
"List all test example functions across all utility modules."
```
``` python
def list_module_examples(
module_name: str # Name of the module to inspect
) -> List[ExampleInfo]: # List of ExampleInfo objects
"List all test example functions in a specific utility module."
```
``` python
def get_example_by_name(
module_name: str, # Name of the module
feature: str # Feature name (e.g., 'basic', 'directional')
) -> Optional[ExampleInfo]: # ExampleInfo object or None if not found
"Get a specific example by module name and feature."
```
#### Classes
``` python
@dataclass
class ExampleInfo:
"Information about a discovered test example function."
name: str # Function name (e.g., 'test_spacing_basic_examples')
module_name: str # Module where it was found (e.g., 'spacing')
feature: str # Feature being demonstrated (e.g., 'basic')
function: Any # The actual function object
source: str # Source code of the function
docstring: str # Docstring of the function
```
### explorer (`explorer.ipynb`)
> CLI tool for API exploration of cjm-fasthtml-tailwind utilities
#### Import
``` python
from cjm_fasthtml_tailwind.cli.explorer import (
display_modules,
display_module_factories,
display_all_factories,
display_module_examples,
display_all_examples,
display_example_source,
display_module_helpers,
display_helper_source,
display_all_helpers,
display_factory_info,
display_search_results,
display_core_utility_source,
display_core_utilities,
display_imports,
display_test_code_result,
get_example_modules,
get_example_factories,
get_example_features,
get_example_helpers,
get_example_core_utils,
get_combine_classes_example,
get_example_test_code,
add_modules_parser,
add_factories_parser,
add_factory_parser,
add_examples_parser,
add_example_parser,
add_helpers_parser,
add_helper_parser,
add_search_parser,
add_test_code_parser,
add_core_utils_parser,
add_core_util_parser,
add_imports_parser,
add_scan_parser,
dispatch_command,
handle_search_command,
handle_test_code_command,
handle_scan_command,
setup_argument_parser,
main
)
```
#### Functions
``` python
def display_modules(
): # TODO: Add type hint
"Display all available utility modules with their documentation."
```
``` python
def display_module_factories(
module_name: str # TODO: Add description
): # TODO: Add type hint
"Display all factories in a specific module."
```
``` python
def display_all_factories(
): # TODO: Add type hint
"Display all factories across all modules."
```
``` python
def display_module_examples(
module_name: str # TODO: Add description
): # TODO: Add type hint
"Display all usage examples in a specific module."
```
``` python
def display_all_examples(
): # TODO: Add type hint
"Display all usage examples across all modules."
```
``` python
def display_example_source(
module_name: str, # TODO: Add description
feature: str # TODO: Add description
): # TODO: Add type hint
"Display the source code of a specific example function."
```
``` python
def display_module_helpers(
module_name: str # TODO: Add description
): # TODO: Add type hint
"Display helper functions available in a specific module."
```
``` python
def display_helper_source(
module_name: str, # TODO: Add description
helper_name: str # TODO: Add description
): # TODO: Add type hint
"Display the source code of a specific helper function."
```
``` python
def display_all_helpers(
): # TODO: Add type hint
"Display all helper functions across all modules."
```
``` python
def display_factory_info(
module_name: str, # TODO: Add description
factory_name: str # TODO: Add description
): # TODO: Add type hint
"Display detailed information about a specific factory."
```
``` python
def display_search_results(
results: List[SearchResult], # TODO: Add description
query: str # TODO: Add description
): # TODO: Add type hint
"Display search results in a formatted way."
```
``` python
def display_core_utility_source(
util_name: str # TODO: Add description
): # TODO: Add type hint
"Display the source code of a specific core utility function."
```
``` python
def display_core_utilities(
): # TODO: Add type hint
"Display all core utility functions."
```
``` python
def display_imports(
modules: Optional[List[str]] = None # TODO: Add description
): # TODO: Add type hint
"Display recommended import statements."
```
``` python
def display_test_code_result(
success: bool, # TODO: Add description
stdout: str, # TODO: Add description
stderr: str, # TODO: Add description
code: str # TODO: Add description
): # TODO: Add type hint
"Display the results of test code execution."
```
``` python
def get_example_modules(
limit: int = 2 # TODO: Add description
) -> str: # TODO: Add return description
"Get example module names dynamically."
```
``` python
def get_example_factories(
module_name: str = None, # TODO: Add description
limit: int = 4 # TODO: Add description
) -> str: # TODO: Add return description
"Get example factory names dynamically."
```
``` python
def get_example_features(
module_name: str = None, # TODO: Add description
limit: int = 3 # TODO: Add description
) -> str: # TODO: Add return description
"Get example feature names dynamically."
```
``` python
def get_example_helpers(
module_name: str = None, # TODO: Add description
limit: int = 2 # TODO: Add description
) -> str: # TODO: Add return description
"Get example helper function names dynamically."
```
``` python
def get_example_core_utils(
limit: int = 2 # TODO: Add description
) -> str: # TODO: Add return description
"Get example core utility names dynamically."
```
``` python
def get_combine_classes_example(
) -> str: # TODO: Add return description
"Get a dynamic example of combine_classes usage."
```
``` python
def get_example_test_code(
limit_chars: int = 50 # TODO: Add description
) -> str: # TODO: Add return description
"Get an actual code example from test functions."
```
``` python
def add_modules_parser(
subparsers # TODO: Add type hint and description
): # TODO: Add type hint
"Add the 'modules' command parser."
```
``` python
def add_factories_parser(
subparsers # TODO: Add type hint and description
): # TODO: Add type hint
"Add the 'factories' command parser."
```
``` python
def add_factory_parser(
subparsers # TODO: Add type hint and description
): # TODO: Add type hint
"Add the 'factory' command parser."
```
``` python
def add_examples_parser(
subparsers # TODO: Add type hint and description
): # TODO: Add type hint
"Add the 'examples' command parser."
```
``` python
def add_example_parser(
subparsers # TODO: Add type hint and description
): # TODO: Add type hint
"Add the 'example' command parser."
```
``` python
def add_helpers_parser(
subparsers # TODO: Add type hint and description
): # TODO: Add type hint
"Add the 'helpers' command parser."
```
``` python
def add_helper_parser(
subparsers # TODO: Add type hint and description
): # TODO: Add type hint
"Add the 'helper' command parser."
```
``` python
def add_search_parser(
subparsers # TODO: Add type hint and description
): # TODO: Add type hint
"Add the 'search' command parser."
```
``` python
def add_test_code_parser(
subparsers # TODO: Add type hint and description
): # TODO: Add type hint
"Add the 'test-code' command parser."
```
``` python
def add_core_utils_parser(
subparsers # TODO: Add type hint and description
): # TODO: Add type hint
"Add the 'core-utils' command parser."
```
``` python
def add_core_util_parser(
subparsers # TODO: Add type hint and description
): # TODO: Add type hint
"Add the 'core-util' command parser."
```
``` python
def add_imports_parser(
subparsers # TODO: Add type hint and description
): # TODO: Add type hint
"Add the 'imports' command parser."
```
``` python
def add_scan_parser(
subparsers # TODO: Add type hint and description
): # TODO: Add type hint
"Add the 'scan' command parser."
```
``` python
def dispatch_command(
args # TODO: Add type hint and description
): # TODO: Add type hint
"Dispatch the parsed arguments to the appropriate handler."
```
``` python
def handle_search_command(
args # TODO: Add type hint and description
): # TODO: Add type hint
"Handle the search command."
```
``` python
def handle_test_code_command(
args # TODO: Add type hint and description
): # TODO: Add type hint
"Handle the test-code command."
```
``` python
def handle_scan_command(
args # TODO: Add type hint and description
): # TODO: Add type hint
"Handle the scan command."
```
``` python
def setup_argument_parser(
): # TODO: Add type hint
"Set up the main argument parser with all subcommands."
```
``` python
def main(
): # TODO: Add type hint
"CLI entry point for exploring cjm-fasthtml-tailwind utilities."
```
### Factory Extraction (`factory_extraction.ipynb`)
> Functions to extract BaseFactory instances from modules:
#### Import
``` python
from cjm_fasthtml_tailwind.cli.factory_extraction import (
FactoryInfo,
extract_factories_from_module,
list_all_factories,
list_module_factories,
get_factory_by_name
)
```
#### Functions
``` python
def extract_factories_from_module(
module: Any, # The module to extract factories from
module_name: str # The name of the module
) -> List[FactoryInfo]: # List of FactoryInfo objects
"Extract all BaseFactory instances from a module."
```
``` python
def list_all_factories(
) -> Dict[str, List[FactoryInfo]]: # Dictionary mapping module names to their factories
"List all factory instances across all utility modules."
```
``` python
def list_module_factories(
module_name: str # Name of the module to inspect (e.g., 'spacing', 'sizing')
) -> List[FactoryInfo]: # List of FactoryInfo objects for the module
"List all factory instances in a specific utility module."
```
``` python
def get_factory_by_name(
module_name: str, # Name of the module
factory_name: str # Name of the factory (e.g., 'p', 'w', 'flex')
) -> Optional[FactoryInfo]: # FactoryInfo object or None if not found
"Get a specific factory by module name and factory name."
```
#### Classes
``` python
@dataclass
class FactoryInfo:
"Information about a discovered factory instance."
name: str # Factory variable name (e.g., 'p', 'w', 'flex')
factory: BaseFactory # The actual factory instance
doc: str # Documentation from the factory
module_name: str # Module where it was found
```
### filters (`filters.ipynb`)
> Filter utilities for Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.utilities.filters import (
filter_none,
BLUR_SCALES,
blur,
BRIGHTNESS_VALUES,
brightness_config,
brightness,
CONTRAST_VALUES,
contrast,
DROP_SHADOW_SCALES,
drop_shadow,
drop_shadow_color,
grayscale,
HUE_ROTATE_VALUES,
hue_rotate_config,
hue_rotate,
invert,
SATURATE_VALUES,
saturate,
sepia,
backdrop_filter_none,
backdrop_blur,
backdrop_brightness,
backdrop_contrast,
backdrop_saturate,
backdrop_opacity,
backdrop_grayscale,
backdrop_sepia,
backdrop_hue_rotate,
test_filters_control_examples,
BlurScale,
test_filters_blur_examples,
test_filters_brightness_examples,
test_filters_contrast_examples,
DropShadowScale,
test_filters_drop_shadow_examples,
test_filters_grayscale_examples,
test_filters_hue_rotate_examples,
test_filters_invert_examples,
test_filters_saturate_examples,
test_filters_sepia_examples,
test_filters_backdrop_examples,
test_filters_practical_examples,
test_filters_factory_documentation
)
```
#### Functions
``` python
def test_filters_control_examples()
"Test filter control utilities."
```
``` python
def test_filters_blur_examples()
"Test blur filter utilities."
```
``` python
def test_filters_brightness_examples()
"Test brightness filter utilities."
```
``` python
def test_filters_contrast_examples()
"Test contrast filter utilities."
```
``` python
def test_filters_drop_shadow_examples()
"Test drop shadow filter utilities."
```
``` python
def test_filters_grayscale_examples()
"Test grayscale filter utilities."
```
``` python
def test_filters_hue_rotate_examples()
"Test hue rotate filter utilities."
```
``` python
def test_filters_invert_examples()
"Test invert filter utilities."
```
``` python
def test_filters_saturate_examples()
"Test saturate filter utilities."
```
``` python
def test_filters_sepia_examples()
"Test sepia filter utilities."
```
``` python
def test_filters_backdrop_examples()
"Test backdrop filter utilities."
```
``` python
def test_filters_practical_examples()
"Test filter utilities in practical FastHTML component examples."
```
``` python
def test_filters_factory_documentation()
"Test that filter factories have accessible documentation."
```
#### Classes
``` python
@dataclass
class BlurScale:
"Represents a blur scale with name and pixel value."
name: str
pixels: str
var: str
def format(self) -> str
"Format as Tailwind class suffix."
```
``` python
@dataclass
class DropShadowScale:
"Represents a drop shadow scale with name and shadow value."
name: str
shadow: str
var: str
def format(self) -> str
"Format as Tailwind class suffix."
```
#### Variables
``` python
filter_none # Remove filters
BLUR_SCALES = [7 items]
BRIGHTNESS_VALUES = [11 items]
CONTRAST_VALUES = [7 items]
DROP_SHADOW_SCALES = [6 items]
HUE_ROTATE_VALUES = [6 items]
SATURATE_VALUES = [5 items]
backdrop_filter_none # Remove backdrop filters
```
### flexbox_and_grid (`flexbox_and_grid.ipynb`)
> Flexbox and CSS Grid utilities for Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.utilities.flexbox_and_grid import (
FLEX_BASIS_CONFIG,
basis,
FLEX_DIRECTION_VALUES,
flex_direction,
FLEX_WRAP_VALUES,
flex_wrap,
FLEX_CONFIG,
flex,
FLEX_GROW_CONFIG,
grow,
FLEX_SHRINK_CONFIG,
shrink,
ORDER_CONFIG,
order,
GRID_COLS_CONFIG,
grid_cols,
GRID_ROWS_CONFIG,
grid_rows,
COL_SPAN_CONFIG,
COL_START_END_CONFIG,
col_span,
col_start,
col_end,
col,
ROW_SPAN_CONFIG,
ROW_START_END_CONFIG,
row_span,
row_start,
row_end,
row,
GRID_FLOW_VALUES,
grid_flow,
AUTO_COLS_VALUES,
AUTO_ROWS_VALUES,
auto_cols,
auto_rows,
gap,
JUSTIFY_CONTENT_VALUES,
justify,
JUSTIFY_ITEMS_VALUES,
justify_items,
JUSTIFY_SELF_VALUES,
justify_self,
ALIGN_CONTENT_VALUES,
content,
ALIGN_ITEMS_VALUES,
items,
ALIGN_SELF_VALUES,
self_align,
PLACE_CONTENT_VALUES,
place_content,
PLACE_ITEMS_VALUES,
place_items,
PLACE_SELF_VALUES,
place_self,
test_flexbox_and_grid_basis_examples,
test_flexbox_and_grid_direction_examples,
test_flexbox_and_grid_wrap_examples,
test_flexbox_and_grid_flex_examples,
GrowFactory,
test_flexbox_and_grid_grow_examples,
ShrinkFactory,
test_flexbox_and_grid_shrink_examples,
test_flexbox_and_grid_order_examples,
test_flexbox_and_grid_template_columns_examples,
test_flexbox_and_grid_template_rows_examples,
ColFactory,
test_flexbox_and_grid_column_examples,
RowFactory,
test_flexbox_and_grid_row_examples,
test_flexbox_and_grid_flow_examples,
AutoColsFactory,
AutoRowsFactory,
test_flexbox_and_grid_auto_cols_rows_examples,
GapFactory,
test_flexbox_and_grid_gap_examples,
test_flexbox_and_grid_justify_examples,
test_flexbox_and_grid_align_examples,
test_flexbox_and_grid_place_examples,
test_flexbox_and_grid_practical_examples,
flex_center,
flex_between,
flex_col_center,
grid_center,
responsive_grid,
test_flexbox_and_grid_helper_examples,
test_flexbox_and_grid_factory_documentation
)
```
#### Functions
``` python
def test_flexbox_and_grid_basis_examples(
): # TODO: Add type hint
"Test flex basis utilities with various scale values."
```
``` python
def test_flexbox_and_grid_direction_examples(
): # TODO: Add type hint
"Test flex direction utilities."
```
``` python
def test_flexbox_and_grid_wrap_examples(
): # TODO: Add type hint
"Test flex wrap utilities."
```
``` python
def test_flexbox_and_grid_flex_examples(
): # TODO: Add type hint
"Test flex utilities for combined grow/shrink properties."
```
``` python
def test_flexbox_and_grid_grow_examples(
): # TODO: Add type hint
"Test flex grow utilities."
```
``` python
def test_flexbox_and_grid_shrink_examples(
): # TODO: Add type hint
"Test flex shrink utilities."
```
``` python
def test_flexbox_and_grid_order_examples(
): # TODO: Add type hint
"Test order utilities for flex and grid items."
```
``` python
def test_flexbox_and_grid_template_columns_examples(
): # TODO: Add type hint
"Test grid template columns utilities."
```
``` python
def test_flexbox_and_grid_template_rows_examples(
): # TODO: Add type hint
"Test grid template rows utilities."
```
``` python
def test_flexbox_and_grid_column_examples(
): # TODO: Add type hint
"Test grid column utilities including span, start, and end."
```
``` python
def test_flexbox_and_grid_row_examples(
): # TODO: Add type hint
"Test grid row utilities including span, start, and end."
```
``` python
def test_flexbox_and_grid_flow_examples(
): # TODO: Add type hint
"Test grid auto flow utilities."
```
``` python
def test_flexbox_and_grid_auto_cols_rows_examples(
): # TODO: Add type hint
"Test grid auto columns and rows utilities."
```
``` python
def test_flexbox_and_grid_gap_examples(
): # TODO: Add type hint
"Test gap utilities for flexbox and grid containers."
```
``` python
def test_flexbox_and_grid_justify_examples(
): # TODO: Add type hint
"Test justify utilities for flex and grid containers."
```
``` python
def test_flexbox_and_grid_align_examples(
): # TODO: Add type hint
"Test align utilities for flex and grid containers."
```
``` python
def test_flexbox_and_grid_place_examples(
): # TODO: Add type hint
"Test place utilities for grid containers."
```
``` python
def test_flexbox_and_grid_practical_examples(
): # TODO: Add type hint
"Test flexbox and grid utilities in practical FastHTML component examples."
```
``` python
def flex_center(
) -> str: # Combined CSS classes for centered flex container
"Create classes for a flex container that centers its content."
```
``` python
def flex_between(
) -> str: # Combined CSS classes for flex container with space between
"Create classes for a flex container with space between items."
```
``` python
def flex_col_center(
) -> str: # Combined CSS classes for centered vertical flex container
"Create classes for a vertical flex container that centers its content."
```
``` python
def grid_center(
) -> str: # Combined CSS classes for centered grid container
"Create classes for a grid container that centers its content."
```
``` python
def responsive_grid(
mobile: int = 1, # Number of columns on mobile devices
tablet: int = 2, # Number of columns on tablet devices
desktop: int = 3, # Number of columns on desktop devices
gap_size: TailwindScale = 4 # Gap size between grid items
) -> str: # Combined CSS classes for responsive grid
"Create responsive grid classes with customizable breakpoints."
```
``` python
def test_flexbox_and_grid_helper_examples(
): # TODO: Add type hint
"Test helper functions for common flexbox and grid patterns."
```
``` python
def test_flexbox_and_grid_factory_documentation(
): # TODO: Add type hint
"Test that factories have accessible documentation."
```
#### Classes
``` python
class GrowFactory:
def __init__(self):
"Initialize with grow configuration and documentation."
super().__init__("grow", FLEX_GROW_CONFIG, "Flex grow utilities for controlling how flex items grow")
def __call__(
self,
value: Optional[TailwindScale] = None # The grow value (defaults to 1 if None)
) -> ScaledUtility: # A new grow utility instance
"Special factory for grow that defaults to grow-1 when called without args."
def __init__(self):
"Initialize with grow configuration and documentation."
super().__init__("grow", FLEX_GROW_CONFIG, "Flex grow utilities for controlling how flex items grow")
def __call__(
self,
value: Optional[TailwindScale] = None # The grow value (defaults to 1 if None)
) -> ScaledUtility: # A new grow utility instance
"Initialize with grow configuration and documentation."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about this grow factory."
```
``` python
class ShrinkFactory:
def __init__(self):
"Initialize with shrink configuration and documentation."
super().__init__("shrink", FLEX_SHRINK_CONFIG, "Flex shrink utilities for controlling how flex items shrink")
def __call__(
self,
value: Optional[TailwindScale] = None # The shrink value (defaults to 1 if None)
) -> ScaledUtility: # A new shrink utility instance
"Special factory for shrink that defaults to shrink-1 when called without args."
def __init__(self):
"Initialize with shrink configuration and documentation."
super().__init__("shrink", FLEX_SHRINK_CONFIG, "Flex shrink utilities for controlling how flex items shrink")
def __call__(
self,
value: Optional[TailwindScale] = None # The shrink value (defaults to 1 if None)
) -> ScaledUtility: # A new shrink utility instance
"Initialize with shrink configuration and documentation."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about this shrink factory."
```
``` python
class ColFactory:
def __init__(self):
"Initialize with 'col' prefix and column configuration."
super().__init__("col", COL_START_END_CONFIG, "Grid column utilities for arbitrary grid-column values")
@property
def auto(
self
) -> str: # The 'col-auto' CSS class
"Special factory for grid-column shorthand."
def __init__(self):
"Initialize with 'col' prefix and column configuration."
super().__init__("col", COL_START_END_CONFIG, "Grid column utilities for arbitrary grid-column values")
@property
def auto(
self
) -> str: # The 'col-auto' CSS class
"Initialize with 'col' prefix and column configuration."
def auto(
self
) -> str: # The 'col-auto' CSS class
"Return the col-auto utility class."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about this column factory."
```
``` python
class RowFactory:
def __init__(self):
"Initialize with 'row' prefix and row configuration."
super().__init__("row", ROW_START_END_CONFIG, "Grid row utilities for arbitrary grid-row values")
@property
def auto(
self
) -> str: # The 'row-auto' CSS class
"Special factory for grid-row shorthand."
def __init__(self):
"Initialize with 'row' prefix and row configuration."
super().__init__("row", ROW_START_END_CONFIG, "Grid row utilities for arbitrary grid-row values")
@property
def auto(
self
) -> str: # The 'row-auto' CSS class
"Initialize with 'row' prefix and row configuration."
def auto(
self
) -> str: # The 'row-auto' CSS class
"Return the row-auto utility class."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about this row factory."
```
``` python
class AutoColsFactory:
def __init__(self):
"Initialize with auto columns values and documentation."
super().__init__(AUTO_COLS_VALUES, "Grid auto columns utilities for controlling the size of implicitly-created grid columns")
def __call__(
self,
value: str # Custom auto-cols value (e.g., '200px', 'minmax(0, 1fr)')
) -> str: # The formatted auto-cols CSS class
"Factory for auto-cols with custom value support."
def __init__(self):
"Initialize with auto columns values and documentation."
super().__init__(AUTO_COLS_VALUES, "Grid auto columns utilities for controlling the size of implicitly-created grid columns")
def __call__(
self,
value: str # Custom auto-cols value (e.g., '200px', 'minmax(0, 1fr)')
) -> str: # The formatted auto-cols CSS class
"Initialize with auto columns values and documentation."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about this auto columns factory."
```
``` python
class AutoRowsFactory:
def __init__(self):
"Initialize with auto rows values and documentation."
super().__init__(AUTO_ROWS_VALUES, "Grid auto rows utilities for controlling the size of implicitly-created grid rows")
def __call__(
self,
value: str # Custom auto-rows value (e.g., '200px', 'minmax(0, 1fr)')
) -> str: # The formatted auto-rows CSS class
"Factory for auto-rows with custom value support."
def __init__(self):
"Initialize with auto rows values and documentation."
super().__init__(AUTO_ROWS_VALUES, "Grid auto rows utilities for controlling the size of implicitly-created grid rows")
def __call__(
self,
value: str # Custom auto-rows value (e.g., '200px', 'minmax(0, 1fr)')
) -> str: # The formatted auto-rows CSS class
"Initialize with auto rows values and documentation."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about this auto rows factory."
```
``` python
class GapFactory:
def __init__(self):
"Initialize with base gap and directional gap factories."
super().__init__("Gap utilities for controlling gutters between grid and flexbox items")
# Base gap utility
self._base = ScaledFactory("gap", SPACING_CONFIG, "Gap utilities for controlling gutters between grid and flexbox items")
# Directional gap utilities with hyphens
self.x = ScaledFactory("gap-x", SPACING_CONFIG, "Column gap utilities for controlling gutters between columns")
self.y = ScaledFactory("gap-y", SPACING_CONFIG, "Row gap utilities for controlling gutters between rows")
def __call__(
self,
value: Optional[TailwindScale] = None # The gap value (numeric, px, or arbitrary)
) -> ScaledUtility: # A new gap utility instance
"Special factory for gap utilities that use hyphenated directions."
def __init__(self):
"Initialize with base gap and directional gap factories."
super().__init__("Gap utilities for controlling gutters between grid and flexbox items")
# Base gap utility
self._base = ScaledFactory("gap", SPACING_CONFIG, "Gap utilities for controlling gutters between grid and flexbox items")
# Directional gap utilities with hyphens
self.x = ScaledFactory("gap-x", SPACING_CONFIG, "Column gap utilities for controlling gutters between columns")
self.y = ScaledFactory("gap-y", SPACING_CONFIG, "Row gap utilities for controlling gutters between rows")
def __call__(
self,
value: Optional[TailwindScale] = None # The gap value (numeric, px, or arbitrary)
) -> ScaledUtility: # A new gap utility instance
"Initialize with base gap and directional gap factories."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the gap factory."
```
#### Variables
``` python
FLEX_BASIS_CONFIG # Create configuration for flex basis - similar to width/height but with container scales
basis # The flex basis factory
FLEX_DIRECTION_VALUES = {4 items} # Flex direction utilities
flex_direction # The flex direction factory
FLEX_WRAP_VALUES = {3 items} # Flex wrap utilities
flex_wrap # The flex wrap factory
FLEX_CONFIG # Flex configuration - supports numeric values and special presets
flex # The flex factory
FLEX_GROW_CONFIG # Flex grow configuration
grow # The flex grow factory
FLEX_SHRINK_CONFIG # Flex shrink configuration (same as grow)
shrink # The flex shrink factory
ORDER_CONFIG # Order configuration - supports numeric values including negative
order # The order factory
GRID_COLS_CONFIG # Grid template columns configuration
grid_cols # The grid columns factory
GRID_ROWS_CONFIG # Grid template rows configuration (same as columns)
grid_rows # The grid rows factory
COL_SPAN_CONFIG # Grid column span configuration
COL_START_END_CONFIG # Grid column start/end configuration
col_span # Column span factory
col_start # Column start factory
col_end # Column end factory
col # The grid column factory
ROW_SPAN_CONFIG # Grid row span configuration (same as column)
ROW_START_END_CONFIG # Grid row start/end configuration (same as column)
row_span # Row span factory
row_start # Row start factory
row_end # Row end factory
row # The grid row factory
GRID_FLOW_VALUES = {5 items} # Grid auto flow utilities
grid_flow # The grid flow factory
AUTO_COLS_VALUES = {4 items} # Grid auto columns values
AUTO_ROWS_VALUES = {4 items} # Grid auto rows values
auto_cols # The auto columns factory
auto_rows # The auto rows factory
gap # The gap factory
JUSTIFY_CONTENT_VALUES = {11 items} # Justify content values
justify # The justify content factory
JUSTIFY_ITEMS_VALUES = {7 items} # Justify items values
justify_items # The justify items factory
JUSTIFY_SELF_VALUES = {7 items} # Justify self values
justify_self # The justify self factory
ALIGN_CONTENT_VALUES = {9 items} # Align content values
content # The align content factory
ALIGN_ITEMS_VALUES = {8 items} # Align items values
items # The align items factory
ALIGN_SELF_VALUES = {9 items} # Align self values
self_align # The align self factory (renamed to avoid conflict with Python's self)
PLACE_CONTENT_VALUES = {10 items} # Place content values
place_content # The place content factory
PLACE_ITEMS_VALUES = {7 items} # Place items values
place_items # The place items factory
PLACE_SELF_VALUES = {7 items} # Place self values
place_self # The place self factory
```
### Helper Function Discovery (`helper_discovery.ipynb`)
> Functions to discover and extract helper functions:
#### Import
``` python
from cjm_fasthtml_tailwind.cli.helper_discovery import (
HelperInfo,
get_helper_examples,
get_module_helpers
)
```
#### Functions
``` python
def get_helper_examples(
module_name: str # Name of the module to inspect
) -> Optional[ExampleInfo]: # ExampleInfo object or None if not found
"Get the helper examples test function for a module."
```
``` python
def get_module_helpers(
module_name: str # Name of the module to inspect
) -> List[HelperInfo]: # List of HelperInfo objects
"Get helper functions from a module based on its test_<module>_helper_examples function."
```
#### Classes
``` python
@dataclass
class HelperInfo:
"Information about a discovered helper function."
name: str # Function name (e.g., 'pad', 'margin', 'combine_classes')
module_name: str # Module where it was found
function: Any # The actual function object
signature: str # Function signature
docstring: str # Function docstring
source: str # Source code of the function
```
### imports (`imports.ipynb`)
> Functions for getting import statements.
#### Import
``` python
from cjm_fasthtml_tailwind.cli.imports import (
get_recommended_imports
)
```
#### Functions
``` python
def get_recommended_imports(
modules: Optional[List[str]] = None # Specific modules to include, or None for all
) -> List[str]: # List of import statements
"Get recommended import statements for using the library."
```
### interactivity (`interactivity.ipynb`)
> Interactivity utilities for Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.utilities.interactivity import (
accent,
appearance,
caret,
scheme,
cursor,
field_sizing,
pointer_events,
resize,
scroll,
scroll_m,
scroll_ms,
scroll_me,
scroll_p,
scroll_ps,
scroll_pe,
snap_align,
snap_stop,
snap,
touch,
select,
will_change,
test_interactivity_accent_examples,
test_interactivity_appearance_examples,
test_interactivity_caret_examples,
test_interactivity_scheme_examples,
CursorFactory,
test_interactivity_cursor_examples,
test_interactivity_field_sizing_examples,
test_interactivity_pointer_events_examples,
test_interactivity_resize_examples,
test_interactivity_scroll_behavior_examples,
test_interactivity_scroll_margin_examples,
test_interactivity_scroll_padding_examples,
test_interactivity_scroll_snap_examples,
test_interactivity_touch_action_examples,
test_interactivity_user_select_examples,
WillChangeFactory,
test_interactivity_will_change_examples,
test_interactivity_form_practical_examples,
test_interactivity_scroll_snap_practical_examples,
test_interactivity_touch_mobile_practical_examples,
test_interactivity_factory_documentation,
test_interactivity_advanced_practical_examples
)
```
#### Functions
``` python
def test_interactivity_accent_examples()
"Test accent color utilities."
```
``` python
def test_interactivity_appearance_examples()
"Test appearance utilities."
```
``` python
def test_interactivity_caret_examples()
"Test caret color utilities."
```
``` python
def test_interactivity_scheme_examples()
"Test color scheme utilities."
```
``` python
def test_interactivity_cursor_examples()
"Test cursor utilities."
```
``` python
def test_interactivity_field_sizing_examples()
"Test field sizing utilities."
```
``` python
def test_interactivity_pointer_events_examples()
"Test pointer events utilities."
```
``` python
def test_interactivity_resize_examples()
"Test resize utilities."
```
``` python
def test_interactivity_scroll_behavior_examples()
"Test scroll behavior utilities."
```
``` python
def test_interactivity_scroll_margin_examples()
"Test scroll margin utilities."
```
``` python
def test_interactivity_scroll_padding_examples()
"Test scroll padding utilities."
```
``` python
def test_interactivity_scroll_snap_examples()
"Test scroll snap utilities."
```
``` python
def test_interactivity_touch_action_examples()
"Test touch action utilities."
```
``` python
def test_interactivity_user_select_examples()
"Test user select utilities."
```
``` python
def test_interactivity_will_change_examples()
"Test will-change utilities."
```
``` python
def test_interactivity_form_practical_examples()
"Test interactivity utilities in form components."
```
``` python
def test_interactivity_scroll_snap_practical_examples()
"Test scroll snap utilities in carousel/gallery components."
```
``` python
def test_interactivity_touch_mobile_practical_examples()
"Test touch and mobile interaction utilities."
```
``` python
def test_interactivity_factory_documentation()
"Test that interactivity factories have accessible documentation."
```
``` python
def test_interactivity_advanced_practical_examples()
"Test advanced combinations of interactivity utilities."
```
#### Classes
``` python
class CursorFactory(SimpleFactory):
"Factory for cursor utilities with arbitrary value support."
```
``` python
class WillChangeFactory(SimpleFactory):
"Factory for will-change utilities with arbitrary value support."
```
#### Variables
``` python
accent # The accent color factory
caret # The caret color factory
scroll_m # The scroll margin factory
scroll_ms # scroll-margin-inline-start
scroll_me # scroll-margin-inline-end
scroll_p # The scroll padding factory
scroll_ps # scroll-padding-inline-start
scroll_pe # scroll-padding-inline-end
```
### layout (`layout.ipynb`)
> Display, position, overflow, z-index and other layout utilities for
> Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.utilities.layout import (
DISPLAY_VALUES,
display_tw,
sr_only,
not_sr_only,
POSITION_VALUES,
position,
inset,
top,
right,
bottom,
left,
start,
end,
OVERFLOW_VALUES,
overflow,
Z_INDEX_CONFIG,
z,
FLOAT_VALUES,
float_tw,
CLEAR_VALUES,
clear,
OBJECT_FIT_VALUES,
object_fit,
OBJECT_POSITION_VALUES,
object_position,
VISIBILITY_VALUES,
visibility,
BOX_SIZING_VALUES,
box,
ISOLATION_VALUES,
isolation,
ASPECT_RATIO_VALUES,
aspect,
COLUMNS_CONFIG,
columns,
BREAK_BEFORE_VALUES,
BREAK_AFTER_VALUES,
BREAK_INSIDE_VALUES,
break_util,
BOX_DECORATION_VALUES,
box_decoration,
OVERSCROLL_VALUES,
overscroll,
test_layout_display_examples,
test_layout_position_examples,
InsetDirectionalFactory,
test_layout_inset_examples,
OverflowFactory,
test_layout_overflow_examples,
test_layout_z_index_examples,
test_layout_float_clear_examples,
ObjectPositionFactory,
test_layout_object_examples,
test_layout_visibility_examples,
AspectRatioFactory,
test_layout_aspect_columns_examples,
test_layout_columns_examples,
BreakFactory,
OverscrollFactory,
test_layout_other_utilities_examples,
test_layout_practical_examples,
test_layout_enhanced_factories_examples,
test_layout_modifier_examples,
test_layout_factory_documentation,
center_absolute,
stack_context,
sticky_top,
full_bleed,
test_layout_helper_examples
)
```
#### Functions
``` python
def test_layout_display_examples(
)
"Test display utilities with various values."
```
``` python
def test_layout_position_examples(
)
"Test position utilities."
```
``` python
def test_layout_inset_examples(
)
"Test inset utilities for positioning elements."
```
``` python
def test_layout_overflow_examples(
)
"Test overflow utilities for content handling."
```
``` python
def test_layout_z_index_examples(
)
"Test z-index utilities for stack ordering."
```
``` python
def test_layout_float_clear_examples(
)
"Test float and clear utilities for content wrapping."
```
``` python
def test_layout_object_examples(
)
"Test object fit and position utilities."
```
``` python
def test_layout_visibility_examples(
)
"Test visibility and box sizing utilities."
```
``` python
def test_layout_aspect_columns_examples(
)
"Test aspect ratio and columns utilities."
```
``` python
def test_layout_columns_examples(
)
"Test columns utilities."
```
``` python
def test_layout_other_utilities_examples(
)
"Test isolation, break, box decoration, and overscroll utilities."
```
``` python
def test_layout_practical_examples(
)
"Test layout utilities in practical FastHTML component examples."
```
``` python
def test_layout_enhanced_factories_examples(
)
"Test enhanced factories with modifier support in practical examples."
```
``` python
def test_layout_modifier_examples(
)
"Test layout utilities with modifiers for conditional styling."
```
``` python
def test_layout_factory_documentation(
)
"Test that factories have accessible documentation."
```
``` python
def center_absolute(
) -> str: # Combined CSS classes for centering an element
"Center an absolutely positioned element."
```
``` python
def stack_context(
z_value: int = 10 # The z-index value for the stacking context
) -> str: # Combined CSS classes for creating a stacking context
"Create a stacking context with z-index."
```
``` python
def sticky_top(
offset: TailwindScale = 0 # Top offset value (e.g., 0, 4, '1rem')
) -> str: # Combined CSS classes for sticky positioning
"Make element sticky at top with optional offset."
```
``` python
def full_bleed(
) -> str: # Combined CSS classes for full-bleed layout
"Make element break out of container constraints."
```
``` python
def test_layout_helper_examples(
)
"Test helper functions for common layout patterns."
```
#### Classes
``` python
class InsetDirectionalFactory:
def __init__(
self,
prefix: str, # The base prefix ('inset')
config: ScaleConfig # Configuration defining valid scales and values
)
"Special factory for inset utilities that use hyphenated directions."
def __init__(
self,
prefix: str, # The base prefix ('inset')
config: ScaleConfig # Configuration defining valid scales and values
)
"Initialize with prefix and scale configuration."
def negative(
self
) -> 'NegativeFactory': # A factory for creating negative variants
"Return a negative variant factory."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get detailed information about this inset factory."
```
``` python
class OverflowFactory:
def __init__(self):
"Initialize with overflow values and directional sub-factories."
super().__init__("Overflow utilities for controlling how an element handles content that is too large")
# Create base overflow utilities
self._values = {value: f"overflow-{value}" for value in OVERFLOW_VALUES}
"Factory for overflow utilities with directional support."
def __init__(self):
"Initialize with overflow values and directional sub-factories."
super().__init__("Overflow utilities for controlling how an element handles content that is too large")
# Create base overflow utilities
self._values = {value: f"overflow-{value}" for value in OVERFLOW_VALUES}
"Initialize with overflow values and directional sub-factories."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the overflow factory."
```
``` python
class ObjectPositionFactory(SimpleFactory):
"Factory for object position with both fixed and custom values."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the object position factory."
```
``` python
class AspectRatioFactory(SimpleFactory):
"Factory for aspect ratio with both fixed and custom values."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the aspect ratio factory."
```
``` python
class BreakFactory:
def __init__(self):
"Initialize with sub-factories for before, after, and inside breaks."
super().__init__("Break utilities for controlling column and page breaks")
self.before = SimpleFactory(BREAK_BEFORE_VALUES, "Break-before utilities for controlling breaks before an element")
self.after = SimpleFactory(BREAK_AFTER_VALUES, "Break-after utilities for controlling breaks after an element")
self.inside = SimpleFactory(BREAK_INSIDE_VALUES, "Break-inside utilities for controlling breaks within an element")
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Factory for break utilities with before, after, and inside sub-factories."
def __init__(self):
"Initialize with sub-factories for before, after, and inside breaks."
super().__init__("Break utilities for controlling column and page breaks")
self.before = SimpleFactory(BREAK_BEFORE_VALUES, "Break-before utilities for controlling breaks before an element")
self.after = SimpleFactory(BREAK_AFTER_VALUES, "Break-after utilities for controlling breaks after an element")
self.inside = SimpleFactory(BREAK_INSIDE_VALUES, "Break-inside utilities for controlling breaks within an element")
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Initialize with sub-factories for before, after, and inside breaks."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the break factory."
```
``` python
class OverscrollFactory:
def __init__(self):
"Initialize with overscroll values and directional sub-factories."
super().__init__("Overscroll behavior utilities for controlling browser behavior at scroll boundaries")
# Create base overscroll utilities
self._values = {value: f"overscroll-{value}" for value in OVERSCROLL_VALUES}
"Factory for overscroll behavior utilities with directional support."
def __init__(self):
"Initialize with overscroll values and directional sub-factories."
super().__init__("Overscroll behavior utilities for controlling browser behavior at scroll boundaries")
# Create base overscroll utilities
self._values = {value: f"overscroll-{value}" for value in OVERSCROLL_VALUES}
"Initialize with overscroll values and directional sub-factories."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the overscroll factory."
```
#### Variables
``` python
DISPLAY_VALUES = {22 items} # Display utilities
display_tw # The display factory
POSITION_VALUES = {5 items} # Position utilities
position # The position factory
inset # The inset factory for positioning
OVERFLOW_VALUES = [5 items] # Overflow values
overflow # The overflow factory
Z_INDEX_CONFIG # Z-index configuration
z # The z-index factory
FLOAT_VALUES = {5 items}
float_tw # Renamed to avoid conflict with Python's float
CLEAR_VALUES = {6 items}
clear # The clear factory
OBJECT_FIT_VALUES = {5 items}
object_fit # The object fit factory
OBJECT_POSITION_VALUES = {9 items}
VISIBILITY_VALUES = {3 items}
visibility # The visibility factory
BOX_SIZING_VALUES = {2 items}
box # The box sizing factory
ISOLATION_VALUES = {2 items}
isolation # The isolation factory
ASPECT_RATIO_VALUES = {3 items}
aspect # The aspect ratio factory
COLUMNS_CONFIG # Columns configuration with container sizes
columns # The columns factory
BREAK_BEFORE_VALUES = {8 items}
BREAK_AFTER_VALUES = {8 items}
BREAK_INSIDE_VALUES = {4 items}
break_util # The break factory
BOX_DECORATION_VALUES = {2 items}
OVERSCROLL_VALUES = [3 items]
overscroll # The overscroll factory
```
### pattern_scanner (`pattern_scanner.ipynb`)
> Scan Python code for replaceable CSS class patterns
#### Import
``` python
from cjm_fasthtml_tailwind.cli.pattern_scanner import (
ClsPattern,
ClsPatternVisitor,
scan_python_code,
extract_css_classes_from_node,
display_patterns,
get_unique_css_classes,
AssertionPattern,
get_available_css_classes,
extract_assertion_patterns,
collect_all_assertion_patterns,
MatchType,
CSSClassMatch,
tokenize_css_class,
find_pattern_matches,
match_css_class,
match_css_classes,
display_match_results,
analyze_code_patterns,
display_code_analysis,
find_assertion_for_class,
find_pattern_examples,
get_migration_suggestions,
display_migration_suggestions,
analyze_and_suggest,
scan_python_file,
scan_jupyter_notebook,
InputType,
detect_input_type,
scan_input,
analyze_input,
display_input_analysis,
analyze_and_suggest_input
)
```
#### Functions
``` python
def scan_python_code(
code: str # Python source code as a string
) -> List[ClsPattern]: # List of ClsPattern objects found in the code
"Scan Python code for cls= patterns."
```
``` python
def extract_css_classes_from_node(
node: ast.AST # TODO: Add description
) -> List[str]: # TODO: Add return description
"""
Recursively extract CSS classes from an AST node.
Handles various patterns including combine_classes calls.
"""
```
``` python
def display_patterns(
patterns: List[ClsPattern], # List of ClsPattern objects to display
show_context: bool = True # Whether to show the code context
) -> None: # TODO: Add return description
"Display found patterns in a formatted way."
```
``` python
def get_unique_css_classes(
patterns: List[ClsPattern] # List of ClsPattern objects
) -> Set[str]: # Set of unique CSS class strings
"Extract all unique CSS classes from a list of patterns."
```
``` python
def get_available_css_classes(
assertion_patterns: List[AssertionPattern] # List of assertion patterns from test examples
) -> Set[str]: # Set of unique CSS class strings available in the library
"Extract all unique CSS classes from assertion patterns. This handles multi-class assertion strings by splitting them."
```
``` python
def extract_assertion_patterns(
source_code: str, # Source code of the test function
module_name: str, # Name of the module containing the test
example_name: str # Name of the test function
) -> List[AssertionPattern]: # List of AssertionPattern objects
"Extract assertion patterns from test example source code."
```
``` python
def collect_all_assertion_patterns(
) -> List[AssertionPattern]: # List of AssertionPattern objects from all modules
"Collect assertion patterns from all test examples in the library."
```
``` python
def tokenize_css_class(
css_class: str # CSS class string (e.g., "bg-blue-500" or "hover:text-white")
) -> List[str]: # List of tokens (e.g., ["bg", "blue", "500"] or ["hover:text", "white"])
"Tokenize a CSS class by splitting on hyphens. Handles modifiers (hover:, focus:, etc.) separately."
```
``` python
def find_pattern_matches(
css_class: str, # CSS class to match (e.g., "px-8" or "hover:text-white")
available_classes: Set[str] # Set of available CSS classes from the library
) -> Tuple[Optional[str], List[str]]: # Tuple of (matched_pattern, similar_classes) - matched_pattern: Pattern prefix that matches (e.g., "px" for "px-8") - similar_classes: List of similar classes with the same pattern
"Find pattern matches for a CSS class by progressively reducing tokens."
```
``` python
def match_css_class(
css_class: str, # CSS class to match
available_classes: Set[str] # Set of available CSS classes from the library
) -> CSSClassMatch: # CSSClassMatch object with match details
"Match a CSS class against available library classes."
```
``` python
def match_css_classes(
css_classes: List[str], # List of CSS classes to match
available_classes: Set[str] # Set of available CSS classes from the library
) -> Dict[str, CSSClassMatch]: # Dictionary mapping CSS classes to their match results
"Match multiple CSS classes against available library classes."
```
``` python
def display_match_results(
matches: Dict[str, CSSClassMatch] # Dictionary of CSS classes to their match results
) -> None: # TODO: Add return description
"Display match results in a formatted way."
```
``` python
def analyze_code_patterns(
code: str # Python source code to analyze
) -> Dict[str, Any]: # Dictionary with analysis results including patterns found and suggestions
"Analyze Python code for replaceable CSS patterns."
```
``` python
def display_code_analysis(
code: str # Python source code to analyze
) -> None: # TODO: Add return description
"Analyze and display replaceable patterns in Python code."
```
``` python
def find_assertion_for_class(
css_class: str, # The CSS class to find (e.g., "px-6")
assertion_patterns: List[AssertionPattern] # List of all assertion patterns from tests
) -> Optional[AssertionPattern]: # AssertionPattern if found, None otherwise
"Find the assertion pattern that demonstrates how to use a specific CSS class. Prioritizes exact single-class matches over multi-class assertions."
```
``` python
def find_pattern_examples(
pattern_prefix: str, # Pattern prefix to match (e.g., "px" for px-* pattern)
assertion_patterns: List[AssertionPattern] # List of all assertion patterns from tests
) -> List[AssertionPattern]: # List of AssertionPattern objects that match the pattern
"Find assertion examples that match a pattern prefix."
```
``` python
def get_migration_suggestions(
matches: Dict[str, CSSClassMatch], # Dictionary of CSS class matches
assertion_patterns: List[AssertionPattern] # List of all assertion patterns from tests
) -> Dict[str, List[str]]: # Dictionary mapping CSS classes to their migration suggestions
"Generate migration suggestions for matched CSS classes."
```
``` python
def display_migration_suggestions(
code: str # Python source code to analyze
) -> None: # TODO: Add return description
"Analyze code and display migration suggestions."
```
``` python
def analyze_and_suggest(
code: str # Python source code to analyze
) -> None: # TODO: Add return description
"Perform complete analysis of code with migration suggestions."
```
``` python
def scan_python_file(
file_path: str # Path to the Python file
) -> List[ClsPattern]: # List of ClsPattern objects found in the file
"Scan a Python file for cls= patterns."
```
``` python
def scan_jupyter_notebook(
notebook_path: str # Path to the Jupyter notebook (.ipynb)
) -> List[ClsPattern]: # List of ClsPattern objects found in the notebook
"Scan a Jupyter notebook for cls= patterns."
```
``` python
def detect_input_type(
input_source: str # Code string or file path
) -> InputType: # InputType enum value
"Detect the type of input based on the source string."
```
``` python
def scan_input(
input_source: str, # Code string, Python file path, or notebook path
input_type: Optional[InputType] = None # Optional explicit input type. If None, will auto-detect.
) -> List[ClsPattern]: # List of ClsPattern objects found
"Scan various input types for cls= patterns."
```
``` python
def analyze_input(
input_source: str, # Code string, Python file path, or notebook path
input_type: Optional[InputType] = None # Optional explicit input type. If None, will auto-detect.
) -> Dict[str, Any]: # Dictionary with analysis results
"Analyze any input type for replaceable CSS patterns."
```
``` python
def display_input_analysis(
input_source: str, # Code string, Python file path, or notebook path
input_type: Optional[InputType] = None # Optional explicit input type. If None, will auto-detect.
) -> None: # TODO: Add return description
"Analyze and display replaceable patterns from any input type."
```
``` python
def analyze_and_suggest_input(
input_source: str, # Code string, Python file path, or notebook path
input_type: Optional[InputType] = None # Optional explicit input type. If None, will auto-detect.
) -> None: # TODO: Add return description
"Perform complete analysis with migration suggestions for any input type."
```
#### Classes
``` python
@dataclass
class ClsPattern:
"Represents a cls= pattern found in code."
line_number: int # Line number where pattern was found
full_expression: str # The full cls=... expression
css_classes: List[str] # Individual CSS classes extracted
context: str # Code context around the pattern
uses_combine_classes: bool # Whether combine_classes is used
```
``` python
class ClsPatternVisitor:
def __init__(
self,
source_lines: List[str] # TODO: Add description
)
"AST visitor to find cls= patterns in Python code."
def __init__(
self,
source_lines: List[str] # TODO: Add description
)
"Initialize with source code lines for context extraction."
def visit_Call(
self,
node: ast.Call # TODO: Add description
) -> None: # TODO: Add return description
"Visit function calls to find cls= keyword arguments."
```
``` python
@dataclass
class AssertionPattern:
"Represents a pattern extracted from a test assertion."
css_class: str # The CSS class string (e.g., "p-4")
factory_expression: str # The factory expression (e.g., "p(4)")
module_name: str # Module where this was found
example_name: str # Test function name
```
``` python
class MatchType(Enum):
"Type of match found for a CSS class."
```
``` python
@dataclass
class CSSClassMatch:
"Represents a match result for a CSS class."
css_class: str # The CSS class being matched
match_type: MatchType # Type of match found
matched_pattern: Optional[str] # The pattern it matches (for PATTERN type)
similar_classes: List[str] # Similar classes found in library
suggested_replacement: Optional[str] # Suggested replacement from library
```
``` python
class InputType(Enum):
"Type of input being scanned."
```
### resources (`resources.ipynb`)
> CDN resources and headers for Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.core.resources import (
TAILWIND_CDN,
get_tailwind_headers
)
```
#### Functions
``` python
def get_tailwind_headers(
) -> List[Union[Link, Script]]: # List of Link and Script elements for Tailwind CSS
"Get the standard Tailwind CSS CDN headers."
```
#### Variables
``` python
TAILWIND_CDN = 'https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4'
```
### scales (`scales.ipynb`)
> Numeric and named scale builders for Tailwind CSS utilities
#### Import
``` python
from cjm_fasthtml_tailwind.builders.scales import (
NUMERIC_SCALE,
DECIMAL_SCALE,
SPACING_SCALE,
FRACTION_DENOMINATORS,
FRACTIONS,
SPACING_CONFIG,
SIZE_CONFIG,
INSET_CONFIG,
generate_fractions,
ScaleConfig,
ScaledUtility,
ScaledFactory,
NegativeFactory,
DirectionalScaledUtility,
DirectionalScaledFactory,
list_scale_values,
SimpleFactory
)
```
#### Functions
``` python
def generate_fractions(
) -> List[str]: # List of all valid Tailwind fraction strings sorted by value
"Generate all valid Tailwind fractions."
```
``` python
def list_scale_values(
config: ScaleConfig # The scale configuration to extract values from
) -> Dict[str, List[Union[str, int, float]]]: # Dictionary mapping scale types to their values
"List all possible values for a scale configuration."
```
#### Classes
``` python
@dataclass
class ScaleConfig:
"Configuration for a scale builder."
numeric: bool = True # Support numeric scales (0-96)
decimals: bool = False # Support decimal scales (0.5, 1.5, etc.)
fractions: bool = False # Support fractions (1/2, 1/3, etc.)
named: Optional[List[NamedScale]] # Named scales (xs, sm, md, etc.)
special: Optional[Dict[str, str]] # Special values (auto, full, screen, etc.)
negative: bool = False # Support negative values
```
``` python
class ScaledUtility:
def __init__(
self,
prefix: str, # The utility prefix (e.g., 'w', 'h', 'p')
config: ScaleConfig, # Configuration defining valid scales and values
negative: bool = False # Whether this is a negative variant
)
"Utility class with scale support."
def __init__(
self,
prefix: str, # The utility prefix (e.g., 'w', 'h', 'p')
config: ScaleConfig, # Configuration defining valid scales and values
negative: bool = False # Whether this is a negative variant
)
"Initialize with prefix and scale configuration."
def get_valid_values(
self
) -> List[Union[str, int, float]]: # List of all valid values for this utility
"Get all valid values for this utility."
```
``` python
class ScaledFactory:
def __init__(
self,
prefix: Optional[str] = None, # The utility prefix (e.g., 'w', 'h', 'p')
config: Optional[ScaleConfig] = None, # Configuration defining valid scales and values
doc: Optional[str] = None # Optional documentation string
)
"Factory for creating scaled utilities with enhanced attribute access."
def __init__(
self,
prefix: Optional[str] = None, # The utility prefix (e.g., 'w', 'h', 'p')
config: Optional[ScaleConfig] = None, # Configuration defining valid scales and values
doc: Optional[str] = None # Optional documentation string
)
"Initialize with prefix and scale configuration."
def negative(
self
) -> 'NegativeFactory': # A factory for creating negative variants
"Return a negative variant factory."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get detailed information about this scaled factory."
```
``` python
class NegativeFactory:
def __init__(
self,
prefix: str, # The utility prefix (e.g., 'm', 'inset')
config: ScaleConfig # Configuration defining valid scales and values
)
"Factory for creating negative variants."
def __init__(
self,
prefix: str, # The utility prefix (e.g., 'm', 'inset')
config: ScaleConfig # Configuration defining valid scales and values
)
"Initialize with prefix and scale configuration."
```
``` python
class DirectionalScaledUtility:
def __init__(
self,
prefix: str, # The base utility prefix (e.g., 'p' for padding)
direction: Optional[str], # The direction suffix ('t', 'r', 'b', 'l', 'x', 'y')
config: ScaleConfig, # Configuration defining valid scales and values
negative: bool = False # Whether this is a negative variant
)
"Directional utility with scale support."
def __init__(
self,
prefix: str, # The base utility prefix (e.g., 'p' for padding)
direction: Optional[str], # The direction suffix ('t', 'r', 'b', 'l', 'x', 'y')
config: ScaleConfig, # Configuration defining valid scales and values
negative: bool = False # Whether this is a negative variant
)
"Initialize with prefix, direction, and scale configuration."
```
``` python
class DirectionalScaledFactory:
def __init__(
self,
prefix: str, # The base utility prefix (e.g., 'p' for padding, 'm' for margin)
config: ScaleConfig, # Configuration defining valid scales and values
doc: Optional[str] = None # Optional documentation string
)
"Factory for creating directional scaled utilities."
def __init__(
self,
prefix: str, # The base utility prefix (e.g., 'p' for padding, 'm' for margin)
config: ScaleConfig, # Configuration defining valid scales and values
doc: Optional[str] = None # Optional documentation string
)
"Initialize with prefix and scale configuration."
def negative(
self
) -> 'NegativeFactory': # A factory for creating negative variants
"Return a negative variant factory."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get detailed information about this directional factory."
```
``` python
class SimpleFactory:
def __init__(
self,
values_dict: Optional[Dict[str, str]] = None, # Dictionary mapping attribute names to CSS values
doc: Optional[str] = None # Optional documentation string
)
"Factory for utilities that are simple string values with modifier support."
def __init__(
self,
values_dict: Optional[Dict[str, str]] = None, # Dictionary mapping attribute names to CSS values
doc: Optional[str] = None # Optional documentation string
)
"Initialize with a dictionary of values."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about this simple factory."
```
#### Variables
``` python
NUMERIC_SCALE # Standard spacing scale (0-96)
DECIMAL_SCALE = [4 items] # Common decimal scales
SPACING_SCALE # Extended spacing scale with decimals
FRACTION_DENOMINATORS = [6 items] # Fraction denominators supported by Tailwind
FRACTIONS # Pre-generate fractions
SPACING_CONFIG # Spacing configuration (padding, margin, gap)
SIZE_CONFIG # Size configuration (width, height)
INSET_CONFIG # Inset configuration (top, right, bottom, left)
```
### Search Functions (`search.ipynb`)
> Functions to search across all library components:
#### Import
``` python
from cjm_fasthtml_tailwind.cli.search import (
search_factories,
search_examples,
search_helpers,
search_modules,
search_all
)
```
#### Functions
``` python
def search_factories(
query: str, # Search query
include_source: bool = False, # Whether to search in source code
case_sensitive: bool = False # Whether to perform case-sensitive search
) -> List[SearchResult]: # List of search results
"Search in all factories."
```
``` python
def search_examples(
query: str, # Search query
include_source: bool = False, # Whether to search in source code
case_sensitive: bool = False # Whether to perform case-sensitive search
) -> List[SearchResult]: # List of search results
"Search in all test examples."
```
``` python
def search_helpers(
query: str, # Search query
include_source: bool = False, # Whether to search in source code
case_sensitive: bool = False # Whether to perform case-sensitive search
) -> List[SearchResult]: # List of search results
"Search in all helper functions."
```
``` python
def search_modules(
query: str, # Search query
case_sensitive: bool = False # Whether to perform case-sensitive search
) -> List[SearchResult]: # List of search results
"Search in module names and documentation."
```
``` python
def search_all(
query: str, # Search query
content_types: Optional[List[str]] = None, # Types to search in ('factories', 'examples', 'helpers', 'modules')
include_source: bool = False, # Whether to search in source code
case_sensitive: bool = False # Whether to perform case-sensitive search
) -> List[SearchResult]: # List of all search results
"Search across all content types."
```
### sizing (`sizing.ipynb`)
> Width, height, and min/max sizing utilities for Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.utilities.sizing import (
w,
h,
min_w,
max_w,
container,
min_h,
max_h,
size_util,
test_sizing_width_examples,
test_sizing_width_named_examples,
test_sizing_width_viewport_examples,
test_sizing_arbitrary_examples,
test_sizing_height_examples,
test_sizing_height_viewport_examples,
test_sizing_min_width_examples,
test_sizing_max_width_examples,
test_sizing_container_examples,
test_sizing_min_height_examples,
test_sizing_size_util_examples,
test_sizing_max_height_examples,
test_sizing_practical_examples,
test_sizing_factory_documentation,
size,
square,
full_size,
full_screen,
test_sizing_helper_examples
)
```
#### Functions
``` python
def test_sizing_width_examples(
)
"Test width utilities with various scales and values."
```
``` python
def test_sizing_width_named_examples(
)
"Test width utilities with named container sizes."
```
``` python
def test_sizing_width_viewport_examples(
)
"Test width utilities with viewport units."
```
``` python
def test_sizing_arbitrary_examples(
)
"Test sizing utilities with arbitrary and custom values."
```
``` python
def test_sizing_height_examples(
)
"Test height utilities with various scales and values."
```
``` python
def test_sizing_height_viewport_examples(
)
"Test height utilities with viewport units."
```
``` python
def test_sizing_min_width_examples(
)
"Test min-width utilities."
```
``` python
def test_sizing_max_width_examples(
)
"Test max-width utilities."
```
``` python
def test_sizing_container_examples(
)
"Test continer utility."
```
``` python
def test_sizing_min_height_examples(
)
"Test min-height utilities."
```
``` python
def test_sizing_size_util_examples(
)
"Test size utilities that set both width and height."
```
``` python
def test_sizing_max_height_examples(
)
"Test max-height utilities."
```
``` python
def test_sizing_practical_examples(
)
"Test sizing utilities in practical FastHTML component examples."
```
``` python
def test_sizing_factory_documentation(
)
"Test that factories have accessible documentation."
```
``` python
def size(
w: Optional[TailwindScale] = None, # Width value
h: Optional[TailwindScale] = None, # Height value
min_w: Optional[TailwindScale] = None, # Minimum width
max_w: Optional[TailwindScale] = None, # Maximum width
min_h: Optional[TailwindScale] = None, # Minimum height
max_h: Optional[TailwindScale] = None # Maximum height
) -> str: # Space-separated size classes
"Generate size classes with a convenient API."
```
``` python
def square(
size: TailwindScale # Size value for both width and height
) -> str: # Space-separated width and height classes
"Create a square element with equal width and height."
```
``` python
def full_size(
) -> str: # "w-full h-full"
"Make element take full width and height of parent."
```
``` python
def full_screen(
) -> str: # "w-screen h-screen"
"Make element take full viewport width and height."
```
``` python
def test_sizing_helper_examples(
)
"Test helper functions for common sizing patterns."
```
#### Variables
``` python
w # The width factory
h # The height factory
min_w # The min-width factory
max_w # The max-width factory
min_h # The min-height factory
max_h # The max-height factory
size_util # The size factory (sets both width and height)
```
### spacing (`spacing.ipynb`)
> Padding and margin utilities for Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.utilities.spacing import (
p,
ps,
pe,
m,
ms,
me,
space,
test_spacing_basic_examples,
test_spacing_directional_examples,
test_spacing_arbitrary_examples,
test_spacing_margin_examples,
test_spacing_margin_directional_examples,
test_spacing_negative_examples,
test_spacing_logical_examples,
SpaceFactory,
test_spacing_space_between_examples,
test_spacing_practical_examples,
pad,
margin,
test_spacing_helper_examples,
test_spacing_modifier_examples,
test_spacing_enhanced_factory_examples,
test_spacing_factory_documentation
)
```
#### Functions
``` python
def test_spacing_basic_examples(
)
"Test basic padding utilities with various scale values."
```
``` python
def test_spacing_directional_examples(
)
"Test directional padding utilities."
```
``` python
def test_spacing_arbitrary_examples(
)
"Test padding utilities with arbitrary and custom values."
```
``` python
def test_spacing_margin_examples(
)
"Test basic margin utilities with various scale values."
```
``` python
def test_spacing_margin_directional_examples(
)
"Test directional margin utilities."
```
``` python
def test_spacing_negative_examples(
)
"Test negative margin utilities."
```
``` python
def test_spacing_logical_examples(
)
"Test logical properties for padding and margin utilities."
```
``` python
def test_spacing_space_between_examples(
)
"Test space between child elements utilities."
```
``` python
def test_spacing_practical_examples(
)
"Test spacing utilities in practical FastHTML component examples."
```
``` python
def pad(
all: Optional[TailwindScale] = None, # Padding for all sides
x: Optional[TailwindScale] = None, # Horizontal padding
y: Optional[TailwindScale] = None, # Vertical padding
t: Optional[TailwindScale] = None, # Top padding
r: Optional[TailwindScale] = None, # Right padding
b: Optional[TailwindScale] = None, # Bottom padding
l: Optional[TailwindScale] = None # Left padding
) -> str: # Space-separated padding classes
"Generate padding classes with a convenient API."
```
``` python
def margin(
all: Optional[TailwindScale] = None, # Margin for all sides
x: Optional[TailwindScale] = None, # Horizontal margin
y: Optional[TailwindScale] = None, # Vertical margin
t: Optional[TailwindScale] = None, # Top margin
r: Optional[TailwindScale] = None, # Right margin
b: Optional[TailwindScale] = None, # Bottom margin
l: Optional[TailwindScale] = None, # Left margin
negative: bool = False # Apply negative margins
) -> str: # Space-separated margin classes
"Generate margin classes with a convenient API."
```
``` python
def test_spacing_helper_examples(
)
"Test helper functions for common spacing patterns."
```
``` python
def test_spacing_modifier_examples(
)
"Test spacing utilities with modifiers for conditional styling."
```
``` python
def test_spacing_enhanced_factory_examples(
)
"Test enhanced SingleValueFactory support in spacing utilities."
```
``` python
def test_spacing_factory_documentation(
)
"Test that factories have accessible documentation."
```
#### Classes
``` python
class SpaceFactory:
def __init__(self):
"""Initialize with scaled factories and reverse utilities."""
super().__init__("Space utilities for adding consistent spacing between child elements")
self.x = ScaledFactory("space-x", SPACING_CONFIG, "Horizontal spacing between child elements")
self.y = ScaledFactory("space-y", SPACING_CONFIG, "Vertical spacing between child elements")
self.x_reverse = SingleValueFactory("space-x-reverse", "Reverse the order of horizontal spacing")
self.y_reverse = SingleValueFactory("space-y-reverse", "Reverse the order of vertical spacing")
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Special factory for space utilities that control spacing between child elements."
def __init__(self):
"""Initialize with scaled factories and reverse utilities."""
super().__init__("Space utilities for adding consistent spacing between child elements")
self.x = ScaledFactory("space-x", SPACING_CONFIG, "Horizontal spacing between child elements")
self.y = ScaledFactory("space-y", SPACING_CONFIG, "Vertical spacing between child elements")
self.x_reverse = SingleValueFactory("space-x-reverse", "Reverse the order of horizontal spacing")
self.y_reverse = SingleValueFactory("space-y-reverse", "Reverse the order of vertical spacing")
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Initialize with scaled factories and reverse utilities."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the space factory."
```
#### Variables
``` python
p # The padding factory
ps # padding-inline-start
pe # padding-inline-end
m # The margin factory
ms # margin-inline-start
me # margin-inline-end
space # The space factory
```
### svg (`svg.ipynb`)
> SVG utilities for Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.utilities.svg import (
fill_none,
fill,
stroke_none,
stroke,
STROKE_WIDTH_CONFIG,
stroke_width,
test_svg_fill_examples,
test_svg_fill_opacity_examples,
test_svg_fill_arbitrary_examples,
test_svg_stroke_examples,
test_svg_stroke_opacity_examples,
StrokeWidthFactory,
test_svg_stroke_width_examples,
test_svg_stroke_width_arbitrary_examples,
test_svg_practical_examples,
test_svg_icon_examples,
test_svg_progress_ring_examples,
test_svg_factory_documentation,
test_svg_edge_cases,
svg_icon_classes,
test_svg_helper_functions
)
```
#### Functions
``` python
def test_svg_fill_examples()
"Test fill color utilities with various color values."
```
``` python
def test_svg_fill_opacity_examples()
"Test fill colors with opacity modifiers."
```
``` python
def test_svg_fill_arbitrary_examples()
"Test fill utilities with arbitrary and custom values."
```
``` python
def test_svg_stroke_examples()
"Test stroke color utilities with various color values."
```
``` python
def test_svg_stroke_opacity_examples()
"Test stroke colors with opacity modifiers."
```
``` python
def test_svg_stroke_width_examples()
"Test stroke width utilities with various values."
```
``` python
def test_svg_stroke_width_arbitrary_examples()
"Test stroke width utilities with arbitrary and custom values."
```
``` python
def test_svg_practical_examples()
"Test SVG utilities in practical FastHTML component examples."
```
``` python
def test_svg_icon_examples():
"""Test creating reusable SVG icon components."""
from fasthtml.common import Div
from fasthtml.svg import Svg, Path
from cjm_fasthtml_tailwind.utilities.sizing import w, h
from cjm_fasthtml_tailwind.utilities.flexbox_and_grid import items, justify
from cjm_fasthtml_tailwind.utilities.layout import display_tw
# Helper function to create an icon
def Icon(path_d: str, size: int = 6, color_cls: str = "")
"Test creating reusable SVG icon components."
```
``` python
def test_svg_progress_ring_examples():
"""Test creating a progress ring component."""
from fasthtml.common import Div
from fasthtml.svg import Svg, Circle
from cjm_fasthtml_tailwind.utilities.sizing import w, h
from cjm_fasthtml_tailwind.utilities.layout import display_tw, position
# Progress ring component
def ProgressRing(percentage: int, size: int = 120)
"Test creating a progress ring component."
```
``` python
def test_svg_factory_documentation()
"Test that SVG factories have accessible documentation."
```
``` python
def test_svg_edge_cases()
"Test edge cases and special values for SVG utilities."
```
``` python
def svg_icon_classes(
fill_color: Optional[Union[str, ColoredUtility]] = None, # Fill color class or utility
stroke_color: Optional[Union[str, ColoredUtility]] = None, # Stroke color class or utility
width: Union[int, str] = 2, # Stroke width value
size: int = 6, # Icon size (numeric value for w and h)
extra_classes: str = "" # Additional classes to include
) -> str: # Combined class string for SVG icon
"Generate common SVG icon classes."
```
``` python
def test_svg_helper_functions()
"Test SVG helper functions."
```
#### Classes
``` python
class StrokeWidthFactory:
def __init__(self):
"""Initialize with stroke width configuration."""
super().__init__("stroke", STROKE_WIDTH_CONFIG, "Stroke width utilities for styling the stroke width of SVG elements")
# Override the numeric scale to only include 0, 1, 2
self._valid_values = [0, 1, 2]
def __call__(
self,
value: Optional[TailwindValue] = None, # The stroke width value
negative: bool = False # Not applicable for stroke width
) -> StandardUtility: # A stroke width utility instance
"Factory for stroke-width utilities with restricted numeric scale (0-2)."
def __init__(self):
"""Initialize with stroke width configuration."""
super().__init__("stroke", STROKE_WIDTH_CONFIG, "Stroke width utilities for styling the stroke width of SVG elements")
# Override the numeric scale to only include 0, 1, 2
self._valid_values = [0, 1, 2]
def __call__(
self,
value: Optional[TailwindValue] = None, # The stroke width value
negative: bool = False # Not applicable for stroke width
) -> StandardUtility: # A stroke width utility instance
"Initialize with stroke width configuration."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get detailed information about the stroke width factory."
```
#### Variables
``` python
fill_none # Remove fill
fill # The fill color factory
stroke_none # Remove stroke
stroke # The stroke color factory
STROKE_WIDTH_CONFIG
stroke_width # The stroke width factory
```
### tables (`tables.ipynb`)
> Table utilities for Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.utilities.tables import (
border_collapse,
border_spacing,
table_layout,
caption_side,
test_tables_border_collapse_examples,
BorderSpacingFactory,
test_tables_border_spacing_basic_examples,
test_tables_border_spacing_directional_examples,
test_tables_border_spacing_arbitrary_examples,
test_tables_layout_examples,
test_tables_caption_side_examples,
test_tables_all_utilities,
test_tables_practical_examples,
test_tables_complex_example,
test_tables_factory_documentation
)
```
#### Functions
``` python
def test_tables_border_collapse_examples()
"Test border collapse utilities."
```
``` python
def test_tables_border_spacing_basic_examples()
"Test basic border spacing utilities."
```
``` python
def test_tables_border_spacing_directional_examples()
"Test directional border spacing utilities."
```
``` python
def test_tables_border_spacing_arbitrary_examples()
"Test border spacing utilities with arbitrary values."
```
``` python
def test_tables_layout_examples()
"Test table layout utilities."
```
``` python
def test_tables_caption_side_examples()
"Test caption side utilities."
```
``` python
def test_tables_all_utilities()
"Comprehensive test of all table utilities."
```
``` python
def test_tables_practical_examples()
"Test table utilities in practical FastHTML component examples."
```
``` python
def test_tables_complex_example()
"Test a complex table example with various styling."
```
``` python
def test_tables_factory_documentation()
"Test that table factories have accessible documentation."
```
#### Classes
``` python
class BorderSpacingFactory:
def __init__(self):
"""Initialize with scaled factories for directional variants."""
super().__init__("Border spacing utilities for controlling the spacing between table borders")
# Create scaled factories with properly hyphenated prefixes
self._base = ScaledFactory("border-spacing", SPACING_CONFIG, "All sides border spacing")
self.x = ScaledFactory("border-spacing-x", SPACING_CONFIG, "Horizontal border spacing")
self.y = ScaledFactory("border-spacing-y", SPACING_CONFIG, "Vertical border spacing")
def __call__(
self,
value: Optional[TailwindScale] = None # The spacing value
) -> StandardUtility: # A border spacing utility for all sides
"Factory for border-spacing utilities with directional support."
def __init__(self):
"""Initialize with scaled factories for directional variants."""
super().__init__("Border spacing utilities for controlling the spacing between table borders")
# Create scaled factories with properly hyphenated prefixes
self._base = ScaledFactory("border-spacing", SPACING_CONFIG, "All sides border spacing")
self.x = ScaledFactory("border-spacing-x", SPACING_CONFIG, "Horizontal border spacing")
self.y = ScaledFactory("border-spacing-y", SPACING_CONFIG, "Vertical border spacing")
def __call__(
self,
value: Optional[TailwindScale] = None # The spacing value
) -> StandardUtility: # A border spacing utility for all sides
"Initialize with scaled factories for directional variants."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the border spacing factory."
```
#### Variables
``` python
border_spacing # The border spacing factory
```
### Test Code Functionality (`test_code.ipynb`)
> Functions to test code snippets using the library:
#### Import
``` python
from cjm_fasthtml_tailwind.cli.test_code import (
create_test_script,
execute_test_code
)
```
#### Functions
``` python
def create_test_script(
code: str # TODO: Add description
) -> str: # TODO: Add return description
"Create a test script with necessary imports and the provided code."
```
``` python
def execute_test_code(
code: str, # The code to test
show_imports: bool = False, # Whether to show the generated imports
timeout: int = 10 # Timeout in seconds
) -> Tuple[bool, str, str]: # (success, stdout, stderr)
"Execute test code in a safe environment."
```
### testing (`testing.ipynb`)
> Standardized test page creation for Jupyter notebooks with FastHTML
#### Import
``` python
from cjm_fasthtml_tailwind.core.testing import (
create_test_app,
create_test_page,
start_test_server
)
```
#### Functions
``` python
def create_test_app(
debug: bool = True # Enable debug mode
) -> tuple: # Tuple containing (app, rt) - FastHTML app instance and route decorator
"Create a standardized test app for Jupyter notebooks with Tailwind."
```
``` python
def create_test_page(
title: str, # Page title
*content, # Page content elements
container: bool = True, # Wrap in container
custom_theme_names: Optional[List[str]] = None # Custom themes for selector
) -> Div: # Div containing complete page layout with navbar and content
"Create a standardized test page layout with optional theme selector."
```
``` python
def start_test_server(
app: FastHTML, # FastHTML app instance created by create_test_app or fast_app
port: int = 8000, # Port
) -> JupyUvi: # JupyUvi server instance for Jupyter notebook testing
"""
Start a test server and return the JupyUvi instance.
Usage:
server = start_test_server(app)
HTMX() # Display the app
# Later, in another cell:
server.stop()
"""
```
### transforms (`transforms.ipynb`)
> Transform, rotate, scale, skew, translate and other transformation
> utilities for Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.utilities.transforms import (
BACKFACE_VALUES,
backface,
PERSPECTIVE_VALUES,
perspective,
PERSPECTIVE_ORIGIN_VALUES,
perspective_origin,
ROTATE_ANGLES,
ROTATE_CONFIG,
rotate,
SCALE_VALUES,
SCALE_CONFIG,
scale_tw,
SKEW_ANGLES,
skew,
TRANSFORM_VALUES,
transform,
TRANSFORM_ORIGIN_VALUES,
origin,
TRANSFORM_STYLE_VALUES,
transform_style,
TRANSLATE_CONFIG,
translate,
test_transforms_backface_examples,
PerspectiveFactory,
test_transforms_perspective_examples,
PerspectiveOriginFactory,
test_transforms_perspective_origin_examples,
RotateUtility,
RotateFactory,
NegativeRotateFactory,
test_transforms_rotate_examples,
ScaleUtility,
ScaleFactory,
NegativeScaleFactory,
test_transforms_scale_examples,
SkewUtility,
SkewFactory,
NegativeSkewFactory,
test_transforms_skew_examples,
TransformFactory,
test_transforms_transform_examples,
TransformOriginFactory,
test_transforms_origin_examples,
test_transforms_style_examples,
TranslateFactory,
test_transforms_translate_examples,
test_transforms_practical_examples,
center_transform,
hover_scale,
flip_card_3d,
parallax_transform,
test_transforms_helper_examples,
test_transforms_factory_documentation
)
```
#### Functions
``` python
def test_transforms_backface_examples()
"Test backface visibility utilities."
```
``` python
def test_transforms_perspective_examples()
"Test perspective utilities."
```
``` python
def test_transforms_perspective_origin_examples()
"Test perspective origin utilities."
```
``` python
def test_transforms_rotate_examples()
"Test rotate utilities."
```
``` python
def test_transforms_scale_examples()
"Test scale utilities."
```
``` python
def test_transforms_skew_examples()
"Test skew utilities."
```
``` python
def test_transforms_transform_examples()
"Test transform utilities."
```
``` python
def test_transforms_origin_examples()
"Test transform origin utilities."
```
``` python
def test_transforms_style_examples()
"Test transform style utilities."
```
``` python
def test_transforms_translate_examples()
"Test translate utilities."
```
``` python
def test_transforms_practical_examples()
"Test transform utilities in practical FastHTML component examples."
```
``` python
def center_transform() -> str
"Center an element using transform translate."
```
``` python
def hover_scale(scale: int = 110) -> str
"Create a hover scale effect."
```
``` python
def flip_card_3d(perspective_value: str = "normal") -> Dict[str, str]:
"""Get classes for a 3D flip card effect."""
return {
"container": str(getattr(perspective, perspective_value)),
"Get classes for a 3D flip card effect."
```
``` python
def parallax_transform(speed: float = 0.5) -> str
"Create a parallax transform effect."
```
``` python
def test_transforms_helper_examples()
"Test helper functions for common transform patterns."
```
``` python
def test_transforms_factory_documentation()
"Test that transform factories have accessible documentation."
```
#### Classes
``` python
class PerspectiveFactory(SimpleFactory):
"Factory for perspective with both named and custom values."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the perspective factory."
```
``` python
class PerspectiveOriginFactory(SimpleFactory):
"Factory for perspective origin with both fixed and custom values."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the perspective origin factory."
```
``` python
class RotateUtility(StandardUtility):
"Utility class for rotation with angle support."
```
``` python
class RotateFactory:
def __init__(self):
"""Initialize with directional sub-factories."""
super().__init__("Rotate utilities for rotating elements")
self.x = ScaledFactory("rotate-x", ROTATE_CONFIG, "Rotate around X axis")
self.y = ScaledFactory("rotate-y", ROTATE_CONFIG, "Rotate around Y axis")
self.z = ScaledFactory("rotate-z", ROTATE_CONFIG, "Rotate around Z axis")
def __call__(self, value: TailwindValue, negative: bool = False) -> RotateUtility
"Factory for rotation utilities with directional support."
def __init__(self):
"""Initialize with directional sub-factories."""
super().__init__("Rotate utilities for rotating elements")
self.x = ScaledFactory("rotate-x", ROTATE_CONFIG, "Rotate around X axis")
self.y = ScaledFactory("rotate-y", ROTATE_CONFIG, "Rotate around Y axis")
self.z = ScaledFactory("rotate-z", ROTATE_CONFIG, "Rotate around Z axis")
def __call__(self, value: TailwindValue, negative: bool = False) -> RotateUtility
"Initialize with directional sub-factories."
def negative(self) -> 'NegativeRotateFactory':
"""Return a negative variant factory."""
return NegativeRotateFactory()
def get_info(self) -> Dict[str, Any]
"Return a negative variant factory."
def get_info(self) -> Dict[str, Any]:
"""Get information about the rotate factory."""
return {
'description': self._doc,
"Get information about the rotate factory."
```
``` python
class NegativeRotateFactory:
"Factory for negative rotation utilities."
```
``` python
class ScaleUtility(StandardUtility):
"Utility class for scaling with percentage support."
```
``` python
class ScaleFactory:
def __init__(self)
"Factory for scale utilities with directional and 3D support."
def __init__(self)
"Initialize with directional sub-factories."
def negative(self) -> 'NegativeScaleFactory':
"""Return a negative variant factory."""
return NegativeScaleFactory()
def get_info(self) -> Dict[str, Any]
"Return a negative variant factory."
def get_info(self) -> Dict[str, Any]:
"""Get information about the scale factory."""
return {
'description': self._doc,
"Get information about the scale factory."
```
``` python
class NegativeScaleFactory:
"Factory for negative scale utilities."
```
``` python
class SkewUtility(StandardUtility):
"Utility class for skewing with angle support."
```
``` python
class SkewFactory:
def __init__(self)
"Factory for skew utilities with directional support."
def __init__(self)
"Initialize with directional sub-factories."
def negative(self) -> 'NegativeSkewFactory':
"""Return a negative variant factory."""
return NegativeSkewFactory()
def get_info(self) -> Dict[str, Any]
"Return a negative variant factory."
def get_info(self) -> Dict[str, Any]:
"""Get information about the skew factory."""
return {
'description': self._doc,
"Get information about the skew factory."
```
``` python
class NegativeSkewFactory:
"Factory for negative skew utilities."
```
``` python
class TransformFactory(SimpleFactory):
"Factory for transform utilities with special and custom values."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the transform factory."
```
``` python
class TransformOriginFactory(SimpleFactory):
"Factory for transform origin with both fixed and custom values."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the transform origin factory."
```
``` python
class TranslateFactory:
def __init__(self):
"""Initialize with directional sub-factories."""
super().__init__("Translate utilities for translating elements")
# Create directional translate factories
self.x = ScaledFactory("translate-x", TRANSLATE_CONFIG, "Translate along X axis")
self.y = ScaledFactory("translate-y", TRANSLATE_CONFIG, "Translate along Y axis")
self.z = ScaledFactory("translate-z", TRANSLATE_CONFIG, "Translate along Z axis")
def __call__(self, value: TailwindScale, negative: bool = False) -> ScaledUtility
"Factory for translate utilities with directional and 3D support."
def __init__(self):
"""Initialize with directional sub-factories."""
super().__init__("Translate utilities for translating elements")
# Create directional translate factories
self.x = ScaledFactory("translate-x", TRANSLATE_CONFIG, "Translate along X axis")
self.y = ScaledFactory("translate-y", TRANSLATE_CONFIG, "Translate along Y axis")
self.z = ScaledFactory("translate-z", TRANSLATE_CONFIG, "Translate along Z axis")
def __call__(self, value: TailwindScale, negative: bool = False) -> ScaledUtility
"Initialize with directional sub-factories."
def negative(self) -> 'NegativeFactory':
"""Return a negative variant factory."""
return NegativeFactory("translate", TRANSLATE_CONFIG)
def get_info(self) -> Dict[str, Any]
"Return a negative variant factory."
def get_info(self) -> Dict[str, Any]:
"""Get information about the translate factory."""
from cjm_fasthtml_tailwind.builders.scales import NUMERIC_SCALE, DECIMAL_SCALE
return {
'description': self._doc,
"Get information about the translate factory."
```
#### Variables
``` python
BACKFACE_VALUES = {2 items}
backface # The backface visibility factory
PERSPECTIVE_VALUES = {6 items}
perspective # The perspective factory
PERSPECTIVE_ORIGIN_VALUES = {9 items}
ROTATE_ANGLES = [9 items] # Common rotation angles in degrees
ROTATE_CONFIG
rotate # The rotate factory
SCALE_VALUES = [10 items] # Common scale percentages
SCALE_CONFIG
scale_tw # The scale factory (renamed to avoid conflict with built-in scale)
SKEW_ANGLES = [6 items] # Common skew angles in degrees
skew # The skew factory
TRANSFORM_VALUES = {3 items}
transform # The transform factory
TRANSFORM_ORIGIN_VALUES = {9 items}
TRANSFORM_STYLE_VALUES = {2 items}
transform_style # The transform style factory
TRANSLATE_CONFIG
translate # The translate factory
```
### transitions_and_animation (`transitions_and_animation.ipynb`)
> Transition and animation utilities for Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.utilities.transitions_and_animation import (
transition,
transition_behavior,
DURATION_SCALE,
DURATION_CONFIG,
duration,
ease,
DELAY_SCALE,
DELAY_CONFIG,
delay,
animate,
TransitionPropertyFactory,
test_transitions_and_animation_property_examples,
test_transitions_and_animation_behavior_examples,
DurationFactory,
test_transitions_and_animation_duration_examples,
EaseFactory,
test_transitions_and_animation_timing_examples,
DelayFactory,
test_transitions_and_animation_delay_examples,
AnimationFactory,
test_transitions_and_animation_examples,
test_transitions_and_animation_practical_examples,
test_transitions_and_animation_animation_examples,
test_transitions_and_animation_composition_examples,
test_transitions_and_animation_factory_documentation,
smooth_transition,
hover_effect,
fade_in,
loading_spinner,
skeleton_loader,
test_transitions_and_animation_helper_examples
)
```
#### Functions
``` python
def test_transitions_and_animation_property_examples()
"Test transition property utilities."
```
``` python
def test_transitions_and_animation_behavior_examples()
"Test transition behavior utilities."
```
``` python
def test_transitions_and_animation_duration_examples()
"Test transition duration utilities."
```
``` python
def test_transitions_and_animation_timing_examples():
"""Test transition timing function utilities."""
# Test predefined easing functions
assert str(ease.linear) == "ease-linear"
assert str(ease._in) == "ease-in" # Note: 'in' is a Python keyword, so we use 'in_'
"Test transition timing function utilities."
```
``` python
def test_transitions_and_animation_delay_examples()
"Test transition delay utilities."
```
``` python
def test_transitions_and_animation_examples()
"Test animation utilities."
```
``` python
def test_transitions_and_animation_practical_examples()
"Test transition and animation utilities in practical FastHTML component examples."
```
``` python
def test_transitions_and_animation_animation_examples()
"Test animation utilities in practical FastHTML component examples."
```
``` python
def test_transitions_and_animation_composition_examples()
"Test composing multiple transition utilities together."
```
``` python
def test_transitions_and_animation_factory_documentation()
"Test that transition and animation factories have accessible documentation."
```
``` python
def smooth_transition(
properties: str = "all", # Which properties to transition (default: all)
duration_ms: int = 300, # Duration in milliseconds
easing: str = "in-out" # Easing function
) -> str: # Combined CSS classes for smooth transitions
"Create a smooth transition with common defaults."
```
``` python
def hover_effect(
duration_ms: int = 200 # Duration in milliseconds
) -> str: # Combined CSS classes for hover effects
"Standard hover effect transition for interactive elements."
```
``` python
def fade_in(
duration_ms: int = 500, # Duration in milliseconds
delay_ms: Optional[int] = None # Optional delay in milliseconds
) -> str: # Combined CSS classes for fade-in effect
"Fade-in transition for entering elements."
```
``` python
def loading_spinner(
) -> str: # Combined CSS classes for a loading spinner
"Create a loading spinner animation."
```
``` python
def skeleton_loader(
) -> str: # Combined CSS classes for a skeleton loader
"Create a skeleton loader animation for content placeholders."
```
``` python
def test_transitions_and_animation_helper_examples()
"Test helper functions for common transition patterns."
```
#### Classes
``` python
class TransitionPropertyFactory(SimpleFactory):
"Factory for transition property utilities with custom value support."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the transition property factory."
```
``` python
class TransitionPropertyFactory(SimpleFactory):
"Factory for transition property utilities with custom value support."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the transition property factory."
```
``` python
class DurationFactory:
def __init__(
self,
prefix: str,
config: ScaleConfig,
doc: Optional[str] = None
)
"Factory for duration utilities with millisecond support."
def __init__(
self,
prefix: str,
config: ScaleConfig,
doc: Optional[str] = None
)
"Initialize duration factory with autocomplete properties."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the duration factory."
```
``` python
class EaseFactory(SimpleFactory):
"Factory for easing/timing function utilities with custom value support."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the ease factory."
```
``` python
class DelayFactory:
def __init__(
self,
prefix: str,
config: ScaleConfig,
doc: Optional[str] = None
)
"Factory for delay utilities with millisecond support."
def __init__(
self,
prefix: str,
config: ScaleConfig,
doc: Optional[str] = None
)
"Initialize delay factory with autocomplete properties."
```
``` python
class AnimationFactory(SimpleFactory):
"Factory for animation utilities with custom value support."
def get_info(
self
) -> Dict[str, Any]: # Dictionary with factory information
"Get information about the animation factory."
```
#### Variables
``` python
DURATION_SCALE = [9 items] # Standard Tailwind duration scale
DURATION_CONFIG # Duration configuration
duration # The duration factory
DELAY_SCALE = [9 items] # Standard Tailwind delay scale
DELAY_CONFIG # Delay configuration
delay # The delay factory
```
### typography (`typography.ipynb`)
> Typography utilities for Tailwind CSS
#### Import
``` python
from cjm_fasthtml_tailwind.utilities.typography import (
font,
TEXT_SIZE_CONFIG,
text,
antialiased,
subpixel_antialiased,
italic,
not_italic,
font_stretch,
normal_nums,
ordinal,
slashed_zero,
lining_nums,
oldstyle_nums,
proportional_nums,
tabular_nums,
diagonal_fractions,
stacked_fractions,
TRACKING_CONFIG,
tracking,
LINE_CLAMP_CONFIG,
line_clamp,
LEADING_CONFIG,
leading,
list_image,
list_position,
list_style,
text_align,
underline,
overline,
line_through,
no_underline,
decoration,
decoration_style,
DECORATION_THICKNESS_CONFIG,
decoration_thickness,
UNDERLINE_OFFSET_CONFIG,
underline_offset,
uppercase,
lowercase,
capitalize,
normal_case,
truncate,
text_ellipsis,
text_clip,
text_wrap,
text_nowrap,
text_balance,
text_pretty,
indent,
align,
whitespace,
break_normal,
break_all,
break_keep,
wrap_break_word,
wrap_anywhere,
wrap_normal,
hyphens,
content,
test_typography_font_family_examples,
test_typography_font_size_examples,
test_typography_font_smoothing_examples,
test_typography_font_style_examples,
FontFactory,
test_typography_font_weight_examples,
test_typography_font_stretch_examples,
test_typography_font_variant_numeric_examples,
test_typography_spacing_examples,
LineClampFactory,
test_typography_line_clamp_examples,
LeadingFactory,
test_typography_line_height_examples,
ListImageUtility,
ListImageFactory,
test_typography_list_image_examples,
test_typography_list_styles_examples,
test_typography_text_alignment_examples,
TextFactory,
test_typography_text_color_examples,
test_typography_text_decoration_examples,
test_typography_underline_offset_examples,
test_typography_text_transform_examples,
test_typography_text_overflow_examples,
test_typography_text_wrap_examples,
test_typography_text_indent_examples,
test_typography_vertical_align_examples,
test_typography_whitespace_examples,
test_typography_word_break_examples,
test_typography_overflow_wrap_examples,
test_typography_hyphens_examples,
ContentUtility,
ContentFactory,
test_typography_content_examples,
test_typography_practical_examples,
test_typography_factory_documentation
)
```
#### Functions
``` python
def test_typography_font_family_examples()
"Test font family utilities."
```
``` python
def test_typography_font_size_examples()
"Test font size utilities."
```
``` python
def test_typography_font_smoothing_examples()
"Test font smoothing utilities."
```
``` python
def test_typography_font_style_examples()
"Test font style utilities."
```
``` python
def test_typography_font_weight_examples()
"Test font weight utilities."
```
``` python
def test_typography_font_stretch_examples()
"Test font stretch utilities."
```
``` python
def test_typography_font_variant_numeric_examples()
"Test font variant numeric utilities."
```
``` python
def test_typography_spacing_examples()
"Test letter spacing utilities."
```
``` python
def test_typography_line_clamp_examples()
"Test line clamp utilities."
```
``` python
def test_typography_line_height_examples()
"Test line height utilities."
```
``` python
def test_typography_list_image_examples()
"Test list style image utilities."
```
``` python
def test_typography_list_styles_examples()
"Test list styles utilities."
```
``` python
def test_typography_text_alignment_examples()
"Test text alignment utilities."
```
``` python
def test_typography_text_color_examples()
"Test text color utilities."
```
``` python
def test_typography_text_decoration_examples()
"Test text decoration utilities."
```
``` python
def test_typography_underline_offset_examples()
"Test underline offset utilities."
```
``` python
def test_typography_text_transform_examples()
"Test text transform utilities."
```
``` python
def test_typography_text_overflow_examples()
"Test text overflow utilities."
```
``` python
def test_typography_text_wrap_examples()
"Test text wrap utilities."
```
``` python
def test_typography_text_indent_examples()
"Test text indent utilities."
```
``` python
def test_typography_vertical_align_examples()
"Test vertical align utilities."
```
``` python
def test_typography_whitespace_examples()
"Test whitespace utilities."
```
``` python
def test_typography_word_break_examples()
"Test word break utilities."
```
``` python
def test_typography_overflow_wrap_examples()
"Test overflow wrap utilities."
```
``` python
def test_typography_hyphens_examples()
"Test hyphens utilities."
```
``` python
def test_typography_content_examples()
"Test content utilities for pseudo-elements."
```
``` python
def test_typography_practical_examples()
"Test typography utilities in practical FastHTML component examples."
```
``` python
def test_typography_factory_documentation()
"Test that typography factories have accessible documentation."
```
#### Classes
``` python
class FontFactory:
def __init__(self)
"Factory for font utilities including family and weight."
def __init__(self)
"Initialize font factory with families and weights."
def get_info(
self
) -> Dict[str, Any]: # Factory information
"Get information about the font factory."
```
``` python
class LineClampFactory(ScaledFactory):
"Factory for line clamp utilities."
```
``` python
class LeadingFactory(ScaledFactory):
"Factory for line height utilities with restricted numeric range."
```
``` python
class ListImageUtility(BaseUtility):
"Utility class for list-style-image with arbitrary value support."
```
``` python
class ListImageFactory:
def __init__(self):
"""Initialize list image factory."""
super().__init__("List style image utilities for controlling list item marker images")
self.none = ListImageUtility("list-image")
self.none._value = "none"
def __call__(
self,
value: str # Image URL or value
) -> ListImageUtility: # A list image utility instance
"Factory for list-style-image utilities."
def __init__(self):
"""Initialize list image factory."""
super().__init__("List style image utilities for controlling list item marker images")
self.none = ListImageUtility("list-image")
self.none._value = "none"
def __call__(
self,
value: str # Image URL or value
) -> ListImageUtility: # A list image utility instance
"Initialize list image factory."
def get_info(
self
) -> Dict[str, Any]: # Factory information
"Get information about the list image factory."
```
``` python
class TextFactory:
def __init__(self)
"Enhanced text factory that supports both font sizes and text colors."
def __init__(self)
"Initialize text factory with size support."
```
``` python
class ContentUtility(BaseUtility):
"Utility class for content with arbitrary value support."
```
``` python
class ContentFactory:
def __init__(self):
"""Initialize content factory."""
super().__init__("Content utilities for controlling before and after pseudo-element content")
self.none = ContentUtility("content")
self.none._value = "none"
def __call__(
self,
value: str # Content value
) -> ContentUtility: # A content utility instance
"Factory for content utilities for pseudo-elements."
def __init__(self):
"""Initialize content factory."""
super().__init__("Content utilities for controlling before and after pseudo-element content")
self.none = ContentUtility("content")
self.none._value = "none"
def __call__(
self,
value: str # Content value
) -> ContentUtility: # A content utility instance
"Initialize content factory."
def get_info(
self
) -> Dict[str, Any]: # Factory information
"Get information about the content factory."
```
#### Variables
``` python
TEXT_SIZE_CONFIG
text # Font size factory
antialiased # Antialiased font smoothing
subpixel_antialiased # Subpixel antialiased font smoothing
italic # Italic font style
not_italic # Normal font style
font # Enhanced font factory for family and weight
normal_nums # Normal numbers
ordinal # Ordinal numbers
slashed_zero # Slashed zero
lining_nums # Lining numbers
oldstyle_nums # Old-style numbers
proportional_nums # Proportional numbers
tabular_nums # Tabular numbers
diagonal_fractions # Diagonal fractions
stacked_fractions # Stacked fractions
TRACKING_CONFIG
tracking # Letter spacing factory
LINE_CLAMP_CONFIG
line_clamp # Line clamp factory
LEADING_CONFIG
leading # Line height factory
list_image # List image factory
text # Enhanced text factory for size and color
underline # Underline text
overline # Overline text
line_through # Line through text
no_underline # No text decoration
decoration # Text decoration color factory
DECORATION_THICKNESS_CONFIG
decoration_thickness # Text decoration thickness factory
UNDERLINE_OFFSET_CONFIG
underline_offset # Text underline offset factory
uppercase # Uppercase text
lowercase # Lowercase text
capitalize # Capitalize text
normal_case # Normal case text
truncate # Truncate overflow text
text_ellipsis # Text ellipsis
text_clip # Text clip
text_wrap # Text wrap
text_nowrap # Text no wrap
text_balance # Text balance
text_pretty # Text pretty
indent # Text indent factory
break_normal # Normal word break
break_all # Break all
break_keep # Keep words together
wrap_break_word # Break word wrap
wrap_anywhere # Wrap anywhere
wrap_normal # Normal wrap
content # Content factory
```
### utils (`utils.ipynb`)
> Utility functions for CLI tools
#### Import
``` python
from cjm_fasthtml_tailwind.cli.utils import (
SearchResult,
print_header,
print_not_found,
print_total,
print_helpful_instructions,
display_items_generic,
handle_module_not_found,
simple_item_formatter,
indented_item_formatter,
extract_match_context,
extract_source_line_context,
create_search_result,
search_in_text,
search_in_name_and_text,
check_factory_usage_patterns,
search_in_fields,
search_in_source_code,
find_usage_in_items,
get_view_command,
format_usage_examples,
discover_utility_modules,
iterate_all_modules_with_items,
extract_helper_names_from_test,
load_code_from_file,
list_utility_modules
)
```
#### Functions
``` python
def print_header(
title: str, # TODO: Add description
width: int = 60 # TODO: Add description
): # TODO: Add type hint
"Print a formatted header with title and separator."
```
``` python
def print_not_found(
item_type: str, # TODO: Add description
item_name: str, # TODO: Add description
module_name: Optional[str] = None # TODO: Add description
): # TODO: Add type hint
"Print a standardized not found message."
```
``` python
def print_total(
item_type: str, # TODO: Add description
count: int, # TODO: Add description
across_modules: bool = False # TODO: Add description
): # TODO: Add type hint
"Print a standardized total count message."
```
``` python
def print_helpful_instructions(
instructions: List[Tuple[str, Optional[str]]] # List of (description, example) tuples
)
"Print helpful instructions section."
```
``` python
def display_items_generic(
items: Union[Dict, List], # Items to display (dict of lists or list)
title: str, # Title for the display
item_formatter: Callable[[Any], str], # Function to format each item
item_type: str, # Type of items for the total message
instructions: Optional[List[Tuple[str, Optional[str]]]] = None, # Help instructions
not_found_message: Optional[str] = None # Custom not found message
)
"Generic function to display a collection of items with consistent formatting."
```
``` python
def handle_module_not_found(
"Print standardized error message for module not found."
```
``` python
def simple_item_formatter(
name_field: str, # Name of the field containing the item name
doc_field: str # Name of the field containing the documentation
) -> Callable[[Any], str]: # Formatter function
"Create a simple formatter for items with name and documentation fields."
```
``` python
def indented_item_formatter(
prefix: str = " " # Indentation prefix
) -> Callable[[Any], Callable[[Any], str]]: # Returns a formatter factory
"Create a formatter that indents items with a prefix."
```
``` python
def extract_match_context(
text: str, # TODO: Add description
query: str, # TODO: Add description
case_sensitive: bool = False, # TODO: Add description
context_size: int = 30 # TODO: Add description
) -> str: # TODO: Add return description
"Extract context around a match in text."
```
``` python
def extract_source_line_context(
source: str, # TODO: Add description
query: str, # TODO: Add description
case_sensitive: bool = False # TODO: Add description
) -> str: # TODO: Add return description
"Extract line context for a match in source code."
```
``` python
def create_search_result(
content_type: str, # TODO: Add description
module_name: str, # TODO: Add description
item_name: str, # TODO: Add description
match_context: str, # TODO: Add description
match_location: str # TODO: Add description
) -> SearchResult: # TODO: Add return description
"Create a SearchResult with standard fields."
```
``` python
def search_in_text(
query: str, # Search query
text: str, # Text to search in
case_sensitive: bool = False # Whether to perform case-sensitive search
) -> bool: # True if match found
"Check if query exists in text."
```
``` python
def search_in_name_and_text(
query: str, # TODO: Add description
item_name: str, # TODO: Add description
text: str, # TODO: Add description
content_type: str, # TODO: Add description
module_name: str, # TODO: Add description
text_location: str, # TODO: Add description
case_sensitive: bool = False # TODO: Add description
) -> List[SearchResult]: # TODO: Add return description
"Search in both name and text fields, returning search results."
```
``` python
def check_factory_usage_patterns(
factory_name: str # TODO: Add description
) -> List[str]: # TODO: Add return description
"Get regex patterns to match common factory usage patterns."
```
``` python
def search_in_fields(
item: Any, # The item to search in
query: str, # Search query
fields: Dict[str, Callable[[Any], str]], # field_name -> getter function
content_type: str, # Type of content being searched
module_name: str, # Module containing the item
item_name: str, # Name of the item
case_sensitive: bool = False # Whether to perform case-sensitive search
) -> List[SearchResult]: # List of search results
"Search for query in multiple fields of an item."
```
``` python
def search_in_source_code(
source: str, # Source code to search in
query: str, # Search query
content_type: str, # Type of content being searched
module_name: str, # Module containing the source
item_name: str, # Name of the item
case_sensitive: bool = False # Whether to perform case-sensitive search
) -> Optional[SearchResult]: # Search result or None
"Search in source code and return result with line context."
```
``` python
def find_usage_in_items(
target_name: str, # Name of the target (factory/helper) to find usage for
items: Dict[str, List[Any]], # Dictionary of module_name -> list of items
source_getter: Callable[[Any], str], # Function to get source code from item
item_type: str # Type of items being searched (for display)
) -> List[Tuple[str, Any]]: # List of (module_name, item) tuples
"Find items that use a specific target (factory/helper)."
```
``` python
def get_view_command(
content_type: str, # Type of content ('factory', 'example', 'helper', 'module')
module_name: str, # Module name
item_name: str # Item name (or feature name for examples)
) -> str: # CLI command to view the item
"Get the CLI command to view a specific item."
```
``` python
def format_usage_examples(
usage_items: List[Tuple[str, Any]], # List of (module_name, item) tuples
item_name_getter: Callable[[Any], str], # Function to get item name
item_type: str, # Type of items ('examples' or 'helpers')
view_command_type: str # Type for get_view_command ('example' or 'helper')
) -> List[str]: # List of formatted strings
"Format usage examples for display."
```
``` python
def discover_utility_modules(
) -> List[Tuple[str, Any]]: # List of (module_name, module) tuples
"Discover all utility modules in the cjm_fasthtml_tailwind.utilities package."
```
``` python
def iterate_all_modules_with_items(
extractor_func, # Function to extract items from a module - TODO: Add type hint
module_filter: Optional[str] = None # Optional specific module to filter for
) -> Dict[str, List[Any]]: # Dictionary mapping module names to their items
"Generic iterator for extracting items from all modules."
```
``` python
def extract_helper_names_from_test(
source: str # Source code of the test_<module>_helper_examples function
) -> List[str]: # List of helper function names
"Extract helper function names from test source code."
```
``` python
def load_code_from_file(
filepath: str # TODO: Add description
) -> Optional[str]: # TODO: Add return description
"Load code from a file."
```
``` python
def list_utility_modules(
) -> Dict[str, str]: # Dictionary mapping module names to their docstrings
"List all available utility modules with their docstrings."
```
#### Classes
``` python
@dataclass
class SearchResult:
"Represents a single search result."
content_type: str # 'factory', 'example', 'helper', 'module'
module_name: str # Module where found
item_name: str # Name of the item (factory name, function name, etc.)
match_context: str # The context where the match was found
match_location: str # Where the match was found (name, doc, source)
score: float = 1.0 # Relevance score for fuzzy matching
```
Raw data
{
"_id": null,
"home_page": "https://github.com/cj-mills/cjm-fasthtml-tailwind",
"name": "cjm-fasthtml-tailwind",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "nbdev jupyter notebook python",
"author": "Christian J. Mills",
"author_email": "9126128+cj-mills@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/df/ed/d26b5c85c6c8afbbc0a3d68e878849e68bd26bd453a4fdc33f5d4cf0b077/cjm_fasthtml_tailwind-0.0.2.tar.gz",
"platform": null,
"description": "# cjm-fasthtml-tailwind\n\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n## Install\n\n``` bash\npip install cjm-fasthtml-tailwind\n```\n\n## Project Structure\n\n nbs/\n \u251c\u2500\u2500 builders/ (2)\n \u2502 \u251c\u2500\u2500 colors.ipynb # Color system builders for Tailwind CSS utilities\n \u2502 \u2514\u2500\u2500 scales.ipynb # Numeric and named scale builders for Tailwind CSS utilities\n \u251c\u2500\u2500 cli/ (10)\n \u2502 \u251c\u2500\u2500 core_utils_discovery.ipynb # Functions to discover and display core utility functions like combine_classes:\n \u2502 \u251c\u2500\u2500 example_discovery.ipynb # Functions to discover and extract test example functions:\n \u2502 \u251c\u2500\u2500 explorer.ipynb # CLI tool for API exploration of cjm-fasthtml-tailwind utilities\n \u2502 \u251c\u2500\u2500 factory_extraction.ipynb # Functions to extract BaseFactory instances from modules:\n \u2502 \u251c\u2500\u2500 helper_discovery.ipynb # Functions to discover and extract helper functions:\n \u2502 \u251c\u2500\u2500 imports.ipynb # Functions for getting import statements.\n \u2502 \u251c\u2500\u2500 pattern_scanner.ipynb # Scan Python code for replaceable CSS class patterns\n \u2502 \u251c\u2500\u2500 search.ipynb # Functions to search across all library components:\n \u2502 \u251c\u2500\u2500 test_code.ipynb # Functions to test code snippets using the library:\n \u2502 \u2514\u2500\u2500 utils.ipynb # Utility functions for CLI tools\n \u251c\u2500\u2500 core/ (3)\n \u2502 \u251c\u2500\u2500 base.ipynb # Base classes, types, and protocols for Tailwind CSS abstractions\n \u2502 \u251c\u2500\u2500 resources.ipynb # CDN resources and headers for Tailwind CSS\n \u2502 \u2514\u2500\u2500 testing.ipynb # Standardized test page creation for Jupyter notebooks with FastHTML\n \u2514\u2500\u2500 utilities/ (15)\n \u251c\u2500\u2500 accessibility.ipynb # Accessibility utilities for Tailwind CSS\n \u251c\u2500\u2500 backgrounds.ipynb # Background utilities for Tailwind CSS\n \u251c\u2500\u2500 borders.ipynb # Border utilities for Tailwind CSS\n \u251c\u2500\u2500 effects.ipynb # Shadow, opacity and other visual effect utilities for Tailwind CSS\n \u251c\u2500\u2500 filters.ipynb # Filter utilities for Tailwind CSS\n \u251c\u2500\u2500 flexbox_and_grid.ipynb # Flexbox and CSS Grid utilities for Tailwind CSS\n \u251c\u2500\u2500 interactivity.ipynb # Interactivity utilities for Tailwind CSS\n \u251c\u2500\u2500 layout.ipynb # Display, position, overflow, z-index and other layout utilities for Tailwind CSS\n \u251c\u2500\u2500 sizing.ipynb # Width, height, and min/max sizing utilities for Tailwind CSS\n \u251c\u2500\u2500 spacing.ipynb # Padding and margin utilities for Tailwind CSS\n \u251c\u2500\u2500 svg.ipynb # SVG utilities for Tailwind CSS\n \u251c\u2500\u2500 tables.ipynb # Table utilities for Tailwind CSS\n \u251c\u2500\u2500 transforms.ipynb # Transform, rotate, scale, skew, translate and other transformation utilities for Tailwind CSS\n \u251c\u2500\u2500 transitions_and_animation.ipynb # Transition and animation utilities for Tailwind CSS\n \u2514\u2500\u2500 typography.ipynb # Typography utilities for Tailwind CSS\n\nTotal: 30 notebooks across 4 directories\n\n## Module Dependencies\n\n``` mermaid\ngraph LR\n builders_colors[builders.colors<br/>colors]\n builders_scales[builders.scales<br/>scales]\n cli_core_utils_discovery[cli.core_utils_discovery<br/>Core Utilities Discovery]\n cli_example_discovery[cli.example_discovery<br/>Example Discovery]\n cli_explorer[cli.explorer<br/>explorer]\n cli_factory_extraction[cli.factory_extraction<br/>Factory Extraction]\n cli_helper_discovery[cli.helper_discovery<br/>Helper Function Discovery]\n cli_imports[cli.imports<br/>imports]\n cli_pattern_scanner[cli.pattern_scanner<br/>pattern_scanner]\n cli_search[cli.search<br/>Search Functions]\n cli_test_code[cli.test_code<br/>Test Code Functionality]\n cli_utils[cli.utils<br/>utils]\n core_base[core.base<br/>base]\n core_resources[core.resources<br/>resources]\n core_testing[core.testing<br/>testing]\n utilities_accessibility[utilities.accessibility<br/>accessibility]\n utilities_backgrounds[utilities.backgrounds<br/>backgrounds]\n utilities_borders[utilities.borders<br/>borders]\n utilities_effects[utilities.effects<br/>effects]\n utilities_filters[utilities.filters<br/>filters]\n utilities_flexbox_and_grid[utilities.flexbox_and_grid<br/>flexbox_and_grid]\n utilities_interactivity[utilities.interactivity<br/>interactivity]\n utilities_layout[utilities.layout<br/>layout]\n utilities_sizing[utilities.sizing<br/>sizing]\n utilities_spacing[utilities.spacing<br/>spacing]\n utilities_svg[utilities.svg<br/>svg]\n utilities_tables[utilities.tables<br/>tables]\n utilities_transforms[utilities.transforms<br/>transforms]\n utilities_transitions_and_animation[utilities.transitions_and_animation<br/>transitions_and_animation]\n utilities_typography[utilities.typography<br/>typography]\n\n builders_colors --> core_base\n builders_scales --> core_base\n cli_example_discovery --> cli_utils\n cli_explorer --> cli_utils\n cli_explorer --> cli_test_code\n cli_explorer --> cli_factory_extraction\n cli_explorer --> cli_pattern_scanner\n cli_explorer --> cli_helper_discovery\n cli_explorer --> cli_core_utils_discovery\n cli_explorer --> cli_example_discovery\n cli_explorer --> cli_search\n cli_explorer --> cli_imports\n cli_factory_extraction --> cli_utils\n cli_factory_extraction --> core_base\n cli_helper_discovery --> cli_utils\n cli_helper_discovery --> cli_example_discovery\n cli_imports --> cli_factory_extraction\n cli_imports --> cli_core_utils_discovery\n cli_imports --> cli_helper_discovery\n cli_imports --> cli_utils\n cli_search --> cli_utils\n cli_search --> cli_example_discovery\n cli_search --> cli_factory_extraction\n cli_search --> cli_helper_discovery\n cli_test_code --> cli_factory_extraction\n cli_test_code --> cli_utils\n cli_test_code --> cli_helper_discovery\n core_testing --> utilities_flexbox_and_grid\n core_testing --> utilities_borders\n core_testing --> utilities_transitions_and_animation\n core_testing --> utilities_sizing\n core_testing --> utilities_backgrounds\n core_testing --> utilities_layout\n core_testing --> utilities_effects\n core_testing --> core_resources\n core_testing --> core_base\n core_testing --> utilities_spacing\n core_testing --> utilities_typography\n utilities_accessibility --> builders_scales\n utilities_accessibility --> utilities_layout\n utilities_accessibility --> core_base\n utilities_backgrounds --> core_base\n utilities_backgrounds --> builders_colors\n utilities_backgrounds --> builders_scales\n utilities_borders --> core_base\n utilities_borders --> builders_colors\n utilities_borders --> builders_scales\n utilities_effects --> core_base\n utilities_effects --> builders_colors\n utilities_effects --> builders_scales\n utilities_filters --> builders_colors\n utilities_filters --> core_base\n utilities_filters --> builders_scales\n utilities_flexbox_and_grid --> core_base\n utilities_flexbox_and_grid --> builders_scales\n utilities_interactivity --> core_base\n utilities_interactivity --> builders_scales\n utilities_interactivity --> builders_colors\n utilities_layout --> core_base\n utilities_layout --> builders_scales\n utilities_sizing --> builders_scales\n utilities_sizing --> core_base\n utilities_spacing --> builders_scales\n utilities_spacing --> core_base\n utilities_svg --> builders_colors\n utilities_svg --> core_base\n utilities_svg --> builders_scales\n utilities_tables --> core_base\n utilities_tables --> builders_scales\n utilities_transforms --> core_base\n utilities_transforms --> builders_scales\n utilities_transitions_and_animation --> core_base\n utilities_transitions_and_animation --> builders_scales\n utilities_typography --> core_base\n utilities_typography --> builders_scales\n utilities_typography --> builders_colors\n```\n\n*76 cross-module dependencies detected*\n\n## CLI Reference\n\n### `cjm-tailwind-explore` Command\n\n usage: cjm-tailwind-explore [-h]\n {modules,factories,factory,examples,example,helpers,helper,search,test-code,core-utils,core-util,imports,scan}\n ...\n\n cjm-fasthtml-tailwind CLI Explorer\n\n This tool helps you explore the cjm-fasthtml-tailwind library, which provides:\n - Python-native Tailwind CSS v4 utility class builders for FastHTML projects\n - Type-safe, dynamic CSS class generation without hardcoded strings\n - Comprehensive utility factories (forced_color_adjust, not_sr_only, sr_only, etc.)\n - Helper functions for common patterns\n - Full integration with FastHTML components\n\n Purpose: This CLI tool enables autonomous exploration of the library's API by:\n - Discovering all available utility modules and their documentation\n - Listing factory instances with their built-in documentation\n - Showing usage examples from test functions\n - Providing source code for helper functions\n - Searching across all library components\n - Testing code snippets with automatic imports\n - Generating recommended import statements\n - Scanning existing code for replaceable CSS patterns\n\n All information is dynamically extracted from the library itself - nothing is hardcoded.\n\n positional arguments:\n {modules,factories,factory,examples,example,helpers,helper,search,test-code,core-utils,core-util,imports,scan}\n Available commands\n modules List all utility modules\n factories List factories\n factory Show detailed info for a specific factory\n examples Show usage examples\n example Show source code for a specific example\n helpers Show helper functions\n helper Show source code for a specific helper\n search Search across all library components\n test-code Test code snippets using the library\n core-utils List core utility functions\n core-util Show source code for a core utility\n imports Show recommended import statements\n scan Scan code for replaceable CSS patterns\n\n options:\n -h, --help show this help message and exit\n\n Getting Started:\n 1. List all modules: cjm-tailwind-explore modules\n 2. View factories: cjm-tailwind-explore factories\n 3. Search for patterns: cjm-tailwind-explore search <query>\n 4. Test code: cjm-tailwind-explore test-code \"<code>\"\n 5. Get imports: cjm-tailwind-explore imports\n 6. Scan existing code: cjm-tailwind-explore scan <file>\n\n Exploration Workflow:\n - Start with 'modules' to see available utility categories\n - Use 'factories -m <module>' to explore specific modules\n - Use 'factory <module> <name>' for detailed factory information\n - Use 'examples' to see test-based usage patterns\n - Use 'search' to find specific functionality\n - Use 'test-code' to verify your understanding\n - Use 'scan' to analyze existing code for migration opportunities\n\n Key Concepts:\n - Factories: Objects that generate CSS classes (e.g., forced_color_adjust, not_sr_only, sr_only)\n - Modules: Categories of utilities (accessibility, backgrounds, borders, etc.)\n - Examples: Test functions demonstrating usage patterns\n - Helpers: Convenience functions for common patterns\n\n Tips for Coding Assistants:\n - Use 'search --include-source' to find usage patterns in code\n - Use 'test-code' to validate generated code before using it\n - Use 'imports' to get all necessary import statements\n - Use 'scan' to identify replaceable hardcoded CSS classes\n - Factory names are intuitive: forced_color_adjust, not_sr_only, sr_only\n - Combine utilities with combine_classes() function\n - All factories support method chaining and attribute access\n\n Example Usage Flow:\n cjm-tailwind-explore modules # See what's available\n cjm-tailwind-explore factories -m accessibility # Explore accessibility utilities\n cjm-tailwind-explore factory accessibility forced_color_adjust # Learn about forced_color_adjust factory\n cjm-tailwind-explore example accessibility forced_color_adjust # See usage examples\n cjm-tailwind-explore test-code 'print(str(forced_color_adjust.auto))' # Test your understanding\n cjm-tailwind-explore scan app.py # Analyze existing code\n\nFor detailed help on any command, use\n`cjm-tailwind-explore <command> --help`.\n\n## Module Overview\n\nDetailed documentation for each module in the project:\n\n### accessibility (`accessibility.ipynb`)\n\n> Accessibility utilities for Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.utilities.accessibility import (\n FORCED_COLOR_ADJUST_VALUES,\n forced_color_adjust,\n test_accessibility_forced_color_adjust_examples,\n test_accessibility_screen_reader_examples,\n test_accessibility_practical_examples,\n test_accessibility_factory_documentation,\n visually_hidden,\n high_contrast_safe,\n test_accessibility_helper_examples\n)\n```\n\n#### Functions\n\n``` python\ndef test_accessibility_forced_color_adjust_examples(\n)\n \"Test forced color adjust utilities.\"\n```\n\n``` python\ndef test_accessibility_screen_reader_examples(\n)\n \"Test screen reader utilities imported from layout module.\"\n```\n\n``` python\ndef test_accessibility_practical_examples(\n)\n \"Test accessibility utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef test_accessibility_factory_documentation(\n)\n \"Test that factories have accessible documentation.\"\n```\n\n``` python\ndef visually_hidden(\n focusable: bool = False # Whether the element should be visible when focused\n) -> str: # CSS classes for hiding element visually\n \"\"\"\n Hide an element visually but keep it available to screen readers.\n \n Args:\n focusable: If True, element becomes visible when focused (useful for skip links)\n \n Returns:\n CSS classes for visual hiding with optional focus visibility\n \"\"\"\n```\n\n``` python\ndef high_contrast_safe(\n *classes: str # Additional CSS classes to combine\n) -> str: # CSS classes including forced color adjust\n \"\"\"\n Create classes that work well with high contrast mode.\n \n Args:\n *classes: Additional CSS classes to include\n \n Returns:\n Combined CSS classes with forced-color-adjust-auto\n \"\"\"\n```\n\n``` python\ndef test_accessibility_helper_examples(\n)\n \"Test helper functions for common accessibility patterns.\"\n```\n\n#### Variables\n\n``` python\nFORCED_COLOR_ADJUST_VALUES = {2 items}\n```\n\n### backgrounds (`backgrounds.ipynb`)\n\n> Background utilities for Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.utilities.backgrounds import (\n bg_attachment,\n bg_clip,\n bg,\n bg_none,\n bg_linear,\n bg_radial,\n bg_conic,\n from_color,\n via_color,\n to_color,\n bg_origin,\n bg_position,\n bg_repeat,\n bg_size,\n test_backgrounds_attachment_examples,\n test_backgrounds_clip_examples,\n test_backgrounds_color_examples,\n test_backgrounds_opacity_examples,\n GradientUtility,\n GradientFactory,\n GradientStopUtility,\n GradientStopFactory,\n test_backgrounds_gradient_examples,\n test_backgrounds_gradient_stops_examples,\n test_backgrounds_gradient_composition_examples,\n test_backgrounds_origin_examples,\n test_backgrounds_position_examples,\n test_backgrounds_repeat_examples,\n test_backgrounds_size_examples,\n test_backgrounds_arbitrary_examples,\n test_backgrounds_practical_examples,\n test_backgrounds_factory_documentation\n)\n```\n\n#### Functions\n\n``` python\ndef test_backgrounds_attachment_examples()\n \"Test background attachment utilities.\"\n```\n\n``` python\ndef test_backgrounds_clip_examples()\n \"Test background clip utilities.\"\n```\n\n``` python\ndef test_backgrounds_color_examples()\n \"Test background color utilities with various color values.\"\n```\n\n``` python\ndef test_backgrounds_opacity_examples()\n \"Test background colors with opacity modifiers.\"\n```\n\n``` python\ndef test_backgrounds_gradient_examples()\n \"Test gradient background utilities.\"\n```\n\n``` python\ndef test_backgrounds_gradient_stops_examples()\n \"Test gradient color stop utilities.\"\n```\n\n``` python\ndef test_backgrounds_gradient_composition_examples()\n \"Test composing gradient backgrounds with color stops.\"\n```\n\n``` python\ndef test_backgrounds_origin_examples()\n \"Test background origin utilities.\"\n```\n\n``` python\ndef test_backgrounds_position_examples()\n \"Test background position utilities.\"\n```\n\n``` python\ndef test_backgrounds_repeat_examples()\n \"Test background repeat utilities.\"\n```\n\n``` python\ndef test_backgrounds_size_examples()\n \"Test background size utilities.\"\n```\n\n``` python\ndef test_backgrounds_arbitrary_examples()\n \"Test background utilities with arbitrary values.\"\n```\n\n``` python\ndef test_backgrounds_practical_examples()\n \"Test background utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef test_backgrounds_factory_documentation()\n \"Test that background factories have accessible documentation.\"\n```\n\n#### Classes\n\n``` python\nclass GradientUtility:\n def __init__(\n self,\n gradient_type: str, # Type of gradient (linear, radial, conic)\n value: Optional[Union[str, int]] = None, # Direction, angle, or custom value\n negative: bool = False # Whether to negate the angle\n )\n \"Utility class for gradient backgrounds with angle support.\"\n \n def __init__(\n self,\n gradient_type: str, # Type of gradient (linear, radial, conic)\n value: Optional[Union[str, int]] = None, # Direction, angle, or custom value\n negative: bool = False # Whether to negate the angle\n )\n \"Initialize gradient utility.\"\n```\n\n``` python\nclass GradientFactory:\n def __init__(\n self,\n gradient_type: str, # Type of gradient (linear, radial, conic)\n doc: Optional[str] = None # Documentation\n )\n \"Factory for gradient utilities with angle and direction support.\"\n \n def __init__(\n self,\n gradient_type: str, # Type of gradient (linear, radial, conic)\n doc: Optional[str] = None # Documentation\n )\n \"Initialize gradient factory.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Factory information\n \"Get information about this gradient factory.\"\n```\n\n``` python\nclass GradientStopUtility:\n def __init__(\n self,\n stop_type: str, # Type of stop (from, via, to)\n value: Optional[Union[ColorValue, str, int]] = None, # Color or percentage\n is_position: bool = False # Whether this is a position value\n )\n \"Utility class for gradient color stops with percentage support.\"\n \n def __init__(\n self,\n stop_type: str, # Type of stop (from, via, to)\n value: Optional[Union[ColorValue, str, int]] = None, # Color or percentage\n is_position: bool = False # Whether this is a position value\n )\n \"Initialize gradient stop utility.\"\n```\n\n``` python\nclass GradientStopFactory:\n def __init__(\n self,\n stop_type: str, # Type of stop (from, via, to)\n doc: Optional[str] = None # Documentation\n )\n \"Enhanced factory for gradient color stops with percentage support.\"\n \n def __init__(\n self,\n stop_type: str, # Type of stop (from, via, to)\n doc: Optional[str] = None # Documentation\n )\n \"Initialize gradient stop factory.\"\n```\n\n#### Variables\n\n``` python\nbg # The background color factory\nbg_none # Remove background image\n```\n\n### base (`base.ipynb`)\n\n> Base classes, types, and protocols for Tailwind CSS abstractions\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.core.base import (\n TailwindScale,\n TailwindFraction,\n TailwindArbitrary,\n TailwindCustomProperty,\n TailwindValue,\n PSEUDO_CLASS_MODIFIERS,\n PSEUDO_ELEMENT_MODIFIERS,\n RESPONSIVE_MODIFIERS,\n THEME_MODIFIERS,\n MOTION_MODIFIERS,\n PRINT_MODIFIERS,\n ORIENTATION_MODIFIERS,\n CONTRAST_MODIFIERS,\n DIRECTION_MODIFIERS,\n STATE_MODIFIERS,\n CHILD_MODIFIERS,\n ALL_MODIFIER_GROUPS,\n CONTAINER_SCALES,\n BREAKPOINTS,\n T,\n DIRECTIONS,\n is_numeric_scale,\n is_fraction,\n is_custom_property,\n is_arbitrary_value,\n TailwindBuilder,\n BaseUtility,\n ModifierMixin,\n ModifierGroup,\n StandardUtility,\n NamedScale,\n Breakpoint,\n BaseFactory,\n UtilityFactory,\n combine_classes,\n SingleValueUtility,\n SingleValueFactory,\n Direction,\n DirectionalUtility,\n NegativeableUtility\n)\n```\n\n#### Functions\n\n``` python\ndef is_numeric_scale(\n value: Any # The value to check - can be int, float, or string\n) -> bool: # True if the value is a valid numeric scale, False otherwise\n \"Check if value is a valid numeric scale (int, float, or 'px').\"\n```\n\n``` python\ndef is_fraction(\n value: Any # The value to check for fraction format\n) -> bool: # True if the value is a valid fraction string, False otherwise\n \"Check if value is a valid fraction string (e.g., '1/2', '3/4').\"\n```\n\n``` python\ndef is_custom_property(\n value: Any # The value to check for CSS custom property format\n) -> bool: # True if the value is a CSS custom property, False otherwise\n \"Check if value is a CSS custom property (starts with --).\"\n```\n\n``` python\ndef is_arbitrary_value(\n value: Any # The value to check for arbitrary CSS value format\n) -> bool: # True if the value contains CSS units or calc(), False otherwise\n \"Check if value is an arbitrary value (contains units or special chars).\"\n```\n\n``` python\ndef combine_classes(\n *args: Union[str, BaseUtility, TailwindBuilder, BaseFactory, None]\n) -> str: # Space-separated class string\n \"Combine multiple class builders or strings into a single class string.\"\n```\n\n#### Classes\n\n``` python\n@runtime_checkable\nclass TailwindBuilder(Protocol):\n \"Protocol for all Tailwind utility builders.\"\n \n def build(\n self,\n *args,\n **kwargs\n ) -> str: # The built CSS class string\n \"Build and return the CSS class string.\"\n```\n\n``` python\nclass BaseUtility:\n def __init__(\n self,\n prefix: str # The utility prefix (e.g., 'w' for width, 'p' for padding)\n )\n \"Base class for all Tailwind utility builders.\"\n \n def __init__(\n self,\n prefix: str # The utility prefix (e.g., 'w' for width, 'p' for padding)\n )\n \"Initialize with a utility prefix.\"\n \n def build(\n self,\n value: Optional[TailwindValue] = None # Optional value to override the stored value\n ) -> str: # The built CSS class string\n \"Build and return the CSS class string.\"\n \n def with_modifiers(\n self,\n *modifiers: str # Modifier strings to apply (e.g., 'hover', 'focus', 'dark')\n ) -> 'BaseUtility': # A new instance with the modifiers applied\n \"Create a new instance with additional modifiers.\nModifiers are applied in the order they are passed.\"\n```\n\n``` python\nclass ModifierMixin:\n \"Mixin to add modifier support to any utility with convenient property access.\"\n \n def hover(self) -> 'BaseUtility':\n \"\"\"Apply hover modifier.\"\"\"\n return self.with_modifiers(\"hover\")\n \n @property\n def focus(self) -> 'BaseUtility'\n \"Apply hover modifier.\"\n \n def focus(self) -> 'BaseUtility':\n \"\"\"Apply focus modifier.\"\"\"\n return self.with_modifiers(\"focus\")\n \n @property\n def active(self) -> 'BaseUtility'\n \"Apply focus modifier.\"\n \n def active(self) -> 'BaseUtility':\n \"\"\"Apply active modifier.\"\"\"\n return self.with_modifiers(\"active\")\n \n @property\n def visited(self) -> 'BaseUtility'\n \"Apply active modifier.\"\n \n def visited(self) -> 'BaseUtility':\n \"\"\"Apply visited modifier.\"\"\"\n return self.with_modifiers(\"visited\")\n \n @property\n def disabled(self) -> 'BaseUtility'\n \"Apply visited modifier.\"\n \n def disabled(self) -> 'BaseUtility':\n \"\"\"Apply disabled modifier.\"\"\"\n return self.with_modifiers(\"disabled\")\n \n @property\n def checked(self) -> 'BaseUtility'\n \"Apply disabled modifier.\"\n \n def checked(self) -> 'BaseUtility':\n \"\"\"Apply checked modifier.\"\"\"\n return self.with_modifiers(\"checked\")\n \n @property\n def required(self) -> 'BaseUtility'\n \"Apply checked modifier.\"\n \n def required(self) -> 'BaseUtility':\n \"\"\"Apply required modifier.\"\"\"\n return self.with_modifiers(\"required\")\n \n @property\n def invalid(self) -> 'BaseUtility'\n \"Apply required modifier.\"\n \n def invalid(self) -> 'BaseUtility':\n \"\"\"Apply invalid modifier.\"\"\"\n return self.with_modifiers(\"invalid\")\n \n @property\n def valid(self) -> 'BaseUtility'\n \"Apply invalid modifier.\"\n \n def valid(self) -> 'BaseUtility':\n \"\"\"Apply valid modifier.\"\"\"\n return self.with_modifiers(\"valid\")\n \n # Pseudo-element modifiers\n @property\n def before(self) -> 'BaseUtility'\n \"Apply valid modifier.\"\n \n def before(self) -> 'BaseUtility':\n \"\"\"Apply before pseudo-element modifier.\"\"\"\n return self.with_modifiers(\"before\")\n \n @property\n def after(self) -> 'BaseUtility'\n \"Apply before pseudo-element modifier.\"\n \n def after(self) -> 'BaseUtility':\n \"\"\"Apply after pseudo-element modifier.\"\"\"\n return self.with_modifiers(\"after\")\n \n @property\n def placeholder(self) -> 'BaseUtility'\n \"Apply after pseudo-element modifier.\"\n \n def placeholder(self) -> 'BaseUtility':\n \"\"\"Apply placeholder modifier.\"\"\"\n return self.with_modifiers(\"placeholder\")\n \n @property\n def selection(self) -> 'BaseUtility'\n \"Apply placeholder modifier.\"\n \n def selection(self) -> 'BaseUtility':\n \"\"\"Apply selection modifier.\"\"\"\n return self.with_modifiers(\"selection\")\n \n # Responsive modifiers\n @property\n def sm(self) -> 'BaseUtility'\n \"Apply selection modifier.\"\n \n def sm(self) -> 'BaseUtility':\n \"\"\"Apply small breakpoint modifier.\"\"\"\n return self.with_modifiers(\"sm\")\n \n @property\n def max_sm(self) -> 'BaseUtility'\n \"Apply small breakpoint modifier.\"\n \n def max_sm(self) -> 'BaseUtility':\n \"\"\"Apply max small breakpoint modifier variant.\"\"\"\n return self.with_modifiers(\"max-sm\")\n \n @property\n def md(self) -> 'BaseUtility'\n \"Apply max small breakpoint modifier variant.\"\n \n def md(self) -> 'BaseUtility':\n \"\"\"Apply medium breakpoint modifier.\"\"\"\n return self.with_modifiers(\"md\")\n \n @property\n def max_md(self) -> 'BaseUtility'\n \"Apply medium breakpoint modifier.\"\n \n def max_md(self) -> 'BaseUtility':\n \"\"\"Apply max medium breakpoint modifier variant.\"\"\"\n return self.with_modifiers(\"max-md\")\n \n @property\n def lg(self) -> 'BaseUtility'\n \"Apply max medium breakpoint modifier variant.\"\n \n def lg(self) -> 'BaseUtility':\n \"\"\"Apply large breakpoint modifier.\"\"\"\n return self.with_modifiers(\"lg\")\n \n @property\n def xl(self) -> 'BaseUtility'\n \"Apply large breakpoint modifier.\"\n \n def xl(self) -> 'BaseUtility':\n \"\"\"Apply extra large breakpoint modifier.\"\"\"\n return self.with_modifiers(\"xl\")\n \n @property\n def _2xl(self) -> 'BaseUtility'\n \"Apply extra large breakpoint modifier.\"\n \n def dark(self) -> 'BaseUtility':\n \"\"\"Apply dark mode modifier.\"\"\"\n return self.with_modifiers(\"dark\")\n \n # Motion modifiers\n @property\n def motion_reduce(self) -> 'BaseUtility'\n \"Apply dark mode modifier.\"\n \n def motion_reduce(self) -> 'BaseUtility':\n \"\"\"Apply reduced motion modifier.\"\"\"\n return self.with_modifiers(\"motion-reduce\")\n \n @property\n def motion_safe(self) -> 'BaseUtility'\n \"Apply reduced motion modifier.\"\n \n def motion_safe(self) -> 'BaseUtility':\n \"\"\"Apply safe motion modifier.\"\"\"\n return self.with_modifiers(\"motion-safe\")\n \n # Structural modifiers\n @property\n def first(self) -> 'BaseUtility'\n \"Apply safe motion modifier.\"\n \n def first(self) -> 'BaseUtility':\n \"\"\"Apply first child modifier.\"\"\"\n return self.with_modifiers(\"first\")\n \n @property\n def last(self) -> 'BaseUtility'\n \"Apply first child modifier.\"\n \n def last(self) -> 'BaseUtility':\n \"\"\"Apply last child modifier.\"\"\"\n return self.with_modifiers(\"last\")\n \n @property\n def odd(self) -> 'BaseUtility'\n \"Apply last child modifier.\"\n \n def odd(self) -> 'BaseUtility':\n \"\"\"Apply odd child modifier.\"\"\"\n return self.with_modifiers(\"odd\")\n \n @property\n def even(self) -> 'BaseUtility'\n \"Apply odd child modifier.\"\n \n def even(self) -> 'BaseUtility':\n \"\"\"Apply even child modifier.\"\"\"\n return self.with_modifiers(\"even\")\n \n # Group and peer modifiers\n def group(\n self, \n state: Optional[str] = None, # Optional state like 'hover', 'focus'\n name: Optional[str] = None # Optional group name for nested groups\n ) -> 'BaseUtility': # The utility with group modifier applied\n \"Apply even child modifier.\"\n \n def group(\n self, \n state: Optional[str] = None, # Optional state like 'hover', 'focus'\n name: Optional[str] = None # Optional group name for nested groups\n ) -> 'BaseUtility': # The utility with group modifier applied\n \"Apply group modifier with optional state and name.\"\n \n def peer(\n self, \n state: Optional[str] = None, # Optional state like 'hover', 'focus'\n name: Optional[str] = None # Optional peer name for multiple peers\n ) -> 'BaseUtility': # The utility with peer modifier applied\n \"Apply peer modifier with optional state and name.\"\n \n def has(\n self,\n selector: str # CSS selector for :has() pseudo-class\n ) -> 'BaseUtility': # The utility with has modifier applied\n \"Apply has modifier with a selector.\"\n \n def aria(\n self,\n attribute: str, # ARIA attribute name\n value: Optional[str] = None # Optional value for the attribute\n ) -> 'BaseUtility': # The utility with aria modifier applied\n \"Apply aria modifier with attribute and optional value.\"\n \n def data(\n self,\n attribute: str, # Data attribute name\n value: Optional[str] = None # Optional value for the attribute\n ) -> 'BaseUtility': # The utility with data modifier applied\n \"Apply data modifier with attribute and optional value.\"\n \n def arbitrary(\n self,\n selector: str # Arbitrary CSS selector\n ) -> 'BaseUtility': # The utility with arbitrary modifier applied\n \"Apply arbitrary modifier with custom selector.\"\n```\n\n``` python\n@dataclass\nclass ModifierGroup:\n \"Group of related modifiers with descriptions.\"\n \n name: str\n description: str\n modifiers: Dict[str, str] # modifier_name -> tailwind_variant\n```\n\n``` python\nclass StandardUtility(BaseUtility, ModifierMixin):\n \"Standard utility class with common value formatting and modifier support.\"\n \n```\n\n``` python\n@dataclass\nclass NamedScale:\n \"Represents a named scale with optional CSS variable.\"\n \n name: str\n var: Optional[str]\n comment: Optional[str]\n \n def format(\n self\n ) -> str: # The name of the scale for use in CSS classes\n \"Format as Tailwind class suffix.\"\n```\n\n``` python\n@dataclass\nclass Breakpoint:\n \"Responsive breakpoint definition.\"\n \n name: str\n min_width: Optional[str]\n```\n\n``` python\nclass BaseFactory:\n def __init__(\n self,\n doc: str # Documentation string describing what this factory creates\n )\n \"Base factory class with documentation support.\"\n \n def __init__(\n self,\n doc: str # Documentation string describing what this factory creates\n )\n \"Initialize with documentation string.\"\n \n def describe(\n self\n ) -> str: # A formatted description of the factory\n \"Return a formatted description of this factory.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get detailed information about this factory's options and valid inputs.\n\nShould return a dictionary with keys like:\n- 'description': Factory description\n- 'valid_inputs': List/description of valid input values\n- 'options': Available options or methods\"\n```\n\n``` python\nclass UtilityFactory:\n def __init__(\n self,\n utility_class: type[T], # The utility class to instantiate\n prefix: str, # The prefix to use for the utilities\n doc: Optional[str] = None # Optional documentation string\n )\n \"Factory for creating utility instances with fluent API.\"\n \n def __init__(\n self,\n utility_class: type[T], # The utility class to instantiate\n prefix: str, # The prefix to use for the utilities\n doc: Optional[str] = None # Optional documentation string\n )\n \"Initialize factory with a utility class and prefix.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about this utility factory.\"\n```\n\n``` python\nclass SingleValueUtility:\n def __init__(\n self,\n value: str # The complete utility class string (e.g., \"container\", \"sr-only\")\n )\n \"A utility that represents a single fixed value.\"\n \n def __init__(\n self,\n value: str # The complete utility class string (e.g., \"container\", \"sr-only\")\n )\n \"Initialize with a complete utility value.\"\n```\n\n``` python\nclass SingleValueFactory:\n def __init__(\n self,\n value: str, # The utility class string (e.g., \"container\")\n doc: str # Documentation describing what this utility does\n )\n \"Factory for a single utility class with modifier support.\"\n \n def __init__(\n self,\n value: str, # The utility class string (e.g., \"container\")\n doc: str # Documentation describing what this utility does\n )\n \"Initialize with a value and documentation.\"\n \n def build(\n self\n ) -> str: # The utility class string\n \"Build and return the utility class string.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about this single-value factory.\"\n```\n\n``` python\n@dataclass\nclass Direction:\n \"Represents a directional variant.\"\n \n suffix: str\n css_suffix: str\n```\n\n``` python\nclass DirectionalUtility:\n def __init__(\n self,\n prefix: str, # Base prefix (e.g., 'p' for padding)\n direction: Optional[str] = None # Optional direction ('t', 'r', 'b', 'l', 'x', 'y')\n )\n \"Base class for utilities with directional variants.\"\n \n def __init__(\n self,\n prefix: str, # Base prefix (e.g., 'p' for padding)\n direction: Optional[str] = None # Optional direction ('t', 'r', 'b', 'l', 'x', 'y')\n )\n \"Initialize with prefix and optional direction.\"\n```\n\n``` python\nclass NegativeableUtility:\n def __init__(\n self,\n prefix: str, # Base prefix\n negative: bool = False # Whether this is a negative variant\n )\n \"Utility class that supports negative values.\"\n \n def __init__(\n self,\n prefix: str, # Base prefix\n negative: bool = False # Whether this is a negative variant\n )\n \"Initialize with prefix and negative flag.\"\n```\n\n#### Variables\n\n``` python\nTailwindScale # Numeric scales like 1, 2.5, \"px\"\nTailwindFraction # Fractions like \"1/2\", \"2/3\"\nTailwindArbitrary # Arbitrary values like \"123px\", \"10rem\"\nTailwindCustomProperty # CSS custom properties like \"--spacing-lg\"\nTailwindValue # Union of all possible value types\nPSEUDO_CLASS_MODIFIERS\nPSEUDO_ELEMENT_MODIFIERS\nRESPONSIVE_MODIFIERS\nTHEME_MODIFIERS\nMOTION_MODIFIERS\nPRINT_MODIFIERS\nORIENTATION_MODIFIERS\nCONTRAST_MODIFIERS\nDIRECTION_MODIFIERS\nSTATE_MODIFIERS\nCHILD_MODIFIERS\nALL_MODIFIER_GROUPS = [11 items]\nCONTAINER_SCALES = [13 items] # Common named scales used across utilities\nBREAKPOINTS = {5 items} # Common breakpoints\nSTATE_MODIFIERS = [39 items] # Common state modifiers\nT\nDIRECTIONS = {6 items} # Common directions\n```\n\n### borders (`borders.ipynb`)\n\n> Border utilities for Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.utilities.borders import (\n RADIUS_SCALES,\n RADIUS_CONFIG,\n rounded,\n BORDER_WIDTH_CONFIG,\n border,\n divide,\n border_color,\n divide_color,\n border_style,\n divide_style,\n OUTLINE_WIDTH_CONFIG,\n outline,\n outline_color,\n outline_style,\n outline_hidden,\n OUTLINE_OFFSET_CONFIG,\n outline_offset,\n RoundedFactory,\n test_borders_radius_examples,\n BorderWidthUtility,\n BorderWidthFactory,\n BorderDirectionalFactory,\n test_borders_width_examples,\n DivideFactory,\n test_borders_divide_examples,\n BorderColorFactory,\n test_borders_color_examples,\n test_borders_divide_color_examples,\n test_borders_style_examples,\n test_borders_divide_style_examples,\n OutlineWidthFactory,\n test_borders_outline_width_examples,\n test_borders_outline_color_examples,\n test_borders_outline_style_examples,\n test_borders_outline_offset_examples,\n test_borders_practical_examples,\n test_borders_factory_documentation\n)\n```\n\n#### Functions\n\n``` python\ndef test_borders_radius_examples()\n \"Test border radius utilities with all variants.\"\n```\n\n``` python\ndef test_borders_width_examples()\n \"Test border width utilities with all variants.\"\n```\n\n``` python\ndef test_borders_divide_examples()\n \"Test divide utilities for adding borders between children.\"\n```\n\n``` python\ndef test_borders_color_examples()\n \"Test border color utilities with all variants.\"\n```\n\n``` python\ndef test_borders_divide_color_examples()\n \"Test divide color utilities for borders between children.\"\n```\n\n``` python\ndef test_borders_style_examples()\n \"Test border style utilities.\"\n```\n\n``` python\ndef test_borders_divide_style_examples()\n \"Test divide style utilities.\"\n```\n\n``` python\ndef test_borders_outline_width_examples()\n \"Test outline width utilities.\"\n```\n\n``` python\ndef test_borders_outline_color_examples()\n \"Test outline color utilities.\"\n```\n\n``` python\ndef test_borders_outline_style_examples()\n \"Test outline style utilities.\"\n```\n\n``` python\ndef test_borders_outline_offset_examples()\n \"Test outline offset utilities.\"\n```\n\n``` python\ndef test_borders_practical_examples()\n \"Test border utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef test_borders_factory_documentation()\n \"Test that border factories have accessible documentation.\"\n```\n\n#### Classes\n\n``` python\nclass RoundedFactory:\n def __init__(\n self,\n doc: Optional[str] = None # Optional documentation string\n )\n \"Factory for creating border radius utilities with all variants.\"\n \n def __init__(\n self,\n doc: Optional[str] = None # Optional documentation string\n )\n \"Initialize with documentation and create all sub-factories.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get detailed information about the rounded factory.\"\n```\n\n``` python\nclass BorderWidthUtility:\n def __init__(\n self,\n prefix: str, # The utility prefix (e.g., 'border', 'border-t')\n config: ScaleConfig = BORDER_WIDTH_CONFIG, # Configuration for valid values\n has_default: bool = True # Whether this utility has a default value (1px)\n )\n \"Utility class for border width with default value support.\"\n \n def __init__(\n self,\n prefix: str, # The utility prefix (e.g., 'border', 'border-t')\n config: ScaleConfig = BORDER_WIDTH_CONFIG, # Configuration for valid values\n has_default: bool = True # Whether this utility has a default value (1px)\n )\n \"Initialize with prefix and configuration.\"\n```\n\n``` python\nclass BorderWidthFactory:\n def __init__(\n self,\n doc: Optional[str] = None # Optional documentation string\n )\n \"Factory for creating border width utilities with directional variants.\"\n \n def __init__(\n self,\n doc: Optional[str] = None # Optional documentation string\n )\n \"Initialize with documentation and create all sub-factories.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get detailed information about the border width factory.\"\n```\n\n``` python\nclass BorderDirectionalFactory:\n def __init__(\n self,\n prefix: str, # The utility prefix (e.g., 'border-t')\n doc: str # Documentation\n )\n \"Factory for directional border width utilities.\"\n \n def __init__(\n self,\n prefix: str, # The utility prefix (e.g., 'border-t')\n doc: str # Documentation\n )\n \"Initialize with prefix and documentation.\"\n \n def describe(self) -> str\n \"Return the documentation for this factory.\"\n```\n\n``` python\nclass DivideFactory:\n def __init__(self):\n \"\"\"Initialize with divide utilities and reverse modifiers.\"\"\"\n super().__init__(\"Divide utilities for adding borders between child elements\")\n \n # Create divide width factories\n self.x = BorderDirectionalFactory(\"divide-x\", \"Horizontal divide between children\")\n self.y = BorderDirectionalFactory(\"divide-y\", \"Vertical divide between children\")\n \n # Create reverse utilities\n self.x_reverse = SingleValueFactory(\"divide-x-reverse\", \"Reverse the order of horizontal divide\")\n self.y_reverse = SingleValueFactory(\"divide-y-reverse\", \"Reverse the order of vertical divide\")\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Factory for creating divide utilities that add borders between children.\"\n \n def __init__(self):\n \"\"\"Initialize with divide utilities and reverse modifiers.\"\"\"\n super().__init__(\"Divide utilities for adding borders between child elements\")\n \n # Create divide width factories\n self.x = BorderDirectionalFactory(\"divide-x\", \"Horizontal divide between children\")\n self.y = BorderDirectionalFactory(\"divide-y\", \"Vertical divide between children\")\n \n # Create reverse utilities\n self.x_reverse = SingleValueFactory(\"divide-x-reverse\", \"Reverse the order of horizontal divide\")\n self.y_reverse = SingleValueFactory(\"divide-y-reverse\", \"Reverse the order of vertical divide\")\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Initialize with divide utilities and reverse modifiers.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the divide factory.\"\n```\n\n``` python\nclass BorderColorFactory:\n def __init__(\n self,\n doc: Optional[str] = None # Optional documentation string\n )\n \"Factory for creating border color utilities with directional variants.\"\n \n def __init__(\n self,\n doc: Optional[str] = None # Optional documentation string\n )\n \"Initialize with documentation and create all sub-factories.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get detailed information about the border color factory.\"\n```\n\n``` python\nclass OutlineWidthFactory:\n def __init__(\n self,\n doc: Optional[str] = None # Optional documentation string\n )\n \"Factory for creating outline width utilities.\"\n \n def __init__(\n self,\n doc: Optional[str] = None # Optional documentation string\n )\n \"Initialize with documentation.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get detailed information about the outline width factory.\"\n```\n\n#### Variables\n\n``` python\nRADIUS_SCALES = [8 items] # Border radius named scales\nRADIUS_CONFIG # Border radius configuration\nBORDER_WIDTH_CONFIG # Border width configuration\nOUTLINE_WIDTH_CONFIG # Outline width configuration\nOUTLINE_OFFSET_CONFIG # Outline offset configuration\n```\n\n### colors (`colors.ipynb`)\n\n> Color system builders for Tailwind CSS utilities\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.builders.colors import (\n SPECIAL_COLORS,\n ColorSpec,\n ColorValue,\n ColorFamily,\n ColorShade,\n is_valid_color_family,\n is_valid_shade,\n parse_color_spec,\n ColoredUtility,\n ColoredFactory,\n ColorFamilyProxy,\n test_colors_enum_examples,\n test_colors_validation_examples,\n test_colors_factory_examples,\n test_colors_opacity_examples,\n test_colors_arbitrary_examples,\n test_colors_proxy_examples,\n test_colors_multiple_utilities_examples,\n test_colors_practical_usage_examples,\n test_colors_modifier_examples,\n get_all_color_families,\n get_all_shades,\n get_all_color_specs,\n test_colors_factory_documentation\n)\n```\n\n#### Functions\n\n``` python\ndef is_valid_color_family(\n value: str # The value to check\n) -> bool: # True if value is a valid color family\n \"Check if a value is a valid Tailwind color family.\"\n```\n\n``` python\ndef is_valid_shade(\n value: str # The value to check\n) -> bool: # True if value is a valid shade\n \"Check if a value is a valid Tailwind shade.\"\n```\n\n``` python\ndef parse_color_spec(\n value: ColorSpec # The color specification to parse\n) -> tuple[str, Optional[str]]: # Tuple of (color_family, shade) or (special_color, None)\n \"\"\"\n Parse a color specification into family and shade.\n \n Examples:\n - \"red-500\" -> (\"red\", \"500\")\n - (\"red\", \"500\") -> (\"red\", \"500\")\n - \"transparent\" -> (\"transparent\", None)\n \"\"\"\n```\n\n``` python\ndef test_colors_enum_examples()\n \"Test color family and shade enums.\"\n```\n\n``` python\ndef test_colors_validation_examples()\n \"Test color validation functions.\"\n```\n\n``` python\ndef test_colors_factory_examples()\n \"Test ColoredFactory with various color specifications.\"\n```\n\n``` python\ndef test_colors_opacity_examples()\n \"Test opacity modifiers with color utilities.\"\n```\n\n``` python\ndef test_colors_arbitrary_examples()\n \"Test arbitrary color values and custom properties.\"\n```\n\n``` python\ndef test_colors_proxy_examples()\n \"Test ColorFamilyProxy for dot notation access.\"\n```\n\n``` python\ndef test_colors_multiple_utilities_examples()\n \"Test color system with multiple utility types.\"\n```\n\n``` python\ndef test_colors_practical_usage_examples()\n \"Test practical usage patterns with FastHTML components.\"\n```\n\n``` python\ndef test_colors_modifier_examples()\n \"Test color utilities with modifiers for conditional styling.\"\n```\n\n``` python\ndef get_all_color_families() -> List[str]\n \"Get list of all Tailwind color family names.\"\n```\n\n``` python\ndef get_all_shades() -> List[str]\n \"Get list of all Tailwind shade values.\"\n```\n\n``` python\ndef get_all_color_specs() -> List[str]:\n \"\"\"Get list of all valid color-shade combinations.\"\"\"\n specs = []\n for family in ColorFamily\n \"Get list of all valid color-shade combinations.\"\n```\n\n``` python\ndef test_colors_factory_documentation()\n \"Test that color factories have proper documentation.\"\n```\n\n#### Classes\n\n``` python\nclass ColorFamily(str, Enum):\n \"Tailwind CSS color families.\"\n```\n\n``` python\nclass ColorShade(str, Enum):\n \"Tailwind CSS color shade values.\"\n```\n\n``` python\nclass ColoredUtility:\n def __init__(\n self,\n prefix: str, # The utility prefix (e.g., 'bg', 'text', 'border')\n color: Optional[ColorValue] = None, # The color value\n opacity: Optional[Union[int, str]] = None # Optional opacity value (0-100 or arbitrary)\n )\n \"Utility class with color and opacity support.\"\n \n def __init__(\n self,\n prefix: str, # The utility prefix (e.g., 'bg', 'text', 'border')\n color: Optional[ColorValue] = None, # The color value\n opacity: Optional[Union[int, str]] = None # Optional opacity value (0-100 or arbitrary)\n )\n \"Initialize with prefix, optional color, and optional opacity.\"\n \n def opacity(\n self,\n value: Union[int, str] # Opacity value (0-100 or arbitrary)\n ) -> 'ColoredUtility': # A new instance with opacity set\n \"Return a new ColoredUtility instance with opacity value.\"\n```\n\n``` python\nclass ColoredFactory:\n def __init__(\n self,\n prefix: str, # The utility prefix (e.g., 'bg', 'text', 'border')\n doc: Optional[str] = None # Optional documentation string\n )\n \"Factory for creating color-based utilities.\"\n \n def __init__(\n self,\n prefix: str, # The utility prefix (e.g., 'bg', 'text', 'border')\n doc: Optional[str] = None # Optional documentation string\n )\n \"Initialize factory with prefix and documentation.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get detailed information about this color factory.\"\n```\n\n``` python\nclass ColorFamilyProxy:\n def __init__(\n self,\n prefix: str, # The utility prefix\n color_family: str # The color family name\n )\n \"Proxy for accessing color shades via dot notation.\"\n \n def __init__(\n self,\n prefix: str, # The utility prefix\n color_family: str # The color family name\n )\n \"Initialize with prefix and color family.\"\n```\n\n#### Variables\n\n``` python\nSPECIAL_COLORS = {5 items}\n```\n\n### Core Utilities Discovery (`core_utils_discovery.ipynb`)\n\n> Functions to discover and display core utility functions like\n> combine_classes:\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.cli.core_utils_discovery import (\n CoreUtilityInfo,\n get_core_utilities\n)\n```\n\n#### Functions\n\n``` python\ndef get_core_utilities(\n) -> List[CoreUtilityInfo]: # TODO: Add return description\n \"Get information about core utility functions.\"\n```\n\n#### Classes\n\n``` python\n@dataclass\nclass CoreUtilityInfo:\n \"Information about a core utility function.\"\n \n name: str # Function name\n module: str # Module path (e.g., 'cjm_fasthtml_tailwind.core.base')\n function: Any # The actual function object\n signature: str # Function signature\n docstring: str # Function docstring\n source: str # Source code\n import_statement: str # How to import this utility\n```\n\n### effects (`effects.ipynb`)\n\n> Shadow, opacity and other visual effect utilities for Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.utilities.effects import (\n SHADOW_SIZE_CONFIG,\n shadow,\n shadow_color,\n INSET_SHADOW_SIZE_CONFIG,\n inset_shadow,\n inset_shadow_color,\n RING_WIDTH_CONFIG,\n ring,\n ring_color,\n INSET_RING_WIDTH_CONFIG,\n inset_ring,\n inset_ring_color,\n TEXT_SHADOW_SIZE_CONFIG,\n text_shadow,\n text_shadow_color,\n OPACITY_CONFIG,\n opacity,\n mix_blend,\n bg_blend,\n mask_clip,\n mask_composite,\n mask,\n mask_linear,\n mask_t_from,\n mask_t_to,\n mask_r_from,\n mask_r_to,\n mask_b_from,\n mask_b_to,\n mask_l_from,\n mask_l_to,\n mask_x_from,\n mask_x_to,\n mask_y_from,\n mask_y_to,\n mask_radial,\n mask_circle,\n mask_ellipse,\n mask_radial_closest_corner,\n mask_radial_closest_side,\n mask_radial_farthest_corner,\n mask_radial_farthest_side,\n mask_radial_at_top_left,\n mask_radial_at_top,\n mask_radial_at_top_right,\n mask_radial_at_left,\n mask_radial_at_center,\n mask_radial_at_right,\n mask_radial_at_bottom_left,\n mask_radial_at_bottom,\n mask_radial_at_bottom_right,\n mask_radial_from,\n mask_radial_to,\n mask_conic,\n mask_conic_from,\n mask_conic_to,\n mask_mode,\n mask_origin,\n mask_position,\n mask_repeat,\n mask_size,\n mask_type,\n test_effects_shadow_size_examples,\n test_effects_shadow_arbitrary_examples,\n test_effects_shadow_color_examples,\n test_effects_shadow_color_arbitrary_examples,\n test_effects_inset_shadow_size_examples,\n test_effects_inset_shadow_arbitrary_examples,\n test_effects_inset_shadow_color_examples,\n test_effects_ring_width_examples,\n test_effects_ring_color_examples,\n test_effects_inset_ring_width_examples,\n test_effects_inset_ring_color_examples,\n test_effects_text_shadow_size_examples,\n test_effects_text_shadow_arbitrary_examples,\n test_effects_text_shadow_color_examples,\n test_effects_opacity_examples,\n test_effects_mix_blend_examples,\n test_effects_bg_blend_examples,\n test_effects_mask_clip_examples,\n test_effects_mask_composite_examples,\n MaskImageUtility,\n MaskImageFactory,\n MaskLinearUtility,\n MaskLinearFactory,\n MaskDirectionalUtility,\n MaskDirectionalFactory,\n MaskRadialUtility,\n MaskRadialFactory,\n MaskConicUtility,\n MaskConicFactory,\n test_effects_mask_basic_examples,\n test_effects_mask_linear_examples,\n test_effects_mask_directional_examples,\n test_effects_mask_radial_examples,\n test_effects_mask_conic_examples,\n test_effects_mask_properties_examples,\n test_effects_shadow_practical_examples,\n test_effects_shadow_composition_examples,\n test_effects_comprehensive_examples,\n test_effects_mask_practical_examples,\n test_effects_factory_documentation\n)\n```\n\n#### Functions\n\n``` python\ndef test_effects_shadow_size_examples()\n \"Test shadow size utilities.\"\n```\n\n``` python\ndef test_effects_shadow_arbitrary_examples()\n \"Test shadow utilities with arbitrary and custom values.\"\n```\n\n``` python\ndef test_effects_shadow_color_examples()\n \"Test shadow color utilities with various color values.\"\n```\n\n``` python\ndef test_effects_shadow_color_arbitrary_examples()\n \"Test shadow color utilities with arbitrary values.\"\n```\n\n``` python\ndef test_effects_inset_shadow_size_examples()\n \"Test inset shadow size utilities.\"\n```\n\n``` python\ndef test_effects_inset_shadow_arbitrary_examples()\n \"Test inset shadow utilities with arbitrary and custom values.\"\n```\n\n``` python\ndef test_effects_inset_shadow_color_examples()\n \"Test inset shadow color utilities with various color values.\"\n```\n\n``` python\ndef test_effects_ring_width_examples()\n \"Test ring width utilities.\"\n```\n\n``` python\ndef test_effects_ring_color_examples()\n \"Test ring color utilities with various color values.\"\n```\n\n``` python\ndef test_effects_inset_ring_width_examples()\n \"Test inset ring width utilities.\"\n```\n\n``` python\ndef test_effects_inset_ring_color_examples()\n \"Test inset ring color utilities with various color values.\"\n```\n\n``` python\ndef test_effects_text_shadow_size_examples()\n \"Test text shadow size utilities.\"\n```\n\n``` python\ndef test_effects_text_shadow_arbitrary_examples()\n \"Test text shadow utilities with arbitrary and custom values.\"\n```\n\n``` python\ndef test_effects_text_shadow_color_examples()\n \"Test text shadow color utilities with various color values.\"\n```\n\n``` python\ndef test_effects_opacity_examples()\n \"Test opacity utilities with various values.\"\n```\n\n``` python\ndef test_effects_mix_blend_examples()\n \"Test mix blend mode utilities.\"\n```\n\n``` python\ndef test_effects_bg_blend_examples()\n \"Test background blend mode utilities.\"\n```\n\n``` python\ndef test_effects_mask_clip_examples()\n \"Test mask clip utilities.\"\n```\n\n``` python\ndef test_effects_mask_composite_examples()\n \"Test mask composite utilities.\"\n```\n\n``` python\ndef test_effects_mask_basic_examples()\n \"Test basic mask image utilities.\"\n```\n\n``` python\ndef test_effects_mask_linear_examples()\n \"Test linear gradient mask utilities.\"\n```\n\n``` python\ndef test_effects_mask_directional_examples()\n \"Test directional mask gradient utilities.\"\n```\n\n``` python\ndef test_effects_mask_radial_examples()\n \"Test radial gradient mask utilities.\"\n```\n\n``` python\ndef test_effects_mask_conic_examples()\n \"Test conic gradient mask utilities.\"\n```\n\n``` python\ndef test_effects_mask_properties_examples()\n \"Test mask property utilities (mode, origin, position, etc.).\"\n```\n\n``` python\ndef test_effects_shadow_practical_examples()\n \"Test shadow utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef test_effects_shadow_composition_examples()\n \"Test composing shadow size and color utilities.\"\n```\n\n``` python\ndef test_effects_comprehensive_examples()\n \"Test comprehensive usage of all effect utilities.\"\n```\n\n``` python\ndef test_effects_mask_practical_examples()\n \"Test mask utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef test_effects_factory_documentation()\n \"Test that effect factories have accessible documentation.\"\n```\n\n#### Classes\n\n``` python\nclass MaskImageUtility:\n def __init__(\n self,\n value: Optional[str] = None, # Mask image value (none, custom property, or arbitrary)\n )\n \"Utility class for mask images.\"\n \n def __init__(\n self,\n value: Optional[str] = None, # Mask image value (none, custom property, or arbitrary)\n )\n \"Initialize mask image utility with optional value.\"\n```\n\n``` python\nclass MaskImageFactory:\n def __init__(\n self,\n doc: Optional[str] = None # Documentation\n )\n \"Factory for basic mask image utilities.\"\n \n def __init__(\n self,\n doc: Optional[str] = None # Documentation\n )\n \"Initialize mask image factory.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Factory information\n \"Get information about the mask image factory.\"\n```\n\n``` python\nclass MaskLinearUtility:\n def __init__(\n self,\n angle: Optional[Union[int, str]] = None, # Angle in degrees or custom value\n negative: bool = False # Whether to negate the angle\n )\n \"Utility class for linear gradient masks with angle support.\"\n \n def __init__(\n self,\n angle: Optional[Union[int, str]] = None, # Angle in degrees or custom value\n negative: bool = False # Whether to negate the angle\n )\n \"Initialize linear gradient mask utility.\"\n```\n\n``` python\nclass MaskLinearFactory:\n def __init__(\n self,\n doc: Optional[str] = None # Documentation\n )\n \"Factory for linear gradient mask utilities with angle support.\"\n \n def __init__(\n self,\n doc: Optional[str] = None # Documentation\n )\n \"Initialize linear gradient mask factory.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Factory information\n \"Get information about the linear gradient mask factory.\"\n```\n\n``` python\nclass MaskDirectionalUtility:\n def __init__(\n self,\n direction: str, # Direction (t, r, b, l, x, y)\n position: str, # Position type (from or to)\n value: Optional[Union[int, str]] = None, # Value (number, percentage, color, etc.)\n )\n \"Utility class for directional mask gradients with from/to support.\"\n \n def __init__(\n self,\n direction: str, # Direction (t, r, b, l, x, y)\n position: str, # Position type (from or to)\n value: Optional[Union[int, str]] = None, # Value (number, percentage, color, etc.)\n )\n \"Initialize directional mask gradient utility.\"\n```\n\n``` python\nclass MaskDirectionalFactory:\n def __init__(\n self,\n direction: str, # Direction (t, r, b, l, x, y)\n position: str, # Position type (from or to)\n doc: Optional[str] = None # Documentation\n )\n \"Factory for directional mask gradient utilities.\"\n \n def __init__(\n self,\n direction: str, # Direction (t, r, b, l, x, y)\n position: str, # Position type (from or to)\n doc: Optional[str] = None # Documentation\n )\n \"Initialize directional mask factory.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Factory information\n \"Get information about this directional mask factory.\"\n```\n\n``` python\nclass MaskRadialUtility:\n def __init__(\n self,\n value: Optional[str] = None, # Arbitrary radial gradient value\n )\n \"Utility class for radial gradient masks.\"\n \n def __init__(\n self,\n value: Optional[str] = None, # Arbitrary radial gradient value\n )\n \"Initialize radial gradient mask utility.\"\n```\n\n``` python\nclass MaskRadialFactory:\n def __init__(\n self,\n doc: Optional[str] = None # Documentation\n )\n \"Factory for radial gradient mask utilities.\"\n \n def __init__(\n self,\n doc: Optional[str] = None # Documentation\n )\n \"Initialize radial gradient mask factory.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Factory information\n \"Get information about the radial gradient mask factory.\"\n```\n\n``` python\nclass MaskConicUtility:\n def __init__(\n self,\n angle: Optional[Union[int, str]] = None, # Starting angle in degrees or custom value\n negative: bool = False # Whether to negate the angle\n )\n \"Utility class for conic gradient masks with angle support.\"\n \n def __init__(\n self,\n angle: Optional[Union[int, str]] = None, # Starting angle in degrees or custom value\n negative: bool = False # Whether to negate the angle\n )\n \"Initialize conic gradient mask utility.\"\n```\n\n``` python\nclass MaskConicFactory:\n def __init__(\n self,\n doc: Optional[str] = None # Documentation\n )\n \"Factory for conic gradient mask utilities with angle support.\"\n \n def __init__(\n self,\n doc: Optional[str] = None # Documentation\n )\n \"Initialize conic gradient mask factory.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Factory information\n \"Get information about the conic gradient mask factory.\"\n```\n\n#### Variables\n\n``` python\nSHADOW_SIZE_CONFIG\nshadow # Box shadow factory\nshadow_color # Create shadow color factory using the existing ColoredFactory\nINSET_SHADOW_SIZE_CONFIG\ninset_shadow # Inset box shadow factory\ninset_shadow_color # Create inset shadow color factory using the existing ColoredFactory\nRING_WIDTH_CONFIG\nring # Ring width factory\nring_color # Create ring color factory using the existing ColoredFactory\nINSET_RING_WIDTH_CONFIG\ninset_ring # Inset ring width factory\ninset_ring_color # Create inset ring color factory using the existing ColoredFactory\nTEXT_SHADOW_SIZE_CONFIG\ntext_shadow # Text shadow factory\ntext_shadow_color # Create text shadow color factory using the existing ColoredFactory\nOPACITY_CONFIG\nopacity # Opacity factory\nmask # Create the basic mask image factory instance\nmask_linear # Create the linear gradient mask factory instance\nmask_t_from # Top direction - from\nmask_t_to # Top direction - to\nmask_r_from # Right direction - from\nmask_r_to # Right direction - to\nmask_b_from # Bottom direction - from\nmask_b_to # Bottom direction - to\nmask_l_from # Left direction - from\nmask_l_to # Left direction - to\nmask_x_from # Horizontal (x) direction - from\nmask_x_to # Horizontal (x) direction - to\nmask_y_from # Vertical (y) direction - from\nmask_y_to # Vertical (y) direction - to\nmask_radial # Create the radial gradient mask factory instance\n```\n\n### Example Discovery (`example_discovery.ipynb`)\n\n> Functions to discover and extract test example functions:\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.cli.example_discovery import (\n ExampleInfo,\n extract_test_examples_from_module,\n list_all_examples,\n list_module_examples,\n get_example_by_name\n)\n```\n\n#### Functions\n\n``` python\ndef extract_test_examples_from_module(\n module: Any, # The module to extract test examples from\n module_name: str # The name of the module\n) -> List[ExampleInfo]: # List of ExampleInfo objects\n \"Extract all test example functions from a module.\"\n```\n\n``` python\ndef list_all_examples(\n) -> Dict[str, List[ExampleInfo]]: # Dictionary mapping module names to their examples\n \"List all test example functions across all utility modules.\"\n```\n\n``` python\ndef list_module_examples(\n module_name: str # Name of the module to inspect\n) -> List[ExampleInfo]: # List of ExampleInfo objects\n \"List all test example functions in a specific utility module.\"\n```\n\n``` python\ndef get_example_by_name(\n module_name: str, # Name of the module\n feature: str # Feature name (e.g., 'basic', 'directional')\n) -> Optional[ExampleInfo]: # ExampleInfo object or None if not found\n \"Get a specific example by module name and feature.\"\n```\n\n#### Classes\n\n``` python\n@dataclass\nclass ExampleInfo:\n \"Information about a discovered test example function.\"\n \n name: str # Function name (e.g., 'test_spacing_basic_examples')\n module_name: str # Module where it was found (e.g., 'spacing')\n feature: str # Feature being demonstrated (e.g., 'basic')\n function: Any # The actual function object\n source: str # Source code of the function\n docstring: str # Docstring of the function\n```\n\n### explorer (`explorer.ipynb`)\n\n> CLI tool for API exploration of cjm-fasthtml-tailwind utilities\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.cli.explorer import (\n display_modules,\n display_module_factories,\n display_all_factories,\n display_module_examples,\n display_all_examples,\n display_example_source,\n display_module_helpers,\n display_helper_source,\n display_all_helpers,\n display_factory_info,\n display_search_results,\n display_core_utility_source,\n display_core_utilities,\n display_imports,\n display_test_code_result,\n get_example_modules,\n get_example_factories,\n get_example_features,\n get_example_helpers,\n get_example_core_utils,\n get_combine_classes_example,\n get_example_test_code,\n add_modules_parser,\n add_factories_parser,\n add_factory_parser,\n add_examples_parser,\n add_example_parser,\n add_helpers_parser,\n add_helper_parser,\n add_search_parser,\n add_test_code_parser,\n add_core_utils_parser,\n add_core_util_parser,\n add_imports_parser,\n add_scan_parser,\n dispatch_command,\n handle_search_command,\n handle_test_code_command,\n handle_scan_command,\n setup_argument_parser,\n main\n)\n```\n\n#### Functions\n\n``` python\ndef display_modules(\n): # TODO: Add type hint\n \"Display all available utility modules with their documentation.\"\n```\n\n``` python\ndef display_module_factories(\n module_name: str # TODO: Add description\n): # TODO: Add type hint\n \"Display all factories in a specific module.\"\n```\n\n``` python\ndef display_all_factories(\n): # TODO: Add type hint\n \"Display all factories across all modules.\"\n```\n\n``` python\ndef display_module_examples(\n module_name: str # TODO: Add description\n): # TODO: Add type hint\n \"Display all usage examples in a specific module.\"\n```\n\n``` python\ndef display_all_examples(\n): # TODO: Add type hint\n \"Display all usage examples across all modules.\"\n```\n\n``` python\ndef display_example_source(\n module_name: str, # TODO: Add description\n feature: str # TODO: Add description\n): # TODO: Add type hint\n \"Display the source code of a specific example function.\"\n```\n\n``` python\ndef display_module_helpers(\n module_name: str # TODO: Add description\n): # TODO: Add type hint\n \"Display helper functions available in a specific module.\"\n```\n\n``` python\ndef display_helper_source(\n module_name: str, # TODO: Add description\n helper_name: str # TODO: Add description\n): # TODO: Add type hint\n \"Display the source code of a specific helper function.\"\n```\n\n``` python\ndef display_all_helpers(\n): # TODO: Add type hint\n \"Display all helper functions across all modules.\"\n```\n\n``` python\ndef display_factory_info(\n module_name: str, # TODO: Add description\n factory_name: str # TODO: Add description\n): # TODO: Add type hint\n \"Display detailed information about a specific factory.\"\n```\n\n``` python\ndef display_search_results(\n results: List[SearchResult], # TODO: Add description\n query: str # TODO: Add description\n): # TODO: Add type hint\n \"Display search results in a formatted way.\"\n```\n\n``` python\ndef display_core_utility_source(\n util_name: str # TODO: Add description\n): # TODO: Add type hint\n \"Display the source code of a specific core utility function.\"\n```\n\n``` python\ndef display_core_utilities(\n): # TODO: Add type hint\n \"Display all core utility functions.\"\n```\n\n``` python\ndef display_imports(\n modules: Optional[List[str]] = None # TODO: Add description\n): # TODO: Add type hint\n \"Display recommended import statements.\"\n```\n\n``` python\ndef display_test_code_result(\n success: bool, # TODO: Add description\n stdout: str, # TODO: Add description\n stderr: str, # TODO: Add description\n code: str # TODO: Add description\n): # TODO: Add type hint\n \"Display the results of test code execution.\"\n```\n\n``` python\ndef get_example_modules(\n limit: int = 2 # TODO: Add description\n) -> str: # TODO: Add return description\n \"Get example module names dynamically.\"\n```\n\n``` python\ndef get_example_factories(\n module_name: str = None, # TODO: Add description\n limit: int = 4 # TODO: Add description\n) -> str: # TODO: Add return description\n \"Get example factory names dynamically.\"\n```\n\n``` python\ndef get_example_features(\n module_name: str = None, # TODO: Add description\n limit: int = 3 # TODO: Add description\n) -> str: # TODO: Add return description\n \"Get example feature names dynamically.\"\n```\n\n``` python\ndef get_example_helpers(\n module_name: str = None, # TODO: Add description\n limit: int = 2 # TODO: Add description\n) -> str: # TODO: Add return description\n \"Get example helper function names dynamically.\"\n```\n\n``` python\ndef get_example_core_utils(\n limit: int = 2 # TODO: Add description\n) -> str: # TODO: Add return description\n \"Get example core utility names dynamically.\"\n```\n\n``` python\ndef get_combine_classes_example(\n) -> str: # TODO: Add return description\n \"Get a dynamic example of combine_classes usage.\"\n```\n\n``` python\ndef get_example_test_code(\n limit_chars: int = 50 # TODO: Add description\n) -> str: # TODO: Add return description\n \"Get an actual code example from test functions.\"\n```\n\n``` python\ndef add_modules_parser(\n subparsers # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Add the 'modules' command parser.\"\n```\n\n``` python\ndef add_factories_parser(\n subparsers # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Add the 'factories' command parser.\"\n```\n\n``` python\ndef add_factory_parser(\n subparsers # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Add the 'factory' command parser.\"\n```\n\n``` python\ndef add_examples_parser(\n subparsers # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Add the 'examples' command parser.\"\n```\n\n``` python\ndef add_example_parser(\n subparsers # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Add the 'example' command parser.\"\n```\n\n``` python\ndef add_helpers_parser(\n subparsers # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Add the 'helpers' command parser.\"\n```\n\n``` python\ndef add_helper_parser(\n subparsers # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Add the 'helper' command parser.\"\n```\n\n``` python\ndef add_search_parser(\n subparsers # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Add the 'search' command parser.\"\n```\n\n``` python\ndef add_test_code_parser(\n subparsers # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Add the 'test-code' command parser.\"\n```\n\n``` python\ndef add_core_utils_parser(\n subparsers # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Add the 'core-utils' command parser.\"\n```\n\n``` python\ndef add_core_util_parser(\n subparsers # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Add the 'core-util' command parser.\"\n```\n\n``` python\ndef add_imports_parser(\n subparsers # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Add the 'imports' command parser.\"\n```\n\n``` python\ndef add_scan_parser(\n subparsers # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Add the 'scan' command parser.\"\n```\n\n``` python\ndef dispatch_command(\n args # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Dispatch the parsed arguments to the appropriate handler.\"\n```\n\n``` python\ndef handle_search_command(\n args # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Handle the search command.\"\n```\n\n``` python\ndef handle_test_code_command(\n args # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Handle the test-code command.\"\n```\n\n``` python\ndef handle_scan_command(\n args # TODO: Add type hint and description\n): # TODO: Add type hint\n \"Handle the scan command.\"\n```\n\n``` python\ndef setup_argument_parser(\n): # TODO: Add type hint\n \"Set up the main argument parser with all subcommands.\"\n```\n\n``` python\ndef main(\n): # TODO: Add type hint\n \"CLI entry point for exploring cjm-fasthtml-tailwind utilities.\"\n```\n\n### Factory Extraction (`factory_extraction.ipynb`)\n\n> Functions to extract BaseFactory instances from modules:\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.cli.factory_extraction import (\n FactoryInfo,\n extract_factories_from_module,\n list_all_factories,\n list_module_factories,\n get_factory_by_name\n)\n```\n\n#### Functions\n\n``` python\ndef extract_factories_from_module(\n module: Any, # The module to extract factories from\n module_name: str # The name of the module\n) -> List[FactoryInfo]: # List of FactoryInfo objects\n \"Extract all BaseFactory instances from a module.\"\n```\n\n``` python\ndef list_all_factories(\n) -> Dict[str, List[FactoryInfo]]: # Dictionary mapping module names to their factories\n \"List all factory instances across all utility modules.\"\n```\n\n``` python\ndef list_module_factories(\n module_name: str # Name of the module to inspect (e.g., 'spacing', 'sizing')\n) -> List[FactoryInfo]: # List of FactoryInfo objects for the module\n \"List all factory instances in a specific utility module.\"\n```\n\n``` python\ndef get_factory_by_name(\n module_name: str, # Name of the module\n factory_name: str # Name of the factory (e.g., 'p', 'w', 'flex')\n) -> Optional[FactoryInfo]: # FactoryInfo object or None if not found\n \"Get a specific factory by module name and factory name.\"\n```\n\n#### Classes\n\n``` python\n@dataclass\nclass FactoryInfo:\n \"Information about a discovered factory instance.\"\n \n name: str # Factory variable name (e.g., 'p', 'w', 'flex')\n factory: BaseFactory # The actual factory instance\n doc: str # Documentation from the factory\n module_name: str # Module where it was found\n```\n\n### filters (`filters.ipynb`)\n\n> Filter utilities for Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.utilities.filters import (\n filter_none,\n BLUR_SCALES,\n blur,\n BRIGHTNESS_VALUES,\n brightness_config,\n brightness,\n CONTRAST_VALUES,\n contrast,\n DROP_SHADOW_SCALES,\n drop_shadow,\n drop_shadow_color,\n grayscale,\n HUE_ROTATE_VALUES,\n hue_rotate_config,\n hue_rotate,\n invert,\n SATURATE_VALUES,\n saturate,\n sepia,\n backdrop_filter_none,\n backdrop_blur,\n backdrop_brightness,\n backdrop_contrast,\n backdrop_saturate,\n backdrop_opacity,\n backdrop_grayscale,\n backdrop_sepia,\n backdrop_hue_rotate,\n test_filters_control_examples,\n BlurScale,\n test_filters_blur_examples,\n test_filters_brightness_examples,\n test_filters_contrast_examples,\n DropShadowScale,\n test_filters_drop_shadow_examples,\n test_filters_grayscale_examples,\n test_filters_hue_rotate_examples,\n test_filters_invert_examples,\n test_filters_saturate_examples,\n test_filters_sepia_examples,\n test_filters_backdrop_examples,\n test_filters_practical_examples,\n test_filters_factory_documentation\n)\n```\n\n#### Functions\n\n``` python\ndef test_filters_control_examples()\n \"Test filter control utilities.\"\n```\n\n``` python\ndef test_filters_blur_examples()\n \"Test blur filter utilities.\"\n```\n\n``` python\ndef test_filters_brightness_examples()\n \"Test brightness filter utilities.\"\n```\n\n``` python\ndef test_filters_contrast_examples()\n \"Test contrast filter utilities.\"\n```\n\n``` python\ndef test_filters_drop_shadow_examples()\n \"Test drop shadow filter utilities.\"\n```\n\n``` python\ndef test_filters_grayscale_examples()\n \"Test grayscale filter utilities.\"\n```\n\n``` python\ndef test_filters_hue_rotate_examples()\n \"Test hue rotate filter utilities.\"\n```\n\n``` python\ndef test_filters_invert_examples()\n \"Test invert filter utilities.\"\n```\n\n``` python\ndef test_filters_saturate_examples()\n \"Test saturate filter utilities.\"\n```\n\n``` python\ndef test_filters_sepia_examples()\n \"Test sepia filter utilities.\"\n```\n\n``` python\ndef test_filters_backdrop_examples()\n \"Test backdrop filter utilities.\"\n```\n\n``` python\ndef test_filters_practical_examples()\n \"Test filter utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef test_filters_factory_documentation()\n \"Test that filter factories have accessible documentation.\"\n```\n\n#### Classes\n\n``` python\n@dataclass\nclass BlurScale:\n \"Represents a blur scale with name and pixel value.\"\n \n name: str\n pixels: str\n var: str\n \n def format(self) -> str\n \"Format as Tailwind class suffix.\"\n```\n\n``` python\n@dataclass\nclass DropShadowScale:\n \"Represents a drop shadow scale with name and shadow value.\"\n \n name: str\n shadow: str\n var: str\n \n def format(self) -> str\n \"Format as Tailwind class suffix.\"\n```\n\n#### Variables\n\n``` python\nfilter_none # Remove filters\nBLUR_SCALES = [7 items]\nBRIGHTNESS_VALUES = [11 items]\nCONTRAST_VALUES = [7 items]\nDROP_SHADOW_SCALES = [6 items]\nHUE_ROTATE_VALUES = [6 items]\nSATURATE_VALUES = [5 items]\nbackdrop_filter_none # Remove backdrop filters\n```\n\n### flexbox_and_grid (`flexbox_and_grid.ipynb`)\n\n> Flexbox and CSS Grid utilities for Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.utilities.flexbox_and_grid import (\n FLEX_BASIS_CONFIG,\n basis,\n FLEX_DIRECTION_VALUES,\n flex_direction,\n FLEX_WRAP_VALUES,\n flex_wrap,\n FLEX_CONFIG,\n flex,\n FLEX_GROW_CONFIG,\n grow,\n FLEX_SHRINK_CONFIG,\n shrink,\n ORDER_CONFIG,\n order,\n GRID_COLS_CONFIG,\n grid_cols,\n GRID_ROWS_CONFIG,\n grid_rows,\n COL_SPAN_CONFIG,\n COL_START_END_CONFIG,\n col_span,\n col_start,\n col_end,\n col,\n ROW_SPAN_CONFIG,\n ROW_START_END_CONFIG,\n row_span,\n row_start,\n row_end,\n row,\n GRID_FLOW_VALUES,\n grid_flow,\n AUTO_COLS_VALUES,\n AUTO_ROWS_VALUES,\n auto_cols,\n auto_rows,\n gap,\n JUSTIFY_CONTENT_VALUES,\n justify,\n JUSTIFY_ITEMS_VALUES,\n justify_items,\n JUSTIFY_SELF_VALUES,\n justify_self,\n ALIGN_CONTENT_VALUES,\n content,\n ALIGN_ITEMS_VALUES,\n items,\n ALIGN_SELF_VALUES,\n self_align,\n PLACE_CONTENT_VALUES,\n place_content,\n PLACE_ITEMS_VALUES,\n place_items,\n PLACE_SELF_VALUES,\n place_self,\n test_flexbox_and_grid_basis_examples,\n test_flexbox_and_grid_direction_examples,\n test_flexbox_and_grid_wrap_examples,\n test_flexbox_and_grid_flex_examples,\n GrowFactory,\n test_flexbox_and_grid_grow_examples,\n ShrinkFactory,\n test_flexbox_and_grid_shrink_examples,\n test_flexbox_and_grid_order_examples,\n test_flexbox_and_grid_template_columns_examples,\n test_flexbox_and_grid_template_rows_examples,\n ColFactory,\n test_flexbox_and_grid_column_examples,\n RowFactory,\n test_flexbox_and_grid_row_examples,\n test_flexbox_and_grid_flow_examples,\n AutoColsFactory,\n AutoRowsFactory,\n test_flexbox_and_grid_auto_cols_rows_examples,\n GapFactory,\n test_flexbox_and_grid_gap_examples,\n test_flexbox_and_grid_justify_examples,\n test_flexbox_and_grid_align_examples,\n test_flexbox_and_grid_place_examples,\n test_flexbox_and_grid_practical_examples,\n flex_center,\n flex_between,\n flex_col_center,\n grid_center,\n responsive_grid,\n test_flexbox_and_grid_helper_examples,\n test_flexbox_and_grid_factory_documentation\n)\n```\n\n#### Functions\n\n``` python\ndef test_flexbox_and_grid_basis_examples(\n): # TODO: Add type hint\n \"Test flex basis utilities with various scale values.\"\n```\n\n``` python\ndef test_flexbox_and_grid_direction_examples(\n): # TODO: Add type hint\n \"Test flex direction utilities.\"\n```\n\n``` python\ndef test_flexbox_and_grid_wrap_examples(\n): # TODO: Add type hint\n \"Test flex wrap utilities.\"\n```\n\n``` python\ndef test_flexbox_and_grid_flex_examples(\n): # TODO: Add type hint\n \"Test flex utilities for combined grow/shrink properties.\"\n```\n\n``` python\ndef test_flexbox_and_grid_grow_examples(\n): # TODO: Add type hint\n \"Test flex grow utilities.\"\n```\n\n``` python\ndef test_flexbox_and_grid_shrink_examples(\n): # TODO: Add type hint\n \"Test flex shrink utilities.\"\n```\n\n``` python\ndef test_flexbox_and_grid_order_examples(\n): # TODO: Add type hint\n \"Test order utilities for flex and grid items.\"\n```\n\n``` python\ndef test_flexbox_and_grid_template_columns_examples(\n): # TODO: Add type hint\n \"Test grid template columns utilities.\"\n```\n\n``` python\ndef test_flexbox_and_grid_template_rows_examples(\n): # TODO: Add type hint\n \"Test grid template rows utilities.\"\n```\n\n``` python\ndef test_flexbox_and_grid_column_examples(\n): # TODO: Add type hint\n \"Test grid column utilities including span, start, and end.\"\n```\n\n``` python\ndef test_flexbox_and_grid_row_examples(\n): # TODO: Add type hint\n \"Test grid row utilities including span, start, and end.\"\n```\n\n``` python\ndef test_flexbox_and_grid_flow_examples(\n): # TODO: Add type hint\n \"Test grid auto flow utilities.\"\n```\n\n``` python\ndef test_flexbox_and_grid_auto_cols_rows_examples(\n): # TODO: Add type hint\n \"Test grid auto columns and rows utilities.\"\n```\n\n``` python\ndef test_flexbox_and_grid_gap_examples(\n): # TODO: Add type hint\n \"Test gap utilities for flexbox and grid containers.\"\n```\n\n``` python\ndef test_flexbox_and_grid_justify_examples(\n): # TODO: Add type hint\n \"Test justify utilities for flex and grid containers.\"\n```\n\n``` python\ndef test_flexbox_and_grid_align_examples(\n): # TODO: Add type hint\n \"Test align utilities for flex and grid containers.\"\n```\n\n``` python\ndef test_flexbox_and_grid_place_examples(\n): # TODO: Add type hint\n \"Test place utilities for grid containers.\"\n```\n\n``` python\ndef test_flexbox_and_grid_practical_examples(\n): # TODO: Add type hint\n \"Test flexbox and grid utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef flex_center(\n) -> str: # Combined CSS classes for centered flex container\n \"Create classes for a flex container that centers its content.\"\n```\n\n``` python\ndef flex_between(\n) -> str: # Combined CSS classes for flex container with space between\n \"Create classes for a flex container with space between items.\"\n```\n\n``` python\ndef flex_col_center(\n) -> str: # Combined CSS classes for centered vertical flex container\n \"Create classes for a vertical flex container that centers its content.\"\n```\n\n``` python\ndef grid_center(\n) -> str: # Combined CSS classes for centered grid container\n \"Create classes for a grid container that centers its content.\"\n```\n\n``` python\ndef responsive_grid(\n mobile: int = 1, # Number of columns on mobile devices\n tablet: int = 2, # Number of columns on tablet devices\n desktop: int = 3, # Number of columns on desktop devices\n gap_size: TailwindScale = 4 # Gap size between grid items\n) -> str: # Combined CSS classes for responsive grid\n \"Create responsive grid classes with customizable breakpoints.\"\n```\n\n``` python\ndef test_flexbox_and_grid_helper_examples(\n): # TODO: Add type hint\n \"Test helper functions for common flexbox and grid patterns.\"\n```\n\n``` python\ndef test_flexbox_and_grid_factory_documentation(\n): # TODO: Add type hint\n \"Test that factories have accessible documentation.\"\n```\n\n#### Classes\n\n``` python\nclass GrowFactory:\n def __init__(self):\n \"Initialize with grow configuration and documentation.\"\n super().__init__(\"grow\", FLEX_GROW_CONFIG, \"Flex grow utilities for controlling how flex items grow\")\n \n def __call__(\n self,\n value: Optional[TailwindScale] = None # The grow value (defaults to 1 if None)\n ) -> ScaledUtility: # A new grow utility instance\n \"Special factory for grow that defaults to grow-1 when called without args.\"\n \n def __init__(self):\n \"Initialize with grow configuration and documentation.\"\n super().__init__(\"grow\", FLEX_GROW_CONFIG, \"Flex grow utilities for controlling how flex items grow\")\n \n def __call__(\n self,\n value: Optional[TailwindScale] = None # The grow value (defaults to 1 if None)\n ) -> ScaledUtility: # A new grow utility instance\n \"Initialize with grow configuration and documentation.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about this grow factory.\"\n```\n\n``` python\nclass ShrinkFactory:\n def __init__(self):\n \"Initialize with shrink configuration and documentation.\"\n super().__init__(\"shrink\", FLEX_SHRINK_CONFIG, \"Flex shrink utilities for controlling how flex items shrink\")\n \n def __call__(\n self,\n value: Optional[TailwindScale] = None # The shrink value (defaults to 1 if None)\n ) -> ScaledUtility: # A new shrink utility instance\n \"Special factory for shrink that defaults to shrink-1 when called without args.\"\n \n def __init__(self):\n \"Initialize with shrink configuration and documentation.\"\n super().__init__(\"shrink\", FLEX_SHRINK_CONFIG, \"Flex shrink utilities for controlling how flex items shrink\")\n \n def __call__(\n self,\n value: Optional[TailwindScale] = None # The shrink value (defaults to 1 if None)\n ) -> ScaledUtility: # A new shrink utility instance\n \"Initialize with shrink configuration and documentation.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about this shrink factory.\"\n```\n\n``` python\nclass ColFactory:\n def __init__(self):\n \"Initialize with 'col' prefix and column configuration.\"\n super().__init__(\"col\", COL_START_END_CONFIG, \"Grid column utilities for arbitrary grid-column values\")\n \n @property\n def auto(\n self\n ) -> str: # The 'col-auto' CSS class\n \"Special factory for grid-column shorthand.\"\n \n def __init__(self):\n \"Initialize with 'col' prefix and column configuration.\"\n super().__init__(\"col\", COL_START_END_CONFIG, \"Grid column utilities for arbitrary grid-column values\")\n \n @property\n def auto(\n self\n ) -> str: # The 'col-auto' CSS class\n \"Initialize with 'col' prefix and column configuration.\"\n \n def auto(\n self\n ) -> str: # The 'col-auto' CSS class\n \"Return the col-auto utility class.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about this column factory.\"\n```\n\n``` python\nclass RowFactory:\n def __init__(self):\n \"Initialize with 'row' prefix and row configuration.\"\n super().__init__(\"row\", ROW_START_END_CONFIG, \"Grid row utilities for arbitrary grid-row values\")\n \n @property\n def auto(\n self\n ) -> str: # The 'row-auto' CSS class\n \"Special factory for grid-row shorthand.\"\n \n def __init__(self):\n \"Initialize with 'row' prefix and row configuration.\"\n super().__init__(\"row\", ROW_START_END_CONFIG, \"Grid row utilities for arbitrary grid-row values\")\n \n @property\n def auto(\n self\n ) -> str: # The 'row-auto' CSS class\n \"Initialize with 'row' prefix and row configuration.\"\n \n def auto(\n self\n ) -> str: # The 'row-auto' CSS class\n \"Return the row-auto utility class.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about this row factory.\"\n```\n\n``` python\nclass AutoColsFactory:\n def __init__(self):\n \"Initialize with auto columns values and documentation.\"\n super().__init__(AUTO_COLS_VALUES, \"Grid auto columns utilities for controlling the size of implicitly-created grid columns\")\n \n def __call__(\n self,\n value: str # Custom auto-cols value (e.g., '200px', 'minmax(0, 1fr)')\n ) -> str: # The formatted auto-cols CSS class\n \"Factory for auto-cols with custom value support.\"\n \n def __init__(self):\n \"Initialize with auto columns values and documentation.\"\n super().__init__(AUTO_COLS_VALUES, \"Grid auto columns utilities for controlling the size of implicitly-created grid columns\")\n \n def __call__(\n self,\n value: str # Custom auto-cols value (e.g., '200px', 'minmax(0, 1fr)')\n ) -> str: # The formatted auto-cols CSS class\n \"Initialize with auto columns values and documentation.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about this auto columns factory.\"\n```\n\n``` python\nclass AutoRowsFactory:\n def __init__(self):\n \"Initialize with auto rows values and documentation.\"\n super().__init__(AUTO_ROWS_VALUES, \"Grid auto rows utilities for controlling the size of implicitly-created grid rows\")\n \n def __call__(\n self,\n value: str # Custom auto-rows value (e.g., '200px', 'minmax(0, 1fr)')\n ) -> str: # The formatted auto-rows CSS class\n \"Factory for auto-rows with custom value support.\"\n \n def __init__(self):\n \"Initialize with auto rows values and documentation.\"\n super().__init__(AUTO_ROWS_VALUES, \"Grid auto rows utilities for controlling the size of implicitly-created grid rows\")\n \n def __call__(\n self,\n value: str # Custom auto-rows value (e.g., '200px', 'minmax(0, 1fr)')\n ) -> str: # The formatted auto-rows CSS class\n \"Initialize with auto rows values and documentation.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about this auto rows factory.\"\n```\n\n``` python\nclass GapFactory:\n def __init__(self):\n \"Initialize with base gap and directional gap factories.\"\n super().__init__(\"Gap utilities for controlling gutters between grid and flexbox items\")\n # Base gap utility\n self._base = ScaledFactory(\"gap\", SPACING_CONFIG, \"Gap utilities for controlling gutters between grid and flexbox items\")\n # Directional gap utilities with hyphens\n self.x = ScaledFactory(\"gap-x\", SPACING_CONFIG, \"Column gap utilities for controlling gutters between columns\")\n self.y = ScaledFactory(\"gap-y\", SPACING_CONFIG, \"Row gap utilities for controlling gutters between rows\")\n \n def __call__(\n self,\n value: Optional[TailwindScale] = None # The gap value (numeric, px, or arbitrary)\n ) -> ScaledUtility: # A new gap utility instance\n \"Special factory for gap utilities that use hyphenated directions.\"\n \n def __init__(self):\n \"Initialize with base gap and directional gap factories.\"\n super().__init__(\"Gap utilities for controlling gutters between grid and flexbox items\")\n # Base gap utility\n self._base = ScaledFactory(\"gap\", SPACING_CONFIG, \"Gap utilities for controlling gutters between grid and flexbox items\")\n # Directional gap utilities with hyphens\n self.x = ScaledFactory(\"gap-x\", SPACING_CONFIG, \"Column gap utilities for controlling gutters between columns\")\n self.y = ScaledFactory(\"gap-y\", SPACING_CONFIG, \"Row gap utilities for controlling gutters between rows\")\n \n def __call__(\n self,\n value: Optional[TailwindScale] = None # The gap value (numeric, px, or arbitrary)\n ) -> ScaledUtility: # A new gap utility instance\n \"Initialize with base gap and directional gap factories.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the gap factory.\"\n```\n\n#### Variables\n\n``` python\nFLEX_BASIS_CONFIG # Create configuration for flex basis - similar to width/height but with container scales\nbasis # The flex basis factory\nFLEX_DIRECTION_VALUES = {4 items} # Flex direction utilities\nflex_direction # The flex direction factory\nFLEX_WRAP_VALUES = {3 items} # Flex wrap utilities\nflex_wrap # The flex wrap factory\nFLEX_CONFIG # Flex configuration - supports numeric values and special presets\nflex # The flex factory\nFLEX_GROW_CONFIG # Flex grow configuration\ngrow # The flex grow factory\nFLEX_SHRINK_CONFIG # Flex shrink configuration (same as grow)\nshrink # The flex shrink factory\nORDER_CONFIG # Order configuration - supports numeric values including negative\norder # The order factory\nGRID_COLS_CONFIG # Grid template columns configuration\ngrid_cols # The grid columns factory\nGRID_ROWS_CONFIG # Grid template rows configuration (same as columns)\ngrid_rows # The grid rows factory\nCOL_SPAN_CONFIG # Grid column span configuration\nCOL_START_END_CONFIG # Grid column start/end configuration\ncol_span # Column span factory\ncol_start # Column start factory\ncol_end # Column end factory\ncol # The grid column factory\nROW_SPAN_CONFIG # Grid row span configuration (same as column)\nROW_START_END_CONFIG # Grid row start/end configuration (same as column)\nrow_span # Row span factory\nrow_start # Row start factory\nrow_end # Row end factory\nrow # The grid row factory\nGRID_FLOW_VALUES = {5 items} # Grid auto flow utilities\ngrid_flow # The grid flow factory\nAUTO_COLS_VALUES = {4 items} # Grid auto columns values\nAUTO_ROWS_VALUES = {4 items} # Grid auto rows values\nauto_cols # The auto columns factory\nauto_rows # The auto rows factory\ngap # The gap factory\nJUSTIFY_CONTENT_VALUES = {11 items} # Justify content values\njustify # The justify content factory\nJUSTIFY_ITEMS_VALUES = {7 items} # Justify items values\njustify_items # The justify items factory\nJUSTIFY_SELF_VALUES = {7 items} # Justify self values\njustify_self # The justify self factory\nALIGN_CONTENT_VALUES = {9 items} # Align content values\ncontent # The align content factory\nALIGN_ITEMS_VALUES = {8 items} # Align items values\nitems # The align items factory\nALIGN_SELF_VALUES = {9 items} # Align self values\nself_align # The align self factory (renamed to avoid conflict with Python's self)\nPLACE_CONTENT_VALUES = {10 items} # Place content values\nplace_content # The place content factory\nPLACE_ITEMS_VALUES = {7 items} # Place items values\nplace_items # The place items factory\nPLACE_SELF_VALUES = {7 items} # Place self values\nplace_self # The place self factory\n```\n\n### Helper Function Discovery (`helper_discovery.ipynb`)\n\n> Functions to discover and extract helper functions:\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.cli.helper_discovery import (\n HelperInfo,\n get_helper_examples,\n get_module_helpers\n)\n```\n\n#### Functions\n\n``` python\ndef get_helper_examples(\n module_name: str # Name of the module to inspect\n) -> Optional[ExampleInfo]: # ExampleInfo object or None if not found\n \"Get the helper examples test function for a module.\"\n```\n\n``` python\ndef get_module_helpers(\n module_name: str # Name of the module to inspect\n) -> List[HelperInfo]: # List of HelperInfo objects\n \"Get helper functions from a module based on its test_<module>_helper_examples function.\"\n```\n\n#### Classes\n\n``` python\n@dataclass\nclass HelperInfo:\n \"Information about a discovered helper function.\"\n \n name: str # Function name (e.g., 'pad', 'margin', 'combine_classes')\n module_name: str # Module where it was found\n function: Any # The actual function object\n signature: str # Function signature\n docstring: str # Function docstring\n source: str # Source code of the function\n```\n\n### imports (`imports.ipynb`)\n\n> Functions for getting import statements.\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.cli.imports import (\n get_recommended_imports\n)\n```\n\n#### Functions\n\n``` python\ndef get_recommended_imports(\n modules: Optional[List[str]] = None # Specific modules to include, or None for all\n) -> List[str]: # List of import statements\n \"Get recommended import statements for using the library.\"\n```\n\n### interactivity (`interactivity.ipynb`)\n\n> Interactivity utilities for Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.utilities.interactivity import (\n accent,\n appearance,\n caret,\n scheme,\n cursor,\n field_sizing,\n pointer_events,\n resize,\n scroll,\n scroll_m,\n scroll_ms,\n scroll_me,\n scroll_p,\n scroll_ps,\n scroll_pe,\n snap_align,\n snap_stop,\n snap,\n touch,\n select,\n will_change,\n test_interactivity_accent_examples,\n test_interactivity_appearance_examples,\n test_interactivity_caret_examples,\n test_interactivity_scheme_examples,\n CursorFactory,\n test_interactivity_cursor_examples,\n test_interactivity_field_sizing_examples,\n test_interactivity_pointer_events_examples,\n test_interactivity_resize_examples,\n test_interactivity_scroll_behavior_examples,\n test_interactivity_scroll_margin_examples,\n test_interactivity_scroll_padding_examples,\n test_interactivity_scroll_snap_examples,\n test_interactivity_touch_action_examples,\n test_interactivity_user_select_examples,\n WillChangeFactory,\n test_interactivity_will_change_examples,\n test_interactivity_form_practical_examples,\n test_interactivity_scroll_snap_practical_examples,\n test_interactivity_touch_mobile_practical_examples,\n test_interactivity_factory_documentation,\n test_interactivity_advanced_practical_examples\n)\n```\n\n#### Functions\n\n``` python\ndef test_interactivity_accent_examples()\n \"Test accent color utilities.\"\n```\n\n``` python\ndef test_interactivity_appearance_examples()\n \"Test appearance utilities.\"\n```\n\n``` python\ndef test_interactivity_caret_examples()\n \"Test caret color utilities.\"\n```\n\n``` python\ndef test_interactivity_scheme_examples()\n \"Test color scheme utilities.\"\n```\n\n``` python\ndef test_interactivity_cursor_examples()\n \"Test cursor utilities.\"\n```\n\n``` python\ndef test_interactivity_field_sizing_examples()\n \"Test field sizing utilities.\"\n```\n\n``` python\ndef test_interactivity_pointer_events_examples()\n \"Test pointer events utilities.\"\n```\n\n``` python\ndef test_interactivity_resize_examples()\n \"Test resize utilities.\"\n```\n\n``` python\ndef test_interactivity_scroll_behavior_examples()\n \"Test scroll behavior utilities.\"\n```\n\n``` python\ndef test_interactivity_scroll_margin_examples()\n \"Test scroll margin utilities.\"\n```\n\n``` python\ndef test_interactivity_scroll_padding_examples()\n \"Test scroll padding utilities.\"\n```\n\n``` python\ndef test_interactivity_scroll_snap_examples()\n \"Test scroll snap utilities.\"\n```\n\n``` python\ndef test_interactivity_touch_action_examples()\n \"Test touch action utilities.\"\n```\n\n``` python\ndef test_interactivity_user_select_examples()\n \"Test user select utilities.\"\n```\n\n``` python\ndef test_interactivity_will_change_examples()\n \"Test will-change utilities.\"\n```\n\n``` python\ndef test_interactivity_form_practical_examples()\n \"Test interactivity utilities in form components.\"\n```\n\n``` python\ndef test_interactivity_scroll_snap_practical_examples()\n \"Test scroll snap utilities in carousel/gallery components.\"\n```\n\n``` python\ndef test_interactivity_touch_mobile_practical_examples()\n \"Test touch and mobile interaction utilities.\"\n```\n\n``` python\ndef test_interactivity_factory_documentation()\n \"Test that interactivity factories have accessible documentation.\"\n```\n\n``` python\ndef test_interactivity_advanced_practical_examples()\n \"Test advanced combinations of interactivity utilities.\"\n```\n\n#### Classes\n\n``` python\nclass CursorFactory(SimpleFactory):\n \"Factory for cursor utilities with arbitrary value support.\"\n \n```\n\n``` python\nclass WillChangeFactory(SimpleFactory):\n \"Factory for will-change utilities with arbitrary value support.\"\n \n```\n\n#### Variables\n\n``` python\naccent # The accent color factory\ncaret # The caret color factory\nscroll_m # The scroll margin factory\nscroll_ms # scroll-margin-inline-start\nscroll_me # scroll-margin-inline-end\nscroll_p # The scroll padding factory\nscroll_ps # scroll-padding-inline-start\nscroll_pe # scroll-padding-inline-end\n```\n\n### layout (`layout.ipynb`)\n\n> Display, position, overflow, z-index and other layout utilities for\n> Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.utilities.layout import (\n DISPLAY_VALUES,\n display_tw,\n sr_only,\n not_sr_only,\n POSITION_VALUES,\n position,\n inset,\n top,\n right,\n bottom,\n left,\n start,\n end,\n OVERFLOW_VALUES,\n overflow,\n Z_INDEX_CONFIG,\n z,\n FLOAT_VALUES,\n float_tw,\n CLEAR_VALUES,\n clear,\n OBJECT_FIT_VALUES,\n object_fit,\n OBJECT_POSITION_VALUES,\n object_position,\n VISIBILITY_VALUES,\n visibility,\n BOX_SIZING_VALUES,\n box,\n ISOLATION_VALUES,\n isolation,\n ASPECT_RATIO_VALUES,\n aspect,\n COLUMNS_CONFIG,\n columns,\n BREAK_BEFORE_VALUES,\n BREAK_AFTER_VALUES,\n BREAK_INSIDE_VALUES,\n break_util,\n BOX_DECORATION_VALUES,\n box_decoration,\n OVERSCROLL_VALUES,\n overscroll,\n test_layout_display_examples,\n test_layout_position_examples,\n InsetDirectionalFactory,\n test_layout_inset_examples,\n OverflowFactory,\n test_layout_overflow_examples,\n test_layout_z_index_examples,\n test_layout_float_clear_examples,\n ObjectPositionFactory,\n test_layout_object_examples,\n test_layout_visibility_examples,\n AspectRatioFactory,\n test_layout_aspect_columns_examples,\n test_layout_columns_examples,\n BreakFactory,\n OverscrollFactory,\n test_layout_other_utilities_examples,\n test_layout_practical_examples,\n test_layout_enhanced_factories_examples,\n test_layout_modifier_examples,\n test_layout_factory_documentation,\n center_absolute,\n stack_context,\n sticky_top,\n full_bleed,\n test_layout_helper_examples\n)\n```\n\n#### Functions\n\n``` python\ndef test_layout_display_examples(\n)\n \"Test display utilities with various values.\"\n```\n\n``` python\ndef test_layout_position_examples(\n)\n \"Test position utilities.\"\n```\n\n``` python\ndef test_layout_inset_examples(\n)\n \"Test inset utilities for positioning elements.\"\n```\n\n``` python\ndef test_layout_overflow_examples(\n)\n \"Test overflow utilities for content handling.\"\n```\n\n``` python\ndef test_layout_z_index_examples(\n)\n \"Test z-index utilities for stack ordering.\"\n```\n\n``` python\ndef test_layout_float_clear_examples(\n)\n \"Test float and clear utilities for content wrapping.\"\n```\n\n``` python\ndef test_layout_object_examples(\n)\n \"Test object fit and position utilities.\"\n```\n\n``` python\ndef test_layout_visibility_examples(\n)\n \"Test visibility and box sizing utilities.\"\n```\n\n``` python\ndef test_layout_aspect_columns_examples(\n)\n \"Test aspect ratio and columns utilities.\"\n```\n\n``` python\ndef test_layout_columns_examples(\n)\n \"Test columns utilities.\"\n```\n\n``` python\ndef test_layout_other_utilities_examples(\n)\n \"Test isolation, break, box decoration, and overscroll utilities.\"\n```\n\n``` python\ndef test_layout_practical_examples(\n)\n \"Test layout utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef test_layout_enhanced_factories_examples(\n)\n \"Test enhanced factories with modifier support in practical examples.\"\n```\n\n``` python\ndef test_layout_modifier_examples(\n)\n \"Test layout utilities with modifiers for conditional styling.\"\n```\n\n``` python\ndef test_layout_factory_documentation(\n)\n \"Test that factories have accessible documentation.\"\n```\n\n``` python\ndef center_absolute(\n) -> str: # Combined CSS classes for centering an element\n \"Center an absolutely positioned element.\"\n```\n\n``` python\ndef stack_context(\n z_value: int = 10 # The z-index value for the stacking context\n) -> str: # Combined CSS classes for creating a stacking context\n \"Create a stacking context with z-index.\"\n```\n\n``` python\ndef sticky_top(\n offset: TailwindScale = 0 # Top offset value (e.g., 0, 4, '1rem')\n) -> str: # Combined CSS classes for sticky positioning\n \"Make element sticky at top with optional offset.\"\n```\n\n``` python\ndef full_bleed(\n) -> str: # Combined CSS classes for full-bleed layout\n \"Make element break out of container constraints.\"\n```\n\n``` python\ndef test_layout_helper_examples(\n)\n \"Test helper functions for common layout patterns.\"\n```\n\n#### Classes\n\n``` python\nclass InsetDirectionalFactory:\n def __init__(\n self,\n prefix: str, # The base prefix ('inset')\n config: ScaleConfig # Configuration defining valid scales and values\n )\n \"Special factory for inset utilities that use hyphenated directions.\"\n \n def __init__(\n self,\n prefix: str, # The base prefix ('inset')\n config: ScaleConfig # Configuration defining valid scales and values\n )\n \"Initialize with prefix and scale configuration.\"\n \n def negative(\n self\n ) -> 'NegativeFactory': # A factory for creating negative variants\n \"Return a negative variant factory.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get detailed information about this inset factory.\"\n```\n\n``` python\nclass OverflowFactory:\n def __init__(self):\n \"Initialize with overflow values and directional sub-factories.\"\n super().__init__(\"Overflow utilities for controlling how an element handles content that is too large\")\n # Create base overflow utilities\n self._values = {value: f\"overflow-{value}\" for value in OVERFLOW_VALUES}\n \"Factory for overflow utilities with directional support.\"\n \n def __init__(self):\n \"Initialize with overflow values and directional sub-factories.\"\n super().__init__(\"Overflow utilities for controlling how an element handles content that is too large\")\n # Create base overflow utilities\n self._values = {value: f\"overflow-{value}\" for value in OVERFLOW_VALUES}\n \"Initialize with overflow values and directional sub-factories.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the overflow factory.\"\n```\n\n``` python\nclass ObjectPositionFactory(SimpleFactory):\n \"Factory for object position with both fixed and custom values.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the object position factory.\"\n```\n\n``` python\nclass AspectRatioFactory(SimpleFactory):\n \"Factory for aspect ratio with both fixed and custom values.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the aspect ratio factory.\"\n```\n\n``` python\nclass BreakFactory:\n def __init__(self):\n \"Initialize with sub-factories for before, after, and inside breaks.\"\n super().__init__(\"Break utilities for controlling column and page breaks\")\n self.before = SimpleFactory(BREAK_BEFORE_VALUES, \"Break-before utilities for controlling breaks before an element\")\n self.after = SimpleFactory(BREAK_AFTER_VALUES, \"Break-after utilities for controlling breaks after an element\")\n self.inside = SimpleFactory(BREAK_INSIDE_VALUES, \"Break-inside utilities for controlling breaks within an element\")\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Factory for break utilities with before, after, and inside sub-factories.\"\n \n def __init__(self):\n \"Initialize with sub-factories for before, after, and inside breaks.\"\n super().__init__(\"Break utilities for controlling column and page breaks\")\n self.before = SimpleFactory(BREAK_BEFORE_VALUES, \"Break-before utilities for controlling breaks before an element\")\n self.after = SimpleFactory(BREAK_AFTER_VALUES, \"Break-after utilities for controlling breaks after an element\")\n self.inside = SimpleFactory(BREAK_INSIDE_VALUES, \"Break-inside utilities for controlling breaks within an element\")\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Initialize with sub-factories for before, after, and inside breaks.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the break factory.\"\n```\n\n``` python\nclass OverscrollFactory:\n def __init__(self):\n \"Initialize with overscroll values and directional sub-factories.\"\n super().__init__(\"Overscroll behavior utilities for controlling browser behavior at scroll boundaries\")\n # Create base overscroll utilities\n self._values = {value: f\"overscroll-{value}\" for value in OVERSCROLL_VALUES}\n \"Factory for overscroll behavior utilities with directional support.\"\n \n def __init__(self):\n \"Initialize with overscroll values and directional sub-factories.\"\n super().__init__(\"Overscroll behavior utilities for controlling browser behavior at scroll boundaries\")\n # Create base overscroll utilities\n self._values = {value: f\"overscroll-{value}\" for value in OVERSCROLL_VALUES}\n \"Initialize with overscroll values and directional sub-factories.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the overscroll factory.\"\n```\n\n#### Variables\n\n``` python\nDISPLAY_VALUES = {22 items} # Display utilities\ndisplay_tw # The display factory\nPOSITION_VALUES = {5 items} # Position utilities\nposition # The position factory\ninset # The inset factory for positioning\nOVERFLOW_VALUES = [5 items] # Overflow values\noverflow # The overflow factory\nZ_INDEX_CONFIG # Z-index configuration\nz # The z-index factory\nFLOAT_VALUES = {5 items}\nfloat_tw # Renamed to avoid conflict with Python's float\nCLEAR_VALUES = {6 items}\nclear # The clear factory\nOBJECT_FIT_VALUES = {5 items}\nobject_fit # The object fit factory\nOBJECT_POSITION_VALUES = {9 items}\nVISIBILITY_VALUES = {3 items}\nvisibility # The visibility factory\nBOX_SIZING_VALUES = {2 items}\nbox # The box sizing factory\nISOLATION_VALUES = {2 items}\nisolation # The isolation factory\nASPECT_RATIO_VALUES = {3 items}\naspect # The aspect ratio factory\nCOLUMNS_CONFIG # Columns configuration with container sizes\ncolumns # The columns factory\nBREAK_BEFORE_VALUES = {8 items}\nBREAK_AFTER_VALUES = {8 items}\nBREAK_INSIDE_VALUES = {4 items}\nbreak_util # The break factory\nBOX_DECORATION_VALUES = {2 items}\nOVERSCROLL_VALUES = [3 items]\noverscroll # The overscroll factory\n```\n\n### pattern_scanner (`pattern_scanner.ipynb`)\n\n> Scan Python code for replaceable CSS class patterns\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.cli.pattern_scanner import (\n ClsPattern,\n ClsPatternVisitor,\n scan_python_code,\n extract_css_classes_from_node,\n display_patterns,\n get_unique_css_classes,\n AssertionPattern,\n get_available_css_classes,\n extract_assertion_patterns,\n collect_all_assertion_patterns,\n MatchType,\n CSSClassMatch,\n tokenize_css_class,\n find_pattern_matches,\n match_css_class,\n match_css_classes,\n display_match_results,\n analyze_code_patterns,\n display_code_analysis,\n find_assertion_for_class,\n find_pattern_examples,\n get_migration_suggestions,\n display_migration_suggestions,\n analyze_and_suggest,\n scan_python_file,\n scan_jupyter_notebook,\n InputType,\n detect_input_type,\n scan_input,\n analyze_input,\n display_input_analysis,\n analyze_and_suggest_input\n)\n```\n\n#### Functions\n\n``` python\ndef scan_python_code(\n code: str # Python source code as a string\n) -> List[ClsPattern]: # List of ClsPattern objects found in the code\n \"Scan Python code for cls= patterns.\"\n```\n\n``` python\ndef extract_css_classes_from_node(\n node: ast.AST # TODO: Add description\n) -> List[str]: # TODO: Add return description\n \"\"\"\n Recursively extract CSS classes from an AST node.\n Handles various patterns including combine_classes calls.\n \"\"\"\n```\n\n``` python\ndef display_patterns(\n patterns: List[ClsPattern], # List of ClsPattern objects to display\n show_context: bool = True # Whether to show the code context\n) -> None: # TODO: Add return description\n \"Display found patterns in a formatted way.\"\n```\n\n``` python\ndef get_unique_css_classes(\n patterns: List[ClsPattern] # List of ClsPattern objects\n) -> Set[str]: # Set of unique CSS class strings\n \"Extract all unique CSS classes from a list of patterns.\"\n```\n\n``` python\ndef get_available_css_classes(\n assertion_patterns: List[AssertionPattern] # List of assertion patterns from test examples\n) -> Set[str]: # Set of unique CSS class strings available in the library\n \"Extract all unique CSS classes from assertion patterns. This handles multi-class assertion strings by splitting them.\"\n```\n\n``` python\ndef extract_assertion_patterns(\n source_code: str, # Source code of the test function\n module_name: str, # Name of the module containing the test\n example_name: str # Name of the test function\n) -> List[AssertionPattern]: # List of AssertionPattern objects\n \"Extract assertion patterns from test example source code.\"\n```\n\n``` python\ndef collect_all_assertion_patterns(\n) -> List[AssertionPattern]: # List of AssertionPattern objects from all modules\n \"Collect assertion patterns from all test examples in the library.\"\n```\n\n``` python\ndef tokenize_css_class(\n css_class: str # CSS class string (e.g., \"bg-blue-500\" or \"hover:text-white\")\n) -> List[str]: # List of tokens (e.g., [\"bg\", \"blue\", \"500\"] or [\"hover:text\", \"white\"])\n \"Tokenize a CSS class by splitting on hyphens. Handles modifiers (hover:, focus:, etc.) separately.\"\n```\n\n``` python\ndef find_pattern_matches(\n css_class: str, # CSS class to match (e.g., \"px-8\" or \"hover:text-white\")\n available_classes: Set[str] # Set of available CSS classes from the library\n) -> Tuple[Optional[str], List[str]]: # Tuple of (matched_pattern, similar_classes) - matched_pattern: Pattern prefix that matches (e.g., \"px\" for \"px-8\") - similar_classes: List of similar classes with the same pattern\n \"Find pattern matches for a CSS class by progressively reducing tokens.\"\n```\n\n``` python\ndef match_css_class(\n css_class: str, # CSS class to match\n available_classes: Set[str] # Set of available CSS classes from the library\n) -> CSSClassMatch: # CSSClassMatch object with match details\n \"Match a CSS class against available library classes.\"\n```\n\n``` python\ndef match_css_classes(\n css_classes: List[str], # List of CSS classes to match\n available_classes: Set[str] # Set of available CSS classes from the library\n) -> Dict[str, CSSClassMatch]: # Dictionary mapping CSS classes to their match results\n \"Match multiple CSS classes against available library classes.\"\n```\n\n``` python\ndef display_match_results(\n matches: Dict[str, CSSClassMatch] # Dictionary of CSS classes to their match results\n) -> None: # TODO: Add return description\n \"Display match results in a formatted way.\"\n```\n\n``` python\ndef analyze_code_patterns(\n code: str # Python source code to analyze\n) -> Dict[str, Any]: # Dictionary with analysis results including patterns found and suggestions\n \"Analyze Python code for replaceable CSS patterns.\"\n```\n\n``` python\ndef display_code_analysis(\n code: str # Python source code to analyze\n) -> None: # TODO: Add return description\n \"Analyze and display replaceable patterns in Python code.\"\n```\n\n``` python\ndef find_assertion_for_class(\n css_class: str, # The CSS class to find (e.g., \"px-6\")\n assertion_patterns: List[AssertionPattern] # List of all assertion patterns from tests\n) -> Optional[AssertionPattern]: # AssertionPattern if found, None otherwise\n \"Find the assertion pattern that demonstrates how to use a specific CSS class. Prioritizes exact single-class matches over multi-class assertions.\"\n```\n\n``` python\ndef find_pattern_examples(\n pattern_prefix: str, # Pattern prefix to match (e.g., \"px\" for px-* pattern)\n assertion_patterns: List[AssertionPattern] # List of all assertion patterns from tests\n) -> List[AssertionPattern]: # List of AssertionPattern objects that match the pattern\n \"Find assertion examples that match a pattern prefix.\"\n```\n\n``` python\ndef get_migration_suggestions(\n matches: Dict[str, CSSClassMatch], # Dictionary of CSS class matches\n assertion_patterns: List[AssertionPattern] # List of all assertion patterns from tests\n) -> Dict[str, List[str]]: # Dictionary mapping CSS classes to their migration suggestions\n \"Generate migration suggestions for matched CSS classes.\"\n```\n\n``` python\ndef display_migration_suggestions(\n code: str # Python source code to analyze\n) -> None: # TODO: Add return description\n \"Analyze code and display migration suggestions.\"\n```\n\n``` python\ndef analyze_and_suggest(\n code: str # Python source code to analyze\n) -> None: # TODO: Add return description\n \"Perform complete analysis of code with migration suggestions.\"\n```\n\n``` python\ndef scan_python_file(\n file_path: str # Path to the Python file\n) -> List[ClsPattern]: # List of ClsPattern objects found in the file\n \"Scan a Python file for cls= patterns.\"\n```\n\n``` python\ndef scan_jupyter_notebook(\n notebook_path: str # Path to the Jupyter notebook (.ipynb)\n) -> List[ClsPattern]: # List of ClsPattern objects found in the notebook\n \"Scan a Jupyter notebook for cls= patterns.\"\n```\n\n``` python\ndef detect_input_type(\n input_source: str # Code string or file path\n) -> InputType: # InputType enum value\n \"Detect the type of input based on the source string.\"\n```\n\n``` python\ndef scan_input(\n input_source: str, # Code string, Python file path, or notebook path\n input_type: Optional[InputType] = None # Optional explicit input type. If None, will auto-detect.\n) -> List[ClsPattern]: # List of ClsPattern objects found\n \"Scan various input types for cls= patterns.\"\n```\n\n``` python\ndef analyze_input(\n input_source: str, # Code string, Python file path, or notebook path\n input_type: Optional[InputType] = None # Optional explicit input type. If None, will auto-detect.\n) -> Dict[str, Any]: # Dictionary with analysis results\n \"Analyze any input type for replaceable CSS patterns.\"\n```\n\n``` python\ndef display_input_analysis(\n input_source: str, # Code string, Python file path, or notebook path\n input_type: Optional[InputType] = None # Optional explicit input type. If None, will auto-detect.\n) -> None: # TODO: Add return description\n \"Analyze and display replaceable patterns from any input type.\"\n```\n\n``` python\ndef analyze_and_suggest_input(\n input_source: str, # Code string, Python file path, or notebook path\n input_type: Optional[InputType] = None # Optional explicit input type. If None, will auto-detect.\n) -> None: # TODO: Add return description\n \"Perform complete analysis with migration suggestions for any input type.\"\n```\n\n#### Classes\n\n``` python\n@dataclass\nclass ClsPattern:\n \"Represents a cls= pattern found in code.\"\n \n line_number: int # Line number where pattern was found\n full_expression: str # The full cls=... expression\n css_classes: List[str] # Individual CSS classes extracted\n context: str # Code context around the pattern\n uses_combine_classes: bool # Whether combine_classes is used\n```\n\n``` python\nclass ClsPatternVisitor:\n def __init__(\n self,\n source_lines: List[str] # TODO: Add description\n )\n \"AST visitor to find cls= patterns in Python code.\"\n \n def __init__(\n self,\n source_lines: List[str] # TODO: Add description\n )\n \"Initialize with source code lines for context extraction.\"\n \n def visit_Call(\n self,\n node: ast.Call # TODO: Add description\n ) -> None: # TODO: Add return description\n \"Visit function calls to find cls= keyword arguments.\"\n```\n\n``` python\n@dataclass\nclass AssertionPattern:\n \"Represents a pattern extracted from a test assertion.\"\n \n css_class: str # The CSS class string (e.g., \"p-4\")\n factory_expression: str # The factory expression (e.g., \"p(4)\")\n module_name: str # Module where this was found\n example_name: str # Test function name\n```\n\n``` python\nclass MatchType(Enum):\n \"Type of match found for a CSS class.\"\n```\n\n``` python\n@dataclass\nclass CSSClassMatch:\n \"Represents a match result for a CSS class.\"\n \n css_class: str # The CSS class being matched\n match_type: MatchType # Type of match found\n matched_pattern: Optional[str] # The pattern it matches (for PATTERN type)\n similar_classes: List[str] # Similar classes found in library\n suggested_replacement: Optional[str] # Suggested replacement from library\n```\n\n``` python\nclass InputType(Enum):\n \"Type of input being scanned.\"\n```\n\n### resources (`resources.ipynb`)\n\n> CDN resources and headers for Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.core.resources import (\n TAILWIND_CDN,\n get_tailwind_headers\n)\n```\n\n#### Functions\n\n``` python\ndef get_tailwind_headers(\n) -> List[Union[Link, Script]]: # List of Link and Script elements for Tailwind CSS\n \"Get the standard Tailwind CSS CDN headers.\"\n```\n\n#### Variables\n\n``` python\nTAILWIND_CDN = 'https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4'\n```\n\n### scales (`scales.ipynb`)\n\n> Numeric and named scale builders for Tailwind CSS utilities\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.builders.scales import (\n NUMERIC_SCALE,\n DECIMAL_SCALE,\n SPACING_SCALE,\n FRACTION_DENOMINATORS,\n FRACTIONS,\n SPACING_CONFIG,\n SIZE_CONFIG,\n INSET_CONFIG,\n generate_fractions,\n ScaleConfig,\n ScaledUtility,\n ScaledFactory,\n NegativeFactory,\n DirectionalScaledUtility,\n DirectionalScaledFactory,\n list_scale_values,\n SimpleFactory\n)\n```\n\n#### Functions\n\n``` python\ndef generate_fractions(\n) -> List[str]: # List of all valid Tailwind fraction strings sorted by value\n \"Generate all valid Tailwind fractions.\"\n```\n\n``` python\ndef list_scale_values(\n config: ScaleConfig # The scale configuration to extract values from\n) -> Dict[str, List[Union[str, int, float]]]: # Dictionary mapping scale types to their values\n \"List all possible values for a scale configuration.\"\n```\n\n#### Classes\n\n``` python\n@dataclass\nclass ScaleConfig:\n \"Configuration for a scale builder.\"\n \n numeric: bool = True # Support numeric scales (0-96)\n decimals: bool = False # Support decimal scales (0.5, 1.5, etc.)\n fractions: bool = False # Support fractions (1/2, 1/3, etc.)\n named: Optional[List[NamedScale]] # Named scales (xs, sm, md, etc.)\n special: Optional[Dict[str, str]] # Special values (auto, full, screen, etc.)\n negative: bool = False # Support negative values\n```\n\n``` python\nclass ScaledUtility:\n def __init__(\n self, \n prefix: str, # The utility prefix (e.g., 'w', 'h', 'p')\n config: ScaleConfig, # Configuration defining valid scales and values\n negative: bool = False # Whether this is a negative variant\n )\n \"Utility class with scale support.\"\n \n def __init__(\n self, \n prefix: str, # The utility prefix (e.g., 'w', 'h', 'p')\n config: ScaleConfig, # Configuration defining valid scales and values\n negative: bool = False # Whether this is a negative variant\n )\n \"Initialize with prefix and scale configuration.\"\n \n def get_valid_values(\n self\n ) -> List[Union[str, int, float]]: # List of all valid values for this utility\n \"Get all valid values for this utility.\"\n```\n\n``` python\nclass ScaledFactory:\n def __init__(\n self, \n prefix: Optional[str] = None, # The utility prefix (e.g., 'w', 'h', 'p')\n config: Optional[ScaleConfig] = None, # Configuration defining valid scales and values\n doc: Optional[str] = None # Optional documentation string\n )\n \"Factory for creating scaled utilities with enhanced attribute access.\"\n \n def __init__(\n self, \n prefix: Optional[str] = None, # The utility prefix (e.g., 'w', 'h', 'p')\n config: Optional[ScaleConfig] = None, # Configuration defining valid scales and values\n doc: Optional[str] = None # Optional documentation string\n )\n \"Initialize with prefix and scale configuration.\"\n \n def negative(\n self\n ) -> 'NegativeFactory': # A factory for creating negative variants\n \"Return a negative variant factory.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get detailed information about this scaled factory.\"\n```\n\n``` python\nclass NegativeFactory:\n def __init__(\n self,\n prefix: str, # The utility prefix (e.g., 'm', 'inset')\n config: ScaleConfig # Configuration defining valid scales and values\n )\n \"Factory for creating negative variants.\"\n \n def __init__(\n self,\n prefix: str, # The utility prefix (e.g., 'm', 'inset')\n config: ScaleConfig # Configuration defining valid scales and values\n )\n \"Initialize with prefix and scale configuration.\"\n```\n\n``` python\nclass DirectionalScaledUtility:\n def __init__(\n self, \n prefix: str, # The base utility prefix (e.g., 'p' for padding)\n direction: Optional[str], # The direction suffix ('t', 'r', 'b', 'l', 'x', 'y')\n config: ScaleConfig, # Configuration defining valid scales and values\n negative: bool = False # Whether this is a negative variant\n )\n \"Directional utility with scale support.\"\n \n def __init__(\n self, \n prefix: str, # The base utility prefix (e.g., 'p' for padding)\n direction: Optional[str], # The direction suffix ('t', 'r', 'b', 'l', 'x', 'y')\n config: ScaleConfig, # Configuration defining valid scales and values\n negative: bool = False # Whether this is a negative variant\n )\n \"Initialize with prefix, direction, and scale configuration.\"\n```\n\n``` python\nclass DirectionalScaledFactory:\n def __init__(\n self, \n prefix: str, # The base utility prefix (e.g., 'p' for padding, 'm' for margin)\n config: ScaleConfig, # Configuration defining valid scales and values\n doc: Optional[str] = None # Optional documentation string\n )\n \"Factory for creating directional scaled utilities.\"\n \n def __init__(\n self, \n prefix: str, # The base utility prefix (e.g., 'p' for padding, 'm' for margin)\n config: ScaleConfig, # Configuration defining valid scales and values\n doc: Optional[str] = None # Optional documentation string\n )\n \"Initialize with prefix and scale configuration.\"\n \n def negative(\n self\n ) -> 'NegativeFactory': # A factory for creating negative variants\n \"Return a negative variant factory.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get detailed information about this directional factory.\"\n```\n\n``` python\nclass SimpleFactory:\n def __init__(\n self,\n values_dict: Optional[Dict[str, str]] = None, # Dictionary mapping attribute names to CSS values\n doc: Optional[str] = None # Optional documentation string\n )\n \"Factory for utilities that are simple string values with modifier support.\"\n \n def __init__(\n self,\n values_dict: Optional[Dict[str, str]] = None, # Dictionary mapping attribute names to CSS values\n doc: Optional[str] = None # Optional documentation string\n )\n \"Initialize with a dictionary of values.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about this simple factory.\"\n```\n\n#### Variables\n\n``` python\nNUMERIC_SCALE # Standard spacing scale (0-96)\nDECIMAL_SCALE = [4 items] # Common decimal scales\nSPACING_SCALE # Extended spacing scale with decimals\nFRACTION_DENOMINATORS = [6 items] # Fraction denominators supported by Tailwind\nFRACTIONS # Pre-generate fractions\nSPACING_CONFIG # Spacing configuration (padding, margin, gap)\nSIZE_CONFIG # Size configuration (width, height)\nINSET_CONFIG # Inset configuration (top, right, bottom, left)\n```\n\n### Search Functions (`search.ipynb`)\n\n> Functions to search across all library components:\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.cli.search import (\n search_factories,\n search_examples,\n search_helpers,\n search_modules,\n search_all\n)\n```\n\n#### Functions\n\n``` python\ndef search_factories(\n query: str, # Search query\n include_source: bool = False, # Whether to search in source code\n case_sensitive: bool = False # Whether to perform case-sensitive search\n) -> List[SearchResult]: # List of search results\n \"Search in all factories.\"\n```\n\n``` python\ndef search_examples(\n query: str, # Search query\n include_source: bool = False, # Whether to search in source code\n case_sensitive: bool = False # Whether to perform case-sensitive search\n) -> List[SearchResult]: # List of search results\n \"Search in all test examples.\"\n```\n\n``` python\ndef search_helpers(\n query: str, # Search query\n include_source: bool = False, # Whether to search in source code\n case_sensitive: bool = False # Whether to perform case-sensitive search\n) -> List[SearchResult]: # List of search results\n \"Search in all helper functions.\"\n```\n\n``` python\ndef search_modules(\n query: str, # Search query\n case_sensitive: bool = False # Whether to perform case-sensitive search\n) -> List[SearchResult]: # List of search results\n \"Search in module names and documentation.\"\n```\n\n``` python\ndef search_all(\n query: str, # Search query\n content_types: Optional[List[str]] = None, # Types to search in ('factories', 'examples', 'helpers', 'modules')\n include_source: bool = False, # Whether to search in source code\n case_sensitive: bool = False # Whether to perform case-sensitive search\n) -> List[SearchResult]: # List of all search results\n \"Search across all content types.\"\n```\n\n### sizing (`sizing.ipynb`)\n\n> Width, height, and min/max sizing utilities for Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.utilities.sizing import (\n w,\n h,\n min_w,\n max_w,\n container,\n min_h,\n max_h,\n size_util,\n test_sizing_width_examples,\n test_sizing_width_named_examples,\n test_sizing_width_viewport_examples,\n test_sizing_arbitrary_examples,\n test_sizing_height_examples,\n test_sizing_height_viewport_examples,\n test_sizing_min_width_examples,\n test_sizing_max_width_examples,\n test_sizing_container_examples,\n test_sizing_min_height_examples,\n test_sizing_size_util_examples,\n test_sizing_max_height_examples,\n test_sizing_practical_examples,\n test_sizing_factory_documentation,\n size,\n square,\n full_size,\n full_screen,\n test_sizing_helper_examples\n)\n```\n\n#### Functions\n\n``` python\ndef test_sizing_width_examples(\n)\n \"Test width utilities with various scales and values.\"\n```\n\n``` python\ndef test_sizing_width_named_examples(\n)\n \"Test width utilities with named container sizes.\"\n```\n\n``` python\ndef test_sizing_width_viewport_examples(\n)\n \"Test width utilities with viewport units.\"\n```\n\n``` python\ndef test_sizing_arbitrary_examples(\n)\n \"Test sizing utilities with arbitrary and custom values.\"\n```\n\n``` python\ndef test_sizing_height_examples(\n)\n \"Test height utilities with various scales and values.\"\n```\n\n``` python\ndef test_sizing_height_viewport_examples(\n)\n \"Test height utilities with viewport units.\"\n```\n\n``` python\ndef test_sizing_min_width_examples(\n)\n \"Test min-width utilities.\"\n```\n\n``` python\ndef test_sizing_max_width_examples(\n)\n \"Test max-width utilities.\"\n```\n\n``` python\ndef test_sizing_container_examples(\n)\n \"Test continer utility.\"\n```\n\n``` python\ndef test_sizing_min_height_examples(\n)\n \"Test min-height utilities.\"\n```\n\n``` python\ndef test_sizing_size_util_examples(\n)\n \"Test size utilities that set both width and height.\"\n```\n\n``` python\ndef test_sizing_max_height_examples(\n)\n \"Test max-height utilities.\"\n```\n\n``` python\ndef test_sizing_practical_examples(\n)\n \"Test sizing utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef test_sizing_factory_documentation(\n)\n \"Test that factories have accessible documentation.\"\n```\n\n``` python\ndef size(\n w: Optional[TailwindScale] = None, # Width value\n h: Optional[TailwindScale] = None, # Height value\n min_w: Optional[TailwindScale] = None, # Minimum width\n max_w: Optional[TailwindScale] = None, # Maximum width\n min_h: Optional[TailwindScale] = None, # Minimum height\n max_h: Optional[TailwindScale] = None # Maximum height\n) -> str: # Space-separated size classes\n \"Generate size classes with a convenient API.\"\n```\n\n``` python\ndef square(\n size: TailwindScale # Size value for both width and height\n) -> str: # Space-separated width and height classes\n \"Create a square element with equal width and height.\"\n```\n\n``` python\ndef full_size(\n) -> str: # \"w-full h-full\"\n \"Make element take full width and height of parent.\"\n```\n\n``` python\ndef full_screen(\n) -> str: # \"w-screen h-screen\"\n \"Make element take full viewport width and height.\"\n```\n\n``` python\ndef test_sizing_helper_examples(\n)\n \"Test helper functions for common sizing patterns.\"\n```\n\n#### Variables\n\n``` python\nw # The width factory\nh # The height factory\nmin_w # The min-width factory\nmax_w # The max-width factory\nmin_h # The min-height factory\nmax_h # The max-height factory\nsize_util # The size factory (sets both width and height)\n```\n\n### spacing (`spacing.ipynb`)\n\n> Padding and margin utilities for Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.utilities.spacing import (\n p,\n ps,\n pe,\n m,\n ms,\n me,\n space,\n test_spacing_basic_examples,\n test_spacing_directional_examples,\n test_spacing_arbitrary_examples,\n test_spacing_margin_examples,\n test_spacing_margin_directional_examples,\n test_spacing_negative_examples,\n test_spacing_logical_examples,\n SpaceFactory,\n test_spacing_space_between_examples,\n test_spacing_practical_examples,\n pad,\n margin,\n test_spacing_helper_examples,\n test_spacing_modifier_examples,\n test_spacing_enhanced_factory_examples,\n test_spacing_factory_documentation\n)\n```\n\n#### Functions\n\n``` python\ndef test_spacing_basic_examples(\n)\n \"Test basic padding utilities with various scale values.\"\n```\n\n``` python\ndef test_spacing_directional_examples(\n)\n \"Test directional padding utilities.\"\n```\n\n``` python\ndef test_spacing_arbitrary_examples(\n)\n \"Test padding utilities with arbitrary and custom values.\"\n```\n\n``` python\ndef test_spacing_margin_examples(\n)\n \"Test basic margin utilities with various scale values.\"\n```\n\n``` python\ndef test_spacing_margin_directional_examples(\n)\n \"Test directional margin utilities.\"\n```\n\n``` python\ndef test_spacing_negative_examples(\n)\n \"Test negative margin utilities.\"\n```\n\n``` python\ndef test_spacing_logical_examples(\n)\n \"Test logical properties for padding and margin utilities.\"\n```\n\n``` python\ndef test_spacing_space_between_examples(\n)\n \"Test space between child elements utilities.\"\n```\n\n``` python\ndef test_spacing_practical_examples(\n)\n \"Test spacing utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef pad(\n all: Optional[TailwindScale] = None, # Padding for all sides\n x: Optional[TailwindScale] = None, # Horizontal padding\n y: Optional[TailwindScale] = None, # Vertical padding\n t: Optional[TailwindScale] = None, # Top padding\n r: Optional[TailwindScale] = None, # Right padding\n b: Optional[TailwindScale] = None, # Bottom padding\n l: Optional[TailwindScale] = None # Left padding\n) -> str: # Space-separated padding classes\n \"Generate padding classes with a convenient API.\"\n```\n\n``` python\ndef margin(\n all: Optional[TailwindScale] = None, # Margin for all sides\n x: Optional[TailwindScale] = None, # Horizontal margin\n y: Optional[TailwindScale] = None, # Vertical margin\n t: Optional[TailwindScale] = None, # Top margin\n r: Optional[TailwindScale] = None, # Right margin\n b: Optional[TailwindScale] = None, # Bottom margin\n l: Optional[TailwindScale] = None, # Left margin\n negative: bool = False # Apply negative margins\n) -> str: # Space-separated margin classes\n \"Generate margin classes with a convenient API.\"\n```\n\n``` python\ndef test_spacing_helper_examples(\n)\n \"Test helper functions for common spacing patterns.\"\n```\n\n``` python\ndef test_spacing_modifier_examples(\n)\n \"Test spacing utilities with modifiers for conditional styling.\"\n```\n\n``` python\ndef test_spacing_enhanced_factory_examples(\n)\n \"Test enhanced SingleValueFactory support in spacing utilities.\"\n```\n\n``` python\ndef test_spacing_factory_documentation(\n)\n \"Test that factories have accessible documentation.\"\n```\n\n#### Classes\n\n``` python\nclass SpaceFactory:\n def __init__(self):\n \"\"\"Initialize with scaled factories and reverse utilities.\"\"\"\n super().__init__(\"Space utilities for adding consistent spacing between child elements\")\n self.x = ScaledFactory(\"space-x\", SPACING_CONFIG, \"Horizontal spacing between child elements\")\n self.y = ScaledFactory(\"space-y\", SPACING_CONFIG, \"Vertical spacing between child elements\")\n self.x_reverse = SingleValueFactory(\"space-x-reverse\", \"Reverse the order of horizontal spacing\")\n self.y_reverse = SingleValueFactory(\"space-y-reverse\", \"Reverse the order of vertical spacing\")\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Special factory for space utilities that control spacing between child elements.\"\n \n def __init__(self):\n \"\"\"Initialize with scaled factories and reverse utilities.\"\"\"\n super().__init__(\"Space utilities for adding consistent spacing between child elements\")\n self.x = ScaledFactory(\"space-x\", SPACING_CONFIG, \"Horizontal spacing between child elements\")\n self.y = ScaledFactory(\"space-y\", SPACING_CONFIG, \"Vertical spacing between child elements\")\n self.x_reverse = SingleValueFactory(\"space-x-reverse\", \"Reverse the order of horizontal spacing\")\n self.y_reverse = SingleValueFactory(\"space-y-reverse\", \"Reverse the order of vertical spacing\")\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Initialize with scaled factories and reverse utilities.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the space factory.\"\n```\n\n#### Variables\n\n``` python\np # The padding factory\nps # padding-inline-start\npe # padding-inline-end\nm # The margin factory\nms # margin-inline-start\nme # margin-inline-end\nspace # The space factory\n```\n\n### svg (`svg.ipynb`)\n\n> SVG utilities for Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.utilities.svg import (\n fill_none,\n fill,\n stroke_none,\n stroke,\n STROKE_WIDTH_CONFIG,\n stroke_width,\n test_svg_fill_examples,\n test_svg_fill_opacity_examples,\n test_svg_fill_arbitrary_examples,\n test_svg_stroke_examples,\n test_svg_stroke_opacity_examples,\n StrokeWidthFactory,\n test_svg_stroke_width_examples,\n test_svg_stroke_width_arbitrary_examples,\n test_svg_practical_examples,\n test_svg_icon_examples,\n test_svg_progress_ring_examples,\n test_svg_factory_documentation,\n test_svg_edge_cases,\n svg_icon_classes,\n test_svg_helper_functions\n)\n```\n\n#### Functions\n\n``` python\ndef test_svg_fill_examples()\n \"Test fill color utilities with various color values.\"\n```\n\n``` python\ndef test_svg_fill_opacity_examples()\n \"Test fill colors with opacity modifiers.\"\n```\n\n``` python\ndef test_svg_fill_arbitrary_examples()\n \"Test fill utilities with arbitrary and custom values.\"\n```\n\n``` python\ndef test_svg_stroke_examples()\n \"Test stroke color utilities with various color values.\"\n```\n\n``` python\ndef test_svg_stroke_opacity_examples()\n \"Test stroke colors with opacity modifiers.\"\n```\n\n``` python\ndef test_svg_stroke_width_examples()\n \"Test stroke width utilities with various values.\"\n```\n\n``` python\ndef test_svg_stroke_width_arbitrary_examples()\n \"Test stroke width utilities with arbitrary and custom values.\"\n```\n\n``` python\ndef test_svg_practical_examples()\n \"Test SVG utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef test_svg_icon_examples():\n \"\"\"Test creating reusable SVG icon components.\"\"\"\n from fasthtml.common import Div\n from fasthtml.svg import Svg, Path\n from cjm_fasthtml_tailwind.utilities.sizing import w, h\n from cjm_fasthtml_tailwind.utilities.flexbox_and_grid import items, justify\n from cjm_fasthtml_tailwind.utilities.layout import display_tw\n \n # Helper function to create an icon\n def Icon(path_d: str, size: int = 6, color_cls: str = \"\")\n \"Test creating reusable SVG icon components.\"\n```\n\n``` python\ndef test_svg_progress_ring_examples():\n \"\"\"Test creating a progress ring component.\"\"\"\n from fasthtml.common import Div\n from fasthtml.svg import Svg, Circle\n from cjm_fasthtml_tailwind.utilities.sizing import w, h\n from cjm_fasthtml_tailwind.utilities.layout import display_tw, position\n \n # Progress ring component\n def ProgressRing(percentage: int, size: int = 120)\n \"Test creating a progress ring component.\"\n```\n\n``` python\ndef test_svg_factory_documentation()\n \"Test that SVG factories have accessible documentation.\"\n```\n\n``` python\ndef test_svg_edge_cases()\n \"Test edge cases and special values for SVG utilities.\"\n```\n\n``` python\ndef svg_icon_classes(\n fill_color: Optional[Union[str, ColoredUtility]] = None, # Fill color class or utility\n stroke_color: Optional[Union[str, ColoredUtility]] = None, # Stroke color class or utility\n width: Union[int, str] = 2, # Stroke width value\n size: int = 6, # Icon size (numeric value for w and h)\n extra_classes: str = \"\" # Additional classes to include\n) -> str: # Combined class string for SVG icon\n \"Generate common SVG icon classes.\"\n```\n\n``` python\ndef test_svg_helper_functions()\n \"Test SVG helper functions.\"\n```\n\n#### Classes\n\n``` python\nclass StrokeWidthFactory:\n def __init__(self):\n \"\"\"Initialize with stroke width configuration.\"\"\"\n super().__init__(\"stroke\", STROKE_WIDTH_CONFIG, \"Stroke width utilities for styling the stroke width of SVG elements\")\n # Override the numeric scale to only include 0, 1, 2\n self._valid_values = [0, 1, 2]\n \n def __call__(\n self,\n value: Optional[TailwindValue] = None, # The stroke width value\n negative: bool = False # Not applicable for stroke width\n ) -> StandardUtility: # A stroke width utility instance\n \"Factory for stroke-width utilities with restricted numeric scale (0-2).\"\n \n def __init__(self):\n \"\"\"Initialize with stroke width configuration.\"\"\"\n super().__init__(\"stroke\", STROKE_WIDTH_CONFIG, \"Stroke width utilities for styling the stroke width of SVG elements\")\n # Override the numeric scale to only include 0, 1, 2\n self._valid_values = [0, 1, 2]\n \n def __call__(\n self,\n value: Optional[TailwindValue] = None, # The stroke width value\n negative: bool = False # Not applicable for stroke width\n ) -> StandardUtility: # A stroke width utility instance\n \"Initialize with stroke width configuration.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get detailed information about the stroke width factory.\"\n```\n\n#### Variables\n\n``` python\nfill_none # Remove fill\nfill # The fill color factory\nstroke_none # Remove stroke\nstroke # The stroke color factory\nSTROKE_WIDTH_CONFIG\nstroke_width # The stroke width factory\n```\n\n### tables (`tables.ipynb`)\n\n> Table utilities for Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.utilities.tables import (\n border_collapse,\n border_spacing,\n table_layout,\n caption_side,\n test_tables_border_collapse_examples,\n BorderSpacingFactory,\n test_tables_border_spacing_basic_examples,\n test_tables_border_spacing_directional_examples,\n test_tables_border_spacing_arbitrary_examples,\n test_tables_layout_examples,\n test_tables_caption_side_examples,\n test_tables_all_utilities,\n test_tables_practical_examples,\n test_tables_complex_example,\n test_tables_factory_documentation\n)\n```\n\n#### Functions\n\n``` python\ndef test_tables_border_collapse_examples()\n \"Test border collapse utilities.\"\n```\n\n``` python\ndef test_tables_border_spacing_basic_examples()\n \"Test basic border spacing utilities.\"\n```\n\n``` python\ndef test_tables_border_spacing_directional_examples()\n \"Test directional border spacing utilities.\"\n```\n\n``` python\ndef test_tables_border_spacing_arbitrary_examples()\n \"Test border spacing utilities with arbitrary values.\"\n```\n\n``` python\ndef test_tables_layout_examples()\n \"Test table layout utilities.\"\n```\n\n``` python\ndef test_tables_caption_side_examples()\n \"Test caption side utilities.\"\n```\n\n``` python\ndef test_tables_all_utilities()\n \"Comprehensive test of all table utilities.\"\n```\n\n``` python\ndef test_tables_practical_examples()\n \"Test table utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef test_tables_complex_example()\n \"Test a complex table example with various styling.\"\n```\n\n``` python\ndef test_tables_factory_documentation()\n \"Test that table factories have accessible documentation.\"\n```\n\n#### Classes\n\n``` python\nclass BorderSpacingFactory:\n def __init__(self):\n \"\"\"Initialize with scaled factories for directional variants.\"\"\"\n super().__init__(\"Border spacing utilities for controlling the spacing between table borders\")\n # Create scaled factories with properly hyphenated prefixes\n self._base = ScaledFactory(\"border-spacing\", SPACING_CONFIG, \"All sides border spacing\")\n self.x = ScaledFactory(\"border-spacing-x\", SPACING_CONFIG, \"Horizontal border spacing\")\n self.y = ScaledFactory(\"border-spacing-y\", SPACING_CONFIG, \"Vertical border spacing\")\n \n def __call__(\n self,\n value: Optional[TailwindScale] = None # The spacing value\n ) -> StandardUtility: # A border spacing utility for all sides\n \"Factory for border-spacing utilities with directional support.\"\n \n def __init__(self):\n \"\"\"Initialize with scaled factories for directional variants.\"\"\"\n super().__init__(\"Border spacing utilities for controlling the spacing between table borders\")\n # Create scaled factories with properly hyphenated prefixes\n self._base = ScaledFactory(\"border-spacing\", SPACING_CONFIG, \"All sides border spacing\")\n self.x = ScaledFactory(\"border-spacing-x\", SPACING_CONFIG, \"Horizontal border spacing\")\n self.y = ScaledFactory(\"border-spacing-y\", SPACING_CONFIG, \"Vertical border spacing\")\n \n def __call__(\n self,\n value: Optional[TailwindScale] = None # The spacing value\n ) -> StandardUtility: # A border spacing utility for all sides\n \"Initialize with scaled factories for directional variants.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the border spacing factory.\"\n```\n\n#### Variables\n\n``` python\nborder_spacing # The border spacing factory\n```\n\n### Test Code Functionality (`test_code.ipynb`)\n\n> Functions to test code snippets using the library:\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.cli.test_code import (\n create_test_script,\n execute_test_code\n)\n```\n\n#### Functions\n\n``` python\ndef create_test_script(\n code: str # TODO: Add description\n) -> str: # TODO: Add return description\n \"Create a test script with necessary imports and the provided code.\"\n```\n\n``` python\ndef execute_test_code(\n code: str, # The code to test\n show_imports: bool = False, # Whether to show the generated imports\n timeout: int = 10 # Timeout in seconds\n) -> Tuple[bool, str, str]: # (success, stdout, stderr)\n \"Execute test code in a safe environment.\"\n```\n\n### testing (`testing.ipynb`)\n\n> Standardized test page creation for Jupyter notebooks with FastHTML\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.core.testing import (\n create_test_app,\n create_test_page,\n start_test_server\n)\n```\n\n#### Functions\n\n``` python\ndef create_test_app(\n debug: bool = True # Enable debug mode\n) -> tuple: # Tuple containing (app, rt) - FastHTML app instance and route decorator\n \"Create a standardized test app for Jupyter notebooks with Tailwind.\"\n```\n\n``` python\ndef create_test_page(\n title: str, # Page title\n *content, # Page content elements\n container: bool = True, # Wrap in container\n custom_theme_names: Optional[List[str]] = None # Custom themes for selector\n) -> Div: # Div containing complete page layout with navbar and content\n \"Create a standardized test page layout with optional theme selector.\"\n```\n\n``` python\ndef start_test_server(\n app: FastHTML, # FastHTML app instance created by create_test_app or fast_app\n port: int = 8000, # Port\n) -> JupyUvi: # JupyUvi server instance for Jupyter notebook testing\n \"\"\"\n Start a test server and return the JupyUvi instance.\n \n Usage:\n server = start_test_server(app)\n HTMX() # Display the app\n \n # Later, in another cell:\n server.stop()\n \"\"\"\n```\n\n### transforms (`transforms.ipynb`)\n\n> Transform, rotate, scale, skew, translate and other transformation\n> utilities for Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.utilities.transforms import (\n BACKFACE_VALUES,\n backface,\n PERSPECTIVE_VALUES,\n perspective,\n PERSPECTIVE_ORIGIN_VALUES,\n perspective_origin,\n ROTATE_ANGLES,\n ROTATE_CONFIG,\n rotate,\n SCALE_VALUES,\n SCALE_CONFIG,\n scale_tw,\n SKEW_ANGLES,\n skew,\n TRANSFORM_VALUES,\n transform,\n TRANSFORM_ORIGIN_VALUES,\n origin,\n TRANSFORM_STYLE_VALUES,\n transform_style,\n TRANSLATE_CONFIG,\n translate,\n test_transforms_backface_examples,\n PerspectiveFactory,\n test_transforms_perspective_examples,\n PerspectiveOriginFactory,\n test_transforms_perspective_origin_examples,\n RotateUtility,\n RotateFactory,\n NegativeRotateFactory,\n test_transforms_rotate_examples,\n ScaleUtility,\n ScaleFactory,\n NegativeScaleFactory,\n test_transforms_scale_examples,\n SkewUtility,\n SkewFactory,\n NegativeSkewFactory,\n test_transforms_skew_examples,\n TransformFactory,\n test_transforms_transform_examples,\n TransformOriginFactory,\n test_transforms_origin_examples,\n test_transforms_style_examples,\n TranslateFactory,\n test_transforms_translate_examples,\n test_transforms_practical_examples,\n center_transform,\n hover_scale,\n flip_card_3d,\n parallax_transform,\n test_transforms_helper_examples,\n test_transforms_factory_documentation\n)\n```\n\n#### Functions\n\n``` python\ndef test_transforms_backface_examples()\n \"Test backface visibility utilities.\"\n```\n\n``` python\ndef test_transforms_perspective_examples()\n \"Test perspective utilities.\"\n```\n\n``` python\ndef test_transforms_perspective_origin_examples()\n \"Test perspective origin utilities.\"\n```\n\n``` python\ndef test_transforms_rotate_examples()\n \"Test rotate utilities.\"\n```\n\n``` python\ndef test_transforms_scale_examples()\n \"Test scale utilities.\"\n```\n\n``` python\ndef test_transforms_skew_examples()\n \"Test skew utilities.\"\n```\n\n``` python\ndef test_transforms_transform_examples()\n \"Test transform utilities.\"\n```\n\n``` python\ndef test_transforms_origin_examples()\n \"Test transform origin utilities.\"\n```\n\n``` python\ndef test_transforms_style_examples()\n \"Test transform style utilities.\"\n```\n\n``` python\ndef test_transforms_translate_examples()\n \"Test translate utilities.\"\n```\n\n``` python\ndef test_transforms_practical_examples()\n \"Test transform utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef center_transform() -> str\n \"Center an element using transform translate.\"\n```\n\n``` python\ndef hover_scale(scale: int = 110) -> str\n \"Create a hover scale effect.\"\n```\n\n``` python\ndef flip_card_3d(perspective_value: str = \"normal\") -> Dict[str, str]:\n \"\"\"Get classes for a 3D flip card effect.\"\"\"\n return {\n \"container\": str(getattr(perspective, perspective_value)),\n \"Get classes for a 3D flip card effect.\"\n```\n\n``` python\ndef parallax_transform(speed: float = 0.5) -> str\n \"Create a parallax transform effect.\"\n```\n\n``` python\ndef test_transforms_helper_examples()\n \"Test helper functions for common transform patterns.\"\n```\n\n``` python\ndef test_transforms_factory_documentation()\n \"Test that transform factories have accessible documentation.\"\n```\n\n#### Classes\n\n``` python\nclass PerspectiveFactory(SimpleFactory):\n \"Factory for perspective with both named and custom values.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the perspective factory.\"\n```\n\n``` python\nclass PerspectiveOriginFactory(SimpleFactory):\n \"Factory for perspective origin with both fixed and custom values.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the perspective origin factory.\"\n```\n\n``` python\nclass RotateUtility(StandardUtility):\n \"Utility class for rotation with angle support.\"\n \n```\n\n``` python\nclass RotateFactory:\n def __init__(self):\n \"\"\"Initialize with directional sub-factories.\"\"\"\n super().__init__(\"Rotate utilities for rotating elements\")\n self.x = ScaledFactory(\"rotate-x\", ROTATE_CONFIG, \"Rotate around X axis\")\n self.y = ScaledFactory(\"rotate-y\", ROTATE_CONFIG, \"Rotate around Y axis\")\n self.z = ScaledFactory(\"rotate-z\", ROTATE_CONFIG, \"Rotate around Z axis\")\n \n def __call__(self, value: TailwindValue, negative: bool = False) -> RotateUtility\n \"Factory for rotation utilities with directional support.\"\n \n def __init__(self):\n \"\"\"Initialize with directional sub-factories.\"\"\"\n super().__init__(\"Rotate utilities for rotating elements\")\n self.x = ScaledFactory(\"rotate-x\", ROTATE_CONFIG, \"Rotate around X axis\")\n self.y = ScaledFactory(\"rotate-y\", ROTATE_CONFIG, \"Rotate around Y axis\")\n self.z = ScaledFactory(\"rotate-z\", ROTATE_CONFIG, \"Rotate around Z axis\")\n \n def __call__(self, value: TailwindValue, negative: bool = False) -> RotateUtility\n \"Initialize with directional sub-factories.\"\n \n def negative(self) -> 'NegativeRotateFactory':\n \"\"\"Return a negative variant factory.\"\"\"\n return NegativeRotateFactory()\n \n def get_info(self) -> Dict[str, Any]\n \"Return a negative variant factory.\"\n \n def get_info(self) -> Dict[str, Any]:\n \"\"\"Get information about the rotate factory.\"\"\"\n return {\n 'description': self._doc,\n \"Get information about the rotate factory.\"\n```\n\n``` python\nclass NegativeRotateFactory:\n \"Factory for negative rotation utilities.\"\n \n```\n\n``` python\nclass ScaleUtility(StandardUtility):\n \"Utility class for scaling with percentage support.\"\n \n```\n\n``` python\nclass ScaleFactory:\n def __init__(self)\n \"Factory for scale utilities with directional and 3D support.\"\n \n def __init__(self)\n \"Initialize with directional sub-factories.\"\n \n def negative(self) -> 'NegativeScaleFactory':\n \"\"\"Return a negative variant factory.\"\"\"\n return NegativeScaleFactory()\n \n def get_info(self) -> Dict[str, Any]\n \"Return a negative variant factory.\"\n \n def get_info(self) -> Dict[str, Any]:\n \"\"\"Get information about the scale factory.\"\"\"\n return {\n 'description': self._doc,\n \"Get information about the scale factory.\"\n```\n\n``` python\nclass NegativeScaleFactory:\n \"Factory for negative scale utilities.\"\n \n```\n\n``` python\nclass SkewUtility(StandardUtility):\n \"Utility class for skewing with angle support.\"\n \n```\n\n``` python\nclass SkewFactory:\n def __init__(self)\n \"Factory for skew utilities with directional support.\"\n \n def __init__(self)\n \"Initialize with directional sub-factories.\"\n \n def negative(self) -> 'NegativeSkewFactory':\n \"\"\"Return a negative variant factory.\"\"\"\n return NegativeSkewFactory()\n \n def get_info(self) -> Dict[str, Any]\n \"Return a negative variant factory.\"\n \n def get_info(self) -> Dict[str, Any]:\n \"\"\"Get information about the skew factory.\"\"\"\n return {\n 'description': self._doc,\n \"Get information about the skew factory.\"\n```\n\n``` python\nclass NegativeSkewFactory:\n \"Factory for negative skew utilities.\"\n \n```\n\n``` python\nclass TransformFactory(SimpleFactory):\n \"Factory for transform utilities with special and custom values.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the transform factory.\"\n```\n\n``` python\nclass TransformOriginFactory(SimpleFactory):\n \"Factory for transform origin with both fixed and custom values.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the transform origin factory.\"\n```\n\n``` python\nclass TranslateFactory:\n def __init__(self):\n \"\"\"Initialize with directional sub-factories.\"\"\"\n super().__init__(\"Translate utilities for translating elements\")\n # Create directional translate factories\n self.x = ScaledFactory(\"translate-x\", TRANSLATE_CONFIG, \"Translate along X axis\")\n self.y = ScaledFactory(\"translate-y\", TRANSLATE_CONFIG, \"Translate along Y axis\")\n self.z = ScaledFactory(\"translate-z\", TRANSLATE_CONFIG, \"Translate along Z axis\")\n \n def __call__(self, value: TailwindScale, negative: bool = False) -> ScaledUtility\n \"Factory for translate utilities with directional and 3D support.\"\n \n def __init__(self):\n \"\"\"Initialize with directional sub-factories.\"\"\"\n super().__init__(\"Translate utilities for translating elements\")\n # Create directional translate factories\n self.x = ScaledFactory(\"translate-x\", TRANSLATE_CONFIG, \"Translate along X axis\")\n self.y = ScaledFactory(\"translate-y\", TRANSLATE_CONFIG, \"Translate along Y axis\")\n self.z = ScaledFactory(\"translate-z\", TRANSLATE_CONFIG, \"Translate along Z axis\")\n \n def __call__(self, value: TailwindScale, negative: bool = False) -> ScaledUtility\n \"Initialize with directional sub-factories.\"\n \n def negative(self) -> 'NegativeFactory':\n \"\"\"Return a negative variant factory.\"\"\"\n return NegativeFactory(\"translate\", TRANSLATE_CONFIG)\n \n def get_info(self) -> Dict[str, Any]\n \"Return a negative variant factory.\"\n \n def get_info(self) -> Dict[str, Any]:\n \"\"\"Get information about the translate factory.\"\"\"\n from cjm_fasthtml_tailwind.builders.scales import NUMERIC_SCALE, DECIMAL_SCALE\n return {\n 'description': self._doc,\n \"Get information about the translate factory.\"\n```\n\n#### Variables\n\n``` python\nBACKFACE_VALUES = {2 items}\nbackface # The backface visibility factory\nPERSPECTIVE_VALUES = {6 items}\nperspective # The perspective factory\nPERSPECTIVE_ORIGIN_VALUES = {9 items}\nROTATE_ANGLES = [9 items] # Common rotation angles in degrees\nROTATE_CONFIG\nrotate # The rotate factory\nSCALE_VALUES = [10 items] # Common scale percentages\nSCALE_CONFIG\nscale_tw # The scale factory (renamed to avoid conflict with built-in scale)\nSKEW_ANGLES = [6 items] # Common skew angles in degrees\nskew # The skew factory\nTRANSFORM_VALUES = {3 items}\ntransform # The transform factory\nTRANSFORM_ORIGIN_VALUES = {9 items}\nTRANSFORM_STYLE_VALUES = {2 items}\ntransform_style # The transform style factory\nTRANSLATE_CONFIG\ntranslate # The translate factory\n```\n\n### transitions_and_animation (`transitions_and_animation.ipynb`)\n\n> Transition and animation utilities for Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.utilities.transitions_and_animation import (\n transition,\n transition_behavior,\n DURATION_SCALE,\n DURATION_CONFIG,\n duration,\n ease,\n DELAY_SCALE,\n DELAY_CONFIG,\n delay,\n animate,\n TransitionPropertyFactory,\n test_transitions_and_animation_property_examples,\n test_transitions_and_animation_behavior_examples,\n DurationFactory,\n test_transitions_and_animation_duration_examples,\n EaseFactory,\n test_transitions_and_animation_timing_examples,\n DelayFactory,\n test_transitions_and_animation_delay_examples,\n AnimationFactory,\n test_transitions_and_animation_examples,\n test_transitions_and_animation_practical_examples,\n test_transitions_and_animation_animation_examples,\n test_transitions_and_animation_composition_examples,\n test_transitions_and_animation_factory_documentation,\n smooth_transition,\n hover_effect,\n fade_in,\n loading_spinner,\n skeleton_loader,\n test_transitions_and_animation_helper_examples\n)\n```\n\n#### Functions\n\n``` python\ndef test_transitions_and_animation_property_examples()\n \"Test transition property utilities.\"\n```\n\n``` python\ndef test_transitions_and_animation_behavior_examples()\n \"Test transition behavior utilities.\"\n```\n\n``` python\ndef test_transitions_and_animation_duration_examples()\n \"Test transition duration utilities.\"\n```\n\n``` python\ndef test_transitions_and_animation_timing_examples():\n \"\"\"Test transition timing function utilities.\"\"\"\n # Test predefined easing functions\n assert str(ease.linear) == \"ease-linear\"\n assert str(ease._in) == \"ease-in\" # Note: 'in' is a Python keyword, so we use 'in_'\n \"Test transition timing function utilities.\"\n```\n\n``` python\ndef test_transitions_and_animation_delay_examples()\n \"Test transition delay utilities.\"\n```\n\n``` python\ndef test_transitions_and_animation_examples()\n \"Test animation utilities.\"\n```\n\n``` python\ndef test_transitions_and_animation_practical_examples()\n \"Test transition and animation utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef test_transitions_and_animation_animation_examples()\n \"Test animation utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef test_transitions_and_animation_composition_examples()\n \"Test composing multiple transition utilities together.\"\n```\n\n``` python\ndef test_transitions_and_animation_factory_documentation()\n \"Test that transition and animation factories have accessible documentation.\"\n```\n\n``` python\ndef smooth_transition(\n properties: str = \"all\", # Which properties to transition (default: all)\n duration_ms: int = 300, # Duration in milliseconds\n easing: str = \"in-out\" # Easing function\n) -> str: # Combined CSS classes for smooth transitions\n \"Create a smooth transition with common defaults.\"\n```\n\n``` python\ndef hover_effect(\n duration_ms: int = 200 # Duration in milliseconds\n) -> str: # Combined CSS classes for hover effects\n \"Standard hover effect transition for interactive elements.\"\n```\n\n``` python\ndef fade_in(\n duration_ms: int = 500, # Duration in milliseconds\n delay_ms: Optional[int] = None # Optional delay in milliseconds\n) -> str: # Combined CSS classes for fade-in effect\n \"Fade-in transition for entering elements.\"\n```\n\n``` python\ndef loading_spinner(\n) -> str: # Combined CSS classes for a loading spinner\n \"Create a loading spinner animation.\"\n```\n\n``` python\ndef skeleton_loader(\n) -> str: # Combined CSS classes for a skeleton loader\n \"Create a skeleton loader animation for content placeholders.\"\n```\n\n``` python\ndef test_transitions_and_animation_helper_examples()\n \"Test helper functions for common transition patterns.\"\n```\n\n#### Classes\n\n``` python\nclass TransitionPropertyFactory(SimpleFactory):\n \"Factory for transition property utilities with custom value support.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the transition property factory.\"\n```\n\n``` python\nclass TransitionPropertyFactory(SimpleFactory):\n \"Factory for transition property utilities with custom value support.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the transition property factory.\"\n```\n\n``` python\nclass DurationFactory:\n def __init__(\n self,\n prefix: str,\n config: ScaleConfig,\n doc: Optional[str] = None\n )\n \"Factory for duration utilities with millisecond support.\"\n \n def __init__(\n self,\n prefix: str,\n config: ScaleConfig,\n doc: Optional[str] = None\n )\n \"Initialize duration factory with autocomplete properties.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the duration factory.\"\n```\n\n``` python\nclass EaseFactory(SimpleFactory):\n \"Factory for easing/timing function utilities with custom value support.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the ease factory.\"\n```\n\n``` python\nclass DelayFactory:\n def __init__(\n self,\n prefix: str,\n config: ScaleConfig,\n doc: Optional[str] = None\n )\n \"Factory for delay utilities with millisecond support.\"\n \n def __init__(\n self,\n prefix: str,\n config: ScaleConfig,\n doc: Optional[str] = None\n )\n \"Initialize delay factory with autocomplete properties.\"\n```\n\n``` python\nclass AnimationFactory(SimpleFactory):\n \"Factory for animation utilities with custom value support.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Dictionary with factory information\n \"Get information about the animation factory.\"\n```\n\n#### Variables\n\n``` python\nDURATION_SCALE = [9 items] # Standard Tailwind duration scale\nDURATION_CONFIG # Duration configuration\nduration # The duration factory\nDELAY_SCALE = [9 items] # Standard Tailwind delay scale\nDELAY_CONFIG # Delay configuration\ndelay # The delay factory\n```\n\n### typography (`typography.ipynb`)\n\n> Typography utilities for Tailwind CSS\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.utilities.typography import (\n font,\n TEXT_SIZE_CONFIG,\n text,\n antialiased,\n subpixel_antialiased,\n italic,\n not_italic,\n font_stretch,\n normal_nums,\n ordinal,\n slashed_zero,\n lining_nums,\n oldstyle_nums,\n proportional_nums,\n tabular_nums,\n diagonal_fractions,\n stacked_fractions,\n TRACKING_CONFIG,\n tracking,\n LINE_CLAMP_CONFIG,\n line_clamp,\n LEADING_CONFIG,\n leading,\n list_image,\n list_position,\n list_style,\n text_align,\n underline,\n overline,\n line_through,\n no_underline,\n decoration,\n decoration_style,\n DECORATION_THICKNESS_CONFIG,\n decoration_thickness,\n UNDERLINE_OFFSET_CONFIG,\n underline_offset,\n uppercase,\n lowercase,\n capitalize,\n normal_case,\n truncate,\n text_ellipsis,\n text_clip,\n text_wrap,\n text_nowrap,\n text_balance,\n text_pretty,\n indent,\n align,\n whitespace,\n break_normal,\n break_all,\n break_keep,\n wrap_break_word,\n wrap_anywhere,\n wrap_normal,\n hyphens,\n content,\n test_typography_font_family_examples,\n test_typography_font_size_examples,\n test_typography_font_smoothing_examples,\n test_typography_font_style_examples,\n FontFactory,\n test_typography_font_weight_examples,\n test_typography_font_stretch_examples,\n test_typography_font_variant_numeric_examples,\n test_typography_spacing_examples,\n LineClampFactory,\n test_typography_line_clamp_examples,\n LeadingFactory,\n test_typography_line_height_examples,\n ListImageUtility,\n ListImageFactory,\n test_typography_list_image_examples,\n test_typography_list_styles_examples,\n test_typography_text_alignment_examples,\n TextFactory,\n test_typography_text_color_examples,\n test_typography_text_decoration_examples,\n test_typography_underline_offset_examples,\n test_typography_text_transform_examples,\n test_typography_text_overflow_examples,\n test_typography_text_wrap_examples,\n test_typography_text_indent_examples,\n test_typography_vertical_align_examples,\n test_typography_whitespace_examples,\n test_typography_word_break_examples,\n test_typography_overflow_wrap_examples,\n test_typography_hyphens_examples,\n ContentUtility,\n ContentFactory,\n test_typography_content_examples,\n test_typography_practical_examples,\n test_typography_factory_documentation\n)\n```\n\n#### Functions\n\n``` python\ndef test_typography_font_family_examples()\n \"Test font family utilities.\"\n```\n\n``` python\ndef test_typography_font_size_examples()\n \"Test font size utilities.\"\n```\n\n``` python\ndef test_typography_font_smoothing_examples()\n \"Test font smoothing utilities.\"\n```\n\n``` python\ndef test_typography_font_style_examples()\n \"Test font style utilities.\"\n```\n\n``` python\ndef test_typography_font_weight_examples()\n \"Test font weight utilities.\"\n```\n\n``` python\ndef test_typography_font_stretch_examples()\n \"Test font stretch utilities.\"\n```\n\n``` python\ndef test_typography_font_variant_numeric_examples()\n \"Test font variant numeric utilities.\"\n```\n\n``` python\ndef test_typography_spacing_examples()\n \"Test letter spacing utilities.\"\n```\n\n``` python\ndef test_typography_line_clamp_examples()\n \"Test line clamp utilities.\"\n```\n\n``` python\ndef test_typography_line_height_examples()\n \"Test line height utilities.\"\n```\n\n``` python\ndef test_typography_list_image_examples()\n \"Test list style image utilities.\"\n```\n\n``` python\ndef test_typography_list_styles_examples()\n \"Test list styles utilities.\"\n```\n\n``` python\ndef test_typography_text_alignment_examples()\n \"Test text alignment utilities.\"\n```\n\n``` python\ndef test_typography_text_color_examples()\n \"Test text color utilities.\"\n```\n\n``` python\ndef test_typography_text_decoration_examples()\n \"Test text decoration utilities.\"\n```\n\n``` python\ndef test_typography_underline_offset_examples()\n \"Test underline offset utilities.\"\n```\n\n``` python\ndef test_typography_text_transform_examples()\n \"Test text transform utilities.\"\n```\n\n``` python\ndef test_typography_text_overflow_examples()\n \"Test text overflow utilities.\"\n```\n\n``` python\ndef test_typography_text_wrap_examples()\n \"Test text wrap utilities.\"\n```\n\n``` python\ndef test_typography_text_indent_examples()\n \"Test text indent utilities.\"\n```\n\n``` python\ndef test_typography_vertical_align_examples()\n \"Test vertical align utilities.\"\n```\n\n``` python\ndef test_typography_whitespace_examples()\n \"Test whitespace utilities.\"\n```\n\n``` python\ndef test_typography_word_break_examples()\n \"Test word break utilities.\"\n```\n\n``` python\ndef test_typography_overflow_wrap_examples()\n \"Test overflow wrap utilities.\"\n```\n\n``` python\ndef test_typography_hyphens_examples()\n \"Test hyphens utilities.\"\n```\n\n``` python\ndef test_typography_content_examples()\n \"Test content utilities for pseudo-elements.\"\n```\n\n``` python\ndef test_typography_practical_examples()\n \"Test typography utilities in practical FastHTML component examples.\"\n```\n\n``` python\ndef test_typography_factory_documentation()\n \"Test that typography factories have accessible documentation.\"\n```\n\n#### Classes\n\n``` python\nclass FontFactory:\n def __init__(self)\n \"Factory for font utilities including family and weight.\"\n \n def __init__(self)\n \"Initialize font factory with families and weights.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Factory information\n \"Get information about the font factory.\"\n```\n\n``` python\nclass LineClampFactory(ScaledFactory):\n \"Factory for line clamp utilities.\"\n \n```\n\n``` python\nclass LeadingFactory(ScaledFactory):\n \"Factory for line height utilities with restricted numeric range.\"\n \n```\n\n``` python\nclass ListImageUtility(BaseUtility):\n \"Utility class for list-style-image with arbitrary value support.\"\n \n```\n\n``` python\nclass ListImageFactory:\n def __init__(self):\n \"\"\"Initialize list image factory.\"\"\"\n super().__init__(\"List style image utilities for controlling list item marker images\")\n self.none = ListImageUtility(\"list-image\")\n self.none._value = \"none\"\n \n def __call__(\n self,\n value: str # Image URL or value\n ) -> ListImageUtility: # A list image utility instance\n \"Factory for list-style-image utilities.\"\n \n def __init__(self):\n \"\"\"Initialize list image factory.\"\"\"\n super().__init__(\"List style image utilities for controlling list item marker images\")\n self.none = ListImageUtility(\"list-image\")\n self.none._value = \"none\"\n \n def __call__(\n self,\n value: str # Image URL or value\n ) -> ListImageUtility: # A list image utility instance\n \"Initialize list image factory.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Factory information\n \"Get information about the list image factory.\"\n```\n\n``` python\nclass TextFactory:\n def __init__(self)\n \"Enhanced text factory that supports both font sizes and text colors.\"\n \n def __init__(self)\n \"Initialize text factory with size support.\"\n```\n\n``` python\nclass ContentUtility(BaseUtility):\n \"Utility class for content with arbitrary value support.\"\n \n```\n\n``` python\nclass ContentFactory:\n def __init__(self):\n \"\"\"Initialize content factory.\"\"\"\n super().__init__(\"Content utilities for controlling before and after pseudo-element content\")\n self.none = ContentUtility(\"content\")\n self.none._value = \"none\"\n \n def __call__(\n self,\n value: str # Content value\n ) -> ContentUtility: # A content utility instance\n \"Factory for content utilities for pseudo-elements.\"\n \n def __init__(self):\n \"\"\"Initialize content factory.\"\"\"\n super().__init__(\"Content utilities for controlling before and after pseudo-element content\")\n self.none = ContentUtility(\"content\")\n self.none._value = \"none\"\n \n def __call__(\n self,\n value: str # Content value\n ) -> ContentUtility: # A content utility instance\n \"Initialize content factory.\"\n \n def get_info(\n self\n ) -> Dict[str, Any]: # Factory information\n \"Get information about the content factory.\"\n```\n\n#### Variables\n\n``` python\nTEXT_SIZE_CONFIG\ntext # Font size factory\nantialiased # Antialiased font smoothing\nsubpixel_antialiased # Subpixel antialiased font smoothing\nitalic # Italic font style\nnot_italic # Normal font style\nfont # Enhanced font factory for family and weight\nnormal_nums # Normal numbers\nordinal # Ordinal numbers\nslashed_zero # Slashed zero\nlining_nums # Lining numbers\noldstyle_nums # Old-style numbers\nproportional_nums # Proportional numbers\ntabular_nums # Tabular numbers\ndiagonal_fractions # Diagonal fractions\nstacked_fractions # Stacked fractions\nTRACKING_CONFIG\ntracking # Letter spacing factory\nLINE_CLAMP_CONFIG\nline_clamp # Line clamp factory\nLEADING_CONFIG\nleading # Line height factory\nlist_image # List image factory\ntext # Enhanced text factory for size and color\nunderline # Underline text\noverline # Overline text\nline_through # Line through text\nno_underline # No text decoration\ndecoration # Text decoration color factory\nDECORATION_THICKNESS_CONFIG\ndecoration_thickness # Text decoration thickness factory\nUNDERLINE_OFFSET_CONFIG\nunderline_offset # Text underline offset factory\nuppercase # Uppercase text\nlowercase # Lowercase text\ncapitalize # Capitalize text\nnormal_case # Normal case text\ntruncate # Truncate overflow text\ntext_ellipsis # Text ellipsis\ntext_clip # Text clip\ntext_wrap # Text wrap\ntext_nowrap # Text no wrap\ntext_balance # Text balance\ntext_pretty # Text pretty\nindent # Text indent factory\nbreak_normal # Normal word break\nbreak_all # Break all\nbreak_keep # Keep words together\nwrap_break_word # Break word wrap\nwrap_anywhere # Wrap anywhere\nwrap_normal # Normal wrap\ncontent # Content factory\n```\n\n### utils (`utils.ipynb`)\n\n> Utility functions for CLI tools\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_tailwind.cli.utils import (\n SearchResult,\n print_header,\n print_not_found,\n print_total,\n print_helpful_instructions,\n display_items_generic,\n handle_module_not_found,\n simple_item_formatter,\n indented_item_formatter,\n extract_match_context,\n extract_source_line_context,\n create_search_result,\n search_in_text,\n search_in_name_and_text,\n check_factory_usage_patterns,\n search_in_fields,\n search_in_source_code,\n find_usage_in_items,\n get_view_command,\n format_usage_examples,\n discover_utility_modules,\n iterate_all_modules_with_items,\n extract_helper_names_from_test,\n load_code_from_file,\n list_utility_modules\n)\n```\n\n#### Functions\n\n``` python\ndef print_header(\n title: str, # TODO: Add description\n width: int = 60 # TODO: Add description\n): # TODO: Add type hint\n \"Print a formatted header with title and separator.\"\n```\n\n``` python\ndef print_not_found(\n item_type: str, # TODO: Add description\n item_name: str, # TODO: Add description\n module_name: Optional[str] = None # TODO: Add description\n): # TODO: Add type hint\n \"Print a standardized not found message.\"\n```\n\n``` python\ndef print_total(\n item_type: str, # TODO: Add description\n count: int, # TODO: Add description\n across_modules: bool = False # TODO: Add description\n): # TODO: Add type hint\n \"Print a standardized total count message.\"\n```\n\n``` python\ndef print_helpful_instructions(\n instructions: List[Tuple[str, Optional[str]]] # List of (description, example) tuples\n)\n \"Print helpful instructions section.\"\n```\n\n``` python\ndef display_items_generic(\n items: Union[Dict, List], # Items to display (dict of lists or list)\n title: str, # Title for the display\n item_formatter: Callable[[Any], str], # Function to format each item\n item_type: str, # Type of items for the total message\n instructions: Optional[List[Tuple[str, Optional[str]]]] = None, # Help instructions\n not_found_message: Optional[str] = None # Custom not found message\n)\n \"Generic function to display a collection of items with consistent formatting.\"\n```\n\n``` python\ndef handle_module_not_found(\n \"Print standardized error message for module not found.\"\n```\n\n``` python\ndef simple_item_formatter(\n name_field: str, # Name of the field containing the item name\n doc_field: str # Name of the field containing the documentation\n) -> Callable[[Any], str]: # Formatter function\n \"Create a simple formatter for items with name and documentation fields.\"\n```\n\n``` python\ndef indented_item_formatter(\n prefix: str = \" \" # Indentation prefix\n) -> Callable[[Any], Callable[[Any], str]]: # Returns a formatter factory\n \"Create a formatter that indents items with a prefix.\"\n```\n\n``` python\ndef extract_match_context(\n text: str, # TODO: Add description\n query: str, # TODO: Add description\n case_sensitive: bool = False, # TODO: Add description\n context_size: int = 30 # TODO: Add description\n) -> str: # TODO: Add return description\n \"Extract context around a match in text.\"\n```\n\n``` python\ndef extract_source_line_context(\n source: str, # TODO: Add description\n query: str, # TODO: Add description\n case_sensitive: bool = False # TODO: Add description\n) -> str: # TODO: Add return description\n \"Extract line context for a match in source code.\"\n```\n\n``` python\ndef create_search_result(\n content_type: str, # TODO: Add description\n module_name: str, # TODO: Add description\n item_name: str, # TODO: Add description\n match_context: str, # TODO: Add description\n match_location: str # TODO: Add description\n) -> SearchResult: # TODO: Add return description\n \"Create a SearchResult with standard fields.\"\n```\n\n``` python\ndef search_in_text(\n query: str, # Search query\n text: str, # Text to search in\n case_sensitive: bool = False # Whether to perform case-sensitive search\n) -> bool: # True if match found\n \"Check if query exists in text.\"\n```\n\n``` python\ndef search_in_name_and_text(\n query: str, # TODO: Add description\n item_name: str, # TODO: Add description\n text: str, # TODO: Add description\n content_type: str, # TODO: Add description\n module_name: str, # TODO: Add description\n text_location: str, # TODO: Add description\n case_sensitive: bool = False # TODO: Add description\n) -> List[SearchResult]: # TODO: Add return description\n \"Search in both name and text fields, returning search results.\"\n```\n\n``` python\ndef check_factory_usage_patterns(\n factory_name: str # TODO: Add description\n) -> List[str]: # TODO: Add return description\n \"Get regex patterns to match common factory usage patterns.\"\n```\n\n``` python\ndef search_in_fields(\n item: Any, # The item to search in\n query: str, # Search query\n fields: Dict[str, Callable[[Any], str]], # field_name -> getter function\n content_type: str, # Type of content being searched\n module_name: str, # Module containing the item\n item_name: str, # Name of the item\n case_sensitive: bool = False # Whether to perform case-sensitive search\n) -> List[SearchResult]: # List of search results\n \"Search for query in multiple fields of an item.\"\n```\n\n``` python\ndef search_in_source_code(\n source: str, # Source code to search in\n query: str, # Search query\n content_type: str, # Type of content being searched\n module_name: str, # Module containing the source\n item_name: str, # Name of the item\n case_sensitive: bool = False # Whether to perform case-sensitive search\n) -> Optional[SearchResult]: # Search result or None\n \"Search in source code and return result with line context.\"\n```\n\n``` python\ndef find_usage_in_items(\n target_name: str, # Name of the target (factory/helper) to find usage for\n items: Dict[str, List[Any]], # Dictionary of module_name -> list of items\n source_getter: Callable[[Any], str], # Function to get source code from item\n item_type: str # Type of items being searched (for display)\n) -> List[Tuple[str, Any]]: # List of (module_name, item) tuples\n \"Find items that use a specific target (factory/helper).\"\n```\n\n``` python\ndef get_view_command(\n content_type: str, # Type of content ('factory', 'example', 'helper', 'module')\n module_name: str, # Module name\n item_name: str # Item name (or feature name for examples)\n) -> str: # CLI command to view the item\n \"Get the CLI command to view a specific item.\"\n```\n\n``` python\ndef format_usage_examples(\n usage_items: List[Tuple[str, Any]], # List of (module_name, item) tuples\n item_name_getter: Callable[[Any], str], # Function to get item name\n item_type: str, # Type of items ('examples' or 'helpers')\n view_command_type: str # Type for get_view_command ('example' or 'helper')\n) -> List[str]: # List of formatted strings\n \"Format usage examples for display.\"\n```\n\n``` python\ndef discover_utility_modules(\n) -> List[Tuple[str, Any]]: # List of (module_name, module) tuples\n \"Discover all utility modules in the cjm_fasthtml_tailwind.utilities package.\"\n```\n\n``` python\ndef iterate_all_modules_with_items(\n extractor_func, # Function to extract items from a module - TODO: Add type hint\n module_filter: Optional[str] = None # Optional specific module to filter for\n) -> Dict[str, List[Any]]: # Dictionary mapping module names to their items\n \"Generic iterator for extracting items from all modules.\"\n```\n\n``` python\ndef extract_helper_names_from_test(\n source: str # Source code of the test_<module>_helper_examples function\n) -> List[str]: # List of helper function names\n \"Extract helper function names from test source code.\"\n```\n\n``` python\ndef load_code_from_file(\n filepath: str # TODO: Add description\n) -> Optional[str]: # TODO: Add return description\n \"Load code from a file.\"\n```\n\n``` python\ndef list_utility_modules(\n) -> Dict[str, str]: # Dictionary mapping module names to their docstrings\n \"List all available utility modules with their docstrings.\"\n```\n\n#### Classes\n\n``` python\n@dataclass\nclass SearchResult:\n \"Represents a single search result.\"\n \n content_type: str # 'factory', 'example', 'helper', 'module'\n module_name: str # Module where found\n item_name: str # Name of the item (factory name, function name, etc.)\n match_context: str # The context where the match was found\n match_location: str # Where the match was found (name, doc, source)\n score: float = 1.0 # Relevance score for fuzzy matching\n```\n",
"bugtrack_url": null,
"license": "Apache Software License 2.0",
"summary": "Python-native Tailwind CSS v4 utility builder providing type-safe, dynamic class generation with full abstraction for FastHTML projects.",
"version": "0.0.2",
"project_urls": {
"Homepage": "https://github.com/cj-mills/cjm-fasthtml-tailwind"
},
"split_keywords": [
"nbdev",
"jupyter",
"notebook",
"python"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "95262c0fa3614f9bdbf6ee16a393d7388c9be47d0e6092a12e547349fa343b73",
"md5": "f8e289b4d5886cfd85cf3e602f8c4854",
"sha256": "bb45b467ba7dd7fba375d7d2402b9e11a242f8d2ff4f8f0f320e741615c8772e"
},
"downloads": -1,
"filename": "cjm_fasthtml_tailwind-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f8e289b4d5886cfd85cf3e602f8c4854",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 206291,
"upload_time": "2025-08-04T23:18:45",
"upload_time_iso_8601": "2025-08-04T23:18:45.868847Z",
"url": "https://files.pythonhosted.org/packages/95/26/2c0fa3614f9bdbf6ee16a393d7388c9be47d0e6092a12e547349fa343b73/cjm_fasthtml_tailwind-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "dfedd26b5c85c6c8afbbc0a3d68e878849e68bd26bd453a4fdc33f5d4cf0b077",
"md5": "d25fb1936d91e6ece19a5a4bfd59855a",
"sha256": "6b64d8a79fd9e3b5e8d4b76f65c3f8255c26da09cb3308992987dcbe8238b239"
},
"downloads": -1,
"filename": "cjm_fasthtml_tailwind-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "d25fb1936d91e6ece19a5a4bfd59855a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 251134,
"upload_time": "2025-08-04T23:18:47",
"upload_time_iso_8601": "2025-08-04T23:18:47.522600Z",
"url": "https://files.pythonhosted.org/packages/df/ed/d26b5c85c6c8afbbc0a3d68e878849e68bd26bd453a4fdc33f5d4cf0b077/cjm_fasthtml_tailwind-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-04 23:18:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cj-mills",
"github_project": "cjm-fasthtml-tailwind",
"github_not_found": true,
"lcname": "cjm-fasthtml-tailwind"
}