@bpmn-io/form-js-playground 0.9.7 → 0.9.9

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.
@@ -377,128 +377,45 @@
377
377
  */
378
378
 
379
379
  var proto = typeof Element !== 'undefined' ? Element.prototype : {};
380
- var vendor = proto.matches || proto.matchesSelector || proto.webkitMatchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector;
381
- var matchesSelector = match;
382
- /**
383
- * Match `el` to `selector`.
384
- *
385
- * @param {Element} el
386
- * @param {String} selector
387
- * @return {Boolean}
388
- * @api public
389
- */
390
-
391
- function match(el, selector) {
392
- if (!el || el.nodeType !== 1) return false;
393
- if (vendor) return vendor.call(el, selector);
394
- var nodes = el.parentNode.querySelectorAll(selector);
395
-
396
- for (var i = 0; i < nodes.length; i++) {
397
- if (nodes[i] == el) return true;
398
- }
399
-
400
- return false;
401
- }
402
- /**
403
- * Closest
404
- *
405
- * @param {Element} el
406
- * @param {String} selector
407
- * @param {Boolean} checkYourSelf (optional)
408
- */
409
-
410
-
411
- function closest(element, selector, checkYourSelf) {
412
- var currentElem = checkYourSelf ? element : element.parentNode;
413
-
414
- while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE && currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
415
- if (matchesSelector(currentElem, selector)) {
416
- return currentElem;
417
- }
418
-
419
- currentElem = currentElem.parentNode;
420
- }
421
-
422
- return matchesSelector(currentElem, selector) ? currentElem : null;
423
- }
424
-
425
- var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
426
- unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
427
- prefix = bind$1 !== 'addEventListener' ? 'on' : '';
428
- /**
429
- * Bind `el` event `type` to `fn`.
430
- *
431
- * @param {Element} el
432
- * @param {String} type
433
- * @param {Function} fn
434
- * @param {Boolean} capture
435
- * @return {Function}
436
- * @api public
437
- */
438
-
439
- var bind_1 = function (el, type, fn, capture) {
440
- el[bind$1](prefix + type, fn, capture || false);
441
- return fn;
442
- };
443
- /**
444
- * Unbind `el` event `type`'s callback `fn`.
445
- *
446
- * @param {Element} el
447
- * @param {String} type
448
- * @param {Function} fn
449
- * @param {Boolean} capture
450
- * @return {Function}
451
- * @api public
452
- */
453
-
454
-
455
- var unbind_1 = function (el, type, fn, capture) {
456
- el[unbind](prefix + type, fn, capture || false);
457
- return fn;
458
- };
459
-
460
- var componentEvent = {
461
- bind: bind_1,
462
- unbind: unbind_1
463
- };
380
+ proto.matches || proto.matchesSelector || proto.webkitMatchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector;
464
381
  /**
465
382
  * Expose `parse`.
466
383
  */
467
384
 
468
- var domify = parse;
385
+ var domify$2 = parse$1;
469
386
  /**
470
387
  * Tests for browser support.
471
388
  */
472
389
 
473
- var innerHTMLBug = false;
474
- var bugTestDiv;
390
+ var innerHTMLBug$1 = false;
391
+ var bugTestDiv$1;
475
392
 
476
393
  if (typeof document !== 'undefined') {
477
- bugTestDiv = document.createElement('div'); // Setup
394
+ bugTestDiv$1 = document.createElement('div'); // Setup
478
395
 
479
- bugTestDiv.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>'; // Make sure that link elements get serialized correctly by innerHTML
396
+ bugTestDiv$1.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>'; // Make sure that link elements get serialized correctly by innerHTML
480
397
  // This requires a wrapper element in IE
481
398
 
482
- innerHTMLBug = !bugTestDiv.getElementsByTagName('link').length;
483
- bugTestDiv = undefined;
399
+ innerHTMLBug$1 = !bugTestDiv$1.getElementsByTagName('link').length;
400
+ bugTestDiv$1 = undefined;
484
401
  }
485
402
  /**
486
403
  * Wrap map from jquery.
487
404
  */
488
405
 
489
406
 
