@mastergo/plugin-utils
Advanced tools
+1
-107
@@ -1,111 +0,5 @@ | ||
| ## [0.1.11](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.27.0...v0.1.11) (2022-04-20) | ||
| # [0.2.0](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.28.0...v0.2.0) (2022-07-01) | ||
| ### Bug Fixes | ||
| * remove console typings ([a7c3334](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/a7c333480a0c7038234e1223f0ea51933ddee363)) | ||
| * 修复SLICE类型提示报错. ([867dc6e](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/867dc6e1b5bbdc5d2e2902e5e7720053c8115902)) | ||
| * 修复VectorPath定义错误.实际上这个地方是一个一维数组. ([e6a3a99](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/e6a3a99c2957b6dbabdb5d31f12ff3c17dec1785)) | ||
| * 再次修复Slice提示的问题. ([4ffbdc0](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/4ffbdc0ad5629de22e375c81414bb5beecdbb2c9)) | ||
| ### Features | ||
| * 添加SLiceNode类型支持 ([08344ec](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/08344ecc3db28ab1753a6948d074171332c7cc51)) | ||
| ## [0.1.10](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.27.0...v0.1.10) (2022-04-20) | ||
| ### Bug Fixes | ||
| * remove console typings ([a7c3334](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/a7c333480a0c7038234e1223f0ea51933ddee363)) | ||
| * 修复SLICE类型提示报错. ([867dc6e](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/867dc6e1b5bbdc5d2e2902e5e7720053c8115902)) | ||
| * 再次修复Slice提示的问题. ([4ffbdc0](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/4ffbdc0ad5629de22e375c81414bb5beecdbb2c9)) | ||
| ### Features | ||
| * 添加SLiceNode类型支持 ([08344ec](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/08344ecc3db28ab1753a6948d074171332c7cc51)) | ||
| ## [0.1.9](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.27.0...v0.1.9) (2022-04-20) | ||
| ### Bug Fixes | ||
| * remove console typings ([a7c3334](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/a7c333480a0c7038234e1223f0ea51933ddee363)) | ||
| * 修复SLICE类型提示报错. ([867dc6e](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/867dc6e1b5bbdc5d2e2902e5e7720053c8115902)) | ||
| ### Features | ||
| * 添加SLiceNode类型支持 ([08344ec](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/08344ecc3db28ab1753a6948d074171332c7cc51)) | ||
| ## [0.1.8](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.27.0...v0.1.8) (2022-04-20) | ||
| ### Bug Fixes | ||
| * remove console typings ([a7c3334](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/a7c333480a0c7038234e1223f0ea51933ddee363)) | ||
| ### Features | ||
| * 添加SLiceNode类型支持 ([08344ec](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/08344ecc3db28ab1753a6948d074171332c7cc51)) | ||
| ## [0.1.7](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.27.0...v0.1.7) (2022-04-19) | ||
| ### Bug Fixes | ||
| * remove console typings ([a7c3334](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/a7c333480a0c7038234e1223f0ea51933ddee363)) | ||
| ### Features | ||
| * 添加SLiceNode类型支持 ([08344ec](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/08344ecc3db28ab1753a6948d074171332c7cc51)) | ||
| ## [0.1.6](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.27.0...v0.1.6) (2022-04-19) | ||
| ### Bug Fixes | ||
| * remove console typings ([a7c3334](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/a7c333480a0c7038234e1223f0ea51933ddee363)) | ||
| ## [0.1.5](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.27.0...v0.1.5) (2022-04-15) | ||
| ### Bug Fixes | ||
| * remove console typings ([a7c3334](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/a7c333480a0c7038234e1223f0ea51933ddee363)) | ||
| ## [0.1.4](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.27.0...v0.1.4) (2022-04-01) | ||
| ## [0.1.3](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.27.0...v0.1.3) (2022-04-01) | ||
| ## [0.1.2](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.27.0...v0.1.2) (2022-04-01) | ||
| ## [0.1.1](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.27.0...v0.1.1) (2022-04-01) | ||
| # [0.27.0](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.26.1...v0.27.0) (2022-01-25) | ||
@@ -112,0 +6,0 @@ |
+137
-23
@@ -13,2 +13,3 @@ declare function hexToRGBA(hex: string): RGBA; | ||
| const mg: PluginAPI | ||
| const console: Console | ||
| const __html__: string | ||
@@ -23,2 +24,11 @@ | ||
| interface Console { | ||
| log(message?: any, ...optionalParams: any[]): void | ||
| error(message?: any, ...optionalParams: any[]): void | ||
| assert(condition?: boolean, message?: string, ...data: any[]): void | ||
| info(message?: any, ...optionalParams: any[]): void | ||
| warn(message?: any, ...optionalParams: any[]): void | ||
| clear(): void | ||
| } | ||
| interface Image { | ||
@@ -35,3 +45,3 @@ readonly href: string | ||
| type PluginEventType = 'selectionchange' | 'currentpagechange' | 'close' | ||
| type PluginEventType = 'selectionchange' | 'currentpagechange' | 'close' | 'themechange' | ||
@@ -62,3 +72,3 @@ interface PluginAPI { | ||
| getNodeById(id: string): PageNode | SceneNode | null | ||
| getNodeById(id: string): SceneNode | null | ||
| createRectangle(): RectangleNode | ||
@@ -74,4 +84,7 @@ createLine(): LineNode | ||
| createPage(): PageNode | ||
| createSlice(): SliceNode | ||
| createNodeFromSvgAsync(svg: string): Promise<FrameNode> | ||
| getHoverLayer(): PageNode | SceneNode | ||
| group(children: ReadonlyArray<SceneNode>): GroupNode | ||
@@ -88,5 +101,6 @@ union(children: ReadonlyArray<SceneNode>): BooleanOperationNode | ||
| getStyleById(id: string): Style | null | ||
| createPaintStyle(): PaintStyle | ||
| createEffectStyle(): EffectStyle | ||
| createTextStyle(): TextStyle | ||
| createFillStyle(config: CreateStyleConfig): PaintStyle | ||
| createStrokeStyle(config: CreateStyleConfig): PaintStyle | ||
| createEffectStyle(config: CreateStyleConfig): EffectStyle | ||
| createTextStyle(config: CreateStyleConfig): TextStyle | ||
@@ -97,2 +111,5 @@ listAvailableFontsAsync(): Promise<Font[]> | ||
| getImageByHref(href: string): Image | ||
| hexToRGBA(hex: string): RGBA | ||
| RGBAToHex(rgba: RGBA): string | ||
| } | ||
@@ -133,2 +150,4 @@ | ||
| constraint?: ExportSettingsConstraints | ||
| isSuffix?: boolean | ||
| fileName?: string | ||
| readonly useAbsoluteBounds?: boolean | ||
@@ -138,3 +157,3 @@ } | ||
| interface ExportMixin { | ||
| exportSettings: ExportSettings[] | ||
| exportSettings: ReadonlyArray<ExportSettings> | ||
| export(settings?: ExportSettings): Promise<Uint8Array | string> // Defaults to PNG format | ||
@@ -152,2 +171,3 @@ } | ||
| close(): void | ||
| resize(width: number, height: number): void | ||
@@ -331,5 +351,10 @@ postMessage(pluginMessage: any, origin?: string): void | ||
| readonly windingRule: WindingRule | ||
| readonly pathIds: ReadonlyArray<number> | ||
| readonly pathIds?: ReadonlyArray<number> | ||
| } | ||
| interface VectorCtrl { | ||
| x: number | ||
| y: number | ||
| } | ||
| type LetterSpacing = { | ||
@@ -379,2 +404,12 @@ readonly value: number | ||
| remove(): void | ||
| getPluginData(key: string): string | ||
| setPluginData(key: string, value: string): void | ||
| getPluginDataKeys(): string[] | ||
| removePluginData(key: string): void | ||
| clearPluginData(): void | ||
| getSharedPluginData(namespace: string, key: string): string | ||
| setSharedPluginData(namespace: string, key: string, value: string): void | ||
| getSharedPluginDataKeys(namespace: string): void | ||
| removeSharedPluginData(namespace: string, key: string): void | ||
| clearSharedPluginData(namespace: string): void | ||
| } | ||
@@ -387,3 +422,3 @@ | ||
| interface ChildrenMixin<ChildrenNode = BaseNode> { | ||
| interface ChildrenMixin<ChildrenNode = SceneNode> { | ||
| readonly children: ReadonlyArray<ChildrenNode> | ||
@@ -419,2 +454,4 @@ appendChild(child: SceneNode): void | ||
| y: number | ||
| width: number | ||
| height: number | ||
| rotation: number // In degrees | ||
@@ -430,2 +467,3 @@ alignSelf: 'STRETCH' | 'INHERIT' // applicable only inside auto-layout frames | ||
| effects: ReadonlyArray<Effect> | ||
| effectStyleId: string | ||
| } | ||
@@ -436,3 +474,10 @@ | ||
| type StrokeAlign = 'CENTER' | 'INSIDE' | 'OUTSIDE' | ||
| type DashCap = 'NONE' | 'ROUND' | 'SQUARE' | ||
| enum StrokeStyle { | ||
| SOLID = 0, | ||
| DASH = 1, | ||
| CUSTOM = 2, | ||
| } | ||
| interface GeometryMixin { | ||
@@ -445,4 +490,12 @@ fills: ReadonlyArray<Paint> | ||
| strokeJoin: StrokeJoin | ||
| readonly strokeDashes: [number, number] | ||
| outlineStroke(): PenNode | null | ||
| strokeStyle: StrokeStyle | ||
| dashCap: DashCap | ||
| strokeDashes: ReadonlyArray<[number, number]> | ||
| fillStyleId: string | ||
| strokeStyleId: string | ||
| /** | ||
| * You have to ensure the layer has stroke before invoking this method. | ||
| * 在调用接口之前需要确保layer有描边. | ||
| */ | ||
| outlineStroke(): SceneNode | null | ||
| } | ||
@@ -453,2 +506,3 @@ | ||
| cornerSmooth: number | ||
| cornerRadius: number | symbol | ||
| } | ||
@@ -470,2 +524,3 @@ | ||
| BlendMixin, | ||
| CornerMixin, | ||
| ConstraintMixin, | ||
@@ -501,3 +556,3 @@ LayoutMixin, | ||
| interface DocumentNode extends BaseNodeMixin, ChildrenMixin<PageNode> { | ||
| interface DocumentNode extends ChildrenMixin<PageNode> { | ||
| readonly type: 'DOCUMENT' | ||
@@ -509,4 +564,3 @@ currentPage: PageNode | ||
| extends BaseNodeMixin, | ||
| ChildrenMixin<SceneNode>, | ||
| ExportMixin { | ||
| ChildrenMixin<SceneNode> { | ||
| readonly type: 'PAGE' | ||
@@ -516,6 +570,25 @@ | ||
| clone(): PageNode | ||
| /** | ||
| * 选中所有图层 | ||
| */ | ||
| selectAll() : void | ||
| /** | ||
| * 背景颜色 | ||
| */ | ||
| bgColor: RGBA | ||
| /** | ||
| * 原型所有的flow | ||
| */ | ||
| readonly flows: Flow[] | ||
| /** | ||
| * 根据flow id获取原型 | ||
| */ | ||
| getLayerPrototypeById(): Flow | ||
| /** | ||
| * 标签,默认'NONE' | ||
| */ | ||
| label:'NONE' | 'BLUE' | 'GREEN' | 'RED' | 'YELLOW' | 'PURPLE' | 'GRAY' | ||
| } | ||
| interface FrameNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin { | ||
| booleanOperation: 'NONE' | 'UNION' | 'INTERSECT' | 'SUBTRACT' | 'EXCLUDE' | ||
| readonly type: 'FRAME' | ||
@@ -525,4 +598,3 @@ clone(): FrameNode | ||
| interface GroupNode extends DefaultContainerMixin { | ||
| booleanOperation: 'NONE' | 'UNION' | 'INTERSECT' | 'SUBTRACT' | 'EXCLUDE' | ||
| interface GroupNode extends DefaultContainerMixin, GeometryMixin { | ||
| readonly type: 'GROUP' | ||
@@ -549,5 +621,6 @@ clone(): GroupNode | ||
| clone(): EllipseNode | ||
| arcData: ArcData | ||
| } | ||
| interface PolygonNode extends DefaultShapeMixin, ConstraintMixin { | ||
| interface PolygonNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin { | ||
| readonly type: 'POLYGON' | ||
@@ -574,5 +647,6 @@ pointCount: number | ||
| interface PenNetwork { | ||
| paths: VectorPaths | ||
| paths: ReadonlyArray<VectorPaths> | ||
| nodes: ReadonlyArray<VectorVertex> | ||
| regions: VectorRegion | ||
| regions: ReadonlyArray<VectorRegion> | [] | ||
| ctrlNodes: ReadonlyArray<VectorCtrl> | ||
| } | ||
@@ -588,3 +662,5 @@ | ||
| penNetwork: PenNetwork | ||
| penPaths: PenPaths | ||
| set penPaths(paths: Array<PenPaths>) | ||
| //@ts-ignore | ||
| get penPaths(): PenPaths | ||
| clone(): PenNode | ||
@@ -595,2 +671,3 @@ } | ||
| extends DefaultShapeMixin, | ||
| FrameContainerMixin, | ||
| ChildrenMixin, | ||
@@ -643,3 +720,3 @@ CornerMixin { | ||
| interface ComponentNode extends DefaultContainerMixin, GeometryMixin { | ||
| interface ComponentNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin { | ||
| readonly type: 'COMPONENT' | ||
@@ -650,5 +727,10 @@ clone(): ComponentNode | ||
| interface InstanceNode extends DefaultContainerMixin, GeometryMixin { | ||
| interface InstanceNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin { | ||
| readonly type: 'INSTANCE' | ||
| clone(): InstanceNode | ||
| /** | ||
| * this is an async func | ||
| */ | ||
| swapComponent(): void | ||
| detachInstance(): InstanceNode | ||
| mainComponent: ComponentNode | null | ||
@@ -665,2 +747,5 @@ } | ||
| /** | ||
| * 画布节点 | ||
| */ | ||
| type SceneNode = | ||
@@ -695,6 +780,35 @@ | GroupNode | ||
| | 'INSTANCE' | ||
| | 'BOOLEAN_OPERATION' | ||
| | 'BOOLEANOPERATION' | ||
| | 'SLICE' | ||
| } | ||
| export interface CreateStyleConfig { | ||
| name: string; | ||
| id: string; | ||
| description?: string; | ||
| } | ||
| interface Flow { | ||
| name: string | ||
| index: string | ||
| id: string | ||
| flowId: string | ||
| description: string | ||
| } | ||
| interface ArcData { | ||
| /** | ||
| * 起点弧度 | ||
| */ | ||
| startingAngle: number | ||
| /** | ||
| * 终点弧度 | ||
| */ | ||
| endingAngle?: number | ||
| /** | ||
| * 内径 | ||
| */ | ||
| innerRadius: number | ||
| } | ||
| export { } |
+2
-1
| { | ||
| "name": "@mastergo/plugin-utils", | ||
| "version": "0.1.11", | ||
| "version": "0.2.0", | ||
| "main": "dist/index.js", | ||
| "types": "dist/index.d.ts", | ||
| "scripts": { | ||
| "prepare": "husky install", | ||
| "dev": "node scripts/dev.js", | ||
@@ -8,0 +9,0 @@ "build": "node scripts/build.js && rm -rf ./dist/lib", |
708
17.61%37590
-3.6%