iobroker.javascript 7.0.10 → 7.1.1

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 (52) hide show
  1. package/README.md +5 -5
  2. package/admin/asset-manifest.json +9 -9
  3. package/admin/google-blockly/blockly-9.3.3.tgz +0 -0
  4. package/admin/google-blockly/blockly_compressed.js +1704 -1469
  5. package/admin/google-blockly/blocks_compressed.js +218 -164
  6. package/admin/google-blockly/javascript_compressed.js +328 -100
  7. package/admin/google-blockly/msg/js/de.js +70 -64
  8. package/admin/google-blockly/msg/js/en.js +20 -14
  9. package/admin/google-blockly/msg/js/es.js +45 -39
  10. package/admin/google-blockly/msg/js/fr.js +65 -59
  11. package/admin/google-blockly/msg/js/it.js +25 -19
  12. package/admin/google-blockly/msg/js/nl.js +61 -55
  13. package/admin/google-blockly/msg/js/pl.js +52 -46
  14. package/admin/google-blockly/msg/js/pt.js +36 -30
  15. package/admin/google-blockly/msg/js/ru.js +47 -41
  16. package/admin/google-blockly/msg/js/uk.js +17 -13
  17. package/admin/google-blockly/msg/js/zh-cn.js +92 -86
  18. package/admin/google-blockly/own/blocks_action.js +4 -4
  19. package/admin/google-blockly/own/blocks_number.js +4 -3
  20. package/admin/google-blockly/own/blocks_procedures.js +106 -75
  21. package/admin/google-blockly/own/blocks_sendto.js +2 -2
  22. package/admin/google-blockly/own/blocks_switch.js +8 -19
  23. package/admin/google-blockly/own/blocks_system.js +171 -113
  24. package/admin/google-blockly/own/blocks_text.js +1 -1
  25. package/admin/google-blockly/own/blocks_time.js +2 -1
  26. package/admin/google-blockly/own/blocks_timeout.js +31 -27
  27. package/admin/google-blockly/own/blocks_trigger.js +62 -44
  28. package/admin/google-blockly/own/blocks_words.js +3 -3
  29. package/admin/google-blockly/own/field_cron.js +138 -189
  30. package/admin/google-blockly/own/field_oid.js +167 -249
  31. package/admin/google-blockly/own/field_script.js +124 -170
  32. package/admin/static/js/472.d73f9bde.chunk.js +3 -0
  33. package/admin/static/js/472.d73f9bde.chunk.js.map +1 -0
  34. package/admin/static/js/{512.6503862a.chunk.js → 512.e71b2bc3.chunk.js} +3 -3
  35. package/admin/static/js/512.e71b2bc3.chunk.js.map +1 -0
  36. package/admin/static/js/98.ecb7402b.chunk.js +2 -0
  37. package/admin/static/js/98.ecb7402b.chunk.js.map +1 -0
  38. package/admin/static/js/{main.d5dc2784.js → main.b8836dea.js} +2 -2
  39. package/admin/static/js/main.b8836dea.js.map +1 -0
  40. package/admin/tab.html +1 -1
  41. package/io-package.json +26 -26
  42. package/main.js +9 -10
  43. package/package.json +4 -4
  44. package/admin/blockly-9.0.1.tgz +0 -0
  45. package/admin/static/js/472.dae7221e.chunk.js +0 -3
  46. package/admin/static/js/472.dae7221e.chunk.js.map +0 -1
  47. package/admin/static/js/512.6503862a.chunk.js.map +0 -1
  48. package/admin/static/js/98.eee0c52f.chunk.js +0 -2
  49. package/admin/static/js/98.eee0c52f.chunk.js.map +0 -1
  50. package/admin/static/js/main.d5dc2784.js.map +0 -1
  51. /package/admin/static/js/{472.dae7221e.chunk.js.LICENSE.txt → 472.d73f9bde.chunk.js.LICENSE.txt} +0 -0
  52. /package/admin/static/js/{512.6503862a.chunk.js.LICENSE.txt → 512.e71b2bc3.chunk.js.LICENSE.txt} +0 -0
@@ -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') {
@@ -34,90 +10,82 @@ if (typeof goog !== 'undefined') {
34
10
  goog.require('goog.userAgent');
35
11
  }
36
12
 
