pxt-core 13.2.0 → 13.2.1
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/built/cli.js +20 -10
- package/built/pxt.js +74 -11
- package/built/pxtlib.d.ts +19 -0
- package/built/pxtlib.js +54 -1
- package/built/pxtsim.d.ts +5 -1
- package/built/react-common/components/controls/Card.d.ts +1 -0
- package/built/react-common/components/controls/Modal.d.ts +1 -0
- package/built/react-common/components/share/Share.d.ts +2 -1
- package/built/react-common/components/share/ShareInfo.d.ts +2 -1
- package/built/react-common/components/theming/SimulatorThemePickerModal.d.ts +15 -0
- package/built/react-common/components/theming/ThemeCard.d.ts +2 -1
- package/built/react-common/components/theming/ThemePickerModal.d.ts +10 -1
- package/built/react-common/components/theming/simulatorThemeDefaults.d.ts +5 -0
- package/built/target.js +1 -1
- package/built/targetlight.js +1 -1
- package/built/web/main.js +30 -30
- package/built/web/multiplayer/js/{main.db72096c.js → main.d98f7e21.js} +2 -2
- package/built/web/pxtapp.js +1 -1
- package/built/web/pxtasseteditor.js +1 -1
- package/built/web/pxtembed.js +2 -2
- package/built/web/pxtlib.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/built/web/react-common-authcode.css +1 -1
- package/built/web/react-common-multiplayer.css +1 -1
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlreact-common-authcode.css +1 -1
- package/built/web/rtlreact-common-multiplayer.css +1 -1
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/runnerembed.js +1 -1
- package/built/web/semantic.css +1 -1
- package/built/web/skillmap/js/main.6352b119.js +2 -0
- package/built/web/teachertool/js/{main.168add6b.js → main.138b6a8e.js} +2 -2
- package/built/web/tutorialtool/js/{main.16de6eb5.js → main.9b70fa5a.js} +2 -2
- package/localtypings/pxtarget.d.ts +25 -0
- package/localtypings/pxteditor.d.ts +11 -2
- package/package.json +1 -1
- package/react-common/components/controls/Card.tsx +3 -0
- package/react-common/components/controls/Modal.tsx +4 -2
- package/react-common/components/share/Share.tsx +4 -1
- package/react-common/components/share/ShareInfo.tsx +21 -4
- package/react-common/components/theming/SimulatorThemePickerModal.tsx +207 -0
- package/react-common/components/theming/ThemeCard.tsx +6 -4
- package/react-common/components/theming/ThemePickerModal.tsx +65 -4
- package/react-common/components/theming/simulatorThemeDefaults.ts +77 -0
- package/react-common/styles/controls/Modal.less +6 -6
- package/react-common/styles/theming/ThemePickerModal.less +193 -4
- package/theme/pxtjson.less +12 -0
- package/webapp/public/multiplayer.html +1 -1
- package/webapp/public/skillmap.html +1 -1
- package/webapp/public/teachertool.html +1 -1
- package/webapp/public/tutorialtool.html +1 -1
- package/built/web/skillmap/js/main.fb626575.js +0 -2
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export function getSimulatorThemePreferenceForColorThemeChange(
|
|
2
|
+
preference: pxt.auth.SimulatorThemePreference | undefined,
|
|
3
|
+
previousColorTheme: pxt.ColorThemeInfo | undefined,
|
|
4
|
+
nextColorTheme: pxt.ColorThemeInfo | undefined,
|
|
5
|
+
presets: pxt.SimulatorThemePreset[] | undefined
|
|
6
|
+
): pxt.auth.SimulatorThemePreference | undefined {
|
|
7
|
+
if (!presets?.length || previousColorTheme?.id === nextColorTheme?.id) return preference;
|
|
8
|
+
|
|
9
|
+
const nextDefault = getDefaultSimulatorThemePreference(nextColorTheme, presets);
|
|
10
|
+
if (!nextDefault) return preference;
|
|
11
|
+
|
|
12
|
+
if (preference) {
|
|
13
|
+
if (preference.presetId !== nextDefault.presetId) return preference;
|
|
14
|
+
if (pxt.auth.simulatorThemeColorsEqual(preference.theme, nextDefault.theme)
|
|
15
|
+
&& preference.theme.layout === nextDefault.theme.layout) return preference;
|
|
16
|
+
}
|
|
17
|
+
else if (!nextColorTheme?.defaultSimulatorTheme) {
|
|
18
|
+
return preference;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return nextDefault;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function getDefaultSimulatorThemePreference(
|
|
25
|
+
colorTheme: pxt.ColorThemeInfo | undefined,
|
|
26
|
+
presets: pxt.SimulatorThemePreset[] | undefined
|
|
27
|
+
): pxt.auth.SimulatorThemePreference | undefined {
|
|
28
|
+
const defaultPreset = presets?.find(candidate => candidate.id === "default") || presets?.[0];
|
|
29
|
+
if (!defaultPreset) return undefined;
|
|
30
|
+
|
|
31
|
+
const configuredDefault = colorTheme?.defaultSimulatorTheme;
|
|
32
|
+
const configuredPreset = typeof configuredDefault === "string"
|
|
33
|
+
? presets?.find(candidate => candidate.id === configuredDefault)
|
|
34
|
+
: undefined;
|
|
35
|
+
const theme = typeof configuredDefault === "object"
|
|
36
|
+
? { ...defaultPreset.theme, ...configuredDefault }
|
|
37
|
+
: configuredPreset?.theme || defaultPreset.theme;
|
|
38
|
+
return {
|
|
39
|
+
presetId: defaultPreset.id,
|
|
40
|
+
theme: copySimulatorTheme(theme as pxt.SimulatorTheme),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function isImplicitSimulatorThemePreference(
|
|
45
|
+
preference: pxt.auth.SimulatorThemePreference,
|
|
46
|
+
presets: pxt.SimulatorThemePreset[] | undefined
|
|
47
|
+
): boolean {
|
|
48
|
+
const defaultPreset = presets?.find(candidate => candidate.id === "default") || presets?.[0];
|
|
49
|
+
return preference.presetId === defaultPreset?.id
|
|
50
|
+
&& preference.theme.layout === pxt.auth.DEFAULT_SIMULATOR_LAYOUT;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function copySimulatorTheme(theme: pxt.SimulatorTheme): pxt.SimulatorTheme {
|
|
54
|
+
const result = { layout: theme.layout || pxt.auth.DEFAULT_SIMULATOR_LAYOUT } as pxt.SimulatorTheme;
|
|
55
|
+
for (const property of Object.keys(theme)) {
|
|
56
|
+
if (pxt.auth.isSimulatorThemeColorProperty(property)
|
|
57
|
+
&& pxt.auth.isSimulatorThemeColor(theme[property])) {
|
|
58
|
+
result[property] = theme[property];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function getSimulatorThemeForLayout(
|
|
65
|
+
theme: pxt.SimulatorTheme,
|
|
66
|
+
layoutId: string,
|
|
67
|
+
colorFields: pxt.SimulatorThemeColorField[] = []
|
|
68
|
+
): pxt.SimulatorTheme {
|
|
69
|
+
const nextTheme = copySimulatorTheme(theme);
|
|
70
|
+
nextTheme.layout = layoutId;
|
|
71
|
+
for (const field of colorFields) {
|
|
72
|
+
if (!pxt.auth.isSimulatorThemeColor(nextTheme[field.property])) {
|
|
73
|
+
nextTheme[field.property] = field.defaultValue;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return nextTheme;
|
|
77
|
+
}
|
|
@@ -54,6 +54,12 @@
|
|
|
54
54
|
padding-bottom: 1.25rem;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
.common-modal-right-menu {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: row;
|
|
60
|
+
align-items: center;
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
.common-modal-close {
|
|
58
64
|
border: 1px solid transparent;
|
|
59
65
|
}
|
|
@@ -118,12 +124,6 @@
|
|
|
118
124
|
border: 1px, solid var(--pxt-focus-border);
|
|
119
125
|
}
|
|
120
126
|
|
|
121
|
-
.common-modal-right-menu {
|
|
122
|
-
display: flex;
|
|
123
|
-
flex-direction: row;
|
|
124
|
-
align-items: center;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
127
|
.common-modal-help {
|
|
128
128
|
display: flex;
|
|
129
129
|
align-items: center;
|
|
@@ -1,6 +1,190 @@
|
|
|
1
|
-
.theme-picker-modal
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
.theme-picker-modal,
|
|
2
|
+
.simulator-theme-picker-modal {
|
|
3
|
+
>.common-modal {
|
|
4
|
+
width: 90%;
|
|
5
|
+
max-width: 64rem;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.common-modal-header {
|
|
9
|
+
padding-left: 0;
|
|
10
|
+
|
|
11
|
+
.common-modal-right-menu {
|
|
12
|
+
flex: 1;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
min-width: 0;
|
|
15
|
+
margin-left: 4rem;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.common-modal-footer {
|
|
20
|
+
grid-template-columns: 1fr auto;
|
|
21
|
+
|
|
22
|
+
button:only-child {
|
|
23
|
+
justify-self: end;
|
|
24
|
+
min-width: 8rem;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.theme-picker-modal>.common-modal,
|
|
30
|
+
.simulator-theme-picker-modal:not(.standalone)>.common-modal {
|
|
31
|
+
height: 90%;
|
|
32
|
+
max-height: 48rem;
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
|
|
36
|
+
.common-modal-body {
|
|
37
|
+
flex: 1;
|
|
38
|
+
min-height: 0;
|
|
39
|
+
overflow-y: auto;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.theme-picker-toggle {
|
|
44
|
+
width: 20rem;
|
|
45
|
+
max-width: 40vw;
|
|
46
|
+
padding: 0.5rem 0;
|
|
47
|
+
|
|
48
|
+
.common-editor-toggle-outer {
|
|
49
|
+
width: 100%;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.common-editor-toggle {
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.common-editor-toggle .common-editor-toggle-item > .common-button {
|
|
57
|
+
padding-left: 0.75rem;
|
|
58
|
+
padding-right: 0.75rem;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.common-button-flex,
|
|
62
|
+
.common-button-label {
|
|
63
|
+
min-width: 0;
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
text-overflow: ellipsis;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.simulator-theme-picker-modal.standalone .common-modal-header {
|
|
70
|
+
padding-left: 1.5rem;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.simulator-theme-picker {
|
|
74
|
+
display: grid;
|
|
75
|
+
grid-template-columns: minmax(18rem, 1fr) minmax(18rem, 1fr);
|
|
76
|
+
gap: 2rem;
|
|
77
|
+
align-items: center;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.simulator-theme-preview {
|
|
81
|
+
min-width: 0;
|
|
82
|
+
|
|
83
|
+
.simframe {
|
|
84
|
+
margin: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.simframe > .ui.loader {
|
|
88
|
+
display: none;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.simulator-theme-controls {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
gap: 0.75rem;
|
|
96
|
+
min-width: 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.simulator-theme-select-field {
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
gap: 0.5rem;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.simulator-theme-select {
|
|
106
|
+
box-sizing: border-box;
|
|
107
|
+
width: 100%;
|
|
108
|
+
height: 2.5rem;
|
|
109
|
+
padding: 0 0.75rem;
|
|
110
|
+
border: 1px solid var(--pxt-neutral-stencil1);
|
|
111
|
+
border-radius: 2px;
|
|
112
|
+
background: var(--pxt-neutral-background1);
|
|
113
|
+
color: var(--pxt-neutral-foreground1);
|
|
114
|
+
font: inherit;
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
|
|
117
|
+
&:focus-visible {
|
|
118
|
+
outline: 3px solid var(--pxt-focus-border);
|
|
119
|
+
outline-offset: 2px;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.simulator-theme-color-list {
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
gap: 0.5rem;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.simulator-theme-color {
|
|
130
|
+
display: grid;
|
|
131
|
+
grid-template-columns: minmax(7rem, 1fr) 3rem minmax(8rem, 1fr);
|
|
132
|
+
gap: 0.5rem;
|
|
133
|
+
align-items: center;
|
|
134
|
+
|
|
135
|
+
.common-input-wrapper {
|
|
136
|
+
min-width: 0;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
input[type="color"] {
|
|
140
|
+
width: 3rem;
|
|
141
|
+
height: 2.25rem;
|
|
142
|
+
padding: 0.125rem;
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
border: 1px solid var(--pxt-neutral-stencil1);
|
|
145
|
+
background: var(--pxt-neutral-background1);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@media only screen and (max-width: 50rem) {
|
|
150
|
+
.theme-picker-modal>.common-modal {
|
|
151
|
+
width: 90%;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.theme-picker-modal,
|
|
155
|
+
.simulator-theme-picker-modal {
|
|
156
|
+
.common-modal-header .common-modal-right-menu {
|
|
157
|
+
margin-left: clamp(0rem, calc(90vw - 16rem), 4rem);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.theme-picker-toggle {
|
|
162
|
+
width: 10rem;
|
|
163
|
+
max-width: 100%;
|
|
164
|
+
|
|
165
|
+
.common-editor-toggle .common-editor-toggle-item > .common-button {
|
|
166
|
+
padding-left: 0.2rem;
|
|
167
|
+
padding-right: 0.2rem;
|
|
168
|
+
|
|
169
|
+
i {
|
|
170
|
+
display: none;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.simulator-theme-picker {
|
|
176
|
+
grid-template-columns: 1fr;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.simulator-theme-preview {
|
|
180
|
+
max-width: 28rem;
|
|
181
|
+
width: 100%;
|
|
182
|
+
justify-self: center;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.simulator-theme-color {
|
|
186
|
+
grid-template-columns: minmax(5.5rem, 1fr) 3rem minmax(6.5rem, 1fr);
|
|
187
|
+
}
|
|
4
188
|
}
|
|
5
189
|
|
|
6
190
|
.theme-picker {
|
|
@@ -18,11 +202,16 @@
|
|
|
18
202
|
|
|
19
203
|
.theme-card {
|
|
20
204
|
width: 18rem;
|
|
21
|
-
height:
|
|
205
|
+
height: auto;
|
|
22
206
|
background-color: var(--pxt-neutral-background1);
|
|
23
207
|
color: var(--pxt-neutral-foreground1);
|
|
24
208
|
border: 1px solid var(--pxt-neutral-stencil1);
|
|
25
209
|
|
|
210
|
+
&.selected {
|
|
211
|
+
border-color: var(--pxt-primary-background);
|
|
212
|
+
box-shadow: inset 0 0 0 2px var(--pxt-primary-background);
|
|
213
|
+
}
|
|
214
|
+
|
|
26
215
|
&:hover {
|
|
27
216
|
border: 1px solid var(--pxt-focus-border);
|
|
28
217
|
cursor: pointer;
|
package/theme/pxtjson.less
CHANGED
|
@@ -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.
|
|
12
|
+
<script defer="defer" src="/blb/multiplayer/js/main.d98f7e21.js"></script><link href="/blb/multiplayer/css/main.40f89d37.css" rel="stylesheet"></head>
|
|
13
13
|
<body class="pxt-theme-root">
|
|
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.
|
|
10
|
+
<script defer="defer" src="/blb/skillmap/js/main.6352b119.js"></script><link href="/blb/skillmap/css/main.450cb46e.css" rel="stylesheet"></head>
|
|
11
11
|
<body class="pxt-theme-root">
|
|
12
12
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
13
13
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<!-- <link rel="manifest" href="/teachertool-data/manifest.json" /> -->
|
|
19
19
|
<title>MakeCode Code Evaluation</title>
|
|
20
20
|
<script>var pxtConfig=null</script>
|
|
21
|
-
<script defer="defer" src="/blb/teachertool/js/main.
|
|
21
|
+
<script defer="defer" src="/blb/teachertool/js/main.138b6a8e.js"></script><link href="/blb/teachertool/css/main.8ef9c91e.css" rel="stylesheet"></head>
|
|
22
22
|
<body class="pxt-theme-root">
|
|
23
23
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
24
24
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<!-- <link rel="manifest" href="/tutorialtool-data/manifest.json" /> -->
|
|
18
18
|
<title>MakeCode Tutorial Tool</title>
|
|
19
19
|
<script>var pxtConfig=null</script>
|
|
20
|
-
<script defer="defer" src="/blb/tutorialtool/js/main.
|
|
20
|
+
<script defer="defer" src="/blb/tutorialtool/js/main.9b70fa5a.js"></script><link href="/blb/tutorialtool/css/main.02bb1797.css" rel="stylesheet"></head>
|
|
21
21
|
|
|
22
22
|
<body>
|
|
23
23
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|