code
stringlengths 28
313k
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
74
| language
stringclasses 1
value | repo
stringlengths 5
60
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
|---|---|---|---|---|---|---|---|
function getSiblingNode(node) {
while (node) {
if (node.nextSibling) {
return node.nextSibling;
}
node = node.parentNode;
}
}
|
Get the next sibling within a container. This will walk up the
DOM if a node's siblings have been exhausted.
@param {DOMElement|DOMTextNode} node
@return {?DOMElement|DOMTextNode}
|
getSiblingNode
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function getNodeForCharacterOffset(root, offset) {
var node = getLeafNode(root);
var nodeStart = 0;
var nodeEnd = 0;
while (node) {
if (node.nodeType === 3) {
nodeEnd = nodeStart + node.textContent.length;
if (nodeStart <= offset && nodeEnd >= offset) {
return {
node: node,
offset: offset - nodeStart
};
}
nodeStart = nodeEnd;
}
node = getLeafNode(getSiblingNode(node));
}
}
|
Get object describing the nodes which contain characters at offset.
@param {DOMElement|DOMTextNode} root
@param {number} offset
@return {?object}
|
getNodeForCharacterOffset
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
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;
}
}
|
Checks if a given DOM node contains or is another DOM node.
|
containsNode
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function isTextNode(object) {
return isNode(object) && object.nodeType == 3;
}
|
@param {*} object The object to check.
@return {boolean} Whether or not the object is a DOM text node.
|
isTextNode
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function isNode(object) {
return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
}
|
@param {*} object The object to check.
@return {boolean} Whether or not the object is a DOM node.
|
isNode
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function getActiveElement() /*?DOMElement*/{
if (typeof document === 'undefined') {
return null;
}
try {
return document.activeElement || document.body;
} catch (e) {
return document.body;
}
}
|
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.
|
getActiveElement
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function getSelection(node) {
if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
return {
start: node.selectionStart,
end: node.selectionEnd
};
} else if (window.getSelection) {
var selection = window.getSelection();
return {
anchorNode: selection.anchorNode,
anchorOffset: selection.anchorOffset,
focusNode: selection.focusNode,
focusOffset: selection.focusOffset
};
} else if (document.selection) {
var range = document.selection.createRange();
return {
parentElement: range.parentElement(),
text: range.text,
top: range.boundingTop,
left: range.boundingLeft
};
}
}
|
Get an object which is a unique representation of the current selection.
The return value will not be consistent across nodes or browsers, but
two identical selections on the same node will return identical objects.
@param {DOMElement} node
@return {object}
|
getSelection
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function constructSelectEvent(nativeEvent, nativeEventTarget) {
// Ensure we have the right element, and that the user is not dragging a
// selection (this matches native `select` event behavior). In HTML5, select
// fires only on input and textarea thus if there's no focused element we
// won't dispatch.
if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
return null;
}
// Only fire when selection has actually changed.
var currentSelection = getSelection(activeElement);
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
lastSelection = currentSelection;
var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget);
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement;
EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
return syntheticEvent;
}
return null;
}
|
Poll selection to see whether it's changed.
@param {object} nativeEvent
@return {?SyntheticEvent}
|
constructSelectEvent
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function getDictionaryKey(inst) {
// Prevents V8 performance issue:
// https://github.com/facebook/react/pull/7232
return '.' + inst._rootNodeID;
}
|
Turns
['abort', ...]
into
eventTypes = {
'abort': {
phasedRegistrationNames: {
bubbled: 'onAbort',
captured: 'onAbortCapture',
},
dependencies: ['topAbort'],
},
...
};
topLevelEventsToDispatchConfig = {
'topAbort': { sameConfig }
};
|
getDictionaryKey
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function getEventCharCode(nativeEvent) {
var charCode;
var keyCode = nativeEvent.keyCode;
if ('charCode' in nativeEvent) {
charCode = nativeEvent.charCode;
// FF does not set `charCode` for the Enter-key, check against `keyCode`.
if (charCode === 0 && keyCode === 13) {
charCode = 13;
}
} else {
// IE8 does not implement `charCode`, but `keyCode` has the correct value.
charCode = keyCode;
}
// Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
// Must not discard the (non-)printable Enter-key.
if (charCode >= 32 || charCode === 13) {
return charCode;
}
return 0;
}
|
`charCode` represents the actual "character code" and is safe to use with
`String.fromCharCode`. As such, only keys that correspond to printable
characters produce a valid `charCode`, the only exception to this is Enter.
The Tab-key is considered non-printable and does not have a `charCode`,
presumably because it does not produce a tab-character in browsers.
@param {object} nativeEvent Native browser event.
@return {number} Normalized `charCode` property.
|
getEventCharCode
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function getEventKey(nativeEvent) {
if (nativeEvent.key) {
// Normalize inconsistent values reported by browsers due to
// implementations of a working draft specification.
// FireFox implements `key` but returns `MozPrintableKey` for all
// printable characters (normalized to `Unidentified`), ignore it.
var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
if (key !== 'Unidentified') {
return key;
}
}
// Browser does not implement `key`, polyfill as much of it as we can.
if (nativeEvent.type === 'keypress') {
var charCode = getEventCharCode(nativeEvent);
// The enter-key is technically both printable and non-printable and can
// thus be captured by `keypress`, no other non-printable key should.
return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
}
if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
// While user keyboard layout determines the actual meaning of each
// `keyCode` value, almost all function keys have a universal value.
return translateToKey[nativeEvent.keyCode] || 'Unidentified';
}
return '';
}
|
@param {object} nativeEvent Native browser event.
@return {string} Normalized `key` property.
|
getEventKey
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
|
@param {object} dispatchConfig Configuration used to dispatch this event.
@param {string} dispatchMarker Marker identifying the event target.
@param {object} nativeEvent Native browser event.
@extends {SyntheticMouseEvent}
|
SyntheticWheelEvent
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function firstDifferenceIndex(string1, string2) {
var minLen = Math.min(string1.length, string2.length);
for (var i = 0; i < minLen; i++) {
if (string1.charAt(i) !== string2.charAt(i)) {
return i;
}
}
return string1.length === string2.length ? -1 : minLen;
}
|
Finds the index of the first character
that's not common between the two given strings.
@return {number} the index of the character where the strings diverge
|
firstDifferenceIndex
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function getReactRootElementInContainer(container) {
if (!container) {
return null;
}
if (container.nodeType === DOC_NODE_TYPE) {
return container.documentElement;
} else {
return container.firstChild;
}
}
|
@param {DOMElement|DOMDocument} container DOM element that may contain
a React component
@return {?*} DOM element that may have the reactRoot ID, or null.
|
getReactRootElementInContainer
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) {
var markerName;
if (ReactFeatureFlags.logTopLevelRenders) {
var wrappedElement = wrapperInstance._currentElement.props.child;
var type = wrappedElement.type;
markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name);
console.time(markerName);
}
var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */
);
if (markerName) {
console.timeEnd(markerName);
}
wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance;
ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction);
}
|
Mounts this component and inserts it into the DOM.
@param {ReactComponent} componentInstance The instance to mount.
@param {DOMElement} container DOM element to mount into.
@param {ReactReconcileTransaction} transaction
@param {boolean} shouldReuseMarkup If true, do not insert markup
|
mountComponentIntoNode
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) {
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
/* useCreateElement */
!shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement);
transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context);
ReactUpdates.ReactReconcileTransaction.release(transaction);
}
|
Batched mount.
@param {ReactComponent} componentInstance The instance to mount.
@param {DOMElement} container DOM element to mount into.
@param {boolean} shouldReuseMarkup If true, do not insert markup
|
batchedMountComponentIntoNode
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function unmountComponentFromNode(instance, container, safely) {
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onBeginFlush();
}
ReactReconciler.unmountComponent(instance, safely);
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onEndFlush();
}
if (container.nodeType === DOC_NODE_TYPE) {
container = container.documentElement;
}
// http://jsperf.com/emptying-a-node
while (container.lastChild) {
container.removeChild(container.lastChild);
}
}
|
Unmounts a component and removes it from the DOM.
@param {ReactComponent} instance React component instance.
@param {DOMElement} container DOM element to unmount from.
@final
@internal
@see {ReactMount.unmountComponentAtNode}
|
unmountComponentFromNode
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function hasNonRootReactChild(container) {
var rootEl = getReactRootElementInContainer(container);
if (rootEl) {
var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl);
return !!(inst && inst._hostParent);
}
}
|
True if the supplied DOM node has a direct React-rendered child that is
not a React root element. Useful for warning in `render`,
`unmountComponentAtNode`, etc.
@param {?DOMElement} node The candidate DOM node.
@return {boolean} True if the DOM element contains a direct child that was
rendered by React but is not a root element.
@internal
|
hasNonRootReactChild
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function nodeIsRenderedByOtherInstance(container) {
var rootEl = getReactRootElementInContainer(container);
return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl));
}
|
True if the supplied DOM node is a React DOM element and
it has been rendered by another copy of React.
@param {?DOMElement} node The candidate DOM node.
@return {boolean} True if the DOM has been rendered by another copy of React
@internal
|
nodeIsRenderedByOtherInstance
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function isValidContainer(node) {
return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE));
}
|
True if the supplied DOM node is a valid node element.
@param {?DOMElement} node The candidate DOM node.
@return {boolean} True if the DOM is a valid DOM node.
@internal
|
isValidContainer
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function isReactNode(node) {
return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME));
}
|
True if the supplied DOM node is a valid React node element.
@param {?DOMElement} node The candidate DOM node.
@return {boolean} True if the DOM is a valid React DOM node.
@internal
|
isReactNode
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
TopLevelWrapper = function () {
this.rootID = topLevelRootCounter++;
}
|
Temporary (?) hack so that we can store all top-level pending updates on
composites instead of having to worry about different types of components
here.
|
TopLevelWrapper
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function findDOMNode(componentOrElement) {
if (process.env.NODE_ENV !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
owner._warnedAboutRefsInRender = true;
}
}
if (componentOrElement == null) {
return null;
}
if (componentOrElement.nodeType === 1) {
return componentOrElement;
}
var inst = ReactInstanceMap.get(componentOrElement);
if (inst) {
inst = getHostComponentFromComposite(inst);
return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null;
}
if (typeof componentOrElement.render === 'function') {
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : _prodInvariant('44') : void 0;
} else {
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : _prodInvariant('45', Object.keys(componentOrElement)) : void 0;
}
}
|
Returns the DOM node rendered by this element.
See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode
@param {ReactComponent|DOMElement} componentOrElement
@return {?DOMElement} The root node of this element.
|
findDOMNode
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function assert( fn ) {
var el = document.createElement("fieldset");
try {
return !!fn( el );
} catch (e) {
return false;
} finally {
// Remove from its parent by default
if ( el.parentNode ) {
el.parentNode.removeChild( el );
}
// release memory in IE
el = null;
}
}
|
Support testing using an element
@param {Function} fn Passed the created element and returns a boolean result
|
assert
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function createDisabledPseudo( disabled ) {
// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
return function( elem ) {
// Only certain elements can match :enabled or :disabled
// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
if ( "form" in elem ) {
// Check for inherited disabledness on relevant non-disabled elements:
// * listed form-associated elements in a disabled fieldset
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
// https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
// * option elements in a disabled optgroup
// https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
// All such elements have a "form" property.
if ( elem.parentNode && elem.disabled === false ) {
// Option elements defer to a parent optgroup if present
if ( "label" in elem ) {
if ( "label" in elem.parentNode ) {
return elem.parentNode.disabled === disabled;
} else {
return elem.disabled === disabled;
}
}
// Support: IE 6 - 11
// Use the isDisabled shortcut property to check for disabled fieldset ancestors
return elem.isDisabled === disabled ||
// Where there is no isDisabled, check manually
/* jshint -W018 */
elem.isDisabled !== !disabled &&
disabledAncestor( elem ) === disabled;
}
return elem.disabled === disabled;
// Try to winnow out elements that can't be disabled before trusting the disabled property.
// Some victims get caught in our net (label, legend, menu, track), but it shouldn't
// even exist on them, let alone have a boolean value.
} else if ( "label" in elem ) {
return elem.disabled === disabled;
}
// Remaining elements are neither :enabled nor :disabled
return false;
};
}
|
Returns a function to use in pseudos for :enabled/:disabled
@param {Boolean} disabled true for :disabled; false for :enabled
|
createDisabledPseudo
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function arr_diff(a, b) {
var seen = [],
diff = [],
i;
for (i = 0; i < b.length; i++)
seen[b[i]] = true;
for (i = 0; i < a.length; i++)
if (!seen[a[i]])
diff.push(a[i]);
return diff;
}
|
Truncate a string to fit within an SVG text node
CSS text-overlow doesn't apply to SVG <= 1.2
@author Dan de Havilland (github.com/dandehavilland)
@date 2014-12-02
|
arr_diff
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function warn_deprecation(message, untilVersion) {
console.warn('Deprecation: ' + message + (untilVersion ? '. This feature will be removed in ' + untilVersion + '.' : ' the near future.'));
console.trace();
}
|
Wrap the contents of a text node to a specific width
Adapted from bl.ocks.org/mbostock/7555321
@author Mike Bostock
@author Dan de Havilland
@date 2015-01-14
|
warn_deprecation
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function chart(selection) {
renderWatch.reset();
renderWatch.models(scatter);
selection.each(function(data) {
var availableWidth = width - margin.left - margin.right,
availableHeight = height - margin.top - margin.bottom;
container = d3.select(this);
nv.utils.initSVG(container);
// Setup Scales
x = scatter.xScale();
y = scatter.yScale();
var dataRaw = data;
// Injecting point index into each point because d3.layout.stack().out does not give index
data.forEach(function(aseries, i) {
aseries.seriesIndex = i;
aseries.values = aseries.values.map(function(d, j) {
d.index = j;
d.seriesIndex = i;
return d;
});
});
var dataFiltered = data.filter(function(series) {
return !series.disabled;
});
data = d3.layout.stack()
.order(order)
.offset(offset)
.values(function(d) { return d.values }) //TODO: make values customizeable in EVERY model in this fashion
.x(getX)
.y(getY)
.out(function(d, y0, y) {
d.display = {
y: y,
y0: y0
};
})
(dataFiltered);
// Setup containers and skeleton of chart
var wrap = container.selectAll('g.nv-wrap.nv-stackedarea').data([data]);
var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedarea');
var defsEnter = wrapEnter.append('defs');
var gEnter = wrapEnter.append('g');
var g = wrap.select('g');
gEnter.append('g').attr('class', 'nv-areaWrap');
gEnter.append('g').attr('class', 'nv-scatterWrap');
wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
// If the user has not specified forceY, make sure 0 is included in the domain
// Otherwise, use user-specified values for forceY
if (scatter.forceY().length == 0) {
scatter.forceY().push(0);
}
scatter
.width(availableWidth)
.height(availableHeight)
.x(getX)
.y(function(d) {
if (d.display !== undefined) { return d.display.y + d.display.y0; }
})
.color(data.map(function(d,i) {
d.color = d.color || color(d, d.seriesIndex);
return d.color;
}));
var scatterWrap = g.select('.nv-scatterWrap')
.datum(data);
scatterWrap.call(scatter);
defsEnter.append('clipPath')
.attr('id', 'nv-edge-clip-' + id)
.append('rect');
wrap.select('#nv-edge-clip-' + id + ' rect')
.attr('width', availableWidth)
.attr('height', availableHeight);
g.attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
var area = d3.svg.area()
.defined(defined)
.x(function(d,i) { return x(getX(d,i)) })
.y0(function(d) {
return y(d.display.y0)
})
.y1(function(d) {
return y(d.display.y + d.display.y0)
})
.interpolate(interpolate);
var zeroArea = d3.svg.area()
.defined(defined)
.x(function(d,i) { return x(getX(d,i)) })
.y0(function(d) { return y(d.display.y0) })
.y1(function(d) { return y(d.display.y0) });
var path = g.select('.nv-areaWrap').selectAll('path.nv-area')
.data(function(d) { return d });
path.enter().append('path').attr('class', function(d,i) { return 'nv-area nv-area-' + i })
.attr('d', function(d,i){
return zeroArea(d.values, d.seriesIndex);
})
.on('mouseover', function(d,i) {
d3.select(this).classed('hover', true);
dispatch.areaMouseover({
point: d,
series: d.key,
pos: [d3.event.pageX, d3.event.pageY],
seriesIndex: d.seriesIndex
});
})
.on('mouseout', function(d,i) {
d3.select(this).classed('hover', false);
dispatch.areaMouseout({
point: d,
series: d.key,
pos: [d3.event.pageX, d3.event.pageY],
seriesIndex: d.seriesIndex
});
})
.on('click', function(d,i) {
d3.select(this).classed('hover', false);
dispatch.areaClick({
point: d,
series: d.key,
pos: [d3.event.pageX, d3.event.pageY],
seriesIndex: d.seriesIndex
});
});
path.exit().remove();
path.style('fill', function(d,i){
return d.color || color(d, d.seriesIndex)
})
.style('stroke', function(d,i){ return d.color || color(d, d.seriesIndex) });
path.watchTransition(renderWatch,'stackedArea path')
.attr('d', function(d,i) {
return area(d.values,i)
});
//============================================================
// Event Handling/Dispatching (in chart's scope)
//------------------------------------------------------------
scatter.dispatch.on('elementMouseover.area', function(e) {
g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', true);
});
scatter.dispatch.on('elementMouseout.area', function(e) {
g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', false);
});
//Special offset functions
chart.d3_stackedOffset_stackPercent = function(stackData) {
var n = stackData.length, //How many series
m = stackData[0].length, //how many points per series
i,
j,
o,
y0 = [];
for (j = 0; j < m; ++j) { //Looping through all points
for (i = 0, o = 0; i < dataRaw.length; i++) { //looping through all series
o += getY(dataRaw[i].values[j]); //total y value of all series at a certian point in time.
}
if (o) for (i = 0; i < n; i++) { //(total y value of all series at point in time i) != 0
stackData[i][j][1] /= o;
} else { //(total y value of all series at point in time i) == 0
for (i = 0; i < n; i++) {
stackData[i][j][1] = 0;
}
}
}
for (j = 0; j < m; ++j) y0[j] = 0;
return y0;
};
});
renderWatch.renderEnd('stackedArea immediate');
return chart;
}
|
*********************************
offset:
'wiggle' (stream)
'zero' (stacked)
'expand' (normalize to 100%)
'silhouette' (simple centered)
order:
'inside-out' (stream)
'default' (input order)
**********************************
|
chart
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function checkMask(value, bitmask) {
return (value & bitmask) === bitmask;
}
|
Mapping from normalized, camelcased property names to a configuration that
specifies how the associated DOM property should be accessed or rendered.
|
checkMask
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function inject() {
if (alreadyInjected) {
// TODO: This is currently true because these injections are shared between
// the client and the server package. They should be built independently
// and not share any injection state. Then this problem will be solved.
return;
}
alreadyInjected = true;
ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
/**
* Inject modules for resolving DOM hierarchy and plugin ordering.
*/
ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree);
ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal);
/**
* Some important event plugins included by default (without having to require
* them).
*/
ReactInjection.EventPluginHub.injectEventPluginsByName({
SimpleEventPlugin: SimpleEventPlugin,
EnterLeaveEventPlugin: EnterLeaveEventPlugin,
ChangeEventPlugin: ChangeEventPlugin,
SelectEventPlugin: SelectEventPlugin,
BeforeInputEventPlugin: BeforeInputEventPlugin
});
ReactInjection.HostComponent.injectGenericComponentClass(ReactDOMComponent);
ReactInjection.HostComponent.injectTextComponentClass(ReactDOMTextComponent);
ReactInjection.DOMProperty.injectDOMPropertyConfig(ARIADOMPropertyConfig);
ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) {
return new ReactDOMEmptyComponent(instantiate);
});
ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
}
|
Some important event plugins included by default (without having to require
them).
|
inject
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function accumulateTwoPhaseDispatches(events) {
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
}
|
A small set of propagation patterns, each of which will accept a small amount
of information, and generate a set of "dispatch ready event objects" - which
are sets of events that have already been annotated with a set of dispatched
listener functions/ids. The API is designed this way to discourage these
propagation strategies from actually executing the dispatches, since we
always want to collect the entire set of dispatches before executing event a
single one.
@constructor EventPropagators
|
accumulateTwoPhaseDispatches
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function warn(action, result) {
var warningCondition = false;
process.env.NODE_ENV !== 'production' ? warning(warningCondition, 'This synthetic event is reused for performance reasons. If you\'re seeing this, ' + 'you\'re %s `%s` on a released/nullified synthetic event. %s. ' + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
}
|
@interface Event
@see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
/#events-inputevents
|
warn
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function getTargetInstForChangeEvent(topLevelType, targetInst) {
if (topLevelType === 'topChange') {
return targetInst;
}
}
|
(For IE <=11) Replacement getter/setter for the `value` property that gets
set on the active element.
|
getTargetInstForChangeEvent
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function shouldUseClickEvent(elem) {
// Use the `click` event to detect changes to checkbox and radio inputs.
// This approach works across all browsers, whereas `change` does not fire
// until `blur` in IE8.
return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
}
|
This plugin creates an `onChange` event that normalizes change events
across form elements. This event fires at a time when it's possible to
change the element's value without seeing a flicker.
Supported elements are:
- input (see `isTextInputElement`)
- textarea
- select
|
shouldUseClickEvent
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
|
@interface UIEvent
@see http://www.w3.org/TR/DOM-Level-3-Events/
|
SyntheticMouseEvent
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
checkRenderMessage = function (owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
|
Operations for dealing with CSS properties.
|
checkRenderMessage
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function isAttributeNameSafe(attributeName) {
if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
return true;
}
if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
return false;
}
if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
validatedAttributeNameCache[attributeName] = true;
return true;
}
illegalAttributeNameCache[attributeName] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0;
return false;
}
|
Creates markup for the ID property.
@param {string} id Unescaped ID.
@return {string} Markup string.
|
isAttributeNameSafe
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function shouldIgnoreValue(propertyInfo, value) {
return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
}
|
Creates markup for a property.
@param {string} name
@param {*} value
@return {?string} Markup string, or null if the property was invalid.
|
shouldIgnoreValue
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function getDeclarationErrorAddendum(owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
|
@param {object} inputProps Props for form component
@return {*} current value of the input either from value prop or link.
|
getDeclarationErrorAddendum
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function flattenChildren(children) {
var content = '';
// Flatten children and warn if they aren't strings or numbers;
// invalid types are ignored.
React.Children.forEach(children, function (child) {
if (child == null) {
return;
}
if (typeof child === 'string' || typeof child === 'number') {
content += child;
} else if (!didWarnInvalidOptionChildren) {
didWarnInvalidOptionChildren = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0;
}
});
return content;
}
|
Implements an <option> host component that warns when `selected` is set.
|
flattenChildren
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function processQueue(inst, updateQueue) {
ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue);
}
|
ReactMultiChild are capable of reconciling multiple children.
@class ReactMultiChild
@internal
|
processQueue
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
getDebugID = function (inst) {
if (!inst._debugID) {
// Check for ART-like instances. TODO: This is silly/gross.
var internal;
if (internal = ReactInstanceMap.get(inst)) {
inst = internal;
}
}
return inst._debugID;
}
|
Provides common functionality for components that must reconcile multiple
children. This is used by `ReactDOMComponent` to mount, update, and
unmount child components.
@lends {ReactMultiChild.prototype}
|
getDebugID
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function instantiateChild(childInstances, child, name, selfDebugID) {
// We found a component instance.
var keyUnique = childInstances[name] === undefined;
if (process.env.NODE_ENV !== 'production') {
if (!ReactComponentTreeHook) {
ReactComponentTreeHook = __webpack_require__(28);
}
if (!keyUnique) {
process.env.NODE_ENV !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0;
}
}
if (child != null && keyUnique) {
childInstances[name] = instantiateReactComponent(child, true);
}
}
|
ReactChildReconciler provides helpers for initializing or updating a set of
children. Its output is suitable for passing it onto ReactMultiChild which
does diffed reordering and insertion.
|
instantiateChild
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function warnNoop(publicInstance, callerName) {
if (process.env.NODE_ENV !== 'production') {
var constructor = publicInstance.constructor;
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
}
}
|
Checks whether or not this composite component is mounted.
@param {ReactClass} publicInstance The instance we want to test.
@return {boolean} True if mounted, false otherwise.
@protected
@final
|
warnNoop
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function scrollValueMonitor(cb) {
var scrollPosition = getUnboundedScrollPosition(window);
cb(scrollPosition);
}
|
Traps top-level events by using event bubbling.
@param {string} topLevelType Record from `EventConstants`.
@param {string} handlerBaseName Event name (e.g. "click").
@param {object} element Element on which to attach listener.
@return {?object} An object with a remove function which will forcefully
remove the listener.
@internal
|
scrollValueMonitor
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function isInDocument(node) {
return containsNode(document.documentElement, node);
}
|
@restoreSelection: If any selection information was potentially lost,
restore it. This is useful when performing operations that could remove dom
nodes and place them back in, resulting in focus being lost.
|
isInDocument
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
|
@interface Event
@see http://www.w3.org/TR/clipboard-apis/
|
SyntheticAnimationEvent
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
|
@interface KeyboardEvent
@see http://www.w3.org/TR/DOM-Level-3-Events/
|
SyntheticFocusEvent
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
|
@interface TouchEvent
@see http://www.w3.org/TR/touch-events/
|
SyntheticDragEvent
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
|
@interface WheelEvent
@see http://www.w3.org/TR/DOM-Level-3-Events/
|
SyntheticTransitionEvent
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function getBsProps(props) {
return {
bsClass: props.bsClass,
bsSize: props.bsSize,
bsStyle: props.bsStyle,
bsRole: props.bsRole
};
}
|
Add a style variant to a Component. Mutates the propTypes of the component
in order to validate the new variant.
|
getBsProps
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function map(children, func, context) {
var index = 0;
return _react2['default'].Children.map(children, function (child) {
if (!_react2['default'].isValidElement(child)) {
return child;
}
return func.call(context, child, index++);
});
}
|
Count the number of "valid components" in the Children container.
@param {?*} children Children tree container.
@returns {number}
|
map
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function forEach(children, func, context) {
var index = 0;
_react2['default'].Children.forEach(children, function (child) {
if (!_react2['default'].isValidElement(child)) {
return;
}
func.call(context, child, index++);
});
}
|
Finds children that are typically specified as `props.children`,
but only iterates over children that are "valid components".
The provided forEachFunc(child, index) will be called for each
leaf child with the index reflecting the position relative to "valid components".
@param {?*} children Children tree container.
@param {function(*, int)} func.
@param {*} context Context for func.
@returns {array} of children that meet the func return statement
|
forEach
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function isTrivialHref(href) {
return !href || href.trim() === '#';
}
|
There are situations due to browser quirks or Bootstrap CSS where
an anchor tag is needed, when semantically a button tag is the
better choice. SafeAnchor ensures that when an anchor is used like a
button its accessible. It also emulates input `disabled` behavior for
links, which is usually desirable for Buttons, NavItems, MenuItems, etc.
|
isTrivialHref
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function Button() {
(0, _classCallCheck3['default'])(this, Button);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
Defines HTML button type attribute
@defaultValue 'button'
|
Button
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function ButtonGroup() {
(0, _classCallCheck3['default'])(this, ButtonGroup);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
Display block buttons; only useful when used with the "vertical" prop.
@type {bool}
|
ButtonGroup
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function Carousel(props, context) {
(0, _classCallCheck3['default'])(this, Carousel);
var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props, context));
_this.handleMouseOver = _this.handleMouseOver.bind(_this);
_this.handleMouseOut = _this.handleMouseOut.bind(_this);
_this.handlePrev = _this.handlePrev.bind(_this);
_this.handleNext = _this.handleNext.bind(_this);
_this.handleItemAnimateOutEnd = _this.handleItemAnimateOutEnd.bind(_this);
var defaultActiveIndex = props.defaultActiveIndex;
_this.state = {
activeIndex: defaultActiveIndex != null ? defaultActiveIndex : 0,
previousActiveIndex: null,
direction: null
};
_this.isUnmounted = false;
return _this;
}
|
Label shown to screen readers only, can be used to show the next element
in the carousel.
Set to null to deactivate.
|
Carousel
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function detectEvents() {
var testEl = document.createElement('div');
var style = testEl.style;
// On some platforms, in particular some releases of Android 4.x,
// the un-prefixed "animation" and "transition" properties are defined on the
// style object but the events that fire will still be prefixed, so we need
// to check if the un-prefixed events are useable, and if not remove them
// from the map
if (!('AnimationEvent' in window)) {
delete EVENT_NAME_MAP.animationend.animation;
}
if (!('TransitionEvent' in window)) {
delete EVENT_NAME_MAP.transitionend.transition;
}
for (var baseEventName in EVENT_NAME_MAP) {
// eslint-disable-line guard-for-in
var baseEvents = EVENT_NAME_MAP[baseEventName];
for (var styleName in baseEvents) {
if (styleName in style) {
endEvents.push(baseEvents[styleName]);
break;
}
}
}
}
|
EVENT_NAME_MAP is used to determine which event fired when a
transition/animation ends, based on the style property used to
define that event.
|
detectEvents
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function Checkbox() {
(0, _classCallCheck3['default'])(this, Checkbox);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
Attaches a ref to the `<input>` element. Only functions can be used here.
```js
<Checkbox inputRef={ref => { this.input = ref; }} />
```
|
Checkbox
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function Clearfix() {
(0, _classCallCheck3['default'])(this, Clearfix);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
Apply clearfix
on Large devices Desktops
adds class `visible-lg-block`
|
Clearfix
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function ControlLabel() {
(0, _classCallCheck3['default'])(this, ControlLabel);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
Uses `controlId` from `<FormGroup>` if not explicitly specified.
|
ControlLabel
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function Col() {
(0, _classCallCheck3['default'])(this, Col);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
Change the order of grid columns to the left
for Large devices Desktops
class-prefix `col-lg-pull-`
|
Col
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function triggerBrowserReflow(node) {
node.offsetHeight; // eslint-disable-line no-unused-expressions
}
|
Callback fired before the component expands
|
triggerBrowserReflow
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function getDimensionValue(dimension, elem) {
var value = elem['offset' + (0, _capitalize2['default'])(dimension)];
var margins = MARGINS[dimension];
return value + parseInt((0, _style2['default'])(elem, margins[0]), 10) + parseInt((0, _style2['default'])(elem, margins[1]), 10);
}
|
Callback fired after the component starts to expand
|
getDimensionValue
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function Transition(props, context) {
_classCallCheck(this, Transition);
var _this = _possibleConstructorReturn(this, (Transition.__proto__ || Object.getPrototypeOf(Transition)).call(this, props, context));
var initialStatus = void 0;
if (props.in) {
// Start enter transition in componentDidMount.
initialStatus = props.transitionAppear ? EXITED : ENTERED;
} else {
initialStatus = props.unmountOnExit ? UNMOUNTED : EXITED;
}
_this.state = { status: initialStatus };
_this.nextCallback = null;
return _this;
}
|
The Transition component lets you define and run css transitions with a simple declarative api.
It works similar to React's own [CSSTransitionGroup](http://facebook.github.io/react/docs/animation.html#high-level-api-reactcsstransitiongroup)
but is specifically optimized for transitioning a single child "in" or "out".
You don't even need to use class based css transitions if you don't want to (but it is easiest).
The extensive set of lifecyle callbacks means you have control over
the transitioning now at each step of the way.
|
Transition
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function ownerDocument(node) {
return node && node.ownerDocument || document;
}
|
Conenience method returns corresponding value for given keyName or keyCode.
@param {Mixed} keyCode {Number} or keyName {String}
@return {Mixed}
@api public
|
ownerDocument
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function FormControl() {
(0, _classCallCheck3['default'])(this, FormControl);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
Attaches a ref to the `<input>` element. Only functions can be used here.
```js
<FormControl inputRef={ref => { this.input = ref; }} />
```
|
FormControl
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function FormGroup() {
(0, _classCallCheck3['default'])(this, FormGroup);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
Sets `id` on `<FormControl>` and `htmlFor` on `<FormGroup.Label>`.
|
FormGroup
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function getDefaultComponent(children) {
if (!children) {
// FIXME: This is the old behavior. Is this right?
return 'div';
}
if (_ValidComponentChildren2['default'].some(children, function (child) {
return child.type !== _ListGroupItem2['default'] || child.props.href || child.props.onClick;
})) {
return 'div';
}
return 'ul';
}
|
You can use a custom element type for this component.
If not specified, it will be treated as `'li'` if every child is a
non-actionable `<ListGroupItem>`, and `'div'` otherwise.
|
getDefaultComponent
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function MenuItem(props, context) {
(0, _classCallCheck3['default'])(this, MenuItem);
var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props, context));
_this.handleClick = _this.handleClick.bind(_this);
return _this;
}
|
Callback fired when the menu item is selected.
```js
(eventKey: any, event: Object) => any
```
|
MenuItem
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
backdropRef = function backdropRef(ref) {
return _this.backdrop = ref;
}
|
A ModalManager instance used to track and manage the state of open
Modals. Useful when customizing how modals interact within a container
|
backdropRef
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function findIndexOf(arr, cb) {
var idx = -1;
arr.some(function (d, i) {
if (cb(d, i)) {
idx = i;
return true;
}
});
return idx;
}
|
Proper state managment for containers and the modals in those containers.
@internal Used by the Modal to ensure proper styling of containers.
|
findIndexOf
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
siblings = function siblings(container, mount, cb) {
mount = [].concat(mount);
[].forEach.call(container.children, function (node) {
if (mount.indexOf(node) === -1 && isHidable(node)) {
cb(node);
}
});
}
|
Firefox doesn't have a focusin event so using capture is easiest way to get bubbling
IE8 can't do addEventListener, but does have onfocusin, so we use that in ie8
We only allow one Listener at a time to avoid stack overflows
|
siblings
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function ModalDialog() {
(0, _classCallCheck3['default'])(this, ModalDialog);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
A css class to apply to the Modal dialog DOM node.
|
ModalDialog
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function ModalHeader() {
(0, _classCallCheck3['default'])(this, ModalHeader);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
A Callback fired when the close button is clicked. If used directly inside
a Modal component, the onHide will automatically be propagated up to the
parent Modal `onHide`.
|
ModalHeader
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function Nav() {
(0, _classCallCheck3['default'])(this, Nav);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
Float the Nav to the left. When `navbar` is `true` the appropriate
contextual classes are added as well.
|
Nav
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function Navbar(props, context) {
(0, _classCallCheck3['default'])(this, Navbar);
var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props, context));
_this.handleToggle = _this.handleToggle.bind(_this);
_this.handleCollapse = _this.handleCollapse.bind(_this);
return _this;
}
|
Explicitly set the visiblity of the navbar body
@controllable onToggle
|
Navbar
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function NavbarToggle() {
(0, _classCallCheck3['default'])(this, NavbarToggle);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
The toggle content, if left empty it will render the default toggle (seen above).
|
NavbarToggle
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function Overlay(props, context) {
_classCallCheck(this, Overlay);
var _this = _possibleConstructorReturn(this, (Overlay.__proto__ || Object.getPrototypeOf(Overlay)).call(this, props, context));
_this.state = { exited: !props.show };
_this.onHiddenListener = _this.handleHidden.bind(_this);
return _this;
}
|
Built on top of `<Position/>` and `<Portal/>`, the overlay component is great for custom tooltip overlays.
|
Overlay
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function Position(props, context) {
_classCallCheck(this, Position);
var _this = _possibleConstructorReturn(this, (Position.__proto__ || Object.getPrototypeOf(Position)).call(this, props, context));
_this.state = {
positionLeft: 0,
positionTop: 0,
arrowOffsetLeft: null,
arrowOffsetTop: null
};
_this._needsFlush = false;
_this._lastTarget = null;
return _this;
}
|
The Position component calculates the coordinates for its child, to position
it relative to a `target` component or node. Useful for creating callouts
and tooltips, the Position component injects a `style` props with `left` and
`top` values for positioning your component.
It also injects "arrow" `left`, and `top` values for styling callout arrows
for giving your components a sense of directionality.
|
Position
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function isOneOf(one, of) {
if (Array.isArray(of)) {
return of.indexOf(one) >= 0;
}
return one === of;
}
|
An element or text to overlay next to the target.
|
isOneOf
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function Pagination() {
(0, _classCallCheck3['default'])(this, Pagination);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
You can use a custom element for the buttons
|
Pagination
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function Radio() {
(0, _classCallCheck3['default'])(this, Radio);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
Attaches a ref to the `<input>` element. Only functions can be used here.
```js
<Radio inputRef={ref => { this.input = ref; }} />
```
|
Radio
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function TabContainer() {
(0, _classCallCheck3['default'])(this, TabContainer);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
The `eventKey` of the currently active tab.
@controllable onSelect
|
TabContainer
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function TabContent(props, context) {
(0, _classCallCheck3['default'])(this, TabContent);
var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props, context));
_this.handlePaneEnter = _this.handlePaneEnter.bind(_this);
_this.handlePaneExited = _this.handlePaneExited.bind(_this);
// Active entries in state will be `null` unless `animation` is set. Need
// to track active child in case keys swap and the active child changes
// but the active key does not.
_this.state = {
activeKey: null,
activeChild: null
};
return _this;
}
|
Unmount tabs (remove it from the DOM) when they are no longer visible
|
TabContent
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function TabPane(props, context) {
(0, _classCallCheck3['default'])(this, TabPane);
var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props, context));
_this.handleEnter = _this.handleEnter.bind(_this);
_this.handleExited = _this.handleExited.bind(_this);
_this['in'] = false;
return _this;
}
|
We override the `<TabContainer>` context so `<Nav>`s in `<TabPane>`s don't
conflict with the top level one.
|
TabPane
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function getDefaultActiveKey(children) {
var defaultActiveKey = void 0;
_ValidComponentChildren2['default'].forEach(children, function (child) {
if (defaultActiveKey == null) {
defaultActiveKey = child.props.eventKey;
}
});
return defaultActiveKey;
}
|
Unmount tabs (remove it from the DOM) when it is no longer visible
|
getDefaultActiveKey
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
function Tooltip() {
(0, _classCallCheck3['default'])(this, Tooltip);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
}
|
The "left" position value for the Tooltip arrow.
|
Tooltip
|
javascript
|
stitchfix/pyxley
|
tests/app/static/bundle.js
|
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
|
MIT
|
constructor(t) {
this.env = t
}
|
RegExp:
https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken)
|
constructor
|
javascript
|
Toulu-debug/enen
|
iOS_Cookie.js
|
https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js
|
MIT
|
function tower() {
var args = Array.prototype.slice.call(arguments);
var fn = args.pop();
args.push('--output-directory', 'tmp');
var child = spawn('./bin/tower', args);
var result = '';
var error = '';
child.stdout.setEncoding('utf-8');
child.stdout.on('data', function(data){
result += data;
});
child.stderr.setEncoding('utf-8');
child.stderr.on('data', function(data){
error += data;
});
child.on('close', function(){
fn(error ? error : null, result);
});
}
|
Execute a tower command, return output as string.
|
tower
|
javascript
|
tower-archive/tower
|
test/cli.js
|
https://github.com/tower-archive/tower/blob/master/test/cli.js
|
MIT
|
function encode(name, value) {
return "&" + encodeURIComponent(name) + "=" + encodeURIComponent(value).replace(/%20/g, "+");
}
|
Modified
Triggers browser event
@param String eventName
@param Object data - Add properties to event object
|
encode
|
javascript
|
Dogfalo/materialize
|
dist/js/materialize.js
|
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
|
MIT
|
function Component(classDef, el, options) {
_classCallCheck(this, Component);
// Display error if el is valid HTML Element
if (!(el instanceof Element)) {
console.error(Error(el + ' is not an HTML Element'));
}
// If exists, destroy and reinitialize in child
var ins = classDef.getInstance(el);
if (!!ins) {
ins.destroy();
}
this.el = el;
this.$el = cash(el);
}
|
Generic constructor for all components
@constructor
@param {Element} el
@param {Object} options
|
Component
|
javascript
|
Dogfalo/materialize
|
dist/js/materialize.js
|
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
|
MIT
|
function s4() {
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
}
|
Generate approximated selector string for a jQuery object
@param {jQuery} obj jQuery object to be parsed
@returns {string}
|
s4
|
javascript
|
Dogfalo/materialize
|
dist/js/materialize.js
|
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
|
MIT
|
function Collapsible(el, options) {
_classCallCheck(this, Collapsible);
var _this3 = _possibleConstructorReturn(this, (Collapsible.__proto__ || Object.getPrototypeOf(Collapsible)).call(this, Collapsible, el, options));
_this3.el.M_Collapsible = _this3;
/**
* Options for the collapsible
* @member Collapsible#options
* @prop {Boolean} [accordion=false] - Type of the collapsible
* @prop {Function} onOpenStart - Callback function called before collapsible is opened
* @prop {Function} onOpenEnd - Callback function called after collapsible is opened
* @prop {Function} onCloseStart - Callback function called before collapsible is closed
* @prop {Function} onCloseEnd - Callback function called after collapsible is closed
* @prop {Number} inDuration - Transition in duration in milliseconds.
* @prop {Number} outDuration - Transition duration in milliseconds.
*/
_this3.options = $.extend({}, Collapsible.defaults, options);
// Setup tab indices
_this3.$headers = _this3.$el.children('li').children('.collapsible-header');
_this3.$headers.attr('tabindex', 0);
_this3._setupEventHandlers();
// Open first active
var $activeBodies = _this3.$el.children('li.active').children('.collapsible-body');
if (_this3.options.accordion) {
// Handle Accordion
$activeBodies.first().css('display', 'block');
} else {
// Handle Expandables
$activeBodies.css('display', 'block');
}
return _this3;
}
|
Construct Collapsible instance
@constructor
@param {Element} el
@param {Object} options
|
Collapsible
|
javascript
|
Dogfalo/materialize
|
dist/js/materialize.js
|
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
|
MIT
|
function Modal(el, options) {
_classCallCheck(this, Modal);
var _this13 = _possibleConstructorReturn(this, (Modal.__proto__ || Object.getPrototypeOf(Modal)).call(this, Modal, el, options));
_this13.el.M_Modal = _this13;
/**
* Options for the modal
* @member Modal#options
* @prop {Number} [opacity=0.5] - Opacity of the modal overlay
* @prop {Number} [inDuration=250] - Length in ms of enter transition
* @prop {Number} [outDuration=250] - Length in ms of exit transition
* @prop {Function} onOpenStart - Callback function called before modal is opened
* @prop {Function} onOpenEnd - Callback function called after modal is opened
* @prop {Function} onCloseStart - Callback function called before modal is closed
* @prop {Function} onCloseEnd - Callback function called after modal is closed
* @prop {Boolean} [dismissible=true] - Allow modal to be dismissed by keyboard or overlay click
* @prop {String} [startingTop='4%'] - startingTop
* @prop {String} [endingTop='10%'] - endingTop
*/
_this13.options = $.extend({}, Modal.defaults, options);
/**
* Describes open/close state of modal
* @type {Boolean}
*/
_this13.isOpen = false;
_this13.id = _this13.$el.attr('id');
_this13._openingTrigger = undefined;
_this13.$overlay = $('<div class="modal-overlay"></div>');
_this13.el.tabIndex = 0;
_this13._nthModalOpened = 0;
Modal._count++;
_this13._setupEventHandlers();
return _this13;
}
|
Construct Modal instance and set up overlay
@constructor
@param {Element} el
@param {Object} options
|
Modal
|
javascript
|
Dogfalo/materialize
|
dist/js/materialize.js
|
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
|
MIT
|
function Materialbox(el, options) {
_classCallCheck(this, Materialbox);
var _this16 = _possibleConstructorReturn(this, (Materialbox.__proto__ || Object.getPrototypeOf(Materialbox)).call(this, Materialbox, el, options));
_this16.el.M_Materialbox = _this16;
/**
* Options for the modal
* @member Materialbox#options
* @prop {Number} [inDuration=275] - Length in ms of enter transition
* @prop {Number} [outDuration=200] - Length in ms of exit transition
* @prop {Function} onOpenStart - Callback function called before materialbox is opened
* @prop {Function} onOpenEnd - Callback function called after materialbox is opened
* @prop {Function} onCloseStart - Callback function called before materialbox is closed
* @prop {Function} onCloseEnd - Callback function called after materialbox is closed
*/
_this16.options = $.extend({}, Materialbox.defaults, options);
_this16.overlayActive = false;
_this16.doneAnimating = true;
_this16.placeholder = $('<div></div>').addClass('material-placeholder');
_this16.originalWidth = 0;
_this16.originalHeight = 0;
_this16.originInlineStyles = _this16.$el.attr('style');
_this16.caption = _this16.el.getAttribute('data-caption') || '';
// Wrap
_this16.$el.before(_this16.placeholder);
_this16.placeholder.append(_this16.$el);
_this16._setupEventHandlers();
return _this16;
}
|
Construct Materialbox instance
@constructor
@param {Element} el
@param {Object} options
|
Materialbox
|
javascript
|
Dogfalo/materialize
|
dist/js/materialize.js
|
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
|
MIT
|
function Tabs(el, options) {
_classCallCheck(this, Tabs);
var _this22 = _possibleConstructorReturn(this, (Tabs.__proto__ || Object.getPrototypeOf(Tabs)).call(this, Tabs, el, options));
_this22.el.M_Tabs = _this22;
/**
* Options for the Tabs
* @member Tabs#options
* @prop {Number} duration
* @prop {Function} onShow
* @prop {Boolean} swipeable
* @prop {Number} responsiveThreshold
*/
_this22.options = $.extend({}, Tabs.defaults, options);
// Setup
_this22.$tabLinks = _this22.$el.children('li.tab').children('a');
_this22.index = 0;
_this22._setupActiveTabLink();
// Setup tabs content
if (_this22.options.swipeable) {
_this22._setupSwipeableTabs();
} else {
_this22._setupNormalTabs();
}
// Setup tabs indicator after content to ensure accurate widths
_this22._setTabsAndTabWidth();
_this22._createIndicator();
_this22._setupEventHandlers();
return _this22;
}
|
Construct Tabs instance
@constructor
@param {Element} el
@param {Object} options
|
Tabs
|
javascript
|
Dogfalo/materialize
|
dist/js/materialize.js
|
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
|
MIT
|
function Tooltip(el, options) {
_classCallCheck(this, Tooltip);
var _this26 = _possibleConstructorReturn(this, (Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).call(this, Tooltip, el, options));
_this26.el.M_Tooltip = _this26;
_this26.options = $.extend({}, Tooltip.defaults, options);
_this26.isOpen = false;
_this26.isHovered = false;
_this26.isFocused = false;
_this26._appendTooltipEl();
_this26._setupEventHandlers();
return _this26;
}
|
Construct Tooltip instance
@constructor
@param {Element} el
@param {Object} options
|
Tooltip
|
javascript
|
Dogfalo/materialize
|
dist/js/materialize.js
|
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
|
MIT
|
function getWavesEffectElement(e) {
if (TouchHandler.allowEvent(e) === false) {
return null;
}
var element = null;
var target = e.target || e.srcElement;
while (target.parentNode !== null) {
if (!(target instanceof SVGElement) && target.className.indexOf('waves-effect') !== -1) {
element = target;
break;
}
target = target.parentNode;
}
return element;
}
|
Delegated click handler for .waves-effect element.
returns null when .waves-effect element not in "click tree"
|
getWavesEffectElement
|
javascript
|
Dogfalo/materialize
|
dist/js/materialize.js
|
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
|
MIT
|
function showEffect(e) {
var element = getWavesEffectElement(e);
if (element !== null) {
Effect.show(e, element);
if ('ontouchstart' in window) {
element.addEventListener('touchend', Effect.hide, false);
element.addEventListener('touchcancel', Effect.hide, false);
}
element.addEventListener('mouseup', Effect.hide, false);
element.addEventListener('mouseleave', Effect.hide, false);
element.addEventListener('dragend', Effect.hide, false);
}
}
|
Bubble the click and show effect if .waves-effect elem was found
|
showEffect
|
javascript
|
Dogfalo/materialize
|
dist/js/materialize.js
|
https://github.com/Dogfalo/materialize/blob/master/dist/js/materialize.js
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.