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

@complex-suite/plugin

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@complex-suite/plugin - npm Package Compare versions

Comparing version
5.0.14
to
5.0.15
+18
-0
history.md

@@ -0,1 +1,19 @@

<!--
版本规则:
- 顶部 `### current` 记录当前未发版的改动(可能为空)。
- 版本升级发版时,将 `current` 更替为本次发版版本号(如 `### 5.0.12`),并在其上方新建一个空的 `### current`。
- 这样每次发版后,顶部始终保留一个 `### current`(可能为空)用于记录后续改动。
-->
### current
### 5.0.15
- fix(date): `PluginDate` 构造函数 `this.data = {}` 后增加 for-in 循环为每个 parser 初始化空对象,与 `pushParse` 行为一致,避免 `$update('init')` → `_syncTargetData` 访问 undefined 报错。
- fix(layout): `PluginLayout` 构造函数 `countBody()` 改为 `countBody(true)`,通过 `else if (extraCount)` 分支触发 `$countMain(true)` 重算 extra 和 main。
- fix(date): `PluginDate.pushRule` 添加新 rule 后遍历 `$parser` 为新 rule 生成 data,getData 立即可用,无需等待下次 `$update`。
- fix(layout): `PluginLayout.destroy` 追加 `this.$life.destroy()`,清理生命周期监听器,避免 SPA 频繁创建/销毁时内存泄漏。
- refactor(plugin): `install` 移除 `if (options)` 冗余判断,options 有默认值 `{}` 永远 truthy。
- refactor(date): `_countOffset` 改用 `Math.min(...list)` 简化代码,行为一致。
- docs(layout): `PluginLayout.type` 添加 JSDoc 注释说明用途:当前布局类型标识(如 'default'无面板/'left-menu'左侧菜单/'top-header'顶部header 等),供页面快速判断布局形态。
### 5.0.11

@@ -2,0 +20,0 @@ - chore: 小版本升级,保持与套件其他子包版本同步。

+6
-7

@@ -11,10 +11,9 @@ import date, { PluginDate } from "./src/date"

const install = function(options: optionsType = {}) {
if (options) {
if (options.notice) {
notice.init(options.notice)
}
if (options.date === false) {
date.destroy()
}
// options 有默认值 {},永远为 truthy,无需判断
if (options.notice) {
notice.init(options.notice)
}
if (options.date === false) {
date.destroy()
}
}

@@ -21,0 +20,0 @@

{
"name": "@complex-suite/plugin",
"version": "5.0.14",
"version": "5.0.15",
"description": "a complex plugin",

@@ -15,3 +15,3 @@ "type": "module",

"dependencies": {
"@complex-suite/utils": "3.0.14"
"@complex-suite/utils": "3.0.15"
},

@@ -18,0 +18,0 @@ "devDependencies": {

@@ -34,2 +34,5 @@ import { _Data } from "@complex-suite/utils"

this.data = {}
for (const parseName in this.$parser) {
this.data[parseName] = {}
}
this.$timer = 0

@@ -58,14 +61,3 @@ this.$update('init')

protected _countOffset() {
let data: undefined | number
for (let n = 0; n < this.$offset.list.length; n++) {
if (data === undefined) {
data = this.$offset.list[n]
} else if (data > this.$offset.list[n]) {
data = this.$offset.list[n]
}
}
if (data === undefined) {
data = defaultOffset
}
this.$offset.value = data
this.$offset.value = this.$offset.list.length > 0 ? Math.min(...this.$offset.list) : defaultOffset
}

@@ -99,2 +91,6 @@ getValue(prop = 'current') {

this._syncTargetValue(ruleName)
// 同步 data:为新 rule 在所有 parser 下生成对应数据,避免 getData 返回 undefined
for (const parseName in this.$parser) {
this.data[parseName][ruleName] = this.$parser[parseName](this.value[ruleName]!)
}
}

@@ -101,0 +97,0 @@ }

@@ -124,2 +124,11 @@ import { _Data, Life, throttle } from "@complex-suite/utils"

class PluginLayout extends DefaultLayout {
/**
* 当前布局类型标识,用于页面快速判断当前布局形态以决定渲染逻辑
* 默认值 'default' 表示无额外布局面板(仅展示页面主体)
* 可选值由业务层自行约定,例如:
* - 'default':无侧边栏/顶部栏,仅展示页面
* - 'left-menu':左侧菜单 + 页面主体
* - 'top-header':顶部 header + 页面主体
* - 'left-menu-top-header':左侧菜单 + 顶部 header + 页面主体
*/
type: string

@@ -146,3 +155,3 @@ body: PluginLayoutData

}
this.countBody()
this.countBody(true)
this.func = throttle(() => {

@@ -197,2 +206,4 @@ this.countBody()

window.removeEventListener('resize', this.func)
// 清理生命周期监听器,避免 SPA 频繁创建/销毁时内存泄漏
this.$life.destroy()
}

@@ -199,0 +210,0 @@ }