Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outlets API #576

Merged
merged 11 commits into from Nov 17, 2022
Merged

Outlets API #576

merged 11 commits into from Nov 17, 2022

Commits on Aug 23, 2022

  1. Copy the full SHA
    1176a78 View commit details
    Browse the repository at this point in the history

Commits on Aug 26, 2022

  1. Copy the full SHA
    5875f98 View commit details
    Browse the repository at this point in the history

Commits on Aug 28, 2022

  1. Add tests for Outlets

    marcoroth committed Aug 28, 2022
    Copy the full SHA
    88dae7a View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2022

  1. Copy the full SHA
    35b3f76 View commit details
    Browse the repository at this point in the history
  2. Swap out TokenListObserver for new SelectorObserver

    The approach using the `SelectorObserver` is much more reliable to fire
    the outlet connected and disconnected callbacks.
    
    It's now matching against the selector provided in the
    `data-[controller]-[outlet]-outlet` attribute instead of just looking
    for elements which have a `data-controller` attribute to appear.
    Previously, when a `data-controller` appeared we checked it's attribute
    value to see if it was relevant as an outlet for the current controller.
    
    Using the `SelectorObserver` we now solve an edge case where the user
    would dynamically add/remove an attribute to the outlet element which
    would then make that element relevant or not relevant anymore as an
    outlet for the current controller. We need to know that so that we can
    reliably fire the outlet callbacks. Previously I wouldn't have fired the
    callbacks.
    
    For every outlet we define we now create a separate instance of the
    `SelectorObserver` which also handles that we just match the relevant
    outlets by adding the `data-controller~=[outletName]` selector to the
    CSS selector we lookup.
    marcoroth committed Aug 30, 2022
    Copy the full SHA
    abba8db View commit details
    Browse the repository at this point in the history
  3. Use outletName over name

    marcoroth committed Aug 30, 2022
    Copy the full SHA
    85dcc13 View commit details
    Browse the repository at this point in the history

Commits on Sep 5, 2022

  1. Copy the full SHA
    369c2d0 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    305e293 View commit details
    Browse the repository at this point in the history
  3. Invoke outlet callbacks for instances that get connected after the cu…

    …rrent instance gets connected
    
    There was an edge case where outlets wouldn't fire the outlet callbacks 
    if they appeared later in the DOM but the current instance had a 
    "dependency" on them.
    
    To solve this the OutletObserver now "notifies" it's dependents that 
    it conencted so they can refire the matching elements via the 
    `refresh()` function of the ElementObserver.
    marcoroth committed Sep 5, 2022
    Copy the full SHA
    4c2c466 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    f967595 View commit details
    Browse the repository at this point in the history

Commits on Nov 17, 2022

  1. Copy the full SHA
    ca4a04a View commit details
    Browse the repository at this point in the history