squarified 0.6.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{dom-event-ClwTQnot.js → dom-event-BkRCiIWB.js} +279 -97
- package/dist/{dom-event-DrYYfglv.mjs → dom-event-CBrOg7CX.mjs} +266 -98
- package/dist/{index-Bks7tGiV.d.ts → index-C0Hd4N0X.d.ts} +85 -28
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -2
- package/dist/index.mjs +3 -4
- package/dist/plugin.d.mts +33 -18
- package/dist/plugin.d.ts +33 -18
- package/dist/plugin.js +295 -140
- package/dist/plugin.mjs +294 -139
- package/package.json +3 -3
|
@@ -23,6 +23,10 @@ declare class Matrix2D implements MatrixLoc {
|
|
|
23
23
|
constructor(loc?: Partial<MatrixLoc>);
|
|
24
24
|
create(loc: MatrixLoc): this;
|
|
25
25
|
transform(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number): this;
|
|
26
|
+
transformPoint(x: number, y: number): {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
};
|
|
26
30
|
translation(x: number, y: number): this;
|
|
27
31
|
scale(a: number, d: number): this;
|
|
28
32
|
private skew;
|
|
@@ -35,12 +39,13 @@ declare const enum DisplayType {
|
|
|
35
39
|
Text = "Text",
|
|
36
40
|
RoundRect = "RoundRect"
|
|
37
41
|
}
|
|
38
|
-
declare abstract class Display {
|
|
42
|
+
declare abstract class Display<T extends Any = Any> {
|
|
39
43
|
parent: Display | null;
|
|
40
44
|
id: number;
|
|
41
45
|
matrix: Matrix2D;
|
|
46
|
+
__widget__: T;
|
|
42
47
|
abstract get __instanceOf__(): DisplayType;
|
|
43
|
-
constructor();
|
|
48
|
+
constructor(id?: number, widget?: T);
|
|
44
49
|
destory(): void;
|
|
45
50
|
}
|
|
46
51
|
interface GraphStyleSheet {
|
|
@@ -49,7 +54,10 @@ interface GraphStyleSheet {
|
|
|
49
54
|
font: string;
|
|
50
55
|
lineWidth: number;
|
|
51
56
|
}
|
|
52
|
-
interface
|
|
57
|
+
interface RequestID {
|
|
58
|
+
__id__?: number;
|
|
59
|
+
}
|
|
60
|
+
interface LocOptions extends RequestID {
|
|
53
61
|
width: number;
|
|
54
62
|
height: number;
|
|
55
63
|
x: number;
|
|
@@ -102,11 +110,11 @@ declare abstract class S extends Display {
|
|
|
102
110
|
skewY: number;
|
|
103
111
|
constructor(options?: Partial<LocOptions>);
|
|
104
112
|
}
|
|
105
|
-
declare abstract class Graph extends S {
|
|
113
|
+
declare abstract class Graph<T extends Any = Any> extends S {
|
|
106
114
|
instruction: ReturnType<typeof createInstruction>;
|
|
107
115
|
__options__: Partial<LocOptions>;
|
|
108
116
|
abstract style: GraphStyleSheet;
|
|
109
|
-
constructor(options?: Partial<GraphOptions
|
|
117
|
+
constructor(options?: Partial<GraphOptions>, widget?: T);
|
|
110
118
|
abstract create(): void;
|
|
111
119
|
abstract clone(): Graph;
|
|
112
120
|
abstract get __shape__(): DisplayType;
|
|
@@ -114,22 +122,24 @@ declare abstract class Graph extends S {
|
|
|
114
122
|
get __instanceOf__(): DisplayType.Graph;
|
|
115
123
|
}
|
|
116
124
|
|
|
125
|
+
declare function traverse(graphs: Display[], handler: (graph: S) => void): void;
|
|
126
|
+
|
|
117
127
|
declare abstract class C extends Display {
|
|
118
128
|
elements: Display[];
|
|
119
|
-
constructor();
|
|
129
|
+
constructor(id?: number);
|
|
120
130
|
abstract get __instanceOf__(): DisplayType;
|
|
121
131
|
add(...elements: Display[]): void;
|
|
122
132
|
remove(...elements: Display[]): void;
|
|
123
133
|
destory(): void;
|
|
124
134
|
}
|
|
125
|
-
declare class Box extends C {
|
|
135
|
+
declare class Box<T extends AnyObject = AnyObject> extends C {
|
|
126
136
|
elements: Display[];
|
|
127
|
-
constructor();
|
|
137
|
+
constructor(id?: number, widget?: T);
|
|
128
138
|
add(...elements: Display[]): void;
|
|
129
139
|
remove(...elements: Display[]): void;
|
|
130
140
|
destory(): void;
|
|
131
141
|
get __instanceOf__(): DisplayType.Box;
|
|
132
|
-
clone(): Box
|
|
142
|
+
clone(): Box<any>;
|
|
133
143
|
}
|
|
134
144
|
|
|
135
145
|
interface RGBColor {
|
|
@@ -167,12 +177,12 @@ type RoundRectStyleOptions = RectStyleOptions & {
|
|
|
167
177
|
type RoundRectOptions = RectOptions & {
|
|
168
178
|
style: Partial<RoundRectStyleOptions>;
|
|
169
179
|
};
|
|
170
|
-
declare class RoundRect extends Graph {
|
|
180
|
+
declare class RoundRect<T extends Any = Any> extends Graph {
|
|
171
181
|
style: Required<RoundRectStyleOptions>;
|
|
172
|
-
constructor(options?: Partial<RoundRectOptions
|
|
182
|
+
constructor(options?: Partial<RoundRectOptions>, widget?: T);
|
|
173
183
|
get __shape__(): DisplayType;
|
|
174
184
|
create(): void;
|
|
175
|
-
clone(): RoundRect
|
|
185
|
+
clone(): RoundRect<any>;
|
|
176
186
|
}
|
|
177
187
|
|
|
178
188
|
interface TextOptions extends Omit<GraphOptions, 'style'> {
|
|
@@ -185,15 +195,36 @@ interface TextOptions extends Omit<GraphOptions, 'style'> {
|
|
|
185
195
|
fill: string;
|
|
186
196
|
}>;
|
|
187
197
|
}
|
|
188
|
-
declare class Text extends Graph {
|
|
198
|
+
declare class Text<T extends Any = Any> extends Graph {
|
|
189
199
|
text: string;
|
|
190
200
|
style: Required<TextOptions['style']>;
|
|
191
|
-
constructor(options?: Partial<TextOptions
|
|
201
|
+
constructor(options?: Partial<TextOptions>, widget?: T);
|
|
192
202
|
create(): void;
|
|
193
|
-
clone(): Text
|
|
203
|
+
clone(): Text<any>;
|
|
194
204
|
get __shape__(): DisplayType;
|
|
195
205
|
}
|
|
196
206
|
|
|
207
|
+
declare function isGraph(display: Display): display is Graph;
|
|
208
|
+
declare function isBox(display: Display): display is Box;
|
|
209
|
+
declare function isRoundRect(display: Display): display is RoundRect;
|
|
210
|
+
declare function isText<T extends Any = Any>(display: Display): display is Text<T>;
|
|
211
|
+
declare const asserts: {
|
|
212
|
+
isGraph: typeof isGraph;
|
|
213
|
+
isBox: typeof isBox;
|
|
214
|
+
isText: typeof isText;
|
|
215
|
+
isRoundRect: typeof isRoundRect;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
declare const easing: {
|
|
219
|
+
linear: (k: number) => number;
|
|
220
|
+
quadraticIn: (k: number) => number;
|
|
221
|
+
quadraticOut: (k: number) => number;
|
|
222
|
+
quadraticInOut: (k: number) => number;
|
|
223
|
+
cubicIn: (k: number) => number;
|
|
224
|
+
cubicOut: (k: number) => number;
|
|
225
|
+
cubicInOut: (k: number) => number;
|
|
226
|
+
};
|
|
227
|
+
|
|
197
228
|
type EventCallback<P = Any[]> = P extends Any[] ? (...args: P) => Any : never;
|
|
198
229
|
type DefaultEventDefinition = Record<string, EventCallback>;
|
|
199
230
|
type BindThisParameter<T, C = unknown> = T extends (...args: infer P) => infer R ? (this: C, ...args: P) => R : never;
|
|
@@ -215,12 +246,19 @@ declare class Event<EvtDefinition extends DefaultEventDefinition = DefaultEventD
|
|
|
215
246
|
bindWithContext<C>(c: C): (evt: keyof EvtDefinition, handler: BindThisParameter<EvtDefinition[keyof EvtDefinition], unknown extends C ? this : C>) => void;
|
|
216
247
|
}
|
|
217
248
|
|
|
249
|
+
declare function writeBoundingRectForCanvas(c: HTMLCanvasElement, w: number, h: number, dpr: number): void;
|
|
218
250
|
interface RenderViewportOptions {
|
|
219
251
|
width: number;
|
|
220
252
|
height: number;
|
|
221
253
|
devicePixelRatio: number;
|
|
222
254
|
shaow?: boolean;
|
|
223
255
|
}
|
|
256
|
+
declare class Canvas {
|
|
257
|
+
canvas: HTMLCanvasElement;
|
|
258
|
+
ctx: CanvasRenderingContext2D;
|
|
259
|
+
constructor(options: RenderViewportOptions);
|
|
260
|
+
setOptions(options: RenderViewportOptions): void;
|
|
261
|
+
}
|
|
224
262
|
declare class Render {
|
|
225
263
|
options: RenderViewportOptions;
|
|
226
264
|
private container;
|
|
@@ -233,13 +271,31 @@ declare class Render {
|
|
|
233
271
|
}
|
|
234
272
|
|
|
235
273
|
type ApplyTo = string | HTMLElement;
|
|
274
|
+
interface DrawGraphIntoCanvasOptions {
|
|
275
|
+
c: HTMLCanvasElement;
|
|
276
|
+
ctx: CanvasRenderingContext2D;
|
|
277
|
+
dpr: number;
|
|
278
|
+
}
|
|
279
|
+
declare function drawGraphIntoCanvas(graph: Display, opts: DrawGraphIntoCanvasOptions, visibleSet?: Set<number>): void;
|
|
280
|
+
interface DirtyRect {
|
|
281
|
+
x: number;
|
|
282
|
+
y: number;
|
|
283
|
+
width: number;
|
|
284
|
+
height: number;
|
|
285
|
+
}
|
|
236
286
|
declare class Schedule<D extends DefaultEventDefinition = DefaultEventDefinition> extends Box {
|
|
237
287
|
render: Render;
|
|
238
288
|
to: HTMLElement;
|
|
239
289
|
event: Event<D>;
|
|
290
|
+
private _overlays;
|
|
291
|
+
private _spatialIndex;
|
|
240
292
|
constructor(to: ApplyTo, renderOptions?: Partial<RenderViewportOptions>);
|
|
293
|
+
addOverlay(...elements: Display[]): void;
|
|
294
|
+
clearOverlay(): void;
|
|
295
|
+
/** Full redraw: clear canvas, draw all elements and overlay. Rebuilds spatial index. */
|
|
241
296
|
update(): void;
|
|
242
|
-
|
|
297
|
+
updateDirty(rects: ReadonlyArray<DirtyRect>): void;
|
|
298
|
+
execute(render: Render, graph?: Display, visibleSet?: Set<number>): void;
|
|
243
299
|
}
|
|
244
300
|
|
|
245
301
|
type Series<T> = {
|
|
@@ -280,7 +336,7 @@ type NativeModule = ReturnType<typeof bindParentForModule>[number] & {
|
|
|
280
336
|
groups: NativeModule[];
|
|
281
337
|
};
|
|
282
338
|
declare function getNodeDepth(node: NativeModule): number;
|
|
283
|
-
declare function visit<T extends AnyObject>(data: T[], fn: (data: T) => boolean | void): T | null;
|
|
339
|
+
declare function visit<T extends AnyObject>(data: T[], fn: (data: T) => boolean | void, getChildren?: (data: T) => T[] | null | undefined): T | null;
|
|
284
340
|
declare function findRelativeNode(p: {
|
|
285
341
|
x: number;
|
|
286
342
|
y: number;
|
|
@@ -315,8 +371,8 @@ declare function squarify(data: NativeModule[], rect: Rect, config: Required<Gra
|
|
|
315
371
|
declare function hashCode(str: string): number;
|
|
316
372
|
declare function perferNumeric(s: string | number): boolean;
|
|
317
373
|
declare function noop(): void;
|
|
318
|
-
declare function createRoundBlock(x: number, y: number, width: number, height: number, style?: Partial<RoundRectStyleOptions
|
|
319
|
-
declare function createTitleText(text: string, x: number, y: number, font: string, color: string): Text
|
|
374
|
+
declare function createRoundBlock<T extends Any = Any>(x: number, y: number, width: number, height: number, style?: Partial<RoundRectStyleOptions>, widget?: T): RoundRect<T>;
|
|
375
|
+
declare function createTitleText<T extends Any = Any>(text: string, x: number, y: number, font: string, color: string, widget?: T): Text<T>;
|
|
320
376
|
declare const raf: ((callback: FrameRequestCallback) => number) & typeof requestAnimationFrame;
|
|
321
377
|
declare function createCanvasElement(): HTMLCanvasElement;
|
|
322
378
|
declare function applyCanvasTransform(ctx: CanvasRenderingContext2D, matrix: Matrix2D, dpr: number): void;
|
|
@@ -345,7 +401,7 @@ declare class DefaultMap<K, V> extends Map<K, V> {
|
|
|
345
401
|
private defaultFactory;
|
|
346
402
|
constructor(defaultFactory: () => V, entries?: readonly [K, V][] | null);
|
|
347
403
|
get(key: K): V;
|
|
348
|
-
|
|
404
|
+
getOrCreate(key: K, value?: () => V): V;
|
|
349
405
|
}
|
|
350
406
|
|
|
351
407
|
interface PluginContext {
|
|
@@ -362,7 +418,7 @@ interface OnLayoutCalculatedResult {
|
|
|
362
418
|
interface PluginHooks {
|
|
363
419
|
onLoad?: (this: PluginContext, treemapContext: BasicTreemapInstance, domEvent: DOMEvent) => void | Record<string, Any>;
|
|
364
420
|
onModuleInit?: (this: PluginContext, modules: LayoutModule[]) => OnModuleInitResult | void;
|
|
365
|
-
onDOMEventTriggered?: <N extends DOMEventType>(this: PluginContext, name: N, event: DOMEventMetadata<N>,
|
|
421
|
+
onDOMEventTriggered?: <N extends DOMEventType>(this: PluginContext, name: N, event: DOMEventMetadata<N>, graphic: Box<LayoutModule> | null, domEvent: DOMEvent) => void;
|
|
366
422
|
onLayoutCalculated?: (this: PluginContext, layoutNodes: LayoutModule[], rect: Rect, viewport: Required<GraphicLayout>) => OnLayoutCalculatedResult | void;
|
|
367
423
|
onResize?: (this: PluginContext, domEvent: DOMEvent) => void;
|
|
368
424
|
onDispose?: (this: PluginContext) => void;
|
|
@@ -384,6 +440,10 @@ declare class PluginDriver<T extends Component> {
|
|
|
384
440
|
getPluginMetadata<M = Any>(pluginName: string): M | null;
|
|
385
441
|
}
|
|
386
442
|
|
|
443
|
+
declare const logger: {
|
|
444
|
+
error: (message: string) => void;
|
|
445
|
+
panic: (message: string) => never;
|
|
446
|
+
};
|
|
387
447
|
type ColorMappings = Record<string, ColorDecoratorResult>;
|
|
388
448
|
interface AABB {
|
|
389
449
|
x: number;
|
|
@@ -395,8 +455,6 @@ declare class Component extends Schedule {
|
|
|
395
455
|
pluginDriver: PluginDriver<Component>;
|
|
396
456
|
data: NativeModule[];
|
|
397
457
|
colorMappings: ColorMappings;
|
|
398
|
-
rectLayer: Box;
|
|
399
|
-
textLayer: Box;
|
|
400
458
|
layoutNodes: LayoutModule[];
|
|
401
459
|
config: GraphicConfig;
|
|
402
460
|
caches: DefaultMap<string, number>;
|
|
@@ -413,8 +471,7 @@ declare class Component extends Schedule {
|
|
|
413
471
|
f: number;
|
|
414
472
|
}): void;
|
|
415
473
|
private isAABBIntersecting;
|
|
416
|
-
|
|
417
|
-
private drawText;
|
|
474
|
+
drawNode(node: LayoutModule, box: Box | null): void;
|
|
418
475
|
draw(flush?: boolean, update?: boolean): void;
|
|
419
476
|
cleanup(): void;
|
|
420
477
|
calculateLayoutNodes(data: NativeModule[], rect: Parameters<typeof squarify>[1], scale?: number): LayoutModule[];
|
|
@@ -480,7 +537,7 @@ declare class DOMEvent extends Event<DOMEVEntDefinition> {
|
|
|
480
537
|
constructor(component: Component);
|
|
481
538
|
destory(): void;
|
|
482
539
|
private dispatch;
|
|
483
|
-
|
|
540
|
+
findRelativeGraphicNode(metadata: DOMEventMetadata<DOMEventType>): Box<LayoutModule> | null;
|
|
484
541
|
}
|
|
485
542
|
|
|
486
543
|
interface CreateTreemapOptions<P extends Plugin[]> {
|
|
@@ -514,5 +571,5 @@ declare function createTreemap<const P extends readonly Plugin[]>(options?: Crea
|
|
|
514
571
|
} & Record<string, never>) & BasicTreemapInstance & ExposedEventMethods & PluginMixins<P>;
|
|
515
572
|
type TreemapInstance<P extends readonly Plugin[]> = BasicTreemapInstance & ExposedEventMethods & PluginMixins<P>;
|
|
516
573
|
|
|
517
|
-
export { noop as
|
|
518
|
-
export type {
|
|
574
|
+
export { Box as B, traverse as F, Text as H, isGraph as I, isBox as J, isRoundRect as K, isText as O, asserts as Q, RoundRect as R, easing as U, Event as Z, drawGraphIntoCanvas as a0, Schedule as a2, writeBoundingRectForCanvas as a3, Canvas as a5, Render as a6, hashCode as a7, perferNumeric as a8, noop as a9, createRoundBlock as aa, createTitleText as ab, raf as ac, createCanvasElement as ad, applyCanvasTransform as ae, mixin as ag, typedForIn as ah, stackMatrixTransform as ai, stackMatrixTransformWithGraphAndLayer as aj, smoothFrame as ak, isScrollWheelOrRightButtonOnMouseupAndDown as al, DefaultMap as am, DOMEvent as b, createTreemap as e, c2m as g, findRelativeNode as h, findRelativeNodeById as i, flatten as j, getNodeDepth as k, definePlugin as n, Component as o, logger as p, sortChildrenByKey as s, isClickEvent as u, visit as v, isContextMenuEvent as w, isMouseEvent as x, isWheelEvent as y };
|
|
575
|
+
export type { DrawGraphIntoCanvasOptions as $, GraphicConfig as A, ColorMappings as C, DOMEventType as D, ExposedEventCallback as E, GraphicLayout as G, LayoutModule as L, Module as M, NativeModule as N, PluginContext as P, Series as S, TreemapOptions as T, DefaultEventDefinition as V, BindThisParameter as W, EventCollectionData as X, EventCollections as Y, ApplyTo as _, DOMEventMetadata as a, DirtyRect as a1, RenderViewportOptions as a4, InheritedCollectionsWithParamter as af, BasicTreemapInstance as c, CreateTreemapOptions as d, TreemapInstance as f, Plugin as l, PluginHooks as m, ExposedEventDefinition as q, ExposedEventMethods as r, PrimitiveEventMetadata as t, GraphicFont as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { _ as ApplyTo, c as BasicTreemapInstance, W as BindThisParameter, B as Box, a5 as Canvas, o as Component, d as CreateTreemapOptions, D as DOMEventType, V as DefaultEventDefinition, am as DefaultMap, a1 as DirtyRect, $ as DrawGraphIntoCanvasOptions, Z as Event, X as EventCollectionData, Y as EventCollections, E as ExposedEventCallback, q as ExposedEventDefinition, r as ExposedEventMethods, A as GraphicConfig, z as GraphicFont, G as GraphicLayout, af as InheritedCollectionsWithParamter, L as LayoutModule, M as Module, N as NativeModule, l as Plugin, P as PluginContext, m as PluginHooks, t as PrimitiveEventMetadata, a6 as Render, a4 as RenderViewportOptions, R as RoundRect, a2 as Schedule, S as Series, H as Text, f as TreemapInstance, T as TreemapOptions, ae as applyCanvasTransform, Q as asserts, g as c2m, ad as createCanvasElement, aa as createRoundBlock, ab as createTitleText, e as createTreemap, n as definePlugin, a0 as drawGraphIntoCanvas, U as easing, h as findRelativeNode, i as findRelativeNodeById, j as flattenModule, k as getNodeDepth, a7 as hashCode, J as isBox, u as isClickEvent, w as isContextMenuEvent, I as isGraph, x as isMouseEvent, K as isRoundRect, al as isScrollWheelOrRightButtonOnMouseupAndDown, O as isText, y as isWheelEvent, p as logger, ag as mixin, a9 as noop, a8 as perferNumeric, ac as raf, ak as smoothFrame, s as sortChildrenByKey, ai as stackMatrixTransform, aj as stackMatrixTransformWithGraphAndLayer, F as traverse, ah as typedForIn, v as visit, a3 as writeBoundingRectForCanvas } from './index-C0Hd4N0X.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { _ as ApplyTo, c as BasicTreemapInstance, W as BindThisParameter, B as Box, a5 as Canvas, o as Component, d as CreateTreemapOptions, D as DOMEventType, V as DefaultEventDefinition, am as DefaultMap, a1 as DirtyRect, $ as DrawGraphIntoCanvasOptions, Z as Event, X as EventCollectionData, Y as EventCollections, E as ExposedEventCallback, q as ExposedEventDefinition, r as ExposedEventMethods, A as GraphicConfig, z as GraphicFont, G as GraphicLayout, af as InheritedCollectionsWithParamter, L as LayoutModule, M as Module, N as NativeModule, l as Plugin, P as PluginContext, m as PluginHooks, t as PrimitiveEventMetadata, a6 as Render, a4 as RenderViewportOptions, R as RoundRect, a2 as Schedule, S as Series, H as Text, f as TreemapInstance, T as TreemapOptions, ae as applyCanvasTransform, Q as asserts, g as c2m, ad as createCanvasElement, aa as createRoundBlock, ab as createTitleText, e as createTreemap, n as definePlugin, a0 as drawGraphIntoCanvas, U as easing, h as findRelativeNode, i as findRelativeNodeById, j as flattenModule, k as getNodeDepth, a7 as hashCode, J as isBox, u as isClickEvent, w as isContextMenuEvent, I as isGraph, x as isMouseEvent, K as isRoundRect, al as isScrollWheelOrRightButtonOnMouseupAndDown, O as isText, y as isWheelEvent, p as logger, ag as mixin, a9 as noop, a8 as perferNumeric, ac as raf, ak as smoothFrame, s as sortChildrenByKey, ai as stackMatrixTransform, aj as stackMatrixTransformWithGraphAndLayer, F as traverse, ah as typedForIn, v as visit, a3 as writeBoundingRectForCanvas } from './index-C0Hd4N0X.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var domEvent = require('./dom-event-
|
|
3
|
+
var domEvent = require('./dom-event-BkRCiIWB.js');
|
|
4
4
|
|
|
5
5
|
function createTreemap(// @ts-expect-error todo fix
|
|
6
6
|
options) {
|
|
@@ -55,7 +55,6 @@ options) {
|
|
|
55
55
|
width,
|
|
56
56
|
devicePixelRatio: window.devicePixelRatio
|
|
57
57
|
});
|
|
58
|
-
component.render.canvas.style.position = 'absolute';
|
|
59
58
|
if (domEvent$1) {
|
|
60
59
|
component.pluginDriver.runHook('onResize', domEvent$1);
|
|
61
60
|
}
|
|
@@ -80,23 +79,39 @@ options) {
|
|
|
80
79
|
return base;
|
|
81
80
|
}
|
|
82
81
|
|
|
82
|
+
exports.Box = domEvent.Box;
|
|
83
|
+
exports.Canvas = domEvent.Canvas;
|
|
84
|
+
exports.Component = domEvent.Component;
|
|
83
85
|
exports.DefaultMap = domEvent.DefaultMap;
|
|
86
|
+
exports.Event = domEvent.Event;
|
|
87
|
+
exports.Render = domEvent.Render;
|
|
88
|
+
exports.RoundRect = domEvent.RoundRect;
|
|
89
|
+
exports.Schedule = domEvent.Schedule;
|
|
90
|
+
exports.Text = domEvent.Text;
|
|
84
91
|
exports.applyCanvasTransform = domEvent.applyCanvasTransform;
|
|
92
|
+
exports.asserts = domEvent.asserts;
|
|
85
93
|
exports.c2m = domEvent.c2m;
|
|
86
94
|
exports.createCanvasElement = domEvent.createCanvasElement;
|
|
87
95
|
exports.createRoundBlock = domEvent.createRoundBlock;
|
|
88
96
|
exports.createTitleText = domEvent.createTitleText;
|
|
89
97
|
exports.definePlugin = domEvent.definePlugin;
|
|
98
|
+
exports.drawGraphIntoCanvas = domEvent.drawGraphIntoCanvas;
|
|
99
|
+
exports.easing = domEvent.easing;
|
|
90
100
|
exports.findRelativeNode = domEvent.findRelativeNode;
|
|
91
101
|
exports.findRelativeNodeById = domEvent.findRelativeNodeById;
|
|
92
102
|
exports.flattenModule = domEvent.flatten;
|
|
93
103
|
exports.getNodeDepth = domEvent.getNodeDepth;
|
|
94
104
|
exports.hashCode = domEvent.hashCode;
|
|
105
|
+
exports.isBox = domEvent.isBox;
|
|
95
106
|
exports.isClickEvent = domEvent.isClickEvent;
|
|
96
107
|
exports.isContextMenuEvent = domEvent.isContextMenuEvent;
|
|
108
|
+
exports.isGraph = domEvent.isGraph;
|
|
97
109
|
exports.isMouseEvent = domEvent.isMouseEvent;
|
|
110
|
+
exports.isRoundRect = domEvent.isRoundRect;
|
|
98
111
|
exports.isScrollWheelOrRightButtonOnMouseupAndDown = domEvent.isScrollWheelOrRightButtonOnMouseupAndDown;
|
|
112
|
+
exports.isText = domEvent.isText;
|
|
99
113
|
exports.isWheelEvent = domEvent.isWheelEvent;
|
|
114
|
+
exports.logger = domEvent.logger;
|
|
100
115
|
exports.mixin = domEvent.mixin;
|
|
101
116
|
exports.noop = domEvent.noop;
|
|
102
117
|
exports.perferNumeric = domEvent.perferNumeric;
|
|
@@ -105,6 +120,8 @@ exports.smoothFrame = domEvent.smoothFrame;
|
|
|
105
120
|
exports.sortChildrenByKey = domEvent.sortChildrenByKey;
|
|
106
121
|
exports.stackMatrixTransform = domEvent.stackMatrixTransform;
|
|
107
122
|
exports.stackMatrixTransformWithGraphAndLayer = domEvent.stackMatrixTransformWithGraphAndLayer;
|
|
123
|
+
exports.traverse = domEvent.traverse;
|
|
108
124
|
exports.typedForIn = domEvent.typedForIn;
|
|
109
125
|
exports.visit = domEvent.visit;
|
|
126
|
+
exports.writeBoundingRectForCanvas = domEvent.writeBoundingRectForCanvas;
|
|
110
127
|
exports.createTreemap = createTreemap;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as logger, m as mixin, E as Event, a as assertExists, b as bindParentForModule, C as Component, D as DOMEvent } from './dom-event-
|
|
2
|
-
export {
|
|
1
|
+
import { l as logger, m as mixin, E as Event, a as assertExists, b as bindParentForModule, C as Component, D as DOMEvent } from './dom-event-CBrOg7CX.mjs';
|
|
2
|
+
export { B as Box, z as Canvas, V as DefaultMap, A as Render, R as RoundRect, S as Schedule, T as Text, M as applyCanvasTransform, u as asserts, c as c2m, L as createCanvasElement, I as createRoundBlock, J as createTitleText, h as definePlugin, x as drawGraphIntoCanvas, w as easing, f as findRelativeNode, d as findRelativeNodeById, e as flattenModule, g as getNodeDepth, F as hashCode, p as isBox, i as isClickEvent, j as isContextMenuEvent, o as isGraph, k as isMouseEvent, q as isRoundRect, U as isScrollWheelOrRightButtonOnMouseupAndDown, r as isText, n as isWheelEvent, H as noop, G as perferNumeric, K as raf, Q as smoothFrame, s as sortChildrenByKey, O as stackMatrixTransform, P as stackMatrixTransformWithGraphAndLayer, t as traverse, N as typedForIn, v as visit, y as writeBoundingRectForCanvas } from './dom-event-CBrOg7CX.mjs';
|
|
3
3
|
|
|
4
4
|
function createTreemap(// @ts-expect-error todo fix
|
|
5
5
|
options) {
|
|
@@ -54,7 +54,6 @@ options) {
|
|
|
54
54
|
width,
|
|
55
55
|
devicePixelRatio: window.devicePixelRatio
|
|
56
56
|
});
|
|
57
|
-
component.render.canvas.style.position = 'absolute';
|
|
58
57
|
if (domEvent) {
|
|
59
58
|
component.pluginDriver.runHook('onResize', domEvent);
|
|
60
59
|
}
|
|
@@ -79,4 +78,4 @@ options) {
|
|
|
79
78
|
return base;
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
export { createTreemap, mixin };
|
|
81
|
+
export { Component, Event, createTreemap, logger, mixin };
|
package/dist/plugin.d.mts
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare const presetHighlightPlugin: {
|
|
4
|
-
name: "treemap:preset-highlight";
|
|
5
|
-
onLoad(this: PluginContext): void;
|
|
6
|
-
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, name: N, _: DOMEventMetadata<N>, module: LayoutModule | null, { stateManager: state, matrix }: DOMEvent): void;
|
|
7
|
-
onResize(this: PluginContext): void;
|
|
8
|
-
onDispose(this: PluginContext): void;
|
|
9
|
-
meta: {
|
|
10
|
-
highlight: null;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
1
|
+
import { D as DOMEventType, P as PluginContext, a as DOMEventMetadata, B as Box, L as LayoutModule, b as DOMEvent, C as ColorMappings, c as BasicTreemapInstance } from './index-C0Hd4N0X.js';
|
|
13
2
|
|
|
14
3
|
declare const presetDragElementPlugin: {
|
|
15
4
|
name: "treemap:preset-drag-element";
|
|
16
|
-
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, name: N, event: DOMEventMetadata<N>, module: LayoutModule | null, domEvent: DOMEvent): void;
|
|
5
|
+
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, name: N, event: DOMEventMetadata<N>, module: Box<LayoutModule> | null, domEvent: DOMEvent): void;
|
|
17
6
|
meta: {
|
|
18
7
|
dragOptions: {
|
|
19
8
|
x: number;
|
|
@@ -25,6 +14,17 @@ declare const presetDragElementPlugin: {
|
|
|
25
14
|
onResize(this: PluginContext, { matrix, stateManager: state }: DOMEvent): void;
|
|
26
15
|
};
|
|
27
16
|
|
|
17
|
+
declare const presetHighlightPlugin: {
|
|
18
|
+
name: "treemap:preset-highlight";
|
|
19
|
+
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, name: N, _: DOMEventMetadata<N>, graphic: Box<LayoutModule> | null, { stateManager: state, matrix, component }: DOMEvent): void;
|
|
20
|
+
onResize(this: PluginContext): void;
|
|
21
|
+
onDispose(this: PluginContext): void;
|
|
22
|
+
meta: {
|
|
23
|
+
overlayGraphic: null;
|
|
24
|
+
lastDirtyRect: null;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
28
|
interface MenuRenderConfig {
|
|
29
29
|
html: string;
|
|
30
30
|
action: string;
|
|
@@ -32,11 +32,11 @@ interface MenuRenderConfig {
|
|
|
32
32
|
interface MenuPluginOptions {
|
|
33
33
|
style?: Partial<CSSStyleDeclaration>;
|
|
34
34
|
render?: (menu: HTMLDivElement) => MenuRenderConfig[];
|
|
35
|
-
onClick?: (action: string, module: LayoutModule | null) => void;
|
|
35
|
+
onClick?: (action: string, module: Box<LayoutModule> | null) => void;
|
|
36
36
|
}
|
|
37
37
|
declare function presetMenuPlugin(options?: MenuPluginOptions): {
|
|
38
38
|
name: "treemap:preset-menu";
|
|
39
|
-
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, _: N, event: DOMEventMetadata<N>, __: LayoutModule | null, DOMEvent: DOMEvent): void;
|
|
39
|
+
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, _: N, event: DOMEventMetadata<N>, __: Box<LayoutModule> | null, DOMEvent: DOMEvent): void;
|
|
40
40
|
onDispose(this: PluginContext): void;
|
|
41
41
|
};
|
|
42
42
|
|
|
@@ -50,24 +50,38 @@ declare const presetColorPlugin: {
|
|
|
50
50
|
interface ScalePluginOptions {
|
|
51
51
|
/**
|
|
52
52
|
* @default Infinity
|
|
53
|
-
* @description The maximum scale factor for the treemap.
|
|
54
53
|
*/
|
|
55
54
|
max?: number;
|
|
56
55
|
/**
|
|
57
56
|
* @default 0.1
|
|
58
|
-
* @description The minimum scale factor for the treemap.
|
|
59
57
|
*/
|
|
60
58
|
min?: number;
|
|
59
|
+
springStiffness?: number;
|
|
60
|
+
springDamping?: number;
|
|
61
|
+
overshootResistance?: number;
|
|
62
|
+
overshootLimitFactor?: number;
|
|
63
|
+
wheelDebounce?: number;
|
|
64
|
+
animationsEnabled?: boolean;
|
|
61
65
|
}
|
|
62
66
|
declare function presetScalePlugin(options?: ScalePluginOptions): {
|
|
63
67
|
name: "treemap:preset-scale";
|
|
64
|
-
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, _: N, event: DOMEventMetadata<N>, module: LayoutModule | null, evt: DOMEvent): void;
|
|
68
|
+
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, _: N, event: DOMEventMetadata<N>, module: Box<LayoutModule> | null, evt: DOMEvent): void;
|
|
65
69
|
meta: {
|
|
66
70
|
scaleOptions: {
|
|
67
71
|
scale: number;
|
|
72
|
+
virtualScale: number;
|
|
68
73
|
minScale: number;
|
|
69
74
|
maxScale: number;
|
|
70
75
|
scaleFactor: number;
|
|
76
|
+
springStiffness: number;
|
|
77
|
+
springDamping: number;
|
|
78
|
+
overshootResistance: number;
|
|
79
|
+
overshootLimitFactor: number;
|
|
80
|
+
lastAnchorX: undefined;
|
|
81
|
+
lastAnchorY: undefined;
|
|
82
|
+
springRafId: null;
|
|
83
|
+
animationsEnabled: boolean;
|
|
84
|
+
wheelDebounce: number;
|
|
71
85
|
};
|
|
72
86
|
gestureState: {
|
|
73
87
|
isTrackingGesture: false;
|
|
@@ -78,6 +92,7 @@ declare function presetScalePlugin(options?: ScalePluginOptions): {
|
|
|
78
92
|
consecutivePinchEvents: number;
|
|
79
93
|
gestureType: "unknown";
|
|
80
94
|
lockGestureType: false;
|
|
95
|
+
wheelEndTimeoutId: null;
|
|
81
96
|
};
|
|
82
97
|
};
|
|
83
98
|
onResize(this: PluginContext, { matrix, stateManager: state }: DOMEvent): void;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare const presetHighlightPlugin: {
|
|
4
|
-
name: "treemap:preset-highlight";
|
|
5
|
-
onLoad(this: PluginContext): void;
|
|
6
|
-
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, name: N, _: DOMEventMetadata<N>, module: LayoutModule | null, { stateManager: state, matrix }: DOMEvent): void;
|
|
7
|
-
onResize(this: PluginContext): void;
|
|
8
|
-
onDispose(this: PluginContext): void;
|
|
9
|
-
meta: {
|
|
10
|
-
highlight: null;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
1
|
+
import { D as DOMEventType, P as PluginContext, a as DOMEventMetadata, B as Box, L as LayoutModule, b as DOMEvent, C as ColorMappings, c as BasicTreemapInstance } from './index-C0Hd4N0X.js';
|
|
13
2
|
|
|
14
3
|
declare const presetDragElementPlugin: {
|
|
15
4
|
name: "treemap:preset-drag-element";
|
|
16
|
-
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, name: N, event: DOMEventMetadata<N>, module: LayoutModule | null, domEvent: DOMEvent): void;
|
|
5
|
+
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, name: N, event: DOMEventMetadata<N>, module: Box<LayoutModule> | null, domEvent: DOMEvent): void;
|
|
17
6
|
meta: {
|
|
18
7
|
dragOptions: {
|
|
19
8
|
x: number;
|
|
@@ -25,6 +14,17 @@ declare const presetDragElementPlugin: {
|
|
|
25
14
|
onResize(this: PluginContext, { matrix, stateManager: state }: DOMEvent): void;
|
|
26
15
|
};
|
|
27
16
|
|
|
17
|
+
declare const presetHighlightPlugin: {
|
|
18
|
+
name: "treemap:preset-highlight";
|
|
19
|
+
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, name: N, _: DOMEventMetadata<N>, graphic: Box<LayoutModule> | null, { stateManager: state, matrix, component }: DOMEvent): void;
|
|
20
|
+
onResize(this: PluginContext): void;
|
|
21
|
+
onDispose(this: PluginContext): void;
|
|
22
|
+
meta: {
|
|
23
|
+
overlayGraphic: null;
|
|
24
|
+
lastDirtyRect: null;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
28
|
interface MenuRenderConfig {
|
|
29
29
|
html: string;
|
|
30
30
|
action: string;
|
|
@@ -32,11 +32,11 @@ interface MenuRenderConfig {
|
|
|
32
32
|
interface MenuPluginOptions {
|
|
33
33
|
style?: Partial<CSSStyleDeclaration>;
|
|
34
34
|
render?: (menu: HTMLDivElement) => MenuRenderConfig[];
|
|
35
|
-
onClick?: (action: string, module: LayoutModule | null) => void;
|
|
35
|
+
onClick?: (action: string, module: Box<LayoutModule> | null) => void;
|
|
36
36
|
}
|
|
37
37
|
declare function presetMenuPlugin(options?: MenuPluginOptions): {
|
|
38
38
|
name: "treemap:preset-menu";
|
|
39
|
-
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, _: N, event: DOMEventMetadata<N>, __: LayoutModule | null, DOMEvent: DOMEvent): void;
|
|
39
|
+
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, _: N, event: DOMEventMetadata<N>, __: Box<LayoutModule> | null, DOMEvent: DOMEvent): void;
|
|
40
40
|
onDispose(this: PluginContext): void;
|
|
41
41
|
};
|
|
42
42
|
|
|
@@ -50,24 +50,38 @@ declare const presetColorPlugin: {
|
|
|
50
50
|
interface ScalePluginOptions {
|
|
51
51
|
/**
|
|
52
52
|
* @default Infinity
|
|
53
|
-
* @description The maximum scale factor for the treemap.
|
|
54
53
|
*/
|
|
55
54
|
max?: number;
|
|
56
55
|
/**
|
|
57
56
|
* @default 0.1
|
|
58
|
-
* @description The minimum scale factor for the treemap.
|
|
59
57
|
*/
|
|
60
58
|
min?: number;
|
|
59
|
+
springStiffness?: number;
|
|
60
|
+
springDamping?: number;
|
|
61
|
+
overshootResistance?: number;
|
|
62
|
+
overshootLimitFactor?: number;
|
|
63
|
+
wheelDebounce?: number;
|
|
64
|
+
animationsEnabled?: boolean;
|
|
61
65
|
}
|
|
62
66
|
declare function presetScalePlugin(options?: ScalePluginOptions): {
|
|
63
67
|
name: "treemap:preset-scale";
|
|
64
|
-
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, _: N, event: DOMEventMetadata<N>, module: LayoutModule | null, evt: DOMEvent): void;
|
|
68
|
+
onDOMEventTriggered<N extends DOMEventType>(this: PluginContext, _: N, event: DOMEventMetadata<N>, module: Box<LayoutModule> | null, evt: DOMEvent): void;
|
|
65
69
|
meta: {
|
|
66
70
|
scaleOptions: {
|
|
67
71
|
scale: number;
|
|
72
|
+
virtualScale: number;
|
|
68
73
|
minScale: number;
|
|
69
74
|
maxScale: number;
|
|
70
75
|
scaleFactor: number;
|
|
76
|
+
springStiffness: number;
|
|
77
|
+
springDamping: number;
|
|
78
|
+
overshootResistance: number;
|
|
79
|
+
overshootLimitFactor: number;
|
|
80
|
+
lastAnchorX: undefined;
|
|
81
|
+
lastAnchorY: undefined;
|
|
82
|
+
springRafId: null;
|
|
83
|
+
animationsEnabled: boolean;
|
|
84
|
+
wheelDebounce: number;
|
|
71
85
|
};
|
|
72
86
|
gestureState: {
|
|
73
87
|
isTrackingGesture: false;
|
|
@@ -78,6 +92,7 @@ declare function presetScalePlugin(options?: ScalePluginOptions): {
|
|
|
78
92
|
consecutivePinchEvents: number;
|
|
79
93
|
gestureType: "unknown";
|
|
80
94
|
lockGestureType: false;
|
|
95
|
+
wheelEndTimeoutId: null;
|
|
81
96
|
};
|
|
82
97
|
};
|
|
83
98
|
onResize(this: PluginContext, { matrix, stateManager: state }: DOMEvent): void;
|