update readme for conciseness

This commit is contained in:
Michael Freno
2025-12-14 12:16:40 -05:00
parent 2f336fecdd
commit 25a08d95a9
3 changed files with 1 additions and 134 deletions

2
.gitignore vendored
View File

@@ -16,4 +16,4 @@ releases/
memory_scan*
*_report*
*.key
*.src.rock
*.rock

View File

@@ -221,59 +221,12 @@ function love.draw()
width = "30vw",
height = "40vh",
backgroundColor = Color.new(0.2, 0.2, 0.2, 1),
-- ID is auto-generated if not provided (works in both modes)
})
FlexLove.endFrame()
end
```
**Key behaviors:**
- `mode = "immediate"` - Element uses immediate-mode lifecycle (recreated each frame, uses StateManager)
- `mode = "retained"` - Element uses retained-mode lifecycle (persists across frames, uses StateManager for mixed-mode children)
- `mode = nil` - Element inherits from global mode setting (default behavior)
- **ID auto-generation** - All elements receive an auto-generated ID if not explicitly provided, enabling state management features
- Mode does NOT inherit from parent to child - each element independently controls its own lifecycle
- Common use cases:
- Performance-critical static UI in retained mode while using immediate mode globally
- Reactive debug overlays in immediate mode within a retained-mode application
- Mixed UI where some components are static (menus) and others are dynamic (HUD)
#### Automatic ID Generation
All elements automatically receive a unique ID if not explicitly provided. This enables powerful state management features:
```lua
-- ID is automatically generated based on call site
local button = FlexLove.new({
text = "Click Me",
-- id is auto-generated (e.g., "main_L42_child0_123456")
})
-- Or provide a custom ID for explicit control
local namedButton = FlexLove.new({
id = "submit_button",
text = "Submit",
})
```
**ID Generation Strategy:**
- **Top-level elements**: ID based on source file and line number (e.g., `main_L42`)
- **Child elements**: ID based on parent ID + sibling index (e.g., `parent_child0`, `parent_child1`)
- **Multiple elements at same location**: Automatically numbered (e.g., `main_L42_1`, `main_L42_2`)
- **Property differentiation**: Similar elements get unique hash suffixes based on their properties
**Benefits of Auto-Generated IDs:**
- Enables state persistence in immediate mode (scroll position, input text, animations)
- Allows retained children in immediate parents (mixed-mode trees)
- Supports state management features without manual ID tracking
- Stable across frames when element structure is consistent
**When to Use Custom IDs:**
- When you need to reference elements programmatically
- For debugging and logging (readable names)
- When element creation order might change but identity should remain stable
### Element Properties
Common properties for all elements:
@@ -808,7 +761,6 @@ lua testing/__tests__/<specific_test>
## Compatibility
**Compatibility:**
- **Lua**: 5.1+
- **LÖVE**: 11.x (tested)

View File

@@ -1,85 +0,0 @@
package = "flexlove"
version = "0.7.2-1"
source = {
url = "git+https://github.com/mikefreno/FlexLove.git",
tag = "v0.7.2",
}
description = {
summary = "A comprehensive UI library providing flexbox/grid layouts, theming, animations, and event handling for LÖVE2D games",
detailed = [[
FlexLöve is a lightweight, flexible GUI library for LÖVE2D that implements a
flexbox-based layout system. The goals of this project are two-fold: first,
anyone with basic CSS knowledge should be able to use this library with minimal
learning curve. Second, this library should take you from early prototyping to
production.
Features:
- Flexbox and Grid Layout systems
- Modern theming with 9-patch support
- Animations and transitions
- Image rendering with CSS-like object-fit
- Touch events and gesture recognition
- Text input with rich editing features
- Responsive design with viewport units
- Both immediate and retained rendering modes
Going this route, you will need to link the luarocks path to your project:
(for mac/linux)
```lua
package.path = package.path .. ";/Users/<username>/.luarocks/share/lua/<version>/?.lua"
package.path = package.path .. ";/Users/<username>/.luarocks/share/lua/<version>/?/init.lua"
package.cpath = package.cpath .. ";/Users/<username>/.luarocks/lib/lua/<version>/?.so"
```
]],
homepage = "https://mikefreno.github.io/FlexLove/",
license = "MIT",
maintainer = "Mike Freno",
}
dependencies = {
"lua >= 5.1",
"luautf8 >= 0.1.3",
}
build = {
type = "builtin",
modules = {
["FlexLove"] = "FlexLove.lua",
["FlexLove.modules.Animation"] = "modules/Animation.lua",
["FlexLove.modules.Blur"] = "modules/Blur.lua",
["FlexLove.modules.Calc"] = "modules/Calc.lua",
["FlexLove.modules.Color"] = "modules/Color.lua",
["FlexLove.modules.Context"] = "modules/Context.lua",
["FlexLove.modules.Element"] = "modules/Element.lua",
["FlexLove.modules.ErrorHandler"] = "modules/ErrorHandler.lua",
["FlexLove.modules.EventHandler"] = "modules/EventHandler.lua",
["FlexLove.modules.FFI"] = "modules/FFI.lua",
["FlexLove.modules.GestureRecognizer"] = "modules/GestureRecognizer.lua",
["FlexLove.modules.Grid"] = "modules/Grid.lua",
["FlexLove.modules.ImageCache"] = "modules/ImageCache.lua",
["FlexLove.modules.ImageRenderer"] = "modules/ImageRenderer.lua",
["FlexLove.modules.ImageScaler"] = "modules/ImageScaler.lua",
["FlexLove.modules.InputEvent"] = "modules/InputEvent.lua",
["FlexLove.modules.LayoutEngine"] = "modules/LayoutEngine.lua",
["FlexLove.modules.MemoryScanner"] = "modules/MemoryScanner.lua",
["FlexLove.modules.ModuleLoader"] = "modules/ModuleLoader.lua",
["FlexLove.modules.NinePatch"] = "modules/NinePatch.lua",
["FlexLove.modules.Performance"] = "modules/Performance.lua",
["FlexLove.modules.Renderer"] = "modules/Renderer.lua",
["FlexLove.modules.RoundedRect"] = "modules/RoundedRect.lua",
["FlexLove.modules.ScrollManager"] = "modules/ScrollManager.lua",
["FlexLove.modules.StateManager"] = "modules/StateManager.lua",
["FlexLove.modules.TextEditor"] = "modules/TextEditor.lua",
["FlexLove.modules.Theme"] = "modules/Theme.lua",
["FlexLove.modules.types"] = "modules/types.lua",
["FlexLove.modules.Units"] = "modules/Units.lua",
["FlexLove.modules.UTF8"] = "modules/UTF8.lua",
["FlexLove.modules.utils"] = "modules/utils.lua",
},
--copy_directories = {
--"docs",
--"examples",
--},
}