@node-projects/web-component-designer-visualization-addons 0.1.145 → 0.1.147

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/dist/index.d.ts CHANGED
@@ -5,6 +5,8 @@ export * from './blockly/components/components.js';
5
5
  export * from './components/BindingsEditor.js';
6
6
  export * from './components/BindingsEditorHistoric.js';
7
7
  export * from './components/SimpleScriptEditor.js';
8
+ export * from './components/SimpleScriptCommandPicker.js';
9
+ export * from './components/SimpleScriptEditorHelp.js';
8
10
  export * from './components/VisualizationPropertyGrid.js';
9
11
  export * from './components/ParameterEditor.js';
10
12
  export * from './components/EventAssignment.js';
@@ -16,6 +18,7 @@ export type * from './interfaces/VisualizationHandler.js';
16
18
  export type * from './interfaces/VisualizationShell.js';
17
19
  export * from './scripting/Script.js';
18
20
  export * from './scripting/ScriptCommands.js';
21
+ export * from './scripting/ScriptCommandsDescriptions.js';
19
22
  export * from './scripting/ScriptSystem.js';
20
23
  export * from './services/BindableObjectDragDropService.js';
21
24
  export * from './services/VisualizationBindingsService.js';
package/dist/index.js CHANGED
@@ -5,12 +5,15 @@ export * from './blockly/components/components.js';
5
5
  export * from './components/BindingsEditor.js';
6
6
  export * from './components/BindingsEditorHistoric.js';
7
7
  export * from './components/SimpleScriptEditor.js';
8
+ export * from './components/SimpleScriptCommandPicker.js';
9
+ export * from './components/SimpleScriptEditorHelp.js';
8
10
  export * from './components/VisualizationPropertyGrid.js';
9
11
  export * from './components/ParameterEditor.js';
10
12
  export * from './components/EventAssignment.js';
11
13
  export * from './helpers/BindingsHelper.js';
12
14
  export * from './scripting/Script.js';
13
15
  export * from './scripting/ScriptCommands.js';
16
+ export * from './scripting/ScriptCommandsDescriptions.js';
14
17
  export * from './scripting/ScriptSystem.js';
15
18
  export * from './services/BindableObjectDragDropService.js';
16
19
  export * from './services/VisualizationBindingsService.js';
@@ -1,6 +1,7 @@
1
1
  import { IBindableObjectsBrowser } from "@node-projects/web-component-designer";
2
2
  export interface VisualizationShell {
3
3
  openConfirmation(element: HTMLElement, options: {
4
+ title?: string;
4
5
  x?: number;
5
6
  y?: number;
6
7
  width?: number;
@@ -11,5 +12,15 @@ export interface VisualizationShell {
11
12
  confirmText?: string;
12
13
  cancelText?: string;
13
14
  }): Promise<boolean>;
15
+ openModal(element: HTMLElement, options: {
16
+ title?: string;
17
+ x?: number;
18
+ y?: number;
19
+ width?: number;
20
+ height?: number;
21
+ parent?: HTMLElement;
22
+ abortSignal?: AbortSignal;
23
+ disableResize?: boolean;
24
+ }): Promise<void>;
14
25
  createBindableObjectBrowser: () => IBindableObjectsBrowser;
15
26
  }
@@ -0,0 +1,3 @@
1
+ export declare function escapeHtml(text: string): string;
2
+ /** Minimal JSON syntax highlighter for short code-snippet examples - not a real parser. */
3
+ export declare function highlightJson(json: string): string;
@@ -0,0 +1,16 @@
1
+ export function escapeHtml(text) {
2
+ return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
3
+ }
4
+ /** Minimal JSON syntax highlighter for short code-snippet examples - not a real parser. */
5
+ export function highlightJson(json) {
6
+ const escaped = escapeHtml(json);
7
+ return escaped.replace(/("(?:\\.|[^"\\])*")(\s*:)?|\b(true|false|null)\b|\b(-?\d+(?:\.\d+)?)\b/g, (match, str, colon, keyword, num) => {
8
+ if (str)
9
+ return `<span class="${colon ? 'cs-key' : 'cs-str'}">${str}</span>${colon ?? ''}`;
10
+ if (keyword)
11
+ return `<span class="cs-bool">${keyword}</span>`;
12
+ if (num)
13
+ return `<span class="cs-num">${num}</span>`;
14
+ return match;
15
+ });
16
+ }
@@ -1,4 +1,5 @@
1
- export declare type ScriptCommands = RunnableScriptCommands | Comment | Condition | Exit | Label | Goto;
1
+ import { IScriptMultiplexValue } from "../interfaces/IScriptMultiplexValue.js";
2
+ export declare type ScriptCommands = RunnableScriptCommands | Comment | Condition | If | Exit | Label | Goto;
2
3
  export declare type RunnableScriptCommands = OpenScreen | OpenUrl | OpenDialog | CloseDialog | ToggleSignalValue | ToggleSignalValueThroughList | SetSignalValue | IncrementSignalValue | DecrementSignalValue | SetBitInSignal | ClearBitInSignal | ToggleBitInSignal | Console | CalculateSignalValue | Javascript | SetElementProperty | Delay | SwitchLanguage | Login | Logout | SubscribeSignal | UnsubscribeSignal | WriteSignalsInGroup | ClearSignalsInGroup | RunScript | CopySignalValuesFromFolder | ShowMessageBox | ShowPrompt | ExportSignalValuesAsJson | ImportSignalValuesFromJson | Repeat;
