Metadata-Version: 2.5
Name: miniui
Version: 0.1.0
Summary: A flexbox-inspired layout engine for building terminal UIs
Project-URL: Homepage, https://github.com/wilburcoding/terminalui
Project-URL: Issues, https://github.com/wilburcoding/terminalui/issues
Author: Wilbur
License-Expression: MIT
License-File: LICENSE
Keywords: cli,flexbox,layout,terminal,tui,ui
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: User Interfaces
Classifier: Topic :: Terminals
Requires-Python: >=3.9
Requires-Dist: pynput>=1.7
Description-Content-Type: text/markdown

# TerminalUI

Easy to use Python library for displaying UI in the terminal. See REFERENCE.md for full API reference. Sample usage of all elements is available at `sample.py` (run with `python sample.py`). 

Objectives:
 - Easy to use, container based UI layout with actually good layout engine?
 - CSS like properties
 - HTML like elements: text, uh...
 - ANSI based colors -> allow any color
 - Button inputs -> allow users to select buttons using arrow keys?
   - Also maybe different frames? -> can select different frames
 - Easy to update?
 - HTML/CSS based importing? would be a lot cleaner than the normal

# TODO

 - [ ] Layout engine
   - [x] Initiailization
   - [x] Elements
     - [x] Text
     - [x] Container
       - [x] Container layouts -> just row and column for now probably
     - [x] Button
     - [x] Input fields
     - [x] Progress Bar
   - [x] Elements properties
     - [x] Backgroudn
     - [x] Border
   - [x] Rendering
     - [x] Initial rendering
       - [x] Text
       - [x] Different container layouts
       - [x] Borders
   - [x] Live element selecting mode
     - [x] Key listeners
 - [x] Color rendering engine
 - [ ] Documentation
   - [ ] Create - REFERENCE.md
   - [ ] 

# IDEA DUMP

 - Layout engine  
   - Elements
     - Boxes
       - Width is x amount of char spaces. Height is in lines.
         - Percentage amounts in the future? 
         - Required field. For now. 
       - Border - always 1 grid space width
         - Later feature probably
       - Layout orientation
         - Vertical is easy -> just place on top and use size calculations
         - Horizontal -> Check if container fits. For text, since width is by default the width of parent container, it would break into 2 lines. 
           - Keep track of lines. Add additional if necesary before moving onto new row
     - Text
       - By default, width is parent container width
         - "parent" = parent width. Otherwise it should be a number
           - Theoretically there should always be a parent. 
             - WHat if parent also has "parent" as width..... Require containers to have a set width
       - Wrap is by default break word
         - Can figure out other options later
     - Input element
       - Basically a button eleemnt but text inside can change?
       - Placeholder disappears when there's actually text inside
   - Generating output
     - Recursively generate the actual appearences of containers starting from main container
       - Main container should automatically be the size of the window
       - once generated, calculate size and figure out placement 
       - Once placement is figured out, generate full output
       - this is def a lot harder than it sounds
 - Color rendering
   - I guess we should just make an alt print function that just has alternate options for colors
   - Keep it simple. Want to focus on actual rendering and layout engine
 - Overall usage structure for users
   - Import module
   - Require a base container for the main layout -> created wiht user setup
   - User can add elements (text, container to start) to this main container and to other containers
     - Can pass parameters to style these elements
     - Can tag elements with ID to find them later
   - Call function to render or update UI 
     - Rendering just clears and pastes new UI. 
     - Start listener allows users to interact
       - same rendering function but allow users to select items
         - How to highlight selected items?
           - All items have by default a "hover" style -> maybe like a different border style (double line border)
 - How to fix styles resetting in the middle bcs of new text?
   - Don't immediate add filling spaces for text?
     - This would really mess up how the current formatting works though
   - I guess always use parent function styling -> mostly a background issue
 - Text styling uses extra characters. What to do?
   - Add formatting stripping function? Can use regular expressions for the special color ones
 - What to do if there is extra space at the end of a row for horizontal or vertical layouts??
   - Use parent styling (just background for the filling)
 - Borders
   - Separate outer and inner heights and width dimensions?
     - All children should be based on inner width
     - The actual outer size is read by the parent of the container
   - Borders not stacking? Why
     - Boxes use set height, not real height. Same with width. 
     - Want to make sure that outer box is the correct width
       - Forcing parent width as maximum
     - What about extra width from the prev?
       - can't forcibly remove?
       - Let's just put a warning since all dimensions are hard set
         - How to detect anyways?
 - Elements expansion
   - Lists? Should be easy
   - Buttons
     - Based on location 
       - Ex. if you press left arrow, it searches for any buttons left at a certain range (starting with the height of the original button)
       - If it doesn't find any buttons on this first path, it continually expands search radius in the direction 
       - Should allow functions to attach to buttons
     - Should essentially be the combination of box and text into a single element
   - Lists
     - Automatically fills and adds new line when necesary
     - Shoudl probably split this up into ordered and unordered lsits
   - Links?
     - Same way users are allowed to select elements?
     - Styles on hover - this would likely be a lot easier to do if we used a css like format
   - Can't really do different sized text
     - Or images
   - Text input?
     - If an input is selected all keyboard input is set into the text input
 - Actively looking for input?
   - keyboard module or pynput
   - Think im gonna use pynput. Looks a little easier to use.
   - Need a way to identify selected elements
     - Force IDs? At least on all input elements
     - some areas are different sizes -> maybe we should use preformatted version?
       - Yeah this is probably the call -> user selecting would be based off the real positioning they see visually anyways
       - After finding the ID of element, then its easy bcs we can just re render and it goes in automatically
   - To start, press any of the keyboard options
   - How to check if something is in a direction?
     - Look for center points within a certain area 
 - Big issue. What happens when elements look similar??
   - How to track where elements end up in final rendering?
   - Ok so no more -> we use rendering order to list
 - How to do margin? 
   - when processing a specific element, just add specific spacing -> use parent styling
 - Features to help user
 - Margin rendering should technically be the same across elements?
 - New elements
   - Progress bar seems nice
   - Multiple different views
   - Table? Should be realtively easy -> given a 2d list. 
     - Dynamic height and width of columns and rows
     - Users can enable columns, but by default there is spacing
 - Progress bar
   - Different styling options (will probably just number) -> ok nvm we'll just have them pick a specific character to fill
   - Processes inner inside the rendering function 

# Notes

I think we worry about stuff like margin and padding later

This sounded a lot easier in my head

Google says i should have helper methods instead of letting people access my variables directly so i guess im doing that

Normal Python shell ignores reset tokens. Command prompt seems to work. Also providing an extra new line at the end helps with the issue. VSCode commnad prompt also doesn't seem to work. Looks like splitting lines individually also helps with this issue. 

Reminder that post-rendering strs always have ANSI sequences inside!
