@joint/core 4.2.0-beta.4 → 4.2.1

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.
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.2.0-beta.4 (2025-11-07) - JavaScript diagramming library
1
+ /*! JointJS v4.2.1 (2025-11-20) - JavaScript diagramming library
2
2
 
3
3
  This Source Code Form is subject to the terms of the Mozilla Public
4
4
  License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.2.0-beta.4 (2025-11-07) - JavaScript diagramming library
1
+ /*! JointJS v4.2.1 (2025-11-20) - JavaScript diagramming library
2
2
 
3
3
  This Source Code Form is subject to the terms of the Mozilla Public
4
4
  License, v. 2.0. If a copy of the MPL was not distributed with this
package/dist/version.mjs CHANGED
@@ -1,3 +1,3 @@
1
- var version = "4.2.0-beta.4";
1
+ var version = "4.2.1";
2
2
 
3
3
  export { version };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@joint/core",
3
3
  "title": "JointJS",
4
- "version": "4.2.0-beta.4",
4
+ "version": "4.2.1",
5
5
  "description": "JavaScript diagramming library",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/joint.min.js",
package/types/joint.d.ts CHANGED
@@ -25,6 +25,11 @@ type _DeepPartial<T> = {
25
25
 
26
26
  type DeepPartial<T> = _DeepPartial<_DeepRequired<T>>;
27
27
 
28
+ /**
29
+ * A type that makes all properties of T nullable.
30
+ */
31
+ type Nullable<T> = { [K in keyof T]: T[K] | null };
32
+
28
33
  // We use `DOMElement` later in the code, to avoid conflicts with the `dia.Element` type.
29
34
  type DOMElement = Element;
30
35
 
@@ -493,7 +498,7 @@ export namespace dia {
493
498
  }
494
499
 
495
500
  interface Selectors {
496
- [selector: string]: attributes.SVGAttributes | undefined;
501
+ [selector: string]: Nullable<attributes.SVGAttributes> | undefined;
497
502
  }
498
503
 
