@meta2d/core
Advanced tools
Comparing version 1.0.15 to 1.0.16
{ | ||
"name": "@meta2d/core", | ||
"version": "1.0.15", | ||
"version": "1.0.16", | ||
"description": "@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,2 +15,3 @@ /// <reference types="offscreencanvas" /> | ||
import { Meta2d } from '../core'; | ||
import { Dialog } from '../dialog'; | ||
export declare const movingSuffix: "-moving"; | ||
@@ -106,2 +107,3 @@ export declare class Canvas { | ||
magnifierCanvas: MagnifierCanvas; | ||
dialog: Dialog; | ||
stopPropagation: (e: MouseEvent) => void; | ||
@@ -108,0 +110,0 @@ constructor(parent: Meta2d, parentElement: HTMLElement, store: Meta2dStore); |
@@ -6,6 +6,6 @@ import { EventType, Handler, WildcardHandler } from 'mitt'; | ||
import { Point } from './point'; | ||
import { EditAction, register, registerAnchors, registerCanvasDraw, Meta2dData, Meta2dStore } from './store'; | ||
import { EditAction, register, registerAnchors, registerCanvasDraw, Meta2dData, Meta2dStore, Network } from './store'; | ||
import { Padding } from './utils'; | ||
import { Rect } from './rect'; | ||
import { Event } from './event'; | ||
import { Event, TriggerCondition } from './event'; | ||
import { ViewMap } from './map'; | ||
@@ -20,3 +20,5 @@ import { MqttClient } from 'mqtt'; | ||
mqttClients: MqttClient[]; | ||
socketFn: (e: string, topic: string) => boolean; | ||
socketFn: (e: string, topic: string, context?: { | ||
meta2d: Meta2d; | ||
}) => boolean; | ||
events: Record<number, (pen: Pen, e: Event) => void>; | ||
@@ -52,3 +54,5 @@ map: ViewMap; | ||
initEventFns(): void; | ||
navigatorTo(id: string): void; | ||
doSendDataEvent(value: any, topics?: string): void; | ||
sendDataToNetWork(value: any, network: Network): Promise<void>; | ||
resize(width?: number, height?: number): void; | ||
@@ -132,3 +136,3 @@ /** | ||
setPenRect(pen: Pen, rect: Rect, render?: boolean): void; | ||
startAnimate(idOrTagOrPens?: string | Pen[], index?: number): void; | ||
startAnimate(idOrTagOrPens?: string | Pen[], params?: number | string): void; | ||
pauseAnimate(idOrTagOrPens?: string | Pen[]): void; | ||
@@ -150,2 +154,3 @@ stopAnimate(idOrTagOrPens?: string | Pen[]): void; | ||
inactive(): void; | ||
activeAll(): void; | ||
/** | ||
@@ -189,2 +194,6 @@ * 删除画笔 | ||
closeHttp(): void; | ||
networkTimer: any; | ||
connectNetwork(): void; | ||
onNetworkConnect(https: Network[]): void; | ||
closeNetwork(): void; | ||
socketCallback(message: string, topic?: string): void; | ||
@@ -214,2 +223,3 @@ setDatas(datas: { | ||
private doEvent; | ||
judgeCondition(pen: Pen, key: string, condition: TriggerCondition): boolean; | ||
pushChildren(parent: Pen, children: Pen[]): void; | ||
@@ -252,2 +262,7 @@ renderPenRaw: typeof renderPenRaw; | ||
/** | ||
* 大小相同 | ||
* @param pens 画笔们 | ||
*/ | ||
beSameByLast(pens?: Pen[], attribute?: string): void; | ||
/** | ||
* 格式刷(样式相同,大小无需一致。) | ||
@@ -268,2 +283,8 @@ * @param pens 画笔们 | ||
/** | ||
* 对齐画笔,基于最后选中的画笔 | ||
* @param align 左对齐,右对齐,上对齐,下对齐,居中对齐 | ||
* @param pens | ||
*/ | ||
alignNodesByLast(align: string, pens?: Pen[]): void; | ||
/** | ||
* 将画笔参照 rect 进行 align 对齐 | ||
@@ -297,5 +318,4 @@ * @param align 左对齐,右对齐,上对齐,下对齐,居中对齐 | ||
* @param pen pen 置顶的画笔 | ||
* @param pens 画笔们,注意 pen 必须在该数组内才有效 | ||
*/ | ||
top(pen: Pen, pens?: Pen[]): void; | ||
top(pen: Pen): void; | ||
/** | ||
@@ -311,3 +331,3 @@ * 若本次改变的画笔存在图片,并且在上层 or 下层,需要擦除上层 or 下层 | ||
*/ | ||
bottom(pen: Pen, pens?: Pen[]): void; | ||
bottom(pen: Pen): void; | ||
/** | ||
@@ -321,10 +341,10 @@ * data.pens 决定了绘制顺序,即越后面的越在上层 | ||
* 该画笔上移,即把该画笔在数组中的位置向后移动一个 | ||
* @param pens 画笔们,注意 pen 必须在该数组内才有效 | ||
* @param pen 画笔 | ||
*/ | ||
up(pen: Pen, pens?: Pen[]): void; | ||
up(pen: Pen): void; | ||
/** | ||
* 该画笔下移,即把该画笔在该数组中的位置前移一个 | ||
* @param pens 画笔们,注意 pen 必须在该数组内才有效 | ||
* @param pen 画笔 | ||
*/ | ||
down(pen: Pen, pens?: Pen[]): void; | ||
down(pen: Pen): void; | ||
setLayer(pen: Pen, toIndex: number, pens?: Pen[]): void; | ||
@@ -331,0 +351,0 @@ changePenId(oldId: string, newId: string): void; |
@@ -0,2 +1,4 @@ | ||
import { Meta2d } from '../core'; | ||
import { IValue, Pen } from '../pen'; | ||
import { Network } from '../store'; | ||
export declare type EventValue = string | IValue | undefined | null; | ||
@@ -11,3 +13,9 @@ export declare type EventName = 'enter' | 'leave' | 'active' | 'inactive' | 'click' | 'mousedown' | 'mouseup' | 'dblclick' | 'valueUpdate'; | ||
extend?: string; | ||
fn?: (pen: Pen, params: string) => void; | ||
fn?: (pen: Pen, params: string, context?: { | ||
meta2d: Meta2d; | ||
eventName: string; | ||
}) => void; | ||
targetType?: string; | ||
network?: Network; | ||
actions?: Event[]; | ||
} | ||
@@ -27,3 +35,6 @@ export declare enum EventAction { | ||
SendPropData = 11, | ||
SendVarData = 12 | ||
SendVarData = 12, | ||
Navigator = 13, | ||
Dialog = 14, | ||
SendData = 15 | ||
} | ||
@@ -35,3 +46,5 @@ export interface Where { | ||
value?: unknown; | ||
fn?: (pen: Pen) => boolean; | ||
fn?: (pen: Pen, context?: { | ||
meta2d: Meta2d; | ||
}) => boolean; | ||
fnJs?: string; | ||
@@ -50,1 +63,33 @@ } | ||
| '[]' | '![]'; | ||
export interface TriggerCondition { | ||
type?: string; | ||
operator?: Comparison; | ||
valueType?: string; | ||
value?: string; | ||
target?: string; | ||
label?: string; | ||
fnJs?: string; | ||
fn?: (pen: Pen, context?: { | ||
meta2d: Meta2d; | ||
}) => boolean; | ||
} | ||
export interface Trigger { | ||
name?: string; | ||
conditionType?: string; | ||
conditions?: TriggerCondition[]; | ||
actions?: Event[]; | ||
} | ||
export interface Bind { | ||
case?: string; | ||
id?: string; | ||
label?: string; | ||
} | ||
export interface RealTime { | ||
label?: string; | ||
key?: string; | ||
type?: string; | ||
keywords?: true; | ||
triggers?: Trigger[]; | ||
binds?: Bind[]; | ||
value?: string; | ||
} |
@@ -16,3 +16,6 @@ export var EventAction; | ||
EventAction[EventAction["SendVarData"] = 12] = "SendVarData"; | ||
EventAction[EventAction["Navigator"] = 13] = "Navigator"; | ||
EventAction[EventAction["Dialog"] = 14] = "Dialog"; | ||
EventAction[EventAction["SendData"] = 15] = "SendData"; | ||
})(EventAction || (EventAction = {})); | ||
//# sourceMappingURL=event.js.map |
@@ -78,3 +78,4 @@ import { TextAlign, TextBaseline, Pen } from './pen'; | ||
defaultFormat?: Pen; | ||
domShapes?: string[]; | ||
} | ||
export declare const defaultOptions: Options; |
@@ -64,3 +64,4 @@ export var KeydownType; | ||
polylineSpace: 10, | ||
domShapes: [], | ||
}; | ||
//# sourceMappingURL=options.js.map |
import { Point } from '../point'; | ||
import { Rect } from '../rect'; | ||
import { Event } from '../event'; | ||
import { Event, RealTime } from '../event'; | ||
import { Canvas } from '../canvas'; | ||
@@ -216,2 +216,3 @@ export declare enum PenType { | ||
currentAnimation?: number; | ||
realTimes?: RealTime[]; | ||
calculative?: { | ||
@@ -218,0 +219,0 @@ x?: number; |
@@ -109,2 +109,3 @@ /// <reference types="offscreencanvas" /> | ||
export declare function setElemPosition(pen: Pen, elem: HTMLElement): void; | ||
export declare function setElemImg(pen: Pen, elem: HTMLElement): void; | ||
/** | ||
@@ -111,0 +112,0 @@ * 每个画笔 locked |
@@ -23,16 +23,2 @@ import { Emitter } from 'mitt'; | ||
websocketProtocols?: string | string[]; | ||
websockets?: { | ||
url?: string; | ||
protocols?: string | string[]; | ||
}[]; | ||
mqtts?: { | ||
url?: string; | ||
options?: { | ||
clientId?: string; | ||
username?: string; | ||
password?: string; | ||
customClientId?: boolean; | ||
}; | ||
topics?: string; | ||
}[]; | ||
background?: string; | ||
@@ -65,3 +51,22 @@ socketCbJs?: string; | ||
height?: number; | ||
networkInterval?: number; | ||
networks?: Network[]; | ||
mockData?: Function; | ||
} | ||
export interface Network { | ||
name?: string; | ||
type: 'mqtt' | 'websocket' | 'http'; | ||
url?: string; | ||
protocols?: string; | ||
topics?: string; | ||
options?: { | ||
clientId?: string; | ||
username?: string; | ||
password?: string; | ||
customClientId?: boolean; | ||
}; | ||
headers?: HeadersInit; | ||
method?: string; | ||
body?: any; | ||
} | ||
export interface HttpOptions { | ||
@@ -68,0 +73,0 @@ http?: string; |
@@ -40,4 +40,4 @@ import { getParent } from '../pen'; | ||
sheet.insertRule('.meta2d-tooltip .text{max-width:320px;min-height:30px;max-height:400px;outline:none;padding:8px 16px;border-radius:4px;background:#777777;color:#ffffff;line-height:1.8;overflow-y:auto;}'); | ||
sheet.insertRule('.meta2d-tooltip .arrow{position:absolute;border:6px solid transparent;background:transparent;top:-4px;left:50%;transform:translateX(-50%)}'); | ||
sheet.insertRule('.meta2d-tooltip .arrow.down{top:initial;bottom: 1.5px;}'); | ||
sheet.insertRule('.meta2d-tooltip .arrow{position:absolute;border:10px solid transparent;background:transparent;top:-5px;left:50%;transform:translateX(-50%)}'); | ||
sheet.insertRule('.meta2d-tooltip .arrow.down{top:initial;bottom: -1px;}'); | ||
} | ||
@@ -44,0 +44,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
1423696
208
20581
13