Add files

This commit is contained in:
DoomRye 2022-07-26 10:06:20 -07:00
commit bb80829159
18195 changed files with 2122994 additions and 0 deletions

View file

@ -0,0 +1,128 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
* @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.
*/
/* Slow implementation for browsers that don't natively support .matches() */
function matchesSelector_SLOW(element, selector) {
var root = element;
while (root.parentNode) {
root = root.parentNode;
}
var all = root.querySelectorAll(selector);
return Array.prototype.indexOf.call(all, element) !== -1;
}
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 addClass(element, className) {
!!/\s/.test(className) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'CSSCore.addClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : void 0;
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 removeClass(element, className) {
!!/\s/.test(className) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'CSSCore.removeClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : void 0;
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 conditionClass(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 check the class on
* @param {string} className the CSS className
* @return {boolean} true if the element has the class, false if not
*/
hasClass: function hasClass(element, className) {
!!/\s/.test(className) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'CSS.hasClass takes only a single class name.') : invariant(false) : void 0;
if (element.classList) {
return !!className && element.classList.contains(className);
}
return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
},
/**
* Tests whether the element matches the selector specified
*
* @param {DOMNode|DOMWindow} element the element that we are querying
* @param {string} selector the CSS selector
* @return {boolean} true if the element matches the selector, false if not
*/
matchesSelector: function matchesSelector(element, selector) {
var matchesImpl = element.matches || element.webkitMatchesSelector || element.mozMatchesSelector || element.msMatchesSelector || function (s) {
return matchesSelector_SLOW(element, s);
};
return matchesImpl.call(element, selector);
}
};
module.exports = CSSCore;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/CSSCore.js
// module id = 2311
// module chunks = 4

View file

@ -0,0 +1,228 @@
'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
var PhotosMimeType = require('./PhotosMimeType');
var createArrayFromMixed = require('./createArrayFromMixed');
var emptyFunction = require('./emptyFunction');
var CR_LF_REGEX = new RegExp('\r\n', 'g');
var LF_ONLY = '\n';
var RICH_TEXT_TYPES = {
'text/rtf': 1,
'text/html': 1
};
/**
* If DataTransferItem is a file then return the Blob of data.
*
* @param {object} item
* @return {?blob}
*/
function getFileFromDataTransfer(item) {
if (item.kind == 'file') {
return item.getAsFile();
}
}
var DataTransfer = function () {
/**
* @param {object} data
*/
function DataTransfer(data) {
_classCallCheck(this, DataTransfer);
this.data = data;
// Types could be DOMStringList or array
this.types = data.types ? createArrayFromMixed(data.types) : [];
}
/**
* Is this likely to be a rich text data transfer?
*
* @return {boolean}
*/
DataTransfer.prototype.isRichText = function isRichText() {
// If HTML is available, treat this data as rich text. This way, we avoid
// using a pasted image if it is packaged with HTML -- this may occur with
// pastes from MS Word, for example. However this is only rich text if
// there's accompanying text.
if (this.getHTML() && this.getText()) {
return true;
}
// When an image is copied from a preview window, you end up with two
// DataTransferItems one of which is a file's metadata as text. Skip those.
if (this.isImage()) {
return false;
}
return this.types.some(function (type) {
return RICH_TEXT_TYPES[type];
});
};
/**
* Get raw text.
*
* @return {?string}
*/
DataTransfer.prototype.getText = function getText() {
var text;
if (this.data.getData) {
if (!this.types.length) {
text = this.data.getData('Text');
} else if (this.types.indexOf('text/plain') != -1) {
text = this.data.getData('text/plain');
}
}
return text ? text.replace(CR_LF_REGEX, LF_ONLY) : null;
};
/**
* Get HTML paste data
*
* @return {?string}
*/
DataTransfer.prototype.getHTML = function getHTML() {
if (this.data.getData) {
if (!this.types.length) {
return this.data.getData('Text');
} else if (this.types.indexOf('text/html') != -1) {
return this.data.getData('text/html');
}
}
};
/**
* Is this a link data transfer?
*
* @return {boolean}
*/
DataTransfer.prototype.isLink = function isLink() {
return this.types.some(function (type) {
return type.indexOf('Url') != -1 || type.indexOf('text/uri-list') != -1 || type.indexOf('text/x-moz-url');
});
};
/**
* Get a link url.
*
* @return {?string}
*/
DataTransfer.prototype.getLink = function getLink() {
if (this.data.getData) {
if (this.types.indexOf('text/x-moz-url') != -1) {
var url = this.data.getData('text/x-moz-url').split('\n');
return url[0];
}
return this.types.indexOf('text/uri-list') != -1 ? this.data.getData('text/uri-list') : this.data.getData('url');
}
return null;
};
/**
* Is this an image data transfer?
*
* @return {boolean}
*/
DataTransfer.prototype.isImage = function isImage() {
var isImage = this.types.some(function (type) {
// Firefox will have a type of application/x-moz-file for images during
// dragging
return type.indexOf('application/x-moz-file') != -1;
});
if (isImage) {
return true;
}
var items = this.getFiles();
for (var i = 0; i < items.length; i++) {
var type = items[i].type;
if (!PhotosMimeType.isImage(type)) {
return false;
}
}
return true;
};
DataTransfer.prototype.getCount = function getCount() {
if (this.data.hasOwnProperty('items')) {
return this.data.items.length;
} else if (this.data.hasOwnProperty('mozItemCount')) {
return this.data.mozItemCount;
} else if (this.data.files) {
return this.data.files.length;
}
return null;
};
/**
* Get files.
*
* @return {array}
*/
DataTransfer.prototype.getFiles = function getFiles() {
if (this.data.items) {
// createArrayFromMixed doesn't properly handle DataTransferItemLists.
return Array.prototype.slice.call(this.data.items).map(getFileFromDataTransfer).filter(emptyFunction.thatReturnsArgument);
} else if (this.data.files) {
return Array.prototype.slice.call(this.data.files);
} else {
return [];
}
};
/**
* Are there any files to fetch?
*
* @return {boolean}
*/
DataTransfer.prototype.hasFiles = function hasFiles() {
return this.getFiles().length > 0;
};
return DataTransfer;
}();
module.exports = DataTransfer;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/DataTransfer.js
// module id = 948
// module chunks = 4

View file

@ -0,0 +1,90 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
* @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 listen(target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, false);
return {
remove: function remove() {
target.removeEventListener(eventType, callback, false);
}
};
} else if (target.attachEvent) {
target.attachEvent('on' + eventType, callback);
return {
remove: function remove() {
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 capture(target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, true);
return {
remove: function remove() {
target.removeEventListener(eventType, callback, true);
}
};
} else {
if (process.env.NODE_ENV !== 'production') {
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
};
}
},
registerDefault: function registerDefault() {}
};
module.exports = EventListener;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/EventListener.js
// module id = 949
// module chunks = 4

View file

@ -0,0 +1,42 @@
/**
* Copyright (c) 2013-present, 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.
*
*/
'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;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/ExecutionEnvironment.js
// module id = 100
// module chunks = 4

View file

@ -0,0 +1,43 @@
"use strict";
/**
* Copyright (c) 2013-present, 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.
*
*/
module.exports = {
BACKSPACE: 8,
TAB: 9,
RETURN: 13,
ALT: 18,
ESC: 27,
SPACE: 32,
PAGE_UP: 33,
PAGE_DOWN: 34,
END: 35,
HOME: 36,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
DELETE: 46,
COMMA: 188,
PERIOD: 190,
A: 65,
Z: 90,
ZERO: 48,
NUMPAD_0: 96,
NUMPAD_9: 105
};
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/Keys.js
// module id = 608
// module chunks = 4

View file

@ -0,0 +1,35 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
*/
var PhotosMimeType = {
isImage: function isImage(mimeString) {
return getParts(mimeString)[0] === 'image';
},
isJpeg: function isJpeg(mimeString) {
var parts = getParts(mimeString);
return PhotosMimeType.isImage(mimeString) && (
// see http://fburl.com/10972194
parts[1] === 'jpeg' || parts[1] === 'pjpeg');
}
};
function getParts(mimeString) {
return mimeString.split('/');
}
module.exports = PhotosMimeType;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/PhotosMimeType.js
// module id = 2312
// module chunks = 4

View file

