You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31108 lines
839 KiB

  1. /**
  2. * @license Paged.js v0.1.43 | MIT | https://gitlab.pagedmedia.org/tools/pagedjs
  3. */
  4. (function (global, factory) {
  5. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  6. typeof define === 'function' && define.amd ? define(factory) :
  7. (global = global || self, global.PagedPolyfill = factory());
  8. }(this, (function () { 'use strict';
  9. function createCommonjsModule(fn, module) {
  10. return module = { exports: {} }, fn(module, module.exports), module.exports;
  11. }
  12. function getCjsExportFromNamespace (n) {
  13. return n && n['default'] || n;
  14. }
  15. var isImplemented = function () {
  16. var assign = Object.assign, obj;
  17. if (typeof assign !== "function") return false;
  18. obj = { foo: "raz" };
  19. assign(obj, { bar: "dwa" }, { trzy: "trzy" });
  20. return (obj.foo + obj.bar + obj.trzy) === "razdwatrzy";
  21. };
  22. var isImplemented$1 = function () {
  23. try {
  24. Object.keys("primitive");
  25. return true;
  26. } catch (e) {
  27. return false;
  28. }
  29. };
  30. // eslint-disable-next-line no-empty-function
  31. var noop = function () {};
  32. var _undefined = noop(); // Support ES3 engines
  33. var isValue = function (val) {
  34. return (val !== _undefined) && (val !== null);
  35. };
  36. var keys = Object.keys;
  37. var shim = function (object) {
  38. return keys(isValue(object) ? Object(object) : object);
  39. };
  40. var keys$1 = isImplemented$1()
  41. ? Object.keys
  42. : shim;
  43. var validValue = function (value) {
  44. if (!isValue(value)) throw new TypeError("Cannot use null or undefined");
  45. return value;
  46. };
  47. var max = Math.max;
  48. var shim$1 = function (dest, src /*, …srcn*/) {
  49. var error, i, length = max(arguments.length, 2), assign;
  50. dest = Object(validValue(dest));
  51. assign = function (key) {
  52. try {
  53. dest[key] = src[key];
  54. } catch (e) {
  55. if (!error) error = e;
  56. }
  57. };
  58. for (i = 1; i < length; ++i) {
  59. src = arguments[i];
  60. keys$1(src).forEach(assign);
  61. }
  62. if (error !== undefined) throw error;
  63. return dest;
  64. };
  65. var assign = isImplemented()
  66. ? Object.assign
  67. : shim$1;
  68. var forEach = Array.prototype.forEach, create = Object.create;
  69. var process = function (src, obj) {
  70. var key;
  71. for (key in src) obj[key] = src[key];
  72. };
  73. // eslint-disable-next-line no-unused-vars
  74. var normalizeOptions = function (opts1 /*, …options*/) {
  75. var result = create(null);
  76. forEach.call(arguments, function (options) {
  77. if (!isValue(options)) return;
  78. process(Object(options), result);
  79. });
  80. return result;
  81. };
  82. // Deprecated
  83. var isCallable = function (obj) {
  84. return typeof obj === "function";
  85. };
  86. var str = "razdwatrzy";
  87. var isImplemented$2 = function () {
  88. if (typeof str.contains !== "function") return false;
  89. return (str.contains("dwa") === true) && (str.contains("foo") === false);
  90. };
  91. var indexOf = String.prototype.indexOf;
  92. var shim$2 = function (searchString/*, position*/) {
  93. return indexOf.call(this, searchString, arguments[1]) > -1;
  94. };
  95. var contains = isImplemented$2()
  96. ? String.prototype.contains
  97. : shim$2;
  98. var d_1 = createCommonjsModule(function (module) {
  99. var d;
  100. d = module.exports = function (dscr, value/*, options*/) {
  101. var c, e, w, options, desc;
  102. if ((arguments.length < 2) || (typeof dscr !== 'string')) {
  103. options = value;
  104. value = dscr;
  105. dscr = null;
  106. } else {
  107. options = arguments[2];
  108. }
  109. if (dscr == null) {
  110. c = w = true;
  111. e = false;
  112. } else {
  113. c = contains.call(dscr, 'c');
  114. e = contains.call(dscr, 'e');
  115. w = contains.call(dscr, 'w');
  116. }
  117. desc = { value: value, configurable: c, enumerable: e, writable: w };
  118. return !options ? desc : assign(normalizeOptions(options), desc);
  119. };
  120. d.gs = function (dscr, get, set/*, options*/) {
  121. var c, e, options, desc;
  122. if (typeof dscr !== 'string') {
  123. options = set;
  124. set = get;
  125. get = dscr;
  126. dscr = null;
  127. } else {
  128. options = arguments[3];
  129. }
  130. if (get == null) {
  131. get = undefined;
  132. } else if (!isCallable(get)) {
  133. options = get;
  134. get = set = undefined;
  135. } else if (set == null) {
  136. set = undefined;
  137. } else if (!isCallable(set)) {
  138. options = set;
  139. set = undefined;
  140. }
  141. if (dscr == null) {
  142. c = true;
  143. e = false;
  144. } else {
  145. c = contains.call(dscr, 'c');
  146. e = contains.call(dscr, 'e');
  147. }
  148. desc = { get: get, set: set, configurable: c, enumerable: e };
  149. return !options ? desc : assign(normalizeOptions(options), desc);
  150. };
  151. });
  152. var validCallable = function (fn) {
  153. if (typeof fn !== "function") throw new TypeError(fn + " is not a function");
  154. return fn;
  155. };
  156. var eventEmitter = createCommonjsModule(function (module, exports) {
  157. var apply = Function.prototype.apply, call = Function.prototype.call
  158. , create = Object.create, defineProperty = Object.defineProperty
  159. , defineProperties = Object.defineProperties
  160. , hasOwnProperty = Object.prototype.hasOwnProperty
  161. , descriptor = { configurable: true, enumerable: false, writable: true }
  162. , on, once, off, emit, methods, descriptors, base;
  163. on = function (type, listener) {
  164. var data;
  165. validCallable(listener);
  166. if (!hasOwnProperty.call(this, '__ee__')) {
  167. data = descriptor.value = create(null);
  168. defineProperty(this, '__ee__', descriptor);
  169. descriptor.value = null;
  170. } else {
  171. data = this.__ee__;
  172. }
  173. if (!data[type]) data[type] = listener;
  174. else if (typeof data[type] === 'object') data[type].push(listener);
  175. else data[type] = [data[type], listener];
  176. return this;
  177. };
  178. once = function (type, listener) {
  179. var once, self;
  180. validCallable(listener);
  181. self = this;
  182. on.call(this, type, once = function () {
  183. off.call(self, type, once);
  184. apply.call(listener, this, arguments);
  185. });
  186. once.__eeOnceListener__ = listener;
  187. return this;
  188. };
  189. off = function (type, listener) {
  190. var data, listeners, candidate, i;
  191. validCallable(listener);
  192. if (!hasOwnProperty.call(this, '__ee__')) return this;
  193. data = this.__ee__;
  194. if (!data[type]) return this;
  195. listeners = data[type];
  196. if (typeof listeners === 'object') {
  197. for (i = 0; (candidate = listeners[i]); ++i) {
  198. if ((candidate === listener) ||
  199. (candidate.__eeOnceListener__ === listener)) {
  200. if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
  201. else listeners.splice(i, 1);
  202. }
  203. }
  204. } else {
  205. if ((listeners === listener) ||
  206. (listeners.__eeOnceListener__ === listener)) {
  207. delete data[type];
  208. }
  209. }
  210. return this;
  211. };
  212. emit = function (type) {
  213. var i, l, listener, listeners, args;
  214. if (!hasOwnProperty.call(this, '__ee__')) return;
  215. listeners = this.__ee__[type];
  216. if (!listeners) return;
  217. if (typeof listeners === 'object') {
  218. l = arguments.length;
  219. args = new Array(l - 1);
  220. for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
  221. listeners = listeners.slice();
  222. for (i = 0; (listener = listeners[i]); ++i) {
  223. apply.call(listener, this, args);
  224. }
  225. } else {
  226. switch (arguments.length) {
  227. case 1:
  228. call.call(listeners, this);
  229. break;
  230. case 2:
  231. call.call(listeners, this, arguments[1]);
  232. break;
  233. case 3:
  234. call.call(listeners, this, arguments[1], arguments[2]);
  235. break;
  236. default:
  237. l = arguments.length;
  238. args = new Array(l - 1);
  239. for (i = 1; i < l; ++i) {
  240. args[i - 1] = arguments[i];
  241. }
  242. apply.call(listeners, this, args);
  243. }
  244. }
  245. };
  246. methods = {
  247. on: on,
  248. once: once,
  249. off: off,
  250. emit: emit
  251. };
  252. descriptors = {
  253. on: d_1(on),
  254. once: d_1(once),
  255. off: d_1(off),
  256. emit: d_1(emit)
  257. };
  258. base = defineProperties({}, descriptors);
  259. module.exports = exports = function (o) {
  260. return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
  261. };
  262. exports.methods = methods;
  263. });
  264. var eventEmitter_1 = eventEmitter.methods;
  265. /**
  266. * Hooks allow for injecting functions that must all complete in order before finishing
  267. * They will execute in parallel but all must finish before continuing
  268. * Functions may return a promise if they are asycn.
  269. * From epubjs/src/utils/hooks
  270. * @param {any} context scope of this
  271. * @example this.content = new Hook(this);
  272. */
  273. class Hook {
  274. constructor(context){
  275. this.context = context || this;
  276. this.hooks = [];
  277. }
  278. /**
  279. * Adds a function to be run before a hook completes
  280. * @example this.content.register(function(){...});
  281. * @return {undefined} void
  282. */
  283. register(){
  284. for(var i = 0; i < arguments.length; ++i) {
  285. if (typeof arguments[i] === "function") {
  286. this.hooks.push(arguments[i]);
  287. } else {
  288. // unpack array
  289. for(var j = 0; j < arguments[i].length; ++j) {
  290. this.hooks.push(arguments[i][j]);
  291. }
  292. }
  293. }
  294. }
  295. /**
  296. * Triggers a hook to run all functions
  297. * @example this.content.trigger(args).then(function(){...});
  298. * @return {Promise} results
  299. */
  300. trigger(){
  301. var args = arguments;
  302. var context = this.context;
  303. var promises = [];
  304. this.hooks.forEach(function(task) {
  305. var executing = task.apply(context, args);
  306. if(executing && typeof executing["then"] === "function") {
  307. // Task is a function that returns a promise
  308. promises.push(executing);
  309. }
  310. // Otherwise Task resolves immediately, add resolved promise with result
  311. promises.push(new Promise((resolve, reject) => {
  312. resolve(executing);
  313. }));
  314. });
  315. return Promise.all(promises);
  316. }
  317. /**
  318. * Triggers a hook to run all functions synchronously
  319. * @example this.content.trigger(args).then(function(){...});
  320. * @return {Array} results
  321. */
  322. triggerSync(){
  323. var args = arguments;
  324. var context = this.context;
  325. var results = [];
  326. this.hooks.forEach(function(task) {
  327. var executing = task.apply(context, args);
  328. results.push(executing);
  329. });
  330. return results;
  331. }
  332. // Adds a function to be run before a hook completes
  333. list(){
  334. return this.hooks;
  335. }
  336. clear(){
  337. return this.hooks = [];
  338. }
  339. }
  340. function getBoundingClientRect(element) {
  341. if (!element) {
  342. return;
  343. }
  344. let rect;
  345. if (typeof element.getBoundingClientRect !== "undefined") {
  346. rect = element.getBoundingClientRect();
  347. } else {
  348. let range = document.createRange();
  349. range.selectNode(element);
  350. rect = range.getBoundingClientRect();
  351. }
  352. return rect;
  353. }
  354. function getClientRects(element) {
  355. if (!element) {
  356. return;
  357. }
  358. let rect;
  359. if (typeof element.getClientRects !== "undefined") {
  360. rect = element.getClientRects();
  361. } else {
  362. let range = document.createRange();
  363. range.selectNode(element);
  364. rect = range.getClientRects();
  365. }
  366. return rect;
  367. }
  368. /**
  369. * Generates a UUID
  370. * based on: http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
  371. * @returns {string} uuid
  372. */
  373. function UUID() {
  374. var d = new Date().getTime();
  375. if (typeof performance !== "undefined" && typeof performance.now === "function") {
  376. d += performance.now(); //use high-precision timer if available
  377. }
  378. return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
  379. var r = (d + Math.random() * 16) % 16 | 0;
  380. d = Math.floor(d / 16);
  381. return (c === "x" ? r : (r & 0x3 | 0x8)).toString(16);
  382. });
  383. }
  384. function attr(element, attributes) {
  385. for (var i = 0; i < attributes.length; i++) {
  386. if (element.hasAttribute(attributes[i])) {
  387. return element.getAttribute(attributes[i]);
  388. }
  389. }
  390. }
  391. /* Based on by https://mths.be/cssescape v1.5.1 by @mathias | MIT license
  392. * Allows # and .
  393. */
  394. function querySelectorEscape(value) {
  395. if (arguments.length == 0) {
  396. throw new TypeError("`CSS.escape` requires an argument.");
  397. }
  398. var string = String(value);
  399. var length = string.length;
  400. var index = -1;
  401. var codeUnit;
  402. var result = "";
  403. var firstCodeUnit = string.charCodeAt(0);
  404. while (++index < length) {
  405. codeUnit = string.charCodeAt(index);
  406. // Note: there’s no need to special-case astral symbols, surrogate
  407. // pairs, or lone surrogates.
  408. // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
  409. // (U+FFFD).
  410. if (codeUnit == 0x0000) {
  411. result += "\uFFFD";
  412. continue;
  413. }
  414. if (
  415. // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
  416. // U+007F, […]
  417. (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
  418. // If the character is the first character and is in the range [0-9]
  419. // (U+0030 to U+0039), […]
  420. (index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
  421. // If the character is the second character and is in the range [0-9]
  422. // (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
  423. (
  424. index == 1 &&
  425. codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
  426. firstCodeUnit == 0x002D
  427. )
  428. ) {
  429. // https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
  430. result += "\\" + codeUnit.toString(16) + " ";
  431. continue;
  432. }
  433. if (
  434. // If the character is the first character and is a `-` (U+002D), and
  435. // there is no second character, […]
  436. index == 0 &&
  437. length == 1 &&
  438. codeUnit == 0x002D
  439. ) {
  440. result += "\\" + string.charAt(index);
  441. continue;
  442. }
  443. // support for period character in id
  444. if (codeUnit == 0x002E) {
  445. if (string.charAt(0) == "#") {
  446. result += "\\.";
  447. continue;
  448. }
  449. }
  450. // If the character is not handled by one of the above rules and is
  451. // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
  452. // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
  453. // U+005A), or [a-z] (U+0061 to U+007A), […]
  454. if (
  455. codeUnit >= 0x0080 ||
  456. codeUnit == 0x002D ||
  457. codeUnit == 0x005F ||
  458. codeUnit == 35 || // Allow #
  459. codeUnit == 46 || // Allow .
  460. codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
  461. codeUnit >= 0x0041 && codeUnit <= 0x005A ||
  462. codeUnit >= 0x0061 && codeUnit <= 0x007A
  463. ) {
  464. // the character itself
  465. result += string.charAt(index);
  466. continue;
  467. }
  468. // Otherwise, the escaped character.
  469. // https://drafts.csswg.org/cssom/#escape-a-character
  470. result += "\\" + string.charAt(index);
  471. }
  472. return result;
  473. }
  474. /**
  475. * Creates a new pending promise and provides methods to resolve or reject it.
  476. * From: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred#backwards_forwards_compatible
  477. * @returns {object} defered
  478. */
  479. function defer() {
  480. this.resolve = null;
  481. this.reject = null;
  482. this.id = UUID();
  483. this.promise = new Promise((resolve, reject) => {
  484. this.resolve = resolve;
  485. this.reject = reject;
  486. });
  487. Object.freeze(this);
  488. }
  489. const requestIdleCallback = typeof window !== "undefined" && ("requestIdleCallback" in window ? window.requestIdleCallback : window.requestAnimationFrame);
  490. function CSSValueToString(obj) {
  491. return obj.value + (obj.unit || "");
  492. }
  493. function isElement(node) {
  494. return node && node.nodeType === 1;
  495. }
  496. function isText(node) {
  497. return node && node.nodeType === 3;
  498. }
  499. function *walk(start, limiter) {
  500. let node = start;
  501. while (node) {
  502. yield node;
  503. if (node.childNodes.length) {
  504. node = node.firstChild;
  505. } else if (node.nextSibling) {
  506. if (limiter && node === limiter) {
  507. node = undefined;
  508. break;
  509. }
  510. node = node.nextSibling;
  511. } else {
  512. while (node) {
  513. node = node.parentNode;
  514. if (limiter && node === limiter) {
  515. node = undefined;
  516. break;
  517. }
  518. if (node && node.nextSibling) {
  519. node = node.nextSibling;
  520. break;
  521. }
  522. }
  523. }
  524. }
  525. }
  526. function nodeAfter(node, limiter) {
  527. if (limiter && node === limiter) {
  528. return;
  529. }
  530. let significantNode = nextSignificantNode(node);
  531. if (significantNode) {
  532. return significantNode;
  533. }
  534. if (node.parentNode) {
  535. while ((node = node.parentNode)) {
  536. if (limiter && node === limiter) {
  537. return;
  538. }
  539. significantNode = nextSignificantNode(node);
  540. if (significantNode) {
  541. return significantNode;
  542. }
  543. }
  544. }
  545. }
  546. function nodeBefore(node, limiter) {
  547. if (limiter && node === limiter) {
  548. return;
  549. }
  550. let significantNode = previousSignificantNode(node);
  551. if (significantNode) {
  552. return significantNode;
  553. }
  554. if (node.parentNode) {
  555. while ((node = node.parentNode)) {
  556. if (limiter && node === limiter) {
  557. return;
  558. }
  559. significantNode = previousSignificantNode(node);
  560. if (significantNode) {
  561. return significantNode;
  562. }
  563. }
  564. }
  565. }
  566. function elementAfter(node, limiter) {
  567. let after = nodeAfter(node, limiter);
  568. while (after && after.nodeType !== 1) {
  569. after = nodeAfter(after, limiter);
  570. }
  571. return after;
  572. }
  573. function elementBefore(node, limiter) {
  574. let before = nodeBefore(node, limiter);
  575. while (before && before.nodeType !== 1) {
  576. before = nodeBefore(before, limiter);
  577. }
  578. return before;
  579. }
  580. function displayedElementAfter(node, limiter) {
  581. let after = elementAfter(node, limiter);
  582. while (after && after.dataset.undisplayed) {
  583. after = elementAfter(after);
  584. }
  585. return after;
  586. }
  587. function displayedElementBefore(node, limiter) {
  588. let before = elementBefore(node, limiter);
  589. while (before && before.dataset.undisplayed) {
  590. before = elementBefore(before);
  591. }
  592. return before;
  593. }
  594. function rebuildAncestors(node) {
  595. let parent, ancestor;
  596. let ancestors = [];
  597. let added = [];
  598. let fragment = document.createDocumentFragment();
  599. // Gather all ancestors
  600. let element = node;
  601. while(element.parentNode && element.parentNode.nodeType === 1) {
  602. ancestors.unshift(element.parentNode);
  603. element = element.parentNode;
  604. }
  605. for (var i = 0; i < ancestors.length; i++) {
  606. ancestor = ancestors[i];
  607. parent = ancestor.cloneNode(false);
  608. parent.setAttribute("data-split-from", parent.getAttribute("data-ref"));
  609. // ancestor.setAttribute("data-split-to", parent.getAttribute("data-ref"));
  610. if (parent.hasAttribute("id")) {
  611. let dataID = parent.getAttribute("id");
  612. parent.setAttribute("data-id", dataID);
  613. parent.removeAttribute("id");
  614. }
  615. // This is handled by css :not, but also tidied up here
  616. if (parent.hasAttribute("data-break-before")) {
  617. parent.removeAttribute("data-break-before");
  618. }
  619. if (parent.hasAttribute("data-previous-break-after")) {
  620. parent.removeAttribute("data-previous-break-after");
  621. }
  622. if (added.length) {
  623. let container = added[added.length-1];
  624. container.appendChild(parent);
  625. } else {
  626. fragment.appendChild(parent);
  627. }
  628. added.push(parent);
  629. }
  630. added = undefined;
  631. return fragment;
  632. }
  633. /*
  634. export function split(bound, cutElement, breakAfter) {
  635. let needsRemoval = [];
  636. let index = indexOf(cutElement);
  637. if (!breakAfter && index === 0) {
  638. return;
  639. }
  640. if (breakAfter && index === (cutElement.parentNode.children.length - 1)) {
  641. return;
  642. }
  643. // Create a fragment with rebuilt ancestors
  644. let fragment = rebuildAncestors(cutElement);
  645. // Clone cut
  646. if (!breakAfter) {
  647. let clone = cutElement.cloneNode(true);
  648. let ref = cutElement.parentNode.getAttribute('data-ref');
  649. let parent = fragment.querySelector("[data-ref='" + ref + "']");
  650. parent.appendChild(clone);
  651. needsRemoval.push(cutElement);
  652. }
  653. // Remove all after cut
  654. let next = nodeAfter(cutElement, bound);
  655. while (next) {
  656. let clone = next.cloneNode(true);
  657. let ref = next.parentNode.getAttribute('data-ref');
  658. let parent = fragment.querySelector("[data-ref='" + ref + "']");
  659. parent.appendChild(clone);
  660. needsRemoval.push(next);
  661. next = nodeAfter(next, bound);
  662. }
  663. // Remove originals
  664. needsRemoval.forEach((node) => {
  665. if (node) {
  666. node.remove();
  667. }
  668. });
  669. // Insert after bounds
  670. bound.parentNode.insertBefore(fragment, bound.nextSibling);
  671. return [bound, bound.nextSibling];
  672. }
  673. */
  674. function needsBreakBefore(node) {
  675. if( typeof node !== "undefined" &&
  676. typeof node.dataset !== "undefined" &&
  677. typeof node.dataset.breakBefore !== "undefined" &&
  678. (node.dataset.breakBefore === "always" ||
  679. node.dataset.breakBefore === "page" ||
  680. node.dataset.breakBefore === "left" ||
  681. node.dataset.breakBefore === "right" ||
  682. node.dataset.breakBefore === "recto" ||
  683. node.dataset.breakBefore === "verso")
  684. ) {
  685. return true;
  686. }
  687. return false;
  688. }
  689. function needsPreviousBreakAfter(node) {
  690. if( typeof node !== "undefined" &&
  691. typeof node.dataset !== "undefined" &&
  692. typeof node.dataset.previousBreakAfter !== "undefined" &&
  693. (node.dataset.previousBreakAfter === "always" ||
  694. node.dataset.previousBreakAfter === "page" ||
  695. node.dataset.previousBreakAfter === "left" ||
  696. node.dataset.previousBreakAfter === "right" ||
  697. node.dataset.previousBreakAfter === "recto" ||
  698. node.dataset.previousBreakAfter === "verso")
  699. ) {
  700. return true;
  701. }
  702. return false;
  703. }
  704. function needsPageBreak(node, previousSignificantNode) {
  705. if (typeof node === "undefined" || !previousSignificantNode || isIgnorable(node)) {
  706. return false;
  707. }
  708. if (node.dataset && node.dataset.undisplayed) {
  709. return false;
  710. }
  711. const previousSignificantNodePage = previousSignificantNode.dataset ? previousSignificantNode.dataset.page : undefined;
  712. const currentNodePage = node.dataset ? node.dataset.page : undefined;
  713. return currentNodePage !== previousSignificantNodePage;
  714. }
  715. function *words(node) {
  716. let currentText = node.nodeValue;
  717. let max = currentText.length;
  718. let currentOffset = 0;
  719. let currentLetter;
  720. let range;
  721. while(currentOffset < max) {
  722. currentLetter = currentText[currentOffset];
  723. if (/^[\S\u202F\u00A0]$/.test(currentLetter)) {
  724. if (!range) {
  725. range = document.createRange();
  726. range.setStart(node, currentOffset);
  727. }
  728. } else {
  729. if (range) {
  730. range.setEnd(node, currentOffset);
  731. yield range;
  732. range = undefined;
  733. }
  734. }
  735. currentOffset += 1;
  736. }
  737. if (range) {
  738. range.setEnd(node, currentOffset);
  739. yield range;
  740. range = undefined;
  741. }
  742. }
  743. function *letters(wordRange) {
  744. let currentText = wordRange.startContainer;
  745. let max = currentText.length;
  746. let currentOffset = wordRange.startOffset;
  747. // let currentLetter;
  748. let range;
  749. while(currentOffset < max) {
  750. // currentLetter = currentText[currentOffset];
  751. range = document.createRange();
  752. range.setStart(currentText, currentOffset);
  753. range.setEnd(currentText, currentOffset+1);
  754. yield range;
  755. currentOffset += 1;
  756. }
  757. }
  758. function isContainer(node) {
  759. let container;
  760. if (typeof node.tagName === "undefined") {
  761. return true;
  762. }
  763. if (node.style && node.style.display === "none") {
  764. return false;
  765. }
  766. switch (node.tagName) {
  767. // Inline
  768. case "A":
  769. case "ABBR":
  770. case "ACRONYM":
  771. case "B":
  772. case "BDO":
  773. case "BIG":
  774. case "BR":
  775. case "BUTTON":
  776. case "CITE":
  777. case "CODE":
  778. case "DFN":
  779. case "EM":
  780. case "I":
  781. case "IMG":
  782. case "INPUT":
  783. case "KBD":
  784. case "LABEL":
  785. case "MAP":
  786. case "OBJECT":
  787. case "Q":
  788. case "SAMP":
  789. case "SCRIPT":
  790. case "SELECT":
  791. case "SMALL":
  792. case "SPAN":
  793. case "STRONG":
  794. case "SUB":
  795. case "SUP":
  796. case "TEXTAREA":
  797. case "TIME":
  798. case "TT":
  799. case "VAR":
  800. case "P":
  801. case "H1":
  802. case "H2":
  803. case "H3":
  804. case "H4":
  805. case "H5":
  806. case "H6":
  807. case "FIGCAPTION":
  808. case "BLOCKQUOTE":
  809. case "PRE":
  810. case "LI":
  811. case "TR":
  812. case "DT":
  813. case "DD":
  814. case "VIDEO":
  815. case "CANVAS":
  816. container = false;
  817. break;
  818. default:
  819. container = true;
  820. }
  821. return container;
  822. }
  823. function cloneNode(n, deep=false) {
  824. return n.cloneNode(deep);
  825. }
  826. function findElement(node, doc) {
  827. const ref = node.getAttribute("data-ref");
  828. return findRef(ref, doc);
  829. }
  830. function findRef(ref, doc) {
  831. return doc.querySelector(`[data-ref='${ref}']`);
  832. }
  833. function validNode(node) {
  834. if (isText(node)) {
  835. return true;
  836. }
  837. if (isElement(node) && node.dataset.ref) {
  838. return true;
  839. }
  840. return false;
  841. }
  842. function prevValidNode(node) {
  843. while (!validNode(node)) {
  844. if (node.previousSibling) {
  845. node = node.previousSibling;
  846. } else {
  847. node = node.parentNode;
  848. }
  849. if (!node) {
  850. break;
  851. }
  852. }
  853. return node;
  854. }
  855. function indexOf$1(node) {
  856. let parent = node.parentNode;
  857. if (!parent) {
  858. return 0;
  859. }
  860. return Array.prototype.indexOf.call(parent.childNodes, node);
  861. }
  862. function child(node, index) {
  863. return node.childNodes[index];
  864. }
  865. function hasContent(node) {
  866. if (isElement(node)) {
  867. return true;
  868. } else if (isText(node) &&
  869. node.textContent.trim().length) {
  870. return true;
  871. }
  872. return false;
  873. }
  874. function indexOfTextNode(node, parent) {
  875. if (!isText(node)) {
  876. return -1;
  877. }
  878. let nodeTextContent = node.textContent;
  879. let child;
  880. let index = -1;
  881. for (var i = 0; i < parent.childNodes.length; i++) {
  882. child = parent.childNodes[i];
  883. if (child.nodeType === 3) {
  884. let text = parent.childNodes[i].textContent;
  885. if (text.includes(nodeTextContent)) {
  886. index = i;
  887. break;
  888. }
  889. }
  890. }
  891. return index;
  892. }
  893. /**
  894. * Throughout, whitespace is defined as one of the characters
  895. * "\t" TAB \u0009
  896. * "\n" LF \u000A
  897. * "\r" CR \u000D
  898. * " " SPC \u0020
  899. *
  900. * This does not use Javascript's "\s" because that includes non-breaking
  901. * spaces (and also some other characters).
  902. */
  903. /**
  904. * Determine if a node should be ignored by the iterator functions.
  905. * taken from https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Whitespace#Whitespace_helper_functions
  906. *
  907. * @param {Node} node An object implementing the DOM1 |Node| interface.
  908. * @return {boolean} true if the node is:
  909. * 1) A |Text| node that is all whitespace
  910. * 2) A |Comment| node
  911. * and otherwise false.
  912. */
  913. function isIgnorable(node) {
  914. return (node.nodeType === 8) || // A comment node
  915. ((node.nodeType === 3) && isAllWhitespace(node)); // a text node, all whitespace
  916. }
  917. /**
  918. * Determine whether a node's text content is entirely whitespace.
  919. *
  920. * @param {Node} node A node implementing the |CharacterData| interface (i.e., a |Text|, |Comment|, or |CDATASection| node
  921. * @return {boolean} true if all of the text content of |nod| is whitespace, otherwise false.
  922. */
  923. function isAllWhitespace(node) {
  924. return !(/[^\t\n\r ]/.test(node.textContent));
  925. }
  926. /**
  927. * Version of |previousSibling| that skips nodes that are entirely
  928. * whitespace or comments. (Normally |previousSibling| is a property
  929. * of all DOM nodes that gives the sibling node, the node that is
  930. * a child of the same parent, that occurs immediately before the
  931. * reference node.)
  932. *
  933. * @param {ChildNode} sib The reference node.
  934. * @return {Node|null} Either:
  935. * 1) The closest previous sibling to |sib| that is not ignorable according to |is_ignorable|, or
  936. * 2) null if no such node exists.
  937. */
  938. function previousSignificantNode(sib) {
  939. while ((sib = sib.previousSibling)) {
  940. if (!isIgnorable(sib)) return sib;
  941. }
  942. return null;
  943. }
  944. function breakInsideAvoidParentNode(node) {
  945. while ((node = node.parentNode)) {
  946. if (node && node.dataset && node.dataset.breakInside === "avoid") {
  947. return node;
  948. }
  949. }
  950. return null;
  951. }
  952. /**
  953. * Find a parent with a given node name.
  954. * @param {Node} node - initial Node
  955. * @param {string} nodeName - node name (eg. "TD", "TABLE", "STRONG"...)
  956. * @param {Node} limiter - go up to the parent until there's no more parent or the current node is equals to the limiter
  957. * @returns {Node|undefined} - Either:
  958. * 1) The closest parent for a the given node name, or
  959. * 2) undefined if no such node exists.
  960. */
  961. function parentOf(node, nodeName, limiter) {
  962. if (limiter && node === limiter) {
  963. return;
  964. }
  965. if (node.parentNode) {
  966. while ((node = node.parentNode)) {
  967. if (limiter && node === limiter) {
  968. return;
  969. }
  970. if (node.nodeName === nodeName) {
  971. return node;
  972. }
  973. }
  974. }
  975. }
  976. /**
  977. * Version of |nextSibling| that skips nodes that are entirely
  978. * whitespace or comments.
  979. *
  980. * @param {ChildNode} sib The reference node.
  981. * @return {Node|null} Either:
  982. * 1) The closest next sibling to |sib| that is not ignorable according to |is_ignorable|, or
  983. * 2) null if no such node exists.
  984. */
  985. function nextSignificantNode(sib) {
  986. while ((sib = sib.nextSibling)) {
  987. if (!isIgnorable(sib)) return sib;
  988. }
  989. return null;
  990. }
  991. function filterTree(content, func, what) {
  992. const treeWalker = document.createTreeWalker(
  993. content || this.dom,
  994. what || NodeFilter.SHOW_ALL,
  995. func ? { acceptNode: func } : null,
  996. false
  997. );
  998. let node;
  999. let current;
  1000. node = treeWalker.nextNode();
  1001. while(node) {
  1002. current = node;
  1003. node = treeWalker.nextNode();
  1004. current.parentNode.removeChild(current);
  1005. }
  1006. }
  1007. /**
  1008. * Layout
  1009. * @class
  1010. */
  1011. class BreakToken {
  1012. constructor(node, offset) {
  1013. this.node = node;
  1014. this.offset = offset;
  1015. }
  1016. equals(otherBreakToken) {
  1017. if (!otherBreakToken) {
  1018. return false;
  1019. }
  1020. if (this["node"] && otherBreakToken["node"] &&
  1021. this["node"] !== otherBreakToken["node"]) {
  1022. return false;
  1023. }
  1024. if (this["offset"] && otherBreakToken["offset"] &&
  1025. this["offset"] !== otherBreakToken["offset"]) {
  1026. return false;
  1027. }
  1028. return true;
  1029. }
  1030. }
  1031. const MAX_CHARS_PER_BREAK = 1500;
  1032. /**
  1033. * Layout
  1034. * @class
  1035. */
  1036. class Layout {
  1037. constructor(element, hooks, options) {
  1038. this.element = element;
  1039. this.bounds = this.element.getBoundingClientRect();
  1040. if (hooks) {
  1041. this.hooks = hooks;
  1042. } else {
  1043. this.hooks = {};
  1044. this.hooks.layout = new Hook();
  1045. this.hooks.renderNode = new Hook();
  1046. this.hooks.layoutNode = new Hook();
  1047. this.hooks.beforeOverflow = new Hook();
  1048. this.hooks.onOverflow = new Hook();
  1049. this.hooks.onBreakToken = new Hook();
  1050. }
  1051. this.settings = options || {};
  1052. this.maxChars = this.settings.maxChars || MAX_CHARS_PER_BREAK;
  1053. this.forceRenderBreak = false;
  1054. }
  1055. async renderTo(wrapper, source, breakToken, bounds = this.bounds) {
  1056. let start = this.getStart(source, breakToken);
  1057. let walker = walk(start, source);
  1058. let node;
  1059. let prevNode;
  1060. let done;
  1061. let next;
  1062. let hasRenderedContent = false;
  1063. let newBreakToken;
  1064. let length = 0;
  1065. let prevBreakToken = breakToken || new BreakToken(start);
  1066. while (!done && !newBreakToken) {
  1067. next = walker.next();
  1068. prevNode = node;
  1069. node = next.value;
  1070. done = next.done;
  1071. if (!node) {
  1072. this.hooks && this.hooks.layout.trigger(wrapper, this);
  1073. let imgs = wrapper.querySelectorAll("img");
  1074. if (imgs.length) {
  1075. await this.waitForImages(imgs);
  1076. }
  1077. newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
  1078. if (newBreakToken && newBreakToken.equals(prevBreakToken)) {
  1079. console.warn("Unable to layout item: ", prevNode);
  1080. return undefined;
  1081. }
  1082. return newBreakToken;
  1083. }
  1084. this.hooks && this.hooks.layoutNode.trigger(node);
  1085. // Check if the rendered element has a break set
  1086. if (hasRenderedContent && this.shouldBreak(node)) {
  1087. this.hooks && this.hooks.layout.trigger(wrapper, this);
  1088. let imgs = wrapper.querySelectorAll("img");
  1089. if (imgs.length) {
  1090. await this.waitForImages(imgs);
  1091. }
  1092. newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
  1093. if (!newBreakToken) {
  1094. newBreakToken = this.breakAt(node);
  1095. }
  1096. if (newBreakToken && newBreakToken.equals(prevBreakToken)) {
  1097. console.warn("Unable to layout item: ", node);
  1098. return undefined;
  1099. }
  1100. length = 0;
  1101. break;
  1102. }
  1103. // Should the Node be a shallow or deep clone
  1104. let shallow = isContainer(node);
  1105. let rendered = this.append(node, wrapper, breakToken, shallow);
  1106. length += rendered.textContent.length;
  1107. // Check if layout has content yet
  1108. if (!hasRenderedContent) {
  1109. hasRenderedContent = hasContent(node);
  1110. }
  1111. // Skip to the next node if a deep clone was rendered
  1112. if (!shallow) {
  1113. walker = walk(nodeAfter(node, source), source);
  1114. }
  1115. if (this.forceRenderBreak) {
  1116. this.hooks && this.hooks.layout.trigger(wrapper, this);
  1117. newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
  1118. if (!newBreakToken) {
  1119. newBreakToken = this.breakAt(node);
  1120. }
  1121. length = 0;
  1122. this.forceRenderBreak = false;
  1123. break;
  1124. }
  1125. // Only check x characters
  1126. if (length >= this.maxChars) {
  1127. this.hooks && this.hooks.layout.trigger(wrapper, this);
  1128. let imgs = wrapper.querySelectorAll("img");
  1129. if (imgs.length) {
  1130. await this.waitForImages(imgs);
  1131. }
  1132. newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
  1133. if (newBreakToken && newBreakToken.equals(prevBreakToken)) {
  1134. console.warn("Unable to layout item: ", node);
  1135. return undefined;
  1136. }
  1137. if (newBreakToken) {
  1138. length = 0;
  1139. }
  1140. }
  1141. }
  1142. return newBreakToken;
  1143. }
  1144. breakAt(node, offset = 0) {
  1145. let newBreakToken = new BreakToken(
  1146. node,
  1147. offset
  1148. );
  1149. let breakHooks = this.hooks.onBreakToken.triggerSync(newBreakToken, undefined, node, this);
  1150. breakHooks.forEach((newToken) => {
  1151. if (typeof newToken != "undefined") {
  1152. newBreakToken = newToken;
  1153. }
  1154. });
  1155. return newBreakToken;
  1156. }
  1157. shouldBreak(node) {
  1158. let previousSibling = previousSignificantNode(node);
  1159. let parentNode = node.parentNode;
  1160. let parentBreakBefore = needsBreakBefore(node) && parentNode && !previousSibling && needsBreakBefore(parentNode);
  1161. let doubleBreakBefore;
  1162. if (parentBreakBefore) {
  1163. doubleBreakBefore = node.dataset.breakBefore === parentNode.dataset.breakBefore;
  1164. }
  1165. return !doubleBreakBefore && needsBreakBefore(node) || needsPreviousBreakAfter(node) || needsPageBreak(node, previousSibling);
  1166. }
  1167. forceBreak() {
  1168. this.forceRenderBreak = true;
  1169. }
  1170. getStart(source, breakToken) {
  1171. let start;
  1172. let node = breakToken && breakToken.node;
  1173. if (node) {
  1174. start = node;
  1175. } else {
  1176. start = source.firstChild;
  1177. }
  1178. return start;
  1179. }
  1180. append(node, dest, breakToken, shallow = true, rebuild = true) {
  1181. let clone = cloneNode(node, !shallow);
  1182. if (node.parentNode && isElement(node.parentNode)) {
  1183. let parent = findElement(node.parentNode, dest);
  1184. // Rebuild chain
  1185. if (parent) {
  1186. parent.appendChild(clone);
  1187. } else if (rebuild) {
  1188. let fragment = rebuildAncestors(node);
  1189. parent = findElement(node.parentNode, fragment);
  1190. if (!parent) {
  1191. dest.appendChild(clone);
  1192. } else if (breakToken && isText(breakToken.node) && breakToken.offset > 0) {
  1193. clone.textContent = clone.textContent.substring(breakToken.offset);
  1194. parent.appendChild(clone);
  1195. } else {
  1196. parent.appendChild(clone);
  1197. }
  1198. dest.appendChild(fragment);
  1199. } else {
  1200. dest.appendChild(clone);
  1201. }
  1202. } else {
  1203. dest.appendChild(clone);
  1204. }
  1205. let nodeHooks = this.hooks.renderNode.triggerSync(clone, node, this);
  1206. nodeHooks.forEach((newNode) => {
  1207. if (typeof newNode != "undefined") {
  1208. clone = newNode;
  1209. }
  1210. });
  1211. return clone;
  1212. }
  1213. async waitForImages(imgs) {
  1214. let results = Array.from(imgs).map(async (img) => {
  1215. return this.awaitImageLoaded(img);
  1216. });
  1217. await Promise.all(results);
  1218. }
  1219. async awaitImageLoaded(image) {
  1220. return new Promise(resolve => {
  1221. if (image.complete !== true) {
  1222. image.onload = function () {
  1223. let {width, height} = window.getComputedStyle(image);
  1224. resolve(width, height);
  1225. };
  1226. image.onerror = function (e) {
  1227. let {width, height} = window.getComputedStyle(image);
  1228. resolve(width, height, e);
  1229. };
  1230. } else {
  1231. let {width, height} = window.getComputedStyle(image);
  1232. resolve(width, height);
  1233. }
  1234. });
  1235. }
  1236. avoidBreakInside(node, limiter) {
  1237. let breakNode;
  1238. if (node === limiter) {
  1239. return;
  1240. }
  1241. while (node.parentNode) {
  1242. node = node.parentNode;
  1243. if (node === limiter) {
  1244. break;
  1245. }
  1246. if (window.getComputedStyle(node)["break-inside"] === "avoid") {
  1247. breakNode = node;
  1248. break;
  1249. }
  1250. }
  1251. return breakNode;
  1252. }
  1253. createBreakToken(overflow, rendered, source) {
  1254. let container = overflow.startContainer;
  1255. let offset = overflow.startOffset;
  1256. let node, renderedNode, parent, index, temp;
  1257. if (isElement(container)) {
  1258. temp = child(container, offset);
  1259. if (isElement(temp)) {
  1260. renderedNode = findElement(temp, rendered);
  1261. if (!renderedNode) {
  1262. // Find closest element with data-ref
  1263. let prevNode = prevValidNode(temp);
  1264. if (!isElement(prevNode)) {
  1265. prevNode = prevNode.parentElement;
  1266. }
  1267. renderedNode = findElement(prevNode, rendered);
  1268. // Check if temp is the last rendered node at its level.
  1269. if (!temp.nextSibling) {
  1270. // We need to ensure that the previous sibling of temp is fully rendered.
  1271. const renderedNodeFromSource = findElement(renderedNode, source);
  1272. const walker = document.createTreeWalker(renderedNodeFromSource, NodeFilter.SHOW_ELEMENT);
  1273. const lastChildOfRenderedNodeFromSource = walker.lastChild();
  1274. const lastChildOfRenderedNodeMatchingFromRendered = findElement(lastChildOfRenderedNodeFromSource, rendered);
  1275. // Check if we found that the last child in source
  1276. if (!lastChildOfRenderedNodeMatchingFromRendered) {
  1277. // Pending content to be rendered before virtual break token
  1278. return;
  1279. }
  1280. // Otherwise we will return a break token as per below
  1281. }
  1282. // renderedNode is actually the last unbroken box that does not overflow.
  1283. // Break Token is therefore the next sibling of renderedNode within source node.
  1284. node = findElement(renderedNode, source).nextSibling;
  1285. offset = 0;
  1286. } else {
  1287. node = findElement(renderedNode, source);
  1288. offset = 0;
  1289. }
  1290. } else {
  1291. renderedNode = findElement(container, rendered);
  1292. if (!renderedNode) {
  1293. renderedNode = findElement(prevValidNode(container), rendered);
  1294. }
  1295. parent = findElement(renderedNode, source);
  1296. index = indexOfTextNode(temp, parent);
  1297. // No seperatation for the first textNode of an element
  1298. if(index === 0) {
  1299. node = parent;
  1300. offset = 0;
  1301. } else {
  1302. node = child(parent, index);
  1303. offset = 0;
  1304. }
  1305. }
  1306. } else {
  1307. renderedNode = findElement(container.parentNode, rendered);
  1308. if (!renderedNode) {
  1309. renderedNode = findElement(prevValidNode(container.parentNode), rendered);
  1310. }
  1311. parent = findElement(renderedNode, source);
  1312. index = indexOfTextNode(container, parent);
  1313. if (index === -1) {
  1314. return;
  1315. }
  1316. node = child(parent, index);
  1317. offset += node.textContent.indexOf(container.textContent);
  1318. }
  1319. if (!node) {
  1320. return;
  1321. }
  1322. return new BreakToken(
  1323. node,
  1324. offset
  1325. );
  1326. }
  1327. findBreakToken(rendered, source, bounds = this.bounds, prevBreakToken, extract = true) {
  1328. let overflow = this.findOverflow(rendered, bounds);
  1329. let breakToken, breakLetter;
  1330. let overflowHooks = this.hooks.onOverflow.triggerSync(overflow, rendered, bounds, this);
  1331. overflowHooks.forEach((newOverflow) => {
  1332. if (typeof newOverflow != "undefined") {
  1333. overflow = newOverflow;
  1334. }
  1335. });
  1336. if (overflow) {
  1337. breakToken = this.createBreakToken(overflow, rendered, source);
  1338. // breakToken is nullable
  1339. let breakHooks = this.hooks.onBreakToken.triggerSync(breakToken, overflow, rendered, this);
  1340. breakHooks.forEach((newToken) => {
  1341. if (typeof newToken != "undefined") {
  1342. breakToken = newToken;
  1343. }
  1344. });
  1345. // Stop removal if we are in a loop
  1346. if (breakToken && breakToken.equals(prevBreakToken)) {
  1347. return breakToken;
  1348. }
  1349. if (breakToken && breakToken["node"] && breakToken["offset"] && breakToken["node"].textContent) {
  1350. breakLetter = breakToken["node"].textContent.charAt(breakToken["offset"]);
  1351. } else {
  1352. breakLetter = undefined;
  1353. }
  1354. if (breakToken && breakToken.node && extract) {
  1355. this.removeOverflow(overflow, breakLetter);
  1356. }
  1357. }
  1358. return breakToken;
  1359. }
  1360. hasOverflow(element, bounds = this.bounds) {
  1361. let constrainingElement = element && element.parentNode; // this gets the element, instead of the wrapper for the width workaround
  1362. let {width} = element.getBoundingClientRect();
  1363. let scrollWidth = constrainingElement ? constrainingElement.scrollWidth : 0;
  1364. return Math.max(Math.floor(width), scrollWidth) > Math.round(bounds.width);
  1365. }
  1366. findOverflow(rendered, bounds = this.bounds) {
  1367. if (!this.hasOverflow(rendered, bounds)) return;
  1368. let start = Math.round(bounds.left);
  1369. let end = Math.round(bounds.right);
  1370. let range;
  1371. let walker = walk(rendered.firstChild, rendered);
  1372. // Find Start
  1373. let next, done, node, offset, skip, breakAvoid, prev, br;
  1374. while (!done) {
  1375. next = walker.next();
  1376. done = next.done;
  1377. node = next.value;
  1378. skip = false;
  1379. breakAvoid = false;
  1380. prev = undefined;
  1381. br = undefined;
  1382. if (node) {
  1383. let pos = getBoundingClientRect(node);
  1384. let left = Math.round(pos.left);
  1385. let right = Math.floor(pos.right);
  1386. if (!range && left >= end) {
  1387. // Check if it is a float
  1388. let isFloat = false;
  1389. // Check if the node is inside a break-inside: avoid table cell
  1390. const insideTableCell = parentOf(node, "TD", rendered);
  1391. if (insideTableCell && window.getComputedStyle(insideTableCell)["break-inside"] === "avoid") {
  1392. // breaking inside a table cell produces unexpected result, as a workaround, we forcibly avoid break inside in a cell.
  1393. prev = insideTableCell;
  1394. } else if (isElement(node)) {
  1395. let styles = window.getComputedStyle(node);
  1396. isFloat = styles.getPropertyValue("float") !== "none";
  1397. skip = styles.getPropertyValue("break-inside") === "avoid";
  1398. breakAvoid = node.dataset.breakBefore === "avoid" || node.dataset.previousBreakAfter === "avoid";
  1399. prev = breakAvoid && nodeBefore(node, rendered);
  1400. br = node.tagName === "BR" || node.tagName === "WBR";
  1401. }
  1402. if (prev) {
  1403. range = document.createRange();
  1404. range.selectNode(prev);
  1405. break;
  1406. }
  1407. if (!br && !isFloat && isElement(node)) {
  1408. range = document.createRange();
  1409. range.selectNode(node);
  1410. break;
  1411. }
  1412. if (isText(node) && node.textContent.trim().length) {
  1413. range = document.createRange();
  1414. range.selectNode(node);
  1415. break;
  1416. }
  1417. }
  1418. if (!range && isText(node) &&
  1419. node.textContent.trim().length &&
  1420. !breakInsideAvoidParentNode(node.parentNode)) {
  1421. let rects = getClientRects(node);
  1422. let rect;
  1423. left = 0;
  1424. for (var i = 0; i != rects.length; i++) {
  1425. rect = rects[i];
  1426. if (rect.width > 0 && (!left || rect.left > left)) {
  1427. left = rect.left;
  1428. }
  1429. }
  1430. if (left >= end) {
  1431. range = document.createRange();
  1432. offset = this.textBreak(node, start, end);
  1433. if (!offset) {
  1434. range = undefined;
  1435. } else {
  1436. range.setStart(node, offset);
  1437. }
  1438. break;
  1439. }
  1440. }
  1441. // Skip children
  1442. if (skip || right <= end) {
  1443. next = nodeAfter(node, rendered);
  1444. if (next) {
  1445. walker = walk(next, rendered);
  1446. }
  1447. }
  1448. }
  1449. }
  1450. // Find End
  1451. if (range) {
  1452. range.setEndAfter(rendered.lastChild);
  1453. return range;
  1454. }
  1455. }
  1456. findEndToken(rendered, source, bounds = this.bounds) {
  1457. if (rendered.childNodes.length === 0) {
  1458. return;
  1459. }
  1460. let lastChild = rendered.lastChild;
  1461. let lastNodeIndex;
  1462. while (lastChild && lastChild.lastChild) {
  1463. if (!validNode(lastChild)) {
  1464. // Only get elements with refs
  1465. lastChild = lastChild.previousSibling;
  1466. } else if (!validNode(lastChild.lastChild)) {
  1467. // Deal with invalid dom items
  1468. lastChild = prevValidNode(lastChild.lastChild);
  1469. break;
  1470. } else {
  1471. lastChild = lastChild.lastChild;
  1472. }
  1473. }
  1474. if (isText(lastChild)) {
  1475. if (lastChild.parentNode.dataset.ref) {
  1476. lastNodeIndex = indexOf$1(lastChild);
  1477. lastChild = lastChild.parentNode;
  1478. } else {
  1479. lastChild = lastChild.previousSibling;
  1480. }
  1481. }
  1482. let original = findElement(lastChild, source);
  1483. if (lastNodeIndex) {
  1484. original = original.childNodes[lastNodeIndex];
  1485. }
  1486. let after = nodeAfter(original);
  1487. return this.breakAt(after);
  1488. }
  1489. textBreak(node, start, end) {
  1490. let wordwalker = words(node);
  1491. let left = 0;
  1492. let right = 0;
  1493. let word, next, done, pos;
  1494. let offset;
  1495. while (!done) {
  1496. next = wordwalker.next();
  1497. word = next.value;
  1498. done = next.done;
  1499. if (!word) {
  1500. break;
  1501. }
  1502. pos = getBoundingClientRect(word);
  1503. left = Math.floor(pos.left);
  1504. right = Math.floor(pos.right);
  1505. if (left >= end) {
  1506. offset = word.startOffset;
  1507. break;
  1508. }
  1509. if (right > end) {
  1510. let letterwalker = letters(word);
  1511. let letter, nextLetter, doneLetter;
  1512. while (!doneLetter) {
  1513. nextLetter = letterwalker.next();
  1514. letter = nextLetter.value;
  1515. doneLetter = nextLetter.done;
  1516. if (!letter) {
  1517. break;
  1518. }
  1519. pos = getBoundingClientRect(letter);
  1520. left = Math.floor(pos.left);
  1521. if (left >= end) {
  1522. offset = letter.startOffset;
  1523. done = true;
  1524. break;
  1525. }
  1526. }
  1527. }
  1528. }
  1529. return offset;
  1530. }
  1531. removeOverflow(overflow, breakLetter) {
  1532. let {startContainer} = overflow;
  1533. let extracted = overflow.extractContents();
  1534. this.hyphenateAtBreak(startContainer, breakLetter);
  1535. return extracted;
  1536. }
  1537. hyphenateAtBreak(startContainer, breakLetter) {
  1538. if (isText(startContainer)) {
  1539. let startText = startContainer.textContent;
  1540. let prevLetter = startText[startText.length - 1];
  1541. // Add a hyphen if previous character is a letter or soft hyphen
  1542. if (
  1543. (breakLetter && /^\w|\u00AD$/.test(prevLetter) && /^\w|\u00AD$/.test(breakLetter)) ||
  1544. (!breakLetter && /^\w|\u00AD$/.test(prevLetter))
  1545. ) {
  1546. startContainer.parentNode.classList.add("pagedjs_hyphen");
  1547. startContainer.textContent += this.settings.hyphenGlyph || "\u2011";
  1548. }
  1549. }
  1550. }
  1551. equalTokens(a, b) {
  1552. if (!a || !b) {
  1553. return false;
  1554. }
  1555. if (a["node"] && b["node"] && a["node"] !== b["node"]) {
  1556. return false;
  1557. }
  1558. if (a["offset"] && b["offset"] && a["offset"] !== b["offset"]) {
  1559. return false;
  1560. }
  1561. return true;
  1562. }
  1563. }
  1564. eventEmitter(Layout.prototype);
  1565. /**
  1566. * Render a page
  1567. * @class
  1568. */
  1569. class Page {
  1570. constructor(pagesArea, pageTemplate, blank, hooks) {
  1571. this.pagesArea = pagesArea;
  1572. this.pageTemplate = pageTemplate;
  1573. this.blank = blank;
  1574. this.width = undefined;
  1575. this.height = undefined;
  1576. this.hooks = hooks;
  1577. // this.element = this.create(this.pageTemplate);
  1578. }
  1579. create(template, after) {
  1580. //let documentFragment = document.createRange().createContextualFragment( TEMPLATE );
  1581. //let page = documentFragment.children[0];
  1582. let clone = document.importNode(this.pageTemplate.content, true);
  1583. let page, index;
  1584. if (after) {
  1585. this.pagesArea.insertBefore(clone, after.nextElementSibling);
  1586. index = Array.prototype.indexOf.call(this.pagesArea.children, after.nextElementSibling);
  1587. page = this.pagesArea.children[index];
  1588. } else {
  1589. this.pagesArea.appendChild(clone);
  1590. page = this.pagesArea.lastChild;
  1591. }
  1592. let pagebox = page.querySelector(".pagedjs_pagebox");
  1593. let area = page.querySelector(".pagedjs_page_content");
  1594. let size = area.getBoundingClientRect();
  1595. area.style.columnWidth = Math.round(size.width) + "px";
  1596. area.style.columnGap = "calc(var(--pagedjs-margin-right) + var(--pagedjs-margin-left))";
  1597. // area.style.overflow = "scroll";
  1598. this.width = Math.round(size.width);
  1599. this.height = Math.round(size.height);
  1600. this.element = page;
  1601. this.pagebox = pagebox;
  1602. this.area = area;
  1603. return page;
  1604. }
  1605. createWrapper() {
  1606. let wrapper = document.createElement("div");
  1607. this.area.appendChild(wrapper);
  1608. this.wrapper = wrapper;
  1609. return wrapper;
  1610. }
  1611. index(pgnum) {
  1612. this.position = pgnum;
  1613. let page = this.element;
  1614. // let pagebox = this.pagebox;
  1615. let index = pgnum + 1;
  1616. let id = `page-${index}`;
  1617. this.id = id;
  1618. // page.dataset.pageNumber = index;
  1619. page.dataset.pageNumber = index;
  1620. page.setAttribute("id", id);
  1621. if (this.name) {
  1622. page.classList.add("pagedjs_" + this.name + "_page");
  1623. }
  1624. if (this.blank) {
  1625. page.classList.add("pagedjs_blank_page");
  1626. }
  1627. if (pgnum === 0) {
  1628. page.classList.add("pagedjs_first_page");
  1629. }
  1630. if (pgnum % 2 !== 1) {
  1631. page.classList.remove("pagedjs_left_page");
  1632. page.classList.add("pagedjs_right_page");
  1633. } else {
  1634. page.classList.remove("pagedjs_right_page");
  1635. page.classList.add("pagedjs_left_page");
  1636. }
  1637. }
  1638. /*
  1639. size(width, height) {
  1640. if (width === this.width && height === this.height) {
  1641. return;
  1642. }
  1643. this.width = width;
  1644. this.height = height;
  1645. this.element.style.width = Math.round(width) + "px";
  1646. this.element.style.height = Math.round(height) + "px";
  1647. this.element.style.columnWidth = Math.round(width) + "px";
  1648. }
  1649. */
  1650. async layout(contents, breakToken, maxChars) {
  1651. this.clear();
  1652. this.startToken = breakToken;
  1653. this.layoutMethod = new Layout(this.area, this.hooks, maxChars);
  1654. let newBreakToken = await this.layoutMethod.renderTo(this.wrapper, contents, breakToken);
  1655. this.addListeners(contents);
  1656. this.endToken = newBreakToken;
  1657. return newBreakToken;
  1658. }
  1659. async append(contents, breakToken) {
  1660. if (!this.layoutMethod) {
  1661. return this.layout(contents, breakToken);
  1662. }
  1663. let newBreakToken = await this.layoutMethod.renderTo(this.wrapper, contents, breakToken);
  1664. this.endToken = newBreakToken;
  1665. return newBreakToken;
  1666. }
  1667. getByParent(ref, entries) {
  1668. let e;
  1669. for (var i = 0; i < entries.length; i++) {
  1670. e = entries[i];
  1671. if (e.dataset.ref === ref) {
  1672. return e;
  1673. }
  1674. }
  1675. }
  1676. onOverflow(func) {
  1677. this._onOverflow = func;
  1678. }
  1679. onUnderflow(func) {
  1680. this._onUnderflow = func;
  1681. }
  1682. clear() {
  1683. this.removeListeners();
  1684. this.wrapper && this.wrapper.remove();
  1685. this.createWrapper();
  1686. }
  1687. addListeners(contents) {
  1688. if (typeof ResizeObserver !== "undefined") {
  1689. this.addResizeObserver(contents);
  1690. } else {
  1691. this._checkOverflowAfterResize = this.checkOverflowAfterResize.bind(this, contents);
  1692. this.element.addEventListener("overflow", this._checkOverflowAfterResize, false);
  1693. this.element.addEventListener("underflow", this._checkOverflowAfterResize, false);
  1694. }
  1695. // TODO: fall back to mutation observer?
  1696. this._onScroll = function () {
  1697. if (this.listening) {
  1698. this.element.scrollLeft = 0;
  1699. }
  1700. }.bind(this);
  1701. // Keep scroll left from changing
  1702. this.element.addEventListener("scroll", this._onScroll);
  1703. this.listening = true;
  1704. return true;
  1705. }
  1706. removeListeners() {
  1707. this.listening = false;
  1708. if (typeof ResizeObserver !== "undefined" && this.ro) {
  1709. this.ro.disconnect();
  1710. } else if (this.element) {
  1711. this.element.removeEventListener("overflow", this._checkOverflowAfterResize, false);
  1712. this.element.removeEventListener("underflow", this._checkOverflowAfterResize, false);
  1713. }
  1714. this.element && this.element.removeEventListener("scroll", this._onScroll);
  1715. }
  1716. addResizeObserver(contents) {
  1717. let wrapper = this.wrapper;
  1718. let prevHeight = wrapper.getBoundingClientRect().height;
  1719. this.ro = new ResizeObserver(entries => {
  1720. if (!this.listening) {
  1721. return;
  1722. }
  1723. requestAnimationFrame(() => {
  1724. for (let entry of entries) {
  1725. const cr = entry.contentRect;
  1726. if (cr.height > prevHeight) {
  1727. this.checkOverflowAfterResize(contents);
  1728. prevHeight = wrapper.getBoundingClientRect().height;
  1729. } else if (cr.height < prevHeight) { // TODO: calc line height && (prevHeight - cr.height) >= 22
  1730. this.checkUnderflowAfterResize(contents);
  1731. prevHeight = cr.height;
  1732. }
  1733. }
  1734. });
  1735. });
  1736. this.ro.observe(wrapper);
  1737. }
  1738. checkOverflowAfterResize(contents) {
  1739. if (!this.listening || !this.layoutMethod) {
  1740. return;
  1741. }
  1742. let newBreakToken = this.layoutMethod.findBreakToken(this.wrapper, contents, this.startToken);
  1743. if (newBreakToken) {
  1744. this.endToken = newBreakToken;
  1745. this._onOverflow && this._onOverflow(newBreakToken);
  1746. }
  1747. }
  1748. checkUnderflowAfterResize(contents) {
  1749. if (!this.listening || !this.layoutMethod) {
  1750. return;
  1751. }
  1752. let endToken = this.layoutMethod.findEndToken(this.wrapper, contents);
  1753. if (endToken) {
  1754. this._onUnderflow && this._onUnderflow(endToken);
  1755. }
  1756. }
  1757. destroy() {
  1758. this.removeListeners();
  1759. this.element.remove();
  1760. this.element = undefined;
  1761. this.wrapper = undefined;
  1762. }
  1763. }
  1764. eventEmitter(Page.prototype);
  1765. /**
  1766. * Render a flow of text offscreen
  1767. * @class
  1768. */
  1769. class ContentParser {
  1770. constructor(content, cb) {
  1771. if (content && content.nodeType) {
  1772. // handle dom
  1773. this.dom = this.add(content);
  1774. } else if (typeof content === "string") {
  1775. this.dom = this.parse(content);
  1776. }
  1777. return this.dom;
  1778. }
  1779. parse(markup, mime) {
  1780. let range = document.createRange();
  1781. let fragment = range.createContextualFragment(markup);
  1782. this.addRefs(fragment);
  1783. return fragment;
  1784. }
  1785. add(contents) {
  1786. // let fragment = document.createDocumentFragment();
  1787. //
  1788. // let children = [...contents.childNodes];
  1789. // for (let child of children) {
  1790. // let clone = child.cloneNode(true);
  1791. // fragment.appendChild(clone);
  1792. // }
  1793. this.addRefs(contents);
  1794. return contents;
  1795. }
  1796. addRefs(content) {
  1797. var treeWalker = document.createTreeWalker(
  1798. content,
  1799. NodeFilter.SHOW_ELEMENT,
  1800. null,
  1801. false
  1802. );
  1803. let node = treeWalker.nextNode();
  1804. while(node) {
  1805. if (!node.hasAttribute("data-ref")) {
  1806. let uuid = UUID();
  1807. node.setAttribute("data-ref", uuid);
  1808. }
  1809. if (node.id) {
  1810. node.setAttribute("data-id", node.id);
  1811. }
  1812. // node.setAttribute("data-children", node.childNodes.length);
  1813. // node.setAttribute("data-text", node.textContent.trim().length);
  1814. node = treeWalker.nextNode();
  1815. }
  1816. }
  1817. find(ref) {
  1818. return this.refs[ref];
  1819. }
  1820. destroy() {
  1821. this.refs = undefined;
  1822. this.dom = undefined;
  1823. }
  1824. }
  1825. /**
  1826. * Queue for handling tasks one at a time
  1827. * @class
  1828. * @param {scope} context what this will resolve to in the tasks
  1829. */
  1830. class Queue {
  1831. constructor(context){
  1832. this._q = [];
  1833. this.context = context;
  1834. this.tick = requestAnimationFrame;
  1835. this.running = false;
  1836. this.paused = false;
  1837. }
  1838. /**
  1839. * Add an item to the queue
  1840. * @return {Promise} enqueued
  1841. */
  1842. enqueue() {
  1843. var deferred, promise;
  1844. var queued;
  1845. var task = [].shift.call(arguments);
  1846. var args = arguments;
  1847. // Handle single args without context
  1848. // if(args && !Array.isArray(args)) {
  1849. // args = [args];
  1850. // }
  1851. if(!task) {
  1852. throw new Error("No Task Provided");
  1853. }
  1854. if(typeof task === "function"){
  1855. deferred = new defer();
  1856. promise = deferred.promise;
  1857. queued = {
  1858. "task" : task,
  1859. "args" : args,
  1860. //"context" : context,
  1861. "deferred" : deferred,
  1862. "promise" : promise
  1863. };
  1864. } else {
  1865. // Task is a promise
  1866. queued = {
  1867. "promise" : task
  1868. };
  1869. }
  1870. this._q.push(queued);
  1871. // Wait to start queue flush
  1872. if (this.paused == false && !this.running) {
  1873. this.run();
  1874. }
  1875. return queued.promise;
  1876. }
  1877. /**
  1878. * Run one item
  1879. * @return {Promise} dequeued
  1880. */
  1881. dequeue(){
  1882. var inwait, task, result;
  1883. if(this._q.length && !this.paused) {
  1884. inwait = this._q.shift();
  1885. task = inwait.task;
  1886. if(task){
  1887. // console.log(task)
  1888. result = task.apply(this.context, inwait.args);
  1889. if(result && typeof result["then"] === "function") {
  1890. // Task is a function that returns a promise
  1891. return result.then(function(){
  1892. inwait.deferred.resolve.apply(this.context, arguments);
  1893. }.bind(this), function() {
  1894. inwait.deferred.reject.apply(this.context, arguments);
  1895. }.bind(this));
  1896. } else {
  1897. // Task resolves immediately
  1898. inwait.deferred.resolve.apply(this.context, result);
  1899. return inwait.promise;
  1900. }
  1901. } else if(inwait.promise) {
  1902. // Task is a promise
  1903. return inwait.promise;
  1904. }
  1905. } else {
  1906. inwait = new defer();
  1907. inwait.deferred.resolve();
  1908. return inwait.promise;
  1909. }
  1910. }
  1911. // Run All Immediately
  1912. dump(){
  1913. while(this._q.length) {
  1914. this.dequeue();
  1915. }
  1916. }
  1917. /**
  1918. * Run all tasks sequentially, at convince
  1919. * @return {Promise} all run
  1920. */
  1921. run(){
  1922. if(!this.running){
  1923. this.running = true;
  1924. this.defered = new defer();
  1925. }
  1926. this.tick.call(window, () => {
  1927. if(this._q.length) {
  1928. this.dequeue()
  1929. .then(function(){
  1930. this.run();
  1931. }.bind(this));
  1932. } else {
  1933. this.defered.resolve();
  1934. this.running = undefined;
  1935. }
  1936. });
  1937. // Unpause
  1938. if(this.paused == true) {
  1939. this.paused = false;
  1940. }
  1941. return this.defered.promise;
  1942. }
  1943. /**
  1944. * Flush all, as quickly as possible
  1945. * @return {Promise} ran
  1946. */
  1947. flush(){
  1948. if(this.running){
  1949. return this.running;
  1950. }
  1951. if(this._q.length) {
  1952. this.running = this.dequeue()
  1953. .then(function(){
  1954. this.running = undefined;
  1955. return this.flush();
  1956. }.bind(this));
  1957. return this.running;
  1958. }
  1959. }
  1960. /**
  1961. * Clear all items in wait
  1962. * @return {void}
  1963. */
  1964. clear(){
  1965. this._q = [];
  1966. }
  1967. /**
  1968. * Get the number of tasks in the queue
  1969. * @return {number} tasks
  1970. */
  1971. length(){
  1972. return this._q.length;
  1973. }
  1974. /**
  1975. * Pause a running queue
  1976. * @return {void}
  1977. */
  1978. pause(){
  1979. this.paused = true;
  1980. }
  1981. /**
  1982. * End the queue
  1983. * @return {void}
  1984. */
  1985. stop(){
  1986. this._q = [];
  1987. this.running = false;
  1988. this.paused = true;
  1989. }
  1990. }
  1991. const TEMPLATE = `
  1992. <div class="pagedjs_page">
  1993. <div class="pagedjs_sheet">
  1994. <div class="pagedjs_bleed pagedjs_bleed-top">
  1995. <div class="pagedjs_marks-crop"></div>
  1996. <div class="pagedjs_marks-middle">
  1997. <div class="pagedjs_marks-cross"></div>
  1998. </div>
  1999. <div class="pagedjs_marks-crop"></div>
  2000. </div>
  2001. <div class="pagedjs_bleed pagedjs_bleed-bottom">
  2002. <div class="pagedjs_marks-crop"></div>
  2003. <div class="pagedjs_marks-middle">
  2004. <div class="pagedjs_marks-cross"></div>
  2005. </div> <div class="pagedjs_marks-crop"></div>
  2006. </div>
  2007. <div class="pagedjs_bleed pagedjs_bleed-left">
  2008. <div class="pagedjs_marks-crop"></div>
  2009. <div class="pagedjs_marks-middle">
  2010. <div class="pagedjs_marks-cross"></div>
  2011. </div> <div class="pagedjs_marks-crop"></div>
  2012. </div>
  2013. <div class="pagedjs_bleed pagedjs_bleed-right">
  2014. <div class="pagedjs_marks-crop"></div>
  2015. <div class="pagedjs_marks-middle">
  2016. <div class="pagedjs_marks-cross"></div>
  2017. </div>
  2018. <div class="pagedjs_marks-crop"></div>
  2019. </div>
  2020. <div class="pagedjs_pagebox">
  2021. <div class="pagedjs_margin-top-left-corner-holder">
  2022. <div class="pagedjs_margin pagedjs_margin-top-left-corner"><div class="pagedjs_margin-content"></div></div>
  2023. </div>
  2024. <div class="pagedjs_margin-top">
  2025. <div class="pagedjs_margin pagedjs_margin-top-left"><div class="pagedjs_margin-content"></div></div>
  2026. <div class="pagedjs_margin pagedjs_margin-top-center"><div class="pagedjs_margin-content"></div></div>
  2027. <div class="pagedjs_margin pagedjs_margin-top-right"><div class="pagedjs_margin-content"></div></div>
  2028. </div>
  2029. <div class="pagedjs_margin-top-right-corner-holder">
  2030. <div class="pagedjs_margin pagedjs_margin-top-right-corner"><div class="pagedjs_margin-content"></div></div>
  2031. </div>
  2032. <div class="pagedjs_margin-right">
  2033. <div class="pagedjs_margin pagedjs_margin-right-top"><div class="pagedjs_margin-content"></div></div>
  2034. <div class="pagedjs_margin pagedjs_margin-right-middle"><div class="pagedjs_margin-content"></div></div>
  2035. <div class="pagedjs_margin pagedjs_margin-right-bottom"><div class="pagedjs_margin-content"></div></div>
  2036. </div>
  2037. <div class="pagedjs_margin-left">
  2038. <div class="pagedjs_margin pagedjs_margin-left-top"><div class="pagedjs_margin-content"></div></div>
  2039. <div class="pagedjs_margin pagedjs_margin-left-middle"><div class="pagedjs_margin-content"></div></div>
  2040. <div class="pagedjs_margin pagedjs_margin-left-bottom"><div class="pagedjs_margin-content"></div></div>
  2041. </div>
  2042. <div class="pagedjs_margin-bottom-left-corner-holder">
  2043. <div class="pagedjs_margin pagedjs_margin-bottom-left-corner"><div class="pagedjs_margin-content"></div></div>
  2044. </div>
  2045. <div class="pagedjs_margin-bottom">
  2046. <div class="pagedjs_margin pagedjs_margin-bottom-left"><div class="pagedjs_margin-content"></div></div>
  2047. <div class="pagedjs_margin pagedjs_margin-bottom-center"><div class="pagedjs_margin-content"></div></div>
  2048. <div class="pagedjs_margin pagedjs_margin-bottom-right"><div class="pagedjs_margin-content"></div></div>
  2049. </div>
  2050. <div class="pagedjs_margin-bottom-right-corner-holder">
  2051. <div class="pagedjs_margin pagedjs_margin-bottom-right-corner"><div class="pagedjs_margin-content"></div></div>
  2052. </div>
  2053. <div class="pagedjs_area">
  2054. <div class="pagedjs_page_content"></div>
  2055. </div>
  2056. </div>
  2057. </div>
  2058. </div>`;
  2059. /**
  2060. * Chop up text into flows
  2061. * @class
  2062. */
  2063. class Chunker {
  2064. constructor(content, renderTo, options) {
  2065. // this.preview = preview;
  2066. this.settings = options || {};
  2067. this.hooks = {};
  2068. this.hooks.beforeParsed = new Hook(this);
  2069. this.hooks.filter = new Hook(this);
  2070. this.hooks.afterParsed = new Hook(this);
  2071. this.hooks.beforePageLayout = new Hook(this);
  2072. this.hooks.layout = new Hook(this);
  2073. this.hooks.renderNode = new Hook(this);
  2074. this.hooks.layoutNode = new Hook(this);
  2075. this.hooks.onOverflow = new Hook(this);
  2076. this.hooks.onBreakToken = new Hook();
  2077. this.hooks.afterPageLayout = new Hook(this);
  2078. this.hooks.afterRendered = new Hook(this);
  2079. this.pages = [];
  2080. this.total = 0;
  2081. this.q = new Queue(this);
  2082. this.stopped = false;
  2083. this.rendered = false;
  2084. this.content = content;
  2085. this.charsPerBreak = [];
  2086. this.maxChars;
  2087. if (content) {
  2088. this.flow(content, renderTo);
  2089. }
  2090. }
  2091. setup(renderTo) {
  2092. this.pagesArea = document.createElement("div");
  2093. this.pagesArea.classList.add("pagedjs_pages");
  2094. if (renderTo) {
  2095. renderTo.appendChild(this.pagesArea);
  2096. } else {
  2097. document.querySelector("body").appendChild(this.pagesArea);
  2098. }
  2099. this.pageTemplate = document.createElement("template");
  2100. this.pageTemplate.innerHTML = TEMPLATE;
  2101. }
  2102. async flow(content, renderTo) {
  2103. let parsed;
  2104. await this.hooks.beforeParsed.trigger(content, this);
  2105. parsed = new ContentParser(content);
  2106. this.hooks.filter.triggerSync(parsed);
  2107. this.source = parsed;
  2108. this.breakToken = undefined;
  2109. if (this.pagesArea && this.pageTemplate) {
  2110. this.q.clear();
  2111. this.removePages();
  2112. } else {
  2113. this.setup(renderTo);
  2114. }
  2115. this.emit("rendering", parsed);
  2116. await this.hooks.afterParsed.trigger(parsed, this);
  2117. await this.loadFonts();
  2118. let rendered = await this.render(parsed, this.breakToken);
  2119. while (rendered.canceled) {
  2120. this.start();
  2121. rendered = await this.render(parsed, this.breakToken);
  2122. }
  2123. this.rendered = true;
  2124. this.pagesArea.style.setProperty("--pagedjs-page-count", this.total);
  2125. await this.hooks.afterRendered.trigger(this.pages, this);
  2126. this.emit("rendered", this.pages);
  2127. return this;
  2128. }
  2129. // oversetPages() {
  2130. // let overset = [];
  2131. // for (let i = 0; i < this.pages.length; i++) {
  2132. // let page = this.pages[i];
  2133. // if (page.overset) {
  2134. // overset.push(page);
  2135. // // page.overset = false;
  2136. // }
  2137. // }
  2138. // return overset;
  2139. // }
  2140. //
  2141. // async handleOverset(parsed) {
  2142. // let overset = this.oversetPages();
  2143. // if (overset.length) {
  2144. // console.log("overset", overset);
  2145. // let index = this.pages.indexOf(overset[0]) + 1;
  2146. // console.log("INDEX", index);
  2147. //
  2148. // // Remove pages
  2149. // // this.removePages(index);
  2150. //
  2151. // // await this.render(parsed, overset[0].overset);
  2152. //
  2153. // // return this.handleOverset(parsed);
  2154. // }
  2155. // }
  2156. async render(parsed, startAt) {
  2157. let renderer = this.layout(parsed, startAt, this.settings);
  2158. let done = false;
  2159. let result;
  2160. while (!done) {
  2161. result = await this.q.enqueue(() => { return this.renderAsync(renderer); });
  2162. done = result.done;
  2163. }
  2164. return result;
  2165. }
  2166. start() {
  2167. this.rendered = false;
  2168. this.stopped = false;
  2169. }
  2170. stop() {
  2171. this.stopped = true;
  2172. // this.q.clear();
  2173. }
  2174. renderOnIdle(renderer) {
  2175. return new Promise(resolve => {
  2176. requestIdleCallback(async () => {
  2177. if (this.stopped) {
  2178. return resolve({ done: true, canceled: true });
  2179. }
  2180. let result = await renderer.next();
  2181. if (this.stopped) {
  2182. resolve({ done: true, canceled: true });
  2183. } else {
  2184. resolve(result);
  2185. }
  2186. });
  2187. });
  2188. }
  2189. async renderAsync(renderer) {
  2190. if (this.stopped) {
  2191. return { done: true, canceled: true };
  2192. }
  2193. let result = await renderer.next();
  2194. if (this.stopped) {
  2195. return { done: true, canceled: true };
  2196. } else {
  2197. return result;
  2198. }
  2199. }
  2200. async handleBreaks(node) {
  2201. let currentPage = this.total + 1;
  2202. let currentPosition = currentPage % 2 === 0 ? "left" : "right";
  2203. // TODO: Recto and Verso should reverse for rtl languages
  2204. let currentSide = currentPage % 2 === 0 ? "verso" : "recto";
  2205. let previousBreakAfter;
  2206. let breakBefore;
  2207. let page;
  2208. if (currentPage === 1) {
  2209. return;
  2210. }
  2211. if (node &&
  2212. typeof node.dataset !== "undefined" &&
  2213. typeof node.dataset.previousBreakAfter !== "undefined") {
  2214. previousBreakAfter = node.dataset.previousBreakAfter;
  2215. }
  2216. if (node &&
  2217. typeof node.dataset !== "undefined" &&
  2218. typeof node.dataset.breakBefore !== "undefined") {
  2219. breakBefore = node.dataset.breakBefore;
  2220. }
  2221. if( previousBreakAfter &&
  2222. (previousBreakAfter === "left" || previousBreakAfter === "right") &&
  2223. previousBreakAfter !== currentPosition) {
  2224. page = this.addPage(true);
  2225. } else if( previousBreakAfter &&
  2226. (previousBreakAfter === "verso" || previousBreakAfter === "recto") &&
  2227. previousBreakAfter !== currentSide) {
  2228. page = this.addPage(true);
  2229. } else if( breakBefore &&
  2230. (breakBefore === "left" || breakBefore === "right") &&
  2231. breakBefore !== currentPosition) {
  2232. page = this.addPage(true);
  2233. } else if( breakBefore &&
  2234. (breakBefore === "verso" || breakBefore === "recto") &&
  2235. breakBefore !== currentSide) {
  2236. page = this.addPage(true);
  2237. }
  2238. if (page) {
  2239. await this.hooks.beforePageLayout.trigger(page, undefined, undefined, this);
  2240. this.emit("page", page);
  2241. // await this.hooks.layout.trigger(page.element, page, undefined, this);
  2242. await this.hooks.afterPageLayout.trigger(page.element, page, undefined, this);
  2243. this.emit("renderedPage", page);
  2244. }
  2245. }
  2246. async *layout(content, startAt) {
  2247. let breakToken = startAt || false;
  2248. while (breakToken !== undefined && ( true)) {
  2249. if (breakToken && breakToken.node) {
  2250. await this.handleBreaks(breakToken.node);
  2251. } else {
  2252. await this.handleBreaks(content.firstChild);
  2253. }
  2254. let page = this.addPage();
  2255. await this.hooks.beforePageLayout.trigger(page, content, breakToken, this);
  2256. this.emit("page", page);
  2257. // Layout content in the page, starting from the breakToken
  2258. breakToken = await page.layout(content, breakToken, this.maxChars);
  2259. await this.hooks.afterPageLayout.trigger(page.element, page, breakToken, this);
  2260. this.emit("renderedPage", page);
  2261. this.recoredCharLength(page.wrapper.textContent.length);
  2262. yield breakToken;
  2263. // Stop if we get undefined, showing we have reached the end of the content
  2264. }
  2265. }
  2266. recoredCharLength(length) {
  2267. if (length === 0) {
  2268. return;
  2269. }
  2270. this.charsPerBreak.push(length);
  2271. // Keep the length of the last few breaks
  2272. if (this.charsPerBreak.length > 4) {
  2273. this.charsPerBreak.shift();
  2274. }
  2275. this.maxChars = this.charsPerBreak.reduce((a, b) => a + b, 0) / (this.charsPerBreak.length);
  2276. }
  2277. removePages(fromIndex=0) {
  2278. if (fromIndex >= this.pages.length) {
  2279. return;
  2280. }
  2281. // Remove pages
  2282. for (let i = fromIndex; i < this.pages.length; i++) {
  2283. this.pages[i].destroy();
  2284. }
  2285. if (fromIndex > 0) {
  2286. this.pages.splice(fromIndex);
  2287. } else {
  2288. this.pages = [];
  2289. }
  2290. this.total = this.pages.length;
  2291. }
  2292. addPage(blank) {
  2293. let lastPage = this.pages[this.pages.length - 1];
  2294. // Create a new page from the template
  2295. let page = new Page(this.pagesArea, this.pageTemplate, blank, this.hooks);
  2296. this.pages.push(page);
  2297. // Create the pages
  2298. page.create(undefined, lastPage && lastPage.element);
  2299. page.index(this.total);
  2300. if (!blank) {
  2301. // Listen for page overflow
  2302. page.onOverflow((overflowToken) => {
  2303. console.warn("overflow on", page.id, overflowToken);
  2304. // Only reflow while rendering
  2305. if (this.rendered) {
  2306. return;
  2307. }
  2308. let index = this.pages.indexOf(page) + 1;
  2309. // Stop the rendering
  2310. this.stop();
  2311. // Set the breakToken to resume at
  2312. this.breakToken = overflowToken;
  2313. // Remove pages
  2314. this.removePages(index);
  2315. if (this.rendered === true) {
  2316. this.rendered = false;
  2317. this.q.enqueue(async () => {
  2318. this.start();
  2319. await this.render(this.source, this.breakToken);
  2320. this.rendered = true;
  2321. });
  2322. }
  2323. });
  2324. page.onUnderflow((overflowToken) => {
  2325. // console.log("underflow on", page.id, overflowToken);
  2326. // page.append(this.source, overflowToken);
  2327. });
  2328. }
  2329. this.total = this.pages.length;
  2330. return page;
  2331. }
  2332. /*
  2333. insertPage(index, blank) {
  2334. let lastPage = this.pages[index];
  2335. // Create a new page from the template
  2336. let page = new Page(this.pagesArea, this.pageTemplate, blank, this.hooks);
  2337. let total = this.pages.splice(index, 0, page);
  2338. // Create the pages
  2339. page.create(undefined, lastPage && lastPage.element);
  2340. page.index(index + 1);
  2341. for (let i = index + 2; i < this.pages.length; i++) {
  2342. this.pages[i].index(i);
  2343. }
  2344. if (!blank) {
  2345. // Listen for page overflow
  2346. page.onOverflow((overflowToken) => {
  2347. if (total < this.pages.length) {
  2348. this.pages[total].layout(this.source, overflowToken);
  2349. } else {
  2350. let newPage = this.addPage();
  2351. newPage.layout(this.source, overflowToken);
  2352. }
  2353. });
  2354. page.onUnderflow(() => {
  2355. // console.log("underflow on", page.id);
  2356. });
  2357. }
  2358. this.total += 1;
  2359. return page;
  2360. }
  2361. */
  2362. loadFonts() {
  2363. let fontPromises = [];
  2364. (document.fonts || []).forEach((fontFace) => {
  2365. if (fontFace.status !== "loaded") {
  2366. let fontLoaded = fontFace.load().then((r) => {
  2367. return fontFace.family;
  2368. }, (r) => {
  2369. console.warn("Failed to preload font-family:", fontFace.family);
  2370. return fontFace.family;
  2371. });
  2372. fontPromises.push(fontLoaded);
  2373. }
  2374. });
  2375. return Promise.all(fontPromises).catch((err) => {
  2376. console.warn(err);
  2377. });
  2378. }
  2379. destroy() {
  2380. this.pagesArea.remove();
  2381. this.pageTemplate.remove();
  2382. }
  2383. }
  2384. eventEmitter(Chunker.prototype);
  2385. //
  2386. // list
  2387. // ┌──────┐
  2388. // ┌──────────────┼─head │
  2389. // │ │ tail─┼──────────────┐
  2390. // │ └──────┘ │
  2391. // ▼ ▼
  2392. // item item item item
  2393. // ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐
  2394. // null ◀──┼─prev │◀───┼─prev │◀───┼─prev │◀───┼─prev │
  2395. // │ next─┼───▶│ next─┼───▶│ next─┼───▶│ next─┼──▶ null
  2396. // ├──────┤ ├──────┤ ├──────┤ ├──────┤
  2397. // │ data │ │ data │ │ data │ │ data │
  2398. // └──────┘ └──────┘ └──────┘ └──────┘
  2399. //
  2400. function createItem(data) {
  2401. return {
  2402. prev: null,
  2403. next: null,
  2404. data: data
  2405. };
  2406. }
  2407. function allocateCursor(node, prev, next) {
  2408. var cursor;
  2409. if (cursors !== null) {
  2410. cursor = cursors;
  2411. cursors = cursors.cursor;
  2412. cursor.prev = prev;
  2413. cursor.next = next;
  2414. cursor.cursor = node.cursor;
  2415. } else {
  2416. cursor = {
  2417. prev: prev,
  2418. next: next,
  2419. cursor: node.cursor
  2420. };
  2421. }
  2422. node.cursor = cursor;
  2423. return cursor;
  2424. }
  2425. function releaseCursor(node) {
  2426. var cursor = node.cursor;
  2427. node.cursor = cursor.cursor;
  2428. cursor.prev = null;
  2429. cursor.next = null;
  2430. cursor.cursor = cursors;
  2431. cursors = cursor;
  2432. }
  2433. var cursors = null;
  2434. var List = function() {
  2435. this.cursor = null;
  2436. this.head = null;
  2437. this.tail = null;
  2438. };
  2439. List.createItem = createItem;
  2440. List.prototype.createItem = createItem;
  2441. List.prototype.updateCursors = function(prevOld, prevNew, nextOld, nextNew) {
  2442. var cursor = this.cursor;
  2443. while (cursor !== null) {
  2444. if (cursor.prev === prevOld) {
  2445. cursor.prev = prevNew;
  2446. }
  2447. if (cursor.next === nextOld) {
  2448. cursor.next = nextNew;
  2449. }
  2450. cursor = cursor.cursor;
  2451. }
  2452. };
  2453. List.prototype.getSize = function() {
  2454. var size = 0;
  2455. var cursor = this.head;
  2456. while (cursor) {
  2457. size++;
  2458. cursor = cursor.next;
  2459. }
  2460. return size;
  2461. };
  2462. List.prototype.fromArray = function(array) {
  2463. var cursor = null;
  2464. this.head = null;
  2465. for (var i = 0; i < array.length; i++) {
  2466. var item = createItem(array[i]);
  2467. if (cursor !== null) {
  2468. cursor.next = item;
  2469. } else {
  2470. this.head = item;
  2471. }
  2472. item.prev = cursor;
  2473. cursor = item;
  2474. }
  2475. this.tail = cursor;
  2476. return this;
  2477. };
  2478. List.prototype.toArray = function() {
  2479. var cursor = this.head;
  2480. var result = [];
  2481. while (cursor) {
  2482. result.push(cursor.data);
  2483. cursor = cursor.next;
  2484. }
  2485. return result;
  2486. };
  2487. List.prototype.toJSON = List.prototype.toArray;
  2488. List.prototype.isEmpty = function() {
  2489. return this.head === null;
  2490. };
  2491. List.prototype.first = function() {
  2492. return this.head && this.head.data;
  2493. };
  2494. List.prototype.last = function() {
  2495. return this.tail && this.tail.data;
  2496. };
  2497. List.prototype.each = function(fn, context) {
  2498. var item;
  2499. if (context === undefined) {
  2500. context = this;
  2501. }
  2502. // push cursor
  2503. var cursor = allocateCursor(this, null, this.head);
  2504. while (cursor.next !== null) {
  2505. item = cursor.next;
  2506. cursor.next = item.next;
  2507. fn.call(context, item.data, item, this);
  2508. }
  2509. // pop cursor
  2510. releaseCursor(this);
  2511. };
  2512. List.prototype.forEach = List.prototype.each;
  2513. List.prototype.eachRight = function(fn, context) {
  2514. var item;
  2515. if (context === undefined) {
  2516. context = this;
  2517. }
  2518. // push cursor
  2519. var cursor = allocateCursor(this, this.tail, null);
  2520. while (cursor.prev !== null) {
  2521. item = cursor.prev;
  2522. cursor.prev = item.prev;
  2523. fn.call(context, item.data, item, this);
  2524. }
  2525. // pop cursor
  2526. releaseCursor(this);
  2527. };
  2528. List.prototype.forEachRight = List.prototype.eachRight;
  2529. List.prototype.nextUntil = function(start, fn, context) {
  2530. if (start === null) {
  2531. return;
  2532. }
  2533. var item;
  2534. if (context === undefined) {
  2535. context = this;
  2536. }
  2537. // push cursor
  2538. var cursor = allocateCursor(this, null, start);
  2539. while (cursor.next !== null) {
  2540. item = cursor.next;
  2541. cursor.next = item.next;
  2542. if (fn.call(context, item.data, item, this)) {
  2543. break;
  2544. }
  2545. }
  2546. // pop cursor
  2547. releaseCursor(this);
  2548. };
  2549. List.prototype.prevUntil = function(start, fn, context) {
  2550. if (start === null) {
  2551. return;
  2552. }
  2553. var item;
  2554. if (context === undefined) {
  2555. context = this;
  2556. }
  2557. // push cursor
  2558. var cursor = allocateCursor(this, start, null);
  2559. while (cursor.prev !== null) {
  2560. item = cursor.prev;
  2561. cursor.prev = item.prev;
  2562. if (fn.call(context, item.data, item, this)) {
  2563. break;
  2564. }
  2565. }
  2566. // pop cursor
  2567. releaseCursor(this);
  2568. };
  2569. List.prototype.some = function(fn, context) {
  2570. var cursor = this.head;
  2571. if (context === undefined) {
  2572. context = this;
  2573. }
  2574. while (cursor !== null) {
  2575. if (fn.call(context, cursor.data, cursor, this)) {
  2576. return true;
  2577. }
  2578. cursor = cursor.next;
  2579. }
  2580. return false;
  2581. };
  2582. List.prototype.map = function(fn, context) {
  2583. var result = new List();
  2584. var cursor = this.head;
  2585. if (context === undefined) {
  2586. context = this;
  2587. }
  2588. while (cursor !== null) {
  2589. result.appendData(fn.call(context, cursor.data, cursor, this));
  2590. cursor = cursor.next;
  2591. }
  2592. return result;
  2593. };
  2594. List.prototype.filter = function(fn, context) {
  2595. var result = new List();
  2596. var cursor = this.head;
  2597. if (context === undefined) {
  2598. context = this;
  2599. }
  2600. while (cursor !== null) {
  2601. if (fn.call(context, cursor.data, cursor, this)) {
  2602. result.appendData(cursor.data);
  2603. }
  2604. cursor = cursor.next;
  2605. }
  2606. return result;
  2607. };
  2608. List.prototype.clear = function() {
  2609. this.head = null;
  2610. this.tail = null;
  2611. };
  2612. List.prototype.copy = function() {
  2613. var result = new List();
  2614. var cursor = this.head;
  2615. while (cursor !== null) {
  2616. result.insert(createItem(cursor.data));
  2617. cursor = cursor.next;
  2618. }
  2619. return result;
  2620. };
  2621. List.prototype.prepend = function(item) {
  2622. // head
  2623. // ^
  2624. // item
  2625. this.updateCursors(null, item, this.head, item);
  2626. // insert to the beginning of the list
  2627. if (this.head !== null) {
  2628. // new item <- first item
  2629. this.head.prev = item;
  2630. // new item -> first item
  2631. item.next = this.head;
  2632. } else {
  2633. // if list has no head, then it also has no tail
  2634. // in this case tail points to the new item
  2635. this.tail = item;
  2636. }
  2637. // head always points to new item
  2638. this.head = item;
  2639. return this;
  2640. };
  2641. List.prototype.prependData = function(data) {
  2642. return this.prepend(createItem(data));
  2643. };
  2644. List.prototype.append = function(item) {
  2645. return this.insert(item);
  2646. };
  2647. List.prototype.appendData = function(data) {
  2648. return this.insert(createItem(data));
  2649. };
  2650. List.prototype.insert = function(item, before) {
  2651. if (before !== undefined && before !== null) {
  2652. // prev before
  2653. // ^
  2654. // item
  2655. this.updateCursors(before.prev, item, before, item);
  2656. if (before.prev === null) {
  2657. // insert to the beginning of list
  2658. if (this.head !== before) {
  2659. throw new Error('before doesn\'t belong to list');
  2660. }
  2661. // since head points to before therefore list doesn't empty
  2662. // no need to check tail
  2663. this.head = item;
  2664. before.prev = item;
  2665. item.next = before;
  2666. this.updateCursors(null, item);
  2667. } else {
  2668. // insert between two items
  2669. before.prev.next = item;
  2670. item.prev = before.prev;
  2671. before.prev = item;
  2672. item.next = before;
  2673. }
  2674. } else {
  2675. // tail
  2676. // ^
  2677. // item
  2678. this.updateCursors(this.tail, item, null, item);
  2679. // insert to the ending of the list
  2680. if (this.tail !== null) {
  2681. // last item -> new item
  2682. this.tail.next = item;
  2683. // last item <- new item
  2684. item.prev = this.tail;
  2685. } else {
  2686. // if list has no tail, then it also has no head
  2687. // in this case head points to new item
  2688. this.head = item;
  2689. }
  2690. // tail always points to new item
  2691. this.tail = item;
  2692. }
  2693. return this;
  2694. };
  2695. List.prototype.insertData = function(data, before) {
  2696. return this.insert(createItem(data), before);
  2697. };
  2698. List.prototype.remove = function(item) {
  2699. // item
  2700. // ^
  2701. // prev next
  2702. this.updateCursors(item, item.prev, item, item.next);
  2703. if (item.prev !== null) {
  2704. item.prev.next = item.next;
  2705. } else {
  2706. if (this.head !== item) {
  2707. throw new Error('item doesn\'t belong to list');
  2708. }
  2709. this.head = item.next;
  2710. }
  2711. if (item.next !== null) {
  2712. item.next.prev = item.prev;
  2713. } else {
  2714. if (this.tail !== item) {
  2715. throw new Error('item doesn\'t belong to list');
  2716. }
  2717. this.tail = item.prev;
  2718. }
  2719. item.prev = null;
  2720. item.next = null;
  2721. return item;
  2722. };
  2723. List.prototype.push = function(data) {
  2724. this.insert(createItem(data));
  2725. };
  2726. List.prototype.pop = function() {
  2727. if (this.tail !== null) {
  2728. return this.remove(this.tail);
  2729. }
  2730. };
  2731. List.prototype.unshift = function(data) {
  2732. this.prepend(createItem(data));
  2733. };
  2734. List.prototype.shift = function() {
  2735. if (this.head !== null) {
  2736. return this.remove(this.head);
  2737. }
  2738. };
  2739. List.prototype.prependList = function(list) {
  2740. return this.insertList(list, this.head);
  2741. };
  2742. List.prototype.appendList = function(list) {
  2743. return this.insertList(list);
  2744. };
  2745. List.prototype.insertList = function(list, before) {
  2746. // ignore empty lists
  2747. if (list.head === null) {
  2748. return this;
  2749. }
  2750. if (before !== undefined && before !== null) {
  2751. this.updateCursors(before.prev, list.tail, before, list.head);
  2752. // insert in the middle of dist list
  2753. if (before.prev !== null) {
  2754. // before.prev <-> list.head
  2755. before.prev.next = list.head;
  2756. list.head.prev = before.prev;
  2757. } else {
  2758. this.head = list.head;
  2759. }
  2760. before.prev = list.tail;
  2761. list.tail.next = before;
  2762. } else {
  2763. this.updateCursors(this.tail, list.tail, null, list.head);
  2764. // insert to end of the list
  2765. if (this.tail !== null) {
  2766. // if destination list has a tail, then it also has a head,
  2767. // but head doesn't change
  2768. // dest tail -> source head
  2769. this.tail.next = list.head;
  2770. // dest tail <- source head
  2771. list.head.prev = this.tail;
  2772. } else {
  2773. // if list has no a tail, then it also has no a head
  2774. // in this case points head to new item
  2775. this.head = list.head;
  2776. }
  2777. // tail always start point to new item
  2778. this.tail = list.tail;
  2779. }
  2780. list.head = null;
  2781. list.tail = null;
  2782. return this;
  2783. };
  2784. List.prototype.replace = function(oldItem, newItemOrList) {
  2785. if ('head' in newItemOrList) {
  2786. this.insertList(newItemOrList, oldItem);
  2787. } else {
  2788. this.insert(newItemOrList, oldItem);
  2789. }
  2790. this.remove(oldItem);
  2791. };
  2792. var List_1 = List;
  2793. var createCustomError = function createCustomError(name, message) {
  2794. // use Object.create(), because some VMs prevent setting line/column otherwise
  2795. // (iOS Safari 10 even throws an exception)
  2796. var error = Object.create(SyntaxError.prototype);
  2797. var errorStack = new Error();
  2798. error.name = name;
  2799. error.message = message;
  2800. Object.defineProperty(error, 'stack', {
  2801. get: function() {
  2802. return (errorStack.stack || '').replace(/^(.+\n){1,3}/, name + ': ' + message + '\n');
  2803. }
  2804. });
  2805. return error;
  2806. };
  2807. var MAX_LINE_LENGTH = 100;
  2808. var OFFSET_CORRECTION = 60;
  2809. var TAB_REPLACEMENT = ' ';
  2810. function sourceFragment(error, extraLines) {
  2811. function processLines(start, end) {
  2812. return lines.slice(start, end).map(function(line, idx) {
  2813. var num = String(start + idx + 1);
  2814. while (num.length < maxNumLength) {
  2815. num = ' ' + num;
  2816. }
  2817. return num + ' |' + line;
  2818. }).join('\n');
  2819. }
  2820. var lines = error.source.split(/\r\n?|\n|\f/);
  2821. var line = error.line;
  2822. var column = error.column;
  2823. var startLine = Math.max(1, line - extraLines) - 1;
  2824. var endLine = Math.min(line + extraLines, lines.length + 1);
  2825. var maxNumLength = Math.max(4, String(endLine).length) + 1;
  2826. var cutLeft = 0;
  2827. // column correction according to replaced tab before column
  2828. column += (TAB_REPLACEMENT.length - 1) * (lines[line - 1].substr(0, column - 1).match(/\t/g) || []).length;
  2829. if (column > MAX_LINE_LENGTH) {
  2830. cutLeft = column - OFFSET_CORRECTION + 3;
  2831. column = OFFSET_CORRECTION - 2;
  2832. }
  2833. for (var i = startLine; i <= endLine; i++) {
  2834. if (i >= 0 && i < lines.length) {
  2835. lines[i] = lines[i].replace(/\t/g, TAB_REPLACEMENT);
  2836. lines[i] =
  2837. (cutLeft > 0 && lines[i].length > cutLeft ? '\u2026' : '') +
  2838. lines[i].substr(cutLeft, MAX_LINE_LENGTH - 2) +
  2839. (lines[i].length > cutLeft + MAX_LINE_LENGTH - 1 ? '\u2026' : '');
  2840. }
  2841. }
  2842. return [
  2843. processLines(startLine, line),
  2844. new Array(column + maxNumLength + 2).join('-') + '^',
  2845. processLines(line, endLine)
  2846. ].filter(Boolean).join('\n');
  2847. }
  2848. var SyntaxError$1 = function(message, source, offset, line, column) {
  2849. var error = createCustomError('SyntaxError', message);
  2850. error.source = source;
  2851. error.offset = offset;
  2852. error.line = line;
  2853. error.column = column;
  2854. error.sourceFragment = function(extraLines) {
  2855. return sourceFragment(error, isNaN(extraLines) ? 0 : extraLines);
  2856. };
  2857. Object.defineProperty(error, 'formattedMessage', {
  2858. get: function() {
  2859. return (
  2860. 'Parse error: ' + error.message + '\n' +
  2861. sourceFragment(error, 2)
  2862. );
  2863. }
  2864. });
  2865. // for backward capability
  2866. error.parseError = {
  2867. offset: offset,
  2868. line: line,
  2869. column: column
  2870. };
  2871. return error;
  2872. };
  2873. var _SyntaxError = SyntaxError$1;
  2874. // CSS Syntax Module Level 3
  2875. // https://www.w3.org/TR/css-syntax-3/
  2876. var TYPE = {
  2877. EOF: 0, // <EOF-token>
  2878. Ident: 1, // <ident-token>
  2879. Function: 2, // <function-token>
  2880. AtKeyword: 3, // <at-keyword-token>
  2881. Hash: 4, // <hash-token>
  2882. String: 5, // <string-token>
  2883. BadString: 6, // <bad-string-token>
  2884. Url: 7, // <url-token>
  2885. BadUrl: 8, // <bad-url-token>
  2886. Delim: 9, // <delim-token>
  2887. Number: 10, // <number-token>
  2888. Percentage: 11, // <percentage-token>
  2889. Dimension: 12, // <dimension-token>
  2890. WhiteSpace: 13, // <whitespace-token>
  2891. CDO: 14, // <CDO-token>
  2892. CDC: 15, // <CDC-token>
  2893. Colon: 16, // <colon-token> :
  2894. Semicolon: 17, // <semicolon-token> ;
  2895. Comma: 18, // <comma-token> ,
  2896. LeftSquareBracket: 19, // <[-token>
  2897. RightSquareBracket: 20, // <]-token>
  2898. LeftParenthesis: 21, // <(-token>
  2899. RightParenthesis: 22, // <)-token>
  2900. LeftCurlyBracket: 23, // <{-token>
  2901. RightCurlyBracket: 24, // <}-token>
  2902. Comment: 25
  2903. };
  2904. var NAME = Object.keys(TYPE).reduce(function(result, key) {
  2905. result[TYPE[key]] = key;
  2906. return result;
  2907. }, {});
  2908. var _const = {
  2909. TYPE: TYPE,
  2910. NAME: NAME
  2911. };
  2912. var EOF = 0;
  2913. // https://drafts.csswg.org/css-syntax-3/
  2914. // § 4.2. Definitions
  2915. // digit
  2916. // A code point between U+0030 DIGIT ZERO (0) and U+0039 DIGIT NINE (9).
  2917. function isDigit(code) {
  2918. return code >= 0x0030 && code <= 0x0039;
  2919. }
  2920. // hex digit
  2921. // A digit, or a code point between U+0041 LATIN CAPITAL LETTER A (A) and U+0046 LATIN CAPITAL LETTER F (F),
  2922. // or a code point between U+0061 LATIN SMALL LETTER A (a) and U+0066 LATIN SMALL LETTER F (f).
  2923. function isHexDigit(code) {
  2924. return (
  2925. isDigit(code) || // 0 .. 9
  2926. (code >= 0x0041 && code <= 0x0046) || // A .. F
  2927. (code >= 0x0061 && code <= 0x0066) // a .. f
  2928. );
  2929. }
  2930. // uppercase letter
  2931. // A code point between U+0041 LATIN CAPITAL LETTER A (A) and U+005A LATIN CAPITAL LETTER Z (Z).
  2932. function isUppercaseLetter(code) {
  2933. return code >= 0x0041 && code <= 0x005A;
  2934. }
  2935. // lowercase letter
  2936. // A code point between U+0061 LATIN SMALL LETTER A (a) and U+007A LATIN SMALL LETTER Z (z).
  2937. function isLowercaseLetter(code) {
  2938. return code >= 0x0061 && code <= 0x007A;
  2939. }
  2940. // letter
  2941. // An uppercase letter or a lowercase letter.
  2942. function isLetter(code) {
  2943. return isUppercaseLetter(code) || isLowercaseLetter(code);
  2944. }
  2945. // non-ASCII code point
  2946. // A code point with a value equal to or greater than U+0080 <control>.
  2947. function isNonAscii(code) {
  2948. return code >= 0x0080;
  2949. }
  2950. // name-start code point
  2951. // A letter, a non-ASCII code point, or U+005F LOW LINE (_).
  2952. function isNameStart(code) {
  2953. return isLetter(code) || isNonAscii(code) || code === 0x005F;
  2954. }
  2955. // name code point
  2956. // A name-start code point, a digit, or U+002D HYPHEN-MINUS (-).
  2957. function isName(code) {
  2958. return isNameStart(code) || isDigit(code) || code === 0x002D;
  2959. }
  2960. // non-printable code point
  2961. // A code point between U+0000 NULL and U+0008 BACKSPACE, or U+000B LINE TABULATION,
  2962. // or a code point between U+000E SHIFT OUT and U+001F INFORMATION SEPARATOR ONE, or U+007F DELETE.
  2963. function isNonPrintable(code) {
  2964. return (
  2965. (code >= 0x0000 && code <= 0x0008) ||
  2966. (code === 0x000B) ||
  2967. (code >= 0x000E && code <= 0x001F) ||
  2968. (code === 0x007F)
  2969. );
  2970. }
  2971. // newline
  2972. // U+000A LINE FEED. Note that U+000D CARRIAGE RETURN and U+000C FORM FEED are not included in this definition,
  2973. // as they are converted to U+000A LINE FEED during preprocessing.
  2974. // TODO: we doesn't do a preprocessing, so check a code point for U+000D CARRIAGE RETURN and U+000C FORM FEED
  2975. function isNewline(code) {
  2976. return code === 0x000A || code === 0x000D || code === 0x000C;
  2977. }
  2978. // whitespace
  2979. // A newline, U+0009 CHARACTER TABULATION, or U+0020 SPACE.
  2980. function isWhiteSpace(code) {
  2981. return isNewline(code) || code === 0x0020 || code === 0x0009;
  2982. }
  2983. // § 4.3.8. Check if two code points are a valid escape
  2984. function isValidEscape(first, second) {
  2985. // If the first code point is not U+005C REVERSE SOLIDUS (\), return false.
  2986. if (first !== 0x005C) {
  2987. return false;
  2988. }
  2989. // Otherwise, if the second code point is a newline or EOF, return false.
  2990. if (isNewline(second) || second === EOF) {
  2991. return false;
  2992. }
  2993. // Otherwise, return true.
  2994. return true;
  2995. }
  2996. // § 4.3.9. Check if three code points would start an identifier
  2997. function isIdentifierStart(first, second, third) {
  2998. // Look at the first code point:
  2999. // U+002D HYPHEN-MINUS
  3000. if (first === 0x002D) {
  3001. // If the second code point is a name-start code point or a U+002D HYPHEN-MINUS,
  3002. // or the second and third code points are a valid escape, return true. Otherwise, return false.
  3003. return (
  3004. isNameStart(second) ||
  3005. second === 0x002D ||
  3006. isValidEscape(second, third)
  3007. );
  3008. }
  3009. // name-start code point
  3010. if (isNameStart(first)) {
  3011. // Return true.
  3012. return true;
  3013. }
  3014. // U+005C REVERSE SOLIDUS (\)
  3015. if (first === 0x005C) {
  3016. // If the first and second code points are a valid escape, return true. Otherwise, return false.
  3017. return isValidEscape(first, second);
  3018. }
  3019. // anything else
  3020. // Return false.
  3021. return false;
  3022. }
  3023. // § 4.3.10. Check if three code points would start a number
  3024. function isNumberStart(first, second, third) {
  3025. // Look at the first code point:
  3026. // U+002B PLUS SIGN (+)
  3027. // U+002D HYPHEN-MINUS (-)
  3028. if (first === 0x002B || first === 0x002D) {
  3029. // If the second code point is a digit, return true.
  3030. if (isDigit(second)) {
  3031. return 2;
  3032. }
  3033. // Otherwise, if the second code point is a U+002E FULL STOP (.)
  3034. // and the third code point is a digit, return true.
  3035. // Otherwise, return false.
  3036. return second === 0x002E && isDigit(third) ? 3 : 0;
  3037. }
  3038. // U+002E FULL STOP (.)
  3039. if (first === 0x002E) {
  3040. // If the second code point is a digit, return true. Otherwise, return false.
  3041. return isDigit(second) ? 2 : 0;
  3042. }
  3043. // digit
  3044. if (isDigit(first)) {
  3045. // Return true.
  3046. return 1;
  3047. }
  3048. // anything else
  3049. // Return false.
  3050. return 0;
  3051. }
  3052. //
  3053. // Misc
  3054. //
  3055. // detect BOM (https://en.wikipedia.org/wiki/Byte_order_mark)
  3056. function isBOM(code) {
  3057. // UTF-16BE
  3058. if (code === 0xFEFF) {
  3059. return 1;
  3060. }
  3061. // UTF-16LE
  3062. if (code === 0xFFFE) {
  3063. return 1;
  3064. }
  3065. return 0;
  3066. }
  3067. // Fast code category
  3068. //
  3069. // https://drafts.csswg.org/css-syntax/#tokenizer-definitions
  3070. // > non-ASCII code point
  3071. // > A code point with a value equal to or greater than U+0080 <control>
  3072. // > name-start code point
  3073. // > A letter, a non-ASCII code point, or U+005F LOW LINE (_).
  3074. // > name code point
  3075. // > A name-start code point, a digit, or U+002D HYPHEN-MINUS (-)
  3076. // That means only ASCII code points has a special meaning and we define a maps for 0..127 codes only
  3077. var CATEGORY = new Array(0x80);
  3078. charCodeCategory.Eof = 0x80;
  3079. charCodeCategory.WhiteSpace = 0x82;
  3080. charCodeCategory.Digit = 0x83;
  3081. charCodeCategory.NameStart = 0x84;
  3082. charCodeCategory.NonPrintable = 0x85;
  3083. for (var i = 0; i < CATEGORY.length; i++) {
  3084. switch (true) {
  3085. case isWhiteSpace(i):
  3086. CATEGORY[i] = charCodeCategory.WhiteSpace;
  3087. break;
  3088. case isDigit(i):
  3089. CATEGORY[i] = charCodeCategory.Digit;
  3090. break;
  3091. case isNameStart(i):
  3092. CATEGORY[i] = charCodeCategory.NameStart;
  3093. break;
  3094. case isNonPrintable(i):
  3095. CATEGORY[i] = charCodeCategory.NonPrintable;
  3096. break;
  3097. default:
  3098. CATEGORY[i] = i || charCodeCategory.Eof;
  3099. }
  3100. }
  3101. function charCodeCategory(code) {
  3102. return code < 0x80 ? CATEGORY[code] : charCodeCategory.NameStart;
  3103. }
  3104. var charCodeDefinitions = {
  3105. isDigit: isDigit,
  3106. isHexDigit: isHexDigit,
  3107. isUppercaseLetter: isUppercaseLetter,
  3108. isLowercaseLetter: isLowercaseLetter,
  3109. isLetter: isLetter,
  3110. isNonAscii: isNonAscii,
  3111. isNameStart: isNameStart,
  3112. isName: isName,
  3113. isNonPrintable: isNonPrintable,
  3114. isNewline: isNewline,
  3115. isWhiteSpace: isWhiteSpace,
  3116. isValidEscape: isValidEscape,
  3117. isIdentifierStart: isIdentifierStart,
  3118. isNumberStart: isNumberStart,
  3119. isBOM: isBOM,
  3120. charCodeCategory: charCodeCategory
  3121. };
  3122. var isDigit$1 = charCodeDefinitions.isDigit;
  3123. var isHexDigit$1 = charCodeDefinitions.isHexDigit;
  3124. var isUppercaseLetter$1 = charCodeDefinitions.isUppercaseLetter;
  3125. var isName$1 = charCodeDefinitions.isName;
  3126. var isWhiteSpace$1 = charCodeDefinitions.isWhiteSpace;
  3127. var isValidEscape$1 = charCodeDefinitions.isValidEscape;
  3128. function getCharCode(source, offset) {
  3129. return offset < source.length ? source.charCodeAt(offset) : 0;
  3130. }
  3131. function getNewlineLength(source, offset, code) {
  3132. if (code === 13 /* \r */ && getCharCode(source, offset + 1) === 10 /* \n */) {
  3133. return 2;
  3134. }
  3135. return 1;
  3136. }
  3137. function cmpChar(testStr, offset, referenceCode) {
  3138. var code = testStr.charCodeAt(offset);
  3139. // code.toLowerCase() for A..Z
  3140. if (isUppercaseLetter$1(code)) {
  3141. code = code | 32;
  3142. }
  3143. return code === referenceCode;
  3144. }
  3145. function cmpStr(testStr, start, end, referenceStr) {
  3146. if (end - start !== referenceStr.length) {
  3147. return false;
  3148. }
  3149. if (start < 0 || end > testStr.length) {
  3150. return false;
  3151. }
  3152. for (var i = start; i < end; i++) {
  3153. var testCode = testStr.charCodeAt(i);
  3154. var referenceCode = referenceStr.charCodeAt(i - start);
  3155. // testCode.toLowerCase() for A..Z
  3156. if (isUppercaseLetter$1(testCode)) {
  3157. testCode = testCode | 32;
  3158. }
  3159. if (testCode !== referenceCode) {
  3160. return false;
  3161. }
  3162. }
  3163. return true;
  3164. }
  3165. function findWhiteSpaceStart(source, offset) {
  3166. for (; offset >= 0; offset--) {
  3167. if (!isWhiteSpace$1(source.charCodeAt(offset))) {
  3168. break;
  3169. }
  3170. }
  3171. return offset + 1;
  3172. }
  3173. function findWhiteSpaceEnd(source, offset) {
  3174. for (; offset < source.length; offset++) {
  3175. if (!isWhiteSpace$1(source.charCodeAt(offset))) {
  3176. break;
  3177. }
  3178. }
  3179. return offset;
  3180. }
  3181. function findDecimalNumberEnd(source, offset) {
  3182. for (; offset < source.length; offset++) {
  3183. if (!isDigit$1(source.charCodeAt(offset))) {
  3184. break;
  3185. }
  3186. }
  3187. return offset;
  3188. }
  3189. // § 4.3.7. Consume an escaped code point
  3190. function consumeEscaped(source, offset) {
  3191. // It assumes that the U+005C REVERSE SOLIDUS (\) has already been consumed and
  3192. // that the next input code point has already been verified to be part of a valid escape.
  3193. offset += 2;
  3194. // hex digit
  3195. if (isHexDigit$1(getCharCode(source, offset - 1))) {
  3196. // Consume as many hex digits as possible, but no more than 5.
  3197. // Note that this means 1-6 hex digits have been consumed in total.
  3198. for (var maxOffset = Math.min(source.length, offset + 5); offset < maxOffset; offset++) {
  3199. if (!isHexDigit$1(getCharCode(source, offset))) {
  3200. break;
  3201. }
  3202. }
  3203. // If the next input code point is whitespace, consume it as well.
  3204. var code = getCharCode(source, offset);
  3205. if (isWhiteSpace$1(code)) {
  3206. offset += getNewlineLength(source, offset, code);
  3207. }
  3208. }
  3209. return offset;
  3210. }
  3211. // §4.3.11. Consume a name
  3212. // Note: This algorithm does not do the verification of the first few code points that are necessary
  3213. // to ensure the returned code points would constitute an <ident-token>. If that is the intended use,
  3214. // ensure that the stream starts with an identifier before calling this algorithm.
  3215. function consumeName(source, offset) {
  3216. // Let result initially be an empty string.
  3217. // Repeatedly consume the next input code point from the stream:
  3218. for (; offset < source.length; offset++) {
  3219. var code = source.charCodeAt(offset);
  3220. // name code point
  3221. if (isName$1(code)) {
  3222. // Append the code point to result.
  3223. continue;
  3224. }
  3225. // the stream starts with a valid escape
  3226. if (isValidEscape$1(code, getCharCode(source, offset + 1))) {
  3227. // Consume an escaped code point. Append the returned code point to result.
  3228. offset = consumeEscaped(source, offset) - 1;
  3229. continue;
  3230. }
  3231. // anything else
  3232. // Reconsume the current input code point. Return result.
  3233. break;
  3234. }
  3235. return offset;
  3236. }
  3237. // §4.3.12. Consume a number
  3238. function consumeNumber(source, offset) {
  3239. var code = source.charCodeAt(offset);
  3240. // 2. If the next input code point is U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-),
  3241. // consume it and append it to repr.
  3242. if (code === 0x002B || code === 0x002D) {
  3243. code = source.charCodeAt(offset += 1);
  3244. }
  3245. // 3. While the next input code point is a digit, consume it and append it to repr.
  3246. if (isDigit$1(code)) {
  3247. offset = findDecimalNumberEnd(source, offset + 1);
  3248. code = source.charCodeAt(offset);
  3249. }
  3250. // 4. If the next 2 input code points are U+002E FULL STOP (.) followed by a digit, then:
  3251. if (code === 0x002E && isDigit$1(source.charCodeAt(offset + 1))) {
  3252. // 4.1 Consume them.
  3253. // 4.2 Append them to repr.
  3254. code = source.charCodeAt(offset += 2);
  3255. // 4.3 Set type to "number".
  3256. // TODO
  3257. // 4.4 While the next input code point is a digit, consume it and append it to repr.
  3258. offset = findDecimalNumberEnd(source, offset);
  3259. }
  3260. // 5. If the next 2 or 3 input code points are U+0045 LATIN CAPITAL LETTER E (E)
  3261. // or U+0065 LATIN SMALL LETTER E (e), ... , followed by a digit, then:
  3262. if (cmpChar(source, offset, 101 /* e */)) {
  3263. var sign = 0;
  3264. code = source.charCodeAt(offset + 1);
  3265. // ... optionally followed by U+002D HYPHEN-MINUS (-) or U+002B PLUS SIGN (+) ...
  3266. if (code === 0x002D || code === 0x002B) {
  3267. sign = 1;
  3268. code = source.charCodeAt(offset + 2);
  3269. }
  3270. // ... followed by a digit
  3271. if (isDigit$1(code)) {
  3272. // 5.1 Consume them.
  3273. // 5.2 Append them to repr.
  3274. // 5.3 Set type to "number".
  3275. // TODO
  3276. // 5.4 While the next input code point is a digit, consume it and append it to repr.
  3277. offset = findDecimalNumberEnd(source, offset + 1 + sign + 1);
  3278. }
  3279. }
  3280. return offset;
  3281. }
  3282. // § 4.3.14. Consume the remnants of a bad url
  3283. // ... its sole use is to consume enough of the input stream to reach a recovery point
  3284. // where normal tokenizing can resume.
  3285. function consumeBadUrlRemnants(source, offset) {
  3286. // Repeatedly consume the next input code point from the stream:
  3287. for (; offset < source.length; offset++) {
  3288. var code = source.charCodeAt(offset);
  3289. // U+0029 RIGHT PARENTHESIS ())
  3290. // EOF
  3291. if (code === 0x0029) {
  3292. // Return.
  3293. offset++;
  3294. break;
  3295. }
  3296. if (isValidEscape$1(code, getCharCode(source, offset + 1))) {
  3297. // Consume an escaped code point.
  3298. // Note: This allows an escaped right parenthesis ("\)") to be encountered
  3299. // without ending the <bad-url-token>. This is otherwise identical to
  3300. // the "anything else" clause.
  3301. offset = consumeEscaped(source, offset);
  3302. }
  3303. }
  3304. return offset;
  3305. }
  3306. var utils = {
  3307. consumeEscaped: consumeEscaped,
  3308. consumeName: consumeName,
  3309. consumeNumber: consumeNumber,
  3310. consumeBadUrlRemnants: consumeBadUrlRemnants,
  3311. cmpChar: cmpChar,
  3312. cmpStr: cmpStr,
  3313. getNewlineLength: getNewlineLength,
  3314. findWhiteSpaceStart: findWhiteSpaceStart,
  3315. findWhiteSpaceEnd: findWhiteSpaceEnd
  3316. };
  3317. var TYPE$1 = _const.TYPE;
  3318. var NAME$1 = _const.NAME;
  3319. var cmpStr$1 = utils.cmpStr;
  3320. var EOF$1 = TYPE$1.EOF;
  3321. var WHITESPACE = TYPE$1.WhiteSpace;
  3322. var COMMENT = TYPE$1.Comment;
  3323. var OFFSET_MASK = 0x00FFFFFF;
  3324. var TYPE_SHIFT = 24;
  3325. var TokenStream = function() {
  3326. this.offsetAndType = null;
  3327. this.balance = null;
  3328. this.reset();
  3329. };
  3330. TokenStream.prototype = {
  3331. reset: function() {
  3332. this.eof = false;
  3333. this.tokenIndex = -1;
  3334. this.tokenType = 0;
  3335. this.tokenStart = this.firstCharOffset;
  3336. this.tokenEnd = this.firstCharOffset;
  3337. },
  3338. lookupType: function(offset) {
  3339. offset += this.tokenIndex;
  3340. if (offset < this.tokenCount) {
  3341. return this.offsetAndType[offset] >> TYPE_SHIFT;
  3342. }
  3343. return EOF$1;
  3344. },
  3345. lookupOffset: function(offset) {
  3346. offset += this.tokenIndex;
  3347. if (offset < this.tokenCount) {
  3348. return this.offsetAndType[offset - 1] & OFFSET_MASK;
  3349. }
  3350. return this.source.length;
  3351. },
  3352. lookupValue: function(offset, referenceStr) {
  3353. offset += this.tokenIndex;
  3354. if (offset < this.tokenCount) {
  3355. return cmpStr$1(
  3356. this.source,
  3357. this.offsetAndType[offset - 1] & OFFSET_MASK,
  3358. this.offsetAndType[offset] & OFFSET_MASK,
  3359. referenceStr
  3360. );
  3361. }
  3362. return false;
  3363. },
  3364. getTokenStart: function(tokenIndex) {
  3365. if (tokenIndex === this.tokenIndex) {
  3366. return this.tokenStart;
  3367. }
  3368. if (tokenIndex > 0) {
  3369. return tokenIndex < this.tokenCount
  3370. ? this.offsetAndType[tokenIndex - 1] & OFFSET_MASK
  3371. : this.offsetAndType[this.tokenCount] & OFFSET_MASK;
  3372. }
  3373. return this.firstCharOffset;
  3374. },
  3375. // TODO: -> skipUntilBalanced
  3376. getRawLength: function(startToken, mode) {
  3377. var cursor = startToken;
  3378. var balanceEnd;
  3379. var offset = this.offsetAndType[Math.max(cursor - 1, 0)] & OFFSET_MASK;
  3380. var type;
  3381. loop:
  3382. for (; cursor < this.tokenCount; cursor++) {
  3383. balanceEnd = this.balance[cursor];
  3384. // stop scanning on balance edge that points to offset before start token
  3385. if (balanceEnd < startToken) {
  3386. break loop;
  3387. }
  3388. type = this.offsetAndType[cursor] >> TYPE_SHIFT;
  3389. // check token is stop type
  3390. switch (mode(type, this.source, offset)) {
  3391. case 1:
  3392. break loop;
  3393. case 2:
  3394. cursor++;
  3395. break loop;
  3396. default:
  3397. offset = this.offsetAndType[cursor] & OFFSET_MASK;
  3398. // fast forward to the end of balanced block
  3399. if (this.balance[balanceEnd] === cursor) {
  3400. cursor = balanceEnd;
  3401. }
  3402. }
  3403. }
  3404. return cursor - this.tokenIndex;
  3405. },
  3406. isBalanceEdge: function(pos) {
  3407. return this.balance[this.tokenIndex] < pos;
  3408. },
  3409. isDelim: function(code, offset) {
  3410. if (offset) {
  3411. return (
  3412. this.lookupType(offset) === TYPE$1.Delim &&
  3413. this.source.charCodeAt(this.lookupOffset(offset)) === code
  3414. );
  3415. }
  3416. return (
  3417. this.tokenType === TYPE$1.Delim &&
  3418. this.source.charCodeAt(this.tokenStart) === code
  3419. );
  3420. },
  3421. getTokenValue: function() {
  3422. return this.source.substring(this.tokenStart, this.tokenEnd);
  3423. },
  3424. getTokenLength: function() {
  3425. return this.tokenEnd - this.tokenStart;
  3426. },
  3427. substrToCursor: function(start) {
  3428. return this.source.substring(start, this.tokenStart);
  3429. },
  3430. skipWS: function() {
  3431. for (var i = this.tokenIndex, skipTokenCount = 0; i < this.tokenCount; i++, skipTokenCount++) {
  3432. if ((this.offsetAndType[i] >> TYPE_SHIFT) !== WHITESPACE) {
  3433. break;
  3434. }
  3435. }
  3436. if (skipTokenCount > 0) {
  3437. this.skip(skipTokenCount);
  3438. }
  3439. },
  3440. skipSC: function() {
  3441. while (this.tokenType === WHITESPACE || this.tokenType === COMMENT) {
  3442. this.next();
  3443. }
  3444. },
  3445. skip: function(tokenCount) {
  3446. var next = this.tokenIndex + tokenCount;
  3447. if (next < this.tokenCount) {
  3448. this.tokenIndex = next;
  3449. this.tokenStart = this.offsetAndType[next - 1] & OFFSET_MASK;
  3450. next = this.offsetAndType[next];
  3451. this.tokenType = next >> TYPE_SHIFT;
  3452. this.tokenEnd = next & OFFSET_MASK;
  3453. } else {
  3454. this.tokenIndex = this.tokenCount;
  3455. this.next();
  3456. }
  3457. },
  3458. next: function() {
  3459. var next = this.tokenIndex + 1;
  3460. if (next < this.tokenCount) {
  3461. this.tokenIndex = next;
  3462. this.tokenStart = this.tokenEnd;
  3463. next = this.offsetAndType[next];
  3464. this.tokenType = next >> TYPE_SHIFT;
  3465. this.tokenEnd = next & OFFSET_MASK;
  3466. } else {
  3467. this.tokenIndex = this.tokenCount;
  3468. this.eof = true;
  3469. this.tokenType = EOF$1;
  3470. this.tokenStart = this.tokenEnd = this.source.length;
  3471. }
  3472. },
  3473. dump: function() {
  3474. var offset = this.firstCharOffset;
  3475. return Array.prototype.slice.call(this.offsetAndType, 0, this.tokenCount).map(function(item, idx) {
  3476. var start = offset;
  3477. var end = item & OFFSET_MASK;
  3478. offset = end;
  3479. return {
  3480. idx: idx,
  3481. type: NAME$1[item >> TYPE_SHIFT],
  3482. chunk: this.source.substring(start, end),
  3483. balance: this.balance[idx]
  3484. };
  3485. }, this);
  3486. }
  3487. };
  3488. var TokenStream_1 = TokenStream;
  3489. function noop$1(value) {
  3490. return value;
  3491. }
  3492. function generateMultiplier(multiplier) {
  3493. if (multiplier.min === 0 && multiplier.max === 0) {
  3494. return '*';
  3495. }
  3496. if (multiplier.min === 0 && multiplier.max === 1) {
  3497. return '?';
  3498. }
  3499. if (multiplier.min === 1 && multiplier.max === 0) {
  3500. return multiplier.comma ? '#' : '+';
  3501. }
  3502. if (multiplier.min === 1 && multiplier.max === 1) {
  3503. return '';
  3504. }
  3505. return (
  3506. (multiplier.comma ? '#' : '') +
  3507. (multiplier.min === multiplier.max
  3508. ? '{' + multiplier.min + '}'
  3509. : '{' + multiplier.min + ',' + (multiplier.max !== 0 ? multiplier.max : '') + '}'
  3510. )
  3511. );
  3512. }
  3513. function generateTypeOpts(node) {
  3514. switch (node.type) {
  3515. case 'Range':
  3516. return (
  3517. ' [' +
  3518. (node.min === null ? '-∞' : node.min) +
  3519. ',' +
  3520. (node.max === null ? '∞' : node.max) +
  3521. ']'
  3522. );
  3523. default:
  3524. throw new Error('Unknown node type `' + node.type + '`');
  3525. }
  3526. }
  3527. function generateSequence(node, decorate, forceBraces, compact) {
  3528. var combinator = node.combinator === ' ' || compact ? node.combinator : ' ' + node.combinator + ' ';
  3529. var result = node.terms.map(function(term) {
  3530. return generate(term, decorate, forceBraces, compact);
  3531. }).join(combinator);
  3532. if (node.explicit || forceBraces) {
  3533. result = (compact || result[0] === ',' ? '[' : '[ ') + result + (compact ? ']' : ' ]');
  3534. }
  3535. return result;
  3536. }
  3537. function generate(node, decorate, forceBraces, compact) {
  3538. var result;
  3539. switch (node.type) {
  3540. case 'Group':
  3541. result =
  3542. generateSequence(node, decorate, forceBraces, compact) +
  3543. (node.disallowEmpty ? '!' : '');
  3544. break;
  3545. case 'Multiplier':
  3546. // return since node is a composition
  3547. return (
  3548. generate(node.term, decorate, forceBraces, compact) +
  3549. decorate(generateMultiplier(node), node)
  3550. );
  3551. case 'Type':
  3552. result = '<' + node.name + (node.opts ? decorate(generateTypeOpts(node.opts), node.opts) : '') + '>';
  3553. break;
  3554. case 'Property':
  3555. result = '<\'' + node.name + '\'>';
  3556. break;
  3557. case 'Keyword':
  3558. result = node.name;
  3559. break;
  3560. case 'AtKeyword':
  3561. result = '@' + node.name;
  3562. break;
  3563. case 'Function':
  3564. result = node.name + '(';
  3565. break;
  3566. case 'String':
  3567. case 'Token':
  3568. result = node.value;
  3569. break;
  3570. case 'Comma':
  3571. result = ',';
  3572. break;
  3573. default:
  3574. throw new Error('Unknown node type `' + node.type + '`');
  3575. }
  3576. return decorate(result, node);
  3577. }
  3578. var generate_1 = function(node, options) {
  3579. var decorate = noop$1;
  3580. var forceBraces = false;
  3581. var compact = false;
  3582. if (typeof options === 'function') {
  3583. decorate = options;
  3584. } else if (options) {
  3585. forceBraces = Boolean(options.forceBraces);
  3586. compact = Boolean(options.compact);
  3587. if (typeof options.decorate === 'function') {
  3588. decorate = options.decorate;
  3589. }
  3590. }
  3591. return generate(node, decorate, forceBraces, compact);
  3592. };
  3593. function fromMatchResult(matchResult) {
  3594. var tokens = matchResult.tokens;
  3595. var longestMatch = matchResult.longestMatch;
  3596. var node = longestMatch < tokens.length ? tokens[longestMatch].node : null;
  3597. var mismatchOffset = -1;
  3598. var entries = 0;
  3599. var css = '';
  3600. for (var i = 0; i < tokens.length; i++) {
  3601. if (i === longestMatch) {
  3602. mismatchOffset = css.length;
  3603. }
  3604. if (node !== null && tokens[i].node === node) {
  3605. if (i <= longestMatch) {
  3606. entries++;
  3607. } else {
  3608. entries = 0;
  3609. }
  3610. }
  3611. css += tokens[i].value;
  3612. }
  3613. return {
  3614. node: node,
  3615. css: css,
  3616. mismatchOffset: mismatchOffset === -1 ? css.length : mismatchOffset,
  3617. last: node === null || entries > 1
  3618. };
  3619. }
  3620. function getLocation(node, point) {
  3621. var loc = node && node.loc && node.loc[point];
  3622. if (loc) {
  3623. return {
  3624. offset: loc.offset,
  3625. line: loc.line,
  3626. column: loc.column
  3627. };
  3628. }
  3629. return null;
  3630. }
  3631. var SyntaxReferenceError = function(type, referenceName) {
  3632. var error = createCustomError(
  3633. 'SyntaxReferenceError',
  3634. type + (referenceName ? ' `' + referenceName + '`' : '')
  3635. );
  3636. error.reference = referenceName;
  3637. return error;
  3638. };
  3639. var MatchError = function(message, syntax, node, matchResult) {
  3640. var error = createCustomError('SyntaxMatchError', message);
  3641. var details = fromMatchResult(matchResult);
  3642. var mismatchOffset = details.mismatchOffset || 0;
  3643. var badNode = details.node || node;
  3644. var end = getLocation(badNode, 'end');
  3645. var start = details.last ? end : getLocation(badNode, 'start');
  3646. var css = details.css;
  3647. error.rawMessage = message;
  3648. error.syntax = syntax ? generate_1(syntax) : '<generic>';
  3649. error.css = css;
  3650. error.mismatchOffset = mismatchOffset;
  3651. error.loc = {
  3652. source: (badNode && badNode.loc && badNode.loc.source) || '<unknown>',
  3653. start: start,
  3654. end: end
  3655. };
  3656. error.line = start ? start.line : undefined;
  3657. error.column = start ? start.column : undefined;
  3658. error.offset = start ? start.offset : undefined;
  3659. error.message = message + '\n' +
  3660. ' syntax: ' + error.syntax + '\n' +
  3661. ' value: ' + (error.css || '<empty string>') + '\n' +
  3662. ' --------' + new Array(error.mismatchOffset + 1).join('-') + '^';
  3663. return error;
  3664. };
  3665. var error = {
  3666. SyntaxReferenceError: SyntaxReferenceError,
  3667. MatchError: MatchError
  3668. };
  3669. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3670. var keywords = Object.create(null);
  3671. var properties = Object.create(null);
  3672. var HYPHENMINUS = 45; // '-'.charCodeAt()
  3673. function isCustomProperty(str, offset) {
  3674. offset = offset || 0;
  3675. return str.length - offset >= 2 &&
  3676. str.charCodeAt(offset) === HYPHENMINUS &&
  3677. str.charCodeAt(offset + 1) === HYPHENMINUS;
  3678. }
  3679. function getVendorPrefix(str, offset) {
  3680. offset = offset || 0;
  3681. // verdor prefix should be at least 3 chars length
  3682. if (str.length - offset >= 3) {
  3683. // vendor prefix starts with hyper minus following non-hyper minus
  3684. if (str.charCodeAt(offset) === HYPHENMINUS &&
  3685. str.charCodeAt(offset + 1) !== HYPHENMINUS) {
  3686. // vendor prefix should contain a hyper minus at the ending
  3687. var secondDashIndex = str.indexOf('-', offset + 2);
  3688. if (secondDashIndex !== -1) {
  3689. return str.substring(offset, secondDashIndex + 1);
  3690. }
  3691. }
  3692. }
  3693. return '';
  3694. }
  3695. function getKeywordDescriptor(keyword) {
  3696. if (hasOwnProperty.call(keywords, keyword)) {
  3697. return keywords[keyword];
  3698. }
  3699. var name = keyword.toLowerCase();
  3700. if (hasOwnProperty.call(keywords, name)) {
  3701. return keywords[keyword] = keywords[name];
  3702. }
  3703. var custom = isCustomProperty(name, 0);
  3704. var vendor = !custom ? getVendorPrefix(name, 0) : '';
  3705. return keywords[keyword] = Object.freeze({
  3706. basename: name.substr(vendor.length),
  3707. name: name,
  3708. vendor: vendor,
  3709. prefix: vendor,
  3710. custom: custom
  3711. });
  3712. }
  3713. function getPropertyDescriptor(property) {
  3714. if (hasOwnProperty.call(properties, property)) {
  3715. return properties[property];
  3716. }
  3717. var name = property;
  3718. var hack = property[0];
  3719. if (hack === '/') {
  3720. hack = property[1] === '/' ? '//' : '/';
  3721. } else if (hack !== '_' &&
  3722. hack !== '*' &&
  3723. hack !== '$' &&
  3724. hack !== '#' &&
  3725. hack !== '+' &&
  3726. hack !== '&') {
  3727. hack = '';
  3728. }
  3729. var custom = isCustomProperty(name, hack.length);
  3730. // re-use result when possible (the same as for lower case)
  3731. if (!custom) {
  3732. name = name.toLowerCase();
  3733. if (hasOwnProperty.call(properties, name)) {
  3734. return properties[property] = properties[name];
  3735. }
  3736. }
  3737. var vendor = !custom ? getVendorPrefix(name, hack.length) : '';
  3738. var prefix = name.substr(0, hack.length + vendor.length);
  3739. return properties[property] = Object.freeze({
  3740. basename: name.substr(prefix.length),
  3741. name: name.substr(hack.length),
  3742. hack: hack,
  3743. vendor: vendor,
  3744. prefix: prefix,
  3745. custom: custom
  3746. });
  3747. }
  3748. var names = {
  3749. keyword: getKeywordDescriptor,
  3750. property: getPropertyDescriptor,
  3751. isCustomProperty: isCustomProperty,
  3752. vendorPrefix: getVendorPrefix
  3753. };
  3754. var MIN_SIZE = 16 * 1024;
  3755. var SafeUint32Array = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; // fallback on Array when TypedArray is not supported
  3756. var adoptBuffer = function adoptBuffer(buffer, size) {
  3757. if (buffer === null || buffer.length < size) {
  3758. return new SafeUint32Array(Math.max(size + 1024, MIN_SIZE));
  3759. }
  3760. return buffer;
  3761. };
  3762. var TYPE$2 = _const.TYPE;
  3763. var isNewline$1 = charCodeDefinitions.isNewline;
  3764. var isName$2 = charCodeDefinitions.isName;
  3765. var isValidEscape$2 = charCodeDefinitions.isValidEscape;
  3766. var isNumberStart$1 = charCodeDefinitions.isNumberStart;
  3767. var isIdentifierStart$1 = charCodeDefinitions.isIdentifierStart;
  3768. var charCodeCategory$1 = charCodeDefinitions.charCodeCategory;
  3769. var isBOM$1 = charCodeDefinitions.isBOM;
  3770. var cmpStr$2 = utils.cmpStr;
  3771. var getNewlineLength$1 = utils.getNewlineLength;
  3772. var findWhiteSpaceEnd$1 = utils.findWhiteSpaceEnd;
  3773. var consumeEscaped$1 = utils.consumeEscaped;
  3774. var consumeName$1 = utils.consumeName;
  3775. var consumeNumber$1 = utils.consumeNumber;
  3776. var consumeBadUrlRemnants$1 = utils.consumeBadUrlRemnants;
  3777. var OFFSET_MASK$1 = 0x00FFFFFF;
  3778. var TYPE_SHIFT$1 = 24;
  3779. function tokenize(source, stream) {
  3780. function getCharCode(offset) {
  3781. return offset < sourceLength ? source.charCodeAt(offset) : 0;
  3782. }
  3783. // § 4.3.3. Consume a numeric token
  3784. function consumeNumericToken() {
  3785. // Consume a number and let number be the result.
  3786. offset = consumeNumber$1(source, offset);
  3787. // If the next 3 input code points would start an identifier, then:
  3788. if (isIdentifierStart$1(getCharCode(offset), getCharCode(offset + 1), getCharCode(offset + 2))) {
  3789. // Create a <dimension-token> with the same value and type flag as number, and a unit set initially to the empty string.
  3790. // Consume a name. Set the <dimension-token>’s unit to the returned value.
  3791. // Return the <dimension-token>.
  3792. type = TYPE$2.Dimension;
  3793. offset = consumeName$1(source, offset);
  3794. return;
  3795. }
  3796. // Otherwise, if the next input code point is U+0025 PERCENTAGE SIGN (%), consume it.
  3797. if (getCharCode(offset) === 0x0025) {
  3798. // Create a <percentage-token> with the same value as number, and return it.
  3799. type = TYPE$2.Percentage;
  3800. offset++;
  3801. return;
  3802. }
  3803. // Otherwise, create a <number-token> with the same value and type flag as number, and return it.
  3804. type = TYPE$2.Number;
  3805. }
  3806. // § 4.3.4. Consume an ident-like token
  3807. function consumeIdentLikeToken() {
  3808. const nameStartOffset = offset;
  3809. // Consume a name, and let string be the result.
  3810. offset = consumeName$1(source, offset);
  3811. // If string’s value is an ASCII case-insensitive match for "url",
  3812. // and the next input code point is U+0028 LEFT PARENTHESIS ((), consume it.
  3813. if (cmpStr$2(source, nameStartOffset, offset, 'url') && getCharCode(offset) === 0x0028) {
  3814. // While the next two input code points are whitespace, consume the next input code point.
  3815. offset = findWhiteSpaceEnd$1(source, offset + 1);
  3816. // If the next one or two input code points are U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('),
  3817. // or whitespace followed by U+0022 QUOTATION MARK (") or U+0027 APOSTROPHE ('),
  3818. // then create a <function-token> with its value set to string and return it.
  3819. if (getCharCode(offset) === 0x0022 ||
  3820. getCharCode(offset) === 0x0027) {
  3821. type = TYPE$2.Function;
  3822. offset = nameStartOffset + 4;
  3823. return;
  3824. }
  3825. // Otherwise, consume a url token, and return it.
  3826. consumeUrlToken();
  3827. return;
  3828. }
  3829. // Otherwise, if the next input code point is U+0028 LEFT PARENTHESIS ((), consume it.
  3830. // Create a <function-token> with its value set to string and return it.
  3831. if (getCharCode(offset) === 0x0028) {
  3832. type = TYPE$2.Function;
  3833. offset++;
  3834. return;
  3835. }
  3836. // Otherwise, create an <ident-token> with its value set to string and return it.
  3837. type = TYPE$2.Ident;
  3838. }
  3839. // § 4.3.5. Consume a string token
  3840. function consumeStringToken(endingCodePoint) {
  3841. // This algorithm may be called with an ending code point, which denotes the code point
  3842. // that ends the string. If an ending code point is not specified,
  3843. // the current input code point is used.
  3844. if (!endingCodePoint) {
  3845. endingCodePoint = getCharCode(offset++);
  3846. }
  3847. // Initially create a <string-token> with its value set to the empty string.
  3848. type = TYPE$2.String;
  3849. // Repeatedly consume the next input code point from the stream:
  3850. for (; offset < source.length; offset++) {
  3851. var code = source.charCodeAt(offset);
  3852. switch (charCodeCategory$1(code)) {
  3853. // ending code point
  3854. case endingCodePoint:
  3855. // Return the <string-token>.
  3856. offset++;
  3857. return;
  3858. // EOF
  3859. case charCodeCategory$1.Eof:
  3860. // This is a parse error. Return the <string-token>.
  3861. return;
  3862. // newline
  3863. case charCodeCategory$1.WhiteSpace:
  3864. if (isNewline$1(code)) {
  3865. // This is a parse error. Reconsume the current input code point,
  3866. // create a <bad-string-token>, and return it.
  3867. offset += getNewlineLength$1(source, offset, code);
  3868. type = TYPE$2.BadString;
  3869. return;
  3870. }
  3871. break;
  3872. // U+005C REVERSE SOLIDUS (\)
  3873. case 0x005C:
  3874. // If the next input code point is EOF, do nothing.
  3875. if (offset === source.length - 1) {
  3876. break;
  3877. }
  3878. var nextCode = getCharCode(offset + 1);
  3879. // Otherwise, if the next input code point is a newline, consume it.
  3880. if (isNewline$1(nextCode)) {
  3881. offset += getNewlineLength$1(source, offset + 1, nextCode);
  3882. } else if (isValidEscape$2(code, nextCode)) {
  3883. // Otherwise, (the stream starts with a valid escape) consume
  3884. // an escaped code point and append the returned code point to
  3885. // the <string-token>’s value.
  3886. offset = consumeEscaped$1(source, offset) - 1;
  3887. }
  3888. break;
  3889. // anything else
  3890. // Append the current input code point to the <string-token>’s value.
  3891. }
  3892. }
  3893. }
  3894. // § 4.3.6. Consume a url token
  3895. // Note: This algorithm assumes that the initial "url(" has already been consumed.
  3896. // This algorithm also assumes that it’s being called to consume an "unquoted" value, like url(foo).
  3897. // A quoted value, like url("foo"), is parsed as a <function-token>. Consume an ident-like token
  3898. // automatically handles this distinction; this algorithm shouldn’t be called directly otherwise.
  3899. function consumeUrlToken() {
  3900. // Initially create a <url-token> with its value set to the empty string.
  3901. type = TYPE$2.Url;
  3902. // Consume as much whitespace as possible.
  3903. offset = findWhiteSpaceEnd$1(source, offset);
  3904. // Repeatedly consume the next input code point from the stream:
  3905. for (; offset < source.length; offset++) {
  3906. var code = source.charCodeAt(offset);
  3907. switch (charCodeCategory$1(code)) {
  3908. // U+0029 RIGHT PARENTHESIS ())
  3909. case 0x0029:
  3910. // Return the <url-token>.
  3911. offset++;
  3912. return;
  3913. // EOF
  3914. case charCodeCategory$1.Eof:
  3915. // This is a parse error. Return the <url-token>.
  3916. return;
  3917. // whitespace
  3918. case charCodeCategory$1.WhiteSpace:
  3919. // Consume as much whitespace as possible.
  3920. offset = findWhiteSpaceEnd$1(source, offset);
  3921. // If the next input code point is U+0029 RIGHT PARENTHESIS ()) or EOF,
  3922. // consume it and return the <url-token>
  3923. // (if EOF was encountered, this is a parse error);
  3924. if (getCharCode(offset) === 0x0029 || offset >= source.length) {
  3925. if (offset < source.length) {
  3926. offset++;
  3927. }
  3928. return;
  3929. }
  3930. // otherwise, consume the remnants of a bad url, create a <bad-url-token>,
  3931. // and return it.
  3932. offset = consumeBadUrlRemnants$1(source, offset);
  3933. type = TYPE$2.BadUrl;
  3934. return;
  3935. // U+0022 QUOTATION MARK (")
  3936. // U+0027 APOSTROPHE (')
  3937. // U+0028 LEFT PARENTHESIS (()
  3938. // non-printable code point
  3939. case 0x0022:
  3940. case 0x0027:
  3941. case 0x0028:
  3942. case charCodeCategory$1.NonPrintable:
  3943. // This is a parse error. Consume the remnants of a bad url,
  3944. // create a <bad-url-token>, and return it.
  3945. offset = consumeBadUrlRemnants$1(source, offset);
  3946. type = TYPE$2.BadUrl;
  3947. return;
  3948. // U+005C REVERSE SOLIDUS (\)
  3949. case 0x005C:
  3950. // If the stream starts with a valid escape, consume an escaped code point and
  3951. // append the returned code point to the <url-token>’s value.
  3952. if (isValidEscape$2(code, getCharCode(offset + 1))) {
  3953. offset = consumeEscaped$1(source, offset) - 1;
  3954. break;
  3955. }
  3956. // Otherwise, this is a parse error. Consume the remnants of a bad url,
  3957. // create a <bad-url-token>, and return it.
  3958. offset = consumeBadUrlRemnants$1(source, offset);
  3959. type = TYPE$2.BadUrl;
  3960. return;
  3961. // anything else
  3962. // Append the current input code point to the <url-token>’s value.
  3963. }
  3964. }
  3965. }
  3966. if (!stream) {
  3967. stream = new TokenStream_1();
  3968. }
  3969. // ensure source is a string
  3970. source = String(source || '');
  3971. var sourceLength = source.length;
  3972. var offsetAndType = adoptBuffer(stream.offsetAndType, sourceLength + 1); // +1 because of eof-token
  3973. var balance = adoptBuffer(stream.balance, sourceLength + 1);
  3974. var tokenCount = 0;
  3975. var start = isBOM$1(getCharCode(0));
  3976. var offset = start;
  3977. var balanceCloseType = 0;
  3978. var balanceStart = 0;
  3979. var balancePrev = 0;
  3980. // https://drafts.csswg.org/css-syntax-3/#consume-token
  3981. // § 4.3.1. Consume a token
  3982. while (offset < sourceLength) {
  3983. var code = source.charCodeAt(offset);
  3984. var type = 0;
  3985. balance[tokenCount] = sourceLength;
  3986. switch (charCodeCategory$1(code)) {
  3987. // whitespace
  3988. case charCodeCategory$1.WhiteSpace:
  3989. // Consume as much whitespace as possible. Return a <whitespace-token>.
  3990. type = TYPE$2.WhiteSpace;
  3991. offset = findWhiteSpaceEnd$1(source, offset + 1);
  3992. break;
  3993. // U+0022 QUOTATION MARK (")
  3994. case 0x0022:
  3995. // Consume a string token and return it.
  3996. consumeStringToken();
  3997. break;
  3998. // U+0023 NUMBER SIGN (#)
  3999. case 0x0023:
  4000. // If the next input code point is a name code point or the next two input code points are a valid escape, then:
  4001. if (isName$2(getCharCode(offset + 1)) || isValidEscape$2(getCharCode(offset + 1), getCharCode(offset + 2))) {
  4002. // Create a <hash-token>.
  4003. type = TYPE$2.Hash;
  4004. // If the next 3 input code points would start an identifier, set the <hash-token>’s type flag to "id".
  4005. // if (isIdentifierStart(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) {
  4006. // // TODO: set id flag
  4007. // }
  4008. // Consume a name, and set the <hash-token>’s value to the returned string.
  4009. offset = consumeName$1(source, offset + 1);
  4010. // Return the <hash-token>.
  4011. } else {
  4012. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4013. type = TYPE$2.Delim;
  4014. offset++;
  4015. }
  4016. break;
  4017. // U+0027 APOSTROPHE (')
  4018. case 0x0027:
  4019. // Consume a string token and return it.
  4020. consumeStringToken();
  4021. break;
  4022. // U+0028 LEFT PARENTHESIS (()
  4023. case 0x0028:
  4024. // Return a <(-token>.
  4025. type = TYPE$2.LeftParenthesis;
  4026. offset++;
  4027. break;
  4028. // U+0029 RIGHT PARENTHESIS ())
  4029. case 0x0029:
  4030. // Return a <)-token>.
  4031. type = TYPE$2.RightParenthesis;
  4032. offset++;
  4033. break;
  4034. // U+002B PLUS SIGN (+)
  4035. case 0x002B:
  4036. // If the input stream starts with a number, ...
  4037. if (isNumberStart$1(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  4038. // ... reconsume the current input code point, consume a numeric token, and return it.
  4039. consumeNumericToken();
  4040. } else {
  4041. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4042. type = TYPE$2.Delim;
  4043. offset++;
  4044. }
  4045. break;
  4046. // U+002C COMMA (,)
  4047. case 0x002C:
  4048. // Return a <comma-token>.
  4049. type = TYPE$2.Comma;
  4050. offset++;
  4051. break;
  4052. // U+002D HYPHEN-MINUS (-)
  4053. case 0x002D:
  4054. // If the input stream starts with a number, reconsume the current input code point, consume a numeric token, and return it.
  4055. if (isNumberStart$1(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  4056. consumeNumericToken();
  4057. } else {
  4058. // Otherwise, if the next 2 input code points are U+002D HYPHEN-MINUS U+003E GREATER-THAN SIGN (->), consume them and return a <CDC-token>.
  4059. if (getCharCode(offset + 1) === 0x002D &&
  4060. getCharCode(offset + 2) === 0x003E) {
  4061. type = TYPE$2.CDC;
  4062. offset = offset + 3;
  4063. } else {
  4064. // Otherwise, if the input stream starts with an identifier, ...
  4065. if (isIdentifierStart$1(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  4066. // ... reconsume the current input code point, consume an ident-like token, and return it.
  4067. consumeIdentLikeToken();
  4068. } else {
  4069. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4070. type = TYPE$2.Delim;
  4071. offset++;
  4072. }
  4073. }
  4074. }
  4075. break;
  4076. // U+002E FULL STOP (.)
  4077. case 0x002E:
  4078. // If the input stream starts with a number, ...
  4079. if (isNumberStart$1(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  4080. // ... reconsume the current input code point, consume a numeric token, and return it.
  4081. consumeNumericToken();
  4082. } else {
  4083. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4084. type = TYPE$2.Delim;
  4085. offset++;
  4086. }
  4087. break;
  4088. // U+002F SOLIDUS (/)
  4089. case 0x002F:
  4090. // If the next two input code point are U+002F SOLIDUS (/) followed by a U+002A ASTERISK (*),
  4091. if (getCharCode(offset + 1) === 0x002A) {
  4092. // ... consume them and all following code points up to and including the first U+002A ASTERISK (*)
  4093. // followed by a U+002F SOLIDUS (/), or up to an EOF code point.
  4094. type = TYPE$2.Comment;
  4095. offset = source.indexOf('*/', offset + 2) + 2;
  4096. if (offset === 1) {
  4097. offset = source.length;
  4098. }
  4099. } else {
  4100. type = TYPE$2.Delim;
  4101. offset++;
  4102. }
  4103. break;
  4104. // U+003A COLON (:)
  4105. case 0x003A:
  4106. // Return a <colon-token>.
  4107. type = TYPE$2.Colon;
  4108. offset++;
  4109. break;
  4110. // U+003B SEMICOLON (;)
  4111. case 0x003B:
  4112. // Return a <semicolon-token>.
  4113. type = TYPE$2.Semicolon;
  4114. offset++;
  4115. break;
  4116. // U+003C LESS-THAN SIGN (<)
  4117. case 0x003C:
  4118. // If the next 3 input code points are U+0021 EXCLAMATION MARK U+002D HYPHEN-MINUS U+002D HYPHEN-MINUS (!--), ...
  4119. if (getCharCode(offset + 1) === 0x0021 &&
  4120. getCharCode(offset + 2) === 0x002D &&
  4121. getCharCode(offset + 3) === 0x002D) {
  4122. // ... consume them and return a <CDO-token>.
  4123. type = TYPE$2.CDO;
  4124. offset = offset + 4;
  4125. } else {
  4126. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4127. type = TYPE$2.Delim;
  4128. offset++;
  4129. }
  4130. break;
  4131. // U+0040 COMMERCIAL AT (@)
  4132. case 0x0040:
  4133. // If the next 3 input code points would start an identifier, ...
  4134. if (isIdentifierStart$1(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) {
  4135. // ... consume a name, create an <at-keyword-token> with its value set to the returned value, and return it.
  4136. type = TYPE$2.AtKeyword;
  4137. offset = consumeName$1(source, offset + 1);
  4138. } else {
  4139. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4140. type = TYPE$2.Delim;
  4141. offset++;
  4142. }
  4143. break;
  4144. // U+005B LEFT SQUARE BRACKET ([)
  4145. case 0x005B:
  4146. // Return a <[-token>.
  4147. type = TYPE$2.LeftSquareBracket;
  4148. offset++;
  4149. break;
  4150. // U+005C REVERSE SOLIDUS (\)
  4151. case 0x005C:
  4152. // If the input stream starts with a valid escape, ...
  4153. if (isValidEscape$2(code, getCharCode(offset + 1))) {
  4154. // ... reconsume the current input code point, consume an ident-like token, and return it.
  4155. consumeIdentLikeToken();
  4156. } else {
  4157. // Otherwise, this is a parse error. Return a <delim-token> with its value set to the current input code point.
  4158. type = TYPE$2.Delim;
  4159. offset++;
  4160. }
  4161. break;
  4162. // U+005D RIGHT SQUARE BRACKET (])
  4163. case 0x005D:
  4164. // Return a <]-token>.
  4165. type = TYPE$2.RightSquareBracket;
  4166. offset++;
  4167. break;
  4168. // U+007B LEFT CURLY BRACKET ({)
  4169. case 0x007B:
  4170. // Return a <{-token>.
  4171. type = TYPE$2.LeftCurlyBracket;
  4172. offset++;
  4173. break;
  4174. // U+007D RIGHT CURLY BRACKET (})
  4175. case 0x007D:
  4176. // Return a <}-token>.
  4177. type = TYPE$2.RightCurlyBracket;
  4178. offset++;
  4179. break;
  4180. // digit
  4181. case charCodeCategory$1.Digit:
  4182. // Reconsume the current input code point, consume a numeric token, and return it.
  4183. consumeNumericToken();
  4184. break;
  4185. // name-start code point
  4186. case charCodeCategory$1.NameStart:
  4187. // Reconsume the current input code point, consume an ident-like token, and return it.
  4188. consumeIdentLikeToken();
  4189. break;
  4190. // EOF
  4191. case charCodeCategory$1.Eof:
  4192. // Return an <EOF-token>.
  4193. break;
  4194. // anything else
  4195. default:
  4196. // Return a <delim-token> with its value set to the current input code point.
  4197. type = TYPE$2.Delim;
  4198. offset++;
  4199. }
  4200. switch (type) {
  4201. case balanceCloseType:
  4202. balancePrev = balanceStart & OFFSET_MASK$1;
  4203. balanceStart = balance[balancePrev];
  4204. balanceCloseType = balanceStart >> TYPE_SHIFT$1;
  4205. balance[tokenCount] = balancePrev;
  4206. balance[balancePrev++] = tokenCount;
  4207. for (; balancePrev < tokenCount; balancePrev++) {
  4208. if (balance[balancePrev] === sourceLength) {
  4209. balance[balancePrev] = tokenCount;
  4210. }
  4211. }
  4212. break;
  4213. case TYPE$2.LeftParenthesis:
  4214. case TYPE$2.Function:
  4215. balance[tokenCount] = balanceStart;
  4216. balanceCloseType = TYPE$2.RightParenthesis;
  4217. balanceStart = (balanceCloseType << TYPE_SHIFT$1) | tokenCount;
  4218. break;
  4219. case TYPE$2.LeftSquareBracket:
  4220. balance[tokenCount] = balanceStart;
  4221. balanceCloseType = TYPE$2.RightSquareBracket;
  4222. balanceStart = (balanceCloseType << TYPE_SHIFT$1) | tokenCount;
  4223. break;
  4224. case TYPE$2.LeftCurlyBracket:
  4225. balance[tokenCount] = balanceStart;
  4226. balanceCloseType = TYPE$2.RightCurlyBracket;
  4227. balanceStart = (balanceCloseType << TYPE_SHIFT$1) | tokenCount;
  4228. break;
  4229. }
  4230. offsetAndType[tokenCount++] = (type << TYPE_SHIFT$1) | offset;
  4231. }
  4232. // finalize buffers
  4233. offsetAndType[tokenCount] = (TYPE$2.EOF << TYPE_SHIFT$1) | offset; // <EOF-token>
  4234. balance[tokenCount] = sourceLength;
  4235. balance[sourceLength] = sourceLength; // prevents false positive balance match with any token
  4236. while (balanceStart !== 0) {
  4237. balancePrev = balanceStart & OFFSET_MASK$1;
  4238. balanceStart = balance[balancePrev];
  4239. balance[balancePrev] = sourceLength;
  4240. }
  4241. // update stream
  4242. stream.source = source;
  4243. stream.firstCharOffset = start;
  4244. stream.offsetAndType = offsetAndType;
  4245. stream.tokenCount = tokenCount;
  4246. stream.balance = balance;
  4247. stream.reset();
  4248. stream.next();
  4249. return stream;
  4250. }
  4251. // extend tokenizer with constants
  4252. Object.keys(_const).forEach(function(key) {
  4253. tokenize[key] = _const[key];
  4254. });
  4255. // extend tokenizer with static methods from utils
  4256. Object.keys(charCodeDefinitions).forEach(function(key) {
  4257. tokenize[key] = charCodeDefinitions[key];
  4258. });
  4259. Object.keys(utils).forEach(function(key) {
  4260. tokenize[key] = utils[key];
  4261. });
  4262. var tokenizer = tokenize;
  4263. var isDigit$2 = tokenizer.isDigit;
  4264. var cmpChar$1 = tokenizer.cmpChar;
  4265. var TYPE$3 = tokenizer.TYPE;
  4266. var DELIM = TYPE$3.Delim;
  4267. var WHITESPACE$1 = TYPE$3.WhiteSpace;
  4268. var COMMENT$1 = TYPE$3.Comment;
  4269. var IDENT = TYPE$3.Ident;
  4270. var NUMBER = TYPE$3.Number;
  4271. var DIMENSION = TYPE$3.Dimension;
  4272. var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
  4273. var HYPHENMINUS$1 = 0x002D; // U+002D HYPHEN-MINUS (-)
  4274. var N = 0x006E; // U+006E LATIN SMALL LETTER N (n)
  4275. var DISALLOW_SIGN = true;
  4276. var ALLOW_SIGN = false;
  4277. function isDelim(token, code) {
  4278. return token !== null && token.type === DELIM && token.value.charCodeAt(0) === code;
  4279. }
  4280. function skipSC(token, offset, getNextToken) {
  4281. while (token !== null && (token.type === WHITESPACE$1 || token.type === COMMENT$1)) {
  4282. token = getNextToken(++offset);
  4283. }
  4284. return offset;
  4285. }
  4286. function checkInteger(token, valueOffset, disallowSign, offset) {
  4287. if (!token) {
  4288. return 0;
  4289. }
  4290. var code = token.value.charCodeAt(valueOffset);
  4291. if (code === PLUSSIGN || code === HYPHENMINUS$1) {
  4292. if (disallowSign) {
  4293. // Number sign is not allowed
  4294. return 0;
  4295. }
  4296. valueOffset++;
  4297. }
  4298. for (; valueOffset < token.value.length; valueOffset++) {
  4299. if (!isDigit$2(token.value.charCodeAt(valueOffset))) {
  4300. // Integer is expected
  4301. return 0;
  4302. }
  4303. }
  4304. return offset + 1;
  4305. }
  4306. // ... <signed-integer>
  4307. // ... ['+' | '-'] <signless-integer>
  4308. function consumeB(token, offset_, getNextToken) {
  4309. var sign = false;
  4310. var offset = skipSC(token, offset_, getNextToken);
  4311. token = getNextToken(offset);
  4312. if (token === null) {
  4313. return offset_;
  4314. }
  4315. if (token.type !== NUMBER) {
  4316. if (isDelim(token, PLUSSIGN) || isDelim(token, HYPHENMINUS$1)) {
  4317. sign = true;
  4318. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4319. token = getNextToken(offset);
  4320. if (token === null && token.type !== NUMBER) {
  4321. return 0;
  4322. }
  4323. } else {
  4324. return offset_;
  4325. }
  4326. }
  4327. if (!sign) {
  4328. var code = token.value.charCodeAt(0);
  4329. if (code !== PLUSSIGN && code !== HYPHENMINUS$1) {
  4330. // Number sign is expected
  4331. return 0;
  4332. }
  4333. }
  4334. return checkInteger(token, sign ? 0 : 1, sign, offset);
  4335. }
  4336. // An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
  4337. var genericAnPlusB = function anPlusB(token, getNextToken) {
  4338. /* eslint-disable brace-style*/
  4339. var offset = 0;
  4340. if (!token) {
  4341. return 0;
  4342. }
  4343. // <integer>
  4344. if (token.type === NUMBER) {
  4345. return checkInteger(token, 0, ALLOW_SIGN, offset); // b
  4346. }
  4347. // -n
  4348. // -n <signed-integer>
  4349. // -n ['+' | '-'] <signless-integer>
  4350. // -n- <signless-integer>
  4351. // <dashndashdigit-ident>
  4352. else if (token.type === IDENT && token.value.charCodeAt(0) === HYPHENMINUS$1) {
  4353. // expect 1st char is N
  4354. if (!cmpChar$1(token.value, 1, N)) {
  4355. return 0;
  4356. }
  4357. switch (token.value.length) {
  4358. // -n
  4359. // -n <signed-integer>
  4360. // -n ['+' | '-'] <signless-integer>
  4361. case 2:
  4362. return consumeB(getNextToken(++offset), offset, getNextToken);
  4363. // -n- <signless-integer>
  4364. case 3:
  4365. if (token.value.charCodeAt(2) !== HYPHENMINUS$1) {
  4366. return 0;
  4367. }
  4368. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4369. token = getNextToken(offset);
  4370. return checkInteger(token, 0, DISALLOW_SIGN, offset);
  4371. // <dashndashdigit-ident>
  4372. default:
  4373. if (token.value.charCodeAt(2) !== HYPHENMINUS$1) {
  4374. return 0;
  4375. }
  4376. return checkInteger(token, 3, DISALLOW_SIGN, offset);
  4377. }
  4378. }
  4379. // '+'? n
  4380. // '+'? n <signed-integer>
  4381. // '+'? n ['+' | '-'] <signless-integer>
  4382. // '+'? n- <signless-integer>
  4383. // '+'? <ndashdigit-ident>
  4384. else if (token.type === IDENT || (isDelim(token, PLUSSIGN) && getNextToken(offset + 1).type === IDENT)) {
  4385. // just ignore a plus
  4386. if (token.type !== IDENT) {
  4387. token = getNextToken(++offset);
  4388. }
  4389. if (token === null || !cmpChar$1(token.value, 0, N)) {
  4390. return 0;
  4391. }
  4392. switch (token.value.length) {
  4393. // '+'? n
  4394. // '+'? n <signed-integer>
  4395. // '+'? n ['+' | '-'] <signless-integer>
  4396. case 1:
  4397. return consumeB(getNextToken(++offset), offset, getNextToken);
  4398. // '+'? n- <signless-integer>
  4399. case 2:
  4400. if (token.value.charCodeAt(1) !== HYPHENMINUS$1) {
  4401. return 0;
  4402. }
  4403. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4404. token = getNextToken(offset);
  4405. return checkInteger(token, 0, DISALLOW_SIGN, offset);
  4406. // '+'? <ndashdigit-ident>
  4407. default:
  4408. if (token.value.charCodeAt(1) !== HYPHENMINUS$1) {
  4409. return 0;
  4410. }
  4411. return checkInteger(token, 2, DISALLOW_SIGN, offset);
  4412. }
  4413. }
  4414. // <ndashdigit-dimension>
  4415. // <ndash-dimension> <signless-integer>
  4416. // <n-dimension>
  4417. // <n-dimension> <signed-integer>
  4418. // <n-dimension> ['+' | '-'] <signless-integer>
  4419. else if (token.type === DIMENSION) {
  4420. var code = token.value.charCodeAt(0);
  4421. var sign = code === PLUSSIGN || code === HYPHENMINUS$1 ? 1 : 0;
  4422. for (var i = sign; i < token.value.length; i++) {
  4423. if (!isDigit$2(token.value.charCodeAt(i))) {
  4424. break;
  4425. }
  4426. }
  4427. if (i === sign) {
  4428. // Integer is expected
  4429. return 0;
  4430. }
  4431. if (!cmpChar$1(token.value, i, N)) {
  4432. return 0;
  4433. }
  4434. // <n-dimension>
  4435. // <n-dimension> <signed-integer>
  4436. // <n-dimension> ['+' | '-'] <signless-integer>
  4437. if (i + 1 === token.value.length) {
  4438. return consumeB(getNextToken(++offset), offset, getNextToken);
  4439. } else {
  4440. if (token.value.charCodeAt(i + 1) !== HYPHENMINUS$1) {
  4441. return 0;
  4442. }
  4443. // <ndash-dimension> <signless-integer>
  4444. if (i + 2 === token.value.length) {
  4445. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4446. token = getNextToken(offset);
  4447. return checkInteger(token, 0, DISALLOW_SIGN, offset);
  4448. }
  4449. // <ndashdigit-dimension>
  4450. else {
  4451. return checkInteger(token, i + 2, DISALLOW_SIGN, offset);
  4452. }
  4453. }
  4454. }
  4455. return 0;
  4456. };
  4457. var isHexDigit$2 = tokenizer.isHexDigit;
  4458. var cmpChar$2 = tokenizer.cmpChar;
  4459. var TYPE$4 = tokenizer.TYPE;
  4460. var IDENT$1 = TYPE$4.Ident;
  4461. var DELIM$1 = TYPE$4.Delim;
  4462. var NUMBER$1 = TYPE$4.Number;
  4463. var DIMENSION$1 = TYPE$4.Dimension;
  4464. var PLUSSIGN$1 = 0x002B; // U+002B PLUS SIGN (+)
  4465. var HYPHENMINUS$2 = 0x002D; // U+002D HYPHEN-MINUS (-)
  4466. var QUESTIONMARK = 0x003F; // U+003F QUESTION MARK (?)
  4467. var U = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
  4468. function isDelim$1(token, code) {
  4469. return token !== null && token.type === DELIM$1 && token.value.charCodeAt(0) === code;
  4470. }
  4471. function startsWith(token, code) {
  4472. return token.value.charCodeAt(0) === code;
  4473. }
  4474. function hexSequence(token, offset, allowDash) {
  4475. for (var pos = offset, hexlen = 0; pos < token.value.length; pos++) {
  4476. var code = token.value.charCodeAt(pos);
  4477. if (code === HYPHENMINUS$2 && allowDash && hexlen !== 0) {
  4478. if (hexSequence(token, offset + hexlen + 1, false) > 0) {
  4479. return 6; // dissallow following question marks
  4480. }
  4481. return 0; // dash at the ending of a hex sequence is not allowed
  4482. }
  4483. if (!isHexDigit$2(code)) {
  4484. return 0; // not a hex digit
  4485. }
  4486. if (++hexlen > 6) {
  4487. return 0; // too many hex digits
  4488. } }
  4489. return hexlen;
  4490. }
  4491. function withQuestionMarkSequence(consumed, length, getNextToken) {
  4492. if (!consumed) {
  4493. return 0; // nothing consumed
  4494. }
  4495. while (isDelim$1(getNextToken(length), QUESTIONMARK)) {
  4496. if (++consumed > 6) {
  4497. return 0; // too many question marks
  4498. }
  4499. length++;
  4500. }
  4501. return length;
  4502. }
  4503. // https://drafts.csswg.org/css-syntax/#urange
  4504. // Informally, the <urange> production has three forms:
  4505. // U+0001
  4506. // Defines a range consisting of a single code point, in this case the code point "1".
  4507. // U+0001-00ff
  4508. // Defines a range of codepoints between the first and the second value, in this case
  4509. // the range between "1" and "ff" (255 in decimal) inclusive.
  4510. // U+00??
  4511. // Defines a range of codepoints where the "?" characters range over all hex digits,
  4512. // in this case defining the same as the value U+0000-00ff.
  4513. // In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat "?" as a hexadecimal digit).
  4514. //
  4515. // <urange> =
  4516. // u '+' <ident-token> '?'* |
  4517. // u <dimension-token> '?'* |
  4518. // u <number-token> '?'* |
  4519. // u <number-token> <dimension-token> |
  4520. // u <number-token> <number-token> |
  4521. // u '+' '?'+
  4522. var genericUrange = function urange(token, getNextToken) {
  4523. var length = 0;
  4524. // should start with `u` or `U`
  4525. if (token === null || token.type !== IDENT$1 || !cmpChar$2(token.value, 0, U)) {
  4526. return 0;
  4527. }
  4528. token = getNextToken(++length);
  4529. if (token === null) {
  4530. return 0;
  4531. }
  4532. // u '+' <ident-token> '?'*
  4533. // u '+' '?'+
  4534. if (isDelim$1(token, PLUSSIGN$1)) {
  4535. token = getNextToken(++length);
  4536. if (token === null) {
  4537. return 0;
  4538. }
  4539. if (token.type === IDENT$1) {
  4540. // u '+' <ident-token> '?'*
  4541. return withQuestionMarkSequence(hexSequence(token, 0, true), ++length, getNextToken);
  4542. }
  4543. if (isDelim$1(token, QUESTIONMARK)) {
  4544. // u '+' '?'+
  4545. return withQuestionMarkSequence(1, ++length, getNextToken);
  4546. }
  4547. // Hex digit or question mark is expected
  4548. return 0;
  4549. }
  4550. // u <number-token> '?'*
  4551. // u <number-token> <dimension-token>
  4552. // u <number-token> <number-token>
  4553. if (token.type === NUMBER$1) {
  4554. if (!startsWith(token, PLUSSIGN$1)) {
  4555. return 0;
  4556. }
  4557. var consumedHexLength = hexSequence(token, 1, true);
  4558. if (consumedHexLength === 0) {
  4559. return 0;
  4560. }
  4561. token = getNextToken(++length);
  4562. if (token === null) {
  4563. // u <number-token> <eof>
  4564. return length;
  4565. }
  4566. if (token.type === DIMENSION$1 || token.type === NUMBER$1) {
  4567. // u <number-token> <dimension-token>
  4568. // u <number-token> <number-token>
  4569. if (!startsWith(token, HYPHENMINUS$2) || !hexSequence(token, 1, false)) {
  4570. return 0;
  4571. }
  4572. return length + 1;
  4573. }
  4574. // u <number-token> '?'*
  4575. return withQuestionMarkSequence(consumedHexLength, length, getNextToken);
  4576. }
  4577. // u <dimension-token> '?'*
  4578. if (token.type === DIMENSION$1) {
  4579. if (!startsWith(token, PLUSSIGN$1)) {
  4580. return 0;
  4581. }
  4582. return withQuestionMarkSequence(hexSequence(token, 1, true), ++length, getNextToken);
  4583. }
  4584. return 0;
  4585. };
  4586. var isIdentifierStart$2 = tokenizer.isIdentifierStart;
  4587. var isHexDigit$3 = tokenizer.isHexDigit;
  4588. var isDigit$3 = tokenizer.isDigit;
  4589. var cmpStr$3 = tokenizer.cmpStr;
  4590. var consumeNumber$2 = tokenizer.consumeNumber;
  4591. var TYPE$5 = tokenizer.TYPE;
  4592. var cssWideKeywords = ['unset', 'initial', 'inherit'];
  4593. var calcFunctionNames = ['calc(', '-moz-calc(', '-webkit-calc('];
  4594. // https://www.w3.org/TR/css-values-3/#lengths
  4595. var LENGTH = {
  4596. // absolute length units
  4597. 'px': true,
  4598. 'mm': true,
  4599. 'cm': true,
  4600. 'in': true,
  4601. 'pt': true,
  4602. 'pc': true,
  4603. 'q': true,
  4604. // relative length units
  4605. 'em': true,
  4606. 'ex': true,
  4607. 'ch': true,
  4608. 'rem': true,
  4609. // viewport-percentage lengths
  4610. 'vh': true,
  4611. 'vw': true,
  4612. 'vmin': true,
  4613. 'vmax': true,
  4614. 'vm': true
  4615. };
  4616. var ANGLE = {
  4617. 'deg': true,
  4618. 'grad': true,
  4619. 'rad': true,
  4620. 'turn': true
  4621. };
  4622. var TIME = {
  4623. 's': true,
  4624. 'ms': true
  4625. };
  4626. var FREQUENCY = {
  4627. 'hz': true,
  4628. 'khz': true
  4629. };
  4630. // https://www.w3.org/TR/css-values-3/#resolution (https://drafts.csswg.org/css-values/#resolution)
  4631. var RESOLUTION = {
  4632. 'dpi': true,
  4633. 'dpcm': true,
  4634. 'dppx': true,
  4635. 'x': true // https://github.com/w3c/csswg-drafts/issues/461
  4636. };
  4637. // https://drafts.csswg.org/css-grid/#fr-unit
  4638. var FLEX = {
  4639. 'fr': true
  4640. };
  4641. // https://www.w3.org/TR/css3-speech/#mixing-props-voice-volume
  4642. var DECIBEL = {
  4643. 'db': true
  4644. };
  4645. // https://www.w3.org/TR/css3-speech/#voice-props-voice-pitch
  4646. var SEMITONES = {
  4647. 'st': true
  4648. };
  4649. // safe char code getter
  4650. function charCode(str, index) {
  4651. return index < str.length ? str.charCodeAt(index) : 0;
  4652. }
  4653. function eqStr(actual, expected) {
  4654. return cmpStr$3(actual, 0, actual.length, expected);
  4655. }
  4656. function eqStrAny(actual, expected) {
  4657. for (var i = 0; i < expected.length; i++) {
  4658. if (eqStr(actual, expected[i])) {
  4659. return true;
  4660. }
  4661. }
  4662. return false;
  4663. }
  4664. // IE postfix hack, i.e. 123\0 or 123px\9
  4665. function isPostfixIeHack(str, offset) {
  4666. if (offset !== str.length - 2) {
  4667. return false;
  4668. }
  4669. return (
  4670. str.charCodeAt(offset) === 0x005C && // U+005C REVERSE SOLIDUS (\)
  4671. isDigit$3(str.charCodeAt(offset + 1))
  4672. );
  4673. }
  4674. function outOfRange(opts, value, numEnd) {
  4675. if (opts && opts.type === 'Range') {
  4676. var num = Number(
  4677. numEnd !== undefined && numEnd !== value.length
  4678. ? value.substr(0, numEnd)
  4679. : value
  4680. );
  4681. if (isNaN(num)) {
  4682. return true;
  4683. }
  4684. if (opts.min !== null && num < opts.min) {
  4685. return true;
  4686. }
  4687. if (opts.max !== null && num > opts.max) {
  4688. return true;
  4689. }
  4690. }
  4691. return false;
  4692. }
  4693. function consumeFunction(token, getNextToken) {
  4694. var startIdx = token.index;
  4695. var length = 0;
  4696. // balanced token consuming
  4697. do {
  4698. length++;
  4699. if (token.balance <= startIdx) {
  4700. break;
  4701. }
  4702. } while (token = getNextToken(length));
  4703. return length;
  4704. }
  4705. // TODO: implement
  4706. // can be used wherever <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> values are allowed
  4707. // https://drafts.csswg.org/css-values/#calc-notation
  4708. function calc(next) {
  4709. return function(token, getNextToken, opts) {
  4710. if (token === null) {
  4711. return 0;
  4712. }
  4713. if (token.type === TYPE$5.Function && eqStrAny(token.value, calcFunctionNames)) {
  4714. return consumeFunction(token, getNextToken);
  4715. }
  4716. return next(token, getNextToken, opts);
  4717. };
  4718. }
  4719. function tokenType(expectedTokenType) {
  4720. return function(token) {
  4721. if (token === null || token.type !== expectedTokenType) {
  4722. return 0;
  4723. }
  4724. return 1;
  4725. };
  4726. }
  4727. function func(name) {
  4728. name = name + '(';
  4729. return function(token, getNextToken) {
  4730. if (token !== null && eqStr(token.value, name)) {
  4731. return consumeFunction(token, getNextToken);
  4732. }
  4733. return 0;
  4734. };
  4735. }
  4736. // =========================
  4737. // Complex types
  4738. //
  4739. // https://drafts.csswg.org/css-values-4/#custom-idents
  4740. // 4.2. Author-defined Identifiers: the <custom-ident> type
  4741. // Some properties accept arbitrary author-defined identifiers as a component value.
  4742. // This generic data type is denoted by <custom-ident>, and represents any valid CSS identifier
  4743. // that would not be misinterpreted as a pre-defined keyword in that property’s value definition.
  4744. //
  4745. // See also: https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident
  4746. function customIdent(token) {
  4747. if (token === null || token.type !== TYPE$5.Ident) {
  4748. return 0;
  4749. }
  4750. var name = token.value.toLowerCase();
  4751. // The CSS-wide keywords are not valid <custom-ident>s
  4752. if (eqStrAny(name, cssWideKeywords)) {
  4753. return 0;
  4754. }
  4755. // The default keyword is reserved and is also not a valid <custom-ident>
  4756. if (eqStr(name, 'default')) {
  4757. return 0;
  4758. }
  4759. // TODO: ignore property specific keywords (as described https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident)
  4760. // Specifications using <custom-ident> must specify clearly what other keywords
  4761. // are excluded from <custom-ident>, if any—for example by saying that any pre-defined keywords
  4762. // in that property’s value definition are excluded. Excluded keywords are excluded
  4763. // in all ASCII case permutations.
  4764. return 1;
  4765. }
  4766. // https://drafts.csswg.org/css-variables/#typedef-custom-property-name
  4767. // A custom property is any property whose name starts with two dashes (U+002D HYPHEN-MINUS), like --foo.
  4768. // The <custom-property-name> production corresponds to this: it’s defined as any valid identifier
  4769. // that starts with two dashes, except -- itself, which is reserved for future use by CSS.
  4770. // NOTE: Current implementation treat `--` as a valid name since most (all?) major browsers treat it as valid.
  4771. function customPropertyName(token) {
  4772. // ... defined as any valid identifier
  4773. if (token === null || token.type !== TYPE$5.Ident) {
  4774. return 0;
  4775. }
  4776. // ... that starts with two dashes (U+002D HYPHEN-MINUS)
  4777. if (charCode(token.value, 0) !== 0x002D || charCode(token.value, 1) !== 0x002D) {
  4778. return 0;
  4779. }
  4780. return 1;
  4781. }
  4782. // https://drafts.csswg.org/css-color-4/#hex-notation
  4783. // The syntax of a <hex-color> is a <hash-token> token whose value consists of 3, 4, 6, or 8 hexadecimal digits.
  4784. // In other words, a hex color is written as a hash character, "#", followed by some number of digits 0-9 or
  4785. // letters a-f (the case of the letters doesn’t matter - #00ff00 is identical to #00FF00).
  4786. function hexColor(token) {
  4787. if (token === null || token.type !== TYPE$5.Hash) {
  4788. return 0;
  4789. }
  4790. var length = token.value.length;
  4791. // valid values (length): #rgb (4), #rgba (5), #rrggbb (7), #rrggbbaa (9)
  4792. if (length !== 4 && length !== 5 && length !== 7 && length !== 9) {
  4793. return 0;
  4794. }
  4795. for (var i = 1; i < length; i++) {
  4796. if (!isHexDigit$3(token.value.charCodeAt(i))) {
  4797. return 0;
  4798. }
  4799. }
  4800. return 1;
  4801. }
  4802. function idSelector(token) {
  4803. if (token === null || token.type !== TYPE$5.Hash) {
  4804. return 0;
  4805. }
  4806. if (!isIdentifierStart$2(charCode(token.value, 1), charCode(token.value, 2), charCode(token.value, 3))) {
  4807. return 0;
  4808. }
  4809. return 1;
  4810. }
  4811. // https://drafts.csswg.org/css-syntax/#any-value
  4812. // It represents the entirety of what a valid declaration can have as its value.
  4813. function declarationValue(token, getNextToken) {
  4814. if (!token) {
  4815. return 0;
  4816. }
  4817. var length = 0;
  4818. var level = 0;
  4819. var startIdx = token.index;
  4820. // The <declaration-value> production matches any sequence of one or more tokens,
  4821. // so long as the sequence ...
  4822. scan:
  4823. do {
  4824. switch (token.type) {
  4825. // ... does not contain <bad-string-token>, <bad-url-token>,
  4826. case TYPE$5.BadString:
  4827. case TYPE$5.BadUrl:
  4828. break scan;
  4829. // ... unmatched <)-token>, <]-token>, or <}-token>,
  4830. case TYPE$5.RightCurlyBracket:
  4831. case TYPE$5.RightParenthesis:
  4832. case TYPE$5.RightSquareBracket:
  4833. if (token.balance > token.index || token.balance < startIdx) {
  4834. break scan;
  4835. }
  4836. level--;
  4837. break;
  4838. // ... or top-level <semicolon-token> tokens
  4839. case TYPE$5.Semicolon:
  4840. if (level === 0) {
  4841. break scan;
  4842. }
  4843. break;
  4844. // ... or <delim-token> tokens with a value of "!"
  4845. case TYPE$5.Delim:
  4846. if (token.value === '!' && level === 0) {
  4847. break scan;
  4848. }
  4849. break;
  4850. case TYPE$5.Function:
  4851. case TYPE$5.LeftParenthesis:
  4852. case TYPE$5.LeftSquareBracket:
  4853. case TYPE$5.LeftCurlyBracket:
  4854. level++;
  4855. break;
  4856. }
  4857. length++;
  4858. // until balance closing
  4859. if (token.balance <= startIdx) {
  4860. break;
  4861. }
  4862. } while (token = getNextToken(length));
  4863. return length;
  4864. }
  4865. // https://drafts.csswg.org/css-syntax/#any-value
  4866. // The <any-value> production is identical to <declaration-value>, but also
  4867. // allows top-level <semicolon-token> tokens and <delim-token> tokens
  4868. // with a value of "!". It represents the entirety of what valid CSS can be in any context.
  4869. function anyValue(token, getNextToken) {
  4870. if (!token) {
  4871. return 0;
  4872. }
  4873. var startIdx = token.index;
  4874. var length = 0;
  4875. // The <any-value> production matches any sequence of one or more tokens,
  4876. // so long as the sequence ...
  4877. scan:
  4878. do {
  4879. switch (token.type) {
  4880. // ... does not contain <bad-string-token>, <bad-url-token>,
  4881. case TYPE$5.BadString:
  4882. case TYPE$5.BadUrl:
  4883. break scan;
  4884. // ... unmatched <)-token>, <]-token>, or <}-token>,
  4885. case TYPE$5.RightCurlyBracket:
  4886. case TYPE$5.RightParenthesis:
  4887. case TYPE$5.RightSquareBracket:
  4888. if (token.balance > token.index || token.balance < startIdx) {
  4889. break scan;
  4890. }
  4891. break;
  4892. }
  4893. length++;
  4894. // until balance closing
  4895. if (token.balance <= startIdx) {
  4896. break;
  4897. }
  4898. } while (token = getNextToken(length));
  4899. return length;
  4900. }
  4901. // =========================
  4902. // Dimensions
  4903. //
  4904. function dimension(type) {
  4905. return function(token, getNextToken, opts) {
  4906. if (token === null || token.type !== TYPE$5.Dimension) {
  4907. return 0;
  4908. }
  4909. var numberEnd = consumeNumber$2(token.value, 0);
  4910. // check unit
  4911. if (type !== null) {
  4912. // check for IE postfix hack, i.e. 123px\0 or 123px\9
  4913. var reverseSolidusOffset = token.value.indexOf('\\', numberEnd);
  4914. var unit = reverseSolidusOffset === -1 || !isPostfixIeHack(token.value, reverseSolidusOffset)
  4915. ? token.value.substr(numberEnd)
  4916. : token.value.substring(numberEnd, reverseSolidusOffset);
  4917. if (type.hasOwnProperty(unit.toLowerCase()) === false) {
  4918. return 0;
  4919. }
  4920. }
  4921. // check range if specified
  4922. if (outOfRange(opts, token.value, numberEnd)) {
  4923. return 0;
  4924. }
  4925. return 1;
  4926. };
  4927. }
  4928. // =========================
  4929. // Percentage
  4930. //
  4931. // §5.5. Percentages: the <percentage> type
  4932. // https://drafts.csswg.org/css-values-4/#percentages
  4933. function percentage(token, getNextToken, opts) {
  4934. // ... corresponds to the <percentage-token> production
  4935. if (token === null || token.type !== TYPE$5.Percentage) {
  4936. return 0;
  4937. }
  4938. // check range if specified
  4939. if (outOfRange(opts, token.value, token.value.length - 1)) {
  4940. return 0;
  4941. }
  4942. return 1;
  4943. }
  4944. // =========================
  4945. // Numeric
  4946. //
  4947. // https://drafts.csswg.org/css-values-4/#numbers
  4948. // The value <zero> represents a literal number with the value 0. Expressions that merely
  4949. // evaluate to a <number> with the value 0 (for example, calc(0)) do not match <zero>;
  4950. // only literal <number-token>s do.
  4951. function zero(next) {
  4952. if (typeof next !== 'function') {
  4953. next = function() {
  4954. return 0;
  4955. };
  4956. }
  4957. return function(token, getNextToken, opts) {
  4958. if (token !== null && token.type === TYPE$5.Number) {
  4959. if (Number(token.value) === 0) {
  4960. return 1;
  4961. }
  4962. }
  4963. return next(token, getNextToken, opts);
  4964. };
  4965. }
  4966. // § 5.3. Real Numbers: the <number> type
  4967. // https://drafts.csswg.org/css-values-4/#numbers
  4968. // Number values are denoted by <number>, and represent real numbers, possibly with a fractional component.
  4969. // ... It corresponds to the <number-token> production
  4970. function number(token, getNextToken, opts) {
  4971. if (token === null) {
  4972. return 0;
  4973. }
  4974. var numberEnd = consumeNumber$2(token.value, 0);
  4975. var isNumber = numberEnd === token.value.length;
  4976. if (!isNumber && !isPostfixIeHack(token.value, numberEnd)) {
  4977. return 0;
  4978. }
  4979. // check range if specified
  4980. if (outOfRange(opts, token.value, numberEnd)) {
  4981. return 0;
  4982. }
  4983. return 1;
  4984. }
  4985. // §5.2. Integers: the <integer> type
  4986. // https://drafts.csswg.org/css-values-4/#integers
  4987. function integer(token, getNextToken, opts) {
  4988. // ... corresponds to a subset of the <number-token> production
  4989. if (token === null || token.type !== TYPE$5.Number) {
  4990. return 0;
  4991. }
  4992. // The first digit of an integer may be immediately preceded by `-` or `+` to indicate the integer’s sign.
  4993. var i = token.value.charCodeAt(0) === 0x002B || // U+002B PLUS SIGN (+)
  4994. token.value.charCodeAt(0) === 0x002D ? 1 : 0; // U+002D HYPHEN-MINUS (-)
  4995. // When written literally, an integer is one or more decimal digits 0 through 9 ...
  4996. for (; i < token.value.length; i++) {
  4997. if (!isDigit$3(token.value.charCodeAt(i))) {
  4998. return 0;
  4999. }
  5000. }
  5001. // check range if specified
  5002. if (outOfRange(opts, token.value, i)) {
  5003. return 0;
  5004. }
  5005. return 1;
  5006. }
  5007. var generic = {
  5008. // token types
  5009. 'ident-token': tokenType(TYPE$5.Ident),
  5010. 'function-token': tokenType(TYPE$5.Function),
  5011. 'at-keyword-token': tokenType(TYPE$5.AtKeyword),
  5012. 'hash-token': tokenType(TYPE$5.Hash),
  5013. 'string-token': tokenType(TYPE$5.String),
  5014. 'bad-string-token': tokenType(TYPE$5.BadString),
  5015. 'url-token': tokenType(TYPE$5.Url),
  5016. 'bad-url-token': tokenType(TYPE$5.BadUrl),
  5017. 'delim-token': tokenType(TYPE$5.Delim),
  5018. 'number-token': tokenType(TYPE$5.Number),
  5019. 'percentage-token': tokenType(TYPE$5.Percentage),
  5020. 'dimension-token': tokenType(TYPE$5.Dimension),
  5021. 'whitespace-token': tokenType(TYPE$5.WhiteSpace),
  5022. 'CDO-token': tokenType(TYPE$5.CDO),
  5023. 'CDC-token': tokenType(TYPE$5.CDC),
  5024. 'colon-token': tokenType(TYPE$5.Colon),
  5025. 'semicolon-token': tokenType(TYPE$5.Semicolon),
  5026. 'comma-token': tokenType(TYPE$5.Comma),
  5027. '[-token': tokenType(TYPE$5.LeftSquareBracket),
  5028. ']-token': tokenType(TYPE$5.RightSquareBracket),
  5029. '(-token': tokenType(TYPE$5.LeftParenthesis),
  5030. ')-token': tokenType(TYPE$5.RightParenthesis),
  5031. '{-token': tokenType(TYPE$5.LeftCurlyBracket),
  5032. '}-token': tokenType(TYPE$5.RightCurlyBracket),
  5033. // token type aliases
  5034. 'string': tokenType(TYPE$5.String),
  5035. 'ident': tokenType(TYPE$5.Ident),
  5036. // complex types
  5037. 'custom-ident': customIdent,
  5038. 'custom-property-name': customPropertyName,
  5039. 'hex-color': hexColor,
  5040. 'id-selector': idSelector, // element( <id-selector> )
  5041. 'an-plus-b': genericAnPlusB,
  5042. 'urange': genericUrange,
  5043. 'declaration-value': declarationValue,
  5044. 'any-value': anyValue,
  5045. // dimensions
  5046. 'dimension': calc(dimension(null)),
  5047. 'angle': calc(dimension(ANGLE)),
  5048. 'decibel': calc(dimension(DECIBEL)),
  5049. 'frequency': calc(dimension(FREQUENCY)),
  5050. 'flex': calc(dimension(FLEX)),
  5051. 'length': calc(zero(dimension(LENGTH))),
  5052. 'resolution': calc(dimension(RESOLUTION)),
  5053. 'semitones': calc(dimension(SEMITONES)),
  5054. 'time': calc(dimension(TIME)),
  5055. // percentage
  5056. 'percentage': calc(percentage),
  5057. // numeric
  5058. 'zero': zero(),
  5059. 'number': calc(number),
  5060. 'integer': calc(integer),
  5061. // old IE stuff
  5062. '-ms-legacy-expression': func('expression')
  5063. };
  5064. var _SyntaxError$1 = function SyntaxError(message, input, offset) {
  5065. var error = createCustomError('SyntaxError', message);
  5066. error.input = input;
  5067. error.offset = offset;
  5068. error.rawMessage = message;
  5069. error.message = error.rawMessage + '\n' +
  5070. ' ' + error.input + '\n' +
  5071. '--' + new Array((error.offset || error.input.length) + 1).join('-') + '^';
  5072. return error;
  5073. };
  5074. var TAB = 9;
  5075. var N$1 = 10;
  5076. var F = 12;
  5077. var R = 13;
  5078. var SPACE = 32;
  5079. var Tokenizer = function(str) {
  5080. this.str = str;
  5081. this.pos = 0;
  5082. };
  5083. Tokenizer.prototype = {
  5084. charCodeAt: function(pos) {
  5085. return pos < this.str.length ? this.str.charCodeAt(pos) : 0;
  5086. },
  5087. charCode: function() {
  5088. return this.charCodeAt(this.pos);
  5089. },
  5090. nextCharCode: function() {
  5091. return this.charCodeAt(this.pos + 1);
  5092. },
  5093. nextNonWsCode: function(pos) {
  5094. return this.charCodeAt(this.findWsEnd(pos));
  5095. },
  5096. findWsEnd: function(pos) {
  5097. for (; pos < this.str.length; pos++) {
  5098. var code = this.str.charCodeAt(pos);
  5099. if (code !== R && code !== N$1 && code !== F && code !== SPACE && code !== TAB) {
  5100. break;
  5101. }
  5102. }
  5103. return pos;
  5104. },
  5105. substringToPos: function(end) {
  5106. return this.str.substring(this.pos, this.pos = end);
  5107. },
  5108. eat: function(code) {
  5109. if (this.charCode() !== code) {
  5110. this.error('Expect `' + String.fromCharCode(code) + '`');
  5111. }
  5112. this.pos++;
  5113. },
  5114. peek: function() {
  5115. return this.pos < this.str.length ? this.str.charAt(this.pos++) : '';
  5116. },
  5117. error: function(message) {
  5118. throw new _SyntaxError$1(message, this.str, this.pos);
  5119. }
  5120. };
  5121. var tokenizer$1 = Tokenizer;
  5122. var TAB$1 = 9;
  5123. var N$2 = 10;
  5124. var F$1 = 12;
  5125. var R$1 = 13;
  5126. var SPACE$1 = 32;
  5127. var EXCLAMATIONMARK = 33; // !
  5128. var NUMBERSIGN = 35; // #
  5129. var AMPERSAND = 38; // &
  5130. var APOSTROPHE = 39; // '
  5131. var LEFTPARENTHESIS = 40; // (
  5132. var RIGHTPARENTHESIS = 41; // )
  5133. var ASTERISK = 42; // *
  5134. var PLUSSIGN$2 = 43; // +
  5135. var COMMA = 44; // ,
  5136. var HYPERMINUS = 45; // -
  5137. var LESSTHANSIGN = 60; // <
  5138. var GREATERTHANSIGN = 62; // >
  5139. var QUESTIONMARK$1 = 63; // ?
  5140. var COMMERCIALAT = 64; // @
  5141. var LEFTSQUAREBRACKET = 91; // [
  5142. var RIGHTSQUAREBRACKET = 93; // ]
  5143. var LEFTCURLYBRACKET = 123; // {
  5144. var VERTICALLINE = 124; // |
  5145. var RIGHTCURLYBRACKET = 125; // }
  5146. var INFINITY = 8734; // ∞
  5147. var NAME_CHAR = createCharMap(function(ch) {
  5148. return /[a-zA-Z0-9\-]/.test(ch);
  5149. });
  5150. var COMBINATOR_PRECEDENCE = {
  5151. ' ': 1,
  5152. '&&': 2,
  5153. '||': 3,
  5154. '|': 4
  5155. };
  5156. function createCharMap(fn) {
  5157. var array = typeof Uint32Array === 'function' ? new Uint32Array(128) : new Array(128);
  5158. for (var i = 0; i < 128; i++) {
  5159. array[i] = fn(String.fromCharCode(i)) ? 1 : 0;
  5160. }
  5161. return array;
  5162. }
  5163. function scanSpaces(tokenizer) {
  5164. return tokenizer.substringToPos(
  5165. tokenizer.findWsEnd(tokenizer.pos)
  5166. );
  5167. }
  5168. function scanWord(tokenizer) {
  5169. var end = tokenizer.pos;
  5170. for (; end < tokenizer.str.length; end++) {
  5171. var code = tokenizer.str.charCodeAt(end);
  5172. if (code >= 128 || NAME_CHAR[code] === 0) {
  5173. break;
  5174. }
  5175. }
  5176. if (tokenizer.pos === end) {
  5177. tokenizer.error('Expect a keyword');
  5178. }
  5179. return tokenizer.substringToPos(end);
  5180. }
  5181. function scanNumber(tokenizer) {
  5182. var end = tokenizer.pos;
  5183. for (; end < tokenizer.str.length; end++) {
  5184. var code = tokenizer.str.charCodeAt(end);
  5185. if (code < 48 || code > 57) {
  5186. break;
  5187. }
  5188. }
  5189. if (tokenizer.pos === end) {
  5190. tokenizer.error('Expect a number');
  5191. }
  5192. return tokenizer.substringToPos(end);
  5193. }
  5194. function scanString(tokenizer) {
  5195. var end = tokenizer.str.indexOf('\'', tokenizer.pos + 1);
  5196. if (end === -1) {
  5197. tokenizer.pos = tokenizer.str.length;
  5198. tokenizer.error('Expect an apostrophe');
  5199. }
  5200. return tokenizer.substringToPos(end + 1);
  5201. }
  5202. function readMultiplierRange(tokenizer) {
  5203. var min = null;
  5204. var max = null;
  5205. tokenizer.eat(LEFTCURLYBRACKET);
  5206. min = scanNumber(tokenizer);
  5207. if (tokenizer.charCode() === COMMA) {
  5208. tokenizer.pos++;
  5209. if (tokenizer.charCode() !== RIGHTCURLYBRACKET) {
  5210. max = scanNumber(tokenizer);
  5211. }
  5212. } else {
  5213. max = min;
  5214. }
  5215. tokenizer.eat(RIGHTCURLYBRACKET);
  5216. return {
  5217. min: Number(min),
  5218. max: max ? Number(max) : 0
  5219. };
  5220. }
  5221. function readMultiplier(tokenizer) {
  5222. var range = null;
  5223. var comma = false;
  5224. switch (tokenizer.charCode()) {
  5225. case ASTERISK:
  5226. tokenizer.pos++;
  5227. range = {
  5228. min: 0,
  5229. max: 0
  5230. };
  5231. break;
  5232. case PLUSSIGN$2:
  5233. tokenizer.pos++;
  5234. range = {
  5235. min: 1,
  5236. max: 0
  5237. };
  5238. break;
  5239. case QUESTIONMARK$1:
  5240. tokenizer.pos++;
  5241. range = {
  5242. min: 0,
  5243. max: 1
  5244. };
  5245. break;
  5246. case NUMBERSIGN:
  5247. tokenizer.pos++;
  5248. comma = true;
  5249. if (tokenizer.charCode() === LEFTCURLYBRACKET) {
  5250. range = readMultiplierRange(tokenizer);
  5251. } else {
  5252. range = {
  5253. min: 1,
  5254. max: 0
  5255. };
  5256. }
  5257. break;
  5258. case LEFTCURLYBRACKET:
  5259. range = readMultiplierRange(tokenizer);
  5260. break;
  5261. default:
  5262. return null;
  5263. }
  5264. return {
  5265. type: 'Multiplier',
  5266. comma: comma,
  5267. min: range.min,
  5268. max: range.max,
  5269. term: null
  5270. };
  5271. }
  5272. function maybeMultiplied(tokenizer, node) {
  5273. var multiplier = readMultiplier(tokenizer);
  5274. if (multiplier !== null) {
  5275. multiplier.term = node;
  5276. return multiplier;
  5277. }
  5278. return node;
  5279. }
  5280. function maybeToken(tokenizer) {
  5281. var ch = tokenizer.peek();
  5282. if (ch === '') {
  5283. return null;
  5284. }
  5285. return {
  5286. type: 'Token',
  5287. value: ch
  5288. };
  5289. }
  5290. function readProperty(tokenizer) {
  5291. var name;
  5292. tokenizer.eat(LESSTHANSIGN);
  5293. tokenizer.eat(APOSTROPHE);
  5294. name = scanWord(tokenizer);
  5295. tokenizer.eat(APOSTROPHE);
  5296. tokenizer.eat(GREATERTHANSIGN);
  5297. return maybeMultiplied(tokenizer, {
  5298. type: 'Property',
  5299. name: name
  5300. });
  5301. }
  5302. // https://drafts.csswg.org/css-values-3/#numeric-ranges
  5303. // 4.1. Range Restrictions and Range Definition Notation
  5304. //
  5305. // Range restrictions can be annotated in the numeric type notation using CSS bracketed
  5306. // range notation—[min,max]—within the angle brackets, after the identifying keyword,
  5307. // indicating a closed range between (and including) min and max.
  5308. // For example, <integer [0, 10]> indicates an integer between 0 and 10, inclusive.
  5309. function readTypeRange(tokenizer) {
  5310. // use null for Infinity to make AST format JSON serializable/deserializable
  5311. var min = null; // -Infinity
  5312. var max = null; // Infinity
  5313. var sign = 1;
  5314. tokenizer.eat(LEFTSQUAREBRACKET);
  5315. if (tokenizer.charCode() === HYPERMINUS) {
  5316. tokenizer.peek();
  5317. sign = -1;
  5318. }
  5319. if (sign == -1 && tokenizer.charCode() === INFINITY) {
  5320. tokenizer.peek();
  5321. } else {
  5322. min = sign * Number(scanNumber(tokenizer));
  5323. }
  5324. scanSpaces(tokenizer);
  5325. tokenizer.eat(COMMA);
  5326. scanSpaces(tokenizer);
  5327. if (tokenizer.charCode() === INFINITY) {
  5328. tokenizer.peek();
  5329. } else {
  5330. sign = 1;
  5331. if (tokenizer.charCode() === HYPERMINUS) {
  5332. tokenizer.peek();
  5333. sign = -1;
  5334. }
  5335. max = sign * Number(scanNumber(tokenizer));
  5336. }
  5337. tokenizer.eat(RIGHTSQUAREBRACKET);
  5338. // If no range is indicated, either by using the bracketed range notation
  5339. // or in the property description, then [−∞,∞] is assumed.
  5340. if (min === null && max === null) {
  5341. return null;
  5342. }
  5343. return {
  5344. type: 'Range',
  5345. min: min,
  5346. max: max
  5347. };
  5348. }
  5349. function readType(tokenizer) {
  5350. var name;
  5351. var opts = null;
  5352. tokenizer.eat(LESSTHANSIGN);
  5353. name = scanWord(tokenizer);
  5354. if (tokenizer.charCode() === LEFTPARENTHESIS &&
  5355. tokenizer.nextCharCode() === RIGHTPARENTHESIS) {
  5356. tokenizer.pos += 2;
  5357. name += '()';
  5358. }
  5359. if (tokenizer.charCodeAt(tokenizer.findWsEnd(tokenizer.pos)) === LEFTSQUAREBRACKET) {
  5360. scanSpaces(tokenizer);
  5361. opts = readTypeRange(tokenizer);
  5362. }
  5363. tokenizer.eat(GREATERTHANSIGN);
  5364. return maybeMultiplied(tokenizer, {
  5365. type: 'Type',
  5366. name: name,
  5367. opts: opts
  5368. });
  5369. }
  5370. function readKeywordOrFunction(tokenizer) {
  5371. var name;
  5372. name = scanWord(tokenizer);
  5373. if (tokenizer.charCode() === LEFTPARENTHESIS) {
  5374. tokenizer.pos++;
  5375. return {
  5376. type: 'Function',
  5377. name: name
  5378. };
  5379. }
  5380. return maybeMultiplied(tokenizer, {
  5381. type: 'Keyword',
  5382. name: name
  5383. });
  5384. }
  5385. function regroupTerms(terms, combinators) {
  5386. function createGroup(terms, combinator) {
  5387. return {
  5388. type: 'Group',
  5389. terms: terms,
  5390. combinator: combinator,
  5391. disallowEmpty: false,
  5392. explicit: false
  5393. };
  5394. }
  5395. combinators = Object.keys(combinators).sort(function(a, b) {
  5396. return COMBINATOR_PRECEDENCE[a] - COMBINATOR_PRECEDENCE[b];
  5397. });
  5398. while (combinators.length > 0) {
  5399. var combinator = combinators.shift();
  5400. for (var i = 0, subgroupStart = 0; i < terms.length; i++) {
  5401. var term = terms[i];
  5402. if (term.type === 'Combinator') {
  5403. if (term.value === combinator) {
  5404. if (subgroupStart === -1) {
  5405. subgroupStart = i - 1;
  5406. }
  5407. terms.splice(i, 1);
  5408. i--;
  5409. } else {
  5410. if (subgroupStart !== -1 && i - subgroupStart > 1) {
  5411. terms.splice(
  5412. subgroupStart,
  5413. i - subgroupStart,
  5414. createGroup(terms.slice(subgroupStart, i), combinator)
  5415. );
  5416. i = subgroupStart + 1;
  5417. }
  5418. subgroupStart = -1;
  5419. }
  5420. }
  5421. }
  5422. if (subgroupStart !== -1 && combinators.length) {
  5423. terms.splice(
  5424. subgroupStart,
  5425. i - subgroupStart,
  5426. createGroup(terms.slice(subgroupStart, i), combinator)
  5427. );
  5428. }
  5429. }
  5430. return combinator;
  5431. }
  5432. function readImplicitGroup(tokenizer) {
  5433. var terms = [];
  5434. var combinators = {};
  5435. var token;
  5436. var prevToken = null;
  5437. var prevTokenPos = tokenizer.pos;
  5438. while (token = peek(tokenizer)) {
  5439. if (token.type !== 'Spaces') {
  5440. if (token.type === 'Combinator') {
  5441. // check for combinator in group beginning and double combinator sequence
  5442. if (prevToken === null || prevToken.type === 'Combinator') {
  5443. tokenizer.pos = prevTokenPos;
  5444. tokenizer.error('Unexpected combinator');
  5445. }
  5446. combinators[token.value] = true;
  5447. } else if (prevToken !== null && prevToken.type !== 'Combinator') {
  5448. combinators[' '] = true; // a b
  5449. terms.push({
  5450. type: 'Combinator',
  5451. value: ' '
  5452. });
  5453. }
  5454. terms.push(token);
  5455. prevToken = token;
  5456. prevTokenPos = tokenizer.pos;
  5457. }
  5458. }
  5459. // check for combinator in group ending
  5460. if (prevToken !== null && prevToken.type === 'Combinator') {
  5461. tokenizer.pos -= prevTokenPos;
  5462. tokenizer.error('Unexpected combinator');
  5463. }
  5464. return {
  5465. type: 'Group',
  5466. terms: terms,
  5467. combinator: regroupTerms(terms, combinators) || ' ',
  5468. disallowEmpty: false,
  5469. explicit: false
  5470. };
  5471. }
  5472. function readGroup(tokenizer) {
  5473. var result;
  5474. tokenizer.eat(LEFTSQUAREBRACKET);
  5475. result = readImplicitGroup(tokenizer);
  5476. tokenizer.eat(RIGHTSQUAREBRACKET);
  5477. result.explicit = true;
  5478. if (tokenizer.charCode() === EXCLAMATIONMARK) {
  5479. tokenizer.pos++;
  5480. result.disallowEmpty = true;
  5481. }
  5482. return result;
  5483. }
  5484. function peek(tokenizer) {
  5485. var code = tokenizer.charCode();
  5486. if (code < 128 && NAME_CHAR[code] === 1) {
  5487. return readKeywordOrFunction(tokenizer);
  5488. }
  5489. switch (code) {
  5490. case RIGHTSQUAREBRACKET:
  5491. // don't eat, stop scan a group
  5492. break;
  5493. case LEFTSQUAREBRACKET:
  5494. return maybeMultiplied(tokenizer, readGroup(tokenizer));
  5495. case LESSTHANSIGN:
  5496. return tokenizer.nextCharCode() === APOSTROPHE
  5497. ? readProperty(tokenizer)
  5498. : readType(tokenizer);
  5499. case VERTICALLINE:
  5500. return {
  5501. type: 'Combinator',
  5502. value: tokenizer.substringToPos(
  5503. tokenizer.nextCharCode() === VERTICALLINE
  5504. ? tokenizer.pos + 2
  5505. : tokenizer.pos + 1
  5506. )
  5507. };
  5508. case AMPERSAND:
  5509. tokenizer.pos++;
  5510. tokenizer.eat(AMPERSAND);
  5511. return {
  5512. type: 'Combinator',
  5513. value: '&&'
  5514. };
  5515. case COMMA:
  5516. tokenizer.pos++;
  5517. return {
  5518. type: 'Comma'
  5519. };
  5520. case APOSTROPHE:
  5521. return maybeMultiplied(tokenizer, {
  5522. type: 'String',
  5523. value: scanString(tokenizer)
  5524. });
  5525. case SPACE$1:
  5526. case TAB$1:
  5527. case N$2:
  5528. case R$1:
  5529. case F$1:
  5530. return {
  5531. type: 'Spaces',
  5532. value: scanSpaces(tokenizer)
  5533. };
  5534. case COMMERCIALAT:
  5535. code = tokenizer.nextCharCode();
  5536. if (code < 128 && NAME_CHAR[code] === 1) {
  5537. tokenizer.pos++;
  5538. return {
  5539. type: 'AtKeyword',
  5540. name: scanWord(tokenizer)
  5541. };
  5542. }
  5543. return maybeToken(tokenizer);
  5544. case ASTERISK:
  5545. case PLUSSIGN$2:
  5546. case QUESTIONMARK$1:
  5547. case NUMBERSIGN:
  5548. case EXCLAMATIONMARK:
  5549. // prohibited tokens (used as a multiplier start)
  5550. break;
  5551. case LEFTCURLYBRACKET:
  5552. // LEFTCURLYBRACKET is allowed since mdn/data uses it w/o quoting
  5553. // check next char isn't a number, because it's likely a disjoined multiplier
  5554. code = tokenizer.nextCharCode();
  5555. if (code < 48 || code > 57) {
  5556. return maybeToken(tokenizer);
  5557. }
  5558. break;
  5559. default:
  5560. return maybeToken(tokenizer);
  5561. }
  5562. }
  5563. function parse(source) {
  5564. var tokenizer = new tokenizer$1(source);
  5565. var result = readImplicitGroup(tokenizer);
  5566. if (tokenizer.pos !== source.length) {
  5567. tokenizer.error('Unexpected input');
  5568. }
  5569. // reduce redundant groups with single group term
  5570. if (result.terms.length === 1 && result.terms[0].type === 'Group') {
  5571. result = result.terms[0];
  5572. }
  5573. return result;
  5574. }
  5575. // warm up parse to elimitate code branches that never execute
  5576. // fix soft deoptimizations (insufficient type feedback)
  5577. parse('[a&&<b>#|<\'c\'>*||e() f{2} /,(% g#{1,2} h{2,})]!');
  5578. var parse_1 = parse;
  5579. var noop$2 = function() {};
  5580. function ensureFunction(value) {
  5581. return typeof value === 'function' ? value : noop$2;
  5582. }
  5583. var walk$1 = function(node, options, context) {
  5584. function walk(node) {
  5585. enter.call(context, node);
  5586. switch (node.type) {
  5587. case 'Group':
  5588. node.terms.forEach(walk);
  5589. break;
  5590. case 'Multiplier':
  5591. walk(node.term);
  5592. break;
  5593. case 'Type':
  5594. case 'Property':
  5595. case 'Keyword':
  5596. case 'AtKeyword':
  5597. case 'Function':
  5598. case 'String':
  5599. case 'Token':
  5600. case 'Comma':
  5601. break;
  5602. default:
  5603. throw new Error('Unknown type: ' + node.type);
  5604. }
  5605. leave.call(context, node);
  5606. }
  5607. var enter = noop$2;
  5608. var leave = noop$2;
  5609. if (typeof options === 'function') {
  5610. enter = options;
  5611. } else if (options) {
  5612. enter = ensureFunction(options.enter);
  5613. leave = ensureFunction(options.leave);
  5614. }
  5615. if (enter === noop$2 && leave === noop$2) {
  5616. throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function');
  5617. }
  5618. walk(node);
  5619. };
  5620. var tokenStream = new TokenStream_1();
  5621. var astToTokens = {
  5622. decorator: function(handlers) {
  5623. var curNode = null;
  5624. var prev = { len: 0, node: null };
  5625. var nodes = [prev];
  5626. var buffer = '';
  5627. return {
  5628. children: handlers.children,
  5629. node: function(node) {
  5630. var tmp = curNode;
  5631. curNode = node;
  5632. handlers.node.call(this, node);
  5633. curNode = tmp;
  5634. },
  5635. chunk: function(chunk) {
  5636. buffer += chunk;
  5637. if (prev.node !== curNode) {
  5638. nodes.push({
  5639. len: chunk.length,
  5640. node: curNode
  5641. });
  5642. } else {
  5643. prev.len += chunk.length;
  5644. }
  5645. },
  5646. result: function() {
  5647. return prepareTokens(buffer, nodes);
  5648. }
  5649. };
  5650. }
  5651. };
  5652. function prepareTokens(str, nodes) {
  5653. var tokens = [];
  5654. var nodesOffset = 0;
  5655. var nodesIndex = 0;
  5656. var currentNode = nodes ? nodes[nodesIndex].node : null;
  5657. tokenizer(str, tokenStream);
  5658. while (!tokenStream.eof) {
  5659. if (nodes) {
  5660. while (nodesIndex < nodes.length && nodesOffset + nodes[nodesIndex].len <= tokenStream.tokenStart) {
  5661. nodesOffset += nodes[nodesIndex++].len;
  5662. currentNode = nodes[nodesIndex].node;
  5663. }
  5664. }
  5665. tokens.push({
  5666. type: tokenStream.tokenType,
  5667. value: tokenStream.getTokenValue(),
  5668. index: tokenStream.tokenIndex, // TODO: remove it, temporary solution
  5669. balance: tokenStream.balance[tokenStream.tokenIndex], // TODO: remove it, temporary solution
  5670. node: currentNode
  5671. });
  5672. tokenStream.next();
  5673. // console.log({ ...tokens[tokens.length - 1], node: undefined });
  5674. }
  5675. return tokens;
  5676. }
  5677. var prepareTokens_1 = function(value, syntax) {
  5678. if (typeof value === 'string') {
  5679. return prepareTokens(value, null);
  5680. }
  5681. return syntax.generate(value, astToTokens);
  5682. };
  5683. var MATCH = { type: 'Match' };
  5684. var MISMATCH = { type: 'Mismatch' };
  5685. var DISALLOW_EMPTY = { type: 'DisallowEmpty' };
  5686. var LEFTPARENTHESIS$1 = 40; // (
  5687. var RIGHTPARENTHESIS$1 = 41; // )
  5688. function createCondition(match, thenBranch, elseBranch) {
  5689. // reduce node count
  5690. if (thenBranch === MATCH && elseBranch === MISMATCH) {
  5691. return match;
  5692. }
  5693. if (match === MATCH && thenBranch === MATCH && elseBranch === MATCH) {
  5694. return match;
  5695. }
  5696. if (match.type === 'If' && match.else === MISMATCH && thenBranch === MATCH) {
  5697. thenBranch = match.then;
  5698. match = match.match;
  5699. }
  5700. return {
  5701. type: 'If',
  5702. match: match,
  5703. then: thenBranch,
  5704. else: elseBranch
  5705. };
  5706. }
  5707. function isFunctionType(name) {
  5708. return (
  5709. name.length > 2 &&
  5710. name.charCodeAt(name.length - 2) === LEFTPARENTHESIS$1 &&
  5711. name.charCodeAt(name.length - 1) === RIGHTPARENTHESIS$1
  5712. );
  5713. }
  5714. function isEnumCapatible(term) {
  5715. return (
  5716. term.type === 'Keyword' ||
  5717. term.type === 'AtKeyword' ||
  5718. term.type === 'Function' ||
  5719. term.type === 'Type' && isFunctionType(term.name)
  5720. );
  5721. }
  5722. function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
  5723. switch (combinator) {
  5724. case ' ':
  5725. // Juxtaposing components means that all of them must occur, in the given order.
  5726. //
  5727. // a b c
  5728. // =
  5729. // match a
  5730. // then match b
  5731. // then match c
  5732. // then MATCH
  5733. // else MISMATCH
  5734. // else MISMATCH
  5735. // else MISMATCH
  5736. var result = MATCH;
  5737. for (var i = terms.length - 1; i >= 0; i--) {
  5738. var term = terms[i];
  5739. result = createCondition(
  5740. term,
  5741. result,
  5742. MISMATCH
  5743. );
  5744. }
  5745. return result;
  5746. case '|':
  5747. // A bar (|) separates two or more alternatives: exactly one of them must occur.
  5748. //
  5749. // a | b | c
  5750. // =
  5751. // match a
  5752. // then MATCH
  5753. // else match b
  5754. // then MATCH
  5755. // else match c
  5756. // then MATCH
  5757. // else MISMATCH
  5758. var result = MISMATCH;
  5759. var map = null;
  5760. for (var i = terms.length - 1; i >= 0; i--) {
  5761. var term = terms[i];
  5762. // reduce sequence of keywords into a Enum
  5763. if (isEnumCapatible(term)) {
  5764. if (map === null && i > 0 && isEnumCapatible(terms[i - 1])) {
  5765. map = Object.create(null);
  5766. result = createCondition(
  5767. {
  5768. type: 'Enum',
  5769. map: map
  5770. },
  5771. MATCH,
  5772. result
  5773. );
  5774. }
  5775. if (map !== null) {
  5776. var key = (isFunctionType(term.name) ? term.name.slice(0, -1) : term.name).toLowerCase();
  5777. if (key in map === false) {
  5778. map[key] = term;
  5779. continue;
  5780. }
  5781. }
  5782. }
  5783. map = null;
  5784. // create a new conditonal node
  5785. result = createCondition(
  5786. term,
  5787. MATCH,
  5788. result
  5789. );
  5790. }
  5791. return result;
  5792. case '&&':
  5793. // A double ampersand (&&) separates two or more components,
  5794. // all of which must occur, in any order.
  5795. // Use MatchOnce for groups with a large number of terms,
  5796. // since &&-groups produces at least N!-node trees
  5797. if (terms.length > 5) {
  5798. return {
  5799. type: 'MatchOnce',
  5800. terms: terms,
  5801. all: true
  5802. };
  5803. }
  5804. // Use a combination tree for groups with small number of terms
  5805. //
  5806. // a && b && c
  5807. // =
  5808. // match a
  5809. // then [b && c]
  5810. // else match b
  5811. // then [a && c]
  5812. // else match c
  5813. // then [a && b]
  5814. // else MISMATCH
  5815. //
  5816. // a && b
  5817. // =
  5818. // match a
  5819. // then match b
  5820. // then MATCH
  5821. // else MISMATCH
  5822. // else match b
  5823. // then match a
  5824. // then MATCH
  5825. // else MISMATCH
  5826. // else MISMATCH
  5827. var result = MISMATCH;
  5828. for (var i = terms.length - 1; i >= 0; i--) {
  5829. var term = terms[i];
  5830. var thenClause;
  5831. if (terms.length > 1) {
  5832. thenClause = buildGroupMatchGraph(
  5833. combinator,
  5834. terms.filter(function(newGroupTerm) {
  5835. return newGroupTerm !== term;
  5836. }),
  5837. false
  5838. );
  5839. } else {
  5840. thenClause = MATCH;
  5841. }
  5842. result = createCondition(
  5843. term,
  5844. thenClause,
  5845. result
  5846. );
  5847. }
  5848. return result;
  5849. case '||':
  5850. // A double bar (||) separates two or more options:
  5851. // one or more of them must occur, in any order.
  5852. // Use MatchOnce for groups with a large number of terms,
  5853. // since ||-groups produces at least N!-node trees
  5854. if (terms.length > 5) {
  5855. return {
  5856. type: 'MatchOnce',
  5857. terms: terms,
  5858. all: false
  5859. };
  5860. }
  5861. // Use a combination tree for groups with small number of terms
  5862. //
  5863. // a || b || c
  5864. // =
  5865. // match a
  5866. // then [b || c]
  5867. // else match b
  5868. // then [a || c]
  5869. // else match c
  5870. // then [a || b]
  5871. // else MISMATCH
  5872. //
  5873. // a || b
  5874. // =
  5875. // match a
  5876. // then match b
  5877. // then MATCH
  5878. // else MATCH
  5879. // else match b
  5880. // then match a
  5881. // then MATCH
  5882. // else MATCH
  5883. // else MISMATCH
  5884. var result = atLeastOneTermMatched ? MATCH : MISMATCH;
  5885. for (var i = terms.length - 1; i >= 0; i--) {
  5886. var term = terms[i];
  5887. var thenClause;
  5888. if (terms.length > 1) {
  5889. thenClause = buildGroupMatchGraph(
  5890. combinator,
  5891. terms.filter(function(newGroupTerm) {
  5892. return newGroupTerm !== term;
  5893. }),
  5894. true
  5895. );
  5896. } else {
  5897. thenClause = MATCH;
  5898. }
  5899. result = createCondition(
  5900. term,
  5901. thenClause,
  5902. result
  5903. );
  5904. }
  5905. return result;
  5906. }
  5907. }
  5908. function buildMultiplierMatchGraph(node) {
  5909. var result = MATCH;
  5910. var matchTerm = buildMatchGraph(node.term);
  5911. if (node.max === 0) {
  5912. // disable repeating of empty match to prevent infinite loop
  5913. matchTerm = createCondition(
  5914. matchTerm,
  5915. DISALLOW_EMPTY,
  5916. MISMATCH
  5917. );
  5918. // an occurrence count is not limited, make a cycle;
  5919. // to collect more terms on each following matching mismatch
  5920. result = createCondition(
  5921. matchTerm,
  5922. null, // will be a loop
  5923. MISMATCH
  5924. );
  5925. result.then = createCondition(
  5926. MATCH,
  5927. MATCH,
  5928. result // make a loop
  5929. );
  5930. if (node.comma) {
  5931. result.then.else = createCondition(
  5932. { type: 'Comma', syntax: node },
  5933. result,
  5934. MISMATCH
  5935. );
  5936. }
  5937. } else {
  5938. // create a match node chain for [min .. max] interval with optional matches
  5939. for (var i = node.min || 1; i <= node.max; i++) {
  5940. if (node.comma && result !== MATCH) {
  5941. result = createCondition(
  5942. { type: 'Comma', syntax: node },
  5943. result,
  5944. MISMATCH
  5945. );
  5946. }
  5947. result = createCondition(
  5948. matchTerm,
  5949. createCondition(
  5950. MATCH,
  5951. MATCH,
  5952. result
  5953. ),
  5954. MISMATCH
  5955. );
  5956. }
  5957. }
  5958. if (node.min === 0) {
  5959. // allow zero match
  5960. result = createCondition(
  5961. MATCH,
  5962. MATCH,
  5963. result
  5964. );
  5965. } else {
  5966. // create a match node chain to collect [0 ... min - 1] required matches
  5967. for (var i = 0; i < node.min - 1; i++) {
  5968. if (node.comma && result !== MATCH) {
  5969. result = createCondition(
  5970. { type: 'Comma', syntax: node },
  5971. result,
  5972. MISMATCH
  5973. );
  5974. }
  5975. result = createCondition(
  5976. matchTerm,
  5977. result,
  5978. MISMATCH
  5979. );
  5980. }
  5981. }
  5982. return result;
  5983. }
  5984. function buildMatchGraph(node) {
  5985. if (typeof node === 'function') {
  5986. return {
  5987. type: 'Generic',
  5988. fn: node
  5989. };
  5990. }
  5991. switch (node.type) {
  5992. case 'Group':
  5993. var result = buildGroupMatchGraph(
  5994. node.combinator,
  5995. node.terms.map(buildMatchGraph),
  5996. false
  5997. );
  5998. if (node.disallowEmpty) {
  5999. result = createCondition(
  6000. result,
  6001. DISALLOW_EMPTY,
  6002. MISMATCH
  6003. );
  6004. }
  6005. return result;
  6006. case 'Multiplier':
  6007. return buildMultiplierMatchGraph(node);
  6008. case 'Type':
  6009. case 'Property':
  6010. return {
  6011. type: node.type,
  6012. name: node.name,
  6013. syntax: node
  6014. };
  6015. case 'Keyword':
  6016. return {
  6017. type: node.type,
  6018. name: node.name.toLowerCase(),
  6019. syntax: node
  6020. };
  6021. case 'AtKeyword':
  6022. return {
  6023. type: node.type,
  6024. name: '@' + node.name.toLowerCase(),
  6025. syntax: node
  6026. };
  6027. case 'Function':
  6028. return {
  6029. type: node.type,
  6030. name: node.name.toLowerCase() + '(',
  6031. syntax: node
  6032. };
  6033. case 'String':
  6034. // convert a one char length String to a Token
  6035. if (node.value.length === 3) {
  6036. return {
  6037. type: 'Token',
  6038. value: node.value.charAt(1),
  6039. syntax: node
  6040. };
  6041. }
  6042. // otherwise use it as is
  6043. return {
  6044. type: node.type,
  6045. value: node.value.substr(1, node.value.length - 2).replace(/\\'/g, '\''),
  6046. syntax: node
  6047. };
  6048. case 'Token':
  6049. return {
  6050. type: node.type,
  6051. value: node.value,
  6052. syntax: node
  6053. };
  6054. case 'Comma':
  6055. return {
  6056. type: node.type,
  6057. syntax: node
  6058. };
  6059. default:
  6060. throw new Error('Unknown node type:', node.type);
  6061. }
  6062. }
  6063. var matchGraph = {
  6064. MATCH: MATCH,
  6065. MISMATCH: MISMATCH,
  6066. DISALLOW_EMPTY: DISALLOW_EMPTY,
  6067. buildMatchGraph: function(syntaxTree, ref) {
  6068. if (typeof syntaxTree === 'string') {
  6069. syntaxTree = parse_1(syntaxTree);
  6070. }
  6071. return {
  6072. type: 'MatchGraph',
  6073. match: buildMatchGraph(syntaxTree),
  6074. syntax: ref || null,
  6075. source: syntaxTree
  6076. };
  6077. }
  6078. };
  6079. var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  6080. var MATCH$1 = matchGraph.MATCH;
  6081. var MISMATCH$1 = matchGraph.MISMATCH;
  6082. var DISALLOW_EMPTY$1 = matchGraph.DISALLOW_EMPTY;
  6083. var TYPE$6 = _const.TYPE;
  6084. var STUB = 0;
  6085. var TOKEN = 1;
  6086. var OPEN_SYNTAX = 2;
  6087. var CLOSE_SYNTAX = 3;
  6088. var EXIT_REASON_MATCH = 'Match';
  6089. var EXIT_REASON_MISMATCH = 'Mismatch';
  6090. var EXIT_REASON_ITERATION_LIMIT = 'Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)';
  6091. var ITERATION_LIMIT = 15000;
  6092. var totalIterationCount = 0;
  6093. function reverseList(list) {
  6094. var prev = null;
  6095. var next = null;
  6096. var item = list;
  6097. while (item !== null) {
  6098. next = item.prev;
  6099. item.prev = prev;
  6100. prev = item;
  6101. item = next;
  6102. }
  6103. return prev;
  6104. }
  6105. function areStringsEqualCaseInsensitive(testStr, referenceStr) {
  6106. if (testStr.length !== referenceStr.length) {
  6107. return false;
  6108. }
  6109. for (var i = 0; i < testStr.length; i++) {
  6110. var testCode = testStr.charCodeAt(i);
  6111. var referenceCode = referenceStr.charCodeAt(i);
  6112. // testCode.toLowerCase() for U+0041 LATIN CAPITAL LETTER A (A) .. U+005A LATIN CAPITAL LETTER Z (Z).
  6113. if (testCode >= 0x0041 && testCode <= 0x005A) {
  6114. testCode = testCode | 32;
  6115. }
  6116. if (testCode !== referenceCode) {
  6117. return false;
  6118. }
  6119. }
  6120. return true;
  6121. }
  6122. function isCommaContextStart(token) {
  6123. if (token === null) {
  6124. return true;
  6125. }
  6126. return (
  6127. token.type === TYPE$6.Comma ||
  6128. token.type === TYPE$6.Function ||
  6129. token.type === TYPE$6.LeftParenthesis ||
  6130. token.type === TYPE$6.LeftSquareBracket ||
  6131. token.type === TYPE$6.LeftCurlyBracket ||
  6132. token.type === TYPE$6.Delim
  6133. );
  6134. }
  6135. function isCommaContextEnd(token) {
  6136. if (token === null) {
  6137. return true;
  6138. }
  6139. return (
  6140. token.type === TYPE$6.RightParenthesis ||
  6141. token.type === TYPE$6.RightSquareBracket ||
  6142. token.type === TYPE$6.RightCurlyBracket ||
  6143. token.type === TYPE$6.Delim
  6144. );
  6145. }
  6146. function internalMatch(tokens, state, syntaxes) {
  6147. function moveToNextToken() {
  6148. do {
  6149. tokenIndex++;
  6150. token = tokenIndex < tokens.length ? tokens[tokenIndex] : null;
  6151. } while (token !== null && (token.type === TYPE$6.WhiteSpace || token.type === TYPE$6.Comment));
  6152. }
  6153. function getNextToken(offset) {
  6154. var nextIndex = tokenIndex + offset;
  6155. return nextIndex < tokens.length ? tokens[nextIndex] : null;
  6156. }
  6157. function stateSnapshotFromSyntax(nextState, prev) {
  6158. return {
  6159. nextState: nextState,
  6160. matchStack: matchStack,
  6161. syntaxStack: syntaxStack,
  6162. thenStack: thenStack,
  6163. tokenIndex: tokenIndex,
  6164. prev: prev
  6165. };
  6166. }
  6167. function pushThenStack(nextState) {
  6168. thenStack = {
  6169. nextState: nextState,
  6170. matchStack: matchStack,
  6171. syntaxStack: syntaxStack,
  6172. prev: thenStack
  6173. };
  6174. }
  6175. function pushElseStack(nextState) {
  6176. elseStack = stateSnapshotFromSyntax(nextState, elseStack);
  6177. }
  6178. function addTokenToMatch() {
  6179. matchStack = {
  6180. type: TOKEN,
  6181. syntax: state.syntax,
  6182. token: token,
  6183. prev: matchStack
  6184. };
  6185. moveToNextToken();
  6186. syntaxStash = null;
  6187. if (tokenIndex > longestMatch) {
  6188. longestMatch = tokenIndex;
  6189. }
  6190. }
  6191. function openSyntax() {
  6192. syntaxStack = {
  6193. syntax: state.syntax,
  6194. opts: state.syntax.opts || (syntaxStack !== null && syntaxStack.opts) || null,
  6195. prev: syntaxStack
  6196. };
  6197. matchStack = {
  6198. type: OPEN_SYNTAX,
  6199. syntax: state.syntax,
  6200. token: matchStack.token,
  6201. prev: matchStack
  6202. };
  6203. }
  6204. function closeSyntax() {
  6205. if (matchStack.type === OPEN_SYNTAX) {
  6206. matchStack = matchStack.prev;
  6207. } else {
  6208. matchStack = {
  6209. type: CLOSE_SYNTAX,
  6210. syntax: syntaxStack.syntax,
  6211. token: matchStack.token,
  6212. prev: matchStack
  6213. };
  6214. }
  6215. syntaxStack = syntaxStack.prev;
  6216. }
  6217. var syntaxStack = null;
  6218. var thenStack = null;
  6219. var elseStack = null;
  6220. // null – stashing allowed, nothing stashed
  6221. // false – stashing disabled, nothing stashed
  6222. // anithing else – fail stashable syntaxes, some syntax stashed
  6223. var syntaxStash = null;
  6224. var iterationCount = 0; // count iterations and prevent infinite loop
  6225. var exitReason = null;
  6226. var token = null;
  6227. var tokenIndex = -1;
  6228. var longestMatch = 0;
  6229. var matchStack = {
  6230. type: STUB,
  6231. syntax: null,
  6232. token: null,
  6233. prev: null
  6234. };
  6235. moveToNextToken();
  6236. while (exitReason === null && ++iterationCount < ITERATION_LIMIT) {
  6237. // function mapList(list, fn) {
  6238. // var result = [];
  6239. // while (list) {
  6240. // result.unshift(fn(list));
  6241. // list = list.prev;
  6242. // }
  6243. // return result;
  6244. // }
  6245. // console.log('--\n',
  6246. // '#' + iterationCount,
  6247. // require('util').inspect({
  6248. // match: mapList(matchStack, x => x.type === TOKEN ? x.token && x.token.value : x.syntax ? ({ [OPEN_SYNTAX]: '<', [CLOSE_SYNTAX]: '</' }[x.type] || x.type) + '!' + x.syntax.name : null),
  6249. // token: token && token.value,
  6250. // tokenIndex,
  6251. // syntax: syntax.type + (syntax.id ? ' #' + syntax.id : '')
  6252. // }, { depth: null })
  6253. // );
  6254. switch (state.type) {
  6255. case 'Match':
  6256. if (thenStack === null) {
  6257. // turn to MISMATCH when some tokens left unmatched
  6258. if (token !== null) {
  6259. // doesn't mismatch if just one token left and it's an IE hack
  6260. if (tokenIndex !== tokens.length - 1 || (token.value !== '\\0' && token.value !== '\\9')) {
  6261. state = MISMATCH$1;
  6262. break;
  6263. }
  6264. }
  6265. // break the main loop, return a result - MATCH
  6266. exitReason = EXIT_REASON_MATCH;
  6267. break;
  6268. }
  6269. // go to next syntax (`then` branch)
  6270. state = thenStack.nextState;
  6271. // check match is not empty
  6272. if (state === DISALLOW_EMPTY$1) {
  6273. if (thenStack.matchStack === matchStack) {
  6274. state = MISMATCH$1;
  6275. break;
  6276. } else {
  6277. state = MATCH$1;
  6278. }
  6279. }
  6280. // close syntax if needed
  6281. while (thenStack.syntaxStack !== syntaxStack) {
  6282. closeSyntax();
  6283. }
  6284. // pop stack
  6285. thenStack = thenStack.prev;
  6286. break;
  6287. case 'Mismatch':
  6288. // when some syntax is stashed
  6289. if (syntaxStash !== null && syntaxStash !== false) {
  6290. // there is no else branches or a branch reduce match stack
  6291. if (elseStack === null || tokenIndex > elseStack.tokenIndex) {
  6292. // restore state from the stash
  6293. elseStack = syntaxStash;
  6294. syntaxStash = false; // disable stashing
  6295. }
  6296. } else if (elseStack === null) {
  6297. // no else branches -> break the main loop
  6298. // return a result - MISMATCH
  6299. exitReason = EXIT_REASON_MISMATCH;
  6300. break;
  6301. }
  6302. // go to next syntax (`else` branch)
  6303. state = elseStack.nextState;
  6304. // restore all the rest stack states
  6305. thenStack = elseStack.thenStack;
  6306. syntaxStack = elseStack.syntaxStack;
  6307. matchStack = elseStack.matchStack;
  6308. tokenIndex = elseStack.tokenIndex;
  6309. token = tokenIndex < tokens.length ? tokens[tokenIndex] : null;
  6310. // pop stack
  6311. elseStack = elseStack.prev;
  6312. break;
  6313. case 'MatchGraph':
  6314. state = state.match;
  6315. break;
  6316. case 'If':
  6317. // IMPORTANT: else stack push must go first,
  6318. // since it stores the state of thenStack before changes
  6319. if (state.else !== MISMATCH$1) {
  6320. pushElseStack(state.else);
  6321. }
  6322. if (state.then !== MATCH$1) {
  6323. pushThenStack(state.then);
  6324. }
  6325. state = state.match;
  6326. break;
  6327. case 'MatchOnce':
  6328. state = {
  6329. type: 'MatchOnceBuffer',
  6330. syntax: state,
  6331. index: 0,
  6332. mask: 0
  6333. };
  6334. break;
  6335. case 'MatchOnceBuffer':
  6336. var terms = state.syntax.terms;
  6337. if (state.index === terms.length) {
  6338. // no matches at all or it's required all terms to be matched
  6339. if (state.mask === 0 || state.syntax.all) {
  6340. state = MISMATCH$1;
  6341. break;
  6342. }
  6343. // a partial match is ok
  6344. state = MATCH$1;
  6345. break;
  6346. }
  6347. // all terms are matched
  6348. if (state.mask === (1 << terms.length) - 1) {
  6349. state = MATCH$1;
  6350. break;
  6351. }
  6352. for (; state.index < terms.length; state.index++) {
  6353. var matchFlag = 1 << state.index;
  6354. if ((state.mask & matchFlag) === 0) {
  6355. // IMPORTANT: else stack push must go first,
  6356. // since it stores the state of thenStack before changes
  6357. pushElseStack(state);
  6358. pushThenStack({
  6359. type: 'AddMatchOnce',
  6360. syntax: state.syntax,
  6361. mask: state.mask | matchFlag
  6362. });
  6363. // match
  6364. state = terms[state.index++];
  6365. break;
  6366. }
  6367. }
  6368. break;
  6369. case 'AddMatchOnce':
  6370. state = {
  6371. type: 'MatchOnceBuffer',
  6372. syntax: state.syntax,
  6373. index: 0,
  6374. mask: state.mask
  6375. };
  6376. break;
  6377. case 'Enum':
  6378. if (token !== null) {
  6379. var name = token.value.toLowerCase();
  6380. // drop \0 and \9 hack from keyword name
  6381. if (name.indexOf('\\') !== -1) {
  6382. name = name.replace(/\\[09].*$/, '');
  6383. }
  6384. if (hasOwnProperty$1.call(state.map, name)) {
  6385. state = state.map[name];
  6386. break;
  6387. }
  6388. }
  6389. state = MISMATCH$1;
  6390. break;
  6391. case 'Generic':
  6392. var opts = syntaxStack !== null ? syntaxStack.opts : null;
  6393. var lastTokenIndex = tokenIndex + Math.floor(state.fn(token, getNextToken, opts));
  6394. if (!isNaN(lastTokenIndex) && lastTokenIndex > tokenIndex) {
  6395. while (tokenIndex < lastTokenIndex) {
  6396. addTokenToMatch();
  6397. }
  6398. state = MATCH$1;
  6399. } else {
  6400. state = MISMATCH$1;
  6401. }
  6402. break;
  6403. case 'Type':
  6404. case 'Property':
  6405. var syntaxDict = state.type === 'Type' ? 'types' : 'properties';
  6406. var dictSyntax = hasOwnProperty$1.call(syntaxes, syntaxDict) ? syntaxes[syntaxDict][state.name] : null;
  6407. if (!dictSyntax || !dictSyntax.match) {
  6408. throw new Error(
  6409. 'Bad syntax reference: ' +
  6410. (state.type === 'Type'
  6411. ? '<' + state.name + '>'
  6412. : '<\'' + state.name + '\'>')
  6413. );
  6414. }
  6415. // stash a syntax for types with low priority
  6416. if (syntaxStash !== false && token !== null && state.type === 'Type') {
  6417. var lowPriorityMatching =
  6418. // https://drafts.csswg.org/css-values-4/#custom-idents
  6419. // When parsing positionally-ambiguous keywords in a property value, a <custom-ident> production
  6420. // can only claim the keyword if no other unfulfilled production can claim it.
  6421. (state.name === 'custom-ident' && token.type === TYPE$6.Ident) ||
  6422. // https://drafts.csswg.org/css-values-4/#lengths
  6423. // ... if a `0` could be parsed as either a <number> or a <length> in a property (such as line-height),
  6424. // it must parse as a <number>
  6425. (state.name === 'length' && token.value === '0');
  6426. if (lowPriorityMatching) {
  6427. if (syntaxStash === null) {
  6428. syntaxStash = stateSnapshotFromSyntax(state, elseStack);
  6429. }
  6430. state = MISMATCH$1;
  6431. break;
  6432. }
  6433. }
  6434. openSyntax();
  6435. state = dictSyntax.match;
  6436. break;
  6437. case 'Keyword':
  6438. var name = state.name;
  6439. if (token !== null) {
  6440. var keywordName = token.value;
  6441. // drop \0 and \9 hack from keyword name
  6442. if (keywordName.indexOf('\\') !== -1) {
  6443. keywordName = keywordName.replace(/\\[09].*$/, '');
  6444. }
  6445. if (areStringsEqualCaseInsensitive(keywordName, name)) {
  6446. addTokenToMatch();
  6447. state = MATCH$1;
  6448. break;
  6449. }
  6450. }
  6451. state = MISMATCH$1;
  6452. break;
  6453. case 'AtKeyword':
  6454. case 'Function':
  6455. if (token !== null && areStringsEqualCaseInsensitive(token.value, state.name)) {
  6456. addTokenToMatch();
  6457. state = MATCH$1;
  6458. break;
  6459. }
  6460. state = MISMATCH$1;
  6461. break;
  6462. case 'Token':
  6463. if (token !== null && token.value === state.value) {
  6464. addTokenToMatch();
  6465. state = MATCH$1;
  6466. break;
  6467. }
  6468. state = MISMATCH$1;
  6469. break;
  6470. case 'Comma':
  6471. if (token !== null && token.type === TYPE$6.Comma) {
  6472. if (isCommaContextStart(matchStack.token)) {
  6473. state = MISMATCH$1;
  6474. } else {
  6475. addTokenToMatch();
  6476. state = isCommaContextEnd(token) ? MISMATCH$1 : MATCH$1;
  6477. }
  6478. } else {
  6479. state = isCommaContextStart(matchStack.token) || isCommaContextEnd(token) ? MATCH$1 : MISMATCH$1;
  6480. }
  6481. break;
  6482. case 'String':
  6483. var string = '';
  6484. for (var lastTokenIndex = tokenIndex; lastTokenIndex < tokens.length && string.length < state.value.length; lastTokenIndex++) {
  6485. string += tokens[lastTokenIndex].value;
  6486. }
  6487. if (areStringsEqualCaseInsensitive(string, state.value)) {
  6488. while (tokenIndex < lastTokenIndex) {
  6489. addTokenToMatch();
  6490. }
  6491. state = MATCH$1;
  6492. } else {
  6493. state = MISMATCH$1;
  6494. }
  6495. break;
  6496. default:
  6497. throw new Error('Unknown node type: ' + state.type);
  6498. }
  6499. }
  6500. totalIterationCount += iterationCount;
  6501. switch (exitReason) {
  6502. case null:
  6503. console.warn('[csstree-match] BREAK after ' + ITERATION_LIMIT + ' iterations');
  6504. exitReason = EXIT_REASON_ITERATION_LIMIT;
  6505. matchStack = null;
  6506. break;
  6507. case EXIT_REASON_MATCH:
  6508. while (syntaxStack !== null) {
  6509. closeSyntax();
  6510. }
  6511. break;
  6512. default:
  6513. matchStack = null;
  6514. }
  6515. return {
  6516. tokens: tokens,
  6517. reason: exitReason,
  6518. iterations: iterationCount,
  6519. match: matchStack,
  6520. longestMatch: longestMatch
  6521. };
  6522. }
  6523. function matchAsList(tokens, matchGraph, syntaxes) {
  6524. var matchResult = internalMatch(tokens, matchGraph, syntaxes || {});
  6525. if (matchResult.match !== null) {
  6526. var item = reverseList(matchResult.match).prev;
  6527. matchResult.match = [];
  6528. while (item !== null) {
  6529. switch (item.type) {
  6530. case STUB:
  6531. break;
  6532. case OPEN_SYNTAX:
  6533. case CLOSE_SYNTAX:
  6534. matchResult.match.push({
  6535. type: item.type,
  6536. syntax: item.syntax
  6537. });
  6538. break;
  6539. default:
  6540. matchResult.match.push({
  6541. token: item.token.value,
  6542. node: item.token.node
  6543. });
  6544. break;
  6545. }
  6546. item = item.prev;
  6547. }
  6548. }
  6549. return matchResult;
  6550. }
  6551. function matchAsTree(tokens, matchGraph, syntaxes) {
  6552. var matchResult = internalMatch(tokens, matchGraph, syntaxes || {});
  6553. if (matchResult.match === null) {
  6554. return matchResult;
  6555. }
  6556. var item = matchResult.match;
  6557. var host = matchResult.match = {
  6558. syntax: matchGraph.syntax || null,
  6559. match: []
  6560. };
  6561. var hostStack = [host];
  6562. // revert a list and start with 2nd item since 1st is a stub item
  6563. item = reverseList(item).prev;
  6564. // build a tree
  6565. while (item !== null) {
  6566. switch (item.type) {
  6567. case OPEN_SYNTAX:
  6568. host.match.push(host = {
  6569. syntax: item.syntax,
  6570. match: []
  6571. });
  6572. hostStack.push(host);
  6573. break;
  6574. case CLOSE_SYNTAX:
  6575. hostStack.pop();
  6576. host = hostStack[hostStack.length - 1];
  6577. break;
  6578. default:
  6579. host.match.push({
  6580. syntax: item.syntax || null,
  6581. token: item.token.value,
  6582. node: item.token.node
  6583. });
  6584. }
  6585. item = item.prev;
  6586. }
  6587. return matchResult;
  6588. }
  6589. var match = {
  6590. matchAsList: matchAsList,
  6591. matchAsTree: matchAsTree,
  6592. getTotalIterationCount: function() {
  6593. return totalIterationCount;
  6594. }
  6595. };
  6596. function getTrace(node) {
  6597. function shouldPutToTrace(syntax) {
  6598. if (syntax === null) {
  6599. return false;
  6600. }
  6601. return (
  6602. syntax.type === 'Type' ||
  6603. syntax.type === 'Property' ||
  6604. syntax.type === 'Keyword'
  6605. );
  6606. }
  6607. function hasMatch(matchNode) {
  6608. if (Array.isArray(matchNode.match)) {
  6609. // use for-loop for better perfomance
  6610. for (var i = 0; i < matchNode.match.length; i++) {
  6611. if (hasMatch(matchNode.match[i])) {
  6612. if (shouldPutToTrace(matchNode.syntax)) {
  6613. result.unshift(matchNode.syntax);
  6614. }
  6615. return true;
  6616. }
  6617. }
  6618. } else if (matchNode.node === node) {
  6619. result = shouldPutToTrace(matchNode.syntax)
  6620. ? [matchNode.syntax]
  6621. : [];
  6622. return true;
  6623. }
  6624. return false;
  6625. }
  6626. var result = null;
  6627. if (this.matched !== null) {
  6628. hasMatch(this.matched);
  6629. }
  6630. return result;
  6631. }
  6632. function testNode(match, node, fn) {
  6633. var trace = getTrace.call(match, node);
  6634. if (trace === null) {
  6635. return false;
  6636. }
  6637. return trace.some(fn);
  6638. }
  6639. function isType(node, type) {
  6640. return testNode(this, node, function(matchNode) {
  6641. return matchNode.type === 'Type' && matchNode.name === type;
  6642. });
  6643. }
  6644. function isProperty(node, property) {
  6645. return testNode(this, node, function(matchNode) {
  6646. return matchNode.type === 'Property' && matchNode.name === property;
  6647. });
  6648. }
  6649. function isKeyword(node) {
  6650. return testNode(this, node, function(matchNode) {
  6651. return matchNode.type === 'Keyword';
  6652. });
  6653. }
  6654. var trace = {
  6655. getTrace: getTrace,
  6656. isType: isType,
  6657. isProperty: isProperty,
  6658. isKeyword: isKeyword
  6659. };
  6660. function getFirstMatchNode(matchNode) {
  6661. if ('node' in matchNode) {
  6662. return matchNode.node;
  6663. }
  6664. return getFirstMatchNode(matchNode.match[0]);
  6665. }
  6666. function getLastMatchNode(matchNode) {
  6667. if ('node' in matchNode) {
  6668. return matchNode.node;
  6669. }
  6670. return getLastMatchNode(matchNode.match[matchNode.match.length - 1]);
  6671. }
  6672. function matchFragments(lexer, ast, match, type, name) {
  6673. function findFragments(matchNode) {
  6674. if (matchNode.syntax !== null &&
  6675. matchNode.syntax.type === type &&
  6676. matchNode.syntax.name === name) {
  6677. var start = getFirstMatchNode(matchNode);
  6678. var end = getLastMatchNode(matchNode);
  6679. lexer.syntax.walk(ast, function(node, item, list) {
  6680. if (node === start) {
  6681. var nodes = new List_1();
  6682. do {
  6683. nodes.appendData(item.data);
  6684. if (item.data === end) {
  6685. break;
  6686. }
  6687. item = item.next;
  6688. } while (item !== null);
  6689. fragments.push({
  6690. parent: list,
  6691. nodes: nodes
  6692. });
  6693. }
  6694. });
  6695. }
  6696. if (Array.isArray(matchNode.match)) {
  6697. matchNode.match.forEach(findFragments);
  6698. }
  6699. }
  6700. var fragments = [];
  6701. if (match.matched !== null) {
  6702. findFragments(match.matched);
  6703. }
  6704. return fragments;
  6705. }
  6706. var search = {
  6707. matchFragments: matchFragments
  6708. };
  6709. var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
  6710. function isValidNumber(value) {
  6711. // Number.isInteger(value) && value >= 0
  6712. return (
  6713. typeof value === 'number' &&
  6714. isFinite(value) &&
  6715. Math.floor(value) === value &&
  6716. value >= 0
  6717. );
  6718. }
  6719. function isValidLocation(loc) {
  6720. return (
  6721. Boolean(loc) &&
  6722. isValidNumber(loc.offset) &&
  6723. isValidNumber(loc.line) &&
  6724. isValidNumber(loc.column)
  6725. );
  6726. }
  6727. function createNodeStructureChecker(type, fields) {
  6728. return function checkNode(node, warn) {
  6729. if (!node || node.constructor !== Object) {
  6730. return warn(node, 'Type of node should be an Object');
  6731. }
  6732. for (var key in node) {
  6733. var valid = true;
  6734. if (hasOwnProperty$2.call(node, key) === false) {
  6735. continue;
  6736. }
  6737. if (key === 'type') {
  6738. if (node.type !== type) {
  6739. warn(node, 'Wrong node type `' + node.type + '`, expected `' + type + '`');
  6740. }
  6741. } else if (key === 'loc') {
  6742. if (node.loc === null) {
  6743. continue;
  6744. } else if (node.loc && node.loc.constructor === Object) {
  6745. if (typeof node.loc.source !== 'string') {
  6746. key += '.source';
  6747. } else if (!isValidLocation(node.loc.start)) {
  6748. key += '.start';
  6749. } else if (!isValidLocation(node.loc.end)) {
  6750. key += '.end';
  6751. } else {
  6752. continue;
  6753. }
  6754. }
  6755. valid = false;
  6756. } else if (fields.hasOwnProperty(key)) {
  6757. for (var i = 0, valid = false; !valid && i < fields[key].length; i++) {
  6758. var fieldType = fields[key][i];
  6759. switch (fieldType) {
  6760. case String:
  6761. valid = typeof node[key] === 'string';
  6762. break;
  6763. case Boolean:
  6764. valid = typeof node[key] === 'boolean';
  6765. break;
  6766. case null:
  6767. valid = node[key] === null;
  6768. break;
  6769. default:
  6770. if (typeof fieldType === 'string') {
  6771. valid = node[key] && node[key].type === fieldType;
  6772. } else if (Array.isArray(fieldType)) {
  6773. valid = node[key] instanceof List_1;
  6774. }
  6775. }
  6776. }
  6777. } else {
  6778. warn(node, 'Unknown field `' + key + '` for ' + type + ' node type');
  6779. }
  6780. if (!valid) {
  6781. warn(node, 'Bad value for `' + type + '.' + key + '`');
  6782. }
  6783. }
  6784. for (var key in fields) {
  6785. if (hasOwnProperty$2.call(fields, key) &&
  6786. hasOwnProperty$2.call(node, key) === false) {
  6787. warn(node, 'Field `' + type + '.' + key + '` is missed');
  6788. }
  6789. }
  6790. };
  6791. }
  6792. function processStructure(name, nodeType) {
  6793. var structure = nodeType.structure;
  6794. var fields = {
  6795. type: String,
  6796. loc: true
  6797. };
  6798. var docs = {
  6799. type: '"' + name + '"'
  6800. };
  6801. for (var key in structure) {
  6802. if (hasOwnProperty$2.call(structure, key) === false) {
  6803. continue;
  6804. }
  6805. var docsTypes = [];
  6806. var fieldTypes = fields[key] = Array.isArray(structure[key])
  6807. ? structure[key].slice()
  6808. : [structure[key]];
  6809. for (var i = 0; i < fieldTypes.length; i++) {
  6810. var fieldType = fieldTypes[i];
  6811. if (fieldType === String || fieldType === Boolean) {
  6812. docsTypes.push(fieldType.name);
  6813. } else if (fieldType === null) {
  6814. docsTypes.push('null');
  6815. } else if (typeof fieldType === 'string') {
  6816. docsTypes.push('<' + fieldType + '>');
  6817. } else if (Array.isArray(fieldType)) {
  6818. docsTypes.push('List'); // TODO: use type enum
  6819. } else {
  6820. throw new Error('Wrong value `' + fieldType + '` in `' + name + '.' + key + '` structure definition');
  6821. }
  6822. }
  6823. docs[key] = docsTypes.join(' | ');
  6824. }
  6825. return {
  6826. docs: docs,
  6827. check: createNodeStructureChecker(name, fields)
  6828. };
  6829. }
  6830. var structure = {
  6831. getStructureFromConfig: function(config) {
  6832. var structure = {};
  6833. if (config.node) {
  6834. for (var name in config.node) {
  6835. if (hasOwnProperty$2.call(config.node, name)) {
  6836. var nodeType = config.node[name];
  6837. if (nodeType.structure) {
  6838. structure[name] = processStructure(name, nodeType);
  6839. } else {
  6840. throw new Error('Missed `structure` field in `' + name + '` node type definition');
  6841. }
  6842. }
  6843. }
  6844. }
  6845. return structure;
  6846. }
  6847. };
  6848. var SyntaxReferenceError$1 = error.SyntaxReferenceError;
  6849. var MatchError$1 = error.MatchError;
  6850. var buildMatchGraph$1 = matchGraph.buildMatchGraph;
  6851. var matchAsTree$1 = match.matchAsTree;
  6852. var getStructureFromConfig = structure.getStructureFromConfig;
  6853. var cssWideKeywords$1 = buildMatchGraph$1('inherit | initial | unset');
  6854. var cssWideKeywordsWithExpression = buildMatchGraph$1('inherit | initial | unset | <-ms-legacy-expression>');
  6855. function dumpMapSyntax(map, compact, syntaxAsAst) {
  6856. var result = {};
  6857. for (var name in map) {
  6858. if (map[name].syntax) {
  6859. result[name] = syntaxAsAst
  6860. ? map[name].syntax
  6861. : generate_1(map[name].syntax, { compact: compact });
  6862. }
  6863. }
  6864. return result;
  6865. }
  6866. function valueHasVar(tokens) {
  6867. for (var i = 0; i < tokens.length; i++) {
  6868. if (tokens[i].value.toLowerCase() === 'var(') {
  6869. return true;
  6870. }
  6871. }
  6872. return false;
  6873. }
  6874. function buildMatchResult(match, error, iterations) {
  6875. return {
  6876. matched: match,
  6877. iterations: iterations,
  6878. error: error,
  6879. getTrace: trace.getTrace,
  6880. isType: trace.isType,
  6881. isProperty: trace.isProperty,
  6882. isKeyword: trace.isKeyword
  6883. };
  6884. }
  6885. function matchSyntax(lexer, syntax, value, useCommon) {
  6886. var tokens = prepareTokens_1(value, lexer.syntax);
  6887. var result;
  6888. if (valueHasVar(tokens)) {
  6889. return buildMatchResult(null, new Error('Matching for a tree with var() is not supported'));
  6890. }
  6891. if (useCommon) {
  6892. result = matchAsTree$1(tokens, lexer.valueCommonSyntax, lexer);
  6893. }
  6894. if (!useCommon || !result.match) {
  6895. result = matchAsTree$1(tokens, syntax.match, lexer);
  6896. if (!result.match) {
  6897. return buildMatchResult(
  6898. null,
  6899. new MatchError$1(result.reason, syntax.syntax, value, result),
  6900. result.iterations
  6901. );
  6902. }
  6903. }
  6904. return buildMatchResult(result.match, null, result.iterations);
  6905. }
  6906. var Lexer = function(config, syntax, structure) {
  6907. this.valueCommonSyntax = cssWideKeywords$1;
  6908. this.syntax = syntax;
  6909. this.generic = false;
  6910. this.atrules = {};
  6911. this.properties = {};
  6912. this.types = {};
  6913. this.structure = structure || getStructureFromConfig(config);
  6914. if (config) {
  6915. if (config.types) {
  6916. for (var name in config.types) {
  6917. this.addType_(name, config.types[name]);
  6918. }
  6919. }
  6920. if (config.generic) {
  6921. this.generic = true;
  6922. for (var name in generic) {
  6923. this.addType_(name, generic[name]);
  6924. }
  6925. }
  6926. if (config.atrules) {
  6927. for (var name in config.atrules) {
  6928. this.addAtrule_(name, config.atrules[name]);
  6929. }
  6930. }
  6931. if (config.properties) {
  6932. for (var name in config.properties) {
  6933. this.addProperty_(name, config.properties[name]);
  6934. }
  6935. }
  6936. }
  6937. };
  6938. Lexer.prototype = {
  6939. structure: {},
  6940. checkStructure: function(ast) {
  6941. function collectWarning(node, message) {
  6942. warns.push({
  6943. node: node,
  6944. message: message
  6945. });
  6946. }
  6947. var structure = this.structure;
  6948. var warns = [];
  6949. this.syntax.walk(ast, function(node) {
  6950. if (structure.hasOwnProperty(node.type)) {
  6951. structure[node.type].check(node, collectWarning);
  6952. } else {
  6953. collectWarning(node, 'Unknown node type `' + node.type + '`');
  6954. }
  6955. });
  6956. return warns.length ? warns : false;
  6957. },
  6958. createDescriptor: function(syntax, type, name) {
  6959. var ref = {
  6960. type: type,
  6961. name: name
  6962. };
  6963. var descriptor = {
  6964. type: type,
  6965. name: name,
  6966. syntax: null,
  6967. match: null
  6968. };
  6969. if (typeof syntax === 'function') {
  6970. descriptor.match = buildMatchGraph$1(syntax, ref);
  6971. } else {
  6972. if (typeof syntax === 'string') {
  6973. // lazy parsing on first access
  6974. Object.defineProperty(descriptor, 'syntax', {
  6975. get: function() {
  6976. Object.defineProperty(descriptor, 'syntax', {
  6977. value: parse_1(syntax)
  6978. });
  6979. return descriptor.syntax;
  6980. }
  6981. });
  6982. } else {
  6983. descriptor.syntax = syntax;
  6984. }
  6985. // lazy graph build on first access
  6986. Object.defineProperty(descriptor, 'match', {
  6987. get: function() {
  6988. Object.defineProperty(descriptor, 'match', {
  6989. value: buildMatchGraph$1(descriptor.syntax, ref)
  6990. });
  6991. return descriptor.match;
  6992. }
  6993. });
  6994. }
  6995. return descriptor;
  6996. },
  6997. addAtrule_: function(name, syntax) {
  6998. this.atrules[name] = {
  6999. prelude: syntax.prelude ? this.createDescriptor(syntax.prelude, 'AtrulePrelude', name) : null,
  7000. descriptors: syntax.descriptors
  7001. ? Object.keys(syntax.descriptors).reduce((res, name) => {
  7002. res[name] = this.createDescriptor(syntax.descriptors[name], 'AtruleDescriptor', name);
  7003. return res;
  7004. }, {})
  7005. : null
  7006. };
  7007. },
  7008. addProperty_: function(name, syntax) {
  7009. this.properties[name] = this.createDescriptor(syntax, 'Property', name);
  7010. },
  7011. addType_: function(name, syntax) {
  7012. this.types[name] = this.createDescriptor(syntax, 'Type', name);
  7013. if (syntax === generic['-ms-legacy-expression']) {
  7014. this.valueCommonSyntax = cssWideKeywordsWithExpression;
  7015. }
  7016. },
  7017. matchAtrulePrelude: function(atruleName, prelude) {
  7018. var atrule = names.keyword(atruleName);
  7019. var atrulePreludeSyntax = atrule.vendor
  7020. ? this.getAtrulePrelude(atrule.name) || this.getAtrulePrelude(atrule.basename)
  7021. : this.getAtrulePrelude(atrule.name);
  7022. if (!atrulePreludeSyntax) {
  7023. if (atrule.basename in this.atrules) {
  7024. return buildMatchResult(null, new Error('At-rule `' + atruleName + '` should not contain a prelude'));
  7025. }
  7026. return buildMatchResult(null, new SyntaxReferenceError$1('Unknown at-rule', atruleName));
  7027. }
  7028. return matchSyntax(this, atrulePreludeSyntax, prelude, true);
  7029. },
  7030. matchAtruleDescriptor: function(atruleName, descriptorName, value) {
  7031. var atrule = names.keyword(atruleName);
  7032. var descriptor = names.keyword(descriptorName);
  7033. var atruleEntry = atrule.vendor
  7034. ? this.atrules[atrule.name] || this.atrules[atrule.basename]
  7035. : this.atrules[atrule.name];
  7036. if (!atruleEntry) {
  7037. return buildMatchResult(null, new SyntaxReferenceError$1('Unknown at-rule', atruleName));
  7038. }
  7039. if (!atruleEntry.descriptors) {
  7040. return buildMatchResult(null, new Error('At-rule `' + atruleName + '` has no known descriptors'));
  7041. }
  7042. var atruleDescriptorSyntax = descriptor.vendor
  7043. ? atruleEntry.descriptors[descriptor.name] || atruleEntry.descriptors[descriptor.basename]
  7044. : atruleEntry.descriptors[descriptor.name];
  7045. if (!atruleDescriptorSyntax) {
  7046. return buildMatchResult(null, new SyntaxReferenceError$1('Unknown at-rule descriptor', descriptorName));
  7047. }
  7048. return matchSyntax(this, atruleDescriptorSyntax, value, true);
  7049. },
  7050. matchDeclaration: function(node) {
  7051. if (node.type !== 'Declaration') {
  7052. return buildMatchResult(null, new Error('Not a Declaration node'));
  7053. }
  7054. return this.matchProperty(node.property, node.value);
  7055. },
  7056. matchProperty: function(propertyName, value) {
  7057. var property = names.property(propertyName);
  7058. // don't match syntax for a custom property
  7059. if (property.custom) {
  7060. return buildMatchResult(null, new Error('Lexer matching doesn\'t applicable for custom properties'));
  7061. }
  7062. var propertySyntax = property.vendor
  7063. ? this.getProperty(property.name) || this.getProperty(property.basename)
  7064. : this.getProperty(property.name);
  7065. if (!propertySyntax) {
  7066. return buildMatchResult(null, new SyntaxReferenceError$1('Unknown property', propertyName));
  7067. }
  7068. return matchSyntax(this, propertySyntax, value, true);
  7069. },
  7070. matchType: function(typeName, value) {
  7071. var typeSyntax = this.getType(typeName);
  7072. if (!typeSyntax) {
  7073. return buildMatchResult(null, new SyntaxReferenceError$1('Unknown type', typeName));
  7074. }
  7075. return matchSyntax(this, typeSyntax, value, false);
  7076. },
  7077. match: function(syntax, value) {
  7078. if (typeof syntax !== 'string' && (!syntax || !syntax.type)) {
  7079. return buildMatchResult(null, new SyntaxReferenceError$1('Bad syntax'));
  7080. }
  7081. if (typeof syntax === 'string' || !syntax.match) {
  7082. syntax = this.createDescriptor(syntax, 'Type', 'anonymous');
  7083. }
  7084. return matchSyntax(this, syntax, value, false);
  7085. },
  7086. findValueFragments: function(propertyName, value, type, name) {
  7087. return search.matchFragments(this, value, this.matchProperty(propertyName, value), type, name);
  7088. },
  7089. findDeclarationValueFragments: function(declaration, type, name) {
  7090. return search.matchFragments(this, declaration.value, this.matchDeclaration(declaration), type, name);
  7091. },
  7092. findAllFragments: function(ast, type, name) {
  7093. var result = [];
  7094. this.syntax.walk(ast, {
  7095. visit: 'Declaration',
  7096. enter: function(declaration) {
  7097. result.push.apply(result, this.findDeclarationValueFragments(declaration, type, name));
  7098. }.bind(this)
  7099. });
  7100. return result;
  7101. },
  7102. getAtrulePrelude: function(atruleName) {
  7103. return this.atrules.hasOwnProperty(atruleName) ? this.atrules[atruleName].prelude : null;
  7104. },
  7105. getAtruleDescriptor: function(atruleName, name) {
  7106. return this.atrules.hasOwnProperty(atruleName) && this.atrules.declarators
  7107. ? this.atrules[atruleName].declarators[name] || null
  7108. : null;
  7109. },
  7110. getProperty: function(name) {
  7111. return this.properties.hasOwnProperty(name) ? this.properties[name] : null;
  7112. },
  7113. getType: function(name) {
  7114. return this.types.hasOwnProperty(name) ? this.types[name] : null;
  7115. },
  7116. validate: function() {
  7117. function validate(syntax, name, broken, descriptor) {
  7118. if (broken.hasOwnProperty(name)) {
  7119. return broken[name];
  7120. }
  7121. broken[name] = false;
  7122. if (descriptor.syntax !== null) {
  7123. walk$1(descriptor.syntax, function(node) {
  7124. if (node.type !== 'Type' && node.type !== 'Property') {
  7125. return;
  7126. }
  7127. var map = node.type === 'Type' ? syntax.types : syntax.properties;
  7128. var brokenMap = node.type === 'Type' ? brokenTypes : brokenProperties;
  7129. if (!map.hasOwnProperty(node.name) || validate(syntax, node.name, brokenMap, map[node.name])) {
  7130. broken[name] = true;
  7131. }
  7132. }, this);
  7133. }
  7134. }
  7135. var brokenTypes = {};
  7136. var brokenProperties = {};
  7137. for (var key in this.types) {
  7138. validate(this, key, brokenTypes, this.types[key]);
  7139. }
  7140. for (var key in this.properties) {
  7141. validate(this, key, brokenProperties, this.properties[key]);
  7142. }
  7143. brokenTypes = Object.keys(brokenTypes).filter(function(name) {
  7144. return brokenTypes[name];
  7145. });
  7146. brokenProperties = Object.keys(brokenProperties).filter(function(name) {
  7147. return brokenProperties[name];
  7148. });
  7149. if (brokenTypes.length || brokenProperties.length) {
  7150. return {
  7151. types: brokenTypes,
  7152. properties: brokenProperties
  7153. };
  7154. }
  7155. return null;
  7156. },
  7157. dump: function(syntaxAsAst, pretty) {
  7158. return {
  7159. generic: this.generic,
  7160. types: dumpMapSyntax(this.types, !pretty, syntaxAsAst),
  7161. properties: dumpMapSyntax(this.properties, !pretty, syntaxAsAst)
  7162. };
  7163. },
  7164. toString: function() {
  7165. return JSON.stringify(this.dump());
  7166. }
  7167. };
  7168. var Lexer_1 = Lexer;
  7169. var definitionSyntax = {
  7170. SyntaxError: _SyntaxError$1,
  7171. parse: parse_1,
  7172. generate: generate_1,
  7173. walk: walk$1
  7174. };
  7175. var isBOM$2 = tokenizer.isBOM;
  7176. var N$3 = 10;
  7177. var F$2 = 12;
  7178. var R$2 = 13;
  7179. function computeLinesAndColumns(host, source) {
  7180. var sourceLength = source.length;
  7181. var lines = adoptBuffer(host.lines, sourceLength); // +1
  7182. var line = host.startLine;
  7183. var columns = adoptBuffer(host.columns, sourceLength);
  7184. var column = host.startColumn;
  7185. var startOffset = source.length > 0 ? isBOM$2(source.charCodeAt(0)) : 0;
  7186. for (var i = startOffset; i < sourceLength; i++) { // -1
  7187. var code = source.charCodeAt(i);
  7188. lines[i] = line;
  7189. columns[i] = column++;
  7190. if (code === N$3 || code === R$2 || code === F$2) {
  7191. if (code === R$2 && i + 1 < sourceLength && source.charCodeAt(i + 1) === N$3) {
  7192. i++;
  7193. lines[i] = line;
  7194. columns[i] = column;
  7195. }
  7196. line++;
  7197. column = 1;
  7198. }
  7199. }
  7200. lines[i] = line;
  7201. columns[i] = column;
  7202. host.lines = lines;
  7203. host.columns = columns;
  7204. }
  7205. var OffsetToLocation = function() {
  7206. this.lines = null;
  7207. this.columns = null;
  7208. this.linesAndColumnsComputed = false;
  7209. };
  7210. OffsetToLocation.prototype = {
  7211. setSource: function(source, startOffset, startLine, startColumn) {
  7212. this.source = source;
  7213. this.startOffset = typeof startOffset === 'undefined' ? 0 : startOffset;
  7214. this.startLine = typeof startLine === 'undefined' ? 1 : startLine;
  7215. this.startColumn = typeof startColumn === 'undefined' ? 1 : startColumn;
  7216. this.linesAndColumnsComputed = false;
  7217. },
  7218. ensureLinesAndColumnsComputed: function() {
  7219. if (!this.linesAndColumnsComputed) {
  7220. computeLinesAndColumns(this, this.source);
  7221. this.linesAndColumnsComputed = true;
  7222. }
  7223. },
  7224. getLocation: function(offset, filename) {
  7225. this.ensureLinesAndColumnsComputed();
  7226. return {
  7227. source: filename,
  7228. offset: this.startOffset + offset,
  7229. line: this.lines[offset],
  7230. column: this.columns[offset]
  7231. };
  7232. },
  7233. getLocationRange: function(start, end, filename) {
  7234. this.ensureLinesAndColumnsComputed();
  7235. return {
  7236. source: filename,
  7237. start: {
  7238. offset: this.startOffset + start,
  7239. line: this.lines[start],
  7240. column: this.columns[start]
  7241. },
  7242. end: {
  7243. offset: this.startOffset + end,
  7244. line: this.lines[end],
  7245. column: this.columns[end]
  7246. }
  7247. };
  7248. }
  7249. };
  7250. var OffsetToLocation_1 = OffsetToLocation;
  7251. var TYPE$7 = tokenizer.TYPE;
  7252. var WHITESPACE$2 = TYPE$7.WhiteSpace;
  7253. var COMMENT$2 = TYPE$7.Comment;
  7254. var sequence = function readSequence(recognizer) {
  7255. var children = this.createList();
  7256. var child = null;
  7257. var context = {
  7258. recognizer: recognizer,
  7259. space: null,
  7260. ignoreWS: false,
  7261. ignoreWSAfter: false
  7262. };
  7263. this.scanner.skipSC();
  7264. while (!this.scanner.eof) {
  7265. switch (this.scanner.tokenType) {
  7266. case COMMENT$2:
  7267. this.scanner.next();
  7268. continue;
  7269. case WHITESPACE$2:
  7270. if (context.ignoreWS) {
  7271. this.scanner.next();
  7272. } else {
  7273. context.space = this.WhiteSpace();
  7274. }
  7275. continue;
  7276. }
  7277. child = recognizer.getNode.call(this, context);
  7278. if (child === undefined) {
  7279. break;
  7280. }
  7281. if (context.space !== null) {
  7282. children.push(context.space);
  7283. context.space = null;
  7284. }
  7285. children.push(child);
  7286. if (context.ignoreWSAfter) {
  7287. context.ignoreWSAfter = false;
  7288. context.ignoreWS = true;
  7289. } else {
  7290. context.ignoreWS = false;
  7291. }
  7292. }
  7293. return children;
  7294. };
  7295. var findWhiteSpaceStart$1 = utils.findWhiteSpaceStart;
  7296. var noop$3 = function() {};
  7297. var TYPE$8 = _const.TYPE;
  7298. var NAME$2 = _const.NAME;
  7299. var WHITESPACE$3 = TYPE$8.WhiteSpace;
  7300. var IDENT$2 = TYPE$8.Ident;
  7301. var FUNCTION = TYPE$8.Function;
  7302. var URL$1 = TYPE$8.Url;
  7303. var HASH = TYPE$8.Hash;
  7304. var PERCENTAGE = TYPE$8.Percentage;
  7305. var NUMBER$2 = TYPE$8.Number;
  7306. var NUMBERSIGN$1 = 0x0023; // U+0023 NUMBER SIGN (#)
  7307. var NULL = 0;
  7308. function createParseContext(name) {
  7309. return function() {
  7310. return this[name]();
  7311. };
  7312. }
  7313. function processConfig(config) {
  7314. var parserConfig = {
  7315. context: {},
  7316. scope: {},
  7317. atrule: {},
  7318. pseudo: {}
  7319. };
  7320. if (config.parseContext) {
  7321. for (var name in config.parseContext) {
  7322. switch (typeof config.parseContext[name]) {
  7323. case 'function':
  7324. parserConfig.context[name] = config.parseContext[name];
  7325. break;
  7326. case 'string':
  7327. parserConfig.context[name] = createParseContext(config.parseContext[name]);
  7328. break;
  7329. }
  7330. }
  7331. }
  7332. if (config.scope) {
  7333. for (var name in config.scope) {
  7334. parserConfig.scope[name] = config.scope[name];
  7335. }
  7336. }
  7337. if (config.atrule) {
  7338. for (var name in config.atrule) {
  7339. var atrule = config.atrule[name];
  7340. if (atrule.parse) {
  7341. parserConfig.atrule[name] = atrule.parse;
  7342. }
  7343. }
  7344. }
  7345. if (config.pseudo) {
  7346. for (var name in config.pseudo) {
  7347. var pseudo = config.pseudo[name];
  7348. if (pseudo.parse) {
  7349. parserConfig.pseudo[name] = pseudo.parse;
  7350. }
  7351. }
  7352. }
  7353. if (config.node) {
  7354. for (var name in config.node) {
  7355. parserConfig[name] = config.node[name].parse;
  7356. }
  7357. }
  7358. return parserConfig;
  7359. }
  7360. var create$1 = function createParser(config) {
  7361. var parser = {
  7362. scanner: new TokenStream_1(),
  7363. locationMap: new OffsetToLocation_1(),
  7364. filename: '<unknown>',
  7365. needPositions: false,
  7366. onParseError: noop$3,
  7367. onParseErrorThrow: false,
  7368. parseAtrulePrelude: true,
  7369. parseRulePrelude: true,
  7370. parseValue: true,
  7371. parseCustomProperty: false,
  7372. readSequence: sequence,
  7373. createList: function() {
  7374. return new List_1();
  7375. },
  7376. createSingleNodeList: function(node) {
  7377. return new List_1().appendData(node);
  7378. },
  7379. getFirstListNode: function(list) {
  7380. return list && list.first();
  7381. },
  7382. getLastListNode: function(list) {
  7383. return list.last();
  7384. },
  7385. parseWithFallback: function(consumer, fallback) {
  7386. var startToken = this.scanner.tokenIndex;
  7387. try {
  7388. return consumer.call(this);
  7389. } catch (e) {
  7390. if (this.onParseErrorThrow) {
  7391. throw e;
  7392. }
  7393. var fallbackNode = fallback.call(this, startToken);
  7394. this.onParseErrorThrow = true;
  7395. this.onParseError(e, fallbackNode);
  7396. this.onParseErrorThrow = false;
  7397. return fallbackNode;
  7398. }
  7399. },
  7400. lookupNonWSType: function(offset) {
  7401. do {
  7402. var type = this.scanner.lookupType(offset++);
  7403. if (type !== WHITESPACE$3) {
  7404. return type;
  7405. }
  7406. } while (type !== NULL);
  7407. return NULL;
  7408. },
  7409. eat: function(tokenType) {
  7410. if (this.scanner.tokenType !== tokenType) {
  7411. var offset = this.scanner.tokenStart;
  7412. var message = NAME$2[tokenType] + ' is expected';
  7413. // tweak message and offset
  7414. switch (tokenType) {
  7415. case IDENT$2:
  7416. // when identifier is expected but there is a function or url
  7417. if (this.scanner.tokenType === FUNCTION || this.scanner.tokenType === URL$1) {
  7418. offset = this.scanner.tokenEnd - 1;
  7419. message = 'Identifier is expected but function found';
  7420. } else {
  7421. message = 'Identifier is expected';
  7422. }
  7423. break;
  7424. case HASH:
  7425. if (this.scanner.isDelim(NUMBERSIGN$1)) {
  7426. this.scanner.next();
  7427. offset++;
  7428. message = 'Name is expected';
  7429. }
  7430. break;
  7431. case PERCENTAGE:
  7432. if (this.scanner.tokenType === NUMBER$2) {
  7433. offset = this.scanner.tokenEnd;
  7434. message = 'Percent sign is expected';
  7435. }
  7436. break;
  7437. default:
  7438. // when test type is part of another token show error for current position + 1
  7439. // e.g. eat(HYPHENMINUS) will fail on "-foo", but pointing on "-" is odd
  7440. if (this.scanner.source.charCodeAt(this.scanner.tokenStart) === tokenType) {
  7441. offset = offset + 1;
  7442. }
  7443. }
  7444. this.error(message, offset);
  7445. }
  7446. this.scanner.next();
  7447. },
  7448. consume: function(tokenType) {
  7449. var value = this.scanner.getTokenValue();
  7450. this.eat(tokenType);
  7451. return value;
  7452. },
  7453. consumeFunctionName: function() {
  7454. var name = this.scanner.source.substring(this.scanner.tokenStart, this.scanner.tokenEnd - 1);
  7455. this.eat(FUNCTION);
  7456. return name;
  7457. },
  7458. getLocation: function(start, end) {
  7459. if (this.needPositions) {
  7460. return this.locationMap.getLocationRange(
  7461. start,
  7462. end,
  7463. this.filename
  7464. );
  7465. }
  7466. return null;
  7467. },
  7468. getLocationFromList: function(list) {
  7469. if (this.needPositions) {
  7470. var head = this.getFirstListNode(list);
  7471. var tail = this.getLastListNode(list);
  7472. return this.locationMap.getLocationRange(
  7473. head !== null ? head.loc.start.offset - this.locationMap.startOffset : this.scanner.tokenStart,
  7474. tail !== null ? tail.loc.end.offset - this.locationMap.startOffset : this.scanner.tokenStart,
  7475. this.filename
  7476. );
  7477. }
  7478. return null;
  7479. },
  7480. error: function(message, offset) {
  7481. var location = typeof offset !== 'undefined' && offset < this.scanner.source.length
  7482. ? this.locationMap.getLocation(offset)
  7483. : this.scanner.eof
  7484. ? this.locationMap.getLocation(findWhiteSpaceStart$1(this.scanner.source, this.scanner.source.length - 1))
  7485. : this.locationMap.getLocation(this.scanner.tokenStart);
  7486. throw new _SyntaxError(
  7487. message || 'Unexpected input',
  7488. this.scanner.source,
  7489. location.offset,
  7490. location.line,
  7491. location.column
  7492. );
  7493. }
  7494. };
  7495. config = processConfig(config || {});
  7496. for (var key in config) {
  7497. parser[key] = config[key];
  7498. }
  7499. return function(source, options) {
  7500. options = options || {};
  7501. var context = options.context || 'default';
  7502. var ast;
  7503. tokenizer(source, parser.scanner);
  7504. parser.locationMap.setSource(
  7505. source,
  7506. options.offset,
  7507. options.line,
  7508. options.column
  7509. );
  7510. parser.filename = options.filename || '<unknown>';
  7511. parser.needPositions = Boolean(options.positions);
  7512. parser.onParseError = typeof options.onParseError === 'function' ? options.onParseError : noop$3;
  7513. parser.onParseErrorThrow = false;
  7514. parser.parseAtrulePrelude = 'parseAtrulePrelude' in options ? Boolean(options.parseAtrulePrelude) : true;
  7515. parser.parseRulePrelude = 'parseRulePrelude' in options ? Boolean(options.parseRulePrelude) : true;
  7516. parser.parseValue = 'parseValue' in options ? Boolean(options.parseValue) : true;
  7517. parser.parseCustomProperty = 'parseCustomProperty' in options ? Boolean(options.parseCustomProperty) : false;
  7518. if (!parser.context.hasOwnProperty(context)) {
  7519. throw new Error('Unknown context `' + context + '`');
  7520. }
  7521. ast = parser.context[context].call(parser, options);
  7522. if (!parser.scanner.eof) {
  7523. parser.error();
  7524. }
  7525. return ast;
  7526. };
  7527. };
  7528. /* -*- Mode: js; js-indent-level: 2; -*- */
  7529. /*
  7530. * Copyright 2011 Mozilla Foundation and contributors
  7531. * Licensed under the New BSD license. See LICENSE or:
  7532. * http://opensource.org/licenses/BSD-3-Clause
  7533. */
  7534. var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
  7535. /**
  7536. * Encode an integer in the range of 0 to 63 to a single base 64 digit.
  7537. */
  7538. var encode = function (number) {
  7539. if (0 <= number && number < intToCharMap.length) {
  7540. return intToCharMap[number];
  7541. }
  7542. throw new TypeError("Must be between 0 and 63: " + number);
  7543. };
  7544. /**
  7545. * Decode a single base 64 character code digit to an integer. Returns -1 on
  7546. * failure.
  7547. */
  7548. var decode = function (charCode) {
  7549. var bigA = 65; // 'A'
  7550. var bigZ = 90; // 'Z'
  7551. var littleA = 97; // 'a'
  7552. var littleZ = 122; // 'z'
  7553. var zero = 48; // '0'
  7554. var nine = 57; // '9'
  7555. var plus = 43; // '+'
  7556. var slash = 47; // '/'
  7557. var littleOffset = 26;
  7558. var numberOffset = 52;
  7559. // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  7560. if (bigA <= charCode && charCode <= bigZ) {
  7561. return (charCode - bigA);
  7562. }
  7563. // 26 - 51: abcdefghijklmnopqrstuvwxyz
  7564. if (littleA <= charCode && charCode <= littleZ) {
  7565. return (charCode - littleA + littleOffset);
  7566. }
  7567. // 52 - 61: 0123456789
  7568. if (zero <= charCode && charCode <= nine) {
  7569. return (charCode - zero + numberOffset);
  7570. }
  7571. // 62: +
  7572. if (charCode == plus) {
  7573. return 62;
  7574. }
  7575. // 63: /
  7576. if (charCode == slash) {
  7577. return 63;
  7578. }
  7579. // Invalid base64 digit.
  7580. return -1;
  7581. };
  7582. var base64 = {
  7583. encode: encode,
  7584. decode: decode
  7585. };
  7586. /* -*- Mode: js; js-indent-level: 2; -*- */
  7587. /*
  7588. * Copyright 2011 Mozilla Foundation and contributors
  7589. * Licensed under the New BSD license. See LICENSE or:
  7590. * http://opensource.org/licenses/BSD-3-Clause
  7591. *
  7592. * Based on the Base 64 VLQ implementation in Closure Compiler:
  7593. * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
  7594. *
  7595. * Copyright 2011 The Closure Compiler Authors. All rights reserved.
  7596. * Redistribution and use in source and binary forms, with or without
  7597. * modification, are permitted provided that the following conditions are
  7598. * met:
  7599. *
  7600. * * Redistributions of source code must retain the above copyright
  7601. * notice, this list of conditions and the following disclaimer.
  7602. * * Redistributions in binary form must reproduce the above
  7603. * copyright notice, this list of conditions and the following
  7604. * disclaimer in the documentation and/or other materials provided
  7605. * with the distribution.
  7606. * * Neither the name of Google Inc. nor the names of its
  7607. * contributors may be used to endorse or promote products derived
  7608. * from this software without specific prior written permission.
  7609. *
  7610. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  7611. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  7612. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  7613. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7614. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  7615. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  7616. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  7617. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  7618. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  7619. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  7620. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  7621. */
  7622. // A single base 64 digit can contain 6 bits of data. For the base 64 variable
  7623. // length quantities we use in the source map spec, the first bit is the sign,
  7624. // the next four bits are the actual value, and the 6th bit is the
  7625. // continuation bit. The continuation bit tells us whether there are more
  7626. // digits in this value following this digit.
  7627. //
  7628. // Continuation
  7629. // | Sign
  7630. // | |
  7631. // V V
  7632. // 101011
  7633. var VLQ_BASE_SHIFT = 5;
  7634. // binary: 100000
  7635. var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
  7636. // binary: 011111
  7637. var VLQ_BASE_MASK = VLQ_BASE - 1;
  7638. // binary: 100000
  7639. var VLQ_CONTINUATION_BIT = VLQ_BASE;
  7640. /**
  7641. * Converts from a two-complement value to a value where the sign bit is
  7642. * placed in the least significant bit. For example, as decimals:
  7643. * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
  7644. * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
  7645. */
  7646. function toVLQSigned(aValue) {
  7647. return aValue < 0
  7648. ? ((-aValue) << 1) + 1
  7649. : (aValue << 1) + 0;
  7650. }
  7651. /**
  7652. * Converts to a two-complement value from a value where the sign bit is
  7653. * placed in the least significant bit. For example, as decimals:
  7654. * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
  7655. * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
  7656. */
  7657. function fromVLQSigned(aValue) {
  7658. var isNegative = (aValue & 1) === 1;
  7659. var shifted = aValue >> 1;
  7660. return isNegative
  7661. ? -shifted
  7662. : shifted;
  7663. }
  7664. /**
  7665. * Returns the base 64 VLQ encoded value.
  7666. */
  7667. var encode$1 = function base64VLQ_encode(aValue) {
  7668. var encoded = "";
  7669. var digit;
  7670. var vlq = toVLQSigned(aValue);
  7671. do {
  7672. digit = vlq & VLQ_BASE_MASK;
  7673. vlq >>>= VLQ_BASE_SHIFT;
  7674. if (vlq > 0) {
  7675. // There are still more digits in this value, so we must make sure the
  7676. // continuation bit is marked.
  7677. digit |= VLQ_CONTINUATION_BIT;
  7678. }
  7679. encoded += base64.encode(digit);
  7680. } while (vlq > 0);
  7681. return encoded;
  7682. };
  7683. /**
  7684. * Decodes the next base 64 VLQ value from the given string and returns the
  7685. * value and the rest of the string via the out parameter.
  7686. */
  7687. var decode$1 = function base64VLQ_decode(aStr, aIndex, aOutParam) {
  7688. var strLen = aStr.length;
  7689. var result = 0;
  7690. var shift = 0;
  7691. var continuation, digit;
  7692. do {
  7693. if (aIndex >= strLen) {
  7694. throw new Error("Expected more digits in base 64 VLQ value.");
  7695. }
  7696. digit = base64.decode(aStr.charCodeAt(aIndex++));
  7697. if (digit === -1) {
  7698. throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
  7699. }
  7700. continuation = !!(digit & VLQ_CONTINUATION_BIT);
  7701. digit &= VLQ_BASE_MASK;
  7702. result = result + (digit << shift);
  7703. shift += VLQ_BASE_SHIFT;
  7704. } while (continuation);
  7705. aOutParam.value = fromVLQSigned(result);
  7706. aOutParam.rest = aIndex;
  7707. };
  7708. var base64Vlq = {
  7709. encode: encode$1,
  7710. decode: decode$1
  7711. };
  7712. var util = createCommonjsModule(function (module, exports) {
  7713. /* -*- Mode: js; js-indent-level: 2; -*- */
  7714. /*
  7715. * Copyright 2011 Mozilla Foundation and contributors
  7716. * Licensed under the New BSD license. See LICENSE or:
  7717. * http://opensource.org/licenses/BSD-3-Clause
  7718. */
  7719. /**
  7720. * This is a helper function for getting values from parameter/options
  7721. * objects.
  7722. *
  7723. * @param args The object we are extracting values from
  7724. * @param name The name of the property we are getting.
  7725. * @param defaultValue An optional value to return if the property is missing
  7726. * from the object. If this is not specified and the property is missing, an
  7727. * error will be thrown.
  7728. */
  7729. function getArg(aArgs, aName, aDefaultValue) {
  7730. if (aName in aArgs) {
  7731. return aArgs[aName];
  7732. } else if (arguments.length === 3) {
  7733. return aDefaultValue;
  7734. } else {
  7735. throw new Error('"' + aName + '" is a required argument.');
  7736. }
  7737. }
  7738. exports.getArg = getArg;
  7739. var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
  7740. var dataUrlRegexp = /^data:.+\,.+$/;
  7741. function urlParse(aUrl) {
  7742. var match = aUrl.match(urlRegexp);
  7743. if (!match) {
  7744. return null;
  7745. }
  7746. return {
  7747. scheme: match[1],
  7748. auth: match[2],
  7749. host: match[3],
  7750. port: match[4],
  7751. path: match[5]
  7752. };
  7753. }
  7754. exports.urlParse = urlParse;
  7755. function urlGenerate(aParsedUrl) {
  7756. var url = '';
  7757. if (aParsedUrl.scheme) {
  7758. url += aParsedUrl.scheme + ':';
  7759. }
  7760. url += '//';
  7761. if (aParsedUrl.auth) {
  7762. url += aParsedUrl.auth + '@';
  7763. }
  7764. if (aParsedUrl.host) {
  7765. url += aParsedUrl.host;
  7766. }
  7767. if (aParsedUrl.port) {
  7768. url += ":" + aParsedUrl.port;
  7769. }
  7770. if (aParsedUrl.path) {
  7771. url += aParsedUrl.path;
  7772. }
  7773. return url;
  7774. }
  7775. exports.urlGenerate = urlGenerate;
  7776. /**
  7777. * Normalizes a path, or the path portion of a URL:
  7778. *
  7779. * - Replaces consecutive slashes with one slash.
  7780. * - Removes unnecessary '.' parts.
  7781. * - Removes unnecessary '<dir>/..' parts.
  7782. *
  7783. * Based on code in the Node.js 'path' core module.
  7784. *
  7785. * @param aPath The path or url to normalize.
  7786. */
  7787. function normalize(aPath) {
  7788. var path = aPath;
  7789. var url = urlParse(aPath);
  7790. if (url) {
  7791. if (!url.path) {
  7792. return aPath;
  7793. }
  7794. path = url.path;
  7795. }
  7796. var isAbsolute = exports.isAbsolute(path);
  7797. var parts = path.split(/\/+/);
  7798. for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
  7799. part = parts[i];
  7800. if (part === '.') {
  7801. parts.splice(i, 1);
  7802. } else if (part === '..') {
  7803. up++;
  7804. } else if (up > 0) {
  7805. if (part === '') {
  7806. // The first part is blank if the path is absolute. Trying to go
  7807. // above the root is a no-op. Therefore we can remove all '..' parts
  7808. // directly after the root.
  7809. parts.splice(i + 1, up);
  7810. up = 0;
  7811. } else {
  7812. parts.splice(i, 2);
  7813. up--;
  7814. }
  7815. }
  7816. }
  7817. path = parts.join('/');
  7818. if (path === '') {
  7819. path = isAbsolute ? '/' : '.';
  7820. }
  7821. if (url) {
  7822. url.path = path;
  7823. return urlGenerate(url);
  7824. }
  7825. return path;
  7826. }
  7827. exports.normalize = normalize;
  7828. /**
  7829. * Joins two paths/URLs.
  7830. *
  7831. * @param aRoot The root path or URL.
  7832. * @param aPath The path or URL to be joined with the root.
  7833. *
  7834. * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
  7835. * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
  7836. * first.
  7837. * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
  7838. * is updated with the result and aRoot is returned. Otherwise the result
  7839. * is returned.
  7840. * - If aPath is absolute, the result is aPath.
  7841. * - Otherwise the two paths are joined with a slash.
  7842. * - Joining for example 'http://' and 'www.example.com' is also supported.
  7843. */
  7844. function join(aRoot, aPath) {
  7845. if (aRoot === "") {
  7846. aRoot = ".";
  7847. }
  7848. if (aPath === "") {
  7849. aPath = ".";
  7850. }
  7851. var aPathUrl = urlParse(aPath);
  7852. var aRootUrl = urlParse(aRoot);
  7853. if (aRootUrl) {
  7854. aRoot = aRootUrl.path || '/';
  7855. }
  7856. // `join(foo, '//www.example.org')`
  7857. if (aPathUrl && !aPathUrl.scheme) {
  7858. if (aRootUrl) {
  7859. aPathUrl.scheme = aRootUrl.scheme;
  7860. }
  7861. return urlGenerate(aPathUrl);
  7862. }
  7863. if (aPathUrl || aPath.match(dataUrlRegexp)) {
  7864. return aPath;
  7865. }
  7866. // `join('http://', 'www.example.com')`
  7867. if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
  7868. aRootUrl.host = aPath;
  7869. return urlGenerate(aRootUrl);
  7870. }
  7871. var joined = aPath.charAt(0) === '/'
  7872. ? aPath
  7873. : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
  7874. if (aRootUrl) {
  7875. aRootUrl.path = joined;
  7876. return urlGenerate(aRootUrl);
  7877. }
  7878. return joined;
  7879. }
  7880. exports.join = join;
  7881. exports.isAbsolute = function (aPath) {
  7882. return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
  7883. };
  7884. /**
  7885. * Make a path relative to a URL or another path.
  7886. *
  7887. * @param aRoot The root path or URL.
  7888. * @param aPath The path or URL to be made relative to aRoot.
  7889. */
  7890. function relative(aRoot, aPath) {
  7891. if (aRoot === "") {
  7892. aRoot = ".";
  7893. }
  7894. aRoot = aRoot.replace(/\/$/, '');
  7895. // It is possible for the path to be above the root. In this case, simply
  7896. // checking whether the root is a prefix of the path won't work. Instead, we
  7897. // need to remove components from the root one by one, until either we find
  7898. // a prefix that fits, or we run out of components to remove.
  7899. var level = 0;
  7900. while (aPath.indexOf(aRoot + '/') !== 0) {
  7901. var index = aRoot.lastIndexOf("/");
  7902. if (index < 0) {
  7903. return aPath;
  7904. }
  7905. // If the only part of the root that is left is the scheme (i.e. http://,
  7906. // file:///, etc.), one or more slashes (/), or simply nothing at all, we
  7907. // have exhausted all components, so the path is not relative to the root.
  7908. aRoot = aRoot.slice(0, index);
  7909. if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
  7910. return aPath;
  7911. }
  7912. ++level;
  7913. }
  7914. // Make sure we add a "../" for each component we removed from the root.
  7915. return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
  7916. }
  7917. exports.relative = relative;
  7918. var supportsNullProto = (function () {
  7919. var obj = Object.create(null);
  7920. return !('__proto__' in obj);
  7921. }());
  7922. function identity (s) {
  7923. return s;
  7924. }
  7925. /**
  7926. * Because behavior goes wacky when you set `__proto__` on objects, we
  7927. * have to prefix all the strings in our set with an arbitrary character.
  7928. *
  7929. * See https://github.com/mozilla/source-map/pull/31 and
  7930. * https://github.com/mozilla/source-map/issues/30
  7931. *
  7932. * @param String aStr
  7933. */
  7934. function toSetString(aStr) {
  7935. if (isProtoString(aStr)) {
  7936. return '$' + aStr;
  7937. }
  7938. return aStr;
  7939. }
  7940. exports.toSetString = supportsNullProto ? identity : toSetString;
  7941. function fromSetString(aStr) {
  7942. if (isProtoString(aStr)) {
  7943. return aStr.slice(1);
  7944. }
  7945. return aStr;
  7946. }
  7947. exports.fromSetString = supportsNullProto ? identity : fromSetString;
  7948. function isProtoString(s) {
  7949. if (!s) {
  7950. return false;
  7951. }
  7952. var length = s.length;
  7953. if (length < 9 /* "__proto__".length */) {
  7954. return false;
  7955. }
  7956. if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
  7957. s.charCodeAt(length - 2) !== 95 /* '_' */ ||
  7958. s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
  7959. s.charCodeAt(length - 4) !== 116 /* 't' */ ||
  7960. s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
  7961. s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
  7962. s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
  7963. s.charCodeAt(length - 8) !== 95 /* '_' */ ||
  7964. s.charCodeAt(length - 9) !== 95 /* '_' */) {
  7965. return false;
  7966. }
  7967. for (var i = length - 10; i >= 0; i--) {
  7968. if (s.charCodeAt(i) !== 36 /* '$' */) {
  7969. return false;
  7970. }
  7971. }
  7972. return true;
  7973. }
  7974. /**
  7975. * Comparator between two mappings where the original positions are compared.
  7976. *
  7977. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  7978. * mappings with the same original source/line/column, but different generated
  7979. * line and column the same. Useful when searching for a mapping with a
  7980. * stubbed out mapping.
  7981. */
  7982. function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
  7983. var cmp = strcmp(mappingA.source, mappingB.source);
  7984. if (cmp !== 0) {
  7985. return cmp;
  7986. }
  7987. cmp = mappingA.originalLine - mappingB.originalLine;
  7988. if (cmp !== 0) {
  7989. return cmp;
  7990. }
  7991. cmp = mappingA.originalColumn - mappingB.originalColumn;
  7992. if (cmp !== 0 || onlyCompareOriginal) {
  7993. return cmp;
  7994. }
  7995. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  7996. if (cmp !== 0) {
  7997. return cmp;
  7998. }
  7999. cmp = mappingA.generatedLine - mappingB.generatedLine;
  8000. if (cmp !== 0) {
  8001. return cmp;
  8002. }
  8003. return strcmp(mappingA.name, mappingB.name);
  8004. }
  8005. exports.compareByOriginalPositions = compareByOriginalPositions;
  8006. /**
  8007. * Comparator between two mappings with deflated source and name indices where
  8008. * the generated positions are compared.
  8009. *
  8010. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  8011. * mappings with the same generated line and column, but different
  8012. * source/name/original line and column the same. Useful when searching for a
  8013. * mapping with a stubbed out mapping.
  8014. */
  8015. function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
  8016. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  8017. if (cmp !== 0) {
  8018. return cmp;
  8019. }
  8020. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  8021. if (cmp !== 0 || onlyCompareGenerated) {
  8022. return cmp;
  8023. }
  8024. cmp = strcmp(mappingA.source, mappingB.source);
  8025. if (cmp !== 0) {
  8026. return cmp;
  8027. }
  8028. cmp = mappingA.originalLine - mappingB.originalLine;
  8029. if (cmp !== 0) {
  8030. return cmp;
  8031. }
  8032. cmp = mappingA.originalColumn - mappingB.originalColumn;
  8033. if (cmp !== 0) {
  8034. return cmp;
  8035. }
  8036. return strcmp(mappingA.name, mappingB.name);
  8037. }
  8038. exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
  8039. function strcmp(aStr1, aStr2) {
  8040. if (aStr1 === aStr2) {
  8041. return 0;
  8042. }
  8043. if (aStr1 === null) {
  8044. return 1; // aStr2 !== null
  8045. }
  8046. if (aStr2 === null) {
  8047. return -1; // aStr1 !== null
  8048. }
  8049. if (aStr1 > aStr2) {
  8050. return 1;
  8051. }
  8052. return -1;
  8053. }
  8054. /**
  8055. * Comparator between two mappings with inflated source and name strings where
  8056. * the generated positions are compared.
  8057. */
  8058. function compareByGeneratedPositionsInflated(mappingA, mappingB) {
  8059. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  8060. if (cmp !== 0) {
  8061. return cmp;
  8062. }
  8063. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  8064. if (cmp !== 0) {
  8065. return cmp;
  8066. }
  8067. cmp = strcmp(mappingA.source, mappingB.source);
  8068. if (cmp !== 0) {
  8069. return cmp;
  8070. }
  8071. cmp = mappingA.originalLine - mappingB.originalLine;
  8072. if (cmp !== 0) {
  8073. return cmp;
  8074. }
  8075. cmp = mappingA.originalColumn - mappingB.originalColumn;
  8076. if (cmp !== 0) {
  8077. return cmp;
  8078. }
  8079. return strcmp(mappingA.name, mappingB.name);
  8080. }
  8081. exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
  8082. /**
  8083. * Strip any JSON XSSI avoidance prefix from the string (as documented
  8084. * in the source maps specification), and then parse the string as
  8085. * JSON.
  8086. */
  8087. function parseSourceMapInput(str) {
  8088. return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
  8089. }
  8090. exports.parseSourceMapInput = parseSourceMapInput;
  8091. /**
  8092. * Compute the URL of a source given the the source root, the source's
  8093. * URL, and the source map's URL.
  8094. */
  8095. function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
  8096. sourceURL = sourceURL || '';
  8097. if (sourceRoot) {
  8098. // This follows what Chrome does.
  8099. if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
  8100. sourceRoot += '/';
  8101. }
  8102. // The spec says:
  8103. // Line 4: An optional source root, useful for relocating source
  8104. // files on a server or removing repeated values in the
  8105. // “sources” entry. This value is prepended to the individual
  8106. // entries in the “source” field.
  8107. sourceURL = sourceRoot + sourceURL;
  8108. }
  8109. // Historically, SourceMapConsumer did not take the sourceMapURL as
  8110. // a parameter. This mode is still somewhat supported, which is why
  8111. // this code block is conditional. However, it's preferable to pass
  8112. // the source map URL to SourceMapConsumer, so that this function
  8113. // can implement the source URL resolution algorithm as outlined in
  8114. // the spec. This block is basically the equivalent of:
  8115. // new URL(sourceURL, sourceMapURL).toString()
  8116. // ... except it avoids using URL, which wasn't available in the
  8117. // older releases of node still supported by this library.
  8118. //
  8119. // The spec says:
  8120. // If the sources are not absolute URLs after prepending of the
  8121. // “sourceRoot”, the sources are resolved relative to the
  8122. // SourceMap (like resolving script src in a html document).
  8123. if (sourceMapURL) {
  8124. var parsed = urlParse(sourceMapURL);
  8125. if (!parsed) {
  8126. throw new Error("sourceMapURL could not be parsed");
  8127. }
  8128. if (parsed.path) {
  8129. // Strip the last path component, but keep the "/".
  8130. var index = parsed.path.lastIndexOf('/');
  8131. if (index >= 0) {
  8132. parsed.path = parsed.path.substring(0, index + 1);
  8133. }
  8134. }
  8135. sourceURL = join(urlGenerate(parsed), sourceURL);
  8136. }
  8137. return normalize(sourceURL);
  8138. }
  8139. exports.computeSourceURL = computeSourceURL;
  8140. });
  8141. var util_1 = util.getArg;
  8142. var util_2 = util.urlParse;
  8143. var util_3 = util.urlGenerate;
  8144. var util_4 = util.normalize;
  8145. var util_5 = util.join;
  8146. var util_6 = util.isAbsolute;
  8147. var util_7 = util.relative;
  8148. var util_8 = util.toSetString;
  8149. var util_9 = util.fromSetString;
  8150. var util_10 = util.compareByOriginalPositions;
  8151. var util_11 = util.compareByGeneratedPositionsDeflated;
  8152. var util_12 = util.compareByGeneratedPositionsInflated;
  8153. var util_13 = util.parseSourceMapInput;
  8154. var util_14 = util.computeSourceURL;
  8155. /* -*- Mode: js; js-indent-level: 2; -*- */
  8156. /*
  8157. * Copyright 2011 Mozilla Foundation and contributors
  8158. * Licensed under the New BSD license. See LICENSE or:
  8159. * http://opensource.org/licenses/BSD-3-Clause
  8160. */
  8161. var has = Object.prototype.hasOwnProperty;
  8162. var hasNativeMap = typeof Map !== "undefined";
  8163. /**
  8164. * A data structure which is a combination of an array and a set. Adding a new
  8165. * member is O(1), testing for membership is O(1), and finding the index of an
  8166. * element is O(1). Removing elements from the set is not supported. Only
  8167. * strings are supported for membership.
  8168. */
  8169. function ArraySet() {
  8170. this._array = [];
  8171. this._set = hasNativeMap ? new Map() : Object.create(null);
  8172. }
  8173. /**
  8174. * Static method for creating ArraySet instances from an existing array.
  8175. */
  8176. ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
  8177. var set = new ArraySet();
  8178. for (var i = 0, len = aArray.length; i < len; i++) {
  8179. set.add(aArray[i], aAllowDuplicates);
  8180. }
  8181. return set;
  8182. };
  8183. /**
  8184. * Return how many unique items are in this ArraySet. If duplicates have been
  8185. * added, than those do not count towards the size.
  8186. *
  8187. * @returns Number
  8188. */
  8189. ArraySet.prototype.size = function ArraySet_size() {
  8190. return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
  8191. };
  8192. /**
  8193. * Add the given string to this set.
  8194. *
  8195. * @param String aStr
  8196. */
  8197. ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
  8198. var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
  8199. var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
  8200. var idx = this._array.length;
  8201. if (!isDuplicate || aAllowDuplicates) {
  8202. this._array.push(aStr);
  8203. }
  8204. if (!isDuplicate) {
  8205. if (hasNativeMap) {
  8206. this._set.set(aStr, idx);
  8207. } else {
  8208. this._set[sStr] = idx;
  8209. }
  8210. }
  8211. };
  8212. /**
  8213. * Is the given string a member of this set?
  8214. *
  8215. * @param String aStr
  8216. */
  8217. ArraySet.prototype.has = function ArraySet_has(aStr) {
  8218. if (hasNativeMap) {
  8219. return this._set.has(aStr);
  8220. } else {
  8221. var sStr = util.toSetString(aStr);
  8222. return has.call(this._set, sStr);
  8223. }
  8224. };
  8225. /**
  8226. * What is the index of the given string in the array?
  8227. *
  8228. * @param String aStr
  8229. */
  8230. ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
  8231. if (hasNativeMap) {
  8232. var idx = this._set.get(aStr);
  8233. if (idx >= 0) {
  8234. return idx;
  8235. }
  8236. } else {
  8237. var sStr = util.toSetString(aStr);
  8238. if (has.call(this._set, sStr)) {
  8239. return this._set[sStr];
  8240. }
  8241. }
  8242. throw new Error('"' + aStr + '" is not in the set.');
  8243. };
  8244. /**
  8245. * What is the element at the given index?
  8246. *
  8247. * @param Number aIdx
  8248. */
  8249. ArraySet.prototype.at = function ArraySet_at(aIdx) {
  8250. if (aIdx >= 0 && aIdx < this._array.length) {
  8251. return this._array[aIdx];
  8252. }
  8253. throw new Error('No element indexed by ' + aIdx);
  8254. };
  8255. /**
  8256. * Returns the array representation of this set (which has the proper indices
  8257. * indicated by indexOf). Note that this is a copy of the internal array used
  8258. * for storing the members so that no one can mess with internal state.
  8259. */
  8260. ArraySet.prototype.toArray = function ArraySet_toArray() {
  8261. return this._array.slice();
  8262. };
  8263. var ArraySet_1 = ArraySet;
  8264. var arraySet = {
  8265. ArraySet: ArraySet_1
  8266. };
  8267. /* -*- Mode: js; js-indent-level: 2; -*- */
  8268. /*
  8269. * Copyright 2014 Mozilla Foundation and contributors
  8270. * Licensed under the New BSD license. See LICENSE or:
  8271. * http://opensource.org/licenses/BSD-3-Clause
  8272. */
  8273. /**
  8274. * Determine whether mappingB is after mappingA with respect to generated
  8275. * position.
  8276. */
  8277. function generatedPositionAfter(mappingA, mappingB) {
  8278. // Optimized for most common case
  8279. var lineA = mappingA.generatedLine;
  8280. var lineB = mappingB.generatedLine;
  8281. var columnA = mappingA.generatedColumn;
  8282. var columnB = mappingB.generatedColumn;
  8283. return lineB > lineA || lineB == lineA && columnB >= columnA ||
  8284. util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
  8285. }
  8286. /**
  8287. * A data structure to provide a sorted view of accumulated mappings in a
  8288. * performance conscious manner. It trades a neglibable overhead in general
  8289. * case for a large speedup in case of mappings being added in order.
  8290. */
  8291. function MappingList() {
  8292. this._array = [];
  8293. this._sorted = true;
  8294. // Serves as infimum
  8295. this._last = {generatedLine: -1, generatedColumn: 0};
  8296. }
  8297. /**
  8298. * Iterate through internal items. This method takes the same arguments that
  8299. * `Array.prototype.forEach` takes.
  8300. *
  8301. * NOTE: The order of the mappings is NOT guaranteed.
  8302. */
  8303. MappingList.prototype.unsortedForEach =
  8304. function MappingList_forEach(aCallback, aThisArg) {
  8305. this._array.forEach(aCallback, aThisArg);
  8306. };
  8307. /**
  8308. * Add the given source mapping.
  8309. *
  8310. * @param Object aMapping
  8311. */
  8312. MappingList.prototype.add = function MappingList_add(aMapping) {
  8313. if (generatedPositionAfter(this._last, aMapping)) {
  8314. this._last = aMapping;
  8315. this._array.push(aMapping);
  8316. } else {
  8317. this._sorted = false;
  8318. this._array.push(aMapping);
  8319. }
  8320. };
  8321. /**
  8322. * Returns the flat, sorted array of mappings. The mappings are sorted by
  8323. * generated position.
  8324. *
  8325. * WARNING: This method returns internal data without copying, for
  8326. * performance. The return value must NOT be mutated, and should be treated as
  8327. * an immutable borrow. If you want to take ownership, you must make your own
  8328. * copy.
  8329. */
  8330. MappingList.prototype.toArray = function MappingList_toArray() {
  8331. if (!this._sorted) {
  8332. this._array.sort(util.compareByGeneratedPositionsInflated);
  8333. this._sorted = true;
  8334. }
  8335. return this._array;
  8336. };
  8337. var MappingList_1 = MappingList;
  8338. var mappingList = {
  8339. MappingList: MappingList_1
  8340. };
  8341. /* -*- Mode: js; js-indent-level: 2; -*- */
  8342. /*
  8343. * Copyright 2011 Mozilla Foundation and contributors
  8344. * Licensed under the New BSD license. See LICENSE or:
  8345. * http://opensource.org/licenses/BSD-3-Clause
  8346. */
  8347. var ArraySet$1 = arraySet.ArraySet;
  8348. var MappingList$1 = mappingList.MappingList;
  8349. /**
  8350. * An instance of the SourceMapGenerator represents a source map which is
  8351. * being built incrementally. You may pass an object with the following
  8352. * properties:
  8353. *
  8354. * - file: The filename of the generated source.
  8355. * - sourceRoot: A root for all relative URLs in this source map.
  8356. */
  8357. function SourceMapGenerator(aArgs) {
  8358. if (!aArgs) {
  8359. aArgs = {};
  8360. }
  8361. this._file = util.getArg(aArgs, 'file', null);
  8362. this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
  8363. this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
  8364. this._sources = new ArraySet$1();
  8365. this._names = new ArraySet$1();
  8366. this._mappings = new MappingList$1();
  8367. this._sourcesContents = null;
  8368. }
  8369. SourceMapGenerator.prototype._version = 3;
  8370. /**
  8371. * Creates a new SourceMapGenerator based on a SourceMapConsumer
  8372. *
  8373. * @param aSourceMapConsumer The SourceMap.
  8374. */
  8375. SourceMapGenerator.fromSourceMap =
  8376. function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
  8377. var sourceRoot = aSourceMapConsumer.sourceRoot;
  8378. var generator = new SourceMapGenerator({
  8379. file: aSourceMapConsumer.file,
  8380. sourceRoot: sourceRoot
  8381. });
  8382. aSourceMapConsumer.eachMapping(function (mapping) {
  8383. var newMapping = {
  8384. generated: {
  8385. line: mapping.generatedLine,
  8386. column: mapping.generatedColumn
  8387. }
  8388. };
  8389. if (mapping.source != null) {
  8390. newMapping.source = mapping.source;
  8391. if (sourceRoot != null) {
  8392. newMapping.source = util.relative(sourceRoot, newMapping.source);
  8393. }
  8394. newMapping.original = {
  8395. line: mapping.originalLine,
  8396. column: mapping.originalColumn
  8397. };
  8398. if (mapping.name != null) {
  8399. newMapping.name = mapping.name;
  8400. }
  8401. }
  8402. generator.addMapping(newMapping);
  8403. });
  8404. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  8405. var sourceRelative = sourceFile;
  8406. if (sourceRoot !== null) {
  8407. sourceRelative = util.relative(sourceRoot, sourceFile);
  8408. }
  8409. if (!generator._sources.has(sourceRelative)) {
  8410. generator._sources.add(sourceRelative);
  8411. }
  8412. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  8413. if (content != null) {
  8414. generator.setSourceContent(sourceFile, content);
  8415. }
  8416. });
  8417. return generator;
  8418. };
  8419. /**
  8420. * Add a single mapping from original source line and column to the generated
  8421. * source's line and column for this source map being created. The mapping
  8422. * object should have the following properties:
  8423. *
  8424. * - generated: An object with the generated line and column positions.
  8425. * - original: An object with the original line and column positions.
  8426. * - source: The original source file (relative to the sourceRoot).
  8427. * - name: An optional original token name for this mapping.
  8428. */
  8429. SourceMapGenerator.prototype.addMapping =
  8430. function SourceMapGenerator_addMapping(aArgs) {
  8431. var generated = util.getArg(aArgs, 'generated');
  8432. var original = util.getArg(aArgs, 'original', null);
  8433. var source = util.getArg(aArgs, 'source', null);
  8434. var name = util.getArg(aArgs, 'name', null);
  8435. if (!this._skipValidation) {
  8436. this._validateMapping(generated, original, source, name);
  8437. }
  8438. if (source != null) {
  8439. source = String(source);
  8440. if (!this._sources.has(source)) {
  8441. this._sources.add(source);
  8442. }
  8443. }
  8444. if (name != null) {
  8445. name = String(name);
  8446. if (!this._names.has(name)) {
  8447. this._names.add(name);
  8448. }
  8449. }
  8450. this._mappings.add({
  8451. generatedLine: generated.line,
  8452. generatedColumn: generated.column,
  8453. originalLine: original != null && original.line,
  8454. originalColumn: original != null && original.column,
  8455. source: source,
  8456. name: name
  8457. });
  8458. };
  8459. /**
  8460. * Set the source content for a source file.
  8461. */
  8462. SourceMapGenerator.prototype.setSourceContent =
  8463. function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
  8464. var source = aSourceFile;
  8465. if (this._sourceRoot != null) {
  8466. source = util.relative(this._sourceRoot, source);
  8467. }
  8468. if (aSourceContent != null) {
  8469. // Add the source content to the _sourcesContents map.
  8470. // Create a new _sourcesContents map if the property is null.
  8471. if (!this._sourcesContents) {
  8472. this._sourcesContents = Object.create(null);
  8473. }
  8474. this._sourcesContents[util.toSetString(source)] = aSourceContent;
  8475. } else if (this._sourcesContents) {
  8476. // Remove the source file from the _sourcesContents map.
  8477. // If the _sourcesContents map is empty, set the property to null.
  8478. delete this._sourcesContents[util.toSetString(source)];
  8479. if (Object.keys(this._sourcesContents).length === 0) {
  8480. this._sourcesContents = null;
  8481. }
  8482. }
  8483. };
  8484. /**
  8485. * Applies the mappings of a sub-source-map for a specific source file to the
  8486. * source map being generated. Each mapping to the supplied source file is
  8487. * rewritten using the supplied source map. Note: The resolution for the
  8488. * resulting mappings is the minimium of this map and the supplied map.
  8489. *
  8490. * @param aSourceMapConsumer The source map to be applied.
  8491. * @param aSourceFile Optional. The filename of the source file.
  8492. * If omitted, SourceMapConsumer's file property will be used.
  8493. * @param aSourceMapPath Optional. The dirname of the path to the source map
  8494. * to be applied. If relative, it is relative to the SourceMapConsumer.
  8495. * This parameter is needed when the two source maps aren't in the same
  8496. * directory, and the source map to be applied contains relative source
  8497. * paths. If so, those relative source paths need to be rewritten
  8498. * relative to the SourceMapGenerator.
  8499. */
  8500. SourceMapGenerator.prototype.applySourceMap =
  8501. function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
  8502. var sourceFile = aSourceFile;
  8503. // If aSourceFile is omitted, we will use the file property of the SourceMap
  8504. if (aSourceFile == null) {
  8505. if (aSourceMapConsumer.file == null) {
  8506. throw new Error(
  8507. 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
  8508. 'or the source map\'s "file" property. Both were omitted.'
  8509. );
  8510. }
  8511. sourceFile = aSourceMapConsumer.file;
  8512. }
  8513. var sourceRoot = this._sourceRoot;
  8514. // Make "sourceFile" relative if an absolute Url is passed.
  8515. if (sourceRoot != null) {
  8516. sourceFile = util.relative(sourceRoot, sourceFile);
  8517. }
  8518. // Applying the SourceMap can add and remove items from the sources and
  8519. // the names array.
  8520. var newSources = new ArraySet$1();
  8521. var newNames = new ArraySet$1();
  8522. // Find mappings for the "sourceFile"
  8523. this._mappings.unsortedForEach(function (mapping) {
  8524. if (mapping.source === sourceFile && mapping.originalLine != null) {
  8525. // Check if it can be mapped by the source map, then update the mapping.
  8526. var original = aSourceMapConsumer.originalPositionFor({
  8527. line: mapping.originalLine,
  8528. column: mapping.originalColumn
  8529. });
  8530. if (original.source != null) {
  8531. // Copy mapping
  8532. mapping.source = original.source;
  8533. if (aSourceMapPath != null) {
  8534. mapping.source = util.join(aSourceMapPath, mapping.source);
  8535. }
  8536. if (sourceRoot != null) {
  8537. mapping.source = util.relative(sourceRoot, mapping.source);
  8538. }
  8539. mapping.originalLine = original.line;
  8540. mapping.originalColumn = original.column;
  8541. if (original.name != null) {
  8542. mapping.name = original.name;
  8543. }
  8544. }
  8545. }
  8546. var source = mapping.source;
  8547. if (source != null && !newSources.has(source)) {
  8548. newSources.add(source);
  8549. }
  8550. var name = mapping.name;
  8551. if (name != null && !newNames.has(name)) {
  8552. newNames.add(name);
  8553. }
  8554. }, this);
  8555. this._sources = newSources;
  8556. this._names = newNames;
  8557. // Copy sourcesContents of applied map.
  8558. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  8559. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  8560. if (content != null) {
  8561. if (aSourceMapPath != null) {
  8562. sourceFile = util.join(aSourceMapPath, sourceFile);
  8563. }
  8564. if (sourceRoot != null) {
  8565. sourceFile = util.relative(sourceRoot, sourceFile);
  8566. }
  8567. this.setSourceContent(sourceFile, content);
  8568. }
  8569. }, this);
  8570. };
  8571. /**
  8572. * A mapping can have one of the three levels of data:
  8573. *
  8574. * 1. Just the generated position.
  8575. * 2. The Generated position, original position, and original source.
  8576. * 3. Generated and original position, original source, as well as a name
  8577. * token.
  8578. *
  8579. * To maintain consistency, we validate that any new mapping being added falls
  8580. * in to one of these categories.
  8581. */
  8582. SourceMapGenerator.prototype._validateMapping =
  8583. function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
  8584. aName) {
  8585. // When aOriginal is truthy but has empty values for .line and .column,
  8586. // it is most likely a programmer error. In this case we throw a very
  8587. // specific error message to try to guide them the right way.
  8588. // For example: https://github.com/Polymer/polymer-bundler/pull/519
  8589. if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
  8590. throw new Error(
  8591. 'original.line and original.column are not numbers -- you probably meant to omit ' +
  8592. 'the original mapping entirely and only map the generated position. If so, pass ' +
  8593. 'null for the original mapping instead of an object with empty or null values.'
  8594. );
  8595. }
  8596. if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  8597. && aGenerated.line > 0 && aGenerated.column >= 0
  8598. && !aOriginal && !aSource && !aName) {
  8599. // Case 1.
  8600. return;
  8601. }
  8602. else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  8603. && aOriginal && 'line' in aOriginal && 'column' in aOriginal
  8604. && aGenerated.line > 0 && aGenerated.column >= 0
  8605. && aOriginal.line > 0 && aOriginal.column >= 0
  8606. && aSource) {
  8607. // Cases 2 and 3.
  8608. return;
  8609. }
  8610. else {
  8611. throw new Error('Invalid mapping: ' + JSON.stringify({
  8612. generated: aGenerated,
  8613. source: aSource,
  8614. original: aOriginal,
  8615. name: aName
  8616. }));
  8617. }
  8618. };
  8619. /**
  8620. * Serialize the accumulated mappings in to the stream of base 64 VLQs
  8621. * specified by the source map format.
  8622. */
  8623. SourceMapGenerator.prototype._serializeMappings =
  8624. function SourceMapGenerator_serializeMappings() {
  8625. var previousGeneratedColumn = 0;
  8626. var previousGeneratedLine = 1;
  8627. var previousOriginalColumn = 0;
  8628. var previousOriginalLine = 0;
  8629. var previousName = 0;
  8630. var previousSource = 0;
  8631. var result = '';
  8632. var next;
  8633. var mapping;
  8634. var nameIdx;
  8635. var sourceIdx;
  8636. var mappings = this._mappings.toArray();
  8637. for (var i = 0, len = mappings.length; i < len; i++) {
  8638. mapping = mappings[i];
  8639. next = '';
  8640. if (mapping.generatedLine !== previousGeneratedLine) {
  8641. previousGeneratedColumn = 0;
  8642. while (mapping.generatedLine !== previousGeneratedLine) {
  8643. next += ';';
  8644. previousGeneratedLine++;
  8645. }
  8646. }
  8647. else {
  8648. if (i > 0) {
  8649. if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
  8650. continue;
  8651. }
  8652. next += ',';
  8653. }
  8654. }
  8655. next += base64Vlq.encode(mapping.generatedColumn
  8656. - previousGeneratedColumn);
  8657. previousGeneratedColumn = mapping.generatedColumn;
  8658. if (mapping.source != null) {
  8659. sourceIdx = this._sources.indexOf(mapping.source);
  8660. next += base64Vlq.encode(sourceIdx - previousSource);
  8661. previousSource = sourceIdx;
  8662. // lines are stored 0-based in SourceMap spec version 3
  8663. next += base64Vlq.encode(mapping.originalLine - 1
  8664. - previousOriginalLine);
  8665. previousOriginalLine = mapping.originalLine - 1;
  8666. next += base64Vlq.encode(mapping.originalColumn
  8667. - previousOriginalColumn);
  8668. previousOriginalColumn = mapping.originalColumn;
  8669. if (mapping.name != null) {
  8670. nameIdx = this._names.indexOf(mapping.name);
  8671. next += base64Vlq.encode(nameIdx - previousName);
  8672. previousName = nameIdx;
  8673. }
  8674. }
  8675. result += next;
  8676. }
  8677. return result;
  8678. };
  8679. SourceMapGenerator.prototype._generateSourcesContent =
  8680. function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
  8681. return aSources.map(function (source) {
  8682. if (!this._sourcesContents) {
  8683. return null;
  8684. }
  8685. if (aSourceRoot != null) {
  8686. source = util.relative(aSourceRoot, source);
  8687. }
  8688. var key = util.toSetString(source);
  8689. return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
  8690. ? this._sourcesContents[key]
  8691. : null;
  8692. }, this);
  8693. };
  8694. /**
  8695. * Externalize the source map.
  8696. */
  8697. SourceMapGenerator.prototype.toJSON =
  8698. function SourceMapGenerator_toJSON() {
  8699. var map = {
  8700. version: this._version,
  8701. sources: this._sources.toArray(),
  8702. names: this._names.toArray(),
  8703. mappings: this._serializeMappings()
  8704. };
  8705. if (this._file != null) {
  8706. map.file = this._file;
  8707. }
  8708. if (this._sourceRoot != null) {
  8709. map.sourceRoot = this._sourceRoot;
  8710. }
  8711. if (this._sourcesContents) {
  8712. map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
  8713. }
  8714. return map;
  8715. };
  8716. /**
  8717. * Render the source map being generated to a string.
  8718. */
  8719. SourceMapGenerator.prototype.toString =
  8720. function SourceMapGenerator_toString() {
  8721. return JSON.stringify(this.toJSON());
  8722. };
  8723. var SourceMapGenerator_1 = SourceMapGenerator;
  8724. var sourceMapGenerator = {
  8725. SourceMapGenerator: SourceMapGenerator_1
  8726. };
  8727. var SourceMapGenerator$1 = sourceMapGenerator.SourceMapGenerator;
  8728. var trackNodes = {
  8729. Atrule: true,
  8730. Selector: true,
  8731. Declaration: true
  8732. };
  8733. var sourceMap = function generateSourceMap(handlers) {
  8734. var map = new SourceMapGenerator$1();
  8735. var line = 1;
  8736. var column = 0;
  8737. var generated = {
  8738. line: 1,
  8739. column: 0
  8740. };
  8741. var original = {
  8742. line: 0, // should be zero to add first mapping
  8743. column: 0
  8744. };
  8745. var sourceMappingActive = false;
  8746. var activatedGenerated = {
  8747. line: 1,
  8748. column: 0
  8749. };
  8750. var activatedMapping = {
  8751. generated: activatedGenerated
  8752. };
  8753. var handlersNode = handlers.node;
  8754. handlers.node = function(node) {
  8755. if (node.loc && node.loc.start && trackNodes.hasOwnProperty(node.type)) {
  8756. var nodeLine = node.loc.start.line;
  8757. var nodeColumn = node.loc.start.column - 1;
  8758. if (original.line !== nodeLine ||
  8759. original.column !== nodeColumn) {
  8760. original.line = nodeLine;
  8761. original.column = nodeColumn;
  8762. generated.line = line;
  8763. generated.column = column;
  8764. if (sourceMappingActive) {
  8765. sourceMappingActive = false;
  8766. if (generated.line !== activatedGenerated.line ||
  8767. generated.column !== activatedGenerated.column) {
  8768. map.addMapping(activatedMapping);
  8769. }
  8770. }
  8771. sourceMappingActive = true;
  8772. map.addMapping({
  8773. source: node.loc.source,
  8774. original: original,
  8775. generated: generated
  8776. });
  8777. }
  8778. }
  8779. handlersNode.call(this, node);
  8780. if (sourceMappingActive && trackNodes.hasOwnProperty(node.type)) {
  8781. activatedGenerated.line = line;
  8782. activatedGenerated.column = column;
  8783. }
  8784. };
  8785. var handlersChunk = handlers.chunk;
  8786. handlers.chunk = function(chunk) {
  8787. for (var i = 0; i < chunk.length; i++) {
  8788. if (chunk.charCodeAt(i) === 10) { // \n
  8789. line++;
  8790. column = 0;
  8791. } else {
  8792. column++;
  8793. }
  8794. }
  8795. handlersChunk(chunk);
  8796. };
  8797. var handlersResult = handlers.result;
  8798. handlers.result = function() {
  8799. if (sourceMappingActive) {
  8800. map.addMapping(activatedMapping);
  8801. }
  8802. return {
  8803. css: handlersResult(),
  8804. map: map
  8805. };
  8806. };
  8807. return handlers;
  8808. };
  8809. var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
  8810. function processChildren(node, delimeter) {
  8811. var list = node.children;
  8812. var prev = null;
  8813. if (typeof delimeter !== 'function') {
  8814. list.forEach(this.node, this);
  8815. } else {
  8816. list.forEach(function(node) {
  8817. if (prev !== null) {
  8818. delimeter.call(this, prev);
  8819. }
  8820. this.node(node);
  8821. prev = node;
  8822. }, this);
  8823. }
  8824. }
  8825. var create$2 = function createGenerator(config) {
  8826. function processNode(node) {
  8827. if (hasOwnProperty$3.call(types, node.type)) {
  8828. types[node.type].call(this, node);
  8829. } else {
  8830. throw new Error('Unknown node type: ' + node.type);
  8831. }
  8832. }
  8833. var types = {};
  8834. if (config.node) {
  8835. for (var name in config.node) {
  8836. types[name] = config.node[name].generate;
  8837. }
  8838. }
  8839. return function(node, options) {
  8840. var buffer = '';
  8841. var handlers = {
  8842. children: processChildren,
  8843. node: processNode,
  8844. chunk: function(chunk) {
  8845. buffer += chunk;
  8846. },
  8847. result: function() {
  8848. return buffer;
  8849. }
  8850. };
  8851. if (options) {
  8852. if (typeof options.decorator === 'function') {
  8853. handlers = options.decorator(handlers);
  8854. }
  8855. if (options.sourceMap) {
  8856. handlers = sourceMap(handlers);
  8857. }
  8858. }
  8859. handlers.node(node);
  8860. return handlers.result();
  8861. };
  8862. };
  8863. var create$3 = function createConvertors(walk) {
  8864. return {
  8865. fromPlainObject: function(ast) {
  8866. walk(ast, {
  8867. enter: function(node) {
  8868. if (node.children && node.children instanceof List_1 === false) {
  8869. node.children = new List_1().fromArray(node.children);
  8870. }
  8871. }
  8872. });
  8873. return ast;
  8874. },
  8875. toPlainObject: function(ast) {
  8876. walk(ast, {
  8877. leave: function(node) {
  8878. if (node.children && node.children instanceof List_1) {
  8879. node.children = node.children.toArray();
  8880. }
  8881. }
  8882. });
  8883. return ast;
  8884. }
  8885. };
  8886. };
  8887. var hasOwnProperty$4 = Object.prototype.hasOwnProperty;
  8888. var noop$4 = function() {};
  8889. function ensureFunction$1(value) {
  8890. return typeof value === 'function' ? value : noop$4;
  8891. }
  8892. function invokeForType(fn, type) {
  8893. return function(node, item, list) {
  8894. if (node.type === type) {
  8895. fn.call(this, node, item, list);
  8896. }
  8897. };
  8898. }
  8899. function getWalkersFromStructure(name, nodeType) {
  8900. var structure = nodeType.structure;
  8901. var walkers = [];
  8902. for (var key in structure) {
  8903. if (hasOwnProperty$4.call(structure, key) === false) {
  8904. continue;
  8905. }
  8906. var fieldTypes = structure[key];
  8907. var walker = {
  8908. name: key,
  8909. type: false,
  8910. nullable: false
  8911. };
  8912. if (!Array.isArray(structure[key])) {
  8913. fieldTypes = [structure[key]];
  8914. }
  8915. for (var i = 0; i < fieldTypes.length; i++) {
  8916. var fieldType = fieldTypes[i];
  8917. if (fieldType === null) {
  8918. walker.nullable = true;
  8919. } else if (typeof fieldType === 'string') {
  8920. walker.type = 'node';
  8921. } else if (Array.isArray(fieldType)) {
  8922. walker.type = 'list';
  8923. }
  8924. }
  8925. if (walker.type) {
  8926. walkers.push(walker);
  8927. }
  8928. }
  8929. if (walkers.length) {
  8930. return {
  8931. context: nodeType.walkContext,
  8932. fields: walkers
  8933. };
  8934. }
  8935. return null;
  8936. }
  8937. function getTypesFromConfig(config) {
  8938. var types = {};
  8939. for (var name in config.node) {
  8940. if (hasOwnProperty$4.call(config.node, name)) {
  8941. var nodeType = config.node[name];
  8942. if (!nodeType.structure) {
  8943. throw new Error('Missed `structure` field in `' + name + '` node type definition');
  8944. }
  8945. types[name] = getWalkersFromStructure(name, nodeType);
  8946. }
  8947. }
  8948. return types;
  8949. }
  8950. function createTypeIterator(config, reverse) {
  8951. var fields = config.fields.slice();
  8952. var contextName = config.context;
  8953. var useContext = typeof contextName === 'string';
  8954. if (reverse) {
  8955. fields.reverse();
  8956. }
  8957. return function(node, context, walk) {
  8958. var prevContextValue;
  8959. if (useContext) {
  8960. prevContextValue = context[contextName];
  8961. context[contextName] = node;
  8962. }
  8963. for (var i = 0; i < fields.length; i++) {
  8964. var field = fields[i];
  8965. var ref = node[field.name];
  8966. if (!field.nullable || ref) {
  8967. if (field.type === 'list') {
  8968. if (reverse) {
  8969. ref.forEachRight(walk);
  8970. } else {
  8971. ref.forEach(walk);
  8972. }
  8973. } else {
  8974. walk(ref);
  8975. }
  8976. }
  8977. }
  8978. if (useContext) {
  8979. context[contextName] = prevContextValue;
  8980. }
  8981. };
  8982. }
  8983. function createFastTraveralMap(iterators) {
  8984. return {
  8985. Atrule: {
  8986. StyleSheet: iterators.StyleSheet,
  8987. Atrule: iterators.Atrule,
  8988. Rule: iterators.Rule,
  8989. Block: iterators.Block
  8990. },
  8991. Rule: {
  8992. StyleSheet: iterators.StyleSheet,
  8993. Atrule: iterators.Atrule,
  8994. Rule: iterators.Rule,
  8995. Block: iterators.Block
  8996. },
  8997. Declaration: {
  8998. StyleSheet: iterators.StyleSheet,
  8999. Atrule: iterators.Atrule,
  9000. Rule: iterators.Rule,
  9001. Block: iterators.Block,
  9002. DeclarationList: iterators.DeclarationList
  9003. }
  9004. };
  9005. }
  9006. var create$4 = function createWalker(config) {
  9007. var types = getTypesFromConfig(config);
  9008. var iteratorsNatural = {};
  9009. var iteratorsReverse = {};
  9010. for (var name in types) {
  9011. if (hasOwnProperty$4.call(types, name) && types[name] !== null) {
  9012. iteratorsNatural[name] = createTypeIterator(types[name], false);
  9013. iteratorsReverse[name] = createTypeIterator(types[name], true);
  9014. }
  9015. }
  9016. var fastTraversalIteratorsNatural = createFastTraveralMap(iteratorsNatural);
  9017. var fastTraversalIteratorsReverse = createFastTraveralMap(iteratorsReverse);
  9018. var walk = function(root, options) {
  9019. function walkNode(node, item, list) {
  9020. enter.call(context, node, item, list);
  9021. if (iterators.hasOwnProperty(node.type)) {
  9022. iterators[node.type](node, context, walkNode);
  9023. }
  9024. leave.call(context, node, item, list);
  9025. }
  9026. var enter = noop$4;
  9027. var leave = noop$4;
  9028. var iterators = iteratorsNatural;
  9029. var context = {
  9030. root: root,
  9031. stylesheet: null,
  9032. atrule: null,
  9033. atrulePrelude: null,
  9034. rule: null,
  9035. selector: null,
  9036. block: null,
  9037. declaration: null,
  9038. function: null
  9039. };
  9040. if (typeof options === 'function') {
  9041. enter = options;
  9042. } else if (options) {
  9043. enter = ensureFunction$1(options.enter);
  9044. leave = ensureFunction$1(options.leave);
  9045. if (options.reverse) {
  9046. iterators = iteratorsReverse;
  9047. }
  9048. if (options.visit) {
  9049. if (fastTraversalIteratorsNatural.hasOwnProperty(options.visit)) {
  9050. iterators = options.reverse
  9051. ? fastTraversalIteratorsReverse[options.visit]
  9052. : fastTraversalIteratorsNatural[options.visit];
  9053. } else if (!types.hasOwnProperty(options.visit)) {
  9054. throw new Error('Bad value `' + options.visit + '` for `visit` option (should be: ' + Object.keys(types).join(', ') + ')');
  9055. }
  9056. enter = invokeForType(enter, options.visit);
  9057. leave = invokeForType(leave, options.visit);
  9058. }
  9059. }
  9060. if (enter === noop$4 && leave === noop$4) {
  9061. throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function');
  9062. }
  9063. // swap handlers in reverse mode to invert visit order
  9064. if (options.reverse) {
  9065. var tmp = enter;
  9066. enter = leave;
  9067. leave = tmp;
  9068. }
  9069. walkNode(root);
  9070. };
  9071. walk.find = function(ast, fn) {
  9072. var found = null;
  9073. walk(ast, function(node, item, list) {
  9074. if (found === null && fn.call(this, node, item, list)) {
  9075. found = node;
  9076. }
  9077. });
  9078. return found;
  9079. };
  9080. walk.findLast = function(ast, fn) {
  9081. var found = null;
  9082. walk(ast, {
  9083. reverse: true,
  9084. enter: function(node, item, list) {
  9085. if (found === null && fn.call(this, node, item, list)) {
  9086. found = node;
  9087. }
  9088. }
  9089. });
  9090. return found;
  9091. };
  9092. walk.findAll = function(ast, fn) {
  9093. var found = [];
  9094. walk(ast, function(node, item, list) {
  9095. if (fn.call(this, node, item, list)) {
  9096. found.push(node);
  9097. }
  9098. });
  9099. return found;
  9100. };
  9101. return walk;
  9102. };
  9103. var clone = function clone(node) {
  9104. var result = {};
  9105. for (var key in node) {
  9106. var value = node[key];
  9107. if (value) {
  9108. if (Array.isArray(value) || value instanceof List_1) {
  9109. value = value.map(clone);
  9110. } else if (value.constructor === Object) {
  9111. value = clone(value);
  9112. }
  9113. }
  9114. result[key] = value;
  9115. }
  9116. return result;
  9117. };
  9118. var hasOwnProperty$5 = Object.prototype.hasOwnProperty;
  9119. var shape = {
  9120. generic: true,
  9121. types: {},
  9122. atrules: {},
  9123. properties: {},
  9124. parseContext: {},
  9125. scope: {},
  9126. atrule: ['parse'],
  9127. pseudo: ['parse'],
  9128. node: ['name', 'structure', 'parse', 'generate', 'walkContext']
  9129. };
  9130. function isObject(value) {
  9131. return value && value.constructor === Object;
  9132. }
  9133. function copy(value) {
  9134. if (isObject(value)) {
  9135. return Object.assign({}, value);
  9136. } else {
  9137. return value;
  9138. }
  9139. }
  9140. function extend(dest, src) {
  9141. for (var key in src) {
  9142. if (hasOwnProperty$5.call(src, key)) {
  9143. if (isObject(dest[key])) {
  9144. extend(dest[key], copy(src[key]));
  9145. } else {
  9146. dest[key] = copy(src[key]);
  9147. }
  9148. }
  9149. }
  9150. }
  9151. function mix(dest, src, shape) {
  9152. for (var key in shape) {
  9153. if (hasOwnProperty$5.call(shape, key) === false) {
  9154. continue;
  9155. }
  9156. if (shape[key] === true) {
  9157. if (key in src) {
  9158. if (hasOwnProperty$5.call(src, key)) {
  9159. dest[key] = copy(src[key]);
  9160. }
  9161. }
  9162. } else if (shape[key]) {
  9163. if (isObject(shape[key])) {
  9164. var res = {};
  9165. extend(res, dest[key]);
  9166. extend(res, src[key]);
  9167. dest[key] = res;
  9168. } else if (Array.isArray(shape[key])) {
  9169. var res = {};
  9170. var innerShape = shape[key].reduce(function(s, k) {
  9171. s[k] = true;
  9172. return s;
  9173. }, {});
  9174. for (var name in dest[key]) {
  9175. if (hasOwnProperty$5.call(dest[key], name)) {
  9176. res[name] = {};
  9177. if (dest[key] && dest[key][name]) {
  9178. mix(res[name], dest[key][name], innerShape);
  9179. }
  9180. }
  9181. }
  9182. for (var name in src[key]) {
  9183. if (hasOwnProperty$5.call(src[key], name)) {
  9184. if (!res[name]) {
  9185. res[name] = {};
  9186. }
  9187. if (src[key] && src[key][name]) {
  9188. mix(res[name], src[key][name], innerShape);
  9189. }
  9190. }
  9191. }
  9192. dest[key] = res;
  9193. }
  9194. }
  9195. }
  9196. return dest;
  9197. }
  9198. var mix_1 = function(dest, src) {
  9199. return mix(dest, src, shape);
  9200. };
  9201. function createSyntax(config) {
  9202. var parse = create$1(config);
  9203. var walk = create$4(config);
  9204. var generate = create$2(config);
  9205. var convert = create$3(walk);
  9206. var syntax = {
  9207. List: List_1,
  9208. SyntaxError: _SyntaxError,
  9209. TokenStream: TokenStream_1,
  9210. Lexer: Lexer_1,
  9211. vendorPrefix: names.vendorPrefix,
  9212. keyword: names.keyword,
  9213. property: names.property,
  9214. isCustomProperty: names.isCustomProperty,
  9215. definitionSyntax: definitionSyntax,
  9216. lexer: null,
  9217. createLexer: function(config) {
  9218. return new Lexer_1(config, syntax, syntax.lexer.structure);
  9219. },
  9220. tokenize: tokenizer,
  9221. parse: parse,
  9222. walk: walk,
  9223. generate: generate,
  9224. find: walk.find,
  9225. findLast: walk.findLast,
  9226. findAll: walk.findAll,
  9227. clone: clone,
  9228. fromPlainObject: convert.fromPlainObject,
  9229. toPlainObject: convert.toPlainObject,
  9230. createSyntax: function(config) {
  9231. return createSyntax(mix_1({}, config));
  9232. },
  9233. fork: function(extension) {
  9234. var base = mix_1({}, config); // copy of config
  9235. return createSyntax(
  9236. typeof extension === 'function'
  9237. ? extension(base, Object.assign)
  9238. : mix_1(base, extension)
  9239. );
  9240. }
  9241. };
  9242. syntax.lexer = new Lexer_1({
  9243. generic: true,
  9244. types: config.types,
  9245. atrules: config.atrules,
  9246. properties: config.properties,
  9247. node: config.node
  9248. }, syntax);
  9249. return syntax;
  9250. }
  9251. var create_1 = function(config) {
  9252. return createSyntax(mix_1({}, config));
  9253. };
  9254. var create$5 = {
  9255. create: create_1
  9256. };
  9257. var atRules = {
  9258. "@charset": {
  9259. syntax: "@charset \"<charset>\";",
  9260. groups: [
  9261. "CSS Charsets"
  9262. ],
  9263. status: "standard",
  9264. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@charset"
  9265. },
  9266. "@counter-style": {
  9267. syntax: "@counter-style <counter-style-name> {\n [ system: <counter-system>; ] ||\n [ symbols: <counter-symbols>; ] ||\n [ additive-symbols: <additive-symbols>; ] ||\n [ negative: <negative-symbol>; ] ||\n [ prefix: <prefix>; ] ||\n [ suffix: <suffix>; ] ||\n [ range: <range>; ] ||\n [ pad: <padding>; ] ||\n [ speak-as: <speak-as>; ] ||\n [ fallback: <counter-style-name>; ]\n}",
  9268. interfaces: [
  9269. "CSSCounterStyleRule"
  9270. ],
  9271. groups: [
  9272. "CSS Counter Styles"
  9273. ],
  9274. descriptors: {
  9275. "additive-symbols": {
  9276. syntax: "[ <integer> && <symbol> ]#",
  9277. media: "all",
  9278. initial: "N/A",
  9279. percentages: "no",
  9280. computed: "asSpecified",
  9281. order: "orderOfAppearance",
  9282. status: "standard"
  9283. },
  9284. fallback: {
  9285. syntax: "<counter-style-name>",
  9286. media: "all",
  9287. initial: "decimal",
  9288. percentages: "no",
  9289. computed: "asSpecified",
  9290. order: "uniqueOrder",
  9291. status: "standard"
  9292. },
  9293. negative: {
  9294. syntax: "<symbol> <symbol>?",
  9295. media: "all",
  9296. initial: "\"-\" hyphen-minus",
  9297. percentages: "no",
  9298. computed: "asSpecified",
  9299. order: "orderOfAppearance",
  9300. status: "standard"
  9301. },
  9302. pad: {
  9303. syntax: "<integer> && <symbol>",
  9304. media: "all",
  9305. initial: "0 \"\"",
  9306. percentages: "no",
  9307. computed: "asSpecified",
  9308. order: "uniqueOrder",
  9309. status: "standard"
  9310. },
  9311. prefix: {
  9312. syntax: "<symbol>",
  9313. media: "all",
  9314. initial: "\"\"",
  9315. percentages: "no",
  9316. computed: "asSpecified",
  9317. order: "uniqueOrder",
  9318. status: "standard"
  9319. },
  9320. range: {
  9321. syntax: "[ [ <integer> | infinite ]{2} ]# | auto",
  9322. media: "all",
  9323. initial: "auto",
  9324. percentages: "no",
  9325. computed: "asSpecified",
  9326. order: "orderOfAppearance",
  9327. status: "standard"
  9328. },
  9329. "speak-as": {
  9330. syntax: "auto | bullets | numbers | words | spell-out | <counter-style-name>",
  9331. media: "all",
  9332. initial: "auto",
  9333. percentages: "no",
  9334. computed: "asSpecified",
  9335. order: "uniqueOrder",
  9336. status: "standard"
  9337. },
  9338. suffix: {
  9339. syntax: "<symbol>",
  9340. media: "all",
  9341. initial: "\". \"",
  9342. percentages: "no",
  9343. computed: "asSpecified",
  9344. order: "uniqueOrder",
  9345. status: "standard"
  9346. },
  9347. symbols: {
  9348. syntax: "<symbol>+",
  9349. media: "all",
  9350. initial: "N/A",
  9351. percentages: "no",
  9352. computed: "asSpecified",
  9353. order: "orderOfAppearance",
  9354. status: "standard"
  9355. },
  9356. system: {
  9357. syntax: "cyclic | numeric | alphabetic | symbolic | additive | [ fixed <integer>? ] | [ extends <counter-style-name> ]",
  9358. media: "all",
  9359. initial: "symbolic",
  9360. percentages: "no",
  9361. computed: "asSpecified",
  9362. order: "uniqueOrder",
  9363. status: "standard"
  9364. }
  9365. },
  9366. status: "standard",
  9367. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@counter-style"
  9368. },
  9369. "@document": {
  9370. syntax: "@document [ <url> | url-prefix(<string>) | domain(<string>) | media-document(<string>) | regexp(<string>) ]# {\n <group-rule-body>\n}",
  9371. interfaces: [
  9372. "CSSGroupingRule",
  9373. "CSSConditionRule"
  9374. ],
  9375. groups: [
  9376. "CSS Conditional Rules"
  9377. ],
  9378. status: "nonstandard",
  9379. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@document"
  9380. },
  9381. "@font-face": {
  9382. syntax: "@font-face {\n [ font-family: <family-name>; ] ||\n [ src: <src>; ] ||\n [ unicode-range: <unicode-range>; ] ||\n [ font-variant: <font-variant>; ] ||\n [ font-feature-settings: <font-feature-settings>; ] ||\n [ font-variation-settings: <font-variation-settings>; ] ||\n [ font-stretch: <font-stretch>; ] ||\n [ font-weight: <font-weight>; ] ||\n [ font-style: <font-style>; ]\n}",
  9383. interfaces: [
  9384. "CSSFontFaceRule"
  9385. ],
  9386. groups: [
  9387. "CSS Fonts"
  9388. ],
  9389. descriptors: {
  9390. "font-display": {
  9391. syntax: "[ auto | block | swap | fallback | optional ]",
  9392. media: "visual",
  9393. percentages: "no",
  9394. initial: "auto",
  9395. computed: "asSpecified",
  9396. order: "uniqueOrder",
  9397. status: "experimental"
  9398. },
  9399. "font-family": {
  9400. syntax: "<family-name>",
  9401. media: "all",
  9402. initial: "n/a (required)",
  9403. percentages: "no",
  9404. computed: "asSpecified",
  9405. order: "uniqueOrder",
  9406. status: "standard"
  9407. },
  9408. "font-feature-settings": {
  9409. syntax: "normal | <feature-tag-value>#",
  9410. media: "all",
  9411. initial: "normal",
  9412. percentages: "no",
  9413. computed: "asSpecified",
  9414. order: "orderOfAppearance",
  9415. status: "standard"
  9416. },
  9417. "font-variation-settings": {
  9418. syntax: "normal | [ <string> <number> ]#",
  9419. media: "all",
  9420. initial: "normal",
  9421. percentages: "no",
  9422. computed: "asSpecified",
  9423. order: "orderOfAppearance",
  9424. status: "standard"
  9425. },
  9426. "font-stretch": {
  9427. syntax: "<font-stretch-absolute>{1,2}",
  9428. media: "all",
  9429. initial: "normal",
  9430. percentages: "no",
  9431. computed: "asSpecified",
  9432. order: "uniqueOrder",
  9433. status: "standard"
  9434. },
  9435. "font-style": {
  9436. syntax: "normal | italic | oblique <angle>{0,2}",
  9437. media: "all",
  9438. initial: "normal",
  9439. percentages: "no",
  9440. computed: "asSpecified",
  9441. order: "uniqueOrder",
  9442. status: "standard"
  9443. },
  9444. "font-weight": {
  9445. syntax: "<font-weight-absolute>{1,2}",
  9446. media: "all",
  9447. initial: "normal",
  9448. percentages: "no",
  9449. computed: "asSpecified",
  9450. order: "uniqueOrder",
  9451. status: "standard"
  9452. },
  9453. "font-variant": {
  9454. syntax: "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic(<feature-value-name>) || historical-forms || styleset(<feature-value-name>#) || character-variant(<feature-value-name>#) || swash(<feature-value-name>) || ornaments(<feature-value-name>) || annotation(<feature-value-name>) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-width-values> || ruby ]",
  9455. media: "all",
  9456. initial: "normal",
  9457. percentages: "no",
  9458. computed: "asSpecified",
  9459. order: "orderOfAppearance",
  9460. status: "standard"
  9461. },
  9462. src: {
  9463. syntax: "[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#",
  9464. media: "all",
  9465. initial: "n/a (required)",
  9466. percentages: "no",
  9467. computed: "asSpecified",
  9468. order: "orderOfAppearance",
  9469. status: "standard"
  9470. },
  9471. "unicode-range": {
  9472. syntax: "<unicode-range>#",
  9473. media: "all",
  9474. initial: "U+0-10FFFF",
  9475. percentages: "no",
  9476. computed: "asSpecified",
  9477. order: "orderOfAppearance",
  9478. status: "standard"
  9479. }
  9480. },
  9481. status: "standard",
  9482. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@font-face"
  9483. },
  9484. "@font-feature-values": {
  9485. syntax: "@font-feature-values <family-name># {\n <feature-value-block-list>\n}",
  9486. interfaces: [
  9487. "CSSFontFeatureValuesRule"
  9488. ],
  9489. groups: [
  9490. "CSS Fonts"
  9491. ],
  9492. status: "standard",
  9493. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@font-feature-values"
  9494. },
  9495. "@import": {
  9496. syntax: "@import [ <string> | <url> ] [ <media-query-list> ]?;",
  9497. groups: [
  9498. "Media Queries"
  9499. ],
  9500. status: "standard",
  9501. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@import"
  9502. },
  9503. "@keyframes": {
  9504. syntax: "@keyframes <keyframes-name> {\n <keyframe-block-list>\n}",
  9505. interfaces: [
  9506. "CSSKeyframeRule",
  9507. "CSSKeyframesRule"
  9508. ],
  9509. groups: [
  9510. "CSS Animations"
  9511. ],
  9512. status: "standard",
  9513. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@keyframes"
  9514. },
  9515. "@media": {
  9516. syntax: "@media <media-query-list> {\n <group-rule-body>\n}",
  9517. interfaces: [
  9518. "CSSGroupingRule",
  9519. "CSSConditionRule",
  9520. "CSSMediaRule",
  9521. "CSSCustomMediaRule"
  9522. ],
  9523. groups: [
  9524. "CSS Conditional Rules",
  9525. "Media Queries"
  9526. ],
  9527. status: "standard",
  9528. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@media"
  9529. },
  9530. "@namespace": {
  9531. syntax: "@namespace <namespace-prefix>? [ <string> | <url> ];",
  9532. groups: [
  9533. "CSS Namespaces"
  9534. ],
  9535. status: "standard",
  9536. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@namespace"
  9537. },
  9538. "@page": {
  9539. syntax: "@page <page-selector-list> {\n <page-body>\n}",
  9540. interfaces: [
  9541. "CSSPageRule"
  9542. ],
  9543. groups: [
  9544. "CSS Pages"
  9545. ],
  9546. descriptors: {
  9547. bleed: {
  9548. syntax: "auto | <length>",
  9549. media: [
  9550. "visual",
  9551. "paged"
  9552. ],
  9553. initial: "auto",
  9554. percentages: "no",
  9555. computed: "asSpecified",
  9556. order: "uniqueOrder",
  9557. status: "experimental"
  9558. },
  9559. marks: {
  9560. syntax: "none | [ crop || cross ]",
  9561. media: [
  9562. "visual",
  9563. "paged"
  9564. ],
  9565. initial: "none",
  9566. percentages: "no",
  9567. computed: "asSpecified",
  9568. order: "orderOfAppearance",
  9569. status: "experimental"
  9570. }
  9571. },
  9572. status: "standard",
  9573. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@page"
  9574. },
  9575. "@supports": {
  9576. syntax: "@supports <supports-condition> {\n <group-rule-body>\n}",
  9577. interfaces: [
  9578. "CSSGroupingRule",
  9579. "CSSConditionRule",
  9580. "CSSSupportsRule"
  9581. ],
  9582. groups: [
  9583. "CSS Conditional Rules"
  9584. ],
  9585. status: "standard",
  9586. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@supports"
  9587. },
  9588. "@viewport": {
  9589. syntax: "@viewport {\n <group-rule-body>\n}",
  9590. interfaces: [
  9591. "CSSViewportRule"
  9592. ],
  9593. groups: [
  9594. "CSS Device Adaptation"
  9595. ],
  9596. descriptors: {
  9597. height: {
  9598. syntax: "<viewport-length>{1,2}",
  9599. media: [
  9600. "visual",
  9601. "continuous"
  9602. ],
  9603. initial: [
  9604. "min-height",
  9605. "max-height"
  9606. ],
  9607. percentages: [
  9608. "min-height",
  9609. "max-height"
  9610. ],
  9611. computed: [
  9612. "min-height",
  9613. "max-height"
  9614. ],
  9615. order: "orderOfAppearance",
  9616. status: "standard"
  9617. },
  9618. "max-height": {
  9619. syntax: "<viewport-length>",
  9620. media: [
  9621. "visual",
  9622. "continuous"
  9623. ],
  9624. initial: "auto",
  9625. percentages: "referToHeightOfInitialViewport",
  9626. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  9627. order: "uniqueOrder",
  9628. status: "standard"
  9629. },
  9630. "max-width": {
  9631. syntax: "<viewport-length>",
  9632. media: [
  9633. "visual",
  9634. "continuous"
  9635. ],
  9636. initial: "auto",
  9637. percentages: "referToWidthOfInitialViewport",
  9638. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  9639. order: "uniqueOrder",
  9640. status: "standard"
  9641. },
  9642. "max-zoom": {
  9643. syntax: "auto | <number> | <percentage>",
  9644. media: [
  9645. "visual",
  9646. "continuous"
  9647. ],
  9648. initial: "auto",
  9649. percentages: "the zoom factor itself",
  9650. computed: "autoNonNegativeOrPercentage",
  9651. order: "uniqueOrder",
  9652. status: "standard"
  9653. },
  9654. "min-height": {
  9655. syntax: "<viewport-length>",
  9656. media: [
  9657. "visual",
  9658. "continuous"
  9659. ],
  9660. initial: "auto",
  9661. percentages: "referToHeightOfInitialViewport",
  9662. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  9663. order: "uniqueOrder",
  9664. status: "standard"
  9665. },
  9666. "min-width": {
  9667. syntax: "<viewport-length>",
  9668. media: [
  9669. "visual",
  9670. "continuous"
  9671. ],
  9672. initial: "auto",
  9673. percentages: "referToWidthOfInitialViewport",
  9674. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  9675. order: "uniqueOrder",
  9676. status: "standard"
  9677. },
  9678. "min-zoom": {
  9679. syntax: "auto | <number> | <percentage>",
  9680. media: [
  9681. "visual",
  9682. "continuous"
  9683. ],
  9684. initial: "auto",
  9685. percentages: "the zoom factor itself",
  9686. computed: "autoNonNegativeOrPercentage",
  9687. order: "uniqueOrder",
  9688. status: "standard"
  9689. },
  9690. orientation: {
  9691. syntax: "auto | portrait | landscape",
  9692. media: [
  9693. "visual",
  9694. "continuous"
  9695. ],
  9696. initial: "auto",
  9697. percentages: "referToSizeOfBoundingBox",
  9698. computed: "asSpecified",
  9699. order: "uniqueOrder",
  9700. status: "standard"
  9701. },
  9702. "user-zoom": {
  9703. syntax: "zoom | fixed",
  9704. media: [
  9705. "visual",
  9706. "continuous"
  9707. ],
  9708. initial: "zoom",
  9709. percentages: "referToSizeOfBoundingBox",
  9710. computed: "asSpecified",
  9711. order: "uniqueOrder",
  9712. status: "standard"
  9713. },
  9714. width: {
  9715. syntax: "<viewport-length>{1,2}",
  9716. media: [
  9717. "visual",
  9718. "continuous"
  9719. ],
  9720. initial: [
  9721. "min-width",
  9722. "max-width"
  9723. ],
  9724. percentages: [
  9725. "min-width",
  9726. "max-width"
  9727. ],
  9728. computed: [
  9729. "min-width",
  9730. "max-width"
  9731. ],
  9732. order: "orderOfAppearance",
  9733. status: "standard"
  9734. },
  9735. zoom: {
  9736. syntax: "auto | <number> | <percentage>",
  9737. media: [
  9738. "visual",
  9739. "continuous"
  9740. ],
  9741. initial: "auto",
  9742. percentages: "the zoom factor itself",
  9743. computed: "autoNonNegativeOrPercentage",
  9744. order: "uniqueOrder",
  9745. status: "standard"
  9746. }
  9747. },
  9748. status: "standard",
  9749. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@viewport"
  9750. }
  9751. };
  9752. var atRules$1 = /*#__PURE__*/Object.freeze({
  9753. __proto__: null,
  9754. 'default': atRules
  9755. });
  9756. var all = {
  9757. syntax: "initial | inherit | unset | revert",
  9758. media: "noPracticalMedia",
  9759. inherited: false,
  9760. animationType: "eachOfShorthandPropertiesExceptUnicodeBiDiAndDirection",
  9761. percentages: "no",
  9762. groups: [
  9763. "CSS Miscellaneous"
  9764. ],
  9765. initial: "noPracticalInitialValue",
  9766. appliesto: "allElements",
  9767. computed: "asSpecifiedAppliesToEachProperty",
  9768. order: "uniqueOrder",
  9769. status: "standard",
  9770. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/all"
  9771. };
  9772. var animation = {
  9773. syntax: "<single-animation>#",
  9774. media: "visual",
  9775. inherited: false,
  9776. animationType: "discrete",
  9777. percentages: "no",
  9778. groups: [
  9779. "CSS Animations"
  9780. ],
  9781. initial: [
  9782. "animation-name",
  9783. "animation-duration",
  9784. "animation-timing-function",
  9785. "animation-delay",
  9786. "animation-iteration-count",
  9787. "animation-direction",
  9788. "animation-fill-mode",
  9789. "animation-play-state"
  9790. ],
  9791. appliesto: "allElementsAndPseudos",
  9792. computed: [
  9793. "animation-name",
  9794. "animation-duration",
  9795. "animation-timing-function",
  9796. "animation-delay",
  9797. "animation-direction",
  9798. "animation-iteration-count",
  9799. "animation-fill-mode",
  9800. "animation-play-state"
  9801. ],
  9802. order: "orderOfAppearance",
  9803. status: "standard",
  9804. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation"
  9805. };
  9806. var appearance = {
  9807. syntax: "none | auto | button | textfield | <compat>",
  9808. media: "all",
  9809. inherited: false,
  9810. animationType: "discrete",
  9811. percentages: "no",
  9812. groups: [
  9813. "CSS Basic User Interface"
  9814. ],
  9815. initial: "auto",
  9816. appliesto: "allElements",
  9817. computed: "asSpecified",
  9818. order: "perGrammar",
  9819. status: "experimental",
  9820. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-appearance"
  9821. };
  9822. var azimuth = {
  9823. syntax: "<angle> | [ [ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] || behind ] | leftwards | rightwards",
  9824. media: "aural",
  9825. inherited: true,
  9826. animationType: "discrete",
  9827. percentages: "no",
  9828. groups: [
  9829. "CSS Speech"
  9830. ],
  9831. initial: "center",
  9832. appliesto: "allElements",
  9833. computed: "normalizedAngle",
  9834. order: "orderOfAppearance",
  9835. status: "obsolete",
  9836. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/azimuth"
  9837. };
  9838. var background = {
  9839. syntax: "[ <bg-layer> , ]* <final-bg-layer>",
  9840. media: "visual",
  9841. inherited: false,
  9842. animationType: [
  9843. "background-color",
  9844. "background-image",
  9845. "background-clip",
  9846. "background-position",
  9847. "background-size",
  9848. "background-repeat",
  9849. "background-attachment"
  9850. ],
  9851. percentages: [
  9852. "background-position",
  9853. "background-size"
  9854. ],
  9855. groups: [
  9856. "CSS Backgrounds and Borders"
  9857. ],
  9858. initial: [
  9859. "background-image",
  9860. "background-position",
  9861. "background-size",
  9862. "background-repeat",
  9863. "background-origin",
  9864. "background-clip",
  9865. "background-attachment",
  9866. "background-color"
  9867. ],
  9868. appliesto: "allElements",
  9869. computed: [
  9870. "background-image",
  9871. "background-position",
  9872. "background-size",
  9873. "background-repeat",
  9874. "background-origin",
  9875. "background-clip",
  9876. "background-attachment",
  9877. "background-color"
  9878. ],
  9879. order: "orderOfAppearance",
  9880. alsoAppliesTo: [
  9881. "::first-letter",
  9882. "::first-line",
  9883. "::placeholder"
  9884. ],
  9885. status: "standard",
  9886. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background"
  9887. };
  9888. var border = {
  9889. syntax: "<line-width> || <line-style> || <color>",
  9890. media: "visual",
  9891. inherited: false,
  9892. animationType: [
  9893. "border-color",
  9894. "border-style",
  9895. "border-width"
  9896. ],
  9897. percentages: "no",
  9898. groups: [
  9899. "CSS Backgrounds and Borders"
  9900. ],
  9901. initial: [
  9902. "border-width",
  9903. "border-style",
  9904. "border-color"
  9905. ],
  9906. appliesto: "allElements",
  9907. computed: [
  9908. "border-width",
  9909. "border-style",
  9910. "border-color"
  9911. ],
  9912. order: "orderOfAppearance",
  9913. alsoAppliesTo: [
  9914. "::first-letter"
  9915. ],
  9916. status: "standard",
  9917. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border"
  9918. };
  9919. var bottom = {
  9920. syntax: "<length> | <percentage> | auto",
  9921. media: "visual",
  9922. inherited: false,
  9923. animationType: "lpc",
  9924. percentages: "referToContainingBlockHeight",
  9925. groups: [
  9926. "CSS Positioning"
  9927. ],
  9928. initial: "auto",
  9929. appliesto: "positionedElements",
  9930. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  9931. order: "uniqueOrder",
  9932. status: "standard",
  9933. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/bottom"
  9934. };
  9935. var clear = {
  9936. syntax: "none | left | right | both | inline-start | inline-end",
  9937. media: "visual",
  9938. inherited: false,
  9939. animationType: "discrete",
  9940. percentages: "no",
  9941. groups: [
  9942. "CSS Positioning"
  9943. ],
  9944. initial: "none",
  9945. appliesto: "blockLevelElements",
  9946. computed: "asSpecified",
  9947. order: "uniqueOrder",
  9948. status: "standard",
  9949. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clear"
  9950. };
  9951. var clip = {
  9952. syntax: "<shape> | auto",
  9953. media: "visual",
  9954. inherited: false,
  9955. animationType: "rectangle",
  9956. percentages: "no",
  9957. groups: [
  9958. "CSS Masking"
  9959. ],
  9960. initial: "auto",
  9961. appliesto: "absolutelyPositionedElements",
  9962. computed: "autoOrRectangle",
  9963. order: "uniqueOrder",
  9964. status: "standard",
  9965. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clip"
  9966. };
  9967. var color = {
  9968. syntax: "<color>",
  9969. media: "visual",
  9970. inherited: true,
  9971. animationType: "color",
  9972. percentages: "no",
  9973. groups: [
  9974. "CSS Color"
  9975. ],
  9976. initial: "variesFromBrowserToBrowser",
  9977. appliesto: "allElements",
  9978. computed: "translucentValuesRGBAOtherwiseRGB",
  9979. order: "uniqueOrder",
  9980. alsoAppliesTo: [
  9981. "::first-letter",
  9982. "::first-line",
  9983. "::placeholder"
  9984. ],
  9985. status: "standard",
  9986. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/color"
  9987. };
  9988. var columns = {
  9989. syntax: "<'column-width'> || <'column-count'>",
  9990. media: "visual",
  9991. inherited: false,
  9992. animationType: [
  9993. "column-width",
  9994. "column-count"
  9995. ],
  9996. percentages: "no",
  9997. groups: [
  9998. "CSS Columns"
  9999. ],
  10000. initial: [
  10001. "column-width",
  10002. "column-count"
  10003. ],
  10004. appliesto: "blockContainersExceptTableWrappers",
  10005. computed: [
  10006. "column-width",
  10007. "column-count"
  10008. ],
  10009. order: "perGrammar",
  10010. status: "standard",
  10011. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/columns"
  10012. };
  10013. var contain = {
  10014. syntax: "none | strict | content | [ size || layout || style || paint ]",
  10015. media: "all",
  10016. inherited: false,
  10017. animationType: "discrete",
  10018. percentages: "no",
  10019. groups: [
  10020. "CSS Containment"
  10021. ],
  10022. initial: "none",
  10023. appliesto: "allElements",
  10024. computed: "asSpecified",
  10025. order: "perGrammar",
  10026. status: "experimental",
  10027. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/contain"
  10028. };
  10029. var content = {
  10030. syntax: "normal | none | [ <content-replacement> | <content-list> ] [/ <string> ]?",
  10031. media: "all",
  10032. inherited: false,
  10033. animationType: "discrete",
  10034. percentages: "no",
  10035. groups: [
  10036. "CSS Generated Content"
  10037. ],
  10038. initial: "normal",
  10039. appliesto: "beforeAndAfterPseudos",
  10040. computed: "normalOnElementsForPseudosNoneAbsoluteURIStringOrAsSpecified",
  10041. order: "uniqueOrder",
  10042. status: "standard",
  10043. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/content"
  10044. };
  10045. var cursor = {
  10046. syntax: "[ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing ] ]",
  10047. media: [
  10048. "visual",
  10049. "interactive"
  10050. ],
  10051. inherited: true,
  10052. animationType: "discrete",
  10053. percentages: "no",
  10054. groups: [
  10055. "CSS Basic User Interface"
  10056. ],
  10057. initial: "auto",
  10058. appliesto: "allElements",
  10059. computed: "asSpecifiedURLsAbsolute",
  10060. order: "uniqueOrder",
  10061. status: "standard",
  10062. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/cursor"
  10063. };
  10064. var direction = {
  10065. syntax: "ltr | rtl",
  10066. media: "visual",
  10067. inherited: true,
  10068. animationType: "discrete",
  10069. percentages: "no",
  10070. groups: [
  10071. "CSS Writing Modes"
  10072. ],
  10073. initial: "ltr",
  10074. appliesto: "allElements",
  10075. computed: "asSpecified",
  10076. order: "uniqueOrder",
  10077. status: "standard",
  10078. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/direction"
  10079. };
  10080. var display = {
  10081. syntax: "[ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy>",
  10082. media: "all",
  10083. inherited: false,
  10084. animationType: "discrete",
  10085. percentages: "no",
  10086. groups: [
  10087. "CSS Display"
  10088. ],
  10089. initial: "inline",
  10090. appliesto: "allElements",
  10091. computed: "asSpecifiedExceptPositionedFloatingAndRootElementsKeywordMaybeDifferent",
  10092. order: "uniqueOrder",
  10093. status: "standard",
  10094. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/display"
  10095. };
  10096. var filter = {
  10097. syntax: "none | <filter-function-list>",
  10098. media: "visual",
  10099. inherited: false,
  10100. animationType: "filterList",
  10101. percentages: "no",
  10102. groups: [
  10103. "Filter Effects"
  10104. ],
  10105. initial: "none",
  10106. appliesto: "allElementsSVGContainerElements",
  10107. computed: "asSpecified",
  10108. order: "uniqueOrder",
  10109. status: "standard",
  10110. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/filter"
  10111. };
  10112. var flex = {
  10113. syntax: "none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]",
  10114. media: "visual",
  10115. inherited: false,
  10116. animationType: [
  10117. "flex-grow",
  10118. "flex-shrink",
  10119. "flex-basis"
  10120. ],
  10121. percentages: "no",
  10122. groups: [
  10123. "CSS Flexible Box Layout"
  10124. ],
  10125. initial: [
  10126. "flex-grow",
  10127. "flex-shrink",
  10128. "flex-basis"
  10129. ],
  10130. appliesto: "flexItemsAndInFlowPseudos",
  10131. computed: [
  10132. "flex-grow",
  10133. "flex-shrink",
  10134. "flex-basis"
  10135. ],
  10136. order: "orderOfAppearance",
  10137. status: "standard",
  10138. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex"
  10139. };
  10140. var float = {
  10141. syntax: "left | right | none | inline-start | inline-end",
  10142. media: "visual",
  10143. inherited: false,
  10144. animationType: "discrete",
  10145. percentages: "no",
  10146. groups: [
  10147. "CSS Positioning"
  10148. ],
  10149. initial: "none",
  10150. appliesto: "allElementsNoEffectIfDisplayNone",
  10151. computed: "asSpecified",
  10152. order: "uniqueOrder",
  10153. status: "standard",
  10154. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/float"
  10155. };
  10156. var font = {
  10157. syntax: "[ [ <'font-style'> || <font-variant-css21> || <'font-weight'> || <'font-stretch'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar",
  10158. media: "visual",
  10159. inherited: true,
  10160. animationType: [
  10161. "font-style",
  10162. "font-variant",
  10163. "font-weight",
  10164. "font-stretch",
  10165. "font-size",
  10166. "line-height",
  10167. "font-family"
  10168. ],
  10169. percentages: [
  10170. "font-size",
  10171. "line-height"
  10172. ],
  10173. groups: [
  10174. "CSS Fonts"
  10175. ],
  10176. initial: [
  10177. "font-style",
  10178. "font-variant",
  10179. "font-weight",
  10180. "font-stretch",
  10181. "font-size",
  10182. "line-height",
  10183. "font-family"
  10184. ],
  10185. appliesto: "allElements",
  10186. computed: [
  10187. "font-style",
  10188. "font-variant",
  10189. "font-weight",
  10190. "font-stretch",
  10191. "font-size",
  10192. "line-height",
  10193. "font-family"
  10194. ],
  10195. order: "orderOfAppearance",
  10196. alsoAppliesTo: [
  10197. "::first-letter",
  10198. "::first-line",
  10199. "::placeholder"
  10200. ],
  10201. status: "standard",
  10202. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font"
  10203. };
  10204. var gap = {
  10205. syntax: "<'row-gap'> <'column-gap'>?",
  10206. media: "visual",
  10207. inherited: false,
  10208. animationType: [
  10209. "row-gap",
  10210. "column-gap"
  10211. ],
  10212. percentages: "no",
  10213. groups: [
  10214. "CSS Box Alignment"
  10215. ],
  10216. initial: [
  10217. "row-gap",
  10218. "column-gap"
  10219. ],
  10220. appliesto: "gridContainers",
  10221. computed: [
  10222. "row-gap",
  10223. "column-gap"
  10224. ],
  10225. order: "uniqueOrder",
  10226. status: "standard",
  10227. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/gap"
  10228. };
  10229. var grid = {
  10230. syntax: "<'grid-template'> | <'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>? | [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'>",
  10231. media: "visual",
  10232. inherited: false,
  10233. animationType: "discrete",
  10234. percentages: [
  10235. "grid-template-rows",
  10236. "grid-template-columns",
  10237. "grid-auto-rows",
  10238. "grid-auto-columns"
  10239. ],
  10240. groups: [
  10241. "CSS Grid Layout"
  10242. ],
  10243. initial: [
  10244. "grid-template-rows",
  10245. "grid-template-columns",
  10246. "grid-template-areas",
  10247. "grid-auto-rows",
  10248. "grid-auto-columns",
  10249. "grid-auto-flow",
  10250. "grid-column-gap",
  10251. "grid-row-gap",
  10252. "column-gap",
  10253. "row-gap"
  10254. ],
  10255. appliesto: "gridContainers",
  10256. computed: [
  10257. "grid-template-rows",
  10258. "grid-template-columns",
  10259. "grid-template-areas",
  10260. "grid-auto-rows",
  10261. "grid-auto-columns",
  10262. "grid-auto-flow",
  10263. "grid-column-gap",
  10264. "grid-row-gap",
  10265. "column-gap",
  10266. "row-gap"
  10267. ],
  10268. order: "uniqueOrder",
  10269. status: "standard",
  10270. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid"
  10271. };
  10272. var height = {
  10273. syntax: "[ <length> | <percentage> ] && [ border-box | content-box ]? | available | min-content | max-content | fit-content | auto",
  10274. media: "visual",
  10275. inherited: false,
  10276. animationType: "lpc",
  10277. percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentagesRelativeToContainingBlock",
  10278. groups: [
  10279. "CSS Box Model"
  10280. ],
  10281. initial: "auto",
  10282. appliesto: "allElementsButNonReplacedAndTableColumns",
  10283. computed: "percentageAutoOrAbsoluteLength",
  10284. order: "uniqueOrder",
  10285. status: "standard",
  10286. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/height"
  10287. };
  10288. var hyphens = {
  10289. syntax: "none | manual | auto",
  10290. media: "visual",
  10291. inherited: true,
  10292. animationType: "discrete",
  10293. percentages: "no",
  10294. groups: [
  10295. "CSS Text"
  10296. ],
  10297. initial: "manual",
  10298. appliesto: "allElements",
  10299. computed: "asSpecified",
  10300. order: "uniqueOrder",
  10301. status: "standard",
  10302. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/hyphens"
  10303. };
  10304. var inset = {
  10305. syntax: "<'top'>{1,4}",
  10306. media: "visual",
  10307. inherited: false,
  10308. animationType: "lpc",
  10309. percentages: "logicalHeightOfContainingBlock",
  10310. groups: [
  10311. "CSS Logical Properties"
  10312. ],
  10313. initial: "auto",
  10314. appliesto: "positionedElements",
  10315. computed: "sameAsBoxOffsets",
  10316. order: "uniqueOrder",
  10317. status: "standard",
  10318. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset"
  10319. };
  10320. var isolation = {
  10321. syntax: "auto | isolate",
  10322. media: "visual",
  10323. inherited: false,
  10324. animationType: "discrete",
  10325. percentages: "no",
  10326. groups: [
  10327. "Compositing and Blending"
  10328. ],
  10329. initial: "auto",
  10330. appliesto: "allElementsSVGContainerGraphicsAndGraphicsReferencingElements",
  10331. computed: "asSpecified",
  10332. order: "uniqueOrder",
  10333. status: "standard",
  10334. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/isolation"
  10335. };
  10336. var left = {
  10337. syntax: "<length> | <percentage> | auto",
  10338. media: "visual",
  10339. inherited: false,
  10340. animationType: "lpc",
  10341. percentages: "referToWidthOfContainingBlock",
  10342. groups: [
  10343. "CSS Positioning"
  10344. ],
  10345. initial: "auto",
  10346. appliesto: "positionedElements",
  10347. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10348. order: "uniqueOrder",
  10349. status: "standard",
  10350. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/left"
  10351. };
  10352. var margin = {
  10353. syntax: "[ <length> | <percentage> | auto ]{1,4}",
  10354. media: "visual",
  10355. inherited: false,
  10356. animationType: "length",
  10357. percentages: "referToWidthOfContainingBlock",
  10358. groups: [
  10359. "CSS Box Model"
  10360. ],
  10361. initial: [
  10362. "margin-bottom",
  10363. "margin-left",
  10364. "margin-right",
  10365. "margin-top"
  10366. ],
  10367. appliesto: "allElementsExceptTableDisplayTypes",
  10368. computed: [
  10369. "margin-bottom",
  10370. "margin-left",
  10371. "margin-right",
  10372. "margin-top"
  10373. ],
  10374. order: "uniqueOrder",
  10375. alsoAppliesTo: [
  10376. "::first-letter"
  10377. ],
  10378. status: "standard",
  10379. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin"
  10380. };
  10381. var mask = {
  10382. syntax: "<mask-layer>#",
  10383. media: "visual",
  10384. inherited: false,
  10385. animationType: [
  10386. "mask-image",
  10387. "mask-mode",
  10388. "mask-repeat",
  10389. "mask-position",
  10390. "mask-clip",
  10391. "mask-origin",
  10392. "mask-size",
  10393. "mask-composite"
  10394. ],
  10395. percentages: [
  10396. "mask-position"
  10397. ],
  10398. groups: [
  10399. "CSS Masking"
  10400. ],
  10401. initial: [
  10402. "mask-image",
  10403. "mask-mode",
  10404. "mask-repeat",
  10405. "mask-position",
  10406. "mask-clip",
  10407. "mask-origin",
  10408. "mask-size",
  10409. "mask-composite"
  10410. ],
  10411. appliesto: "allElementsSVGContainerElements",
  10412. computed: [
  10413. "mask-image",
  10414. "mask-mode",
  10415. "mask-repeat",
  10416. "mask-position",
  10417. "mask-clip",
  10418. "mask-origin",
  10419. "mask-size",
  10420. "mask-composite"
  10421. ],
  10422. order: "perGrammar",
  10423. stacking: true,
  10424. status: "standard",
  10425. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask"
  10426. };
  10427. var offset = {
  10428. syntax: "[ <'offset-position'>? [ <'offset-path'> [ <'offset-distance'> || <'offset-rotate'> ]? ]? ]! [ / <'offset-anchor'> ]?",
  10429. media: "visual",
  10430. inherited: false,
  10431. animationType: [
  10432. "offset-position",
  10433. "offset-path",
  10434. "offset-distance",
  10435. "offset-anchor",
  10436. "offset-rotate"
  10437. ],
  10438. percentages: [
  10439. "offset-position",
  10440. "offset-distance",
  10441. "offset-anchor"
  10442. ],
  10443. groups: [
  10444. "CSS Motion Path"
  10445. ],
  10446. initial: [
  10447. "offset-position",
  10448. "offset-path",
  10449. "offset-distance",
  10450. "offset-anchor",
  10451. "offset-rotate"
  10452. ],
  10453. appliesto: "transformableElements",
  10454. computed: [
  10455. "offset-position",
  10456. "offset-path",
  10457. "offset-distance",
  10458. "offset-anchor",
  10459. "offset-rotate"
  10460. ],
  10461. order: "perGrammar",
  10462. stacking: true,
  10463. status: "experimental",
  10464. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset"
  10465. };
  10466. var opacity = {
  10467. syntax: "<alpha-value>",
  10468. media: "visual",
  10469. inherited: false,
  10470. animationType: "number",
  10471. percentages: "no",
  10472. groups: [
  10473. "CSS Color"
  10474. ],
  10475. initial: "1.0",
  10476. appliesto: "allElements",
  10477. computed: "specifiedValueClipped0To1",
  10478. order: "uniqueOrder",
  10479. alsoAppliesTo: [
  10480. "::placeholder"
  10481. ],
  10482. status: "standard",
  10483. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/opacity"
  10484. };
  10485. var order = {
  10486. syntax: "<integer>",
  10487. media: "visual",
  10488. inherited: false,
  10489. animationType: "integer",
  10490. percentages: "no",
  10491. groups: [
  10492. "CSS Flexible Box Layout"
  10493. ],
  10494. initial: "0",
  10495. appliesto: "flexItemsAndAbsolutelyPositionedFlexContainerChildren",
  10496. computed: "asSpecified",
  10497. order: "uniqueOrder",
  10498. status: "standard",
  10499. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/order"
  10500. };
  10501. var orphans = {
  10502. syntax: "<integer>",
  10503. media: "visual",
  10504. inherited: true,
  10505. animationType: "discrete",
  10506. percentages: "no",
  10507. groups: [
  10508. "CSS Fragmentation"
  10509. ],
  10510. initial: "2",
  10511. appliesto: "blockContainerElements",
  10512. computed: "asSpecified",
  10513. order: "perGrammar",
  10514. status: "standard",
  10515. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/orphans"
  10516. };
  10517. var outline = {
  10518. syntax: "[ <'outline-color'> || <'outline-style'> || <'outline-width'> ]",
  10519. media: [
  10520. "visual",
  10521. "interactive"
  10522. ],
  10523. inherited: false,
  10524. animationType: [
  10525. "outline-color",
  10526. "outline-width",
  10527. "outline-style"
  10528. ],
  10529. percentages: "no",
  10530. groups: [
  10531. "CSS Basic User Interface"
  10532. ],
  10533. initial: [
  10534. "outline-color",
  10535. "outline-style",
  10536. "outline-width"
  10537. ],
  10538. appliesto: "allElements",
  10539. computed: [
  10540. "outline-color",
  10541. "outline-width",
  10542. "outline-style"
  10543. ],
  10544. order: "orderOfAppearance",
  10545. status: "standard",
  10546. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline"
  10547. };
  10548. var overflow = {
  10549. syntax: "[ visible | hidden | clip | scroll | auto ]{1,2}",
  10550. media: "visual",
  10551. inherited: false,
  10552. animationType: "discrete",
  10553. percentages: "no",
  10554. groups: [
  10555. "CSS Overflow"
  10556. ],
  10557. initial: "visible",
  10558. appliesto: "blockContainersFlexContainersGridContainers",
  10559. computed: "asSpecified",
  10560. order: "uniqueOrder",
  10561. status: "standard",
  10562. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow"
  10563. };
  10564. var padding = {
  10565. syntax: "[ <length> | <percentage> ]{1,4}",
  10566. media: "visual",
  10567. inherited: false,
  10568. animationType: "length",
  10569. percentages: "referToWidthOfContainingBlock",
  10570. groups: [
  10571. "CSS Box Model"
  10572. ],
  10573. initial: [
  10574. "padding-bottom",
  10575. "padding-left",
  10576. "padding-right",
  10577. "padding-top"
  10578. ],
  10579. appliesto: "allElementsExceptInternalTableDisplayTypes",
  10580. computed: [
  10581. "padding-bottom",
  10582. "padding-left",
  10583. "padding-right",
  10584. "padding-top"
  10585. ],
  10586. order: "uniqueOrder",
  10587. alsoAppliesTo: [
  10588. "::first-letter"
  10589. ],
  10590. status: "standard",
  10591. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding"
  10592. };
  10593. var perspective = {
  10594. syntax: "none | <length>",
  10595. media: "visual",
  10596. inherited: false,
  10597. animationType: "length",
  10598. percentages: "no",
  10599. groups: [
  10600. "CSS Transforms"
  10601. ],
  10602. initial: "none",
  10603. appliesto: "transformableElements",
  10604. computed: "absoluteLengthOrNone",
  10605. order: "uniqueOrder",
  10606. stacking: true,
  10607. status: "standard",
  10608. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/perspective"
  10609. };
  10610. var position = {
  10611. syntax: "static | relative | absolute | sticky | fixed",
  10612. media: "visual",
  10613. inherited: false,
  10614. animationType: "discrete",
  10615. percentages: "no",
  10616. groups: [
  10617. "CSS Positioning"
  10618. ],
  10619. initial: "static",
  10620. appliesto: "allElements",
  10621. computed: "asSpecified",
  10622. order: "uniqueOrder",
  10623. stacking: true,
  10624. status: "standard",
  10625. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/position"
  10626. };
  10627. var quotes = {
  10628. syntax: "none | auto | [ <string> <string> ]+",
  10629. media: "visual",
  10630. inherited: true,
  10631. animationType: "discrete",
  10632. percentages: "no",
  10633. groups: [
  10634. "CSS Generated Content"
  10635. ],
  10636. initial: "dependsOnUserAgent",
  10637. appliesto: "allElements",
  10638. computed: "asSpecified",
  10639. order: "uniqueOrder",
  10640. status: "standard",
  10641. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/quotes"
  10642. };
  10643. var resize = {
  10644. syntax: "none | both | horizontal | vertical | block | inline",
  10645. media: "visual",
  10646. inherited: false,
  10647. animationType: "discrete",
  10648. percentages: "no",
  10649. groups: [
  10650. "CSS Basic User Interface"
  10651. ],
  10652. initial: "none",
  10653. appliesto: "elementsWithOverflowNotVisibleAndReplacedElements",
  10654. computed: "asSpecified",
  10655. order: "uniqueOrder",
  10656. status: "standard",
  10657. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/resize"
  10658. };
  10659. var right = {
  10660. syntax: "<length> | <percentage> | auto",
  10661. media: "visual",
  10662. inherited: false,
  10663. animationType: "lpc",
  10664. percentages: "referToWidthOfContainingBlock",
  10665. groups: [
  10666. "CSS Positioning"
  10667. ],
  10668. initial: "auto",
  10669. appliesto: "positionedElements",
  10670. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10671. order: "uniqueOrder",
  10672. status: "standard",
  10673. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/right"
  10674. };
  10675. var rotate = {
  10676. syntax: "none | <angle> | [ x | y | z | <number>{3} ] && <angle>",
  10677. media: "visual",
  10678. inherited: false,
  10679. animationType: "transform",
  10680. percentages: "no",
  10681. groups: [
  10682. "CSS Transforms"
  10683. ],
  10684. initial: "none",
  10685. appliesto: "transformableElements",
  10686. computed: "asSpecified",
  10687. order: "perGrammar",
  10688. stacking: true,
  10689. status: "standard",
  10690. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/rotate"
  10691. };
  10692. var scale = {
  10693. syntax: "none | <number>{1,3}",
  10694. media: "visual",
  10695. inherited: false,
  10696. animationType: "transform",
  10697. percentages: "no",
  10698. groups: [
  10699. "CSS Transforms"
  10700. ],
  10701. initial: "none",
  10702. appliesto: "transformableElements",
  10703. computed: "asSpecified",
  10704. order: "perGrammar",
  10705. stacking: true,
  10706. status: "standard",
  10707. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scale"
  10708. };
  10709. var top = {
  10710. syntax: "<length> | <percentage> | auto",
  10711. media: "visual",
  10712. inherited: false,
  10713. animationType: "lpc",
  10714. percentages: "referToContainingBlockHeight",
  10715. groups: [
  10716. "CSS Positioning"
  10717. ],
  10718. initial: "auto",
  10719. appliesto: "positionedElements",
  10720. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10721. order: "uniqueOrder",
  10722. status: "standard",
  10723. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/top"
  10724. };
  10725. var transform = {
  10726. syntax: "none | <transform-list>",
  10727. media: "visual",
  10728. inherited: false,
  10729. animationType: "transform",
  10730. percentages: "referToSizeOfBoundingBox",
  10731. groups: [
  10732. "CSS Transforms"
  10733. ],
  10734. initial: "none",
  10735. appliesto: "transformableElements",
  10736. computed: "asSpecifiedRelativeToAbsoluteLengths",
  10737. order: "uniqueOrder",
  10738. stacking: true,
  10739. status: "standard",
  10740. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform"
  10741. };
  10742. var transition = {
  10743. syntax: "<single-transition>#",
  10744. media: "interactive",
  10745. inherited: false,
  10746. animationType: "discrete",
  10747. percentages: "no",
  10748. groups: [
  10749. "CSS Transitions"
  10750. ],
  10751. initial: [
  10752. "transition-delay",
  10753. "transition-duration",
  10754. "transition-property",
  10755. "transition-timing-function"
  10756. ],
  10757. appliesto: "allElementsAndPseudos",
  10758. computed: [
  10759. "transition-delay",
  10760. "transition-duration",
  10761. "transition-property",
  10762. "transition-timing-function"
  10763. ],
  10764. order: "orderOfAppearance",
  10765. status: "standard",
  10766. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition"
  10767. };
  10768. var translate = {
  10769. syntax: "none | <length-percentage> [ <length-percentage> <length>? ]?",
  10770. media: "visual",
  10771. inherited: false,
  10772. animationType: "transform",
  10773. percentages: "referToSizeOfBoundingBox",
  10774. groups: [
  10775. "CSS Transforms"
  10776. ],
  10777. initial: "none",
  10778. appliesto: "transformableElements",
  10779. computed: "asSpecifiedRelativeToAbsoluteLengths",
  10780. order: "perGrammar",
  10781. stacking: true,
  10782. status: "standard",
  10783. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/translate"
  10784. };
  10785. var visibility = {
  10786. syntax: "visible | hidden | collapse",
  10787. media: "visual",
  10788. inherited: true,
  10789. animationType: "visibility",
  10790. percentages: "no",
  10791. groups: [
  10792. "CSS Box Model"
  10793. ],
  10794. initial: "visible",
  10795. appliesto: "allElements",
  10796. computed: "asSpecified",
  10797. order: "uniqueOrder",
  10798. status: "standard",
  10799. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/visibility"
  10800. };
  10801. var widows = {
  10802. syntax: "<integer>",
  10803. media: "visual",
  10804. inherited: true,
  10805. animationType: "discrete",
  10806. percentages: "no",
  10807. groups: [
  10808. "CSS Fragmentation"
  10809. ],
  10810. initial: "2",
  10811. appliesto: "blockContainerElements",
  10812. computed: "asSpecified",
  10813. order: "perGrammar",
  10814. status: "standard",
  10815. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/widows"
  10816. };
  10817. var width = {
  10818. syntax: "[ <length> | <percentage> ] && [ border-box | content-box ]? | available | min-content | max-content | fit-content | auto",
  10819. media: "visual",
  10820. inherited: false,
  10821. animationType: "lpc",
  10822. percentages: "referToWidthOfContainingBlock",
  10823. groups: [
  10824. "CSS Box Model"
  10825. ],
  10826. initial: "auto",
  10827. appliesto: "allElementsButNonReplacedAndTableRows",
  10828. computed: "percentageAutoOrAbsoluteLength",
  10829. order: "lengthOrPercentageBeforeKeywordIfBothPresent",
  10830. status: "standard",
  10831. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/width"
  10832. };
  10833. var zoom = {
  10834. syntax: "normal | reset | <number> | <percentage>",
  10835. media: "visual",
  10836. inherited: false,
  10837. animationType: "integer",
  10838. percentages: "no",
  10839. groups: [
  10840. "Microsoft Extensions"
  10841. ],
  10842. initial: "normal",
  10843. appliesto: "allElements",
  10844. computed: "asSpecified",
  10845. order: "uniqueOrder",
  10846. status: "nonstandard",
  10847. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/zoom"
  10848. };
  10849. var properties$1 = {
  10850. "--*": {
  10851. syntax: "<declaration-value>",
  10852. media: "all",
  10853. inherited: true,
  10854. animationType: "discrete",
  10855. percentages: "no",
  10856. groups: [
  10857. "CSS Variables"
  10858. ],
  10859. initial: "seeProse",
  10860. appliesto: "allElements",
  10861. computed: "asSpecifiedWithVarsSubstituted",
  10862. order: "perGrammar",
  10863. status: "experimental",
  10864. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/--*"
  10865. },
  10866. "-ms-accelerator": {
  10867. syntax: "false | true",
  10868. media: "visual",
  10869. inherited: false,
  10870. animationType: "discrete",
  10871. percentages: "no",
  10872. groups: [
  10873. "Microsoft Extensions"
  10874. ],
  10875. initial: "false",
  10876. appliesto: "allElements",
  10877. computed: "asSpecified",
  10878. order: "uniqueOrder",
  10879. status: "nonstandard",
  10880. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-accelerator"
  10881. },
  10882. "-ms-block-progression": {
  10883. syntax: "tb | rl | bt | lr",
  10884. media: "visual",
  10885. inherited: false,
  10886. animationType: "discrete",
  10887. percentages: "no",
  10888. groups: [
  10889. "Microsoft Extensions"
  10890. ],
  10891. initial: "tb",
  10892. appliesto: "allElements",
  10893. computed: "asSpecified",
  10894. order: "uniqueOrder",
  10895. status: "nonstandard",
  10896. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-block-progression"
  10897. },
  10898. "-ms-content-zoom-chaining": {
  10899. syntax: "none | chained",
  10900. media: "interactive",
  10901. inherited: false,
  10902. animationType: "discrete",
  10903. percentages: "no",
  10904. groups: [
  10905. "Microsoft Extensions"
  10906. ],
  10907. initial: "none",
  10908. appliesto: "nonReplacedBlockAndInlineBlockElements",
  10909. computed: "asSpecified",
  10910. order: "uniqueOrder",
  10911. status: "nonstandard",
  10912. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-chaining"
  10913. },
  10914. "-ms-content-zooming": {
  10915. syntax: "none | zoom",
  10916. media: "interactive",
  10917. inherited: false,
  10918. animationType: "discrete",
  10919. percentages: "no",
  10920. groups: [
  10921. "Microsoft Extensions"
  10922. ],
  10923. initial: "zoomForTheTopLevelNoneForTheRest",
  10924. appliesto: "nonReplacedBlockAndInlineBlockElements",
  10925. computed: "asSpecified",
  10926. order: "uniqueOrder",
  10927. status: "nonstandard",
  10928. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zooming"
  10929. },
  10930. "-ms-content-zoom-limit": {
  10931. syntax: "<'-ms-content-zoom-limit-min'> <'-ms-content-zoom-limit-max'>",
  10932. media: "interactive",
  10933. inherited: false,
  10934. animationType: "discrete",
  10935. percentages: [
  10936. "-ms-content-zoom-limit-max",
  10937. "-ms-content-zoom-limit-min"
  10938. ],
  10939. groups: [
  10940. "Microsoft Extensions"
  10941. ],
  10942. initial: [
  10943. "-ms-content-zoom-limit-max",
  10944. "-ms-content-zoom-limit-min"
  10945. ],
  10946. appliesto: "nonReplacedBlockAndInlineBlockElements",
  10947. computed: [
  10948. "-ms-content-zoom-limit-max",
  10949. "-ms-content-zoom-limit-min"
  10950. ],
  10951. order: "uniqueOrder",
  10952. status: "nonstandard",
  10953. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit"
  10954. },
  10955. "-ms-content-zoom-limit-max": {
  10956. syntax: "<percentage>",
  10957. media: "interactive",
  10958. inherited: false,
  10959. animationType: "discrete",
  10960. percentages: "maxZoomFactor",
  10961. groups: [
  10962. "Microsoft Extensions"
  10963. ],
  10964. initial: "400%",
  10965. appliesto: "nonReplacedBlockAndInlineBlockElements",
  10966. computed: "asSpecified",
  10967. order: "uniqueOrder",
  10968. status: "nonstandard",
  10969. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit-max"
  10970. },
  10971. "-ms-content-zoom-limit-min": {
  10972. syntax: "<percentage>",
  10973. media: "interactive",
  10974. inherited: false,
  10975. animationType: "discrete",
  10976. percentages: "minZoomFactor",
  10977. groups: [
  10978. "Microsoft Extensions"
  10979. ],
  10980. initial: "100%",
  10981. appliesto: "nonReplacedBlockAndInlineBlockElements",
  10982. computed: "asSpecified",
  10983. order: "uniqueOrder",
  10984. status: "nonstandard",
  10985. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit-min"
  10986. },
  10987. "-ms-content-zoom-snap": {
  10988. syntax: "<'-ms-content-zoom-snap-type'> || <'-ms-content-zoom-snap-points'>",
  10989. media: "interactive",
  10990. inherited: false,
  10991. animationType: "discrete",
  10992. percentages: "no",
  10993. groups: [
  10994. "Microsoft Extensions"
  10995. ],
  10996. initial: [
  10997. "-ms-content-zoom-snap-type",
  10998. "-ms-content-zoom-snap-points"
  10999. ],
  11000. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11001. computed: [
  11002. "-ms-content-zoom-snap-type",
  11003. "-ms-content-zoom-snap-points"
  11004. ],
  11005. order: "uniqueOrder",
  11006. status: "nonstandard",
  11007. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap"
  11008. },
  11009. "-ms-content-zoom-snap-points": {
  11010. syntax: "snapInterval( <percentage>, <percentage> ) | snapList( <percentage># )",
  11011. media: "interactive",
  11012. inherited: false,
  11013. animationType: "discrete",
  11014. percentages: "no",
  11015. groups: [
  11016. "Microsoft Extensions"
  11017. ],
  11018. initial: "snapInterval(0%, 100%)",
  11019. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11020. computed: "asSpecified",
  11021. order: "uniqueOrder",
  11022. status: "nonstandard",
  11023. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap-points"
  11024. },
  11025. "-ms-content-zoom-snap-type": {
  11026. syntax: "none | proximity | mandatory",
  11027. media: "interactive",
  11028. inherited: false,
  11029. animationType: "discrete",
  11030. percentages: "no",
  11031. groups: [
  11032. "Microsoft Extensions"
  11033. ],
  11034. initial: "none",
  11035. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11036. computed: "asSpecified",
  11037. order: "uniqueOrder",
  11038. status: "nonstandard",
  11039. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap-type"
  11040. },
  11041. "-ms-filter": {
  11042. syntax: "<string>",
  11043. media: "visual",
  11044. inherited: false,
  11045. animationType: "discrete",
  11046. percentages: "no",
  11047. groups: [
  11048. "Microsoft Extensions"
  11049. ],
  11050. initial: "\"\"",
  11051. appliesto: "allElements",
  11052. computed: "asSpecified",
  11053. order: "uniqueOrder",
  11054. status: "nonstandard",
  11055. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-filter"
  11056. },
  11057. "-ms-flow-from": {
  11058. syntax: "[ none | <custom-ident> ]#",
  11059. media: "visual",
  11060. inherited: false,
  11061. animationType: "discrete",
  11062. percentages: "no",
  11063. groups: [
  11064. "Microsoft Extensions"
  11065. ],
  11066. initial: "none",
  11067. appliesto: "nonReplacedElements",
  11068. computed: "asSpecified",
  11069. order: "uniqueOrder",
  11070. status: "nonstandard",
  11071. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-flow-from"
  11072. },
  11073. "-ms-flow-into": {
  11074. syntax: "[ none | <custom-ident> ]#",
  11075. media: "visual",
  11076. inherited: false,
  11077. animationType: "discrete",
  11078. percentages: "no",
  11079. groups: [
  11080. "Microsoft Extensions"
  11081. ],
  11082. initial: "none",
  11083. appliesto: "iframeElements",
  11084. computed: "asSpecified",
  11085. order: "uniqueOrder",
  11086. status: "nonstandard",
  11087. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-flow-into"
  11088. },
  11089. "-ms-high-contrast-adjust": {
  11090. syntax: "auto | none",
  11091. media: "visual",
  11092. inherited: true,
  11093. animationType: "discrete",
  11094. percentages: "no",
  11095. groups: [
  11096. "Microsoft Extensions"
  11097. ],
  11098. initial: "auto",
  11099. appliesto: "allElements",
  11100. computed: "asSpecified",
  11101. order: "uniqueOrder",
  11102. status: "nonstandard",
  11103. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-high-contrast-adjust"
  11104. },
  11105. "-ms-hyphenate-limit-chars": {
  11106. syntax: "auto | <integer>{1,3}",
  11107. media: "visual",
  11108. inherited: true,
  11109. animationType: "discrete",
  11110. percentages: "no",
  11111. groups: [
  11112. "Microsoft Extensions"
  11113. ],
  11114. initial: "auto",
  11115. appliesto: "allElements",
  11116. computed: "asSpecified",
  11117. order: "uniqueOrder",
  11118. status: "nonstandard",
  11119. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-chars"
  11120. },
  11121. "-ms-hyphenate-limit-lines": {
  11122. syntax: "no-limit | <integer>",
  11123. media: "visual",
  11124. inherited: true,
  11125. animationType: "discrete",
  11126. percentages: "no",
  11127. groups: [
  11128. "Microsoft Extensions"
  11129. ],
  11130. initial: "no-limit",
  11131. appliesto: "blockContainerElements",
  11132. computed: "asSpecified",
  11133. order: "uniqueOrder",
  11134. status: "nonstandard",
  11135. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-lines"
  11136. },
  11137. "-ms-hyphenate-limit-zone": {
  11138. syntax: "<percentage> | <length>",
  11139. media: "visual",
  11140. inherited: true,
  11141. animationType: "discrete",
  11142. percentages: "referToLineBoxWidth",
  11143. groups: [
  11144. "Microsoft Extensions"
  11145. ],
  11146. initial: "0",
  11147. appliesto: "blockContainerElements",
  11148. computed: "asSpecified",
  11149. order: "uniqueOrder",
  11150. status: "nonstandard",
  11151. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-zone"
  11152. },
  11153. "-ms-ime-align": {
  11154. syntax: "auto | after",
  11155. media: "visual",
  11156. inherited: false,
  11157. animationType: "discrete",
  11158. percentages: "no",
  11159. groups: [
  11160. "Microsoft Extensions"
  11161. ],
  11162. initial: "auto",
  11163. appliesto: "allElements",
  11164. computed: "asSpecified",
  11165. order: "uniqueOrder",
  11166. status: "nonstandard",
  11167. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-ime-align"
  11168. },
  11169. "-ms-overflow-style": {
  11170. syntax: "auto | none | scrollbar | -ms-autohiding-scrollbar",
  11171. media: "interactive",
  11172. inherited: true,
  11173. animationType: "discrete",
  11174. percentages: "no",
  11175. groups: [
  11176. "Microsoft Extensions"
  11177. ],
  11178. initial: "auto",
  11179. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11180. computed: "asSpecified",
  11181. order: "uniqueOrder",
  11182. status: "nonstandard",
  11183. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-overflow-style"
  11184. },
  11185. "-ms-scrollbar-3dlight-color": {
  11186. syntax: "<color>",
  11187. media: "visual",
  11188. inherited: true,
  11189. animationType: "discrete",
  11190. percentages: "no",
  11191. groups: [
  11192. "Microsoft Extensions"
  11193. ],
  11194. initial: "dependsOnUserAgent",
  11195. appliesto: "allElements",
  11196. computed: "asSpecified",
  11197. order: "uniqueOrder",
  11198. status: "nonstandard",
  11199. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-3dlight-color"
  11200. },
  11201. "-ms-scrollbar-arrow-color": {
  11202. syntax: "<color>",
  11203. media: "visual",
  11204. inherited: true,
  11205. animationType: "discrete",
  11206. percentages: "no",
  11207. groups: [
  11208. "Microsoft Extensions"
  11209. ],
  11210. initial: "ButtonText",
  11211. appliesto: "allElements",
  11212. computed: "asSpecified",
  11213. order: "uniqueOrder",
  11214. status: "nonstandard",
  11215. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-arrow-color"
  11216. },
  11217. "-ms-scrollbar-base-color": {
  11218. syntax: "<color>",
  11219. media: "visual",
  11220. inherited: true,
  11221. animationType: "discrete",
  11222. percentages: "no",
  11223. groups: [
  11224. "Microsoft Extensions"
  11225. ],
  11226. initial: "dependsOnUserAgent",
  11227. appliesto: "allElements",
  11228. computed: "asSpecified",
  11229. order: "uniqueOrder",
  11230. status: "nonstandard",
  11231. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-base-color"
  11232. },
  11233. "-ms-scrollbar-darkshadow-color": {
  11234. syntax: "<color>",
  11235. media: "visual",
  11236. inherited: true,
  11237. animationType: "discrete",
  11238. percentages: "no",
  11239. groups: [
  11240. "Microsoft Extensions"
  11241. ],
  11242. initial: "ThreeDDarkShadow",
  11243. appliesto: "allElements",
  11244. computed: "asSpecified",
  11245. order: "uniqueOrder",
  11246. status: "nonstandard",
  11247. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-darkshadow-color"
  11248. },
  11249. "-ms-scrollbar-face-color": {
  11250. syntax: "<color>",
  11251. media: "visual",
  11252. inherited: true,
  11253. animationType: "discrete",
  11254. percentages: "no",
  11255. groups: [
  11256. "Microsoft Extensions"
  11257. ],
  11258. initial: "ThreeDFace",
  11259. appliesto: "allElements",
  11260. computed: "asSpecified",
  11261. order: "uniqueOrder",
  11262. status: "nonstandard",
  11263. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-face-color"
  11264. },
  11265. "-ms-scrollbar-highlight-color": {
  11266. syntax: "<color>",
  11267. media: "visual",
  11268. inherited: true,
  11269. animationType: "discrete",
  11270. percentages: "no",
  11271. groups: [
  11272. "Microsoft Extensions"
  11273. ],
  11274. initial: "ThreeDHighlight",
  11275. appliesto: "allElements",
  11276. computed: "asSpecified",
  11277. order: "uniqueOrder",
  11278. status: "nonstandard",
  11279. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-highlight-color"
  11280. },
  11281. "-ms-scrollbar-shadow-color": {
  11282. syntax: "<color>",
  11283. media: "visual",
  11284. inherited: true,
  11285. animationType: "discrete",
  11286. percentages: "no",
  11287. groups: [
  11288. "Microsoft Extensions"
  11289. ],
  11290. initial: "ThreeDDarkShadow",
  11291. appliesto: "allElements",
  11292. computed: "asSpecified",
  11293. order: "uniqueOrder",
  11294. status: "nonstandard",
  11295. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-shadow-color"
  11296. },
  11297. "-ms-scrollbar-track-color": {
  11298. syntax: "<color>",
  11299. media: "visual",
  11300. inherited: true,
  11301. animationType: "discrete",
  11302. percentages: "no",
  11303. groups: [
  11304. "Microsoft Extensions"
  11305. ],
  11306. initial: "Scrollbar",
  11307. appliesto: "allElements",
  11308. computed: "asSpecified",
  11309. order: "uniqueOrder",
  11310. status: "nonstandard",
  11311. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-track-color"
  11312. },
  11313. "-ms-scroll-chaining": {
  11314. syntax: "chained | none",
  11315. media: "interactive",
  11316. inherited: false,
  11317. animationType: "discrete",
  11318. percentages: "no",
  11319. groups: [
  11320. "Microsoft Extensions"
  11321. ],
  11322. initial: "chained",
  11323. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11324. computed: "asSpecified",
  11325. order: "uniqueOrder",
  11326. status: "nonstandard",
  11327. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-chaining"
  11328. },
  11329. "-ms-scroll-limit": {
  11330. syntax: "<'-ms-scroll-limit-x-min'> <'-ms-scroll-limit-y-min'> <'-ms-scroll-limit-x-max'> <'-ms-scroll-limit-y-max'>",
  11331. media: "interactive",
  11332. inherited: false,
  11333. animationType: "discrete",
  11334. percentages: "no",
  11335. groups: [
  11336. "Microsoft Extensions"
  11337. ],
  11338. initial: [
  11339. "-ms-scroll-limit-x-min",
  11340. "-ms-scroll-limit-y-min",
  11341. "-ms-scroll-limit-x-max",
  11342. "-ms-scroll-limit-y-max"
  11343. ],
  11344. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11345. computed: [
  11346. "-ms-scroll-limit-x-min",
  11347. "-ms-scroll-limit-y-min",
  11348. "-ms-scroll-limit-x-max",
  11349. "-ms-scroll-limit-y-max"
  11350. ],
  11351. order: "uniqueOrder",
  11352. status: "nonstandard",
  11353. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit"
  11354. },
  11355. "-ms-scroll-limit-x-max": {
  11356. syntax: "auto | <length>",
  11357. media: "interactive",
  11358. inherited: false,
  11359. animationType: "discrete",
  11360. percentages: "no",
  11361. groups: [
  11362. "Microsoft Extensions"
  11363. ],
  11364. initial: "auto",
  11365. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11366. computed: "asSpecified",
  11367. order: "uniqueOrder",
  11368. status: "nonstandard",
  11369. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-x-max"
  11370. },
  11371. "-ms-scroll-limit-x-min": {
  11372. syntax: "<length>",
  11373. media: "interactive",
  11374. inherited: false,
  11375. animationType: "discrete",
  11376. percentages: "no",
  11377. groups: [
  11378. "Microsoft Extensions"
  11379. ],
  11380. initial: "0",
  11381. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11382. computed: "asSpecified",
  11383. order: "uniqueOrder",
  11384. status: "nonstandard",
  11385. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-x-min"
  11386. },
  11387. "-ms-scroll-limit-y-max": {
  11388. syntax: "auto | <length>",
  11389. media: "interactive",
  11390. inherited: false,
  11391. animationType: "discrete",
  11392. percentages: "no",
  11393. groups: [
  11394. "Microsoft Extensions"
  11395. ],
  11396. initial: "auto",
  11397. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11398. computed: "asSpecified",
  11399. order: "uniqueOrder",
  11400. status: "nonstandard",
  11401. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-y-max"
  11402. },
  11403. "-ms-scroll-limit-y-min": {
  11404. syntax: "<length>",
  11405. media: "interactive",
  11406. inherited: false,
  11407. animationType: "discrete",
  11408. percentages: "no",
  11409. groups: [
  11410. "Microsoft Extensions"
  11411. ],
  11412. initial: "0",
  11413. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11414. computed: "asSpecified",
  11415. order: "uniqueOrder",
  11416. status: "nonstandard",
  11417. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-y-min"
  11418. },
  11419. "-ms-scroll-rails": {
  11420. syntax: "none | railed",
  11421. media: "interactive",
  11422. inherited: false,
  11423. animationType: "discrete",
  11424. percentages: "no",
  11425. groups: [
  11426. "Microsoft Extensions"
  11427. ],
  11428. initial: "railed",
  11429. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11430. computed: "asSpecified",
  11431. order: "uniqueOrder",
  11432. status: "nonstandard",
  11433. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-rails"
  11434. },
  11435. "-ms-scroll-snap-points-x": {
  11436. syntax: "snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )",
  11437. media: "interactive",
  11438. inherited: false,
  11439. animationType: "discrete",
  11440. percentages: "no",
  11441. groups: [
  11442. "Microsoft Extensions"
  11443. ],
  11444. initial: "snapInterval(0px, 100%)",
  11445. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11446. computed: "asSpecified",
  11447. order: "uniqueOrder",
  11448. status: "nonstandard",
  11449. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-points-x"
  11450. },
  11451. "-ms-scroll-snap-points-y": {
  11452. syntax: "snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )",
  11453. media: "interactive",
  11454. inherited: false,
  11455. animationType: "discrete",
  11456. percentages: "no",
  11457. groups: [
  11458. "Microsoft Extensions"
  11459. ],
  11460. initial: "snapInterval(0px, 100%)",
  11461. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11462. computed: "asSpecified",
  11463. order: "uniqueOrder",
  11464. status: "nonstandard",
  11465. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-points-y"
  11466. },
  11467. "-ms-scroll-snap-type": {
  11468. syntax: "none | proximity | mandatory",
  11469. media: "interactive",
  11470. inherited: false,
  11471. animationType: "discrete",
  11472. percentages: "no",
  11473. groups: [
  11474. "Microsoft Extensions"
  11475. ],
  11476. initial: "none",
  11477. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11478. computed: "asSpecified",
  11479. order: "uniqueOrder",
  11480. status: "nonstandard",
  11481. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-type"
  11482. },
  11483. "-ms-scroll-snap-x": {
  11484. syntax: "<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-x'>",
  11485. media: "interactive",
  11486. inherited: false,
  11487. animationType: "discrete",
  11488. percentages: "no",
  11489. groups: [
  11490. "Microsoft Extensions"
  11491. ],
  11492. initial: [
  11493. "-ms-scroll-snap-type",
  11494. "-ms-scroll-snap-points-x"
  11495. ],
  11496. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11497. computed: [
  11498. "-ms-scroll-snap-type",
  11499. "-ms-scroll-snap-points-x"
  11500. ],
  11501. order: "uniqueOrder",
  11502. status: "nonstandard",
  11503. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-x"
  11504. },
  11505. "-ms-scroll-snap-y": {
  11506. syntax: "<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-y'>",
  11507. media: "interactive",
  11508. inherited: false,
  11509. animationType: "discrete",
  11510. percentages: "no",
  11511. groups: [
  11512. "Microsoft Extensions"
  11513. ],
  11514. initial: [
  11515. "-ms-scroll-snap-type",
  11516. "-ms-scroll-snap-points-y"
  11517. ],
  11518. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11519. computed: [
  11520. "-ms-scroll-snap-type",
  11521. "-ms-scroll-snap-points-y"
  11522. ],
  11523. order: "uniqueOrder",
  11524. status: "nonstandard",
  11525. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-y"
  11526. },
  11527. "-ms-scroll-translation": {
  11528. syntax: "none | vertical-to-horizontal",
  11529. media: "interactive",
  11530. inherited: true,
  11531. animationType: "discrete",
  11532. percentages: "no",
  11533. groups: [
  11534. "Microsoft Extensions"
  11535. ],
  11536. initial: "none",
  11537. appliesto: "allElements",
  11538. computed: "asSpecified",
  11539. order: "uniqueOrder",
  11540. status: "nonstandard",
  11541. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-translation"
  11542. },
  11543. "-ms-text-autospace": {
  11544. syntax: "none | ideograph-alpha | ideograph-numeric | ideograph-parenthesis | ideograph-space",
  11545. media: "visual",
  11546. inherited: false,
  11547. animationType: "discrete",
  11548. percentages: "no",
  11549. groups: [
  11550. "Microsoft Extensions"
  11551. ],
  11552. initial: "none",
  11553. appliesto: "allElements",
  11554. computed: "asSpecified",
  11555. order: "uniqueOrder",
  11556. status: "nonstandard",
  11557. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-text-autospace"
  11558. },
  11559. "-ms-touch-select": {
  11560. syntax: "grippers | none",
  11561. media: "interactive",
  11562. inherited: true,
  11563. animationType: "discrete",
  11564. percentages: "no",
  11565. groups: [
  11566. "Microsoft Extensions"
  11567. ],
  11568. initial: "grippers",
  11569. appliesto: "allElements",
  11570. computed: "asSpecified",
  11571. order: "uniqueOrder",
  11572. status: "nonstandard",
  11573. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-touch-select"
  11574. },
  11575. "-ms-user-select": {
  11576. syntax: "none | element | text",
  11577. media: "interactive",
  11578. inherited: false,
  11579. animationType: "discrete",
  11580. percentages: "no",
  11581. groups: [
  11582. "Microsoft Extensions"
  11583. ],
  11584. initial: "text",
  11585. appliesto: "nonReplacedElements",
  11586. computed: "asSpecified",
  11587. order: "uniqueOrder",
  11588. status: "nonstandard",
  11589. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-user-select"
  11590. },
  11591. "-ms-wrap-flow": {
  11592. syntax: "auto | both | start | end | maximum | clear",
  11593. media: "visual",
  11594. inherited: false,
  11595. animationType: "discrete",
  11596. percentages: "no",
  11597. groups: [
  11598. "Microsoft Extensions"
  11599. ],
  11600. initial: "auto",
  11601. appliesto: "blockLevelElements",
  11602. computed: "asSpecified",
  11603. order: "uniqueOrder",
  11604. status: "nonstandard",
  11605. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-flow"
  11606. },
  11607. "-ms-wrap-margin": {
  11608. syntax: "<length>",
  11609. media: "visual",
  11610. inherited: false,
  11611. animationType: "discrete",
  11612. percentages: "no",
  11613. groups: [
  11614. "Microsoft Extensions"
  11615. ],
  11616. initial: "0",
  11617. appliesto: "exclusionElements",
  11618. computed: "asSpecified",
  11619. order: "uniqueOrder",
  11620. status: "nonstandard",
  11621. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-margin"
  11622. },
  11623. "-ms-wrap-through": {
  11624. syntax: "wrap | none",
  11625. media: "visual",
  11626. inherited: false,
  11627. animationType: "discrete",
  11628. percentages: "no",
  11629. groups: [
  11630. "Microsoft Extensions"
  11631. ],
  11632. initial: "wrap",
  11633. appliesto: "blockLevelElements",
  11634. computed: "asSpecified",
  11635. order: "uniqueOrder",
  11636. status: "nonstandard",
  11637. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-through"
  11638. },
  11639. "-moz-appearance": {
  11640. syntax: "none | button | button-arrow-down | button-arrow-next | button-arrow-previous | button-arrow-up | button-bevel | button-focus | caret | checkbox | checkbox-container | checkbox-label | checkmenuitem | dualbutton | groupbox | listbox | listitem | menuarrow | menubar | menucheckbox | menuimage | menuitem | menuitemtext | menulist | menulist-button | menulist-text | menulist-textfield | menupopup | menuradio | menuseparator | meterbar | meterchunk | progressbar | progressbar-vertical | progresschunk | progresschunk-vertical | radio | radio-container | radio-label | radiomenuitem | range | range-thumb | resizer | resizerpanel | scale-horizontal | scalethumbend | scalethumb-horizontal | scalethumbstart | scalethumbtick | scalethumb-vertical | scale-vertical | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical | searchfield | separator | sheet | spinner | spinner-downbutton | spinner-textfield | spinner-upbutton | splitter | statusbar | statusbarpanel | tab | tabpanel | tabpanels | tab-scroll-arrow-back | tab-scroll-arrow-forward | textfield | textfield-multiline | toolbar | toolbarbutton | toolbarbutton-dropdown | toolbargripper | toolbox | tooltip | treeheader | treeheadercell | treeheadersortarrow | treeitem | treeline | treetwisty | treetwistyopen | treeview | -moz-mac-unified-toolbar | -moz-win-borderless-glass | -moz-win-browsertabbar-toolbox | -moz-win-communicationstext | -moz-win-communications-toolbox | -moz-win-exclude-glass | -moz-win-glass | -moz-win-mediatext | -moz-win-media-toolbox | -moz-window-button-box | -moz-window-button-box-maximized | -moz-window-button-close | -moz-window-button-maximize | -moz-window-button-minimize | -moz-window-button-restore | -moz-window-frame-bottom | -moz-window-frame-left | -moz-window-frame-right | -moz-window-titlebar | -moz-window-titlebar-maximized",
  11641. media: "visual",
  11642. inherited: false,
  11643. animationType: "discrete",
  11644. percentages: "no",
  11645. groups: [
  11646. "Mozilla Extensions",
  11647. "WebKit Extensions"
  11648. ],
  11649. initial: "noneButOverriddenInUserAgentCSS",
  11650. appliesto: "allElements",
  11651. computed: "asSpecified",
  11652. order: "uniqueOrder",
  11653. status: "nonstandard",
  11654. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-appearance"
  11655. },
  11656. "-moz-binding": {
  11657. syntax: "<url> | none",
  11658. media: "visual",
  11659. inherited: false,
  11660. animationType: "discrete",
  11661. percentages: "no",
  11662. groups: [
  11663. "Mozilla Extensions"
  11664. ],
  11665. initial: "none",
  11666. appliesto: "allElementsExceptGeneratedContentOrPseudoElements",
  11667. computed: "asSpecified",
  11668. order: "uniqueOrder",
  11669. status: "nonstandard",
  11670. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-binding"
  11671. },
  11672. "-moz-border-bottom-colors": {
  11673. syntax: "<color>+ | none",
  11674. media: "visual",
  11675. inherited: false,
  11676. animationType: "discrete",
  11677. percentages: "no",
  11678. groups: [
  11679. "Mozilla Extensions"
  11680. ],
  11681. initial: "none",
  11682. appliesto: "allElements",
  11683. computed: "asSpecified",
  11684. order: "uniqueOrder",
  11685. status: "nonstandard",
  11686. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-bottom-colors"
  11687. },
  11688. "-moz-border-left-colors": {
  11689. syntax: "<color>+ | none",
  11690. media: "visual",
  11691. inherited: false,
  11692. animationType: "discrete",
  11693. percentages: "no",
  11694. groups: [
  11695. "Mozilla Extensions"
  11696. ],
  11697. initial: "none",
  11698. appliesto: "allElements",
  11699. computed: "asSpecified",
  11700. order: "uniqueOrder",
  11701. status: "nonstandard",
  11702. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-left-colors"
  11703. },
  11704. "-moz-border-right-colors": {
  11705. syntax: "<color>+ | none",
  11706. media: "visual",
  11707. inherited: false,
  11708. animationType: "discrete",
  11709. percentages: "no",
  11710. groups: [
  11711. "Mozilla Extensions"
  11712. ],
  11713. initial: "none",
  11714. appliesto: "allElements",
  11715. computed: "asSpecified",
  11716. order: "uniqueOrder",
  11717. status: "nonstandard",
  11718. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-right-colors"
  11719. },
  11720. "-moz-border-top-colors": {
  11721. syntax: "<color>+ | none",
  11722. media: "visual",
  11723. inherited: false,
  11724. animationType: "discrete",
  11725. percentages: "no",
  11726. groups: [
  11727. "Mozilla Extensions"
  11728. ],
  11729. initial: "none",
  11730. appliesto: "allElements",
  11731. computed: "asSpecified",
  11732. order: "uniqueOrder",
  11733. status: "nonstandard",
  11734. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-top-colors"
  11735. },
  11736. "-moz-context-properties": {
  11737. syntax: "none | [ fill | fill-opacity | stroke | stroke-opacity ]#",
  11738. media: "visual",
  11739. inherited: true,
  11740. animationType: "discrete",
  11741. percentages: "no",
  11742. groups: [
  11743. "Mozilla Extensions"
  11744. ],
  11745. initial: "none",
  11746. appliesto: "allElementsThatCanReferenceImages",
  11747. computed: "asSpecified",
  11748. order: "uniqueOrder",
  11749. status: "nonstandard",
  11750. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-context-properties"
  11751. },
  11752. "-moz-float-edge": {
  11753. syntax: "border-box | content-box | margin-box | padding-box",
  11754. media: "visual",
  11755. inherited: false,
  11756. animationType: "discrete",
  11757. percentages: "no",
  11758. groups: [
  11759. "Mozilla Extensions"
  11760. ],
  11761. initial: "content-box",
  11762. appliesto: "allElements",
  11763. computed: "asSpecified",
  11764. order: "uniqueOrder",
  11765. status: "nonstandard",
  11766. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-float-edge"
  11767. },
  11768. "-moz-force-broken-image-icon": {
  11769. syntax: "<integer>",
  11770. media: "visual",
  11771. inherited: false,
  11772. animationType: "discrete",
  11773. percentages: "no",
  11774. groups: [
  11775. "Mozilla Extensions"
  11776. ],
  11777. initial: "0",
  11778. appliesto: "images",
  11779. computed: "asSpecified",
  11780. order: "uniqueOrder",
  11781. status: "nonstandard",
  11782. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-force-broken-image-icon"
  11783. },
  11784. "-moz-image-region": {
  11785. syntax: "<shape> | auto",
  11786. media: "visual",
  11787. inherited: true,
  11788. animationType: "discrete",
  11789. percentages: "no",
  11790. groups: [
  11791. "Mozilla Extensions"
  11792. ],
  11793. initial: "auto",
  11794. appliesto: "xulImageElements",
  11795. computed: "asSpecified",
  11796. order: "uniqueOrder",
  11797. status: "nonstandard",
  11798. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-image-region"
  11799. },
  11800. "-moz-orient": {
  11801. syntax: "inline | block | horizontal | vertical",
  11802. media: "visual",
  11803. inherited: false,
  11804. animationType: "discrete",
  11805. percentages: "no",
  11806. groups: [
  11807. "Mozilla Extensions"
  11808. ],
  11809. initial: "inline",
  11810. appliesto: "anyElementEffectOnProgressAndMeter",
  11811. computed: "asSpecified",
  11812. order: "uniqueOrder",
  11813. status: "nonstandard",
  11814. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-orient"
  11815. },
  11816. "-moz-outline-radius": {
  11817. syntax: "<outline-radius>{1,4} [ / <outline-radius>{1,4} ]?",
  11818. media: "visual",
  11819. inherited: false,
  11820. animationType: [
  11821. "-moz-outline-radius-topleft",
  11822. "-moz-outline-radius-topright",
  11823. "-moz-outline-radius-bottomright",
  11824. "-moz-outline-radius-bottomleft"
  11825. ],
  11826. percentages: [
  11827. "-moz-outline-radius-topleft",
  11828. "-moz-outline-radius-topright",
  11829. "-moz-outline-radius-bottomright",
  11830. "-moz-outline-radius-bottomleft"
  11831. ],
  11832. groups: [
  11833. "Mozilla Extensions"
  11834. ],
  11835. initial: [
  11836. "-moz-outline-radius-topleft",
  11837. "-moz-outline-radius-topright",
  11838. "-moz-outline-radius-bottomright",
  11839. "-moz-outline-radius-bottomleft"
  11840. ],
  11841. appliesto: "allElements",
  11842. computed: [
  11843. "-moz-outline-radius-topleft",
  11844. "-moz-outline-radius-topright",
  11845. "-moz-outline-radius-bottomright",
  11846. "-moz-outline-radius-bottomleft"
  11847. ],
  11848. order: "uniqueOrder",
  11849. status: "nonstandard",
  11850. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius"
  11851. },
  11852. "-moz-outline-radius-bottomleft": {
  11853. syntax: "<outline-radius>",
  11854. media: "visual",
  11855. inherited: false,
  11856. animationType: "lpc",
  11857. percentages: "referToDimensionOfBorderBox",
  11858. groups: [
  11859. "Mozilla Extensions"
  11860. ],
  11861. initial: "0",
  11862. appliesto: "allElements",
  11863. computed: "asSpecified",
  11864. order: "uniqueOrder",
  11865. status: "nonstandard",
  11866. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-bottomleft"
  11867. },
  11868. "-moz-outline-radius-bottomright": {
  11869. syntax: "<outline-radius>",
  11870. media: "visual",
  11871. inherited: false,
  11872. animationType: "lpc",
  11873. percentages: "referToDimensionOfBorderBox",
  11874. groups: [
  11875. "Mozilla Extensions"
  11876. ],
  11877. initial: "0",
  11878. appliesto: "allElements",
  11879. computed: "asSpecified",
  11880. order: "uniqueOrder",
  11881. status: "nonstandard",
  11882. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-bottomright"
  11883. },
  11884. "-moz-outline-radius-topleft": {
  11885. syntax: "<outline-radius>",
  11886. media: "visual",
  11887. inherited: false,
  11888. animationType: "lpc",
  11889. percentages: "referToDimensionOfBorderBox",
  11890. groups: [
  11891. "Mozilla Extensions"
  11892. ],
  11893. initial: "0",
  11894. appliesto: "allElements",
  11895. computed: "asSpecified",
  11896. order: "uniqueOrder",
  11897. status: "nonstandard",
  11898. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-topleft"
  11899. },
  11900. "-moz-outline-radius-topright": {
  11901. syntax: "<outline-radius>",
  11902. media: "visual",
  11903. inherited: false,
  11904. animationType: "lpc",
  11905. percentages: "referToDimensionOfBorderBox",
  11906. groups: [
  11907. "Mozilla Extensions"
  11908. ],
  11909. initial: "0",
  11910. appliesto: "allElements",
  11911. computed: "asSpecified",
  11912. order: "uniqueOrder",
  11913. status: "nonstandard",
  11914. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-topright"
  11915. },
  11916. "-moz-stack-sizing": {
  11917. syntax: "ignore | stretch-to-fit",
  11918. media: "visual",
  11919. inherited: true,
  11920. animationType: "discrete",
  11921. percentages: "no",
  11922. groups: [
  11923. "Mozilla Extensions"
  11924. ],
  11925. initial: "stretch-to-fit",
  11926. appliesto: "allElements",
  11927. computed: "asSpecified",
  11928. order: "uniqueOrder",
  11929. status: "nonstandard",
  11930. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-stack-sizing"
  11931. },
  11932. "-moz-text-blink": {
  11933. syntax: "none | blink",
  11934. media: "visual",
  11935. inherited: false,
  11936. animationType: "discrete",
  11937. percentages: "no",
  11938. groups: [
  11939. "Mozilla Extensions"
  11940. ],
  11941. initial: "none",
  11942. appliesto: "allElements",
  11943. computed: "asSpecified",
  11944. order: "uniqueOrder",
  11945. status: "nonstandard",
  11946. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-text-blink"
  11947. },
  11948. "-moz-user-focus": {
  11949. syntax: "ignore | normal | select-after | select-before | select-menu | select-same | select-all | none",
  11950. media: "interactive",
  11951. inherited: false,
  11952. animationType: "discrete",
  11953. percentages: "no",
  11954. groups: [
  11955. "Mozilla Extensions"
  11956. ],
  11957. initial: "none",
  11958. appliesto: "allElements",
  11959. computed: "asSpecified",
  11960. order: "uniqueOrder",
  11961. status: "nonstandard",
  11962. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-user-focus"
  11963. },
  11964. "-moz-user-input": {
  11965. syntax: "auto | none | enabled | disabled",
  11966. media: "visual",
  11967. inherited: true,
  11968. animationType: "discrete",
  11969. percentages: "no",
  11970. groups: [
  11971. "Mozilla Extensions"
  11972. ],
  11973. initial: "auto",
  11974. appliesto: "allElements",
  11975. computed: "asSpecified",
  11976. order: "uniqueOrder",
  11977. status: "nonstandard",
  11978. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-user-input"
  11979. },
  11980. "-moz-user-modify": {
  11981. syntax: "read-only | read-write | write-only",
  11982. media: "interactive",
  11983. inherited: true,
  11984. animationType: "discrete",
  11985. percentages: "no",
  11986. groups: [
  11987. "Mozilla Extensions"
  11988. ],
  11989. initial: "read-only",
  11990. appliesto: "allElements",
  11991. computed: "asSpecified",
  11992. order: "uniqueOrder",
  11993. status: "nonstandard",
  11994. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-user-modify"
  11995. },
  11996. "-moz-window-dragging": {
  11997. syntax: "drag | no-drag",
  11998. media: "visual",
  11999. inherited: false,
  12000. animationType: "discrete",
  12001. percentages: "no",
  12002. groups: [
  12003. "Mozilla Extensions"
  12004. ],
  12005. initial: "drag",
  12006. appliesto: "allElementsCreatingNativeWindows",
  12007. computed: "asSpecified",
  12008. order: "uniqueOrder",
  12009. status: "nonstandard",
  12010. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-window-dragging"
  12011. },
  12012. "-moz-window-shadow": {
  12013. syntax: "default | menu | tooltip | sheet | none",
  12014. media: "visual",
  12015. inherited: false,
  12016. animationType: "discrete",
  12017. percentages: "no",
  12018. groups: [
  12019. "Mozilla Extensions"
  12020. ],
  12021. initial: "default",
  12022. appliesto: "allElementsCreatingNativeWindows",
  12023. computed: "asSpecified",
  12024. order: "uniqueOrder",
  12025. status: "nonstandard",
  12026. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-window-shadow"
  12027. },
  12028. "-webkit-appearance": {
  12029. 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",
  12030. media: "visual",
  12031. inherited: false,
  12032. animationType: "discrete",
  12033. percentages: "no",
  12034. groups: [
  12035. "WebKit Extensions"
  12036. ],
  12037. initial: "noneButOverriddenInUserAgentCSS",
  12038. appliesto: "allElements",
  12039. computed: "asSpecified",
  12040. order: "uniqueOrder",
  12041. status: "nonstandard",
  12042. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-appearance"
  12043. },
  12044. "-webkit-border-before": {
  12045. syntax: "<'border-width'> || <'border-style'> || <'color'>",
  12046. media: "visual",
  12047. inherited: true,
  12048. animationType: "discrete",
  12049. percentages: [
  12050. "-webkit-border-before-width"
  12051. ],
  12052. groups: [
  12053. "WebKit Extensions"
  12054. ],
  12055. initial: [
  12056. "border-width",
  12057. "border-style",
  12058. "color"
  12059. ],
  12060. appliesto: "allElements",
  12061. computed: [
  12062. "border-width",
  12063. "border-style",
  12064. "color"
  12065. ],
  12066. order: "uniqueOrder",
  12067. status: "nonstandard",
  12068. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-border-before"
  12069. },
  12070. "-webkit-border-before-color": {
  12071. syntax: "<'color'>",
  12072. media: "visual",
  12073. inherited: true,
  12074. animationType: "discrete",
  12075. percentages: "no",
  12076. groups: [
  12077. "WebKit Extensions"
  12078. ],
  12079. initial: "currentcolor",
  12080. appliesto: "allElements",
  12081. computed: "computedColor",
  12082. order: "uniqueOrder",
  12083. status: "nonstandard"
  12084. },
  12085. "-webkit-border-before-style": {
  12086. syntax: "<'border-style'>",
  12087. media: "visual",
  12088. inherited: true,
  12089. animationType: "discrete",
  12090. percentages: "no",
  12091. groups: [
  12092. "WebKit Extensions"
  12093. ],
  12094. initial: "none",
  12095. appliesto: "allElements",
  12096. computed: "asSpecified",
  12097. order: "uniqueOrder",
  12098. status: "nonstandard"
  12099. },
  12100. "-webkit-border-before-width": {
  12101. syntax: "<'border-width'>",
  12102. media: "visual",
  12103. inherited: true,
  12104. animationType: "discrete",
  12105. percentages: "logicalWidthOfContainingBlock",
  12106. groups: [
  12107. "WebKit Extensions"
  12108. ],
  12109. initial: "medium",
  12110. appliesto: "allElements",
  12111. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  12112. order: "uniqueOrder",
  12113. status: "nonstandard"
  12114. },
  12115. "-webkit-box-reflect": {
  12116. syntax: "[ above | below | right | left ]? <length>? <image>?",
  12117. media: "visual",
  12118. inherited: false,
  12119. animationType: "discrete",
  12120. percentages: "no",
  12121. groups: [
  12122. "WebKit Extensions"
  12123. ],
  12124. initial: "none",
  12125. appliesto: "allElements",
  12126. computed: "asSpecified",
  12127. order: "uniqueOrder",
  12128. status: "nonstandard",
  12129. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-box-reflect"
  12130. },
  12131. "-webkit-line-clamp": {
  12132. syntax: "none | <integer>",
  12133. media: "visual",
  12134. inherited: false,
  12135. animationType: "byComputedValueType",
  12136. percentages: "no",
  12137. groups: [
  12138. "WebKit Extensions",
  12139. "CSS Overflow"
  12140. ],
  12141. initial: "none",
  12142. appliesto: "allElements",
  12143. computed: "asSpecified",
  12144. order: "uniqueOrder",
  12145. status: "standard",
  12146. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-line-clamp"
  12147. },
  12148. "-webkit-mask": {
  12149. syntax: "[ <mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || [ <box> | border | padding | content | text ] || [ <box> | border | padding | content ] ]#",
  12150. media: "visual",
  12151. inherited: false,
  12152. animationType: "discrete",
  12153. percentages: "no",
  12154. groups: [
  12155. "WebKit Extensions"
  12156. ],
  12157. initial: [
  12158. "-webkit-mask-image",
  12159. "-webkit-mask-repeat",
  12160. "-webkit-mask-attachment",
  12161. "-webkit-mask-position",
  12162. "-webkit-mask-origin",
  12163. "-webkit-mask-clip"
  12164. ],
  12165. appliesto: "allElements",
  12166. computed: [
  12167. "-webkit-mask-image",
  12168. "-webkit-mask-repeat",
  12169. "-webkit-mask-attachment",
  12170. "-webkit-mask-position",
  12171. "-webkit-mask-origin",
  12172. "-webkit-mask-clip"
  12173. ],
  12174. order: "uniqueOrder",
  12175. status: "nonstandard",
  12176. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask"
  12177. },
  12178. "-webkit-mask-attachment": {
  12179. syntax: "<attachment>#",
  12180. media: "visual",
  12181. inherited: false,
  12182. animationType: "discrete",
  12183. percentages: "no",
  12184. groups: [
  12185. "WebKit Extensions"
  12186. ],
  12187. initial: "scroll",
  12188. appliesto: "allElements",
  12189. computed: "asSpecified",
  12190. order: "orderOfAppearance",
  12191. status: "nonstandard",
  12192. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-attachment"
  12193. },
  12194. "-webkit-mask-clip": {
  12195. syntax: "[ <box> | border | padding | content | text ]#",
  12196. media: "visual",
  12197. inherited: false,
  12198. animationType: "discrete",
  12199. percentages: "no",
  12200. groups: [
  12201. "WebKit Extensions"
  12202. ],
  12203. initial: "border",
  12204. appliesto: "allElements",
  12205. computed: "asSpecified",
  12206. order: "orderOfAppearance",
  12207. status: "nonstandard",
  12208. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-clip"
  12209. },
  12210. "-webkit-mask-composite": {
  12211. syntax: "<composite-style>#",
  12212. media: "visual",
  12213. inherited: false,
  12214. animationType: "discrete",
  12215. percentages: "no",
  12216. groups: [
  12217. "WebKit Extensions"
  12218. ],
  12219. initial: "source-over",
  12220. appliesto: "allElements",
  12221. computed: "asSpecified",
  12222. order: "orderOfAppearance",
  12223. status: "nonstandard",
  12224. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-composite"
  12225. },
  12226. "-webkit-mask-image": {
  12227. syntax: "<mask-reference>#",
  12228. media: "visual",
  12229. inherited: false,
  12230. animationType: "discrete",
  12231. percentages: "no",
  12232. groups: [
  12233. "WebKit Extensions"
  12234. ],
  12235. initial: "none",
  12236. appliesto: "allElements",
  12237. computed: "absoluteURIOrNone",
  12238. order: "orderOfAppearance",
  12239. status: "nonstandard",
  12240. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-image"
  12241. },
  12242. "-webkit-mask-origin": {
  12243. syntax: "[ <box> | border | padding | content ]#",
  12244. media: "visual",
  12245. inherited: false,
  12246. animationType: "discrete",
  12247. percentages: "no",
  12248. groups: [
  12249. "WebKit Extensions"
  12250. ],
  12251. initial: "padding",
  12252. appliesto: "allElements",
  12253. computed: "asSpecified",
  12254. order: "orderOfAppearance",
  12255. status: "nonstandard",
  12256. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-origin"
  12257. },
  12258. "-webkit-mask-position": {
  12259. syntax: "<position>#",
  12260. media: "visual",
  12261. inherited: false,
  12262. animationType: "discrete",
  12263. percentages: "referToSizeOfElement",
  12264. groups: [
  12265. "WebKit Extensions"
  12266. ],
  12267. initial: "0% 0%",
  12268. appliesto: "allElements",
  12269. computed: "absoluteLengthOrPercentage",
  12270. order: "orderOfAppearance",
  12271. status: "nonstandard",
  12272. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-position"
  12273. },
  12274. "-webkit-mask-position-x": {
  12275. syntax: "[ <length-percentage> | left | center | right ]#",
  12276. media: "visual",
  12277. inherited: false,
  12278. animationType: "discrete",
  12279. percentages: "referToSizeOfElement",
  12280. groups: [
  12281. "WebKit Extensions"
  12282. ],
  12283. initial: "0%",
  12284. appliesto: "allElements",
  12285. computed: "absoluteLengthOrPercentage",
  12286. order: "orderOfAppearance",
  12287. status: "nonstandard",
  12288. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-position-x"
  12289. },
  12290. "-webkit-mask-position-y": {
  12291. syntax: "[ <length-percentage> | top | center | bottom ]#",
  12292. media: "visual",
  12293. inherited: false,
  12294. animationType: "discrete",
  12295. percentages: "referToSizeOfElement",
  12296. groups: [
  12297. "WebKit Extensions"
  12298. ],
  12299. initial: "0%",
  12300. appliesto: "allElements",
  12301. computed: "absoluteLengthOrPercentage",
  12302. order: "orderOfAppearance",
  12303. status: "nonstandard",
  12304. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-position-y"
  12305. },
  12306. "-webkit-mask-repeat": {
  12307. syntax: "<repeat-style>#",
  12308. media: "visual",
  12309. inherited: false,
  12310. animationType: "discrete",
  12311. percentages: "no",
  12312. groups: [
  12313. "WebKit Extensions"
  12314. ],
  12315. initial: "repeat",
  12316. appliesto: "allElements",
  12317. computed: "asSpecified",
  12318. order: "orderOfAppearance",
  12319. status: "nonstandard",
  12320. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-repeat"
  12321. },
  12322. "-webkit-mask-repeat-x": {
  12323. syntax: "repeat | no-repeat | space | round",
  12324. media: "visual",
  12325. inherited: false,
  12326. animationType: "discrete",
  12327. percentages: "no",
  12328. groups: [
  12329. "WebKit Extensions"
  12330. ],
  12331. initial: "repeat",
  12332. appliesto: "allElements",
  12333. computed: "asSpecified",
  12334. order: "orderOfAppearance",
  12335. status: "nonstandard",
  12336. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-repeat-x"
  12337. },
  12338. "-webkit-mask-repeat-y": {
  12339. syntax: "repeat | no-repeat | space | round",
  12340. media: "visual",
  12341. inherited: false,
  12342. animationType: "discrete",
  12343. percentages: "no",
  12344. groups: [
  12345. "WebKit Extensions"
  12346. ],
  12347. initial: "repeat",
  12348. appliesto: "allElements",
  12349. computed: "absoluteLengthOrPercentage",
  12350. order: "orderOfAppearance",
  12351. status: "nonstandard",
  12352. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-repeat-y"
  12353. },
  12354. "-webkit-mask-size": {
  12355. syntax: "<bg-size>#",
  12356. media: "visual",
  12357. inherited: false,
  12358. animationType: "discrete",
  12359. percentages: "relativeToBackgroundPositioningArea",
  12360. groups: [
  12361. "WebKit Extensions"
  12362. ],
  12363. initial: "auto auto",
  12364. appliesto: "allElements",
  12365. computed: "asSpecified",
  12366. order: "orderOfAppearance",
  12367. status: "nonstandard",
  12368. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-size"
  12369. },
  12370. "-webkit-overflow-scrolling": {
  12371. syntax: "auto | touch",
  12372. media: "visual",
  12373. inherited: true,
  12374. animationType: "discrete",
  12375. percentages: "no",
  12376. groups: [
  12377. "WebKit Extensions"
  12378. ],
  12379. initial: "auto",
  12380. appliesto: "scrollingBoxes",
  12381. computed: "asSpecified",
  12382. order: "orderOfAppearance",
  12383. status: "nonstandard",
  12384. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-overflow-scrolling"
  12385. },
  12386. "-webkit-tap-highlight-color": {
  12387. syntax: "<color>",
  12388. media: "visual",
  12389. inherited: false,
  12390. animationType: "discrete",
  12391. percentages: "no",
  12392. groups: [
  12393. "WebKit Extensions"
  12394. ],
  12395. initial: "black",
  12396. appliesto: "allElements",
  12397. computed: "asSpecified",
  12398. order: "uniqueOrder",
  12399. status: "nonstandard",
  12400. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-tap-highlight-color"
  12401. },
  12402. "-webkit-text-fill-color": {
  12403. syntax: "<color>",
  12404. media: "visual",
  12405. inherited: true,
  12406. animationType: "color",
  12407. percentages: "no",
  12408. groups: [
  12409. "WebKit Extensions"
  12410. ],
  12411. initial: "currentcolor",
  12412. appliesto: "allElements",
  12413. computed: "computedColor",
  12414. order: "uniqueOrder",
  12415. status: "nonstandard",
  12416. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-fill-color"
  12417. },
  12418. "-webkit-text-stroke": {
  12419. syntax: "<length> || <color>",
  12420. media: "visual",
  12421. inherited: true,
  12422. animationType: [
  12423. "-webkit-text-stroke-width",
  12424. "-webkit-text-stroke-color"
  12425. ],
  12426. percentages: "no",
  12427. groups: [
  12428. "WebKit Extensions"
  12429. ],
  12430. initial: [
  12431. "-webkit-text-stroke-width",
  12432. "-webkit-text-stroke-color"
  12433. ],
  12434. appliesto: "allElements",
  12435. computed: [
  12436. "-webkit-text-stroke-width",
  12437. "-webkit-text-stroke-color"
  12438. ],
  12439. order: "canonicalOrder",
  12440. status: "nonstandard",
  12441. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke"
  12442. },
  12443. "-webkit-text-stroke-color": {
  12444. syntax: "<color>",
  12445. media: "visual",
  12446. inherited: true,
  12447. animationType: "color",
  12448. percentages: "no",
  12449. groups: [
  12450. "WebKit Extensions"
  12451. ],
  12452. initial: "currentcolor",
  12453. appliesto: "allElements",
  12454. computed: "computedColor",
  12455. order: "uniqueOrder",
  12456. status: "nonstandard",
  12457. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-color"
  12458. },
  12459. "-webkit-text-stroke-width": {
  12460. syntax: "<length>",
  12461. media: "visual",
  12462. inherited: true,
  12463. animationType: "discrete",
  12464. percentages: "no",
  12465. groups: [
  12466. "WebKit Extensions"
  12467. ],
  12468. initial: "0",
  12469. appliesto: "allElements",
  12470. computed: "absoluteLength",
  12471. order: "uniqueOrder",
  12472. status: "nonstandard",
  12473. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-width"
  12474. },
  12475. "-webkit-touch-callout": {
  12476. syntax: "default | none",
  12477. media: "visual",
  12478. inherited: true,
  12479. animationType: "discrete",
  12480. percentages: "no",
  12481. groups: [
  12482. "WebKit Extensions"
  12483. ],
  12484. initial: "default",
  12485. appliesto: "allElements",
  12486. computed: "asSpecified",
  12487. order: "uniqueOrder",
  12488. status: "nonstandard",
  12489. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-touch-callout"
  12490. },
  12491. "-webkit-user-modify": {
  12492. syntax: "read-only | read-write | read-write-plaintext-only",
  12493. media: "interactive",
  12494. inherited: true,
  12495. animationType: "discrete",
  12496. percentages: "no",
  12497. groups: [
  12498. "WebKit Extensions"
  12499. ],
  12500. initial: "read-only",
  12501. appliesto: "allElements",
  12502. computed: "asSpecified",
  12503. order: "uniqueOrder",
  12504. status: "nonstandard"
  12505. },
  12506. "align-content": {
  12507. syntax: "normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position>",
  12508. media: "visual",
  12509. inherited: false,
  12510. animationType: "discrete",
  12511. percentages: "no",
  12512. groups: [
  12513. "CSS Box Alignment"
  12514. ],
  12515. initial: "normal",
  12516. appliesto: "multilineFlexContainers",
  12517. computed: "asSpecified",
  12518. order: "uniqueOrder",
  12519. status: "standard",
  12520. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-content"
  12521. },
  12522. "align-items": {
  12523. syntax: "normal | stretch | <baseline-position> | [ <overflow-position>? <self-position> ]",
  12524. media: "visual",
  12525. inherited: false,
  12526. animationType: "discrete",
  12527. percentages: "no",
  12528. groups: [
  12529. "CSS Box Alignment"
  12530. ],
  12531. initial: "normal",
  12532. appliesto: "allElements",
  12533. computed: "asSpecified",
  12534. order: "uniqueOrder",
  12535. status: "standard",
  12536. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-items"
  12537. },
  12538. "align-self": {
  12539. syntax: "auto | normal | stretch | <baseline-position> | <overflow-position>? <self-position>",
  12540. media: "visual",
  12541. inherited: false,
  12542. animationType: "discrete",
  12543. percentages: "no",
  12544. groups: [
  12545. "CSS Box Alignment"
  12546. ],
  12547. initial: "auto",
  12548. appliesto: "flexItemsGridItemsAndAbsolutelyPositionedBoxes",
  12549. computed: "autoOnAbsolutelyPositionedElementsValueOfAlignItemsOnParent",
  12550. order: "uniqueOrder",
  12551. status: "standard",
  12552. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-self"
  12553. },
  12554. all: all,
  12555. animation: animation,
  12556. "animation-delay": {
  12557. syntax: "<time>#",
  12558. media: "visual",
  12559. inherited: false,
  12560. animationType: "discrete",
  12561. percentages: "no",
  12562. groups: [
  12563. "CSS Animations"
  12564. ],
  12565. initial: "0s",
  12566. appliesto: "allElementsAndPseudos",
  12567. computed: "asSpecified",
  12568. order: "uniqueOrder",
  12569. status: "standard",
  12570. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-delay"
  12571. },
  12572. "animation-direction": {
  12573. syntax: "<single-animation-direction>#",
  12574. media: "visual",
  12575. inherited: false,
  12576. animationType: "discrete",
  12577. percentages: "no",
  12578. groups: [
  12579. "CSS Animations"
  12580. ],
  12581. initial: "normal",
  12582. appliesto: "allElementsAndPseudos",
  12583. computed: "asSpecified",
  12584. order: "uniqueOrder",
  12585. status: "standard",
  12586. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-direction"
  12587. },
  12588. "animation-duration": {
  12589. syntax: "<time>#",
  12590. media: "visual",
  12591. inherited: false,
  12592. animationType: "discrete",
  12593. percentages: "no",
  12594. groups: [
  12595. "CSS Animations"
  12596. ],
  12597. initial: "0s",
  12598. appliesto: "allElementsAndPseudos",
  12599. computed: "asSpecified",
  12600. order: "uniqueOrder",
  12601. status: "standard",
  12602. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-duration"
  12603. },
  12604. "animation-fill-mode": {
  12605. syntax: "<single-animation-fill-mode>#",
  12606. media: "visual",
  12607. inherited: false,
  12608. animationType: "discrete",
  12609. percentages: "no",
  12610. groups: [
  12611. "CSS Animations"
  12612. ],
  12613. initial: "none",
  12614. appliesto: "allElementsAndPseudos",
  12615. computed: "asSpecified",
  12616. order: "uniqueOrder",
  12617. status: "standard",
  12618. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-fill-mode"
  12619. },
  12620. "animation-iteration-count": {
  12621. syntax: "<single-animation-iteration-count>#",
  12622. media: "visual",
  12623. inherited: false,
  12624. animationType: "discrete",
  12625. percentages: "no",
  12626. groups: [
  12627. "CSS Animations"
  12628. ],
  12629. initial: "1",
  12630. appliesto: "allElementsAndPseudos",
  12631. computed: "asSpecified",
  12632. order: "uniqueOrder",
  12633. status: "standard",
  12634. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-iteration-count"
  12635. },
  12636. "animation-name": {
  12637. syntax: "[ none | <keyframes-name> ]#",
  12638. media: "visual",
  12639. inherited: false,
  12640. animationType: "discrete",
  12641. percentages: "no",
  12642. groups: [
  12643. "CSS Animations"
  12644. ],
  12645. initial: "none",
  12646. appliesto: "allElementsAndPseudos",
  12647. computed: "asSpecified",
  12648. order: "uniqueOrder",
  12649. status: "standard",
  12650. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-name"
  12651. },
  12652. "animation-play-state": {
  12653. syntax: "<single-animation-play-state>#",
  12654. media: "visual",
  12655. inherited: false,
  12656. animationType: "discrete",
  12657. percentages: "no",
  12658. groups: [
  12659. "CSS Animations"
  12660. ],
  12661. initial: "running",
  12662. appliesto: "allElementsAndPseudos",
  12663. computed: "asSpecified",
  12664. order: "uniqueOrder",
  12665. status: "standard",
  12666. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-play-state"
  12667. },
  12668. "animation-timing-function": {
  12669. syntax: "<timing-function>#",
  12670. media: "visual",
  12671. inherited: false,
  12672. animationType: "discrete",
  12673. percentages: "no",
  12674. groups: [
  12675. "CSS Animations"
  12676. ],
  12677. initial: "ease",
  12678. appliesto: "allElementsAndPseudos",
  12679. computed: "asSpecified",
  12680. order: "uniqueOrder",
  12681. status: "standard",
  12682. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-timing-function"
  12683. },
  12684. appearance: appearance,
  12685. "aspect-ratio": {
  12686. syntax: "auto | <ratio>",
  12687. media: "all",
  12688. inherited: false,
  12689. animationType: "discrete",
  12690. percentages: "no",
  12691. groups: [
  12692. "CSS Basic User Interface"
  12693. ],
  12694. initial: "auto",
  12695. appliesto: "allElementsExceptInlineBoxesAndInternalRubyOrTableBoxes",
  12696. computed: "asSpecified",
  12697. order: "perGrammar",
  12698. status: "experimental",
  12699. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/aspect-ratio"
  12700. },
  12701. azimuth: azimuth,
  12702. "backdrop-filter": {
  12703. syntax: "none | <filter-function-list>",
  12704. media: "visual",
  12705. inherited: false,
  12706. animationType: "filterList",
  12707. percentages: "no",
  12708. groups: [
  12709. "Filter Effects"
  12710. ],
  12711. initial: "none",
  12712. appliesto: "allElementsSVGContainerElements",
  12713. computed: "asSpecified",
  12714. order: "uniqueOrder",
  12715. status: "experimental",
  12716. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/backdrop-filter"
  12717. },
  12718. "backface-visibility": {
  12719. syntax: "visible | hidden",
  12720. media: "visual",
  12721. inherited: false,
  12722. animationType: "discrete",
  12723. percentages: "no",
  12724. groups: [
  12725. "CSS Transforms"
  12726. ],
  12727. initial: "visible",
  12728. appliesto: "transformableElements",
  12729. computed: "asSpecified",
  12730. order: "uniqueOrder",
  12731. status: "standard",
  12732. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/backface-visibility"
  12733. },
  12734. background: background,
  12735. "background-attachment": {
  12736. syntax: "<attachment>#",
  12737. media: "visual",
  12738. inherited: false,
  12739. animationType: "discrete",
  12740. percentages: "no",
  12741. groups: [
  12742. "CSS Backgrounds and Borders"
  12743. ],
  12744. initial: "scroll",
  12745. appliesto: "allElements",
  12746. computed: "asSpecified",
  12747. order: "uniqueOrder",
  12748. alsoAppliesTo: [
  12749. "::first-letter",
  12750. "::first-line",
  12751. "::placeholder"
  12752. ],
  12753. status: "standard",
  12754. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-attachment"
  12755. },
  12756. "background-blend-mode": {
  12757. syntax: "<blend-mode>#",
  12758. media: "none",
  12759. inherited: false,
  12760. animationType: "discrete",
  12761. percentages: "no",
  12762. groups: [
  12763. "Compositing and Blending"
  12764. ],
  12765. initial: "normal",
  12766. appliesto: "allElementsSVGContainerGraphicsAndGraphicsReferencingElements",
  12767. computed: "asSpecified",
  12768. order: "uniqueOrder",
  12769. alsoAppliesTo: [
  12770. "::first-letter",
  12771. "::first-line",
  12772. "::placeholder"
  12773. ],
  12774. status: "standard",
  12775. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-blend-mode"
  12776. },
  12777. "background-clip": {
  12778. syntax: "<box>#",
  12779. media: "visual",
  12780. inherited: false,
  12781. animationType: "discrete",
  12782. percentages: "no",
  12783. groups: [
  12784. "CSS Backgrounds and Borders"
  12785. ],
  12786. initial: "border-box",
  12787. appliesto: "allElements",
  12788. computed: "asSpecified",
  12789. order: "uniqueOrder",
  12790. alsoAppliesTo: [
  12791. "::first-letter",
  12792. "::first-line",
  12793. "::placeholder"
  12794. ],
  12795. status: "standard",
  12796. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-clip"
  12797. },
  12798. "background-color": {
  12799. syntax: "<color>",
  12800. media: "visual",
  12801. inherited: false,
  12802. animationType: "color",
  12803. percentages: "no",
  12804. groups: [
  12805. "CSS Backgrounds and Borders"
  12806. ],
  12807. initial: "transparent",
  12808. appliesto: "allElements",
  12809. computed: "computedColor",
  12810. order: "uniqueOrder",
  12811. alsoAppliesTo: [
  12812. "::first-letter",
  12813. "::first-line",
  12814. "::placeholder"
  12815. ],
  12816. status: "standard",
  12817. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-color"
  12818. },
  12819. "background-image": {
  12820. syntax: "<bg-image>#",
  12821. media: "visual",
  12822. inherited: false,
  12823. animationType: "discrete",
  12824. percentages: "no",
  12825. groups: [
  12826. "CSS Backgrounds and Borders"
  12827. ],
  12828. initial: "none",
  12829. appliesto: "allElements",
  12830. computed: "asSpecifiedURLsAbsolute",
  12831. order: "uniqueOrder",
  12832. alsoAppliesTo: [
  12833. "::first-letter",
  12834. "::first-line",
  12835. "::placeholder"
  12836. ],
  12837. status: "standard",
  12838. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-image"
  12839. },
  12840. "background-origin": {
  12841. syntax: "<box>#",
  12842. media: "visual",
  12843. inherited: false,
  12844. animationType: "discrete",
  12845. percentages: "no",
  12846. groups: [
  12847. "CSS Backgrounds and Borders"
  12848. ],
  12849. initial: "padding-box",
  12850. appliesto: "allElements",
  12851. computed: "asSpecified",
  12852. order: "uniqueOrder",
  12853. alsoAppliesTo: [
  12854. "::first-letter",
  12855. "::first-line",
  12856. "::placeholder"
  12857. ],
  12858. status: "standard",
  12859. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-origin"
  12860. },
  12861. "background-position": {
  12862. syntax: "<bg-position>#",
  12863. media: "visual",
  12864. inherited: false,
  12865. animationType: "repeatableListOfSimpleListOfLpc",
  12866. percentages: "referToSizeOfBackgroundPositioningAreaMinusBackgroundImageSize",
  12867. groups: [
  12868. "CSS Backgrounds and Borders"
  12869. ],
  12870. initial: "0% 0%",
  12871. appliesto: "allElements",
  12872. computed: "listEachItemTwoKeywordsOriginOffsets",
  12873. order: "uniqueOrder",
  12874. alsoAppliesTo: [
  12875. "::first-letter",
  12876. "::first-line",
  12877. "::placeholder"
  12878. ],
  12879. status: "standard",
  12880. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position"
  12881. },
  12882. "background-position-x": {
  12883. syntax: "[ center | [ left | right | x-start | x-end ]? <length-percentage>? ]#",
  12884. media: "visual",
  12885. inherited: false,
  12886. animationType: "discrete",
  12887. percentages: "referToWidthOfBackgroundPositioningAreaMinusBackgroundImageHeight",
  12888. groups: [
  12889. "CSS Backgrounds and Borders"
  12890. ],
  12891. initial: "left",
  12892. appliesto: "allElements",
  12893. computed: "listEachItemConsistingOfAbsoluteLengthPercentageAndOrigin",
  12894. order: "uniqueOrder",
  12895. status: "experimental",
  12896. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position-x"
  12897. },
  12898. "background-position-y": {
  12899. syntax: "[ center | [ top | bottom | y-start | y-end ]? <length-percentage>? ]#",
  12900. media: "visual",
  12901. inherited: false,
  12902. animationType: "discrete",
  12903. percentages: "referToHeightOfBackgroundPositioningAreaMinusBackgroundImageHeight",
  12904. groups: [
  12905. "CSS Backgrounds and Borders"
  12906. ],
  12907. initial: "top",
  12908. appliesto: "allElements",
  12909. computed: "listEachItemConsistingOfAbsoluteLengthPercentageAndOrigin",
  12910. order: "uniqueOrder",
  12911. status: "experimental",
  12912. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position-y"
  12913. },
  12914. "background-repeat": {
  12915. syntax: "<repeat-style>#",
  12916. media: "visual",
  12917. inherited: false,
  12918. animationType: "discrete",
  12919. percentages: "no",
  12920. groups: [
  12921. "CSS Backgrounds and Borders"
  12922. ],
  12923. initial: "repeat",
  12924. appliesto: "allElements",
  12925. computed: "listEachItemHasTwoKeywordsOnePerDimension",
  12926. order: "uniqueOrder",
  12927. alsoAppliesTo: [
  12928. "::first-letter",
  12929. "::first-line",
  12930. "::placeholder"
  12931. ],
  12932. status: "standard",
  12933. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-repeat"
  12934. },
  12935. "background-size": {
  12936. syntax: "<bg-size>#",
  12937. media: "visual",
  12938. inherited: false,
  12939. animationType: "repeatableListOfSimpleListOfLpc",
  12940. percentages: "relativeToBackgroundPositioningArea",
  12941. groups: [
  12942. "CSS Backgrounds and Borders"
  12943. ],
  12944. initial: "auto auto",
  12945. appliesto: "allElements",
  12946. computed: "asSpecifiedRelativeToAbsoluteLengths",
  12947. order: "uniqueOrder",
  12948. alsoAppliesTo: [
  12949. "::first-letter",
  12950. "::first-line",
  12951. "::placeholder"
  12952. ],
  12953. status: "standard",
  12954. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-size"
  12955. },
  12956. "block-overflow": {
  12957. syntax: "clip | ellipsis | <string>",
  12958. media: "visual",
  12959. inherited: true,
  12960. animationType: "discrete",
  12961. percentages: "no",
  12962. groups: [
  12963. "CSS Overflow"
  12964. ],
  12965. initial: "clip",
  12966. appliesto: "blockContainers",
  12967. computed: "asSpecified",
  12968. order: "perGrammar",
  12969. status: "experimental"
  12970. },
  12971. "block-size": {
  12972. syntax: "<'width'>",
  12973. media: "visual",
  12974. inherited: false,
  12975. animationType: "discrete",
  12976. percentages: "blockSizeOfContainingBlock",
  12977. groups: [
  12978. "CSS Logical Properties"
  12979. ],
  12980. initial: "auto",
  12981. appliesto: "sameAsWidthAndHeight",
  12982. computed: "sameAsWidthAndHeight",
  12983. order: "uniqueOrder",
  12984. status: "standard",
  12985. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/block-size"
  12986. },
  12987. border: border,
  12988. "border-block": {
  12989. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  12990. media: "visual",
  12991. inherited: false,
  12992. animationType: "discrete",
  12993. percentages: "no",
  12994. groups: [
  12995. "CSS Logical Properties"
  12996. ],
  12997. initial: [
  12998. "border-top-width",
  12999. "border-top-style",
  13000. "border-top-color"
  13001. ],
  13002. appliesto: "allElements",
  13003. computed: [
  13004. "border-top-width",
  13005. "border-top-style",
  13006. "border-top-color"
  13007. ],
  13008. order: "uniqueOrder",
  13009. status: "standard",
  13010. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block"
  13011. },
  13012. "border-block-color": {
  13013. syntax: "<'border-top-color'>{1,2}",
  13014. media: "visual",
  13015. inherited: false,
  13016. animationType: "discrete",
  13017. percentages: "no",
  13018. groups: [
  13019. "CSS Logical Properties"
  13020. ],
  13021. initial: "currentcolor",
  13022. appliesto: "allElements",
  13023. computed: "computedColor",
  13024. order: "uniqueOrder",
  13025. status: "standard",
  13026. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-color"
  13027. },
  13028. "border-block-style": {
  13029. syntax: "<'border-top-style'>",
  13030. media: "visual",
  13031. inherited: false,
  13032. animationType: "discrete",
  13033. percentages: "no",
  13034. groups: [
  13035. "CSS Logical Properties"
  13036. ],
  13037. initial: "none",
  13038. appliesto: "allElements",
  13039. computed: "asSpecified",
  13040. order: "uniqueOrder",
  13041. status: "standard",
  13042. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-style"
  13043. },
  13044. "border-block-width": {
  13045. syntax: "<'border-top-width'>",
  13046. media: "visual",
  13047. inherited: false,
  13048. animationType: "discrete",
  13049. percentages: "logicalWidthOfContainingBlock",
  13050. groups: [
  13051. "CSS Logical Properties"
  13052. ],
  13053. initial: "medium",
  13054. appliesto: "allElements",
  13055. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13056. order: "uniqueOrder",
  13057. status: "standard",
  13058. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-width"
  13059. },
  13060. "border-block-end": {
  13061. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  13062. media: "visual",
  13063. inherited: false,
  13064. animationType: "discrete",
  13065. percentages: "no",
  13066. groups: [
  13067. "CSS Logical Properties"
  13068. ],
  13069. initial: [
  13070. "border-top-width",
  13071. "border-top-style",
  13072. "border-top-color"
  13073. ],
  13074. appliesto: "allElements",
  13075. computed: [
  13076. "border-top-width",
  13077. "border-top-style",
  13078. "border-top-color"
  13079. ],
  13080. order: "uniqueOrder",
  13081. status: "standard",
  13082. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end"
  13083. },
  13084. "border-block-end-color": {
  13085. syntax: "<'border-top-color'>",
  13086. media: "visual",
  13087. inherited: false,
  13088. animationType: "discrete",
  13089. percentages: "no",
  13090. groups: [
  13091. "CSS Logical Properties"
  13092. ],
  13093. initial: "currentcolor",
  13094. appliesto: "allElements",
  13095. computed: "computedColor",
  13096. order: "uniqueOrder",
  13097. status: "standard",
  13098. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end-color"
  13099. },
  13100. "border-block-end-style": {
  13101. syntax: "<'border-top-style'>",
  13102. media: "visual",
  13103. inherited: false,
  13104. animationType: "discrete",
  13105. percentages: "no",
  13106. groups: [
  13107. "CSS Logical Properties"
  13108. ],
  13109. initial: "none",
  13110. appliesto: "allElements",
  13111. computed: "asSpecified",
  13112. order: "uniqueOrder",
  13113. status: "standard",
  13114. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end-style"
  13115. },
  13116. "border-block-end-width": {
  13117. syntax: "<'border-top-width'>",
  13118. media: "visual",
  13119. inherited: false,
  13120. animationType: "discrete",
  13121. percentages: "logicalWidthOfContainingBlock",
  13122. groups: [
  13123. "CSS Logical Properties"
  13124. ],
  13125. initial: "medium",
  13126. appliesto: "allElements",
  13127. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13128. order: "uniqueOrder",
  13129. status: "standard",
  13130. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end-width"
  13131. },
  13132. "border-block-start": {
  13133. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  13134. media: "visual",
  13135. inherited: false,
  13136. animationType: "discrete",
  13137. percentages: "no",
  13138. groups: [
  13139. "CSS Logical Properties"
  13140. ],
  13141. initial: [
  13142. "border-width",
  13143. "border-style",
  13144. "color"
  13145. ],
  13146. appliesto: "allElements",
  13147. computed: [
  13148. "border-width",
  13149. "border-style",
  13150. "border-block-start-color"
  13151. ],
  13152. order: "uniqueOrder",
  13153. status: "standard",
  13154. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start"
  13155. },
  13156. "border-block-start-color": {
  13157. syntax: "<'border-top-color'>",
  13158. media: "visual",
  13159. inherited: false,
  13160. animationType: "discrete",
  13161. percentages: "no",
  13162. groups: [
  13163. "CSS Logical Properties"
  13164. ],
  13165. initial: "currentcolor",
  13166. appliesto: "allElements",
  13167. computed: "computedColor",
  13168. order: "uniqueOrder",
  13169. status: "standard",
  13170. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start-color"
  13171. },
  13172. "border-block-start-style": {
  13173. syntax: "<'border-top-style'>",
  13174. media: "visual",
  13175. inherited: false,
  13176. animationType: "discrete",
  13177. percentages: "no",
  13178. groups: [
  13179. "CSS Logical Properties"
  13180. ],
  13181. initial: "none",
  13182. appliesto: "allElements",
  13183. computed: "asSpecified",
  13184. order: "uniqueOrder",
  13185. status: "standard",
  13186. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start-style"
  13187. },
  13188. "border-block-start-width": {
  13189. syntax: "<'border-top-width'>",
  13190. media: "visual",
  13191. inherited: false,
  13192. animationType: "discrete",
  13193. percentages: "logicalWidthOfContainingBlock",
  13194. groups: [
  13195. "CSS Logical Properties"
  13196. ],
  13197. initial: "medium",
  13198. appliesto: "allElements",
  13199. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13200. order: "uniqueOrder",
  13201. status: "standard",
  13202. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start-width"
  13203. },
  13204. "border-bottom": {
  13205. syntax: "<line-width> || <line-style> || <color>",
  13206. media: "visual",
  13207. inherited: false,
  13208. animationType: [
  13209. "border-bottom-color",
  13210. "border-bottom-style",
  13211. "border-bottom-width"
  13212. ],
  13213. percentages: "no",
  13214. groups: [
  13215. "CSS Backgrounds and Borders"
  13216. ],
  13217. initial: [
  13218. "border-bottom-width",
  13219. "border-bottom-style",
  13220. "border-bottom-color"
  13221. ],
  13222. appliesto: "allElements",
  13223. computed: [
  13224. "border-bottom-width",
  13225. "border-bottom-style",
  13226. "border-bottom-color"
  13227. ],
  13228. order: "orderOfAppearance",
  13229. alsoAppliesTo: [
  13230. "::first-letter"
  13231. ],
  13232. status: "standard",
  13233. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom"
  13234. },
  13235. "border-bottom-color": {
  13236. syntax: "<'border-top-color'>",
  13237. media: "visual",
  13238. inherited: false,
  13239. animationType: "color",
  13240. percentages: "no",
  13241. groups: [
  13242. "CSS Backgrounds and Borders"
  13243. ],
  13244. initial: "currentcolor",
  13245. appliesto: "allElements",
  13246. computed: "computedColor",
  13247. order: "uniqueOrder",
  13248. alsoAppliesTo: [
  13249. "::first-letter"
  13250. ],
  13251. status: "standard",
  13252. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-color"
  13253. },
  13254. "border-bottom-left-radius": {
  13255. syntax: "<length-percentage>{1,2}",
  13256. media: "visual",
  13257. inherited: false,
  13258. animationType: "lpc",
  13259. percentages: "referToDimensionOfBorderBox",
  13260. groups: [
  13261. "CSS Backgrounds and Borders"
  13262. ],
  13263. initial: "0",
  13264. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13265. computed: "twoAbsoluteLengthOrPercentages",
  13266. order: "uniqueOrder",
  13267. alsoAppliesTo: [
  13268. "::first-letter"
  13269. ],
  13270. status: "standard",
  13271. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-left-radius"
  13272. },
  13273. "border-bottom-right-radius": {
  13274. syntax: "<length-percentage>{1,2}",
  13275. media: "visual",
  13276. inherited: false,
  13277. animationType: "lpc",
  13278. percentages: "referToDimensionOfBorderBox",
  13279. groups: [
  13280. "CSS Backgrounds and Borders"
  13281. ],
  13282. initial: "0",
  13283. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13284. computed: "twoAbsoluteLengthOrPercentages",
  13285. order: "uniqueOrder",
  13286. alsoAppliesTo: [
  13287. "::first-letter"
  13288. ],
  13289. status: "standard",
  13290. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-right-radius"
  13291. },
  13292. "border-bottom-style": {
  13293. syntax: "<line-style>",
  13294. media: "visual",
  13295. inherited: false,
  13296. animationType: "discrete",
  13297. percentages: "no",
  13298. groups: [
  13299. "CSS Backgrounds and Borders"
  13300. ],
  13301. initial: "none",
  13302. appliesto: "allElements",
  13303. computed: "asSpecified",
  13304. order: "uniqueOrder",
  13305. alsoAppliesTo: [
  13306. "::first-letter"
  13307. ],
  13308. status: "standard",
  13309. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-style"
  13310. },
  13311. "border-bottom-width": {
  13312. syntax: "<line-width>",
  13313. media: "visual",
  13314. inherited: false,
  13315. animationType: "length",
  13316. percentages: "no",
  13317. groups: [
  13318. "CSS Backgrounds and Borders"
  13319. ],
  13320. initial: "medium",
  13321. appliesto: "allElements",
  13322. computed: "absoluteLengthOr0IfBorderBottomStyleNoneOrHidden",
  13323. order: "uniqueOrder",
  13324. alsoAppliesTo: [
  13325. "::first-letter"
  13326. ],
  13327. status: "standard",
  13328. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-width"
  13329. },
  13330. "border-collapse": {
  13331. syntax: "collapse | separate",
  13332. media: "visual",
  13333. inherited: true,
  13334. animationType: "discrete",
  13335. percentages: "no",
  13336. groups: [
  13337. "CSS Table"
  13338. ],
  13339. initial: "separate",
  13340. appliesto: "tableElements",
  13341. computed: "asSpecified",
  13342. order: "uniqueOrder",
  13343. status: "standard",
  13344. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-collapse"
  13345. },
  13346. "border-color": {
  13347. syntax: "<color>{1,4}",
  13348. media: "visual",
  13349. inherited: false,
  13350. animationType: [
  13351. "border-bottom-color",
  13352. "border-left-color",
  13353. "border-right-color",
  13354. "border-top-color"
  13355. ],
  13356. percentages: "no",
  13357. groups: [
  13358. "CSS Backgrounds and Borders"
  13359. ],
  13360. initial: [
  13361. "border-top-color",
  13362. "border-right-color",
  13363. "border-bottom-color",
  13364. "border-left-color"
  13365. ],
  13366. appliesto: "allElements",
  13367. computed: [
  13368. "border-bottom-color",
  13369. "border-left-color",
  13370. "border-right-color",
  13371. "border-top-color"
  13372. ],
  13373. order: "uniqueOrder",
  13374. alsoAppliesTo: [
  13375. "::first-letter"
  13376. ],
  13377. status: "standard",
  13378. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-color"
  13379. },
  13380. "border-end-end-radius": {
  13381. syntax: "<length-percentage>{1,2}",
  13382. media: "visual",
  13383. inherited: false,
  13384. animationType: "lpc",
  13385. percentages: "referToDimensionOfBorderBox",
  13386. groups: [
  13387. "CSS Logical Properties"
  13388. ],
  13389. initial: "0",
  13390. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13391. computed: "twoAbsoluteLengthOrPercentages",
  13392. order: "uniqueOrder",
  13393. alsoAppliesTo: [
  13394. "::first-letter"
  13395. ],
  13396. status: "standard",
  13397. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-end-end-radius"
  13398. },
  13399. "border-end-start-radius": {
  13400. syntax: "<length-percentage>{1,2}",
  13401. media: "visual",
  13402. inherited: false,
  13403. animationType: "lpc",
  13404. percentages: "referToDimensionOfBorderBox",
  13405. groups: [
  13406. "CSS Logical Properties"
  13407. ],
  13408. initial: "0",
  13409. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13410. computed: "twoAbsoluteLengthOrPercentages",
  13411. order: "uniqueOrder",
  13412. alsoAppliesTo: [
  13413. "::first-letter"
  13414. ],
  13415. status: "standard",
  13416. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-end-start-radius"
  13417. },
  13418. "border-image": {
  13419. syntax: "<'border-image-source'> || <'border-image-slice'> [ / <'border-image-width'> | / <'border-image-width'>? / <'border-image-outset'> ]? || <'border-image-repeat'>",
  13420. media: "visual",
  13421. inherited: false,
  13422. animationType: "discrete",
  13423. percentages: [
  13424. "border-image-slice",
  13425. "border-image-width"
  13426. ],
  13427. groups: [
  13428. "CSS Backgrounds and Borders"
  13429. ],
  13430. initial: [
  13431. "border-image-source",
  13432. "border-image-slice",
  13433. "border-image-width",
  13434. "border-image-outset",
  13435. "border-image-repeat"
  13436. ],
  13437. appliesto: "allElementsExceptTableElementsWhenCollapse",
  13438. computed: [
  13439. "border-image-outset",
  13440. "border-image-repeat",
  13441. "border-image-slice",
  13442. "border-image-source",
  13443. "border-image-width"
  13444. ],
  13445. order: "uniqueOrder",
  13446. alsoAppliesTo: [
  13447. "::first-letter"
  13448. ],
  13449. status: "standard",
  13450. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image"
  13451. },
  13452. "border-image-outset": {
  13453. syntax: "[ <length> | <number> ]{1,4}",
  13454. media: "visual",
  13455. inherited: false,
  13456. animationType: "byComputedValueType",
  13457. percentages: "no",
  13458. groups: [
  13459. "CSS Backgrounds and Borders"
  13460. ],
  13461. initial: "0",
  13462. appliesto: "allElementsExceptTableElementsWhenCollapse",
  13463. computed: "asSpecifiedRelativeToAbsoluteLengths",
  13464. order: "uniqueOrder",
  13465. alsoAppliesTo: [
  13466. "::first-letter"
  13467. ],
  13468. status: "standard",
  13469. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-outset"
  13470. },
  13471. "border-image-repeat": {
  13472. syntax: "[ stretch | repeat | round | space ]{1,2}",
  13473. media: "visual",
  13474. inherited: false,
  13475. animationType: "discrete",
  13476. percentages: "no",
  13477. groups: [
  13478. "CSS Backgrounds and Borders"
  13479. ],
  13480. initial: "stretch",
  13481. appliesto: "allElementsExceptTableElementsWhenCollapse",
  13482. computed: "asSpecified",
  13483. order: "uniqueOrder",
  13484. alsoAppliesTo: [
  13485. "::first-letter"
  13486. ],
  13487. status: "standard",
  13488. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-repeat"
  13489. },
  13490. "border-image-slice": {
  13491. syntax: "<number-percentage>{1,4} && fill?",
  13492. media: "visual",
  13493. inherited: false,
  13494. animationType: "byComputedValueType",
  13495. percentages: "referToSizeOfBorderImage",
  13496. groups: [
  13497. "CSS Backgrounds and Borders"
  13498. ],
  13499. initial: "100%",
  13500. appliesto: "allElementsExceptTableElementsWhenCollapse",
  13501. computed: "oneToFourPercentagesOrAbsoluteLengthsPlusFill",
  13502. order: "percentagesOrLengthsFollowedByFill",
  13503. alsoAppliesTo: [
  13504. "::first-letter"
  13505. ],
  13506. status: "standard",
  13507. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-slice"
  13508. },
  13509. "border-image-source": {
  13510. syntax: "none | <image>",
  13511. media: "visual",
  13512. inherited: false,
  13513. animationType: "discrete",
  13514. percentages: "no",
  13515. groups: [
  13516. "CSS Backgrounds and Borders"
  13517. ],
  13518. initial: "none",
  13519. appliesto: "allElementsExceptTableElementsWhenCollapse",
  13520. computed: "noneOrImageWithAbsoluteURI",
  13521. order: "uniqueOrder",
  13522. alsoAppliesTo: [
  13523. "::first-letter"
  13524. ],
  13525. status: "standard",
  13526. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-source"
  13527. },
  13528. "border-image-width": {
  13529. syntax: "[ <length-percentage> | <number> | auto ]{1,4}",
  13530. media: "visual",
  13531. inherited: false,
  13532. animationType: "byComputedValueType",
  13533. percentages: "referToWidthOrHeightOfBorderImageArea",
  13534. groups: [
  13535. "CSS Backgrounds and Borders"
  13536. ],
  13537. initial: "1",
  13538. appliesto: "allElementsExceptTableElementsWhenCollapse",
  13539. computed: "asSpecifiedRelativeToAbsoluteLengths",
  13540. order: "uniqueOrder",
  13541. alsoAppliesTo: [
  13542. "::first-letter"
  13543. ],
  13544. status: "standard",
  13545. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-width"
  13546. },
  13547. "border-inline": {
  13548. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  13549. media: "visual",
  13550. inherited: false,
  13551. animationType: "discrete",
  13552. percentages: "no",
  13553. groups: [
  13554. "CSS Logical Properties"
  13555. ],
  13556. initial: [
  13557. "border-top-width",
  13558. "border-top-style",
  13559. "border-top-color"
  13560. ],
  13561. appliesto: "allElements",
  13562. computed: [
  13563. "border-top-width",
  13564. "border-top-style",
  13565. "border-top-color"
  13566. ],
  13567. order: "uniqueOrder",
  13568. status: "standard",
  13569. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline"
  13570. },
  13571. "border-inline-end": {
  13572. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  13573. media: "visual",
  13574. inherited: false,
  13575. animationType: "discrete",
  13576. percentages: "no",
  13577. groups: [
  13578. "CSS Logical Properties"
  13579. ],
  13580. initial: [
  13581. "border-width",
  13582. "border-style",
  13583. "color"
  13584. ],
  13585. appliesto: "allElements",
  13586. computed: [
  13587. "border-width",
  13588. "border-style",
  13589. "border-inline-end-color"
  13590. ],
  13591. order: "uniqueOrder",
  13592. status: "standard",
  13593. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end"
  13594. },
  13595. "border-inline-color": {
  13596. syntax: "<'border-top-color'>{1,2}",
  13597. media: "visual",
  13598. inherited: false,
  13599. animationType: "discrete",
  13600. percentages: "no",
  13601. groups: [
  13602. "CSS Logical Properties"
  13603. ],
  13604. initial: "currentcolor",
  13605. appliesto: "allElements",
  13606. computed: "computedColor",
  13607. order: "uniqueOrder",
  13608. status: "standard",
  13609. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-color"
  13610. },
  13611. "border-inline-style": {
  13612. syntax: "<'border-top-style'>",
  13613. media: "visual",
  13614. inherited: false,
  13615. animationType: "discrete",
  13616. percentages: "no",
  13617. groups: [
  13618. "CSS Logical Properties"
  13619. ],
  13620. initial: "none",
  13621. appliesto: "allElements",
  13622. computed: "asSpecified",
  13623. order: "uniqueOrder",
  13624. status: "standard",
  13625. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-style"
  13626. },
  13627. "border-inline-width": {
  13628. syntax: "<'border-top-width'>",
  13629. media: "visual",
  13630. inherited: false,
  13631. animationType: "discrete",
  13632. percentages: "logicalWidthOfContainingBlock",
  13633. groups: [
  13634. "CSS Logical Properties"
  13635. ],
  13636. initial: "medium",
  13637. appliesto: "allElements",
  13638. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13639. order: "uniqueOrder",
  13640. status: "standard",
  13641. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-width"
  13642. },
  13643. "border-inline-end-color": {
  13644. syntax: "<'border-top-color'>",
  13645. media: "visual",
  13646. inherited: false,
  13647. animationType: "discrete",
  13648. percentages: "no",
  13649. groups: [
  13650. "CSS Logical Properties"
  13651. ],
  13652. initial: "currentcolor",
  13653. appliesto: "allElements",
  13654. computed: "computedColor",
  13655. order: "uniqueOrder",
  13656. status: "standard",
  13657. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-color"
  13658. },
  13659. "border-inline-end-style": {
  13660. syntax: "<'border-top-style'>",
  13661. media: "visual",
  13662. inherited: false,
  13663. animationType: "discrete",
  13664. percentages: "no",
  13665. groups: [
  13666. "CSS Logical Properties"
  13667. ],
  13668. initial: "none",
  13669. appliesto: "allElements",
  13670. computed: "asSpecified",
  13671. order: "uniqueOrder",
  13672. status: "standard",
  13673. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-style"
  13674. },
  13675. "border-inline-end-width": {
  13676. syntax: "<'border-top-width'>",
  13677. media: "visual",
  13678. inherited: false,
  13679. animationType: "discrete",
  13680. percentages: "logicalWidthOfContainingBlock",
  13681. groups: [
  13682. "CSS Logical Properties"
  13683. ],
  13684. initial: "medium",
  13685. appliesto: "allElements",
  13686. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13687. order: "uniqueOrder",
  13688. status: "standard",
  13689. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-width"
  13690. },
  13691. "border-inline-start": {
  13692. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  13693. media: "visual",
  13694. inherited: false,
  13695. animationType: "discrete",
  13696. percentages: "no",
  13697. groups: [
  13698. "CSS Logical Properties"
  13699. ],
  13700. initial: [
  13701. "border-width",
  13702. "border-style",
  13703. "color"
  13704. ],
  13705. appliesto: "allElements",
  13706. computed: [
  13707. "border-width",
  13708. "border-style",
  13709. "border-inline-start-color"
  13710. ],
  13711. order: "uniqueOrder",
  13712. status: "standard",
  13713. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start"
  13714. },
  13715. "border-inline-start-color": {
  13716. syntax: "<'border-top-color'>",
  13717. media: "visual",
  13718. inherited: false,
  13719. animationType: "discrete",
  13720. percentages: "no",
  13721. groups: [
  13722. "CSS Logical Properties"
  13723. ],
  13724. initial: "currentcolor",
  13725. appliesto: "allElements",
  13726. computed: "computedColor",
  13727. order: "uniqueOrder",
  13728. status: "standard",
  13729. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-color"
  13730. },
  13731. "border-inline-start-style": {
  13732. syntax: "<'border-top-style'>",
  13733. media: "visual",
  13734. inherited: false,
  13735. animationType: "discrete",
  13736. percentages: "no",
  13737. groups: [
  13738. "CSS Logical Properties"
  13739. ],
  13740. initial: "none",
  13741. appliesto: "allElements",
  13742. computed: "asSpecified",
  13743. order: "uniqueOrder",
  13744. status: "standard",
  13745. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-style"
  13746. },
  13747. "border-inline-start-width": {
  13748. syntax: "<'border-top-width'>",
  13749. media: "visual",
  13750. inherited: false,
  13751. animationType: "discrete",
  13752. percentages: "logicalWidthOfContainingBlock",
  13753. groups: [
  13754. "CSS Logical Properties"
  13755. ],
  13756. initial: "medium",
  13757. appliesto: "allElements",
  13758. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13759. order: "uniqueOrder",
  13760. status: "standard",
  13761. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-width"
  13762. },
  13763. "border-left": {
  13764. syntax: "<line-width> || <line-style> || <color>",
  13765. media: "visual",
  13766. inherited: false,
  13767. animationType: [
  13768. "border-left-color",
  13769. "border-left-style",
  13770. "border-left-width"
  13771. ],
  13772. percentages: "no",
  13773. groups: [
  13774. "CSS Backgrounds and Borders"
  13775. ],
  13776. initial: [
  13777. "border-left-width",
  13778. "border-left-style",
  13779. "border-left-color"
  13780. ],
  13781. appliesto: "allElements",
  13782. computed: [
  13783. "border-left-width",
  13784. "border-left-style",
  13785. "border-left-color"
  13786. ],
  13787. order: "orderOfAppearance",
  13788. alsoAppliesTo: [
  13789. "::first-letter"
  13790. ],
  13791. status: "standard",
  13792. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left"
  13793. },
  13794. "border-left-color": {
  13795. syntax: "<color>",
  13796. media: "visual",
  13797. inherited: false,
  13798. animationType: "color",
  13799. percentages: "no",
  13800. groups: [
  13801. "CSS Backgrounds and Borders"
  13802. ],
  13803. initial: "currentcolor",
  13804. appliesto: "allElements",
  13805. computed: "computedColor",
  13806. order: "uniqueOrder",
  13807. alsoAppliesTo: [
  13808. "::first-letter"
  13809. ],
  13810. status: "standard",
  13811. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left-color"
  13812. },
  13813. "border-left-style": {
  13814. syntax: "<line-style>",
  13815. media: "visual",
  13816. inherited: false,
  13817. animationType: "discrete",
  13818. percentages: "no",
  13819. groups: [
  13820. "CSS Backgrounds and Borders"
  13821. ],
  13822. initial: "none",
  13823. appliesto: "allElements",
  13824. computed: "asSpecified",
  13825. order: "uniqueOrder",
  13826. alsoAppliesTo: [
  13827. "::first-letter"
  13828. ],
  13829. status: "standard",
  13830. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left-style"
  13831. },
  13832. "border-left-width": {
  13833. syntax: "<line-width>",
  13834. media: "visual",
  13835. inherited: false,
  13836. animationType: "length",
  13837. percentages: "no",
  13838. groups: [
  13839. "CSS Backgrounds and Borders"
  13840. ],
  13841. initial: "medium",
  13842. appliesto: "allElements",
  13843. computed: "absoluteLengthOr0IfBorderLeftStyleNoneOrHidden",
  13844. order: "uniqueOrder",
  13845. alsoAppliesTo: [
  13846. "::first-letter"
  13847. ],
  13848. status: "standard",
  13849. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left-width"
  13850. },
  13851. "border-radius": {
  13852. syntax: "<length-percentage>{1,4} [ / <length-percentage>{1,4} ]?",
  13853. media: "visual",
  13854. inherited: false,
  13855. animationType: [
  13856. "border-top-left-radius",
  13857. "border-top-right-radius",
  13858. "border-bottom-right-radius",
  13859. "border-bottom-left-radius"
  13860. ],
  13861. percentages: "referToDimensionOfBorderBox",
  13862. groups: [
  13863. "CSS Backgrounds and Borders"
  13864. ],
  13865. initial: [
  13866. "border-top-left-radius",
  13867. "border-top-right-radius",
  13868. "border-bottom-right-radius",
  13869. "border-bottom-left-radius"
  13870. ],
  13871. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13872. computed: [
  13873. "border-bottom-left-radius",
  13874. "border-bottom-right-radius",
  13875. "border-top-left-radius",
  13876. "border-top-right-radius"
  13877. ],
  13878. order: "uniqueOrder",
  13879. alsoAppliesTo: [
  13880. "::first-letter"
  13881. ],
  13882. status: "standard",
  13883. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-radius"
  13884. },
  13885. "border-right": {
  13886. syntax: "<line-width> || <line-style> || <color>",
  13887. media: "visual",
  13888. inherited: false,
  13889. animationType: [
  13890. "border-right-color",
  13891. "border-right-style",
  13892. "border-right-width"
  13893. ],
  13894. percentages: "no",
  13895. groups: [
  13896. "CSS Backgrounds and Borders"
  13897. ],
  13898. initial: [
  13899. "border-right-width",
  13900. "border-right-style",
  13901. "border-right-color"
  13902. ],
  13903. appliesto: "allElements",
  13904. computed: [
  13905. "border-right-width",
  13906. "border-right-style",
  13907. "border-right-color"
  13908. ],
  13909. order: "orderOfAppearance",
  13910. alsoAppliesTo: [
  13911. "::first-letter"
  13912. ],
  13913. status: "standard",
  13914. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right"
  13915. },
  13916. "border-right-color": {
  13917. syntax: "<color>",
  13918. media: "visual",
  13919. inherited: false,
  13920. animationType: "color",
  13921. percentages: "no",
  13922. groups: [
  13923. "CSS Backgrounds and Borders"
  13924. ],
  13925. initial: "currentcolor",
  13926. appliesto: "allElements",
  13927. computed: "computedColor",
  13928. order: "uniqueOrder",
  13929. alsoAppliesTo: [
  13930. "::first-letter"
  13931. ],
  13932. status: "standard",
  13933. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right-color"
  13934. },
  13935. "border-right-style": {
  13936. syntax: "<line-style>",
  13937. media: "visual",
  13938. inherited: false,
  13939. animationType: "discrete",
  13940. percentages: "no",
  13941. groups: [
  13942. "CSS Backgrounds and Borders"
  13943. ],
  13944. initial: "none",
  13945. appliesto: "allElements",
  13946. computed: "asSpecified",
  13947. order: "uniqueOrder",
  13948. alsoAppliesTo: [
  13949. "::first-letter"
  13950. ],
  13951. status: "standard",
  13952. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right-style"
  13953. },
  13954. "border-right-width": {
  13955. syntax: "<line-width>",
  13956. media: "visual",
  13957. inherited: false,
  13958. animationType: "length",
  13959. percentages: "no",
  13960. groups: [
  13961. "CSS Backgrounds and Borders"
  13962. ],
  13963. initial: "medium",
  13964. appliesto: "allElements",
  13965. computed: "absoluteLengthOr0IfBorderRightStyleNoneOrHidden",
  13966. order: "uniqueOrder",
  13967. alsoAppliesTo: [
  13968. "::first-letter"
  13969. ],
  13970. status: "standard",
  13971. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right-width"
  13972. },
  13973. "border-spacing": {
  13974. syntax: "<length> <length>?",
  13975. media: "visual",
  13976. inherited: true,
  13977. animationType: "discrete",
  13978. percentages: "no",
  13979. groups: [
  13980. "CSS Table"
  13981. ],
  13982. initial: "0",
  13983. appliesto: "tableElements",
  13984. computed: "twoAbsoluteLengths",
  13985. order: "uniqueOrder",
  13986. status: "standard",
  13987. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-spacing"
  13988. },
  13989. "border-start-end-radius": {
  13990. syntax: "<length-percentage>{1,2}",
  13991. media: "visual",
  13992. inherited: false,
  13993. animationType: "lpc",
  13994. percentages: "referToDimensionOfBorderBox",
  13995. groups: [
  13996. "CSS Logical Properties"
  13997. ],
  13998. initial: "0",
  13999. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14000. computed: "twoAbsoluteLengthOrPercentages",
  14001. order: "uniqueOrder",
  14002. alsoAppliesTo: [
  14003. "::first-letter"
  14004. ],
  14005. status: "standard",
  14006. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-start-end-radius"
  14007. },
  14008. "border-start-start-radius": {
  14009. syntax: "<length-percentage>{1,2}",
  14010. media: "visual",
  14011. inherited: false,
  14012. animationType: "lpc",
  14013. percentages: "referToDimensionOfBorderBox",
  14014. groups: [
  14015. "CSS Logical Properties"
  14016. ],
  14017. initial: "0",
  14018. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14019. computed: "twoAbsoluteLengthOrPercentages",
  14020. order: "uniqueOrder",
  14021. alsoAppliesTo: [
  14022. "::first-letter"
  14023. ],
  14024. status: "standard",
  14025. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-start-start-radius"
  14026. },
  14027. "border-style": {
  14028. syntax: "<line-style>{1,4}",
  14029. media: "visual",
  14030. inherited: false,
  14031. animationType: "discrete",
  14032. percentages: "no",
  14033. groups: [
  14034. "CSS Backgrounds and Borders"
  14035. ],
  14036. initial: [
  14037. "border-top-style",
  14038. "border-right-style",
  14039. "border-bottom-style",
  14040. "border-left-style"
  14041. ],
  14042. appliesto: "allElements",
  14043. computed: [
  14044. "border-bottom-style",
  14045. "border-left-style",
  14046. "border-right-style",
  14047. "border-top-style"
  14048. ],
  14049. order: "uniqueOrder",
  14050. alsoAppliesTo: [
  14051. "::first-letter"
  14052. ],
  14053. status: "standard",
  14054. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-style"
  14055. },
  14056. "border-top": {
  14057. syntax: "<line-width> || <line-style> || <color>",
  14058. media: "visual",
  14059. inherited: false,
  14060. animationType: [
  14061. "border-top-color",
  14062. "border-top-style",
  14063. "border-top-width"
  14064. ],
  14065. percentages: "no",
  14066. groups: [
  14067. "CSS Backgrounds and Borders"
  14068. ],
  14069. initial: [
  14070. "border-top-width",
  14071. "border-top-style",
  14072. "border-top-color"
  14073. ],
  14074. appliesto: "allElements",
  14075. computed: [
  14076. "border-top-width",
  14077. "border-top-style",
  14078. "border-top-color"
  14079. ],
  14080. order: "orderOfAppearance",
  14081. alsoAppliesTo: [
  14082. "::first-letter"
  14083. ],
  14084. status: "standard",
  14085. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top"
  14086. },
  14087. "border-top-color": {
  14088. syntax: "<color>",
  14089. media: "visual",
  14090. inherited: false,
  14091. animationType: "color",
  14092. percentages: "no",
  14093. groups: [
  14094. "CSS Backgrounds and Borders"
  14095. ],
  14096. initial: "currentcolor",
  14097. appliesto: "allElements",
  14098. computed: "computedColor",
  14099. order: "uniqueOrder",
  14100. alsoAppliesTo: [
  14101. "::first-letter"
  14102. ],
  14103. status: "standard",
  14104. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-color"
  14105. },
  14106. "border-top-left-radius": {
  14107. syntax: "<length-percentage>{1,2}",
  14108. media: "visual",
  14109. inherited: false,
  14110. animationType: "lpc",
  14111. percentages: "referToDimensionOfBorderBox",
  14112. groups: [
  14113. "CSS Backgrounds and Borders"
  14114. ],
  14115. initial: "0",
  14116. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14117. computed: "twoAbsoluteLengthOrPercentages",
  14118. order: "uniqueOrder",
  14119. alsoAppliesTo: [
  14120. "::first-letter"
  14121. ],
  14122. status: "standard",
  14123. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-left-radius"
  14124. },
  14125. "border-top-right-radius": {
  14126. syntax: "<length-percentage>{1,2}",
  14127. media: "visual",
  14128. inherited: false,
  14129. animationType: "lpc",
  14130. percentages: "referToDimensionOfBorderBox",
  14131. groups: [
  14132. "CSS Backgrounds and Borders"
  14133. ],
  14134. initial: "0",
  14135. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14136. computed: "twoAbsoluteLengthOrPercentages",
  14137. order: "uniqueOrder",
  14138. alsoAppliesTo: [
  14139. "::first-letter"
  14140. ],
  14141. status: "standard",
  14142. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-right-radius"
  14143. },
  14144. "border-top-style": {
  14145. syntax: "<line-style>",
  14146. media: "visual",
  14147. inherited: false,
  14148. animationType: "discrete",
  14149. percentages: "no",
  14150. groups: [
  14151. "CSS Backgrounds and Borders"
  14152. ],
  14153. initial: "none",
  14154. appliesto: "allElements",
  14155. computed: "asSpecified",
  14156. order: "uniqueOrder",
  14157. alsoAppliesTo: [
  14158. "::first-letter"
  14159. ],
  14160. status: "standard",
  14161. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-style"
  14162. },
  14163. "border-top-width": {
  14164. syntax: "<line-width>",
  14165. media: "visual",
  14166. inherited: false,
  14167. animationType: "length",
  14168. percentages: "no",
  14169. groups: [
  14170. "CSS Backgrounds and Borders"
  14171. ],
  14172. initial: "medium",
  14173. appliesto: "allElements",
  14174. computed: "absoluteLengthOr0IfBorderTopStyleNoneOrHidden",
  14175. order: "uniqueOrder",
  14176. alsoAppliesTo: [
  14177. "::first-letter"
  14178. ],
  14179. status: "standard",
  14180. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-width"
  14181. },
  14182. "border-width": {
  14183. syntax: "<line-width>{1,4}",
  14184. media: "visual",
  14185. inherited: false,
  14186. animationType: [
  14187. "border-bottom-width",
  14188. "border-left-width",
  14189. "border-right-width",
  14190. "border-top-width"
  14191. ],
  14192. percentages: "no",
  14193. groups: [
  14194. "CSS Backgrounds and Borders"
  14195. ],
  14196. initial: [
  14197. "border-top-width",
  14198. "border-right-width",
  14199. "border-bottom-width",
  14200. "border-left-width"
  14201. ],
  14202. appliesto: "allElements",
  14203. computed: [
  14204. "border-bottom-width",
  14205. "border-left-width",
  14206. "border-right-width",
  14207. "border-top-width"
  14208. ],
  14209. order: "uniqueOrder",
  14210. alsoAppliesTo: [
  14211. "::first-letter"
  14212. ],
  14213. status: "standard",
  14214. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-width"
  14215. },
  14216. bottom: bottom,
  14217. "box-align": {
  14218. syntax: "start | center | end | baseline | stretch",
  14219. media: "visual",
  14220. inherited: false,
  14221. animationType: "discrete",
  14222. percentages: "no",
  14223. groups: [
  14224. "Mozilla Extensions",
  14225. "WebKit Extensions"
  14226. ],
  14227. initial: "stretch",
  14228. appliesto: "elementsWithDisplayBoxOrInlineBox",
  14229. computed: "asSpecified",
  14230. order: "uniqueOrder",
  14231. status: "nonstandard",
  14232. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-align"
  14233. },
  14234. "box-decoration-break": {
  14235. syntax: "slice | clone",
  14236. media: "visual",
  14237. inherited: false,
  14238. animationType: "discrete",
  14239. percentages: "no",
  14240. groups: [
  14241. "CSS Fragmentation"
  14242. ],
  14243. initial: "slice",
  14244. appliesto: "allElements",
  14245. computed: "asSpecified",
  14246. order: "uniqueOrder",
  14247. status: "standard",
  14248. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-decoration-break"
  14249. },
  14250. "box-direction": {
  14251. syntax: "normal | reverse | inherit",
  14252. media: "visual",
  14253. inherited: false,
  14254. animationType: "discrete",
  14255. percentages: "no",
  14256. groups: [
  14257. "Mozilla Extensions",
  14258. "WebKit Extensions"
  14259. ],
  14260. initial: "normal",
  14261. appliesto: "elementsWithDisplayBoxOrInlineBox",
  14262. computed: "asSpecified",
  14263. order: "uniqueOrder",
  14264. status: "nonstandard",
  14265. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-direction"
  14266. },
  14267. "box-flex": {
  14268. syntax: "<number>",
  14269. media: "visual",
  14270. inherited: false,
  14271. animationType: "discrete",
  14272. percentages: "no",
  14273. groups: [
  14274. "Mozilla Extensions",
  14275. "WebKit Extensions"
  14276. ],
  14277. initial: "0",
  14278. appliesto: "directChildrenOfElementsWithDisplayMozBoxMozInlineBox",
  14279. computed: "asSpecified",
  14280. order: "uniqueOrder",
  14281. status: "nonstandard",
  14282. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-flex"
  14283. },
  14284. "box-flex-group": {
  14285. syntax: "<integer>",
  14286. media: "visual",
  14287. inherited: false,
  14288. animationType: "discrete",
  14289. percentages: "no",
  14290. groups: [
  14291. "Mozilla Extensions",
  14292. "WebKit Extensions"
  14293. ],
  14294. initial: "1",
  14295. appliesto: "inFlowChildrenOfBoxElements",
  14296. computed: "asSpecified",
  14297. order: "uniqueOrder",
  14298. status: "nonstandard",
  14299. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-flex-group"
  14300. },
  14301. "box-lines": {
  14302. syntax: "single | multiple",
  14303. media: "visual",
  14304. inherited: false,
  14305. animationType: "discrete",
  14306. percentages: "no",
  14307. groups: [
  14308. "Mozilla Extensions",
  14309. "WebKit Extensions"
  14310. ],
  14311. initial: "single",
  14312. appliesto: "boxElements",
  14313. computed: "asSpecified",
  14314. order: "uniqueOrder",
  14315. status: "nonstandard",
  14316. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-lines"
  14317. },
  14318. "box-ordinal-group": {
  14319. syntax: "<integer>",
  14320. media: "visual",
  14321. inherited: false,
  14322. animationType: "discrete",
  14323. percentages: "no",
  14324. groups: [
  14325. "Mozilla Extensions",
  14326. "WebKit Extensions"
  14327. ],
  14328. initial: "1",
  14329. appliesto: "childrenOfBoxElements",
  14330. computed: "asSpecified",
  14331. order: "uniqueOrder",
  14332. status: "nonstandard",
  14333. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-ordinal-group"
  14334. },
  14335. "box-orient": {
  14336. syntax: "horizontal | vertical | inline-axis | block-axis | inherit",
  14337. media: "visual",
  14338. inherited: false,
  14339. animationType: "discrete",
  14340. percentages: "no",
  14341. groups: [
  14342. "Mozilla Extensions",
  14343. "WebKit Extensions"
  14344. ],
  14345. initial: "inlineAxisHorizontalInXUL",
  14346. appliesto: "elementsWithDisplayBoxOrInlineBox",
  14347. computed: "asSpecified",
  14348. order: "uniqueOrder",
  14349. status: "nonstandard",
  14350. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-orient"
  14351. },
  14352. "box-pack": {
  14353. syntax: "start | center | end | justify",
  14354. media: "visual",
  14355. inherited: false,
  14356. animationType: "discrete",
  14357. percentages: "no",
  14358. groups: [
  14359. "Mozilla Extensions",
  14360. "WebKit Extensions"
  14361. ],
  14362. initial: "start",
  14363. appliesto: "elementsWithDisplayMozBoxMozInlineBox",
  14364. computed: "asSpecified",
  14365. order: "uniqueOrder",
  14366. status: "nonstandard",
  14367. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-pack"
  14368. },
  14369. "box-shadow": {
  14370. syntax: "none | <shadow>#",
  14371. media: "visual",
  14372. inherited: false,
  14373. animationType: "shadowList",
  14374. percentages: "no",
  14375. groups: [
  14376. "CSS Backgrounds and Borders"
  14377. ],
  14378. initial: "none",
  14379. appliesto: "allElements",
  14380. computed: "absoluteLengthsSpecifiedColorAsSpecified",
  14381. order: "uniqueOrder",
  14382. alsoAppliesTo: [
  14383. "::first-letter"
  14384. ],
  14385. status: "standard",
  14386. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-shadow"
  14387. },
  14388. "box-sizing": {
  14389. syntax: "content-box | border-box",
  14390. media: "visual",
  14391. inherited: false,
  14392. animationType: "discrete",
  14393. percentages: "no",
  14394. groups: [
  14395. "CSS Basic User Interface"
  14396. ],
  14397. initial: "content-box",
  14398. appliesto: "allElementsAcceptingWidthOrHeight",
  14399. computed: "asSpecified",
  14400. order: "uniqueOrder",
  14401. status: "standard",
  14402. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-sizing"
  14403. },
  14404. "break-after": {
  14405. syntax: "auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region",
  14406. media: "visual",
  14407. inherited: false,
  14408. animationType: "discrete",
  14409. percentages: "no",
  14410. groups: [
  14411. "CSS Fragmentation"
  14412. ],
  14413. initial: "auto",
  14414. appliesto: "blockLevelElements",
  14415. computed: "asSpecified",
  14416. order: "uniqueOrder",
  14417. status: "standard",
  14418. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/break-after"
  14419. },
  14420. "break-before": {
  14421. syntax: "auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region",
  14422. media: "visual",
  14423. inherited: false,
  14424. animationType: "discrete",
  14425. percentages: "no",
  14426. groups: [
  14427. "CSS Fragmentation"
  14428. ],
  14429. initial: "auto",
  14430. appliesto: "blockLevelElements",
  14431. computed: "asSpecified",
  14432. order: "uniqueOrder",
  14433. status: "standard",
  14434. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/break-before"
  14435. },
  14436. "break-inside": {
  14437. syntax: "auto | avoid | avoid-page | avoid-column | avoid-region",
  14438. media: "visual",
  14439. inherited: false,
  14440. animationType: "discrete",
  14441. percentages: "no",
  14442. groups: [
  14443. "CSS Fragmentation"
  14444. ],
  14445. initial: "auto",
  14446. appliesto: "blockLevelElements",
  14447. computed: "asSpecified",
  14448. order: "uniqueOrder",
  14449. status: "standard",
  14450. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/break-inside"
  14451. },
  14452. "caption-side": {
  14453. syntax: "top | bottom | block-start | block-end | inline-start | inline-end",
  14454. media: "visual",
  14455. inherited: true,
  14456. animationType: "discrete",
  14457. percentages: "no",
  14458. groups: [
  14459. "CSS Table"
  14460. ],
  14461. initial: "top",
  14462. appliesto: "tableCaptionElements",
  14463. computed: "asSpecified",
  14464. order: "uniqueOrder",
  14465. status: "standard",
  14466. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/caption-side"
  14467. },
  14468. "caret-color": {
  14469. syntax: "auto | <color>",
  14470. media: "interactive",
  14471. inherited: true,
  14472. animationType: "color",
  14473. percentages: "no",
  14474. groups: [
  14475. "CSS Basic User Interface"
  14476. ],
  14477. initial: "auto",
  14478. appliesto: "allElements",
  14479. computed: "asAutoOrColor",
  14480. order: "perGrammar",
  14481. status: "standard",
  14482. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/caret-color"
  14483. },
  14484. clear: clear,
  14485. clip: clip,
  14486. "clip-path": {
  14487. syntax: "<clip-source> | [ <basic-shape> || <geometry-box> ] | none",
  14488. media: "visual",
  14489. inherited: false,
  14490. animationType: "basicShapeOtherwiseNo",
  14491. percentages: "referToReferenceBoxWhenSpecifiedOtherwiseBorderBox",
  14492. groups: [
  14493. "CSS Masking"
  14494. ],
  14495. initial: "none",
  14496. appliesto: "allElementsSVGContainerElements",
  14497. computed: "asSpecifiedURLsAbsolute",
  14498. order: "uniqueOrder",
  14499. status: "standard",
  14500. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clip-path"
  14501. },
  14502. color: color,
  14503. "color-adjust": {
  14504. syntax: "economy | exact",
  14505. media: "visual",
  14506. inherited: true,
  14507. animationType: "discrete",
  14508. percentages: "no",
  14509. groups: [
  14510. "CSS Color"
  14511. ],
  14512. initial: "economy",
  14513. appliesto: "allElements",
  14514. computed: "asSpecified",
  14515. order: "perGrammar",
  14516. status: "standard",
  14517. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/color-adjust"
  14518. },
  14519. "column-count": {
  14520. syntax: "<integer> | auto",
  14521. media: "visual",
  14522. inherited: false,
  14523. animationType: "integer",
  14524. percentages: "no",
  14525. groups: [
  14526. "CSS Columns"
  14527. ],
  14528. initial: "auto",
  14529. appliesto: "blockContainersExceptTableWrappers",
  14530. computed: "asSpecified",
  14531. order: "perGrammar",
  14532. status: "standard",
  14533. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-count"
  14534. },
  14535. "column-fill": {
  14536. syntax: "auto | balance | balance-all",
  14537. media: "visualInContinuousMediaNoEffectInOverflowColumns",
  14538. inherited: false,
  14539. animationType: "discrete",
  14540. percentages: "no",
  14541. groups: [
  14542. "CSS Columns"
  14543. ],
  14544. initial: "balance",
  14545. appliesto: "multicolElements",
  14546. computed: "asSpecified",
  14547. order: "perGrammar",
  14548. status: "standard",
  14549. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-fill"
  14550. },
  14551. "column-gap": {
  14552. syntax: "normal | <length-percentage>",
  14553. media: "visual",
  14554. inherited: false,
  14555. animationType: "lpc",
  14556. percentages: "referToDimensionOfContentArea",
  14557. groups: [
  14558. "CSS Box Alignment"
  14559. ],
  14560. initial: "normal",
  14561. appliesto: "multiColumnElementsFlexContainersGridContainers",
  14562. computed: "asSpecifiedWithLengthsAbsoluteAndNormalComputingToZeroExceptMultiColumn",
  14563. order: "perGrammar",
  14564. status: "standard",
  14565. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-gap"
  14566. },
  14567. "column-rule": {
  14568. syntax: "<'column-rule-width'> || <'column-rule-style'> || <'column-rule-color'>",
  14569. media: "visual",
  14570. inherited: false,
  14571. animationType: [
  14572. "column-rule-color",
  14573. "column-rule-style",
  14574. "column-rule-width"
  14575. ],
  14576. percentages: "no",
  14577. groups: [
  14578. "CSS Columns"
  14579. ],
  14580. initial: [
  14581. "column-rule-width",
  14582. "column-rule-style",
  14583. "column-rule-color"
  14584. ],
  14585. appliesto: "multicolElements",
  14586. computed: [
  14587. "column-rule-color",
  14588. "column-rule-style",
  14589. "column-rule-width"
  14590. ],
  14591. order: "perGrammar",
  14592. status: "standard",
  14593. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule"
  14594. },
  14595. "column-rule-color": {
  14596. syntax: "<color>",
  14597. media: "visual",
  14598. inherited: false,
  14599. animationType: "color",
  14600. percentages: "no",
  14601. groups: [
  14602. "CSS Columns"
  14603. ],
  14604. initial: "currentcolor",
  14605. appliesto: "multicolElements",
  14606. computed: "computedColor",
  14607. order: "perGrammar",
  14608. status: "standard",
  14609. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule-color"
  14610. },
  14611. "column-rule-style": {
  14612. syntax: "<'border-style'>",
  14613. media: "visual",
  14614. inherited: false,
  14615. animationType: "discrete",
  14616. percentages: "no",
  14617. groups: [
  14618. "CSS Columns"
  14619. ],
  14620. initial: "none",
  14621. appliesto: "multicolElements",
  14622. computed: "asSpecified",
  14623. order: "perGrammar",
  14624. status: "standard",
  14625. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule-style"
  14626. },
  14627. "column-rule-width": {
  14628. syntax: "<'border-width'>",
  14629. media: "visual",
  14630. inherited: false,
  14631. animationType: "length",
  14632. percentages: "no",
  14633. groups: [
  14634. "CSS Columns"
  14635. ],
  14636. initial: "medium",
  14637. appliesto: "multicolElements",
  14638. computed: "absoluteLength0IfColumnRuleStyleNoneOrHidden",
  14639. order: "perGrammar",
  14640. status: "standard",
  14641. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule-width"
  14642. },
  14643. "column-span": {
  14644. syntax: "none | all",
  14645. media: "visual",
  14646. inherited: false,
  14647. animationType: "discrete",
  14648. percentages: "no",
  14649. groups: [
  14650. "CSS Columns"
  14651. ],
  14652. initial: "none",
  14653. appliesto: "inFlowBlockLevelElements",
  14654. computed: "asSpecified",
  14655. order: "perGrammar",
  14656. status: "standard",
  14657. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-span"
  14658. },
  14659. "column-width": {
  14660. syntax: "<length> | auto",
  14661. media: "visual",
  14662. inherited: false,
  14663. animationType: "length",
  14664. percentages: "no",
  14665. groups: [
  14666. "CSS Columns"
  14667. ],
  14668. initial: "auto",
  14669. appliesto: "blockContainersExceptTableWrappers",
  14670. computed: "absoluteLengthZeroOrLarger",
  14671. order: "perGrammar",
  14672. status: "standard",
  14673. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-width"
  14674. },
  14675. columns: columns,
  14676. contain: contain,
  14677. content: content,
  14678. "counter-increment": {
  14679. syntax: "[ <custom-ident> <integer>? ]+ | none",
  14680. media: "all",
  14681. inherited: false,
  14682. animationType: "discrete",
  14683. percentages: "no",
  14684. groups: [
  14685. "CSS Counter Styles"
  14686. ],
  14687. initial: "none",
  14688. appliesto: "allElements",
  14689. computed: "asSpecified",
  14690. order: "uniqueOrder",
  14691. status: "standard",
  14692. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/counter-increment"
  14693. },
  14694. "counter-reset": {
  14695. syntax: "[ <custom-ident> <integer>? ]+ | none",
  14696. media: "all",
  14697. inherited: false,
  14698. animationType: "discrete",
  14699. percentages: "no",
  14700. groups: [
  14701. "CSS Counter Styles"
  14702. ],
  14703. initial: "none",
  14704. appliesto: "allElements",
  14705. computed: "asSpecified",
  14706. order: "uniqueOrder",
  14707. status: "standard",
  14708. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/counter-reset"
  14709. },
  14710. "counter-set": {
  14711. syntax: "[ <custom-ident> <integer>? ]+ | none",
  14712. media: "all",
  14713. inherited: false,
  14714. animationType: "discrete",
  14715. percentages: "no",
  14716. groups: [
  14717. "CSS Counter Styles"
  14718. ],
  14719. initial: "none",
  14720. appliesto: "allElements",
  14721. computed: "asSpecified",
  14722. order: "uniqueOrder",
  14723. status: "standard",
  14724. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/counter-set"
  14725. },
  14726. cursor: cursor,
  14727. direction: direction,
  14728. display: display,
  14729. "empty-cells": {
  14730. syntax: "show | hide",
  14731. media: "visual",
  14732. inherited: true,
  14733. animationType: "discrete",
  14734. percentages: "no",
  14735. groups: [
  14736. "CSS Table"
  14737. ],
  14738. initial: "show",
  14739. appliesto: "tableCellElements",
  14740. computed: "asSpecified",
  14741. order: "uniqueOrder",
  14742. status: "standard",
  14743. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/empty-cells"
  14744. },
  14745. filter: filter,
  14746. flex: flex,
  14747. "flex-basis": {
  14748. syntax: "content | <'width'>",
  14749. media: "visual",
  14750. inherited: false,
  14751. animationType: "lpc",
  14752. percentages: "referToFlexContainersInnerMainSize",
  14753. groups: [
  14754. "CSS Flexible Box Layout"
  14755. ],
  14756. initial: "auto",
  14757. appliesto: "flexItemsAndInFlowPseudos",
  14758. computed: "asSpecifiedRelativeToAbsoluteLengths",
  14759. order: "lengthOrPercentageBeforeKeywordIfBothPresent",
  14760. status: "standard",
  14761. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-basis"
  14762. },
  14763. "flex-direction": {
  14764. syntax: "row | row-reverse | column | column-reverse",
  14765. media: "visual",
  14766. inherited: false,
  14767. animationType: "discrete",
  14768. percentages: "no",
  14769. groups: [
  14770. "CSS Flexible Box Layout"
  14771. ],
  14772. initial: "row",
  14773. appliesto: "flexContainers",
  14774. computed: "asSpecified",
  14775. order: "uniqueOrder",
  14776. status: "standard",
  14777. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-direction"
  14778. },
  14779. "flex-flow": {
  14780. syntax: "<'flex-direction'> || <'flex-wrap'>",
  14781. media: "visual",
  14782. inherited: false,
  14783. animationType: "discrete",
  14784. percentages: "no",
  14785. groups: [
  14786. "CSS Flexible Box Layout"
  14787. ],
  14788. initial: [
  14789. "flex-direction",
  14790. "flex-wrap"
  14791. ],
  14792. appliesto: "flexContainers",
  14793. computed: [
  14794. "flex-direction",
  14795. "flex-wrap"
  14796. ],
  14797. order: "orderOfAppearance",
  14798. status: "standard",
  14799. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-flow"
  14800. },
  14801. "flex-grow": {
  14802. syntax: "<number>",
  14803. media: "visual",
  14804. inherited: false,
  14805. animationType: "number",
  14806. percentages: "no",
  14807. groups: [
  14808. "CSS Flexible Box Layout"
  14809. ],
  14810. initial: "0",
  14811. appliesto: "flexItemsAndInFlowPseudos",
  14812. computed: "asSpecified",
  14813. order: "uniqueOrder",
  14814. status: "standard",
  14815. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-grow"
  14816. },
  14817. "flex-shrink": {
  14818. syntax: "<number>",
  14819. media: "visual",
  14820. inherited: false,
  14821. animationType: "number",
  14822. percentages: "no",
  14823. groups: [
  14824. "CSS Flexible Box Layout"
  14825. ],
  14826. initial: "1",
  14827. appliesto: "flexItemsAndInFlowPseudos",
  14828. computed: "asSpecified",
  14829. order: "uniqueOrder",
  14830. status: "standard",
  14831. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-shrink"
  14832. },
  14833. "flex-wrap": {
  14834. syntax: "nowrap | wrap | wrap-reverse",
  14835. media: "visual",
  14836. inherited: false,
  14837. animationType: "discrete",
  14838. percentages: "no",
  14839. groups: [
  14840. "CSS Flexible Box Layout"
  14841. ],
  14842. initial: "nowrap",
  14843. appliesto: "flexContainers",
  14844. computed: "asSpecified",
  14845. order: "uniqueOrder",
  14846. status: "standard",
  14847. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-wrap"
  14848. },
  14849. float: float,
  14850. font: font,
  14851. "font-family": {
  14852. syntax: "[ <family-name> | <generic-family> ]#",
  14853. media: "visual",
  14854. inherited: true,
  14855. animationType: "discrete",
  14856. percentages: "no",
  14857. groups: [
  14858. "CSS Fonts"
  14859. ],
  14860. initial: "dependsOnUserAgent",
  14861. appliesto: "allElements",
  14862. computed: "asSpecified",
  14863. order: "uniqueOrder",
  14864. alsoAppliesTo: [
  14865. "::first-letter",
  14866. "::first-line",
  14867. "::placeholder"
  14868. ],
  14869. status: "standard",
  14870. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-family"
  14871. },
  14872. "font-feature-settings": {
  14873. syntax: "normal | <feature-tag-value>#",
  14874. media: "visual",
  14875. inherited: true,
  14876. animationType: "discrete",
  14877. percentages: "no",
  14878. groups: [
  14879. "CSS Fonts"
  14880. ],
  14881. initial: "normal",
  14882. appliesto: "allElements",
  14883. computed: "asSpecified",
  14884. order: "uniqueOrder",
  14885. alsoAppliesTo: [
  14886. "::first-letter",
  14887. "::first-line",
  14888. "::placeholder"
  14889. ],
  14890. status: "standard",
  14891. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-feature-settings"
  14892. },
  14893. "font-kerning": {
  14894. syntax: "auto | normal | none",
  14895. media: "visual",
  14896. inherited: true,
  14897. animationType: "discrete",
  14898. percentages: "no",
  14899. groups: [
  14900. "CSS Fonts"
  14901. ],
  14902. initial: "auto",
  14903. appliesto: "allElements",
  14904. computed: "asSpecified",
  14905. order: "uniqueOrder",
  14906. alsoAppliesTo: [
  14907. "::first-letter",
  14908. "::first-line",
  14909. "::placeholder"
  14910. ],
  14911. status: "standard",
  14912. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-kerning"
  14913. },
  14914. "font-language-override": {
  14915. syntax: "normal | <string>",
  14916. media: "visual",
  14917. inherited: true,
  14918. animationType: "discrete",
  14919. percentages: "no",
  14920. groups: [
  14921. "CSS Fonts"
  14922. ],
  14923. initial: "normal",
  14924. appliesto: "allElements",
  14925. computed: "asSpecified",
  14926. order: "uniqueOrder",
  14927. alsoAppliesTo: [
  14928. "::first-letter",
  14929. "::first-line",
  14930. "::placeholder"
  14931. ],
  14932. status: "standard",
  14933. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-language-override"
  14934. },
  14935. "font-optical-sizing": {
  14936. syntax: "auto | none",
  14937. media: "visual",
  14938. inherited: true,
  14939. animationType: "discrete",
  14940. percentages: "no",
  14941. groups: [
  14942. "CSS Fonts"
  14943. ],
  14944. initial: "auto",
  14945. appliesto: "allElements",
  14946. computed: "asSpecified",
  14947. order: "perGrammar",
  14948. alsoAppliesTo: [
  14949. "::first-letter",
  14950. "::first-line",
  14951. "::placeholder"
  14952. ],
  14953. status: "standard",
  14954. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-optical-sizing"
  14955. },
  14956. "font-variation-settings": {
  14957. syntax: "normal | [ <string> <number> ]#",
  14958. media: "visual",
  14959. inherited: true,
  14960. animationType: "transform",
  14961. percentages: "no",
  14962. groups: [
  14963. "CSS Fonts"
  14964. ],
  14965. initial: "normal",
  14966. appliesto: "allElements",
  14967. computed: "asSpecified",
  14968. order: "perGrammar",
  14969. alsoAppliesTo: [
  14970. "::first-letter",
  14971. "::first-line",
  14972. "::placeholder"
  14973. ],
  14974. status: "experimental",
  14975. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variation-settings"
  14976. },
  14977. "font-size": {
  14978. syntax: "<absolute-size> | <relative-size> | <length-percentage>",
  14979. media: "visual",
  14980. inherited: true,
  14981. animationType: "length",
  14982. percentages: "referToParentElementsFontSize",
  14983. groups: [
  14984. "CSS Fonts"
  14985. ],
  14986. initial: "medium",
  14987. appliesto: "allElements",
  14988. computed: "asSpecifiedRelativeToAbsoluteLengths",
  14989. order: "uniqueOrder",
  14990. alsoAppliesTo: [
  14991. "::first-letter",
  14992. "::first-line",
  14993. "::placeholder"
  14994. ],
  14995. status: "standard",
  14996. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-size"
  14997. },
  14998. "font-size-adjust": {
  14999. syntax: "none | <number>",
  15000. media: "visual",
  15001. inherited: true,
  15002. animationType: "number",
  15003. percentages: "no",
  15004. groups: [
  15005. "CSS Fonts"
  15006. ],
  15007. initial: "none",
  15008. appliesto: "allElements",
  15009. computed: "asSpecified",
  15010. order: "uniqueOrder",
  15011. alsoAppliesTo: [
  15012. "::first-letter",
  15013. "::first-line",
  15014. "::placeholder"
  15015. ],
  15016. status: "standard",
  15017. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-size-adjust"
  15018. },
  15019. "font-stretch": {
  15020. syntax: "<font-stretch-absolute>",
  15021. media: "visual",
  15022. inherited: true,
  15023. animationType: "fontStretch",
  15024. percentages: "no",
  15025. groups: [
  15026. "CSS Fonts"
  15027. ],
  15028. initial: "normal",
  15029. appliesto: "allElements",
  15030. computed: "asSpecified",
  15031. order: "uniqueOrder",
  15032. alsoAppliesTo: [
  15033. "::first-letter",
  15034. "::first-line",
  15035. "::placeholder"
  15036. ],
  15037. status: "standard",
  15038. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-stretch"
  15039. },
  15040. "font-style": {
  15041. syntax: "normal | italic | oblique <angle>?",
  15042. media: "visual",
  15043. inherited: true,
  15044. animationType: "discrete",
  15045. percentages: "no",
  15046. groups: [
  15047. "CSS Fonts"
  15048. ],
  15049. initial: "normal",
  15050. appliesto: "allElements",
  15051. computed: "asSpecified",
  15052. order: "uniqueOrder",
  15053. alsoAppliesTo: [
  15054. "::first-letter",
  15055. "::first-line",
  15056. "::placeholder"
  15057. ],
  15058. status: "standard",
  15059. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-style"
  15060. },
  15061. "font-synthesis": {
  15062. syntax: "none | [ weight || style ]",
  15063. media: "visual",
  15064. inherited: true,
  15065. animationType: "discrete",
  15066. percentages: "no",
  15067. groups: [
  15068. "CSS Fonts"
  15069. ],
  15070. initial: "weight style",
  15071. appliesto: "allElements",
  15072. computed: "asSpecified",
  15073. order: "orderOfAppearance",
  15074. alsoAppliesTo: [
  15075. "::first-letter",
  15076. "::first-line",
  15077. "::placeholder"
  15078. ],
  15079. status: "standard",
  15080. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-synthesis"
  15081. },
  15082. "font-variant": {
  15083. syntax: "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-width-values> || ruby ]",
  15084. media: "visual",
  15085. inherited: true,
  15086. animationType: "discrete",
  15087. percentages: "no",
  15088. groups: [
  15089. "CSS Fonts"
  15090. ],
  15091. initial: "normal",
  15092. appliesto: "allElements",
  15093. computed: "asSpecified",
  15094. order: "uniqueOrder",
  15095. alsoAppliesTo: [
  15096. "::first-letter",
  15097. "::first-line",
  15098. "::placeholder"
  15099. ],
  15100. status: "standard",
  15101. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant"
  15102. },
  15103. "font-variant-alternates": {
  15104. syntax: "normal | [ stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) ]",
  15105. media: "visual",
  15106. inherited: true,
  15107. animationType: "discrete",
  15108. percentages: "no",
  15109. groups: [
  15110. "CSS Fonts"
  15111. ],
  15112. initial: "normal",
  15113. appliesto: "allElements",
  15114. computed: "asSpecified",
  15115. order: "orderOfAppearance",
  15116. alsoAppliesTo: [
  15117. "::first-letter",
  15118. "::first-line",
  15119. "::placeholder"
  15120. ],
  15121. status: "standard",
  15122. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-alternates"
  15123. },
  15124. "font-variant-caps": {
  15125. syntax: "normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps",
  15126. media: "visual",
  15127. inherited: true,
  15128. animationType: "discrete",
  15129. percentages: "no",
  15130. groups: [
  15131. "CSS Fonts"
  15132. ],
  15133. initial: "normal",
  15134. appliesto: "allElements",
  15135. computed: "asSpecified",
  15136. order: "uniqueOrder",
  15137. alsoAppliesTo: [
  15138. "::first-letter",
  15139. "::first-line",
  15140. "::placeholder"
  15141. ],
  15142. status: "standard",
  15143. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-caps"
  15144. },
  15145. "font-variant-east-asian": {
  15146. syntax: "normal | [ <east-asian-variant-values> || <east-asian-width-values> || ruby ]",
  15147. media: "visual",
  15148. inherited: true,
  15149. animationType: "discrete",
  15150. percentages: "no",
  15151. groups: [
  15152. "CSS Fonts"
  15153. ],
  15154. initial: "normal",
  15155. appliesto: "allElements",
  15156. computed: "asSpecified",
  15157. order: "orderOfAppearance",
  15158. alsoAppliesTo: [
  15159. "::first-letter",
  15160. "::first-line",
  15161. "::placeholder"
  15162. ],
  15163. status: "standard",
  15164. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-east-asian"
  15165. },
  15166. "font-variant-ligatures": {
  15167. syntax: "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> ]",
  15168. media: "visual",
  15169. inherited: true,
  15170. animationType: "discrete",
  15171. percentages: "no",
  15172. groups: [
  15173. "CSS Fonts"
  15174. ],
  15175. initial: "normal",
  15176. appliesto: "allElements",
  15177. computed: "asSpecified",
  15178. order: "orderOfAppearance",
  15179. alsoAppliesTo: [
  15180. "::first-letter",
  15181. "::first-line",
  15182. "::placeholder"
  15183. ],
  15184. status: "standard",
  15185. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-ligatures"
  15186. },
  15187. "font-variant-numeric": {
  15188. syntax: "normal | [ <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero ]",
  15189. media: "visual",
  15190. inherited: true,
  15191. animationType: "discrete",
  15192. percentages: "no",
  15193. groups: [
  15194. "CSS Fonts"
  15195. ],
  15196. initial: "normal",
  15197. appliesto: "allElements",
  15198. computed: "asSpecified",
  15199. order: "orderOfAppearance",
  15200. alsoAppliesTo: [
  15201. "::first-letter",
  15202. "::first-line",
  15203. "::placeholder"
  15204. ],
  15205. status: "standard",
  15206. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-numeric"
  15207. },
  15208. "font-variant-position": {
  15209. syntax: "normal | sub | super",
  15210. media: "visual",
  15211. inherited: true,
  15212. animationType: "discrete",
  15213. percentages: "no",
  15214. groups: [
  15215. "CSS Fonts"
  15216. ],
  15217. initial: "normal",
  15218. appliesto: "allElements",
  15219. computed: "asSpecified",
  15220. order: "uniqueOrder",
  15221. alsoAppliesTo: [
  15222. "::first-letter",
  15223. "::first-line",
  15224. "::placeholder"
  15225. ],
  15226. status: "standard",
  15227. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-position"
  15228. },
  15229. "font-weight": {
  15230. syntax: "<font-weight-absolute> | bolder | lighter",
  15231. media: "visual",
  15232. inherited: true,
  15233. animationType: "fontWeight",
  15234. percentages: "no",
  15235. groups: [
  15236. "CSS Fonts"
  15237. ],
  15238. initial: "normal",
  15239. appliesto: "allElements",
  15240. computed: "keywordOrNumericalValueBolderLighterTransformedToRealValue",
  15241. order: "uniqueOrder",
  15242. alsoAppliesTo: [
  15243. "::first-letter",
  15244. "::first-line",
  15245. "::placeholder"
  15246. ],
  15247. status: "standard",
  15248. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-weight"
  15249. },
  15250. gap: gap,
  15251. grid: grid,
  15252. "grid-area": {
  15253. syntax: "<grid-line> [ / <grid-line> ]{0,3}",
  15254. media: "visual",
  15255. inherited: false,
  15256. animationType: "discrete",
  15257. percentages: "no",
  15258. groups: [
  15259. "CSS Grid Layout"
  15260. ],
  15261. initial: [
  15262. "grid-row-start",
  15263. "grid-column-start",
  15264. "grid-row-end",
  15265. "grid-column-end"
  15266. ],
  15267. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15268. computed: [
  15269. "grid-row-start",
  15270. "grid-column-start",
  15271. "grid-row-end",
  15272. "grid-column-end"
  15273. ],
  15274. order: "uniqueOrder",
  15275. status: "standard",
  15276. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-area"
  15277. },
  15278. "grid-auto-columns": {
  15279. syntax: "<track-size>+",
  15280. media: "visual",
  15281. inherited: false,
  15282. animationType: "discrete",
  15283. percentages: "referToDimensionOfContentArea",
  15284. groups: [
  15285. "CSS Grid Layout"
  15286. ],
  15287. initial: "auto",
  15288. appliesto: "gridContainers",
  15289. computed: "percentageAsSpecifiedOrAbsoluteLength",
  15290. order: "uniqueOrder",
  15291. status: "standard",
  15292. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-auto-columns"
  15293. },
  15294. "grid-auto-flow": {
  15295. syntax: "[ row | column ] || dense",
  15296. media: "visual",
  15297. inherited: false,
  15298. animationType: "discrete",
  15299. percentages: "no",
  15300. groups: [
  15301. "CSS Grid Layout"
  15302. ],
  15303. initial: "row",
  15304. appliesto: "gridContainers",
  15305. computed: "asSpecified",
  15306. order: "uniqueOrder",
  15307. status: "standard",
  15308. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-auto-flow"
  15309. },
  15310. "grid-auto-rows": {
  15311. syntax: "<track-size>+",
  15312. media: "visual",
  15313. inherited: false,
  15314. animationType: "discrete",
  15315. percentages: "referToDimensionOfContentArea",
  15316. groups: [
  15317. "CSS Grid Layout"
  15318. ],
  15319. initial: "auto",
  15320. appliesto: "gridContainers",
  15321. computed: "percentageAsSpecifiedOrAbsoluteLength",
  15322. order: "uniqueOrder",
  15323. status: "standard",
  15324. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-auto-rows"
  15325. },
  15326. "grid-column": {
  15327. syntax: "<grid-line> [ / <grid-line> ]?",
  15328. media: "visual",
  15329. inherited: false,
  15330. animationType: "discrete",
  15331. percentages: "no",
  15332. groups: [
  15333. "CSS Grid Layout"
  15334. ],
  15335. initial: [
  15336. "grid-column-start",
  15337. "grid-column-end"
  15338. ],
  15339. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15340. computed: [
  15341. "grid-column-start",
  15342. "grid-column-end"
  15343. ],
  15344. order: "uniqueOrder",
  15345. status: "standard",
  15346. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-column"
  15347. },
  15348. "grid-column-end": {
  15349. syntax: "<grid-line>",
  15350. media: "visual",
  15351. inherited: false,
  15352. animationType: "discrete",
  15353. percentages: "no",
  15354. groups: [
  15355. "CSS Grid Layout"
  15356. ],
  15357. initial: "auto",
  15358. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15359. computed: "asSpecified",
  15360. order: "uniqueOrder",
  15361. status: "standard",
  15362. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-column-end"
  15363. },
  15364. "grid-column-gap": {
  15365. syntax: "<length-percentage>",
  15366. media: "visual",
  15367. inherited: false,
  15368. animationType: "length",
  15369. percentages: "referToDimensionOfContentArea",
  15370. groups: [
  15371. "CSS Grid Layout"
  15372. ],
  15373. initial: "0",
  15374. appliesto: "gridContainers",
  15375. computed: "percentageAsSpecifiedOrAbsoluteLength",
  15376. order: "uniqueOrder",
  15377. status: "obsolete",
  15378. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-gap"
  15379. },
  15380. "grid-column-start": {
  15381. syntax: "<grid-line>",
  15382. media: "visual",
  15383. inherited: false,
  15384. animationType: "discrete",
  15385. percentages: "no",
  15386. groups: [
  15387. "CSS Grid Layout"
  15388. ],
  15389. initial: "auto",
  15390. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15391. computed: "asSpecified",
  15392. order: "uniqueOrder",
  15393. status: "standard",
  15394. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-column-start"
  15395. },
  15396. "grid-gap": {
  15397. syntax: "<'grid-row-gap'> <'grid-column-gap'>?",
  15398. media: "visual",
  15399. inherited: false,
  15400. animationType: [
  15401. "grid-row-gap",
  15402. "grid-column-gap"
  15403. ],
  15404. percentages: "no",
  15405. groups: [
  15406. "CSS Grid Layout"
  15407. ],
  15408. initial: [
  15409. "grid-row-gap",
  15410. "grid-column-gap"
  15411. ],
  15412. appliesto: "gridContainers",
  15413. computed: [
  15414. "grid-row-gap",
  15415. "grid-column-gap"
  15416. ],
  15417. order: "uniqueOrder",
  15418. status: "obsolete",
  15419. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/gap"
  15420. },
  15421. "grid-row": {
  15422. syntax: "<grid-line> [ / <grid-line> ]?",
  15423. media: "visual",
  15424. inherited: false,
  15425. animationType: "discrete",
  15426. percentages: "no",
  15427. groups: [
  15428. "CSS Grid Layout"
  15429. ],
  15430. initial: [
  15431. "grid-row-start",
  15432. "grid-row-end"
  15433. ],
  15434. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15435. computed: [
  15436. "grid-row-start",
  15437. "grid-row-end"
  15438. ],
  15439. order: "uniqueOrder",
  15440. status: "standard",
  15441. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-row"
  15442. },
  15443. "grid-row-end": {
  15444. syntax: "<grid-line>",
  15445. media: "visual",
  15446. inherited: false,
  15447. animationType: "discrete",
  15448. percentages: "no",
  15449. groups: [
  15450. "CSS Grid Layout"
  15451. ],
  15452. initial: "auto",
  15453. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15454. computed: "asSpecified",
  15455. order: "uniqueOrder",
  15456. status: "standard",
  15457. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-row-end"
  15458. },
  15459. "grid-row-gap": {
  15460. syntax: "<length-percentage>",
  15461. media: "visual",
  15462. inherited: false,
  15463. animationType: "length",
  15464. percentages: "referToDimensionOfContentArea",
  15465. groups: [
  15466. "CSS Grid Layout"
  15467. ],
  15468. initial: "0",
  15469. appliesto: "gridContainers",
  15470. computed: "percentageAsSpecifiedOrAbsoluteLength",
  15471. order: "uniqueOrder",
  15472. status: "obsolete",
  15473. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/row-gap"
  15474. },
  15475. "grid-row-start": {
  15476. syntax: "<grid-line>",
  15477. media: "visual",
  15478. inherited: false,
  15479. animationType: "discrete",
  15480. percentages: "no",
  15481. groups: [
  15482. "CSS Grid Layout"
  15483. ],
  15484. initial: "auto",
  15485. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15486. computed: "asSpecified",
  15487. order: "uniqueOrder",
  15488. status: "standard",
  15489. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-row-start"
  15490. },
  15491. "grid-template": {
  15492. syntax: "none | [ <'grid-template-rows'> / <'grid-template-columns'> ] | [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?",
  15493. media: "visual",
  15494. inherited: false,
  15495. animationType: "discrete",
  15496. percentages: [
  15497. "grid-template-columns",
  15498. "grid-template-rows"
  15499. ],
  15500. groups: [
  15501. "CSS Grid Layout"
  15502. ],
  15503. initial: [
  15504. "grid-template-columns",
  15505. "grid-template-rows",
  15506. "grid-template-areas"
  15507. ],
  15508. appliesto: "gridContainers",
  15509. computed: [
  15510. "grid-template-columns",
  15511. "grid-template-rows",
  15512. "grid-template-areas"
  15513. ],
  15514. order: "uniqueOrder",
  15515. status: "standard",
  15516. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template"
  15517. },
  15518. "grid-template-areas": {
  15519. syntax: "none | <string>+",
  15520. media: "visual",
  15521. inherited: false,
  15522. animationType: "discrete",
  15523. percentages: "no",
  15524. groups: [
  15525. "CSS Grid Layout"
  15526. ],
  15527. initial: "none",
  15528. appliesto: "gridContainers",
  15529. computed: "asSpecified",
  15530. order: "uniqueOrder",
  15531. status: "standard",
  15532. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template-areas"
  15533. },
  15534. "grid-template-columns": {
  15535. syntax: "none | <track-list> | <auto-track-list> | subgrid <line-name-list>?",
  15536. media: "visual",
  15537. inherited: false,
  15538. animationType: "simpleListOfLpcDifferenceLpc",
  15539. percentages: "referToDimensionOfContentArea",
  15540. groups: [
  15541. "CSS Grid Layout"
  15542. ],
  15543. initial: "none",
  15544. appliesto: "gridContainers",
  15545. computed: "asSpecifiedRelativeToAbsoluteLengths",
  15546. order: "uniqueOrder",
  15547. status: "standard",
  15548. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template-columns"
  15549. },
  15550. "grid-template-rows": {
  15551. syntax: "none | <track-list> | <auto-track-list> | subgrid <line-name-list>?",
  15552. media: "visual",
  15553. inherited: false,
  15554. animationType: "simpleListOfLpcDifferenceLpc",
  15555. percentages: "referToDimensionOfContentArea",
  15556. groups: [
  15557. "CSS Grid Layout"
  15558. ],
  15559. initial: "none",
  15560. appliesto: "gridContainers",
  15561. computed: "asSpecifiedRelativeToAbsoluteLengths",
  15562. order: "uniqueOrder",
  15563. status: "standard",
  15564. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template-rows"
  15565. },
  15566. "hanging-punctuation": {
  15567. syntax: "none | [ first || [ force-end | allow-end ] || last ]",
  15568. media: "visual",
  15569. inherited: true,
  15570. animationType: "discrete",
  15571. percentages: "no",
  15572. groups: [
  15573. "CSS Text"
  15574. ],
  15575. initial: "none",
  15576. appliesto: "allElements",
  15577. computed: "asSpecified",
  15578. order: "uniqueOrder",
  15579. status: "standard",
  15580. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/hanging-punctuation"
  15581. },
  15582. height: height,
  15583. hyphens: hyphens,
  15584. "image-orientation": {
  15585. syntax: "from-image | <angle> | [ <angle>? flip ]",
  15586. media: "visual",
  15587. inherited: true,
  15588. animationType: "discrete",
  15589. percentages: "no",
  15590. groups: [
  15591. "CSS Images"
  15592. ],
  15593. initial: "0deg",
  15594. appliesto: "allElements",
  15595. computed: "angleRoundedToNextQuarter",
  15596. order: "uniqueOrder",
  15597. status: "standard",
  15598. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/image-orientation"
  15599. },
  15600. "image-rendering": {
  15601. syntax: "auto | crisp-edges | pixelated",
  15602. media: "visual",
  15603. inherited: true,
  15604. animationType: "discrete",
  15605. percentages: "no",
  15606. groups: [
  15607. "CSS Images"
  15608. ],
  15609. initial: "auto",
  15610. appliesto: "allElements",
  15611. computed: "asSpecified",
  15612. order: "uniqueOrder",
  15613. status: "standard",
  15614. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/image-rendering"
  15615. },
  15616. "image-resolution": {
  15617. syntax: "[ from-image || <resolution> ] && snap?",
  15618. media: "visual",
  15619. inherited: true,
  15620. animationType: "discrete",
  15621. percentages: "no",
  15622. groups: [
  15623. "CSS Images"
  15624. ],
  15625. initial: "1dppx",
  15626. appliesto: "allElements",
  15627. computed: "asSpecifiedWithExceptionOfResolution",
  15628. order: "uniqueOrder",
  15629. status: "experimental"
  15630. },
  15631. "ime-mode": {
  15632. syntax: "auto | normal | active | inactive | disabled",
  15633. media: "interactive",
  15634. inherited: false,
  15635. animationType: "discrete",
  15636. percentages: "no",
  15637. groups: [
  15638. "CSS Basic User Interface"
  15639. ],
  15640. initial: "auto",
  15641. appliesto: "textFields",
  15642. computed: "asSpecified",
  15643. order: "uniqueOrder",
  15644. status: "obsolete",
  15645. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/ime-mode"
  15646. },
  15647. "initial-letter": {
  15648. syntax: "normal | [ <number> <integer>? ]",
  15649. media: "visual",
  15650. inherited: false,
  15651. animationType: "discrete",
  15652. percentages: "no",
  15653. groups: [
  15654. "CSS Inline"
  15655. ],
  15656. initial: "normal",
  15657. appliesto: "firstLetterPseudoElementsAndInlineLevelFirstChildren",
  15658. computed: "asSpecified",
  15659. order: "uniqueOrder",
  15660. status: "experimental",
  15661. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/initial-letter"
  15662. },
  15663. "initial-letter-align": {
  15664. syntax: "[ auto | alphabetic | hanging | ideographic ]",
  15665. media: "visual",
  15666. inherited: false,
  15667. animationType: "discrete",
  15668. percentages: "no",
  15669. groups: [
  15670. "CSS Inline"
  15671. ],
  15672. initial: "auto",
  15673. appliesto: "firstLetterPseudoElementsAndInlineLevelFirstChildren",
  15674. computed: "asSpecified",
  15675. order: "uniqueOrder",
  15676. status: "experimental",
  15677. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/initial-letter-align"
  15678. },
  15679. "inline-size": {
  15680. syntax: "<'width'>",
  15681. media: "visual",
  15682. inherited: false,
  15683. animationType: "discrete",
  15684. percentages: "inlineSizeOfContainingBlock",
  15685. groups: [
  15686. "CSS Logical Properties"
  15687. ],
  15688. initial: "auto",
  15689. appliesto: "sameAsWidthAndHeight",
  15690. computed: "sameAsWidthAndHeight",
  15691. order: "uniqueOrder",
  15692. status: "standard",
  15693. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inline-size"
  15694. },
  15695. inset: inset,
  15696. "inset-block": {
  15697. syntax: "<'top'>{1,2}",
  15698. media: "visual",
  15699. inherited: false,
  15700. animationType: "lpc",
  15701. percentages: "logicalHeightOfContainingBlock",
  15702. groups: [
  15703. "CSS Logical Properties"
  15704. ],
  15705. initial: "auto",
  15706. appliesto: "positionedElements",
  15707. computed: "sameAsBoxOffsets",
  15708. order: "uniqueOrder",
  15709. status: "standard",
  15710. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-block"
  15711. },
  15712. "inset-block-end": {
  15713. syntax: "<'top'>",
  15714. media: "visual",
  15715. inherited: false,
  15716. animationType: "lpc",
  15717. percentages: "logicalHeightOfContainingBlock",
  15718. groups: [
  15719. "CSS Logical Properties"
  15720. ],
  15721. initial: "auto",
  15722. appliesto: "positionedElements",
  15723. computed: "sameAsBoxOffsets",
  15724. order: "uniqueOrder",
  15725. status: "standard",
  15726. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-block-end"
  15727. },
  15728. "inset-block-start": {
  15729. syntax: "<'top'>",
  15730. media: "visual",
  15731. inherited: false,
  15732. animationType: "lpc",
  15733. percentages: "logicalHeightOfContainingBlock",
  15734. groups: [
  15735. "CSS Logical Properties"
  15736. ],
  15737. initial: "auto",
  15738. appliesto: "positionedElements",
  15739. computed: "sameAsBoxOffsets",
  15740. order: "uniqueOrder",
  15741. status: "standard",
  15742. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-block-start"
  15743. },
  15744. "inset-inline": {
  15745. syntax: "<'top'>{1,2}",
  15746. media: "visual",
  15747. inherited: false,
  15748. animationType: "lpc",
  15749. percentages: "logicalWidthOfContainingBlock",
  15750. groups: [
  15751. "CSS Logical Properties"
  15752. ],
  15753. initial: "auto",
  15754. appliesto: "positionedElements",
  15755. computed: "sameAsBoxOffsets",
  15756. order: "uniqueOrder",
  15757. status: "standard",
  15758. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-inline"
  15759. },
  15760. "inset-inline-end": {
  15761. syntax: "<'top'>",
  15762. media: "visual",
  15763. inherited: false,
  15764. animationType: "lpc",
  15765. percentages: "logicalWidthOfContainingBlock",
  15766. groups: [
  15767. "CSS Logical Properties"
  15768. ],
  15769. initial: "auto",
  15770. appliesto: "positionedElements",
  15771. computed: "sameAsBoxOffsets",
  15772. order: "uniqueOrder",
  15773. status: "standard",
  15774. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-inline-end"
  15775. },
  15776. "inset-inline-start": {
  15777. syntax: "<'top'>",
  15778. media: "visual",
  15779. inherited: false,
  15780. animationType: "lpc",
  15781. percentages: "logicalWidthOfContainingBlock",
  15782. groups: [
  15783. "CSS Logical Properties"
  15784. ],
  15785. initial: "auto",
  15786. appliesto: "positionedElements",
  15787. computed: "sameAsBoxOffsets",
  15788. order: "uniqueOrder",
  15789. status: "standard",
  15790. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-inline-start"
  15791. },
  15792. isolation: isolation,
  15793. "justify-content": {
  15794. syntax: "normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ]",
  15795. media: "visual",
  15796. inherited: false,
  15797. animationType: "discrete",
  15798. percentages: "no",
  15799. groups: [
  15800. "CSS Box Alignment"
  15801. ],
  15802. initial: "normal",
  15803. appliesto: "flexContainers",
  15804. computed: "asSpecified",
  15805. order: "uniqueOrder",
  15806. status: "standard",
  15807. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-content"
  15808. },
  15809. "justify-items": {
  15810. syntax: "normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ] | legacy | legacy && [ left | right | center ]",
  15811. media: "visual",
  15812. inherited: false,
  15813. animationType: "discrete",
  15814. percentages: "no",
  15815. groups: [
  15816. "CSS Box Alignment"
  15817. ],
  15818. initial: "legacy",
  15819. appliesto: "allElements",
  15820. computed: "asSpecified",
  15821. order: "perGrammar",
  15822. status: "standard",
  15823. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-items"
  15824. },
  15825. "justify-self": {
  15826. syntax: "auto | normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ]",
  15827. media: "visual",
  15828. inherited: false,
  15829. animationType: "discrete",
  15830. percentages: "no",
  15831. groups: [
  15832. "CSS Box Alignment"
  15833. ],
  15834. initial: "auto",
  15835. appliesto: "blockLevelBoxesAndAbsolutelyPositionedBoxesAndGridItems",
  15836. computed: "asSpecified",
  15837. order: "uniqueOrder",
  15838. status: "standard",
  15839. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-self"
  15840. },
  15841. left: left,
  15842. "letter-spacing": {
  15843. syntax: "normal | <length>",
  15844. media: "visual",
  15845. inherited: true,
  15846. animationType: "length",
  15847. percentages: "no",
  15848. groups: [
  15849. "CSS Text"
  15850. ],
  15851. initial: "normal",
  15852. appliesto: "allElements",
  15853. computed: "optimumValueOfAbsoluteLengthOrNormal",
  15854. order: "uniqueOrder",
  15855. alsoAppliesTo: [
  15856. "::first-letter",
  15857. "::first-line"
  15858. ],
  15859. status: "standard",
  15860. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/letter-spacing"
  15861. },
  15862. "line-break": {
  15863. syntax: "auto | loose | normal | strict | anywhere",
  15864. media: "visual",
  15865. inherited: false,
  15866. animationType: "discrete",
  15867. percentages: "no",
  15868. groups: [
  15869. "CSS Text"
  15870. ],
  15871. initial: "auto",
  15872. appliesto: "allElements",
  15873. computed: "asSpecified",
  15874. order: "uniqueOrder",
  15875. status: "standard",
  15876. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/line-break"
  15877. },
  15878. "line-clamp": {
  15879. syntax: "none | <integer>",
  15880. media: "visual",
  15881. inherited: false,
  15882. animationType: "integer",
  15883. percentages: "no",
  15884. groups: [
  15885. "CSS Overflow"
  15886. ],
  15887. initial: "none",
  15888. appliesto: "blockContainersExceptMultiColumnContainers",
  15889. computed: "asSpecified",
  15890. order: "perGrammar",
  15891. status: "experimental"
  15892. },
  15893. "line-height": {
  15894. syntax: "normal | <number> | <length> | <percentage>",
  15895. media: "visual",
  15896. inherited: true,
  15897. animationType: "numberOrLength",
  15898. percentages: "referToElementFontSize",
  15899. groups: [
  15900. "CSS Fonts"
  15901. ],
  15902. initial: "normal",
  15903. appliesto: "allElements",
  15904. computed: "absoluteLengthOrAsSpecified",
  15905. order: "uniqueOrder",
  15906. alsoAppliesTo: [
  15907. "::first-letter",
  15908. "::first-line",
  15909. "::placeholder"
  15910. ],
  15911. status: "standard",
  15912. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/line-height"
  15913. },
  15914. "line-height-step": {
  15915. syntax: "<length>",
  15916. media: "visual",
  15917. inherited: true,
  15918. animationType: "discrete",
  15919. percentages: "no",
  15920. groups: [
  15921. "CSS Fonts"
  15922. ],
  15923. initial: "0",
  15924. appliesto: "blockContainers",
  15925. computed: "absoluteLength",
  15926. order: "perGrammar",
  15927. status: "experimental",
  15928. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/line-height-step"
  15929. },
  15930. "list-style": {
  15931. syntax: "<'list-style-type'> || <'list-style-position'> || <'list-style-image'>",
  15932. media: "visual",
  15933. inherited: true,
  15934. animationType: "discrete",
  15935. percentages: "no",
  15936. groups: [
  15937. "CSS Lists and Counters"
  15938. ],
  15939. initial: [
  15940. "list-style-type",
  15941. "list-style-position",
  15942. "list-style-image"
  15943. ],
  15944. appliesto: "listItems",
  15945. computed: [
  15946. "list-style-image",
  15947. "list-style-position",
  15948. "list-style-type"
  15949. ],
  15950. order: "orderOfAppearance",
  15951. status: "standard",
  15952. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style"
  15953. },
  15954. "list-style-image": {
  15955. syntax: "<url> | none",
  15956. media: "visual",
  15957. inherited: true,
  15958. animationType: "discrete",
  15959. percentages: "no",
  15960. groups: [
  15961. "CSS Lists and Counters"
  15962. ],
  15963. initial: "none",
  15964. appliesto: "listItems",
  15965. computed: "noneOrImageWithAbsoluteURI",
  15966. order: "uniqueOrder",
  15967. status: "standard",
  15968. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style-image"
  15969. },
  15970. "list-style-position": {
  15971. syntax: "inside | outside",
  15972. media: "visual",
  15973. inherited: true,
  15974. animationType: "discrete",
  15975. percentages: "no",
  15976. groups: [
  15977. "CSS Lists and Counters"
  15978. ],
  15979. initial: "outside",
  15980. appliesto: "listItems",
  15981. computed: "asSpecified",
  15982. order: "uniqueOrder",
  15983. status: "standard",
  15984. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style-position"
  15985. },
  15986. "list-style-type": {
  15987. syntax: "<counter-style> | <string> | none",
  15988. media: "visual",
  15989. inherited: true,
  15990. animationType: "discrete",
  15991. percentages: "no",
  15992. groups: [
  15993. "CSS Lists and Counters"
  15994. ],
  15995. initial: "disc",
  15996. appliesto: "listItems",
  15997. computed: "asSpecified",
  15998. order: "uniqueOrder",
  15999. status: "standard",
  16000. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style-type"
  16001. },
  16002. margin: margin,
  16003. "margin-block": {
  16004. syntax: "<'margin-left'>{1,2}",
  16005. media: "visual",
  16006. inherited: false,
  16007. animationType: "discrete",
  16008. percentages: "dependsOnLayoutModel",
  16009. groups: [
  16010. "CSS Logical Properties"
  16011. ],
  16012. initial: "0",
  16013. appliesto: "sameAsMargin",
  16014. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16015. order: "uniqueOrder",
  16016. status: "standard",
  16017. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-block"
  16018. },
  16019. "margin-block-end": {
  16020. syntax: "<'margin-left'>",
  16021. media: "visual",
  16022. inherited: false,
  16023. animationType: "discrete",
  16024. percentages: "dependsOnLayoutModel",
  16025. groups: [
  16026. "CSS Logical Properties"
  16027. ],
  16028. initial: "0",
  16029. appliesto: "sameAsMargin",
  16030. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16031. order: "uniqueOrder",
  16032. status: "standard",
  16033. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-block-end"
  16034. },
  16035. "margin-block-start": {
  16036. syntax: "<'margin-left'>",
  16037. media: "visual",
  16038. inherited: false,
  16039. animationType: "discrete",
  16040. percentages: "dependsOnLayoutModel",
  16041. groups: [
  16042. "CSS Logical Properties"
  16043. ],
  16044. initial: "0",
  16045. appliesto: "sameAsMargin",
  16046. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16047. order: "uniqueOrder",
  16048. status: "standard",
  16049. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-block-start"
  16050. },
  16051. "margin-bottom": {
  16052. syntax: "<length> | <percentage> | auto",
  16053. media: "visual",
  16054. inherited: false,
  16055. animationType: "length",
  16056. percentages: "referToWidthOfContainingBlock",
  16057. groups: [
  16058. "CSS Box Model"
  16059. ],
  16060. initial: "0",
  16061. appliesto: "allElementsExceptTableDisplayTypes",
  16062. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16063. order: "uniqueOrder",
  16064. alsoAppliesTo: [
  16065. "::first-letter"
  16066. ],
  16067. status: "standard",
  16068. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-bottom"
  16069. },
  16070. "margin-inline": {
  16071. syntax: "<'margin-left'>{1,2}",
  16072. media: "visual",
  16073. inherited: false,
  16074. animationType: "discrete",
  16075. percentages: "dependsOnLayoutModel",
  16076. groups: [
  16077. "CSS Logical Properties"
  16078. ],
  16079. initial: "0",
  16080. appliesto: "sameAsMargin",
  16081. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16082. order: "uniqueOrder",
  16083. status: "standard",
  16084. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-inline"
  16085. },
  16086. "margin-inline-end": {
  16087. syntax: "<'margin-left'>",
  16088. media: "visual",
  16089. inherited: false,
  16090. animationType: "discrete",
  16091. percentages: "dependsOnLayoutModel",
  16092. groups: [
  16093. "CSS Logical Properties"
  16094. ],
  16095. initial: "0",
  16096. appliesto: "sameAsMargin",
  16097. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16098. order: "uniqueOrder",
  16099. status: "standard",
  16100. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-inline-end"
  16101. },
  16102. "margin-inline-start": {
  16103. syntax: "<'margin-left'>",
  16104. media: "visual",
  16105. inherited: false,
  16106. animationType: "discrete",
  16107. percentages: "dependsOnLayoutModel",
  16108. groups: [
  16109. "CSS Logical Properties"
  16110. ],
  16111. initial: "0",
  16112. appliesto: "sameAsMargin",
  16113. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16114. order: "uniqueOrder",
  16115. status: "standard",
  16116. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-inline-start"
  16117. },
  16118. "margin-left": {
  16119. syntax: "<length> | <percentage> | auto",
  16120. media: "visual",
  16121. inherited: false,
  16122. animationType: "length",
  16123. percentages: "referToWidthOfContainingBlock",
  16124. groups: [
  16125. "CSS Box Model"
  16126. ],
  16127. initial: "0",
  16128. appliesto: "allElementsExceptTableDisplayTypes",
  16129. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16130. order: "uniqueOrder",
  16131. alsoAppliesTo: [
  16132. "::first-letter"
  16133. ],
  16134. status: "standard",
  16135. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-left"
  16136. },
  16137. "margin-right": {
  16138. syntax: "<length> | <percentage> | auto",
  16139. media: "visual",
  16140. inherited: false,
  16141. animationType: "length",
  16142. percentages: "referToWidthOfContainingBlock",
  16143. groups: [
  16144. "CSS Box Model"
  16145. ],
  16146. initial: "0",
  16147. appliesto: "allElementsExceptTableDisplayTypes",
  16148. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16149. order: "uniqueOrder",
  16150. alsoAppliesTo: [
  16151. "::first-letter"
  16152. ],
  16153. status: "standard",
  16154. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-right"
  16155. },
  16156. "margin-top": {
  16157. syntax: "<length> | <percentage> | auto",
  16158. media: "visual",
  16159. inherited: false,
  16160. animationType: "length",
  16161. percentages: "referToWidthOfContainingBlock",
  16162. groups: [
  16163. "CSS Box Model"
  16164. ],
  16165. initial: "0",
  16166. appliesto: "allElementsExceptTableDisplayTypes",
  16167. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16168. order: "uniqueOrder",
  16169. alsoAppliesTo: [
  16170. "::first-letter"
  16171. ],
  16172. status: "standard",
  16173. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-top"
  16174. },
  16175. mask: mask,
  16176. "mask-border": {
  16177. syntax: "<'mask-border-source'> || <'mask-border-slice'> [ / <'mask-border-width'>? [ / <'mask-border-outset'> ]? ]? || <'mask-border-repeat'> || <'mask-border-mode'>",
  16178. media: "visual",
  16179. inherited: false,
  16180. animationType: [
  16181. "mask-border-mode",
  16182. "mask-border-outset",
  16183. "mask-border-repeat",
  16184. "mask-border-slice",
  16185. "mask-border-source",
  16186. "mask-border-width"
  16187. ],
  16188. percentages: [
  16189. "mask-border-slice",
  16190. "mask-border-width"
  16191. ],
  16192. groups: [
  16193. "CSS Masking"
  16194. ],
  16195. initial: [
  16196. "mask-border-mode",
  16197. "mask-border-outset",
  16198. "mask-border-repeat",
  16199. "mask-border-slice",
  16200. "mask-border-source",
  16201. "mask-border-width"
  16202. ],
  16203. appliesto: "allElementsSVGContainerElements",
  16204. computed: [
  16205. "mask-border-mode",
  16206. "mask-border-outset",
  16207. "mask-border-repeat",
  16208. "mask-border-slice",
  16209. "mask-border-source",
  16210. "mask-border-width"
  16211. ],
  16212. order: "perGrammar",
  16213. stacking: true,
  16214. status: "experimental",
  16215. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border"
  16216. },
  16217. "mask-border-mode": {
  16218. syntax: "luminance | alpha",
  16219. media: "visual",
  16220. inherited: false,
  16221. animationType: "discrete",
  16222. percentages: "no",
  16223. groups: [
  16224. "CSS Masking"
  16225. ],
  16226. initial: "alpha",
  16227. appliesto: "allElementsSVGContainerElements",
  16228. computed: "asSpecified",
  16229. order: "perGrammar",
  16230. status: "experimental",
  16231. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-mode"
  16232. },
  16233. "mask-border-outset": {
  16234. syntax: "[ <length> | <number> ]{1,4}",
  16235. media: "visual",
  16236. inherited: false,
  16237. animationType: "discrete",
  16238. percentages: "no",
  16239. groups: [
  16240. "CSS Masking"
  16241. ],
  16242. initial: "0",
  16243. appliesto: "allElementsSVGContainerElements",
  16244. computed: "asSpecifiedRelativeToAbsoluteLengths",
  16245. order: "perGrammar",
  16246. status: "experimental",
  16247. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-outset"
  16248. },
  16249. "mask-border-repeat": {
  16250. syntax: "[ stretch | repeat | round | space ]{1,2}",
  16251. media: "visual",
  16252. inherited: false,
  16253. animationType: "discrete",
  16254. percentages: "no",
  16255. groups: [
  16256. "CSS Masking"
  16257. ],
  16258. initial: "stretch",
  16259. appliesto: "allElementsSVGContainerElements",
  16260. computed: "asSpecified",
  16261. order: "perGrammar",
  16262. status: "experimental",
  16263. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-repeat"
  16264. },
  16265. "mask-border-slice": {
  16266. syntax: "<number-percentage>{1,4} fill?",
  16267. media: "visual",
  16268. inherited: false,
  16269. animationType: "discrete",
  16270. percentages: "referToSizeOfMaskBorderImage",
  16271. groups: [
  16272. "CSS Masking"
  16273. ],
  16274. initial: "0",
  16275. appliesto: "allElementsSVGContainerElements",
  16276. computed: "asSpecified",
  16277. order: "perGrammar",
  16278. status: "experimental",
  16279. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-slice"
  16280. },
  16281. "mask-border-source": {
  16282. syntax: "none | <image>",
  16283. media: "visual",
  16284. inherited: false,
  16285. animationType: "discrete",
  16286. percentages: "no",
  16287. groups: [
  16288. "CSS Masking"
  16289. ],
  16290. initial: "none",
  16291. appliesto: "allElementsSVGContainerElements",
  16292. computed: "asSpecifiedURLsAbsolute",
  16293. order: "perGrammar",
  16294. status: "experimental",
  16295. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-source"
  16296. },
  16297. "mask-border-width": {
  16298. syntax: "[ <length-percentage> | <number> | auto ]{1,4}",
  16299. media: "visual",
  16300. inherited: false,
  16301. animationType: "discrete",
  16302. percentages: "relativeToMaskBorderImageArea",
  16303. groups: [
  16304. "CSS Masking"
  16305. ],
  16306. initial: "auto",
  16307. appliesto: "allElementsSVGContainerElements",
  16308. computed: "asSpecifiedRelativeToAbsoluteLengths",
  16309. order: "perGrammar",
  16310. status: "experimental",
  16311. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-width"
  16312. },
  16313. "mask-clip": {
  16314. syntax: "[ <geometry-box> | no-clip ]#",
  16315. media: "visual",
  16316. inherited: false,
  16317. animationType: "discrete",
  16318. percentages: "no",
  16319. groups: [
  16320. "CSS Masking"
  16321. ],
  16322. initial: "border-box",
  16323. appliesto: "allElementsSVGContainerElements",
  16324. computed: "asSpecified",
  16325. order: "perGrammar",
  16326. status: "standard",
  16327. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-clip"
  16328. },
  16329. "mask-composite": {
  16330. syntax: "<compositing-operator>#",
  16331. media: "visual",
  16332. inherited: false,
  16333. animationType: "discrete",
  16334. percentages: "no",
  16335. groups: [
  16336. "CSS Masking"
  16337. ],
  16338. initial: "add",
  16339. appliesto: "allElementsSVGContainerElements",
  16340. computed: "asSpecified",
  16341. order: "perGrammar",
  16342. status: "standard",
  16343. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-composite"
  16344. },
  16345. "mask-image": {
  16346. syntax: "<mask-reference>#",
  16347. media: "visual",
  16348. inherited: false,
  16349. animationType: "discrete",
  16350. percentages: "no",
  16351. groups: [
  16352. "CSS Masking"
  16353. ],
  16354. initial: "none",
  16355. appliesto: "allElementsSVGContainerElements",
  16356. computed: "asSpecifiedURLsAbsolute",
  16357. order: "perGrammar",
  16358. status: "standard",
  16359. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-image"
  16360. },
  16361. "mask-mode": {
  16362. syntax: "<masking-mode>#",
  16363. media: "visual",
  16364. inherited: false,
  16365. animationType: "discrete",
  16366. percentages: "no",
  16367. groups: [
  16368. "CSS Masking"
  16369. ],
  16370. initial: "match-source",
  16371. appliesto: "allElementsSVGContainerElements",
  16372. computed: "asSpecified",
  16373. order: "perGrammar",
  16374. status: "standard",
  16375. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-mode"
  16376. },
  16377. "mask-origin": {
  16378. syntax: "<geometry-box>#",
  16379. media: "visual",
  16380. inherited: false,
  16381. animationType: "discrete",
  16382. percentages: "no",
  16383. groups: [
  16384. "CSS Masking"
  16385. ],
  16386. initial: "border-box",
  16387. appliesto: "allElementsSVGContainerElements",
  16388. computed: "asSpecified",
  16389. order: "perGrammar",
  16390. status: "standard",
  16391. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-origin"
  16392. },
  16393. "mask-position": {
  16394. syntax: "<position>#",
  16395. media: "visual",
  16396. inherited: false,
  16397. animationType: "repeatableListOfSimpleListOfLpc",
  16398. percentages: "referToSizeOfMaskPaintingArea",
  16399. groups: [
  16400. "CSS Masking"
  16401. ],
  16402. initial: "center",
  16403. appliesto: "allElementsSVGContainerElements",
  16404. computed: "consistsOfTwoKeywordsForOriginAndOffsets",
  16405. order: "perGrammar",
  16406. status: "standard",
  16407. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-position"
  16408. },
  16409. "mask-repeat": {
  16410. syntax: "<repeat-style>#",
  16411. media: "visual",
  16412. inherited: false,
  16413. animationType: "discrete",
  16414. percentages: "no",
  16415. groups: [
  16416. "CSS Masking"
  16417. ],
  16418. initial: "no-repeat",
  16419. appliesto: "allElementsSVGContainerElements",
  16420. computed: "consistsOfTwoDimensionKeywords",
  16421. order: "perGrammar",
  16422. status: "standard",
  16423. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-repeat"
  16424. },
  16425. "mask-size": {
  16426. syntax: "<bg-size>#",
  16427. media: "visual",
  16428. inherited: false,
  16429. animationType: "repeatableListOfSimpleListOfLpc",
  16430. percentages: "no",
  16431. groups: [
  16432. "CSS Masking"
  16433. ],
  16434. initial: "auto",
  16435. appliesto: "allElementsSVGContainerElements",
  16436. computed: "asSpecifiedRelativeToAbsoluteLengths",
  16437. order: "perGrammar",
  16438. status: "standard",
  16439. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-size"
  16440. },
  16441. "mask-type": {
  16442. syntax: "luminance | alpha",
  16443. media: "visual",
  16444. inherited: false,
  16445. animationType: "discrete",
  16446. percentages: "no",
  16447. groups: [
  16448. "CSS Masking"
  16449. ],
  16450. initial: "luminance",
  16451. appliesto: "maskElements",
  16452. computed: "asSpecified",
  16453. order: "perGrammar",
  16454. status: "standard",
  16455. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-type"
  16456. },
  16457. "max-block-size": {
  16458. syntax: "<'max-width'>",
  16459. media: "visual",
  16460. inherited: false,
  16461. animationType: "discrete",
  16462. percentages: "blockSizeOfContainingBlock",
  16463. groups: [
  16464. "CSS Logical Properties"
  16465. ],
  16466. initial: "0",
  16467. appliesto: "sameAsWidthAndHeight",
  16468. computed: "sameAsMaxWidthAndMaxHeight",
  16469. order: "uniqueOrder",
  16470. status: "experimental",
  16471. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-block-size"
  16472. },
  16473. "max-height": {
  16474. syntax: "<length> | <percentage> | none | max-content | min-content | fit-content | fill-available",
  16475. media: "visual",
  16476. inherited: false,
  16477. animationType: "lpc",
  16478. percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentagesNone",
  16479. groups: [
  16480. "CSS Box Model"
  16481. ],
  16482. initial: "none",
  16483. appliesto: "allElementsButNonReplacedAndTableColumns",
  16484. computed: "percentageAsSpecifiedAbsoluteLengthOrNone",
  16485. order: "uniqueOrder",
  16486. status: "standard",
  16487. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-height"
  16488. },
  16489. "max-inline-size": {
  16490. syntax: "<'max-width'>",
  16491. media: "visual",
  16492. inherited: false,
  16493. animationType: "discrete",
  16494. percentages: "inlineSizeOfContainingBlock",
  16495. groups: [
  16496. "CSS Logical Properties"
  16497. ],
  16498. initial: "0",
  16499. appliesto: "sameAsWidthAndHeight",
  16500. computed: "sameAsMaxWidthAndMaxHeight",
  16501. order: "uniqueOrder",
  16502. status: "experimental",
  16503. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-inline-size"
  16504. },
  16505. "max-lines": {
  16506. syntax: "none | <integer>",
  16507. media: "visual",
  16508. inherited: false,
  16509. animationType: "integer",
  16510. percentages: "no",
  16511. groups: [
  16512. "CSS Overflow"
  16513. ],
  16514. initial: "none",
  16515. appliesto: "blockContainersExceptMultiColumnContainers",
  16516. computed: "asSpecified",
  16517. order: "perGrammar",
  16518. status: "experimental"
  16519. },
  16520. "max-width": {
  16521. syntax: "<length> | <percentage> | none | max-content | min-content | fit-content | fill-available",
  16522. media: "visual",
  16523. inherited: false,
  16524. animationType: "lpc",
  16525. percentages: "referToWidthOfContainingBlock",
  16526. groups: [
  16527. "CSS Box Model"
  16528. ],
  16529. initial: "none",
  16530. appliesto: "allElementsButNonReplacedAndTableRows",
  16531. computed: "percentageAsSpecifiedAbsoluteLengthOrNone",
  16532. order: "uniqueOrder",
  16533. status: "standard",
  16534. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-width"
  16535. },
  16536. "min-block-size": {
  16537. syntax: "<'min-width'>",
  16538. media: "visual",
  16539. inherited: false,
  16540. animationType: "discrete",
  16541. percentages: "blockSizeOfContainingBlock",
  16542. groups: [
  16543. "CSS Logical Properties"
  16544. ],
  16545. initial: "0",
  16546. appliesto: "sameAsWidthAndHeight",
  16547. computed: "sameAsMinWidthAndMinHeight",
  16548. order: "uniqueOrder",
  16549. status: "standard",
  16550. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-block-size"
  16551. },
  16552. "min-height": {
  16553. syntax: "<length> | <percentage> | auto | max-content | min-content | fit-content | fill-available",
  16554. media: "visual",
  16555. inherited: false,
  16556. animationType: "lpc",
  16557. percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentages0",
  16558. groups: [
  16559. "CSS Box Model"
  16560. ],
  16561. initial: "auto",
  16562. appliesto: "allElementsButNonReplacedAndTableColumns",
  16563. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16564. order: "uniqueOrder",
  16565. status: "standard",
  16566. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-height"
  16567. },
  16568. "min-inline-size": {
  16569. syntax: "<'min-width'>",
  16570. media: "visual",
  16571. inherited: false,
  16572. animationType: "discrete",
  16573. percentages: "inlineSizeOfContainingBlock",
  16574. groups: [
  16575. "CSS Logical Properties"
  16576. ],
  16577. initial: "0",
  16578. appliesto: "sameAsWidthAndHeight",
  16579. computed: "sameAsMinWidthAndMinHeight",
  16580. order: "uniqueOrder",
  16581. status: "standard",
  16582. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-inline-size"
  16583. },
  16584. "min-width": {
  16585. syntax: "<length> | <percentage> | auto | max-content | min-content | fit-content | fill-available",
  16586. media: "visual",
  16587. inherited: false,
  16588. animationType: "lpc",
  16589. percentages: "referToWidthOfContainingBlock",
  16590. groups: [
  16591. "CSS Box Model"
  16592. ],
  16593. initial: "auto",
  16594. appliesto: "allElementsButNonReplacedAndTableRows",
  16595. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16596. order: "uniqueOrder",
  16597. status: "standard",
  16598. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-width"
  16599. },
  16600. "mix-blend-mode": {
  16601. syntax: "<blend-mode>",
  16602. media: "visual",
  16603. inherited: false,
  16604. animationType: "discrete",
  16605. percentages: "no",
  16606. groups: [
  16607. "Compositing and Blending"
  16608. ],
  16609. initial: "normal",
  16610. appliesto: "allElements",
  16611. computed: "asSpecified",
  16612. order: "uniqueOrder",
  16613. stacking: true,
  16614. status: "standard",
  16615. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mix-blend-mode"
  16616. },
  16617. "object-fit": {
  16618. syntax: "fill | contain | cover | none | scale-down",
  16619. media: "visual",
  16620. inherited: false,
  16621. animationType: "discrete",
  16622. percentages: "no",
  16623. groups: [
  16624. "CSS Images"
  16625. ],
  16626. initial: "fill",
  16627. appliesto: "replacedElements",
  16628. computed: "asSpecified",
  16629. order: "uniqueOrder",
  16630. status: "standard",
  16631. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/object-fit"
  16632. },
  16633. "object-position": {
  16634. syntax: "<position>",
  16635. media: "visual",
  16636. inherited: true,
  16637. animationType: "repeatableListOfSimpleListOfLpc",
  16638. percentages: "referToWidthAndHeightOfElement",
  16639. groups: [
  16640. "CSS Images"
  16641. ],
  16642. initial: "50% 50%",
  16643. appliesto: "replacedElements",
  16644. computed: "asSpecified",
  16645. order: "uniqueOrder",
  16646. status: "standard",
  16647. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/object-position"
  16648. },
  16649. offset: offset,
  16650. "offset-anchor": {
  16651. syntax: "auto | <position>",
  16652. media: "visual",
  16653. inherited: false,
  16654. animationType: "position",
  16655. percentages: "relativeToWidthAndHeight",
  16656. groups: [
  16657. "CSS Motion Path"
  16658. ],
  16659. initial: "auto",
  16660. appliesto: "transformableElements",
  16661. computed: "forLengthAbsoluteValueOtherwisePercentage",
  16662. order: "perGrammar",
  16663. status: "experimental"
  16664. },
  16665. "offset-distance": {
  16666. syntax: "<length-percentage>",
  16667. media: "visual",
  16668. inherited: false,
  16669. animationType: "lpc",
  16670. percentages: "referToTotalPathLength",
  16671. groups: [
  16672. "CSS Motion Path"
  16673. ],
  16674. initial: "0",
  16675. appliesto: "transformableElements",
  16676. computed: "forLengthAbsoluteValueOtherwisePercentage",
  16677. order: "perGrammar",
  16678. status: "experimental",
  16679. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-distance"
  16680. },
  16681. "offset-path": {
  16682. syntax: "none | ray( [ <angle> && <size>? && contain? ] ) | <path()> | <url> | [ <basic-shape> || <geometry-box> ]",
  16683. media: "visual",
  16684. inherited: false,
  16685. animationType: "angleOrBasicShapeOrPath",
  16686. percentages: "no",
  16687. groups: [
  16688. "CSS Motion Path"
  16689. ],
  16690. initial: "none",
  16691. appliesto: "transformableElements",
  16692. computed: "asSpecified",
  16693. order: "perGrammar",
  16694. stacking: true,
  16695. status: "experimental",
  16696. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-path"
  16697. },
  16698. "offset-position": {
  16699. syntax: "auto | <position>",
  16700. media: "visual",
  16701. inherited: false,
  16702. animationType: "position",
  16703. percentages: "referToSizeOfContainingBlock",
  16704. groups: [
  16705. "CSS Motion Path"
  16706. ],
  16707. initial: "auto",
  16708. appliesto: "transformableElements",
  16709. computed: "forLengthAbsoluteValueOtherwisePercentage",
  16710. order: "perGrammar",
  16711. status: "experimental"
  16712. },
  16713. "offset-rotate": {
  16714. syntax: "[ auto | reverse ] || <angle>",
  16715. media: "visual",
  16716. inherited: false,
  16717. animationType: "angleOrBasicShapeOrPath",
  16718. percentages: "no",
  16719. groups: [
  16720. "CSS Motion Path"
  16721. ],
  16722. initial: "auto",
  16723. appliesto: "transformableElements",
  16724. computed: "asSpecified",
  16725. order: "perGrammar",
  16726. status: "experimental",
  16727. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-rotate"
  16728. },
  16729. opacity: opacity,
  16730. order: order,
  16731. orphans: orphans,
  16732. outline: outline,
  16733. "outline-color": {
  16734. syntax: "<color> | invert",
  16735. media: [
  16736. "visual",
  16737. "interactive"
  16738. ],
  16739. inherited: false,
  16740. animationType: "color",
  16741. percentages: "no",
  16742. groups: [
  16743. "CSS Basic User Interface"
  16744. ],
  16745. initial: "invertOrCurrentColor",
  16746. appliesto: "allElements",
  16747. computed: "invertForTranslucentColorRGBAOtherwiseRGB",
  16748. order: "uniqueOrder",
  16749. status: "standard",
  16750. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-color"
  16751. },
  16752. "outline-offset": {
  16753. syntax: "<length>",
  16754. media: [
  16755. "visual",
  16756. "interactive"
  16757. ],
  16758. inherited: false,
  16759. animationType: "length",
  16760. percentages: "no",
  16761. groups: [
  16762. "CSS Basic User Interface"
  16763. ],
  16764. initial: "0",
  16765. appliesto: "allElements",
  16766. computed: "asSpecifiedRelativeToAbsoluteLengths",
  16767. order: "uniqueOrder",
  16768. status: "standard",
  16769. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-offset"
  16770. },
  16771. "outline-style": {
  16772. syntax: "auto | <'border-style'>",
  16773. media: [
  16774. "visual",
  16775. "interactive"
  16776. ],
  16777. inherited: false,
  16778. animationType: "discrete",
  16779. percentages: "no",
  16780. groups: [
  16781. "CSS Basic User Interface"
  16782. ],
  16783. initial: "none",
  16784. appliesto: "allElements",
  16785. computed: "asSpecified",
  16786. order: "uniqueOrder",
  16787. status: "standard",
  16788. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-style"
  16789. },
  16790. "outline-width": {
  16791. syntax: "<line-width>",
  16792. media: [
  16793. "visual",
  16794. "interactive"
  16795. ],
  16796. inherited: false,
  16797. animationType: "length",
  16798. percentages: "no",
  16799. groups: [
  16800. "CSS Basic User Interface"
  16801. ],
  16802. initial: "medium",
  16803. appliesto: "allElements",
  16804. computed: "absoluteLength0ForNone",
  16805. order: "uniqueOrder",
  16806. status: "standard",
  16807. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-width"
  16808. },
  16809. overflow: overflow,
  16810. "overflow-anchor": {
  16811. syntax: "auto | none",
  16812. media: "visual",
  16813. inherited: false,
  16814. animationType: "discrete",
  16815. percentages: "no",
  16816. groups: [
  16817. "CSS Scroll Anchoring"
  16818. ],
  16819. initial: "auto",
  16820. appliesto: "allElements",
  16821. computed: "asSpecified",
  16822. order: "perGrammar",
  16823. status: "experimental"
  16824. },
  16825. "overflow-block": {
  16826. syntax: "visible | hidden | clip | scroll | auto",
  16827. media: "visual",
  16828. inherited: false,
  16829. animationType: "discrete",
  16830. percentages: "no",
  16831. groups: [
  16832. "CSS Overflow"
  16833. ],
  16834. initial: "auto",
  16835. appliesto: "blockContainersFlexContainersGridContainers",
  16836. computed: "asSpecified",
  16837. order: "perGrammar",
  16838. status: "experimental"
  16839. },
  16840. "overflow-clip-box": {
  16841. syntax: "padding-box | content-box",
  16842. media: "visual",
  16843. inherited: false,
  16844. animationType: "discrete",
  16845. percentages: "no",
  16846. groups: [
  16847. "Mozilla Extensions"
  16848. ],
  16849. initial: "padding-box",
  16850. appliesto: "allElements",
  16851. computed: "asSpecified",
  16852. order: "uniqueOrder",
  16853. status: "nonstandard",
  16854. mdn_url: "https://developer.mozilla.org/docs/Mozilla/CSS/overflow-clip-box"
  16855. },
  16856. "overflow-inline": {
  16857. syntax: "visible | hidden | clip | scroll | auto",
  16858. media: "visual",
  16859. inherited: false,
  16860. animationType: "discrete",
  16861. percentages: "no",
  16862. groups: [
  16863. "CSS Overflow"
  16864. ],
  16865. initial: "auto",
  16866. appliesto: "blockContainersFlexContainersGridContainers",
  16867. computed: "asSpecified",
  16868. order: "perGrammar",
  16869. status: "experimental"
  16870. },
  16871. "overflow-wrap": {
  16872. syntax: "normal | break-word | anywhere",
  16873. media: "visual",
  16874. inherited: true,
  16875. animationType: "discrete",
  16876. percentages: "no",
  16877. groups: [
  16878. "CSS Text"
  16879. ],
  16880. initial: "normal",
  16881. appliesto: "nonReplacedInlineElements",
  16882. computed: "asSpecified",
  16883. order: "uniqueOrder",
  16884. status: "standard",
  16885. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-wrap"
  16886. },
  16887. "overflow-x": {
  16888. syntax: "visible | hidden | clip | scroll | auto",
  16889. media: "visual",
  16890. inherited: false,
  16891. animationType: "discrete",
  16892. percentages: "no",
  16893. groups: [
  16894. "CSS Overflow"
  16895. ],
  16896. initial: "visible",
  16897. appliesto: "blockContainersFlexContainersGridContainers",
  16898. computed: "asSpecified",
  16899. order: "uniqueOrder",
  16900. status: "standard",
  16901. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-x"
  16902. },
  16903. "overflow-y": {
  16904. syntax: "visible | hidden | clip | scroll | auto",
  16905. media: "visual",
  16906. inherited: false,
  16907. animationType: "discrete",
  16908. percentages: "no",
  16909. groups: [
  16910. "CSS Overflow"
  16911. ],
  16912. initial: "visible",
  16913. appliesto: "blockContainersFlexContainersGridContainers",
  16914. computed: "asSpecified",
  16915. order: "uniqueOrder",
  16916. status: "standard",
  16917. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-y"
  16918. },
  16919. "overscroll-behavior": {
  16920. syntax: "[ contain | none | auto ]{1,2}",
  16921. media: "visual",
  16922. inherited: false,
  16923. animationType: "discrete",
  16924. percentages: "no",
  16925. groups: [
  16926. "CSS Box Model"
  16927. ],
  16928. initial: "auto",
  16929. appliesto: "nonReplacedBlockAndInlineBlockElements",
  16930. computed: "asSpecified",
  16931. order: "uniqueOrder",
  16932. status: "nonstandard",
  16933. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior"
  16934. },
  16935. "overscroll-behavior-x": {
  16936. syntax: "contain | none | auto",
  16937. media: "visual",
  16938. inherited: false,
  16939. animationType: "discrete",
  16940. percentages: "no",
  16941. groups: [
  16942. "CSS Box Model"
  16943. ],
  16944. initial: "auto",
  16945. appliesto: "nonReplacedBlockAndInlineBlockElements",
  16946. computed: "asSpecified",
  16947. order: "uniqueOrder",
  16948. status: "nonstandard",
  16949. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-x"
  16950. },
  16951. "overscroll-behavior-y": {
  16952. syntax: "contain | none | auto",
  16953. media: "visual",
  16954. inherited: false,
  16955. animationType: "discrete",
  16956. percentages: "no",
  16957. groups: [
  16958. "CSS Box Model"
  16959. ],
  16960. initial: "auto",
  16961. appliesto: "nonReplacedBlockAndInlineBlockElements",
  16962. computed: "asSpecified",
  16963. order: "uniqueOrder",
  16964. status: "nonstandard",
  16965. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-y"
  16966. },
  16967. padding: padding,
  16968. "padding-block": {
  16969. syntax: "<'padding-left'>{1,2}",
  16970. media: "visual",
  16971. inherited: false,
  16972. animationType: "discrete",
  16973. percentages: "logicalWidthOfContainingBlock",
  16974. groups: [
  16975. "CSS Logical Properties"
  16976. ],
  16977. initial: "0",
  16978. appliesto: "allElements",
  16979. computed: "asLength",
  16980. order: "uniqueOrder",
  16981. status: "standard",
  16982. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-block"
  16983. },
  16984. "padding-block-end": {
  16985. syntax: "<'padding-left'>",
  16986. media: "visual",
  16987. inherited: false,
  16988. animationType: "discrete",
  16989. percentages: "logicalWidthOfContainingBlock",
  16990. groups: [
  16991. "CSS Logical Properties"
  16992. ],
  16993. initial: "0",
  16994. appliesto: "allElements",
  16995. computed: "asLength",
  16996. order: "uniqueOrder",
  16997. status: "standard",
  16998. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-block-end"
  16999. },
  17000. "padding-block-start": {
  17001. syntax: "<'padding-left'>",
  17002. media: "visual",
  17003. inherited: false,
  17004. animationType: "discrete",
  17005. percentages: "logicalWidthOfContainingBlock",
  17006. groups: [
  17007. "CSS Logical Properties"
  17008. ],
  17009. initial: "0",
  17010. appliesto: "allElements",
  17011. computed: "asLength",
  17012. order: "uniqueOrder",
  17013. status: "standard",
  17014. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-block-start"
  17015. },
  17016. "padding-bottom": {
  17017. syntax: "<length> | <percentage>",
  17018. media: "visual",
  17019. inherited: false,
  17020. animationType: "length",
  17021. percentages: "referToWidthOfContainingBlock",
  17022. groups: [
  17023. "CSS Box Model"
  17024. ],
  17025. initial: "0",
  17026. appliesto: "allElementsExceptInternalTableDisplayTypes",
  17027. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17028. order: "uniqueOrder",
  17029. alsoAppliesTo: [
  17030. "::first-letter"
  17031. ],
  17032. status: "standard",
  17033. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-bottom"
  17034. },
  17035. "padding-inline": {
  17036. syntax: "<'padding-left'>{1,2}",
  17037. media: "visual",
  17038. inherited: false,
  17039. animationType: "discrete",
  17040. percentages: "logicalWidthOfContainingBlock",
  17041. groups: [
  17042. "CSS Logical Properties"
  17043. ],
  17044. initial: "0",
  17045. appliesto: "allElements",
  17046. computed: "asLength",
  17047. order: "uniqueOrder",
  17048. status: "standard",
  17049. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-inline"
  17050. },
  17051. "padding-inline-end": {
  17052. syntax: "<'padding-left'>",
  17053. media: "visual",
  17054. inherited: false,
  17055. animationType: "discrete",
  17056. percentages: "logicalWidthOfContainingBlock",
  17057. groups: [
  17058. "CSS Logical Properties"
  17059. ],
  17060. initial: "0",
  17061. appliesto: "allElements",
  17062. computed: "asLength",
  17063. order: "uniqueOrder",
  17064. status: "standard",
  17065. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-inline-end"
  17066. },
  17067. "padding-inline-start": {
  17068. syntax: "<'padding-left'>",
  17069. media: "visual",
  17070. inherited: false,
  17071. animationType: "discrete",
  17072. percentages: "logicalWidthOfContainingBlock",
  17073. groups: [
  17074. "CSS Logical Properties"
  17075. ],
  17076. initial: "0",
  17077. appliesto: "allElements",
  17078. computed: "asLength",
  17079. order: "uniqueOrder",
  17080. status: "standard",
  17081. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-inline-start"
  17082. },
  17083. "padding-left": {
  17084. syntax: "<length> | <percentage>",
  17085. media: "visual",
  17086. inherited: false,
  17087. animationType: "length",
  17088. percentages: "referToWidthOfContainingBlock",
  17089. groups: [
  17090. "CSS Box Model"
  17091. ],
  17092. initial: "0",
  17093. appliesto: "allElementsExceptInternalTableDisplayTypes",
  17094. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17095. order: "uniqueOrder",
  17096. alsoAppliesTo: [
  17097. "::first-letter"
  17098. ],
  17099. status: "standard",
  17100. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-left"
  17101. },
  17102. "padding-right": {
  17103. syntax: "<length> | <percentage>",
  17104. media: "visual",
  17105. inherited: false,
  17106. animationType: "length",
  17107. percentages: "referToWidthOfContainingBlock",
  17108. groups: [
  17109. "CSS Box Model"
  17110. ],
  17111. initial: "0",
  17112. appliesto: "allElementsExceptInternalTableDisplayTypes",
  17113. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17114. order: "uniqueOrder",
  17115. alsoAppliesTo: [
  17116. "::first-letter"
  17117. ],
  17118. status: "standard",
  17119. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-right"
  17120. },
  17121. "padding-top": {
  17122. syntax: "<length> | <percentage>",
  17123. media: "visual",
  17124. inherited: false,
  17125. animationType: "length",
  17126. percentages: "referToWidthOfContainingBlock",
  17127. groups: [
  17128. "CSS Box Model"
  17129. ],
  17130. initial: "0",
  17131. appliesto: "allElementsExceptInternalTableDisplayTypes",
  17132. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17133. order: "uniqueOrder",
  17134. alsoAppliesTo: [
  17135. "::first-letter"
  17136. ],
  17137. status: "standard",
  17138. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-top"
  17139. },
  17140. "page-break-after": {
  17141. syntax: "auto | always | avoid | left | right | recto | verso",
  17142. media: [
  17143. "visual",
  17144. "paged"
  17145. ],
  17146. inherited: false,
  17147. animationType: "discrete",
  17148. percentages: "no",
  17149. groups: [
  17150. "CSS Pages"
  17151. ],
  17152. initial: "auto",
  17153. appliesto: "blockElementsInNormalFlow",
  17154. computed: "asSpecified",
  17155. order: "uniqueOrder",
  17156. status: "standard",
  17157. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/page-break-after"
  17158. },
  17159. "page-break-before": {
  17160. syntax: "auto | always | avoid | left | right | recto | verso",
  17161. media: [
  17162. "visual",
  17163. "paged"
  17164. ],
  17165. inherited: false,
  17166. animationType: "discrete",
  17167. percentages: "no",
  17168. groups: [
  17169. "CSS Pages"
  17170. ],
  17171. initial: "auto",
  17172. appliesto: "blockElementsInNormalFlow",
  17173. computed: "asSpecified",
  17174. order: "uniqueOrder",
  17175. status: "standard",
  17176. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/page-break-before"
  17177. },
  17178. "page-break-inside": {
  17179. syntax: "auto | avoid",
  17180. media: [
  17181. "visual",
  17182. "paged"
  17183. ],
  17184. inherited: false,
  17185. animationType: "discrete",
  17186. percentages: "no",
  17187. groups: [
  17188. "CSS Pages"
  17189. ],
  17190. initial: "auto",
  17191. appliesto: "blockElementsInNormalFlow",
  17192. computed: "asSpecified",
  17193. order: "uniqueOrder",
  17194. status: "standard",
  17195. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/page-break-inside"
  17196. },
  17197. "paint-order": {
  17198. syntax: "normal | [ fill || stroke || markers ]",
  17199. media: "visual",
  17200. inherited: true,
  17201. animationType: "discrete",
  17202. percentages: "no",
  17203. groups: [
  17204. "CSS Text"
  17205. ],
  17206. initial: "normal",
  17207. appliesto: "textElements",
  17208. computed: "asSpecified",
  17209. order: "uniqueOrder",
  17210. status: "experimental",
  17211. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/paint-order"
  17212. },
  17213. perspective: perspective,
  17214. "perspective-origin": {
  17215. syntax: "<position>",
  17216. media: "visual",
  17217. inherited: false,
  17218. animationType: "simpleListOfLpc",
  17219. percentages: "referToSizeOfBoundingBox",
  17220. groups: [
  17221. "CSS Transforms"
  17222. ],
  17223. initial: "50% 50%",
  17224. appliesto: "transformableElements",
  17225. computed: "forLengthAbsoluteValueOtherwisePercentage",
  17226. order: "oneOrTwoValuesLengthAbsoluteKeywordsPercentages",
  17227. status: "standard",
  17228. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/perspective-origin"
  17229. },
  17230. "place-content": {
  17231. syntax: "<'align-content'> <'justify-content'>?",
  17232. media: "visual",
  17233. inherited: false,
  17234. animationType: "discrete",
  17235. percentages: "no",
  17236. groups: [
  17237. "CSS Box Alignment"
  17238. ],
  17239. initial: "normal",
  17240. appliesto: "multilineFlexContainers",
  17241. computed: "asSpecified",
  17242. order: "uniqueOrder",
  17243. status: "standard",
  17244. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/place-content"
  17245. },
  17246. "place-items": {
  17247. syntax: "<'align-items'> <'justify-items'>?",
  17248. media: "visual",
  17249. inherited: false,
  17250. animationType: "discrete",
  17251. percentages: "no",
  17252. groups: [
  17253. "CSS Box Alignment"
  17254. ],
  17255. initial: [
  17256. "align-items",
  17257. "justify-items"
  17258. ],
  17259. appliesto: "allElements",
  17260. computed: [
  17261. "align-items",
  17262. "justify-items"
  17263. ],
  17264. order: "uniqueOrder",
  17265. status: "standard",
  17266. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/place-items"
  17267. },
  17268. "place-self": {
  17269. syntax: "<'align-self'> <'justify-self'>?",
  17270. media: "visual",
  17271. inherited: false,
  17272. animationType: "discrete",
  17273. percentages: "no",
  17274. groups: [
  17275. "CSS Box Alignment"
  17276. ],
  17277. initial: [
  17278. "align-self",
  17279. "justify-self"
  17280. ],
  17281. appliesto: "blockLevelBoxesAndAbsolutelyPositionedBoxesAndGridItems",
  17282. computed: [
  17283. "align-self",
  17284. "justify-self"
  17285. ],
  17286. order: "uniqueOrder",
  17287. status: "standard",
  17288. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/place-self"
  17289. },
  17290. "pointer-events": {
  17291. syntax: "auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit",
  17292. media: "visual",
  17293. inherited: true,
  17294. animationType: "discrete",
  17295. percentages: "no",
  17296. groups: [
  17297. "Pointer Events"
  17298. ],
  17299. initial: "auto",
  17300. appliesto: "allElements",
  17301. computed: "asSpecified",
  17302. order: "uniqueOrder",
  17303. status: "standard",
  17304. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/pointer-events"
  17305. },
  17306. position: position,
  17307. quotes: quotes,
  17308. resize: resize,
  17309. right: right,
  17310. rotate: rotate,
  17311. "row-gap": {
  17312. syntax: "normal | <length-percentage>",
  17313. media: "visual",
  17314. inherited: false,
  17315. animationType: "lpc",
  17316. percentages: "referToDimensionOfContentArea",
  17317. groups: [
  17318. "CSS Box Alignment"
  17319. ],
  17320. initial: "normal",
  17321. appliesto: "multiColumnElementsFlexContainersGridContainers",
  17322. computed: "asSpecifiedWithLengthsAbsoluteAndNormalComputingToZeroExceptMultiColumn",
  17323. order: "perGrammar",
  17324. status: "standard",
  17325. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/row-gap"
  17326. },
  17327. "ruby-align": {
  17328. syntax: "start | center | space-between | space-around",
  17329. media: "visual",
  17330. inherited: true,
  17331. animationType: "discrete",
  17332. percentages: "no",
  17333. groups: [
  17334. "CSS Ruby"
  17335. ],
  17336. initial: "space-around",
  17337. appliesto: "rubyBasesAnnotationsBaseAnnotationContainers",
  17338. computed: "asSpecified",
  17339. order: "uniqueOrder",
  17340. status: "experimental",
  17341. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/ruby-align"
  17342. },
  17343. "ruby-merge": {
  17344. syntax: "separate | collapse | auto",
  17345. media: "visual",
  17346. inherited: true,
  17347. animationType: "discrete",
  17348. percentages: "no",
  17349. groups: [
  17350. "CSS Ruby"
  17351. ],
  17352. initial: "separate",
  17353. appliesto: "rubyAnnotationsContainers",
  17354. computed: "asSpecified",
  17355. order: "uniqueOrder",
  17356. status: "experimental"
  17357. },
  17358. "ruby-position": {
  17359. syntax: "over | under | inter-character",
  17360. media: "visual",
  17361. inherited: true,
  17362. animationType: "discrete",
  17363. percentages: "no",
  17364. groups: [
  17365. "CSS Ruby"
  17366. ],
  17367. initial: "over",
  17368. appliesto: "rubyAnnotationsContainers",
  17369. computed: "asSpecified",
  17370. order: "uniqueOrder",
  17371. status: "experimental",
  17372. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/ruby-position"
  17373. },
  17374. scale: scale,
  17375. "scrollbar-color": {
  17376. syntax: "auto | dark | light | <color>{2}",
  17377. media: "visual",
  17378. inherited: true,
  17379. animationType: "color",
  17380. percentages: "no",
  17381. groups: [
  17382. "CSS Scrollbars"
  17383. ],
  17384. initial: "auto",
  17385. appliesto: "scrollingBoxes",
  17386. computed: "asSpecified",
  17387. order: "perGrammar",
  17388. status: "standard",
  17389. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-color"
  17390. },
  17391. "scrollbar-width": {
  17392. syntax: "auto | thin | none",
  17393. media: "visual",
  17394. inherited: false,
  17395. animationType: "discrete",
  17396. percentages: "no",
  17397. groups: [
  17398. "CSS Scrollbars"
  17399. ],
  17400. initial: "auto",
  17401. appliesto: "scrollingBoxes",
  17402. computed: "asSpecified",
  17403. order: "perGrammar",
  17404. status: "standard",
  17405. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-width"
  17406. },
  17407. "scroll-behavior": {
  17408. syntax: "auto | smooth",
  17409. media: "visual",
  17410. inherited: false,
  17411. animationType: "discrete",
  17412. percentages: "no",
  17413. groups: [
  17414. "CSSOM View"
  17415. ],
  17416. initial: "auto",
  17417. appliesto: "scrollingBoxes",
  17418. computed: "asSpecified",
  17419. order: "uniqueOrder",
  17420. status: "standard",
  17421. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-behavior"
  17422. },
  17423. "scroll-margin": {
  17424. syntax: "<length>{1,4}",
  17425. media: "visual",
  17426. inherited: false,
  17427. animationType: "byComputedValueType",
  17428. percentages: "no",
  17429. groups: [
  17430. "CSS Scroll Snap"
  17431. ],
  17432. initial: "0",
  17433. appliesto: "allElements",
  17434. computed: "asSpecified",
  17435. order: "perGrammar",
  17436. status: "standard",
  17437. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin"
  17438. },
  17439. "scroll-margin-block": {
  17440. syntax: "<length>{1,2}",
  17441. media: "visual",
  17442. inherited: false,
  17443. animationType: "byComputedValueType",
  17444. percentages: "no",
  17445. groups: [
  17446. "CSS Scroll Snap"
  17447. ],
  17448. initial: "0",
  17449. appliesto: "allElements",
  17450. computed: "asSpecified",
  17451. order: "perGrammar",
  17452. status: "standard",
  17453. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block"
  17454. },
  17455. "scroll-margin-block-start": {
  17456. syntax: "<length>",
  17457. media: "visual",
  17458. inherited: false,
  17459. animationType: "byComputedValueType",
  17460. percentages: "no",
  17461. groups: [
  17462. "CSS Scroll Snap"
  17463. ],
  17464. initial: "0",
  17465. appliesto: "allElements",
  17466. computed: "asSpecified",
  17467. order: "perGrammar",
  17468. status: "standard",
  17469. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-start"
  17470. },
  17471. "scroll-margin-block-end": {
  17472. syntax: "<length>",
  17473. media: "visual",
  17474. inherited: false,
  17475. animationType: "byComputedValueType",
  17476. percentages: "no",
  17477. groups: [
  17478. "CSS Scroll Snap"
  17479. ],
  17480. initial: "0",
  17481. appliesto: "allElements",
  17482. computed: "asSpecified",
  17483. order: "perGrammar",
  17484. status: "standard",
  17485. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-end"
  17486. },
  17487. "scroll-margin-bottom": {
  17488. syntax: "<length>",
  17489. media: "visual",
  17490. inherited: false,
  17491. animationType: "byComputedValueType",
  17492. percentages: "no",
  17493. groups: [
  17494. "CSS Scroll Snap"
  17495. ],
  17496. initial: "0",
  17497. appliesto: "allElements",
  17498. computed: "asSpecified",
  17499. order: "perGrammar",
  17500. status: "standard",
  17501. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-bottom"
  17502. },
  17503. "scroll-margin-inline": {
  17504. syntax: "<length>{1,2}",
  17505. media: "visual",
  17506. inherited: false,
  17507. animationType: "byComputedValueType",
  17508. percentages: "no",
  17509. groups: [
  17510. "CSS Scroll Snap"
  17511. ],
  17512. initial: "0",
  17513. appliesto: "allElements",
  17514. computed: "asSpecified",
  17515. order: "perGrammar",
  17516. status: "standard",
  17517. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline"
  17518. },
  17519. "scroll-margin-inline-start": {
  17520. syntax: "<length>",
  17521. media: "visual",
  17522. inherited: false,
  17523. animationType: "byComputedValueType",
  17524. percentages: "no",
  17525. groups: [
  17526. "CSS Scroll Snap"
  17527. ],
  17528. initial: "0",
  17529. appliesto: "allElements",
  17530. computed: "asSpecified",
  17531. order: "perGrammar",
  17532. status: "standard",
  17533. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-start"
  17534. },
  17535. "scroll-margin-inline-end": {
  17536. syntax: "<length>",
  17537. media: "visual",
  17538. inherited: false,
  17539. animationType: "byComputedValueType",
  17540. percentages: "no",
  17541. groups: [
  17542. "CSS Scroll Snap"
  17543. ],
  17544. initial: "0",
  17545. appliesto: "allElements",
  17546. computed: "asSpecified",
  17547. order: "perGrammar",
  17548. status: "standard",
  17549. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-end"
  17550. },
  17551. "scroll-margin-left": {
  17552. syntax: "<length>",
  17553. media: "visual",
  17554. inherited: false,
  17555. animationType: "byComputedValueType",
  17556. percentages: "no",
  17557. groups: [
  17558. "CSS Scroll Snap"
  17559. ],
  17560. initial: "0",
  17561. appliesto: "allElements",
  17562. computed: "asSpecified",
  17563. order: "perGrammar",
  17564. status: "standard",
  17565. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-left"
  17566. },
  17567. "scroll-margin-right": {
  17568. syntax: "<length>",
  17569. media: "visual",
  17570. inherited: false,
  17571. animationType: "byComputedValueType",
  17572. percentages: "no",
  17573. groups: [
  17574. "CSS Scroll Snap"
  17575. ],
  17576. initial: "0",
  17577. appliesto: "allElements",
  17578. computed: "asSpecified",
  17579. order: "perGrammar",
  17580. status: "standard",
  17581. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-right"
  17582. },
  17583. "scroll-margin-top": {
  17584. syntax: "<length>",
  17585. media: "visual",
  17586. inherited: false,
  17587. animationType: "byComputedValueType",
  17588. percentages: "no",
  17589. groups: [
  17590. "CSS Scroll Snap"
  17591. ],
  17592. initial: "0",
  17593. appliesto: "allElements",
  17594. computed: "asSpecified",
  17595. order: "perGrammar",
  17596. status: "standard",
  17597. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-top"
  17598. },
  17599. "scroll-padding": {
  17600. syntax: "[ auto | <length-percentage> ]{1,4}",
  17601. media: "visual",
  17602. inherited: false,
  17603. animationType: "byComputedValueType",
  17604. percentages: "relativeToTheScrollContainersScrollport",
  17605. groups: [
  17606. "CSS Scroll Snap"
  17607. ],
  17608. initial: "auto",
  17609. appliesto: "scrollContainers",
  17610. computed: "asSpecified",
  17611. order: "perGrammar",
  17612. status: "standard",
  17613. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding"
  17614. },
  17615. "scroll-padding-block": {
  17616. syntax: "[ auto | <length-percentage> ]{1,2}",
  17617. media: "visual",
  17618. inherited: false,
  17619. animationType: "byComputedValueType",
  17620. percentages: "relativeToTheScrollContainersScrollport",
  17621. groups: [
  17622. "CSS Scroll Snap"
  17623. ],
  17624. initial: "auto",
  17625. appliesto: "scrollContainers",
  17626. computed: "asSpecified",
  17627. order: "perGrammar",
  17628. status: "standard",
  17629. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block"
  17630. },
  17631. "scroll-padding-block-start": {
  17632. syntax: "auto | <length-percentage>",
  17633. media: "visual",
  17634. inherited: false,
  17635. animationType: "byComputedValueType",
  17636. percentages: "relativeToTheScrollContainersScrollport",
  17637. groups: [
  17638. "CSS Scroll Snap"
  17639. ],
  17640. initial: "auto",
  17641. appliesto: "scrollContainers",
  17642. computed: "asSpecified",
  17643. order: "perGrammar",
  17644. status: "standard",
  17645. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-start"
  17646. },
  17647. "scroll-padding-block-end": {
  17648. syntax: "auto | <length-percentage>",
  17649. media: "visual",
  17650. inherited: false,
  17651. animationType: "byComputedValueType",
  17652. percentages: "relativeToTheScrollContainersScrollport",
  17653. groups: [
  17654. "CSS Scroll Snap"
  17655. ],
  17656. initial: "auto",
  17657. appliesto: "scrollContainers",
  17658. computed: "asSpecified",
  17659. order: "perGrammar",
  17660. status: "standard",
  17661. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-end"
  17662. },
  17663. "scroll-padding-bottom": {
  17664. syntax: "auto | <length-percentage>",
  17665. media: "visual",
  17666. inherited: false,
  17667. animationType: "byComputedValueType",
  17668. percentages: "relativeToTheScrollContainersScrollport",
  17669. groups: [
  17670. "CSS Scroll Snap"
  17671. ],
  17672. initial: "auto",
  17673. appliesto: "scrollContainers",
  17674. computed: "asSpecified",
  17675. order: "perGrammar",
  17676. status: "standard",
  17677. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-bottom"
  17678. },
  17679. "scroll-padding-inline": {
  17680. syntax: "[ auto | <length-percentage> ]{1,2}",
  17681. media: "visual",
  17682. inherited: false,
  17683. animationType: "byComputedValueType",
  17684. percentages: "relativeToTheScrollContainersScrollport",
  17685. groups: [
  17686. "CSS Scroll Snap"
  17687. ],
  17688. initial: "auto",
  17689. appliesto: "scrollContainers",
  17690. computed: "asSpecified",
  17691. order: "perGrammar",
  17692. status: "standard",
  17693. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline"
  17694. },
  17695. "scroll-padding-inline-start": {
  17696. syntax: "auto | <length-percentage>",
  17697. media: "visual",
  17698. inherited: false,
  17699. animationType: "byComputedValueType",
  17700. percentages: "relativeToTheScrollContainersScrollport",
  17701. groups: [
  17702. "CSS Scroll Snap"
  17703. ],
  17704. initial: "auto",
  17705. appliesto: "scrollContainers",
  17706. computed: "asSpecified",
  17707. order: "perGrammar",
  17708. status: "standard",
  17709. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-start"
  17710. },
  17711. "scroll-padding-inline-end": {
  17712. syntax: "auto | <length-percentage>",
  17713. media: "visual",
  17714. inherited: false,
  17715. animationType: "byComputedValueType",
  17716. percentages: "relativeToTheScrollContainersScrollport",
  17717. groups: [
  17718. "CSS Scroll Snap"
  17719. ],
  17720. initial: "auto",
  17721. appliesto: "scrollContainers",
  17722. computed: "asSpecified",
  17723. order: "perGrammar",
  17724. status: "standard",
  17725. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-end"
  17726. },
  17727. "scroll-padding-left": {
  17728. syntax: "auto | <length-percentage>",
  17729. media: "visual",
  17730. inherited: false,
  17731. animationType: "byComputedValueType",
  17732. percentages: "relativeToTheScrollContainersScrollport",
  17733. groups: [
  17734. "CSS Scroll Snap"
  17735. ],
  17736. initial: "auto",
  17737. appliesto: "scrollContainers",
  17738. computed: "asSpecified",
  17739. order: "perGrammar",
  17740. status: "standard",
  17741. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-left"
  17742. },
  17743. "scroll-padding-right": {
  17744. syntax: "auto | <length-percentage>",
  17745. media: "visual",
  17746. inherited: false,
  17747. animationType: "byComputedValueType",
  17748. percentages: "relativeToTheScrollContainersScrollport",
  17749. groups: [
  17750. "CSS Scroll Snap"
  17751. ],
  17752. initial: "auto",
  17753. appliesto: "scrollContainers",
  17754. computed: "asSpecified",
  17755. order: "perGrammar",
  17756. status: "standard",
  17757. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-right"
  17758. },
  17759. "scroll-padding-top": {
  17760. syntax: "auto | <length-percentage>",
  17761. media: "visual",
  17762. inherited: false,
  17763. animationType: "byComputedValueType",
  17764. percentages: "relativeToTheScrollContainersScrollport",
  17765. groups: [
  17766. "CSS Scroll Snap"
  17767. ],
  17768. initial: "auto",
  17769. appliesto: "scrollContainers",
  17770. computed: "asSpecified",
  17771. order: "perGrammar",
  17772. status: "standard",
  17773. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-top"
  17774. },
  17775. "scroll-snap-align": {
  17776. syntax: "[ none | start | end | center ]{1,2}",
  17777. media: "visual",
  17778. inherited: false,
  17779. animationType: "discrete",
  17780. percentages: "no",
  17781. groups: [
  17782. "CSS Scroll Snap"
  17783. ],
  17784. initial: "none",
  17785. appliesto: "allElements",
  17786. computed: "asSpecified",
  17787. order: "perGrammar",
  17788. status: "standard",
  17789. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-align"
  17790. },
  17791. "scroll-snap-coordinate": {
  17792. syntax: "none | <position>#",
  17793. media: "interactive",
  17794. inherited: false,
  17795. animationType: "position",
  17796. percentages: "referToBorderBox",
  17797. groups: [
  17798. "CSS Scroll Snap"
  17799. ],
  17800. initial: "none",
  17801. appliesto: "allElements",
  17802. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17803. order: "uniqueOrder",
  17804. status: "obsolete",
  17805. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-coordinate"
  17806. },
  17807. "scroll-snap-destination": {
  17808. syntax: "<position>",
  17809. media: "interactive",
  17810. inherited: false,
  17811. animationType: "position",
  17812. percentages: "relativeToScrollContainerPaddingBoxAxis",
  17813. groups: [
  17814. "CSS Scroll Snap"
  17815. ],
  17816. initial: "0px 0px",
  17817. appliesto: "scrollContainers",
  17818. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17819. order: "uniqueOrder",
  17820. status: "obsolete",
  17821. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-destination"
  17822. },
  17823. "scroll-snap-points-x": {
  17824. syntax: "none | repeat( <length-percentage> )",
  17825. media: "interactive",
  17826. inherited: false,
  17827. animationType: "discrete",
  17828. percentages: "relativeToScrollContainerPaddingBoxAxis",
  17829. groups: [
  17830. "CSS Scroll Snap"
  17831. ],
  17832. initial: "none",
  17833. appliesto: "scrollContainers",
  17834. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17835. order: "uniqueOrder",
  17836. status: "obsolete",
  17837. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-points-x"
  17838. },
  17839. "scroll-snap-points-y": {
  17840. syntax: "none | repeat( <length-percentage> )",
  17841. media: "interactive",
  17842. inherited: false,
  17843. animationType: "discrete",
  17844. percentages: "relativeToScrollContainerPaddingBoxAxis",
  17845. groups: [
  17846. "CSS Scroll Snap"
  17847. ],
  17848. initial: "none",
  17849. appliesto: "scrollContainers",
  17850. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17851. order: "uniqueOrder",
  17852. status: "obsolete",
  17853. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-points-y"
  17854. },
  17855. "scroll-snap-stop": {
  17856. syntax: "normal | always",
  17857. media: "visual",
  17858. inherited: false,
  17859. animationType: "discrete",
  17860. percentages: "no",
  17861. groups: [
  17862. "CSS Scroll Snap"
  17863. ],
  17864. initial: "normal",
  17865. appliesto: "allElements",
  17866. computed: "asSpecified",
  17867. order: "perGrammar",
  17868. status: "standard",
  17869. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-stop"
  17870. },
  17871. "scroll-snap-type": {
  17872. syntax: "none | [ x | y | block | inline | both ] [ mandatory | proximity ]?",
  17873. media: "interactive",
  17874. inherited: false,
  17875. animationType: "discrete",
  17876. percentages: "no",
  17877. groups: [
  17878. "CSS Scroll Snap"
  17879. ],
  17880. initial: "none",
  17881. appliesto: "allElements",
  17882. computed: "asSpecified",
  17883. order: "uniqueOrder",
  17884. status: "standard",
  17885. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type"
  17886. },
  17887. "scroll-snap-type-x": {
  17888. syntax: "none | mandatory | proximity",
  17889. media: "interactive",
  17890. inherited: false,
  17891. animationType: "discrete",
  17892. percentages: "no",
  17893. groups: [
  17894. "CSS Scroll Snap"
  17895. ],
  17896. initial: "none",
  17897. appliesto: "scrollContainers",
  17898. computed: "asSpecified",
  17899. order: "uniqueOrder",
  17900. status: "obsolete",
  17901. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type-x"
  17902. },
  17903. "scroll-snap-type-y": {
  17904. syntax: "none | mandatory | proximity",
  17905. media: "interactive",
  17906. inherited: false,
  17907. animationType: "discrete",
  17908. percentages: "no",
  17909. groups: [
  17910. "CSS Scroll Snap"
  17911. ],
  17912. initial: "none",
  17913. appliesto: "scrollContainers",
  17914. computed: "asSpecified",
  17915. order: "uniqueOrder",
  17916. status: "obsolete",
  17917. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type-y"
  17918. },
  17919. "shape-image-threshold": {
  17920. syntax: "<alpha-value>",
  17921. media: "visual",
  17922. inherited: false,
  17923. animationType: "number",
  17924. percentages: "no",
  17925. groups: [
  17926. "CSS Shapes"
  17927. ],
  17928. initial: "0.0",
  17929. appliesto: "floats",
  17930. computed: "specifiedValueNumberClipped0To1",
  17931. order: "uniqueOrder",
  17932. status: "standard",
  17933. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/shape-image-threshold"
  17934. },
  17935. "shape-margin": {
  17936. syntax: "<length-percentage>",
  17937. media: "visual",
  17938. inherited: false,
  17939. animationType: "lpc",
  17940. percentages: "referToWidthOfContainingBlock",
  17941. groups: [
  17942. "CSS Shapes"
  17943. ],
  17944. initial: "0",
  17945. appliesto: "floats",
  17946. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17947. order: "uniqueOrder",
  17948. status: "standard",
  17949. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/shape-margin"
  17950. },
  17951. "shape-outside": {
  17952. syntax: "none | <shape-box> || <basic-shape> | <image>",
  17953. media: "visual",
  17954. inherited: false,
  17955. animationType: "basicShapeOtherwiseNo",
  17956. percentages: "no",
  17957. groups: [
  17958. "CSS Shapes"
  17959. ],
  17960. initial: "none",
  17961. appliesto: "floats",
  17962. computed: "asDefinedForBasicShapeWithAbsoluteURIOtherwiseAsSpecified",
  17963. order: "uniqueOrder",
  17964. status: "standard",
  17965. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/shape-outside"
  17966. },
  17967. "tab-size": {
  17968. syntax: "<integer> | <length>",
  17969. media: "visual",
  17970. inherited: true,
  17971. animationType: "length",
  17972. percentages: "no",
  17973. groups: [
  17974. "CSS Text"
  17975. ],
  17976. initial: "8",
  17977. appliesto: "blockContainers",
  17978. computed: "specifiedIntegerOrAbsoluteLength",
  17979. order: "uniqueOrder",
  17980. status: "standard",
  17981. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/tab-size"
  17982. },
  17983. "table-layout": {
  17984. syntax: "auto | fixed",
  17985. media: "visual",
  17986. inherited: false,
  17987. animationType: "discrete",
  17988. percentages: "no",
  17989. groups: [
  17990. "CSS Table"
  17991. ],
  17992. initial: "auto",
  17993. appliesto: "tableElements",
  17994. computed: "asSpecified",
  17995. order: "uniqueOrder",
  17996. status: "standard",
  17997. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/table-layout"
  17998. },
  17999. "text-align": {
  18000. syntax: "start | end | left | right | center | justify | match-parent",
  18001. media: "visual",
  18002. inherited: true,
  18003. animationType: "discrete",
  18004. percentages: "no",
  18005. groups: [
  18006. "CSS Text"
  18007. ],
  18008. initial: "startOrNamelessValueIfLTRRightIfRTL",
  18009. appliesto: "blockContainers",
  18010. computed: "asSpecifiedExceptMatchParent",
  18011. order: "orderOfAppearance",
  18012. alsoAppliesTo: [
  18013. "::placeholder"
  18014. ],
  18015. status: "standard",
  18016. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-align"
  18017. },
  18018. "text-align-last": {
  18019. syntax: "auto | start | end | left | right | center | justify",
  18020. media: "visual",
  18021. inherited: true,
  18022. animationType: "discrete",
  18023. percentages: "no",
  18024. groups: [
  18025. "CSS Text"
  18026. ],
  18027. initial: "auto",
  18028. appliesto: "blockContainers",
  18029. computed: "asSpecified",
  18030. order: "uniqueOrder",
  18031. status: "standard",
  18032. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-align-last"
  18033. },
  18034. "text-combine-upright": {
  18035. syntax: "none | all | [ digits <integer>? ]",
  18036. media: "visual",
  18037. inherited: true,
  18038. animationType: "discrete",
  18039. percentages: "no",
  18040. groups: [
  18041. "CSS Writing Modes"
  18042. ],
  18043. initial: "none",
  18044. appliesto: "nonReplacedInlineElements",
  18045. computed: "keywordPlusIntegerIfDigits",
  18046. order: "uniqueOrder",
  18047. status: "standard",
  18048. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-combine-upright"
  18049. },
  18050. "text-decoration": {
  18051. syntax: "<'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> || <'text-decoration-thickness'>",
  18052. media: "visual",
  18053. inherited: false,
  18054. animationType: [
  18055. "text-decoration-color",
  18056. "text-decoration-style",
  18057. "text-decoration-line",
  18058. "text-decoration-thickness"
  18059. ],
  18060. percentages: "no",
  18061. groups: [
  18062. "CSS Text Decoration"
  18063. ],
  18064. initial: [
  18065. "text-decoration-color",
  18066. "text-decoration-style",
  18067. "text-decoration-line"
  18068. ],
  18069. appliesto: "allElements",
  18070. computed: [
  18071. "text-decoration-line",
  18072. "text-decoration-style",
  18073. "text-decoration-color",
  18074. "text-decoration-thickness"
  18075. ],
  18076. order: "orderOfAppearance",
  18077. alsoAppliesTo: [
  18078. "::first-letter",
  18079. "::first-line",
  18080. "::placeholder"
  18081. ],
  18082. status: "standard",
  18083. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration"
  18084. },
  18085. "text-decoration-color": {
  18086. syntax: "<color>",
  18087. media: "visual",
  18088. inherited: false,
  18089. animationType: "color",
  18090. percentages: "no",
  18091. groups: [
  18092. "CSS Text Decoration"
  18093. ],
  18094. initial: "currentcolor",
  18095. appliesto: "allElements",
  18096. computed: "computedColor",
  18097. order: "uniqueOrder",
  18098. alsoAppliesTo: [
  18099. "::first-letter",
  18100. "::first-line",
  18101. "::placeholder"
  18102. ],
  18103. status: "standard",
  18104. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-color"
  18105. },
  18106. "text-decoration-line": {
  18107. syntax: "none | [ underline || overline || line-through || blink ] | spelling-error | grammar-error",
  18108. media: "visual",
  18109. inherited: false,
  18110. animationType: "discrete",
  18111. percentages: "no",
  18112. groups: [
  18113. "CSS Text Decoration"
  18114. ],
  18115. initial: "none",
  18116. appliesto: "allElements",
  18117. computed: "asSpecified",
  18118. order: "orderOfAppearance",
  18119. alsoAppliesTo: [
  18120. "::first-letter",
  18121. "::first-line",
  18122. "::placeholder"
  18123. ],
  18124. status: "standard",
  18125. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-line"
  18126. },
  18127. "text-decoration-skip": {
  18128. syntax: "none | [ objects || [ spaces | [ leading-spaces || trailing-spaces ] ] || edges || box-decoration ]",
  18129. media: "visual",
  18130. inherited: true,
  18131. animationType: "discrete",
  18132. percentages: "no",
  18133. groups: [
  18134. "CSS Text Decoration"
  18135. ],
  18136. initial: "objects",
  18137. appliesto: "allElements",
  18138. computed: "asSpecified",
  18139. order: "orderOfAppearance",
  18140. status: "experimental",
  18141. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip"
  18142. },
  18143. "text-decoration-skip-ink": {
  18144. syntax: "auto | none",
  18145. media: "visual",
  18146. inherited: true,
  18147. animationType: "discrete",
  18148. percentages: "no",
  18149. groups: [
  18150. "CSS Text Decoration"
  18151. ],
  18152. initial: "auto",
  18153. appliesto: "allElements",
  18154. computed: "asSpecified",
  18155. order: "orderOfAppearance",
  18156. status: "experimental",
  18157. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip-ink"
  18158. },
  18159. "text-decoration-style": {
  18160. syntax: "solid | double | dotted | dashed | wavy",
  18161. media: "visual",
  18162. inherited: false,
  18163. animationType: "discrete",
  18164. percentages: "no",
  18165. groups: [
  18166. "CSS Text Decoration"
  18167. ],
  18168. initial: "solid",
  18169. appliesto: "allElements",
  18170. computed: "asSpecified",
  18171. order: "uniqueOrder",
  18172. alsoAppliesTo: [
  18173. "::first-letter",
  18174. "::first-line",
  18175. "::placeholder"
  18176. ],
  18177. status: "standard",
  18178. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-style"
  18179. },
  18180. "text-decoration-thickness": {
  18181. syntax: "auto | from-font | <length>",
  18182. media: "visual",
  18183. inherited: false,
  18184. animationType: "byComputedValueType",
  18185. percentages: "no",
  18186. groups: [
  18187. "CSS Text Decoration"
  18188. ],
  18189. initial: "auto",
  18190. appliesto: "allElements",
  18191. computed: "asSpecified",
  18192. order: "uniqueOrder",
  18193. alsoAppliesTo: [
  18194. "::first-letter",
  18195. "::first-line",
  18196. "::placeholder"
  18197. ],
  18198. status: "standard",
  18199. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-thickness"
  18200. },
  18201. "text-emphasis": {
  18202. syntax: "<'text-emphasis-style'> || <'text-emphasis-color'>",
  18203. media: "visual",
  18204. inherited: false,
  18205. animationType: [
  18206. "text-emphasis-color",
  18207. "text-emphasis-style"
  18208. ],
  18209. percentages: "no",
  18210. groups: [
  18211. "CSS Text Decoration"
  18212. ],
  18213. initial: [
  18214. "text-emphasis-style",
  18215. "text-emphasis-color"
  18216. ],
  18217. appliesto: "allElements",
  18218. computed: [
  18219. "text-emphasis-style",
  18220. "text-emphasis-color"
  18221. ],
  18222. order: "orderOfAppearance",
  18223. status: "standard",
  18224. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis"
  18225. },
  18226. "text-emphasis-color": {
  18227. syntax: "<color>",
  18228. media: "visual",
  18229. inherited: false,
  18230. animationType: "color",
  18231. percentages: "no",
  18232. groups: [
  18233. "CSS Text Decoration"
  18234. ],
  18235. initial: "currentcolor",
  18236. appliesto: "allElements",
  18237. computed: "computedColor",
  18238. order: "uniqueOrder",
  18239. status: "standard",
  18240. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-color"
  18241. },
  18242. "text-emphasis-position": {
  18243. syntax: "[ over | under ] && [ right | left ]",
  18244. media: "visual",
  18245. inherited: false,
  18246. animationType: "discrete",
  18247. percentages: "no",
  18248. groups: [
  18249. "CSS Text Decoration"
  18250. ],
  18251. initial: "over right",
  18252. appliesto: "allElements",
  18253. computed: "asSpecified",
  18254. order: "uniqueOrder",
  18255. status: "standard",
  18256. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-position"
  18257. },
  18258. "text-emphasis-style": {
  18259. syntax: "none | [ [ filled | open ] || [ dot | circle | double-circle | triangle | sesame ] ] | <string>",
  18260. media: "visual",
  18261. inherited: false,
  18262. animationType: "discrete",
  18263. percentages: "no",
  18264. groups: [
  18265. "CSS Text Decoration"
  18266. ],
  18267. initial: "none",
  18268. appliesto: "allElements",
  18269. computed: "asSpecified",
  18270. order: "uniqueOrder",
  18271. status: "standard",
  18272. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-style"
  18273. },
  18274. "text-indent": {
  18275. syntax: "<length-percentage> && hanging? && each-line?",
  18276. media: "visual",
  18277. inherited: true,
  18278. animationType: "lpc",
  18279. percentages: "referToWidthOfContainingBlock",
  18280. groups: [
  18281. "CSS Text"
  18282. ],
  18283. initial: "0",
  18284. appliesto: "blockContainers",
  18285. computed: "percentageOrAbsoluteLengthPlusKeywords",
  18286. order: "lengthOrPercentageBeforeKeywords",
  18287. status: "standard",
  18288. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-indent"
  18289. },
  18290. "text-justify": {
  18291. syntax: "auto | inter-character | inter-word | none",
  18292. media: "visual",
  18293. inherited: true,
  18294. animationType: "discrete",
  18295. percentages: "no",
  18296. groups: [
  18297. "CSS Text"
  18298. ],
  18299. initial: "auto",
  18300. appliesto: "inlineLevelAndTableCellElements",
  18301. computed: "asSpecified",
  18302. order: "uniqueOrder",
  18303. status: "standard",
  18304. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-justify"
  18305. },
  18306. "text-orientation": {
  18307. syntax: "mixed | upright | sideways",
  18308. media: "visual",
  18309. inherited: true,
  18310. animationType: "discrete",
  18311. percentages: "no",
  18312. groups: [
  18313. "CSS Writing Modes"
  18314. ],
  18315. initial: "mixed",
  18316. appliesto: "allElementsExceptTableRowGroupsRowsColumnGroupsAndColumns",
  18317. computed: "asSpecified",
  18318. order: "uniqueOrder",
  18319. status: "standard",
  18320. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-orientation"
  18321. },
  18322. "text-overflow": {
  18323. syntax: "[ clip | ellipsis | <string> ]{1,2}",
  18324. media: "visual",
  18325. inherited: false,
  18326. animationType: "discrete",
  18327. percentages: "no",
  18328. groups: [
  18329. "CSS Basic User Interface"
  18330. ],
  18331. initial: "clip",
  18332. appliesto: "blockContainerElements",
  18333. computed: "asSpecified",
  18334. order: "uniqueOrder",
  18335. alsoAppliesTo: [
  18336. "::placeholder"
  18337. ],
  18338. status: "standard",
  18339. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-overflow"
  18340. },
  18341. "text-rendering": {
  18342. syntax: "auto | optimizeSpeed | optimizeLegibility | geometricPrecision",
  18343. media: "visual",
  18344. inherited: true,
  18345. animationType: "discrete",
  18346. percentages: "no",
  18347. groups: [
  18348. "CSS Miscellaneous"
  18349. ],
  18350. initial: "auto",
  18351. appliesto: "textElements",
  18352. computed: "asSpecified",
  18353. order: "uniqueOrder",
  18354. status: "standard",
  18355. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-rendering"
  18356. },
  18357. "text-shadow": {
  18358. syntax: "none | <shadow-t>#",
  18359. media: "visual",
  18360. inherited: true,
  18361. animationType: "shadowList",
  18362. percentages: "no",
  18363. groups: [
  18364. "CSS Text Decoration"
  18365. ],
  18366. initial: "none",
  18367. appliesto: "allElements",
  18368. computed: "colorPlusThreeAbsoluteLengths",
  18369. order: "uniqueOrder",
  18370. alsoAppliesTo: [
  18371. "::first-letter",
  18372. "::first-line",
  18373. "::placeholder"
  18374. ],
  18375. status: "standard",
  18376. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-shadow"
  18377. },
  18378. "text-size-adjust": {
  18379. syntax: "none | auto | <percentage>",
  18380. media: "visual",
  18381. inherited: true,
  18382. animationType: "discrete",
  18383. percentages: "referToSizeOfFont",
  18384. groups: [
  18385. "CSS Text"
  18386. ],
  18387. initial: "autoForSmartphoneBrowsersSupportingInflation",
  18388. appliesto: "allElements",
  18389. computed: "asSpecified",
  18390. order: "uniqueOrder",
  18391. status: "experimental",
  18392. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-size-adjust"
  18393. },
  18394. "text-transform": {
  18395. syntax: "none | capitalize | uppercase | lowercase | full-width | full-size-kana",
  18396. media: "visual",
  18397. inherited: true,
  18398. animationType: "discrete",
  18399. percentages: "no",
  18400. groups: [
  18401. "CSS Text"
  18402. ],
  18403. initial: "none",
  18404. appliesto: "allElements",
  18405. computed: "asSpecified",
  18406. order: "uniqueOrder",
  18407. alsoAppliesTo: [
  18408. "::first-letter",
  18409. "::first-line",
  18410. "::placeholder"
  18411. ],
  18412. status: "standard",
  18413. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-transform"
  18414. },
  18415. "text-underline-offset": {
  18416. syntax: "auto | from-font | <length>",
  18417. media: "visual",
  18418. inherited: true,
  18419. animationType: "byComputedValueType",
  18420. percentages: "no",
  18421. groups: [
  18422. "CSS Text Decoration"
  18423. ],
  18424. initial: "auto",
  18425. appliesto: "allElements",
  18426. computed: "asSpecified",
  18427. order: "uniqueOrder",
  18428. alsoAppliesTo: [
  18429. "::first-letter",
  18430. "::first-line",
  18431. "::placeholder"
  18432. ],
  18433. status: "standard",
  18434. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-underline-offset"
  18435. },
  18436. "text-underline-position": {
  18437. syntax: "auto | [ under || [ left | right ] ]",
  18438. media: "visual",
  18439. inherited: true,
  18440. animationType: "discrete",
  18441. percentages: "no",
  18442. groups: [
  18443. "CSS Text Decoration"
  18444. ],
  18445. initial: "auto",
  18446. appliesto: "allElements",
  18447. computed: "asSpecified",
  18448. order: "orderOfAppearance",
  18449. status: "standard",
  18450. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-underline-position"
  18451. },
  18452. top: top,
  18453. "touch-action": {
  18454. syntax: "auto | none | [ [ pan-x | pan-left | pan-right ] || [ pan-y | pan-up | pan-down ] || pinch-zoom ] | manipulation",
  18455. media: "visual",
  18456. inherited: false,
  18457. animationType: "discrete",
  18458. percentages: "no",
  18459. groups: [
  18460. "Pointer Events"
  18461. ],
  18462. initial: "auto",
  18463. appliesto: "allElementsExceptNonReplacedInlineElementsTableRowsColumnsRowColumnGroups",
  18464. computed: "asSpecified",
  18465. order: "uniqueOrder",
  18466. status: "standard",
  18467. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/touch-action"
  18468. },
  18469. transform: transform,
  18470. "transform-box": {
  18471. syntax: "border-box | fill-box | view-box",
  18472. media: "visual",
  18473. inherited: false,
  18474. animationType: "discrete",
  18475. percentages: "no",
  18476. groups: [
  18477. "CSS Transforms"
  18478. ],
  18479. initial: "border-box ",
  18480. appliesto: "transformableElements",
  18481. computed: "asSpecified",
  18482. order: "uniqueOrder",
  18483. status: "standard",
  18484. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-box"
  18485. },
  18486. "transform-origin": {
  18487. syntax: "[ <length-percentage> | left | center | right | top | bottom ] | [ [ <length-percentage> | left | center | right ] && [ <length-percentage> | top | center | bottom ] ] <length>?",
  18488. media: "visual",
  18489. inherited: false,
  18490. animationType: "simpleListOfLpc",
  18491. percentages: "referToSizeOfBoundingBox",
  18492. groups: [
  18493. "CSS Transforms"
  18494. ],
  18495. initial: "50% 50% 0",
  18496. appliesto: "transformableElements",
  18497. computed: "forLengthAbsoluteValueOtherwisePercentage",
  18498. order: "oneOrTwoValuesLengthAbsoluteKeywordsPercentages",
  18499. status: "standard",
  18500. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-origin"
  18501. },
  18502. "transform-style": {
  18503. syntax: "flat | preserve-3d",
  18504. media: "visual",
  18505. inherited: false,
  18506. animationType: "discrete",
  18507. percentages: "no",
  18508. groups: [
  18509. "CSS Transforms"
  18510. ],
  18511. initial: "flat",
  18512. appliesto: "transformableElements",
  18513. computed: "asSpecified",
  18514. order: "uniqueOrder",
  18515. stacking: true,
  18516. status: "standard",
  18517. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-style"
  18518. },
  18519. transition: transition,
  18520. "transition-delay": {
  18521. syntax: "<time>#",
  18522. media: "interactive",
  18523. inherited: false,
  18524. animationType: "discrete",
  18525. percentages: "no",
  18526. groups: [
  18527. "CSS Transitions"
  18528. ],
  18529. initial: "0s",
  18530. appliesto: "allElementsAndPseudos",
  18531. computed: "asSpecified",
  18532. order: "uniqueOrder",
  18533. status: "standard",
  18534. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-delay"
  18535. },
  18536. "transition-duration": {
  18537. syntax: "<time>#",
  18538. media: "interactive",
  18539. inherited: false,
  18540. animationType: "discrete",
  18541. percentages: "no",
  18542. groups: [
  18543. "CSS Transitions"
  18544. ],
  18545. initial: "0s",
  18546. appliesto: "allElementsAndPseudos",
  18547. computed: "asSpecified",
  18548. order: "uniqueOrder",
  18549. status: "standard",
  18550. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-duration"
  18551. },
  18552. "transition-property": {
  18553. syntax: "none | <single-transition-property>#",
  18554. media: "visual",
  18555. inherited: false,
  18556. animationType: "discrete",
  18557. percentages: "no",
  18558. groups: [
  18559. "CSS Transitions"
  18560. ],
  18561. initial: "all",
  18562. appliesto: "allElementsAndPseudos",
  18563. computed: "asSpecified",
  18564. order: "uniqueOrder",
  18565. status: "standard",
  18566. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-property"
  18567. },
  18568. "transition-timing-function": {
  18569. syntax: "<timing-function>#",
  18570. media: "interactive",
  18571. inherited: false,
  18572. animationType: "discrete",
  18573. percentages: "no",
  18574. groups: [
  18575. "CSS Transitions"
  18576. ],
  18577. initial: "ease",
  18578. appliesto: "allElementsAndPseudos",
  18579. computed: "asSpecified",
  18580. order: "uniqueOrder",
  18581. status: "standard",
  18582. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-timing-function"
  18583. },
  18584. translate: translate,
  18585. "unicode-bidi": {
  18586. syntax: "normal | embed | isolate | bidi-override | isolate-override | plaintext",
  18587. media: "visual",
  18588. inherited: false,
  18589. animationType: "discrete",
  18590. percentages: "no",
  18591. groups: [
  18592. "CSS Writing Modes"
  18593. ],
  18594. initial: "normal",
  18595. appliesto: "allElementsSomeValuesNoEffectOnNonInlineElements",
  18596. computed: "asSpecified",
  18597. order: "uniqueOrder",
  18598. status: "standard",
  18599. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/unicode-bidi"
  18600. },
  18601. "user-select": {
  18602. syntax: "auto | text | none | contain | all",
  18603. media: "visual",
  18604. inherited: false,
  18605. animationType: "discrete",
  18606. percentages: "no",
  18607. groups: [
  18608. "CSS Basic User Interface"
  18609. ],
  18610. initial: "auto",
  18611. appliesto: "allElements",
  18612. computed: "asSpecified",
  18613. order: "uniqueOrder",
  18614. status: "nonstandard",
  18615. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/user-select"
  18616. },
  18617. "vertical-align": {
  18618. syntax: "baseline | sub | super | text-top | text-bottom | middle | top | bottom | <percentage> | <length>",
  18619. media: "visual",
  18620. inherited: false,
  18621. animationType: "length",
  18622. percentages: "referToLineHeight",
  18623. groups: [
  18624. "CSS Table"
  18625. ],
  18626. initial: "baseline",
  18627. appliesto: "inlineLevelAndTableCellElements",
  18628. computed: "absoluteLengthOrKeyword",
  18629. order: "uniqueOrder",
  18630. alsoAppliesTo: [
  18631. "::first-letter",
  18632. "::first-line",
  18633. "::placeholder"
  18634. ],
  18635. status: "standard",
  18636. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/vertical-align"
  18637. },
  18638. visibility: visibility,
  18639. "white-space": {
  18640. syntax: "normal | pre | nowrap | pre-wrap | pre-line | break-spaces",
  18641. media: "visual",
  18642. inherited: true,
  18643. animationType: "discrete",
  18644. percentages: "no",
  18645. groups: [
  18646. "CSS Text"
  18647. ],
  18648. initial: "normal",
  18649. appliesto: "allElements",
  18650. computed: "asSpecified",
  18651. order: "uniqueOrder",
  18652. status: "standard",
  18653. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/white-space"
  18654. },
  18655. widows: widows,
  18656. width: width,
  18657. "will-change": {
  18658. syntax: "auto | <animateable-feature>#",
  18659. media: "all",
  18660. inherited: false,
  18661. animationType: "discrete",
  18662. percentages: "no",
  18663. groups: [
  18664. "CSS Will Change"
  18665. ],
  18666. initial: "auto",
  18667. appliesto: "allElements",
  18668. computed: "asSpecified",
  18669. order: "uniqueOrder",
  18670. status: "standard",
  18671. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/will-change"
  18672. },
  18673. "word-break": {
  18674. syntax: "normal | break-all | keep-all | break-word",
  18675. media: "visual",
  18676. inherited: true,
  18677. animationType: "discrete",
  18678. percentages: "no",
  18679. groups: [
  18680. "CSS Text"
  18681. ],
  18682. initial: "normal",
  18683. appliesto: "allElements",
  18684. computed: "asSpecified",
  18685. order: "uniqueOrder",
  18686. status: "standard",
  18687. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/word-break"
  18688. },
  18689. "word-spacing": {
  18690. syntax: "normal | <length-percentage>",
  18691. media: "visual",
  18692. inherited: true,
  18693. animationType: "length",
  18694. percentages: "referToWidthOfAffectedGlyph",
  18695. groups: [
  18696. "CSS Text"
  18697. ],
  18698. initial: "normal",
  18699. appliesto: "allElements",
  18700. computed: "optimumMinAndMaxValueOfAbsoluteLengthPercentageOrNormal",
  18701. order: "uniqueOrder",
  18702. alsoAppliesTo: [
  18703. "::first-letter",
  18704. "::first-line",
  18705. "::placeholder"
  18706. ],
  18707. status: "standard",
  18708. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/word-spacing"
  18709. },
  18710. "word-wrap": {
  18711. syntax: "normal | break-word",
  18712. media: "visual",
  18713. inherited: true,
  18714. animationType: "discrete",
  18715. percentages: "no",
  18716. groups: [
  18717. "CSS Text"
  18718. ],
  18719. initial: "normal",
  18720. appliesto: "nonReplacedInlineElements",
  18721. computed: "asSpecified",
  18722. order: "uniqueOrder",
  18723. status: "standard",
  18724. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-wrap"
  18725. },
  18726. "writing-mode": {
  18727. syntax: "horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr",
  18728. media: "visual",
  18729. inherited: true,
  18730. animationType: "discrete",
  18731. percentages: "no",
  18732. groups: [
  18733. "CSS Writing Modes"
  18734. ],
  18735. initial: "horizontal-tb",
  18736. appliesto: "allElementsExceptTableRowColumnGroupsTableRowsColumns",
  18737. computed: "asSpecified",
  18738. order: "uniqueOrder",
  18739. status: "standard",
  18740. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/writing-mode"
  18741. },
  18742. "z-index": {
  18743. syntax: "auto | <integer>",
  18744. media: "visual",
  18745. inherited: false,
  18746. animationType: "integer",
  18747. percentages: "no",
  18748. groups: [
  18749. "CSS Positioning"
  18750. ],
  18751. initial: "auto",
  18752. appliesto: "positionedElements",
  18753. computed: "asSpecified",
  18754. order: "uniqueOrder",
  18755. stacking: true,
  18756. status: "standard",
  18757. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/z-index"
  18758. },
  18759. zoom: zoom
  18760. };
  18761. var properties$2 = /*#__PURE__*/Object.freeze({
  18762. __proto__: null,
  18763. all: all,
  18764. animation: animation,
  18765. appearance: appearance,
  18766. azimuth: azimuth,
  18767. background: background,
  18768. border: border,
  18769. bottom: bottom,
  18770. clear: clear,
  18771. clip: clip,
  18772. color: color,
  18773. columns: columns,
  18774. contain: contain,
  18775. content: content,
  18776. cursor: cursor,
  18777. direction: direction,
  18778. display: display,
  18779. filter: filter,
  18780. flex: flex,
  18781. float: float,
  18782. font: font,
  18783. gap: gap,
  18784. grid: grid,
  18785. height: height,
  18786. hyphens: hyphens,
  18787. inset: inset,
  18788. isolation: isolation,
  18789. left: left,
  18790. margin: margin,
  18791. mask: mask,
  18792. offset: offset,
  18793. opacity: opacity,
  18794. order: order,
  18795. orphans: orphans,
  18796. outline: outline,
  18797. overflow: overflow,
  18798. padding: padding,
  18799. perspective: perspective,
  18800. position: position,
  18801. quotes: quotes,
  18802. resize: resize,
  18803. right: right,
  18804. rotate: rotate,
  18805. scale: scale,
  18806. top: top,
  18807. transform: transform,
  18808. transition: transition,
  18809. translate: translate,
  18810. visibility: visibility,
  18811. widows: widows,
  18812. width: width,
  18813. zoom: zoom,
  18814. 'default': properties$1
  18815. });
  18816. var attachment = {
  18817. syntax: "scroll | fixed | local"
  18818. };
  18819. var box = {
  18820. syntax: "border-box | padding-box | content-box"
  18821. };
  18822. var color$1 = {
  18823. syntax: "<rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>"
  18824. };
  18825. var combinator = {
  18826. syntax: "'>' | '+' | '~' | [ '||' ]"
  18827. };
  18828. var compat = {
  18829. syntax: "searchfield | textarea | push-button | button-bevel | slider-horizontal | checkbox | radio | square-button | menulist | menulist-button | listbox | meter | progress-bar"
  18830. };
  18831. var gradient = {
  18832. syntax: "<linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()> | <conic-gradient()>"
  18833. };
  18834. var hue = {
  18835. syntax: "<number> | <angle>"
  18836. };
  18837. var image = {
  18838. syntax: "<url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>"
  18839. };
  18840. var nth = {
  18841. syntax: "<an-plus-b> | even | odd"
  18842. };
  18843. var position$1 = {
  18844. syntax: "[ [ left | center | right ] || [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]"
  18845. };
  18846. var quote = {
  18847. syntax: "open-quote | close-quote | no-open-quote | no-close-quote"
  18848. };
  18849. var shadow = {
  18850. syntax: "inset? && <length>{2,4} && <color>?"
  18851. };
  18852. var shape$1 = {
  18853. syntax: "rect(<top>, <right>, <bottom>, <left>)"
  18854. };
  18855. var size = {
  18856. syntax: "closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}"
  18857. };
  18858. var symbol = {
  18859. syntax: "<string> | <image> | <custom-ident>"
  18860. };
  18861. var target = {
  18862. syntax: "<target-counter()> | <target-counters()> | <target-text()>"
  18863. };
  18864. var syntaxes = {
  18865. "absolute-size": {
  18866. syntax: "xx-small | x-small | small | medium | large | x-large | xx-large | xxx-large"
  18867. },
  18868. "alpha-value": {
  18869. syntax: "<number> | <percentage>"
  18870. },
  18871. "angle-percentage": {
  18872. syntax: "<angle> | <percentage>"
  18873. },
  18874. "angular-color-hint": {
  18875. syntax: "<angle-percentage>"
  18876. },
  18877. "angular-color-stop": {
  18878. syntax: "<color> && <color-stop-angle>?"
  18879. },
  18880. "angular-color-stop-list": {
  18881. syntax: "[ <angular-color-stop> [, <angular-color-hint>]? ]# , <angular-color-stop>"
  18882. },
  18883. "animateable-feature": {
  18884. syntax: "scroll-position | contents | <custom-ident>"
  18885. },
  18886. attachment: attachment,
  18887. "attr()": {
  18888. syntax: "attr( <attr-name> <type-or-unit>? [, <attr-fallback> ]? )"
  18889. },
  18890. "attr-matcher": {
  18891. syntax: "[ '~' | '|' | '^' | '$' | '*' ]? '='"
  18892. },
  18893. "attr-modifier": {
  18894. syntax: "i | s"
  18895. },
  18896. "attribute-selector": {
  18897. syntax: "'[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'"
  18898. },
  18899. "auto-repeat": {
  18900. syntax: "repeat( [ auto-fill | auto-fit ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"
  18901. },
  18902. "auto-track-list": {
  18903. syntax: "[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>? <auto-repeat>\n[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>?"
  18904. },
  18905. "baseline-position": {
  18906. syntax: "[ first | last ]? baseline"
  18907. },
  18908. "basic-shape": {
  18909. syntax: "<inset()> | <circle()> | <ellipse()> | <polygon()>"
  18910. },
  18911. "bg-image": {
  18912. syntax: "none | <image>"
  18913. },
  18914. "bg-layer": {
  18915. syntax: "<bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"
  18916. },
  18917. "bg-position": {
  18918. syntax: "[ [ left | center | right | top | bottom | <length-percentage> ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ] | [ center | [ left | right ] <length-percentage>? ] && [ center | [ top | bottom ] <length-percentage>? ] ]"
  18919. },
  18920. "bg-size": {
  18921. syntax: "[ <length-percentage> | auto ]{1,2} | cover | contain"
  18922. },
  18923. "blur()": {
  18924. syntax: "blur( <length> )"
  18925. },
  18926. "blend-mode": {
  18927. syntax: "normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | hard-light | soft-light | difference | exclusion | hue | saturation | color | luminosity"
  18928. },
  18929. box: box,
  18930. "brightness()": {
  18931. syntax: "brightness( <number-percentage> )"
  18932. },
  18933. "calc()": {
  18934. syntax: "calc( <calc-sum> )"
  18935. },
  18936. "calc-sum": {
  18937. syntax: "<calc-product> [ [ '+' | '-' ] <calc-product> ]*"
  18938. },
  18939. "calc-product": {
  18940. syntax: "<calc-value> [ '*' <calc-value> | '/' <number> ]*"
  18941. },
  18942. "calc-value": {
  18943. syntax: "<number> | <dimension> | <percentage> | ( <calc-sum> )"
  18944. },
  18945. "cf-final-image": {
  18946. syntax: "<image> | <color>"
  18947. },
  18948. "cf-mixing-image": {
  18949. syntax: "<percentage>? && <image>"
  18950. },
  18951. "circle()": {
  18952. syntax: "circle( [ <shape-radius> ]? [ at <position> ]? )"
  18953. },
  18954. "clamp()": {
  18955. syntax: "clamp( <calc-sum>#{3} )"
  18956. },
  18957. "class-selector": {
  18958. syntax: "'.' <ident-token>"
  18959. },
  18960. "clip-source": {
  18961. syntax: "<url>"
  18962. },
  18963. color: color$1,
  18964. "color-stop": {
  18965. syntax: "<color-stop-length> | <color-stop-angle>"
  18966. },
  18967. "color-stop-angle": {
  18968. syntax: "<angle-percentage>{1,2}"
  18969. },
  18970. "color-stop-length": {
  18971. syntax: "<length-percentage>{1,2}"
  18972. },
  18973. "color-stop-list": {
  18974. syntax: "[ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop>"
  18975. },
  18976. combinator: combinator,
  18977. "common-lig-values": {
  18978. syntax: "[ common-ligatures | no-common-ligatures ]"
  18979. },
  18980. compat: compat,
  18981. "composite-style": {
  18982. syntax: "clear | copy | source-over | source-in | source-out | source-atop | destination-over | destination-in | destination-out | destination-atop | xor"
  18983. },
  18984. "compositing-operator": {
  18985. syntax: "add | subtract | intersect | exclude"
  18986. },
  18987. "compound-selector": {
  18988. syntax: "[ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!"
  18989. },
  18990. "compound-selector-list": {
  18991. syntax: "<compound-selector>#"
  18992. },
  18993. "complex-selector": {
  18994. syntax: "<compound-selector> [ <combinator>? <compound-selector> ]*"
  18995. },
  18996. "complex-selector-list": {
  18997. syntax: "<complex-selector>#"
  18998. },
  18999. "conic-gradient()": {
  19000. syntax: "conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )"
  19001. },
  19002. "contextual-alt-values": {
  19003. syntax: "[ contextual | no-contextual ]"
  19004. },
  19005. "content-distribution": {
  19006. syntax: "space-between | space-around | space-evenly | stretch"
  19007. },
  19008. "content-list": {
  19009. syntax: "[ <string> | contents | <image> | <quote> | <target> | <leader()> ]+"
  19010. },
  19011. "content-position": {
  19012. syntax: "center | start | end | flex-start | flex-end"
  19013. },
  19014. "content-replacement": {
  19015. syntax: "<image>"
  19016. },
  19017. "contrast()": {
  19018. syntax: "contrast( [ <number-percentage> ] )"
  19019. },
  19020. "counter()": {
  19021. syntax: "counter( <custom-ident>, <counter-style>? )"
  19022. },
  19023. "counter-style": {
  19024. syntax: "<counter-style-name> | symbols()"
  19025. },
  19026. "counter-style-name": {
  19027. syntax: "<custom-ident>"
  19028. },
  19029. "counters()": {
  19030. syntax: "counters( <custom-ident>, <string>, <counter-style>? )"
  19031. },
  19032. "cross-fade()": {
  19033. syntax: "cross-fade( <cf-mixing-image> , <cf-final-image>? )"
  19034. },
  19035. "cubic-bezier-timing-function": {
  19036. syntax: "ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number>, <number>, <number>, <number>)"
  19037. },
  19038. "deprecated-system-color": {
  19039. 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"
  19040. },
  19041. "discretionary-lig-values": {
  19042. syntax: "[ discretionary-ligatures | no-discretionary-ligatures ]"
  19043. },
  19044. "display-box": {
  19045. syntax: "contents | none"
  19046. },
  19047. "display-inside": {
  19048. syntax: "flow | flow-root | table | flex | grid | ruby"
  19049. },
  19050. "display-internal": {
  19051. syntax: "table-row-group | table-header-group | table-footer-group | table-row | table-cell | table-column-group | table-column | table-caption | ruby-base | ruby-text | ruby-base-container | ruby-text-container"
  19052. },
  19053. "display-legacy": {
  19054. syntax: "inline-block | inline-list-item | inline-table | inline-flex | inline-grid"
  19055. },
  19056. "display-listitem": {
  19057. syntax: "<display-outside>? && [ flow | flow-root ]? && list-item"
  19058. },
  19059. "display-outside": {
  19060. syntax: "block | inline | run-in"
  19061. },
  19062. "drop-shadow()": {
  19063. syntax: "drop-shadow( <length>{2,3} <color>? )"
  19064. },
  19065. "east-asian-variant-values": {
  19066. syntax: "[ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]"
  19067. },
  19068. "east-asian-width-values": {
  19069. syntax: "[ full-width | proportional-width ]"
  19070. },
  19071. "element()": {
  19072. syntax: "element( <id-selector> )"
  19073. },
  19074. "ellipse()": {
  19075. syntax: "ellipse( [ <shape-radius>{2} ]? [ at <position> ]? )"
  19076. },
  19077. "ending-shape": {
  19078. syntax: "circle | ellipse"
  19079. },
  19080. "env()": {
  19081. syntax: "env( <custom-ident> , <declaration-value>? )"
  19082. },
  19083. "explicit-track-list": {
  19084. syntax: "[ <line-names>? <track-size> ]+ <line-names>?"
  19085. },
  19086. "family-name": {
  19087. syntax: "<string> | <custom-ident>+"
  19088. },
  19089. "feature-tag-value": {
  19090. syntax: "<string> [ <integer> | on | off ]?"
  19091. },
  19092. "feature-type": {
  19093. syntax: "@stylistic | @historical-forms | @styleset | @character-variant | @swash | @ornaments | @annotation"
  19094. },
  19095. "feature-value-block": {
  19096. syntax: "<feature-type> '{' <feature-value-declaration-list> '}'"
  19097. },
  19098. "feature-value-block-list": {
  19099. syntax: "<feature-value-block>+"
  19100. },
  19101. "feature-value-declaration": {
  19102. syntax: "<custom-ident>: <integer>+;"
  19103. },
  19104. "feature-value-declaration-list": {
  19105. syntax: "<feature-value-declaration>"
  19106. },
  19107. "feature-value-name": {
  19108. syntax: "<custom-ident>"
  19109. },
  19110. "fill-rule": {
  19111. syntax: "nonzero | evenodd"
  19112. },
  19113. "filter-function": {
  19114. syntax: "<blur()> | <brightness()> | <contrast()> | <drop-shadow()> | <grayscale()> | <hue-rotate()> | <invert()> | <opacity()> | <saturate()> | <sepia()>"
  19115. },
  19116. "filter-function-list": {
  19117. syntax: "[ <filter-function> | <url> ]+"
  19118. },
  19119. "final-bg-layer": {
  19120. syntax: "<'background-color'> || <bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"
  19121. },
  19122. "fit-content()": {
  19123. syntax: "fit-content( [ <length> | <percentage> ] )"
  19124. },
  19125. "fixed-breadth": {
  19126. syntax: "<length-percentage>"
  19127. },
  19128. "fixed-repeat": {
  19129. syntax: "repeat( [ <positive-integer> ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"
  19130. },
  19131. "fixed-size": {
  19132. syntax: "<fixed-breadth> | minmax( <fixed-breadth> , <track-breadth> ) | minmax( <inflexible-breadth> , <fixed-breadth> )"
  19133. },
  19134. "font-stretch-absolute": {
  19135. syntax: "normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage>"
  19136. },
  19137. "font-variant-css21": {
  19138. syntax: "[ normal | small-caps ]"
  19139. },
  19140. "font-weight-absolute": {
  19141. syntax: "normal | bold | <number>"
  19142. },
  19143. "frequency-percentage": {
  19144. syntax: "<frequency> | <percentage>"
  19145. },
  19146. "general-enclosed": {
  19147. syntax: "[ <function-token> <any-value> ) ] | ( <ident> <any-value> )"
  19148. },
  19149. "generic-family": {
  19150. syntax: "serif | sans-serif | cursive | fantasy | monospace"
  19151. },
  19152. "generic-name": {
  19153. syntax: "serif | sans-serif | cursive | fantasy | monospace"
  19154. },
  19155. "geometry-box": {
  19156. syntax: "<shape-box> | fill-box | stroke-box | view-box"
  19157. },
  19158. gradient: gradient,
  19159. "grayscale()": {
  19160. syntax: "grayscale( <number-percentage> )"
  19161. },
  19162. "grid-line": {
  19163. syntax: "auto | <custom-ident> | [ <integer> && <custom-ident>? ] | [ span && [ <integer> || <custom-ident> ] ]"
  19164. },
  19165. "historical-lig-values": {
  19166. syntax: "[ historical-ligatures | no-historical-ligatures ]"
  19167. },
  19168. "hsl()": {
  19169. syntax: "hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )"
  19170. },
  19171. "hsla()": {
  19172. syntax: "hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )"
  19173. },
  19174. hue: hue,
  19175. "hue-rotate()": {
  19176. syntax: "hue-rotate( <angle> )"
  19177. },
  19178. "id-selector": {
  19179. syntax: "<hash-token>"
  19180. },
  19181. image: image,
  19182. "image()": {
  19183. syntax: "image( <image-tags>? [ <image-src>? , <color>? ]! )"
  19184. },
  19185. "image-set()": {
  19186. syntax: "image-set( <image-set-option># )"
  19187. },
  19188. "image-set-option": {
  19189. syntax: "[ <image> | <string> ] <resolution>"
  19190. },
  19191. "image-src": {
  19192. syntax: "<url> | <string>"
  19193. },
  19194. "image-tags": {
  19195. syntax: "ltr | rtl"
  19196. },
  19197. "inflexible-breadth": {
  19198. syntax: "<length> | <percentage> | min-content | max-content | auto"
  19199. },
  19200. "inset()": {
  19201. syntax: "inset( <length-percentage>{1,4} [ round <'border-radius'> ]? )"
  19202. },
  19203. "invert()": {
  19204. syntax: "invert( <number-percentage> )"
  19205. },
  19206. "keyframes-name": {
  19207. syntax: "<custom-ident> | <string>"
  19208. },
  19209. "keyframe-block": {
  19210. syntax: "<keyframe-selector># {\n <declaration-list>\n}"
  19211. },
  19212. "keyframe-block-list": {
  19213. syntax: "<keyframe-block>+"
  19214. },
  19215. "keyframe-selector": {
  19216. syntax: "from | to | <percentage>"
  19217. },
  19218. "leader()": {
  19219. syntax: "leader( <leader-type> )"
  19220. },
  19221. "leader-type": {
  19222. syntax: "dotted | solid | space | <string>"
  19223. },
  19224. "length-percentage": {
  19225. syntax: "<length> | <percentage>"
  19226. },
  19227. "line-names": {
  19228. syntax: "'[' <custom-ident>* ']'"
  19229. },
  19230. "line-name-list": {
  19231. syntax: "[ <line-names> | <name-repeat> ]+"
  19232. },
  19233. "line-style": {
  19234. syntax: "none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset"
  19235. },
  19236. "line-width": {
  19237. syntax: "<length> | thin | medium | thick"
  19238. },
  19239. "linear-color-hint": {
  19240. syntax: "<length-percentage>"
  19241. },
  19242. "linear-color-stop": {
  19243. syntax: "<color> <color-stop-length>?"
  19244. },
  19245. "linear-gradient()": {
  19246. syntax: "linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"
  19247. },
  19248. "mask-layer": {
  19249. syntax: "<mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> || <masking-mode>"
  19250. },
  19251. "mask-position": {
  19252. syntax: "[ <length-percentage> | left | center | right ] [ <length-percentage> | top | center | bottom ]?"
  19253. },
  19254. "mask-reference": {
  19255. syntax: "none | <image> | <mask-source>"
  19256. },
  19257. "mask-source": {
  19258. syntax: "<url>"
  19259. },
  19260. "masking-mode": {
  19261. syntax: "alpha | luminance | match-source"
  19262. },
  19263. "matrix()": {
  19264. syntax: "matrix( <number>#{6} )"
  19265. },
  19266. "matrix3d()": {
  19267. syntax: "matrix3d( <number>#{16} )"
  19268. },
  19269. "max()": {
  19270. syntax: "max( <calc-sum># )"
  19271. },
  19272. "media-and": {
  19273. syntax: "<media-in-parens> [ and <media-in-parens> ]+"
  19274. },
  19275. "media-condition": {
  19276. syntax: "<media-not> | <media-and> | <media-or> | <media-in-parens>"
  19277. },
  19278. "media-condition-without-or": {
  19279. syntax: "<media-not> | <media-and> | <media-in-parens>"
  19280. },
  19281. "media-feature": {
  19282. syntax: "( [ <mf-plain> | <mf-boolean> | <mf-range> ] )"
  19283. },
  19284. "media-in-parens": {
  19285. syntax: "( <media-condition> ) | <media-feature> | <general-enclosed>"
  19286. },
  19287. "media-not": {
  19288. syntax: "not <media-in-parens>"
  19289. },
  19290. "media-or": {
  19291. syntax: "<media-in-parens> [ or <media-in-parens> ]+"
  19292. },
  19293. "media-query": {
  19294. syntax: "<media-condition> | [ not | only ]? <media-type> [ and <media-condition-without-or> ]?"
  19295. },
  19296. "media-query-list": {
  19297. syntax: "<media-query>#"
  19298. },
  19299. "media-type": {
  19300. syntax: "<ident>"
  19301. },
  19302. "mf-boolean": {
  19303. syntax: "<mf-name>"
  19304. },
  19305. "mf-name": {
  19306. syntax: "<ident>"
  19307. },
  19308. "mf-plain": {
  19309. syntax: "<mf-name> : <mf-value>"
  19310. },
  19311. "mf-range": {
  19312. syntax: "<mf-name> [ '<' | '>' ]? '='? <mf-value>\n| <mf-value> [ '<' | '>' ]? '='? <mf-name>\n| <mf-value> '<' '='? <mf-name> '<' '='? <mf-value>\n| <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>"
  19313. },
  19314. "mf-value": {
  19315. syntax: "<number> | <dimension> | <ident> | <ratio>"
  19316. },
  19317. "min()": {
  19318. syntax: "min( <calc-sum># )"
  19319. },
  19320. "minmax()": {
  19321. syntax: "minmax( [ <length> | <percentage> | <flex> | min-content | max-content | auto ] , [ <length> | <percentage> | <flex> | min-content | max-content | auto ] )"
  19322. },
  19323. "named-color": {
  19324. 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"
  19325. },
  19326. "namespace-prefix": {
  19327. syntax: "<ident>"
  19328. },
  19329. "ns-prefix": {
  19330. syntax: "[ <ident-token> | '*' ]? '|'"
  19331. },
  19332. "number-percentage": {
  19333. syntax: "<number> | <percentage>"
  19334. },
  19335. "numeric-figure-values": {
  19336. syntax: "[ lining-nums | oldstyle-nums ]"
  19337. },
  19338. "numeric-fraction-values": {
  19339. syntax: "[ diagonal-fractions | stacked-fractions ]"
  19340. },
  19341. "numeric-spacing-values": {
  19342. syntax: "[ proportional-nums | tabular-nums ]"
  19343. },
  19344. nth: nth,
  19345. "opacity()": {
  19346. syntax: "opacity( [ <number-percentage> ] )"
  19347. },
  19348. "overflow-position": {
  19349. syntax: "unsafe | safe"
  19350. },
  19351. "outline-radius": {
  19352. syntax: "<length> | <percentage>"
  19353. },
  19354. "page-body": {
  19355. syntax: "<declaration>? [ ; <page-body> ]? | <page-margin-box> <page-body>"
  19356. },
  19357. "page-margin-box": {
  19358. syntax: "<page-margin-box-type> '{' <declaration-list> '}'"
  19359. },
  19360. "page-margin-box-type": {
  19361. syntax: "@top-left-corner | @top-left | @top-center | @top-right | @top-right-corner | @bottom-left-corner | @bottom-left | @bottom-center | @bottom-right | @bottom-right-corner | @left-top | @left-middle | @left-bottom | @right-top | @right-middle | @right-bottom"
  19362. },
  19363. "page-selector-list": {
  19364. syntax: "[ <page-selector># ]?"
  19365. },
  19366. "page-selector": {
  19367. syntax: "<pseudo-page>+ | <ident> <pseudo-page>*"
  19368. },
  19369. "paint()": {
  19370. syntax: "paint( <ident>, <declaration-value>? )"
  19371. },
  19372. "perspective()": {
  19373. syntax: "perspective( <length> )"
  19374. },
  19375. "polygon()": {
  19376. syntax: "polygon( <fill-rule>? , [ <length-percentage> <length-percentage> ]# )"
  19377. },
  19378. position: position$1,
  19379. "pseudo-class-selector": {
  19380. syntax: "':' <ident-token> | ':' <function-token> <any-value> ')'"
  19381. },
  19382. "pseudo-element-selector": {
  19383. syntax: "':' <pseudo-class-selector>"
  19384. },
  19385. "pseudo-page": {
  19386. syntax: ": [ left | right | first | blank ]"
  19387. },
  19388. quote: quote,
  19389. "radial-gradient()": {
  19390. syntax: "radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"
  19391. },
  19392. "relative-selector": {
  19393. syntax: "<combinator>? <complex-selector>"
  19394. },
  19395. "relative-selector-list": {
  19396. syntax: "<relative-selector>#"
  19397. },
  19398. "relative-size": {
  19399. syntax: "larger | smaller"
  19400. },
  19401. "repeat-style": {
  19402. syntax: "repeat-x | repeat-y | [ repeat | space | round | no-repeat ]{1,2}"
  19403. },
  19404. "repeating-linear-gradient()": {
  19405. syntax: "repeating-linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"
  19406. },
  19407. "repeating-radial-gradient()": {
  19408. syntax: "repeating-radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"
  19409. },
  19410. "rgb()": {
  19411. syntax: "rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )"
  19412. },
  19413. "rgba()": {
  19414. syntax: "rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <number>#{3} , <alpha-value>? )"
  19415. },
  19416. "rotate()": {
  19417. syntax: "rotate( [ <angle> | <zero> ] )"
  19418. },
  19419. "rotate3d()": {
  19420. syntax: "rotate3d( <number> , <number> , <number> , [ <angle> | <zero> ] )"
  19421. },
  19422. "rotateX()": {
  19423. syntax: "rotateX( [ <angle> | <zero> ] )"
  19424. },
  19425. "rotateY()": {
  19426. syntax: "rotateY( [ <angle> | <zero> ] )"
  19427. },
  19428. "rotateZ()": {
  19429. syntax: "rotateZ( [ <angle> | <zero> ] )"
  19430. },
  19431. "saturate()": {
  19432. syntax: "saturate( <number-percentage> )"
  19433. },
  19434. "scale()": {
  19435. syntax: "scale( <number> , <number>? )"
  19436. },
  19437. "scale3d()": {
  19438. syntax: "scale3d( <number> , <number> , <number> )"
  19439. },
  19440. "scaleX()": {
  19441. syntax: "scaleX( <number> )"
  19442. },
  19443. "scaleY()": {
  19444. syntax: "scaleY( <number> )"
  19445. },
  19446. "scaleZ()": {
  19447. syntax: "scaleZ( <number> )"
  19448. },
  19449. "self-position": {
  19450. syntax: "center | start | end | self-start | self-end | flex-start | flex-end"
  19451. },
  19452. "shape-radius": {
  19453. syntax: "<length-percentage> | closest-side | farthest-side"
  19454. },
  19455. "skew()": {
  19456. syntax: "skew( [ <angle> | <zero> ] , [ <angle> | <zero> ]? )"
  19457. },
  19458. "skewX()": {
  19459. syntax: "skewX( [ <angle> | <zero> ] )"
  19460. },
  19461. "skewY()": {
  19462. syntax: "skewY( [ <angle> | <zero> ] )"
  19463. },
  19464. "sepia()": {
  19465. syntax: "sepia( <number-percentage> )"
  19466. },
  19467. shadow: shadow,
  19468. "shadow-t": {
  19469. syntax: "[ <length>{2,3} && <color>? ]"
  19470. },
  19471. shape: shape$1,
  19472. "shape-box": {
  19473. syntax: "<box> | margin-box"
  19474. },
  19475. "side-or-corner": {
  19476. syntax: "[ left | right ] || [ top | bottom ]"
  19477. },
  19478. "single-animation": {
  19479. syntax: "<time> || <timing-function> || <time> || <single-animation-iteration-count> || <single-animation-direction> || <single-animation-fill-mode> || <single-animation-play-state> || [ none | <keyframes-name> ]"
  19480. },
  19481. "single-animation-direction": {
  19482. syntax: "normal | reverse | alternate | alternate-reverse"
  19483. },
  19484. "single-animation-fill-mode": {
  19485. syntax: "none | forwards | backwards | both"
  19486. },
  19487. "single-animation-iteration-count": {
  19488. syntax: "infinite | <number>"
  19489. },
  19490. "single-animation-play-state": {
  19491. syntax: "running | paused"
  19492. },
  19493. "single-transition": {
  19494. syntax: "[ none | <single-transition-property> ] || <time> || <timing-function> || <time>"
  19495. },
  19496. "single-transition-property": {
  19497. syntax: "all | <custom-ident>"
  19498. },
  19499. size: size,
  19500. "step-position": {
  19501. syntax: "jump-start | jump-end | jump-none | jump-both | start | end"
  19502. },
  19503. "step-timing-function": {
  19504. syntax: "step-start | step-end | steps(<integer>[, <step-position>]?)"
  19505. },
  19506. "subclass-selector": {
  19507. syntax: "<id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector>"
  19508. },
  19509. "supports-condition": {
  19510. syntax: "not <supports-in-parens> | <supports-in-parens> [ and <supports-in-parens> ]* | <supports-in-parens> [ or <supports-in-parens> ]*"
  19511. },
  19512. "supports-in-parens": {
  19513. syntax: "( <supports-condition> ) | <supports-feature> | <general-enclosed>"
  19514. },
  19515. "supports-feature": {
  19516. syntax: "<supports-decl> | <supports-selector-fn>"
  19517. },
  19518. "supports-decl": {
  19519. syntax: "( <declaration> )"
  19520. },
  19521. "supports-selector-fn": {
  19522. syntax: "selector( <complex-selector> )"
  19523. },
  19524. symbol: symbol,
  19525. target: target,
  19526. "target-counter()": {
  19527. syntax: "target-counter( [ <string> | <url> ] , <custom-ident> , <counter-style>? )"
  19528. },
  19529. "target-counters()": {
  19530. syntax: "target-counters( [ <string> | <url> ] , <custom-ident> , <string> , <counter-style>? )"
  19531. },
  19532. "target-text()": {
  19533. syntax: "target-text( [ <string> | <url> ] , [ content | before | after | first-letter ]? )"
  19534. },
  19535. "time-percentage": {
  19536. syntax: "<time> | <percentage>"
  19537. },
  19538. "timing-function": {
  19539. syntax: "linear | <cubic-bezier-timing-function> | <step-timing-function>"
  19540. },
  19541. "track-breadth": {
  19542. syntax: "<length-percentage> | <flex> | min-content | max-content | auto"
  19543. },
  19544. "track-list": {
  19545. syntax: "[ <line-names>? [ <track-size> | <track-repeat> ] ]+ <line-names>?"
  19546. },
  19547. "track-repeat": {
  19548. syntax: "repeat( [ <positive-integer> ] , [ <line-names>? <track-size> ]+ <line-names>? )"
  19549. },
  19550. "track-size": {
  19551. syntax: "<track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( [ <length> | <percentage> ] )"
  19552. },
  19553. "transform-function": {
  19554. syntax: "<matrix()> | <translate()> | <translateX()> | <translateY()> | <scale()> | <scaleX()> | <scaleY()> | <rotate()> | <skew()> | <skewX()> | <skewY()> | <matrix3d()> | <translate3d()> | <translateZ()> | <scale3d()> | <scaleZ()> | <rotate3d()> | <rotateX()> | <rotateY()> | <rotateZ()> | <perspective()>"
  19555. },
  19556. "transform-list": {
  19557. syntax: "<transform-function>+"
  19558. },
  19559. "translate()": {
  19560. syntax: "translate( <length-percentage> , <length-percentage>? )"
  19561. },
  19562. "translate3d()": {
  19563. syntax: "translate3d( <length-percentage> , <length-percentage> , <length> )"
  19564. },
  19565. "translateX()": {
  19566. syntax: "translateX( <length-percentage> )"
  19567. },
  19568. "translateY()": {
  19569. syntax: "translateY( <length-percentage> )"
  19570. },
  19571. "translateZ()": {
  19572. syntax: "translateZ( <length> )"
  19573. },
  19574. "type-or-unit": {
  19575. syntax: "string | color | url | integer | number | length | angle | time | frequency | cap | ch | em | ex | ic | lh | rlh | rem | vb | vi | vw | vh | vmin | vmax | mm | Q | cm | in | pt | pc | px | deg | grad | rad | turn | ms | s | Hz | kHz | %"
  19576. },
  19577. "type-selector": {
  19578. syntax: "<wq-name> | <ns-prefix>? '*'"
  19579. },
  19580. "var()": {
  19581. syntax: "var( <custom-property-name> , <declaration-value>? )"
  19582. },
  19583. "viewport-length": {
  19584. syntax: "auto | <length-percentage>"
  19585. },
  19586. "wq-name": {
  19587. syntax: "<ns-prefix>? <ident-token>"
  19588. }
  19589. };
  19590. var syntaxes$1 = /*#__PURE__*/Object.freeze({
  19591. __proto__: null,
  19592. attachment: attachment,
  19593. box: box,
  19594. color: color$1,
  19595. combinator: combinator,
  19596. compat: compat,
  19597. gradient: gradient,
  19598. hue: hue,
  19599. image: image,
  19600. nth: nth,
  19601. position: position$1,
  19602. quote: quote,
  19603. shadow: shadow,
  19604. shape: shape$1,
  19605. size: size,
  19606. symbol: symbol,
  19607. target: target,
  19608. 'default': syntaxes
  19609. });
  19610. var properties$3 = {
  19611. "-moz-background-clip": {
  19612. comment: "deprecated syntax in old Firefox, https://developer.mozilla.org/en/docs/Web/CSS/background-clip",
  19613. syntax: "padding | border"
  19614. },
  19615. "-moz-border-radius-bottomleft": {
  19616. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-left-radius",
  19617. syntax: "<'border-bottom-left-radius'>"
  19618. },
  19619. "-moz-border-radius-bottomright": {
  19620. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",
  19621. syntax: "<'border-bottom-right-radius'>"
  19622. },
  19623. "-moz-border-radius-topleft": {
  19624. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-top-left-radius",
  19625. syntax: "<'border-top-left-radius'>"
  19626. },
  19627. "-moz-border-radius-topright": {
  19628. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",
  19629. syntax: "<'border-bottom-right-radius'>"
  19630. },
  19631. "-moz-control-character-visibility": {
  19632. comment: "firefox specific keywords, https://bugzilla.mozilla.org/show_bug.cgi?id=947588",
  19633. syntax: "visible | hidden"
  19634. },
  19635. "-moz-osx-font-smoothing": {
  19636. comment: "misssed old syntax https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",
  19637. syntax: "auto | grayscale"
  19638. },
  19639. "-moz-user-select": {
  19640. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",
  19641. syntax: "none | text | all | -moz-none"
  19642. },
  19643. "-ms-flex-align": {
  19644. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",
  19645. syntax: "start | end | center | baseline | stretch"
  19646. },
  19647. "-ms-flex-item-align": {
  19648. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",
  19649. syntax: "auto | start | end | center | baseline | stretch"
  19650. },
  19651. "-ms-flex-line-pack": {
  19652. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-line-pack",
  19653. syntax: "start | end | center | justify | distribute | stretch"
  19654. },
  19655. "-ms-flex-negative": {
  19656. comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
  19657. syntax: "<'flex-shrink'>"
  19658. },
  19659. "-ms-flex-pack": {
  19660. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-pack",
  19661. syntax: "start | end | center | justify | distribute"
  19662. },
  19663. "-ms-flex-order": {
  19664. comment: "misssed old syntax implemented in IE; https://msdn.microsoft.com/en-us/library/jj127303(v=vs.85).aspx",
  19665. syntax: "<integer>"
  19666. },
  19667. "-ms-flex-positive": {
  19668. comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
  19669. syntax: "<'flex-grow'>"
  19670. },
  19671. "-ms-flex-preferred-size": {
  19672. comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
  19673. syntax: "<'flex-basis'>"
  19674. },
  19675. "-ms-interpolation-mode": {
  19676. comment: "https://msdn.microsoft.com/en-us/library/ff521095(v=vs.85).aspx",
  19677. syntax: "nearest-neighbor | bicubic"
  19678. },
  19679. "-ms-grid-column-align": {
  19680. comment: "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466338.aspx",
  19681. syntax: "start | end | center | stretch"
  19682. },
  19683. "-ms-grid-columns": {
  19684. comment: "misssed old syntax implemented in IE; https://www.w3.org/TR/2012/WD-css3-grid-layout-20120322/#grid-columns",
  19685. syntax: "<track-list-v0>"
  19686. },
  19687. "-ms-grid-row-align": {
  19688. comment: "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466348.aspx",
  19689. syntax: "start | end | center | stretch"
  19690. },
  19691. "-ms-grid-rows": {
  19692. comment: "misssed old syntax implemented in IE; https://www.w3.org/TR/2012/WD-css3-grid-layout-20120322/#grid-rows",
  19693. syntax: "<track-list-v0>"
  19694. },
  19695. "-ms-hyphenate-limit-last": {
  19696. comment: "misssed old syntax implemented in IE; https://www.w3.org/TR/css-text-4/#hyphenate-line-limits",
  19697. syntax: "none | always | column | page | spread"
  19698. },
  19699. "-webkit-appearance": {
  19700. comment: "webkit specific keywords",
  19701. references: [
  19702. "http://css-infos.net/property/-webkit-appearance"
  19703. ],
  19704. 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"
  19705. },
  19706. "-webkit-background-clip": {
  19707. comment: "https://developer.mozilla.org/en/docs/Web/CSS/background-clip",
  19708. syntax: "[ <box> | border | padding | content | text ]#"
  19709. },
  19710. "-webkit-column-break-after": {
  19711. comment: "added, http://help.dottoro.com/lcrthhhv.php",
  19712. syntax: "always | auto | avoid"
  19713. },
  19714. "-webkit-column-break-before": {
  19715. comment: "added, http://help.dottoro.com/lcxquvkf.php",
  19716. syntax: "always | auto | avoid"
  19717. },
  19718. "-webkit-column-break-inside": {
  19719. comment: "added, http://help.dottoro.com/lclhnthl.php",
  19720. syntax: "always | auto | avoid"
  19721. },
  19722. "-webkit-font-smoothing": {
  19723. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",
  19724. syntax: "auto | none | antialiased | subpixel-antialiased"
  19725. },
  19726. "-webkit-mask-box-image": {
  19727. comment: "missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image",
  19728. syntax: "[ <url> | <gradient> | none ] [ <length-percentage>{4} <-webkit-mask-box-repeat>{2} ]?"
  19729. },
  19730. "-webkit-print-color-adjust": {
  19731. comment: "missed",
  19732. references: [
  19733. "https://developer.mozilla.org/en/docs/Web/CSS/-webkit-print-color-adjust"
  19734. ],
  19735. syntax: "economy | exact"
  19736. },
  19737. "-webkit-text-security": {
  19738. comment: "missed; http://help.dottoro.com/lcbkewgt.php",
  19739. syntax: "none | circle | disc | square"
  19740. },
  19741. "-webkit-user-drag": {
  19742. comment: "missed; http://help.dottoro.com/lcbixvwm.php",
  19743. syntax: "none | element | auto"
  19744. },
  19745. "-webkit-user-select": {
  19746. comment: "auto is supported by old webkit, https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",
  19747. syntax: "auto | none | text | all"
  19748. },
  19749. "alignment-baseline": {
  19750. comment: "added SVG property",
  19751. references: [
  19752. "https://www.w3.org/TR/SVG/text.html#AlignmentBaselineProperty"
  19753. ],
  19754. syntax: "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical"
  19755. },
  19756. "baseline-shift": {
  19757. comment: "added SVG property",
  19758. references: [
  19759. "https://www.w3.org/TR/SVG/text.html#BaselineShiftProperty"
  19760. ],
  19761. syntax: "baseline | sub | super | <svg-length>"
  19762. },
  19763. behavior: {
  19764. comment: "added old IE property https://msdn.microsoft.com/en-us/library/ms530723(v=vs.85).aspx",
  19765. syntax: "<url>+"
  19766. },
  19767. "clip-rule": {
  19768. comment: "added SVG property",
  19769. references: [
  19770. "https://www.w3.org/TR/SVG/masking.html#ClipRuleProperty"
  19771. ],
  19772. syntax: "nonzero | evenodd"
  19773. },
  19774. cue: {
  19775. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19776. syntax: "<'cue-before'> <'cue-after'>?"
  19777. },
  19778. "cue-after": {
  19779. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19780. syntax: "<url> <decibel>? | none"
  19781. },
  19782. "cue-before": {
  19783. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19784. syntax: "<url> <decibel>? | none"
  19785. },
  19786. cursor: {
  19787. comment: "added legacy keywords: hand, -webkit-grab. -webkit-grabbing, -webkit-zoom-in, -webkit-zoom-out, -moz-grab, -moz-grabbing, -moz-zoom-in, -moz-zoom-out",
  19788. references: [
  19789. "https://www.sitepoint.com/css3-cursor-styles/"
  19790. ],
  19791. syntax: "[ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing | hand | -webkit-grab | -webkit-grabbing | -webkit-zoom-in | -webkit-zoom-out | -moz-grab | -moz-grabbing | -moz-zoom-in | -moz-zoom-out ] ]"
  19792. },
  19793. display: {
  19794. comment: "extended with -ms-flexbox",
  19795. 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"
  19796. },
  19797. position: {
  19798. comment: "extended with -webkit-sticky",
  19799. syntax: "static | relative | absolute | sticky | fixed | -webkit-sticky"
  19800. },
  19801. "dominant-baseline": {
  19802. comment: "added SVG property",
  19803. references: [
  19804. "https://www.w3.org/TR/SVG/text.html#DominantBaselineProperty"
  19805. ],
  19806. syntax: "auto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge"
  19807. },
  19808. "image-rendering": {
  19809. comment: "extended with <-non-standard-image-rendering>, added SVG keywords optimizeSpeed and optimizeQuality",
  19810. references: [
  19811. "https://developer.mozilla.org/en/docs/Web/CSS/image-rendering",
  19812. "https://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty"
  19813. ],
  19814. syntax: "auto | crisp-edges | pixelated | optimizeSpeed | optimizeQuality | <-non-standard-image-rendering>"
  19815. },
  19816. fill: {
  19817. comment: "added SVG property",
  19818. references: [
  19819. "https://www.w3.org/TR/SVG/painting.html#FillProperty"
  19820. ],
  19821. syntax: "<paint>"
  19822. },
  19823. "fill-opacity": {
  19824. comment: "added SVG property",
  19825. references: [
  19826. "https://www.w3.org/TR/SVG/painting.html#FillProperty"
  19827. ],
  19828. syntax: "<number-zero-one>"
  19829. },
  19830. "fill-rule": {
  19831. comment: "added SVG property",
  19832. references: [
  19833. "https://www.w3.org/TR/SVG/painting.html#FillProperty"
  19834. ],
  19835. syntax: "nonzero | evenodd"
  19836. },
  19837. filter: {
  19838. comment: "extend with IE legacy syntaxes",
  19839. syntax: "none | <filter-function-list> | <-ms-filter-function-list>"
  19840. },
  19841. "glyph-orientation-horizontal": {
  19842. comment: "added SVG property",
  19843. references: [
  19844. "https://www.w3.org/TR/SVG/text.html#GlyphOrientationHorizontalProperty"
  19845. ],
  19846. syntax: "<angle>"
  19847. },
  19848. "glyph-orientation-vertical": {
  19849. comment: "added SVG property",
  19850. references: [
  19851. "https://www.w3.org/TR/SVG/text.html#GlyphOrientationVerticalProperty"
  19852. ],
  19853. syntax: "<angle>"
  19854. },
  19855. kerning: {
  19856. comment: "added SVG property",
  19857. references: [
  19858. "https://www.w3.org/TR/SVG/text.html#KerningProperty"
  19859. ],
  19860. syntax: "auto | <svg-length>"
  19861. },
  19862. "letter-spacing": {
  19863. comment: "fix syntax <length> -> <length-percentage>",
  19864. references: [
  19865. "https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/letter-spacing"
  19866. ],
  19867. syntax: "normal | <length-percentage>"
  19868. },
  19869. marker: {
  19870. comment: "added SVG property",
  19871. references: [
  19872. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  19873. ],
  19874. syntax: "none | <url>"
  19875. },
  19876. "marker-end": {
  19877. comment: "added SVG property",
  19878. references: [
  19879. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  19880. ],
  19881. syntax: "none | <url>"
  19882. },
  19883. "marker-mid": {
  19884. comment: "added SVG property",
  19885. references: [
  19886. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  19887. ],
  19888. syntax: "none | <url>"
  19889. },
  19890. "marker-start": {
  19891. comment: "added SVG property",
  19892. references: [
  19893. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  19894. ],
  19895. syntax: "none | <url>"
  19896. },
  19897. "max-width": {
  19898. comment: "extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/max-width",
  19899. syntax: "<length> | <percentage> | none | max-content | min-content | fit-content | fill-available | <-non-standard-width>"
  19900. },
  19901. "min-width": {
  19902. comment: "extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width",
  19903. syntax: "<length> | <percentage> | auto | max-content | min-content | fit-content | fill-available | <-non-standard-width>"
  19904. },
  19905. opacity: {
  19906. comment: "strict to 0..1 <number> -> <number-zero-one>",
  19907. syntax: "<number-zero-one>"
  19908. },
  19909. overflow: {
  19910. comment: "extend by vendor keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow",
  19911. syntax: "[ visible | hidden | clip | scroll | auto ]{1,2} | <-non-standard-overflow>"
  19912. },
  19913. pause: {
  19914. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19915. syntax: "<'pause-before'> <'pause-after'>?"
  19916. },
  19917. "pause-after": {
  19918. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19919. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  19920. },
  19921. "pause-before": {
  19922. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19923. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  19924. },
  19925. rest: {
  19926. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19927. syntax: "<'rest-before'> <'rest-after'>?"
  19928. },
  19929. "rest-after": {
  19930. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19931. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  19932. },
  19933. "rest-before": {
  19934. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19935. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  19936. },
  19937. "shape-rendering": {
  19938. comment: "added SVG property",
  19939. references: [
  19940. "https://www.w3.org/TR/SVG/painting.html#ShapeRenderingPropert"
  19941. ],
  19942. syntax: "auto | optimizeSpeed | crispEdges | geometricPrecision"
  19943. },
  19944. src: {
  19945. comment: "added @font-face's src property https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src",
  19946. syntax: "[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#"
  19947. },
  19948. speak: {
  19949. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19950. syntax: "auto | none | normal"
  19951. },
  19952. "speak-as": {
  19953. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  19954. syntax: "normal | spell-out || digits || [ literal-punctuation | no-punctuation ]"
  19955. },
  19956. stroke: {
  19957. comment: "added SVG property",
  19958. references: [
  19959. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  19960. ],
  19961. syntax: "<paint>"
  19962. },
  19963. "stroke-dasharray": {
  19964. comment: "added SVG property; a list of comma and/or white space separated <length>s and <percentage>s",
  19965. references: [
  19966. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  19967. ],
  19968. syntax: "none | [ <svg-length>+ ]#"
  19969. },
  19970. "stroke-dashoffset": {
  19971. comment: "added SVG property",
  19972. references: [
  19973. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  19974. ],
  19975. syntax: "<svg-length>"
  19976. },
  19977. "stroke-linecap": {
  19978. comment: "added SVG property",
  19979. references: [
  19980. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  19981. ],
  19982. syntax: "butt | round | square"
  19983. },
  19984. "stroke-linejoin": {
  19985. comment: "added SVG property",
  19986. references: [
  19987. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  19988. ],
  19989. syntax: "miter | round | bevel"
  19990. },
  19991. "stroke-miterlimit": {
  19992. comment: "added SVG property (<miterlimit> = <number-one-or-greater>) ",
  19993. references: [
  19994. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  19995. ],
  19996. syntax: "<number-one-or-greater>"
  19997. },
  19998. "stroke-opacity": {
  19999. comment: "added SVG property",
  20000. references: [
  20001. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20002. ],
  20003. syntax: "<number-zero-one>"
  20004. },
  20005. "stroke-width": {
  20006. comment: "added SVG property",
  20007. references: [
  20008. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20009. ],
  20010. syntax: "<svg-length>"
  20011. },
  20012. "text-anchor": {
  20013. comment: "added SVG property",
  20014. references: [
  20015. "https://www.w3.org/TR/SVG/text.html#TextAlignmentProperties"
  20016. ],
  20017. syntax: "start | middle | end"
  20018. },
  20019. "unicode-bidi": {
  20020. comment: "added prefixed keywords https://developer.mozilla.org/en-US/docs/Web/CSS/unicode-bidi",
  20021. syntax: "normal | embed | isolate | bidi-override | isolate-override | plaintext | -moz-isolate | -moz-isolate-override | -moz-plaintext | -webkit-isolate"
  20022. },
  20023. "unicode-range": {
  20024. comment: "added missed property https://developer.mozilla.org/en-US/docs/Web/CSS/%40font-face/unicode-range",
  20025. syntax: "<urange>#"
  20026. },
  20027. "voice-balance": {
  20028. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20029. syntax: "<number> | left | center | right | leftwards | rightwards"
  20030. },
  20031. "voice-duration": {
  20032. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20033. syntax: "auto | <time>"
  20034. },
  20035. "voice-family": {
  20036. comment: "<name> -> <family-name>, https://www.w3.org/TR/css3-speech/#property-index",
  20037. syntax: "[ [ <family-name> | <generic-voice> ] , ]* [ <family-name> | <generic-voice> ] | preserve"
  20038. },
  20039. "voice-pitch": {
  20040. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20041. syntax: "<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"
  20042. },
  20043. "voice-range": {
  20044. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20045. syntax: "<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"
  20046. },
  20047. "voice-rate": {
  20048. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20049. syntax: "[ normal | x-slow | slow | medium | fast | x-fast ] || <percentage>"
  20050. },
  20051. "voice-stress": {
  20052. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20053. syntax: "normal | strong | moderate | none | reduced"
  20054. },
  20055. "voice-volume": {
  20056. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20057. syntax: "silent | [ [ x-soft | soft | medium | loud | x-loud ] || <decibel> ]"
  20058. },
  20059. "writing-mode": {
  20060. comment: "extend with SVG keywords",
  20061. syntax: "horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr | <svg-writing-mode>"
  20062. }
  20063. };
  20064. var syntaxes$2 = {
  20065. "-legacy-gradient": {
  20066. comment: "added collection of legacy gradient syntaxes",
  20067. syntax: "<-webkit-gradient()> | <-legacy-linear-gradient> | <-legacy-repeating-linear-gradient> | <-legacy-radial-gradient> | <-legacy-repeating-radial-gradient>"
  20068. },
  20069. "-legacy-linear-gradient": {
  20070. comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
  20071. syntax: "-moz-linear-gradient( <-legacy-linear-gradient-arguments> ) | -webkit-linear-gradient( <-legacy-linear-gradient-arguments> ) | -o-linear-gradient( <-legacy-linear-gradient-arguments> )"
  20072. },
  20073. "-legacy-repeating-linear-gradient": {
  20074. comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
  20075. syntax: "-moz-repeating-linear-gradient( <-legacy-linear-gradient-arguments> ) | -webkit-repeating-linear-gradient( <-legacy-linear-gradient-arguments> ) | -o-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )"
  20076. },
  20077. "-legacy-linear-gradient-arguments": {
  20078. comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
  20079. syntax: "[ <angle> | <side-or-corner> ]? , <color-stop-list>"
  20080. },
  20081. "-legacy-radial-gradient": {
  20082. comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
  20083. syntax: "-moz-radial-gradient( <-legacy-radial-gradient-arguments> ) | -webkit-radial-gradient( <-legacy-radial-gradient-arguments> ) | -o-radial-gradient( <-legacy-radial-gradient-arguments> )"
  20084. },
  20085. "-legacy-repeating-radial-gradient": {
  20086. comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
  20087. syntax: "-moz-repeating-radial-gradient( <-legacy-radial-gradient-arguments> ) | -webkit-repeating-radial-gradient( <-legacy-radial-gradient-arguments> ) | -o-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )"
  20088. },
  20089. "-legacy-radial-gradient-arguments": {
  20090. comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
  20091. syntax: "[ <position> , ]? [ [ [ <-legacy-radial-gradient-shape> || <-legacy-radial-gradient-size> ] | [ <length> | <percentage> ]{2} ] , ]? <color-stop-list>"
  20092. },
  20093. "-legacy-radial-gradient-size": {
  20094. comment: "before a standard it contains 2 extra keywords (`contain` and `cover`) https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltsize",
  20095. syntax: "closest-side | closest-corner | farthest-side | farthest-corner | contain | cover"
  20096. },
  20097. "-legacy-radial-gradient-shape": {
  20098. comment: "define to double sure it doesn't extends in future https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltshape",
  20099. syntax: "circle | ellipse"
  20100. },
  20101. "-non-standard-font": {
  20102. comment: "non standard fonts",
  20103. references: [
  20104. "https://webkit.org/blog/3709/using-the-system-font-in-web-content/"
  20105. ],
  20106. syntax: "-apple-system-body | -apple-system-headline | -apple-system-subheadline | -apple-system-caption1 | -apple-system-caption2 | -apple-system-footnote | -apple-system-short-body | -apple-system-short-headline | -apple-system-short-subheadline | -apple-system-short-caption1 | -apple-system-short-footnote | -apple-system-tall-body"
  20107. },
  20108. "-non-standard-color": {
  20109. comment: "non standard colors",
  20110. references: [
  20111. "http://cssdot.ru/%D0%A1%D0%BF%D1%80%D0%B0%D0%B2%D0%BE%D1%87%D0%BD%D0%B8%D0%BA_CSS/color-i305.html",
  20112. "https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Mozilla_Color_Preference_Extensions"
  20113. ],
  20114. syntax: "-moz-ButtonDefault | -moz-ButtonHoverFace | -moz-ButtonHoverText | -moz-CellHighlight | -moz-CellHighlightText | -moz-Combobox | -moz-ComboboxText | -moz-Dialog | -moz-DialogText | -moz-dragtargetzone | -moz-EvenTreeRow | -moz-Field | -moz-FieldText | -moz-html-CellHighlight | -moz-html-CellHighlightText | -moz-mac-accentdarkestshadow | -moz-mac-accentdarkshadow | -moz-mac-accentface | -moz-mac-accentlightesthighlight | -moz-mac-accentlightshadow | -moz-mac-accentregularhighlight | -moz-mac-accentregularshadow | -moz-mac-chrome-active | -moz-mac-chrome-inactive | -moz-mac-focusring | -moz-mac-menuselect | -moz-mac-menushadow | -moz-mac-menutextselect | -moz-MenuHover | -moz-MenuHoverText | -moz-MenuBarText | -moz-MenuBarHoverText | -moz-nativehyperlinktext | -moz-OddTreeRow | -moz-win-communicationstext | -moz-win-mediatext | -moz-activehyperlinktext | -moz-default-background-color | -moz-default-color | -moz-hyperlinktext | -moz-visitedhyperlinktext | -webkit-activelink | -webkit-focus-ring-color | -webkit-link | -webkit-text"
  20115. },
  20116. "-non-standard-image-rendering": {
  20117. comment: "non-standard keywords http://phrogz.net/tmp/canvas_image_zoom.html",
  20118. syntax: "optimize-contrast | -moz-crisp-edges | -o-crisp-edges | -webkit-optimize-contrast"
  20119. },
  20120. "-non-standard-overflow": {
  20121. comment: "non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow",
  20122. syntax: "-moz-scrollbars-none | -moz-scrollbars-horizontal | -moz-scrollbars-vertical | -moz-hidden-unscrollable"
  20123. },
  20124. "-non-standard-width": {
  20125. comment: "non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width",
  20126. syntax: "min-intrinsic | intrinsic | -moz-min-content | -moz-max-content | -webkit-min-content | -webkit-max-content"
  20127. },
  20128. "-webkit-gradient()": {
  20129. 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 )",
  20130. syntax: "-webkit-gradient( <-webkit-gradient-type>, <-webkit-gradient-point> [, <-webkit-gradient-point> | , <-webkit-gradient-radius>, <-webkit-gradient-point> ] [, <-webkit-gradient-radius>]? [, <-webkit-gradient-color-stop>]* )"
  20131. },
  20132. "-webkit-gradient-color-stop": {
  20133. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  20134. syntax: "from( <color> ) | color-stop( [ <number-zero-one> | <percentage> ] , <color> ) | to( <color> )"
  20135. },
  20136. "-webkit-gradient-point": {
  20137. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  20138. syntax: "[ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]"
  20139. },
  20140. "-webkit-gradient-radius": {
  20141. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  20142. syntax: "<length> | <percentage>"
  20143. },
  20144. "-webkit-gradient-type": {
  20145. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  20146. syntax: "linear | radial"
  20147. },
  20148. "-webkit-mask-box-repeat": {
  20149. comment: "missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image",
  20150. syntax: "repeat | stretch | round"
  20151. },
  20152. "-webkit-mask-clip-style": {
  20153. comment: "missed; there is no enough information about `-webkit-mask-clip` property, but looks like all those keywords are working",
  20154. syntax: "border | border-box | padding | padding-box | content | content-box | text"
  20155. },
  20156. "-ms-filter-function-list": {
  20157. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  20158. syntax: "<-ms-filter-function>+"
  20159. },
  20160. "-ms-filter-function": {
  20161. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  20162. syntax: "<-ms-filter-function-progid> | <-ms-filter-function-legacy>"
  20163. },
  20164. "-ms-filter-function-progid": {
  20165. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  20166. syntax: "'progid:' [ <ident-token> '.' ]* [ <ident-token> | <function-token> <any-value>? ) ]"
  20167. },
  20168. "-ms-filter-function-legacy": {
  20169. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  20170. syntax: "<ident-token> | <function-token> <any-value>? )"
  20171. },
  20172. "-ms-filter": {
  20173. syntax: "<string>"
  20174. },
  20175. age: {
  20176. comment: "https://www.w3.org/TR/css3-speech/#voice-family",
  20177. syntax: "child | young | old"
  20178. },
  20179. "attr-name": {
  20180. syntax: "<wq-name>"
  20181. },
  20182. "attr-fallback": {
  20183. syntax: "<any-value>"
  20184. },
  20185. "border-radius": {
  20186. comment: "missed, https://drafts.csswg.org/css-backgrounds-3/#the-border-radius",
  20187. syntax: "<length-percentage>{1,2}"
  20188. },
  20189. bottom: {
  20190. 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",
  20191. syntax: "<length> | auto"
  20192. },
  20193. "content-list": {
  20194. comment: "missed -> https://drafts.csswg.org/css-content/#typedef-content-list (document-url, <target> and leader() is omitted util stabilization)",
  20195. syntax: "[ <string> | contents | <url> | <quote> | <attr()> | counter( <ident>, <'list-style-type'>? ) ]+"
  20196. },
  20197. "generic-voice": {
  20198. comment: "https://www.w3.org/TR/css3-speech/#voice-family",
  20199. syntax: "[ <age>? <gender> <integer>? ]"
  20200. },
  20201. gender: {
  20202. comment: "https://www.w3.org/TR/css3-speech/#voice-family",
  20203. syntax: "male | female | neutral"
  20204. },
  20205. "generic-family": {
  20206. comment: "added -apple-system",
  20207. references: [
  20208. "https://webkit.org/blog/3709/using-the-system-font-in-web-content/"
  20209. ],
  20210. syntax: "serif | sans-serif | cursive | fantasy | monospace | -apple-system"
  20211. },
  20212. gradient: {
  20213. comment: "added legacy syntaxes support",
  20214. syntax: "<linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()> | <conic-gradient()> | <-legacy-gradient>"
  20215. },
  20216. left: {
  20217. 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",
  20218. syntax: "<length> | auto"
  20219. },
  20220. "mask-image": {
  20221. comment: "missed; https://drafts.fxtf.org/css-masking-1/#the-mask-image",
  20222. syntax: "<mask-reference>#"
  20223. },
  20224. "name-repeat": {
  20225. comment: "missed, and looks like obsolete, keep it as is since other property syntaxes should be changed too; https://www.w3.org/TR/2015/WD-css-grid-1-20150917/#typedef-name-repeat",
  20226. syntax: "repeat( [ <positive-integer> | auto-fill ], <line-names>+)"
  20227. },
  20228. "named-color": {
  20229. comment: "added non standard color names",
  20230. 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>"
  20231. },
  20232. paint: {
  20233. comment: "used by SVG https://www.w3.org/TR/SVG/painting.html#SpecifyingPaint",
  20234. syntax: "none | <color> | <url> [ none | <color> ]? | context-fill | context-stroke"
  20235. },
  20236. "path()": {
  20237. 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",
  20238. syntax: "path( <string> )"
  20239. },
  20240. ratio: {
  20241. comment: "missed, https://drafts.csswg.org/mediaqueries-4/#typedef-ratio",
  20242. syntax: "<integer> / <integer>"
  20243. },
  20244. right: {
  20245. 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",
  20246. syntax: "<length> | auto"
  20247. },
  20248. shape: {
  20249. comment: "missed spaces in function body and add backwards compatible syntax",
  20250. syntax: "rect( <top>, <right>, <bottom>, <left> ) | rect( <top> <right> <bottom> <left> )"
  20251. },
  20252. "svg-length": {
  20253. comment: "All coordinates and lengths in SVG can be specified with or without a unit identifier",
  20254. references: [
  20255. "https://www.w3.org/TR/SVG11/coords.html#Units"
  20256. ],
  20257. syntax: "<percentage> | <length> | <number>"
  20258. },
  20259. "svg-writing-mode": {
  20260. comment: "SVG specific keywords (deprecated for CSS)",
  20261. references: [
  20262. "https://developer.mozilla.org/en/docs/Web/CSS/writing-mode",
  20263. "https://www.w3.org/TR/SVG/text.html#WritingModeProperty"
  20264. ],
  20265. syntax: "lr-tb | rl-tb | tb-rl | lr | rl | tb"
  20266. },
  20267. top: {
  20268. 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",
  20269. syntax: "<length> | auto"
  20270. },
  20271. "track-group": {
  20272. comment: "used by old grid-columns and grid-rows syntax v0",
  20273. syntax: "'(' [ <string>* <track-minmax> <string>* ]+ ')' [ '[' <positive-integer> ']' ]? | <track-minmax>"
  20274. },
  20275. "track-list-v0": {
  20276. comment: "used by old grid-columns and grid-rows syntax v0",
  20277. syntax: "[ <string>* <track-group> <string>* ]+ | none"
  20278. },
  20279. "track-minmax": {
  20280. comment: "used by old grid-columns and grid-rows syntax v0",
  20281. syntax: "minmax( <track-breadth> , <track-breadth> ) | auto | <track-breadth> | fit-content"
  20282. },
  20283. x: {
  20284. comment: "missed; not sure we should add it, but no others except `cursor` is using it so it's ok for now; https://drafts.csswg.org/css-ui-3/#cursor",
  20285. syntax: "<number>"
  20286. },
  20287. y: {
  20288. comment: "missed; not sure we should add it, but no others except `cursor` is using so it's ok for now; https://drafts.csswg.org/css-ui-3/#cursor",
  20289. syntax: "<number>"
  20290. },
  20291. declaration: {
  20292. comment: "missed, restored by https://drafts.csswg.org/css-syntax",
  20293. syntax: "<ident-token> : <declaration-value>? [ '!' important ]?"
  20294. },
  20295. "declaration-list": {
  20296. comment: "missed, restored by https://drafts.csswg.org/css-syntax",
  20297. syntax: "[ <declaration>? ';' ]* <declaration>?"
  20298. },
  20299. url: {
  20300. comment: "https://drafts.csswg.org/css-values-4/#urls",
  20301. syntax: "url( <string> <url-modifier>* ) | <url-token>"
  20302. },
  20303. "url-modifier": {
  20304. comment: "https://drafts.csswg.org/css-values-4/#typedef-url-modifier",
  20305. syntax: "<ident> | <function-token> <any-value> )"
  20306. },
  20307. "number-zero-one": {
  20308. syntax: "<number [0,1]>"
  20309. },
  20310. "number-one-or-greater": {
  20311. syntax: "<number [1,∞]>"
  20312. },
  20313. "positive-integer": {
  20314. syntax: "<integer [0,∞]>"
  20315. }
  20316. };
  20317. var patch = {
  20318. properties: properties$3,
  20319. syntaxes: syntaxes$2
  20320. };
  20321. var patch$1 = /*#__PURE__*/Object.freeze({
  20322. __proto__: null,
  20323. properties: properties$3,
  20324. syntaxes: syntaxes$2,
  20325. 'default': patch
  20326. });
  20327. var mdnAtrules = getCjsExportFromNamespace(atRules$1);
  20328. var mdnProperties = getCjsExportFromNamespace(properties$2);
  20329. var mdnSyntaxes = getCjsExportFromNamespace(syntaxes$1);
  20330. var patch$2 = getCjsExportFromNamespace(patch$1);
  20331. function preprocessAtrules(dict) {
  20332. var result = Object.create(null);
  20333. for (var atruleName in dict) {
  20334. var atrule = dict[atruleName];
  20335. var descriptors = null;
  20336. if (atrule.descriptors) {
  20337. descriptors = Object.create(null);
  20338. for (var descriptor in atrule.descriptors) {
  20339. descriptors[descriptor] = atrule.descriptors[descriptor].syntax;
  20340. }
  20341. }
  20342. result[atruleName.substr(1)] = {
  20343. prelude: atrule.syntax.trim().match(/^@\S+\s+([^;\{]*)/)[1].trim() || null,
  20344. descriptors
  20345. };
  20346. }
  20347. return result;
  20348. }
  20349. function buildDictionary(dict, patchDict) {
  20350. var result = {};
  20351. // copy all syntaxes for an original dict
  20352. for (var key in dict) {
  20353. result[key] = dict[key].syntax;
  20354. }
  20355. // apply a patch
  20356. for (var key in patchDict) {
  20357. if (key in dict) {
  20358. if (patchDict[key].syntax) {
  20359. result[key] = patchDict[key].syntax;
  20360. } else {
  20361. delete result[key];
  20362. }
  20363. } else {
  20364. if (patchDict[key].syntax) {
  20365. result[key] = patchDict[key].syntax;
  20366. }
  20367. }
  20368. }
  20369. return result;
  20370. }
  20371. var data = {
  20372. types: buildDictionary(mdnSyntaxes, patch$2.syntaxes),
  20373. atrules: preprocessAtrules(mdnAtrules),
  20374. properties: buildDictionary(mdnProperties, patch$2.properties)
  20375. };
  20376. var cmpChar$3 = tokenizer.cmpChar;
  20377. var isDigit$4 = tokenizer.isDigit;
  20378. var TYPE$9 = tokenizer.TYPE;
  20379. var WHITESPACE$4 = TYPE$9.WhiteSpace;
  20380. var COMMENT$3 = TYPE$9.Comment;
  20381. var IDENT$3 = TYPE$9.Ident;
  20382. var NUMBER$3 = TYPE$9.Number;
  20383. var DIMENSION$2 = TYPE$9.Dimension;
  20384. var PLUSSIGN$3 = 0x002B; // U+002B PLUS SIGN (+)
  20385. var HYPHENMINUS$3 = 0x002D; // U+002D HYPHEN-MINUS (-)
  20386. var N$4 = 0x006E; // U+006E LATIN SMALL LETTER N (n)
  20387. var DISALLOW_SIGN$1 = true;
  20388. var ALLOW_SIGN$1 = false;
  20389. function checkInteger$1(offset, disallowSign) {
  20390. var pos = this.scanner.tokenStart + offset;
  20391. var code = this.scanner.source.charCodeAt(pos);
  20392. if (code === PLUSSIGN$3 || code === HYPHENMINUS$3) {
  20393. if (disallowSign) {
  20394. this.error('Number sign is not allowed');
  20395. }
  20396. pos++;
  20397. }
  20398. for (; pos < this.scanner.tokenEnd; pos++) {
  20399. if (!isDigit$4(this.scanner.source.charCodeAt(pos))) {
  20400. this.error('Integer is expected', pos);
  20401. }
  20402. }
  20403. }
  20404. function checkTokenIsInteger(disallowSign) {
  20405. return checkInteger$1.call(this, 0, disallowSign);
  20406. }
  20407. function expectCharCode(offset, code) {
  20408. if (!cmpChar$3(this.scanner.source, this.scanner.tokenStart + offset, code)) {
  20409. var msg = '';
  20410. switch (code) {
  20411. case N$4:
  20412. msg = 'N is expected';
  20413. break;
  20414. case HYPHENMINUS$3:
  20415. msg = 'HyphenMinus is expected';
  20416. break;
  20417. }
  20418. this.error(msg, this.scanner.tokenStart + offset);
  20419. }
  20420. }
  20421. // ... <signed-integer>
  20422. // ... ['+' | '-'] <signless-integer>
  20423. function consumeB$1() {
  20424. var offset = 0;
  20425. var sign = 0;
  20426. var type = this.scanner.tokenType;
  20427. while (type === WHITESPACE$4 || type === COMMENT$3) {
  20428. type = this.scanner.lookupType(++offset);
  20429. }
  20430. if (type !== NUMBER$3) {
  20431. if (this.scanner.isDelim(PLUSSIGN$3, offset) ||
  20432. this.scanner.isDelim(HYPHENMINUS$3, offset)) {
  20433. sign = this.scanner.isDelim(PLUSSIGN$3, offset) ? PLUSSIGN$3 : HYPHENMINUS$3;
  20434. do {
  20435. type = this.scanner.lookupType(++offset);
  20436. } while (type === WHITESPACE$4 || type === COMMENT$3);
  20437. if (type !== NUMBER$3) {
  20438. this.scanner.skip(offset);
  20439. checkTokenIsInteger.call(this, DISALLOW_SIGN$1);
  20440. }
  20441. } else {
  20442. return null;
  20443. }
  20444. }
  20445. if (offset > 0) {
  20446. this.scanner.skip(offset);
  20447. }
  20448. if (sign === 0) {
  20449. type = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  20450. if (type !== PLUSSIGN$3 && type !== HYPHENMINUS$3) {
  20451. this.error('Number sign is expected');
  20452. }
  20453. }
  20454. checkTokenIsInteger.call(this, sign !== 0);
  20455. return sign === HYPHENMINUS$3 ? '-' + this.consume(NUMBER$3) : this.consume(NUMBER$3);
  20456. }
  20457. // An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
  20458. var AnPlusB = {
  20459. name: 'AnPlusB',
  20460. structure: {
  20461. a: [String, null],
  20462. b: [String, null]
  20463. },
  20464. parse: function() {
  20465. /* eslint-disable brace-style*/
  20466. var start = this.scanner.tokenStart;
  20467. var a = null;
  20468. var b = null;
  20469. // <integer>
  20470. if (this.scanner.tokenType === NUMBER$3) {
  20471. checkTokenIsInteger.call(this, ALLOW_SIGN$1);
  20472. b = this.consume(NUMBER$3);
  20473. }
  20474. // -n
  20475. // -n <signed-integer>
  20476. // -n ['+' | '-'] <signless-integer>
  20477. // -n- <signless-integer>
  20478. // <dashndashdigit-ident>
  20479. else if (this.scanner.tokenType === IDENT$3 && cmpChar$3(this.scanner.source, this.scanner.tokenStart, HYPHENMINUS$3)) {
  20480. a = '-1';
  20481. expectCharCode.call(this, 1, N$4);
  20482. switch (this.scanner.getTokenLength()) {
  20483. // -n
  20484. // -n <signed-integer>
  20485. // -n ['+' | '-'] <signless-integer>
  20486. case 2:
  20487. this.scanner.next();
  20488. b = consumeB$1.call(this);
  20489. break;
  20490. // -n- <signless-integer>
  20491. case 3:
  20492. expectCharCode.call(this, 2, HYPHENMINUS$3);
  20493. this.scanner.next();
  20494. this.scanner.skipSC();
  20495. checkTokenIsInteger.call(this, DISALLOW_SIGN$1);
  20496. b = '-' + this.consume(NUMBER$3);
  20497. break;
  20498. // <dashndashdigit-ident>
  20499. default:
  20500. expectCharCode.call(this, 2, HYPHENMINUS$3);
  20501. checkInteger$1.call(this, 3, DISALLOW_SIGN$1);
  20502. this.scanner.next();
  20503. b = this.scanner.substrToCursor(start + 2);
  20504. }
  20505. }
  20506. // '+'? n
  20507. // '+'? n <signed-integer>
  20508. // '+'? n ['+' | '-'] <signless-integer>
  20509. // '+'? n- <signless-integer>
  20510. // '+'? <ndashdigit-ident>
  20511. else if (this.scanner.tokenType === IDENT$3 || (this.scanner.isDelim(PLUSSIGN$3) && this.scanner.lookupType(1) === IDENT$3)) {
  20512. var sign = 0;
  20513. a = '1';
  20514. // just ignore a plus
  20515. if (this.scanner.isDelim(PLUSSIGN$3)) {
  20516. sign = 1;
  20517. this.scanner.next();
  20518. }
  20519. expectCharCode.call(this, 0, N$4);
  20520. switch (this.scanner.getTokenLength()) {
  20521. // '+'? n
  20522. // '+'? n <signed-integer>
  20523. // '+'? n ['+' | '-'] <signless-integer>
  20524. case 1:
  20525. this.scanner.next();
  20526. b = consumeB$1.call(this);
  20527. break;
  20528. // '+'? n- <signless-integer>
  20529. case 2:
  20530. expectCharCode.call(this, 1, HYPHENMINUS$3);
  20531. this.scanner.next();
  20532. this.scanner.skipSC();
  20533. checkTokenIsInteger.call(this, DISALLOW_SIGN$1);
  20534. b = '-' + this.consume(NUMBER$3);
  20535. break;
  20536. // '+'? <ndashdigit-ident>
  20537. default:
  20538. expectCharCode.call(this, 1, HYPHENMINUS$3);
  20539. checkInteger$1.call(this, 2, DISALLOW_SIGN$1);
  20540. this.scanner.next();
  20541. b = this.scanner.substrToCursor(start + sign + 1);
  20542. }
  20543. }
  20544. // <ndashdigit-dimension>
  20545. // <ndash-dimension> <signless-integer>
  20546. // <n-dimension>
  20547. // <n-dimension> <signed-integer>
  20548. // <n-dimension> ['+' | '-'] <signless-integer>
  20549. else if (this.scanner.tokenType === DIMENSION$2) {
  20550. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  20551. var sign = code === PLUSSIGN$3 || code === HYPHENMINUS$3;
  20552. for (var i = this.scanner.tokenStart + sign; i < this.scanner.tokenEnd; i++) {
  20553. if (!isDigit$4(this.scanner.source.charCodeAt(i))) {
  20554. break;
  20555. }
  20556. }
  20557. if (i === this.scanner.tokenStart + sign) {
  20558. this.error('Integer is expected', this.scanner.tokenStart + sign);
  20559. }
  20560. expectCharCode.call(this, i - this.scanner.tokenStart, N$4);
  20561. a = this.scanner.source.substring(start, i);
  20562. // <n-dimension>
  20563. // <n-dimension> <signed-integer>
  20564. // <n-dimension> ['+' | '-'] <signless-integer>
  20565. if (i + 1 === this.scanner.tokenEnd) {
  20566. this.scanner.next();
  20567. b = consumeB$1.call(this);
  20568. } else {
  20569. expectCharCode.call(this, i - this.scanner.tokenStart + 1, HYPHENMINUS$3);
  20570. // <ndash-dimension> <signless-integer>
  20571. if (i + 2 === this.scanner.tokenEnd) {
  20572. this.scanner.next();
  20573. this.scanner.skipSC();
  20574. checkTokenIsInteger.call(this, DISALLOW_SIGN$1);
  20575. b = '-' + this.consume(NUMBER$3);
  20576. }
  20577. // <ndashdigit-dimension>
  20578. else {
  20579. checkInteger$1.call(this, i - this.scanner.tokenStart + 2, DISALLOW_SIGN$1);
  20580. this.scanner.next();
  20581. b = this.scanner.substrToCursor(i + 1);
  20582. }
  20583. }
  20584. } else {
  20585. this.error();
  20586. }
  20587. if (a !== null && a.charCodeAt(0) === PLUSSIGN$3) {
  20588. a = a.substr(1);
  20589. }
  20590. if (b !== null && b.charCodeAt(0) === PLUSSIGN$3) {
  20591. b = b.substr(1);
  20592. }
  20593. return {
  20594. type: 'AnPlusB',
  20595. loc: this.getLocation(start, this.scanner.tokenStart),
  20596. a: a,
  20597. b: b
  20598. };
  20599. },
  20600. generate: function(node) {
  20601. var a = node.a !== null && node.a !== undefined;
  20602. var b = node.b !== null && node.b !== undefined;
  20603. if (a) {
  20604. this.chunk(
  20605. node.a === '+1' ? '+n' : // eslint-disable-line operator-linebreak, indent
  20606. node.a === '1' ? 'n' : // eslint-disable-line operator-linebreak, indent
  20607. node.a === '-1' ? '-n' : // eslint-disable-line operator-linebreak, indent
  20608. node.a + 'n' // eslint-disable-line operator-linebreak, indent
  20609. );
  20610. if (b) {
  20611. b = String(node.b);
  20612. if (b.charAt(0) === '-' || b.charAt(0) === '+') {
  20613. this.chunk(b.charAt(0));
  20614. this.chunk(b.substr(1));
  20615. } else {
  20616. this.chunk('+');
  20617. this.chunk(b);
  20618. }
  20619. }
  20620. } else {
  20621. this.chunk(String(node.b));
  20622. }
  20623. }
  20624. };
  20625. var TYPE$a = tokenizer.TYPE;
  20626. var WhiteSpace = TYPE$a.WhiteSpace;
  20627. var Semicolon = TYPE$a.Semicolon;
  20628. var LeftCurlyBracket = TYPE$a.LeftCurlyBracket;
  20629. var Delim = TYPE$a.Delim;
  20630. var EXCLAMATIONMARK$1 = 0x0021; // U+0021 EXCLAMATION MARK (!)
  20631. function getOffsetExcludeWS() {
  20632. if (this.scanner.tokenIndex > 0) {
  20633. if (this.scanner.lookupType(-1) === WhiteSpace) {
  20634. return this.scanner.tokenIndex > 1
  20635. ? this.scanner.getTokenStart(this.scanner.tokenIndex - 1)
  20636. : this.scanner.firstCharOffset;
  20637. }
  20638. }
  20639. return this.scanner.tokenStart;
  20640. }
  20641. // 0, 0, false
  20642. function balanceEnd() {
  20643. return 0;
  20644. }
  20645. // LEFTCURLYBRACKET, 0, false
  20646. function leftCurlyBracket(tokenType) {
  20647. return tokenType === LeftCurlyBracket ? 1 : 0;
  20648. }
  20649. // LEFTCURLYBRACKET, SEMICOLON, false
  20650. function leftCurlyBracketOrSemicolon(tokenType) {
  20651. return tokenType === LeftCurlyBracket || tokenType === Semicolon ? 1 : 0;
  20652. }
  20653. // EXCLAMATIONMARK, SEMICOLON, false
  20654. function exclamationMarkOrSemicolon(tokenType, source, offset) {
  20655. if (tokenType === Delim && source.charCodeAt(offset) === EXCLAMATIONMARK$1) {
  20656. return 1;
  20657. }
  20658. return tokenType === Semicolon ? 1 : 0;
  20659. }
  20660. // 0, SEMICOLON, true
  20661. function semicolonIncluded(tokenType) {
  20662. return tokenType === Semicolon ? 2 : 0;
  20663. }
  20664. var Raw = {
  20665. name: 'Raw',
  20666. structure: {
  20667. value: String
  20668. },
  20669. parse: function(startToken, mode, excludeWhiteSpace) {
  20670. var startOffset = this.scanner.getTokenStart(startToken);
  20671. var endOffset;
  20672. this.scanner.skip(
  20673. this.scanner.getRawLength(startToken, mode || balanceEnd)
  20674. );
  20675. if (excludeWhiteSpace && this.scanner.tokenStart > startOffset) {
  20676. endOffset = getOffsetExcludeWS.call(this);
  20677. } else {
  20678. endOffset = this.scanner.tokenStart;
  20679. }
  20680. return {
  20681. type: 'Raw',
  20682. loc: this.getLocation(startOffset, endOffset),
  20683. value: this.scanner.source.substring(startOffset, endOffset)
  20684. };
  20685. },
  20686. generate: function(node) {
  20687. this.chunk(node.value);
  20688. },
  20689. mode: {
  20690. default: balanceEnd,
  20691. leftCurlyBracket: leftCurlyBracket,
  20692. leftCurlyBracketOrSemicolon: leftCurlyBracketOrSemicolon,
  20693. exclamationMarkOrSemicolon: exclamationMarkOrSemicolon,
  20694. semicolonIncluded: semicolonIncluded
  20695. }
  20696. };
  20697. var TYPE$b = tokenizer.TYPE;
  20698. var rawMode = Raw.mode;
  20699. var ATKEYWORD = TYPE$b.AtKeyword;
  20700. var SEMICOLON = TYPE$b.Semicolon;
  20701. var LEFTCURLYBRACKET$1 = TYPE$b.LeftCurlyBracket;
  20702. var RIGHTCURLYBRACKET$1 = TYPE$b.RightCurlyBracket;
  20703. function consumeRaw(startToken) {
  20704. return this.Raw(startToken, rawMode.leftCurlyBracketOrSemicolon, true);
  20705. }
  20706. function isDeclarationBlockAtrule() {
  20707. for (var offset = 1, type; type = this.scanner.lookupType(offset); offset++) {
  20708. if (type === RIGHTCURLYBRACKET$1) {
  20709. return true;
  20710. }
  20711. if (type === LEFTCURLYBRACKET$1 ||
  20712. type === ATKEYWORD) {
  20713. return false;
  20714. }
  20715. }
  20716. return false;
  20717. }
  20718. var Atrule = {
  20719. name: 'Atrule',
  20720. structure: {
  20721. name: String,
  20722. prelude: ['AtrulePrelude', 'Raw', null],
  20723. block: ['Block', null]
  20724. },
  20725. parse: function() {
  20726. var start = this.scanner.tokenStart;
  20727. var name;
  20728. var nameLowerCase;
  20729. var prelude = null;
  20730. var block = null;
  20731. this.eat(ATKEYWORD);
  20732. name = this.scanner.substrToCursor(start + 1);
  20733. nameLowerCase = name.toLowerCase();
  20734. this.scanner.skipSC();
  20735. // parse prelude
  20736. if (this.scanner.eof === false &&
  20737. this.scanner.tokenType !== LEFTCURLYBRACKET$1 &&
  20738. this.scanner.tokenType !== SEMICOLON) {
  20739. if (this.parseAtrulePrelude) {
  20740. prelude = this.parseWithFallback(this.AtrulePrelude.bind(this, name), consumeRaw);
  20741. // turn empty AtrulePrelude into null
  20742. if (prelude.type === 'AtrulePrelude' && prelude.children.head === null) {
  20743. prelude = null;
  20744. }
  20745. } else {
  20746. prelude = consumeRaw.call(this, this.scanner.tokenIndex);
  20747. }
  20748. this.scanner.skipSC();
  20749. }
  20750. switch (this.scanner.tokenType) {
  20751. case SEMICOLON:
  20752. this.scanner.next();
  20753. break;
  20754. case LEFTCURLYBRACKET$1:
  20755. if (this.atrule.hasOwnProperty(nameLowerCase) &&
  20756. typeof this.atrule[nameLowerCase].block === 'function') {
  20757. block = this.atrule[nameLowerCase].block.call(this);
  20758. } else {
  20759. // TODO: should consume block content as Raw?
  20760. block = this.Block(isDeclarationBlockAtrule.call(this));
  20761. }
  20762. break;
  20763. }
  20764. return {
  20765. type: 'Atrule',
  20766. loc: this.getLocation(start, this.scanner.tokenStart),
  20767. name: name,
  20768. prelude: prelude,
  20769. block: block
  20770. };
  20771. },
  20772. generate: function(node) {
  20773. this.chunk('@');
  20774. this.chunk(node.name);
  20775. if (node.prelude !== null) {
  20776. this.chunk(' ');
  20777. this.node(node.prelude);
  20778. }
  20779. if (node.block) {
  20780. this.node(node.block);
  20781. } else {
  20782. this.chunk(';');
  20783. }
  20784. },
  20785. walkContext: 'atrule'
  20786. };
  20787. var TYPE$c = tokenizer.TYPE;
  20788. var SEMICOLON$1 = TYPE$c.Semicolon;
  20789. var LEFTCURLYBRACKET$2 = TYPE$c.LeftCurlyBracket;
  20790. var AtrulePrelude = {
  20791. name: 'AtrulePrelude',
  20792. structure: {
  20793. children: [[]]
  20794. },
  20795. parse: function(name) {
  20796. var children = null;
  20797. if (name !== null) {
  20798. name = name.toLowerCase();
  20799. }
  20800. this.scanner.skipSC();
  20801. if (this.atrule.hasOwnProperty(name) &&
  20802. typeof this.atrule[name].prelude === 'function') {
  20803. // custom consumer
  20804. children = this.atrule[name].prelude.call(this);
  20805. } else {
  20806. // default consumer
  20807. children = this.readSequence(this.scope.AtrulePrelude);
  20808. }
  20809. this.scanner.skipSC();
  20810. if (this.scanner.eof !== true &&
  20811. this.scanner.tokenType !== LEFTCURLYBRACKET$2 &&
  20812. this.scanner.tokenType !== SEMICOLON$1) {
  20813. this.error('Semicolon or block is expected');
  20814. }
  20815. if (children === null) {
  20816. children = this.createList();
  20817. }
  20818. return {
  20819. type: 'AtrulePrelude',
  20820. loc: this.getLocationFromList(children),
  20821. children: children
  20822. };
  20823. },
  20824. generate: function(node) {
  20825. this.children(node);
  20826. },
  20827. walkContext: 'atrulePrelude'
  20828. };
  20829. var TYPE$d = tokenizer.TYPE;
  20830. var IDENT$4 = TYPE$d.Ident;
  20831. var STRING = TYPE$d.String;
  20832. var COLON = TYPE$d.Colon;
  20833. var LEFTSQUAREBRACKET$1 = TYPE$d.LeftSquareBracket;
  20834. var RIGHTSQUAREBRACKET$1 = TYPE$d.RightSquareBracket;
  20835. var DOLLARSIGN = 0x0024; // U+0024 DOLLAR SIGN ($)
  20836. var ASTERISK$1 = 0x002A; // U+002A ASTERISK (*)
  20837. var EQUALSSIGN = 0x003D; // U+003D EQUALS SIGN (=)
  20838. var CIRCUMFLEXACCENT = 0x005E; // U+005E (^)
  20839. var VERTICALLINE$1 = 0x007C; // U+007C VERTICAL LINE (|)
  20840. var TILDE = 0x007E; // U+007E TILDE (~)
  20841. function getAttributeName() {
  20842. if (this.scanner.eof) {
  20843. this.error('Unexpected end of input');
  20844. }
  20845. var start = this.scanner.tokenStart;
  20846. var expectIdent = false;
  20847. var checkColon = true;
  20848. if (this.scanner.isDelim(ASTERISK$1)) {
  20849. expectIdent = true;
  20850. checkColon = false;
  20851. this.scanner.next();
  20852. } else if (!this.scanner.isDelim(VERTICALLINE$1)) {
  20853. this.eat(IDENT$4);
  20854. }
  20855. if (this.scanner.isDelim(VERTICALLINE$1)) {
  20856. if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 1) !== EQUALSSIGN) {
  20857. this.scanner.next();
  20858. this.eat(IDENT$4);
  20859. } else if (expectIdent) {
  20860. this.error('Identifier is expected', this.scanner.tokenEnd);
  20861. }
  20862. } else if (expectIdent) {
  20863. this.error('Vertical line is expected');
  20864. }
  20865. if (checkColon && this.scanner.tokenType === COLON) {
  20866. this.scanner.next();
  20867. this.eat(IDENT$4);
  20868. }
  20869. return {
  20870. type: 'Identifier',
  20871. loc: this.getLocation(start, this.scanner.tokenStart),
  20872. name: this.scanner.substrToCursor(start)
  20873. };
  20874. }
  20875. function getOperator() {
  20876. var start = this.scanner.tokenStart;
  20877. var code = this.scanner.source.charCodeAt(start);
  20878. if (code !== EQUALSSIGN && // =
  20879. code !== TILDE && // ~=
  20880. code !== CIRCUMFLEXACCENT && // ^=
  20881. code !== DOLLARSIGN && // $=
  20882. code !== ASTERISK$1 && // *=
  20883. code !== VERTICALLINE$1 // |=
  20884. ) {
  20885. this.error('Attribute selector (=, ~=, ^=, $=, *=, |=) is expected');
  20886. }
  20887. this.scanner.next();
  20888. if (code !== EQUALSSIGN) {
  20889. if (!this.scanner.isDelim(EQUALSSIGN)) {
  20890. this.error('Equal sign is expected');
  20891. }
  20892. this.scanner.next();
  20893. }
  20894. return this.scanner.substrToCursor(start);
  20895. }
  20896. // '[' <wq-name> ']'
  20897. // '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'
  20898. var AttributeSelector = {
  20899. name: 'AttributeSelector',
  20900. structure: {
  20901. name: 'Identifier',
  20902. matcher: [String, null],
  20903. value: ['String', 'Identifier', null],
  20904. flags: [String, null]
  20905. },
  20906. parse: function() {
  20907. var start = this.scanner.tokenStart;
  20908. var name;
  20909. var matcher = null;
  20910. var value = null;
  20911. var flags = null;
  20912. this.eat(LEFTSQUAREBRACKET$1);
  20913. this.scanner.skipSC();
  20914. name = getAttributeName.call(this);
  20915. this.scanner.skipSC();
  20916. if (this.scanner.tokenType !== RIGHTSQUAREBRACKET$1) {
  20917. // avoid case `[name i]`
  20918. if (this.scanner.tokenType !== IDENT$4) {
  20919. matcher = getOperator.call(this);
  20920. this.scanner.skipSC();
  20921. value = this.scanner.tokenType === STRING
  20922. ? this.String()
  20923. : this.Identifier();
  20924. this.scanner.skipSC();
  20925. }
  20926. // attribute flags
  20927. if (this.scanner.tokenType === IDENT$4) {
  20928. flags = this.scanner.getTokenValue();
  20929. this.scanner.next();
  20930. this.scanner.skipSC();
  20931. }
  20932. }
  20933. this.eat(RIGHTSQUAREBRACKET$1);
  20934. return {
  20935. type: 'AttributeSelector',
  20936. loc: this.getLocation(start, this.scanner.tokenStart),
  20937. name: name,
  20938. matcher: matcher,
  20939. value: value,
  20940. flags: flags
  20941. };
  20942. },
  20943. generate: function(node) {
  20944. var flagsPrefix = ' ';
  20945. this.chunk('[');
  20946. this.node(node.name);
  20947. if (node.matcher !== null) {
  20948. this.chunk(node.matcher);
  20949. if (node.value !== null) {
  20950. this.node(node.value);
  20951. // space between string and flags is not required
  20952. if (node.value.type === 'String') {
  20953. flagsPrefix = '';
  20954. }
  20955. }
  20956. }
  20957. if (node.flags !== null) {
  20958. this.chunk(flagsPrefix);
  20959. this.chunk(node.flags);
  20960. }
  20961. this.chunk(']');
  20962. }
  20963. };
  20964. var TYPE$e = tokenizer.TYPE;
  20965. var rawMode$1 = Raw.mode;
  20966. var WHITESPACE$5 = TYPE$e.WhiteSpace;
  20967. var COMMENT$4 = TYPE$e.Comment;
  20968. var SEMICOLON$2 = TYPE$e.Semicolon;
  20969. var ATKEYWORD$1 = TYPE$e.AtKeyword;
  20970. var LEFTCURLYBRACKET$3 = TYPE$e.LeftCurlyBracket;
  20971. var RIGHTCURLYBRACKET$2 = TYPE$e.RightCurlyBracket;
  20972. function consumeRaw$1(startToken) {
  20973. return this.Raw(startToken, null, true);
  20974. }
  20975. function consumeRule() {
  20976. return this.parseWithFallback(this.Rule, consumeRaw$1);
  20977. }
  20978. function consumeRawDeclaration(startToken) {
  20979. return this.Raw(startToken, rawMode$1.semicolonIncluded, true);
  20980. }
  20981. function consumeDeclaration() {
  20982. if (this.scanner.tokenType === SEMICOLON$2) {
  20983. return consumeRawDeclaration.call(this, this.scanner.tokenIndex);
  20984. }
  20985. var node = this.parseWithFallback(this.Declaration, consumeRawDeclaration);
  20986. if (this.scanner.tokenType === SEMICOLON$2) {
  20987. this.scanner.next();
  20988. }
  20989. return node;
  20990. }
  20991. var Block = {
  20992. name: 'Block',
  20993. structure: {
  20994. children: [[
  20995. 'Atrule',
  20996. 'Rule',
  20997. 'Declaration'
  20998. ]]
  20999. },
  21000. parse: function(isDeclaration) {
  21001. var consumer = isDeclaration ? consumeDeclaration : consumeRule;
  21002. var start = this.scanner.tokenStart;
  21003. var children = this.createList();
  21004. this.eat(LEFTCURLYBRACKET$3);
  21005. scan:
  21006. while (!this.scanner.eof) {
  21007. switch (this.scanner.tokenType) {
  21008. case RIGHTCURLYBRACKET$2:
  21009. break scan;
  21010. case WHITESPACE$5:
  21011. case COMMENT$4:
  21012. this.scanner.next();
  21013. break;
  21014. case ATKEYWORD$1:
  21015. children.push(this.parseWithFallback(this.Atrule, consumeRaw$1));
  21016. break;
  21017. default:
  21018. children.push(consumer.call(this));
  21019. }
  21020. }
  21021. if (!this.scanner.eof) {
  21022. this.eat(RIGHTCURLYBRACKET$2);
  21023. }
  21024. return {
  21025. type: 'Block',
  21026. loc: this.getLocation(start, this.scanner.tokenStart),
  21027. children: children
  21028. };
  21029. },
  21030. generate: function(node) {
  21031. this.chunk('{');
  21032. this.children(node, function(prev) {
  21033. if (prev.type === 'Declaration') {
  21034. this.chunk(';');
  21035. }
  21036. });
  21037. this.chunk('}');
  21038. },
  21039. walkContext: 'block'
  21040. };
  21041. var TYPE$f = tokenizer.TYPE;
  21042. var LEFTSQUAREBRACKET$2 = TYPE$f.LeftSquareBracket;
  21043. var RIGHTSQUAREBRACKET$2 = TYPE$f.RightSquareBracket;
  21044. var Brackets = {
  21045. name: 'Brackets',
  21046. structure: {
  21047. children: [[]]
  21048. },
  21049. parse: function(readSequence, recognizer) {
  21050. var start = this.scanner.tokenStart;
  21051. var children = null;
  21052. this.eat(LEFTSQUAREBRACKET$2);
  21053. children = readSequence.call(this, recognizer);
  21054. if (!this.scanner.eof) {
  21055. this.eat(RIGHTSQUAREBRACKET$2);
  21056. }
  21057. return {
  21058. type: 'Brackets',
  21059. loc: this.getLocation(start, this.scanner.tokenStart),
  21060. children: children
  21061. };
  21062. },
  21063. generate: function(node) {
  21064. this.chunk('[');
  21065. this.children(node);
  21066. this.chunk(']');
  21067. }
  21068. };
  21069. var CDC = tokenizer.TYPE.CDC;
  21070. var CDC_1 = {
  21071. name: 'CDC',
  21072. structure: [],
  21073. parse: function() {
  21074. var start = this.scanner.tokenStart;
  21075. this.eat(CDC); // -->
  21076. return {
  21077. type: 'CDC',
  21078. loc: this.getLocation(start, this.scanner.tokenStart)
  21079. };
  21080. },
  21081. generate: function() {
  21082. this.chunk('-->');
  21083. }
  21084. };
  21085. var CDO = tokenizer.TYPE.CDO;
  21086. var CDO_1 = {
  21087. name: 'CDO',
  21088. structure: [],
  21089. parse: function() {
  21090. var start = this.scanner.tokenStart;
  21091. this.eat(CDO); // <!--
  21092. return {
  21093. type: 'CDO',
  21094. loc: this.getLocation(start, this.scanner.tokenStart)
  21095. };
  21096. },
  21097. generate: function() {
  21098. this.chunk('<!--');
  21099. }
  21100. };
  21101. var TYPE$g = tokenizer.TYPE;
  21102. var IDENT$5 = TYPE$g.Ident;
  21103. var FULLSTOP = 0x002E; // U+002E FULL STOP (.)
  21104. // '.' ident
  21105. var ClassSelector = {
  21106. name: 'ClassSelector',
  21107. structure: {
  21108. name: String
  21109. },
  21110. parse: function() {
  21111. if (!this.scanner.isDelim(FULLSTOP)) {
  21112. this.error('Full stop is expected');
  21113. }
  21114. this.scanner.next();
  21115. return {
  21116. type: 'ClassSelector',
  21117. loc: this.getLocation(this.scanner.tokenStart - 1, this.scanner.tokenEnd),
  21118. name: this.consume(IDENT$5)
  21119. };
  21120. },
  21121. generate: function(node) {
  21122. this.chunk('.');
  21123. this.chunk(node.name);
  21124. }
  21125. };
  21126. var TYPE$h = tokenizer.TYPE;
  21127. var IDENT$6 = TYPE$h.Ident;
  21128. var PLUSSIGN$4 = 0x002B; // U+002B PLUS SIGN (+)
  21129. var SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
  21130. var GREATERTHANSIGN$1 = 0x003E; // U+003E GREATER-THAN SIGN (>)
  21131. var TILDE$1 = 0x007E; // U+007E TILDE (~)
  21132. // + | > | ~ | /deep/
  21133. var Combinator = {
  21134. name: 'Combinator',
  21135. structure: {
  21136. name: String
  21137. },
  21138. parse: function() {
  21139. var start = this.scanner.tokenStart;
  21140. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  21141. switch (code) {
  21142. case GREATERTHANSIGN$1:
  21143. case PLUSSIGN$4:
  21144. case TILDE$1:
  21145. this.scanner.next();
  21146. break;
  21147. case SOLIDUS:
  21148. this.scanner.next();
  21149. if (this.scanner.tokenType !== IDENT$6 || this.scanner.lookupValue(0, 'deep') === false) {
  21150. this.error('Identifier `deep` is expected');
  21151. }
  21152. this.scanner.next();
  21153. if (!this.scanner.isDelim(SOLIDUS)) {
  21154. this.error('Solidus is expected');
  21155. }
  21156. this.scanner.next();
  21157. break;
  21158. default:
  21159. this.error('Combinator is expected');
  21160. }
  21161. return {
  21162. type: 'Combinator',
  21163. loc: this.getLocation(start, this.scanner.tokenStart),
  21164. name: this.scanner.substrToCursor(start)
  21165. };
  21166. },
  21167. generate: function(node) {
  21168. this.chunk(node.name);
  21169. }
  21170. };
  21171. var TYPE$i = tokenizer.TYPE;
  21172. var COMMENT$5 = TYPE$i.Comment;
  21173. var ASTERISK$2 = 0x002A; // U+002A ASTERISK (*)
  21174. var SOLIDUS$1 = 0x002F; // U+002F SOLIDUS (/)
  21175. // '/*' .* '*/'
  21176. var Comment = {
  21177. name: 'Comment',
  21178. structure: {
  21179. value: String
  21180. },
  21181. parse: function() {
  21182. var start = this.scanner.tokenStart;
  21183. var end = this.scanner.tokenEnd;
  21184. this.eat(COMMENT$5);
  21185. if ((end - start + 2) >= 2 &&
  21186. this.scanner.source.charCodeAt(end - 2) === ASTERISK$2 &&
  21187. this.scanner.source.charCodeAt(end - 1) === SOLIDUS$1) {
  21188. end -= 2;
  21189. }
  21190. return {
  21191. type: 'Comment',
  21192. loc: this.getLocation(start, this.scanner.tokenStart),
  21193. value: this.scanner.source.substring(start + 2, end)
  21194. };
  21195. },
  21196. generate: function(node) {
  21197. this.chunk('/*');
  21198. this.chunk(node.value);
  21199. this.chunk('*/');
  21200. }
  21201. };
  21202. var isCustomProperty$1 = names.isCustomProperty;
  21203. var TYPE$j = tokenizer.TYPE;
  21204. var rawMode$2 = Raw.mode;
  21205. var IDENT$7 = TYPE$j.Ident;
  21206. var HASH$1 = TYPE$j.Hash;
  21207. var COLON$1 = TYPE$j.Colon;
  21208. var SEMICOLON$3 = TYPE$j.Semicolon;
  21209. var DELIM$2 = TYPE$j.Delim;
  21210. var EXCLAMATIONMARK$2 = 0x0021; // U+0021 EXCLAMATION MARK (!)
  21211. var NUMBERSIGN$2 = 0x0023; // U+0023 NUMBER SIGN (#)
  21212. var DOLLARSIGN$1 = 0x0024; // U+0024 DOLLAR SIGN ($)
  21213. var AMPERSAND$1 = 0x0026; // U+0026 ANPERSAND (&)
  21214. var ASTERISK$3 = 0x002A; // U+002A ASTERISK (*)
  21215. var PLUSSIGN$5 = 0x002B; // U+002B PLUS SIGN (+)
  21216. var SOLIDUS$2 = 0x002F; // U+002F SOLIDUS (/)
  21217. function consumeValueRaw(startToken) {
  21218. return this.Raw(startToken, rawMode$2.exclamationMarkOrSemicolon, true);
  21219. }
  21220. function consumeCustomPropertyRaw(startToken) {
  21221. return this.Raw(startToken, rawMode$2.exclamationMarkOrSemicolon, false);
  21222. }
  21223. function consumeValue() {
  21224. var startValueToken = this.scanner.tokenIndex;
  21225. var value = this.Value();
  21226. if (value.type !== 'Raw' &&
  21227. this.scanner.eof === false &&
  21228. this.scanner.tokenType !== SEMICOLON$3 &&
  21229. this.scanner.isDelim(EXCLAMATIONMARK$2) === false &&
  21230. this.scanner.isBalanceEdge(startValueToken) === false) {
  21231. this.error();
  21232. }
  21233. return value;
  21234. }
  21235. var Declaration = {
  21236. name: 'Declaration',
  21237. structure: {
  21238. important: [Boolean, String],
  21239. property: String,
  21240. value: ['Value', 'Raw']
  21241. },
  21242. parse: function() {
  21243. var start = this.scanner.tokenStart;
  21244. var startToken = this.scanner.tokenIndex;
  21245. var property = readProperty$1.call(this);
  21246. var customProperty = isCustomProperty$1(property);
  21247. var parseValue = customProperty ? this.parseCustomProperty : this.parseValue;
  21248. var consumeRaw = customProperty ? consumeCustomPropertyRaw : consumeValueRaw;
  21249. var important = false;
  21250. var value;
  21251. this.scanner.skipSC();
  21252. this.eat(COLON$1);
  21253. if (!customProperty) {
  21254. this.scanner.skipSC();
  21255. }
  21256. if (parseValue) {
  21257. value = this.parseWithFallback(consumeValue, consumeRaw);
  21258. } else {
  21259. value = consumeRaw.call(this, this.scanner.tokenIndex);
  21260. }
  21261. if (this.scanner.isDelim(EXCLAMATIONMARK$2)) {
  21262. important = getImportant.call(this);
  21263. this.scanner.skipSC();
  21264. }
  21265. // Do not include semicolon to range per spec
  21266. // https://drafts.csswg.org/css-syntax/#declaration-diagram
  21267. if (this.scanner.eof === false &&
  21268. this.scanner.tokenType !== SEMICOLON$3 &&
  21269. this.scanner.isBalanceEdge(startToken) === false) {
  21270. this.error();
  21271. }
  21272. return {
  21273. type: 'Declaration',
  21274. loc: this.getLocation(start, this.scanner.tokenStart),
  21275. important: important,
  21276. property: property,
  21277. value: value
  21278. };
  21279. },
  21280. generate: function(node) {
  21281. this.chunk(node.property);
  21282. this.chunk(':');
  21283. this.node(node.value);
  21284. if (node.important) {
  21285. this.chunk(node.important === true ? '!important' : '!' + node.important);
  21286. }
  21287. },
  21288. walkContext: 'declaration'
  21289. };
  21290. function readProperty$1() {
  21291. var start = this.scanner.tokenStart;
  21292. // hacks
  21293. if (this.scanner.tokenType === DELIM$2) {
  21294. switch (this.scanner.source.charCodeAt(this.scanner.tokenStart)) {
  21295. case ASTERISK$3:
  21296. case DOLLARSIGN$1:
  21297. case PLUSSIGN$5:
  21298. case NUMBERSIGN$2:
  21299. case AMPERSAND$1:
  21300. this.scanner.next();
  21301. break;
  21302. // TODO: not sure we should support this hack
  21303. case SOLIDUS$2:
  21304. this.scanner.next();
  21305. if (this.scanner.isDelim(SOLIDUS$2)) {
  21306. this.scanner.next();
  21307. }
  21308. break;
  21309. }
  21310. }
  21311. if (this.scanner.tokenType === HASH$1) {
  21312. this.eat(HASH$1);
  21313. } else {
  21314. this.eat(IDENT$7);
  21315. }
  21316. return this.scanner.substrToCursor(start);
  21317. }
  21318. // ! ws* important
  21319. function getImportant() {
  21320. this.eat(DELIM$2);
  21321. this.scanner.skipSC();
  21322. var important = this.consume(IDENT$7);
  21323. // store original value in case it differ from `important`
  21324. // for better original source restoring and hacks like `!ie` support
  21325. return important === 'important' ? true : important;
  21326. }
  21327. var TYPE$k = tokenizer.TYPE;
  21328. var rawMode$3 = Raw.mode;
  21329. var WHITESPACE$6 = TYPE$k.WhiteSpace;
  21330. var COMMENT$6 = TYPE$k.Comment;
  21331. var SEMICOLON$4 = TYPE$k.Semicolon;
  21332. function consumeRaw$2(startToken) {
  21333. return this.Raw(startToken, rawMode$3.semicolonIncluded, true);
  21334. }
  21335. var DeclarationList = {
  21336. name: 'DeclarationList',
  21337. structure: {
  21338. children: [[
  21339. 'Declaration'
  21340. ]]
  21341. },
  21342. parse: function() {
  21343. var children = this.createList();
  21344. while (!this.scanner.eof) {
  21345. switch (this.scanner.tokenType) {
  21346. case WHITESPACE$6:
  21347. case COMMENT$6:
  21348. case SEMICOLON$4:
  21349. this.scanner.next();
  21350. break;
  21351. default:
  21352. children.push(this.parseWithFallback(this.Declaration, consumeRaw$2));
  21353. }
  21354. }
  21355. return {
  21356. type: 'DeclarationList',
  21357. loc: this.getLocationFromList(children),
  21358. children: children
  21359. };
  21360. },
  21361. generate: function(node) {
  21362. this.children(node, function(prev) {
  21363. if (prev.type === 'Declaration') {
  21364. this.chunk(';');
  21365. }
  21366. });
  21367. }
  21368. };
  21369. var consumeNumber$3 = utils.consumeNumber;
  21370. var TYPE$l = tokenizer.TYPE;
  21371. var DIMENSION$3 = TYPE$l.Dimension;
  21372. var Dimension = {
  21373. name: 'Dimension',
  21374. structure: {
  21375. value: String,
  21376. unit: String
  21377. },
  21378. parse: function() {
  21379. var start = this.scanner.tokenStart;
  21380. var numberEnd = consumeNumber$3(this.scanner.source, start);
  21381. this.eat(DIMENSION$3);
  21382. return {
  21383. type: 'Dimension',
  21384. loc: this.getLocation(start, this.scanner.tokenStart),
  21385. value: this.scanner.source.substring(start, numberEnd),
  21386. unit: this.scanner.source.substring(numberEnd, this.scanner.tokenStart)
  21387. };
  21388. },
  21389. generate: function(node) {
  21390. this.chunk(node.value);
  21391. this.chunk(node.unit);
  21392. }
  21393. };
  21394. var TYPE$m = tokenizer.TYPE;
  21395. var RIGHTPARENTHESIS$2 = TYPE$m.RightParenthesis;
  21396. // <function-token> <sequence> )
  21397. var _Function = {
  21398. name: 'Function',
  21399. structure: {
  21400. name: String,
  21401. children: [[]]
  21402. },
  21403. parse: function(readSequence, recognizer) {
  21404. var start = this.scanner.tokenStart;
  21405. var name = this.consumeFunctionName();
  21406. var nameLowerCase = name.toLowerCase();
  21407. var children;
  21408. children = recognizer.hasOwnProperty(nameLowerCase)
  21409. ? recognizer[nameLowerCase].call(this, recognizer)
  21410. : readSequence.call(this, recognizer);
  21411. if (!this.scanner.eof) {
  21412. this.eat(RIGHTPARENTHESIS$2);
  21413. }
  21414. return {
  21415. type: 'Function',
  21416. loc: this.getLocation(start, this.scanner.tokenStart),
  21417. name: name,
  21418. children: children
  21419. };
  21420. },
  21421. generate: function(node) {
  21422. this.chunk(node.name);
  21423. this.chunk('(');
  21424. this.children(node);
  21425. this.chunk(')');
  21426. },
  21427. walkContext: 'function'
  21428. };
  21429. var TYPE$n = tokenizer.TYPE;
  21430. var HASH$2 = TYPE$n.Hash;
  21431. // '#' ident
  21432. var HexColor = {
  21433. name: 'HexColor',
  21434. structure: {
  21435. value: String
  21436. },
  21437. parse: function() {
  21438. var start = this.scanner.tokenStart;
  21439. this.eat(HASH$2);
  21440. return {
  21441. type: 'HexColor',
  21442. loc: this.getLocation(start, this.scanner.tokenStart),
  21443. value: this.scanner.substrToCursor(start + 1)
  21444. };
  21445. },
  21446. generate: function(node) {
  21447. this.chunk('#');
  21448. this.chunk(node.value);
  21449. }
  21450. };
  21451. var TYPE$o = tokenizer.TYPE;
  21452. var IDENT$8 = TYPE$o.Ident;
  21453. var Identifier = {
  21454. name: 'Identifier',
  21455. structure: {
  21456. name: String
  21457. },
  21458. parse: function() {
  21459. return {
  21460. type: 'Identifier',
  21461. loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  21462. name: this.consume(IDENT$8)
  21463. };
  21464. },
  21465. generate: function(node) {
  21466. this.chunk(node.name);
  21467. }
  21468. };
  21469. var TYPE$p = tokenizer.TYPE;
  21470. var HASH$3 = TYPE$p.Hash;
  21471. // <hash-token>
  21472. var IdSelector = {
  21473. name: 'IdSelector',
  21474. structure: {
  21475. name: String
  21476. },
  21477. parse: function() {
  21478. var start = this.scanner.tokenStart;
  21479. // TODO: check value is an ident
  21480. this.eat(HASH$3);
  21481. return {
  21482. type: 'IdSelector',
  21483. loc: this.getLocation(start, this.scanner.tokenStart),
  21484. name: this.scanner.substrToCursor(start + 1)
  21485. };
  21486. },
  21487. generate: function(node) {
  21488. this.chunk('#');
  21489. this.chunk(node.name);
  21490. }
  21491. };
  21492. var TYPE$q = tokenizer.TYPE;
  21493. var IDENT$9 = TYPE$q.Ident;
  21494. var NUMBER$4 = TYPE$q.Number;
  21495. var DIMENSION$4 = TYPE$q.Dimension;
  21496. var LEFTPARENTHESIS$2 = TYPE$q.LeftParenthesis;
  21497. var RIGHTPARENTHESIS$3 = TYPE$q.RightParenthesis;
  21498. var COLON$2 = TYPE$q.Colon;
  21499. var DELIM$3 = TYPE$q.Delim;
  21500. var MediaFeature = {
  21501. name: 'MediaFeature',
  21502. structure: {
  21503. name: String,
  21504. value: ['Identifier', 'Number', 'Dimension', 'Ratio', null]
  21505. },
  21506. parse: function() {
  21507. var start = this.scanner.tokenStart;
  21508. var name;
  21509. var value = null;
  21510. this.eat(LEFTPARENTHESIS$2);
  21511. this.scanner.skipSC();
  21512. name = this.consume(IDENT$9);
  21513. this.scanner.skipSC();
  21514. if (this.scanner.tokenType !== RIGHTPARENTHESIS$3) {
  21515. this.eat(COLON$2);
  21516. this.scanner.skipSC();
  21517. switch (this.scanner.tokenType) {
  21518. case NUMBER$4:
  21519. if (this.lookupNonWSType(1) === DELIM$3) {
  21520. value = this.Ratio();
  21521. } else {
  21522. value = this.Number();
  21523. }
  21524. break;
  21525. case DIMENSION$4:
  21526. value = this.Dimension();
  21527. break;
  21528. case IDENT$9:
  21529. value = this.Identifier();
  21530. break;
  21531. default:
  21532. this.error('Number, dimension, ratio or identifier is expected');
  21533. }
  21534. this.scanner.skipSC();
  21535. }
  21536. this.eat(RIGHTPARENTHESIS$3);
  21537. return {
  21538. type: 'MediaFeature',
  21539. loc: this.getLocation(start, this.scanner.tokenStart),
  21540. name: name,
  21541. value: value
  21542. };
  21543. },
  21544. generate: function(node) {
  21545. this.chunk('(');
  21546. this.chunk(node.name);
  21547. if (node.value !== null) {
  21548. this.chunk(':');
  21549. this.node(node.value);
  21550. }
  21551. this.chunk(')');
  21552. }
  21553. };
  21554. var TYPE$r = tokenizer.TYPE;
  21555. var WHITESPACE$7 = TYPE$r.WhiteSpace;
  21556. var COMMENT$7 = TYPE$r.Comment;
  21557. var IDENT$a = TYPE$r.Ident;
  21558. var LEFTPARENTHESIS$3 = TYPE$r.LeftParenthesis;
  21559. var MediaQuery = {
  21560. name: 'MediaQuery',
  21561. structure: {
  21562. children: [[
  21563. 'Identifier',
  21564. 'MediaFeature',
  21565. 'WhiteSpace'
  21566. ]]
  21567. },
  21568. parse: function() {
  21569. this.scanner.skipSC();
  21570. var children = this.createList();
  21571. var child = null;
  21572. var space = null;
  21573. scan:
  21574. while (!this.scanner.eof) {
  21575. switch (this.scanner.tokenType) {
  21576. case COMMENT$7:
  21577. this.scanner.next();
  21578. continue;
  21579. case WHITESPACE$7:
  21580. space = this.WhiteSpace();
  21581. continue;
  21582. case IDENT$a:
  21583. child = this.Identifier();
  21584. break;
  21585. case LEFTPARENTHESIS$3:
  21586. child = this.MediaFeature();
  21587. break;
  21588. default:
  21589. break scan;
  21590. }
  21591. if (space !== null) {
  21592. children.push(space);
  21593. space = null;
  21594. }
  21595. children.push(child);
  21596. }
  21597. if (child === null) {
  21598. this.error('Identifier or parenthesis is expected');
  21599. }
  21600. return {
  21601. type: 'MediaQuery',
  21602. loc: this.getLocationFromList(children),
  21603. children: children
  21604. };
  21605. },
  21606. generate: function(node) {
  21607. this.children(node);
  21608. }
  21609. };
  21610. var COMMA$1 = tokenizer.TYPE.Comma;
  21611. var MediaQueryList = {
  21612. name: 'MediaQueryList',
  21613. structure: {
  21614. children: [[
  21615. 'MediaQuery'
  21616. ]]
  21617. },
  21618. parse: function(relative) {
  21619. var children = this.createList();
  21620. this.scanner.skipSC();
  21621. while (!this.scanner.eof) {
  21622. children.push(this.MediaQuery(relative));
  21623. if (this.scanner.tokenType !== COMMA$1) {
  21624. break;
  21625. }
  21626. this.scanner.next();
  21627. }
  21628. return {
  21629. type: 'MediaQueryList',
  21630. loc: this.getLocationFromList(children),
  21631. children: children
  21632. };
  21633. },
  21634. generate: function(node) {
  21635. this.children(node, function() {
  21636. this.chunk(',');
  21637. });
  21638. }
  21639. };
  21640. var Nth = {
  21641. name: 'Nth',
  21642. structure: {
  21643. nth: ['AnPlusB', 'Identifier'],
  21644. selector: ['SelectorList', null]
  21645. },
  21646. parse: function(allowOfClause) {
  21647. this.scanner.skipSC();
  21648. var start = this.scanner.tokenStart;
  21649. var end = start;
  21650. var selector = null;
  21651. var query;
  21652. if (this.scanner.lookupValue(0, 'odd') || this.scanner.lookupValue(0, 'even')) {
  21653. query = this.Identifier();
  21654. } else {
  21655. query = this.AnPlusB();
  21656. }
  21657. this.scanner.skipSC();
  21658. if (allowOfClause && this.scanner.lookupValue(0, 'of')) {
  21659. this.scanner.next();
  21660. selector = this.SelectorList();
  21661. if (this.needPositions) {
  21662. end = this.getLastListNode(selector.children).loc.end.offset;
  21663. }
  21664. } else {
  21665. if (this.needPositions) {
  21666. end = query.loc.end.offset;
  21667. }
  21668. }
  21669. return {
  21670. type: 'Nth',
  21671. loc: this.getLocation(start, end),
  21672. nth: query,
  21673. selector: selector
  21674. };
  21675. },
  21676. generate: function(node) {
  21677. this.node(node.nth);
  21678. if (node.selector !== null) {
  21679. this.chunk(' of ');
  21680. this.node(node.selector);
  21681. }
  21682. }
  21683. };
  21684. var NUMBER$5 = tokenizer.TYPE.Number;
  21685. var _Number = {
  21686. name: 'Number',
  21687. structure: {
  21688. value: String
  21689. },
  21690. parse: function() {
  21691. return {
  21692. type: 'Number',
  21693. loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  21694. value: this.consume(NUMBER$5)
  21695. };
  21696. },
  21697. generate: function(node) {
  21698. this.chunk(node.value);
  21699. }
  21700. };
  21701. // '/' | '*' | ',' | ':' | '+' | '-'
  21702. var Operator = {
  21703. name: 'Operator',
  21704. structure: {
  21705. value: String
  21706. },
  21707. parse: function() {
  21708. var start = this.scanner.tokenStart;
  21709. this.scanner.next();
  21710. return {
  21711. type: 'Operator',
  21712. loc: this.getLocation(start, this.scanner.tokenStart),
  21713. value: this.scanner.substrToCursor(start)
  21714. };
  21715. },
  21716. generate: function(node) {
  21717. this.chunk(node.value);
  21718. }
  21719. };
  21720. var TYPE$s = tokenizer.TYPE;
  21721. var LEFTPARENTHESIS$4 = TYPE$s.LeftParenthesis;
  21722. var RIGHTPARENTHESIS$4 = TYPE$s.RightParenthesis;
  21723. var Parentheses = {
  21724. name: 'Parentheses',
  21725. structure: {
  21726. children: [[]]
  21727. },
  21728. parse: function(readSequence, recognizer) {
  21729. var start = this.scanner.tokenStart;
  21730. var children = null;
  21731. this.eat(LEFTPARENTHESIS$4);
  21732. children = readSequence.call(this, recognizer);
  21733. if (!this.scanner.eof) {
  21734. this.eat(RIGHTPARENTHESIS$4);
  21735. }
  21736. return {
  21737. type: 'Parentheses',
  21738. loc: this.getLocation(start, this.scanner.tokenStart),
  21739. children: children
  21740. };
  21741. },
  21742. generate: function(node) {
  21743. this.chunk('(');
  21744. this.children(node);
  21745. this.chunk(')');
  21746. }
  21747. };
  21748. var consumeNumber$4 = utils.consumeNumber;
  21749. var TYPE$t = tokenizer.TYPE;
  21750. var PERCENTAGE$1 = TYPE$t.Percentage;
  21751. var Percentage = {
  21752. name: 'Percentage',
  21753. structure: {
  21754. value: String
  21755. },
  21756. parse: function() {
  21757. var start = this.scanner.tokenStart;
  21758. var numberEnd = consumeNumber$4(this.scanner.source, start);
  21759. this.eat(PERCENTAGE$1);
  21760. return {
  21761. type: 'Percentage',
  21762. loc: this.getLocation(start, this.scanner.tokenStart),
  21763. value: this.scanner.source.substring(start, numberEnd)
  21764. };
  21765. },
  21766. generate: function(node) {
  21767. this.chunk(node.value);
  21768. this.chunk('%');
  21769. }
  21770. };
  21771. var TYPE$u = tokenizer.TYPE;
  21772. var IDENT$b = TYPE$u.Ident;
  21773. var FUNCTION$1 = TYPE$u.Function;
  21774. var COLON$3 = TYPE$u.Colon;
  21775. var RIGHTPARENTHESIS$5 = TYPE$u.RightParenthesis;
  21776. // : [ <ident> | <function-token> <any-value>? ) ]
  21777. var PseudoClassSelector = {
  21778. name: 'PseudoClassSelector',
  21779. structure: {
  21780. name: String,
  21781. children: [['Raw'], null]
  21782. },
  21783. parse: function() {
  21784. var start = this.scanner.tokenStart;
  21785. var children = null;
  21786. var name;
  21787. var nameLowerCase;
  21788. this.eat(COLON$3);
  21789. if (this.scanner.tokenType === FUNCTION$1) {
  21790. name = this.consumeFunctionName();
  21791. nameLowerCase = name.toLowerCase();
  21792. if (this.pseudo.hasOwnProperty(nameLowerCase)) {
  21793. this.scanner.skipSC();
  21794. children = this.pseudo[nameLowerCase].call(this);
  21795. this.scanner.skipSC();
  21796. } else {
  21797. children = this.createList();
  21798. children.push(
  21799. this.Raw(this.scanner.tokenIndex, null, false)
  21800. );
  21801. }
  21802. this.eat(RIGHTPARENTHESIS$5);
  21803. } else {
  21804. name = this.consume(IDENT$b);
  21805. }
  21806. return {
  21807. type: 'PseudoClassSelector',
  21808. loc: this.getLocation(start, this.scanner.tokenStart),
  21809. name: name,
  21810. children: children
  21811. };
  21812. },
  21813. generate: function(node) {
  21814. this.chunk(':');
  21815. this.chunk(node.name);
  21816. if (node.children !== null) {
  21817. this.chunk('(');
  21818. this.children(node);
  21819. this.chunk(')');
  21820. }
  21821. },
  21822. walkContext: 'function'
  21823. };
  21824. var TYPE$v = tokenizer.TYPE;
  21825. var IDENT$c = TYPE$v.Ident;
  21826. var FUNCTION$2 = TYPE$v.Function;
  21827. var COLON$4 = TYPE$v.Colon;
  21828. var RIGHTPARENTHESIS$6 = TYPE$v.RightParenthesis;
  21829. // :: [ <ident> | <function-token> <any-value>? ) ]
  21830. var PseudoElementSelector = {
  21831. name: 'PseudoElementSelector',
  21832. structure: {
  21833. name: String,
  21834. children: [['Raw'], null]
  21835. },
  21836. parse: function() {
  21837. var start = this.scanner.tokenStart;
  21838. var children = null;
  21839. var name;
  21840. var nameLowerCase;
  21841. this.eat(COLON$4);
  21842. this.eat(COLON$4);
  21843. if (this.scanner.tokenType === FUNCTION$2) {
  21844. name = this.consumeFunctionName();
  21845. nameLowerCase = name.toLowerCase();
  21846. if (this.pseudo.hasOwnProperty(nameLowerCase)) {
  21847. this.scanner.skipSC();
  21848. children = this.pseudo[nameLowerCase].call(this);
  21849. this.scanner.skipSC();
  21850. } else {
  21851. children = this.createList();
  21852. children.push(
  21853. this.Raw(this.scanner.tokenIndex, null, false)
  21854. );
  21855. }
  21856. this.eat(RIGHTPARENTHESIS$6);
  21857. } else {
  21858. name = this.consume(IDENT$c);
  21859. }
  21860. return {
  21861. type: 'PseudoElementSelector',
  21862. loc: this.getLocation(start, this.scanner.tokenStart),
  21863. name: name,
  21864. children: children
  21865. };
  21866. },
  21867. generate: function(node) {
  21868. this.chunk('::');
  21869. this.chunk(node.name);
  21870. if (node.children !== null) {
  21871. this.chunk('(');
  21872. this.children(node);
  21873. this.chunk(')');
  21874. }
  21875. },
  21876. walkContext: 'function'
  21877. };
  21878. var isDigit$5 = tokenizer.isDigit;
  21879. var TYPE$w = tokenizer.TYPE;
  21880. var NUMBER$6 = TYPE$w.Number;
  21881. var DELIM$4 = TYPE$w.Delim;
  21882. var SOLIDUS$3 = 0x002F; // U+002F SOLIDUS (/)
  21883. var FULLSTOP$1 = 0x002E; // U+002E FULL STOP (.)
  21884. // Terms of <ratio> should be a positive numbers (not zero or negative)
  21885. // (see https://drafts.csswg.org/mediaqueries-3/#values)
  21886. // However, -o-min-device-pixel-ratio takes fractional values as a ratio's term
  21887. // and this is using by various sites. Therefore we relax checking on parse
  21888. // to test a term is unsigned number without an exponent part.
  21889. // Additional checking may be applied on lexer validation.
  21890. function consumeNumber$5() {
  21891. this.scanner.skipWS();
  21892. var value = this.consume(NUMBER$6);
  21893. for (var i = 0; i < value.length; i++) {
  21894. var code = value.charCodeAt(i);
  21895. if (!isDigit$5(code) && code !== FULLSTOP$1) {
  21896. this.error('Unsigned number is expected', this.scanner.tokenStart - value.length + i);
  21897. }
  21898. }
  21899. if (Number(value) === 0) {
  21900. this.error('Zero number is not allowed', this.scanner.tokenStart - value.length);
  21901. }
  21902. return value;
  21903. }
  21904. // <positive-integer> S* '/' S* <positive-integer>
  21905. var Ratio = {
  21906. name: 'Ratio',
  21907. structure: {
  21908. left: String,
  21909. right: String
  21910. },
  21911. parse: function() {
  21912. var start = this.scanner.tokenStart;
  21913. var left = consumeNumber$5.call(this);
  21914. var right;
  21915. this.scanner.skipWS();
  21916. if (!this.scanner.isDelim(SOLIDUS$3)) {
  21917. this.error('Solidus is expected');
  21918. }
  21919. this.eat(DELIM$4);
  21920. right = consumeNumber$5.call(this);
  21921. return {
  21922. type: 'Ratio',
  21923. loc: this.getLocation(start, this.scanner.tokenStart),
  21924. left: left,
  21925. right: right
  21926. };
  21927. },
  21928. generate: function(node) {
  21929. this.chunk(node.left);
  21930. this.chunk('/');
  21931. this.chunk(node.right);
  21932. }
  21933. };
  21934. var TYPE$x = tokenizer.TYPE;
  21935. var rawMode$4 = Raw.mode;
  21936. var LEFTCURLYBRACKET$4 = TYPE$x.LeftCurlyBracket;
  21937. function consumeRaw$3(startToken) {
  21938. return this.Raw(startToken, rawMode$4.leftCurlyBracket, true);
  21939. }
  21940. function consumePrelude() {
  21941. var prelude = this.SelectorList();
  21942. if (prelude.type !== 'Raw' &&
  21943. this.scanner.eof === false &&
  21944. this.scanner.tokenType !== LEFTCURLYBRACKET$4) {
  21945. this.error();
  21946. }
  21947. return prelude;
  21948. }
  21949. var Rule = {
  21950. name: 'Rule',
  21951. structure: {
  21952. prelude: ['SelectorList', 'Raw'],
  21953. block: ['Block']
  21954. },
  21955. parse: function() {
  21956. var startToken = this.scanner.tokenIndex;
  21957. var startOffset = this.scanner.tokenStart;
  21958. var prelude;
  21959. var block;
  21960. if (this.parseRulePrelude) {
  21961. prelude = this.parseWithFallback(consumePrelude, consumeRaw$3);
  21962. } else {
  21963. prelude = consumeRaw$3.call(this, startToken);
  21964. }
  21965. block = this.Block(true);
  21966. return {
  21967. type: 'Rule',
  21968. loc: this.getLocation(startOffset, this.scanner.tokenStart),
  21969. prelude: prelude,
  21970. block: block
  21971. };
  21972. },
  21973. generate: function(node) {
  21974. this.node(node.prelude);
  21975. this.node(node.block);
  21976. },
  21977. walkContext: 'rule'
  21978. };
  21979. var Selector = {
  21980. name: 'Selector',
  21981. structure: {
  21982. children: [[
  21983. 'TypeSelector',
  21984. 'IdSelector',
  21985. 'ClassSelector',
  21986. 'AttributeSelector',
  21987. 'PseudoClassSelector',
  21988. 'PseudoElementSelector',
  21989. 'Combinator',
  21990. 'WhiteSpace'
  21991. ]]
  21992. },
  21993. parse: function() {
  21994. var children = this.readSequence(this.scope.Selector);
  21995. // nothing were consumed
  21996. if (this.getFirstListNode(children) === null) {
  21997. this.error('Selector is expected');
  21998. }
  21999. return {
  22000. type: 'Selector',
  22001. loc: this.getLocationFromList(children),
  22002. children: children
  22003. };
  22004. },
  22005. generate: function(node) {
  22006. this.children(node);
  22007. }
  22008. };
  22009. var TYPE$y = tokenizer.TYPE;
  22010. var COMMA$2 = TYPE$y.Comma;
  22011. var SelectorList = {
  22012. name: 'SelectorList',
  22013. structure: {
  22014. children: [[
  22015. 'Selector',
  22016. 'Raw'
  22017. ]]
  22018. },
  22019. parse: function() {
  22020. var children = this.createList();
  22021. while (!this.scanner.eof) {
  22022. children.push(this.Selector());
  22023. if (this.scanner.tokenType === COMMA$2) {
  22024. this.scanner.next();
  22025. continue;
  22026. }
  22027. break;
  22028. }
  22029. return {
  22030. type: 'SelectorList',
  22031. loc: this.getLocationFromList(children),
  22032. children: children
  22033. };
  22034. },
  22035. generate: function(node) {
  22036. this.children(node, function() {
  22037. this.chunk(',');
  22038. });
  22039. },
  22040. walkContext: 'selector'
  22041. };
  22042. var STRING$1 = tokenizer.TYPE.String;
  22043. var _String = {
  22044. name: 'String',
  22045. structure: {
  22046. value: String
  22047. },
  22048. parse: function() {
  22049. return {
  22050. type: 'String',
  22051. loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  22052. value: this.consume(STRING$1)
  22053. };
  22054. },
  22055. generate: function(node) {
  22056. this.chunk(node.value);
  22057. }
  22058. };
  22059. var TYPE$z = tokenizer.TYPE;
  22060. var WHITESPACE$8 = TYPE$z.WhiteSpace;
  22061. var COMMENT$8 = TYPE$z.Comment;
  22062. var ATKEYWORD$2 = TYPE$z.AtKeyword;
  22063. var CDO$1 = TYPE$z.CDO;
  22064. var CDC$1 = TYPE$z.CDC;
  22065. var EXCLAMATIONMARK$3 = 0x0021; // U+0021 EXCLAMATION MARK (!)
  22066. function consumeRaw$4(startToken) {
  22067. return this.Raw(startToken, null, false);
  22068. }
  22069. var StyleSheet = {
  22070. name: 'StyleSheet',
  22071. structure: {
  22072. children: [[
  22073. 'Comment',
  22074. 'CDO',
  22075. 'CDC',
  22076. 'Atrule',
  22077. 'Rule',
  22078. 'Raw'
  22079. ]]
  22080. },
  22081. parse: function() {
  22082. var start = this.scanner.tokenStart;
  22083. var children = this.createList();
  22084. var child;
  22085. while (!this.scanner.eof) {
  22086. switch (this.scanner.tokenType) {
  22087. case WHITESPACE$8:
  22088. this.scanner.next();
  22089. continue;
  22090. case COMMENT$8:
  22091. // ignore comments except exclamation comments (i.e. /*! .. */) on top level
  22092. if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 2) !== EXCLAMATIONMARK$3) {
  22093. this.scanner.next();
  22094. continue;
  22095. }
  22096. child = this.Comment();
  22097. break;
  22098. case CDO$1: // <!--
  22099. child = this.CDO();
  22100. break;
  22101. case CDC$1: // -->
  22102. child = this.CDC();
  22103. break;
  22104. // CSS Syntax Module Level 3
  22105. // §2.2 Error handling
  22106. // At the "top level" of a stylesheet, an <at-keyword-token> starts an at-rule.
  22107. case ATKEYWORD$2:
  22108. child = this.parseWithFallback(this.Atrule, consumeRaw$4);
  22109. break;
  22110. // Anything else starts a qualified rule ...
  22111. default:
  22112. child = this.parseWithFallback(this.Rule, consumeRaw$4);
  22113. }
  22114. children.push(child);
  22115. }
  22116. return {
  22117. type: 'StyleSheet',
  22118. loc: this.getLocation(start, this.scanner.tokenStart),
  22119. children: children
  22120. };
  22121. },
  22122. generate: function(node) {
  22123. this.children(node);
  22124. },
  22125. walkContext: 'stylesheet'
  22126. };
  22127. var TYPE$A = tokenizer.TYPE;
  22128. var IDENT$d = TYPE$A.Ident;
  22129. var ASTERISK$4 = 0x002A; // U+002A ASTERISK (*)
  22130. var VERTICALLINE$2 = 0x007C; // U+007C VERTICAL LINE (|)
  22131. function eatIdentifierOrAsterisk() {
  22132. if (this.scanner.tokenType !== IDENT$d &&
  22133. this.scanner.isDelim(ASTERISK$4) === false) {
  22134. this.error('Identifier or asterisk is expected');
  22135. }
  22136. this.scanner.next();
  22137. }
  22138. // ident
  22139. // ident|ident
  22140. // ident|*
  22141. // *
  22142. // *|ident
  22143. // *|*
  22144. // |ident
  22145. // |*
  22146. var TypeSelector = {
  22147. name: 'TypeSelector',
  22148. structure: {
  22149. name: String
  22150. },
  22151. parse: function() {
  22152. var start = this.scanner.tokenStart;
  22153. if (this.scanner.isDelim(VERTICALLINE$2)) {
  22154. this.scanner.next();
  22155. eatIdentifierOrAsterisk.call(this);
  22156. } else {
  22157. eatIdentifierOrAsterisk.call(this);
  22158. if (this.scanner.isDelim(VERTICALLINE$2)) {
  22159. this.scanner.next();
  22160. eatIdentifierOrAsterisk.call(this);
  22161. }
  22162. }
  22163. return {
  22164. type: 'TypeSelector',
  22165. loc: this.getLocation(start, this.scanner.tokenStart),
  22166. name: this.scanner.substrToCursor(start)
  22167. };
  22168. },
  22169. generate: function(node) {
  22170. this.chunk(node.name);
  22171. }
  22172. };
  22173. var isHexDigit$4 = tokenizer.isHexDigit;
  22174. var cmpChar$4 = tokenizer.cmpChar;
  22175. var TYPE$B = tokenizer.TYPE;
  22176. var NAME$3 = tokenizer.NAME;
  22177. var IDENT$e = TYPE$B.Ident;
  22178. var NUMBER$7 = TYPE$B.Number;
  22179. var DIMENSION$5 = TYPE$B.Dimension;
  22180. var PLUSSIGN$6 = 0x002B; // U+002B PLUS SIGN (+)
  22181. var HYPHENMINUS$4 = 0x002D; // U+002D HYPHEN-MINUS (-)
  22182. var QUESTIONMARK$2 = 0x003F; // U+003F QUESTION MARK (?)
  22183. var U$1 = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
  22184. function eatHexSequence(offset, allowDash) {
  22185. for (var pos = this.scanner.tokenStart + offset, len = 0; pos < this.scanner.tokenEnd; pos++) {
  22186. var code = this.scanner.source.charCodeAt(pos);
  22187. if (code === HYPHENMINUS$4 && allowDash && len !== 0) {
  22188. if (eatHexSequence.call(this, offset + len + 1, false) === 0) {
  22189. this.error();
  22190. }
  22191. return -1;
  22192. }
  22193. if (!isHexDigit$4(code)) {
  22194. this.error(
  22195. allowDash && len !== 0
  22196. ? 'HyphenMinus' + (len < 6 ? ' or hex digit' : '') + ' is expected'
  22197. : (len < 6 ? 'Hex digit is expected' : 'Unexpected input'),
  22198. pos
  22199. );
  22200. }
  22201. if (++len > 6) {
  22202. this.error('Too many hex digits', pos);
  22203. } }
  22204. this.scanner.next();
  22205. return len;
  22206. }
  22207. function eatQuestionMarkSequence(max) {
  22208. var count = 0;
  22209. while (this.scanner.isDelim(QUESTIONMARK$2)) {
  22210. if (++count > max) {
  22211. this.error('Too many question marks');
  22212. }
  22213. this.scanner.next();
  22214. }
  22215. }
  22216. function startsWith$1(code) {
  22217. if (this.scanner.source.charCodeAt(this.scanner.tokenStart) !== code) {
  22218. this.error(NAME$3[code] + ' is expected');
  22219. }
  22220. }
  22221. // https://drafts.csswg.org/css-syntax/#urange
  22222. // Informally, the <urange> production has three forms:
  22223. // U+0001
  22224. // Defines a range consisting of a single code point, in this case the code point "1".
  22225. // U+0001-00ff
  22226. // Defines a range of codepoints between the first and the second value, in this case
  22227. // the range between "1" and "ff" (255 in decimal) inclusive.
  22228. // U+00??
  22229. // Defines a range of codepoints where the "?" characters range over all hex digits,
  22230. // in this case defining the same as the value U+0000-00ff.
  22231. // In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat "?" as a hexadecimal digit).
  22232. //
  22233. // <urange> =
  22234. // u '+' <ident-token> '?'* |
  22235. // u <dimension-token> '?'* |
  22236. // u <number-token> '?'* |
  22237. // u <number-token> <dimension-token> |
  22238. // u <number-token> <number-token> |
  22239. // u '+' '?'+
  22240. function scanUnicodeRange() {
  22241. var hexLength = 0;
  22242. // u '+' <ident-token> '?'*
  22243. // u '+' '?'+
  22244. if (this.scanner.isDelim(PLUSSIGN$6)) {
  22245. this.scanner.next();
  22246. if (this.scanner.tokenType === IDENT$e) {
  22247. hexLength = eatHexSequence.call(this, 0, true);
  22248. if (hexLength > 0) {
  22249. eatQuestionMarkSequence.call(this, 6 - hexLength);
  22250. }
  22251. return;
  22252. }
  22253. if (this.scanner.isDelim(QUESTIONMARK$2)) {
  22254. this.scanner.next();
  22255. eatQuestionMarkSequence.call(this, 5);
  22256. return;
  22257. }
  22258. this.error('Hex digit or question mark is expected');
  22259. return;
  22260. }
  22261. // u <number-token> '?'*
  22262. // u <number-token> <dimension-token>
  22263. // u <number-token> <number-token>
  22264. if (this.scanner.tokenType === NUMBER$7) {
  22265. startsWith$1.call(this, PLUSSIGN$6);
  22266. hexLength = eatHexSequence.call(this, 1, true);
  22267. if (this.scanner.isDelim(QUESTIONMARK$2)) {
  22268. eatQuestionMarkSequence.call(this, 6 - hexLength);
  22269. return;
  22270. }
  22271. if (this.scanner.tokenType === DIMENSION$5 ||
  22272. this.scanner.tokenType === NUMBER$7) {
  22273. startsWith$1.call(this, HYPHENMINUS$4);
  22274. eatHexSequence.call(this, 1, false);
  22275. return;
  22276. }
  22277. return;
  22278. }
  22279. // u <dimension-token> '?'*
  22280. if (this.scanner.tokenType === DIMENSION$5) {
  22281. startsWith$1.call(this, PLUSSIGN$6);
  22282. hexLength = eatHexSequence.call(this, 1, true);
  22283. if (hexLength > 0) {
  22284. eatQuestionMarkSequence.call(this, 6 - hexLength);
  22285. }
  22286. return;
  22287. }
  22288. this.error();
  22289. }
  22290. var UnicodeRange = {
  22291. name: 'UnicodeRange',
  22292. structure: {
  22293. value: String
  22294. },
  22295. parse: function() {
  22296. var start = this.scanner.tokenStart;
  22297. // U or u
  22298. if (!cmpChar$4(this.scanner.source, start, U$1)) {
  22299. this.error('U is expected');
  22300. }
  22301. if (!cmpChar$4(this.scanner.source, start + 1, PLUSSIGN$6)) {
  22302. this.error('Plus sign is expected');
  22303. }
  22304. this.scanner.next();
  22305. scanUnicodeRange.call(this);
  22306. return {
  22307. type: 'UnicodeRange',
  22308. loc: this.getLocation(start, this.scanner.tokenStart),
  22309. value: this.scanner.substrToCursor(start)
  22310. };
  22311. },
  22312. generate: function(node) {
  22313. this.chunk(node.value);
  22314. }
  22315. };
  22316. var isWhiteSpace$2 = tokenizer.isWhiteSpace;
  22317. var cmpStr$4 = tokenizer.cmpStr;
  22318. var TYPE$C = tokenizer.TYPE;
  22319. var FUNCTION$3 = TYPE$C.Function;
  22320. var URL$2 = TYPE$C.Url;
  22321. var RIGHTPARENTHESIS$7 = TYPE$C.RightParenthesis;
  22322. // <url-token> | <function-token> <string> )
  22323. var Url = {
  22324. name: 'Url',
  22325. structure: {
  22326. value: ['String', 'Raw']
  22327. },
  22328. parse: function() {
  22329. var start = this.scanner.tokenStart;
  22330. var value;
  22331. switch (this.scanner.tokenType) {
  22332. case URL$2:
  22333. var rawStart = start + 4;
  22334. var rawEnd = this.scanner.tokenEnd - 1;
  22335. while (rawStart < rawEnd && isWhiteSpace$2(this.scanner.source.charCodeAt(rawStart))) {
  22336. rawStart++;
  22337. }
  22338. while (rawStart < rawEnd && isWhiteSpace$2(this.scanner.source.charCodeAt(rawEnd - 1))) {
  22339. rawEnd--;
  22340. }
  22341. value = {
  22342. type: 'Raw',
  22343. loc: this.getLocation(rawStart, rawEnd),
  22344. value: this.scanner.source.substring(rawStart, rawEnd)
  22345. };
  22346. this.eat(URL$2);
  22347. break;
  22348. case FUNCTION$3:
  22349. if (!cmpStr$4(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(')) {
  22350. this.error('Function name must be `url`');
  22351. }
  22352. this.eat(FUNCTION$3);
  22353. this.scanner.skipSC();
  22354. value = this.String();
  22355. this.scanner.skipSC();
  22356. this.eat(RIGHTPARENTHESIS$7);
  22357. break;
  22358. default:
  22359. this.error('Url or Function is expected');
  22360. }
  22361. return {
  22362. type: 'Url',
  22363. loc: this.getLocation(start, this.scanner.tokenStart),
  22364. value: value
  22365. };
  22366. },
  22367. generate: function(node) {
  22368. this.chunk('url');
  22369. this.chunk('(');
  22370. this.node(node.value);
  22371. this.chunk(')');
  22372. }
  22373. };
  22374. var Value = {
  22375. name: 'Value',
  22376. structure: {
  22377. children: [[]]
  22378. },
  22379. parse: function() {
  22380. var start = this.scanner.tokenStart;
  22381. var children = this.readSequence(this.scope.Value);
  22382. return {
  22383. type: 'Value',
  22384. loc: this.getLocation(start, this.scanner.tokenStart),
  22385. children: children
  22386. };
  22387. },
  22388. generate: function(node) {
  22389. this.children(node);
  22390. }
  22391. };
  22392. var WHITESPACE$9 = tokenizer.TYPE.WhiteSpace;
  22393. var SPACE$2 = Object.freeze({
  22394. type: 'WhiteSpace',
  22395. loc: null,
  22396. value: ' '
  22397. });
  22398. var WhiteSpace$1 = {
  22399. name: 'WhiteSpace',
  22400. structure: {
  22401. value: String
  22402. },
  22403. parse: function() {
  22404. this.eat(WHITESPACE$9);
  22405. return SPACE$2;
  22406. // return {
  22407. // type: 'WhiteSpace',
  22408. // loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  22409. // value: this.consume(WHITESPACE)
  22410. // };
  22411. },
  22412. generate: function(node) {
  22413. this.chunk(node.value);
  22414. }
  22415. };
  22416. var node = {
  22417. AnPlusB: AnPlusB,
  22418. Atrule: Atrule,
  22419. AtrulePrelude: AtrulePrelude,
  22420. AttributeSelector: AttributeSelector,
  22421. Block: Block,
  22422. Brackets: Brackets,
  22423. CDC: CDC_1,
  22424. CDO: CDO_1,
  22425. ClassSelector: ClassSelector,
  22426. Combinator: Combinator,
  22427. Comment: Comment,
  22428. Declaration: Declaration,
  22429. DeclarationList: DeclarationList,
  22430. Dimension: Dimension,
  22431. Function: _Function,
  22432. HexColor: HexColor,
  22433. Identifier: Identifier,
  22434. IdSelector: IdSelector,
  22435. MediaFeature: MediaFeature,
  22436. MediaQuery: MediaQuery,
  22437. MediaQueryList: MediaQueryList,
  22438. Nth: Nth,
  22439. Number: _Number,
  22440. Operator: Operator,
  22441. Parentheses: Parentheses,
  22442. Percentage: Percentage,
  22443. PseudoClassSelector: PseudoClassSelector,
  22444. PseudoElementSelector: PseudoElementSelector,
  22445. Ratio: Ratio,
  22446. Raw: Raw,
  22447. Rule: Rule,
  22448. Selector: Selector,
  22449. SelectorList: SelectorList,
  22450. String: _String,
  22451. StyleSheet: StyleSheet,
  22452. TypeSelector: TypeSelector,
  22453. UnicodeRange: UnicodeRange,
  22454. Url: Url,
  22455. Value: Value,
  22456. WhiteSpace: WhiteSpace$1
  22457. };
  22458. var lexer = {
  22459. generic: true,
  22460. types: data.types,
  22461. atrules: data.atrules,
  22462. properties: data.properties,
  22463. node: node
  22464. };
  22465. var cmpChar$5 = tokenizer.cmpChar;
  22466. var cmpStr$5 = tokenizer.cmpStr;
  22467. var TYPE$D = tokenizer.TYPE;
  22468. var IDENT$f = TYPE$D.Ident;
  22469. var STRING$2 = TYPE$D.String;
  22470. var NUMBER$8 = TYPE$D.Number;
  22471. var FUNCTION$4 = TYPE$D.Function;
  22472. var URL$3 = TYPE$D.Url;
  22473. var HASH$4 = TYPE$D.Hash;
  22474. var DIMENSION$6 = TYPE$D.Dimension;
  22475. var PERCENTAGE$2 = TYPE$D.Percentage;
  22476. var LEFTPARENTHESIS$5 = TYPE$D.LeftParenthesis;
  22477. var LEFTSQUAREBRACKET$3 = TYPE$D.LeftSquareBracket;
  22478. var COMMA$3 = TYPE$D.Comma;
  22479. var DELIM$5 = TYPE$D.Delim;
  22480. var NUMBERSIGN$3 = 0x0023; // U+0023 NUMBER SIGN (#)
  22481. var ASTERISK$5 = 0x002A; // U+002A ASTERISK (*)
  22482. var PLUSSIGN$7 = 0x002B; // U+002B PLUS SIGN (+)
  22483. var HYPHENMINUS$5 = 0x002D; // U+002D HYPHEN-MINUS (-)
  22484. var SOLIDUS$4 = 0x002F; // U+002F SOLIDUS (/)
  22485. var U$2 = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
  22486. var _default = function defaultRecognizer(context) {
  22487. switch (this.scanner.tokenType) {
  22488. case HASH$4:
  22489. return this.HexColor();
  22490. case COMMA$3:
  22491. context.space = null;
  22492. context.ignoreWSAfter = true;
  22493. return this.Operator();
  22494. case LEFTPARENTHESIS$5:
  22495. return this.Parentheses(this.readSequence, context.recognizer);
  22496. case LEFTSQUAREBRACKET$3:
  22497. return this.Brackets(this.readSequence, context.recognizer);
  22498. case STRING$2:
  22499. return this.String();
  22500. case DIMENSION$6:
  22501. return this.Dimension();
  22502. case PERCENTAGE$2:
  22503. return this.Percentage();
  22504. case NUMBER$8:
  22505. return this.Number();
  22506. case FUNCTION$4:
  22507. return cmpStr$5(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(')
  22508. ? this.Url()
  22509. : this.Function(this.readSequence, context.recognizer);
  22510. case URL$3:
  22511. return this.Url();
  22512. case IDENT$f:
  22513. // check for unicode range, it should start with u+ or U+
  22514. if (cmpChar$5(this.scanner.source, this.scanner.tokenStart, U$2) &&
  22515. cmpChar$5(this.scanner.source, this.scanner.tokenStart + 1, PLUSSIGN$7)) {
  22516. return this.UnicodeRange();
  22517. } else {
  22518. return this.Identifier();
  22519. }
  22520. case DELIM$5:
  22521. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  22522. if (code === SOLIDUS$4 ||
  22523. code === ASTERISK$5 ||
  22524. code === PLUSSIGN$7 ||
  22525. code === HYPHENMINUS$5) {
  22526. return this.Operator(); // TODO: replace with Delim
  22527. }
  22528. // TODO: produce a node with Delim node type
  22529. if (code === NUMBERSIGN$3) {
  22530. this.error('Hex or identifier is expected', this.scanner.tokenStart + 1);
  22531. }
  22532. break;
  22533. }
  22534. };
  22535. var atrulePrelude = {
  22536. getNode: _default
  22537. };
  22538. var TYPE$E = tokenizer.TYPE;
  22539. var DELIM$6 = TYPE$E.Delim;
  22540. var IDENT$g = TYPE$E.Ident;
  22541. var DIMENSION$7 = TYPE$E.Dimension;
  22542. var PERCENTAGE$3 = TYPE$E.Percentage;
  22543. var NUMBER$9 = TYPE$E.Number;
  22544. var HASH$5 = TYPE$E.Hash;
  22545. var COLON$5 = TYPE$E.Colon;
  22546. var LEFTSQUAREBRACKET$4 = TYPE$E.LeftSquareBracket;
  22547. var NUMBERSIGN$4 = 0x0023; // U+0023 NUMBER SIGN (#)
  22548. var ASTERISK$6 = 0x002A; // U+002A ASTERISK (*)
  22549. var PLUSSIGN$8 = 0x002B; // U+002B PLUS SIGN (+)
  22550. var SOLIDUS$5 = 0x002F; // U+002F SOLIDUS (/)
  22551. var FULLSTOP$2 = 0x002E; // U+002E FULL STOP (.)
  22552. var GREATERTHANSIGN$2 = 0x003E; // U+003E GREATER-THAN SIGN (>)
  22553. var VERTICALLINE$3 = 0x007C; // U+007C VERTICAL LINE (|)
  22554. var TILDE$2 = 0x007E; // U+007E TILDE (~)
  22555. function getNode(context) {
  22556. switch (this.scanner.tokenType) {
  22557. case LEFTSQUAREBRACKET$4:
  22558. return this.AttributeSelector();
  22559. case HASH$5:
  22560. return this.IdSelector();
  22561. case COLON$5:
  22562. if (this.scanner.lookupType(1) === COLON$5) {
  22563. return this.PseudoElementSelector();
  22564. } else {
  22565. return this.PseudoClassSelector();
  22566. }
  22567. case IDENT$g:
  22568. return this.TypeSelector();
  22569. case NUMBER$9:
  22570. case PERCENTAGE$3:
  22571. return this.Percentage();
  22572. case DIMENSION$7:
  22573. // throws when .123ident
  22574. if (this.scanner.source.charCodeAt(this.scanner.tokenStart) === FULLSTOP$2) {
  22575. this.error('Identifier is expected', this.scanner.tokenStart + 1);
  22576. }
  22577. break;
  22578. case DELIM$6:
  22579. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  22580. switch (code) {
  22581. case PLUSSIGN$8:
  22582. case GREATERTHANSIGN$2:
  22583. case TILDE$2:
  22584. context.space = null;
  22585. context.ignoreWSAfter = true;
  22586. return this.Combinator();
  22587. case SOLIDUS$5: // /deep/
  22588. return this.Combinator();
  22589. case FULLSTOP$2:
  22590. return this.ClassSelector();
  22591. case ASTERISK$6:
  22592. case VERTICALLINE$3:
  22593. return this.TypeSelector();
  22594. case NUMBERSIGN$4:
  22595. return this.IdSelector();
  22596. }
  22597. break;
  22598. }
  22599. }
  22600. var selector = {
  22601. getNode: getNode
  22602. };
  22603. // https://drafts.csswg.org/css-images-4/#element-notation
  22604. // https://developer.mozilla.org/en-US/docs/Web/CSS/element
  22605. var element = function() {
  22606. this.scanner.skipSC();
  22607. var children = this.createSingleNodeList(
  22608. this.IdSelector()
  22609. );
  22610. this.scanner.skipSC();
  22611. return children;
  22612. };
  22613. // legacy IE function
  22614. // expression( <any-value> )
  22615. var expression = function() {
  22616. return this.createSingleNodeList(
  22617. this.Raw(this.scanner.tokenIndex, null, false)
  22618. );
  22619. };
  22620. var TYPE$F = tokenizer.TYPE;
  22621. var rawMode$5 = Raw.mode;
  22622. var COMMA$4 = TYPE$F.Comma;
  22623. // var( <ident> , <value>? )
  22624. var _var = function() {
  22625. var children = this.createList();
  22626. this.scanner.skipSC();
  22627. // NOTE: Don't check more than a first argument is an ident, rest checks are for lexer
  22628. children.push(this.Identifier());
  22629. this.scanner.skipSC();
  22630. if (this.scanner.tokenType === COMMA$4) {
  22631. children.push(this.Operator());
  22632. children.push(this.parseCustomProperty
  22633. ? this.Value(null)
  22634. : this.Raw(this.scanner.tokenIndex, rawMode$5.exclamationMarkOrSemicolon, false)
  22635. );
  22636. }
  22637. return children;
  22638. };
  22639. var value = {
  22640. getNode: _default,
  22641. '-moz-element': element,
  22642. 'element': element,
  22643. 'expression': expression,
  22644. 'var': _var
  22645. };
  22646. var scope = {
  22647. AtrulePrelude: atrulePrelude,
  22648. Selector: selector,
  22649. Value: value
  22650. };
  22651. var fontFace = {
  22652. parse: {
  22653. prelude: null,
  22654. block: function() {
  22655. return this.Block(true);
  22656. }
  22657. }
  22658. };
  22659. var TYPE$G = tokenizer.TYPE;
  22660. var STRING$3 = TYPE$G.String;
  22661. var IDENT$h = TYPE$G.Ident;
  22662. var URL$4 = TYPE$G.Url;
  22663. var FUNCTION$5 = TYPE$G.Function;
  22664. var LEFTPARENTHESIS$6 = TYPE$G.LeftParenthesis;
  22665. var _import = {
  22666. parse: {
  22667. prelude: function() {
  22668. var children = this.createList();
  22669. this.scanner.skipSC();
  22670. switch (this.scanner.tokenType) {
  22671. case STRING$3:
  22672. children.push(this.String());
  22673. break;
  22674. case URL$4:
  22675. case FUNCTION$5:
  22676. children.push(this.Url());
  22677. break;
  22678. default:
  22679. this.error('String or url() is expected');
  22680. }
  22681. if (this.lookupNonWSType(0) === IDENT$h ||
  22682. this.lookupNonWSType(0) === LEFTPARENTHESIS$6) {
  22683. children.push(this.WhiteSpace());
  22684. children.push(this.MediaQueryList());
  22685. }
  22686. return children;
  22687. },
  22688. block: null
  22689. }
  22690. };
  22691. var media = {
  22692. parse: {
  22693. prelude: function() {
  22694. return this.createSingleNodeList(
  22695. this.MediaQueryList()
  22696. );
  22697. },
  22698. block: function() {
  22699. return this.Block(false);
  22700. }
  22701. }
  22702. };
  22703. var page = {
  22704. parse: {
  22705. prelude: function() {
  22706. return this.createSingleNodeList(
  22707. this.SelectorList()
  22708. );
  22709. },
  22710. block: function() {
  22711. return this.Block(true);
  22712. }
  22713. }
  22714. };
  22715. var TYPE$H = tokenizer.TYPE;
  22716. var WHITESPACE$a = TYPE$H.WhiteSpace;
  22717. var COMMENT$9 = TYPE$H.Comment;
  22718. var IDENT$i = TYPE$H.Ident;
  22719. var FUNCTION$6 = TYPE$H.Function;
  22720. var COLON$6 = TYPE$H.Colon;
  22721. var LEFTPARENTHESIS$7 = TYPE$H.LeftParenthesis;
  22722. function consumeRaw$5() {
  22723. return this.createSingleNodeList(
  22724. this.Raw(this.scanner.tokenIndex, null, false)
  22725. );
  22726. }
  22727. function parentheses() {
  22728. this.scanner.skipSC();
  22729. if (this.scanner.tokenType === IDENT$i &&
  22730. this.lookupNonWSType(1) === COLON$6) {
  22731. return this.createSingleNodeList(
  22732. this.Declaration()
  22733. );
  22734. }
  22735. return readSequence.call(this);
  22736. }
  22737. function readSequence() {
  22738. var children = this.createList();
  22739. var space = null;
  22740. var child;
  22741. this.scanner.skipSC();
  22742. scan:
  22743. while (!this.scanner.eof) {
  22744. switch (this.scanner.tokenType) {
  22745. case WHITESPACE$a:
  22746. space = this.WhiteSpace();
  22747. continue;
  22748. case COMMENT$9:
  22749. this.scanner.next();
  22750. continue;
  22751. case FUNCTION$6:
  22752. child = this.Function(consumeRaw$5, this.scope.AtrulePrelude);
  22753. break;
  22754. case IDENT$i:
  22755. child = this.Identifier();
  22756. break;
  22757. case LEFTPARENTHESIS$7:
  22758. child = this.Parentheses(parentheses, this.scope.AtrulePrelude);
  22759. break;
  22760. default:
  22761. break scan;
  22762. }
  22763. if (space !== null) {
  22764. children.push(space);
  22765. space = null;
  22766. }
  22767. children.push(child);
  22768. }
  22769. return children;
  22770. }
  22771. var supports = {
  22772. parse: {
  22773. prelude: function() {
  22774. var children = readSequence.call(this);
  22775. if (this.getFirstListNode(children) === null) {
  22776. this.error('Condition is expected');
  22777. }
  22778. return children;
  22779. },
  22780. block: function() {
  22781. return this.Block(false);
  22782. }
  22783. }
  22784. };
  22785. var atrule = {
  22786. 'font-face': fontFace,
  22787. 'import': _import,
  22788. 'media': media,
  22789. 'page': page,
  22790. 'supports': supports
  22791. };
  22792. var dir = {
  22793. parse: function() {
  22794. return this.createSingleNodeList(
  22795. this.Identifier()
  22796. );
  22797. }
  22798. };
  22799. var has$1 = {
  22800. parse: function() {
  22801. return this.createSingleNodeList(
  22802. this.SelectorList()
  22803. );
  22804. }
  22805. };
  22806. var lang = {
  22807. parse: function() {
  22808. return this.createSingleNodeList(
  22809. this.Identifier()
  22810. );
  22811. }
  22812. };
  22813. var selectorList = {
  22814. parse: function selectorList() {
  22815. return this.createSingleNodeList(
  22816. this.SelectorList()
  22817. );
  22818. }
  22819. };
  22820. var matches = selectorList;
  22821. var not = selectorList;
  22822. var ALLOW_OF_CLAUSE = true;
  22823. var nthWithOfClause = {
  22824. parse: function nthWithOfClause() {
  22825. return this.createSingleNodeList(
  22826. this.Nth(ALLOW_OF_CLAUSE)
  22827. );
  22828. }
  22829. };
  22830. var nthChild = nthWithOfClause;
  22831. var nthLastChild = nthWithOfClause;
  22832. var DISALLOW_OF_CLAUSE = false;
  22833. var nth$1 = {
  22834. parse: function nth() {
  22835. return this.createSingleNodeList(
  22836. this.Nth(DISALLOW_OF_CLAUSE)
  22837. );
  22838. }
  22839. };
  22840. var nthLastOfType = nth$1;
  22841. var nthOfType = nth$1;
  22842. var slotted = {
  22843. parse: function compoundSelector() {
  22844. return this.createSingleNodeList(
  22845. this.Selector()
  22846. );
  22847. }
  22848. };
  22849. var pseudo = {
  22850. 'dir': dir,
  22851. 'has': has$1,
  22852. 'lang': lang,
  22853. 'matches': matches,
  22854. 'not': not,
  22855. 'nth-child': nthChild,
  22856. 'nth-last-child': nthLastChild,
  22857. 'nth-last-of-type': nthLastOfType,
  22858. 'nth-of-type': nthOfType,
  22859. 'slotted': slotted
  22860. };
  22861. var parser = {
  22862. parseContext: {
  22863. default: 'StyleSheet',
  22864. stylesheet: 'StyleSheet',
  22865. atrule: 'Atrule',
  22866. atrulePrelude: function(options) {
  22867. return this.AtrulePrelude(options.atrule ? String(options.atrule) : null);
  22868. },
  22869. mediaQueryList: 'MediaQueryList',
  22870. mediaQuery: 'MediaQuery',
  22871. rule: 'Rule',
  22872. selectorList: 'SelectorList',
  22873. selector: 'Selector',
  22874. block: function() {
  22875. return this.Block(true);
  22876. },
  22877. declarationList: 'DeclarationList',
  22878. declaration: 'Declaration',
  22879. value: 'Value'
  22880. },
  22881. scope: scope,
  22882. atrule: atrule,
  22883. pseudo: pseudo,
  22884. node: node
  22885. };
  22886. var walker = {
  22887. node: node
  22888. };
  22889. function merge() {
  22890. var dest = {};
  22891. for (var i = 0; i < arguments.length; i++) {
  22892. var src = arguments[i];
  22893. for (var key in src) {
  22894. dest[key] = src[key];
  22895. }
  22896. }
  22897. return dest;
  22898. }
  22899. var syntax = create$5.create(
  22900. merge(
  22901. lexer,
  22902. parser,
  22903. walker
  22904. )
  22905. );
  22906. var lib = syntax;
  22907. class Sheet {
  22908. constructor(url, hooks) {
  22909. if (hooks) {
  22910. this.hooks = hooks;
  22911. } else {
  22912. this.hooks = {};
  22913. this.hooks.onUrl = new Hook(this);
  22914. this.hooks.onAtPage = new Hook(this);
  22915. this.hooks.onAtMedia = new Hook(this);
  22916. this.hooks.onRule = new Hook(this);
  22917. this.hooks.onDeclaration = new Hook(this);
  22918. this.hooks.onSelector = new Hook(this);
  22919. this.hooks.onPseudoSelector = new Hook(this);
  22920. this.hooks.onContent = new Hook(this);
  22921. this.hooks.onImport = new Hook(this);
  22922. this.hooks.beforeTreeParse = new Hook(this);
  22923. this.hooks.beforeTreeWalk = new Hook(this);
  22924. this.hooks.afterTreeWalk = new Hook(this);
  22925. }
  22926. try {
  22927. this.url = new URL(url, window.location.href);
  22928. } catch (e) {
  22929. this.url = new URL(window.location.href);
  22930. }
  22931. }
  22932. // parse
  22933. async parse(text) {
  22934. this.text = text;
  22935. await this.hooks.beforeTreeParse.trigger(this.text, this);
  22936. // send to csstree
  22937. this.ast = lib.parse(this._text);
  22938. await this.hooks.beforeTreeWalk.trigger(this.ast);
  22939. // Replace urls
  22940. this.replaceUrls(this.ast);
  22941. // Scope
  22942. this.id = UUID();
  22943. // this.addScope(this.ast, this.uuid);
  22944. // Replace IDs with data-id
  22945. this.replaceIds(this.ast);
  22946. this.imported = [];
  22947. // Trigger Hooks
  22948. this.urls(this.ast);
  22949. this.rules(this.ast);
  22950. this.atrules(this.ast);
  22951. await this.hooks.afterTreeWalk.trigger(this.ast, this);
  22952. // return ast
  22953. return this.ast;
  22954. }
  22955. insertRule(rule) {
  22956. let inserted = this.ast.children.appendData(rule);
  22957. inserted.forEach((item) => {
  22958. this.declarations(item);
  22959. });
  22960. }
  22961. urls(ast) {
  22962. lib.walk(ast, {
  22963. visit: "Url",
  22964. enter: (node, item, list) => {
  22965. this.hooks.onUrl.trigger(node, item, list);
  22966. }
  22967. });
  22968. }
  22969. atrules(ast) {
  22970. lib.walk(ast, {
  22971. visit: "Atrule",
  22972. enter: (node, item, list) => {
  22973. const basename = lib.keyword(node.name).basename;
  22974. if (basename === "page") {
  22975. this.hooks.onAtPage.trigger(node, item, list);
  22976. this.declarations(node, item, list);
  22977. }
  22978. if (basename === "media") {
  22979. this.hooks.onAtMedia.trigger(node, item, list);
  22980. this.declarations(node, item, list);
  22981. }
  22982. if (basename === "import") {
  22983. this.hooks.onImport.trigger(node, item, list);
  22984. this.imports(node, item, list);
  22985. }
  22986. }
  22987. });
  22988. }
  22989. rules(ast) {
  22990. lib.walk(ast, {
  22991. visit: "Rule",
  22992. enter: (ruleNode, ruleItem, rulelist) => {
  22993. // console.log("rule", ruleNode);
  22994. this.hooks.onRule.trigger(ruleNode, ruleItem, rulelist);
  22995. this.declarations(ruleNode, ruleItem, rulelist);
  22996. this.onSelector(ruleNode, ruleItem, rulelist);
  22997. }
  22998. });
  22999. }
  23000. declarations(ruleNode, ruleItem, rulelist) {
  23001. lib.walk(ruleNode, {
  23002. visit: "Declaration",
  23003. enter: (declarationNode, dItem, dList) => {
  23004. // console.log(declarationNode);
  23005. this.hooks.onDeclaration.trigger(declarationNode, dItem, dList, {ruleNode, ruleItem, rulelist});
  23006. if (declarationNode.property === "content") {
  23007. lib.walk(declarationNode, {
  23008. visit: "Function",
  23009. enter: (funcNode, fItem, fList) => {
  23010. this.hooks.onContent.trigger(funcNode, fItem, fList, {declarationNode, dItem, dList}, {ruleNode, ruleItem, rulelist});
  23011. }
  23012. });
  23013. }
  23014. }
  23015. });
  23016. }
  23017. // add pseudo elements to parser
  23018. onSelector(ruleNode, ruleItem, rulelist) {
  23019. lib.walk(ruleNode, {
  23020. visit: "Selector",
  23021. enter: (selectNode, selectItem, selectList) => {
  23022. // console.log(selectNode);
  23023. this.hooks.onSelector.trigger(selectNode, selectItem, selectList, {ruleNode, ruleItem, rulelist});
  23024. if (selectNode.children.forEach(node => {if (node.type === "PseudoElementSelector") {
  23025. lib.walk(node, {
  23026. visit: "PseudoElementSelector",
  23027. enter: (pseudoNode, pItem, pList) => {
  23028. this.hooks.onPseudoSelector.trigger(pseudoNode, pItem, pList, {selectNode, selectItem, selectList}, {ruleNode, ruleItem, rulelist});
  23029. }
  23030. });
  23031. }}));
  23032. // else {
  23033. // console.log("dommage");
  23034. // }
  23035. }
  23036. });
  23037. }
  23038. replaceUrls(ast) {
  23039. lib.walk(ast, {
  23040. visit: "Url",
  23041. enter: (node, item, list) => {
  23042. let content = node.value.value;
  23043. if ((node.value.type === "Raw" && content.startsWith("data:")) || (node.value.type === "String" && (content.startsWith("\"data:") || content.startsWith("'data:")))) ; else {
  23044. let href = content.replace(/["']/g, "");
  23045. let url = new URL(href, this.url);
  23046. node.value.value = url.toString();
  23047. }
  23048. }
  23049. });
  23050. }
  23051. addScope(ast, id) {
  23052. // Get all selector lists
  23053. // add an id
  23054. lib.walk(ast, {
  23055. visit: "Selector",
  23056. enter: (node, item, list) => {
  23057. let children = node.children;
  23058. children.prepend(children.createItem({
  23059. type: "WhiteSpace",
  23060. value: " "
  23061. }));
  23062. children.prepend(children.createItem({
  23063. type: "IdSelector",
  23064. name: id,
  23065. loc: null,
  23066. children: null
  23067. }));
  23068. }
  23069. });
  23070. }
  23071. getNamedPageSelectors(ast) {
  23072. let namedPageSelectors = {};
  23073. lib.walk(ast, {
  23074. visit: "Rule",
  23075. enter: (node, item, list) => {
  23076. lib.walk(node, {
  23077. visit: "Declaration",
  23078. enter: (declaration, dItem, dList) => {
  23079. if (declaration.property === "page") {
  23080. let value = declaration.value.children.first();
  23081. let name = value.name;
  23082. let selector = lib.generate(node.prelude);
  23083. namedPageSelectors[name] = {
  23084. name: name,
  23085. selector: selector
  23086. };
  23087. // dList.remove(dItem);
  23088. // Add in page break
  23089. declaration.property = "break-before";
  23090. value.type = "Identifier";
  23091. value.name = "always";
  23092. }
  23093. }
  23094. });
  23095. }
  23096. });
  23097. return namedPageSelectors;
  23098. }
  23099. replaceIds(ast) {
  23100. lib.walk(ast, {
  23101. visit: "Rule",
  23102. enter: (node, item, list) => {
  23103. lib.walk(node, {
  23104. visit: "IdSelector",
  23105. enter: (idNode, idItem, idList) => {
  23106. let name = idNode.name;
  23107. idNode.flags = null;
  23108. idNode.matcher = "=";
  23109. idNode.name = {type: "Identifier", loc: null, name: "data-id"};
  23110. idNode.type = "AttributeSelector";
  23111. idNode.value = {type: "String", loc: null, value: `"${name}"`};
  23112. }
  23113. });
  23114. }
  23115. });
  23116. }
  23117. imports(node, item, list) {
  23118. // console.log("import", node, item, list);
  23119. let queries = [];
  23120. lib.walk(node, {
  23121. visit: "MediaQuery",
  23122. enter: (mqNode, mqItem, mqList) => {
  23123. lib.walk(mqNode, {
  23124. visit: "Identifier",
  23125. enter: (identNode, identItem, identList) => {
  23126. queries.push(identNode.name);
  23127. }
  23128. });
  23129. }
  23130. });
  23131. // Just basic media query support for now
  23132. let shouldNotApply = queries.some((query, index) => {
  23133. let q = query;
  23134. if (q === "not") {
  23135. q = queries[index + 1];
  23136. return !(q === "screen" || q === "speech");
  23137. } else {
  23138. return (q === "screen" || q === "speech");
  23139. }
  23140. });
  23141. if (shouldNotApply) {
  23142. return;
  23143. }
  23144. lib.walk(node, {
  23145. visit: "String",
  23146. enter: (urlNode, urlItem, urlList) => {
  23147. let href = urlNode.value.replace(/["']/g, "");
  23148. let url = new URL(href, this.url);
  23149. let value = url.toString();
  23150. this.imported.push(value);
  23151. // Remove the original
  23152. list.remove(item);
  23153. }
  23154. });
  23155. }
  23156. set text(t) {
  23157. this._text = t;
  23158. }
  23159. get text() {
  23160. return this._text;
  23161. }
  23162. // generate string
  23163. toString(ast) {
  23164. return lib.generate(ast || this.ast);
  23165. }
  23166. }
  23167. var baseStyles = `
  23168. :root {
  23169. --pagedjs-width: 8.5in;
  23170. --pagedjs-height: 11in;
  23171. --pagedjs-width-right: 8.5in;
  23172. --pagedjs-height-right: 11in;
  23173. --pagedjs-width-left: 8.5in;
  23174. --pagedjs-height-left: 11in;
  23175. --pagedjs-pagebox-width: 8.5in;
  23176. --pagedjs-pagebox-height: 11in;
  23177. --pagedjs-margin-top: 1in;
  23178. --pagedjs-margin-right: 1in;
  23179. --pagedjs-margin-bottom: 1in;
  23180. --pagedjs-margin-left: 1in;
  23181. --pagedjs-padding-top: 0mm;
  23182. --pagedjs-padding-right: 0mm;
  23183. --pagedjs-padding-bottom: 0mm;
  23184. --pagedjs-padding-left: 0mm;
  23185. --pagedjs-border-top: 0mm;
  23186. --pagedjs-border-right: 0mm;
  23187. --pagedjs-border-bottom: 0mm;
  23188. --pagedjs-border-left: 0mm;
  23189. --pagedjs-bleed-top: 0mm;
  23190. --pagedjs-bleed-right: 0mm;
  23191. --pagedjs-bleed-bottom: 0mm;
  23192. --pagedjs-bleed-left: 0mm;
  23193. --pagedjs-bleed-right-top: 0mm;
  23194. --pagedjs-bleed-right-right: 0mm;
  23195. --pagedjs-bleed-right-bottom: 0mm;
  23196. --pagedjs-bleed-right-left: 0mm;
  23197. --pagedjs-bleed-left-top: 0mm;
  23198. --pagedjs-bleed-left-right: 0mm;
  23199. --pagedjs-bleed-left-bottom: 0mm;
  23200. --pagedjs-bleed-left-left: 0mm;
  23201. --pagedjs-crop-color: black;
  23202. --pagedjs-crop-offset: 2mm;
  23203. --pagedjs-crop-stroke: 1px;
  23204. --pagedjs-cross-size: 5mm;
  23205. --pagedjs-mark-cross-display: none;
  23206. --pagedjs-mark-crop-display: none;
  23207. --pagedjs-page-count: 0;
  23208. --pagedjs-page-counter-increment: 1;
  23209. }
  23210. @page {
  23211. size: letter;
  23212. margin: 0;
  23213. }
  23214. .pagedjs_sheet {
  23215. box-sizing: border-box;
  23216. width: var(--pagedjs-width);
  23217. height: var(--pagedjs-height);
  23218. overflow: hidden;
  23219. position: relative;
  23220. display: grid;
  23221. grid-template-columns: [bleed-left] var(--pagedjs-bleed-left) [sheet-center] calc(var(--pagedjs-width) - var(--pagedjs-bleed-left) - var(--pagedjs-bleed-right)) [bleed-right] var(--pagedjs-bleed-right);
  23222. grid-template-rows: [bleed-top] var(--pagedjs-bleed-top) [sheet-middle] calc(var(--pagedjs-height) - var(--pagedjs-bleed-top) - var(--pagedjs-bleed-bottom)) [bleed-bottom] var(--pagedjs-bleed-bottom);
  23223. }
  23224. .pagedjs_right_page .pagedjs_sheet {
  23225. width: var(--pagedjs-width-right);
  23226. height: var(--pagedjs-height-right);
  23227. grid-template-columns: [bleed-left] var(--pagedjs-bleed-right-left) [sheet-center] calc(var(--pagedjs-width) - var(--pagedjs-bleed-right-left) - var(--pagedjs-bleed-right-right)) [bleed-right] var(--pagedjs-bleed-right-right);
  23228. grid-template-rows: [bleed-top] var(--pagedjs-bleed-right-top) [sheet-middle] calc(var(--pagedjs-height) - var(--pagedjs-bleed-right-top) - var(--pagedjs-bleed-right-bottom)) [bleed-bottom] var(--pagedjs-bleed-right-bottom);
  23229. }
  23230. .pagedjs_left_page .pagedjs_sheet {
  23231. width: var(--pagedjs-width-left);
  23232. height: var(--pagedjs-height-left);
  23233. grid-template-columns: [bleed-left] var(--pagedjs-bleed-left-left) [sheet-center] calc(var(--pagedjs-width) - var(--pagedjs-bleed-left-left) - var(--pagedjs-bleed-left-right)) [bleed-right] var(--pagedjs-bleed-left-right);
  23234. grid-template-rows: [bleed-top] var(--pagedjs-bleed-left-top) [sheet-middle] calc(var(--pagedjs-height) - var(--pagedjs-bleed-left-top) - var(--pagedjs-bleed-left-bottom)) [bleed-bottom] var(--pagedjs-bleed-left-bottom);
  23235. }
  23236. .pagedjs_bleed {
  23237. display: flex;
  23238. align-items: center;
  23239. justify-content: center;
  23240. flex-wrap: nowrap;
  23241. overflow: hidden;
  23242. }
  23243. .pagedjs_bleed-top {
  23244. grid-column: bleed-left / -1;
  23245. grid-row: bleed-top;
  23246. flex-direction: row;
  23247. }
  23248. .pagedjs_bleed-bottom {
  23249. grid-column: bleed-left / -1;
  23250. grid-row: bleed-bottom;
  23251. flex-direction: row;
  23252. }
  23253. .pagedjs_bleed-left {
  23254. grid-column: bleed-left;
  23255. grid-row: bleed-top / -1;
  23256. flex-direction: column;
  23257. }
  23258. .pagedjs_bleed-right {
  23259. grid-column: bleed-right;
  23260. grid-row: bleed-top / -1;
  23261. flex-direction: column;
  23262. }
  23263. .pagedjs_marks-crop {
  23264. display: var(--pagedjs-mark-crop-display);
  23265. flex-grow: 0;
  23266. flex-shrink: 0;
  23267. z-index: 9999999999;
  23268. }
  23269. .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1),
  23270. .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) {
  23271. width: calc(var(--pagedjs-bleed-left) - var(--pagedjs-crop-stroke));
  23272. border-right: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  23273. }
  23274. .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1),
  23275. .pagedjs_right_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) {
  23276. width: calc(var(--pagedjs-bleed-right-left) - var(--pagedjs-crop-stroke));
  23277. }
  23278. .pagedjs_left_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1),
  23279. .pagedjs_left_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) {
  23280. width: calc(var(--pagedjs-bleed-left-left) - var(--pagedjs-crop-stroke));
  23281. }
  23282. .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3),
  23283. .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) {
  23284. width: calc(var(--pagedjs-bleed-right) - var(--pagedjs-crop-stroke));
  23285. border-left: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  23286. }
  23287. .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3),
  23288. .pagedjs_right_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) {
  23289. width: calc(var(--pagedjs-bleed-right-right) - var(--pagedjs-crop-stroke));
  23290. }
  23291. .pagedjs_left_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3),
  23292. .pagedjs_left_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) {
  23293. width: calc(var(--pagedjs-bleed-left-right) - var(--pagedjs-crop-stroke));
  23294. }
  23295. .pagedjs_bleed-top .pagedjs_marks-crop {
  23296. align-self: flex-start;
  23297. height: calc(var(--pagedjs-bleed-top) - var(--pagedjs-crop-offset));
  23298. }
  23299. .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop {
  23300. height: calc(var(--pagedjs-bleed-right-top) - var(--pagedjs-crop-offset));
  23301. }
  23302. .pagedjs_left_page .pagedjs_bleed-top .pagedjs_marks-crop {
  23303. height: calc(var(--pagedjs-bleed-left-top) - var(--pagedjs-crop-offset));
  23304. }
  23305. .pagedjs_bleed-bottom .pagedjs_marks-crop {
  23306. align-self: flex-end;
  23307. height: calc(var(--pagedjs-bleed-bottom) - var(--pagedjs-crop-offset));
  23308. }
  23309. .pagedjs_right_page .pagedjs_bleed-bottom .pagedjs_marks-crop {
  23310. height: calc(var(--pagedjs-bleed-right-bottom) - var(--pagedjs-crop-offset));
  23311. }
  23312. .pagedjs_left_page .pagedjs_bleed-bottom .pagedjs_marks-crop {
  23313. height: calc(var(--pagedjs-bleed-left-bottom) - var(--pagedjs-crop-offset));
  23314. }
  23315. .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1),
  23316. .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) {
  23317. height: calc(var(--pagedjs-bleed-top) - var(--pagedjs-crop-stroke));
  23318. border-bottom: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  23319. }
  23320. .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1),
  23321. .pagedjs_right_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) {
  23322. height: calc(var(--pagedjs-bleed-right-top) - var(--pagedjs-crop-stroke));
  23323. }
  23324. .pagedjs_left_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1),
  23325. .pagedjs_left_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) {
  23326. height: calc(var(--pagedjs-bleed-left-top) - var(--pagedjs-crop-stroke));
  23327. }
  23328. .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3),
  23329. .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) {
  23330. height: calc(var(--pagedjs-bleed-bottom) - var(--pagedjs-crop-stroke));
  23331. border-top: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  23332. }
  23333. .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3),
  23334. .pagedjs_right_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) {
  23335. height: calc(var(--pagedjs-bleed-right-bottom) - var(--pagedjs-crop-stroke));
  23336. }
  23337. .pagedjs_left_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3),
  23338. .pagedjs_left_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) {
  23339. height: calc(var(--pagedjs-bleed-left-bottom) - var(--pagedjs-crop-stroke));
  23340. }
  23341. .pagedjs_bleed-left .pagedjs_marks-crop {
  23342. width: calc(var(--pagedjs-bleed-left) - var(--pagedjs-crop-offset));
  23343. align-self: flex-start;
  23344. }
  23345. .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop {
  23346. width: calc(var(--pagedjs-bleed-right-left) - var(--pagedjs-crop-offset));
  23347. }
  23348. .pagedjs_left_page .pagedjs_bleed-left .pagedjs_marks-crop {
  23349. width: calc(var(--pagedjs-bleed-left-left) - var(--pagedjs-crop-offset));
  23350. }
  23351. .pagedjs_bleed-right .pagedjs_marks-crop {
  23352. width: calc(var(--pagedjs-bleed-right) - var(--pagedjs-crop-offset));
  23353. align-self: flex-end;
  23354. }
  23355. .pagedjs_right_page .pagedjs_bleed-right .pagedjs_marks-crop {
  23356. width: calc(var(--pagedjs-bleed-right-right) - var(--pagedjs-crop-offset));
  23357. }
  23358. .pagedjs_left_page .pagedjs_bleed-right .pagedjs_marks-crop {
  23359. width: calc(var(--pagedjs-bleed-left-right) - var(--pagedjs-crop-offset));
  23360. }
  23361. .pagedjs_marks-middle {
  23362. display: flex;
  23363. flex-grow: 1;
  23364. flex-shrink: 0;
  23365. align-items: center;
  23366. justify-content: center;
  23367. }
  23368. .pagedjs_marks-cross {
  23369. display: var(--pagedjs-mark-cross-display);
  23370. background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIzMi41MzdweCIgaGVpZ2h0PSIzMi41MzdweCIgdmlld0JveD0iMC4xMDQgMC4xMDQgMzIuNTM3IDMyLjUzNyIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwLjEwNCAwLjEwNCAzMi41MzcgMzIuNTM3IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMy4zODkzIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIGQ9Ik0yOS45MzEsMTYuMzczYzAsNy40ODktNi4wNjgsMTMuNTYtMTMuNTU4LDEzLjU2Yy03LjQ4MywwLTEzLjU1Ny02LjA3Mi0xMy41NTctMTMuNTZjMC03LjQ4Niw2LjA3NC0xMy41NTQsMTMuNTU3LTEzLjU1NEMyMy44NjIsMi44MTksMjkuOTMxLDguODg3LDI5LjkzMSwxNi4zNzN6Ii8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjMuMzg5MyIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMC4xMDQiIHkxPSIxNi4zNzMiIHgyPSIzMi42NDIiIHkyPSIxNi4zNzMiLz48bGluZSBmaWxsPSJub25lIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMy4zODkzIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHgxPSIxNi4zNzMiIHkxPSIwLjEwNCIgeDI9IjE2LjM3MyIgeTI9IjMyLjY0MiIvPjxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIzLjM4OTMiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgZD0iTTI0LjUwOCwxNi4zNzNjMCw0LjQ5Ni0zLjYzOCw4LjEzNS04LjEzNSw4LjEzNWMtNC40OTEsMC04LjEzNS0zLjYzOC04LjEzNS04LjEzNWMwLTQuNDg5LDMuNjQ0LTguMTM1LDguMTM1LTguMTM1QzIwLjg2OSw4LjIzOSwyNC41MDgsMTEuODg0LDI0LjUwOCwxNi4zNzN6Ii8+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjAuNjc3OCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBkPSJNMjkuOTMxLDE2LjM3M2MwLDcuNDg5LTYuMDY4LDEzLjU2LTEzLjU1OCwxMy41NmMtNy40ODMsMC0xMy41NTctNi4wNzItMTMuNTU3LTEzLjU2YzAtNy40ODYsNi4wNzQtMTMuNTU0LDEzLjU1Ny0xMy41NTRDMjMuODYyLDIuODE5LDI5LjkzMSw4Ljg4NywyOS45MzEsMTYuMzczeiIvPjxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLXdpZHRoPSIwLjY3NzgiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgeDE9IjAuMTA0IiB5MT0iMTYuMzczIiB4Mj0iMzIuNjQyIiB5Mj0iMTYuMzczIi8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjAuNjc3OCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMTYuMzczIiB5MT0iMC4xMDQiIHgyPSIxNi4zNzMiIHkyPSIzMi42NDIiLz48cGF0aCBkPSJNMjQuNTA4LDE2LjM3M2MwLDQuNDk2LTMuNjM4LDguMTM1LTguMTM1LDguMTM1Yy00LjQ5MSwwLTguMTM1LTMuNjM4LTguMTM1LTguMTM1YzAtNC40ODksMy42NDQtOC4xMzUsOC4xMzUtOC4xMzVDMjAuODY5LDguMjM5LDI0LjUwOCwxMS44ODQsMjQuNTA4LDE2LjM3MyIvPjxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIwLjY3NzgiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgeDE9IjguMjM5IiB5MT0iMTYuMzczIiB4Mj0iMjQuNTA4IiB5Mj0iMTYuMzczIi8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjAuNjc3OCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMTYuMzczIiB5MT0iOC4yMzkiIHgyPSIxNi4zNzMiIHkyPSIyNC41MDgiLz48L3N2Zz4=);
  23371. background-repeat: no-repeat;
  23372. background-position: 50% 50%;
  23373. background-size: var(--pagedjs-cross-size);
  23374. z-index: 2147483647;
  23375. width: var(--pagedjs-cross-size);
  23376. height: var(--pagedjs-cross-size);
  23377. }
  23378. .pagedjs_pagebox {
  23379. box-sizing: border-box;
  23380. width: var(--pagedjs-pagebox-width);
  23381. height: var(--pagedjs-pagebox-height);
  23382. position: relative;
  23383. display: grid;
  23384. grid-template-columns: [left] var(--pagedjs-margin-left) [center] calc(var(--pagedjs-pagebox-width) - var(--pagedjs-margin-left) - var(--pagedjs-margin-right)) [right] var(--pagedjs-margin-right);
  23385. grid-template-rows: [header] var(--pagedjs-margin-top) [page] calc(var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top) - var(--pagedjs-margin-bottom)) [footer] var(--pagedjs-margin-bottom);
  23386. grid-column: sheet-center;
  23387. grid-row: sheet-middle;
  23388. }
  23389. .pagedjs_pagebox * {
  23390. box-sizing: border-box;
  23391. }
  23392. .pagedjs_margin-top {
  23393. width: calc(var(--pagedjs-pagebox-width) - var(--pagedjs-margin-left) - var(--pagedjs-margin-right));
  23394. height: var(--pagedjs-margin-top);
  23395. grid-column: center;
  23396. grid-row: header;
  23397. flex-wrap: nowrap;
  23398. display: grid;
  23399. grid-template-columns: repeat(3, 1fr);
  23400. grid-template-rows: 100%;
  23401. }
  23402. .pagedjs_margin-top-left-corner-holder {
  23403. width: var(--pagedjs-margin-left);
  23404. height: var(--pagedjs-margin-top);
  23405. display: flex;
  23406. grid-column: left;
  23407. grid-row: header;
  23408. }
  23409. .pagedjs_margin-top-right-corner-holder {
  23410. width: var(--pagedjs-margin-right);
  23411. height: var(--pagedjs-margin-top);
  23412. display: flex;
  23413. grid-column: right;
  23414. grid-row: header;
  23415. }
  23416. .pagedjs_margin-top-left-corner {
  23417. width: var(--pagedjs-margin-left);
  23418. }
  23419. .pagedjs_margin-top-right-corner {
  23420. width: var(--pagedjs-margin-right);
  23421. }
  23422. .pagedjs_margin-right {
  23423. height: calc(var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top) - var(--pagedjs-margin-bottom));
  23424. width: var(--pagedjs-margin-right);
  23425. right: 0;
  23426. grid-column: right;
  23427. grid-row: page;
  23428. display: grid;
  23429. grid-template-rows: repeat(3, 33.3333%);
  23430. grid-template-columns: 100%;
  23431. }
  23432. .pagedjs_margin-bottom {
  23433. width: calc(var(--pagedjs-pagebox-width) - var(--pagedjs-margin-left) - var(--pagedjs-margin-right));
  23434. height: var(--pagedjs-margin-bottom);
  23435. grid-column: center;
  23436. grid-row: footer;
  23437. display: grid;
  23438. grid-template-columns: repeat(3, 1fr);
  23439. grid-template-rows: 100%;
  23440. }
  23441. .pagedjs_margin-bottom-left-corner-holder {
  23442. width: var(--pagedjs-margin-left);
  23443. height: var(--pagedjs-margin-bottom);
  23444. display: flex;
  23445. grid-column: left;
  23446. grid-row: footer;
  23447. }
  23448. .pagedjs_margin-bottom-right-corner-holder {
  23449. width: var(--pagedjs-margin-right);
  23450. height: var(--pagedjs-margin-bottom);
  23451. display: flex;
  23452. grid-column: right;
  23453. grid-row: footer;
  23454. }
  23455. .pagedjs_margin-bottom-left-corner {
  23456. width: var(--pagedjs-margin-left);
  23457. }
  23458. .pagedjs_margin-bottom-right-corner {
  23459. width: var(--pagedjs-margin-right);
  23460. }
  23461. .pagedjs_margin-left {
  23462. height: calc(var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top) - var(--pagedjs-margin-bottom));
  23463. width: var(--pagedjs-margin-left);
  23464. grid-column: left;
  23465. grid-row: page;
  23466. display: grid;
  23467. grid-template-rows: repeat(3, 33.33333%);
  23468. grid-template-columns: 100%;
  23469. }
  23470. .pagedjs_pages .pagedjs_pagebox .pagedjs_margin:not(.hasContent) {
  23471. visibility: hidden;
  23472. }
  23473. .pagedjs_pagebox > .pagedjs_area {
  23474. grid-column: center;
  23475. grid-row: page;
  23476. width: 100%;
  23477. height: 100%;
  23478. padding: var(--pagedjs-padding-top) var(--pagedjs-padding-right) var(--pagedjs-padding-bottom) var(--pagedjs-padding-left);
  23479. border-top: var(--pagedjs-border-top);
  23480. border-right: var(--pagedjs-border-right);
  23481. border-bottom: var(--pagedjs-border-bottom);
  23482. border-left: var(--pagedjs-border-left);
  23483. }
  23484. .pagedjs_pagebox > .pagedjs_area > .pagedjs_page_content {
  23485. width: 100%;
  23486. height: 100%;
  23487. position: relative;
  23488. column-fill: auto;
  23489. }
  23490. .pagedjs_page {
  23491. counter-increment: page var(--pagedjs-page-counter-increment);
  23492. width: var(--pagedjs-width);
  23493. height: var(--pagedjs-height);
  23494. }
  23495. .pagedjs_page.pagedjs_right_page {
  23496. width: var(--pagedjs-width-right);
  23497. height: var(--pagedjs-height-right);
  23498. }
  23499. .pagedjs_page.pagedjs_left_page {
  23500. width: var(--pagedjs-width-left);
  23501. height: var(--pagedjs-height-left);
  23502. }
  23503. .pagedjs_pages {
  23504. counter-reset: pages var(--pagedjs-page-count);
  23505. }
  23506. .pagedjs_pagebox .pagedjs_margin-top-left-corner,
  23507. .pagedjs_pagebox .pagedjs_margin-top-right-corner,
  23508. .pagedjs_pagebox .pagedjs_margin-bottom-left-corner,
  23509. .pagedjs_pagebox .pagedjs_margin-bottom-right-corner,
  23510. .pagedjs_pagebox .pagedjs_margin-top-left,
  23511. .pagedjs_pagebox .pagedjs_margin-top-right,
  23512. .pagedjs_pagebox .pagedjs_margin-bottom-left,
  23513. .pagedjs_pagebox .pagedjs_margin-bottom-right,
  23514. .pagedjs_pagebox .pagedjs_margin-top-center,
  23515. .pagedjs_pagebox .pagedjs_margin-bottom-center,
  23516. .pagedjs_pagebox .pagedjs_margin-top-center,
  23517. .pagedjs_pagebox .pagedjs_margin-bottom-center,
  23518. .pagedjs_margin-right-middle,
  23519. .pagedjs_margin-left-middle {
  23520. display: flex;
  23521. align-items: center;
  23522. }
  23523. .pagedjs_margin-right-top,
  23524. .pagedjs_margin-left-top {
  23525. display: flex;
  23526. align-items: flex-top;
  23527. }
  23528. .pagedjs_margin-right-bottom,
  23529. .pagedjs_margin-left-bottom {
  23530. display: flex;
  23531. align-items: flex-end;
  23532. }
  23533. /*
  23534. .pagedjs_pagebox .pagedjs_margin-top-center,
  23535. .pagedjs_pagebox .pagedjs_margin-bottom-center {
  23536. height: 100%;
  23537. display: none;
  23538. align-items: center;
  23539. flex: 1 0 33%;
  23540. margin: 0 auto;
  23541. }
  23542. .pagedjs_pagebox .pagedjs_margin-top-left-corner,
  23543. .pagedjs_pagebox .pagedjs_margin-top-right-corner,
  23544. .pagedjs_pagebox .pagedjs_margin-bottom-right-corner,
  23545. .pagedjs_pagebox .pagedjs_margin-bottom-left-corner {
  23546. display: none;
  23547. align-items: center;
  23548. }
  23549. .pagedjs_pagebox .pagedjs_margin-left-top,
  23550. .pagedjs_pagebox .pagedjs_margin-right-top {
  23551. display: none;
  23552. align-items: flex-start;
  23553. }
  23554. .pagedjs_pagebox .pagedjs_margin-right-middle,
  23555. .pagedjs_pagebox .pagedjs_margin-left-middle {
  23556. display: none;
  23557. align-items: center;
  23558. }
  23559. .pagedjs_pagebox .pagedjs_margin-left-bottom,
  23560. .pagedjs_pagebox .pagedjs_margin-right-bottom {
  23561. display: none;
  23562. align-items: flex-end;
  23563. }
  23564. */
  23565. .pagedjs_pagebox .pagedjs_margin-top-left,
  23566. .pagedjs_pagebox .pagedjs_margin-top-right-corner,
  23567. .pagedjs_pagebox .pagedjs_margin-bottom-left,
  23568. .pagedjs_pagebox .pagedjs_margin-bottom-right-corner { text-align: left; }
  23569. .pagedjs_pagebox .pagedjs_margin-top-left-corner,
  23570. .pagedjs_pagebox .pagedjs_margin-top-right,
  23571. .pagedjs_pagebox .pagedjs_margin-bottom-left-corner,
  23572. .pagedjs_pagebox .pagedjs_margin-bottom-right { text-align: right; }
  23573. .pagedjs_pagebox .pagedjs_margin-top-center,
  23574. .pagedjs_pagebox .pagedjs_margin-bottom-center,
  23575. .pagedjs_pagebox .pagedjs_margin-left-top,
  23576. .pagedjs_pagebox .pagedjs_margin-left-middle,
  23577. .pagedjs_pagebox .pagedjs_margin-left-bottom,
  23578. .pagedjs_pagebox .pagedjs_margin-right-top,
  23579. .pagedjs_pagebox .pagedjs_margin-right-middle,
  23580. .pagedjs_pagebox .pagedjs_margin-right-bottom { text-align: center; }
  23581. .pagedjs_pages .pagedjs_margin .pagedjs_margin-content {
  23582. width: 100%;
  23583. }
  23584. .pagedjs_pages .pagedjs_margin-left .pagedjs_margin-content::after,
  23585. .pagedjs_pages .pagedjs_margin-top .pagedjs_margin-content::after,
  23586. .pagedjs_pages .pagedjs_margin-right .pagedjs_margin-content::after,
  23587. .pagedjs_pages .pagedjs_margin-bottom .pagedjs_margin-content::after {
  23588. display: block;
  23589. }
  23590. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to] {
  23591. margin-bottom: unset;
  23592. padding-bottom: unset;
  23593. }
  23594. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from] {
  23595. text-indent: unset;
  23596. margin-top: unset;
  23597. padding-top: unset;
  23598. initial-letter: unset;
  23599. }
  23600. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from] > *::first-letter,
  23601. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]::first-letter {
  23602. color: unset;
  23603. font-size: unset;
  23604. font-weight: unset;
  23605. font-family: unset;
  23606. color: unset;
  23607. line-height: unset;
  23608. float: unset;
  23609. padding: unset;
  23610. margin: unset;
  23611. }
  23612. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to]:after,
  23613. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to]::after {
  23614. content: unset;
  23615. }
  23616. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]:before,
  23617. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]::before {
  23618. content: unset;
  23619. }
  23620. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div li[data-split-from]:first-of-type {
  23621. list-style: none;
  23622. }
  23623. /*
  23624. [data-page]:not([data-split-from]),
  23625. [data-break-before="page"]:not([data-split-from]),
  23626. [data-break-before="always"]:not([data-split-from]),
  23627. [data-break-before="left"]:not([data-split-from]),
  23628. [data-break-before="right"]:not([data-split-from]),
  23629. [data-break-before="recto"]:not([data-split-from]),
  23630. [data-break-before="verso"]:not([data-split-from])
  23631. {
  23632. break-before: column;
  23633. }
  23634. [data-page]:not([data-split-to]),
  23635. [data-break-after="page"]:not([data-split-to]),
  23636. [data-break-after="always"]:not([data-split-to]),
  23637. [data-break-after="left"]:not([data-split-to]),
  23638. [data-break-after="right"]:not([data-split-to]),
  23639. [data-break-after="recto"]:not([data-split-to]),
  23640. [data-break-after="verso"]:not([data-split-to])
  23641. {
  23642. break-after: column;
  23643. }
  23644. */
  23645. .pagedjs_clear-after::after {
  23646. content: none !important;
  23647. }
  23648. [data-align-last-split-element='justify'] {
  23649. text-align-last: justify;
  23650. }
  23651. @media print {
  23652. html {
  23653. width: 100%;
  23654. height: 100%;
  23655. }
  23656. body {
  23657. margin: 0;
  23658. padding: 0;
  23659. width: 100% !important;
  23660. height: 100% !important;
  23661. min-width: 100%;
  23662. max-width: 100%;
  23663. min-height: 100%;
  23664. max-height: 100%;
  23665. }
  23666. .pagedjs_pages {
  23667. width: auto;
  23668. display: block !important;
  23669. transform: none !important;
  23670. height: 100% !important;
  23671. min-height: 100%;
  23672. max-height: 100%;
  23673. overflow: visible;
  23674. }
  23675. .pagedjs_page {
  23676. margin: 0;
  23677. padding: 0;
  23678. max-height: 100%;
  23679. min-height: 100%;
  23680. height: 100% !important;
  23681. page-break-after: always;
  23682. break-after: page;
  23683. }
  23684. .pagedjs_sheet {
  23685. margin: 0;
  23686. padding: 0;
  23687. max-height: 100%;
  23688. min-height: 100%;
  23689. height: 100% !important;
  23690. }
  23691. }
  23692. `;
  23693. async function request(url, options={}) {
  23694. return new Promise(function(resolve, reject) {
  23695. let request = new XMLHttpRequest();
  23696. request.open(options.method || "get", url, true);
  23697. for (let i in options.headers) {
  23698. request.setRequestHeader(i, options.headers[i]);
  23699. }
  23700. request.withCredentials = options.credentials === "include";
  23701. request.onload = () => {
  23702. // Chrome returns a status code of 0 for local files
  23703. const status = request.status === 0 && url.startsWith("file://") ? 200 : request.status;
  23704. resolve(new Response(request.responseText, {status}));
  23705. };
  23706. request.onerror = reject;
  23707. request.send(options.body || null);
  23708. });
  23709. }
  23710. class Polisher {
  23711. constructor(setup) {
  23712. this.sheets = [];
  23713. this.inserted = [];
  23714. this.hooks = {};
  23715. this.hooks.onUrl = new Hook(this);
  23716. this.hooks.onAtPage = new Hook(this);
  23717. this.hooks.onAtMedia = new Hook(this);
  23718. this.hooks.onRule = new Hook(this);
  23719. this.hooks.onDeclaration = new Hook(this);
  23720. this.hooks.onContent = new Hook(this);
  23721. this.hooks.onSelector = new Hook(this);
  23722. this.hooks.onPseudoSelector = new Hook(this);
  23723. this.hooks.onImport = new Hook(this);
  23724. this.hooks.beforeTreeParse = new Hook(this);
  23725. this.hooks.beforeTreeWalk = new Hook(this);
  23726. this.hooks.afterTreeWalk = new Hook(this);
  23727. if (setup !== false) {
  23728. this.setup();
  23729. }
  23730. }
  23731. setup() {
  23732. this.base = this.insert(baseStyles);
  23733. this.styleEl = document.createElement("style");
  23734. document.head.appendChild(this.styleEl);
  23735. this.styleSheet = this.styleEl.sheet;
  23736. return this.styleSheet;
  23737. }
  23738. async add() {
  23739. let fetched = [];
  23740. let urls = [];
  23741. for (var i = 0; i < arguments.length; i++) {
  23742. let f;
  23743. if (typeof arguments[i] === "object") {
  23744. for (let url in arguments[i]) {
  23745. let obj = arguments[i];
  23746. f = new Promise(function(resolve, reject) {
  23747. urls.push(url);
  23748. resolve(obj[url]);
  23749. });
  23750. }
  23751. } else {
  23752. urls.push(arguments[i]);
  23753. f = request(arguments[i]).then((response) => {
  23754. return response.text();
  23755. });
  23756. }
  23757. fetched.push(f);
  23758. }
  23759. return await Promise.all(fetched)
  23760. .then(async (originals) => {
  23761. let text = "";
  23762. for (let index = 0; index < originals.length; index++) {
  23763. text = await this.convertViaSheet(originals[index], urls[index]);
  23764. this.insert(text);
  23765. }
  23766. return text;
  23767. });
  23768. }
  23769. async convertViaSheet(cssStr, href) {
  23770. let sheet = new Sheet(href, this.hooks);
  23771. await sheet.parse(cssStr);
  23772. // Insert the imported sheets first
  23773. for (let url of sheet.imported) {
  23774. let str = await request(url).then((response) => {
  23775. return response.text();
  23776. });
  23777. let text = await this.convertViaSheet(str, url);
  23778. this.insert(text);
  23779. }
  23780. this.sheets.push(sheet);
  23781. if (typeof sheet.width !== "undefined") {
  23782. this.width = sheet.width;
  23783. }
  23784. if (typeof sheet.height !== "undefined") {
  23785. this.height = sheet.height;
  23786. }
  23787. if (typeof sheet.orientation !== "undefined") {
  23788. this.orientation = sheet.orientation;
  23789. }
  23790. return sheet.toString();
  23791. }
  23792. insert(text){
  23793. let head = document.querySelector("head");
  23794. let style = document.createElement("style");
  23795. style.type = "text/css";
  23796. style.setAttribute("data-pagedjs-inserted-styles", "true");
  23797. style.appendChild(document.createTextNode(text));
  23798. head.appendChild(style);
  23799. this.inserted.push(style);
  23800. return style;
  23801. }
  23802. destroy() {
  23803. this.styleEl.remove();
  23804. this.inserted.forEach((s) => {
  23805. s.remove();
  23806. });
  23807. this.sheets = [];
  23808. }
  23809. }
  23810. class Handler {
  23811. constructor(chunker, polisher, caller) {
  23812. let hooks = Object.assign({}, chunker && chunker.hooks, polisher && polisher.hooks, caller && caller.hooks);
  23813. this.chunker = chunker;
  23814. this.polisher = polisher;
  23815. this.caller = caller;
  23816. for (let name in hooks) {
  23817. if (name in this) {
  23818. let hook = hooks[name];
  23819. hook.register(this[name].bind(this));
  23820. }
  23821. }
  23822. }
  23823. }
  23824. eventEmitter(Handler.prototype);
  23825. // https://www.w3.org/TR/css3-page/#page-size-prop
  23826. var pageSizes = {
  23827. "A0": {
  23828. width: {
  23829. value: 841,
  23830. unit: "mm"
  23831. },
  23832. height: {
  23833. value: 1189,
  23834. unit: "mm"
  23835. }
  23836. },
  23837. "A1": {
  23838. width: {
  23839. value: 594,
  23840. unit: "mm"
  23841. },
  23842. height: {
  23843. value: 841,
  23844. unit: "mm"
  23845. }
  23846. },
  23847. "A2": {
  23848. width: {
  23849. value: 420,
  23850. unit: "mm"
  23851. },
  23852. height: {
  23853. value: 594,
  23854. unit: "mm"
  23855. }
  23856. },
  23857. "A3": {
  23858. width: {
  23859. value: 297,
  23860. unit: "mm"
  23861. },
  23862. height: {
  23863. value: 420,
  23864. unit: "mm"
  23865. }
  23866. },
  23867. "A4": {
  23868. width: {
  23869. value: 210,
  23870. unit: "mm"
  23871. },
  23872. height: {
  23873. value: 297,
  23874. unit: "mm"
  23875. }
  23876. },
  23877. "A5": {
  23878. width: {
  23879. value: 148,
  23880. unit: "mm"
  23881. },
  23882. height: {
  23883. value: 210,
  23884. unit: "mm"
  23885. }
  23886. },
  23887. "A6": {
  23888. width: {
  23889. value: 105,
  23890. unit: "mm"
  23891. },
  23892. height: {
  23893. value: 148,
  23894. unit: "mm"
  23895. }
  23896. },
  23897. "A7": {
  23898. width: {
  23899. value: 74,
  23900. unit: "mm"
  23901. },
  23902. height: {
  23903. value: 105,
  23904. unit: "mm"
  23905. }
  23906. },
  23907. "A8": {
  23908. width: {
  23909. value: 52,
  23910. unit: "mm"
  23911. },
  23912. height: {
  23913. value: 74,
  23914. unit: "mm"
  23915. }
  23916. },
  23917. "A9": {
  23918. width: {
  23919. value: 37,
  23920. unit: "mm"
  23921. },
  23922. height: {
  23923. value: 52,
  23924. unit: "mm"
  23925. }
  23926. },
  23927. "A10": {
  23928. width: {
  23929. value: 26,
  23930. unit: "mm"
  23931. },
  23932. height: {
  23933. value: 37,
  23934. unit: "mm"
  23935. }
  23936. },
  23937. "B4": {
  23938. width: {
  23939. value: 250,
  23940. unit: "mm"
  23941. },
  23942. height: {
  23943. value: 353,
  23944. unit: "mm"
  23945. }
  23946. },
  23947. "B5": {
  23948. width: {
  23949. value: 176,
  23950. unit: "mm"
  23951. },
  23952. height: {
  23953. value: 250,
  23954. unit: "mm"
  23955. }
  23956. },
  23957. "letter": {
  23958. width: {
  23959. value: 8.5,
  23960. unit: "in"
  23961. },
  23962. height: {
  23963. value: 11,
  23964. unit: "in"
  23965. }
  23966. },
  23967. "legal": {
  23968. width: {
  23969. value: 8.5,
  23970. unit: "in"
  23971. },
  23972. height: {
  23973. value: 14,
  23974. unit: "in"
  23975. }
  23976. },
  23977. "ledger": {
  23978. width: {
  23979. value: 11,
  23980. unit: "in"
  23981. },
  23982. height: {
  23983. value: 17,
  23984. unit: "in"
  23985. }
  23986. }
  23987. };
  23988. class AtPage extends Handler {
  23989. constructor(chunker, polisher, caller) {
  23990. super(chunker, polisher, caller);
  23991. this.pages = {};
  23992. this.width = undefined;
  23993. this.height = undefined;
  23994. this.orientation = undefined;
  23995. this.marginalia = {};
  23996. }
  23997. pageModel(selector) {
  23998. return {
  23999. selector: selector,
  24000. name: undefined,
  24001. psuedo: undefined,
  24002. nth: undefined,
  24003. marginalia: {},
  24004. width: undefined,
  24005. height: undefined,
  24006. orientation: undefined,
  24007. margin: {
  24008. top: {},
  24009. right: {},
  24010. left: {},
  24011. bottom: {}
  24012. },
  24013. padding: {
  24014. top: {},
  24015. right: {},
  24016. left: {},
  24017. bottom: {}
  24018. },
  24019. border: {
  24020. top: {},
  24021. right: {},
  24022. left: {},
  24023. bottom: {}
  24024. },
  24025. backgroundOrigin: undefined,
  24026. block: {},
  24027. marks: undefined
  24028. };
  24029. }
  24030. // Find and Remove @page rules
  24031. onAtPage(node, item, list) {
  24032. let page, marginalia;
  24033. let selector = "";
  24034. let named, psuedo, nth;
  24035. let needsMerge = false;
  24036. if (node.prelude) {
  24037. named = this.getTypeSelector(node);
  24038. psuedo = this.getPsuedoSelector(node);
  24039. nth = this.getNthSelector(node);
  24040. selector = lib.generate(node.prelude);
  24041. } else {
  24042. selector = "*";
  24043. }
  24044. if (selector in this.pages) {
  24045. // this.pages[selector] = Object.assign(this.pages[selector], page);
  24046. // console.log("after", selector, this.pages[selector]);
  24047. // this.pages[selector].added = false;
  24048. page = this.pages[selector];
  24049. marginalia = this.replaceMarginalia(node);
  24050. needsMerge = true;
  24051. } else {
  24052. page = this.pageModel(selector);
  24053. marginalia = this.replaceMarginalia(node);
  24054. this.pages[selector] = page;
  24055. }
  24056. page.name = named;
  24057. page.psuedo = psuedo;
  24058. page.nth = nth;
  24059. if (needsMerge) {
  24060. page.marginalia = Object.assign(page.marginalia, marginalia);
  24061. } else {
  24062. page.marginalia = marginalia;
  24063. }
  24064. let declarations = this.replaceDeclarations(node);
  24065. if (declarations.size) {
  24066. page.size = declarations.size;
  24067. page.width = declarations.size.width;
  24068. page.height = declarations.size.height;
  24069. page.orientation = declarations.size.orientation;
  24070. page.format = declarations.size.format;
  24071. }
  24072. if (declarations.bleed && declarations.bleed[0] != "auto") {
  24073. switch (declarations.bleed.length) {
  24074. case 4: // top right bottom left
  24075. page.bleed = {
  24076. top: declarations.bleed[0],
  24077. right: declarations.bleed[1],
  24078. bottom: declarations.bleed[2],
  24079. left: declarations.bleed[3]
  24080. };
  24081. break;
  24082. case 3: // top right bottom right
  24083. page.bleed = {
  24084. top: declarations.bleed[0],
  24085. right: declarations.bleed[1],
  24086. bottom: declarations.bleed[2],
  24087. left: declarations.bleed[1]
  24088. };
  24089. break;
  24090. case 2: // top right top right
  24091. page.bleed = {
  24092. top: declarations.bleed[0],
  24093. right: declarations.bleed[1],
  24094. bottom: declarations.bleed[0],
  24095. left: declarations.bleed[1]
  24096. };
  24097. break;
  24098. default:
  24099. page.bleed = {
  24100. top: declarations.bleed[0],
  24101. right: declarations.bleed[0],
  24102. bottom: declarations.bleed[0],
  24103. left: declarations.bleed[0]
  24104. };
  24105. }
  24106. }
  24107. if (declarations.marks) {
  24108. if (!declarations.bleed || declarations.bleed && declarations.bleed[0] === "auto") {
  24109. // Spec say 6pt, but needs more space for marks
  24110. page.bleed = {
  24111. top: { value: 6, unit: "mm" },
  24112. right: { value: 6, unit: "mm" },
  24113. bottom: { value: 6, unit: "mm" },
  24114. left: { value: 6, unit: "mm" }
  24115. };
  24116. }
  24117. page.marks = declarations.marks;
  24118. }
  24119. if (declarations.margin) {
  24120. page.margin = declarations.margin;
  24121. }
  24122. if (declarations.padding) {
  24123. page.padding = declarations.padding;
  24124. }
  24125. if (declarations.border) {
  24126. page.border = declarations.border;
  24127. }
  24128. if (declarations.marks) {
  24129. page.marks = declarations.marks;
  24130. }
  24131. if (needsMerge) {
  24132. page.block.children.appendList(node.block.children);
  24133. } else {
  24134. page.block = node.block;
  24135. }
  24136. // Remove the rule
  24137. list.remove(item);
  24138. }
  24139. /* Handled in breaks */
  24140. /*
  24141. afterParsed(parsed) {
  24142. for (let b in this.named) {
  24143. // Find elements
  24144. let elements = parsed.querySelectorAll(b);
  24145. // Add break data
  24146. for (var i = 0; i < elements.length; i++) {
  24147. elements[i].setAttribute("data-page", this.named[b]);
  24148. }
  24149. }
  24150. }
  24151. */
  24152. afterTreeWalk(ast, sheet) {
  24153. this.addPageClasses(this.pages, ast, sheet);
  24154. if ("*" in this.pages) {
  24155. let width = this.pages["*"].width;
  24156. let height = this.pages["*"].height;
  24157. let format = this.pages["*"].format;
  24158. let orientation = this.pages["*"].orientation;
  24159. let bleed = this.pages["*"].bleed;
  24160. let marks = this.pages["*"].marks;
  24161. let bleedverso = undefined;
  24162. let bleedrecto = undefined;
  24163. if (":left" in this.pages) {
  24164. bleedverso = this.pages[":left"].bleed;
  24165. }
  24166. if (":right" in this.pages) {
  24167. bleedrecto = this.pages[":right"].bleed;
  24168. }
  24169. if ((width && height) &&
  24170. (this.width !== width || this.height !== height)) {
  24171. this.width = width;
  24172. this.height = height;
  24173. this.format = format;
  24174. this.orientation = orientation;
  24175. this.addRootVars(ast, width, height, orientation, bleed, bleedrecto, bleedverso, marks);
  24176. this.addRootPage(ast, this.pages["*"].size, bleed, bleedrecto, bleedverso);
  24177. this.emit("size", { width, height, orientation, format, bleed });
  24178. this.emit("atpages", this.pages);
  24179. }
  24180. }
  24181. }
  24182. getTypeSelector(ast) {
  24183. // Find page name
  24184. let name;
  24185. lib.walk(ast, {
  24186. visit: "TypeSelector",
  24187. enter: (node, item, list) => {
  24188. name = node.name;
  24189. }
  24190. });
  24191. return name;
  24192. }
  24193. getPsuedoSelector(ast) {
  24194. // Find if it has :left & :right & :black & :first
  24195. let name;
  24196. lib.walk(ast, {
  24197. visit: "PseudoClassSelector",
  24198. enter: (node, item, list) => {
  24199. if (node.name !== "nth") {
  24200. name = node.name;
  24201. }
  24202. }
  24203. });
  24204. return name;
  24205. }
  24206. getNthSelector(ast) {
  24207. // Find if it has :nth
  24208. let nth;
  24209. lib.walk(ast, {
  24210. visit: "PseudoClassSelector",
  24211. enter: (node, item, list) => {
  24212. if (node.name === "nth" && node.children) {
  24213. let raw = node.children.first();
  24214. nth = raw.value;
  24215. }
  24216. }
  24217. });
  24218. return nth;
  24219. }
  24220. replaceMarginalia(ast) {
  24221. let parsed = {};
  24222. lib.walk(ast.block, {
  24223. visit: "Atrule",
  24224. enter: (node, item, list) => {
  24225. let name = node.name;
  24226. if (name === "top") {
  24227. name = "top-center";
  24228. }
  24229. if (name === "right") {
  24230. name = "right-middle";
  24231. }
  24232. if (name === "left") {
  24233. name = "left-middle";
  24234. }
  24235. if (name === "bottom") {
  24236. name = "bottom-center";
  24237. }
  24238. parsed[name] = node.block;
  24239. list.remove(item);
  24240. }
  24241. });
  24242. return parsed;
  24243. }
  24244. replaceDeclarations(ast) {
  24245. let parsed = {};
  24246. lib.walk(ast.block, {
  24247. visit: "Declaration",
  24248. enter: (declaration, dItem, dList) => {
  24249. let prop = lib.property(declaration.property).name;
  24250. // let value = declaration.value;
  24251. if (prop === "marks") {
  24252. parsed.marks = [];
  24253. lib.walk(declaration, {
  24254. visit: "Identifier",
  24255. enter: (ident) => {
  24256. parsed.marks.push(ident.name);
  24257. }
  24258. });
  24259. dList.remove(dItem);
  24260. } else if (prop === "margin") {
  24261. parsed.margin = this.getMargins(declaration);
  24262. dList.remove(dItem);
  24263. } else if (prop.indexOf("margin-") === 0) {
  24264. let m = prop.substring("margin-".length);
  24265. if (!parsed.margin) {
  24266. parsed.margin = {
  24267. top: {},
  24268. right: {},
  24269. left: {},
  24270. bottom: {}
  24271. };
  24272. }
  24273. parsed.margin[m] = declaration.value.children.first();
  24274. dList.remove(dItem);
  24275. } else if (prop === "padding") {
  24276. parsed.padding = this.getPaddings(declaration.value);
  24277. dList.remove(dItem);
  24278. } else if (prop.indexOf("padding-") === 0) {
  24279. let p = prop.substring("padding-".length);
  24280. if (!parsed.padding) {
  24281. parsed.padding = {
  24282. top: {},
  24283. right: {},
  24284. left: {},
  24285. bottom: {}
  24286. };
  24287. }
  24288. parsed.padding[p] = declaration.value.children.first();
  24289. dList.remove(dItem);
  24290. }
  24291. else if (prop === "border") {
  24292. if (!parsed.border) {
  24293. parsed.border = {
  24294. top: {},
  24295. right: {},
  24296. left: {},
  24297. bottom: {}
  24298. };
  24299. }
  24300. parsed.border.top = lib.generate(declaration.value);
  24301. parsed.border.right = lib.generate(declaration.value);
  24302. parsed.border.left = lib.generate(declaration.value);
  24303. parsed.border.bottom = lib.generate(declaration.value);
  24304. dList.remove(dItem);
  24305. }
  24306. else if (prop.indexOf("border-") === 0) {
  24307. if (!parsed.border) {
  24308. parsed.border = {
  24309. top: {},
  24310. right: {},
  24311. left: {},
  24312. bottom: {}
  24313. };
  24314. }
  24315. let p = prop.substring("border-".length);
  24316. parsed.border[p] = lib.generate(declaration.value);
  24317. dList.remove(dItem);
  24318. }
  24319. else if (prop === "size") {
  24320. parsed.size = this.getSize(declaration);
  24321. dList.remove(dItem);
  24322. } else if (prop === "bleed") {
  24323. parsed.bleed = [];
  24324. lib.walk(declaration, {
  24325. enter: (subNode) => {
  24326. switch (subNode.type) {
  24327. case "String": // bleed: "auto"
  24328. if (subNode.value.indexOf("auto") > -1) {
  24329. parsed.bleed.push("auto");
  24330. }
  24331. break;
  24332. case "Dimension": // bleed: 1in 2in, bleed: 20px ect.
  24333. parsed.bleed.push({
  24334. value: subNode.value,
  24335. unit: subNode.unit
  24336. });
  24337. break;
  24338. case "Number":
  24339. parsed.bleed.push({
  24340. value: subNode.value,
  24341. unit: "px"
  24342. });
  24343. break;
  24344. // ignore
  24345. }
  24346. }
  24347. });
  24348. dList.remove(dItem);
  24349. }
  24350. }
  24351. });
  24352. return parsed;
  24353. }
  24354. getSize(declaration) {
  24355. let width, height, orientation, format;
  24356. // Get size: Xmm Ymm
  24357. lib.walk(declaration, {
  24358. visit: "Dimension",
  24359. enter: (node, item, list) => {
  24360. let { value, unit } = node;
  24361. if (typeof width === "undefined") {
  24362. width = { value, unit };
  24363. } else if (typeof height === "undefined") {
  24364. height = { value, unit };
  24365. }
  24366. }
  24367. });
  24368. // Get size: "A4"
  24369. lib.walk(declaration, {
  24370. visit: "String",
  24371. enter: (node, item, list) => {
  24372. let name = node.value.replace(/["|']/g, "");
  24373. let s = pageSizes[name];
  24374. if (s) {
  24375. width = s.width;
  24376. height = s.height;
  24377. }
  24378. }
  24379. });
  24380. // Get Format or Landscape or Portrait
  24381. lib.walk(declaration, {
  24382. visit: "Identifier",
  24383. enter: (node, item, list) => {
  24384. let name = node.name;
  24385. if (name === "landscape" || name === "portrait") {
  24386. orientation = node.name;
  24387. } else if (name !== "auto") {
  24388. let s = pageSizes[name];
  24389. if (s) {
  24390. width = s.width;
  24391. height = s.height;
  24392. }
  24393. format = name;
  24394. }
  24395. }
  24396. });
  24397. return {
  24398. width,
  24399. height,
  24400. orientation,
  24401. format
  24402. };
  24403. }
  24404. getMargins(declaration) {
  24405. let margins = [];
  24406. let margin = {
  24407. top: {},
  24408. right: {},
  24409. left: {},
  24410. bottom: {}
  24411. };
  24412. lib.walk(declaration, {
  24413. enter: (node) => {
  24414. switch (node.type) {
  24415. case "Dimension": // margin: 1in 2in, margin: 20px, etc...
  24416. margins.push(node);
  24417. break;
  24418. case "Number": // margin: 0
  24419. margins.push({value: node.value, unit: "px"});
  24420. break;
  24421. // ignore
  24422. }
  24423. }
  24424. });
  24425. if (margins.length === 1) {
  24426. for (let m in margin) {
  24427. margin[m] = margins[0];
  24428. }
  24429. } else if (margins.length === 2) {
  24430. margin.top = margins[0];
  24431. margin.right = margins[1];
  24432. margin.bottom = margins[0];
  24433. margin.left = margins[1];
  24434. } else if (margins.length === 3) {
  24435. margin.top = margins[0];
  24436. margin.right = margins[1];
  24437. margin.bottom = margins[2];
  24438. margin.left = margins[1];
  24439. } else if (margins.length === 4) {
  24440. margin.top = margins[0];
  24441. margin.right = margins[1];
  24442. margin.bottom = margins[2];
  24443. margin.left = margins[3];
  24444. }
  24445. return margin;
  24446. }
  24447. getPaddings(declaration) {
  24448. let paddings = [];
  24449. let padding = {
  24450. top: {},
  24451. right: {},
  24452. left: {},
  24453. bottom: {}
  24454. };
  24455. lib.walk(declaration, {
  24456. enter: (node) => {
  24457. switch (node.type) {
  24458. case "Dimension": // padding: 1in 2in, padding: 20px, etc...
  24459. paddings.push(node);
  24460. break;
  24461. case "Number": // padding: 0
  24462. paddings.push({value: node.value, unit: "px"});
  24463. break;
  24464. // ignore
  24465. }
  24466. }
  24467. });
  24468. if (paddings.length === 1) {
  24469. for (let p in padding) {
  24470. padding[p] = paddings[0];
  24471. }
  24472. } else if (paddings.length === 2) {
  24473. padding.top = paddings[0];
  24474. padding.right = paddings[1];
  24475. padding.bottom = paddings[0];
  24476. padding.left = paddings[1];
  24477. } else if (paddings.length === 3) {
  24478. padding.top = paddings[0];
  24479. padding.right = paddings[1];
  24480. padding.bottom = paddings[2];
  24481. padding.left = paddings[1];
  24482. } else if (paddings.length === 4) {
  24483. padding.top = paddings[0];
  24484. padding.right = paddings[1];
  24485. padding.bottom = paddings[2];
  24486. padding.left = paddings[3];
  24487. }
  24488. return padding;
  24489. }
  24490. // get values for the border on the @page to pass them to the element with the .pagedjs_area class
  24491. getBorders(declaration) {
  24492. let border = {
  24493. top: {},
  24494. right: {},
  24495. left: {},
  24496. bottom: {}
  24497. };
  24498. if (declaration.prop == "border") {
  24499. border.top = lib.generate(declaration.value);
  24500. border.right = lib.generate(declaration.value);
  24501. border.bottom = lib.generate(declaration.value);
  24502. border.left = lib.generate(declaration.value);
  24503. }
  24504. else if (declaration.prop == "border-top") {
  24505. border.top = lib.generate(declaration.value);
  24506. }
  24507. else if (declaration.prop == "border-right") {
  24508. border.right = lib.generate(declaration.value);
  24509. }
  24510. else if (declaration.prop == "border-bottom") {
  24511. border.bottom = lib.generate(declaration.value);
  24512. }
  24513. else if (declaration.prop == "border-left") {
  24514. border.left = lib.generate(declaration.value);
  24515. }
  24516. return border;
  24517. }
  24518. addPageClasses(pages, ast, sheet) {
  24519. // First add * page
  24520. if ("*" in pages) {
  24521. let p = this.createPage(pages["*"], ast.children, sheet);
  24522. sheet.insertRule(p);
  24523. }
  24524. // Add :left & :right
  24525. if (":left" in pages) {
  24526. let left = this.createPage(pages[":left"], ast.children, sheet);
  24527. sheet.insertRule(left);
  24528. }
  24529. if (":right" in pages) {
  24530. let right = this.createPage(pages[":right"], ast.children, sheet);
  24531. sheet.insertRule(right);
  24532. }
  24533. // Add :first & :blank
  24534. if (":first" in pages) {
  24535. let first = this.createPage(pages[":first"], ast.children, sheet);
  24536. sheet.insertRule(first);
  24537. }
  24538. if (":blank" in pages) {
  24539. let blank = this.createPage(pages[":blank"], ast.children, sheet);
  24540. sheet.insertRule(blank);
  24541. }
  24542. // Add nth pages
  24543. for (let pg in pages) {
  24544. if (pages[pg].nth) {
  24545. let nth = this.createPage(pages[pg], ast.children, sheet);
  24546. sheet.insertRule(nth);
  24547. }
  24548. }
  24549. // Add named pages
  24550. for (let pg in pages) {
  24551. if (pages[pg].name) {
  24552. let named = this.createPage(pages[pg], ast.children, sheet);
  24553. sheet.insertRule(named);
  24554. }
  24555. }
  24556. }
  24557. createPage(page, ruleList, sheet) {
  24558. let selectors = this.selectorsForPage(page);
  24559. let children = page.block.children.copy();
  24560. let block = {
  24561. type: "Block",
  24562. loc: 0,
  24563. children: children
  24564. };
  24565. let rule = this.createRule(selectors, block);
  24566. this.addMarginVars(page.margin, children, children.first());
  24567. this.addPaddingVars(page.padding, children, children.first());
  24568. this.addBorderVars(page.border, children, children.first());
  24569. if (page.width) {
  24570. this.addDimensions(page.width, page.height, page.orientation, children, children.first());
  24571. }
  24572. if (page.marginalia) {
  24573. this.addMarginaliaStyles(page, ruleList, rule, sheet);
  24574. this.addMarginaliaContent(page, ruleList, rule, sheet);
  24575. }
  24576. return rule;
  24577. }
  24578. addMarginVars(margin, list, item) {
  24579. // variables for margins
  24580. for (let m in margin) {
  24581. if (typeof margin[m].value !== "undefined") {
  24582. let value = margin[m].value + (margin[m].unit || "");
  24583. let mVar = list.createItem({
  24584. type: "Declaration",
  24585. property: "--pagedjs-margin-" + m,
  24586. value: {
  24587. type: "Raw",
  24588. value: value
  24589. }
  24590. });
  24591. list.append(mVar, item);
  24592. }
  24593. }
  24594. }
  24595. addPaddingVars(padding, list, item) {
  24596. // variables for padding
  24597. for (let p in padding) {
  24598. if (typeof padding[p].value !== "undefined") {
  24599. let value = padding[p].value + (padding[p].unit || "");
  24600. let pVar = list.createItem({
  24601. type: "Declaration",
  24602. property: "--pagedjs-padding-" + p,
  24603. value: {
  24604. type: "Raw",
  24605. value: value
  24606. }
  24607. });
  24608. list.append(pVar, item);
  24609. }
  24610. }
  24611. }
  24612. addBorderVars(border, list, item) {
  24613. // variables for borders
  24614. for (let b in border) {
  24615. if (typeof border[b] !== "undefined") {
  24616. let value = border[b];
  24617. let bVar = list.createItem({
  24618. type: "Declaration",
  24619. property: "--pagedjs-border-" + b,
  24620. value: {
  24621. type: "Raw",
  24622. value: value
  24623. }
  24624. });
  24625. list.append(bVar, item);
  24626. }
  24627. }
  24628. }
  24629. addDimensions(width, height, orientation, list, item) {
  24630. let widthString, heightString;
  24631. widthString = CSSValueToString(width);
  24632. heightString = CSSValueToString(height);
  24633. if (orientation && orientation !== "portrait") {
  24634. // reverse for orientation
  24635. [widthString, heightString] = [heightString, widthString];
  24636. }
  24637. // width variable
  24638. let wVar = this.createVariable("--pagedjs-pagebox-width", widthString);
  24639. list.appendData(wVar);
  24640. // height variable
  24641. let hVar = this.createVariable("--pagedjs-pagebox-height", heightString);
  24642. list.appendData(hVar);
  24643. // let w = this.createDimension("width", width);
  24644. // let h = this.createDimension("height", height);
  24645. // list.appendData(w);
  24646. // list.appendData(h);
  24647. }
  24648. addMarginaliaStyles(page, list, item, sheet) {
  24649. for (let loc in page.marginalia) {
  24650. let block = lib.clone(page.marginalia[loc]);
  24651. let hasContent = false;
  24652. if (block.children.isEmpty()) {
  24653. continue;
  24654. }
  24655. lib.walk(block, {
  24656. visit: "Declaration",
  24657. enter: (node, item, list) => {
  24658. if (node.property === "content") {
  24659. if (node.value.children && node.value.children.first().name === "none") {
  24660. hasContent = false;
  24661. } else {
  24662. hasContent = true;
  24663. }
  24664. list.remove(item);
  24665. }
  24666. if (node.property === "vertical-align") {
  24667. lib.walk(node, {
  24668. visit: "Identifier",
  24669. enter: (identNode, identItem, identlist) => {
  24670. let name = identNode.name;
  24671. if (name === "top") {
  24672. identNode.name = "flex-start";
  24673. } else if (name === "middle") {
  24674. identNode.name = "center";
  24675. } else if (name === "bottom") {
  24676. identNode.name = "flex-end";
  24677. }
  24678. }
  24679. });
  24680. node.property = "align-items";
  24681. }
  24682. if (node.property === "width" &&
  24683. (loc === "top-left" ||
  24684. loc === "top-center" ||
  24685. loc === "top-right" ||
  24686. loc === "bottom-left" ||
  24687. loc === "bottom-center" ||
  24688. loc === "bottom-right")) {
  24689. let c = lib.clone(node);
  24690. c.property = "max-width";
  24691. list.appendData(c);
  24692. }
  24693. if (node.property === "height" &&
  24694. (loc === "left-top" ||
  24695. loc === "left-middle" ||
  24696. loc === "left-bottom" ||
  24697. loc === "right-top" ||
  24698. loc === "right-middle" ||
  24699. loc === "right-bottom")) {
  24700. let c = lib.clone(node);
  24701. c.property = "max-height";
  24702. list.appendData(c);
  24703. }
  24704. }
  24705. });
  24706. let marginSelectors = this.selectorsForPageMargin(page, loc);
  24707. let marginRule = this.createRule(marginSelectors, block);
  24708. list.appendData(marginRule);
  24709. let sel = lib.generate({
  24710. type: "Selector",
  24711. children: marginSelectors
  24712. });
  24713. this.marginalia[sel] = {
  24714. page: page,
  24715. selector: sel,
  24716. block: page.marginalia[loc],
  24717. hasContent: hasContent
  24718. };
  24719. }
  24720. }
  24721. addMarginaliaContent(page, list, item, sheet) {
  24722. let displayNone;
  24723. // Just content
  24724. for (let loc in page.marginalia) {
  24725. let content = lib.clone(page.marginalia[loc]);
  24726. lib.walk(content, {
  24727. visit: "Declaration",
  24728. enter: (node, item, list) => {
  24729. if (node.property !== "content") {
  24730. list.remove(item);
  24731. }
  24732. if (node.value.children && node.value.children.first().name === "none") {
  24733. displayNone = true;
  24734. }
  24735. }
  24736. });
  24737. if (content.children.isEmpty()) {
  24738. continue;
  24739. }
  24740. let displaySelectors = this.selectorsForPageMargin(page, loc);
  24741. let displayDeclaration;
  24742. displaySelectors.insertData({
  24743. type: "Combinator",
  24744. name: ">"
  24745. });
  24746. displaySelectors.insertData({
  24747. type: "ClassSelector",
  24748. name: "pagedjs_margin-content"
  24749. });
  24750. displaySelectors.insertData({
  24751. type: "Combinator",
  24752. name: ">"
  24753. });
  24754. displaySelectors.insertData({
  24755. type: "TypeSelector",
  24756. name: "*"
  24757. });
  24758. if (displayNone) {
  24759. displayDeclaration = this.createDeclaration("display", "none");
  24760. } else {
  24761. displayDeclaration = this.createDeclaration("display", "block");
  24762. }
  24763. let displayRule = this.createRule(displaySelectors, [displayDeclaration]);
  24764. sheet.insertRule(displayRule);
  24765. // insert content rule
  24766. let contentSelectors = this.selectorsForPageMargin(page, loc);
  24767. contentSelectors.insertData({
  24768. type: "Combinator",
  24769. name: ">"
  24770. });
  24771. contentSelectors.insertData({
  24772. type: "ClassSelector",
  24773. name: "pagedjs_margin-content"
  24774. });
  24775. contentSelectors.insertData({
  24776. type: "PseudoElementSelector",
  24777. name: "after",
  24778. children: null
  24779. });
  24780. let contentRule = this.createRule(contentSelectors, content);
  24781. sheet.insertRule(contentRule);
  24782. }
  24783. }
  24784. addRootVars(ast, width, height, orientation, bleed, bleedrecto, bleedverso, marks) {
  24785. let rules = [];
  24786. let selectors = new lib.List();
  24787. selectors.insertData({
  24788. type: "PseudoClassSelector",
  24789. name: "root",
  24790. children: null
  24791. });
  24792. let widthString, heightString;
  24793. let widthStringRight, heightStringRight;
  24794. let widthStringLeft, heightStringLeft;
  24795. if (!bleed) {
  24796. widthString = CSSValueToString(width);
  24797. heightString = CSSValueToString(height);
  24798. widthStringRight = CSSValueToString(width);
  24799. heightStringRight = CSSValueToString(height);
  24800. widthStringLeft = CSSValueToString(width);
  24801. heightStringLeft = CSSValueToString(height);
  24802. } else {
  24803. widthString = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleed.left)} + ${CSSValueToString(bleed.right)} )`;
  24804. heightString = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleed.top)} + ${CSSValueToString(bleed.bottom)} )`;
  24805. widthStringRight = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleed.left)} + ${CSSValueToString(bleed.right)} )`;
  24806. heightStringRight = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleed.top)} + ${CSSValueToString(bleed.bottom)} )`;
  24807. widthStringLeft = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleed.left)} + ${CSSValueToString(bleed.right)} )`;
  24808. heightStringLeft = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleed.top)} + ${CSSValueToString(bleed.bottom)} )`;
  24809. let bleedTop = this.createVariable("--pagedjs-bleed-top", CSSValueToString(bleed.top));
  24810. let bleedRight = this.createVariable("--pagedjs-bleed-right", CSSValueToString(bleed.right));
  24811. let bleedBottom = this.createVariable("--pagedjs-bleed-bottom", CSSValueToString(bleed.bottom));
  24812. let bleedLeft = this.createVariable("--pagedjs-bleed-left", CSSValueToString(bleed.left));
  24813. let bleedTopRecto = this.createVariable("--pagedjs-bleed-right-top", CSSValueToString(bleed.top));
  24814. let bleedRightRecto = this.createVariable("--pagedjs-bleed-right-right", CSSValueToString(bleed.right));
  24815. let bleedBottomRecto = this.createVariable("--pagedjs-bleed-right-bottom", CSSValueToString(bleed.bottom));
  24816. let bleedLeftRecto = this.createVariable("--pagedjs-bleed-right-left", CSSValueToString(bleed.left));
  24817. let bleedTopVerso = this.createVariable("--pagedjs-bleed-left-top", CSSValueToString(bleed.top));
  24818. let bleedRightVerso = this.createVariable("--pagedjs-bleed-left-right", CSSValueToString(bleed.right));
  24819. let bleedBottomVerso = this.createVariable("--pagedjs-bleed-left-bottom", CSSValueToString(bleed.bottom));
  24820. let bleedLeftVerso = this.createVariable("--pagedjs-bleed-left-left", CSSValueToString(bleed.left));
  24821. if (bleedrecto) {
  24822. bleedTopRecto = this.createVariable("--pagedjs-bleed-right-top", CSSValueToString(bleedrecto.top));
  24823. bleedRightRecto = this.createVariable("--pagedjs-bleed-right-right", CSSValueToString(bleedrecto.right));
  24824. bleedBottomRecto = this.createVariable("--pagedjs-bleed-right-bottom", CSSValueToString(bleedrecto.bottom));
  24825. bleedLeftRecto = this.createVariable("--pagedjs-bleed-right-left", CSSValueToString(bleedrecto.left));
  24826. widthStringRight = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleedrecto.left)} + ${CSSValueToString(bleedrecto.right)} )`;
  24827. heightStringRight = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleedrecto.top)} + ${CSSValueToString(bleedrecto.bottom)} )`;
  24828. }
  24829. if (bleedverso) {
  24830. bleedTopVerso = this.createVariable("--pagedjs-bleed-left-top", CSSValueToString(bleedverso.top));
  24831. bleedRightVerso = this.createVariable("--pagedjs-bleed-left-right", CSSValueToString(bleedverso.right));
  24832. bleedBottomVerso = this.createVariable("--pagedjs-bleed-left-bottom", CSSValueToString(bleedverso.bottom));
  24833. bleedLeftVerso = this.createVariable("--pagedjs-bleed-left-left", CSSValueToString(bleedverso.left));
  24834. widthStringLeft = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleedverso.left)} + ${CSSValueToString(bleedverso.right)} )`;
  24835. heightStringLeft = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleedverso.top)} + ${CSSValueToString(bleedverso.bottom)} )`;
  24836. }
  24837. let pageWidthVar = this.createVariable("--pagedjs-width", CSSValueToString(width));
  24838. let pageHeightVar = this.createVariable("--pagedjs-height", CSSValueToString(height));
  24839. rules.push(
  24840. bleedTop,
  24841. bleedRight,
  24842. bleedBottom,
  24843. bleedLeft,
  24844. bleedTopRecto,
  24845. bleedRightRecto,
  24846. bleedBottomRecto,
  24847. bleedLeftRecto,
  24848. bleedTopVerso,
  24849. bleedRightVerso,
  24850. bleedBottomVerso,
  24851. bleedLeftVerso,
  24852. pageWidthVar,
  24853. pageHeightVar
  24854. );
  24855. }
  24856. if (marks) {
  24857. marks.forEach((mark) => {
  24858. let markDisplay = this.createVariable("--pagedjs-mark-" + mark + "-display", "block");
  24859. rules.push(markDisplay);
  24860. });
  24861. }
  24862. // orientation variable
  24863. if (orientation) {
  24864. let oVar = this.createVariable("--pagedjs-orientation", orientation);
  24865. rules.push(oVar);
  24866. if (orientation !== "portrait") {
  24867. // reverse for orientation
  24868. [widthString, heightString] = [heightString, widthString];
  24869. [widthStringRight, heightStringRight] = [heightStringRight, widthStringRight];
  24870. [widthStringLeft, heightStringLeft] = [heightStringLeft, widthStringLeft];
  24871. }
  24872. }
  24873. let wVar = this.createVariable("--pagedjs-width", widthString);
  24874. let hVar = this.createVariable("--pagedjs-height", heightString);
  24875. let wVarR = this.createVariable("--pagedjs-width-right", widthStringRight);
  24876. let hVarR = this.createVariable("--pagedjs-height-right", heightStringRight);
  24877. let wVarL = this.createVariable("--pagedjs-width-left", widthStringLeft);
  24878. let hVarL = this.createVariable("--pagedjs-height-left", heightStringLeft);
  24879. rules.push(wVar, hVar, wVarR, hVarR, wVarL, hVarL);
  24880. let rule = this.createRule(selectors, rules);
  24881. ast.children.appendData(rule);
  24882. }
  24883. /*
  24884. @page {
  24885. size: var(--pagedjs-width) var(--pagedjs-height);
  24886. margin: 0;
  24887. padding: 0;
  24888. }
  24889. */
  24890. addRootPage(ast, size, bleed, bleedrecto, bleedverso) {
  24891. let { width, height, orientation, format } = size;
  24892. let children = new lib.List();
  24893. let childrenLeft = new lib.List();
  24894. let childrenRight = new lib.List();
  24895. let dimensions = new lib.List();
  24896. let dimensionsLeft = new lib.List();
  24897. let dimensionsRight = new lib.List();
  24898. if (bleed) {
  24899. let widthCalculations = new lib.List();
  24900. let heightCalculations = new lib.List();
  24901. // width
  24902. widthCalculations.appendData({
  24903. type: "Dimension",
  24904. unit: width.unit,
  24905. value: width.value
  24906. });
  24907. widthCalculations.appendData({
  24908. type: "WhiteSpace",
  24909. value: " "
  24910. });
  24911. widthCalculations.appendData({
  24912. type: "Operator",
  24913. value: "+"
  24914. });
  24915. widthCalculations.appendData({
  24916. type: "WhiteSpace",
  24917. value: " "
  24918. });
  24919. widthCalculations.appendData({
  24920. type: "Dimension",
  24921. unit: bleed.left.unit,
  24922. value: bleed.left.value
  24923. });
  24924. widthCalculations.appendData({
  24925. type: "WhiteSpace",
  24926. value: " "
  24927. });
  24928. widthCalculations.appendData({
  24929. type: "Operator",
  24930. value: "+"
  24931. });
  24932. widthCalculations.appendData({
  24933. type: "WhiteSpace",
  24934. value: " "
  24935. });
  24936. widthCalculations.appendData({
  24937. type: "Dimension",
  24938. unit: bleed.right.unit,
  24939. value: bleed.right.value
  24940. });
  24941. // height
  24942. heightCalculations.appendData({
  24943. type: "Dimension",
  24944. unit: height.unit,
  24945. value: height.value
  24946. });
  24947. heightCalculations.appendData({
  24948. type: "WhiteSpace",
  24949. value: " "
  24950. });
  24951. heightCalculations.appendData({
  24952. type: "Operator",
  24953. value: "+"
  24954. });
  24955. heightCalculations.appendData({
  24956. type: "WhiteSpace",
  24957. value: " "
  24958. });
  24959. heightCalculations.appendData({
  24960. type: "Dimension",
  24961. unit: bleed.top.unit,
  24962. value: bleed.top.value
  24963. });
  24964. heightCalculations.appendData({
  24965. type: "WhiteSpace",
  24966. value: " "
  24967. });
  24968. heightCalculations.appendData({
  24969. type: "Operator",
  24970. value: "+"
  24971. });
  24972. heightCalculations.appendData({
  24973. type: "WhiteSpace",
  24974. value: " "
  24975. });
  24976. heightCalculations.appendData({
  24977. type: "Dimension",
  24978. unit: bleed.bottom.unit,
  24979. value: bleed.bottom.value
  24980. });
  24981. dimensions.appendData({
  24982. type: "Function",
  24983. name: "calc",
  24984. children: widthCalculations
  24985. });
  24986. dimensions.appendData({
  24987. type: "WhiteSpace",
  24988. value: " "
  24989. });
  24990. dimensions.appendData({
  24991. type: "Function",
  24992. name: "calc",
  24993. children: heightCalculations
  24994. });
  24995. } else if (format) {
  24996. dimensions.appendData({
  24997. type: "Identifier",
  24998. name: format
  24999. });
  25000. if (orientation) {
  25001. dimensions.appendData({
  25002. type: "WhiteSpace",
  25003. value: " "
  25004. });
  25005. dimensions.appendData({
  25006. type: "Identifier",
  25007. name: orientation
  25008. });
  25009. }
  25010. } else {
  25011. dimensions.appendData({
  25012. type: "Dimension",
  25013. unit: width.unit,
  25014. value: width.value
  25015. });
  25016. dimensions.appendData({
  25017. type: "WhiteSpace",
  25018. value: " "
  25019. });
  25020. dimensions.appendData({
  25021. type: "Dimension",
  25022. unit: height.unit,
  25023. value: height.value
  25024. });
  25025. }
  25026. children.appendData({
  25027. type: "Declaration",
  25028. property: "size",
  25029. loc: null,
  25030. value: {
  25031. type: "Value",
  25032. children: dimensions
  25033. }
  25034. });
  25035. children.appendData({
  25036. type: "Declaration",
  25037. property: "margin",
  25038. loc: null,
  25039. value: {
  25040. type: "Value",
  25041. children: [{
  25042. type: "Dimension",
  25043. unit: "px",
  25044. value: 0
  25045. }]
  25046. }
  25047. });
  25048. children.appendData({
  25049. type: "Declaration",
  25050. property: "padding",
  25051. loc: null,
  25052. value: {
  25053. type: "Value",
  25054. children: [{
  25055. type: "Dimension",
  25056. unit: "px",
  25057. value: 0
  25058. }]
  25059. }
  25060. });
  25061. children.appendData({
  25062. type: "Declaration",
  25063. property: "padding",
  25064. loc: null,
  25065. value: {
  25066. type: "Value",
  25067. children: [{
  25068. type: "Dimension",
  25069. unit: "px",
  25070. value: 0
  25071. }]
  25072. }
  25073. });
  25074. let rule = ast.children.createItem({
  25075. type: "Atrule",
  25076. prelude: null,
  25077. name: "page",
  25078. block: {
  25079. type: "Block",
  25080. loc: null,
  25081. children: children
  25082. }
  25083. });
  25084. ast.children.append(rule);
  25085. if (bleedverso) {
  25086. let widthCalculationsLeft = new lib.List();
  25087. let heightCalculationsLeft = new lib.List();
  25088. // width
  25089. widthCalculationsLeft.appendData({
  25090. type: "Dimension",
  25091. unit: width.unit,
  25092. value: width.value
  25093. });
  25094. widthCalculationsLeft.appendData({
  25095. type: "WhiteSpace",
  25096. value: " "
  25097. });
  25098. widthCalculationsLeft.appendData({
  25099. type: "Operator",
  25100. value: "+"
  25101. });
  25102. widthCalculationsLeft.appendData({
  25103. type: "WhiteSpace",
  25104. value: " "
  25105. });
  25106. widthCalculationsLeft.appendData({
  25107. type: "Dimension",
  25108. unit: bleedverso.left.unit,
  25109. value: bleedverso.left.value
  25110. });
  25111. widthCalculationsLeft.appendData({
  25112. type: "WhiteSpace",
  25113. value: " "
  25114. });
  25115. widthCalculationsLeft.appendData({
  25116. type: "Operator",
  25117. value: "+"
  25118. });
  25119. widthCalculationsLeft.appendData({
  25120. type: "WhiteSpace",
  25121. value: " "
  25122. });
  25123. widthCalculationsLeft.appendData({
  25124. type: "Dimension",
  25125. unit: bleedverso.right.unit,
  25126. value: bleedverso.right.value
  25127. });
  25128. // height
  25129. heightCalculationsLeft.appendData({
  25130. type: "Dimension",
  25131. unit: height.unit,
  25132. value: height.value
  25133. });
  25134. heightCalculationsLeft.appendData({
  25135. type: "WhiteSpace",
  25136. value: " "
  25137. });
  25138. heightCalculationsLeft.appendData({
  25139. type: "Operator",
  25140. value: "+"
  25141. });
  25142. heightCalculationsLeft.appendData({
  25143. type: "WhiteSpace",
  25144. value: " "
  25145. });
  25146. heightCalculationsLeft.appendData({
  25147. type: "Dimension",
  25148. unit: bleedverso.top.unit,
  25149. value: bleedverso.top.value
  25150. });
  25151. heightCalculationsLeft.appendData({
  25152. type: "WhiteSpace",
  25153. value: " "
  25154. });
  25155. heightCalculationsLeft.appendData({
  25156. type: "Operator",
  25157. value: "+"
  25158. });
  25159. heightCalculationsLeft.appendData({
  25160. type: "WhiteSpace",
  25161. value: " "
  25162. });
  25163. heightCalculationsLeft.appendData({
  25164. type: "Dimension",
  25165. unit: bleedverso.bottom.unit,
  25166. value: bleedverso.bottom.value
  25167. });
  25168. dimensionsLeft.appendData({
  25169. type: "Function",
  25170. name: "calc",
  25171. children: widthCalculationsLeft
  25172. });
  25173. dimensionsLeft.appendData({
  25174. type: "WhiteSpace",
  25175. value: " "
  25176. });
  25177. dimensionsLeft.appendData({
  25178. type: "Function",
  25179. name: "calc",
  25180. children: heightCalculationsLeft
  25181. });
  25182. childrenLeft.appendData({
  25183. type: "Declaration",
  25184. property: "size",
  25185. loc: null,
  25186. value: {
  25187. type: "Value",
  25188. children: dimensionsLeft
  25189. }
  25190. });
  25191. let ruleLeft = ast.children.createItem({
  25192. type: "Atrule",
  25193. prelude: null,
  25194. name: "page :left",
  25195. block: {
  25196. type: "Block",
  25197. loc: null,
  25198. children: childrenLeft
  25199. }
  25200. });
  25201. ast.children.append(ruleLeft);
  25202. }
  25203. if (bleedrecto) {
  25204. let widthCalculationsRight = new lib.List();
  25205. let heightCalculationsRight = new lib.List();
  25206. // width
  25207. widthCalculationsRight.appendData({
  25208. type: "Dimension",
  25209. unit: width.unit,
  25210. value: width.value
  25211. });
  25212. widthCalculationsRight.appendData({
  25213. type: "WhiteSpace",
  25214. value: " "
  25215. });
  25216. widthCalculationsRight.appendData({
  25217. type: "Operator",
  25218. value: "+"
  25219. });
  25220. widthCalculationsRight.appendData({
  25221. type: "WhiteSpace",
  25222. value: " "
  25223. });
  25224. widthCalculationsRight.appendData({
  25225. type: "Dimension",
  25226. unit: bleedrecto.left.unit,
  25227. value: bleedrecto.left.value
  25228. });
  25229. widthCalculationsRight.appendData({
  25230. type: "WhiteSpace",
  25231. value: " "
  25232. });
  25233. widthCalculationsRight.appendData({
  25234. type: "Operator",
  25235. value: "+"
  25236. });
  25237. widthCalculationsRight.appendData({
  25238. type: "WhiteSpace",
  25239. value: " "
  25240. });
  25241. widthCalculationsRight.appendData({
  25242. type: "Dimension",
  25243. unit: bleedrecto.right.unit,
  25244. value: bleedrecto.right.value
  25245. });
  25246. // height
  25247. heightCalculationsRight.appendData({
  25248. type: "Dimension",
  25249. unit: height.unit,
  25250. value: height.value
  25251. });
  25252. heightCalculationsRight.appendData({
  25253. type: "WhiteSpace",
  25254. value: " "
  25255. });
  25256. heightCalculationsRight.appendData({
  25257. type: "Operator",
  25258. value: "+"
  25259. });
  25260. heightCalculationsRight.appendData({
  25261. type: "WhiteSpace",
  25262. value: " "
  25263. });
  25264. heightCalculationsRight.appendData({
  25265. type: "Dimension",
  25266. unit: bleedrecto.top.unit,
  25267. value: bleedrecto.top.value
  25268. });
  25269. heightCalculationsRight.appendData({
  25270. type: "WhiteSpace",
  25271. value: " "
  25272. });
  25273. heightCalculationsRight.appendData({
  25274. type: "Operator",
  25275. value: "+"
  25276. });
  25277. heightCalculationsRight.appendData({
  25278. type: "WhiteSpace",
  25279. value: " "
  25280. });
  25281. heightCalculationsRight.appendData({
  25282. type: "Dimension",
  25283. unit: bleedrecto.bottom.unit,
  25284. value: bleedrecto.bottom.value
  25285. });
  25286. dimensionsRight.appendData({
  25287. type: "Function",
  25288. name: "calc",
  25289. children: widthCalculationsRight
  25290. });
  25291. dimensionsRight.appendData({
  25292. type: "WhiteSpace",
  25293. value: " "
  25294. });
  25295. dimensionsRight.appendData({
  25296. type: "Function",
  25297. name: "calc",
  25298. children: heightCalculationsRight
  25299. });
  25300. childrenRight.appendData({
  25301. type: "Declaration",
  25302. property: "size",
  25303. loc: null,
  25304. value: {
  25305. type: "Value",
  25306. children: dimensionsRight
  25307. }
  25308. });
  25309. let ruleRight = ast.children.createItem({
  25310. type: "Atrule",
  25311. prelude: null,
  25312. name: "page :right",
  25313. block: {
  25314. type: "Block",
  25315. loc: null,
  25316. children: childrenRight
  25317. }
  25318. });
  25319. ast.children.append(ruleRight);
  25320. }
  25321. }
  25322. getNth(nth) {
  25323. let n = nth.indexOf("n");
  25324. let plus = nth.indexOf("+");
  25325. let splitN = nth.split("n");
  25326. let splitP = nth.split("+");
  25327. let a = null;
  25328. let b = null;
  25329. if (n > -1) {
  25330. a = splitN[0];
  25331. if (plus > -1) {
  25332. b = splitP[1];
  25333. }
  25334. } else {
  25335. b = nth;
  25336. }
  25337. return {
  25338. type: "Nth",
  25339. loc: null,
  25340. selector: null,
  25341. nth: {
  25342. type: "AnPlusB",
  25343. loc: null,
  25344. a: a,
  25345. b: b
  25346. }
  25347. };
  25348. }
  25349. addPageAttributes(page, start, pages) {
  25350. let named = start.dataset.page;
  25351. if (named) {
  25352. page.name = named;
  25353. page.element.classList.add("pagedjs_named_page");
  25354. page.element.classList.add("pagedjs_" + named + "_page");
  25355. if (!start.dataset.splitFrom) {
  25356. page.element.classList.add("pagedjs_" + named + "_first_page");
  25357. }
  25358. }
  25359. }
  25360. getStartElement(content, breakToken) {
  25361. let node = breakToken && breakToken.node;
  25362. if (!content && !breakToken) {
  25363. return;
  25364. }
  25365. // No break
  25366. if (!node) {
  25367. return content.children[0];
  25368. }
  25369. // Top level element
  25370. if (node.nodeType === 1 && node.parentNode.nodeType === 11) {
  25371. return node;
  25372. }
  25373. // Named page
  25374. if (node.nodeType === 1 && node.dataset.page) {
  25375. return node;
  25376. }
  25377. // Get top level Named parent
  25378. let fragment = rebuildAncestors(node);
  25379. let pages = fragment.querySelectorAll("[data-page]");
  25380. if (pages.length) {
  25381. return pages[pages.length - 1];
  25382. } else {
  25383. return fragment.children[0];
  25384. }
  25385. }
  25386. beforePageLayout(page, contents, breakToken, chunker) {
  25387. let start = this.getStartElement(contents, breakToken);
  25388. if (start) {
  25389. this.addPageAttributes(page, start, chunker.pages);
  25390. }
  25391. // page.element.querySelector('.paged_area').style.color = red;
  25392. }
  25393. afterPageLayout(fragment, page, breakToken, chunker) {
  25394. for (let m in this.marginalia) {
  25395. let margin = this.marginalia[m];
  25396. let sels = m.split(" ");
  25397. let content;
  25398. if (page.element.matches(sels[0]) && margin.hasContent) {
  25399. content = page.element.querySelector(sels[1]);
  25400. content.classList.add("hasContent");
  25401. }
  25402. }
  25403. // check center
  25404. ["top", "bottom"].forEach((loc) => {
  25405. let marginGroup = page.element.querySelector(".pagedjs_margin-" + loc);
  25406. let center = page.element.querySelector(".pagedjs_margin-" + loc + "-center");
  25407. let left = page.element.querySelector(".pagedjs_margin-" + loc + "-left");
  25408. let right = page.element.querySelector(".pagedjs_margin-" + loc + "-right");
  25409. let centerContent = center.classList.contains("hasContent");
  25410. let leftContent = left.classList.contains("hasContent");
  25411. let rightContent = right.classList.contains("hasContent");
  25412. let centerWidth, leftWidth, rightWidth;
  25413. if (leftContent) {
  25414. leftWidth = window.getComputedStyle(left)["max-width"];
  25415. }
  25416. if (rightContent) {
  25417. rightWidth = window.getComputedStyle(right)["max-width"];
  25418. }
  25419. if (centerContent) {
  25420. centerWidth = window.getComputedStyle(center)["max-width"];
  25421. if (centerWidth === "none" || centerWidth === "auto") {
  25422. if (!leftContent && !rightContent) {
  25423. marginGroup.style["grid-template-columns"] = "0 1fr 0";
  25424. } else if (leftContent) {
  25425. if (!rightContent) {
  25426. if (leftWidth !== "none" && leftWidth !== "auto") {
  25427. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + leftWidth;
  25428. } else {
  25429. marginGroup.style["grid-template-columns"] = "auto auto 1fr";
  25430. left.style["white-space"] = "nowrap";
  25431. center.style["white-space"] = "nowrap";
  25432. let leftOuterWidth = left.offsetWidth;
  25433. let centerOuterWidth = center.offsetWidth;
  25434. let outerwidths = leftOuterWidth + centerOuterWidth;
  25435. let newcenterWidth = centerOuterWidth * 100 / outerwidths;
  25436. marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
  25437. left.style["white-space"] = "normal";
  25438. center.style["white-space"] = "normal";
  25439. }
  25440. } else {
  25441. if (leftWidth !== "none" && leftWidth !== "auto") {
  25442. if (rightWidth !== "none" && rightWidth !== "auto") {
  25443. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + rightWidth;
  25444. } else {
  25445. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + leftWidth;
  25446. }
  25447. } else {
  25448. if (rightWidth !== "none" && rightWidth !== "auto") {
  25449. marginGroup.style["grid-template-columns"] = rightWidth + " 1fr " + rightWidth;
  25450. } else {
  25451. marginGroup.style["grid-template-columns"] = "auto auto 1fr";
  25452. left.style["white-space"] = "nowrap";
  25453. center.style["white-space"] = "nowrap";
  25454. right.style["white-space"] = "nowrap";
  25455. let leftOuterWidth = left.offsetWidth;
  25456. let centerOuterWidth = center.offsetWidth;
  25457. let rightOuterWidth = right.offsetWidth;
  25458. let outerwidths = leftOuterWidth + centerOuterWidth + rightOuterWidth;
  25459. let newcenterWidth = centerOuterWidth * 100 / outerwidths;
  25460. if (newcenterWidth > 40) {
  25461. marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
  25462. } else {
  25463. marginGroup.style["grid-template-columns"] = "repeat(3, 1fr)";
  25464. }
  25465. left.style["white-space"] = "normal";
  25466. center.style["white-space"] = "normal";
  25467. right.style["white-space"] = "normal";
  25468. }
  25469. }
  25470. }
  25471. } else {
  25472. if (rightWidth !== "none" && rightWidth !== "auto") {
  25473. marginGroup.style["grid-template-columns"] = rightWidth + " 1fr " + rightWidth;
  25474. } else {
  25475. marginGroup.style["grid-template-columns"] = "auto auto 1fr";
  25476. right.style["white-space"] = "nowrap";
  25477. center.style["white-space"] = "nowrap";
  25478. let rightOuterWidth = right.offsetWidth;
  25479. let centerOuterWidth = center.offsetWidth;
  25480. let outerwidths = rightOuterWidth + centerOuterWidth;
  25481. let newcenterWidth = centerOuterWidth * 100 / outerwidths;
  25482. marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
  25483. right.style["white-space"] = "normal";
  25484. center.style["white-space"] = "normal";
  25485. }
  25486. }
  25487. } else if (centerWidth !== "none" && centerWidth !== "auto") {
  25488. if (leftContent && leftWidth !== "none" && leftWidth !== "auto") {
  25489. marginGroup.style["grid-template-columns"] = leftWidth + " " + centerWidth + " 1fr";
  25490. } else if (rightContent && rightWidth !== "none" && rightWidth !== "auto") {
  25491. marginGroup.style["grid-template-columns"] = "1fr " + centerWidth + " " + rightWidth;
  25492. } else {
  25493. marginGroup.style["grid-template-columns"] = "1fr " + centerWidth + " 1fr";
  25494. }
  25495. }
  25496. } else {
  25497. if (leftContent) {
  25498. if (!rightContent) {
  25499. marginGroup.style["grid-template-columns"] = "1fr 0 0";
  25500. } else {
  25501. if (leftWidth !== "none" && leftWidth !== "auto") {
  25502. if (rightWidth !== "none" && rightWidth !== "auto") {
  25503. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + rightWidth;
  25504. } else {
  25505. marginGroup.style["grid-template-columns"] = leftWidth + " 0 1fr";
  25506. }
  25507. } else {
  25508. if (rightWidth !== "none" && rightWidth !== "auto") {
  25509. marginGroup.style["grid-template-columns"] = "1fr 0 " + rightWidth;
  25510. } else {
  25511. marginGroup.style["grid-template-columns"] = "auto 1fr auto";
  25512. left.style["white-space"] = "nowrap";
  25513. right.style["white-space"] = "nowrap";
  25514. let leftOuterWidth = left.offsetWidth;
  25515. let rightOuterWidth = right.offsetWidth;
  25516. let outerwidths = leftOuterWidth + rightOuterWidth;
  25517. let newLeftWidth = leftOuterWidth * 100 / outerwidths;
  25518. marginGroup.style["grid-template-columns"] = "minmax(16.66%, " + newLeftWidth + "%) 0 1fr";
  25519. left.style["white-space"] = "normal";
  25520. right.style["white-space"] = "normal";
  25521. }
  25522. }
  25523. }
  25524. } else {
  25525. if (rightWidth !== "none" && rightWidth !== "auto") {
  25526. marginGroup.style["grid-template-columns"] = "1fr 0 " + rightWidth;
  25527. } else {
  25528. marginGroup.style["grid-template-columns"] = "0 0 1fr";
  25529. }
  25530. }
  25531. }
  25532. });
  25533. // check middle
  25534. ["left", "right"].forEach((loc) => {
  25535. let middle = page.element.querySelector(".pagedjs_margin-" + loc + "-middle.hasContent");
  25536. let marginGroup = page.element.querySelector(".pagedjs_margin-" + loc);
  25537. let top = page.element.querySelector(".pagedjs_margin-" + loc + "-top");
  25538. let bottom = page.element.querySelector(".pagedjs_margin-" + loc + "-bottom");
  25539. let topContent = top.classList.contains("hasContent");
  25540. let bottomContent = bottom.classList.contains("hasContent");
  25541. let middleHeight, topHeight, bottomHeight;
  25542. if (topContent) {
  25543. topHeight = window.getComputedStyle(top)["max-height"];
  25544. }
  25545. if (bottomContent) {
  25546. bottomHeight = window.getComputedStyle(bottom)["max-height"];
  25547. }
  25548. if (middle) {
  25549. middleHeight = window.getComputedStyle(middle)["max-height"];
  25550. if (middleHeight === "none" || middleHeight === "auto") {
  25551. if (!topContent && !bottomContent) {
  25552. marginGroup.style["grid-template-rows"] = "0 1fr 0";
  25553. } else if (topContent) {
  25554. if (!bottomContent) {
  25555. if (topHeight !== "none" && topHeight !== "auto") {
  25556. marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + "*2) " + topHeight;
  25557. }
  25558. } else {
  25559. if (topHeight !== "none" && topHeight !== "auto") {
  25560. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  25561. marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + " - " + bottomHeight + ") " + bottomHeight;
  25562. } else {
  25563. marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + "*2) " + topHeight;
  25564. }
  25565. } else {
  25566. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  25567. marginGroup.style["grid-template-rows"] = bottomHeight + " calc(100% - " + bottomHeight + "*2) " + bottomHeight;
  25568. }
  25569. }
  25570. }
  25571. } else {
  25572. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  25573. marginGroup.style["grid-template-rows"] = bottomHeight + " calc(100% - " + bottomHeight + "*2) " + bottomHeight;
  25574. }
  25575. }
  25576. } else {
  25577. if (topContent && topHeight !== "none" && topHeight !== "auto") {
  25578. marginGroup.style["grid-template-rows"] = topHeight + " " + middleHeight + " calc(100% - (" + topHeight + " + " + middleHeight + "))";
  25579. } else if (bottomContent && bottomHeight !== "none" && bottomHeight !== "auto") {
  25580. marginGroup.style["grid-template-rows"] = "1fr " + middleHeight + " " + bottomHeight;
  25581. } else {
  25582. marginGroup.style["grid-template-rows"] = "calc((100% - " + middleHeight + ")/2) " + middleHeight + " calc((100% - " + middleHeight + ")/2)";
  25583. }
  25584. }
  25585. } else {
  25586. if (topContent) {
  25587. if (!bottomContent) {
  25588. marginGroup.style["grid-template-rows"] = "1fr 0 0";
  25589. } else {
  25590. if (topHeight !== "none" && topHeight !== "auto") {
  25591. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  25592. marginGroup.style["grid-template-rows"] = topHeight + " 1fr " + bottomHeight;
  25593. } else {
  25594. marginGroup.style["grid-template-rows"] = topHeight + " 0 1fr";
  25595. }
  25596. } else {
  25597. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  25598. marginGroup.style["grid-template-rows"] = "1fr 0 " + bottomHeight;
  25599. } else {
  25600. marginGroup.style["grid-template-rows"] = "1fr 0 1fr";
  25601. }
  25602. }
  25603. }
  25604. } else {
  25605. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  25606. marginGroup.style["grid-template-rows"] = "1fr 0 " + bottomHeight;
  25607. } else {
  25608. marginGroup.style["grid-template-rows"] = "0 0 1fr";
  25609. }
  25610. }
  25611. }
  25612. });
  25613. }
  25614. // CSS Tree Helpers
  25615. selectorsForPage(page) {
  25616. let nthlist;
  25617. let nth;
  25618. let selectors = new lib.List();
  25619. selectors.insertData({
  25620. type: "ClassSelector",
  25621. name: "pagedjs_page"
  25622. });
  25623. // Named page
  25624. if (page.name) {
  25625. selectors.insertData({
  25626. type: "ClassSelector",
  25627. name: "pagedjs_named_page"
  25628. });
  25629. selectors.insertData({
  25630. type: "ClassSelector",
  25631. name: "pagedjs_" + page.name + "_page"
  25632. });
  25633. }
  25634. // PsuedoSelector
  25635. if (page.psuedo && !(page.name && page.psuedo === "first")) {
  25636. selectors.insertData({
  25637. type: "ClassSelector",
  25638. name: "pagedjs_" + page.psuedo + "_page"
  25639. });
  25640. }
  25641. if (page.name && page.psuedo === "first") {
  25642. selectors.insertData({
  25643. type: "ClassSelector",
  25644. name: "pagedjs_" + page.name + "_" + page.psuedo + "_page"
  25645. });
  25646. }
  25647. // Nth
  25648. if (page.nth) {
  25649. nthlist = new lib.List();
  25650. nth = this.getNth(page.nth);
  25651. nthlist.insertData(nth);
  25652. selectors.insertData({
  25653. type: "PseudoClassSelector",
  25654. name: "nth-of-type",
  25655. children: nthlist
  25656. });
  25657. }
  25658. return selectors;
  25659. }
  25660. selectorsForPageMargin(page, margin) {
  25661. let selectors = this.selectorsForPage(page);
  25662. selectors.insertData({
  25663. type: "Combinator",
  25664. name: " "
  25665. });
  25666. selectors.insertData({
  25667. type: "ClassSelector",
  25668. name: "pagedjs_margin-" + margin
  25669. });
  25670. return selectors;
  25671. }
  25672. createDeclaration(property, value, important) {
  25673. let children = new lib.List();
  25674. children.insertData({
  25675. type: "Identifier",
  25676. loc: null,
  25677. name: value
  25678. });
  25679. return {
  25680. type: "Declaration",
  25681. loc: null,
  25682. important: important,
  25683. property: property,
  25684. value: {
  25685. type: "Value",
  25686. loc: null,
  25687. children: children
  25688. }
  25689. };
  25690. }
  25691. createVariable(property, value) {
  25692. return {
  25693. type: "Declaration",
  25694. loc: null,
  25695. property: property,
  25696. value: {
  25697. type: "Raw",
  25698. value: value
  25699. }
  25700. };
  25701. }
  25702. createCalculatedDimension(property, items, important, operator = "+") {
  25703. let children = new lib.List();
  25704. let calculations = new lib.List();
  25705. items.forEach((item, index) => {
  25706. calculations.appendData({
  25707. type: "Dimension",
  25708. unit: item.unit,
  25709. value: item.value
  25710. });
  25711. calculations.appendData({
  25712. type: "WhiteSpace",
  25713. value: " "
  25714. });
  25715. if (index + 1 < items.length) {
  25716. calculations.appendData({
  25717. type: "Operator",
  25718. value: operator
  25719. });
  25720. calculations.appendData({
  25721. type: "WhiteSpace",
  25722. value: " "
  25723. });
  25724. }
  25725. });
  25726. children.insertData({
  25727. type: "Function",
  25728. loc: null,
  25729. name: "calc",
  25730. children: calculations
  25731. });
  25732. return {
  25733. type: "Declaration",
  25734. loc: null,
  25735. important: important,
  25736. property: property,
  25737. value: {
  25738. type: "Value",
  25739. loc: null,
  25740. children: children
  25741. }
  25742. };
  25743. }
  25744. createDimension(property, cssValue, important) {
  25745. let children = new lib.List();
  25746. children.insertData({
  25747. type: "Dimension",
  25748. loc: null,
  25749. value: cssValue.value,
  25750. unit: cssValue.unit
  25751. });
  25752. return {
  25753. type: "Declaration",
  25754. loc: null,
  25755. important: important,
  25756. property: property,
  25757. value: {
  25758. type: "Value",
  25759. loc: null,
  25760. children: children
  25761. }
  25762. };
  25763. }
  25764. createBlock(declarations) {
  25765. let block = new lib.List();
  25766. declarations.forEach((declaration) => {
  25767. block.insertData(declaration);
  25768. });
  25769. return {
  25770. type: "Block",
  25771. loc: null,
  25772. children: block
  25773. };
  25774. }
  25775. createRule(selectors, block) {
  25776. let selectorList = new lib.List();
  25777. selectorList.insertData({
  25778. type: "Selector",
  25779. children: selectors
  25780. });
  25781. if (Array.isArray(block)) {
  25782. block = this.createBlock(block);
  25783. }
  25784. return {
  25785. type: "Rule",
  25786. prelude: {
  25787. type: "SelectorList",
  25788. children: selectorList
  25789. },
  25790. block: block
  25791. };
  25792. }
  25793. }
  25794. class Breaks extends Handler {
  25795. constructor(chunker, polisher, caller) {
  25796. super(chunker, polisher, caller);
  25797. this.breaks = {};
  25798. }
  25799. onDeclaration(declaration, dItem, dList, rule) {
  25800. let property = declaration.property;
  25801. if (property === "page") {
  25802. let children = declaration.value.children.first();
  25803. let value = children.name;
  25804. let selector = lib.generate(rule.ruleNode.prelude);
  25805. let name = value;
  25806. let breaker = {
  25807. property: property,
  25808. value: value,
  25809. selector: selector,
  25810. name: name
  25811. };
  25812. selector.split(",").forEach((s) => {
  25813. if (!this.breaks[s]) {
  25814. this.breaks[s] = [breaker];
  25815. } else {
  25816. this.breaks[s].push(breaker);
  25817. }
  25818. });
  25819. dList.remove(dItem);
  25820. }
  25821. if (property === "break-before" ||
  25822. property === "break-after" ||
  25823. property === "page-break-before" ||
  25824. property === "page-break-after"
  25825. ) {
  25826. let child = declaration.value.children.first();
  25827. let value = child.name;
  25828. let selector = lib.generate(rule.ruleNode.prelude);
  25829. if (property === "page-break-before") {
  25830. property = "break-before";
  25831. } else if (property === "page-break-after") {
  25832. property = "break-after";
  25833. }
  25834. let breaker = {
  25835. property: property,
  25836. value: value,
  25837. selector: selector
  25838. };
  25839. selector.split(",").forEach((s) => {
  25840. if (!this.breaks[s]) {
  25841. this.breaks[s] = [breaker];
  25842. } else {
  25843. this.breaks[s].push(breaker);
  25844. }
  25845. });
  25846. // Remove from CSS -- handle right / left in module
  25847. dList.remove(dItem);
  25848. }
  25849. }
  25850. afterParsed(parsed) {
  25851. this.processBreaks(parsed, this.breaks);
  25852. }
  25853. processBreaks(parsed, breaks) {
  25854. for (let b in breaks) {
  25855. // Find elements
  25856. let elements = parsed.querySelectorAll(b);
  25857. // Add break data
  25858. for (var i = 0; i < elements.length; i++) {
  25859. for (let prop of breaks[b]) {
  25860. if (prop.property === "break-after") {
  25861. let nodeAfter = displayedElementAfter(elements[i], parsed);
  25862. elements[i].setAttribute("data-break-after", prop.value);
  25863. if (nodeAfter) {
  25864. nodeAfter.setAttribute("data-previous-break-after", prop.value);
  25865. }
  25866. } else if (prop.property === "break-before") {
  25867. let nodeBefore = displayedElementBefore(elements[i], parsed);
  25868. // Breaks are only allowed between siblings, not between a box and its container.
  25869. // If we cannot find a node before we should not break!
  25870. // https://drafts.csswg.org/css-break-3/#break-propagation
  25871. if (nodeBefore) {
  25872. if (prop.value === "page" && needsPageBreak(elements[i], nodeBefore)) {
  25873. // we ignore this explicit page break because an implicit page break is already needed
  25874. continue;
  25875. }
  25876. elements[i].setAttribute("data-break-before", prop.value);
  25877. nodeBefore.setAttribute("data-next-break-before", prop.value);
  25878. }
  25879. } else if (prop.property === "page") {
  25880. elements[i].setAttribute("data-page", prop.value);
  25881. let nodeAfter = displayedElementAfter(elements[i], parsed);
  25882. if (nodeAfter) {
  25883. nodeAfter.setAttribute("data-after-page", prop.value);
  25884. }
  25885. } else {
  25886. elements[i].setAttribute("data-" + prop.property, prop.value);
  25887. }
  25888. }
  25889. }
  25890. }
  25891. }
  25892. mergeBreaks(pageBreaks, newBreaks) {
  25893. for (let b in newBreaks) {
  25894. if (b in pageBreaks) {
  25895. pageBreaks[b] = pageBreaks[b].concat(newBreaks[b]);
  25896. } else {
  25897. pageBreaks[b] = newBreaks[b];
  25898. }
  25899. }
  25900. return pageBreaks;
  25901. }
  25902. addBreakAttributes(pageElement, page) {
  25903. let before = pageElement.querySelector("[data-break-before]");
  25904. let after = pageElement.querySelector("[data-break-after]");
  25905. let previousBreakAfter = pageElement.querySelector("[data-previous-break-after]");
  25906. if (before) {
  25907. if (before.dataset.splitFrom) {
  25908. page.splitFrom = before.dataset.splitFrom;
  25909. pageElement.setAttribute("data-split-from", before.dataset.splitFrom);
  25910. } else if (before.dataset.breakBefore && before.dataset.breakBefore !== "avoid") {
  25911. page.breakBefore = before.dataset.breakBefore;
  25912. pageElement.setAttribute("data-break-before", before.dataset.breakBefore);
  25913. }
  25914. }
  25915. if (after && after.dataset) {
  25916. if (after.dataset.splitTo) {
  25917. page.splitTo = after.dataset.splitTo;
  25918. pageElement.setAttribute("data-split-to", after.dataset.splitTo);
  25919. } else if (after.dataset.breakAfter && after.dataset.breakAfter !== "avoid") {
  25920. page.breakAfter = after.dataset.breakAfter;
  25921. pageElement.setAttribute("data-break-after", after.dataset.breakAfter);
  25922. }
  25923. }
  25924. if (previousBreakAfter && previousBreakAfter.dataset) {
  25925. if (previousBreakAfter.dataset.previousBreakAfter && previousBreakAfter.dataset.previousBreakAfter !== "avoid") {
  25926. page.previousBreakAfter = previousBreakAfter.dataset.previousBreakAfter;
  25927. }
  25928. }
  25929. }
  25930. afterPageLayout(pageElement, page) {
  25931. this.addBreakAttributes(pageElement, page);
  25932. }
  25933. }
  25934. class PrintMedia extends Handler {
  25935. constructor(chunker, polisher, caller) {
  25936. super(chunker, polisher, caller);
  25937. }
  25938. onAtMedia(node, item, list) {
  25939. let media = this.getMediaName(node);
  25940. let rules;
  25941. if (media === "print") {
  25942. rules = node.block.children;
  25943. // Remove rules from the @media block
  25944. node.block.children = new lib.List();
  25945. // Append rules to the end of main rules list
  25946. list.appendList(rules);
  25947. }
  25948. }
  25949. getMediaName(node) {
  25950. let media = "";
  25951. if (typeof node.prelude === "undefined" ||
  25952. node.prelude.type !== "AtrulePrelude" ) {
  25953. return;
  25954. }
  25955. lib.walk(node.prelude, {
  25956. visit: "Identifier",
  25957. enter: (identNode, iItem, iList) => {
  25958. media = identNode.name;
  25959. }
  25960. });
  25961. return media;
  25962. }
  25963. }
  25964. class Splits extends Handler {
  25965. constructor(chunker, polisher, caller) {
  25966. super(chunker, polisher, caller);
  25967. }
  25968. afterPageLayout(pageElement, page, breakToken, chunker) {
  25969. let splits = Array.from(pageElement.querySelectorAll("[data-split-from]"));
  25970. let pages = pageElement.parentNode;
  25971. let index = Array.prototype.indexOf.call(pages.children, pageElement);
  25972. let prevPage;
  25973. if (index === 0) {
  25974. return;
  25975. }
  25976. prevPage = pages.children[index - 1];
  25977. let from; // Capture the last from element
  25978. splits.forEach((split) => {
  25979. let ref = split.dataset.ref;
  25980. from = prevPage.querySelector("[data-ref='"+ ref +"']:not([data-split-to])");
  25981. if (from) {
  25982. from.dataset.splitTo = ref;
  25983. if (!from.dataset.splitFrom) {
  25984. from.dataset.splitOriginal = true;
  25985. }
  25986. }
  25987. });
  25988. // Fix alignment on the deepest split element
  25989. if (from) {
  25990. this.handleAlignment(from);
  25991. }
  25992. }
  25993. handleAlignment(node) {
  25994. let styles = window.getComputedStyle(node);
  25995. let align = styles["text-align"];
  25996. let alignLast = styles["text-align-last"];
  25997. node.dataset.lastSplitElement = "true";
  25998. if (align === "justify" && alignLast === "auto") {
  25999. node.dataset.alignLastSplitElement = "justify";
  26000. } else {
  26001. node.dataset.alignLastSplitElement = alignLast;
  26002. }
  26003. }
  26004. }
  26005. class Counters extends Handler {
  26006. constructor(chunker, polisher, caller) {
  26007. super(chunker, polisher, caller);
  26008. this.styleSheet = polisher.styleSheet;
  26009. this.counters = {};
  26010. this.resetCountersMap = new Map();
  26011. }
  26012. onDeclaration(declaration, dItem, dList, rule) {
  26013. let property = declaration.property;
  26014. if (property === "counter-increment") {
  26015. let inc = this.handleIncrement(declaration, rule);
  26016. if (inc) {
  26017. dList.remove(dItem);
  26018. }
  26019. } else if (property === "counter-reset") {
  26020. let reset = this.handleReset(declaration, rule);
  26021. if (reset) {
  26022. dList.remove(dItem);
  26023. }
  26024. }
  26025. }
  26026. onContent(funcNode, fItem, fList, declaration, rule) {
  26027. if (funcNode.name === "counter") ;
  26028. }
  26029. afterParsed(parsed) {
  26030. this.processCounters(parsed, this.counters);
  26031. this.scopeCounters(this.counters);
  26032. }
  26033. addCounter(name) {
  26034. if (name in this.counters) {
  26035. return this.counters[name];
  26036. }
  26037. this.counters[name] = {
  26038. name: name,
  26039. increments: {},
  26040. resets: {}
  26041. };
  26042. return this.counters[name];
  26043. }
  26044. handleIncrement(declaration, rule) {
  26045. const identifier = declaration.value.children.first();
  26046. const number = declaration.value.children.getSize() > 1 ? declaration.value.children.last().value : 1;
  26047. const name = identifier && identifier.name;
  26048. if (name === "page" || name.indexOf("target-counter-") === 0) {
  26049. return;
  26050. }
  26051. let selector = lib.generate(rule.ruleNode.prelude);
  26052. let counter;
  26053. if (!(name in this.counters)) {
  26054. counter = this.addCounter(name);
  26055. } else {
  26056. counter = this.counters[name];
  26057. }
  26058. return counter.increments[selector] = {
  26059. selector: selector,
  26060. number
  26061. };
  26062. }
  26063. handleReset(declaration, rule) {
  26064. let identifier = declaration.value.children.first();
  26065. let number = declaration.value.children.getSize() > 1
  26066. && declaration.value.children.last().value;
  26067. let name = identifier && identifier.name;
  26068. let selector = lib.generate(rule.ruleNode.prelude);
  26069. let counter;
  26070. if (!(name in this.counters)) {
  26071. counter = this.addCounter(name);
  26072. } else {
  26073. counter = this.counters[name];
  26074. }
  26075. return counter.resets[selector] = {
  26076. selector: selector,
  26077. number: number || 0
  26078. };
  26079. }
  26080. processCounters(parsed, counters) {
  26081. let counter;
  26082. for (let c in counters) {
  26083. counter = this.counters[c];
  26084. this.processCounterIncrements(parsed, counter);
  26085. this.processCounterResets(parsed, counter);
  26086. if (c !== "page") {
  26087. this.addCounterValues(parsed, counter);
  26088. }
  26089. }
  26090. }
  26091. scopeCounters(counters) {
  26092. let countersArray = [];
  26093. for (let c in counters) {
  26094. if(c !== "page") {
  26095. countersArray.push(`${counters[c].name} 0`);
  26096. }
  26097. }
  26098. // Add to pages to allow cross page scope
  26099. this.insertRule(`.pagedjs_pages { counter-reset: ${countersArray.join(" ")} page 0 pages var(--pagedjs-page-count)}`);
  26100. }
  26101. insertRule(rule) {
  26102. this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
  26103. }
  26104. processCounterIncrements(parsed, counter) {
  26105. let increment;
  26106. for (let inc in counter.increments) {
  26107. increment = counter.increments[inc];
  26108. // Find elements for increments
  26109. let incrementElements = parsed.querySelectorAll(increment.selector);
  26110. // Add counter data
  26111. for (let i = 0; i < incrementElements.length; i++) {
  26112. incrementElements[i].setAttribute("data-counter-"+ counter.name +"-increment", increment.number);
  26113. incrementElements[i].setAttribute("data-counter-increment", counter.name);
  26114. }
  26115. }
  26116. }
  26117. processCounterResets(parsed, counter) {
  26118. let reset;
  26119. for (let r in counter.resets) {
  26120. reset = counter.resets[r];
  26121. // Find elements for resets
  26122. let resetElements = parsed.querySelectorAll(reset.selector);
  26123. // Add counter data
  26124. for (var i = 0; i < resetElements.length; i++) {
  26125. resetElements[i].setAttribute("data-counter-"+ counter.name +"-reset", reset.number);
  26126. resetElements[i].setAttribute("data-counter-reset", counter.name);
  26127. }
  26128. }
  26129. }
  26130. addCounterValues(parsed, counter) {
  26131. const counterName = counter.name;
  26132. const elements = parsed.querySelectorAll("[data-counter-"+ counterName +"-reset], [data-counter-"+ counterName +"-increment]");
  26133. let count = 0;
  26134. let element;
  26135. let increment, reset;
  26136. let resetValue, incrementValue, resetDelta;
  26137. let incrementArray;
  26138. for (let i = 0; i < elements.length; i++) {
  26139. element = elements[i];
  26140. resetDelta = 0;
  26141. incrementArray = [];
  26142. if (element.hasAttribute("data-counter-"+ counterName +"-reset")) {
  26143. reset = element.getAttribute("data-counter-"+ counterName +"-reset");
  26144. resetValue = parseInt(reset);
  26145. // Use negative increment value inplace of reset
  26146. resetDelta = resetValue - count;
  26147. incrementArray.push(`${counterName} ${resetDelta}`);
  26148. count = resetValue;
  26149. }
  26150. if (element.hasAttribute("data-counter-"+ counterName +"-increment")) {
  26151. increment = element.getAttribute("data-counter-"+ counterName +"-increment");
  26152. incrementValue = parseInt(increment);
  26153. count += incrementValue;
  26154. element.setAttribute("data-counter-"+counterName+"-value", count);
  26155. incrementArray.push(`${counterName} ${incrementValue}`);
  26156. }
  26157. if (incrementArray.length > 0) {
  26158. this.incrementCounterForElement(element, incrementArray);
  26159. }
  26160. }
  26161. }
  26162. incrementCounterForElement(element, incrementArray) {
  26163. if (!element || !incrementArray || incrementArray.length === 0) return;
  26164. const ref = element.dataset.ref;
  26165. const prevIncrements = Array.from(this.styleSheet.cssRules).filter((rule) => {
  26166. return rule.selectorText === `[data-ref="${element.dataset.ref}"]:not([data-split-from])`
  26167. && rule.style[0] === "counter-increment";
  26168. });
  26169. const increments = [];
  26170. for (let styleRule of prevIncrements) {
  26171. let values = styleRule.style.counterIncrement.split(" ");
  26172. for (let i = 0; i < values.length; i+=2) {
  26173. increments.push(values[i] + " " + values[i+1]);
  26174. }
  26175. }
  26176. Array.prototype.push.apply(increments, incrementArray);
  26177. this.insertRule(`[data-ref="${ref}"]:not([data-split-from]) { counter-increment: ${increments.join(" ")} }`);
  26178. }
  26179. afterPageLayout(pageElement, page) {
  26180. let pgreset = pageElement.querySelectorAll("[data-counter-page-reset]");
  26181. pgreset.forEach((reset) => {
  26182. const ref = reset.dataset && reset.dataset.ref;
  26183. if (ref && this.resetCountersMap.has(ref)) ; else {
  26184. if (ref) {
  26185. this.resetCountersMap.set(ref, "");
  26186. }
  26187. let value = reset.dataset.counterPageReset;
  26188. this.styleSheet.insertRule(`[data-page-number="${pageElement.dataset.pageNumber}"] { counter-increment: none; counter-reset: page ${value}; }`, this.styleSheet.cssRules.length);
  26189. }
  26190. });
  26191. }
  26192. }
  26193. class Lists extends Handler {
  26194. constructor(chunker, polisher, caller) {
  26195. super(chunker, polisher, caller);
  26196. }
  26197. afterParsed(content) {
  26198. const orderedLists = content.querySelectorAll("ol");
  26199. for (var list of orderedLists) {
  26200. this.addDataNumbers(list);
  26201. }
  26202. }
  26203. afterPageLayout(pageElement, page, breakToken, chunker) {
  26204. var orderedLists = pageElement.getElementsByTagName("ol");
  26205. for (var list of orderedLists) {
  26206. if (list.hasChildNodes()) {
  26207. list.start = list.firstElementChild.dataset.itemNum;
  26208. }
  26209. else {
  26210. list.parentNode.removeChild(list);
  26211. }
  26212. }
  26213. }
  26214. addDataNumbers(list) {
  26215. let start = 1;
  26216. if (list.hasAttribute("start")) {
  26217. start = parseInt(list.getAttribute("start"), 10);
  26218. if (isNaN(start)) {
  26219. start = 1;
  26220. }
  26221. }
  26222. let items = list.children;
  26223. for (var i = 0; i < items.length; i++) {
  26224. items[i].setAttribute("data-item-num", i + start);
  26225. }
  26226. }
  26227. }
  26228. class PositionFixed extends Handler {
  26229. constructor(chunker, polisher, caller) {
  26230. super(chunker, polisher, caller);
  26231. this.styleSheet = polisher.styleSheet;
  26232. this.fixedElementsSelector = [];
  26233. this.fixedElements = [];
  26234. }
  26235. onDeclaration(declaration, dItem, dList, rule) {
  26236. if (declaration.property === "position" && declaration.value.children.first().name === "fixed") {
  26237. let selector = lib.generate(rule.ruleNode.prelude);
  26238. this.fixedElementsSelector.push(selector);
  26239. dList.remove(dItem);
  26240. }
  26241. }
  26242. afterParsed(fragment) {
  26243. this.fixedElementsSelector.forEach(fixedEl => {
  26244. fragment.querySelectorAll(`${fixedEl}`).forEach(el => {
  26245. el.style.setProperty("position", "absolute");
  26246. this.fixedElements.push(el);
  26247. el.remove();
  26248. });
  26249. });
  26250. }
  26251. afterPageLayout(pageElement, page, breakToken) {
  26252. this.fixedElements.forEach(el => {
  26253. const clone = el.cloneNode(true);
  26254. pageElement.querySelector(".pagedjs_pagebox").insertAdjacentElement("afterbegin", clone);
  26255. });
  26256. }
  26257. }
  26258. class PageCounterIncrement extends Handler {
  26259. constructor(chunker, polisher, caller) {
  26260. super(chunker, polisher, caller);
  26261. this.styleSheet = polisher.styleSheet;
  26262. this.pageCounter = {
  26263. name: "page",
  26264. increments: {},
  26265. resets: {}
  26266. };
  26267. }
  26268. onDeclaration(declaration, dItem, dList, rule) {
  26269. const property = declaration.property;
  26270. if (property === "counter-increment") {
  26271. let inc = this.handleIncrement(declaration, rule);
  26272. if (inc) {
  26273. dList.remove(dItem);
  26274. }
  26275. }
  26276. }
  26277. afterParsed(_) {
  26278. for (const inc in this.pageCounter.increments) {
  26279. const increment = this.pageCounter.increments[inc];
  26280. this.insertRule(`${increment.selector} { --pagedjs-page-counter-increment: ${increment.number} }`);
  26281. }
  26282. }
  26283. handleIncrement(declaration, rule) {
  26284. const identifier = declaration.value.children.first();
  26285. const number = declaration.value.children.getSize() > 1 ? declaration.value.children.last().value : 1;
  26286. const name = identifier && identifier.name;
  26287. if (name.indexOf("target-counter-") === 0) {
  26288. return;
  26289. }
  26290. // A counter named page is automatically created and incremented by 1 on every page of the document,
  26291. // unless the counter-increment property in the page context explicitly specifies a different increment for the page counter.
  26292. // https://www.w3.org/TR/css-page-3/#page-based-counters
  26293. if (name !== "page") {
  26294. return;
  26295. }
  26296. // the counter-increment property is not defined on the page context (i.e. @page rule), ignoring...
  26297. if (rule.ruleNode.name === "page" && rule.ruleNode.type === "Atrule") {
  26298. return;
  26299. }
  26300. const selector = lib.generate(rule.ruleNode.prelude);
  26301. return this.pageCounter.increments[selector] = {
  26302. selector: selector,
  26303. number
  26304. };
  26305. }
  26306. insertRule(rule) {
  26307. this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
  26308. }
  26309. }
  26310. class NthOfType extends Handler {
  26311. constructor(chunker, polisher, caller) {
  26312. super(chunker, polisher, caller);
  26313. this.styleSheet = polisher.styleSheet;
  26314. this.selectors = {};
  26315. }
  26316. onRule(ruleNode, ruleItem, rulelist) {
  26317. let selector = lib.generate(ruleNode.prelude);
  26318. if (selector.match(/:(first|last|nth)-of-type/)) {
  26319. let declarations = lib.generate(ruleNode.block);
  26320. declarations = declarations.replace(/[{}]/g,"");
  26321. let uuid = "nth-of-type-" + UUID();
  26322. selector.split(",").forEach((s) => {
  26323. if (!this.selectors[s]) {
  26324. this.selectors[s] = [uuid, declarations];
  26325. } else {
  26326. this.selectors[s][1] = `${this.selectors[s][1]};${declarations}` ;
  26327. }
  26328. });
  26329. rulelist.remove(ruleItem);
  26330. }
  26331. }
  26332. afterParsed(parsed) {
  26333. this.processSelectors(parsed, this.selectors);
  26334. }
  26335. processSelectors(parsed, selectors) {
  26336. // add the new attributes to matching elements
  26337. for (let s in selectors) {
  26338. let elements = parsed.querySelectorAll(s);
  26339. for (var i = 0; i < elements.length; i++) {
  26340. let dataNthOfType = elements[i].getAttribute("data-nth-of-type");
  26341. if (dataNthOfType && dataNthOfType != "") {
  26342. dataNthOfType = `${dataNthOfType},${selectors[s][0]}`;
  26343. elements[i].setAttribute("data-nth-of-type", dataNthOfType);
  26344. } else {
  26345. elements[i].setAttribute("data-nth-of-type", selectors[s][0]);
  26346. }
  26347. }
  26348. let rule = `*[data-nth-of-type*='${selectors[s][0]}'] { ${selectors[s][1]}; }`;
  26349. this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
  26350. }
  26351. }
  26352. }
  26353. class Following extends Handler {
  26354. constructor(chunker, polisher, caller) {
  26355. super(chunker, polisher, caller);
  26356. this.styleSheet = polisher.styleSheet;
  26357. this.selectors = {};
  26358. }
  26359. onRule(ruleNode, ruleItem, rulelist) {
  26360. let selector = lib.generate(ruleNode.prelude);
  26361. if (selector.match(/\+/)) {
  26362. let declarations = lib.generate(ruleNode.block);
  26363. declarations = declarations.replace(/[{}]/g,"");
  26364. let uuid = "following-" + UUID();
  26365. selector.split(",").forEach((s) => {
  26366. if (!this.selectors[s]) {
  26367. this.selectors[s] = [uuid, declarations];
  26368. } else {
  26369. this.selectors[s][1] = `${this.selectors[s][1]};${declarations}` ;
  26370. }
  26371. });
  26372. rulelist.remove(ruleItem);
  26373. }
  26374. }
  26375. afterParsed(parsed) {
  26376. this.processSelectors(parsed, this.selectors);
  26377. }
  26378. processSelectors(parsed, selectors) {
  26379. // add the new attributes to matching elements
  26380. for (let s in selectors) {
  26381. let elements = parsed.querySelectorAll(s);
  26382. for (var i = 0; i < elements.length; i++) {
  26383. let dataFollowing = elements[i].getAttribute("data-following");
  26384. if (dataFollowing && dataFollowing != "") {
  26385. dataFollowing = `${dataFollowing},${selectors[s][0]}`;
  26386. elements[i].setAttribute("data-following", dataFollowing);
  26387. } else {
  26388. elements[i].setAttribute("data-following", selectors[s][0]);
  26389. }
  26390. }
  26391. let rule = `*[data-following*='${selectors[s][0]}'] { ${selectors[s][1]}; }`;
  26392. this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
  26393. }
  26394. }
  26395. }
  26396. var pagedMediaHandlers = [
  26397. AtPage,
  26398. Breaks,
  26399. PrintMedia,
  26400. Splits,
  26401. Counters,
  26402. Lists,
  26403. PositionFixed,
  26404. PageCounterIncrement,
  26405. NthOfType,
  26406. Following
  26407. ];
  26408. class RunningHeaders extends Handler {
  26409. constructor(chunker, polisher, caller) {
  26410. super(chunker, polisher, caller);
  26411. this.runningSelectors = {};
  26412. this.elements = {};
  26413. }
  26414. onDeclaration(declaration, dItem, dList, rule) {
  26415. if (declaration.property === "position") {
  26416. let selector = lib.generate(rule.ruleNode.prelude);
  26417. let identifier = declaration.value.children.first().name;
  26418. if (identifier === "running") {
  26419. let value;
  26420. lib.walk(declaration, {
  26421. visit: "Function",
  26422. enter: (node, item, list) => {
  26423. value = node.children.first().name;
  26424. }
  26425. });
  26426. this.runningSelectors[value] = {
  26427. identifier: identifier,
  26428. value: value,
  26429. selector: selector
  26430. };
  26431. }
  26432. }
  26433. if (declaration.property === "content") {
  26434. lib.walk(declaration, {
  26435. visit: "Function",
  26436. enter: (funcNode, fItem, fList) => {
  26437. if (funcNode.name.indexOf("element") > -1) {
  26438. let selector = lib.generate(rule.ruleNode.prelude);
  26439. let func = funcNode.name;
  26440. let value = funcNode.children.first().name;
  26441. let args = [value];
  26442. // we only handle first for now
  26443. let style = "first";
  26444. selector.split(",").forEach((s) => {
  26445. // remove before / after
  26446. s = s.replace(/::after|::before/, "");
  26447. this.elements[s] = {
  26448. func: func,
  26449. args: args,
  26450. value: value,
  26451. style: style ,
  26452. selector: s,
  26453. fullSelector: selector
  26454. };
  26455. });
  26456. }
  26457. }
  26458. });
  26459. }
  26460. }
  26461. afterParsed(fragment) {
  26462. for (let name of Object.keys(this.runningSelectors)) {
  26463. let set = this.runningSelectors[name];
  26464. let selected = Array.from(fragment.querySelectorAll(set.selector));
  26465. if (set.identifier === "running") {
  26466. for (let header of selected) {
  26467. header.style.display = "none";
  26468. }
  26469. }
  26470. }
  26471. }
  26472. afterPageLayout(fragment) {
  26473. for (let name of Object.keys(this.runningSelectors)) {
  26474. let set = this.runningSelectors[name];
  26475. let selected = fragment.querySelector(set.selector);
  26476. if (selected) {
  26477. // let cssVar;
  26478. if (set.identifier === "running") {
  26479. // cssVar = selected.textContent.replace(/\\([\s\S])|(["|'])/g,"\\$1$2");
  26480. // this.styleSheet.insertRule(`:root { --string-${name}: "${cssVar}"; }`, this.styleSheet.cssRules.length);
  26481. // fragment.style.setProperty(`--string-${name}`, `"${cssVar}"`);
  26482. set.first = selected;
  26483. } else {
  26484. console.warn(set.value + "needs css replacement");
  26485. }
  26486. }
  26487. }
  26488. // move elements
  26489. if (!this.orderedSelectors) {
  26490. this.orderedSelectors = this.orderSelectors(this.elements);
  26491. }
  26492. for (let selector of this.orderedSelectors) {
  26493. if (selector) {
  26494. let el = this.elements[selector];
  26495. let selected = fragment.querySelector(selector);
  26496. if (selected) {
  26497. let running = this.runningSelectors[el.args[0]];
  26498. if (running && running.first) {
  26499. selected.innerHTML = ""; // Clear node
  26500. // selected.classList.add("pagedjs_clear-after"); // Clear ::after
  26501. let clone = running.first.cloneNode(true);
  26502. clone.style.display = null;
  26503. selected.appendChild(clone);
  26504. }
  26505. }
  26506. }
  26507. }
  26508. }
  26509. /**
  26510. * Assign a weight to @page selector classes
  26511. * 1) page
  26512. * 2) left & right
  26513. * 3) blank
  26514. * 4) first & nth
  26515. * 5) named page
  26516. * 6) named left & right
  26517. * 7) named first & nth
  26518. * @param {string} [s] selector string
  26519. * @return {int} weight
  26520. */
  26521. pageWeight(s) {
  26522. let weight = 1;
  26523. let selector = s.split(" ");
  26524. let parts = selector.length && selector[0].split(".");
  26525. parts.shift(); // remove empty first part
  26526. switch (parts.length) {
  26527. case 4:
  26528. if (parts[3] === "pagedjs_first_page") {
  26529. weight = 7;
  26530. } else if (parts[3] === "pagedjs_left_page" || parts[3] === "pagedjs_right_page") {
  26531. weight = 6;
  26532. }
  26533. break;
  26534. case 3:
  26535. if (parts[1] === "pagedjs_named_page") {
  26536. if (parts[2].indexOf(":nth-of-type") > -1) {
  26537. weight = 7;
  26538. } else {
  26539. weight = 5;
  26540. }
  26541. }
  26542. break;
  26543. case 2:
  26544. if (parts[1] === "pagedjs_first_page") {
  26545. weight = 4;
  26546. } else if (parts[1] === "pagedjs_blank_page") {
  26547. weight = 3;
  26548. } else if (parts[1] === "pagedjs_left_page" || parts[1] === "pagedjs_right_page") {
  26549. weight = 2;
  26550. }
  26551. break;
  26552. default:
  26553. if (parts[0].indexOf(":nth-of-type") > -1) {
  26554. weight = 4;
  26555. } else {
  26556. weight = 1;
  26557. }
  26558. }
  26559. return weight;
  26560. }
  26561. /**
  26562. * Orders the selectors based on weight
  26563. *
  26564. * Does not try to deduplicate base on specifity of the selector
  26565. * Previous matched selector will just be overwritten
  26566. * @param {obj} [obj] selectors object
  26567. * @return {Array} orderedSelectors
  26568. */
  26569. orderSelectors(obj) {
  26570. let selectors = Object.keys(obj);
  26571. let weighted = {
  26572. 1: [],
  26573. 2: [],
  26574. 3: [],
  26575. 4: [],
  26576. 5: [],
  26577. 6: [],
  26578. 7: []
  26579. };
  26580. let orderedSelectors = [];
  26581. for (let s of selectors) {
  26582. let w = this.pageWeight(s);
  26583. weighted[w].unshift(s);
  26584. }
  26585. for (var i = 1; i <= 7; i++) {
  26586. orderedSelectors = orderedSelectors.concat(weighted[i]);
  26587. }
  26588. return orderedSelectors;
  26589. }
  26590. beforeTreeParse(text, sheet) {
  26591. // element(x) is parsed as image element selector, so update element to element-ident
  26592. sheet.text = text.replace(/element[\s]*\(([^|^#)]*)\)/g, "element-ident($1)");
  26593. }
  26594. }
  26595. function cleanPseudoContent(el, trim = "\"' ") {
  26596. if(el == null) return;
  26597. return el
  26598. .replace(new RegExp(`^[${trim}]+`), "")
  26599. .replace(new RegExp(`[${trim}]+$`), "")
  26600. .replace(/["']/g, match => {
  26601. return "\\" + match;
  26602. })
  26603. .replace(/[\n]/g, match => {
  26604. return "\\00000A";
  26605. });
  26606. }
  26607. function cleanSelector(el) {
  26608. if(el == null) return;
  26609. return el
  26610. .replace(new RegExp("::footnote-call", "g"), "")
  26611. .replace(new RegExp("::footnote-marker", "g"), "");
  26612. }
  26613. class StringSets extends Handler {
  26614. constructor(chunker, polisher, caller) {
  26615. super(chunker, polisher, caller);
  26616. this.stringSetSelectors = {};
  26617. this.type;
  26618. // pageLastString = last string variable defined on the page
  26619. this.pageLastString;
  26620. }
  26621. onDeclaration(declaration, dItem, dList, rule) {
  26622. if (declaration.property === "string-set") {
  26623. let selector = lib.generate(rule.ruleNode.prelude);
  26624. let identifier = declaration.value.children.first().name;
  26625. let value;
  26626. lib.walk(declaration, {
  26627. visit: "Function",
  26628. enter: (node, item, list) => {
  26629. value = lib.generate(node);
  26630. }
  26631. });
  26632. this.stringSetSelectors[identifier] = {
  26633. identifier,
  26634. value,
  26635. selector
  26636. };
  26637. }
  26638. }
  26639. onContent(funcNode, fItem, fList, declaration, rule) {
  26640. if (funcNode.name === "string") {
  26641. let identifier = funcNode.children && funcNode.children.first().name;
  26642. this.type = funcNode.children.last().name;
  26643. funcNode.name = "var";
  26644. funcNode.children = new lib.List();
  26645. if(this.type === "first" || this.type === "last" || this.type === "start" || this.type === "first-except"){
  26646. funcNode.children.append(
  26647. funcNode.children.createItem({
  26648. type: "Identifier",
  26649. loc: null,
  26650. name: "--pagedjs-string-" + this.type + "-" + identifier
  26651. })
  26652. );
  26653. }else {
  26654. funcNode.children.append(
  26655. funcNode.children.createItem({
  26656. type: "Identifier",
  26657. loc: null,
  26658. name: "--pagedjs-string-first-" + identifier
  26659. })
  26660. );
  26661. }
  26662. }
  26663. }
  26664. afterPageLayout(fragment) {
  26665. if ( this.pageLastString === undefined )
  26666. {
  26667. this.pageLastString = {};
  26668. }
  26669. for (let name of Object.keys(this.stringSetSelectors)) {
  26670. let set = this.stringSetSelectors[name];
  26671. let selected = fragment.querySelectorAll(set.selector);
  26672. // Get the last found string for the current identifier
  26673. let stringPrevPage = ( name in this.pageLastString ) ? this.pageLastString[name] : "";
  26674. let varFirst, varLast, varStart, varFirstExcept;
  26675. if(selected.length == 0){
  26676. // if there is no sel. on the page
  26677. varFirst = stringPrevPage;
  26678. varLast = stringPrevPage;
  26679. varStart = stringPrevPage;
  26680. varFirstExcept = stringPrevPage;
  26681. }else {
  26682. selected.forEach((sel) => {
  26683. // push each content into the array to define in the variable the first and the last element of the page.
  26684. this.pageLastString[name] = selected[selected.length - 1].textContent;
  26685. });
  26686. /* FIRST */
  26687. varFirst = selected[0].textContent;
  26688. /* LAST */
  26689. varLast = selected[selected.length - 1].textContent;
  26690. /* START */
  26691. // Hack to find if the sel. is the first elem of the page / find a better way
  26692. let selTop = selected[0].getBoundingClientRect().top;
  26693. let pageContent = selected[0].closest(".pagedjs_page_content");
  26694. let pageContentTop = pageContent.getBoundingClientRect().top;
  26695. if(selTop == pageContentTop){
  26696. varStart = varFirst;
  26697. }else {
  26698. varStart = stringPrevPage;
  26699. }
  26700. /* FIRST EXCEPT */
  26701. varFirstExcept = "";
  26702. }
  26703. fragment.style.setProperty(`--pagedjs-string-first-${name}`, `"${cleanPseudoContent(varFirst)}`);
  26704. fragment.style.setProperty(`--pagedjs-string-last-${name}`, `"${cleanPseudoContent(varLast)}`);
  26705. fragment.style.setProperty(`--pagedjs-string-start-${name}`, `"${cleanPseudoContent(varStart)}`);
  26706. fragment.style.setProperty(`--pagedjs-string-first-except-${name}`, `"${cleanPseudoContent(varFirstExcept)}`);
  26707. }
  26708. }
  26709. }
  26710. class TargetCounters extends Handler {
  26711. constructor(chunker, polisher, caller) {
  26712. super(chunker, polisher, caller);
  26713. this.styleSheet = polisher.styleSheet;
  26714. this.counterTargets = {};
  26715. }
  26716. onContent(funcNode, fItem, fList, declaration, rule) {
  26717. if (funcNode.name === "target-counter") {
  26718. let selector = lib.generate(rule.ruleNode.prelude);
  26719. let first = funcNode.children.first();
  26720. let func = first.name;
  26721. let value = lib.generate(funcNode);
  26722. let args = [];
  26723. first.children.forEach((child) => {
  26724. if (child.type === "Identifier") {
  26725. args.push(child.name);
  26726. }
  26727. });
  26728. let counter;
  26729. let style;
  26730. let styleIdentifier;
  26731. funcNode.children.forEach((child) => {
  26732. if (child.type === "Identifier") {
  26733. if (!counter) {
  26734. counter = child.name;
  26735. } else if (!style) {
  26736. styleIdentifier = lib.clone(child);
  26737. style = child.name;
  26738. }
  26739. }
  26740. });
  26741. let variable = "target-counter-" + UUID();
  26742. selector.split(",").forEach((s) => {
  26743. this.counterTargets[s] = {
  26744. func: func,
  26745. args: args,
  26746. value: value,
  26747. counter: counter,
  26748. style: style,
  26749. selector: s,
  26750. fullSelector: selector,
  26751. variable: variable
  26752. };
  26753. });
  26754. // Replace with counter
  26755. funcNode.name = "counter";
  26756. funcNode.children = new lib.List();
  26757. funcNode.children.appendData({
  26758. type: "Identifier",
  26759. loc: 0,
  26760. name: variable
  26761. });
  26762. if (styleIdentifier) {
  26763. funcNode.children.appendData({type: "Operator", loc: null, value: ","});
  26764. funcNode.children.appendData(styleIdentifier);
  26765. }
  26766. }
  26767. }
  26768. afterPageLayout(fragment, page, breakToken, chunker) {
  26769. Object.keys(this.counterTargets).forEach((name) => {
  26770. let target = this.counterTargets[name];
  26771. let split = target.selector.split("::");
  26772. let query = split[0];
  26773. let queried = chunker.pagesArea.querySelectorAll(query + ":not([data-" + target.variable + "])");
  26774. queried.forEach((selected, index) => {
  26775. // TODO: handle func other than attr
  26776. if (target.func !== "attr") {
  26777. return;
  26778. }
  26779. let val = attr(selected, target.args);
  26780. let element = chunker.pagesArea.querySelector(querySelectorEscape(val));
  26781. if (element) {
  26782. let selector = UUID();
  26783. selected.setAttribute("data-" + target.variable, selector);
  26784. // TODO: handle other counter types (by query)
  26785. let pseudo = "";
  26786. if (split.length > 1) {
  26787. pseudo += "::" + split[1];
  26788. }
  26789. if (target.counter === "page") {
  26790. let pages = chunker.pagesArea.querySelectorAll(".pagedjs_page");
  26791. let pg = 0;
  26792. for (let i = 0; i < pages.length; i++) {
  26793. let styles = window.getComputedStyle(pages[i]);
  26794. let reset = styles["counter-reset"].replace("page", "").trim();
  26795. let increment = styles["counter-increment"].replace("page", "").trim();
  26796. if (reset !== "none") {
  26797. pg = parseInt(reset);
  26798. }
  26799. if (increment !== "none") {
  26800. pg += parseInt(increment);
  26801. }
  26802. if (pages[i].contains(element)) {
  26803. break;
  26804. }
  26805. }
  26806. this.styleSheet.insertRule(`[data-${target.variable}="${selector}"]${pseudo} { counter-reset: ${target.variable} ${pg}; }`, this.styleSheet.cssRules.length);
  26807. } else {
  26808. let value = element.getAttribute(`data-counter-${target.counter}-value`);
  26809. if (value) {
  26810. this.styleSheet.insertRule(`[data-${target.variable}="${selector}"]${pseudo} { counter-reset: ${target.variable} ${target.variable} ${parseInt(value)}; }`, this.styleSheet.cssRules.length);
  26811. }
  26812. }
  26813. }
  26814. });
  26815. });
  26816. }
  26817. }
  26818. // import { nodeAfter } from "../../utils/dom";
  26819. class TargetText extends Handler {
  26820. constructor(chunker, polisher, caller) {
  26821. super(chunker, polisher, caller);
  26822. this.styleSheet = polisher.styleSheet;
  26823. this.textTargets = {};
  26824. this.beforeContent = "";
  26825. this.afterContent = "";
  26826. this.selector = {};
  26827. }
  26828. onContent(funcNode, fItem, fList, declaration, rule) {
  26829. if (funcNode.name === "target-text") {
  26830. this.selector = lib.generate(rule.ruleNode.prelude);
  26831. let first = funcNode.children.first();
  26832. let last = funcNode.children.last();
  26833. let func = first.name;
  26834. let value = lib.generate(funcNode);
  26835. let args = [];
  26836. first.children.forEach(child => {
  26837. if (child.type === "Identifier") {
  26838. args.push(child.name);
  26839. }
  26840. });
  26841. let style;
  26842. if (last !== first) {
  26843. style = last.name;
  26844. }
  26845. let variable = "--pagedjs-" + UUID();
  26846. this.selector.split(",").forEach(s => {
  26847. this.textTargets[s] = {
  26848. func: func,
  26849. args: args,
  26850. value: value,
  26851. style: style || "content",
  26852. selector: s,
  26853. fullSelector: this.selector,
  26854. variable: variable
  26855. };
  26856. });
  26857. // Replace with variable
  26858. funcNode.name = "var";
  26859. funcNode.children = new lib.List();
  26860. funcNode.children.appendData({
  26861. type: "Identifier",
  26862. loc: 0,
  26863. name: variable
  26864. });
  26865. }
  26866. }
  26867. // parse this on the ONCONTENT : get all before and after and replace the value with a variable
  26868. onPseudoSelector(pseudoNode, pItem, pList, selector, rule) {
  26869. // console.log(pseudoNode);
  26870. // console.log(rule);
  26871. rule.ruleNode.block.children.forEach(properties => {
  26872. if (pseudoNode.name === "before" && properties.property === "content") {
  26873. // let beforeVariable = "--pagedjs-" + UUID();
  26874. let contenu = properties.value.children;
  26875. contenu.forEach(prop => {
  26876. if (prop.type === "String") {
  26877. this.beforeContent = prop.value;
  26878. }
  26879. });
  26880. } else if (pseudoNode.name === "after" && properties.property === "content") {
  26881. properties.value.children.forEach(prop => {
  26882. if (prop.type === "String") {
  26883. this.afterContent = prop.value;
  26884. }
  26885. });
  26886. }
  26887. });
  26888. }
  26889. afterParsed(fragment) {
  26890. Object.keys(this.textTargets).forEach(name => {
  26891. let target = this.textTargets[name];
  26892. let split = target.selector.split("::");
  26893. let query = split[0];
  26894. let queried = fragment.querySelectorAll(query);
  26895. let textContent;
  26896. queried.forEach((selected, index) => {
  26897. let val = attr(selected, target.args);
  26898. let element = fragment.querySelector(querySelectorEscape(val));
  26899. if (element) {
  26900. // content & first-letter & before & after refactorized
  26901. if (target.style) {
  26902. this.selector = UUID();
  26903. selected.setAttribute("data-target-text", this.selector);
  26904. let psuedo = "";
  26905. if (split.length > 1) {
  26906. psuedo += "::" + split[1];
  26907. }
  26908. if (target.style === "before" || target.style === "after") {
  26909. const pseudoType = `${target.style}Content`;
  26910. textContent = cleanPseudoContent(this[pseudoType]);
  26911. } else {
  26912. textContent = cleanPseudoContent(element.textContent, " ");
  26913. }
  26914. textContent = target.style === "first-letter" ? textContent.charAt(0) : textContent;
  26915. this.styleSheet.insertRule(`[data-target-text="${this.selector}"]${psuedo} { ${target.variable}: "${textContent}" }`);
  26916. } else {
  26917. console.warn("missed target", val);
  26918. }
  26919. }
  26920. });
  26921. });
  26922. }
  26923. }
  26924. var generatedContentHandlers = [
  26925. RunningHeaders,
  26926. StringSets,
  26927. TargetCounters,
  26928. TargetText
  26929. ];
  26930. class WhiteSpaceFilter extends Handler {
  26931. constructor(chunker, polisher, caller) {
  26932. super(chunker, polisher, caller);
  26933. }
  26934. filter(content) {
  26935. filterTree(content, (node) => {
  26936. return this.filterEmpty(node);
  26937. }, NodeFilter.SHOW_TEXT);
  26938. }
  26939. filterEmpty(node) {
  26940. if (node.textContent.length > 1 && isIgnorable(node)) {
  26941. // Do not touch the content if text is pre-formatted
  26942. let parent = node.parentNode;
  26943. let pre = isElement(parent) && parent.closest("pre");
  26944. if (pre) {
  26945. return NodeFilter.FILTER_REJECT;
  26946. }
  26947. const previousSibling = previousSignificantNode(node);
  26948. const nextSibling = nextSignificantNode(node);
  26949. if (nextSibling === null && previousSibling === null) {
  26950. // we should not remove a Node that does not have any siblings.
  26951. node.textContent = " ";
  26952. return NodeFilter.FILTER_REJECT;
  26953. }
  26954. if (nextSibling === null) {
  26955. // we can safely remove this node
  26956. return NodeFilter.FILTER_ACCEPT;
  26957. }
  26958. if (previousSibling === null) {
  26959. // we can safely remove this node
  26960. return NodeFilter.FILTER_ACCEPT;
  26961. }
  26962. // replace the content with a single space
  26963. node.textContent = " ";
  26964. // TODO: we also need to preserve sequences of white spaces when the parent has "white-space" rule:
  26965. // pre
  26966. // Sequences of white space are preserved. Lines are only broken at newline characters in the source and at <br> elements.
  26967. //
  26968. // pre-wrap
  26969. // Sequences of white space are preserved. Lines are broken at newline characters, at <br>, and as necessary to fill line boxes.
  26970. //
  26971. // pre-line
  26972. // Sequences of white space are collapsed. Lines are broken at newline characters, at <br>, and as necessary to fill line boxes.
  26973. //
  26974. // break-spaces
  26975. // The behavior is identical to that of pre-wrap, except that:
  26976. // - Any sequence of preserved white space always takes up space, including at the end of the line.
  26977. // - A line breaking opportunity exists after every preserved white space character, including between white space characters.
  26978. // - Such preserved spaces take up space and do not hang, and thus affect the box’s intrinsic sizes (min-content size and max-content size).
  26979. //
  26980. // See: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space#Values
  26981. return NodeFilter.FILTER_REJECT;
  26982. } else {
  26983. return NodeFilter.FILTER_REJECT;
  26984. }
  26985. }
  26986. }
  26987. class CommentsFilter extends Handler {
  26988. constructor(chunker, polisher, caller) {
  26989. super(chunker, polisher, caller);
  26990. }
  26991. filter(content) {
  26992. filterTree(content, null, NodeFilter.SHOW_COMMENT);
  26993. }
  26994. }
  26995. class ScriptsFilter extends Handler {
  26996. constructor(chunker, polisher, caller) {
  26997. super(chunker, polisher, caller);
  26998. }
  26999. filter(content) {
  27000. content.querySelectorAll("script").forEach( script => { script.remove(); });
  27001. }
  27002. }
  27003. var clearCut = createCommonjsModule(function (module, exports) {
  27004. /**
  27005. * Originally ported from https://github.com/keeganstreet/specificity/blob/866bf7ab4e7f62a7179c15b13a95af4e1c7b1afa/specificity.js
  27006. *
  27007. * Calculates the specificity of CSS selectors
  27008. * http://www.w3.org/TR/css3-selectors/#specificity
  27009. *
  27010. * Returns a selector integer value
  27011. */
  27012. // The following regular expressions assume that selectors matching the preceding regular expressions have been removed
  27013. var attributeRegex = /(\[[^\]]+\])/g;
  27014. var idRegex = /(#[^\s\+>~\.\[:]+)/g;
  27015. var classRegex = /(\.[^\s\+>~\.\[:]+)/g;
  27016. var pseudoElementRegex = /(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/g;
  27017. var pseudoClassRegex = /(:[^\s\+>~\.\[:]+)/g;
  27018. var elementRegex = /([^\s\+>~\.\[:]+)/g;
  27019. var notRegex = /:not\(([^\)]*)\)/g;
  27020. var ruleRegex = /\{[^]*/gm;
  27021. var separatorRegex = /[\*\s\+>~]/g;
  27022. var straysRegex = /[#\.]/g;
  27023. // Find matches for a regular expression in a string and push their details to parts
  27024. // Type is "a" for IDs, "b" for classes, attributes and pseudo-classes and "c" for elements and pseudo-elements
  27025. var findMatch = function(regex, type, types, selector) {
  27026. var matches = selector.match(regex);
  27027. if (matches) {
  27028. for (var i = 0; i < matches.length; i++) {
  27029. types[type]++;
  27030. // Replace this simple selector with whitespace so it won't be counted in further simple selectors
  27031. selector = selector.replace(matches[i], ' ');
  27032. }
  27033. }
  27034. return selector;
  27035. };
  27036. // Calculate the specificity for a selector by dividing it into simple selectors and counting them
  27037. var calculate = function(selector) {
  27038. var commaIndex = selector.indexOf(',');
  27039. if (commaIndex !== -1) {
  27040. selector = selector.substring(0, commaIndex);
  27041. }
  27042. var types = {
  27043. a: 0,
  27044. b: 0,
  27045. c: 0
  27046. };
  27047. // Remove the negation psuedo-class (:not) but leave its argument because specificity is calculated on its argument
  27048. selector = selector.replace(notRegex, ' $1 ');
  27049. // Remove anything after a left brace in case a user has pasted in a rule, not just a selector
  27050. selector = selector.replace(ruleRegex, ' ');
  27051. // Add attribute selectors to parts collection (type b)
  27052. selector = findMatch(attributeRegex, 'b', types, selector);
  27053. // Add ID selectors to parts collection (type a)
  27054. selector = findMatch(idRegex, 'a', types, selector);
  27055. // Add class selectors to parts collection (type b)
  27056. selector = findMatch(classRegex, 'b', types, selector);
  27057. // Add pseudo-element selectors to parts collection (type c)
  27058. selector = findMatch(pseudoElementRegex, 'c', types, selector);
  27059. // Add pseudo-class selectors to parts collection (type b)
  27060. selector = findMatch(pseudoClassRegex, 'b', types, selector);
  27061. // Remove universal selector and separator characters
  27062. selector = selector.replace(separatorRegex, ' ');
  27063. // Remove any stray dots or hashes which aren't attached to words
  27064. // These may be present if the user is live-editing this selector
  27065. selector = selector.replace(straysRegex, ' ');
  27066. // The only things left should be element selectors (type c)
  27067. findMatch(elementRegex, 'c', types, selector);
  27068. return (types.a * 100) + (types.b * 10) + (types.c * 1);
  27069. };
  27070. var specificityCache = {};
  27071. exports.calculateSpecificity = function(selector) {
  27072. var specificity = specificityCache[selector];
  27073. if (specificity === undefined) {
  27074. specificity = calculate(selector);
  27075. specificityCache[selector] = specificity;
  27076. }
  27077. return specificity;
  27078. };
  27079. var validSelectorCache = {};
  27080. var testSelectorElement = null;
  27081. exports.isSelectorValid = function(selector) {
  27082. var valid = validSelectorCache[selector];
  27083. if (valid === undefined) {
  27084. if (testSelectorElement == null) {
  27085. testSelectorElement = document.createElement('div');
  27086. }
  27087. try {
  27088. testSelectorElement.querySelector(selector);
  27089. valid = true;
  27090. } catch (error) {
  27091. valid = false;
  27092. }
  27093. validSelectorCache[selector] = valid;
  27094. }
  27095. return valid;
  27096. };
  27097. exports.validateSelector = function(selector) {
  27098. if (!exports.isSelectorValid(selector)) {
  27099. var error = new SyntaxError(selector + ' is not a valid selector');
  27100. error.code = 'EBADSELECTOR';
  27101. throw error;
  27102. }
  27103. };
  27104. });
  27105. var clearCut_1 = clearCut.calculateSpecificity;
  27106. var clearCut_2 = clearCut.isSelectorValid;
  27107. var clearCut_3 = clearCut.validateSelector;
  27108. class UndisplayedFilter extends Handler {
  27109. constructor(chunker, polisher, caller) {
  27110. super(chunker, polisher, caller);
  27111. this.displayRules = {};
  27112. }
  27113. onDeclaration(declaration, dItem, dList, rule) {
  27114. if (declaration.property === "display") {
  27115. let selector = lib.generate(rule.ruleNode.prelude);
  27116. let value = declaration.value.children.first().name;
  27117. selector.split(",").forEach((s) => {
  27118. this.displayRules[s] = {
  27119. value: value,
  27120. selector: s,
  27121. specificity: clearCut_1(s),
  27122. important: declaration.important
  27123. };
  27124. });
  27125. }
  27126. }
  27127. filter(content) {
  27128. let { matches, selectors } = this.sortDisplayedSelectors(content, this.displayRules);
  27129. // Find matching elements that have display styles
  27130. for (let i = 0; i < matches.length; i++) {
  27131. let element = matches[i];
  27132. let selector = selectors[i];
  27133. let displayValue = selector[selector.length-1].value;
  27134. if(this.removable(element) && displayValue === "none") {
  27135. element.dataset.undisplayed = "undisplayed";
  27136. }
  27137. }
  27138. // Find elements that have inline styles
  27139. let styledElements = content.querySelectorAll("[style]");
  27140. for (let i = 0; i < styledElements.length; i++) {
  27141. let element = styledElements[i];
  27142. if (this.removable(element)) {
  27143. element.dataset.undisplayed = "undisplayed";
  27144. }
  27145. }
  27146. }
  27147. sorter(a, b) {
  27148. if (a.important && !b.important) {
  27149. return 1;
  27150. }
  27151. if (b.important && !a.important) {
  27152. return -1;
  27153. }
  27154. return a.specificity - b.specificity;
  27155. }
  27156. sortDisplayedSelectors(content, displayRules=[]) {
  27157. let matches = [];
  27158. let selectors = [];
  27159. for (let d in displayRules) {
  27160. let displayItem = displayRules[d];
  27161. let selector = displayItem.selector;
  27162. let query = [];
  27163. try {
  27164. try {
  27165. query = content.querySelectorAll(selector);
  27166. } catch (e) {
  27167. query = content.querySelectorAll(cleanSelector(selector));
  27168. }
  27169. } catch (e) {
  27170. query = [];
  27171. }
  27172. let elements = Array.from(query);
  27173. for (let e of elements) {
  27174. if (matches.includes(e)) {
  27175. let index = matches.indexOf(e);
  27176. selectors[index].push(displayItem);
  27177. selectors[index] = selectors[index].sort(this.sorter);
  27178. } else {
  27179. matches.push(e);
  27180. selectors.push([displayItem]);
  27181. }
  27182. }
  27183. }
  27184. return { matches, selectors };
  27185. }
  27186. removable(element) {
  27187. if (element.style &&
  27188. element.style.display !== "" &&
  27189. element.style.display !== "none") {
  27190. return false;
  27191. }
  27192. return true;
  27193. }
  27194. }
  27195. var filters = [
  27196. WhiteSpaceFilter,
  27197. CommentsFilter,
  27198. ScriptsFilter,
  27199. UndisplayedFilter
  27200. ];
  27201. var isImplemented$3 = function () {
  27202. var from = Array.from, arr, result;
  27203. if (typeof from !== "function") return false;
  27204. arr = ["raz", "dwa"];
  27205. result = from(arr);
  27206. return Boolean(result && (result !== arr) && (result[1] === "dwa"));
  27207. };
  27208. var validTypes = { object: true, symbol: true };
  27209. var isImplemented$4 = function () {
  27210. var symbol;
  27211. if (typeof Symbol !== 'function') return false;
  27212. symbol = Symbol('test symbol');
  27213. try { String(symbol); } catch (e) { return false; }
  27214. // Return 'true' also for polyfills
  27215. if (!validTypes[typeof Symbol.iterator]) return false;
  27216. if (!validTypes[typeof Symbol.toPrimitive]) return false;
  27217. if (!validTypes[typeof Symbol.toStringTag]) return false;
  27218. return true;
  27219. };
  27220. var isSymbol = function (x) {
  27221. if (!x) return false;
  27222. if (typeof x === 'symbol') return true;
  27223. if (!x.constructor) return false;
  27224. if (x.constructor.name !== 'Symbol') return false;
  27225. return (x[x.constructor.toStringTag] === 'Symbol');
  27226. };
  27227. var validateSymbol = function (value) {
  27228. if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
  27229. return value;
  27230. };
  27231. var create$6 = Object.create, defineProperties = Object.defineProperties
  27232. , defineProperty = Object.defineProperty, objPrototype = Object.prototype
  27233. , NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create$6(null)
  27234. , isNativeSafe;
  27235. if (typeof Symbol === 'function') {
  27236. NativeSymbol = Symbol;
  27237. try {
  27238. String(NativeSymbol());
  27239. isNativeSafe = true;
  27240. } catch (ignore) {}
  27241. }
  27242. var generateName = (function () {
  27243. var created = create$6(null);
  27244. return function (desc) {
  27245. var postfix = 0, name, ie11BugWorkaround;
  27246. while (created[desc + (postfix || '')]) ++postfix;
  27247. desc += (postfix || '');
  27248. created[desc] = true;
  27249. name = '@@' + desc;
  27250. defineProperty(objPrototype, name, d_1.gs(null, function (value) {
  27251. // For IE11 issue see:
  27252. // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/
  27253. // ie11-broken-getters-on-dom-objects
  27254. // https://github.com/medikoo/es6-symbol/issues/12
  27255. if (ie11BugWorkaround) return;
  27256. ie11BugWorkaround = true;
  27257. defineProperty(this, name, d_1(value));
  27258. ie11BugWorkaround = false;
  27259. }));
  27260. return name;
  27261. };
  27262. }());
  27263. // Internal constructor (not one exposed) for creating Symbol instances.
  27264. // This one is used to ensure that `someSymbol instanceof Symbol` always return false
  27265. HiddenSymbol = function Symbol(description) {
  27266. if (this instanceof HiddenSymbol) throw new TypeError('Symbol is not a constructor');
  27267. return SymbolPolyfill(description);
  27268. };
  27269. // Exposed `Symbol` constructor
  27270. // (returns instances of HiddenSymbol)
  27271. var polyfill = SymbolPolyfill = function Symbol(description) {
  27272. var symbol;
  27273. if (this instanceof Symbol) throw new TypeError('Symbol is not a constructor');
  27274. if (isNativeSafe) return NativeSymbol(description);
  27275. symbol = create$6(HiddenSymbol.prototype);
  27276. description = (description === undefined ? '' : String(description));
  27277. return defineProperties(symbol, {
  27278. __description__: d_1('', description),
  27279. __name__: d_1('', generateName(description))
  27280. });
  27281. };
  27282. defineProperties(SymbolPolyfill, {
  27283. for: d_1(function (key) {
  27284. if (globalSymbols[key]) return globalSymbols[key];
  27285. return (globalSymbols[key] = SymbolPolyfill(String(key)));
  27286. }),
  27287. keyFor: d_1(function (s) {
  27288. var key;
  27289. validateSymbol(s);
  27290. for (key in globalSymbols) if (globalSymbols[key] === s) return key;
  27291. }),
  27292. // To ensure proper interoperability with other native functions (e.g. Array.from)
  27293. // fallback to eventual native implementation of given symbol
  27294. hasInstance: d_1('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')),
  27295. isConcatSpreadable: d_1('', (NativeSymbol && NativeSymbol.isConcatSpreadable) ||
  27296. SymbolPolyfill('isConcatSpreadable')),
  27297. iterator: d_1('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')),
  27298. match: d_1('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')),
  27299. replace: d_1('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')),
  27300. search: d_1('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')),
  27301. species: d_1('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')),
  27302. split: d_1('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')),
  27303. toPrimitive: d_1('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')),
  27304. toStringTag: d_1('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')),
  27305. unscopables: d_1('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables'))
  27306. });
  27307. // Internal tweaks for real symbol producer
  27308. defineProperties(HiddenSymbol.prototype, {
  27309. constructor: d_1(SymbolPolyfill),
  27310. toString: d_1('', function () { return this.__name__; })
  27311. });
  27312. // Proper implementation of methods exposed on Symbol.prototype
  27313. // They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype
  27314. defineProperties(SymbolPolyfill.prototype, {
  27315. toString: d_1(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),
  27316. valueOf: d_1(function () { return validateSymbol(this); })
  27317. });
  27318. defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d_1('', function () {
  27319. var symbol = validateSymbol(this);
  27320. if (typeof symbol === 'symbol') return symbol;
  27321. return symbol.toString();
  27322. }));
  27323. defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d_1('c', 'Symbol'));
  27324. // Proper implementaton of toPrimitive and toStringTag for returned symbol instances
  27325. defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag,
  27326. d_1('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));
  27327. // Note: It's important to define `toPrimitive` as last one, as some implementations
  27328. // implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)
  27329. // And that may invoke error in definition flow:
  27330. // See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149
  27331. defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive,
  27332. d_1('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));
  27333. var es6Symbol = isImplemented$4() ? Symbol : polyfill;
  27334. var objToString = Object.prototype.toString
  27335. , id = objToString.call(
  27336. (function () {
  27337. return arguments;
  27338. })()
  27339. );
  27340. var isArguments = function (value) {
  27341. return objToString.call(value) === id;
  27342. };
  27343. var objToString$1 = Object.prototype.toString, id$1 = objToString$1.call(noop);
  27344. var isFunction = function (value) {
  27345. return typeof value === "function" && objToString$1.call(value) === id$1;
  27346. };
  27347. var isImplemented$5 = function () {
  27348. var sign = Math.sign;
  27349. if (typeof sign !== "function") return false;
  27350. return (sign(10) === 1) && (sign(-20) === -1);
  27351. };
  27352. var shim$3 = function (value) {
  27353. value = Number(value);
  27354. if (isNaN(value) || (value === 0)) return value;
  27355. return value > 0 ? 1 : -1;
  27356. };
  27357. var sign = isImplemented$5()
  27358. ? Math.sign
  27359. : shim$3;
  27360. var abs = Math.abs, floor = Math.floor;
  27361. var toInteger = function (value) {
  27362. if (isNaN(value)) return 0;
  27363. value = Number(value);
  27364. if ((value === 0) || !isFinite(value)) return value;
  27365. return sign(value) * floor(abs(value));
  27366. };
  27367. var max$1 = Math.max;
  27368. var toPosInteger = function (value) {
  27369. return max$1(0, toInteger(value));
  27370. };
  27371. var objToString$2 = Object.prototype.toString, id$2 = objToString$2.call("");
  27372. var isString = function (value) {
  27373. return (
  27374. typeof value === "string" ||
  27375. (value &&
  27376. typeof value === "object" &&
  27377. (value instanceof String || objToString$2.call(value) === id$2)) ||
  27378. false
  27379. );
  27380. };
  27381. var iteratorSymbol = es6Symbol.iterator
  27382. , isArray = Array.isArray
  27383. , call = Function.prototype.call
  27384. , desc = { configurable: true, enumerable: true, writable: true, value: null }
  27385. , defineProperty$1 = Object.defineProperty;
  27386. // eslint-disable-next-line complexity
  27387. var shim$4 = function (arrayLike /*, mapFn, thisArg*/) {
  27388. var mapFn = arguments[1]
  27389. , thisArg = arguments[2]
  27390. , Context
  27391. , i
  27392. , j
  27393. , arr
  27394. , length
  27395. , code
  27396. , iterator
  27397. , result
  27398. , getIterator
  27399. , value;
  27400. arrayLike = Object(validValue(arrayLike));
  27401. if (isValue(mapFn)) validCallable(mapFn);
  27402. if (!this || this === Array || !isFunction(this)) {
  27403. // Result: Plain array
  27404. if (!mapFn) {
  27405. if (isArguments(arrayLike)) {
  27406. // Source: Arguments
  27407. length = arrayLike.length;
  27408. if (length !== 1) return Array.apply(null, arrayLike);
  27409. arr = new Array(1);
  27410. arr[0] = arrayLike[0];
  27411. return arr;
  27412. }
  27413. if (isArray(arrayLike)) {
  27414. // Source: Array
  27415. arr = new Array(length = arrayLike.length);
  27416. for (i = 0; i < length; ++i) arr[i] = arrayLike[i];
  27417. return arr;
  27418. }
  27419. }
  27420. arr = [];
  27421. } else {
  27422. // Result: Non plain array
  27423. Context = this;
  27424. }
  27425. if (!isArray(arrayLike)) {
  27426. if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) {
  27427. // Source: Iterator
  27428. iterator = validCallable(getIterator).call(arrayLike);
  27429. if (Context) arr = new Context();
  27430. result = iterator.next();
  27431. i = 0;
  27432. while (!result.done) {
  27433. value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value;
  27434. if (Context) {
  27435. desc.value = value;
  27436. defineProperty$1(arr, i, desc);
  27437. } else {
  27438. arr[i] = value;
  27439. }
  27440. result = iterator.next();
  27441. ++i;
  27442. }
  27443. length = i;
  27444. } else if (isString(arrayLike)) {
  27445. // Source: String
  27446. length = arrayLike.length;
  27447. if (Context) arr = new Context();
  27448. for (i = 0, j = 0; i < length; ++i) {
  27449. value = arrayLike[i];
  27450. if (i + 1 < length) {
  27451. code = value.charCodeAt(0);
  27452. // eslint-disable-next-line max-depth
  27453. if (code >= 0xd800 && code <= 0xdbff) value += arrayLike[++i];
  27454. }
  27455. value = mapFn ? call.call(mapFn, thisArg, value, j) : value;
  27456. if (Context) {
  27457. desc.value = value;
  27458. defineProperty$1(arr, j, desc);
  27459. } else {
  27460. arr[j] = value;
  27461. }
  27462. ++j;
  27463. }
  27464. length = j;
  27465. }
  27466. }
  27467. if (length === undefined) {
  27468. // Source: array or array-like
  27469. length = toPosInteger(arrayLike.length);
  27470. if (Context) arr = new Context(length);
  27471. for (i = 0; i < length; ++i) {
  27472. value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i];
  27473. if (Context) {
  27474. desc.value = value;
  27475. defineProperty$1(arr, i, desc);
  27476. } else {
  27477. arr[i] = value;
  27478. }
  27479. }
  27480. }
  27481. if (Context) {
  27482. desc.value = null;
  27483. arr.length = length;
  27484. }
  27485. return arr;
  27486. };
  27487. var from_1 = isImplemented$3()
  27488. ? Array.from
  27489. : shim$4;
  27490. var isImplemented$6 = function () {
  27491. var numberIsNaN = Number.isNaN;
  27492. if (typeof numberIsNaN !== "function") return false;
  27493. return !numberIsNaN({}) && numberIsNaN(NaN) && !numberIsNaN(34);
  27494. };
  27495. var shim$5 = function (value) {
  27496. // eslint-disable-next-line no-self-compare
  27497. return value !== value;
  27498. };
  27499. var isNan = isImplemented$6()
  27500. ? Number.isNaN
  27501. : shim$5;
  27502. var indexOf$2 = Array.prototype.indexOf
  27503. , objHasOwnProperty = Object.prototype.hasOwnProperty
  27504. , abs$1 = Math.abs
  27505. , floor$1 = Math.floor;
  27506. var eIndexOf = function (searchElement /*, fromIndex*/) {
  27507. var i, length, fromIndex, val;
  27508. if (!isNan(searchElement)) return indexOf$2.apply(this, arguments);
  27509. length = toPosInteger(validValue(this).length);
  27510. fromIndex = arguments[1];
  27511. if (isNaN(fromIndex)) fromIndex = 0;
  27512. else if (fromIndex >= 0) fromIndex = floor$1(fromIndex);
  27513. else fromIndex = toPosInteger(this.length) - floor$1(abs$1(fromIndex));
  27514. for (i = fromIndex; i < length; ++i) {
  27515. if (objHasOwnProperty.call(this, i)) {
  27516. val = this[i];
  27517. if (isNan(val)) return i; // Jslint: ignore
  27518. }
  27519. }
  27520. return -1;
  27521. };
  27522. var forEach$1 = Array.prototype.forEach
  27523. , splice = Array.prototype.splice;
  27524. // eslint-disable-next-line no-unused-vars
  27525. var remove = function (itemToRemove /*, …item*/) {
  27526. forEach$1.call(
  27527. arguments,
  27528. function (item) {
  27529. var index = eIndexOf.call(this, item);
  27530. if (index !== -1) splice.call(this, index, 1);
  27531. },
  27532. this
  27533. );
  27534. };
  27535. var map = { function: true, object: true };
  27536. var isObject$1 = function (value) {
  27537. return (isValue(value) && map[typeof value]) || false;
  27538. };
  27539. var validObject = function (value) {
  27540. if (!isObject$1(value)) throw new TypeError(value + " is not an Object");
  27541. return value;
  27542. };
  27543. var emit = eventEmitter.methods.emit
  27544. , defineProperty$2 = Object.defineProperty
  27545. , hasOwnProperty$6 = Object.prototype.hasOwnProperty
  27546. , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  27547. var pipe = function (e1, e2/*, name*/) {
  27548. var pipes, pipe, desc, name;
  27549. (validObject(e1) && validObject(e2));
  27550. name = arguments[2];
  27551. if (name === undefined) name = 'emit';
  27552. pipe = {
  27553. close: function () { remove.call(pipes, e2); }
  27554. };
  27555. if (hasOwnProperty$6.call(e1, '__eePipes__')) {
  27556. (pipes = e1.__eePipes__).push(e2);
  27557. return pipe;
  27558. }
  27559. defineProperty$2(e1, '__eePipes__', d_1('c', pipes = [e2]));
  27560. desc = getOwnPropertyDescriptor(e1, name);
  27561. if (!desc) {
  27562. desc = d_1('c', undefined);
  27563. } else {
  27564. delete desc.get;
  27565. delete desc.set;
  27566. }
  27567. desc.value = function () {
  27568. var i, emitter, data = from_1(pipes);
  27569. emit.apply(this, arguments);
  27570. for (i = 0; (emitter = data[i]); ++i) emit.apply(emitter, arguments);
  27571. };
  27572. defineProperty$2(e1, name, desc);
  27573. return pipe;
  27574. };
  27575. let registeredHandlers = [...pagedMediaHandlers, ...generatedContentHandlers, ...filters];
  27576. class Handlers {
  27577. constructor(chunker, polisher, caller) {
  27578. registeredHandlers.forEach((Handler) => {
  27579. let handler = new Handler(chunker, polisher, caller);
  27580. pipe(handler, this);
  27581. });
  27582. }
  27583. }
  27584. eventEmitter(Handlers.prototype);
  27585. function registerHandlers() {
  27586. for (var i = 0; i < arguments.length; i++) {
  27587. registeredHandlers.push(arguments[i]);
  27588. }
  27589. }
  27590. function initializeHandlers(chunker, polisher, caller) {
  27591. let handlers = new Handlers(chunker, polisher, caller);
  27592. return handlers;
  27593. }
  27594. class Previewer {
  27595. constructor(options) {
  27596. // this.preview = this.getParams("preview") !== "false";
  27597. this.settings = options || {};
  27598. // Process styles
  27599. this.polisher = new Polisher(false);
  27600. // Chunk contents
  27601. this.chunker = new Chunker(undefined, undefined, this.settings);
  27602. // Hooks
  27603. this.hooks = {};
  27604. this.hooks.beforePreview = new Hook(this);
  27605. this.hooks.afterPreview = new Hook(this);
  27606. // default size
  27607. this.size = {
  27608. width: {
  27609. value: 8.5,
  27610. unit: "in"
  27611. },
  27612. height: {
  27613. value: 11,
  27614. unit: "in"
  27615. },
  27616. format: undefined,
  27617. orientation: undefined
  27618. };
  27619. this.chunker.on("page", (page) => {
  27620. this.emit("page", page);
  27621. });
  27622. this.chunker.on("rendering", () => {
  27623. this.emit("rendering", this.chunker);
  27624. });
  27625. }
  27626. initializeHandlers() {
  27627. let handlers = initializeHandlers(this.chunker, this.polisher, this);
  27628. handlers.on("size", (size) => {
  27629. this.size = size;
  27630. this.emit("size", size);
  27631. });
  27632. handlers.on("atpages", (pages) => {
  27633. this.atpages = pages;
  27634. this.emit("atpages", pages);
  27635. });
  27636. return handlers;
  27637. }
  27638. registerHandlers() {
  27639. return registerHandlers.apply(registerHandlers, arguments);
  27640. }
  27641. getParams(name) {
  27642. let param;
  27643. let url = new URL(window.location);
  27644. let params = new URLSearchParams(url.search);
  27645. for(var pair of params.entries()) {
  27646. if(pair[0] === name) {
  27647. param = pair[1];
  27648. }
  27649. }
  27650. return param;
  27651. }
  27652. wrapContent() {
  27653. // Wrap body in template tag
  27654. let body = document.querySelector("body");
  27655. // Check if a template exists
  27656. let template;
  27657. template = body.querySelector(":scope > template[data-ref='pagedjs-content']");
  27658. if (!template) {
  27659. // Otherwise create one
  27660. template = document.createElement("template");
  27661. template.dataset.ref = "pagedjs-content";
  27662. template.innerHTML = body.innerHTML;
  27663. body.innerHTML = "";
  27664. body.appendChild(template);
  27665. }
  27666. return template.content;
  27667. }
  27668. removeStyles(doc=document) {
  27669. // Get all stylesheets
  27670. let stylesheets = Array.from(doc.querySelectorAll("link[rel='stylesheet']"));
  27671. let hrefs = stylesheets.map((sheet) => {
  27672. sheet.remove();
  27673. return sheet.href;
  27674. });
  27675. // Get inline styles
  27676. let inlineStyles = Array.from(doc.querySelectorAll("style:not([data-pagedjs-inserted-styles])"));
  27677. inlineStyles.forEach((inlineStyle) => {
  27678. let obj = {};
  27679. obj[window.location.href] = inlineStyle.textContent;
  27680. hrefs.push(obj);
  27681. inlineStyle.remove();
  27682. });
  27683. return hrefs;
  27684. }
  27685. async preview(content, stylesheets, renderTo) {
  27686. await this.hooks.beforePreview.trigger(content, renderTo);
  27687. if (!content) {
  27688. content = this.wrapContent();
  27689. }
  27690. if (!stylesheets) {
  27691. stylesheets = this.removeStyles();
  27692. }
  27693. this.polisher.setup();
  27694. this.handlers = this.initializeHandlers();
  27695. await this.polisher.add(...stylesheets);
  27696. let startTime = performance.now();
  27697. // Render flow
  27698. let flow = await this.chunker.flow(content, renderTo);
  27699. let endTime = performance.now();
  27700. flow.performance = (endTime - startTime);
  27701. flow.size = this.size;
  27702. this.emit("rendered", flow);
  27703. await this.hooks.afterPreview.trigger(flow.pages);
  27704. return flow;
  27705. }
  27706. }
  27707. eventEmitter(Previewer.prototype);
  27708. var Paged = /*#__PURE__*/Object.freeze({
  27709. __proto__: null,
  27710. Chunker: Chunker,
  27711. Polisher: Polisher,
  27712. Previewer: Previewer,
  27713. Handler: Handler,
  27714. registerHandlers: registerHandlers,
  27715. initializeHandlers: initializeHandlers
  27716. });
  27717. window.Paged = Paged;
  27718. let ready = new Promise(function(resolve, reject){
  27719. if (document.readyState === "interactive" || document.readyState === "complete") {
  27720. resolve(document.readyState);
  27721. return;
  27722. }
  27723. document.onreadystatechange = function ($) {
  27724. if (document.readyState === "interactive") {
  27725. resolve(document.readyState);
  27726. }
  27727. };
  27728. });
  27729. let config = window.PagedConfig || {
  27730. auto: true,
  27731. before: undefined,
  27732. after: undefined,
  27733. content: undefined,
  27734. stylesheets: undefined,
  27735. renderTo: undefined,
  27736. settings: undefined
  27737. };
  27738. let previewer = new Previewer(config.settings);
  27739. ready.then(async function () {
  27740. let done;
  27741. if (config.before) {
  27742. await config.before();
  27743. }
  27744. if(config.auto !== false) {
  27745. done = await previewer.preview(config.content, config.stylesheets, config.renderTo);
  27746. }
  27747. if (config.after) {
  27748. await config.after(done);
  27749. }
  27750. });
  27751. return previewer;
  27752. })));