pxt-core 7.4.9 → 7.4.13

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 (59) hide show
  1. package/built/cli.js +94 -83
  2. package/built/pxt.js +180 -135
  3. package/built/pxtblockly.js +1509 -1508
  4. package/built/pxtblocks.d.ts +11 -4
  5. package/built/pxtblocks.js +126 -138
  6. package/built/pxtlib.d.ts +6 -2
  7. package/built/pxtlib.js +86 -52
  8. package/built/target.js +1 -1
  9. package/built/web/blockly.css +1 -1
  10. package/built/web/main.js +1 -1
  11. package/built/web/pxtapp.js +1 -1
  12. package/built/web/pxtasseteditor.js +1 -1
  13. package/built/web/pxtblockly.js +53 -1
  14. package/built/web/pxtblocks.js +1 -1
  15. package/built/web/pxtembed.js +53 -1
  16. package/built/web/pxtlib.js +1 -1
  17. package/built/web/pxtworker.js +1 -1
  18. package/built/web/react-common-skillmap.css +1 -0
  19. package/built/web/rtlblockly.css +1 -1
  20. package/built/web/rtlreact-common-skillmap.css +1 -0
  21. package/built/web/rtlsemantic.css +1 -1
  22. package/built/web/semantic.css +1 -1
  23. package/built/web/skillmap/js/main.b96caef3.chunk.js +1 -0
  24. package/docfiles/tracking.html +1 -1
  25. package/localtypings/blockly.d.ts +12268 -7535
  26. package/localtypings/pxtarget.d.ts +1 -0
  27. package/localtypings/pxtblockly.d.ts +37 -0
  28. package/package.json +6 -3
  29. package/react-common/components/Checkbox.tsx +25 -0
  30. package/react-common/components/Notification.tsx +82 -0
  31. package/react-common/components/profile/Badge.tsx +33 -0
  32. package/react-common/components/profile/BadgeInfo.tsx +74 -0
  33. package/react-common/components/profile/BadgeList.tsx +67 -0
  34. package/react-common/components/profile/Profile.tsx +42 -0
  35. package/react-common/components/profile/UserNotification.tsx +32 -0
  36. package/react-common/components/profile/UserPane.tsx +64 -0
  37. package/react-common/components/types.d.ts +29 -0
  38. package/react-common/components/util.tsx +35 -0
  39. package/{built/web/react-common.css → react-common/styles/profile/profile.less} +1 -0
  40. package/react-common/styles/react-common-skillmap-core.less +10 -0
  41. package/react-common/styles/react-common-skillmap.less +12 -0
  42. package/react-common/styles/react-common.less +1 -0
  43. package/react-common/tsconfig.json +36 -0
  44. package/theme/blockly-core.less +38 -13
  45. package/theme/common-components.less +7 -0
  46. package/theme/common.less +1 -1
  47. package/theme/highcontrast.less +4 -0
  48. package/theme/melodyeditor.less +2 -2
  49. package/theme/print.less +1 -1
  50. package/theme/pxt.less +2 -0
  51. package/theme/toolbox.less +1 -0
  52. package/theme/tutorial-sidebar.less +64 -6
  53. package/webapp/public/blockly/blockly_compressed.js +1271 -1288
  54. package/webapp/public/blockly/blocks_compressed.js +47 -65
  55. package/webapp/public/blockly/msg/js/en.js +8 -17
  56. package/webapp/public/blockly/msg/json/en.json +6 -15
  57. package/webapp/public/blockly/plugins.js +57 -0
  58. package/webapp/public/skillmap.html +2 -2
  59. package/built/web/skillmap/js/main.ea4b3e23.chunk.js +0 -1
package/built/cli.js CHANGED
@@ -1728,94 +1728,105 @@ ${gcards.map(gcard => `[${gcard.name}](${gcard.url})`).join(',\n')}
1728
1728
  nodeutil.writeFileSync("built/target-strings.json", nodeutil.stringify(targetStringsSorted));
