iobroker.javascript 7.0.7 → 7.0.8

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 (41) hide show
  1. package/README.md +2 -1
  2. package/admin/asset-manifest.json +5 -5
  3. package/admin/google-blockly/blockly_compressed.js +1469 -1704
  4. package/admin/google-blockly/blocks_compressed.js +164 -218
  5. package/admin/google-blockly/javascript_compressed.js +100 -328
  6. package/admin/google-blockly/msg/js/de.js +64 -70
  7. package/admin/google-blockly/msg/js/en.js +14 -20
  8. package/admin/google-blockly/msg/js/es.js +39 -45
  9. package/admin/google-blockly/msg/js/fr.js +59 -65
  10. package/admin/google-blockly/msg/js/it.js +19 -25
  11. package/admin/google-blockly/msg/js/nl.js +55 -61
  12. package/admin/google-blockly/msg/js/pl.js +46 -52
  13. package/admin/google-blockly/msg/js/pt.js +30 -36
  14. package/admin/google-blockly/msg/js/ru.js +41 -47
  15. package/admin/google-blockly/msg/js/uk.js +13 -17
  16. package/admin/google-blockly/msg/js/zh-cn.js +86 -92
  17. package/admin/google-blockly/own/blocks_action.js +4 -4
  18. package/admin/google-blockly/own/blocks_other.js +103 -0
  19. package/admin/google-blockly/own/blocks_procedures.js +63 -62
  20. package/admin/google-blockly/own/blocks_sendto.js +62 -60
  21. package/admin/google-blockly/own/blocks_switch.js +40 -29
  22. package/admin/google-blockly/own/blocks_system.js +113 -170
  23. package/admin/google-blockly/own/blocks_time.js +35 -35
  24. package/admin/google-blockly/own/blocks_timeout.js +42 -42
  25. package/admin/google-blockly/own/blocks_trigger.js +51 -68
  26. package/admin/google-blockly/own/blocks_words.js +8 -9
  27. package/admin/google-blockly/own/field_cron.js +189 -139
  28. package/admin/google-blockly/own/field_oid.js +250 -170
  29. package/admin/google-blockly/own/field_script.js +168 -122
  30. package/admin/static/js/98.bf3dfa2b.chunk.js +2 -0
  31. package/admin/static/js/98.bf3dfa2b.chunk.js.map +1 -0
  32. package/admin/static/js/{main.d86fb9de.js → main.d9e7d255.js} +2 -2
  33. package/admin/static/js/{main.d86fb9de.js.map → main.d9e7d255.js.map} +1 -1
  34. package/admin/tab.html +1 -1
  35. package/io-package.json +14 -14
  36. package/package.json +1 -1
  37. package/admin/google-blockly/own/blocks_logic.js +0 -64
  38. package/admin/google-blockly/own/blocks_number.js +0 -25
  39. package/admin/google-blockly/own/blocks_text.js +0 -23
  40. package/admin/static/js/98.f78be4fc.chunk.js +0 -2
  41. package/admin/static/js/98.f78be4fc.chunk.js.map +0 -1
@@ -1,3 +1,27 @@
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
+ */
1
25
  'use strict';
2
26
 
3
27
  if (typeof goog !== 'undefined') {
@@ -10,82 +34,90 @@ if (typeof goog !== 'undefined') {
10
34
  goog.require('goog.userAgent');
11
35
  }
12
36
 
13
- class FieldOID extends Blockly.Field {
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
+ };
14
48
 
15
- constructor(value, type) {
16
- super(value);
49
+ if (typeof goog !== 'undefined') {
50
+ goog.inherits(Blockly.FieldOID, Blockly.Field);
51
+ } else {
52
+ Blockly.utils.object.inherits(Blockly.FieldOID, Blockly.Field);
53
+ }
17
54
 
18
- this._type = type;
55
+ /**
56
+ * Point size of text. Should match blocklyText's font-size in CSS.
57
+ */
58
+ Blockly.FieldOID.FONTSIZE = 11;
19
59
 
20
- this.FONTSIZE = 11;
21
- this.CURSOR = 'pointer';
22
- this.spellcheck_ = false;
23
- }
60
+ /**
61
+ * Mouse cursor style when over the hotspot that initiates the editor.
62
+ */
63
+ Blockly.FieldOID.prototype.CURSOR = 'pointer';
64
+
65
+ /**
66
+ * Allow browser to spellcheck this field.
67
+ * @private
68
+ */
69
+ Blockly.FieldOID.prototype.spellcheck_ = false;
24
70
 
25
- dispose() {
26
- Blockly.WidgetDiv.hideIfOwner(this);
27
- super.dispose();
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.
28
87
  }
29
88
 
30
- setValue(id) {
31
- if (id === null) {
32
- return; // No change if null.
33
- }
34
-
35
- var 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
- var text = objects[obj._id].common && objects[obj._id].common.name && objects[obj._id].common.name;
89
+ const objects = window.main.objects;
90
+
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);
109
+
43
110
  if (text) {
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
- }
111
+ that._idName = text;
112
+ that.forceRerender();
59
113
  }
60
114
  }
61
- });
62
- } else {
63
- var 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;
66
- }
67
- if (text.length > this.maxDisplayLength) {
68
- // Truncate displayed string and add an ellipsis ('...').
69
- text = text.substring(0, this.maxDisplayLength - 2) + '\u2026';
70
115
  }
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
- var text = this._idName || this.text_;
86
- if (!text) {
87
- // Prevent the field from disappearing if empty.
88
- return Blockly.Field.NBSP;
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;
89
121
  }
