Initial commit

This commit is contained in:
pasketti
2026-04-05 16:14:49 -04:00
commit ebee3a5534
14059 changed files with 2588797 additions and 0 deletions

162
node_modules/uncontrollable/index.js generated vendored Normal file
View File

@@ -0,0 +1,162 @@
"use strict";
exports.__esModule = true;
exports.default = uncontrollable;
var _react = _interopRequireDefault(require("react"));
var _invariant = _interopRequireDefault(require("invariant"));
var Utils = _interopRequireWildcard(require("./utils"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function uncontrollable(Component, controlledValues, methods) {
if (methods === void 0) {
methods = [];
}
var displayName = Component.displayName || Component.name || 'Component';
var isCompositeComponent = Utils.isReactComponent(Component);
var controlledProps = Object.keys(controlledValues);
var PROPS_TO_OMIT = controlledProps.map(Utils.defaultKey);
!(isCompositeComponent || !methods.length) ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, '[uncontrollable] stateless function components cannot pass through methods ' + 'because they have no associated instances. Check component: ' + displayName + ', ' + 'attempting to pass through methods: ' + methods.join(', ')) : invariant(false) : void 0;
var UncontrolledComponent =
/*#__PURE__*/
function (_React$Component) {
_inheritsLoose(UncontrolledComponent, _React$Component);
function UncontrolledComponent() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.handlers = Object.create(null);
controlledProps.forEach(function (propName) {
var handlerName = controlledValues[propName];
var handleChange = function handleChange(value) {
if (_this.props[handlerName]) {
var _this$props;
_this._notifying = true;
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
(_this$props = _this.props)[handlerName].apply(_this$props, [value].concat(args));
_this._notifying = false;
}
_this._values[propName] = value;
if (!_this.unmounted) _this.forceUpdate();
};
_this.handlers[handlerName] = handleChange;
});
if (isCompositeComponent) _this.attachRef = function (ref) {
_this.inner = ref;
};
return _this;
}
var _proto = UncontrolledComponent.prototype;
_proto.shouldComponentUpdate = function shouldComponentUpdate() {
//let the forceUpdate trigger the update
return !this._notifying;
};
_proto.componentWillMount = function componentWillMount() {
var _this2 = this;
var props = this.props;
this._values = Object.create(null);
controlledProps.forEach(function (key) {
_this2._values[key] = props[Utils.defaultKey(key)];
});
};
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var _this3 = this;
var props = this.props;
controlledProps.forEach(function (key) {
/**
* If a prop switches from controlled to Uncontrolled
* reset its value to the defaultValue
*/
if (!Utils.isProp(nextProps, key) && Utils.isProp(props, key)) {
_this3._values[key] = nextProps[Utils.defaultKey(key)];
}
});
};
_proto.componentWillUnmount = function componentWillUnmount() {
this.unmounted = true;
};
_proto.getControlledInstance = function getControlledInstance() {
return this.inner;
};
_proto.render = function render() {
var _this4 = this;
var props = _extends({}, this.props);
PROPS_TO_OMIT.forEach(function (prop) {
delete props[prop];
});
var newProps = {};
controlledProps.forEach(function (propName) {
var propValue = _this4.props[propName];
newProps[propName] = propValue !== undefined ? propValue : _this4._values[propName];
});
return _react.default.createElement(Component, _extends({}, props, newProps, this.handlers, {
ref: this.attachRef
}));
};
return UncontrolledComponent;
}(_react.default.Component);
UncontrolledComponent.displayName = "Uncontrolled(" + displayName + ")";
UncontrolledComponent.propTypes = Utils.uncontrolledPropTypes(controlledValues, displayName);
methods.forEach(function (method) {
UncontrolledComponent.prototype[method] = function $proxiedMethod() {
var _inner;
return (_inner = this.inner)[method].apply(_inner, arguments);
};
});
UncontrolledComponent.ControlledComponent = Component;
/**
* useful when wrapping a Component and you want to control
* everything
*/
UncontrolledComponent.deferControlTo = function (newComponent, additions, nextMethods) {
if (additions === void 0) {
additions = {};
}
return uncontrollable(newComponent, _extends({}, controlledValues, additions), nextMethods);
};
return UncontrolledComponent;
}
module.exports = exports["default"];

21
node_modules/uncontrollable/package.json generated vendored Normal file
View File

@@ -0,0 +1,21 @@
{
"name": "uncontrollable",
"version": "5.1.0",
"description": "Wrap a controlled react component, to allow specific prop/handler pairs to be uncontrolled",
"author": {
"name": "Jason Quense",
"email": "monastic.panic@gmail.com"
},
"repository": "jquense/uncontrollable",
"license": "MIT",
"main": "index.js",
"peerDependencies": {
"react": ">=15.0.0"
},
"jest": {
"rootDir": "./test"
},
"dependencies": {
"invariant": "^2.2.4"
}
}

59
node_modules/uncontrollable/utils.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
"use strict";
exports.__esModule = true;
exports.uncontrolledPropTypes = uncontrolledPropTypes;
exports.isProp = isProp;
exports.defaultKey = defaultKey;
exports.isReactComponent = isReactComponent;
var _invariant = _interopRequireDefault(require("invariant"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var noop = function noop() {};
function readOnlyPropType(handler, name) {
return function (props, propName) {
if (props[propName] !== undefined) {
if (!props[handler]) {
return new Error("You have provided a `" + propName + "` prop to `" + name + "` " + ("without an `" + handler + "` handler prop. This will render a read-only field. ") + ("If the field should be mutable use `" + defaultKey(propName) + "`. ") + ("Otherwise, set `" + handler + "`."));
}
}
};
}
function uncontrolledPropTypes(controlledValues, displayName) {
var propTypes = {};
Object.keys(controlledValues).forEach(function (prop) {
// add default propTypes for folks that use runtime checks
propTypes[defaultKey(prop)] = noop;
if (process.env.NODE_ENV !== 'production') {
var handler = controlledValues[prop];
!(typeof handler === 'string' && handler.trim().length) ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, 'Uncontrollable - [%s]: the prop `%s` needs a valid handler key name in order to make it uncontrollable', displayName, prop) : invariant(false) : void 0;
propTypes[prop] = readOnlyPropType(handler, displayName);
}
});
return propTypes;
}
function isProp(props, prop) {
return props[prop] !== undefined;
}
function defaultKey(key) {
return 'default' + key.charAt(0).toUpperCase() + key.substr(1);
}
/**
* 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 isReactComponent(component) {
return !!(component && component.prototype && component.prototype.isReactComponent);
}