pxt-core 8.2.10 → 8.2.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pxt-core",
3
- "version": "8.2.10",
3
+ "version": "8.2.12",
4
4
  "description": "Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors",
5
5
  "keywords": [
6
6
  "TypeScript",
@@ -150,7 +150,9 @@ export const ShareInfo = (props: ShareInfoProps) => {
150
150
  <div className="project-share-thumbnail">
151
151
  {thumbnailUri
152
152
  ? <img src={thumbnailUri} />
153
- : <div className="project-thumbnail-placeholder" />
153
+ : <div className="project-thumbnail-placeholder">
154
+ <div className="common-spinner" />
155
+ </div>
154
156
  }
155
157
  {shareState !== "publish" &&
156
158
  <Button
@@ -163,11 +165,12 @@ export const ShareInfo = (props: ShareInfoProps) => {
163
165
  }
164
166
  <div className="project-share-content">
165
167
  {(prePublish || shareState === "publish") && <>
166
- <div className="project-share-title">
167
- <h2>{inputTitle}</h2>
168
+ <div className="project-share-title project-share-label" id="share-input-title">
169
+ {inputTitle}
168
170
  </div>
169
171
  {showDescription && <>
170
172
  <Input
173
+ ariaDescribedBy="share-input-title"
171
174
  className="name-input"
172
175
  initialValue={name}
173
176
  placeholder={lf("Name your project")}
@@ -207,6 +210,7 @@ export const ShareInfo = (props: ShareInfoProps) => {
207
210
  <div className="project-share-data">
208
211
  <div className="common-input-attached-button">
209
212
  <Input
213
+ ariaDescribedBy="share-input-title"
210
214
  handleInputRef={handleInputRef}
211
215
  initialValue={shareData.url}
212
216
  readOnly={true}
@@ -219,36 +223,38 @@ export const ShareInfo = (props: ShareInfoProps) => {
219
223
  onBlur={handleCopyBlur} />
220
224
  </div>
221
225
  <div className="project-share-actions">
222
- <Button className="square-button gray embed mobile-portrait-hidden"
223
- title={lf("Show embed code")}
224
- leftIcon="fas fa-code"
225
- onClick={handleEmbedClick} />
226
- <SocialButton className="square-button facebook"
227
- url={shareData?.url}
228
- type='facebook'
229
- heading={lf("Share on Facebook")} />
230
- <SocialButton className="square-button twitter"
231
- url={shareData?.url}
232
- type='twitter'
233
- heading={lf("Share on Twitter")} />
234
- <SocialButton className="square-button google-classroom"
235
- url={shareData?.url}
236
- type='google-classroom'
237
- heading={lf("Share on Google Classroom")} />
238
- <SocialButton className="square-button microsoft-teams"
239
- url={shareData?.url}
240
- type='microsoft-teams'
241
- heading={lf("Share on Microsoft Teams")} />
242
- <SocialButton className="square-button whatsapp"
243
- url={shareData?.url}
244
- type='whatsapp'
245
- heading={lf("Share on WhatsApp")} />
246
- {navigator.share && <Button className="square-button device-share"
247
- title={lf("Show device share options")}
248
- ariaLabel={lf("Show device share options")}
249
- leftIcon={"icon share"}
250
- onClick={handleDeviceShareClick}
251
- />}
226
+ <div className="project-share-social">
227
+ <Button className="square-button gray embed mobile-portrait-hidden"
228
+ title={lf("Show embed code")}
229
+ leftIcon="fas fa-code"
230
+ onClick={handleEmbedClick} />
231
+ <SocialButton className="square-button facebook"
232
+ url={shareData?.url}
233
+ type='facebook'
234
+ heading={lf("Share on Facebook")} />
235
+ <SocialButton className="square-button twitter"
236
+ url={shareData?.url}
237
+ type='twitter'
238
+ heading={lf("Share on Twitter")} />
239
+ <SocialButton className="square-button google-classroom"
240
+ url={shareData?.url}
241
+ type='google-classroom'
242
+ heading={lf("Share on Google Classroom")} />
243
+ <SocialButton className="square-button microsoft-teams"
244
+ url={shareData?.url}
245
+ type='microsoft-teams'
246
+ heading={lf("Share on Microsoft Teams")} />
247
+ <SocialButton className="square-button whatsapp"
248
+ url={shareData?.url}
249
+ type='whatsapp'
250
+ heading={lf("Share on WhatsApp")} />
251
+ {navigator.share && <Button className="square-button device-share"
252
+ title={lf("Show device share options")}
253
+ ariaLabel={lf("Show device share options")}
254
+ leftIcon={"icon share"}
255
+ onClick={handleDeviceShareClick}
256
+ />}
257
+ </div>
252
258
  <Button
253
259
  className="menu-button project-qrcode"
254
260
  buttonRef={handleQRCodeButtonRef}
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { Button } from "../controls/Button";
3
+ import { classList } from "../util";
3
4
 
4
5
  export interface ThumbnailRecorderProps {
5
6
  initialUri?: string;
@@ -31,7 +32,7 @@ export interface SimRecorderRef {
31
32
 
32
33
  export const ThumbnailRecorder = (props: ThumbnailRecorderProps) => {
33
34
  const { initialUri, onApply, onCancel, simRecorder } = props;
34
- const [ uri, setUri ] = React.useState(initialUri);
35
+ const [ uri, setUri ] = React.useState(undefined);
35
36
  const [ error, setError] = React.useState<string>(undefined)
36
37
  const [ recorderRef, setRecorderRef ] = React.useState<SimRecorderRef>(undefined);
37
38
  const [ recorderState, setRecorderState ] = React.useState<SimRecorderState>("default");
@@ -76,62 +77,73 @@ export const ThumbnailRecorder = (props: ThumbnailRecorderProps) => {
76
77
  setRecorderRef(ref);
77
78
  }
78
79
 
79
- const screenshotLabel = lf("Take screenshot ({0})", targetTheme.simScreenshotKey);
80
- const startRecordingLabel = lf("Record gameplay ({0})", targetTheme.simGifKey);
80
+ const screenshotLabel = lf("Screenshot ({0})", targetTheme.simScreenshotKey);
81
+ const startRecordingLabel = lf("Record ({0})", targetTheme.simGifKey);
81
82
  const stopRecordingLabel = lf("Stop recording ({0})", targetTheme.simGifKey) ;
82
83
 
84
+ const thumbnailLabel = uri ? lf("New Thumbnail") : lf("Current Thumbnail");
85
+ const classes = classList(
86
+ "gif-recorder-content",
87
+ uri && "has-uri"
88
+ )
89
+
83
90
  return <>
84
- <div className="gif-recorder-content">
85
- <div className="gif-recorder-sim-embed">
86
- {React.createElement(simRecorder, { onSimRecorderInit: handleSimRecorderRef })}
91
+ <div className={classes}>
92
+ <div className="gif-recorder-sim">
93
+ <div className="gif-recorder-sim-embed">
94
+ {React.createElement(simRecorder, { onSimRecorderInit: handleSimRecorderRef })}
95
+ </div>
96
+ <div className="gif-recorder">
97
+ <div className="gif-recorder-actions">
98
+ <Button className="teal inverted"
99
+ title={screenshotLabel}
100
+ label={screenshotLabel}
101
+ leftIcon="fas fa-camera"
102
+ onClick={handleScreenshotClick} />
103
+ <Button className="teal inverted"
104
+ title={recorderState === "recording" ? stopRecordingLabel : startRecordingLabel}
105
+ label={recorderState === "recording" ? stopRecordingLabel : startRecordingLabel}
106
+ leftIcon={`fas fa-${recorderState === "recording" ? "square" : "circle"}`}
107
+ onClick={handleRecordClick} />
108
+ <div className="spacer mobile-only" />
109
+ <Button className="mobile-only"
110
+ title={lf("Cancel")}
111
+ label={lf("Cancel")}
112
+ onClick={onCancel} />
113
+ </div>
114
+ </div>
87
115
  </div>
88
116
  <div className="thumbnail-controls">
89
117
  <div className="thumbnail-preview">
90
118
  <div>
91
- <span className="thumbnail-label">{lf("Current Thumbnail")}</span>
92
- <div className="thumbnail-image">
93
- {initialUri
94
- ? <img src={initialUri} />
95
- : <div className="thumbnail-placeholder" />
96
- }
119
+ <div className="thumbnail-header">
120
+ <span className="project-share-label">{thumbnailLabel}</span>
121
+ <Button
122
+ className="link-button mobile-only"
123
+ title={lf("Try again?")}
124
+ label={lf("Try again?")}
125
+ onClick={() => setUri(undefined)} />
97
126
  </div>
98
- </div>
99
- <div>
100
- <span className="thumbnail-label">{lf("New Thumbnail")}</span>
101
127
  <div className="thumbnail-image">
102
- {uri
103
- ? <img src={uri} />
128
+ {(uri || initialUri)
129
+ ? <img src={uri || initialUri} />
104
130
  : <div className="thumbnail-placeholder" />
105
131
  }
106
132
  </div>
107
133
  </div>
108
134
  </div>
109
135
  <div className="thumbnail-actions">
110
- <Button className="primary"
111
- title={lf("Apply")}
112
- label={lf("Apply")}
113
- onClick={handleApplyClick} />
136
+ {uri &&
137
+ <Button className="primary"
138
+ title={lf("Apply")}
139
+ label={lf("Apply")}
140
+ onClick={handleApplyClick} />
141
+ }
114
142
  <Button title={lf("Cancel")}
115
143
  label={lf("Cancel")}
116
144
  onClick={onCancel} />
117
145
  </div>
118
146
  </div>
119
147
  </div>
120
-
121
- <div className="gif-recorder">
122
- <div className="gif-recorder-label">{lf("Pick your project thumbnail")}</div>
123
- <div className="gif-recorder-actions">
124
- {<Button className="teal inverted"
125
- title={screenshotLabel}
126
- label={screenshotLabel}
127
- leftIcon="fas fa-camera"
128
- onClick={handleScreenshotClick} />}
129
- {<Button className="teal inverted"
130
- title={recorderState === "recording" ? stopRecordingLabel : startRecordingLabel}
131
- label={recorderState === "recording" ? stopRecordingLabel : startRecordingLabel}
132
- leftIcon={`fas fa-${recorderState === "recording" ? "square" : "circle"}`}
133
- onClick={handleRecordClick} />}
134
- </div>
135
- </div>
136
148
  </>
137
149
  }
@@ -24,7 +24,12 @@
24
24
  overflow: hidden;
25
25
  }
26
26
 
27
- @media @mobileAndBelow {
27
+ .wide > .common-modal {
28
+ width: 75%;
29
+ max-width: 60rem;
30
+ }
31
+
32
+ @media @tabletAndBelow {
28
33
  .common-modal, .wide > .common-modal {
29
34
  width: 95%;
30
35
  }
@@ -121,11 +126,6 @@
121
126
  max-height: unset;
122
127
  }
123
128
 
124
- .wide > .common-modal {
125
- width: 75%;
126
- max-width: 60rem;
127
- }
128
-
129
129
  /****************************************************
130
130
  * High Contrast *
131
131
  ****************************************************/
@@ -30,10 +30,6 @@
30
30
  justify-content: center;
31
31
  flex: 1;
32
32
 
33
- > div {
34
- margin-bottom: 1rem;
35
- }
36
-
37
33
  .project-share-content {
38
34
  flex-grow: 1;
39
35
 
@@ -50,11 +46,11 @@
50
46
 
51
47
  .project-share-title {
52
48
  margin-bottom: 1rem;
49
+ }
53
50
 
54
- h2 {
55
- margin: 0;
56
- margin-bottom: 0.5rem
57
- }
51
+ .project-share-label {
52
+ font-weight: 700;
53
+ margin-bottom: 0.5rem;
58
54
  }
59
55
 
60
56
  #project-share-dropdown {
@@ -76,6 +72,17 @@
76
72
  background-color: rgba(0, 0, 0, 0.05);
77
73
  margin-bottom: 1rem;
78
74
  }
75
+
76
+ .project-thumbnail-placeholder {
77
+ display: flex;
78
+ align-items: center;
79
+ justify-content: center;
80
+
81
+ .common-spinner {
82
+ width: 5rem;
83
+ height: 5rem;
84
+ }
85
+ }
79
86
  }
80
87
 
81
88
  .fullscreen {
@@ -98,35 +105,33 @@
98
105
  }
99
106
  }
100
107
 
108
+
101
109
  /////////////////////////////////////////
102
110
  // Embed //
103
111
  /////////////////////////////////////////
104
112
 
105
113
  .project-share-actions {
106
114
  display: flex;
115
+ flex-direction: row;
107
116
  margin-top: 1rem;
108
117
  position: relative;
109
118
  margin-bottom: 2rem;
119
+ }
110
120
 
111
- .common-button {
112
- margin-right: 0.5rem;
113
- }
121
+ .project-share-social {
122
+ display: flex;
123
+ flex-direction: row;
124
+ flex-grow: 1;
125
+ flex-wrap: wrap;
126
+ gap: 0.5rem;
114
127
  }
115
128
 
116
129
  .project-share-text {
117
130
  margin-bottom: 1rem;
118
131
  }
119
132
 
120
- .common-button.menu-button.project-qrcode {
121
- position: absolute;
122
- right: 0;
123
- height: 6rem;
124
- padding: 0.5rem;
125
- top: -0.5rem;
126
-
127
- img {
128
- height: 5rem;
129
- }
133
+ .common-button.menu-button.project-qrcode img {
134
+ height: 5rem;
130
135
  }
131
136
 
132
137
  .common-button.menu-button.project-qrcode:focus::after {
@@ -165,10 +170,12 @@
165
170
  .gif-recorder-content {
166
171
  display: flex;
167
172
  flex-direction: row;
173
+ align-items: center;
168
174
 
169
175
  .thumbnail-controls {
170
176
  display: flex;
171
177
  flex-direction: column;
178
+ padding: 0 4rem;
172
179
 
173
180
  .thumbnail-preview {
174
181
  display: flex;
@@ -184,10 +191,15 @@
184
191
  .thumbnail-placeholder {
185
192
  display: flex;
186
193
  background-color: rgba(0, 0, 0, 0.05);
187
- width: 10rem;
188
- height: 7.5rem;
194
+ width: 15rem;
195
+ height: 12.25rem;
189
196
  }
190
197
  }
198
+
199
+ .thumbnail-actions {
200
+ display: flex;
201
+ flex-direction: row;
202
+ }
191
203
  }
192
204
  }
193
205
 
@@ -200,19 +212,14 @@
200
212
  }
201
213
  }
202
214
 
215
+ .gif-recorder-sim {
216
+ flex-grow: 1;
217
+ }
218
+
203
219
  .gif-recorder {
204
- position: absolute;
205
220
  display: flex;
206
221
  flex-direction: column;
207
222
  align-items: center;
208
-
209
- bottom: 1rem;
210
- left: 50vw;
211
- padding: 1rem;
212
- transform: translateX(-50%);
213
- background: @white;
214
- border: @teal;
215
- border-radius: 0.2rem;
216
223
  font-family: @segoeUIFont;
217
224
  }
218
225
 
@@ -232,4 +239,79 @@
232
239
  background-color: rgba(0, 0, 0, 0.05);
233
240
  width: 24.5rem;
234
241
  height: 18.375rem;
242
+ }
243
+
244
+ .thumbnail-header {
245
+ display: flex;
246
+ flex-direction: row;
247
+
248
+ .project-share-label {
249
+ flex-grow: 1;
250
+ }
251
+
252
+ .common-button.link-button {
253
+ margin-bottom: 0.5rem;
254
+ }
255
+ }
256
+
257
+
258
+ /////////////////////////////////////////
259
+ // Mobile //
260
+ /////////////////////////////////////////
261
+
262
+ #root.miniSim:not(.fullscreensim) .gif-recorder-sim div.simframe {
263
+ width: 100%;
264
+ }
265
+
266
+ @media @tabletAndBelow {
267
+ .gif-recorder-content .thumbnail-controls {
268
+ padding: 0 2rem;
269
+ }
270
+ }
271
+
272
+ @media @mobileAndBelow {
273
+ .project-share-info, .gif-recorder-content {
274
+ flex-direction: column;
275
+ }
276
+
277
+ .gif-recorder-sim {
278
+ width: 100%;
279
+ }
280
+
281
+ .gif-recorder-actions {
282
+ width: 100%;
283
+
284
+ .spacer {
285
+ flex-grow: 1;
286
+ }
287
+ }
288
+
289
+ .gif-recorder-actions .common-button:not(.mobile-only) {
290
+ width: 3rem;
291
+ height: 3rem;
292
+ overflow: hidden;
293
+ padding: 0;
294
+
295
+ i, i.fas, i.far {
296
+ margin: 0;
297
+ }
298
+
299
+ .common-button-label {
300
+ display: none;
301
+ }
302
+ }
303
+
304
+ .gif-recorder-content {
305
+ &.has-uri {
306
+ .gif-recorder-sim {
307
+ display: none;
308
+ }
309
+ }
310
+
311
+ &:not(.has-uri) {
312
+ .thumbnail-controls {
313
+ display: none;
314
+ }
315
+ }
316
+ }
235
317
  }