@ -0,0 +1,92 @@
"use strict";
/**
* Copyright (c) 2013-present, 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.
*
*/
/**
* @param {DOMElement} element
* @param {DOMDocument} doc
* @return {boolean}
*/
function _isViewportScrollElement(element, doc) {
return !!doc && (element === doc.documentElement || element === doc.body);
}
/**
* Scroll Module. This class contains 4 simple static functions
* to be used to access Element.scrollTop/scrollLeft properties.
* To solve the inconsistencies between browsers when either
* document.body or document.documentElement is supplied,
* below logic will be used to alleviate the issue:
*
* 1. If 'element' is either 'document.body' or 'document.documentElement,
* get whichever element's 'scroll{Top,Left}' is larger.
* 2. If 'element' is either 'document.body' or 'document.documentElement',
* set the 'scroll{Top,Left}' on both elements.
*/
var Scroll = {
/**
* @param {DOMElement} element
* @return {number}
*/
getTop: function getTop(element) {
var doc = element.ownerDocument;
return _isViewportScrollElement(element, doc) ?
// In practice, they will either both have the same value,
// or one will be zero and the other will be the scroll position
// of the viewport. So we can use `X || Y` instead of `Math.max(X, Y)`
doc.body.scrollTop || doc.documentElement.scrollTop : element.scrollTop;
},
/**
* @param {DOMElement} element
* @param {number} newTop
*/
setTop: function setTop(element, newTop) {
var doc = element.ownerDocument;
if (_isViewportScrollElement(element, doc)) {
doc.body.scrollTop = doc.documentElement.scrollTop = newTop;
} else {
element.scrollTop = newTop;
}
},
/**
* @param {DOMElement} element
* @return {number}
*/
getLeft: function getLeft(element) {
var doc = element.ownerDocument;
return _isViewportScrollElement(element, doc) ? doc.body.scrollLeft || doc.documentElement.scrollLeft : element.scrollLeft;
},
/**
* @param {DOMElement} element
* @param {number} newLeft
*/
setLeft: function setLeft(element, newLeft) {
var doc = element.ownerDocument;
if (_isViewportScrollElement(element, doc)) {
doc.body.scrollLeft = doc.documentElement.scrollLeft = newLeft;
} else {
element.scrollLeft = newLeft;
}
}
};
module.exports = Scroll;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/Scroll.js
// module id = 950
// module chunks = 4

View file

@ -0,0 +1,71 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
var getStyleProperty = require('./getStyleProperty');
/**
* @param {DOMNode} element [description]
* @param {string} name Overflow style property name.
* @return {boolean} True if the supplied ndoe is scrollable.
*/
function _isNodeScrollable(element, name) {
var overflow = Style.get(element, name);
return overflow === 'auto' || overflow === 'scroll';
}
/**
* Utilities for querying and mutating style properties.
*/
var Style = {
/**
* Gets the style property for the supplied node. This will return either the
* computed style, if available, or the declared style.
*
* @param {DOMNode} node
* @param {string} name Style property name.
* @return {?string} Style property value.
*/
get: getStyleProperty,
/**
* Determines the nearest ancestor of a node that is scrollable.
*
* NOTE: This can be expensive if used repeatedly or on a node nested deeply.
*
* @param {?DOMNode} node Node from which to start searching.
* @return {?DOMWindow|DOMElement} Scroll parent of the supplied node.
*/
getScrollParent: function getScrollParent(node) {
if (!node) {
return null;
}
var ownerDocument = node.ownerDocument;
while (node && node !== ownerDocument.body) {
if (_isNodeScrollable(node, 'overflow') || _isNodeScrollable(node, 'overflowY') || _isNodeScrollable(node, 'overflowX')) {
return node;
}
node = node.parentNode;
}
return ownerDocument.defaultView || ownerDocument.parentWindow;
}
};
module.exports = Style;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/Style.js
// module id = 609
// module chunks = 4

View file

@ -0,0 +1,44 @@
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
* @stub
*
*/
'use strict';
// \u00a1-\u00b1\u00b4-\u00b8\u00ba\u00bb\u00bf
// is latin supplement punctuation except fractions and superscript
// numbers
// \u2010-\u2027\u2030-\u205e
// is punctuation from the general punctuation block:
// weird quotes, commas, bullets, dashes, etc.
// \u30fb\u3001\u3002\u3008-\u3011\u3014-\u301f
// is CJK punctuation
// \uff1a-\uff1f\uff01-\uff0f\uff3b-\uff40\uff5b-\uff65
// is some full-width/half-width punctuation
// \u2E2E\u061f\u066a-\u066c\u061b\u060c\u060d\uFD3e\uFD3F
// is some Arabic punctuation marks
// \u1801\u0964\u104a\u104b
// is misc. other language punctuation marks
var PUNCTUATION = '[.,+*?$|#{}()\'\\^\\-\\[\\]\\\\\\/!@%"~=<>_:;' + '\u30FB\u3001\u3002\u3008-\u3011\u3014-\u301F\uFF1A-\uFF1F\uFF01-\uFF0F' + '\uFF3B-\uFF40\uFF5B-\uFF65\u2E2E\u061F\u066A-\u066C\u061B\u060C\u060D' + '\uFD3E\uFD3F\u1801\u0964\u104A\u104B\u2010-\u2027\u2030-\u205E' + '\xA1-\xB1\xB4-\xB8\xBA\xBB\xBF]';
module.exports = {
getPunctuation: function getPunctuation() {
return PUNCTUATION;
}
};
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/TokenizeUtil.js
// module id = 2313
// module chunks = 4

View file

@ -0,0 +1,37 @@
/**
* Copyright (c) 2013-present, 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.
*
*
*/
'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var URI = function () {
function URI(uri) {
_classCallCheck(this, URI);
this._uri = uri;
}
URI.prototype.toString = function toString() {
return this._uri;
};
return URI;
}();
module.exports = URI;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/URI.js
// module id = 2314
// module chunks = 4

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,115 @@
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*
*/
/**
* Constants to represent text directionality
*
* Also defines a *global* direciton, to be used in bidi algorithms as a
* default fallback direciton, when no better direction is found or provided.
*
* NOTE: Use `setGlobalDir()`, or update `initGlobalDir()`, to set the initial
* global direction value based on the application.
*
* Part of the implementation of Unicode Bidirectional Algorithm (UBA)
* Unicode Standard Annex #9 (UAX9)
* http://www.unicode.org/reports/tr9/
*/
'use strict';
var invariant = require('./invariant');
var NEUTRAL = 'NEUTRAL'; // No strong direction
var LTR = 'LTR'; // Left-to-Right direction
var RTL = 'RTL'; // Right-to-Left direction
var globalDir = null;
// == Helpers ==
/**
* Check if a directionality value is a Strong one
*/
function isStrong(dir) {
return dir === LTR || dir === RTL;
}
/**
* Get string value to be used for `dir` HTML attribute or `direction` CSS
* property.
*/
function getHTMLDir(dir) {
!isStrong(dir) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dir` must be a strong direction to be converted to HTML Direction') : invariant(false) : void 0;
return dir === LTR ? 'ltr' : 'rtl';
}
/**
* Get string value to be used for `dir` HTML attribute or `direction` CSS
* property, but returns null if `dir` has same value as `otherDir`.
* `null`.
*/
function getHTMLDirIfDifferent(dir, otherDir) {
!isStrong(dir) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dir` must be a strong direction to be converted to HTML Direction') : invariant(false) : void 0;
!isStrong(otherDir) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`otherDir` must be a strong direction to be converted to HTML Direction') : invariant(false) : void 0;
return dir === otherDir ? null : getHTMLDir(dir);
}
// == Global Direction ==
/**
* Set the global direction.
*/
function setGlobalDir(dir) {
globalDir = dir;
}
/**
* Initialize the global direction
*/
function initGlobalDir() {
setGlobalDir(LTR);
}
/**
* Get the global direction
*/
function getGlobalDir() {
if (!globalDir) {
this.initGlobalDir();
}
!globalDir ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Global direction not set.') : invariant(false) : void 0;
return globalDir;
}
var UnicodeBidiDirection = {
// Values
NEUTRAL: NEUTRAL,
LTR: LTR,
RTL: RTL,
// Helpers
isStrong: isStrong,
getHTMLDir: getHTMLDir,
getHTMLDirIfDifferent: getHTMLDirIfDifferent,
// Global Direction
setGlobalDir: setGlobalDir,
initGlobalDir: initGlobalDir,
getGlobalDir: getGlobalDir
};
module.exports = UnicodeBidiDirection;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/UnicodeBidiDirection.js
// module id = 610
// module chunks = 4

View file

