@joint/core 4.2.1 → 4.2.2

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.1 (2025-11-20) - JavaScript diagramming library
1
+ /*! JointJS v4.2.2 (2025-12-16) - 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.1 (2025-11-20) - JavaScript diagramming library
1
+ /*! JointJS v4.2.2 (2025-12-16) - 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.1";
1
+ var version = "4.2.2";
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.1",
4
+ "version": "4.2.2",
5
5
  "description": "JavaScript diagramming library",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/joint.min.js",
package/src/dia/Graph.mjs CHANGED
@@ -29,6 +29,13 @@ export const Graph = Model.extend({
29
29
  */
30
30
  defaultLayerId: DEFAULT_LAYER_ID,
31
31
 
32
+ /**
33
+ * @protected
34
+ * @description If `true`, layer functionality is disabled
35
+ * and all cells are assigned to the default layer.
36
+ */
37
+ ignoreLayers: false,
38
+
32
39
  initialize: function(attrs, options = {}) {
33
40
 
34
41
  const layerCollection = this.layerCollection = new GraphLayerCollection([], {
@@ -52,6 +59,11 @@ export const Graph = Model.extend({
52
59
  // Controller that manages communication between the graph and its layers.
53
60
  this.layersController = new GraphLayersController({ graph: this });
54
61
 
62
+ // Option to ignore layers altogether.
63
+ if (options.ignoreLayers) {
64
+ this.ignoreLayers = true;
65
+ }
66
+
55
67
  // `Graph` keeps an internal data structure (an adjacency list)
56
68
  // for fast graph queries. All changes that affect the structure of the graph
57
69
  // must be reflected in the `al` object. This object provides fast answers to
@@ -156,7 +168,7 @@ export const Graph = Model.extend({
156
168
  // Backward compatibility: prior v4.2, z-index was not set during reset.
157
169
  if (opt && opt.ensureZIndex) {
158
170
  if (cellAttributes.z === undefined) {
159
- const layerId = cellAttributes[config.layerAttribute] || this.defaultLayerId;
171
+ const layerId = this.getCellLayerId(cellInit);
160
172
  const zIndex = this.maxZIndex(layerId) + 1;
161
173
  if (cellInit[CELL_MARKER]) {
162
174
  // Set with event in case there is a listener
@@ -268,6 +280,10 @@ export const Graph = Model.extend({
268
280
  if (!cellInit) {
269
281
  throw new Error('dia.Graph: No cell provided.');
270
282
  }
283
+ if (this.ignoreLayers) {
284
+ // When layers are ignored, all cells belong to the default layer.
285
+ return this.defaultLayerId;
286
+ }
271
287
  const cellAttributes = cellInit[CELL_MARKER]
272
288
  ? cellInit.attributes
273
289
  : cellInit;
package/types/joint.d.ts CHANGED
@@ -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