@robotical/martyblocksjr 4.2.9 → 4.2.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.
@@ -168,8 +168,39 @@ div.frame {
168
168
  cursor: default;
169
169
  }
170
170
 
171
- .pageactionrow.delete-mode .duplicatepage {
172
- visibility: hidden;
171
+ .deletepage {
172
+ appearance: none;
173
+ position: absolute;
174
+ right: 0;
175
+ bottom: 0;
176
+ width: ${24 * scaleMultiplier}px;
177
+ height: ${24 * scaleMultiplier}px;
178
+ padding: 0;
179
+ border: 0;
180
+ border-radius: 50%;
181
+ background: url('../assets/ui/closeit.svg') no-repeat center;
182
+ background-size: 100.5%;
183
+ cursor: pointer;
184
+ opacity: 0.55;
185
+ pointer-events: auto;
186
+ transition: opacity 0.15s ease, transform 0.1s ease;
187
+ -webkit-user-select: none;
188
+ }
189
+
190
+ .deletepage:hover:not(:disabled),
191
+ .deletepage:focus-visible:not(:disabled) {
192
+ filter: brightness(1.08);
193
+ opacity: 1;
194
+ }
195
+
196
+ .deletepage:active:not(:disabled) {
197
+ opacity: 1;
198
+ transform: scale(0.94);
199
+ }
200
+
201
+ .deletepage:disabled {
202
+ opacity: 0.24;
203
+ cursor: default;
173
204
  }
174
205
 
175
206
  .duplicatepageicon,
@@ -301,22 +332,6 @@ div.frame {
301
332
  background-size: 65%;
302
333
  }
303
334
 
304
- .deletethumb {
305
- position: relative;
306
- margin: ${css_vh(-3.9)} ${css_vh(0)} ${css_vh(0)};
307
- width: ${css_vh(5.86)};
308
- height: ${css_vh(5.73)};
309
- background: url('../assets/ui/closeit.svg');
310
- background-size: 100.5%; /* webview pixelates the image unless we do this */
311
- visibility: hidden;
312
- z-index: 5;
313
- -webkit-user-select: none;
314
- }
315
-
316
- .deletethumb.on {visibility: visible; }
317
-
318
- .deletethumb.off {visibility: hidden; }
319
-
320
335
  .circle {
321
336
  position: absolute;
322
337
  width: ${css_vh(2.6)};
@@ -487,52 +502,65 @@ div.frame {
487
502
 
488
503
  /* Palette animations */
489
504
 
490
- .deleteasset {
505
+ .delete-recorded-sound {
506
+ appearance: none;
491
507
  position: absolute;
492
- /* margin: ${css_vh(-13.02)} ${css_vh(0)} ${css_vh(0)}; */
493
- top: 0; /* top: 0 seems to work better than negative margin as it's not affected by the height of the image which can be variable */
494
- width: ${css_vh(5.86)};
495
- height: ${css_vh(5.73)};
496
- background: url('../assets/ui/closeit.svg');
508
+ width: ${css_vh(4.69)};
509
+ height: ${css_vh(4.69)};
510
+ padding: 0;
511
+ border: 0;
512
+ border-radius: 50%;
513
+ background: url('../assets/ui/closeit.svg') no-repeat center;
497
514
  background-size: 100.5%; /* webview pixelates the image unless we do this */
498
515
  z-index: 5;
516
+ cursor: pointer;
517
+ opacity: 0.55;
518
+ transition: opacity 0.15s ease, transform 0.1s ease;
499
519
  -webkit-user-select: none;
500
520
  }
501
521
 
502
- /* Palette animations */
522
+ .delete-recorded-sound:hover,
523
+ .delete-recorded-sound:focus-visible {
524
+ filter: brightness(1.08);
525
+ opacity: 1;
526
+ }
503
527
 
504
- .deletesound {
505
- position: absolute;
506
- margin: ${css_vh(-0.78)} ${css_vh(-0.78)} ${css_vh(0)};
507
- width: ${css_vh(5.86)};
508
- height: ${css_vh(5.73)};
509
- background: url('../assets/ui/closeit.svg');
510
- background-size: 100.5%; /* webview pixelates the image unless we do this */
511
- z-index: 5;
512
- zoom: 75%;
513
- -webkit-user-select: none;
528
+ .delete-recorded-sound:active {
529
+ opacity: 1;
530
+ transform: scale(0.94);
514
531
  }
515
532
 
516
- .deletesprite {
533
+ .textsprite-delete-button {
534
+ appearance: none;
517
535
  position: absolute;
518
- margin: ${css_vh(0)} ${css_vh(0)} ${css_vh(0)};
519
- width: 45px;
520
- height: 44px;
521
- background: url('../assets/ui/closeit.svg');
536
+ top: -18px;
537
+ width: 36px;
538
+ height: 36px;
539
+ padding: 0;
540
+ border: 0;
541
+ border-radius: 50%;
542
+ background: url('../assets/ui/closeit.svg') no-repeat center;
522
543
  background-size: 100.5%; /* webview pixelates the image unless we do this */
523
544
  z-index: 5;
545
+ cursor: pointer;
546
+ opacity: 0.55;
547
+ transition: opacity 0.15s ease, transform 0.1s ease;
524
548
  -webkit-user-select: none;
525
549
  }
526
550
 
527
- .deletetext {
528
- position: absolute;
529
- margin: ${css_vh(-2.08)} ${css_vh(-4.17)} ${css_vh(0)};
530
- width: ${css_vh(5.86)};
531
- height: ${css_vh(5.73)};
532
- background: url('../assets/ui/closeit.svg');
533
- background-size: 100.5%; /* webview pixelates the image unless we do this */
534
- z-index: 5;
535
- -webkit-user-select: none;
551
+ .textsprite-delete-button:hover,
552
+ .textsprite-delete-button:focus-visible {
553
+ filter: brightness(1.08);
554
+ opacity: 1;
555
+ }
556
+
557
+ .textsprite-delete-button:active {
558
+ opacity: 1;
559
+ transform: scale(0.94);
560
+ }
561
+
562
+ .stage.fullscreen .textsprite-delete-button {
563
+ display: none;
536
564
  }
537
565
 
538
566
  .shakeme{
@@ -287,7 +287,7 @@
287
287
  top: 0px;
288
288
  right: 0;
289
289
  width: ${css_vh(1.04)};
290
- height: ${css_vh(25.63)};
290
+ height: ${css_vh(39.58)};
291
291
  background: rgba(255,255,255,0.5);
292
292
  touch-action: none;
293
293
  z-index: 8;
@@ -319,7 +319,7 @@
319
319
  padding: 0px;
320
320
  top: ${css_vh(14.75)};
321
321
  left: ${css_vh(7.55)};
322
- width: ${css_vh(33.85)};
322
+ width: ${css_vh(27.34)};
323
323
  overflow-x: hidden;
324
324
  }
325
325
 
@@ -330,8 +330,8 @@
330
330
  display: block;
331
331
  overflow-y: scroll;
332
332
  overflow-x: hidden;
333
- width: ${css_vh(33.85)};
334
- max-height: ${css_vh(25.63)};
333
+ width: ${css_vh(27.34)};
334
+ max-height: ${css_vh(39.58)};
335
335
  }
336
336
 
337
337
  .spritethumbs::-webkit-scrollbar {
@@ -345,6 +345,23 @@
345
345
  width: ${css_vh(29.95)};
346
346
  }
347
347
 
348
+ #library .spritethumbs .spriteactions {
349
+ position: absolute;
350
+ top: 0;
351
+ left: ${css_vh(2.34)};
352
+ width: ${css_vh(29.95)};
353
+ z-index: 7;
354
+ pointer-events: none;
355
+ }
356
+
357
+ .spriteactionrow {
358
+ position: relative;
359
+ width: ${css_vh(23.18)};
360
+ height: ${css_vh(10.16)};
361
+ margin: 0 0 ${css_vh(-0.39)};
362
+ pointer-events: none;
363
+ }
364
+
348
365
  #library .addsprite {
349
366
  position: relative;
350
367
  display: inline-block;
@@ -461,28 +478,34 @@
461
478
  background-size: 100% 100%;
462
479
  }
463
480
 
464
- .spritethumb.on .deletespritethumb {
481
+ .deletespritethumb {
482
+ appearance: none;
465
483
  position: absolute;
466
- margin: 0px 0px 0px;
467
- left: 0px;
468
- width: ${css_vh(5.86)};
469
- height: ${css_vh(5.73)};
470
- background: url('../assets/ui/closeit.svg');
484
+ top: ${css_vh(0.39)};
485
+ right: ${css_vh(0.52)};
486
+ width: ${css_vh(3.13)};
487
+ height: ${css_vh(3.13)};
488
+ padding: 0;
489
+ border: 0;
490
+ border-radius: 50%;
491
+ background: url('../assets/ui/closeit.svg') no-repeat center;
471
492
  background-size: 100.5%; /* webview pixelates the image unless we do this */
472
- z-index: 5;
493
+ cursor: pointer;
494
+ opacity: 0.55;
495
+ pointer-events: auto;
496
+ transition: opacity 0.15s ease, transform 0.1s ease;
473
497
  -webkit-user-select: none;
474
498
  }
475
499
 
476
- .spritethumb.off .deletespritethumb {
477
- position: absolute;
478
- margin: 0px 0px 0px;
479
- left: 0px;
480
- width: ${css_vh(5.86)};
481
- height: ${css_vh(5.73)};
482
- background: url('../assets/ui/closeit.svg');
483
- background-size: 100.5%; /* webview pixelates the image unless we do this */
484
- z-index: 5;
485
- -webkit-user-select: none;
500
+ .deletespritethumb:hover,
501
+ .deletespritethumb:focus-visible {
502
+ filter: brightness(1.08);
503
+ opacity: 1;
504
+ }
505
+
506
+ .deletespritethumb:active {
507
+ opacity: 1;
508
+ transform: scale(0.94);
486
509
  }
487
510
 
488
511
  .spritethumb .icon{
@@ -200,6 +200,7 @@ hr.bigdivide{
200
200
  }
201
201
 
202
202
  .assetbox {
203
+ position: relative;
203
204
  display: inline-block;
204
205
  vertical-align: top;
205
206
  width: ${css_vh(17.84)};
@@ -208,6 +209,37 @@ hr.bigdivide{
208
209
  padding: ${css_vh(0.65)};
209
210
  }
210
211
 
212
+ .asset-delete-button {
213
+ appearance: none;
214
+ position: absolute;
215
+ top: ${css_vh(0.39)};
216
+ right: ${css_vh(0.39)};
217
+ width: ${css_vh(3.13)};
218
+ height: ${css_vh(3.13)};
219
+ padding: 0;
220
+ border: 0;
221
+ border-radius: 50%;
222
+ background: url('../assets/ui/closeit.svg') no-repeat center;
223
+ background-size: 100.5%;
224
+ cursor: pointer;
225
+ opacity: 0.55;
226
+ pointer-events: auto;
227
+ transition: opacity 0.15s ease, transform 0.1s ease;
228
+ z-index: 20;
229
+ -webkit-user-select: none;
230
+ }
231
+
232
+ .asset-delete-button:hover,
233
+ .asset-delete-button:focus-visible {
234
+ filter: brightness(1.08);
235
+ opacity: 1;
236
+ }
237
+
238
+ .asset-delete-button:active {
239
+ opacity: 1;
240
+ transform: scale(0.94);
241
+ }
242
+
211
243
  .assetbox.off {
212
244
  background: url('../assets/paint/thumbOff.png') no-repeat center top;
213
245
  background-size: 100%;
@@ -3,7 +3,7 @@
3
3
  position: relative;
4
4
  margin: 0px;
5
5
  padding: 0px;
6
- width: ${css_vw(21.68)};
6
+ width: ${css_vh(28.91)};
7
7
  height: ${css_vh(26.04)};
8
8
  vertical-align: top;
9
9
  }
@@ -159,94 +159,43 @@
159
159
  left: 8px;
160
160
  }
161
161
 
162
- .card-action-delete {
163
- left: auto;
164
- right: 8px;
165
- }
166
-
167
- .project-options-button {
162
+ .project-delete-button {
163
+ display: flex;
164
+ align-items: center;
165
+ justify-content: center;
168
166
  position: absolute;
169
167
  top: ${css_vh(1.1)};
170
168
  right: ${css_vh(0.8)};
171
169
  z-index: 8;
172
170
  width: ${css_vh(5.2)};
173
171
  height: ${css_vh(5.2)};
174
- padding: 0 0 ${css_vh(1.1)};
175
- border: 2px solid #315F7B;
172
+ padding: 0 0 ${css_vh(0.3)};
173
+ border: 2px solid #fff;
176
174
  border-radius: 50%;
177
- background: rgba(255, 255, 255, 0.94);
178
- box-shadow: 0 ${css_vh(0.25)} ${css_vh(0.55)} rgba(27, 62, 78, 0.35);
179
- color: #315F7B;
175
+ background: #E43D44;
176
+ box-shadow: 0 0 0 2px #9E1F28, 0 ${css_vh(0.25)} ${css_vh(0.55)} rgba(27, 62, 78, 0.35);
177
+ color: #fff;
180
178
  cursor: pointer;
181
179
  font-family: 'Lato Regular';
182
- font-size: ${css_vh(4.2)};
180
+ font-size: ${css_vh(3.8)};
183
181
  font-weight: bold;
184
182
  line-height: 1;
183
+ opacity: 0.55;
184
+ transition: opacity 0.15s ease, transform 0.1s ease;
185
185
  -webkit-tap-highlight-color: transparent;
186
186
  }
187
187
 
188
- .project-options-button:hover,
189
- .project-options-button:focus-visible,
190
- .project-options-button[aria-expanded="true"] {
191
- background: #EAF7FF;
188
+ .project-delete-button:hover,
189
+ .project-delete-button:focus-visible {
190
+ background: #C92F37;
191
+ opacity: 1;
192
192
  outline: 3px solid #133C46;
193
- outline-offset: 2px;
194
- }
195
-
196
- .project-options-menu {
197
- position: absolute;
198
- top: ${css_vh(6.7)};
199
- right: ${css_vh(0.8)};
200
- z-index: 20;
201
- min-width: ${css_vh(18)};
202
- padding: ${css_vh(0.7)};
203
- border: 2px solid #315F7B;
204
- border-radius: 12px;
205
- background: #FFFDF7;
206
- box-shadow: 0 ${css_vh(0.45)} ${css_vh(1.1)} rgba(27, 62, 78, 0.4);
207
- }
208
-
209
- .project-options-menu[hidden] {
210
- display: none;
211
- }
212
-
213
- .project-options-delete {
214
- display: flex;
215
- align-items: center;
216
- gap: ${css_vh(0.8)};
217
- width: 100%;
218
- min-height: ${css_vh(4.8)};
219
- padding: ${css_vh(0.7)} ${css_vh(1)};
220
- border: 0;
221
- border-radius: 8px;
222
- background: transparent;
223
- color: #9E1F28;
224
- cursor: pointer;
225
- font-family: 'Lato Regular';
226
- font-size: ${css_vh(1.8)};
227
- font-weight: bold;
228
- text-align: left;
229
- white-space: nowrap;
230
- }
231
-
232
- .project-options-delete:hover,
233
- .project-options-delete:focus-visible {
234
- background: #FCE5E5;
235
- outline: 3px solid #9E1F28;
236
- outline-offset: -1px;
193
+ outline-offset: 3px;
237
194
  }
238
195
 
239
- .project-options-delete-icon {
240
- display: inline-flex;
241
- align-items: center;
242
- justify-content: center;
243
- width: ${css_vh(2.6)};
244
- height: ${css_vh(2.6)};
245
- border-radius: 50%;
246
- background: #E43D44;
247
- color: #fff;
248
- font-size: ${css_vh(1.8)};
249
- line-height: 1;
196
+ .project-delete-button:active {
197
+ opacity: 1;
198
+ transform: scale(0.94);
250
199
  }
251
200
 
252
201
  .project-delete-dialog-backdrop {
@@ -264,7 +213,9 @@
264
213
  }
265
214
 
266
215
  .project-delete-dialog {
267
- width: min(${css_vh(52)}, 90vw);
216
+ box-sizing: border-box;
217
+ width: ${css_vh(52)};
218
+ max-width: 90vw;
268
219
  padding: ${css_vh(3)};
269
220
  border: ${css_vh(0.4)} solid #315F7B;
270
221
  border-radius: 18px;
@@ -325,18 +276,6 @@
325
276
  outline-offset: 3px;
326
277
  }
327
278
 
328
- .closex {
329
- position: relative;
330
- float: left;
331
- top: ${css_vh(-54.17)};
332
- z-index: 5;
333
- visibility: hidden;
334
- width: ${css_vh(5.86)};
335
- height: ${css_vh(5.73)};
336
- background: url('../assets/ui/closeit.svg');
337
- background-size: 101%;
338
- }
339
-
340
279
  .share {
341
280
  position: relative;
342
281
  top: ${css_vh(-22.14)};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robotical/martyblocksjr",
3
- "version": "4.2.9",
3
+ "version": "4.2.10",
4
4
  "description": "ScratchJr",
5
5
  "repository": {
6
6
  "type": "git",
@@ -340,7 +340,7 @@ describe("duplicate page", () => {
340
340
  );
341
341
 
342
342
  it(
343
- "always shows the duplicate glyph and hides the action during long-press delete mode",
343
+ "always shows duplicate and bottom-right delete actions without long-press mode",
344
344
  async () => {
345
345
  const { browser, page, errors } = await openPage("/editor.html?mode=edit");
346
346
 
@@ -353,6 +353,12 @@ describe("duplicate page", () => {
353
353
  const action = document.querySelector(
354
354
  `#pageactions .duplicatepage[data-owner="${currentPageId}"]`
355
355
  );
356
+ const deleteAction = document.querySelector(
357
+ `#pageactions .deletepage[data-owner="${currentPageId}"]`
358
+ );
359
+ const row = deleteAction.parentElement;
360
+ const deleteBounds = deleteAction.getBoundingClientRect();
361
+ const rowBounds = row.getBoundingClientRect();
356
362
  const icon = action.querySelector(".duplicatepageicon");
357
363
  const backSquare = window.getComputedStyle(icon, "::before");
358
364
  const frontSquare = window.getComputedStyle(icon, "::after");
@@ -362,6 +368,10 @@ describe("duplicate page", () => {
362
368
  frontContent: frontSquare.content,
363
369
  backZIndex: backSquare.zIndex,
364
370
  frontZIndex: frontSquare.zIndex,
371
+ deleteVisibility: window.getComputedStyle(deleteAction).visibility,
372
+ deleteEnabled: !deleteAction.disabled,
373
+ deleteAtBottomRight: Math.abs(deleteBounds.right - rowBounds.right) < 2
374
+ && Math.abs(deleteBounds.bottom - rowBounds.bottom) < 2,
365
375
  };
366
376
  }, pageId);
367
377
 
@@ -370,8 +380,11 @@ describe("duplicate page", () => {
370
380
  expect(restingState.frontContent).not.toBe("none");
371
381
  expect(restingState.backZIndex).not.toBe("-1");
372
382
  expect(restingState.frontZIndex).not.toBe("-1");
383
+ expect(restingState.deleteVisibility).toBe("visible");
384
+ expect(restingState.deleteEnabled).toBe(true);
385
+ expect(restingState.deleteAtBottomRight).toBe(true);
373
386
 
374
- await page.evaluate((currentPageId) => new Promise((resolve) => {
387
+ const heldState = await page.evaluate((currentPageId) => new Promise((resolve) => {
375
388
  const thumb = document.querySelector(`.pagethumb[data-owner="${currentPageId}"]`);
376
389
  const bounds = thumb.getBoundingClientRect();
377
390
  thumb.dispatchEvent(new PointerEvent("pointerdown", {
@@ -383,27 +396,39 @@ describe("duplicate page", () => {
383
396
  pointerType: "mouse",
384
397
  isPrimary: true,
385
398
  }));
386
- window.setTimeout(resolve, 600);
399
+ window.setTimeout(() => {
400
+ const duplicateAction = document.querySelector(
401
+ `#pageactions .duplicatepage[data-owner="${currentPageId}"]`
402
+ );
403
+ const deleteAction = document.querySelector(
404
+ `#pageactions .deletepage[data-owner="${currentPageId}"]`
405
+ );
406
+ const result = {
407
+ isShaking: thumb.classList.contains("shakeme"),
408
+ hasLegacyDeleteControl: Boolean(thumb.querySelector(".deletethumb")),
409
+ duplicateVisibility: window.getComputedStyle(duplicateAction).visibility,
410
+ deleteVisibility: window.getComputedStyle(deleteAction).visibility,
411
+ };
412
+ window.dispatchEvent(new PointerEvent("pointerup", {
413
+ bubbles: true,
414
+ cancelable: true,
415
+ clientX: bounds.left + (bounds.width / 2),
416
+ clientY: bounds.top + (bounds.height / 2),
417
+ pointerId: 1,
418
+ pointerType: "mouse",
419
+ isPrimary: true,
420
+ }));
421
+ resolve(result);
422
+ }, 600);
387
423
  }), pageId);
388
- await page.waitForFunction((currentPageId) => {
389
- const thumb = document.querySelector(`.pagethumb[data-owner="${currentPageId}"]`);
390
- const action = document.querySelector(
391
- `#pageactions .duplicatepage[data-owner="${currentPageId}"]`
392
- );
393
- return thumb.classList.contains("shakeme")
394
- && window.getComputedStyle(action).visibility === "hidden"
395
- && window.getComputedStyle(thumb.querySelector(".deletethumb")).visibility === "visible";
396
- }, { timeout: 5_000 }, pageId);
397
424
 
398
- await page.evaluate(() => window.ScratchJr.clearSelection());
399
- await page.waitForFunction((currentPageId) => {
400
- const thumb = document.querySelector(`.pagethumb[data-owner="${currentPageId}"]`);
401
- const action = document.querySelector(
402
- `#pageactions .duplicatepage[data-owner="${currentPageId}"]`
403
- );
404
- return !thumb.classList.contains("shakeme")
405
- && window.getComputedStyle(action).visibility === "visible";
406
- }, { timeout: 5_000 }, pageId);
425
+ expect(heldState.isShaking).toBe(false);
426
+ expect(heldState.hasLegacyDeleteControl).toBe(false);
427
+ expect(heldState.duplicateVisibility).toBe("visible");
428
+ expect(heldState.deleteVisibility).toBe("visible");
429
+
430
+ await page.click(`#pageactions .deletepage[data-owner="${pageId}"]`);
431
+ await page.waitForFunction(() => window.ScratchJr.stage.pages.length === 1);
407
432
  expect(errors).toEqual([]);
408
433
  } finally {
409
434
  await browser.close();