From 4b4176192b8c2084ad7bae68668dd17024308149 Mon Sep 17 00:00:00 2001 From: Marcell Mars Date: Tue, 6 Sep 2022 22:48:31 +0200 Subject: [PATCH] upgrade sandpoints theme... --- .../data/sandpointsnamegraph.json | 1 + .../static/js/paged.polyfill.js | 5960 +++++++++++------ _vendor/modules.txt | 2 +- content/struggle/_index.md | 0 content/struggle/health_care.md | 20 - 5 files changed, 3844 insertions(+), 2139 deletions(-) delete mode 100644 content/struggle/_index.md delete mode 100644 content/struggle/health_care.md diff --git a/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/data/sandpointsnamegraph.json b/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/data/sandpointsnamegraph.json index 7538769..5781557 100644 --- a/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/data/sandpointsnamegraph.json +++ b/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/data/sandpointsnamegraph.json @@ -31,6 +31,7 @@ "pin": "pins", "record": "records", "reflection": "reflections", + "research": "researches", "room": "rooms", "scribe": "scribes", "section": "sections", diff --git a/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/static/js/paged.polyfill.js b/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/static/js/paged.polyfill.js index c984974..9dec03e 100644 --- a/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/static/js/paged.polyfill.js +++ b/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/static/js/paged.polyfill.js @@ -1,22 +1,18 @@ /** - * @license Paged.js v0.1.43 | MIT | https://gitlab.pagedmedia.org/tools/pagedjs + * @license Paged.js v0.3.1 | MIT | https://gitlab.pagedmedia.org/tools/pagedjs */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, global.PagedPolyfill = factory()); -}(this, (function () { 'use strict'; + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.PagedPolyfill = factory()); +})(this, (function () { 'use strict'; - function createCommonjsModule(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; - } + var eventEmitter = {exports: {}}; - function getCjsExportFromNamespace (n) { - return n && n['default'] || n; - } + var d$3 = {exports: {}}; - var isImplemented = function () { + var isImplemented$6 = function () { var assign = Object.assign, obj; if (typeof assign !== "function") return false; obj = { foo: "raz" }; @@ -24,7 +20,7 @@ return (obj.foo + obj.bar + obj.trzy) === "razdwatrzy"; }; - var isImplemented$1 = function () { + var isImplemented$5 = function () { try { Object.keys("primitive"); return true; @@ -34,34 +30,40 @@ }; // eslint-disable-next-line no-empty-function - var noop = function () {}; + var noop$4 = function () {}; - var _undefined = noop(); // Support ES3 engines + var _undefined = noop$4(); // Support ES3 engines - var isValue = function (val) { + var isValue$5 = function (val) { return (val !== _undefined) && (val !== null); }; - var keys = Object.keys; + var isValue$4 = isValue$5; - var shim = function (object) { - return keys(isValue(object) ? Object(object) : object); + var keys$2 = Object.keys; + + var shim$5 = function (object) { + return keys$2(isValue$4(object) ? Object(object) : object); }; - var keys$1 = isImplemented$1() + var keys$1 = isImplemented$5() ? Object.keys - : shim; + : shim$5; - var validValue = function (value) { - if (!isValue(value)) throw new TypeError("Cannot use null or undefined"); + var isValue$3 = isValue$5; + + var validValue$1 = function (value) { + if (!isValue$3(value)) throw new TypeError("Cannot use null or undefined"); return value; }; - var max = Math.max; + var keys = keys$1 + , value$3 = validValue$1 + , max$1 = Math.max; - var shim$1 = function (dest, src /*, …srcn*/) { - var error, i, length = max(arguments.length, 2), assign; - dest = Object(validValue(dest)); + var shim$4 = function (dest, src /*, …srcn*/) { + var error, i, length = max$1(arguments.length, 2), assign; + dest = Object(value$3(dest)); assign = function (key) { try { dest[key] = src[key]; @@ -71,17 +73,19 @@ }; for (i = 1; i < length; ++i) { src = arguments[i]; - keys$1(src).forEach(assign); + keys(src).forEach(assign); } if (error !== undefined) throw error; return dest; }; - var assign = isImplemented() + var assign$2 = isImplemented$6() ? Object.assign - : shim$1; + : shim$4; - var forEach = Array.prototype.forEach, create = Object.create; + var isValue$2 = isValue$5; + + var forEach$1 = Array.prototype.forEach, create$6 = Object.create; var process = function (src, obj) { var key; @@ -90,42 +94,43 @@ // eslint-disable-next-line no-unused-vars var normalizeOptions = function (opts1 /*, …options*/) { - var result = create(null); - forEach.call(arguments, function (options) { - if (!isValue(options)) return; + var result = create$6(null); + forEach$1.call(arguments, function (options) { + if (!isValue$2(options)) return; process(Object(options), result); }); return result; }; - // Deprecated - - var isCallable = function (obj) { + var isCallable$1 = function (obj) { return typeof obj === "function"; }; var str = "razdwatrzy"; - var isImplemented$2 = function () { + var isImplemented$4 = function () { if (typeof str.contains !== "function") return false; return (str.contains("dwa") === true) && (str.contains("foo") === false); }; - var indexOf = String.prototype.indexOf; + var indexOf$3 = String.prototype.indexOf; - var shim$2 = function (searchString/*, position*/) { - return indexOf.call(this, searchString, arguments[1]) > -1; + var shim$3 = function (searchString/*, position*/) { + return indexOf$3.call(this, searchString, arguments[1]) > -1; }; - var contains = isImplemented$2() + var contains$1 = isImplemented$4() ? String.prototype.contains - : shim$2; + : shim$3; - var d_1 = createCommonjsModule(function (module) { + var assign$1 = assign$2 + , normalizeOpts = normalizeOptions + , isCallable = isCallable$1 + , contains = contains$1 - var d; + , d$2; - d = module.exports = function (dscr, value/*, options*/) { + d$2 = d$3.exports = function (dscr, value/*, options*/) { var c, e, w, options, desc; if ((arguments.length < 2) || (typeof dscr !== 'string')) { options = value; @@ -144,10 +149,10 @@ } desc = { value: value, configurable: c, enumerable: e, writable: w }; - return !options ? desc : assign(normalizeOptions(options), desc); + return !options ? desc : assign$1(normalizeOpts(options), desc); }; - d.gs = function (dscr, get, set/*, options*/) { + d$2.gs = function (dscr, get, set/*, options*/) { var c, e, options, desc; if (typeof dscr !== 'string') { options = set; @@ -177,18 +182,20 @@ } desc = { get: get, set: set, configurable: c, enumerable: e }; - return !options ? desc : assign(normalizeOptions(options), desc); + return !options ? desc : assign$1(normalizeOpts(options), desc); }; - }); var validCallable = function (fn) { if (typeof fn !== "function") throw new TypeError(fn + " is not a function"); return fn; }; - var eventEmitter = createCommonjsModule(function (module, exports) { + (function (module, exports) { - var apply = Function.prototype.apply, call = Function.prototype.call + var d = d$3.exports + , callable = validCallable + + , apply = Function.prototype.apply, call = Function.prototype.call , create = Object.create, defineProperty = Object.defineProperty , defineProperties = Object.defineProperties , hasOwnProperty = Object.prototype.hasOwnProperty @@ -199,7 +206,7 @@ on = function (type, listener) { var data; - validCallable(listener); + callable(listener); if (!hasOwnProperty.call(this, '__ee__')) { data = descriptor.value = create(null); @@ -218,7 +225,7 @@ once = function (type, listener) { var once, self; - validCallable(listener); + callable(listener); self = this; on.call(this, type, once = function () { off.call(self, type, once); @@ -232,7 +239,7 @@ off = function (type, listener) { var data, listeners, candidate, i; - validCallable(listener); + callable(listener); if (!hasOwnProperty.call(this, '__ee__')) return this; data = this.__ee__; @@ -303,10 +310,10 @@ }; descriptors = { - on: d_1(on), - once: d_1(once), - off: d_1(off), - emit: d_1(emit) + on: d(on), + once: d(once), + off: d(off), + emit: d(emit) }; base = defineProperties({}, descriptors); @@ -315,8 +322,9 @@ return (o == null) ? create(base) : defineProperties(Object(o), descriptors); }; exports.methods = methods; - }); - var eventEmitter_1 = eventEmitter.methods; + }(eventEmitter, eventEmitter.exports)); + + var EventEmitter = eventEmitter.exports; /** * Hooks allow for injecting functions that must all complete in order before finishing @@ -366,11 +374,12 @@ if(executing && typeof executing["then"] === "function") { // Task is a function that returns a promise promises.push(executing); + } else { + // Otherwise Task resolves immediately, add resolved promise with result + promises.push(new Promise((resolve, reject) => { + resolve(executing); + })); } - // Otherwise Task resolves immediately, add resolved promise with result - promises.push(new Promise((resolve, reject) => { - resolve(executing); - })); }); @@ -591,7 +600,7 @@ return node && node.nodeType === 3; } - function *walk(start, limiter) { + function* walk$2(start, limiter) { let node = start; while (node) { @@ -712,6 +721,41 @@ let fragment = document.createDocumentFragment(); + // Handle rowspan on table + if (node.nodeName === "TR") { + let previousRow = node.previousElementSibling; + let previousRowDistance = 1; + while (previousRow) { + // previous row has more columns, might indicate a rowspan. + if (previousRow.childElementCount > node.childElementCount) { + const initialColumns = Array.from(node.children); + while (node.firstChild) { + node.firstChild.remove(); + } + let k = 0; + for (let j = 0; j < previousRow.children.length; j++) { + let column = previousRow.children[j]; + if (column.rowSpan && column.rowSpan > previousRowDistance) { + const duplicatedColumn = column.cloneNode(true); + // Adjust rowspan value + duplicatedColumn.rowSpan = column.rowSpan - previousRowDistance; + // Add the column to the row + node.appendChild(duplicatedColumn); + } else { + // Fill the gap with the initial columns (if exists) + const initialColumn = initialColumns[k++]; + // The initial column can be undefined if the newly created table has less columns than the original table + if (initialColumn) { + node.appendChild(initialColumn); + } + } + } + } + previousRow = previousRow.previousElementSibling; + previousRowDistance++; + } + } + // Gather all ancestors let element = node; while(element.parentNode && element.parentNode.nodeType === 1) { @@ -844,8 +888,20 @@ if (node.dataset && node.dataset.undisplayed) { return false; } - const previousSignificantNodePage = previousSignificantNode.dataset ? previousSignificantNode.dataset.page : undefined; - const currentNodePage = node.dataset ? node.dataset.page : undefined; + let previousSignificantNodePage = previousSignificantNode.dataset ? previousSignificantNode.dataset.page : undefined; + if (typeof previousSignificantNodePage === "undefined") { + const nodeWithNamedPage = getNodeWithNamedPage(previousSignificantNode); + if (nodeWithNamedPage) { + previousSignificantNodePage = nodeWithNamedPage.dataset.page; + } + } + let currentNodePage = node.dataset ? node.dataset.page : undefined; + if (typeof currentNodePage === "undefined") { + const nodeWithNamedPage = getNodeWithNamedPage(node, previousSignificantNode); + if (nodeWithNamedPage) { + currentNodePage = nodeWithNamedPage.dataset.page; + } + } return currentNodePage !== previousSignificantNodePage; } @@ -856,10 +912,11 @@ let currentLetter; let range; + const significantWhitespaces = node.parentElement && node.parentElement.nodeName === "PRE"; - while(currentOffset < max) { + while (currentOffset < max) { currentLetter = currentText[currentOffset]; - if (/^[\S\u202F\u00A0]$/.test(currentLetter)) { + if (/^[\S\u202F\u00A0]$/.test(currentLetter) || significantWhitespaces) { if (!range) { range = document.createRange(); range.setStart(node, currentOffset); @@ -878,7 +935,6 @@ if (range) { range.setEnd(node, currentOffset); yield range; - range = undefined; } } @@ -1014,7 +1070,7 @@ } - function indexOf$1(node) { + function indexOf$2(node) { let parent = node.parentNode; if (!parent) { return 0; @@ -1113,6 +1169,23 @@ return null; } + function getNodeWithNamedPage(node, limiter) { + if (node && node.dataset && node.dataset.page) { + return node; + } + if (node.parentNode) { + while ((node = node.parentNode)) { + if (limiter && node === limiter) { + return; + } + if (node.dataset && node.dataset.page) { + return node; + } + } + } + return null; + } + function breakInsideAvoidParentNode(node) { while ((node = node.parentNode)) { if (node && node.dataset && node.dataset.breakInside === "avoid") { @@ -1209,6 +1282,25 @@ } + /** + * Render result. + * @class + */ + class RenderResult { + + constructor(breakToken, error) { + this.breakToken = breakToken; + this.error = error; + } + } + + class OverflowContentError extends Error { + constructor(message, items) { + super(message); + this.items = items; + } + } + const MAX_CHARS_PER_BREAK = 1500; /** @@ -1231,6 +1323,7 @@ this.hooks.layoutNode = new Hook(); this.hooks.beforeOverflow = new Hook(); this.hooks.onOverflow = new Hook(); + this.hooks.afterOverflowRemoved = new Hook(); this.hooks.onBreakToken = new Hook(); } @@ -1242,7 +1335,7 @@ async renderTo(wrapper, source, breakToken, bounds = this.bounds) { let start = this.getStart(source, breakToken); - let walker = walk(start, source); + let walker = walk$2(start, source); let node; let prevNode; @@ -1274,15 +1367,15 @@ if (newBreakToken && newBreakToken.equals(prevBreakToken)) { console.warn("Unable to layout item: ", prevNode); - return undefined; + return new RenderResult(undefined, new OverflowContentError("Unable to layout item", [prevNode])); } - return newBreakToken; + return new RenderResult(newBreakToken); } this.hooks && this.hooks.layoutNode.trigger(node); // Check if the rendered element has a break set - if (hasRenderedContent && this.shouldBreak(node)) { + if (hasRenderedContent && this.shouldBreak(node, start)) { this.hooks && this.hooks.layout.trigger(wrapper, this); let imgs = wrapper.querySelectorAll("img"); @@ -1298,7 +1391,7 @@ if (newBreakToken && newBreakToken.equals(prevBreakToken)) { console.warn("Unable to layout item: ", node); - return undefined; + return new RenderResult(undefined, new OverflowContentError("Unable to layout item", [node])); } length = 0; @@ -1320,7 +1413,7 @@ // Skip to the next node if a deep clone was rendered if (!shallow) { - walker = walk(nodeAfter(node, source), source); + walker = walk$2(nodeAfter(node, source), source); } if (this.forceRenderBreak) { @@ -1352,7 +1445,7 @@ if (newBreakToken && newBreakToken.equals(prevBreakToken)) { console.warn("Unable to layout item: ", node); - return undefined; + return new RenderResult(undefined, new OverflowContentError("Unable to layout item", [node])); } if (newBreakToken) { @@ -1362,7 +1455,7 @@ } - return newBreakToken; + return new RenderResult(newBreakToken); } breakAt(node, offset = 0) { @@ -1380,17 +1473,17 @@ return newBreakToken; } - shouldBreak(node) { - let previousSibling = previousSignificantNode(node); + shouldBreak(node, limiter) { + let previousNode = nodeBefore(node, limiter); let parentNode = node.parentNode; - let parentBreakBefore = needsBreakBefore(node) && parentNode && !previousSibling && needsBreakBefore(parentNode); + let parentBreakBefore = needsBreakBefore(node) && parentNode && !previousNode && needsBreakBefore(parentNode); let doubleBreakBefore; if (parentBreakBefore) { doubleBreakBefore = node.dataset.breakBefore === parentNode.dataset.breakBefore; } - return !doubleBreakBefore && needsBreakBefore(node) || needsPreviousBreakAfter(node) || needsPageBreak(node, previousSibling); + return !doubleBreakBefore && needsBreakBefore(node) || needsPreviousBreakAfter(node) || needsPageBreak(node, previousNode); } forceBreak() { @@ -1620,7 +1713,8 @@ } if (breakToken && breakToken.node && extract) { - this.removeOverflow(overflow, breakLetter); + let removed = this.removeOverflow(overflow, breakLetter); + this.hooks && this.hooks.afterOverflowRemoved.trigger(removed, rendered, this); } } @@ -1641,7 +1735,7 @@ let end = Math.round(bounds.right); let range; - let walker = walk(rendered.firstChild, rendered); + let walker = walk$2(rendered.firstChild, rendered); // Find Start let next, done, node, offset, skip, breakAvoid, prev, br; @@ -1677,6 +1771,47 @@ br = node.tagName === "BR" || node.tagName === "WBR"; } + let tableRow; + if (node.nodeName === "TR") { + tableRow = node; + } else { + tableRow = parentOf(node, "TR", rendered); + } + if (tableRow) { + // honor break-inside="avoid" in parent tbody/thead + let container = tableRow.parentElement; + if (["TBODY", "THEAD"].includes(container.nodeName)) { + let styles = window.getComputedStyle(container); + if (styles.getPropertyValue("break-inside") === "avoid") prev = container; + } + + // Check if the node is inside a row with a rowspan + const table = parentOf(tableRow, "TABLE", rendered); + if (table) { + let columnCount = 0; + for (const cell of Array.from(table.rows[0].cells)) { + columnCount += parseInt(cell.getAttribute("COLSPAN") || "1"); + } + if (tableRow.cells.length !== columnCount) { + let previousRow = tableRow.previousSibling; + let previousRowColumnCount; + while (previousRow !== null) { + previousRowColumnCount = 0; + for (const cell of Array.from(previousRow.cells)) { + previousRowColumnCount += parseInt(cell.getAttribute("COLSPAN") || "1"); + } + if (previousRowColumnCount === columnCount) { + break; + } + previousRow = previousRow.previousSibling; + } + if (previousRowColumnCount === columnCount) { + prev = previousRow; + } + } + } + } + if (prev) { range = document.createRange(); range.selectNode(prev); @@ -1727,7 +1862,7 @@ if (skip || right <= end) { next = nodeAfter(node, rendered); if (next) { - walker = walk(next, rendered); + walker = walk$2(next, rendered); } } @@ -1767,7 +1902,7 @@ if (isText(lastChild)) { if (lastChild.parentNode.dataset.ref) { - lastNodeIndex = indexOf$1(lastChild); + lastNodeIndex = indexOf$2(lastChild); lastChild = lastChild.parentNode; } else { lastChild = lastChild.previousSibling; @@ -1879,14 +2014,14 @@ } } - eventEmitter(Layout.prototype); + EventEmitter(Layout.prototype); /** * Render a page * @class */ class Page { - constructor(pagesArea, pageTemplate, blank, hooks) { + constructor(pagesArea, pageTemplate, blank, hooks, options) { this.pagesArea = pagesArea; this.pageTemplate = pageTemplate; this.blank = blank; @@ -1896,6 +2031,8 @@ this.hooks = hooks; + this.settings = options || {}; + // this.element = this.create(this.pageTemplate); } @@ -1916,6 +2053,7 @@ let pagebox = page.querySelector(".pagedjs_pagebox"); let area = page.querySelector(".pagedjs_page_content"); + let footnotesArea = page.querySelector(".pagedjs_footnote_area"); let size = area.getBoundingClientRect(); @@ -1931,6 +2069,7 @@ this.element = page; this.pagebox = pagebox; this.area = area; + this.footnotesArea = footnotesArea; return page; } @@ -2003,10 +2142,16 @@ this.startToken = breakToken; - this.layoutMethod = new Layout(this.area, this.hooks, maxChars); + let settings = this.settings; + if (!settings.maxChars && maxChars) { + settings.maxChars = maxChars; + } + + this.layoutMethod = new Layout(this.area, this.hooks, settings); + + let renderResult = await this.layoutMethod.renderTo(this.wrapper, contents, breakToken); + let newBreakToken = renderResult.breakToken; - let newBreakToken = await this.layoutMethod.renderTo(this.wrapper, contents, breakToken); - this.addListeners(contents); this.endToken = newBreakToken; @@ -2020,7 +2165,8 @@ return this.layout(contents, breakToken); } - let newBreakToken = await this.layoutMethod.renderTo(this.wrapper, contents, breakToken); + let renderResult = await this.layoutMethod.renderTo(this.wrapper, contents, breakToken); + let newBreakToken = renderResult.breakToken; this.endToken = newBreakToken; @@ -2151,7 +2297,7 @@ } } - eventEmitter(Page.prototype); + EventEmitter(Page.prototype); /** * Render a flow of text offscreen @@ -2499,6 +2645,11 @@
+
+
+
+
+
@@ -2523,6 +2674,7 @@ this.hooks.renderNode = new Hook(this); this.hooks.layoutNode = new Hook(this); this.hooks.onOverflow = new Hook(this); + this.hooks.afterOverflowRemoved = new Hook(this); this.hooks.onBreakToken = new Hook(); this.hooks.afterPageLayout = new Hook(this); this.hooks.afterRendered = new Hook(this); @@ -2631,7 +2783,7 @@ // } async render(parsed, startAt) { - let renderer = this.layout(parsed, startAt, this.settings); + let renderer = this.layout(parsed, startAt); let done = false; let result; @@ -2681,7 +2833,7 @@ } } - async handleBreaks(node) { + async handleBreaks(node, force) { let currentPage = this.total + 1; let currentPosition = currentPage % 2 === 0 ? "left" : "right"; // TODO: Recto and Verso should reverse for rtl languages @@ -2706,7 +2858,9 @@ breakBefore = node.dataset.breakBefore; } - if( previousBreakAfter && + if (force) { + page = this.addPage(true); + } else if( previousBreakAfter && (previousBreakAfter === "left" || previousBreakAfter === "right") && previousBreakAfter !== currentPosition) { page = this.addPage(true); @@ -2736,7 +2890,7 @@ async *layout(content, startAt) { let breakToken = startAt || false; - while (breakToken !== undefined && ( true)) { + while (breakToken !== undefined && (true)) { if (breakToken && breakToken.node) { await this.handleBreaks(breakToken.node); @@ -2803,7 +2957,7 @@ addPage(blank) { let lastPage = this.pages[this.pages.length - 1]; // Create a new page from the template - let page = new Page(this.pagesArea, this.pageTemplate, blank, this.hooks); + let page = new Page(this.pagesArea, this.pageTemplate, blank, this.hooks, this.settings); this.pages.push(page); @@ -2901,7 +3055,30 @@ } */ + async clonePage(originalPage) { + let lastPage = this.pages[this.pages.length - 1]; + let page = new Page(this.pagesArea, this.pageTemplate, false, this.hooks); + + this.pages.push(page); + + // Create the pages + page.create(undefined, lastPage && lastPage.element); + + page.index(this.total); + + await this.hooks.beforePageLayout.trigger(page, undefined, undefined, this); + this.emit("page", page); + + for (const className of originalPage.element.classList) { + if (className !== "pagedjs_left_page" && className !== "pagedjs_right_page") { + page.element.classList.add(className); + } + } + + await this.hooks.afterPageLayout.trigger(page.element, page, undefined, this); + this.emit("renderedPage", page); + } loadFonts() { let fontPromises = []; @@ -2928,7 +3105,11 @@ } - eventEmitter(Chunker.prototype); + EventEmitter(Chunker.prototype); + + var syntax = {exports: {}}; + + var create$5 = {}; // // list @@ -2987,16 +3168,16 @@ } var cursors = null; - var List = function() { + var List$6 = function() { this.cursor = null; this.head = null; this.tail = null; }; - List.createItem = createItem; - List.prototype.createItem = createItem; + List$6.createItem = createItem; + List$6.prototype.createItem = createItem; - List.prototype.updateCursors = function(prevOld, prevNew, nextOld, nextNew) { + List$6.prototype.updateCursors = function(prevOld, prevNew, nextOld, nextNew) { var cursor = this.cursor; while (cursor !== null) { @@ -3012,7 +3193,7 @@ } }; - List.prototype.getSize = function() { + List$6.prototype.getSize = function() { var size = 0; var cursor = this.head; @@ -3024,7 +3205,7 @@ return size; }; - List.prototype.fromArray = function(array) { + List$6.prototype.fromArray = function(array) { var cursor = null; this.head = null; @@ -3047,7 +3228,7 @@ return this; }; - List.prototype.toArray = function() { + List$6.prototype.toArray = function() { var cursor = this.head; var result = []; @@ -3059,21 +3240,21 @@ return result; }; - List.prototype.toJSON = List.prototype.toArray; + List$6.prototype.toJSON = List$6.prototype.toArray; - List.prototype.isEmpty = function() { + List$6.prototype.isEmpty = function() { return this.head === null; }; - List.prototype.first = function() { + List$6.prototype.first = function() { return this.head && this.head.data; }; - List.prototype.last = function() { + List$6.prototype.last = function() { return this.tail && this.tail.data; }; - List.prototype.each = function(fn, context) { + List$6.prototype.each = function(fn, context) { var item; if (context === undefined) { @@ -3094,9 +3275,9 @@ releaseCursor(this); }; - List.prototype.forEach = List.prototype.each; + List$6.prototype.forEach = List$6.prototype.each; - List.prototype.eachRight = function(fn, context) { + List$6.prototype.eachRight = function(fn, context) { var item; if (context === undefined) { @@ -3117,9 +3298,57 @@ releaseCursor(this); }; - List.prototype.forEachRight = List.prototype.eachRight; + List$6.prototype.forEachRight = List$6.prototype.eachRight; - List.prototype.nextUntil = function(start, fn, context) { + List$6.prototype.reduce = function(fn, initialValue, context) { + var item; + + if (context === undefined) { + context = this; + } + + // push cursor + var cursor = allocateCursor(this, null, this.head); + var acc = initialValue; + + while (cursor.next !== null) { + item = cursor.next; + cursor.next = item.next; + + acc = fn.call(context, acc, item.data, item, this); + } + + // pop cursor + releaseCursor(this); + + return acc; + }; + + List$6.prototype.reduceRight = function(fn, initialValue, context) { + var item; + + if (context === undefined) { + context = this; + } + + // push cursor + var cursor = allocateCursor(this, this.tail, null); + var acc = initialValue; + + while (cursor.prev !== null) { + item = cursor.prev; + cursor.prev = item.prev; + + acc = fn.call(context, acc, item.data, item, this); + } + + // pop cursor + releaseCursor(this); + + return acc; + }; + + List$6.prototype.nextUntil = function(start, fn, context) { if (start === null) { return; } @@ -3146,7 +3375,7 @@ releaseCursor(this); }; - List.prototype.prevUntil = function(start, fn, context) { + List$6.prototype.prevUntil = function(start, fn, context) { if (start === null) { return; } @@ -3173,7 +3402,7 @@ releaseCursor(this); }; - List.prototype.some = function(fn, context) { + List$6.prototype.some = function(fn, context) { var cursor = this.head; if (context === undefined) { @@ -3191,8 +3420,8 @@ return false; }; - List.prototype.map = function(fn, context) { - var result = new List(); + List$6.prototype.map = function(fn, context) { + var result = new List$6(); var cursor = this.head; if (context === undefined) { @@ -3207,8 +3436,8 @@ return result; }; - List.prototype.filter = function(fn, context) { - var result = new List(); + List$6.prototype.filter = function(fn, context) { + var result = new List$6(); var cursor = this.head; if (context === undefined) { @@ -3225,13 +3454,13 @@ return result; }; - List.prototype.clear = function() { + List$6.prototype.clear = function() { this.head = null; this.tail = null; }; - List.prototype.copy = function() { - var result = new List(); + List$6.prototype.copy = function() { + var result = new List$6(); var cursor = this.head; while (cursor !== null) { @@ -3242,7 +3471,7 @@ return result; }; - List.prototype.prepend = function(item) { + List$6.prototype.prepend = function(item) { // head // ^ // item @@ -3267,19 +3496,19 @@ return this; }; - List.prototype.prependData = function(data) { + List$6.prototype.prependData = function(data) { return this.prepend(createItem(data)); }; - List.prototype.append = function(item) { + List$6.prototype.append = function(item) { return this.insert(item); }; - List.prototype.appendData = function(data) { + List$6.prototype.appendData = function(data) { return this.insert(createItem(data)); }; - List.prototype.insert = function(item, before) { + List$6.prototype.insert = function(item, before) { if (before !== undefined && before !== null) { // prev before // ^ @@ -3334,11 +3563,11 @@ return this; }; - List.prototype.insertData = function(data, before) { + List$6.prototype.insertData = function(data, before) { return this.insert(createItem(data), before); }; - List.prototype.remove = function(item) { + List$6.prototype.remove = function(item) { // item // ^ // prev next @@ -3370,35 +3599,35 @@ return item; }; - List.prototype.push = function(data) { + List$6.prototype.push = function(data) { this.insert(createItem(data)); }; - List.prototype.pop = function() { + List$6.prototype.pop = function() { if (this.tail !== null) { return this.remove(this.tail); } }; - List.prototype.unshift = function(data) { + List$6.prototype.unshift = function(data) { this.prepend(createItem(data)); }; - List.prototype.shift = function() { + List$6.prototype.shift = function() { if (this.head !== null) { return this.remove(this.head); } }; - List.prototype.prependList = function(list) { + List$6.prototype.prependList = function(list) { return this.insertList(list, this.head); }; - List.prototype.appendList = function(list) { + List$6.prototype.appendList = function(list) { return this.insertList(list); }; - List.prototype.insertList = function(list, before) { + List$6.prototype.insertList = function(list, before) { // ignore empty lists if (list.head === null) { return this; @@ -3447,7 +3676,7 @@ return this; }; - List.prototype.replace = function(oldItem, newItemOrList) { + List$6.prototype.replace = function(oldItem, newItemOrList) { if ('head' in newItemOrList) { this.insertList(newItemOrList, oldItem); } else { @@ -3457,9 +3686,9 @@ this.remove(oldItem); }; - var List_1 = List; + var List_1 = List$6; - var createCustomError = function createCustomError(name, message) { + var createCustomError$3 = function createCustomError(name, message) { // use Object.create(), because some VMs prevent setting line/column otherwise // (iOS Safari 10 even throws an exception) var error = Object.create(SyntaxError.prototype); @@ -3477,6 +3706,7 @@ return error; }; + var createCustomError$2 = createCustomError$3; var MAX_LINE_LENGTH = 100; var OFFSET_CORRECTION = 60; var TAB_REPLACEMENT = ' '; @@ -3527,8 +3757,8 @@ ].filter(Boolean).join('\n'); } - var SyntaxError$1 = function(message, source, offset, line, column) { - var error = createCustomError('SyntaxError', message); + var SyntaxError$4 = function(message, source, offset, line, column) { + var error = createCustomError$2('SyntaxError', message); error.source = source; error.offset = offset; @@ -3557,11 +3787,11 @@ return error; }; - var _SyntaxError = SyntaxError$1; + var _SyntaxError$1 = SyntaxError$4; // CSS Syntax Module Level 3 // https://www.w3.org/TR/css-syntax-3/ - var TYPE = { + var TYPE$H = { EOF: 0, // Ident: 1, // Function: 2, // @@ -3590,33 +3820,33 @@ Comment: 25 }; - var NAME = Object.keys(TYPE).reduce(function(result, key) { - result[TYPE[key]] = key; + var NAME$3 = Object.keys(TYPE$H).reduce(function(result, key) { + result[TYPE$H[key]] = key; return result; }, {}); var _const = { - TYPE: TYPE, - NAME: NAME + TYPE: TYPE$H, + NAME: NAME$3 }; - var EOF = 0; + var EOF$1 = 0; // https://drafts.csswg.org/css-syntax-3/ // § 4.2. Definitions // digit // A code point between U+0030 DIGIT ZERO (0) and U+0039 DIGIT NINE (9). - function isDigit(code) { + function isDigit$5(code) { return code >= 0x0030 && code <= 0x0039; } // hex digit // A digit, or a code point between U+0041 LATIN CAPITAL LETTER A (A) and U+0046 LATIN CAPITAL LETTER F (F), // or a code point between U+0061 LATIN SMALL LETTER A (a) and U+0066 LATIN SMALL LETTER F (f). - function isHexDigit(code) { + function isHexDigit$4(code) { return ( - isDigit(code) || // 0 .. 9 + isDigit$5(code) || // 0 .. 9 (code >= 0x0041 && code <= 0x0046) || // A .. F (code >= 0x0061 && code <= 0x0066) // a .. f ); @@ -3624,7 +3854,7 @@ // uppercase letter // A code point between U+0041 LATIN CAPITAL LETTER A (A) and U+005A LATIN CAPITAL LETTER Z (Z). - function isUppercaseLetter(code) { + function isUppercaseLetter$1(code) { return code >= 0x0041 && code <= 0x005A; } @@ -3637,7 +3867,7 @@ // letter // An uppercase letter or a lowercase letter. function isLetter(code) { - return isUppercaseLetter(code) || isLowercaseLetter(code); + return isUppercaseLetter$1(code) || isLowercaseLetter(code); } // non-ASCII code point @@ -3654,8 +3884,8 @@ // name code point // A name-start code point, a digit, or U+002D HYPHEN-MINUS (-). - function isName(code) { - return isNameStart(code) || isDigit(code) || code === 0x002D; + function isName$2(code) { + return isNameStart(code) || isDigit$5(code) || code === 0x002D; } // non-printable code point @@ -3674,25 +3904,25 @@ // U+000A LINE FEED. Note that U+000D CARRIAGE RETURN and U+000C FORM FEED are not included in this definition, // as they are converted to U+000A LINE FEED during preprocessing. // TODO: we doesn't do a preprocessing, so check a code point for U+000D CARRIAGE RETURN and U+000C FORM FEED - function isNewline(code) { + function isNewline$1(code) { return code === 0x000A || code === 0x000D || code === 0x000C; } // whitespace // A newline, U+0009 CHARACTER TABULATION, or U+0020 SPACE. - function isWhiteSpace(code) { - return isNewline(code) || code === 0x0020 || code === 0x0009; + function isWhiteSpace$2(code) { + return isNewline$1(code) || code === 0x0020 || code === 0x0009; } // § 4.3.8. Check if two code points are a valid escape - function isValidEscape(first, second) { + function isValidEscape$2(first, second) { // If the first code point is not U+005C REVERSE SOLIDUS (\), return false. if (first !== 0x005C) { return false; } // Otherwise, if the second code point is a newline or EOF, return false. - if (isNewline(second) || second === EOF) { + if (isNewline$1(second) || second === EOF$1) { return false; } @@ -3701,7 +3931,7 @@ } // § 4.3.9. Check if three code points would start an identifier - function isIdentifierStart(first, second, third) { + function isIdentifierStart$2(first, second, third) { // Look at the first code point: // U+002D HYPHEN-MINUS @@ -3711,7 +3941,7 @@ return ( isNameStart(second) || second === 0x002D || - isValidEscape(second, third) + isValidEscape$2(second, third) ); } @@ -3724,7 +3954,7 @@ // U+005C REVERSE SOLIDUS (\) if (first === 0x005C) { // If the first and second code points are a valid escape, return true. Otherwise, return false. - return isValidEscape(first, second); + return isValidEscape$2(first, second); } // anything else @@ -3733,31 +3963,31 @@ } // § 4.3.10. Check if three code points would start a number - function isNumberStart(first, second, third) { + function isNumberStart$1(first, second, third) { // Look at the first code point: // U+002B PLUS SIGN (+) // U+002D HYPHEN-MINUS (-) if (first === 0x002B || first === 0x002D) { // If the second code point is a digit, return true. - if (isDigit(second)) { + if (isDigit$5(second)) { return 2; } // Otherwise, if the second code point is a U+002E FULL STOP (.) // and the third code point is a digit, return true. // Otherwise, return false. - return second === 0x002E && isDigit(third) ? 3 : 0; + return second === 0x002E && isDigit$5(third) ? 3 : 0; } // U+002E FULL STOP (.) if (first === 0x002E) { // If the second code point is a digit, return true. Otherwise, return false. - return isDigit(second) ? 2 : 0; + return isDigit$5(second) ? 2 : 0; } // digit - if (isDigit(first)) { + if (isDigit$5(first)) { // Return true. return 1; } @@ -3772,7 +4002,7 @@ // // detect BOM (https://en.wikipedia.org/wiki/Byte_order_mark) - function isBOM(code) { + function isBOM$2(code) { // UTF-16BE if (code === 0xFEFF) { return 1; @@ -3797,70 +4027,71 @@ // > A name-start code point, a digit, or U+002D HYPHEN-MINUS (-) // That means only ASCII code points has a special meaning and we define a maps for 0..127 codes only var CATEGORY = new Array(0x80); - charCodeCategory.Eof = 0x80; - charCodeCategory.WhiteSpace = 0x82; - charCodeCategory.Digit = 0x83; - charCodeCategory.NameStart = 0x84; - charCodeCategory.NonPrintable = 0x85; + charCodeCategory$1.Eof = 0x80; + charCodeCategory$1.WhiteSpace = 0x82; + charCodeCategory$1.Digit = 0x83; + charCodeCategory$1.NameStart = 0x84; + charCodeCategory$1.NonPrintable = 0x85; for (var i = 0; i < CATEGORY.length; i++) { switch (true) { - case isWhiteSpace(i): - CATEGORY[i] = charCodeCategory.WhiteSpace; + case isWhiteSpace$2(i): + CATEGORY[i] = charCodeCategory$1.WhiteSpace; break; - case isDigit(i): - CATEGORY[i] = charCodeCategory.Digit; + case isDigit$5(i): + CATEGORY[i] = charCodeCategory$1.Digit; break; case isNameStart(i): - CATEGORY[i] = charCodeCategory.NameStart; + CATEGORY[i] = charCodeCategory$1.NameStart; break; case isNonPrintable(i): - CATEGORY[i] = charCodeCategory.NonPrintable; + CATEGORY[i] = charCodeCategory$1.NonPrintable; break; default: - CATEGORY[i] = i || charCodeCategory.Eof; + CATEGORY[i] = i || charCodeCategory$1.Eof; } } - function charCodeCategory(code) { - return code < 0x80 ? CATEGORY[code] : charCodeCategory.NameStart; + function charCodeCategory$1(code) { + return code < 0x80 ? CATEGORY[code] : charCodeCategory$1.NameStart; } - var charCodeDefinitions = { - isDigit: isDigit, - isHexDigit: isHexDigit, - isUppercaseLetter: isUppercaseLetter, + var charCodeDefinitions$1 = { + isDigit: isDigit$5, + isHexDigit: isHexDigit$4, + isUppercaseLetter: isUppercaseLetter$1, isLowercaseLetter: isLowercaseLetter, isLetter: isLetter, isNonAscii: isNonAscii, isNameStart: isNameStart, - isName: isName, + isName: isName$2, isNonPrintable: isNonPrintable, - isNewline: isNewline, - isWhiteSpace: isWhiteSpace, - isValidEscape: isValidEscape, - isIdentifierStart: isIdentifierStart, - isNumberStart: isNumberStart, + isNewline: isNewline$1, + isWhiteSpace: isWhiteSpace$2, + isValidEscape: isValidEscape$2, + isIdentifierStart: isIdentifierStart$2, + isNumberStart: isNumberStart$1, - isBOM: isBOM, - charCodeCategory: charCodeCategory + isBOM: isBOM$2, + charCodeCategory: charCodeCategory$1 }; - var isDigit$1 = charCodeDefinitions.isDigit; - var isHexDigit$1 = charCodeDefinitions.isHexDigit; - var isUppercaseLetter$1 = charCodeDefinitions.isUppercaseLetter; - var isName$1 = charCodeDefinitions.isName; - var isWhiteSpace$1 = charCodeDefinitions.isWhiteSpace; - var isValidEscape$1 = charCodeDefinitions.isValidEscape; + var charCodeDef = charCodeDefinitions$1; + var isDigit$4 = charCodeDef.isDigit; + var isHexDigit$3 = charCodeDef.isHexDigit; + var isUppercaseLetter = charCodeDef.isUppercaseLetter; + var isName$1 = charCodeDef.isName; + var isWhiteSpace$1 = charCodeDef.isWhiteSpace; + var isValidEscape$1 = charCodeDef.isValidEscape; function getCharCode(source, offset) { return offset < source.length ? source.charCodeAt(offset) : 0; } - function getNewlineLength(source, offset, code) { + function getNewlineLength$1(source, offset, code) { if (code === 13 /* \r */ && getCharCode(source, offset + 1) === 10 /* \n */) { return 2; } @@ -3868,18 +4099,18 @@ return 1; } - function cmpChar(testStr, offset, referenceCode) { + function cmpChar$5(testStr, offset, referenceCode) { var code = testStr.charCodeAt(offset); // code.toLowerCase() for A..Z - if (isUppercaseLetter$1(code)) { + if (isUppercaseLetter(code)) { code = code | 32; } return code === referenceCode; } - function cmpStr(testStr, start, end, referenceStr) { + function cmpStr$6(testStr, start, end, referenceStr) { if (end - start !== referenceStr.length) { return false; } @@ -3893,7 +4124,7 @@ var referenceCode = referenceStr.charCodeAt(i - start); // testCode.toLowerCase() for A..Z - if (isUppercaseLetter$1(testCode)) { + if (isUppercaseLetter(testCode)) { testCode = testCode | 32; } @@ -3905,7 +4136,7 @@ return true; } - function findWhiteSpaceStart(source, offset) { + function findWhiteSpaceStart$1(source, offset) { for (; offset >= 0; offset--) { if (!isWhiteSpace$1(source.charCodeAt(offset))) { break; @@ -3915,7 +4146,7 @@ return offset + 1; } - function findWhiteSpaceEnd(source, offset) { + function findWhiteSpaceEnd$1(source, offset) { for (; offset < source.length; offset++) { if (!isWhiteSpace$1(source.charCodeAt(offset))) { break; @@ -3927,7 +4158,7 @@ function findDecimalNumberEnd(source, offset) { for (; offset < source.length; offset++) { - if (!isDigit$1(source.charCodeAt(offset))) { + if (!isDigit$4(source.charCodeAt(offset))) { break; } } @@ -3936,17 +4167,17 @@ } // § 4.3.7. Consume an escaped code point - function consumeEscaped(source, offset) { + function consumeEscaped$1(source, offset) { // It assumes that the U+005C REVERSE SOLIDUS (\) has already been consumed and // that the next input code point has already been verified to be part of a valid escape. offset += 2; // hex digit - if (isHexDigit$1(getCharCode(source, offset - 1))) { + if (isHexDigit$3(getCharCode(source, offset - 1))) { // Consume as many hex digits as possible, but no more than 5. // Note that this means 1-6 hex digits have been consumed in total. for (var maxOffset = Math.min(source.length, offset + 5); offset < maxOffset; offset++) { - if (!isHexDigit$1(getCharCode(source, offset))) { + if (!isHexDigit$3(getCharCode(source, offset))) { break; } } @@ -3954,7 +4185,7 @@ // If the next input code point is whitespace, consume it as well. var code = getCharCode(source, offset); if (isWhiteSpace$1(code)) { - offset += getNewlineLength(source, offset, code); + offset += getNewlineLength$1(source, offset, code); } } @@ -3965,7 +4196,7 @@ // Note: This algorithm does not do the verification of the first few code points that are necessary // to ensure the returned code points would constitute an . If that is the intended use, // ensure that the stream starts with an identifier before calling this algorithm. - function consumeName(source, offset) { + function consumeName$1(source, offset) { // Let result initially be an empty string. // Repeatedly consume the next input code point from the stream: for (; offset < source.length; offset++) { @@ -3980,7 +4211,7 @@ // the stream starts with a valid escape if (isValidEscape$1(code, getCharCode(source, offset + 1))) { // Consume an escaped code point. Append the returned code point to result. - offset = consumeEscaped(source, offset) - 1; + offset = consumeEscaped$1(source, offset) - 1; continue; } @@ -3993,7 +4224,7 @@ } // §4.3.12. Consume a number - function consumeNumber(source, offset) { + function consumeNumber$5(source, offset) { var code = source.charCodeAt(offset); // 2. If the next input code point is U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-), @@ -4003,13 +4234,13 @@ } // 3. While the next input code point is a digit, consume it and append it to repr. - if (isDigit$1(code)) { + if (isDigit$4(code)) { offset = findDecimalNumberEnd(source, offset + 1); code = source.charCodeAt(offset); } // 4. If the next 2 input code points are U+002E FULL STOP (.) followed by a digit, then: - if (code === 0x002E && isDigit$1(source.charCodeAt(offset + 1))) { + if (code === 0x002E && isDigit$4(source.charCodeAt(offset + 1))) { // 4.1 Consume them. // 4.2 Append them to repr. code = source.charCodeAt(offset += 2); @@ -4024,7 +4255,7 @@ // 5. If the next 2 or 3 input code points are U+0045 LATIN CAPITAL LETTER E (E) // or U+0065 LATIN SMALL LETTER E (e), ... , followed by a digit, then: - if (cmpChar(source, offset, 101 /* e */)) { + if (cmpChar$5(source, offset, 101 /* e */)) { var sign = 0; code = source.charCodeAt(offset + 1); @@ -4035,7 +4266,7 @@ } // ... followed by a digit - if (isDigit$1(code)) { + if (isDigit$4(code)) { // 5.1 Consume them. // 5.2 Append them to repr. @@ -4053,7 +4284,7 @@ // § 4.3.14. Consume the remnants of a bad url // ... its sole use is to consume enough of the input stream to reach a recovery point // where normal tokenizing can resume. - function consumeBadUrlRemnants(source, offset) { + function consumeBadUrlRemnants$1(source, offset) { // Repeatedly consume the next input code point from the stream: for (; offset < source.length; offset++) { var code = source.charCodeAt(offset); @@ -4071,48 +4302,49 @@ // Note: This allows an escaped right parenthesis ("\)") to be encountered // without ending the . This is otherwise identical to // the "anything else" clause. - offset = consumeEscaped(source, offset); + offset = consumeEscaped$1(source, offset); } } return offset; } - var utils = { - consumeEscaped: consumeEscaped, - consumeName: consumeName, - consumeNumber: consumeNumber, - consumeBadUrlRemnants: consumeBadUrlRemnants, + var utils$2 = { + consumeEscaped: consumeEscaped$1, + consumeName: consumeName$1, + consumeNumber: consumeNumber$5, + consumeBadUrlRemnants: consumeBadUrlRemnants$1, - cmpChar: cmpChar, - cmpStr: cmpStr, + cmpChar: cmpChar$5, + cmpStr: cmpStr$6, - getNewlineLength: getNewlineLength, - findWhiteSpaceStart: findWhiteSpaceStart, - findWhiteSpaceEnd: findWhiteSpaceEnd + getNewlineLength: getNewlineLength$1, + findWhiteSpaceStart: findWhiteSpaceStart$1, + findWhiteSpaceEnd: findWhiteSpaceEnd$1 }; - var TYPE$1 = _const.TYPE; - var NAME$1 = _const.NAME; + var constants$2 = _const; + var TYPE$G = constants$2.TYPE; + var NAME$2 = constants$2.NAME; + var utils$1 = utils$2; + var cmpStr$5 = utils$1.cmpStr; - var cmpStr$1 = utils.cmpStr; + var EOF = TYPE$G.EOF; + var WHITESPACE$c = TYPE$G.WhiteSpace; + var COMMENT$a = TYPE$G.Comment; - var EOF$1 = TYPE$1.EOF; - var WHITESPACE = TYPE$1.WhiteSpace; - var COMMENT = TYPE$1.Comment; + var OFFSET_MASK$1 = 0x00FFFFFF; + var TYPE_SHIFT$1 = 24; - var OFFSET_MASK = 0x00FFFFFF; - var TYPE_SHIFT = 24; - - var TokenStream = function() { + var TokenStream$4 = function() { this.offsetAndType = null; this.balance = null; this.reset(); }; - TokenStream.prototype = { + TokenStream$4.prototype = { reset: function() { this.eof = false; this.tokenIndex = -1; @@ -4125,16 +4357,16 @@ offset += this.tokenIndex; if (offset < this.tokenCount) { - return this.offsetAndType[offset] >> TYPE_SHIFT; + return this.offsetAndType[offset] >> TYPE_SHIFT$1; } - return EOF$1; + return EOF; }, lookupOffset: function(offset) { offset += this.tokenIndex; if (offset < this.tokenCount) { - return this.offsetAndType[offset - 1] & OFFSET_MASK; + return this.offsetAndType[offset - 1] & OFFSET_MASK$1; } return this.source.length; @@ -4143,10 +4375,10 @@ offset += this.tokenIndex; if (offset < this.tokenCount) { - return cmpStr$1( + return cmpStr$5( this.source, - this.offsetAndType[offset - 1] & OFFSET_MASK, - this.offsetAndType[offset] & OFFSET_MASK, + this.offsetAndType[offset - 1] & OFFSET_MASK$1, + this.offsetAndType[offset] & OFFSET_MASK$1, referenceStr ); } @@ -4160,8 +4392,8 @@ if (tokenIndex > 0) { return tokenIndex < this.tokenCount - ? this.offsetAndType[tokenIndex - 1] & OFFSET_MASK - : this.offsetAndType[this.tokenCount] & OFFSET_MASK; + ? this.offsetAndType[tokenIndex - 1] & OFFSET_MASK$1 + : this.offsetAndType[this.tokenCount] & OFFSET_MASK$1; } return this.firstCharOffset; @@ -4171,7 +4403,7 @@ getRawLength: function(startToken, mode) { var cursor = startToken; var balanceEnd; - var offset = this.offsetAndType[Math.max(cursor - 1, 0)] & OFFSET_MASK; + var offset = this.offsetAndType[Math.max(cursor - 1, 0)] & OFFSET_MASK$1; var type; loop: @@ -4183,7 +4415,7 @@ break loop; } - type = this.offsetAndType[cursor] >> TYPE_SHIFT; + type = this.offsetAndType[cursor] >> TYPE_SHIFT$1; // check token is stop type switch (mode(type, this.source, offset)) { @@ -4195,12 +4427,12 @@ break loop; default: - offset = this.offsetAndType[cursor] & OFFSET_MASK; - // fast forward to the end of balanced block if (this.balance[balanceEnd] === cursor) { cursor = balanceEnd; } + + offset = this.offsetAndType[cursor] & OFFSET_MASK$1; } } @@ -4212,13 +4444,13 @@ isDelim: function(code, offset) { if (offset) { return ( - this.lookupType(offset) === TYPE$1.Delim && + this.lookupType(offset) === TYPE$G.Delim && this.source.charCodeAt(this.lookupOffset(offset)) === code ); } return ( - this.tokenType === TYPE$1.Delim && + this.tokenType === TYPE$G.Delim && this.source.charCodeAt(this.tokenStart) === code ); }, @@ -4235,7 +4467,7 @@ skipWS: function() { for (var i = this.tokenIndex, skipTokenCount = 0; i < this.tokenCount; i++, skipTokenCount++) { - if ((this.offsetAndType[i] >> TYPE_SHIFT) !== WHITESPACE) { + if ((this.offsetAndType[i] >> TYPE_SHIFT$1) !== WHITESPACE$c) { break; } } @@ -4245,7 +4477,7 @@ } }, skipSC: function() { - while (this.tokenType === WHITESPACE || this.tokenType === COMMENT) { + while (this.tokenType === WHITESPACE$c || this.tokenType === COMMENT$a) { this.next(); } }, @@ -4254,10 +4486,10 @@ if (next < this.tokenCount) { this.tokenIndex = next; - this.tokenStart = this.offsetAndType[next - 1] & OFFSET_MASK; + this.tokenStart = this.offsetAndType[next - 1] & OFFSET_MASK$1; next = this.offsetAndType[next]; - this.tokenType = next >> TYPE_SHIFT; - this.tokenEnd = next & OFFSET_MASK; + this.tokenType = next >> TYPE_SHIFT$1; + this.tokenEnd = next & OFFSET_MASK$1; } else { this.tokenIndex = this.tokenCount; this.next(); @@ -4270,38 +4502,48 @@ this.tokenIndex = next; this.tokenStart = this.tokenEnd; next = this.offsetAndType[next]; - this.tokenType = next >> TYPE_SHIFT; - this.tokenEnd = next & OFFSET_MASK; + this.tokenType = next >> TYPE_SHIFT$1; + this.tokenEnd = next & OFFSET_MASK$1; } else { this.tokenIndex = this.tokenCount; this.eof = true; - this.tokenType = EOF$1; + this.tokenType = EOF; this.tokenStart = this.tokenEnd = this.source.length; } }, - dump: function() { - var offset = this.firstCharOffset; - - return Array.prototype.slice.call(this.offsetAndType, 0, this.tokenCount).map(function(item, idx) { + forEachToken(fn) { + for (var i = 0, offset = this.firstCharOffset; i < this.tokenCount; i++) { var start = offset; - var end = item & OFFSET_MASK; + var item = this.offsetAndType[i]; + var end = item & OFFSET_MASK$1; + var type = item >> TYPE_SHIFT$1; offset = end; - return { - idx: idx, - type: NAME$1[item >> TYPE_SHIFT], + fn(type, start, end, i); + } + }, + + dump() { + var tokens = new Array(this.tokenCount); + + this.forEachToken((type, start, end, index) => { + tokens[index] = { + idx: index, + type: NAME$2[type], chunk: this.source.substring(start, end), - balance: this.balance[idx] + balance: this.balance[index] }; - }, this); + }); + + return tokens; } }; - var TokenStream_1 = TokenStream; + var TokenStream_1 = TokenStream$4; - function noop$1(value) { + function noop$3(value) { return value; } @@ -4350,7 +4592,7 @@ function generateSequence(node, decorate, forceBraces, compact) { var combinator = node.combinator === ' ' || compact ? node.combinator : ' ' + node.combinator + ' '; var result = node.terms.map(function(term) { - return generate(term, decorate, forceBraces, compact); + return generate$2(term, decorate, forceBraces, compact); }).join(combinator); if (node.explicit || forceBraces) { @@ -4360,7 +4602,7 @@ return result; } - function generate(node, decorate, forceBraces, compact) { + function generate$2(node, decorate, forceBraces, compact) { var result; switch (node.type) { @@ -4373,7 +4615,7 @@ case 'Multiplier': // return since node is a composition return ( - generate(node.term, decorate, forceBraces, compact) + + generate$2(node.term, decorate, forceBraces, compact) + decorate(generateMultiplier(node), node) ); @@ -4414,7 +4656,7 @@ } var generate_1 = function(node, options) { - var decorate = noop$1; + var decorate = noop$3; var forceBraces = false; var compact = false; @@ -4428,23 +4670,34 @@ } } - return generate(node, decorate, forceBraces, compact); + return generate$2(node, decorate, forceBraces, compact); }; - function fromMatchResult(matchResult) { - var tokens = matchResult.tokens; - var longestMatch = matchResult.longestMatch; - var node = longestMatch < tokens.length ? tokens[longestMatch].node : null; - var mismatchOffset = -1; - var entries = 0; - var css = ''; + const createCustomError$1 = createCustomError$3; + const generate$1 = generate_1; + const defaultLoc = { offset: 0, line: 1, column: 1 }; + + function locateMismatch(matchResult, node) { + const tokens = matchResult.tokens; + const longestMatch = matchResult.longestMatch; + const mismatchNode = longestMatch < tokens.length ? tokens[longestMatch].node || null : null; + const badNode = mismatchNode !== node ? mismatchNode : null; + let mismatchOffset = 0; + let mismatchLength = 0; + let entries = 0; + let css = ''; + let start; + let end; + + for (let i = 0; i < tokens.length; i++) { + const token = tokens[i].value; - for (var i = 0; i < tokens.length; i++) { if (i === longestMatch) { + mismatchLength = token.length; mismatchOffset = css.length; } - if (node !== null && tokens[i].node === node) { + if (badNode !== null && tokens[i].node === badNode) { if (i <= longestMatch) { entries++; } else { @@ -4452,33 +4705,58 @@ } } - css += tokens[i].value; + css += token; + } + + if (longestMatch === tokens.length || entries > 1) { // last + start = fromLoc(badNode || node, 'end') || buildLoc(defaultLoc, css); + end = buildLoc(start); + } else { + start = fromLoc(badNode, 'start') || + buildLoc(fromLoc(node, 'start') || defaultLoc, css.slice(0, mismatchOffset)); + end = fromLoc(badNode, 'end') || + buildLoc(start, css.substr(mismatchOffset, mismatchLength)); } return { - node: node, - css: css, - mismatchOffset: mismatchOffset === -1 ? css.length : mismatchOffset, - last: node === null || entries > 1 + css, + mismatchOffset, + mismatchLength, + start, + end }; } - function getLocation(node, point) { - var loc = node && node.loc && node.loc[point]; + function fromLoc(node, point) { + const value = node && node.loc && node.loc[point]; - if (loc) { - return { - offset: loc.offset, - line: loc.line, - column: loc.column - }; + if (value) { + return 'line' in value ? buildLoc(value) : value; } return null; } - var SyntaxReferenceError = function(type, referenceName) { - var error = createCustomError( + function buildLoc({ offset, line, column }, extra) { + const loc = { + offset, + line, + column + }; + + if (extra) { + const lines = extra.split(/\n|\r\n?|\f/); + + loc.offset += extra.length; + loc.line += lines.length - 1; + loc.column = lines.length === 1 ? loc.column + extra.length : lines.pop().length + 1; + } + + return loc; + } + + const SyntaxReferenceError$1 = function(type, referenceName) { + const error = createCustomError$1( 'SyntaxReferenceError', type + (referenceName ? ' `' + referenceName + '`' : '') ); @@ -4488,51 +4766,52 @@ return error; }; - var MatchError = function(message, syntax, node, matchResult) { - var error = createCustomError('SyntaxMatchError', message); - var details = fromMatchResult(matchResult); - var mismatchOffset = details.mismatchOffset || 0; - var badNode = details.node || node; - var end = getLocation(badNode, 'end'); - var start = details.last ? end : getLocation(badNode, 'start'); - var css = details.css; + const SyntaxMatchError$1 = function(message, syntax, node, matchResult) { + const error = createCustomError$1('SyntaxMatchError', message); + const { + css, + mismatchOffset, + mismatchLength, + start, + end + } = locateMismatch(matchResult, node); error.rawMessage = message; - error.syntax = syntax ? generate_1(syntax) : ''; + error.syntax = syntax ? generate$1(syntax) : ''; error.css = css; error.mismatchOffset = mismatchOffset; - error.loc = { - source: (badNode && badNode.loc && badNode.loc.source) || '', - start: start, - end: end - }; - error.line = start ? start.line : undefined; - error.column = start ? start.column : undefined; - error.offset = start ? start.offset : undefined; + error.mismatchLength = mismatchLength; error.message = message + '\n' + ' syntax: ' + error.syntax + '\n' + - ' value: ' + (error.css || '') + '\n' + + ' value: ' + (css || '') + '\n' + ' --------' + new Array(error.mismatchOffset + 1).join('-') + '^'; + Object.assign(error, start); + error.loc = { + source: (node && node.loc && node.loc.source) || '', + start, + end + }; + return error; }; var error = { - SyntaxReferenceError: SyntaxReferenceError, - MatchError: MatchError + SyntaxReferenceError: SyntaxReferenceError$1, + SyntaxMatchError: SyntaxMatchError$1 }; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var keywords = Object.create(null); - var properties = Object.create(null); - var HYPHENMINUS = 45; // '-'.charCodeAt() + var hasOwnProperty$7 = Object.prototype.hasOwnProperty; + var keywords$1 = Object.create(null); + var properties$1 = Object.create(null); + var HYPHENMINUS$5 = 45; // '-'.charCodeAt() - function isCustomProperty(str, offset) { + function isCustomProperty$1(str, offset) { offset = offset || 0; return str.length - offset >= 2 && - str.charCodeAt(offset) === HYPHENMINUS && - str.charCodeAt(offset + 1) === HYPHENMINUS; + str.charCodeAt(offset) === HYPHENMINUS$5 && + str.charCodeAt(offset + 1) === HYPHENMINUS$5; } function getVendorPrefix(str, offset) { @@ -4541,8 +4820,8 @@ // verdor prefix should be at least 3 chars length if (str.length - offset >= 3) { // vendor prefix starts with hyper minus following non-hyper minus - if (str.charCodeAt(offset) === HYPHENMINUS && - str.charCodeAt(offset + 1) !== HYPHENMINUS) { + if (str.charCodeAt(offset) === HYPHENMINUS$5 && + str.charCodeAt(offset + 1) !== HYPHENMINUS$5) { // vendor prefix should contain a hyper minus at the ending var secondDashIndex = str.indexOf('-', offset + 2); @@ -4556,20 +4835,20 @@ } function getKeywordDescriptor(keyword) { - if (hasOwnProperty.call(keywords, keyword)) { - return keywords[keyword]; + if (hasOwnProperty$7.call(keywords$1, keyword)) { + return keywords$1[keyword]; } var name = keyword.toLowerCase(); - if (hasOwnProperty.call(keywords, name)) { - return keywords[keyword] = keywords[name]; + if (hasOwnProperty$7.call(keywords$1, name)) { + return keywords$1[keyword] = keywords$1[name]; } - var custom = isCustomProperty(name, 0); + var custom = isCustomProperty$1(name, 0); var vendor = !custom ? getVendorPrefix(name, 0) : ''; - return keywords[keyword] = Object.freeze({ + return keywords$1[keyword] = Object.freeze({ basename: name.substr(vendor.length), name: name, vendor: vendor, @@ -4579,8 +4858,8 @@ } function getPropertyDescriptor(property) { - if (hasOwnProperty.call(properties, property)) { - return properties[property]; + if (hasOwnProperty$7.call(properties$1, property)) { + return properties$1[property]; } var name = property; @@ -4597,20 +4876,20 @@ hack = ''; } - var custom = isCustomProperty(name, hack.length); + var custom = isCustomProperty$1(name, hack.length); // re-use result when possible (the same as for lower case) if (!custom) { name = name.toLowerCase(); - if (hasOwnProperty.call(properties, name)) { - return properties[property] = properties[name]; + if (hasOwnProperty$7.call(properties$1, name)) { + return properties$1[property] = properties$1[name]; } } var vendor = !custom ? getVendorPrefix(name, hack.length) : ''; var prefix = name.substr(0, hack.length + vendor.length); - return properties[property] = Object.freeze({ + return properties$1[property] = Object.freeze({ basename: name.substr(prefix.length), name: name.substr(hack.length), hack: hack, @@ -4620,17 +4899,17 @@ }); } - var names = { + var names$2 = { keyword: getKeywordDescriptor, property: getPropertyDescriptor, - isCustomProperty: isCustomProperty, + isCustomProperty: isCustomProperty$1, vendorPrefix: getVendorPrefix }; var MIN_SIZE = 16 * 1024; var SafeUint32Array = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; // fallback on Array when TypedArray is not supported - var adoptBuffer = function adoptBuffer(buffer, size) { + var adoptBuffer$2 = function adoptBuffer(buffer, size) { if (buffer === null || buffer.length < size) { return new SafeUint32Array(Math.max(size + 1024, MIN_SIZE)); } @@ -4638,30 +4917,34 @@ return buffer; }; - var TYPE$2 = _const.TYPE; + var TokenStream$3 = TokenStream_1; + var adoptBuffer$1 = adoptBuffer$2; + var constants$1 = _const; + var TYPE$F = constants$1.TYPE; - var isNewline$1 = charCodeDefinitions.isNewline; - var isName$2 = charCodeDefinitions.isName; - var isValidEscape$2 = charCodeDefinitions.isValidEscape; - var isNumberStart$1 = charCodeDefinitions.isNumberStart; + var charCodeDefinitions = charCodeDefinitions$1; + var isNewline = charCodeDefinitions.isNewline; + var isName = charCodeDefinitions.isName; + var isValidEscape = charCodeDefinitions.isValidEscape; + var isNumberStart = charCodeDefinitions.isNumberStart; var isIdentifierStart$1 = charCodeDefinitions.isIdentifierStart; - var charCodeCategory$1 = charCodeDefinitions.charCodeCategory; + var charCodeCategory = charCodeDefinitions.charCodeCategory; var isBOM$1 = charCodeDefinitions.isBOM; + var utils = utils$2; + var cmpStr$4 = utils.cmpStr; + var getNewlineLength = utils.getNewlineLength; + var findWhiteSpaceEnd = utils.findWhiteSpaceEnd; + var consumeEscaped = utils.consumeEscaped; + var consumeName = utils.consumeName; + var consumeNumber$4 = utils.consumeNumber; + var consumeBadUrlRemnants = utils.consumeBadUrlRemnants; - var cmpStr$2 = utils.cmpStr; - var getNewlineLength$1 = utils.getNewlineLength; - var findWhiteSpaceEnd$1 = utils.findWhiteSpaceEnd; - var consumeEscaped$1 = utils.consumeEscaped; - var consumeName$1 = utils.consumeName; - var consumeNumber$1 = utils.consumeNumber; - var consumeBadUrlRemnants$1 = utils.consumeBadUrlRemnants; + var OFFSET_MASK = 0x00FFFFFF; + var TYPE_SHIFT = 24; - var OFFSET_MASK$1 = 0x00FFFFFF; - var TYPE_SHIFT$1 = 24; - - function tokenize(source, stream) { + function tokenize$3(source, stream) { function getCharCode(offset) { return offset < sourceLength ? source.charCodeAt(offset) : 0; } @@ -4669,28 +4952,28 @@ // § 4.3.3. Consume a numeric token function consumeNumericToken() { // Consume a number and let number be the result. - offset = consumeNumber$1(source, offset); + offset = consumeNumber$4(source, offset); // If the next 3 input code points would start an identifier, then: if (isIdentifierStart$1(getCharCode(offset), getCharCode(offset + 1), getCharCode(offset + 2))) { // Create a with the same value and type flag as number, and a unit set initially to the empty string. // Consume a name. Set the ’s unit to the returned value. // Return the . - type = TYPE$2.Dimension; - offset = consumeName$1(source, offset); + type = TYPE$F.Dimension; + offset = consumeName(source, offset); return; } // Otherwise, if the next input code point is U+0025 PERCENTAGE SIGN (%), consume it. if (getCharCode(offset) === 0x0025) { // Create a with the same value as number, and return it. - type = TYPE$2.Percentage; + type = TYPE$F.Percentage; offset++; return; } // Otherwise, create a with the same value and type flag as number, and return it. - type = TYPE$2.Number; + type = TYPE$F.Number; } // § 4.3.4. Consume an ident-like token @@ -4698,20 +4981,20 @@ const nameStartOffset = offset; // Consume a name, and let string be the result. - offset = consumeName$1(source, offset); + offset = consumeName(source, offset); // If string’s value is an ASCII case-insensitive match for "url", // and the next input code point is U+0028 LEFT PARENTHESIS ((), consume it. - if (cmpStr$2(source, nameStartOffset, offset, 'url') && getCharCode(offset) === 0x0028) { + if (cmpStr$4(source, nameStartOffset, offset, 'url') && getCharCode(offset) === 0x0028) { // While the next two input code points are whitespace, consume the next input code point. - offset = findWhiteSpaceEnd$1(source, offset + 1); + offset = findWhiteSpaceEnd(source, offset + 1); // If the next one or two input code points are U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), // or whitespace followed by U+0022 QUOTATION MARK (") or U+0027 APOSTROPHE ('), // then create a with its value set to string and return it. if (getCharCode(offset) === 0x0022 || getCharCode(offset) === 0x0027) { - type = TYPE$2.Function; + type = TYPE$F.Function; offset = nameStartOffset + 4; return; } @@ -4724,13 +5007,13 @@ // Otherwise, if the next input code point is U+0028 LEFT PARENTHESIS ((), consume it. // Create a with its value set to string and return it. if (getCharCode(offset) === 0x0028) { - type = TYPE$2.Function; + type = TYPE$F.Function; offset++; return; } // Otherwise, create an with its value set to string and return it. - type = TYPE$2.Ident; + type = TYPE$F.Ident; } // § 4.3.5. Consume a string token @@ -4743,13 +5026,13 @@ } // Initially create a with its value set to the empty string. - type = TYPE$2.String; + type = TYPE$F.String; // Repeatedly consume the next input code point from the stream: for (; offset < source.length; offset++) { var code = source.charCodeAt(offset); - switch (charCodeCategory$1(code)) { + switch (charCodeCategory(code)) { // ending code point case endingCodePoint: // Return the . @@ -4757,17 +5040,17 @@ return; // EOF - case charCodeCategory$1.Eof: + case charCodeCategory.Eof: // This is a parse error. Return the . return; // newline - case charCodeCategory$1.WhiteSpace: - if (isNewline$1(code)) { + case charCodeCategory.WhiteSpace: + if (isNewline(code)) { // This is a parse error. Reconsume the current input code point, // create a , and return it. - offset += getNewlineLength$1(source, offset, code); - type = TYPE$2.BadString; + offset += getNewlineLength(source, offset, code); + type = TYPE$F.BadString; return; } break; @@ -4782,13 +5065,13 @@ var nextCode = getCharCode(offset + 1); // Otherwise, if the next input code point is a newline, consume it. - if (isNewline$1(nextCode)) { - offset += getNewlineLength$1(source, offset + 1, nextCode); - } else if (isValidEscape$2(code, nextCode)) { + if (isNewline(nextCode)) { + offset += getNewlineLength(source, offset + 1, nextCode); + } else if (isValidEscape(code, nextCode)) { // Otherwise, (the stream starts with a valid escape) consume // an escaped code point and append the returned code point to // the ’s value. - offset = consumeEscaped$1(source, offset) - 1; + offset = consumeEscaped(source, offset) - 1; } break; @@ -4805,16 +5088,16 @@ // automatically handles this distinction; this algorithm shouldn’t be called directly otherwise. function consumeUrlToken() { // Initially create a with its value set to the empty string. - type = TYPE$2.Url; + type = TYPE$F.Url; // Consume as much whitespace as possible. - offset = findWhiteSpaceEnd$1(source, offset); + offset = findWhiteSpaceEnd(source, offset); // Repeatedly consume the next input code point from the stream: for (; offset < source.length; offset++) { var code = source.charCodeAt(offset); - switch (charCodeCategory$1(code)) { + switch (charCodeCategory(code)) { // U+0029 RIGHT PARENTHESIS ()) case 0x0029: // Return the . @@ -4822,14 +5105,14 @@ return; // EOF - case charCodeCategory$1.Eof: + case charCodeCategory.Eof: // This is a parse error. Return the . return; // whitespace - case charCodeCategory$1.WhiteSpace: + case charCodeCategory.WhiteSpace: // Consume as much whitespace as possible. - offset = findWhiteSpaceEnd$1(source, offset); + offset = findWhiteSpaceEnd(source, offset); // If the next input code point is U+0029 RIGHT PARENTHESIS ()) or EOF, // consume it and return the @@ -4843,8 +5126,8 @@ // otherwise, consume the remnants of a bad url, create a , // and return it. - offset = consumeBadUrlRemnants$1(source, offset); - type = TYPE$2.BadUrl; + offset = consumeBadUrlRemnants(source, offset); + type = TYPE$F.BadUrl; return; // U+0022 QUOTATION MARK (") @@ -4854,26 +5137,26 @@ case 0x0022: case 0x0027: case 0x0028: - case charCodeCategory$1.NonPrintable: + case charCodeCategory.NonPrintable: // This is a parse error. Consume the remnants of a bad url, // create a , and return it. - offset = consumeBadUrlRemnants$1(source, offset); - type = TYPE$2.BadUrl; + offset = consumeBadUrlRemnants(source, offset); + type = TYPE$F.BadUrl; return; // U+005C REVERSE SOLIDUS (\) case 0x005C: // If the stream starts with a valid escape, consume an escaped code point and // append the returned code point to the ’s value. - if (isValidEscape$2(code, getCharCode(offset + 1))) { - offset = consumeEscaped$1(source, offset) - 1; + if (isValidEscape(code, getCharCode(offset + 1))) { + offset = consumeEscaped(source, offset) - 1; break; } // Otherwise, this is a parse error. Consume the remnants of a bad url, // create a , and return it. - offset = consumeBadUrlRemnants$1(source, offset); - type = TYPE$2.BadUrl; + offset = consumeBadUrlRemnants(source, offset); + type = TYPE$F.BadUrl; return; // anything else @@ -4883,15 +5166,15 @@ } if (!stream) { - stream = new TokenStream_1(); + stream = new TokenStream$3(); } // ensure source is a string source = String(source || ''); var sourceLength = source.length; - var offsetAndType = adoptBuffer(stream.offsetAndType, sourceLength + 1); // +1 because of eof-token - var balance = adoptBuffer(stream.balance, sourceLength + 1); + var offsetAndType = adoptBuffer$1(stream.offsetAndType, sourceLength + 1); // +1 because of eof-token + var balance = adoptBuffer$1(stream.balance, sourceLength + 1); var tokenCount = 0; var start = isBOM$1(getCharCode(0)); var offset = start; @@ -4907,12 +5190,12 @@ balance[tokenCount] = sourceLength; - switch (charCodeCategory$1(code)) { + switch (charCodeCategory(code)) { // whitespace - case charCodeCategory$1.WhiteSpace: + case charCodeCategory.WhiteSpace: // Consume as much whitespace as possible. Return a . - type = TYPE$2.WhiteSpace; - offset = findWhiteSpaceEnd$1(source, offset + 1); + type = TYPE$F.WhiteSpace; + offset = findWhiteSpaceEnd(source, offset + 1); break; // U+0022 QUOTATION MARK (") @@ -4924,9 +5207,9 @@ // U+0023 NUMBER SIGN (#) case 0x0023: // If the next input code point is a name code point or the next two input code points are a valid escape, then: - if (isName$2(getCharCode(offset + 1)) || isValidEscape$2(getCharCode(offset + 1), getCharCode(offset + 2))) { + if (isName(getCharCode(offset + 1)) || isValidEscape(getCharCode(offset + 1), getCharCode(offset + 2))) { // Create a . - type = TYPE$2.Hash; + type = TYPE$F.Hash; // If the next 3 input code points would start an identifier, set the ’s type flag to "id". // if (isIdentifierStart(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) { @@ -4934,12 +5217,12 @@ // } // Consume a name, and set the ’s value to the returned string. - offset = consumeName$1(source, offset + 1); + offset = consumeName(source, offset + 1); // Return the . } else { // Otherwise, return a with its value set to the current input code point. - type = TYPE$2.Delim; + type = TYPE$F.Delim; offset++; } @@ -4954,26 +5237,26 @@ // U+0028 LEFT PARENTHESIS (() case 0x0028: // Return a <(-token>. - type = TYPE$2.LeftParenthesis; + type = TYPE$F.LeftParenthesis; offset++; break; // U+0029 RIGHT PARENTHESIS ()) case 0x0029: // Return a <)-token>. - type = TYPE$2.RightParenthesis; + type = TYPE$F.RightParenthesis; offset++; break; // U+002B PLUS SIGN (+) case 0x002B: // If the input stream starts with a number, ... - if (isNumberStart$1(code, getCharCode(offset + 1), getCharCode(offset + 2))) { + if (isNumberStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) { // ... reconsume the current input code point, consume a numeric token, and return it. consumeNumericToken(); } else { // Otherwise, return a with its value set to the current input code point. - type = TYPE$2.Delim; + type = TYPE$F.Delim; offset++; } break; @@ -4981,20 +5264,20 @@ // U+002C COMMA (,) case 0x002C: // Return a . - type = TYPE$2.Comma; + type = TYPE$F.Comma; offset++; break; // U+002D HYPHEN-MINUS (-) case 0x002D: // If the input stream starts with a number, reconsume the current input code point, consume a numeric token, and return it. - if (isNumberStart$1(code, getCharCode(offset + 1), getCharCode(offset + 2))) { + if (isNumberStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) { consumeNumericToken(); } else { // Otherwise, if the next 2 input code points are U+002D HYPHEN-MINUS U+003E GREATER-THAN SIGN (->), consume them and return a . if (getCharCode(offset + 1) === 0x002D && getCharCode(offset + 2) === 0x003E) { - type = TYPE$2.CDC; + type = TYPE$F.CDC; offset = offset + 3; } else { // Otherwise, if the input stream starts with an identifier, ... @@ -5003,7 +5286,7 @@ consumeIdentLikeToken(); } else { // Otherwise, return a with its value set to the current input code point. - type = TYPE$2.Delim; + type = TYPE$F.Delim; offset++; } } @@ -5013,12 +5296,12 @@ // U+002E FULL STOP (.) case 0x002E: // If the input stream starts with a number, ... - if (isNumberStart$1(code, getCharCode(offset + 1), getCharCode(offset + 2))) { + if (isNumberStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) { // ... reconsume the current input code point, consume a numeric token, and return it. consumeNumericToken(); } else { // Otherwise, return a with its value set to the current input code point. - type = TYPE$2.Delim; + type = TYPE$F.Delim; offset++; } @@ -5030,13 +5313,13 @@ if (getCharCode(offset + 1) === 0x002A) { // ... consume them and all following code points up to and including the first U+002A ASTERISK (*) // followed by a U+002F SOLIDUS (/), or up to an EOF code point. - type = TYPE$2.Comment; + type = TYPE$F.Comment; offset = source.indexOf('*/', offset + 2) + 2; if (offset === 1) { offset = source.length; } } else { - type = TYPE$2.Delim; + type = TYPE$F.Delim; offset++; } break; @@ -5044,14 +5327,14 @@ // U+003A COLON (:) case 0x003A: // Return a . - type = TYPE$2.Colon; + type = TYPE$F.Colon; offset++; break; // U+003B SEMICOLON (;) case 0x003B: // Return a . - type = TYPE$2.Semicolon; + type = TYPE$F.Semicolon; offset++; break; @@ -5062,11 +5345,11 @@ getCharCode(offset + 2) === 0x002D && getCharCode(offset + 3) === 0x002D) { // ... consume them and return a . - type = TYPE$2.CDO; + type = TYPE$F.CDO; offset = offset + 4; } else { // Otherwise, return a with its value set to the current input code point. - type = TYPE$2.Delim; + type = TYPE$F.Delim; offset++; } @@ -5077,11 +5360,11 @@ // If the next 3 input code points would start an identifier, ... if (isIdentifierStart$1(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) { // ... consume a name, create an with its value set to the returned value, and return it. - type = TYPE$2.AtKeyword; - offset = consumeName$1(source, offset + 1); + type = TYPE$F.AtKeyword; + offset = consumeName(source, offset + 1); } else { // Otherwise, return a with its value set to the current input code point. - type = TYPE$2.Delim; + type = TYPE$F.Delim; offset++; } @@ -5090,19 +5373,19 @@ // U+005B LEFT SQUARE BRACKET ([) case 0x005B: // Return a <[-token>. - type = TYPE$2.LeftSquareBracket; + type = TYPE$F.LeftSquareBracket; offset++; break; // U+005C REVERSE SOLIDUS (\) case 0x005C: // If the input stream starts with a valid escape, ... - if (isValidEscape$2(code, getCharCode(offset + 1))) { + if (isValidEscape(code, getCharCode(offset + 1))) { // ... reconsume the current input code point, consume an ident-like token, and return it. consumeIdentLikeToken(); } else { // Otherwise, this is a parse error. Return a with its value set to the current input code point. - type = TYPE$2.Delim; + type = TYPE$F.Delim; offset++; } break; @@ -5110,53 +5393,53 @@ // U+005D RIGHT SQUARE BRACKET (]) case 0x005D: // Return a <]-token>. - type = TYPE$2.RightSquareBracket; + type = TYPE$F.RightSquareBracket; offset++; break; // U+007B LEFT CURLY BRACKET ({) case 0x007B: // Return a <{-token>. - type = TYPE$2.LeftCurlyBracket; + type = TYPE$F.LeftCurlyBracket; offset++; break; // U+007D RIGHT CURLY BRACKET (}) case 0x007D: // Return a <}-token>. - type = TYPE$2.RightCurlyBracket; + type = TYPE$F.RightCurlyBracket; offset++; break; // digit - case charCodeCategory$1.Digit: + case charCodeCategory.Digit: // Reconsume the current input code point, consume a numeric token, and return it. consumeNumericToken(); break; // name-start code point - case charCodeCategory$1.NameStart: + case charCodeCategory.NameStart: // Reconsume the current input code point, consume an ident-like token, and return it. consumeIdentLikeToken(); break; // EOF - case charCodeCategory$1.Eof: + case charCodeCategory.Eof: // Return an . break; // anything else default: // Return a with its value set to the current input code point. - type = TYPE$2.Delim; + type = TYPE$F.Delim; offset++; } switch (type) { case balanceCloseType: - balancePrev = balanceStart & OFFSET_MASK$1; + balancePrev = balanceStart & OFFSET_MASK; balanceStart = balance[balancePrev]; - balanceCloseType = balanceStart >> TYPE_SHIFT$1; + balanceCloseType = balanceStart >> TYPE_SHIFT; balance[tokenCount] = balancePrev; balance[balancePrev++] = tokenCount; for (; balancePrev < tokenCount; balancePrev++) { @@ -5166,35 +5449,35 @@ } break; - case TYPE$2.LeftParenthesis: - case TYPE$2.Function: + case TYPE$F.LeftParenthesis: + case TYPE$F.Function: balance[tokenCount] = balanceStart; - balanceCloseType = TYPE$2.RightParenthesis; - balanceStart = (balanceCloseType << TYPE_SHIFT$1) | tokenCount; + balanceCloseType = TYPE$F.RightParenthesis; + balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount; break; - case TYPE$2.LeftSquareBracket: + case TYPE$F.LeftSquareBracket: balance[tokenCount] = balanceStart; - balanceCloseType = TYPE$2.RightSquareBracket; - balanceStart = (balanceCloseType << TYPE_SHIFT$1) | tokenCount; + balanceCloseType = TYPE$F.RightSquareBracket; + balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount; break; - case TYPE$2.LeftCurlyBracket: + case TYPE$F.LeftCurlyBracket: balance[tokenCount] = balanceStart; - balanceCloseType = TYPE$2.RightCurlyBracket; - balanceStart = (balanceCloseType << TYPE_SHIFT$1) | tokenCount; + balanceCloseType = TYPE$F.RightCurlyBracket; + balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount; break; } - offsetAndType[tokenCount++] = (type << TYPE_SHIFT$1) | offset; + offsetAndType[tokenCount++] = (type << TYPE_SHIFT) | offset; } // finalize buffers - offsetAndType[tokenCount] = (TYPE$2.EOF << TYPE_SHIFT$1) | offset; // + offsetAndType[tokenCount] = (TYPE$F.EOF << TYPE_SHIFT) | offset; // balance[tokenCount] = sourceLength; balance[sourceLength] = sourceLength; // prevents false positive balance match with any token while (balanceStart !== 0) { - balancePrev = balanceStart & OFFSET_MASK$1; + balancePrev = balanceStart & OFFSET_MASK; balanceStart = balance[balancePrev]; balance[balancePrev] = sourceLength; } @@ -5212,56 +5495,56 @@ } // extend tokenizer with constants - Object.keys(_const).forEach(function(key) { - tokenize[key] = _const[key]; + Object.keys(constants$1).forEach(function(key) { + tokenize$3[key] = constants$1[key]; }); // extend tokenizer with static methods from utils Object.keys(charCodeDefinitions).forEach(function(key) { - tokenize[key] = charCodeDefinitions[key]; + tokenize$3[key] = charCodeDefinitions[key]; }); Object.keys(utils).forEach(function(key) { - tokenize[key] = utils[key]; + tokenize$3[key] = utils[key]; }); - var tokenizer = tokenize; + var tokenizer$3 = tokenize$3; - var isDigit$2 = tokenizer.isDigit; - var cmpChar$1 = tokenizer.cmpChar; - var TYPE$3 = tokenizer.TYPE; + var isDigit$3 = tokenizer$3.isDigit; + var cmpChar$4 = tokenizer$3.cmpChar; + var TYPE$E = tokenizer$3.TYPE; - var DELIM = TYPE$3.Delim; - var WHITESPACE$1 = TYPE$3.WhiteSpace; - var COMMENT$1 = TYPE$3.Comment; - var IDENT = TYPE$3.Ident; - var NUMBER = TYPE$3.Number; - var DIMENSION = TYPE$3.Dimension; - var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+) - var HYPHENMINUS$1 = 0x002D; // U+002D HYPHEN-MINUS (-) - var N = 0x006E; // U+006E LATIN SMALL LETTER N (n) - var DISALLOW_SIGN = true; - var ALLOW_SIGN = false; + var DELIM$6 = TYPE$E.Delim; + var WHITESPACE$b = TYPE$E.WhiteSpace; + var COMMENT$9 = TYPE$E.Comment; + var IDENT$i = TYPE$E.Ident; + var NUMBER$9 = TYPE$E.Number; + var DIMENSION$7 = TYPE$E.Dimension; + var PLUSSIGN$8 = 0x002B; // U+002B PLUS SIGN (+) + var HYPHENMINUS$4 = 0x002D; // U+002D HYPHEN-MINUS (-) + var N$4 = 0x006E; // U+006E LATIN SMALL LETTER N (n) + var DISALLOW_SIGN$1 = true; + var ALLOW_SIGN$1 = false; - function isDelim(token, code) { - return token !== null && token.type === DELIM && token.value.charCodeAt(0) === code; + function isDelim$1(token, code) { + return token !== null && token.type === DELIM$6 && token.value.charCodeAt(0) === code; } function skipSC(token, offset, getNextToken) { - while (token !== null && (token.type === WHITESPACE$1 || token.type === COMMENT$1)) { + while (token !== null && (token.type === WHITESPACE$b || token.type === COMMENT$9)) { token = getNextToken(++offset); } return offset; } - function checkInteger(token, valueOffset, disallowSign, offset) { + function checkInteger$1(token, valueOffset, disallowSign, offset) { if (!token) { return 0; } var code = token.value.charCodeAt(valueOffset); - if (code === PLUSSIGN || code === HYPHENMINUS$1) { + if (code === PLUSSIGN$8 || code === HYPHENMINUS$4) { if (disallowSign) { // Number sign is not allowed return 0; @@ -5270,7 +5553,7 @@ } for (; valueOffset < token.value.length; valueOffset++) { - if (!isDigit$2(token.value.charCodeAt(valueOffset))) { + if (!isDigit$3(token.value.charCodeAt(valueOffset))) { // Integer is expected return 0; } @@ -5281,7 +5564,7 @@ // ... // ... ['+' | '-'] - function consumeB(token, offset_, getNextToken) { + function consumeB$1(token, offset_, getNextToken) { var sign = false; var offset = skipSC(token, offset_, getNextToken); @@ -5291,13 +5574,13 @@ return offset_; } - if (token.type !== NUMBER) { - if (isDelim(token, PLUSSIGN) || isDelim(token, HYPHENMINUS$1)) { + if (token.type !== NUMBER$9) { + if (isDelim$1(token, PLUSSIGN$8) || isDelim$1(token, HYPHENMINUS$4)) { sign = true; offset = skipSC(getNextToken(++offset), offset, getNextToken); token = getNextToken(offset); - if (token === null && token.type !== NUMBER) { + if (token === null && token.type !== NUMBER$9) { return 0; } } else { @@ -5307,13 +5590,13 @@ if (!sign) { var code = token.value.charCodeAt(0); - if (code !== PLUSSIGN && code !== HYPHENMINUS$1) { + if (code !== PLUSSIGN$8 && code !== HYPHENMINUS$4) { // Number sign is expected return 0; } } - return checkInteger(token, sign ? 0 : 1, sign, offset); + return checkInteger$1(token, sign ? 0 : 1, sign, offset); } // An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb @@ -5326,8 +5609,8 @@ } // - if (token.type === NUMBER) { - return checkInteger(token, 0, ALLOW_SIGN, offset); // b + if (token.type === NUMBER$9) { + return checkInteger$1(token, 0, ALLOW_SIGN$1, offset); // b } // -n @@ -5335,9 +5618,9 @@ // -n ['+' | '-'] // -n- // - else if (token.type === IDENT && token.value.charCodeAt(0) === HYPHENMINUS$1) { + else if (token.type === IDENT$i && token.value.charCodeAt(0) === HYPHENMINUS$4) { // expect 1st char is N - if (!cmpChar$1(token.value, 1, N)) { + if (!cmpChar$4(token.value, 1, N$4)) { return 0; } @@ -5346,26 +5629,26 @@ // -n // -n ['+' | '-'] case 2: - return consumeB(getNextToken(++offset), offset, getNextToken); + return consumeB$1(getNextToken(++offset), offset, getNextToken); // -n- case 3: - if (token.value.charCodeAt(2) !== HYPHENMINUS$1) { + if (token.value.charCodeAt(2) !== HYPHENMINUS$4) { return 0; } offset = skipSC(getNextToken(++offset), offset, getNextToken); token = getNextToken(offset); - return checkInteger(token, 0, DISALLOW_SIGN, offset); + return checkInteger$1(token, 0, DISALLOW_SIGN$1, offset); // default: - if (token.value.charCodeAt(2) !== HYPHENMINUS$1) { + if (token.value.charCodeAt(2) !== HYPHENMINUS$4) { return 0; } - return checkInteger(token, 3, DISALLOW_SIGN, offset); + return checkInteger$1(token, 3, DISALLOW_SIGN$1, offset); } } @@ -5374,13 +5657,13 @@ // '+'? n ['+' | '-'] // '+'? n- // '+'? - else if (token.type === IDENT || (isDelim(token, PLUSSIGN) && getNextToken(offset + 1).type === IDENT)) { + else if (token.type === IDENT$i || (isDelim$1(token, PLUSSIGN$8) && getNextToken(offset + 1).type === IDENT$i)) { // just ignore a plus - if (token.type !== IDENT) { + if (token.type !== IDENT$i) { token = getNextToken(++offset); } - if (token === null || !cmpChar$1(token.value, 0, N)) { + if (token === null || !cmpChar$4(token.value, 0, N$4)) { return 0; } @@ -5389,26 +5672,26 @@ // '+'? n // '+'? n ['+' | '-'] case 1: - return consumeB(getNextToken(++offset), offset, getNextToken); + return consumeB$1(getNextToken(++offset), offset, getNextToken); // '+'? n- case 2: - if (token.value.charCodeAt(1) !== HYPHENMINUS$1) { + if (token.value.charCodeAt(1) !== HYPHENMINUS$4) { return 0; } offset = skipSC(getNextToken(++offset), offset, getNextToken); token = getNextToken(offset); - return checkInteger(token, 0, DISALLOW_SIGN, offset); + return checkInteger$1(token, 0, DISALLOW_SIGN$1, offset); // '+'? default: - if (token.value.charCodeAt(1) !== HYPHENMINUS$1) { + if (token.value.charCodeAt(1) !== HYPHENMINUS$4) { return 0; } - return checkInteger(token, 2, DISALLOW_SIGN, offset); + return checkInteger$1(token, 2, DISALLOW_SIGN$1, offset); } } @@ -5417,12 +5700,12 @@ // // // ['+' | '-'] - else if (token.type === DIMENSION) { + else if (token.type === DIMENSION$7) { var code = token.value.charCodeAt(0); - var sign = code === PLUSSIGN || code === HYPHENMINUS$1 ? 1 : 0; + var sign = code === PLUSSIGN$8 || code === HYPHENMINUS$4 ? 1 : 0; for (var i = sign; i < token.value.length; i++) { - if (!isDigit$2(token.value.charCodeAt(i))) { + if (!isDigit$3(token.value.charCodeAt(i))) { break; } } @@ -5432,7 +5715,7 @@ return 0; } - if (!cmpChar$1(token.value, i, N)) { + if (!cmpChar$4(token.value, i, N$4)) { return 0; } @@ -5440,9 +5723,9 @@ // // ['+' | '-'] if (i + 1 === token.value.length) { - return consumeB(getNextToken(++offset), offset, getNextToken); + return consumeB$1(getNextToken(++offset), offset, getNextToken); } else { - if (token.value.charCodeAt(i + 1) !== HYPHENMINUS$1) { + if (token.value.charCodeAt(i + 1) !== HYPHENMINUS$4) { return 0; } @@ -5451,11 +5734,11 @@ offset = skipSC(getNextToken(++offset), offset, getNextToken); token = getNextToken(offset); - return checkInteger(token, 0, DISALLOW_SIGN, offset); + return checkInteger$1(token, 0, DISALLOW_SIGN$1, offset); } // else { - return checkInteger(token, i + 2, DISALLOW_SIGN, offset); + return checkInteger$1(token, i + 2, DISALLOW_SIGN$1, offset); } } } @@ -5463,24 +5746,24 @@ return 0; }; - var isHexDigit$2 = tokenizer.isHexDigit; - var cmpChar$2 = tokenizer.cmpChar; - var TYPE$4 = tokenizer.TYPE; + var isHexDigit$2 = tokenizer$3.isHexDigit; + var cmpChar$3 = tokenizer$3.cmpChar; + var TYPE$D = tokenizer$3.TYPE; - var IDENT$1 = TYPE$4.Ident; - var DELIM$1 = TYPE$4.Delim; - var NUMBER$1 = TYPE$4.Number; - var DIMENSION$1 = TYPE$4.Dimension; - var PLUSSIGN$1 = 0x002B; // U+002B PLUS SIGN (+) - var HYPHENMINUS$2 = 0x002D; // U+002D HYPHEN-MINUS (-) - var QUESTIONMARK = 0x003F; // U+003F QUESTION MARK (?) - var U = 0x0075; // U+0075 LATIN SMALL LETTER U (u) + var IDENT$h = TYPE$D.Ident; + var DELIM$5 = TYPE$D.Delim; + var NUMBER$8 = TYPE$D.Number; + var DIMENSION$6 = TYPE$D.Dimension; + var PLUSSIGN$7 = 0x002B; // U+002B PLUS SIGN (+) + var HYPHENMINUS$3 = 0x002D; // U+002D HYPHEN-MINUS (-) + var QUESTIONMARK$2 = 0x003F; // U+003F QUESTION MARK (?) + var U$2 = 0x0075; // U+0075 LATIN SMALL LETTER U (u) - function isDelim$1(token, code) { - return token !== null && token.type === DELIM$1 && token.value.charCodeAt(0) === code; + function isDelim(token, code) { + return token !== null && token.type === DELIM$5 && token.value.charCodeAt(0) === code; } - function startsWith(token, code) { + function startsWith$1(token, code) { return token.value.charCodeAt(0) === code; } @@ -5488,7 +5771,7 @@ for (var pos = offset, hexlen = 0; pos < token.value.length; pos++) { var code = token.value.charCodeAt(pos); - if (code === HYPHENMINUS$2 && allowDash && hexlen !== 0) { + if (code === HYPHENMINUS$3 && allowDash && hexlen !== 0) { if (hexSequence(token, offset + hexlen + 1, false) > 0) { return 6; // dissallow following question marks } @@ -5512,7 +5795,7 @@ return 0; // nothing consumed } - while (isDelim$1(getNextToken(length), QUESTIONMARK)) { + while (isDelim(getNextToken(length), QUESTIONMARK$2)) { if (++consumed > 6) { return 0; // too many question marks } @@ -5546,7 +5829,7 @@ var length = 0; // should start with `u` or `U` - if (token === null || token.type !== IDENT$1 || !cmpChar$2(token.value, 0, U)) { + if (token === null || token.type !== IDENT$h || !cmpChar$3(token.value, 0, U$2)) { return 0; } @@ -5557,18 +5840,18 @@ // u '+' '?'* // u '+' '?'+ - if (isDelim$1(token, PLUSSIGN$1)) { + if (isDelim(token, PLUSSIGN$7)) { token = getNextToken(++length); if (token === null) { return 0; } - if (token.type === IDENT$1) { + if (token.type === IDENT$h) { // u '+' '?'* return withQuestionMarkSequence(hexSequence(token, 0, true), ++length, getNextToken); } - if (isDelim$1(token, QUESTIONMARK)) { + if (isDelim(token, QUESTIONMARK$2)) { // u '+' '?'+ return withQuestionMarkSequence(1, ++length, getNextToken); } @@ -5580,8 +5863,8 @@ // u '?'* // u // u - if (token.type === NUMBER$1) { - if (!startsWith(token, PLUSSIGN$1)) { + if (token.type === NUMBER$8) { + if (!startsWith$1(token, PLUSSIGN$7)) { return 0; } @@ -5596,10 +5879,10 @@ return length; } - if (token.type === DIMENSION$1 || token.type === NUMBER$1) { + if (token.type === DIMENSION$6 || token.type === NUMBER$8) { // u // u - if (!startsWith(token, HYPHENMINUS$2) || !hexSequence(token, 1, false)) { + if (!startsWith$1(token, HYPHENMINUS$3) || !hexSequence(token, 1, false)) { return 0; } @@ -5611,8 +5894,8 @@ } // u '?'* - if (token.type === DIMENSION$1) { - if (!startsWith(token, PLUSSIGN$1)) { + if (token.type === DIMENSION$6) { + if (!startsWith$1(token, PLUSSIGN$7)) { return 0; } @@ -5622,16 +5905,17 @@ return 0; }; - var isIdentifierStart$2 = tokenizer.isIdentifierStart; - var isHexDigit$3 = tokenizer.isHexDigit; - var isDigit$3 = tokenizer.isDigit; - var cmpStr$3 = tokenizer.cmpStr; - var consumeNumber$2 = tokenizer.consumeNumber; - var TYPE$5 = tokenizer.TYPE; + var tokenizer$2 = tokenizer$3; + var isIdentifierStart = tokenizer$2.isIdentifierStart; + var isHexDigit$1 = tokenizer$2.isHexDigit; + var isDigit$2 = tokenizer$2.isDigit; + var cmpStr$3 = tokenizer$2.cmpStr; + var consumeNumber$3 = tokenizer$2.consumeNumber; + var TYPE$C = tokenizer$2.TYPE; + var anPlusB = genericAnPlusB; + var urange = genericUrange; - - - var cssWideKeywords = ['unset', 'initial', 'inherit']; + var cssWideKeywords$1 = ['unset', 'initial', 'inherit']; var calcFunctionNames = ['calc(', '-moz-calc(', '-webkit-calc(']; // https://www.w3.org/TR/css-values-3/#lengths @@ -5726,7 +6010,7 @@ return ( str.charCodeAt(offset) === 0x005C && // U+005C REVERSE SOLIDUS (\) - isDigit$3(str.charCodeAt(offset + 1)) + isDigit$2(str.charCodeAt(offset + 1)) ); } @@ -5779,7 +6063,7 @@ return 0; } - if (token.type === TYPE$5.Function && eqStrAny(token.value, calcFunctionNames)) { + if (token.type === TYPE$C.Function && eqStrAny(token.value, calcFunctionNames)) { return consumeFunction(token, getNextToken); } @@ -5821,14 +6105,14 @@ // // See also: https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident function customIdent(token) { - if (token === null || token.type !== TYPE$5.Ident) { + if (token === null || token.type !== TYPE$C.Ident) { return 0; } var name = token.value.toLowerCase(); // The CSS-wide keywords are not valid s - if (eqStrAny(name, cssWideKeywords)) { + if (eqStrAny(name, cssWideKeywords$1)) { return 0; } @@ -5853,7 +6137,7 @@ // NOTE: Current implementation treat `--` as a valid name since most (all?) major browsers treat it as valid. function customPropertyName(token) { // ... defined as any valid identifier - if (token === null || token.type !== TYPE$5.Ident) { + if (token === null || token.type !== TYPE$C.Ident) { return 0; } @@ -5870,7 +6154,7 @@ // In other words, a hex color is written as a hash character, "#", followed by some number of digits 0-9 or // letters a-f (the case of the letters doesn’t matter - #00ff00 is identical to #00FF00). function hexColor(token) { - if (token === null || token.type !== TYPE$5.Hash) { + if (token === null || token.type !== TYPE$C.Hash) { return 0; } @@ -5882,7 +6166,7 @@ } for (var i = 1; i < length; i++) { - if (!isHexDigit$3(token.value.charCodeAt(i))) { + if (!isHexDigit$1(token.value.charCodeAt(i))) { return 0; } } @@ -5891,11 +6175,11 @@ } function idSelector(token) { - if (token === null || token.type !== TYPE$5.Hash) { + if (token === null || token.type !== TYPE$C.Hash) { return 0; } - if (!isIdentifierStart$2(charCode(token.value, 1), charCode(token.value, 2), charCode(token.value, 3))) { + if (!isIdentifierStart(charCode(token.value, 1), charCode(token.value, 2), charCode(token.value, 3))) { return 0; } @@ -5919,14 +6203,14 @@ do { switch (token.type) { // ... does not contain , , - case TYPE$5.BadString: - case TYPE$5.BadUrl: + case TYPE$C.BadString: + case TYPE$C.BadUrl: break scan; // ... unmatched <)-token>, <]-token>, or <}-token>, - case TYPE$5.RightCurlyBracket: - case TYPE$5.RightParenthesis: - case TYPE$5.RightSquareBracket: + case TYPE$C.RightCurlyBracket: + case TYPE$C.RightParenthesis: + case TYPE$C.RightSquareBracket: if (token.balance > token.index || token.balance < startIdx) { break scan; } @@ -5935,7 +6219,7 @@ break; // ... or top-level tokens - case TYPE$5.Semicolon: + case TYPE$C.Semicolon: if (level === 0) { break scan; } @@ -5943,17 +6227,17 @@ break; // ... or tokens with a value of "!" - case TYPE$5.Delim: + case TYPE$C.Delim: if (token.value === '!' && level === 0) { break scan; } break; - case TYPE$5.Function: - case TYPE$5.LeftParenthesis: - case TYPE$5.LeftSquareBracket: - case TYPE$5.LeftCurlyBracket: + case TYPE$C.Function: + case TYPE$C.LeftParenthesis: + case TYPE$C.LeftSquareBracket: + case TYPE$C.LeftCurlyBracket: level++; break; } @@ -5987,14 +6271,14 @@ do { switch (token.type) { // ... does not contain , , - case TYPE$5.BadString: - case TYPE$5.BadUrl: + case TYPE$C.BadString: + case TYPE$C.BadUrl: break scan; // ... unmatched <)-token>, <]-token>, or <}-token>, - case TYPE$5.RightCurlyBracket: - case TYPE$5.RightParenthesis: - case TYPE$5.RightSquareBracket: + case TYPE$C.RightCurlyBracket: + case TYPE$C.RightParenthesis: + case TYPE$C.RightSquareBracket: if (token.balance > token.index || token.balance < startIdx) { break scan; } @@ -6019,11 +6303,11 @@ function dimension(type) { return function(token, getNextToken, opts) { - if (token === null || token.type !== TYPE$5.Dimension) { + if (token === null || token.type !== TYPE$C.Dimension) { return 0; } - var numberEnd = consumeNumber$2(token.value, 0); + var numberEnd = consumeNumber$3(token.value, 0); // check unit if (type !== null) { @@ -6055,7 +6339,7 @@ // https://drafts.csswg.org/css-values-4/#percentages function percentage(token, getNextToken, opts) { // ... corresponds to the production - if (token === null || token.type !== TYPE$5.Percentage) { + if (token === null || token.type !== TYPE$C.Percentage) { return 0; } @@ -6083,7 +6367,7 @@ } return function(token, getNextToken, opts) { - if (token !== null && token.type === TYPE$5.Number) { + if (token !== null && token.type === TYPE$C.Number) { if (Number(token.value) === 0) { return 1; } @@ -6102,7 +6386,7 @@ return 0; } - var numberEnd = consumeNumber$2(token.value, 0); + var numberEnd = consumeNumber$3(token.value, 0); var isNumber = numberEnd === token.value.length; if (!isNumber && !isPostfixIeHack(token.value, numberEnd)) { return 0; @@ -6120,7 +6404,7 @@ // https://drafts.csswg.org/css-values-4/#integers function integer(token, getNextToken, opts) { // ... corresponds to a subset of the production - if (token === null || token.type !== TYPE$5.Number) { + if (token === null || token.type !== TYPE$C.Number) { return 0; } @@ -6130,7 +6414,7 @@ // When written literally, an integer is one or more decimal digits 0 through 9 ... for (; i < token.value.length; i++) { - if (!isDigit$3(token.value.charCodeAt(i))) { + if (!isDigit$2(token.value.charCodeAt(i))) { return 0; } } @@ -6143,44 +6427,44 @@ return 1; } - var generic = { + var generic$1 = { // token types - 'ident-token': tokenType(TYPE$5.Ident), - 'function-token': tokenType(TYPE$5.Function), - 'at-keyword-token': tokenType(TYPE$5.AtKeyword), - 'hash-token': tokenType(TYPE$5.Hash), - 'string-token': tokenType(TYPE$5.String), - 'bad-string-token': tokenType(TYPE$5.BadString), - 'url-token': tokenType(TYPE$5.Url), - 'bad-url-token': tokenType(TYPE$5.BadUrl), - 'delim-token': tokenType(TYPE$5.Delim), - 'number-token': tokenType(TYPE$5.Number), - 'percentage-token': tokenType(TYPE$5.Percentage), - 'dimension-token': tokenType(TYPE$5.Dimension), - 'whitespace-token': tokenType(TYPE$5.WhiteSpace), - 'CDO-token': tokenType(TYPE$5.CDO), - 'CDC-token': tokenType(TYPE$5.CDC), - 'colon-token': tokenType(TYPE$5.Colon), - 'semicolon-token': tokenType(TYPE$5.Semicolon), - 'comma-token': tokenType(TYPE$5.Comma), - '[-token': tokenType(TYPE$5.LeftSquareBracket), - ']-token': tokenType(TYPE$5.RightSquareBracket), - '(-token': tokenType(TYPE$5.LeftParenthesis), - ')-token': tokenType(TYPE$5.RightParenthesis), - '{-token': tokenType(TYPE$5.LeftCurlyBracket), - '}-token': tokenType(TYPE$5.RightCurlyBracket), + 'ident-token': tokenType(TYPE$C.Ident), + 'function-token': tokenType(TYPE$C.Function), + 'at-keyword-token': tokenType(TYPE$C.AtKeyword), + 'hash-token': tokenType(TYPE$C.Hash), + 'string-token': tokenType(TYPE$C.String), + 'bad-string-token': tokenType(TYPE$C.BadString), + 'url-token': tokenType(TYPE$C.Url), + 'bad-url-token': tokenType(TYPE$C.BadUrl), + 'delim-token': tokenType(TYPE$C.Delim), + 'number-token': tokenType(TYPE$C.Number), + 'percentage-token': tokenType(TYPE$C.Percentage), + 'dimension-token': tokenType(TYPE$C.Dimension), + 'whitespace-token': tokenType(TYPE$C.WhiteSpace), + 'CDO-token': tokenType(TYPE$C.CDO), + 'CDC-token': tokenType(TYPE$C.CDC), + 'colon-token': tokenType(TYPE$C.Colon), + 'semicolon-token': tokenType(TYPE$C.Semicolon), + 'comma-token': tokenType(TYPE$C.Comma), + '[-token': tokenType(TYPE$C.LeftSquareBracket), + ']-token': tokenType(TYPE$C.RightSquareBracket), + '(-token': tokenType(TYPE$C.LeftParenthesis), + ')-token': tokenType(TYPE$C.RightParenthesis), + '{-token': tokenType(TYPE$C.LeftCurlyBracket), + '}-token': tokenType(TYPE$C.RightCurlyBracket), // token type aliases - 'string': tokenType(TYPE$5.String), - 'ident': tokenType(TYPE$5.Ident), + 'string': tokenType(TYPE$C.String), + 'ident': tokenType(TYPE$C.Ident), // complex types 'custom-ident': customIdent, 'custom-property-name': customPropertyName, 'hex-color': hexColor, 'id-selector': idSelector, // element( ) - 'an-plus-b': genericAnPlusB, - 'urange': genericUrange, + 'an-plus-b': anPlusB, + 'urange': urange, 'declaration-value': declarationValue, 'any-value': anyValue, @@ -6207,7 +6491,9 @@ '-ms-legacy-expression': func('expression') }; - var _SyntaxError$1 = function SyntaxError(message, input, offset) { + var createCustomError = createCustomError$3; + + var _SyntaxError = function SyntaxError(message, input, offset) { var error = createCustomError('SyntaxError', message); error.input = input; @@ -6220,18 +6506,20 @@ return error; }; - var TAB = 9; - var N$1 = 10; - var F = 12; - var R = 13; - var SPACE = 32; + var SyntaxError$3 = _SyntaxError; - var Tokenizer = function(str) { + var TAB$1 = 9; + var N$3 = 10; + var F$2 = 12; + var R$2 = 13; + var SPACE$2 = 32; + + var Tokenizer$1 = function(str) { this.str = str; this.pos = 0; }; - Tokenizer.prototype = { + Tokenizer$1.prototype = { charCodeAt: function(pos) { return pos < this.str.length ? this.str.charCodeAt(pos) : 0; }, @@ -6247,7 +6535,7 @@ findWsEnd: function(pos) { for (; pos < this.str.length; pos++) { var code = this.str.charCodeAt(pos); - if (code !== R && code !== N$1 && code !== F && code !== SPACE && code !== TAB) { + if (code !== R$2 && code !== N$3 && code !== F$2 && code !== SPACE$2 && code !== TAB$1) { break; } } @@ -6268,36 +6556,37 @@ return this.pos < this.str.length ? this.str.charAt(this.pos++) : ''; }, error: function(message) { - throw new _SyntaxError$1(message, this.str, this.pos); + throw new SyntaxError$3(message, this.str, this.pos); } }; - var tokenizer$1 = Tokenizer; + var tokenizer$1 = Tokenizer$1; - var TAB$1 = 9; + var Tokenizer = tokenizer$1; + var TAB = 9; var N$2 = 10; var F$1 = 12; var R$1 = 13; var SPACE$1 = 32; - var EXCLAMATIONMARK = 33; // ! - var NUMBERSIGN = 35; // # - var AMPERSAND = 38; // & + var EXCLAMATIONMARK$3 = 33; // ! + var NUMBERSIGN$4 = 35; // # + var AMPERSAND$1 = 38; // & var APOSTROPHE = 39; // ' - var LEFTPARENTHESIS = 40; // ( - var RIGHTPARENTHESIS = 41; // ) - var ASTERISK = 42; // * - var PLUSSIGN$2 = 43; // + - var COMMA = 44; // , + var LEFTPARENTHESIS$7 = 40; // ( + var RIGHTPARENTHESIS$7 = 41; // ) + var ASTERISK$6 = 42; // * + var PLUSSIGN$6 = 43; // + + var COMMA$4 = 44; // , var HYPERMINUS = 45; // - var LESSTHANSIGN = 60; // < - var GREATERTHANSIGN = 62; // > + var GREATERTHANSIGN$2 = 62; // > var QUESTIONMARK$1 = 63; // ? var COMMERCIALAT = 64; // @ - var LEFTSQUAREBRACKET = 91; // [ - var RIGHTSQUAREBRACKET = 93; // ] - var LEFTCURLYBRACKET = 123; // { - var VERTICALLINE = 124; // | - var RIGHTCURLYBRACKET = 125; // } + var LEFTSQUAREBRACKET$4 = 91; // [ + var RIGHTSQUAREBRACKET$2 = 93; // ] + var LEFTCURLYBRACKET$4 = 123; // { + var VERTICALLINE$3 = 124; // | + var RIGHTCURLYBRACKET$2 = 125; // } var INFINITY = 8734; // ∞ var NAME_CHAR = createCharMap(function(ch) { return /[a-zA-Z0-9\-]/.test(ch); @@ -6372,20 +6661,20 @@ var min = null; var max = null; - tokenizer.eat(LEFTCURLYBRACKET); + tokenizer.eat(LEFTCURLYBRACKET$4); min = scanNumber(tokenizer); - if (tokenizer.charCode() === COMMA) { + if (tokenizer.charCode() === COMMA$4) { tokenizer.pos++; - if (tokenizer.charCode() !== RIGHTCURLYBRACKET) { + if (tokenizer.charCode() !== RIGHTCURLYBRACKET$2) { max = scanNumber(tokenizer); } } else { max = min; } - tokenizer.eat(RIGHTCURLYBRACKET); + tokenizer.eat(RIGHTCURLYBRACKET$2); return { min: Number(min), @@ -6398,7 +6687,7 @@ var comma = false; switch (tokenizer.charCode()) { - case ASTERISK: + case ASTERISK$6: tokenizer.pos++; range = { @@ -6408,7 +6697,7 @@ break; - case PLUSSIGN$2: + case PLUSSIGN$6: tokenizer.pos++; range = { @@ -6428,12 +6717,12 @@ break; - case NUMBERSIGN: + case NUMBERSIGN$4: tokenizer.pos++; comma = true; - if (tokenizer.charCode() === LEFTCURLYBRACKET) { + if (tokenizer.charCode() === LEFTCURLYBRACKET$4) { range = readMultiplierRange(tokenizer); } else { range = { @@ -6444,7 +6733,7 @@ break; - case LEFTCURLYBRACKET: + case LEFTCURLYBRACKET$4: range = readMultiplierRange(tokenizer); break; @@ -6485,7 +6774,7 @@ }; } - function readProperty(tokenizer) { + function readProperty$1(tokenizer) { var name; tokenizer.eat(LESSTHANSIGN); @@ -6494,7 +6783,7 @@ name = scanWord(tokenizer); tokenizer.eat(APOSTROPHE); - tokenizer.eat(GREATERTHANSIGN); + tokenizer.eat(GREATERTHANSIGN$2); return maybeMultiplied(tokenizer, { type: 'Property', @@ -6515,7 +6804,7 @@ var max = null; // Infinity var sign = 1; - tokenizer.eat(LEFTSQUAREBRACKET); + tokenizer.eat(LEFTSQUAREBRACKET$4); if (tokenizer.charCode() === HYPERMINUS) { tokenizer.peek(); @@ -6529,7 +6818,7 @@ } scanSpaces(tokenizer); - tokenizer.eat(COMMA); + tokenizer.eat(COMMA$4); scanSpaces(tokenizer); if (tokenizer.charCode() === INFINITY) { @@ -6545,7 +6834,7 @@ max = sign * Number(scanNumber(tokenizer)); } - tokenizer.eat(RIGHTSQUAREBRACKET); + tokenizer.eat(RIGHTSQUAREBRACKET$2); // If no range is indicated, either by using the bracketed range notation // or in the property description, then [−∞,∞] is assumed. @@ -6567,18 +6856,18 @@ tokenizer.eat(LESSTHANSIGN); name = scanWord(tokenizer); - if (tokenizer.charCode() === LEFTPARENTHESIS && - tokenizer.nextCharCode() === RIGHTPARENTHESIS) { + if (tokenizer.charCode() === LEFTPARENTHESIS$7 && + tokenizer.nextCharCode() === RIGHTPARENTHESIS$7) { tokenizer.pos += 2; name += '()'; } - if (tokenizer.charCodeAt(tokenizer.findWsEnd(tokenizer.pos)) === LEFTSQUAREBRACKET) { + if (tokenizer.charCodeAt(tokenizer.findWsEnd(tokenizer.pos)) === LEFTSQUAREBRACKET$4) { scanSpaces(tokenizer); opts = readTypeRange(tokenizer); } - tokenizer.eat(GREATERTHANSIGN); + tokenizer.eat(GREATERTHANSIGN$2); return maybeMultiplied(tokenizer, { type: 'Type', @@ -6592,7 +6881,7 @@ name = scanWord(tokenizer); - if (tokenizer.charCode() === LEFTPARENTHESIS) { + if (tokenizer.charCode() === LEFTPARENTHESIS$7) { tokenizer.pos++; return { @@ -6708,13 +6997,13 @@ function readGroup(tokenizer) { var result; - tokenizer.eat(LEFTSQUAREBRACKET); + tokenizer.eat(LEFTSQUAREBRACKET$4); result = readImplicitGroup(tokenizer); - tokenizer.eat(RIGHTSQUAREBRACKET); + tokenizer.eat(RIGHTSQUAREBRACKET$2); result.explicit = true; - if (tokenizer.charCode() === EXCLAMATIONMARK) { + if (tokenizer.charCode() === EXCLAMATIONMARK$3) { tokenizer.pos++; result.disallowEmpty = true; } @@ -6730,38 +7019,38 @@ } switch (code) { - case RIGHTSQUAREBRACKET: + case RIGHTSQUAREBRACKET$2: // don't eat, stop scan a group break; - case LEFTSQUAREBRACKET: + case LEFTSQUAREBRACKET$4: return maybeMultiplied(tokenizer, readGroup(tokenizer)); case LESSTHANSIGN: return tokenizer.nextCharCode() === APOSTROPHE - ? readProperty(tokenizer) + ? readProperty$1(tokenizer) : readType(tokenizer); - case VERTICALLINE: + case VERTICALLINE$3: return { type: 'Combinator', value: tokenizer.substringToPos( - tokenizer.nextCharCode() === VERTICALLINE + tokenizer.nextCharCode() === VERTICALLINE$3 ? tokenizer.pos + 2 : tokenizer.pos + 1 ) }; - case AMPERSAND: + case AMPERSAND$1: tokenizer.pos++; - tokenizer.eat(AMPERSAND); + tokenizer.eat(AMPERSAND$1); return { type: 'Combinator', value: '&&' }; - case COMMA: + case COMMA$4: tokenizer.pos++; return { type: 'Comma' @@ -6774,7 +7063,7 @@ }); case SPACE$1: - case TAB$1: + case TAB: case N$2: case R$1: case F$1: @@ -6796,15 +7085,15 @@ return maybeToken(tokenizer); - case ASTERISK: - case PLUSSIGN$2: + case ASTERISK$6: + case PLUSSIGN$6: case QUESTIONMARK$1: - case NUMBERSIGN: - case EXCLAMATIONMARK: + case NUMBERSIGN$4: + case EXCLAMATIONMARK$3: // prohibited tokens (used as a multiplier start) break; - case LEFTCURLYBRACKET: + case LEFTCURLYBRACKET$4: // LEFTCURLYBRACKET is allowed since mdn/data uses it w/o quoting // check next char isn't a number, because it's likely a disjoined multiplier code = tokenizer.nextCharCode(); @@ -6820,8 +7109,8 @@ } } - function parse(source) { - var tokenizer = new tokenizer$1(source); + function parse$2(source) { + var tokenizer = new Tokenizer(source); var result = readImplicitGroup(tokenizer); if (tokenizer.pos !== source.length) { @@ -6838,13 +7127,13 @@ // warm up parse to elimitate code branches that never execute // fix soft deoptimizations (insufficient type feedback) - parse('[a&&#|<\'c\'>*||e() f{2} /,(% g#{1,2} h{2,})]!'); + parse$2('[a&&#|<\'c\'>*||e() f{2} /,(% g#{1,2} h{2,})]!'); - var parse_1 = parse; + var parse_1 = parse$2; var noop$2 = function() {}; - function ensureFunction(value) { + function ensureFunction$1(value) { return typeof value === 'function' ? value : noop$2; } @@ -6884,8 +7173,8 @@ if (typeof options === 'function') { enter = options; } else if (options) { - enter = ensureFunction(options.enter); - leave = ensureFunction(options.leave); + enter = ensureFunction$1(options.enter); + leave = ensureFunction$1(options.leave); } if (enter === noop$2 && leave === noop$2) { @@ -6895,7 +7184,9 @@ walk(node); }; - var tokenStream = new TokenStream_1(); + var tokenize$2 = tokenizer$3; + var TokenStream$2 = TokenStream_1; + var tokenStream = new TokenStream$2(); var astToTokens = { decorator: function(handlers) { var curNode = null; @@ -6923,19 +7214,19 @@ } }, result: function() { - return prepareTokens(buffer, nodes); + return prepareTokens$1(buffer, nodes); } }; } }; - function prepareTokens(str, nodes) { + function prepareTokens$1(str, nodes) { var tokens = []; var nodesOffset = 0; var nodesIndex = 0; var currentNode = nodes ? nodes[nodesIndex].node : null; - tokenizer(str, tokenStream); + tokenize$2(str, tokenStream); while (!tokenStream.eof) { if (nodes) { @@ -6961,29 +7252,31 @@ var prepareTokens_1 = function(value, syntax) { if (typeof value === 'string') { - return prepareTokens(value, null); + return prepareTokens$1(value, null); } return syntax.generate(value, astToTokens); }; - var MATCH = { type: 'Match' }; - var MISMATCH = { type: 'Mismatch' }; - var DISALLOW_EMPTY = { type: 'DisallowEmpty' }; - var LEFTPARENTHESIS$1 = 40; // ( - var RIGHTPARENTHESIS$1 = 41; // ) + var parse$1 = parse_1; + + var MATCH$1 = { type: 'Match' }; + var MISMATCH$1 = { type: 'Mismatch' }; + var DISALLOW_EMPTY$1 = { type: 'DisallowEmpty' }; + var LEFTPARENTHESIS$6 = 40; // ( + var RIGHTPARENTHESIS$6 = 41; // ) function createCondition(match, thenBranch, elseBranch) { // reduce node count - if (thenBranch === MATCH && elseBranch === MISMATCH) { + if (thenBranch === MATCH$1 && elseBranch === MISMATCH$1) { return match; } - if (match === MATCH && thenBranch === MATCH && elseBranch === MATCH) { + if (match === MATCH$1 && thenBranch === MATCH$1 && elseBranch === MATCH$1) { return match; } - if (match.type === 'If' && match.else === MISMATCH && thenBranch === MATCH) { + if (match.type === 'If' && match.else === MISMATCH$1 && thenBranch === MATCH$1) { thenBranch = match.then; match = match.match; } @@ -6999,8 +7292,8 @@ function isFunctionType(name) { return ( name.length > 2 && - name.charCodeAt(name.length - 2) === LEFTPARENTHESIS$1 && - name.charCodeAt(name.length - 1) === RIGHTPARENTHESIS$1 + name.charCodeAt(name.length - 2) === LEFTPARENTHESIS$6 && + name.charCodeAt(name.length - 1) === RIGHTPARENTHESIS$6 ); } @@ -7027,7 +7320,7 @@ // else MISMATCH // else MISMATCH // else MISMATCH - var result = MATCH; + var result = MATCH$1; for (var i = terms.length - 1; i >= 0; i--) { var term = terms[i]; @@ -7035,7 +7328,7 @@ result = createCondition( term, result, - MISMATCH + MISMATCH$1 ); } return result; @@ -7053,7 +7346,7 @@ // then MATCH // else MISMATCH - var result = MISMATCH; + var result = MISMATCH$1; var map = null; for (var i = terms.length - 1; i >= 0; i--) { @@ -7068,7 +7361,7 @@ type: 'Enum', map: map }, - MATCH, + MATCH$1, result ); } @@ -7087,7 +7380,7 @@ // create a new conditonal node result = createCondition( term, - MATCH, + MATCH$1, result ); } @@ -7130,7 +7423,7 @@ // then MATCH // else MISMATCH // else MISMATCH - var result = MISMATCH; + var result = MISMATCH$1; for (var i = terms.length - 1; i >= 0; i--) { var term = terms[i]; @@ -7145,7 +7438,7 @@ false ); } else { - thenClause = MATCH; + thenClause = MATCH$1; } result = createCondition( @@ -7193,7 +7486,7 @@ // then MATCH // else MATCH // else MISMATCH - var result = atLeastOneTermMatched ? MATCH : MISMATCH; + var result = atLeastOneTermMatched ? MATCH$1 : MISMATCH$1; for (var i = terms.length - 1; i >= 0; i--) { var term = terms[i]; @@ -7208,7 +7501,7 @@ true ); } else { - thenClause = MATCH; + thenClause = MATCH$1; } result = createCondition( @@ -7222,15 +7515,15 @@ } function buildMultiplierMatchGraph(node) { - var result = MATCH; - var matchTerm = buildMatchGraph(node.term); + var result = MATCH$1; + var matchTerm = buildMatchGraph$1(node.term); if (node.max === 0) { // disable repeating of empty match to prevent infinite loop matchTerm = createCondition( matchTerm, - DISALLOW_EMPTY, - MISMATCH + DISALLOW_EMPTY$1, + MISMATCH$1 ); // an occurrence count is not limited, make a cycle; @@ -7238,12 +7531,12 @@ result = createCondition( matchTerm, null, // will be a loop - MISMATCH + MISMATCH$1 ); result.then = createCondition( - MATCH, - MATCH, + MATCH$1, + MATCH$1, result // make a loop ); @@ -7251,28 +7544,28 @@ result.then.else = createCondition( { type: 'Comma', syntax: node }, result, - MISMATCH + MISMATCH$1 ); } } else { // create a match node chain for [min .. max] interval with optional matches for (var i = node.min || 1; i <= node.max; i++) { - if (node.comma && result !== MATCH) { + if (node.comma && result !== MATCH$1) { result = createCondition( { type: 'Comma', syntax: node }, result, - MISMATCH + MISMATCH$1 ); } result = createCondition( matchTerm, createCondition( - MATCH, - MATCH, + MATCH$1, + MATCH$1, result ), - MISMATCH + MISMATCH$1 ); } } @@ -7280,25 +7573,25 @@ if (node.min === 0) { // allow zero match result = createCondition( - MATCH, - MATCH, + MATCH$1, + MATCH$1, result ); } else { // create a match node chain to collect [0 ... min - 1] required matches for (var i = 0; i < node.min - 1; i++) { - if (node.comma && result !== MATCH) { + if (node.comma && result !== MATCH$1) { result = createCondition( { type: 'Comma', syntax: node }, result, - MISMATCH + MISMATCH$1 ); } result = createCondition( matchTerm, result, - MISMATCH + MISMATCH$1 ); } } @@ -7306,7 +7599,7 @@ return result; } - function buildMatchGraph(node) { + function buildMatchGraph$1(node) { if (typeof node === 'function') { return { type: 'Generic', @@ -7318,15 +7611,15 @@ case 'Group': var result = buildGroupMatchGraph( node.combinator, - node.terms.map(buildMatchGraph), + node.terms.map(buildMatchGraph$1), false ); if (node.disallowEmpty) { result = createCondition( result, - DISALLOW_EMPTY, - MISMATCH + DISALLOW_EMPTY$1, + MISMATCH$1 ); } @@ -7399,30 +7692,30 @@ } } - var matchGraph = { - MATCH: MATCH, - MISMATCH: MISMATCH, - DISALLOW_EMPTY: DISALLOW_EMPTY, + var matchGraph$1 = { + MATCH: MATCH$1, + MISMATCH: MISMATCH$1, + DISALLOW_EMPTY: DISALLOW_EMPTY$1, buildMatchGraph: function(syntaxTree, ref) { if (typeof syntaxTree === 'string') { - syntaxTree = parse_1(syntaxTree); + syntaxTree = parse$1(syntaxTree); } return { type: 'MatchGraph', - match: buildMatchGraph(syntaxTree), + match: buildMatchGraph$1(syntaxTree), syntax: ref || null, source: syntaxTree }; } }; - var hasOwnProperty$1 = Object.prototype.hasOwnProperty; - - var MATCH$1 = matchGraph.MATCH; - var MISMATCH$1 = matchGraph.MISMATCH; - var DISALLOW_EMPTY$1 = matchGraph.DISALLOW_EMPTY; - var TYPE$6 = _const.TYPE; + var hasOwnProperty$6 = Object.prototype.hasOwnProperty; + var matchGraph = matchGraph$1; + var MATCH = matchGraph.MATCH; + var MISMATCH = matchGraph.MISMATCH; + var DISALLOW_EMPTY = matchGraph.DISALLOW_EMPTY; + var TYPE$B = _const.TYPE; var STUB = 0; var TOKEN = 1; @@ -7473,18 +7766,28 @@ return true; } + function isContextEdgeDelim(token) { + if (token.type !== TYPE$B.Delim) { + return false; + } + + // Fix matching for unicode-range: U+30??, U+FF00-FF9F + // Probably we need to check out previous match instead + return token.value !== '?'; + } + function isCommaContextStart(token) { if (token === null) { return true; } return ( - token.type === TYPE$6.Comma || - token.type === TYPE$6.Function || - token.type === TYPE$6.LeftParenthesis || - token.type === TYPE$6.LeftSquareBracket || - token.type === TYPE$6.LeftCurlyBracket || - token.type === TYPE$6.Delim + token.type === TYPE$B.Comma || + token.type === TYPE$B.Function || + token.type === TYPE$B.LeftParenthesis || + token.type === TYPE$B.LeftSquareBracket || + token.type === TYPE$B.LeftCurlyBracket || + isContextEdgeDelim(token) ); } @@ -7494,10 +7797,10 @@ } return ( - token.type === TYPE$6.RightParenthesis || - token.type === TYPE$6.RightSquareBracket || - token.type === TYPE$6.RightCurlyBracket || - token.type === TYPE$6.Delim + token.type === TYPE$B.RightParenthesis || + token.type === TYPE$B.RightSquareBracket || + token.type === TYPE$B.RightCurlyBracket || + token.type === TYPE$B.Delim ); } @@ -7506,7 +7809,7 @@ do { tokenIndex++; token = tokenIndex < tokens.length ? tokens[tokenIndex] : null; - } while (token !== null && (token.type === TYPE$6.WhiteSpace || token.type === TYPE$6.Comment)); + } while (token !== null && (token.type === TYPE$B.WhiteSpace || token.type === TYPE$B.Comment)); } function getNextToken(offset) { @@ -7634,7 +7937,7 @@ if (token !== null) { // doesn't mismatch if just one token left and it's an IE hack if (tokenIndex !== tokens.length - 1 || (token.value !== '\\0' && token.value !== '\\9')) { - state = MISMATCH$1; + state = MISMATCH; break; } } @@ -7648,12 +7951,12 @@ state = thenStack.nextState; // check match is not empty - if (state === DISALLOW_EMPTY$1) { + if (state === DISALLOW_EMPTY) { if (thenStack.matchStack === matchStack) { - state = MISMATCH$1; + state = MISMATCH; break; } else { - state = MATCH$1; + state = MATCH; } } @@ -7703,11 +8006,11 @@ case 'If': // IMPORTANT: else stack push must go first, // since it stores the state of thenStack before changes - if (state.else !== MISMATCH$1) { + if (state.else !== MISMATCH) { pushElseStack(state.else); } - if (state.then !== MATCH$1) { + if (state.then !== MATCH) { pushThenStack(state.then); } @@ -7729,18 +8032,18 @@ if (state.index === terms.length) { // no matches at all or it's required all terms to be matched if (state.mask === 0 || state.syntax.all) { - state = MISMATCH$1; + state = MISMATCH; break; } // a partial match is ok - state = MATCH$1; + state = MATCH; break; } // all terms are matched if (state.mask === (1 << terms.length) - 1) { - state = MATCH$1; + state = MATCH; break; } @@ -7782,13 +8085,13 @@ name = name.replace(/\\[09].*$/, ''); } - if (hasOwnProperty$1.call(state.map, name)) { + if (hasOwnProperty$6.call(state.map, name)) { state = state.map[name]; break; } } - state = MISMATCH$1; + state = MISMATCH; break; case 'Generic': @@ -7800,9 +8103,9 @@ addTokenToMatch(); } - state = MATCH$1; + state = MATCH; } else { - state = MISMATCH$1; + state = MISMATCH; } break; @@ -7810,7 +8113,7 @@ case 'Type': case 'Property': var syntaxDict = state.type === 'Type' ? 'types' : 'properties'; - var dictSyntax = hasOwnProperty$1.call(syntaxes, syntaxDict) ? syntaxes[syntaxDict][state.name] : null; + var dictSyntax = hasOwnProperty$6.call(syntaxes, syntaxDict) ? syntaxes[syntaxDict][state.name] : null; if (!dictSyntax || !dictSyntax.match) { throw new Error( @@ -7827,7 +8130,7 @@ // https://drafts.csswg.org/css-values-4/#custom-idents // When parsing positionally-ambiguous keywords in a property value, a production // can only claim the keyword if no other unfulfilled production can claim it. - (state.name === 'custom-ident' && token.type === TYPE$6.Ident) || + (state.name === 'custom-ident' && token.type === TYPE$B.Ident) || // https://drafts.csswg.org/css-values-4/#lengths // ... if a `0` could be parsed as either a or a in a property (such as line-height), @@ -7839,7 +8142,7 @@ syntaxStash = stateSnapshotFromSyntax(state, elseStack); } - state = MISMATCH$1; + state = MISMATCH; break; } } @@ -7861,45 +8164,45 @@ if (areStringsEqualCaseInsensitive(keywordName, name)) { addTokenToMatch(); - state = MATCH$1; + state = MATCH; break; } } - state = MISMATCH$1; + state = MISMATCH; break; case 'AtKeyword': case 'Function': if (token !== null && areStringsEqualCaseInsensitive(token.value, state.name)) { addTokenToMatch(); - state = MATCH$1; + state = MATCH; break; } - state = MISMATCH$1; + state = MISMATCH; break; case 'Token': if (token !== null && token.value === state.value) { addTokenToMatch(); - state = MATCH$1; + state = MATCH; break; } - state = MISMATCH$1; + state = MISMATCH; break; case 'Comma': - if (token !== null && token.type === TYPE$6.Comma) { + if (token !== null && token.type === TYPE$B.Comma) { if (isCommaContextStart(matchStack.token)) { - state = MISMATCH$1; + state = MISMATCH; } else { addTokenToMatch(); - state = isCommaContextEnd(token) ? MISMATCH$1 : MATCH$1; + state = isCommaContextEnd(token) ? MISMATCH : MATCH; } } else { - state = isCommaContextStart(matchStack.token) || isCommaContextEnd(token) ? MATCH$1 : MISMATCH$1; + state = isCommaContextStart(matchStack.token) || isCommaContextEnd(token) ? MATCH : MISMATCH; } break; @@ -7916,9 +8219,9 @@ addTokenToMatch(); } - state = MATCH$1; + state = MATCH; } else { - state = MISMATCH$1; + state = MISMATCH; } break; @@ -7992,7 +8295,7 @@ return matchResult; } - function matchAsTree(tokens, matchGraph, syntaxes) { + function matchAsTree$1(tokens, matchGraph, syntaxes) { var matchResult = internalMatch(tokens, matchGraph, syntaxes || {}); if (matchResult.match === null) { @@ -8041,7 +8344,7 @@ var match = { matchAsList: matchAsList, - matchAsTree: matchAsTree, + matchAsTree: matchAsTree$1, getTotalIterationCount: function() { return totalIterationCount; } @@ -8120,13 +8423,15 @@ }); } - var trace = { + var trace$1 = { getTrace: getTrace, isType: isType, isProperty: isProperty, isKeyword: isKeyword }; + var List$5 = List_1; + function getFirstMatchNode(matchNode) { if ('node' in matchNode) { return matchNode.node; @@ -8153,7 +8458,7 @@ lexer.syntax.walk(ast, function(node, item, list) { if (node === start) { - var nodes = new List_1(); + var nodes = new List$5(); do { nodes.appendData(item.data); @@ -8187,11 +8492,12 @@ return fragments; } - var search = { + var search$1 = { matchFragments: matchFragments }; - var hasOwnProperty$2 = Object.prototype.hasOwnProperty; + var List$4 = List_1; + var hasOwnProperty$5 = Object.prototype.hasOwnProperty; function isValidNumber(value) { // Number.isInteger(value) && value >= 0 @@ -8221,7 +8527,7 @@ for (var key in node) { var valid = true; - if (hasOwnProperty$2.call(node, key) === false) { + if (hasOwnProperty$5.call(node, key) === false) { continue; } @@ -8266,7 +8572,7 @@ if (typeof fieldType === 'string') { valid = node[key] && node[key].type === fieldType; } else if (Array.isArray(fieldType)) { - valid = node[key] instanceof List_1; + valid = node[key] instanceof List$4; } } } @@ -8280,8 +8586,8 @@ } for (var key in fields) { - if (hasOwnProperty$2.call(fields, key) && - hasOwnProperty$2.call(node, key) === false) { + if (hasOwnProperty$5.call(fields, key) && + hasOwnProperty$5.call(node, key) === false) { warn(node, 'Field `' + type + '.' + key + '` is missed'); } } @@ -8299,7 +8605,7 @@ }; for (var key in structure) { - if (hasOwnProperty$2.call(structure, key) === false) { + if (hasOwnProperty$5.call(structure, key) === false) { continue; } @@ -8338,7 +8644,7 @@ if (config.node) { for (var name in config.node) { - if (hasOwnProperty$2.call(config.node, name)) { + if (hasOwnProperty$5.call(config.node, name)) { var nodeType = config.node[name]; if (nodeType.structure) { @@ -8354,21 +8660,21 @@ } }; - var SyntaxReferenceError$1 = error.SyntaxReferenceError; - var MatchError$1 = error.MatchError; - - - - - - - var buildMatchGraph$1 = matchGraph.buildMatchGraph; - var matchAsTree$1 = match.matchAsTree; - - + var SyntaxReferenceError = error.SyntaxReferenceError; + var SyntaxMatchError = error.SyntaxMatchError; + var names$1 = names$2; + var generic = generic$1; + var parse = parse_1; + var generate = generate_1; + var walk = walk$1; + var prepareTokens = prepareTokens_1; + var buildMatchGraph = matchGraph$1.buildMatchGraph; + var matchAsTree = match.matchAsTree; + var trace = trace$1; + var search = search$1; var getStructureFromConfig = structure.getStructureFromConfig; - var cssWideKeywords$1 = buildMatchGraph$1('inherit | initial | unset'); - var cssWideKeywordsWithExpression = buildMatchGraph$1('inherit | initial | unset | <-ms-legacy-expression>'); + var cssWideKeywords = buildMatchGraph('inherit | initial | unset'); + var cssWideKeywordsWithExpression = buildMatchGraph('inherit | initial | unset | <-ms-legacy-expression>'); function dumpMapSyntax(map, compact, syntaxAsAst) { var result = {}; @@ -8377,13 +8683,30 @@ if (map[name].syntax) { result[name] = syntaxAsAst ? map[name].syntax - : generate_1(map[name].syntax, { compact: compact }); + : generate(map[name].syntax, { compact: compact }); } } return result; } + function dumpAtruleMapSyntax(map, compact, syntaxAsAst) { + const result = {}; + + for (const [name, atrule] of Object.entries(map)) { + result[name] = { + prelude: atrule.prelude && ( + syntaxAsAst + ? atrule.prelude.syntax + : generate(atrule.prelude.syntax, { compact }) + ), + descriptors: atrule.descriptors && dumpMapSyntax(atrule.descriptors, compact, syntaxAsAst) + }; + } + + return result; + } + function valueHasVar(tokens) { for (var i = 0; i < tokens.length; i++) { if (tokens[i].value.toLowerCase() === 'var(') { @@ -8407,7 +8730,7 @@ } function matchSyntax(lexer, syntax, value, useCommon) { - var tokens = prepareTokens_1(value, lexer.syntax); + var tokens = prepareTokens(value, lexer.syntax); var result; if (valueHasVar(tokens)) { @@ -8415,15 +8738,15 @@ } if (useCommon) { - result = matchAsTree$1(tokens, lexer.valueCommonSyntax, lexer); + result = matchAsTree(tokens, lexer.valueCommonSyntax, lexer); } if (!useCommon || !result.match) { - result = matchAsTree$1(tokens, syntax.match, lexer); + result = matchAsTree(tokens, syntax.match, lexer); if (!result.match) { return buildMatchResult( null, - new MatchError$1(result.reason, syntax.syntax, value, result), + new SyntaxMatchError(result.reason, syntax.syntax, value, result), result.iterations ); } @@ -8432,8 +8755,8 @@ return buildMatchResult(result.match, null, result.iterations); } - var Lexer = function(config, syntax, structure) { - this.valueCommonSyntax = cssWideKeywords$1; + var Lexer$1 = function(config, syntax, structure) { + this.valueCommonSyntax = cssWideKeywords; this.syntax = syntax; this.generic = false; this.atrules = {}; @@ -8469,7 +8792,7 @@ } }; - Lexer.prototype = { + Lexer$1.prototype = { structure: {}, checkStructure: function(ast) { function collectWarning(node, message) { @@ -8493,7 +8816,7 @@ return warns.length ? warns : false; }, - createDescriptor: function(syntax, type, name) { + createDescriptor: function(syntax, type, name, parent = null) { var ref = { type: type, name: name @@ -8501,19 +8824,20 @@ var descriptor = { type: type, name: name, + parent: parent, syntax: null, match: null }; if (typeof syntax === 'function') { - descriptor.match = buildMatchGraph$1(syntax, ref); + descriptor.match = buildMatchGraph(syntax, ref); } else { if (typeof syntax === 'string') { // lazy parsing on first access Object.defineProperty(descriptor, 'syntax', { get: function() { Object.defineProperty(descriptor, 'syntax', { - value: parse_1(syntax) + value: parse(syntax) }); return descriptor.syntax; @@ -8527,7 +8851,7 @@ Object.defineProperty(descriptor, 'match', { get: function() { Object.defineProperty(descriptor, 'match', { - value: buildMatchGraph$1(descriptor.syntax, ref) + value: buildMatchGraph(descriptor.syntax, ref) }); return descriptor.match; @@ -8538,20 +8862,34 @@ return descriptor; }, addAtrule_: function(name, syntax) { + if (!syntax) { + return; + } + this.atrules[name] = { + type: 'Atrule', + name: name, prelude: syntax.prelude ? this.createDescriptor(syntax.prelude, 'AtrulePrelude', name) : null, descriptors: syntax.descriptors - ? Object.keys(syntax.descriptors).reduce((res, name) => { - res[name] = this.createDescriptor(syntax.descriptors[name], 'AtruleDescriptor', name); + ? Object.keys(syntax.descriptors).reduce((res, descName) => { + res[descName] = this.createDescriptor(syntax.descriptors[descName], 'AtruleDescriptor', descName, name); return res; }, {}) : null }; }, addProperty_: function(name, syntax) { + if (!syntax) { + return; + } + this.properties[name] = this.createDescriptor(syntax, 'Property', name); }, addType_: function(name, syntax) { + if (!syntax) { + return; + } + this.types[name] = this.createDescriptor(syntax, 'Type', name); if (syntax === generic['-ms-legacy-expression']) { @@ -8559,48 +8897,84 @@ } }, - matchAtrulePrelude: function(atruleName, prelude) { - var atrule = names.keyword(atruleName); + checkAtruleName: function(atruleName) { + if (!this.getAtrule(atruleName)) { + return new SyntaxReferenceError('Unknown at-rule', '@' + atruleName); + } + }, + checkAtrulePrelude: function(atruleName, prelude) { + let error = this.checkAtruleName(atruleName); - var atrulePreludeSyntax = atrule.vendor - ? this.getAtrulePrelude(atrule.name) || this.getAtrulePrelude(atrule.basename) - : this.getAtrulePrelude(atrule.name); - - if (!atrulePreludeSyntax) { - if (atrule.basename in this.atrules) { - return buildMatchResult(null, new Error('At-rule `' + atruleName + '` should not contain a prelude')); - } - - return buildMatchResult(null, new SyntaxReferenceError$1('Unknown at-rule', atruleName)); + if (error) { + return error; } - return matchSyntax(this, atrulePreludeSyntax, prelude, true); + var atrule = this.getAtrule(atruleName); + + if (!atrule.prelude && prelude) { + return new SyntaxError('At-rule `@' + atruleName + '` should not contain a prelude'); + } + + if (atrule.prelude && !prelude) { + return new SyntaxError('At-rule `@' + atruleName + '` should contain a prelude'); + } + }, + checkAtruleDescriptorName: function(atruleName, descriptorName) { + let error = this.checkAtruleName(atruleName); + + if (error) { + return error; + } + + var atrule = this.getAtrule(atruleName); + var descriptor = names$1.keyword(descriptorName); + + if (!atrule.descriptors) { + return new SyntaxError('At-rule `@' + atruleName + '` has no known descriptors'); + } + + if (!atrule.descriptors[descriptor.name] && + !atrule.descriptors[descriptor.basename]) { + return new SyntaxReferenceError('Unknown at-rule descriptor', descriptorName); + } + }, + checkPropertyName: function(propertyName) { + var property = names$1.property(propertyName); + + // don't match syntax for a custom property + if (property.custom) { + return new Error('Lexer matching doesn\'t applicable for custom properties'); + } + + if (!this.getProperty(propertyName)) { + return new SyntaxReferenceError('Unknown property', propertyName); + } + }, + + matchAtrulePrelude: function(atruleName, prelude) { + var error = this.checkAtrulePrelude(atruleName, prelude); + + if (error) { + return buildMatchResult(null, error); + } + + if (!prelude) { + return buildMatchResult(null, null); + } + + return matchSyntax(this, this.getAtrule(atruleName).prelude, prelude, false); }, matchAtruleDescriptor: function(atruleName, descriptorName, value) { - var atrule = names.keyword(atruleName); - var descriptor = names.keyword(descriptorName); + var error = this.checkAtruleDescriptorName(atruleName, descriptorName); - var atruleEntry = atrule.vendor - ? this.atrules[atrule.name] || this.atrules[atrule.basename] - : this.atrules[atrule.name]; - - if (!atruleEntry) { - return buildMatchResult(null, new SyntaxReferenceError$1('Unknown at-rule', atruleName)); + if (error) { + return buildMatchResult(null, error); } - if (!atruleEntry.descriptors) { - return buildMatchResult(null, new Error('At-rule `' + atruleName + '` has no known descriptors')); - } + var atrule = this.getAtrule(atruleName); + var descriptor = names$1.keyword(descriptorName); - var atruleDescriptorSyntax = descriptor.vendor - ? atruleEntry.descriptors[descriptor.name] || atruleEntry.descriptors[descriptor.basename] - : atruleEntry.descriptors[descriptor.name]; - - if (!atruleDescriptorSyntax) { - return buildMatchResult(null, new SyntaxReferenceError$1('Unknown at-rule descriptor', descriptorName)); - } - - return matchSyntax(this, atruleDescriptorSyntax, value, true); + return matchSyntax(this, atrule.descriptors[descriptor.name] || atrule.descriptors[descriptor.basename], value, false); }, matchDeclaration: function(node) { if (node.type !== 'Declaration') { @@ -8610,35 +8984,26 @@ return this.matchProperty(node.property, node.value); }, matchProperty: function(propertyName, value) { - var property = names.property(propertyName); + var error = this.checkPropertyName(propertyName); - // don't match syntax for a custom property - if (property.custom) { - return buildMatchResult(null, new Error('Lexer matching doesn\'t applicable for custom properties')); + if (error) { + return buildMatchResult(null, error); } - var propertySyntax = property.vendor - ? this.getProperty(property.name) || this.getProperty(property.basename) - : this.getProperty(property.name); - - if (!propertySyntax) { - return buildMatchResult(null, new SyntaxReferenceError$1('Unknown property', propertyName)); - } - - return matchSyntax(this, propertySyntax, value, true); + return matchSyntax(this, this.getProperty(propertyName), value, true); }, matchType: function(typeName, value) { var typeSyntax = this.getType(typeName); if (!typeSyntax) { - return buildMatchResult(null, new SyntaxReferenceError$1('Unknown type', typeName)); + return buildMatchResult(null, new SyntaxReferenceError('Unknown type', typeName)); } return matchSyntax(this, typeSyntax, value, false); }, match: function(syntax, value) { if (typeof syntax !== 'string' && (!syntax || !syntax.type)) { - return buildMatchResult(null, new SyntaxReferenceError$1('Bad syntax')); + return buildMatchResult(null, new SyntaxReferenceError('Bad syntax')); } if (typeof syntax === 'string' || !syntax.match) { @@ -8667,16 +9032,31 @@ return result; }, - getAtrulePrelude: function(atruleName) { - return this.atrules.hasOwnProperty(atruleName) ? this.atrules[atruleName].prelude : null; + getAtrule: function(atruleName, fallbackBasename = true) { + var atrule = names$1.keyword(atruleName); + var atruleEntry = atrule.vendor && fallbackBasename + ? this.atrules[atrule.name] || this.atrules[atrule.basename] + : this.atrules[atrule.name]; + + return atruleEntry || null; + }, + getAtrulePrelude: function(atruleName, fallbackBasename = true) { + const atrule = this.getAtrule(atruleName, fallbackBasename); + + return atrule && atrule.prelude || null; }, getAtruleDescriptor: function(atruleName, name) { return this.atrules.hasOwnProperty(atruleName) && this.atrules.declarators ? this.atrules[atruleName].declarators[name] || null : null; }, - getProperty: function(name) { - return this.properties.hasOwnProperty(name) ? this.properties[name] : null; + getProperty: function(propertyName, fallbackBasename = true) { + var property = names$1.property(propertyName); + var propertyEntry = property.vendor && fallbackBasename + ? this.properties[property.name] || this.properties[property.basename] + : this.properties[property.name]; + + return propertyEntry || null; }, getType: function(name) { return this.types.hasOwnProperty(name) ? this.types[name] : null; @@ -8690,7 +9070,7 @@ broken[name] = false; if (descriptor.syntax !== null) { - walk$1(descriptor.syntax, function(node) { + walk(descriptor.syntax, function(node) { if (node.type !== 'Type' && node.type !== 'Property') { return; } @@ -8736,7 +9116,8 @@ return { generic: this.generic, types: dumpMapSyntax(this.types, !pretty, syntaxAsAst), - properties: dumpMapSyntax(this.properties, !pretty, syntaxAsAst) + properties: dumpMapSyntax(this.properties, !pretty, syntaxAsAst), + atrules: dumpAtruleMapSyntax(this.atrules, !pretty, syntaxAsAst) }; }, toString: function() { @@ -8744,20 +9125,21 @@ } }; - var Lexer_1 = Lexer; + var Lexer_1 = Lexer$1; - var definitionSyntax = { - SyntaxError: _SyntaxError$1, + var definitionSyntax$1 = { + SyntaxError: _SyntaxError, parse: parse_1, generate: generate_1, walk: walk$1 }; - var isBOM$2 = tokenizer.isBOM; + var adoptBuffer = adoptBuffer$2; + var isBOM = tokenizer$3.isBOM; - var N$3 = 10; - var F$2 = 12; - var R$2 = 13; + var N$1 = 10; + var F = 12; + var R = 13; function computeLinesAndColumns(host, source) { var sourceLength = source.length; @@ -8765,7 +9147,7 @@ var line = host.startLine; var columns = adoptBuffer(host.columns, sourceLength); var column = host.startColumn; - var startOffset = source.length > 0 ? isBOM$2(source.charCodeAt(0)) : 0; + var startOffset = source.length > 0 ? isBOM(source.charCodeAt(0)) : 0; for (var i = startOffset; i < sourceLength; i++) { // -1 var code = source.charCodeAt(i); @@ -8773,8 +9155,8 @@ lines[i] = line; columns[i] = column++; - if (code === N$3 || code === R$2 || code === F$2) { - if (code === R$2 && i + 1 < sourceLength && source.charCodeAt(i + 1) === N$3) { + if (code === N$1 || code === R || code === F) { + if (code === R && i + 1 < sourceLength && source.charCodeAt(i + 1) === N$1) { i++; lines[i] = line; columns[i] = column; @@ -8792,13 +9174,13 @@ host.columns = columns; } - var OffsetToLocation = function() { + var OffsetToLocation$1 = function() { this.lines = null; this.columns = null; this.linesAndColumnsComputed = false; }; - OffsetToLocation.prototype = { + OffsetToLocation$1.prototype = { setSource: function(source, startOffset, startLine, startColumn) { this.source = source; this.startOffset = typeof startOffset === 'undefined' ? 0 : startOffset; @@ -8842,13 +9224,13 @@ } }; - var OffsetToLocation_1 = OffsetToLocation; + var OffsetToLocation_1 = OffsetToLocation$1; - var TYPE$7 = tokenizer.TYPE; - var WHITESPACE$2 = TYPE$7.WhiteSpace; - var COMMENT$2 = TYPE$7.Comment; + var TYPE$A = tokenizer$3.TYPE; + var WHITESPACE$a = TYPE$A.WhiteSpace; + var COMMENT$8 = TYPE$A.Comment; - var sequence = function readSequence(recognizer) { + var sequence$1 = function readSequence(recognizer) { var children = this.createList(); var child = null; var context = { @@ -8862,11 +9244,11 @@ while (!this.scanner.eof) { switch (this.scanner.tokenType) { - case COMMENT$2: + case COMMENT$8: this.scanner.next(); continue; - case WHITESPACE$2: + case WHITESPACE$a: if (context.ignoreWS) { this.scanner.next(); } else { @@ -8899,20 +9281,27 @@ return children; }; - var findWhiteSpaceStart$1 = utils.findWhiteSpaceStart; + var OffsetToLocation = OffsetToLocation_1; + var SyntaxError$2 = _SyntaxError$1; + var TokenStream$1 = TokenStream_1; + var List$3 = List_1; + var tokenize$1 = tokenizer$3; + var constants = _const; + var { findWhiteSpaceStart, cmpStr: cmpStr$2 } = utils$2; + var sequence = sequence$1; + var noop$1 = function() {}; - var noop$3 = function() {}; - - var TYPE$8 = _const.TYPE; - var NAME$2 = _const.NAME; - var WHITESPACE$3 = TYPE$8.WhiteSpace; - var IDENT$2 = TYPE$8.Ident; - var FUNCTION = TYPE$8.Function; - var URL$1 = TYPE$8.Url; - var HASH = TYPE$8.Hash; - var PERCENTAGE = TYPE$8.Percentage; - var NUMBER$2 = TYPE$8.Number; - var NUMBERSIGN$1 = 0x0023; // U+0023 NUMBER SIGN (#) + var TYPE$z = constants.TYPE; + var NAME$1 = constants.NAME; + var WHITESPACE$9 = TYPE$z.WhiteSpace; + var COMMENT$7 = TYPE$z.Comment; + var IDENT$g = TYPE$z.Ident; + var FUNCTION$6 = TYPE$z.Function; + var URL$4 = TYPE$z.Url; + var HASH$5 = TYPE$z.Hash; + var PERCENTAGE$3 = TYPE$z.Percentage; + var NUMBER$7 = TYPE$z.Number; + var NUMBERSIGN$3 = 0x0023; // U+0023 NUMBER SIGN (#) var NULL = 0; function createParseContext(name) { @@ -8978,14 +9367,14 @@ return parserConfig; } - var create$1 = function createParser(config) { + var create$4 = function createParser(config) { var parser = { - scanner: new TokenStream_1(), - locationMap: new OffsetToLocation_1(), + scanner: new TokenStream$1(), + locationMap: new OffsetToLocation(), filename: '', needPositions: false, - onParseError: noop$3, + onParseError: noop$1, onParseErrorThrow: false, parseAtrulePrelude: true, parseRulePrelude: true, @@ -8995,10 +9384,10 @@ readSequence: sequence, createList: function() { - return new List_1(); + return new List$3(); }, createSingleNodeList: function(node) { - return new List_1().appendData(node); + return new List$3().appendData(node); }, getFirstListNode: function(list) { return list && list.first(); @@ -9030,7 +9419,7 @@ lookupNonWSType: function(offset) { do { var type = this.scanner.lookupType(offset++); - if (type !== WHITESPACE$3) { + if (type !== WHITESPACE$9) { return type; } } while (type !== NULL); @@ -9041,13 +9430,13 @@ eat: function(tokenType) { if (this.scanner.tokenType !== tokenType) { var offset = this.scanner.tokenStart; - var message = NAME$2[tokenType] + ' is expected'; + var message = NAME$1[tokenType] + ' is expected'; // tweak message and offset switch (tokenType) { - case IDENT$2: + case IDENT$g: // when identifier is expected but there is a function or url - if (this.scanner.tokenType === FUNCTION || this.scanner.tokenType === URL$1) { + if (this.scanner.tokenType === FUNCTION$6 || this.scanner.tokenType === URL$4) { offset = this.scanner.tokenEnd - 1; message = 'Identifier is expected but function found'; } else { @@ -9055,16 +9444,16 @@ } break; - case HASH: - if (this.scanner.isDelim(NUMBERSIGN$1)) { + case HASH$5: + if (this.scanner.isDelim(NUMBERSIGN$3)) { this.scanner.next(); offset++; message = 'Name is expected'; } break; - case PERCENTAGE: - if (this.scanner.tokenType === NUMBER$2) { + case PERCENTAGE$3: + if (this.scanner.tokenType === NUMBER$7) { offset = this.scanner.tokenEnd; message = 'Percent sign is expected'; } @@ -9094,7 +9483,7 @@ consumeFunctionName: function() { var name = this.scanner.source.substring(this.scanner.tokenStart, this.scanner.tokenEnd - 1); - this.eat(FUNCTION); + this.eat(FUNCTION$6); return name; }, @@ -9128,10 +9517,10 @@ var location = typeof offset !== 'undefined' && offset < this.scanner.source.length ? this.locationMap.getLocation(offset) : this.scanner.eof - ? this.locationMap.getLocation(findWhiteSpaceStart$1(this.scanner.source, this.scanner.source.length - 1)) + ? this.locationMap.getLocation(findWhiteSpaceStart(this.scanner.source, this.scanner.source.length - 1)) : this.locationMap.getLocation(this.scanner.tokenStart); - throw new _SyntaxError( + throw new SyntaxError$2( message || 'Unexpected input', this.scanner.source, location.offset, @@ -9150,9 +9539,10 @@ options = options || {}; var context = options.context || 'default'; + var onComment = options.onComment; var ast; - tokenizer(source, parser.scanner); + tokenize$1(source, parser.scanner); parser.locationMap.setSource( source, options.offset, @@ -9162,7 +9552,7 @@ parser.filename = options.filename || ''; parser.needPositions = Boolean(options.positions); - parser.onParseError = typeof options.onParseError === 'function' ? options.onParseError : noop$3; + parser.onParseError = typeof options.onParseError === 'function' ? options.onParseError : noop$1; parser.onParseErrorThrow = false; parser.parseAtrulePrelude = 'parseAtrulePrelude' in options ? Boolean(options.parseAtrulePrelude) : true; parser.parseRulePrelude = 'parseRulePrelude' in options ? Boolean(options.parseRulePrelude) : true; @@ -9173,6 +9563,19 @@ throw new Error('Unknown context `' + context + '`'); } + if (typeof onComment === 'function') { + parser.scanner.forEachToken((type, start, end) => { + if (type === COMMENT$7) { + const loc = parser.getLocation(start, end); + const value = cmpStr$2(source, end - 2, end, '*/') + ? source.slice(start + 2, end - 2) + : source.slice(start + 2, end); + + onComment(value, loc); + } + }); + } + ast = parser.context[context].call(parser, options); if (!parser.scanner.eof) { @@ -9183,7 +9586,14 @@ }; }; + var sourceMapGenerator = {}; + + var base64Vlq = {}; + + var base64$1 = {}; + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: @@ -9195,7 +9605,7 @@ /** * Encode an integer in the range of 0 to 63 to a single base 64 digit. */ - var encode = function (number) { + base64$1.encode = function (number) { if (0 <= number && number < intToCharMap.length) { return intToCharMap[number]; } @@ -9206,7 +9616,7 @@ * Decode a single base 64 character code digit to an integer. Returns -1 on * failure. */ - var decode = function (charCode) { + base64$1.decode = function (charCode) { var bigA = 65; // 'A' var bigZ = 90; // 'Z' @@ -9251,12 +9661,8 @@ return -1; }; - var base64 = { - encode: encode, - decode: decode - }; - /* -*- Mode: js; js-indent-level: 2; -*- */ + /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: @@ -9293,7 +9699,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + var base64 = base64$1; // A single base 64 digit can contain 6 bits of data. For the base 64 variable // length quantities we use in the source map spec, the first bit is the sign, @@ -9347,7 +9753,7 @@ /** * Returns the base 64 VLQ encoded value. */ - var encode$1 = function base64VLQ_encode(aValue) { + base64Vlq.encode = function base64VLQ_encode(aValue) { var encoded = ""; var digit; @@ -9371,7 +9777,7 @@ * Decodes the next base 64 VLQ value from the given string and returns the * value and the rest of the string via the out parameter. */ - var decode$1 = function base64VLQ_decode(aStr, aIndex, aOutParam) { + base64Vlq.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { var strLen = aStr.length; var result = 0; var shift = 0; @@ -9397,13 +9803,11 @@ aOutParam.rest = aIndex; }; - var base64Vlq = { - encode: encode$1, - decode: decode$1 - }; + var util$3 = {}; - var util = createCommonjsModule(function (module, exports) { /* -*- Mode: js; js-indent-level: 2; -*- */ + + (function (exports) { /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: @@ -9891,31 +10295,20 @@ return normalize(sourceURL); } exports.computeSourceURL = computeSourceURL; - }); - var util_1 = util.getArg; - var util_2 = util.urlParse; - var util_3 = util.urlGenerate; - var util_4 = util.normalize; - var util_5 = util.join; - var util_6 = util.isAbsolute; - var util_7 = util.relative; - var util_8 = util.toSetString; - var util_9 = util.fromSetString; - var util_10 = util.compareByOriginalPositions; - var util_11 = util.compareByGeneratedPositionsDeflated; - var util_12 = util.compareByGeneratedPositionsInflated; - var util_13 = util.parseSourceMapInput; - var util_14 = util.computeSourceURL; + }(util$3)); + + var arraySet = {}; /* -*- Mode: js; js-indent-level: 2; -*- */ + /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause */ - - var has = Object.prototype.hasOwnProperty; + var util$2 = util$3; + var has$1 = Object.prototype.hasOwnProperty; var hasNativeMap = typeof Map !== "undefined"; /** @@ -9924,7 +10317,7 @@ * element is O(1). Removing elements from the set is not supported. Only * strings are supported for membership. */ - function ArraySet() { + function ArraySet$1() { this._array = []; this._set = hasNativeMap ? new Map() : Object.create(null); } @@ -9932,8 +10325,8 @@ /** * Static method for creating ArraySet instances from an existing array. */ - ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); + ArraySet$1.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { + var set = new ArraySet$1(); for (var i = 0, len = aArray.length; i < len; i++) { set.add(aArray[i], aAllowDuplicates); } @@ -9946,7 +10339,7 @@ * * @returns Number */ - ArraySet.prototype.size = function ArraySet_size() { + ArraySet$1.prototype.size = function ArraySet_size() { return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; }; @@ -9955,9 +10348,9 @@ * * @param String aStr */ - ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var sStr = hasNativeMap ? aStr : util.toSetString(aStr); - var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + ArraySet$1.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { + var sStr = hasNativeMap ? aStr : util$2.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has$1.call(this._set, sStr); var idx = this._array.length; if (!isDuplicate || aAllowDuplicates) { this._array.push(aStr); @@ -9976,12 +10369,12 @@ * * @param String aStr */ - ArraySet.prototype.has = function ArraySet_has(aStr) { + ArraySet$1.prototype.has = function ArraySet_has(aStr) { if (hasNativeMap) { return this._set.has(aStr); } else { - var sStr = util.toSetString(aStr); - return has.call(this._set, sStr); + var sStr = util$2.toSetString(aStr); + return has$1.call(this._set, sStr); } }; @@ -9990,15 +10383,15 @@ * * @param String aStr */ - ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + ArraySet$1.prototype.indexOf = function ArraySet_indexOf(aStr) { if (hasNativeMap) { var idx = this._set.get(aStr); if (idx >= 0) { return idx; } } else { - var sStr = util.toSetString(aStr); - if (has.call(this._set, sStr)) { + var sStr = util$2.toSetString(aStr); + if (has$1.call(this._set, sStr)) { return this._set[sStr]; } } @@ -10011,7 +10404,7 @@ * * @param Number aIdx */ - ArraySet.prototype.at = function ArraySet_at(aIdx) { + ArraySet$1.prototype.at = function ArraySet_at(aIdx) { if (aIdx >= 0 && aIdx < this._array.length) { return this._array[aIdx]; } @@ -10023,24 +10416,23 @@ * indicated by indexOf). Note that this is a copy of the internal array used * for storing the members so that no one can mess with internal state. */ - ArraySet.prototype.toArray = function ArraySet_toArray() { + ArraySet$1.prototype.toArray = function ArraySet_toArray() { return this._array.slice(); }; - var ArraySet_1 = ArraySet; + arraySet.ArraySet = ArraySet$1; - var arraySet = { - ArraySet: ArraySet_1 - }; + var mappingList = {}; /* -*- Mode: js; js-indent-level: 2; -*- */ + /* * Copyright 2014 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause */ - + var util$1 = util$3; /** * Determine whether mappingB is after mappingA with respect to generated @@ -10053,7 +10445,7 @@ var columnA = mappingA.generatedColumn; var columnB = mappingB.generatedColumn; return lineB > lineA || lineB == lineA && columnB >= columnA || - util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; + util$1.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; } /** @@ -10061,7 +10453,7 @@ * performance conscious manner. It trades a neglibable overhead in general * case for a large speedup in case of mappings being added in order. */ - function MappingList() { + function MappingList$1() { this._array = []; this._sorted = true; // Serves as infimum @@ -10074,7 +10466,7 @@ * * NOTE: The order of the mappings is NOT guaranteed. */ - MappingList.prototype.unsortedForEach = + MappingList$1.prototype.unsortedForEach = function MappingList_forEach(aCallback, aThisArg) { this._array.forEach(aCallback, aThisArg); }; @@ -10084,7 +10476,7 @@ * * @param Object aMapping */ - MappingList.prototype.add = function MappingList_add(aMapping) { + MappingList$1.prototype.add = function MappingList_add(aMapping) { if (generatedPositionAfter(this._last, aMapping)) { this._last = aMapping; this._array.push(aMapping); @@ -10103,31 +10495,28 @@ * an immutable borrow. If you want to take ownership, you must make your own * copy. */ - MappingList.prototype.toArray = function MappingList_toArray() { + MappingList$1.prototype.toArray = function MappingList_toArray() { if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); + this._array.sort(util$1.compareByGeneratedPositionsInflated); this._sorted = true; } return this._array; }; - var MappingList_1 = MappingList; - - var mappingList = { - MappingList: MappingList_1 - }; + mappingList.MappingList = MappingList$1; /* -*- Mode: js; js-indent-level: 2; -*- */ + /* * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause */ - - - var ArraySet$1 = arraySet.ArraySet; - var MappingList$1 = mappingList.MappingList; + var base64VLQ = base64Vlq; + var util = util$3; + var ArraySet = arraySet.ArraySet; + var MappingList = mappingList.MappingList; /** * An instance of the SourceMapGenerator represents a source map which is @@ -10137,30 +10526,30 @@ * - file: The filename of the generated source. * - sourceRoot: A root for all relative URLs in this source map. */ - function SourceMapGenerator(aArgs) { + function SourceMapGenerator$1(aArgs) { if (!aArgs) { aArgs = {}; } this._file = util.getArg(aArgs, 'file', null); this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); this._skipValidation = util.getArg(aArgs, 'skipValidation', false); - this._sources = new ArraySet$1(); - this._names = new ArraySet$1(); - this._mappings = new MappingList$1(); + this._sources = new ArraySet(); + this._names = new ArraySet(); + this._mappings = new MappingList(); this._sourcesContents = null; } - SourceMapGenerator.prototype._version = 3; + SourceMapGenerator$1.prototype._version = 3; /** * Creates a new SourceMapGenerator based on a SourceMapConsumer * * @param aSourceMapConsumer The SourceMap. */ - SourceMapGenerator.fromSourceMap = + SourceMapGenerator$1.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ + var generator = new SourceMapGenerator$1({ file: aSourceMapConsumer.file, sourceRoot: sourceRoot }); @@ -10218,7 +10607,7 @@ * - source: The original source file (relative to the sourceRoot). * - name: An optional original token name for this mapping. */ - SourceMapGenerator.prototype.addMapping = + SourceMapGenerator$1.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) { var generated = util.getArg(aArgs, 'generated'); var original = util.getArg(aArgs, 'original', null); @@ -10256,7 +10645,7 @@ /** * Set the source content for a source file. */ - SourceMapGenerator.prototype.setSourceContent = + SourceMapGenerator$1.prototype.setSourceContent = function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { var source = aSourceFile; if (this._sourceRoot != null) { @@ -10296,7 +10685,7 @@ * paths. If so, those relative source paths need to be rewritten * relative to the SourceMapGenerator. */ - SourceMapGenerator.prototype.applySourceMap = + SourceMapGenerator$1.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { var sourceFile = aSourceFile; // If aSourceFile is omitted, we will use the file property of the SourceMap @@ -10316,8 +10705,8 @@ } // Applying the SourceMap can add and remove items from the sources and // the names array. - var newSources = new ArraySet$1(); - var newNames = new ArraySet$1(); + var newSources = new ArraySet(); + var newNames = new ArraySet(); // Find mappings for the "sourceFile" this._mappings.unsortedForEach(function (mapping) { @@ -10384,7 +10773,7 @@ * To maintain consistency, we validate that any new mapping being added falls * in to one of these categories. */ - SourceMapGenerator.prototype._validateMapping = + SourceMapGenerator$1.prototype._validateMapping = function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, aName) { // When aOriginal is truthy but has empty values for .line and .column, @@ -10427,7 +10816,7 @@ * Serialize the accumulated mappings in to the stream of base 64 VLQs * specified by the source map format. */ - SourceMapGenerator.prototype._serializeMappings = + SourceMapGenerator$1.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() { var previousGeneratedColumn = 0; var previousGeneratedLine = 1; @@ -10462,27 +10851,27 @@ } } - next += base64Vlq.encode(mapping.generatedColumn + next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn); previousGeneratedColumn = mapping.generatedColumn; if (mapping.source != null) { sourceIdx = this._sources.indexOf(mapping.source); - next += base64Vlq.encode(sourceIdx - previousSource); + next += base64VLQ.encode(sourceIdx - previousSource); previousSource = sourceIdx; // lines are stored 0-based in SourceMap spec version 3 - next += base64Vlq.encode(mapping.originalLine - 1 + next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine); previousOriginalLine = mapping.originalLine - 1; - next += base64Vlq.encode(mapping.originalColumn + next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn); previousOriginalColumn = mapping.originalColumn; if (mapping.name != null) { nameIdx = this._names.indexOf(mapping.name); - next += base64Vlq.encode(nameIdx - previousName); + next += base64VLQ.encode(nameIdx - previousName); previousName = nameIdx; } } @@ -10493,7 +10882,7 @@ return result; }; - SourceMapGenerator.prototype._generateSourcesContent = + SourceMapGenerator$1.prototype._generateSourcesContent = function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { return aSources.map(function (source) { if (!this._sourcesContents) { @@ -10512,7 +10901,7 @@ /** * Externalize the source map. */ - SourceMapGenerator.prototype.toJSON = + SourceMapGenerator$1.prototype.toJSON = function SourceMapGenerator_toJSON() { var map = { version: this._version, @@ -10536,26 +10925,22 @@ /** * Render the source map being generated to a string. */ - SourceMapGenerator.prototype.toString = + SourceMapGenerator$1.prototype.toString = function SourceMapGenerator_toString() { return JSON.stringify(this.toJSON()); }; - var SourceMapGenerator_1 = SourceMapGenerator; + sourceMapGenerator.SourceMapGenerator = SourceMapGenerator$1; - var sourceMapGenerator = { - SourceMapGenerator: SourceMapGenerator_1 - }; - - var SourceMapGenerator$1 = sourceMapGenerator.SourceMapGenerator; + var SourceMapGenerator = sourceMapGenerator.SourceMapGenerator; var trackNodes = { Atrule: true, Selector: true, Declaration: true }; - var sourceMap = function generateSourceMap(handlers) { - var map = new SourceMapGenerator$1(); + var sourceMap$1 = function generateSourceMap(handlers) { + var map = new SourceMapGenerator(); var line = 1; var column = 0; var generated = { @@ -10643,7 +11028,8 @@ return handlers; }; - var hasOwnProperty$3 = Object.prototype.hasOwnProperty; + var sourceMap = sourceMap$1; + var hasOwnProperty$4 = Object.prototype.hasOwnProperty; function processChildren(node, delimeter) { var list = node.children; @@ -10663,9 +11049,9 @@ } } - var create$2 = function createGenerator(config) { + var create$3 = function createGenerator(config) { function processNode(node) { - if (hasOwnProperty$3.call(types, node.type)) { + if (hasOwnProperty$4.call(types, node.type)) { types[node.type].call(this, node); } else { throw new Error('Unknown node type: ' + node.type); @@ -10709,13 +11095,15 @@ }; }; - var create$3 = function createConvertors(walk) { + var List$2 = List_1; + + var create$2 = function createConvertors(walk) { return { fromPlainObject: function(ast) { walk(ast, { enter: function(node) { - if (node.children && node.children instanceof List_1 === false) { - node.children = new List_1().fromArray(node.children); + if (node.children && node.children instanceof List$2 === false) { + node.children = new List$2().fromArray(node.children); } } }); @@ -10725,7 +11113,7 @@ toPlainObject: function(ast) { walk(ast, { leave: function(node) { - if (node.children && node.children instanceof List_1) { + if (node.children && node.children instanceof List$2) { node.children = node.children.toArray(); } } @@ -10736,11 +11124,11 @@ }; }; - var hasOwnProperty$4 = Object.prototype.hasOwnProperty; - var noop$4 = function() {}; + var hasOwnProperty$3 = Object.prototype.hasOwnProperty; + var noop = function() {}; - function ensureFunction$1(value) { - return typeof value === 'function' ? value : noop$4; + function ensureFunction(value) { + return typeof value === 'function' ? value : noop; } function invokeForType(fn, type) { @@ -10756,7 +11144,7 @@ var walkers = []; for (var key in structure) { - if (hasOwnProperty$4.call(structure, key) === false) { + if (hasOwnProperty$3.call(structure, key) === false) { continue; } @@ -10801,7 +11189,7 @@ var types = {}; for (var name in config.node) { - if (hasOwnProperty$4.call(config.node, name)) { + if (hasOwnProperty$3.call(config.node, name)) { var nodeType = config.node[name]; if (!nodeType.structure) { @@ -10824,7 +11212,7 @@ fields.reverse(); } - return function(node, context, walk) { + return function(node, context, walk, walkReducer) { var prevContextValue; if (useContext) { @@ -10838,13 +11226,15 @@ if (!field.nullable || ref) { if (field.type === 'list') { - if (reverse) { - ref.forEachRight(walk); - } else { - ref.forEach(walk); + var breakWalk = reverse + ? ref.reduceRight(walkReducer, false) + : ref.reduce(walkReducer, false); + + if (breakWalk) { + return true; } - } else { - walk(ref); + } else if (walk(ref)) { + return true; } } } @@ -10879,13 +11269,15 @@ }; } - var create$4 = function createWalker(config) { + var create$1 = function createWalker(config) { var types = getTypesFromConfig(config); var iteratorsNatural = {}; var iteratorsReverse = {}; + var breakWalk = Symbol('break-walk'); + var skipNode = Symbol('skip-node'); for (var name in types) { - if (hasOwnProperty$4.call(types, name) && types[name] !== null) { + if (hasOwnProperty$3.call(types, name) && types[name] !== null) { iteratorsNatural[name] = createTypeIterator(types[name], false); iteratorsReverse[name] = createTypeIterator(types[name], true); } @@ -10896,19 +11288,38 @@ var walk = function(root, options) { function walkNode(node, item, list) { - enter.call(context, node, item, list); + var enterRet = enter.call(context, node, item, list); - if (iterators.hasOwnProperty(node.type)) { - iterators[node.type](node, context, walkNode); + if (enterRet === breakWalk) { + debugger; + return true; } - leave.call(context, node, item, list); + if (enterRet === skipNode) { + return false; + } + + if (iterators.hasOwnProperty(node.type)) { + if (iterators[node.type](node, context, walkNode, walkReducer)) { + return true; + } + } + + if (leave.call(context, node, item, list) === breakWalk) { + return true; + } + + return false; } - var enter = noop$4; - var leave = noop$4; + var walkReducer = (ret, data, item, list) => ret || walkNode(data, item, list); + var enter = noop; + var leave = noop; var iterators = iteratorsNatural; var context = { + break: breakWalk, + skip: skipNode, + root: root, stylesheet: null, atrule: null, @@ -10923,8 +11334,8 @@ if (typeof options === 'function') { enter = options; } else if (options) { - enter = ensureFunction$1(options.enter); - leave = ensureFunction$1(options.leave); + enter = ensureFunction(options.enter); + leave = ensureFunction(options.leave); if (options.reverse) { iterators = iteratorsReverse; @@ -10944,26 +11355,23 @@ } } - if (enter === noop$4 && leave === noop$4) { + if (enter === noop && leave === noop) { throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function'); } - // swap handlers in reverse mode to invert visit order - if (options.reverse) { - var tmp = enter; - enter = leave; - leave = tmp; - } - walkNode(root); }; + walk.break = breakWalk; + walk.skip = skipNode; + walk.find = function(ast, fn) { var found = null; walk(ast, function(node, item, list) { - if (found === null && fn.call(this, node, item, list)) { + if (fn.call(this, node, item, list)) { found = node; + return breakWalk; } }); @@ -10976,8 +11384,9 @@ walk(ast, { reverse: true, enter: function(node, item, list) { - if (found === null && fn.call(this, node, item, list)) { + if (fn.call(this, node, item, list)) { found = node; + return breakWalk; } } }); @@ -11000,14 +11409,16 @@ return walk; }; - var clone = function clone(node) { + var List$1 = List_1; + + var clone$1 = function clone(node) { var result = {}; for (var key in node) { var value = node[key]; if (value) { - if (Array.isArray(value) || value instanceof List_1) { + if (Array.isArray(value) || value instanceof List$1) { value = value.map(clone); } else if (value.constructor === Object) { value = clone(value); @@ -11020,84 +11431,138 @@ return result; }; - var hasOwnProperty$5 = Object.prototype.hasOwnProperty; - var shape = { + const hasOwnProperty$2 = Object.prototype.hasOwnProperty; + const shape$1 = { generic: true, - types: {}, - atrules: {}, - properties: {}, - parseContext: {}, - scope: {}, + types: appendOrAssign, + atrules: { + prelude: appendOrAssignOrNull, + descriptors: appendOrAssignOrNull + }, + properties: appendOrAssign, + parseContext: assign, + scope: deepAssign, atrule: ['parse'], pseudo: ['parse'], node: ['name', 'structure', 'parse', 'generate', 'walkContext'] }; - function isObject(value) { + function isObject$2(value) { return value && value.constructor === Object; } function copy(value) { - if (isObject(value)) { - return Object.assign({}, value); - } else { - return value; - } + return isObject$2(value) + ? Object.assign({}, value) + : value; } - function extend(dest, src) { - for (var key in src) { - if (hasOwnProperty$5.call(src, key)) { - if (isObject(dest[key])) { - extend(dest[key], copy(src[key])); + + function assign(dest, src) { + return Object.assign(dest, src); + } + + function deepAssign(dest, src) { + for (const key in src) { + if (hasOwnProperty$2.call(src, key)) { + if (isObject$2(dest[key])) { + deepAssign(dest[key], copy(src[key])); } else { dest[key] = copy(src[key]); } } } + + return dest; } - function mix(dest, src, shape) { - for (var key in shape) { - if (hasOwnProperty$5.call(shape, key) === false) { + function append(a, b) { + if (typeof b === 'string' && /^\s*\|/.test(b)) { + return typeof a === 'string' + ? a + b + : b.replace(/^\s*\|\s*/, ''); + } + + return b || null; + } + + function appendOrAssign(a, b) { + if (typeof b === 'string') { + return append(a, b); + } + + const result = Object.assign({}, a); + for (let key in b) { + if (hasOwnProperty$2.call(b, key)) { + result[key] = append(hasOwnProperty$2.call(a, key) ? a[key] : undefined, b[key]); + } + } + + return result; + } + + function appendOrAssignOrNull(a, b) { + const result = appendOrAssign(a, b); + + return !isObject$2(result) || Object.keys(result).length + ? result + : null; + } + + function mix$1(dest, src, shape) { + for (const key in shape) { + if (hasOwnProperty$2.call(shape, key) === false) { continue; } if (shape[key] === true) { if (key in src) { - if (hasOwnProperty$5.call(src, key)) { + if (hasOwnProperty$2.call(src, key)) { dest[key] = copy(src[key]); } } } else if (shape[key]) { - if (isObject(shape[key])) { - var res = {}; - extend(res, dest[key]); - extend(res, src[key]); - dest[key] = res; + if (typeof shape[key] === 'function') { + const fn = shape[key]; + dest[key] = fn({}, dest[key]); + dest[key] = fn(dest[key] || {}, src[key]); + } else if (isObject$2(shape[key])) { + const result = {}; + + for (let name in dest[key]) { + result[name] = mix$1({}, dest[key][name], shape[key]); + } + + for (let name in src[key]) { + result[name] = mix$1(result[name] || {}, src[key][name], shape[key]); + } + + dest[key] = result; } else if (Array.isArray(shape[key])) { - var res = {}; - var innerShape = shape[key].reduce(function(s, k) { + const res = {}; + const innerShape = shape[key].reduce(function(s, k) { s[k] = true; return s; }, {}); - for (var name in dest[key]) { - if (hasOwnProperty$5.call(dest[key], name)) { - res[name] = {}; - if (dest[key] && dest[key][name]) { - mix(res[name], dest[key][name], innerShape); - } + + for (const [name, value] of Object.entries(dest[key] || {})) { + res[name] = {}; + if (value) { + mix$1(res[name], value, innerShape); } } - for (var name in src[key]) { - if (hasOwnProperty$5.call(src[key], name)) { + + for (const name in src[key]) { + if (hasOwnProperty$2.call(src[key], name)) { if (!res[name]) { res[name] = {}; } + if (src[key] && src[key][name]) { - mix(res[name], src[key][name], innerShape); + mix$1(res[name], src[key][name], innerShape); } } } + dest[key] = res; } } @@ -11105,21 +11570,33 @@ return dest; } - var mix_1 = function(dest, src) { - return mix(dest, src, shape); - }; + var mix_1 = (dest, src) => mix$1(dest, src, shape$1); + + var List = List_1; + var SyntaxError$1 = _SyntaxError$1; + var TokenStream = TokenStream_1; + var Lexer = Lexer_1; + var definitionSyntax = definitionSyntax$1; + var tokenize = tokenizer$3; + var createParser = create$4; + var createGenerator = create$3; + var createConvertor = create$2; + var createWalker = create$1; + var clone = clone$1; + var names = names$2; + var mix = mix_1; function createSyntax(config) { - var parse = create$1(config); - var walk = create$4(config); - var generate = create$2(config); - var convert = create$3(walk); + var parse = createParser(config); + var walk = createWalker(config); + var generate = createGenerator(config); + var convert = createConvertor(walk); var syntax = { - List: List_1, - SyntaxError: _SyntaxError, - TokenStream: TokenStream_1, - Lexer: Lexer_1, + List: List, + SyntaxError: SyntaxError$1, + TokenStream: TokenStream, + Lexer: Lexer, vendorPrefix: names.vendorPrefix, keyword: names.keyword, @@ -11129,10 +11606,10 @@ definitionSyntax: definitionSyntax, lexer: null, createLexer: function(config) { - return new Lexer_1(config, syntax, syntax.lexer.structure); + return new Lexer(config, syntax, syntax.lexer.structure); }, - tokenize: tokenizer, + tokenize: tokenize, parse: parse, walk: walk, generate: generate, @@ -11146,19 +11623,19 @@ toPlainObject: convert.toPlainObject, createSyntax: function(config) { - return createSyntax(mix_1({}, config)); + return createSyntax(mix({}, config)); }, fork: function(extension) { - var base = mix_1({}, config); // copy of config + var base = mix({}, config); // copy of config return createSyntax( typeof extension === 'function' ? extension(base, Object.assign) - : mix_1(base, extension) + : mix(base, extension) ); } }; - syntax.lexer = new Lexer_1({ + syntax.lexer = new Lexer({ generic: true, types: config.types, atrules: config.atrules, @@ -11168,15 +11645,11 @@ return syntax; } - var create_1 = function(config) { - return createSyntax(mix_1({}, config)); + create$5.create = function(config) { + return createSyntax(mix({}, config)); }; - var create$5 = { - create: create_1 - }; - - var atRules = { + var require$$0 = { "@charset": { syntax: "@charset \"\";", groups: [ @@ -11197,7 +11670,7 @@ "additive-symbols": { syntax: "[ && ]#", media: "all", - initial: "N/A", + initial: "n/a (required)", percentages: "no", computed: "asSpecified", order: "orderOfAppearance", @@ -11269,7 +11742,7 @@ symbols: { syntax: "+", media: "all", - initial: "N/A", + initial: "n/a (required)", percentages: "no", computed: "asSpecified", order: "orderOfAppearance", @@ -11476,7 +11949,7 @@ percentages: "no", computed: "asSpecified", order: "uniqueOrder", - status: "experimental" + status: "standard" }, marks: { syntax: "none | [ crop || cross ]", @@ -11488,11 +11961,64 @@ percentages: "no", computed: "asSpecified", order: "orderOfAppearance", - status: "experimental" + status: "standard" + }, + size: { + syntax: "{1,2} | auto | [ || [ portrait | landscape ] ]", + media: [ + "visual", + "paged" + ], + initial: "auto", + percentages: "no", + computed: "asSpecifiedRelativeToAbsoluteLengths", + order: "orderOfAppearance", + status: "standard" } }, status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@page" + }, + "@property": { + syntax: "@property {\n \n}", + interfaces: [ + "CSS", + "CSSPropertyRule" + ], + groups: [ + "CSS Houdini" + ], + descriptors: { + syntax: { + syntax: "", + media: "all", + percentages: "no", + initial: "n/a (required)", + computed: "asSpecified", + order: "uniqueOrder", + status: "experimental" + }, + inherits: { + syntax: "true | false", + media: "all", + percentages: "no", + initial: "auto", + computed: "asSpecified", + order: "uniqueOrder", + status: "experimental" + }, + "initial-value": { + syntax: "", + media: "all", + initial: "n/a (required)", + percentages: "no", + computed: "asSpecified", + order: "uniqueOrder", + status: "experimental" + } + }, + status: "experimental", + mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@property" }, "@supports": { syntax: "@supports {\n \n}", @@ -11633,6 +12159,18 @@ order: "uniqueOrder", status: "standard" }, + "viewport-fit": { + syntax: "auto | contain | cover", + media: [ + "visual", + "continuous" + ], + initial: "auto", + percentages: "no", + computed: "asSpecified", + order: "uniqueOrder", + status: "standard" + }, width: { syntax: "{1,2}", media: [ @@ -11672,11 +12210,6 @@ } }; - var atRules$1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - 'default': atRules - }); - var all = { syntax: "initial | inherit | unset | revert", media: "noPracticalMedia", @@ -11728,7 +12261,7 @@ mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation" }; var appearance = { - syntax: "none | auto | button | textfield | ", + syntax: "none | auto | textfield | menulist-button | ", media: "all", inherited: false, animationType: "discrete", @@ -11741,7 +12274,7 @@ computed: "asSpecified", order: "perGrammar", status: "experimental", - mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-appearance" + mdn_url: "https://developer.mozilla.org/docs/Web/CSS/appearance" }; var azimuth = { syntax: " | [ [ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] || behind ] | leftwards | rightwards", @@ -11888,7 +12421,7 @@ status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clip" }; - var color = { + var color$1 = { syntax: "", media: "visual", inherited: true, @@ -11947,7 +12480,7 @@ appliesto: "allElements", computed: "asSpecified", order: "perGrammar", - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/contain" }; var content = { @@ -12141,7 +12674,7 @@ "row-gap", "column-gap" ], - appliesto: "gridContainers", + appliesto: "multiColumnElementsFlexContainersGridContainers", computed: [ "row-gap", "column-gap" @@ -12194,7 +12727,7 @@ mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid" }; var height = { - syntax: "[ | ] && [ border-box | content-box ]? | available | min-content | max-content | fit-content | auto", + syntax: "auto | | | min-content | max-content | fit-content()", media: "visual", inherited: false, animationType: "lpc", @@ -12297,7 +12830,8 @@ ], order: "uniqueOrder", alsoAppliesTo: [ - "::first-letter" + "::first-letter", + "::first-line" ], status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin" @@ -12384,7 +12918,7 @@ ], order: "perGrammar", stacking: true, - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset" }; var opacity = { @@ -12416,7 +12950,7 @@ "CSS Flexible Box Layout" ], initial: "0", - appliesto: "flexItemsAndAbsolutelyPositionedFlexContainerChildren", + appliesto: "flexItemsGridItemsAbsolutelyPositionedContainerChildren", computed: "asSpecified", order: "uniqueOrder", status: "standard", @@ -12480,7 +13014,10 @@ ], initial: "visible", appliesto: "blockContainersFlexContainersGridContainers", - computed: "asSpecified", + computed: [ + "overflow-x", + "overflow-y" + ], order: "uniqueOrder", status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow" @@ -12509,7 +13046,8 @@ ], order: "uniqueOrder", alsoAppliesTo: [ - "::first-letter" + "::first-letter", + "::first-line" ], status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding" @@ -12531,7 +13069,7 @@ status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/perspective" }; - var position = { + var position$1 = { syntax: "static | relative | absolute | sticky | fixed", media: "visual", inherited: false, @@ -12739,7 +13277,7 @@ mdn_url: "https://developer.mozilla.org/docs/Web/CSS/widows" }; var width = { - syntax: "[ | ] && [ border-box | content-box ]? | available | min-content | max-content | fit-content | auto", + syntax: "auto | | | min-content | max-content | fit-content()", media: "visual", inherited: false, animationType: "lpc", @@ -12770,7 +13308,7 @@ status: "nonstandard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/zoom" }; - var properties$1 = { + var require$$1 = { "--*": { syntax: "", media: "all", @@ -13009,6 +13547,38 @@ order: "uniqueOrder", status: "nonstandard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-flow-into" + }, + "-ms-grid-columns": { + syntax: "none | | ", + media: "visual", + inherited: false, + animationType: "simpleListOfLpcDifferenceLpc", + percentages: "referToDimensionOfContentArea", + groups: [ + "CSS Grid Layout" + ], + initial: "none", + appliesto: "gridContainers", + computed: "asSpecifiedRelativeToAbsoluteLengths", + order: "uniqueOrder", + status: "nonstandard", + mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-grid-columns" + }, + "-ms-grid-rows": { + syntax: "none | | ", + media: "visual", + inherited: false, + animationType: "simpleListOfLpcDifferenceLpc", + percentages: "referToDimensionOfContentArea", + groups: [ + "CSS Grid Layout" + ], + initial: "none", + appliesto: "gridContainers", + computed: "asSpecifiedRelativeToAbsoluteLengths", + order: "uniqueOrder", + status: "nonstandard", + mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-grid-rows" }, "-ms-high-contrast-adjust": { syntax: "auto | none", @@ -13575,7 +14145,7 @@ computed: "asSpecified", order: "uniqueOrder", status: "nonstandard", - mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-appearance" + mdn_url: "https://developer.mozilla.org/docs/Web/CSS/appearance" }, "-moz-binding": { syntax: " | none", @@ -13690,7 +14260,7 @@ mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-float-edge" }, "-moz-force-broken-image-icon": { - syntax: "", + syntax: "", media: "visual", inherited: false, animationType: "discrete", @@ -13950,7 +14520,7 @@ mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-window-shadow" }, "-webkit-appearance": { - syntax: "none | button | button-bevel | caret | checkbox | default-button | inner-spin-button | listbox | listitem | media-controls-background | media-controls-fullscreen-background | media-current-time-display | media-enter-fullscreen-button | media-exit-fullscreen-button | media-fullscreen-button | media-mute-button | media-overlay-play-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | media-time-remaining-display | media-toggle-closed-captions-button | media-volume-slider | media-volume-slider-container | media-volume-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | meter | progress-bar | progress-bar-value | push-button | radio | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield", + syntax: "none | button | button-bevel | caret | checkbox | default-button | inner-spin-button | listbox | listitem | media-controls-background | media-controls-fullscreen-background | media-current-time-display | media-enter-fullscreen-button | media-exit-fullscreen-button | media-fullscreen-button | media-mute-button | media-overlay-play-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | media-time-remaining-display | media-toggle-closed-captions-button | media-volume-slider | media-volume-slider-container | media-volume-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | meter | progress-bar | progress-bar-value | push-button | radio | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield | -apple-pay-button", media: "visual", inherited: false, animationType: "discrete", @@ -13963,7 +14533,7 @@ computed: "asSpecified", order: "uniqueOrder", status: "nonstandard", - mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-appearance" + mdn_url: "https://developer.mozilla.org/docs/Web/CSS/appearance" }, "-webkit-border-before": { syntax: "<'border-width'> || <'border-style'> || <'color'>", @@ -14474,6 +15044,22 @@ order: "uniqueOrder", status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-self" + }, + "align-tracks": { + syntax: "[ normal | | | ? ]#", + media: "visual", + inherited: false, + animationType: "discrete", + percentages: "no", + groups: [ + "CSS Grid Layout" + ], + initial: "normal", + appliesto: "gridContainersWithMasonryLayoutInTheirBlockAxis", + computed: "asSpecified", + order: "uniqueOrder", + status: "experimental", + mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-tracks" }, all: all, animation: animation, @@ -14636,7 +15222,7 @@ appliesto: "allElementsSVGContainerElements", computed: "asSpecified", order: "uniqueOrder", - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/backdrop-filter" }, "backface-visibility": { @@ -14804,7 +15390,7 @@ mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position" }, "background-position-x": { - syntax: "[ center | [ left | right | x-start | x-end ]? ? ]#", + syntax: "[ center | [ [ left | right | x-start | x-end ]? ? ]! ]#", media: "visual", inherited: false, animationType: "discrete", @@ -14820,7 +15406,7 @@ mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position-x" }, "background-position-y": { - syntax: "[ center | [ top | bottom | y-start | y-end ]? ? ]#", + syntax: "[ center | [ [ top | bottom | y-start | y-end ]? ? ]! ]#", media: "visual", inherited: false, animationType: "discrete", @@ -14896,7 +15482,7 @@ syntax: "<'width'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "lpc", percentages: "blockSizeOfContainingBlock", groups: [ "CSS Logical Properties" @@ -14985,7 +15571,11 @@ syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: [ + "border-block-end-color", + "border-block-end-style", + "border-block-end-width" + ], percentages: "no", groups: [ "CSS Logical Properties" @@ -15009,7 +15599,7 @@ syntax: "<'border-top-color'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "color", percentages: "no", groups: [ "CSS Logical Properties" @@ -15041,7 +15631,7 @@ syntax: "<'border-top-width'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "length", percentages: "logicalWidthOfContainingBlock", groups: [ "CSS Logical Properties" @@ -15057,7 +15647,11 @@ syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: [ + "border-block-start-color", + "border-block-start-style", + "border-block-start-width" + ], percentages: "no", groups: [ "CSS Logical Properties" @@ -15081,7 +15675,7 @@ syntax: "<'border-top-color'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "color", percentages: "no", groups: [ "CSS Logical Properties" @@ -15113,7 +15707,7 @@ syntax: "<'border-top-width'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "length", percentages: "logicalWidthOfContainingBlock", groups: [ "CSS Logical Properties" @@ -15496,7 +16090,11 @@ syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: [ + "border-inline-end-color", + "border-inline-end-style", + "border-inline-end-width" + ], percentages: "no", groups: [ "CSS Logical Properties" @@ -15568,7 +16166,7 @@ syntax: "<'border-top-color'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "color", percentages: "no", groups: [ "CSS Logical Properties" @@ -15600,7 +16198,7 @@ syntax: "<'border-top-width'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "length", percentages: "logicalWidthOfContainingBlock", groups: [ "CSS Logical Properties" @@ -15616,7 +16214,11 @@ syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: [ + "border-inline-start-color", + "border-inline-start-style", + "border-inline-start-width" + ], percentages: "no", groups: [ "CSS Logical Properties" @@ -15640,7 +16242,7 @@ syntax: "<'border-top-color'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "color", percentages: "no", groups: [ "CSS Logical Properties" @@ -15672,7 +16274,7 @@ syntax: "<'border-top-width'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "length", percentages: "logicalWidthOfContainingBlock", groups: [ "CSS Logical Properties" @@ -16423,7 +17025,7 @@ status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clip-path" }, - color: color, + color: color$1, "color-adjust": { syntax: "economy | exact", media: "visual", @@ -16895,7 +17497,7 @@ "::first-line", "::placeholder" ], - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variation-settings" }, "font-size": { @@ -16939,6 +17541,22 @@ ], status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-size-adjust" + }, + "font-smooth": { + syntax: "auto | never | always | | ", + media: "visual", + inherited: true, + animationType: "discrete", + percentages: "no", + groups: [ + "CSS Fonts" + ], + initial: "auto", + appliesto: "allElements", + computed: "asSpecified", + order: "uniqueOrder", + status: "nonstandard", + mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-smooth" }, "font-stretch": { syntax: "", @@ -17514,7 +18132,7 @@ groups: [ "CSS Images" ], - initial: "0deg", + initial: "from-image", appliesto: "allElements", computed: "angleRoundedToNextQuarter", order: "uniqueOrder", @@ -17604,7 +18222,7 @@ syntax: "<'width'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "lpc", percentages: "inlineSizeOfContainingBlock", groups: [ "CSS Logical Properties" @@ -17761,6 +18379,22 @@ order: "uniqueOrder", status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-self" + }, + "justify-tracks": { + syntax: "[ normal | | ? [ | left | right ] ]#", + media: "visual", + inherited: false, + animationType: "discrete", + percentages: "no", + groups: [ + "CSS Grid Layout" + ], + initial: "normal", + appliesto: "gridContainersWithMasonryLayoutInTheirInlineAxis", + computed: "asSpecified", + order: "uniqueOrder", + status: "experimental", + mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-tracks" }, left: left, "letter-spacing": { @@ -17786,7 +18420,7 @@ "line-break": { syntax: "auto | loose | normal | strict | anywhere", media: "visual", - inherited: false, + inherited: true, animationType: "discrete", percentages: "no", groups: [ @@ -17944,7 +18578,7 @@ syntax: "<'margin-left'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "length", percentages: "dependsOnLayoutModel", groups: [ "CSS Logical Properties" @@ -17960,7 +18594,7 @@ syntax: "<'margin-left'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "length", percentages: "dependsOnLayoutModel", groups: [ "CSS Logical Properties" @@ -17986,7 +18620,8 @@ computed: "percentageAsSpecifiedOrAbsoluteLength", order: "uniqueOrder", alsoAppliesTo: [ - "::first-letter" + "::first-letter", + "::first-line" ], status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-bottom" @@ -18011,7 +18646,7 @@ syntax: "<'margin-left'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "length", percentages: "dependsOnLayoutModel", groups: [ "CSS Logical Properties" @@ -18027,7 +18662,7 @@ syntax: "<'margin-left'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "length", percentages: "dependsOnLayoutModel", groups: [ "CSS Logical Properties" @@ -18053,7 +18688,8 @@ computed: "percentageAsSpecifiedOrAbsoluteLength", order: "uniqueOrder", alsoAppliesTo: [ - "::first-letter" + "::first-letter", + "::first-line" ], status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-left" @@ -18072,7 +18708,8 @@ computed: "percentageAsSpecifiedOrAbsoluteLength", order: "uniqueOrder", alsoAppliesTo: [ - "::first-letter" + "::first-letter", + "::first-line" ], status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-right" @@ -18091,10 +18728,31 @@ computed: "percentageAsSpecifiedOrAbsoluteLength", order: "uniqueOrder", alsoAppliesTo: [ - "::first-letter" + "::first-letter", + "::first-line" ], status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-top" + }, + "margin-trim": { + syntax: "none | in-flow | all", + media: "visual", + inherited: false, + animationType: "discrete", + percentages: "no", + groups: [ + "CSS Box Model" + ], + initial: "none", + appliesto: "blockContainersAndMultiColumnContainers", + computed: "asSpecified", + order: "perGrammar", + alsoAppliesTo: [ + "::first-letter", + "::first-line" + ], + status: "experimental", + mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-trim" }, mask: mask, "mask-border": { @@ -18135,7 +18793,7 @@ ], order: "perGrammar", stacking: true, - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border" }, "mask-border-mode": { @@ -18151,7 +18809,7 @@ appliesto: "allElementsSVGContainerElements", computed: "asSpecified", order: "perGrammar", - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-mode" }, "mask-border-outset": { @@ -18167,7 +18825,7 @@ appliesto: "allElementsSVGContainerElements", computed: "asSpecifiedRelativeToAbsoluteLengths", order: "perGrammar", - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-outset" }, "mask-border-repeat": { @@ -18183,7 +18841,7 @@ appliesto: "allElementsSVGContainerElements", computed: "asSpecified", order: "perGrammar", - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-repeat" }, "mask-border-slice": { @@ -18199,7 +18857,7 @@ appliesto: "allElementsSVGContainerElements", computed: "asSpecified", order: "perGrammar", - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-slice" }, "mask-border-source": { @@ -18215,7 +18873,7 @@ appliesto: "allElementsSVGContainerElements", computed: "asSpecifiedURLsAbsolute", order: "perGrammar", - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-source" }, "mask-border-width": { @@ -18231,7 +18889,7 @@ appliesto: "allElementsSVGContainerElements", computed: "asSpecifiedRelativeToAbsoluteLengths", order: "perGrammar", - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-width" }, "mask-clip": { @@ -18377,12 +19035,44 @@ order: "perGrammar", status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-type" + }, + "masonry-auto-flow": { + syntax: "[ pack | next ] || [ definite-first | ordered ]", + media: "visual", + inherited: false, + animationType: "discrete", + percentages: "no", + groups: [ + "CSS Grid Layout" + ], + initial: "pack", + appliesto: "gridContainersWithMasonryLayout", + computed: "asSpecified", + order: "uniqueOrder", + status: "experimental", + mdn_url: "https://developer.mozilla.org/docs/Web/CSS/masonry-auto-flow" + }, + "math-style": { + syntax: "normal | compact", + media: "visual", + inherited: true, + animationType: "notAnimatable", + percentages: "no", + groups: [ + "MathML" + ], + initial: "normal", + appliesto: "allElements", + computed: "asSpecified", + order: "perGrammar", + status: "standard", + mdn_url: "https://developer.mozilla.org/docs/Web/CSS/math-style" }, "max-block-size": { syntax: "<'max-width'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "lpc", percentages: "blockSizeOfContainingBlock", groups: [ "CSS Logical Properties" @@ -18391,11 +19081,11 @@ appliesto: "sameAsWidthAndHeight", computed: "sameAsMaxWidthAndMaxHeight", order: "uniqueOrder", - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-block-size" }, "max-height": { - syntax: " | | none | max-content | min-content | fit-content | fill-available", + syntax: "none | | min-content | max-content | fit-content()", media: "visual", inherited: false, animationType: "lpc", @@ -18414,7 +19104,7 @@ syntax: "<'max-width'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "lpc", percentages: "inlineSizeOfContainingBlock", groups: [ "CSS Logical Properties" @@ -18423,7 +19113,7 @@ appliesto: "sameAsWidthAndHeight", computed: "sameAsMaxWidthAndMaxHeight", order: "uniqueOrder", - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-inline-size" }, "max-lines": { @@ -18442,7 +19132,7 @@ status: "experimental" }, "max-width": { - syntax: " | | none | max-content | min-content | fit-content | fill-available", + syntax: "none | | min-content | max-content | fit-content()", media: "visual", inherited: false, animationType: "lpc", @@ -18461,7 +19151,7 @@ syntax: "<'min-width'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "lpc", percentages: "blockSizeOfContainingBlock", groups: [ "CSS Logical Properties" @@ -18474,7 +19164,7 @@ mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-block-size" }, "min-height": { - syntax: " | | auto | max-content | min-content | fit-content | fill-available", + syntax: "auto | | | min-content | max-content | fit-content()", media: "visual", inherited: false, animationType: "lpc", @@ -18493,7 +19183,7 @@ syntax: "<'min-width'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "lpc", percentages: "inlineSizeOfContainingBlock", groups: [ "CSS Logical Properties" @@ -18506,7 +19196,7 @@ mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-inline-size" }, "min-width": { - syntax: " | | auto | max-content | min-content | fit-content | fill-available", + syntax: "auto | | | min-content | max-content | fit-content()", media: "visual", inherited: false, animationType: "lpc", @@ -18584,7 +19274,7 @@ appliesto: "transformableElements", computed: "forLengthAbsoluteValueOtherwisePercentage", order: "perGrammar", - status: "experimental" + status: "standard" }, "offset-distance": { syntax: "", @@ -18599,11 +19289,11 @@ appliesto: "transformableElements", computed: "forLengthAbsoluteValueOtherwisePercentage", order: "perGrammar", - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-distance" }, "offset-path": { - syntax: "none | ray( [ && ? && contain? ] ) | | | [ || ]", + syntax: "none | ray( [ && && contain? ] ) | | | [ || ]", media: "visual", inherited: false, animationType: "angleOrBasicShapeOrPath", @@ -18616,7 +19306,7 @@ computed: "asSpecified", order: "perGrammar", stacking: true, - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-path" }, "offset-position": { @@ -18647,7 +19337,7 @@ appliesto: "transformableElements", computed: "asSpecified", order: "perGrammar", - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-rotate" }, opacity: opacity, @@ -18744,7 +19434,7 @@ appliesto: "allElements", computed: "asSpecified", order: "perGrammar", - status: "experimental" + status: "standard" }, "overflow-block": { syntax: "visible | hidden | clip | scroll | auto", @@ -18757,9 +19447,9 @@ ], initial: "auto", appliesto: "blockContainersFlexContainersGridContainers", - computed: "asSpecified", + computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent", order: "perGrammar", - status: "experimental" + status: "standard" }, "overflow-clip-box": { syntax: "padding-box | content-box", @@ -18788,9 +19478,9 @@ ], initial: "auto", appliesto: "blockContainersFlexContainersGridContainers", - computed: "asSpecified", + computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent", order: "perGrammar", - status: "experimental" + status: "standard" }, "overflow-wrap": { syntax: "normal | break-word | anywhere", @@ -18819,7 +19509,7 @@ ], initial: "visible", appliesto: "blockContainersFlexContainersGridContainers", - computed: "asSpecified", + computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent", order: "uniqueOrder", status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-x" @@ -18835,7 +19525,7 @@ ], initial: "visible", appliesto: "blockContainersFlexContainersGridContainers", - computed: "asSpecified", + computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent", order: "uniqueOrder", status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-y" @@ -18853,8 +19543,40 @@ appliesto: "nonReplacedBlockAndInlineBlockElements", computed: "asSpecified", order: "uniqueOrder", - status: "nonstandard", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior" + }, + "overscroll-behavior-block": { + syntax: "contain | none | auto", + media: "visual", + inherited: false, + animationType: "discrete", + percentages: "no", + groups: [ + "CSS Box Model" + ], + initial: "auto", + appliesto: "nonReplacedBlockAndInlineBlockElements", + computed: "asSpecified", + order: "uniqueOrder", + status: "standard", + mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-block" + }, + "overscroll-behavior-inline": { + syntax: "contain | none | auto", + media: "visual", + inherited: false, + animationType: "discrete", + percentages: "no", + groups: [ + "CSS Box Model" + ], + initial: "auto", + appliesto: "nonReplacedBlockAndInlineBlockElements", + computed: "asSpecified", + order: "uniqueOrder", + status: "standard", + mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-inline" }, "overscroll-behavior-x": { syntax: "contain | none | auto", @@ -18869,7 +19591,7 @@ appliesto: "nonReplacedBlockAndInlineBlockElements", computed: "asSpecified", order: "uniqueOrder", - status: "nonstandard", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-x" }, "overscroll-behavior-y": { @@ -18885,7 +19607,7 @@ appliesto: "nonReplacedBlockAndInlineBlockElements", computed: "asSpecified", order: "uniqueOrder", - status: "nonstandard", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-y" }, padding: padding, @@ -18909,7 +19631,7 @@ syntax: "<'padding-left'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "length", percentages: "logicalWidthOfContainingBlock", groups: [ "CSS Logical Properties" @@ -18925,7 +19647,7 @@ syntax: "<'padding-left'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "length", percentages: "logicalWidthOfContainingBlock", groups: [ "CSS Logical Properties" @@ -18951,7 +19673,8 @@ computed: "percentageAsSpecifiedOrAbsoluteLength", order: "uniqueOrder", alsoAppliesTo: [ - "::first-letter" + "::first-letter", + "::first-line" ], status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-bottom" @@ -18976,7 +19699,7 @@ syntax: "<'padding-left'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "length", percentages: "logicalWidthOfContainingBlock", groups: [ "CSS Logical Properties" @@ -18992,7 +19715,7 @@ syntax: "<'padding-left'>", media: "visual", inherited: false, - animationType: "discrete", + animationType: "length", percentages: "logicalWidthOfContainingBlock", groups: [ "CSS Logical Properties" @@ -19018,7 +19741,8 @@ computed: "percentageAsSpecifiedOrAbsoluteLength", order: "uniqueOrder", alsoAppliesTo: [ - "::first-letter" + "::first-letter", + "::first-line" ], status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-left" @@ -19037,7 +19761,8 @@ computed: "percentageAsSpecifiedOrAbsoluteLength", order: "uniqueOrder", alsoAppliesTo: [ - "::first-letter" + "::first-letter", + "::first-line" ], status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-right" @@ -19056,7 +19781,8 @@ computed: "percentageAsSpecifiedOrAbsoluteLength", order: "uniqueOrder", alsoAppliesTo: [ - "::first-letter" + "::first-letter", + "::first-line" ], status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-top" @@ -19131,7 +19857,7 @@ appliesto: "textElements", computed: "asSpecified", order: "uniqueOrder", - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/paint-order" }, perspective: perspective, @@ -19227,7 +19953,7 @@ status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/pointer-events" }, - position: position, + position: position$1, quotes: quotes, resize: resize, right: right, @@ -19311,6 +20037,22 @@ order: "perGrammar", status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-color" + }, + "scrollbar-gutter": { + syntax: "auto | [ stable | always ] && both? && force?", + media: "visual", + inherited: false, + animationType: "discrete", + percentages: "no", + groups: [ + "CSS Overflow" + ], + initial: "auto", + appliesto: "allElements", + computed: "asSpecified", + order: "perGrammar", + status: "standard", + mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-gutter" }, "scrollbar-width": { syntax: "auto | thin | none", @@ -19959,7 +20701,7 @@ syntax: "none | all | [ digits ? ]", media: "visual", inherited: true, - animationType: "discrete", + animationType: "notAnimatable", percentages: "no", groups: [ "CSS Writing Modes" @@ -20065,7 +20807,7 @@ mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip" }, "text-decoration-skip-ink": { - syntax: "auto | none", + syntax: "auto | all | none", media: "visual", inherited: true, animationType: "discrete", @@ -20077,7 +20819,7 @@ appliesto: "allElements", computed: "asSpecified", order: "orderOfAppearance", - status: "experimental", + status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip-ink" }, "text-decoration-style": { @@ -20102,11 +20844,11 @@ mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-style" }, "text-decoration-thickness": { - syntax: "auto | from-font | ", + syntax: "auto | from-font | | ", media: "visual", inherited: false, animationType: "byComputedValueType", - percentages: "no", + percentages: "referToElementFontSize", groups: [ "CSS Text Decoration" ], @@ -20337,11 +21079,11 @@ mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-transform" }, "text-underline-offset": { - syntax: "auto | from-font | ", + syntax: "auto | | ", media: "visual", inherited: true, animationType: "byComputedValueType", - percentages: "no", + percentages: "referToElementFontSize", groups: [ "CSS Text Decoration" ], @@ -20358,7 +21100,7 @@ mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-underline-offset" }, "text-underline-position": { - syntax: "auto | [ under || [ left | right ] ]", + syntax: "auto | from-font | [ under || [ left | right ] ]", media: "visual", inherited: true, animationType: "discrete", @@ -20392,7 +21134,7 @@ }, transform: transform, "transform-box": { - syntax: "border-box | fill-box | view-box", + syntax: "content-box | border-box | fill-box | stroke-box | view-box", media: "visual", inherited: false, animationType: "discrete", @@ -20400,10 +21142,10 @@ groups: [ "CSS Transforms" ], - initial: "border-box ", + initial: "view-box", appliesto: "transformableElements", computed: "asSpecified", - order: "uniqueOrder", + order: "perGrammar", status: "standard", mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-box" }, @@ -20683,77 +21425,18 @@ zoom: zoom }; - var properties$2 = /*#__PURE__*/Object.freeze({ - __proto__: null, - all: all, - animation: animation, - appearance: appearance, - azimuth: azimuth, - background: background, - border: border, - bottom: bottom, - clear: clear, - clip: clip, - color: color, - columns: columns, - contain: contain, - content: content, - cursor: cursor, - direction: direction, - display: display, - filter: filter, - flex: flex, - float: float, - font: font, - gap: gap, - grid: grid, - height: height, - hyphens: hyphens, - inset: inset, - isolation: isolation, - left: left, - margin: margin, - mask: mask, - offset: offset, - opacity: opacity, - order: order, - orphans: orphans, - outline: outline, - overflow: overflow, - padding: padding, - perspective: perspective, - position: position, - quotes: quotes, - resize: resize, - right: right, - rotate: rotate, - scale: scale, - top: top, - transform: transform, - transition: transition, - translate: translate, - visibility: visibility, - widows: widows, - width: width, - zoom: zoom, - 'default': properties$1 - }); - var attachment = { syntax: "scroll | fixed | local" }; var box = { syntax: "border-box | padding-box | content-box" }; - var color$1 = { + var color = { syntax: " | | | | | | currentcolor | " }; var combinator = { syntax: "'>' | '+' | '~' | [ '||' ]" }; - var compat = { - syntax: "searchfield | textarea | push-button | button-bevel | slider-horizontal | checkbox | radio | square-button | menulist | menulist-button | listbox | meter | progress-bar" - }; var gradient = { syntax: " | | | | " }; @@ -20763,10 +21446,10 @@ var image = { syntax: " | | | | | | " }; - var nth = { + var nth$1 = { syntax: " | even | odd" }; - var position$1 = { + var position = { syntax: "[ [ left | center | right ] || [ top | center | bottom ] | [ left | center | right | ] [ top | center | bottom | ]? | [ [ left | right ] ] && [ [ top | bottom ] ] ]" }; var quote = { @@ -20775,7 +21458,7 @@ var shadow = { syntax: "inset? && {2,4} && ?" }; - var shape$1 = { + var shape = { syntax: "rect(, , , )" }; var size = { @@ -20787,7 +21470,7 @@ var target = { syntax: " | | " }; - var syntaxes = { + var require$$2 = { "absolute-size": { syntax: "xx-small | x-small | small | medium | large | x-large | xx-large | xxx-large" }, @@ -20832,7 +21515,7 @@ syntax: "[ first | last ]? baseline" }, "basic-shape": { - syntax: " | | | " + syntax: " | | | | " }, "bg-image": { syntax: "none | " @@ -20886,7 +21569,7 @@ "clip-source": { syntax: "" }, - color: color$1, + color: color, "color-stop": { syntax: " | " }, @@ -20903,7 +21586,9 @@ "common-lig-values": { syntax: "[ common-ligatures | no-common-ligatures ]" }, - compat: compat, + "compat-auto": { + syntax: "searchfield | textarea | push-button | slider-horizontal | checkbox | radio | square-button | menulist | listbox | meter | progress-bar | button" + }, "composite-style": { syntax: "clear | copy | source-over | source-in | source-out | source-atop | destination-over | destination-in | destination-out | destination-atop | xor" }, @@ -20959,7 +21644,7 @@ syntax: "cross-fade( , ? )" }, "cubic-bezier-timing-function": { - syntax: "ease | ease-in | ease-out | ease-in-out | cubic-bezier(, , , )" + syntax: "ease | ease-in | ease-out | ease-in-out | cubic-bezier(, , , )" }, "deprecated-system-color": { syntax: "ActiveBorder | ActiveCaption | AppWorkspace | Background | ButtonFace | ButtonHighlight | ButtonShadow | ButtonText | CaptionText | GrayText | Highlight | HighlightText | InactiveBorder | InactiveCaption | InactiveCaptionText | InfoBackground | InfoText | Menu | MenuText | Scrollbar | ThreeDDarkShadow | ThreeDFace | ThreeDHighlight | ThreeDLightShadow | ThreeDShadow | Window | WindowFrame | WindowText" @@ -21064,7 +21749,7 @@ syntax: "[ normal | small-caps ]" }, "font-weight-absolute": { - syntax: "normal | bold | " + syntax: "normal | bold | " }, "frequency-percentage": { syntax: " | " @@ -21244,7 +21929,7 @@ syntax: "min( # )" }, "minmax()": { - syntax: "minmax( [ | | | min-content | max-content | auto ] , [ | | | min-content | max-content | auto ] )" + syntax: "minmax( [ | | min-content | max-content | auto ] , [ | | | min-content | max-content | auto ] )" }, "named-color": { syntax: "transparent | aliceblue | antiquewhite | aqua | aquamarine | azure | beige | bisque | black | blanchedalmond | blue | blueviolet | brown | burlywood | cadetblue | chartreuse | chocolate | coral | cornflowerblue | cornsilk | crimson | cyan | darkblue | darkcyan | darkgoldenrod | darkgray | darkgreen | darkgrey | darkkhaki | darkmagenta | darkolivegreen | darkorange | darkorchid | darkred | darksalmon | darkseagreen | darkslateblue | darkslategray | darkslategrey | darkturquoise | darkviolet | deeppink | deepskyblue | dimgray | dimgrey | dodgerblue | firebrick | floralwhite | forestgreen | fuchsia | gainsboro | ghostwhite | gold | goldenrod | gray | green | greenyellow | grey | honeydew | hotpink | indianred | indigo | ivory | khaki | lavender | lavenderblush | lawngreen | lemonchiffon | lightblue | lightcoral | lightcyan | lightgoldenrodyellow | lightgray | lightgreen | lightgrey | lightpink | lightsalmon | lightseagreen | lightskyblue | lightslategray | lightslategrey | lightsteelblue | lightyellow | lime | limegreen | linen | magenta | maroon | mediumaquamarine | mediumblue | mediumorchid | mediumpurple | mediumseagreen | mediumslateblue | mediumspringgreen | mediumturquoise | mediumvioletred | midnightblue | mintcream | mistyrose | moccasin | navajowhite | navy | oldlace | olive | olivedrab | orange | orangered | orchid | palegoldenrod | palegreen | paleturquoise | palevioletred | papayawhip | peachpuff | peru | pink | plum | powderblue | purple | rebeccapurple | red | rosybrown | royalblue | saddlebrown | salmon | sandybrown | seagreen | seashell | sienna | silver | skyblue | slateblue | slategray | slategrey | snow | springgreen | steelblue | tan | teal | thistle | tomato | turquoise | violet | wheat | white | whitesmoke | yellow | yellowgreen" @@ -21267,7 +21952,7 @@ "numeric-spacing-values": { syntax: "[ proportional-nums | tabular-nums ]" }, - nth: nth, + nth: nth$1, "opacity()": { syntax: "opacity( [ ] )" }, @@ -21291,6 +21976,9 @@ }, "page-selector": { syntax: "+ | *" + }, + "path()": { + syntax: "path( [ , ]? )" }, "paint()": { syntax: "paint( , ? )" @@ -21301,7 +21989,7 @@ "polygon()": { syntax: "polygon( ? , [ ]# )" }, - position: position$1, + position: position, "pseudo-class-selector": { syntax: "':' | ':' ')'" }, @@ -21394,7 +22082,7 @@ "shadow-t": { syntax: "[ {2,3} && ? ]" }, - shape: shape$1, + shape: shape, "shape-box": { syntax: " | margin-box" }, @@ -21514,28 +22202,20 @@ } }; - var syntaxes$1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - attachment: attachment, - box: box, - color: color$1, - combinator: combinator, - compat: compat, - gradient: gradient, - hue: hue, - image: image, - nth: nth, - position: position$1, - quote: quote, - shadow: shadow, - shape: shape$1, - size: size, - symbol: symbol, - target: target, - 'default': syntaxes - }); - - var properties$3 = { + var atrules = { + charset: { + prelude: "" + }, + "font-face": { + descriptors: { + "unicode-range": { + comment: "replaces , an old production name", + syntax: "#" + } + } + } + }; + var properties = { "-moz-background-clip": { comment: "deprecated syntax in old Firefox, https://developer.mozilla.org/en/docs/Web/CSS/background-clip", syntax: "padding | border" @@ -21608,18 +22288,10 @@ comment: "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466338.aspx", syntax: "start | end | center | stretch" }, - "-ms-grid-columns": { - comment: "misssed old syntax implemented in IE; https://www.w3.org/TR/2012/WD-css3-grid-layout-20120322/#grid-columns", - syntax: "" - }, "-ms-grid-row-align": { comment: "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466348.aspx", syntax: "start | end | center | stretch" }, - "-ms-grid-rows": { - comment: "misssed old syntax implemented in IE; https://www.w3.org/TR/2012/WD-css3-grid-layout-20120322/#grid-rows", - syntax: "" - }, "-ms-hyphenate-limit-last": { comment: "misssed old syntax implemented in IE; https://www.w3.org/TR/css-text-4/#hyphenate-line-limits", syntax: "none | always | column | page | spread" @@ -21629,7 +22301,7 @@ references: [ "http://css-infos.net/property/-webkit-appearance" ], - syntax: "none | button | button-bevel | caps-lock-indicator | caret | checkbox | default-button | listbox | listitem | media-fullscreen-button | media-mute-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | push-button | radio | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbargripper-horizontal | scrollbargripper-vertical | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield" + syntax: "none | button | button-bevel | caps-lock-indicator | caret | checkbox | default-button | inner-spin-button | listbox | listitem | media-controls-background | media-controls-fullscreen-background | media-current-time-display | media-enter-fullscreen-button | media-exit-fullscreen-button | media-fullscreen-button | media-mute-button | media-overlay-play-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | media-time-remaining-display | media-toggle-closed-captions-button | media-volume-slider | media-volume-slider-container | media-volume-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | meter | progress-bar | progress-bar-value | push-button | radio | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbargripper-horizontal | scrollbargripper-vertical | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield | -apple-pay-button" }, "-webkit-background-clip": { comment: "https://developer.mozilla.org/en/docs/Web/CSS/background-clip", @@ -21720,11 +22392,11 @@ }, display: { comment: "extended with -ms-flexbox", - syntax: "block | contents | flex | flow | flow-root | grid | inline | inline-block | inline-flex | inline-grid | inline-list-item | inline-table | list-item | none | ruby | ruby-base | ruby-base-container | ruby-text | ruby-text-container | run-in | table | table-caption | table-cell | table-column | table-column-group | table-footer-group | table-header-group | table-row | table-row-group | -ms-flexbox | -ms-inline-flexbox | -ms-grid | -ms-inline-grid | -webkit-flex | -webkit-inline-flex | -webkit-box | -webkit-inline-box | -moz-inline-stack | -moz-box | -moz-inline-box" + syntax: "| <-non-standard-display>" }, position: { comment: "extended with -webkit-sticky", - syntax: "static | relative | absolute | sticky | fixed | -webkit-sticky" + syntax: "| -webkit-sticky" }, "dominant-baseline": { comment: "added SVG property", @@ -21739,7 +22411,7 @@ "https://developer.mozilla.org/en/docs/Web/CSS/image-rendering", "https://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty" ], - syntax: "auto | crisp-edges | pixelated | optimizeSpeed | optimizeQuality | <-non-standard-image-rendering>" + syntax: "| optimizeSpeed | optimizeQuality | <-non-standard-image-rendering>" }, fill: { comment: "added SVG property", @@ -21764,7 +22436,7 @@ }, filter: { comment: "extend with IE legacy syntaxes", - syntax: "none | | <-ms-filter-function-list>" + syntax: "| <-ms-filter-function-list>" }, "glyph-orientation-horizontal": { comment: "added SVG property", @@ -21823,20 +22495,20 @@ syntax: "none | " }, "max-width": { - comment: "extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/max-width", - syntax: " | | none | max-content | min-content | fit-content | fill-available | <-non-standard-width>" + comment: "fix auto -> none (https://github.com/mdn/data/pull/431); extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/max-width", + syntax: "none | | min-content | max-content | fit-content() | <-non-standard-width>" + }, + width: { + comment: "per spec fit-content should be a function, however browsers are supporting it as a keyword (https://github.com/csstree/stylelint-validator/issues/29)", + syntax: "| fit-content | -moz-fit-content | -webkit-fit-content" }, "min-width": { comment: "extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width", - syntax: " | | auto | max-content | min-content | fit-content | fill-available | <-non-standard-width>" - }, - opacity: { - comment: "strict to 0..1 -> ", - syntax: "" + syntax: "auto | | min-content | max-content | fit-content() | <-non-standard-width>" }, overflow: { comment: "extend by vendor keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow", - syntax: "[ visible | hidden | clip | scroll | auto ]{1,2} | <-non-standard-overflow>" + syntax: "| <-non-standard-overflow>" }, pause: { comment: "https://www.w3.org/TR/css3-speech/#property-index", @@ -21946,7 +22618,7 @@ }, "unicode-bidi": { comment: "added prefixed keywords https://developer.mozilla.org/en-US/docs/Web/CSS/unicode-bidi", - syntax: "normal | embed | isolate | bidi-override | isolate-override | plaintext | -moz-isolate | -moz-isolate-override | -moz-plaintext | -webkit-isolate" + syntax: "| -moz-isolate | -moz-isolate-override | -moz-plaintext | -webkit-isolate | -webkit-isolate-override | -webkit-plaintext" }, "unicode-range": { comment: "added missed property https://developer.mozilla.org/en-US/docs/Web/CSS/%40font-face/unicode-range", @@ -21986,10 +22658,10 @@ }, "writing-mode": { comment: "extend with SVG keywords", - syntax: "horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr | " + syntax: "| " } }; - var syntaxes$2 = { + var syntaxes = { "-legacy-gradient": { comment: "added collection of legacy gradient syntaxes", syntax: "<-webkit-gradient()> | <-legacy-linear-gradient> | <-legacy-repeating-linear-gradient> | <-legacy-radial-gradient> | <-legacy-repeating-radial-gradient>" @@ -22051,7 +22723,7 @@ }, "-non-standard-width": { comment: "non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width", - syntax: "min-intrinsic | intrinsic | -moz-min-content | -moz-max-content | -webkit-min-content | -webkit-max-content" + syntax: "fill-available | min-intrinsic | intrinsic | -moz-available | -moz-fit-content | -moz-min-content | -moz-max-content | -webkit-min-content | -webkit-max-content" }, "-webkit-gradient()": { comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/ - TODO: simplify when after match algorithm improvement ( [, point, radius | , point] -> [, radius]? , point )", @@ -22120,7 +22792,11 @@ }, "content-list": { comment: "missed -> https://drafts.csswg.org/css-content/#typedef-content-list (document-url, and leader() is omitted util stabilization)", - syntax: "[ | contents | | | | counter( , <'list-style-type'>? ) ]+" + syntax: "[ | contents | | | | | | counter( , <'list-style-type'>? ) ]+" + }, + "element()": { + comment: "https://drafts.csswg.org/css-gcpm/#element-syntax & https://drafts.csswg.org/css-images-4/#element-notation", + syntax: "element( , [ first | start | last | first-except ]? ) | element( )" }, "generic-voice": { comment: "https://www.w3.org/TR/css3-speech/#voice-family", @@ -22135,11 +22811,11 @@ references: [ "https://webkit.org/blog/3709/using-the-system-font-in-web-content/" ], - syntax: "serif | sans-serif | cursive | fantasy | monospace | -apple-system" + syntax: "| -apple-system" }, gradient: { comment: "added legacy syntaxes support", - syntax: " | | | | | <-legacy-gradient>" + syntax: "| <-legacy-gradient>" }, left: { comment: "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect", @@ -22155,15 +22831,15 @@ }, "named-color": { comment: "added non standard color names", - syntax: "transparent | aliceblue | antiquewhite | aqua | aquamarine | azure | beige | bisque | black | blanchedalmond | blue | blueviolet | brown | burlywood | cadetblue | chartreuse | chocolate | coral | cornflowerblue | cornsilk | crimson | cyan | darkblue | darkcyan | darkgoldenrod | darkgray | darkgreen | darkgrey | darkkhaki | darkmagenta | darkolivegreen | darkorange | darkorchid | darkred | darksalmon | darkseagreen | darkslateblue | darkslategray | darkslategrey | darkturquoise | darkviolet | deeppink | deepskyblue | dimgray | dimgrey | dodgerblue | firebrick | floralwhite | forestgreen | fuchsia | gainsboro | ghostwhite | gold | goldenrod | gray | green | greenyellow | grey | honeydew | hotpink | indianred | indigo | ivory | khaki | lavender | lavenderblush | lawngreen | lemonchiffon | lightblue | lightcoral | lightcyan | lightgoldenrodyellow | lightgray | lightgreen | lightgrey | lightpink | lightsalmon | lightseagreen | lightskyblue | lightslategray | lightslategrey | lightsteelblue | lightyellow | lime | limegreen | linen | magenta | maroon | mediumaquamarine | mediumblue | mediumorchid | mediumpurple | mediumseagreen | mediumslateblue | mediumspringgreen | mediumturquoise | mediumvioletred | midnightblue | mintcream | mistyrose | moccasin | navajowhite | navy | oldlace | olive | olivedrab | orange | orangered | orchid | palegoldenrod | palegreen | paleturquoise | palevioletred | papayawhip | peachpuff | peru | pink | plum | powderblue | purple | rebeccapurple | red | rosybrown | royalblue | saddlebrown | salmon | sandybrown | seagreen | seashell | sienna | silver | skyblue | slateblue | slategray | slategrey | snow | springgreen | steelblue | tan | teal | thistle | tomato | turquoise | violet | wheat | white | whitesmoke | yellow | yellowgreen | <-non-standard-color>" + syntax: "| <-non-standard-color>" }, paint: { comment: "used by SVG https://www.w3.org/TR/SVG/painting.html#SpecifyingPaint", syntax: "none | | [ none | ]? | context-fill | context-stroke" }, - "path()": { - comment: "missed, `motion` property was renamed, but left it as is for now; path() syntax was get from last draft https://drafts.fxtf.org/motion-1/#funcdef-offset-path-path", - syntax: "path( )" + "page-size": { + comment: "https://www.w3.org/TR/css-page-3/#typedef-page-size-page-size", + syntax: "A5 | A4 | A3 | B5 | B4 | JIS-B5 | JIS-B4 | letter | legal | ledger" }, ratio: { comment: "missed, https://drafts.csswg.org/mediaqueries-4/#typedef-ratio", @@ -22240,39 +22916,34 @@ }, "positive-integer": { syntax: "" + }, + "-non-standard-display": { + syntax: "-ms-inline-flexbox | -ms-grid | -ms-inline-grid | -webkit-flex | -webkit-inline-flex | -webkit-box | -webkit-inline-box | -moz-inline-stack | -moz-box | -moz-inline-box" } }; - var patch = { - properties: properties$3, - syntaxes: syntaxes$2 + var require$$3 = { + atrules: atrules, + properties: properties, + syntaxes: syntaxes }; - var patch$1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - properties: properties$3, - syntaxes: syntaxes$2, - 'default': patch - }); - - var mdnAtrules = getCjsExportFromNamespace(atRules$1); - - var mdnProperties = getCjsExportFromNamespace(properties$2); - - var mdnSyntaxes = getCjsExportFromNamespace(syntaxes$1); - - var patch$2 = getCjsExportFromNamespace(patch$1); + const mdnAtrules = require$$0; + const mdnProperties = require$$1; + const mdnSyntaxes = require$$2; + const patch = require$$3; + const extendSyntax = /^\s*\|\s*/; function preprocessAtrules(dict) { - var result = Object.create(null); + const result = Object.create(null); - for (var atruleName in dict) { - var atrule = dict[atruleName]; - var descriptors = null; + for (const atruleName in dict) { + const atrule = dict[atruleName]; + let descriptors = null; if (atrule.descriptors) { descriptors = Object.create(null); - for (var descriptor in atrule.descriptors) { + for (const descriptor in atrule.descriptors) { descriptors[descriptor] = atrule.descriptors[descriptor].syntax; } } @@ -22286,25 +22957,27 @@ return result; } - function buildDictionary(dict, patchDict) { - var result = {}; + function patchDictionary(dict, patchDict) { + const result = {}; // copy all syntaxes for an original dict - for (var key in dict) { - result[key] = dict[key].syntax; + for (const key in dict) { + result[key] = dict[key].syntax || dict[key]; } // apply a patch - for (var key in patchDict) { + for (const key in patchDict) { if (key in dict) { if (patchDict[key].syntax) { - result[key] = patchDict[key].syntax; + result[key] = extendSyntax.test(patchDict[key].syntax) + ? result[key] + ' ' + patchDict[key].syntax.trim() + : patchDict[key].syntax; } else { delete result[key]; } } else { if (patchDict[key].syntax) { - result[key] = patchDict[key].syntax; + result[key] = patchDict[key].syntax.replace(extendSyntax, ''); } } } @@ -22312,32 +22985,72 @@ return result; } - var data = { - types: buildDictionary(mdnSyntaxes, patch$2.syntaxes), - atrules: preprocessAtrules(mdnAtrules), - properties: buildDictionary(mdnProperties, patch$2.properties) + function unpackSyntaxes(dict) { + const result = {}; + + for (const key in dict) { + result[key] = dict[key].syntax; + } + + return result; + } + + function patchAtrules(dict, patchDict) { + const result = {}; + + // copy all syntaxes for an original dict + for (const key in dict) { + const patchDescriptors = (patchDict[key] && patchDict[key].descriptors) || null; + + result[key] = { + prelude: key in patchDict && 'prelude' in patchDict[key] + ? patchDict[key].prelude + : dict[key].prelude || null, + descriptors: dict[key].descriptors + ? patchDictionary(dict[key].descriptors, patchDescriptors || {}) + : patchDescriptors && unpackSyntaxes(patchDescriptors) + }; + } + + // apply a patch + for (const key in patchDict) { + if (!hasOwnProperty.call(dict, key)) { + result[key] = { + prelude: patchDict[key].prelude || null, + descriptors: patchDict[key].descriptors && unpackSyntaxes(patchDict[key].descriptors) + }; + } + } + + return result; + } + + var data$1 = { + types: patchDictionary(mdnSyntaxes, patch.syntaxes), + atrules: patchAtrules(preprocessAtrules(mdnAtrules), patch.atrules), + properties: patchDictionary(mdnProperties, patch.properties) }; - var cmpChar$3 = tokenizer.cmpChar; - var isDigit$4 = tokenizer.isDigit; - var TYPE$9 = tokenizer.TYPE; + var cmpChar$2 = tokenizer$3.cmpChar; + var isDigit$1 = tokenizer$3.isDigit; + var TYPE$y = tokenizer$3.TYPE; - var WHITESPACE$4 = TYPE$9.WhiteSpace; - var COMMENT$3 = TYPE$9.Comment; - var IDENT$3 = TYPE$9.Ident; - var NUMBER$3 = TYPE$9.Number; - var DIMENSION$2 = TYPE$9.Dimension; - var PLUSSIGN$3 = 0x002B; // U+002B PLUS SIGN (+) - var HYPHENMINUS$3 = 0x002D; // U+002D HYPHEN-MINUS (-) - var N$4 = 0x006E; // U+006E LATIN SMALL LETTER N (n) - var DISALLOW_SIGN$1 = true; - var ALLOW_SIGN$1 = false; + var WHITESPACE$8 = TYPE$y.WhiteSpace; + var COMMENT$6 = TYPE$y.Comment; + var IDENT$f = TYPE$y.Ident; + var NUMBER$6 = TYPE$y.Number; + var DIMENSION$5 = TYPE$y.Dimension; + var PLUSSIGN$5 = 0x002B; // U+002B PLUS SIGN (+) + var HYPHENMINUS$2 = 0x002D; // U+002D HYPHEN-MINUS (-) + var N = 0x006E; // U+006E LATIN SMALL LETTER N (n) + var DISALLOW_SIGN = true; + var ALLOW_SIGN = false; - function checkInteger$1(offset, disallowSign) { + function checkInteger(offset, disallowSign) { var pos = this.scanner.tokenStart + offset; var code = this.scanner.source.charCodeAt(pos); - if (code === PLUSSIGN$3 || code === HYPHENMINUS$3) { + if (code === PLUSSIGN$5 || code === HYPHENMINUS$2) { if (disallowSign) { this.error('Number sign is not allowed'); } @@ -22345,25 +23058,25 @@ } for (; pos < this.scanner.tokenEnd; pos++) { - if (!isDigit$4(this.scanner.source.charCodeAt(pos))) { + if (!isDigit$1(this.scanner.source.charCodeAt(pos))) { this.error('Integer is expected', pos); } } } function checkTokenIsInteger(disallowSign) { - return checkInteger$1.call(this, 0, disallowSign); + return checkInteger.call(this, 0, disallowSign); } function expectCharCode(offset, code) { - if (!cmpChar$3(this.scanner.source, this.scanner.tokenStart + offset, code)) { + if (!cmpChar$2(this.scanner.source, this.scanner.tokenStart + offset, code)) { var msg = ''; switch (code) { - case N$4: + case N: msg = 'N is expected'; break; - case HYPHENMINUS$3: + case HYPHENMINUS$2: msg = 'HyphenMinus is expected'; break; } @@ -22374,27 +23087,27 @@ // ... // ... ['+' | '-'] - function consumeB$1() { + function consumeB() { var offset = 0; var sign = 0; var type = this.scanner.tokenType; - while (type === WHITESPACE$4 || type === COMMENT$3) { + while (type === WHITESPACE$8 || type === COMMENT$6) { type = this.scanner.lookupType(++offset); } - if (type !== NUMBER$3) { - if (this.scanner.isDelim(PLUSSIGN$3, offset) || - this.scanner.isDelim(HYPHENMINUS$3, offset)) { - sign = this.scanner.isDelim(PLUSSIGN$3, offset) ? PLUSSIGN$3 : HYPHENMINUS$3; + if (type !== NUMBER$6) { + if (this.scanner.isDelim(PLUSSIGN$5, offset) || + this.scanner.isDelim(HYPHENMINUS$2, offset)) { + sign = this.scanner.isDelim(PLUSSIGN$5, offset) ? PLUSSIGN$5 : HYPHENMINUS$2; do { type = this.scanner.lookupType(++offset); - } while (type === WHITESPACE$4 || type === COMMENT$3); + } while (type === WHITESPACE$8 || type === COMMENT$6); - if (type !== NUMBER$3) { + if (type !== NUMBER$6) { this.scanner.skip(offset); - checkTokenIsInteger.call(this, DISALLOW_SIGN$1); + checkTokenIsInteger.call(this, DISALLOW_SIGN); } } else { return null; @@ -22407,13 +23120,13 @@ if (sign === 0) { type = this.scanner.source.charCodeAt(this.scanner.tokenStart); - if (type !== PLUSSIGN$3 && type !== HYPHENMINUS$3) { + if (type !== PLUSSIGN$5 && type !== HYPHENMINUS$2) { this.error('Number sign is expected'); } } checkTokenIsInteger.call(this, sign !== 0); - return sign === HYPHENMINUS$3 ? '-' + this.consume(NUMBER$3) : this.consume(NUMBER$3); + return sign === HYPHENMINUS$2 ? '-' + this.consume(NUMBER$6) : this.consume(NUMBER$6); } // An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb @@ -22430,9 +23143,9 @@ var b = null; // - if (this.scanner.tokenType === NUMBER$3) { - checkTokenIsInteger.call(this, ALLOW_SIGN$1); - b = this.consume(NUMBER$3); + if (this.scanner.tokenType === NUMBER$6) { + checkTokenIsInteger.call(this, ALLOW_SIGN); + b = this.consume(NUMBER$6); } // -n @@ -22440,10 +23153,10 @@ // -n ['+' | '-'] // -n- // - else if (this.scanner.tokenType === IDENT$3 && cmpChar$3(this.scanner.source, this.scanner.tokenStart, HYPHENMINUS$3)) { + else if (this.scanner.tokenType === IDENT$f && cmpChar$2(this.scanner.source, this.scanner.tokenStart, HYPHENMINUS$2)) { a = '-1'; - expectCharCode.call(this, 1, N$4); + expectCharCode.call(this, 1, N); switch (this.scanner.getTokenLength()) { // -n @@ -22451,25 +23164,25 @@ // -n ['+' | '-'] case 2: this.scanner.next(); - b = consumeB$1.call(this); + b = consumeB.call(this); break; // -n- case 3: - expectCharCode.call(this, 2, HYPHENMINUS$3); + expectCharCode.call(this, 2, HYPHENMINUS$2); this.scanner.next(); this.scanner.skipSC(); - checkTokenIsInteger.call(this, DISALLOW_SIGN$1); + checkTokenIsInteger.call(this, DISALLOW_SIGN); - b = '-' + this.consume(NUMBER$3); + b = '-' + this.consume(NUMBER$6); break; // default: - expectCharCode.call(this, 2, HYPHENMINUS$3); - checkInteger$1.call(this, 3, DISALLOW_SIGN$1); + expectCharCode.call(this, 2, HYPHENMINUS$2); + checkInteger.call(this, 3, DISALLOW_SIGN); this.scanner.next(); b = this.scanner.substrToCursor(start + 2); @@ -22481,17 +23194,17 @@ // '+'? n ['+' | '-'] // '+'? n- // '+'? - else if (this.scanner.tokenType === IDENT$3 || (this.scanner.isDelim(PLUSSIGN$3) && this.scanner.lookupType(1) === IDENT$3)) { + else if (this.scanner.tokenType === IDENT$f || (this.scanner.isDelim(PLUSSIGN$5) && this.scanner.lookupType(1) === IDENT$f)) { var sign = 0; a = '1'; // just ignore a plus - if (this.scanner.isDelim(PLUSSIGN$3)) { + if (this.scanner.isDelim(PLUSSIGN$5)) { sign = 1; this.scanner.next(); } - expectCharCode.call(this, 0, N$4); + expectCharCode.call(this, 0, N); switch (this.scanner.getTokenLength()) { // '+'? n @@ -22499,25 +23212,25 @@ // '+'? n ['+' | '-'] case 1: this.scanner.next(); - b = consumeB$1.call(this); + b = consumeB.call(this); break; // '+'? n- case 2: - expectCharCode.call(this, 1, HYPHENMINUS$3); + expectCharCode.call(this, 1, HYPHENMINUS$2); this.scanner.next(); this.scanner.skipSC(); - checkTokenIsInteger.call(this, DISALLOW_SIGN$1); + checkTokenIsInteger.call(this, DISALLOW_SIGN); - b = '-' + this.consume(NUMBER$3); + b = '-' + this.consume(NUMBER$6); break; // '+'? default: - expectCharCode.call(this, 1, HYPHENMINUS$3); - checkInteger$1.call(this, 2, DISALLOW_SIGN$1); + expectCharCode.call(this, 1, HYPHENMINUS$2); + checkInteger.call(this, 2, DISALLOW_SIGN); this.scanner.next(); b = this.scanner.substrToCursor(start + sign + 1); @@ -22529,12 +23242,12 @@ // // // ['+' | '-'] - else if (this.scanner.tokenType === DIMENSION$2) { + else if (this.scanner.tokenType === DIMENSION$5) { var code = this.scanner.source.charCodeAt(this.scanner.tokenStart); - var sign = code === PLUSSIGN$3 || code === HYPHENMINUS$3; + var sign = code === PLUSSIGN$5 || code === HYPHENMINUS$2; for (var i = this.scanner.tokenStart + sign; i < this.scanner.tokenEnd; i++) { - if (!isDigit$4(this.scanner.source.charCodeAt(i))) { + if (!isDigit$1(this.scanner.source.charCodeAt(i))) { break; } } @@ -22543,7 +23256,7 @@ this.error('Integer is expected', this.scanner.tokenStart + sign); } - expectCharCode.call(this, i - this.scanner.tokenStart, N$4); + expectCharCode.call(this, i - this.scanner.tokenStart, N); a = this.scanner.source.substring(start, i); // @@ -22551,20 +23264,20 @@ // ['+' | '-'] if (i + 1 === this.scanner.tokenEnd) { this.scanner.next(); - b = consumeB$1.call(this); + b = consumeB.call(this); } else { - expectCharCode.call(this, i - this.scanner.tokenStart + 1, HYPHENMINUS$3); + expectCharCode.call(this, i - this.scanner.tokenStart + 1, HYPHENMINUS$2); // if (i + 2 === this.scanner.tokenEnd) { this.scanner.next(); this.scanner.skipSC(); - checkTokenIsInteger.call(this, DISALLOW_SIGN$1); - b = '-' + this.consume(NUMBER$3); + checkTokenIsInteger.call(this, DISALLOW_SIGN); + b = '-' + this.consume(NUMBER$6); } // else { - checkInteger$1.call(this, i - this.scanner.tokenStart + 2, DISALLOW_SIGN$1); + checkInteger.call(this, i - this.scanner.tokenStart + 2, DISALLOW_SIGN); this.scanner.next(); b = this.scanner.substrToCursor(i + 1); } @@ -22573,11 +23286,11 @@ this.error(); } - if (a !== null && a.charCodeAt(0) === PLUSSIGN$3) { + if (a !== null && a.charCodeAt(0) === PLUSSIGN$5) { a = a.substr(1); } - if (b !== null && b.charCodeAt(0) === PLUSSIGN$3) { + if (b !== null && b.charCodeAt(0) === PLUSSIGN$5) { b = b.substr(1); } @@ -22616,17 +23329,18 @@ } }; - var TYPE$a = tokenizer.TYPE; + var tokenizer = tokenizer$3; + var TYPE$x = tokenizer.TYPE; - var WhiteSpace = TYPE$a.WhiteSpace; - var Semicolon = TYPE$a.Semicolon; - var LeftCurlyBracket = TYPE$a.LeftCurlyBracket; - var Delim = TYPE$a.Delim; - var EXCLAMATIONMARK$1 = 0x0021; // U+0021 EXCLAMATION MARK (!) + var WhiteSpace$1 = TYPE$x.WhiteSpace; + var Semicolon = TYPE$x.Semicolon; + var LeftCurlyBracket = TYPE$x.LeftCurlyBracket; + var Delim = TYPE$x.Delim; + var EXCLAMATIONMARK$2 = 0x0021; // U+0021 EXCLAMATION MARK (!) function getOffsetExcludeWS() { if (this.scanner.tokenIndex > 0) { - if (this.scanner.lookupType(-1) === WhiteSpace) { + if (this.scanner.lookupType(-1) === WhiteSpace$1) { return this.scanner.tokenIndex > 1 ? this.scanner.getTokenStart(this.scanner.tokenIndex - 1) : this.scanner.firstCharOffset; @@ -22653,7 +23367,7 @@ // EXCLAMATIONMARK, SEMICOLON, false function exclamationMarkOrSemicolon(tokenType, source, offset) { - if (tokenType === Delim && source.charCodeAt(offset) === EXCLAMATIONMARK$1) { + if (tokenType === Delim && source.charCodeAt(offset) === EXCLAMATIONMARK$2) { return 1; } @@ -22703,16 +23417,16 @@ } }; - var TYPE$b = tokenizer.TYPE; - var rawMode = Raw.mode; + var TYPE$w = tokenizer$3.TYPE; + var rawMode$5 = Raw.mode; - var ATKEYWORD = TYPE$b.AtKeyword; - var SEMICOLON = TYPE$b.Semicolon; - var LEFTCURLYBRACKET$1 = TYPE$b.LeftCurlyBracket; - var RIGHTCURLYBRACKET$1 = TYPE$b.RightCurlyBracket; + var ATKEYWORD$2 = TYPE$w.AtKeyword; + var SEMICOLON$4 = TYPE$w.Semicolon; + var LEFTCURLYBRACKET$3 = TYPE$w.LeftCurlyBracket; + var RIGHTCURLYBRACKET$1 = TYPE$w.RightCurlyBracket; - function consumeRaw(startToken) { - return this.Raw(startToken, rawMode.leftCurlyBracketOrSemicolon, true); + function consumeRaw$5(startToken) { + return this.Raw(startToken, rawMode$5.leftCurlyBracketOrSemicolon, true); } function isDeclarationBlockAtrule() { @@ -22721,8 +23435,8 @@ return true; } - if (type === LEFTCURLYBRACKET$1 || - type === ATKEYWORD) { + if (type === LEFTCURLYBRACKET$3 || + type === ATKEYWORD$2) { return false; } } @@ -22744,7 +23458,7 @@ var prelude = null; var block = null; - this.eat(ATKEYWORD); + this.eat(ATKEYWORD$2); name = this.scanner.substrToCursor(start + 1); nameLowerCase = name.toLowerCase(); @@ -22752,28 +23466,28 @@ // parse prelude if (this.scanner.eof === false && - this.scanner.tokenType !== LEFTCURLYBRACKET$1 && - this.scanner.tokenType !== SEMICOLON) { + this.scanner.tokenType !== LEFTCURLYBRACKET$3 && + this.scanner.tokenType !== SEMICOLON$4) { if (this.parseAtrulePrelude) { - prelude = this.parseWithFallback(this.AtrulePrelude.bind(this, name), consumeRaw); + prelude = this.parseWithFallback(this.AtrulePrelude.bind(this, name), consumeRaw$5); // turn empty AtrulePrelude into null if (prelude.type === 'AtrulePrelude' && prelude.children.head === null) { prelude = null; } } else { - prelude = consumeRaw.call(this, this.scanner.tokenIndex); + prelude = consumeRaw$5.call(this, this.scanner.tokenIndex); } this.scanner.skipSC(); } switch (this.scanner.tokenType) { - case SEMICOLON: + case SEMICOLON$4: this.scanner.next(); break; - case LEFTCURLYBRACKET$1: + case LEFTCURLYBRACKET$3: if (this.atrule.hasOwnProperty(nameLowerCase) && typeof this.atrule[nameLowerCase].block === 'function') { block = this.atrule[nameLowerCase].block.call(this); @@ -22811,10 +23525,10 @@ walkContext: 'atrule' }; - var TYPE$c = tokenizer.TYPE; + var TYPE$v = tokenizer$3.TYPE; - var SEMICOLON$1 = TYPE$c.Semicolon; - var LEFTCURLYBRACKET$2 = TYPE$c.LeftCurlyBracket; + var SEMICOLON$3 = TYPE$v.Semicolon; + var LEFTCURLYBRACKET$2 = TYPE$v.LeftCurlyBracket; var AtrulePrelude = { name: 'AtrulePrelude', @@ -22843,7 +23557,7 @@ if (this.scanner.eof !== true && this.scanner.tokenType !== LEFTCURLYBRACKET$2 && - this.scanner.tokenType !== SEMICOLON$1) { + this.scanner.tokenType !== SEMICOLON$3) { this.error('Semicolon or block is expected'); } @@ -22863,19 +23577,19 @@ walkContext: 'atrulePrelude' }; - var TYPE$d = tokenizer.TYPE; + var TYPE$u = tokenizer$3.TYPE; - var IDENT$4 = TYPE$d.Ident; - var STRING = TYPE$d.String; - var COLON = TYPE$d.Colon; - var LEFTSQUAREBRACKET$1 = TYPE$d.LeftSquareBracket; - var RIGHTSQUAREBRACKET$1 = TYPE$d.RightSquareBracket; - var DOLLARSIGN = 0x0024; // U+0024 DOLLAR SIGN ($) - var ASTERISK$1 = 0x002A; // U+002A ASTERISK (*) + var IDENT$e = TYPE$u.Ident; + var STRING$3 = TYPE$u.String; + var COLON$6 = TYPE$u.Colon; + var LEFTSQUAREBRACKET$3 = TYPE$u.LeftSquareBracket; + var RIGHTSQUAREBRACKET$1 = TYPE$u.RightSquareBracket; + var DOLLARSIGN$1 = 0x0024; // U+0024 DOLLAR SIGN ($) + var ASTERISK$5 = 0x002A; // U+002A ASTERISK (*) var EQUALSSIGN = 0x003D; // U+003D EQUALS SIGN (=) var CIRCUMFLEXACCENT = 0x005E; // U+005E (^) - var VERTICALLINE$1 = 0x007C; // U+007C VERTICAL LINE (|) - var TILDE = 0x007E; // U+007E TILDE (~) + var VERTICALLINE$2 = 0x007C; // U+007C VERTICAL LINE (|) + var TILDE$2 = 0x007E; // U+007E TILDE (~) function getAttributeName() { if (this.scanner.eof) { @@ -22886,18 +23600,18 @@ var expectIdent = false; var checkColon = true; - if (this.scanner.isDelim(ASTERISK$1)) { + if (this.scanner.isDelim(ASTERISK$5)) { expectIdent = true; checkColon = false; this.scanner.next(); - } else if (!this.scanner.isDelim(VERTICALLINE$1)) { - this.eat(IDENT$4); + } else if (!this.scanner.isDelim(VERTICALLINE$2)) { + this.eat(IDENT$e); } - if (this.scanner.isDelim(VERTICALLINE$1)) { + if (this.scanner.isDelim(VERTICALLINE$2)) { if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 1) !== EQUALSSIGN) { this.scanner.next(); - this.eat(IDENT$4); + this.eat(IDENT$e); } else if (expectIdent) { this.error('Identifier is expected', this.scanner.tokenEnd); } @@ -22905,9 +23619,9 @@ this.error('Vertical line is expected'); } - if (checkColon && this.scanner.tokenType === COLON) { + if (checkColon && this.scanner.tokenType === COLON$6) { this.scanner.next(); - this.eat(IDENT$4); + this.eat(IDENT$e); } return { @@ -22922,11 +23636,11 @@ var code = this.scanner.source.charCodeAt(start); if (code !== EQUALSSIGN && // = - code !== TILDE && // ~= + code !== TILDE$2 && // ~= code !== CIRCUMFLEXACCENT && // ^= - code !== DOLLARSIGN && // $= - code !== ASTERISK$1 && // *= - code !== VERTICALLINE$1 // |= + code !== DOLLARSIGN$1 && // $= + code !== ASTERISK$5 && // *= + code !== VERTICALLINE$2 // |= ) { this.error('Attribute selector (=, ~=, ^=, $=, *=, |=) is expected'); } @@ -22961,7 +23675,7 @@ var value = null; var flags = null; - this.eat(LEFTSQUAREBRACKET$1); + this.eat(LEFTSQUAREBRACKET$3); this.scanner.skipSC(); name = getAttributeName.call(this); @@ -22969,12 +23683,12 @@ if (this.scanner.tokenType !== RIGHTSQUAREBRACKET$1) { // avoid case `[name i]` - if (this.scanner.tokenType !== IDENT$4) { + if (this.scanner.tokenType !== IDENT$e) { matcher = getOperator.call(this); this.scanner.skipSC(); - value = this.scanner.tokenType === STRING + value = this.scanner.tokenType === STRING$3 ? this.String() : this.Identifier(); @@ -22982,7 +23696,7 @@ } // attribute flags - if (this.scanner.tokenType === IDENT$4) { + if (this.scanner.tokenType === IDENT$e) { flags = this.scanner.getTokenValue(); this.scanner.next(); @@ -23029,24 +23743,24 @@ } }; - var TYPE$e = tokenizer.TYPE; - var rawMode$1 = Raw.mode; + var TYPE$t = tokenizer$3.TYPE; + var rawMode$4 = Raw.mode; - var WHITESPACE$5 = TYPE$e.WhiteSpace; - var COMMENT$4 = TYPE$e.Comment; - var SEMICOLON$2 = TYPE$e.Semicolon; - var ATKEYWORD$1 = TYPE$e.AtKeyword; - var LEFTCURLYBRACKET$3 = TYPE$e.LeftCurlyBracket; - var RIGHTCURLYBRACKET$2 = TYPE$e.RightCurlyBracket; + var WHITESPACE$7 = TYPE$t.WhiteSpace; + var COMMENT$5 = TYPE$t.Comment; + var SEMICOLON$2 = TYPE$t.Semicolon; + var ATKEYWORD$1 = TYPE$t.AtKeyword; + var LEFTCURLYBRACKET$1 = TYPE$t.LeftCurlyBracket; + var RIGHTCURLYBRACKET = TYPE$t.RightCurlyBracket; - function consumeRaw$1(startToken) { + function consumeRaw$4(startToken) { return this.Raw(startToken, null, true); } function consumeRule() { - return this.parseWithFallback(this.Rule, consumeRaw$1); + return this.parseWithFallback(this.Rule, consumeRaw$4); } function consumeRawDeclaration(startToken) { - return this.Raw(startToken, rawMode$1.semicolonIncluded, true); + return this.Raw(startToken, rawMode$4.semicolonIncluded, true); } function consumeDeclaration() { if (this.scanner.tokenType === SEMICOLON$2) { @@ -23077,21 +23791,21 @@ var start = this.scanner.tokenStart; var children = this.createList(); - this.eat(LEFTCURLYBRACKET$3); + this.eat(LEFTCURLYBRACKET$1); scan: while (!this.scanner.eof) { switch (this.scanner.tokenType) { - case RIGHTCURLYBRACKET$2: + case RIGHTCURLYBRACKET: break scan; - case WHITESPACE$5: - case COMMENT$4: + case WHITESPACE$7: + case COMMENT$5: this.scanner.next(); break; case ATKEYWORD$1: - children.push(this.parseWithFallback(this.Atrule, consumeRaw$1)); + children.push(this.parseWithFallback(this.Atrule, consumeRaw$4)); break; default: @@ -23100,7 +23814,7 @@ } if (!this.scanner.eof) { - this.eat(RIGHTCURLYBRACKET$2); + this.eat(RIGHTCURLYBRACKET); } return { @@ -23121,10 +23835,10 @@ walkContext: 'block' }; - var TYPE$f = tokenizer.TYPE; + var TYPE$s = tokenizer$3.TYPE; - var LEFTSQUAREBRACKET$2 = TYPE$f.LeftSquareBracket; - var RIGHTSQUAREBRACKET$2 = TYPE$f.RightSquareBracket; + var LEFTSQUAREBRACKET$2 = TYPE$s.LeftSquareBracket; + var RIGHTSQUAREBRACKET = TYPE$s.RightSquareBracket; var Brackets = { name: 'Brackets', @@ -23140,7 +23854,7 @@ children = readSequence.call(this, recognizer); if (!this.scanner.eof) { - this.eat(RIGHTSQUAREBRACKET$2); + this.eat(RIGHTSQUAREBRACKET); } return { @@ -23156,7 +23870,7 @@ } }; - var CDC = tokenizer.TYPE.CDC; + var CDC$1 = tokenizer$3.TYPE.CDC; var CDC_1 = { name: 'CDC', @@ -23164,7 +23878,7 @@ parse: function() { var start = this.scanner.tokenStart; - this.eat(CDC); // --> + this.eat(CDC$1); // --> return { type: 'CDC', @@ -23176,7 +23890,7 @@ } }; - var CDO = tokenizer.TYPE.CDO; + var CDO$1 = tokenizer$3.TYPE.CDO; var CDO_1 = { name: 'CDO', @@ -23184,7 +23898,7 @@ parse: function() { var start = this.scanner.tokenStart; - this.eat(CDO); // + case CDC: // --> child = this.CDC(); break; // CSS Syntax Module Level 3 // §2.2 Error handling // At the "top level" of a stylesheet, an starts an at-rule. - case ATKEYWORD$2: - child = this.parseWithFallback(this.Atrule, consumeRaw$4); + case ATKEYWORD: + child = this.parseWithFallback(this.Atrule, consumeRaw$1); break; // Anything else starts a qualified rule ... default: - child = this.parseWithFallback(this.Rule, consumeRaw$4); + child = this.parseWithFallback(this.Rule, consumeRaw$1); } children.push(child); @@ -24425,15 +25153,15 @@ walkContext: 'stylesheet' }; - var TYPE$A = tokenizer.TYPE; + var TYPE$7 = tokenizer$3.TYPE; - var IDENT$d = TYPE$A.Ident; - var ASTERISK$4 = 0x002A; // U+002A ASTERISK (*) - var VERTICALLINE$2 = 0x007C; // U+007C VERTICAL LINE (|) + var IDENT$5 = TYPE$7.Ident; + var ASTERISK$2 = 0x002A; // U+002A ASTERISK (*) + var VERTICALLINE$1 = 0x007C; // U+007C VERTICAL LINE (|) function eatIdentifierOrAsterisk() { - if (this.scanner.tokenType !== IDENT$d && - this.scanner.isDelim(ASTERISK$4) === false) { + if (this.scanner.tokenType !== IDENT$5 && + this.scanner.isDelim(ASTERISK$2) === false) { this.error('Identifier or asterisk is expected'); } @@ -24456,13 +25184,13 @@ parse: function() { var start = this.scanner.tokenStart; - if (this.scanner.isDelim(VERTICALLINE$2)) { + if (this.scanner.isDelim(VERTICALLINE$1)) { this.scanner.next(); eatIdentifierOrAsterisk.call(this); } else { eatIdentifierOrAsterisk.call(this); - if (this.scanner.isDelim(VERTICALLINE$2)) { + if (this.scanner.isDelim(VERTICALLINE$1)) { this.scanner.next(); eatIdentifierOrAsterisk.call(this); } @@ -24479,24 +25207,24 @@ } }; - var isHexDigit$4 = tokenizer.isHexDigit; - var cmpChar$4 = tokenizer.cmpChar; - var TYPE$B = tokenizer.TYPE; - var NAME$3 = tokenizer.NAME; + var isHexDigit = tokenizer$3.isHexDigit; + var cmpChar$1 = tokenizer$3.cmpChar; + var TYPE$6 = tokenizer$3.TYPE; + var NAME = tokenizer$3.NAME; - var IDENT$e = TYPE$B.Ident; - var NUMBER$7 = TYPE$B.Number; - var DIMENSION$5 = TYPE$B.Dimension; - var PLUSSIGN$6 = 0x002B; // U+002B PLUS SIGN (+) - var HYPHENMINUS$4 = 0x002D; // U+002D HYPHEN-MINUS (-) - var QUESTIONMARK$2 = 0x003F; // U+003F QUESTION MARK (?) + var IDENT$4 = TYPE$6.Ident; + var NUMBER$2 = TYPE$6.Number; + var DIMENSION$2 = TYPE$6.Dimension; + var PLUSSIGN$2 = 0x002B; // U+002B PLUS SIGN (+) + var HYPHENMINUS$1 = 0x002D; // U+002D HYPHEN-MINUS (-) + var QUESTIONMARK = 0x003F; // U+003F QUESTION MARK (?) var U$1 = 0x0075; // U+0075 LATIN SMALL LETTER U (u) function eatHexSequence(offset, allowDash) { for (var pos = this.scanner.tokenStart + offset, len = 0; pos < this.scanner.tokenEnd; pos++) { var code = this.scanner.source.charCodeAt(pos); - if (code === HYPHENMINUS$4 && allowDash && len !== 0) { + if (code === HYPHENMINUS$1 && allowDash && len !== 0) { if (eatHexSequence.call(this, offset + len + 1, false) === 0) { this.error(); } @@ -24504,7 +25232,7 @@ return -1; } - if (!isHexDigit$4(code)) { + if (!isHexDigit(code)) { this.error( allowDash && len !== 0 ? 'HyphenMinus' + (len < 6 ? ' or hex digit' : '') + ' is expected' @@ -24524,7 +25252,7 @@ function eatQuestionMarkSequence(max) { var count = 0; - while (this.scanner.isDelim(QUESTIONMARK$2)) { + while (this.scanner.isDelim(QUESTIONMARK)) { if (++count > max) { this.error('Too many question marks'); } @@ -24533,9 +25261,9 @@ } } - function startsWith$1(code) { + function startsWith(code) { if (this.scanner.source.charCodeAt(this.scanner.tokenStart) !== code) { - this.error(NAME$3[code] + ' is expected'); + this.error(NAME[code] + ' is expected'); } } @@ -24563,10 +25291,10 @@ // u '+' '?'* // u '+' '?'+ - if (this.scanner.isDelim(PLUSSIGN$6)) { + if (this.scanner.isDelim(PLUSSIGN$2)) { this.scanner.next(); - if (this.scanner.tokenType === IDENT$e) { + if (this.scanner.tokenType === IDENT$4) { hexLength = eatHexSequence.call(this, 0, true); if (hexLength > 0) { eatQuestionMarkSequence.call(this, 6 - hexLength); @@ -24574,7 +25302,7 @@ return; } - if (this.scanner.isDelim(QUESTIONMARK$2)) { + if (this.scanner.isDelim(QUESTIONMARK)) { this.scanner.next(); eatQuestionMarkSequence.call(this, 5); return; @@ -24587,18 +25315,18 @@ // u '?'* // u // u - if (this.scanner.tokenType === NUMBER$7) { - startsWith$1.call(this, PLUSSIGN$6); + if (this.scanner.tokenType === NUMBER$2) { + startsWith.call(this, PLUSSIGN$2); hexLength = eatHexSequence.call(this, 1, true); - if (this.scanner.isDelim(QUESTIONMARK$2)) { + if (this.scanner.isDelim(QUESTIONMARK)) { eatQuestionMarkSequence.call(this, 6 - hexLength); return; } - if (this.scanner.tokenType === DIMENSION$5 || - this.scanner.tokenType === NUMBER$7) { - startsWith$1.call(this, HYPHENMINUS$4); + if (this.scanner.tokenType === DIMENSION$2 || + this.scanner.tokenType === NUMBER$2) { + startsWith.call(this, HYPHENMINUS$1); eatHexSequence.call(this, 1, false); return; } @@ -24607,8 +25335,8 @@ } // u '?'* - if (this.scanner.tokenType === DIMENSION$5) { - startsWith$1.call(this, PLUSSIGN$6); + if (this.scanner.tokenType === DIMENSION$2) { + startsWith.call(this, PLUSSIGN$2); hexLength = eatHexSequence.call(this, 1, true); if (hexLength > 0) { @@ -24630,11 +25358,11 @@ var start = this.scanner.tokenStart; // U or u - if (!cmpChar$4(this.scanner.source, start, U$1)) { + if (!cmpChar$1(this.scanner.source, start, U$1)) { this.error('U is expected'); } - if (!cmpChar$4(this.scanner.source, start + 1, PLUSSIGN$6)) { + if (!cmpChar$1(this.scanner.source, start + 1, PLUSSIGN$2)) { this.error('Plus sign is expected'); } @@ -24652,13 +25380,13 @@ } }; - var isWhiteSpace$2 = tokenizer.isWhiteSpace; - var cmpStr$4 = tokenizer.cmpStr; - var TYPE$C = tokenizer.TYPE; + var isWhiteSpace = tokenizer$3.isWhiteSpace; + var cmpStr$1 = tokenizer$3.cmpStr; + var TYPE$5 = tokenizer$3.TYPE; - var FUNCTION$3 = TYPE$C.Function; - var URL$2 = TYPE$C.Url; - var RIGHTPARENTHESIS$7 = TYPE$C.RightParenthesis; + var FUNCTION$3 = TYPE$5.Function; + var URL$3 = TYPE$5.Url; + var RIGHTPARENTHESIS = TYPE$5.RightParenthesis; // | ) var Url = { @@ -24671,15 +25399,15 @@ var value; switch (this.scanner.tokenType) { - case URL$2: + case URL$3: var rawStart = start + 4; var rawEnd = this.scanner.tokenEnd - 1; - while (rawStart < rawEnd && isWhiteSpace$2(this.scanner.source.charCodeAt(rawStart))) { + while (rawStart < rawEnd && isWhiteSpace(this.scanner.source.charCodeAt(rawStart))) { rawStart++; } - while (rawStart < rawEnd && isWhiteSpace$2(this.scanner.source.charCodeAt(rawEnd - 1))) { + while (rawStart < rawEnd && isWhiteSpace(this.scanner.source.charCodeAt(rawEnd - 1))) { rawEnd--; } @@ -24689,11 +25417,11 @@ value: this.scanner.source.substring(rawStart, rawEnd) }; - this.eat(URL$2); + this.eat(URL$3); break; case FUNCTION$3: - if (!cmpStr$4(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(')) { + if (!cmpStr$1(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(')) { this.error('Function name must be `url`'); } @@ -24701,7 +25429,7 @@ this.scanner.skipSC(); value = this.String(); this.scanner.skipSC(); - this.eat(RIGHTPARENTHESIS$7); + this.eat(RIGHTPARENTHESIS); break; default: @@ -24742,21 +25470,21 @@ } }; - var WHITESPACE$9 = tokenizer.TYPE.WhiteSpace; - var SPACE$2 = Object.freeze({ + var WHITESPACE$2 = tokenizer$3.TYPE.WhiteSpace; + var SPACE = Object.freeze({ type: 'WhiteSpace', loc: null, value: ' ' }); - var WhiteSpace$1 = { + var WhiteSpace = { name: 'WhiteSpace', structure: { value: String }, parse: function() { - this.eat(WHITESPACE$9); - return SPACE$2; + this.eat(WHITESPACE$2); + return SPACE; // return { // type: 'WhiteSpace', @@ -24785,7 +25513,7 @@ DeclarationList: DeclarationList, Dimension: Dimension, Function: _Function, - HexColor: HexColor, + Hash: Hash, Identifier: Identifier, IdSelector: IdSelector, MediaFeature: MediaFeature, @@ -24809,9 +25537,11 @@ UnicodeRange: UnicodeRange, Url: Url, Value: Value, - WhiteSpace: WhiteSpace$1 + WhiteSpace: WhiteSpace }; + var data = data$1; + var lexer = { generic: true, types: data.types, @@ -24820,87 +25550,87 @@ node: node }; - var cmpChar$5 = tokenizer.cmpChar; - var cmpStr$5 = tokenizer.cmpStr; - var TYPE$D = tokenizer.TYPE; + var cmpChar = tokenizer$3.cmpChar; + var cmpStr = tokenizer$3.cmpStr; + var TYPE$4 = tokenizer$3.TYPE; - var IDENT$f = TYPE$D.Ident; - var STRING$2 = TYPE$D.String; - var NUMBER$8 = TYPE$D.Number; - var FUNCTION$4 = TYPE$D.Function; - var URL$3 = TYPE$D.Url; - var HASH$4 = TYPE$D.Hash; - var DIMENSION$6 = TYPE$D.Dimension; - var PERCENTAGE$2 = TYPE$D.Percentage; - var LEFTPARENTHESIS$5 = TYPE$D.LeftParenthesis; - var LEFTSQUAREBRACKET$3 = TYPE$D.LeftSquareBracket; - var COMMA$3 = TYPE$D.Comma; - var DELIM$5 = TYPE$D.Delim; - var NUMBERSIGN$3 = 0x0023; // U+0023 NUMBER SIGN (#) - var ASTERISK$5 = 0x002A; // U+002A ASTERISK (*) - var PLUSSIGN$7 = 0x002B; // U+002B PLUS SIGN (+) - var HYPHENMINUS$5 = 0x002D; // U+002D HYPHEN-MINUS (-) - var SOLIDUS$4 = 0x002F; // U+002F SOLIDUS (/) - var U$2 = 0x0075; // U+0075 LATIN SMALL LETTER U (u) + var IDENT$3 = TYPE$4.Ident; + var STRING$1 = TYPE$4.String; + var NUMBER$1 = TYPE$4.Number; + var FUNCTION$2 = TYPE$4.Function; + var URL$2 = TYPE$4.Url; + var HASH$1 = TYPE$4.Hash; + var DIMENSION$1 = TYPE$4.Dimension; + var PERCENTAGE$1 = TYPE$4.Percentage; + var LEFTPARENTHESIS$2 = TYPE$4.LeftParenthesis; + var LEFTSQUAREBRACKET$1 = TYPE$4.LeftSquareBracket; + var COMMA$1 = TYPE$4.Comma; + var DELIM$1 = TYPE$4.Delim; + var NUMBERSIGN$1 = 0x0023; // U+0023 NUMBER SIGN (#) + var ASTERISK$1 = 0x002A; // U+002A ASTERISK (*) + var PLUSSIGN$1 = 0x002B; // U+002B PLUS SIGN (+) + var HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-) + var SOLIDUS$1 = 0x002F; // U+002F SOLIDUS (/) + var U = 0x0075; // U+0075 LATIN SMALL LETTER U (u) var _default = function defaultRecognizer(context) { switch (this.scanner.tokenType) { - case HASH$4: - return this.HexColor(); + case HASH$1: + return this.Hash(); - case COMMA$3: + case COMMA$1: context.space = null; context.ignoreWSAfter = true; return this.Operator(); - case LEFTPARENTHESIS$5: + case LEFTPARENTHESIS$2: return this.Parentheses(this.readSequence, context.recognizer); - case LEFTSQUAREBRACKET$3: + case LEFTSQUAREBRACKET$1: return this.Brackets(this.readSequence, context.recognizer); - case STRING$2: + case STRING$1: return this.String(); - case DIMENSION$6: + case DIMENSION$1: return this.Dimension(); - case PERCENTAGE$2: + case PERCENTAGE$1: return this.Percentage(); - case NUMBER$8: + case NUMBER$1: return this.Number(); - case FUNCTION$4: - return cmpStr$5(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(') + case FUNCTION$2: + return cmpStr(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(') ? this.Url() : this.Function(this.readSequence, context.recognizer); - case URL$3: + case URL$2: return this.Url(); - case IDENT$f: + case IDENT$3: // check for unicode range, it should start with u+ or U+ - if (cmpChar$5(this.scanner.source, this.scanner.tokenStart, U$2) && - cmpChar$5(this.scanner.source, this.scanner.tokenStart + 1, PLUSSIGN$7)) { + if (cmpChar(this.scanner.source, this.scanner.tokenStart, U) && + cmpChar(this.scanner.source, this.scanner.tokenStart + 1, PLUSSIGN$1)) { return this.UnicodeRange(); } else { return this.Identifier(); } - case DELIM$5: + case DELIM$1: var code = this.scanner.source.charCodeAt(this.scanner.tokenStart); - if (code === SOLIDUS$4 || - code === ASTERISK$5 || - code === PLUSSIGN$7 || - code === HYPHENMINUS$5) { + if (code === SOLIDUS$1 || + code === ASTERISK$1 || + code === PLUSSIGN$1 || + code === HYPHENMINUS) { return this.Operator(); // TODO: replace with Delim } // TODO: produce a node with Delim node type - if (code === NUMBERSIGN$3) { + if (code === NUMBERSIGN$1) { this.error('Hex or identifier is expected', this.scanner.tokenStart + 1); } @@ -24912,76 +25642,76 @@ getNode: _default }; - var TYPE$E = tokenizer.TYPE; + var TYPE$3 = tokenizer$3.TYPE; - var DELIM$6 = TYPE$E.Delim; - var IDENT$g = TYPE$E.Ident; - var DIMENSION$7 = TYPE$E.Dimension; - var PERCENTAGE$3 = TYPE$E.Percentage; - var NUMBER$9 = TYPE$E.Number; - var HASH$5 = TYPE$E.Hash; - var COLON$5 = TYPE$E.Colon; - var LEFTSQUAREBRACKET$4 = TYPE$E.LeftSquareBracket; - var NUMBERSIGN$4 = 0x0023; // U+0023 NUMBER SIGN (#) - var ASTERISK$6 = 0x002A; // U+002A ASTERISK (*) - var PLUSSIGN$8 = 0x002B; // U+002B PLUS SIGN (+) - var SOLIDUS$5 = 0x002F; // U+002F SOLIDUS (/) - var FULLSTOP$2 = 0x002E; // U+002E FULL STOP (.) - var GREATERTHANSIGN$2 = 0x003E; // U+003E GREATER-THAN SIGN (>) - var VERTICALLINE$3 = 0x007C; // U+007C VERTICAL LINE (|) - var TILDE$2 = 0x007E; // U+007E TILDE (~) + var DELIM = TYPE$3.Delim; + var IDENT$2 = TYPE$3.Ident; + var DIMENSION = TYPE$3.Dimension; + var PERCENTAGE = TYPE$3.Percentage; + var NUMBER = TYPE$3.Number; + var HASH = TYPE$3.Hash; + var COLON$1 = TYPE$3.Colon; + var LEFTSQUAREBRACKET = TYPE$3.LeftSquareBracket; + var NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#) + var ASTERISK = 0x002A; // U+002A ASTERISK (*) + var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+) + var SOLIDUS = 0x002F; // U+002F SOLIDUS (/) + var FULLSTOP = 0x002E; // U+002E FULL STOP (.) + var GREATERTHANSIGN = 0x003E; // U+003E GREATER-THAN SIGN (>) + var VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|) + var TILDE = 0x007E; // U+007E TILDE (~) function getNode(context) { switch (this.scanner.tokenType) { - case LEFTSQUAREBRACKET$4: + case LEFTSQUAREBRACKET: return this.AttributeSelector(); - case HASH$5: + case HASH: return this.IdSelector(); - case COLON$5: - if (this.scanner.lookupType(1) === COLON$5) { + case COLON$1: + if (this.scanner.lookupType(1) === COLON$1) { return this.PseudoElementSelector(); } else { return this.PseudoClassSelector(); } - case IDENT$g: + case IDENT$2: return this.TypeSelector(); - case NUMBER$9: - case PERCENTAGE$3: + case NUMBER: + case PERCENTAGE: return this.Percentage(); - case DIMENSION$7: + case DIMENSION: // throws when .123ident - if (this.scanner.source.charCodeAt(this.scanner.tokenStart) === FULLSTOP$2) { + if (this.scanner.source.charCodeAt(this.scanner.tokenStart) === FULLSTOP) { this.error('Identifier is expected', this.scanner.tokenStart + 1); } break; - case DELIM$6: + case DELIM: var code = this.scanner.source.charCodeAt(this.scanner.tokenStart); switch (code) { - case PLUSSIGN$8: - case GREATERTHANSIGN$2: - case TILDE$2: + case PLUSSIGN: + case GREATERTHANSIGN: + case TILDE: context.space = null; context.ignoreWSAfter = true; return this.Combinator(); - case SOLIDUS$5: // /deep/ + case SOLIDUS: // /deep/ return this.Combinator(); - case FULLSTOP$2: + case FULLSTOP: return this.ClassSelector(); - case ASTERISK$6: - case VERTICALLINE$3: + case ASTERISK: + case VERTICALLINE: return this.TypeSelector(); - case NUMBERSIGN$4: + case NUMBERSIGN: return this.IdSelector(); } @@ -24992,20 +25722,6 @@ getNode: getNode }; - // https://drafts.csswg.org/css-images-4/#element-notation - // https://developer.mozilla.org/en-US/docs/Web/CSS/element - var element = function() { - this.scanner.skipSC(); - - var children = this.createSingleNodeList( - this.IdSelector() - ); - - this.scanner.skipSC(); - - return children; - }; - // legacy IE function // expression( ) var expression = function() { @@ -25014,10 +25730,11 @@ ); }; - var TYPE$F = tokenizer.TYPE; - var rawMode$5 = Raw.mode; + var TYPE$2 = tokenizer$3.TYPE; + var rawMode = Raw.mode; - var COMMA$4 = TYPE$F.Comma; + var COMMA = TYPE$2.Comma; + var WHITESPACE$1 = TYPE$2.WhiteSpace; // var( , ? ) var _var = function() { @@ -25030,21 +25747,35 @@ this.scanner.skipSC(); - if (this.scanner.tokenType === COMMA$4) { + if (this.scanner.tokenType === COMMA) { children.push(this.Operator()); - children.push(this.parseCustomProperty + + const startIndex = this.scanner.tokenIndex; + const value = this.parseCustomProperty ? this.Value(null) - : this.Raw(this.scanner.tokenIndex, rawMode$5.exclamationMarkOrSemicolon, false) - ); + : this.Raw(this.scanner.tokenIndex, rawMode.exclamationMarkOrSemicolon, false); + + if (value.type === 'Value' && value.children.isEmpty()) { + for (let offset = startIndex - this.scanner.tokenIndex; offset <= 0; offset++) { + if (this.scanner.lookupType(offset) === WHITESPACE$1) { + value.children.appendData({ + type: 'WhiteSpace', + loc: null, + value: ' ' + }); + break; + } + } + } + + children.push(value); } return children; }; - var value = { + var value$2 = { getNode: _default, - '-moz-element': element, - 'element': element, 'expression': expression, 'var': _var }; @@ -25052,7 +25783,7 @@ var scope = { AtrulePrelude: atrulePrelude, Selector: selector, - Value: value + Value: value$2 }; var fontFace = { @@ -25064,13 +25795,13 @@ } }; - var TYPE$G = tokenizer.TYPE; + var TYPE$1 = tokenizer$3.TYPE; - var STRING$3 = TYPE$G.String; - var IDENT$h = TYPE$G.Ident; - var URL$4 = TYPE$G.Url; - var FUNCTION$5 = TYPE$G.Function; - var LEFTPARENTHESIS$6 = TYPE$G.LeftParenthesis; + var STRING = TYPE$1.String; + var IDENT$1 = TYPE$1.Ident; + var URL$1 = TYPE$1.Url; + var FUNCTION$1 = TYPE$1.Function; + var LEFTPARENTHESIS$1 = TYPE$1.LeftParenthesis; var _import = { parse: { @@ -25080,12 +25811,12 @@ this.scanner.skipSC(); switch (this.scanner.tokenType) { - case STRING$3: + case STRING: children.push(this.String()); break; - case URL$4: - case FUNCTION$5: + case URL$1: + case FUNCTION$1: children.push(this.Url()); break; @@ -25093,8 +25824,8 @@ this.error('String or url() is expected'); } - if (this.lookupNonWSType(0) === IDENT$h || - this.lookupNonWSType(0) === LEFTPARENTHESIS$6) { + if (this.lookupNonWSType(0) === IDENT$1 || + this.lookupNonWSType(0) === LEFTPARENTHESIS$1) { children.push(this.WhiteSpace()); children.push(this.MediaQueryList()); } @@ -25131,16 +25862,16 @@ } }; - var TYPE$H = tokenizer.TYPE; + var TYPE = tokenizer$3.TYPE; - var WHITESPACE$a = TYPE$H.WhiteSpace; - var COMMENT$9 = TYPE$H.Comment; - var IDENT$i = TYPE$H.Ident; - var FUNCTION$6 = TYPE$H.Function; - var COLON$6 = TYPE$H.Colon; - var LEFTPARENTHESIS$7 = TYPE$H.LeftParenthesis; + var WHITESPACE = TYPE.WhiteSpace; + var COMMENT = TYPE.Comment; + var IDENT = TYPE.Ident; + var FUNCTION = TYPE.Function; + var COLON = TYPE.Colon; + var LEFTPARENTHESIS = TYPE.LeftParenthesis; - function consumeRaw$5() { + function consumeRaw() { return this.createSingleNodeList( this.Raw(this.scanner.tokenIndex, null, false) ); @@ -25149,8 +25880,8 @@ function parentheses() { this.scanner.skipSC(); - if (this.scanner.tokenType === IDENT$i && - this.lookupNonWSType(1) === COLON$6) { + if (this.scanner.tokenType === IDENT && + this.lookupNonWSType(1) === COLON) { return this.createSingleNodeList( this.Declaration() ); @@ -25169,23 +25900,23 @@ scan: while (!this.scanner.eof) { switch (this.scanner.tokenType) { - case WHITESPACE$a: + case WHITESPACE: space = this.WhiteSpace(); continue; - case COMMENT$9: + case COMMENT: this.scanner.next(); continue; - case FUNCTION$6: - child = this.Function(consumeRaw$5, this.scope.AtrulePrelude); + case FUNCTION: + child = this.Function(consumeRaw, this.scope.AtrulePrelude); break; - case IDENT$i: + case IDENT: child = this.Identifier(); break; - case LEFTPARENTHESIS$7: + case LEFTPARENTHESIS: child = this.Parentheses(parentheses, this.scope.AtrulePrelude); break; @@ -25237,7 +25968,7 @@ } }; - var has$1 = { + var has = { parse: function() { return this.createSingleNodeList( this.SelectorList() @@ -25281,7 +26012,7 @@ var DISALLOW_OF_CLAUSE = false; - var nth$1 = { + var nth = { parse: function nth() { return this.createSingleNodeList( this.Nth(DISALLOW_OF_CLAUSE) @@ -25289,9 +26020,9 @@ } }; - var nthLastOfType = nth$1; + var nthLastOfType = nth; - var nthOfType = nth$1; + var nthOfType = nth; var slotted = { parse: function compoundSelector() { @@ -25303,7 +26034,7 @@ var pseudo = { 'dir': dir, - 'has': has$1, + 'has': has, 'lang': lang, 'matches': matches, 'not': not, @@ -25344,6 +26075,136 @@ node: node }; + var _args = [ + [ + "css-tree@1.1.3", + "/home/gitlab-runner/builds/BQJy2NwB/0/pagedjs/pagedjs" + ] + ]; + var _from = "css-tree@1.1.3"; + var _id = "css-tree@1.1.3"; + var _inBundle = false; + var _integrity = "sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q=="; + var _location = "/css-tree"; + var _phantomChildren = { + }; + var _requested = { + type: "version", + registry: true, + raw: "css-tree@1.1.3", + name: "css-tree", + escapedName: "css-tree", + rawSpec: "1.1.3", + saveSpec: null, + fetchSpec: "1.1.3" + }; + var _requiredBy = [ + "/" + ]; + var _resolved = "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz"; + var _spec = "1.1.3"; + var _where = "/home/gitlab-runner/builds/BQJy2NwB/0/pagedjs/pagedjs"; + var author = { + name: "Roman Dvornov", + email: "rdvornov@gmail.com", + url: "https://github.com/lahmatiy" + }; + var bugs = { + url: "https://github.com/csstree/csstree/issues" + }; + var dependencies = { + "mdn-data": "2.0.14", + "source-map": "^0.6.1" + }; + var description = "A tool set for CSS: fast detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation and matching) based on specs and browser implementations"; + var devDependencies = { + "@rollup/plugin-commonjs": "^11.0.2", + "@rollup/plugin-json": "^4.0.2", + "@rollup/plugin-node-resolve": "^7.1.1", + coveralls: "^3.0.9", + eslint: "^6.8.0", + "json-to-ast": "^2.1.0", + mocha: "^6.2.3", + nyc: "^14.1.1", + rollup: "^1.32.1", + "rollup-plugin-terser": "^5.3.0" + }; + var engines = { + node: ">=8.0.0" + }; + var files = [ + "data", + "dist", + "lib" + ]; + var homepage = "https://github.com/csstree/csstree#readme"; + var jsdelivr = "dist/csstree.min.js"; + var keywords = [ + "css", + "ast", + "tokenizer", + "parser", + "walker", + "lexer", + "generator", + "utils", + "syntax", + "validation" + ]; + var license = "MIT"; + var main = "lib/index.js"; + var name = "css-tree"; + var repository = { + type: "git", + url: "git+https://github.com/csstree/csstree.git" + }; + var scripts = { + build: "rollup --config", + coverage: "nyc npm test", + coveralls: "nyc report --reporter=text-lcov | coveralls", + hydrogen: "node --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces --redirect-code-traces-to=code.asm --trace_hydrogen_file=code.cfg --print-opt-code bin/parse --stat -o /dev/null", + lint: "eslint data lib scripts test && node scripts/review-syntax-patch --lint && node scripts/update-docs --lint", + "lint-and-test": "npm run lint && npm test", + prepublishOnly: "npm run build", + "review:syntax-patch": "node scripts/review-syntax-patch", + test: "mocha --reporter progress", + travis: "nyc npm run lint-and-test && npm run coveralls", + "update:docs": "node scripts/update-docs" + }; + var unpkg = "dist/csstree.min.js"; + var version = "1.1.3"; + var require$$4 = { + _args: _args, + _from: _from, + _id: _id, + _inBundle: _inBundle, + _integrity: _integrity, + _location: _location, + _phantomChildren: _phantomChildren, + _requested: _requested, + _requiredBy: _requiredBy, + _resolved: _resolved, + _spec: _spec, + _where: _where, + author: author, + bugs: bugs, + dependencies: dependencies, + description: description, + devDependencies: devDependencies, + engines: engines, + files: files, + homepage: homepage, + jsdelivr: jsdelivr, + keywords: keywords, + license: license, + main: main, + name: name, + repository: repository, + scripts: scripts, + unpkg: unpkg, + version: version + }; + function merge() { var dest = {}; @@ -25357,15 +26218,16 @@ return dest; } - var syntax = create$5.create( + syntax.exports = create$5.create( merge( lexer, parser, walker ) ); + syntax.exports.version = require$$4.version; - var lib = syntax; + var lib = syntax.exports; class Sheet { constructor(url, hooks) { @@ -25516,7 +26378,6 @@ lib.walk(ruleNode, { visit: "Selector", enter: (selectNode, selectItem, selectList) => { - // console.log(selectNode); this.hooks.onSelector.trigger(selectNode, selectItem, selectList, {ruleNode, ruleItem, rulelist}); if (selectNode.children.forEach(node => {if (node.type === "PseudoElementSelector") { @@ -25527,10 +26388,6 @@ } }); }})); - // else { - // console.log("dommage"); - // } - } }); } @@ -25691,6 +26548,7 @@ --pagedjs-height-left: 11in; --pagedjs-pagebox-width: 8.5in; --pagedjs-pagebox-height: 11in; + --pagedjs-footnotes-height: 0mm; --pagedjs-margin-top: 1in; --pagedjs-margin-right: 1in; --pagedjs-margin-bottom: 1in; @@ -25716,6 +26574,7 @@ --pagedjs-bleed-left-bottom: 0mm; --pagedjs-bleed-left-left: 0mm; --pagedjs-crop-color: black; + --pagedjs-crop-shadow: white; --pagedjs-crop-offset: 2mm; --pagedjs-crop-stroke: 1px; --pagedjs-cross-size: 5mm; @@ -25723,6 +26582,7 @@ --pagedjs-mark-crop-display: none; --pagedjs-page-count: 0; --pagedjs-page-counter-increment: 1; + --pagedjs-footnotes-count: 0; } @page { @@ -25798,6 +26658,7 @@ .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) { width: calc(var(--pagedjs-bleed-left) - var(--pagedjs-crop-stroke)); border-right: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color); + box-shadow: 1px 0px 0px 0px var(--pagedjs-crop-shadow); } .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1), @@ -25814,6 +26675,7 @@ .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) { width: calc(var(--pagedjs-bleed-right) - var(--pagedjs-crop-stroke)); border-left: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color); + box-shadow: -1px 0px 0px 0px var(--pagedjs-crop-shadow); } .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3), @@ -25856,6 +26718,7 @@ .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) { height: calc(var(--pagedjs-bleed-top) - var(--pagedjs-crop-stroke)); border-bottom: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color); + box-shadow: 0px 1px 0px 0px var(--pagedjs-crop-shadow); } .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1), @@ -25872,6 +26735,7 @@ .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) { height: calc(var(--pagedjs-bleed-bottom) - var(--pagedjs-crop-stroke)); border-top: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color); + box-shadow: 0px -1px 0px 0px var(--pagedjs-crop-shadow); } .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3), @@ -26056,11 +26920,86 @@ .pagedjs_pagebox > .pagedjs_area > .pagedjs_page_content { width: 100%; - height: 100%; + height: calc(100% - var(--pagedjs-footnotes-height)); position: relative; column-fill: auto; } +.pagedjs_pagebox > .pagedjs_area > .pagedjs_page_content > div { + height: inherit; +} + +.pagedjs_pagebox > .pagedjs_area > .pagedjs_footnote_area { + position: relative; + overflow: hidden; + height: var(--pagedjs-footnotes-height); + display: flex; + justify-content: flex-end; + flex-flow: column; +} + +.pagedjs_pagebox > .pagedjs_area > .pagedjs_footnote_area > .pagedjs_footnote_content { + overflow: hidden; +} + +.pagedjs_pagebox > .pagedjs_area > .pagedjs_footnote_area > .pagedjs_footnote_inner_content { + overflow: hidden; +} + +.pagedjs_area [data-footnote-call] { + all: unset; + counter-increment: footnote; +} + +.pagedjs_area [data-split-from] { + counter-increment: unset; + counter-reset: unset; +} + +[data-footnote-call]::after { + vertical-align: super; + font-size: 65%; + line-height: normal; + content: counter(footnote); +} + +@supports ( font-variant-position: super ) { + [data-footnote-call]::after { + vertical-align: baseline; + font-size: 100%; + line-height: inherit; + font-variant-position: super; + } +} + +.pagedjs_footnote_empty { + display: none; +} + +.pagedjs_area [data-split-from] { + counter-increment: unset; + counter-reset: unset; +} + +[data-footnote-marker]:not([data-split-from]) { + counter-increment: footnote-marker; + text-indent: 0; + display: list-item; + list-style-position: inside; +} + +[data-footnote-marker]::marker { + content: counter(footnote-marker) ". "; +} + +[data-footnote-marker][data-split-from]::marker { + content: unset; +} + +.pagedjs_area .pagedjs_footnote_inner_content [data-note-display="inline"] { + display: inline; +} + .pagedjs_page { counter-increment: page var(--pagedjs-page-counter-increment); width: var(--pagedjs-width); @@ -26078,7 +27017,7 @@ } .pagedjs_pages { - counter-reset: pages var(--pagedjs-page-count); + counter-reset: pages var(--pagedjs-page-count) footnote var(--pagedjs-footnotes-count) footnote-marker var(--pagedjs-footnotes-count); } .pagedjs_pagebox .pagedjs_margin-top-left-corner, @@ -26206,13 +27145,13 @@ margin: unset; } -.pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to]:after, -.pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to]::after { +.pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to]:not([data-footnote-call]):after, +.pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to]:not([data-footnote-call])::after { content: unset; } -.pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]:before, -.pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]::before { +.pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]:not([data-footnote-call]):before, +.pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]:not([data-footnote-call])::before { content: unset; } @@ -26257,6 +27196,8 @@ html { width: 100%; height: 100%; + -webkit-print-color-adjust: exact; + print-color-adjust: exact; } body { margin: 0; @@ -26421,7 +27362,6 @@ insert(text){ let head = document.querySelector("head"); let style = document.createElement("style"); - style.type = "text/css"; style.setAttribute("data-pagedjs-inserted-styles", "true"); style.appendChild(document.createTextNode(text)); @@ -26457,7 +27397,7 @@ } } - eventEmitter(Handler.prototype); + EventEmitter(Handler.prototype); // https://www.w3.org/TR/css3-page/#page-size-prop @@ -26666,7 +27606,8 @@ }, backgroundOrigin: undefined, block: {}, - marks: undefined + marks: undefined, + notes: undefined }; } @@ -26710,6 +27651,9 @@ page.marginalia = marginalia; } + let notes = this.replaceNotes(node); + page.notes = notes; + let declarations = this.replaceDeclarations(node); if (declarations.size) { @@ -26894,25 +27838,49 @@ replaceMarginalia(ast) { let parsed = {}; + const MARGINS = [ + "top-left-corner", "top-left", "top", "top-center", "top-right", "top-right-corner", + "bottom-left-corner", "bottom-left", "bottom", "bottom-center", "bottom-right", "bottom-right-corner", + "left-top", "left-middle", "left", "left-bottom", "top-right-corner", + "right-top", "right-middle", "right", "right-bottom", "right-right-corner" + ]; + lib.walk(ast.block, { + visit: "Atrule", + enter: (node, item, list) => { + let name = node.name; + if (MARGINS.includes(name)) { + if (name === "top") { + name = "top-center"; + } + if (name === "right") { + name = "right-middle"; + } + if (name === "left") { + name = "left-middle"; + } + if (name === "bottom") { + name = "bottom-center"; + } + parsed[name] = node.block; + list.remove(item); + } + } + }); + + return parsed; + } + + replaceNotes(ast) { + let parsed = {}; lib.walk(ast.block, { visit: "Atrule", enter: (node, item, list) => { let name = node.name; - if (name === "top") { - name = "top-center"; + if (name === "footnote") { + parsed[name] = node.block; + list.remove(item); } - if (name === "right") { - name = "right-middle"; - } - if (name === "left") { - name = "left-middle"; - } - if (name === "bottom") { - name = "bottom-center"; - } - parsed[name] = node.block; - list.remove(item); } }); @@ -27300,6 +28268,11 @@ this.addMarginaliaStyles(page, ruleList, rule, sheet); this.addMarginaliaContent(page, ruleList, rule, sheet); } + + if(page.notes) { + this.addNotesStyles(page.notes, page, ruleList, rule, sheet); + } + return rule; } @@ -27345,20 +28318,20 @@ addBorderVars(border, list, item) { // variables for borders - for (let b in border) { - if (typeof border[b] !== "undefined") { - let value = border[b]; - let bVar = list.createItem({ + for (const name of Object.keys(border)) { + const value = border[name]; + // value is an empty object when undefined + if (typeof value === "string") { + const borderItem = list.createItem({ type: "Declaration", - property: "--pagedjs-border-" + b, + property: "--pagedjs-border-" + name, value: { type: "Raw", value: value } }); - list.append(bVar, item); + list.append(borderItem, item); } - } } @@ -27669,6 +28642,29 @@ ast.children.appendData(rule); } + + addNotesStyles(notes, page, list, item, sheet) { + + for (const note in notes) { + let selectors = this.selectorsForPage(page); + + selectors.insertData({ + type: "Combinator", + name: " " + }); + + selectors.insertData({ + type: "ClassSelector", + name: "pagedjs_" + note + "_content" + }); + + let notesRule = this.createRule(selectors, notes[note]); + + list.appendData(notesRule); + } + + } + /* @page { size: var(--pagedjs-width) var(--pagedjs-height); @@ -29009,22 +30005,32 @@ let property = declaration.property; if (property === "counter-increment") { - let inc = this.handleIncrement(declaration, rule); - if (inc) { + this.handleIncrement(declaration, rule); + // clean up empty declaration + let hasProperities = false; + declaration.value.children.forEach((data) => { + if (data.type && data.type !== "WhiteSpace") { + hasProperities = true; + } + }); + if (!hasProperities) { dList.remove(dItem); } } else if (property === "counter-reset") { - let reset = this.handleReset(declaration, rule); - if (reset) { + this.handleReset(declaration, rule); + // clean up empty declaration + let hasProperities = false; + declaration.value.children.forEach((data) => { + if (data.type && data.type !== "WhiteSpace") { + hasProperities = true; + } + }); + if (!hasProperities) { dList.remove(dItem); } } } - onContent(funcNode, fItem, fList, declaration, rule) { - if (funcNode.name === "counter") ; - } - afterParsed(parsed) { this.processCounters(parsed, this.counters); this.scopeCounters(this.counters); @@ -29045,47 +30051,113 @@ } handleIncrement(declaration, rule) { - const identifier = declaration.value.children.first(); - const number = declaration.value.children.getSize() > 1 ? declaration.value.children.last().value : 1; - const name = identifier && identifier.name; + let increments = []; + let children = declaration.value.children; - if (name === "page" || name.indexOf("target-counter-") === 0) { - return; - } + children.forEach((data, item) => { + if (data.type && data.type === "Identifier") { + let name = data.name; - let selector = lib.generate(rule.ruleNode.prelude); + if (name === "page" || name.indexOf("target-counter-") === 0) { + return; + } - let counter; - if (!(name in this.counters)) { - counter = this.addCounter(name); - } else { - counter = this.counters[name]; - } + let whitespace, number, value; + if (item.next && item.next.data.type === "WhiteSpace") { + whitespace = item.next; + } + if (whitespace && whitespace.next && whitespace.next.data.type === "Number") { + number = whitespace.next; + value = parseInt(number.data.value); + } - return counter.increments[selector] = { - selector: selector, - number - }; + let selector = lib.generate(rule.ruleNode.prelude); + + let counter; + if (!(name in this.counters)) { + counter = this.addCounter(name); + } else { + counter = this.counters[name]; + } + let increment = { + selector: selector, + number: value || 1 + }; + counter.increments[selector] = increment; + increments.push(increment); + + // Remove the parsed resets + children.remove(item); + if (whitespace) { + children.remove(whitespace); + } + if (number) { + children.remove(number); + } + } + }); + + return increments; } handleReset(declaration, rule) { - let identifier = declaration.value.children.first(); - let number = declaration.value.children.getSize() > 1 - && declaration.value.children.last().value; - let name = identifier && identifier.name; - let selector = lib.generate(rule.ruleNode.prelude); - let counter; + let resets = []; + let children = declaration.value.children; - if (!(name in this.counters)) { - counter = this.addCounter(name); - } else { - counter = this.counters[name]; - } + children.forEach((data, item) => { + if (data.type && data.type === "Identifier") { + let name = data.name; + let whitespace, number, value; + if (item.next && item.next.data.type === "WhiteSpace") { + whitespace = item.next; + } + if (whitespace && whitespace.next && whitespace.next.data.type === "Number") { + number = whitespace.next; + value = parseInt(number.data.value); + } - return counter.resets[selector] = { - selector: selector, - number: number || 0 - }; + let counter; + let selector; + let prelude = rule.ruleNode.prelude; + + if (rule.ruleNode.type === "Atrule" && rule.ruleNode.name === "page") { + selector = ".pagedjs_page"; + } else { + selector = lib.generate(prelude || rule.ruleNode); + } + + if (name === "footnote") { + this.addFootnoteMarkerCounter(declaration.value.children); + } + + if (!(name in this.counters)) { + counter = this.addCounter(name); + } else { + counter = this.counters[name]; + } + + let reset = { + selector: selector, + number: value || 0 + }; + + counter.resets[selector] = reset; + resets.push(reset); + + if (selector !== ".pagedjs_page") { + // Remove the parsed resets + children.remove(item); + if (whitespace) { + children.remove(whitespace); + } + if (number) { + children.remove(number); + } + } + } + }); + + return resets; } processCounters(parsed, counters) { @@ -29108,7 +30180,7 @@ } } // Add to pages to allow cross page scope - this.insertRule(`.pagedjs_pages { counter-reset: ${countersArray.join(" ")} page 0 pages var(--pagedjs-page-count)}`); + this.insertRule(`.pagedjs_pages { counter-reset: ${countersArray.join(" ")} page 0 pages var(--pagedjs-page-count) footnote var(--pagedjs-footnotes-count) footnote-marker var(--pagedjs-footnotes-count)}`); } insertRule(rule) { @@ -29124,7 +30196,11 @@ // Add counter data for (let i = 0; i < incrementElements.length; i++) { incrementElements[i].setAttribute("data-counter-"+ counter.name +"-increment", increment.number); - incrementElements[i].setAttribute("data-counter-increment", counter.name); + if (incrementElements[i].getAttribute("data-counter-increment")) { + incrementElements[i].setAttribute("data-counter-increment", incrementElements[i].getAttribute("data-counter-increment") + " " + counter.name); + } else { + incrementElements[i].setAttribute("data-counter-increment", counter.name); + } } } } @@ -29138,14 +30214,23 @@ // Add counter data for (var i = 0; i < resetElements.length; i++) { resetElements[i].setAttribute("data-counter-"+ counter.name +"-reset", reset.number); - resetElements[i].setAttribute("data-counter-reset", counter.name); + if (resetElements[i].getAttribute("data-counter-reset")) { + resetElements[i].setAttribute("data-counter-reset", resetElements[i].getAttribute("data-counter-reset") + " " + counter.name); + } else { + resetElements[i].setAttribute("data-counter-reset", counter.name); + } } } } addCounterValues(parsed, counter) { - const counterName = counter.name; - const elements = parsed.querySelectorAll("[data-counter-"+ counterName +"-reset], [data-counter-"+ counterName +"-increment]"); + let counterName = counter.name; + + if (counterName === "page" || counterName === "footnote") { + return; + } + + let elements = parsed.querySelectorAll("[data-counter-"+ counterName +"-reset], [data-counter-"+ counterName +"-increment]"); let count = 0; let element; @@ -29188,6 +30273,41 @@ } } + addFootnoteMarkerCounter(list) { + let markers = []; + lib.walk(list, { + visit: "Identifier", + enter: (identNode, iItem, iList) => { + markers.push(identNode.name); + } + }); + + // Already added + if (markers.includes("footnote-maker")) { + return; + } + + list.insertData({ + type: "WhiteSpace", + value: " " + }); + + list.insertData({ + type: "Identifier", + name: "footnote-marker" + }); + + list.insertData({ + type: "WhiteSpace", + value: " " + }); + + list.insertData({ + type: "Number", + value: 0 + }); + } + incrementCounterForElement(element, incrementArray) { if (!element || !incrementArray || incrementArray.length === 0) return; @@ -29211,7 +30331,9 @@ } afterPageLayout(pageElement, page) { - let pgreset = pageElement.querySelectorAll("[data-counter-page-reset]"); + let resets = []; + + let pgreset = pageElement.querySelectorAll("[data-counter-page-reset]:not([data-split-from])"); pgreset.forEach((reset) => { const ref = reset.dataset && reset.dataset.ref; if (ref && this.resetCountersMap.has(ref)) ; else { @@ -29219,9 +30341,20 @@ this.resetCountersMap.set(ref, ""); } let value = reset.dataset.counterPageReset; - this.styleSheet.insertRule(`[data-page-number="${pageElement.dataset.pageNumber}"] { counter-increment: none; counter-reset: page ${value}; }`, this.styleSheet.cssRules.length); + resets.push(`page ${value}`); } }); + + let notereset = pageElement.querySelectorAll("[data-counter-footnote-reset]:not([data-split-from])"); + notereset.forEach((reset) => { + let value = reset.dataset.counterFootnoteReset; + resets.push(`footnote ${value}`); + resets.push(`footnote-marker ${value}`); + }); + + if (resets.length) { + this.styleSheet.insertRule(`[data-page-number="${pageElement.dataset.pageNumber}"] { counter-increment: none; counter-reset: ${resets.join(" ")} }`, this.styleSheet.cssRules.length); + } } } @@ -29241,12 +30374,9 @@ afterPageLayout(pageElement, page, breakToken, chunker) { var orderedLists = pageElement.getElementsByTagName("ol"); for (var list of orderedLists) { - if (list.hasChildNodes()) { + if (list.firstElementChild) { list.start = list.firstElementChild.dataset.itemNum; } - else { - list.parentNode.removeChild(list); - } } } @@ -29335,7 +30465,7 @@ const number = declaration.value.children.getSize() > 1 ? declaration.value.children.last().value : 1; const name = identifier && identifier.name; - if (name.indexOf("target-counter-") === 0) { + if (name && name.indexOf("target-counter-") === 0) { return; } // A counter named page is automatically created and incremented by 1 on every page of the document, @@ -29470,6 +30600,548 @@ } } + class Footnotes extends Handler { + constructor(chunker, polisher, caller) { + super(chunker, polisher, caller); + + this.footnotes = {}; + this.needsLayout = []; + } + + onDeclaration(declaration, dItem, dList, rule) { + let property = declaration.property; + if (property === "float") { + let identifier = declaration.value.children && declaration.value.children.first(); + let location = identifier && identifier.name; + if (location === "footnote") { + let selector = lib.generate(rule.ruleNode.prelude); + this.footnotes[selector] = { + selector: selector, + policy: "auto", + display: "block" + }; + dList.remove(dItem); + } + } + if (property === "footnote-policy") { + let identifier = declaration.value.children && declaration.value.children.first(); + let policy = identifier && identifier.name; + if (policy) { + let selector = lib.generate(rule.ruleNode.prelude); + let note = this.footnotes[selector]; + if (note) { + note.policy = policy; + } + } + } + if (property === "footnote-display") { + let identifier = declaration.value.children && declaration.value.children.first(); + let display = identifier && identifier.name; + let selector = lib.generate(rule.ruleNode.prelude); + if (display && this.footnotes[selector]) { + let note = this.footnotes[selector]; + if (note) { + note.display = display; + } + } + } + } + + onPseudoSelector(pseudoNode, pItem, pList, selector, rule) { + let name = pseudoNode.name; + if (name === "footnote-marker") { + // switch ::footnote-marker to [data-footnote-marker]::before + let prelude = rule.ruleNode.prelude; + let newPrelude = new lib.List(); + + // Can't get remove to work, so just copying everything else + prelude.children.first().children.each((node) => { + if (node.type !== "PseudoElementSelector") { + newPrelude.appendData(node); + } + }); + + // Add our data call + newPrelude.appendData({ + type: "AttributeSelector", + name: { + type: "Identifier", + name: "data-footnote-marker", + }, + flags: null, + loc: null, + matcher: null, + value: null + }); + + // Add new pseudo element + newPrelude.appendData({ + type: "PseudoElementSelector", + name: "marker", + loc: null, + children: null + }); + + prelude.children.first().children = newPrelude; + } + + if (name === "footnote-call") { + // switch ::footnote-call to [data-footnote-call]::after + + let prelude = rule.ruleNode.prelude; + let newPrelude = new lib.List(); + + // Can't get remove to work, so just copying everything else + prelude.children.first().children.each((node) => { + if (node.type !== "PseudoElementSelector") { + newPrelude.appendData(node); + } + }); + + // Add our data call + newPrelude.appendData({ + type: "AttributeSelector", + name: { + type: "Identifier", + name: "data-footnote-call", + }, + flags: null, + loc: null, + matcher: null, + value: null + }); + + // Add new pseudo element + newPrelude.appendData({ + type: "PseudoElementSelector", + name: "after", + loc: null, + children: null + }); + + prelude.children.first().children = newPrelude; + } + } + + afterParsed(parsed) { + this.processFootnotes(parsed, this.footnotes); + } + + processFootnotes(parsed, notes) { + for (let n in notes) { + // Find elements + let elements = parsed.querySelectorAll(n); + let element; + let note = notes[n]; + for (var i = 0; i < elements.length; i++) { + element = elements[i]; + // Add note type + element.setAttribute("data-note", "footnote"); + element.setAttribute("data-break-before", "avoid"); + element.setAttribute("data-note-policy", note.policy || "auto"); + element.setAttribute("data-note-display", note.display || "block"); + // Mark all parents + this.processFootnoteContainer(element); + } + } + } + + processFootnoteContainer(node) { + // Find the container + let element = node.parentElement; + let prevElement = element; + // Walk up the dom until we find a container element + while (element) { + if (isContainer(element)) { + // Add flag to the previous non-container element that will render with children + prevElement.setAttribute("data-has-notes", "true"); + break; + } + + prevElement = element; + element = element.parentElement; + + // If no containers were found and there are no further parents flag the last element + if (!element) { + prevElement.setAttribute("data-has-notes", "true"); + } + } + } + + renderNode(node) { + if (node.nodeType == 1) { + // Get all notes + let notes; + + // Ingnore html element nodes, like mathml + if (!node.dataset) { + return; + } + + if (node.dataset.note === "footnote") { + notes = [node]; + } else if (node.dataset.hasNotes || node.querySelectorAll("[data-note='footnote']")) { + notes = node.querySelectorAll("[data-note='footnote']"); + } + + if (notes && notes.length) { + this.findVisibleFootnotes(notes, node); + } + } + } + + findVisibleFootnotes(notes, node) { + let area, size, right; + area = node.closest(".pagedjs_page_content"); + size = area.getBoundingClientRect(); + right = size.left + size.width; + + for (let i = 0; i < notes.length; ++i) { + let currentNote = notes[i]; + let bounds = currentNote.getBoundingClientRect(); + let left = bounds.left; + + if (left < right) { + // Add call for the note + this.moveFootnote(currentNote, node.closest(".pagedjs_area"), true); + } + } + } + + moveFootnote(node, pageArea, needsNoteCall) { + // let pageArea = node.closest(".pagedjs_area"); + let noteArea = pageArea.querySelector(".pagedjs_footnote_area"); + let noteContent = noteArea.querySelector(".pagedjs_footnote_content"); + let noteInnerContent = noteContent.querySelector(".pagedjs_footnote_inner_content"); + + if (!isElement(node)) { + return; + } + + // Add call for the note + let noteCall; + if (needsNoteCall) { + noteCall = this.createFootnoteCall(node); + } + + // Remove the break before attribute for future layout + node.removeAttribute("data-break-before"); + + // Check if note already exists for overflow + let existing = noteInnerContent.querySelector(`[data-ref="${node.dataset.ref}"]`); + if (existing) { + // Remove the note from the flow but no need to render it again + node.remove(); + return; + } + + // Add the note node + noteInnerContent.appendChild(node); + + // Remove empty class + if (noteContent.classList.contains("pagedjs_footnote_empty")) { + noteContent.classList.remove("pagedjs_footnote_empty"); + } + + // Add marker + node.dataset.footnoteMarker = node.dataset.ref; + + // Add Id + node.id = `note-${node.dataset.ref}`; + + // Get note content size + let height = noteContent.scrollHeight; + + // Check the noteCall is still on screen + let area = pageArea.querySelector(".pagedjs_page_content"); + let size = area.getBoundingClientRect(); + let right = size.left + size.width; + + // TODO: add a max height in CSS + + // Check element sizes + let noteCallBounds = noteCall && noteCall.getBoundingClientRect(); + let noteAreaBounds = noteArea.getBoundingClientRect(); + + // Get the @footnote margins + let noteContentMargins = this.marginsHeight(noteContent); + let noteContentPadding = this.paddingHeight(noteContent); + let noteContentBorders = this.borderHeight(noteContent); + let total = noteContentMargins + noteContentPadding + noteContentBorders; + + // Get the top of the @footnote area + let notAreaTop = Math.floor(noteAreaBounds.top); + // If the height isn't set yet, remove the margins from the top + if (noteAreaBounds.height === 0) { + notAreaTop -= this.marginsHeight(noteContent, false); + notAreaTop -= this.paddingHeight(noteContent, false); + notAreaTop -= this.borderHeight(noteContent, false); + } + // Determine the note call position and offset per policy + let notePolicy = node.dataset.notePolicy; + let noteCallPosition = 0; + let noteCallOffset = 0; + if (noteCall) { + // Get the correct line bottom for super or sub styled callouts + let prevSibling = noteCall.previousSibling; + let range = new Range(); + if (prevSibling) { + range.setStartBefore(prevSibling); + } else { + range.setStartBefore(noteCall); + } + range.setEndAfter(noteCall); + let rangeBounds = range.getBoundingClientRect(); + noteCallPosition = rangeBounds.bottom; + if (!notePolicy || notePolicy === "auto") { + noteCallOffset = Math.ceil(rangeBounds.bottom); + } else if (notePolicy === "line") { + noteCallOffset = Math.ceil(rangeBounds.top); + } else if (notePolicy === "block") { + // Check that there is a previous element on the page + let parentParagraph = noteCall.closest("p").previousElementSibling; + if (parentParagraph) { + noteCallOffset = Math.ceil( + parentParagraph.getBoundingClientRect().bottom + ); + } else { + noteCallOffset = Math.ceil(rangeBounds.bottom); + } + } + } + + let contentDelta = height + total - noteAreaBounds.height; + // Space between the top of the footnotes area and the bottom of the footnote call + let noteDelta = noteCallPosition ? notAreaTop - noteCallPosition : 0; + // Space needed for the force a break for the policy of the footnote + let notePolicyDelta = noteCallPosition ? Math.floor(noteAreaBounds.top) - noteCallOffset : 0; + let hasNotes = noteArea.querySelector("[data-note='footnote']"); + if (needsNoteCall && noteCallBounds.left > right) { + // Note is offscreen and will be chunked to the next page on overflow + node.remove(); + } else if (!hasNotes && needsNoteCall && total > noteDelta) { + // No space to add even the footnote area + pageArea.style.setProperty("--pagedjs-footnotes-height", "0px"); + // Add a wrapper as this div is removed later + let wrapperDiv = document.createElement("div"); + wrapperDiv.appendChild(node); + // Push to the layout queue for the next page + this.needsLayout.push(wrapperDiv); + } else if (!needsNoteCall) { + // Call was previously added, force adding footnote + pageArea.style.setProperty( + "--pagedjs-footnotes-height", + `${height + total}px` + ); + } else if (noteCallPosition < noteAreaBounds.top - contentDelta) { + // the current note content will fit without pushing the call to the next page + pageArea.style.setProperty( + "--pagedjs-footnotes-height", + `${height + noteContentMargins + noteContentBorders}px` + ); + } else { + // set height to just before note call + pageArea.style.setProperty( + "--pagedjs-footnotes-height", + `${noteAreaBounds.height + notePolicyDelta}px` + ); + noteInnerContent.style.height = + noteAreaBounds.height + notePolicyDelta - total + "px"; + } + } + + createFootnoteCall(node) { + let parentElement = node.parentElement; + let footnoteCall = document.createElement("a"); + for (const className of node.classList) { + footnoteCall.classList.add(`${className}`); + } + + footnoteCall.dataset.footnoteCall = node.dataset.ref; + footnoteCall.dataset.ref = node.dataset.ref; + + // Increment for counters + footnoteCall.dataset.dataCounterFootnoteIncrement = 1; + + // Add link + footnoteCall.href = `#note-${node.dataset.ref}`; + + parentElement.insertBefore(footnoteCall, node); + + return footnoteCall; + } + + afterPageLayout(pageElement, page, breakToken, chunker) { + let pageArea = pageElement.querySelector(".pagedjs_area"); + let noteArea = page.footnotesArea; + let noteContent = noteArea.querySelector(".pagedjs_footnote_content"); + let noteInnerContent = noteArea.querySelector(".pagedjs_footnote_inner_content"); + + let noteContentBounds = noteContent.getBoundingClientRect(); + let { width } = noteContentBounds; + + noteInnerContent.style.columnWidth = Math.round(width) + "px"; + noteInnerContent.style.columnGap = "calc(var(--pagedjs-margin-right) + var(--pagedjs-margin-left))"; + + // Get overflow + let layout = new Layout(noteArea, undefined, chunker.settings); + let overflow = layout.findOverflow(noteInnerContent, noteContentBounds); + + if (overflow) { + let { startContainer, startOffset } = overflow; + let startIsNode; + if (isElement(startContainer)) { + let start = startContainer.childNodes[startOffset]; + startIsNode = isElement(start) && start.hasAttribute("data-footnote-marker"); + } + + let extracted = overflow.extractContents(); + + if (!startIsNode) { + let splitChild = extracted.firstElementChild; + splitChild.dataset.splitFrom = splitChild.dataset.ref; + + this.handleAlignment(noteInnerContent.lastElementChild); + } + + this.needsLayout.push(extracted); + + noteContent.style.removeProperty("height"); + noteInnerContent.style.removeProperty("height"); + + let noteInnerContentBounds = noteInnerContent.getBoundingClientRect(); + let { height } = noteInnerContentBounds; + + // Get the @footnote margins + let noteContentMargins = this.marginsHeight(noteContent); + let noteContentPadding = this.paddingHeight(noteContent); + let noteContentBorders = this.borderHeight(noteContent); + pageArea.style.setProperty( + "--pagedjs-footnotes-height", + `${height + noteContentMargins + noteContentBorders + noteContentPadding}px` + ); + + // Hide footnote content if empty + if (noteInnerContent.childNodes.length === 0) { + noteContent.classList.add("pagedjs_footnote_empty"); + } + + if (!breakToken) { + chunker.clonePage(page); + } else { + let breakBefore, previousBreakAfter; + if ( + breakToken.node && + typeof breakToken.node.dataset !== "undefined" && + typeof breakToken.node.dataset.previousBreakAfter !== "undefined" + ) { + previousBreakAfter = breakToken.node.dataset.previousBreakAfter; + } + + if ( + breakToken.node && + typeof breakToken.node.dataset !== "undefined" && + typeof breakToken.node.dataset.breakBefore !== "undefined" + ) { + breakBefore = breakToken.node.dataset.breakBefore; + } + + if (breakBefore || previousBreakAfter) { + chunker.clonePage(page); + } + } + } + noteInnerContent.style.height = "auto"; + } + + handleAlignment(node) { + let styles = window.getComputedStyle(node); + let alignLast = styles["text-align-last"]; + node.dataset.lastSplitElement = "true"; + if (alignLast === "auto") { + node.dataset.alignLastSplitElement = "justify"; + } else { + node.dataset.alignLastSplitElement = alignLast; + } + } + + beforePageLayout(page) { + while (this.needsLayout.length) { + let fragment = this.needsLayout.shift(); + + Array.from(fragment.childNodes).forEach((node) => { + this.moveFootnote( + node, + page.element.querySelector(".pagedjs_area"), + false + ); + }); + } + } + + afterOverflowRemoved(removed, rendered) { + // Find the page area + let area = rendered.closest(".pagedjs_area"); + // Get any rendered footnotes + let notes = area.querySelectorAll(".pagedjs_footnote_area [data-note='footnote']"); + for (let n = 0; n < notes.length; n++) { + const note = notes[n]; + // Check if the call for that footnote has been removed with the overflow + let call = removed.querySelector(`[data-footnote-call="${note.dataset.ref}"]`); + if (call) { + note.remove(); + } + } + // Hide footnote content if empty + let noteInnerContent = area.querySelector(".pagedjs_footnote_inner_content"); + if (noteInnerContent && noteInnerContent.childNodes.length === 0) { + noteInnerContent.parentElement.classList.add("pagedjs_footnote_empty"); + } + } + + marginsHeight(element, total=true) { + let styles = window.getComputedStyle(element); + let marginTop = parseInt(styles.marginTop); + let marginBottom = parseInt(styles.marginBottom); + let margin = 0; + if (marginTop) { + margin += marginTop; + } + if (marginBottom && total) { + margin += marginBottom; + } + return margin; + } + + paddingHeight(element, total=true) { + let styles = window.getComputedStyle(element); + let paddingTop = parseInt(styles.paddingTop); + let paddingBottom = parseInt(styles.paddingBottom); + let padding = 0; + if (paddingTop) { + padding += paddingTop; + } + if (paddingBottom && total) { + padding += paddingBottom; + } + return padding; + } + + borderHeight(element, total=true) { + let styles = window.getComputedStyle(element); + let borderTop = parseInt(styles.borderTop); + let borderBottom = parseInt(styles.borderBottom); + let borders = 0; + if (borderTop) { + borders += borderTop; + } + if (borderBottom && total) { + borders += borderBottom; + } + return borders; + } + } + var pagedMediaHandlers = [ AtPage, Breaks, @@ -29480,7 +31152,8 @@ PositionFixed, PageCounterIncrement, NthOfType, - Following + Following, + Footnotes ]; class RunningHeaders extends Handler { @@ -29569,16 +31242,18 @@ afterPageLayout(fragment) { for (let name of Object.keys(this.runningSelectors)) { let set = this.runningSelectors[name]; - let selected = fragment.querySelector(set.selector); - if (selected) { - // let cssVar; - if (set.identifier === "running") { - // cssVar = selected.textContent.replace(/\\([\s\S])|(["|'])/g,"\\$1$2"); - // this.styleSheet.insertRule(`:root { --string-${name}: "${cssVar}"; }`, this.styleSheet.cssRules.length); - // fragment.style.setProperty(`--string-${name}`, `"${cssVar}"`); - set.first = selected; - } else { - console.warn(set.value + "needs css replacement"); + if (!set.first) { + let selected = fragment.querySelector(set.selector); + if (selected) { + // let cssVar; + if (set.identifier === "running") { + // cssVar = selected.textContent.replace(/\\([\s\S])|(["|'])/g,"\\$1$2"); + // this.styleSheet.insertRule(`:root { --string-${name}: "${cssVar}"; }`, this.styleSheet.cssRules.length); + // fragment.style.setProperty(`--string-${name}`, `"${cssVar}"`); + set.first = selected; + } else { + console.warn(set.value + "needs css replacement"); + } } } } @@ -29628,7 +31303,7 @@ switch (parts.length) { case 4: - if (parts[3] === "pagedjs_first_page") { + if (/^pagedjs_[\w-]+_first_page$/.test(parts[3])) { weight = 7; } else if (parts[3] === "pagedjs_left_page" || parts[3] === "pagedjs_right_page") { weight = 6; @@ -29935,7 +31610,7 @@ afterPageLayout(fragment, page, breakToken, chunker) { Object.keys(this.counterTargets).forEach((name) => { let target = this.counterTargets[name]; - let split = target.selector.split("::"); + let split = target.selector.split(/::?/g); let query = split[0]; let queried = chunker.pagesArea.querySelectorAll(query + ":not([data-" + target.variable + "])"); @@ -29960,7 +31635,8 @@ let pages = chunker.pagesArea.querySelectorAll(".pagedjs_page"); let pg = 0; for (let i = 0; i < pages.length; i++) { - let styles = window.getComputedStyle(pages[i]); + let page = pages[i]; + let styles = window.getComputedStyle(page); let reset = styles["counter-reset"].replace("page", "").trim(); let increment = styles["counter-increment"].replace("page", "").trim(); @@ -29971,11 +31647,10 @@ pg += parseInt(increment); } - if (pages[i].contains(element)) { + if (page.contains(element)){ break; } } - this.styleSheet.insertRule(`[data-${target.variable}="${selector}"]${pseudo} { counter-reset: ${target.variable} ${pg}; }`, this.styleSheet.cssRules.length); } else { let value = element.getAttribute(`data-counter-${target.counter}-value`); @@ -29983,6 +31658,14 @@ this.styleSheet.insertRule(`[data-${target.variable}="${selector}"]${pseudo} { counter-reset: ${target.variable} ${target.variable} ${parseInt(value)}; }`, this.styleSheet.cssRules.length); } } + + // force redraw + let el = document.querySelector(`[data-${target.variable}="${selector}"]`); + if (el) { + el.style.display = "none"; + el.clientHeight; + el.style.removeProperty("display"); + } } }); }); @@ -30210,7 +31893,8 @@ } - var clearCut = createCommonjsModule(function (module, exports) { + var clearCut = {}; + /** * Originally ported from https://github.com/keeganstreet/specificity/blob/866bf7ab4e7f62a7179c15b13a95af4e1c7b1afa/specificity.js * @@ -30220,6 +31904,7 @@ * Returns a selector integer value */ + (function (exports) { // The following regular expressions assume that selectors matching the preceding regular expressions have been removed var attributeRegex = /(\[[^\]]+\])/g; var idRegex = /(#[^\s\+>~\.\[:]+)/g; @@ -30333,10 +32018,7 @@ throw error; } }; - }); - var clearCut_1 = clearCut.calculateSpecificity; - var clearCut_2 = clearCut.isSelectorValid; - var clearCut_3 = clearCut.validateSelector; + }(clearCut)); class UndisplayedFilter extends Handler { constructor(chunker, polisher, caller) { @@ -30353,7 +32035,7 @@ this.displayRules[s] = { value: value, selector: s, - specificity: clearCut_1(s), + specificity: clearCut.calculateSpecificity(s), important: declaration.important }; }); @@ -30455,7 +32137,7 @@ var validTypes = { object: true, symbol: true }; - var isImplemented$4 = function () { + var isImplemented$2 = function () { var symbol; if (typeof Symbol !== 'function') return false; symbol = Symbol('test symbol'); @@ -30469,7 +32151,7 @@ return true; }; - var isSymbol = function (x) { + var isSymbol$1 = function (x) { if (!x) return false; if (typeof x === 'symbol') return true; if (!x.constructor) return false; @@ -30477,14 +32159,19 @@ return (x[x.constructor.toStringTag] === 'Symbol'); }; - var validateSymbol = function (value) { + var isSymbol = isSymbol$1; + + var validateSymbol$1 = function (value) { if (!isSymbol(value)) throw new TypeError(value + " is not a symbol"); return value; }; - var create$6 = Object.create, defineProperties = Object.defineProperties - , defineProperty = Object.defineProperty, objPrototype = Object.prototype - , NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create$6(null) + var d$1 = d$3.exports + , validateSymbol = validateSymbol$1 + + , create = Object.create, defineProperties = Object.defineProperties + , defineProperty$2 = Object.defineProperty, objPrototype = Object.prototype + , NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create(null) , isNativeSafe; if (typeof Symbol === 'function') { @@ -30496,21 +32183,21 @@ } var generateName = (function () { - var created = create$6(null); + var created = create(null); return function (desc) { var postfix = 0, name, ie11BugWorkaround; while (created[desc + (postfix || '')]) ++postfix; desc += (postfix || ''); created[desc] = true; name = '@@' + desc; - defineProperty(objPrototype, name, d_1.gs(null, function (value) { + defineProperty$2(objPrototype, name, d$1.gs(null, function (value) { // For IE11 issue see: // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/ // ie11-broken-getters-on-dom-objects // https://github.com/medikoo/es6-symbol/issues/12 if (ie11BugWorkaround) return; ie11BugWorkaround = true; - defineProperty(this, name, d_1(value)); + defineProperty$2(this, name, d$1(value)); ie11BugWorkaround = false; })); return name; @@ -30530,19 +32217,19 @@ var symbol; if (this instanceof Symbol) throw new TypeError('Symbol is not a constructor'); if (isNativeSafe) return NativeSymbol(description); - symbol = create$6(HiddenSymbol.prototype); + symbol = create(HiddenSymbol.prototype); description = (description === undefined ? '' : String(description)); return defineProperties(symbol, { - __description__: d_1('', description), - __name__: d_1('', generateName(description)) + __description__: d$1('', description), + __name__: d$1('', generateName(description)) }); }; defineProperties(SymbolPolyfill, { - for: d_1(function (key) { + for: d$1(function (key) { if (globalSymbols[key]) return globalSymbols[key]; return (globalSymbols[key] = SymbolPolyfill(String(key))); }), - keyFor: d_1(function (s) { + keyFor: d$1(function (s) { var key; validateSymbol(s); for (key in globalSymbols) if (globalSymbols[key] === s) return key; @@ -30550,120 +32237,131 @@ // To ensure proper interoperability with other native functions (e.g. Array.from) // fallback to eventual native implementation of given symbol - hasInstance: d_1('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')), - isConcatSpreadable: d_1('', (NativeSymbol && NativeSymbol.isConcatSpreadable) || + hasInstance: d$1('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')), + isConcatSpreadable: d$1('', (NativeSymbol && NativeSymbol.isConcatSpreadable) || SymbolPolyfill('isConcatSpreadable')), - iterator: d_1('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')), - match: d_1('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')), - replace: d_1('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')), - search: d_1('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')), - species: d_1('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')), - split: d_1('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')), - toPrimitive: d_1('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')), - toStringTag: d_1('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')), - unscopables: d_1('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables')) + iterator: d$1('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')), + match: d$1('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')), + replace: d$1('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')), + search: d$1('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')), + species: d$1('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')), + split: d$1('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')), + toPrimitive: d$1('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')), + toStringTag: d$1('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')), + unscopables: d$1('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables')) }); // Internal tweaks for real symbol producer defineProperties(HiddenSymbol.prototype, { - constructor: d_1(SymbolPolyfill), - toString: d_1('', function () { return this.__name__; }) + constructor: d$1(SymbolPolyfill), + toString: d$1('', function () { return this.__name__; }) }); // Proper implementation of methods exposed on Symbol.prototype // They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype defineProperties(SymbolPolyfill.prototype, { - toString: d_1(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }), - valueOf: d_1(function () { return validateSymbol(this); }) + toString: d$1(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }), + valueOf: d$1(function () { return validateSymbol(this); }) }); - defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d_1('', function () { + defineProperty$2(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d$1('', function () { var symbol = validateSymbol(this); if (typeof symbol === 'symbol') return symbol; return symbol.toString(); })); - defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d_1('c', 'Symbol')); + defineProperty$2(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d$1('c', 'Symbol')); // Proper implementaton of toPrimitive and toStringTag for returned symbol instances - defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag, - d_1('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag])); + defineProperty$2(HiddenSymbol.prototype, SymbolPolyfill.toStringTag, + d$1('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag])); // Note: It's important to define `toPrimitive` as last one, as some implementations // implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols) // And that may invoke error in definition flow: // See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149 - defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive, - d_1('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive])); + defineProperty$2(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive, + d$1('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive])); - var es6Symbol = isImplemented$4() ? Symbol : polyfill; + var es6Symbol = isImplemented$2() ? Symbol : polyfill; - var objToString = Object.prototype.toString - , id = objToString.call( + var objToString$2 = Object.prototype.toString + , id$2 = objToString$2.call( (function () { return arguments; })() ); - var isArguments = function (value) { - return objToString.call(value) === id; + var isArguments$1 = function (value) { + return objToString$2.call(value) === id$2; }; - var objToString$1 = Object.prototype.toString, id$1 = objToString$1.call(noop); + var objToString$1 = Object.prototype.toString, id$1 = objToString$1.call(noop$4); - var isFunction = function (value) { + var isFunction$1 = function (value) { return typeof value === "function" && objToString$1.call(value) === id$1; }; - var isImplemented$5 = function () { + var isImplemented$1 = function () { var sign = Math.sign; if (typeof sign !== "function") return false; return (sign(10) === 1) && (sign(-20) === -1); }; - var shim$3 = function (value) { + var shim$2 = function (value) { value = Number(value); if (isNaN(value) || (value === 0)) return value; return value > 0 ? 1 : -1; }; - var sign = isImplemented$5() + var sign$1 = isImplemented$1() ? Math.sign - : shim$3; + : shim$2; - var abs = Math.abs, floor = Math.floor; + var sign = sign$1 - var toInteger = function (value) { + , abs$1 = Math.abs, floor$1 = Math.floor; + + var toInteger$1 = function (value) { if (isNaN(value)) return 0; value = Number(value); if ((value === 0) || !isFinite(value)) return value; - return sign(value) * floor(abs(value)); + return sign(value) * floor$1(abs$1(value)); }; - var max$1 = Math.max; + var toInteger = toInteger$1 + + , max = Math.max; var toPosInteger = function (value) { - return max$1(0, toInteger(value)); + return max(0, toInteger(value)); }; - var objToString$2 = Object.prototype.toString, id$2 = objToString$2.call(""); + var objToString = Object.prototype.toString, id = objToString.call(""); - var isString = function (value) { + var isString$1 = function (value) { return ( typeof value === "string" || (value && typeof value === "object" && - (value instanceof String || objToString$2.call(value) === id$2)) || + (value instanceof String || objToString.call(value) === id)) || false ); }; var iteratorSymbol = es6Symbol.iterator + , isArguments = isArguments$1 + , isFunction = isFunction$1 + , toPosInt$1 = toPosInteger + , callable = validCallable + , validValue = validValue$1 + , isValue$1 = isValue$5 + , isString = isString$1 , isArray = Array.isArray , call = Function.prototype.call , desc = { configurable: true, enumerable: true, writable: true, value: null } , defineProperty$1 = Object.defineProperty; // eslint-disable-next-line complexity - var shim$4 = function (arrayLike /*, mapFn, thisArg*/) { + var shim$1 = function (arrayLike /*, mapFn, thisArg*/) { var mapFn = arguments[1] , thisArg = arguments[2] , Context @@ -30679,7 +32377,7 @@ arrayLike = Object(validValue(arrayLike)); - if (isValue(mapFn)) validCallable(mapFn); + if (isValue$1(mapFn)) callable(mapFn); if (!this || this === Array || !isFunction(this)) { // Result: Plain array if (!mapFn) { @@ -30707,7 +32405,7 @@ if (!isArray(arrayLike)) { if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) { // Source: Iterator - iterator = validCallable(getIterator).call(arrayLike); + iterator = callable(getIterator).call(arrayLike); if (Context) arr = new Context(); result = iterator.next(); i = 0; @@ -30748,7 +32446,7 @@ } if (length === undefined) { // Source: array or array-like - length = toPosInteger(arrayLike.length); + length = toPosInt$1(arrayLike.length); if (Context) arr = new Context(length); for (i = 0; i < length; ++i) { value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i]; @@ -30767,109 +32465,121 @@ return arr; }; - var from_1 = isImplemented$3() + var from = isImplemented$3() ? Array.from - : shim$4; + : shim$1; - var isImplemented$6 = function () { + var isImplemented = function () { var numberIsNaN = Number.isNaN; if (typeof numberIsNaN !== "function") return false; return !numberIsNaN({}) && numberIsNaN(NaN) && !numberIsNaN(34); }; - var shim$5 = function (value) { + var shim = function (value) { // eslint-disable-next-line no-self-compare return value !== value; }; - var isNan = isImplemented$6() + var isNan = isImplemented() ? Number.isNaN - : shim$5; + : shim; - var indexOf$2 = Array.prototype.indexOf + var numberIsNaN = isNan + , toPosInt = toPosInteger + , value$1 = validValue$1 + , indexOf$1 = Array.prototype.indexOf , objHasOwnProperty = Object.prototype.hasOwnProperty - , abs$1 = Math.abs - , floor$1 = Math.floor; + , abs = Math.abs + , floor = Math.floor; var eIndexOf = function (searchElement /*, fromIndex*/) { var i, length, fromIndex, val; - if (!isNan(searchElement)) return indexOf$2.apply(this, arguments); + if (!numberIsNaN(searchElement)) return indexOf$1.apply(this, arguments); - length = toPosInteger(validValue(this).length); + length = toPosInt(value$1(this).length); fromIndex = arguments[1]; if (isNaN(fromIndex)) fromIndex = 0; - else if (fromIndex >= 0) fromIndex = floor$1(fromIndex); - else fromIndex = toPosInteger(this.length) - floor$1(abs$1(fromIndex)); + else if (fromIndex >= 0) fromIndex = floor(fromIndex); + else fromIndex = toPosInt(this.length) - floor(abs(fromIndex)); for (i = fromIndex; i < length; ++i) { if (objHasOwnProperty.call(this, i)) { val = this[i]; - if (isNan(val)) return i; // Jslint: ignore + if (numberIsNaN(val)) return i; // Jslint: ignore } } return -1; }; - var forEach$1 = Array.prototype.forEach + var indexOf = eIndexOf + , forEach = Array.prototype.forEach , splice = Array.prototype.splice; // eslint-disable-next-line no-unused-vars - var remove = function (itemToRemove /*, …item*/) { - forEach$1.call( + var remove$1 = function (itemToRemove /*, …item*/) { + forEach.call( arguments, function (item) { - var index = eIndexOf.call(this, item); + var index = indexOf.call(this, item); if (index !== -1) splice.call(this, index, 1); }, this ); }; + var isValue = isValue$5; + var map = { function: true, object: true }; var isObject$1 = function (value) { return (isValue(value) && map[typeof value]) || false; }; + var isObject = isObject$1; + var validObject = function (value) { - if (!isObject$1(value)) throw new TypeError(value + " is not an Object"); + if (!isObject(value)) throw new TypeError(value + " is not an Object"); return value; }; - var emit = eventEmitter.methods.emit + var aFrom = from + , remove = remove$1 + , value = validObject + , d = d$3.exports + , emit = eventEmitter.exports.methods.emit - , defineProperty$2 = Object.defineProperty - , hasOwnProperty$6 = Object.prototype.hasOwnProperty + , defineProperty = Object.defineProperty + , hasOwnProperty$1 = Object.prototype.hasOwnProperty , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var pipe = function (e1, e2/*, name*/) { var pipes, pipe, desc, name; - (validObject(e1) && validObject(e2)); + (value(e1) && value(e2)); name = arguments[2]; if (name === undefined) name = 'emit'; pipe = { close: function () { remove.call(pipes, e2); } }; - if (hasOwnProperty$6.call(e1, '__eePipes__')) { + if (hasOwnProperty$1.call(e1, '__eePipes__')) { (pipes = e1.__eePipes__).push(e2); return pipe; } - defineProperty$2(e1, '__eePipes__', d_1('c', pipes = [e2])); + defineProperty(e1, '__eePipes__', d('c', pipes = [e2])); desc = getOwnPropertyDescriptor(e1, name); if (!desc) { - desc = d_1('c', undefined); + desc = d('c', undefined); } else { delete desc.get; delete desc.set; } desc.value = function () { - var i, emitter, data = from_1(pipes); + var i, emitter, data = aFrom(pipes); emit.apply(this, arguments); for (i = 0; (emitter = data[i]); ++i) emit.apply(emitter, arguments); }; - defineProperty$2(e1, name, desc); + defineProperty(e1, name, desc); return pipe; }; @@ -30885,7 +32595,7 @@ } } - eventEmitter(Handlers.prototype); + EventEmitter(Handlers.prototype); function registerHandlers() { for (var i = 0; i < arguments.length; i++) { @@ -30993,22 +32703,36 @@ removeStyles(doc=document) { // Get all stylesheets - let stylesheets = Array.from(doc.querySelectorAll("link[rel='stylesheet']")); - let hrefs = stylesheets.map((sheet) => { - sheet.remove(); - return sheet.href; - }); - + const stylesheets = Array.from(doc.querySelectorAll("link[rel='stylesheet']")); // Get inline styles - let inlineStyles = Array.from(doc.querySelectorAll("style:not([data-pagedjs-inserted-styles])")); - inlineStyles.forEach((inlineStyle) => { - let obj = {}; - obj[window.location.href] = inlineStyle.textContent; - hrefs.push(obj); - inlineStyle.remove(); - }); - - return hrefs; + const inlineStyles = Array.from(doc.querySelectorAll("style:not([data-pagedjs-inserted-styles])")); + const elements = [...stylesheets, ...inlineStyles]; + return elements + // preserve order + .sort(function (element1, element2) { + const position = element1.compareDocumentPosition(element2); + if (position === Node.DOCUMENT_POSITION_PRECEDING) { + return 1; + } else if (position === Node.DOCUMENT_POSITION_FOLLOWING) { + return -1; + } + return 0; + }) + // extract the href + .map((element) => { + if (element.nodeName === "STYLE") { + const obj = {}; + obj[window.location.href] = element.textContent; + element.remove(); + return obj; + } + if (element.nodeName === "LINK") { + element.remove(); + return element.href; + } + // ignore + console.warn(`Unable to process: ${element}, ignoring.`); + }); } async preview(content, stylesheets, renderTo) { @@ -31047,7 +32771,7 @@ } } - eventEmitter(Previewer.prototype); + EventEmitter(Previewer.prototype); var Paged = /*#__PURE__*/Object.freeze({ __proto__: null, @@ -31104,4 +32828,4 @@ return previewer; -}))); +})); diff --git a/_vendor/modules.txt b/_vendor/modules.txt index d98debd..0f749c2 100644 --- a/_vendor/modules.txt +++ b/_vendor/modules.txt @@ -1,2 +1,2 @@ -# git.sandpoints.org/Drawwell/SandpointsTheme v0.0.0-20220906062458-efc027f4de78 +# git.sandpoints.org/Drawwell/SandpointsTheme v0.0.0-20220906204502-cea3de57cdab # git.sandpoints.org/Drawwell/SandpointsEditPage v0.0.0-20210825011616-e019d8a4d186 diff --git a/content/struggle/_index.md b/content/struggle/_index.md deleted file mode 100644 index e69de29..0000000 diff --git a/content/struggle/health_care.md b/content/struggle/health_care.md deleted file mode 100644 index 02a3bdb..0000000 --- a/content/struggle/health_care.md +++ /dev/null @@ -1,20 +0,0 @@ -+++ -title = "Health Care" -has_factors = ["factor1.md", "factor2.md"] -+++ - -# About Health Care struggles - -Some text here. - -An example of bibliography reference: - -- ![](bib:e610c577-e6a6-4a11-9e45-dbec435f011b) -- or inside some text as a ![text snippet](bib:e610c577-e6a6-4a11-9e45-dbec435f011b) - -## A new paragraph - -And why not one more reference example: - -- ![](bib:eb9a283a-7184-4b62-aefc-6af498b17538) -- or inside some text as a ![text snippet](bib:eb9a283a-7184-4b62-aefc-6af498b17538)