mirror of
https://github.com/swc-project/swc.git
synced 2024-11-23 00:32:15 +03:00
fix(es/minifier): Fix bugs (#2433)
swc_ecma_minifier: - `sequences`: Stop searching for candidates if a dependency issue is found.
This commit is contained in:
parent
f8995848b8
commit
0e48284afb
8
Cargo.lock
generated
8
Cargo.lock
generated
@ -1547,9 +1547,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.10"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
|
||||
checksum = "c3ca011bd0129ff4ae15cd04c4eef202cadf6c51c21e47aba319b4e0501db741"
|
||||
|
||||
[[package]]
|
||||
name = "precomputed-hash"
|
||||
@ -2674,7 +2674,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_minifier"
|
||||
version = "0.38.0"
|
||||
version = "0.38.1"
|
||||
dependencies = [
|
||||
"ansi_term 0.12.1",
|
||||
"anyhow",
|
||||
@ -2783,7 +2783,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_base"
|
||||
version = "0.37.4"
|
||||
version = "0.37.5"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"phf",
|
||||
|
@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "src/lists/*.json"]
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_ecma_minifier"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.38.0"
|
||||
version = "0.38.1"
|
||||
|
||||
[features]
|
||||
debug = ["backtrace"]
|
||||
|
@ -283,6 +283,8 @@ where
|
||||
n.apply(&mut visitor);
|
||||
self.changed |= visitor.changed();
|
||||
if visitor.changed() {
|
||||
n.invoke();
|
||||
|
||||
tracing::debug!("compressor: Simplified expressions");
|
||||
if cfg!(feature = "debug") {
|
||||
tracing::debug!("===== Simplified =====\n{}", dump(&*n));
|
||||
@ -334,6 +336,8 @@ where
|
||||
);
|
||||
|
||||
if cfg!(feature = "debug") && visitor.changed() {
|
||||
n.invoke();
|
||||
|
||||
let start = n.dump();
|
||||
tracing::debug!("===== After pure =====\n{}", start);
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ where
|
||||
};
|
||||
|
||||
match &*e.exprs[e.exprs.len() - 2] {
|
||||
Expr::Assign(assign) => {
|
||||
Expr::Assign(assign @ AssignExpr { op: op!("="), .. }) => {
|
||||
if let Some(lhs) = get_lhs_ident(&assign.left) {
|
||||
if lhs.sym == last_id.sym && lhs.span.ctxt == last_id.span.ctxt {
|
||||
e.exprs.pop();
|
||||
@ -692,7 +692,7 @@ where
|
||||
}
|
||||
|
||||
for mut exprs in exprs {
|
||||
self.merge_sequences_in_exprs(&mut exprs);
|
||||
let _ = self.merge_sequences_in_exprs(&mut exprs);
|
||||
}
|
||||
|
||||
stmts.retain_mut(|stmt| match stmt.as_stmt_mut() {
|
||||
@ -764,7 +764,7 @@ where
|
||||
.map(Mergable::Expr)
|
||||
.collect();
|
||||
|
||||
self.merge_sequences_in_exprs(&mut exprs);
|
||||
let _ = self.merge_sequences_in_exprs(&mut exprs);
|
||||
|
||||
e.exprs.retain(|e| !e.is_invalid());
|
||||
}
|
||||
@ -774,7 +774,7 @@ where
|
||||
///
|
||||
/// TODO(kdy1): Check for side effects and call merge_sequential_expr more
|
||||
/// if expressions between a and b are side-effect-free.
|
||||
fn merge_sequences_in_exprs(&mut self, exprs: &mut Vec<Mergable>) {
|
||||
fn merge_sequences_in_exprs(&mut self, exprs: &mut Vec<Mergable>) -> Result<(), ()> {
|
||||
for idx in 0..exprs.len() {
|
||||
for j in idx..exprs.len() {
|
||||
let (a1, a2) = exprs.split_at_mut(idx);
|
||||
@ -794,7 +794,7 @@ where
|
||||
},
|
||||
Mergable::Expr(e) => e,
|
||||
},
|
||||
) {
|
||||
)? {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -818,6 +818,8 @@ where
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn is_skippable_for_seq(&self, a: Option<&Mergable>, e: &Expr) -> bool {
|
||||
@ -918,7 +920,9 @@ where
|
||||
}
|
||||
|
||||
/// Returns true if something is modified.
|
||||
fn merge_sequential_expr(&mut self, a: &mut Mergable, b: &mut Expr) -> bool {
|
||||
///
|
||||
/// Returns [Err] iff we should stop checking.
|
||||
fn merge_sequential_expr(&mut self, a: &mut Mergable, b: &mut Expr) -> Result<bool, ()> {
|
||||
let _tracing = if cfg!(feature = "debug") {
|
||||
let b_str = dump(&*b);
|
||||
|
||||
@ -933,16 +937,16 @@ where
|
||||
Expr::Seq(a) => {
|
||||
//
|
||||
for a in a.exprs.iter_mut().rev() {
|
||||
if self.merge_sequential_expr(&mut Mergable::Expr(a), b) {
|
||||
return true;
|
||||
if self.merge_sequential_expr(&mut Mergable::Expr(a), b)? {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
if !self.is_skippable_for_seq(None, &a) {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
_ => {}
|
||||
@ -950,7 +954,7 @@ where
|
||||
}
|
||||
|
||||
match b {
|
||||
Expr::Update(..) | Expr::Arrow(..) | Expr::Fn(..) => return false,
|
||||
Expr::Update(..) | Expr::Arrow(..) | Expr::Fn(..) => return Ok(false),
|
||||
|
||||
Expr::Cond(b) => {
|
||||
tracing::trace!("seq: Try test of cond");
|
||||
@ -966,16 +970,16 @@ where
|
||||
op, left, right, ..
|
||||
}) => {
|
||||
tracing::trace!("seq: Try left of bin");
|
||||
if self.merge_sequential_expr(a, &mut **left) {
|
||||
return true;
|
||||
if self.merge_sequential_expr(a, &mut **left)? {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
if !self.is_skippable_for_seq(Some(a), &left) {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
match *op {
|
||||
op!("&&") | op!("||") | op!("??") => return false,
|
||||
op!("&&") | op!("||") | op!("??") => return Ok(false),
|
||||
_ => {}
|
||||
}
|
||||
|
||||
@ -999,12 +1003,12 @@ where
|
||||
..
|
||||
}) => {
|
||||
tracing::trace!("seq: Try object of member (computed)");
|
||||
if self.merge_sequential_expr(a, &mut **obj) {
|
||||
return true;
|
||||
if self.merge_sequential_expr(a, &mut **obj)? {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
if obj.may_have_side_effects() {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
tracing::trace!("seq: Try prop of member (computed)");
|
||||
@ -1015,34 +1019,34 @@ where
|
||||
match &mut b.left {
|
||||
PatOrExpr::Expr(b) => {
|
||||
tracing::trace!("seq: Try lhs of assign");
|
||||
if self.merge_sequential_expr(a, &mut **b) {
|
||||
return true;
|
||||
if self.merge_sequential_expr(a, &mut **b)? {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
match &**b {
|
||||
Expr::Ident(..) => {}
|
||||
|
||||
_ => {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
PatOrExpr::Pat(b) => match &mut **b {
|
||||
Pat::Expr(b) => {
|
||||
tracing::trace!("seq: Try lhs of assign");
|
||||
if self.merge_sequential_expr(a, &mut **b) {
|
||||
return true;
|
||||
if self.merge_sequential_expr(a, &mut **b)? {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
match &**b {
|
||||
Expr::Ident(..) => {}
|
||||
_ => {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Pat::Ident(..) => {}
|
||||
_ => return false,
|
||||
_ => return Ok(false),
|
||||
},
|
||||
}
|
||||
|
||||
@ -1056,18 +1060,18 @@ where
|
||||
Expr::Ident(..) => {}
|
||||
|
||||
_ => {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
},
|
||||
PatOrExpr::Pat(b) => match &mut **b {
|
||||
Pat::Expr(b) => match &**b {
|
||||
Expr::Ident(..) => {}
|
||||
_ => {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
},
|
||||
Pat::Ident(..) => {}
|
||||
_ => return false,
|
||||
_ => return Ok(false),
|
||||
},
|
||||
}
|
||||
|
||||
@ -1080,8 +1084,8 @@ where
|
||||
match elem {
|
||||
Some(elem) => {
|
||||
tracing::trace!("seq: Try element of array");
|
||||
if self.merge_sequential_expr(a, &mut elem.expr) {
|
||||
return true;
|
||||
if self.merge_sequential_expr(a, &mut elem.expr)? {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
match &*elem.expr {
|
||||
@ -1096,7 +1100,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
Expr::Call(CallExpr {
|
||||
@ -1106,7 +1110,7 @@ where
|
||||
}) => {
|
||||
let is_this_undefined = b_callee.is_ident();
|
||||
tracing::trace!("seq: Try callee of call");
|
||||
if self.merge_sequential_expr(a, &mut **b_callee) {
|
||||
if self.merge_sequential_expr(a, &mut **b_callee)? {
|
||||
if is_this_undefined {
|
||||
match &**b_callee {
|
||||
Expr::Member(..) => {
|
||||
@ -1126,63 +1130,63 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
if !self.is_skippable_for_seq(Some(a), &b_callee) {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
for arg in b_args {
|
||||
tracing::trace!("seq: Try arg of call");
|
||||
if self.merge_sequential_expr(a, &mut arg.expr) {
|
||||
return true;
|
||||
if self.merge_sequential_expr(a, &mut arg.expr)? {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
if !self.is_skippable_for_seq(Some(a), &arg.expr) {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
Expr::New(NewExpr {
|
||||
callee: b_callee, ..
|
||||
}) => {
|
||||
tracing::trace!("seq: Try callee of new");
|
||||
if self.merge_sequential_expr(a, &mut **b_callee) {
|
||||
return true;
|
||||
if self.merge_sequential_expr(a, &mut **b_callee)? {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
Expr::Seq(SeqExpr { exprs: b_exprs, .. }) => {
|
||||
for b_expr in b_exprs {
|
||||
tracing::trace!("seq: Try elem of seq");
|
||||
|
||||
if self.merge_sequential_expr(a, &mut **b_expr) {
|
||||
return true;
|
||||
if self.merge_sequential_expr(a, &mut **b_expr)? {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
if !self.is_skippable_for_seq(Some(a), &b_expr) {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
Expr::Object(ObjectLit { props, .. }) => {
|
||||
for prop in props {
|
||||
match prop {
|
||||
PropOrSpread::Spread(prop) => {
|
||||
if self.merge_sequential_expr(a, &mut *prop.expr) {
|
||||
return true;
|
||||
if self.merge_sequential_expr(a, &mut *prop.expr)? {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
PropOrSpread::Prop(prop) => {
|
||||
// Inline into key
|
||||
@ -1196,32 +1200,32 @@ where
|
||||
};
|
||||
|
||||
if let Some(PropName::Computed(key)) = key {
|
||||
if self.merge_sequential_expr(a, &mut key.expr) {
|
||||
return true;
|
||||
if self.merge_sequential_expr(a, &mut key.expr)? {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
if !self.is_skippable_for_seq(Some(a), &key.expr) {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
}
|
||||
|
||||
match &mut **prop {
|
||||
Prop::KeyValue(prop) => {
|
||||
if self.merge_sequential_expr(a, &mut prop.value) {
|
||||
return true;
|
||||
if self.merge_sequential_expr(a, &mut prop.value)? {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
if !self.is_skippable_for_seq(Some(a), &prop.value) {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
}
|
||||
Prop::Assign(prop) => {
|
||||
if self.merge_sequential_expr(a, &mut prop.value) {
|
||||
return true;
|
||||
if self.merge_sequential_expr(a, &mut prop.value)? {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
if !self.is_skippable_for_seq(Some(a), &prop.value) {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
@ -1230,7 +1234,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
_ => {}
|
||||
@ -1281,7 +1285,7 @@ where
|
||||
v.expr_usage,
|
||||
v.pat_usage
|
||||
);
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
let mut replaced = false;
|
||||
@ -1296,14 +1300,14 @@ where
|
||||
});
|
||||
if replaced {
|
||||
a.take();
|
||||
return true;
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
|
||||
_ => {}
|
||||
}
|
||||
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
_ => {}
|
||||
@ -1326,7 +1330,7 @@ where
|
||||
Some(v) => v,
|
||||
None => {
|
||||
tracing::trace!("[X] sequences: Aborting because lhs is not an id");
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1341,20 +1345,20 @@ where
|
||||
left_id.sym,
|
||||
left_id.span.ctxt
|
||||
);
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
}
|
||||
|
||||
(left_id.clone(), right)
|
||||
}
|
||||
_ => return false,
|
||||
_ => return Ok(false),
|
||||
}
|
||||
}
|
||||
|
||||
Mergable::Var(a) => {
|
||||
let left = match &a.name {
|
||||
Pat::Ident(i) => i.id.clone(),
|
||||
_ => return false,
|
||||
_ => return Ok(false),
|
||||
};
|
||||
|
||||
if let Some(usage) = self
|
||||
@ -1363,16 +1367,16 @@ where
|
||||
.and_then(|data| data.vars.get(&left.to_id()))
|
||||
{
|
||||
if usage.ref_count != 1 {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
if usage.reassigned || !usage.is_fn_local {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
match &mut a.init {
|
||||
Some(v) => (left, v),
|
||||
None => {
|
||||
if usage.declared_count > 1 {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
right_val = undefined(DUMMY_SP);
|
||||
@ -1380,19 +1384,19 @@ where
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if right.is_this() || right.is_ident_ref_to(js_word!("arguments")) {
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
if idents_used_by_ignoring_nested(&**right)
|
||||
.iter()
|
||||
.any(|v| v.0 == js_word!("arguments"))
|
||||
{
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
{
|
||||
@ -1419,7 +1423,7 @@ where
|
||||
|
||||
if used_by_b.contains(id) {
|
||||
tracing::trace!("[X] sequences: Aborting because of deps");
|
||||
return false;
|
||||
return Err(());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1440,7 +1444,7 @@ where
|
||||
v.expr_usage,
|
||||
v.pat_usage
|
||||
);
|
||||
return false;
|
||||
return Ok(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1458,7 +1462,11 @@ where
|
||||
|
||||
replace_id_with_expr(b, left_id.to_id(), to);
|
||||
|
||||
true
|
||||
if cfg!(feature = "debug") {
|
||||
tracing::debug!("sequences: [Chanded] {}", dump(&*b));
|
||||
}
|
||||
|
||||
Ok(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,6 +119,8 @@ where
|
||||
pub(super) fn ignore_return_value(&mut self, e: &mut Expr) {
|
||||
match e {
|
||||
Expr::Seq(e) => {
|
||||
self.drop_useless_ident_ref_in_seq(e);
|
||||
|
||||
if let Some(last) = e.exprs.last_mut() {
|
||||
// Non-last elements are already processed.
|
||||
self.ignore_return_value(&mut **last);
|
||||
|
@ -412,8 +412,6 @@ where
|
||||
return;
|
||||
}
|
||||
|
||||
self.drop_useless_ident_ref_in_seq(e);
|
||||
|
||||
self.merge_seq_call(e);
|
||||
|
||||
let len = e.exprs.len();
|
||||
|
@ -28,6 +28,11 @@ where
|
||||
PatOrExpr::Pat(left) => match &**left {
|
||||
Pat::Ident(left) => {
|
||||
if left.id.sym == ident.sym && left.id.span.ctxt == ident.span.ctxt {
|
||||
tracing::debug!(
|
||||
"drop_useless_ident_ref_in_seq: Dropping `{}` as it's useless",
|
||||
left.id
|
||||
);
|
||||
self.changed = true;
|
||||
seq.exprs.pop();
|
||||
}
|
||||
}
|
||||
|
@ -316,8 +316,8 @@ fn projects(input: PathBuf) {
|
||||
#[testing::fixture("tests/exec/**/input.js")]
|
||||
fn base_exec(input: PathBuf) {
|
||||
let dir = input.parent().unwrap();
|
||||
let config = dir.join("config.json");
|
||||
let config = read_to_string(&config).expect("failed to read config.json");
|
||||
|
||||
let config = find_config(&dir);
|
||||
eprintln!("---- {} -----\n{}", Color::Green.paint("Config"), config);
|
||||
|
||||
testing::run_test2(false, |cm, handler| {
|
||||
|
1
ecmascript/minifier/tests/compress/fixture/issues/.gitignore
vendored
Normal file
1
ecmascript/minifier/tests/compress/fixture/issues/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
private
|
File diff suppressed because it is too large
Load Diff
153
ecmascript/minifier/tests/compress/fixture/issues/react-autosuggest/1/input.js
vendored
Normal file
153
ecmascript/minifier/tests/compress/fixture/issues/react-autosuggest/1/input.js
vendored
Normal file
@ -0,0 +1,153 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
|
||||
var _Item = _interopRequireDefault(require("./Item"));
|
||||
|
||||
var _compareObjects = _interopRequireDefault(require("./compareObjects"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () { })); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
var ItemsList = /*#__PURE__*/function (_Component) {
|
||||
_inherits(ItemsList, _Component);
|
||||
|
||||
var _super = _createSuper(ItemsList);
|
||||
|
||||
function ItemsList() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, ItemsList);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
_this = _super.call.apply(_super, [this].concat(args));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "storeHighlightedItemReference", function (highlightedItem) {
|
||||
_this.props.onHighlightedItemChange(highlightedItem === null ? null : highlightedItem.item);
|
||||
});
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(ItemsList, [{
|
||||
key: "shouldComponentUpdate",
|
||||
value: function shouldComponentUpdate(nextProps) {
|
||||
return (0, _compareObjects["default"])(nextProps, this.props, ['itemProps']);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
var _this$props = this.props,
|
||||
items = _this$props.items,
|
||||
itemProps = _this$props.itemProps,
|
||||
renderItem = _this$props.renderItem,
|
||||
renderItemData = _this$props.renderItemData,
|
||||
sectionIndex = _this$props.sectionIndex,
|
||||
highlightedItemIndex = _this$props.highlightedItemIndex,
|
||||
getItemId = _this$props.getItemId,
|
||||
theme = _this$props.theme,
|
||||
keyPrefix = _this$props.keyPrefix;
|
||||
var sectionPrefix = sectionIndex === null ? keyPrefix : "".concat(keyPrefix, "section-").concat(sectionIndex, "-");
|
||||
var isItemPropsFunction = typeof itemProps === 'function';
|
||||
return /*#__PURE__*/_react["default"].createElement("ul", _extends({
|
||||
role: "listbox"
|
||||
}, theme("".concat(sectionPrefix, "items-list"), 'itemsList')), items.map(function (item, itemIndex) {
|
||||
var isFirst = itemIndex === 0;
|
||||
var isHighlighted = itemIndex === highlightedItemIndex;
|
||||
var itemKey = "".concat(sectionPrefix, "item-").concat(itemIndex);
|
||||
var itemPropsObj = isItemPropsFunction ? itemProps({
|
||||
sectionIndex: sectionIndex,
|
||||
itemIndex: itemIndex
|
||||
}) : itemProps;
|
||||
|
||||
var allItemProps = _objectSpread({
|
||||
id: getItemId(sectionIndex, itemIndex),
|
||||
'aria-selected': isHighlighted
|
||||
}, theme(itemKey, 'item', isFirst && 'itemFirst', isHighlighted && 'itemHighlighted'), {}, itemPropsObj);
|
||||
|
||||
if (isHighlighted) {
|
||||
allItemProps.ref = _this2.storeHighlightedItemReference;
|
||||
} // `key` is provided by theme()
|
||||
|
||||
/* eslint-disable react/jsx-key */
|
||||
|
||||
|
||||
return /*#__PURE__*/_react["default"].createElement(_Item["default"], _extends({}, allItemProps, {
|
||||
sectionIndex: sectionIndex,
|
||||
isHighlighted: isHighlighted,
|
||||
itemIndex: itemIndex,
|
||||
item: item,
|
||||
renderItem: renderItem,
|
||||
renderItemData: renderItemData
|
||||
}));
|
||||
/* eslint-enable react/jsx-key */
|
||||
}));
|
||||
}
|
||||
}]);
|
||||
|
||||
return ItemsList;
|
||||
}(_react.Component);
|
||||
|
||||
exports["default"] = ItemsList;
|
||||
|
||||
_defineProperty(ItemsList, "propTypes", {
|
||||
items: _propTypes["default"].array.isRequired,
|
||||
itemProps: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].func]),
|
||||
renderItem: _propTypes["default"].func.isRequired,
|
||||
renderItemData: _propTypes["default"].object.isRequired,
|
||||
sectionIndex: _propTypes["default"].number,
|
||||
highlightedItemIndex: _propTypes["default"].number,
|
||||
onHighlightedItemChange: _propTypes["default"].func.isRequired,
|
||||
getItemId: _propTypes["default"].func.isRequired,
|
||||
theme: _propTypes["default"].func.isRequired,
|
||||
keyPrefix: _propTypes["default"].string.isRequired
|
||||
});
|
||||
|
||||
_defineProperty(ItemsList, "defaultProps", {
|
||||
sectionIndex: null
|
||||
});
|
194
ecmascript/minifier/tests/compress/fixture/issues/react-autosuggest/1/output.js
vendored
Normal file
194
ecmascript/minifier/tests/compress/fixture/issues/react-autosuggest/1/output.js
vendored
Normal file
@ -0,0 +1,194 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: !0
|
||||
}), exports.default = void 0;
|
||||
var _react = function(obj) {
|
||||
if (obj && obj.__esModule) return obj;
|
||||
if (null === obj || "object" !== _typeof(obj) && "function" != typeof obj) return {
|
||||
"default": obj
|
||||
};
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) return cache.get(obj);
|
||||
var newObj = {
|
||||
}, hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for(var key in obj)if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
||||
desc && (desc.get || desc.set) ? Object.defineProperty(newObj, key, desc) : newObj[key] = obj[key];
|
||||
}
|
||||
return newObj.default = obj, cache && cache.set(obj, newObj), newObj;
|
||||
}(require("react")), _propTypes = _interopRequireDefault(require("prop-types")), _Item = _interopRequireDefault(require("./Item")), _compareObjects = _interopRequireDefault(require("./compareObjects"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
"default": obj
|
||||
};
|
||||
}
|
||||
function _getRequireWildcardCache() {
|
||||
if ("function" != typeof WeakMap) return null;
|
||||
var cache = new WeakMap();
|
||||
return _getRequireWildcardCache = function() {
|
||||
return cache;
|
||||
}, cache;
|
||||
}
|
||||
function _typeof(obj) {
|
||||
return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
|
||||
return typeof obj;
|
||||
} : function(obj) {
|
||||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||||
})(obj);
|
||||
}
|
||||
function _extends() {
|
||||
return (_extends = Object.assign || function(target) {
|
||||
for(var i = 1; i < arguments.length; i++){
|
||||
var source = arguments[i];
|
||||
for(var key in source)Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
|
||||
}
|
||||
return target;
|
||||
}).apply(this, arguments);
|
||||
}
|
||||
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 _defineProperties(target, props) {
|
||||
for(var i = 0; i < props.length; i++){
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
function _assertThisInitialized(self) {
|
||||
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
return self;
|
||||
}
|
||||
function _getPrototypeOf(o) {
|
||||
return (_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function(o) {
|
||||
return o.__proto__ || Object.getPrototypeOf(o);
|
||||
})(o);
|
||||
}
|
||||
function _setPrototypeOf(o, p) {
|
||||
return (_setPrototypeOf = Object.setPrototypeOf || function(o, p) {
|
||||
return o.__proto__ = p, o;
|
||||
})(o, p);
|
||||
}
|
||||
function _defineProperty(obj, key, value) {
|
||||
return key in obj ? Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: !0,
|
||||
configurable: !0,
|
||||
writable: !0
|
||||
}) : obj[key] = value, obj;
|
||||
}
|
||||
var ItemsList = function(_Component) {
|
||||
!function(subClass, superClass) {
|
||||
if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function");
|
||||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
||||
constructor: {
|
||||
value: subClass,
|
||||
writable: !0,
|
||||
configurable: !0
|
||||
}
|
||||
}), superClass && _setPrototypeOf(subClass, superClass);
|
||||
}(ItemsList, _Component);
|
||||
var Constructor, protoProps, staticProps, _super = function(Derived) {
|
||||
return function() {
|
||||
var self, call, result, Super = _getPrototypeOf(Derived);
|
||||
if ((function() {
|
||||
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
|
||||
if (Reflect.construct.sham) return !1;
|
||||
if ("function" == typeof Proxy) return !0;
|
||||
try {
|
||||
return Date.prototype.toString.call(Reflect.construct(Date, [], function() {
|
||||
})), !0;
|
||||
} catch (e) {
|
||||
return !1;
|
||||
}
|
||||
})()) {
|
||||
var NewTarget = _getPrototypeOf(this).constructor;
|
||||
result = Reflect.construct(Super, arguments, NewTarget);
|
||||
} else result = Super.apply(this, arguments);
|
||||
return self = this, (call = result) && ("object" === _typeof(call) || "function" == typeof call) ? call : _assertThisInitialized(self);
|
||||
};
|
||||
}(ItemsList);
|
||||
function ItemsList() {
|
||||
var _this;
|
||||
!function(instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
||||
}(this, ItemsList);
|
||||
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key];
|
||||
return _defineProperty(_assertThisInitialized(_this = _super.call.apply(_super, [
|
||||
this
|
||||
].concat(args))), "storeHighlightedItemReference", function(highlightedItem) {
|
||||
_this.props.onHighlightedItemChange(null === highlightedItem ? null : highlightedItem.item);
|
||||
}), _this;
|
||||
}
|
||||
return Constructor = ItemsList, protoProps = [
|
||||
{
|
||||
key: "shouldComponentUpdate",
|
||||
value: function(nextProps) {
|
||||
return (0, _compareObjects.default)(nextProps, this.props, [
|
||||
"itemProps"
|
||||
]);
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "render",
|
||||
value: function() {
|
||||
var _this2 = this, _this$props = this.props, items = _this$props.items, itemProps = _this$props.itemProps, renderItem = _this$props.renderItem, renderItemData = _this$props.renderItemData, sectionIndex = _this$props.sectionIndex, highlightedItemIndex = _this$props.highlightedItemIndex, getItemId = _this$props.getItemId, theme = _this$props.theme, keyPrefix = _this$props.keyPrefix, sectionPrefix = null === sectionIndex ? keyPrefix : "".concat(keyPrefix, "section-").concat(sectionIndex, "-"), isItemPropsFunction = "function" == typeof itemProps;
|
||||
return _react.default.createElement("ul", _extends({
|
||||
role: "listbox"
|
||||
}, theme("".concat(sectionPrefix, "items-list"), "itemsList")), items.map(function(item, itemIndex) {
|
||||
var isHighlighted = itemIndex === highlightedItemIndex, itemKey = "".concat(sectionPrefix, "item-").concat(itemIndex), itemPropsObj = isItemPropsFunction ? itemProps({
|
||||
sectionIndex: sectionIndex,
|
||||
itemIndex: itemIndex
|
||||
}) : itemProps, allItemProps = function(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;
|
||||
}({
|
||||
id: getItemId(sectionIndex, itemIndex),
|
||||
"aria-selected": isHighlighted
|
||||
}, theme(itemKey, "item", 0 === itemIndex && "itemFirst", isHighlighted && "itemHighlighted"), {
|
||||
}, itemPropsObj);
|
||||
return isHighlighted && (allItemProps.ref = _this2.storeHighlightedItemReference), _react.default.createElement(_Item.default, _extends({
|
||||
}, allItemProps, {
|
||||
sectionIndex: sectionIndex,
|
||||
isHighlighted: isHighlighted,
|
||||
itemIndex: itemIndex,
|
||||
item: item,
|
||||
renderItem: renderItem,
|
||||
renderItemData: renderItemData
|
||||
}));
|
||||
}));
|
||||
}
|
||||
}
|
||||
], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), ItemsList;
|
||||
}(_react.Component);
|
||||
exports.default = ItemsList, _defineProperty(ItemsList, "propTypes", {
|
||||
items: _propTypes.default.array.isRequired,
|
||||
itemProps: _propTypes.default.oneOfType([
|
||||
_propTypes.default.object,
|
||||
_propTypes.default.func
|
||||
]),
|
||||
renderItem: _propTypes.default.func.isRequired,
|
||||
renderItemData: _propTypes.default.object.isRequired,
|
||||
sectionIndex: _propTypes.default.number,
|
||||
highlightedItemIndex: _propTypes.default.number,
|
||||
onHighlightedItemChange: _propTypes.default.func.isRequired,
|
||||
getItemId: _propTypes.default.func.isRequired,
|
||||
theme: _propTypes.default.func.isRequired,
|
||||
keyPrefix: _propTypes.default.string.isRequired
|
||||
}), _defineProperty(ItemsList, "defaultProps", {
|
||||
sectionIndex: null
|
||||
});
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"defaults": true,
|
||||
"toplevel": true
|
||||
}
|
177
ecmascript/minifier/tests/compress/fixture/issues/react-autowhatever/1/input.js
vendored
Normal file
177
ecmascript/minifier/tests/compress/fixture/issues/react-autowhatever/1/input.js
vendored
Normal file
@ -0,0 +1,177 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Item from './Item';
|
||||
import compareObjects from './compareObjects';
|
||||
function _assertThisInitialized(self) {
|
||||
if (self === void 0) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
}
|
||||
return self;
|
||||
}
|
||||
function _classCallCheck(instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
}
|
||||
function _defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if ("value" in descriptor) descriptor.writable = true;
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
}
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function _getPrototypeOf(o) {
|
||||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
||||
return o.__proto__ || Object.getPrototypeOf(o);
|
||||
};
|
||||
return _getPrototypeOf(o);
|
||||
}
|
||||
function _inherits(subClass, superClass) {
|
||||
if (typeof superClass !== "function" && superClass !== null) {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
||||
constructor: {
|
||||
value: subClass,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
if (superClass) _setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
function _objectSpread(target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i] != null ? arguments[i] : {
|
||||
};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === "function") {
|
||||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
}));
|
||||
}
|
||||
ownKeys.forEach(function (key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
function _possibleConstructorReturn(self, call) {
|
||||
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
||||
return call;
|
||||
}
|
||||
return _assertThisInitialized(self);
|
||||
}
|
||||
function _setPrototypeOf(o, p) {
|
||||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
var _typeof = function (obj) {
|
||||
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
||||
};
|
||||
var ItemsList = /*#__PURE__*/ function (Component) {
|
||||
"use strict";
|
||||
_inherits(ItemsList, Component);
|
||||
function ItemsList() {
|
||||
_classCallCheck(this, ItemsList);
|
||||
var _this;
|
||||
_this = _possibleConstructorReturn(this, _getPrototypeOf(ItemsList).apply(this, arguments));
|
||||
_this.storeHighlightedItemReference = function (highlightedItem) {
|
||||
_this.props.onHighlightedItemChange(highlightedItem === null ? null : highlightedItem.item);
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
_createClass(ItemsList, [
|
||||
{
|
||||
key: "shouldComponentUpdate",
|
||||
value: function shouldComponentUpdate(nextProps) {
|
||||
return compareObjects(nextProps, this.props, [
|
||||
'itemProps'
|
||||
]);
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this = this;
|
||||
var _props = this.props, items = _props.items, itemProps = _props.itemProps, renderItem = _props.renderItem, renderItemData = _props.renderItemData, sectionIndex = _props.sectionIndex, highlightedItemIndex = _props.highlightedItemIndex, getItemId = _props.getItemId, theme = _props.theme, keyPrefix = _props.keyPrefix;
|
||||
var sectionPrefix = sectionIndex === null ? keyPrefix : "".concat(keyPrefix, "section-").concat(sectionIndex, "-");
|
||||
var isItemPropsFunction = typeof itemProps === 'function';
|
||||
return (/*#__PURE__*/ _jsx("ul", _objectSpread({
|
||||
role: "listbox"
|
||||
}, theme("".concat(sectionPrefix, "items-list"), 'itemsList'), {
|
||||
children: items.map(function (item, itemIndex) {
|
||||
var isFirst = itemIndex === 0;
|
||||
var isHighlighted = itemIndex === highlightedItemIndex;
|
||||
var itemKey = "".concat(sectionPrefix, "item-").concat(itemIndex);
|
||||
var itemPropsObj = isItemPropsFunction ? itemProps({
|
||||
sectionIndex: sectionIndex,
|
||||
itemIndex: itemIndex
|
||||
}) : itemProps;
|
||||
var allItemProps = _objectSpread({
|
||||
id: getItemId(sectionIndex, itemIndex),
|
||||
'aria-selected': isHighlighted
|
||||
}, theme(itemKey, 'item', isFirst && 'itemFirst', isHighlighted && 'itemHighlighted'), itemPropsObj);
|
||||
if (isHighlighted) {
|
||||
allItemProps.ref = _this.storeHighlightedItemReference;
|
||||
}
|
||||
// `key` is provided by theme()
|
||||
/* eslint-disable react/jsx-key */ return (/*#__PURE__*/ _jsx(Item, _objectSpread({
|
||||
}, allItemProps, {
|
||||
sectionIndex: sectionIndex,
|
||||
isHighlighted: isHighlighted,
|
||||
itemIndex: itemIndex,
|
||||
item: item,
|
||||
renderItem: renderItem,
|
||||
renderItemData: renderItemData
|
||||
})));
|
||||
/* eslint-enable react/jsx-key */
|
||||
})
|
||||
})));
|
||||
}
|
||||
}
|
||||
]);
|
||||
return ItemsList;
|
||||
}(Component);
|
||||
ItemsList.propTypes = {
|
||||
items: PropTypes.array.isRequired,
|
||||
itemProps: PropTypes.oneOfType([
|
||||
PropTypes.object,
|
||||
PropTypes.func
|
||||
]),
|
||||
renderItem: PropTypes.func.isRequired,
|
||||
renderItemData: PropTypes.object.isRequired,
|
||||
sectionIndex: PropTypes.number,
|
||||
highlightedItemIndex: PropTypes.number,
|
||||
onHighlightedItemChange: PropTypes.func.isRequired,
|
||||
getItemId: PropTypes.func.isRequired,
|
||||
theme: PropTypes.func.isRequired,
|
||||
keyPrefix: PropTypes.string.isRequired
|
||||
};
|
||||
ItemsList.defaultProps = {
|
||||
sectionIndex: null
|
||||
};
|
||||
export { ItemsList as default };
|
121
ecmascript/minifier/tests/compress/fixture/issues/react-autowhatever/1/output.js
vendored
Normal file
121
ecmascript/minifier/tests/compress/fixture/issues/react-autowhatever/1/output.js
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import Item from "./Item";
|
||||
import compareObjects from "./compareObjects";
|
||||
function _defineProperties(target, props) {
|
||||
for(var i = 0; i < props.length; i++){
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
function _defineProperty(obj, key, value) {
|
||||
return key in obj ? Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: !0,
|
||||
configurable: !0,
|
||||
writable: !0
|
||||
}) : obj[key] = value, obj;
|
||||
}
|
||||
function _getPrototypeOf(o) {
|
||||
return (_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function(o) {
|
||||
return o.__proto__ || Object.getPrototypeOf(o);
|
||||
})(o);
|
||||
}
|
||||
function _objectSpread(target) {
|
||||
for(var i = 1; i < arguments.length; i++){
|
||||
var source = null != arguments[i] ? arguments[i] : {
|
||||
}, ownKeys = Object.keys(source);
|
||||
"function" == typeof Object.getOwnPropertySymbols && (ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
}))), ownKeys.forEach(function(key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
function _setPrototypeOf(o, p) {
|
||||
return (_setPrototypeOf = Object.setPrototypeOf || function(o, p) {
|
||||
return o.__proto__ = p, o;
|
||||
})(o, p);
|
||||
}
|
||||
var ItemsList = function(Component) {
|
||||
"use strict";
|
||||
var Constructor, protoProps, staticProps;
|
||||
function ItemsList() {
|
||||
var _this, self, call, obj;
|
||||
return !function(instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
||||
}(this, ItemsList), self = this, call = _getPrototypeOf(ItemsList).apply(this, arguments), (_this = call && ("object" == ((obj = call) && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj) || "function" == typeof call) ? call : (function(self) {
|
||||
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
return self;
|
||||
})(self)).storeHighlightedItemReference = function(highlightedItem) {
|
||||
_this.props.onHighlightedItemChange(null === highlightedItem ? null : highlightedItem.item);
|
||||
}, _this;
|
||||
}
|
||||
return !function(subClass, superClass) {
|
||||
if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function");
|
||||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
||||
constructor: {
|
||||
value: subClass,
|
||||
writable: !0,
|
||||
configurable: !0
|
||||
}
|
||||
}), superClass && _setPrototypeOf(subClass, superClass);
|
||||
}(ItemsList, Component), Constructor = ItemsList, protoProps = [
|
||||
{
|
||||
key: "shouldComponentUpdate",
|
||||
value: function(nextProps) {
|
||||
return compareObjects(nextProps, this.props, [
|
||||
"itemProps"
|
||||
]);
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "render",
|
||||
value: function() {
|
||||
var _this = this, _props = this.props, items = _props.items, itemProps = _props.itemProps, renderItem = _props.renderItem, renderItemData = _props.renderItemData, sectionIndex = _props.sectionIndex, highlightedItemIndex = _props.highlightedItemIndex, getItemId = _props.getItemId, theme = _props.theme, keyPrefix = _props.keyPrefix, sectionPrefix = null === sectionIndex ? keyPrefix : "".concat(keyPrefix, "section-").concat(sectionIndex, "-"), isItemPropsFunction = "function" == typeof itemProps;
|
||||
return _jsx("ul", _objectSpread({
|
||||
role: "listbox"
|
||||
}, theme("".concat(sectionPrefix, "items-list"), "itemsList"), {
|
||||
children: items.map(function(item, itemIndex) {
|
||||
var isHighlighted = itemIndex === highlightedItemIndex, itemKey = "".concat(sectionPrefix, "item-").concat(itemIndex), itemPropsObj = isItemPropsFunction ? itemProps({
|
||||
sectionIndex: sectionIndex,
|
||||
itemIndex: itemIndex
|
||||
}) : itemProps, allItemProps = _objectSpread({
|
||||
id: getItemId(sectionIndex, itemIndex),
|
||||
"aria-selected": isHighlighted
|
||||
}, theme(itemKey, "item", 0 === itemIndex && "itemFirst", isHighlighted && "itemHighlighted"), itemPropsObj);
|
||||
return isHighlighted && (allItemProps.ref = _this.storeHighlightedItemReference), _jsx(Item, _objectSpread({
|
||||
}, allItemProps, {
|
||||
sectionIndex: sectionIndex,
|
||||
isHighlighted: isHighlighted,
|
||||
itemIndex: itemIndex,
|
||||
item: item,
|
||||
renderItem: renderItem,
|
||||
renderItemData: renderItemData
|
||||
}));
|
||||
})
|
||||
}));
|
||||
}
|
||||
}
|
||||
], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), ItemsList;
|
||||
}(Component);
|
||||
ItemsList.propTypes = {
|
||||
items: PropTypes.array.isRequired,
|
||||
itemProps: PropTypes.oneOfType([
|
||||
PropTypes.object,
|
||||
PropTypes.func
|
||||
]),
|
||||
renderItem: PropTypes.func.isRequired,
|
||||
renderItemData: PropTypes.object.isRequired,
|
||||
sectionIndex: PropTypes.number,
|
||||
highlightedItemIndex: PropTypes.number,
|
||||
onHighlightedItemChange: PropTypes.func.isRequired,
|
||||
getItemId: PropTypes.func.isRequired,
|
||||
theme: PropTypes.func.isRequired,
|
||||
keyPrefix: PropTypes.string.isRequired
|
||||
}, ItemsList.defaultProps = {
|
||||
sectionIndex: null
|
||||
};
|
||||
export { ItemsList as default };
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"defaults": true,
|
||||
"toplevel": true
|
||||
}
|
@ -68,17 +68,17 @@ export default function createInstantSearchManager(param) {
|
||||
}, indices, swcHelpers.defineProperty({
|
||||
}, indexId, widgets.concat(widget)));
|
||||
}, {
|
||||
}), derivedParameters = Object.keys(derivedIndices).map(function(indexId) {
|
||||
return {
|
||||
parameters: derivedIndices[indexId].reduce(function(res, widget) {
|
||||
return widget.getSearchParameters(res);
|
||||
}, sharedParameters),
|
||||
indexId: indexId
|
||||
};
|
||||
});
|
||||
return {
|
||||
mainParameters: mainParameters,
|
||||
derivedParameters: Object.keys(derivedIndices).map(function(indexId) {
|
||||
return {
|
||||
parameters: derivedIndices[indexId].reduce(function(res, widget) {
|
||||
return widget.getSearchParameters(res);
|
||||
}, sharedParameters),
|
||||
indexId: indexId
|
||||
};
|
||||
})
|
||||
derivedParameters: derivedParameters
|
||||
};
|
||||
}, search = function() {
|
||||
if (!skip) {
|
||||
@ -86,10 +86,10 @@ export default function createInstantSearchManager(param) {
|
||||
helper.derivedHelpers.slice().forEach(function(derivedHelper) {
|
||||
derivedHelper.detach();
|
||||
}), derivedParameters.forEach(function(param) {
|
||||
var indexId = param.indexId, parameters = param.parameters;
|
||||
helper.derive(function() {
|
||||
var indexId = param.indexId, parameters = param.parameters, derivedHelper = helper.derive(function() {
|
||||
return parameters;
|
||||
}).on("result", handleSearchSuccess({
|
||||
});
|
||||
derivedHelper.on("result", handleSearchSuccess({
|
||||
indexId: indexId
|
||||
})).on("error", handleSearchError);
|
||||
}), helper.setState(mainParameters), helper.search();
|
||||
|
@ -0,0 +1,15 @@
|
||||
function ItemsList() {
|
||||
var _ref;
|
||||
|
||||
var _temp, _this, _ret;
|
||||
|
||||
_classCallCheck(this, ItemsList);
|
||||
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ItemsList.__proto__ || Object.getPrototypeOf(ItemsList)).call.apply(_ref, [this].concat(args))), _this), _this.storeHighlightedItemReference = function (highlightedItem) {
|
||||
_this.props.onHighlightedItemChange(highlightedItem === null ? null : highlightedItem.item);
|
||||
}, _temp), _possibleConstructorReturn(_this, _ret);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
function ItemsList() {
|
||||
_classCallCheck(this, ItemsList);
|
||||
for(var _ref, _temp, _this, _ret, _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key];
|
||||
return _temp = _this = _possibleConstructorReturn(this, (_ref = ItemsList.__proto__ || Object.getPrototypeOf(ItemsList)).call.apply(_ref, [
|
||||
this
|
||||
].concat(args))), _this.storeHighlightedItemReference = function(highlightedItem) {
|
||||
_this.props.onHighlightedItemChange(null === highlightedItem ? null : highlightedItem.item);
|
||||
}, _ret = _temp, _possibleConstructorReturn(_this, _ret);
|
||||
}
|
@ -3,7 +3,7 @@ jQuery.extend = jQuery.fn.extend = function() {
|
||||
}, i = 1, length = arguments.length, deep = !1;
|
||||
for("boolean" == typeof target && (deep = target, target = arguments[1] || {
|
||||
}, i = 2), "object" == typeof target || jQuery.isFunction(target) || (target = {
|
||||
}), length === i && (target = this, --i); i < length; i++)if (null != (options = arguments[i])) for(name in options)src = target[name], target !== (copy = options[name]) && (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy))) ? (copyIsArray ? (copyIsArray = !1, clone = src && jQuery.isArray(src) ? src : []) : clone = src && jQuery.isPlainObject(src) ? src : {
|
||||
}), length === i && (target = this, --i); i < length; i++)if (null != (options = arguments[i])) for(name in options)src = target[name], copy = options[name], target !== copy && (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy))) ? (copyIsArray ? (copyIsArray = !1, clone = src && jQuery.isArray(src) ? src : []) : clone = src && jQuery.isPlainObject(src) ? src : {
|
||||
}, target[name] = jQuery.extend(deep, clone, copy)) : void 0 !== copy && (target[name] = copy));
|
||||
return target;
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ export const obj = {
|
||||
isFunction && (args[0] = value.call(this, index, table ? self.html() : void 0)), self.domManip(args, table, callback);
|
||||
});
|
||||
if (l && (first = (fragment = jQuery.buildFragment(args, this[0].ownerDocument, !1, this)).firstChild, 1 === fragment.childNodes.length && (fragment = first), first)) {
|
||||
for(table = table && jQuery.nodeName(first, "tr"), hasScripts = (scripts = jQuery.map(getAll(fragment, "script"), disableScript)).length; i < l; i++)node = fragment, i !== iNoClone && (node = jQuery.clone(node, !0, !0), hasScripts && jQuery.merge(scripts, getAll(node, "script"))), callback.call(table && jQuery.nodeName(this[i], "table") ? findOrAppend(this[i], "tbody") : this[i], node, i);
|
||||
for(table = table && jQuery.nodeName(first, "tr"), scripts = jQuery.map(getAll(fragment, "script"), disableScript), hasScripts = scripts.length; i < l; i++)node = fragment, i !== iNoClone && (node = jQuery.clone(node, !0, !0), hasScripts && jQuery.merge(scripts, getAll(node, "script"))), callback.call(table && jQuery.nodeName(this[i], "table") ? findOrAppend(this[i], "tbody") : this[i], node, i);
|
||||
if (hasScripts) for(doc = scripts[scripts.length - 1].ownerDocument, jQuery.map(scripts, restoreScript), i = 0; i < hasScripts; i++)node = scripts[i], rscriptType.test(node.type || "") && !jQuery._data(node, "globalEval") && jQuery.contains(doc, node) && (node.src ? jQuery.ajax({
|
||||
url: node.src,
|
||||
type: "GET",
|
||||
|
@ -37,7 +37,7 @@
|
||||
},
|
||||
1383: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4512), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7945), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(_Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6086), BrowserLoaded = (0, __webpack_require__(4652).default)((0, _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__.Z)(_Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee() {
|
||||
var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4512), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7945), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(_Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6086), next_dynamic__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4652), BrowserLoaded = (0, next_dynamic__WEBPACK_IMPORTED_MODULE_2__.default)((0, _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__.Z)(_Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee() {
|
||||
return _Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function(_context) {
|
||||
for(;;)switch(_context.prev = _context.next){
|
||||
case 0:
|
||||
|
@ -1,4 +1,9 @@
|
||||
function getSourceInfoErrorAddendumForProps(elementProps) {
|
||||
var source;
|
||||
return null != elementProps && void 0 !== (source = elementProps.__source) ? "\n\nCheck your code at " + source.fileName.replace(/^.*[\\\/]/, "") + ":" + source.lineNumber + "." : "";
|
||||
return null != elementProps ? (function(source) {
|
||||
if (void 0 !== source) {
|
||||
var fileName = source.fileName.replace(/^.*[\\\/]/, ""), lineNumber = source.lineNumber;
|
||||
return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
|
||||
}
|
||||
return "";
|
||||
})(elementProps.__source) : "";
|
||||
}
|
||||
|
@ -26,13 +26,13 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
||||
return 1;
|
||||
}
|
||||
var subtreeCount = 0, nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + SUBSEPARATOR;
|
||||
if (Array.isArray(children)) for(var i = 0; i < children.length; i++)subtreeCount += mapIntoArray(child, array, escapedPrefix, nextNamePrefix + getElementKey(child = children[i], i), callback);
|
||||
if (Array.isArray(children)) for(var i = 0; i < children.length; i++)nextName = nextNamePrefix + getElementKey(child = children[i], i), subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
||||
else {
|
||||
var iteratorFn = getIteratorFn(children);
|
||||
if ("function" == typeof iteratorFn) {
|
||||
var child, step, iterableChildren = children;
|
||||
var child, nextName, step, iterableChildren = children;
|
||||
iteratorFn === iterableChildren.entries && (didWarnAboutMaps || warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."), didWarnAboutMaps = !0);
|
||||
for(var iterator = iteratorFn.call(iterableChildren), ii = 0; !(step = iterator.next()).done;)subtreeCount += mapIntoArray(child, array, escapedPrefix, nextNamePrefix + getElementKey(child = step.value, ii++), callback);
|
||||
for(var iterator = iteratorFn.call(iterableChildren), ii = 0; !(step = iterator.next()).done;)nextName = nextNamePrefix + getElementKey(child = step.value, ii++), subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
||||
} else if ("object" === type) {
|
||||
var childrenString = "" + children;
|
||||
throw Error("Objects are not valid as a React child (found: " + ("[object Object]" === childrenString ? "object with keys {" + Object.keys(children).join(", ") + "}" : childrenString) + "). If you meant to render a collection of children, use an array instead.");
|
||||
|
@ -2,7 +2,7 @@ _.indexOf = function(array, item, isSorted) {
|
||||
if (null == array) return -1;
|
||||
var i = 0, length = array.length;
|
||||
if (isSorted) {
|
||||
if ("number" != typeof isSorted) return array[i = _.sortedIndex(array, item)] === item ? i : -1;
|
||||
if ("number" != typeof isSorted) return i = _.sortedIndex(array, item), array[i] === item ? i : -1;
|
||||
i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted;
|
||||
}
|
||||
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted);
|
||||
|
@ -2,7 +2,7 @@ _.indexOf = function(array, item, isSorted) {
|
||||
if (null == array) return -1;
|
||||
var i = 0, length = array.length;
|
||||
if (isSorted) {
|
||||
if ("number" != typeof isSorted) return array[i = _.sortedIndex(array, item)] === item ? i : -1;
|
||||
if ("number" != typeof isSorted) return i = _.sortedIndex(array, item), array[i] === item ? i : -1;
|
||||
i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted;
|
||||
}
|
||||
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted);
|
||||
|
@ -1,6 +1,6 @@
|
||||
export const E = {
|
||||
test: function(Y) {
|
||||
var DOCUMENT = Y.config.doc, useSVG = !Y.config.defaultGraphicEngine || "canvas" != Y.config.defaultGraphicEngine, canvas = DOCUMENT && DOCUMENT.createElement("canvas");
|
||||
return DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (useSVG || !canvas);
|
||||
var DOCUMENT = Y.config.doc, useSVG = !Y.config.defaultGraphicEngine || "canvas" != Y.config.defaultGraphicEngine, canvas = DOCUMENT && DOCUMENT.createElement("canvas"), svg = DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1");
|
||||
return svg && (useSVG || !canvas);
|
||||
}
|
||||
};
|
||||
|
28
ecmascript/minifier/tests/exec/vercel/001/input.js
Normal file
28
ecmascript/minifier/tests/exec/vercel/001/input.js
Normal file
@ -0,0 +1,28 @@
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
|
||||
function ItemsList() {
|
||||
var _ref;
|
||||
|
||||
var _temp, _this, _ret;
|
||||
|
||||
_classCallCheck(this, ItemsList);
|
||||
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ItemsList.__proto__ || Object.getPrototypeOf(ItemsList)).call.apply(_ref, [this].concat(args))), _this), _this.storeHighlightedItemReference = function (highlightedItem) {
|
||||
_this.props.onHighlightedItemChange(highlightedItem === null ? null : highlightedItem.item);
|
||||
}, _temp), _possibleConstructorReturn(_this, _ret);
|
||||
}
|
||||
|
||||
|
||||
new ItemsList();
|
||||
console.log('PASS')
|
43
ecmascript/minifier/tests/exec/vercel/002/input.js
Normal file
43
ecmascript/minifier/tests/exec/vercel/002/input.js
Normal file
@ -0,0 +1,43 @@
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function _classCallCheck(instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
}
|
||||
function _possibleConstructorReturn(self, call) {
|
||||
if (!self) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
}
|
||||
return call && ("object" == typeof call || "function" == typeof call) ? call : self;
|
||||
}
|
||||
function _inherits(subClass, superClass) {
|
||||
if ("function" != typeof superClass && null !== superClass) {
|
||||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
||||
}
|
||||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
||||
constructor: {
|
||||
value: subClass,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
||||
}
|
||||
function ItemsList() {
|
||||
_classCallCheck(this, ItemsList);
|
||||
for (var _ref, _temp, _this, _ret, _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ItemsList.__proto__ || Object.getPrototypeOf(ItemsList)).call.apply(_ref, [
|
||||
this
|
||||
].concat(args))), _this), _this.storeHighlightedItemReference = function (highlightedItem) {
|
||||
_this.props.onHighlightedItemChange(null === highlightedItem ? null : highlightedItem.item);
|
||||
}, _temp), _possibleConstructorReturn(_this, _ret);
|
||||
}
|
||||
new ItemsList();
|
||||
console.log("PASS");
|
4
ecmascript/minifier/tests/exec/vercel/config.json
Normal file
4
ecmascript/minifier/tests/exec/vercel/config.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"defaults": true,
|
||||
"toplevel": true
|
||||
}
|
@ -727,7 +727,7 @@
|
||||
arg.replace(FN_ARG, function(all, underscore, name) {
|
||||
$inject.push(name);
|
||||
});
|
||||
}), fn.$inject = $inject) : isArray(fn) ? (assertArgFn(fn[last = fn.length - 1], "fn"), $inject = fn.slice(0, last)) : assertArgFn(fn, "fn", !0), $inject;
|
||||
}), fn.$inject = $inject) : isArray(fn) ? (last = fn.length - 1, assertArgFn(fn[last], "fn"), $inject = fn.slice(0, last)) : assertArgFn(fn, "fn", !0), $inject;
|
||||
}
|
||||
function createInjector(modulesToLoad) {
|
||||
var INSTANTIATING = {
|
||||
@ -1135,7 +1135,7 @@
|
||||
return linkFnFound ? function(scope, nodeList, $rootElement, boundTranscludeFn) {
|
||||
var nodeLinkFn1, childLinkFn1, node, $node, childScope, childTranscludeFn, i1, ii, n, stableNodeList = [];
|
||||
for(i1 = 0, ii = nodeList.length; i1 < ii; i1++)stableNodeList.push(nodeList[i1]);
|
||||
for(i1 = 0, n = 0, ii = linkFns.length; i1 < ii; n++)node = stableNodeList[n], nodeLinkFn1 = linkFns[i1++], childLinkFn1 = linkFns[i1++], $node = jqLite(node), nodeLinkFn1 ? (nodeLinkFn1.scope ? (childScope = scope.$new(), $node.data("$scope", childScope), safeAddClass($node, "ng-scope")) : childScope = scope, nodeLinkFn1(childLinkFn1, childScope, node, $rootElement, (childTranscludeFn = nodeLinkFn1.transclude) || !boundTranscludeFn && transcludeFn ? createBoundTranscludeFn(scope, childTranscludeFn || transcludeFn) : boundTranscludeFn)) : childLinkFn1 && childLinkFn1(scope, node.childNodes, undefined, boundTranscludeFn);
|
||||
for(i1 = 0, n = 0, ii = linkFns.length; i1 < ii; n++)node = stableNodeList[n], nodeLinkFn1 = linkFns[i1++], childLinkFn1 = linkFns[i1++], $node = jqLite(node), nodeLinkFn1 ? (nodeLinkFn1.scope ? (childScope = scope.$new(), $node.data("$scope", childScope), safeAddClass($node, "ng-scope")) : childScope = scope, childTranscludeFn = nodeLinkFn1.transclude, nodeLinkFn1(childLinkFn1, childScope, node, $rootElement, childTranscludeFn || !boundTranscludeFn && transcludeFn ? createBoundTranscludeFn(scope, childTranscludeFn || transcludeFn) : boundTranscludeFn)) : childLinkFn1 && childLinkFn1(scope, node.childNodes, undefined, boundTranscludeFn);
|
||||
} : null;
|
||||
}
|
||||
function createBoundTranscludeFn(scope, transcludeFn) {
|
||||
@ -1153,7 +1153,11 @@
|
||||
addDirective(directives, directiveNormalize(nodeName_(node).toLowerCase()), "E", maxPriority, ignoreDirective);
|
||||
for(var attr, name, nName, ngAttrName, value, nAttrs = node.attributes, j = 0, jj = nAttrs && nAttrs.length; j < jj; j++){
|
||||
var attrStartName = !1, attrEndName = !1;
|
||||
attr = nAttrs[j], (!msie || msie >= 8 || attr.specified) && (ngAttrName = directiveNormalize(name = attr.name), NG_ATTR_BINDING.test(ngAttrName) && (name = snake_case(ngAttrName.substr(6), "-")), ngAttrName === ngAttrName.replace(/(Start|End)$/, "") + "Start" && (attrStartName = name, attrEndName = name.substr(0, name.length - 5) + "end", name = name.substr(0, name.length - 6)), attrsMap[nName = directiveNormalize(name.toLowerCase())] = name, attrs[nName] = value = trim(msie && "href" == name ? decodeURIComponent(node.getAttribute(name, 2)) : attr.value), getBooleanAttrName(node, nName) && (attrs[nName] = !0), addAttrInterpolateDirective(node, directives, value, nName), addDirective(directives, nName, "A", maxPriority, ignoreDirective, attrStartName, attrEndName));
|
||||
if (attr = nAttrs[j], !msie || msie >= 8 || attr.specified) {
|
||||
ngAttrName = directiveNormalize(name = attr.name), NG_ATTR_BINDING.test(ngAttrName) && (name = snake_case(ngAttrName.substr(6), "-"));
|
||||
var directiveNName = ngAttrName.replace(/(Start|End)$/, "");
|
||||
ngAttrName === directiveNName + "Start" && (attrStartName = name, attrEndName = name.substr(0, name.length - 5) + "end", name = name.substr(0, name.length - 6)), attrsMap[nName = directiveNormalize(name.toLowerCase())] = name, attrs[nName] = value = trim(msie && "href" == name ? decodeURIComponent(node.getAttribute(name, 2)) : attr.value), getBooleanAttrName(node, nName) && (attrs[nName] = !0), addAttrInterpolateDirective(node, directives, value, nName), addDirective(directives, nName, "A", maxPriority, ignoreDirective, attrStartName, attrEndName);
|
||||
}
|
||||
}
|
||||
if (isString(className = node.className) && "" !== className) for(; match = CLASS_DIRECTIVE_REGEXP.exec(className);)addDirective(directives, nName = directiveNormalize(match[2]), "C", maxPriority, ignoreDirective) && (attrs[nName] = trim(match[3])), className = className.substr(match.index + match[0].length);
|
||||
break;
|
||||
@ -1192,7 +1196,7 @@
|
||||
if ((directiveValue = directive.scope) && (newScopeDirective = newScopeDirective || directive, !directive.templateUrl && (assertNoDuplicate("new/isolated scope", newIsolateScopeDirective, directive, $compileNode), isObject(directiveValue) && (newIsolateScopeDirective = directive))), directiveName = directive.name, !directive.templateUrl && directive.controller && (directiveValue = directive.controller, assertNoDuplicate("'" + directiveName + "' controller", (controllerDirectives = controllerDirectives || {
|
||||
})[directiveName], directive, $compileNode), controllerDirectives[directiveName] = directive), (directiveValue = directive.transclude) && (hasTranscludeDirective = !0, directive.$$tlb || (assertNoDuplicate("transclusion", nonTlbTranscludeDirective, directive, $compileNode), nonTlbTranscludeDirective = directive), "element" == directiveValue ? (hasElementTranscludeDirective = !0, terminalPriority = directive.priority, $template = groupScan(compileNode, attrStart, attrEnd), compileNode = ($compileNode = templateAttrs.$$element = jqLite(document.createComment(" " + directiveName + ": " + templateAttrs[directiveName] + " ")))[0], replaceWith(jqCollection, jqLite(sliceArgs($template)), compileNode), childTranscludeFn = compile($template, transcludeFn, terminalPriority, replaceDirective && replaceDirective.name, {
|
||||
nonTlbTranscludeDirective: nonTlbTranscludeDirective
|
||||
})) : ($template = jqLite(jqLiteClone(compileNode)).contents(), $compileNode.empty(), childTranscludeFn = compile($template, transcludeFn))), directive.template) if (assertNoDuplicate("template", templateDirective, directive, $compileNode), templateDirective = directive, directiveValue = denormalizeTemplate(directiveValue = isFunction(directive.template) ? directive.template($compileNode, templateAttrs) : directive.template), directive.replace) {
|
||||
})) : ($template = jqLite(jqLiteClone(compileNode)).contents(), $compileNode.empty(), childTranscludeFn = compile($template, transcludeFn))), directive.template) if (assertNoDuplicate("template", templateDirective, directive, $compileNode), templateDirective = directive, directiveValue = isFunction(directive.template) ? directive.template($compileNode, templateAttrs) : directive.template, directiveValue = denormalizeTemplate(directiveValue), directive.replace) {
|
||||
if (replaceDirective = directive, compileNode = ($template = jqLite("<div>" + trim(directiveValue) + "</div>").contents())[0], 1 != $template.length || 1 !== compileNode.nodeType) throw $compileMinErr("tplrt", "Template for directive '{0}' must have exactly one root element. {1}", directiveName, "");
|
||||
replaceWith(jqCollection, $compileNode, compileNode);
|
||||
var newTemplateAttrs = {
|
||||
@ -1332,7 +1336,7 @@
|
||||
return $compileNode.empty(), $http.get($sce.getTrustedResourceUrl(templateUrl), {
|
||||
cache: $templateCache
|
||||
}).success(function(content) {
|
||||
var compileNode, tempTemplateAttrs, $template;
|
||||
var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;
|
||||
if (content = denormalizeTemplate(content), origAsyncDirective.replace) {
|
||||
if (compileNode = ($template = jqLite("<div>" + trim(content) + "</div>").contents())[0], 1 != $template.length || 1 !== compileNode.nodeType) throw $compileMinErr("tplrt", "Template for directive '{0}' must have exactly one root element. {1}", origAsyncDirective.name, templateUrl);
|
||||
tempTemplateAttrs = {
|
||||
@ -1346,7 +1350,7 @@
|
||||
node == compileNode && ($rootElement[i] = $compileNode[0]);
|
||||
}), afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn); linkQueue.length;){
|
||||
var scope = linkQueue.shift(), beforeTemplateLinkNode = linkQueue.shift(), linkRootElement = linkQueue.shift(), boundTranscludeFn = linkQueue.shift(), linkNode = $compileNode[0];
|
||||
beforeTemplateLinkNode !== beforeTemplateCompileNode && (linkNode = jqLiteClone(compileNode), replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode)), afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement, afterTemplateNodeLinkFn.transclude ? createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude) : boundTranscludeFn);
|
||||
beforeTemplateLinkNode !== beforeTemplateCompileNode && (linkNode = jqLiteClone(compileNode), replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode)), childBoundTranscludeFn = afterTemplateNodeLinkFn.transclude ? createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude) : boundTranscludeFn, afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement, childBoundTranscludeFn);
|
||||
}
|
||||
linkQueue = null;
|
||||
}).error(function(response, code, headers, config) {
|
||||
@ -2435,8 +2439,8 @@
|
||||
})), v = v.$$v), v;
|
||||
}, {
|
||||
assign: function(self, value, locals) {
|
||||
var key = indexFn(self, locals);
|
||||
return ensureSafeObject(obj(self, locals), parser.text)[key] = value;
|
||||
var key = indexFn(self, locals), safe = ensureSafeObject(obj(self, locals), parser.text);
|
||||
return safe[key] = value;
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -3983,13 +3987,13 @@
|
||||
$id: hashKey
|
||||
};
|
||||
if (!match) throw ngRepeatMinErr("iexp", "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.", expression);
|
||||
if (lhs = match[1], rhs = match[2], (trackByExp = match[4]) ? (trackByExpGetter = $parse(trackByExp), trackByIdExpFn = function(key, value, index) {
|
||||
if (lhs = match[1], rhs = match[2], trackByExp = match[4], trackByExp ? (trackByExpGetter = $parse(trackByExp), trackByIdExpFn = function(key, value, index) {
|
||||
return keyIdentifier && (hashFnLocals[keyIdentifier] = key), hashFnLocals[valueIdentifier] = value, hashFnLocals.$index = index, trackByExpGetter($scope, hashFnLocals);
|
||||
}) : (trackByIdArrayFn = function(key, value) {
|
||||
return hashKey(value);
|
||||
}, trackByIdObjFn = function(key) {
|
||||
return key;
|
||||
}), !(match = lhs.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/))) throw ngRepeatMinErr("iidexp", "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.", lhs);
|
||||
}), match = lhs.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/), !match) throw ngRepeatMinErr("iidexp", "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.", lhs);
|
||||
valueIdentifier = match[3] || match[1], keyIdentifier = match[2];
|
||||
var lastBlockMap = {
|
||||
};
|
||||
@ -4001,7 +4005,7 @@
|
||||
for(key in trackByIdFn = trackByIdExpFn || trackByIdObjFn, collectionKeys = [], collection)collection.hasOwnProperty(key) && "$" != key.charAt(0) && collectionKeys.push(key);
|
||||
collectionKeys.sort();
|
||||
}
|
||||
for(index = 0, arrayLength = collectionKeys.length, length = nextBlockOrder.length = collectionKeys.length; index < length; index++)if (assertNotHasOwnProperty(trackById = trackByIdFn(key, value = collection[key = collection === collectionKeys ? index : collectionKeys[index]], index), "`track by` id"), lastBlockMap.hasOwnProperty(trackById)) block = lastBlockMap[trackById], delete lastBlockMap[trackById], nextBlockMap[trackById] = block, nextBlockOrder[index] = block;
|
||||
for(index = 0, arrayLength = collectionKeys.length, length = nextBlockOrder.length = collectionKeys.length; index < length; index++)if (key = collection === collectionKeys ? index : collectionKeys[index], value = collection[key], trackById = trackByIdFn(key, value, index), assertNotHasOwnProperty(trackById, "`track by` id"), lastBlockMap.hasOwnProperty(trackById)) block = lastBlockMap[trackById], delete lastBlockMap[trackById], nextBlockMap[trackById] = block, nextBlockOrder[index] = block;
|
||||
else if (nextBlockMap.hasOwnProperty(trackById)) throw forEach(nextBlockOrder, function(block) {
|
||||
block && block.scope && (lastBlockMap[block.id] = block);
|
||||
}), ngRepeatMinErr("dupes", "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}", expression, trackById);
|
||||
@ -4012,7 +4016,7 @@
|
||||
element["$$NG_REMOVED"] = !0;
|
||||
}), block.scope.$destroy());
|
||||
for(index = 0, length = collectionKeys.length; index < length; index++){
|
||||
if (value = collection[key = collection === collectionKeys ? index : collectionKeys[index]], block = nextBlockOrder[index], nextBlockOrder[index - 1] && (previousNode = getBlockEnd(nextBlockOrder[index - 1])), block.scope) {
|
||||
if (key = collection === collectionKeys ? index : collectionKeys[index], value = collection[key], block = nextBlockOrder[index], nextBlockOrder[index - 1] && (previousNode = getBlockEnd(nextBlockOrder[index - 1])), block.scope) {
|
||||
childScope = block.scope, nextNode = previousNode;
|
||||
do nextNode = nextNode.nextSibling;
|
||||
while (nextNode && nextNode["$$NG_REMOVED"])
|
||||
|
@ -89,7 +89,7 @@
|
||||
}, i = 1, length = arguments.length, deep = !1;
|
||||
for("boolean" == typeof target && (deep = target, target = arguments[1] || {
|
||||
}, i = 2), "object" == typeof target || jQuery.isFunction(target) || (target = {
|
||||
}), length === i && (target = this, --i); i < length; i++)if (null != (options = arguments[i])) for(name in options)src = target[name], target !== (copy = options[name]) && (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy))) ? (copyIsArray ? (copyIsArray = !1, clone = src && jQuery.isArray(src) ? src : []) : clone = src && jQuery.isPlainObject(src) ? src : {
|
||||
}), length === i && (target = this, --i); i < length; i++)if (null != (options = arguments[i])) for(name in options)src = target[name], copy = options[name], target !== copy && (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy))) ? (copyIsArray ? (copyIsArray = !1, clone = src && jQuery.isArray(src) ? src : []) : clone = src && jQuery.isPlainObject(src) ? src : {
|
||||
}, target[name] = jQuery.extend(deep, clone, copy)) : copy !== undefined && (target[name] = copy));
|
||||
return target;
|
||||
}, jQuery.extend({
|
||||
@ -648,7 +648,7 @@
|
||||
return jQuery.isFunction(value) ? this.each(function(i) {
|
||||
jQuery(this).toggleClass(value.call(this, i, this.className, stateVal), stateVal);
|
||||
}) : this.each(function() {
|
||||
if ("string" === type) for(var className, i = 0, self = jQuery(this), state = stateVal, classNames = value.match(core_rnotwhite) || []; className = classNames[i++];)self[(state = isBool ? state : !self.hasClass(className)) ? "addClass" : "removeClass"](className);
|
||||
if ("string" === type) for(var className, i = 0, self = jQuery(this), state = stateVal, classNames = value.match(core_rnotwhite) || []; className = classNames[i++];)state = isBool ? state : !self.hasClass(className), self[state ? "addClass" : "removeClass"](className);
|
||||
else ("undefined" === type || "boolean" === type) && (this.className && jQuery._data(this, "__className__", this.className), this.className = this.className || !1 === value ? "" : jQuery._data(this, "__className__") || "");
|
||||
});
|
||||
},
|
||||
@ -1470,7 +1470,7 @@
|
||||
"",
|
||||
argument
|
||||
], Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches) {
|
||||
for(var idx, matched = fn(seed, argument), i = matched.length; i--;)seed[idx = indexOf.call(seed, matched[i])] = !(matches[idx] = matched[i]);
|
||||
for(var idx, matched = fn(seed, argument), i = matched.length; i--;)idx = indexOf.call(seed, matched[i]), seed[idx] = !(matches[idx] = matched[i]);
|
||||
}) : function(elem) {
|
||||
return fn(elem, 0, args);
|
||||
}) : fn;
|
||||
@ -2075,7 +2075,7 @@
|
||||
isFunction && (args[0] = value.call(this, index, table ? self.html() : undefined)), self.domManip(args, table, callback);
|
||||
});
|
||||
if (l && (first = (fragment = jQuery.buildFragment(args, this[0].ownerDocument, !1, this)).firstChild, 1 === fragment.childNodes.length && (fragment = first), first)) {
|
||||
for(table = table && jQuery.nodeName(first, "tr"), hasScripts = (scripts = jQuery.map(getAll(fragment, "script"), disableScript)).length; i < l; i++)node = fragment, i !== iNoClone && (node = jQuery.clone(node, !0, !0), hasScripts && jQuery.merge(scripts, getAll(node, "script"))), callback.call(table && jQuery.nodeName(this[i], "table") ? findOrAppend(this[i], "tbody") : this[i], node, i);
|
||||
for(table = table && jQuery.nodeName(first, "tr"), scripts = jQuery.map(getAll(fragment, "script"), disableScript), hasScripts = scripts.length; i < l; i++)node = fragment, i !== iNoClone && (node = jQuery.clone(node, !0, !0), hasScripts && jQuery.merge(scripts, getAll(node, "script"))), callback.call(table && jQuery.nodeName(this[i], "table") ? findOrAppend(this[i], "tbody") : this[i], node, i);
|
||||
if (hasScripts) for(doc = scripts[scripts.length - 1].ownerDocument, jQuery.map(scripts, restoreScript), i = 0; i < hasScripts; i++)node = scripts[i], rscriptType.test(node.type || "") && !jQuery._data(node, "globalEval") && jQuery.contains(doc, node) && (node.src ? jQuery.ajax({
|
||||
url: node.src,
|
||||
type: "GET",
|
||||
@ -2248,7 +2248,7 @@
|
||||
},
|
||||
css: function(elem, name, extra, styles) {
|
||||
var num, val, hooks, origName = jQuery.camelCase(name);
|
||||
return (name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(elem.style, origName)), (hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]) && "get" in hooks && (val = hooks.get(elem, !0, extra)), val === undefined && (val = curCSS(elem, name, styles)), "normal" === val && name in cssNormalTransform && (val = cssNormalTransform[name]), "" === extra || extra) ? (num = parseFloat(val), !0 === extra || jQuery.isNumeric(num) ? num || 0 : val) : val;
|
||||
return (name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(elem.style, origName)), hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName], hooks && "get" in hooks && (val = hooks.get(elem, !0, extra)), val === undefined && (val = curCSS(elem, name, styles)), "normal" === val && name in cssNormalTransform && (val = cssNormalTransform[name]), "" === extra || extra) ? (num = parseFloat(val), !0 === extra || jQuery.isNumeric(num) ? num || 0 : val) : val;
|
||||
},
|
||||
swap: function(elem, options, callback, args) {
|
||||
var ret, name, old = {
|
||||
@ -2617,7 +2617,7 @@
|
||||
state: "success",
|
||||
data: response
|
||||
};
|
||||
})(s, response)).state, success = isSuccess.data, isSuccess = !(error = isSuccess.error))) : (error = statusText, (status || !statusText) && (statusText = "error", status < 0 && (status = 0))), jqXHR.status = status, jqXHR.statusText = (nativeStatusText || statusText) + "", isSuccess ? deferred.resolveWith(callbackContext, [
|
||||
})(s, response)).state, success = isSuccess.data, error = isSuccess.error, isSuccess = !error)) : (error = statusText, (status || !statusText) && (statusText = "error", status < 0 && (status = 0))), jqXHR.status = status, jqXHR.statusText = (nativeStatusText || statusText) + "", isSuccess ? deferred.resolveWith(callbackContext, [
|
||||
success,
|
||||
statusText,
|
||||
jqXHR
|
||||
@ -2708,7 +2708,7 @@
|
||||
} catch (e) {
|
||||
}
|
||||
})();
|
||||
} : createStandardXHR, xhrSupported = jQuery.ajaxSettings.xhr(), jQuery.support.cors = !!xhrSupported && "withCredentials" in xhrSupported, (xhrSupported = jQuery.support.ajax = !!xhrSupported) && jQuery.ajaxTransport(function(s) {
|
||||
} : createStandardXHR, xhrSupported = jQuery.ajaxSettings.xhr(), jQuery.support.cors = !!xhrSupported && "withCredentials" in xhrSupported, xhrSupported = jQuery.support.ajax = !!xhrSupported, xhrSupported && jQuery.ajaxTransport(function(s) {
|
||||
if (!s.crossDomain || jQuery.support.cors) {
|
||||
var callback;
|
||||
return {
|
||||
@ -2777,7 +2777,7 @@
|
||||
"*": [function(prop, value) {
|
||||
var end, unit, tween = this.createTween(prop, value), parts = rfxnum.exec(value), target = tween.cur(), start = +target || 0, scale = 1, maxIterations = 20;
|
||||
if (parts) {
|
||||
if (end = +parts[2], "px" !== (unit = parts[3] || (jQuery.cssNumber[prop] ? "" : "px")) && start) {
|
||||
if (end = +parts[2], unit = parts[3] || (jQuery.cssNumber[prop] ? "" : "px"), "px" !== unit && start) {
|
||||
start = jQuery.css(tween.elem, prop, !0) || end || 1;
|
||||
do start /= scale = scale || ".5", jQuery.style(tween.elem, prop, start + unit);
|
||||
while (scale !== (scale = tween.cur() / target) && 1 !== scale && --maxIterations)
|
||||
@ -2846,7 +2846,7 @@
|
||||
}
|
||||
function propFilter(props, specialEasing) {
|
||||
var value, name, index, easing, hooks;
|
||||
for(index in props)if (easing = specialEasing[name = jQuery.camelCase(index)], value = props[index], jQuery.isArray(value) && (easing = value[1], value = props[index] = value[0]), index !== name && (props[name] = value, delete props[index]), (hooks = jQuery.cssHooks[name]) && "expand" in hooks) for(index in value = hooks.expand(value), delete props[name], value)index in props || (props[index] = value[index], specialEasing[index] = easing);
|
||||
for(index in props)if (easing = specialEasing[name = jQuery.camelCase(index)], value = props[index], jQuery.isArray(value) && (easing = value[1], value = props[index] = value[0]), index !== name && (props[name] = value, delete props[index]), hooks = jQuery.cssHooks[name], hooks && "expand" in hooks) for(index in value = hooks.expand(value), delete props[name], value)index in props || (props[index] = value[index], specialEasing[index] = easing);
|
||||
else specialEasing[name] = easing;
|
||||
}
|
||||
function Tween(elem, options, prop, end, easing) {
|
||||
|
@ -347,7 +347,7 @@
|
||||
_proto: $.extend({
|
||||
}, prototype),
|
||||
_childConstructors: []
|
||||
}), (basePrototype = new base()).options = $.widget.extend({
|
||||
}), basePrototype = new base(), basePrototype.options = $.widget.extend({
|
||||
}, basePrototype.options), $.each(prototype, function(prop, value) {
|
||||
if (!$.isFunction(value)) {
|
||||
proxiedPrototype[prop] = value;
|
||||
@ -609,7 +609,7 @@
|
||||
hash !== history_hash && (iframe_doc.title = doc1.title, iframe_doc.open(), domain && iframe_doc.write("<script>document.domain=\"" + domain + "\"</script>"), iframe_doc.close(), iframe.location.hash = hash);
|
||||
}), self;
|
||||
})();
|
||||
})(jQuery, this), $1 = jQuery, window.matchMedia = window.matchMedia || (refNode = (docElem = (doc = document).documentElement).firstElementChild || docElem.firstChild, fakeBody = doc.createElement("body"), (div = doc.createElement("div")).id = "mq-test-1", div.style.cssText = "position:absolute;top:-100em", fakeBody.style.background = "none", fakeBody.appendChild(div), function(q) {
|
||||
})(jQuery, this), $1 = jQuery, window.matchMedia = window.matchMedia || (refNode = (docElem = (doc = document).documentElement).firstElementChild || docElem.firstChild, fakeBody = doc.createElement("body"), div = doc.createElement("div"), div.id = "mq-test-1", div.style.cssText = "position:absolute;top:-100em", fakeBody.style.background = "none", fakeBody.appendChild(div), function(q) {
|
||||
return div.innerHTML = "­<style media=\"" + q + "\"> #mq-test-1 { width: 42px; }</style>", docElem.insertBefore(fakeBody, refNode), bool = 42 === div.offsetWidth, docElem.removeChild(fakeBody), {
|
||||
matches: bool,
|
||||
media: q
|
||||
@ -657,7 +657,7 @@
|
||||
return !!ret && "none" !== ret;
|
||||
}(),
|
||||
boxShadow: !!propExists("boxShadow") && !bb,
|
||||
fixedPosition: (w = window, ua = navigator.userAgent, platform = navigator.platform, wkversion = !!(wkmatch = ua.match(/AppleWebKit\/([0-9]+)/)) && wkmatch[1], ffversion = !!(ffmatch = ua.match(/Fennec\/([0-9]+)/)) && ffmatch[1], omversion = !!(operammobilematch = ua.match(/Opera Mobi\/([0-9]+)/)) && operammobilematch[1], !((platform.indexOf("iPhone") > -1 || platform.indexOf("iPad") > -1 || platform.indexOf("iPod") > -1) && wkversion && wkversion < 534 || w.operamini && "[object OperaMini]" === ({
|
||||
fixedPosition: (w = window, ua = navigator.userAgent, platform = navigator.platform, wkmatch = ua.match(/AppleWebKit\/([0-9]+)/), wkversion = !!wkmatch && wkmatch[1], ffmatch = ua.match(/Fennec\/([0-9]+)/), ffversion = !!ffmatch && ffmatch[1], operammobilematch = ua.match(/Opera Mobi\/([0-9]+)/), omversion = !!operammobilematch && operammobilematch[1], !((platform.indexOf("iPhone") > -1 || platform.indexOf("iPad") > -1 || platform.indexOf("iPod") > -1) && wkversion && wkversion < 534 || w.operamini && "[object OperaMini]" === ({
|
||||
}).toString.call(w.operamini) || operammobilematch && omversion < 7458 || ua.indexOf("Android") > -1 && wkversion && wkversion < 533 || ffversion && ffversion < 6 || "palmGetResource" in window && wkversion && wkversion < 534 || ua.indexOf("MeeGo") > -1 && ua.indexOf("NokiaBrowser/8.5.0") > -1)),
|
||||
scrollTop: ("pageXOffset" in window || "scrollTop" in document.documentElement || "scrollTop" in fakeBody1[0]) && !("palmGetResource" in window) && !operamini,
|
||||
dynamicBaseTag: (fauxBase = location.protocol + "//" + location.host + location.pathname + "ui-dir/", (base1 = $("head base")).length ? base1.attr("href") : base1 = $("<base>", {
|
||||
@ -781,8 +781,8 @@
|
||||
makeUrlAbsolute: function(relUrl, absUrl) {
|
||||
if (!path.isRelativeUrl(relUrl)) return relUrl;
|
||||
absUrl === undefined && (absUrl = this.documentBase);
|
||||
var relObj = path.parseUrl(relUrl), absObj = path.parseUrl(absUrl), protocol = relObj.protocol || absObj.protocol, doubleSlash = relObj.protocol ? relObj.doubleSlash : relObj.doubleSlash || absObj.doubleSlash, authority = relObj.authority || absObj.authority, hasPath = "" !== relObj.pathname;
|
||||
return protocol + doubleSlash + authority + path.makePathAbsolute(relObj.pathname || absObj.filename, absObj.pathname) + (relObj.search || !hasPath && absObj.search || "") + relObj.hash;
|
||||
var relObj = path.parseUrl(relUrl), absObj = path.parseUrl(absUrl), protocol = relObj.protocol || absObj.protocol, doubleSlash = relObj.protocol ? relObj.doubleSlash : relObj.doubleSlash || absObj.doubleSlash, authority = relObj.authority || absObj.authority, hasPath = "" !== relObj.pathname, pathname = path.makePathAbsolute(relObj.pathname || absObj.filename, absObj.pathname), search = relObj.search || !hasPath && absObj.search || "", hash = relObj.hash;
|
||||
return protocol + doubleSlash + authority + pathname + search + hash;
|
||||
},
|
||||
addSearchParams: function(url, params) {
|
||||
var u = path.parseUrl(url), p = "object" == typeof params ? $4.param(params) : params, s = u.search || "?";
|
||||
@ -829,7 +829,7 @@
|
||||
},
|
||||
squash: function(url, resolutionUrl) {
|
||||
var href, cleanedUrl, stateIndex, isPath = this.isPath(url), uri = this.parseUrl(url), preservedHash = uri.hash, uiState = "";
|
||||
return resolutionUrl = resolutionUrl || (path.isPath(url) ? path.getLocation() : path.getDocumentUrl()), cleanedUrl = isPath ? path.stripHash(url) : url, (stateIndex = (cleanedUrl = path.isPath(uri.hash) ? path.stripHash(uri.hash) : cleanedUrl).indexOf(this.uiStateKey)) > -1 && (uiState = cleanedUrl.slice(stateIndex), cleanedUrl = cleanedUrl.slice(0, stateIndex)), href = path.makeUrlAbsolute(cleanedUrl, resolutionUrl), this.parseUrl(href).search, isPath ? ((path.isPath(preservedHash) || 0 === preservedHash.replace("#", "").indexOf(this.uiStateKey)) && (preservedHash = ""), uiState && -1 === preservedHash.indexOf(this.uiStateKey) && (preservedHash += uiState), -1 === preservedHash.indexOf("#") && "" !== preservedHash && (preservedHash = "#" + preservedHash), href = (href = path.parseUrl(href)).protocol + "//" + href.host + href.pathname + this.parseUrl(href).search + preservedHash) : href += href.indexOf("#") > -1 ? uiState : "#" + uiState, href;
|
||||
return resolutionUrl = resolutionUrl || (path.isPath(url) ? path.getLocation() : path.getDocumentUrl()), cleanedUrl = isPath ? path.stripHash(url) : url, cleanedUrl = path.isPath(uri.hash) ? path.stripHash(uri.hash) : cleanedUrl, stateIndex = cleanedUrl.indexOf(this.uiStateKey), stateIndex > -1 && (uiState = cleanedUrl.slice(stateIndex), cleanedUrl = cleanedUrl.slice(0, stateIndex)), href = path.makeUrlAbsolute(cleanedUrl, resolutionUrl), this.parseUrl(href).search, isPath ? ((path.isPath(preservedHash) || 0 === preservedHash.replace("#", "").indexOf(this.uiStateKey)) && (preservedHash = ""), uiState && -1 === preservedHash.indexOf(this.uiStateKey) && (preservedHash += uiState), -1 === preservedHash.indexOf("#") && "" !== preservedHash && (preservedHash = "#" + preservedHash), href = (href = path.parseUrl(href)).protocol + "//" + href.host + href.pathname + this.parseUrl(href).search + preservedHash) : href += href.indexOf("#") > -1 ? uiState : "#" + uiState, href;
|
||||
},
|
||||
isPreservableHash: function(hash) {
|
||||
return 0 === hash.replace("#", "").indexOf(this.uiStateKey);
|
||||
@ -905,7 +905,7 @@
|
||||
},
|
||||
hash: function(url, href) {
|
||||
var parsed, loc, resolved;
|
||||
return parsed = path1.parseUrl(url), (loc = path1.parseLocation()).pathname + loc.search === parsed.pathname + parsed.search ? parsed.hash ? parsed.hash : parsed.pathname + parsed.search : path1.isPath(url) ? (resolved = path1.parseUrl(href)).pathname + resolved.search + (path1.isPreservableHash(resolved.hash) ? resolved.hash.replace("#", "") : "") : url;
|
||||
return parsed = path1.parseUrl(url), loc = path1.parseLocation(), loc.pathname + loc.search === parsed.pathname + parsed.search ? parsed.hash ? parsed.hash : parsed.pathname + parsed.search : path1.isPath(url) ? (resolved = path1.parseUrl(href)).pathname + resolved.search + (path1.isPreservableHash(resolved.hash) ? resolved.hash.replace("#", "") : "") : url;
|
||||
},
|
||||
go: function(url, data, noEvents) {
|
||||
var state, href, hash, popstateEvent, isPopStateEvent = $6.event.special.navigate.isPushStateEnabled();
|
||||
@ -1268,7 +1268,7 @@
|
||||
var orientation = get_orientation();
|
||||
orientation !== last_orientation && (last_orientation = orientation, win.trigger("orientationchange"));
|
||||
}
|
||||
$.support.orientation && (landscape_threshold = 50, initial_orientation_is_landscape = (ww = window.innerWidth || win.width()) > (wh = window.innerHeight || win.height()) && ww - wh > landscape_threshold, initial_orientation_is_default = portrait_map[window.orientation], (initial_orientation_is_landscape && initial_orientation_is_default || !initial_orientation_is_landscape && !initial_orientation_is_default) && (portrait_map = {
|
||||
$.support.orientation && (ww = window.innerWidth || win.width(), wh = window.innerHeight || win.height(), landscape_threshold = 50, initial_orientation_is_landscape = ww > wh && ww - wh > landscape_threshold, initial_orientation_is_default = portrait_map[window.orientation], (initial_orientation_is_landscape && initial_orientation_is_default || !initial_orientation_is_landscape && !initial_orientation_is_default) && (portrait_map = {
|
||||
"-90": !0,
|
||||
"90": !0
|
||||
})), $.event.special.orientationchange = $.extend({
|
||||
@ -1670,7 +1670,7 @@
|
||||
return;
|
||||
}
|
||||
if (this._triggerPageBeforeChange(toPage, triggerData, settings) && !((beforeTransition = this._triggerWithDeprecated("beforetransition", triggerData)).deprecatedEvent.isDefaultPrevented() || beforeTransition.event.isDefaultPrevented())) {
|
||||
if (isPageTransitioning = !0, toPage[0] !== $.mobile.firstPage[0] || settings.dataUrl || (settings.dataUrl = $.mobile.path.documentUrl.hrefNoHash), fromPage = settings.fromPage, pageUrl = url = settings.dataUrl && $.mobile.path.convertUrlToDataUrl(settings.dataUrl) || toPage.jqmData("url"), $.mobile.path.getFilePath(url), active = $.mobile.navigate.history.getActive(), activeIsInitialPage = 0 === $.mobile.navigate.history.activeIndex, historyDir = 0, pageTitle = document.title, isDialog = ("dialog" === settings.role || "dialog" === toPage.jqmData("role")) && !0 !== toPage.jqmData("dialog"), fromPage && fromPage[0] === toPage[0] && !settings.allowSamePageTransition) {
|
||||
if (isPageTransitioning = !0, toPage[0] !== $.mobile.firstPage[0] || settings.dataUrl || (settings.dataUrl = $.mobile.path.documentUrl.hrefNoHash), fromPage = settings.fromPage, url = settings.dataUrl && $.mobile.path.convertUrlToDataUrl(settings.dataUrl) || toPage.jqmData("url"), pageUrl = url, $.mobile.path.getFilePath(url), active = $.mobile.navigate.history.getActive(), activeIsInitialPage = 0 === $.mobile.navigate.history.activeIndex, historyDir = 0, pageTitle = document.title, isDialog = ("dialog" === settings.role || "dialog" === toPage.jqmData("role")) && !0 !== toPage.jqmData("dialog"), fromPage && fromPage[0] === toPage[0] && !settings.allowSamePageTransition) {
|
||||
isPageTransitioning = !1, this._triggerWithDeprecated("transition", triggerData), this.element.trigger("pagechange", triggerData), settings.fromHashChange && $.mobile.navigate.history.direct({
|
||||
url: url
|
||||
});
|
||||
@ -2245,9 +2245,9 @@
|
||||
_beforeListviewRefresh: $.noop,
|
||||
_afterListviewRefresh: $.noop,
|
||||
refresh: function(create) {
|
||||
var buttonClass, pos, numli, item, itemClass, itemTheme, itemIcon, icon, a, isDivider, startCount, newStartCount, value, last, splittheme, splitThemeClass, altButtonClass, li, o = this.options, $list = this.element, ol = !!$.nodeName($list[0], "ol"), start = $list.attr("start"), itemClassDict = {
|
||||
var buttonClass, pos, numli, item, itemClass, itemTheme, itemIcon, icon, a, isDivider, startCount, newStartCount, value, last, splittheme, splitThemeClass, spliticon, altButtonClass, li, o = this.options, $list = this.element, ol = !!$.nodeName($list[0], "ol"), start = $list.attr("start"), itemClassDict = {
|
||||
}, countBubbles = $list.find(".ui-li-count"), countTheme = getAttr($list[0], "counttheme") || this.options.countTheme, countThemeClass = countTheme ? "ui-body-" + countTheme : "ui-body-inherit";
|
||||
for(o.theme && $list.addClass("ui-group-theme-" + o.theme), ol && (start || 0 === start) && (startCount = parseInt(start, 10) - 1, $list.css("counter-reset", "listnumbering " + startCount)), this._beforeListviewRefresh(), pos = 0, numli = (li = this._getChildrenByTagName($list[0], "li", "LI")).length; pos < numli; pos++)item = li.eq(pos), itemClass = "", (create || 0 > item[0].className.search(/\bui-li-static\b|\bui-li-divider\b/)) && (a = this._getChildrenByTagName(item[0], "a", "A"), isDivider = "list-divider" === getAttr(item[0], "role"), value = item.attr("value"), itemTheme = getAttr(item[0], "theme"), a.length && 0 > a[0].className.search(/\bui-btn\b/) && !isDivider ? (icon = !1 !== (itemIcon = getAttr(item[0], "icon")) && (itemIcon || o.icon), a.removeClass("ui-link"), buttonClass = "ui-btn", itemTheme && (buttonClass += " ui-btn-" + itemTheme), a.length > 1 ? (itemClass = "ui-li-has-alt", splitThemeClass = (splittheme = getAttr((last = a.last())[0], "theme") || o.splitTheme || getAttr(item[0], "theme", !0)) ? " ui-btn-" + splittheme : "", altButtonClass = "ui-btn ui-btn-icon-notext ui-icon-" + (getAttr(last[0], "icon") || getAttr(item[0], "icon") || o.splitIcon) + splitThemeClass, last.attr("title", $.trim(last.getEncodedText())).addClass(altButtonClass).empty()) : icon && (buttonClass += " ui-btn-icon-right ui-icon-" + icon), a.first().addClass(buttonClass)) : isDivider ? (itemClass = "ui-li-divider ui-bar-" + (getAttr(item[0], "theme") || o.dividerTheme || o.theme || "inherit"), item.attr("role", "heading")) : a.length <= 0 && (itemClass = "ui-li-static ui-body-" + (itemTheme || "inherit")), ol && value && (newStartCount = parseInt(value, 10) - 1, item.css("counter-reset", "listnumbering " + newStartCount))), itemClassDict[itemClass] || (itemClassDict[itemClass] = []), itemClassDict[itemClass].push(item[0]);
|
||||
for(o.theme && $list.addClass("ui-group-theme-" + o.theme), ol && (start || 0 === start) && (startCount = parseInt(start, 10) - 1, $list.css("counter-reset", "listnumbering " + startCount)), this._beforeListviewRefresh(), pos = 0, numli = (li = this._getChildrenByTagName($list[0], "li", "LI")).length; pos < numli; pos++)item = li.eq(pos), itemClass = "", (create || 0 > item[0].className.search(/\bui-li-static\b|\bui-li-divider\b/)) && (a = this._getChildrenByTagName(item[0], "a", "A"), isDivider = "list-divider" === getAttr(item[0], "role"), value = item.attr("value"), itemTheme = getAttr(item[0], "theme"), a.length && 0 > a[0].className.search(/\bui-btn\b/) && !isDivider ? (icon = !1 !== (itemIcon = getAttr(item[0], "icon")) && (itemIcon || o.icon), a.removeClass("ui-link"), buttonClass = "ui-btn", itemTheme && (buttonClass += " ui-btn-" + itemTheme), a.length > 1 ? (itemClass = "ui-li-has-alt", splitThemeClass = (splittheme = getAttr((last = a.last())[0], "theme") || o.splitTheme || getAttr(item[0], "theme", !0)) ? " ui-btn-" + splittheme : "", spliticon = getAttr(last[0], "icon") || getAttr(item[0], "icon") || o.splitIcon, altButtonClass = "ui-btn ui-btn-icon-notext ui-icon-" + spliticon + splitThemeClass, last.attr("title", $.trim(last.getEncodedText())).addClass(altButtonClass).empty()) : icon && (buttonClass += " ui-btn-icon-right ui-icon-" + icon), a.first().addClass(buttonClass)) : isDivider ? (itemClass = "ui-li-divider ui-bar-" + (getAttr(item[0], "theme") || o.dividerTheme || o.theme || "inherit"), item.attr("role", "heading")) : a.length <= 0 && (itemClass = "ui-li-static ui-body-" + (itemTheme || "inherit")), ol && value && (newStartCount = parseInt(value, 10) - 1, item.css("counter-reset", "listnumbering " + newStartCount))), itemClassDict[itemClass] || (itemClassDict[itemClass] = []), itemClassDict[itemClass].push(item[0]);
|
||||
for(itemClass in itemClassDict)$(itemClassDict[itemClass]).addClass(itemClass);
|
||||
countBubbles.each(function() {
|
||||
$(this).closest("li").addClass("ui-li-has-count");
|
||||
@ -2565,7 +2565,7 @@
|
||||
for((origTabIndex = control.attr("tabindex")) && handle.attr("tabindex", origTabIndex), control.attr("tabindex", "-1").focus(function() {
|
||||
$(this).blur(), handle.focus();
|
||||
}), (wrapper = document.createElement("div")).className = "ui-slider-inneroffset", j = 0, length = domSlider.childNodes.length; j < length; j++)wrapper.appendChild(domSlider.childNodes[j]);
|
||||
for(domSlider.appendChild(wrapper), handle.addClass("ui-slider-handle-snapping"), i = 0, optionsCount = (options = control.find("option")).length; i < optionsCount; i++)side = i ? "a" : "b", activeClass = i ? " " + $.mobile.activeBtnClass : "", (sliderImg = document.createElement("span")).className = [
|
||||
for(domSlider.appendChild(wrapper), handle.addClass("ui-slider-handle-snapping"), i = 0, optionsCount = (options = control.find("option")).length; i < optionsCount; i++)side = i ? "a" : "b", activeClass = i ? " " + $.mobile.activeBtnClass : "", sliderImg = document.createElement("span"), sliderImg.className = [
|
||||
"ui-slider-label ui-slider-label-",
|
||||
side,
|
||||
activeClass
|
||||
@ -2673,7 +2673,7 @@
|
||||
if (data = val, tol = 8, left = this.slider.offset().left, pxStep = (width = this.slider.width()) / ((max - min) / step), !this.dragging || data.pageX < left - tol || data.pageX > left + width + tol) return;
|
||||
percent = pxStep > 1 ? (data.pageX - left) / width * 100 : Math.round((data.pageX - left) / width * 100);
|
||||
} else null == val && (val = isInput ? parseFloat(control.val() || 0) : control[0].selectedIndex), percent = (parseFloat(val) - min) / (max - min) * 100;
|
||||
if (!isNaN(percent) && (alignValue = newval - (valModStep = ((newval = percent / 100 * (max - min) + min) - min) % step), 2 * Math.abs(valModStep) >= step && (alignValue += valModStep > 0 ? step : -step), percentPerStep = 100 / ((max - min) / step), newval = parseFloat(alignValue.toFixed(5)), void 0 === pxStep && (pxStep = width / ((max - min) / step)), pxStep > 1 && isInput && (percent = (newval - min) * percentPerStep * (1 / step)), percent < 0 && (percent = 0), percent > 100 && (percent = 100), newval < min && (newval = min), newval > max && (newval = max), this.handle.css("left", percent + "%"), this.handle[0].setAttribute("aria-valuenow", isInput ? newval : optionElements.eq(newval).attr("value")), this.handle[0].setAttribute("aria-valuetext", isInput ? newval : optionElements.eq(newval).getEncodedText()), this.handle[0].setAttribute("title", isInput ? newval : optionElements.eq(newval).getEncodedText()), this.valuebg && this.valuebg.css("width", percent + "%"), this._labels && (handlePercent = this.handle.width() / this.slider.width() * 100, aPercent = percent && handlePercent + (100 - handlePercent) * percent / 100, bPercent = 100 === percent ? 0 : Math.min(handlePercent + 100 - aPercent, 100), this._labels.each(function() {
|
||||
if (!isNaN(percent) && (valModStep = ((newval = percent / 100 * (max - min) + min) - min) % step, alignValue = newval - valModStep, 2 * Math.abs(valModStep) >= step && (alignValue += valModStep > 0 ? step : -step), percentPerStep = 100 / ((max - min) / step), newval = parseFloat(alignValue.toFixed(5)), void 0 === pxStep && (pxStep = width / ((max - min) / step)), pxStep > 1 && isInput && (percent = (newval - min) * percentPerStep * (1 / step)), percent < 0 && (percent = 0), percent > 100 && (percent = 100), newval < min && (newval = min), newval > max && (newval = max), this.handle.css("left", percent + "%"), this.handle[0].setAttribute("aria-valuenow", isInput ? newval : optionElements.eq(newval).attr("value")), this.handle[0].setAttribute("aria-valuetext", isInput ? newval : optionElements.eq(newval).getEncodedText()), this.handle[0].setAttribute("title", isInput ? newval : optionElements.eq(newval).getEncodedText()), this.valuebg && this.valuebg.css("width", percent + "%"), this._labels && (handlePercent = this.handle.width() / this.slider.width() * 100, aPercent = percent && handlePercent + (100 - handlePercent) * percent / 100, bPercent = 100 === percent ? 0 : Math.min(handlePercent + 100 - aPercent, 100), this._labels.each(function() {
|
||||
var ab = $(this).hasClass("ui-slider-label-a");
|
||||
$(this).width((ab ? aPercent : bPercent) + "%");
|
||||
})), !preventInputUpdate)) {
|
||||
@ -3021,12 +3021,12 @@
|
||||
this._prepareHeightUpdate(this.options.keyupTimeoutBuffer);
|
||||
},
|
||||
_updateHeight: function() {
|
||||
var borderHeight, height, scrollTop = this.window.scrollTop();
|
||||
var paddingTop, paddingBottom, paddingHeight, borderTop, borderBottom, borderHeight, height, scrollTop = this.window.scrollTop();
|
||||
this.keyupTimeout = 0, "onpage" in this.element[0] || this.element.css({
|
||||
height: 0,
|
||||
"min-height": 0,
|
||||
"max-height": 0
|
||||
}), this.element[0].scrollHeight, this.element[0].clientHeight, borderHeight = parseFloat(this.element.css("border-top-width")) + parseFloat(this.element.css("border-bottom-width")), height = this.element[0].scrollHeight + borderHeight + 15, 0 === this.element[0].clientHeight && (height += parseFloat(this.element.css("padding-top")) + parseFloat(this.element.css("padding-bottom"))), this.element.css({
|
||||
}), this.element[0].scrollHeight, this.element[0].clientHeight, borderTop = parseFloat(this.element.css("border-top-width")), borderBottom = parseFloat(this.element.css("border-bottom-width")), borderHeight = borderTop + borderBottom, height = this.element[0].scrollHeight + borderHeight + 15, 0 === this.element[0].clientHeight && (paddingTop = parseFloat(this.element.css("padding-top")), paddingBottom = parseFloat(this.element.css("padding-bottom")), paddingHeight = paddingTop + paddingBottom, height += paddingHeight), this.element.css({
|
||||
height: height,
|
||||
"min-height": "",
|
||||
"max-height": ""
|
||||
@ -3390,7 +3390,7 @@
|
||||
},
|
||||
_open: function(options) {
|
||||
var ua, wkmatch, wkversion, androidmatch, andversion, chromematch, openOptions = $.extend({
|
||||
}, this.options, options), androidBlacklist = (wkversion = !!(wkmatch = (ua = navigator.userAgent).match(/AppleWebKit\/([0-9\.]+)/)) && wkmatch[1], andversion = !!(androidmatch = ua.match(/Android (\d+(?:\.\d+))/)) && androidmatch[1], chromematch = ua.indexOf("Chrome") > -1, null !== androidmatch && "4.0" === andversion && !!wkversion && wkversion > 534.13 && !chromematch);
|
||||
}, this.options, options), androidBlacklist = (wkversion = !!(wkmatch = (ua = navigator.userAgent).match(/AppleWebKit\/([0-9\.]+)/)) && wkmatch[1], androidmatch = ua.match(/Android (\d+(?:\.\d+))/), andversion = !!androidmatch && androidmatch[1], chromematch = ua.indexOf("Chrome") > -1, null !== androidmatch && "4.0" === andversion && !!wkversion && wkversion > 534.13 && !chromematch);
|
||||
this._createPrerequisites($.noop, $.noop, $.proxy(this, "_openPrerequisitesComplete")), this._currentTransition = openOptions.transition, this._applyTransition(openOptions.transition), this._ui.screen.removeClass("ui-screen-hidden"), this._ui.container.removeClass("ui-popup-truncate"), this._reposition(openOptions), this._ui.container.removeClass("ui-popup-hidden"), this.options.overlayTheme && androidBlacklist && this.element.closest(".ui-page").addClass("ui-popup-open"), this._animate({
|
||||
additionalCondition: !0,
|
||||
transition: openOptions.transition,
|
||||
@ -3442,7 +3442,7 @@
|
||||
},
|
||||
open: function(options) {
|
||||
var url, hashkey, activePage, currentIsDialog, urlHistory, self = this, currentOptions = this.options;
|
||||
return $.mobile.popup.active || currentOptions.disabled ? this : ($.mobile.popup.active = this, this._scrollTop = this.window.scrollTop(), currentOptions.history) ? (urlHistory = $.mobile.navigate.history, hashkey = $.mobile.dialogHashKey, currentIsDialog = !!(activePage = $.mobile.activePage) && activePage.hasClass("ui-dialog"), this._myUrl = url = urlHistory.getActive().url, url.indexOf(hashkey) > -1 && !currentIsDialog && urlHistory.activeIndex > 0) ? (self._open(options), self._bindContainerClose(), this) : (-1 !== url.indexOf(hashkey) || currentIsDialog ? url = $.mobile.path.parseLocation().hash + hashkey : url += url.indexOf("#") > -1 ? hashkey : "#" + hashkey, 0 === urlHistory.activeIndex && url === urlHistory.initialDst && (url += hashkey), this.window.one("beforenavigate", function(theEvent) {
|
||||
return $.mobile.popup.active || currentOptions.disabled ? this : ($.mobile.popup.active = this, this._scrollTop = this.window.scrollTop(), currentOptions.history) ? (urlHistory = $.mobile.navigate.history, hashkey = $.mobile.dialogHashKey, activePage = $.mobile.activePage, currentIsDialog = !!activePage && activePage.hasClass("ui-dialog"), this._myUrl = url = urlHistory.getActive().url, url.indexOf(hashkey) > -1 && !currentIsDialog && urlHistory.activeIndex > 0) ? (self._open(options), self._bindContainerClose(), this) : (-1 !== url.indexOf(hashkey) || currentIsDialog ? url = $.mobile.path.parseLocation().hash + hashkey : url += url.indexOf("#") > -1 ? hashkey : "#" + hashkey, 0 === urlHistory.activeIndex && url === urlHistory.initialDst && (url += hashkey), this.window.one("beforenavigate", function(theEvent) {
|
||||
theEvent.preventDefault(), self._open(options), self._bindContainerClose();
|
||||
}), this.urlAltered = !0, $.mobile.navigate(url, {
|
||||
role: "dialog"
|
||||
@ -3515,7 +3515,7 @@
|
||||
},
|
||||
build: function() {
|
||||
var selectId, popupId, dialogId, label, thisPage, isMultiple, menuId, themeAttr, overlayTheme, overlayThemeAttr, dividerThemeAttr, menuPage, listbox, list, header, headerTitle, menuPageContent, menuPageClose, headerClose, self, o = this.options;
|
||||
return o.nativeMenu ? this._super() : (self = this, popupId = (selectId = this.selectId) + "-listbox", dialogId = selectId + "-dialog", label = this.label, thisPage = this.element.closest(".ui-page"), isMultiple = this.element[0].multiple, menuId = selectId + "-menu", themeAttr = o.theme ? " data-" + $.mobile.ns + "theme='" + o.theme + "'" : "", overlayThemeAttr = (overlayTheme = o.overlayTheme || o.theme || null) ? " data-" + $.mobile.ns + "overlay-theme='" + overlayTheme + "'" : "", dividerThemeAttr = o.dividerTheme && isMultiple ? " data-" + $.mobile.ns + "divider-theme='" + o.dividerTheme + "'" : "", menuPage = $("<div data-" + $.mobile.ns + "role='dialog' class='ui-selectmenu' id='" + dialogId + "'" + themeAttr + overlayThemeAttr + "><div data-" + $.mobile.ns + "role='header'><div class='ui-title'>" + label.getEncodedText() + "</div></div><div data-" + $.mobile.ns + "role='content'></div></div>"), listbox = $("<div id='" + popupId + "' class='ui-selectmenu'></div>").insertAfter(this.select).popup({
|
||||
return o.nativeMenu ? this._super() : (self = this, popupId = (selectId = this.selectId) + "-listbox", dialogId = selectId + "-dialog", label = this.label, thisPage = this.element.closest(".ui-page"), isMultiple = this.element[0].multiple, menuId = selectId + "-menu", themeAttr = o.theme ? " data-" + $.mobile.ns + "theme='" + o.theme + "'" : "", overlayTheme = o.overlayTheme || o.theme || null, overlayThemeAttr = overlayTheme ? " data-" + $.mobile.ns + "overlay-theme='" + overlayTheme + "'" : "", dividerThemeAttr = o.dividerTheme && isMultiple ? " data-" + $.mobile.ns + "divider-theme='" + o.dividerTheme + "'" : "", menuPage = $("<div data-" + $.mobile.ns + "role='dialog' class='ui-selectmenu' id='" + dialogId + "'" + themeAttr + overlayThemeAttr + "><div data-" + $.mobile.ns + "role='header'><div class='ui-title'>" + label.getEncodedText() + "</div></div><div data-" + $.mobile.ns + "role='content'></div></div>"), listbox = $("<div id='" + popupId + "' class='ui-selectmenu'></div>").insertAfter(this.select).popup({
|
||||
theme: o.overlayTheme
|
||||
}), list = $("<ul class='ui-selectmenu-list' id='" + menuId + "' role='listbox' aria-labelledby='" + this.buttonId + "'" + themeAttr + dividerThemeAttr + "></ul>").appendTo(listbox), header = $("<div class='ui-header ui-bar-" + (o.theme ? o.theme : "inherit") + "'></div>").prependTo(listbox), headerTitle = $("<h1 class='ui-title'></h1>").appendTo(header), this.isMultiple && (headerClose = $("<a>", {
|
||||
role: "button",
|
||||
@ -3954,7 +3954,7 @@
|
||||
return this.options.arrow && (this._ui.arrow = this._addArrow()), ret;
|
||||
},
|
||||
_addArrow: function() {
|
||||
var clone, gd, ct, ar, theme, opts = this.options, ar1 = (gd = (clone = uiTemplate.clone()).eq(0), ar = (ct = clone.eq(1)).children(), {
|
||||
var clone, gd, ct, ar, theme, opts = this.options, ar1 = (gd = (clone = uiTemplate.clone()).eq(0), ct = clone.eq(1), ar = ct.children(), {
|
||||
arEls: ct.add(gd),
|
||||
gd: gd,
|
||||
ct: ct,
|
||||
@ -4672,7 +4672,7 @@
|
||||
tabIndex: -1
|
||||
}), this.panels = $(), this.anchors.each(function(i, anchor) {
|
||||
var selector, panel, panelId, anchorId = $(anchor).uniqueId().attr("id"), tab = $(anchor).closest("li"), originalAriaControls = tab.attr("aria-controls");
|
||||
isLocal(anchor) ? (selector = anchor.hash, panel = that.element.find(that._sanitizeSelector(selector))) : (selector = "#" + (panelId = that._tabId(tab)), (panel = that.element.find(selector)).length || (panel = that._createPanel(panelId)).insertAfter(that.panels[i - 1] || that.tablist), panel.attr("aria-live", "polite")), panel.length && (that.panels = that.panels.add(panel)), originalAriaControls && tab.data("ui-tabs-aria-controls", originalAriaControls), tab.attr({
|
||||
isLocal(anchor) ? (selector = anchor.hash, panel = that.element.find(that._sanitizeSelector(selector))) : (selector = "#" + (panelId = that._tabId(tab)), panel = that.element.find(selector), panel.length || (panel = that._createPanel(panelId)).insertAfter(that.panels[i - 1] || that.tablist), panel.attr("aria-live", "polite")), panel.length && (that.panels = that.panels.add(panel)), originalAriaControls && tab.data("ui-tabs-aria-controls", originalAriaControls), tab.attr({
|
||||
"aria-controls": selector.substring(1),
|
||||
"aria-labelledby": anchorId
|
||||
}), panel.attr("aria-labelledby", anchorId);
|
||||
|
@ -516,7 +516,7 @@ String.implement({
|
||||
return Math.min(max, Math.max(min, this));
|
||||
},
|
||||
round: function(precision) {
|
||||
return Math.round(this * (precision = Math.pow(10, precision || 0).toFixed(precision < 0 ? -precision : 0))) / precision;
|
||||
return precision = Math.pow(10, precision || 0).toFixed(precision < 0 ? -precision : 0), Math.round(this * precision) / precision;
|
||||
},
|
||||
times: function(fn, bind) {
|
||||
for(var i = 0; i < this; i++)fn.call(bind, i, this);
|
||||
|
@ -156,7 +156,7 @@
|
||||
case REACT_PROVIDER_TYPE:
|
||||
return getContextName(type._context) + ".Provider";
|
||||
case REACT_FORWARD_REF_TYPE:
|
||||
return outerType = type, wrapperName = "ForwardRef", functionName = (innerType = type.render).displayName || innerType.name || "", outerType.displayName || ("" !== functionName ? wrapperName + "(" + functionName + ")" : wrapperName);
|
||||
return outerType = type, innerType = type.render, wrapperName = "ForwardRef", functionName = innerType.displayName || innerType.name || "", outerType.displayName || ("" !== functionName ? wrapperName + "(" + functionName + ")" : wrapperName);
|
||||
case REACT_MEMO_TYPE:
|
||||
return getComponentName(type.type);
|
||||
case REACT_BLOCK_TYPE:
|
||||
@ -316,13 +316,13 @@
|
||||
return 1;
|
||||
}
|
||||
var subtreeCount = 0, nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
|
||||
if (Array.isArray(children)) for(var i = 0; i < children.length; i++)subtreeCount += mapIntoArray(child, array, escapedPrefix, nextNamePrefix + getElementKey(child = children[i], i), callback);
|
||||
if (Array.isArray(children)) for(var i = 0; i < children.length; i++)nextName = nextNamePrefix + getElementKey(child = children[i], i), subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
||||
else {
|
||||
var iteratorFn = getIteratorFn(children);
|
||||
if ("function" == typeof iteratorFn) {
|
||||
var child, step, iterableChildren = children;
|
||||
var child, nextName, step, iterableChildren = children;
|
||||
iteratorFn === iterableChildren.entries && (didWarnAboutMaps || warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."), didWarnAboutMaps = !0);
|
||||
for(var iterator = iteratorFn.call(iterableChildren), ii = 0; !(step = iterator.next()).done;)subtreeCount += mapIntoArray(child, array, escapedPrefix, nextNamePrefix + getElementKey(child = step.value, ii++), callback);
|
||||
for(var iterator = iteratorFn.call(iterableChildren), ii = 0; !(step = iterator.next()).done;)nextName = nextNamePrefix + getElementKey(child = step.value, ii++), subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
||||
} else if ("object" === type) {
|
||||
var childrenString = "" + children;
|
||||
throw Error("Objects are not valid as a React child (found: " + ("[object Object]" === childrenString ? "object with keys {" + Object.keys(children).join(", ") + "}" : childrenString) + "). If you meant to render a collection of children, use an array instead.");
|
||||
@ -619,7 +619,13 @@
|
||||
if (!validType) {
|
||||
var typeString, info = "";
|
||||
(void 0 === type || "object" == typeof type && null !== type && 0 === Object.keys(type).length) && (info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
||||
var source, elementProps, sourceInfo = null != (elementProps = props) && void 0 !== (source = elementProps.__source) ? "\n\nCheck your code at " + source.fileName.replace(/^.*[\\\/]/, "") + ":" + source.lineNumber + "." : "";
|
||||
var elementProps, sourceInfo = null != (elementProps = props) ? function(source) {
|
||||
if (void 0 !== source) {
|
||||
var fileName = source.fileName.replace(/^.*[\\\/]/, ""), lineNumber = source.lineNumber;
|
||||
return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
|
||||
}
|
||||
return "";
|
||||
}(elementProps.__source) : "";
|
||||
sourceInfo ? info += sourceInfo : info += getDeclarationErrorAddendum(), null === type ? typeString = "null" : Array.isArray(type) ? typeString = "array" : void 0 !== type && type.$$typeof === REACT_ELEMENT_TYPE ? (typeString = "<" + (getComponentName(type.type) || "Unknown") + " />", info = " Did you accidentally export a JSX literal instead of a component?") : typeString = typeof type, error("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
|
||||
}
|
||||
var element = createElement.apply(this, arguments);
|
||||
@ -774,7 +780,7 @@
|
||||
var callback = currentTask.callback;
|
||||
if ("function" == typeof callback) {
|
||||
currentTask.callback = null, currentPriorityLevel = currentTask.priorityLevel;
|
||||
var continuationCallback = callback(currentTask.expirationTime <= currentTime);
|
||||
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime, continuationCallback = callback(didUserCallbackTimeout);
|
||||
currentTime = getCurrentTime(), "function" == typeof continuationCallback ? currentTask.callback = continuationCallback : currentTask === peek(taskQueue) && pop(taskQueue), advanceTimers(currentTime);
|
||||
} else pop(taskQueue);
|
||||
currentTask = peek(taskQueue);
|
||||
|
File diff suppressed because one or more lines are too long
@ -221,7 +221,7 @@
|
||||
if (null == array) return -1;
|
||||
var i = 0, length = array.length;
|
||||
if (isSorted) {
|
||||
if ("number" != typeof isSorted) return array[i = _.sortedIndex(array, item)] === item ? i : -1;
|
||||
if ("number" != typeof isSorted) return i = _.sortedIndex(array, item), array[i] === item ? i : -1;
|
||||
i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted;
|
||||
}
|
||||
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted);
|
||||
|
@ -1130,15 +1130,15 @@ var YUI = function() {
|
||||
}), add("load", "8", {
|
||||
name: "graphics-svg",
|
||||
test: function(Y) {
|
||||
var DOCUMENT = Y.config.doc, useSVG = !Y.config.defaultGraphicEngine || "canvas" != Y.config.defaultGraphicEngine, canvas = DOCUMENT && DOCUMENT.createElement("canvas");
|
||||
return DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (useSVG || !canvas);
|
||||
var DOCUMENT = Y.config.doc, useSVG = !Y.config.defaultGraphicEngine || "canvas" != Y.config.defaultGraphicEngine, canvas = DOCUMENT && DOCUMENT.createElement("canvas"), svg = DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1");
|
||||
return svg && (useSVG || !canvas);
|
||||
},
|
||||
trigger: "graphics"
|
||||
}), add("load", "9", {
|
||||
name: "graphics-svg-default",
|
||||
test: function(Y) {
|
||||
var DOCUMENT = Y.config.doc, useSVG = !Y.config.defaultGraphicEngine || "canvas" != Y.config.defaultGraphicEngine, canvas = DOCUMENT && DOCUMENT.createElement("canvas");
|
||||
return DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (useSVG || !canvas);
|
||||
var DOCUMENT = Y.config.doc, useSVG = !Y.config.defaultGraphicEngine || "canvas" != Y.config.defaultGraphicEngine, canvas = DOCUMENT && DOCUMENT.createElement("canvas"), svg = DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1");
|
||||
return svg && (useSVG || !canvas);
|
||||
},
|
||||
trigger: "graphics"
|
||||
}), add("load", "10", {
|
||||
@ -1265,8 +1265,8 @@ var YUI = function() {
|
||||
error: 8
|
||||
};
|
||||
INSTANCE.log = function(msg, cat, src, silent) {
|
||||
var bail, excl, incl, m, minlevel, Y1 = INSTANCE, c = Y1.config, publisher = Y1.fire ? Y1 : YUI.Env.globalEvents;
|
||||
return c.debug && (void 0 !== (src = src || "") && (excl = c.logExclude, !(incl = c.logInclude) || src in incl ? incl && src in incl ? bail = !incl[src] : excl && src in excl && (bail = excl[src]) : bail = 1, Y1.config.logLevel = Y1.config.logLevel || "debug", minlevel = LEVELS[Y1.config.logLevel.toLowerCase()], cat in LEVELS && LEVELS[cat] < minlevel && (bail = 1)), bail || (c.useBrowserConsole && (m = src ? src + ": " + msg : msg, Y1.Lang.isFunction(c.logFn) ? c.logFn.call(Y1, msg, cat, src) : "undefined" != typeof console && console.log ? console[cat && console[cat] && cat in LEVELS ? cat : "log"](m) : "undefined" != typeof opera && opera.postError(m)), publisher && !silent && (publisher !== Y1 || publisher.getEvent("yui:log") || publisher.publish("yui:log", {
|
||||
var bail, excl, incl, m, f, minlevel, Y1 = INSTANCE, c = Y1.config, publisher = Y1.fire ? Y1 : YUI.Env.globalEvents;
|
||||
return c.debug && (void 0 !== (src = src || "") && (excl = c.logExclude, incl = c.logInclude, !incl || src in incl ? incl && src in incl ? bail = !incl[src] : excl && src in excl && (bail = excl[src]) : bail = 1, Y1.config.logLevel = Y1.config.logLevel || "debug", minlevel = LEVELS[Y1.config.logLevel.toLowerCase()], cat in LEVELS && LEVELS[cat] < minlevel && (bail = 1)), bail || (c.useBrowserConsole && (m = src ? src + ": " + msg : msg, Y1.Lang.isFunction(c.logFn) ? c.logFn.call(Y1, msg, cat, src) : "undefined" != typeof console && console.log ? (f = cat && console[cat] && cat in LEVELS ? cat : "log", console[f](m)) : "undefined" != typeof opera && opera.postError(m)), publisher && !silent && (publisher !== Y1 || publisher.getEvent("yui:log") || publisher.publish("yui:log", {
|
||||
broadcast: 2
|
||||
}), publisher.fire("yui:log", {
|
||||
msg: msg,
|
||||
@ -1301,7 +1301,7 @@ var YUI = function() {
|
||||
]
|
||||
}), YUI.add("loader-base", function(Y, NAME) {
|
||||
var VERSION, CDN_BASE, COMBO_BASE, META, groups, yui2Update, galleryUpdate;
|
||||
VERSION = Y.version, COMBO_BASE = (CDN_BASE = Y.Env.base) + "combo?", groups = (META = {
|
||||
VERSION = Y.version, CDN_BASE = Y.Env.base, COMBO_BASE = CDN_BASE + "combo?", META = {
|
||||
version: VERSION,
|
||||
root: VERSION + "/",
|
||||
base: Y.Env.base,
|
||||
@ -1323,7 +1323,7 @@ var YUI = function() {
|
||||
},
|
||||
patterns: {
|
||||
}
|
||||
}).groups, yui2Update = function(tnt, yui2, config) {
|
||||
}, groups = META.groups, yui2Update = function(tnt, yui2, config) {
|
||||
var root = "2in3." + (tnt || "4") + "/" + (yui2 || "2.9.0") + "/build/", base = config && config.base ? config.base : CDN_BASE, combo = config && config.comboBase ? config.comboBase : COMBO_BASE;
|
||||
groups.yui2.base = base + root, groups.yui2.root = root, groups.yui2.comboBase = combo;
|
||||
}, galleryUpdate = function(tag, config) {
|
||||
@ -1419,7 +1419,7 @@ var YUI = function() {
|
||||
_requires: function(mod1, mod2) {
|
||||
var i, rm, after_map, s, info = this.moduleInfo, m = info[mod1], other = info[mod2];
|
||||
if (!m || !other) return !1;
|
||||
if (rm = m.expanded_map, (after_map = m.after_map) && mod2 in after_map) return !0;
|
||||
if (rm = m.expanded_map, after_map = m.after_map, after_map && mod2 in after_map) return !0;
|
||||
if ((after_map = other.after_map) && mod1 in after_map) return !1;
|
||||
if (s = info[mod2] && info[mod2].supersedes) {
|
||||
for(i = 0; i < s.length; i++)if (this._requires(mod1, s[i])) return !0;
|
||||
@ -1815,10 +1815,10 @@ var YUI = function() {
|
||||
jsMods: [],
|
||||
css: [],
|
||||
cssMods: []
|
||||
}, url = j, len = (mods = comboSources[j]).length)) for(i = 0; i < len; i++)!inserted[mods[i]] && ((m = mods[i]) && (m.combine || !m.ext) ? (resCombos[j].comboSep = m.comboSep, resCombos[j].group = m.group, resCombos[j].maxURLLength = m.maxURLLength, frag = (L.isValue(m.root) ? m.root : self.root) + (m.path || m.fullpath), frag = self._filter(frag, m.name), resCombos[j][m.type].push(frag), resCombos[j][m.type + "Mods"].push(m)) : mods[i] && addSingle(mods[i]));
|
||||
}, url = j, mods = comboSources[j], len = mods.length)) for(i = 0; i < len; i++)!inserted[mods[i]] && ((m = mods[i]) && (m.combine || !m.ext) ? (resCombos[j].comboSep = m.comboSep, resCombos[j].group = m.group, resCombos[j].maxURLLength = m.maxURLLength, frag = (L.isValue(m.root) ? m.root : self.root) + (m.path || m.fullpath), frag = self._filter(frag, m.name), resCombos[j][m.type].push(frag), resCombos[j][m.type + "Mods"].push(m)) : mods[i] && addSingle(mods[i]));
|
||||
for(j in resCombos)if (resCombos.hasOwnProperty(j)) {
|
||||
for(type in comboSep = resCombos[base = j].comboSep || self.comboSep, maxURLLength = resCombos[base].maxURLLength || self.maxURLLength, resCombos[base])if ("js" === type || "css" === type) {
|
||||
if (urls = resCombos[base][type], mods = resCombos[base][type + "Mods"], len = urls.length, baseLen = (tmpBase = base + urls.join(comboSep)).length, maxURLLength <= base.length && (maxURLLength = 1024), len) if (baseLen > maxURLLength) {
|
||||
if (urls = resCombos[base][type], mods = resCombos[base][type + "Mods"], len = urls.length, tmpBase = base + urls.join(comboSep), baseLen = tmpBase.length, maxURLLength <= base.length && (maxURLLength = 1024), len) if (baseLen > maxURLLength) {
|
||||
for(s = 0, u = []; s < len; s++)u.push(urls[s]), (tmpBase = base + u.join(comboSep)).length > maxURLLength && (m = u.pop(), tmpBase = base + u.join(comboSep), resolved[type].push(self._filter(tmpBase, null, resCombos[base].group)), u = [], m && u.push(m));
|
||||
u.length && (tmpBase = base + u.join(comboSep), resolved[type].push(self._filter(tmpBase, null, resCombos[base].group)));
|
||||
} else resolved[type].push(self._filter(tmpBase, null, resCombos[base].group));
|
||||
@ -3427,8 +3427,8 @@ var YUI = function() {
|
||||
condition: {
|
||||
name: "graphics-svg",
|
||||
test: function(Y) {
|
||||
var DOCUMENT = Y.config.doc, useSVG = !Y.config.defaultGraphicEngine || "canvas" != Y.config.defaultGraphicEngine, canvas = DOCUMENT && DOCUMENT.createElement("canvas");
|
||||
return DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (useSVG || !canvas);
|
||||
var DOCUMENT = Y.config.doc, useSVG = !Y.config.defaultGraphicEngine || "canvas" != Y.config.defaultGraphicEngine, canvas = DOCUMENT && DOCUMENT.createElement("canvas"), svg = DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1");
|
||||
return svg && (useSVG || !canvas);
|
||||
},
|
||||
trigger: "graphics"
|
||||
},
|
||||
@ -3440,8 +3440,8 @@ var YUI = function() {
|
||||
condition: {
|
||||
name: "graphics-svg-default",
|
||||
test: function(Y) {
|
||||
var DOCUMENT = Y.config.doc, useSVG = !Y.config.defaultGraphicEngine || "canvas" != Y.config.defaultGraphicEngine, canvas = DOCUMENT && DOCUMENT.createElement("canvas");
|
||||
return DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (useSVG || !canvas);
|
||||
var DOCUMENT = Y.config.doc, useSVG = !Y.config.defaultGraphicEngine || "canvas" != Y.config.defaultGraphicEngine, canvas = DOCUMENT && DOCUMENT.createElement("canvas"), svg = DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1");
|
||||
return svg && (useSVG || !canvas);
|
||||
},
|
||||
trigger: "graphics"
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_ecma_transforms_base"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.37.4"
|
||||
version = "0.37.5"
|
||||
|
||||
[dependencies]
|
||||
once_cell = "1.5.2"
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::ext::{AsOptExpr, PatOrExprExt};
|
||||
use crate::ext::AsOptExpr;
|
||||
use swc_common::{collections::AHashMap, comments::Comments, util::take::Take, Span, Spanned};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith};
|
||||
@ -105,12 +105,16 @@ impl VisitMut for Fixer<'_> {
|
||||
fn visit_mut_assign_expr(&mut self, expr: &mut AssignExpr) {
|
||||
expr.visit_mut_children_with(self);
|
||||
|
||||
match &mut *expr.right {
|
||||
// `foo = (bar = baz)` => foo = bar = baz
|
||||
Expr::Assign(AssignExpr { ref left, .. }) if left.as_ident().is_some() => {}
|
||||
fn rhs_need_paren(e: &Expr) -> bool {
|
||||
match e {
|
||||
Expr::Assign(e) => rhs_need_paren(&e.right),
|
||||
Expr::Seq(..) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
Expr::Seq(..) => self.wrap(&mut expr.right),
|
||||
_ => {}
|
||||
if rhs_need_paren(&expr.right) {
|
||||
self.wrap(&mut expr.right);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1436,4 +1440,48 @@ var store = global[SHARED] || (global[SHARED] = {});
|
||||
identical!(issue_2163_2, "() => ([foo] = bar());");
|
||||
|
||||
identical!(issue_2191, "(-1) ** h");
|
||||
|
||||
identical!(
|
||||
minifier_011,
|
||||
"
|
||||
function ItemsList() {
|
||||
var _ref;
|
||||
|
||||
var _temp, _this, _ret;
|
||||
|
||||
_classCallCheck(this, ItemsList);
|
||||
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = \
|
||||
ItemsList.__proto__ || Object.getPrototypeOf(ItemsList)).call.apply(_ref, \
|
||||
[this].concat(args))), _this), _this.storeHighlightedItemReference = function \
|
||||
(highlightedItem) {
|
||||
_this.props.onHighlightedItemChange(highlightedItem === null ? null : \
|
||||
highlightedItem.item);
|
||||
}, _temp), _possibleConstructorReturn(_this, _ret);
|
||||
}
|
||||
"
|
||||
);
|
||||
|
||||
identical!(
|
||||
minifier_012,
|
||||
"
|
||||
function ItemsList() {
|
||||
for(var _ref, _temp, _this, _len = arguments.length, args = Array(_len), _key = 0; \
|
||||
_key < _len; _key++)args[_key] = arguments[_key];
|
||||
return _possibleConstructorReturn(_this, (_temp = (_this = \
|
||||
_possibleConstructorReturn(this, (_ref = ItemsList.__proto__ || \
|
||||
Object.getPrototypeOf(ItemsList)).call.apply(_ref, [
|
||||
this
|
||||
].concat(args))), _this), _this.storeHighlightedItemReference = \
|
||||
function(highlightedItem) {
|
||||
_this.props.onHighlightedItemChange(null === highlightedItem ? null : \
|
||||
highlightedItem.item);
|
||||
}, _temp));
|
||||
}
|
||||
"
|
||||
);
|
||||
}
|
||||
|
@ -78,6 +78,8 @@
|
||||
"jest": "^27.0.1",
|
||||
"lodash": "^4.17.21",
|
||||
"progress": "^2.0.3",
|
||||
"prop-types": "^15.7.2",
|
||||
"react": "^17.0.2",
|
||||
"regenerator-runtime": "^0.13.9",
|
||||
"source-map": "^0.7.3",
|
||||
"source-map-support": "^0.5.19",
|
||||
|
28
tests/vercel/full-compact/react-autosuggest/.swcrc
Normal file
28
tests/vercel/full-compact/react-autosuggest/.swcrc
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"jsc": {
|
||||
"target": "es5",
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"tsx": true
|
||||
},
|
||||
"transform": {
|
||||
"react": {
|
||||
"runtime": "automatic",
|
||||
"pragma": "React.createElement",
|
||||
"pragmaFrag": "React.Fragment",
|
||||
"throwIfNamespace": true,
|
||||
"useBuiltins": true
|
||||
}
|
||||
},
|
||||
"minify": {
|
||||
"compress": {
|
||||
"toplevel": true
|
||||
},
|
||||
"mangle": {
|
||||
"toplevel": true
|
||||
},
|
||||
"toplevel": true
|
||||
}
|
||||
},
|
||||
"minify": true
|
||||
}
|
171
tests/vercel/full-compact/react-autosuggest/1/input/index.js
vendored
Normal file
171
tests/vercel/full-compact/react-autosuggest/1/input/index.js
vendored
Normal file
@ -0,0 +1,171 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
|
||||
// var _Item = _interopRequireDefault(require("./Item"));
|
||||
|
||||
// var _compareObjects = _interopRequireDefault(require("./compareObjects"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _createSuper(Derived) {
|
||||
return function () {
|
||||
var Super = _getPrototypeOf(Derived), result;
|
||||
if (_isNativeReflectConstruct()) {
|
||||
var NewTarget = _getPrototypeOf(this).constructor;
|
||||
result = Reflect.construct(Super, arguments, NewTarget);
|
||||
} else {
|
||||
result = Super.apply(this, arguments);
|
||||
}
|
||||
return _possibleConstructorReturn(this, result);
|
||||
};
|
||||
}
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () { })); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
var ItemsList = /*#__PURE__*/function (_Component) {
|
||||
_inherits(ItemsList, _Component);
|
||||
|
||||
var _super = _createSuper(ItemsList);
|
||||
|
||||
function ItemsList() {
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, ItemsList);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
_this = _super.call.apply(_super, [this].concat(args));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "storeHighlightedItemReference", function (highlightedItem) {
|
||||
_this.props.onHighlightedItemChange(highlightedItem === null ? null : highlightedItem.item);
|
||||
});
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(ItemsList, [{
|
||||
key: "shouldComponentUpdate",
|
||||
value: function shouldComponentUpdate(nextProps) {
|
||||
return (0, _compareObjects["default"])(nextProps, this.props, ['itemProps']);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
var _this$props = this.props,
|
||||
items = _this$props.items,
|
||||
itemProps = _this$props.itemProps,
|
||||
renderItem = _this$props.renderItem,
|
||||
renderItemData = _this$props.renderItemData,
|
||||
sectionIndex = _this$props.sectionIndex,
|
||||
highlightedItemIndex = _this$props.highlightedItemIndex,
|
||||
getItemId = _this$props.getItemId,
|
||||
theme = _this$props.theme,
|
||||
keyPrefix = _this$props.keyPrefix;
|
||||
var sectionPrefix = sectionIndex === null ? keyPrefix : "".concat(keyPrefix, "section-").concat(sectionIndex, "-");
|
||||
var isItemPropsFunction = typeof itemProps === 'function';
|
||||
return /*#__PURE__*/_react["default"].createElement("ul", _extends({
|
||||
role: "listbox"
|
||||
}, theme("".concat(sectionPrefix, "items-list"), 'itemsList')), items.map(function (item, itemIndex) {
|
||||
var isFirst = itemIndex === 0;
|
||||
var isHighlighted = itemIndex === highlightedItemIndex;
|
||||
var itemKey = "".concat(sectionPrefix, "item-").concat(itemIndex);
|
||||
var itemPropsObj = isItemPropsFunction ? itemProps({
|
||||
sectionIndex: sectionIndex,
|
||||
itemIndex: itemIndex
|
||||
}) : itemProps;
|
||||
|
||||
var allItemProps = _objectSpread({
|
||||
id: getItemId(sectionIndex, itemIndex),
|
||||
'aria-selected': isHighlighted
|
||||
}, theme(itemKey, 'item', isFirst && 'itemFirst', isHighlighted && 'itemHighlighted'), {}, itemPropsObj);
|
||||
|
||||
if (isHighlighted) {
|
||||
allItemProps.ref = _this2.storeHighlightedItemReference;
|
||||
} // `key` is provided by theme()
|
||||
|
||||
/* eslint-disable react/jsx-key */
|
||||
|
||||
|
||||
return /*#__PURE__*/_react["default"].createElement(_Item["default"], _extends({}, allItemProps, {
|
||||
sectionIndex: sectionIndex,
|
||||
isHighlighted: isHighlighted,
|
||||
itemIndex: itemIndex,
|
||||
item: item,
|
||||
renderItem: renderItem,
|
||||
renderItemData: renderItemData
|
||||
}));
|
||||
/* eslint-enable react/jsx-key */
|
||||
}));
|
||||
}
|
||||
}]);
|
||||
|
||||
return ItemsList;
|
||||
}(_react.Component);
|
||||
|
||||
exports["default"] = ItemsList;
|
||||
|
||||
_defineProperty(ItemsList, "propTypes", {
|
||||
items: _propTypes["default"].array.isRequired,
|
||||
itemProps: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].func]),
|
||||
renderItem: _propTypes["default"].func.isRequired,
|
||||
renderItemData: _propTypes["default"].object.isRequired,
|
||||
sectionIndex: _propTypes["default"].number,
|
||||
highlightedItemIndex: _propTypes["default"].number,
|
||||
onHighlightedItemChange: _propTypes["default"].func.isRequired,
|
||||
getItemId: _propTypes["default"].func.isRequired,
|
||||
theme: _propTypes["default"].func.isRequired,
|
||||
keyPrefix: _propTypes["default"].string.isRequired
|
||||
});
|
||||
|
||||
_defineProperty(ItemsList, "defaultProps", {
|
||||
sectionIndex: null
|
||||
});
|
||||
|
||||
|
||||
const a = new ItemsList();
|
1
tests/vercel/full-compact/react-autosuggest/1/output/index.js
vendored
Normal file
1
tests/vercel/full-compact/react-autosuggest/1/output/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
28
tests/vercel/full/react-autosuggest/.swcrc
Normal file
28
tests/vercel/full/react-autosuggest/.swcrc
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"jsc": {
|
||||
"target": "es5",
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"tsx": true
|
||||
},
|
||||
"transform": {
|
||||
"react": {
|
||||
"runtime": "automatic",
|
||||
"pragma": "React.createElement",
|
||||
"pragmaFrag": "React.Fragment",
|
||||
"throwIfNamespace": true,
|
||||
"useBuiltins": true
|
||||
}
|
||||
},
|
||||
"minify": {
|
||||
"compress": {
|
||||
"toplevel": true
|
||||
},
|
||||
"mangle": false,
|
||||
"toplevel": true
|
||||
}
|
||||
},
|
||||
"module": {
|
||||
"type": "commonjs"
|
||||
}
|
||||
}
|
153
tests/vercel/full/react-autosuggest/1/input/index.js
vendored
Normal file
153
tests/vercel/full/react-autosuggest/1/input/index.js
vendored
Normal file
@ -0,0 +1,153 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
|
||||
var _Item = _interopRequireDefault(require("./Item"));
|
||||
|
||||
var _compareObjects = _interopRequireDefault(require("./compareObjects"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () { })); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
var ItemsList = /*#__PURE__*/function (_Component) {
|
||||
_inherits(ItemsList, _Component);
|
||||
|
||||
var _super = _createSuper(ItemsList);
|
||||
|
||||
function ItemsList() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, ItemsList);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
_this = _super.call.apply(_super, [this].concat(args));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "storeHighlightedItemReference", function (highlightedItem) {
|
||||
_this.props.onHighlightedItemChange(highlightedItem === null ? null : highlightedItem.item);
|
||||
});
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(ItemsList, [{
|
||||
key: "shouldComponentUpdate",
|
||||
value: function shouldComponentUpdate(nextProps) {
|
||||
return (0, _compareObjects["default"])(nextProps, this.props, ['itemProps']);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
var _this$props = this.props,
|
||||
items = _this$props.items,
|
||||
itemProps = _this$props.itemProps,
|
||||
renderItem = _this$props.renderItem,
|
||||
renderItemData = _this$props.renderItemData,
|
||||
sectionIndex = _this$props.sectionIndex,
|
||||
highlightedItemIndex = _this$props.highlightedItemIndex,
|
||||
getItemId = _this$props.getItemId,
|
||||
theme = _this$props.theme,
|
||||
keyPrefix = _this$props.keyPrefix;
|
||||
var sectionPrefix = sectionIndex === null ? keyPrefix : "".concat(keyPrefix, "section-").concat(sectionIndex, "-");
|
||||
var isItemPropsFunction = typeof itemProps === 'function';
|
||||
return /*#__PURE__*/_react["default"].createElement("ul", _extends({
|
||||
role: "listbox"
|
||||
}, theme("".concat(sectionPrefix, "items-list"), 'itemsList')), items.map(function (item, itemIndex) {
|
||||
var isFirst = itemIndex === 0;
|
||||
var isHighlighted = itemIndex === highlightedItemIndex;
|
||||
var itemKey = "".concat(sectionPrefix, "item-").concat(itemIndex);
|
||||
var itemPropsObj = isItemPropsFunction ? itemProps({
|
||||
sectionIndex: sectionIndex,
|
||||
itemIndex: itemIndex
|
||||
}) : itemProps;
|
||||
|
||||
var allItemProps = _objectSpread({
|
||||
id: getItemId(sectionIndex, itemIndex),
|
||||
'aria-selected': isHighlighted
|
||||
}, theme(itemKey, 'item', isFirst && 'itemFirst', isHighlighted && 'itemHighlighted'), {}, itemPropsObj);
|
||||
|
||||
if (isHighlighted) {
|
||||
allItemProps.ref = _this2.storeHighlightedItemReference;
|
||||
} // `key` is provided by theme()
|
||||
|
||||
/* eslint-disable react/jsx-key */
|
||||
|
||||
|
||||
return /*#__PURE__*/_react["default"].createElement(_Item["default"], _extends({}, allItemProps, {
|
||||
sectionIndex: sectionIndex,
|
||||
isHighlighted: isHighlighted,
|
||||
itemIndex: itemIndex,
|
||||
item: item,
|
||||
renderItem: renderItem,
|
||||
renderItemData: renderItemData
|
||||
}));
|
||||
/* eslint-enable react/jsx-key */
|
||||
}));
|
||||
}
|
||||
}]);
|
||||
|
||||
return ItemsList;
|
||||
}(_react.Component);
|
||||
|
||||
exports["default"] = ItemsList;
|
||||
|
||||
_defineProperty(ItemsList, "propTypes", {
|
||||
items: _propTypes["default"].array.isRequired,
|
||||
itemProps: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].func]),
|
||||
renderItem: _propTypes["default"].func.isRequired,
|
||||
renderItemData: _propTypes["default"].object.isRequired,
|
||||
sectionIndex: _propTypes["default"].number,
|
||||
highlightedItemIndex: _propTypes["default"].number,
|
||||
onHighlightedItemChange: _propTypes["default"].func.isRequired,
|
||||
getItemId: _propTypes["default"].func.isRequired,
|
||||
theme: _propTypes["default"].func.isRequired,
|
||||
keyPrefix: _propTypes["default"].string.isRequired
|
||||
});
|
||||
|
||||
_defineProperty(ItemsList, "defaultProps", {
|
||||
sectionIndex: null
|
||||
});
|
198
tests/vercel/full/react-autosuggest/1/output/index.js
vendored
Normal file
198
tests/vercel/full/react-autosuggest/1/output/index.js
vendored
Normal file
@ -0,0 +1,198 @@
|
||||
"use strict";
|
||||
var _typeof = function(obj) {
|
||||
return obj && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: !0
|
||||
}), exports.default = void 0;
|
||||
var _react = function(obj) {
|
||||
if (obj && obj.__esModule) return obj;
|
||||
if (null === obj || "object" !== _typeof1(obj) && "function" != typeof obj) return {
|
||||
"default": obj
|
||||
};
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) return cache.get(obj);
|
||||
var newObj = {
|
||||
}, hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for(var key in obj)if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
||||
desc && (desc.get || desc.set) ? Object.defineProperty(newObj, key, desc) : newObj[key] = obj[key];
|
||||
}
|
||||
return newObj.default = obj, cache && cache.set(obj, newObj), newObj;
|
||||
}(require("react")), _propTypes = _interopRequireDefault(require("prop-types")), _Item = _interopRequireDefault(require("./Item")), _compareObjects = _interopRequireDefault(require("./compareObjects"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
"default": obj
|
||||
};
|
||||
}
|
||||
function _getRequireWildcardCache() {
|
||||
if ("function" != typeof WeakMap) return null;
|
||||
var cache = new WeakMap();
|
||||
return _getRequireWildcardCache = function() {
|
||||
return cache;
|
||||
}, cache;
|
||||
}
|
||||
function _typeof1(obj) {
|
||||
return (_typeof1 = "function" == typeof Symbol && "symbol" === _typeof(Symbol.iterator) ? function(obj) {
|
||||
return void 0 === obj ? "undefined" : _typeof(obj);
|
||||
} : function(obj) {
|
||||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : void 0 === obj ? "undefined" : _typeof(obj);
|
||||
})(obj);
|
||||
}
|
||||
function _extends() {
|
||||
return (_extends = Object.assign || function(target) {
|
||||
for(var i = 1; i < arguments.length; i++){
|
||||
var source = arguments[i];
|
||||
for(var key in source)Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
|
||||
}
|
||||
return target;
|
||||
}).apply(this, arguments);
|
||||
}
|
||||
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 _defineProperties(target, props) {
|
||||
for(var i = 0; i < props.length; i++){
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
function _assertThisInitialized(self) {
|
||||
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
return self;
|
||||
}
|
||||
function _getPrototypeOf(o) {
|
||||
return (_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function(o) {
|
||||
return o.__proto__ || Object.getPrototypeOf(o);
|
||||
})(o);
|
||||
}
|
||||
function _setPrototypeOf(o, p) {
|
||||
return (_setPrototypeOf = Object.setPrototypeOf || function(o, p) {
|
||||
return o.__proto__ = p, o;
|
||||
})(o, p);
|
||||
}
|
||||
function _defineProperty(obj, key, value) {
|
||||
return key in obj ? Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: !0,
|
||||
configurable: !0,
|
||||
writable: !0
|
||||
}) : obj[key] = value, obj;
|
||||
}
|
||||
var ItemsList = function(_Component) {
|
||||
!function(subClass, superClass) {
|
||||
if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function");
|
||||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
||||
constructor: {
|
||||
value: subClass,
|
||||
writable: !0,
|
||||
configurable: !0
|
||||
}
|
||||
}), superClass && _setPrototypeOf(subClass, superClass);
|
||||
}(ItemsList, _Component);
|
||||
var Constructor, protoProps, staticProps, _super = function(Derived) {
|
||||
return function() {
|
||||
var self, call, result, Super = _getPrototypeOf(Derived);
|
||||
if ((function() {
|
||||
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
|
||||
if (Reflect.construct.sham) return !1;
|
||||
if ("function" == typeof Proxy) return !0;
|
||||
try {
|
||||
return Date.prototype.toString.call(Reflect.construct(Date, [], function() {
|
||||
})), !0;
|
||||
} catch (e) {
|
||||
return !1;
|
||||
}
|
||||
})()) {
|
||||
var NewTarget = _getPrototypeOf(this).constructor;
|
||||
result = Reflect.construct(Super, arguments, NewTarget);
|
||||
} else result = Super.apply(this, arguments);
|
||||
return self = this, (call = result) && ("object" === _typeof1(call) || "function" == typeof call) ? call : _assertThisInitialized(self);
|
||||
};
|
||||
}(ItemsList);
|
||||
function ItemsList() {
|
||||
var _this;
|
||||
!function(instance, Constructor) {
|
||||
var left, right;
|
||||
if (left = instance, null != (right = Constructor) && "undefined" != typeof Symbol && right[Symbol.hasInstance] ? !right[Symbol.hasInstance](left) : !(left instanceof right)) throw new TypeError("Cannot call a class as a function");
|
||||
}(this, ItemsList);
|
||||
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key];
|
||||
return _defineProperty(_assertThisInitialized(_this = _super.call.apply(_super, [
|
||||
this
|
||||
].concat(args))), "storeHighlightedItemReference", function(highlightedItem) {
|
||||
_this.props.onHighlightedItemChange(null === highlightedItem ? null : highlightedItem.item);
|
||||
}), _this;
|
||||
}
|
||||
return Constructor = ItemsList, protoProps = [
|
||||
{
|
||||
key: "shouldComponentUpdate",
|
||||
value: function(nextProps) {
|
||||
return (0, _compareObjects.default)(nextProps, this.props, [
|
||||
"itemProps"
|
||||
]);
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "render",
|
||||
value: function() {
|
||||
var _this2 = this, _this$props = this.props, items = _this$props.items, itemProps = _this$props.itemProps, renderItem = _this$props.renderItem, renderItemData = _this$props.renderItemData, sectionIndex = _this$props.sectionIndex, highlightedItemIndex = _this$props.highlightedItemIndex, getItemId = _this$props.getItemId, theme = _this$props.theme, keyPrefix = _this$props.keyPrefix, sectionPrefix = null === sectionIndex ? keyPrefix : "".concat(keyPrefix, "section-").concat(sectionIndex, "-"), isItemPropsFunction = "function" == typeof itemProps;
|
||||
return _react.default.createElement("ul", _extends({
|
||||
role: "listbox"
|
||||
}, theme("".concat(sectionPrefix, "items-list"), "itemsList")), items.map(function(item, itemIndex) {
|
||||
var isHighlighted = itemIndex === highlightedItemIndex, itemKey = "".concat(sectionPrefix, "item-").concat(itemIndex), itemPropsObj = isItemPropsFunction ? itemProps({
|
||||
sectionIndex: sectionIndex,
|
||||
itemIndex: itemIndex
|
||||
}) : itemProps, allItemProps = function(target) {
|
||||
for(var _arguments = arguments, _loop = function(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));
|
||||
});
|
||||
}, i = 1; i < arguments.length; i++)_loop(i);
|
||||
return target;
|
||||
}({
|
||||
id: getItemId(sectionIndex, itemIndex),
|
||||
"aria-selected": isHighlighted
|
||||
}, theme(itemKey, "item", 0 === itemIndex && "itemFirst", isHighlighted && "itemHighlighted"), {
|
||||
}, itemPropsObj);
|
||||
return isHighlighted && (allItemProps.ref = _this2.storeHighlightedItemReference), _react.default.createElement(_Item.default, _extends({
|
||||
}, allItemProps, {
|
||||
sectionIndex: sectionIndex,
|
||||
isHighlighted: isHighlighted,
|
||||
itemIndex: itemIndex,
|
||||
item: item,
|
||||
renderItem: renderItem,
|
||||
renderItemData: renderItemData
|
||||
}));
|
||||
}));
|
||||
}
|
||||
}
|
||||
], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), ItemsList;
|
||||
}(_react.Component);
|
||||
exports.default = ItemsList, _defineProperty(ItemsList, "propTypes", {
|
||||
items: _propTypes.default.array.isRequired,
|
||||
itemProps: _propTypes.default.oneOfType([
|
||||
_propTypes.default.object,
|
||||
_propTypes.default.func
|
||||
]),
|
||||
renderItem: _propTypes.default.func.isRequired,
|
||||
renderItemData: _propTypes.default.object.isRequired,
|
||||
sectionIndex: _propTypes.default.number,
|
||||
highlightedItemIndex: _propTypes.default.number,
|
||||
onHighlightedItemChange: _propTypes.default.func.isRequired,
|
||||
getItemId: _propTypes.default.func.isRequired,
|
||||
theme: _propTypes.default.func.isRequired,
|
||||
keyPrefix: _propTypes.default.string.isRequired
|
||||
}), _defineProperty(ItemsList, "defaultProps", {
|
||||
sectionIndex: null
|
||||
});
|
30
tests/vercel/full/react-autowhatever/.swcrc
Normal file
30
tests/vercel/full/react-autowhatever/.swcrc
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"jsc": {
|
||||
"target": "es5",
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"tsx": true
|
||||
},
|
||||
"transform": {
|
||||
"react": {
|
||||
"runtime": "automatic",
|
||||
"pragma": "React.createElement",
|
||||
"pragmaFrag": "React.Fragment",
|
||||
"throwIfNamespace": true,
|
||||
"useBuiltins": true
|
||||
}
|
||||
},
|
||||
"minify": {
|
||||
"compress": {
|
||||
"toplevel": true
|
||||
},
|
||||
"mangle": {
|
||||
"toplevel": true
|
||||
},
|
||||
"toplevel": true
|
||||
}
|
||||
},
|
||||
"module": {
|
||||
"type": "commonjs"
|
||||
}
|
||||
}
|
81
tests/vercel/full/react-autowhatever/1/input/index.js
vendored
Normal file
81
tests/vercel/full/react-autowhatever/1/input/index.js
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
export default class ItemsList extends Component {
|
||||
static propTypes = {
|
||||
items: PropTypes.array.isRequired,
|
||||
itemProps: PropTypes.oneOfType([
|
||||
PropTypes.object,
|
||||
PropTypes.func
|
||||
]),
|
||||
renderItem: PropTypes.func.isRequired,
|
||||
renderItemData: PropTypes.object.isRequired,
|
||||
sectionIndex: PropTypes.number,
|
||||
highlightedItemIndex: PropTypes.number,
|
||||
onHighlightedItemChange: PropTypes.func.isRequired,
|
||||
getItemId: PropTypes.func.isRequired,
|
||||
theme: PropTypes.func.isRequired,
|
||||
keyPrefix: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
sectionIndex: null
|
||||
};
|
||||
|
||||
shouldComponentUpdate(nextProps) {
|
||||
return true
|
||||
}
|
||||
|
||||
storeHighlightedItemReference = highlightedItem => {
|
||||
this.props.onHighlightedItemChange(highlightedItem === null ? null : highlightedItem.item);
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
items, itemProps, renderItem, renderItemData, sectionIndex,
|
||||
highlightedItemIndex, getItemId, theme, keyPrefix
|
||||
} = this.props;
|
||||
const sectionPrefix = (sectionIndex === null ? keyPrefix : `${keyPrefix}section-${sectionIndex}-`);
|
||||
const isItemPropsFunction = (typeof itemProps === 'function');
|
||||
|
||||
return (
|
||||
<ul role="listbox" {...theme(`${sectionPrefix}items-list`, 'itemsList')}>
|
||||
{
|
||||
items.map((item, itemIndex) => {
|
||||
const isFirst = (itemIndex === 0);
|
||||
const isHighlighted = (itemIndex === highlightedItemIndex);
|
||||
const itemKey = `${sectionPrefix}item-${itemIndex}`;
|
||||
const itemPropsObj = isItemPropsFunction ? itemProps({ sectionIndex, itemIndex }) : itemProps;
|
||||
const allItemProps = {
|
||||
id: getItemId(sectionIndex, itemIndex),
|
||||
'aria-selected': isHighlighted,
|
||||
...theme(itemKey, 'item', isFirst && 'itemFirst', isHighlighted && 'itemHighlighted'),
|
||||
...itemPropsObj
|
||||
};
|
||||
|
||||
if (isHighlighted) {
|
||||
allItemProps.ref = this.storeHighlightedItemReference;
|
||||
}
|
||||
|
||||
// `key` is provided by theme()
|
||||
/* eslint-disable react/jsx-key */
|
||||
return (
|
||||
<Item
|
||||
{...allItemProps}
|
||||
sectionIndex={sectionIndex}
|
||||
isHighlighted={isHighlighted}
|
||||
itemIndex={itemIndex}
|
||||
item={item}
|
||||
renderItem={renderItem}
|
||||
renderItemData={renderItemData}
|
||||
/>
|
||||
);
|
||||
/* eslint-enable react/jsx-key */
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const a = new ItemsList()
|
132
tests/vercel/full/react-autowhatever/1/output/index.js
vendored
Normal file
132
tests/vercel/full/react-autowhatever/1/output/index.js
vendored
Normal file
@ -0,0 +1,132 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: !0
|
||||
}), exports.default = void 0;
|
||||
var a, b = require("react/jsx-runtime"), c = function(a) {
|
||||
if (a && a.__esModule) return a;
|
||||
var d = {
|
||||
};
|
||||
if (null != a) {
|
||||
for(var e in a)if (Object.prototype.hasOwnProperty.call(a, e)) {
|
||||
var f = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(a, e) : {
|
||||
};
|
||||
f.get || f.set ? Object.defineProperty(d, e, f) : d[e] = a[e];
|
||||
}
|
||||
}
|
||||
return d.default = a, d;
|
||||
}(require("react")), g = (a = require("prop-types")) && a.__esModule ? a : {
|
||||
default: a
|
||||
};
|
||||
function h(i, j) {
|
||||
for(var k = 0; k < j.length; k++){
|
||||
var l = j[k];
|
||||
l.enumerable = l.enumerable || !1, l.configurable = !0, "value" in l && (l.writable = !0), Object.defineProperty(i, l.key, l);
|
||||
}
|
||||
}
|
||||
function m(a, e, n) {
|
||||
return e in a ? Object.defineProperty(a, e, {
|
||||
value: n,
|
||||
enumerable: !0,
|
||||
configurable: !0,
|
||||
writable: !0
|
||||
}) : a[e] = n, a;
|
||||
}
|
||||
function o(p) {
|
||||
return o = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(p) {
|
||||
return p.__proto__ || Object.getPrototypeOf(p);
|
||||
}, o(p);
|
||||
}
|
||||
function q(i) {
|
||||
for(var k = 1; k < arguments.length; k++){
|
||||
var r = null != arguments[k] ? arguments[k] : {
|
||||
}, s = Object.keys(r);
|
||||
"function" == typeof Object.getOwnPropertySymbols && (s = s.concat(Object.getOwnPropertySymbols(r).filter(function(t) {
|
||||
return Object.getOwnPropertyDescriptor(r, t).enumerable;
|
||||
}))), s.forEach(function(e) {
|
||||
m(i, e, r[e]);
|
||||
});
|
||||
}
|
||||
return i;
|
||||
}
|
||||
function u(p, v) {
|
||||
return u = Object.setPrototypeOf || function _setPrototypeOf(p, v) {
|
||||
return p.__proto__ = v, p;
|
||||
}, u(p, v);
|
||||
}
|
||||
var w = function(x) {
|
||||
"use strict";
|
||||
var y, z, A;
|
||||
function w() {
|
||||
var B, C, D, a;
|
||||
return !function(E, y) {
|
||||
if (!(E instanceof y)) throw new TypeError("Cannot call a class as a function");
|
||||
}(this, w), C = this, D = o(w).apply(this, arguments), (B = D && ("object" == ((a = D) && "undefined" != typeof Symbol && a.constructor === Symbol ? "symbol" : typeof a) || "function" == typeof D) ? D : (function(C) {
|
||||
if (void 0 === C) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
return C;
|
||||
})(C)).storeHighlightedItemReference = function(F) {
|
||||
B.props.onHighlightedItemChange(null === F ? null : F.item);
|
||||
}, B;
|
||||
}
|
||||
return !function(G, H) {
|
||||
if ("function" != typeof H && null !== H) throw new TypeError("Super expression must either be null or a function");
|
||||
G.prototype = Object.create(H && H.prototype, {
|
||||
constructor: {
|
||||
value: G,
|
||||
writable: !0,
|
||||
configurable: !0
|
||||
}
|
||||
}), H && u(G, H);
|
||||
}(w, x), y = w, z = [
|
||||
{
|
||||
key: "shouldComponentUpdate",
|
||||
value: function(I) {
|
||||
return !0;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "render",
|
||||
value: function() {
|
||||
var J = this, K = this.props, L = K.items, M = K.itemProps, N = K.renderItem, O = K.renderItemData, P = K.sectionIndex, Q = K.highlightedItemIndex, R = K.getItemId, S = K.theme, T = K.keyPrefix, U = null === P ? T : "".concat(T, "section-").concat(P, "-"), V = "function" == typeof M;
|
||||
return b.jsx("ul", q({
|
||||
role: "listbox"
|
||||
}, S("".concat(U, "items-list"), "itemsList"), {
|
||||
children: L.map(function(W, X) {
|
||||
var Y = X === Q, Z = "".concat(U, "item-").concat(X), $ = V ? M({
|
||||
sectionIndex: P,
|
||||
itemIndex: X
|
||||
}) : M, _ = q({
|
||||
id: R(P, X),
|
||||
"aria-selected": Y
|
||||
}, S(Z, "item", 0 === X && "itemFirst", Y && "itemHighlighted"), $);
|
||||
return Y && (_.ref = J.storeHighlightedItemReference), b.jsx(Item, q({
|
||||
}, _, {
|
||||
sectionIndex: P,
|
||||
isHighlighted: Y,
|
||||
itemIndex: X,
|
||||
item: W,
|
||||
renderItem: N,
|
||||
renderItemData: O
|
||||
}));
|
||||
})
|
||||
}));
|
||||
}
|
||||
}
|
||||
], h(y.prototype, z), A && h(y, A), w;
|
||||
}(c.Component);
|
||||
w.propTypes = {
|
||||
items: g.default.array.isRequired,
|
||||
itemProps: g.default.oneOfType([
|
||||
g.default.object,
|
||||
g.default.func
|
||||
]),
|
||||
renderItem: g.default.func.isRequired,
|
||||
renderItemData: g.default.object.isRequired,
|
||||
sectionIndex: g.default.number,
|
||||
highlightedItemIndex: g.default.number,
|
||||
onHighlightedItemChange: g.default.func.isRequired,
|
||||
getItemId: g.default.func.isRequired,
|
||||
theme: g.default.func.isRequired,
|
||||
keyPrefix: g.default.string.isRequired
|
||||
}, w.defaultProps = {
|
||||
sectionIndex: null
|
||||
}, exports.default = w, new w();
|
68
tests/vercel/full/react-autowhatever/2/input/index.js
vendored
Normal file
68
tests/vercel/full/react-autowhatever/2/input/index.js
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
export default class ItemsList extends Component {
|
||||
static propTypes = {
|
||||
items: 500
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
sectionIndex: null
|
||||
};
|
||||
|
||||
shouldComponentUpdate(nextProps) {
|
||||
return compareObjects(nextProps, this.props, ['itemProps']);
|
||||
}
|
||||
|
||||
storeHighlightedItemReference = highlightedItem => {
|
||||
this.props.onHighlightedItemChange(highlightedItem === null ? null : highlightedItem.item);
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
items, itemProps, renderItem, renderItemData, sectionIndex,
|
||||
highlightedItemIndex, getItemId, theme, keyPrefix
|
||||
} = this.props;
|
||||
const sectionPrefix = (sectionIndex === null ? keyPrefix : `${keyPrefix}section-${sectionIndex}-`);
|
||||
const isItemPropsFunction = (typeof itemProps === 'function');
|
||||
|
||||
return (
|
||||
<ul role="listbox" {...theme(`${sectionPrefix}items-list`, 'itemsList')}>
|
||||
{
|
||||
items.map((item, itemIndex) => {
|
||||
const isFirst = (itemIndex === 0);
|
||||
const isHighlighted = (itemIndex === highlightedItemIndex);
|
||||
const itemKey = `${sectionPrefix}item-${itemIndex}`;
|
||||
const itemPropsObj = isItemPropsFunction ? itemProps({ sectionIndex, itemIndex }) : itemProps;
|
||||
const allItemProps = {
|
||||
id: getItemId(sectionIndex, itemIndex),
|
||||
'aria-selected': isHighlighted,
|
||||
...theme(itemKey, 'item', isFirst && 'itemFirst', isHighlighted && 'itemHighlighted'),
|
||||
...itemPropsObj
|
||||
};
|
||||
|
||||
if (isHighlighted) {
|
||||
allItemProps.ref = this.storeHighlightedItemReference;
|
||||
}
|
||||
|
||||
// `key` is provided by theme()
|
||||
/* eslint-disable react/jsx-key */
|
||||
return (
|
||||
<Item
|
||||
{...allItemProps}
|
||||
sectionIndex={sectionIndex}
|
||||
isHighlighted={isHighlighted}
|
||||
itemIndex={itemIndex}
|
||||
item={item}
|
||||
renderItem={renderItem}
|
||||
renderItemData={renderItemData}
|
||||
/>
|
||||
);
|
||||
/* eslint-enable react/jsx-key */
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const a = new ItemsList();
|
120
tests/vercel/full/react-autowhatever/2/output/index.js
vendored
Normal file
120
tests/vercel/full/react-autowhatever/2/output/index.js
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: !0
|
||||
}), exports.default = void 0;
|
||||
var a = require("react/jsx-runtime"), b = function(c) {
|
||||
if (c && c.__esModule) return c;
|
||||
var d = {
|
||||
};
|
||||
if (null != c) {
|
||||
for(var e in c)if (Object.prototype.hasOwnProperty.call(c, e)) {
|
||||
var f = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(c, e) : {
|
||||
};
|
||||
f.get || f.set ? Object.defineProperty(d, e, f) : d[e] = c[e];
|
||||
}
|
||||
}
|
||||
return d.default = c, d;
|
||||
}(require("react"));
|
||||
function g(h, i) {
|
||||
for(var j = 0; j < i.length; j++){
|
||||
var k = i[j];
|
||||
k.enumerable = k.enumerable || !1, k.configurable = !0, "value" in k && (k.writable = !0), Object.defineProperty(h, k.key, k);
|
||||
}
|
||||
}
|
||||
function l(c, e, m) {
|
||||
return e in c ? Object.defineProperty(c, e, {
|
||||
value: m,
|
||||
enumerable: !0,
|
||||
configurable: !0,
|
||||
writable: !0
|
||||
}) : c[e] = m, c;
|
||||
}
|
||||
function n(o) {
|
||||
return n = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
||||
return o.__proto__ || Object.getPrototypeOf(o);
|
||||
}, n(o);
|
||||
}
|
||||
function p(h) {
|
||||
for(var j = 1; j < arguments.length; j++){
|
||||
var q = null != arguments[j] ? arguments[j] : {
|
||||
}, r = Object.keys(q);
|
||||
"function" == typeof Object.getOwnPropertySymbols && (r = r.concat(Object.getOwnPropertySymbols(q).filter(function(s) {
|
||||
return Object.getOwnPropertyDescriptor(q, s).enumerable;
|
||||
}))), r.forEach(function(e) {
|
||||
l(h, e, q[e]);
|
||||
});
|
||||
}
|
||||
return h;
|
||||
}
|
||||
function t(o, u) {
|
||||
return t = Object.setPrototypeOf || function _setPrototypeOf(o, u) {
|
||||
return o.__proto__ = u, o;
|
||||
}, t(o, u);
|
||||
}
|
||||
var v = function(w) {
|
||||
"use strict";
|
||||
var x, y, z;
|
||||
function v() {
|
||||
var A, B, C, c;
|
||||
return !function(D, x) {
|
||||
if (!(D instanceof x)) throw new TypeError("Cannot call a class as a function");
|
||||
}(this, v), B = this, C = n(v).apply(this, arguments), (A = C && ("object" == ((c = C) && "undefined" != typeof Symbol && c.constructor === Symbol ? "symbol" : typeof c) || "function" == typeof C) ? C : (function(B) {
|
||||
if (void 0 === B) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
return B;
|
||||
})(B)).storeHighlightedItemReference = function(E) {
|
||||
A.props.onHighlightedItemChange(null === E ? null : E.item);
|
||||
}, A;
|
||||
}
|
||||
return !function(F, G) {
|
||||
if ("function" != typeof G && null !== G) throw new TypeError("Super expression must either be null or a function");
|
||||
F.prototype = Object.create(G && G.prototype, {
|
||||
constructor: {
|
||||
value: F,
|
||||
writable: !0,
|
||||
configurable: !0
|
||||
}
|
||||
}), G && t(F, G);
|
||||
}(v, w), x = v, y = [
|
||||
{
|
||||
key: "shouldComponentUpdate",
|
||||
value: function(H) {
|
||||
return compareObjects(H, this.props, [
|
||||
"itemProps"
|
||||
]);
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "render",
|
||||
value: function() {
|
||||
var I = this, J = this.props, K = J.items, L = J.itemProps, M = J.renderItem, N = J.renderItemData, O = J.sectionIndex, P = J.highlightedItemIndex, Q = J.getItemId, R = J.theme, S = J.keyPrefix, T = null === O ? S : "".concat(S, "section-").concat(O, "-"), U = "function" == typeof L;
|
||||
return a.jsx("ul", p({
|
||||
role: "listbox"
|
||||
}, R("".concat(T, "items-list"), "itemsList"), {
|
||||
children: K.map(function(V, W) {
|
||||
var X = W === P, Y = "".concat(T, "item-").concat(W), Z = U ? L({
|
||||
sectionIndex: O,
|
||||
itemIndex: W
|
||||
}) : L, $ = p({
|
||||
id: Q(O, W),
|
||||
"aria-selected": X
|
||||
}, R(Y, "item", 0 === W && "itemFirst", X && "itemHighlighted"), Z);
|
||||
return X && ($.ref = I.storeHighlightedItemReference), a.jsx(Item, p({
|
||||
}, $, {
|
||||
sectionIndex: O,
|
||||
isHighlighted: X,
|
||||
itemIndex: W,
|
||||
item: V,
|
||||
renderItem: M,
|
||||
renderItemData: N
|
||||
}));
|
||||
})
|
||||
}));
|
||||
}
|
||||
}
|
||||
], g(x.prototype, y), z && g(x, z), v;
|
||||
}(b.Component);
|
||||
v.propTypes = {
|
||||
items: 500
|
||||
}, v.defaultProps = {
|
||||
sectionIndex: null
|
||||
}, exports.default = v, new v();
|
@ -55,312 +55,312 @@ export default function createInstantSearchManager(z) {
|
||||
}, ba, a.defineProperty({
|
||||
}, da, ea.concat(ca)));
|
||||
}, {
|
||||
}), fa = Object.keys(Y).map(function(ga) {
|
||||
return {
|
||||
parameters: Y[ga].reduce(function(ha, ia) {
|
||||
return ia.getSearchParameters(ha);
|
||||
}, L),
|
||||
indexId: ga
|
||||
};
|
||||
});
|
||||
return {
|
||||
mainParameters: R,
|
||||
derivedParameters: Object.keys(Y).map(function(fa) {
|
||||
return {
|
||||
parameters: Y[fa].reduce(function(ga, ha) {
|
||||
return ha.getSearchParameters(ga);
|
||||
}, L),
|
||||
indexId: fa
|
||||
};
|
||||
})
|
||||
derivedParameters: fa
|
||||
};
|
||||
}, ia = function() {
|
||||
if (!ja) {
|
||||
var ka = K(la.state), ma = ka.mainParameters, na = ka.derivedParameters;
|
||||
la.derivedHelpers.slice().forEach(function(oa) {
|
||||
oa.detach();
|
||||
}), na.forEach(function(pa) {
|
||||
var qa = pa.indexId, ra = pa.parameters;
|
||||
la.derive(function() {
|
||||
return ra;
|
||||
}).on("result", sa({
|
||||
indexId: qa
|
||||
})).on("error", ta);
|
||||
}), la.setState(ma), la.search();
|
||||
}, ja = function() {
|
||||
if (!ka) {
|
||||
var la = K(ma.state), na = la.mainParameters, oa = la.derivedParameters;
|
||||
ma.derivedHelpers.slice().forEach(function(pa) {
|
||||
pa.detach();
|
||||
}), oa.forEach(function(qa) {
|
||||
var ra = qa.indexId, sa = qa.parameters, ta = ma.derive(function() {
|
||||
return sa;
|
||||
});
|
||||
ta.on("result", ua({
|
||||
indexId: ra
|
||||
})).on("error", va);
|
||||
}), ma.setState(na), ma.search();
|
||||
}
|
||||
}, sa = function(ua) {
|
||||
var va = ua.indexId;
|
||||
return function(wa) {
|
||||
var xa = ya.getState(), za = !la.derivedHelpers.length, Aa = xa.results ? xa.results : {
|
||||
}, ua = function(wa) {
|
||||
var xa = wa.indexId;
|
||||
return function(ya) {
|
||||
var za = Aa.getState(), Ba = !ma.derivedHelpers.length, Ca = za.results ? za.results : {
|
||||
};
|
||||
Aa = !za && Aa.getFacetByName ? {
|
||||
} : Aa, Aa = za ? wa.results : a.objectSpread({
|
||||
}, Aa, a.defineProperty({
|
||||
}, va, wa.results));
|
||||
var Ba = ya.getState(), Ca = Ba.isSearchStalled;
|
||||
la.hasPendingRequests() || (clearTimeout(Da), Da = null, Ca = !1), Ba.resultsFacetValues;
|
||||
var Ea = a.objectWithoutProperties(Ba, ["resultsFacetValues"]);
|
||||
ya.setState(a.objectSpread({
|
||||
}, Ea, {
|
||||
results: Aa,
|
||||
isSearchStalled: Ca,
|
||||
Ca = !Ba && Ca.getFacetByName ? {
|
||||
} : Ca, Ca = Ba ? ya.results : a.objectSpread({
|
||||
}, Ca, a.defineProperty({
|
||||
}, xa, ya.results));
|
||||
var Da = Aa.getState(), Ea = Da.isSearchStalled;
|
||||
ma.hasPendingRequests() || (clearTimeout(Fa), Fa = null, Ea = !1), Da.resultsFacetValues;
|
||||
var Ga = a.objectWithoutProperties(Da, ["resultsFacetValues"]);
|
||||
Aa.setState(a.objectSpread({
|
||||
}, Ga, {
|
||||
results: Ca,
|
||||
isSearchStalled: Ea,
|
||||
searching: !1,
|
||||
error: null
|
||||
}));
|
||||
};
|
||||
}, ta = function(Fa) {
|
||||
var Ga = Fa.error, Ha = ya.getState(), Ia = Ha.isSearchStalled;
|
||||
la.hasPendingRequests() || (clearTimeout(Da), Ia = !1), Ha.resultsFacetValues;
|
||||
var Ja = a.objectWithoutProperties(Ha, ["resultsFacetValues"]);
|
||||
ya.setState(a.objectSpread({
|
||||
}, Ja, {
|
||||
isSearchStalled: Ia,
|
||||
error: Ga,
|
||||
}, va = function(Ha) {
|
||||
var Ia = Ha.error, Ja = Aa.getState(), Ka = Ja.isSearchStalled;
|
||||
ma.hasPendingRequests() || (clearTimeout(Fa), Ka = !1), Ja.resultsFacetValues;
|
||||
var La = a.objectWithoutProperties(Ja, ["resultsFacetValues"]);
|
||||
Aa.setState(a.objectSpread({
|
||||
}, La, {
|
||||
isSearchStalled: Ka,
|
||||
error: Ia,
|
||||
searching: !1
|
||||
}));
|
||||
}, Ka = function(La, Ma) {
|
||||
if (La.transporter) {
|
||||
La.transporter.responsesCache.set({
|
||||
}, Ma = function(Na, Oa) {
|
||||
if (Na.transporter) {
|
||||
Na.transporter.responsesCache.set({
|
||||
method: "search",
|
||||
args: [
|
||||
Ma.reduce(function(Na, Oa) {
|
||||
return Na.concat(Oa.rawResults.map(function(Pa) {
|
||||
Oa.reduce(function(Pa, Qa) {
|
||||
return Pa.concat(Qa.rawResults.map(function(Ra) {
|
||||
return {
|
||||
indexName: Pa.index,
|
||||
params: Pa.params
|
||||
indexName: Ra.index,
|
||||
params: Ra.params
|
||||
};
|
||||
}));
|
||||
}, []),
|
||||
]
|
||||
}, {
|
||||
results: Ma.reduce(function(Qa, Ra) {
|
||||
return Qa.concat(Ra.rawResults);
|
||||
results: Oa.reduce(function(Sa, Ta) {
|
||||
return Sa.concat(Ta.rawResults);
|
||||
}, [])
|
||||
});
|
||||
return;
|
||||
}
|
||||
var Sa = "/1/indexes/*/queries_body_".concat(JSON.stringify({
|
||||
requests: Ma.reduce(function(Ta, Ua) {
|
||||
return Ta.concat(Ua.rawResults.map(function(Va) {
|
||||
var Ua = "/1/indexes/*/queries_body_".concat(JSON.stringify({
|
||||
requests: Oa.reduce(function(Va, Wa) {
|
||||
return Va.concat(Wa.rawResults.map(function(Xa) {
|
||||
return {
|
||||
indexName: Va.index,
|
||||
params: Va.params
|
||||
indexName: Xa.index,
|
||||
params: Xa.params
|
||||
};
|
||||
}));
|
||||
}, [])
|
||||
}));
|
||||
La.cache = a.objectSpread({
|
||||
}, La.cache, a.defineProperty({
|
||||
}, Sa, JSON.stringify({
|
||||
results: Ma.reduce(function(Wa, Xa) {
|
||||
return Wa.concat(Xa.rawResults);
|
||||
Na.cache = a.objectSpread({
|
||||
}, Na.cache, a.defineProperty({
|
||||
}, Ua, JSON.stringify({
|
||||
results: Oa.reduce(function(Ya, Za) {
|
||||
return Ya.concat(Za.rawResults);
|
||||
}, [])
|
||||
})));
|
||||
}, Ya = function(Za, $a) {
|
||||
if (Za.transporter) {
|
||||
Za.transporter.responsesCache.set({
|
||||
}, $a = function(_a, ab) {
|
||||
if (_a.transporter) {
|
||||
_a.transporter.responsesCache.set({
|
||||
method: "search",
|
||||
args: [
|
||||
$a.rawResults.map(function(_a) {
|
||||
ab.rawResults.map(function(bb) {
|
||||
return {
|
||||
indexName: _a.index,
|
||||
params: _a.params
|
||||
indexName: bb.index,
|
||||
params: bb.params
|
||||
};
|
||||
}),
|
||||
]
|
||||
}, {
|
||||
results: $a.rawResults
|
||||
results: ab.rawResults
|
||||
});
|
||||
return;
|
||||
}
|
||||
var ab = "/1/indexes/*/queries_body_".concat(JSON.stringify({
|
||||
requests: $a.rawResults.map(function(bb) {
|
||||
var cb = "/1/indexes/*/queries_body_".concat(JSON.stringify({
|
||||
requests: ab.rawResults.map(function(db) {
|
||||
return {
|
||||
indexName: bb.index,
|
||||
params: bb.params
|
||||
indexName: db.index,
|
||||
params: db.params
|
||||
};
|
||||
})
|
||||
}));
|
||||
Za.cache = a.objectSpread({
|
||||
}, Za.cache, a.defineProperty({
|
||||
}, ab, JSON.stringify({
|
||||
results: $a.rawResults
|
||||
_a.cache = a.objectSpread({
|
||||
}, _a.cache, a.defineProperty({
|
||||
}, cb, JSON.stringify({
|
||||
results: ab.rawResults
|
||||
})));
|
||||
}, la = b(C, A, a.objectSpread({
|
||||
}, ma = b(C, A, a.objectSpread({
|
||||
}, d));
|
||||
h(C), la.on("search", function() {
|
||||
Da || (Da = setTimeout(function() {
|
||||
var cb = ya.getState(), db = cb.resultsFacetValues, eb = a.objectWithoutProperties(cb, ["resultsFacetValues"]);
|
||||
ya.setState(a.objectSpread({
|
||||
}, eb, {
|
||||
h(C), ma.on("search", function() {
|
||||
Fa || (Fa = setTimeout(function() {
|
||||
var eb = Aa.getState(), fb = eb.resultsFacetValues, gb = a.objectWithoutProperties(eb, ["resultsFacetValues"]);
|
||||
Aa.setState(a.objectSpread({
|
||||
}, gb, {
|
||||
isSearchStalled: !0
|
||||
}));
|
||||
}, E));
|
||||
}).on("result", sa({
|
||||
}).on("result", ua({
|
||||
indexId: A
|
||||
})).on("error", ta);
|
||||
var ja = !1, Da = null, Q = la.state, H = c(function() {
|
||||
var fb = F(ya.getState().widgets);
|
||||
ya.setState(a.objectSpread({
|
||||
}, ya.getState(), {
|
||||
metadata: fb,
|
||||
})).on("error", va);
|
||||
var ka = !1, Fa = null, Q = ma.state, H = c(function() {
|
||||
var hb = F(Aa.getState().widgets);
|
||||
Aa.setState(a.objectSpread({
|
||||
}, Aa.getState(), {
|
||||
metadata: hb,
|
||||
searching: !0
|
||||
})), ia();
|
||||
})), ja();
|
||||
});
|
||||
!function(gb, hb) {
|
||||
if (hb && (gb.transporter && !gb._cacheHydrated || gb._useCache && "function" == typeof gb.addAlgoliaAgent)) {
|
||||
if (gb.transporter && !gb._cacheHydrated) {
|
||||
gb._cacheHydrated = !0;
|
||||
var ib = gb.search;
|
||||
gb.search = function(jb) {
|
||||
for(var kb = arguments.length, lb = new Array(kb > 1 ? kb - 1 : 0), mb = 1; mb < kb; mb++)lb[mb - 1] = arguments[mb];
|
||||
var nb = jb.map(function(ob) {
|
||||
!function(ib, jb) {
|
||||
if (jb && (ib.transporter && !ib._cacheHydrated || ib._useCache && "function" == typeof ib.addAlgoliaAgent)) {
|
||||
if (ib.transporter && !ib._cacheHydrated) {
|
||||
ib._cacheHydrated = !0;
|
||||
var kb = ib.search;
|
||||
ib.search = function(lb) {
|
||||
for(var mb = arguments.length, nb = new Array(mb > 1 ? mb - 1 : 0), ob = 1; ob < mb; ob++)nb[ob - 1] = arguments[ob];
|
||||
var pb = lb.map(function(qb) {
|
||||
return a.objectSpread({
|
||||
}, ob, {
|
||||
params: function(pb) {
|
||||
var qb = function(rb) {
|
||||
for(var sb = arguments.length, tb = new Array(sb > 1 ? sb - 1 : 0), ub = 1; ub < sb; ub++)tb[ub - 1] = arguments[ub];
|
||||
var vb = 0;
|
||||
return rb.replace(/%s/g, function() {
|
||||
return encodeURIComponent(tb[vb++]);
|
||||
}, qb, {
|
||||
params: function(rb) {
|
||||
var sb = function(tb) {
|
||||
for(var ub = arguments.length, vb = new Array(ub > 1 ? ub - 1 : 0), wb = 1; wb < ub; wb++)vb[wb - 1] = arguments[wb];
|
||||
var xb = 0;
|
||||
return tb.replace(/%s/g, function() {
|
||||
return encodeURIComponent(vb[xb++]);
|
||||
});
|
||||
};
|
||||
return Object.keys(pb).map(function(wb) {
|
||||
var xb;
|
||||
return qb("%s=%s", wb, (xb = pb[wb], "[object Object]" === Object.prototype.toString.call(xb) || "[object Array]" === Object.prototype.toString.call(xb)) ? JSON.stringify(pb[wb]) : pb[wb]);
|
||||
return Object.keys(rb).map(function(yb) {
|
||||
var zb;
|
||||
return sb("%s=%s", yb, (zb = rb[yb], "[object Object]" === Object.prototype.toString.call(zb) || "[object Array]" === Object.prototype.toString.call(zb)) ? JSON.stringify(rb[yb]) : rb[yb]);
|
||||
}).join("&");
|
||||
}(ob.params)
|
||||
}(qb.params)
|
||||
});
|
||||
});
|
||||
return gb.transporter.responsesCache.get({
|
||||
return ib.transporter.responsesCache.get({
|
||||
method: "search",
|
||||
args: [
|
||||
nb
|
||||
].concat(a.toConsumableArray(lb))
|
||||
pb
|
||||
].concat(a.toConsumableArray(nb))
|
||||
}, function() {
|
||||
return ib.apply(void 0, [
|
||||
jb
|
||||
].concat(a.toConsumableArray(lb)));
|
||||
return kb.apply(void 0, [
|
||||
lb
|
||||
].concat(a.toConsumableArray(nb)));
|
||||
});
|
||||
};
|
||||
}
|
||||
if (Array.isArray(hb.results)) {
|
||||
Ka(gb, hb.results);
|
||||
if (Array.isArray(jb.results)) {
|
||||
Ma(ib, jb.results);
|
||||
return;
|
||||
}
|
||||
Ya(gb, hb);
|
||||
$a(ib, jb);
|
||||
}
|
||||
}(C, D);
|
||||
var yb, zb, Ab, ya = (zb = {
|
||||
var Ab, Bb, Cb, Aa = (Bb = {
|
||||
widgets: void 0 === B ? {
|
||||
} : B,
|
||||
metadata: Bb(D),
|
||||
results: (yb = D) ? Array.isArray(yb.results) ? yb.results.reduce(function(Cb, Db) {
|
||||
metadata: Db(D),
|
||||
results: (Ab = D) ? Array.isArray(Ab.results) ? Ab.results.reduce(function(Eb, Fb) {
|
||||
return a.objectSpread({
|
||||
}, Cb, a.defineProperty({
|
||||
}, Db._internalIndexId, new b.SearchResults(new b.SearchParameters(Db.state), Db.rawResults)));
|
||||
}, Eb, a.defineProperty({
|
||||
}, Fb._internalIndexId, new b.SearchResults(new b.SearchParameters(Fb.state), Fb.rawResults)));
|
||||
}, {
|
||||
}) : new b.SearchResults(new b.SearchParameters(yb.state), yb.rawResults) : null,
|
||||
}) : new b.SearchResults(new b.SearchParameters(Ab.state), Ab.rawResults) : null,
|
||||
error: null,
|
||||
searching: !1,
|
||||
isSearchStalled: !0,
|
||||
searchingForFacetValues: !1
|
||||
}, Ab = [], {
|
||||
}, Cb = [], {
|
||||
getState: function() {
|
||||
return zb;
|
||||
return Bb;
|
||||
},
|
||||
setState: function(Eb) {
|
||||
zb = Eb, Ab.forEach(function(Fb) {
|
||||
return Fb();
|
||||
setState: function(Gb) {
|
||||
Bb = Gb, Cb.forEach(function(Hb) {
|
||||
return Hb();
|
||||
});
|
||||
},
|
||||
subscribe: function(Gb) {
|
||||
return Ab.push(Gb), function() {
|
||||
Ab.splice(Ab.indexOf(Gb), 1);
|
||||
subscribe: function(Ib) {
|
||||
return Cb.push(Ib), function() {
|
||||
Cb.splice(Cb.indexOf(Ib), 1);
|
||||
};
|
||||
}
|
||||
});
|
||||
return {
|
||||
store: ya,
|
||||
store: Aa,
|
||||
widgetsManager: H,
|
||||
getWidgetsIds: function() {
|
||||
return ya.getState().metadata.reduce(function(Hb, Ib) {
|
||||
return void 0 !== Ib.id ? Hb.concat(Ib.id) : Hb;
|
||||
return Aa.getState().metadata.reduce(function(Jb, Kb) {
|
||||
return void 0 !== Kb.id ? Jb.concat(Kb.id) : Jb;
|
||||
}, []);
|
||||
},
|
||||
getSearchParameters: K,
|
||||
onSearchForFacetValues: function(Jb) {
|
||||
var Kb = Jb.facetName, Lb = Jb.query, Mb = Jb.maxFacetHits;
|
||||
ya.setState(a.objectSpread({
|
||||
}, ya.getState(), {
|
||||
onSearchForFacetValues: function(Lb) {
|
||||
var Mb = Lb.facetName, Nb = Lb.query, Ob = Lb.maxFacetHits;
|
||||
Aa.setState(a.objectSpread({
|
||||
}, Aa.getState(), {
|
||||
searchingForFacetValues: !0
|
||||
})), la.searchForFacetValues(Kb, Lb, Math.max(1, Math.min(void 0 === Mb ? 10 : Mb, 100))).then(function(Nb) {
|
||||
ya.setState(a.objectSpread({
|
||||
}, ya.getState(), {
|
||||
})), ma.searchForFacetValues(Mb, Nb, Math.max(1, Math.min(void 0 === Ob ? 10 : Ob, 100))).then(function(Pb) {
|
||||
Aa.setState(a.objectSpread({
|
||||
}, Aa.getState(), {
|
||||
error: null,
|
||||
searchingForFacetValues: !1,
|
||||
resultsFacetValues: a.objectSpread({
|
||||
}, ya.getState().resultsFacetValues, (j = {
|
||||
}, a.defineProperty(j, Kb, Nb.facetHits), a.defineProperty(j, "query", Lb), j))
|
||||
}, Aa.getState().resultsFacetValues, (j = {
|
||||
}, a.defineProperty(j, Mb, Pb.facetHits), a.defineProperty(j, "query", Nb), j))
|
||||
}));
|
||||
}, function(Ob) {
|
||||
ya.setState(a.objectSpread({
|
||||
}, ya.getState(), {
|
||||
}, function(Qb) {
|
||||
Aa.setState(a.objectSpread({
|
||||
}, Aa.getState(), {
|
||||
searchingForFacetValues: !1,
|
||||
error: Ob
|
||||
error: Qb
|
||||
}));
|
||||
}).catch(function(Pb) {
|
||||
}).catch(function(Rb) {
|
||||
setTimeout(function() {
|
||||
throw Pb;
|
||||
throw Rb;
|
||||
});
|
||||
});
|
||||
},
|
||||
onExternalStateUpdate: function(Qb) {
|
||||
var Rb = F(Qb);
|
||||
ya.setState(a.objectSpread({
|
||||
}, ya.getState(), {
|
||||
widgets: Qb,
|
||||
metadata: Rb,
|
||||
onExternalStateUpdate: function(Sb) {
|
||||
var Tb = F(Sb);
|
||||
Aa.setState(a.objectSpread({
|
||||
}, Aa.getState(), {
|
||||
widgets: Sb,
|
||||
metadata: Tb,
|
||||
searching: !0
|
||||
})), ia();
|
||||
})), ja();
|
||||
},
|
||||
transitionState: function(Sb) {
|
||||
var Tb = ya.getState().widgets;
|
||||
return H.getWidgets().filter(function(Ub) {
|
||||
return Boolean(Ub.transitionState);
|
||||
}).reduce(function(Vb, Wb) {
|
||||
return Wb.transitionState(Tb, Vb);
|
||||
}, Sb);
|
||||
transitionState: function(Ub) {
|
||||
var Vb = Aa.getState().widgets;
|
||||
return H.getWidgets().filter(function(Wb) {
|
||||
return Boolean(Wb.transitionState);
|
||||
}).reduce(function(Xb, Yb) {
|
||||
return Yb.transitionState(Vb, Xb);
|
||||
}, Ub);
|
||||
},
|
||||
updateClient: function(Xb) {
|
||||
h(Xb), la.setClient(Xb), ia();
|
||||
updateClient: function(Zb) {
|
||||
h(Zb), ma.setClient(Zb), ja();
|
||||
},
|
||||
updateIndex: function(Yb) {
|
||||
Q = Q.setIndex(Yb);
|
||||
updateIndex: function($b) {
|
||||
Q = Q.setIndex($b);
|
||||
},
|
||||
clearCache: function() {
|
||||
la.clearCache(), ia();
|
||||
ma.clearCache(), ja();
|
||||
},
|
||||
skipSearch: function() {
|
||||
ja = !0;
|
||||
ka = !0;
|
||||
}
|
||||
};
|
||||
};
|
||||
function Bb(Zb) {
|
||||
return Zb ? Zb.metadata.map(function($b) {
|
||||
function Db(_b) {
|
||||
return _b ? _b.metadata.map(function(ac) {
|
||||
return a.objectSpread({
|
||||
value: function() {
|
||||
return {
|
||||
};
|
||||
}
|
||||
}, $b, {
|
||||
items: $b.items && $b.items.map(function(_b) {
|
||||
}, ac, {
|
||||
items: ac.items && ac.items.map(function(bc) {
|
||||
return a.objectSpread({
|
||||
value: function() {
|
||||
return {
|
||||
};
|
||||
}
|
||||
}, _b, {
|
||||
items: _b.items && _b.items.map(function(ac) {
|
||||
}, bc, {
|
||||
items: bc.items && bc.items.map(function(cc) {
|
||||
return a.objectSpread({
|
||||
value: function() {
|
||||
return {
|
||||
};
|
||||
}
|
||||
}, ac);
|
||||
}, cc);
|
||||
})
|
||||
});
|
||||
})
|
||||
|
18
tests/vercel/loader-only/react-autowhatever/1/input/.swcrc
Normal file
18
tests/vercel/loader-only/react-autowhatever/1/input/.swcrc
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"jsc": {
|
||||
"target": "es5",
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"tsx": true
|
||||
},
|
||||
"transform": {
|
||||
"react": {
|
||||
"runtime": "automatic",
|
||||
"pragma": "React.createElement",
|
||||
"pragmaFrag": "React.Fragment",
|
||||
"throwIfNamespace": true,
|
||||
"useBuiltins": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
81
tests/vercel/loader-only/react-autowhatever/1/input/index.js
vendored
Normal file
81
tests/vercel/loader-only/react-autowhatever/1/input/index.js
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Item from './Item';
|
||||
import compareObjects from './compareObjects';
|
||||
|
||||
export default class ItemsList extends Component {
|
||||
static propTypes = {
|
||||
items: PropTypes.array.isRequired,
|
||||
itemProps: PropTypes.oneOfType([
|
||||
PropTypes.object,
|
||||
PropTypes.func
|
||||
]),
|
||||
renderItem: PropTypes.func.isRequired,
|
||||
renderItemData: PropTypes.object.isRequired,
|
||||
sectionIndex: PropTypes.number,
|
||||
highlightedItemIndex: PropTypes.number,
|
||||
onHighlightedItemChange: PropTypes.func.isRequired,
|
||||
getItemId: PropTypes.func.isRequired,
|
||||
theme: PropTypes.func.isRequired,
|
||||
keyPrefix: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
sectionIndex: null
|
||||
};
|
||||
|
||||
shouldComponentUpdate(nextProps) {
|
||||
return compareObjects(nextProps, this.props, ['itemProps']);
|
||||
}
|
||||
|
||||
storeHighlightedItemReference = highlightedItem => {
|
||||
this.props.onHighlightedItemChange(highlightedItem === null ? null : highlightedItem.item);
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
items, itemProps, renderItem, renderItemData, sectionIndex,
|
||||
highlightedItemIndex, getItemId, theme, keyPrefix
|
||||
} = this.props;
|
||||
const sectionPrefix = (sectionIndex === null ? keyPrefix : `${keyPrefix}section-${sectionIndex}-`);
|
||||
const isItemPropsFunction = (typeof itemProps === 'function');
|
||||
|
||||
return (
|
||||
<ul role="listbox" {...theme(`${sectionPrefix}items-list`, 'itemsList')}>
|
||||
{
|
||||
items.map((item, itemIndex) => {
|
||||
const isFirst = (itemIndex === 0);
|
||||
const isHighlighted = (itemIndex === highlightedItemIndex);
|
||||
const itemKey = `${sectionPrefix}item-${itemIndex}`;
|
||||
const itemPropsObj = isItemPropsFunction ? itemProps({ sectionIndex, itemIndex }) : itemProps;
|
||||
const allItemProps = {
|
||||
id: getItemId(sectionIndex, itemIndex),
|
||||
'aria-selected': isHighlighted,
|
||||
...theme(itemKey, 'item', isFirst && 'itemFirst', isHighlighted && 'itemHighlighted'),
|
||||
...itemPropsObj
|
||||
};
|
||||
|
||||
if (isHighlighted) {
|
||||
allItemProps.ref = this.storeHighlightedItemReference;
|
||||
}
|
||||
|
||||
// `key` is provided by theme()
|
||||
/* eslint-disable react/jsx-key */
|
||||
return (
|
||||
<Item
|
||||
{...allItemProps}
|
||||
sectionIndex={sectionIndex}
|
||||
isHighlighted={isHighlighted}
|
||||
itemIndex={itemIndex}
|
||||
item={item}
|
||||
renderItem={renderItem}
|
||||
renderItemData={renderItemData}
|
||||
/>
|
||||
);
|
||||
/* eslint-enable react/jsx-key */
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
}
|
176
tests/vercel/loader-only/react-autowhatever/1/output/index.js
vendored
Normal file
176
tests/vercel/loader-only/react-autowhatever/1/output/index.js
vendored
Normal file
@ -0,0 +1,176 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Item from './Item';
|
||||
import compareObjects from './compareObjects';
|
||||
function _assertThisInitialized(self) {
|
||||
if (self === void 0) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
}
|
||||
return self;
|
||||
}
|
||||
function _classCallCheck(instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
}
|
||||
function _defineProperties(target, props) {
|
||||
for(var i = 0; i < props.length; i++){
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if ("value" in descriptor) descriptor.writable = true;
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
}
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function _getPrototypeOf(o) {
|
||||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
||||
return o.__proto__ || Object.getPrototypeOf(o);
|
||||
};
|
||||
return _getPrototypeOf(o);
|
||||
}
|
||||
function _inherits(subClass, superClass) {
|
||||
if (typeof superClass !== "function" && superClass !== null) {
|
||||
throw new TypeError("Super expression must either be null or a function");
|
||||
}
|
||||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
||||
constructor: {
|
||||
value: subClass,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
if (superClass) _setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
function _objectSpread(target) {
|
||||
for(var i = 1; i < arguments.length; i++){
|
||||
var source = arguments[i] != null ? arguments[i] : {
|
||||
};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === "function") {
|
||||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
}));
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
function _possibleConstructorReturn(self, call) {
|
||||
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
||||
return call;
|
||||
}
|
||||
return _assertThisInitialized(self);
|
||||
}
|
||||
function _setPrototypeOf(o, p) {
|
||||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
var _typeof = function(obj) {
|
||||
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
||||
};
|
||||
var ItemsList = /*#__PURE__*/ function(Component) {
|
||||
"use strict";
|
||||
_inherits(ItemsList, Component);
|
||||
function ItemsList() {
|
||||
_classCallCheck(this, ItemsList);
|
||||
var _this;
|
||||
_this = _possibleConstructorReturn(this, _getPrototypeOf(ItemsList).apply(this, arguments));
|
||||
_this.storeHighlightedItemReference = function(highlightedItem) {
|
||||
_this.props.onHighlightedItemChange(highlightedItem === null ? null : highlightedItem.item);
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
_createClass(ItemsList, [
|
||||
{
|
||||
key: "shouldComponentUpdate",
|
||||
value: function shouldComponentUpdate(nextProps) {
|
||||
return compareObjects(nextProps, this.props, [
|
||||
'itemProps'
|
||||
]);
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this = this;
|
||||
var _props = this.props, items = _props.items, itemProps = _props.itemProps, renderItem = _props.renderItem, renderItemData = _props.renderItemData, sectionIndex = _props.sectionIndex, highlightedItemIndex = _props.highlightedItemIndex, getItemId = _props.getItemId, theme = _props.theme, keyPrefix = _props.keyPrefix;
|
||||
var sectionPrefix = sectionIndex === null ? keyPrefix : "".concat(keyPrefix, "section-").concat(sectionIndex, "-");
|
||||
var isItemPropsFunction = typeof itemProps === 'function';
|
||||
return(/*#__PURE__*/ _jsx("ul", _objectSpread({
|
||||
role: "listbox"
|
||||
}, theme("".concat(sectionPrefix, "items-list"), 'itemsList'), {
|
||||
children: items.map(function(item, itemIndex) {
|
||||
var isFirst = itemIndex === 0;
|
||||
var isHighlighted = itemIndex === highlightedItemIndex;
|
||||
var itemKey = "".concat(sectionPrefix, "item-").concat(itemIndex);
|
||||
var itemPropsObj = isItemPropsFunction ? itemProps({
|
||||
sectionIndex: sectionIndex,
|
||||
itemIndex: itemIndex
|
||||
}) : itemProps;
|
||||
var allItemProps = _objectSpread({
|
||||
id: getItemId(sectionIndex, itemIndex),
|
||||
'aria-selected': isHighlighted
|
||||
}, theme(itemKey, 'item', isFirst && 'itemFirst', isHighlighted && 'itemHighlighted'), itemPropsObj);
|
||||
if (isHighlighted) {
|
||||
allItemProps.ref = _this.storeHighlightedItemReference;
|
||||
}
|
||||
// `key` is provided by theme()
|
||||
/* eslint-disable react/jsx-key */ return(/*#__PURE__*/ _jsx(Item, _objectSpread({
|
||||
}, allItemProps, {
|
||||
sectionIndex: sectionIndex,
|
||||
isHighlighted: isHighlighted,
|
||||
itemIndex: itemIndex,
|
||||
item: item,
|
||||
renderItem: renderItem,
|
||||
renderItemData: renderItemData
|
||||
})));
|
||||
/* eslint-enable react/jsx-key */ })
|
||||
})));
|
||||
}
|
||||
}
|
||||
]);
|
||||
return ItemsList;
|
||||
}(Component);
|
||||
ItemsList.propTypes = {
|
||||
items: PropTypes.array.isRequired,
|
||||
itemProps: PropTypes.oneOfType([
|
||||
PropTypes.object,
|
||||
PropTypes.func
|
||||
]),
|
||||
renderItem: PropTypes.func.isRequired,
|
||||
renderItemData: PropTypes.object.isRequired,
|
||||
sectionIndex: PropTypes.number,
|
||||
highlightedItemIndex: PropTypes.number,
|
||||
onHighlightedItemChange: PropTypes.func.isRequired,
|
||||
getItemId: PropTypes.func.isRequired,
|
||||
theme: PropTypes.func.isRequired,
|
||||
keyPrefix: PropTypes.string.isRequired
|
||||
};
|
||||
ItemsList.defaultProps = {
|
||||
sectionIndex: null
|
||||
};
|
||||
export { ItemsList as default };
|
Loading…
Reference in New Issue
Block a user