Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

@leafer-ui/data

Package Overview
Dependencies
Maintainers
1
Versions
115
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.6.2
to
1.6.3
+5
-5
package.json
{
"name": "@leafer-ui/data",
"version": "1.6.2",
"version": "1.6.3",
"description": "@leafer-ui/data",

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

"dependencies": {
"@leafer/core": "1.6.2",
"@leafer-ui/external": "1.6.2"
"@leafer/core": "1.6.3",
"@leafer-ui/external": "1.6.3"
},
"devDependencies": {
"@leafer/interface": "1.6.2",
"@leafer-ui/interface": "1.6.2"
"@leafer/interface": "1.6.3",
"@leafer-ui/interface": "1.6.3"
}
}

@@ -18,3 +18,2 @@ import { IImageData, IImageInputData, IImage, IObject, IJSONOptions } from '@leafer-ui/interface'

public __setImageFill(value: string): void {
if (this.__leaf.image) this.__leaf.image = null;
(this as IImageInputData).fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined

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

import { INumber, IValue, IBoolean, IPathCommandData, IPathString, IPointData, IPathCommandObject, IObject, IFilter } from '@leafer/interface'
import { PathConvert, LeafData, Debug } from '@leafer/core'
import { PathConvert, DataHelper, LeafData, Debug } from '@leafer/core'
import { IUI, IUIData, ILeafPaint } from '@leafer-ui/interface'
import { Paint, PaintImage } from '@leafer-ui/external'
import { Paint, PaintImage, ColorConvert } from '@leafer-ui/external'
const { parse, objectToCanvasData } = PathConvert
const { stintSet } = DataHelper, { hasTransparent } = ColorConvert
const emptyPaint: ILeafPaint = {}

@@ -40,5 +41,8 @@ const debug = Debug.get('UIData')

public __pixelFill?: boolean // png / svg / webp
public __pixelStroke?: boolean
public __isAlphaPixelFill?: boolean // png / svg / webp
public __isAlphaPixelStroke?: boolean
public __isTransparentFill?: boolean // 半透明的
public __isTransparentStroke?: boolean
public get __clipAfterFill(): boolean { const t = this as IUIData; return (t.cornerRadius || t.innerShadow || t.__pathInputed) as unknown as boolean } // 用于 __drawAfterFill()

@@ -95,15 +99,7 @@ public get __hasSurface(): boolean { const t = this as IUIData; return (t.fill || t.stroke) as unknown as boolean }

if (typeof value === 'string' || !value) {
if (this.__isFills) {
this.__removeInput('fill')
PaintImage.recycleImage('fill', this)
this.__isFills = false
this.__pixelFill && (this.__pixelFill = false)
}
stintSet(this, '__isTransparentFill', hasTransparent(value as string))
this.__isFills && this.__removePaint('fill', true)
this._fill = value
} else if (typeof value === 'object') {
this.__setInput('fill', value)
const layout = this.__leaf.__layout
layout.boxChanged || layout.boxChange()
this.__isFills = true
this._fill || (this._fill = emptyPaint)
this.__setPaint('fill', value)
}

@@ -114,15 +110,7 @@ }

if (typeof value === 'string' || !value) {
if (this.__isStrokes) {
this.__removeInput('stroke')
PaintImage.recycleImage('stroke', this)
this.__isStrokes = false
this.__pixelStroke && (this.__pixelStroke = false)
}
stintSet(this, '__isTransparentStroke', hasTransparent(value as string))
this.__isStrokes && this.__removePaint('stroke', true)
this._stroke = value
} else if (typeof value === 'object') {
this.__setInput('stroke', value)
const layout = this.__leaf.__layout
layout.boxChanged || layout.boxChange()
this.__isStrokes = true
this._stroke || (this._stroke = emptyPaint)
this.__setPaint('stroke', value)
}

@@ -163,5 +151,28 @@ }

if (stroke) Paint.compute('stroke', this.__leaf)
this.__needComputePaint = false
this.__needComputePaint = undefined
}
public __setPaint(attrName: 'fill' | 'stroke', value: IValue): void {
this.__setInput(attrName, value)
const layout = this.__leaf.__layout
layout.boxChanged || layout.boxChange()
if (value instanceof Array && !value.length) {
this.__removePaint(attrName)
} else {
if (attrName === 'fill') this.__isFills = true, this._fill || (this._fill = emptyPaint)
else this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint)
}
}
public __removePaint(attrName: 'fill' | 'stroke', removeInput?: boolean): void {
if (removeInput) this.__removeInput(attrName)
PaintImage.recycleImage(attrName, this)
if (attrName === 'fill') {
stintSet(this, '__isAlphaPixelFill', undefined)
this._fill = this.__isFills = undefined
} else {
stintSet(this, '__isAlphaPixelStroke', undefined)
this._stroke = this.__isStrokes = undefined
}
}
}

@@ -174,5 +185,5 @@

if (value.some((item: IFilter) => item.visible === false)) value = value.filter((item: IFilter) => item.visible !== false)
value.length || (value = null)
} else value = value && (value as IFilter).visible !== false ? [value] : null;
value.length || (value = undefined)
} else value = value && (value as IFilter).visible !== false ? [value] : undefined;
(data as IObject)['_' + key] = value
}

@@ -15,4 +15,6 @@ import { INumber, IPointData, IBoolean, IValue, IPathCommandData, IPathCommandObject, IPathString } from '@leafer/interface';

get __hasMultiPaint(): boolean;
__pixelFill?: boolean;
__pixelStroke?: boolean;
__isAlphaPixelFill?: boolean;
__isAlphaPixelStroke?: boolean;
__isTransparentFill?: boolean;
__isTransparentStroke?: boolean;
get __clipAfterFill(): boolean;

@@ -43,2 +45,4 @@ get __hasSurface(): boolean;

__computePaint(): void;
__setPaint(attrName: 'fill' | 'stroke', value: IValue): void;
__removePaint(attrName: 'fill' | 'stroke', removeInput?: boolean): void;
}

@@ -45,0 +49,0 @@