490
- var map$1 = {
407
+ var map$1$1 = {
491
408
  legend: [1, '<fieldset>', '</fieldset>'],
492
409
  tr: [2, '<table><tbody>', '</tbody></table>'],
493
410
  col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
494
411
  // for script/link/style tags to work in IE6-8, you have to wrap
495
412
  // in a div with a non-whitespace character in front, ha!
496
- _default: innerHTMLBug ? [1, 'X<div>', '</div>'] : [0, '', '']
413
+ _default: innerHTMLBug$1 ? [1, 'X<div>', '</div>'] : [0, '', '']
497
414
  };
498
- map$1.td = map$1.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
499
- map$1.option = map$1.optgroup = [1, '<select multiple="multiple">', '</select>'];
500
- map$1.thead = map$1.tbody = map$1.colgroup = map$1.caption = map$1.tfoot = [1, '<table>', '</table>'];
501
- map$1.polyline = map$1.ellipse = map$1.polygon = map$1.circle = map$1.text = map$1.line = map$1.path = map$1.rect = map$1.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">', '</svg>'];
415
+ map$1$1.td = map$1$1.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
416
+ map$1$1.option = map$1$1.optgroup = [1, '<select multiple="multiple">', '</select>'];
417
+ map$1$1.thead = map$1$1.tbody = map$1$1.colgroup = map$1$1.caption = map$1$1.tfoot = [1, '<table>', '</table>'];
418
+ map$1$1.polyline = map$1$1.ellipse = map$1$1.polygon = map$1$1.circle = map$1$1.text = map$1$1.line = map$1$1.path = map$1$1.rect = map$1$1.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">', '</svg>'];
502
419
  /**
503
420
  * Parse `html` and return a DOM Node instance, which could be a TextNode,
504
421
  * HTML DOM Node of some kind (<div> for example), or a DocumentFragment
@@ -510,7 +427,7 @@
510
427
  * @api private
511
428
  */
512
429
 
513
- function parse(html, doc) {
430
+ function parse$1(html, doc) {
514
431
  if ('string' != typeof html) throw new TypeError('String expected'); // default to the global `document` object
515
432
 
516
433
  if (!doc) doc = document; // tag name
@@ -528,7 +445,7 @@
528
445
  } // wrap map
529
446
 
530
447
 
531
- var wrap = map$1[tag] || map$1._default;
448
+ var wrap = map$1$1[tag] || map$1$1._default;
532
449
  var depth = wrap[0];
533
450
  var prefix = wrap[1];
534
451
  var suffix = wrap[2];
@@ -552,11 +469,6 @@
552
469
  return fragment;
553
470
  }
554
471
 
555
- function query(selector, el) {
556
- el = el || document;
557
- return el.querySelector(selector);
558
- }
559
-
560
472
  var OVERLAY_HTML = '<div class="drop-overlay">' + '<div class="box">' + '<div class="label">{label}</div>' + '</div>' + '</div>';
561
473
  /**
562
474
  * Add file drop functionality to the given element,
@@ -736,7 +648,7 @@
736
648
 
737
649
  function createOverlay(label) {
738
650
  var markup = OVERLAY_HTML.replace('{label}', label);
739
- return domify(markup);
651
+ return domify$2(markup);
740
652
  }
741
653
 
742
654
  function preventDrop(event) {
@@ -1349,54 +1261,40 @@
1349
1261
  * @return {Array<?>}
1350
1262
  */
1351
1263
 
1352
- var nativeToString = Object.prototype.toString;
1353
- var nativeHasOwnProperty = Object.prototype.hasOwnProperty;
1264
+ const nativeToString$1 = Object.prototype.toString;
1265
+ const nativeHasOwnProperty$1 = Object.prototype.hasOwnProperty;
1354
1266
 
1355
- function isUndefined(obj) {
1267
+ function isUndefined$1(obj) {
1356
1268
  return obj === undefined;
1357
1269
  }
1358
1270
 
1359
- function isDefined(obj) {
1271
+ function isDefined$1(obj) {
1360
1272
  return obj !== undefined;
1361
1273
  }
1362
1274
 
1363
- function isNil(obj) {
1275
+ function isNil$1(obj) {
1364
1276
  return obj == null;
1365
1277
  }
1366
1278
 
1367
- function isArray$1(obj) {
1368
- return nativeToString.call(obj) === '[object Array]';
1279
+ function isArray$2(obj) {
1280
+ return nativeToString$1.call(obj) === '[object Array]';
1369
1281
  }
1370
1282
 
1371
- function isObject(obj) {
1372
- return nativeToString.call(obj) === '[object Object]';
1283
+ function isObject$1(obj) {
1284
+ return nativeToString$1.call(obj) === '[object Object]';
1373
1285
  }
1374
1286
 
1375
- function isNumber(obj) {
1376
- return nativeToString.call(obj) === '[object Number]';
1287
+ function isNumber$1(obj) {
1288
+ return nativeToString$1.call(obj) === '[object Number]';
1377
1289
  }
1378
1290
 
1379
- function isFunction(obj) {
1380
- var tag = nativeToString.call(obj);
1291
+ function isFunction$1(obj) {
1292
+ const tag = nativeToString$1.call(obj);
1381
1293
  return tag === '[object Function]' || tag === '[object AsyncFunction]' || tag === '[object GeneratorFunction]' || tag === '[object AsyncGeneratorFunction]' || tag === '[object Proxy]';
1382
1294
  }
1383
1295
 
1384
- function isString(obj) {
1385
- return nativeToString.call(obj) === '[object String]';
1386
- }
1387
- /**
1388
- * Ensure collection is an array.
1389
- *
1390
- * @param {Object} obj
1391
- */
1392
-
1393
-
1394
- function ensureArray(obj) {
1395
- if (isArray$1(obj)) {
1396
- return;
1397
- }
1398
-
1399
- throw new Error('must supply array');
1296
+ function isString$1(obj) {
1297
+ return nativeToString$1.call(obj) === '[object String]';
1400
1298
  }
1401
1299
  /**
1402
1300
  * Return true, if target owns a property with the given key.
@@ -1408,29 +1306,8 @@
1408
1306
  */
1409
1307
 
1410
1308
 
1411
- function has(target, key) {
1412
- return nativeHasOwnProperty.call(target, key);
1413
- }
1414
- /**
1415
- * Find element in collection.
1416
- *
1417
- * @param {Array|Object} collection
1418
- * @param {Function|Object} matcher
1419
- *
1420
- * @return {Object}
1421
- */
1422
-
1423
-
1424
- function find$3(collection, matcher) {
1425
- matcher = toMatcher(matcher);
1426
- var match;
1427
- forEach(collection, function (val, key) {
1428
- if (matcher(val, key)) {
1429
- match = val;
1430
- return false;
1431
- }
1432
- });
1433
- return match;
1309
+ function has$1(target, key) {
1310
+ return nativeHasOwnProperty$1.call(target, key);
1434
1311
  }
1435
1312
  /**
1436
1313
  * Iterate over collection; returning something
@@ -1443,17 +1320,17 @@
1443
1320
  */
1444
1321
 
1445
1322
 
1446
- function forEach(collection, iterator) {
1447
- var val, result;
1323
+ function forEach$1(collection, iterator) {
1324
+ let val, result;
1448
1325
 
1449
- if (isUndefined(collection)) {
1326
+ if (isUndefined$1(collection)) {
1450
1327
  return;
1451
1328
  }
1452
1329
 
1453
- var convertKey = isArray$1(collection) ? toNum : identity;
1330
+ const convertKey = isArray$2(collection) ? toNum$1 : identity$1;
1454
1331
 
1455
- for (var key in collection) {
1456
- if (has(collection, key)) {
1332
+ for (let key in collection) {
1333
+ if (has$1(collection, key)) {
1457
1334
  val = collection[key];
1458
1335
  result = iterator(val, convertKey(key));
1459
1336
 
@@ -1463,213 +1340,14 @@
1463
1340
  }
1464
1341
  }
1465
1342
  }
1466
- /**
1467
- * Return collection without element.
1468
- *
1469
- * @param {Array} arr
1470
- * @param {Function} matcher
1471
- *
1472
- * @return {Array}
1473
- */
1474
-
1475
-
1476
- function without(arr, matcher) {
1477
- if (isUndefined(arr)) {
1478
- return [];
1479
- }
1480
-
1481
- ensureArray(arr);
1482
- matcher = toMatcher(matcher);
1483
- return arr.filter(function (el, idx) {
1484
- return !matcher(el, idx);
1485
- });
1486
- }
1487
- /**
1488
- * Transform a collection into another collection
1489
- * by piping each member through the given fn.
1490
- *
1491
- * @param {Object|Array} collection
1492
- * @param {Function} fn
1493
- *
1494
- * @return {Array} transformed collection
1495
- */
1496
-
1497
1343
 
1498
- function map(collection, fn) {
1499
- var result = [];
1500
- forEach(collection, function (val, key) {
1501
- result.push(fn(val, key));
1502
- });
1503
- return result;
1504
- }
1505
- /**
1506
- * Group collection members by attribute.
1507
- *
1508
- * @param {Object|Array} collection
1509
- * @param {Function} extractor
1510
- *
1511
- * @return {Object} map with { attrValue => [ a, b, c ] }
1512
- */
1513
-
1514
-
1515
- function groupBy(collection, extractor) {
1516
- var grouped = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1517
- extractor = toExtractor(extractor);
1518
- forEach(collection, function (val) {
1519
- var discriminator = extractor(val) || '_';
1520
- var group = grouped[discriminator];
1521
-
1522
- if (!group) {
1523
- group = grouped[discriminator] = [];
1524
- }
1525
-
1526
- group.push(val);
1527
- });
1528
- return grouped;
1529
- }
1530
-
1531
- function uniqueBy(extractor) {
1532
- extractor = toExtractor(extractor);
1533
- var grouped = {};
1534
-
1535
- for (var _len = arguments.length, collections = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1536
- collections[_key - 1] = arguments[_key];
1537
- }
1538
-
1539
- forEach(collections, function (c) {
1540
- return groupBy(c, extractor, grouped);
1541
- });
1542
- var result = map(grouped, function (val, key) {
1543
- return val[0];
1544
- });
1545
- return result;
1546
- }
1547
- /**
1548
- * Sort collection by criteria.
1549
- *
1550
- * @param {Object|Array} collection
1551
- * @param {String|Function} extractor
1552
- *
1553
- * @return {Array}
1554
- */
1555
-
1556
- function sortBy(collection, extractor) {
1557
- extractor = toExtractor(extractor);
1558
- var sorted = [];
1559
- forEach(collection, function (value, key) {
1560
- var disc = extractor(value, key);
1561
- var entry = {
1562
- d: disc,
1563
- v: value
1564
- };
1565
-
1566
- for (var idx = 0; idx < sorted.length; idx++) {
1567
- var d = sorted[idx].d;
1568
-
1569
- if (disc < d) {
1570
- sorted.splice(idx, 0, entry);
1571
- return;
1572
- }
1573
- } // not inserted, append (!)
1574
-
1575
-
1576
- sorted.push(entry);
1577
- });
1578
- return map(sorted, function (e) {
1579
- return e.v;
1580
- });
1581
- }
1582
-
1583
- function toExtractor(extractor) {
1584
- return isFunction(extractor) ? extractor : function (e) {
1585
- return e[extractor];
1586
- };
1587
- }
1588
-
1589
- function toMatcher(matcher) {
1590
- return isFunction(matcher) ? matcher : function (e) {
1591
- return e === matcher;
1592
- };
1593
- }
1594
-
1595
- function identity(arg) {
1344
+ function identity$1(arg) {
1596
1345
  return arg;
1597
1346
  }
1598
1347
 
1599
- function toNum(arg) {
1348
+ function toNum$1(arg) {
1600
1349
  return Number(arg);
1601
1350
  }
1602
- /**
1603
- * Debounce fn, calling it only once if the given time
1604
- * elapsed between calls.
1605
- *
1606
- * Lodash-style the function exposes methods to `#clear`
1607
- * and `#flush` to control internal behavior.
1608
- *
1609
- * @param {Function} fn
1610
- * @param {Number} timeout
1611
- *
1612
- * @return {Function} debounced function
1613
- */
1614
-
1615
-
1616
- function debounce$2(fn, timeout) {
1617
- var timer;
1618
- var lastArgs;
1619
- var lastThis;
1620
- var lastNow;
1621
-
1622
- function fire(force) {
1623
- var now = Date.now();
1624
- var scheduledDiff = force ? 0 : lastNow + timeout - now;
1625
-
1626
- if (scheduledDiff > 0) {
1627
- return schedule(scheduledDiff);
1628
- }
1629
-
1630
- fn.apply(lastThis, lastArgs);
1631
- clear();
1632
- }
1633
-
1634
- function schedule(timeout) {
1635
- timer = setTimeout(fire, timeout);
1636
- }
1637
-
1638
- function clear() {
1639
- if (timer) {
1640
- clearTimeout(timer);
1641
- }
1642
-
1643
- timer = lastNow = lastArgs = lastThis = undefined;
1644
- }
1645
-
1646
- function flush() {
1647
- if (timer) {
1648
- fire(true);
1649
- }
1650
-
1651
- clear();
1652
- }
1653
-
1654
- function callback() {
1655
- lastNow = Date.now();
1656
-
1657
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1658
- args[_key] = arguments[_key];
1659
- }
1660
-
1661
- lastArgs = args;
1662
- lastThis = this; // ensure an execution is scheduled
1663
-
1664
- if (!timer) {
1665
- schedule(timeout);
1666
- }
1667
- }
1668
-
1669
- callback.flush = flush;
1670
- callback.cancel = clear;
1671
- return callback;
1672
- }
1673
1351
  /**
1674
1352
  * Bind function against target <this>.
1675
1353
  *
@@ -1680,43 +1358,9 @@
1680
1358
  */
1681
1359
 
1682
1360
 
1683
- function bind(fn, target) {
1361
+ function bind$2(fn, target) {
1684
1362
  return fn.bind(target);
1685
1363
  }
1686
-
1687
- function _typeof(obj) {
1688
- "@babel/helpers - typeof";
1689
-
1690
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1691
- _typeof = function (obj) {
1692
- return typeof obj;
1693
- };
1694
- } else {
1695
- _typeof = function (obj) {
1696
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1697
- };
1698
- }
1699
-
1700
- return _typeof(obj);
1701
- }
1702
-
1703
- function _extends$d() {
1704
- _extends$d = Object.assign || function (target) {
1705
- for (var i = 1; i < arguments.length; i++) {
1706
- var source = arguments[i];
1707
-
1708
- for (var key in source) {
1709
- if (Object.prototype.hasOwnProperty.call(source, key)) {
1710
- target[key] = source[key];
1711
- }
1712
- }
1713
- }
1714
-
1715
- return target;
1716
- };
1717
-
1718
- return _extends$d.apply(this, arguments);
1719
- }
1720
1364
  /**
1721
1365
  * Convenience wrapper for `Object.assign`.
1722
1366
  *
@@ -1727,12 +1371,8 @@
1727
1371
  */
1728
1372
 
1729
1373
 
1730
- function assign(target) {
1731
- for (var _len = arguments.length, others = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1732
- others[_key - 1] = arguments[_key];
1733
- }
1734
-
1735
- return _extends$d.apply(void 0, [target].concat(others));
1374
+ function assign$1(target, ...others) {
1375
+ return Object.assign(target, ...others);
1736
1376
  }
1737
1377
  /**
1738
1378
  * Sets a nested property of a given object to the specified value.
@@ -1745,11 +1385,11 @@
1745
1385
  */
1746
1386
 
1747
1387
 
1748
- function set(target, path, value) {
1749
- var currentTarget = target;
1750
- forEach(path, function (key, idx) {
1388
+ function set$1(target, path, value) {
1389
+ let currentTarget = target;
1390
+ forEach$1(path, function (key, idx) {
1751
1391
  if (typeof key !== 'number' && typeof key !== 'string') {
1752
- throw new Error('illegal key type: ' + _typeof(key) + '. Key should be of type number or string.');
1392
+ throw new Error('illegal key type: ' + typeof key + '. Key should be of type number or string.');
1753
1393
  }
1754
1394
 
1755
1395
  if (key === 'constructor') {
@@ -1760,15 +1400,15 @@
1760
1400
  throw new Error('illegal key: __proto__');
1761
1401
  }
1762
1402
 
1763
- var nextKey = path[idx + 1];
1764
- var nextTarget = currentTarget[key];
1403
+ let nextKey = path[idx + 1];
1404
+ let nextTarget = currentTarget[key];
1765
1405
 
1766
- if (isDefined(nextKey) && isNil(nextTarget)) {
1406
+ if (isDefined$1(nextKey) && isNil$1(nextTarget)) {
1767
1407
  nextTarget = currentTarget[key] = isNaN(+nextKey) ? {} : [];
1768
1408
  }
1769
1409
 
1770
- if (isUndefined(nextKey)) {
1771
- if (isUndefined(value)) {
1410
+ if (isUndefined$1(nextKey)) {
1411
+ if (isUndefined$1(value)) {
1772
1412
  delete currentTarget[key];
1773
1413
  } else {
1774
1414
  currentTarget[key] = value;
@@ -1788,18 +1428,18 @@
1788
1428
  */
1789
1429
 
1790
1430
 
1791
- function get(target, path, defaultValue) {
1792
- var currentTarget = target;
1793
- forEach(path, function (key) {
1431
+ function get$1(target, path, defaultValue) {
1432
+ let currentTarget = target;
1433
+ forEach$1(path, function (key) {
1794
1434
  // accessing nil property yields <undefined>
1795
- if (isNil(currentTarget)) {
1435
+ if (isNil$1(currentTarget)) {
1796
1436
  currentTarget = undefined;
1797
1437
  return false;
1798
1438
  }
1799
1439
 
1800
1440
  currentTarget = currentTarget[key];
1801
1441
  });
1802
- return isUndefined(currentTarget) ? defaultValue : currentTarget;
1442
+ return isUndefined$1(currentTarget) ? defaultValue : currentTarget;
1803
1443
  }
1804
1444
 
1805
1445
  var e$2 = {
@@ -2442,7 +2082,7 @@
2442
2082
  */
2443
2083
 
2444
2084
 
2445
- function isArray(obj) {
2085
+ function isArray$1(obj) {
2446
2086
  return Array.isArray(obj);
2447
2087
  }
2448
2088
  /**
@@ -2470,7 +2110,7 @@
2470
2110
 
2471
2111
 
2472
2112
  function annotate(...args) {
2473
- if (args.length === 1 && isArray(args[0])) {
2113
+ if (args.length === 1 && isArray$1(args[0])) {
2474
2114
  args = args[0];
2475
2115
  }
2476
2116
 
@@ -2601,7 +2241,7 @@
2601
2241
  }
2602
2242
 
2603
2243
  if (typeof fn !== 'function') {
2604
- if (isArray(fn)) {
2244
+ if (isArray$1(fn)) {
2605
2245
  fn = annotate(fn.slice());
2606
2246
  } else {
2607
2247
  throw error(`Cannot invoke "${fn}". Expected a function!`);
@@ -2845,7 +2485,7 @@
2845
2485
 
2846
2486
 
2847
2487
  function arrayUnwrap(type, value) {
2848
- if (type !== 'value' && isArray(value)) {
2488
+ if (type !== 'value' && isArray$1(value)) {
2849
2489
  value = annotate(value.slice());
2850
2490
  }
2851
2491
 
@@ -2965,22 +2605,22 @@
2965
2605
 
2966
2606
 
2967
2607
  EventBus$1.prototype.on = function (events, priority, callback, that) {
2968
- events = isArray$1(events) ? events : [events];
2608
+ events = isArray$2(events) ? events : [events];
2969
2609
 
2970
- if (isFunction(priority)) {
2610
+ if (isFunction$1(priority)) {
2971
2611
  that = callback;
2972
2612
  callback = priority;
2973
2613
  priority = DEFAULT_PRIORITY$3;
2974
2614
  }
2975
2615
 
2976
- if (!isNumber(priority)) {
2616
+ if (!isNumber$1(priority)) {
2977
2617
  throw new Error('priority must be a number');
2978
2618
  }
2979
2619
 
2980
2620
  var actualCallback = callback;
2981
2621
 
2982
2622
  if (that) {
2983
- actualCallback = bind(callback, that); // make sure we remember and are able to remove
2623
+ actualCallback = bind$2(callback, that); // make sure we remember and are able to remove
2984
2624
  // bound callbacks via {@link #off} using the original
2985
2625
  // callback
2986
2626
 
@@ -3009,13 +2649,13 @@
3009
2649
  EventBus$1.prototype.once = function (event, priority, callback, that) {
3010
2650
  var self = this;
3011
2651
 
3012
- if (isFunction(priority)) {
2652
+ if (isFunction$1(priority)) {
3013
2653
  that = callback;
3014
2654
  callback = priority;
3015
2655
  priority = DEFAULT_PRIORITY$3;
3016
2656
  }
3017
2657
 
3018
- if (!isNumber(priority)) {
2658
+ if (!isNumber$1(priority)) {
3019
2659
  throw new Error('priority must be a number');
3020
2660
  }
3021
2661
 
@@ -3043,7 +2683,7 @@
3043
2683
 
3044
2684
 
3045
2685
  EventBus$1.prototype.off = function (events, callback) {
3046
- events = isArray$1(events) ? events : [events];
2686
+ events = isArray$2(events) ? events : [events];
3047
2687
  var self = this;
3048
2688
  events.forEach(function (event) {
3049
2689
  self._removeListener(event, callback);
@@ -3311,7 +2951,7 @@
3311
2951
  };
3312
2952
 
3313
2953
  InternalEvent$1.prototype.init = function (data) {
3314
- assign(this, data || {});
2954
+ assign$1(this, data || {});
3315
2955
  };
3316
2956
  /**
3317
2957
  * Invoke function. Be fast...
@@ -3342,7 +2982,7 @@
3342
2982
  errors = [...errors, `Field must match pattern ${validate.pattern}.`];
3343
2983
  }
3344
2984
 
3345
- if (validate.required && (isNil(value) || value === '')) {
2985
+ if (validate.required && (isNil$1(value) || value === '')) {
3346
2986
  errors = [...errors, 'Field is required.'];
3347
2987
  }
3348
2988
 
@@ -3614,7 +3254,7 @@
3614
3254
 
3615
3255
  if (valuesKey) {
3616
3256
  importedData = { ...importedData,
3617
- [valuesKey]: get(data, [valuesKey])
3257
+ [valuesKey]: get$1(data, [valuesKey])
3618
3258
  };
3619
3259
  } // try to get value from data
3620
3260
  // if unavailable - try to get default value from form field
@@ -3624,9 +3264,9 @@
3624
3264
  if (_path) {
3625
3265
  const fieldImplementation = this._formFields.get(type);
3626
3266
 
3627
- let valueData = get(data, _path);
3267
+ let valueData = get$1(data, _path);
3628
3268
 
3629
- if (!isUndefined(valueData) && fieldImplementation.sanitizeValue) {
3269
+ if (!isUndefined$1(valueData) && fieldImplementation.sanitizeValue) {
3630
3270
  valueData = fieldImplementation.sanitizeValue({
3631
3271
  formField,
3632
3272
  data,
@@ -3634,7 +3274,7 @@
3634
3274
  });
3635
3275
  }
3636
3276
 
3637
- const initialFieldValue = !isUndefined(valueData) ? valueData : !isUndefined(defaultValue) ? defaultValue : fieldImplementation.emptyValue;
3277
+ const initialFieldValue = !isUndefined$1(valueData) ? valueData : !isUndefined$1(defaultValue) ? defaultValue : fieldImplementation.emptyValue;
3638
3278
  importedData = { ...importedData,
3639
3279
  [_path[0]]: initialFieldValue
3640
3280
  };
@@ -3816,7 +3456,7 @@
3816
3456
  } = formField;
3817
3457
 
3818
3458
  try {
3819
- const validValues = (valuesKey ? get(data, [valuesKey]) : values).map(v => v.value) || [];
3459
+ const validValues = (valuesKey ? get$1(data, [valuesKey]) : values).map(v => v.value) || [];
3820
3460
  return validValues.includes(value) ? value : null;
3821
3461
  } catch (error) {
3822
3462
  // use default value in case of formatting error
@@ -3837,7 +3477,7 @@
3837
3477
  } = formField;
3838
3478
 
3839
3479
  try {
3840
- const validValues = (valuesKey ? get(data, [valuesKey]) : values).map(v => v.value) || [];
3480
+ const validValues = (valuesKey ? get$1(data, [valuesKey]) : values).map(v => v.value) || [];
3841
3481
  return value.filter(v => validValues.includes(v));
3842
3482
  } catch (error) {
3843
3483
  // use default value in case of formatting error
@@ -4200,7 +3840,7 @@
4200
3840
  throw new Error(`cannot render field <${field.type}>`);
4201
3841
  }
4202
3842
 
4203
- const value = get(data, _path);
3843
+ const value = get$1(data, _path);
4204
3844
  const fieldErrors = findErrors(errors, _path);
4205
3845
  const disabled = properties.readOnly || field.disabled || false;
4206
3846
  return e$1(Element, {
@@ -5018,7 +4658,7 @@
5018
4658
 
5019
4659
  Textfield$1.sanitizeValue = ({
5020
4660
  value
5021
- }) => isArray$1(value) || isObject(value) ? null : String(value);
4661
+ }) => isArray$2(value) || isObject$1(value) ? null : String(value);
5022
4662
 
5023
4663
  const formFields = [Button, Checkbox$1, Checklist, Default, Number$1, Radio, Select$1, Taglist, Text$3, Textfield$1];
5024
4664
 
@@ -5268,22 +4908,8 @@
5268
4908
  throw new Error('form is read-only');
5269
4909
  }
5270
4910
 
5271
- const formFieldRegistry = this.get('formFieldRegistry');
5272
- const data = formFieldRegistry.getAll().reduce((data, field) => {
5273
- const {
5274
- disabled,
5275
- _path
5276
- } = field; // do not submit disabled form fields
5277
-
5278
- if (disabled || !_path) {
5279
- return data;
5280
- }
4911
+ const data = this._getSubmitData();
5281
4912
 
5282
- const value = get(this._getState().data, _path);
5283
- return { ...data,
5284
- [_path[0]]: value
5285
- };
5286
- }, {});
5287
4913
  const errors = this.validate();
5288
4914
 
5289
4915
  this._emit('submit', {
@@ -5328,9 +4954,9 @@
5328
4954
  return errors;
5329
4955
  }
5330
4956
 
5331
- const value = get(data, _path);
4957
+ const value = get$1(data, _path);
5332
4958
  const fieldErrors = validator.validateField(field, value);
5333
- return set(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
4959
+ return set$1(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
5334
4960
  },
5335
4961
  /** @type {Errors} */
5336
4962
  {});
@@ -5353,7 +4979,7 @@
5353
4979
 
5354
4980
  this.detach();
5355
4981
 
5356
- if (isString(parentNode)) {
4982
+ if (isString$1(parentNode)) {
5357
4983
  parentNode = document.querySelector(parentNode);
5358
4984
  }
5359
4985
 
@@ -5394,7 +5020,7 @@
5394
5020
 
5395
5021
 
5396
5022
  setProperty(property, value) {
5397
- const properties = set(this._getState().properties, [property], value);
5023
+ const properties = set$1(this._getState().properties, [property], value);
5398
5024
 
5399
5025
  this._setState({
5400
5026
  properties
@@ -5466,8 +5092,8 @@
5466
5092
 
5467
5093
  const validator = this.get('validator');
5468
5094
  const fieldErrors = validator.validateField(field, value);
5469
- set(data, _path, value);
5470
- set(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
5095
+ set$1(data, _path, value);
5096
+ set$1(errors, [pathStringify(_path)], fieldErrors.length ? fieldErrors : undefined);
5471
5097
 
5472
5098
  this._setState({
5473
5099
  data: clone(data),
@@ -5502,11 +5128,444 @@
5502
5128
  _onEvent(type, priority, handler) {
5503
5129
  this.get('eventBus').on(type, priority, handler);
5504
5130
  }
5131
+ /**
5132
+ * @internal
5133
+ */
5134
+
5135
+
5136
+ _getSubmitData() {
5137
+ const formFieldRegistry = this.get('formFieldRegistry');
5138
+ return formFieldRegistry.getAll().reduce((data, field) => {
5139
+ const {
5140
+ disabled,
5141
+ _path
5142
+ } = field; // do not submit disabled form fields
5143
+
5144
+ if (disabled || !_path) {
5145
+ return data;
5146
+ }
5147
+
5148
+ const value = get$1(this._getState().data, _path);
5149
+ return { ...data,
5150
+ [_path[0]]: value
5151
+ };
5152
+ }, {});
5153
+ }
5505
5154
 
5506
5155
  }
5507
5156
 
5508
5157
  const schemaVersion = 5;
5509
5158
 
5159
+ /**
5160
+ * Flatten array, one level deep.
5161
+ *
5162
+ * @param {Array<?>} arr
5163
+ *
5164
+ * @return {Array<?>}
5165
+ */
5166
+
5167
+ const nativeToString = Object.prototype.toString;
5168
+ const nativeHasOwnProperty = Object.prototype.hasOwnProperty;
5169
+
5170
+ function isUndefined(obj) {
5171
+ return obj === undefined;
5172
+ }
5173
+
5174
+ function isDefined(obj) {
5175
+ return obj !== undefined;
5176
+ }
5177
+
5178
+ function isNil(obj) {
5179
+ return obj == null;
5180
+ }
5181
+
5182
+ function isArray(obj) {
5183
+ return nativeToString.call(obj) === '[object Array]';
5184
+ }
5185
+
5186
+ function isObject(obj) {
5187
+ return nativeToString.call(obj) === '[object Object]';
5188
+ }
5189
+
5190
+ function isNumber(obj) {
5191
+ return nativeToString.call(obj) === '[object Number]';
5192
+ }
5193
+
5194
+ function isFunction(obj) {
5195
+ const tag = nativeToString.call(obj);
5196
+ return tag === '[object Function]' || tag === '[object AsyncFunction]' || tag === '[object GeneratorFunction]' || tag === '[object AsyncGeneratorFunction]' || tag === '[object Proxy]';
5197
+ }
5198
+
5199
+ function isString(obj) {
5200
+ return nativeToString.call(obj) === '[object String]';
5201
+ }
5202
+ /**
5203
+ * Ensure collection is an array.
5204
+ *
5205
+ * @param {Object} obj
5206
+ */
5207
+
5208
+
5209
+ function ensureArray(obj) {
5210
+ if (isArray(obj)) {
5211
+ return;
5212
+ }
5213
+
5214
+ throw new Error('must supply array');
5215
+ }
5216
+ /**
5217
+ * Return true, if target owns a property with the given key.
5218
+ *
5219
+ * @param {Object} target
5220
+ * @param {String} key
5221
+ *
5222
+ * @return {Boolean}
5223
+ */
5224
+
5225
+
5226
+ function has(target, key) {
5227
+ return nativeHasOwnProperty.call(target, key);
5228
+ }
5229
+ /**
5230
+ * Find element in collection.
5231
+ *
5232
+ * @param {Array|Object} collection
5233
+ * @param {Function|Object} matcher
5234
+ *
5235
+ * @return {Object}
5236
+ */
5237
+
5238
+
5239
+ function find$3(collection, matcher) {
5240
+ matcher = toMatcher(matcher);
5241
+ let match;
5242
+ forEach(collection, function (val, key) {
5243
+ if (matcher(val, key)) {
5244
+ match = val;
5245
+ return false;
5246
+ }
5247
+ });
5248
+ return match;
5249
+ }
5250
+ /**
5251
+ * Iterate over collection; returning something
5252
+ * (non-undefined) will stop iteration.
5253
+ *
5254
+ * @param {Array|Object} collection
5255
+ * @param {Function} iterator
5256
+ *
5257
+ * @return {Object} return result that stopped the iteration
5258
+ */
5259
+
5260
+
5261
+ function forEach(collection, iterator) {
5262
+ let val, result;
5263
+
5264
+ if (isUndefined(collection)) {
5265
+ return;
5266
+ }
5267
+
5268
+ const convertKey = isArray(collection) ? toNum : identity;
5269
+
5270
+ for (let key in collection) {
5271
+ if (has(collection, key)) {
5272
+ val = collection[key];
5273
+ result = iterator(val, convertKey(key));
5274
+
5275
+ if (result === false) {
5276
+ return val;
5277
+ }
5278
+ }
5279
+ }
5280
+ }
5281
+ /**
5282
+ * Return collection without element.
5283
+ *
5284
+ * @param {Array} arr
5285
+ * @param {Function} matcher
5286
+ *
5287
+ * @return {Array}
5288
+ */
5289
+
5290
+
5291
+ function without(arr, matcher) {
5292
+ if (isUndefined(arr)) {
5293
+ return [];
5294
+ }
5295
+
5296
+ ensureArray(arr);
5297
+ matcher = toMatcher(matcher);
5298
+ return arr.filter(function (el, idx) {
5299
+ return !matcher(el, idx);
5300
+ });
5301
+ }
5302
+ /**
5303
+ * Transform a collection into another collection
5304
+ * by piping each member through the given fn.
5305
+ *
5306
+ * @param {Object|Array} collection
5307
+ * @param {Function} fn
5308
+ *
5309
+ * @return {Array} transformed collection
5310
+ */
5311
+
5312
+
5313
+ function map$1(collection, fn) {
5314
+ let result = [];
5315
+ forEach(collection, function (val, key) {
5316
+ result.push(fn(val, key));
5317
+ });
5318
+ return result;
5319
+ }
5320
+ /**
5321
+ * Group collection members by attribute.
5322
+ *
5323
+ * @param {Object|Array} collection
5324
+ * @param {Function} extractor
5325
+ *
5326
+ * @return {Object} map with { attrValue => [ a, b, c ] }
5327
+ */
5328
+
5329
+
5330
+ function groupBy(collection, extractor, grouped = {}) {
5331
+ extractor = toExtractor(extractor);
5332
+ forEach(collection, function (val) {
5333
+ let discriminator = extractor(val) || '_';
5334
+ let group = grouped[discriminator];
5335
+
5336
+ if (!group) {
5337
+ group = grouped[discriminator] = [];
5338
+ }
5339
+
5340
+ group.push(val);
5341
+ });
5342
+ return grouped;
5343
+ }
5344
+
5345
+ function uniqueBy(extractor, ...collections) {
5346
+ extractor = toExtractor(extractor);
5347
+ let grouped = {};
5348
+ forEach(collections, c => groupBy(c, extractor, grouped));
5349
+ let result = map$1(grouped, function (val, key) {
5350
+ return val[0];
5351
+ });
5352
+ return result;
5353
+ }
5354
+ /**
5355
+ * Sort collection by criteria.
5356
+ *
5357
+ * @param {Object|Array} collection
5358
+ * @param {String|Function} extractor
5359
+ *
5360
+ * @return {Array}
5361
+ */
5362
+
5363
+ function sortBy(collection, extractor) {
5364
+ extractor = toExtractor(extractor);
5365
+ let sorted = [];
5366
+ forEach(collection, function (value, key) {
5367
+ let disc = extractor(value, key);
5368
+ let entry = {
5369
+ d: disc,
5370
+ v: value
5371
+ };
5372
+
5373
+ for (var idx = 0; idx < sorted.length; idx++) {
5374
+ let {
5375
+ d
5376
+ } = sorted[idx];
5377
+
5378
+ if (disc < d) {
5379
+ sorted.splice(idx, 0, entry);
5380
+ return;
5381
+ }
5382
+ } // not inserted, append (!)
5383
+
5384
+
5385
+ sorted.push(entry);
5386
+ });
5387
+ return map$1(sorted, e => e.v);
5388
+ }
5389
+
5390
+ function toExtractor(extractor) {
5391
+ return isFunction(extractor) ? extractor : e => {
5392
+ return e[extractor];
5393
+ };
5394
+ }
5395
+
5396
+ function toMatcher(matcher) {
5397
+ return isFunction(matcher) ? matcher : e => {
5398
+ return e === matcher;
5399
+ };
5400
+ }
5401
+
5402
+ function identity(arg) {
5403
+ return arg;
5404
+ }
5405
+
5406
+ function toNum(arg) {
5407
+ return Number(arg);
5408
+ }
5409
+ /**
5410
+ * Debounce fn, calling it only once if the given time
5411
+ * elapsed between calls.
5412
+ *
5413
+ * Lodash-style the function exposes methods to `#clear`
5414
+ * and `#flush` to control internal behavior.
5415
+ *
5416
+ * @param {Function} fn
5417
+ * @param {Number} timeout
5418
+ *
5419
+ * @return {Function} debounced function
5420
+ */
5421
+
5422
+
5423
+ function debounce$2(fn, timeout) {
5424
+ let timer;
5425
+ let lastArgs;
5426
+ let lastThis;
5427
+ let lastNow;
5428
+
5429
+ function fire(force) {
5430
+ let now = Date.now();
5431
+ let scheduledDiff = force ? 0 : lastNow + timeout - now;
5432
+
5433
+ if (scheduledDiff > 0) {
5434
+ return schedule(scheduledDiff);
5435
+ }
5436
+
5437
+ fn.apply(lastThis, lastArgs);
5438
+ clear();
5439
+ }
5440
+
5441
+ function schedule(timeout) {
5442
+ timer = setTimeout(fire, timeout);
5443
+ }
5444
+
5445
+ function clear() {
5446
+ if (timer) {
5447
+ clearTimeout(timer);
5448
+ }
5449
+
5450
+ timer = lastNow = lastArgs = lastThis = undefined;
5451
+ }
5452
+
5453
+ function flush() {
5454
+ if (timer) {
5455
+ fire(true);
5456
+ }
5457
+
5458
+ clear();
5459
+ }
5460
+
5461
+ function callback(...args) {
5462
+ lastNow = Date.now();
5463
+ lastArgs = args;
5464
+ lastThis = this; // ensure an execution is scheduled
5465
+
5466
+ if (!timer) {
5467
+ schedule(timeout);
5468
+ }
5469
+ }
5470
+
5471
+ callback.flush = flush;
5472
+ callback.cancel = clear;
5473
+ return callback;
5474
+ }
5475
+ /**
5476
+ * Bind function against target <this>.
5477
+ *
5478
+ * @param {Function} fn
5479
+ * @param {Object} target
5480
+ *
5481
+ * @return {Function} bound function
5482
+ */
5483
+
5484
+
5485
+ function bind(fn, target) {
5486
+ return fn.bind(target);
5487
+ }
5488
+ /**
5489
+ * Convenience wrapper for `Object.assign`.
5490
+ *
5491
+ * @param {Object} target
5492
+ * @param {...Object} others
5493
+ *
5494
+ * @return {Object} the target
5495
+ */
5496
+
5497
+
5498
+ function assign(target, ...others) {
5499
+ return Object.assign(target, ...others);
5500
+ }
5501
+ /**
5502
+ * Sets a nested property of a given object to the specified value.
5503
+ *
5504
+ * This mutates the object and returns it.
5505
+ *
5506
+ * @param {Object} target The target of the set operation.
5507
+ * @param {(string|number)[]} path The path to the nested value.
5508
+ * @param {any} value The value to set.
5509
+ */
5510
+
5511
+
5512
+ function set(target, path, value) {
5513
+ let currentTarget = target;
5514
+ forEach(path, function (key, idx) {
5515
+ if (typeof key !== 'number' && typeof key !== 'string') {
5516
+ throw new Error('illegal key type: ' + typeof key + '. Key should be of type number or string.');
5517
+ }
5518
+
5519
+ if (key === 'constructor') {
5520
+ throw new Error('illegal key: constructor');
5521
+ }
5522
+
5523
+ if (key === '__proto__') {
5524
+ throw new Error('illegal key: __proto__');
5525
+ }
5526
+
5527
+ let nextKey = path[idx + 1];
5528
+ let nextTarget = currentTarget[key];
5529
+
5530
+ if (isDefined(nextKey) && isNil(nextTarget)) {
5531
+ nextTarget = currentTarget[key] = isNaN(+nextKey) ? {} : [];
5532
+ }
5533
+
5534
+ if (isUndefined(nextKey)) {
5535
+ if (isUndefined(value)) {
5536
+ delete currentTarget[key];
5537
+ } else {
5538
+ currentTarget[key] = value;
5539
+ }
5540
+ } else {
5541
+ currentTarget = nextTarget;
5542
+ }
5543
+ });
5544
+ return target;
5545
+ }
5546
+ /**
5547
+ * Gets a nested property of a given object.
5548
+ *
5549
+ * @param {Object} target The target of the get operation.
5550
+ * @param {(string|number)[]} path The path to the nested value.
5551
+ * @param {any} [defaultValue] The value to return if no value exists.
5552
+ */
5553
+
5554
+
5555
+ function get(target, path, defaultValue) {
5556
+ let currentTarget = target;
5557
+ forEach(path, function (key) {
5558
+ // accessing nil property yields <undefined>
5559
+ if (isNil(currentTarget)) {
5560
+ currentTarget = undefined;
5561
+ return false;
5562
+ }
5563
+
5564
+ currentTarget = currentTarget[key];
5565
+ });
5566
+ return isUndefined(currentTarget) ? defaultValue : currentTarget;
5567
+ }
5568
+
5510
5569
  var atoa$1 = function atoa(a, n) {
5511
5570
  return Array.prototype.slice.call(a, n);
5512
5571
  };
@@ -6644,6 +6703,196 @@
6644
6703
 
6645
6704
  var dragula_1 = dragula;
6646
6705
 
6706
+ function _mergeNamespaces(n, m) {
6707
+ m.forEach(function (e) {
6708
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
6709
+ if (k !== 'default' && !(k in n)) {
6710
+ var d = Object.getOwnPropertyDescriptor(e, k);
6711
+ Object.defineProperty(n, k, d.get ? d : {
6712
+ enumerable: true,
6713
+ get: function () {
6714
+ return e[k];
6715
+ }
6716
+ });
6717
+ }
6718
+ });
6719
+ });
6720
+ return Object.freeze(n);
6721
+ }
6722
+ /**
6723
+ * @param { HTMLElement } element
6724
+ * @param { String } selector
6725
+ *
6726
+ * @return { boolean }
6727
+ */
6728
+
6729
+
6730
+ function matches(element, selector) {
6731
+ return element && typeof element.matches === 'function' && element.matches(selector);
6732
+ }
6733
+ /**
6734
+ * Closest
6735
+ *
6736
+ * @param {Element} el
6737
+ * @param {String} selector
6738
+ * @param {Boolean} checkYourSelf (optional)
6739
+ */
6740
+
6741
+
6742
+ function closest(element, selector, checkYourSelf) {
6743
+ var currentElem = checkYourSelf ? element : element.parentNode;
6744
+
6745
+ while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE && currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
6746
+ if (matches(currentElem, selector)) {
6747
+ return currentElem;
6748
+ }
6749
+
6750
+ currentElem = currentElem.parentNode;
6751
+ }
6752
+
6753
+ return matches(currentElem, selector) ? currentElem : null;
6754
+ }
6755
+
6756
+ var componentEvent = {};
6757
+ var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
6758
+ unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
6759
+ prefix = bind$1 !== 'addEventListener' ? 'on' : '';
6760
+ /**
6761
+ * Bind `el` event `type` to `fn`.
6762
+ *
6763
+ * @param {Element} el
6764
+ * @param {String} type
6765
+ * @param {Function} fn
6766
+ * @param {Boolean} capture
6767
+ * @return {Function}
6768
+ * @api public
6769
+ */
6770
+
6771
+ var bind_1 = componentEvent.bind = function (el, type, fn, capture) {
6772
+ el[bind$1](prefix + type, fn, capture || false);
6773
+ return fn;
6774
+ };
6775
+ /**
6776
+ * Unbind `el` event `type`'s callback `fn`.
6777
+ *
6778
+ * @param {Element} el
6779
+ * @param {String} type
6780
+ * @param {Function} fn
6781
+ * @param {Boolean} capture
6782
+ * @return {Function}
6783
+ * @api public
6784
+ */
6785
+
6786
+
6787
+ var unbind_1 = componentEvent.unbind = function (el, type, fn, capture) {
6788
+ el[unbind$1](prefix + type, fn, capture || false);
6789
+ return fn;
6790
+ };
6791
+
6792
+ var event = /*#__PURE__*/_mergeNamespaces({
6793
+ __proto__: null,
6794
+ bind: bind_1,
6795
+ unbind: unbind_1,
6796
+ 'default': componentEvent
6797
+ }, [componentEvent]);
6798
+ /**
6799
+ * Expose `parse`.
6800
+ */
6801
+
6802
+ var domify = parse;
6803
+ /**
6804
+ * Tests for browser support.
6805
+ */
6806
+
6807
+ var innerHTMLBug = false;
6808
+ var bugTestDiv;
6809
+
6810
+ if (typeof document !== 'undefined') {
6811
+ bugTestDiv = document.createElement('div'); // Setup
6812
+
6813
+ bugTestDiv.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>'; // Make sure that link elements get serialized correctly by innerHTML
6814
+ // This requires a wrapper element in IE
6815
+
6816
+ innerHTMLBug = !bugTestDiv.getElementsByTagName('link').length;
6817
+ bugTestDiv = undefined;
6818
+ }
6819
+ /**
6820
+ * Wrap map from jquery.
6821
+ */
6822
+
6823
+
6824
+ var map = {
6825
+ legend: [1, '<fieldset>', '</fieldset>'],
6826
+ tr: [2, '<table><tbody>', '</tbody></table>'],
6827
+ col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
6828
+ // for script/link/style tags to work in IE6-8, you have to wrap
6829
+ // in a div with a non-whitespace character in front, ha!
6830
+ _default: innerHTMLBug ? [1, 'X<div>', '</div>'] : [0, '', '']
6831
+ };
6832
+ map.td = map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
6833
+ map.option = map.optgroup = [1, '<select multiple="multiple">', '</select>'];
6834
+ map.thead = map.tbody = map.colgroup = map.caption = map.tfoot = [1, '<table>', '</table>'];
6835
+ map.polyline = map.ellipse = map.polygon = map.circle = map.text = map.line = map.path = map.rect = map.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">', '</svg>'];
6836
+ /**
6837
+ * Parse `html` and return a DOM Node instance, which could be a TextNode,
6838
+ * HTML DOM Node of some kind (<div> for example), or a DocumentFragment
6839
+ * instance, depending on the contents of the `html` string.
6840
+ *
6841
+ * @param {String} html - HTML string to "domify"
6842
+ * @param {Document} doc - The `document` instance to create the Node for
6843
+ * @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance
6844
+ * @api private
6845
+ */
6846
+
6847
+ function parse(html, doc) {
6848
+ if ('string' != typeof html) throw new TypeError('String expected'); // default to the global `document` object
6849
+
6850
+ if (!doc) doc = document; // tag name
6851
+
6852
+ var m = /<([\w:]+)/.exec(html);
6853
+ if (!m) return doc.createTextNode(html);
6854
+ html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace
6855
+
6856
+ var tag = m[1]; // body support
6857
+
6858
+ if (tag == 'body') {
6859
+ var el = doc.createElement('html');
6860
+ el.innerHTML = html;
6861
+ return el.removeChild(el.lastChild);
6862
+ } // wrap map
6863
+
6864
+
6865
+ var wrap = Object.prototype.hasOwnProperty.call(map, tag) ? map[tag] : map._default;
6866
+ var depth = wrap[0];
6867
+ var prefix = wrap[1];
6868
+ var suffix = wrap[2];
6869
+ var el = doc.createElement('div');
6870
+ el.innerHTML = prefix + html + suffix;
6871
+
6872
+ while (depth--) el = el.lastChild; // one element
6873
+
6874
+
6875
+ if (el.firstChild == el.lastChild) {
6876
+ return el.removeChild(el.firstChild);
6877
+ } // several elements
6878
+
6879
+
6880
+ var fragment = doc.createDocumentFragment();
6881
+
6882
+ while (el.firstChild) {
6883
+ fragment.appendChild(el.removeChild(el.firstChild));
6884
+ }
6885
+
6886
+ return fragment;
6887
+ }
6888
+
6889
+ var domify$1 = domify;
6890
+
6891
+ function query(selector, el) {
6892
+ el = el || document;
6893
+ return el.querySelector(selector);
6894
+ }
6895
+
6647
6896
  var arrayMove$1 = {exports: {}};
6648
6897
 
6649
6898
  const arrayMoveMutate = (array, from, to) => {
@@ -6765,7 +7014,7 @@
6765
7014
  * @param {number} [priority=1000] the priority in which this listener is called, larger is higher
6766
7015
  * @param {Function} callback
6767
7016
  * @param {Object} [that] Pass context (`this`) to the callback
6768
- */EventBus.prototype.on=function(events,priority,callback,that){events=isArray$1(events)?events:[events];if(isFunction(priority)){that=callback;callback=priority;priority=DEFAULT_PRIORITY$2;}if(!isNumber(priority)){throw new Error('priority must be a number');}var actualCallback=callback;if(that){actualCallback=bind(callback,that);// make sure we remember and are able to remove
7017
+ */EventBus.prototype.on=function(events,priority,callback,that){events=isArray(events)?events:[events];if(isFunction(priority)){that=callback;callback=priority;priority=DEFAULT_PRIORITY$2;}if(!isNumber(priority)){throw new Error('priority must be a number');}var actualCallback=callback;if(that){actualCallback=bind(callback,that);// make sure we remember and are able to remove
6769
7018
  // bound callbacks via {@link #off} using the original
6770
7019
  // callback
6771
7020
  actualCallback[FN_REF]=callback[FN_REF]||callback;}var self=this;events.forEach(function(e){self._addListener(e,{priority:priority,callback:actualCallback,next:null});});};/**
@@ -6785,7 +7034,7 @@
6785
7034
  *
6786
7035
  * @param {string|Array<string>} events
6787
7036
  * @param {Function} [callback]
6788
- */EventBus.prototype.off=function(events,callback){events=isArray$1(events)?events:[events];var self=this;events.forEach(function(event){self._removeListener(event,callback);});};/**
7037
+ */EventBus.prototype.off=function(events,callback){events=isArray(events)?events:[events];var self=this;events.forEach(function(event){self._removeListener(event,callback);});};/**
6789
7038
  * Create an EventBus event.
6790
7039
  *
6791
7040
  * @param {Object} data
@@ -6960,7 +7209,7 @@
6960
7209
  * @param {Injector} injector
6961
7210
  */EditorActions.prototype._registerDefaultActions=function(injector){// (1) retrieve optional components to integrate with
6962
7211
  var commandStack=injector.get('commandStack',false);var modeling=injector.get('modeling',false);var selection=injector.get('selection',false);var zoomScroll=injector.get('zoomScroll',false);var copyPaste=injector.get('copyPaste',false);var canvas=injector.get('canvas',false);var rules=injector.get('rules',false);var keyboardMove=injector.get('keyboardMove',false);var keyboardMoveSelection=injector.get('keyboardMoveSelection',false);// (2) check components and register actions
6963
- if(commandStack){this.register('undo',function(){commandStack.undo();});this.register('redo',function(){commandStack.redo();});}if(copyPaste&&selection){this.register('copy',function(){var selectedElements=selection.get();copyPaste.copy(selectedElements);});}if(copyPaste){this.register('paste',function(){copyPaste.paste();});}if(zoomScroll){this.register('stepZoom',function(opts){zoomScroll.stepZoom(opts.value);});}if(canvas){this.register('zoom',function(opts){canvas.zoom(opts.value);});}if(modeling&&selection&&rules){this.register('removeSelection',function(){var selectedElements=selection.get();if(!selectedElements.length){return;}var allowed=rules.allowed('elements.delete',{elements:selectedElements}),removableElements;if(allowed===false){return;}else if(isArray$1(allowed)){removableElements=allowed;}else {removableElements=selectedElements;}if(removableElements.length){modeling.removeElements(removableElements.slice());}});}if(keyboardMove){this.register('moveCanvas',function(opts){keyboardMove.moveCanvas(opts);});}if(keyboardMoveSelection){this.register('moveSelection',function(opts){keyboardMoveSelection.moveSelection(opts.direction,opts.accelerated);});}};/**
7212
+ if(commandStack){this.register('undo',function(){commandStack.undo();});this.register('redo',function(){commandStack.redo();});}if(copyPaste&&selection){this.register('copy',function(){var selectedElements=selection.get();if(selectedElements.length){return copyPaste.copy(selectedElements);}});}if(copyPaste){this.register('paste',function(){copyPaste.paste();});}if(zoomScroll){this.register('stepZoom',function(opts){zoomScroll.stepZoom(opts.value);});}if(canvas){this.register('zoom',function(opts){canvas.zoom(opts.value);});}if(modeling&&selection&&rules){this.register('removeSelection',function(){var selectedElements=selection.get();if(!selectedElements.length){return;}var allowed=rules.allowed('elements.delete',{elements:selectedElements}),removableElements;if(allowed===false){return;}else if(isArray(allowed)){removableElements=allowed;}else {removableElements=selectedElements;}if(removableElements.length){modeling.removeElements(removableElements.slice());}});}if(keyboardMove){this.register('moveCanvas',function(opts){keyboardMove.moveCanvas(opts);});}if(keyboardMoveSelection){this.register('moveSelection',function(opts){keyboardMoveSelection.moveSelection(opts.direction,opts.accelerated);});}};/**
6964
7213
  * Triggers a registered action
6965
7214
  *
6966
7215
  * @param {string} action
@@ -7010,7 +7259,7 @@
7010
7259
  */EditorActions.prototype.isRegistered=function(action){return !!this._actions[action];};function error(action,message){return new Error(action+' '+message);}var EditorActionsModule$1={__init__:['editorActions'],editorActions:['type',EditorActions]};class FormEditorActions extends EditorActions{constructor(eventBus,injector){super(eventBus,injector);eventBus.on('form.init',()=>{this._registerDefaultActions(injector);eventBus.fire('editorActions.init',{editorActions:this});});}_registerDefaultActions(injector){const commandStack=injector.get('commandStack',false),formFieldRegistry=injector.get('formFieldRegistry',false),selection=injector.get('selection',false);if(commandStack){// @ts-ignore
7011
7260
  this.register('undo',()=>{commandStack.undo();});// @ts-ignore
7012
7261
  this.register('redo',()=>{commandStack.redo();});}if(formFieldRegistry&&selection){// @ts-ignore
7013
- this.register('selectFormField',(options={})=>{const{id}=options;if(!id){return;}const formField=formFieldRegistry.get(id);if(formField){selection.set(formField);}});}}}FormEditorActions.$inject=['eventBus','injector'];var EditorActionsModule={__depends__:[EditorActionsModule$1],editorActions:['type',FormEditorActions]};/**
7262
+ this.register('selectFormField',(options={})=>{const{id}=options;if(!id){return;}const formField=formFieldRegistry.get(id);if(formField){selection.set(formField);}});}}}FormEditorActions.$inject=['eventBus','injector'];var EditorActionsModule={__depends__:[EditorActionsModule$1],editorActions:['type',FormEditorActions]};var KEYCODE_C=67;var KEYCODE_V=86;var KEYCODE_Y$1=89;var KEYCODE_Z$1=90;var KEYS_COPY=['c','C',KEYCODE_C];var KEYS_PASTE=['v','V',KEYCODE_V];var KEYS_REDO$1=['y','Y',KEYCODE_Y$1];var KEYS_UNDO$1=['z','Z',KEYCODE_Z$1];/**
7014
7263
  * Returns true if event was triggered with any modifier
7015
7264
  * @param {KeyboardEvent} event
7016
7265
  */function hasModifier(event){return event.ctrlKey||event.metaKey||event.shiftKey||event.altKey;}/**
@@ -7022,9 +7271,9 @@
7022
7271
  *
7023
7272
  * @param {string|Array<string>} keys
7024
7273
  * @param {KeyboardEvent} event
7025
- */function isKey(keys,event){keys=isArray$1(keys)?keys:[keys];return keys.indexOf(event.key)!==-1||keys.indexOf(event.keyCode)!==-1;}/**
7274
+ */function isKey(keys,event){keys=isArray(keys)?keys:[keys];return keys.indexOf(event.key)!==-1||keys.indexOf(event.keyCode)!==-1;}/**
7026
7275
  * @param {KeyboardEvent} event
7027
- */function isShift(event){return event.shiftKey;}var KEYDOWN_EVENT='keyboard.keydown',KEYUP_EVENT='keyboard.keyup';var HANDLE_MODIFIER_ATTRIBUTE='input-handle-modified-keys';var DEFAULT_PRIORITY$1=1000;/**
7276
+ */function isShift(event){return event.shiftKey;}function isCopy(event){return isCmd(event)&&isKey(KEYS_COPY,event);}function isPaste(event){return isCmd(event)&&isKey(KEYS_PASTE,event);}function isUndo(event){return isCmd(event)&&!isShift(event)&&isKey(KEYS_UNDO$1,event);}function isRedo(event){return isCmd(event)&&(isKey(KEYS_REDO$1,event)||isKey(KEYS_UNDO$1,event)&&isShift(event));}var KEYDOWN_EVENT='keyboard.keydown',KEYUP_EVENT='keyboard.keyup';var HANDLE_MODIFIER_ATTRIBUTE='input-handle-modified-keys';var DEFAULT_PRIORITY$1=1000;/**
7028
7277
  * A keyboard abstraction that may be activated and
7029
7278
  * deactivated by users at will, consuming key events
7030
7279
  * and triggering diagram actions.
@@ -7048,10 +7297,10 @@
7048
7297
  * @param {Config} config
7049
7298
  * @param {EventBus} eventBus
7050
7299
  */function Keyboard(config,eventBus){var self=this;this._config=config||{};this._eventBus=eventBus;this._keydownHandler=this._keydownHandler.bind(this);this._keyupHandler=this._keyupHandler.bind(this);// properly clean dom registrations
7051
- eventBus.on('diagram.destroy',function(){self._fire('destroy');self.unbind();});eventBus.on('diagram.init',function(){self._fire('init');});eventBus.on('attach',function(){if(config&&config.bindTo){self.bind(config.bindTo);}});eventBus.on('detach',function(){self.unbind();});}Keyboard.$inject=['config.keyboard','eventBus'];Keyboard.prototype._keydownHandler=function(event){this._keyHandler(event,KEYDOWN_EVENT);};Keyboard.prototype._keyupHandler=function(event){this._keyHandler(event,KEYUP_EVENT);};Keyboard.prototype._keyHandler=function(event,type){var eventBusResult;if(this._isEventIgnored(event)){return;}var context={keyEvent:event};eventBusResult=this._eventBus.fire(type||KEYDOWN_EVENT,context);if(eventBusResult){event.preventDefault();}};Keyboard.prototype._isEventIgnored=function(event){return isInput(event.target)&&this._isModifiedKeyIgnored(event);};Keyboard.prototype._isModifiedKeyIgnored=function(event){if(!isCmd(event)){return true;}var allowedModifiers=this._getAllowedModifiers(event.target);return !allowedModifiers.includes(event.key);};Keyboard.prototype._getAllowedModifiers=function(element){var modifierContainer=closest(element,'['+HANDLE_MODIFIER_ATTRIBUTE+']',true);if(!modifierContainer||this._node&&!this._node.contains(modifierContainer)){return [];}return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');};Keyboard.prototype.bind=function(node){// make sure that the keyboard is only bound once to the DOM
7300
+ eventBus.on('diagram.destroy',function(){self._fire('destroy');self.unbind();});eventBus.on('diagram.init',function(){self._fire('init');});eventBus.on('attach',function(){if(config&&config.bindTo){self.bind(config.bindTo);}});eventBus.on('detach',function(){self.unbind();});}Keyboard.$inject=['config.keyboard','eventBus'];Keyboard.prototype._keydownHandler=function(event){this._keyHandler(event,KEYDOWN_EVENT);};Keyboard.prototype._keyupHandler=function(event){this._keyHandler(event,KEYUP_EVENT);};Keyboard.prototype._keyHandler=function(event,type){var eventBusResult;if(this._isEventIgnored(event)){return;}var context={keyEvent:event};eventBusResult=this._eventBus.fire(type||KEYDOWN_EVENT,context);if(eventBusResult){event.preventDefault();}};Keyboard.prototype._isEventIgnored=function(event){return isInput(event.target)&&this._isModifiedKeyIgnored(event);};Keyboard.prototype._isModifiedKeyIgnored=function(event){if(!isCmd(event)){return true;}var allowedModifiers=this._getAllowedModifiers(event.target);return allowedModifiers.indexOf(event.key)===-1;};Keyboard.prototype._getAllowedModifiers=function(element){var modifierContainer=closest(element,'['+HANDLE_MODIFIER_ATTRIBUTE+']',true);if(!modifierContainer||this._node&&!this._node.contains(modifierContainer)){return [];}return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');};Keyboard.prototype.bind=function(node){// make sure that the keyboard is only bound once to the DOM
7052
7301
  this.unbind();this._node=node;// bind key events
7053
- componentEvent.bind(node,'keydown',this._keydownHandler,true);componentEvent.bind(node,'keyup',this._keyupHandler,true);this._fire('bind');};Keyboard.prototype.getBinding=function(){return this._node;};Keyboard.prototype.unbind=function(){var node=this._node;if(node){this._fire('unbind');// unbind key events
7054
- componentEvent.unbind(node,'keydown',this._keydownHandler,true);componentEvent.unbind(node,'keyup',this._keyupHandler,true);}this._node=null;};Keyboard.prototype._fire=function(event){this._eventBus.fire('keyboard.'+event,{node:this._node});};/**
7302
+ event.bind(node,'keydown',this._keydownHandler,true);event.bind(node,'keyup',this._keyupHandler,true);this._fire('bind');};Keyboard.prototype.getBinding=function(){return this._node;};Keyboard.prototype.unbind=function(){var node=this._node;if(node){this._fire('unbind');// unbind key events
7303
+ event.unbind(node,'keydown',this._keydownHandler,true);event.unbind(node,'keyup',this._keyupHandler,true);}this._node=null;};Keyboard.prototype._fire=function(event){this._eventBus.fire('keyboard.'+event,{node:this._node});};/**
7055
7304
  * Add a listener function that is notified with `KeyboardEvent` whenever
7056
7305
  * the keyboard is bound and the user presses a key. If no priority is
7057
7306
  * provided, the default value of 1000 is used.
@@ -7060,7 +7309,7 @@
7060
7309
  * @param {Function} listener
7061
7310
  * @param {string} type
7062
7311
  */Keyboard.prototype.addListener=function(priority,listener,type){if(isFunction(priority)){type=listener;listener=priority;priority=DEFAULT_PRIORITY$1;}this._eventBus.on(type||KEYDOWN_EVENT,priority,listener);};Keyboard.prototype.removeListener=function(listener,type){this._eventBus.off(type||KEYDOWN_EVENT,listener);};Keyboard.prototype.hasModifier=hasModifier;Keyboard.prototype.isCmd=isCmd;Keyboard.prototype.isShift=isShift;Keyboard.prototype.isKey=isKey;// helpers ///////
7063
- function isInput(target){return target&&(matchesSelector(target,'input, textarea')||target.contentEditable==='true');}var LOW_PRIORITY$1=500;var KEYCODE_C=67;var KEYCODE_V=86;var KEYCODE_Y=89;var KEYCODE_Z=90;var KEYS_COPY=['c','C',KEYCODE_C];var KEYS_PASTE=['v','V',KEYCODE_V];var KEYS_REDO=['y','Y',KEYCODE_Y];var KEYS_UNDO=['z','Z',KEYCODE_Z];/**
7312
+ function isInput(target){return target&&(matches(target,'input, textarea')||target.contentEditable==='true');}var LOW_PRIORITY$1=500;var KEYCODE_Y=89;var KEYCODE_Z=90;var KEYS_REDO=['y','Y',KEYCODE_Y];var KEYS_UNDO=['z','Z',KEYCODE_Z];/**
7064
7313
  * Adds default keyboard bindings.
7065
7314
  *
7066
7315
  * This does not pull in any features will bind only actions that
@@ -7081,14 +7330,14 @@
7081
7330
  * @param {Function} fn that implements the key binding
7082
7331
  */function addListener(action,fn){if(editorActions.isRegistered(action)){keyboard.addListener(fn);}}// undo
7083
7332
  // (CTRL|CMD) + Z
7084
- addListener('undo',function(context){var event=context.keyEvent;if(isCmd(event)&&!isShift(event)&&isKey(KEYS_UNDO,event)){editorActions.trigger('undo');return true;}});// redo
7333
+ addListener('undo',function(context){var event=context.keyEvent;if(isUndo(event)){editorActions.trigger('undo');return true;}});// redo
7085
7334
  // CTRL + Y
7086
7335
  // CMD + SHIFT + Z
7087
- addListener('redo',function(context){var event=context.keyEvent;if(isCmd(event)&&(isKey(KEYS_REDO,event)||isKey(KEYS_UNDO,event)&&isShift(event))){editorActions.trigger('redo');return true;}});// copy
7336
+ addListener('redo',function(context){var event=context.keyEvent;if(isRedo(event)){editorActions.trigger('redo');return true;}});// copy
7088
7337
  // CTRL/CMD + C
7089
- addListener('copy',function(context){var event=context.keyEvent;if(isCmd(event)&&isKey(KEYS_COPY,event)){editorActions.trigger('copy');return true;}});// paste
7338
+ addListener('copy',function(context){var event=context.keyEvent;if(isCopy(event)){editorActions.trigger('copy');return true;}});// paste
7090
7339
  // CTRL/CMD + V
7091
- addListener('paste',function(context){var event=context.keyEvent;if(isCmd(event)&&isKey(KEYS_PASTE,event)){editorActions.trigger('paste');return true;}});// zoom in one step
7340
+ addListener('paste',function(context){var event=context.keyEvent;if(isPaste(event)){editorActions.trigger('paste');return true;}});// zoom in one step
7092
7341
  // CTRL/CMD + +
7093
7342
  addListener('stepZoom',function(context){var event=context.keyEvent;// quirk: it has to be triggered by `=` as well to work on international keyboard layout
7094
7343
  // cf: https://github.com/bpmn-io/bpmn-js/issues/1362#issuecomment-722989754
@@ -7158,7 +7407,7 @@
7158
7407
  *
7159
7408
  * @example
7160
7409
  *
7161
- * import inherits from 'inherits';
7410
+ * import inherits from 'inherits-browser';
7162
7411
  *
7163
7412
  * import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
7164
7413
  *
@@ -7182,7 +7431,7 @@
7182
7431
  * @param {boolean} unwrap if true, unwrap the event and pass (context, command, event) to the
7183
7432
  * listener instead
7184
7433
  * @param {Object} [that] Pass context (`this`) to the handler function
7185
- */CommandInterceptor.prototype.on=function(events,hook,priority,handlerFn,unwrap,that){if(isFunction(hook)||isNumber(hook)){that=unwrap;unwrap=handlerFn;handlerFn=priority;priority=hook;hook=null;}if(isFunction(priority)){that=unwrap;unwrap=handlerFn;handlerFn=priority;priority=DEFAULT_PRIORITY;}if(isObject(unwrap)){that=unwrap;unwrap=false;}if(!isFunction(handlerFn)){throw new Error('handlerFn must be a function');}if(!isArray$1(events)){events=[events];}var eventBus=this._eventBus;forEach(events,function(event){// concat commandStack(.event)?(.hook)?
7434
+ */CommandInterceptor.prototype.on=function(events,hook,priority,handlerFn,unwrap,that){if(isFunction(hook)||isNumber(hook)){that=unwrap;unwrap=handlerFn;handlerFn=priority;priority=hook;hook=null;}if(isFunction(priority)){that=unwrap;unwrap=handlerFn;handlerFn=priority;priority=DEFAULT_PRIORITY;}if(isObject(unwrap)){that=unwrap;unwrap=false;}if(!isFunction(handlerFn)){throw new Error('handlerFn must be a function');}if(!isArray(events)){events=[events];}var eventBus=this._eventBus;forEach(events,function(event){// concat commandStack(.event)?(.hook)?
7186
7435
  var fullEvent=['commandStack',event,hook].filter(function(e){return e;}).join('.');eventBus.on(fullEvent,priority,unwrap?unwrapEvent(handlerFn,that):handlerFn,that);});};var hooks=['canExecute','preExecute','preExecuted','execute','executed','postExecute','postExecuted','revert','reverted'];/*
7187
7436
  * Install hook shortcuts
7188
7437
  *
@@ -7302,7 +7551,7 @@
7302
7551
  *
7303
7552
  * @param {string} command the command to execute
7304
7553
  * @param {Object} context the environment to execute the command in
7305
- */CommandStack.prototype.execute=function(command,context){if(!command){throw new Error('command required');}this._currentExecution.trigger='execute';var action={command:command,context:context};this._pushAction(action);this._internalExecute(action);this._popAction(action);};/**
7554
+ */CommandStack.prototype.execute=function(command,context){if(!command){throw new Error('command required');}this._currentExecution.trigger='execute';const action={command:command,context:context};this._pushAction(action);this._internalExecute(action);this._popAction(action);};/**
7306
7555
  * Ask whether a given command can be executed.
7307
7556
  *
7308
7557
  * Implementors may hook into the mechanism on two ways:
@@ -7321,15 +7570,15 @@
7321
7570
  * @param {Object} context the environment to execute the command in
7322
7571
  *
7323
7572
  * @return {boolean} true if the command can be executed
7324
- */CommandStack.prototype.canExecute=function(command,context){var action={command:command,context:context};var handler=this._getHandler(command);var result=this._fire(command,'canExecute',action);// handler#canExecute will only be called if no listener
7573
+ */CommandStack.prototype.canExecute=function(command,context){const action={command:command,context:context};const handler=this._getHandler(command);let result=this._fire(command,'canExecute',action);// handler#canExecute will only be called if no listener
7325
7574
  // decided on a result already
7326
7575
  if(result===undefined){if(!handler){return false;}if(handler.canExecute){result=handler.canExecute(context);}}return result;};/**
7327
7576
  * Clear the command stack, erasing all undo / redo history
7328
7577
  */CommandStack.prototype.clear=function(emit){this._stack.length=0;this._stackIdx=-1;if(emit!==false){this._fire('changed',{trigger:'clear'});}};/**
7329
7578
  * Undo last command(s)
7330
- */CommandStack.prototype.undo=function(){var action=this._getUndoAction(),next;if(action){this._currentExecution.trigger='undo';this._pushAction(action);while(action){this._internalUndo(action);next=this._getUndoAction();if(!next||next.id!==action.id){break;}action=next;}this._popAction();}};/**
7579
+ */CommandStack.prototype.undo=function(){let action=this._getUndoAction(),next;if(action){this._currentExecution.trigger='undo';this._pushAction(action);while(action){this._internalUndo(action);next=this._getUndoAction();if(!next||next.id!==action.id){break;}action=next;}this._popAction();}};/**
7331
7580
  * Redo last command(s)
7332
- */CommandStack.prototype.redo=function(){var action=this._getRedoAction(),next;if(action){this._currentExecution.trigger='redo';this._pushAction(action);while(action){this._internalExecute(action,true);next=this._getRedoAction();if(!next||next.id!==action.id){break;}action=next;}this._popAction();}};/**
7581
+ */CommandStack.prototype.redo=function(){let action=this._getRedoAction(),next;if(action){this._currentExecution.trigger='redo';this._pushAction(action);while(action){this._internalExecute(action,true);next=this._getRedoAction();if(!next||next.id!==action.id){break;}action=next;}this._popAction();}};/**
7333
7582
  * Register a handler instance with the command stack
7334
7583
  *
7335
7584
  * @param {string} command
@@ -7340,13 +7589,13 @@
7340
7589
  *
7341
7590
  * @param {string} command
7342
7591
  * @param {Function} a constructor for a {@link CommandHandler}
7343
- */CommandStack.prototype.registerHandler=function(command,handlerCls){if(!command||!handlerCls){throw new Error('command and handlerCls must be defined');}var handler=this._injector.instantiate(handlerCls);this.register(command,handler);};CommandStack.prototype.canUndo=function(){return !!this._getUndoAction();};CommandStack.prototype.canRedo=function(){return !!this._getRedoAction();};// stack access //////////////////////
7592
+ */CommandStack.prototype.registerHandler=function(command,handlerCls){if(!command||!handlerCls){throw new Error('command and handlerCls must be defined');}const handler=this._injector.instantiate(handlerCls);this.register(command,handler);};CommandStack.prototype.canUndo=function(){return !!this._getUndoAction();};CommandStack.prototype.canRedo=function(){return !!this._getRedoAction();};// stack access //////////////////////
7344
7593
  CommandStack.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1];};CommandStack.prototype._getUndoAction=function(){return this._stack[this._stackIdx];};// internal functionality //////////////////////
7345
- CommandStack.prototype._internalUndo=function(action){var self=this;var command=action.command,context=action.context;var handler=this._getHandler(command);// guard against illegal nested command stack invocations
7346
- this._atomicDo(function(){self._fire(command,'revert',action);if(handler.revert){self._markDirty(handler.revert(context));}self._revertedAction(action);self._fire(command,'reverted',action);});};CommandStack.prototype._fire=function(command,qualifier,event){if(arguments.length<3){event=qualifier;qualifier=null;}var names=qualifier?[command+'.'+qualifier,qualifier]:[command],i,name,result;event=this._eventBus.createEvent(event);for(i=0;name=names[i];i++){result=this._eventBus.fire('commandStack.'+name,event);if(event.cancelBubble){break;}}return result;};CommandStack.prototype._createId=function(){return this._uid++;};CommandStack.prototype._atomicDo=function(fn){var execution=this._currentExecution;execution.atomic=true;try{fn();}finally{execution.atomic=false;}};CommandStack.prototype._internalExecute=function(action,redo){var self=this;var command=action.command,context=action.context;var handler=this._getHandler(command);if(!handler){throw new Error('no command handler registered for <'+command+'>');}this._pushAction(action);if(!redo){this._fire(command,'preExecute',action);if(handler.preExecute){handler.preExecute(context);}this._fire(command,'preExecuted',action);}// guard against illegal nested command stack invocations
7347
- this._atomicDo(function(){self._fire(command,'execute',action);if(handler.execute){// actual execute + mark return results as dirty
7348
- self._markDirty(handler.execute(context));}// log to stack
7349
- self._executedAction(action,redo);self._fire(command,'executed',action);});if(!redo){this._fire(command,'postExecute',action);if(handler.postExecute){handler.postExecute(context);}this._fire(command,'postExecuted',action);}this._popAction(action);};CommandStack.prototype._pushAction=function(action){var execution=this._currentExecution,actions=execution.actions;var baseAction=actions[0];if(execution.atomic){throw new Error('illegal invocation in <execute> or <revert> phase (action: '+action.command+')');}if(!action.id){action.id=baseAction&&baseAction.id||this._createId();}actions.push(action);};CommandStack.prototype._popAction=function(){var execution=this._currentExecution,trigger=execution.trigger,actions=execution.actions,dirty=execution.dirty;actions.pop();if(!actions.length){this._eventBus.fire('elements.changed',{elements:uniqueBy('id',dirty.reverse())});dirty.length=0;this._fire('changed',{trigger:trigger});execution.trigger=null;}};CommandStack.prototype._markDirty=function(elements){var execution=this._currentExecution;if(!elements){return;}elements=isArray$1(elements)?elements:[elements];execution.dirty=execution.dirty.concat(elements);};CommandStack.prototype._executedAction=function(action,redo){var stackIdx=++this._stackIdx;if(!redo){this._stack.splice(stackIdx,this._stack.length,action);}};CommandStack.prototype._revertedAction=function(action){this._stackIdx--;};CommandStack.prototype._getHandler=function(command){return this._handlerMap[command];};CommandStack.prototype._setHandler=function(command,handler){if(!command||!handler){throw new Error('command and handler required');}if(this._handlerMap[command]){throw new Error('overriding handler for command <'+command+'>');}this._handlerMap[command]=handler;};var commandModule={commandStack:['type',CommandStack]};var ModelingModule={__depends__:[behaviorModule,commandModule],__init__:['modeling'],modeling:['type',Modeling]};class Selection{constructor(eventBus){this._eventBus=eventBus;this._selection=null;}get(){return this._selection;}set(selection){if(this._selection===selection){return;}this._selection=selection;this._eventBus.fire('selection.changed',{selection:this._selection});}toggle(selection){const newSelection=this._selection===selection?null:selection;this.set(newSelection);}clear(){this.set(null);}isSelected(formField){return this._selection===formField;}}Selection.$inject=['eventBus'];class SelectionBehavior{constructor(eventBus,selection){eventBus.on(['commandStack.formField.add.postExecuted','commandStack.formField.move.postExecuted'],({context})=>{const{formField}=context;selection.set(formField);});eventBus.on('commandStack.formField.remove.postExecuted',({context})=>{const{sourceFormField,sourceIndex}=context;const formField=sourceFormField.components[sourceIndex]||sourceFormField.components[sourceIndex-1];if(formField){selection.set(formField);}else {selection.clear();}});eventBus.on('formField.remove',({formField})=>{if(selection.isSelected(formField)){selection.clear();}});}}SelectionBehavior.$inject=['eventBus','selection'];var SelectionModule={__init__:['selection','selectionBehavior'],selection:['type',Selection],selectionBehavior:['type',SelectionBehavior]};const types$1=[{label:'Text Field',type:'textfield'},{label:'Number',type:'number'},{label:'Checkbox',type:'checkbox'},{label:'Checklist',type:'checklist'},{label:'Taglist',type:'taglist'},{label:'Radio',type:'radio'},{label:'Select',type:'select'},{label:'Text',type:'text'},{label:'Button',type:'button'}];function Palette(props){return e$1("div",{class:"fjs-palette",children:[e$1("div",{class:"fjs-palette-header",title:"Form elements library",children:[e$1("span",{class:"fjs-hide-compact",children:"FORM ELEMENTS "}),"LIBRARY"]}),e$1("div",{class:"fjs-palette-fields fjs-drag-container fjs-no-drop",children:types$1.map(({label,type})=>{const Icon=iconsByType[type];return e$1("div",{class:"fjs-palette-field fjs-drag-copy fjs-no-drop","data-field-type":type,title:`Create a ${label} element`,children:[Icon?e$1(Icon,{class:"fjs-palette-field-icon",width:"36",height:"36",viewBox:"0 0 54 54"}):null,e$1("span",{class:"fjs-palette-field-text",children:label})]});})})]});}class PaletteRenderer{constructor(paletteConfig,eventBus){const{parent}=paletteConfig||{};this._eventBus=eventBus;this._container=domify('<div class="fjs-palette-container"></div>');if(parent){this.attachTo(parent);}this._eventBus.once('formEditor.rendered',500,()=>{this._render();});}/**
7594
+ CommandStack.prototype._internalUndo=function(action){const command=action.command,context=action.context;const handler=this._getHandler(command);// guard against illegal nested command stack invocations
7595
+ this._atomicDo(()=>{this._fire(command,'revert',action);if(handler.revert){this._markDirty(handler.revert(context));}this._revertedAction(action);this._fire(command,'reverted',action);});};CommandStack.prototype._fire=function(command,qualifier,event){if(arguments.length<3){event=qualifier;qualifier=null;}const names=qualifier?[command+'.'+qualifier,qualifier]:[command];let result;event=this._eventBus.createEvent(event);for(const name of names){result=this._eventBus.fire('commandStack.'+name,event);if(event.cancelBubble){break;}}return result;};CommandStack.prototype._createId=function(){return this._uid++;};CommandStack.prototype._atomicDo=function(fn){const execution=this._currentExecution;execution.atomic=true;try{fn();}finally{execution.atomic=false;}};CommandStack.prototype._internalExecute=function(action,redo){const command=action.command,context=action.context;const handler=this._getHandler(command);if(!handler){throw new Error('no command handler registered for <'+command+'>');}this._pushAction(action);if(!redo){this._fire(command,'preExecute',action);if(handler.preExecute){handler.preExecute(context);}this._fire(command,'preExecuted',action);}// guard against illegal nested command stack invocations
7596
+ this._atomicDo(()=>{this._fire(command,'execute',action);if(handler.execute){// actual execute + mark return results as dirty
7597
+ this._markDirty(handler.execute(context));}// log to stack
7598
+ this._executedAction(action,redo);this._fire(command,'executed',action);});if(!redo){this._fire(command,'postExecute',action);if(handler.postExecute){handler.postExecute(context);}this._fire(command,'postExecuted',action);}this._popAction(action);};CommandStack.prototype._pushAction=function(action){const execution=this._currentExecution,actions=execution.actions;const baseAction=actions[0];if(execution.atomic){throw new Error('illegal invocation in <execute> or <revert> phase (action: '+action.command+')');}if(!action.id){action.id=baseAction&&baseAction.id||this._createId();}actions.push(action);};CommandStack.prototype._popAction=function(){const execution=this._currentExecution,trigger=execution.trigger,actions=execution.actions,dirty=execution.dirty;actions.pop();if(!actions.length){this._eventBus.fire('elements.changed',{elements:uniqueBy('id',dirty.reverse())});dirty.length=0;this._fire('changed',{trigger:trigger});execution.trigger=null;}};CommandStack.prototype._markDirty=function(elements){const execution=this._currentExecution;if(!elements){return;}elements=isArray(elements)?elements:[elements];execution.dirty=execution.dirty.concat(elements);};CommandStack.prototype._executedAction=function(action,redo){const stackIdx=++this._stackIdx;if(!redo){this._stack.splice(stackIdx,this._stack.length,action);}};CommandStack.prototype._revertedAction=function(action){this._stackIdx--;};CommandStack.prototype._getHandler=function(command){return this._handlerMap[command];};CommandStack.prototype._setHandler=function(command,handler){if(!command||!handler){throw new Error('command and handler required');}if(this._handlerMap[command]){throw new Error('overriding handler for command <'+command+'>');}this._handlerMap[command]=handler;};var commandModule={commandStack:['type',CommandStack]};var ModelingModule={__depends__:[behaviorModule,commandModule],__init__:['modeling'],modeling:['type',Modeling]};class Selection{constructor(eventBus){this._eventBus=eventBus;this._selection=null;}get(){return this._selection;}set(selection){if(this._selection===selection){return;}this._selection=selection;this._eventBus.fire('selection.changed',{selection:this._selection});}toggle(selection){const newSelection=this._selection===selection?null:selection;this.set(newSelection);}clear(){this.set(null);}isSelected(formField){return this._selection===formField;}}Selection.$inject=['eventBus'];class SelectionBehavior{constructor(eventBus,selection){eventBus.on(['commandStack.formField.add.postExecuted','commandStack.formField.move.postExecuted'],({context})=>{const{formField}=context;selection.set(formField);});eventBus.on('commandStack.formField.remove.postExecuted',({context})=>{const{sourceFormField,sourceIndex}=context;const formField=sourceFormField.components[sourceIndex]||sourceFormField.components[sourceIndex-1];if(formField){selection.set(formField);}else {selection.clear();}});eventBus.on('formField.remove',({formField})=>{if(selection.isSelected(formField)){selection.clear();}});}}SelectionBehavior.$inject=['eventBus','selection'];var SelectionModule={__init__:['selection','selectionBehavior'],selection:['type',Selection],selectionBehavior:['type',SelectionBehavior]};const types$1=[{label:'Text Field',type:'textfield'},{label:'Number',type:'number'},{label:'Checkbox',type:'checkbox'},{label:'Checklist',type:'checklist'},{label:'Taglist',type:'taglist'},{label:'Radio',type:'radio'},{label:'Select',type:'select'},{label:'Text',type:'text'},{label:'Button',type:'button'}];function Palette(props){return e$1("div",{class:"fjs-palette",children:[e$1("div",{class:"fjs-palette-header",title:"Form elements library",children:[e$1("span",{class:"fjs-hide-compact",children:"FORM ELEMENTS "}),"LIBRARY"]}),e$1("div",{class:"fjs-palette-fields fjs-drag-container fjs-no-drop",children:types$1.map(({label,type})=>{const Icon=iconsByType[type];return e$1("div",{class:"fjs-palette-field fjs-drag-copy fjs-no-drop","data-field-type":type,title:`Create a ${label} element`,children:[Icon?e$1(Icon,{class:"fjs-palette-field-icon",width:"36",height:"36",viewBox:"0 0 54 54"}):null,e$1("span",{class:"fjs-palette-field-text",children:label})]});})})]});}class PaletteRenderer{constructor(paletteConfig,eventBus){const{parent}=paletteConfig||{};this._eventBus=eventBus;this._container=domify$1('<div class="fjs-palette-container"></div>');if(parent){this.attachTo(parent);}this._eventBus.once('formEditor.rendered',500,()=>{this._render();});}/**
7350
7599
  * Attach the palette to a parent node.
7351
7600
  *
7352
7601
  * @param {HTMLElement} container
@@ -7521,7 +7770,7 @@
7521
7770
  const[layout,setLayout]=l$1(createLayout(layoutConfig));y(()=>{if(typeof layoutChanged==='function'){layoutChanged(layout);}},[layout,layoutChanged]);const getLayoutForKey=(key,defaultValue)=>{return get(layout,key,defaultValue);};const setLayoutForKey=(key,config)=>{const newLayout=assign({},layout);set(newLayout,key,config);setLayout(newLayout);};const layoutContext={layout,setLayout,getLayoutForKey,setLayoutForKey};// set-up description context
7522
7771
  const description=createDescriptionContext(descriptionConfig);if(typeof descriptionLoaded==='function'){descriptionLoaded(description);}const getDescriptionForId=(id,element)=>{return description[id]&&description[id](element);};const descriptionContext={description,getDescriptionForId};const[errors,setErrors]=l$1({});const onSetErrors=({errors})=>setErrors(errors);useEvent('propertiesPanel.setErrors',onSetErrors,eventBus);const errorsContext={errors};const eventContext={eventBus};const propertiesPanelContext={element};// empty state
7523
7772
  if(placeholderProvider&&!element){return e$1(Placeholder,{...placeholderProvider.getEmpty()});}// multiple state
7524
- if(placeholderProvider&&isArray$1(element)){return e$1(Placeholder,{...placeholderProvider.getMultiple()});}return e$1(LayoutContext.Provider,{value:propertiesPanelContext,children:e$1(ErrorsContext.Provider,{value:errorsContext,children:e$1(DescriptionContext.Provider,{value:descriptionContext,children:e$1(LayoutContext.Provider,{value:layoutContext,children:e$1(EventContext.Provider,{value:eventContext,children:e$1("div",{class:classNames('bio-properties-panel',layout.open?'open':''),children:[e$1(Header,{element:element,headerProvider:headerProvider}),e$1("div",{class:"bio-properties-panel-scroll-container",children:groups.map(group=>{const{component:Component=Group,id}=group;return v$1(Component,{...group,key:id,element:element});})})]})})})})})});}// helpers //////////////////
7773
+ if(placeholderProvider&&isArray(element)){return e$1(Placeholder,{...placeholderProvider.getMultiple()});}return e$1(LayoutContext.Provider,{value:propertiesPanelContext,children:e$1(ErrorsContext.Provider,{value:errorsContext,children:e$1(DescriptionContext.Provider,{value:descriptionContext,children:e$1(LayoutContext.Provider,{value:layoutContext,children:e$1(EventContext.Provider,{value:eventContext,children:e$1("div",{class:classNames('bio-properties-panel',layout.open?'open':''),children:[e$1(Header,{element:element,headerProvider:headerProvider}),e$1("div",{class:"bio-properties-panel-scroll-container",children:groups.map(group=>{const{component:Component=Group,id}=group;return v$1(Component,{...group,key:id,element:element});})})]})})})})})});}// helpers //////////////////
7525
7774
  function createLayout(overrides){return {...DEFAULT_LAYOUT,...overrides};}function createDescriptionContext(overrides){return {...DEFAULT_DESCRIPTION,...overrides};}function CollapsibleEntry(props){const{element,entries=[],id,label,open:shouldOpen,remove}=props;const[open,setOpen]=l$1(shouldOpen);const toggleOpen=()=>setOpen(!open);const{onShow}=F$1(LayoutContext);const propertiesPanelContext={...F$1(LayoutContext),onShow:A$1(()=>{setOpen(true);if(isFunction(onShow)){onShow();}},[onShow,setOpen])};// todo(pinussilvestrus): translate once we have a translate mechanism for the core
7526
7775
  const placeholderLabel='<empty>';return e$1("div",{"data-entry-id":id,class:classNames('bio-properties-panel-collapsible-entry',open?'open':''),children:[e$1("div",{class:"bio-properties-panel-collapsible-entry-header",onClick:toggleOpen,children:[e$1("div",{title:label||placeholderLabel,class:classNames('bio-properties-panel-collapsible-entry-header-title',!label&&'empty'),children:label||placeholderLabel}),e$1("button",{title:"Toggle list item",class:"bio-properties-panel-arrow bio-properties-panel-collapsible-entry-arrow",children:e$1(ArrowIcon,{class:open?'bio-properties-panel-arrow-down':'bio-properties-panel-arrow-right'})}),remove?e$1("button",{title:"Delete item",class:"bio-properties-panel-remove-entry",onClick:remove,children:e$1(DeleteIcon,{})}):null]}),e$1("div",{class:classNames('bio-properties-panel-collapsible-entry-entries',open?'open':''),children:e$1(LayoutContext.Provider,{value:propertiesPanelContext,children:entries.map(entry=>{const{component:Component,id}=entry;return v$1(Component,{...entry,element:element,key:id});})})})]});}function ListItem(props){const{autoFocusEntry,autoOpen}=props;// focus specified entry on auto open
7527
7776
  y(()=>{if(autoOpen&&autoFocusEntry){const entry=query(`[data-entry-id="${autoFocusEntry}"]`);const focusableInput=query('.bio-properties-panel-input',entry);if(focusableInput){if(isFunction(focusableInput.select)){focusableInput.select();}else if(isFunction(focusableInput.focus)){focusableInput.focus();}}}},[autoOpen,autoFocusEntry]);return e$1("div",{class:"bio-properties-panel-list-item",children:e$1(CollapsibleEntry,{...props,open:autoOpen})});}const noop$2=()=>{};/**
@@ -11250,7 +11499,8 @@ meta: meta$1,/// [Metadata](#highlight.tags.meta) that applies to the entire
11250
11499
  * @returns {Object}
11251
11500
  */function updateKey(properties,oldKey,newKey){return Object.entries(properties).reduce((newProperties,entry)=>{const[key,value]=entry;return {...newProperties,[key===oldKey?newKey:key]:value};},{});}const VALUES_SOURCES={STATIC:'static',INPUT:'input'};const VALUES_SOURCE_DEFAULT=VALUES_SOURCES.STATIC;const VALUES_SOURCES_LABELS={[VALUES_SOURCES.STATIC]:'Static',[VALUES_SOURCES.INPUT]:'Input data'};const VALUES_SOURCES_PATHS={[VALUES_SOURCES.STATIC]:['values'],[VALUES_SOURCES.INPUT]:['valuesKey']};const VALUES_SOURCES_DEFAULTS={[VALUES_SOURCES.STATIC]:[],[VALUES_SOURCES.INPUT]:''};// helpers ///////////////////
11252
11501
  function getValuesSource(field){for(const source of Object.values(VALUES_SOURCES)){if(get(field,VALUES_SOURCES_PATHS[source])!==undefined){return source;}}return VALUES_SOURCE_DEFAULT;}function ValuesSourceSelectEntry(props){const{editField,field,id}=props;return [{id:id+'-select',component:ValuesSourceSelect,isEdited:isEdited$4,editField,field}];}function ValuesSourceSelect(props){const{editField,field,id}=props;const getValue=getValuesSource;const setValue=value=>{let newField=field;const newProperties={};Object.values(VALUES_SOURCES).forEach(source=>{// Clear all values source definitions and default the newly selected one
11253
- const newValue=value===source?VALUES_SOURCES_DEFAULTS[source]:undefined;newProperties[VALUES_SOURCES_PATHS[source]]=newValue;});newField=editField(field,newProperties);return newField;};const getValuesSourceOptions=()=>{return Object.values(VALUES_SOURCES).map(valueSource=>({label:VALUES_SOURCES_LABELS[valueSource],value:valueSource}));};return SelectEntry({label:'Type',element:field,getOptions:getValuesSourceOptions,getValue,id,setValue});}function InputKeyValuesSourceEntry(props){const{editField,field,id}=props;return [{id:id+'-key',component:InputValuesKey,label:'Input values key',description:'Define which input property to populate the values from',isEdited:isEdited$1,editField,field}];}function InputValuesKey(props){const{editField,field,id,label,description}=props;const debounce=useService('debounce');const path=VALUES_SOURCES_PATHS[VALUES_SOURCES.INPUT];const getValue=()=>get(field,path,'');const setValue=value=>editField(field,path,value||'');return TextfieldEntry({debounce,description,element:field,getValue,id,label,setValue});}function StaticValuesSourceEntry(props){const{editField,field,id:idPrefix}=props;const{values}=field;const addEntry=e=>{e.stopPropagation();const index=values.length+1;const entry={label:`Value ${index}`,value:`value${index}`};editField(field,VALUES_SOURCES_PATHS[VALUES_SOURCES.STATIC],arrayAdd(values,values.length,entry));};const removeEntry=entry=>{editField(field,VALUES_SOURCES_PATHS[VALUES_SOURCES.STATIC],without(values,entry));};const validateFactory=key=>{return value=>{if(value===key){return;}if(isUndefined(value)||!value.length){return 'Must not be empty.';}const isValueAssigned=values.find(entry=>entry.value===value);if(isValueAssigned){return 'Must be unique.';}};};const items=values.map((entry,index)=>{const id=idPrefix+'-'+index;return {id,label:entry.label,entries:ValueEntry({editField,field,idPrefix:id,index,validateFactory}),autoFocusEntry:id+'-label',remove:()=>removeEntry(entry)};});return {items,add:addEntry,shouldSort:false};}function GeneralGroup(field,editField){const entries=[...IdEntry({field,editField}),...LabelEntry({field,editField}),...DescriptionEntry({field,editField}),...KeyEntry({field,editField}),...DefaultOptionEntry({field,editField}),...ActionEntry({field,editField}),...ColumnsEntry({field,editField}),...TextEntry({field,editField}),...DisabledEntry({field,editField})];return {id:'general',label:'General',entries};}function ValidationGroup(field,editField){const{type}=field;if(!(INPUTS.includes(type)&&type!=='checkbox'&&type!=='checklist'&&type!=='taglist')){return null;}const onChange=key=>{return value=>{const validate=get(field,['validate'],{});editField(field,['validate'],set(validate,[key],value));};};const getValue=key=>{return ()=>{return get(field,['validate',key]);};};let entries=[{id:'required',component:Required,getValue,field,isEdited:isEdited$7,onChange}];if(type==='textfield'){entries.push({id:'minLength',component:MinLength,getValue,field,isEdited:isEdited$5,onChange},{id:'maxLength',component:MaxLength,getValue,field,isEdited:isEdited$5,onChange},{id:'pattern',component:Pattern,getValue,field,isEdited:isEdited$1,onChange});}if(type==='number'){entries.push({id:'min',component:Min,getValue,field,isEdited:isEdited$5,onChange},{id:'max',component:Max,getValue,field,isEdited:isEdited$5,onChange});}return {id:'validation',label:'Validation',entries};}function Required(props){const{field,getValue,id,onChange}=props;return CheckboxEntry({element:field,getValue:getValue('required'),id,label:'Required',setValue:onChange('required')});}function MinLength(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('minLength'),id,label:'Minimum length',min:0,setValue:onChange('minLength')});}function MaxLength(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('maxLength'),id,label:'Maximum length',min:0,setValue:onChange('maxLength')});}function Pattern(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return TextfieldEntry({debounce,element:field,getValue:getValue('pattern'),id,label:'Regular expression pattern',setValue:onChange('pattern')});}function Min(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('min'),id,label:'Minimum',min:0,setValue:onChange('min')});}function Max(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('max'),id,label:'Maximum',min:0,setValue:onChange('max')});}function ValuesGroups(field,editField){const{type,id:fieldId}=field;if(!VALUES_INPUTS.includes(type)){return [];}const context={editField,field};const valuesSourceId=`${fieldId}-valuesSource`;/**
11502
+ const newValue=value===source?VALUES_SOURCES_DEFAULTS[source]:undefined;newProperties[VALUES_SOURCES_PATHS[source]]=newValue;});newField=editField(field,newProperties);return newField;};const getValuesSourceOptions=()=>{return Object.values(VALUES_SOURCES).map(valueSource=>({label:VALUES_SOURCES_LABELS[valueSource],value:valueSource}));};return SelectEntry({label:'Type',element:field,getOptions:getValuesSourceOptions,getValue,id,setValue});}function InputKeyValuesSourceEntry(props){const{editField,field,id}=props;return [{id:id+'-key',component:InputValuesKey,label:'Input values key',description:'Define which input property to populate the values from',isEdited:isEdited$1,editField,field}];}function InputValuesKey(props){const{editField,field,id,label,description}=props;const debounce=useService('debounce');const path=VALUES_SOURCES_PATHS[VALUES_SOURCES.INPUT];const getValue=()=>get(field,path,'');const setValue=value=>editField(field,path,value||'');return TextfieldEntry({debounce,description,element:field,getValue,id,label,setValue});}function StaticValuesSourceEntry(props){const{editField,field,id:idPrefix}=props;const{values}=field;const addEntry=e=>{e.stopPropagation();const index=values.length+1;const entry=getIndexedEntry(index);editField(field,VALUES_SOURCES_PATHS[VALUES_SOURCES.STATIC],arrayAdd(values,values.length,entry));};const removeEntry=entry=>{editField(field,VALUES_SOURCES_PATHS[VALUES_SOURCES.STATIC],without(values,entry));};const validateFactory=key=>{return value=>{if(value===key){return;}if(isUndefined(value)||!value.length){return 'Must not be empty.';}const isValueAssigned=values.find(entry=>entry.value===value);if(isValueAssigned){return 'Must be unique.';}};};const items=values.map((entry,index)=>{const id=idPrefix+'-'+index;return {id,label:entry.label,entries:ValueEntry({editField,field,idPrefix:id,index,validateFactory}),autoFocusEntry:id+'-label',remove:()=>removeEntry(entry)};});return {items,add:addEntry,shouldSort:false};}// helper
11503
+ function getIndexedEntry(index){const entry={label:'Value',value:'value'};if(index>1){entry.label+=` ${index}`;entry.value+=`${index}`;}return entry;}function GeneralGroup(field,editField){const entries=[...IdEntry({field,editField}),...LabelEntry({field,editField}),...DescriptionEntry({field,editField}),...KeyEntry({field,editField}),...DefaultOptionEntry({field,editField}),...ActionEntry({field,editField}),...ColumnsEntry({field,editField}),...TextEntry({field,editField}),...DisabledEntry({field,editField})];return {id:'general',label:'General',entries};}function ValidationGroup(field,editField){const{type}=field;if(!(INPUTS.includes(type)&&type!=='checkbox'&&type!=='checklist'&&type!=='taglist')){return null;}const onChange=key=>{return value=>{const validate=get(field,['validate'],{});editField(field,['validate'],set(validate,[key],value));};};const getValue=key=>{return ()=>{return get(field,['validate',key]);};};let entries=[{id:'required',component:Required,getValue,field,isEdited:isEdited$7,onChange}];if(type==='textfield'){entries.push({id:'minLength',component:MinLength,getValue,field,isEdited:isEdited$5,onChange},{id:'maxLength',component:MaxLength,getValue,field,isEdited:isEdited$5,onChange},{id:'pattern',component:Pattern,getValue,field,isEdited:isEdited$1,onChange});}if(type==='number'){entries.push({id:'min',component:Min,getValue,field,isEdited:isEdited$5,onChange},{id:'max',component:Max,getValue,field,isEdited:isEdited$5,onChange});}return {id:'validation',label:'Validation',entries};}function Required(props){const{field,getValue,id,onChange}=props;return CheckboxEntry({element:field,getValue:getValue('required'),id,label:'Required',setValue:onChange('required')});}function MinLength(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('minLength'),id,label:'Minimum length',min:0,setValue:onChange('minLength')});}function MaxLength(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('maxLength'),id,label:'Maximum length',min:0,setValue:onChange('maxLength')});}function Pattern(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return TextfieldEntry({debounce,element:field,getValue:getValue('pattern'),id,label:'Regular expression pattern',setValue:onChange('pattern')});}function Min(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('min'),id,label:'Minimum',min:0,setValue:onChange('min')});}function Max(props){const{field,getValue,id,onChange}=props;const debounce=useService('debounce');return NumberFieldEntry({debounce,element:field,getValue:getValue('max'),id,label:'Maximum',min:0,setValue:onChange('max')});}function ValuesGroups(field,editField){const{type,id:fieldId}=field;if(!VALUES_INPUTS.includes(type)){return [];}const context={editField,field};const valuesSourceId=`${fieldId}-valuesSource`;/**
11254
11504
  * @type {Array<Group|ListGroup>}
11255
11505
  */const groups=[{id:valuesSourceId,label:'Options source',component:Group,entries:ValuesSourceSelectEntry({...context,id:valuesSourceId})}];const valuesSource=getValuesSource(field);if(valuesSource===VALUES_SOURCES.INPUT){const dynamicValuesId=`${fieldId}-dynamicValues`;groups.push({id:dynamicValuesId,label:'Dynamic options',component:Group,entries:InputKeyValuesSourceEntry({...context,id:dynamicValuesId})});}else if(valuesSource===VALUES_SOURCES.STATIC){const staticValuesId=`${fieldId}-staticValues`;groups.push({id:staticValuesId,label:'Static options',component:ListGroup,...StaticValuesSourceEntry({...context,id:staticValuesId})});}return groups;}function CustomValuesGroup(field,editField){const{properties={},type}=field;if(type==='default'){return null;}const addEntry=event=>{event.stopPropagation();const index=Object.keys(properties).length+1;const key=`key${index}`,value='value';editField(field,['properties'],{...properties,[key]:value});};const validateFactory=key=>{return value=>{if(value===key){return;}if(isUndefined(value)||!value.length){return 'Must not be empty.';}if(has(properties,value)){return 'Must be unique.';}};};const items=Object.keys(properties).map((key,index)=>{const removeEntry=event=>{event.stopPropagation();return editField(field,['properties'],removeKey(properties,key));};const id=`${field.id}-property-${index}`;return {autoFocusEntry:id+'-key',entries:CustomValueEntry({editField,field,idPrefix:id,index,validateFactory}),id,label:key||'',remove:removeEntry};});return {add:addEntry,component:ListGroup,id:'custom-values',items,label:'Custom properties',shouldSort:false};}// helpers //////////
11256
11506
  /**
@@ -11265,7 +11515,7 @@ meta: meta$1,/// [Metadata](#highlight.tags.meta) that applies to the entire
11265
11515
  eventBus.fire('propertiesPanel.updated',{formField:field});};h(()=>{function onSelectionChange(event){_update(event.selection||schema);}eventBus.on('selection.changed',onSelectionChange);return ()=>{eventBus.off('selection.changed',onSelectionChange);};},[]);h(()=>{const onFieldChanged=()=>{/**
11266
11516
  * TODO(pinussilvestrus): update with actual updated element,
11267
11517
  * once we have a proper updater/change support
11268
- */_update(selection.get()||schema);};eventBus.on('changed',onFieldChanged);return ()=>{eventBus.off('changed',onFieldChanged);};},[]);const selectedFormField=state.selectedFormField;const propertiesPanelContext={getService(type,strict=true){return injector.get(type,strict);}};const onFocus=()=>eventBus.fire('propertiesPanel.focusin');const onBlur=()=>eventBus.fire('propertiesPanel.focusout');const editField=A$1((formField,key,value)=>modeling.editFormField(formField,key,value),[modeling]);return e$1("div",{class:"fjs-properties-panel","data-field":selectedFormField&&selectedFormField.id,onFocusCapture:onFocus,onBlurCapture:onBlur,children:e$1(PropertiesPanelContext.Provider,{value:propertiesPanelContext,children:e$1(PropertiesPanel,{element:selectedFormField,eventBus:eventBus,groups:getGroups(selectedFormField,editField),headerProvider:PropertiesPanelHeaderProvider,placeholderProvider:PropertiesPanelPlaceholderProvider})})});}class PropertiesPanelRenderer{constructor(propertiesPanelConfig,injector,eventBus){const{parent}=propertiesPanelConfig||{};this._eventBus=eventBus;this._injector=injector;this._container=domify('<div class="fjs-properties-container" input-handle-modified-keys="y,z"></div>');if(parent){this.attachTo(parent);}this._eventBus.once('formEditor.rendered',500,()=>{this._render();});}/**
11518
+ */_update(selection.get()||schema);};eventBus.on('changed',onFieldChanged);return ()=>{eventBus.off('changed',onFieldChanged);};},[]);const selectedFormField=state.selectedFormField;const propertiesPanelContext={getService(type,strict=true){return injector.get(type,strict);}};const onFocus=()=>eventBus.fire('propertiesPanel.focusin');const onBlur=()=>eventBus.fire('propertiesPanel.focusout');const editField=A$1((formField,key,value)=>modeling.editFormField(formField,key,value),[modeling]);return e$1("div",{class:"fjs-properties-panel","data-field":selectedFormField&&selectedFormField.id,onFocusCapture:onFocus,onBlurCapture:onBlur,children:e$1(PropertiesPanelContext.Provider,{value:propertiesPanelContext,children:e$1(PropertiesPanel,{element:selectedFormField,eventBus:eventBus,groups:getGroups(selectedFormField,editField),headerProvider:PropertiesPanelHeaderProvider,placeholderProvider:PropertiesPanelPlaceholderProvider})})});}class PropertiesPanelRenderer{constructor(propertiesPanelConfig,injector,eventBus){const{parent}=propertiesPanelConfig||{};this._eventBus=eventBus;this._injector=injector;this._container=domify$1('<div class="fjs-properties-container" input-handle-modified-keys="y,z"></div>');if(parent){this.attachTo(parent);}this._eventBus.once('formEditor.rendered',500,()=>{this._render();});}/**
11269
11519
  * Attach the properties panel to a parent node.
11270
11520
  *
11271
11521
  * @param {HTMLElement} container
@@ -40134,7 +40384,7 @@ meta: meta$1,/// [Metadata](#highlight.tags.meta) that applies to the entire
40134
40384
  const [initialSchema, setInitialSchema] = l$1(props.schema);
40135
40385
  const [data, setData] = l$1(props.data || {});
40136
40386
  const [schema, setSchema] = l$1(props.schema);
40137
- const [resultData, setResultData] = l$1(props.data || {}); // pipe to playground API
40387
+ const [resultData, setResultData] = l$1({}); // pipe to playground API
40138
40388
 
40139
40389
  y(() => {
40140
40390
  props.onInit({
@@ -40145,7 +40395,10 @@ meta: meta$1,/// [Metadata](#highlight.tags.meta) that applies to the entire
40145
40395
  attachPropertiesPanelContainer: node => propertiesPanelRef.current.attachTo(node),
40146
40396
  attachResultContainer: node => resultViewRef.current.attachTo(node),
40147
40397
  get: (name, strict) => formEditorRef.current.get(name, strict),
40398
+ getDataEditor: () => dataEditorRef.current,
40148
40399
  getEditor: () => formEditorRef.current,
40400
+ getForm: () => formRef.current,
40401
+ getResultView: () => resultViewRef.current,
40149
40402
  getSchema: () => formEditorRef.current.getSchema(),
40150
40403
  setSchema: setInitialSchema,
40151
40404
  saveSchema: () => formEditorRef.current.saveSchema()
@@ -40184,8 +40437,8 @@ meta: meta$1,/// [Metadata](#highlight.tags.meta) that applies to the entire
40184
40437
  // notifiy interested parties after render
40185
40438
  emit('formPlayground.rendered');
40186
40439
  });
40187
- form.on('changed', event => {
40188
- setResultData(event.data);
40440
+ form.on('changed', () => {
40441
+ setResultData(form._getSubmitData());
40189
40442
  });
40190
40443
  dataEditor.on('changed', event => {
40191
40444
  try {
@@ -40369,44 +40622,25 @@ meta: meta$1,/// [Metadata](#highlight.tags.meta) that applies to the entire
40369
40622
  return state;
40370
40623
  };
40371
40624
 
40372
- this.getSchema = withRef(function () {
40373
- return ref.getSchema();
40374
- });
40375
- this.setSchema = withRef(function (schema) {
40376
- return ref.setSchema(schema);
40377
- });
40378
- this.saveSchema = withRef(function () {
40379
- return ref.saveSchema();
40380
- });
40381
- this.get = withRef(function (name, strict) {
40382
- return ref.get(name, strict);
40383
- });
40384
- this.getEditor = withRef(function () {
40385
- return ref.getEditor();
40386
- });
40625
+ this.getSchema = withRef(() => ref.getSchema());
40626
+ this.setSchema = withRef(schema => ref.setSchema(schema));
40627
+ this.saveSchema = withRef(() => ref.saveSchema());
40628
+ this.get = withRef((name, strict) => ref.get(name, strict));
40629
+ this.getDataEditor = withRef(() => ref.getDataEditor());
40630
+ this.getEditor = withRef(() => ref.getEditor());
40631
+ this.getForm = withRef((name, strict) => ref.getForm(name, strict));
40632
+ this.getResultView = withRef(() => ref.getResultView());
40387
40633
 
40388
40634
  this.destroy = function () {
40389
40635
  this.emit('destroy');
40390
40636
  };
40391
40637
 
40392
- this.attachEditorContainer = withRef(function (node) {
40393
- return ref.attachEditorContainer(node);
40394
- });
40395
- this.attachPreviewContainer = withRef(function (node) {
40396
- return ref.attachFormContainer(node);
40397
- });
40398
- this.attachDataContainer = withRef(function (node) {
40399
- return ref.attachDataContainer(node);
40400
- });
40401
- this.attachResultContainer = withRef(function (node) {
40402
- return ref.attachResultContainer(node);
40403
- });
40404
- this.attachPaletteContainer = withRef(function (node) {
40405
- return ref.attachPaletteContainer(node);
40406
- });
40407
- this.attachPropertiesPanelContainer = withRef(function (node) {
40408
- return ref.attachPropertiesPanelContainer(node);
40409
- });
40638
+ this.attachEditorContainer = withRef(node => ref.attachEditorContainer(node));
40639
+ this.attachPreviewContainer = withRef(node => ref.attachFormContainer(node));
40640
+ this.attachDataContainer = withRef(node => ref.attachDataContainer(node));
40641
+ this.attachResultContainer = withRef(node => ref.attachResultContainer(node));
40642
+ this.attachPaletteContainer = withRef(node => ref.attachPaletteContainer(node));
40643
+ this.attachPropertiesPanelContainer = withRef(node => ref.attachPropertiesPanelContainer(node));
40410
40644
  }
40411
40645
 
40412
40646
  exports.Playground = Playground;