Skip to content

Commit

Permalink
fix: adds missing build
Browse files Browse the repository at this point in the history
  • Loading branch information
wbotelhos committed Apr 27, 2024
1 parent 9c631dc commit 57ee4ee
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 39 deletions.
2 changes: 1 addition & 1 deletion build/raty.amd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/raty.commonjs.min.js

Large diffs are not rendered by default.

34 changes: 1 addition & 33 deletions build/raty.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class Raty {
this.scoreField.removeAttribute('value');
}
}

click(score) {
if (!this._isReadOnly()) {
score = this._adjustedScore(score);
Expand All @@ -69,7 +68,6 @@ class Raty {
this._target(score);
}
}

move(score) {
var integer = parseInt(score, 10);
var decimal = this._getDecimal(score, 1);
Expand All @@ -87,7 +85,6 @@ class Raty {
star.dispatchEvent(evt);
this.isMove = false;
}

readOnly(readonly) {
if (this._isReadOnly() !== readonly) {
if (readonly) {
Expand Down Expand Up @@ -144,7 +141,6 @@ class Raty {
}
return this;
}

_adjustedScore(score) {
if (score || score === 0) {
return this._between(score, 0, this.opt.number);
Expand Down Expand Up @@ -187,7 +183,6 @@ class Raty {
this.opt[replaces[i]] = this.opt[replaces[i]].replace('.', '-');
}
}

_apply(score) {
this._fill(score);
if (score) {
Expand Down Expand Up @@ -215,7 +210,6 @@ class Raty {
_between(value, min, max) {
return Math.min(Math.max(parseFloat(value), min), max);
}

_binds() {
if (this.cancelButton) {
this._bindOverCancel();
Expand All @@ -226,7 +220,6 @@ class Raty {
this._bindClick();
this._bindOut();
}

_bindClick() {
this.stars.forEach(value => {
value.addEventListener('click', evt => {
Expand All @@ -247,7 +240,6 @@ class Raty {
});
});
}

_bindClickCancel() {
this.cancelButton.addEventListener('click', evt => {
this.scoreField.removeAttribute('value');
Expand All @@ -256,7 +248,6 @@ class Raty {
}
});
}

_bindOut() {
this.element.addEventListener('mouseleave', evt => {
const score = +this.scoreField.value || undefined;
Expand All @@ -268,7 +259,6 @@ class Raty {
}
});
}

_bindOutCancel() {
this.cancelButton.addEventListener('mouseleave', evt => {
let icon = this.opt.cancelOff;
Expand All @@ -282,7 +272,6 @@ class Raty {
}
});
}

_bindOver() {
const action = this.opt.half ? 'mousemove' : 'mouseover';
this.stars.forEach(value => {
Expand All @@ -301,7 +290,6 @@ class Raty {
});
});
}

_bindOverCancel() {
this.cancelButton.addEventListener('mouseover', evt => {
if (this._isReadOnly()) {
Expand All @@ -326,15 +314,13 @@ class Raty {
}
});
}

_buildScoreField() {
const input = document.createElement('input');
input.name = this.opt.scoreName;
input.type = 'hidden';
this.element.appendChild(input);
return input;
}

_createCancel() {
const button = document.createElement(this.opt.starType);
const icon = this.opt.path + this.opt.cancelOff;
Expand All @@ -345,7 +331,6 @@ class Raty {
button.setAttribute('src', icon);
} else {
button.classList.add(icon);

button.setAttribute('data-alt', 'x');
}
if (this.opt.cancelPlace === 'left') {
Expand All @@ -357,7 +342,6 @@ class Raty {
}
this.cancelButton = button;
}

_createScore() {
this.scoreField = document.querySelector(this.opt.targetScore) || this._buildScoreField();
}
Expand All @@ -375,7 +359,6 @@ class Raty {
}
this.stars = this.element.querySelectorAll(this.opt.starType);
}

_error(message) {
throw new Error(message);
}
Expand All @@ -392,7 +375,6 @@ class Raty {
}
}
}

_fill(score) {
let hash = 0;
if (this.opt.iconRangeSame && this.opt.iconRange) {
Expand Down Expand Up @@ -430,21 +412,18 @@ class Raty {
}
return result;
}

_getRangeIcon(irange, turnOn) {
return turnOn ? irange.on || this.opt.starOn : irange.off || this.opt.starOff;
}

_getScoreByPosition(evt, icon) {
let score = parseInt(icon.alt || icon.getAttribute('data-alt'), 10);
if (this.opt.half) {
const size = this._getWidth();
const percent = parseFloat((evt.pageX - icon.offsetLeft) / size);
const percent = parseFloat((evt.pageX - icon.getBoundingClientRect().x) / size);
score = score - 1 + percent;
}
return score;
}

_getHint(score, evt) {
if (score !== 0 && !score) {
return this.opt.noRatedMsg;
Expand All @@ -465,7 +444,6 @@ class Raty {
}
return hint === '' ? '' : hint || score;
}

_getWidth() {
const width = parseFloat(this.stars[0].offsetWidth) || 16;
if (!width) {
Expand All @@ -478,7 +456,6 @@ class Raty {
true: true
}[this.element.dataset.readOnly] || false;
}

_lock() {
const hint = this._getHint(this.scoreField.value);
this.element.style.pointerEvents = 'none';
Expand All @@ -495,7 +472,6 @@ class Raty {
_nameForIndex(i) {
return this.opt.score && this.opt.score >= i ? 'starOn' : 'starOff';
}

_resetTitle() {
for (let i = 0; i < this.opt.number; i++) {
this.stars[i].title = this._getHint(i + 1);
Expand All @@ -515,7 +491,6 @@ class Raty {
return acc;
}, {});
}

_roundHalfScore(score) {
const integer = parseInt(score, 10);
let decimal = this._getDecimal(score, 1);
Expand All @@ -524,7 +499,6 @@ class Raty {
}
return integer + decimal;
}

_roundStars(score, evt) {
const name = this._starName(score, evt);
if (name) {
Expand All @@ -533,7 +507,6 @@ class Raty {
star && this._setIcon(star, icon);
}
}

_setIcon(star, icon) {
star[this.opt.starType === 'img' ? 'src' : 'className'] = this.opt.path + icon;
}
Expand All @@ -543,7 +516,6 @@ class Raty {
this.opt.path += '/';
}
}

_setTarget(target, score) {
if (score) {
score = this.opt.targetFormat.toString().replace('{score}', score);
Expand All @@ -554,7 +526,6 @@ class Raty {
target.textContent = score;
}
}

_setTitle(score, evt) {
if (score) {
const integer = parseInt(Math.ceil(score), 10);
Expand All @@ -578,7 +549,6 @@ class Raty {
}
return 'starOn';
}

_target(score, evt) {
if (this.opt.target) {
const target = document.querySelector(this.opt.target);
Expand All @@ -604,11 +574,9 @@ class Raty {
this._setTarget(target, score);
}
}

_turnOn(i, score) {
return this.opt.single ? i === score : i <= score;
}

_unlock() {
this.element.style.cursor = 'pointer';
this.element.style.pointerEvents = 'auto';
Expand Down
2 changes: 1 addition & 1 deletion build/raty.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/raty.module.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/raty.systemjs.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/raty.umd.min.js

Large diffs are not rendered by default.

0 comments on commit 57ee4ee

Please sign in to comment.