@joint/core 4.2.1 → 4.2.3

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/src/util/util.mjs CHANGED
@@ -97,11 +97,9 @@ export const parseDOMJSON = function(json, namespace) {
97
97
  if (!nodeDef.hasOwnProperty('tagName')) throw new Error('json-dom-parser: missing tagName');
98
98
  const tagName = nodeDef.tagName;
99
99
 
100
- let node;
101
-
102
100
  // Namespace URI
103
101
  const ns = (nodeDef.hasOwnProperty('namespaceURI')) ? nodeDef.namespaceURI : parentNS;
104
- node = document.createElementNS(ns, tagName);
102
+ const node = document.createElementNS(ns, tagName);
105
103
  const svg = (ns === svgNamespace);
106
104
 
107
105
  const wrapperNode = (svg) ? V(node) : $(node);
@@ -316,7 +314,7 @@ export const normalizeEvent = function(evt) {
316
314
  // If the event is a touch event, normalize it to a mouse event.
317
315
  const touch = originalEvent && originalEvent.changedTouches && originalEvent.changedTouches[0];
318
316
  if (touch) {
319
- for (let property in touch) {
317
+ for (const property in touch) {
320
318
  // copy all the properties from the first touch that are not
321
319
  // defined on TouchEvent (clientX, clientY, pageX, pageY, screenX, screenY, identifier, ...)
322
320
  if (evt[property] === undefined) {
@@ -315,7 +315,7 @@ const isSymbol = (value) => {
315
315
 
316
316
  const initCloneArray = (array) => {
317
317
  const length = array.length;
318
- let result = new array.constructor(length);
318
+ const result = new array.constructor(length);
319
319
 
320
320
  if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
321
321
  result.index = array.index;
@@ -538,7 +538,7 @@ const baseIsEqual = (value, other, stack) => {
538
538
  };
539
539
 
540
540
  const baseIsEqualDeep = (object, other, equalFunc, stack) => {
541
- let objIsArr = Array.isArray(object);
541
+ const objIsArr = Array.isArray(object);
542
542
  const othIsArr = Array.isArray(other);
543
543
  let objTag = objIsArr ? arrayTag : getTag(object);
544
544
  let othTag = othIsArr ? arrayTag : getTag(other);
@@ -546,7 +546,7 @@ const baseIsEqualDeep = (object, other, equalFunc, stack) => {
546
546
  objTag = objTag == argsTag ? objectTag : objTag;
547
547
  othTag = othTag == argsTag ? objectTag : othTag;
548
548
 
549
- let objIsObj = objTag == objectTag;
549
+ const objIsObj = objTag == objectTag;
550
550
  const othIsObj = othTag == objectTag;
551
551
  const isSameTag = objTag == othTag;
552
552
 
@@ -710,7 +710,7 @@ const equalByTag = (object, other, tag, equalFunc, stack) => {
710
710
 
711
711
  const mapToArray = (map) => {
712
712
  let index = -1;
713
- let result = Array(map.size);
713
+ const result = Array(map.size);
714
714
 
715
715
  map.forEach((value, key) => {
716
716
  result[++index] = [key, value];
@@ -852,7 +852,7 @@ const diff = (array, values) => {
852
852
  }
853
853
 
854
854
  outer:
855
- for (let key in array) {
855
+ for (const key in array) {
856
856
  let value = array[key];
857
857
  const computed = value;
858
858
 
package/types/joint.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { g } from './geometry';
2
- import { Vectorizer } from './vectorizer';
1
+ import type { g } from './geometry';
2
+ import type { Vectorizer } from './vectorizer';
3
3
 
4
4
  export const version: string;
5
5
 
@@ -323,6 +323,7 @@ export namespace dia {
323
323
  constructor(attributes?: Graph.Attributes, opt?: {
324
324
  cellNamespace?: any,
325
325
  layerNamespace?: any,
326
+ ignoreLayers?: boolean,
326
327
  /** @deprecated use cellNamespace instead */
327
328
  cellModel?: typeof Cell
328
329
  });
@@ -551,7 +552,7 @@ export namespace dia {
551
552
  }
552
553
 
553
554
  interface ExportOptions {
554
- ignoreDefault?: boolean | string[];
555
+ ignoreDefaults?: boolean | string[];
555
556
  ignoreEmptyAttributes?: boolean;
556
557
  }
557
558
 
@@ -1667,8 +1668,8 @@ export namespace dia {
1667
1668
  moveThreshold?: number;
1668
1669
  magnetThreshold?: number | string;
1669
1670
  // views
1670
- elementView?: typeof ElementView | ((element: Element) => typeof ElementView);
1671
- linkView?: typeof LinkView | ((link: Link) => typeof LinkView);
1671
+ elementView?: typeof ElementView<any> | ((element: Element) => typeof ElementView<any> | null | undefined);
1672
+ linkView?: typeof LinkView<any> | ((link: Link) => typeof LinkView<any> | null | undefined);
1672
1673
  measureNode?: MeasureNodeCallback;
1673
1674
  // embedding
1674
1675
  embeddingMode?: boolean;
@@ -3240,6 +3241,7 @@ export namespace util {
3240
3241
 
3241
3242
  export function toArray(value: any): any[];
3242
3243
 
3244
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
3243
3245
  export function debounce<T extends Function>(func: T, wait?: number, options?: { leading?: boolean, maxWait?: number, trailing?: boolean }): T & Cancelable;
3244
3246
 
3245
3247
  export function groupBy(collection: Collection, iteratee?: IterateeFunction<any>): object;
@@ -1,4 +1,4 @@
1
- import { g } from './geometry';
1
+ import type { g } from './geometry';
2
2
 
3
3
  export const V: VCallable;
4
4
  export type V = VElement;