@ -0,0 +1,107 @@
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*
*/
/**
* Stateful API for text direction detection
*
* This class can be used in applications where you need to detect the
* direction of a sequence of text blocks, where each direction shall be used
* as the fallback direction for the next one.
*
* NOTE: A default direction, if not provided, is set based on the global
* direction, as defined by `UnicodeBidiDirection`.
*
* == Example ==
* ```
* var UnicodeBidiService = require('UnicodeBidiService');
*
* var bidiService = new UnicodeBidiService();
*
* ...
*
* bidiService.reset();
* for (var para in paragraphs) {
* var dir = bidiService.getDirection(para);
* ...
* }
* ```
*
* Part of our implementation of Unicode Bidirectional Algorithm (UBA)
* Unicode Standard Annex #9 (UAX9)
* http://www.unicode.org/reports/tr9/
*/
'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var UnicodeBidi = require('./UnicodeBidi');
var UnicodeBidiDirection = require('./UnicodeBidiDirection');
var invariant = require('./invariant');
var UnicodeBidiService = function () {
/**
* Stateful class for paragraph direction detection
*
* @param defaultDir Default direction of the service
*/
function UnicodeBidiService(defaultDir) {
_classCallCheck(this, UnicodeBidiService);
if (!defaultDir) {
defaultDir = UnicodeBidiDirection.getGlobalDir();
} else {
!UnicodeBidiDirection.isStrong(defaultDir) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Default direction must be a strong direction (LTR or RTL)') : invariant(false) : void 0;
}
this._defaultDir = defaultDir;
this.reset();
}
/**
* Reset the internal state
*
* Instead of creating a new instance, you can just reset() your instance
* everytime you start a new loop.
*/
UnicodeBidiService.prototype.reset = function reset() {
this._lastDir = this._defaultDir;
};
/**
* Returns the direction of a block of text, and remembers it as the
* fall-back direction for the next paragraph.
*
* @param str A text block, e.g. paragraph, table cell, tag
* @return The resolved direction
*/
UnicodeBidiService.prototype.getDirection = function getDirection(str) {
this._lastDir = UnicodeBidi.getDirection(str, this._lastDir);
return this._lastDir;
};
return UnicodeBidiService;
}();
module.exports = UnicodeBidiService;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/UnicodeBidiService.js
// module id = 2315
// module chunks = 4

View file

