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

renji-ui

v0.0.6

Published

renji-ui 是一套Web Components组件库。

Downloads

15

Readme

renji-ui 是一个Web Components 组件库。

组件

已更新组件:标签页窗口组件

预览

http://renji-ui.shadowroot.host

快速上手

html

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link href="/libs/bootstrap/version/bootstrap-5.3.2-dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="/libs/bootstrap-icons/version/1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
    <style type="text/css">
        renji-tabs-window{position:absolute;}
        renji-tabs-window>.tab-content{height:100%;}
    </style>    
</head>
<body>

    <div id="renji-tabs-window-content-001" style="display: none;">
      <div class="d-flex w-100 h-100">
        <button class="btn btn-outline-primary">111</button>
      </div>
    </div>

    <div id="renji-tabs-window-content-002" style="display: none;">
      <div class="d-flex w-100 h-100">
        <button class="btn btn-outline-primary">222</button>
      </div>
    </div>

    <div id="renji-tabs-window-content-003" style="display: none;">
      <div class="d-flex w-100 h-100">
        <button class="btn btn-outline-primary">333</button>
      </div>
    </div>

    <renji-tabs-window>
        <div class="tab-content" slot="tab-content">
            <div for="renji-tabs-window-content-001">demo1</div>
            <div for="renji-tabs-window-content-002">demo2</div>
        </div>
    </renji-tabs-window>

    <renji-tabs-window>
        <div class="tab-content" slot="tab-content">
            <div for="renji-tabs-window-content-003">demo3</div>
        </div>
    </renji-tabs-window>
    <script type="module" src="./test.js"></script>
</body>
</html>

js

import { registerAll, mergeWindow } from "../dist/index.esm.min.js";
registerAll();

const shadowHost1 = document.querySelector("renji-tabs-window");
const shadowHost2 = shadowHost1.nextElementSibling;

shadowHost2.style.left = window.innerWidth / 4 + 'px';
shadowHost2.style.top = window.innerHeight / 4 + 'px';


// 小工具按钮的图标字体
shadowHost1.addFont(
  "/libs/bootstrap-icons/version/1.11.3/font/bootstrap-icons.min.css"
);

// 添加按钮工具
// shadowHost1.addRightTool({ iconImg: "/img/demo.png" }, (ev) => {
//   alert(1);
// });
shadowHost1.addRightTool({ icon: "bi-pc-display" }, (ev) => {
  alert(1);
});
shadowHost1.addRightTool({ icon: "bi-tablet" }, (ev) => {
  alert(2);
});
shadowHost1.addRightTool({ icon: "bi-phone" }, (ev) => {
  alert(3);
});


/**
 * 多个窗口合并
 * 虽然默认支持同时创建多个标签页,但还是建议只创建一个,
 * 然后通过窗口合并来实现首次创建多个标签页。
 */
// mergeWindow(shadowHost1, shadowHost2)

VUE

main.ts

import { registerAll } from 'renji-ui';
registerAll();

demo-component.ts

// 下一个版本将在支持下面写法基础上,优化更简单的写法。
const domid = 'renji-tabs-window-content-' + count;
const content = ref(null) as any;
onMounted(async ()=>{
  const win = document.createElement('renji-tabs-window');
  win.style.cssText = 'position:absolute;';
  win.innerHTML = `<div slot="tab-content"><div for="${domid}">${props.title}</div></div>`;
  content.value.after(win);
})

<template>
  <div :id="domid" ref="content" style="display: none;">
    <slot></slot>
  </div>
</template>