@antv/g 5.1.3 → 5.1.4

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.umd.js CHANGED
@@ -7637,393 +7637,6 @@
7637
7637
  return Rectangle;
7638
7638
  }();
7639
7639
 
7640
- var SceneGraphSelectorFactory = Syringe.defineToken('SceneGraphSelectorFactory');
7641
- var SceneGraphSelector = Syringe.defineToken('SceneGraphSelector', {
7642
- multiple: false
7643
- });
7644
- var NAME_REGEXP = /\[\s*name=(.*)\s*\]/;
7645
- /**
7646
- * support the following DOM API:
7647
- * * getElementById
7648
- * * getElementsByClassName
7649
- * * getElementsByName
7650
- * * getElementsByTag
7651
- * * querySelector
7652
- * * querySelectorAll
7653
- */
7654
-
7655
- exports.DefaultSceneGraphSelector = /*#__PURE__*/function () {
7656
- function DefaultSceneGraphSelector() {}
7657
-
7658
- var _proto = DefaultSceneGraphSelector.prototype;
7659
-
7660
- _proto.selectOne = function selectOne(query, root) {
7661
- if (query.startsWith('.')) {
7662
- return root.find(function (node) {
7663
- // return !node.shadow && node.id === query.substring(1);
7664
- return node.className === query.substring(1);
7665
- });
7666
- } else if (query.startsWith('#')) {
7667
- // getElementById('id')
7668
- return root.find(function (node) {
7669
- // return !node.shadow && node.id === query.substring(1);
7670
- return node.id === query.substring(1);
7671
- });
7672
- } else if (query.startsWith('[name=')) {
7673
- var matches = query.match(NAME_REGEXP);
7674
-
7675
- if (matches && matches.length > 1) {
7676
- var targetName = matches[1].replace(/"/g, ''); // getElementByName();
7677
-
7678
- return root.find(function (node) {
7679
- return root !== node && node.name === targetName;
7680
- });
7681
- } else {
7682
- return null;
7683
- }
7684
- } else {
7685
- // getElementsByTag('circle');
7686
- return root.find(function (node) {
7687
- return root !== node && node.nodeName === query;
7688
- });
7689
- }
7690
- };
7691
-
7692
- _proto.selectAll = function selectAll(query, root) {
7693
- // only support `[name="${name}"]` `.className` `#id`
7694
- if (query.startsWith('.')) {
7695
- // getElementsByClassName('className');
7696
- // should not include itself
7697
- return root.findAll(function (node) {
7698
- return root !== node && node.className === query.substring(1);
7699
- });
7700
- } else if (query.startsWith('#')) {
7701
- return root.findAll(function (node) {
7702
- return root !== node && node.id === query.substring(1);
7703
- });
7704
- } else if (query.startsWith('[name=')) {
7705
- // getElementsByName();
7706
- var matches = query.match(NAME_REGEXP);
7707
-
7708
- if (matches && matches.length > 1) {
7709
- var targetName = matches[1].replace(/"/g, ''); // getElementByName();
7710
-
7711
- return root.findAll(function (node) {
7712
- return root !== node && node.name === targetName;
7713
- });
7714
- } else {
7715
- return [];
7716
- }
7717
- } else {
7718
- // getElementsByTag('circle');
7719
- return root.findAll(function (node) {
7720
- return root !== node && node.nodeName === query;
7721
- });
7722
- }
7723
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
7724
- ;
7725
-
7726
- _proto.is = function is() {
7727
- // TODO: need a simple `matches` implementation
7728
- return true;
7729
- };
7730
-
7731
- return DefaultSceneGraphSelector;
7732
- }();
7733
-
7734
- exports.DefaultSceneGraphSelector = __decorate([singleton({
7735
- token: SceneGraphSelector
7736
- })], exports.DefaultSceneGraphSelector);
7737
-
7738
- /**
7739
- * built-in events for element
7740
- * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationEvent
7741
- *
7742
- * TODO: use MutationObserver instead
7743
- * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
7744
- */
7745
-
7746
- (function (ElementEvent) {
7747
- ElementEvent["DESTROY"] = "destroy";
7748
- /**
7749
- * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMAttrModified
7750
- */
7751
-
7752
- ElementEvent["ATTR_MODIFIED"] = "DOMAttrModified";
7753
- /**
7754
- * it has been inserted
7755
- * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeInserted
7756
- */
7757
-
7758
- ElementEvent["INSERTED"] = "DOMNodeInserted";
7759
- /**
7760
- * it has had a child inserted
7761
- */
7762
-
7763
- ElementEvent["CHILD_INSERTED"] = "child-inserted";
7764
- /**
7765
- * it is being removed
7766
- * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeRemoved
7767
- */
7768
-
7769
- ElementEvent["REMOVED"] = "removed";
7770
- /**
7771
- * it has had a child removed
7772
- */
7773
-
7774
- ElementEvent["CHILD_REMOVED"] = "child-removed";
7775
- /**
7776
- * @see https://www.w3.org/TR/DOM-Level-3-Events/#domnodeinsertedintodocument
7777
- */
7778
-
7779
- ElementEvent["MOUNTED"] = "DOMNodeInsertedIntoDocument";
7780
- /**
7781
- * @see https://www.w3.org/TR/DOM-Level-3-Events/#domnoderemovedfromdocument
7782
- */
7783
-
7784
- ElementEvent["UNMOUNTED"] = "DOMNodeRemovedFromDocument";
7785
- ElementEvent["BOUNDS_CHANGED"] = "bounds-changed";
7786
- ElementEvent["GEOMETRY_BOUNDS_CHANGED"] = "geometry-bounds-changed";
7787
- /**
7788
- * trigger when z-index changed
7789
- */
7790
-
7791
- ElementEvent["RENDER_ORDER_CHANGED"] = "render-order-changed";
7792
- })(exports.ElementEvent || (exports.ElementEvent = {}));
7793
-
7794
- /**
7795
- * An DOM-compatible synthetic event implementation that is "forwarded" on behalf of an original
7796
- * FederatedEvent or native {@link https://dom.spec.whatwg.org/#event Event}.
7797
- */
7798
-
7799
- var FederatedEvent = /*#__PURE__*/function () {
7800
- /**
7801
- * The event boundary which manages this event. Propagation can only occur
7802
- * within the boundary's jurisdiction.
7803
- */
7804
- function FederatedEvent(manager) {
7805
- this.type = void 0;
7806
- this.eventPhase = FederatedEvent.prototype.NONE;
7807
- this.target = void 0;
7808
- this.bubbles = true;
7809
- this.cancelBubble = true;
7810
- this.cancelable = false;
7811
- this.currentTarget = void 0;
7812
- this.defaultPrevented = false;
7813
- this.timeStamp = void 0;
7814
- this.nativeEvent = void 0;
7815
- this.originalEvent = void 0;
7816
- this.propagationStopped = false;
7817
- this.propagationImmediatelyStopped = false;
7818
- this.manager = void 0;
7819
- this.detail = void 0;
7820
- this.layer = new Point();
7821
- this.page = new Point();
7822
- this.canvas = new Point();
7823
- this.viewport = new Point();
7824
- this.path = void 0;
7825
- this.view = void 0;
7826
- this.which = void 0;
7827
- this.returnValue = void 0;
7828
- this.srcElement = void 0;
7829
- this.composed = false;
7830
- this.isTrusted = void 0;
7831
- this.NONE = 0;
7832
- this.CAPTURING_PHASE = 1;
7833
- this.AT_TARGET = 2;
7834
- this.BUBBLING_PHASE = 3;
7835
- this.manager = manager;
7836
- }
7837
-
7838
- var _proto = FederatedEvent.prototype;
7839
-
7840
- /**
7841
- * The propagation path for this event
7842
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/composedPath
7843
- *
7844
- * So composedPath()[0] represents the original target.
7845
- * @see https://polymer-library.polymer-project.org/3.0/docs/devguide/events#retargeting
7846
- */
7847
- _proto.composedPath = function composedPath() {
7848
- if (this.manager && (!this.path || this.path[0] !== this.target)) {
7849
- this.path = this.target ? this.manager.propagationPath(this.target) : [];
7850
- }
7851
-
7852
- return this.path;
7853
- }
7854
- /**
7855
- * @deprecated
7856
- */
7857
- ;
7858
-
7859
- /**
7860
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/preventDefault
7861
- */
7862
- _proto.preventDefault = function preventDefault() {
7863
- if (this.nativeEvent instanceof Event && this.nativeEvent.cancelable) {
7864
- this.nativeEvent.preventDefault();
7865
- }
7866
-
7867
- this.defaultPrevented = true;
7868
- }
7869
- /**
7870
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/stopImmediatePropagation
7871
- */
7872
- ;
7873
-
7874
- _proto.stopImmediatePropagation = function stopImmediatePropagation() {
7875
- this.propagationImmediatelyStopped = true;
7876
- }
7877
- /**
7878
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/stopPropagation
7879
- */
7880
- ;
7881
-
7882
- _proto.stopPropagation = function stopPropagation() {
7883
- this.propagationStopped = true;
7884
- }
7885
- /**
7886
- * @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view
7887
- */
7888
- ;
7889
-
7890
- /**
7891
- * added for compatibility with DOM Event,
7892
- * deprecated props and methods
7893
- */
7894
- _proto.initEvent = function initEvent() {};
7895
-
7896
- _proto.initUIEvent = function initUIEvent() {};
7897
-
7898
- _createClass$5(FederatedEvent, [{
7899
- key: "name",
7900
- get:
7901
- /**
7902
- * The type of event, supports the following:
7903
- * * pointerdown
7904
- * * touchstart
7905
- * * mousedown
7906
- * * rightdown
7907
- * * ...
7908
- */
7909
-
7910
- /**
7911
- * @deprecated
7912
- */
7913
- function get() {
7914
- return this.type;
7915
- }
7916
- /**
7917
- * The propagation phase.
7918
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase
7919
- */
7920
-
7921
- }, {
7922
- key: "layerX",
7923
- get: function get() {
7924
- return this.layer.x;
7925
- }
7926
- }, {
7927
- key: "layerY",
7928
- get: function get() {
7929
- return this.layer.y;
7930
- }
7931
- /**
7932
- * The coordinates of the event relative to the DOM document.
7933
- * This is a non-standard property.
7934
- * relative to the DOM document.
7935
- * @see https://developer.mozilla.org/zh-CN/docs/Web/API/MouseEvent/pageX
7936
- */
7937
-
7938
- }, {
7939
- key: "pageX",
7940
- get: function get() {
7941
- return this.page.x;
7942
- }
7943
- }, {
7944
- key: "pageY",
7945
- get: function get() {
7946
- return this.page.y;
7947
- }
7948
- /**
7949
- * relative to Canvas, origin is left-top
7950
- */
7951
-
7952
- }, {
7953
- key: "x",
7954
- get: function get() {
7955
- return this.canvas.x;
7956
- }
7957
- }, {
7958
- key: "y",
7959
- get: function get() {
7960
- return this.canvas.y;
7961
- }
7962
- }, {
7963
- key: "canvasX",
7964
- get: function get() {
7965
- return this.canvas.x;
7966
- }
7967
- }, {
7968
- key: "canvasY",
7969
- get: function get() {
7970
- return this.canvas.y;
7971
- }
7972
- /**
7973
- * relative to Viewport, account for Camera
7974
- */
7975
-
7976
- }, {
7977
- key: "viewportX",
7978
- get: function get() {
7979
- return this.viewport.x;
7980
- }
7981
- }, {
7982
- key: "viewportY",
7983
- get: function get() {
7984
- return this.viewport.y;
7985
- }
7986
- }, {
7987
- key: "propagationPath",
7988
- get: function get() {
7989
- return this.composedPath();
7990
- }
7991
- }]);
7992
-
7993
- return FederatedEvent;
7994
- }();
7995
-
7996
- var MutationEvent = /*#__PURE__*/function (_FederatedEvent) {
7997
- _inheritsLoose(MutationEvent, _FederatedEvent);
7998
-
7999
- function MutationEvent(typeArg, relatedNode, prevValue, newValue, attrName, attrChange, prevParsedValue, newParsedValue) {
8000
- var _this;
8001
-
8002
- _this = _FederatedEvent.call(this, null) || this;
8003
- _this.relatedNode = void 0;
8004
- _this.prevValue = void 0;
8005
- _this.newValue = void 0;
8006
- _this.attrName = void 0;
8007
- _this.attrChange = void 0;
8008
- _this.prevParsedValue = void 0;
8009
- _this.newParsedValue = void 0;
8010
- _this.relatedNode = relatedNode;
8011
- _this.prevValue = prevValue;
8012
- _this.newValue = newValue;
8013
- _this.attrName = attrName;
8014
- _this.attrChange = attrChange;
8015
- _this.prevParsedValue = prevParsedValue;
8016
- _this.newParsedValue = newParsedValue;
8017
- _this.type = typeArg;
8018
- return _this;
8019
- }
8020
-
8021
- return MutationEvent;
8022
- }(FederatedEvent);
8023
- MutationEvent.ADDITION = 2;
8024
- MutationEvent.MODIFICATION = 1;
8025
- MutationEvent.REMOVAL = 3;
8026
-
8027
7640
  function DCHECK(bool) {
8028
7641
  if (!bool) {
8029
7642
  throw new Error();
@@ -8878,39 +8491,297 @@
8878
8491
  * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#percentage
8879
8492
  */
8880
8493
 
8881
- PropertySyntax["PERCENTAGE"] = "<percentage>";
8882
- PropertySyntax["LENGTH_PERCENTAGE"] = "<length> | <percentage>";
8883
- PropertySyntax["LENGTH_PERCENTAGE_12"] = "[<length> | <percentage>]{1,2}";
8884
- /**
8885
- * @see https://developer.mozilla.org/en-US/docs/Web/CSS/margin#formal_syntax
8886
- */
8494
+ PropertySyntax["PERCENTAGE"] = "<percentage>";
8495
+ PropertySyntax["LENGTH_PERCENTAGE"] = "<length> | <percentage>";
8496
+ PropertySyntax["LENGTH_PERCENTAGE_12"] = "[<length> | <percentage>]{1,2}";
8497
+ /**
8498
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/margin#formal_syntax
8499
+ */
8500
+
8501
+ PropertySyntax["LENGTH_PERCENTAGE_14"] = "[<length> | <percentage>]{1,4}";
8502
+ /**
8503
+ * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#list-of-ts
8504
+ */
8505
+
8506
+ PropertySyntax["LIST_OF_POINTS"] = "<list-of-points>";
8507
+ PropertySyntax["PATH"] = "<path>";
8508
+ /**
8509
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/filter#formal_syntax
8510
+ */
8511
+
8512
+ PropertySyntax["FILTER"] = "<filter>";
8513
+ PropertySyntax["Z_INDEX"] = "<z-index>";
8514
+ PropertySyntax["OFFSET_PATH"] = "<offset-path>";
8515
+ PropertySyntax["OFFSET_DISTANCE"] = "<offset-distance>";
8516
+ PropertySyntax["CLIP_PATH"] = "<clip-path>";
8517
+ PropertySyntax["TRANSFORM"] = "<transform>";
8518
+ PropertySyntax["TRANSFORM_ORIGIN"] = "<transform-origin>";
8519
+ PropertySyntax["TEXT"] = "<text>";
8520
+ PropertySyntax["TEXT_TRANSFORM"] = "<text-transform>";
8521
+ })(exports.PropertySyntax || (exports.PropertySyntax = {}));
8522
+
8523
+ var StyleValueRegistry = Syringe.defineToken('StyleValueRegistry');
8524
+
8525
+ var GeometryUpdaterFactory = Syringe.defineToken('GeometryUpdaterFactory');
8526
+ var GeometryAABBUpdater = Syringe.defineToken('GeometryAABBUpdater');
8527
+
8528
+ /**
8529
+ * built-in events for element
8530
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationEvent
8531
+ *
8532
+ * TODO: use MutationObserver instead
8533
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
8534
+ */
8535
+
8536
+ (function (ElementEvent) {
8537
+ ElementEvent["DESTROY"] = "destroy";
8538
+ /**
8539
+ * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMAttrModified
8540
+ */
8541
+
8542
+ ElementEvent["ATTR_MODIFIED"] = "DOMAttrModified";
8543
+ /**
8544
+ * it has been inserted
8545
+ * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeInserted
8546
+ */
8547
+
8548
+ ElementEvent["INSERTED"] = "DOMNodeInserted";
8549
+ /**
8550
+ * it has had a child inserted
8551
+ */
8552
+
8553
+ ElementEvent["CHILD_INSERTED"] = "child-inserted";
8554
+ /**
8555
+ * it is being removed
8556
+ * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeRemoved
8557
+ */
8558
+
8559
+ ElementEvent["REMOVED"] = "removed";
8560
+ /**
8561
+ * it has had a child removed
8562
+ */
8563
+
8564
+ ElementEvent["CHILD_REMOVED"] = "child-removed";
8565
+ /**
8566
+ * @see https://www.w3.org/TR/DOM-Level-3-Events/#domnodeinsertedintodocument
8567
+ */
8568
+
8569
+ ElementEvent["MOUNTED"] = "DOMNodeInsertedIntoDocument";
8570
+ /**
8571
+ * @see https://www.w3.org/TR/DOM-Level-3-Events/#domnoderemovedfromdocument
8572
+ */
8573
+
8574
+ ElementEvent["UNMOUNTED"] = "DOMNodeRemovedFromDocument";
8575
+ ElementEvent["BOUNDS_CHANGED"] = "bounds-changed";
8576
+ ElementEvent["GEOMETRY_BOUNDS_CHANGED"] = "geometry-bounds-changed";
8577
+ /**
8578
+ * trigger when z-index changed
8579
+ */
8580
+
8581
+ ElementEvent["RENDER_ORDER_CHANGED"] = "render-order-changed";
8582
+ })(exports.ElementEvent || (exports.ElementEvent = {}));
8583
+
8584
+ /**
8585
+ * An DOM-compatible synthetic event implementation that is "forwarded" on behalf of an original
8586
+ * FederatedEvent or native {@link https://dom.spec.whatwg.org/#event Event}.
8587
+ */
8588
+
8589
+ var FederatedEvent = /*#__PURE__*/function () {
8590
+ /**
8591
+ * The event boundary which manages this event. Propagation can only occur
8592
+ * within the boundary's jurisdiction.
8593
+ */
8594
+ function FederatedEvent(manager) {
8595
+ this.type = void 0;
8596
+ this.eventPhase = FederatedEvent.prototype.NONE;
8597
+ this.target = void 0;
8598
+ this.bubbles = true;
8599
+ this.cancelBubble = true;
8600
+ this.cancelable = false;
8601
+ this.currentTarget = void 0;
8602
+ this.defaultPrevented = false;
8603
+ this.timeStamp = void 0;
8604
+ this.nativeEvent = void 0;
8605
+ this.originalEvent = void 0;
8606
+ this.propagationStopped = false;
8607
+ this.propagationImmediatelyStopped = false;
8608
+ this.manager = void 0;
8609
+ this.detail = void 0;
8610
+ this.layer = new Point();
8611
+ this.page = new Point();
8612
+ this.canvas = new Point();
8613
+ this.viewport = new Point();
8614
+ this.path = void 0;
8615
+ this.view = void 0;
8616
+ this.which = void 0;
8617
+ this.returnValue = void 0;
8618
+ this.srcElement = void 0;
8619
+ this.composed = false;
8620
+ this.isTrusted = void 0;
8621
+ this.NONE = 0;
8622
+ this.CAPTURING_PHASE = 1;
8623
+ this.AT_TARGET = 2;
8624
+ this.BUBBLING_PHASE = 3;
8625
+ this.manager = manager;
8626
+ }
8627
+
8628
+ var _proto = FederatedEvent.prototype;
8629
+
8630
+ /**
8631
+ * The propagation path for this event
8632
+ * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/composedPath
8633
+ *
8634
+ * So composedPath()[0] represents the original target.
8635
+ * @see https://polymer-library.polymer-project.org/3.0/docs/devguide/events#retargeting
8636
+ */
8637
+ _proto.composedPath = function composedPath() {
8638
+ if (this.manager && (!this.path || this.path[0] !== this.target)) {
8639
+ this.path = this.target ? this.manager.propagationPath(this.target) : [];
8640
+ }
8641
+
8642
+ return this.path;
8643
+ }
8644
+ /**
8645
+ * @deprecated
8646
+ */
8647
+ ;
8648
+
8649
+ /**
8650
+ * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/preventDefault
8651
+ */
8652
+ _proto.preventDefault = function preventDefault() {
8653
+ if (this.nativeEvent instanceof Event && this.nativeEvent.cancelable) {
8654
+ this.nativeEvent.preventDefault();
8655
+ }
8656
+
8657
+ this.defaultPrevented = true;
8658
+ }
8659
+ /**
8660
+ * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/stopImmediatePropagation
8661
+ */
8662
+ ;
8663
+
8664
+ _proto.stopImmediatePropagation = function stopImmediatePropagation() {
8665
+ this.propagationImmediatelyStopped = true;
8666
+ }
8667
+ /**
8668
+ * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/stopPropagation
8669
+ */
8670
+ ;
8671
+
8672
+ _proto.stopPropagation = function stopPropagation() {
8673
+ this.propagationStopped = true;
8674
+ }
8675
+ /**
8676
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view
8677
+ */
8678
+ ;
8679
+
8680
+ /**
8681
+ * added for compatibility with DOM Event,
8682
+ * deprecated props and methods
8683
+ */
8684
+ _proto.initEvent = function initEvent() {};
8685
+
8686
+ _proto.initUIEvent = function initUIEvent() {};
8687
+
8688
+ _createClass$5(FederatedEvent, [{
8689
+ key: "name",
8690
+ get:
8691
+ /**
8692
+ * The type of event, supports the following:
8693
+ * * pointerdown
8694
+ * * touchstart
8695
+ * * mousedown
8696
+ * * rightdown
8697
+ * * ...
8698
+ */
8699
+
8700
+ /**
8701
+ * @deprecated
8702
+ */
8703
+ function get() {
8704
+ return this.type;
8705
+ }
8706
+ /**
8707
+ * The propagation phase.
8708
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase
8709
+ */
8887
8710
 
8888
- PropertySyntax["LENGTH_PERCENTAGE_14"] = "[<length> | <percentage>]{1,4}";
8889
- /**
8890
- * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#list-of-ts
8891
- */
8711
+ }, {
8712
+ key: "layerX",
8713
+ get: function get() {
8714
+ return this.layer.x;
8715
+ }
8716
+ }, {
8717
+ key: "layerY",
8718
+ get: function get() {
8719
+ return this.layer.y;
8720
+ }
8721
+ /**
8722
+ * The coordinates of the event relative to the DOM document.
8723
+ * This is a non-standard property.
8724
+ * relative to the DOM document.
8725
+ * @see https://developer.mozilla.org/zh-CN/docs/Web/API/MouseEvent/pageX
8726
+ */
8892
8727
 
8893
- PropertySyntax["LIST_OF_POINTS"] = "<list-of-points>";
8894
- PropertySyntax["PATH"] = "<path>";
8895
- /**
8896
- * @see https://developer.mozilla.org/en-US/docs/Web/CSS/filter#formal_syntax
8897
- */
8728
+ }, {
8729
+ key: "pageX",
8730
+ get: function get() {
8731
+ return this.page.x;
8732
+ }
8733
+ }, {
8734
+ key: "pageY",
8735
+ get: function get() {
8736
+ return this.page.y;
8737
+ }
8738
+ /**
8739
+ * relative to Canvas, origin is left-top
8740
+ */
8898
8741
 
8899
- PropertySyntax["FILTER"] = "<filter>";
8900
- PropertySyntax["Z_INDEX"] = "<z-index>";
8901
- PropertySyntax["OFFSET_PATH"] = "<offset-path>";
8902
- PropertySyntax["OFFSET_DISTANCE"] = "<offset-distance>";
8903
- PropertySyntax["CLIP_PATH"] = "<clip-path>";
8904
- PropertySyntax["TRANSFORM"] = "<transform>";
8905
- PropertySyntax["TRANSFORM_ORIGIN"] = "<transform-origin>";
8906
- PropertySyntax["TEXT"] = "<text>";
8907
- PropertySyntax["TEXT_TRANSFORM"] = "<text-transform>";
8908
- })(exports.PropertySyntax || (exports.PropertySyntax = {}));
8742
+ }, {
8743
+ key: "x",
8744
+ get: function get() {
8745
+ return this.canvas.x;
8746
+ }
8747
+ }, {
8748
+ key: "y",
8749
+ get: function get() {
8750
+ return this.canvas.y;
8751
+ }
8752
+ }, {
8753
+ key: "canvasX",
8754
+ get: function get() {
8755
+ return this.canvas.x;
8756
+ }
8757
+ }, {
8758
+ key: "canvasY",
8759
+ get: function get() {
8760
+ return this.canvas.y;
8761
+ }
8762
+ /**
8763
+ * relative to Viewport, account for Camera
8764
+ */
8909
8765
 
8910
- var StyleValueRegistry = Syringe.defineToken('StyleValueRegistry');
8766
+ }, {
8767
+ key: "viewportX",
8768
+ get: function get() {
8769
+ return this.viewport.x;
8770
+ }
8771
+ }, {
8772
+ key: "viewportY",
8773
+ get: function get() {
8774
+ return this.viewport.y;
8775
+ }
8776
+ }, {
8777
+ key: "propagationPath",
8778
+ get: function get() {
8779
+ return this.composedPath();
8780
+ }
8781
+ }]);
8911
8782
 
8912
- var GeometryUpdaterFactory = Syringe.defineToken('GeometryUpdaterFactory');
8913
- var GeometryAABBUpdater = Syringe.defineToken('GeometryAABBUpdater');
8783
+ return FederatedEvent;
8784
+ }();
8914
8785
 
8915
8786
  /**
8916
8787
  * @see https://developer.mozilla.org/en-US/docs/Web/Events/Creating_and_triggering_events
@@ -9454,6 +9325,37 @@
9454
9325
  };
9455
9326
  Sortable.tag = 'c-sortable';
9456
9327
 
9328
+ var MutationEvent = /*#__PURE__*/function (_FederatedEvent) {
9329
+ _inheritsLoose(MutationEvent, _FederatedEvent);
9330
+
9331
+ function MutationEvent(typeArg, relatedNode, prevValue, newValue, attrName, attrChange, prevParsedValue, newParsedValue) {
9332
+ var _this;
9333
+
9334
+ _this = _FederatedEvent.call(this, null) || this;
9335
+ _this.relatedNode = void 0;
9336
+ _this.prevValue = void 0;
9337
+ _this.newValue = void 0;
9338
+ _this.attrName = void 0;
9339
+ _this.attrChange = void 0;
9340
+ _this.prevParsedValue = void 0;
9341
+ _this.newParsedValue = void 0;
9342
+ _this.relatedNode = relatedNode;
9343
+ _this.prevValue = prevValue;
9344
+ _this.newValue = newValue;
9345
+ _this.attrName = attrName;
9346
+ _this.attrChange = attrChange;
9347
+ _this.prevParsedValue = prevParsedValue;
9348
+ _this.newParsedValue = newParsedValue;
9349
+ _this.type = typeArg;
9350
+ return _this;
9351
+ }
9352
+
9353
+ return MutationEvent;
9354
+ }(FederatedEvent);
9355
+ MutationEvent.ADDITION = 2;
9356
+ MutationEvent.MODIFICATION = 1;
9357
+ MutationEvent.REMOVAL = 3;
9358
+
9457
9359
  var entityCounter = 0;
9458
9360
  /**
9459
9361
  * Has following capabilities:
@@ -9612,6 +9514,24 @@
9612
9514
  _proto.querySelectorAll = function querySelectorAll(selectors) {
9613
9515
  return this.sceneGraphService.querySelectorAll(selectors, this);
9614
9516
  }
9517
+ /**
9518
+ * should traverses the element and its parents (heading toward the document root)
9519
+ * until it finds a node that matches the specified CSS selector.
9520
+ * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/closest
9521
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#polyfill
9522
+ */
9523
+ ;
9524
+
9525
+ _proto.closest = function closest(selectors) {
9526
+ var el = this;
9527
+
9528
+ do {
9529
+ if (this.sceneGraphService.matches(selectors, el)) return el;
9530
+ el = el.parentElement;
9531
+ } while (el !== null);
9532
+
9533
+ return null;
9534
+ }
9615
9535
  /**
9616
9536
  * search in scene group, but should not include itself
9617
9537
  */
@@ -23186,6 +23106,159 @@
23186
23106
  return fontStyle + " " + fontVariant + " " + fontWeight + " " + fontSizeString + " " + fontFamilies.join(',');
23187
23107
  }