499
504
  interface Attributes extends GenericAttributes<Selectors> {
@@ -918,18 +923,7 @@ export namespace dia {
918
923
  connector?: connectors.Connector | connectors.ConnectorJSON;
919
924
  }
920
925
 
921
- interface LinkSelectors extends Cell.Selectors {
922
- '.connection'?: attributes.SVGPathAttributes;
923
- '.connection-wrap'?: attributes.SVGPathAttributes;
924
- '.marker-source'?: attributes.SVGPathAttributes;
925
- '.marker-target'?: attributes.SVGPathAttributes;
926
- '.labels'?: attributes.SVGAttributes;
927
- '.marker-vertices'?: attributes.SVGAttributes;
928
- '.marker-arrowheads'?: attributes.SVGAttributes;
929
- '.link-tools'?: attributes.SVGAttributes;
930
- }
931
-
932
- interface Attributes extends Cell.GenericAttributes<LinkSelectors> {
926
+ interface Attributes extends Cell.GenericAttributes<Cell.Selectors> {
933
927
  }
934
928
 
935
929
  interface LabelPosition {
@@ -2740,43 +2734,43 @@ export namespace highlighters {
2740
2734
  export namespace shapes {
2741
2735
 
2742
2736
  interface SVGTextSelector extends dia.Cell.Selectors {
2743
- text?: attributes.SVGTextAttributes;
2737
+ text?: Nullable<attributes.SVGTextAttributes>;
2744
2738
  }
2745
2739
 
2746
2740
  interface SVGRectSelector extends dia.Cell.Selectors {
2747
- rect?: attributes.SVGRectAttributes;
2741
+ rect?: Nullable<attributes.SVGRectAttributes>;
2748
2742
  }
2749
2743
 
2750
2744
  interface SVGCircleSelector extends dia.Cell.Selectors {
2751
- circle?: attributes.SVGCircleAttributes;
2745
+ circle?: Nullable<attributes.SVGCircleAttributes>;
2752
2746
  }
2753
2747
 
2754
2748
  interface SVGEllipseSelector extends dia.Cell.Selectors {
2755
- ellipse?: attributes.SVGEllipseAttributes;
2749
+ ellipse?: Nullable<attributes.SVGEllipseAttributes>;
2756
2750
  }
2757
2751
 
2758
2752
  interface SVGPolygonSelector extends dia.Cell.Selectors {
2759
- polygon?: attributes.SVGPolygonAttributes;
2753
+ polygon?: Nullable<attributes.SVGPolygonAttributes>;
2760
2754
  }
2761
2755
 
2762
2756
  interface SVGPolylineSelector extends dia.Cell.Selectors {
2763
- polyline?: attributes.SVGPolylineAttributes;
2757
+ polyline?: Nullable<attributes.SVGPolylineAttributes>;
2764
2758
  }
2765
2759
 
2766
2760
  interface SVGImageSelector extends dia.Cell.Selectors {
2767
- image?: attributes.SVGImageAttributes;
2761
+ image?: Nullable<attributes.SVGImageAttributes>;
2768
2762
  }
2769
2763
 
2770
2764
  interface SVGPathSelector extends dia.Cell.Selectors {
2771
- path?: attributes.SVGPathAttributes;
2765
+ path?: Nullable<attributes.SVGPathAttributes>;
2772
2766
  }
2773
2767
 
2774
2768
  namespace standard {
2775
2769
 
2776
2770
  interface RectangleSelectors extends dia.Cell.Selectors {
2777
- root?: attributes.SVGAttributes;
2778
- body?: attributes.SVGRectAttributes;
2779
- label?: attributes.SVGTextAttributes;
2771
+ root?: Nullable<attributes.SVGAttributes>;
2772
+ body?: Nullable<attributes.SVGRectAttributes>;
2773
+ label?: Nullable<attributes.SVGTextAttributes>;
2780
2774
  }
2781
2775
 
2782
2776
  type RectangleAttributes = dia.Element.GenericAttributes<RectangleSelectors>;
@@ -2785,9 +2779,9 @@ export namespace shapes {
2785
2779
  }
2786
2780
 
2787
2781
  interface CircleSelectors extends dia.Cell.Selectors {
2788
- root?: attributes.SVGAttributes;
2789
- body?: attributes.SVGCircleAttributes;
2790
- label?: attributes.SVGTextAttributes;
2782
+ root?: Nullable<attributes.SVGAttributes>;
2783
+ body?: Nullable<attributes.SVGCircleAttributes>;
2784
+ label?: Nullable<attributes.SVGTextAttributes>;
2791
2785
  }
2792
2786
 
2793
2787
  type CircleAttributes = dia.Element.GenericAttributes<CircleSelectors>;
@@ -2796,9 +2790,9 @@ export namespace shapes {
2796
2790
  }
2797
2791
 
2798
2792
  interface EllipseSelectors extends dia.Cell.Selectors {
2799
- root?: attributes.SVGAttributes;
2800
- body?: attributes.SVGEllipseAttributes;
2801
- label?: attributes.SVGTextAttributes;
2793
+ root?: Nullable<attributes.SVGAttributes>;
2794
+ body?: Nullable<attributes.SVGEllipseAttributes>;
2795
+ label?: Nullable<attributes.SVGTextAttributes>;
2802
2796
  }
2803
2797
 
2804
2798
  type EllipseAttributes = dia.Element.GenericAttributes<EllipseSelectors>;
@@ -2807,9 +2801,9 @@ export namespace shapes {
2807
2801
  }
2808
2802
 
2809
2803
  interface PathSelectors extends dia.Cell.Selectors {
2810
- root?: attributes.SVGAttributes;
2811
- body?: attributes.SVGPathAttributes;
2812
- label?: attributes.SVGTextAttributes;
2804
+ root?: Nullable<attributes.SVGAttributes>;
2805
+ body?: Nullable<attributes.SVGPathAttributes>;
2806
+ label?: Nullable<attributes.SVGTextAttributes>;
2813
2807
  }
2814
2808
 
2815
2809
  type PathAttributes = dia.Element.GenericAttributes<PathSelectors>;
@@ -2818,9 +2812,9 @@ export namespace shapes {
2818
2812
  }
2819
2813
 
2820
2814
  interface PolygonSelectors extends dia.Cell.Selectors {
2821
- root?: attributes.SVGAttributes;
2822
- body?: attributes.SVGPolygonAttributes;
2823
- label?: attributes.SVGTextAttributes;
2815
+ root?: Nullable<attributes.SVGAttributes>;
2816
+ body?: Nullable<attributes.SVGPolygonAttributes>;
2817
+ label?: Nullable<attributes.SVGTextAttributes>;
2824
2818
  }
2825
2819
 
2826
2820
  type PolygonAttributes = dia.Element.GenericAttributes<PolygonSelectors>;
@@ -2829,9 +2823,9 @@ export namespace shapes {
2829
2823
  }
2830
2824
 
2831
2825
  interface PolylineSelectors extends dia.Cell.Selectors {
2832
- root?: attributes.SVGAttributes;
2833
- body?: attributes.SVGPolylineAttributes;
2834
- label?: attributes.SVGTextAttributes;
2826
+ root?: Nullable<attributes.SVGAttributes>;
2827
+ body?: Nullable<attributes.SVGPolylineAttributes>;
2828
+ label?: Nullable<attributes.SVGTextAttributes>;
2835
2829
  }
2836
2830
 
2837
2831
  type PolylineAttributes = dia.Element.GenericAttributes<PolylineSelectors>;
@@ -2840,9 +2834,9 @@ export namespace shapes {
2840
2834
  }
2841
2835
 
2842
2836
  interface ImageSelectors extends dia.Cell.Selectors {
2843
- root?: attributes.SVGAttributes;
2844
- image?: attributes.SVGImageAttributes;
2845
- label?: attributes.SVGTextAttributes;
2837
+ root?: Nullable<attributes.SVGAttributes>;
2838
+ image?: Nullable<attributes.SVGImageAttributes>;
2839
+ label?: Nullable<attributes.SVGTextAttributes>;
2846
2840
  }
2847
2841
 
2848
2842
  type ImageAttributes = dia.Element.GenericAttributes<ImageSelectors>;
@@ -2851,11 +2845,11 @@ export namespace shapes {
2851
2845
  }
2852
2846
 
2853
2847
  interface BorderedImageSelectors extends dia.Cell.Selectors {
2854
- root?: attributes.SVGAttributes;
2855
- border?: attributes.SVGRectAttributes;
2856
- background?: attributes.SVGRectAttributes;
2857
- image?: attributes.SVGImageAttributes;
2858
- label?: attributes.SVGTextAttributes;
2848
+ root?: Nullable<attributes.SVGAttributes>;
2849
+ border?: Nullable<attributes.SVGRectAttributes>;
2850
+ background?: Nullable<attributes.SVGRectAttributes>;
2851
+ image?: Nullable<attributes.SVGImageAttributes>;
2852
+ label?: Nullable<attributes.SVGTextAttributes>;
2859
2853
  }
2860
2854
 
2861
2855
  type BorderedImageAttributes = dia.Element.GenericAttributes<BorderedImageSelectors>;
@@ -2864,10 +2858,10 @@ export namespace shapes {
2864
2858
  }
2865
2859
 
2866
2860
  interface EmbeddedImageSelectors extends dia.Cell.Selectors {
2867
- root?: attributes.SVGAttributes;
2868
- body?: attributes.SVGRectAttributes;
2869
- image?: attributes.SVGImageAttributes;
2870
- label?: attributes.SVGTextAttributes;
2861
+ root?: Nullable<attributes.SVGAttributes>;
2862
+ body?: Nullable<attributes.SVGRectAttributes>;
2863
+ image?: Nullable<attributes.SVGImageAttributes>;
2864
+ label?: Nullable<attributes.SVGTextAttributes>;
2871
2865
  }
2872
2866
 
2873
2867
  type EmbeddedImageAttributes = dia.Element.GenericAttributes<EmbeddedImageSelectors>;
@@ -2876,11 +2870,11 @@ export namespace shapes {
2876
2870
  }
2877
2871
 
2878
2872
  interface InscribedImageSelectors extends dia.Cell.Selectors {
2879
- root?: attributes.SVGAttributes;
2880
- border?: attributes.SVGEllipseAttributes;
2881
- background?: attributes.SVGEllipseAttributes;
2882
- image?: attributes.SVGImageAttributes;
2883
- label?: attributes.SVGTextAttributes;
2873
+ root?: Nullable<attributes.SVGAttributes>;
2874
+ border?: Nullable<attributes.SVGEllipseAttributes>;
2875
+ background?: Nullable<attributes.SVGEllipseAttributes>;
2876
+ image?: Nullable<attributes.SVGImageAttributes>;
2877
+ label?: Nullable<attributes.SVGTextAttributes>;
2884
2878
  }
2885
2879
 
2886
2880
  type InscribedImageAttributes = dia.Element.GenericAttributes<InscribedImageSelectors>;
@@ -2889,11 +2883,11 @@ export namespace shapes {
2889
2883
  }
2890
2884
 
2891
2885
  interface HeaderedRectangleSelectors extends dia.Cell.Selectors {
2892
- root?: attributes.SVGAttributes;
2893
- body?: attributes.SVGRectAttributes;
2894
- header?: attributes.SVGRectAttributes;
2895
- headerText?: attributes.SVGTextAttributes;
2896
- bodyText?: attributes.SVGTextAttributes;
2886
+ root?: Nullable<attributes.SVGAttributes>;
2887
+ body?: Nullable<attributes.SVGRectAttributes>;
2888
+ header?: Nullable<attributes.SVGRectAttributes>;
2889
+ headerText?: Nullable<attributes.SVGTextAttributes>;
2890
+ bodyText?: Nullable<attributes.SVGTextAttributes>;
2897
2891
  }
2898
2892
 
2899
2893
  type HeaderedRectangleAttributes = dia.Element.GenericAttributes<HeaderedRectangleSelectors>;
@@ -2906,9 +2900,9 @@ export namespace shapes {
2906
2900
  }
2907
2901
 
2908
2902
  interface CylinderSelectors extends dia.Cell.Selectors {
2909
- root?: attributes.SVGAttributes;
2903
+ root?: Nullable<attributes.SVGAttributes>;
2910
2904
  body?: CylinderBodyAttributes;
2911
- top?: attributes.SVGEllipseAttributes;
2905
+ top?: Nullable<attributes.SVGEllipseAttributes>;
2912
2906
  }
2913
2907
 
2914
2908
  type CylinderAttributes = dia.Element.GenericAttributes<CylinderSelectors>;
@@ -2919,13 +2913,13 @@ export namespace shapes {
2919
2913
  }
2920
2914
 
2921
2915
  interface TextBlockSelectors extends dia.Cell.Selectors {
2922
- root?: attributes.SVGAttributes;
2923
- body?: attributes.SVGRectAttributes;
2924
- label?: {
2916
+ root?: Nullable<attributes.SVGAttributes>;
2917
+ body?: Nullable<attributes.SVGRectAttributes>;
2918
+ label?: Nullable<{
2925
2919
  text?: string;
2926
2920
  style?: { [key: string]: any };
2927
2921
  [key: string]: any;
2928
- };
2922
+ }>;
2929
2923
  }
2930
2924
 
2931
2925
  type TextBlockAttributes = dia.Element.GenericAttributes<TextBlockSelectors>;
@@ -2934,9 +2928,9 @@ export namespace shapes {
2934
2928
  }
2935
2929
 
2936
2930
  interface LinkSelectors extends dia.Cell.Selectors {
2937
- root?: attributes.SVGAttributes;
2938
- line?: attributes.SVGPathAttributes;
2939
- wrapper?: attributes.SVGPathAttributes;
2931
+ root?: Nullable<attributes.SVGAttributes>;
2932
+ line?: Nullable<attributes.SVGPathAttributes>;
2933
+ wrapper?: Nullable<attributes.SVGPathAttributes>;
2940
2934
  }
2941
2935
 
2942
2936
  type LinkAttributes = dia.Link.GenericAttributes<LinkSelectors>;
@@ -2945,9 +2939,9 @@ export namespace shapes {
2945
2939
  }
2946
2940
 
2947
2941
  interface DoubleLinkSelectors extends dia.Cell.Selectors {
2948
- root?: attributes.SVGAttributes;
2949
- line?: attributes.SVGPathAttributes;
2950
- outline?: attributes.SVGPathAttributes;
2942
+ root?: Nullable<attributes.SVGAttributes>;
2943
+ line?: Nullable<attributes.SVGPathAttributes>;
2944
+ outline?: Nullable<attributes.SVGPathAttributes>;
2951
2945
  }
2952
2946
 
2953
2947
  type DoubleLinkAttributes = dia.Link.GenericAttributes<DoubleLinkSelectors>;
@@ -2956,9 +2950,9 @@ export namespace shapes {
2956
2950
  }
2957
2951
 
2958
2952
  interface ShadowLinkSelectors extends dia.Cell.Selectors {
2959
- root?: attributes.SVGAttributes;
2960
- line?: attributes.SVGPathAttributes;
2961
- shadow?: attributes.SVGPathAttributes;
2953
+ root?: Nullable<attributes.SVGAttributes>;
2954
+ line?: Nullable<attributes.SVGPathAttributes>;
2955
+ shadow?: Nullable<attributes.SVGPathAttributes>;
2962
2956
  }
2963
2957
 
2964
2958
  type ShadowLinkAttributes = dia.Link.GenericAttributes<ShadowLinkSelectors>;
@@ -2966,52 +2960,6 @@ export namespace shapes {
2966
2960
  class ShadowLink extends dia.Link<ShadowLinkAttributes> {
2967
2961
  }
2968
2962
  }
2969
-
2970
- namespace devs {
2971
-
2972
- interface ModelSelectors extends dia.Cell.Selectors {
2973
- '.label'?: attributes.SVGTextAttributes;
2974
- '.body'?: attributes.SVGRectAttributes;
2975
- }
2976
-
2977
- interface ModelAttributes extends dia.Element.GenericAttributes<ModelSelectors> {
2978
- inPorts?: string[];
2979
- outPorts?: string[];
2980
- }
2981
-
2982
- class Model extends dia.Element {
2983
-
2984
- constructor(attributes?: ModelAttributes, opt?: { [key: string]: any });
2985
-
2986
- changeInGroup(properties: any, opt?: any): boolean;
2987
-
2988
- changeOutGroup(properties: any, opt?: any): boolean;
2989
-
2990
- createPortItem(group: string, port: string): any;
2991
-
2992
- createPortItems(group: string, ports: string[]): any[];
2993
-
2994
- addOutPort(port: string, opt?: any): this;
2995
-
2996
- addInPort(port: string, opt?: any): this;
2997
-
2998
- removeOutPort(port: string, opt?: any): this;
2999
-
3000
- removeInPort(port: string, opt?: any): this;
3001
- }
3002
-
3003
- class Coupled extends Model {
3004
-
3005
- }
3006
-
3007
- class Atomic extends Model {
3008
-
3009
- }
3010
-
3011
- class Link extends dia.Link {
3012
-
3013
- }
3014
- }
3015
2963
  }
3016
2964
 
3017
2965
  // util
@@ -3370,9 +3318,17 @@ export namespace layout {
3370
3318
  angle: number;
3371
3319
  };
3372
3320
 
3373
- type LayoutFunction = (ports: Array<dia.Element.Port>, elBBox: g.Rect, opt: Options) => Array<Transformation>;
3321
+ interface LayoutOptions {
3322
+ [key: string]: any;
3323
+ }
3374
3324
 
3375
- interface Options {
3325
+ type LayoutFunction<T = LayoutOptions> = (
3326
+ portsArgs: Array<T>,
3327
+ elBBox: g.Rect,
3328
+ portGroupArgs: LayoutOptions
3329
+ ) => Array<Partial<Transformation>>;
3330
+
3331
+ interface Options extends LayoutOptions {
3376
3332
  x?: number | string;
3377
3333
  y?: number | string;
3378
3334
  dx?: number;
@@ -3383,19 +3339,20 @@ export namespace layout {
3383
3339
  startAngle?: number;
3384
3340
  step?: number;
3385
3341
  compensateRotation?: boolean;
3386
- [key: string]: any;
3387
3342
  }
3388
3343
 
3389
- export var absolute: LayoutFunction;
3344
+ /** @todo define Options types per-layout */
3345
+ export var absolute: LayoutFunction<Options>;
3346
+ export var line: LayoutFunction<Options>;
3347
+ export var left: LayoutFunction<Options>;
3348
+ export var right: LayoutFunction<Options>;
3349
+ export var top: LayoutFunction<Options>;
3350
+ export var bottom: LayoutFunction<Options>;
3351
+ export var ellipseSpread: LayoutFunction<Options>;
3352
+ export var ellipse: LayoutFunction<Options>;
3353
+
3390
3354
  /** @deprecated */
3391
- export var fn: LayoutFunction;
3392
- export var line: LayoutFunction;
3393
- export var left: LayoutFunction;
3394
- export var right: LayoutFunction;
3395
- export var top: LayoutFunction;
3396
- export var bottom: LayoutFunction;
3397
- export var ellipseSpread: LayoutFunction;
3398
- export var ellipse: LayoutFunction;
3355
+ export var fn: LayoutFunction<Options>;
3399
3356
  }
3400
3357
 
3401
3358
  export namespace PortLabel {