Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antv/g-lite

Package Overview
Dependencies
Maintainers
0
Versions
168
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/g-lite - npm Package Compare versions

Comparing version 2.2.9 to 2.2.10

2

package.json
{
"name": "@antv/g-lite",
"version": "2.2.9",
"version": "2.2.10",
"description": "A core module for rendering engine implements DOM API.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -5,7 +5,6 @@ import type { IRenderer } from './AbstractRenderer';

import { Document, EventTarget } from './dom';
import { CustomElementRegistry } from './dom/CustomElementRegistry';
import type { ICanvas } from './dom/interfaces';
import { EventService, RenderingService } from './services';
import type { PointLike } from './shapes';
import { type CanvasConfig, type Cursor, type InteractivePointerEvent } from './types';
import { type CanvasConfig, type Cursor } from './types';
export declare function isCanvas(value: any): value is Canvas;

@@ -30,4 +29,14 @@ export declare enum CanvasEvent {

* prototype chains: Canvas(Window) -> EventTarget
*
* @docs https://g.antv.antgroup.com/api/canvas/intro
*/
export declare class Canvas extends EventTarget implements ICanvas {
customElements: ICanvas['customElements'];
devicePixelRatio: ICanvas['devicePixelRatio'];
requestAnimationFrame: ICanvas['requestAnimationFrame'];
cancelAnimationFrame: ICanvas['cancelAnimationFrame'];
supportsTouchEvents: ICanvas['supportsTouchEvents'];
supportsPointerEvents: ICanvas['supportsPointerEvents'];
isTouchEvent: ICanvas['isTouchEvent'];
isMouseEvent: ICanvas['isMouseEvent'];
/**

@@ -38,37 +47,2 @@ * window.document

/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry
*/
customElements: CustomElementRegistry;
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
*/
requestAnimationFrame: (callback: FrameRequestCallback) => number;
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame
*/
cancelAnimationFrame: (handle: number) => void;
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio
*/
devicePixelRatio: number;
/**
* whether the runtime supports PointerEvent?
* if not, the event system won't trigger pointer events like `pointerdown`
*/
supportsPointerEvents: boolean;
/**
* whether the runtime supports TouchEvent?
* if not, the event system won't trigger touch events like `touchstart`
*/
supportsTouchEvents: boolean;
/**
* is this native event a TouchEvent?
*/
isTouchEvent: (event: InteractivePointerEvent) => event is TouchEvent;
/**
* is this native event a MouseEvent?
*/
isMouseEvent: (event: InteractivePointerEvent) => event is MouseEvent;
dblClickSpeed?: CanvasConfig['dblClickSpeed'];
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element

@@ -89,3 +63,3 @@ */

private updateSizeAttenuation;
getConfig(): Partial<CanvasConfig>;
getConfig(): CanvasConfig;
/**

@@ -92,0 +66,0 @@ * get the root displayObject in scenegraph

@@ -39,3 +39,3 @@ import type { DisplayObject } from '../../display-objects';

export declare function convertAngleUnit(value: CSSUnitValue): number;
export declare function parseDimensionArrayFormat(string: string | number | (string | number)[], size: number): number[];
export declare function parseDimensionArrayFormat(string: string | number | (string | number)[], size?: 2 | 4 | 'even'): number[];
export declare function parseDimensionArray(string: string | (string | number)[]): CSSUnitValue[];

@@ -42,0 +42,0 @@ export declare function parseDimensionArrayUnmemoize(string: string | (string | number)[]): CSSUnitValue[];

@@ -20,4 +20,2 @@ import type RBush from 'rbush';

export declare enum ElementEvent {
REPARENT = "reparent",
DESTROY = "destroy",
/**

@@ -33,2 +31,6 @@ * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMAttrModified

/**
* @see https://www.w3.org/TR/DOM-Level-3-Events/#domnodeinsertedintodocument
*/
MOUNTED = "DOMNodeInsertedIntoDocument",
/**
* it is being removed

@@ -39,9 +41,7 @@ * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeRemoved

/**
* @see https://www.w3.org/TR/DOM-Level-3-Events/#domnodeinsertedintodocument
*/
MOUNTED = "DOMNodeInsertedIntoDocument",
/**
* @see https://www.w3.org/TR/DOM-Level-3-Events/#domnoderemovedfromdocument
*/
UNMOUNTED = "DOMNodeRemovedFromDocument",
REPARENT = "reparent",
DESTROY = "destroy",
BOUNDS_CHANGED = "bounds-changed",

@@ -54,4 +54,17 @@ CULLED = "culled"

removeEventListener: (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void;
dispatchEvent: <T extends FederatedEvent>(e: T, skipPropagate?: boolean) => boolean;
/**
* @param skipPropagate - The default value is `false`. If true, the event is only triggered globally (note that the global is not the object itself), skipping the event propagation process. In addition, if the object has been removed from the global, the event is only triggered on the object itself.
* @param dispatchToSelf - The default value is `false`. If true, the event will be triggered on the object itself.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent
*/
dispatchEvent: <T extends FederatedEvent>(e: T, skipPropagate?: boolean, dispatchToSelf?: boolean) => boolean;
}
interface EventListener {
(evt: FederatedEvent): void;
}
interface EventListenerObject {
handleEvent(object: FederatedEvent): void;
}
export type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
export interface INode extends IEventTarget {

@@ -131,3 +144,4 @@ shadow: boolean;

/**
* Traverse in sub tree.
* iterate current node and its descendants
* @param callback - callback to execute for each node, return false to break
*/

@@ -401,3 +415,3 @@ forEach: (callback: (o: INode) => void | boolean) => void;

export interface CanvasContext {
config: Partial<CanvasConfig>;
config: CanvasConfig;
camera: ICamera;

@@ -415,20 +429,33 @@ /**

}
export interface ICanvas extends IEventTarget {
document: IDocument;
export interface IWindow {
/** https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry */
customElements: CustomElementRegistry;
/** https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio */
devicePixelRatio: number;
requestAnimationFrame: (callback: FrameRequestCallback) => number;
cancelAnimationFrame: (handle: number) => void;
/** https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope/requestAnimationFrame */
requestAnimationFrame: typeof requestAnimationFrame;
/** https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope/cancelAnimationFrame */
cancelAnimationFrame: typeof cancelAnimationFrame;
/**
* whether the runtime supports TouchEvent?
* if not, the event system won't trigger touch events like `touchstart`
*/
supportsTouchEvents: boolean;
/**
* whether the runtime supports PointerEvent?
* if not, the event system won't trigger pointer events like `pointerdown`
*/
supportsPointerEvents: boolean;
/**
* is this native event a TouchEvent?
*/
isTouchEvent: (event: InteractivePointerEvent) => event is TouchEvent;
/**
* is this native event a MouseEvent?
*/
isMouseEvent: (event: InteractivePointerEvent) => event is MouseEvent;
dblClickSpeed?: number;
render: () => void;
destroy: (destroyScenegraph?: boolean) => void;
resize: (width: number, height: number) => void;
}
export interface ICanvas extends IWindow, IEventTarget {
document: IDocument;
context: CanvasContext;
mountChildren: (parent: INode) => void;
unmountChildren: (parent: INode) => void;
mountFragment: (fragment: INode) => void;
getConfig: () => Partial<CanvasConfig>;

@@ -439,2 +466,5 @@ getCamera: () => ICamera;

getEventService: () => EventService;
mountChildren: (parent: INode) => void;
unmountChildren: (parent: INode) => void;
mountFragment: (fragment: INode) => void;
client2Viewport: (client: PointLike) => PointLike;

@@ -444,11 +474,7 @@ viewport2Client: (viewport: PointLike) => PointLike;

viewport2Canvas: (viewport: PointLike) => PointLike;
render: () => void;
destroy: (destroyScenegraph?: boolean) => void;
resize: (width: number, height: number) => void;
}
interface EventListener {
(evt: FederatedEvent): void;
}
interface EventListenerObject {
handleEvent(object: FederatedEvent): void;
}
export type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
export {};
//# sourceMappingURL=interfaces.d.ts.map

@@ -137,8 +137,4 @@ import { EventTarget } from './EventTarget';

getAncestor(n: number): INode | null;
/**
* iterate current node and its descendants
* @param callback - callback to execute for each node, return false to break
*/
forEach(callback: (o: INode) => void | boolean): void;
}
//# sourceMappingURL=Node.d.ts.map

@@ -24,3 +24,2 @@ import type { CanvasContext, GlobalRuntime, InteractivePointerEvent } from '..';

private rootTarget;
private emitter;
/**

@@ -27,0 +26,0 @@ * Store HTML elements in current canvas.

@@ -5,2 +5,3 @@ import type { IRenderer } from './AbstractRenderer';

import type { DisplayObject } from './display-objects';
import type { IWindow } from './dom/interfaces';
export declare enum Shape {

@@ -298,37 +299,41 @@ GROUP = "g",

}
export interface CanvasConfig {
export interface CanvasConfig extends Partial<Omit<IWindow, 'customElements'>> {
/**
* Renderer
* When the renderer is initialized, a `<canvas>/<svg>` element is automatically
* created inside the container DOM element.
*/
renderer: IRenderer;
/**
* document.getElementById(container);
*/
container?: string | HTMLElement;
/**
* support OffscreenCanvas
* When this parameter is passed, the `container` parameter will be ignored.
*
* - support OffscreenCanvas
*/
canvas?: CanvasLike;
/**
* used in JSDOM
* Renderer
*
* @see https://g.antv.antgroup.com/api/renderer/intro
*/
document?: Document;
renderer: IRenderer;
/**
* used in text measurement & texture generation
* 画布宽度
*/
offscreenCanvas?: CanvasLike;
width?: number;
/**
* window.devicePixelRatio
* 画布高度
*/
devicePixelRatio?: number;
height?: number;
/**
* rAF
* 画布背景色
*/
requestAnimationFrame?: (callback: FrameRequestCallback) => number;
cancelAnimationFrame?: (id: number) => void;
background?: ColorType;
/**
* replace `new window.Image()`
* cursor style
*/
createImage?: (src: string) => HTMLImageElement;
cursor?: Cursor;
/**
* One container can have multiple canvases inside.
*/
supportsMutipleCanvasesInOneContainer?: boolean;
/**
* Optimize rendering performance for high-resolution large images

@@ -352,13 +357,2 @@ */

/**
* limits query
*/
supportsPointerEvents?: boolean;
supportsTouchEvents?: boolean;
isTouchEvent?: (event: InteractivePointerEvent) => event is TouchEvent;
isMouseEvent?: (event: InteractivePointerEvent) => event is MouseEvent;
/**
* double click speed (ms), default is 200ms
*/
dblClickSpeed?: number;
/**
* Listen to native click event instead of mocking with pointerup & down events.

@@ -380,11 +374,2 @@ */

/**
* Should we account for CSS Transform applied on container? Enabled by default.
* @deprecated
*/
supportsCSSTransform?: boolean;
/**
* One container can have multiple canvases inside.
*/
supportsMutipleCanvasesInOneContainer?: boolean;
/**
* 销毁画布时是否执行清理操作

@@ -394,18 +379,19 @@ */

/**
* 画布宽度
* used in JSDOM
*/
width?: number;
document?: Document;
/**
* 画布高度
* used in text measurement & texture generation
*/
height?: number;
offscreenCanvas?: CanvasLike;
/**
* 画布背景色
* replace `new window.Image()`
*/
background?: ColorType;
createImage?: () => HTMLImageElement;
/**
* 画布的 cursor 样式
* double click speed (ms)
*
* - default is 200ms
*/
cursor?: Cursor;
[key: string]: any;
dblClickSpeed?: number;
}

@@ -412,0 +398,0 @@ /**

@@ -10,7 +10,4 @@ /**

export declare const pnow: () => number;
type TRequestAnimationFrame = (callback: (...args: any[]) => any) => number;
type TCancelAnimationFrame = (id: number) => void;
export declare const raf: TRequestAnimationFrame;
export declare const caf: TCancelAnimationFrame;
export {};
export declare const raf: typeof requestAnimationFrame;
export declare const caf: typeof cancelAnimationFrame;
//# sourceMappingURL=raf.d.ts.map

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 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 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 not supported yet

Sorry, the diff of this file is not supported yet

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