@veloceapps/sdk 6.0.0-41 → 6.0.0-42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/veloceapps-sdk-cms.umd.js +3 -168
- package/bundles/veloceapps-sdk-cms.umd.js.map +1 -1
- package/cms/types/common.types.d.ts +2 -2
- package/esm2015/cms/cms.elements.js +4 -17
- package/esm2015/cms/types/common.types.js +1 -1
- package/fesm2015/veloceapps-sdk-cms.js +5 -166
- package/fesm2015/veloceapps-sdk-cms.js.map +1 -1
- package/package.json +1 -1
- package/cms/plugins/element-hover.plugin.d.ts +0 -32
- package/esm2015/cms/plugins/element-hover.plugin.js +0 -157
@@ -1367,159 +1367,6 @@
|
|
1367
1367
|
type: i0.Input
|
1368
1368
|
}] } });
|
1369
1369
|
|
1370
|
-
var ElementHoverPlugin = /** @class */ (function () {
|
1371
|
-
function ElementHoverPlugin(host) {
|
1372
|
-
var _this = this;
|
1373
|
-
this.host = host;
|
1374
|
-
this.hoverClassName = 'element-hover';
|
1375
|
-
this.color = 'red';
|
1376
|
-
this.highlighted = false;
|
1377
|
-
this.destroyed$ = new rxjs.Subject();
|
1378
|
-
this.el = this.host.injector.get(i0.ElementRef);
|
1379
|
-
this.metadata = this.host.injector.get(ELEMENT_METADATA);
|
1380
|
-
this.document = this.host.injector.get(i7.DOCUMENT);
|
1381
|
-
this.runtimeEditorService = this.host.injector.get(RuntimeEditorService);
|
1382
|
-
this.mouseOverListenerBound = this.mouseOverListener.bind(this);
|
1383
|
-
this.mouseLeaveListenerBound = this.mouseLeaveListener.bind(this);
|
1384
|
-
this.runtimeEditorService.editorMode$.pipe(rxjs.takeUntil(this.destroyed$)).subscribe(function (editorMode) {
|
1385
|
-
if (editorMode) {
|
1386
|
-
_this.attachListeners();
|
1387
|
-
}
|
1388
|
-
else {
|
1389
|
-
_this.detachListeners();
|
1390
|
-
}
|
1391
|
-
});
|
1392
|
-
}
|
1393
|
-
ElementHoverPlugin.prototype.ngOnDestroy = function () {
|
1394
|
-
this.destroyed$.next();
|
1395
|
-
this.destroyed$.complete();
|
1396
|
-
this.detachListeners();
|
1397
|
-
};
|
1398
|
-
ElementHoverPlugin.prototype.attachListeners = function () {
|
1399
|
-
this.el.nativeElement.addEventListener('mouseover', this.mouseOverListenerBound);
|
1400
|
-
this.el.nativeElement.addEventListener('mouseleave', this.mouseLeaveListenerBound);
|
1401
|
-
};
|
1402
|
-
ElementHoverPlugin.prototype.detachListeners = function () {
|
1403
|
-
this.el.nativeElement.removeEventListener('mouseover', this.mouseOverListenerBound);
|
1404
|
-
this.el.nativeElement.removeEventListener('mouseleave', this.mouseLeaveListenerBound);
|
1405
|
-
};
|
1406
|
-
ElementHoverPlugin.prototype.mouseOverListener = function (e) {
|
1407
|
-
var _this = this;
|
1408
|
-
var path = e.composedPath();
|
1409
|
-
var innerPath = path.slice(0, path.indexOf(this.el.nativeElement));
|
1410
|
-
var hasChildHovered = innerPath.some(function (target) {
|
1411
|
-
var t = target;
|
1412
|
-
return t.tagName === 'VL-ELEMENT' && t.classList.contains(_this.hoverClassName);
|
1413
|
-
});
|
1414
|
-
if (hasChildHovered) {
|
1415
|
-
this.removeHighlight();
|
1416
|
-
}
|
1417
|
-
else {
|
1418
|
-
this.addHighlight();
|
1419
|
-
}
|
1420
|
-
};
|
1421
|
-
ElementHoverPlugin.prototype.mouseLeaveListener = function () {
|
1422
|
-
this.removeHighlight();
|
1423
|
-
};
|
1424
|
-
ElementHoverPlugin.prototype.addHighlight = function () {
|
1425
|
-
if (this.highlighted) {
|
1426
|
-
return;
|
1427
|
-
}
|
1428
|
-
this.highlighted = true;
|
1429
|
-
this.el.nativeElement.classList.add(this.hoverClassName);
|
1430
|
-
var overlay = this.createContainer();
|
1431
|
-
this.addRemoveButton(overlay);
|
1432
|
-
this.addElementName(overlay);
|
1433
|
-
this.el.nativeElement.appendChild(overlay);
|
1434
|
-
this.overlayEl = overlay;
|
1435
|
-
};
|
1436
|
-
ElementHoverPlugin.prototype.removeHighlight = function () {
|
1437
|
-
if (!this.highlighted) {
|
1438
|
-
return;
|
1439
|
-
}
|
1440
|
-
this.highlighted = false;
|
1441
|
-
this.el.nativeElement.style.boxShadow = '';
|
1442
|
-
this.el.nativeElement.classList.remove(this.hoverClassName);
|
1443
|
-
this.deleteRemoveButton();
|
1444
|
-
};
|
1445
|
-
ElementHoverPlugin.prototype.createContainer = function () {
|
1446
|
-
var hostRect = this.el.nativeElement.getBoundingClientRect();
|
1447
|
-
var div = this.document.createElement('div');
|
1448
|
-
lodash.merge(div.style, {
|
1449
|
-
position: 'fixed',
|
1450
|
-
display: 'block',
|
1451
|
-
pointerEvents: 'none',
|
1452
|
-
left: '0',
|
1453
|
-
top: '0',
|
1454
|
-
fontSize: '10px',
|
1455
|
-
lineHeight: "12px",
|
1456
|
-
fontWeight: '400',
|
1457
|
-
color: '#fff',
|
1458
|
-
width: hostRect.width + "px",
|
1459
|
-
height: hostRect.height + "px",
|
1460
|
-
transform: "translate(" + hostRect.left + "px, " + hostRect.top + "px)",
|
1461
|
-
boxSizing: 'border-box',
|
1462
|
-
boxShadow: "inset 0 0 0 1px " + this.color,
|
1463
|
-
});
|
1464
|
-
return div;
|
1465
|
-
};
|
1466
|
-
ElementHoverPlugin.prototype.addRemoveButton = function (container) {
|
1467
|
-
var _this = this;
|
1468
|
-
if (this.metadata.type === 'LAYOUT_REGION') {
|
1469
|
-
return;
|
1470
|
-
}
|
1471
|
-
var buttonEl = this.document.createElement('div');
|
1472
|
-
var buttonSize = 12;
|
1473
|
-
lodash.merge(buttonEl.style, {
|
1474
|
-
bottom: '100%',
|
1475
|
-
right: '0',
|
1476
|
-
width: buttonSize + "px",
|
1477
|
-
height: buttonSize + "px",
|
1478
|
-
padding: '1px',
|
1479
|
-
textAlign: 'center',
|
1480
|
-
backgroundColor: this.color,
|
1481
|
-
position: 'absolute',
|
1482
|
-
cursor: 'pointer',
|
1483
|
-
display: 'block',
|
1484
|
-
pointerEvents: 'all',
|
1485
|
-
});
|
1486
|
-
buttonEl.innerHTML = '✕';
|
1487
|
-
buttonEl.addEventListener('click', function () {
|
1488
|
-
if (_this.metadata.path) {
|
1489
|
-
_this.runtimeEditorService.elementDeleted$.next({ path: _this.metadata.path });
|
1490
|
-
}
|
1491
|
-
});
|
1492
|
-
container.appendChild(buttonEl);
|
1493
|
-
};
|
1494
|
-
ElementHoverPlugin.prototype.addElementName = function (container) {
|
1495
|
-
var nameEl = this.document.createElement('div');
|
1496
|
-
lodash.merge(nameEl.style, {
|
1497
|
-
bottom: '100%',
|
1498
|
-
left: '0',
|
1499
|
-
height: "12px",
|
1500
|
-
backgroundColor: this.color,
|
1501
|
-
position: 'absolute',
|
1502
|
-
padding: '1px 2px',
|
1503
|
-
display: 'block',
|
1504
|
-
pointerEvents: 'all',
|
1505
|
-
});
|
1506
|
-
nameEl.innerHTML = this.metadata.name;
|
1507
|
-
container.appendChild(nameEl);
|
1508
|
-
};
|
1509
|
-
ElementHoverPlugin.prototype.deleteRemoveButton = function () {
|
1510
|
-
if (this.overlayEl) {
|
1511
|
-
this.el.nativeElement.removeChild(this.overlayEl);
|
1512
|
-
this.overlayEl = undefined;
|
1513
|
-
}
|
1514
|
-
};
|
1515
|
-
return ElementHoverPlugin;
|
1516
|
-
}());
|
1517
|
-
ElementHoverPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementHoverPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
1518
|
-
ElementHoverPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: ElementHoverPlugin, ngImport: i0__namespace });
|
1519
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementHoverPlugin, decorators: [{
|
1520
|
-
type: i0.Directive
|
1521
|
-
}], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
|
1522
|
-
|
1523
1370
|
var IOPlugin = /** @class */ (function () {
|
1524
1371
|
function IOPlugin(host) {
|
1525
1372
|
var _this = this;
|
@@ -1623,12 +1470,12 @@
|
|
1623
1470
|
var CONFIG = {
|
1624
1471
|
CUSTOM: {
|
1625
1472
|
component: exports.ElementComponent,
|
1626
|
-
plugins: [
|
1473
|
+
plugins: [IOPlugin, ScriptPlugin],
|
1627
1474
|
},
|
1628
1475
|
CONTAINER: {
|
1629
1476
|
component: exports.ElementComponent,
|
1630
1477
|
defaultTemplate: '<element-children></element-children>',
|
1631
|
-
plugins: [
|
1478
|
+
plugins: [ScriptPlugin],
|
1632
1479
|
},
|
1633
1480
|
SERVICE: {
|
1634
1481
|
component: exports.ElementComponent,
|
@@ -1638,21 +1485,9 @@
|
|
1638
1485
|
},
|
1639
1486
|
REFERENCE: {
|
1640
1487
|
component: exports.ElementComponent,
|
1641
|
-
plugins: [
|
1488
|
+
plugins: [IOPlugin, ScriptPlugin],
|
1642
1489
|
suppressTemplate: true,
|
1643
1490
|
},
|
1644
|
-
PAGE: {
|
1645
|
-
component: exports.ElementComponent,
|
1646
|
-
plugins: [ElementHoverPlugin, IOPlugin, ScriptPlugin],
|
1647
|
-
},
|
1648
|
-
PAGE_LAYOUT: {
|
1649
|
-
component: exports.ElementComponent,
|
1650
|
-
plugins: [ElementHoverPlugin, IOPlugin, ScriptPlugin],
|
1651
|
-
},
|
1652
|
-
LAYOUT_REGION: {
|
1653
|
-
component: exports.ElementComponent,
|
1654
|
-
plugins: [ElementHoverPlugin, IOPlugin, ScriptPlugin],
|
1655
|
-
},
|
1656
1491
|
};
|
1657
1492
|
|
1658
1493
|
var EXPORTED_CLASS_REGEX = /export class (\S+)/;
|