npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-tether

v3.1.0

Published

Tether an element to another element in the DOM

Downloads

116,517

Readme

Ember Tether Build Status Ember Observer Score

This ember-cli addon provides a component that allows for 'tethering' a block to a target somewhere else on the page. The target may be an element, an element selector, or an Ember view. Importantly, the component retains typical context for Ember action handling and data binding.

Compatibility

  • Ember.js v3.28 or above
  • Ember CLI v3.28 or above
  • Node.js v14 or above

For Ember 1.13 - 2.3, use 0.4.1. For support for earlier versions of Ember, use ember-tether 0.3.1.

Installation

Live Demo

View a live demo here: http://yapplabs.github.io/ember-tether/

Installation

ember install ember-tether

Note: Ember CLI versions < 0.2.3 should use ember install:addon instead of ember install

Example Usage

Given the following DOM:

<body class="ember-application">
  <div id="a-nice-person">
    Nice person
  </div>
  <div class="ember-view">
    <!-- rest of your Ember app's DOM... -->
  </div>
</body>

and a template like this:

<EmberTether
  @target='#a-nice-person'
  @targetAttachment='top right'
  @attachment='top left'
>
  A puppy
</EmberTether>

Then "A puppy" would be rendered alongside the a-nice-person div.

If the ember-tether component is destroyed, its far-off content is destroyed too. For example, given:

{{#if this.isShowing}}
  <EmberTether
    @target='#a-nice-person'
    @targetAttachment='top right'
    @attachment='top left'
  >
    A puppy
  </EmberTether>
{{/if}}

If this.isShowing starts off true and becomes false, then the "A puppy" text will be removed from the page.

Similarly, if you use <EmberTether /> in a route's template, it will render its content next to the target element when the route is entered and remove it when the route is exited.

Acceptance Testing

Tether works by appending tethered elements to the <body> tag. Unfortunately, this moves your content outside of the Ember application rootElement during acceptance testing. This breaks event dispatch and action handling, including traditional Ember test helpers like click.

As of version 0.4.0, we can configure a different element to be used instead of body. This can be useful for Ember tests.

// config/environment.js

ENV['ember-tether'] = {
  bodyElementId: 'ember-testing'
};

It is also possible to pass a bodyElement to a particular ember-tether component declaration.

Contributing

See the Contributing guide for details.

License

  • Ship Shape Tether, the underlying library that implement the actual tethering behavior
  • ember-wormhole, whose pattern for element content manipulation inspired the approach in ember-tether
  • Tetherball, for providing countless hours of entertainment over the past century