Skip to content

Commit

Permalink
[build] 0.9.1
Browse files Browse the repository at this point in the history
close #82
close #81
  • Loading branch information
toxic-johann committed Jan 28, 2018
1 parent c1c61ca commit 32d96cb
Show file tree
Hide file tree
Showing 9 changed files with 141 additions and 72 deletions.
2 changes: 1 addition & 1 deletion bundle-size/common.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle-size/es.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle-size/min.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle-size/umd.html

Large diffs are not rendered by default.

43 changes: 33 additions & 10 deletions lib/index.browser.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/**
* chimee v0.9.0
* chimee v0.9.1
* (c) 2017-2018 toxic-johann
* Released under MIT
*/
Expand Down Expand Up @@ -344,7 +344,7 @@ var _objectGpo = Object.getPrototypeOf || function (O) {


_objectSap('getPrototypeOf', function () {
return function getPrototypeOf$$1(it) {
return function getPrototypeOf(it) {
return _objectGpo(_toObject(it));
};
});
Expand Down Expand Up @@ -8482,7 +8482,7 @@ var Plugin = (_dec$3 = autobindClass(), _dec$3(_class$3 = function (_VideoWrappe
var _this = _possibleConstructorReturn(this, (Plugin.__proto__ || _Object$getPrototypeOf(Plugin)).call(this));

_this.destroyed = false;
_this.VERSION = '0.9.0';
_this.VERSION = '0.9.1';
_this.__operable = true;
_this.__level = 0;

Expand Down Expand Up @@ -9164,7 +9164,9 @@ var Dom = (_dec$5 = waituntil('__dispatcher.videoConfigReady'), _dec2$4 = before
_createClass(Dom, [{
key: 'installVideo',
value: function installVideo(videoElement) {
var _this2 = this;
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref$bindEvent = _ref.bindEvent,
bindEvent = _ref$bindEvent === undefined ? true : _ref$bindEvent;

this.__videoExtendedNodes.push(videoElement);
setAttr(videoElement, 'tabindex', -1);
Expand All @@ -9189,6 +9191,15 @@ var Dom = (_dec$5 = waituntil('__dispatcher.videoConfigReady'), _dec2$4 = before
if (this.container.parentElement !== this.wrapper) {
$(this.wrapper).append(this.container);
}
if (bindEvent) this.bindVideoEvents(videoElement);
this.videoElement = videoElement;
return videoElement;
}
}, {
key: 'bindVideoEvents',
value: function bindVideoEvents(videoElement) {
var _this2 = this;

videoEvents.forEach(function (key) {
var fn = function fn() {
var _dispatcher$bus3;
Expand All @@ -9205,8 +9216,6 @@ var Dom = (_dec$5 = waituntil('__dispatcher.videoConfigReady'), _dec2$4 = before
this._addDomEvents(videoElement, this.videoDomEventHandlerList, function (key) {
return _this2._getEventHandler(key, { penetrate: true });
});
this.videoElement = videoElement;
return videoElement;
}
}, {
key: 'removeVideo',
Expand Down Expand Up @@ -9473,10 +9482,10 @@ var Dom = (_dec$5 = waituntil('__dispatcher.videoConfigReady'), _dec2$4 = before

}, {
key: '_getEventHandler',
value: function _getEventHandler(key, _ref) {
value: function _getEventHandler(key, _ref2) {
var _this8 = this;

var penetrate = _ref.penetrate;
var penetrate = _ref2.penetrate;

if (!penetrate || ['mouseenter', 'mouseleave'].indexOf(key) < 0) {
return function () {
Expand Down Expand Up @@ -10000,7 +10009,7 @@ var Dispatcher = (_dec$6 = before(convertNameIntoId), _dec2$5 = before(checkPlug
var oldKernel = this.kernel;
var originVideoConfig = deepClone(this.videoConfig);
this.dom.removeVideo();
this.dom.installVideo(video);
this.dom.installVideo(video, { bindEvent: false });
// as we will reset the currentVideoConfig on the new video
// it will trigger the watch function as they maybe differnet
// because video config will return the real situation
Expand All @@ -10025,6 +10034,11 @@ var Dispatcher = (_dec$6 = before(convertNameIntoId), _dec2$5 = before(checkPlug
_Object$assign(this.videoConfig, { isLive: isLive, box: box, preset: preset, kernels: kernels });
// const config = {}
oldKernel.destroy();
// delay video event binding
// so that people can't feel the default value change
setTimeout(function () {
return _this3.dom.bindVideoEvents(video);
});
}
/**
* destroy function called when dispatcher destroyed
Expand Down Expand Up @@ -10535,6 +10549,15 @@ var Chimee = (_dec$7 = autobindClass(), _dec$7(_class$8 = (_class2$2 = (_temp =
value: function destroy() {
_get(Chimee.prototype.__proto__ || _Object$getPrototypeOf(Chimee.prototype), '__destroy', this).call(this);
this.__dispatcher.destroy();
// $FlowFixMe: normal obejct define
Object.defineProperty(this, '__dispatcher', {
get: function get$$1() {
throw new Error('This instance has been destroyed.');
},

enumerable: true,
configurable: true
});
this.destroyed = true;
}
}, {
Expand Down Expand Up @@ -10567,7 +10590,7 @@ var Chimee = (_dec$7 = autobindClass(), _dec$7(_class$8 = (_class2$2 = (_temp =
}), _descriptor2$1 = _applyDecoratedDescriptor$7(_class2$2.prototype, 'version', [frozen], {
enumerable: true,
initializer: function initializer() {
return '0.9.0';
return '0.9.1';
}
}), _descriptor3$1 = _applyDecoratedDescriptor$7(_class2$2.prototype, 'config', [frozen], {
enumerable: true,
Expand Down
91 changes: 57 additions & 34 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/**
* chimee v0.9.0
* chimee v0.9.1
* (c) 2017-2018 toxic-johann
* Released under MIT
*/
Expand All @@ -9,29 +9,29 @@

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

var _Object$defineProperty = _interopDefault(require('babel-runtime/core-js/object/define-property'));
var _Object$getOwnPropertyDescriptor = _interopDefault(require('babel-runtime/core-js/object/get-own-property-descriptor'));
var _Object$getPrototypeOf = _interopDefault(require('babel-runtime/core-js/object/get-prototype-of'));
var _Map = _interopDefault(require('babel-runtime/core-js/map'));
var _toConsumableArray = _interopDefault(require('babel-runtime/helpers/toConsumableArray'));
var _Promise = _interopDefault(require('babel-runtime/core-js/promise'));
var _classCallCheck = _interopDefault(require('babel-runtime/helpers/classCallCheck'));
var _createClass = _interopDefault(require('babel-runtime/helpers/createClass'));
var chimeeHelper = require('chimee-helper');
var toxicDecorators = require('toxic-decorators');
var _Object$defineProperty = _interopDefault(require('babel-runtime/core-js/object/define-property'));
var _Number$isNaN = _interopDefault(require('babel-runtime/core-js/number/is-nan'));
var _Object$keys = _interopDefault(require('babel-runtime/core-js/object/keys'));
var _JSON$stringify = _interopDefault(require('babel-runtime/core-js/json/stringify'));
var _defineProperty = _interopDefault(require('babel-runtime/helpers/defineProperty'));
var _typeof = _interopDefault(require('babel-runtime/helpers/typeof'));
var _Object$getPrototypeOf = _interopDefault(require('babel-runtime/core-js/object/get-prototype-of'));
var _possibleConstructorReturn = _interopDefault(require('babel-runtime/helpers/possibleConstructorReturn'));
var _get = _interopDefault(require('babel-runtime/helpers/get'));
var _inherits = _interopDefault(require('babel-runtime/helpers/inherits'));
var _toConsumableArray = _interopDefault(require('babel-runtime/helpers/toConsumableArray'));
var esFullscreen = _interopDefault(require('es-fullscreen'));
var _slicedToArray = _interopDefault(require('babel-runtime/helpers/slicedToArray'));
var _Object$entries = _interopDefault(require('babel-runtime/core-js/object/entries'));
var _Object$assign = _interopDefault(require('babel-runtime/core-js/object/assign'));
var _Promise = _interopDefault(require('babel-runtime/core-js/promise'));
var _typeof = _interopDefault(require('babel-runtime/helpers/typeof'));
var chimeeHelper = require('chimee-helper');
var ChimeeKernel = _interopDefault(require('chimee-kernel'));
var _Map = _interopDefault(require('babel-runtime/core-js/map'));
var toxicDecorators = require('toxic-decorators');
var _Object$keys = _interopDefault(require('babel-runtime/core-js/object/keys'));
var _JSON$stringify = _interopDefault(require('babel-runtime/core-js/json/stringify'));
var _defineProperty = _interopDefault(require('babel-runtime/helpers/defineProperty'));
var _Number$isNaN = _interopDefault(require('babel-runtime/core-js/number/is-nan'));
var esFullscreen = _interopDefault(require('es-fullscreen'));

var videoEvents = ['abort', 'canplay', 'canplaythrough', 'durationchange', 'emptied', 'encrypted', 'ended', 'error', 'interruptbegin', 'interruptend', 'loadeddata', 'loadedmetadata', 'loadstart', 'mozaudioavailable', 'pause', 'play', 'playing', 'progress', 'ratechange', 'seeked', 'seeking', 'stalled', 'suspend', 'timeupdate', 'volumechange', 'waiting'];
var videoReadOnlyProperties = ['buffered', 'currentSrc', 'duration', 'error', 'ended', 'networkState', 'paused', 'readyState', 'seekable', 'sinkId', 'controlsList', 'tabIndex', 'dataset', 'offsetHeight', 'offsetLeft', 'offsetParent', 'offsetTop', 'offsetWidth'];
Expand Down Expand Up @@ -622,15 +622,15 @@ function accessorVideoAttribute(attribute) {
},
_set = _ref.set,
_get$$1 = _ref.get,
isBoolean$$1 = _ref.isBoolean;
isBoolean = _ref.isBoolean;

return toxicDecorators.accessor({
get: function get(value) {
return this.dispatcher.videoConfigReady && this.inited ? this.dom.videoElement[_get$$1] : value;
},
set: function set(value) {
if (!this.dispatcher.videoConfigReady) return value;
var val = isBoolean$$1 ? value ? '' : undefined
var val = isBoolean ? value ? '' : undefined
/* istanbul ignore next */
: value === null ? undefined : value;
this.dom.setAttr('video', _set, val);
Expand All @@ -641,15 +641,15 @@ function accessorVideoAttribute(attribute) {
});
}

function accessorCustomAttribute(attribute, isBoolean$$1) {
function accessorCustomAttribute(attribute, isBoolean) {
return toxicDecorators.accessor({
get: function get(value) {
var attrValue = this.dom.getAttr('video', attribute);
return this.dispatcher.videoConfigReady && this.inited ? isBoolean$$1 ? !!attrValue : attrValue : value;
return this.dispatcher.videoConfigReady && this.inited ? isBoolean ? !!attrValue : attrValue : value;
},
set: function set(value) {
if (!this.dispatcher.videoConfigReady) return value;
var val = isBoolean$$1 ? value || undefined : value === null ? undefined : value;
var val = isBoolean ? value || undefined : value === null ? undefined : value;
this.dom.setAttr('video', attribute, val);
return value;
}
Expand Down Expand Up @@ -1462,7 +1462,7 @@ var Plugin = (_dec$3 = toxicDecorators.autobindClass(), _dec$3(_class$3 = functi
var _this = _possibleConstructorReturn(this, (Plugin.__proto__ || _Object$getPrototypeOf(Plugin)).call(this));

_this.destroyed = false;
_this.VERSION = '0.9.0';
_this.VERSION = '0.9.1';
_this.__operable = true;
_this.__level = 0;

Expand Down Expand Up @@ -1860,7 +1860,9 @@ var Dom = (_dec$4 = toxicDecorators.waituntil('__dispatcher.videoConfigReady'),
_createClass(Dom, [{
key: 'installVideo',
value: function installVideo(videoElement) {
var _this2 = this;
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref$bindEvent = _ref.bindEvent,
bindEvent = _ref$bindEvent === undefined ? true : _ref$bindEvent;

this.__videoExtendedNodes.push(videoElement);
chimeeHelper.setAttr(videoElement, 'tabindex', -1);
Expand All @@ -1885,6 +1887,15 @@ var Dom = (_dec$4 = toxicDecorators.waituntil('__dispatcher.videoConfigReady'),
if (this.container.parentElement !== this.wrapper) {
chimeeHelper.$(this.wrapper).append(this.container);
}
if (bindEvent) this.bindVideoEvents(videoElement);
this.videoElement = videoElement;
return videoElement;
}
}, {
key: 'bindVideoEvents',
value: function bindVideoEvents(videoElement) {
var _this2 = this;

videoEvents.forEach(function (key) {
var fn = function fn() {
var _dispatcher$bus3;
Expand All @@ -1901,8 +1912,6 @@ var Dom = (_dec$4 = toxicDecorators.waituntil('__dispatcher.videoConfigReady'),
this._addDomEvents(videoElement, this.videoDomEventHandlerList, function (key) {
return _this2._getEventHandler(key, { penetrate: true });
});
this.videoElement = videoElement;
return videoElement;
}
}, {
key: 'removeVideo',
Expand Down Expand Up @@ -2040,25 +2049,25 @@ var Dom = (_dec$4 = toxicDecorators.waituntil('__dispatcher.videoConfigReady'),

}, {
key: 'setAttr',
value: function setAttr$$1(target, attr, val) {
value: function setAttr(target, attr, val) {
// $FlowFixMe: flow do not support computed property/element on class, which is silly here.
chimeeHelper.setAttr(this[target], attr, val);
}
}, {
key: 'getAttr',
value: function getAttr$$1(target, attr) {
value: function getAttr(target, attr) {
// $FlowFixMe: flow do not support computed property/element on class, which is silly here.
return chimeeHelper.getAttr(this[target], attr);
}
}, {
key: 'setStyle',
value: function setStyle$$1(target, attr, val) {
value: function setStyle(target, attr, val) {
// $FlowFixMe: flow do not support computed property/element on class, which is silly here.
chimeeHelper.setStyle(this[target], attr, val);
}
}, {
key: 'getStyle',
value: function getStyle$$1(target, attr) {
value: function getStyle(target, attr) {
// $FlowFixMe: flow do not support computed property/element on class, which is silly here.
return chimeeHelper.getStyle(this[target], attr);
}
Expand Down Expand Up @@ -2169,10 +2178,10 @@ var Dom = (_dec$4 = toxicDecorators.waituntil('__dispatcher.videoConfigReady'),

}, {
key: '_getEventHandler',
value: function _getEventHandler(key, _ref) {
value: function _getEventHandler(key, _ref2) {
var _this8 = this;

var penetrate = _ref.penetrate;
var penetrate = _ref2.penetrate;

if (!penetrate || ['mouseenter', 'mouseleave'].indexOf(key) < 0) {
return function () {
Expand Down Expand Up @@ -2449,12 +2458,12 @@ var Dispatcher = (_dec$5 = toxicDecorators.before(convertNameIntoId), _dec2$4 =
if (!chimeeHelper.isString(option.alias)) option.alias = undefined;
var _option = option,
name = _option.name,
alias$$1 = _option.alias;
alias = _option.alias;

option.name = alias$$1 || name;
option.name = alias || name;
delete option.alias;
var key = chimeeHelper.camelize(name);
var id = chimeeHelper.camelize(alias$$1 || name);
var id = chimeeHelper.camelize(alias || name);
var pluginOption = option;
var pluginConfig = Dispatcher.getPluginConfig(key);
if (chimeeHelper.isEmpty(pluginConfig)) throw new TypeError('You have not installed plugin ' + key);
Expand Down Expand Up @@ -2696,7 +2705,7 @@ var Dispatcher = (_dec$5 = toxicDecorators.before(convertNameIntoId), _dec2$4 =
var oldKernel = this.kernel;
var originVideoConfig = chimeeHelper.deepClone(this.videoConfig);
this.dom.removeVideo();
this.dom.installVideo(video);
this.dom.installVideo(video, { bindEvent: false });
// as we will reset the currentVideoConfig on the new video
// it will trigger the watch function as they maybe differnet
// because video config will return the real situation
Expand All @@ -2721,6 +2730,11 @@ var Dispatcher = (_dec$5 = toxicDecorators.before(convertNameIntoId), _dec2$4 =
_Object$assign(this.videoConfig, { isLive: isLive, box: box, preset: preset, kernels: kernels });
// const config = {}
oldKernel.destroy();
// delay video event binding
// so that people can't feel the default value change
setTimeout(function () {
return _this3.dom.bindVideoEvents(video);
});
}
/**
* destroy function called when dispatcher destroyed
Expand Down Expand Up @@ -3231,6 +3245,15 @@ var Chimee = (_dec$6 = toxicDecorators.autobindClass(), _dec$6(_class$7 = (_clas
value: function destroy() {
_get(Chimee.prototype.__proto__ || _Object$getPrototypeOf(Chimee.prototype), '__destroy', this).call(this);
this.__dispatcher.destroy();
// $FlowFixMe: normal obejct define
Object.defineProperty(this, '__dispatcher', {
get: function get() {
throw new Error('This instance has been destroyed.');
},

enumerable: true,
configurable: true
});
this.destroyed = true;
}
}, {
Expand Down Expand Up @@ -3263,7 +3286,7 @@ var Chimee = (_dec$6 = toxicDecorators.autobindClass(), _dec$6(_class$7 = (_clas
}), _descriptor2$1 = _applyDecoratedDescriptor$6(_class2$1.prototype, 'version', [toxicDecorators.frozen], {
enumerable: true,
initializer: function initializer() {
return '0.9.0';
return '0.9.1';
}
}), _descriptor3$1 = _applyDecoratedDescriptor$6(_class2$1.prototype, 'config', [toxicDecorators.frozen], {
enumerable: true,
Expand Down
2 changes: 1 addition & 1 deletion lib/index.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 32d96cb

Please sign in to comment.