squarified 0.4.0 → 0.4.2
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-BLJt9knO.mjs +1646 -0
- package/dist/dom-event-CeVZ44nB.js +1686 -0
- package/dist/index-BoUEaWVv.d.ts +520 -0
- package/dist/index.d.mts +1 -620
- package/dist/index.d.ts +1 -620
- package/dist/index.js +113 -100
- package/dist/index.mjs +82 -69
- package/dist/plugin.d.mts +74 -427
- package/dist/plugin.d.ts +74 -427
- package/dist/plugin.js +451 -372
- package/dist/plugin.mjs +440 -362
- package/package.json +9 -6
- package/dist/dom-event-BPqG0KO2.js +0 -1712
- package/dist/dom-event-DQ8OFrZa.mjs +0 -1471
package/dist/index.js
CHANGED
|
@@ -1,103 +1,116 @@
|
|
|
1
|
-
|
|
2
|
-
const require_dom_event = require('./dom-event-BPqG0KO2.js');
|
|
1
|
+
'use strict';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
3
|
+
var domEvent = require('./dom-event-CeVZ44nB.js');
|
|
4
|
+
|
|
5
|
+
function createTreemap(// @ts-expect-error todo fix
|
|
6
|
+
options) {
|
|
7
|
+
const { plugins = [], graphic = {} } = options || {};
|
|
8
|
+
let root = null;
|
|
9
|
+
let installed = false;
|
|
10
|
+
let domEvent$1 = null;
|
|
11
|
+
let component = null;
|
|
12
|
+
const exposedEvent = new domEvent.Event();
|
|
13
|
+
if (!Array.isArray(plugins)) {
|
|
14
|
+
domEvent.logger.panic('Plugins should be an array');
|
|
15
|
+
}
|
|
16
|
+
const api = {
|
|
17
|
+
zoom: domEvent.noop
|
|
18
|
+
};
|
|
19
|
+
const ctx = {
|
|
20
|
+
init,
|
|
21
|
+
dispose,
|
|
22
|
+
resize,
|
|
23
|
+
setOptions
|
|
24
|
+
};
|
|
25
|
+
function init(el) {
|
|
26
|
+
component = new domEvent.Component(graphic, el);
|
|
27
|
+
domEvent$1 = new domEvent.DOMEvent(component);
|
|
28
|
+
root = el;
|
|
29
|
+
root.style.position = 'relative';
|
|
30
|
+
if (!installed) {
|
|
31
|
+
plugins.forEach((plugin)=>component?.pluginDriver.use(plugin));
|
|
32
|
+
installed = true;
|
|
33
|
+
component.pluginDriver.runHook('onLoad', ctx, domEvent$1);
|
|
34
|
+
}
|
|
35
|
+
domEvent$1.on('__exposed__', (type, args)=>exposedEvent.emit(type, args));
|
|
36
|
+
}
|
|
37
|
+
function dispose() {
|
|
38
|
+
if (root && component && domEvent$1) {
|
|
39
|
+
domEvent$1.destory();
|
|
40
|
+
component.destory();
|
|
41
|
+
root.removeChild(root.firstChild);
|
|
42
|
+
for(const evt in exposedEvent.eventCollections){
|
|
43
|
+
exposedEvent.off(evt);
|
|
44
|
+
}
|
|
45
|
+
component.pluginDriver.runHook('onDispose');
|
|
46
|
+
root = null;
|
|
47
|
+
component = null;
|
|
48
|
+
domEvent$1 = null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function resize() {
|
|
52
|
+
if (!component || !root) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const { width, height } = root.getBoundingClientRect();
|
|
56
|
+
component.render.initOptions({
|
|
57
|
+
height,
|
|
58
|
+
width,
|
|
59
|
+
devicePixelRatio: window.devicePixelRatio
|
|
60
|
+
});
|
|
61
|
+
component.render.canvas.style.position = 'absolute';
|
|
62
|
+
if (domEvent$1) {
|
|
63
|
+
component.pluginDriver.runHook('onResize', domEvent$1);
|
|
64
|
+
}
|
|
65
|
+
component.cleanup();
|
|
66
|
+
component.draw();
|
|
67
|
+
}
|
|
68
|
+
function setOptions(options) {
|
|
69
|
+
domEvent.assertExists(component, domEvent.logger, 'Treemap not initialized. Please call `init()` before setOptions.');
|
|
70
|
+
component.data = domEvent.bindParentForModule(options.data);
|
|
71
|
+
resize();
|
|
72
|
+
}
|
|
73
|
+
const base = domEvent.mixin(ctx, [
|
|
74
|
+
{
|
|
75
|
+
name: 'on',
|
|
76
|
+
fn: ()=>exposedEvent.bindWithContext(api)
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'off',
|
|
80
|
+
fn: ()=>exposedEvent.off.bind(exposedEvent)
|
|
81
|
+
}
|
|
82
|
+
]);
|
|
83
|
+
return base;
|
|
70
84
|
}
|
|
71
85
|
|
|
72
|
-
|
|
73
|
-
exports.
|
|
74
|
-
exports.
|
|
75
|
-
exports.
|
|
76
|
-
exports.
|
|
77
|
-
exports.
|
|
78
|
-
exports.
|
|
79
|
-
exports.
|
|
80
|
-
exports.
|
|
81
|
-
exports.
|
|
82
|
-
exports.
|
|
83
|
-
exports.
|
|
84
|
-
exports.
|
|
85
|
-
exports.
|
|
86
|
-
exports.
|
|
87
|
-
exports.
|
|
88
|
-
exports.
|
|
89
|
-
exports.
|
|
90
|
-
exports.
|
|
91
|
-
exports.
|
|
92
|
-
exports.
|
|
93
|
-
exports.
|
|
94
|
-
exports.
|
|
95
|
-
exports.
|
|
96
|
-
exports.
|
|
97
|
-
exports.
|
|
98
|
-
exports.
|
|
99
|
-
exports.
|
|
100
|
-
exports.
|
|
101
|
-
exports.
|
|
102
|
-
exports.
|
|
103
|
-
exports.visit = require_dom_event.visit
|
|
86
|
+
exports.DefaultMap = domEvent.DefaultMap;
|
|
87
|
+
exports.applyCanvasTransform = domEvent.applyCanvasTransform;
|
|
88
|
+
exports.c2m = domEvent.c2m;
|
|
89
|
+
exports.createCanvasElement = domEvent.createCanvasElement;
|
|
90
|
+
exports.createRoundBlock = domEvent.createRoundBlock;
|
|
91
|
+
exports.createTitleText = domEvent.createTitleText;
|
|
92
|
+
exports.definePlugin = domEvent.definePlugin;
|
|
93
|
+
exports.findRelativeNode = domEvent.findRelativeNode;
|
|
94
|
+
exports.findRelativeNodeById = domEvent.findRelativeNodeById;
|
|
95
|
+
exports.flattenModule = domEvent.flatten;
|
|
96
|
+
exports.getNodeDepth = domEvent.getNodeDepth;
|
|
97
|
+
exports.hashCode = domEvent.hashCode;
|
|
98
|
+
exports.isClickEvent = domEvent.isClickEvent;
|
|
99
|
+
exports.isContextMenuEvent = domEvent.isContextMenuEvent;
|
|
100
|
+
exports.isMacOS = domEvent.isMacOS;
|
|
101
|
+
exports.isMouseEvent = domEvent.isMouseEvent;
|
|
102
|
+
exports.isScrollWheelOrRightButtonOnMouseupAndDown = domEvent.isScrollWheelOrRightButtonOnMouseupAndDown;
|
|
103
|
+
exports.isWheelEvent = domEvent.isWheelEvent;
|
|
104
|
+
exports.mixin = domEvent.mixin;
|
|
105
|
+
exports.mixinWithParams = domEvent.mixinWithParams;
|
|
106
|
+
exports.noop = domEvent.noop;
|
|
107
|
+
exports.perferNumeric = domEvent.perferNumeric;
|
|
108
|
+
exports.prettyStrJoin = domEvent.prettyStrJoin;
|
|
109
|
+
exports.raf = domEvent.raf;
|
|
110
|
+
exports.smoothFrame = domEvent.smoothFrame;
|
|
111
|
+
exports.sortChildrenByKey = domEvent.sortChildrenByKey;
|
|
112
|
+
exports.stackMatrixTransform = domEvent.stackMatrixTransform;
|
|
113
|
+
exports.stackMatrixTransformWithGraphAndLayer = domEvent.stackMatrixTransformWithGraphAndLayer;
|
|
114
|
+
exports.typedForIn = domEvent.typedForIn;
|
|
115
|
+
exports.visit = domEvent.visit;
|
|
116
|
+
exports.createTreemap = createTreemap;
|
package/dist/index.mjs
CHANGED
|
@@ -1,72 +1,85 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as logger, m as mixin, E as Event, n as noop, a as assertExists, b as bindParentForModule, C as Component, D as DOMEvent } from './dom-event-BLJt9knO.mjs';
|
|
2
|
+
export { J as DefaultMap, x as applyCanvasTransform, c as c2m, w as createCanvasElement, r as createRoundBlock, t as createTitleText, h as definePlugin, f as findRelativeNode, d as findRelativeNodeById, e as flattenModule, g as getNodeDepth, p as hashCode, i as isClickEvent, j as isContextMenuEvent, A as isMacOS, k as isMouseEvent, I as isScrollWheelOrRightButtonOnMouseupAndDown, o as isWheelEvent, y as mixinWithParams, q as perferNumeric, z as prettyStrJoin, u as raf, H as smoothFrame, s as sortChildrenByKey, F as stackMatrixTransform, G as stackMatrixTransformWithGraphAndLayer, B as typedForIn, v as visit } from './dom-event-BLJt9knO.mjs';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
4
|
+
function createTreemap(// @ts-expect-error todo fix
|
|
5
|
+
options) {
|
|
6
|
+
const { plugins = [], graphic = {} } = options || {};
|
|
7
|
+
let root = null;
|
|
8
|
+
let installed = false;
|
|
9
|
+
let domEvent = null;
|
|
10
|
+
let component = null;
|
|
11
|
+
const exposedEvent = new Event();
|
|
12
|
+
if (!Array.isArray(plugins)) {
|
|
13
|
+
logger.panic('Plugins should be an array');
|
|
14
|
+
}
|
|
15
|
+
const api = {
|
|
16
|
+
zoom: noop
|
|
17
|
+
};
|
|
18
|
+
const ctx = {
|
|
19
|
+
init,
|
|
20
|
+
dispose,
|
|
21
|
+
resize,
|
|
22
|
+
setOptions
|
|
23
|
+
};
|
|
24
|
+
function init(el) {
|
|
25
|
+
component = new Component(graphic, el);
|
|
26
|
+
domEvent = new DOMEvent(component);
|
|
27
|
+
root = el;
|
|
28
|
+
root.style.position = 'relative';
|
|
29
|
+
if (!installed) {
|
|
30
|
+
plugins.forEach((plugin)=>component?.pluginDriver.use(plugin));
|
|
31
|
+
installed = true;
|
|
32
|
+
component.pluginDriver.runHook('onLoad', ctx, domEvent);
|
|
33
|
+
}
|
|
34
|
+
domEvent.on('__exposed__', (type, args)=>exposedEvent.emit(type, args));
|
|
35
|
+
}
|
|
36
|
+
function dispose() {
|
|
37
|
+
if (root && component && domEvent) {
|
|
38
|
+
domEvent.destory();
|
|
39
|
+
component.destory();
|
|
40
|
+
root.removeChild(root.firstChild);
|
|
41
|
+
for(const evt in exposedEvent.eventCollections){
|
|
42
|
+
exposedEvent.off(evt);
|
|
43
|
+
}
|
|
44
|
+
component.pluginDriver.runHook('onDispose');
|
|
45
|
+
root = null;
|
|
46
|
+
component = null;
|
|
47
|
+
domEvent = null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function resize() {
|
|
51
|
+
if (!component || !root) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const { width, height } = root.getBoundingClientRect();
|
|
55
|
+
component.render.initOptions({
|
|
56
|
+
height,
|
|
57
|
+
width,
|
|
58
|
+
devicePixelRatio: window.devicePixelRatio
|
|
59
|
+
});
|
|
60
|
+
component.render.canvas.style.position = 'absolute';
|
|
61
|
+
if (domEvent) {
|
|
62
|
+
component.pluginDriver.runHook('onResize', domEvent);
|
|
63
|
+
}
|
|
64
|
+
component.cleanup();
|
|
65
|
+
component.draw();
|
|
66
|
+
}
|
|
67
|
+
function setOptions(options) {
|
|
68
|
+
assertExists(component, logger, 'Treemap not initialized. Please call `init()` before setOptions.');
|
|
69
|
+
component.data = bindParentForModule(options.data);
|
|
70
|
+
resize();
|
|
71
|
+
}
|
|
72
|
+
const base = mixin(ctx, [
|
|
73
|
+
{
|
|
74
|
+
name: 'on',
|
|
75
|
+
fn: ()=>exposedEvent.bindWithContext(api)
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'off',
|
|
79
|
+
fn: ()=>exposedEvent.off.bind(exposedEvent)
|
|
80
|
+
}
|
|
81
|
+
]);
|
|
82
|
+
return base;
|
|
69
83
|
}
|
|
70
84
|
|
|
71
|
-
|
|
72
|
-
export { DefaultMap, applyCanvasTransform, c2m, createCanvasElement, createRoundBlock, createTitleText, createTreemap, definePlugin, findRelativeNode, findRelativeNodeById, flatten as flattenModule, getNodeDepth, hashCode, isClickEvent, isContextMenuEvent, isMacOS, isMouseEvent, isScrollWheelOrRightButtonOnMouseupAndDown, isWheelEvent, mixin, mixinWithParams, noop, perferNumeric, prettyStrJoin, raf, smoothFrame, sortChildrenByKey, stackMatrixTransform, stackMatrixTransformWithGraphAndLayer, typedForIn, visit };
|
|
85
|
+
export { createTreemap, mixin, noop };
|