Socket
Socket
Sign inDemoInstall

mp-painter

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mp-painter - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

dist/lib/lineSpliter.d.ts

7

package.json
{
"name": "mp-painter",
"version": "0.0.5",
"version": "0.0.6",
"description": "A declarative canvas lib using with mini-program, espacially with uniapp.",
"main": "src/lib/painter.js",
"main": "dist/lib/painter.js",
"types": "dist/lib/painter.d.ts",
"scripts": {

@@ -22,3 +23,3 @@ "build": "tsc -p src",

"dependencies": {
"@types/uni-app": "^1.2.0"
"@types/uni-app": "^1.4.1"
},

@@ -25,0 +26,0 @@ "devDependencies": {

@@ -15,4 +15,4 @@ import Painter, {PaintBaseOption, CanvasObj} from "./painter";

let {
direction,
children,
direction = "vertical",
children = [],
left = 0,

@@ -32,5 +32,2 @@ top = 0,

direction = direction || "vertical"
children = children || [];
let drawChild = (child: CanvasObj) => {

@@ -96,2 +93,2 @@

};
}
}

@@ -6,17 +6,5 @@ import Painter, {PaintBaseOption} from "./painter";

type fontWeight = "normal" | "bold";
type baseline = "top" | "middle" | "bottom" | "normal";
type align = "left" | "right" | "center";
export interface CanvasTextBlock extends Omit<CanvasText, "type"> {
type: "text-block",
// color: string,
// fontSize: number
// fontWeight: fontWeight
// fontFamily: string
// baseline: baseline
// align: align
// content: string;
lineHeight: number

@@ -23,0 +11,0 @@ lineClamp: number

@@ -37,7 +37,7 @@ import Painter, { PaintBaseOption } from "./painter";

color = "#000",
align = "left",
fontWeight = "normal",
align = "left" as align,
fontWeight = "normal" as fontWeight,
fontFamily = "serial",
fontSize = 30,
baseline = "top",
baseline = "top" as baseline,
content = "",

@@ -44,0 +44,0 @@ left = 0,

@@ -9,6 +9,6 @@ import { delay } from "../utils/delay";

import paintContainer, { CanvasContainer } from "./paint-container";
import { PLATFORM } from "../utils/platform";
import { PLATFORM, UniPlatforms } from "../utils/platform";
type UniPlatforms = "mp-weixin" | "mp-alipay" | "mp-baidu";
interface IPanterOption {

@@ -68,7 +68,9 @@ upx2px?: (upx: number) => number

platform = PLATFORM,
upx2px = typeof uni == "object" ? uni.upx2px : x => x
}: IPanterOption = {}){
this.ctx = ctx;
this.upx2px = upx2px;
this.platform = platform;
this.upx2px = uni.upx2px;
if(platform == "mp-alipay"){
this.upx2px = (x: number) => uni.upx2px(x * 2);
}
}

@@ -140,2 +142,2 @@

}
}
}

@@ -11,7 +11,7 @@ {

// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
"declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
"sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
"outDir": "../dist", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */

@@ -18,0 +18,0 @@ // "composite": true, /* Enable project compilation */

@@ -1,12 +0,15 @@

export const PLATFORM = (function(){
// @ts-ignore
var swan: unknown;
var my: unknown;
var wx: unknown;
export type UniPlatforms = "mp-weixin" | "mp-alipay" | "mp-baidu";
export const PLATFORM: UniPlatforms = (function(){
if(typeof swan == "object")
return "mp-baidu"
// @ts-ignore
if(typeof my == "object")
return "mp-alipay"
// @ts-ignore
if(typeof wx == "object")
return "mp-weixin"
return "mp-weixin"
})();
})();
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc