forked from google/blockly
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from trinketapp/merge-upstream-201707
Upstream Merge
- Loading branch information
Showing
426 changed files
with
75,647 additions
and
18,748 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*_compressed*.js | ||
*_uncompressed*.js | ||
/msg/* | ||
/core/css.js | ||
/tests/jsunit/* | ||
/tests/generators/* | ||
/generators/* | ||
/demos/* | ||
/accessible/* | ||
/appengine/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"rules": { | ||
"curly": ["error", "multi-line"], | ||
"eol-last": ["error"], | ||
"indent": ["error", 2, {"SwitchCase": 1}], # Blockly/Google use 2-space indents | ||
"linebreak-style": ["error", "unix"], | ||
"max-len": ["error", 120, 4], | ||
"no-trailing-spaces": ["error", { "skipBlankLines": true }], | ||
"no-unused-vars": ["error", {"args": "after-used", "varsIgnorePattern": "^_"}], | ||
"no-use-before-define": ["error"], | ||
"quotes": ["off"], # Blockly mixes single and double quotes | ||
"semi": ["error", "always"], | ||
"space-before-function-paren": ["error", "never"], # Blockly doesn't have space before function paren | ||
"strict": ["off"], # Blockly uses 'use strict' in files | ||
"no-cond-assign": ["off"], # Blockly often uses cond-assignment in loops | ||
"no-redeclare": ["off"], # Closure style allows redeclarations | ||
"valid-jsdoc": ["error", {"requireReturn": false}], | ||
"no-console": ["off"] | ||
}, | ||
"env": { | ||
"browser": true | ||
}, | ||
"globals": { | ||
"Blockly": true, # Blockly global | ||
"goog": true # goog closure libraries/includes | ||
}, | ||
"extends": "eslint:recommended" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ npm-debug.log | |
.project | ||
*.pyc | ||
*.komodoproject | ||
/nbproject/private/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
registry=https://registry.npmjs.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
language: node_js | ||
matrix: | ||
include: | ||
- os: linux | ||
dist: trusty | ||
node_js: stable | ||
sudo: required | ||
addons: | ||
apt: | ||
packages: | ||
- google-chrome-stable | ||
- os: osx | ||
node_js: stable | ||
osx_image: xcode8.3 | ||
|
||
before_install: | ||
- npm install google-closure-library | ||
- npm install webdriverio | ||
# Symlink closure library | ||
- ln -s $(npm root)/google-closure-library ../closure-library | ||
|
||
before_script: | ||
- export DISPLAY=:99.0 | ||
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then ( scripts/setup_linux_env.sh ) fi | ||
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then ( scripts/setup_osx_env.sh ) fi | ||
- sleep 2 | ||
|
||
script: | ||
- set -x | ||
- npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Contributing to Blockly | ||
|
||
Want to contribute? Great! | ||
- First, read this page (including the small print at the end). | ||
- Second, please make pull requests against develop, not master. If your patch | ||
needs to go into master immediately, include a note in your PR. | ||
|
||
For more information on style guide and other details, head over to the [Blockly Developers site](https://developers.google.com/blockly/guides/modify/contributing). | ||
|
||
### Before you contribute | ||
Before we can use your code, you must sign the | ||
[Google Individual Contributor License Agreement](https://cla.developers.google.com/about/google-individual) | ||
(CLA), which you can do online. The CLA is necessary mainly because you own the | ||
copyright to your changes, even after your contribution becomes part of our | ||
codebase, so we need your permission to use and distribute your code. We also | ||
need to be sure of various other things—for instance that you'll tell us if you | ||
know that your code infringes on other people's patents. You don't have to sign | ||
the CLA until after you've submitted your code for review and a member has | ||
approved it, but you must do it before we can put your code into our codebase. | ||
|
||
### Larger changes | ||
Before you start working on a larger contribution, you should get in touch with | ||
us first through the issue tracker with your idea so that we can help out and | ||
possibly guide you. Coordinating up front makes it much easier to avoid | ||
frustration later on. | ||
|
||
### Code reviews | ||
All submissions, including submissions by project members, require review. We | ||
use Github pull requests for this purpose. | ||
|
||
### Browser compatibility | ||
We care strongly about making Blockly work on all browsers. As of 2017 we | ||
support IE 10 and 11, Edge, Chrome, Safari, and Firefox. We will not accept | ||
changes that only work on a subset of those browsers. You can check [caniuse.com](https://caniuse.com/) | ||
for compatibility information. | ||
|
||
### The small print | ||
Contributions made by corporations are covered by a different agreement than | ||
the one above, the | ||
[Software Grant and Corporate Contributor License Agreement](https://cla.developers.google.com/about/google-corporate). |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
# Blockly | ||
# Blockly [![Build Status]( https://travis-ci.org/google/blockly.svg?branch=master)](https://travis-ci.org/google/blockly) | ||
|
||
|
||
Google's Blockly is a web-based, visual programming editor. Users can drag | ||
blocks together to build programs. All code is free and open source. | ||
|
||
**The project page is https://developers.google.com/blockly/** | ||
|
||
![](https://developers.google.com/blockly/sample.png) | ||
![](https://developers.google.com/blockly/images/sample.png) | ||
|
||
Blockly has an active [developer forum](https://groups.google.com/forum/#!forum/blockly). Please drop by and say hello. Show us your prototypes early; collectively we have a lot of experience and can offer hints which will save you time. | ||
|
||
Help us focus our development efforts by telling us [what you are doing with | ||
Blockly](https://developers.google.com/blockly/registration). The questionnaire only takes | ||
a few minutes and will help us better support the Blockly community. | ||
|
||
Want to contribute? Great! First, read [our guidelines for contributors](https://developers.google.com/blockly/guides/modify/contributing). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Accessible Blockly | ||
================== | ||
|
||
Google's Blockly is a web-based, visual programming editor that is accessible | ||
to blind users. | ||
|
||
The code in this directory renders a version of the Blockly toolbox and | ||
workspace that is fully keyboard-navigable, and compatible with most screen | ||
readers. It is optimized for NVDA on Firefox. | ||
|
||
In the future, Accessible Blockly may be modified to suit accessibility needs | ||
other than visual impairments. Note that deaf users are expected to continue | ||
using Blockly over Accessible Blockly. | ||
|
||
|
||
Using Accessible Blockly in Your Web App | ||
---------------------------------------- | ||
The demo at blockly/demos/accessible covers the absolute minimum required to | ||
import Accessible Blockly into your web app. You will need to import the files | ||
in the same order as in the demo: utils.service.js will need to be the first | ||
Angular file imported. | ||
|
||
When the DOMContentLoaded event fires, call ng.platform.browser.bootstrap() on | ||
the main component to be loaded. This will usually be blocklyApp.AppComponent, | ||
but if you have another component that wraps it, use that one instead. | ||
|
||
|
||
Customizing the Sidebar and Audio | ||
--------------------------------- | ||
The Accessible Blockly workspace comes with a customizable sidebar. | ||
|
||
To customize the sidebar, you will need to declare an ACCESSIBLE_GLOBALS object | ||
in the global scope that looks like this: | ||
|
||
var ACCESSIBLE_GLOBALS = { | ||
mediaPathPrefix: null, | ||
customSidebarButtons: [] | ||
}; | ||
|
||
The value of mediaPathPrefix should be the location of the accessible/media | ||
folder. | ||
|
||
The value of 'customSidebarButtons' should be a list of objects, each | ||
representing buttons on the sidebar. Each of these objects should have the | ||
following keys: | ||
- 'text' (the text to display on the button) | ||
- 'action' (the function that gets run when the button is clicked) | ||
- 'id' (optional; the id of the button) | ||
|
||
|
||
Limitations | ||
----------- | ||
- We do not support having multiple Accessible Blockly apps in a single webpage. | ||
- Accessible Blockly does not support the use of shadow blocks. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/** | ||
* AccessibleBlockly | ||
* | ||
* Copyright 2016 Google Inc. | ||
* https://developers.google.com/blockly/ | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the 'License'); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an 'AS IS' BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* @fileoverview Top-level component for the Accessible Blockly application. | ||
* @author [email protected] (Madeeha Ghori) | ||
*/ | ||
|
||
goog.provide('blocklyApp.AppComponent'); | ||
|
||
goog.require('Blockly'); | ||
|
||
goog.require('blocklyApp.AudioService'); | ||
goog.require('blocklyApp.BlockConnectionService'); | ||
goog.require('blocklyApp.BlockOptionsModalComponent'); | ||
goog.require('blocklyApp.BlockOptionsModalService'); | ||
goog.require('blocklyApp.KeyboardInputService'); | ||
goog.require('blocklyApp.NotificationsService'); | ||
goog.require('blocklyApp.SidebarComponent'); | ||
goog.require('blocklyApp.ToolboxModalComponent'); | ||
goog.require('blocklyApp.ToolboxModalService'); | ||
goog.require('blocklyApp.TranslatePipe'); | ||
goog.require('blocklyApp.TreeService'); | ||
goog.require('blocklyApp.UtilsService'); | ||
goog.require('blocklyApp.VariableAddModalComponent'); | ||
goog.require('blocklyApp.VariableModalService'); | ||
goog.require('blocklyApp.VariableRenameModalComponent'); | ||
goog.require('blocklyApp.VariableRemoveModalComponent'); | ||
goog.require('blocklyApp.WorkspaceComponent'); | ||
|
||
|
||
blocklyApp.workspace = new Blockly.Workspace(); | ||
|
||
blocklyApp.AppComponent = ng.core.Component({ | ||
selector: 'blockly-app', | ||
template: ` | ||
<blockly-workspace></blockly-workspace> | ||
<blockly-sidebar></blockly-sidebar> | ||
<!-- Warning: Hiding this when there is no content looks visually nicer, | ||
but it can have unexpected side effects. In particular, it sometimes stops | ||
screenreaders from reading anything in this div. --> | ||
<div class="blocklyAriaLiveStatus"> | ||
<span aria-live="polite" role="status">{{getAriaLiveReadout()}}</span> | ||
</div> | ||
<blockly-add-variable-modal></blockly-add-variable-modal> | ||
<blockly-rename-variable-modal></blockly-rename-variable-modal> | ||
<blockly-remove-variable-modal></blockly-remove-variable-modal> | ||
<blockly-toolbox-modal></blockly-toolbox-modal> | ||
<blockly-block-options-modal></blockly-block-options-modal> | ||
<label id="blockly-translate-button" aria-hidden="true" hidden> | ||
{{'BUTTON'|translate}} | ||
</label> | ||
<label id="blockly-translate-workspace-block" aria-hidden="true" hidden> | ||
{{'WORKSPACE_BLOCK'|translate}} | ||
</label> | ||
`, | ||
directives: [ | ||
blocklyApp.BlockOptionsModalComponent, | ||
blocklyApp.SidebarComponent, | ||
blocklyApp.ToolboxModalComponent, | ||
blocklyApp.VariableAddModalComponent, | ||
blocklyApp.VariableRenameModalComponent, | ||
blocklyApp.VariableRemoveModalComponent, | ||
blocklyApp.WorkspaceComponent | ||
], | ||
pipes: [blocklyApp.TranslatePipe], | ||
// All services are declared here, so that all components in the application | ||
// use the same instance of the service. | ||
// https://www.sitepoint.com/angular-2-components-providers-classes-factories-values/ | ||
providers: [ | ||
blocklyApp.AudioService, | ||
blocklyApp.BlockConnectionService, | ||
blocklyApp.BlockOptionsModalService, | ||
blocklyApp.KeyboardInputService, | ||
blocklyApp.NotificationsService, | ||
blocklyApp.ToolboxModalService, | ||
blocklyApp.TreeService, | ||
blocklyApp.UtilsService, | ||
blocklyApp.VariableModalService | ||
] | ||
}) | ||
.Class({ | ||
constructor: [ | ||
blocklyApp.NotificationsService, function(notificationsService) { | ||
this.notificationsService = notificationsService; | ||
} | ||
], | ||
getAriaLiveReadout: function() { | ||
return this.notificationsService.getDisplayedMessage(); | ||
} | ||
}); |
Oops, something went wrong.