@ -0,0 +1,221 @@
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
/**
* Unicode-enabled replacesments for basic String functions.
*
* All the functions in this module assume that the input string is a valid
* UTF-16 encoding of a Unicode sequence. If it's not the case, the behavior
* will be undefined.
*
* WARNING: Since this module is typechecks-enforced, you may find new bugs
* when replacing normal String functions with ones provided here.
*/
'use strict';
var invariant = require('./invariant');
// These two ranges are consecutive so anything in [HIGH_START, LOW_END] is a
// surrogate code unit.
var SURROGATE_HIGH_START = 0xD800;
var SURROGATE_HIGH_END = 0xDBFF;
var SURROGATE_LOW_START = 0xDC00;
var SURROGATE_LOW_END = 0xDFFF;
var SURROGATE_UNITS_REGEX = /[\uD800-\uDFFF]/;
/**
* @param {number} codeUnit A Unicode code-unit, in range [0, 0x10FFFF]
* @return {boolean} Whether code-unit is in a surrogate (hi/low) range
*/
function isCodeUnitInSurrogateRange(codeUnit) {
return SURROGATE_HIGH_START <= codeUnit && codeUnit <= SURROGATE_LOW_END;
}
/**
* Returns whether the two characters starting at `index` form a surrogate pair.
* For example, given the string s = "\uD83D\uDE0A", (s, 0) returns true and
* (s, 1) returns false.
*
* @param {string} str
* @param {number} index
* @return {boolean}
*/
function isSurrogatePair(str, index) {
!(0 <= index && index < str.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isSurrogatePair: Invalid index %s for string length %s.', index, str.length) : invariant(false) : void 0;
if (index + 1 === str.length) {
return false;
}
var first = str.charCodeAt(index);
var second = str.charCodeAt(index + 1);
return SURROGATE_HIGH_START <= first && first <= SURROGATE_HIGH_END && SURROGATE_LOW_START <= second && second <= SURROGATE_LOW_END;
}
/**
* @param {string} str Non-empty string
* @return {boolean} True if the input includes any surrogate code units
*/
function hasSurrogateUnit(str) {
return SURROGATE_UNITS_REGEX.test(str);
}
/**
* Return the length of the original Unicode character at given position in the
* String by looking into the UTF-16 code unit; that is equal to 1 for any
* non-surrogate characters in BMP ([U+0000..U+D7FF] and [U+E000, U+FFFF]); and
* returns 2 for the hi/low surrogates ([U+D800..U+DFFF]), which are in fact
* representing non-BMP characters ([U+10000..U+10FFFF]).
*
* Examples:
* - '\u0020' => 1
* - '\u3020' => 1
* - '\uD835' => 2
* - '\uD835\uDDEF' => 2
* - '\uDDEF' => 2
*
* @param {string} str Non-empty string
* @param {number} pos Position in the string to look for one code unit
* @return {number} Number 1 or 2
*/
function getUTF16Length(str, pos) {
return 1 + isCodeUnitInSurrogateRange(str.charCodeAt(pos));
}
/**
* Fully Unicode-enabled replacement for String#length
*
* @param {string} str Valid Unicode string
* @return {number} The number of Unicode characters in the string
*/
function strlen(str) {
// Call the native functions if there's no surrogate char
if (!hasSurrogateUnit(str)) {
return str.length;
}
var len = 0;
for (var pos = 0; pos < str.length; pos += getUTF16Length(str, pos)) {
len++;
}
return len;
}
/**
* Fully Unicode-enabled replacement for String#substr()
*
* @param {string} str Valid Unicode string
* @param {number} start Location in Unicode sequence to begin extracting
* @param {?number} length The number of Unicode characters to extract
* (default: to the end of the string)
* @return {string} Extracted sub-string
*/
function substr(str, start, length) {
start = start || 0;
length = length === undefined ? Infinity : length || 0;
// Call the native functions if there's no surrogate char
if (!hasSurrogateUnit(str)) {
return str.substr(start, length);
}
// Obvious cases
var size = str.length;
if (size <= 0 || start > size || length <= 0) {
return '';
}
// Find the actual starting position
var posA = 0;
if (start > 0) {
for (; start > 0 && posA < size; start--) {
posA += getUTF16Length(str, posA);
}
if (posA >= size) {
return '';
}
} else if (start < 0) {
for (posA = size; start < 0 && 0 < posA; start++) {
posA -= getUTF16Length(str, posA - 1);
}
if (posA < 0) {
posA = 0;
}
}
// Find the actual ending position
var posB = size;
if (length < size) {
for (posB = posA; length > 0 && posB < size; length--) {
posB += getUTF16Length(str, posB);
}
}
return str.substring(posA, posB);
}
/**
* Fully Unicode-enabled replacement for String#substring()
*
* @param {string} str Valid Unicode string
* @param {number} start Location in Unicode sequence to begin extracting
* @param {?number} end Location in Unicode sequence to end extracting
* (default: end of the string)
* @return {string} Extracted sub-string
*/
function substring(str, start, end) {
start = start || 0;
end = end === undefined ? Infinity : end || 0;
if (start < 0) {
start = 0;
}
if (end < 0) {
end = 0;
}
var length = Math.abs(end - start);
start = start < end ? start : end;
return substr(str, start, length);
}
/**
* Get a list of Unicode code-points from a String
*
* @param {string} str Valid Unicode string
* @return {array<number>} A list of code-points in [0..0x10FFFF]
*/
function getCodePoints(str) {
var codePoints = [];
for (var pos = 0; pos < str.length; pos += getUTF16Length(str, pos)) {
codePoints.push(str.codePointAt(pos));
}
return codePoints;
}
var UnicodeUtils = {
getCodePoints: getCodePoints,
getUTF16Length: getUTF16Length,
hasSurrogateUnit: hasSurrogateUnit,
isCodeUnitInSurrogateRange: isCodeUnitInSurrogateRange,
isSurrogatePair: isSurrogatePair,
strlen: strlen,
substring: substring,
substr: substr
};
module.exports = UnicodeUtils;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/UnicodeUtils.js
// module id = 247
// module chunks = 4

View file

@ -0,0 +1,248 @@
/**
* Copyright (c) 2013-present, 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.
*
*/
'use strict';
var UserAgentData = require('./UserAgentData');
var VersionRange = require('./VersionRange');
var mapObject = require('./mapObject');
var memoizeStringOnly = require('./memoizeStringOnly');
/**
* Checks to see whether `name` and `version` satisfy `query`.
*
* @param {string} name Name of the browser, device, engine or platform
* @param {?string} version Version of the browser, engine or platform
* @param {string} query Query of form "Name [range expression]"
* @param {?function} normalizer Optional pre-processor for range expression
* @return {boolean}
*/
function compare(name, version, query, normalizer) {
// check for exact match with no version
if (name === query) {
return true;
}
// check for non-matching names
if (!query.startsWith(name)) {
return false;
}
// full comparison with version
var range = query.slice(name.length);
if (version) {
range = normalizer ? normalizer(range) : range;
return VersionRange.contains(range, version);
}
return false;
}
/**
* Normalizes `version` by stripping any "NT" prefix, but only on the Windows
* platform.
*
* Mimics the stripping performed by the `UserAgentWindowsPlatform` PHP class.
*
* @param {string} version
* @return {string}
*/
function normalizePlatformVersion(version) {
if (UserAgentData.platformName === 'Windows') {
return version.replace(/^\s*NT/, '');
}
return version;
}
/**
* Provides client-side access to the authoritative PHP-generated User Agent
* information supplied by the server.
*/
var UserAgent = {
/**
* Check if the User Agent browser matches `query`.
*
* `query` should be a string like "Chrome" or "Chrome > 33".
*
* Valid browser names include:
*
* - ACCESS NetFront
* - AOL
* - Amazon Silk
* - Android
* - BlackBerry
* - BlackBerry PlayBook
* - Chrome
* - Chrome for iOS
* - Chrome frame
* - Facebook PHP SDK
* - Facebook for iOS
* - Firefox
* - IE
* - IE Mobile
* - Mobile Safari
* - Motorola Internet Browser
* - Nokia
* - Openwave Mobile Browser
* - Opera
* - Opera Mini
* - Opera Mobile
* - Safari
* - UIWebView
* - Unknown
* - webOS
* - etc...
*
* An authoritative list can be found in the PHP `BrowserDetector` class and
* related classes in the same file (see calls to `new UserAgentBrowser` here:
* https://fburl.com/50728104).
*
* @note Function results are memoized
*
* @param {string} query Query of the form "Name [range expression]"
* @return {boolean}
*/
isBrowser: function isBrowser(query) {
return compare(UserAgentData.browserName, UserAgentData.browserFullVersion, query);
},
/**
* Check if the User Agent browser uses a 32 or 64 bit architecture.
*
* @note Function results are memoized
*
* @param {string} query Query of the form "32" or "64".
* @return {boolean}
*/
isBrowserArchitecture: function isBrowserArchitecture(query) {
return compare(UserAgentData.browserArchitecture, null, query);
},
/**
* Check if the User Agent device matches `query`.
*
* `query` should be a string like "iPhone" or "iPad".
*
* Valid device names include:
*
* - Kindle
* - Kindle Fire
* - Unknown
* - iPad
* - iPhone
* - iPod
* - etc...
*
* An authoritative list can be found in the PHP `DeviceDetector` class and
* related classes in the same file (see calls to `new UserAgentDevice` here:
* https://fburl.com/50728332).
*
* @note Function results are memoized
*
* @param {string} query Query of the form "Name"
* @return {boolean}
*/
isDevice: function isDevice(query) {
return compare(UserAgentData.deviceName, null, query);
},
/**
* Check if the User Agent rendering engine matches `query`.
*
* `query` should be a string like "WebKit" or "WebKit >= 537".
*
* Valid engine names include:
*
* - Gecko
* - Presto
* - Trident
* - WebKit
* - etc...
*
* An authoritative list can be found in the PHP `RenderingEngineDetector`
* class related classes in the same file (see calls to `new
* UserAgentRenderingEngine` here: https://fburl.com/50728617).
*
* @note Function results are memoized
*
* @param {string} query Query of the form "Name [range expression]"
* @return {boolean}
*/
isEngine: function isEngine(query) {
return compare(UserAgentData.engineName, UserAgentData.engineVersion, query);
},
/**
* Check if the User Agent platform matches `query`.
*
* `query` should be a string like "Windows" or "iOS 5 - 6".
*
* Valid platform names include:
*
* - Android
* - BlackBerry OS
* - Java ME
* - Linux
* - Mac OS X
* - Mac OS X Calendar
* - Mac OS X Internet Account
* - Symbian
* - SymbianOS
* - Windows
* - Windows Mobile
* - Windows Phone
* - iOS
* - iOS Facebook Integration Account
* - iOS Facebook Social Sharing UI
* - webOS
* - Chrome OS
* - etc...
*
* An authoritative list can be found in the PHP `PlatformDetector` class and
* related classes in the same file (see calls to `new UserAgentPlatform`
* here: https://fburl.com/50729226).
*
* @note Function results are memoized
*
* @param {string} query Query of the form "Name [range expression]"
* @return {boolean}
*/
isPlatform: function isPlatform(query) {
return compare(UserAgentData.platformName, UserAgentData.platformFullVersion, query, normalizePlatformVersion);
},
/**
* Check if the User Agent platform is a 32 or 64 bit architecture.
*
* @note Function results are memoized
*
* @param {string} query Query of the form "32" or "64".
* @return {boolean}
*/
isPlatformArchitecture: function isPlatformArchitecture(query) {
return compare(UserAgentData.platformArchitecture, null, query);
}
};
module.exports = mapObject(UserAgent, memoizeStringOnly);
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/UserAgent.js
// module id = 154
// module chunks = 4

View file

@ -0,0 +1,89 @@
/**
* Copyright (c) 2013-present, 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.
*
*/
/**
* Usage note:
* This module makes a best effort to export the same data we would internally.
* At Facebook we use a server-generated module that does the parsing and
* exports the data for the client to use. We can't rely on a server-side
* implementation in open source so instead we make use of an open source
* library to do the heavy lifting and then make some adjustments as necessary.
* It's likely there will be some differences. Some we can smooth over.
* Others are going to be harder.
*/
'use strict';
var UAParser = require('ua-parser-js');
var UNKNOWN = 'Unknown';
var PLATFORM_MAP = {
'Mac OS': 'Mac OS X'
};
/**
* Convert from UAParser platform name to what we expect.
*/
function convertPlatformName(name) {
return PLATFORM_MAP[name] || name;
}
/**
* Get the version number in parts. This is very naive. We actually get major
* version as a part of UAParser already, which is generally good enough, but
* let's get the minor just in case.
*/
function getBrowserVersion(version) {
if (!version) {
return {
major: '',
minor: ''
};
}
var parts = version.split('.');
return {
major: parts[0],
minor: parts[1]
};
}
/**
* Get the UA data fom UAParser and then convert it to the format we're
* expecting for our APIS.
*/
var parser = new UAParser();
var results = parser.getResult();
// Do some conversion first.
var browserVersionData = getBrowserVersion(results.browser.version);
var uaData = {
browserArchitecture: results.cpu.architecture || UNKNOWN,
browserFullVersion: results.browser.version || UNKNOWN,
browserMinorVersion: browserVersionData.minor || UNKNOWN,
browserName: results.browser.name || UNKNOWN,
browserVersion: results.browser.major || UNKNOWN,
deviceName: results.device.model || UNKNOWN,
engineName: results.engine.name || UNKNOWN,
engineVersion: results.engine.version || UNKNOWN,
platformArchitecture: results.cpu.architecture || UNKNOWN,
platformName: convertPlatformName(results.os.name) || UNKNOWN,
platformVersion: results.os.version || UNKNOWN,
platformFullVersion: results.os.version || UNKNOWN
};
module.exports = uaData;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/UserAgentData.js
// module id = 2316
// module chunks = 4

View file

@ -0,0 +1,389 @@
/**
* Copyright (c) 2013-present, 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.
*
*/
'use strict';
var invariant = require('./invariant');
var componentRegex = /\./;
var orRegex = /\|\|/;
var rangeRegex = /\s+\-\s+/;
var modifierRegex = /^(<=|<|=|>=|~>|~|>|)?\s*(.+)/;
var numericRegex = /^(\d*)(.*)/;
/**
* Splits input `range` on "||" and returns true if any subrange matches
* `version`.
*
* @param {string} range
* @param {string} version
* @returns {boolean}
*/
function checkOrExpression(range, version) {
var expressions = range.split(orRegex);
if (expressions.length > 1) {
return expressions.some(function (range) {
return VersionRange.contains(range, version);
});
} else {
range = expressions[0].trim();
return checkRangeExpression(range, version);
}
}
/**
* Splits input `range` on " - " (the surrounding whitespace is required) and
* returns true if version falls between the two operands.
*
* @param {string} range
* @param {string} version
* @returns {boolean}
*/
function checkRangeExpression(range, version) {
var expressions = range.split(rangeRegex);
!(expressions.length > 0 && expressions.length <= 2) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'the "-" operator expects exactly 2 operands') : invariant(false) : void 0;
if (expressions.length === 1) {
return checkSimpleExpression(expressions[0], version);
} else {
var startVersion = expressions[0],
endVersion = expressions[1];
!(isSimpleVersion(startVersion) && isSimpleVersion(endVersion)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'operands to the "-" operator must be simple (no modifiers)') : invariant(false) : void 0;
return checkSimpleExpression('>=' + startVersion, version) && checkSimpleExpression('<=' + endVersion, version);
}
}
/**
* Checks if `range` matches `version`. `range` should be a "simple" range (ie.
* not a compound range using the " - " or "||" operators).
*
* @param {string} range
* @param {string} version
* @returns {boolean}
*/
function checkSimpleExpression(range, version) {
range = range.trim();
if (range === '') {
return true;
}
var versionComponents = version.split(componentRegex);
var _getModifierAndCompon = getModifierAndComponents(range),
modifier = _getModifierAndCompon.modifier,
rangeComponents = _getModifierAndCompon.rangeComponents;
switch (modifier) {
case '<':
return checkLessThan(versionComponents, rangeComponents);
case '<=':
return checkLessThanOrEqual(versionComponents, rangeComponents);
case '>=':
return checkGreaterThanOrEqual(versionComponents, rangeComponents);
case '>':
return checkGreaterThan(versionComponents, rangeComponents);
case '~':
case '~>':
return checkApproximateVersion(versionComponents, rangeComponents);
default:
return checkEqual(versionComponents, rangeComponents);
}
}
/**
* Checks whether `a` is less than `b`.
*
* @param {array<string>} a
* @param {array<string>} b
* @returns {boolean}
*/
function checkLessThan(a, b) {
return compareComponents(a, b) === -1;
}
/**
* Checks whether `a` is less than or equal to `b`.
*
* @param {array<string>} a
* @param {array<string>} b
* @returns {boolean}
*/
function checkLessThanOrEqual(a, b) {
var result = compareComponents(a, b);
return result === -1 || result === 0;
}
/**
* Checks whether `a` is equal to `b`.
*
* @param {array<string>} a
* @param {array<string>} b
* @returns {boolean}
*/
function checkEqual(a, b) {
return compareComponents(a, b) === 0;
}
/**
* Checks whether `a` is greater than or equal to `b`.
*
* @param {array<string>} a
* @param {array<string>} b
* @returns {boolean}
*/
function checkGreaterThanOrEqual(a, b) {
var result = compareComponents(a, b);
return result === 1 || result === 0;
}
/**
* Checks whether `a` is greater than `b`.
*
* @param {array<string>} a
* @param {array<string>} b
* @returns {boolean}
*/
function checkGreaterThan(a, b) {
return compareComponents(a, b) === 1;
}
/**
* Checks whether `a` is "reasonably close" to `b` (as described in
* https://www.npmjs.org/doc/misc/semver.html). For example, if `b` is "1.3.1"
* then "reasonably close" is defined as ">= 1.3.1 and < 1.4".
*
* @param {array<string>} a
* @param {array<string>} b
* @returns {boolean}
*/
function checkApproximateVersion(a, b) {
var lowerBound = b.slice();
var upperBound = b.slice();
if (upperBound.length > 1) {
upperBound.pop();
}
var lastIndex = upperBound.length - 1;
var numeric = parseInt(upperBound[lastIndex], 10);
if (isNumber(numeric)) {
upperBound[lastIndex] = numeric + 1 + '';
}
return checkGreaterThanOrEqual(a, lowerBound) && checkLessThan(a, upperBound);
}
/**
* Extracts the optional modifier (<, <=, =, >=, >, ~, ~>) and version
* components from `range`.
*
* For example, given `range` ">= 1.2.3" returns an object with a `modifier` of
* `">="` and `components` of `[1, 2, 3]`.
*
* @param {string} range
* @returns {object}
*/
function getModifierAndComponents(range) {
var rangeComponents = range.split(componentRegex);
var matches = rangeComponents[0].match(modifierRegex);
!matches ? process.env.NODE_ENV !== 'production' ? invariant(false, 'expected regex to match but it did not') : invariant(false) : void 0;
return {
modifier: matches[1],
rangeComponents: [matches[2]].concat(rangeComponents.slice(1))
};
}
/**
* Determines if `number` is a number.
*
* @param {mixed} number
* @returns {boolean}
*/
function isNumber(number) {
return !isNaN(number) && isFinite(number);
}
/**
* Tests whether `range` is a "simple" version number without any modifiers
* (">", "~" etc).
*
* @param {string} range
* @returns {boolean}
*/
function isSimpleVersion(range) {
return !getModifierAndComponents(range).modifier;
}
/**
* Zero-pads array `array` until it is at least `length` long.
*
* @param {array} array
* @param {number} length
*/
function zeroPad(array, length) {
for (var i = array.length; i < length; i++) {
array[i] = '0';
}
}
/**
* Normalizes `a` and `b` in preparation for comparison by doing the following:
*
* - zero-pads `a` and `b`
* - marks any "x", "X" or "*" component in `b` as equivalent by zero-ing it out
* in both `a` and `b`
* - marks any final "*" component in `b` as a greedy wildcard by zero-ing it
* and all of its successors in `a`
*
* @param {array<string>} a
* @param {array<string>} b
* @returns {array<array<string>>}
*/
function normalizeVersions(a, b) {
a = a.slice();
b = b.slice();
zeroPad(a, b.length);
// mark "x" and "*" components as equal
for (var i = 0; i < b.length; i++) {
var matches = b[i].match(/^[x*]$/i);
if (matches) {
b[i] = a[i] = '0';
// final "*" greedily zeros all remaining components
if (matches[0] === '*' && i === b.length - 1) {
for (var j = i; j < a.length; j++) {
a[j] = '0';
}
}
}
}
zeroPad(b, a.length);
return [a, b];
}
/**
* Returns the numerical -- not the lexicographical -- ordering of `a` and `b`.
*
* For example, `10-alpha` is greater than `2-beta`.
*
* @param {string} a
* @param {string} b
* @returns {number} -1, 0 or 1 to indicate whether `a` is less than, equal to,
* or greater than `b`, respectively
*/
function compareNumeric(a, b) {
var aPrefix = a.match(numericRegex)[1];
var bPrefix = b.match(numericRegex)[1];
var aNumeric = parseInt(aPrefix, 10);
var bNumeric = parseInt(bPrefix, 10);
if (isNumber(aNumeric) && isNumber(bNumeric) && aNumeric !== bNumeric) {
return compare(aNumeric, bNumeric);
} else {
return compare(a, b);
}
}
/**
* Returns the ordering of `a` and `b`.
*
* @param {string|number} a
* @param {string|number} b
* @returns {number} -1, 0 or 1 to indicate whether `a` is less than, equal to,
* or greater than `b`, respectively
*/
function compare(a, b) {
!(typeof a === typeof b) ? process.env.NODE_ENV !== 'production' ? invariant(false, '"a" and "b" must be of the same type') : invariant(false) : void 0;
if (a > b) {
return 1;
} else if (a < b) {
return -1;
} else {
return 0;
}
}
/**
* Compares arrays of version components.
*
* @param {array<string>} a
* @param {array<string>} b
* @returns {number} -1, 0 or 1 to indicate whether `a` is less than, equal to,
* or greater than `b`, respectively
*/
function compareComponents(a, b) {
var _normalizeVersions = normalizeVersions(a, b),
aNormalized = _normalizeVersions[0],
bNormalized = _normalizeVersions[1];
for (var i = 0; i < bNormalized.length; i++) {
var result = compareNumeric(aNormalized[i], bNormalized[i]);
if (result) {
return result;
}
}
return 0;
}
var VersionRange = {
/**
* Checks whether `version` satisfies the `range` specification.
*
* We support a subset of the expressions defined in
* https://www.npmjs.org/doc/misc/semver.html:
*
* version Must match version exactly
* =version Same as just version
* >version Must be greater than version
* >=version Must be greater than or equal to version
* <version Must be less than version
* <=version Must be less than or equal to version
* ~version Must be at least version, but less than the next significant
* revision above version:
* "~1.2.3" is equivalent to ">= 1.2.3 and < 1.3"
* ~>version Equivalent to ~version
* 1.2.x Must match "1.2.x", where "x" is a wildcard that matches
* anything
* 1.2.* Similar to "1.2.x", but "*" in the trailing position is a
* "greedy" wildcard, so will match any number of additional
* components:
* "1.2.*" will match "1.2.1", "1.2.1.1", "1.2.1.1.1" etc
* * Any version
* "" (Empty string) Same as *
* v1 - v2 Equivalent to ">= v1 and <= v2"
* r1 || r2 Passes if either r1 or r2 are satisfied
*
* @param {string} range
* @param {string} version
* @returns {boolean}
*/
contains: function contains(range, version) {
return checkOrExpression(range.trim(), version.trim());
}
};
module.exports = VersionRange;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/VersionRange.js
// module id = 2317
// module chunks = 4