23188
23108
 
23109
+ var SceneGraphSelectorFactory = Syringe.defineToken('SceneGraphSelectorFactory');
23110
+ var SceneGraphSelector = Syringe.defineToken('SceneGraphSelector', {
23111
+ multiple: false
23112
+ });
23113
+ var ATTRIBUTE_REGEXP = /\[\s*(.*)=(.*)\s*\]/;
23114
+ /**
23115
+ * support the following DOM API:
23116
+ * * getElementById
23117
+ * * getElementsByClassName
23118
+ * * getElementsByName
23119
+ * * getElementsByTag
23120
+ * * querySelector
23121
+ * * querySelectorAll
23122
+ */
23123
+
23124
+ exports.DefaultSceneGraphSelector = /*#__PURE__*/function () {
23125
+ function DefaultSceneGraphSelector() {}
23126
+
23127
+ var _proto = DefaultSceneGraphSelector.prototype;
23128
+
23129
+ _proto.selectOne = function selectOne(query, root) {
23130
+ var _this = this;
23131
+
23132
+ if (query.startsWith('.')) {
23133
+ return root.find(function (node) {
23134
+ // return !node.shadow && node.id === query.substring(1);
23135
+ return node.className === _this.getIdOrClassname(query);
23136
+ });
23137
+ } else if (query.startsWith('#')) {
23138
+ // getElementById('id')
23139
+ return root.find(function (node) {
23140
+ // return !node.shadow && node.id === query.substring(1);
23141
+ return node.id === _this.getIdOrClassname(query);
23142
+ });
23143
+ } else if (query.startsWith('[')) {
23144
+ var _this$getAttribute = this.getAttribute(query),
23145
+ name = _this$getAttribute.name,
23146
+ value = _this$getAttribute.value;
23147
+
23148
+ if (name) {
23149
+ // getElementByName();
23150
+ return root.find(function (node) {
23151
+ return root !== node && (name === 'name' ? node.name === value : _this.attributeToString(node, name) === value);
23152
+ });
23153
+ } else {
23154
+ return null;
23155
+ }
23156
+ } else {
23157
+ // getElementsByTag('circle');
23158
+ return root.find(function (node) {
23159
+ return root !== node && node.nodeName === query;
23160
+ });
23161
+ }
23162
+ };
23163
+
23164
+ _proto.selectAll = function selectAll(query, root) {
23165
+ var _this2 = this;
23166
+
23167
+ // only support `[name="${name}"]` `.className` `#id`
23168
+ if (query.startsWith('.')) {
23169
+ // getElementsByClassName('className');
23170
+ // should not include itself
23171
+ return root.findAll(function (node) {
23172
+ return root !== node && node.className === _this2.getIdOrClassname(query);
23173
+ });
23174
+ } else if (query.startsWith('#')) {
23175
+ return root.findAll(function (node) {
23176
+ return root !== node && node.id === _this2.getIdOrClassname(query);
23177
+ });
23178
+ } else if (query.startsWith('[')) {
23179
+ var _this$getAttribute2 = this.getAttribute(query),
23180
+ name = _this$getAttribute2.name,
23181
+ value = _this$getAttribute2.value;
23182
+
23183
+ if (name) {
23184
+ // getElementsByName();
23185
+ return root.findAll(function (node) {
23186
+ return root !== node && (name === 'name' ? node.name === value : _this2.attributeToString(node, name) === value);
23187
+ });
23188
+ } else {
23189
+ return [];
23190
+ }
23191
+ } else {
23192
+ // getElementsByTag('circle');
23193
+ return root.findAll(function (node) {
23194
+ return root !== node && node.nodeName === query;
23195
+ });
23196
+ }
23197
+ } // eslint-disable-next-line @typescript-eslint/no-unused-vars
23198
+ ;
23199
+
23200
+ _proto.is = function is(query, node) {
23201
+ // a simple `matches` implementation
23202
+ if (query.startsWith('.')) {
23203
+ return node.className === this.getIdOrClassname(query);
23204
+ } else if (query.startsWith('#')) {
23205
+ return node.id === this.getIdOrClassname(query);
23206
+ } else if (query.startsWith('[')) {
23207
+ var _this$getAttribute3 = this.getAttribute(query),
23208
+ name = _this$getAttribute3.name,
23209
+ value = _this$getAttribute3.value;
23210
+
23211
+ return name === 'name' ? node.name === value : this.attributeToString(node, name) === value;
23212
+ } else {
23213
+ return node.nodeName === query;
23214
+ }
23215
+ };
23216
+
23217
+ _proto.getIdOrClassname = function getIdOrClassname(query) {
23218
+ return query.substring(1);
23219
+ };
23220
+
23221
+ _proto.getAttribute = function getAttribute(query) {
23222
+ var matches = query.match(ATTRIBUTE_REGEXP);
23223
+ var name = '';
23224
+ var value = '';
23225
+
23226
+ if (matches && matches.length > 2) {
23227
+ name = matches[1].replace(/"/g, '');
23228
+ value = matches[2].replace(/"/g, '');
23229
+ }
23230
+
23231
+ return {
23232
+ name: name,
23233
+ value: value
23234
+ };
23235
+ };
23236
+
23237
+ _proto.attributeToString = function attributeToString(node, name) {
23238
+ if (!node.getAttribute) {
23239
+ return '';
23240
+ }
23241
+
23242
+ var value = node.getAttribute(name);
23243
+
23244
+ if (isNil(value)) {
23245
+ return '';
23246
+ }
23247
+
23248
+ if (value.toString) {
23249
+ return value.toString();
23250
+ }
23251
+
23252
+ return '';
23253
+ };
23254
+
23255
+ return DefaultSceneGraphSelector;
23256
+ }();
23257
+
23258
+ exports.DefaultSceneGraphSelector = __decorate([singleton({
23259
+ token: SceneGraphSelector
23260
+ })], exports.DefaultSceneGraphSelector);
23261
+
23189
23262
  function sortByZIndex(o1, o2) {
23190
23263
  var zIndex1 = Number(o1.style.zIndex);
23191
23264
  var zIndex2 = Number(o2.style.zIndex);
@@ -27973,7 +28046,7 @@
27973
28046
  var _this$renderingContex, _this$renderingContex2;
27974
28047
 
27975
28048
  var canvas = (_this$renderingContex = _this.renderingContext.root) === null || _this$renderingContex === void 0 ? void 0 : (_this$renderingContex2 = _this$renderingContex.ownerDocument) === null || _this$renderingContex2 === void 0 ? void 0 : _this$renderingContex2.defaultView;
27976
- if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') return;
28049
+ if (canvas.supportsTouchEvents && nativeEvent.pointerType === 'touch') return;
27977
28050
 
27978
28051
  var normalizedEvents = _this.normalizeToPointerEvent(nativeEvent, canvas);
27979
28052
 
@@ -28034,6 +28107,8 @@
28034
28107
  _this2.eventService.mapEvent(wheelEvent);
28035
28108
  });
28036
28109
  renderingService.hooks.pointerDown.tap(EventPlugin_1.tag, function (nativeEvent) {
28110
+ if (canvas.supportsTouchEvents && nativeEvent.pointerType === 'touch') return;
28111
+
28037
28112
  var events = _this2.normalizeToPointerEvent(nativeEvent, canvas);
28038
28113
 
28039
28114
  if (_this2.autoPreventDefault && events[0].isNormalized) {
@@ -28055,7 +28130,7 @@
28055
28130
  _this2.setCursor(_this2.eventService.cursor);
28056
28131
  });
28057
28132
  renderingService.hooks.pointerUp.tap(EventPlugin_1.tag, function (nativeEvent) {
28058
- if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') return; // account for element in SVG
28133
+ if (canvas.supportsTouchEvents && nativeEvent.pointerType === 'touch') return; // account for element in SVG
28059
28134
 
28060
28135
  var $element = _this2.contextService.getDomElement();
28061
28136
 
@@ -28079,24 +28154,7 @@
28079
28154
  });
28080
28155
  renderingService.hooks.pointerMove.tap(EventPlugin_1.tag, this.onPointerMove);
28081
28156
  renderingService.hooks.pointerOver.tap(EventPlugin_1.tag, this.onPointerMove);
28082
- renderingService.hooks.pointerOut.tap(EventPlugin_1.tag, this.onPointerMove); // renderingService.hooks.pointerCancel.tap(
28083
- // EventPlugin.tag,
28084
- // (nativeEvent: InteractivePointerEvent) => {
28085
- // if (canvas.supportTouchEvent && (nativeEvent as PointerEvent).pointerType === 'touch') {
28086
- // return;
28087
- // }
28088
- // const normalizedEvent = this.normalizeToPointerEvent(nativeEvent, canvas);
28089
- // if (this.autoPreventDefault && (normalizedEvent as any).isNormalized) {
28090
- // const cancelable = nativeEvent.cancelable || !('cancelable' in nativeEvent);
28091
- // if (cancelable) {
28092
- // nativeEvent.preventDefault();
28093
- // }
28094
- // }
28095
- // const federatedEvent = this.bootstrapEvent(this.rootPointerEvent, normalizedEvent, canvas);
28096
- // this.eventService.mapEvent(federatedEvent);
28097
- // this.setCursor(this.eventService.cursor);
28098
- // },
28099
- // );
28157
+ renderingService.hooks.pointerOut.tap(EventPlugin_1.tag, this.onPointerMove);
28100
28158
  };
28101
28159
 
28102
28160
  _proto.bootstrapEvent = function bootstrapEvent(e, nativeEvent, view) {
@@ -28375,8 +28433,8 @@
28375
28433
  _this.requestAnimationFrame = void 0;
28376
28434
  _this.cancelAnimationFrame = void 0;
28377
28435
  _this.devicePixelRatio = void 0;
28378
- _this.supportPointerEvent = void 0;
28379
- _this.supportTouchEvent = void 0;
28436
+ _this.supportsPointerEvents = void 0;
28437
+ _this.supportsTouchEvents = void 0;
28380
28438
  _this.isTouchEvent = void 0;
28381
28439
  _this.isMouseEvent = void 0;
28382
28440
  _this.Element = DisplayObject;
@@ -28401,8 +28459,8 @@
28401
28459
  requestAnimationFrame = config.requestAnimationFrame,
28402
28460
  cancelAnimationFrame = config.cancelAnimationFrame,
28403
28461
  createImage = config.createImage,
28404
- supportPointerEvent = config.supportPointerEvent,
28405
- supportTouchEvent = config.supportTouchEvent,
28462
+ supportsPointerEvents = config.supportsPointerEvents,
28463
+ supportsTouchEvents = config.supportsTouchEvents,
28406
28464
  isTouchEvent = config.isTouchEvent,
28407
28465
  isMouseEvent = config.isMouseEvent;
28408
28466
  cleanExistedCanvas(container, _assertThisInitialized(_this));
@@ -28431,13 +28489,13 @@
28431
28489
  // the following feature-detect from hammer.js
28432
28490
  // @see https://github.com/hammerjs/hammer.js/blob/master/src/inputjs/input-consts.js#L5
28433
28491
 
28434
- _this.supportTouchEvent = supportTouchEvent !== null && supportTouchEvent !== void 0 ? supportTouchEvent : 'ontouchstart' in globalThis;
28435
- _this.supportPointerEvent = supportPointerEvent !== null && supportPointerEvent !== void 0 ? supportPointerEvent : !!globalThis.PointerEvent;
28492
+ _this.supportsTouchEvents = supportsTouchEvents !== null && supportsTouchEvents !== void 0 ? supportsTouchEvents : 'ontouchstart' in globalThis;
28493
+ _this.supportsPointerEvents = supportsPointerEvents !== null && supportsPointerEvents !== void 0 ? supportsPointerEvents : !!globalThis.PointerEvent;
28436
28494
  _this.isTouchEvent = isTouchEvent !== null && isTouchEvent !== void 0 ? isTouchEvent : function (event) {
28437
- return _this.supportTouchEvent && event instanceof globalThis.TouchEvent;
28495
+ return _this.supportsTouchEvents && event instanceof globalThis.TouchEvent;
28438
28496
  };
28439
28497
  _this.isMouseEvent = isMouseEvent !== null && isMouseEvent !== void 0 ? isMouseEvent : function (event) {
28440
- return !globalThis.MouseEvent || event instanceof globalThis.MouseEvent && (!_this.supportPointerEvent || !(event instanceof globalThis.PointerEvent));
28498
+ return !globalThis.MouseEvent || event instanceof globalThis.MouseEvent && (!_this.supportsPointerEvents || !(event instanceof globalThis.PointerEvent));
28441
28499
  };
28442
28500
 
28443
28501
  _this.initRenderingContext({