pxt-core 12.2.14 → 12.2.16

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.
Files changed (38) hide show
  1. package/built/pxt.js +12 -6
  2. package/built/pxtcompiler.d.ts +1 -0
  3. package/built/pxtcompiler.js +12 -6
  4. package/built/react-common/components/share/Share.d.ts +2 -1
  5. package/built/react-common/components/share/ShareInfo.d.ts +2 -2
  6. package/built/react-common/components/share/ShareLinkDialog.d.ts +12 -0
  7. package/built/target.js +1 -1
  8. package/built/targetlight.js +1 -1
  9. package/built/web/icons.css +44 -50
  10. package/built/web/icons.html +0 -2
  11. package/built/web/main.js +31 -31
  12. package/built/web/pxtcompiler.js +1 -1
  13. package/built/web/pxtembed.js +1 -1
  14. package/built/web/pxtworker.js +1 -1
  15. package/built/web/react-common-authcode.css +1 -1
  16. package/built/web/react-common-multiplayer.css +1 -1
  17. package/built/web/react-common-skillmap.css +1 -1
  18. package/built/web/rtlreact-common-authcode.css +1 -1
  19. package/built/web/rtlreact-common-multiplayer.css +1 -1
  20. package/built/web/rtlreact-common-skillmap.css +1 -1
  21. package/built/web/rtlsemantic.css +2 -2
  22. package/built/web/semantic.css +2 -2
  23. package/built/web/skillmap/js/{main.89c76d6b.js → main.ab86acc7.js} +2 -2
  24. package/built/web/teachertool/js/{main.696248ce.js → main.7b6efbfc.js} +2 -2
  25. package/localtypings/pxtarget.d.ts +2 -0
  26. package/localtypings/pxteditor.d.ts +1 -1
  27. package/package.json +1 -1
  28. package/react-common/components/share/Share.tsx +4 -1
  29. package/react-common/components/share/ShareInfo.tsx +22 -8
  30. package/react-common/components/share/ShareLinkDialog.tsx +94 -0
  31. package/react-common/styles/controls/Textarea.less +7 -4
  32. package/react-common/styles/share/share.less +14 -0
  33. package/theme/common.less +8 -0
  34. package/theme/home.less +26 -17
  35. package/theme/pxt.less +1 -0
  36. package/theme/pxtjson.less +5 -0
  37. package/webapp/public/skillmap.html +1 -1
  38. package/webapp/public/teachertool.html +1 -1
package/built/pxt.js CHANGED
@@ -141655,6 +141655,7 @@ var ts;
141655
141655
  blocksInfo,
141656
141656
  screenSize,
141657
141657
  apis: service.lastApiInfo.apis,
141658
+ decls: service.lastApiInfo.decls,
141658
141659
  checker: (_b = service.service === null || service.service === void 0 ? void 0 : service.service.getProgram()) === null || _b === void 0 ? void 0 : _b.getTypeChecker()
141659
141660
  };
141660
141661
  resultSymbols.forEach(sym => patchSymbolWithSnippet(sym.symbol, isPython, context));
@@ -142705,7 +142706,7 @@ var ts;
142705
142706
  takenNames = service_1.lastApiInfo.apis.byQName;
142706
142707
  }
142707
142708
  const { bannedCategories, screenSize } = v.runtime;
142708
- const { apis } = service_1.lastApiInfo;
142709
+ const { apis, decls } = service_1.lastApiInfo;
142709
142710
  const blocksInfo = blocksInfoOp(apis, bannedCategories);
142710
142711
  const checker = service_1.service && service_1.service.getProgram().getTypeChecker();
142711
142712
  // needed for blocks that have parent wraps like music.play(...)
@@ -142719,7 +142720,8 @@ var ts;
142719
142720
  bannedCategories,
142720
142721
  screenSize,
142721
142722
  checker,
142722
- includeParentSnippet
142723
+ includeParentSnippet,
142724
+ decls
142723
142725
  };
