@joint/core 4.1.0-beta.1 → 4.1.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.
package/dist/geometry.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.1.0-beta.1 (2024-10-30) - JavaScript diagramming library
1
+ /*! JointJS v4.1.1 (2024-12-02) - 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.1.0-beta.1 (2024-10-30) - JavaScript diagramming library
1
+ /*! JointJS v4.1.1 (2024-12-02) - 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.1.0-beta.1 (2024-10-30) - JavaScript diagramming library
1
+ /*! JointJS v4.1.1 (2024-12-02) - JavaScript diagramming library
2
2
 
3
3
 
4
4
  This Source Code Form is subject to the terms of the Mozilla Public
@@ -1001,7 +1001,7 @@ export declare namespace dia {
1001
1001
 
1002
1002
  export type UnsetCallback<V> = (
1003
1003
  this: V,
1004
- node: Element,
1004
+ node: DOMElement,
1005
1005
  nodeAttributes: { [name: string]: any },
1006
1006
  cellView: V
1007
1007
  ) => string | Array<string> | null | void;
@@ -1010,7 +1010,7 @@ export declare namespace dia {
1010
1010
  this: V,
1011
1011
  attributeValue: any,
1012
1012
  refBBox: g.Rect,
1013
- node: Element,
1013
+ node: DOMElement,
1014
1014
  nodeAttributes: { [name: string]: any },
1015
1015
  cellView: V
1016
1016
  ) => { [key: string]: any } | string | number | void;
@@ -1019,7 +1019,7 @@ export declare namespace dia {
1019
1019
  this: V,
1020
1020
  attributeValue: any,
1021
1021
  refBBox: g.Rect,
1022
- node: Element,
1022
+ node: DOMElement,
1023
1023
  nodeAttributes: { [name: string]: any },
1024
1024
  cellView: V
1025
1025
  ) => dia.Point | null | void;
@@ -1028,7 +1028,7 @@ export declare namespace dia {
1028
1028
  this: V,
1029
1029
  attributeValue: any,
1030
1030
  nodeBBox: g.Rect,
1031
- node: Element,
1031
+ node: DOMElement,
1032
1032
  nodeAttributes: { [name: string]: any },
1033
1033
  cellView: V
1034
1034
  ) => dia.Point | null | void;
@@ -1529,7 +1529,7 @@ export declare namespace dia {
1529
1529
 
1530
1530
  isNodeConnection(node: SVGElement): boolean;
1531
1531
 
1532
- getEventTarget(evt: dia.Event, opt?: { fromPoint?: boolean }): Element;
1532
+ getEventTarget(evt: dia.Event, opt?: { fromPoint?: boolean }): DOMElement;
1533
1533
 
1534
1534
  checkMouseleave(evt: dia.Event): void;
1535
1535
 
@@ -1650,7 +1650,7 @@ export declare namespace dia {
1650
1650
 
1651
1651
  export class ElementView<E extends Element = Element> extends CellViewGeneric<E> {
1652
1652
 
1653
- update(element?: E, renderingOnlyAttrs?: { [key: string]: any }): void;
1653
+ update(element?: DOMElement, renderingOnlyAttrs?: { [key: string]: any }): void;
1654
1654
 
1655
1655
  setInteractivity(value: boolean | ElementView.InteractivityOptions): void;
1656
1656
 
@@ -1659,9 +1659,9 @@ export declare namespace dia {
1659
1659
  getTargetParentView(evt: dia.Event): CellView | null;
1660
1660
 
1661
1661
  findPortNode(portId: string | number): SVGElement | null;
1662
- findPortNode(portId: string | number, selector: string): E | null;
1662
+ findPortNode(portId: string | number, selector: string): DOMElement | null;
1663
1663
 
1664
- findPortNodes(portId: string | number, groupSelector: string): E[];
1664
+ findPortNodes(portId: string | number, groupSelector: string): DOMElement[];
1665
1665
 
1666
1666
  protected renderMarkup(): void;
1667
1667
 
@@ -1810,9 +1810,9 @@ export declare namespace dia {
1810
1810
  getEndMagnet(endType: dia.LinkEnd): SVGElement | null;
1811
1811
 
1812
1812
  findLabelNode(labelIndex: string | number): SVGElement | null;
1813
- findLabelNode(labelIndex: string | number, selector: string): Element | null;
1813
+ findLabelNode(labelIndex: string | number, selector: string): DOMElement | null;
1814
1814
 
1815
- findLabelNodes(labelIndex: string | number, groupSelector: string): Element[];
1815
+ findLabelNodes(labelIndex: string | number, groupSelector: string): DOMElement[];
1816
1816
 
1817
1817
  removeRedundantLinearVertices(opt?: dia.ModelSetOptions): number;
1818
1818
 
@@ -2757,6 +2757,8 @@ export declare namespace dia {
2757
2757
  }
2758
2758
  }
2759
2759
 
2760
+ declare type DOMElement = Element;
2761
+
2760
2762
  export declare namespace elementTools {
2761
2763
 
2762
2764
  export namespace Button {
@@ -4234,7 +4236,7 @@ export declare namespace mvc {
4234
4236
  export type Dom = unknown;
4235
4237
  // The following types represent the DOM elements that can be passed to the
4236
4238
  // $() function.
4237
- export type $Element<T extends Element = Element> = string | T | T[] | Dom;
4239
+ export type $Element<T extends DOMElement = DOMElement> = string | T | T[] | Dom;
4238
4240
  export type $HTMLElement = $Element<HTMLElement>;
4239
4241
  export type $SVGElement = $Element<SVGElement>;
4240
4242
 
@@ -4242,7 +4244,7 @@ export declare namespace mvc {
4242
4244
  duration?: number;
4243
4245
  delay?: number;
4244
4246
  easing?: string;
4245
- complete?: (this: Element) => void;
4247
+ complete?: (this: DOMElement) => void;
4246
4248
  }
4247
4249
 
4248
4250
  export interface Event {
@@ -4265,7 +4267,7 @@ export declare namespace mvc {
4265
4267
  screenX: number | undefined;
4266
4268
  screenY: number | undefined;
4267
4269
  /** @deprecated */
