Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@mastergo/plugin-utils

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

@mastergo/plugin-utils - npm Package Compare versions

Comparing version
0.2.0
to
0.3.0
+8
-0
CHANGELOG.md

@@ -0,1 +1,9 @@

# [0.3.0](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.29.0...v0.3.0) (2022-07-08)
# [0.3.0](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.29.0...v0.3.0) (2022-07-08)
# [0.2.0](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.28.0...v0.2.0) (2022-07-01)

@@ -2,0 +10,0 @@

+56
-3

@@ -85,2 +85,4 @@ declare function hexToRGBA(hex: string): RGBA;

showGrid(show: boolean): void
group(children: ReadonlyArray<SceneNode>): GroupNode

@@ -101,2 +103,3 @@ union(children: ReadonlyArray<SceneNode>): BooleanOperationNode

createTextStyle(config: CreateStyleConfig): TextStyle
createGridStyle(config: CreateStyleConfig): GridStyle

@@ -178,3 +181,3 @@ listAvailableFontsAsync(): Promise<Font[]>

type StyleType = 'PAINT' | 'TEXT' | 'EFFECT'
type StyleType = 'PAINT' | 'TEXT' | 'EFFECT' | 'GRID'

@@ -185,2 +188,3 @@ interface BaseStyle extends PublishableMixin {

name: string
remove(): void
}

@@ -226,4 +230,9 @@

}
interface GridStyle extends BaseStyle {
type: 'GRID'
layoutGrids: ReadonlyArray<LayoutGrid>
}
type Style = PaintStyle | EffectStyle | TextStyle
type Style = PaintStyle | EffectStyle | TextStyle | GridStyle

@@ -282,3 +291,3 @@ /// /////////////////////////////////////////////////////////////////////////////

// 待确认
type ConstraintType = 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'SCALE'
type ConstraintType = 'START' | 'END' | 'STARTANDEND' | 'CENTER' | 'SCALE'

@@ -492,2 +501,9 @@ interface Constraints {

interface RectangleStrokeWeightMixin {
strokeTopWeight: number
strokeLeftWeight: number
strokeBottomWeight: number
strokeRightWeight: number
}
interface CornerMixin {

@@ -511,2 +527,3 @@ // 待确认

ChildrenMixin,
RectangleStrokeWeightMixin,
RectangleCornerMixin,

@@ -531,4 +548,36 @@ BlendMixin,

}
export interface RowsColsLayoutGrid {
readonly gridType: "ROWS" | "COLUMNS"
readonly alignment: "LEFT" | "RIGHT" | "STRETCH" | "CENTER"
readonly gutterSize: number
readonly count: number
readonly sectionSize?: number | null
readonly offset?: number
readonly isVisible?: boolean
readonly color?: RGBA
readonly id?: string
readonly name?: string
}
export interface GridLayoutGrid {
readonly gridType: "GRID"
readonly sectionSize: number
readonly isVisible?: boolean
readonly color?: RGBA
readonly id?: string
readonly name?: string
}
export type LayoutGrid = RowsColsLayoutGrid | GridLayoutGrid
interface FrameContainerMixin extends AutoLayout {
clipsContent: boolean
layoutGrids: ReadonlyArray<LayoutGrid>
gridStyleId: string
}

@@ -594,2 +643,3 @@

CornerMixin,
RectangleStrokeWeightMixin,
RectangleCornerMixin {

@@ -766,2 +816,5 @@ readonly type: 'RECTANGLE'

name: string;
/**
* layerId
*/
id: string;

@@ -768,0 +821,0 @@ description?: string;

+21
-7
function hexToRGBA(hex) {
hex = hex.replace('#', '');
if (hex.length === 3 || hex.length === 4) {
let convertTo8Digits = '';
for (const char of hex) {
convertTo8Digits += char.repeat(2);
}
hex = convertTo8Digits;
}
if (hex.length === 6) {
// 默认alpha为1
hex += 'FF';
}
else if (hex.length !== 8) {
throw new Error('Hex format error');
}
const bigint = parseInt(hex, 16);
return {
a: ((bigint >> 24) & 255) / 255,
r: ((bigint >> 16) & 255) / 255,
g: ((bigint >> 8) & 255) / 255,
b: (bigint & 255) / 255
r: ((bigint >> 24) & 255) / 255,
g: ((bigint >> 16) & 255) / 255,
b: ((bigint >> 8) & 255) / 255,
a: (bigint & 255) / 255,
};
}
function RGBAToHex(rgba) {
return ['a', 'r', 'g', 'b'].reduce((prev, key) => {
let s = (rgba[key] * 255).toString(16).toUpperCase();
s = s.length === 1 ? '0' + s : s;
return ['r', 'g', 'b', 'a'].reduce((prev, key) => {
let s = (rgba[key] * 255).toString(16).slice(0, 2).toUpperCase();
s = s.length === 1 ? ('0' + s) : s;
return prev + s;

@@ -16,0 +30,0 @@ }, '#');

{
"name": "@mastergo/plugin-utils",
"version": "0.2.0",
"version": "0.3.0",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",