pxt-core 7.5.5 → 7.5.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.
@@ -20,6 +20,7 @@ declare namespace pxt.workspace {
20
20
  pubId: string; // for published scripts
21
21
  pubCurrent: boolean; // is this exactly pubId, or just based on it
22
22
  pubVersions?: PublishVersion[];
23
+ pubPermalink?: string; // permanent (persistent) share ID
23
24
  githubId?: string;
24
25
  githubTag?: string; // the release tag if any (commit.tag)
25
26
  githubCurrent?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pxt-core",
3
- "version": "7.5.5",
3
+ "version": "7.5.6",
4
4
  "description": "Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors",
5
5
  "keywords": [
6
6
  "TypeScript",
@@ -18,25 +18,27 @@ export interface ShareData {
18
18
  export interface ShareProps {
19
19
  projectName: string;
20
20
  screenshotUri?: string;
21
+ showShareDropdown?: boolean;
21
22
 
22
23
  screenshotAsync: () => Promise<string>;
23
24
  gifRecordAsync: () => Promise<void>;
24
25
  gifRenderAsync: () => Promise<string | void>;
25
26
  gifAddFrame: (dataUri: ImageData, delay?: number) => boolean;
26
- publishAsync: (name: string, screenshotUri?: string) => Promise<ShareData>;
27
+ publishAsync: (name: string, screenshotUri?: string, forceAnonymous?: boolean) => Promise<ShareData>;
27
28
  registerSimulatorMsgHandler?: (handler: (msg: any) => void) => void;
28
29
  unregisterSimulatorMsgHandler?: () => void;
29
30
  }
30
31
 
31
32
  export const Share = (props: ShareProps) => {
32
- const { projectName, screenshotUri, screenshotAsync, gifRecordAsync, gifRenderAsync, gifAddFrame,
33
- publishAsync, registerSimulatorMsgHandler, unregisterSimulatorMsgHandler } = props;
33
+ const { projectName, screenshotUri, showShareDropdown, screenshotAsync, gifRecordAsync, gifRenderAsync,
34
+ gifAddFrame, publishAsync, registerSimulatorMsgHandler, unregisterSimulatorMsgHandler } = props;
34
35
 
35
36
  return <div className="project-share">
36
37
  {(!!screenshotAsync || !!gifRecordAsync) && <div className="project-share-simulator">
37
38
  <div id="shareLoanedSimulator" />
38
39
  </div>}
39
40
  <ShareInfo projectName={projectName}
41
+ showShareDropdown={showShareDropdown}
40
42
  screenshotUri={screenshotUri}
41
43
  screenshotAsync={screenshotAsync}
42
44
  gifRecordAsync={gifRecordAsync}
@@ -2,6 +2,7 @@ import * as React from "react";
2
2
  import { Button } from "../controls/Button";
3
3
  import { EditorToggle } from "../controls/EditorToggle";
4
4
  import { Input } from "../controls/Input";
5
+ import { MenuDropdown } from "../controls/MenuDropdown";
5
6
  import { Textarea } from "../controls/Textarea";
6
7
 
7
8
  import { ShareData } from "./Share";
@@ -12,19 +13,20 @@ export interface ShareInfoProps {
12
13
  projectName: string;
13
14
  description?: string;
14
15
  screenshotUri?: string;
16
+ showShareDropdown?: boolean;
15
17
 
16
18
  screenshotAsync?: () => Promise<string>;
17
19
  gifRecordAsync?: () => Promise<void>;
18
20
  gifRenderAsync?: () => Promise<string | void>;
19
21
  gifAddFrame?: (dataUri: ImageData, delay?: number) => boolean;
20
- publishAsync: (name: string, screenshotUri?: string) => Promise<ShareData>;
22
+ publishAsync: (name: string, screenshotUri?: string, forceAnonymous?: boolean) => Promise<ShareData>;
21
23
  registerSimulatorMsgHandler?: (handler: (msg: any) => void) => void;
22
24
  unregisterSimulatorMsgHandler?: () => void;
23
25
  }
24
26
 
25
27
  export const ShareInfo = (props: ShareInfoProps) => {
26
- const { projectName, description, screenshotUri, screenshotAsync, gifRecordAsync, gifRenderAsync, gifAddFrame,
27
- publishAsync, registerSimulatorMsgHandler, unregisterSimulatorMsgHandler } = props;
28
+ const { projectName, description, screenshotUri, showShareDropdown, screenshotAsync, gifRecordAsync,
29
+ gifRenderAsync, gifAddFrame, publishAsync, registerSimulatorMsgHandler, unregisterSimulatorMsgHandler } = props;
28
30
  const [ name, setName ] = React.useState(projectName);
29
31
  const [ thumbnailUri, setThumbnailUri ] = React.useState(screenshotUri);
30
32
  const [ shareState, setShareState ] = React.useState<"share" | "gifrecord" | "publish">("share");
@@ -47,8 +49,8 @@ export const ShareInfo = (props: ShareInfoProps) => {
47
49
  exitGifRecord();
48
50
  }
49
51
 
50
- const handlePublishClick = async () => {
51
- let publishedShareData = await publishAsync(name, thumbnailUri);
52
+ const handlePublishClick = async (forceAnonymous?: boolean) => {
53
+ let publishedShareData = await publishAsync(name, thumbnailUri, forceAnonymous);
52
54
  setShareData(publishedShareData);
53
55
  if (!publishedShareData?.error) setShareState("publish");
54
56
  }
@@ -76,7 +78,6 @@ export const ShareInfo = (props: ShareInfoProps) => {
76
78
  }
77
79
  }
78
80
 
79
-
80
81
  const embedOptions = [{
81
82
  name: "code",
82
83
  label: lf("Code"),
@@ -99,10 +100,23 @@ export const ShareInfo = (props: ShareInfoProps) => {
99
100
  onClick: () => setEmbedState("simulator")
100
101
  }];
101
102
 
103
+ const dropdownOptions = [{
104
+ title: lf("Create snapshot"),
105
+ label: lf("Create snapshot"),
106
+ onClick: () => handlePublishClick(true)
107
+ }]
108
+
102
109
  return <>
103
110
  <div className="project-share-info">
104
111
  {(shareState === "share" || shareState === "publish") && <>
105
- {showSimulator && <h2>{lf("About your project")}</h2>}
112
+ {showSimulator && <div className="project-share-title">
113
+ <h2>{lf("About your project")}</h2>
114
+ {showShareDropdown && <MenuDropdown id="project-share-dropdown"
115
+ icon="fas fa-ellipsis-h"
116
+ title={lf("More share options")}
117
+ items={dropdownOptions}
118
+ />}
119
+ </div>}
106
120
  <Input label={lf("Project Name")}
107
121
  initialValue={name}
108
122
  placeholder={lf("Name your project")}
@@ -35,6 +35,19 @@
35
35
  }
36
36
  }
37
37
 
38
+ .project-share-title {
39
+ display: flex;
40
+
41
+ h2 {
42
+ flex: 1;
43
+ margin: 0;
44
+ }
45
+ }
46
+
47
+ #project-share-dropdown {
48
+ color: @primaryColor;
49
+ }
50
+
38
51
  .project-share-thumbnail {
39
52
  display: flex;
40
53
  flex-direction: column;