@qixian.cs/github-contributors-list
Advanced tools
Comparing version 1.1.0 to 2.0.0
@@ -1,18 +0,2 @@ | ||
import React from 'react'; | ||
export interface AvatarListItem { | ||
username?: string; | ||
url?: string; | ||
} | ||
export interface ButtonProps { | ||
className?: string; | ||
style?: React.CSSProperties; | ||
fileName: string; | ||
owner: string; | ||
repo: string; | ||
filter?: (item: AvatarListItem) => boolean; | ||
emptyRender?: (fileName: string, owner: string, repo: string) => React.ReactNode; | ||
renderItem?: (item?: AvatarListItem, loading?: boolean) => React.ReactNode; | ||
cache?: boolean; | ||
} | ||
declare const AvatarList: React.FC<ButtonProps>; | ||
import { AvatarList } from './AvatarList'; | ||
export default AvatarList; |
@@ -1,573 +0,2 @@ | ||
'use strict'; | ||
var React = require('react'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var React__default = /*#__PURE__*/_interopDefaultLegacy(React); | ||
function _iterableToArrayLimit(arr, i) { | ||
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (null != _i) { | ||
var _s, | ||
_e, | ||
_x, | ||
_r, | ||
_arr = [], | ||
_n = !0, | ||
_d = !1; | ||
try { | ||
if (_x = (_i = _i.call(arr)).next, 0 === i) { | ||
if (Object(_i) !== _i) return; | ||
_n = !1; | ||
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); | ||
} catch (err) { | ||
_d = !0, _e = err; | ||
} finally { | ||
try { | ||
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
} | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _regeneratorRuntime() { | ||
_regeneratorRuntime = function () { | ||
return exports; | ||
}; | ||
var exports = {}, | ||
Op = Object.prototype, | ||
hasOwn = Op.hasOwnProperty, | ||
defineProperty = Object.defineProperty || function (obj, key, desc) { | ||
obj[key] = desc.value; | ||
}, | ||
$Symbol = "function" == typeof Symbol ? Symbol : {}, | ||
iteratorSymbol = $Symbol.iterator || "@@iterator", | ||
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", | ||
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; | ||
function define(obj, key, value) { | ||
return Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: !0, | ||
configurable: !0, | ||
writable: !0 | ||
}), obj[key]; | ||
} | ||
try { | ||
define({}, ""); | ||
} catch (err) { | ||
define = function (obj, key, value) { | ||
return obj[key] = value; | ||
}; | ||
} | ||
function wrap(innerFn, outerFn, self, tryLocsList) { | ||
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, | ||
generator = Object.create(protoGenerator.prototype), | ||
context = new Context(tryLocsList || []); | ||
return defineProperty(generator, "_invoke", { | ||
value: makeInvokeMethod(innerFn, self, context) | ||
}), generator; | ||
} | ||
function tryCatch(fn, obj, arg) { | ||
try { | ||
return { | ||
type: "normal", | ||
arg: fn.call(obj, arg) | ||
}; | ||
} catch (err) { | ||
return { | ||
type: "throw", | ||
arg: err | ||
}; | ||
} | ||
} | ||
exports.wrap = wrap; | ||
var ContinueSentinel = {}; | ||
function Generator() {} | ||
function GeneratorFunction() {} | ||
function GeneratorFunctionPrototype() {} | ||
var IteratorPrototype = {}; | ||
define(IteratorPrototype, iteratorSymbol, function () { | ||
return this; | ||
}); | ||
var getProto = Object.getPrototypeOf, | ||
NativeIteratorPrototype = getProto && getProto(getProto(values([]))); | ||
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); | ||
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); | ||
function defineIteratorMethods(prototype) { | ||
["next", "throw", "return"].forEach(function (method) { | ||
define(prototype, method, function (arg) { | ||
return this._invoke(method, arg); | ||
}); | ||
}); | ||
} | ||
function AsyncIterator(generator, PromiseImpl) { | ||
function invoke(method, arg, resolve, reject) { | ||
var record = tryCatch(generator[method], generator, arg); | ||
if ("throw" !== record.type) { | ||
var result = record.arg, | ||
value = result.value; | ||
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { | ||
invoke("next", value, resolve, reject); | ||
}, function (err) { | ||
invoke("throw", err, resolve, reject); | ||
}) : PromiseImpl.resolve(value).then(function (unwrapped) { | ||
result.value = unwrapped, resolve(result); | ||
}, function (error) { | ||
return invoke("throw", error, resolve, reject); | ||
}); | ||
} | ||
reject(record.arg); | ||
} | ||
var previousPromise; | ||
defineProperty(this, "_invoke", { | ||
value: function (method, arg) { | ||
function callInvokeWithMethodAndArg() { | ||
return new PromiseImpl(function (resolve, reject) { | ||
invoke(method, arg, resolve, reject); | ||
}); | ||
} | ||
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); | ||
} | ||
}); | ||
} | ||
function makeInvokeMethod(innerFn, self, context) { | ||
var state = "suspendedStart"; | ||
return function (method, arg) { | ||
if ("executing" === state) throw new Error("Generator is already running"); | ||
if ("completed" === state) { | ||
if ("throw" === method) throw arg; | ||
return doneResult(); | ||
} | ||
for (context.method = method, context.arg = arg;;) { | ||
var delegate = context.delegate; | ||
if (delegate) { | ||
var delegateResult = maybeInvokeDelegate(delegate, context); | ||
if (delegateResult) { | ||
if (delegateResult === ContinueSentinel) continue; | ||
return delegateResult; | ||
} | ||
} | ||
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { | ||
if ("suspendedStart" === state) throw state = "completed", context.arg; | ||
context.dispatchException(context.arg); | ||
} else "return" === context.method && context.abrupt("return", context.arg); | ||
state = "executing"; | ||
var record = tryCatch(innerFn, self, context); | ||
if ("normal" === record.type) { | ||
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; | ||
return { | ||
value: record.arg, | ||
done: context.done | ||
}; | ||
} | ||
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); | ||
} | ||
}; | ||
} | ||
function maybeInvokeDelegate(delegate, context) { | ||
var methodName = context.method, | ||
method = delegate.iterator[methodName]; | ||
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; | ||
var record = tryCatch(method, delegate.iterator, context.arg); | ||
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; | ||
var info = record.arg; | ||
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); | ||
} | ||
function pushTryEntry(locs) { | ||
var entry = { | ||
tryLoc: locs[0] | ||
}; | ||
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); | ||
} | ||
function resetTryEntry(entry) { | ||
var record = entry.completion || {}; | ||
record.type = "normal", delete record.arg, entry.completion = record; | ||
} | ||
function Context(tryLocsList) { | ||
this.tryEntries = [{ | ||
tryLoc: "root" | ||
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); | ||
} | ||
function values(iterable) { | ||
if (iterable) { | ||
var iteratorMethod = iterable[iteratorSymbol]; | ||
if (iteratorMethod) return iteratorMethod.call(iterable); | ||
if ("function" == typeof iterable.next) return iterable; | ||
if (!isNaN(iterable.length)) { | ||
var i = -1, | ||
next = function next() { | ||
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; | ||
return next.value = undefined, next.done = !0, next; | ||
}; | ||
return next.next = next; | ||
} | ||
} | ||
return { | ||
next: doneResult | ||
}; | ||
} | ||
function doneResult() { | ||
return { | ||
value: undefined, | ||
done: !0 | ||
}; | ||
} | ||
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { | ||
value: GeneratorFunctionPrototype, | ||
configurable: !0 | ||
}), defineProperty(GeneratorFunctionPrototype, "constructor", { | ||
value: GeneratorFunction, | ||
configurable: !0 | ||
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { | ||
var ctor = "function" == typeof genFun && genFun.constructor; | ||
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); | ||
}, exports.mark = function (genFun) { | ||
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; | ||
}, exports.awrap = function (arg) { | ||
return { | ||
__await: arg | ||
}; | ||
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { | ||
return this; | ||
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { | ||
void 0 === PromiseImpl && (PromiseImpl = Promise); | ||
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); | ||
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { | ||
return result.done ? result.value : iter.next(); | ||
}); | ||
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { | ||
return this; | ||
}), define(Gp, "toString", function () { | ||
return "[object Generator]"; | ||
}), exports.keys = function (val) { | ||
var object = Object(val), | ||
keys = []; | ||
for (var key in object) keys.push(key); | ||
return keys.reverse(), function next() { | ||
for (; keys.length;) { | ||
var key = keys.pop(); | ||
if (key in object) return next.value = key, next.done = !1, next; | ||
} | ||
return next.done = !0, next; | ||
}; | ||
}, exports.values = values, Context.prototype = { | ||
constructor: Context, | ||
reset: function (skipTempReset) { | ||
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); | ||
}, | ||
stop: function () { | ||
this.done = !0; | ||
var rootRecord = this.tryEntries[0].completion; | ||
if ("throw" === rootRecord.type) throw rootRecord.arg; | ||
return this.rval; | ||
}, | ||
dispatchException: function (exception) { | ||
if (this.done) throw exception; | ||
var context = this; | ||
function handle(loc, caught) { | ||
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; | ||
} | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i], | ||
record = entry.completion; | ||
if ("root" === entry.tryLoc) return handle("end"); | ||
if (entry.tryLoc <= this.prev) { | ||
var hasCatch = hasOwn.call(entry, "catchLoc"), | ||
hasFinally = hasOwn.call(entry, "finallyLoc"); | ||
if (hasCatch && hasFinally) { | ||
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); | ||
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); | ||
} else if (hasCatch) { | ||
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); | ||
} else { | ||
if (!hasFinally) throw new Error("try statement without catch or finally"); | ||
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); | ||
} | ||
} | ||
} | ||
}, | ||
abrupt: function (type, arg) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { | ||
var finallyEntry = entry; | ||
break; | ||
} | ||
} | ||
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); | ||
var record = finallyEntry ? finallyEntry.completion : {}; | ||
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); | ||
}, | ||
complete: function (record, afterLoc) { | ||
if ("throw" === record.type) throw record.arg; | ||
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; | ||
}, | ||
finish: function (finallyLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; | ||
} | ||
}, | ||
catch: function (tryLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.tryLoc === tryLoc) { | ||
var record = entry.completion; | ||
if ("throw" === record.type) { | ||
var thrown = record.arg; | ||
resetTryEntry(entry); | ||
} | ||
return thrown; | ||
} | ||
} | ||
throw new Error("illegal catch attempt"); | ||
}, | ||
delegateYield: function (iterable, resultName, nextLoc) { | ||
return this.delegate = { | ||
iterator: values(iterable), | ||
resultName: resultName, | ||
nextLoc: nextLoc | ||
}, "next" === this.method && (this.arg = undefined), ContinueSentinel; | ||
} | ||
}, exports; | ||
} | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
try { | ||
var info = gen[key](arg); | ||
var value = info.value; | ||
} catch (error) { | ||
reject(error); | ||
return; | ||
} | ||
if (info.done) { | ||
resolve(value); | ||
} else { | ||
Promise.resolve(value).then(_next, _throw); | ||
} | ||
} | ||
function _asyncToGenerator(fn) { | ||
return function () { | ||
var self = this, | ||
args = arguments; | ||
return new Promise(function (resolve, reject) { | ||
var gen = fn.apply(self, args); | ||
function _next(value) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); | ||
} | ||
function _throw(err) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); | ||
} | ||
_next(undefined); | ||
}); | ||
}; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
key = _toPropertyKey(key); | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _toPrimitive(input, hint) { | ||
if (typeof input !== "object" || input === null) return input; | ||
var prim = input[Symbol.toPrimitive]; | ||
if (prim !== undefined) { | ||
var res = prim.call(input, hint || "default"); | ||
if (typeof res !== "object") return res; | ||
throw new TypeError("@@toPrimitive must return a primitive value."); | ||
} | ||
return (hint === "string" ? String : Number)(input); | ||
} | ||
function _toPropertyKey(arg) { | ||
var key = _toPrimitive(arg, "string"); | ||
return typeof key === "symbol" ? key : String(key); | ||
} | ||
var successCbQueue = []; | ||
var fetchLock = {}; | ||
// 获取头像列表 | ||
var getAvatarList = /*#__PURE__*/function () { | ||
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) { | ||
var fileName, repo, owner, url, data; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) switch (_context.prev = _context.next) { | ||
case 0: | ||
fileName = _ref.fileName, repo = _ref.repo, owner = _ref.owner; | ||
url = "https://proapi.azurewebsites.net/doc/getAvatarList?filename=".concat(fileName, "&owner=").concat(owner, "&repo=").concat(repo); | ||
_context.next = 4; | ||
return fetch(url, { | ||
mode: 'cors' | ||
}).then(function (res) { | ||
return res.json(); | ||
}).catch(function (e) { | ||
return console.log(e); | ||
}); | ||
case 4: | ||
data = _context.sent; | ||
if (data) { | ||
_context.next = 7; | ||
break; | ||
} | ||
return _context.abrupt("return", []); | ||
case 7: | ||
return _context.abrupt("return", data); | ||
case 8: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee); | ||
})); | ||
return function getAvatarList(_x) { | ||
return _ref2.apply(this, arguments); | ||
}; | ||
}(); | ||
var AvatarList = function AvatarList(_ref3) { | ||
var className = _ref3.className, | ||
renderItem = _ref3.renderItem, | ||
repo = _ref3.repo, | ||
owner = _ref3.owner, | ||
style = _ref3.style, | ||
fileName = _ref3.fileName, | ||
_ref3$filter = _ref3.filter, | ||
filter = _ref3$filter === void 0 ? function () { | ||
return true; | ||
} : _ref3$filter, | ||
_ref3$cache = _ref3.cache, | ||
cache = _ref3$cache === void 0 ? false : _ref3$cache, | ||
emptyRender = _ref3.emptyRender; | ||
var _useState = React.useState([]), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
list = _useState2[0], | ||
setList = _useState2[1]; | ||
var _useState3 = React.useState(true), | ||
_useState4 = _slicedToArray(_useState3, 2), | ||
loading = _useState4[0], | ||
setLoading = _useState4[1]; | ||
React.useEffect(function () { | ||
if (cache && fetchLock[fileName]) { | ||
successCbQueue.push(function (items) { | ||
setList(items); | ||
setLoading(false); | ||
}); | ||
return; | ||
} | ||
// loading | ||
fetchLock[fileName] = true; | ||
setLoading(true); | ||
getAvatarList({ | ||
owner: owner, | ||
repo: repo, | ||
fileName: fileName | ||
}).then(function (data) { | ||
setList(data); | ||
setLoading(false); | ||
cache && successCbQueue.forEach(function (fn) { | ||
return fn(data); | ||
}); | ||
}).catch(function () { | ||
setLoading(false); | ||
fetchLock[fileName] = false; | ||
}); | ||
}, [owner, repo, fileName]); | ||
React.useEffect(function () { | ||
return function () { | ||
fetchLock[fileName] = false; | ||
successCbQueue.splice(0, successCbQueue.length); | ||
}; | ||
}, [fileName]); | ||
if (loading) { | ||
return /*#__PURE__*/React__default['default'].createElement("div", { | ||
className: className, | ||
style: _objectSpread2({ | ||
display: 'flex', | ||
listStyle: 'none', | ||
margin: 0, | ||
padding: 0 | ||
}, style) | ||
}, renderItem && renderItem({}, true) || /*#__PURE__*/React__default['default'].createElement("span", null, "loading")); | ||
} | ||
var displayList = list.filter(filter); | ||
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("ul", { | ||
className: className, | ||
style: _objectSpread2({ | ||
display: 'flex', | ||
listStyle: 'none', | ||
margin: 0, | ||
padding: 0, | ||
flexFlow: 'wrap' | ||
}, style) | ||
}, displayList.map(function (item) { | ||
if (renderItem) { | ||
return renderItem(item, loading); | ||
} | ||
return /*#__PURE__*/React__default['default'].createElement("li", { | ||
style: { | ||
marginRight: 8, | ||
borderRadius: 20, | ||
overflow: 'hidden', | ||
border: '1px solid #ddd' | ||
} | ||
}, /*#__PURE__*/React__default['default'].createElement("a", { | ||
href: "https://github.com/".concat(item.username) | ||
}, /*#__PURE__*/React__default['default'].createElement("img", { | ||
width: 40, | ||
src: item.url, | ||
alt: item.username | ||
}))); | ||
}), displayList.length === 0 && emptyRender && emptyRender(fileName, owner, repo))); | ||
}; | ||
module.exports = AvatarList; | ||
import { AvatarList } from "./AvatarList"; | ||
export default AvatarList; |
{ | ||
"name": "@qixian.cs/github-contributors-list", | ||
"version": "1.1.0", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"module": "dist/index.esm.js", | ||
"authors": { | ||
"name": "chenshuai2144", | ||
"email": "qixian.cs@outlook.com" | ||
}, | ||
"version": "2.0.0", | ||
"description": "A react library developed with dumi", | ||
"module": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"dev": "father doc dev", | ||
"start": "npm run dev", | ||
"dev": "dumi dev", | ||
"build": "father build", | ||
"site": "father doc build && gh-pages -d ./.doc", | ||
"prepublishOnly": "npm run build && np --no-cleanup --yolo --no-publish" | ||
"build:watch": "father dev", | ||
"docs:build": "dumi build", | ||
"prepare": "husky install && dumi setup", | ||
"doctor": "father doctor", | ||
"lint": "npm run lint:es && npm run lint:css", | ||
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"", | ||
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"", | ||
"prepublishOnly": "father doctor && npm run build" | ||
}, | ||
"homepage": "https://github.com/chenshuai2144/github-contributors-list", | ||
"bugs": { | ||
"url": "https://github.com/chenshuai2144/github-contributors-list/issues" | ||
"authors": [], | ||
"license": "MIT", | ||
"files": [ | ||
"dist" | ||
], | ||
"commitlint": { | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/chenshuai2144/github-contributors-list" | ||
"lint-staged": { | ||
"*.{md,json}": [ | ||
"prettier --write --no-error-on-unmatched-pattern" | ||
], | ||
"*.{css,less}": [ | ||
"stylelint --fix", | ||
"prettier --write" | ||
], | ||
"*.{js,jsx}": [ | ||
"eslint --fix", | ||
"prettier --write" | ||
], | ||
"*.{ts,tsx}": [ | ||
"eslint --fix", | ||
"prettier --parser=typescript --write" | ||
] | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.0.0" | ||
"react": ">=16.9.0", | ||
"react-dom": ">=16.9.0" | ||
}, | ||
"devDependencies": { | ||
"father": "^2.16.0", | ||
"gh-pages": "^2.1.1", | ||
"np": "^5.2.1", | ||
"typescript": "^3.3.3" | ||
"@commitlint/cli": "^17.1.2", | ||
"@commitlint/config-conventional": "^17.1.0", | ||
"@types/react": "^18.0.0", | ||
"@types/react-dom": "^18.0.0", | ||
"@umijs/lint": "^4.0.0", | ||
"dumi": "^2.2.13", | ||
"eslint": "^8.23.0", | ||
"father": "^4.1.0", | ||
"husky": "^8.0.1", | ||
"lint-staged": "^13.0.3", | ||
"prettier": "^2.7.1", | ||
"prettier-plugin-organize-imports": "^3.0.0", | ||
"prettier-plugin-packagejson": "^2.2.18", | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0", | ||
"stylelint": "^14.9.1" | ||
}, | ||
"license": "MIT" | ||
"dependencies": { | ||
"swr": "^2.2.4" | ||
} | ||
} |
@@ -1,19 +0,40 @@ | ||
# github-contributors-list | ||
# @qixian.cs/github-contributors-list | ||
可以显示某个 filename 的 contributors 列表。 | ||
[![NPM version](https://img.shields.io/npm/v/@qixian.cs/github-contributors-list.svg?style=flat)](https://npmjs.org/package/@qixian.cs/github-contributors-list) | ||
[![NPM downloads](http://img.shields.io/npm/dm/@qixian.cs/github-contributors-list.svg?style=flat)](https://npmjs.org/package/@qixian.cs/github-contributors-list) | ||
> 个人作品,请勿用于生产环境 | ||
A react library developed with dumi | ||
## Usage | ||
```tsx | ||
TODO | ||
import AvatarList from 'github-contributors-list'; | ||
## Options | ||
<AvatarList repo="ant-design" owner="ant-design" fileName="/components/layout/index.en-US.md" /> | ||
TODO | ||
## Development | ||
```bash | ||
# install dependencies | ||
$ pnpm install | ||
# develop library by docs demo | ||
$ pnpm start | ||
# build library source code | ||
$ pnpm run build | ||
# build library source code in watch mode | ||
$ pnpm run build:watch | ||
# build docs | ||
$ pnpm run docs:build | ||
# check your project for potential problems | ||
$ pnpm run doctor | ||
``` | ||
## LICENSE | ||
MIT |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41
2
19508
3
16
7
172
2
1
1
+ Addedswr@^2.2.4
+ Addedclient-only@0.0.1(transitive)
+ Addedreact-dom@18.3.1(transitive)
+ Addedscheduler@0.23.2(transitive)
+ Addedswr@2.2.5(transitive)
+ Addeduse-sync-external-store@1.2.2(transitive)