View file

@ -0,0 +1,38 @@
"use strict";
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
var _hyphenPattern = /-(.)/g;
/**
* Camelcases a hyphenated string, for example:
*
* > camelize('background-color')
* < "backgroundColor"
*
* @param {string} string
* @return {string}
*/
function camelize(string) {
return string.replace(_hyphenPattern, function (_, character) {
return character.toUpperCase();
});
}
module.exports = camelize;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/camelize.js
// module id = 952
// module chunks = 4

View file

@ -0,0 +1,46 @@
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
'use strict';
var camelize = require('./camelize');
var msPattern = /^-ms-/;
/**
* Camelcases a hyphenated CSS property name, for example:
*
* > camelizeStyleName('background-color')
* < "backgroundColor"
* > camelizeStyleName('-moz-transition')
* < "MozTransition"
* > camelizeStyleName('-ms-transition')
* < "msTransition"
*
* As Andi Smith suggests
* (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
* is converted to lowercase `ms`.
*
* @param {string} string
* @return {string}
*/
function camelizeStyleName(string) {
return camelize(string.replace(msPattern, 'ms-'));
}
module.exports = camelizeStyleName;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/camelizeStyleName.js
// module id = 2318
// module chunks = 4

View file

@ -0,0 +1,46 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
*
*/
var isTextNode = require('./isTextNode');
/*eslint-disable no-bitwise */
/**
* Checks if a given DOM node contains or is another DOM node.
*/
function containsNode(outerNode, innerNode) {
if (!outerNode || !innerNode) {
return false;
} else if (outerNode === innerNode) {
return true;
} else if (isTextNode(outerNode)) {
return false;
} else if (isTextNode(innerNode)) {
return containsNode(outerNode, innerNode.parentNode);
} else if ('contains' in outerNode) {
return outerNode.contains(innerNode);
} else if (outerNode.compareDocumentPosition) {
return !!(outerNode.compareDocumentPosition(innerNode) & 16);
} else {
return false;
}
}
module.exports = containsNode;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/containsNode.js
// module id = 611
// module chunks = 4

