pxt-core 8.5.13 → 8.5.15

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.
@@ -531,6 +531,7 @@ declare namespace pxt {
531
531
  hash?: string;
532
532
  usedBlocks: Map<number>;
533
533
  snippetBlocks: Map<Map<number>>;
534
+ highlightBlocks: Map<Map<number>>;
534
535
  }
535
536
 
536
537
  interface PackageApiInfo {
@@ -635,6 +636,10 @@ declare namespace pxt.editor {
635
636
  NoPython = "no-python",
636
637
  NoJavaScript = "no-javascript"
637
638
  }
639
+
640
+ // Placeholder for IProjectView defined in pxteditor.d.ts
641
+ interface IProjectView {
642
+ }
638
643
  }
639
644
 
640
645
  declare namespace ts.pxtc {
@@ -1102,6 +1107,7 @@ declare namespace pxt.tutorial {
1102
1107
  customTs?: string; // custom typescript code loaded in a separate file for the tutorial
1103
1108
  tutorialValidationRules?: pxt.Map<boolean>; //a map of rules used in a tutorial and if the rules are activated
1104
1109
  globalBlockConfig?: TutorialBlockConfig; // concatenated `blockconfig.global` sections. Contains block configs applicable to all tutorial steps
1110
+ globalValidationConfig?: CodeValidationConfig; // concatenated 'validation.global' sections. Contains validation config applicable to all steps
1105
1111
  }
1106
1112
 
1107
1113
  interface TutorialMetadata {
@@ -1137,6 +1143,30 @@ declare namespace pxt.tutorial {
1137
1143
  blocks?: TutorialBlockConfigEntry[]; // markdown fragment can contain multiple block definitions
1138
1144
  }
1139
1145
 
1146
+ interface CodeValidationResult {
1147
+ isValid: Boolean;
1148
+ hint: any;
1149
+ }
1150
+
1151
+ interface CodeValidationExecuteOptions {
1152
+ parent: pxt.editor.IProjectView;
1153
+ tutorialOptions: TutorialOptions;
1154
+ }
1155
+
1156
+ interface CodeValidator {
1157
+ enabled: boolean;
1158
+ execute(options: CodeValidationExecuteOptions): Promise<CodeValidationResult>;
1159
+ }
1160
+
1161
+ interface CodeValidatorMetadata {
1162
+ validatorType: string;
1163
+ properties: pxt.Map<string>;
1164
+ }
1165
+
1166
+ interface CodeValidationConfig {
1167
+ validatorsMetadata: CodeValidatorMetadata[];
1168
+ }
1169
+
1140
1170
  interface TutorialStepInfo {
1141
1171
  // Step metadata
1142
1172
  showHint?: boolean; // automatically displays hint
@@ -1161,6 +1191,9 @@ declare namespace pxt.tutorial {
1161
1191
 
1162
1192
  // concatenated `blockconfig.local` sections. Contains block configs applicable to the current step only
1163
1193
  localBlockConfig?: pxt.tutorial.TutorialBlockConfig;
1194
+
1195
+ // concatenated 'validation.local' sections. Contains config applicable to this step only.
1196
+ localValidationConfig?: pxt.tutorial.CodeValidationConfig;
1164
1197
  }
1165
1198
 
1166
1199
  interface TutorialActivityInfo {
@@ -1193,6 +1226,7 @@ declare namespace pxt.tutorial {
1193
1226
  tutorialValidationRules?: pxt.Map<boolean>; //a map of rules used in a tutorial and if the rules are activated
1194
1227
  templateLoaded?: boolean; // if the template code has been loaded once, we skip
1195
1228
  globalBlockConfig?: TutorialBlockConfig; // concatenated `blockconfig.global` sections. Contains block configs applicable to all tutorial steps
1229
+ globalValidationConfig?: CodeValidationConfig // concatenated 'validation.global' sections. Contains validation config applicable to all steps
1196
1230
  }
1197
1231
  interface TutorialCompletionInfo {
1198
1232
  // id of the tutorial
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pxt-core",
3
- "version": "8.5.13",
3
+ "version": "8.5.15",
4
4
  "description": "Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors",
5
5
  "keywords": [
6
6
  "TypeScript",
@@ -555,6 +555,82 @@
555
555
  }
556
556
  }
557
557
 
558
+ /*********************************
559
+ Validation
560
+ *********************************/
561
+ .tutorial-validation-error-container {
562
+ position: fixed;
563
+ top: unset;
564
+ right: unset;
565
+ bottom: 5.5rem;
566
+ left: 23rem;
567
+ max-width: 60%;
568
+ min-width: 18.75rem;
569
+ max-height: 70%;
570
+ background: @white;
571
+ box-shadow: 0 0rem 0.5rem;
572
+ border-radius: 0.5rem;
573
+ z-index: 40;
574
+ }
575
+
576
+ .tutorial-validation-error-body {
577
+ display: flex;
578
+ flex-direction: row;
579
+ padding: 2rem 2rem 2rem 0.5rem;
580
+ }
581
+
582
+ .tutorial-validation-error-hint {
583
+ padding: 1.5rem;
584
+ }
585
+
586
+ .tutorial-validation-error-inner {
587
+ display: flex;
588
+ flex-direction: column;
589
+ }
590
+
591
+ .tutorial-validation-error-emoji {
592
+ font-size: 3rem;
593
+ padding-top: 1rem;
594
+ padding-right: 0.2rem;
595
+ }
596
+
597
+ .tutorial-validation-error-controls {
598
+ display: flex;
599
+ justify-content: right;
600
+ margin: 0;
601
+ margin-top: 0.5rem;
602
+
603
+ > .common-button {
604
+ width: unset;
605
+ }
606
+ }
607
+
608
+ .tutorial-validation-error-close.common-button {
609
+ position: absolute;
610
+ right: 0.6rem;
611
+ top: 0.8rem;
612
+ padding: 0 !important;
613
+
614
+ i.right {
615
+ opacity: 1;
616
+ font-size: 1.3rem;
617
+ margin: 0 !important;
618
+ }
619
+ }
620
+
621
+ .tutorial-validation-answer-key-hint {
622
+ max-height: 50vh;
623
+ overflow: auto;
624
+ padding-right: 2rem;
625
+ }
626
+
627
+ /* Remove border around blocks in the hint */
628
+ .tutorial-validation-answer-key-hint .lang-blocks .segment.raised {
629
+ border: none;
630
+ background: none;
631
+ box-shadow: none;
632
+ padding: 0;
633
+ }
558
634
  /*******************************
559
635
  Media Adjustments
560
636
  *******************************/
@@ -876,6 +952,15 @@
876
952
  .tutorial-title {
877
953
  max-width: calc(100% - 10rem);
878
954
  }
955
+
956
+ /*******************************
957
+ Validation
958
+ *******************************/
959
+
960
+ .tutorial-validation-error-container {
961
+ right: 1rem;
962
+ left: unset;
963
+ }
879
964
  }
880
965
 
881
966
  /* thin tablet header */
@@ -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.1a1e5af6.js"></script><link href="/blb/multiplayer/css/main.30eccbaa.css" rel="stylesheet"></head>
12
+ <script defer="defer" src="/blb/multiplayer/js/main.816fb70a.js"></script><link href="/blb/multiplayer/css/main.30eccbaa.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.3008f5a9.js"></script><link href="/blb/skillmap/css/main.06a18ee8.css" rel="stylesheet"></head>
10
+ <script defer="defer" src="/blb/skillmap/js/main.ae646473.js"></script><link href="/blb/skillmap/css/main.06a18ee8.css" rel="stylesheet"></head>
11
11
  <body>
12
12
  <noscript>You need to enable JavaScript to run this app.</noscript>
13
13