4268
- toElement: Element | undefined;
4270
+ toElement: DOMElement | undefined;
4269
4271
  // PointerEvent
4270
4272
  pointerId: number | undefined;
4271
4273
  pointerType: string | undefined;
@@ -4630,7 +4632,7 @@ export declare namespace mvc {
4630
4632
 
4631
4633
  }
4632
4634
 
4633
- export interface ViewBaseOptions<TModel extends (Model | undefined) = Model, TElement extends Element = HTMLElement> {
4635
+ export interface ViewBaseOptions<TModel extends (Model | undefined) = Model, TElement extends DOMElement = HTMLElement> {
4634
4636
  model?: TModel | undefined;
4635
4637
  // TODO: quickfix, this can't be fixed easy. The collection does not need to have the same model as the parent view.
4636
4638
  collection?: Collection<any> | undefined; // was: Collection<TModel>;
@@ -4644,7 +4646,7 @@ export declare namespace mvc {
4644
4646
 
4645
4647
  export type ViewBaseEventListener = (event: mvc.Event) => void;
4646
4648
 
4647
- export class ViewBase<TModel extends (Model | undefined) = Model, TElement extends Element = HTMLElement> extends EventsMixin implements Events {
4649
+ export class ViewBase<TModel extends (Model | undefined) = Model, TElement extends DOMElement = HTMLElement> extends EventsMixin implements Events {
4648
4650
  /**
4649
4651
  * Do not use, prefer TypeScript's extend functionality.
4650
4652
  */
@@ -4696,7 +4698,7 @@ export declare namespace mvc {
4696
4698
  protected _setAttributes(attributes: Record<string, any>): void;
4697
4699
  }
4698
4700
 
4699
- export interface ViewOptions<T extends (mvc.Model | undefined), E extends Element = HTMLElement> extends mvc.ViewBaseOptions<T, E> {
4701
+ export interface ViewOptions<T extends (mvc.Model | undefined), E extends DOMElement = HTMLElement> extends mvc.ViewBaseOptions<T, E> {
4700
4702
  theme?: string;
4701
4703
  [key: string]: any;
4702
4704
  }
@@ -4705,7 +4707,7 @@ export declare namespace mvc {
4705
4707
  [key: string]: any;
4706
4708
  }
4707
4709
 
4708
- export class View<T extends (mvc.Model | undefined), E extends Element = HTMLElement> extends mvc.ViewBase<T, E> {
4710
+ export class View<T extends (mvc.Model | undefined), E extends DOMElement = HTMLElement> extends mvc.ViewBase<T, E> {
4709
4711
 
4710
4712
  constructor(opt?: ViewOptions<T, E>);
4711
4713
 
@@ -4733,7 +4735,7 @@ export declare namespace mvc {
4733
4735
 
4734
4736
  children?: dia.MarkupJSON;
4735
4737
 
4736
- childNodes?: { [key: string]: Element } | null;
4738
+ childNodes?: { [key: string]: DOMElement } | null;
4737
4739
 
4738
4740
  style?: { [key: string]: any };
4739
4741
 
@@ -4745,9 +4747,9 @@ export declare namespace mvc {
4745
4747
 
4746
4748
  undelegateDocumentEvents(): this;
4747
4749
 
4748
- delegateElementEvents(element: Element, events?: mvc.EventsHash, data?: viewEventData): this;
4750
+ delegateElementEvents(element: DOMElement, events?: mvc.EventsHash, data?: viewEventData): this;
4749
4751
 
4750
- undelegateElementEvents(element: Element): this;
4752
+ undelegateElementEvents(element: DOMElement): this;
4751
4753
 
4752
4754
  eventData(evt: dia.Event): viewEventData;
4753
4755
  eventData(evt: dia.Event, data: viewEventData): this;
@@ -4757,7 +4759,7 @@ export declare namespace mvc {
4757
4759
 
4758
4760
  renderChildren(children?: dia.MarkupJSON): this;
4759
4761
 
4760
- findAttribute(attributeName: string, node: Element): string | null;
4762
+ findAttribute(attributeName: string, node: DOMElement): string | null;
4761
4763
 
4762
4764
  confirmUpdate(flag: number, opt: { [key: string]: any }): number;
4763
4765
 
@@ -4765,7 +4767,7 @@ export declare namespace mvc {
4765
4767
 
4766
4768
  isMounted(): boolean;
4767
4769
 
4768
- protected findAttributeNode(attributeName: string, node: Element): Element | null;
4770
+ protected findAttributeNode(attributeName: string, node: DOMElement): DOMElement | null;
4769
4771
 
4770
4772
  protected init(): void;
4771
4773
 
@@ -5181,6 +5183,8 @@ export declare namespace shapes {
5181
5183
 
5182
5184
  export declare namespace util {
5183
5185
 
5186
+ export function cloneCells(cells: dia.Cell[]): { [id: string]: dia.Cell };
5187
+
5184
5188
  export function isCalcExpression(value: any): boolean;
5185
5189
 
5186
5190
  export function evalCalcFormula(formula: string, rect: g.PlainRect): number;
@@ -5242,27 +5246,27 @@ export declare namespace util {
5242
5246
 
5243
5247
  export function imageToDataUri(url: string, callback: (err: Error | null, dataUri: string) => void): void;
5244
5248
 
5245
- export function getElementBBox(el: Element): dia.BBox;
5249
+ export function getElementBBox(el: DOMElement): dia.BBox;
5246
5250
 
5247
5251
  export function sortElements(
5248
5252
  elements: mvc.$Element,
5249
- comparator: (a: Element, b: Element) => number
5250
- ): Element[];
5253
+ comparator: (a: DOMElement, b: DOMElement) => number
5254
+ ): DOMElement[];
5251
5255
 
5252
- export function setAttributesBySelector(el: Element, attrs: { [selector: string]: { [attribute: string]: any }}): void;
5256
+ export function setAttributesBySelector(el: DOMElement, attrs: { [selector: string]: { [attribute: string]: any }}): void;
5253
5257
 
5254
5258
  export function normalizeSides(sides: dia.Sides): dia.PaddingJSON;
5255
5259
 
5256
5260
  export function template(html: string): (data: any) => string;
5257
5261
 
5258
- export function toggleFullScreen(el?: Element): void;
5262
+ export function toggleFullScreen(el?: DOMElement): void;
5259
5263
 
5260
5264
  export function objectDifference(object: object, base: object, opt?: { maxDepth?: number }): object;
5261
5265
 
5262
5266
  export interface DOMJSONDocument {
5263
5267
  fragment: DocumentFragment;
5264
- selectors: { [key: string]: Element };
5265
- groupSelectors: { [key: string]: Element[] };
5268
+ selectors: { [key: string]: DOMElement };
5269
+ groupSelectors: { [key: string]: DOMElement[] };
5266
5270
  }
5267
5271
 
5268
5272
  export function parseDOMJSON(json: dia.MarkupJSON): DOMJSONDocument;
package/dist/joint.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.1.0-beta.1 (2024-10-30) - JavaScript diagramming library
1
+ /*! JointJS v4.1.1 (2024-12-02) - JavaScript diagramming library
2
2
 
3
3
 
4
4
  This Source Code Form is subject to the terms of the Mozilla Public
@@ -34469,15 +34469,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
34469
34469
  const tool = tools[i];
34470
34470
  tool.updateVisibility();
34471
34471
  if (!tool.isVisible()) continue;
34472
- if (!this.isRendered) {
34473
- // There is at least one visible tool
34474
- this.isRendered = Array(n).fill(false);
34475
- }
34476
- if (!this.isRendered[i]) {
34477
- // First update executes render()
34478
- tool.render();
34479
- this.isRendered[i] = true;
34480
- } else if (opt.tool !== tool.cid) {
34472
+ if (this.ensureToolRendered(tools, i) && opt.tool !== tool.cid) {
34481
34473
  tool.update();
34482
34474
  }
34483
34475
  }
@@ -34495,6 +34487,19 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
34495
34487
  }
34496
34488
  return this;
34497
34489
  },
34490
+ ensureToolRendered(tools, i) {
34491
+ if (!this.isRendered) {
34492
+ // There is at least one visible tool
34493
+ this.isRendered = Array(tools.length).fill(false);
34494
+ }
34495
+ if (!this.isRendered[i]) {
34496
+ // First update executes render()
34497
+ tools[i].render();
34498
+ this.isRendered[i] = true;
34499
+ return false;
34500
+ }
34501
+ return true;
34502
+ },
34498
34503
  focusTool: function (focusedTool) {
34499
34504
  var tools = this.tools;
34500
34505
  if (!tools) return this;
@@ -34517,7 +34522,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
34517
34522
  tool.show();
34518
34523
  // Check if the tool is conditionally visible too
34519
34524
  if (tool.isVisible()) {
34520
- tool.update();
34525
+ this.ensureToolRendered(tools, i) && tool.update();
34521
34526
  }
34522
34527
  }
34523
34528
  }
@@ -34527,7 +34532,12 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
34527
34532
  return this.focusTool(null);
34528
34533
  },
34529
34534
  show: function () {
34530
- return this.blurTool(null);
34535
+ this.blurTool(null);
34536
+ // If this the first time the tools are shown, make sure they are mounted
34537
+ if (!this.isMounted()) {
34538
+ this.mount();
34539
+ }
34540
+ return this;
34531
34541
  },
34532
34542
  onRemove: function () {
34533
34543
  var tools = this.tools;
@@ -36486,7 +36496,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
36486
36496
  Control: Control
36487
36497
  });
36488
36498
 
36489
- var version = "4.1.0-beta.1";
36499
+ var version = "4.1.1";
36490
36500
 
36491
36501
  const Vectorizer = V;
36492
36502
  const layout = {