iobroker.mywebui 1.37.64 → 1.37.65

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "mywebui",
4
- "version": "1.37.64",
4
+ "version": "1.37.65",
5
5
  "titleLang": {
6
6
  "en": "mywebui",
7
7
  "de": "mywebui",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.mywebui",
3
- "version": "1.37.64",
3
+ "version": "1.37.65",
4
4
  "description": "ioBroker mywebui - Custom edited mywebui by gokturk413",
5
5
  "type": "module",
6
6
  "main": "dist/backend/main.js",
@@ -767,7 +767,7 @@ export class IobrokerWebuiAppShell extends BaseCustomWebComponentConstructorAppe
767
767
  const collectAnimCfg = () => {
768
768
  const e = effectSel.value;
769
769
  const c = {};
770
- const addCtrl = (key, row) => { const v = row._getCtrl(); if (v.oid) c[key] = v; };
770
+ const addCtrl = (key, row) => { const v = row._getCtrl(); if (v.oid || v.oid_bind) c[key] = v; };
771
771
  addCtrl('play', playCtrl); addCtrl('pause', pauseCtrl);
772
772
  addCtrl('resume', resumeCtrl); addCtrl('stop', stopCtrl);
773
773
  addCtrl('reverse', reverseCtrl);
@@ -868,8 +868,11 @@ export class IobrokerWebuiAppShell extends BaseCustomWebComponentConstructorAppe
868
868
  const wrap = document.createElement('div');
869
869
  wrap.style.cssText = 'border:1px solid #eee;border-radius:3px;padding:6px;margin-bottom:6px;background:#fafafa;';
870
870
  const head = document.createElement('div');
871
- head.style.cssText = 'font-size:11px;font-weight:600;color:#444;margin-bottom:5px;';
872
- head.textContent = label;
871
+ head.style.cssText = 'display:flex;align-items:center;gap:4px;font-size:11px;font-weight:600;color:#444;margin-bottom:5px;';
872
+ head.appendChild(this._makeBindSquare('oid', ctrlCfg, designItem, 'data-animation', saveAndRefresh));
873
+ const headText = document.createElement('span');
874
+ headText.textContent = label;
875
+ head.appendChild(headText);
873
876
  wrap.appendChild(head);
874
877
  const oidInp = document.createElement('input');
875
878
  oidInp.type = 'text'; oidInp.value = ctrlCfg.oid || '';
@@ -900,7 +903,11 @@ export class IobrokerWebuiAppShell extends BaseCustomWebComponentConstructorAppe
900
903
  condRow.style.cssText = 'display:flex;gap:3px;';
901
904
  condRow.appendChild(condSel); condRow.appendChild(valInp);
902
905
  wrap.appendChild(condRow);
903
- wrap._getCtrl = () => ({ oid: oidInp.value || undefined, condition: condSel.value, value: valInp.value });
906
+ wrap._getCtrl = () => {
907
+ const v = { oid: oidInp.value || undefined, condition: condSel.value, value: valInp.value };
908
+ if (ctrlCfg.oid_bind) v.oid_bind = ctrlCfg.oid_bind;
909
+ return v;
910
+ };
904
911
  return wrap;
905
912
  };
906
913
 
@@ -1064,8 +1071,8 @@ export class IobrokerWebuiAppShell extends BaseCustomWebComponentConstructorAppe
1064
1071
  if (parseFloat(delayInp.value)) out.delay = parseFloat(delayInp.value);
1065
1072
  if (parseInt(repeatInp.value)) out.repeat = parseInt(repeatInp.value);
1066
1073
  out.ease = easeSel.value || 'power2.out';
1067
- if (triggerSel.value === 'oid' && oidInp.value) {
1068
- out.oid = oidInp.value;
1074
+ if (triggerSel.value === 'oid' && (oidInp.value || cfg.oid_bind)) {
1075
+ if (oidInp.value) out.oid = oidInp.value;
1069
1076
  out.condition = condSel.value;
1070
1077
  out.conditionValue = condValInp.value;
1071
1078
  }
@@ -1180,8 +1187,11 @@ export class IobrokerWebuiAppShell extends BaseCustomWebComponentConstructorAppe
1180
1187
  const oidSection = document.createElement('div');
1181
1188
  oidSection.style.display = cfg.trigger === 'oid' ? '' : 'none';
1182
1189
  const oidLabel = document.createElement('div');
1183
- oidLabel.style.cssText = 'font-size:11px;font-weight:600;color:#555;margin-bottom:3px;padding-left:15px;';
1184
- oidLabel.textContent = 'OID';
1190
+ oidLabel.style.cssText = 'display:flex;align-items:center;gap:4px;font-size:11px;font-weight:600;color:#555;margin-bottom:3px;padding-left:4px;';
1191
+ oidLabel.appendChild(this._makeBindSquare('oid', cfg, designItem, 'data-effects', saveAndRefresh));
1192
+ const oidLabelText = document.createElement('span');
1193
+ oidLabelText.textContent = 'OID';
1194
+ oidLabel.appendChild(oidLabelText);
1185
1195
  const oidRowDiv = document.createElement('div');
1186
1196
  oidRowDiv.style.cssText = 'display:flex;gap:3px;margin-bottom:4px;padding-left:15px;';
1187
1197
  oidRowDiv.appendChild(oidInp); oidRowDiv.appendChild(oidPickBtn);
@@ -156,9 +156,26 @@ class AnimationInstance {
156
156
  if (!window.gsap) return;
157
157
  const controls = this.cfg.controls || {};
158
158
 
159
- const bindControl = (key, action) => {
159
+ const bindControl = async (key, action) => {
160
160
  const ctrl = controls[key];
161
- if (!ctrl?.oid) return;
161
+ if (!ctrl) return;
162
+
163
+ // If OID itself is bound via binding square, resolve it first
164
+ if (ctrl.oid_bind?.signal) {
165
+ try {
166
+ const s = await iobrokerHandler.connection.getState(ctrl.oid_bind.signal);
167
+ if (s?.val != null) ctrl.oid = String(s.val);
168
+ } catch (e) {}
169
+ const oidBindHandler = (id, state) => {
170
+ if (state?.val != null) ctrl.oid = String(state.val);
171
+ };
172
+ try {
173
+ iobrokerHandler.connection.subscribeState(ctrl.oid_bind.signal, oidBindHandler);
174
+ this._subs.push({ oid: ctrl.oid_bind.signal, handler: oidBindHandler });
175
+ } catch (e) {}
176
+ }
177
+
178
+ if (!ctrl.oid) return;
162
179
  const handler = (id, state) => {
163
180
  if (checkCond(state?.val, ctrl.condition || 'equal', ctrl.value ?? 'true')) action();
164
181
  };
@@ -171,11 +188,11 @@ class AnimationInstance {
171
188
  }).catch(() => {});
172
189
  };
173
190
 
174
- bindControl('play', () => this._play());
175
- bindControl('pause', () => this.tween?.pause());
176
- bindControl('resume', () => this.tween?.play());
177
- bindControl('stop', () => this.tween?.pause(0));
178
- bindControl('reverse', () => this.tween?.reverse());
191
+ await bindControl('play', () => this._play());
192
+ await bindControl('pause', () => this.tween?.pause());
193
+ await bindControl('resume', () => this.tween?.play());
194
+ await bindControl('stop', () => this.tween?.pause(0));
195
+ await bindControl('reverse', () => this.tween?.reverse());
179
196
 
180
197
  // Dynamic property bindings — each prop can have a propKey_bind: {signal, expression}
181
198
  const dynamicProps = [
@@ -360,15 +377,28 @@ async function _applyEffect(el, cfg) {
360
377
  } else if (cfg.trigger === 'click') {
361
378
  _clickFn = applyTween;
362
379
  el.addEventListener('click', _clickFn);
363
- } else if (cfg.trigger === 'oid' && cfg.oid) {
364
- _oidId = cfg.oid;
365
- _oidHandler = (id, state) => {
366
- if (checkCond(state?.val, cfg.condition || 'equal', cfg.conditionValue ?? 'true')) applyTween();
367
- };
368
- try { iobrokerHandler.connection.subscribeState(cfg.oid, _oidHandler); } catch (e) {}
369
- iobrokerHandler.connection.getState(cfg.oid).then(state => {
370
- if (state && checkCond(state.val, cfg.condition || 'equal', cfg.conditionValue ?? 'true')) applyTween();
371
- }).catch(() => {});
380
+ } else if (cfg.trigger === 'oid') {
381
+ // Resolve OID — may come from a binding square binding
382
+ if (cfg.oid_bind?.signal) {
383
+ try {
384
+ const s = await iobrokerHandler.connection.getState(cfg.oid_bind.signal);
385
+ if (s?.val != null) cfg.oid = String(s.val);
386
+ } catch (e) {}
387
+ const oidBindHandler = (id, state) => { if (state?.val != null) cfg.oid = String(state.val); };
388
+ try { iobrokerHandler.connection.subscribeState(cfg.oid_bind.signal, oidBindHandler); } catch (e) {}
389
+ _oidId = cfg.oid_bind.signal;
390
+ _oidHandler = oidBindHandler;
391
+ }
392
+ if (cfg.oid) {
393
+ _oidId = cfg.oid;
394
+ _oidHandler = (id, state) => {
395
+ if (checkCond(state?.val, cfg.condition || 'equal', cfg.conditionValue ?? 'true')) applyTween();
396
+ };
397
+ try { iobrokerHandler.connection.subscribeState(cfg.oid, _oidHandler); } catch (e) {}
398
+ iobrokerHandler.connection.getState(cfg.oid).then(state => {
399
+ if (state && checkCond(state.val, cfg.condition || 'equal', cfg.conditionValue ?? 'true')) applyTween();
400
+ }).catch(() => {});
401
+ }
372
402
  }
373
403
 
374
404
  return () => {