initial commit
This commit is contained in:
3
node_modules/jibo-tools/.npmignore
generated
vendored
Normal file
3
node_modules/jibo-tools/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
gulpfile.js
|
||||
tests
|
||||
.gitignore
|
||||
3
node_modules/jibo-tools/LICENSE.txt
generated
vendored
Normal file
3
node_modules/jibo-tools/LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
Copyright © 2015 Jibo, Inc. All rights reserved.
|
||||
|
||||
See www.jibo.com/legal/copyright for additional attributions.
|
||||
9
node_modules/jibo-tools/bin/README.MD
generated
vendored
Normal file
9
node_modules/jibo-tools/bin/README.MD
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# bin
|
||||
Everything in the ```/bin``` folder ends up copied into the ```/jibo/sdk/bin``` folder of robots.
|
||||
They are not meant to be run directly from on the robot, but rather are executed remotely from
|
||||
the computer of people executing ```jibo``` CLI commands.
|
||||
|
||||
- bin/window-manager.js
|
||||
- Windows Manager
|
||||
- bin/index-robot.js
|
||||
- Index Robot
|
||||
26
node_modules/jibo-tools/bin/setup.sh
generated
vendored
Executable file
26
node_modules/jibo-tools/bin/setup.sh
generated
vendored
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
# echo "Making sure Jibo's Audio, Body, and TTS service are running."
|
||||
# Kill all of the services
|
||||
# TODO: Make sure this isn't causing issues where services expect to shutdown nicely
|
||||
killall jibo-audio-service >/dev/null 2>&1
|
||||
killall jibo-body-service >/dev/null 2>&1
|
||||
killall jibo-tts-service >/dev/null 2>&1
|
||||
|
||||
# Give some for the processes to be killed
|
||||
#sleep 1
|
||||
|
||||
# Now startup the services again
|
||||
jibo-audio-service -c /etc/jibo/jibo-audio-service.json >/tmp/jibo-audio-service.log 2>&1 &
|
||||
jibo-body-service -c /etc/jibo/jibo-body-service.json >/tmp/jibo-body-service.log 2>&1 &
|
||||
jibo-tts-service -c /etc/jibo/jibo-tts-service.json >/tmp/jibo-tts-service.log 2>&1 &
|
||||
|
||||
#echo "All services are a go."
|
||||
|
||||
# Enable the robot to network to more than local host
|
||||
# (example use git, or npm, and just hit remote endpoints in general)
|
||||
# route add default gw 192.168.1.1 wlp1s0 >/dev/null 2>&1
|
||||
# echo "nameserver 192.168.1.1" > /tmp/resolv.conf 2>/dev/null
|
||||
|
||||
# Give the above command some time to take effect/finish
|
||||
sleep 1
|
||||
57
node_modules/jibo-tools/bin/window-manager.js
generated
vendored
Normal file
57
node_modules/jibo-tools/bin/window-manager.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Simpler version of jibo-wm that does not have any dependencies and is the entry point for electron
|
||||
* and launches the provided skill's index.html that is passed as the first parameter.
|
||||
*/
|
||||
|
||||
// Early out of the process if no skill path argument was provided
|
||||
var skillPath = process.argv[3];
|
||||
var token = null;
|
||||
if(process.argv.length > 4) {
|
||||
token = process.argv[4];
|
||||
}
|
||||
|
||||
if(!skillPath){
|
||||
console.log('skill path argument must be provided');
|
||||
process.exit();
|
||||
}
|
||||
|
||||
var app = require('app'),
|
||||
BrowserWindow = require('browser-window'),
|
||||
Menu = require('menu'),
|
||||
path = require('path'),
|
||||
ipc = require('ipc'),
|
||||
mainWindow = null;
|
||||
|
||||
app.on('window-all-closed', function () {
|
||||
if (process.platform != 'darwin')
|
||||
app.quit();
|
||||
});
|
||||
|
||||
function loadSkill(registryHost) {
|
||||
var options = {width: 1280, height: 720};
|
||||
options.frame = false
|
||||
mainWindow = new BrowserWindow(options);
|
||||
ipc.on('get-registry-host', function (event, arg) {
|
||||
event.sender.send('set-registry-host', {
|
||||
registryHost: registryHost,
|
||||
token: token
|
||||
});
|
||||
});
|
||||
var indexPath = skillPath;
|
||||
mainWindow.loadUrl('file://' + indexPath);
|
||||
mainWindow.on('closed', function () {
|
||||
mainWindow = null;
|
||||
});
|
||||
}
|
||||
|
||||
//the simulation will return the registry data
|
||||
ipc.on('registry-init', function (event, registryHost) {
|
||||
loadSkill(registryHost);
|
||||
});
|
||||
|
||||
app.on('ready', function () {
|
||||
// Make sure there are no menus
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate([]));
|
||||
|
||||
loadSkill('http://127.0.0.1:8181/registry');
|
||||
});
|
||||
16
node_modules/jibo-tools/bin/xwindows-warmup.sh
generated
vendored
Executable file
16
node_modules/jibo-tools/bin/xwindows-warmup.sh
generated
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Kill any instance(s) of xwindows running
|
||||
kill -9 `ps auxw | egrep "/usr/bin/[s]tartx" | awk '{print $1}'` >/dev/null 2>&1
|
||||
|
||||
# Actually start XWindows (This triggers the initial 4 minute initialization of xwindows)
|
||||
# Afer this has successfully completed launching a skill will not set 4 minute load times
|
||||
# Also time how long it takes
|
||||
echo -n "Warming up X Windows... (Takes approximately 4 minutes, the first time after booting up a robot)"
|
||||
date1=$(date +"%s")
|
||||
startx /bin/echo "done" >/dev/null 2>&1
|
||||
date2=$(date +"%s")
|
||||
diff=$(($date2-$date1))
|
||||
echo
|
||||
echo "Warmup took $(($diff / 60))m$(($diff % 60))s."
|
||||
echo "Warmup complete."
|
||||
6
node_modules/jibo-tools/color.js
generated
vendored
Normal file
6
node_modules/jibo-tools/color.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
var crypto = require('crypto');
|
||||
|
||||
var shasum = crypto.createHash('sha1');
|
||||
shasum.update("bob1");
|
||||
|
||||
console.log(shasum.digest('hex'));
|
||||
26
node_modules/jibo-tools/electron/index.html
generated
vendored
Normal file
26
node_modules/jibo-tools/electron/index.html
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>Jibo Simulator</title>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="../styles/main.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<div id="visualizer"></div>
|
||||
<div id="face"></div>
|
||||
</div>
|
||||
<div id="chat"></div>
|
||||
|
||||
<script>
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.type = 'text/css';
|
||||
link.href = require.resolve('jibo-atom-styles/lib/atom-dark-ui.css');
|
||||
head.appendChild(link);
|
||||
require('../lib/simulator/simulator/main');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
226
node_modules/jibo-tools/electron/main.js
generated
vendored
Normal file
226
node_modules/jibo-tools/electron/main.js
generated
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
var app = require('app'),
|
||||
globalShortcut = require('global-shortcut'),
|
||||
BrowserWindow = require('browser-window'),
|
||||
Menu = require('menu'),
|
||||
mainWindow = null,
|
||||
path = require('path'),
|
||||
ipc = require('ipc'),
|
||||
program = require('commander'),
|
||||
settings = require('../lib/simulator/settings'),
|
||||
devTools = require('../lib/simulator/dev-tools');
|
||||
|
||||
|
||||
program
|
||||
.option('-p, --path <path>', 'The path to the skill')
|
||||
.option('-r, --remote <address>', 'Run this as a remote simulation')
|
||||
.option('-t, --token <token>', 'Run this as a remote simulation')
|
||||
.option('-f, --frameless', 'Run with frameless window (no menu bar)')
|
||||
.parse(process.argv);
|
||||
|
||||
var inRemoteMode = typeof program.remote !== "undefined" && program.remote.length > 0;
|
||||
ipc.on('is-remote-mode', function (event) {
|
||||
event.returnValue = inRemoteMode.toString();
|
||||
});
|
||||
|
||||
if (!program.path) {
|
||||
console.error("You must specify a --path");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Figure out which short cut style we should do based on the current platform
|
||||
var toggleDevToolsShortcutStem = 'Alt+Command+';
|
||||
if (process.platform != 'darwin'){
|
||||
toggleDevToolsShortcutStem = "Shift+Control+"
|
||||
}
|
||||
|
||||
settings.init();
|
||||
|
||||
var windowing = require('../lib/simulator/windowing');
|
||||
|
||||
function shutdown(windowThatClosed){
|
||||
if(mainWindow){
|
||||
if( mainWindow !== windowThatClosed ){
|
||||
mainWindow.close();
|
||||
}
|
||||
mainWindow = null;
|
||||
}
|
||||
|
||||
windowing.shutdown();
|
||||
|
||||
devTools.shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called by the visualizer when running in the simulator. It uses
|
||||
* this to load in the entire simulator module. This way the simulator module doesn't
|
||||
* bloat up the size of the jibo module.
|
||||
*/
|
||||
ipc.on('get-skill-path', function (event) {
|
||||
event.returnValue = program.path;
|
||||
});
|
||||
|
||||
var template = [
|
||||
{
|
||||
label: 'Electron',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Quit',
|
||||
accelerator: 'CommandOrControl+Q',
|
||||
click: function () {
|
||||
app.quit();
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Edit',
|
||||
submenu: [
|
||||
{label: 'Undo', accelerator: 'Command+Z', selector: 'undo:'},
|
||||
{label: 'Redo', accelerator: 'Command+Shift+Z', selector: 'redo:'},
|
||||
{type: 'separator'},
|
||||
{label: 'Cut', accelerator: 'Command+X', selector: 'cut:'},
|
||||
{label: 'Copy', accelerator: 'Command+C', selector: 'copy:'},
|
||||
{label: 'Paste', accelerator: 'Command+V', selector: 'paste:'},
|
||||
{label: 'Select All', accelerator: 'Command+A', selector: 'selectAll:'},
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'View',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Reload',
|
||||
accelerator: 'CommandOrControl+R',
|
||||
click: function () {
|
||||
if (mainWindow) {
|
||||
mainWindow.webContents.send('reload-skill');
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
}
|
||||
]
|
||||
// Defer to the window windowing module to set up it's related menu items
|
||||
.concat(windowing.getMenuItems())
|
||||
.concat([
|
||||
{
|
||||
label: 'Developer',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Developer Tools',
|
||||
accelerator: toggleDevToolsShortcutStem + 'I',
|
||||
click: function () {
|
||||
if(mainWindow){
|
||||
settings.update({
|
||||
isDevToolsOpened: !settings.get('isDevToolsOpened')
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
])
|
||||
}
|
||||
];
|
||||
|
||||
app.on('window-all-closed', function () {
|
||||
if (process.platform != 'darwin'){
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
||||
function loadSkill() {
|
||||
var registryHost = inRemoteMode ? program.remote : undefined;
|
||||
//
|
||||
if(!inRemoteMode){
|
||||
// The simulator window tell us where the registry end point is
|
||||
ipc.on('registry-init', function (event, _registryHost) {
|
||||
registryHost = _registryHost;
|
||||
});
|
||||
}
|
||||
|
||||
// Set the window size taking into consideration retina display type
|
||||
// monitors so that our simulation window is pixel perfect
|
||||
var screen = require('screen'), display;
|
||||
// Try to guess which screen the window will end up so that we can
|
||||
// factor in the display's scaleFactor
|
||||
try{
|
||||
display = screen.getDisplayMatching({
|
||||
x: settings.get('windowX'),
|
||||
y: settings.get('windowY'),
|
||||
width: settings.get('contentWidth'),
|
||||
height: settings.get('contentHeight')
|
||||
});
|
||||
} catch(error){
|
||||
display = screen.getDisplayMatching({
|
||||
x: 100, //settings.get('windowX'),
|
||||
y: 100, //settings.get('windowY'),
|
||||
width: 1000, //settings.get('contentWidth'),
|
||||
height: 1000 // settings.get('contentHeight')
|
||||
});
|
||||
};
|
||||
|
||||
// Force 2d mode if running remote mode
|
||||
if(inRemoteMode){
|
||||
settings.update({
|
||||
viewMode: '2d'
|
||||
});
|
||||
}
|
||||
var options = {
|
||||
//"zoom-factor": windowing.getInitialZoomFactor()
|
||||
};
|
||||
|
||||
if( settings.get('fullscreen') ){
|
||||
options.fullscreen = true;
|
||||
} else {
|
||||
// This ensures the width/height of the body are actually what we set
|
||||
// and unaffected by os specific window framing elements
|
||||
options["use-content-size"] = true;
|
||||
options.x = settings.get('windowX');
|
||||
options.y = settings.get('windowY');
|
||||
options.width = settings.get('contentWidth') / display.scaleFactor;
|
||||
options.height = settings.get('contentHeight') / display.scaleFactor;
|
||||
}
|
||||
|
||||
mainWindow = new BrowserWindow(options);
|
||||
|
||||
devTools.init(mainWindow);
|
||||
|
||||
// Add an unlisted shortcut for opening/closing the dev tools of the visualizer itself
|
||||
globalShortcut.register(toggleDevToolsShortcutStem + 'J', function(){
|
||||
if(mainWindow){
|
||||
mainWindow.webContents.toggleDevTools();
|
||||
}
|
||||
});
|
||||
|
||||
windowing.setWindow(mainWindow);
|
||||
|
||||
settings.setWindow(mainWindow);
|
||||
|
||||
ipc.on('get-registry-host', function (event, arg) {
|
||||
event.sender.send('set-registry-host', {
|
||||
registryHost: registryHost,
|
||||
token: program.token
|
||||
});
|
||||
});
|
||||
|
||||
var indexPath = program.path;
|
||||
|
||||
// Make sure the working directory is the root directory of the skill
|
||||
process.chdir(path.dirname(indexPath));
|
||||
|
||||
// Load the visualizer web app which will itself load the skill's index.html
|
||||
mainWindow.loadUrl('file://' + path.resolve(__dirname, "index.html") );
|
||||
|
||||
mainWindow.on('closed', function () {
|
||||
shutdown(mainWindow);
|
||||
});
|
||||
}
|
||||
|
||||
app.on('ready', function () {
|
||||
// Set the context menu
|
||||
var menu = Menu.buildFromTemplate(template);
|
||||
Menu.setApplicationMenu(menu);
|
||||
|
||||
loadSkill();
|
||||
});
|
||||
6
node_modules/jibo-tools/electron/package.json
generated
vendored
Normal file
6
node_modules/jibo-tools/electron/package.json
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "jibo-simulator",
|
||||
"version": "0.5.0",
|
||||
"description": "",
|
||||
"main": "main.js"
|
||||
}
|
||||
BIN
node_modules/jibo-tools/images/loader.gif
generated
vendored
Normal file
BIN
node_modules/jibo-tools/images/loader.gif
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 95 KiB |
1
node_modules/jibo-tools/lib/get-electron-path.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/get-electron-path.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(){var e=require("path"),r=require("os"),t=r.platform(),n={darwin:"dist/Electron.app/Contents/MacOS/Electron",freebsd:"dist/electron",linux:"dist/electron",win32:"dist/electron.exe"},i=e.resolve(e.dirname(require.resolve("electron-prebuilt")),n[t]);return i}module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/jibo-tools.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/jibo-tools.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var r=function(r){return r&&r.__esModule?r["default"]:r},e=r(require("./package-generator/package-generator")),o=r(require("./launcher/launcher")),t=r(require("./robots/ssh")),s=r(require("./robots/sync")),u=r(require("./robots/run")),i=r(require("./robots/debug")),a=r(require("./robots/stop")),b=r(require("./robots/robots")),n=r(require("./robots/networks")),l=r(require("./robots/disk-space")),q=r(require("./robots/build-version")),c=r(require("./robots/volume")),p=r(require("./robots/startup")),d=r(require("./robots/reboot")),g=r(require("./robots/poweroff")),h=r(require("./robots/validate-skill-path")),k=r(require("./get-electron-path"));module.exports={packageGenerator:e,launcher:o,ssh:t,sync:s,run:u,debug:i,stop:a,robots:b,networks:n,diskSpace:l,buildVersion:q,volume:c,startup:p,reboot:d,poweroff:g,validateSkillPath:h,getElectronPath:k};
|
||||
1
node_modules/jibo-tools/lib/launcher/launcher.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/launcher/launcher.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=function(){function e(e,t){for(var i in t){var r=t[i];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(e,t)}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),i=function h(e,t,i){var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:h(o,t,i)}if("value"in r&&r.writable)return r.value;var n=r.get;if(void 0!==n)return n.call(i)},r=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},o=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=require("child_process").spawn,s=e(require("../get-electron-path")),l=e(require("path")),c=require("events").EventEmitter,u=e(require("lodash")),a=function(e){function c(){o(this,c),i(Object.getPrototypeOf(c.prototype),"constructor",this).call(this),this.child=void 0,this.onChildExitBinded=this.onChildExit.bind(this)}return r(c,e),t(c,{onChildExit:{value:function(){this.child.removeAllListeners(),this.child=void 0,this.emit("exit")}},play:{value:function(e,t){var i=void 0===arguments[2]?"0123456789abcdefg":arguments[2];if(console.log("indexPath",e),console.log("remoteRegistry",t),!this.child){var r=l.resolve(__dirname,"..","..","electron"),o=[l.resolve(r,"main.js"),"--path",e,"--token",i];t&&t.length>0&&o.push("--remote",t);var c={ATOM_SHELL_INTERNAL_RUN_AS_NODE:"0"};process.env.hasOwnProperty("NODE_PATH_SIM")&&(process.env.hasOwnProperty("NODE_PATH")?c.NODE_PATH=process.env.NODE_PATH+":"+process.env.NODE_PATH_SIM:c.NODE_PATH=process.env.NODE_PATH_SIM),this.child=n(s(),o,{cwd:r,env:u.assign({},process.env,c),stdio:"inherit"}),this.emit("start"),this.child.on("exit",this.onChildExit.bind(this))}}},stop:{value:function(){this.child&&(console.log("STOP"),this.child.on("error",function(e){console.log(e)}),this.child.kill())}}}),c}(c);module.exports=new a;
|
||||
1
node_modules/jibo-tools/lib/package-generator/package-generator.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/package-generator/package-generator.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e,r){var n;return n=/__(?:(package-name)|([pP]ackageName)|(package_name))__/g,e.replace(n,r)}function r(e,r){var n;return n=/__(?:(display-name))__/g,e.replace(n,r)}function n(e){return e=e.replace(/-+|_+/g," "),e=e.replace(/\s+/g," ").trim(),e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})}function a(e,r){var a;return a=/__(?:(skill-page-title))__/g,e.replace(a,n(r))}var t=function(e){return e&&e.__esModule?e["default"]:e},c=t(require("fs-plus")),i=t(require("path")),l=t(require("wrench")),s=t(require("npm"));module.exports=function(n,t,u,o,p){var m,_,g,d,y,S,f,h,v,k=i.resolve(__dirname,"../../templates",n);try{c.statSync(k)}catch(b){p("Template type "+n+" does not exist")}for(null===u&&(u=i.basename(t)),c.makeTreeSync(t),y=l.readdirSyncRecursive(k),f=[],g=0,d=y.length;d>g;g++)m=y[g],v=i.resolve(k,m),S=v.replace(k,""),S=S.replace(/^\//,""),S=S.replace(/\.template$/,""),h=i.join(t,S),c.existsSync(h)||(c.isDirectorySync(v)?f.push(c.makeTreeSync(h)):c.isFileSync(v)?(c.makeTreeSync(i.dirname(h)),_=c.readFileSync(v),"package.json"===i.basename(v)?(_=e(_.toString(),u),_=r(_.toString(),o)):"index.html"===i.basename(v)&&(_=a(_.toString(),u)),f.push(c.writeFileSync(h,_))):f.push(void 0));s.load(function(){s.commands.install(t,[],function(e){p(e?"Error during npm install: "+e:null)})})};
|
||||
1
node_modules/jibo-tools/lib/robots/build-version.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/build-version.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function o(o,i){e("ssh root@"+o.ip+' "jibo-version"',function(o,e){return o?void i(o):void i(null,e)})}var e=require("child_process").exec;module.exports=o;
|
||||
1
node_modules/jibo-tools/lib/robots/config.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/config.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=function(){function e(e,t){for(var r in t){var n=t[r];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(e,t)}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),r=function g(e,t,r){var n=Object.getOwnPropertyDescriptor(e,t);if(void 0===n){var o=Object.getPrototypeOf(e);return null===o?void 0:g(o,t,r)}if("value"in n&&n.writable)return n.value;var i=n.get;if(void 0!==i)return i.call(r)},n=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},o=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=e(require("fs")),u=e(require("path")),s=require("events").EventEmitter,a=e(require("ensureDir")),l=e(require("osenv")),f=u.resolve(l.home(),".jibo/cli.json"),c=function(e){function s(){o(this,s),r(Object.getPrototypeOf(s.prototype),"constructor",this).call(this),this.settings={}}return n(s,e),t(s,{load:{value:function(e){var t=this;i.readFile(f,function(r,n){if(r)return t.settings={},void e(null);try{var o=JSON.parse(n);t.settings=o}catch(i){console.log("parse error"),console.log(i),e(i)}e(null)})}},save:{value:function(e){var t=this;a(u.dirname(f),null,function(){i.writeFile(f,JSON.stringify(t.settings,null," "),function(t){e(t)})})}},get:{value:function(){if(0===arguments.length)return this.settings;for(var e=this.settings,t=0;t<arguments.length;t++){if("undefined"==typeof e[arguments[t]])return;e=e[arguments[t]]}return e}},set:{value:function(e){if(0===arguments.length)throw new Error("No value was provided to Config.set()");1===arguments.length&&(this.settings=e);for(var t=this.settings,r=0;r<arguments.length-2;r++)console.log("path "+arguments[r]),("undefined"==typeof t[arguments[r]]||Array.isArray(t[arguments[r]]))&&(t[arguments[r]]={}),t=t[arguments[r]];t[arguments[arguments.length-2]]=arguments[arguments.length-1]}}}),s}(s);module.exports=c;
|
||||
1
node_modules/jibo-tools/lib/robots/debug.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/debug.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function r(r,e,c,l){o(r,e,function(e,o){return e?void c(e):void i("9222:localhost:9222",function(e){if(e)return void c(e);var l=t("sh",["-c","ssh -f -N -L 9222:localhost:9222 root@"+r.ip]);l.stdout.on("data",function(r){process.stdout.write(r)}),l.on("exit",function(){n("http://localhost:9222/json",function(r,e,n){if(r||200!=e.statusCode)return void c(new Error("Couldn't fetch debugger apps list: "+r));try{!function(){var r=JSON.parse(n);i("debugger-app",function(e){if(e)return void c(e);var n=u.resolve(__dirname,"./debugger-app.js"),i=""+s()+" "+n+" http://localhost:9222"+r[0].devtoolsFrontendUrl+" &",l=t("sh",["-c",""+i]);l.unref(),c(null,o)})}()}catch(l){return void c(l)}})})})},l)}var e=function(r){return r&&r.__esModule?r["default"]:r},t=require("child_process").spawn,o=e(require("./run")),n=e(require("request")),u=e(require("path")),i=e(require("./kill-process")),s=e(require("../get-electron-path"));module.exports=r;
|
||||
1
node_modules/jibo-tools/lib/robots/debugger-app.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/debugger-app.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(){var e;try{e=JSON.parse(r.readFileSync(d,"utf8"))}catch(t){}return"undefined"!=typeof e&&"undefined"!=typeof e.bounds?e.bounds:{width:1024,height:768}}function t(){var e={bounds:c.getBounds()};r.writeFileSync(d,JSON.stringify(e))}var o=require("app"),n=require("menu"),a=require("browser-window"),l=require("path"),r=require("fs"),d=l.join(o.getDataPath(),"debugger-config.json"),i=process.argv[2],u=[{label:"Electron",submenu:[{label:"Quit",accelerator:"Command+Q",click:function(){o.quit()}}]},{label:"View",submenu:[{label:"Reload",accelerator:"Command+R",click:function(){c&&c.reloadIgnoringCache()}}]},{label:"Edit",submenu:[{label:"Undo",accelerator:"Command+Z",selector:"undo:"},{label:"Redo",accelerator:"Command+Shift+Z",selector:"redo:"},{type:"separator"},{label:"Cut",accelerator:"Command+X",selector:"cut:"},{label:"Copy",accelerator:"Command+C",selector:"copy:"},{label:"Paste",accelerator:"Command+V",selector:"paste:"},{label:"Select All",accelerator:"Command+A",selector:"selectAll:"}]}],c=null;o.on("window-all-closed",function(){"darwin"!=process.platform&&o.quit()}),o.on("ready",function(){n.setApplicationMenu(n.buildFromTemplate(u));var o=e();c=new a(o),c.loadUrl(i),c.on("closed",function(){t(c),c=null});var l={x:c.getBounds().x,y:c.getBounds().y,width:c.getBounds().width,height:c.getBounds().height};setInterval(function(){(l.x!==c.getBounds().x||l.y!==c.getBounds().y||l.width!==c.getBounds().width||l.height!==c.getBounds().height)&&(t(),l={x:c.getBounds().x,y:c.getBounds().y,width:c.getBounds().width,height:c.getBounds().height})},500)});
|
||||
1
node_modules/jibo-tools/lib/robots/disk-space.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/disk-space.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function s(s,n){i("ssh root@"+s.ip+' "df -h"',function(o,e){return o?void n(o):(e=e.split("\n").slice(0,2).join("\n"),void i("ssh root@"+s.ip+' "cd /jibo/skills; du -hs *|sort -nr"',function(s,i){return s?void n(s):void n(null,"System Diskspace:\n\n"+e+"\n\nSkill Diskspace Usage:\n\n"+i)}))})}var i=require("child_process").exec;module.exports=s;
|
||||
2
node_modules/jibo-tools/lib/robots/index-robot-via-motion-service.js
generated
vendored
Executable file
2
node_modules/jibo-tools/lib/robots/index-robot-via-motion-service.js
generated
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";var o=require("ws"),e=[{position:0,velocity:0,enabled:!0},{position:0,velocity:0,enabled:!0},{position:0,velocity:0,enabled:!0}],n={start:function(n){var t=n+":9191",i=new o("ws://"+t);i.on("open",function(){try{i.send(JSON.stringify(e)),setInterval(function(){process.exit()},1e3)}catch(o){console.log("Error sending to motion service: "+o),process.exit(1)}}),i.on("error",function(){console.log("Couldn't connect to motion service"),process.exit(1)})}};n.start(process.argv[2]);
|
||||
2
node_modules/jibo-tools/lib/robots/index-robot.js
generated
vendored
Executable file
2
node_modules/jibo-tools/lib/robots/index-robot.js
generated
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";var t=require("ws"),s={start:function(t,s){this.state=null,this.indexed=!1,this.holdOffOnLogging=!0,this._start(t,s)},_start:function(t,s){var e=this,o=t+":8282";try{this.indexed=!1,this.state_socket=this._setupStateSocket(o),this.state_socket.on("close",function(){e.state_socket=null}),this.state_socket.on("error",function(){console.log("Couldn't connect to body service's state websocket"),process.exit(1)}),this.command_socket=this._setupCommandSocket(o),this.command_socket.on("close",function(){e.command_socket=null}),this.command_socket.on("error",function(){console.log("Couldn't connect to body service's command websocket"),process.exit(1)})}catch(n){console.log("ERROROROROR: "+n)}setTimeout(function(){e.holdOffOnLogging=!1,e.indexed?(console.log("\nJibo was already indexed."),e._shutdown(s)):(process.stdout.write("Indexing Jibo. Hold onto your bot, he's going to be spinning..."),e._startSpinningJibo(e.command_socket),e.indexCheckInterval=setInterval(function(){e.indexed&&(console.log("Finished."),e._shutdown(s))},100))},500)},_shutdown:function(t){process.exit(),t()},_setupStateSocket:function(s){var e=this,o=new t("ws://"+s+"/axis_state");return o.on("open",function(){}),o.on("message",function(t){var s,o=JSON.parse(t);e.state=o,null===e.state_socket,s="pelvis "+e._statusToStr(o.pelvis.status),s+=" - ",s+="torso "+e._statusToStr(o.torso.status),s+=" - ",s+="neck "+e._statusToStr(o.neck.status),e.holdOffOnLogging===!1&&process.stdout.write("."),1&o.pelvis.status&&1&o.torso.status&&1&o.neck.status&&(e.indexed=!0)}),o},_setupCommandSocket:function(s){var e=new t("ws://"+s+"/axis_command");return e.on("open",function(){}),e.on("message",function(t){console.log("Got command message: "+t.data)}),e},_startSpinningJibo:function(s){var e=this;this.spinInterval=setInterval(function(){s.readyState!=t.OPEN&&console.log("error: socket.readyState",s.readyState);var o=e._buildCmd();o&&s.send(o)},50)},_buildCmd:function(){if(null===this.state)return null;var t={mode:4,value:[-1],vel_limit:this.state.pelvis.vel_limit,acc_limit:50,cur_limit:this.state.pelvis.cur_limit},s={mode:4,value:[-1],vel_limit:this.state.torso.vel_limit,acc_limit:50,cur_limit:this.state.torso.cur_limit},e={mode:4,value:[-1],vel_limit:this.state.neck.vel_limit,acc_limit:50,cur_limit:this.state.neck.cur_limit},o={ts:[this.state.ts[0],this.state.ts[1]],pelvis:t,torso:s,neck:e};return JSON.stringify(o)},_statusToStr:function(t){if(0===t)return"none";var s="";return 1&t&&(s+="INDEXED "),2&t&&(s+="ENABLED "),4&t&&(s+="BRAKED "),8&t&&(s+="MOVING "),16&t&&(s+="STALLED "),32&t&&(s+="TIMEOUT "),64&t&&(s+="FAULT "),128&t&&(s+="ABS_INDEXED "),s}};s.start(process.argv[2]);
|
||||
1
node_modules/jibo-tools/lib/robots/kill-process.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/kill-process.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e,r){n("ps -e",function(t,u){if(t)return void r(t);var o=i.filter(u.split("\n"),function(r){return-1!==r.search(e)});o=i.map(o,function(e){return/\d{1,}/.exec(e)[0]});var c="kill "+o.join(" ")+" || :";n(c,function(e){return e?void r(e):void r()})})}var r=function(e){return e&&e.__esModule?e["default"]:e},n=require("child_process").exec,i=r(require("lodash"));module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/robots/led.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/led.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function o(o,n){return i?void process.nextTick(n):(i=new t("ws://"+o.ip+":8282/led_command"),i.onopen=function(){n()},void(i.onerror=function(){n(new Error("Couldn't open websocket to robot for LED manipulation"))}))}function n(o,n,t,e,u,s){var c=JSON.stringify({ts:[0,0],rate_limit:[Math.abs((n-r[0])/u*100),Math.abs((t-r[1])/u*100),Math.abs((e-r[2])/u*100)],color:[n,t,e]});i.send(c),r[0]=n,r[1]=t,r[2]=e,setTimeout(function(){s()},1e3*u)}var t=require("ws"),i=void 0,r=[0,0,0],e={pulse:function(t,i,r,e,u,s){o(t,function(o){return o?void s(o):void n(t,i,r,e,u,function(o){return o?void s(o):void n(t,0,0,0,u,function(o){return o?void s(o):void s()})})})}};module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/robots/networks.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/networks.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},e=require("child_process").spawn,o=t(require("./led")),n={getNetworkName:function(t){process.nextTick(t,null,"")},isRobotReachable:function(t,n){this.getNetworkName(function(r){if(r)return void n(r);var i=e("ping",["-t 10",t.ip],["pipe"]),s="";i.stderr.on("data",function(t){s+=t.toString(),(-1!==s.search("No route to host")||-1!==s.search("Host is down"))&&(n(null,!1),i.kill("SIGHUP"))});var u="";i.stdout.on("data",function(e){if(u+=e.toString(),-1!==u.search("bytes from")){i.kill("SIGHUP");var r=1/8;o.pulse(t,105/255*r,210/255*r,231/255*r,.125,function(){n(null,!0)})}})})}};module.exports=n;
|
||||
1
node_modules/jibo-tools/lib/robots/poweroff.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/poweroff.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function o(o,r){e("ssh root@"+o.ip+' "poweroff"',function(o){return o?void r(o):void r(null)})}var e=require("child_process").exec;module.exports=o;
|
||||
1
node_modules/jibo-tools/lib/robots/reboot.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/reboot.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function o(o,r){e("ssh root@"+o.ip+' "reboot"',function(o){return o?void r(o):void r(null)})}var e=require("child_process").exec;module.exports=o;
|
||||
1
node_modules/jibo-tools/lib/robots/robots.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/robots.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function t(t){var e=new r;e.load(function(o){return o?void t(o):void t(null,e)})}function e(){return!0}var o=function(t){return t&&t.__esModule?t["default"]:t},r=o(require("./config")),n=o(require("lodash")),i={list:function(e){t(function(t,o){if(t)return void e(t);var r=o.get("robots");return Array.isArray(r)?void e(null,r):void e(null,[])})},add:function(o,r,i,u){t(function(t,a){if(t)return void u(t);if(0===o.length)return void u(new Error("Robot's name must be at least one character long"));if(e(r)===!1)return void u(new Error("IP address is not a valid ("+r+")"));if(0===i.length)return void u(new Error("Network name must be at least one character long"));var s=a.get("robots");return("undefined"==typeof s||Array.isArray(s)===!1)&&(s=[]),-1!==n.findIndex(s,function(t){return t.name===o})?void u(new Error("A robot with the name "+o+" already exists. Delete it first if you want to update it's information ")):(s.push({name:o,ip:r,network:i}),s.sort(function(t,e){return t>e}),a.set("robots",s),1===s.length&&a.set("defaultRobot",o),void a.save(function(t){u(t)}))})},remove:function(e,o){console.log(""),t(function(t,r){if(t)return void o(t);if(0===e.length)return void o(new Error("Robot's name must be at least one character long"));var i=r.get("robots");if("undefined"==typeof i||Array.isArray(i)===!1)return void o(new Error("There are no robots to delete"));var u=n.findIndex(i,function(t){return t.name===e});return-1===u?void o(new Error("No robot with the name "+e+" exists.")):(n.pullAt(i,u),r.set("robots",i),r.get("defaultRobot")===e&&r.set("defaultRobot",void 0),void r.save(function(t){o(t)}))})},setDefault:function(e,o){t(function(t,r){if(t)return void o(t);if(0===e.length)return void o(new Error("Robot's name must be at least one character long"));var i=r.get("robots");return Array.isArray(i)===!1||-1===n.findIndex(i,function(t){return t.name===e})?void o(new Error(""+e+" doesn't exist in the list of robots. Run to 'jibo robot-list' to see the list of robots")):(r.set("defaultRobot",e),void r.save(function(t){o(t)}))})},getDefault:function(e){t(function(t,o){if(t)return void e(t);var r=o.get("defaultRobot");return"undefined"==typeof r?void e(null,null):void e(null,r)})},getInfo:function(t,e){return 0===t.length?void e(new Error("Robot's name must be at least one character long")):void this.list(function(o,r){if(o)return void e(o);var i=n.findIndex(r,function(e){return e.name===t});return-1===i?void e(new Error("No robot by the name "+t+" exists in the robot list")):void e(null,r[i])})}};module.exports=i;
|
||||
1
node_modules/jibo-tools/lib/robots/run.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/run.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function r(r,e,n,i){o(r,function(o){if(o)return void n(o);var s="cd /jibo/skills/"+e+"/;(killall -SIGQUIT /opt/electron/electron;true) >/dev/null 2>&1;LD_LIBRARY_PATH=/usr/lib/tegra:/usr/lib/tegra-egl startx /opt/electron/electron --remote-debugging-port=9222 /jibo/sdk/bin/window-manager.js "+("/jibo/skills/"+e+"/index.html -- -nocursor"),l=t("sh",["-c","ssh root@"+r.ip+' "'+s+'"']);l.stdout.on("data",function(){l.kill("SIGHUP")}),l.stderr.on("data",function(r){return i===!0&&process.stderr.write(r),-1!==r.toString().search("Renderer process started")?void l.kill("SIGHUP"):void 0}),l.on("exit",function(){n(null,e)})})}var e=function(r){return r&&r.__esModule?r["default"]:r},t=require("child_process").spawn,o=e(require("./sync-bin-scripts"));module.exports=r;
|
||||
1
node_modules/jibo-tools/lib/robots/services.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/services.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var r=require("child_process").exec,e={list:function(e){r("/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'",function(r,i){if(r)return void e(r);var t=i.trim();e(null,t)})},debug:function(){}};module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/robots/ssh.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/ssh.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},r=require("child_process"),i=r.spawn,o=r.exec,n=e(require("fs")),s=e(require("path")),t=e(require("osenv")),u={run:function(e,r){var o=i("sh",["-c","ssh root@"+e.ip],{stdio:"inherit"});o.on("exit",function(){r(null)})},addKey:function(e,r){var i=s.resolve(t.home(),".ssh/id_rsa.pub");n.readFile(i,"utf8",function(n,s){return n?-2===n.errno?void r(new Error("There isn't a public key at the expected location: '"+i+"'")):void r(n):void o("ssh root@"+e.ip+' "cat .ssh/authorized_keys"',function(i,n){if(i){if(-1===i.toString().indexOf("can't open '.ssh/authorized_keys'"))return void r(i)}else if(-1!==n.indexOf(s))return void r(new Error("Your ssh key was already added"));o("cat ~/.ssh/id_rsa.pub | ssh root@"+e.ip+' "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"',function(e){return e?void r(e):void r(null)})})})},tunnel:function(){}};module.exports=u;
|
||||
1
node_modules/jibo-tools/lib/robots/startup.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/startup.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function r(r,e){t(r,function(t){if(t)return void e(t);var n=i("sh",["-c","ssh root@"+r.ip+' "source /etc/profile; [ ! -e /etc/init.d/S85jibo-motion-service ] || /etc/init.d/S85jibo-motion-service stop || true ;"'],{stdio:"inherit"});n.on("exit",function(t){if(0!==t)return void e(new Error("stop-motion-service script exited with an error code: "+t));var n=o.resolve(__dirname,"./index-robot.js"),s=i(n,[r.ip],{stdio:"inherit"});s.on("exit",function(o){if(0!==o)return void e(new Error("There was an error trying to index the robot"));var t=i("sh",["-c","ssh root@"+r.ip+' "(killall /opt/electron/electron;true) >/dev/null 2>&1; source /etc/profile; /jibo/sdk/bin/xwindows-warmup.sh"'],{stdio:"inherit"});t.on("exit",function(r){return 0!==r?void e(new Error("xwindows-warmup.sh script exited with an error code: "+r)):void e(null)})})})})}var e=function(r){return r&&r.__esModule?r["default"]:r},i=require("child_process").spawn,o=e(require("path")),t=e(require("./sync-bin-scripts"));module.exports=r;
|
||||
1
node_modules/jibo-tools/lib/robots/stop.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/stop.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e,r){o("debugger-bootstrap",function(o){if(o)return void r(o);var i=t("sh",["-c","ssh root@"+e.ip+' "(killall -SIGQUIT /opt/electron/electron;true)"'],{stdio:"inherit"});i.on("exit",function(){r(null)})})}var r=function(e){return e&&e.__esModule?e["default"]:e},t=require("child_process").spawn,o=r(require("./kill-process"));module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/robots/sync-bin-scripts.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/sync-bin-scripts.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e,r){var n=o.resolve(__dirname,"../../bin"),t="ssh root@"+e.ip+' "mkdir -p /jibo/sdk/bin"; '+("rsync -av --delete "+n+" root@"+e.ip+":/jibo/sdk/");i(t,function(e){return e?void r(e):void r(null)})}var r=function(e){return e&&e.__esModule?e["default"]:e},i=require("child_process").exec,o=r(require("path"));module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/robots/sync.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/sync.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e,i,o){r(i,function(i,r,u){return i?void o(i):void s("ssh root@"+e.ip+' "mkdir -p /jibo/skills/'+u+'"',function(i){if(i)return void o(i);var s=t("sh",["-c","rsync -av -L -p --delete --force --exclude='.git/' --exclude='*/node_modules/jibo-gulp/' "+r+"/ root@"+e.ip+":/jibo/skills/"+u+"/"]),n=0;s.stdout.on("data",function(e){process.stdout.write(e),n++}),s.on("exit",function(){o(null,r,"/jibo/skills/"+u,n)})})})}var i=function(e){return e&&e.__esModule?e["default"]:e},o=require("child_process"),t=o.spawn,s=o.exec,r=i(require("./validate-skill-path"));module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/robots/validate-skill-path.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/validate-skill-path.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function r(r){return"string"==typeof r?n.resolve(process.cwd(),r):process.cwd()}function e(e,o){e=r(e),t.lstat(e,function(r,i){return r?-2===r.errno?void o(new Error("No folder exists at "+e)):void o(r):i.isDirectory()===!1?void o(new Error(""+e+" is a file not a directory")):void t.readFile(n.resolve(e,"package.json"),"utf8",function(r,n){if(r)return-2===r.errno?void o(new Error("No 'package.json' exists at "+e+"/package.json")):void o(r);var t=void 0;try{t=JSON.parse(n)}catch(i){return void o(new Error("Error parsing skill's 'package.json' at "+e+"/package.json"))}if("string"!=typeof t.name&&0!==t.name.length)return void o(new Error('Skill hasn\'t properly set the "name" field in '+e+"/package.json"));var a=t.name;o(null,e,a)})})}var o=function(r){return r&&r.__esModule?r["default"]:r},n=o(require("path")),t=o(require("fs"));module.exports=e;
|
||||
1
node_modules/jibo-tools/lib/robots/volume.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/robots/volume.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=require("child_process").exec,r={get:function(r,n){e("ssh root@"+r.ip+' "amixer -c 1 cget numid=2"',function(e,r){if(e)return void n(e);var u=/values=(\d{1,3}),(\d{1,3})/g.exec(r);return 3!==u.length||Number.isNaN(parseInt(u[1]))===!0||Number.isNaN(parseInt(u[2]))===!0?void n(new Error("Could not parse the internal get volume command's output (we use an amixer command). Should have included \"values=<number>,<number>\". It's output was\n\n"+r)):void n(null,u[2])})},set:function(r,n,u){var t=parseInt(n);return Number.isNaN(parseInt(t))?void u(new Error("Volume wasn't a number. Was "+n)):0>t||t>175?void u(new Error("Volume must be in the range [0-175]. Was "+t)):void e("ssh root@"+r.ip+' "amixer -c 1 cset numid=2 '+t+'"',function(e){return e?void u(e):void u(null)})}};module.exports=r;
|
||||
1
node_modules/jibo-tools/lib/simulator/dev-tools.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/dev-tools.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var n=function(n){return n&&n.__esModule?n["default"]:n},e=n(require("./settings")),o={init:function(n){var o=this;this.mainWindow=n,e.get("isSimulatorDevToolsOpened")&&this.mainWindow.webContents.openDevTools(),this.devToolsWindowDimensionChangesInterval=setInterval(function(){o.mainWindow.webContents.devToolsWebContents},200),this.mainWindow.webContents.on("devtools-opened",function(){if(e.update({isSimulatorDevToolsOpened:!0}),o.mainWindow.webContents.devToolsWebContents){var t=n.webContents.devToolsWebContents.getOwnerBrowserWindow();t.setPosition(e.get("devToolsWindowX"),e.get("devToolsWindowY"))}}),this.mainWindow.webContents.on("devtools-closed",function(){e.update({isSimulatorDevToolsOpened:!1})})},shutdown:function(){this.devToolsWindowDimensionChangesInterval&&(clearInterval(this.devToolsWindowDimensionChangesInterval),this.devToolsWindowDimensionChangesInterval=null)}};module.exports=o;
|
||||
1
node_modules/jibo-tools/lib/simulator/elements/custom-elements.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/elements/custom-elements.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var t=function(){function t(t,e){for(var n in e){var r=e[n];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(t,e)}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),e=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)},n=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r=require("react/lib/ReactInjection"),o={isCustomAttribute:function(t){return-1!==["mini"].indexOf(t)},Properties:{mini:null},DOMAttributeNames:{},DOMPropertyNames:{}};r.DOMProperty.injectDOMPropertyConfig(o);var i=function(r){function o(){n(this,o),null!=r&&r.apply(this,arguments)}return e(o,r),t(o,{createdCallback:{value:function(){this.classList.add("editor","editor-colors"),this.setAttribute("tabindex",-1),this.addEventListener("focus",this.focused.bind(this)),this.addEventListener("blur",this.blurred.bind(this))}},attachedCallback:{value:function(){console.log("atom-text-editor attached")}},detachedCallback:{value:function(){console.log("atom-text-editor detached")}},focused:{value:function(){}},blurred:{value:function(){}}}),o}(HTMLElement);document.registerElement("atom-workspace"),document.registerElement("atom-panel"),document.registerElement("atom-pane-container"),document.registerElement("atom-text-editor",{prototype:i.prototype});
|
||||
1
node_modules/jibo-tools/lib/simulator/react-components/tab-bar.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/react-components/tab-bar.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},e=t(require("react"));module.exports=e.createClass({displayName:"tab-bar",getInitialState:function(){return{activeTab:0}},render:function(){var t=this,a=[];return this.props.tabs.forEach(function(i,s){var c="tab";s===t.state.activeTab&&(c+=" active"),a.push(e.createElement("div",{onClick:t.onClick.bind(t,s,i.callback),className:c},e.createElement("div",{className:"title"},i.label)))}),e.createElement("div",null,e.createElement("div",{className:"tab-bar",style:{width:"100%"}},a))},onClick:function(t,e){this.state.activeTab=t,this.setState(this.state),e()}});
|
||||
1
node_modules/jibo-tools/lib/simulator/services/asr-service.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/asr-service.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/jibo-tools/lib/simulator/services/audio-entity.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/audio-entity.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var i=function(){function i(i,t){for(var n in t){var o=t[n];o.configurable=!0,o.value&&(o.writable=!0)}Object.defineProperties(i,t)}return function(t,n,o){return n&&i(t.prototype,n),o&&i(t,o),t}}(),t=function(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")},n=function(){function n(){t(this,n),this.ts=[0,0],this.type=void 0,this.id=void 0,this.position={x:void 0,y:void 0,z:void 0},this.confidence=void 0}return i(n,{updatePosition:{value:function(i){this.position.x=i.x,this.position.y=i.y,this.position.z=i.z}},updateId:{value:function(i){this.id=i}},updateType:{value:function(i){this.type=i}},updateConfidence:{value:function(i){this.confidence=i}},updateTs:{value:function(i){this.ts=i}}}),n}();module.exports=n;
|
||||
1
node_modules/jibo-tools/lib/simulator/services/entity.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/entity.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var i=function(){function i(i,o){for(var d in o){var t=o[d];t.configurable=!0,t.value&&(t.writable=!0)}Object.defineProperties(i,o)}return function(o,d,t){return d&&i(o.prototype,d),t&&i(o,t),o}}(),o=function(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")},d=0,t=function(){function t(){var i=void 0===arguments[0]?void 0:arguments[0];o(this,t),this.id=i||d++,this.confidence=void 0,this.description=void 0,this.position={x:void 0,y:void 0,z:void 0},this.orientation={x:void 0,y:void 0,z:void 0},this.extent={x:void 0,y:void 0,z:void 0},this["static"]=void 0,this.parts=[{key:void 0,value:{id:void 0,confidence:void 0,visible:void 0,tracker:{position:{x:void 0,y:void 0,z:void 0},rotation:{x:void 0,y:void 0,z:void 0},velocity:{x:void 0,y:void 0,z:void 0},angVelocity:{x:void 0,y:void 0,z:void 0}},extent:{x:void 0,y:void 0,z:void 0},rays:[{origin:{x:0,y:0,z:0},dir:{x:void 0,y:void 0,z:void 0},cameraId:void 0,tag:void 0,timestamp:{time_since_epoch:{count:void 0}}}],trackers:[{id:void 0,cameraId:void 0,confidence:void 0,covariance:{n11:void 0,n12:void 0,n21:void 0,n22:void 0},points:[],rectangle:{left:void 0,top:void 0,right:void 0,bottom:void 0},velocity:{x:void 0,y:void 0},inFOV:void 0,visible:void 0,lastUpdate:{time_since_epoch:{count:void 0}},name:void 0,needModelUpdate:void 0}]}}]}return i(t,{updatePosition:{value:function(i){this.parts[0].value.rays[0].dir.x=i.x,this.parts[0].value.rays[0].dir.y=i.y,this.parts[0].value.rays[0].dir.z=i.z}},updateId:{value:function(i){this.id=i}}}),t}();module.exports=t;
|
||||
1
node_modules/jibo-tools/lib/simulator/services/lps-service.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/lps-service.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},e=function(){function t(t,e){for(var i in e){var n=e[i];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(t,e)}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),i=function l(t,e,i){var n=Object.getOwnPropertyDescriptor(t,e);if(void 0===n){var o=Object.getPrototypeOf(t);return null===o?void 0:l(o,e,i)}if("value"in n&&n.writable)return n.value;var r=n.get;if(void 0!==r)return r.call(i)},n=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)},o=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r=t(require("http")),s=require("websocket").server,a=t(require("./entity")),u=t(require("./audio-entity")),c=t(require("events")),d=function(t){function c(){o(this,c),i(Object.getPrototypeOf(c.prototype),"constructor",this).call(this),this.port=12476,this.cameras=[],this.entities=[],this.audioEntities=[],this.visualState={cameras:this.cameras,entities:this.entities},this.audioState={entities:this.audioEntities},this.connectionHandlers={"/visual_awareness":this.onVisualAwareness.bind(this),"/audible_awareness":this.onAudibleAwareness.bind(this)},this.httpHandlers={"/photo":this.onPhoto.bind(this),"/barcode":this.onBarcode.bind(this)},setInterval(this.update.bind(this),100)}return n(c,t),e(c,{init:{value:function(t){var e=this;this.httpServer=r.createServer(),this.httpServer.on("listening",function(){e.wsServer=new s({httpServer:e.httpServer,autoAcceptConnections:!1}),e.wsServer.on("request",function(t){var i=t.accept(null,t.origin);e.connectionHandlers[t.resource]?e.connectionHandlers[t.resource](i):console.warn("No simulator handler found for",t.resource)}),t()}),this.httpServer.on("request",function(t,i){"POST"===t.method&&(e.httpHandlers[t.url]?e.httpHandlers[t.url](t,i):(i.writeHead(200,{"Content-Type":"text/plain"}),i.end()))}),this.httpServer.listen(this.port)}},onPhoto:{value:function(t,e){e.writeHead(404,{"Content-Type":"text/plain"}),e.end()}},onBarcode:{value:function(t,e){e.writeHead(200,{"Content-Type":"text/plain"}),e.end()}},onVisualAwareness:{value:function(t){this.visualSocket=t}},onAudibleAwareness:{value:function(t){this.audibleSocket=t}},updateTrackingState:{value:function(t){this.visualState=t}},getAudioEntityFromId:{value:function(t){var e=void 0;return this.audioEntities.forEach(function(i){i.id==t&&(e=i)}),e}},getVisualEntityFromId:{value:function(t){var e=void 0;return this.entities.forEach(function(i){i.id==t&&(e=i)}),e}},onAudio:{value:function(t){var e=this.getVisualEntityFromId(t),i=this.getAudioEntityFromId(t);if(i||(i=new u,i.updateId(t),i.updateConfidence(100),i.updatePosition(0,0,0),this.audioEntities.push(i)),e){var n=e.parts[0].value.rays[0].dir;i.updatePosition(n)}this.audioState.entities=this.audioEntities,this.update()}},setTargetId:{value:function(t,e){this.entities.forEach(function(i){i.id===t&&(i.id=e)})}},getEntities:{value:function(){return this.entities}},updateTarget:{value:function(t){var e=this.getVisualEntityFromId(t.id);e||(e=new a(t.id),this.entities.push(e)),e.updatePosition(t),this.update(),this.emit("update",t)}},addEntity:{value:function(){}},update:{value:function(){this.visualSocket&&this.visualSocket.connected&&this.visualSocket.send(JSON.stringify(this.visualState)),this.audibleSocket&&this.audibleSocket.connected&&this.audibleSocket.send(JSON.stringify(this.audioState))}}}),c}(c);module.exports=new d;
|
||||
1
node_modules/jibo-tools/lib/simulator/services/motor-service.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/motor-service.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},e=function(){function t(t,e){for(var i in e){var n=e[i];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(t,e)}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},n=t(require("http")),o=require("animation-utilities"),r=o.Clock,s=o.TrajectoryControllerSim,a=o.PosVelControllerSim,c=require("websocket").server,l=t(require("lodash")),u={ts:[0,0],pos:0,inc_pos:0,vel:0,cur:0,pwm:0,status:1,vel_limit:10,acc_limit:10,cur_limit:10,mode:4,ref:0,ticks:0},d={ts:[0,0],pelvis:Object.assign({},u),torso:Object.assign({},u),neck:Object.assign({},u)},m=l.cloneDeep(d),v=[0,0,0],f=performance.now(),h=function(){function t(e,n,o){i(this,t),this.initialPosition=e,this.velocity=n,(null===o||void 0===o)&&(o=r.currentTime()),this.initialTime=o}return e(t,{getPosition:{value:function(t){(null===t||void 0===t)&&(t=r.currentTime());var e=t.subtract(this.initialTime);return this.initialPosition+this.velocity*e}},getVelocity:{value:function(){return this.velocity}}}),t}(),p={pelvis:new h(0,0),torso:new h(0,0),neck:new h(0,0)},S=function(){function t(){i(this,t),this.port=12475,this.stateSocketList=[],this.commandSocketList=[],this.ledSocketList=[];var e=this,o=this.onAxisCommand.bind(this),r=this.onLEDCommand.bind(this),s=n.createServer(function(t,e){e.writeHead(404),e.end()});s.listen(this.port,function(){}),this.server=new c({httpServer:s,autoAcceptConnections:!1}),this.server.on("request",function(t){var i=t.accept(null,t.origin);"/axis_state"===t.resource?(e.stateSocketList.push(i),e.sendState(),i.on("close",function(){e.stateSocketList.indexOf(i)>-1&&e.stateSocketList.splice(e.stateSocketList.indexOf(i),1)})):"/axis_command"===t.resource?(e.commandSocketList.push(i),i.on("message",o),i.on("close",function(){e.commandSocketList.indexOf(i)>-1&&e.commandSocketList.splice(e.commandSocketList.indexOf(i),1),e.reset()})):"/led_command"===t.resource&&(e.ledSocketList.push(i),i.on("message",r),i.on("close",function(){e.ledSocketList.indexOf(i)>-1&&e.ledSocketList.splice(e.ledSocketList.indexOf(i),1)}))})}return e(t,{init:{value:function(t){t()}},sendState:{value:function(){if(this.stateSocketList.length>0){var t=r.currentTime()._timestamp;m.neck.ts=t,m.torso.ts=t,m.pelvis.ts=t,m.ts=t;try{var e=!0,i=!1,n=void 0;try{for(var o,s=this.stateSocketList[Symbol.iterator]();!(e=(o=s.next()).done);e=!0){var a=o.value;a.connected&&a.send(JSON.stringify(m))}}catch(c){i=!0,n=c}finally{try{!e&&s["return"]&&s["return"]()}finally{if(i)throw n}}}catch(l){}}}},updateState:{value:function(){var t=r.currentTime(),e=performance.now()-f<500,i=!0,n=!1,o=void 0;try{for(var s,a=Object.keys(p)[Symbol.iterator]();!(i=(s=a.next()).done);i=!0){var c=s.value;e?m[c].vel=p[c].getVelocity(t):m[c].vel=0,m[c].pos=p[c].getPosition(t)}}catch(l){n=!0,o=l}finally{try{!i&&a["return"]&&a["return"]()}finally{if(n)throw o}}}},onAxisCommand:{value:function(t){f=performance.now(),t=JSON.parse(t.utf8Data);var e=r.currentTime(),i=!0,n=!1,o=void 0;try{for(var c,l=Object.keys(p)[Symbol.iterator]();!(i=(c=l.next()).done);i=!0){var u=c.value;4===t[u].mode?p[u]=new h(p[u].getPosition(e),t[u].value[0],e):5===t[u].mode?(p[u]=new s(p[u].getPosition(e),p[u].getVelocity(e),e),p[u].updateCommand(t[u].value[1],t[u].value[0],t[u].value[2],t[u].acc_limit,t[u].vel_limit,e)):7===t[u].mode?(p[u]=new a(p[u].getPosition(e),p[u].getVelocity(e),e),p[u].updateCommand(t[u].value[1],t[u].value[0],t[u].acc_limit,t[u].vel_limit,e)):p[u]=new h(p[u].getPosition(e),0,e)}}catch(d){n=!0,o=d}finally{try{!i&&l["return"]&&l["return"]()}finally{if(n)throw o}}this.updateState(),this.sendState()}},onLEDCommand:{value:function(t){t=JSON.parse(t.utf8Data),t.color&&Array.isArray(t.color)&&3===t.color.length&&(v=t.color)}},reset:{value:function(){m=l.cloneDeep(d),p={pelvis:new h(0,0),torso:new h(0,0),neck:new h(0,0)}}},render:{value:function(t){this.updateState(),t.display({topSection_r:m.neck.pos,middleSection_r:m.torso.pos,bottomSection_r:m.pelvis.pos,lightring_redChannelBn_r:v[0],lightring_greenChannelBn_r:v[1],lightring_blueChannelBn_r:v[2]})}}}),t}();module.exports=new S;
|
||||
1
node_modules/jibo-tools/lib/simulator/services/nlu-service.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/nlu-service.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=function(){function e(e,t){for(var r in t){var n=t[r];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(e,t)}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=e(require("http")),s=void 0;try{s=require("jibo-parser")}catch(i){console.warn("Error importing jibo-parser. Simulator will not support robust parsing.")}var a=0,o=function(){function e(){r(this,e),this.port=11231,this.handles={}}return t(e,{init:{value:function(e){var t=this;this.server=n.createServer(),this.server.on("request",function(e,r){"/nlu_interface"===e.url&&"POST"===e.method&&(e.setEncoding("utf8"),e.on("data",function(e){var n=void 0;try{n=JSON.parse(e)}catch(s){return r.writeHead(200,{"Content-Type":"text/html"}),r.write(JSON.stringify({Status:"ERROR",Message:"Inavlid request. Request body is not valid JSON"})),void r.end()}"COMPILE"===n.REQ_TYPE?t.compile(n.REQ_CONTENT.RULE_STRING,r):"PARSE_FROM_URI"===n.REQ_TYPE?t.parseFromUri(n.REQ_CONTENT.URI,n.REQ_CONTENT.TXT_STRING,r):"PARSE_FROM_TEXT"===n.REQ_TYPE&&t.parseFromText(n.REQ_CONTENT.RULE_STRING,n.REQ_CONTENT.TXT_STRING,r)}))}),this.server.on("listening",function(){e()}),this.server.listen(this.port)}},parseFromUri:{value:function(e,t,r){var n={Status:"OK",URI:""},i=this.handles[e];if(i&&s){var a=s.build_sentence_parser(i),o=a.parse_sentence(t);n.Result=JSON.parse(o)}else n.Status="ERROR",n.Message="No handle named '"+e+"' exists";r.writeHead(200,{"Content-Type":"text/html"}),r.write(JSON.stringify(n)),r.end()}},parseFromText:{value:function(e,t,r){var n={Status:"OK"};try{var i=s.compile_fst_from_text(e,"handle:"+a++),o=s.build_sentence_parser(i),u=o.parse_sentence(t);n.Result=JSON.parse(u)}catch(l){n.Status="ERROR",n.Message=l.message}r.writeHead(200,{"Content-Type":"text/html"}),r.write(JSON.stringify(n)),r.end()}},compile:{value:function(e,t){var r={Status:"OK",URI:""};try{var n="handle:"+a++;this.handles[n]=s.compile_fst_from_text(e,n),r.URI=n}catch(i){r.Status="ERROR",r.Message=i.message}t.writeHead(200,{"Content-Type":"text/html"}),t.write(JSON.stringify(r)),t.end()}}}),e}();module.exports=new o;
|
||||
1
node_modules/jibo-tools/lib/simulator/services/registry-service.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/registry-service.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},r=function(){function e(e,r){for(var t in r){var n=r[t];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(e,r)}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),t=function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")},n=e(require("http")),o=e(require("./lps-service")),i=e(require("./nlu-service")),s=e(require("./asr-service")),u=e(require("./tts-service")),a=e(require("./motor-service")),c=8181,p=[{name:"body",host:"127.0.0.1",port:a.port},{name:"lps",host:"127.0.0.1",port:o.port},{name:"nlu",host:"127.0.0.1",port:i.port},{name:"asr",host:"127.0.0.1",port:s.port},{name:"tts",host:"127.0.0.1",port:u.port}],f=function(){function e(){t(this,e)}return r(e,{init:{value:function(e){this.server=n.createServer(),this.server.on("request",function(e,r){"GET"===e.method&&(r.writeHead(200,{"Content-Type":"text/plain"}),r.end(JSON.stringify(p),"utf8"))}),this.server.on("listening",function(){e()}),this.server.listen(c)}}}),e}();module.exports=new f;
|
||||
1
node_modules/jibo-tools/lib/simulator/services/service-initializer.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/service-initializer.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var i=function(i){return i&&i.__esModule?i["default"]:i},e=i(require("./lps-service")),r=i(require("./nlu-service")),n=i(require("./asr-service")),t=i(require("./tts-service")),u=i(require("./motor-service")),c=i(require("./registry-service")),s=i(require("async"));module.exports=function(i){s.parallel([function(i){e.init(i)},function(i){r.init(i)},function(i){n.init(i)},function(i){t.init(i)},function(i){u.init(i)},function(i){c.init(i)}],function(){i()})};
|
||||
1
node_modules/jibo-tools/lib/simulator/services/tts-service.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/services/tts-service.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e,t,n){var s={token:e,timestamp:t,status:n,moreinfo:[]};return s}function t(e){var t=.2,s=[{name:"/pau/",start:0,end:t}];return e.split(" ").forEach(function(e){e=e.trim(),n(e[e.length-1])&&(e=e.substr(0,e.length-1)),s.push({name:e,start:t,end:t+.3}),t+=.3}),s.push({name:"/pau/",start:t,end:t+.2}),s}function n(e){return"."===e||","===e||"?"===e||"!"===e||";"===e||":"===e}var s=function(e){return e&&e.__esModule?e["default"]:e},r=function(){function e(e,t){for(var n in t){var s=t[n];s.configurable=!0,s.value&&(s.writable=!0)}Object.defineProperties(e,t)}return function(t,n,s){return n&&e(t.prototype,n),s&&e(t,s),t}}(),o=function f(e,t,n){var s=Object.getOwnPropertyDescriptor(e,t);if(void 0===s){var r=Object.getPrototypeOf(e);return null===r?void 0:f(r,t,n)}if("value"in s&&s.writable)return s.value;var o=s.get;if(void 0!==o)return o.call(n)},i=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},a=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},u=s(require("http")),c=require("events").EventEmitter,p=require("websocket").server,l=function(n){function s(){a(this,s),o(Object.getPrototypeOf(s.prototype),"constructor",this).call(this),this.port=11275,this.messages=[],this.connectionHandlers={"/tts_token_times":this.onTokenTimes.bind(this),"/tts_speak":this.onSpeak.bind(this),"/tts_stop":this.onStop.bind(this)}}return i(s,n),r(s,{init:{value:function(e){var t=this;this.httpServer=u.createServer(),this.httpServer.on("request",function(e,n){"POST"===e.method&&(e.setEncoding("utf8"),e.on("data",function(s){var r=void 0;try{for(r=JSON.parse(s),t.messages.push({url:e.url,data:r,response:n});t.messages.length;){var o=t.messages.shift();t.connectionHandlers[o.url](o.data,o.response)}}catch(i){return console.error(i),t.messages.push({url:e.url,data:"ERROR Invalid request. Request body is not valid JSON",response:n}),n.writeHead(200,{"Content-Type":"text/html"}),n.write(JSON.stringify({Status:"ERROR",Message:"Inavlid request. Request body is not valid JSON"})),t.socket&&t.socket.send(JSON.stringify({status:"error",message:"ERROR Invalid request. Request body is not valid JSON"})),void n.end()}t.socket&&t.processMessages()}))}),this.httpServer.on("listening",function(){t.wsServer=new p({httpServer:t.httpServer,autoAcceptconnections:!1}),t.wsServer.on("request",function(e){var n=e.accept(null,e.orgin);"/tts_tokens"===e.resource?(t.tokenSocket=n,t.processMessages()):"/tts_phones"===e.resource&&(t.phoneSocket=n,t.processMessages())})}),e(),this.httpServer.listen(this.port)}},processMessages:{value:function(){for(;this.messages.length;){var e=this.messages.shift();this.connectionHandlers[e.url](e.data,e.response)}}},onSpeak:{value:function(n,s){var r=this;s.writeHead(204,{"Content-Type":"text/html"}),s.write(JSON.stringify({Status:"OK",Message:"Speaking TTS"})),s.end();var o=t(n.prompt);setTimeout(function(){r.emit("speech",n.prompt),r.tokenSocket.send(JSON.stringify(e("",0,"STOP")))},1e3*o[o.length-1].end)}},onTokenTimes:{value:function(e,n){var s={tokentimes:{tokens:t(e.prompt)}};n.writeHead(200,{"Content-Type":"text/html"}),n.write(JSON.stringify(s)),n.end()}},onStop:{value:function(e,t){t.writeHead(200,{"Content-Type":"text/html"}),t.write(JSON.stringify({Status:"OK",Message:"Stopping TTS"})),t.end(),this.emit("stop")}}}),s}(c);module.exports=new l;
|
||||
1
node_modules/jibo-tools/lib/simulator/settings.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/settings.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},e=t(require("path")),i=t(require("fs")),s=t(require("lodash")),n=t(require("app")),o=t(require("ipc")),r=e.join(n.getDataPath(),"simulator-settings.json"),u={contentWidth:1280,contentHeight:720,windowX:50,windowY:50,fullscreen:!1,zoomFactorIndex:4,zoomFactor:1,viewMode:"2d",devToolsWindowX:0,devToolsWindowY:0,devToolsContentWidth:1200,devToolsContentHeight:800,isSimulatorDevToolsOpened:!1,isDevToolsOpened:!1},a={init:function(){var t=this;try{this._settings=JSON.parse(i.readFileSync(r,"utf8")),this._settings=s.extend({},u,this._settings)}catch(e){this._settings=u}this.simulatorReady=!1,o.on("get-simulator-settings",function(e){e.returnValue=JSON.stringify(t._settings),t.simulatorReady=!0;var i=require("./windowing");t.update({zoomFactor:i.getZoom()})})},setWindow:function(t){this.mainWindow=t},update:function(t){this._settings=s.extend({},this._settings,t),i.writeFileSync(r,JSON.stringify(this._settings,null," "),"utf8"),this.simulatorReady===!0&&this.mainWindow.webContents.send("simulator-settings-changed",JSON.stringify(this._settings))},get:function(t){return this._settings[t]},all:function(){return this._settings}};module.exports=a;
|
||||
1
node_modules/jibo-tools/lib/simulator/simulator/dimensions.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/simulator/dimensions.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";module.exports={SCREEN_WIDTH:1280,SCREEN_HEIGHT:720,SCREEN_EPSILON:2,CHAT_WIDTH:400};
|
||||
1
node_modules/jibo-tools/lib/simulator/simulator/face-on-body.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/simulator/face-on-body.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/jibo-tools/lib/simulator/simulator/main.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/simulator/main.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e,t){var i=new u(e,t.scene._camera,new l.Vector3(.2,0,.2),null,new l.Vector3(0,0,1));return i.setMouseFilters(function(e){return e.altKey&&!e.metaKey&&!e.ctrlKey},function(e){return e.shiftKey},function(e){return!e.shiftKey}),i.installRendererIntoScene(t.scene),i.addPositionChangedCallback(function(e){e.id="testId",o.updateTarget(e)}),o.updateTarget({id:"testId",x:.2,y:0,z:.2}),!0}var t=function(e){return e&&e.__esModule?e["default"]:e},i=t(require("react")),n=t(require("../services/service-initializer")),r=t(require("../services/asr-service")),o=t(require("../services/lps-service")),s=t(require("../views/chat-view")),a=t(require("../views/lps-view")),d=t(require("../react-components/tab-bar")),c=require("animation-utilities"),l=c.THREE,u=c.MouseTargetPositioner;require("../elements/custom-elements");var h=t(require("ipc")),v=t(require("./face-on-body")),m=t(require("../services/motor-service")),f=c.JiboConfig,p=c.RobotInfo,g=t(require("./dimensions")),w=t(require("async")),y="true"===h.sendSync("is-remote-mode");y&&(g.CHAT_WIDTH=0);var b=i.createClass({displayName:"View",getInitialState:function(){return{currentView:"chat"}},render:function(){var e=this,t=[{label:"Chat",callback:function(){e.setState({currentView:"chat"})}},{label:"LPS",callback:function(){e.setState({currentView:"lps"})}}],n="chat"==this.state.currentView;if(y)return i.createElement("div",null);var r=void 0,c=void 0,l=void 0,u=o.getEntities();return r=i.createElement(d,{tabs:t}),c=i.createElement(s,{ref:"chat",onWords:this.onWords,isSelected:n}),l=i.createElement(a,{ref:"lps",isSelected:!n,setTargetId:o.setTargetId.bind(o),targets:u,onAddTarget:this.addMouseTargetPositioner,updateTargets:this.forceUpdate.bind(this)}),i.createElement("atom-workspace",{id:"chat",style:{width:g.CHAT_WIDTH,height:"100%"}},r,c,l)},componentDidMount:function(){var e=this;o.on("update",function(){e.forceUpdate()});var t=this.props.robotInfo,i=void 0,n=function(e,t){i.isDevToolsOpened()&&t.isDevToolsOpened===!1?i.closeDevTools():i.isDevToolsOpened()||t.isDevToolsOpened!==!0||i.openDevTools()},r=document.getElementById("face"),s=document.getElementById("visualizer");this.visualizerContainer=s,v.init(t,r,s,n,function(t,n,o){e.robotRenderer=n;var s=h.sendSync("get-skill-path");r.innerHTML='<div id="loader"></div><webview id="webview" nodeintegration autosize="on" width="1280" height="720" minwidth="10" maxwidth="20000" minheight="10" maxheight="20000" src="'+s+'" style="border: none; display:block; width:1280px; height:720px"></webview>',i=document.getElementById("webview");var a=document.getElementById("loader");a.style.visibility="visible",h.on("reload-skill",function(){a.style.visibility="visible",i.reloadIgnoringCache()}),i.addEventListener("dom-ready",function(){!i.isDevToolsOpened()&&o.isDevToolsOpened&&i.openDevTools(),i.insertCSS("html{min-width: 1280px; min-height: 720px;} body{min-width: 1280px; min-height: 720px; margin: 0px; overflow: hidden;}"),a.style.visibility="hidden",i.style.width="1281px",setTimeout(function(){i.style.width="1280px"},1e3)});var d=function(){m.render(n),requestAnimationFrame(d)};requestAnimationFrame(d)})},onWords:function(e){r.onWordsReceived(e)},addMouseTargetPositioner:function(){this.hasMouseTargetPositioner||(this.hasMouseTargetPositioner=e(this.visualizerContainer,this.robotRenderer))}});w.series([function(e){y?(h.send("registry-init","http://127.0.0.1:8181"),e()):n(function(){h.send("registry-init","http://127.0.0.1:8181"),e()})},function(e){var t=new f;p.createInfo(t,function(t){i.render(i.createElement(b,{robotInfo:t,asrService:r}),document.getElementById("chat")),e()})}],function(e){e&&console.error("Simulator: "+e)});
|
||||
1
node_modules/jibo-tools/lib/simulator/timer.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/timer.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var t=function(){function t(t,n){for(var e in n){var r=n[e];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(t,n)}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}(),n=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")},e=function(){function e(){var t=this;n(this,e),this.interval=33,this.updaters=[],setInterval(function(){t.updaters.forEach(function(t){t.update()})},this.interval)}return t(e,{add:{value:function(t){this.updaters.push(t)}},remove:{value:function(t){var n=this.updaters.indexOf(t);n>=0&&this.updaters.splice(n,1)}}}),e}();module.exports=new e;
|
||||
1
node_modules/jibo-tools/lib/simulator/views/asr-view.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/asr-view.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react"));module.exports=t.createClass({displayName:"asr-view",getInitialState:function(){return{text:"",speaker:""}},onTextChange:function(e){var t=e.target.value;t=t.trim().replace(/[\|&;\$%@"#<>\(\)\+,?.]/g,"").toLowerCase(),this.setState({text:this.value}),13===e.nativeEvent.keyCode?(this.setState({text:""}),this.props.onWords({words:t,"final":!0,speaker:this.state.speaker}),this.props.messageHandler({words:t,speaker:this.state.speaker})):32===e.nativeEvent.keyCode&&this.props.onWords({words:t,incremental:!0,speaker:this.state.speaker})},onSpeakerChange:function(e){var t=e.target.value;this.setState({speaker:t})},render:function(){return t.createElement("div",{className:"asr-input"},t.createElement("div",{className:"speaker-box"},"Who is speaking?",t.createElement("input",{type:"text",className:"speaker-input",value:this.state.speaker,onChange:this.onSpeakerChange})),t.createElement("input",{type:"text",className:"text-input",placeholder:"Speak to jibo here...",style:{height:30,borderColor:"gray",borderWidth:1,width:"100%"},value:this.state.text,onKeyPress:this.onTextChange}))}});
|
||||
1
node_modules/jibo-tools/lib/simulator/views/chat-message.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/chat-message.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react"));module.exports=t.createClass({displayName:"chat-message",getInitialState:function(){return{}},render:function(){var e={},a="#2E6575";"jibo"!==this.props.message.author?e={"text-align":"right"}:(e={"text-align":"left"},a="#1EB2E2");var r={"border-radius":"5px",margin:"1%",backgroundColor:a,clear:"both",width:"100%"},s=this.props.message.author?this.props.message.author:"[anybody]";return t.createElement("div",{style:e},t.createElement("div",{style:r},t.createElement("div",{className:"speaker",style:{fontWeight:"bold",padding:"3px"}},s),t.createElement("div",{className:"content",style:{padding:"3px"}},this.props.message.content)))}});
|
||||
1
node_modules/jibo-tools/lib/simulator/views/chat-view.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/chat-view.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},s=e(require("react")),t=e(require("../services/tts-service")),r=e(require("./messages-list")),a=e(require("./asr-view"));module.exports=s.createClass({displayName:"chat-view",getInitialState:function(){return{isSelected:!1}},componentDidMount:function(){var e=this;this.chatProxy=this.props.chatProxy,t.on("speech",function(s){e.messageHandler({words:s,speaker:"jibo"})}),window.addEventListener("resize",function(){e.forceUpdate()})},messageHandler:function(e){this.addMessage({content:e.words,author:e.speaker}),this.props.onWords(e)},addMessage:function(e){e&&(e.date=new Date,this.refs.messagesList.addMessage(e))},render:function(){var e={};return this.props.isSelected?e.display="":e.display="none",s.createElement("div",{className:"chat-box",ref:"root",style:e},s.createElement("div",{className:"chat-content-wrapper",style:{height:window.innerHeight-132}},s.createElement(r,{ref:"messagesList",height:window.innerHeight})),s.createElement(a,{ref:"AsrView",messageHandler:this.messageHandler,onWords:this.props.onWords}))}});
|
||||
1
node_modules/jibo-tools/lib/simulator/views/lps-view-orig.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/lps-view-orig.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=function(){function e(e,t){for(var n in t){var o=t[n];o.configurable=!0,o.value&&(o.writable=!0)}Object.defineProperties(e,t)}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o=e(require("react")),i=require("animation-utilities"),r=i.visualize,s=i.THREE,a=i.MouseCoordinateWrangler,c=e(require("../timer")),h=e(require("../services/lps-service")),l=-.18,u=1,d={},p=function(){function e(t){n(this,e),this.id=u++,d[this.id]=this;var o=new s.SphereGeometry(.1,32,32),i=new s.MeshLambertMaterial({color:12303291});this.sphere=new s.Mesh(o,i),this.sphere.name=this.id,t.add(this.sphere)}return t(e,{setPosition:{value:function(e){this.position=e.clone(),this.sphere.position.x=e.x,this.sphere.position.y=e.y,this.sphere.position.z=e.z}},getData:{value:function(){return{identity:[{id:this.id,confidence:1,classification:"person"}],body:{position:{x:this.position.x,y:this.position.y,z:this.position.z}}}}},remove:{value:function(){delete d[this.id],this.sphere.parent.remove(this.sphere)}}}),e}();module.exports=o.createClass({displayName:"lps-view-orig",getInitialState:function(){return{}},render:function(){var e={border:"1px solid grey",width:550,height:550,margin:"auto"};return o.createElement("div",null,o.createElement("div",{className:"panel-heading",style:{height:40}},o.createElement("h2",{style:{margin:"auto",textAlign:"center"}},"LPS View")),o.createElement("div",{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onDoubleClick:this.onDoubleClick,style:e,ref:"content"}))},getIntersectedPerson:function(e){var t=o.findDOMNode(this.refs.content),n=e.nativeEvent,i=this.renderer.scene.getScene(),r=this.renderer.scene.getCamera(),c=a.getLocalCoordinatesNDCCentered(n,t),h=new s.Raycaster;h.setFromCamera(c,r);for(var l=h.intersectObject(i,!0),u=0;u<l.length;u++){var p=d[l[u].object.name];if(p)return p}},getIntersectionAtHeight:function(e,t,n){var i=o.findDOMNode(this.refs.content),r=new s.Vector3;r.set(e/i.clientWidth*2-1,2*-(t/i.clientHeight)+1,.5);var a=this.renderer.scene.getCamera();r.unproject(a);var c=r.sub(a.position).normalize(),h=-a.position.z/c.z;return h+=n,a.position.clone().add(c.multiplyScalar(h))},onDoubleClick:function(e){console.log("DOUBLE CLICK");var t=this.getIntersectedPerson(e);if(t)t.remove();else{e=e.nativeEvent;var n=this.getIntersectionAtHeight(e.offsetX,e.offsetY,l),o=new p(this.renderer.scene.getScene());o.setPosition(n)}},onMouseUp:function(){if(this.person){this.person=void 0;var e=o.findDOMNode(this.refs.content);e.removeEventListener("mousemove",this.onMouseMoveBind)}},onMouseMove:function(e){var t=this.getIntersectionAtHeight(e.offsetX,e.offsetY,l);this.person.setPosition(t)},onMouseDown:function(e){if(this.person=this.getIntersectedPerson(e),this.person){this.onMouseMoveBind=this.onMouseMove.bind(this);var t=o.findDOMNode(this.refs.content);t.addEventListener("mousemove",this.onMouseMoveBind)}},componentDidMount:function(){var e=this,t=o.findDOMNode(this.refs.content);r.createRobotRenderer(this.props.robotInfo,t,r.DisplayType.BODY,function(t){t.setBackgroundColor(.7,.7,.7,0),e.renderer=t;var n=t.scene.getCamera();n.up=new s.Vector3(-1,0,0),t.setCamera(new s.Vector3(0,0,4),new s.Vector3(0,0,0)),t.scene.removeTrackballControls();var o=t.scene.getScene().getObjectByName("headMesh"),i=new s.MeshLambertMaterial({color:16711680,opacity:.1,transparent:!0}),r=2,a=100*Math.PI/180;e.cone={length:r,fov:a};var h=2*r*Math.cos(.5*a),l=new s.Mesh(new s.CylinderGeometry(0,h,r,50,50,!1),i);l.overdraw=.5,l.rotation.x=.5*Math.PI,l.position.z-=.5*r,l.position.y+=.15,e.cylinder=l,o.add(l),c.add(e)})},createSphere:function(e){var t=void 0===arguments[1]?16711680:arguments[1],n=new s.Mesh(new s.SphereGeometry(.05,32,32),new s.MeshLambertMaterial({color:t}));return n.position.x=e.x,n.position.y=e.y,n.position.z=e.z,this.renderer.scene.getScene().add(n),n},componentWillUnmount:function(){c.remove(this),clearInterval(this.interval)},update:function(){var e=this,t=new s.Vector3(0,.5*this.cone.length,0),n=new s.Vector3(0,-.5*this.cone.length,0);this.cylinder.localToWorld(t),this.cylinder.localToWorld(n);var o=(new Date).getTime(),i=[];Object.keys(d).forEach(function(r){var s=d[r],a=s.sphere.position.clone(),c=n.clone().sub(t).length(),h=-t.clone().sub(a).dot(n.clone().sub(t))/c,l=n.clone().sub(t).cross(t.clone().sub(a)).length()/c,u=h>.1&&l/h<1/Math.cos(.5*e.cone.fov);u?s.sphere.material.color.setHex(47872):s.sphere.material.color.setHex(12303291),r=parseInt(r),i.push({timestamp:o,id:r,classification:"person",data:s.getData(),visible:u})}),h.updateTrackingState({tracks:i})}});
|
||||
1
node_modules/jibo-tools/lib/simulator/views/lps-view.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/lps-view.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),r=e(require("./target-view")),a=e(require("../services/lps-service")),n=e(require("marked"));module.exports=t.createClass({displayName:"lps-view",getInitialState:function(){return{isSelected:!1}},onClick:function(){a.addEntity()},render:function(){var e=this,a={};this.props.isSelected?a.display="":a.display="none",a.color="white";var i=[],s=0;this.props.targets.forEach(function(a){i.push(t.createElement(r,{setTargetId:e.props.setTargetId,target:a})),i.push(t.createElement("hr",{key:s++}))});var l="Click the `Add Target` button to add a single target to Jibo's Local Perceptual Space.\n\n* `shift+scroll` to zoom in and out.\n\n* `shift+drag` to move camera.\n\n* `shift+alt+drag` to move the LPS target on the ground.\n\n* `alt+drag` to move the height of the target.";return t.createElement("div",{className:"right-pane",ref:"rightPane",style:a},t.createElement("div",{className:"panel-heading",style:{padding:"0px"}},t.createElement("h2",{style:{textAlign:"center",marginTop:"6px",marginBottom:"6px"}},"Targets")),t.createElement("button",{className:"btn",style:{margin:"10px"},onClick:this.props.onAddTarget},"Add a target"),t.createElement("br",null),t.createElement("div",{style:{padding:20},dangerouslySetInnerHTML:{__html:n(l,{sanitize:!0})}}),t.createElement("hr",{key:s++}),t.createElement("div",{className:"arguments-scroll-container"},i))}});
|
||||
1
node_modules/jibo-tools/lib/simulator/views/messages-list.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/messages-list.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},s=e(require("react")),t=e(require("./chat-message"));module.exports=s.createClass({displayName:"messages-list",getInitialState:function(){return{messages:[]}},addMessage:function(e){var s=this.state.messages,t=this.refs.messageContainer.getDOMNode();s.push(e),this.setState({messages:s}),t.scrollHeight-(t.scrollTop+t.offsetHeight)>=50?this.scrolled=!0:this.scrolled=!1},componentDidUpdate:function(){if(!this.scrolled){var e=this.refs.messageContainer.getDOMNode();e.scrollTop=e.scrollHeight}},render:function(){var e,a={width:"100%",paddingLeft:"3%",paddingRight:"3%",paddingTop:"2%",paddingBottom:"2%"};return e=this.state.messages.map(function(e){return s.createElement(t,{message:e})}),e.length||(e=s.createElement("div",{className:"chat-no-messages"},"No messages")),s.createElement("div",{ref:"messageContainer",className:"chat-messages col-xs-9",style:a},e)}});
|
||||
1
node_modules/jibo-tools/lib/simulator/views/target-view.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/target-view.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react"));module.exports=t.createClass({displayName:"target-view",getInitialState:function(){return{id:this.props.target.id}},onIdChange:function(e){var t=e.target.value;this.props.setTargetId(this.state.id,t),this.setState({id:t})},render:function(){var e={};e.color="white",e.margin="10px",e.textAlign="left";var r=this.props.target.parts[0].value.rays[0].dir,a=void 0;for(a in r)r[a]=Number(r[a]).toFixed(5);return t.createElement("div",{style:e},t.createElement("div",{className:"target-id"},t.createElement("p",null,t.createElement("div",null,"ID"),t.createElement("input",{type:"text",className:"target-id",value:this.state.id,onChange:this.onIdChange,style:{color:"black"}})),t.createElement("p",null,"Current Location: ",t.createElement("br",null),"x: ",r.x,t.createElement("br",null),"y: ",r.y,t.createElement("br",null),"z: ",r.z,t.createElement("br",null))))}});
|
||||
1
node_modules/jibo-tools/lib/simulator/views/tts-view.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/views/tts-view.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),r=e(require("../services/tts-service"));module.exports=t.createClass({displayName:"tts-view",getInitialState:function(){return{text:""}},componentWillMount:function(){var e=this;r.on("speech",function(t){e.setState({text:t})})},render:function(){return t.createElement("div",null,t.createElement("input",{type:"text",style:{height:30,borderColor:"gray",borderWidth:1,width:"100%"},value:this.state.text}))}});
|
||||
1
node_modules/jibo-tools/lib/simulator/windowing.js
generated
vendored
Normal file
1
node_modules/jibo-tools/lib/simulator/windowing.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";function e(e){var t=require("screen"),r=void 0;if(!(0>e&&e!==o||e>=i.length)){if(c=e,e===o){r=t.getDisplayMatching(l.getBounds());var u=require("lifesized"),d=u.ppi(r),s=294;a=d/s*r.scaleFactor}else a=i[c];r=t.getDisplayMatching(l.getBounds()),n.update({zoomFactor:a/r.scaleFactor,zoomFactorIndex:c})}}var t=function(e){return e&&e.__esModule?e["default"]:e},n=t(require("./settings")),i=[.5,.67,.75,.9,1,1.1,1.25,1.5,1.75,2,2.5,3,4,5],r=4,o=-2,c=n.get("zoomFactorIndex"),a=c===o?1:i[c],l=null,u={setWindow:function(e){var t=this;l=e;var i=require("global-shortcut");i.register("CmdOrCtrl+0",function(){u.reset()}),this.dimensionChangeInterval=setInterval(function(){var e=l.getContentSize(),i=t.getScaleFactor();(n.get("windowX")!==l.getBounds().x||n.get("windowY")!==l.getBounds().y||n.get("contentWidth")!==e[0]*i||n.get("contentHeight")!==e[1]*i||n.get("devicePixelRatio")!==i)&&n.update({windowX:l.getBounds().x,windowY:l.getBounds().y,contentWidth:e[0]*i,contentHeight:e[1]*i,devicePixelRatio:i})},200)},shutdown:function(){this.dimensionChangeInterval&&clearInterval(this.dimensionChangeInterval)},getZoom:function(){return a},getInitialZoomFactor:function(){return this.getZoom()},getDisplay:function(){var e=require("screen");return l?e.getDisplayMatching(l.getBounds()):e.getDisplayMatching({x:n.get("windowX"),y:n.get("windowY"),width:n.get("contentWidth"),height:n.get("contentHeight")})},getScaleFactor:function(){var e=this.getDisplay();return e.scaleFactor},getMenuItems:function(){return[{label:"Toggle Full Screen",accelerator:"Ctrl+Command+F",click:function(){l&&(l.setFullScreen(!l.isFullScreen()),n.update({fullscreen:l.isFullScreen()}))}},{label:"Actual Sized (100%)",accelerator:"CmdOrCtrl+0",click:function(){e(r)}},{label:"Zoom In",accelerator:"CmdOrCtrl+=",click:function(){e(c===o?r:c+1)}},{label:"Zoom Out",accelerator:"CmdOrCtrl+-",click:function(){e(c===o?r:c-1)}},{label:"Physical Sized",accelerator:"CmdOrCtrl+4",click:function(){e(o)}},{type:"separator"},{label:"2D View",accelerator:"CmdOrCtrl+2",click:function(){n.update({viewMode:"2d"})}},{label:"3D View",accelerator:"CmdOrCtrl+3",click:function(){n.update({viewMode:"3d"})}},{type:"separator"}]},reset:function(){e(r,!0)}};module.exports=u;
|
||||
3
node_modules/jibo-tools/node_modules/async/.travis.yml
generated
vendored
Normal file
3
node_modules/jibo-tools/node_modules/async/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
19
node_modules/jibo-tools/node_modules/async/LICENSE
generated
vendored
Normal file
19
node_modules/jibo-tools/node_modules/async/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2010-2014 Caolan McMahon
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
1646
node_modules/jibo-tools/node_modules/async/README.md
generated
vendored
Normal file
1646
node_modules/jibo-tools/node_modules/async/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11
node_modules/jibo-tools/node_modules/async/component.json
generated
vendored
Normal file
11
node_modules/jibo-tools/node_modules/async/component.json
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "async",
|
||||
"repo": "caolan/async",
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"version": "0.1.23",
|
||||
"keywords": [],
|
||||
"dependencies": {},
|
||||
"development": {},
|
||||
"main": "lib/async.js",
|
||||
"scripts": [ "lib/async.js" ]
|
||||
}
|
||||
1123
node_modules/jibo-tools/node_modules/async/lib/async.js
generated
vendored
Executable file
1123
node_modules/jibo-tools/node_modules/async/lib/async.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load Diff
36
node_modules/jibo-tools/node_modules/async/package.json
generated
vendored
Normal file
36
node_modules/jibo-tools/node_modules/async/package.json
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "async",
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"main": "./lib/async",
|
||||
"author": "Caolan McMahon",
|
||||
"version": "0.9.0",
|
||||
"repository" : {
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/caolan/async.git"
|
||||
},
|
||||
"bugs" : {
|
||||
"url" : "https://github.com/caolan/async/issues"
|
||||
},
|
||||
"licenses" : [
|
||||
{
|
||||
"type" : "MIT",
|
||||
"url" : "https://github.com/caolan/async/raw/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"devDependencies": {
|
||||
"nodeunit": ">0.0.0",
|
||||
"uglify-js": "1.2.x",
|
||||
"nodelint": ">0.0.0"
|
||||
},
|
||||
"jam": {
|
||||
"main": "lib/async.js",
|
||||
"include": [
|
||||
"lib/async.js",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"test": "nodeunit test/test-async.js"
|
||||
}
|
||||
}
|
||||
20
node_modules/jibo-tools/node_modules/react/README.md
generated
vendored
Normal file
20
node_modules/jibo-tools/node_modules/react/README.md
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
# react
|
||||
|
||||
An npm package to get you immediate access to [React](http://facebook.github.io/react/),
|
||||
without also requiring the JSX transformer. This is especially useful for cases where you
|
||||
want to [`browserify`](https://github.com/substack/node-browserify) your module using
|
||||
`React`.
|
||||
|
||||
**Note:** by default, React will be in development mode. The development version includes extra warnings about common mistakes, whereas the production version includes extra performance optimizations and strips all error messages.
|
||||
|
||||
To use React in production mode, set the environment variable `NODE_ENV` to `production`. A minifier that performs dead-code elimination such as [UglifyJS](https://github.com/mishoo/UglifyJS2) is recommended to completely remove the extra code present in development mode.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```js
|
||||
var React = require('react');
|
||||
|
||||
// You can also access ReactWithAddons.
|
||||
var React = require('react/addons');
|
||||
```
|
||||
|
||||
1
node_modules/jibo-tools/node_modules/react/addons.js
generated
vendored
Normal file
1
node_modules/jibo-tools/node_modules/react/addons.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./lib/ReactWithAddons');
|
||||
15919
node_modules/jibo-tools/node_modules/react/dist/JSXTransformer.js
generated
vendored
Normal file
15919
node_modules/jibo-tools/node_modules/react/dist/JSXTransformer.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
21598
node_modules/jibo-tools/node_modules/react/dist/react-with-addons.js
generated
vendored
Normal file
21598
node_modules/jibo-tools/node_modules/react/dist/react-with-addons.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
17
node_modules/jibo-tools/node_modules/react/dist/react-with-addons.min.js
generated
vendored
Normal file
17
node_modules/jibo-tools/node_modules/react/dist/react-with-addons.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
19562
node_modules/jibo-tools/node_modules/react/dist/react.js
generated
vendored
Normal file
19562
node_modules/jibo-tools/node_modules/react/dist/react.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
15
node_modules/jibo-tools/node_modules/react/dist/react.min.js
generated
vendored
Normal file
15
node_modules/jibo-tools/node_modules/react/dist/react.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
25
node_modules/jibo-tools/node_modules/react/lib/AutoFocusMixin.js
generated
vendored
Normal file
25
node_modules/jibo-tools/node_modules/react/lib/AutoFocusMixin.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule AutoFocusMixin
|
||||
* @typechecks static-only
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var focusNode = require("./focusNode");
|
||||
|
||||
var AutoFocusMixin = {
|
||||
componentDidMount: function() {
|
||||
if (this.props.autoFocus) {
|
||||
focusNode(this.getDOMNode());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = AutoFocusMixin;
|
||||
493
node_modules/jibo-tools/node_modules/react/lib/BeforeInputEventPlugin.js
generated
vendored
Normal file
493
node_modules/jibo-tools/node_modules/react/lib/BeforeInputEventPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,493 @@
|
||||
/**
|
||||
* Copyright 2013-2015 Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule BeforeInputEventPlugin
|
||||
* @typechecks static-only
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var EventConstants = require("./EventConstants");
|
||||
var EventPropagators = require("./EventPropagators");
|
||||
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
||||
var FallbackCompositionState = require("./FallbackCompositionState");
|
||||
var SyntheticCompositionEvent = require("./SyntheticCompositionEvent");
|
||||
var SyntheticInputEvent = require("./SyntheticInputEvent");
|
||||
|
||||
var keyOf = require("./keyOf");
|
||||
|
||||
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
|
||||
var START_KEYCODE = 229;
|
||||
|
||||
var canUseCompositionEvent = (
|
||||
ExecutionEnvironment.canUseDOM &&
|
||||
'CompositionEvent' in window
|
||||
);
|
||||
|
||||
var documentMode = null;
|
||||
if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
|
||||
documentMode = document.documentMode;
|
||||
}
|
||||
|
||||
// Webkit offers a very useful `textInput` event that can be used to
|
||||
// directly represent `beforeInput`. The IE `textinput` event is not as
|
||||
// useful, so we don't use it.
|
||||
var canUseTextInputEvent = (
|
||||
ExecutionEnvironment.canUseDOM &&
|
||||
'TextEvent' in window &&
|
||||
!documentMode &&
|
||||
!isPresto()
|
||||
);
|
||||
|
||||
// In IE9+, we have access to composition events, but the data supplied
|
||||
// by the native compositionend event may be incorrect. Japanese ideographic
|
||||
// spaces, for instance (\u3000) are not recorded correctly.
|
||||
var useFallbackCompositionData = (
|
||||
ExecutionEnvironment.canUseDOM &&
|
||||
(
|
||||
(!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11)
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Opera <= 12 includes TextEvent in window, but does not fire
|
||||
* text input events. Rely on keypress instead.
|
||||
*/
|
||||
function isPresto() {
|
||||
var opera = window.opera;
|
||||
return (
|
||||
typeof opera === 'object' &&
|
||||
typeof opera.version === 'function' &&
|
||||
parseInt(opera.version(), 10) <= 12
|
||||
);
|
||||
}
|
||||
|
||||
var SPACEBAR_CODE = 32;
|
||||
var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
|
||||
|
||||
var topLevelTypes = EventConstants.topLevelTypes;
|
||||
|
||||
// Events and their corresponding property names.
|
||||
var eventTypes = {
|
||||
beforeInput: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: keyOf({onBeforeInput: null}),
|
||||
captured: keyOf({onBeforeInputCapture: null})
|
||||
},
|
||||
dependencies: [
|
||||
topLevelTypes.topCompositionEnd,
|
||||
topLevelTypes.topKeyPress,
|
||||
topLevelTypes.topTextInput,
|
||||
topLevelTypes.topPaste
|
||||
]
|
||||
},
|
||||
compositionEnd: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: keyOf({onCompositionEnd: null}),
|
||||
captured: keyOf({onCompositionEndCapture: null})
|
||||
},
|
||||
dependencies: [
|
||||
topLevelTypes.topBlur,
|
||||
topLevelTypes.topCompositionEnd,
|
||||
topLevelTypes.topKeyDown,
|
||||
topLevelTypes.topKeyPress,
|
||||
topLevelTypes.topKeyUp,
|
||||
topLevelTypes.topMouseDown
|
||||
]
|
||||
},
|
||||
compositionStart: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: keyOf({onCompositionStart: null}),
|
||||
captured: keyOf({onCompositionStartCapture: null})
|
||||
},
|
||||
dependencies: [
|
||||
topLevelTypes.topBlur,
|
||||
topLevelTypes.topCompositionStart,
|
||||
topLevelTypes.topKeyDown,
|
||||
topLevelTypes.topKeyPress,
|
||||
topLevelTypes.topKeyUp,
|
||||
topLevelTypes.topMouseDown
|
||||
]
|
||||
},
|
||||
compositionUpdate: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: keyOf({onCompositionUpdate: null}),
|
||||
captured: keyOf({onCompositionUpdateCapture: null})
|
||||
},
|
||||
dependencies: [
|
||||
topLevelTypes.topBlur,
|
||||
topLevelTypes.topCompositionUpdate,
|
||||
topLevelTypes.topKeyDown,
|
||||
topLevelTypes.topKeyPress,
|
||||
topLevelTypes.topKeyUp,
|
||||
topLevelTypes.topMouseDown
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
// Track whether we've ever handled a keypress on the space key.
|
||||
var hasSpaceKeypress = false;
|
||||
|
||||
/**
|
||||
* Return whether a native keypress event is assumed to be a command.
|
||||
* This is required because Firefox fires `keypress` events for key commands
|
||||
* (cut, copy, select-all, etc.) even though no character is inserted.
|
||||
*/
|
||||
function isKeypressCommand(nativeEvent) {
|
||||
return (
|
||||
(nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
|
||||
// ctrlKey && altKey is equivalent to AltGr, and is not a command.
|
||||
!(nativeEvent.ctrlKey && nativeEvent.altKey)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Translate native top level events into event types.
|
||||
*
|
||||
* @param {string} topLevelType
|
||||
* @return {object}
|
||||
*/
|
||||
function getCompositionEventType(topLevelType) {
|
||||
switch (topLevelType) {
|
||||
case topLevelTypes.topCompositionStart:
|
||||
return eventTypes.compositionStart;
|
||||
case topLevelTypes.topCompositionEnd:
|
||||
return eventTypes.compositionEnd;
|
||||
case topLevelTypes.topCompositionUpdate:
|
||||
return eventTypes.compositionUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Does our fallback best-guess model think this event signifies that
|
||||
* composition has begun?
|
||||
*
|
||||
* @param {string} topLevelType
|
||||
* @param {object} nativeEvent
|
||||
* @return {boolean}
|
||||
*/
|
||||
function isFallbackCompositionStart(topLevelType, nativeEvent) {
|
||||
return (
|
||||
topLevelType === topLevelTypes.topKeyDown &&
|
||||
nativeEvent.keyCode === START_KEYCODE
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does our fallback mode think that this event is the end of composition?
|
||||
*
|
||||
* @param {string} topLevelType
|
||||
* @param {object} nativeEvent
|
||||
* @return {boolean}
|
||||
*/
|
||||
function isFallbackCompositionEnd(topLevelType, nativeEvent) {
|
||||
switch (topLevelType) {
|
||||
case topLevelTypes.topKeyUp:
|
||||
// Command keys insert or clear IME input.
|
||||
return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);
|
||||
case topLevelTypes.topKeyDown:
|
||||
// Expect IME keyCode on each keydown. If we get any other
|
||||
// code we must have exited earlier.
|
||||
return (nativeEvent.keyCode !== START_KEYCODE);
|
||||
case topLevelTypes.topKeyPress:
|
||||
case topLevelTypes.topMouseDown:
|
||||
case topLevelTypes.topBlur:
|
||||
// Events are not possible without cancelling IME.
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Google Input Tools provides composition data via a CustomEvent,
|
||||
* with the `data` property populated in the `detail` object. If this
|
||||
* is available on the event object, use it. If not, this is a plain
|
||||
* composition event and we have nothing special to extract.
|
||||
*
|
||||
* @param {object} nativeEvent
|
||||
* @return {?string}
|
||||
*/
|
||||
function getDataFromCustomEvent(nativeEvent) {
|
||||
var detail = nativeEvent.detail;
|
||||
if (typeof detail === 'object' && 'data' in detail) {
|
||||
return detail.data;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Track the current IME composition fallback object, if any.
|
||||
var currentComposition = null;
|
||||
|
||||
/**
|
||||
* @param {string} topLevelType Record from `EventConstants`.
|
||||
* @param {DOMEventTarget} topLevelTarget The listening component root node.
|
||||
* @param {string} topLevelTargetID ID of `topLevelTarget`.
|
||||
* @param {object} nativeEvent Native browser event.
|
||||
* @return {?object} A SyntheticCompositionEvent.
|
||||
*/
|
||||
function extractCompositionEvent(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID,
|
||||
nativeEvent
|
||||
) {
|
||||
var eventType;
|
||||
var fallbackData;
|
||||
|
||||
if (canUseCompositionEvent) {
|
||||
eventType = getCompositionEventType(topLevelType);
|
||||
} else if (!currentComposition) {
|
||||
if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
|
||||
eventType = eventTypes.compositionStart;
|
||||
}
|
||||
} else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
|
||||
eventType = eventTypes.compositionEnd;
|
||||
}
|
||||
|
||||
if (!eventType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (useFallbackCompositionData) {
|
||||
// The current composition is stored statically and must not be
|
||||
// overwritten while composition continues.
|
||||
if (!currentComposition && eventType === eventTypes.compositionStart) {
|
||||
currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
|
||||
} else if (eventType === eventTypes.compositionEnd) {
|
||||
if (currentComposition) {
|
||||
fallbackData = currentComposition.getData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var event = SyntheticCompositionEvent.getPooled(
|
||||
eventType,
|
||||
topLevelTargetID,
|
||||
nativeEvent
|
||||
);
|
||||
|
||||
if (fallbackData) {
|
||||
// Inject data generated from fallback path into the synthetic event.
|
||||
// This matches the property of native CompositionEventInterface.
|
||||
event.data = fallbackData;
|
||||
} else {
|
||||
var customData = getDataFromCustomEvent(nativeEvent);
|
||||
if (customData !== null) {
|
||||
event.data = customData;
|
||||
}
|
||||
}
|
||||
|
||||
EventPropagators.accumulateTwoPhaseDispatches(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} topLevelType Record from `EventConstants`.
|
||||
* @param {object} nativeEvent Native browser event.
|
||||
* @return {?string} The string corresponding to this `beforeInput` event.
|
||||
*/
|
||||
function getNativeBeforeInputChars(topLevelType, nativeEvent) {
|
||||
switch (topLevelType) {
|
||||
case topLevelTypes.topCompositionEnd:
|
||||
return getDataFromCustomEvent(nativeEvent);
|
||||
case topLevelTypes.topKeyPress:
|
||||
/**
|
||||
* If native `textInput` events are available, our goal is to make
|
||||
* use of them. However, there is a special case: the spacebar key.
|
||||
* In Webkit, preventing default on a spacebar `textInput` event
|
||||
* cancels character insertion, but it *also* causes the browser
|
||||
* to fall back to its default spacebar behavior of scrolling the
|
||||
* page.
|
||||
*
|
||||
* Tracking at:
|
||||
* https://code.google.com/p/chromium/issues/detail?id=355103
|
||||
*
|
||||
* To avoid this issue, use the keypress event as if no `textInput`
|
||||
* event is available.
|
||||
*/
|
||||
var which = nativeEvent.which;
|
||||
if (which !== SPACEBAR_CODE) {
|
||||
return null;
|
||||
}
|
||||
|
||||
hasSpaceKeypress = true;
|
||||
return SPACEBAR_CHAR;
|
||||
|
||||
case topLevelTypes.topTextInput:
|
||||
// Record the characters to be added to the DOM.
|
||||
var chars = nativeEvent.data;
|
||||
|
||||
// If it's a spacebar character, assume that we have already handled
|
||||
// it at the keypress level and bail immediately. Android Chrome
|
||||
// doesn't give us keycodes, so we need to blacklist it.
|
||||
if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return chars;
|
||||
|
||||
default:
|
||||
// For other native event types, do nothing.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For browsers that do not provide the `textInput` event, extract the
|
||||
* appropriate string to use for SyntheticInputEvent.
|
||||
*
|
||||
* @param {string} topLevelType Record from `EventConstants`.
|
||||
* @param {object} nativeEvent Native browser event.
|
||||
* @return {?string} The fallback string for this `beforeInput` event.
|
||||
*/
|
||||
function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
|
||||
// If we are currently composing (IME) and using a fallback to do so,
|
||||
// try to extract the composed characters from the fallback object.
|
||||
if (currentComposition) {
|
||||
if (
|
||||
topLevelType === topLevelTypes.topCompositionEnd ||
|
||||
isFallbackCompositionEnd(topLevelType, nativeEvent)
|
||||
) {
|
||||
var chars = currentComposition.getData();
|
||||
FallbackCompositionState.release(currentComposition);
|
||||
currentComposition = null;
|
||||
return chars;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (topLevelType) {
|
||||
case topLevelTypes.topPaste:
|
||||
// If a paste event occurs after a keypress, throw out the input
|
||||
// chars. Paste events should not lead to BeforeInput events.
|
||||
return null;
|
||||
case topLevelTypes.topKeyPress:
|
||||
/**
|
||||
* As of v27, Firefox may fire keypress events even when no character
|
||||
* will be inserted. A few possibilities:
|
||||
*
|
||||
* - `which` is `0`. Arrow keys, Esc key, etc.
|
||||
*
|
||||
* - `which` is the pressed key code, but no char is available.
|
||||
* Ex: 'AltGr + d` in Polish. There is no modified character for
|
||||
* this key combination and no character is inserted into the
|
||||
* document, but FF fires the keypress for char code `100` anyway.
|
||||
* No `input` event will occur.
|
||||
*
|
||||
* - `which` is the pressed key code, but a command combination is
|
||||
* being used. Ex: `Cmd+C`. No character is inserted, and no
|
||||
* `input` event will occur.
|
||||
*/
|
||||
if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
|
||||
return String.fromCharCode(nativeEvent.which);
|
||||
}
|
||||
return null;
|
||||
case topLevelTypes.topCompositionEnd:
|
||||
return useFallbackCompositionData ? null : nativeEvent.data;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract a SyntheticInputEvent for `beforeInput`, based on either native
|
||||
* `textInput` or fallback behavior.
|
||||
*
|
||||
* @param {string} topLevelType Record from `EventConstants`.
|
||||
* @param {DOMEventTarget} topLevelTarget The listening component root node.
|
||||
* @param {string} topLevelTargetID ID of `topLevelTarget`.
|
||||
* @param {object} nativeEvent Native browser event.
|
||||
* @return {?object} A SyntheticInputEvent.
|
||||
*/
|
||||
function extractBeforeInputEvent(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID,
|
||||
nativeEvent
|
||||
) {
|
||||
var chars;
|
||||
|
||||
if (canUseTextInputEvent) {
|
||||
chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
|
||||
} else {
|
||||
chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
|
||||
}
|
||||
|
||||
// If no characters are being inserted, no BeforeInput event should
|
||||
// be fired.
|
||||
if (!chars) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var event = SyntheticInputEvent.getPooled(
|
||||
eventTypes.beforeInput,
|
||||
topLevelTargetID,
|
||||
nativeEvent
|
||||
);
|
||||
|
||||
event.data = chars;
|
||||
EventPropagators.accumulateTwoPhaseDispatches(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an `onBeforeInput` event to match
|
||||
* http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
|
||||
*
|
||||
* This event plugin is based on the native `textInput` event
|
||||
* available in Chrome, Safari, Opera, and IE. This event fires after
|
||||
* `onKeyPress` and `onCompositionEnd`, but before `onInput`.
|
||||
*
|
||||
* `beforeInput` is spec'd but not implemented in any browsers, and
|
||||
* the `input` event does not provide any useful information about what has
|
||||
* actually been added, contrary to the spec. Thus, `textInput` is the best
|
||||
* available event to identify the characters that have actually been inserted
|
||||
* into the target node.
|
||||
*
|
||||
* This plugin is also responsible for emitting `composition` events, thus
|
||||
* allowing us to share composition fallback code for both `beforeInput` and
|
||||
* `composition` event types.
|
||||
*/
|
||||
var BeforeInputEventPlugin = {
|
||||
|
||||
eventTypes: eventTypes,
|
||||
|
||||
/**
|
||||
* @param {string} topLevelType Record from `EventConstants`.
|
||||
* @param {DOMEventTarget} topLevelTarget The listening component root node.
|
||||
* @param {string} topLevelTargetID ID of `topLevelTarget`.
|
||||
* @param {object} nativeEvent Native browser event.
|
||||
* @return {*} An accumulation of synthetic events.
|
||||
* @see {EventPluginHub.extractEvents}
|
||||
*/
|
||||
extractEvents: function(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID,
|
||||
nativeEvent
|
||||
) {
|
||||
return [
|
||||
extractCompositionEvent(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID,
|
||||
nativeEvent
|
||||
),
|
||||
extractBeforeInputEvent(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID,
|
||||
nativeEvent
|
||||
)
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = BeforeInputEventPlugin;
|
||||
108
node_modules/jibo-tools/node_modules/react/lib/CSSCore.js
generated
vendored
Normal file
108
node_modules/jibo-tools/node_modules/react/lib/CSSCore.js
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule CSSCore
|
||||
* @typechecks
|
||||
*/
|
||||
|
||||
var invariant = require("./invariant");
|
||||
|
||||
/**
|
||||
* The CSSCore module specifies the API (and implements most of the methods)
|
||||
* that should be used when dealing with the display of elements (via their
|
||||
* CSS classes and visibility on screen. It is an API focused on mutating the
|
||||
* display and not reading it as no logical state should be encoded in the
|
||||
* display of elements.
|
||||
*/
|
||||
|
||||
var CSSCore = {
|
||||
|
||||
/**
|
||||
* Adds the class passed in to the element if it doesn't already have it.
|
||||
*
|
||||
* @param {DOMElement} element the element to set the class on
|
||||
* @param {string} className the CSS className
|
||||
* @return {DOMElement} the element passed in
|
||||
*/
|
||||
addClass: function(element, className) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
!/\s/.test(className),
|
||||
'CSSCore.addClass takes only a single class name. "%s" contains ' +
|
||||
'multiple classes.', className
|
||||
) : invariant(!/\s/.test(className)));
|
||||
|
||||
if (className) {
|
||||
if (element.classList) {
|
||||
element.classList.add(className);
|
||||
} else if (!CSSCore.hasClass(element, className)) {
|
||||
element.className = element.className + ' ' + className;
|
||||
}
|
||||
}
|
||||
return element;
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes the class passed in from the element
|
||||
*
|
||||
* @param {DOMElement} element the element to set the class on
|
||||
* @param {string} className the CSS className
|
||||
* @return {DOMElement} the element passed in
|
||||
*/
|
||||
removeClass: function(element, className) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
!/\s/.test(className),
|
||||
'CSSCore.removeClass takes only a single class name. "%s" contains ' +
|
||||
'multiple classes.', className
|
||||
) : invariant(!/\s/.test(className)));
|
||||
|
||||
if (className) {
|
||||
if (element.classList) {
|
||||
element.classList.remove(className);
|
||||
} else if (CSSCore.hasClass(element, className)) {
|
||||
element.className = element.className
|
||||
.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1')
|
||||
.replace(/\s+/g, ' ') // multiple spaces to one
|
||||
.replace(/^\s*|\s*$/g, ''); // trim the ends
|
||||
}
|
||||
}
|
||||
return element;
|
||||
},
|
||||
|
||||
/**
|
||||
* Helper to add or remove a class from an element based on a condition.
|
||||
*
|
||||
* @param {DOMElement} element the element to set the class on
|
||||
* @param {string} className the CSS className
|
||||
* @param {*} bool condition to whether to add or remove the class
|
||||
* @return {DOMElement} the element passed in
|
||||
*/
|
||||
conditionClass: function(element, className, bool) {
|
||||
return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);
|
||||
},
|
||||
|
||||
/**
|
||||
* Tests whether the element has the class specified.
|
||||
*
|
||||
* @param {DOMNode|DOMWindow} element the element to set the class on
|
||||
* @param {string} className the CSS className
|
||||
* @return {boolean} true if the element has the class, false if not
|
||||
*/
|
||||
hasClass: function(element, className) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
!/\s/.test(className),
|
||||
'CSS.hasClass takes only a single class name.'
|
||||
) : invariant(!/\s/.test(className)));
|
||||
if (element.classList) {
|
||||
return !!className && element.classList.contains(className);
|
||||
}
|
||||
return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports = CSSCore;
|
||||
123
node_modules/jibo-tools/node_modules/react/lib/CSSProperty.js
generated
vendored
Normal file
123
node_modules/jibo-tools/node_modules/react/lib/CSSProperty.js
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule CSSProperty
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* CSS properties which accept numbers but are not in units of "px".
|
||||
*/
|
||||
var isUnitlessNumber = {
|
||||
boxFlex: true,
|
||||
boxFlexGroup: true,
|
||||
columnCount: true,
|
||||
flex: true,
|
||||
flexGrow: true,
|
||||
flexPositive: true,
|
||||
flexShrink: true,
|
||||
flexNegative: true,
|
||||
fontWeight: true,
|
||||
lineClamp: true,
|
||||
lineHeight: true,
|
||||
opacity: true,
|
||||
order: true,
|
||||
orphans: true,
|
||||
widows: true,
|
||||
zIndex: true,
|
||||
zoom: true,
|
||||
|
||||
// SVG-related properties
|
||||
fillOpacity: true,
|
||||
strokeDashoffset: true,
|
||||
strokeOpacity: true,
|
||||
strokeWidth: true
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} prefix vendor-specific prefix, eg: Webkit
|
||||
* @param {string} key style name, eg: transitionDuration
|
||||
* @return {string} style name prefixed with `prefix`, properly camelCased, eg:
|
||||
* WebkitTransitionDuration
|
||||
*/
|
||||
function prefixKey(prefix, key) {
|
||||
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Support style names that may come passed in prefixed by adding permutations
|
||||
* of vendor prefixes.
|
||||
*/
|
||||
var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
|
||||
|
||||
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
|
||||
// infinite loop, because it iterates over the newly added props too.
|
||||
Object.keys(isUnitlessNumber).forEach(function(prop) {
|
||||
prefixes.forEach(function(prefix) {
|
||||
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Most style properties can be unset by doing .style[prop] = '' but IE8
|
||||
* doesn't like doing that with shorthand properties so for the properties that
|
||||
* IE8 breaks on, which are listed here, we instead unset each of the
|
||||
* individual properties. See http://bugs.jquery.com/ticket/12385.
|
||||
* The 4-value 'clock' properties like margin, padding, border-width seem to
|
||||
* behave without any problems. Curiously, list-style works too without any
|
||||
* special prodding.
|
||||
*/
|
||||
var shorthandPropertyExpansions = {
|
||||
background: {
|
||||
backgroundImage: true,
|
||||
backgroundPosition: true,
|
||||
backgroundRepeat: true,
|
||||
backgroundColor: true
|
||||
},
|
||||
border: {
|
||||
borderWidth: true,
|
||||
borderStyle: true,
|
||||
borderColor: true
|
||||
},
|
||||
borderBottom: {
|
||||
borderBottomWidth: true,
|
||||
borderBottomStyle: true,
|
||||
borderBottomColor: true
|
||||
},
|
||||
borderLeft: {
|
||||
borderLeftWidth: true,
|
||||
borderLeftStyle: true,
|
||||
borderLeftColor: true
|
||||
},
|
||||
borderRight: {
|
||||
borderRightWidth: true,
|
||||
borderRightStyle: true,
|
||||
borderRightColor: true
|
||||
},
|
||||
borderTop: {
|
||||
borderTopWidth: true,
|
||||
borderTopStyle: true,
|
||||
borderTopColor: true
|
||||
},
|
||||
font: {
|
||||
fontStyle: true,
|
||||
fontVariant: true,
|
||||
fontWeight: true,
|
||||
fontSize: true,
|
||||
lineHeight: true,
|
||||
fontFamily: true
|
||||
}
|
||||
};
|
||||
|
||||
var CSSProperty = {
|
||||
isUnitlessNumber: isUnitlessNumber,
|
||||
shorthandPropertyExpansions: shorthandPropertyExpansions
|
||||
};
|
||||
|
||||
module.exports = CSSProperty;
|
||||
178
node_modules/jibo-tools/node_modules/react/lib/CSSPropertyOperations.js
generated
vendored
Normal file
178
node_modules/jibo-tools/node_modules/react/lib/CSSPropertyOperations.js
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule CSSPropertyOperations
|
||||
* @typechecks static-only
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var CSSProperty = require("./CSSProperty");
|
||||
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
||||
|
||||
var camelizeStyleName = require("./camelizeStyleName");
|
||||
var dangerousStyleValue = require("./dangerousStyleValue");
|
||||
var hyphenateStyleName = require("./hyphenateStyleName");
|
||||
var memoizeStringOnly = require("./memoizeStringOnly");
|
||||
var warning = require("./warning");
|
||||
|
||||
var processStyleName = memoizeStringOnly(function(styleName) {
|
||||
return hyphenateStyleName(styleName);
|
||||
});
|
||||
|
||||
var styleFloatAccessor = 'cssFloat';
|
||||
if (ExecutionEnvironment.canUseDOM) {
|
||||
// IE8 only supports accessing cssFloat (standard) as styleFloat
|
||||
if (document.documentElement.style.cssFloat === undefined) {
|
||||
styleFloatAccessor = 'styleFloat';
|
||||
}
|
||||
}
|
||||
|
||||
if ("production" !== process.env.NODE_ENV) {
|
||||
// 'msTransform' is correct, but the other prefixes should be capitalized
|
||||
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
|
||||
|
||||
// style values shouldn't contain a semicolon
|
||||
var badStyleValueWithSemicolonPattern = /;\s*$/;
|
||||
|
||||
var warnedStyleNames = {};
|
||||
var warnedStyleValues = {};
|
||||
|
||||
var warnHyphenatedStyleName = function(name) {
|
||||
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
||||
return;
|
||||
}
|
||||
|
||||
warnedStyleNames[name] = true;
|
||||
("production" !== process.env.NODE_ENV ? warning(
|
||||
false,
|
||||
'Unsupported style property %s. Did you mean %s?',
|
||||
name,
|
||||
camelizeStyleName(name)
|
||||
) : null);
|
||||
};
|
||||
|
||||
var warnBadVendoredStyleName = function(name) {
|
||||
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
||||
return;
|
||||
}
|
||||
|
||||
warnedStyleNames[name] = true;
|
||||
("production" !== process.env.NODE_ENV ? warning(
|
||||
false,
|
||||
'Unsupported vendor-prefixed style property %s. Did you mean %s?',
|
||||
name,
|
||||
name.charAt(0).toUpperCase() + name.slice(1)
|
||||
) : null);
|
||||
};
|
||||
|
||||
var warnStyleValueWithSemicolon = function(name, value) {
|
||||
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
|
||||
return;
|
||||
}
|
||||
|
||||
warnedStyleValues[value] = true;
|
||||
("production" !== process.env.NODE_ENV ? warning(
|
||||
false,
|
||||
'Style property values shouldn\'t contain a semicolon. ' +
|
||||
'Try "%s: %s" instead.',
|
||||
name,
|
||||
value.replace(badStyleValueWithSemicolonPattern, '')
|
||||
) : null);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {*} value
|
||||
*/
|
||||
var warnValidStyle = function(name, value) {
|
||||
if (name.indexOf('-') > -1) {
|
||||
warnHyphenatedStyleName(name);
|
||||
} else if (badVendoredStyleNamePattern.test(name)) {
|
||||
warnBadVendoredStyleName(name);
|
||||
} else if (badStyleValueWithSemicolonPattern.test(value)) {
|
||||
warnStyleValueWithSemicolon(name, value);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Operations for dealing with CSS properties.
|
||||
*/
|
||||
var CSSPropertyOperations = {
|
||||
|
||||
/**
|
||||
* Serializes a mapping of style properties for use as inline styles:
|
||||
*
|
||||
* > createMarkupForStyles({width: '200px', height: 0})
|
||||
* "width:200px;height:0;"
|
||||
*
|
||||
* Undefined values are ignored so that declarative programming is easier.
|
||||
* The result should be HTML-escaped before insertion into the DOM.
|
||||
*
|
||||
* @param {object} styles
|
||||
* @return {?string}
|
||||
*/
|
||||
createMarkupForStyles: function(styles) {
|
||||
var serialized = '';
|
||||
for (var styleName in styles) {
|
||||
if (!styles.hasOwnProperty(styleName)) {
|
||||
continue;
|
||||
}
|
||||
var styleValue = styles[styleName];
|
||||
if ("production" !== process.env.NODE_ENV) {
|
||||
warnValidStyle(styleName, styleValue);
|
||||
}
|
||||
if (styleValue != null) {
|
||||
serialized += processStyleName(styleName) + ':';
|
||||
serialized += dangerousStyleValue(styleName, styleValue) + ';';
|
||||
}
|
||||
}
|
||||
return serialized || null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the value for multiple styles on a node. If a value is specified as
|
||||
* '' (empty string), the corresponding style property will be unset.
|
||||
*
|
||||
* @param {DOMElement} node
|
||||
* @param {object} styles
|
||||
*/
|
||||
setValueForStyles: function(node, styles) {
|
||||
var style = node.style;
|
||||
for (var styleName in styles) {
|
||||
if (!styles.hasOwnProperty(styleName)) {
|
||||
continue;
|
||||
}
|
||||
if ("production" !== process.env.NODE_ENV) {
|
||||
warnValidStyle(styleName, styles[styleName]);
|
||||
}
|
||||
var styleValue = dangerousStyleValue(styleName, styles[styleName]);
|
||||
if (styleName === 'float') {
|
||||
styleName = styleFloatAccessor;
|
||||
}
|
||||
if (styleValue) {
|
||||
style[styleName] = styleValue;
|
||||
} else {
|
||||
var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
|
||||
if (expansion) {
|
||||
// Shorthand property that IE8 won't like unsetting, so unset each
|
||||
// component to placate it
|
||||
for (var individualStyleName in expansion) {
|
||||
style[individualStyleName] = '';
|
||||
}
|
||||
} else {
|
||||
style[styleName] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports = CSSPropertyOperations;
|
||||
96
node_modules/jibo-tools/node_modules/react/lib/CallbackQueue.js
generated
vendored
Normal file
96
node_modules/jibo-tools/node_modules/react/lib/CallbackQueue.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule CallbackQueue
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var PooledClass = require("./PooledClass");
|
||||
|
||||
var assign = require("./Object.assign");
|
||||
var invariant = require("./invariant");
|
||||
|
||||
/**
|
||||
* A specialized pseudo-event module to help keep track of components waiting to
|
||||
* be notified when their DOM representations are available for use.
|
||||
*
|
||||
* This implements `PooledClass`, so you should never need to instantiate this.
|
||||
* Instead, use `CallbackQueue.getPooled()`.
|
||||
*
|
||||
* @class ReactMountReady
|
||||
* @implements PooledClass
|
||||
* @internal
|
||||
*/
|
||||
function CallbackQueue() {
|
||||
this._callbacks = null;
|
||||
this._contexts = null;
|
||||
}
|
||||
|
||||
assign(CallbackQueue.prototype, {
|
||||
|
||||
/**
|
||||
* Enqueues a callback to be invoked when `notifyAll` is invoked.
|
||||
*
|
||||
* @param {function} callback Invoked when `notifyAll` is invoked.
|
||||
* @param {?object} context Context to call `callback` with.
|
||||
* @internal
|
||||
*/
|
||||
enqueue: function(callback, context) {
|
||||
this._callbacks = this._callbacks || [];
|
||||
this._contexts = this._contexts || [];
|
||||
this._callbacks.push(callback);
|
||||
this._contexts.push(context);
|
||||
},
|
||||
|
||||
/**
|
||||
* Invokes all enqueued callbacks and clears the queue. This is invoked after
|
||||
* the DOM representation of a component has been created or updated.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
notifyAll: function() {
|
||||
var callbacks = this._callbacks;
|
||||
var contexts = this._contexts;
|
||||
if (callbacks) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
callbacks.length === contexts.length,
|
||||
'Mismatched list of contexts in callback queue'
|
||||
) : invariant(callbacks.length === contexts.length));
|
||||
this._callbacks = null;
|
||||
this._contexts = null;
|
||||
for (var i = 0, l = callbacks.length; i < l; i++) {
|
||||
callbacks[i].call(contexts[i]);
|
||||
}
|
||||
callbacks.length = 0;
|
||||
contexts.length = 0;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets the internal queue.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
reset: function() {
|
||||
this._callbacks = null;
|
||||
this._contexts = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* `PooledClass` looks for this.
|
||||
*/
|
||||
destructor: function() {
|
||||
this.reset();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
PooledClass.addPoolingTo(CallbackQueue);
|
||||
|
||||
module.exports = CallbackQueue;
|
||||
380
node_modules/jibo-tools/node_modules/react/lib/ChangeEventPlugin.js
generated
vendored
Normal file
380
node_modules/jibo-tools/node_modules/react/lib/ChangeEventPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,380 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule ChangeEventPlugin
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var EventConstants = require("./EventConstants");
|
||||
var EventPluginHub = require("./EventPluginHub");
|
||||
var EventPropagators = require("./EventPropagators");
|
||||
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
||||
var ReactUpdates = require("./ReactUpdates");
|
||||
var SyntheticEvent = require("./SyntheticEvent");
|
||||
|
||||
var isEventSupported = require("./isEventSupported");
|
||||
var isTextInputElement = require("./isTextInputElement");
|
||||
var keyOf = require("./keyOf");
|
||||
|
||||
var topLevelTypes = EventConstants.topLevelTypes;
|
||||
|
||||
var eventTypes = {
|
||||
change: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: keyOf({onChange: null}),
|
||||
captured: keyOf({onChangeCapture: null})
|
||||
},
|
||||
dependencies: [
|
||||
topLevelTypes.topBlur,
|
||||
topLevelTypes.topChange,
|
||||
topLevelTypes.topClick,
|
||||
topLevelTypes.topFocus,
|
||||
topLevelTypes.topInput,
|
||||
topLevelTypes.topKeyDown,
|
||||
topLevelTypes.topKeyUp,
|
||||
topLevelTypes.topSelectionChange
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* For IE shims
|
||||
*/
|
||||
var activeElement = null;
|
||||
var activeElementID = null;
|
||||
var activeElementValue = null;
|
||||
var activeElementValueProp = null;
|
||||
|
||||
/**
|
||||
* SECTION: handle `change` event
|
||||
*/
|
||||
function shouldUseChangeEvent(elem) {
|
||||
return (
|
||||
elem.nodeName === 'SELECT' ||
|
||||
(elem.nodeName === 'INPUT' && elem.type === 'file')
|
||||
);
|
||||
}
|
||||
|
||||
var doesChangeEventBubble = false;
|
||||
if (ExecutionEnvironment.canUseDOM) {
|
||||
// See `handleChange` comment below
|
||||
doesChangeEventBubble = isEventSupported('change') && (
|
||||
(!('documentMode' in document) || document.documentMode > 8)
|
||||
);
|
||||
}
|
||||
|
||||
function manualDispatchChangeEvent(nativeEvent) {
|
||||
var event = SyntheticEvent.getPooled(
|
||||
eventTypes.change,
|
||||
activeElementID,
|
||||
nativeEvent
|
||||
);
|
||||
EventPropagators.accumulateTwoPhaseDispatches(event);
|
||||
|
||||
// If change and propertychange bubbled, we'd just bind to it like all the
|
||||
// other events and have it go through ReactBrowserEventEmitter. Since it
|
||||
// doesn't, we manually listen for the events and so we have to enqueue and
|
||||
// process the abstract event manually.
|
||||
//
|
||||
// Batching is necessary here in order to ensure that all event handlers run
|
||||
// before the next rerender (including event handlers attached to ancestor
|
||||
// elements instead of directly on the input). Without this, controlled
|
||||
// components don't work properly in conjunction with event bubbling because
|
||||
// the component is rerendered and the value reverted before all the event
|
||||
// handlers can run. See https://github.com/facebook/react/issues/708.
|
||||
ReactUpdates.batchedUpdates(runEventInBatch, event);
|
||||
}
|
||||
|
||||
function runEventInBatch(event) {
|
||||
EventPluginHub.enqueueEvents(event);
|
||||
EventPluginHub.processEventQueue();
|
||||
}
|
||||
|
||||
function startWatchingForChangeEventIE8(target, targetID) {
|
||||
activeElement = target;
|
||||
activeElementID = targetID;
|
||||
activeElement.attachEvent('onchange', manualDispatchChangeEvent);
|
||||
}
|
||||
|
||||
function stopWatchingForChangeEventIE8() {
|
||||
if (!activeElement) {
|
||||
return;
|
||||
}
|
||||
activeElement.detachEvent('onchange', manualDispatchChangeEvent);
|
||||
activeElement = null;
|
||||
activeElementID = null;
|
||||
}
|
||||
|
||||
function getTargetIDForChangeEvent(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID) {
|
||||
if (topLevelType === topLevelTypes.topChange) {
|
||||
return topLevelTargetID;
|
||||
}
|
||||
}
|
||||
function handleEventsForChangeEventIE8(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID) {
|
||||
if (topLevelType === topLevelTypes.topFocus) {
|
||||
// stopWatching() should be a noop here but we call it just in case we
|
||||
// missed a blur event somehow.
|
||||
stopWatchingForChangeEventIE8();
|
||||
startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
|
||||
} else if (topLevelType === topLevelTypes.topBlur) {
|
||||
stopWatchingForChangeEventIE8();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SECTION: handle `input` event
|
||||
*/
|
||||
var isInputEventSupported = false;
|
||||
if (ExecutionEnvironment.canUseDOM) {
|
||||
// IE9 claims to support the input event but fails to trigger it when
|
||||
// deleting text, so we ignore its input events
|
||||
isInputEventSupported = isEventSupported('input') && (
|
||||
(!('documentMode' in document) || document.documentMode > 9)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* (For old IE.) Replacement getter/setter for the `value` property that gets
|
||||
* set on the active element.
|
||||
*/
|
||||
var newValueProp = {
|
||||
get: function() {
|
||||
return activeElementValueProp.get.call(this);
|
||||
},
|
||||
set: function(val) {
|
||||
// Cast to a string so we can do equality checks.
|
||||
activeElementValue = '' + val;
|
||||
activeElementValueProp.set.call(this, val);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* (For old IE.) Starts tracking propertychange events on the passed-in element
|
||||
* and override the value property so that we can distinguish user events from
|
||||
* value changes in JS.
|
||||
*/
|
||||
function startWatchingForValueChange(target, targetID) {
|
||||
activeElement = target;
|
||||
activeElementID = targetID;
|
||||
activeElementValue = target.value;
|
||||
activeElementValueProp = Object.getOwnPropertyDescriptor(
|
||||
target.constructor.prototype,
|
||||
'value'
|
||||
);
|
||||
|
||||
Object.defineProperty(activeElement, 'value', newValueProp);
|
||||
activeElement.attachEvent('onpropertychange', handlePropertyChange);
|
||||
}
|
||||
|
||||
/**
|
||||
* (For old IE.) Removes the event listeners from the currently-tracked element,
|
||||
* if any exists.
|
||||
*/
|
||||
function stopWatchingForValueChange() {
|
||||
if (!activeElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
// delete restores the original property definition
|
||||
delete activeElement.value;
|
||||
activeElement.detachEvent('onpropertychange', handlePropertyChange);
|
||||
|
||||
activeElement = null;
|
||||
activeElementID = null;
|
||||
activeElementValue = null;
|
||||
activeElementValueProp = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* (For old IE.) Handles a propertychange event, sending a `change` event if
|
||||
* the value of the active element has changed.
|
||||
*/
|
||||
function handlePropertyChange(nativeEvent) {
|
||||
if (nativeEvent.propertyName !== 'value') {
|
||||
return;
|
||||
}
|
||||
var value = nativeEvent.srcElement.value;
|
||||
if (value === activeElementValue) {
|
||||
return;
|
||||
}
|
||||
activeElementValue = value;
|
||||
|
||||
manualDispatchChangeEvent(nativeEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* If a `change` event should be fired, returns the target's ID.
|
||||
*/
|
||||
function getTargetIDForInputEvent(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID) {
|
||||
if (topLevelType === topLevelTypes.topInput) {
|
||||
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
|
||||
// what we want so fall through here and trigger an abstract event
|
||||
return topLevelTargetID;
|
||||
}
|
||||
}
|
||||
|
||||
// For IE8 and IE9.
|
||||
function handleEventsForInputEventIE(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID) {
|
||||
if (topLevelType === topLevelTypes.topFocus) {
|
||||
// In IE8, we can capture almost all .value changes by adding a
|
||||
// propertychange handler and looking for events with propertyName
|
||||
// equal to 'value'
|
||||
// In IE9, propertychange fires for most input events but is buggy and
|
||||
// doesn't fire when text is deleted, but conveniently, selectionchange
|
||||
// appears to fire in all of the remaining cases so we catch those and
|
||||
// forward the event if the value has changed
|
||||
// In either case, we don't want to call the event handler if the value
|
||||
// is changed from JS so we redefine a setter for `.value` that updates
|
||||
// our activeElementValue variable, allowing us to ignore those changes
|
||||
//
|
||||
// stopWatching() should be a noop here but we call it just in case we
|
||||
// missed a blur event somehow.
|
||||
stopWatchingForValueChange();
|
||||
startWatchingForValueChange(topLevelTarget, topLevelTargetID);
|
||||
} else if (topLevelType === topLevelTypes.topBlur) {
|
||||
stopWatchingForValueChange();
|
||||
}
|
||||
}
|
||||
|
||||
// For IE8 and IE9.
|
||||
function getTargetIDForInputEventIE(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID) {
|
||||
if (topLevelType === topLevelTypes.topSelectionChange ||
|
||||
topLevelType === topLevelTypes.topKeyUp ||
|
||||
topLevelType === topLevelTypes.topKeyDown) {
|
||||
// On the selectionchange event, the target is just document which isn't
|
||||
// helpful for us so just check activeElement instead.
|
||||
//
|
||||
// 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
|
||||
// propertychange on the first input event after setting `value` from a
|
||||
// script and fires only keydown, keypress, keyup. Catching keyup usually
|
||||
// gets it and catching keydown lets us fire an event for the first
|
||||
// keystroke if user does a key repeat (it'll be a little delayed: right
|
||||
// before the second keystroke). Other input methods (e.g., paste) seem to
|
||||
// fire selectionchange normally.
|
||||
if (activeElement && activeElement.value !== activeElementValue) {
|
||||
activeElementValue = activeElement.value;
|
||||
return activeElementID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SECTION: handle `click` event
|
||||
*/
|
||||
function shouldUseClickEvent(elem) {
|
||||
// Use the `click` event to detect changes to checkbox and radio inputs.
|
||||
// This approach works across all browsers, whereas `change` does not fire
|
||||
// until `blur` in IE8.
|
||||
return (
|
||||
elem.nodeName === 'INPUT' &&
|
||||
(elem.type === 'checkbox' || elem.type === 'radio')
|
||||
);
|
||||
}
|
||||
|
||||
function getTargetIDForClickEvent(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID) {
|
||||
if (topLevelType === topLevelTypes.topClick) {
|
||||
return topLevelTargetID;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This plugin creates an `onChange` event that normalizes change events
|
||||
* across form elements. This event fires at a time when it's possible to
|
||||
* change the element's value without seeing a flicker.
|
||||
*
|
||||
* Supported elements are:
|
||||
* - input (see `isTextInputElement`)
|
||||
* - textarea
|
||||
* - select
|
||||
*/
|
||||
var ChangeEventPlugin = {
|
||||
|
||||
eventTypes: eventTypes,
|
||||
|
||||
/**
|
||||
* @param {string} topLevelType Record from `EventConstants`.
|
||||
* @param {DOMEventTarget} topLevelTarget The listening component root node.
|
||||
* @param {string} topLevelTargetID ID of `topLevelTarget`.
|
||||
* @param {object} nativeEvent Native browser event.
|
||||
* @return {*} An accumulation of synthetic events.
|
||||
* @see {EventPluginHub.extractEvents}
|
||||
*/
|
||||
extractEvents: function(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID,
|
||||
nativeEvent) {
|
||||
|
||||
var getTargetIDFunc, handleEventFunc;
|
||||
if (shouldUseChangeEvent(topLevelTarget)) {
|
||||
if (doesChangeEventBubble) {
|
||||
getTargetIDFunc = getTargetIDForChangeEvent;
|
||||
} else {
|
||||
handleEventFunc = handleEventsForChangeEventIE8;
|
||||
}
|
||||
} else if (isTextInputElement(topLevelTarget)) {
|
||||
if (isInputEventSupported) {
|
||||
getTargetIDFunc = getTargetIDForInputEvent;
|
||||
} else {
|
||||
getTargetIDFunc = getTargetIDForInputEventIE;
|
||||
handleEventFunc = handleEventsForInputEventIE;
|
||||
}
|
||||
} else if (shouldUseClickEvent(topLevelTarget)) {
|
||||
getTargetIDFunc = getTargetIDForClickEvent;
|
||||
}
|
||||
|
||||
if (getTargetIDFunc) {
|
||||
var targetID = getTargetIDFunc(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID
|
||||
);
|
||||
if (targetID) {
|
||||
var event = SyntheticEvent.getPooled(
|
||||
eventTypes.change,
|
||||
targetID,
|
||||
nativeEvent
|
||||
);
|
||||
EventPropagators.accumulateTwoPhaseDispatches(event);
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
||||
if (handleEventFunc) {
|
||||
handleEventFunc(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports = ChangeEventPlugin;
|
||||
23
node_modules/jibo-tools/node_modules/react/lib/ClientReactRootIndex.js
generated
vendored
Normal file
23
node_modules/jibo-tools/node_modules/react/lib/ClientReactRootIndex.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule ClientReactRootIndex
|
||||
* @typechecks
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var nextReactRootIndex = 0;
|
||||
|
||||
var ClientReactRootIndex = {
|
||||
createReactRootIndex: function() {
|
||||
return nextReactRootIndex++;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ClientReactRootIndex;
|
||||
134
node_modules/jibo-tools/node_modules/react/lib/DOMChildrenOperations.js
generated
vendored
Normal file
134
node_modules/jibo-tools/node_modules/react/lib/DOMChildrenOperations.js
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule DOMChildrenOperations
|
||||
* @typechecks static-only
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var Danger = require("./Danger");
|
||||
var ReactMultiChildUpdateTypes = require("./ReactMultiChildUpdateTypes");
|
||||
|
||||
var setTextContent = require("./setTextContent");
|
||||
var invariant = require("./invariant");
|
||||
|
||||
/**
|
||||
* Inserts `childNode` as a child of `parentNode` at the `index`.
|
||||
*
|
||||
* @param {DOMElement} parentNode Parent node in which to insert.
|
||||
* @param {DOMElement} childNode Child node to insert.
|
||||
* @param {number} index Index at which to insert the child.
|
||||
* @internal
|
||||
*/
|
||||
function insertChildAt(parentNode, childNode, index) {
|
||||
// By exploiting arrays returning `undefined` for an undefined index, we can
|
||||
// rely exclusively on `insertBefore(node, null)` instead of also using
|
||||
// `appendChild(node)`. However, using `undefined` is not allowed by all
|
||||
// browsers so we must replace it with `null`.
|
||||
parentNode.insertBefore(
|
||||
childNode,
|
||||
parentNode.childNodes[index] || null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operations for updating with DOM children.
|
||||
*/
|
||||
var DOMChildrenOperations = {
|
||||
|
||||
dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
|
||||
|
||||
updateTextContent: setTextContent,
|
||||
|
||||
/**
|
||||
* Updates a component's children by processing a series of updates. The
|
||||
* update configurations are each expected to have a `parentNode` property.
|
||||
*
|
||||
* @param {array<object>} updates List of update configurations.
|
||||
* @param {array<string>} markupList List of markup strings.
|
||||
* @internal
|
||||
*/
|
||||
processUpdates: function(updates, markupList) {
|
||||
var update;
|
||||
// Mapping from parent IDs to initial child orderings.
|
||||
var initialChildren = null;
|
||||
// List of children that will be moved or removed.
|
||||
var updatedChildren = null;
|
||||
|
||||
for (var i = 0; i < updates.length; i++) {
|
||||
update = updates[i];
|
||||
if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||
|
||||
update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
|
||||
var updatedIndex = update.fromIndex;
|
||||
var updatedChild = update.parentNode.childNodes[updatedIndex];
|
||||
var parentID = update.parentID;
|
||||
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
updatedChild,
|
||||
'processUpdates(): Unable to find child %s of element. This ' +
|
||||
'probably means the DOM was unexpectedly mutated (e.g., by the ' +
|
||||
'browser), usually due to forgetting a <tbody> when using tables, ' +
|
||||
'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' +
|
||||
'in an <svg> parent. Try inspecting the child nodes of the element ' +
|
||||
'with React ID `%s`.',
|
||||
updatedIndex,
|
||||
parentID
|
||||
) : invariant(updatedChild));
|
||||
|
||||
initialChildren = initialChildren || {};
|
||||
initialChildren[parentID] = initialChildren[parentID] || [];
|
||||
initialChildren[parentID][updatedIndex] = updatedChild;
|
||||
|
||||
updatedChildren = updatedChildren || [];
|
||||
updatedChildren.push(updatedChild);
|
||||
}
|
||||
}
|
||||
|
||||
var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
|
||||
|
||||
// Remove updated children first so that `toIndex` is consistent.
|
||||
if (updatedChildren) {
|
||||
for (var j = 0; j < updatedChildren.length; j++) {
|
||||
updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
|
||||
}
|
||||
}
|
||||
|
||||
for (var k = 0; k < updates.length; k++) {
|
||||
update = updates[k];
|
||||
switch (update.type) {
|
||||
case ReactMultiChildUpdateTypes.INSERT_MARKUP:
|
||||
insertChildAt(
|
||||
update.parentNode,
|
||||
renderedMarkup[update.markupIndex],
|
||||
update.toIndex
|
||||
);
|
||||
break;
|
||||
case ReactMultiChildUpdateTypes.MOVE_EXISTING:
|
||||
insertChildAt(
|
||||
update.parentNode,
|
||||
initialChildren[update.parentID][update.fromIndex],
|
||||
update.toIndex
|
||||
);
|
||||
break;
|
||||
case ReactMultiChildUpdateTypes.TEXT_CONTENT:
|
||||
setTextContent(
|
||||
update.parentNode,
|
||||
update.textContent
|
||||
);
|
||||
break;
|
||||
case ReactMultiChildUpdateTypes.REMOVE_NODE:
|
||||
// Already removed by the for-loop above.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports = DOMChildrenOperations;
|
||||
295
node_modules/jibo-tools/node_modules/react/lib/DOMProperty.js
generated
vendored
Normal file
295
node_modules/jibo-tools/node_modules/react/lib/DOMProperty.js
generated
vendored
Normal file
@@ -0,0 +1,295 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule DOMProperty
|
||||
* @typechecks static-only
|
||||
*/
|
||||
|
||||
/*jslint bitwise: true */
|
||||
|
||||
'use strict';
|
||||
|
||||
var invariant = require("./invariant");
|
||||
|
||||
function checkMask(value, bitmask) {
|
||||
return (value & bitmask) === bitmask;
|
||||
}
|
||||
|
||||
var DOMPropertyInjection = {
|
||||
/**
|
||||
* Mapping from normalized, camelcased property names to a configuration that
|
||||
* specifies how the associated DOM property should be accessed or rendered.
|
||||
*/
|
||||
MUST_USE_ATTRIBUTE: 0x1,
|
||||
MUST_USE_PROPERTY: 0x2,
|
||||
HAS_SIDE_EFFECTS: 0x4,
|
||||
HAS_BOOLEAN_VALUE: 0x8,
|
||||
HAS_NUMERIC_VALUE: 0x10,
|
||||
HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
|
||||
HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
|
||||
|
||||
/**
|
||||
* Inject some specialized knowledge about the DOM. This takes a config object
|
||||
* with the following properties:
|
||||
*
|
||||
* isCustomAttribute: function that given an attribute name will return true
|
||||
* if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
|
||||
* attributes where it's impossible to enumerate all of the possible
|
||||
* attribute names,
|
||||
*
|
||||
* Properties: object mapping DOM property name to one of the
|
||||
* DOMPropertyInjection constants or null. If your attribute isn't in here,
|
||||
* it won't get written to the DOM.
|
||||
*
|
||||
* DOMAttributeNames: object mapping React attribute name to the DOM
|
||||
* attribute name. Attribute names not specified use the **lowercase**
|
||||
* normalized name.
|
||||
*
|
||||
* DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
|
||||
* Property names not specified use the normalized name.
|
||||
*
|
||||
* DOMMutationMethods: Properties that require special mutation methods. If
|
||||
* `value` is undefined, the mutation method should unset the property.
|
||||
*
|
||||
* @param {object} domPropertyConfig the config as described above.
|
||||
*/
|
||||
injectDOMPropertyConfig: function(domPropertyConfig) {
|
||||
var Properties = domPropertyConfig.Properties || {};
|
||||
var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
|
||||
var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
|
||||
var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
|
||||
|
||||
if (domPropertyConfig.isCustomAttribute) {
|
||||
DOMProperty._isCustomAttributeFunctions.push(
|
||||
domPropertyConfig.isCustomAttribute
|
||||
);
|
||||
}
|
||||
|
||||
for (var propName in Properties) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
!DOMProperty.isStandardName.hasOwnProperty(propName),
|
||||
'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' +
|
||||
'\'%s\' which has already been injected. You may be accidentally ' +
|
||||
'injecting the same DOM property config twice, or you may be ' +
|
||||
'injecting two configs that have conflicting property names.',
|
||||
propName
|
||||
) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName)));
|
||||
|
||||
DOMProperty.isStandardName[propName] = true;
|
||||
|
||||
var lowerCased = propName.toLowerCase();
|
||||
DOMProperty.getPossibleStandardName[lowerCased] = propName;
|
||||
|
||||
if (DOMAttributeNames.hasOwnProperty(propName)) {
|
||||
var attributeName = DOMAttributeNames[propName];
|
||||
DOMProperty.getPossibleStandardName[attributeName] = propName;
|
||||
DOMProperty.getAttributeName[propName] = attributeName;
|
||||
} else {
|
||||
DOMProperty.getAttributeName[propName] = lowerCased;
|
||||
}
|
||||
|
||||
DOMProperty.getPropertyName[propName] =
|
||||
DOMPropertyNames.hasOwnProperty(propName) ?
|
||||
DOMPropertyNames[propName] :
|
||||
propName;
|
||||
|
||||
if (DOMMutationMethods.hasOwnProperty(propName)) {
|
||||
DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];
|
||||
} else {
|
||||
DOMProperty.getMutationMethod[propName] = null;
|
||||
}
|
||||
|
||||
var propConfig = Properties[propName];
|
||||
DOMProperty.mustUseAttribute[propName] =
|
||||
checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE);
|
||||
DOMProperty.mustUseProperty[propName] =
|
||||
checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY);
|
||||
DOMProperty.hasSideEffects[propName] =
|
||||
checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS);
|
||||
DOMProperty.hasBooleanValue[propName] =
|
||||
checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE);
|
||||
DOMProperty.hasNumericValue[propName] =
|
||||
checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE);
|
||||
DOMProperty.hasPositiveNumericValue[propName] =
|
||||
checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE);
|
||||
DOMProperty.hasOverloadedBooleanValue[propName] =
|
||||
checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE);
|
||||
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
!DOMProperty.mustUseAttribute[propName] ||
|
||||
!DOMProperty.mustUseProperty[propName],
|
||||
'DOMProperty: Cannot require using both attribute and property: %s',
|
||||
propName
|
||||
) : invariant(!DOMProperty.mustUseAttribute[propName] ||
|
||||
!DOMProperty.mustUseProperty[propName]));
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
DOMProperty.mustUseProperty[propName] ||
|
||||
!DOMProperty.hasSideEffects[propName],
|
||||
'DOMProperty: Properties that have side effects must use property: %s',
|
||||
propName
|
||||
) : invariant(DOMProperty.mustUseProperty[propName] ||
|
||||
!DOMProperty.hasSideEffects[propName]));
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
!!DOMProperty.hasBooleanValue[propName] +
|
||||
!!DOMProperty.hasNumericValue[propName] +
|
||||
!!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,
|
||||
'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
|
||||
'numeric value, but not a combination: %s',
|
||||
propName
|
||||
) : invariant(!!DOMProperty.hasBooleanValue[propName] +
|
||||
!!DOMProperty.hasNumericValue[propName] +
|
||||
!!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));
|
||||
}
|
||||
}
|
||||
};
|
||||
var defaultValueCache = {};
|
||||
|
||||
/**
|
||||
* DOMProperty exports lookup objects that can be used like functions:
|
||||
*
|
||||
* > DOMProperty.isValid['id']
|
||||
* true
|
||||
* > DOMProperty.isValid['foobar']
|
||||
* undefined
|
||||
*
|
||||
* Although this may be confusing, it performs better in general.
|
||||
*
|
||||
* @see http://jsperf.com/key-exists
|
||||
* @see http://jsperf.com/key-missing
|
||||
*/
|
||||
var DOMProperty = {
|
||||
|
||||
ID_ATTRIBUTE_NAME: 'data-reactid',
|
||||
|
||||
/**
|
||||
* Checks whether a property name is a standard property.
|
||||
* @type {Object}
|
||||
*/
|
||||
isStandardName: {},
|
||||
|
||||
/**
|
||||
* Mapping from lowercase property names to the properly cased version, used
|
||||
* to warn in the case of missing properties.
|
||||
* @type {Object}
|
||||
*/
|
||||
getPossibleStandardName: {},
|
||||
|
||||
/**
|
||||
* Mapping from normalized names to attribute names that differ. Attribute
|
||||
* names are used when rendering markup or with `*Attribute()`.
|
||||
* @type {Object}
|
||||
*/
|
||||
getAttributeName: {},
|
||||
|
||||
/**
|
||||
* Mapping from normalized names to properties on DOM node instances.
|
||||
* (This includes properties that mutate due to external factors.)
|
||||
* @type {Object}
|
||||
*/
|
||||
getPropertyName: {},
|
||||
|
||||
/**
|
||||
* Mapping from normalized names to mutation methods. This will only exist if
|
||||
* mutation cannot be set simply by the property or `setAttribute()`.
|
||||
* @type {Object}
|
||||
*/
|
||||
getMutationMethod: {},
|
||||
|
||||
/**
|
||||
* Whether the property must be accessed and mutated as an object property.
|
||||
* @type {Object}
|
||||
*/
|
||||
mustUseAttribute: {},
|
||||
|
||||
/**
|
||||
* Whether the property must be accessed and mutated using `*Attribute()`.
|
||||
* (This includes anything that fails `<propName> in <element>`.)
|
||||
* @type {Object}
|
||||
*/
|
||||
mustUseProperty: {},
|
||||
|
||||
/**
|
||||
* Whether or not setting a value causes side effects such as triggering
|
||||
* resources to be loaded or text selection changes. We must ensure that
|
||||
* the value is only set if it has changed.
|
||||
* @type {Object}
|
||||
*/
|
||||
hasSideEffects: {},
|
||||
|
||||
/**
|
||||
* Whether the property should be removed when set to a falsey value.
|
||||
* @type {Object}
|
||||
*/
|
||||
hasBooleanValue: {},
|
||||
|
||||
/**
|
||||
* Whether the property must be numeric or parse as a
|
||||
* numeric and should be removed when set to a falsey value.
|
||||
* @type {Object}
|
||||
*/
|
||||
hasNumericValue: {},
|
||||
|
||||
/**
|
||||
* Whether the property must be positive numeric or parse as a positive
|
||||
* numeric and should be removed when set to a falsey value.
|
||||
* @type {Object}
|
||||
*/
|
||||
hasPositiveNumericValue: {},
|
||||
|
||||
/**
|
||||
* Whether the property can be used as a flag as well as with a value. Removed
|
||||
* when strictly equal to false; present without a value when strictly equal
|
||||
* to true; present with a value otherwise.
|
||||
* @type {Object}
|
||||
*/
|
||||
hasOverloadedBooleanValue: {},
|
||||
|
||||
/**
|
||||
* All of the isCustomAttribute() functions that have been injected.
|
||||
*/
|
||||
_isCustomAttributeFunctions: [],
|
||||
|
||||
/**
|
||||
* Checks whether a property name is a custom attribute.
|
||||
* @method
|
||||
*/
|
||||
isCustomAttribute: function(attributeName) {
|
||||
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
|
||||
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
|
||||
if (isCustomAttributeFn(attributeName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the default property value for a DOM property (i.e., not an
|
||||
* attribute). Most default values are '' or false, but not all. Worse yet,
|
||||
* some (in particular, `type`) vary depending on the type of element.
|
||||
*
|
||||
* TODO: Is it better to grab all the possible properties when creating an
|
||||
* element to avoid having to create the same element twice?
|
||||
*/
|
||||
getDefaultValueForProperty: function(nodeName, prop) {
|
||||
var nodeDefaults = defaultValueCache[nodeName];
|
||||
var testElement;
|
||||
if (!nodeDefaults) {
|
||||
defaultValueCache[nodeName] = nodeDefaults = {};
|
||||
}
|
||||
if (!(prop in nodeDefaults)) {
|
||||
testElement = document.createElement(nodeName);
|
||||
nodeDefaults[prop] = testElement[prop];
|
||||
}
|
||||
return nodeDefaults[prop];
|
||||
},
|
||||
|
||||
injection: DOMPropertyInjection
|
||||
};
|
||||
|
||||
module.exports = DOMProperty;
|
||||
188
node_modules/jibo-tools/node_modules/react/lib/DOMPropertyOperations.js
generated
vendored
Normal file
188
node_modules/jibo-tools/node_modules/react/lib/DOMPropertyOperations.js
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule DOMPropertyOperations
|
||||
* @typechecks static-only
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var DOMProperty = require("./DOMProperty");
|
||||
|
||||
var quoteAttributeValueForBrowser = require("./quoteAttributeValueForBrowser");
|
||||
var warning = require("./warning");
|
||||
|
||||
function shouldIgnoreValue(name, value) {
|
||||
return value == null ||
|
||||
(DOMProperty.hasBooleanValue[name] && !value) ||
|
||||
(DOMProperty.hasNumericValue[name] && isNaN(value)) ||
|
||||
(DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
|
||||
(DOMProperty.hasOverloadedBooleanValue[name] && value === false);
|
||||
}
|
||||
|
||||
if ("production" !== process.env.NODE_ENV) {
|
||||
var reactProps = {
|
||||
children: true,
|
||||
dangerouslySetInnerHTML: true,
|
||||
key: true,
|
||||
ref: true
|
||||
};
|
||||
var warnedProperties = {};
|
||||
|
||||
var warnUnknownProperty = function(name) {
|
||||
if (reactProps.hasOwnProperty(name) && reactProps[name] ||
|
||||
warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
|
||||
return;
|
||||
}
|
||||
|
||||
warnedProperties[name] = true;
|
||||
var lowerCasedName = name.toLowerCase();
|
||||
|
||||
// data-* attributes should be lowercase; suggest the lowercase version
|
||||
var standardName = (
|
||||
DOMProperty.isCustomAttribute(lowerCasedName) ?
|
||||
lowerCasedName :
|
||||
DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
|
||||
DOMProperty.getPossibleStandardName[lowerCasedName] :
|
||||
null
|
||||
);
|
||||
|
||||
// For now, only warn when we have a suggested correction. This prevents
|
||||
// logging too much when using transferPropsTo.
|
||||
("production" !== process.env.NODE_ENV ? warning(
|
||||
standardName == null,
|
||||
'Unknown DOM property %s. Did you mean %s?',
|
||||
name,
|
||||
standardName
|
||||
) : null);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Operations for dealing with DOM properties.
|
||||
*/
|
||||
var DOMPropertyOperations = {
|
||||
|
||||
/**
|
||||
* Creates markup for the ID property.
|
||||
*
|
||||
* @param {string} id Unescaped ID.
|
||||
* @return {string} Markup string.
|
||||
*/
|
||||
createMarkupForID: function(id) {
|
||||
return DOMProperty.ID_ATTRIBUTE_NAME + '=' +
|
||||
quoteAttributeValueForBrowser(id);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates markup for a property.
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {*} value
|
||||
* @return {?string} Markup string, or null if the property was invalid.
|
||||
*/
|
||||
createMarkupForProperty: function(name, value) {
|
||||
if (DOMProperty.isStandardName.hasOwnProperty(name) &&
|
||||
DOMProperty.isStandardName[name]) {
|
||||
if (shouldIgnoreValue(name, value)) {
|
||||
return '';
|
||||
}
|
||||
var attributeName = DOMProperty.getAttributeName[name];
|
||||
if (DOMProperty.hasBooleanValue[name] ||
|
||||
(DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
|
||||
return attributeName;
|
||||
}
|
||||
return attributeName + '=' + quoteAttributeValueForBrowser(value);
|
||||
} else if (DOMProperty.isCustomAttribute(name)) {
|
||||
if (value == null) {
|
||||
return '';
|
||||
}
|
||||
return name + '=' + quoteAttributeValueForBrowser(value);
|
||||
} else if ("production" !== process.env.NODE_ENV) {
|
||||
warnUnknownProperty(name);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the value for a property on a node.
|
||||
*
|
||||
* @param {DOMElement} node
|
||||
* @param {string} name
|
||||
* @param {*} value
|
||||
*/
|
||||
setValueForProperty: function(node, name, value) {
|
||||
if (DOMProperty.isStandardName.hasOwnProperty(name) &&
|
||||
DOMProperty.isStandardName[name]) {
|
||||
var mutationMethod = DOMProperty.getMutationMethod[name];
|
||||
if (mutationMethod) {
|
||||
mutationMethod(node, value);
|
||||
} else if (shouldIgnoreValue(name, value)) {
|
||||
this.deleteValueForProperty(node, name);
|
||||
} else if (DOMProperty.mustUseAttribute[name]) {
|
||||
// `setAttribute` with objects becomes only `[object]` in IE8/9,
|
||||
// ('' + value) makes it output the correct toString()-value.
|
||||
node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
|
||||
} else {
|
||||
var propName = DOMProperty.getPropertyName[name];
|
||||
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
|
||||
// property type before comparing; only `value` does and is string.
|
||||
if (!DOMProperty.hasSideEffects[name] ||
|
||||
('' + node[propName]) !== ('' + value)) {
|
||||
// Contrary to `setAttribute`, object properties are properly
|
||||
// `toString`ed by IE8/9.
|
||||
node[propName] = value;
|
||||
}
|
||||
}
|
||||
} else if (DOMProperty.isCustomAttribute(name)) {
|
||||
if (value == null) {
|
||||
node.removeAttribute(name);
|
||||
} else {
|
||||
node.setAttribute(name, '' + value);
|
||||
}
|
||||
} else if ("production" !== process.env.NODE_ENV) {
|
||||
warnUnknownProperty(name);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Deletes the value for a property on a node.
|
||||
*
|
||||
* @param {DOMElement} node
|
||||
* @param {string} name
|
||||
*/
|
||||
deleteValueForProperty: function(node, name) {
|
||||
if (DOMProperty.isStandardName.hasOwnProperty(name) &&
|
||||
DOMProperty.isStandardName[name]) {
|
||||
var mutationMethod = DOMProperty.getMutationMethod[name];
|
||||
if (mutationMethod) {
|
||||
mutationMethod(node, undefined);
|
||||
} else if (DOMProperty.mustUseAttribute[name]) {
|
||||
node.removeAttribute(DOMProperty.getAttributeName[name]);
|
||||
} else {
|
||||
var propName = DOMProperty.getPropertyName[name];
|
||||
var defaultValue = DOMProperty.getDefaultValueForProperty(
|
||||
node.nodeName,
|
||||
propName
|
||||
);
|
||||
if (!DOMProperty.hasSideEffects[name] ||
|
||||
('' + node[propName]) !== defaultValue) {
|
||||
node[propName] = defaultValue;
|
||||
}
|
||||
}
|
||||
} else if (DOMProperty.isCustomAttribute(name)) {
|
||||
node.removeAttribute(name);
|
||||
} else if ("production" !== process.env.NODE_ENV) {
|
||||
warnUnknownProperty(name);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports = DOMPropertyOperations;
|
||||
183
node_modules/jibo-tools/node_modules/react/lib/Danger.js
generated
vendored
Normal file
183
node_modules/jibo-tools/node_modules/react/lib/Danger.js
generated
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule Danger
|
||||
* @typechecks static-only
|
||||
*/
|
||||
|
||||
/*jslint evil: true, sub: true */
|
||||
|
||||
'use strict';
|
||||
|
||||
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
||||
|
||||
var createNodesFromMarkup = require("./createNodesFromMarkup");
|
||||
var emptyFunction = require("./emptyFunction");
|
||||
var getMarkupWrap = require("./getMarkupWrap");
|
||||
var invariant = require("./invariant");
|
||||
|
||||
var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
|
||||
var RESULT_INDEX_ATTR = 'data-danger-index';
|
||||
|
||||
/**
|
||||
* Extracts the `nodeName` from a string of markup.
|
||||
*
|
||||
* NOTE: Extracting the `nodeName` does not require a regular expression match
|
||||
* because we make assumptions about React-generated markup (i.e. there are no
|
||||
* spaces surrounding the opening tag and there is at least one attribute).
|
||||
*
|
||||
* @param {string} markup String of markup.
|
||||
* @return {string} Node name of the supplied markup.
|
||||
* @see http://jsperf.com/extract-nodename
|
||||
*/
|
||||
function getNodeName(markup) {
|
||||
return markup.substring(1, markup.indexOf(' '));
|
||||
}
|
||||
|
||||
var Danger = {
|
||||
|
||||
/**
|
||||
* Renders markup into an array of nodes. The markup is expected to render
|
||||
* into a list of root nodes. Also, the length of `resultList` and
|
||||
* `markupList` should be the same.
|
||||
*
|
||||
* @param {array<string>} markupList List of markup strings to render.
|
||||
* @return {array<DOMElement>} List of rendered nodes.
|
||||
* @internal
|
||||
*/
|
||||
dangerouslyRenderMarkup: function(markupList) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
ExecutionEnvironment.canUseDOM,
|
||||
'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' +
|
||||
'thread. Make sure `window` and `document` are available globally ' +
|
||||
'before requiring React when unit testing or use ' +
|
||||
'React.renderToString for server rendering.'
|
||||
) : invariant(ExecutionEnvironment.canUseDOM));
|
||||
var nodeName;
|
||||
var markupByNodeName = {};
|
||||
// Group markup by `nodeName` if a wrap is necessary, else by '*'.
|
||||
for (var i = 0; i < markupList.length; i++) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
markupList[i],
|
||||
'dangerouslyRenderMarkup(...): Missing markup.'
|
||||
) : invariant(markupList[i]));
|
||||
nodeName = getNodeName(markupList[i]);
|
||||
nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
|
||||
markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
|
||||
markupByNodeName[nodeName][i] = markupList[i];
|
||||
}
|
||||
var resultList = [];
|
||||
var resultListAssignmentCount = 0;
|
||||
for (nodeName in markupByNodeName) {
|
||||
if (!markupByNodeName.hasOwnProperty(nodeName)) {
|
||||
continue;
|
||||
}
|
||||
var markupListByNodeName = markupByNodeName[nodeName];
|
||||
|
||||
// This for-in loop skips the holes of the sparse array. The order of
|
||||
// iteration should follow the order of assignment, which happens to match
|
||||
// numerical index order, but we don't rely on that.
|
||||
var resultIndex;
|
||||
for (resultIndex in markupListByNodeName) {
|
||||
if (markupListByNodeName.hasOwnProperty(resultIndex)) {
|
||||
var markup = markupListByNodeName[resultIndex];
|
||||
|
||||
// Push the requested markup with an additional RESULT_INDEX_ATTR
|
||||
// attribute. If the markup does not start with a < character, it
|
||||
// will be discarded below (with an appropriate console.error).
|
||||
markupListByNodeName[resultIndex] = markup.replace(
|
||||
OPEN_TAG_NAME_EXP,
|
||||
// This index will be parsed back out below.
|
||||
'$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Render each group of markup with similar wrapping `nodeName`.
|
||||
var renderNodes = createNodesFromMarkup(
|
||||
markupListByNodeName.join(''),
|
||||
emptyFunction // Do nothing special with <script> tags.
|
||||
);
|
||||
|
||||
for (var j = 0; j < renderNodes.length; ++j) {
|
||||
var renderNode = renderNodes[j];
|
||||
if (renderNode.hasAttribute &&
|
||||
renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
|
||||
|
||||
resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
|
||||
renderNode.removeAttribute(RESULT_INDEX_ATTR);
|
||||
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
!resultList.hasOwnProperty(resultIndex),
|
||||
'Danger: Assigning to an already-occupied result index.'
|
||||
) : invariant(!resultList.hasOwnProperty(resultIndex)));
|
||||
|
||||
resultList[resultIndex] = renderNode;
|
||||
|
||||
// This should match resultList.length and markupList.length when
|
||||
// we're done.
|
||||
resultListAssignmentCount += 1;
|
||||
|
||||
} else if ("production" !== process.env.NODE_ENV) {
|
||||
console.error(
|
||||
'Danger: Discarding unexpected node:',
|
||||
renderNode
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Although resultList was populated out of order, it should now be a dense
|
||||
// array.
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
resultListAssignmentCount === resultList.length,
|
||||
'Danger: Did not assign to every index of resultList.'
|
||||
) : invariant(resultListAssignmentCount === resultList.length));
|
||||
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
resultList.length === markupList.length,
|
||||
'Danger: Expected markup to render %s nodes, but rendered %s.',
|
||||
markupList.length,
|
||||
resultList.length
|
||||
) : invariant(resultList.length === markupList.length));
|
||||
|
||||
return resultList;
|
||||
},
|
||||
|
||||
/**
|
||||
* Replaces a node with a string of markup at its current position within its
|
||||
* parent. The markup must render into a single root node.
|
||||
*
|
||||
* @param {DOMElement} oldChild Child node to replace.
|
||||
* @param {string} markup Markup to render in place of the child node.
|
||||
* @internal
|
||||
*/
|
||||
dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
ExecutionEnvironment.canUseDOM,
|
||||
'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
|
||||
'worker thread. Make sure `window` and `document` are available ' +
|
||||
'globally before requiring React when unit testing or use ' +
|
||||
'React.renderToString for server rendering.'
|
||||
) : invariant(ExecutionEnvironment.canUseDOM));
|
||||
("production" !== process.env.NODE_ENV ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
oldChild.tagName.toLowerCase() !== 'html',
|
||||
'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +
|
||||
'<html> node. This is because browser quirks make this unreliable ' +
|
||||
'and/or slow. If you want to render to the root you must use ' +
|
||||
'server rendering. See React.renderToString().'
|
||||
) : invariant(oldChild.tagName.toLowerCase() !== 'html'));
|
||||
|
||||
var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
|
||||
oldChild.parentNode.replaceChild(newChild, oldChild);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports = Danger;
|
||||
37
node_modules/jibo-tools/node_modules/react/lib/DefaultEventPluginOrder.js
generated
vendored
Normal file
37
node_modules/jibo-tools/node_modules/react/lib/DefaultEventPluginOrder.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule DefaultEventPluginOrder
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var keyOf = require("./keyOf");
|
||||
|
||||
/**
|
||||
* Module that is injectable into `EventPluginHub`, that specifies a
|
||||
* deterministic ordering of `EventPlugin`s. A convenient way to reason about
|
||||
* plugins, without having to package every one of them. This is better than
|
||||
* having plugins be ordered in the same order that they are injected because
|
||||
* that ordering would be influenced by the packaging order.
|
||||
* `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
|
||||
* preventing default on events is convenient in `SimpleEventPlugin` handlers.
|
||||
*/
|
||||
var DefaultEventPluginOrder = [
|
||||
keyOf({ResponderEventPlugin: null}),
|
||||
keyOf({SimpleEventPlugin: null}),
|
||||
keyOf({TapEventPlugin: null}),
|
||||
keyOf({EnterLeaveEventPlugin: null}),
|
||||
keyOf({ChangeEventPlugin: null}),
|
||||
keyOf({SelectEventPlugin: null}),
|
||||
keyOf({BeforeInputEventPlugin: null}),
|
||||
keyOf({AnalyticsEventPlugin: null}),
|
||||
keyOf({MobileSafariClickEventPlugin: null})
|
||||
];
|
||||
|
||||
module.exports = DefaultEventPluginOrder;
|
||||
138
node_modules/jibo-tools/node_modules/react/lib/EnterLeaveEventPlugin.js
generated
vendored
Normal file
138
node_modules/jibo-tools/node_modules/react/lib/EnterLeaveEventPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule EnterLeaveEventPlugin
|
||||
* @typechecks static-only
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var EventConstants = require("./EventConstants");
|
||||
var EventPropagators = require("./EventPropagators");
|
||||
var SyntheticMouseEvent = require("./SyntheticMouseEvent");
|
||||
|
||||
var ReactMount = require("./ReactMount");
|
||||
var keyOf = require("./keyOf");
|
||||
|
||||
var topLevelTypes = EventConstants.topLevelTypes;
|
||||
var getFirstReactDOM = ReactMount.getFirstReactDOM;
|
||||
|
||||
var eventTypes = {
|
||||
mouseEnter: {
|
||||
registrationName: keyOf({onMouseEnter: null}),
|
||||
dependencies: [
|
||||
topLevelTypes.topMouseOut,
|
||||
topLevelTypes.topMouseOver
|
||||
]
|
||||
},
|
||||
mouseLeave: {
|
||||
registrationName: keyOf({onMouseLeave: null}),
|
||||
dependencies: [
|
||||
topLevelTypes.topMouseOut,
|
||||
topLevelTypes.topMouseOver
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
var extractedEvents = [null, null];
|
||||
|
||||
var EnterLeaveEventPlugin = {
|
||||
|
||||
eventTypes: eventTypes,
|
||||
|
||||
/**
|
||||
* For almost every interaction we care about, there will be both a top-level
|
||||
* `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
|
||||
* we do not extract duplicate events. However, moving the mouse into the
|
||||
* browser from outside will not fire a `mouseout` event. In this case, we use
|
||||
* the `mouseover` top-level event.
|
||||
*
|
||||
* @param {string} topLevelType Record from `EventConstants`.
|
||||
* @param {DOMEventTarget} topLevelTarget The listening component root node.
|
||||
* @param {string} topLevelTargetID ID of `topLevelTarget`.
|
||||
* @param {object} nativeEvent Native browser event.
|
||||
* @return {*} An accumulation of synthetic events.
|
||||
* @see {EventPluginHub.extractEvents}
|
||||
*/
|
||||
extractEvents: function(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID,
|
||||
nativeEvent) {
|
||||
if (topLevelType === topLevelTypes.topMouseOver &&
|
||||
(nativeEvent.relatedTarget || nativeEvent.fromElement)) {
|
||||
return null;
|
||||
}
|
||||
if (topLevelType !== topLevelTypes.topMouseOut &&
|
||||
topLevelType !== topLevelTypes.topMouseOver) {
|
||||
// Must not be a mouse in or mouse out - ignoring.
|
||||
return null;
|
||||
}
|
||||
|
||||
var win;
|
||||
if (topLevelTarget.window === topLevelTarget) {
|
||||
// `topLevelTarget` is probably a window object.
|
||||
win = topLevelTarget;
|
||||
} else {
|
||||
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
|
||||
var doc = topLevelTarget.ownerDocument;
|
||||
if (doc) {
|
||||
win = doc.defaultView || doc.parentWindow;
|
||||
} else {
|
||||
win = window;
|
||||
}
|
||||
}
|
||||
|
||||
var from, to;
|
||||
if (topLevelType === topLevelTypes.topMouseOut) {
|
||||
from = topLevelTarget;
|
||||
to =
|
||||
getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
|
||||
win;
|
||||
} else {
|
||||
from = win;
|
||||
to = topLevelTarget;
|
||||
}
|
||||
|
||||
if (from === to) {
|
||||
// Nothing pertains to our managed components.
|
||||
return null;
|
||||
}
|
||||
|
||||
var fromID = from ? ReactMount.getID(from) : '';
|
||||
var toID = to ? ReactMount.getID(to) : '';
|
||||
|
||||
var leave = SyntheticMouseEvent.getPooled(
|
||||
eventTypes.mouseLeave,
|
||||
fromID,
|
||||
nativeEvent
|
||||
);
|
||||
leave.type = 'mouseleave';
|
||||
leave.target = from;
|
||||
leave.relatedTarget = to;
|
||||
|
||||
var enter = SyntheticMouseEvent.getPooled(
|
||||
eventTypes.mouseEnter,
|
||||
toID,
|
||||
nativeEvent
|
||||
);
|
||||
enter.type = 'mouseenter';
|
||||
enter.target = to;
|
||||
enter.relatedTarget = from;
|
||||
|
||||
EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
|
||||
|
||||
extractedEvents[0] = leave;
|
||||
extractedEvents[1] = enter;
|
||||
|
||||
return extractedEvents;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports = EnterLeaveEventPlugin;
|
||||
70
node_modules/jibo-tools/node_modules/react/lib/EventConstants.js
generated
vendored
Normal file
70
node_modules/jibo-tools/node_modules/react/lib/EventConstants.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule EventConstants
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var keyMirror = require("./keyMirror");
|
||||
|
||||
var PropagationPhases = keyMirror({bubbled: null, captured: null});
|
||||
|
||||
/**
|
||||
* Types of raw signals from the browser caught at the top level.
|
||||
*/
|
||||
var topLevelTypes = keyMirror({
|
||||
topBlur: null,
|
||||
topChange: null,
|
||||
topClick: null,
|
||||
topCompositionEnd: null,
|
||||
topCompositionStart: null,
|
||||
topCompositionUpdate: null,
|
||||
topContextMenu: null,
|
||||
topCopy: null,
|
||||
topCut: null,
|
||||
topDoubleClick: null,
|
||||
topDrag: null,
|
||||
topDragEnd: null,
|
||||
topDragEnter: null,
|
||||
topDragExit: null,
|
||||
topDragLeave: null,
|
||||
topDragOver: null,
|
||||
topDragStart: null,
|
||||
topDrop: null,
|
||||
topError: null,
|
||||
topFocus: null,
|
||||
topInput: null,
|
||||
topKeyDown: null,
|
||||
topKeyPress: null,
|
||||
topKeyUp: null,
|
||||
topLoad: null,
|
||||
topMouseDown: null,
|
||||
topMouseMove: null,
|
||||
topMouseOut: null,
|
||||
topMouseOver: null,
|
||||
topMouseUp: null,
|
||||
topPaste: null,
|
||||
topReset: null,
|
||||
topScroll: null,
|
||||
topSelectionChange: null,
|
||||
topSubmit: null,
|
||||
topTextInput: null,
|
||||
topTouchCancel: null,
|
||||
topTouchEnd: null,
|
||||
topTouchMove: null,
|
||||
topTouchStart: null,
|
||||
topWheel: null
|
||||
});
|
||||
|
||||
var EventConstants = {
|
||||
topLevelTypes: topLevelTypes,
|
||||
PropagationPhases: PropagationPhases
|
||||
};
|
||||
|
||||
module.exports = EventConstants;
|
||||
86
node_modules/jibo-tools/node_modules/react/lib/EventListener.js
generated
vendored
Normal file
86
node_modules/jibo-tools/node_modules/react/lib/EventListener.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @providesModule EventListener
|
||||
* @typechecks
|
||||
*/
|
||||
|
||||
var emptyFunction = require("./emptyFunction");
|
||||
|
||||
/**
|
||||
* Upstream version of event listener. Does not take into account specific
|
||||
* nature of platform.
|
||||
*/
|
||||
var EventListener = {
|
||||
/**
|
||||
* Listen to DOM events during the bubble phase.
|
||||
*
|
||||
* @param {DOMEventTarget} target DOM element to register listener on.
|
||||
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
|
||||
* @param {function} callback Callback function.
|
||||
* @return {object} Object with a `remove` method.
|
||||
*/
|
||||
listen: function(target, eventType, callback) {
|
||||
if (target.addEventListener) {
|
||||
target.addEventListener(eventType, callback, false);
|
||||
return {
|
||||
remove: function() {
|
||||
target.removeEventListener(eventType, callback, false);
|
||||
}
|
||||
};
|
||||
} else if (target.attachEvent) {
|
||||
target.attachEvent('on' + eventType, callback);
|
||||
return {
|
||||
remove: function() {
|
||||
target.detachEvent('on' + eventType, callback);
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Listen to DOM events during the capture phase.
|
||||
*
|
||||
* @param {DOMEventTarget} target DOM element to register listener on.
|
||||
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
|
||||
* @param {function} callback Callback function.
|
||||
* @return {object} Object with a `remove` method.
|
||||
*/
|
||||
capture: function(target, eventType, callback) {
|
||||
if (!target.addEventListener) {
|
||||
if ("production" !== process.env.NODE_ENV) {
|
||||
console.error(
|
||||
'Attempted to listen to events during the capture phase on a ' +
|
||||
'browser that does not support the capture phase. Your application ' +
|
||||
'will not receive some events.'
|
||||
);
|
||||
}
|
||||
return {
|
||||
remove: emptyFunction
|
||||
};
|
||||
} else {
|
||||
target.addEventListener(eventType, callback, true);
|
||||
return {
|
||||
remove: function() {
|
||||
target.removeEventListener(eventType, callback, true);
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
registerDefault: function() {}
|
||||
};
|
||||
|
||||
module.exports = EventListener;
|
||||
274
node_modules/jibo-tools/node_modules/react/lib/EventPluginHub.js
generated
vendored
Normal file
274
node_modules/jibo-tools/node_modules/react/lib/EventPluginHub.js
generated
vendored
Normal file
@@ -0,0 +1,274 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule EventPluginHub
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var EventPluginRegistry = require("./EventPluginRegistry");
|
||||
var EventPluginUtils = require("./EventPluginUtils");
|
||||
|
||||
var accumulateInto = require("./accumulateInto");
|
||||
var forEachAccumulated = require("./forEachAccumulated");
|
||||
var invariant = require("./invariant");
|
||||
|
||||
/**
|
||||
* Internal store for event listeners
|
||||
*/
|
||||
var listenerBank = {};
|
||||
|
||||
/**
|
||||
* Internal queue of events that have accumulated their dispatches and are
|
||||
* waiting to have their dispatches executed.
|
||||
*/
|
||||
var eventQueue = null;
|
||||
|
||||
/**
|
||||
* Dispatches an event and releases it back into the pool, unless persistent.
|
||||
*
|
||||
* @param {?object} event Synthetic event to be dispatched.
|
||||
* @private
|
||||
*/
|
||||
var executeDispatchesAndRelease = function(event) {
|
||||
if (event) {
|
||||
var executeDispatch = EventPluginUtils.executeDispatch;
|
||||
// Plugins can provide custom behavior when dispatching events.
|
||||
var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
|
||||
if (PluginModule && PluginModule.executeDispatch) {
|
||||
executeDispatch = PluginModule.executeDispatch;
|
||||
}
|
||||
EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);
|
||||
|
||||
if (!event.isPersistent()) {
|
||||
event.constructor.release(event);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* - `InstanceHandle`: [required] Module that performs logical traversals of DOM
|
||||
* hierarchy given ids of the logical DOM elements involved.
|
||||
*/
|
||||
var InstanceHandle = null;
|
||||
|
||||
function validateInstanceHandle() {
|
||||
var valid =
|
||||
InstanceHandle &&
|
||||
InstanceHandle.traverseTwoPhase &&
|
||||
InstanceHandle.traverseEnterLeave;
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
valid,
|
||||
'InstanceHandle not injected before use!'
|
||||
) : invariant(valid));
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a unified interface for event plugins to be installed and configured.
|
||||
*
|
||||
* Event plugins can implement the following properties:
|
||||
*
|
||||
* `extractEvents` {function(string, DOMEventTarget, string, object): *}
|
||||
* Required. When a top-level event is fired, this method is expected to
|
||||
* extract synthetic events that will in turn be queued and dispatched.
|
||||
*
|
||||
* `eventTypes` {object}
|
||||
* Optional, plugins that fire events must publish a mapping of registration
|
||||
* names that are used to register listeners. Values of this mapping must
|
||||
* be objects that contain `registrationName` or `phasedRegistrationNames`.
|
||||
*
|
||||
* `executeDispatch` {function(object, function, string)}
|
||||
* Optional, allows plugins to override how an event gets dispatched. By
|
||||
* default, the listener is simply invoked.
|
||||
*
|
||||
* Each plugin that is injected into `EventsPluginHub` is immediately operable.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
var EventPluginHub = {
|
||||
|
||||
/**
|
||||
* Methods for injecting dependencies.
|
||||
*/
|
||||
injection: {
|
||||
|
||||
/**
|
||||
* @param {object} InjectedMount
|
||||
* @public
|
||||
*/
|
||||
injectMount: EventPluginUtils.injection.injectMount,
|
||||
|
||||
/**
|
||||
* @param {object} InjectedInstanceHandle
|
||||
* @public
|
||||
*/
|
||||
injectInstanceHandle: function(InjectedInstanceHandle) {
|
||||
InstanceHandle = InjectedInstanceHandle;
|
||||
if ("production" !== process.env.NODE_ENV) {
|
||||
validateInstanceHandle();
|
||||
}
|
||||
},
|
||||
|
||||
getInstanceHandle: function() {
|
||||
if ("production" !== process.env.NODE_ENV) {
|
||||
validateInstanceHandle();
|
||||
}
|
||||
return InstanceHandle;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {array} InjectedEventPluginOrder
|
||||
* @public
|
||||
*/
|
||||
injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
|
||||
|
||||
/**
|
||||
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
|
||||
*/
|
||||
injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
|
||||
|
||||
},
|
||||
|
||||
eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
|
||||
|
||||
registrationNameModules: EventPluginRegistry.registrationNameModules,
|
||||
|
||||
/**
|
||||
* Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
|
||||
*
|
||||
* @param {string} id ID of the DOM element.
|
||||
* @param {string} registrationName Name of listener (e.g. `onClick`).
|
||||
* @param {?function} listener The callback to store.
|
||||
*/
|
||||
putListener: function(id, registrationName, listener) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
!listener || typeof listener === 'function',
|
||||
'Expected %s listener to be a function, instead got type %s',
|
||||
registrationName, typeof listener
|
||||
) : invariant(!listener || typeof listener === 'function'));
|
||||
|
||||
var bankForRegistrationName =
|
||||
listenerBank[registrationName] || (listenerBank[registrationName] = {});
|
||||
bankForRegistrationName[id] = listener;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} id ID of the DOM element.
|
||||
* @param {string} registrationName Name of listener (e.g. `onClick`).
|
||||
* @return {?function} The stored callback.
|
||||
*/
|
||||
getListener: function(id, registrationName) {
|
||||
var bankForRegistrationName = listenerBank[registrationName];
|
||||
return bankForRegistrationName && bankForRegistrationName[id];
|
||||
},
|
||||
|
||||
/**
|
||||
* Deletes a listener from the registration bank.
|
||||
*
|
||||
* @param {string} id ID of the DOM element.
|
||||
* @param {string} registrationName Name of listener (e.g. `onClick`).
|
||||
*/
|
||||
deleteListener: function(id, registrationName) {
|
||||
var bankForRegistrationName = listenerBank[registrationName];
|
||||
if (bankForRegistrationName) {
|
||||
delete bankForRegistrationName[id];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Deletes all listeners for the DOM element with the supplied ID.
|
||||
*
|
||||
* @param {string} id ID of the DOM element.
|
||||
*/
|
||||
deleteAllListeners: function(id) {
|
||||
for (var registrationName in listenerBank) {
|
||||
delete listenerBank[registrationName][id];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Allows registered plugins an opportunity to extract events from top-level
|
||||
* native browser events.
|
||||
*
|
||||
* @param {string} topLevelType Record from `EventConstants`.
|
||||
* @param {DOMEventTarget} topLevelTarget The listening component root node.
|
||||
* @param {string} topLevelTargetID ID of `topLevelTarget`.
|
||||
* @param {object} nativeEvent Native browser event.
|
||||
* @return {*} An accumulation of synthetic events.
|
||||
* @internal
|
||||
*/
|
||||
extractEvents: function(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID,
|
||||
nativeEvent) {
|
||||
var events;
|
||||
var plugins = EventPluginRegistry.plugins;
|
||||
for (var i = 0, l = plugins.length; i < l; i++) {
|
||||
// Not every plugin in the ordering may be loaded at runtime.
|
||||
var possiblePlugin = plugins[i];
|
||||
if (possiblePlugin) {
|
||||
var extractedEvents = possiblePlugin.extractEvents(
|
||||
topLevelType,
|
||||
topLevelTarget,
|
||||
topLevelTargetID,
|
||||
nativeEvent
|
||||
);
|
||||
if (extractedEvents) {
|
||||
events = accumulateInto(events, extractedEvents);
|
||||
}
|
||||
}
|
||||
}
|
||||
return events;
|
||||
},
|
||||
|
||||
/**
|
||||
* Enqueues a synthetic event that should be dispatched when
|
||||
* `processEventQueue` is invoked.
|
||||
*
|
||||
* @param {*} events An accumulation of synthetic events.
|
||||
* @internal
|
||||
*/
|
||||
enqueueEvents: function(events) {
|
||||
if (events) {
|
||||
eventQueue = accumulateInto(eventQueue, events);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Dispatches all synthetic events on the event queue.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
processEventQueue: function() {
|
||||
// Set `eventQueue` to null before processing it so that we can tell if more
|
||||
// events get enqueued while processing.
|
||||
var processingEventQueue = eventQueue;
|
||||
eventQueue = null;
|
||||
forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
!eventQueue,
|
||||
'processEventQueue(): Additional events were enqueued while processing ' +
|
||||
'an event queue. Support for this has not yet been implemented.'
|
||||
) : invariant(!eventQueue));
|
||||
},
|
||||
|
||||
/**
|
||||
* These are needed for tests only. Do not use!
|
||||
*/
|
||||
__purge: function() {
|
||||
listenerBank = {};
|
||||
},
|
||||
|
||||
__getListenerBank: function() {
|
||||
return listenerBank;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports = EventPluginHub;
|
||||
276
node_modules/jibo-tools/node_modules/react/lib/EventPluginRegistry.js
generated
vendored
Normal file
276
node_modules/jibo-tools/node_modules/react/lib/EventPluginRegistry.js
generated
vendored
Normal file
@@ -0,0 +1,276 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule EventPluginRegistry
|
||||
* @typechecks static-only
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var invariant = require("./invariant");
|
||||
|
||||
/**
|
||||
* Injectable ordering of event plugins.
|
||||
*/
|
||||
var EventPluginOrder = null;
|
||||
|
||||
/**
|
||||
* Injectable mapping from names to event plugin modules.
|
||||
*/
|
||||
var namesToPlugins = {};
|
||||
|
||||
/**
|
||||
* Recomputes the plugin list using the injected plugins and plugin ordering.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function recomputePluginOrdering() {
|
||||
if (!EventPluginOrder) {
|
||||
// Wait until an `EventPluginOrder` is injected.
|
||||
return;
|
||||
}
|
||||
for (var pluginName in namesToPlugins) {
|
||||
var PluginModule = namesToPlugins[pluginName];
|
||||
var pluginIndex = EventPluginOrder.indexOf(pluginName);
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
pluginIndex > -1,
|
||||
'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +
|
||||
'the plugin ordering, `%s`.',
|
||||
pluginName
|
||||
) : invariant(pluginIndex > -1));
|
||||
if (EventPluginRegistry.plugins[pluginIndex]) {
|
||||
continue;
|
||||
}
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
PluginModule.extractEvents,
|
||||
'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +
|
||||
'method, but `%s` does not.',
|
||||
pluginName
|
||||
) : invariant(PluginModule.extractEvents));
|
||||
EventPluginRegistry.plugins[pluginIndex] = PluginModule;
|
||||
var publishedEvents = PluginModule.eventTypes;
|
||||
for (var eventName in publishedEvents) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
publishEventForPlugin(
|
||||
publishedEvents[eventName],
|
||||
PluginModule,
|
||||
eventName
|
||||
),
|
||||
'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',
|
||||
eventName,
|
||||
pluginName
|
||||
) : invariant(publishEventForPlugin(
|
||||
publishedEvents[eventName],
|
||||
PluginModule,
|
||||
eventName
|
||||
)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Publishes an event so that it can be dispatched by the supplied plugin.
|
||||
*
|
||||
* @param {object} dispatchConfig Dispatch configuration for the event.
|
||||
* @param {object} PluginModule Plugin publishing the event.
|
||||
* @return {boolean} True if the event was successfully published.
|
||||
* @private
|
||||
*/
|
||||
function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName),
|
||||
'EventPluginHub: More than one plugin attempted to publish the same ' +
|
||||
'event name, `%s`.',
|
||||
eventName
|
||||
) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)));
|
||||
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
|
||||
|
||||
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
|
||||
if (phasedRegistrationNames) {
|
||||
for (var phaseName in phasedRegistrationNames) {
|
||||
if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
|
||||
var phasedRegistrationName = phasedRegistrationNames[phaseName];
|
||||
publishRegistrationName(
|
||||
phasedRegistrationName,
|
||||
PluginModule,
|
||||
eventName
|
||||
);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (dispatchConfig.registrationName) {
|
||||
publishRegistrationName(
|
||||
dispatchConfig.registrationName,
|
||||
PluginModule,
|
||||
eventName
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Publishes a registration name that is used to identify dispatched events and
|
||||
* can be used with `EventPluginHub.putListener` to register listeners.
|
||||
*
|
||||
* @param {string} registrationName Registration name to add.
|
||||
* @param {object} PluginModule Plugin publishing the event.
|
||||
* @private
|
||||
*/
|
||||
function publishRegistrationName(registrationName, PluginModule, eventName) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
!EventPluginRegistry.registrationNameModules[registrationName],
|
||||
'EventPluginHub: More than one plugin attempted to publish the same ' +
|
||||
'registration name, `%s`.',
|
||||
registrationName
|
||||
) : invariant(!EventPluginRegistry.registrationNameModules[registrationName]));
|
||||
EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
|
||||
EventPluginRegistry.registrationNameDependencies[registrationName] =
|
||||
PluginModule.eventTypes[eventName].dependencies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers plugins so that they can extract and dispatch events.
|
||||
*
|
||||
* @see {EventPluginHub}
|
||||
*/
|
||||
var EventPluginRegistry = {
|
||||
|
||||
/**
|
||||
* Ordered list of injected plugins.
|
||||
*/
|
||||
plugins: [],
|
||||
|
||||
/**
|
||||
* Mapping from event name to dispatch config
|
||||
*/
|
||||
eventNameDispatchConfigs: {},
|
||||
|
||||
/**
|
||||
* Mapping from registration name to plugin module
|
||||
*/
|
||||
registrationNameModules: {},
|
||||
|
||||
/**
|
||||
* Mapping from registration name to event name
|
||||
*/
|
||||
registrationNameDependencies: {},
|
||||
|
||||
/**
|
||||
* Injects an ordering of plugins (by plugin name). This allows the ordering
|
||||
* to be decoupled from injection of the actual plugins so that ordering is
|
||||
* always deterministic regardless of packaging, on-the-fly injection, etc.
|
||||
*
|
||||
* @param {array} InjectedEventPluginOrder
|
||||
* @internal
|
||||
* @see {EventPluginHub.injection.injectEventPluginOrder}
|
||||
*/
|
||||
injectEventPluginOrder: function(InjectedEventPluginOrder) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
!EventPluginOrder,
|
||||
'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
|
||||
'once. You are likely trying to load more than one copy of React.'
|
||||
) : invariant(!EventPluginOrder));
|
||||
// Clone the ordering so it cannot be dynamically mutated.
|
||||
EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
|
||||
recomputePluginOrdering();
|
||||
},
|
||||
|
||||
/**
|
||||
* Injects plugins to be used by `EventPluginHub`. The plugin names must be
|
||||
* in the ordering injected by `injectEventPluginOrder`.
|
||||
*
|
||||
* Plugins can be injected as part of page initialization or on-the-fly.
|
||||
*
|
||||
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
|
||||
* @internal
|
||||
* @see {EventPluginHub.injection.injectEventPluginsByName}
|
||||
*/
|
||||
injectEventPluginsByName: function(injectedNamesToPlugins) {
|
||||
var isOrderingDirty = false;
|
||||
for (var pluginName in injectedNamesToPlugins) {
|
||||
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
|
||||
continue;
|
||||
}
|
||||
var PluginModule = injectedNamesToPlugins[pluginName];
|
||||
if (!namesToPlugins.hasOwnProperty(pluginName) ||
|
||||
namesToPlugins[pluginName] !== PluginModule) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
!namesToPlugins[pluginName],
|
||||
'EventPluginRegistry: Cannot inject two different event plugins ' +
|
||||
'using the same name, `%s`.',
|
||||
pluginName
|
||||
) : invariant(!namesToPlugins[pluginName]));
|
||||
namesToPlugins[pluginName] = PluginModule;
|
||||
isOrderingDirty = true;
|
||||
}
|
||||
}
|
||||
if (isOrderingDirty) {
|
||||
recomputePluginOrdering();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Looks up the plugin for the supplied event.
|
||||
*
|
||||
* @param {object} event A synthetic event.
|
||||
* @return {?object} The plugin that created the supplied event.
|
||||
* @internal
|
||||
*/
|
||||
getPluginModuleForEvent: function(event) {
|
||||
var dispatchConfig = event.dispatchConfig;
|
||||
if (dispatchConfig.registrationName) {
|
||||
return EventPluginRegistry.registrationNameModules[
|
||||
dispatchConfig.registrationName
|
||||
] || null;
|
||||
}
|
||||
for (var phase in dispatchConfig.phasedRegistrationNames) {
|
||||
if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
|
||||
continue;
|
||||
}
|
||||
var PluginModule = EventPluginRegistry.registrationNameModules[
|
||||
dispatchConfig.phasedRegistrationNames[phase]
|
||||
];
|
||||
if (PluginModule) {
|
||||
return PluginModule;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Exposed for unit testing.
|
||||
* @private
|
||||
*/
|
||||
_resetEventPlugins: function() {
|
||||
EventPluginOrder = null;
|
||||
for (var pluginName in namesToPlugins) {
|
||||
if (namesToPlugins.hasOwnProperty(pluginName)) {
|
||||
delete namesToPlugins[pluginName];
|
||||
}
|
||||
}
|
||||
EventPluginRegistry.plugins.length = 0;
|
||||
|
||||
var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
|
||||
for (var eventName in eventNameDispatchConfigs) {
|
||||
if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
|
||||
delete eventNameDispatchConfigs[eventName];
|
||||
}
|
||||
}
|
||||
|
||||
var registrationNameModules = EventPluginRegistry.registrationNameModules;
|
||||
for (var registrationName in registrationNameModules) {
|
||||
if (registrationNameModules.hasOwnProperty(registrationName)) {
|
||||
delete registrationNameModules[registrationName];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports = EventPluginRegistry;
|
||||
217
node_modules/jibo-tools/node_modules/react/lib/EventPluginUtils.js
generated
vendored
Normal file
217
node_modules/jibo-tools/node_modules/react/lib/EventPluginUtils.js
generated
vendored
Normal file
@@ -0,0 +1,217 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule EventPluginUtils
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var EventConstants = require("./EventConstants");
|
||||
|
||||
var invariant = require("./invariant");
|
||||
|
||||
/**
|
||||
* Injected dependencies:
|
||||
*/
|
||||
|
||||
/**
|
||||
* - `Mount`: [required] Module that can convert between React dom IDs and
|
||||
* actual node references.
|
||||
*/
|
||||
var injection = {
|
||||
Mount: null,
|
||||
injectMount: function(InjectedMount) {
|
||||
injection.Mount = InjectedMount;
|
||||
if ("production" !== process.env.NODE_ENV) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
InjectedMount && InjectedMount.getNode,
|
||||
'EventPluginUtils.injection.injectMount(...): Injected Mount module ' +
|
||||
'is missing getNode.'
|
||||
) : invariant(InjectedMount && InjectedMount.getNode));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var topLevelTypes = EventConstants.topLevelTypes;
|
||||
|
||||
function isEndish(topLevelType) {
|
||||
return topLevelType === topLevelTypes.topMouseUp ||
|
||||
topLevelType === topLevelTypes.topTouchEnd ||
|
||||
topLevelType === topLevelTypes.topTouchCancel;
|
||||
}
|
||||
|
||||
function isMoveish(topLevelType) {
|
||||
return topLevelType === topLevelTypes.topMouseMove ||
|
||||
topLevelType === topLevelTypes.topTouchMove;
|
||||
}
|
||||
function isStartish(topLevelType) {
|
||||
return topLevelType === topLevelTypes.topMouseDown ||
|
||||
topLevelType === topLevelTypes.topTouchStart;
|
||||
}
|
||||
|
||||
|
||||
var validateEventDispatches;
|
||||
if ("production" !== process.env.NODE_ENV) {
|
||||
validateEventDispatches = function(event) {
|
||||
var dispatchListeners = event._dispatchListeners;
|
||||
var dispatchIDs = event._dispatchIDs;
|
||||
|
||||
var listenersIsArr = Array.isArray(dispatchListeners);
|
||||
var idsIsArr = Array.isArray(dispatchIDs);
|
||||
var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
|
||||
var listenersLen = listenersIsArr ?
|
||||
dispatchListeners.length :
|
||||
dispatchListeners ? 1 : 0;
|
||||
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
idsIsArr === listenersIsArr && IDsLen === listenersLen,
|
||||
'EventPluginUtils: Invalid `event`.'
|
||||
) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen));
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `cb(event, listener, id)`. Avoids using call if no scope is
|
||||
* provided. The `(listener,id)` pair effectively forms the "dispatch" but are
|
||||
* kept separate to conserve memory.
|
||||
*/
|
||||
function forEachEventDispatch(event, cb) {
|
||||
var dispatchListeners = event._dispatchListeners;
|
||||
var dispatchIDs = event._dispatchIDs;
|
||||
if ("production" !== process.env.NODE_ENV) {
|
||||
validateEventDispatches(event);
|
||||
}
|
||||
if (Array.isArray(dispatchListeners)) {
|
||||
for (var i = 0; i < dispatchListeners.length; i++) {
|
||||
if (event.isPropagationStopped()) {
|
||||
break;
|
||||
}
|
||||
// Listeners and IDs are two parallel arrays that are always in sync.
|
||||
cb(event, dispatchListeners[i], dispatchIDs[i]);
|
||||
}
|
||||
} else if (dispatchListeners) {
|
||||
cb(event, dispatchListeners, dispatchIDs);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Default implementation of PluginModule.executeDispatch().
|
||||
* @param {SyntheticEvent} SyntheticEvent to handle
|
||||
* @param {function} Application-level callback
|
||||
* @param {string} domID DOM id to pass to the callback.
|
||||
*/
|
||||
function executeDispatch(event, listener, domID) {
|
||||
event.currentTarget = injection.Mount.getNode(domID);
|
||||
var returnValue = listener(event, domID);
|
||||
event.currentTarget = null;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard/simple iteration through an event's collected dispatches.
|
||||
*/
|
||||
function executeDispatchesInOrder(event, cb) {
|
||||
forEachEventDispatch(event, cb);
|
||||
event._dispatchListeners = null;
|
||||
event._dispatchIDs = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard/simple iteration through an event's collected dispatches, but stops
|
||||
* at the first dispatch execution returning true, and returns that id.
|
||||
*
|
||||
* @return id of the first dispatch execution who's listener returns true, or
|
||||
* null if no listener returned true.
|
||||
*/
|
||||
function executeDispatchesInOrderStopAtTrueImpl(event) {
|
||||
var dispatchListeners = event._dispatchListeners;
|
||||
var dispatchIDs = event._dispatchIDs;
|
||||
if ("production" !== process.env.NODE_ENV) {
|
||||
validateEventDispatches(event);
|
||||
}
|
||||
if (Array.isArray(dispatchListeners)) {
|
||||
for (var i = 0; i < dispatchListeners.length; i++) {
|
||||
if (event.isPropagationStopped()) {
|
||||
break;
|
||||
}
|
||||
// Listeners and IDs are two parallel arrays that are always in sync.
|
||||
if (dispatchListeners[i](event, dispatchIDs[i])) {
|
||||
return dispatchIDs[i];
|
||||
}
|
||||
}
|
||||
} else if (dispatchListeners) {
|
||||
if (dispatchListeners(event, dispatchIDs)) {
|
||||
return dispatchIDs;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see executeDispatchesInOrderStopAtTrueImpl
|
||||
*/
|
||||
function executeDispatchesInOrderStopAtTrue(event) {
|
||||
var ret = executeDispatchesInOrderStopAtTrueImpl(event);
|
||||
event._dispatchIDs = null;
|
||||
event._dispatchListeners = null;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execution of a "direct" dispatch - there must be at most one dispatch
|
||||
* accumulated on the event or it is considered an error. It doesn't really make
|
||||
* sense for an event with multiple dispatches (bubbled) to keep track of the
|
||||
* return values at each dispatch execution, but it does tend to make sense when
|
||||
* dealing with "direct" dispatches.
|
||||
*
|
||||
* @return The return value of executing the single dispatch.
|
||||
*/
|
||||
function executeDirectDispatch(event) {
|
||||
if ("production" !== process.env.NODE_ENV) {
|
||||
validateEventDispatches(event);
|
||||
}
|
||||
var dispatchListener = event._dispatchListeners;
|
||||
var dispatchID = event._dispatchIDs;
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
!Array.isArray(dispatchListener),
|
||||
'executeDirectDispatch(...): Invalid `event`.'
|
||||
) : invariant(!Array.isArray(dispatchListener)));
|
||||
var res = dispatchListener ?
|
||||
dispatchListener(event, dispatchID) :
|
||||
null;
|
||||
event._dispatchListeners = null;
|
||||
event._dispatchIDs = null;
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {SyntheticEvent} event
|
||||
* @return {bool} True iff number of dispatches accumulated is greater than 0.
|
||||
*/
|
||||
function hasDispatches(event) {
|
||||
return !!event._dispatchListeners;
|
||||
}
|
||||
|
||||
/**
|
||||
* General utilities that are useful in creating custom Event Plugins.
|
||||
*/
|
||||
var EventPluginUtils = {
|
||||
isEndish: isEndish,
|
||||
isMoveish: isMoveish,
|
||||
isStartish: isStartish,
|
||||
|
||||
executeDirectDispatch: executeDirectDispatch,
|
||||
executeDispatch: executeDispatch,
|
||||
executeDispatchesInOrder: executeDispatchesInOrder,
|
||||
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
|
||||
hasDispatches: hasDispatches,
|
||||
injection: injection,
|
||||
useTouchEvents: false
|
||||
};
|
||||
|
||||
module.exports = EventPluginUtils;
|
||||
138
node_modules/jibo-tools/node_modules/react/lib/EventPropagators.js
generated
vendored
Normal file
138
node_modules/jibo-tools/node_modules/react/lib/EventPropagators.js
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule EventPropagators
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var EventConstants = require("./EventConstants");
|
||||
var EventPluginHub = require("./EventPluginHub");
|
||||
|
||||
var accumulateInto = require("./accumulateInto");
|
||||
var forEachAccumulated = require("./forEachAccumulated");
|
||||
|
||||
var PropagationPhases = EventConstants.PropagationPhases;
|
||||
var getListener = EventPluginHub.getListener;
|
||||
|
||||
/**
|
||||
* Some event types have a notion of different registration names for different
|
||||
* "phases" of propagation. This finds listeners by a given phase.
|
||||
*/
|
||||
function listenerAtPhase(id, event, propagationPhase) {
|
||||
var registrationName =
|
||||
event.dispatchConfig.phasedRegistrationNames[propagationPhase];
|
||||
return getListener(id, registrationName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tags a `SyntheticEvent` with dispatched listeners. Creating this function
|
||||
* here, allows us to not have to bind or create functions for each event.
|
||||
* Mutating the event's members allows us to not have to create a wrapping
|
||||
* "dispatch" object that pairs the event with the listener.
|
||||
*/
|
||||
function accumulateDirectionalDispatches(domID, upwards, event) {
|
||||
if ("production" !== process.env.NODE_ENV) {
|
||||
if (!domID) {
|
||||
throw new Error('Dispatching id must not be null');
|
||||
}
|
||||
}
|
||||
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
|
||||
var listener = listenerAtPhase(domID, event, phase);
|
||||
if (listener) {
|
||||
event._dispatchListeners =
|
||||
accumulateInto(event._dispatchListeners, listener);
|
||||
event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect dispatches (must be entirely collected before dispatching - see unit
|
||||
* tests). Lazily allocate the array to conserve memory. We must loop through
|
||||
* each event and perform the traversal for each one. We can not perform a
|
||||
* single traversal for the entire collection of events because each event may
|
||||
* have a different target.
|
||||
*/
|
||||
function accumulateTwoPhaseDispatchesSingle(event) {
|
||||
if (event && event.dispatchConfig.phasedRegistrationNames) {
|
||||
EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(
|
||||
event.dispatchMarker,
|
||||
accumulateDirectionalDispatches,
|
||||
event
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Accumulates without regard to direction, does not look for phased
|
||||
* registration names. Same as `accumulateDirectDispatchesSingle` but without
|
||||
* requiring that the `dispatchMarker` be the same as the dispatched ID.
|
||||
*/
|
||||
function accumulateDispatches(id, ignoredDirection, event) {
|
||||
if (event && event.dispatchConfig.registrationName) {
|
||||
var registrationName = event.dispatchConfig.registrationName;
|
||||
var listener = getListener(id, registrationName);
|
||||
if (listener) {
|
||||
event._dispatchListeners =
|
||||
accumulateInto(event._dispatchListeners, listener);
|
||||
event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Accumulates dispatches on an `SyntheticEvent`, but only for the
|
||||
* `dispatchMarker`.
|
||||
* @param {SyntheticEvent} event
|
||||
*/
|
||||
function accumulateDirectDispatchesSingle(event) {
|
||||
if (event && event.dispatchConfig.registrationName) {
|
||||
accumulateDispatches(event.dispatchMarker, null, event);
|
||||
}
|
||||
}
|
||||
|
||||
function accumulateTwoPhaseDispatches(events) {
|
||||
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
|
||||
}
|
||||
|
||||
function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
|
||||
EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(
|
||||
fromID,
|
||||
toID,
|
||||
accumulateDispatches,
|
||||
leave,
|
||||
enter
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function accumulateDirectDispatches(events) {
|
||||
forEachAccumulated(events, accumulateDirectDispatchesSingle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A small set of propagation patterns, each of which will accept a small amount
|
||||
* of information, and generate a set of "dispatch ready event objects" - which
|
||||
* are sets of events that have already been annotated with a set of dispatched
|
||||
* listener functions/ids. The API is designed this way to discourage these
|
||||
* propagation strategies from actually executing the dispatches, since we
|
||||
* always want to collect the entire set of dispatches before executing event a
|
||||
* single one.
|
||||
*
|
||||
* @constructor EventPropagators
|
||||
*/
|
||||
var EventPropagators = {
|
||||
accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
|
||||
accumulateDirectDispatches: accumulateDirectDispatches,
|
||||
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
|
||||
};
|
||||
|
||||
module.exports = EventPropagators;
|
||||
42
node_modules/jibo-tools/node_modules/react/lib/ExecutionEnvironment.js
generated
vendored
Normal file
42
node_modules/jibo-tools/node_modules/react/lib/ExecutionEnvironment.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule ExecutionEnvironment
|
||||
*/
|
||||
|
||||
/*jslint evil: true */
|
||||
|
||||
"use strict";
|
||||
|
||||
var canUseDOM = !!(
|
||||
(typeof window !== 'undefined' &&
|
||||
window.document && window.document.createElement)
|
||||
);
|
||||
|
||||
/**
|
||||
* Simple, lightweight module assisting with the detection and context of
|
||||
* Worker. Helps avoid circular dependencies and allows code to reason about
|
||||
* whether or not they are in a Worker, even if they never include the main
|
||||
* `ReactWorker` dependency.
|
||||
*/
|
||||
var ExecutionEnvironment = {
|
||||
|
||||
canUseDOM: canUseDOM,
|
||||
|
||||
canUseWorkers: typeof Worker !== 'undefined',
|
||||
|
||||
canUseEventListeners:
|
||||
canUseDOM && !!(window.addEventListener || window.attachEvent),
|
||||
|
||||
canUseViewport: canUseDOM && !!window.screen,
|
||||
|
||||
isInWorker: !canUseDOM // For now, this is true - might change in the future.
|
||||
|
||||
};
|
||||
|
||||
module.exports = ExecutionEnvironment;
|
||||
89
node_modules/jibo-tools/node_modules/react/lib/FallbackCompositionState.js
generated
vendored
Normal file
89
node_modules/jibo-tools/node_modules/react/lib/FallbackCompositionState.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule FallbackCompositionState
|
||||
* @typechecks static-only
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var PooledClass = require("./PooledClass");
|
||||
|
||||
var assign = require("./Object.assign");
|
||||
var getTextContentAccessor = require("./getTextContentAccessor");
|
||||
|
||||
/**
|
||||
* This helper class stores information about text content of a target node,
|
||||
* allowing comparison of content before and after a given event.
|
||||
*
|
||||
* Identify the node where selection currently begins, then observe
|
||||
* both its text content and its current position in the DOM. Since the
|
||||
* browser may natively replace the target node during composition, we can
|
||||
* use its position to find its replacement.
|
||||
*
|
||||
* @param {DOMEventTarget} root
|
||||
*/
|
||||
function FallbackCompositionState(root) {
|
||||
this._root = root;
|
||||
this._startText = this.getText();
|
||||
this._fallbackText = null;
|
||||
}
|
||||
|
||||
assign(FallbackCompositionState.prototype, {
|
||||
/**
|
||||
* Get current text of input.
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
getText: function() {
|
||||
if ('value' in this._root) {
|
||||
return this._root.value;
|
||||
}
|
||||
return this._root[getTextContentAccessor()];
|
||||
},
|
||||
|
||||
/**
|
||||
* Determine the differing substring between the initially stored
|
||||
* text content and the current content.
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
getData: function() {
|
||||
if (this._fallbackText) {
|
||||
return this._fallbackText;
|
||||
}
|
||||
|
||||
var start;
|
||||
var startValue = this._startText;
|
||||
var startLength = startValue.length;
|
||||
var end;
|
||||
var endValue = this.getText();
|
||||
var endLength = endValue.length;
|
||||
|
||||
for (start = 0; start < startLength; start++) {
|
||||
if (startValue[start] !== endValue[start]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var minEnd = startLength - start;
|
||||
for (end = 1; end <= minEnd; end++) {
|
||||
if (startValue[startLength - end] !== endValue[endLength - end]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var sliceTail = end > 1 ? 1 - end : undefined;
|
||||
this._fallbackText = endValue.slice(start, sliceTail);
|
||||
return this._fallbackText;
|
||||
}
|
||||
});
|
||||
|
||||
PooledClass.addPoolingTo(FallbackCompositionState);
|
||||
|
||||
module.exports = FallbackCompositionState;
|
||||
209
node_modules/jibo-tools/node_modules/react/lib/HTMLDOMPropertyConfig.js
generated
vendored
Normal file
209
node_modules/jibo-tools/node_modules/react/lib/HTMLDOMPropertyConfig.js
generated
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule HTMLDOMPropertyConfig
|
||||
*/
|
||||
|
||||
/*jslint bitwise: true*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var DOMProperty = require("./DOMProperty");
|
||||
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
||||
|
||||
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
|
||||
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
|
||||
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
|
||||
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
|
||||
var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
|
||||
var HAS_POSITIVE_NUMERIC_VALUE =
|
||||
DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
|
||||
var HAS_OVERLOADED_BOOLEAN_VALUE =
|
||||
DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
|
||||
|
||||
var hasSVG;
|
||||
if (ExecutionEnvironment.canUseDOM) {
|
||||
var implementation = document.implementation;
|
||||
hasSVG = (
|
||||
implementation &&
|
||||
implementation.hasFeature &&
|
||||
implementation.hasFeature(
|
||||
'http://www.w3.org/TR/SVG11/feature#BasicStructure',
|
||||
'1.1'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
var HTMLDOMPropertyConfig = {
|
||||
isCustomAttribute: RegExp.prototype.test.bind(
|
||||
/^(data|aria)-[a-z_][a-z\d_.\-]*$/
|
||||
),
|
||||
Properties: {
|
||||
/**
|
||||
* Standard Properties
|
||||
*/
|
||||
accept: null,
|
||||
acceptCharset: null,
|
||||
accessKey: null,
|
||||
action: null,
|
||||
allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
||||
allowTransparency: MUST_USE_ATTRIBUTE,
|
||||
alt: null,
|
||||
async: HAS_BOOLEAN_VALUE,
|
||||
autoComplete: null,
|
||||
// autoFocus is polyfilled/normalized by AutoFocusMixin
|
||||
// autoFocus: HAS_BOOLEAN_VALUE,
|
||||
autoPlay: HAS_BOOLEAN_VALUE,
|
||||
cellPadding: null,
|
||||
cellSpacing: null,
|
||||
charSet: MUST_USE_ATTRIBUTE,
|
||||
checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
||||
classID: MUST_USE_ATTRIBUTE,
|
||||
// To set className on SVG elements, it's necessary to use .setAttribute;
|
||||
// this works on HTML elements too in all browsers except IE8. Conveniently,
|
||||
// IE8 doesn't support SVG and so we can simply use the attribute in
|
||||
// browsers that support SVG and the property in browsers that don't,
|
||||
// regardless of whether the element is HTML or SVG.
|
||||
className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
|
||||
cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
|
||||
colSpan: null,
|
||||
content: null,
|
||||
contentEditable: null,
|
||||
contextMenu: MUST_USE_ATTRIBUTE,
|
||||
controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
||||
coords: null,
|
||||
crossOrigin: null,
|
||||
data: null, // For `<object />` acts as `src`.
|
||||
dateTime: MUST_USE_ATTRIBUTE,
|
||||
defer: HAS_BOOLEAN_VALUE,
|
||||
dir: null,
|
||||
disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
||||
download: HAS_OVERLOADED_BOOLEAN_VALUE,
|
||||
draggable: null,
|
||||
encType: null,
|
||||
form: MUST_USE_ATTRIBUTE,
|
||||
formAction: MUST_USE_ATTRIBUTE,
|
||||
formEncType: MUST_USE_ATTRIBUTE,
|
||||
formMethod: MUST_USE_ATTRIBUTE,
|
||||
formNoValidate: HAS_BOOLEAN_VALUE,
|
||||
formTarget: MUST_USE_ATTRIBUTE,
|
||||
frameBorder: MUST_USE_ATTRIBUTE,
|
||||
headers: null,
|
||||
height: MUST_USE_ATTRIBUTE,
|
||||
hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
||||
high: null,
|
||||
href: null,
|
||||
hrefLang: null,
|
||||
htmlFor: null,
|
||||
httpEquiv: null,
|
||||
icon: null,
|
||||
id: MUST_USE_PROPERTY,
|
||||
label: null,
|
||||
lang: null,
|
||||
list: MUST_USE_ATTRIBUTE,
|
||||
loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
||||
low: null,
|
||||
manifest: MUST_USE_ATTRIBUTE,
|
||||
marginHeight: null,
|
||||
marginWidth: null,
|
||||
max: null,
|
||||
maxLength: MUST_USE_ATTRIBUTE,
|
||||
media: MUST_USE_ATTRIBUTE,
|
||||
mediaGroup: null,
|
||||
method: null,
|
||||
min: null,
|
||||
multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
||||
muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
||||
name: null,
|
||||
noValidate: HAS_BOOLEAN_VALUE,
|
||||
open: HAS_BOOLEAN_VALUE,
|
||||
optimum: null,
|
||||
pattern: null,
|
||||
placeholder: null,
|
||||
poster: null,
|
||||
preload: null,
|
||||
radioGroup: null,
|
||||
readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
||||
rel: null,
|
||||
required: HAS_BOOLEAN_VALUE,
|
||||
role: MUST_USE_ATTRIBUTE,
|
||||
rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
|
||||
rowSpan: null,
|
||||
sandbox: null,
|
||||
scope: null,
|
||||
scoped: HAS_BOOLEAN_VALUE,
|
||||
scrolling: null,
|
||||
seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
||||
selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
||||
shape: null,
|
||||
size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
|
||||
sizes: MUST_USE_ATTRIBUTE,
|
||||
span: HAS_POSITIVE_NUMERIC_VALUE,
|
||||
spellCheck: null,
|
||||
src: null,
|
||||
srcDoc: MUST_USE_PROPERTY,
|
||||
srcSet: MUST_USE_ATTRIBUTE,
|
||||
start: HAS_NUMERIC_VALUE,
|
||||
step: null,
|
||||
style: null,
|
||||
tabIndex: null,
|
||||
target: null,
|
||||
title: null,
|
||||
type: null,
|
||||
useMap: null,
|
||||
value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
|
||||
width: MUST_USE_ATTRIBUTE,
|
||||
wmode: MUST_USE_ATTRIBUTE,
|
||||
|
||||
/**
|
||||
* Non-standard Properties
|
||||
*/
|
||||
// autoCapitalize and autoCorrect are supported in Mobile Safari for
|
||||
// keyboard hints.
|
||||
autoCapitalize: null,
|
||||
autoCorrect: null,
|
||||
// itemProp, itemScope, itemType are for
|
||||
// Microdata support. See http://schema.org/docs/gs.html
|
||||
itemProp: MUST_USE_ATTRIBUTE,
|
||||
itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
||||
itemType: MUST_USE_ATTRIBUTE,
|
||||
// itemID and itemRef are for Microdata support as well but
|
||||
// only specified in the the WHATWG spec document. See
|
||||
// https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
|
||||
itemID: MUST_USE_ATTRIBUTE,
|
||||
itemRef: MUST_USE_ATTRIBUTE,
|
||||
// property is supported for OpenGraph in meta tags.
|
||||
property: null,
|
||||
// IE-only attribute that controls focus behavior
|
||||
unselectable: MUST_USE_ATTRIBUTE
|
||||
},
|
||||
DOMAttributeNames: {
|
||||
acceptCharset: 'accept-charset',
|
||||
className: 'class',
|
||||
htmlFor: 'for',
|
||||
httpEquiv: 'http-equiv'
|
||||
},
|
||||
DOMPropertyNames: {
|
||||
autoCapitalize: 'autocapitalize',
|
||||
autoComplete: 'autocomplete',
|
||||
autoCorrect: 'autocorrect',
|
||||
autoFocus: 'autofocus',
|
||||
autoPlay: 'autoplay',
|
||||
// `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
|
||||
// http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
|
||||
encType: 'encoding',
|
||||
hrefLang: 'hreflang',
|
||||
radioGroup: 'radiogroup',
|
||||
spellCheck: 'spellcheck',
|
||||
srcDoc: 'srcdoc',
|
||||
srcSet: 'srcset'
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HTMLDOMPropertyConfig;
|
||||
39
node_modules/jibo-tools/node_modules/react/lib/LinkedStateMixin.js
generated
vendored
Normal file
39
node_modules/jibo-tools/node_modules/react/lib/LinkedStateMixin.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule LinkedStateMixin
|
||||
* @typechecks static-only
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var ReactLink = require("./ReactLink");
|
||||
var ReactStateSetters = require("./ReactStateSetters");
|
||||
|
||||
/**
|
||||
* A simple mixin around ReactLink.forState().
|
||||
*/
|
||||
var LinkedStateMixin = {
|
||||
/**
|
||||
* Create a ReactLink that's linked to part of this component's state. The
|
||||
* ReactLink will have the current value of this.state[key] and will call
|
||||
* setState() when a change is requested.
|
||||
*
|
||||
* @param {string} key state key to update. Note: you may want to use keyOf()
|
||||
* if you're using Google Closure Compiler advanced mode.
|
||||
* @return {ReactLink} ReactLink instance linking to the state.
|
||||
*/
|
||||
linkState: function(key) {
|
||||
return new ReactLink(
|
||||
this.state[key],
|
||||
ReactStateSetters.createStateKeySetter(this, key)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = LinkedStateMixin;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user