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

duice

v0.2.1

Published

DUICE(Data-oriented javascript UI Component Element)

Downloads

391

Readme

DUICE (Data-binding UI Component Element)

Conception

1. MVC Auto-Binding (between Data Structure and HTML DOM Element)

By using the Object and Array, bidirectional binding processing is performed with HTML DOM Element in charge of presentation of the screen. (It's implemented by Internally it is Proxy and Observer Pattern) When changing the data of Object and Array, the value of the UI DOM element binding was also automatically changed. Conversely, if the user changes the value of the UI DOM Element, the binding Object and Array is automatically changed.

2. Reducing Learning Curve (Only simple HTML and javascript)

If you know only basic HTML format and Javascript, configure it to be able to operate.

3. Pure Javascript Prototype (No Dependency, No Conflict)

This library is developted by just pure javascript. It is oriented towards minimal code, no-dependency and no-conflict. Therefore you can use it with another javascript library together.


Git and Website

Demo Site

References


Object Element

Javascript

const user = new duice.ObjectProxy({
    id: 'apple',
    name: 'Apple'
});

HTML

| attribute | description | |:-------------------------------------------|:-----------------------------------------------------| | data-duice-bind="[object]" | Object name to bind | | data-duice-property="[property of object]" | Object Property name to bind | | data-duice-script="[script code]" | javascript code to execute when element is updated | | data-duice-format="[data format clause]" | ex) string('###-###'), number(2), date('yyyy-MM-dd') |

<span data-duice-bind="user" data-duice-property="id"></span>
<input type="text" data-duice-bind="user" data-duice-property="name"/>

Test Case

Object Element Test


Array Element

Javascript

const users = new duice.ArrayProxy([
    {id: 'apple', name: 'Apple'},
    {id: 'monkey', name: 'Monkey'},
    {id: 'orange', name: 'Orange'}
]);

HTML

| attribute | description | |:-----------------------------------------------|:-----------------------------------------| | data-duice-bind="[array]" | Object name to bind | | data-duice-loop="[element name],[status name]" | element object and status variable name | | data-duice-script="[script code]" | javascript code to execute when element is updated |

<table>
    <tr>
        <th>no</th>
        <th>name</th>
        <th>name</th>
    </tr>
    <tr data-duice-bind="users" data-duice-loop="user,status">
        <td data-duice-bind="status" data-duice-property="count"></td>
        <td data-duice-bind="user" data-duice-property="id"></td>
        <td><input type="text" data-duice-bind="user" data-duice-property="name"/></td>
    </tr>
</table>

Test Case

Array Element Test


Dialog(alert,confirm,prompt,custom dialog)

Javascript

// await style
async function confirmAwait() {
    if(await duice.confirm('<b>Hello~</b>\nThis is confirm message!\nYes or No?')){
        alert(true);
    }else{
        alert(false);
    }
}

// then style
async function confirmThen() {
    duice.confirm('<b>Hello~</b>\nThis is confirm message!\nYes or No?').then((result) =>{
        if(result) {
            alert(true);
        }else{
            alert(false);
        }
    });
}

// custom dialog from HTML Dialog Element
async function openDialog() {
    duice.openDialog(document.getElementById('myDialog')).then(()=>{
        alert('do next');
    });
}

HTML

<dialog id="myDialog">
    <pre>
        Custom Dialog
    </pre>
</dialog>

Test Case

Dialog/Alert/Confirm/Prompt Test


License

LICENSE

Contact