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-showcase

v0.2.0

Published

A set of primitives to showcae interactive code samples

Downloads

10

Readme

ember-showcase CI

A set of primitives to showcase interactive code examples

le demonstration a la gif

Compatibility

  • Ember.js v3.16 or above
  • Ember CLI v2.13 or above
  • Node.js v10 or above

Installation

ember install ember-showcase

Usage

ember-showcase is an addon that provides you with component abstractions that you can build upon to showcase interactive code-samples in your applications.

This can be useful for documenting an addon, a styleguide or when writing a blog.

ember-showcase comes with no styling. As it is meant as a base for your own abstraction on top of it you can style it as you see fit. The follwing guide walks you through the existing components in ember-showcase and how you could create your own component abstraction on top of it.

Components

Showcase

The Showcase-component is a provider component that yields out everything you need to build your own interactive code sample component.

Showcase yields a nested hash that holds the following properties:

  • ui - a set of declarative components
    • useSnippet - a component that you use to register snippets to the Showcase
    • snippet - a component that renders a code snippet
  • state - state of the Showcase you can use to build your own code sample abstraction
    • activeSnippet - the currently active code snippet of all all the registered snippets. By default this will be the first registered snippet
    • snippets - all the registered snippets on the Showcase
  • actions - a set of actions you can trigger on the Showcase
    • registerSnippet - an action to register a code snippet on the Showcase
    • activateSnippet - an action to switch out the currently active snippet

Example

In this example we will walk you through creating your own Demo-component that is based on ember-showcase. Demo will be able to show an interactive code sample - i.e. an ui that shows the code to demo in action. You will also be able to attach an optional set of code-snippets (based on ember-code-snippet) that you can toggle between to show other developers how the component you are demoing will be used in code.

Here's how you will be able to use it:

<Demo as |demo|>
  <div>
    Hello world!
  </div>
  <demo.ui.useSnippet @name="demo-usage.md" @title="template.hbs" @language="html" />
</Demo>

And here's how you would use ember-showcase to implement Demo:

<Showcase as |showcase|>
  <div>
    {{#each showcase.state.snippets as |snippet|}}
      <button
        type="button"
        {{on "click" (fn showcase.actions.activateSnippet snippet)}}
      >
        {{snippet.title}}
      </button>
    {{/each}}
  </div>
  <div>
    {{yield (hash
      ui=(hash
        useSnippet=showcase.ui.useSnippet
      )
    )}}
  </div>
  {{#if showcase.state.activeSnippet}}
    <showcase.ui.snippet
      @name={{showcase.state.activeSnippet.name}}
      @language={{showcase.state.activeSnippet.language}}
    />
  {{/if}}
</Showcase>

Bundled addons

ember-showcase bundles some addons to provide its functionality.

If you need to customize code-snippet or code-highlighting functionality please have a look at the documentation of both addons.

Contributing

See the Contributing guide for details.

License

This project is developed by effective-ember and contributors. It is licensed under the MIT License.