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

ns-rivets

v0.0.1

Published

Rivets adapter for Noscript MVC framework

Downloads

3

Readme

Адаптер Rivets.js для Noscript

Полная перерисовка HTML-нод у видов убивает анимацию и может быть излишней при незначительных изменениях моделей. Например, когда нужно переставить класс при смене определенного состояния или изменить текст в одной из внутренних нод.

Это подход к решению обеих проблем за счет использования DOM-шаблонизации, используемой в том или ином виде во фреймворках Knockout и Angular. В качестве движка DOM-шаблонизации используется микробиблиотека Rivets.js.

ns.ViewRivets

Вид, который будет использовать на DOM-шаблонизацию, должен указать ns.ViewRivets в качестве базового класса: [TODO: Про инвалидацию вида]

ns.View.define('order', {
    models: ['order'],
}, ns.ViewRivets);

Yate-шаблон:

match .order ns-view-content {
    <div class="order" rv-class-order_complete="models.order:complete">
        // rv-атрибут выше примерно соотносится с традиционной записью
        //
        //     if models.order.complete {
        //         @class += " order_complete"
        //     }

        <span class="order__assignee">
            '{{ models.order:assignee }}'
        </span>

        // ... Ниже много другого, нечасто меняющегося, HTML
    </div>
}

Доступные binder-ы

Для подписки на изменение атрибутов модели используется binder :. Ниже, например, происходит скрытие или показ блока в зависимости от значения .deleted на модели message:

<div rv-hide="models.message:deleted"></div>

Для подписки на изменение содержимого модели-коллекции можно использовать binder *. Это удобно, например, для динамической отрисовки списков:

<div class="todos">
    <div class="todo" rv-each-todo="models.todos*">
        <input type="checkbox" rv-checked="todo:complete" />
        '{{ todo:title }}'
    </div>
</div>

Более подробно можно посмотреть в примере, вид view-messages.js.

Просмотр примеров использования

Склонируйте репозиторий, перейдите в его корень и выполните:

npm install && npm run examples

После запуска сервера перейдите по http://localhost:8181/examples/ в браузере.