3
4
  /**
4
5
  * signal - a signal (the default)
@@ -419,6 +420,38 @@ export interface Condition {
419
420
  falseScriptType?: string;
420
421
  additionalData?: string;
421
422
  }
423
+ export interface IfSignal extends IScriptMultiplexValue {
424
+ /**
425
+ * Optional variable name to reference this value in the formula (e.g. "isOn").
426
+ * If empty, the value is referenced positionally as __0, __1, __2, ... (in listed order).
427
+ */
428
+ varName?: string;
429
+ }
430
+ export interface If {
431
+ type: 'If';
432
+ /**
433
+ * Values referenced in the formula, either positionally as __0, __1, __2, ... (in listed
434
+ * order) or, if varName is set, by that name. Each entry works like Condition.value1
435
+ * (source: signal/property/elementProperty/signalInProperty/event/parameter/context/
436
+ * complexString/complexSignal/expression)
437
+ * @TJS-format signalList
438
+ */
439
+ signals: IfSignal[];
440
+ /**
441
+ * Boolean formula, e.g. (__0 == true || __1 == true) && __2 == false
442
+ * @TJS-format formula
443
+ */
444
+ formula: string;
445
+ /**
446
+ * Commands executed when the formula evaluates to true
447
+ */
448
+ trueCommands: ScriptCommands[];
449
+ /**
450
+ * Commands executed when the formula evaluates to false
451
+ */
452
+ elseCommands: ScriptCommands[];
453
+ additionalData?: string;
454
+ }
422
455
  export interface Exit {
423
456
  type: 'Exit';
424
457
  additionalData?: string;
@@ -0,0 +1,9 @@
1
+ export interface ScriptCommandHelp {
2
+ /** short hint shown next to the command name */
3
+ description: string;
4
+ /** a single command object, as JSON */
5
+ example: string;
6
+ /** optional longer clarification, shown below the example */
7
+ note?: string;
8
+ }
9
+ export declare const nativeScriptCommandDescriptions: Record<string, ScriptCommandHelp>;
@@ -0,0 +1,159 @@
1
+ export const nativeScriptCommandDescriptions = {
2
+ Comment: {
3
+ description: 'has no effect on script execution',
4
+ example: '{ "type": "Comment", "comment": "explains the next step" }',
5
+ },
6
+ OpenScreen: {
7
+ description: 'navigate to a screen (with history)',
8
+ example: '{ "type": "OpenScreen", "screen": "MyScreen" }',
9
+ },
10
+ OpenDialog: {
11
+ description: 'open a screen as a movable/closable dialog',
12
+ example: '{ "type": "OpenDialog", "screen": "MyScreen", "title": "My Dialog",\n "moveable": true, "closeable": true }',
13
+ },
14
+ CloseDialog: {
15
+ description: 'close the parent dialog this command runs in',
16
+ example: '{ "type": "CloseDialog" }',
17
+ },
18
+ OpenUrl: {
19
+ description: 'open an URL, optionally as an in-app dialog',
20
+ example: '{ "type": "OpenUrl", "url": "https://example.com", "target": "_blank", "openInDialog": false }',
21
+ },
22
+ ShowMessageBox: {
23
+ description: 'ask the user to confirm before continuing',
24
+ example: '{ "type": "ShowMessageBox", "title": "Confirm", "message": "Are you sure?",\n "messageType": "warning", "buttons": "yesNo", "resultSignal": ".Local.Result",\n "exitScriptOnCancel": true }',
25
+ note: 'exitScriptOnCancel: true stops the chain when the user picks a negative button.',
26
+ },
27
+ ShowPrompt: {
28
+ description: 'ask the user for text input',
29
+ example: '{ "type": "ShowPrompt", "title": "Name?", "message": "Enter a name",\n "resultSignal": ".Local.Name", "exitScriptOnCancel": true }',
30
+ },
31
+ SetSignalValue: {
32
+ description: 'write a signal / property',
33
+ example: '{ "type": "SetSignalValue", "signal": ".Some.Signal", "value": true }',
34
+ note: 'target: "signal" (default) | "property" (a screen/control property) | "elementProperty" (a property of the element raising the event).',
35
+ },
36
+ ToggleSignalValue: {
37
+ description: 'toggle a boolean signal / property',
38
+ example: '{ "type": "ToggleSignalValue", "signal": ".Some.Toggle" }',
39
+ },
40
+ ToggleSignalValueThroughList: {
41
+ description: 'cycle a signal / property through a fixed list of values',
42
+ example: '{ "type": "ToggleSignalValueThroughList", "signal": ".Some.Mode", "valueList": [1, 2, 3] }',
43
+ },
44
+ IncrementSignalValue: {
45
+ description: 'increment a numeric signal / property',
46
+ example: '{ "type": "IncrementSignalValue", "signal": ".Some.Counter", "value": 1 }',
47
+ },
48
+ DecrementSignalValue: {
49
+ description: 'decrement a numeric signal / property',
50
+ example: '{ "type": "DecrementSignalValue", "signal": ".Some.Counter", "value": 1 }',
51
+ },
52
+ CalculateSignalValue: {
53
+ description: 'calculate a new signal value from a formula',
54
+ example: '{ "type": "CalculateSignalValue", "targetSignal": ".Some.Result",\n "formula": "{adapter.0.level} * 100 + 30" }',
55
+ note: 'The formula can reference other signals in curly braces: {signalName}.',
56
+ },
57
+ SetBitInSignal: {
58
+ description: 'set a single bit (by number) in a signal / property',
59
+ example: '{ "type": "SetBitInSignal", "signal": ".Some.Bits", "bitNumber": 3 }',
60
+ },
61
+ ClearBitInSignal: {
62
+ description: 'clear a single bit (by number) in a signal / property',
63
+ example: '{ "type": "ClearBitInSignal", "signal": ".Some.Bits", "bitNumber": 3 }',
64
+ },
65
+ ToggleBitInSignal: {
66
+ description: 'toggle a single bit (by number) in a signal / property',
67
+ example: '{ "type": "ToggleBitInSignal", "signal": ".Some.Bits", "bitNumber": 3 }',
68
+ },
69
+ Javascript: {
70
+ description: 'run a JavaScript snippet',
71
+ example: '{ "type": "Javascript", "script": "console.log(context.element)" }',
72
+ note: 'context: { event, element, shadowRoot, instance }.',
73
+ },
74
+ SetElementProperty: {
75
+ description: 'set a property/attribute/CSS value/class on matching elements',
76
+ example: '{ "type": "SetElementProperty", "target": "property", "targetSelectorTarget": "container",\n "targetSelector": ".my-class", "name": "disabled", "value": true }',
77
+ note: 'target: "property" (default) | "attribute" | "css" | "class". targetSelectorTarget: "container" (screen/customControl, default) | "element" (current element).',
78
+ },
79
+ Delay: {
80
+ description: 'pause the script chain',
81
+ example: '{ "type": "Delay", "value": 500 }',
82
+ },
83
+ Console: {
84
+ description: 'write a message to the browser console',
85
+ example: '{ "type": "Console", "target": "log", "message": "done" }',
86
+ note: 'target: "log" (default) | "info" | "debug" | "warn" | "error".',
87
+ },
88
+ SwitchLanguage: {
89
+ description: 'switch the active UI language',
90
+ example: '{ "type": "SwitchLanguage", "language": "en" }',
91
+ },
92
+ Login: {
93
+ description: 'log a user in',
94
+ example: '{ "type": "Login", "username": "user", "password": "pass" }',
95
+ },
96
+ Logout: {
97
+ description: 'log the current user out',
98
+ example: '{ "type": "Logout" }',
99
+ },
100
+ SubscribeSignal: {
101
+ description: 'subscribe to a signal so its updates are pushed to the client',
102
+ example: '{ "type": "SubscribeSignal", "signal": ".Some.Signal", "oneTime": false }',
103
+ },
104
+ UnsubscribeSignal: {
105
+ description: 'unsubscribe from a previously subscribed signal',
106
+ example: '{ "type": "UnsubscribeSignal", "signal": ".Some.Signal" }',
107
+ },
108
+ WriteSignalsInGroup: {
109
+ description: 'write all pending signal values of a named group',
110
+ example: '{ "type": "WriteSignalsInGroup", "group": "MyGroup" }',
111
+ },
112
+ ClearSignalsInGroup: {
113
+ description: 'clear all pending signal values of a named group',
114
+ example: '{ "type": "ClearSignalsInGroup", "group": "MyGroup" }',
115
+ },
116
+ RunScript: {
117
+ description: 'run another named script',
118
+ example: '{ "type": "RunScript", "name": "MyScript", "scriptType": "SimpleScript" }',
119
+ },
120
+ CopySignalValuesFromFolder: {
121
+ description: 'copy signal values from one signal folder to another',
122
+ example: '{ "type": "CopySignalValuesFromFolder", "sourceFolder": ".Source", "destinationFolder": ".Target" }',
123
+ },
124
+ ExportSignalValuesAsJson: {
125
+ description: 'export matching signal values as a downloadable JSON file',
126
+ example: '{ "type": "ExportSignalValuesAsJson", "regex": "^\\\\.Some\\\\..*", "fileName": "export.json" }',
127
+ },
128
+ ImportSignalValuesFromJson: {
129
+ description: 'import signal values from a JSON string',
130
+ example: '{ "type": "ImportSignalValuesFromJson", "data": "{ \\".Some.Signal\\": true }" }',
131
+ },
132
+ Repeat: {
133
+ description: 'jump back to a label a number of times, or indefinitely',
134
+ example: '{ "type": "Repeat", "label": "lbl_loop", "count": 0, "mode": "eventValid" }',
135
+ note: 'mode: "eventValid" (default, repeats until the event is no longer active) | "always" (repeats until count is 0 or indefinitely when count is 0).',
136
+ },
137
+ Condition: {
138
+ description: 'compare two values and jump to a label depending on the result',
139
+ example: '{ "type": "Condition", "value1": {"source":"signal","name":".Is.On"}, "value2": true,\n "comparisonType": "==", "trueGotoLabel": "lbl_off", "falseGotoLabel": "lbl_on" }',
140
+ note: 'comparisonType: ==null | !=null | ==true | ==false | == | != | > | < | >= | <= | && | ||.',
141
+ },
142
+ If: {
143
+ description: 'evaluate a formula and run nested commands depending on the result',
144
+ example: '{ "type": "If",\n "signals": [{"source":"signal","name":".Is.On"}, {"varName":"ready","source":"signal","name":".Is.Ready"}],\n "formula": "__0 == true && ready == false", "trueCommands": [], "elseCommands": [] }',
145
+ note: 'signals is a list of values (like Condition.value1). Each is referenced in the formula either positionally as __0, __1, ... or, if varName is set, by that name. trueCommands/elseCommands are edited as nested commands in the tree, not as JSON here.',
146
+ },
147
+ Exit: {
148
+ description: 'stop executing the current script chain',
149
+ example: '{ "type": "Exit" }',
150
+ },
151
+ Label: {
152
+ description: 'a named jump target for Condition / Goto / Repeat',
153
+ example: '{ "type": "Label", "label": "lbl_on" }',
154
+ },
155
+ Goto: {
156
+ description: 'jump unconditionally to a label',
157
+ example: '{ "type": "Goto", "label": "lbl_on" }',
158
+ },
159
+ };
@@ -1,6 +1,6 @@
1
1
  import { VisualisationElementScript } from "../interfaces/VisualisationElementScript.js";
2
2
  import { VisualizationHandler } from "../interfaces/VisualizationHandler.js";
3
- import { ScriptCommands, signalTarget } from "./ScriptCommands.js";
3
+ import { If, ScriptCommands, signalTarget } from "./ScriptCommands.js";
4
4
  export declare const cyclicAttributeName = "cyclic";
5
5
  export type contextType = {
6
6
  event: Event;
@@ -13,7 +13,7 @@ export declare class ScriptSystem {
13
13
  _visualizationHandler: VisualizationHandler;
14
14
  _subscriptionCallback: () => void;
15
15
  constructor(visualizationHandler: VisualizationHandler);
16
- execute(scriptCommands: ScriptCommands[], outerContext: contextType): Promise<void>;
16
+ execute(scriptCommands: ScriptCommands[], outerContext: contextType): Promise<boolean>;
17
17
  getValueFromTarget(target: signalTarget, name: string, context: contextType): Promise<any>;
18
18
  setValueOnTarget(target: signalTarget, name: string, context: contextType, value: any): Promise<void>;
19
19
  runExternalScript(name: string, type: string): Promise<void>;
@@ -23,6 +23,7 @@ export declare class ScriptSystem {
23
23
  getValue<T>(value: T, outerContext: contextType): Promise<T>;
24
24
  getStateOrFieldOrParameter(name: string, context: contextType): Promise<any>;
25
25
  parseStringWithValues(text: string, context: contextType): Promise<string>;
26
+ evaluateIfFormula(command: If, outerContext: contextType): Promise<boolean>;
26
27
  getSignalName(name: string, outerContext: contextType): string;
27
28
  createScriptContext(root: HTMLElement, event: Event, element: Element, parameters: Record<string, any>, relativeSignalsPath: string): any;
28
29
  assignAllScripts(source: string, javascriptCode: string, shadowRoot: ShadowRoot, instance: HTMLElement, visualizationHandler: VisualizationHandler, contextCreator?: (root: HTMLElement, event: Event, element: Element, parameters: Record<string, any>, relativeSignalsPath: string) => any, assignExternalScript?: (element: Element, event: string, scriptData: any) => void, runInitalization?: (jsObject: VisualisationElementScript) => void): Promise<VisualisationElementScript>;
@@ -22,6 +22,7 @@ export class ScriptSystem {
22
22
  async execute(scriptCommands, outerContext) {
23
23
  let repeatCount = -1;
24
24
  let eventNotValid = false;
25
+ let stopped = false;
25
26
  const triggerEvent = outerContext.event?.type;
26
27
  const cancelEvent = triggerEvent ? eventOpposites[triggerEvent] : null;
27
28
  if (cancelEvent) {
@@ -36,8 +37,18 @@ export class ScriptSystem {
36
37
  for (let i = 0; i < scriptCommands.length; i++) {
37
38
  let c = scriptCommands[i];
38
39
  if (c.type == "Exit") {
40
+ stopped = true;
39
41
  break;
40
42
  }
43
+ else if (c.type == "If") {
44
+ const res = await this.evaluateIfFormula(c, outerContext);
45
+ const branchCommands = (res ? c.trueCommands : c.elseCommands) ?? [];
46
+ const shouldContinue = await this.execute(branchCommands, outerContext);
47
+ if (!shouldContinue) {
48
+ stopped = true;
49
+ break;
50
+ }
51
+ }
41
52
  else if (c.type == "Goto") {
42
53
  const label = await this.getValue(c.label, outerContext);
43
54
  i = scriptCommands.findIndex(x => x.type == "Label" && x.label == label);
@@ -133,10 +144,12 @@ export class ScriptSystem {
133
144
  else {
134
145
  const continueScript = await this.runScriptCommand(c, outerContext);
135
146
  if (!continueScript) {
147
+ stopped = true;
136
148
  break;
137
149
  }
138
150
  }
139
151
  }
152
+ return !stopped;
140
153
  }
141
154
  async getValueFromTarget(target, name, context) {
142
155
  if (target === 'property') {
@@ -168,6 +181,7 @@ export class ScriptSystem {
168
181
  case 'Comment':
169
182
  case 'Label':
170
183
  case 'Condition':
184
+ case 'If':
171
185
  case 'Goto':
172
186
  case 'Exit':
173
187
  case 'Repeat':
@@ -514,6 +528,17 @@ export class ScriptSystem {
514
528
  }
515
529
  return nm;
516
530
  }
531
+ async evaluateIfFormula(command, outerContext) {
532
+ const entries = command.signals ?? [];
533
+ const varNames = entries.map((e, i) => e.varName?.trim() || '__' + i);
534
+ const values = await Promise.all(entries.map(e => this.getValue(e, outerContext)));
535
+ const formula = await this.getValue(command.formula, outerContext);
536
+ if (!command.compiledFormula || command._compiledFormulaSrc !== formula) {
537
+ command.compiledFormula = new Function(...varNames, 'return (' + formula + ');');
538
+ command._compiledFormulaSrc = formula;
539
+ }
540
+ return !!command.compiledFormula(...values);
541
+ }
517
542
  getSignalName(name, outerContext) {
518
543
  if (name[0] === '.')
519
544
  return outerContext.relativeSignalsPath + name;
@@ -1,5 +1,5 @@
1
1
  import { ScriptCommands, SetElementProperty } from "./ScriptCommands";
2
2
  export declare class ScriptUpgrades {
3
- static upgradeScriptCommand(scriptCommand: ScriptCommands): import("./ScriptCommands").OpenScreen | import("./ScriptCommands").OpenUrl | import("./ScriptCommands").OpenDialog | import("./ScriptCommands").CloseDialog | import("./ScriptCommands").ToggleSignalValue | import("./ScriptCommands").ToggleSignalValueThroughList | import("./ScriptCommands").SetSignalValue | import("./ScriptCommands").IncrementSignalValue | import("./ScriptCommands").DecrementSignalValue | import("./ScriptCommands").SetBitInSignal | import("./ScriptCommands").ClearBitInSignal | import("./ScriptCommands").ToggleBitInSignal | import("./ScriptCommands").Console | import("./ScriptCommands").CalculateSignalValue | import("./ScriptCommands").Javascript | SetElementProperty | import("./ScriptCommands").Delay | import("./ScriptCommands").SwitchLanguage | import("./ScriptCommands").Login | import("./ScriptCommands").Logout | import("./ScriptCommands").SubscribeSignal | import("./ScriptCommands").UnsubscribeSignal | import("./ScriptCommands").WriteSignalsInGroup | import("./ScriptCommands").ClearSignalsInGroup | import("./ScriptCommands").RunScript | import("./ScriptCommands").CopySignalValuesFromFolder | import("./ScriptCommands").ShowMessageBox | import("./ScriptCommands").ShowPrompt | import("./ScriptCommands").ExportSignalValuesAsJson | import("./ScriptCommands").ImportSignalValuesFromJson | import("./ScriptCommands").Repeat | import("./ScriptCommands").Comment | import("./ScriptCommands").Condition | import("./ScriptCommands").Exit | import("./ScriptCommands").Label | import("./ScriptCommands").Goto;
3
+ static upgradeScriptCommand(scriptCommand: ScriptCommands): import("./ScriptCommands").OpenScreen | import("./ScriptCommands").OpenUrl | import("./ScriptCommands").OpenDialog | import("./ScriptCommands").CloseDialog | import("./ScriptCommands").ToggleSignalValue | import("./ScriptCommands").ToggleSignalValueThroughList | import("./ScriptCommands").SetSignalValue | import("./ScriptCommands").IncrementSignalValue | import("./ScriptCommands").DecrementSignalValue | import("./ScriptCommands").SetBitInSignal | import("./ScriptCommands").ClearBitInSignal | import("./ScriptCommands").ToggleBitInSignal | import("./ScriptCommands").Console | import("./ScriptCommands").CalculateSignalValue | import("./ScriptCommands").Javascript | SetElementProperty | import("./ScriptCommands").Delay | import("./ScriptCommands").SwitchLanguage | import("./ScriptCommands").Login | import("./ScriptCommands").Logout | import("./ScriptCommands").SubscribeSignal | import("./ScriptCommands").UnsubscribeSignal | import("./ScriptCommands").WriteSignalsInGroup | import("./ScriptCommands").ClearSignalsInGroup | import("./ScriptCommands").RunScript | import("./ScriptCommands").CopySignalValuesFromFolder | import("./ScriptCommands").ShowMessageBox | import("./ScriptCommands").ShowPrompt | import("./ScriptCommands").ExportSignalValuesAsJson | import("./ScriptCommands").ImportSignalValuesFromJson | import("./ScriptCommands").Repeat | import("./ScriptCommands").Comment | import("./ScriptCommands").Condition | import("./ScriptCommands").If | import("./ScriptCommands").Exit | import("./ScriptCommands").Label | import("./ScriptCommands").Goto;
4
4
  static upgradeSetElementProperty(scriptCommand: SetElementProperty): SetElementProperty;
5
5
  }
@@ -4,6 +4,10 @@ export class ScriptUpgrades {
4
4
  if (scriptCommand.type === 'SetElementProperty') {
5
5
  return ScriptUpgrades.upgradeSetElementProperty(scriptCommand);
6
6
  }
7
+ if (scriptCommand.type === 'If') {
8
+ scriptCommand.trueCommands = (scriptCommand.trueCommands ?? []).map(c => ScriptUpgrades.upgradeScriptCommand(c));
9
+ scriptCommand.elseCommands = (scriptCommand.elseCommands ?? []).map(c => ScriptUpgrades.upgradeScriptCommand(c));
10
+ }
7
11
  return scriptCommand;
8
12
  }
9
13
  static upgradeSetElementProperty(scriptCommand) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "web-component-designer addon for visualizations",
3
3
  "name": "@node-projects/web-component-designer-visualization-addons",
4
- "version": "0.1.145",
4
+ "version": "0.1.147",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",
@@ -14,7 +14,7 @@
14
14
  "bundle": "esbuild ./dist/index.js --format=esm --minify --external:@node-projects/css-parser --external:@blockly/* --external:blockly --external:long --external:wunderbaum --external:@node-projects/* --platform=neutral --bundle --outfile=./dist/index-min.js"
15
15
  },
16
16
  "dependencies": {
17
- "@blockly/zoom-to-fit": ">=6.0.9",
17
+ "@blockly/zoom-to-fit": ">=13.0.0",
18
18
  "@node-projects/base-custom-webcomponent": ">=0.27.8",
19
19
  "@node-projects/css-parser": "^5.2.0",
20
20
  "@node-projects/propertygrid.webcomponent": ">=1.2.3",
@@ -22,7 +22,7 @@
22
22
  "@node-projects/web-component-designer": ">=0.1.224",
23
23
  "@node-projects/web-component-designer-codeview-monaco": ">=0.1.32",
24
24
  "@node-projects/web-component-designer-widgets-wunderbaum": ">=0.1.29",
25
- "blockly": ">=11.1.1",
25
+ "blockly": ">=13.0.0",
26
26
  "long": ">=5.2.3"
27
27
  },
28
28
  "devDependencies": {