}
insert(mediaList, insertType, thumbnailSize) {
switch (insertType) {
- case "separate" /* Separate */: {
+ case "separate" /* MediaInsertType.Separate */: {
let sizeArgument = "";
if (thumbnailSize) {
sizeArgument = ` size="${thumbnailSize}"`;
this.submitButton.disabled = false;
}
switch (response.type) {
- case "authorizationRequired" /* AuthorizationRequired */:
+ case "authorizationRequired" /* ResponseType.AuthorizationRequired */:
this.promptCredentials(response.template);
break;
- case "conflict" /* Conflict */:
+ case "conflict" /* ResponseType.Conflict */:
this.showConflict(response.template);
break;
- case "queue" /* Queue */:
+ case "queue" /* ResponseType.Queue */:
this.startInstallation(response.queueID);
break;
default:
if (element.closest(".popover") !== null) {
this.cache.set(id, {
content: null,
- state: 0 /* None */,
+ state: 0 /* State.None */,
});
return;
}
if (!this.cache.has(cacheId)) {
this.cache.set(cacheId, {
content: null,
- state: 0 /* None */,
+ state: 0 /* State.None */,
});
}
});
fragment = Util_1.default.createFragmentFromHtml("<p>" + content + "</p>");
}
data.content = fragment;
- data.state = 2 /* Ready */;
+ data.state = 2 /* State.Ready */;
if (this.activeId) {
const activeElement = this.elements.get(this.activeId).element;
if (activeElement.dataset.cacheId === cacheId) {
if (this.hoverId === id) {
this.show();
}
- }, 800 /* Show */);
+ }, 800 /* Delay.Show */);
}
/**
* Handles the mouse leaving the popover-enabled element or the popover itself.
if (this.timerLeave) {
return;
}
- this.timerLeave = window.setTimeout(() => this.hidePopover(), 500 /* Hide */);
+ this.timerLeave = window.setTimeout(() => this.hidePopover(), 500 /* Delay.Hide */);
}
/**
* Handles the mouse start hovering the popover element.
const cacheId = elementData.element.dataset.cacheId;
const data = this.cache.get(cacheId);
switch (data.state) {
- case 2 /* Ready */: {
+ case 2 /* State.Ready */: {
this.popoverContent.appendChild(data.content);
this.rebuild();
break;
}
- case 0 /* None */: {
- data.state = 1 /* Loading */;
+ case 0 /* State.None */: {
+ data.state = 1 /* State.Loading */;
const handler = this.handlers.get(elementData.identifier);
if (handler.loadCallback) {
handler.loadCallback(elementData.objectId, this, elementData.element);
}
break;
}
- case 1 /* Loading */: {
+ case 1 /* State.Loading */: {
// Do not interrupt inflight requests.
break;
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.prevByTag = exports.prevByClass = exports.prevBySel = exports.prev = exports.nextByTag = exports.nextByClass = exports.nextBySel = exports.next = exports.parentByTag = exports.parentByClass = exports.parentBySel = exports.childrenByTag = exports.childrenByClass = exports.childrenBySel = exports.childByTag = exports.childByClass = exports.childBySel = void 0;
const _test = new Map([
- [0 /* None */, () => true],
- [1 /* Selector */, (element, selector) => element.matches(selector)],
- [2 /* ClassName */, (element, className) => element.classList.contains(className)],
- [3 /* TagName */, (element, tagName) => element.nodeName === tagName],
+ [0 /* Type.None */, () => true],
+ [1 /* Type.Selector */, (element, selector) => element.matches(selector)],
+ [2 /* Type.ClassName */, (element, className) => element.classList.contains(className)],
+ [3 /* Type.TagName */, (element, tagName) => element.nodeName === tagName],
]);
function _getChildren(element, type, value) {
if (!(element instanceof Element)) {
* Examines child elements and returns the first child matching the given selector.
*/
function childBySel(element, selector) {
- return _getChildren(element, 1 /* Selector */, selector)[0] || null;
+ return _getChildren(element, 1 /* Type.Selector */, selector)[0] || null;
}
exports.childBySel = childBySel;
/**
* Examines child elements and returns the first child that has the given CSS class set.
*/
function childByClass(element, className) {
- return _getChildren(element, 2 /* ClassName */, className)[0] || null;
+ return _getChildren(element, 2 /* Type.ClassName */, className)[0] || null;
}
exports.childByClass = childByClass;
function childByTag(element, tagName) {
- return _getChildren(element, 3 /* TagName */, tagName)[0] || null;
+ return _getChildren(element, 3 /* Type.TagName */, tagName)[0] || null;
}
exports.childByTag = childByTag;
/**
* Examines child elements and returns all children matching the given selector.
*/
function childrenBySel(element, selector) {
- return _getChildren(element, 1 /* Selector */, selector);
+ return _getChildren(element, 1 /* Type.Selector */, selector);
}
exports.childrenBySel = childrenBySel;
/**
* Examines child elements and returns all children that have the given CSS class set.
*/
function childrenByClass(element, className) {
- return _getChildren(element, 2 /* ClassName */, className);
+ return _getChildren(element, 2 /* Type.ClassName */, className);
}
exports.childrenByClass = childrenByClass;
function childrenByTag(element, tagName) {
- return _getChildren(element, 3 /* TagName */, tagName);
+ return _getChildren(element, 3 /* Type.TagName */, tagName);
}
exports.childrenByTag = childrenByTag;
/**
* Examines parent nodes and returns the first parent that matches the given selector.
*/
function parentBySel(element, selector, untilElement) {
- return _getParent(element, 1 /* Selector */, selector, untilElement);
+ return _getParent(element, 1 /* Type.Selector */, selector, untilElement);
}
exports.parentBySel = parentBySel;
/**
* Examines parent nodes and returns the first parent that has the given CSS class set.
*/
function parentByClass(element, className, untilElement) {
- return _getParent(element, 2 /* ClassName */, className, untilElement);
+ return _getParent(element, 2 /* Type.ClassName */, className, untilElement);
}
exports.parentByClass = parentByClass;
/**
* Examines parent nodes and returns the first parent which equals the given tag.
*/
function parentByTag(element, tagName, untilElement) {
- return _getParent(element, 3 /* TagName */, tagName, untilElement);
+ return _getParent(element, 3 /* Type.TagName */, tagName, untilElement);
}
exports.parentByTag = parentByTag;
/**
* @deprecated 5.4 Use `element.nextElementSibling` instead.
*/
function next(element) {
- return _getSibling(element, "nextElementSibling", 0 /* None */, "");
+ return _getSibling(element, "nextElementSibling", 0 /* Type.None */, "");
}
exports.next = next;
/**
* Returns the next element sibling that matches the given selector.
*/
function nextBySel(element, selector) {
- return _getSibling(element, "nextElementSibling", 1 /* Selector */, selector);
+ return _getSibling(element, "nextElementSibling", 1 /* Type.Selector */, selector);
}
exports.nextBySel = nextBySel;
/**
* Returns the next element sibling with given CSS class.
*/
function nextByClass(element, className) {
- return _getSibling(element, "nextElementSibling", 2 /* ClassName */, className);
+ return _getSibling(element, "nextElementSibling", 2 /* Type.ClassName */, className);
}
exports.nextByClass = nextByClass;
/**
* Returns the next element sibling with given CSS class.
*/
function nextByTag(element, tagName) {
- return _getSibling(element, "nextElementSibling", 3 /* TagName */, tagName);
+ return _getSibling(element, "nextElementSibling", 3 /* Type.TagName */, tagName);
}
exports.nextByTag = nextByTag;
/**
* @deprecated 5.4 Use `element.previousElementSibling` instead.
*/
function prev(element) {
- return _getSibling(element, "previousElementSibling", 0 /* None */, "");
+ return _getSibling(element, "previousElementSibling", 0 /* Type.None */, "");
}
exports.prev = prev;
/**
* Returns the previous element sibling that matches the given selector.
*/
function prevBySel(element, selector) {
- return _getSibling(element, "previousElementSibling", 1 /* Selector */, selector);
+ return _getSibling(element, "previousElementSibling", 1 /* Type.Selector */, selector);
}
exports.prevBySel = prevBySel;
/**
* Returns the previous element sibling with given CSS class.
*/
function prevByClass(element, className) {
- return _getSibling(element, "previousElementSibling", 2 /* ClassName */, className);
+ return _getSibling(element, "previousElementSibling", 2 /* Type.ClassName */, className);
}
exports.prevByClass = prevByClass;
/**
* Returns the previous element sibling with given CSS class.
*/
function prevByTag(element, tagName) {
- return _getSibling(element, "previousElementSibling", 3 /* TagName */, tagName);
+ return _getSibling(element, "previousElementSibling", 3 /* Type.TagName */, tagName);
}
exports.prevByTag = prevByTag;
});
// Afrikaans
af(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Amharic
am(n) {
const i = Math.floor(Math.abs(n));
if (n == 1 || i === 0) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Arabic
ar(n) {
if (n == 0) {
- return "zero" /* Zero */;
+ return "zero" /* Category.Zero */;
}
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
if (n == 2) {
- return "two" /* Two */;
+ return "two" /* Category.Two */;
}
const mod100 = n % 100;
if (mod100 >= 3 && mod100 <= 10) {
- return "few" /* Few */;
+ return "few" /* Category.Few */;
}
if (mod100 >= 11 && mod100 <= 99) {
- return "many" /* Many */;
+ return "many" /* Category.Many */;
}
},
// Assamese
as(n) {
const i = Math.floor(Math.abs(n));
if (n == 1 || i === 0) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Azerbaijani
az(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Belarusian
const mod10 = n % 10;
const mod100 = n % 100;
if (mod10 == 1 && mod100 != 11) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
if (mod10 >= 2 && mod10 <= 4 && !(mod100 >= 12 && mod100 <= 14)) {
- return "few" /* Few */;
+ return "few" /* Category.Few */;
}
if (mod10 == 0 || (mod10 >= 5 && mod10 <= 9) || (mod100 >= 11 && mod100 <= 14)) {
- return "many" /* Many */;
+ return "many" /* Category.Many */;
}
},
// Bulgarian
bg(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Bengali
bn(n) {
const i = Math.floor(Math.abs(n));
if (n == 1 || i === 0) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Tibetan
const fMod10 = f % 10;
const fMod100 = f % 100;
if ((v == 0 && mod10 == 1 && mod100 != 11) || (fMod10 == 1 && fMod100 != 11)) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
if ((v == 0 && mod10 >= 2 && mod10 <= 4 && mod100 >= 12 && mod100 <= 14) ||
(fMod10 >= 2 && fMod10 <= 4 && fMod100 >= 12 && fMod100 <= 14)) {
- return "few" /* Few */;
+ return "few" /* Category.Few */;
}
},
// Czech
cs(n) {
const v = Plural.getV(n);
if (n == 1 && v === 0) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
if (n >= 2 && n <= 4 && v === 0) {
- return "few" /* Few */;
+ return "few" /* Category.Few */;
}
if (v === 0) {
- return "many" /* Many */;
+ return "many" /* Category.Many */;
}
},
// Welsh
cy(n) {
if (n == 0) {
- return "zero" /* Zero */;
+ return "zero" /* Category.Zero */;
}
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
if (n == 2) {
- return "two" /* Two */;
+ return "two" /* Category.Two */;
}
if (n == 3) {
- return "few" /* Few */;
+ return "few" /* Category.Few */;
}
if (n == 6) {
- return "many" /* Many */;
+ return "many" /* Category.Many */;
}
},
// Danish
da(n) {
if (n > 0 && n < 2) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Greek
el(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Catalan (ca)
// Urdu (ur)
en(n) {
if (n == 1 && Plural.getV(n) === 0) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Spanish
es(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Basque
eu(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Persian
fa(n) {
if (n >= 0 && n <= 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// French
fr(n) {
if (n >= 0 && n < 2) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Irish
ga(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
if (n == 2) {
- return "two" /* Two */;
+ return "two" /* Category.Two */;
}
if (n == 3 || n == 4 || n == 5 || n == 6) {
- return "few" /* Few */;
+ return "few" /* Category.Few */;
}
if (n == 7 || n == 8 || n == 9 || n == 10) {
- return "many" /* Many */;
+ return "many" /* Category.Many */;
}
},
// Gujarati
gu(n) {
if (n >= 0 && n <= 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Hebrew
he(n) {
const v = Plural.getV(n);
if (n == 1 && v === 0) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
if (n == 2 && v === 0) {
- return "two" /* Two */;
+ return "two" /* Category.Two */;
}
if (n > 10 && v === 0 && n % 10 == 0) {
- return "many" /* Many */;
+ return "many" /* Category.Many */;
}
},
// Hindi
hi(n) {
if (n >= 0 && n <= 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Croatian
// Hungarian
hu(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Armenian
hy(n) {
if (n >= 0 && n < 2) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Indonesian
is(n) {
const f = Plural.getF(n);
if ((f === 0 && n % 10 === 1 && !(n % 100 === 11)) || !(f === 0)) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Japanese
// Georgian
ka(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Kazakh
kk(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Khmer
// Kannada
kn(n) {
if (n >= 0 && n <= 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Korean
// Kurdish
ku(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Kyrgyz
ky(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Luxembourgish
lb(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Lao
const mod10 = n % 10;
const mod100 = n % 100;
if (mod10 == 1 && !(mod100 >= 11 && mod100 <= 19)) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
if (mod10 >= 2 && mod10 <= 9 && !(mod100 >= 11 && mod100 <= 19)) {
- return "few" /* Few */;
+ return "few" /* Category.Few */;
}
if (Plural.getF(n) != 0) {
- return "many" /* Many */;
+ return "many" /* Category.Many */;
}
},
// Latvian
const fMod10 = f % 10;
const fMod100 = f % 100;
if (mod10 == 0 || (mod100 >= 11 && mod100 <= 19) || (v == 2 && fMod100 >= 11 && fMod100 <= 19)) {
- return "zero" /* Zero */;
+ return "zero" /* Category.Zero */;
}
if ((mod10 == 1 && mod100 != 11) || (v == 2 && fMod10 == 1 && fMod100 != 11) || (v != 2 && fMod10 == 1)) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Macedonian
// Malayalam
ml(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Mongolian
mn(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Marathi
mr(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Malay
mt(n) {
const mod100 = n % 100;
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
if (n == 0 || (mod100 >= 2 && mod100 <= 10)) {
- return "few" /* Few */;
+ return "few" /* Category.Few */;
}
if (mod100 >= 11 && mod100 <= 19) {
- return "many" /* Many */;
+ return "many" /* Category.Many */;
}
},
// Burmese
// Norwegian
no(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Nepali
ne(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Odia
or(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Punjabi
pa(n) {
if (n == 1 || n == 0) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Polish
const mod10 = n % 10;
const mod100 = n % 100;
if (n == 1 && v == 0) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
if (v == 0 && mod10 >= 2 && mod10 <= 4 && !(mod100 >= 12 && mod100 <= 14)) {
- return "few" /* Few */;
+ return "few" /* Category.Few */;
}
if (v == 0 &&
((n != 1 && mod10 >= 0 && mod10 <= 1) || (mod10 >= 5 && mod10 <= 9) || (mod100 >= 12 && mod100 <= 14))) {
- return "many" /* Many */;
+ return "many" /* Category.Many */;
}
},
// Pashto
ps(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Portuguese
pt(n) {
if (n >= 0 && n < 2) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Romanian
const v = Plural.getV(n);
const mod100 = n % 100;
if (n == 1 && v === 0) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
if (v != 0 || n == 0 || (mod100 >= 2 && mod100 <= 19)) {
- return "few" /* Few */;
+ return "few" /* Category.Few */;
}
},
// Russian
const mod100 = n % 100;
if (Plural.getV(n) == 0) {
if (mod10 == 1 && mod100 != 11) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
if (mod10 >= 2 && mod10 <= 4 && !(mod100 >= 12 && mod100 <= 14)) {
- return "few" /* Few */;
+ return "few" /* Category.Few */;
}
if (mod10 == 0 || (mod10 >= 5 && mod10 <= 9) || (mod100 >= 11 && mod100 <= 14)) {
- return "many" /* Many */;
+ return "many" /* Category.Many */;
}
}
},
// Sindhi
sd(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Sinhala
si(n) {
if (n == 0 || n == 1 || (Math.floor(n) == 0 && Plural.getF(n) == 1)) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Slovak
const v = Plural.getV(n);
const mod100 = n % 100;
if (v == 0 && mod100 == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
if (v == 0 && mod100 == 2) {
- return "two" /* Two */;
+ return "two" /* Category.Two */;
}
if ((v == 0 && (mod100 == 3 || mod100 == 4)) || v != 0) {
- return "few" /* Few */;
+ return "few" /* Category.Few */;
}
},
// Albanian
sq(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Serbian
// Tamil
ta(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Telugu
te(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Tajik
// Turkmen
tk(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Turkish
tr(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Uyghur
ug(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Ukrainian
// Uzbek
uz(n) {
if (n == 1) {
- return "one" /* One */;
+ return "one" /* Category.One */;
}
},
// Vietnamese
if (category) {
return category;
}
- return "other" /* Other */;
+ return "other" /* Category.Other */;
},
/**
* Returns the value for a `plural` element used in the template.
}
let category = Plural.getCategory(value);
if (!parameters[category]) {
- category = "other" /* Other */;
+ category = "other" /* Category.Other */;
}
const string = parameters[category];
if (string.indexOf("#") !== -1) {
thumbnailSize = thumbnailSizeSelect.value;
}
if (this._options.callbackInsert !== null) {
- this._options.callbackInsert(this._mediaToInsert, "separate" /* Separate */, thumbnailSize);
+ this._options.callbackInsert(this._mediaToInsert, "separate" /* MediaInsertType.Separate */, thumbnailSize);
}
else {
this._options.editor.buffer.set();
}
}
else if (options.pointerClassNames.length === 2) {
- element.classList[top === "auto" ? "add" : "remove"](options.pointerClassNames[0 /* Bottom */]);
- element.classList[left === "auto" ? "add" : "remove"](options.pointerClassNames[1 /* Right */]);
+ element.classList[top === "auto" ? "add" : "remove"](options.pointerClassNames[0 /* PointerClass.Bottom */]);
+ element.classList[left === "auto" ? "add" : "remove"](options.pointerClassNames[1 /* PointerClass.Right */]);
}
Util_1.default.setStyles(element, {
bottom: bottom === "auto" ? bottom : Math.round(bottom).toString() + "px",
</div>`,
options: {
onSetup: (content) => {
- this.channels.set("r" /* R */, content.querySelector('input[data-channel="r"]'));
- this.channels.set("g" /* G */, content.querySelector('input[data-channel="g"]'));
- this.channels.set("b" /* B */, content.querySelector('input[data-channel="b"]'));
- this.channels.set("a" /* A */, content.querySelector('input[data-channel="a"]'));
+ this.channels.set("r" /* Channel.R */, content.querySelector('input[data-channel="r"]'));
+ this.channels.set("g" /* Channel.G */, content.querySelector('input[data-channel="g"]'));
+ this.channels.set("b" /* Channel.B */, content.querySelector('input[data-channel="b"]'));
+ this.channels.set("a" /* Channel.A */, content.querySelector('input[data-channel="a"]'));
this.channels.forEach((input) => {
- input.addEventListener("input", () => this.updateColor("rgba" /* RGBA */));
+ input.addEventListener("input", () => this.updateColor("rgba" /* ColorSource.RGBA */));
});
this.hslContainer = content.querySelector(".colorPickerHsvContainer");
- this.hsl.set("hue" /* Hue */, content.querySelector('input[data-coordinate="hue"]'));
- this.hsl.set("saturation" /* Saturation */, content.querySelector('input[data-coordinate="saturation"]'));
- this.hsl.set("lightness" /* Lightness */, content.querySelector('input[data-coordinate="lightness"]'));
+ this.hsl.set("hue" /* HSL.Hue */, content.querySelector('input[data-coordinate="hue"]'));
+ this.hsl.set("saturation" /* HSL.Saturation */, content.querySelector('input[data-coordinate="saturation"]'));
+ this.hsl.set("lightness" /* HSL.Lightness */, content.querySelector('input[data-coordinate="lightness"]'));
this.hsl.forEach((input) => {
- input.addEventListener("input", () => this.updateColor("hsl" /* HSL */));
+ input.addEventListener("input", () => this.updateColor("hsl" /* ColorSource.HSL */));
});
this.newColor = content.querySelector(".colorPickerColorNew > span");
this.oldColor = content.querySelector(".colorPickerColorOld > span");
return;
}
}
- this.setColor(color, "hex" /* HEX */);
+ this.setColor(color, "hex" /* ColorSource.HEX */);
}
/**
* Returns the current RGBA color set via the color and alpha input.
* @since 5.5
*/
getColor(source) {
- const a = parseFloat(this.channels.get("a" /* A */).value);
- if (source === "hsl" /* HSL */) {
- const rgb = ColorUtil.hslToRgb(parseInt(this.hsl.get("hue" /* Hue */).value, 10), parseInt(this.hsl.get("saturation" /* Saturation */).value, 10), parseInt(this.hsl.get("lightness" /* Lightness */).value, 10));
+ const a = parseFloat(this.channels.get("a" /* Channel.A */).value);
+ if (source === "hsl" /* ColorSource.HSL */) {
+ const rgb = ColorUtil.hslToRgb(parseInt(this.hsl.get("hue" /* HSL.Hue */).value, 10), parseInt(this.hsl.get("saturation" /* HSL.Saturation */).value, 10), parseInt(this.hsl.get("lightness" /* HSL.Lightness */).value, 10));
return {
...rgb,
a,
};
}
return {
- r: parseInt(this.channels.get("r" /* R */).value, 10),
- g: parseInt(this.channels.get("g" /* G */).value, 10),
- b: parseInt(this.channels.get("b" /* B */).value, 10),
+ r: parseInt(this.channels.get("r" /* Channel.R */).value, 10),
+ g: parseInt(this.channels.get("g" /* Channel.G */).value, 10),
+ b: parseInt(this.channels.get("b" /* Channel.B */).value, 10),
a,
};
}
}
const { r, g, b, a } = color;
const { h, s, l } = ColorUtil.rgbToHsl(r, g, b);
- if (source !== "hsl" /* HSL */) {
- this.hsl.get("hue" /* Hue */).value = h.toString();
- this.hsl.get("saturation" /* Saturation */).value = s.toString();
- this.hsl.get("lightness" /* Lightness */).value = l.toString();
+ if (source !== "hsl" /* ColorSource.HSL */) {
+ this.hsl.get("hue" /* HSL.Hue */).value = h.toString();
+ this.hsl.get("saturation" /* HSL.Saturation */).value = s.toString();
+ this.hsl.get("lightness" /* HSL.Lightness */).value = l.toString();
}
- this.hslContainer.style.setProperty(`--${"hue" /* Hue */}`, `${h}`);
- this.hslContainer.style.setProperty(`--${"saturation" /* Saturation */}`, `${s}%`);
- this.hslContainer.style.setProperty(`--${"lightness" /* Lightness */}`, `${l}%`);
- if (source !== "rgba" /* RGBA */) {
- this.channels.get("r" /* R */).value = r.toString();
- this.channels.get("g" /* G */).value = g.toString();
- this.channels.get("b" /* B */).value = b.toString();
- this.channels.get("a" /* A */).value = a.toString();
+ this.hslContainer.style.setProperty(`--${"hue" /* HSL.Hue */}`, `${h}`);
+ this.hslContainer.style.setProperty(`--${"saturation" /* HSL.Saturation */}`, `${s}%`);
+ this.hslContainer.style.setProperty(`--${"lightness" /* HSL.Lightness */}`, `${l}%`);
+ if (source !== "rgba" /* ColorSource.RGBA */) {
+ this.channels.get("r" /* Channel.R */).value = r.toString();
+ this.channels.get("g" /* Channel.G */).value = g.toString();
+ this.channels.get("b" /* Channel.B */).value = b.toString();
+ this.channels.get("a" /* Channel.A */).value = a.toString();
}
this.newColor.style.backgroundColor = ColorUtil.rgbaToString(color);
- if (source !== "hex" /* HEX */) {
+ if (source !== "hex" /* ColorSource.HEX */) {
this.colorTextInput.value = ColorUtil.rgbaToHex(color);
}
}
if (typeof color === "string") {
color = ColorUtil.stringToRgba(color);
}
- this.setColor(color, "setup" /* Setup */);
+ this.setColor(color, "setup" /* ColorSource.Setup */);
this.oldColor.style.backgroundColor = ColorUtil.rgbaToString(color);
}
/**
* @since 5.5
*/
submitDialog() {
- const color = this.getColor("rgba" /* RGBA */);
+ const color = this.getColor("rgba" /* ColorSource.RGBA */);
const colorString = ColorUtil.rgbaToString(color);
this.oldColor.style.backgroundColor = colorString;
this.input.value = colorString;
this.form.addEventListener("submit", (event) => {
event.preventDefault();
this.activePage = 1;
- void this.search(0 /* Modify */);
+ void this.search(0 /* SearchAction.Modify */);
});
this.typeInput.addEventListener("change", () => this.changeType());
window.addEventListener("popstate", () => {
updateQueryString(searchAction) {
const url = new URL(this.form.action);
url.search += url.search !== "" ? "&" : "?";
- if (searchAction !== 1 /* Navigation */) {
+ if (searchAction !== 1 /* SearchAction.Navigation */) {
this.searchParameters = [];
new FormData(this.form).forEach((value, key) => {
if (value.toString().trim()) {
parameters.push(["pageNo", this.activePage.toString()]);
}
url.search += new URLSearchParams(parameters);
- if (searchAction === 2 /* Init */) {
+ if (searchAction === 2 /* SearchAction.Init */) {
window.history.replaceState({}, document.title, url.toString());
}
else {
}
});
this.typeInput.dispatchEvent(new Event("change"));
- void this.search(2 /* Init */);
+ void this.search(2 /* SearchAction.Init */);
}
initPagination(position) {
const wrapperDiv = document.createElement("div");
this.activePage = pageNo;
this.removeSearchResults();
this.showSearchResults(template);
- this.updateQueryString(1 /* Navigation */);
+ this.updateQueryString(1 /* SearchAction.Navigation */);
}
removeSearchResults() {
while (this.form.nextSibling !== null && this.form.nextSibling !== this.delimiter) {