@joint/core 4.0.3 → 4.0.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/README.md CHANGED
@@ -5,13 +5,13 @@
5
5
  [![NPM Version](https://img.shields.io/npm/v/jointjs)](https://www.npmjs.com/package/jointjs)
6
6
  [![NPM License](https://img.shields.io/npm/l/jointjs?color=blue)](https://github.com/clientIO/joint/blob/master/LICENSE)
7
7
 
8
- [JointJS](https://jointjs.com) is a tested and proven *JavaScript*/*Typescript* diagramming library that helps developers and companies of any size build visual and No-Code/Low-Code applications faster and with confidence. It’s a flexible tool from which a wide range of UIs can be created (interactive diagramming applications, drawing tools, data visualizations, UIs for monitoring systems, and many more). It can become the foundational layer of your next application and help you bring your idea to market in days, not months or years.
8
+ [JointJS](https://jointjs.com) is a tested and proven *JavaScript*/*Typescript* diagramming library that helps developers and companies of any size build visual and No-Code/Low-Code applications faster and with confidence. It’s a flexible tool from which a wide range of UIs can be created (interactive diagramming applications, drawing tools, data visualizations, UIs for monitoring systems, and many more). It can become the foundational layer of your next application and help you bring your idea to market in days, not months or years.
9
9
 
10
10
  ![Use Cases](https://user-images.githubusercontent.com/3967880/200360293-808f148c-32af-4f46-bec1-b4ae4e1592a0.jpg)
11
11
 
12
12
  Further **information**, **examples** and **documentation** can be found at [jointjs.com](https://jointjs.com).
13
13
 
14
- :1234: Get started with [tutorials](https://resources.jointjs.com/tutorial).
14
+ :1234: Get started with [tutorials](https://docs.jointjs.com).
15
15
 
16
16
  :bulb: To ask a question, share feedback, or engage in a discussion with other community members, visit our [GitHub discussions](https://github.com/clientIO/joint/discussions).
17
17
 
package/dist/geometry.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.0.3 (2024-05-14) - JavaScript diagramming library
1
+ /*! JointJS v4.0.4 (2024-05-31) - JavaScript diagramming library
2
2
 
3
3
 
4
4
  This Source Code Form is subject to the terms of the Mozilla Public
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.0.3 (2024-05-14) - JavaScript diagramming library
1
+ /*! JointJS v4.0.4 (2024-05-31) - JavaScript diagramming library
2
2
 
3
3
 
4
4
  This Source Code Form is subject to the terms of the Mozilla Public
package/dist/joint.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.0.3 (2024-05-14) - JavaScript diagramming library
1
+ /*! JointJS v4.0.4 (2024-05-31) - JavaScript diagramming library
2
2
 
3
3
 
4
4
  This Source Code Form is subject to the terms of the Mozilla Public
@@ -618,6 +618,16 @@ export declare namespace connectors {
618
618
  var curve: CurveConnector;
619
619
  }
620
620
 
621
+ declare type DeepPartial<T> = _DeepPartial<_DeepRequired<T>>;
622
+
623
+ declare type _DeepPartial<T> = {
624
+ [P in keyof T]?: T[P] extends object ? _DeepPartial<T[P]> : T[P];
625
+ };
626
+
627
+ declare type _DeepRequired<T> = {
628
+ [P in keyof T]-?: T[P] extends object ? _DeepRequired<T[P]> : T[P];
629
+ };
630
+
621
631
  export declare namespace dia {
622
632
 
623
633
  export type Event = mvc.TriggeredEvent;
@@ -933,7 +943,7 @@ export declare namespace dia {
933
943
 
934
944
  export class Cell<A extends ObjectHash = Cell.Attributes, S extends mvc.ModelSetOptions = dia.ModelSetOptions> extends mvc.Model<A, S> {
935
945
 
936
- constructor(attributes?: A, opt?: Cell.ConstructorOptions);
946
+ constructor(attributes?: DeepPartial<A>, opt?: Cell.ConstructorOptions);
937
947
 
938
948
  id: Cell.ID;
939
949
  graph: Graph;
@@ -967,7 +977,7 @@ export declare namespace dia {
967
977
  isEmbedded(): boolean;
968
978
 
969
979
  prop(key: Path): any;
970
- prop(object: Partial<A>, opt?: Cell.Options): this;
980
+ prop(object: DeepPartial<A>, opt?: Cell.Options): this;
971
981
  prop(key: Path, value: any, opt?: Cell.Options): this;
972
982
 
973
983
  removeProp(path: Path, opt?: Cell.Options): this;
package/dist/joint.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.0.3 (2024-05-14) - JavaScript diagramming library
1
+ /*! JointJS v4.0.4 (2024-05-31) - JavaScript diagramming library
2
2
 
3
3
 
4
4
  This Source Code Form is subject to the terms of the Mozilla Public
@@ -17410,6 +17410,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
17410
17410
  return (attrs.text !== undefined);
17411
17411
  }
17412
17412
 
17413
+ var FONT_ATTRIBUTES = ['font-weight', 'font-family', 'font-size', 'letter-spacing', 'text-transform'];
17414
+
17413
17415
  var textAttributesNS = {
17414
17416
 
17415
17417
  'line-height': {
@@ -17525,18 +17527,28 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
17525
17527
  var text = value.text;
17526
17528
  if (text === undefined) { text = attrs.text; }
17527
17529
  if (text !== undefined) {
17530
+
17528
17531
  var breakTextFn = value.breakText || breakText;
17529
17532
  var computedStyles = getComputedStyle(node);
17533
+ var wrapFontAttributes = {};
17534
+ // The font size attributes must be set on the node
17535
+ // to get the correct text wrapping.
17536
+ // TODO: set the native SVG attributes before special attributes
17537
+ for (var i = 0; i < FONT_ATTRIBUTES.length; i++) {
17538
+ var name = FONT_ATTRIBUTES[i];
17539
+ if (name in attrs) {
17540
+ node.setAttribute(name, attrs[name]);
17541
+ }
17542
+ // Note: computedStyles is a live object
17543
+ // i.e. the properties are evaluated when accessed.
17544
+ wrapFontAttributes[name] = computedStyles[name];
17545
+ }
17530
17546
 
17531
- wrappedText = breakTextFn('' + text, size, {
17532
- 'font-weight': computedStyles.fontWeight,
17533
- 'font-family': computedStyles.fontFamily,
17534
- 'text-transform': computedStyles.textTransform,
17535
- 'font-size': computedStyles.fontSize,
17536
- 'letter-spacing': computedStyles.letterSpacing,
17537
- // The `line-height` attribute in SVG is JoinJS specific.
17538
- 'lineHeight': attrs['line-height'],
17539
- }, {
17547
+ // The `line-height` attribute in SVG is JoinJS specific.
17548
+ // TODO: change the `lineHeight` to breakText option.
17549
+ wrapFontAttributes.lineHeight = attrs['line-height'];
17550
+
17551
+ wrappedText = breakTextFn('' + text, size, wrapFontAttributes, {
17540
17552
  // Provide an existing SVG Document here
17541
17553
  // instead of creating a temporary one over again.
17542
17554
  svgDocument: this.paper.svg,
@@ -17550,7 +17562,11 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
17550
17562
  wrappedText = '';
17551
17563
  }
17552
17564
  textAttributesNS.text.set.call(this, wrappedText, refBBox, node, attrs);
17553
- }
17565
+ },
17566
+ // We expose the font attributes list to allow
17567
+ // the user to take other custom font attributes into account
17568
+ // when wrapping the text.
17569
+ FONT_ATTRIBUTES: FONT_ATTRIBUTES
17554
17570
  },
17555
17571
 
17556
17572
  'title': {
@@ -21617,6 +21633,11 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
21617
21633
  svgforeignobject: function() {
21618
21634
  return !!document.createElementNS &&
21619
21635
  /SVGForeignObject/.test(({}).toString.call(document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject')));
21636
+ },
21637
+
21638
+ // works for iOS browsers too
21639
+ isSafari: function() {
21640
+ return /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);
21620
21641
  }
21621
21642
  },
21622
21643
 
@@ -32485,6 +32506,11 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
32485
32506
  this.updateHighlighters(true);
32486
32507
  this.updateTools(opt);
32487
32508
  flags = this.removeFlag(flags, [Flags$2.RENDER, Flags$2.UPDATE, Flags$2.LABELS, Flags$2.TOOLS, Flags$2.CONNECTOR]);
32509
+
32510
+ if (env.test('isSafari')) {
32511
+ this.__fixSafariBug268376();
32512
+ }
32513
+
32488
32514
  return flags;
32489
32515
  }
32490
32516
 
@@ -32538,6 +32564,20 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
32538
32564
  return flags;
32539
32565
  },
32540
32566
 
32567
+ __fixSafariBug268376: function() {
32568
+ // Safari has a bug where any change after the first render is not reflected in the DOM.
32569
+ // https://bugs.webkit.org/show_bug.cgi?id=268376
32570
+ var ref = this;
32571
+ var el = ref.el;
32572
+ var childNodes = Array.from(el.childNodes);
32573
+ var fragment = document.createDocumentFragment();
32574
+ for (var i = 0, n = childNodes.length; i < n; i++) {
32575
+ el.removeChild(childNodes[i]);
32576
+ fragment.appendChild(childNodes[i]);
32577
+ }
32578
+ el.appendChild(fragment);
32579
+ },
32580
+
32541
32581
  requestConnectionUpdate: function(opt) {
32542
32582
  this.requestUpdate(this.getFlag(Flags$2.UPDATE), opt);
32543
32583
  },
@@ -39948,7 +39988,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
39948
39988
  Control: Control
39949
39989
  });
39950
39990
 
39951
- var version = "4.0.3";
39991
+ var version = "4.0.4";
39952
39992
 
39953
39993
  var Vectorizer = V;
39954
39994
  var layout = { PortLabel: PortLabel, Port: Port };