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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@imckl/electron-element-plus-ui

v0.0.2

Published

Electron + Element Plus 应用的 UI 组件库

Readme

@imckl/electron-element-plus-ui

Electron + Element Plus 应用的 UI 组件库。

特性

  • 开箱即用:提供标准的 Electron 应用布局
  • 三栏布局:Header + Sidebar + Main 结构
  • Tab 页管理:内置 Tab 页容器、右键菜单、重命名对话框
  • 配置式菜单:通过 menuItems 配置侧边栏菜单
  • 可折叠侧边栏:支持展开/折叠
  • 跨进程支持:提供 main、preload、renderer 三进程入口
  • TypeScript:完整的类型支持

安装

npm install @imckl/electron-element-plus-ui

快速开始

1. 主进程配置

// src/main/index.ts
import { setupTabContextMenu, setupAboutDialog, showAboutDialog } from '@imckl/electron-element-plus-ui/main'

// 创建窗口后调用
setupTabContextMenu(mainWindow)
setupAboutDialog(mainWindow)

// 菜单项(可选)
{ label: '关于', click: () => showAboutDialog(mainWindow) }

2. 预加载脚本配置

// src/preload/index.ts
import { exposeLayoutApi } from '@imckl/electron-element-plus-ui/preload'

// 暴露 API 到渲染进程
exposeLayoutApi()

3. 类型声明

// src/env.d.ts
import type { ElectronLayoutApi } from '@imckl/electron-element-plus-ui'

declare global {
  interface Window {
    electronLayoutApi: ElectronLayoutApi
  }
}

4. 渲染进程使用

// src/renderer/index.ts
import '@imckl/electron-element-plus-ui/dist/style.css'

参考 Layout 模块文档。

模块文档

  • Layout 模块 - ElectronLayout 组件 + useTabManager
  • About 模块 - 关于对话框(useAboutDialog / ElectronAboutDialog)

开发

# 跳过下载 Electron binary(构建时不需要)
ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm install
npm run build

注意事项

electron-vite 配置

Electron preload 运行在沙盒环境,无法直接 require 第三方包。使用 electron-vite 时需要配置将本包打包进 preload:

// electron.vite.config.ts
export default defineConfig({
  preload: {
    build: {
      externalizeDeps: {
        exclude: ['@imckl/electron-element-plus-ui'],
      },
    },
  },
})

Preload 安全性

本库的 preload 入口设计遵循 Electron 安全最佳实践:

  • ✅ 只包含 contextBridge 和 ipcRenderer 调用
  • ✅ 只依赖纯常量和类型定义
  • ❌ 不引入渲染进程代码(Vue 组件等)
  • ❌ 不暴露危险的 Node.js API(fs、child_process 等)
  • ❌ 不引入大型依赖库

License

MIT