iobroker.javascript 7.0.5 → 7.0.7

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/README.md CHANGED
@@ -46,6 +46,12 @@ Since v5.5.0 of the JavaScript adapter the following locations (relative to the
46
46
  <!--
47
47
  ### **WORK IN PROGRESS**
48
48
  -->
49
+ ### 7.0.7 (2023-06-12)
50
+ * (klein0r) Corrected trigger block
51
+ * (klein0r) Corrected typescript V5
52
+ * (bluefox) coffescript was degraded to the previous version
53
+ * (bluefox) tried to correct vscode font
54
+
49
55
  ### 7.0.5 (2023-06-06)
50
56
  * (klein0r) reset timeouts in blockly
51
57
  * (klein0r) added additional blockly blocks
@@ -69,14 +75,6 @@ Since v5.5.0 of the JavaScript adapter the following locations (relative to the
69
75
  * (AlCalzone) Pinned `@types/node` to v14
70
76
  * (bluefox) Added list of astrological events in GUI
71
77
 
72
- ### 6.2.0 (2023-02-17)
73
- * (Apollon77) Prevented duplicate schedule triggering with inaccurate RTC clocks
74
- * (Apollon77) Fixed sendToAsync and sendToHostAsync
75
- * (Apollon77) Added rename/renameFile(Async) methods
76
- * (Apollon77) Deprecated get/setBinaryState(Async) methods and log a message on usage. Use Files instead!
77
- * (Apollon77) Deprecated usage of own states in javascript.X.scriptEnabled/Problem and log a message on usage. Use own states in 0_userdata.0 instead!
78
- * (bluefox) added axios to pre-installed modules. `request` will be removed in the future
79
-
80
78
  ## License
81
79
  The MIT License (MIT)
82
80
 
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "files": {
3
- "main.js": "/static/js/main.eee05982.js",
3
+ "main.js": "/static/js/main.d86fb9de.js",
4
4
  "static/css/98.d346bb5b.chunk.css": "/static/css/98.d346bb5b.chunk.css",
5
- "static/js/98.3bc0a67c.chunk.js": "/static/js/98.3bc0a67c.chunk.js",
5
+ "static/js/98.f78be4fc.chunk.js": "/static/js/98.f78be4fc.chunk.js",
6
6
  "static/js/90.30165444.chunk.js": "/static/js/90.30165444.chunk.js",
7
7
  "static/js/305.11168aa5.chunk.js": "/static/js/305.11168aa5.chunk.js",
8
8
  "static/js/281.6af18b40.chunk.js": "/static/js/281.6af18b40.chunk.js",
@@ -143,9 +143,9 @@
143
143
  "static/media/Garage Doors.svg": "/static/media/Garage Doors.0c2a1cfca7ad1ea59625.svg",
144
144
  "static/media/Outdoor Blinds.svg": "/static/media/Outdoor Blinds.37b85a9c060a4af48da9.svg",
145
145
  "static/media/Upstairs.svg": "/static/media/Upstairs.441813e54e0daca0882d.svg",
146
- "main.eee05982.js.map": "/static/js/main.eee05982.js.map",
146
+ "main.d86fb9de.js.map": "/static/js/main.d86fb9de.js.map",
147
147
  "98.d346bb5b.chunk.css.map": "/static/css/98.d346bb5b.chunk.css.map",
148
- "98.3bc0a67c.chunk.js.map": "/static/js/98.3bc0a67c.chunk.js.map",
148
+ "98.f78be4fc.chunk.js.map": "/static/js/98.f78be4fc.chunk.js.map",
149
149
  "90.30165444.chunk.js.map": "/static/js/90.30165444.chunk.js.map",
150
150
  "305.11168aa5.chunk.js.map": "/static/js/305.11168aa5.chunk.js.map",
151
151
  "281.6af18b40.chunk.js.map": "/static/js/281.6af18b40.chunk.js.map",
@@ -166,6 +166,6 @@
166
166
  "472.dae7221e.chunk.js.map": "/static/js/472.dae7221e.chunk.js.map"
167
167
  },
168
168
  "entrypoints": [
169
- "static/js/main.eee05982.js"
169
+ "static/js/main.d86fb9de.js"
170
170
  ]
171
171
  }
@@ -805,10 +805,11 @@ Blockly.Blocks['cron_builder'] = {
805
805
  this.sourceBlock_.setInputsInline(option === true || option === 'true' || option === 'TRUE');
806
806
  }), 'LINE');
