1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update globalize

This commit is contained in:
Luke Pulverenti 2015-08-05 21:21:18 -04:00
parent 3d3df5717d
commit 7fb95d0419
21 changed files with 142 additions and 90 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-autogrow-textarea", "name": "iron-autogrow-textarea",
"version": "1.0.3", "version": "1.0.4",
"description": "A textarea element that automatically grows with input", "description": "A textarea element that automatically grows with input",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -37,11 +37,11 @@
"paper-styles": "PolymerElements/paper-styles#^1.0.0", "paper-styles": "PolymerElements/paper-styles#^1.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"_release": "1.0.3", "_release": "1.0.4",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.3", "tag": "v1.0.4",
"commit": "9eae088ce72a31b0baf44e6cdc183e5b73014af5" "commit": "0501594add2228c34b39b9fa898d177f7f8e1adb"
}, },
"_source": "git://github.com/PolymerElements/iron-autogrow-textarea.git", "_source": "git://github.com/PolymerElements/iron-autogrow-textarea.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-autogrow-textarea", "name": "iron-autogrow-textarea",
"version": "1.0.3", "version": "1.0.4",
"description": "A textarea element that automatically grows with input", "description": "A textarea element that automatically grows with input",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"

View file

@ -21,9 +21,7 @@ never scroll.
Example: Example:
<iron-autogrow-textarea id="a1"> <iron-autogrow-textarea></iron-autogrow-textarea>
<textarea id="t1"></textarea>
</iron-autogrow-textarea>
Because the `textarea`'s `value` property is not observable, you should use Because the `textarea`'s `value` property is not observable, you should use
this element's `bind-value` instead for imperative updates. this element's `bind-value` instead for imperative updates.
@ -63,6 +61,7 @@ this element's `bind-value` instead for imperative updates.
height: 100%; height: 100%;
font-size: inherit; font-size: inherit;
font-family: inherit; font-family: inherit;
line-height: inherit;
} }
::content textarea:invalid { ::content textarea:invalid {
@ -150,8 +149,8 @@ this element's `bind-value` instead for imperative updates.
* Bound to the textarea's `autofocus` attribute. * Bound to the textarea's `autofocus` attribute.
*/ */
autofocus: { autofocus: {
type: String, type: Boolean,
value: 'off' value: false
}, },
/** /**
@ -302,5 +301,5 @@ this element's `bind-value` instead for imperative updates.
_computeValue: function() { _computeValue: function() {
return this.bindValue; return this.bindValue;
} }
}) });
</script> </script>

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-behaviors", "name": "iron-behaviors",
"version": "1.0.5", "version": "1.0.6",
"description": "Provides a set of behaviors for the iron elements", "description": "Provides a set of behaviors for the iron elements",
"private": true, "private": true,
"authors": [ "authors": [
@ -28,11 +28,11 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"homepage": "https://github.com/PolymerElements/iron-behaviors", "homepage": "https://github.com/PolymerElements/iron-behaviors",
"_release": "1.0.5", "_release": "1.0.6",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.5", "tag": "v1.0.6",
"commit": "bdae66f398838eda78c203b3ae979dcb5cd2a60e" "commit": "9dad0f52150c887997045b8bbf2a82b2394b8a37"
}, },
"_source": "git://github.com/PolymerElements/iron-behaviors.git", "_source": "git://github.com/PolymerElements/iron-behaviors.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-behaviors", "name": "iron-behaviors",
"version": "1.0.5", "version": "1.0.6",
"description": "Provides a set of behaviors for the iron elements", "description": "Provides a set of behaviors for the iron elements",
"private": true, "private": true,
"authors": [ "authors": [

View file

@ -109,8 +109,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// to emulate native checkbox, (de-)activations from a user interaction fire // to emulate native checkbox, (de-)activations from a user interaction fire
// 'change' events // 'change' events
_userActivate: function(active) { _userActivate: function(active) {
this.active = active; if (this.active !== active) {
this.fire('change'); this.active = active;
this.fire('change');
}
}, },
_eventSourceIsPrimaryInput: function(event) { _eventSourceIsPrimaryInput: function(event) {

View file

@ -60,11 +60,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
], ],
ready: function() { ready: function() {
// TODO(sjmiles): ensure read-only property is valued so the compound
// observer will fire
if (this.focused === undefined) {
this._setFocused(false);
}
this.addEventListener('focus', this._boundFocusBlurHandler, true); this.addEventListener('focus', this._boundFocusBlurHandler, true);
this.addEventListener('blur', this._boundFocusBlurHandler, true); this.addEventListener('blur', this._boundFocusBlurHandler, true);
}, },
@ -75,7 +70,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
var focused = event.type === 'focus'; var focused = event.type === 'focus';
this._setFocused(focused); this._setFocused(focused);
} else if (!this.shadowRoot) { } else if (!this.shadowRoot) {
event.stopPropagation();
this.fire(event.type, {sourceEvent: event}, { this.fire(event.type, {sourceEvent: event}, {
node: this, node: this,
bubbles: event.bubbles, bubbles: event.bubbles,

View file

@ -90,26 +90,22 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
focusable = fixture('NestedFocusedState'); focusable = fixture('NestedFocusedState');
}); });
test('focus/blur events fired on host element', function(done) { test('focus/blur events fired on host element', function() {
var nFocusEvents = 0; var nFocusEvents = 0;
var nBlurEvents = 0; var nBlurEvents = 0;
focusable.addEventListener('focus', function() { focusable.addEventListener('focus', function() {
nFocusEvents += 1; nFocusEvents += 1;
// setTimeout to wait for potentially more, erroneous events MockInteractions.blur(focusable.$.input);
setTimeout(function() {
assert.equal(nFocusEvents, 1, 'one focus event fired');
MockInteractions.blur(focusable.$.input);
});
}); });
focusable.addEventListener('blur', function() { focusable.addEventListener('blur', function() {
nBlurEvents += 1; nBlurEvents += 1;
// setTimeout to wait for potentially more, erroneous events
setTimeout(function() {
assert.equal(nBlurEvents, 1, 'one blur event fired');
done();
});
}); });
MockInteractions.focus(focusable.$.input); MockInteractions.focus(focusable.$.input);
expect(nBlurEvents).to.be.greaterThan(0);
expect(nFocusEvents).to.be.greaterThan(0);
}); });
}); });

View file

@ -23,14 +23,14 @@
"paper-styles": "polymerelements/paper-styles#^1.0.0", "paper-styles": "polymerelements/paper-styles#^1.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"homepage": "https://github.com/PolymerElements/iron-flex-layout", "homepage": "https://github.com/polymerelements/iron-flex-layout",
"_release": "1.0.2", "_release": "1.0.2",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.2", "tag": "v1.0.2",
"commit": "50bcecf40ab23caa7c2cd90030555e00c5ba7154" "commit": "50bcecf40ab23caa7c2cd90030555e00c5ba7154"
}, },
"_source": "git://github.com/PolymerElements/iron-flex-layout.git", "_source": "git://github.com/polymerelements/iron-flex-layout.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-flex-layout" "_originalSource": "polymerelements/iron-flex-layout"
} }

View file

@ -25,14 +25,14 @@
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"homepage": "https://github.com/PolymerElements/iron-meta", "homepage": "https://github.com/polymerelements/iron-meta",
"_release": "1.0.3", "_release": "1.0.3",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.3", "tag": "v1.0.3",
"commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04" "commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04"
}, },
"_source": "git://github.com/PolymerElements/iron-meta.git", "_source": "git://github.com/polymerelements/iron-meta.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-meta" "_originalSource": "polymerelements/iron-meta"
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-validatable-behavior", "name": "iron-validatable-behavior",
"version": "1.0.3", "version": "1.0.4",
"description": "Provides a behavior for an element that validates user input", "description": "Provides a behavior for an element that validates user input",
"authors": "The Polymer Authors", "authors": "The Polymer Authors",
"keywords": [ "keywords": [
@ -32,11 +32,11 @@
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"_release": "1.0.3", "_release": "1.0.4",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.3", "tag": "v1.0.4",
"commit": "714ac9f09f9d7d5f6f792a38bb15970adaacb264" "commit": "ff267b561b032608755d705c1a7e346454b0aee4"
}, },
"_source": "git://github.com/PolymerElements/iron-validatable-behavior.git", "_source": "git://github.com/PolymerElements/iron-validatable-behavior.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-validatable-behavior", "name": "iron-validatable-behavior",
"version": "1.0.3", "version": "1.0.4",
"description": "Provides a behavior for an element that validates user input", "description": "Provides a behavior for an element that validates user input",
"authors": "The Polymer Authors", "authors": "The Polymer Authors",
"keywords": [ "keywords": [

View file

@ -16,7 +16,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/** /**
* Use `Polymer.IronValidatableBehavior` to implement an element that validates user input. * Use `Polymer.IronValidatableBehavior` to implement an element that validates user input.
* *
* ### Accessiblity * ### Accessibility
* *
* Changing the `invalid` property, either manually or by calling `validate()` will update the * Changing the `invalid` property, either manually or by calling `validate()` will update the
* `aria-invalid` attribute. * `aria-invalid` attribute.
@ -87,19 +87,35 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}, },
/** /**
* @param {Object} values Passed to the validator's `validate()` function. * Returns true if the `value` is valid, and updates `invalid`. If you want
* @return {boolean} True if `values` is valid. * your element to have custom validation logic, do not override this method;
* override `_getValidity(value)` instead.
* @param {Object} value The value to be validated. By default, it is passed
* to the validator's `validate()` function, if a validator is set.
* @return {boolean} True if `value` is valid.
*/ */
validate: function(values) { validate: function(value) {
var valid = true; this.invalid = !this._getValidity(value);
return !this.invalid;
},
/**
* Returns true if `value` is valid. By default, it is passed
* to the validator's `validate()` function, if a validator is set. You
* should override this method if you want to implement custom validity
* logic for your element.
*
* @param {Object} value The value to be validated.
* @return {boolean} True if `value` is valid.
*/
_getValidity: function(value) {
if (this.hasValidator()) { if (this.hasValidator()) {
valid = this._validator.validate(values); return this._validator.validate(value);
} }
return true;
this.invalid = !valid;
return valid;
} }
}; };
</script> </script>

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-input", "name": "paper-input",
"version": "1.0.9", "version": "1.0.10",
"description": "Material design text fields", "description": "Material design text fields",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -44,11 +44,11 @@
"iron-icon": "PolymerElements/iron-icon#^1.0.0", "iron-icon": "PolymerElements/iron-icon#^1.0.0",
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0" "paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0"
}, },
"_release": "1.0.9", "_release": "1.0.10",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.9", "tag": "v1.0.10",
"commit": "39ab833e7597fabfac9ff98d4825a6ae7b3c89c4" "commit": "902279329e0259de5487d6f1fa1f438be0e0802e"
}, },
"_source": "git://github.com/PolymerElements/paper-input.git", "_source": "git://github.com/PolymerElements/paper-input.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "paper-input", "name": "paper-input",
"version": "1.0.9", "version": "1.0.10",
"description": "Material design text fields", "description": "Material design text fields",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"

