1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-04 02:09:22 +02:00
Daniel Neto 2023-06-30 08:55:17 -03:00
parent 746e163d01
commit 1c7ea28b46
808 changed files with 316395 additions and 381162 deletions

View file

@ -25,10 +25,6 @@ export default function computeAutoPlacement(state, options) {
if (allowedPlacements.length === 0) {
allowedPlacements = placements;
if (process.env.NODE_ENV !== "production") {
console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' '));
}
} // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...

View file

@ -55,18 +55,6 @@ export default function computeAutoPlacement(
if (allowedPlacements.length === 0) {
allowedPlacements = placements;
if (false) {
console.error(
[
'Popper: The `allowedAutoPlacements` option did not allow any',
'placements. Ensure the `placement` option matches the variation',
'of the allowed placements.',
'For example, "auto" cannot be used to allow "bottom-start".',
'Use "auto-start" instead.',
].join(' ')
);
}
}
// $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...

View file

@ -1 +0,0 @@
export default function format(str: string, ...args: Array<string>): string;

View file

@ -1,9 +0,0 @@
export default function format(str) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return [].concat(args).reduce(function (p, c) {
return p.replace(/%s/, c);
}, str);
}

View file

@ -1,5 +0,0 @@
// @flow
export default function format(str: string, ...args: Array<string>) {
return [...args].reduce((p, c) => p.replace(/%s/, c), str);
}

View file

@ -1,7 +1,7 @@
export default function getUAString() {
var uaData = navigator.userAgentData;
if (uaData != null && uaData.brands) {
if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
return uaData.brands.map(function (item) {
return item.brand + "/" + item.version;
}).join(' ');

View file

@ -10,7 +10,7 @@ interface NavigatorUAData {
export default function getUAString(): string {
const uaData = (navigator: Navigator).userAgentData;
if (uaData?.brands) {
if (uaData?.brands && Array.isArray(uaData.brands)) {
return uaData.brands
.map((item) => `${item.brand}/${item.version}`)
.join(' ');

View file

@ -1 +0,0 @@
export default function validateModifiers(modifiers: Array<any>): void;

View file

@ -1,81 +0,0 @@
import format from "./format.js";
import { modifierPhases } from "../enums.js";
var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
export default function validateModifiers(modifiers) {
modifiers.forEach(function (modifier) {
[].concat(Object.keys(modifier), VALID_PROPERTIES) // IE11-compatible replacement for `new Set(iterable)`
.filter(function (value, index, self) {
return self.indexOf(value) === index;
}).forEach(function (key) {
switch (key) {
case 'name':
if (typeof modifier.name !== 'string') {
console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
}
break;
case 'enabled':
if (typeof modifier.enabled !== 'boolean') {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
}
break;
case 'phase':
if (modifierPhases.indexOf(modifier.phase) < 0) {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
}
break;
case 'fn':
if (typeof modifier.fn !== 'function') {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
}
break;
case 'effect':
if (modifier.effect != null && typeof modifier.effect !== 'function') {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
}
break;
case 'requires':
if (modifier.requires != null && !Array.isArray(modifier.requires)) {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
}
break;
case 'requiresIfExists':
if (!Array.isArray(modifier.requiresIfExists)) {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
}
break;
case 'options':
case 'data':
break;
default:
console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
return "\"" + s + "\"";
}).join(', ') + "; but \"" + key + "\" was provided.");
}
modifier.requires && modifier.requires.forEach(function (requirement) {
if (modifiers.find(function (mod) {
return mod.name === requirement;
}) == null) {
console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
}
});
});
});
}

View file

@ -1,151 +0,0 @@
// @flow
import format from './format';
import { modifierPhases } from '../enums';
const INVALID_MODIFIER_ERROR =
'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
const MISSING_DEPENDENCY_ERROR =
'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
const VALID_PROPERTIES = [
'name',
'enabled',
'phase',
'fn',
'effect',
'requires',
'options',
];
export default function validateModifiers(modifiers: Array<any>): void {
modifiers.forEach((modifier) => {
[...Object.keys(modifier), ...VALID_PROPERTIES]
// IE11-compatible replacement for `new Set(iterable)`
.filter((value, index, self) => self.indexOf(value) === index)
.forEach((key) => {
switch (key) {
case 'name':
if (typeof modifier.name !== 'string') {
console.error(
format(
INVALID_MODIFIER_ERROR,
String(modifier.name),
'"name"',
'"string"',
`"${String(modifier.name)}"`
)
);
}
break;
case 'enabled':
if (typeof modifier.enabled !== 'boolean') {
console.error(
format(
INVALID_MODIFIER_ERROR,
modifier.name,
'"enabled"',
'"boolean"',
`"${String(modifier.enabled)}"`
)
);
}
break;
case 'phase':
if (modifierPhases.indexOf(modifier.phase) < 0) {
console.error(
format(
INVALID_MODIFIER_ERROR,
modifier.name,
'"phase"',
`either ${modifierPhases.join(', ')}`,
`"${String(modifier.phase)}"`
)
);
}
break;
case 'fn':
if (typeof modifier.fn !== 'function') {
console.error(
format(
INVALID_MODIFIER_ERROR,
modifier.name,
'"fn"',
'"function"',
`"${String(modifier.fn)}"`
)
);
}
break;
case 'effect':
if (
modifier.effect != null &&
typeof modifier.effect !== 'function'
) {
console.error(
format(
INVALID_MODIFIER_ERROR,
modifier.name,
'"effect"',
'"function"',
`"${String(modifier.fn)}"`
)
);
}
break;
case 'requires':
if (
modifier.requires != null &&
!Array.isArray(modifier.requires)
) {
console.error(
format(
INVALID_MODIFIER_ERROR,
modifier.name,
'"requires"',
'"array"',
`"${String(modifier.requires)}"`
)
);
}
break;
case 'requiresIfExists':
if (!Array.isArray(modifier.requiresIfExists)) {
console.error(
format(
INVALID_MODIFIER_ERROR,
modifier.name,
'"requiresIfExists"',
'"array"',
`"${String(modifier.requiresIfExists)}"`
)
);
}
break;
case 'options':
case 'data':
break;
default:
console.error(
`PopperJS: an invalid property has been provided to the "${
modifier.name
}" modifier, valid properties are ${VALID_PROPERTIES.map(
(s) => `"${s}"`
).join(', ')}; but "${key}" was provided.`
);
}
modifier.requires &&
modifier.requires.forEach((requirement) => {
if (modifiers.find((mod) => mod.name === requirement) == null) {
console.error(
format(
MISSING_DEPENDENCY_ERROR,
String(modifier.name),
requirement,
requirement
)
);
}
});
});
});
}