View file

@ -0,0 +1,133 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
var invariant = require('./invariant');
/**
* Convert array-like objects to arrays.
*
* This API assumes the caller knows the contents of the data type. For less
* well defined inputs use createArrayFromMixed.
*
* @param {object|function|filelist} obj
* @return {array}
*/
function toArray(obj) {
var length = obj.length;
// Some browsers builtin objects can report typeof 'function' (e.g. NodeList
// in old versions of Safari).
!(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0;
!(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0;
!(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0;
!(typeof obj.callee !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object can\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0;
// Old IE doesn't give collections access to hasOwnProperty. Assume inputs
// without method will throw during the slice call and skip straight to the
// fallback.
if (obj.hasOwnProperty) {
try {
return Array.prototype.slice.call(obj);
} catch (e) {
// IE < 9 does not support Array#slice on collections objects
}
}
// Fall back to copying key by key. This assumes all keys have a value,
// so will not preserve sparsely populated inputs.
var ret = Array(length);
for (var ii = 0; ii < length; ii++) {
ret[ii] = obj[ii];
}
return ret;
}
/**
* Perform a heuristic test to determine if an object is "array-like".
*
* A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
* Joshu replied: "Mu."
*
* This function determines if its argument has "array nature": it returns
* true if the argument is an actual array, an `arguments' object, or an
* HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
*
* It will return false for other array-like objects like Filelist.
*
* @param {*} obj
* @return {boolean}
*/
function hasArrayNature(obj) {
return (
// not null/false
!!obj && (
// arrays are objects, NodeLists are functions in Safari
typeof obj == 'object' || typeof obj == 'function') &&
// quacks like an array
'length' in obj &&
// not window
!('setInterval' in obj) &&
// no DOM node should be considered an array-like
// a 'select' element has 'length' and 'item' properties on IE8
typeof obj.nodeType != 'number' && (
// a real array
Array.isArray(obj) ||
// arguments
'callee' in obj ||
// HTMLCollection/NodeList
'item' in obj)
);
}
/**
* Ensure that the argument is an array by wrapping it in an array if it is not.
* Creates a copy of the argument if it is already an array.
*
* This is mostly useful idiomatically:
*
* var createArrayFromMixed = require('createArrayFromMixed');
*
* function takesOneOrMoreThings(things) {
* things = createArrayFromMixed(things);
* ...
* }
*
* This allows you to treat `things' as an array, but accept scalars in the API.
*
* If you need to convert an array-like object, like `arguments`, into an array
* use toArray instead.
*
* @param {*} obj
* @return {array}
*/
function createArrayFromMixed(obj) {
if (!hasArrayNature(obj)) {
return [obj];
} else if (Array.isArray(obj)) {
return obj.slice();
} else {
return toArray(obj);
}
}
module.exports = createArrayFromMixed;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/createArrayFromMixed.js
// module id = 953
// module chunks = 4

View file

@ -0,0 +1,90 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
/*eslint-disable fb-www/unsafe-html*/
var ExecutionEnvironment = require('./ExecutionEnvironment');
var createArrayFromMixed = require('./createArrayFromMixed');
var getMarkupWrap = require('./getMarkupWrap');
var invariant = require('./invariant');
/**
* Dummy container used to render all markup.
*/
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
/**
* Pattern used by `getNodeName`.
*/
var nodeNamePattern = /^\s*<(\w+)/;
/**
* Extracts the `nodeName` of the first element in a string of markup.
*
* @param {string} markup String of markup.
* @return {?string} Node name of the supplied markup.
*/
function getNodeName(markup) {
var nodeNameMatch = markup.match(nodeNamePattern);
return nodeNameMatch && nodeNameMatch[1].toLowerCase();
}
/**
* Creates an array containing the nodes rendered from the supplied markup. The
* optionally supplied `handleScript` function will be invoked once for each
* <script> element that is rendered. If no `handleScript` function is supplied,
* an exception is thrown if any <script> elements are rendered.
*
* @param {string} markup A string of valid HTML markup.
* @param {?function} handleScript Invoked once for each rendered <script>.
* @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
*/
function createNodesFromMarkup(markup, handleScript) {
var node = dummyNode;
!!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0;
var nodeName = getNodeName(markup);
var wrap = nodeName && getMarkupWrap(nodeName);
if (wrap) {
node.innerHTML = wrap[1] + markup + wrap[2];
var wrapDepth = wrap[0];
while (wrapDepth--) {
node = node.lastChild;
}
} else {
node.innerHTML = markup;
}
var scripts = node.getElementsByTagName('script');
if (scripts.length) {
!handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0;
createArrayFromMixed(scripts).forEach(handleScript);
}
var nodes = Array.from(node.childNodes);
while (node.lastChild) {
node.removeChild(node.lastChild);
}
return nodes;
}
module.exports = createNodesFromMarkup;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/createNodesFromMarkup.js
// module id = 2319
// module chunks = 4

View file

@ -0,0 +1,48 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
*/
/**
* This function is used to mark string literals representing CSS class names
* so that they can be transformed statically. This allows for modularization
* and minification of CSS class names.
*
* In static_upstream, this function is actually implemented, but it should
* eventually be replaced with something more descriptive, and the transform
* that is used in the main stack should be ported for use elsewhere.
*
* @param string|object className to modularize, or an object of key/values.
* In the object case, the values are conditions that
* determine if the className keys should be included.
* @param [string ...] Variable list of classNames in the string case.
* @return string Renderable space-separated CSS className.
*/
function cx(classNames) {
if (typeof classNames == 'object') {
return Object.keys(classNames).filter(function (className) {
return classNames[className];
}).map(replace).join(' ');
}
return Array.prototype.map.call(arguments, replace).join(' ');
}
function replace(str) {
return str.replace(/\//g, '-');
}
module.exports = cx;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/cx.js
// module id = 331
// module chunks = 4

View file

@ -0,0 +1,45 @@
"use strict";
/**
* Copyright (c) 2013-present, 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.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/emptyFunction.js
// module id = 93
// module chunks = 4

View file

@ -0,0 +1,26 @@
/**
* Copyright (c) 2013-present, 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.
*
*/
'use strict';
var emptyObject = {};
if (process.env.NODE_ENV !== 'production') {
Object.freeze(emptyObject);
}
module.exports = emptyObject;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/emptyObject.js
// module id = 283
// module chunks = 4

View file

@ -0,0 +1,33 @@
/**
* Copyright (c) 2013-present, 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.
*
*/
'use strict';
/**
* @param {DOMElement} node input/textarea to focus
*/
function focusNode(node) {
// IE8 can throw "Can't move focus to the control because it is invisible,
// not enabled, or of a type that does not accept the focus." for all kinds of
// reasons that are too expensive and fragile to test.
try {
node.focus();
} catch (e) {}
}
module.exports = focusNode;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/focusNode.js
// module id = 954
// module chunks = 4

View file

@ -0,0 +1,45 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
/* eslint-disable fb-www/typeof-undefined */
/**
* Same as document.activeElement but wraps in a try-catch block. In IE it is
* not safe to call document.activeElement if there is nothing focused.
*
* The activeElement will be null only if the document or document body is not
* yet defined.
*
* @param {?DOMDocument} doc Defaults to current document.
* @return {?DOMElement}
*/
function getActiveElement(doc) /*?DOMElement*/{
doc = doc || (typeof document !== 'undefined' ? document : undefined);
if (typeof doc === 'undefined') {
return null;
}
try {
return doc.activeElement || doc.body;
} catch (e) {
return doc.body;
}
}
module.exports = getActiveElement;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/getActiveElement.js
// module id = 419
// module chunks = 4

View file

@ -0,0 +1,37 @@
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
'use strict';
var isWebkit = typeof navigator !== 'undefined' && navigator.userAgent.indexOf('AppleWebKit') > -1;
/**
* Gets the element with the document scroll properties such as `scrollLeft` and
* `scrollHeight`. This may differ across different browsers.
*
* NOTE: The return value can be null if the DOM is not yet ready.
*
* @param {?DOMDocument} doc Defaults to current document.
* @return {?DOMElement}
*/
function getDocumentScrollElement(doc) {
doc = doc || document;
return !isWebkit && doc.compatMode === 'CSS1Compat' ? doc.documentElement : doc.body;
}
module.exports = getDocumentScrollElement;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/getDocumentScrollElement.js
// module id = 2320
// module chunks = 4

View file

@ -0,0 +1,40 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
var getElementRect = require('./getElementRect');
/**
* Gets an element's position in pixels relative to the viewport. The returned
* object represents the position of the element's top left corner.
*
* @param {DOMElement} element
* @return {object}
*/
function getElementPosition(element) {
var rect = getElementRect(element);
return {
x: rect.left,
y: rect.top,
width: rect.right - rect.left,
height: rect.bottom - rect.top
};
}
module.exports = getElementPosition;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/getElementPosition.js
// module id = 2321
// module chunks = 4

View file

@ -0,0 +1,57 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
var containsNode = require('./containsNode');
/**
* Gets an element's bounding rect in pixels relative to the viewport.
*
* @param {DOMElement} elem
* @return {object}
*/
function getElementRect(elem) {
var docElem = elem.ownerDocument.documentElement;
// FF 2, Safari 3 and Opera 9.5- do not support getBoundingClientRect().
// IE9- will throw if the element is not in the document.
if (!('getBoundingClientRect' in elem) || !containsNode(docElem, elem)) {
return {
left: 0,
right: 0,
top: 0,
bottom: 0
};
}
// Subtracts clientTop/Left because IE8- added a 2px border to the
// <html> element (see http://fburl.com/1493213). IE 7 in
// Quicksmode does not report clientLeft/clientTop so there
// will be an unaccounted offset of 2px when in quirksmode
var rect = elem.getBoundingClientRect();
return {
left: Math.round(rect.left) - docElem.clientLeft,
right: Math.round(rect.right) - docElem.clientLeft,
top: Math.round(rect.top) - docElem.clientTop,
bottom: Math.round(rect.bottom) - docElem.clientTop
};
}
module.exports = getElementRect;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/getElementRect.js
// module id = 2322
// module chunks = 4

View file

@ -0,0 +1,101 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
*/
/*eslint-disable fb-www/unsafe-html */
var ExecutionEnvironment = require('./ExecutionEnvironment');
var invariant = require('./invariant');
/**
* Dummy container used to detect which wraps are necessary.
*/
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
/**
* Some browsers cannot use `innerHTML` to render certain elements standalone,
* so we wrap them, render the wrapped nodes, then extract the desired node.
*
* In IE8, certain elements cannot render alone, so wrap all elements ('*').
*/
var shouldWrap = {};
var selectWrap = [1, '<select multiple="true">', '</select>'];
var tableWrap = [1, '<table>', '</table>'];
var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
var markupWrap = {
'*': [1, '?<div>', '</div>'],
'area': [1, '<map>', '</map>'],
'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
'legend': [1, '<fieldset>', '</fieldset>'],
'param': [1, '<object>', '</object>'],
'tr': [2, '<table><tbody>', '</tbody></table>'],
'optgroup': selectWrap,
'option': selectWrap,
'caption': tableWrap,
'colgroup': tableWrap,
'tbody': tableWrap,
'tfoot': tableWrap,
'thead': tableWrap,
'td': trWrap,
'th': trWrap
};
// Initialize the SVG elements since we know they'll always need to be wrapped
// consistently. If they are created inside a <div> they will be initialized in
// the wrong namespace (and will not display).
var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
svgElements.forEach(function (nodeName) {
markupWrap[nodeName] = svgWrap;
shouldWrap[nodeName] = true;
});
/**
* Gets the markup wrap configuration for the supplied `nodeName`.
*
* NOTE: This lazily detects which wraps are necessary for the current browser.
*
* @param {string} nodeName Lowercase `nodeName`.
* @return {?array} Markup wrap configuration, if applicable.
*/
function getMarkupWrap(nodeName) {
!!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0;
if (!markupWrap.hasOwnProperty(nodeName)) {
nodeName = '*';
}
if (!shouldWrap.hasOwnProperty(nodeName)) {
if (nodeName === '*') {
dummyNode.innerHTML = '<link />';
} else {
dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
}
shouldWrap[nodeName] = !dummyNode.firstChild;
}
return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
}
module.exports = getMarkupWrap;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/getMarkupWrap.js
// module id = 2323
// module chunks = 4

View file

@ -0,0 +1,54 @@
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
'use strict';
var getDocumentScrollElement = require('./getDocumentScrollElement');
var getUnboundedScrollPosition = require('./getUnboundedScrollPosition');
/**
* Gets the scroll position of the supplied element or window.
*
* The return values are bounded. This means that if the scroll position is
* negative or exceeds the element boundaries (which is possible using inertial
* scrolling), you will get zero or the maximum scroll position, respectively.
*
* If you need the unbound scroll position, use `getUnboundedScrollPosition`.
*
* @param {DOMWindow|DOMElement} scrollable
* @return {object} Map with `x` and `y` keys.
*/
function getScrollPosition(scrollable) {
var documentScrollElement = getDocumentScrollElement(scrollable.ownerDocument || scrollable.document);
if (scrollable.Window && scrollable instanceof scrollable.Window) {
scrollable = documentScrollElement;
}
var scrollPosition = getUnboundedScrollPosition(scrollable);
var viewport = scrollable === documentScrollElement ? scrollable.ownerDocument.documentElement : scrollable;
var xMax = scrollable.scrollWidth - viewport.clientWidth;
var yMax = scrollable.scrollHeight - viewport.clientHeight;
scrollPosition.x = Math.max(0, Math.min(scrollPosition.x, xMax));
scrollPosition.y = Math.max(0, Math.min(scrollPosition.y, yMax));
return scrollPosition;
}
module.exports = getScrollPosition;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/getScrollPosition.js
// module id = 612
// module chunks = 4

View file

@ -0,0 +1,60 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
var camelize = require('./camelize');
var hyphenate = require('./hyphenate');
function asString(value) /*?string*/{
return value == null ? value : String(value);
}
function getStyleProperty( /*DOMNode*/node, /*string*/name) /*?string*/{
var computedStyle = void 0;
// W3C Standard
if (window.getComputedStyle) {
// In certain cases such as within an iframe in FF3, this returns null.
computedStyle = window.getComputedStyle(node, null);
if (computedStyle) {
return asString(computedStyle.getPropertyValue(hyphenate(name)));
}
}
// Safari
if (document.defaultView && document.defaultView.getComputedStyle) {
computedStyle = document.defaultView.getComputedStyle(node, null);
// A Safari bug causes this to return null for `display: none` elements.
if (computedStyle) {
return asString(computedStyle.getPropertyValue(hyphenate(name)));
}
if (name === 'display') {
return 'none';
}
}
// Internet Explorer
if (node.currentStyle) {
if (name === 'float') {
return asString(node.currentStyle.cssFloat || node.currentStyle.styleFloat);
}
return asString(node.currentStyle[camelize(name)]);
}
return asString(node.style && node.style[camelize(name)]);
}
module.exports = getStyleProperty;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/getStyleProperty.js
// module id = 2324
// module chunks = 4

View file

@ -0,0 +1,45 @@
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
'use strict';
/**
* Gets the scroll position of the supplied element or window.
*
* The return values are unbounded, unlike `getScrollPosition`. This means they
* may be negative or exceed the element boundaries (which is possible using
* inertial scrolling).
*
* @param {DOMWindow|DOMElement} scrollable
* @return {object} Map with `x` and `y` keys.
*/
function getUnboundedScrollPosition(scrollable) {
if (scrollable.Window && scrollable instanceof scrollable.Window) {
return {
x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft,
y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop
};
}
return {
x: scrollable.scrollLeft,
y: scrollable.scrollTop
};
}
module.exports = getUnboundedScrollPosition;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/getUnboundedScrollPosition.js
// module id = 955
// module chunks = 4

View file

@ -0,0 +1,66 @@
"use strict";
function getViewportWidth() {
var width = void 0;
if (document.documentElement) {
width = document.documentElement.clientWidth;
}
if (!width && document.body) {
width = document.body.clientWidth;
}
return width || 0;
} /**
* Copyright (c) 2013-present, 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.
*
*
* @typechecks
*/
function getViewportHeight() {
var height = void 0;
if (document.documentElement) {
height = document.documentElement.clientHeight;
}
if (!height && document.body) {
height = document.body.clientHeight;
}
return height || 0;
}
/**
* Gets the viewport dimensions including any scrollbars.
*/
function getViewportDimensions() {
return {
width: window.innerWidth || getViewportWidth(),
height: window.innerHeight || getViewportHeight()
};
}
/**
* Gets the viewport dimensions excluding any scrollbars.
*/
getViewportDimensions.withoutScrollbars = function () {
return {
width: getViewportWidth(),
height: getViewportHeight()
};
};
module.exports = getViewportDimensions;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/getViewportDimensions.js
// module id = 2325
// module chunks = 4

View file

@ -0,0 +1,39 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
var _uppercasePattern = /([A-Z])/g;
/**
* Hyphenates a camelcased string, for example:
*
* > hyphenate('backgroundColor')
* < "background-color"
*
* For CSS style names, use `hyphenateStyleName` instead which works properly
* with all vendor prefixes, including `ms`.
*
* @param {string} string
* @return {string}
*/
function hyphenate(string) {
return string.replace(_uppercasePattern, '-$1').toLowerCase();
}
module.exports = hyphenate;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/hyphenate.js
// module id = 956
// module chunks = 4

View file

@ -0,0 +1,45 @@
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
'use strict';
var hyphenate = require('./hyphenate');
var msPattern = /^ms-/;
/**
* Hyphenates a camelcased CSS property name, for example:
*
* > hyphenateStyleName('backgroundColor')
* < "background-color"
* > hyphenateStyleName('MozTransition')
* < "-moz-transition"
* > hyphenateStyleName('msTransition')
* < "-ms-transition"
*
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
* is converted to `-ms-`.
*
* @param {string} string
* @return {string}
*/
function hyphenateStyleName(string) {
return hyphenate(string).replace(msPattern, '-ms-');
}
module.exports = hyphenateStyleName;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/hyphenateStyleName.js
// module id = 2326
// module chunks = 4

View file

@ -0,0 +1,62 @@
/**
* Copyright (c) 2013-present, 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.
*
*/
'use strict';
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var validateFormat = function validateFormat(format) {};
if (process.env.NODE_ENV !== 'production') {
validateFormat = function validateFormat(format) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
};
}
function invariant(condition, format, a, b, c, d, e, f) {
validateFormat(format);
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
module.exports = invariant;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/invariant.js
// module id = 20
// module chunks = 4

View file

@ -0,0 +1,31 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
/**
* @param {*} object The object to check.
* @return {boolean} Whether or not the object is a DOM node.
*/
function isNode(object) {
var doc = object ? object.ownerDocument || object : document;
var defaultView = doc.defaultView || window;
return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
}
module.exports = isNode;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/isNode.js
// module id = 2327
// module chunks = 4

View file

@ -0,0 +1,31 @@
'use strict';
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*/
var isNode = require('./isNode');
/**
* @param {*} object The object to check.
* @return {boolean} Whether or not the object is a DOM text node.
*/
function isTextNode(object) {
return isNode(object) && object.nodeType == 3;
}
module.exports = isTextNode;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/isTextNode.js
// module id = 2328
// module chunks = 4

View file

@ -0,0 +1,46 @@
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks static-only
*/
'use strict';
/**
* Combines multiple className strings into one.
* http://jsperf.com/joinclasses-args-vs-array
*
* @param {...?string} className
* @return {string}
*/
function joinClasses(className /*, ... */) {
if (!className) {
className = '';
}
var nextClass = void 0;
var argLength = arguments.length;
if (argLength > 1) {
for (var ii = 1; ii < argLength; ii++) {
nextClass = arguments[ii];
if (nextClass) {
className = (className ? className + ' ' : '') + nextClass;
}
}
}
return className;
}
module.exports = joinClasses;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/joinClasses.js
// module id = 2329
// module chunks = 4

View file

@ -0,0 +1,54 @@
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks static-only
*/
'use strict';
var invariant = require('./invariant');
/**
* Constructs an enumeration with keys equal to their value.
*
* For example:
*
* var COLORS = keyMirror({blue: null, red: null});
* var myColor = COLORS.blue;
* var isColorValid = !!COLORS[myColor];
*
* The last line could not be performed if the values of the generated enum were
* not equal to their keys.
*
* Input: {key1: val1, key2: val2}
* Output: {key1: key1, key2: key2}
*
* @param {object} obj
* @return {object}
*/
var keyMirror = function keyMirror(obj) {
var ret = {};
var key;
!(obj instanceof Object && !Array.isArray(obj)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : void 0;
for (key in obj) {
if (!obj.hasOwnProperty(key)) {
continue;
}
ret[key] = key;
}
return ret;
};
module.exports = keyMirror;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/keyMirror.js
// module id = 420
// module chunks = 4

View file

@ -0,0 +1,41 @@
"use strict";
/**
* Copyright (c) 2013-present, 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.
*
*/
/**
* Allows extraction of a minified key. Let's the build system minify keys
* without losing the ability to dynamically use key strings as values
* themselves. Pass in an object with a single key/val pair and it will return
* you the string key of that single record. Suppose you want to grab the
* value for a key 'className' inside of an object. Key/val minification may
* have aliased that key to be 'xa12'. keyOf({className: null}) will return
* 'xa12' in that case. Resolve keys you want to use once at startup time, then
* reuse those resolutions.
*/
var keyOf = function keyOf(oneKeyObj) {
var key;
for (key in oneKeyObj) {
if (!oneKeyObj.hasOwnProperty(key)) {
continue;
}
return key;
}
return null;
};
module.exports = keyOf;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/keyOf.js
// module id = 202
// module chunks = 4

View file

@ -0,0 +1,57 @@
/**
* Copyright (c) 2013-present, 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.
*
*/
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* Executes the provided `callback` once for each enumerable own property in the
* object and constructs a new object from the results. The `callback` is
* invoked with three arguments:
*
* - the property value
* - the property name
* - the object being traversed
*
* Properties that are added after the call to `mapObject` will not be visited
* by `callback`. If the values of existing properties are changed, the value
* passed to `callback` will be the value at the time `mapObject` visits them.
* Properties that are deleted before being visited are not visited.
*
* @grep function objectMap()
* @grep function objMap()
*
* @param {?object} object
* @param {function} callback
* @param {*} context
* @return {?object}
*/
function mapObject(object, callback, context) {
if (!object) {
return null;
}
var result = {};
for (var name in object) {
if (hasOwnProperty.call(object, name)) {
result[name] = callback.call(context, object[name], name, object);
}
}
return result;
}
module.exports = mapObject;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/mapObject.js
// module id = 2330
// module chunks = 4

View file

@ -0,0 +1,36 @@
/**
* Copyright (c) 2013-present, 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.
*
*
* @typechecks static-only
*/
'use strict';
/**
* Memoizes the return value of a function that accepts one string argument.
*/
function memoizeStringOnly(callback) {
var cache = {};
return function (string) {
if (!cache.hasOwnProperty(string)) {
cache[string] = callback.call(this, string);
}
return cache[string];
};
}
module.exports = memoizeStringOnly;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/memoizeStringOnly.js
// module id = 957
// module chunks = 4

View file

@ -0,0 +1,28 @@
"use strict";
/**
* Copyright (c) 2013-present, 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.
*
*
*/
var nullthrows = function nullthrows(x) {
if (x != null) {
return x;
}
throw new Error("Got unexpected null or undefined");
};
module.exports = nullthrows;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/nullthrows.js
// module id = 126
// module chunks = 4

View file

@ -0,0 +1,74 @@
/**
* Copyright (c) 2013-present, 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.
*
* @typechecks
*
*/
/*eslint-disable no-self-compare */
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
// Added the nonzero y check to make Flow happy, but it is redundant
return x !== 0 || y !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
}
/**
* Performs equality by iterating through keys on an object and returning false
* when any key has values which are not strictly equal between the arguments.
* Returns true when the values of all keys are strictly equal.
*/
function shallowEqual(objA, objB) {
if (is(objA, objB)) {
return true;
}
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
// Test for A's keys different from B.
for (var i = 0; i < keysA.length; i++) {
if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
return false;
}
}
return true;
}
module.exports = shallowEqual;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/shallowEqual.js
// module id = 421
// module chunks = 4

View file

@ -0,0 +1,73 @@
/**
* Copyright 2014-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.
*
*/
'use strict';
var emptyFunction = require('./emptyFunction');
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if (process.env.NODE_ENV !== 'production') {
(function () {
var printWarning = function printWarning(format) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
warning = function warning(condition, format) {
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
printWarning.apply(undefined, [format].concat(args));
}
};
})();
}
module.exports = warning;
//////////////////
// WEBPACK FOOTER
// ./~/fbjs/lib/warning.js
// module id = 40
// module chunks = 4