View file

@ -109,14 +109,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
value: false value: false
}, },
/**
* The maximum length of the input value. Bind this to the `<input is="iron-input">`'s
* `maxlength` property.
*/
maxlength: {
type: Number
},
/** /**
* The error message to display when the input is invalid. Bind this to the * The error message to display when the input is invalid. Bind this to the
* `<paper-input-error>`'s content, if using. * `<paper-input-error>`'s content, if using.
@ -199,6 +191,39 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
type: Number type: Number
}, },
/**
* The maximum length of the input value. Bind this to the `<input is="iron-input">`'s
* `maxlength` property.
*/
maxlength: {
type: Number
},
/**
* The minimum (numeric or date-time) input value.
* Bind this to the `<input is="iron-input">`'s `min` property.
*/
min: {
type: String
},
/**
* The maximum (numeric or date-time) input value.
* Can be a String (e.g. `"2000-1-1"`) or a Number (e.g. `2`).
* Bind this to the `<input is="iron-input">`'s `max` property.
*/
max: {
type: String
},
/**
* Limits the numeric or date-time increments.
* Bind this to the `<input is="iron-input">`'s `step` property.
*/
step: {
type: String
},
/** /**
* Bind this to the `<input is="iron-input">`'s `name` property. * Bind this to the `<input is="iron-input">`'s `name` property.
*/ */

