mirror of
https://github.com/owncast/owncast.git
synced 2024-10-10 19:16:02 +00:00
![dependabot[bot]](/assets/img/avatar_default.png)
* Commit updated Javascript packages * Bump preact from 10.5.4 to 10.5.5 in /build/javascript (#265) * Trying a new github workflow to install javascript packages * Bump tailwindcss from 1.9.2 to 1.9.4 in /build/javascript (#266) Bumps [tailwindcss](https://github.com/tailwindlabs/tailwindcss) from 1.9.2 to 1.9.4. - [Release notes](https://github.com/tailwindlabs/tailwindcss/releases) - [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/master/CHANGELOG.md) - [Commits](https://github.com/tailwindlabs/tailwindcss/compare/v1.9.2...v1.9.4) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Commit updated Javascript packages * Bump preact from 10.5.4 to 10.5.5 in /build/javascript Bumps [preact](https://github.com/preactjs/preact) from 10.5.4 to 10.5.5. - [Release notes](https://github.com/preactjs/preact/releases) - [Commits](https://github.com/preactjs/preact/compare/10.5.4...10.5.5) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Gabe Kangas <gabek@real-ity.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Owncast <owncast@owncast.online> * Bump @justinribeiro/lite-youtube in /build/javascript Bumps [@justinribeiro/lite-youtube](https://github.com/justinribeiro/lite-youtube) from 0.9.0 to 0.9.1. - [Release notes](https://github.com/justinribeiro/lite-youtube/releases) - [Commits](https://github.com/justinribeiro/lite-youtube/commits) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Owncast <owncast@owncast.online> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Gabe Kangas <gabek@real-ity.com>
82 lines
2.5 KiB
JavaScript
82 lines
2.5 KiB
JavaScript
"use strict";
|
|
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
r[k] = a[j];
|
|
return r;
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var actionTypes = {
|
|
equals: "",
|
|
element: "~",
|
|
start: "^",
|
|
end: "$",
|
|
any: "*",
|
|
not: "!",
|
|
hyphen: "|",
|
|
};
|
|
var charsToEscape = new Set(__spreadArrays(Object.values(actionTypes).filter(Boolean), [
|
|
":",
|
|
"[",
|
|
"]",
|
|
" ",
|
|
"\\",
|
|
]));
|
|
function stringify(token) {
|
|
return token.map(stringifySubselector).join(", ");
|
|
}
|
|
exports.default = stringify;
|
|
function stringifySubselector(token) {
|
|
return token.map(stringifyToken).join("");
|
|
}
|
|
function stringifyToken(token) {
|
|
switch (token.type) {
|
|
// Simple types
|
|
case "child":
|
|
return " > ";
|
|
case "parent":
|
|
return " < ";
|
|
case "sibling":
|
|
return " ~ ";
|
|
case "adjacent":
|
|
return " + ";
|
|
case "descendant":
|
|
return " ";
|
|
case "universal":
|
|
return "*";
|
|
case "tag":
|
|
return escapeName(token.name);
|
|
case "pseudo-element":
|
|
return "::" + escapeName(token.name);
|
|
case "pseudo":
|
|
if (token.data === null)
|
|
return ":" + escapeName(token.name);
|
|
if (typeof token.data === "string") {
|
|
return ":" + escapeName(token.name) + "(" + token.data + ")";
|
|
}
|
|
return ":" + escapeName(token.name) + "(" + stringify(token.data) + ")";
|
|
case "attribute":
|
|
if (token.action === "exists") {
|
|
return "[" + escapeName(token.name) + "]";
|
|
}
|
|
if (token.name === "id" &&
|
|
token.action === "equals" &&
|
|
!token.ignoreCase) {
|
|
return "#" + escapeName(token.value);
|
|
}
|
|
if (token.name === "class" &&
|
|
token.action === "element" &&
|
|
!token.ignoreCase) {
|
|
return "." + escapeName(token.value);
|
|
}
|
|
return "[" + escapeName(token.name) + actionTypes[token.action] + "='" + escapeName(token.value) + "'" + (token.ignoreCase ? "i" : "") + "]";
|
|
}
|
|
}
|
|
function escapeName(str) {
|
|
return str
|
|
.split("")
|
|
.map(function (c) { return (charsToEscape.has(c) ? "\\" + c : c); })
|
|
.join("");
|
|
}
|