807
807
 
808
- const _input = this.appendValueInput('DOW')
808
+ let _input = this.appendValueInput('DOW')
809
809
  .appendField(Blockly.Translate('cron_builder_dow'));
810
810
 
811
- const wp = this.workspace;
811
+ const wp = this.workspace;
812
+
812
813
  setTimeout(function (_input) {
813
814
  if (!_input.connection.isConnected()) {
814
815
  const _shadow = wp.newBlock('text');
@@ -818,9 +819,9 @@ Blockly.Blocks['cron_builder'] = {
818
819
  }
819
820
  }, 100, _input);
820
821
 
821
-
822
822
  _input = this.appendValueInput('MONTHS')
823
823
  .appendField(Blockly.Translate('cron_builder_month'));
824
+
824
825
  setTimeout(function (_input) {
825
826
  if (!_input.connection.isConnected()) {
826
827
  const _shadow = wp.newBlock('text');
@@ -832,6 +833,7 @@ Blockly.Blocks['cron_builder'] = {
832
833
 
833
834
  _input = this.appendValueInput('DAYS')
834
835
  .appendField(Blockly.Translate('cron_builder_day'));
836
+
835
837
  setTimeout(function (_input) {
836
838
  if (!_input.connection.isConnected()) {
837
839
  const _shadow = wp.newBlock('text');
@@ -841,9 +843,9 @@ Blockly.Blocks['cron_builder'] = {
841
843
  }
842
844
  }, 100, _input);
843
845
 
844
-
845
846
  _input = this.appendValueInput('HOURS')
846
847
  .appendField(Blockly.Translate('cron_builder_hour'));
848
+
847
849
  setTimeout(function (_input) {
848
850
  if (!_input.connection.isConnected()) {
849
851
  const _shadow = wp.newBlock('text');
@@ -853,9 +855,9 @@ Blockly.Blocks['cron_builder'] = {
853
855
  }
854
856
  }, 100, _input);
855
857
 
856
-
857
858
  _input = this.appendValueInput('MINUTES')
858
859
  .appendField(Blockly.Translate('cron_builder_minutes'));
860
+
859
861
  setTimeout(function (_input) {
860
862
  if (!_input.connection.isConnected()) {
861
863
  const _shadow = wp.newBlock('text');
@@ -941,11 +943,11 @@ Blockly.JavaScript['cron_builder'] = function(block) {
941
943
  const code =
942
944
  (withSeconds === 'TRUE' || withSeconds === 'true' || withSeconds === true ?
943
945
  seconds + '.toString().trim() + \' \' + ' : '') +
944
- minutes + '.toString().trim() + \' \' + ' +
945
- hours + '.toString().trim() + \' \' + ' +
946
- days + '.toString().trim() + \' \' + ' +
947
- months + '.toString().trim() + \' \' + ' +
948
- dow + '.toString().trim()';
946
+ minutes + '.toString().trim() + \' \' + ' +
947
+ hours + '.toString().trim() + \' \' + ' +
948
+ days + '.toString().trim() + \' \' + ' +
949
+ months + '.toString().trim() + \' \' + ' +
950
+ dow + '.toString().trim()';
949
951
 
950
952
  return [code, Blockly.JavaScript.ORDER_ATOMIC]
951
953
  };
@@ -1,27 +1,3 @@
1
- /**
2
- * @license
3
- * Visual Blocks Editor
4
- *
5
- * Copyright 2012 Google Inc.
6
- * https://developers.google.com/blockly/
7
- *
8
- * Licensed under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License.
10
- * You may obtain a copy of the License at
11
- *
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
- *
14
- * Unless required by applicable law or agreed to in writing, software
15
- * distributed under the License is distributed on an "AS IS" BASIS,
16
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- * See the License for the specific language governing permissions and
18
- * limitations under the License.
19
- */
20
-
21
- /**
22
- * @fileoverview Text input field.
23
- * @author fraser@google.com (Neil Fraser)
24
- */
25
1
  'use strict';
26
2
 
27
3
  if (typeof goog !== 'undefined') {
@@ -36,7 +12,7 @@ if (typeof goog !== 'undefined') {
36
12
 
37
13
  Blockly.b64EncodeUnicode = function(text) {
38
14
  return btoa(encodeURIComponent(text).replace(/%([0-9A-F]{2})/g, function(match, p) {
39
- return String.fromCharCode(parseInt(p, 16))
15
+ return String.fromCharCode(parseInt(p, 16));
40
16
  }));
41
17
  };
42
18
 
@@ -44,7 +20,7 @@ Blockly.b64EncodeUnicode = function(text) {
44
20
  Blockly.b64DecodeUnicode = function(text) {
45
21
  try {
46
22
  return decodeURIComponent(Array.prototype.map.call(atob(text), function(s) {
47
- return '%' + ('00' + s.charCodeAt(0).toString(16)).slice(-2)
23
+ return '%' + ('00' + s.charCodeAt(0).toString(16)).slice(-2);
48
24
  }).join(''));
49
25
  } catch (e) {
50
26
  // old style
@@ -52,158 +28,136 @@ Blockly.b64DecodeUnicode = function(text) {
52
28
  }
53
29
  };
54
30
 
55
- /**
56
- * Class for an editable text field.
57
- * @param {string} text The initial content of the field.
58
- * @param {Function=} opt_validator An optional function that is called
59
- * to validate any constraints on what the user entered. Takes the new
60
- * text as an argument and returns either the accepted text, a replacement
61
- * text, or null to abort the change.
62
- * @extends {Blockly.Field}
63
- * @constructor
64
- */
65
- Blockly.FieldScript = function(text) {
66
- //Blockly.FieldScript.superClass_.constructor.call(this, text);
67
- };
68
- if (typeof goog !== 'undefined') {
69
- goog.inherits(Blockly.FieldScript, Blockly.Field);
70
- } else {
71
- Blockly.utils.object.inherits(Blockly.FieldScript, Blockly.Field);
72
- }
73
- /**
74
- * Point size of text. Should match blocklyText's font-size in CSS.
75
- */
76
- Blockly.FieldScript.FONTSIZE = 11;
77
-
78
- /**
79
- * Mouse cursor style when over the hotspot that initiates the editor.
80
- */
81
- Blockly.FieldScript.prototype.CURSOR = 'pointer';
82
-
83
- /**
84
- * Allow browser to spellcheck this field.
85
- * @private
86
- */
87
- Blockly.FieldScript.prototype.spellcheck_ = false;
88
-
89
- /**
90
- * Close the input widget if this input is being deleted.
91
- */
92
- Blockly.FieldScript.prototype.dispose = function() {
93
- Blockly.WidgetDiv.hideIfOwner(this);
94
- Blockly.FieldScript.superClass_.dispose.call(this);
95
- };
31
+ class FieldScript extends Blockly.Field {
32
+ constructor(value, type) {
33
+ super(value);
96
34
 
97
- /**
98
- * Set the text in this field.
99
- * @param {?string} text New text.
100
- * @override
101
- */
102
- Blockly.FieldScript.prototype.setValue = function (text) {
103
- if (text === null) {
104
- return; // No change if null.
35
+ this.FONTSIZE = 11;
36
+ this.CURSOR = 'pointer';
37
+ this.spellcheck_ = false;
105
38
  }
106
39
 
107
- Blockly.Field.prototype.setValue.call(this, text);
108
- };
109
-
110
- /**
111
- * Show the inline free-text editor on top of the text.
112
- * @param {boolean=} opt_quietInput True if editor should be created without
113
- * focus. Defaults to false.
114
- * @private
115
- */
116
- Blockly.FieldScript.prototype.showEditor_ = function(opt_quietInput) {
117
- this.workspace_ = this.sourceBlock_.workspace;
118
- var that = this;
119
- var base64 = that.getValue();
120
- var args = null;
121
- var isReturn = false;
122
- if (this.sourceBlock_ && this.sourceBlock_.arguments_) {
123
- args = this.sourceBlock_.arguments_;
124
- }
125
- if (this.sourceBlock_.getProcedureDef) {
126
- var options = this.sourceBlock_.getProcedureDef();
127
- isReturn = options[2];
40
+ dispose() {
41
+ Blockly.WidgetDiv.hideIfOwner(this);
42
+ super.dispose();
128
43
  }
129
44
 
130
- window.main.showScriptDialog(Blockly.b64DecodeUnicode(base64 || ''), args, isReturn, function (newScript) {
131
- newScript !== undefined && newScript !== null && that.setValue(Blockly.b64EncodeUnicode(newScript));
132
- });
133
- };
134
-
135
- /**
136
- * Draws the border with the correct width.
137
- * Saves the computed width in a property.
138
- * @private
139
- */
140
- Blockly.FieldScript.prototype.render_ = function() {
141
- // the implementation is taken from field.js => Blockly.Field.prototype.updateSize_
142
- var constants = this.getConstants();
143
- var xOffset = this.borderRect_ ? this.getConstants().FIELD_BORDER_RECT_X_PADDING : 0;
144
- var totalWidth = xOffset * 2 + 12;
145
- var totalHeight = constants.FIELD_TEXT_HEIGHT;
146
-
147
- if (this.borderRect_) {
148
- totalHeight = Math.max(totalHeight, constants.FIELD_BORDER_RECT_HEIGHT);
45
+ /**
46
+ * Set the text in this field.
47
+ * @param {?string} text New text.
48
+ * @override
49
+ */
50
+ setValue(text) {
51
+ if (text === null) {
52
+ return; // No change if null.
53
+ }
54
+
55
+ super.setValue(text);
149
56
  }
150
57
 
151
- this.size_.height = totalHeight;
152
- this.size_.width = totalWidth;
58
+ /**
59
+ * Show the inline free-text editor on top of the text.
60
+ * @param {boolean=} opt_quietInput True if editor should be created without
61
+ * focus. Defaults to false.
62
+ * @private
63
+ */
64
+ showEditor_(opt_quietInput) {
65
+ this.workspace_ = this.sourceBlock_.workspace;
66
+ var that = this;
67
+ var base64 = that.getValue();
68
+ var args = null;
69
+ var isReturn = false;
70
+
71
+ if (this.sourceBlock_ && this.sourceBlock_.arguments_) {
72
+ args = this.sourceBlock_.arguments_;
73
+ }
74
+ if (this.sourceBlock_.getProcedureDef) {
75
+ var options = this.sourceBlock_.getProcedureDef();
76
+ isReturn = options[2];
77
+ }
78
+
79
+ window.main.showScriptDialog(Blockly.b64DecodeUnicode(base64 || ''), args, isReturn, function (newScript) {
80
+ newScript !== undefined && newScript !== null && that.setValue(Blockly.b64EncodeUnicode(newScript));
81
+ });
82
+ }
153
83
 
154
- this.positionTextElement_(xOffset, 12);
155
- this.positionBorderRect_();
156
- this.textElement_.textContent = '...';
157
- };
84
+ /**
85
+ * Draws the border with the correct width.
86
+ * Saves the computed width in a property.
87
+ * @private
88
+ */
89
+ render_() {
90
+ // the implementation is taken from field.js => Blockly.Field.prototype.updateSize_
91
+ var constants = this.getConstants();
92
+ var xOffset = this.borderRect_ ? this.getConstants().FIELD_BORDER_RECT_X_PADDING : 0;
93
+ var totalWidth = xOffset * 2 + 12;
94
+ var totalHeight = constants.FIELD_TEXT_HEIGHT;
95
+
96
+ if (this.borderRect_) {
97
+ totalHeight = Math.max(totalHeight, constants.FIELD_BORDER_RECT_HEIGHT);
98
+ }
99
+
100
+ this.size_.height = totalHeight;
101
+ this.size_.width = totalWidth;
102
+
103
+ this.positionTextElement_(xOffset, 12);
104
+ this.positionBorderRect_();
105
+ this.textElement_.textContent = '...';
106
+ }
158
107
 
159
- /**
160
- * Update the text node of this field to display the current text.
161
- * @private
162
- */
163
- Blockly.FieldScript.prototype.updateTextNode_ = function() {
164
- var width = (Blockly.BlockSvg.SEP_SPACE_X || 5) * 3;
165
- if (!this.textElement_) {
166
- // Not rendered yet.
167
- return;
108
+ /**
109
+ * Update the text node of this field to display the current text.
110
+ * @private
111
+ */
112
+ updateTextNode_() {
113
+ var width = (Blockly.BlockSvg.SEP_SPACE_X || 5) * 3;
114
+ if (!this.textElement_) {
115
+ // Not rendered yet.
116
+ return;
117
+ }
118
+ // Empty the text element.
119
+ goog.dom.removeChildren(/** @type {!Element} */ (this.textElement_));
120
+
121
+ var textNode = document.createTextNode('...');
122
+ this.textElement_.appendChild(textNode);
123
+
124
+ // Cached width is obsolete. Clear it.
125
+ this.size_.width = width;
168
126
  }
169
- // Empty the text element.
170
- goog.dom.removeChildren(/** @type {!Element} */ (this.textElement_));
171
127
 
172
- var textNode = document.createTextNode('...');
173
- this.textElement_.appendChild(textNode);
128
+ /**
129
+ * Close the editor, save the results, and dispose of the editable
130
+ * text field's elements.
131
+ * @return {!Function} Closure to call on destruction of the WidgetDiv.
132
+ * @private
133
+ */
134
+ /*widgetDispose_() {
135
+ var thisField = this;
136
+ return function() {
137
+ var htmlInput = Blockly.FieldScript.htmlInput_;
138
+
139
+ // Save the edit (if it validates).
140
+ var text = htmlInput.value;
141
+ thisField.setValue(text);
142
+ thisField.sourceBlock_.rendered && thisField.sourceBlock_.render();
143
+ Blockly.unbindEvent_(htmlInput.onKeyDownWrapper_);
144
+ Blockly.unbindEvent_(htmlInput.onKeyUpWrapper_);
145
+ Blockly.unbindEvent_(htmlInput.onKeyPressWrapper_);
146
+
147
+ thisField.workspace_.removeChangeListener(
148
+ htmlInput.onWorkspaceChangeWrapper_);
149
+
150
+ Blockly.FieldScript.htmlInput_ = null;
151
+
152
+ // Delete style properties.
153
+ var style = Blockly.WidgetDiv.DIV.style;
154
+ style.width = 'auto';
155
+ style.height = 'auto';
156
+ style.fontSize = '';
157
+ };
158
+ }*/
159
+ }
174
160
 
175
- // Cached width is obsolete. Clear it.
176
- this.size_.width = width;
177
- };
161
+ Blockly.FieldScript = FieldScript;
178
162
 
179
- /**
180
- * Close the editor, save the results, and dispose of the editable
181
- * text field's elements.
182
- * @return {!Function} Closure to call on destruction of the WidgetDiv.
183
- * @private
184
- */
185
- /*Blockly.FieldScript.prototype.widgetDispose_ = function() {
186
- var thisField = this;
187
- return function() {
188
- var htmlInput = Blockly.FieldScript.htmlInput_;
189
-
190
- // Save the edit (if it validates).
191
- var text = htmlInput.value;
192
- thisField.setValue(text);
193
- thisField.sourceBlock_.rendered && thisField.sourceBlock_.render();
194
- Blockly.unbindEvent_(htmlInput.onKeyDownWrapper_);
195
- Blockly.unbindEvent_(htmlInput.onKeyUpWrapper_);
196
- Blockly.unbindEvent_(htmlInput.onKeyPressWrapper_);
197
-
198
- thisField.workspace_.removeChangeListener(
199
- htmlInput.onWorkspaceChangeWrapper_);
200
-
201
- Blockly.FieldScript.htmlInput_ = null;
202
-
203
- // Delete style properties.
204
- var style = Blockly.WidgetDiv.DIV.style;
205
- style.width = 'auto';
206
- style.height = 'auto';
207
- style.fontSize = '';
208
- };
209
- };*/
163
+ // Blockly.fieldRegistry.register('field_script', FieldScript);