@node-projects/web-component-designer-visualization-addons 0.1.24 → 0.1.26

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.
@@ -9,6 +9,12 @@ const prefix = `function extractPart(obj, propertyPath) {
9
9
  return retVal;
10
10
  }
11
11
 
12
+ function delay(ms) {
13
+ return new Promise(res => {
14
+ setTimeout(() => res(), ms);
15
+ });
16
+ }
17
+
12
18
  export async function run(eventData, shadowRoot, parameters, relativeSignalsPath) {
13
19
  `;
14
20
  const postfix = `}`;
@@ -28,6 +34,8 @@ export async function generateEventCodeFromBlockly(data) {
28
34
  //@ts-ignore
29
35
  Blockly.JavaScript.addReservedWords('relativeSignalsPath');
30
36
  //@ts-ignore
37
+ Blockly.JavaScript.addReservedWords('delay');
38
+ //@ts-ignore
31
39
  Blockly.JavaScript.addReservedWords('IOB');
32
40
  //@ts-ignore
33
41
  Blockly.JavaScript.addReservedWords('RUNTIME');
@@ -9,6 +9,24 @@ declare const _default: {
9
9
  kind: string;
10
10
  type: string;
11
11
  inputs?: undefined;
12
+ } | {
13
+ kind: string;
14
+ type: string;
15
+ inputs: {
16
+ DELAY: {
17
+ shadow: {
18
+ type: string;
19
+ fields: {
20
+ NUM: number;
21
+ };
22
+ };
23
+ };
24
+ SCREEN?: undefined;
25
+ OID?: undefined;
26
+ NAME?: undefined;
27
+ PROPERTYPATH?: undefined;
28
+ SELECTOR?: undefined;
29
+ };
12
30
  } | {
13
31
  kind: string;
14
32
  type: string;
@@ -21,6 +39,7 @@ declare const _default: {
21
39
  };
22
40
  };
23
41
  };
42
+ DELAY?: undefined;
24
43
  OID?: undefined;
25
44
  NAME?: undefined;
26
45
  PROPERTYPATH?: undefined;
@@ -38,6 +57,7 @@ declare const _default: {
38
57
  };
39
58
  };
40
59
  };
60
+ DELAY?: undefined;
41
61
  SCREEN?: undefined;
42
62
  NAME?: undefined;
43
63
  PROPERTYPATH?: undefined;
@@ -55,6 +75,7 @@ declare const _default: {
55
75
  };
56
76
  };
57
77
  };
78
+ DELAY?: undefined;
58
79
  SCREEN?: undefined;
59
80
  OID?: undefined;
60
81
  PROPERTYPATH?: undefined;
@@ -72,6 +93,7 @@ declare const _default: {
72
93
  };
73
94
  };
74
95
  };
96
+ DELAY?: undefined;
75
97
  SCREEN?: undefined;
76
98
  OID?: undefined;
77
99
  NAME?: undefined;
@@ -89,6 +111,7 @@ declare const _default: {
89
111
  };
90
112
  };
91
113
  };
114
+ DELAY?: undefined;
92
115
  SCREEN?: undefined;
93
116
  OID?: undefined;
94
117
  NAME?: undefined;
@@ -28,6 +28,20 @@ export default {
28
28
  kind: 'block',
29
29
  type: 'debugger',
30
30
  },
31
+ {
32
+ kind: 'block',
33
+ type: 'delay',
34
+ inputs: {
35
+ DELAY: {
36
+ shadow: {
37
+ type: 'math_number',
38
+ fields: {
39
+ NUM: 1000,
40
+ },
41
+ },
42
+ },
43
+ },
44
+ },
31
45
  {
32
46
  kind: 'block',
33
47
  type: 'open_screen',
File without changes
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ //@ts-ignore
3
+ Blockly.Blocks['delay'] = {
4
+ init: function () {
5
+ this.appendValueInput('DELAY')
6
+ .setCheck("Number")
7
+ .appendField('delay');
8
+ this.setInputsInline(true);
9
+ this.setPreviousStatement(true, null);
10
+ this.setNextStatement(true, null);
11
+ this.setColour(230);
12
+ }
13
+ };
14
+ //@ts-ignore
15
+ Blockly.JavaScript['delay'] = function (block) {
16
+ //@ts-ignore
17
+ const delay = Blockly.JavaScript.valueToCode(block, 'DELAY', Blockly.JavaScript.ORDER_ATOMIC);
18
+ let code = 'await delay(' + delay + ')';
19
+ return code;
20
+ };
@@ -1,5 +1,6 @@
1
1
  import './Console.js';
2
2
  import './Debugger.js';
3
+ import './Delay.js';
3
4
  import './GetParameter.js';
4
5
  import './GetState.js';
5
6
  import './GetSubProperty.js';
@@ -1,5 +1,6 @@
1
1
  import './Console.js';
2
2
  import './Debugger.js';
3
+ import './Delay.js';
3
4
  import './GetParameter.js';
4
5
  import './GetState.js';
5
6
  import './GetSubProperty.js';
@@ -191,7 +191,7 @@ export class BindingsHelper {
191
191
  else if (!isLit(element) && binding.events?.[0] == targetName + '-changed')
192
192
  delete bindingCopy.events;
193
193
  }
194
- const eventsString = binding.events?.length > 0 ? '::' + binding.events.join(',') : '';
194
+ const eventsString = binding.twoWay && binding.events?.length > 0 ? '::' + binding.events.join(',') : '';
195
195
  if (binding.target == BindingTarget.property &&
196
196
  !binding.expression && !binding.expressionTwoWay &&
197
197
  binding.converter == null &&
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.24",
4
+ "version": "0.1.26",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",