🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

complex-plugin

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

complex-plugin - npm Package Compare versions

Comparing version
4.9.3
to
4.10.1
+80
README.md
# Complex Plugin
这是一个功能强大的复杂插件,旨在提供高度可扩展的布局管理、日期处理和通知功能。
## 特性
- **布局管理 (`PluginLayout`)**:
- 动态安装和卸载布局模块。
- 自动计算主内容区域和附加区域的尺寸。
- 响应式的生命周期事件 (`install`, `extra`, `main`, `body`, `change`)。
- **日期管理 (`PluginDate`)**:
- 统一的日期实例,自动更新当前时间。
- 可自定义的日期解析规则和格式化函数。
- 高效的定时器管理,可动态调整更新频率。
- **通知系统 (`notice`)**:
- 异步初始化,确保在UI库加载完成后再执行通知。
- 提供 `message`, `alert`, `confirm` 等标准通知方法。
- 内置 `debugConfirm`,用于在开发模式下进行安全的操作确认。
## 安装
```bash
npm install complex-plugin
```
## 使用
### 布局管理
```typescript
import { PluginLayout } from 'complex-plugin';
const layout = new PluginLayout({
header: { height: 60 },
footer: { height: 50 },
sidebar: { width: 200 }
});
layout.onLife('main', () => {
console.log('Main area size changed:', layout.main.width, layout.main.height);
});
```
### 日期管理
```typescript
import { date } from 'complex-plugin';
// 获取预定义的“今天”
const today = date.getValue('today');
// 添加自定义解析规则
date.pushRule('lastYear', (current) => {
return new Date(current.getFullYear() - 1, current.getMonth(), current.getDate());
});
const lastYear = date.getValue('lastYear');
```
### 通知系统
```typescript
import { notice } from 'complex-plugin';
// 假设您使用的是 Ant Design Vue
import { message, Modal } from 'ant-design-vue';
notice.init({
message: message.info,
alert: Modal.info,
confirm: Modal.confirm
});
// 现在,您可以在项目的任何地方调用 notice
notice.message('操作成功!');
```
## 依赖
- [complex-utils](https://github.com/MarAngle/complex-utils): 提供核心的工具函数和基类。
import { describe, it, expect } from 'vitest'
import date from './date'
describe('date', () => {
it('should be an instance of PluginDate', () => {
expect(date.constructor.name).toBe('PluginDate')
})
it('should have a today value', () => {
expect(date.getValue('today')).toBeInstanceOf(Date)
})
it('should have a tomorrow value', () => {
expect(date.getValue('tomorrow')).toBeInstanceOf(Date)
})
})
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
globals: true,
environment: 'jsdom',
include: ['src/**/*.test.ts'],
},
})
+41
-44

@@ -1,78 +0,75 @@

