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

@composy/portal-core

v0.0.1

Published

企业门户编辑器 - Portal editor with drag-and-drop widget layout

Readme

@composy/portal-core

企业门户编辑器核心模块 - 门户页面可视化搭建与展示

功能特性

  • 可视化门户页面编辑器(拖拽搭建、栅格布局、组件调整)
  • 丰富的内置组件(待办、公告、日程、快捷入口、数据卡片、图表、嵌入、时钟)
  • 主题切换(亮色/暗色)与 LDesign token 集成
  • 支持自定义 Widget 注册
  • 响应式布局与碰撞检测

安装

pnpm add @composy/portal-core

快速开始

import { createPortalEditor } from '@composy/portal-core'

const editor = createPortalEditor({
  container: '#portal-editor',
  layout: {
    columns: 12,
    rowGap: 16,
    colGap: 16,
    items: [],
  },
  theme: 'light',
})

editor.on('change', (layout) => {
  console.log('布局变化:', layout)
})

editor.addWidget('chart')

Vue 使用

<template>
  <LDesignPortalEditor v-model="layout" theme="light" />
</template>

<script setup>
import { ref } from 'vue'
import { LDesignPortalEditor } from '@composy/portal-vue'

const layout = ref(null)
</script>

Class 命名规范

所有 DOM class 使用 ldesign-portal-* 前缀,遵循 BEM 风格:

| Class | 说明 | |-------|------| | ldesign-portal-editor | 编辑器根 | | ldesign-portal__sidebar | 侧边栏 | | ldesign-portal__widget | Widget 卡片 | | ldesign-portal__widget--selected | 选中状态 | | ldesign-portal--disabled | 禁用状态 |

CSS 变量

组件使用 --ldesign-portal-* CSS 变量,默认值引用 LDesign color/size token:

--ldesign-portal-color-primary: var(--ld-primary-600);
--ldesign-portal-bg-page: var(--ld-bg-page);
--ldesign-portal-border-color: var(--ld-border);
--ldesign-portal-text-primary: var(--ld-text-primary);
--ldesign-portal-radius-lg: var(--ld-radius-lg, 10px);
--ldesign-portal-spacing-md: var(--ld-size-4, 16px);

Style 加载

// 使用默认主题
import '@composy/portal-core/dist/style.css'

构建产物

| 目录 | 说明 | |------|------| | dist/ | UMD 格式(含 min.js) | | es/ | ESM 格式 | | esm/ | ESM 格式(preserveModules) | | lib/ | CJS 格式 |

API

createPortalEditor

createPortalEditor(config: PortalEditorConfig): PortalEditorInstance

PortalEditorInstance

  • getLayout() / setLayout(layout) — 布局读写
  • addWidget(type, position?, size?, data?) — 添加 Widget
  • removeWidget(id) / select(id) — 删除/选中 Widget
  • setTheme(theme) / setDisabled(disabled) — 主题/禁用
  • exportLayout() / importLayout(json) — 导入导出
  • on(event, handler) / destroy() — 事件/销毁

内置 Widget

| 类型 | 说明 | 默认尺寸 | |------|------|----------| | todo | 我的待办 | 4x3 | | announcement | 公告通知 | 4x3 | | calendar | 今日日程 | 4x3 | | shortcuts | 快捷入口 | 4x3 | | dataCard | 数据卡片 | 4x3 | | chart | 趋势图表 | 6x3 | | iframe | 外部嵌入 | 6x4 | | clock | 时钟 | 3x2 |

验证

pnpm --dir libraries/portal/packages/core run type-check
pnpm --dir libraries/portal/packages/core run build
node libraries/portal/scripts/check-package-outputs.mjs all

License

MIT