View file

@ -93,12 +93,15 @@ style this element.
validator="[[validator]]" validator="[[validator]]"
type$="[[type]]" type$="[[type]]"
pattern$="[[pattern]]" pattern$="[[pattern]]"
maxlength$="[[maxlength]]"
required$="[[required]]" required$="[[required]]"
autocomplete$="[[autocomplete]]" autocomplete$="[[autocomplete]]"
autofocus$="[[autofocus]]" autofocus$="[[autofocus]]"
inputmode$="[[inputmode]]" inputmode$="[[inputmode]]"
minlength$="[[minlength]]" minlength$="[[minlength]]"
maxlength$="[[maxlength]]"
min$="[[min]]"
max$="[[max]]"
step$="[[step]]"
name$="[[name]]" name$="[[name]]"
placeholder$="[[placeholder]]" placeholder$="[[placeholder]]"
readonly$="[[readonly]]" readonly$="[[readonly]]"

View file

@ -176,26 +176,21 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
input = fixture('basic'); input = fixture('basic');
}); });
test('focus/blur events fired on host element', function(done) { test('focus/blur events fired on host element', function() {
var nFocusEvents = 0; var nFocusEvents = 0;
var nBlurEvents = 0; var nBlurEvents = 0;
input.addEventListener('focus', function() { input.addEventListener('focus', function(event) {
nFocusEvents += 1; nFocusEvents += 1;
// setTimeout to wait for potentially more, erroneous events assert(input.focused, 'input is focused');
setTimeout(function() { MockInteractions.blur(input.inputElement);
assert.equal(nFocusEvents, 1, 'one focus event fired');
MockInteractions.blur(input.inputElement);
});
}); });
input.addEventListener('blur', function() { input.addEventListener('blur', function() {
nBlurEvents += 1; nBlurEvents += 1;
// setTimeout to wait for potentially more, erroneous events assert(!input.focused, 'input is blurred');
setTimeout(function() {
assert.equal(nBlurEvents, 1, 'one blur event fired');
done();
});
}); });
MockInteractions.focus(input.inputElement); MockInteractions.focus(input.inputElement);
assert.isTrue(nFocusEvents >= 1, 'focus event fired');
assert.isTrue(nBlurEvents >= 1, 'blur event fired');
}); });
}); });