37
- /**
38
- * Class for an editable text field.
39
- * @param {string} text The initial content of the field.
40
- * @param {string} type Type of objects (default: state)
41
- * @extends {Blockly.Field}
42
- * @constructor
43
- */
44
- Blockly.FieldOID = function(text, type) {
45
- Blockly.FieldOID.superClass_.constructor.call(this, text);
46
- this._type = type;
47
- };
48
-
49
- if (typeof goog !== 'undefined') {
50
- goog.inherits(Blockly.FieldOID, Blockly.Field);
51
- } else {
52
- Blockly.utils.object.inherits(Blockly.FieldOID, Blockly.Field);
53
- }
54
-
55
- /**
56
- * Point size of text. Should match blocklyText's font-size in CSS.
57
- */
58
- Blockly.FieldOID.FONTSIZE = 11;
13
+ class FieldOID extends Blockly.Field {
59
14
 
60
- /**
61
- * Mouse cursor style when over the hotspot that initiates the editor.
62
- */
63
- Blockly.FieldOID.prototype.CURSOR = 'pointer';
15
+ constructor(value, type) {
16
+ super(value);
64
17
 
65
- /**
66
- * Allow browser to spellcheck this field.
67
- * @private
68
- */
69
- Blockly.FieldOID.prototype.spellcheck_ = false;
18
+ this._type = type;
70
19
 
71
- /**
72
- * Close the input widget if this input is being deleted.
73
- */
74
- Blockly.FieldOID.prototype.dispose = function() {
75
- Blockly.WidgetDiv.hideIfOwner(this);
76
- Blockly.FieldOID.superClass_.dispose.call(this);
77
- };
78
-
79
- /**
80
- * Set the text in this field.
81
- * @param {?string} id New ID.
82
- * @override
83
- */
84
- Blockly.FieldOID.prototype.setValue = function(id) {
85
- if (id === null) {
86
- return; // No change if null.
20
+ this.FONTSIZE = 11;
21
+ this.CURSOR = 'pointer';
22
+ this.spellcheck_ = false;
87
23
  }
88
24
 
89
- const objects = window.main.objects;
25
+ dispose() {
26
+ Blockly.WidgetDiv.hideIfOwner(this);
27
+ super.dispose();
28
+ }
90
29
 
91
- if (objects && !objects[id] && typeof window.main.getObject === 'function') {
92
- this._idName = id || Blockly.Field.NBSP;
93
- const that = this;
94
- window.main.getObject(id, function (err, obj) {
95
- if (obj) {
96
- objects[obj._id] = objects[obj._id] || obj;
97
- let text = objects[obj._id].common && objects[obj._id].common.name && objects[obj._id].common.name;
98
- if (text) {
99
- if (typeof text === 'object') {
100
- text = text[systemLang] || text.en;
101
- }
102
- if (text.length > that.maxDisplayLength) {
103
- // Truncate displayed string and add an ellipsis ('...').
104
- text = text.substring(0, that.maxDisplayLength - 2) + '\u2026';
105
- }
106
- text.trim();
107
- // Replace whitespace with non-breaking spaces so the text doesn't collapse.
108
- text = text.replace(/\s/g, Blockly.Field.NBSP);
30
+ setValue(id) {
31
+ if (id === null) {
32
+ return; // No change if null.
33
+ }
109
34
 
35
+ const objects = window.main.objects;
36
+
37
+ if (objects && !objects[id] && typeof window.main.getObject === 'function') {
38
+ this._idName = id || Blockly.Field.NBSP;
39
+ window.main.getObject(id, (err, obj) => {
40
+ if (obj) {
41
+ objects[obj._id] = objects[obj._id] || obj;
42
+ let text = objects[obj._id].common && objects[obj._id].common.name && objects[obj._id].common.name;
110
43
  if (text) {
111
- that._idName = text;
112
- that.forceRerender();
44
+ if (typeof text === 'object') {
45
+ text = text[systemLang] || text.en;
46
+ }
47
+ if (text.length > this.maxDisplayLength) {
48
+ // Truncate displayed string and add an ellipsis ('...').
49
+ text = text.substring(0, this.maxDisplayLength - 2) + '\u2026';
50
+ }
51
+ text.trim();
52
+ // Replace whitespace with non-breaking spaces so the text doesn't collapse.
53
+ text = text.replace(/\s/g, Blockly.Field.NBSP);
54
+
55
+ if (text) {
56
+ this._idName = text;
57
+ this.forceRerender();
58
+ }
113
59
  }
114
60
  }
61
+ });
62
+ } else {
63
+ let text = objects && objects[id] && objects[id].common && objects[id].common.name ? objects[id].common.name : id;
64
+ if (typeof text === 'object') {
65
+ text = text[systemLang] || text.en;
115
66
  }
116
- });
117
- } else {
118
- let text = objects && objects[id] && objects[id].common && objects[id].common.name ? objects[id].common.name : id;
119
- if (typeof text === 'object') {
120
- text = text[systemLang] || text.en;
67
+ if (text.length > this.maxDisplayLength) {
68
+ // Truncate the displayed string and add an ellipsis ('...').
69
+ text = text.substring(0, this.maxDisplayLength - 2) + '\u2026';
70
+ }
71
+ // Replace whitespace with non-breaking spaces so the text doesn't collapse.
72
+ text = text.replace(/\s/g, Blockly.Field.NBSP);
73
+
74
+ if (!text) {
75
+ // Prevent the field from disappearing if empty.
76
+ text = Blockly.Field.NBSP;
77
+ }
78
+ this._idName = text;
79
+ }
80
+
81
+ super.setValue(id);
82
+ }
83
+
84
+ getDisplayText_() {
85
+ let text = this._idName || this.text_;
86
+ if (!text) {
87
+ // Prevent the field from disappearing if empty.
88
+ return Blockly.Field.NBSP;
121
89
  }
122
90
  if (text.length > this.maxDisplayLength) {
123
91
  // Truncate displayed string and add an ellipsis ('...').
@@ -125,171 +93,121 @@ Blockly.FieldOID.prototype.setValue = function(id) {
125
93
  }
126
94
  // Replace whitespace with non-breaking spaces so the text doesn't collapse.
127
95
  text = text.replace(/\s/g, Blockly.Field.NBSP);
128
-
129
- if (!text) {
130
- // Prevent the field from disappearing if empty.
131
- text = Blockly.Field.NBSP;
96
+ if (this.sourceBlock_.RTL) {
97
+ // The SVG is LTR, force text to be RTL.
98
+ text += '\u200F';
132
99
  }
133
- this._idName = text;
100
+ return text;
134
101
  }
135
102
 
136
- Blockly.Field.prototype.setValue.call(this, id);
137
- };
138
-
139
- /**
140
- * Get the text from this field as displayed on screen. May differ from getText
141
- * due to ellipsis, and other formatting.
142
- * @return {string} Currently displayed text.
143
- * @protected
144
- */
145
- Blockly.FieldOID.prototype.getDisplayText_ = function() {
146
- let text = this._idName || this.text_;
147
- if (!text) {
148
- // Prevent the field from disappearing if empty.
149
- return Blockly.Field.NBSP;
150
- }
151
- if (text.length > this.maxDisplayLength) {
152
- // Truncate displayed string and add an ellipsis ('...').
153
- text = text.substring(0, this.maxDisplayLength - 2) + '\u2026';
154
- }
155
- // Replace whitespace with non-breaking spaces so the text doesn't collapse.
156
- text = text.replace(/\s/g, Blockly.Field.NBSP);
157
- if (this.sourceBlock_.RTL) {
158
- // The SVG is LTR, force text to be RTL.
159
- text += '\u200F';
103
+ showEditor_(opt_quietInput) {
104
+ this.workspace_ = this.sourceBlock_.workspace;
105
+ window.main && window.main.selectIdDialog && window.main.selectIdDialog(this.getValue(), this._type, (newId) => { newId !== null && this.setValue(newId); });
160
106
  }
161
- return text;
162
- };
163
107
 
164
- /**
165
- * Show the inline free-text editor on top of the text.
166
- * @param {boolean=} opt_quietInput True if editor should be created without
167
- * focus. Defaults to false.
168
- * @private
169
- */
170
- Blockly.FieldOID.prototype.showEditor_ = function(opt_quietInput) {
171
- this.workspace_ = this.sourceBlock_.workspace;
172
- const that = this;
173
- window.main && window.main.selectIdDialog && window.main.selectIdDialog(this.getValue(), this._type, function (newId) { newId !== null && that.setValue(newId);});
174
- };
108
+ /**
109
+ * Handle a change to the editor.
110
+ * @param {!Event} e Keyboard event.
111
+ * @private
112
+ */
113
+ onHtmlInputChange_(e) {
114
+ const htmlInput = Blockly.FieldOID.htmlInput_;
115
+ // Update source block.
116
+ const text = htmlInput.value;
117
+ if (text !== htmlInput.oldValue_) {
118
+ htmlInput.oldValue_ = text;
119
+ this.setValue(text);
120
+ this.validate_();
121
+ } else if (goog.userAgent.WEBKIT) {
122
+ // Cursor key. Render the source block to show the caret moving.
123
+ // Chrome only (version 26, OS X).
124
+ this.sourceBlock_.render();
125
+ }
175
126
 
176
- /**
177
- * Handle key down to the editor.
178
- * @param {!Event} e Keyboard event.
179
- * @private
180
- */
181
- /*Blockly.FieldOID.prototype.onHtmlInputKeyDown_ = function(e) {
182
- const htmlInput = Blockly.FieldOID.htmlInput_;
183
- const tabKey = 9, enterKey = 13, escKey = 27;
184
- if (e.keyCode == enterKey) {
185
- Blockly.WidgetDiv.hide();
186
- } else if (e.keyCode == escKey) {
187
- htmlInput.value = htmlInput.defaultValue;
188
- Blockly.WidgetDiv.hide();
189
- } else if (e.keyCode == tabKey) {
190
- Blockly.WidgetDiv.hide();
191
- this.sourceBlock_.tab(this, !e.shiftKey);
192
- e.preventDefault();
127
+ this.resizeEditor_();
128
+ Blockly.svgResize(this.sourceBlock_.workspace);
193
129
  }
194
- };*/
195
130
 
196
- /**
197
- * Handle a change to the editor.
198
- * @param {!Event} e Keyboard event.
199
- * @private
200
- */
201
- Blockly.FieldOID.prototype.onHtmlInputChange_ = function(e) {
202
- const htmlInput = Blockly.FieldOID.htmlInput_;
203
- // Update source block.
204
- const text = htmlInput.value;
205
- if (text !== htmlInput.oldValue_) {
206
- htmlInput.oldValue_ = text;
207
- this.setValue(text);
208
- this.validate_();
209
- } else if (goog.userAgent.WEBKIT) {
210
- // Cursor key. Render the source block to show the caret moving.
211
- // Chrome only (version 26, OS X).
212
- this.sourceBlock_.render();
213
- }
214
- this.resizeEditor_();
215
- Blockly.svgResize(this.sourceBlock_.workspace);
216
- };
217
- /*
218
- * Check to see if the contents of the editor validates.
219
- * Style the editor accordingly.
220
- * @private
221
- */
222
- Blockly.FieldOID.prototype.validate_ = function() {
223
- goog.asserts.assertObject(Blockly.FieldOID.htmlInput_);
131
+ /*
132
+ * Check to see if the contents of the editor validates.
133
+ * Style the editor accordingly.
134
+ * @private
135
+ */
136
+ validate_() {
137
+ goog.asserts.assertObject(Blockly.FieldOID.htmlInput_);
224
138
 
225
- const htmlInput = Blockly.FieldOID.htmlInput_;
139
+ const htmlInput = Blockly.FieldOID.htmlInput_;
226
140
 
227
- if (htmlInput.value) {
228
- Blockly.addClass_(htmlInput, 'blocklyInvalidInput');
229
- } else {
230
- Blockly.removeClass_(htmlInput, 'blocklyInvalidInput');
141
+ if (htmlInput.value) {
142
+ Blockly.addClass_(htmlInput, 'blocklyInvalidInput');
143
+ } else {
144
+ Blockly.removeClass_(htmlInput, 'blocklyInvalidInput');
145
+ }
231
146
  }
232
- };
233
147
 
234
- /**
235
- * Resize the editor and the underlying block to fit the text.
236
- * @private
237
- */
238
- Blockly.FieldOID.prototype.resizeEditor_ = function() {
239
- const div = Blockly.WidgetDiv.DIV;
240
- const bBox = this.fieldGroup_.getBBox();
241
- div.style.width = bBox.width * this.workspace_.scale + 'px';
242
- div.style.height = bBox.height * this.workspace_.scale + 'px';
243
- const xy = this.getAbsoluteXY_();
244
- // In RTL mode block fields and LTR input fields the left edge moves,
245
- // whereas the right edge is fixed. Reposition the editor.
246
- if (this.sourceBlock_.RTL) {
247
- const borderBBox = this.getScaledBBox_();
248
- xy.x += borderBBox.width;
249
- xy.x -= div.offsetWidth;
250
- }
251
- // Shift by a few pixels to line up exactly.
252
- xy.y += 1;
253
- if (goog.userAgent.GECKO && Blockly.WidgetDiv.DIV.style.top) {
254
- // Firefox mis-reports the location of the border by a pixel
255
- // once the WidgetDiv is moved into position.
256
- xy.x -= 1;
257
- xy.y -= 1;
258
- }
259
- if (goog.userAgent.WEBKIT) {
260
- xy.y -= 3;
148
+ /**
149
+ * Resize the editor and the underlying block to fit the text.
150
+ * @private
151
+ */
152
+ resizeEditor_() {
153
+ const div = Blockly.WidgetDiv.DIV;
154
+ const bBox = this.fieldGroup_.getBBox();
155
+ div.style.width = bBox.width * this.workspace_.scale + 'px';
156
+ div.style.height = bBox.height * this.workspace_.scale + 'px';
157
+ const xy = this.getAbsoluteXY_();
158
+ // In RTL mode block fields and LTR input fields the left edge moves,
159
+ // whereas the right edge is fixed. Reposition the editor.
160
+ if (this.sourceBlock_.RTL) {
161
+ const borderBBox = this.getScaledBBox_();
162
+ xy.x += borderBBox.width;
163
+ xy.x -= div.offsetWidth;
164
+ }
165
+ // Shift by a few pixels to line up exactly.
166
+ xy.y += 1;
167
+ if (goog.userAgent.GECKO && Blockly.WidgetDiv.DIV.style.top) {
168
+ // Firefox mis-reports the location of the border by a pixel
169
+ // once the WidgetDiv is moved into position.
170
+ xy.x -= 1;
171
+ xy.y -= 1;
172
+ }
173
+ if (goog.userAgent.WEBKIT) {
174
+ xy.y -= 3;
175
+ }
176
+ div.style.left = xy.x + 'px';
177
+ div.style.top = xy.y + 'px';
261
178
  }
262
- div.style.left = xy.x + 'px';
263
- div.style.top = xy.y + 'px';
264
- };
265
179
 
266
- /**
267
- * Close the editor, save the results, and dispose of the editable
268
- * text field's elements.
269
- * @return {!Function} Closure to call on destruction of the WidgetDiv.
270
- * @private
271
- */
272
- Blockly.FieldOID.prototype.widgetDispose_ = function() {
273
- const thisField = this;
274
- return function() {
275
- const htmlInput = Blockly.FieldOID.htmlInput_;
276
- // Save the edit (if it validates).
277
- const text = htmlInput.value;
278
- thisField.setValue(text);
279
- thisField.sourceBlock_.rendered && thisField.sourceBlock_.render();
280
- Blockly.unbindEvent_(htmlInput.onKeyDownWrapper_);
281
- Blockly.unbindEvent_(htmlInput.onKeyUpWrapper_);
282
- Blockly.unbindEvent_(htmlInput.onKeyPressWrapper_);
283
-
284
- thisField.workspace_.removeChangeListener(
285
- htmlInput.onWorkspaceChangeWrapper_);
180
+ /**
181
+ * Close the editor, save the results, and dispose of the editable
182
+ * text field's elements.
183
+ * @return {!Function} Closure to call on destruction of the WidgetDiv.
184
+ * @private
185
+ */
186
+ widgetDispose_() {
187
+ return () => {
188
+ const htmlInput = this.htmlInput_;
189
+ // Save the edit (if it validates).
190
+ const text = htmlInput.value;
191
+ this.setValue(text);
192
+ this.sourceBlock_.rendered && this.sourceBlock_.render();
193
+
194
+ Blockly.unbindEvent_(htmlInput.onKeyDownWrapper_);
195
+ Blockly.unbindEvent_(htmlInput.onKeyUpWrapper_);
196
+ Blockly.unbindEvent_(htmlInput.onKeyPressWrapper_);
197
+
198
+ this.workspace_.removeChangeListener(htmlInput.onWorkspaceChangeWrapper_);
199
+
200
+ this.htmlInput_ = null;
201
+
202
+ // Delete style properties.
203
+ const style = Blockly.WidgetDiv.DIV.style;
204
+ style.width = 'auto';
205
+ style.height = 'auto';
206
+ style.fontSize = '';
207
+ };
208
+ }
209
+ }
286
210
 
287
- Blockly.FieldOID.htmlInput_ = null;
211
+ Blockly.FieldOID = FieldOID;
288
212
 
289
- // Delete style properties.
290
- const style = Blockly.WidgetDiv.DIV.style;
291
- style.width = 'auto';
292
- style.height = 'auto';
293
- style.fontSize = '';
294
- };
295
- };
213
+ // Blockly.fieldRegistry.register('field_oid', FieldOID);