1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 17:59:55 +02:00

Moving to node_modules folder to make easier to upgrade

trying to move from Bootstrap 3 to Bootstrap 5
This commit is contained in:
Daniel 2021-10-26 14:52:45 -03:00
parent 047e363a16
commit d4d042e041
8460 changed files with 1355889 additions and 547977 deletions

83
node_modules/fizzy-ui-utils/README.md generated vendored Normal file
View file

@ -0,0 +1,83 @@
# Fizzy UI utils
UI utility & helper functions
Used in [Flickity](https://flickity.metafizzy.co), [Isotope](https://isotope.metafizzy.co), [Masonry](https://masonry.desandro.com), [Draggabilly](https://draggabilly.desandro.com)
## Install
npm: `npm install fizzy-ui-utils`
Yarn: `yarn add fizzy-ui-utils`
## API
``` js
// browser global
const utils = window.fizzyUIUtils;
// CommonJS
const utils = require('fizzy-ui-utils');
// JavaScript module
import utils from 'fizzy-ui-utils';
// ---- ---- //
utils.makeArray( obj )
// make array from object
// makeArray('single object') => [ 'single object' ]
utils.modulo( num, div )
// num [modulo] div
utils.removeFrom( ary, obj )
// remove object from array
utils.getQueryElement( elem )
// if elem is a string, use it as a selector and return element
MyClass.prototype.handleEvent = utils.handleEvent;
// enable MyClass.onclick when element.addEventListener( 'click', this, false )
utils.filterFindElements( elems, selector )
// iterate through elems, filter and find all elements that match selector
utils.debounceMethod( MyClass, methodName, threhold )
// debounce a class method
utils.docReady( callback )
// trigger callback on document ready
utils.toDashed( str )
// 'camelCaseString' -> 'camel-case-string'
utils.htmlInit( MyClass, namespace )
// on document ready, initialize MyClass on every element
// that matches [data-my-class] attribute
// pass in JSON options from attribute value
```
**Legacy API** The following methods were available in v2, and still available in v3, but should be avoided in favor of native browser API
``` js
utils.extend( a, b )
// extend object
// use Object.assign() or { ...obj } instead
utils.getParent( elem, selector )
// get parent element of an element, given a selector string
// use elem.closest( selector ) instead
```
## Browser support
Fizzy UI utils uses ES2018 features like spread operators and arrow functions. As such its browser support is: Chrome 46+, Firefox 34+, Safari 10+, and Edge 12+.
For older browser support, including IE10 and Android 4, [try v2](https://github.com/metafizzy/fizzy-ui-utils/tree/v2.0.7).
---
[MIT license](https://desandro.mit-license.org/). Have at it.
By [Metafizzy 🌈🐻](https://metafizzy.co)

31
node_modules/fizzy-ui-utils/bower.json generated vendored Normal file
View file

@ -0,0 +1,31 @@
{
"name": "fizzy-ui-utils",
"authors": [
"David DeSandro"
],
"description": "UI utilities",
"main": "utils.js",
"dependencies": {
},
"moduleType": [
"amd",
"globals",
"node"
],
"keywords": [
"utility",
"ui"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests",
"package.json"
],
"devDependencies": {
"qunit": "~1.20.0"
}
}

76
node_modules/fizzy-ui-utils/package.json generated vendored Normal file
View file

@ -0,0 +1,76 @@
{
"_from": "fizzy-ui-utils@^3.0.0",
"_id": "fizzy-ui-utils@3.0.0",
"_inBundle": false,
"_integrity": "sha512-uJj38QFQiJ/KCio5tiZhwAjIbTXSIgzBCKdKVbaYfLS053F6z23Nb0o1ZoO9gnxOQWN7BCc35jsvrCtAq3gY9g==",
"_location": "/fizzy-ui-utils",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "fizzy-ui-utils@^3.0.0",
"name": "fizzy-ui-utils",
"escapedName": "fizzy-ui-utils",
"rawSpec": "^3.0.0",
"saveSpec": null,
"fetchSpec": "^3.0.0"
},
"_requiredBy": [
"/infinite-scroll"
],
"_resolved": "https://registry.npmjs.org/fizzy-ui-utils/-/fizzy-ui-utils-3.0.0.tgz",
"_shasum": "cc5e876eea263d3d92828a3144745dbd7b972fc8",
"_spec": "fizzy-ui-utils@^3.0.0",
"_where": "G:\\GDrive\\htdocs\\YouPHPTube\\node_modules\\infinite-scroll",
"author": {
"name": "David DeSandro"
},
"bugs": {
"url": "https://github.com/metafizzy/fizzy-ui-utils/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "UI utilities",
"devDependencies": {
"eslint": "^7.15.0",
"eslint-plugin-metafizzy": "^1.1.2",
"qunit": "^2.13.0"
},
"eslintConfig": {
"plugins": [
"metafizzy"
],
"extends": "plugin:metafizzy/browser",
"parserOptions": {
"ecmaVersion": 2018
},
"env": {
"browser": true,
"commonjs": true
},
"globals": {
"QUnit": "readonly",
"fizzyUIUtils": "readonly"
}
},
"homepage": "https://github.com/metafizzy/fizzy-ui-utils",
"keywords": [
"ui",
"utility",
"browser",
"DOM"
],
"license": "MIT",
"main": "utils.js",
"name": "fizzy-ui-utils",
"repository": {
"type": "git",
"url": "git://github.com/metafizzy/fizzy-ui-utils.git"
},
"scripts": {
"lint": "npx eslint .",
"test": "npm run lint && echo \"view test/index.html in a browser\""
},
"version": "3.0.0"
}

60
node_modules/fizzy-ui-utils/test/index.html generated vendored Normal file
View file

@ -0,0 +1,60 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>fizzy-ui-utils test</title>
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css" />
</head>
<body>
<div id="qunit"></div>
<div class="grid grid-a">
<div class="item item-a0"></div>
<div class="item item-a1"></div>
<div class="item item-a2"></div>
<div class="item item-a3">
<ul>
<li>
<p>
<span class="span-a3"></span>
</p>
</li>
</ul>
</div>
</div>
<div class="grid grid-b">
<div class="item"></div>
<div class="item"></div>
<div>
<div class="item"></div>
</div>
<div>
<ul>
<li>
<div class="item"></div>
</li>
</ul>
</div>
</div>
<p data-nice-greeter data-greeter-expected="hello world"></p>
<p data-nice-greeter='{ "greeting": "bonjour", "recipient": "mon ami" }'
data-greeter-expected="bonjour mon ami"></p>
<script src="../node_modules/qunit/qunit/qunit.js"></script>
<script src="../utils.js"></script>
<script src="unit/make-array.js"></script>
<script src="unit/remove-from.js"></script>
<script src="unit/get-parent.js"></script>
<script src="unit/filter-find-elements.js"></script>
<script src="unit/html-init.js"></script>
</body>
</html>

View file

@ -0,0 +1,8 @@
QUnit.test( 'filterFindElements', function( assert ) {
let gridB = document.querySelector('.grid-b');
let itemElems = fizzyUIUtils.filterFindElements( gridB.children, '.item' );
assert.equal( itemElems.length, 4, '4 items filter/found' );
} );

30
node_modules/fizzy-ui-utils/test/unit/get-parent.js generated vendored Normal file
View file

@ -0,0 +1,30 @@
QUnit.test( 'getParent', function( assert ) {
let getParent = fizzyUIUtils.getParent;
let gridA = document.querySelector('.grid-a');
let itemA1 = document.querySelector('.item-a1');
let parent = getParent( itemA1, '.grid' );
assert.equal( parent, gridA, 'got grid parent from item' );
parent = getParent( document.querySelector('.span-a3'), '.grid' );
assert.equal( parent, gridA, 'got grid parent from span' );
parent = getParent( itemA1, '#qunit' );
assert.ok( parent === undefined, 'parent not tree is undefined' );
let treeNotInDocument = document.createElement('div');
treeNotInDocument.innerHTML =
'<div class="a">' +
'<div class="a1">' +
'</div>';
parent = getParent( treeNotInDocument.querySelector('.a1'), '.not-found' );
assert.ok(
parent === undefined,
'Parent should be `undefined` even when the given tree is not in the document',
);
} );

23
node_modules/fizzy-ui-utils/test/unit/html-init.js generated vendored Normal file
View file

@ -0,0 +1,23 @@
QUnit.test( 'htmlInit', function( assert ) {
fizzyUIUtils.htmlInit( NiceGreeter, 'niceGreeter' );
let done = assert.async();
fizzyUIUtils.docReady( function() {
let greeterElems = document.querySelectorAll('[data-greeter-expected]');
for ( let i = 0; i < greeterElems.length; i++ ) {
let greeterElem = greeterElems[i];
let attr = greeterElem.getAttribute('data-greeter-expected');
assert.equal( greeterElem.textContent, attr, 'textContent matches options' );
}
done();
} );
} );
function NiceGreeter( elem, options ) {
this.element = elem;
let greeting = options && options.greeting || 'hello';
let recipient = options && options.recipient || 'world';
this.element.textContent = greeting + ' ' + recipient;
}

34
node_modules/fizzy-ui-utils/test/unit/make-array.js generated vendored Normal file
View file

@ -0,0 +1,34 @@
QUnit.test( 'makeArray', function( assert ) {
let makeArray = fizzyUIUtils.makeArray;
let aryA = [ 0, 1, 2 ];
let aryB = makeArray( aryA );
assert.deepEqual( aryA, aryB, 'makeArray on array returns same array' );
let itemElems = document.querySelectorAll('.grid-a .item');
let items = makeArray( itemElems );
assert.ok( Array.isArray( items ), 'makeArray on querySelectorAll NodeList' );
assert.equal( items.length, itemElems.length, 'length matches' );
let grids = makeArray( document.querySelector('.grid-a') );
assert.ok( Array.isArray( grids ), 'makeArray on single element is array' );
assert.equal( grids.length, 1, 'length = 1' );
let empty = makeArray();
assert.deepEqual( empty, [], 'makeArray on undefined is empty array' );
assert.equal( empty.length, 0, 'length = 0' );
assert.ok( empty[0] === undefined, '[0] is undefined' );
// isotope#1235
let aryC = makeArray('foo');
assert.deepEqual( aryC, [ 'foo' ], 'string turns to single array item' );
let nullAry = makeArray( null );
assert.deepEqual( nullAry, [], 'makeArray(null) returns empty array' );
let falseAry = makeArray( false );
assert.deepEqual( falseAry, [ false ], 'makeArray(false) returns array with false' );
assert.equal( falseAry.length, 1, 'falseyAry has 1 item' );
} );

13
node_modules/fizzy-ui-utils/test/unit/remove-from.js generated vendored Normal file
View file

@ -0,0 +1,13 @@
QUnit.test( 'removeFrom', function( assert ) {
let removeFrom = fizzyUIUtils.removeFrom;
let ary = [ 0, 1, 2, 3, 4, 5, 6 ];
removeFrom( ary, 2 );
let ary2 = [ 0, 1, 3, 4, 5, 6 ];
assert.deepEqual( ary, ary2, '2 removed' );
removeFrom( ary, 8 );
assert.deepEqual( ary, ary2, '8 not removed' );
} );

196
node_modules/fizzy-ui-utils/utils.js generated vendored Normal file
View file

@ -0,0 +1,196 @@
/**
* Fizzy UI utils v3.0.0
* MIT license
*/
( function( global, factory ) {
// universal module definition
if ( typeof module == 'object' && module.exports ) {
// CommonJS
module.exports = factory( global );
} else {
// browser global
global.fizzyUIUtils = factory( global );
}
}( this, function factory( global ) {
let utils = {};
// ----- extend ----- //
// extends objects
utils.extend = function( a, b ) {
return Object.assign( a, b );
};
// ----- modulo ----- //
utils.modulo = function( num, div ) {
return ( ( num % div ) + div ) % div;
};
// ----- makeArray ----- //
// turn element or nodeList into an array
utils.makeArray = function( obj ) {
// use object if already an array
if ( Array.isArray( obj ) ) return obj;
// return empty array if undefined or null. #6
if ( obj === null || obj === undefined ) return [];
let isArrayLike = typeof obj == 'object' && typeof obj.length == 'number';
// convert nodeList to array
if ( isArrayLike ) return [ ...obj ];
// array of single index
return [ obj ];
};
// ----- removeFrom ----- //
utils.removeFrom = function( ary, obj ) {
let index = ary.indexOf( obj );
if ( index != -1 ) {
ary.splice( index, 1 );
}
};
// ----- getParent ----- //
utils.getParent = function( elem, selector ) {
while ( elem.parentNode && elem != document.body ) {
elem = elem.parentNode;
if ( elem.matches( selector ) ) return elem;
}
};
// ----- getQueryElement ----- //
// use element as selector string
utils.getQueryElement = function( elem ) {
if ( typeof elem == 'string' ) {
return document.querySelector( elem );
}
return elem;
};
// ----- handleEvent ----- //
// enable .ontype to trigger from .addEventListener( elem, 'type' )
utils.handleEvent = function( event ) {
let method = 'on' + event.type;
if ( this[ method ] ) {
this[ method ]( event );
}
};
// ----- filterFindElements ----- //
utils.filterFindElements = function( elems, selector ) {
// make array of elems
elems = utils.makeArray( elems );
return elems
// check that elem is an actual element
.filter( ( elem ) => elem instanceof HTMLElement )
.reduce( ( ffElems, elem ) => {
// add elem if no selector
if ( !selector ) {
ffElems.push( elem );
return ffElems;
}
// filter & find items if we have a selector
// filter
if ( elem.matches( selector ) ) {
ffElems.push( elem );
}
// find children
let childElems = elem.querySelectorAll( selector );
// concat childElems to filterFound array
ffElems = ffElems.concat( ...childElems );
return ffElems;
}, [] );
};
// ----- debounceMethod ----- //
utils.debounceMethod = function( _class, methodName, threshold ) {
threshold = threshold || 100;
// original method
let method = _class.prototype[ methodName ];
let timeoutName = methodName + 'Timeout';
_class.prototype[ methodName ] = function() {
clearTimeout( this[ timeoutName ] );
let args = arguments;
this[ timeoutName ] = setTimeout( () => {
method.apply( this, args );
delete this[ timeoutName ];
}, threshold );
};
};
// ----- docReady ----- //
utils.docReady = function( onDocReady ) {
let readyState = document.readyState;
if ( readyState == 'complete' || readyState == 'interactive' ) {
// do async to allow for other scripts to run. metafizzy/flickity#441
setTimeout( onDocReady );
} else {
document.addEventListener( 'DOMContentLoaded', onDocReady );
}
};
// ----- htmlInit ----- //
// http://bit.ly/3oYLusc
utils.toDashed = function( str ) {
return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) {
return $1 + '-' + $2;
} ).toLowerCase();
};
let console = global.console;
// allow user to initialize classes via [data-namespace] or .js-namespace class
// htmlInit( Widget, 'widgetName' )
// options are parsed from data-namespace-options
utils.htmlInit = function( WidgetClass, namespace ) {
utils.docReady( function() {
let dashedNamespace = utils.toDashed( namespace );
let dataAttr = 'data-' + dashedNamespace;
let dataAttrElems = document.querySelectorAll( `[${dataAttr}]` );
let jQuery = global.jQuery;
[ ...dataAttrElems ].forEach( ( elem ) => {
let attr = elem.getAttribute( dataAttr );
let options;
try {
options = attr && JSON.parse( attr );
} catch ( error ) {
// log error, do not initialize
if ( console ) {
console.error( `Error parsing ${dataAttr} on ${elem.className}: ${error}` );
}
return;
}
// initialize
let instance = new WidgetClass( elem, options );
// make available via $().data('namespace')
if ( jQuery ) {
jQuery.data( elem, namespace, instance );
}
} );
} );
};
// ----- ----- //
return utils;
} ) );