142724
142726
  const snippetNode = service_1.getSnippet(snippetContext, fn, n, isPython);
142725
142727
  const snippet = service_1.snippetStringify(snippetNode);
@@ -143187,12 +143189,16 @@ var ts;
143187
143189
  }
143188
143190
  service.snippetAddsDefinitions = snippetAddsDefinitions;
143189
143191
  function getSnippet(context, fn, decl, python, recursionDepth = 0) {
143190
- var _a, _b, _c;
143192
+ var _a, _b, _c, _d;
143191
143193
  // TODO: a lot of this is duplicate logic with blocklyloader.ts:buildBlockFromDef; we should
143192
143194
  // unify these approaches
143193
143195
  let { apis, takenNames, blocksInfo, screenSize, checker, parameterOverride, includeParentSnippet } = context;
143194
143196
  const PY_INDENT = pxt.py.INDENT;
143195
143197
  const fileType = python ? "python" : "typescript";
143198
+ if (fn.attributes.blockAliasFor) {
143199
+ fn = apis.byQName[fn.attributes.blockAliasFor] || fn;
143200
+ decl = ((_a = context.decls) === null || _a === void 0 ? void 0 : _a[fn.qName]) || decl;
143201
+ }
143196
143202
  let snippetPrefix = fn.namespace;
143197
143203
  let addNamespace = false;
143198
143204
  let namespaceToUse = "";
@@ -143201,7 +143207,7 @@ var ts;
143201
143207
  let overrideParamLabel;
143202
143208
  let overrideSnippet;
143203
143209
  if (parameterOverride) {
143204
- overrideParamLabel = (_a = Object.keys(parameterOverride)) === null || _a === void 0 ? void 0 : _a[0];
143210
+ overrideParamLabel = (_b = Object.keys(parameterOverride)) === null || _b === void 0 ? void 0 : _b[0];
143205
143211
  if (overrideParamLabel) {
143206
143212
  overrideSnippet = parameterOverride[overrideParamLabel];
143207
143213
  }
@@ -143232,7 +143238,7 @@ var ts;
143232
143238
  const params = pxt.blocks.compileInfo(element);
143233
143239
  const blocksById = blocksInfo.blocksById;
143234
143240
  // TODO: move out of getSnippet for general reuse
143235
- const blockParameters = ((_b = attrs._def) === null || _b === void 0 ? void 0 : _b.parameters.filter(param => !!params.definitionNameToParam[param.name]).map(param => params.definitionNameToParam[param.name].actualName)) || [];
143241
+ const blockParameters = ((_c = attrs._def) === null || _c === void 0 ? void 0 : _c.parameters.filter(param => !!params.definitionNameToParam[param.name]).map(param => params.definitionNameToParam[param.name].actualName)) || [];
143236
143242
  const includedParameters = decl.parameters ? decl.parameters
143237
143243
  // Only keep required parameters and parameters included in the blockdef
143238
143244
  .filter(param => (!param.initializer && !param.questionToken)
@@ -143252,7 +143258,7 @@ var ts;
143252
143258
  if (python && snippetPrefix)
143253
143259
  snippetPrefix = pxtc.U.snakify(snippetPrefix);
143254
143260
  }
143255
- else if (((_c = params.thisParameter) === null || _c === void 0 ? void 0 : _c.shadowBlockId) === "variables_get") {
143261
+ else if (((_d = params.thisParameter) === null || _d === void 0 ? void 0 : _d.shadowBlockId) === "variables_get") {
143256
143262
  snippetPrefix = params.thisParameter.defaultValue || params.thisParameter.definitionName;
143257
143263
  if (python && snippetPrefix)
143258
143264
  snippetPrefix = pxtc.U.snakify(snippetPrefix);
@@ -1028,6 +1028,7 @@ declare namespace ts.pxtc.service {
1028
1028
  [key: string]: SnippetNode;
1029
1029
  };
1030
1030
  includeParentSnippet?: boolean;
1031
+ decls?: pxt.Map<ts.Declaration>;
1031
1032
  }
1032
1033
  function getSnippet(context: SnippetContext, fn: SymbolInfo, decl: ts.FunctionLikeDeclaration, python?: boolean, recursionDepth?: number): SnippetNode;
1033
1034
  function isTaggedTemplate(sym: SymbolInfo): boolean;
@@ -17189,6 +17189,7 @@ var ts;
17189
17189
  blocksInfo,
17190
17190
  screenSize,
17191
17191
  apis: service.lastApiInfo.apis,
17192
+ decls: service.lastApiInfo.decls,
17192
17193
  checker: (_b = service.service === null || service.service === void 0 ? void 0 : service.service.getProgram()) === null || _b === void 0 ? void 0 : _b.getTypeChecker()
17193
17194
  };
17194
17195
  resultSymbols.forEach(sym => patchSymbolWithSnippet(sym.symbol, isPython, context));
@@ -18239,7 +18240,7 @@ var ts;
18239
18240
  takenNames = service_1.lastApiInfo.apis.byQName;
18240
18241
  }
18241
18242
  const { bannedCategories, screenSize } = v.runtime;
18242
- const { apis } = service_1.lastApiInfo;
18243
+ const { apis, decls } = service_1.lastApiInfo;
18243
18244
  const blocksInfo = blocksInfoOp(apis, bannedCategories);
18244
18245
  const checker = service_1.service && service_1.service.getProgram().getTypeChecker();
18245
18246
  // needed for blocks that have parent wraps like music.play(...)
@@ -18253,7 +18254,8 @@ var ts;
18253
18254
  bannedCategories,
18254
18255
  screenSize,
18255
18256
  checker,
18256
- includeParentSnippet
18257
+ includeParentSnippet,
18258
+ decls
18257
18259
  };