1729
1729
  pxt.log(`target-strings.json built`);
1730
1730
  }
1731
- function buildSemanticUIAsync(parsed) {
1732
- const forceRedbuild = parsed && parsed.flags["force"] || false;
1733
- if (!fs.existsSync(path.join("theme", "style.less")) ||
1734
- !fs.existsSync(path.join("theme", "theme.config")))
1735
- return Promise.resolve();
1736
- let dirty = !fs.existsSync("built/web/semantic.css");
1737
- if (!dirty) {
1738
- const csstime = fs.statSync("built/web/semantic.css").mtime;
1739
- dirty = nodeutil.allFiles("theme")
1740
- .map(f => fs.statSync(f))
1741
- .some(stat => stat.mtime > csstime);
1742
- }
1743
- if (!dirty && !forceRedbuild)
1744
- return Promise.resolve();
1745
- let pkg = readJson("package.json");
1731
+ async function buildSemanticUIAsync(parsed) {
1732
+ if (!fs.existsSync(path.join("theme", "style.less")) || !fs.existsSync(path.join("theme", "theme.config"))) {
1733
+ return;
1734
+ }
1735
+ const pkg = readJson("package.json");
1736
+ const isPxtCore = pkg["name"] === "pxt-core";
1746
1737
  nodeutil.mkdirP(path.join("built", "web"));
1747
1738
  const lessPath = require.resolve('less');
1748
1739
  const lessCPath = path.join(path.dirname(lessPath), '/bin/lessc');
1749
- return nodeutil.spawnAsync({
1740
+ const lessIncludePaths = [
1741
+ "node_modules/semantic-ui-less",
1742
+ "node_modules/pxt-core/theme",
1743
+ "theme/foo/bar",
1744
+ "theme",
1745
+ "node_modules/pxt-core/react-common/styles",
1746
+ "react-common/styles"
1747
+ ].join(":");
1748
+ // Build semantic css
1749
+ await nodeutil.spawnAsync({
1750
1750
  cmd: "node",
1751
- args: [lessCPath, "theme/style.less", "built/web/semantic.css", "--include-path=node_modules/semantic-ui-less:node_modules/pxt-core/theme:theme/foo/bar"]
1752
- }).then(() => {
1753
- function linkFont(font, semCss) {
1754
- const fontFile = fs.readFileSync("node_modules/semantic-ui-less/themes/default/assets/fonts/" + font + ".woff");
1755
- const url = "url(data:application/font-woff;charset=utf-8;base64,"
1756
- + fontFile.toString("base64") + ") format('woff')";
1757
- const r = new RegExp(`src:.*url\\("fonts\/${font}\\.woff.*`, "g");
1758
- semCss = semCss.replace('src: url("fonts/' + font + '.eot");', "")
1759
- .replace(r, "src: " + url + ";");
1760
- return semCss;
1761
- }
1762
- let semCss = fs.readFileSync('built/web/semantic.css', "utf8");
1763
- semCss = linkFont("icons", semCss);
1764
- semCss = linkFont("outline-icons", semCss);
1765
- semCss = linkFont("brand-icons", semCss);
1766
- return semCss;
1767
- }).then((semCss) => {
1768
- // Append icons.css to semantic.css (custom pxt icons)
1769
- const iconsFile = (pkg["name"] == "pxt-core") ? 'built/web/icons.css' : 'node_modules/pxt-core/built/web/icons.css';
1770
- const iconsCss = fs.readFileSync(iconsFile, "utf-8");
1771
- const reactCommonFile = (pkg["name"] == "pxt-core") ? 'built/web/react-common.css' : 'node_modules/pxt-core/built/web/react-common.css';
1772
- const reactCommonCss = fs.readFileSync(reactCommonFile, "utf-8");
1773
- semCss = semCss + "\n" + iconsCss + "\n" + reactCommonCss;
1774
- nodeutil.writeFileSync('built/web/semantic.css', semCss);
1775
- }).then(() => {
1776
- // generate blockly css
1777
- if (!fs.existsSync(path.join("theme", "blockly.less")))
1778
- return Promise.resolve();
1779
- return nodeutil.spawnAsync({
1751
+ args: [
1752
+ lessCPath,
1753
+ "theme/style.less",
1754
+ "built/web/semantic.css",
1755
+ "--include-path=" + lessIncludePaths
1756
+ ]
1757
+ });
1758
+ // Inline all of our icon fonts
1759
+ let semCss = await readFileAsync('built/web/semantic.css', "utf8");
1760
+ semCss = await linkFontAsync("icons", semCss);
1761
+ semCss = await linkFontAsync("outline-icons", semCss);
1762
+ semCss = await linkFontAsync("brand-icons", semCss);
1763
+ // Append icons.css to semantic.css (custom pxt icons)
1764
+ const iconsFile = isPxtCore ? 'built/web/icons.css' : 'node_modules/pxt-core/built/web/icons.css';
1765
+ const iconsCss = await readFileAsync(iconsFile, "utf8");
1766
+ semCss = semCss + "\n" + iconsCss;
1767
+ nodeutil.writeFileSync('built/web/semantic.css', semCss);
1768
+ // Generate blockly css
1769
+ if (fs.existsSync(path.join("theme", "blockly.less"))) {
1770
+ await nodeutil.spawnAsync({
1780
1771
  cmd: "node",
1781
- args: [lessCPath, "theme/blockly.less", "built/web/blockly.css", "--include-path=node_modules/semantic-ui-less:node_modules/pxt-core/theme:theme/foo/bar"]
1782
- });
1783
- }).then(() => {
1784
- // run postcss with autoprefixer and rtlcss
1785
- pxt.debug("running postcss");
1786
- const postcss = require('postcss');
1787
- const browserList = [
1788
- "Chrome >= 38",
1789
- "Firefox >= 31",
1790
- "Edge >= 12",
1791
- "ie >= 11",
1792
- "Safari >= 9",
1793
- "Opera >= 21",
1794
- "iOS >= 9",
1795
- "ChromeAndroid >= 59",
1796
- "FirefoxAndroid >= 55"
1797
- ];
1798
- const cssnano = require('cssnano')({
1799
- zindex: false,
1800
- autoprefixer: { browsers: browserList, add: true }
1801
- });
1802
- const rtlcss = require('rtlcss');
1803
- const files = ['semantic.css', 'blockly.css'];
1804
- files.forEach(cssFile => {
1805
- fs.readFile(`built/web/${cssFile}`, "utf8", (err, css) => {
1806
- postcss([cssnano])
1807
- .process(css, { from: `built/web/${cssFile}`, to: `built/web/${cssFile}` }).then((result) => {
1808
- fs.writeFile(`built/web/${cssFile}`, result.css, (err2) => {
1809
- // process rtl css
1810
- postcss([rtlcss])
1811
- .process(result.css, { from: `built/web/${cssFile}`, to: `built/web/rtl${cssFile}` }).then((result2) => {
1812
- nodeutil.writeFileSync(`built/web/rtl${cssFile}`, result2.css, { encoding: "utf8" });
1813
- });
1814
- });
1815
- });
1816
- });
1772
+ args: [
1773
+ lessCPath,
1774
+ "theme/blockly.less",
1775
+ "built/web/blockly.css",
1776
+ "--include-path=" + lessIncludePaths
1777
+ ]
1817
1778
  });
1779
+ }
1780
+ // Generate react-common css for skillmap
1781
+ const skillmapFile = isPxtCore ? "react-common/styles/react-common-skillmap-core.less" :
1782
+ "node_modules/pxt-core/react-common/styles/react-common-skillmap.less";
1783
+ await nodeutil.spawnAsync({
1784
+ cmd: "node",
1785
+ args: [
1786
+ lessCPath,
1787
+ skillmapFile,
1788
+ "built/web/react-common-skillmap.css",
1789
+ "--include-path=" + lessIncludePaths
1790
+ ]
1791
+ });
1792
+ // Run postcss with autoprefixer and rtlcss
1793
+ pxt.debug("running postcss");
1794
+ const postcss = require('postcss');
1795
+ const browserList = [
1796
+ "Chrome >= 38",
1797
+ "Firefox >= 31",
1798
+ "Edge >= 12",
1799
+ "ie >= 11",
1800
+ "Safari >= 9",
1801
+ "Opera >= 21",
1802
+ "iOS >= 9",
1803
+ "ChromeAndroid >= 59",
1804
+ "FirefoxAndroid >= 55"
1805
+ ];
1806
+ const cssnano = require("cssnano")({
1807
+ zindex: false,
1808
+ autoprefixer: { browsers: browserList, add: true }
1818
1809
  });
1810
+ const rtlcss = require("rtlcss");
1811
+ const files = ["semantic.css", "blockly.css", "react-common-skillmap.css"];
1812
+ for (const cssFile of files) {
1813
+ const css = await readFileAsync(`built/web/${cssFile}`, "utf8");
1814
+ const processed = await postcss([cssnano])
1815
+ .process(css, { from: `built/web/${cssFile}`, to: `built/web/${cssFile}` });
1816
+ await writeFileAsync(`built/web/${cssFile}`, processed.css);
1817
+ const processedRtl = await postcss([rtlcss])
1818
+ .process(processed.css, { from: `built/web/${cssFile}`, to: `built/web/rtl${cssFile}` });
1819
+ await writeFileAsync(`built/web/rtl${cssFile}`, processedRtl.css, "utf8");
1820
+ }
1821
+ }
1822
+ async function linkFontAsync(font, semCss) {
1823
+ const fontFile = await readFileAsync("node_modules/semantic-ui-less/themes/default/assets/fonts/" + font + ".woff");
1824
+ const url = "url(data:application/font-woff;charset=utf-8;base64,"
1825
+ + fontFile.toString("base64") + ") format('woff')";
1826
+ const r = new RegExp(`src:.*url\\("fonts\/${font}\\.woff.*`, "g");
1827
+ semCss = semCss.replace('src: url("fonts/' + font + '.eot");', "")
1828
+ .replace(r, "src: " + url + ";");
1829
+ return semCss;
1819
1830
  }
1820
1831
  function buildWebStringsAsync() {
1821
1832
  if (pxt.appTarget.id != "core")
@@ -1838,7 +1849,7 @@ function buildSkillMapAsync(parsed) {
1838
1849
  nodeutil.cp("node_modules/pxt-core/built/pxtlib.js", `${skillmapRoot}/public/blb`);
1839
1850
  nodeutil.cp("built/web/semantic.css", `${skillmapRoot}/public/blb`);
1840
1851
  nodeutil.cp("node_modules/pxt-core/built/web/icons.css", `${skillmapRoot}/public/blb`);
1841
- nodeutil.cp("node_modules/pxt-core/built/web/react-common.css", `${skillmapRoot}/public/blb`);
1852
+ nodeutil.cp("node_modules/pxt-core/built/web/react-common-skillmap.css", `${skillmapRoot}/public/blb`);
1842
1853
  // copy 'assets' over from docs/static
1843
1854
  nodeutil.cpR("docs/static/skillmap/assets", `${skillmapRoot}/public/assets`);
1844
1855
  if (docsPath) {
@@ -6196,7 +6207,7 @@ ${pxt.crowdin.KEY_VARIABLE} - crowdin key
6196
6207
  help: "build required css files",
6197
6208
  flags: {
6198
6209
  force: {
6199
- description: "force re-compile of less files"
6210
+ description: "deprecated; now on by default"
6200
6211
  }
6201
6212
  }
6202
6213
  }, buildSemanticUIAsync);