@jylups/flowable-bpmn-js 0.0.0-stage → 0.1.0-next.0
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/LICENSE +21 -0
- package/README.md +286 -2
- package/assets/flowable-bpmn-js-touch.css +76 -0
- package/assets/flowable-bpmn-js.css +70 -0
- package/dist/assets/bpmn-font/css/bpmn-codes.css +110 -0
- package/dist/assets/bpmn-font/css/bpmn-embedded.css +168 -0
- package/dist/assets/bpmn-font/css/bpmn.css +166 -0
- package/dist/assets/bpmn-font/font/bpmn.eot +0 -0
- package/dist/assets/bpmn-font/font/bpmn.svg +228 -0
- package/dist/assets/bpmn-font/font/bpmn.ttf +0 -0
- package/dist/assets/bpmn-font/font/bpmn.woff +0 -0
- package/dist/assets/bpmn-font/font/bpmn.woff2 +0 -0
- package/dist/assets/bpmn-js-bpmnlint.css +263 -0
- package/dist/assets/bpmn-js.css +151 -0
- package/dist/assets/diagram-js.css +1325 -0
- package/dist/assets/flowable-bpmn-js-touch.css +76 -0
- package/dist/assets/flowable-bpmn-js.css +70 -0
- package/dist/assets/properties-panel.css +1905 -0
- package/dist/flowable-bpmn-modeler.development.js +128087 -0
- package/dist/flowable-bpmn-modeler.development.js.map +1 -0
- package/dist/flowable-bpmn-modeler.production.min.js +348 -0
- package/dist/flowable-bpmn-navigated-viewer.development.js +28092 -0
- package/dist/flowable-bpmn-navigated-viewer.development.js.map +1 -0
- package/dist/flowable-bpmn-navigated-viewer.production.min.js +2 -0
- package/dist/flowable-bpmn-viewer.development.js +26751 -0
- package/dist/flowable-bpmn-viewer.development.js.map +1 -0
- package/dist/flowable-bpmn-viewer.production.min.js +2 -0
- package/index.d.ts +107 -0
- package/index.js +32 -0
- package/lib/Modeler.js +68 -0
- package/lib/NavigatedViewer.js +30 -0
- package/lib/NewDiagram.js +69 -0
- package/lib/Theme.js +32 -0
- package/lib/Viewer.js +32 -0
- package/lib/distro/Modeler.js +5 -0
- package/lib/distro/NavigatedViewer.js +5 -0
- package/lib/distro/Viewer.js +5 -0
- package/lib/draw/TypedTaskRenderer.js +81 -0
- package/lib/draw/index.js +10 -0
- package/lib/features/touch/InputTracker.js +34 -0
- package/lib/features/touch/LICENSE +21 -0
- package/lib/features/touch/TouchContextPad.js +197 -0
- package/lib/features/touch/TouchInteraction.js +1276 -0
- package/lib/features/touch/TouchLabelEditing.js +60 -0
- package/lib/features/touch/index.js +40 -0
- package/lib/features/typed-tasks/ReplaceWithTypedTaskHandler.js +63 -0
- package/lib/features/typed-tasks/TypedTaskPaletteProvider.js +76 -0
- package/lib/features/typed-tasks/TypedTaskReplaceMenuProvider.js +71 -0
- package/lib/features/typed-tasks/TypedTasks.js +127 -0
- package/lib/features/typed-tasks/icons.js +99 -0
- package/lib/features/typed-tasks/index.js +17 -0
- package/lib/lint/FlowableLinting.js +23 -0
- package/lib/lint/index.js +44 -0
- package/lib/lint/module.js +15 -0
- package/lib/lint/rules/called-element.js +19 -0
- package/lib/lint/rules/service-task-implementation.js +81 -0
- package/lib/lint/rules/valid-durations.js +102 -0
- package/lib/lint/values.js +71 -0
- package/lib/xml/FlowableXML.js +50 -0
- package/lib/xml/index.js +6 -0
- package/package.json +80 -4
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creating and connecting from the context pad and the palette by touch.
|
|
3
|
+
* Nothing here changes anything for a mouse.
|
|
4
|
+
*
|
|
5
|
+
* - Dragging from a context pad entry: once the drag starts, the selection is
|
|
6
|
+
* cleared and the context pad closes, which removes the entry under the
|
|
7
|
+
* finger from the page. iOS keeps sending the touch to that removed element,
|
|
8
|
+
* where it no longer reaches the drag's listeners on the document, so the
|
|
9
|
+
* drag never ends. The entry is kept in the page, out of sight, until the
|
|
10
|
+
* finger lifts.
|
|
11
|
+
* - Tapping an entry that creates a shape starts a create that waits for the
|
|
12
|
+
* next touch. A tap on the canvas places the shape there; a touch anywhere
|
|
13
|
+
* else (a toolbar, the palette, the context pad) cancels it, instead of
|
|
14
|
+
* dropping the shape at that point.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Keeps a touched element in the page while its touch lasts.
|
|
20
|
+
*
|
|
21
|
+
* @param {Document} doc
|
|
22
|
+
*/
|
|
23
|
+
function TouchTargetKeeper(doc) {
|
|
24
|
+
this._doc = doc;
|
|
25
|
+
this._target = null;
|
|
26
|
+
this._holder = null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A touch started on this element.
|
|
31
|
+
*
|
|
32
|
+
* @param {Element} target
|
|
33
|
+
*/
|
|
34
|
+
TouchTargetKeeper.prototype.touchStarted = function(target) {
|
|
35
|
+
var self = this;
|
|
36
|
+
|
|
37
|
+
this.release();
|
|
38
|
+
this._target = target;
|
|
39
|
+
|
|
40
|
+
function end() {
|
|
41
|
+
target.removeEventListener('touchend', end);
|
|
42
|
+
target.removeEventListener('touchcancel', end);
|
|
43
|
+
|
|
44
|
+
// after the end has reached the document's listeners
|
|
45
|
+
setTimeout(function() {
|
|
46
|
+
if (self._target === target) {
|
|
47
|
+
self.release();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
target.addEventListener('touchend', end);
|
|
53
|
+
target.addEventListener('touchcancel', end);
|
|
54
|
+
|
|
55
|
+
// a safety net for removals that don't close the context pad
|
|
56
|
+
target.addEventListener('touchmove', function() {
|
|
57
|
+
self.keep();
|
|
58
|
+
}, { passive: true });
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Puts the touched element back in the page if it was removed.
|
|
63
|
+
*/
|
|
64
|
+
TouchTargetKeeper.prototype.keep = function() {
|
|
65
|
+
var target = this._target;
|
|
66
|
+
|
|
67
|
+
if (!target || target.isConnected) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this._getHolder().appendChild(target);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Forgets the touched element, and takes it out of the page if it was kept.
|
|
76
|
+
*/
|
|
77
|
+
TouchTargetKeeper.prototype.release = function() {
|
|
78
|
+
if (this._target && this._target.parentNode === this._holder) {
|
|
79
|
+
this._target.remove();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
this._target = null;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
TouchTargetKeeper.prototype._getHolder = function() {
|
|
86
|
+
if (!this._holder || !this._holder.isConnected) {
|
|
87
|
+
var holder = this._doc.createElement('div');
|
|
88
|
+
|
|
89
|
+
holder.className = 'touch-target-keeper';
|
|
90
|
+
holder.setAttribute('aria-hidden', 'true');
|
|
91
|
+
|
|
92
|
+
Object.assign(holder.style, {
|
|
93
|
+
position: 'fixed',
|
|
94
|
+
left: '0',
|
|
95
|
+
top: '0',
|
|
96
|
+
width: '0',
|
|
97
|
+
height: '0',
|
|
98
|
+
overflow: 'hidden'
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
this._doc.body.appendChild(holder);
|
|
102
|
+
this._holder = holder;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return this._holder;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Whether a touch that starts while a drag waits should cancel the drag: the
|
|
111
|
+
* drag was started by a tap (no touch was down) and the new touch is not on
|
|
112
|
+
* the canvas. Such a drag is already active: create starts it at once.
|
|
113
|
+
*
|
|
114
|
+
* @param {Object|null} context the drag's context, with `isTouch`
|
|
115
|
+
* @param {boolean} startedByTap
|
|
116
|
+
* @param {boolean} onCanvas
|
|
117
|
+
*
|
|
118
|
+
* @return {boolean}
|
|
119
|
+
*/
|
|
120
|
+
function shouldCancelWaitingDrag(context, startedByTap, onCanvas) {
|
|
121
|
+
return !!context && !!context.isTouch && startedByTap && !onCanvas;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @param {EventBus} eventBus
|
|
127
|
+
* @param {Dragging} dragging
|
|
128
|
+
* @param {Canvas} canvas
|
|
129
|
+
*/
|
|
130
|
+
export default function TouchContextPad(eventBus, dragging, canvas) {
|
|
131
|
+
var keeper = new TouchTargetKeeper(document);
|
|
132
|
+
|
|
133
|
+
var svg = null,
|
|
134
|
+
touchesDown = 0,
|
|
135
|
+
startedByTap = false;
|
|
136
|
+
|
|
137
|
+
eventBus.on('canvas.init', 1000, function(event) {
|
|
138
|
+
svg = event.svg;
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// capture listeners on the document, registered before the drag's own, so
|
|
142
|
+
// they run first for the same touch
|
|
143
|
+
function touchStarted(event) {
|
|
144
|
+
touchesDown = event.touches.length;
|
|
145
|
+
|
|
146
|
+
var target = event.target;
|
|
147
|
+
|
|
148
|
+
// only this modeler's context pad and palette: a page may have several
|
|
149
|
+
if (target.closest && target.closest('.djs-context-pad, .djs-palette') && canvas.getContainer().contains(target)) {
|
|
150
|
+
keeper.touchStarted(target);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
var onCanvas = !!svg && svg.contains(target);
|
|
154
|
+
var cancel = shouldCancelWaitingDrag(dragging.context(), startedByTap, onCanvas);
|
|
155
|
+
|
|
156
|
+
// only the first touch after the tap decides: it places or it cancels
|
|
157
|
+
startedByTap = false;
|
|
158
|
+
|
|
159
|
+
if (cancel) {
|
|
160
|
+
dragging.cancel();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function touchEnded(event) {
|
|
165
|
+
touchesDown = event.touches.length;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
document.addEventListener('touchstart', touchStarted, true);
|
|
169
|
+
document.addEventListener('touchend', touchEnded, true);
|
|
170
|
+
document.addEventListener('touchcancel', touchEnded, true);
|
|
171
|
+
|
|
172
|
+
eventBus.on('drag.init', 1000, function(event) {
|
|
173
|
+
|
|
174
|
+
// a drag that starts while no finger is down was started by a tap
|
|
175
|
+
startedByTap = !!event.isTouch && touchesDown === 0;
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
eventBus.on('drag.ended', 1000, function() {
|
|
179
|
+
startedByTap = false;
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
eventBus.on('contextPad.close', 1000, function() {
|
|
183
|
+
keeper.keep();
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
eventBus.on('diagram.destroy', 1000, function() {
|
|
187
|
+
keeper.release();
|
|
188
|
+
|
|
189
|
+
document.removeEventListener('touchstart', touchStarted, true);
|
|
190
|
+
document.removeEventListener('touchend', touchEnded, true);
|
|
191
|
+
document.removeEventListener('touchcancel', touchEnded, true);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
TouchContextPad.$inject = [ 'eventBus', 'dragging', 'canvas' ];
|
|
196
|
+
|
|
197
|
+
export { TouchTargetKeeper, shouldCancelWaitingDrag };
|