@metadev/daga 4.2.12 → 4.2.13

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/Changelog.md CHANGED
@@ -6,6 +6,10 @@ List of releases and changes.
6
6
 
7
7
  ## Next release Joyeuse
8
8
 
9
+ ## v. 4.2.13
10
+
11
+ - Fix check for whether a browser is Safari [#363](https://github.com/metadevpro/daga/pull/363)
12
+
9
13
  ## v. 4.2.12
10
14
 
11
15
  - Force location of field `<foreignObject>` tags in webkit browsers [#356](https://github.com/metadevpro/daga/pull/356)
package/index.cjs.js CHANGED
@@ -7414,8 +7414,8 @@ const unrotate = (width, height, orientation) => {
7414
7414
  return [oldWidth, oldHeight];
7415
7415
  };
7416
7416
 
7417
- var _a;
7418
- const isWebkit = ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) === null || _a === void 0 ? void 0 : _a.indexOf('AppleWebKit')) >= 0;
7417
+ const isUserAgentSafari = userAgent => /^((?!chrome|android).)*safari/i.test(userAgent);
7418
+ const isSafari = isUserAgentSafari(navigator.userAgent);
7419
7419
 
7420
7420
  /**
7421
7421
  * Thickness of the invisible path around a connection used to make it easier to click on, in diagram units.
@@ -7714,7 +7714,7 @@ class DiagramCanvas {
7714
7714
  const transformAttribute = event.transform.toString();
7715
7715
  this.selectCanvasElements().attr('transform', transformAttribute);
7716
7716
  d3__namespace.select(`#${this.backgroundPatternId}`).attr('patternTransform', transformAttribute);
7717
- if (isWebkit) {
7717
+ if (isSafari) {
7718
7718
  // force update fields to compensate for a rendering bug in webkit
7719
7719
  this.updateFieldsInView();
7720
7720
  }
@@ -8676,7 +8676,7 @@ class DiagramCanvas {
8676
8676
  this.secondaryButton = false;
8677
8677
  })).append('xhtml:div').style('width', '100%').style('height', '100%').style('display', 'flex').append('xhtml:p').style('box-sizing', 'border-box').style('outline', 0).style('margin', 0).style('border', 0).style('padding', 0).style('user-select', 'none').style('font-kerning', 'none').style('white-space', 'nowrap');
8678
8678
  mergeSelection.attr('x', 0).attr('y', 0).attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1).select('div').style('justify-content', d => d.horizontalAlign === exports.HorizontalAlign.Center ? 'center' : d.horizontalAlign === exports.HorizontalAlign.Right ? 'flex-end' : 'flex-start').style('align-items', d => d.verticalAlign === exports.VerticalAlign.Center ? 'center' : d.verticalAlign === exports.VerticalAlign.Bottom ? 'end' : 'start').select('p').style('max-width', d => d.fit ? 'default' : `${unrotate(d.width, d.height, d.orientation)[0]}px`).style('max-height', d => d.fit ? 'default' : `${unrotate(d.width, d.height, d.orientation)[1]}px`).style('overflow', d => d.fit ? 'default' : 'clip').style('text-overflow', d => d.fit ? 'default' : 'ellipsis').style('text-align', d => d.horizontalAlign === exports.HorizontalAlign.Center ? 'center' : d.horizontalAlign === exports.HorizontalAlign.Right ? 'end' : 'start').style('transform', d => `rotate(${d.orientation}deg)`).style('font-size', d => `${d.fontSize}px`).style('font-family', d => d.fontFamily || "'Wonder Unit Sans', sans-serif").style('font-weight', d => d.highlighted ? 600 : 400).style('color', d => d.selected ? d.selectedColor || '#000000' : d.color || '#000000').html(d => d.text.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\n/g, '<br/>'));
8679
- if (isWebkit) {
8679
+ if (isSafari) {
8680
8680
  const zoomFactor = this.zoomTransform.k;
8681
8681
  mergeSelection.attr('width', d => `${d.width * zoomFactor}px`).attr('height', d => `${d.height * zoomFactor}px`).select('div').style('position', 'absolute').style('left', d => `${d.coords[0] * zoomFactor + this.zoomTransform.x}px`).style('top', d => `${d.coords[1] * zoomFactor + this.zoomTransform.y}px`).select('p').style('font-size', d => `${d.fontSize * zoomFactor}px`);
8682
8682
  }
package/index.esm.js CHANGED
@@ -7393,8 +7393,8 @@ const unrotate = (width, height, orientation) => {
7393
7393
  return [oldWidth, oldHeight];
7394
7394
  };
7395
7395
 
7396
- var _a;
7397
- const isWebkit = ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) === null || _a === void 0 ? void 0 : _a.indexOf('AppleWebKit')) >= 0;
7396
+ const isUserAgentSafari = userAgent => /^((?!chrome|android).)*safari/i.test(userAgent);
7397
+ const isSafari = isUserAgentSafari(navigator.userAgent);
7398
7398
 
7399
7399
  /**
7400
7400
  * Thickness of the invisible path around a connection used to make it easier to click on, in diagram units.
@@ -7693,7 +7693,7 @@ class DiagramCanvas {
7693
7693
  const transformAttribute = event.transform.toString();
7694
7694
  this.selectCanvasElements().attr('transform', transformAttribute);
7695
7695
  d3.select(`#${this.backgroundPatternId}`).attr('patternTransform', transformAttribute);
7696
- if (isWebkit) {
7696
+ if (isSafari) {
7697
7697
  // force update fields to compensate for a rendering bug in webkit
7698
7698
  this.updateFieldsInView();
7699
7699
  }
@@ -8655,7 +8655,7 @@ class DiagramCanvas {
8655
8655
  this.secondaryButton = false;
8656
8656
  })).append('xhtml:div').style('width', '100%').style('height', '100%').style('display', 'flex').append('xhtml:p').style('box-sizing', 'border-box').style('outline', 0).style('margin', 0).style('border', 0).style('padding', 0).style('user-select', 'none').style('font-kerning', 'none').style('white-space', 'nowrap');
8657
8657
  mergeSelection.attr('x', 0).attr('y', 0).attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1).select('div').style('justify-content', d => d.horizontalAlign === HorizontalAlign.Center ? 'center' : d.horizontalAlign === HorizontalAlign.Right ? 'flex-end' : 'flex-start').style('align-items', d => d.verticalAlign === VerticalAlign.Center ? 'center' : d.verticalAlign === VerticalAlign.Bottom ? 'end' : 'start').select('p').style('max-width', d => d.fit ? 'default' : `${unrotate(d.width, d.height, d.orientation)[0]}px`).style('max-height', d => d.fit ? 'default' : `${unrotate(d.width, d.height, d.orientation)[1]}px`).style('overflow', d => d.fit ? 'default' : 'clip').style('text-overflow', d => d.fit ? 'default' : 'ellipsis').style('text-align', d => d.horizontalAlign === HorizontalAlign.Center ? 'center' : d.horizontalAlign === HorizontalAlign.Right ? 'end' : 'start').style('transform', d => `rotate(${d.orientation}deg)`).style('font-size', d => `${d.fontSize}px`).style('font-family', d => d.fontFamily || "'Wonder Unit Sans', sans-serif").style('font-weight', d => d.highlighted ? 600 : 400).style('color', d => d.selected ? d.selectedColor || '#000000' : d.color || '#000000').html(d => d.text.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\n/g, '<br/>'));
8658
- if (isWebkit) {
8658
+ if (isSafari) {
8659
8659
  const zoomFactor = this.zoomTransform.k;
8660
8660
  mergeSelection.attr('width', d => `${d.width * zoomFactor}px`).attr('height', d => `${d.height * zoomFactor}px`).select('div').style('position', 'absolute').style('left', d => `${d.coords[0] * zoomFactor + this.zoomTransform.x}px`).style('top', d => `${d.coords[1] * zoomFactor + this.zoomTransform.y}px`).select('p').style('font-size', d => `${d.fontSize * zoomFactor}px`);
8661
8661
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metadev/daga",
3
- "version": "4.2.12",
3
+ "version": "4.2.13",
4
4
  "dependencies": {},
5
5
  "peerDependencies": {
6
6
  "d3": "^7.9.0",
@@ -1 +1,2 @@
1
- export declare const isWebkit: boolean;
1
+ export declare const isUserAgentSafari: (userAgent: string) => boolean;
2
+ export declare const isSafari: boolean;