@node-projects/web-component-designer-visualization-addons 0.1.0

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.
Files changed (78) hide show
  1. package/README.md +19 -0
  2. package/dist/blockly/BlocklyJavascriptHelper.d.ts +2 -0
  3. package/dist/blockly/BlocklyJavascriptHelper.js +35 -0
  4. package/dist/blockly/BlocklyScriptEditor.d.ts +16 -0
  5. package/dist/blockly/BlocklyScriptEditor.js +106 -0
  6. package/dist/blockly/BlocklyToolbox.d.ts +1117 -0
  7. package/dist/blockly/BlocklyToolbox.js +980 -0
  8. package/dist/blockly/components/Console.d.ts +0 -0
  9. package/dist/blockly/components/Console.js +26 -0
  10. package/dist/blockly/components/Debugger.d.ts +0 -0
  11. package/dist/blockly/components/Debugger.js +15 -0
  12. package/dist/blockly/components/GetState.d.ts +0 -0
  13. package/dist/blockly/components/GetState.js +21 -0
  14. package/dist/blockly/components/GetSubProperty.d.ts +0 -0
  15. package/dist/blockly/components/GetSubProperty.js +27 -0
  16. package/dist/blockly/components/OpenScreen.d.ts +0 -0
  17. package/dist/blockly/components/OpenScreen.js +31 -0
  18. package/dist/blockly/components/QuerySelector.d.ts +0 -0
  19. package/dist/blockly/components/QuerySelector.js +30 -0
  20. package/dist/blockly/components/QuerySelectorAll.d.ts +0 -0
  21. package/dist/blockly/components/QuerySelectorAll.js +30 -0
  22. package/dist/blockly/components/Return.d.ts +0 -0
  23. package/dist/blockly/components/Return.js +21 -0
  24. package/dist/blockly/components/SetElement.d.ts +0 -0
  25. package/dist/blockly/components/SetElement.js +44 -0
  26. package/dist/blockly/components/SetState.d.ts +0 -0
  27. package/dist/blockly/components/SetState.js +26 -0
  28. package/dist/blockly/components/StartEvent.d.ts +0 -0
  29. package/dist/blockly/components/StartEvent.js +23 -0
  30. package/dist/blockly/components/components.d.ts +11 -0
  31. package/dist/blockly/components/components.js +11 -0
  32. package/dist/blockly/components/fields/FieldObjectId.d.ts +1 -0
  33. package/dist/blockly/components/fields/FieldObjectId.js +6 -0
  34. package/dist/components/BindingsEditor.d.ts +49 -0
  35. package/dist/components/BindingsEditor.js +298 -0
  36. package/dist/components/BindingsEditorHistoric.d.ts +14 -0
  37. package/dist/components/BindingsEditorHistoric.js +97 -0
  38. package/dist/components/PropertyGridExt.d.ts +0 -0
  39. package/dist/components/PropertyGridExt.js +1 -0
  40. package/dist/components/ScriptEditor.d.ts +28 -0
  41. package/dist/components/ScriptEditor.js +254 -0
  42. package/dist/components/VisualizationPropertyGrid.d.ts +12 -0
  43. package/dist/components/VisualizationPropertyGrid.js +104 -0
  44. package/dist/helpers/BindingsHelper.d.ts +47 -0
  45. package/dist/helpers/BindingsHelper.js +642 -0
  46. package/dist/index.d.ts +21 -0
  47. package/dist/index.js +22 -0
  48. package/dist/interfaces/IScriptMultiplexValue.d.ts +15 -0
  49. package/dist/interfaces/IScriptMultiplexValue.js +15 -0
  50. package/dist/interfaces/VisualisationElementScript.d.ts +5 -0
  51. package/dist/interfaces/VisualisationElementScript.js +1 -0
  52. package/dist/interfaces/VisualizationBinding.d.ts +20 -0
  53. package/dist/interfaces/VisualizationBinding.js +4 -0
  54. package/dist/interfaces/VisualizationHandler.d.ts +24 -0
  55. package/dist/interfaces/VisualizationHandler.js +2 -0
  56. package/dist/interfaces/VisualizationShell.d.ts +13 -0
  57. package/dist/interfaces/VisualizationShell.js +1 -0
  58. package/dist/interfaces/VisualizationUiHandler.d.ts +5 -0
  59. package/dist/interfaces/VisualizationUiHandler.js +2 -0
  60. package/dist/scripting/Script.d.ts +6 -0
  61. package/dist/scripting/Script.js +5 -0
  62. package/dist/scripting/ScriptCommands.d.ts +192 -0
  63. package/dist/scripting/ScriptCommands.js +1 -0
  64. package/dist/scripting/ScriptSystem.d.ts +23 -0
  65. package/dist/scripting/ScriptSystem.js +224 -0
  66. package/dist/services/BindableObjectDragDropService.d.ts +16 -0
  67. package/dist/services/BindableObjectDragDropService.js +145 -0
  68. package/dist/services/BindingsService.d.ts +11 -0
  69. package/dist/services/BindingsService.js +46 -0
  70. package/dist/services/PropertyGridDragDropService.d.ts +7 -0
  71. package/dist/services/PropertyGridDragDropService.js +10 -0
  72. package/dist/services/ScriptRefactorService.d.ts +9 -0
  73. package/dist/services/ScriptRefactorService.js +79 -0
  74. package/dist/services/SignalPropertyEditor.d.ts +7 -0
  75. package/dist/services/SignalPropertyEditor.js +43 -0
  76. package/dist/setupVisuService.d.ts +0 -0
  77. package/dist/setupVisuService.js +1 -0
  78. package/package.json +29 -0
