Commit Graph

58 Commits

Author SHA1 Message Date
Aaron Dodson
5870c66cf0 chore: Migrate ESLint configuration file to new flat format. (#8675)
* chore: rename .eslintrc.js to eslint.config.js

* chore: Rename eslint.config.js to eslint.config.mjs.

* refactor: Migrate ESLint config to new flat format.

* chore: Remove old per-directory and global ignore ESLint config files.

* fix: Allowlist JSDoc tag aliases.

* fix: Don't require @license in tests/*.

* fix: Add NodeJS globals to several files that run under Node.

* chore: Remove now-unneeded ESLint directives in core.

* chore: Remove invalid/unneeded ESLint directives.

* fix: Fix invalid use of `await` outside of an `async` function.

* fix: Improve screenshot error message.

* fix: Update ESLint config file to not warn on existing violations.

* chore: Remove suppressions of rules that weren't triggering.

* chore: Fix package-lock.json.
2024-12-03 12:40:48 -08:00
Maribeth Bottorff
53cc12da77 chore: fix playground context menu (#8139) 2024-05-17 09:48:41 -07:00
Neil Fraser
0ecbcde9fc chore: Use .includes and .startsWith, not .indexOf (#7936)
Easier to read than the diverse collection of `=== 0` and `!== -1` and `> -1` tests.
2024-03-15 00:03:55 +01:00
Neil Fraser
61cdbb65d3 chore: Setting style property to make CSP less grumpy. (#7503)
* Setting style property to make CSP less grumpy.

"Content-Security-Policy: The page’s settings blocked the loading of a resource at inline (“style-src”)."

The 'style' property should be set as an object, not as a string, according to CSP rules.

Back-ported from Blockly Games.
2023-09-19 17:01:14 +02:00
Christopher Allen
5b5a56586c refactor(tests): Introduce loading shims, use in playgrounds (#7380)
* refactor(build): Simplify implementation of posixPath

* fix(closure): Make safe to import in node.js

  Make the implementation declareModlueId safe to import and
  execute in node.js, which does not provide a window global.

  (N.B. because this is an ESM and therefore automatically
  strict, using window?.goog?.declareModuleId doesn't work
  because window being undefined is an early error.)

* feat(tests): Introduce chunk loading shims

  - Add a buildShims task to build_tasks.js that, for each chunk,
    creates a correspondingly-named build/<chunk>.mjs that will
    either (in uncompressed mode) import and reexport that chunk's
    entry point module (e.g. core/blockly.js) or (in compressed
    mode) load dist/<chunk>_compressed.js using a <script> tag
    and then export the corresponding properties on the chunk's
    exports object.

  - Provide helper methods used by these shims in
    tests/scripts/loading.mjs, including code to detect whether
    to load in compressed or uncompressed mode.

  - Add a quote() function to scripts/helpers.js, used by
    buildShims.  This is copied from tests/bootstrap_helper.js,
    which will be removed in a later commit.

* refactor(tests): Update playground.html to use new loading shims

* refactor(tests): Update advanced_playground.html to use new loading shims

* refactor(tests): Update multi_playground.html to use new loading shims

* chore(tests): Delete playgrounds/shared_procedures.html

  Shared procedure support was moved to a plugin and this should
  have been removed from core along with it.

* docs(tests): Typo corrections.

* chore(tests): Add ".loader" infix to shim filenames.

  Per suggestion on PR #7380, have buildShims name the shims
  ${chunk.name}.loader.mjs instead of just `${chunk.name}.mjs`.
2023-08-14 22:47:19 +01:00
dependabot[bot]
2546b01d70 chore(deps): Bump prettier from 2.8.8 to 3.0.0 (#7322)
* chore(deps): Bump prettier from 2.8.8 to 3.0.0

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: Reformat using Prettier v3.0 defaults

The main change is to add trailing commas to the last line of
block-formatted function calls.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
2023-07-25 14:56:10 +00:00
Christopher Allen
817ffab754 refactor(tests): Update bootstrap.js to better support generator chunks (#7171)
Refactor bootstrap.js and bootstrap_helper.js to be able to deal
with generator chunks.  In particular for each chunk, specify:

- The goog.module ID to goog.require() in uncompressed mode.
- The script filename to load in compressed mode.
- Where the chunk's UMD wrapper will save the export object when
  loaded as a script.
- What global variable the chunk's export object should be saved in
  (if desired).
- Any individual named exports to destructure to global variables.

This allows the bootstrap scripts to be slightly simpler while
also being more flexible.
2023-06-15 21:03:04 +01:00
Maribeth Bottorff
88ff901a72 chore: use prettier instead of clang-format (#7014)
* chore: add and configure prettier

* chore: remove clang-format

* chore: remove clang-format config

* chore: lint additional ts files

* chore: fix lint errors in blocks

* chore: add prettier-ignore where needed

* chore: ignore js blocks when formatting

* chore: fix playground html syntax

* chore: fix yaml spacing from merge

* chore: convert text blocks to use arrow functions

* chore: format everything with prettier

* chore: fix lint unused imports in blocks
2023-05-10 16:01:39 -07:00
Christopher Allen
d808c068d2 fix(tests): Use build/msg/en.js instead of msg/messages.js (#6825)
This change had already been made (by PR #6475 amongst other) to
most of the tests, but there were a couple of stragglers that
still mentioned messages.js.

Fixes #6824.
2023-02-07 10:25:13 +00:00
Christopher Allen
52a0d525d7 chore(build): Remove build products from the Blockly repository (#6475)
* feat(build): Make build tasks invoke their prerequisites

  - Divide gulp targets into three kinds: main sequence,
    manually invokable, and script-only.  The first two categories
    automatically invoke their prerequisites.
  - Give (most of) the affected gulp targets shorter and more memorable
    names that could become their npm script names in future.

* feat(build): Make package tasks invoke their prerequisites

  Have the package task invoke the cleanBuildDir (as well as
  cleanPackageDir) and build tasks.  Remove the checkBuildDir
  task as it is now redundant since a fresh build is done every
  time.

* feat(build): Make git tasks invoke their prerequisites

* feat(build): Make cleanup, license [sic] tasks invoke their prerequisites

  Turns out they don't have any, so this commit just classifies
  their gulp targets according to the established scheme.

* feat(build): Make appengine tasks invoke their prerequisites

  In this case prepareDeployDir will eventually depend on package
  but does not for now.

* feat(build): Have npm scripts run npm ci first where applicable

  Have any npm script that have external effects (e.g. publishing an
  npm package, pushing a new version to appengine, or updating GitHub
  Pages) start by running npm ci to ensure that all dependencies are
  up-to-date with respect to package-lock.json.

  (This is done by npm and not a gulp script because gulp itself
  might need updating.  So might npm, but that is less likely to
  make any difference to what gets published/pushed.)

* chore(build): have tests use package target

  Have the tests just run the package target (with debug flags)
  since that runs the the build target automatically.

* feat(tests): Write Closure Compiler output directly to dist/

  Since they are already UMD-wrapped, have Closure Compiler write
  output chunks directly to RELEASE_DIR, i.e. dist/.

* chore(tests): Use freshly-build files in compressed mode.

  Use the freshly-built build/*_compresssed.js files when bootstrapping
  in compressed mode, rather than using the checked-in files in the
  repository root.

  This helps ensure that compressed and uncompressed mode will be
  testing (as closely as possible) the same code.

  Obsoletes #6218 (though the issues discussed there have not actually
  yet been addressed in this branch).

* chore(build): Write intermediate langfiles to build/msg

  Write the results of create_messages.py to build/msg instead of
  build/msg/js.

* fix(build): Use build/msg/en.js instead of msg/messages.js in tests

  This has no direct effect but fixes a long-standing misdesign
  where we are testing against the input to, rather than the output
  of, the language file processing pipeline.

* feat(demos): Use freshly-built files

  Use the freshly-built dist/*_compresssed.js and build/msg/* files
  rather than using the checked-in files in the repository root.

  This helps ensure that these demos are using the most recent
  version of Blockly (even in the develop branch).

* fix(build): Update appengine deployment to include built files

  Modify the prepareDemos task as follows:

  - Use the git index instead of HEAD, so that most local changes
    will be applied (without copying whatever .gitignored cruft
    might be in the local directory).
  - Run clean and build and then copy build/msg and
    dist/*_compressed.js* to the deploy directory.

  This fixes the problem created by the previous commit, wherein the
  demos relied on built files that were not being deployed to
  appengine.

* fix(build): Update GitHub Pages deployment to include built files

  Modify the updateGithubPages task to run clean and build and
  then git add build/msg dist/*_compressed.js*, so that they will
  be included in the deployed pages.

  This fixes the problem created by the previous^2 commit,
  wherein the demos relied on built files that were not being
  deployed to GitHub Pages.

* chore(build): Remove build products from repository

  Remove *_compressed.js* and msg/js/* from the blockly repository.
  Also remove the now-obsolete checkinBuilt gulp task.

* chore(build): Apply relevant changes to test_tasks.js

  Apply changes made to run_all_tests.sh and check_metadata.sh to
  the corresponding parts of their JS replacements in
  test_tasks.js.

* chore(build): Make updates suggested in PR #6475

  - Remove `clean:builddir` and `clean:releasedir` - `clean`
    is sufficient.
  - Remove duplicate `require` from `appengine_tasks.js`.

* feat(build): Use shorter npm script names

  Since scripts that run build tasks now automatically run their
  prerequisite tasks, the previous naming scheme of task `build`
  running all the `build:subtask`s no longe really makes very
  much sense.

  Additionally, following a chat discussion, there seems to be a
  rough consensus to use "messages" to refer to the .json input
  files, and "langfiles" to the generated .js output files.

  Consequently, simplify npm script names by renaming as follows:

  - "generate:langfiles" -> "messages"
  - "build:langfiles" -> "langfiles"
  - "build:js" -> "tsc"
  - "build:deps" -> "deps"
  - "build:compiled" -> "minify"
  - "build:compressed": delete this synonym for "build:compiled",

  ("minify" was chosen as agnostic to Closure Compiler vs. WebPack.)

* chores(build): Add deprecation notice for old scripts

  To reduce potential confusion/frustration, restore the previous
  npm scripts but have them display a deprecation notice instead
  (note that npm prints the script contents before running it, so
  echo is not needed).

* docs(build): Add comments distinguishing 'messages' from 'langfiles'
2022-11-03 13:15:10 +00:00
Beka Westberg
ad22de1e53 test: add shared procedures playground (#6485)
* test: add shared procedures playground

* test: use json toolbox in testplayground

* chore: delete unnecessary toolbox def
2022-10-13 15:26:00 -07:00
Beka Westberg
8c9cabfe57 chore: fix the advanced playground (#6354) 2022-08-17 15:12:39 -07:00
Christopher Allen
46df7d132d refactor(tests): Revise tests/playgrounds/prepare.js as tests/bootstrap.js to improve support for ES modules and post-bootstrap scripts (#6214)
* refactor(tests): Move and rename prepare.js, blockly.mjs

  Since prepare.js and blockly.mjs are going to be needed for running
  all tests in uncompiled mode (not just the playgrounds), move them
  tests/.  Further, rename prepare.js to bootstrap.js to better reflect
  its purpose.

* feat(tests): Introduce BLOCKLY_BOOTSTRAP_OPTIONS

  Provide a mechanism for web pages that use bootstrap.js to control
  what is loaded and how.

* fix(tests): Use the blockly repository path for all script src= URLs

  Previously the (non-advanced) playground was only correctly loadging
  on localhost because you can put an arbitrary number of "../"s in front
  of a relative URL and it just takes you to the root directory.

* fix(tests): Don't use template literals in bootstrap.js

  This is necessary (but not necessarily sufficient) to be able to
  load the file in IE 11.

* fix(tests): Throw error if attempting to bootstrap in node.js

* feat(tests): Make bootstrap.js more configurable.

* Terminology change: use "compressed" and "uncompressed" to describe
  what Closure Compiler calls "compiled" and "uncompiled", to reduce
  confusion with the compilation that will be done by tsc.

* Get the list of modules to bootstrap (in compressed mode), or
  scripts to load (in compressed mode) from BLOCKLY_BOOTSTRAP_OPTIONS,
  to allow calling scripts to to specify exactly what to load.

* feat(tests): Use a proper quote function

  We need to generate string literals.  Best to use a quote function
  instead of concatenating on quote marks withou escaping.  Copy a
  well-tested one from Code City.

* feat(tests): Support an additionalScripts option

  This is a list of scripts to load (in order) once the required modules
  have been bootstrapped.

  We do this using goog.addDependency to make the first script depend
  on the required modules, then each subsequent script depend on the
  previous one, and then finally goog.bootstrapping the last such script.

* refactor(tests): Remove special handling of msg/messages.js

* refactor(tests): Use additionalScripts for all script loading

  Use additionalScripts option for all script loading in
  playground.html and advanced_playground.html.

* refactor(tests): Use bootstrap instead of uncompressed in Mocha tests

  Use tests/bootstrap.js instead of blockly_uncompressed.js to load
  blockly in uncompressed mode in the Mocha tests.

  This entails adding a new item, despFiles, to BLOCKLY_BOOTSTRAP_OPTIONS,
  to allow tests/deps.mocha.js to be loaded at the appropriate point.

  Mention of blockly_uncompressed.js is removed from
  tests/mocah/.mocharc.js; it's not clear to me what effect the "file:"
  directive in this file might have previously had and I was not able to
  find documentation for it on mochajs.org, but in any case removing it
  appears to have had no ill effect.

* refactor(tests): Use bootstrap instead of uncompressed in generator tests

  This entails adding an additional check in bootstrap so as to load
  uncompressed when loading from a file: URL, since these are not
  localhost URLs - though in fact the generator tests run equally well
  in compressed mode, albeit against (for now) the previously-check-in
  build products rather than the live code.

* refactor(test): Use bootstrap.js in multi_playground.html

  This removes the last use of load_all.js, so remove it.

* chore(tests): Delete blockly_uncompressed.js

  Its function has now been entirely subsumed by tests/bootstrap.js,
  so remove it and update any remaining mentions of it.

  Also fix formatting and positions of some comments in playground.html.

* fix(tests): Rewrite bootstrap sequencing code

  An earlier commit modified the generated <script> to use
  goog.addDependency to trick the debug module loader into loading
  .additionalScripts (via goog.bootstrap), but it turns out there is
  a small problem: scripts like msg/messages.js have undeclared
  dependencies on the Blockly module, and without a call to
  goog.require('Blockly') in them they can end up being run before
  the Blockly module is fully loaded.

  (This problem only occurs when there are ES Modules, rather than
  merely goog.modules, in the mix.)

  Fix this by adding a script, bootstrap_helper.js, to be loaded
  options.requires and any options.additionalScripts that makes an
  explicit call to goog.require for each of option.requires.

  Also refactor the code so that instead of generating a loop which
  calls goog.addDependency, we generate the addDependency calls
  directly.  This makes debugging a bit easer as we can use the browser's
  dev tools to inspect the generated calls in the DOM tree.

* fix(tests): Prevent spurious transpilation warnings

  For some reason when the debug module loader encounters ES modules
  it starts to complain about being unable to transpile some ES202x
  features in other (non-ESM) modules, even though it doesn't normally
  try to transpile those.

  Since uncompressed-mode testing is almost exclusively on modern
  browsers we don't care about transpiling these features, so suppress
  the warnings instead.

* refactor(tests): Rename blockly.mjs to bootstrap_done.mjs; simplify

  Since blockly.mjs is no longer returning just the exports object
  from core/blockly.js (see PR #5995), it might be better named after
  its actual purpose: to wait for bootstrapping to be done.

  Remove all the code that was used to pass the blockly.js exports
  object along from the bootstrap callback to the blockly.mjs export,
  since there's no reason to go to a lot of trouble to set a local
  variable named Blockly to the same value as a global variable named
  Blockly.

  (Something like this may be needed again in future, but certainly in
  a different form.)

* chore(tests): Use freshly-build files in compressed mode.

  Use the freshly-built build/*_compresssed.js files when bootstrapping
  in compressed mode, rather than using the checked-in files in the
  repository root.

  This helps ensure that compressed and uncompressed mode will be
  testing (as closely as possible) the same code.

* chore(tests): Rename BlocklyLoader to blocklyLoader; record compressed

  - Rename the BlocklyLoader global to blocklyLoader (since it is not
    a class constructor).
  - Create it regardless of whether we are bootstrapping in
    uncompressed or loading compressed via <script> tags.
  - Record which we are doing as .compressed, and use this property
    to choose playground background colour.

* chore(tests): Resolve comments for PR #6214

  Mostly documentation changes, but notably renaming blocklyLoader to
  bootstrapInfo.

* Revert "chore(tests): Use freshly-build files in compressed mode."

  This reverts commit de8d356838.
2022-06-15 19:35:01 +01:00
Christopher Allen
307ff71c21 refactor(build): Preparation for building TypeScript (#6205)
* chore(deps): Update closure/goog/base.js, add goog.js

  - Update base.js from the latest version (20220502.0.0).
  - Also copy over goog.js, which provides access to a suitable subset
    of goog.* via an importable module).

* chore(build): Split gulpfiles/config.js exports object

  This makes it possible for entries to depend on each other.

* chore(build): build config consistency

  - Reorder entries in gulpfiles.config.js to better match order they
    are used.
  - Have update_metadata.sh reference config.js and vice versa.

* refactor(build): Move deps.js (+ deps.mocha.js) from test/ to build/

  Once we start using tsc, deps.js will be created based on the ouptut
  of tsc rather than the raw source in core/.  Since tsc will need to
  be run before running closure-make-deps and also before trying to
  load blockly_uncompressed.js, it doesn't really make sense to check
  in deps.js; it's better to re-create as needed.

  To reduce inconvenience, a new "prepare" script is added to
  package.json which will run the buildDeps gulp target automaticaly
  when one runs npm install.

* refactor(build): Always build from TypeScript sources

  - Add buildJavaScript gulp task to use tsc to compile any .ts files
    in core/ into build/src/core/ (and also copy any .js files that
    are not yet migrated to TypeScript, which for now is all of them.
  - Remove closure/goog from explicit inputs to tsc; it will find
    the files it needs (e.g., goog.js) automatically.
  - Have buildDeps, the playground, and all the tests that run in
    uncompiled mode use build/src/core/ instead of core/ as their
    input directory.

* feat(build): Add buildJavaScriptAndDeps gulp task

  Have npm run build:deps (and npm run prepare) use a new gulp task,
  buildJavaScriptAndDeps, to run tsc followed by closure-make-deps,
  ensuring that deps.js is calculated based on the most recent code
  in core/.

* fix(build): Fix implementation of flattenCorePaths

  Even though this function is going away I want to remove it in
  a separate PR so that we can revert easily if desired.  But the
  previous checked-in code was totally wrong.  This version works.

* fix(build): Don't let checkinBuilt copy build/src/**

  Now that we are putting a lot more stuff in build/ (specifically,
  all the tsc output in build/src/), modify checkinBuilt so that it
  only copies the specific things we want to check in (for now):

  - _compressed.js build artifacts and their accompanying .js.maps
  - the generated build/msg/js/*.js language files.

  Unrelatedly, also fix safety-quoting of arguments for one execSync
  call.
2022-06-14 22:20:42 +01:00
Maribeth Bottorff
05b47e27d9 chore: fix screenshot lint (#6056)
* chore: fix screenshot lint

* chore: remove extra space
2022-03-31 14:34:33 -07:00
Beka Westberg
c4a25eb3c4 fix: revert "Delete events should animate when played (#5919)" (#6031)
* Revert "Delete events should animate when played (#5919)"

This reverts commit bce4c5e2c6.

* fix: lint in screenshot
2022-03-29 11:47:50 -07:00
Aaron Dodson
ca6e590101 fix: Fix downloading screenshots on the playground. (#6025)
* fix: Fix downloading screenshots on the playground.

* fix: Resolve lint warning about unused variable.
2022-03-25 08:27:08 -07:00
alschmiedt
364bf14ce6 fix: advanced playground and playground to work when hosted (#6021) 2022-03-23 11:08:55 -07:00
Beka Westberg
9e1cda8f45 fix: playground access to Blockly 2022-03-14 11:53:27 -07:00
Christopher Allen
5078dcbc6d refactor(blocks)!: Rename Blockly.blocks.* modules to Blockly.libraryBlocks.* (#5953)
...and rename Blockly.blocks.all (blocks/all.js) to
Blockly.libraryBlocks (blocks/blocks.js

BREAKING CHANGE: (only) because the exports object from the
`blocks_compressed.js` chunk will be accessed as
`Blockly.libraryBlocks` instead of `Blockly.blocks.all` when the
chunk is loaded in a browser via a `<script>` tag.  There will
be no changes visible when the chunk is loaded via ES module
`import` or CJS `require`.
2022-02-23 21:25:52 +00:00
Christopher Allen
b1f0a6a867 refactor(tests): Use goog.bootstrap to allow loading ES modules in playground (#5931)
* chore(deps): Update closure/goog/base.js, add goog.js

  * Update base.js from the latest version (20220104.0.0).
  * Also copy over goog.js, which provides access to asuitable subset
    of goog.* via an importable module).

* refactor(tests): Have playground.html load Blockly as a module

  N.B.:

  * We still need a preparation step, in order to load base.js and
    deps.js via <script> tags in uncompiled mode; in compiled mode
    it will instead load all the *_compressed.js files via <script>
    tags.

    Acess to the Blockly object is via:

        import Blockly from './playgrounds/blockly.mjs';

    (N.B: no "* as", since blockly.mjs has only a default export.)

  * There remain two serious defects when running in uncompiled mode:
    * It does not attempt to load msg/messages.js, causing startup to
      fail.
    * Module loading only works if there are no ES Modules; if there
      are, something goes wrong with base.js's attempt to sequence
      module loads causing goog.modules that import ES modules to get
      a null exports object for that import.  X-(

* fix(tests): Have playground.html load messages.js before generators

  This fixes the issue caused by missing messages when loading
  the generators.

* fix(tests): Move bootsrap calls to prepare.js

  Move the calls to goog.bootstrap from blockly.mjs to prepare.mjs.
  This is needed to work around a bug in the Cosure Library debug
  loader (https://github.com/google/closure-library/issues/1152).

  This gets a bit ugly because most of the code has to go in a
  <script> (because it needs goog.bootstrap, which was loaded by
  an earlier <script> tag).

* fix(documentation): Minor comment corrections for PR #5931
2022-02-23 10:30:21 +00:00
alschmiedt
2adf326c23 fix: update the playground to load compressed when hosted (#5835) 2022-01-06 11:28:27 -08:00
Rachel Fenichel
5a70f8a337 chore(test): add version of multi_playground with compressed files (#5785) 2021-12-03 11:11:57 -08:00
Rachel Fenichel
8635942248 chore(test): Add playground that uses compressed files (#5782) 2021-12-03 10:44:15 -08:00
alschmiedt
0493011201 fix: the advanced playground to work with dec 2021 release (#5775) 2021-12-02 17:43:26 -08:00
Rachel Fenichel
f14a1c8034 chore: fix more lint (#5676)
* chore: fix assorted lint

* chore: clang-format

* chore: clang-format
2021-11-08 16:41:52 -08:00
Rachel Fenichel
f70032aaa6 chore: replace more uses of var with const and let (#5628)
* chore: fix uses of var in core/block_dragger

* chore: fix uses of var in core/extensions.js

* chore: fix uses of var in core/field_multilineinput.js

* chore: fix uses of var in assorted core files

* chore: fix uses of var in node test runner and playground screenshot code

* fix: undefined return from measureFontMetrics

* fix: violations of no-const-assign

* chore: only one variable declaration per line
2021-10-25 09:28:31 -07:00
Neil Fraser
90b3f75d82 Remove @author tags (#5601)
Our files are up to a decade old, and have churned so much, that the initial author of the file no longer has much meaning.

Furthermore, this will encourage developers to post to the developer group, rather than emailing Googlers (usually me) directly.
2021-10-15 09:50:46 -07:00
kozbial
beff5e19bf Combine workspace_comment_render_svg.js with workspace_comment_svg.js 2021-07-29 17:03:52 -07:00
Christopher Allen
1306e41d3b Load playground.html etc. from local http server
Unlike goog.provide packages, goog.module modules are loaded using
XMLHttpRequest in uncompiled mode.  Because browsers treat file: URLs
as each being a separate, unique origin, this means that CORS rules
prevent goog.module modules being loaded from a file URL.

To work around this, use the http-server npm to serve the repository
root directory on localhost:8080.

Provide a script so that you can type `npm start` to start the local
http server and automatically open a browser window pointing at
tests/playground.html.

Modify the setBackgroundColour function in the playgrounds to provide
the usual lilac background on locahost URLs and a sickly green one
if using a file: URL, all of which will soon stop working.

(The background doesn't actually appear to be visible in the advanced
playground.)
2021-07-09 23:11:19 +01:00
Monica Kozbial
a15bbf1700 Revert #4697 (#4917) 2021-06-16 09:36:39 -07:00
Sam El-Husseini
d83279008b Remove dark theme in favour of @blockly/theme-dark (#4697)
* Remove dark theme in favour of @blockly/theme-dark
2021-04-21 13:33:59 -07:00
Fishuke
16979f7458 Fix misplaced percent sign in css, close iframe html tag (#4560) 2021-01-05 11:09:37 -08:00
Sam El-Husseini
70f71af933 Add test-blocks into the basic playground (#4333)
* Use local node_modules files instead of unkpkg for advanced playground, get test blocks in the basic playground from npm

* Also move theme-modern

* Update package-lock
2020-10-02 09:48:01 -07:00
alschmiedt
38d37d7c7a Updates dev tools script to new version (#4273) 2020-09-11 10:11:43 -07:00
alschmiedt
5bca960628 Fix advanced playground (#4266) 2020-09-10 15:57:53 -07:00
alschmiedt
29269957c7 Removes test blocks (#4250) 2020-09-08 13:50:45 -07:00
alschmiedt
d01169fa79 Toolbox Rewrite (#4223)
Rewrite the toolbox in order to get rid of old closure code and make it easier to extend.

Co-authored-by: Maribeth Bottorff <maribethb@google.com>
2020-09-02 08:13:07 -07:00
Sam El-Husseini
02ff548801 Snap dev tools to 1.1.1 (#4077) 2020-07-27 11:33:06 -07:00
Sam El-Husseini
5d43d256e2 Move test blocks to dev-tools, refactor advanced playground (#4057)
* Remove remaining advanced playground actions, and remove test blocks
2020-07-24 13:53:00 -07:00
alschmiedt
03f4a3d4e3 Fix spaces (#3992) 2020-06-24 13:53:57 -07:00
Sam El-Husseini
f1977fd5e3 No flyout mutator 2020-06-11 09:28:40 -07:00
Sam El-Husseini
0a7fee5af0 Remove arrow functions 2020-06-08 12:07:20 -07:00
Sam El-Husseini
2276b67968 PR comments 2020-06-08 12:05:37 -07:00
Sam El-Husseini
47385c5986 minor updates 2020-06-08 10:10:39 -07:00
Sam El-Husseini
29339351ad Use unpkg 2020-06-08 09:54:14 -07:00
Sam El-Husseini
e96ec4489c Update the advanced playground to include the new Blockly playground 2020-06-08 09:53:45 -07:00
alschmiedt
26e84fef11 Add ability to add blocks by type (#3928)
* Add ability to add blocks by type
2020-06-04 12:49:04 -07:00
Sam El-Husseini
38557d45be Fix advanced playground options passing (#3907) 2020-05-19 09:59:08 -07:00
alschmiedt
55a36ba364 Add JSON definition for test blocks (#3901)
* Add JSON definition for test blocks
2020-05-15 13:50:12 -07:00