18258
18260
  const snippetNode = service_1.getSnippet(snippetContext, fn, n, isPython);
18259
18261
  const snippet = service_1.snippetStringify(snippetNode);
@@ -18721,12 +18723,16 @@ var ts;
18721
18723
  }
18722
18724
  service.snippetAddsDefinitions = snippetAddsDefinitions;
18723
18725
  function getSnippet(context, fn, decl, python, recursionDepth = 0) {
18724
- var _a, _b, _c;
18726
+ var _a, _b, _c, _d;
18725
18727
  // TODO: a lot of this is duplicate logic with blocklyloader.ts:buildBlockFromDef; we should
18726
18728
  // unify these approaches
18727
18729
  let { apis, takenNames, blocksInfo, screenSize, checker, parameterOverride, includeParentSnippet } = context;
18728
18730
  const PY_INDENT = pxt.py.INDENT;
18729
18731
  const fileType = python ? "python" : "typescript";
18732
+ if (fn.attributes.blockAliasFor) {
18733
+ fn = apis.byQName[fn.attributes.blockAliasFor] || fn;
18734
+ decl = ((_a = context.decls) === null || _a === void 0 ? void 0 : _a[fn.qName]) || decl;
18735
+ }
18730
18736
  let snippetPrefix = fn.namespace;
18731
18737
  let addNamespace = false;
18732
18738
  let namespaceToUse = "";
@@ -18735,7 +18741,7 @@ var ts;
18735
18741
  let overrideParamLabel;
18736
18742
  let overrideSnippet;
18737
18743
  if (parameterOverride) {
18738
- overrideParamLabel = (_a = Object.keys(parameterOverride)) === null || _a === void 0 ? void 0 : _a[0];
18744
+ overrideParamLabel = (_b = Object.keys(parameterOverride)) === null || _b === void 0 ? void 0 : _b[0];
18739
18745
  if (overrideParamLabel) {
18740
18746
  overrideSnippet = parameterOverride[overrideParamLabel];
18741
18747
  }
@@ -18766,7 +18772,7 @@ var ts;
18766
18772
  const params = pxt.blocks.compileInfo(element);
18767
18773
  const blocksById = blocksInfo.blocksById;
18768
18774
  // TODO: move out of getSnippet for general reuse
18769
- const blockParameters = ((_b = attrs._def) === null || _b === void 0 ? void 0 : _b.parameters.filter(param => !!params.definitionNameToParam[param.name]).map(param => params.definitionNameToParam[param.name].actualName)) || [];
18775
+ const blockParameters = ((_c = attrs._def) === null || _c === void 0 ? void 0 : _c.parameters.filter(param => !!params.definitionNameToParam[param.name]).map(param => params.definitionNameToParam[param.name].actualName)) || [];
18770
18776
  const includedParameters = decl.parameters ? decl.parameters
18771
18777
  // Only keep required parameters and parameters included in the blockdef
18772
18778
  .filter(param => (!param.initializer && !param.questionToken)
@@ -18786,7 +18792,7 @@ var ts;
18786
18792
  if (python && snippetPrefix)
18787
18793
  snippetPrefix = pxtc.U.snakify(snippetPrefix);
18788
18794
  }
18789
- else if (((_c = params.thisParameter) === null || _c === void 0 ? void 0 : _c.shadowBlockId) === "variables_get") {
18795
+ else if (((_d = params.thisParameter) === null || _d === void 0 ? void 0 : _d.shadowBlockId) === "variables_get") {
18790
18796
  snippetPrefix = params.thisParameter.defaultValue || params.thisParameter.definitionName;
18791
18797
  if (python && snippetPrefix)
18792
18798
  snippetPrefix = pxtc.U.snakify(snippetPrefix);
@@ -13,6 +13,7 @@ export interface ShareData {
13
13
  }
14
14
  export interface ShareProps {
15
15
  projectName: string;
16
+ projectDescription?: string;
16
17
  screenshotUri?: string;
17
18
  isLoggedIn?: boolean;
18
19
  hasProjectBeenPersistentShared?: boolean;
@@ -21,7 +22,7 @@ export interface ShareProps {
21
22
  kind?: "multiplayer" | "vscode" | "share";
22
23
  setAnonymousSharePreference?: (anonymousByDefault: boolean) => void;
23
24
  simRecorder: SimRecorder;
24
- publishAsync: (name: string, screenshotUri?: string, forceAnonymous?: boolean) => Promise<ShareData>;
25
+ publishAsync: (name: string, description?: string, screenshotUri?: string, forceAnonymous?: boolean) => Promise<ShareData>;
25
26
  onClose: () => void;
26
27
  }
27
28
  export declare const Share: (props: ShareProps) => JSX.Element;
@@ -2,12 +2,12 @@ import { ShareData } from "./Share";
2
2
  import { SimRecorder } from "./ThumbnailRecorder";
3
3
  export interface ShareInfoProps {
4
4
  projectName: string;
5
- description?: string;
5
+ projectDescription?: string;
6
6
  screenshotUri?: string;
7
7
  isLoggedIn?: boolean;
8
8
  hasProjectBeenPersistentShared?: boolean;
9
9
  simRecorder: SimRecorder;
10
- publishAsync: (name: string, screenshotUri?: string, forceAnonymous?: boolean) => Promise<ShareData>;
10
+ publishAsync: (name: string, description?: string, screenshotUri?: string, forceAnonymous?: boolean) => Promise<ShareData>;
11
11
  isMultiplayerGame?: boolean;
12
12
  kind?: "multiplayer" | "vscode" | "share";
13
13
  anonymousShareByDefault?: boolean;
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ export interface ShareLinkDialogProps {
3
+ visible: boolean;
4
+ shareUrl?: string;
5
+ title?: string;
6
+ ariaLabel?: string;
7
+ linkAriaLabel?: string;
8
+ className?: string;
9
+ children?: React.ReactNode;
10
+ onClose: () => void;
11
+ }
12
+ export declare const ShareLinkDialog: React.FC<ShareLinkDialogProps>;