### ToDo
### 4.10.1
- refactor(build): 移除项目的所有构建配置,回归到纯源码模式。
- fix(deps): 修正 `complex-utils` 的版本依赖,并修复类型定义不匹配的编译错误。
- feat(test): 集成 `Vitest` 单元测试框架。
- docs(readme): 创建详细的 `README.md` 文件。
### 4.9.2/3
- feat:PluginLayoutData添加visible属性及相关逻辑
### 4.9.3
- feat(layout): `PluginLayoutData` 添加 `visible` 属性及相关显示/隐藏逻辑。
### 4.9.1
- feat:修改模块加载逻辑为ES2020
- feat(module): 修改模块加载逻辑为 ES2020。
### 4.8.2
- fix:修正layout监控window的resize事件的判断逻辑为delay,避免布局数据错误的BUG
- fix(layout): 修正 `resize` 事件的监听逻辑为 `delay` 模式,避免布局数据错误。
- refactor(code): 基于 AI 进行全局代码优化。
### 4.8.2
- 基于AI优化代码
### 4.8.1
- 稳定版升级
- chore: 稳定版升级。
### 4.6.10
- 升级utils依赖
- chore(deps): 升级 `complex-utils` 依赖。
### 4.6.8
- 升级utils依赖,适配新版Wait
- chore(deps): 升级 `complex-utils` 依赖,适配新版 `Wait` 类。
### 4.6.4/5/6/7
- 升级utils依赖
- notice添加debugConfirm函数
### 4.6.7
- chore(deps): 升级 `complex-utils` 依赖。
- feat(notice): 添加 `debugConfirm` 函数,用于开发模式下的安全确认。
### 4.6.1/2/3
- 升级utils依赖
- 双数稳定版
### 4.6.3
- chore(deps): 升级 `complex-utils` 依赖。
- chore: 双数稳定版更新。
### 4.3.10
- 升级utils依赖,优化Wait逻辑
- chore(deps): 升级 `complex-utils` 依赖,优化 `Wait` 逻辑。
### 4.3.3/4/5/6/7/8/9
- 升级依赖,优化类型
- 优化notice类型和加载逻辑,实现加载前的函数调用在加载后触发
- notice.showMsg => notice.message
- noticeMsgTye => messageType
### 4.3.9
- refactor(notice): 优化 `notice` 的类型和加载逻辑,实现异步初始化。
- refactor(notice)!: **[非兼容性更新]** `notice.showMsg` 重命名为 `notice.message`。
### 4.3.1/2
- 重构Layout
### 4.3.2
- refactor(layout): 重构 `PluginLayout` 模块。
### 4.2.9/10
- plugin的触发事件由recount跟改为resize
### 4.2.10
- refactor(layout): 将布局的触发事件由 `recount` 更改为 `resize`。
### 4.2.8
- 优化undefined校验
- refactor(code): 优化全局的 `undefined` 校验逻辑。
### 4.2.5/6
- 升级依赖,优化代码
### 4.2.6
- chore(deps): 升级依赖并优化代码。
### 4.2.0/1/2/3/4
- 升级依赖,优化代码
### 4.1.6
- refactor(layout)!: **[非兼容性更新]** `layout` 实例通过页面生成并通过 `provide` 传递。
### 4.1.5/6
- 重要非兼容:layout通过页面生成并通过provide传递
### 4.1.4
- refactor(layout): 优化 `PluginLayout` 模块。
### 4.1.3/4
- 优化layout
### 4.1.2
- 优化date
- refactor(date): 优化 `PluginDate` 模块。
### 4.1.1
- 升级依赖,优化类型
- chore(deps): 升级依赖并优化类型定义。
### 4.1.0
- 优化函数命名规则:外部函数以字母开头,内部函数以$开头,私有函数以_开头
- refactor(code): 统一函数命名规则 (外部函数、内部函数、私有函数)。
### 4.0.3
- 升级依赖,适配formatConfig
- chore(deps): 升级依赖,适配 `formatConfig`。
### 4.0.1/2
- 升级依赖,优化layout生命周期类型
### 4.0.2
- refactor(layout): 优化 `layout` 的生命周期类型。
### 4.0.0
- 简化逻辑,实现基本的功能
- feat: 项目初始化,实现布局、日期和通知等核心功能。
{
"name": "complex-plugin",
"version": "4.9.3",
"version": "4.10.1",
"description": "a complex plugin",

@@ -12,9 +12,13 @@ "type": "module",

"dependencies": {
"complex-utils": "2.9.2 - 2.9.99"
"complex-utils": "2.10.2 - 2.10.99"
},
"devDependencies": {
"typescript": "^5.2.2"
"jsdom": "^27.1.0",
"typescript": "^5.2.2",
"vitest": "^4.0.7"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"check": "tsc --noEmit",
"test": "vitest",
"coverage": "vitest run --coverage"
},

@@ -21,0 +25,0 @@ "keywords": [

import { _Data, Life, throttle } from "complex-utils"
import { DataWithLife } from "complex-utils/src/class/Life"
import type { DataWithLife } from "complex-utils/src/class/Life"

@@ -4,0 +4,0 @@ class DefaultLayout extends _Data implements DataWithLife {