View file

@ -138,20 +138,21 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
input = fixture('basic'); input = fixture('basic');
}); });
test('focus/blur events fired on host element', function(done) { test('focus/blur events fired on host element', function() {
var nFocusEvents = 0; var nFocusEvents = 0;
var nBlurEvents = 0; var nBlurEvents = 0;
input.addEventListener('focus', function(event) { input.addEventListener('focus', function(event) {
nFocusEvents += 1; nFocusEvents += 1;
assert(input.focused, 'input is focused');
MockInteractions.blur(input.inputElement.textarea); MockInteractions.blur(input.inputElement.textarea);
}); });
input.addEventListener('blur', function() { input.addEventListener('blur', function() {
nBlurEvents += 1; nBlurEvents += 1;
assert.isTrue(nFocusEvents >= 1, 'focus event fired'); assert(!input.focused, 'input is blurred');
assert.isTrue(nBlurEvents >= 1, 'blur event fired');
done();
}); });
MockInteractions.focus(input.inputElement.textarea); MockInteractions.focus(input.inputElement.textarea);
assert.isTrue(nFocusEvents >= 1, 'focus event fired');
assert.isTrue(nBlurEvents >= 1, 'blur event fired')
}); });
}); });

View file

@ -50,11 +50,28 @@
var currentCulture = 'en-US'; var currentCulture = 'en-US';
function setCulture(value) { function setCulture(value) {
Logger.log('Setting culture to ' + value);
currentCulture = value; currentCulture = value;
return $.when(loadDictionary('html', value), loadDictionary('javascript', value)); return $.when(loadDictionary('html', value), loadDictionary('javascript', value));
} }
function normalizeLocaleName(culture) {
culture = culture.replace('_', '-');
// If it's de-DE, convert to just de
var parts = culture.split('-');
if (parts.length == 2) {
if (parts[0].toLowerCase() == parts[1].toLowerCase()) {
culture = parts[0].toLowerCase();
}
}
return culture;
}
function getDeviceCulture() { function getDeviceCulture() {
var deferred = DeferredBuilder.Deferred(); var deferred = DeferredBuilder.Deferred();
@ -62,9 +79,11 @@
if (navigator.globalization && navigator.globalization.getLocaleName) { if (navigator.globalization && navigator.globalization.getLocaleName) {
Logger.log('Calling navigator.globalization.getLocaleName');
navigator.globalization.getLocaleName(function (locale) { navigator.globalization.getLocaleName(function (locale) {
culture = (locale.value || '').replace('_', '-'); culture = normalizeLocaleName(locale.value || '');
Logger.log('Device culture is ' + culture); Logger.log('Device culture is ' + culture);
deferred.resolveWith(null, [culture]); deferred.resolveWith(null, [culture]);
@ -79,12 +98,12 @@
Logger.log('AppInfo.supportsUserDisplayLanguageSetting is true'); Logger.log('AppInfo.supportsUserDisplayLanguageSetting is true');
culture = document.documentElement.getAttribute('data-culture'); culture = AppSettings.displayLanguage();
deferred.resolveWith(null, [culture]); deferred.resolveWith(null, [culture]);
} else { } else {
Logger.log('navigator.globalization.getLocaleName is unavailable'); Logger.log('Getting culture from document');
culture = document.documentElement.getAttribute('data-culture'); culture = document.documentElement.getAttribute('data-culture');
deferred.resolveWith(null, [culture]); deferred.resolveWith(null, [culture]);
@ -96,6 +115,8 @@
function ensure() { function ensure() {
Logger.log('Entering Globalize.ensure');
var deferred = DeferredBuilder.Deferred(); var deferred = DeferredBuilder.Deferred();
getDeviceCulture().done(function (culture) { getDeviceCulture().done(function (culture) {

View file

@ -2070,7 +2070,7 @@ var AppInfo = {};
deps.push('appstorage'); deps.push('appstorage');
require([deps], function () { require(deps, function () {
capabilities.DeviceProfile = MediaPlayer.getDeviceProfile(Math.max(screen.height, screen.width)); capabilities.DeviceProfile = MediaPlayer.getDeviceProfile(Math.max(screen.height, screen.width));
createConnectionManager(capabilities).done(function () { onConnectionManagerCreated(deferred); }); createConnectionManager(capabilities).done(function () { onConnectionManagerCreated(deferred); });