iobroker.mywebui 1.37.72 → 1.37.74
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/io-package.json
CHANGED
package/package.json
CHANGED
|
@@ -866,18 +866,39 @@ export class IobrokerWebuiAppShell extends BaseCustomWebComponentConstructorAppe
|
|
|
866
866
|
const block = document.createElement('div');
|
|
867
867
|
block.style.cssText = 'border:2px solid #c8d6e0;border-radius:5px;padding:8px;margin-bottom:10px;background:#f7fafc;';
|
|
868
868
|
|
|
869
|
-
//
|
|
869
|
+
// Collapsible body — collapsed by default
|
|
870
|
+
const body = document.createElement('div');
|
|
871
|
+
body.style.display = 'none';
|
|
872
|
+
|
|
873
|
+
// Header: toggle arrow + "Animation #N (effect)" + delete button
|
|
870
874
|
const hdr = document.createElement('div');
|
|
871
|
-
hdr.style.cssText = 'display:flex;justify-content:space-between;align-items:center;
|
|
875
|
+
hdr.style.cssText = 'display:flex;justify-content:space-between;align-items:center;cursor:pointer;user-select:none;';
|
|
876
|
+
const hdrLeft = document.createElement('div');
|
|
877
|
+
hdrLeft.style.cssText = 'display:flex;align-items:center;gap:5px;';
|
|
878
|
+
const arrow = document.createElement('span');
|
|
879
|
+
arrow.textContent = '▶';
|
|
880
|
+
arrow.style.cssText = 'font-size:9px;color:#3a6a8a;transition:transform 0.15s;';
|
|
872
881
|
const hdrTitle = document.createElement('span');
|
|
873
|
-
|
|
882
|
+
const effectLabel = cfg.effect || 'none';
|
|
883
|
+
hdrTitle.textContent = `#${index + 1} — ${effectLabel}`;
|
|
874
884
|
hdrTitle.style.cssText = 'font-size:12px;font-weight:700;color:#3a6a8a;';
|
|
885
|
+
hdrLeft.appendChild(arrow); hdrLeft.appendChild(hdrTitle);
|
|
875
886
|
const delBtn = document.createElement('button');
|
|
876
|
-
delBtn.textContent = '✕
|
|
877
|
-
delBtn.
|
|
878
|
-
delBtn.
|
|
879
|
-
|
|
887
|
+
delBtn.textContent = '✕';
|
|
888
|
+
delBtn.title = 'Remove animation';
|
|
889
|
+
delBtn.style.cssText = 'font-size:10px;padding:1px 5px;cursor:pointer;border:1px solid #c66;border-radius:3px;background:#fff;color:#c33;';
|
|
890
|
+
delBtn.onclick = (e) => { e.stopPropagation(); cfgList.splice(index, 1); saveAndRefresh(); };
|
|
891
|
+
hdr.appendChild(hdrLeft); hdr.appendChild(delBtn);
|
|
892
|
+
|
|
893
|
+
hdr.onclick = () => {
|
|
894
|
+
const collapsed = body.style.display === 'none';
|
|
895
|
+
body.style.display = collapsed ? '' : 'none';
|
|
896
|
+
arrow.style.transform = collapsed ? 'rotate(90deg)' : '';
|
|
897
|
+
hdr.style.marginBottom = collapsed ? '8px' : '0';
|
|
898
|
+
};
|
|
899
|
+
|
|
880
900
|
block.appendChild(hdr);
|
|
901
|
+
block.appendChild(body);
|
|
881
902
|
|
|
882
903
|
const sec = (title) => {
|
|
883
904
|
const d = document.createElement('div');
|
|
@@ -966,24 +987,24 @@ export class IobrokerWebuiAppShell extends BaseCustomWebComponentConstructorAppe
|
|
|
966
987
|
return out;
|
|
967
988
|
};
|
|
968
989
|
|
|
969
|
-
//
|
|
970
|
-
|
|
971
|
-
|
|
990
|
+
// ── All content goes into collapsible body ──
|
|
991
|
+
body.appendChild(sec('Effect'));
|
|
992
|
+
body.appendChild(mkField('Type', 'effect', effectSel, cfg));
|
|
972
993
|
|
|
973
994
|
const svgAttrRow = mkField('SVG Attr', 'svgAttr', svgAttrSel, cfg);
|
|
974
995
|
svgAttrRow.style.display = cfg.effect === 'svg' ? '' : 'none';
|
|
975
|
-
|
|
996
|
+
body.appendChild(svgAttrRow);
|
|
976
997
|
effectSel.addEventListener('change', () => { svgAttrRow.style.display = effectSel.value === 'svg' ? '' : 'none'; });
|
|
977
998
|
|
|
978
|
-
|
|
979
|
-
|
|
999
|
+
body.appendChild(mkField('Value From', 'valueFrom', valueFromInp, cfg));
|
|
1000
|
+
body.appendChild(mkField('Value To', 'valueTo', valueToInp, cfg));
|
|
980
1001
|
|
|
981
1002
|
const colorRows = document.createElement('div');
|
|
982
1003
|
const isColorEffect = e => ['fill','color','backgroundColor','svg'].includes(e);
|
|
983
1004
|
colorRows.style.display = isColorEffect(cfg.effect) ? '' : 'none';
|
|
984
1005
|
colorRows.appendChild(mkField('Color From', 'fillColorFrom', fillFromInp, cfg));
|
|
985
1006
|
colorRows.appendChild(mkField('Color To', 'fillColorTo', fillToInp, cfg));
|
|
986
|
-
|
|
1007
|
+
body.appendChild(colorRows);
|
|
987
1008
|
effectSel.addEventListener('change', () => { colorRows.style.display = isColorEffect(effectSel.value) ? '' : 'none'; });
|
|
988
1009
|
|
|
989
1010
|
const motionRows = document.createElement('div');
|
|
@@ -991,27 +1012,27 @@ export class IobrokerWebuiAppShell extends BaseCustomWebComponentConstructorAppe
|
|
|
991
1012
|
motionRows.appendChild(mkField('Path ID', 'pathId', pathIdInp, cfg));
|
|
992
1013
|
motionRows.appendChild(alignToPathChk);
|
|
993
1014
|
motionRows.appendChild(orientToPathChk);
|
|
994
|
-
|
|
1015
|
+
body.appendChild(motionRows);
|
|
995
1016
|
effectSel.addEventListener('change', () => { motionRows.style.display = effectSel.value === 'motionPath' ? '' : 'none'; });
|
|
996
1017
|
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1018
|
+
body.appendChild(sec('Timing'));
|
|
1019
|
+
body.appendChild(mkField('Duration (s)', 'duration', durationInp, cfg));
|
|
1020
|
+
body.appendChild(mkField('Ease', 'ease', easeSel, cfg));
|
|
1021
|
+
body.appendChild(mkField('Repeat', 'repeat', repeatInp, cfg));
|
|
1022
|
+
body.appendChild(yoyoChk);
|
|
1002
1023
|
|
|
1003
1024
|
const originRows = document.createElement('div');
|
|
1004
1025
|
originRows.style.display = (cfg.effect === 'rotation' || cfg.effect === 'scale') ? '' : 'none';
|
|
1005
1026
|
originRows.appendChild(sec('Transform Origin'));
|
|
1006
1027
|
originRows.appendChild(mkField('Origin X (%)', 'transformOriginX', originXInp, cfg));
|
|
1007
1028
|
originRows.appendChild(mkField('Origin Y (%)', 'transformOriginY', originYInp, cfg));
|
|
1008
|
-
|
|
1029
|
+
body.appendChild(originRows);
|
|
1009
1030
|
effectSel.addEventListener('change', () => { originRows.style.display = (effectSel.value === 'rotation' || effectSel.value === 'scale') ? '' : 'none'; });
|
|
1010
1031
|
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1032
|
+
body.appendChild(sec('Controls (OID triggers)'));
|
|
1033
|
+
body.appendChild(playCtrl); body.appendChild(pauseCtrl);
|
|
1034
|
+
body.appendChild(resumeCtrl); body.appendChild(stopCtrl);
|
|
1035
|
+
body.appendChild(reverseCtrl);
|
|
1015
1036
|
|
|
1016
1037
|
return block;
|
|
1017
1038
|
};
|
|
@@ -2,6 +2,7 @@ import { BaseCustomWebComponentConstructorAppend, css, cssFromString } from "@go
|
|
|
2
2
|
import { iobrokerHandler } from "../common/IobrokerHandler.js";
|
|
3
3
|
import { PropertiesHelper } from "@gokturk413/web-component-designer/dist/elements/services/propertiesService/services/PropertiesHelper.js";
|
|
4
4
|
import { visibilityService } from "./VisibilityService.js";
|
|
5
|
+
import { scanAndApplyAnimations, scanAndApplyEffects, cleanupAnimations, cleanupEffects } from "./AnimationService.js";
|
|
5
6
|
export const webuiCustomControlPrefix = 'webui-';
|
|
6
7
|
export const webuiCustomControlSymbol = Symbol('webuiCustomControlSymbol');
|
|
7
8
|
export class BaseCustomControl extends BaseCustomWebComponentConstructorAppend {
|
|
@@ -80,6 +81,9 @@ export class BaseCustomControl extends BaseCustomWebComponentConstructorAppend {
|
|
|
80
81
|
|
|
81
82
|
// Scan and apply visibility to all elements inside the custom control
|
|
82
83
|
await visibilityService.scanAndApply(this.shadowRoot);
|
|
84
|
+
// Scan and apply animations/effects to all elements inside the custom control
|
|
85
|
+
scanAndApplyAnimations(this.shadowRoot).catch(() => {});
|
|
86
|
+
scanAndApplyEffects(this.shadowRoot).catch(() => {});
|
|
83
87
|
}
|
|
84
88
|
disconnectedCallback() {
|
|
85
89
|
for (let e of this.#eventListeners) {
|
|
@@ -98,6 +102,9 @@ export class BaseCustomControl extends BaseCustomWebComponentConstructorAppend {
|
|
|
98
102
|
// Remove visibility control from all elements inside the custom control
|
|
99
103
|
const controlledElements = this.shadowRoot.querySelectorAll('[data-visibility-controlled="true"]');
|
|
100
104
|
controlledElements.forEach(el => visibilityService.removeVisibility(el));
|
|
105
|
+
// Cleanup animations and effects
|
|
106
|
+
cleanupAnimations(this.shadowRoot);
|
|
107
|
+
cleanupEffects(this.shadowRoot);
|
|
101
108
|
}
|
|
102
109
|
_assignEvent(event, callback) {
|
|
103
110
|
const arrayEl = [event, callback];
|