iobroker.javascript 7.0.7 → 7.0.10
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 +6 -12
- package/admin/asset-manifest.json +7 -7
- package/admin/google-blockly/blockly_compressed.js +1469 -1704
- package/admin/google-blockly/blocks_compressed.js +164 -218
- package/admin/google-blockly/javascript_compressed.js +100 -328
- package/admin/google-blockly/msg/js/de.js +64 -70
- package/admin/google-blockly/msg/js/en.js +14 -20
- package/admin/google-blockly/msg/js/es.js +39 -45
- package/admin/google-blockly/msg/js/fr.js +59 -65
- package/admin/google-blockly/msg/js/it.js +19 -25
- package/admin/google-blockly/msg/js/nl.js +55 -61
- package/admin/google-blockly/msg/js/pl.js +46 -52
- package/admin/google-blockly/msg/js/pt.js +30 -36
- package/admin/google-blockly/msg/js/ru.js +41 -47
- package/admin/google-blockly/msg/js/uk.js +13 -17
- package/admin/google-blockly/msg/js/zh-cn.js +86 -92
- package/admin/google-blockly/own/blocks_action.js +4 -4
- package/admin/google-blockly/own/blocks_logic.js +2 -2
- package/admin/google-blockly/own/blocks_procedures.js +63 -62
- package/admin/google-blockly/own/blocks_sendto.js +62 -60
- package/admin/google-blockly/own/blocks_switch.js +40 -29
- package/admin/google-blockly/own/blocks_system.js +109 -170
- package/admin/google-blockly/own/blocks_time.js +35 -35
- package/admin/google-blockly/own/blocks_timeout.js +42 -42
- package/admin/google-blockly/own/blocks_trigger.js +51 -68
- package/admin/google-blockly/own/blocks_words.js +12 -8
- package/admin/google-blockly/own/field_cron.js +189 -139
- package/admin/google-blockly/own/field_oid.js +250 -170
- package/admin/google-blockly/own/field_script.js +168 -122
- package/admin/static/js/{565.643198c0.chunk.js → 569.e2b427a7.chunk.js} +2 -2
- package/admin/static/js/569.e2b427a7.chunk.js.map +1 -0
- package/admin/static/js/759.7f25ba6c.chunk.js.map +1 -1
- package/admin/static/js/98.eee0c52f.chunk.js +2 -0
- package/admin/static/js/98.eee0c52f.chunk.js.map +1 -0
- package/admin/static/js/{main.d86fb9de.js → main.d5dc2784.js} +2 -2
- package/admin/static/js/{main.d86fb9de.js.map → main.d5dc2784.js.map} +1 -1
- package/admin/tab.html +1 -1
- package/io-package.json +27 -27
- package/package.json +1 -1
- package/admin/static/js/565.643198c0.chunk.js.map +0 -1
- package/admin/static/js/98.f78be4fc.chunk.js +0 -2
- 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') {
|
|
@@ -12,7 +36,7 @@ if (typeof goog !== 'undefined') {
|
|
|
12
36
|
|
|
13
37
|
Blockly.b64EncodeUnicode = function(text) {
|
|
14
38
|
return btoa(encodeURIComponent(text).replace(/%([0-9A-F]{2})/g, function(match, p) {
|
|
15
|
-
return String.fromCharCode(parseInt(p, 16))
|
|
39
|
+
return String.fromCharCode(parseInt(p, 16))
|
|
16
40
|
}));
|
|
17
41
|
};
|
|
18
42
|
|
|
@@ -20,7 +44,7 @@ Blockly.b64EncodeUnicode = function(text) {
|
|
|
20
44
|
Blockly.b64DecodeUnicode = function(text) {
|
|
21
45
|
try {
|
|
22
46
|
return decodeURIComponent(Array.prototype.map.call(atob(text), function(s) {
|
|
23
|
-
return '%' + ('00' + s.charCodeAt(0).toString(16)).slice(-2)
|
|
47
|
+
return '%' + ('00' + s.charCodeAt(0).toString(16)).slice(-2)
|
|
24
48
|
}).join(''));
|
|
25
49
|
} catch (e) {
|
|
26
50
|
// old style
|
|
@@ -28,136 +52,158 @@ Blockly.b64DecodeUnicode = function(text) {
|
|
|
28
52
|
}
|
|
29
53
|
};
|
|
30
54
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
+
};
|
|
34
96
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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.
|
|
38
105
|
}
|
|
39
106
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
super.dispose();
|
|
43
|
-
}
|
|
107
|
+
Blockly.Field.prototype.setValue.call(this, text);
|
|
108
|
+
};
|
|
44
109
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
+
const that = this;
|
|
119
|
+
const base64 = that.getValue();
|
|
120
|
+
let args = null;
|
|
121
|
+
let isReturn = false;
|
|
122
|
+
if (this.sourceBlock_ && this.sourceBlock_.arguments_) {
|
|
123
|
+
args = this.sourceBlock_.arguments_;
|
|
56
124
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
});
|
|
125
|
+
if (this.sourceBlock_.getProcedureDef) {
|
|
126
|
+
const options = this.sourceBlock_.getProcedureDef();
|
|
127
|
+
isReturn = options[2];
|
|
82
128
|
}
|
|
83
129
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
this.positionTextElement_(xOffset, 12);
|
|
104
|
-
this.positionBorderRect_();
|
|
105
|
-
this.textElement_.textContent = '...';
|
|
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
|
+
const constants = this.getConstants();
|
|
143
|
+
const xOffset = this.borderRect_ ? this.getConstants().FIELD_BORDER_RECT_X_PADDING : 0;
|
|
144
|
+
const totalWidth = xOffset * 2 + 12;
|
|
145
|
+
let totalHeight = constants.FIELD_TEXT_HEIGHT;
|
|
146
|
+
|
|
147
|
+
if (this.borderRect_) {
|
|
148
|
+
totalHeight = Math.max(totalHeight, constants.FIELD_BORDER_RECT_HEIGHT);
|
|
106
149
|
}
|
|
107
150
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
this.size_.width = width;
|
|
151
|
+
this.size_.height = totalHeight;
|
|
152
|
+
this.size_.width = totalWidth;
|
|
153
|
+
|
|
154
|
+
this.positionTextElement_(xOffset, 12);
|
|
155
|
+
this.positionBorderRect_();
|
|
156
|
+
this.textElement_.textContent = '...';
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Update the text node of this field to display the current text.
|
|
161
|
+
* @private
|
|
162
|
+
*/
|
|
163
|
+
Blockly.FieldScript.prototype.updateTextNode_ = function() {
|
|
164
|
+
const width = (Blockly.BlockSvg.SEP_SPACE_X || 5) * 3;
|
|
165
|
+
if (!this.textElement_) {
|
|
166
|
+
// Not rendered yet.
|
|
167
|
+
return;
|
|
126
168
|
}
|
|
169
|
+
// Empty the text element.
|
|
170
|
+
goog.dom.removeChildren(/** @type {!Element} */ (this.textElement_));
|
|
127
171
|
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
}
|
|
172
|
+
const textNode = document.createTextNode('...');
|
|
173
|
+
this.textElement_.appendChild(textNode);
|
|
160
174
|
|
|
161
|
-
|
|
175
|
+
// Cached width is obsolete. Clear it.
|
|
176
|
+
this.size_.width = width;
|
|
177
|
+
};
|
|
162
178
|
|
|
163
|
-
|
|
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
|
+
const thisField = this;
|
|
187
|
+
return function() {
|
|
188
|
+
const htmlInput = Blockly.FieldScript.htmlInput_;
|
|
189
|
+
|
|
190
|
+
// Save the edit (if it validates).
|
|
191
|
+
const 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
|
+
const style = Blockly.WidgetDiv.DIV.style;
|
|
205
|
+
style.width = 'auto';
|
|
206
|
+
style.height = 'auto';
|
|
207
|
+
style.fontSize = '';
|
|
208
|
+
};
|
|
209
|
+
};*/
|