File without changes
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ //@ts-ignore
3
+ Blockly.Blocks['console'] = {
4
+ init: function () {
5
+ this.appendDummyInput()
6
+ .appendField('console')
7
+ //@ts-ignore
8
+ .appendField(new Blockly.FieldDropdown([["debug", "DEBUG"], ["error", "ERROR"], ["info", "INFO"], ["log", "LOG"], ["warn", "WARN"]]), "LEVEL");
9
+ this.appendValueInput('VALUE')
10
+ .setCheck(null)
11
+ .appendField('value');
12
+ this.setInputsInline(true);
13
+ this.setPreviousStatement(true, null);
14
+ this.setNextStatement(true, null);
15
+ this.setColour(230);
16
+ }
17
+ };
18
+ //@ts-ignore
19
+ Blockly.JavaScript['console'] = function (block) {
20
+ var level = block.getFieldValue('LEVEL');
21
+ //@ts-ignore
22
+ const value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC);
23
+ let code = `console['${level.toLowerCase()}'](${value});
24
+ `;
25
+ return code;
26
+ };
File without changes
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ //@ts-ignore
3
+ Blockly.Blocks['debugger'] = {
4
+ init: function () {
5
+ this.appendDummyInput()
6
+ .appendField("debugger");
7
+ this.setPreviousStatement(true, null);
8
+ this.setNextStatement(true, null);
9
+ this.setColour(230);
10
+ }
11
+ };
12
+ //@ts-ignore
13
+ Blockly.JavaScript['debugger'] = function (block) {
14
+ return 'debugger;\n';
15
+ };
File without changes
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ //@ts-ignore
3
+ Blockly.Blocks['get_state'] = {
4
+ init: function () {
5
+ this.appendValueInput('OID')
6
+ .setCheck("String")
7
+ //@ts-ignore
8
+ .appendField('get_state');
9
+ this.setInputsInline(true);
10
+ this.setOutput(true, null);
11
+ this.setColour(230);
12
+ }
13
+ };
14
+ //@ts-ignore
15
+ Blockly.JavaScript['get_state'] = function (block, generator) {
16
+ //@ts-ignore
17
+ const id = Blockly.JavaScript.valueToCode(block, 'OID', Blockly.JavaScript.ORDER_ATOMIC);
18
+ const code = `(await IOB.getState(${id})).val`;
19
+ //@ts-ignore
20
+ return [code, Blockly.JavaScript.ORDER_NONE];
21
+ };
File without changes
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ //@ts-ignore
3
+ Blockly.Blocks['get_sub_property'] = {
4
+ init: function () {
5
+ this.appendDummyInput()
6
+ .appendField("getSubProperty");
7
+ this.appendValueInput('OBJECT')
8
+ .setCheck('Object')
9
+ .appendField('object');
10
+ this.appendValueInput('PROPERTYPATH')
11
+ .setCheck("String")
12
+ .appendField('propertypath');
13
+ this.setInputsInline(true);
14
+ this.setOutput(true, null);
15
+ this.setColour(230);
16
+ }
17
+ };
18
+ //@ts-ignore
19
+ Blockly.JavaScript['get_sub_property'] = function (block, generator) {
20
+ //@ts-ignore
21
+ const obj = Blockly.JavaScript.valueToCode(block, 'OBJECT', Blockly.JavaScript.ORDER_ATOMIC);
22
+ //@ts-ignore
23
+ const propertypath = Blockly.JavaScript.valueToCode(block, 'PROPERTYPATH', Blockly.JavaScript.ORDER_ATOMIC);
24
+ const code = `extractPart(${obj}, ${propertypath})`;
25
+ //@ts-ignore
26
+ return [code, Blockly.JavaScript.ORDER_NONE];
27
+ };
File without changes
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ //@ts-ignore
3
+ Blockly.Blocks['open_screen'] = {
4
+ init: function () {
5
+ this.appendDummyInput()
6
+ .appendField('open screen');
7
+ this.appendValueInput('SCREEN')
8
+ .setCheck('String')
9
+ .appendField('screen');
10
+ this.appendValueInput('RELATIVESIGNALSPATH')
11
+ .setCheck("String")
12
+ .appendField('relativeSignalsPath');
13
+ this.appendValueInput('NOHISTORY')
14
+ .setCheck("Boolean")
15
+ .appendField('noHistory');
16
+ this.setPreviousStatement(true, null);
17
+ this.setNextStatement(true, null);
18
+ this.setColour(230);
19
+ }
20
+ };
21
+ //@ts-ignore
22
+ Blockly.JavaScript['open_screen'] = function (block) {
23
+ //@ts-ignore
24
+ const screen = Blockly.JavaScript.valueToCode(block, 'SCREEN', Blockly.JavaScript.ORDER_ATOMIC);
25
+ //@ts-ignore
26
+ const relativeSignalsPath = Blockly.JavaScript.valueToCode(block, 'RELATIVESIGNALSPATH', Blockly.JavaScript.ORDER_ATOMIC);
27
+ //@ts-ignore
28
+ const noHistory = Blockly.JavaScript.valueToCode(block, 'NOHISTORY', Blockly.JavaScript.ORDER_ATOMIC);
29
+ let code = `RUNTIME.openScreen({screen: ${screen}, relativeSignalsPath: ${relativeSignalsPath}, noHistory: ${noHistory}})`;
30
+ return code;
31
+ };
File without changes
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ //@ts-ignore
3
+ Blockly.Blocks['query_selector'] = {
4
+ init: function () {
5
+ this.appendDummyInput()
6
+ .appendField('querySelector')
7
+ //@ts-ignore
8
+ .appendField(new Blockly.FieldDropdown([["currentScreen", "CURRENTSCREEN"], ["parentScreen", "PARENTSCREEN"]]), "SOURCE");
9
+ this.appendValueInput('SELECTOR')
10
+ .setCheck("String")
11
+ //@ts-ignore
12
+ .appendField('selector');
13
+ this.setInputsInline(true);
14
+ this.setOutput(true, 'Element');
15
+ this.setColour(230);
16
+ }
17
+ };
18
+ //@ts-ignore
19
+ Blockly.JavaScript['query_selector'] = function (block, generator) {
20
+ var dropdown_source = block.getFieldValue('SOURCE');
21
+ //@ts-ignore
22
+ const selector = Blockly.JavaScript.valueToCode(block, 'SELECTOR', Blockly.JavaScript.ORDER_ATOMIC);
23
+ let code;
24
+ if (dropdown_source === 'CURRENTSCREEN')
25
+ code = `shadowRoot.querySelector(${selector})`;
26
+ else if (dropdown_source === 'PARENTSCREEN')
27
+ code = `shadowRoot.host.getRootNode().querySelector(${selector})`;
28
+ //@ts-ignore
29
+ return [code, Blockly.JavaScript.ORDER_NONE];
30
+ };
File without changes
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ //@ts-ignore
3
+ Blockly.Blocks['query_selector_all'] = {
4
+ init: function () {
5
+ this.appendDummyInput()
6
+ .appendField('querySelectorAll')
7
+ //@ts-ignore
8
+ .appendField(new Blockly.FieldDropdown([["currentScreen", "CURRENTSCREEN"], ["parentScreen", "PARENTSCREEN"]]), "SOURCE");
9
+ this.appendValueInput('SELECTOR')
10
+ .setCheck("String")
11
+ //@ts-ignore
12
+ .appendField('selector');
13
+ this.setInputsInline(true);
14
+ this.setOutput(true, 'Array');
15
+ this.setColour(230);
16
+ }
17
+ };
18
+ //@ts-ignore
19
+ Blockly.JavaScript['query_selector_all'] = function (block, generator) {
20
+ var dropdown_source = block.getFieldValue('SOURCE');
21
+ //@ts-ignore
22
+ const selector = Blockly.JavaScript.valueToCode(block, 'SELECTOR', Blockly.JavaScript.ORDER_ATOMIC);
23
+ let code;
24
+ if (dropdown_source === 'CURRENTSCREEN')
25
+ code = `shadowRoot.querySelectorall(${selector})`;
26
+ else if (dropdown_source === 'PARENTSCREEN')
27
+ code = `shadowRoot.querySelectorall(${selector})`;
28
+ //@ts-ignore
29
+ return [code, Blockly.JavaScript.ORDER_NONE];
30
+ };
File without changes
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ //@ts-ignore
3
+ Blockly.Blocks['return'] = {
4
+ init: function () {
5
+ this.appendDummyInput()
6
+ .appendField("return");
7
+ this.appendValueInput("VALUE")
8
+ .setCheck(null)
9
+ .appendField("value");
10
+ this.setInputsInline(true);
11
+ this.setPreviousStatement(true, null);
12
+ this.setColour(230);
13
+ }
14
+ };
15
+ //@ts-ignore
16
+ Blockly.JavaScript['return'] = function (block) {
17
+ //@ts-ignore
18
+ const value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC);
19
+ let code = 'return ' + value + ';';
20
+ return code;
21
+ };
File without changes
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ //@ts-ignore
3
+ Blockly.Blocks['set_element'] = {
4
+ init: function () {
5
+ this.appendDummyInput()
6
+ .appendField('setElement')
7
+ //@ts-ignore
8
+ .appendField(new Blockly.FieldDropdown([["property", "PROPERTY"], ["attribute", "ATTRIBUTE"], ["style", "STYLE"]]), "TARGET");
9
+ this.appendValueInput('ELEMENT')
10
+ .setCheck('Element')
11
+ .appendField('element');
12
+ this.appendValueInput('NAME')
13
+ .setCheck("String")
14
+ .appendField('name');
15
+ this.appendValueInput('VALUE')
16
+ .setCheck(null)
17
+ .appendField('value');
18
+ this.setInputsInline(true);
19
+ this.setPreviousStatement(true, null);
20
+ this.setNextStatement(true, null);
21
+ this.setColour(230);
22
+ }
23
+ };
24
+ //@ts-ignore
25
+ Blockly.JavaScript['set_element'] = function (block) {
26
+ var dropdown_target = block.getFieldValue('TARGET');
27
+ //@ts-ignore
28
+ const element = Blockly.JavaScript.valueToCode(block, 'ELEMENT', Blockly.JavaScript.ORDER_ATOMIC);
29
+ //@ts-ignore
30
+ const name = Blockly.JavaScript.valueToCode(block, 'NAME', Blockly.JavaScript.ORDER_ATOMIC);
31
+ //@ts-ignore
32
+ const value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC);
33
+ let code = '';
34
+ if (dropdown_target === 'PROPERTY') {
35
+ code += element + '[' + name + '] = ' + value + ';\n';
36
+ }
37
+ else if (dropdown_target === 'ATTRIBUTE') {
38
+ code += element + '.setAttribute(' + name + ', ' + value + ');\n';
39
+ }
40
+ else if (dropdown_target === 'STYLE') {
41
+ code += element + '.style[' + name + '] = ' + value + ';\n';
42
+ }
43
+ return code;
44
+ };
File without changes
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ //@ts-ignore
3
+ Blockly.Blocks['set_state'] = {
4
+ init: function () {
5
+ this.appendValueInput('OID')
6
+ .setCheck("String")
7
+ //@ts-ignore
8
+ .appendField('set_state');
9
+ this.appendValueInput('VALUE')
10
+ .setCheck(null)
11
+ .appendField('with');
12
+ this.setInputsInline(true);
13
+ this.setPreviousStatement(true, null);
14
+ this.setNextStatement(true, null);
15
+ this.setColour(230);
16
+ }
17
+ };
18
+ //@ts-ignore
19
+ Blockly.JavaScript['set_state'] = function (block) {
20
+ //@ts-ignore
21
+ const id = Blockly.JavaScript.valueToCode(block, 'OID', Blockly.JavaScript.ORDER_ATOMIC);
22
+ //@ts-ignore
23
+ const value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC);
24
+ const code = `await IOB.setState(${id}, ${value});\n`;
25
+ return code;
26
+ };
File without changes
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ //@ts-ignore
3
+ Blockly.defineBlocksWithJsonArray([
4
+ {
5
+ 'type': 'start_event',
6
+ 'message0': 'Event %1',
7
+ 'nextStatement': null,
8
+ 'style': 'hat_blocks',
9
+ 'args0': [
10
+ {
11
+ 'type': 'field_variable',
12
+ 'name': 'EVENTVAR',
13
+ 'variable': 'event'
14
+ }
15
+ ],
16
+ },
17
+ ]);
18
+ //@ts-ignore
19
+ Blockly.JavaScript['start_event'] = function (block) {
20
+ //@ts-ignore
21
+ let name = Blockly.JavaScript.getVariableName(block.getField('EVENTVAR').variable.name);
22
+ return name + ' = ' + 'eventData;\n';
23
+ };
@@ -0,0 +1,11 @@
1
+ import './fields/FieldObjectId.js';
2
+ import './Console.js';
3
+ import './Debugger.js';
4
+ import './GetState.js';
5
+ import './GetSubProperty.js';
6
+ import './OpenScreen.js';
7
+ import './QuerySelector.js';
8
+ import './QuerySelectorAll.js';
9
+ import './SetElement.js';
10
+ import './SetState.js';
11
+ import './StartEvent.js';
@@ -0,0 +1,11 @@
1
+ import './fields/FieldObjectId.js';
2
+ import './Console.js';
3
+ import './Debugger.js';
4
+ import './GetState.js';
5
+ import './GetSubProperty.js';
6
+ import './OpenScreen.js';
7
+ import './QuerySelector.js';
8
+ import './QuerySelectorAll.js';
9
+ import './SetElement.js';
10
+ import './SetState.js';
11
+ import './StartEvent.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ //@ts-ignore
2
+ class FieldObjectId extends Blockly.FieldTextInput {
3
+ }
4
+ //@ts-ignore
5
+ Blockly.FieldObjectId = FieldObjectId;
6
+ export {};
@@ -0,0 +1,49 @@
1
+ import { BaseCustomWebComponentConstructorAppend } from '@node-projects/base-custom-webcomponent';
2
+ import { BindingTarget, IBinding, IProperty, ServiceContainer } from '@node-projects/web-component-designer';
3
+ import { VisualizationShell } from '../interfaces/VisualizationShell.js';
4
+ export declare class BindingsEditor extends BaseCustomWebComponentConstructorAppend {
5
+ static readonly template: HTMLTemplateElement;
6
+ static readonly style: CSSStyleSheet;
7
+ static readonly is = "iobroker-webui-dynamics-editor";
8
+ static readonly properties: {
9
+ twoWayPossible: BooleanConstructor;
10
+ twoWay: BooleanConstructor;
11
+ expression: StringConstructor;
12
+ objectNames: StringConstructor;
13
+ events: StringConstructor;
14
+ invert: BooleanConstructor;
15
+ converters: ArrayConstructor;
16
+ historic: ObjectConstructor;
17
+ };
18
+ twoWayPossible: boolean;
19
+ twoWay: boolean;
20
+ expression: string;
21
+ expressionTwoWay: string;
22
+ historic: any;
23
+ objectNames: string;
24
+ events: string;
25
+ invert: boolean;
26
+ converters: {
27
+ key: string;
28
+ value: any;
29
+ }[];
30
+ objectValueType: string;
31
+ private _property;
32
+ private _binding;
33
+ private _bindingTarget;
34
+ private _serviceContainer;
35
+ private _shell;
36
+ private _activeRow;
37
+ constructor(property: IProperty, binding: IBinding & {
38
+ converter: Record<string, any>;
39
+ }, bindingTarget: BindingTarget, servieContainer: ServiceContainer, shell: VisualizationShell);
40
+ ready(): void;
41
+ _focusRow(index: number): void;
42
+ _updatefocusedRow(): void;
43
+ _clear(): void;
44
+ _refresh(): void;
45
+ _select(): Promise<void>;
46
+ showHistoric(): Promise<void>;
47
+ addConverter(): void;
48
+ removeConverter(): void;
49
+ }