90
122
  if (text.length > this.maxDisplayLength) {
91
123
  // Truncate displayed string and add an ellipsis ('...').
@@ -93,123 +125,171 @@ class FieldOID extends Blockly.Field {
93
125
  }
94
126
  // Replace whitespace with non-breaking spaces so the text doesn't collapse.
95
127
  text = text.replace(/\s/g, Blockly.Field.NBSP);
96
- if (this.sourceBlock_.RTL) {
97
- // The SVG is LTR, force text to be RTL.
98
- text += '\u200F';
128
+
129
+ if (!text) {
130
+ // Prevent the field from disappearing if empty.
131
+ text = Blockly.Field.NBSP;
99
132
  }
100
- return text;
133
+ this._idName = text;
101
134
  }
102
135
 
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); });
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';
106
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';
160
+ }
161
+ return text;
162
+ };
107
163
 
108
- /**
109
- * Handle a change to the editor.
110
- * @param {!Event} e Keyboard event.
111
- * @private
112
- */
113
- onHtmlInputChange_(e) {
114
- var htmlInput = Blockly.FieldOID.htmlInput_;
115
- // Update source block.
116
- var 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
- }
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
+ };
126
175
 
127
- this.resizeEditor_();
128
- Blockly.svgResize(this.sourceBlock_.workspace);
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();
129
193
  }
194
+ };*/
130
195
 
131
- /*
132
- * Check to see if the contents of the editor validates.
133
- * Style the editor accordingly.
134
- * @private
135
- */
136
- validate_() {
137
- var valid = true;
138
-
139
- goog.asserts.assertObject(Blockly.FieldOID.htmlInput_);
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_);
140
224
 
141
- var htmlInput = Blockly.FieldOID.htmlInput_;
225
+ const htmlInput = Blockly.FieldOID.htmlInput_;
142
226
 
143
- if (htmlInput.value) {
144
- Blockly.addClass_(htmlInput, 'blocklyInvalidInput');
145
- } else {
146
- Blockly.removeClass_(htmlInput, 'blocklyInvalidInput');
147
- }
227
+ if (htmlInput.value) {
228
+ Blockly.addClass_(htmlInput, 'blocklyInvalidInput');
229
+ } else {
230
+ Blockly.removeClass_(htmlInput, 'blocklyInvalidInput');
148
231
  }
232
+ };
149
233
 
150
- /**
151
- * Resize the editor and the underlying block to fit the text.
152
- * @private
153
- */
154
- resizeEditor_() {
155
- var div = Blockly.WidgetDiv.DIV;
156
- var bBox = this.fieldGroup_.getBBox();
157
- div.style.width = bBox.width * this.workspace_.scale + 'px';
158
- div.style.height = bBox.height * this.workspace_.scale + 'px';
159
- var xy = this.getAbsoluteXY_();
160
- // In RTL mode block fields and LTR input fields the left edge moves,
161
- // whereas the right edge is fixed. Reposition the editor.
162
- if (this.sourceBlock_.RTL) {
163
- var borderBBox = this.getScaledBBox_();
164
- xy.x += borderBBox.width;
165
- xy.x -= div.offsetWidth;
166
- }
167
- // Shift by a few pixels to line up exactly.
168
- xy.y += 1;
169
- if (goog.userAgent.GECKO && Blockly.WidgetDiv.DIV.style.top) {
170
- // Firefox mis-reports the location of the border by a pixel
171
- // once the WidgetDiv is moved into position.
172
- xy.x -= 1;
173
- xy.y -= 1;
174
- }
175
- if (goog.userAgent.WEBKIT) {
176
- xy.y -= 3;
177
- }
178
- div.style.left = xy.x + 'px';
179
- div.style.top = xy.y + 'px';
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;
180
250
  }
181
-
182
- /**
183
- * Close the editor, save the results, and dispose of the editable
184
- * text field's elements.
185
- * @return {!Function} Closure to call on destruction of the WidgetDiv.
186
- * @private
187
- */
188
- widgetDispose_() {
189
- return () => {
190
- var htmlInput = this.htmlInput_;
191
- // Save the edit (if it validates).
192
- var text = htmlInput.value;
193
- this.setValue(text);
194
- this.sourceBlock_.rendered && this.sourceBlock_.render();
195
-
196
- Blockly.unbindEvent_(htmlInput.onKeyDownWrapper_);
197
- Blockly.unbindEvent_(htmlInput.onKeyUpWrapper_);
198
- Blockly.unbindEvent_(htmlInput.onKeyPressWrapper_);
199
-
200
- this.workspace_.removeChangeListener(htmlInput.onWorkspaceChangeWrapper_);
201
-
202
- this.htmlInput_ = null;
203
-
204
- // Delete style properties.
205
- let style = Blockly.WidgetDiv.DIV.style;
206
- style.width = 'auto';
207
- style.height = 'auto';
208
- style.fontSize = '';
209
- };
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;
210
258
  }
211
- }
259
+ if (goog.userAgent.WEBKIT) {
260
+ xy.y -= 3;
261
+ }
262
+ div.style.left = xy.x + 'px';
263
+ div.style.top = xy.y + 'px';
264
+ };
265
+
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_);
212
286
 
213
- Blockly.FieldOID = FieldOID;
287
+ Blockly.FieldOID.htmlInput_ = null;
214
288
 
215
- // Blockly.fieldRegistry.register('field_oid', FieldOID);
289
+ // Delete style properties.
290
+ const style = Blockly.WidgetDiv.DIV.style;
291
+ style.width = 'auto';
292
+ style.height = 'auto';
293
+ style.fontSize = '';
294
+ };
295
+ };