Framework updates
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,10 @@ API
|
||||
group will have their min-width set to match the widest element.
|
||||
Returns the jQuery object for chaining.
|
||||
|
||||
Each element can only belong to one width group at a time:
|
||||
- If already in the same group: no-op (idempotent)
|
||||
- If in a different group: moved to the new group
|
||||
|
||||
Example:
|
||||
$(".toolbar .btn").width_group("toolbar-buttons");
|
||||
|
||||
@@ -64,14 +68,29 @@ AUTOMATIC CLEANUP
|
||||
Explicit $.width_group_destroy() calls are optional but can be used for
|
||||
immediate cleanup.
|
||||
|
||||
COMPONENT INTEGRATION
|
||||
When width_group() is called, it automatically finds child components
|
||||
within each element using shallowFind('.Component'). For each component
|
||||
found, it listens for the 'ready' event and triggers a debounced
|
||||
recalculation when the component becomes ready.
|
||||
|
||||
This handles cases where a width group contains components that load
|
||||
asynchronously - the widths will be recalculated once the component
|
||||
content is rendered.
|
||||
|
||||
All recalculation triggers (resize, component ready) share the same
|
||||
debounced function (100ms) to prevent excessive recalculations.
|
||||
|
||||
HOW IT WORKS
|
||||
1. On width_group() call, elements are added to a named registry
|
||||
2. Calculation runs:
|
||||
2. Calculation runs immediately:
|
||||
a. Remove min-width from all elements (measure natural width)
|
||||
b. Find max scrollWidth across all connected elements
|
||||
c. Apply max as min-width to all connected elements
|
||||
3. On window resize (debounced 100ms), recalculate all groups
|
||||
4. Disconnected elements are pruned on each calculation
|
||||
3. Child components found via shallowFind('.Component') have their
|
||||
ready events listened to for debounced recalculation
|
||||
4. On window resize (debounced 100ms), recalculate all groups
|
||||
5. Disconnected elements are pruned on each calculation
|
||||
|
||||
EXAMPLES
|
||||
Button group with consistent widths:
|
||||
|
||||
Reference in New Issue
Block a user