@meursyphus/flitter 0.0.7 → 0.0.8
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/index.cjs → index.cjs} +259 -152
- package/{dist/index.d.cts → index.d.cts} +131 -22
- package/{dist/index.d.ts → index.d.ts} +131 -22
- package/{dist/index.global.js → index.global.js} +264 -157
- package/{dist/index.js → index.js} +259 -152
- package/package.json +8 -3
- package/.eslintrc.cjs +0 -35
- package/.prettierrc +0 -9
- package/dist/README.md +0 -73
- package/dist/package.json +0 -61
- package/tsconfig.json +0 -18
- package/tsup.config.ts +0 -10
|
@@ -414,18 +414,6 @@ function createUniqueId() {
|
|
|
414
414
|
return (id++).toString();
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
-
// src/utils/TypedObject.ts
|
|
418
|
-
function entries(obj) {
|
|
419
|
-
return Object.entries(obj);
|
|
420
|
-
}
|
|
421
|
-
function keys(obj) {
|
|
422
|
-
return Object.keys(obj);
|
|
423
|
-
}
|
|
424
|
-
var TypedObject_default = {
|
|
425
|
-
entries,
|
|
426
|
-
keys
|
|
427
|
-
};
|
|
428
|
-
|
|
429
417
|
// src/utils/index.ts
|
|
430
418
|
var _Utils = class _Utils {
|
|
431
419
|
static sum(values) {
|
|
@@ -11960,6 +11948,14 @@ var ToolTipPosition = /* @__PURE__ */ ((ToolTipPosition2) => {
|
|
|
11960
11948
|
return ToolTipPosition2;
|
|
11961
11949
|
})(ToolTipPosition || {});
|
|
11962
11950
|
|
|
11951
|
+
// src/exception/index.ts
|
|
11952
|
+
var NotImplementedError = class extends Error {
|
|
11953
|
+
constructor(method) {
|
|
11954
|
+
super(`${method} is not implemented`);
|
|
11955
|
+
this.name = "NotImplementedError";
|
|
11956
|
+
}
|
|
11957
|
+
};
|
|
11958
|
+
|
|
11963
11959
|
// src/renderobject/RenderObject.ts
|
|
11964
11960
|
var _domNode, _domOrder, _domOrderChanged;
|
|
11965
11961
|
var RenderObject = class {
|
|
@@ -11996,8 +11992,11 @@ var RenderObject = class {
|
|
|
11996
11992
|
set domOrder(newOrder) {
|
|
11997
11993
|
if (newOrder === __privateGet(this, _domOrder))
|
|
11998
11994
|
return;
|
|
11999
|
-
__privateSet(this, _domOrderChanged, true);
|
|
12000
11995
|
__privateSet(this, _domOrder, newOrder);
|
|
11996
|
+
this.didDomOrderChange();
|
|
11997
|
+
}
|
|
11998
|
+
didDomOrderChange() {
|
|
11999
|
+
__privateSet(this, _domOrderChanged, true);
|
|
12001
12000
|
}
|
|
12002
12001
|
get domNode() {
|
|
12003
12002
|
assert(__privateGet(this, _domNode) != null, "domNode is not initialized");
|
|
@@ -12091,7 +12090,7 @@ var RenderObject = class {
|
|
|
12091
12090
|
this.ownerElement = ownerElement;
|
|
12092
12091
|
this.depth = ownerElement.depth;
|
|
12093
12092
|
if (this.isPainter) {
|
|
12094
|
-
this.mountSvgEl(this.renderOwner.paintContext);
|
|
12093
|
+
this.mountSvgEl(this.renderOwner.renderContext.paintContext);
|
|
12095
12094
|
this.renderOwner.didDomOrderChange();
|
|
12096
12095
|
}
|
|
12097
12096
|
}
|
|
@@ -12125,8 +12124,8 @@ var RenderObject = class {
|
|
|
12125
12124
|
resolveSvgEl() {
|
|
12126
12125
|
const container = this.domNode;
|
|
12127
12126
|
const svgEls = {};
|
|
12128
|
-
for (
|
|
12129
|
-
const child =
|
|
12127
|
+
for (const element of container.children) {
|
|
12128
|
+
const child = element;
|
|
12130
12129
|
const name = child.getAttribute("data-render-name");
|
|
12131
12130
|
svgEls[name] = child;
|
|
12132
12131
|
}
|
|
@@ -12135,7 +12134,10 @@ var RenderObject = class {
|
|
|
12135
12134
|
rearrangeDomOrder() {
|
|
12136
12135
|
if (!__privateGet(this, _domOrderChanged))
|
|
12137
12136
|
return;
|
|
12138
|
-
this.isPainter && this.renderOwner.paintContext.insertSvgEl(
|
|
12137
|
+
this.isPainter && this.renderOwner.renderContext.paintContext.insertSvgEl(
|
|
12138
|
+
this.domNode,
|
|
12139
|
+
this.domOrder
|
|
12140
|
+
);
|
|
12139
12141
|
__privateSet(this, _domOrderChanged, false);
|
|
12140
12142
|
}
|
|
12141
12143
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -12147,7 +12149,7 @@ var RenderObject = class {
|
|
|
12147
12149
|
*/
|
|
12148
12150
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12149
12151
|
preformLayout() {
|
|
12150
|
-
throw
|
|
12152
|
+
throw new NotImplementedError("performLayout");
|
|
12151
12153
|
}
|
|
12152
12154
|
/*
|
|
12153
12155
|
* Do not call this method directly. instead call paint
|
|
@@ -12196,12 +12198,22 @@ var RenderObject = class {
|
|
|
12196
12198
|
});
|
|
12197
12199
|
}
|
|
12198
12200
|
/**
|
|
12199
|
-
*
|
|
12200
12201
|
* It is currently only used on ZIndexRenderObject
|
|
12201
12202
|
*/
|
|
12202
12203
|
accept(visitor) {
|
|
12203
12204
|
visitor.visitGeneral(this);
|
|
12204
12205
|
}
|
|
12206
|
+
hitTest({ globalPoint }) {
|
|
12207
|
+
const viewPort = this.renderOwner.renderContext.viewPort;
|
|
12208
|
+
const { translation, scale } = viewPort;
|
|
12209
|
+
const bounds = {
|
|
12210
|
+
left: (this.matrix.storage[12] + translation.x) * scale,
|
|
12211
|
+
top: (this.matrix.storage[13] + translation.y) * scale,
|
|
12212
|
+
right: (this.matrix.storage[12] + translation.x + this.size.width) * scale,
|
|
12213
|
+
bottom: (this.matrix.storage[13] + translation.y + this.size.height) * scale
|
|
12214
|
+
};
|
|
12215
|
+
return globalPoint.x >= bounds.left && globalPoint.x <= bounds.right && globalPoint.y >= bounds.top && globalPoint.y <= bounds.bottom;
|
|
12216
|
+
}
|
|
12205
12217
|
};
|
|
12206
12218
|
_domNode = new WeakMap();
|
|
12207
12219
|
_domOrder = new WeakMap();
|
|
@@ -12427,7 +12439,7 @@ var RenderObjectElement = class extends Element_default {
|
|
|
12427
12439
|
}
|
|
12428
12440
|
findAncestorRenderObjectElement() {
|
|
12429
12441
|
let ancestor = this.parent;
|
|
12430
|
-
while (ancestor != null &&
|
|
12442
|
+
while (ancestor != null && ancestor.type !== "render") {
|
|
12431
12443
|
ancestor = ancestor.parent;
|
|
12432
12444
|
}
|
|
12433
12445
|
return ancestor;
|
|
@@ -12461,7 +12473,6 @@ var RenderObjectToWidgetAdapter = class extends RenderObjectWidget_default {
|
|
|
12461
12473
|
app,
|
|
12462
12474
|
renderOwner,
|
|
12463
12475
|
buildOwner,
|
|
12464
|
-
renderContext,
|
|
12465
12476
|
scheduler
|
|
12466
12477
|
}) {
|
|
12467
12478
|
super({ children: [app] });
|
|
@@ -12471,7 +12482,7 @@ var RenderObjectToWidgetAdapter = class extends RenderObjectWidget_default {
|
|
|
12471
12482
|
__publicField(this, "scheduler");
|
|
12472
12483
|
this.renderOwner = renderOwner;
|
|
12473
12484
|
this.buildOwner = buildOwner;
|
|
12474
|
-
this.renderContext = renderContext;
|
|
12485
|
+
this.renderContext = renderOwner.renderContext;
|
|
12475
12486
|
this.scheduler = scheduler;
|
|
12476
12487
|
}
|
|
12477
12488
|
createElement() {
|
|
@@ -12484,8 +12495,8 @@ var RenderObjectToWidgetAdapter = class extends RenderObjectWidget_default {
|
|
|
12484
12495
|
createRenderObject() {
|
|
12485
12496
|
return new RenderView_default({ renderOwner: this.renderOwner });
|
|
12486
12497
|
}
|
|
12487
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12488
12498
|
updateRenderObject(renderObject) {
|
|
12499
|
+
renderObject.renderOwner = this.renderOwner;
|
|
12489
12500
|
}
|
|
12490
12501
|
};
|
|
12491
12502
|
var RenderObjectToWidgetAdapter_default = RenderObjectToWidgetAdapter;
|
|
@@ -12529,9 +12540,11 @@ var BuildOwner_default = BuildOwner;
|
|
|
12529
12540
|
var RenderOwner = class {
|
|
12530
12541
|
constructor({
|
|
12531
12542
|
onNeedVisualUpdate,
|
|
12532
|
-
|
|
12543
|
+
renderContext,
|
|
12544
|
+
hitTestDispatcher
|
|
12533
12545
|
}) {
|
|
12534
|
-
__publicField(this, "
|
|
12546
|
+
__publicField(this, "hitTestDispatcher");
|
|
12547
|
+
__publicField(this, "renderContext");
|
|
12535
12548
|
__publicField(this, "onNeedVisualUpdate");
|
|
12536
12549
|
__publicField(this, "needsPaintRenderObjects", []);
|
|
12537
12550
|
__publicField(this, "needsLayoutRenderObjects", []);
|
|
@@ -12541,7 +12554,9 @@ var RenderOwner = class {
|
|
|
12541
12554
|
__publicField(this, "renderView");
|
|
12542
12555
|
__publicField(this, "domOrderChanged", true);
|
|
12543
12556
|
this.onNeedVisualUpdate = onNeedVisualUpdate;
|
|
12544
|
-
this.
|
|
12557
|
+
this.renderContext = renderContext;
|
|
12558
|
+
this.hitTestDispatcher = hitTestDispatcher;
|
|
12559
|
+
this.hitTestDispatcher.init({ renderContext: this.renderContext });
|
|
12545
12560
|
}
|
|
12546
12561
|
requestVisualUpdate() {
|
|
12547
12562
|
this.onNeedVisualUpdate();
|
|
@@ -12582,7 +12597,7 @@ var RenderOwner = class {
|
|
|
12582
12597
|
dirties.sort((a, b) => a.depth - b.depth).forEach((renderObject) => {
|
|
12583
12598
|
if (!renderObject.needsPaint)
|
|
12584
12599
|
return;
|
|
12585
|
-
renderObject.paintWithoutLayout(this.paintContext);
|
|
12600
|
+
renderObject.paintWithoutLayout(this.renderContext.paintContext);
|
|
12586
12601
|
});
|
|
12587
12602
|
}
|
|
12588
12603
|
};
|
|
@@ -12746,6 +12761,154 @@ var GlobalKey = class {
|
|
|
12746
12761
|
};
|
|
12747
12762
|
var Globalkey_default = GlobalKey;
|
|
12748
12763
|
|
|
12764
|
+
// src/hit-test/HitTestDispatcher.ts
|
|
12765
|
+
var _activated, _detectors, _rootPosition, _renderContext, _hitPosition, _handleMouseDown, _handleClick, _hitHistory, _handleMouseMove, _handleMouseUp, _handleMouseWheel, _handleMouseEnter, _handleMouseLeave, _wrapEvent, _didDomOrderChangeState;
|
|
12766
|
+
var HitTestDispatcher = class {
|
|
12767
|
+
constructor() {
|
|
12768
|
+
__privateAdd(this, _activated, typeof window !== "undefined");
|
|
12769
|
+
__privateAdd(this, _detectors, []);
|
|
12770
|
+
__privateAdd(this, _rootPosition, null);
|
|
12771
|
+
__privateAdd(this, _renderContext, void 0);
|
|
12772
|
+
__privateAdd(this, _hitPosition, new offset_default({ x: 0, y: 0 }));
|
|
12773
|
+
__privateAdd(this, _handleMouseDown, (e) => {
|
|
12774
|
+
this.hitTest(e, "onMouseDown");
|
|
12775
|
+
});
|
|
12776
|
+
__privateAdd(this, _handleClick, (e) => {
|
|
12777
|
+
this.hitTest(e, "onClick");
|
|
12778
|
+
});
|
|
12779
|
+
__privateAdd(this, _hitHistory, []);
|
|
12780
|
+
__privateAdd(this, _handleMouseMove, (e) => {
|
|
12781
|
+
this.traceHitPosition(e);
|
|
12782
|
+
this.hitTest(e, "onMouseMove");
|
|
12783
|
+
e.isPropagationStopped = false;
|
|
12784
|
+
for (const i in __privateGet(this, _detectors)) {
|
|
12785
|
+
const detector = __privateGet(this, _detectors)[i];
|
|
12786
|
+
if (e.isPropagationStopped)
|
|
12787
|
+
return;
|
|
12788
|
+
if (!__privateGet(this, _hitHistory)[i] && detector.hitTest({ globalPoint: __privateGet(this, _hitPosition) })) {
|
|
12789
|
+
detector.onMouseEnter(e);
|
|
12790
|
+
}
|
|
12791
|
+
}
|
|
12792
|
+
e.isPropagationStopped = false;
|
|
12793
|
+
for (const i in __privateGet(this, _detectors)) {
|
|
12794
|
+
const detector = __privateGet(this, _detectors)[i];
|
|
12795
|
+
if (e.isPropagationStopped)
|
|
12796
|
+
return;
|
|
12797
|
+
if (__privateGet(this, _hitHistory)[i] && !detector.hitTest({ globalPoint: __privateGet(this, _hitPosition) })) {
|
|
12798
|
+
detector.onMouseLeave(e);
|
|
12799
|
+
}
|
|
12800
|
+
}
|
|
12801
|
+
__privateGet(this, _detectors).forEach((detector, i) => {
|
|
12802
|
+
__privateGet(this, _hitHistory)[i] = detector.hitTest({
|
|
12803
|
+
globalPoint: __privateGet(this, _hitPosition)
|
|
12804
|
+
});
|
|
12805
|
+
});
|
|
12806
|
+
});
|
|
12807
|
+
__privateAdd(this, _handleMouseUp, (e) => {
|
|
12808
|
+
this.hitTest(e, "onMouseUp");
|
|
12809
|
+
});
|
|
12810
|
+
__privateAdd(this, _handleMouseWheel, (e) => {
|
|
12811
|
+
this.hitTest(e, "onMouseWheel");
|
|
12812
|
+
e.isPropagationStopped = false;
|
|
12813
|
+
for (const detector of __privateGet(this, _detectors)) {
|
|
12814
|
+
if (e.isPropagationStopped)
|
|
12815
|
+
return;
|
|
12816
|
+
if (!detector.hitTest({ globalPoint: __privateGet(this, _hitPosition) }))
|
|
12817
|
+
continue;
|
|
12818
|
+
detector.onMouseEnter(e);
|
|
12819
|
+
}
|
|
12820
|
+
e.isPropagationStopped = false;
|
|
12821
|
+
});
|
|
12822
|
+
__privateAdd(this, _handleMouseEnter, () => {
|
|
12823
|
+
const rect = __privateGet(this, _renderContext).view.getBoundingClientRect();
|
|
12824
|
+
__privateSet(this, _rootPosition, new offset_default({
|
|
12825
|
+
x: rect.left,
|
|
12826
|
+
y: rect.top
|
|
12827
|
+
}));
|
|
12828
|
+
});
|
|
12829
|
+
__privateAdd(this, _handleMouseLeave, () => {
|
|
12830
|
+
__privateSet(this, _rootPosition, null);
|
|
12831
|
+
});
|
|
12832
|
+
__publicField(this, "hitTest", (e, type) => {
|
|
12833
|
+
for (const detector of __privateGet(this, _detectors)) {
|
|
12834
|
+
if (e.isPropagationStopped)
|
|
12835
|
+
return;
|
|
12836
|
+
if (!detector.hitTest({ globalPoint: __privateGet(this, _hitPosition) }))
|
|
12837
|
+
continue;
|
|
12838
|
+
detector[type](e);
|
|
12839
|
+
}
|
|
12840
|
+
});
|
|
12841
|
+
__privateAdd(this, _wrapEvent, (callback) => (e) => {
|
|
12842
|
+
const stopPropagation = e.stopPropagation;
|
|
12843
|
+
e.stopPropagation = function() {
|
|
12844
|
+
e.isPropagationStopped = true;
|
|
12845
|
+
stopPropagation.call(e);
|
|
12846
|
+
};
|
|
12847
|
+
return callback(e);
|
|
12848
|
+
});
|
|
12849
|
+
/**
|
|
12850
|
+
* This code is for batch processing. The intention is not to perform the sorting operation every time this method is called,
|
|
12851
|
+
* but rather to ensure that the sorting happens only once in a batch manner. This is achieved by wrapping the sorting logic
|
|
12852
|
+
* inside a setTimeout, which defers the execution until the current call stack is clear, effectively coalescing multiple calls
|
|
12853
|
+
* into a single operation.
|
|
12854
|
+
*/
|
|
12855
|
+
__privateAdd(this, _didDomOrderChangeState, "idle");
|
|
12856
|
+
}
|
|
12857
|
+
init({ renderContext }) {
|
|
12858
|
+
if (!__privateGet(this, _activated))
|
|
12859
|
+
return;
|
|
12860
|
+
__privateSet(this, _renderContext, renderContext);
|
|
12861
|
+
const { view } = __privateGet(this, _renderContext);
|
|
12862
|
+
view.addEventListener("mousedown", __privateGet(this, _wrapEvent).call(this, __privateGet(this, _handleMouseDown)));
|
|
12863
|
+
view.addEventListener("click", __privateGet(this, _wrapEvent).call(this, __privateGet(this, _handleClick)));
|
|
12864
|
+
view.addEventListener("mousemove", __privateGet(this, _wrapEvent).call(this, __privateGet(this, _handleMouseMove)));
|
|
12865
|
+
view.addEventListener("mouseup", __privateGet(this, _wrapEvent).call(this, __privateGet(this, _handleMouseUp)));
|
|
12866
|
+
view.addEventListener("wheel", __privateGet(this, _wrapEvent).call(this, __privateGet(this, _handleMouseWheel)));
|
|
12867
|
+
view.addEventListener("mouseenter", __privateGet(this, _handleMouseEnter));
|
|
12868
|
+
view.addEventListener("mouseleave", __privateGet(this, _handleMouseLeave));
|
|
12869
|
+
}
|
|
12870
|
+
traceHitPosition(e) {
|
|
12871
|
+
if (__privateGet(this, _rootPosition) == null)
|
|
12872
|
+
return;
|
|
12873
|
+
__privateGet(this, _hitPosition).x = e.clientX - __privateGet(this, _rootPosition).x;
|
|
12874
|
+
__privateGet(this, _hitPosition).y = e.clientY - __privateGet(this, _rootPosition).y;
|
|
12875
|
+
}
|
|
12876
|
+
didChangeDomOrder() {
|
|
12877
|
+
if (__privateGet(this, _didDomOrderChangeState) === "processing")
|
|
12878
|
+
return;
|
|
12879
|
+
__privateSet(this, _didDomOrderChangeState, "processing");
|
|
12880
|
+
setTimeout(() => {
|
|
12881
|
+
__privateSet(this, _detectors, __privateGet(this, _detectors).sort((a, b) => b.domOrder - a.domOrder));
|
|
12882
|
+
__privateSet(this, _didDomOrderChangeState, "idle");
|
|
12883
|
+
}, 0);
|
|
12884
|
+
}
|
|
12885
|
+
addDetector(detector) {
|
|
12886
|
+
if (!__privateGet(this, _activated))
|
|
12887
|
+
return;
|
|
12888
|
+
__privateGet(this, _detectors).push(detector);
|
|
12889
|
+
}
|
|
12890
|
+
removeDetector(detector) {
|
|
12891
|
+
if (!__privateGet(this, _activated))
|
|
12892
|
+
return;
|
|
12893
|
+
__privateSet(this, _detectors, __privateGet(this, _detectors).filter((d) => d !== detector));
|
|
12894
|
+
}
|
|
12895
|
+
};
|
|
12896
|
+
_activated = new WeakMap();
|
|
12897
|
+
_detectors = new WeakMap();
|
|
12898
|
+
_rootPosition = new WeakMap();
|
|
12899
|
+
_renderContext = new WeakMap();
|
|
12900
|
+
_hitPosition = new WeakMap();
|
|
12901
|
+
_handleMouseDown = new WeakMap();
|
|
12902
|
+
_handleClick = new WeakMap();
|
|
12903
|
+
_hitHistory = new WeakMap();
|
|
12904
|
+
_handleMouseMove = new WeakMap();
|
|
12905
|
+
_handleMouseUp = new WeakMap();
|
|
12906
|
+
_handleMouseWheel = new WeakMap();
|
|
12907
|
+
_handleMouseEnter = new WeakMap();
|
|
12908
|
+
_handleMouseLeave = new WeakMap();
|
|
12909
|
+
_wrapEvent = new WeakMap();
|
|
12910
|
+
_didDomOrderChangeState = new WeakMap();
|
|
12911
|
+
|
|
12749
12912
|
// src/runApp.ts
|
|
12750
12913
|
var AppRunner = class {
|
|
12751
12914
|
constructor({
|
|
@@ -12762,11 +12925,20 @@ var AppRunner = class {
|
|
|
12762
12925
|
__publicField(this, "scheduler");
|
|
12763
12926
|
__publicField(this, "didRun", false);
|
|
12764
12927
|
__publicField(this, "widget");
|
|
12928
|
+
__publicField(this, "handleViewResize", (size) => {
|
|
12929
|
+
this.viewSize = size;
|
|
12930
|
+
if (this.didRun) {
|
|
12931
|
+
this.draw();
|
|
12932
|
+
} else {
|
|
12933
|
+
this.runApp(this.widget);
|
|
12934
|
+
}
|
|
12935
|
+
});
|
|
12765
12936
|
this.viewSize = ssrSize;
|
|
12766
12937
|
const renderContext = new RenderContext({
|
|
12767
12938
|
view,
|
|
12768
12939
|
document: _document,
|
|
12769
|
-
window: _window
|
|
12940
|
+
window: _window,
|
|
12941
|
+
onResize: this.handleViewResize
|
|
12770
12942
|
});
|
|
12771
12943
|
const renderDispatcher = new RenderFrameDispatcher_default();
|
|
12772
12944
|
const buildOwner = new BuildOwner_default({
|
|
@@ -12774,7 +12946,8 @@ var AppRunner = class {
|
|
|
12774
12946
|
});
|
|
12775
12947
|
const renderOwner = new RenderOwner_default({
|
|
12776
12948
|
onNeedVisualUpdate: () => renderDispatcher.dispatch(),
|
|
12777
|
-
|
|
12949
|
+
renderContext,
|
|
12950
|
+
hitTestDispatcher: new HitTestDispatcher()
|
|
12778
12951
|
});
|
|
12779
12952
|
const scheduler = new Scheduler_default();
|
|
12780
12953
|
scheduler.addPersistenceCallbacks(() => buildOwner.flushBuild());
|
|
@@ -12793,14 +12966,12 @@ var AppRunner = class {
|
|
|
12793
12966
|
app: widget,
|
|
12794
12967
|
buildOwner: this.buildOwner,
|
|
12795
12968
|
renderOwner: this.renderOwner,
|
|
12796
|
-
renderContext: this.renderContext,
|
|
12797
12969
|
scheduler: this.scheduler
|
|
12798
12970
|
}).createElement();
|
|
12799
12971
|
this.root.mount(void 0);
|
|
12800
12972
|
this.root.renderObject.constraints = constraints_default.tight(this.viewSize);
|
|
12801
12973
|
this.didRun = true;
|
|
12802
12974
|
this.draw();
|
|
12803
|
-
this.scheduler.consumePostCallbacks();
|
|
12804
12975
|
return this.renderContext.view.innerHTML;
|
|
12805
12976
|
}
|
|
12806
12977
|
setConfig({
|
|
@@ -12814,7 +12985,7 @@ var AppRunner = class {
|
|
|
12814
12985
|
this.renderContext.window = window2;
|
|
12815
12986
|
if (view)
|
|
12816
12987
|
this.renderContext.view = view;
|
|
12817
|
-
this.renderOwner.
|
|
12988
|
+
this.renderOwner.renderContext = this.renderContext;
|
|
12818
12989
|
}
|
|
12819
12990
|
onMount({
|
|
12820
12991
|
view,
|
|
@@ -12825,28 +12996,13 @@ var AppRunner = class {
|
|
|
12825
12996
|
window,
|
|
12826
12997
|
document
|
|
12827
12998
|
});
|
|
12828
|
-
resizeTarget && this.
|
|
12829
|
-
}
|
|
12830
|
-
observeCanvasSize(target) {
|
|
12831
|
-
const resize = (child) => {
|
|
12832
|
-
const { width, height } = child.target.getBoundingClientRect();
|
|
12833
|
-
this.viewSize = new size_default({ width, height });
|
|
12834
|
-
};
|
|
12835
|
-
const resizeObserver = new ResizeObserver((entries2) => {
|
|
12836
|
-
const child = entries2[0];
|
|
12837
|
-
resize(child);
|
|
12838
|
-
if (this.didRun) {
|
|
12839
|
-
this.draw();
|
|
12840
|
-
} else {
|
|
12841
|
-
this.runApp(this.widget);
|
|
12842
|
-
}
|
|
12843
|
-
});
|
|
12844
|
-
resizeObserver.observe(target);
|
|
12999
|
+
resizeTarget && this.renderContext.observeSize(resizeTarget);
|
|
12845
13000
|
}
|
|
12846
13001
|
draw() {
|
|
12847
13002
|
this.layout();
|
|
12848
13003
|
this.renderOwner.rearrangeDomOrder();
|
|
12849
13004
|
this.paint();
|
|
13005
|
+
this.scheduler.consumePostCallbacks();
|
|
12850
13006
|
}
|
|
12851
13007
|
rebuild() {
|
|
12852
13008
|
this.root.children[0].rebuild();
|
|
@@ -12859,19 +13015,42 @@ var AppRunner = class {
|
|
|
12859
13015
|
const rootRenderObject = this.root.renderObject;
|
|
12860
13016
|
rootRenderObject.paint(this.renderContext.paintContext);
|
|
12861
13017
|
}
|
|
13018
|
+
dispose() {
|
|
13019
|
+
this.root.unmount();
|
|
13020
|
+
this.renderContext.dispose();
|
|
13021
|
+
}
|
|
12862
13022
|
};
|
|
12863
13023
|
var RenderContext = class {
|
|
12864
13024
|
constructor({
|
|
12865
13025
|
document: document2,
|
|
12866
13026
|
window: window2,
|
|
12867
|
-
view
|
|
13027
|
+
view,
|
|
13028
|
+
onResize
|
|
12868
13029
|
}) {
|
|
12869
13030
|
__publicField(this, "document");
|
|
12870
13031
|
__publicField(this, "window");
|
|
12871
13032
|
__publicField(this, "view");
|
|
13033
|
+
__publicField(this, "viewPort", {
|
|
13034
|
+
translation: { x: 0, y: 0 },
|
|
13035
|
+
scale: 1
|
|
13036
|
+
});
|
|
13037
|
+
__publicField(this, "viewSize", new size_default({ width: 0, height: 0 }));
|
|
13038
|
+
__publicField(this, "resizeObserver");
|
|
13039
|
+
__publicField(this, "onResize");
|
|
12872
13040
|
this.document = document2;
|
|
12873
13041
|
this.window = window2;
|
|
12874
13042
|
this.view = view;
|
|
13043
|
+
this.onResize = onResize;
|
|
13044
|
+
}
|
|
13045
|
+
setViewport({
|
|
13046
|
+
translation,
|
|
13047
|
+
scale
|
|
13048
|
+
}) {
|
|
13049
|
+
this.viewPort = { translation, scale };
|
|
13050
|
+
this.view.setAttribute(
|
|
13051
|
+
"viewBox",
|
|
13052
|
+
`${-this.viewPort.translation.x} ${-this.viewPort.translation.y} ${this.viewSize.width / this.viewPort.scale} ${this.viewSize.height / this.viewPort.scale}`
|
|
13053
|
+
);
|
|
12875
13054
|
}
|
|
12876
13055
|
setConfig({
|
|
12877
13056
|
document: document2,
|
|
@@ -12906,6 +13085,17 @@ var RenderContext = class {
|
|
|
12906
13085
|
}
|
|
12907
13086
|
};
|
|
12908
13087
|
}
|
|
13088
|
+
dispose() {
|
|
13089
|
+
this.resizeObserver.disconnect();
|
|
13090
|
+
}
|
|
13091
|
+
observeSize(target) {
|
|
13092
|
+
this.resizeObserver = new ResizeObserver(([child]) => {
|
|
13093
|
+
const { width, height } = child.target.getBoundingClientRect();
|
|
13094
|
+
this.viewSize = new size_default({ width, height });
|
|
13095
|
+
this.onResize(this.viewSize);
|
|
13096
|
+
});
|
|
13097
|
+
this.resizeObserver.observe(target);
|
|
13098
|
+
}
|
|
12909
13099
|
};
|
|
12910
13100
|
|
|
12911
13101
|
// src/element/ComponentElement.ts
|
|
@@ -17257,7 +17447,6 @@ var BaseGestureDetector = class extends SingleChildRenderObjectWidget_default {
|
|
|
17257
17447
|
onDragEnd,
|
|
17258
17448
|
onDragMove,
|
|
17259
17449
|
onDragStart,
|
|
17260
|
-
bubble = {},
|
|
17261
17450
|
onWheel
|
|
17262
17451
|
}) {
|
|
17263
17452
|
super({ child, key });
|
|
@@ -17273,7 +17462,6 @@ var BaseGestureDetector = class extends SingleChildRenderObjectWidget_default {
|
|
|
17273
17462
|
__publicField(this, "onDragEnd");
|
|
17274
17463
|
__publicField(this, "onWheel");
|
|
17275
17464
|
__publicField(this, "cursor");
|
|
17276
|
-
__publicField(this, "bubble");
|
|
17277
17465
|
this.onClick = onClick != null ? onClick : emptyCallback;
|
|
17278
17466
|
this.onMouseDown = onMouseDown != null ? onMouseDown : emptyCallback;
|
|
17279
17467
|
this.onMouseMove = onMouseMove != null ? onMouseMove : emptyCallback;
|
|
@@ -17286,19 +17474,6 @@ var BaseGestureDetector = class extends SingleChildRenderObjectWidget_default {
|
|
|
17286
17474
|
this.onDragEnd = onDragEnd != null ? onDragEnd : emptyCallback;
|
|
17287
17475
|
this.onWheel = onWheel != null ? onWheel : emptyCallback;
|
|
17288
17476
|
this.cursor = cursor != null ? cursor : "pointer";
|
|
17289
|
-
this.bubble = __spreadValues({
|
|
17290
|
-
mousedown: false,
|
|
17291
|
-
mouseenter: false,
|
|
17292
|
-
mouseleave: false,
|
|
17293
|
-
mousemove: false,
|
|
17294
|
-
mouseover: false,
|
|
17295
|
-
mouseup: false,
|
|
17296
|
-
click: false,
|
|
17297
|
-
wheel: false,
|
|
17298
|
-
dragstart: false,
|
|
17299
|
-
dragend: false,
|
|
17300
|
-
drag: false
|
|
17301
|
-
}, bubble);
|
|
17302
17477
|
}
|
|
17303
17478
|
createRenderObject() {
|
|
17304
17479
|
return new RenderGestureDetector({
|
|
@@ -17313,8 +17488,7 @@ var BaseGestureDetector = class extends SingleChildRenderObjectWidget_default {
|
|
|
17313
17488
|
onDragMove: this.onDragMove,
|
|
17314
17489
|
onDragEnd: this.onDragEnd,
|
|
17315
17490
|
onWheel: this.onWheel,
|
|
17316
|
-
cursor: this.cursor
|
|
17317
|
-
bubble: this.bubble
|
|
17491
|
+
cursor: this.cursor
|
|
17318
17492
|
});
|
|
17319
17493
|
}
|
|
17320
17494
|
updateRenderObject(renderObject) {
|
|
@@ -17326,7 +17500,6 @@ var BaseGestureDetector = class extends SingleChildRenderObjectWidget_default {
|
|
|
17326
17500
|
renderObject.onDragStart = this.onDragStart;
|
|
17327
17501
|
renderObject.onDragMove = this.onDragMove;
|
|
17328
17502
|
renderObject.onDragEnd = this.onDragEnd;
|
|
17329
|
-
renderObject.bubble = this.bubble;
|
|
17330
17503
|
renderObject.onWheel = this.onWheel;
|
|
17331
17504
|
}
|
|
17332
17505
|
};
|
|
@@ -17343,13 +17516,11 @@ var RenderGestureDetector = class extends SingleChildRenderObject_default {
|
|
|
17343
17516
|
onDragMove,
|
|
17344
17517
|
onDragStart,
|
|
17345
17518
|
cursor,
|
|
17346
|
-
bubble,
|
|
17347
17519
|
onWheel
|
|
17348
17520
|
}) {
|
|
17349
17521
|
super({ isPainter: true });
|
|
17350
17522
|
__publicField(this, "isRenderGestureDetector", true);
|
|
17351
17523
|
__publicField(this, "id", createUniqueId());
|
|
17352
|
-
__publicField(this, "_bubble");
|
|
17353
17524
|
__publicField(this, "_cursor");
|
|
17354
17525
|
__publicField(this, "_onClick");
|
|
17355
17526
|
__publicField(this, "_onMouseDown");
|
|
@@ -17374,13 +17545,6 @@ var RenderGestureDetector = class extends SingleChildRenderObject_default {
|
|
|
17374
17545
|
this._onDragStart = onDragStart;
|
|
17375
17546
|
this._onWheel = onWheel;
|
|
17376
17547
|
this._cursor = cursor;
|
|
17377
|
-
this._bubble = bubble;
|
|
17378
|
-
}
|
|
17379
|
-
get bubble() {
|
|
17380
|
-
return this._bubble;
|
|
17381
|
-
}
|
|
17382
|
-
set bubble(prop) {
|
|
17383
|
-
this._bubble = prop;
|
|
17384
17548
|
}
|
|
17385
17549
|
get cursor() {
|
|
17386
17550
|
return this._cursor;
|
|
@@ -17479,37 +17643,10 @@ var RenderGestureDetector = class extends SingleChildRenderObject_default {
|
|
|
17479
17643
|
return;
|
|
17480
17644
|
this._onWheel = prop;
|
|
17481
17645
|
}
|
|
17482
|
-
get listeners() {
|
|
17483
|
-
const listeners = {
|
|
17484
|
-
click: this.onClick,
|
|
17485
|
-
mousedown: this.onMouseDown,
|
|
17486
|
-
mousemove: this.onMouseMove,
|
|
17487
|
-
mouseup: this.onMouseUp,
|
|
17488
|
-
mouseover: this.onMouseOver,
|
|
17489
|
-
mouseenter: this.onMouseEnter,
|
|
17490
|
-
mouseleave: this.onMouseLeave,
|
|
17491
|
-
wheel: this.onWheel,
|
|
17492
|
-
dragstart: this.onDragStart,
|
|
17493
|
-
drag: this.onDragMove,
|
|
17494
|
-
dragend: this.onDragEnd
|
|
17495
|
-
};
|
|
17496
|
-
return TypedObject_default.keys(listeners).reduce(
|
|
17497
|
-
(acc, key) => {
|
|
17498
|
-
acc[key] = (e) => {
|
|
17499
|
-
var _a;
|
|
17500
|
-
if (this.bubble[key]) {
|
|
17501
|
-
this.dispatchParent(e);
|
|
17502
|
-
}
|
|
17503
|
-
(_a = listeners[key]) == null ? void 0 : _a.call(listeners, e);
|
|
17504
|
-
};
|
|
17505
|
-
return acc;
|
|
17506
|
-
},
|
|
17507
|
-
{}
|
|
17508
|
-
);
|
|
17509
|
-
}
|
|
17510
17646
|
attach(ownerElement) {
|
|
17511
17647
|
super.attach(ownerElement);
|
|
17512
17648
|
this.addEventListeners();
|
|
17649
|
+
this.renderOwner.hitTestDispatcher.addDetector(this);
|
|
17513
17650
|
}
|
|
17514
17651
|
dispose(context) {
|
|
17515
17652
|
this.removeEventListeners();
|
|
@@ -17519,6 +17656,7 @@ var RenderGestureDetector = class extends SingleChildRenderObject_default {
|
|
|
17519
17656
|
globalDragBackend = null;
|
|
17520
17657
|
}
|
|
17521
17658
|
super.dispose(context);
|
|
17659
|
+
this.renderOwner.hitTestDispatcher.removeDetector(this);
|
|
17522
17660
|
}
|
|
17523
17661
|
removeEventListeners() {
|
|
17524
17662
|
getSingletonDragBackend().disconnectDragSource(this.id);
|
|
@@ -17527,22 +17665,13 @@ var RenderGestureDetector = class extends SingleChildRenderObject_default {
|
|
|
17527
17665
|
const isBrowser = typeof window !== "undefined";
|
|
17528
17666
|
if (!isBrowser)
|
|
17529
17667
|
return;
|
|
17530
|
-
const {
|
|
17531
|
-
svgEls: { rect }
|
|
17532
|
-
} = this.resolveSvgEl();
|
|
17533
17668
|
const dragBackend = getSingletonDragBackend();
|
|
17534
17669
|
dragBackend.isSetup || dragBackend.setup();
|
|
17535
17670
|
backendRefCount++;
|
|
17536
|
-
|
|
17537
|
-
|
|
17538
|
-
|
|
17539
|
-
|
|
17540
|
-
onDragEnd: dragend
|
|
17541
|
-
});
|
|
17542
|
-
TypedObject_default.entries(restListeners).forEach(([type, listener]) => {
|
|
17543
|
-
rect.addEventListener(type, (e) => {
|
|
17544
|
-
listener(e);
|
|
17545
|
-
});
|
|
17671
|
+
dragBackend.connectDragSource(this, {
|
|
17672
|
+
onDragStart: this.onDragStart,
|
|
17673
|
+
onDragMove: this.onDragMove,
|
|
17674
|
+
onDragEnd: this.onDragEnd
|
|
17546
17675
|
});
|
|
17547
17676
|
}
|
|
17548
17677
|
performPaint({ rect }) {
|
|
@@ -17558,19 +17687,9 @@ var RenderGestureDetector = class extends SingleChildRenderObject_default {
|
|
|
17558
17687
|
rect
|
|
17559
17688
|
};
|
|
17560
17689
|
}
|
|
17561
|
-
|
|
17562
|
-
|
|
17563
|
-
|
|
17564
|
-
}
|
|
17565
|
-
dispatchParent(e) {
|
|
17566
|
-
let parent = this.parent;
|
|
17567
|
-
while (parent != null) {
|
|
17568
|
-
if (parent == null ? void 0 : parent.isRenderGestureDetector) {
|
|
17569
|
-
parent.dispatch(e);
|
|
17570
|
-
break;
|
|
17571
|
-
}
|
|
17572
|
-
parent = parent.parent;
|
|
17573
|
-
}
|
|
17690
|
+
didChangeDomOrder() {
|
|
17691
|
+
super.didChangeDomOrder();
|
|
17692
|
+
this.renderOwner.hitTestDispatcher.didChangeDomOrder();
|
|
17574
17693
|
}
|
|
17575
17694
|
};
|
|
17576
17695
|
function emptyCallback(_arg) {
|
|
@@ -17579,7 +17698,6 @@ var DragBackend = class {
|
|
|
17579
17698
|
constructor() {
|
|
17580
17699
|
__publicField(this, "isSetup", false);
|
|
17581
17700
|
__publicField(this, "activeDragSourceId", null);
|
|
17582
|
-
__publicField(this, "dragStartListener", {});
|
|
17583
17701
|
__publicField(this, "dragMoveListener", {});
|
|
17584
17702
|
__publicField(this, "dragEndListener", {});
|
|
17585
17703
|
__publicField(this, "handleMouseMoveTop", (e) => {
|
|
@@ -17619,19 +17737,21 @@ var DragBackend = class {
|
|
|
17619
17737
|
this.root.removeEventListener("mouseup", this.handleMouseUpTop);
|
|
17620
17738
|
this.isSetup = false;
|
|
17621
17739
|
}
|
|
17622
|
-
|
|
17740
|
+
setActiveDragSourceId(sourceId) {
|
|
17741
|
+
this.activeDragSourceId = sourceId;
|
|
17742
|
+
}
|
|
17743
|
+
connectDragSource(detector, {
|
|
17623
17744
|
onDragStart = emptyCallback,
|
|
17624
17745
|
onDragMove = emptyCallback,
|
|
17625
17746
|
onDragEnd = emptyCallback
|
|
17626
17747
|
} = {}) {
|
|
17627
|
-
|
|
17628
|
-
|
|
17748
|
+
const sourceId = detector.id;
|
|
17749
|
+
const onMouseDown = detector.onMouseDown;
|
|
17750
|
+
detector.onMouseDown = (e) => {
|
|
17751
|
+
onMouseDown(e);
|
|
17752
|
+
this.setActiveDragSourceId(sourceId);
|
|
17629
17753
|
onDragStart(e);
|
|
17630
17754
|
};
|
|
17631
|
-
node.addEventListener(
|
|
17632
|
-
"mousedown",
|
|
17633
|
-
this.dragStartListener[sourceId].bind(this)
|
|
17634
|
-
);
|
|
17635
17755
|
this.dragMoveListener[sourceId] = (e) => {
|
|
17636
17756
|
onDragMove(e);
|
|
17637
17757
|
};
|
|
@@ -18372,19 +18492,6 @@ var ToolTipState = class extends State {
|
|
|
18372
18492
|
clipped: false,
|
|
18373
18493
|
children: [
|
|
18374
18494
|
GestureDetector_default({
|
|
18375
|
-
bubble: {
|
|
18376
|
-
mousedown: true,
|
|
18377
|
-
mouseenter: true,
|
|
18378
|
-
mouseleave: true,
|
|
18379
|
-
mousemove: true,
|
|
18380
|
-
mouseover: true,
|
|
18381
|
-
mouseup: true,
|
|
18382
|
-
click: true,
|
|
18383
|
-
drag: true,
|
|
18384
|
-
dragend: true,
|
|
18385
|
-
dragstart: true,
|
|
18386
|
-
wheel: true
|
|
18387
|
-
},
|
|
18388
18495
|
cursor: "default",
|
|
18389
18496
|
child: this.widget.child,
|
|
18390
18497
|
onMouseEnter: () => {
|