mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update shared components
This commit is contained in:
parent
b29e4cd59d
commit
0a1cafc981
11 changed files with 306 additions and 66 deletions
|
@ -16,12 +16,12 @@
|
|||
},
|
||||
"devDependencies": {},
|
||||
"ignore": [],
|
||||
"version": "1.1.49",
|
||||
"_release": "1.1.49",
|
||||
"version": "1.1.50",
|
||||
"_release": "1.1.50",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "1.1.49",
|
||||
"commit": "6fe9a4ae4aa727695fbd17a40486065ce46c0892"
|
||||
"tag": "1.1.50",
|
||||
"commit": "d9bc0ad32357f2302171b6d592a792c1361ddc55"
|
||||
},
|
||||
"_source": "git://github.com/MediaBrowser/emby-webcomponents.git",
|
||||
"_target": "~1.1.5",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define(['loading', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'browser'], function (loading, viewManager, skinManager, pluginManager, backdrop, browser) {
|
||||
define(['loading', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'browser', 'pageJs'], function (loading, viewManager, skinManager, pluginManager, backdrop, browser, page) {
|
||||
|
||||
var connectionManager;
|
||||
|
||||
|
|
|
@ -32,14 +32,14 @@
|
|||
"web-component-tester": "^4.0.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"homepage": "https://github.com/PolymerElements/iron-icon",
|
||||
"homepage": "https://github.com/polymerelements/iron-icon",
|
||||
"_release": "1.0.8",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.8",
|
||||
"commit": "f36b38928849ef3853db727faa8c9ef104d611eb"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/iron-icon.git",
|
||||
"_source": "git://github.com/polymerelements/iron-icon.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "PolymerElements/iron-icon"
|
||||
"_originalSource": "polymerelements/iron-icon"
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
{
|
||||
"name": "query-string",
|
||||
"homepage": "https://github.com/sindresorhus/query-string",
|
||||
"version": "3.0.1",
|
||||
"_release": "3.0.1",
|
||||
"version": "2.3.0",
|
||||
"_release": "2.3.0",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v3.0.1",
|
||||
"commit": "9fbb928f67f493a7a7458cdb82c15b40ceb4124b"
|
||||
"tag": "2.3.0",
|
||||
"commit": "89837373db79e73fb8bade647b46c188c69d761a"
|
||||
},
|
||||
"_source": "git://github.com/sindresorhus/query-string.git",
|
||||
"_target": "~3.0.1",
|
||||
"_target": "~2.3.0",
|
||||
"_originalSource": "query-string",
|
||||
"_direct": true
|
||||
}
|
12
dashboard-ui/bower_components/query-string/.jshintrc
vendored
Normal file
12
dashboard-ui/bower_components/query-string/.jshintrc
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"node": true,
|
||||
"esnext": true,
|
||||
"bitwise": true,
|
||||
"curly": true,
|
||||
"immed": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"undef": true,
|
||||
"unused": "vars",
|
||||
"strict": true
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- 'stable'
|
||||
- 'iojs'
|
||||
- '0.12'
|
||||
- '0.10'
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
'use strict';
|
||||
var strictUriEncode = require('strict-uri-encode');
|
||||
|
||||
exports.extract = function (str) {
|
||||
return str.split('?')[1] || '';
|
||||
window.queryString = {};
|
||||
window.queryString.extract = function (maybeUrl) {
|
||||
return maybeUrl.split('?')[1] || '';
|
||||
};
|
||||
|
||||
exports.parse = function (str) {
|
||||
window.queryString.parse = function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
return {};
|
||||
}
|
||||
|
@ -18,13 +18,10 @@ exports.parse = function (str) {
|
|||
|
||||
return str.split('&').reduce(function (ret, param) {
|
||||
var parts = param.replace(/\+/g, ' ').split('=');
|
||||
// Firefox (pre 40) decodes `%3D` to `=`
|
||||
// https://github.com/sindresorhus/query-string/pull/37
|
||||
var key = parts.shift();
|
||||
var val = parts.length > 0 ? parts.join('=') : undefined;
|
||||
var key = parts[0];
|
||||
var val = parts[1];
|
||||
|
||||
key = decodeURIComponent(key);
|
||||
|
||||
// missing `=` should be `null`:
|
||||
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
|
||||
val = val === undefined ? null : decodeURIComponent(val);
|
||||
|
@ -41,26 +38,16 @@ exports.parse = function (str) {
|
|||
}, {});
|
||||
};
|
||||
|
||||
exports.stringify = function (obj) {
|
||||
window.queryString.stringify = function (obj) {
|
||||
return obj ? Object.keys(obj).sort().map(function (key) {
|
||||
var val = obj[key];
|
||||
|
||||
if (val === undefined) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (val === null) {
|
||||
return key;
|
||||
}
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
return val.slice().sort().map(function (val2) {
|
||||
return strictUriEncode(key) + '=' + strictUriEncode(val2);
|
||||
return val.sort().map(function (val2) {
|
||||
return encodeURIComponent(key) + '=' + encodeURIComponent(val2);
|
||||
}).join('&');
|
||||
}
|
||||
|
||||
return strictUriEncode(key) + '=' + strictUriEncode(val);
|
||||
}).filter(function (x) {
|
||||
return x.length > 0;
|
||||
return encodeURIComponent(key) + '=' + encodeURIComponent(val);
|
||||
}).join('&') : '';
|
||||
};
|
||||
|
|
|
@ -1,23 +1,7 @@
|
|||
{
|
||||
"name": "query-string",
|
||||
"version": "3.0.1",
|
||||
"version": "2.3.0",
|
||||
"description": "Parse and stringify URL query strings",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/query-string",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"browser",
|
||||
"querystring",
|
||||
|
@ -33,11 +17,23 @@
|
|||
"encode",
|
||||
"decode"
|
||||
],
|
||||
"dependencies": {
|
||||
"strict-uri-encode": "^1.0.0"
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"repository": "sindresorhus/query-string",
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
"mocha": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,19 +13,19 @@ $ npm install --save query-string
|
|||
## Usage
|
||||
|
||||
```js
|
||||
const queryString = require('query-string');
|
||||
var queryString = require('query-string');
|
||||
|
||||
console.log(location.search);
|
||||
//=> '?foo=bar'
|
||||
//=> ?foo=bar
|
||||
|
||||
const parsed = queryString.parse(location.search);
|
||||
var parsed = queryString.parse(location.search);
|
||||
console.log(parsed);
|
||||
//=> {foo: 'bar'}
|
||||
|
||||
console.log(location.hash);
|
||||
//=> '#token=bada55cafe'
|
||||
//=> #token=bada55cafe
|
||||
|
||||
const parsedHash = queryString.parse(location.hash);
|
||||
var parsedHash = queryString.parse(location.hash);
|
||||
console.log(parsedHash);
|
||||
//=> {token: 'bada55cafe'}
|
||||
|
||||
|
@ -35,7 +35,7 @@ parsed.ilike = 'pizza';
|
|||
location.search = queryString.stringify(parsed);
|
||||
|
||||
console.log(location.search);
|
||||
//=> '?foo=unicorn&ilike=pizza'
|
||||
//=> ?foo=unicorn&ilike=pizza
|
||||
```
|
||||
|
||||
|
||||
|
@ -56,7 +56,7 @@ Extract a query string from a URL that can be passed into `.parse()`.
|
|||
|
||||
## Nesting
|
||||
|
||||
This module intentionally doesn't support nesting as it's not spec'd and varies between implementations, which causes a lot of [edge cases](https://github.com/visionmedia/node-querystring/issues).
|
||||
This module intentionally doesn't support nesting as it's not specced and varies between implementations, which causes a lot of [edge cases](https://github.com/visionmedia/node-querystring/issues).
|
||||
|
||||
You're much better off just converting the object to a JSON string:
|
||||
|
||||
|
@ -67,7 +67,7 @@ queryString.stringify({
|
|||
unicorn: 'cake'
|
||||
})
|
||||
});
|
||||
//=> 'foo=bar&nested=%7B%22unicorn%22%3A%22cake%22%7D'
|
||||
//=> foo=bar&nested=%7B%22unicorn%22%3A%22cake%22%7D
|
||||
```
|
||||
|
||||
|
||||
|
|
91
dashboard-ui/bower_components/query-string/test.js
vendored
Normal file
91
dashboard-ui/bower_components/query-string/test.js
vendored
Normal file
|
@ -0,0 +1,91 @@
|
|||
'use strict';
|
||||
var assert = require('assert');
|
||||
var qs = require('./');
|
||||
|
||||
describe('.parse()', function () {
|
||||
it('query strings starting with a `?`', function () {
|
||||
assert.deepEqual(qs.parse('?foo=bar'), {foo: 'bar'});
|
||||
});
|
||||
|
||||
it('query strings starting with a `#`', function () {
|
||||
assert.deepEqual(qs.parse('#foo=bar'), {foo: 'bar'});
|
||||
});
|
||||
|
||||
it('query strings starting with a `&', function () {
|
||||
assert.deepEqual(qs.parse('&foo=bar&foo=baz'), {foo: ['bar', 'baz']});
|
||||
});
|
||||
|
||||
it('parse a query string', function () {
|
||||
assert.deepEqual(qs.parse('foo=bar'), {foo: 'bar'});
|
||||
});
|
||||
|
||||
it('parse multiple query string', function () {
|
||||
assert.deepEqual(qs.parse('foo=bar&key=val'), {foo: 'bar', key: 'val'});
|
||||
});
|
||||
|
||||
it('parse query string without a value', function () {
|
||||
assert.deepEqual(qs.parse('foo'), {foo: null});
|
||||
assert.deepEqual(qs.parse('foo&key'), {foo: null, key: null});
|
||||
assert.deepEqual(qs.parse('foo=bar&key'), {foo: 'bar', key: null});
|
||||
});
|
||||
|
||||
it('return empty object if no qss can be found', function () {
|
||||
assert.deepEqual(qs.parse('?'), {});
|
||||
assert.deepEqual(qs.parse('&'), {});
|
||||
assert.deepEqual(qs.parse('#'), {});
|
||||
assert.deepEqual(qs.parse(' '), {});
|
||||
});
|
||||
|
||||
it('handle `+` correctly', function () {
|
||||
assert.deepEqual(qs.parse('foo+faz=bar+baz++'), {'foo faz': 'bar baz '});
|
||||
});
|
||||
|
||||
it('handle multiple of the same key', function () {
|
||||
assert.deepEqual(qs.parse('foo=bar&foo=baz'), {foo: ['bar', 'baz']});
|
||||
});
|
||||
|
||||
it('query strings params including embedded `=`', function () {
|
||||
assert.deepEqual(qs.parse('?param=http%3A%2F%2Fsomeurl%3Fid%3D2837'), {param: 'http://someurl?id=2837'});
|
||||
});
|
||||
});
|
||||
|
||||
describe('.stringify()', function () {
|
||||
it('stringify', function () {
|
||||
assert.strictEqual(qs.stringify({foo: 'bar'}), 'foo=bar');
|
||||
assert.strictEqual(qs.stringify({foo: 'bar', bar: 'baz'}), 'bar=baz&foo=bar');
|
||||
});
|
||||
|
||||
it('different types', function () {
|
||||
assert.strictEqual(qs.stringify(), '');
|
||||
assert.strictEqual(qs.stringify(0), '');
|
||||
});
|
||||
|
||||
it('URI encode', function () {
|
||||
assert.strictEqual(qs.stringify({'foo bar': 'baz faz'}), 'foo%20bar=baz%20faz');
|
||||
});
|
||||
|
||||
it('handle array value', function () {
|
||||
assert.strictEqual(qs.stringify({abc: 'abc', foo: ['bar', 'baz']}), 'abc=abc&foo=bar&foo=baz');
|
||||
});
|
||||
});
|
||||
|
||||
describe('.extract()', function () {
|
||||
it('should extract qs from url', function () {
|
||||
assert.equal(qs.extract('http://foo.bar/?abc=def&hij=klm'), 'abc=def&hij=klm');
|
||||
assert.equal(qs.extract('http://foo.bar/?'), '');
|
||||
});
|
||||
|
||||
it('should handle strings not containing qs', function () {
|
||||
assert.equal(qs.extract('http://foo.bar/'), '');
|
||||
assert.equal(qs.extract(''), '');
|
||||
});
|
||||
|
||||
it('should throw for invalid values', function() {
|
||||
assert.throws(function() {
|
||||
qs.extract(null);
|
||||
}, TypeError);
|
||||
assert.throws(function() {
|
||||
qs.extract(undefined);
|
||||
}, TypeError);
|
||||
});
|
||||
});
|
154
dashboard-ui/components/viewcontainer-lite.js
Normal file
154
dashboard-ui/components/viewcontainer-lite.js
Normal file
|
@ -0,0 +1,154 @@
|
|||
define([], function () {
|
||||
|
||||
var pageContainerCount;
|
||||
var animationDuration = 500;
|
||||
|
||||
function loadView(options) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var animatedPages = document.querySelector('.mainAnimatedPages');
|
||||
|
||||
if (options.cancel) {
|
||||
return;
|
||||
}
|
||||
|
||||
var selected = animatedPages.selected;
|
||||
var pageIndex = selected == null ? 0 : (selected + 1);
|
||||
|
||||
if (pageIndex >= pageContainerCount) {
|
||||
pageIndex = 0;
|
||||
}
|
||||
|
||||
var html = '<div class="page-view" data-type="' + (options.type || '') + '" data-url="' + options.url + '">';
|
||||
html += options.view;
|
||||
html += '</div>';
|
||||
|
||||
var animatable = animatedPages.querySelectorAll('.mainAnimatedPage')[pageIndex];
|
||||
|
||||
var currentPage = animatable.querySelector('.page-view');
|
||||
|
||||
if (currentPage) {
|
||||
triggerDestroy(currentPage);
|
||||
}
|
||||
|
||||
animatable.innerHTML = html;
|
||||
|
||||
var view = animatable.querySelector('.page-view');
|
||||
|
||||
if (onBeforeChange) {
|
||||
onBeforeChange(view, false, options);
|
||||
}
|
||||
|
||||
sendResolve(resolve, view);
|
||||
});
|
||||
}
|
||||
|
||||
var onBeforeChange;
|
||||
function setOnBeforeChange(fn) {
|
||||
onBeforeChange = fn;
|
||||
}
|
||||
|
||||
function sendResolve(resolve, view) {
|
||||
|
||||
// Don't report completion until the animation has finished, otherwise rendering may not perform well
|
||||
setTimeout(function () {
|
||||
|
||||
resolve(view);
|
||||
|
||||
}, animationDuration);
|
||||
}
|
||||
|
||||
function replaceAnimatedPages() {
|
||||
var elem = document.querySelector('neon-animated-pages.mainAnimatedPages');
|
||||
|
||||
if (elem) {
|
||||
var div = document.createElement('div');
|
||||
div.classList.add('mainAnimatedPages');
|
||||
div.classList.add('skinBody');
|
||||
div.innerHTML = '<div class="mainAnimatedPage"></div><div class="mainAnimatedPage"></div><div class="mainAnimatedPage"></div>';
|
||||
elem.parentNode.replaceChild(div, elem);
|
||||
|
||||
pageContainerCount = document.querySelectorAll('.mainAnimatedPage').length;
|
||||
}
|
||||
}
|
||||
|
||||
function tryRestoreView(options) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var url = options.url;
|
||||
var view = document.querySelector(".page-view[data-url='" + url + "']");
|
||||
var page = parentWithClass(view, 'mainAnimatedPage');
|
||||
|
||||
if (view) {
|
||||
|
||||
var index = -1;
|
||||
var pages = document.querySelectorAll('.mainAnimatedPage');
|
||||
for (var i = 0, length = pages.length; i < length; i++) {
|
||||
if (pages[i] == page) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index != -1) {
|
||||
|
||||
var animatedPages = document.querySelector('.mainAnimatedPages');
|
||||
if (options.cancel) {
|
||||
return;
|
||||
}
|
||||
|
||||
var animatable = animatedPages.querySelectorAll('.mainAnimatedPage')[index];
|
||||
var view = animatable.querySelector('.page-view');
|
||||
|
||||
if (onBeforeChange) {
|
||||
onBeforeChange(view, true, options);
|
||||
}
|
||||
|
||||
animatedPages.selected = index;
|
||||
sendResolve(resolve, view);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
reject();
|
||||
});
|
||||
}
|
||||
|
||||
function triggerDestroy(view) {
|
||||
view.dispatchEvent(new CustomEvent("viewdestroy", {}));
|
||||
}
|
||||
|
||||
function reset() {
|
||||
|
||||
var views = document.querySelectorAll(".mainAnimatedPage:not(.iron-selected) .page-view");
|
||||
|
||||
for (var i = 0, length = views.length; i < length; i++) {
|
||||
|
||||
var view = views[i];
|
||||
triggerDestroy(view);
|
||||
view.parentNode.removeChild(view);
|
||||
}
|
||||
}
|
||||
|
||||
function parentWithClass(elem, className) {
|
||||
|
||||
while (!elem.classList || !elem.classList.contains(className)) {
|
||||
elem = elem.parentNode;
|
||||
|
||||
if (!elem) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
replaceAnimatedPages();
|
||||
|
||||
return {
|
||||
loadView: loadView,
|
||||
tryRestoreView: tryRestoreView,
|
||||
reset: reset,
|
||||
setOnBeforeChange: setOnBeforeChange
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue