pxt-core 8.4.1 → 8.4.3
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/backendutils.js +1 -0
- package/built/cli.js +83 -75
- package/built/pxt.js +1274 -179
- package/built/pxtblockly.js +323 -40
- package/built/pxtblocks.d.ts +30 -7
- package/built/pxtblocks.js +324 -41
- package/built/pxteditor.d.ts +2 -0
- package/built/pxtlib.d.ts +91 -5
- package/built/pxtlib.js +1183 -101
- package/built/pxtsim.js +8 -3
- package/built/server.js +4 -0
- package/built/target.js +1 -1
- package/built/web/main.js +1 -1
- package/built/web/multiplayer/css/main.2dd69ed8.css +4 -0
- package/built/web/multiplayer/js/main.f3b8f930.js +2 -0
- package/built/web/pxtapp.js +1 -1
- package/built/web/pxtasseteditor.js +1 -1
- package/built/web/pxtblockly.js +1 -1
- package/built/web/pxtblocks.js +1 -1
- package/built/web/pxtembed.js +2 -2
- package/built/web/pxtlib.js +1 -1
- package/built/web/pxtsim.js +1 -1
- package/built/web/pxtworker.js +2 -2
- package/built/web/react-common-authcode.css +4 -6993
- package/built/web/react-common-multiplayer.css +13 -0
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlreact-common-authcode.css +13 -0
- package/built/web/rtlreact-common-multiplayer.css +13 -0
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/semantic.css +1 -1
- package/built/web/skillmap/js/main.a6cf40e1.chunk.js +1 -0
- package/common-docs/identity/sign-in.md +17 -3
- package/common-docs/static/music-editor/apple.png +0 -0
- package/common-docs/static/music-editor/burger.png +0 -0
- package/common-docs/static/music-editor/cake.png +0 -0
- package/common-docs/static/music-editor/car.png +0 -0
- package/common-docs/static/music-editor/cat.png +0 -0
- package/common-docs/static/music-editor/cherry.png +0 -0
- package/common-docs/static/music-editor/clam.png +0 -0
- package/common-docs/static/music-editor/computer.png +0 -0
- package/common-docs/static/music-editor/crab.png +0 -0
- package/common-docs/static/music-editor/dog.png +0 -0
- package/common-docs/static/music-editor/duck.png +0 -0
- package/common-docs/static/music-editor/egg.png +0 -0
- package/common-docs/static/music-editor/explosion.png +0 -0
- package/common-docs/static/music-editor/fish.png +0 -0
- package/common-docs/static/music-editor/ice-cream.png +0 -0
- package/common-docs/static/music-editor/lemon.png +0 -0
- package/common-docs/static/music-editor/metronomeWorker.js +35 -0
- package/common-docs/static/music-editor/snake.png +0 -0
- package/common-docs/static/music-editor/star.png +0 -0
- package/common-docs/static/music-editor/strawberry.png +0 -0
- package/common-docs/static/music-editor/taco.png +0 -0
- package/common-docs/static/music-editor/treble-clef.svg +1 -0
- package/localtypings/projectheader.d.ts +1 -0
- package/package.json +4 -2
- package/react-common/components/controls/Input.tsx +7 -3
- package/react-common/components/share/Share.tsx +6 -2
- package/react-common/components/share/ShareInfo.tsx +12 -3
- package/react-common/styles/controls/Button.less +9 -0
- package/react-common/styles/react-common-authcode-core.less +1 -1
- package/react-common/styles/react-common-authcode.less +1 -1
- package/react-common/styles/react-common-multiplayer-core.less +10 -0
- package/react-common/styles/react-common-multiplayer.less +12 -0
- package/theme/highcontrast.less +14 -0
- package/theme/music-editor/EditControls.less +22 -0
- package/theme/music-editor/MusicEditor.less +25 -0
- package/theme/music-editor/Note.less +16 -0
- package/theme/music-editor/NoteGroup.less +7 -0
- package/theme/music-editor/PlaybackControls.less +55 -0
- package/theme/music-editor/ScrollableWorkspace.less +3 -0
- package/theme/music-editor/Staff.less +31 -0
- package/theme/music-editor/Track.less +0 -0
- package/theme/music-editor/TrackSelector.less +48 -0
- package/theme/music-editor/Workspace.less +3 -0
- package/theme/pxt.less +1 -0
- package/theme/tutorial-sidebar.less +19 -3
- package/theme/tutorial.less +2 -2
- package/webapp/public/multiplayer.html +1 -1
- package/webapp/public/skillmap.html +1 -1
- package/built/web/skillmap/js/main.6fa0eaff.chunk.js +0 -1
package/built/pxtlib.d.ts
CHANGED
|
@@ -99,6 +99,7 @@ declare namespace pxt.auth {
|
|
|
99
99
|
protected abstract onProfileDeleted(userId: string): Promise<void>;
|
|
100
100
|
protected abstract onApiError(err: any): Promise<void>;
|
|
101
101
|
protected abstract onStateCleared(): Promise<void>;
|
|
102
|
+
authTokenAsync(): Promise<string>;
|
|
102
103
|
/**
|
|
103
104
|
* Starts the process of authenticating the user against the given identity
|
|
104
105
|
* provider. Upon success the backend will write an http-only session cookie
|
|
@@ -177,6 +178,7 @@ declare namespace pxt.auth {
|
|
|
177
178
|
function hasIdentity(): boolean;
|
|
178
179
|
function enableAuth(enabled?: boolean): void;
|
|
179
180
|
function userName(user: pxt.auth.UserProfile): string;
|
|
181
|
+
function firstName(user: pxt.auth.UserProfile): string;
|
|
180
182
|
function userInitials(user: pxt.auth.UserProfile): string;
|
|
181
183
|
function generateUserProfilePicDataUrl(profile: pxt.auth.UserProfile): void;
|
|
182
184
|
/**
|
|
@@ -554,6 +556,7 @@ declare namespace pxt {
|
|
|
554
556
|
asseteditorUrl?: string;
|
|
555
557
|
skillmapUrl?: string;
|
|
556
558
|
authcodeUrl?: string;
|
|
559
|
+
multiplayerUrl?: string;
|
|
557
560
|
isStatic?: boolean;
|
|
558
561
|
verprefix?: string;
|
|
559
562
|
}
|
|
@@ -1613,6 +1616,8 @@ declare namespace pxt.sprite {
|
|
|
1613
1616
|
const IMAGE_PREFIX = "image";
|
|
1614
1617
|
const ANIMATION_NAMESPACE = "myAnimations";
|
|
1615
1618
|
const ANIMATION_PREFIX = "anim";
|
|
1619
|
+
const SONG_NAMESPACE = "mySongs";
|
|
1620
|
+
const SONG_PREFIX = "song";
|
|
1616
1621
|
interface Coord {
|
|
1617
1622
|
x: number;
|
|
1618
1623
|
y: number;
|
|
@@ -1764,6 +1769,66 @@ declare namespace pxt.storage.shared {
|
|
|
1764
1769
|
function setAsync(container: string, key: string, val: any): Promise<void>;
|
|
1765
1770
|
function delAsync(container: string, key: string): Promise<void>;
|
|
1766
1771
|
}
|
|
1772
|
+
declare namespace pxt.assets.music {
|
|
1773
|
+
interface Instrument {
|
|
1774
|
+
waveform: number;
|
|
1775
|
+
ampEnvelope: Envelope;
|
|
1776
|
+
pitchEnvelope?: Envelope;
|
|
1777
|
+
ampLFO?: LFO;
|
|
1778
|
+
pitchLFO?: LFO;
|
|
1779
|
+
octave?: number;
|
|
1780
|
+
}
|
|
1781
|
+
interface Envelope {
|
|
1782
|
+
attack: number;
|
|
1783
|
+
decay: number;
|
|
1784
|
+
sustain: number;
|
|
1785
|
+
release: number;
|
|
1786
|
+
amplitude: number;
|
|
1787
|
+
}
|
|
1788
|
+
interface LFO {
|
|
1789
|
+
frequency: number;
|
|
1790
|
+
amplitude: number;
|
|
1791
|
+
}
|
|
1792
|
+
interface Song {
|
|
1793
|
+
measures: number;
|
|
1794
|
+
beatsPerMeasure: number;
|
|
1795
|
+
beatsPerMinute: number;
|
|
1796
|
+
ticksPerBeat: number;
|
|
1797
|
+
tracks: Track[];
|
|
1798
|
+
}
|
|
1799
|
+
interface Track {
|
|
1800
|
+
instrument: Instrument;
|
|
1801
|
+
id: number;
|
|
1802
|
+
name?: string;
|
|
1803
|
+
iconURI?: string;
|
|
1804
|
+
drums?: DrumInstrument[];
|
|
1805
|
+
notes: NoteEvent[];
|
|
1806
|
+
}
|
|
1807
|
+
interface NoteEvent {
|
|
1808
|
+
notes: number[];
|
|
1809
|
+
startTick: number;
|
|
1810
|
+
endTick: number;
|
|
1811
|
+
}
|
|
1812
|
+
interface DrumSoundStep {
|
|
1813
|
+
waveform: number;
|
|
1814
|
+
frequency: number;
|
|
1815
|
+
volume: number;
|
|
1816
|
+
duration: number;
|
|
1817
|
+
}
|
|
1818
|
+
interface DrumInstrument {
|
|
1819
|
+
startFrequency: number;
|
|
1820
|
+
startVolume: number;
|
|
1821
|
+
steps: DrumSoundStep[];
|
|
1822
|
+
}
|
|
1823
|
+
function renderInstrument(instrument: Instrument, noteFrequency: number, gateLength: number, volume: number): Uint8Array;
|
|
1824
|
+
function renderDrumInstrument(sound: DrumInstrument, volume: number): Uint8Array;
|
|
1825
|
+
function encodeSongToHex(song: Song): string;
|
|
1826
|
+
function decodeSongFromHex(hex: string): Song;
|
|
1827
|
+
function cloneSong(song: Song): Song;
|
|
1828
|
+
function songEquals(a: Song, b: Song): boolean;
|
|
1829
|
+
function inflateSong(song: pxt.assets.music.Song): void;
|
|
1830
|
+
function getEmptySong(measures: number): pxt.assets.music.Song;
|
|
1831
|
+
}
|
|
1767
1832
|
declare namespace pxt {
|
|
1768
1833
|
class Package {
|
|
1769
1834
|
id: string;
|
|
@@ -2607,11 +2672,13 @@ declare namespace pxt {
|
|
|
2607
2672
|
export const IMAGE_MIME_TYPE = "image/x-mkcd-f4";
|
|
2608
2673
|
export const TILEMAP_MIME_TYPE = "application/mkcd-tilemap";
|
|
2609
2674
|
export const ANIMATION_MIME_TYPE = "application/mkcd-animation";
|
|
2675
|
+
export const SONG_MIME_TYPE = "application/mkcd-song";
|
|
2610
2676
|
export const enum AssetType {
|
|
2611
2677
|
Image = "image",
|
|
2612
2678
|
Tile = "tile",
|
|
2613
2679
|
Tilemap = "tilemap",
|
|
2614
|
-
Animation = "animation"
|
|
2680
|
+
Animation = "animation",
|
|
2681
|
+
Song = "song"
|
|
2615
2682
|
}
|
|
2616
2683
|
export interface AssetMetadata {
|
|
2617
2684
|
displayName?: string;
|
|
@@ -2623,7 +2690,7 @@ declare namespace pxt {
|
|
|
2623
2690
|
blockId: string;
|
|
2624
2691
|
fieldName: string;
|
|
2625
2692
|
}
|
|
2626
|
-
export type Asset = ProjectImage | Tile | Animation | ProjectTilemap;
|
|
2693
|
+
export type Asset = ProjectImage | Tile | Animation | ProjectTilemap | Song;
|
|
2627
2694
|
export interface BaseAsset {
|
|
2628
2695
|
internalID: number;
|
|
2629
2696
|
id: string;
|
|
@@ -2661,6 +2728,10 @@ declare namespace pxt {
|
|
|
2661
2728
|
type: AssetType.Tilemap;
|
|
2662
2729
|
data: pxt.sprite.TilemapData;
|
|
2663
2730
|
}
|
|
2731
|
+
export interface Song extends BaseAsset {
|
|
2732
|
+
type: AssetType.Song;
|
|
2733
|
+
song: assets.music.Song;
|
|
2734
|
+
}
|
|
2664
2735
|
export interface TilemapSnapshot {
|
|
2665
2736
|
revision: number;
|
|
2666
2737
|
projectTilemaps?: ProjectTilemap[];
|
|
@@ -2674,6 +2745,7 @@ declare namespace pxt {
|
|
|
2674
2745
|
tilemaps: AssetCollection<ProjectTilemap>;
|
|
2675
2746
|
images: AssetCollection<ProjectImage>;
|
|
2676
2747
|
animations: AssetCollection<Animation>;
|
|
2748
|
+
songs: AssetCollection<Song>;
|
|
2677
2749
|
}
|
|
2678
2750
|
interface AssetSnapshotDiff {
|
|
2679
2751
|
beforeRevision: number;
|
|
@@ -2682,6 +2754,7 @@ declare namespace pxt {
|
|
|
2682
2754
|
tilemaps: AssetCollectionDiff<ProjectTilemap>;
|
|
2683
2755
|
images: AssetCollectionDiff<ProjectImage>;
|
|
2684
2756
|
animations: AssetCollectionDiff<Animation>;
|
|
2757
|
+
songs: AssetCollectionDiff<Song>;
|
|
2685
2758
|
}
|
|
2686
2759
|
interface AssetUpdateListener {
|
|
2687
2760
|
internalID: number;
|
|
@@ -2734,6 +2807,7 @@ declare namespace pxt {
|
|
|
2734
2807
|
getProjectTiles(tileWidth: number, createIfMissing: boolean): TileSet | null;
|
|
2735
2808
|
createNewTile(data: pxt.sprite.BitmapData, id?: string, displayName?: string): Tile;
|
|
2736
2809
|
createNewProjectImage(data: pxt.sprite.BitmapData, displayName?: string): ProjectImage;
|
|
2810
|
+
createNewSong(data: pxt.assets.music.Song, displayName?: string): Song;
|
|
2737
2811
|
updateTile(tile: pxt.Tile): Tile;
|
|
2738
2812
|
deleteTile(id: string): void;
|
|
2739
2813
|
getProjectTilesetJRes(): Map<any>;
|
|
@@ -2775,6 +2849,10 @@ declare namespace pxt {
|
|
|
2775
2849
|
* assets.animation`shortId`
|
|
2776
2850
|
* assets.animation`displayName`
|
|
2777
2851
|
*
|
|
2852
|
+
* SONGS:
|
|
2853
|
+
* assets.song`shortId`
|
|
2854
|
+
* assets.song`displayName`
|
|
2855
|
+
*
|
|
2778
2856
|
* TILEMAPS:
|
|
2779
2857
|
* tilemap`shortId`
|
|
2780
2858
|
*
|
|
@@ -2787,36 +2865,43 @@ declare namespace pxt {
|
|
|
2787
2865
|
lookupAsset(assetType: AssetType.Tile, name: string): Tile;
|
|
2788
2866
|
lookupAsset(assetType: AssetType.Tilemap, name: string): ProjectTilemap;
|
|
2789
2867
|
lookupAsset(assetType: AssetType.Animation, name: string): Animation;
|
|
2868
|
+
lookupAsset(assetType: AssetType.Song, name: string): Song;
|
|
2790
2869
|
lookupAsset(assetType: AssetType, name: string): Asset;
|
|
2791
2870
|
lookupAssetByName(assetType: AssetType.Image, name: string): ProjectImage;
|
|
2792
2871
|
lookupAssetByName(assetType: AssetType.Tile, name: string): Tile;
|
|
2793
2872
|
lookupAssetByName(assetType: AssetType.Tilemap, name: string): ProjectTilemap;
|
|
2794
2873
|
lookupAssetByName(assetType: AssetType.Animation, name: string): Animation;
|
|
2874
|
+
lookupAssetByName(assetType: AssetType.Song, name: string): Song;
|
|
2795
2875
|
lookupAssetByName(assetType: AssetType, name: string): Asset;
|
|
2796
2876
|
getAssets(type: AssetType.Image): ProjectImage[];
|
|
2797
2877
|
getAssets(type: AssetType.Tile): Tile[];
|
|
2798
2878
|
getAssets(type: AssetType.Tilemap): ProjectTilemap[];
|
|
2799
2879
|
getAssets(type: AssetType.Animation): Animation[];
|
|
2880
|
+
getAssets(type: AssetType.Song): Song[];
|
|
2800
2881
|
getAssets(type: AssetType): Asset[];
|
|
2801
2882
|
getGalleryAssets(type: AssetType.Image): ProjectImage[];
|
|
2802
2883
|
getGalleryAssets(type: AssetType.Tile): Tile[];
|
|
2803
2884
|
getGalleryAssets(type: AssetType.Tilemap): ProjectTilemap[];
|
|
2804
2885
|
getGalleryAssets(type: AssetType.Animation): Animation[];
|
|
2886
|
+
getGalleryAssets(type: AssetType.Song): Song[];
|
|
2805
2887
|
getGalleryAssets(type: AssetType): Asset[];
|
|
2806
2888
|
lookupBlockAsset(assetType: AssetType.Image, blockID: string): ProjectImage;
|
|
2807
2889
|
lookupBlockAsset(assetType: AssetType.Tile, blockID: string): Tile;
|
|
2808
2890
|
lookupBlockAsset(assetType: AssetType.Tilemap, blockID: string): ProjectTilemap;
|
|
2809
2891
|
lookupBlockAsset(assetType: AssetType.Animation, blockID: string): Animation;
|
|
2892
|
+
lookupBlockAsset(assetType: AssetType.Song, blockID: string): Song;
|
|
2810
2893
|
lookupBlockAsset(assetType: AssetType, blockID: string): Asset;
|
|
2811
2894
|
updateAsset(asset: ProjectImage): ProjectImage;
|
|
2812
2895
|
updateAsset(asset: Tile): Tile;
|
|
2813
2896
|
updateAsset(asset: ProjectTilemap): ProjectTilemap;
|
|
2814
2897
|
updateAsset(asset: Animation): Animation;
|
|
2898
|
+
updateAsset(asset: Song): Song;
|
|
2815
2899
|
updateAsset(asset: Asset): Asset;
|
|
2816
2900
|
duplicateAsset(asset: ProjectImage, displayName?: string): ProjectImage;
|
|
2817
2901
|
duplicateAsset(asset: Tile, displayName?: string): Tile;
|
|
2818
2902
|
duplicateAsset(asset: ProjectTilemap, displayName?: string): ProjectTilemap;
|
|
2819
2903
|
duplicateAsset(asset: Animation, displayName?: string): Animation;
|
|
2904
|
+
duplicateAsset(asset: Song, displayName?: string): Song;
|
|
2820
2905
|
duplicateAsset(asset: Asset, displayName?: string): Asset;
|
|
2821
2906
|
removeAsset(asset: Asset): void;
|
|
2822
2907
|
addChangeListener(asset: Asset, listener: () => void): void;
|
|
@@ -2827,12 +2912,13 @@ declare namespace pxt {
|
|
|
2827
2912
|
removeInactiveBlockAssets(activeBlockIDs: string[]): void;
|
|
2828
2913
|
protected generateImage(entry: JRes, type: AssetType.Image): ProjectImage;
|
|
2829
2914
|
protected generateImage(entry: JRes, type: AssetType.Tile): Tile;
|
|
2915
|
+
protected generateSong(entry: JRes): Song;
|
|
2830
2916
|
protected generateAnimation(entry: JRes): [Animation, boolean];
|
|
2831
|
-
protected inflateAnimation(animation: Animation, assets: (Tile | ProjectImage | Animation)[]): Animation;
|
|
2917
|
+
protected inflateAnimation(animation: Animation, assets: (Tile | ProjectImage | Animation | Song)[]): Animation;
|
|
2832
2918
|
generateNewID(type: AssetType): string;
|
|
2833
2919
|
protected generateNewIDInternal(type: AssetType, varPrefix: string, namespaceString?: string): string;
|
|
2834
2920
|
protected onChange(): void;
|
|
2835
|
-
protected readImages(allJRes: Map<JRes>, isProjectFile?: boolean): (Tile | ProjectImage | Animation)[];
|
|
2921
|
+
protected readImages(allJRes: Map<JRes>, isProjectFile?: boolean): (Tile | ProjectImage | Animation | Song)[];
|
|
2836
2922
|
protected cleanupTemporaryAssets(): void;
|
|
2837
2923
|
}
|
|
2838
2924
|
export function emitTilemapsFromJRes(jres: pxt.Map<JRes>): string;
|
|
@@ -2845,7 +2931,7 @@ declare namespace pxt {
|
|
|
2845
2931
|
type: string;
|
|
2846
2932
|
name: string;
|
|
2847
2933
|
};
|
|
2848
|
-
export function lookupProjectAssetByTSReference(ts: string, project: TilemapProject): Tile | ProjectImage | Animation | ProjectTilemap;
|
|
2934
|
+
export function lookupProjectAssetByTSReference(ts: string, project: TilemapProject): Tile | ProjectImage | Animation | ProjectTilemap | Song;
|
|
2849
2935
|
export function getDefaultAssetDisplayName(type: pxt.AssetType): string;
|
|
2850
2936
|
export function getShortIDForAsset(asset: pxt.Asset): string;
|
|
2851
2937
|
export {};
|