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-cli-happy-splitter

v0.5.2

Published

Ember componet for split panel that works without CSP violations

Downloads

78

Readme

Build Status npm version

ember-cli-happy-splitter

Ember component that implements a split panel (AKA split view, split container). It tries to have very little opinion about the container and the nested views.

Why is it happy? Because there are no content security policy violations! ☺

Installation

Via Ember CLI:

ember install ember-cli-happy-splitter

Available Options

  • isVertical - boolean flag to create vertical (true) or horizontal (false) split views; set on the happy-split-container
  • splitterWidth - the width of the splitter in pixels; set on the happy-split-container
  • splitPercentage - the percentage of each happy-split-view; you are responsible for ensuring they total 100
  • minimumPercentage - the minimum splitPercentage of each happy-split-view; defaults to 10%

CSS rules

Override the following CSS rules to customize the appearance of this component:

  • .happy-split-container - the container that holders the views and splitter bars; 100% width and height by default
  • .happy-split-view - the views within the split container; no default rule provided
  • .happy-splitter - the splitter bar when the user is not interacting with it
  • .happy-splitter:hover - the splitter bar when the user is hovering over it; no default rule provided
  • .happy-splitter.dragging - the splitter bar when the user is dragging it
  • .happy-splitter.vertical, .happy-split-container.vertical.dragging - change the cursor definition here for vertically split containers
  • .happy-splitter.horizontal, .happy-split-container.horizontal.dragging - change the cursor definition here for horizontally split containers
  • .happy-splitter-thumb - the thumb within the splitter bar; no styling by default, refer to splitter-thumb.scss for an example

Usage

This is a simple vertical splitter configuration. Note the use of the handlebars whitespace control character ('~') on both sides of the happy-splitter-bar. The happy-split-container uses a simple inline-block layout. When using a vertical splitter, browsers will interpret the line breaks as meaningful syntax. The whitespace control character removes these line breaks. This is only required for vertical splitters.

{{#happy-split-container}}
  {{#happy-split-view}}
    <h2>hello from left panel!</h2>
  {{/happy-split-view}}
  {{~ happy-splitter-bar ~}}
  {{#happy-split-view}}
    <h2>hello from right panel!</h2>
  {{/happy-split-view}}
{{/happy-split-container}}

Examples

Vertical Splitter

{{#happy-split-container isVertical=true}}
  {{#happy-split-view}}
    <h2>hello from left panel!</h2>
  {{/happy-split-view}}
  {{~ happy-splitter-bar ~}}
  {{#happy-split-view}}
    <h2>hello from right panel!</h2>
  {{/happy-split-view}}
{{/happy-split-container}}

The isVertical variable defaults to true and is optional in this scenario.

Horizontal Splitter

{{#happy-split-container isVertical=false}}
  {{#happy-split-view}}
    <h2>hello from top panel!</h2>
  {{/happy-split-view}}
  {{happy-splitter-bar}}
  {{#happy-split-view}}
    <h2>hello from bottom panel!</h2>
  {{/happy-split-view}}
{{/happy-split-container}}

Customizing Splitter Width

{{#happy-split-container isVertical=true splitterWidth=10}}
  {{#happy-split-view}}
    <h2>hello from left panel!</h2>
  {{/happy-split-view}}
  {{~ happy-splitter-bar ~}}
  {{#happy-split-view}}
    <h2>hello from right panel!</h2>
  {{/happy-split-view}}
{{/happy-split-container}}

This will create a splitter 10px wide.

Customizing Split Amounts

{{#happy-split-container isVertical=true}}
  {{#happy-split-view splitPercentage=25}}
    <h2>hello from left panel!</h2>
  {{/happy-split-view}}
  {{~ happy-splitter-bar ~}}
  {{#happy-split-view}}
    <h2>hello from right panel!</h2>
  {{/happy-split-view}}
{{/happy-split-container}}

Annotate each panel with the desired split percentage. Percentages need to add up to 100.

To Do

  • Add more example templates to the dummy app
  • Handle more than 2 panels in a container
  • Validate split percentages add up to 100
  • Validate minimumPercentage >= 0

License

MIT license