pxt-core 10.3.4 → 10.3.6

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.
@@ -37,4 +37,5 @@ for (let i = 0; i < sentence.length; i++) {
37
37
 
38
38
  ## See also
39
39
 
40
+ [char code at](/reference/text/char-code-at),
40
41
  [substr](/reference/text/substr)
@@ -0,0 +1,33 @@
1
+ # char Code At
2
+
3
+ Get the code for a character (letter, number, or symbol) from a place in a text string.
4
+
5
+ ```sig
6
+ "".charCodeAt(0)
7
+ ```
8
+
9
+ Like the position of a character in the an alphabet, or the traditional order of characters in a language, characters are assigned a code in a character set when used with computers. If a character set used only the 5 characters of "ABCDE", then 'A', as the first character, would have a character code of `0` and 'D' would have a charcter code of `3`.
10
+
11
+ You can find the code of a character in a text string by selecting it from it's position in a string.
12
+
13
+ ## Parameters
14
+
15
+ * **index**: the [number](/types/number) for the position in the text string to return a character code for.
16
+
17
+ ## Returns
18
+
19
+ * a [number](/types/string) that is the code in the character set for the selected position in the text string.
20
+
21
+ ## Example
22
+
23
+ Find the character code for the character at position `6` in a string.
24
+
25
+ ```blocks
26
+ let sentence = "Super space ship"
27
+ let myCharCode = sentence.charCodeAt(6)
28
+ ```
29
+
30
+ ## See also
31
+
32
+ [char at](/reference/text/char-at),
33
+ [substr](/reference/text/substr)
@@ -3,8 +3,8 @@
3
3
  {
4
4
  "id": "59AAC5BA-B0B3-4389-AA90-1E767EFA8563",
5
5
  "use": "block_used_n_times",
6
- "template": "${Block} used ${count} times",
7
- "description": "This block was used the specified number of times in your project.",
6
+ "template": "${Block} used at least ${count} time(s)",
7
+ "description": "This block was used at least the specified number of times in your project.",
8
8
  "docPath": "/teachertool",
9
9
  "tags": ["General"],
10
10
  "params": [
@@ -24,7 +24,7 @@
24
24
  {
25
25
  "id": "7AE7EA2A-3AC8-42DC-89DB-65E3AE157156",
26
26
  "use": "block_comment_used",
27
- "template": "At least ${count} comments",
27
+ "template": "At least ${count} comment(s)",
28
28
  "description": "The project contains at least the specified number of comments.",
29
29
  "docPath": "/teachertool",
30
30
  "maxCount": 1,
@@ -41,7 +41,7 @@
41
41
  {
42
42
  "id": "B8987394-1531-4C71-8661-BE4086CE0C6E",
43
43
  "use": "n_loops",
44
- "template": "At least ${count} loops used",
44
+ "template": "At least ${count} loop(s) used",
45
45
  "docPath": "/teachertool",
46
46
  "description": "The program uses at least this many loops of any kind (for, repeat, while, or for-of).",
47
47
  "maxCount": 1,
@@ -58,7 +58,7 @@
58
58
  {
59
59
  "id": "79D5DAF7-FED3-473F-81E2-E004922E5F55",
60
60
  "use": "custom_function_called",
61
- "template": "At least ${count} custom functions exist and get called",
61
+ "template": "At least ${count} custom function(s) exist and get called",
62
62
  "docPath": "/teachertool",
63
63
  "description": "At least this many user-defined functions are created and called.",
64
64
  "maxCount": 1,
@@ -75,7 +75,7 @@
75
75
  {
76
76
  "id": "0DFA44C8-3CA5-4C77-946E-AF09F6C03879",
77
77
  "use": "variable_usage",
78
- "template": "Uses at least ${count} variables",
78
+ "template": "Uses at least ${count} variable(s)",
79
79
  "docPath": "/teachertool",
80
80
  "description": "The program creates and uses at least this many user-defined variables.",
81
81
  "maxCount": 1,
@@ -522,6 +522,7 @@ declare namespace pxt {
522
522
 
523
523
  dragFileImage?: string;
524
524
  connectDeviceImage?: string;
525
+ disconnectDeviceImage?: string;
525
526
  selectDeviceImage?: string;
526
527
  connectionSuccessImage?: string;
527
528
  incompatibleHardwareImage?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pxt-core",
3
- "version": "10.3.4",
3
+ "version": "10.3.6",
4
4
  "description": "Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors",
5
5
  "keywords": [
6
6
  "TypeScript",
@@ -22,6 +22,7 @@ export interface InputProps extends ControlProps {
22
22
  handleInputRef?: React.RefObject<HTMLInputElement> | ((ref: HTMLInputElement) => void);
23
23
  preserveValueOnBlur?: boolean;
24
24
  options?: pxt.Map<string>;
25
+ filter?: string;
25
26
 
26
27
  onChange?: (newValue: string) => void;
27
28
  onEnterKey?: (value: string) => void;
@@ -62,8 +63,9 @@ export const Input = (props: InputProps) => {
62
63
  options
63
64
  } = props;
64
65
 
65
- const [value, setValue] = React.useState(undefined);
66
+ const [value, setValue] = React.useState(initialValue || "");
66
67
  const [expanded, setExpanded] = React.useState(false);
68
+ const [filter] = React.useState(props.filter ? new RegExp(props.filter) : undefined);
67
69
 
68
70
  let container: HTMLDivElement;
69
71
 
@@ -83,7 +85,10 @@ export const Input = (props: InputProps) => {
83
85
  }
84
86
 
85
87
  const changeHandler = (e: React.ChangeEvent<any>) => {
86
- const newValue = (e.target as any).value;
88
+ let newValue = (e.target as any).value;
89
+ if (newValue && filter) {
90
+ newValue = newValue.match(filter)?.join("") || "";
91
+ }
87
92
  if (!readOnly && (value !== newValue)) {
88
93
  setValue(newValue);
89
94
  }
@@ -147,7 +152,7 @@ export const Input = (props: InputProps) => {
147
152
 
148
153
  const value = options[option];
149
154
  setValue(value);
150
- if (onOptionSelected) {
155
+ if (onOptionSelected) {
151
156
  onOptionSelected(value);
152
157
  }
153
158
 
@@ -174,7 +179,7 @@ export const Input = (props: InputProps) => {
174
179
  aria-hidden={ariaHidden}
175
180
  type={type || "text"}
176
181
  placeholder={placeholder}
177
- value={value !== undefined ? value : (initialValue || "")}
182
+ value={value}
178
183
  readOnly={!!readOnly}
179
184
  onClick={clickHandler}
180
185
  onChange={changeHandler}
@@ -9,7 +9,7 @@
9
9
  <link rel="stylesheet" data-rtl="/blb/rtlsemantic.css" href="/blb/semantic.css">
10
10
  <link rel="stylesheet" href="/blb/icons.css">
11
11
  <link rel="stylesheet" href="/blb/react-common-multiplayer.css">
12
- <script defer="defer" src="/blb/multiplayer/js/main.06600d76.js"></script><link href="/blb/multiplayer/css/main.53c69969.css" rel="stylesheet"></head>
12
+ <script defer="defer" src="/blb/multiplayer/js/main.d7077ff8.js"></script><link href="/blb/multiplayer/css/main.53c69969.css" rel="stylesheet"></head>
13
13
  <body>
14
14
  <noscript>You need to enable JavaScript to run this app.</noscript>
15
15
 
@@ -7,7 +7,7 @@
7
7
  <link rel="stylesheet" data-rtl="/blb/rtlsemantic.css" href="/blb/semantic.css">
8
8
  <link rel="stylesheet" href="/blb/icons.css">
9
9
  <link rel="stylesheet" href="/blb/react-common-skillmap.css">
10
- <script defer="defer" src="/blb/skillmap/js/main.c31cb548.js"></script><link href="/blb/skillmap/css/main.1ec2262e.css" rel="stylesheet"></head>
10
+ <script defer="defer" src="/blb/skillmap/js/main.14978cef.js"></script><link href="/blb/skillmap/css/main.1ec2262e.css" rel="stylesheet"></head>
11
11
  <body>
12
12
  <noscript>You need to enable JavaScript to run this app.</noscript>
13
13
 
@@ -18,7 +18,7 @@
18
18
  <!-- <link rel="manifest" href="/teachertool-data/manifest.json" /> -->
19
19
  <title>MakeCode Code Evaluation</title>
20
20
  <script>var pxtConfig=null</script>
21
- <script defer="defer" src="/blb/teachertool/js/main.78692989.js"></script><link href="/blb/teachertool/css/main.1dcea34b.css" rel="stylesheet"></head>
21
+ <script defer="defer" src="/blb/teachertool/js/main.a8296247.js"></script><link href="/blb/teachertool/css/main.1dcea34b.css" rel="stylesheet"></head>
22
22
  <body>
23
23
  <noscript>You need to enable JavaScript to run this app.</noscript>
24
24