You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@leafer-ui/data

Package Overview
Dependencies
Maintainers
1
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leafer-ui/data - npm Package Compare versions

Comparing version
1.5.3
to
1.6.0
+5
-5
package.json
{
"name": "@leafer-ui/data",
"version": "1.5.3",
"version": "1.6.0",
"description": "@leafer-ui/data",

@@ -25,9 +25,9 @@ "author": "Chao (Leafer) Wan",

"dependencies": {
"@leafer/core": "1.5.3",
"@leafer-ui/external": "1.5.3"
"@leafer/core": "1.6.0",
"@leafer-ui/external": "1.6.0"
},
"devDependencies": {
"@leafer/interface": "1.5.3",
"@leafer-ui/interface": "1.5.3"
"@leafer/interface": "1.6.0",
"@leafer-ui/interface": "1.6.0"
}
}

@@ -1,3 +0,5 @@

import { IFontWeight, ITextData } from '@leafer-ui/interface'
import { UICreator } from '@leafer/core'
import { IFontWeight, ITextData, IUI, IText, IObject, IBackgroundBoxStyle } from '@leafer-ui/interface'
import { UIData } from "./UIData"

@@ -23,2 +25,3 @@

protected _fontWeight?: number
protected _boxStyle?: IBackgroundBoxStyle

@@ -35,2 +38,28 @@ setFontWeight(value: IFontWeight): void {

setBoxStyle(value: IUI) {
let t = this.__leaf as IText, box = t.__box
if (value) {
const { boxStyle } = this as ITextData
if (box) for (let key in boxStyle) (box as IObject)[key] = undefined
else box = t.__box = UICreator.get('Rect', 0 as any) as IUI // 传递 0 可以优化内存占用
const layout = t.__layout, boxLayout = box.__layout
if (!boxStyle) box.parent = t as any, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds
box.set(value)
if (boxLayout.strokeChanged) layout.strokeChange()
if (boxLayout.renderChanged) layout.renderChange()
box.__updateChange()
} else if (box) {
t.__box = box.parent = null
box.destroy()
}
this._boxStyle = value
}
}

@@ -33,2 +33,3 @@ import { INumber, IValue, IBoolean, IPathCommandData, IPathString, IPointData, IPathCommandObject, IObject, IFilter } from '@leafer/interface'

public get __hasStroke(): boolean { return (this as IUIData).stroke && (this as IUIData).strokeWidth as unknown as boolean }
public get __hasHalf(): number { const t = this as IUIData; return (t.stroke && t.strokeAlign === 'center' && t.strokeWidth % 2) || undefined }
public get __hasMultiPaint(): boolean { // fix: opacity

@@ -98,3 +99,3 @@ const t = this as IUIData

this.__isFills = false
if (this.__pixelFill) this.__pixelFill = false
this.__pixelFill && (this.__pixelFill = false)
}

@@ -104,3 +105,4 @@ this._fill = value

this.__setInput('fill', value)
this.__leaf.__layout.boxChanged || this.__leaf.__layout.boxChange()
const layout = this.__leaf.__layout
layout.boxChanged || layout.boxChange()
this.__isFills = true

@@ -117,3 +119,3 @@ this._fill || (this._fill = emptyPaint)

this.__isStrokes = false
if (this.__pixelStroke) this.__pixelStroke = false
this.__pixelStroke && (this.__pixelStroke = false)
}

@@ -123,3 +125,4 @@ this._stroke = value

this.__setInput('stroke', value)
this.__leaf.__layout.boxChanged || this.__leaf.__layout.boxChange()
const layout = this.__leaf.__layout
layout.boxChanged || layout.boxChange()
this.__isStrokes = true

@@ -126,0 +129,0 @@ this._stroke || (this._stroke = emptyPaint)

import { INumber, IPointData, IBoolean, IValue, IPathCommandData, IPathCommandObject, IPathString } from '@leafer/interface';
import { LeafData } from '@leafer/core';
import { IUIData, IUI, IGroupData, IBoxData, ILeaferData, IObject, IJSONOptions, IFrameData, ILineData, IRectData, IEllipseData, IPolygonData, IStarData, IPathData, IPenData, ITextData, IFontWeight, IImageData, IImage, ICanvasData } from '@leafer-ui/interface';
import { IUIData, IUI, IGroupData, IBoxData, ILeaferData, IObject, IJSONOptions, IFrameData, ILineData, IRectData, IEllipseData, IPolygonData, IStarData, IPathData, IPenData, ITextData, IBackgroundBoxStyle, IFontWeight, IImageData, IImage, ICanvasData } from '@leafer-ui/interface';

@@ -13,2 +13,3 @@ declare class UIData extends LeafData implements IUIData {

get __hasStroke(): boolean;
get __hasHalf(): number;
get __hasMultiPaint(): boolean;

@@ -87,3 +88,5 @@ __pixelFill?: boolean;

protected _fontWeight?: number;
protected _boxStyle?: IBackgroundBoxStyle;
setFontWeight(value: IFontWeight): void;
setBoxStyle(value: IUI): void;
}

@@ -90,0 +93,0 @@