@joint/core 4.1.0 → 4.1.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.
- package/dist/geometry.js +1 -1
- package/dist/geometry.min.js +1 -1
- package/dist/joint.d.ts +32 -30
- package/dist/joint.js +76 -46
- package/dist/joint.min.js +2 -2
- package/dist/joint.nowrap.js +76 -46
- package/dist/joint.nowrap.min.js +2 -2
- package/dist/vectorizer.js +2 -2
- package/dist/vectorizer.min.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +1 -1
- package/src/V/index.mjs +1 -1
- package/src/dia/ElementView.mjs +1 -1
- package/src/dia/HighlighterView.mjs +5 -5
- package/src/dia/ToolsView.mjs +22 -11
- package/src/mvc/Collection.mjs +6 -2
- package/src/mvc/Dom/Dom.mjs +2 -2
- package/src/mvc/Dom/methods.mjs +9 -7
- package/src/mvc/Listener.mjs +1 -2
- package/src/mvc/Model.mjs +6 -2
- package/src/mvc/ViewBase.mjs +6 -2
- package/src/util/util.mjs +5 -4
- package/src/util/utilHelpers.mjs +5 -5
- package/types/joint.d.ts +32 -29
package/dist/vectorizer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! JointJS v4.1.
|
|
1
|
+
/*! JointJS v4.1.2 (2025-01-16) - JavaScript diagramming library
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
This Source Code Form is subject to the terms of the Mozilla Public
|
|
@@ -5721,8 +5721,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
5721
5721
|
case 'bottom':
|
|
5722
5722
|
dy = -(0.25 * llMaxFont) - rLineHeights;
|
|
5723
5723
|
break;
|
|
5724
|
-
default:
|
|
5725
5724
|
case 'top':
|
|
5725
|
+
default:
|
|
5726
5726
|
dy = 0.8 * flMaxFont;
|
|
5727
5727
|
break;
|
|
5728
5728
|
}
|
package/dist/vectorizer.min.js
CHANGED
package/dist/version.mjs
CHANGED
package/package.json
CHANGED
package/src/V/index.mjs
CHANGED
package/src/dia/ElementView.mjs
CHANGED
|
@@ -42,13 +42,13 @@ export const HighlighterView = mvc.View.extend({
|
|
|
42
42
|
// The cellView is now rendered/updated since it has a higher update priority.
|
|
43
43
|
this.updateRequested = false;
|
|
44
44
|
const { cellView, nodeSelector } = this;
|
|
45
|
-
if (
|
|
45
|
+
if (cellView.isMounted()) {
|
|
46
|
+
this.update(cellView, nodeSelector);
|
|
47
|
+
this.mount();
|
|
48
|
+
this.transform();
|
|
49
|
+
} else {
|
|
46
50
|
this.postponedUpdate = true;
|
|
47
|
-
return 0;
|
|
48
51
|
}
|
|
49
|
-
this.update(cellView, nodeSelector);
|
|
50
|
-
this.mount();
|
|
51
|
-
this.transform();
|
|
52
52
|
return 0;
|
|
53
53
|
},
|
|
54
54
|
|
package/src/dia/ToolsView.mjs
CHANGED
|
@@ -52,15 +52,7 @@ export const ToolsView = mvc.View.extend({
|
|
|
52
52
|
const tool = tools[i];
|
|
53
53
|
tool.updateVisibility();
|
|
54
54
|
if (!tool.isVisible()) continue;
|
|
55
|
-
if (
|
|
56
|
-
// There is at least one visible tool
|
|
57
|
-
this.isRendered = Array(n).fill(false);
|
|
58
|
-
}
|
|
59
|
-
if (!this.isRendered[i]) {
|
|
60
|
-
// First update executes render()
|
|
61
|
-
tool.render();
|
|
62
|
-
this.isRendered[i] = true;
|
|
63
|
-
} else if (opt.tool !== tool.cid) {
|
|
55
|
+
if (this.ensureToolRendered(tools, i) && opt.tool !== tool.cid) {
|
|
64
56
|
tool.update();
|
|
65
57
|
}
|
|
66
58
|
}
|
|
@@ -79,6 +71,20 @@ export const ToolsView = mvc.View.extend({
|
|
|
79
71
|
return this;
|
|
80
72
|
},
|
|
81
73
|
|
|
74
|
+
ensureToolRendered(tools, i) {
|
|
75
|
+
if (!this.isRendered) {
|
|
76
|
+
// There is at least one visible tool
|
|
77
|
+
this.isRendered = Array(tools.length).fill(false);
|
|
78
|
+
}
|
|
79
|
+
if (!this.isRendered[i]) {
|
|
80
|
+
// First update executes render()
|
|
81
|
+
tools[i].render();
|
|
82
|
+
this.isRendered[i] = true;
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
},
|
|
87
|
+
|
|
82
88
|
focusTool: function(focusedTool) {
|
|
83
89
|
|
|
84
90
|
var tools = this.tools;
|
|
@@ -103,7 +109,7 @@ export const ToolsView = mvc.View.extend({
|
|
|
103
109
|
tool.show();
|
|
104
110
|
// Check if the tool is conditionally visible too
|
|
105
111
|
if (tool.isVisible()) {
|
|
106
|
-
tool.update();
|
|
112
|
+
this.ensureToolRendered(tools, i) && tool.update();
|
|
107
113
|
}
|
|
108
114
|
}
|
|
109
115
|
}
|
|
@@ -115,7 +121,12 @@ export const ToolsView = mvc.View.extend({
|
|
|
115
121
|
},
|
|
116
122
|
|
|
117
123
|
show: function() {
|
|
118
|
-
|
|
124
|
+
this.blurTool(null);
|
|
125
|
+
// If this the first time the tools are shown, make sure they are mounted
|
|
126
|
+
if (!this.isMounted()) {
|
|
127
|
+
this.mount();
|
|
128
|
+
}
|
|
129
|
+
return this;
|
|
119
130
|
},
|
|
120
131
|
|
|
121
132
|
onRemove: function() {
|
package/src/mvc/Collection.mjs
CHANGED
|
@@ -59,11 +59,15 @@ assign(Collection.prototype, Events, {
|
|
|
59
59
|
|
|
60
60
|
// preinitialize is an empty function by default. You can override it with a function
|
|
61
61
|
// or object. preinitialize will run before any instantiation logic is run in the Collection.
|
|
62
|
-
preinitialize: function(){
|
|
62
|
+
preinitialize: function(){
|
|
63
|
+
// No implementation.
|
|
64
|
+
},
|
|
63
65
|
|
|
64
66
|
// Initialize is an empty function by default. Override it with your own
|
|
65
67
|
// initialization logic.
|
|
66
|
-
initialize: function(){
|
|
68
|
+
initialize: function(){
|
|
69
|
+
// No implementation.
|
|
70
|
+
},
|
|
67
71
|
|
|
68
72
|
// The JSON representation of a Collection is an array of the
|
|
69
73
|
// models' attributes.
|
package/src/mvc/Dom/Dom.mjs
CHANGED
|
@@ -109,8 +109,8 @@ $.fn.find = function(selector) {
|
|
|
109
109
|
return ret;
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
-
$.fn.add = function(selector
|
|
113
|
-
const newElements = $(selector
|
|
112
|
+
$.fn.add = function(selector) {
|
|
113
|
+
const newElements = $(selector).toArray();
|
|
114
114
|
const prevElements = this.toArray();
|
|
115
115
|
const ret = this.pushStack([]);
|
|
116
116
|
$.merge(ret, uniq(prevElements.concat(newElements)));
|
package/src/mvc/Dom/methods.mjs
CHANGED
|
@@ -65,7 +65,7 @@ export function html(html) {
|
|
|
65
65
|
if (!el) return null;
|
|
66
66
|
if (arguments.length === 0) return el.innerHTML;
|
|
67
67
|
if (html === undefined) return this; // do nothing
|
|
68
|
-
cleanNodesData(
|
|
68
|
+
cleanNodesData(el.getElementsByTagName('*'));
|
|
69
69
|
if (typeof html === 'string' || typeof html === 'number') {
|
|
70
70
|
el.innerHTML = html;
|
|
71
71
|
} else {
|
|
@@ -336,17 +336,19 @@ export function position() {
|
|
|
336
336
|
// when a statically positioned element is identified
|
|
337
337
|
doc = el.ownerDocument;
|
|
338
338
|
offsetParent = el.offsetParent || doc.documentElement;
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
339
|
+
const isStaticallyPositioned = (el) => {
|
|
340
|
+
const { position } = el.style;
|
|
341
|
+
return !position || position === 'static';
|
|
342
|
+
};
|
|
343
|
+
while (offsetParent && offsetParent !== doc.documentElement && isStaticallyPositioned(offsetParent)) {
|
|
344
|
+
offsetParent = offsetParent.offsetParent || doc.documentElement;
|
|
343
345
|
}
|
|
344
|
-
if (offsetParent && offsetParent !== el && offsetParent.nodeType === 1) {
|
|
346
|
+
if (offsetParent && offsetParent !== el && offsetParent.nodeType === 1 && !isStaticallyPositioned(offsetParent)) {
|
|
345
347
|
// Incorporate borders into its offset, since they are outside its content origin
|
|
346
348
|
const offsetParentStyles = window.getComputedStyle(offsetParent);
|
|
347
349
|
const borderTopWidth = parseFloat(offsetParentStyles.borderTopWidth) || 0;
|
|
348
350
|
const borderLeftWidth = parseFloat(offsetParentStyles.borderLeftWidth) || 0;
|
|
349
|
-
parentOffset = $
|
|
351
|
+
parentOffset = $(offsetParent).offset();
|
|
350
352
|
parentOffset.top += borderTopWidth;
|
|
351
353
|
parentOffset.left += borderLeftWidth;
|
|
352
354
|
}
|
package/src/mvc/Listener.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import V from '../V/index.mjs';
|
|
2
1
|
import { Events } from './Events.mjs';
|
|
3
2
|
|
|
4
3
|
export class Listener {
|
|
@@ -9,7 +8,7 @@ export class Listener {
|
|
|
9
8
|
listenTo(object, evt, ...args) {
|
|
10
9
|
const { callbackArguments } = this;
|
|
11
10
|
// signature 1 - (object, eventHashMap, context)
|
|
12
|
-
if (
|
|
11
|
+
if (evt && typeof evt === 'object') {
|
|
13
12
|
const [context = null] = args;
|
|
14
13
|
Object.entries(evt).forEach(([eventName, cb]) => {
|
|
15
14
|
if (typeof cb !== 'function') return;
|
package/src/mvc/Model.mjs
CHANGED
|
@@ -59,11 +59,15 @@ assign(Model.prototype, Events, {
|
|
|
59
59
|
|
|
60
60
|
// preinitialize is an empty function by default. You can override it with a function
|
|
61
61
|
// or object. preinitialize will run before any instantiation logic is run in the Model.
|
|
62
|
-
preinitialize: function(){
|
|
62
|
+
preinitialize: function(){
|
|
63
|
+
// No implementation.
|
|
64
|
+
},
|
|
63
65
|
|
|
64
66
|
// Initialize is an empty function by default. Override it with your own
|
|
65
67
|
// initialization logic.
|
|
66
|
-
initialize: function(){
|
|
68
|
+
initialize: function(){
|
|
69
|
+
// No implementation.
|
|
70
|
+
},
|
|
67
71
|
|
|
68
72
|
// Return a copy of the model's `attributes` object.
|
|
69
73
|
toJSON: function(options) {
|
package/src/mvc/ViewBase.mjs
CHANGED
|
@@ -52,11 +52,15 @@ assign(ViewBase.prototype, Events, {
|
|
|
52
52
|
|
|
53
53
|
// preinitialize is an empty function by default. You can override it with a function
|
|
54
54
|
// or object. preinitialize will run before any instantiation logic is run in the View
|
|
55
|
-
preinitialize: function(){
|
|
55
|
+
preinitialize: function(){
|
|
56
|
+
// No implementation.
|
|
57
|
+
},
|
|
56
58
|
|
|
57
59
|
// Initialize is an empty function by default. Override it with your own
|
|
58
60
|
// initialization logic.
|
|
59
|
-
initialize: function(){
|
|
61
|
+
initialize: function(){
|
|
62
|
+
// No implementation.
|
|
63
|
+
},
|
|
60
64
|
|
|
61
65
|
// **render** is the core function that your view should override, in order
|
|
62
66
|
// to populate its element (`this.el`), with the appropriate HTML. The
|
package/src/util/util.mjs
CHANGED
|
@@ -79,10 +79,10 @@ export const parseDOMJSON = function(json, namespace) {
|
|
|
79
79
|
const groupSelectors = {};
|
|
80
80
|
const svgNamespace = V.namespace.svg;
|
|
81
81
|
|
|
82
|
-
const
|
|
82
|
+
const initialNS = namespace || svgNamespace;
|
|
83
83
|
const fragment = document.createDocumentFragment();
|
|
84
84
|
|
|
85
|
-
const parseNode = function(siblingsDef, parentNode,
|
|
85
|
+
const parseNode = function(siblingsDef, parentNode, parentNS) {
|
|
86
86
|
for (let i = 0; i < siblingsDef.length; i++) {
|
|
87
87
|
const nodeDef = siblingsDef[i];
|
|
88
88
|
|
|
@@ -100,7 +100,7 @@ export const parseDOMJSON = function(json, namespace) {
|
|
|
100
100
|
let node;
|
|
101
101
|
|
|
102
102
|
// Namespace URI
|
|
103
|
-
|
|
103
|
+
const ns = (nodeDef.hasOwnProperty('namespaceURI')) ? nodeDef.namespaceURI : parentNS;
|
|
104
104
|
node = document.createElementNS(ns, tagName);
|
|
105
105
|
const svg = (ns === svgNamespace);
|
|
106
106
|
|
|
@@ -152,7 +152,7 @@ export const parseDOMJSON = function(json, namespace) {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
};
|
|
155
|
-
parseNode(json, fragment,
|
|
155
|
+
parseNode(json, fragment, initialNS);
|
|
156
156
|
return {
|
|
157
157
|
fragment: fragment,
|
|
158
158
|
selectors: selectors,
|
|
@@ -1790,4 +1790,5 @@ export {
|
|
|
1790
1790
|
};
|
|
1791
1791
|
|
|
1792
1792
|
export const noop = function() {
|
|
1793
|
+
// Do nothing.
|
|
1793
1794
|
};
|
package/src/util/utilHelpers.mjs
CHANGED
|
@@ -389,7 +389,7 @@ const initCloneByTag = (object, tag, isDeep) => {
|
|
|
389
389
|
const Constructor = object.constructor;
|
|
390
390
|
switch(tag) {
|
|
391
391
|
case arrayBufferTag:
|
|
392
|
-
return cloneArrayBuffer(object
|
|
392
|
+
return cloneArrayBuffer(object);
|
|
393
393
|
case boolTag:
|
|
394
394
|
case dateTag:
|
|
395
395
|
return new Constructor(+object);
|
|
@@ -1168,7 +1168,7 @@ const baseMerge = (object, source, srcIndex, customizer, stack) => {
|
|
|
1168
1168
|
|
|
1169
1169
|
assignMergeValue(object, key, newValue);
|
|
1170
1170
|
}
|
|
1171
|
-
}
|
|
1171
|
+
});
|
|
1172
1172
|
};
|
|
1173
1173
|
|
|
1174
1174
|
const baseMergeDeep = (object, source, key, srcIndex, mergeFunc, customizer, stack) => {
|
|
@@ -1281,7 +1281,7 @@ function last(array) {
|
|
|
1281
1281
|
|
|
1282
1282
|
const createSet = (Set && (1 / setToArray(new Set([undefined,-0]))[1]) == 1 / 0)
|
|
1283
1283
|
? (values) => new Set(values)
|
|
1284
|
-
: () => {};
|
|
1284
|
+
: () => { /* no-op */ };
|
|
1285
1285
|
|
|
1286
1286
|
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
|
|
1287
1287
|
if (isObject(objValue) && isObject(srcValue)) {
|
|
@@ -2236,8 +2236,8 @@ export function debounce(func, wait, opt) {
|
|
|
2236
2236
|
export const groupBy = (collection, iteratee) => {
|
|
2237
2237
|
iteratee = getIteratee(iteratee, 2);
|
|
2238
2238
|
|
|
2239
|
-
return reduce(collection, (result, value
|
|
2240
|
-
key = iteratee(value);
|
|
2239
|
+
return reduce(collection, (result, value) => {
|
|
2240
|
+
const key = iteratee(value);
|
|
2241
2241
|
if (hasOwnProperty.call(result, key)) {
|
|
2242
2242
|
result[key].push(value);
|
|
2243
2243
|
} else {
|
package/types/joint.d.ts
CHANGED
|
@@ -22,6 +22,9 @@ type _DeepPartial<T> = {
|
|
|
22
22
|
|
|
23
23
|
type DeepPartial<T> = _DeepPartial<_DeepRequired<T>>;
|
|
24
24
|
|
|
25
|
+
// We use `DOMElement` later in the code, to avoid conflicts with the `dia.Element` type.
|
|
26
|
+
type DOMElement = Element;
|
|
27
|
+
|
|
25
28
|
export namespace dia {
|
|
26
29
|
|
|
27
30
|
type Event = mvc.TriggeredEvent;
|
|
@@ -395,7 +398,7 @@ export namespace dia {
|
|
|
395
398
|
|
|
396
399
|
type UnsetCallback<V> = (
|
|
397
400
|
this: V,
|
|
398
|
-
node:
|
|
401
|
+
node: DOMElement,
|
|
399
402
|
nodeAttributes: { [name: string]: any },
|
|
400
403
|
cellView: V
|
|
401
404
|
) => string | Array<string> | null | void;
|
|
@@ -404,7 +407,7 @@ export namespace dia {
|
|
|
404
407
|
this: V,
|
|
405
408
|
attributeValue: any,
|
|
406
409
|
refBBox: g.Rect,
|
|
407
|
-
node:
|
|
410
|
+
node: DOMElement,
|
|
408
411
|
nodeAttributes: { [name: string]: any },
|
|
409
412
|
cellView: V
|
|
410
413
|
) => { [key: string]: any } | string | number | void;
|
|
@@ -413,7 +416,7 @@ export namespace dia {
|
|
|
413
416
|
this: V,
|
|
414
417
|
attributeValue: any,
|
|
415
418
|
refBBox: g.Rect,
|
|
416
|
-
node:
|
|
419
|
+
node: DOMElement,
|
|
417
420
|
nodeAttributes: { [name: string]: any },
|
|
418
421
|
cellView: V
|
|
419
422
|
) => dia.Point | null | void;
|
|
@@ -422,7 +425,7 @@ export namespace dia {
|
|
|
422
425
|
this: V,
|
|
423
426
|
attributeValue: any,
|
|
424
427
|
nodeBBox: g.Rect,
|
|
425
|
-
node:
|
|
428
|
+
node: DOMElement,
|
|
426
429
|
nodeAttributes: { [name: string]: any },
|
|
427
430
|
cellView: V
|
|
428
431
|
) => dia.Point | null | void;
|
|
@@ -923,7 +926,7 @@ export namespace dia {
|
|
|
923
926
|
|
|
924
927
|
isNodeConnection(node: SVGElement): boolean;
|
|
925
928
|
|
|
926
|
-
getEventTarget(evt: dia.Event, opt?: { fromPoint?: boolean }):
|
|
929
|
+
getEventTarget(evt: dia.Event, opt?: { fromPoint?: boolean }): DOMElement;
|
|
927
930
|
|
|
928
931
|
checkMouseleave(evt: dia.Event): void;
|
|
929
932
|
|
|
@@ -1044,7 +1047,7 @@ export namespace dia {
|
|
|
1044
1047
|
|
|
1045
1048
|
class ElementView<E extends Element = Element> extends CellViewGeneric<E> {
|
|
1046
1049
|
|
|
1047
|
-
update(element?:
|
|
1050
|
+
update(element?: DOMElement, renderingOnlyAttrs?: { [key: string]: any }): void;
|
|
1048
1051
|
|
|
1049
1052
|
setInteractivity(value: boolean | ElementView.InteractivityOptions): void;
|
|
1050
1053
|
|
|
@@ -1053,9 +1056,9 @@ export namespace dia {
|
|
|
1053
1056
|
getTargetParentView(evt: dia.Event): CellView | null;
|
|
1054
1057
|
|
|
1055
1058
|
findPortNode(portId: string | number): SVGElement | null;
|
|
1056
|
-
findPortNode(portId: string | number, selector: string):
|
|
1059
|
+
findPortNode(portId: string | number, selector: string): DOMElement | null;
|
|
1057
1060
|
|
|
1058
|
-
findPortNodes(portId: string | number, groupSelector: string):
|
|
1061
|
+
findPortNodes(portId: string | number, groupSelector: string): DOMElement[];
|
|
1059
1062
|
|
|
1060
1063
|
protected renderMarkup(): void;
|
|
1061
1064
|
|
|
@@ -1204,9 +1207,9 @@ export namespace dia {
|
|
|
1204
1207
|
getEndMagnet(endType: dia.LinkEnd): SVGElement | null;
|
|
1205
1208
|
|
|
1206
1209
|
findLabelNode(labelIndex: string | number): SVGElement | null;
|
|
1207
|
-
findLabelNode(labelIndex: string | number, selector: string):
|
|
1210
|
+
findLabelNode(labelIndex: string | number, selector: string): DOMElement | null;
|
|
1208
1211
|
|
|
1209
|
-
findLabelNodes(labelIndex: string | number, groupSelector: string):
|
|
1212
|
+
findLabelNodes(labelIndex: string | number, groupSelector: string): DOMElement[];
|
|
1210
1213
|
|
|
1211
1214
|
removeRedundantLinearVertices(opt?: dia.ModelSetOptions): number;
|
|
1212
1215
|
|
|
@@ -2647,27 +2650,27 @@ export namespace util {
|
|
|
2647
2650
|
|
|
2648
2651
|
export function imageToDataUri(url: string, callback: (err: Error | null, dataUri: string) => void): void;
|
|
2649
2652
|
|
|
2650
|
-
export function getElementBBox(el:
|
|
2653
|
+
export function getElementBBox(el: DOMElement): dia.BBox;
|
|
2651
2654
|
|
|
2652
2655
|
export function sortElements(
|
|
2653
2656
|
elements: mvc.$Element,
|
|
2654
|
-
comparator: (a:
|
|
2655
|
-
):
|
|
2657
|
+
comparator: (a: DOMElement, b: DOMElement) => number
|
|
2658
|
+
): DOMElement[];
|
|
2656
2659
|
|
|
2657
|
-
export function setAttributesBySelector(el:
|
|
2660
|
+
export function setAttributesBySelector(el: DOMElement, attrs: { [selector: string]: { [attribute: string]: any }}): void;
|
|
2658
2661
|
|
|
2659
2662
|
export function normalizeSides(sides: dia.Sides): dia.PaddingJSON;
|
|
2660
2663
|
|
|
2661
2664
|
export function template(html: string): (data: any) => string;
|
|
2662
2665
|
|
|
2663
|
-
export function toggleFullScreen(el?:
|
|
2666
|
+
export function toggleFullScreen(el?: DOMElement): void;
|
|
2664
2667
|
|
|
2665
2668
|
export function objectDifference(object: object, base: object, opt?: { maxDepth?: number }): object;
|
|
2666
2669
|
|
|
2667
2670
|
interface DOMJSONDocument {
|
|
2668
2671
|
fragment: DocumentFragment;
|
|
2669
|
-
selectors: { [key: string]:
|
|
2670
|
-
groupSelectors: { [key: string]:
|
|
2672
|
+
selectors: { [key: string]: DOMElement };
|
|
2673
|
+
groupSelectors: { [key: string]: DOMElement[] };
|
|
2671
2674
|
}
|
|
2672
2675
|
|
|
2673
2676
|
export function parseDOMJSON(json: dia.MarkupJSON): DOMJSONDocument;
|
|
@@ -2998,7 +3001,7 @@ export namespace mvc {
|
|
|
2998
3001
|
type Dom = unknown;
|
|
2999
3002
|
// The following types represent the DOM elements that can be passed to the
|
|
3000
3003
|
// $() function.
|
|
3001
|
-
type $Element<T extends
|
|
3004
|
+
type $Element<T extends DOMElement = DOMElement> = string | T | T[] | Dom;
|
|
3002
3005
|
type $HTMLElement = $Element<HTMLElement>;
|
|
3003
3006
|
type $SVGElement = $Element<SVGElement>;
|
|
3004
3007
|
|
|
@@ -3006,7 +3009,7 @@ export namespace mvc {
|
|
|
3006
3009
|
duration?: number;
|
|
3007
3010
|
delay?: number;
|
|
3008
3011
|
easing?: string;
|
|
3009
|
-
complete?: (this:
|
|
3012
|
+
complete?: (this: DOMElement) => void;
|
|
3010
3013
|
}
|
|
3011
3014
|
|
|
3012
3015
|
interface Event {
|
|
@@ -3029,7 +3032,7 @@ export namespace mvc {
|
|
|
3029
3032
|
screenX: number | undefined;
|
|
3030
3033
|
screenY: number | undefined;
|
|
3031
3034
|
/** @deprecated */
|
|
3032
|
-
toElement:
|
|
3035
|
+
toElement: DOMElement | undefined;
|
|
3033
3036
|
// PointerEvent
|
|
3034
3037
|
pointerId: number | undefined;
|
|
3035
3038
|
pointerType: string | undefined;
|
|
@@ -3394,7 +3397,7 @@ export namespace mvc {
|
|
|
3394
3397
|
|
|
3395
3398
|
}
|
|
3396
3399
|
|
|
3397
|
-
interface ViewBaseOptions<TModel extends (Model | undefined) = Model, TElement extends
|
|
3400
|
+
interface ViewBaseOptions<TModel extends (Model | undefined) = Model, TElement extends DOMElement = HTMLElement> {
|
|
3398
3401
|
model?: TModel | undefined;
|
|
3399
3402
|
// TODO: quickfix, this can't be fixed easy. The collection does not need to have the same model as the parent view.
|
|
3400
3403
|
collection?: Collection<any> | undefined; // was: Collection<TModel>;
|
|
@@ -3408,7 +3411,7 @@ export namespace mvc {
|
|
|
3408
3411
|
|
|
3409
3412
|
type ViewBaseEventListener = (event: mvc.Event) => void;
|
|
3410
3413
|
|
|
3411
|
-
class ViewBase<TModel extends (Model | undefined) = Model, TElement extends
|
|
3414
|
+
class ViewBase<TModel extends (Model | undefined) = Model, TElement extends DOMElement = HTMLElement> extends EventsMixin implements Events {
|
|
3412
3415
|
/**
|
|
3413
3416
|
* Do not use, prefer TypeScript's extend functionality.
|
|
3414
3417
|
*/
|
|
@@ -3460,7 +3463,7 @@ export namespace mvc {
|
|
|
3460
3463
|
protected _setAttributes(attributes: Record<string, any>): void;
|
|
3461
3464
|
}
|
|
3462
3465
|
|
|
3463
|
-
interface ViewOptions<T extends (mvc.Model | undefined), E extends
|
|
3466
|
+
interface ViewOptions<T extends (mvc.Model | undefined), E extends DOMElement = HTMLElement> extends mvc.ViewBaseOptions<T, E> {
|
|
3464
3467
|
theme?: string;
|
|
3465
3468
|
[key: string]: any;
|
|
3466
3469
|
}
|
|
@@ -3469,7 +3472,7 @@ export namespace mvc {
|
|
|
3469
3472
|
[key: string]: any;
|
|
3470
3473
|
}
|
|
3471
3474
|
|
|
3472
|
-
class View<T extends (mvc.Model | undefined), E extends
|
|
3475
|
+
class View<T extends (mvc.Model | undefined), E extends DOMElement = HTMLElement> extends mvc.ViewBase<T, E> {
|
|
3473
3476
|
|
|
3474
3477
|
constructor(opt?: ViewOptions<T, E>);
|
|
3475
3478
|
|
|
@@ -3497,7 +3500,7 @@ export namespace mvc {
|
|
|
3497
3500
|
|
|
3498
3501
|
children?: dia.MarkupJSON;
|
|
3499
3502
|
|
|
3500
|
-
childNodes?: { [key: string]:
|
|
3503
|
+
childNodes?: { [key: string]: DOMElement } | null;
|
|
3501
3504
|
|
|
3502
3505
|
style?: { [key: string]: any };
|
|
3503
3506
|
|
|
@@ -3509,9 +3512,9 @@ export namespace mvc {
|
|
|
3509
3512
|
|
|
3510
3513
|
undelegateDocumentEvents(): this;
|
|
3511
3514
|
|
|
3512
|
-
delegateElementEvents(element:
|
|
3515
|
+
delegateElementEvents(element: DOMElement, events?: mvc.EventsHash, data?: viewEventData): this;
|
|
3513
3516
|
|
|
3514
|
-
undelegateElementEvents(element:
|
|
3517
|
+
undelegateElementEvents(element: DOMElement): this;
|
|
3515
3518
|
|
|
3516
3519
|
eventData(evt: dia.Event): viewEventData;
|
|
3517
3520
|
eventData(evt: dia.Event, data: viewEventData): this;
|
|
@@ -3521,7 +3524,7 @@ export namespace mvc {
|
|
|
3521
3524
|
|
|
3522
3525
|
renderChildren(children?: dia.MarkupJSON): this;
|
|
3523
3526
|
|
|
3524
|
-
findAttribute(attributeName: string, node:
|
|
3527
|
+
findAttribute(attributeName: string, node: DOMElement): string | null;
|
|
3525
3528
|
|
|
3526
3529
|
confirmUpdate(flag: number, opt: { [key: string]: any }): number;
|
|
3527
3530
|
|
|
@@ -3529,7 +3532,7 @@ export namespace mvc {
|
|
|
3529
3532
|
|
|
3530
3533
|
isMounted(): boolean;
|
|
3531
3534
|
|
|
3532
|
-
protected findAttributeNode(attributeName: string, node:
|
|
3535
|
+
protected findAttributeNode(attributeName: string, node: DOMElement): DOMElement | null;
|
|
3533
3536
|
|
|
3534
3537
|
protected init(): void;
|
|
3535
3538
|
|